@fjell/core 4.4.2 → 4.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.kodrdriv/config.yaml +10 -0
- package/.kodrdriv/context/content.md +1 -0
- package/dist/cjs/AItemService.js +42 -0
- package/dist/cjs/AItemService.js.map +1 -0
- package/dist/cjs/dictionary.js +71 -0
- package/dist/cjs/dictionary.js.map +1 -0
- package/dist/cjs/index.js +57 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/item/IFactory.js +93 -0
- package/dist/cjs/item/IFactory.js.map +1 -0
- package/dist/cjs/item/IQFactory.js +154 -0
- package/dist/cjs/item/IQFactory.js.map +1 -0
- package/dist/cjs/item/IQUtils.js +316 -0
- package/dist/cjs/item/IQUtils.js.map +1 -0
- package/dist/cjs/item/IUtils.js +84 -0
- package/dist/cjs/item/IUtils.js.map +1 -0
- package/dist/cjs/item/ItemQuery.js +10 -0
- package/dist/cjs/item/ItemQuery.js.map +1 -0
- package/dist/cjs/key/KUtils.js +298 -0
- package/dist/cjs/key/KUtils.js.map +1 -0
- package/dist/cjs/logger.js +10 -0
- package/dist/cjs/logger.js.map +1 -0
- package/dist/esm/AItemService.js.map +1 -0
- package/dist/esm/dictionary.js.map +1 -0
- package/dist/esm/item/IFactory.js.map +1 -0
- package/dist/esm/item/IQFactory.js.map +1 -0
- package/dist/esm/item/IQUtils.js.map +1 -0
- package/dist/esm/item/IUtils.js.map +1 -0
- package/dist/esm/item/ItemQuery.js.map +1 -0
- package/dist/esm/key/KUtils.js.map +1 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/index.cjs +1021 -0
- package/dist/index.cjs.map +1 -0
- package/package.json +22 -21
- package/vitest.config.ts +37 -0
- package/dist/AItemService.js.map +0 -1
- package/dist/dictionary.js.map +0 -1
- package/dist/item/IFactory.js.map +0 -1
- package/dist/item/IQFactory.js.map +0 -1
- package/dist/item/IQUtils.js.map +0 -1
- package/dist/item/IUtils.js.map +0 -1
- package/dist/item/ItemQuery.js.map +0 -1
- package/dist/key/KUtils.js.map +0 -1
- package/dist/logger.js.map +0 -1
- /package/dist/{AItemService.js → esm/AItemService.js} +0 -0
- /package/dist/{dictionary.js → esm/dictionary.js} +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{index.js.map → esm/index.js.map} +0 -0
- /package/dist/{item → esm/item}/IFactory.js +0 -0
- /package/dist/{item → esm/item}/IQFactory.js +0 -0
- /package/dist/{item → esm/item}/IQUtils.js +0 -0
- /package/dist/{item → esm/item}/IUtils.js +0 -0
- /package/dist/{item → esm/item}/ItemQuery.js +0 -0
- /package/dist/{key → esm/key}/KUtils.js +0 -0
- /package/dist/{logger.js → esm/logger.js} +0 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const KUtils = require('../key/KUtils.js');
|
|
6
|
+
const logger$1 = require('../logger.js');
|
|
7
|
+
const luxon = require('luxon');
|
|
8
|
+
const ItemQuery = require('./ItemQuery.js');
|
|
9
|
+
|
|
10
|
+
const logger = logger$1.default.get('IQUtils');
|
|
11
|
+
/**
|
|
12
|
+
* When we query or search, we're sending a GET request. This converts everything in ItemQuery into a flat
|
|
13
|
+
* object that can be sent over a GET request.
|
|
14
|
+
*
|
|
15
|
+
* Note that there is some discussion about this. Evidently Elastic supports search with POST, but that also
|
|
16
|
+
* feels like a bit of a hack. It's not a RESTful way to do things. So we're sticking with GET for now.
|
|
17
|
+
*
|
|
18
|
+
* For reference, look at RFC 9110 "HTTP Semantics", June which clarified on top of and RFC 7231. It's possible
|
|
19
|
+
* but there are so many caveats and conditions in the standard, it's not worth it.
|
|
20
|
+
*
|
|
21
|
+
* Anticipating the next question - "isn't there a limit to the length of a URL?" The specification does not
|
|
22
|
+
* specify a limit, and there are limits in various browsers and servers - Apache is 4,000 chars, Chrome is 2M chars.
|
|
23
|
+
* Short answer is that if this query is being used to craft something that complex, it is probably a better idea
|
|
24
|
+
* to provide an action or a custom query endpoint on the server.
|
|
25
|
+
*
|
|
26
|
+
* @param query
|
|
27
|
+
* @returns QueryParams ready to be get over a GET request.
|
|
28
|
+
*/ const queryToParams = (query)=>{
|
|
29
|
+
const params = {};
|
|
30
|
+
if (query.compoundCondition) {
|
|
31
|
+
params.compoundCondition = JSON.stringify(query.compoundCondition);
|
|
32
|
+
}
|
|
33
|
+
if (query.refs) {
|
|
34
|
+
params.refs = JSON.stringify(query.refs);
|
|
35
|
+
}
|
|
36
|
+
if (query.limit) {
|
|
37
|
+
params.limit = query.limit;
|
|
38
|
+
}
|
|
39
|
+
if (query.offset) {
|
|
40
|
+
params.offset = query.offset;
|
|
41
|
+
}
|
|
42
|
+
if (query.aggs) {
|
|
43
|
+
params.aggs = JSON.stringify(query.aggs);
|
|
44
|
+
}
|
|
45
|
+
if (query.events) {
|
|
46
|
+
params.events = JSON.stringify(query.events);
|
|
47
|
+
}
|
|
48
|
+
return params;
|
|
49
|
+
};
|
|
50
|
+
// This is a dateTimeReviver used for JSON parse - when we convert a param back to a query, we need this.
|
|
51
|
+
const dateTimeReviver = function(key, value) {
|
|
52
|
+
if (typeof value === 'string') {
|
|
53
|
+
const parsedDate = luxon.DateTime.fromISO(value);
|
|
54
|
+
if (parsedDate.isValid) {
|
|
55
|
+
return parsedDate.toJSDate();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* This method translates from a flat QueryParams object with stringify'd JSON back to a full ItemQuery.
|
|
62
|
+
*
|
|
63
|
+
* @param params Parameters sent over a GET request
|
|
64
|
+
* @returns A fully hydrated ItemQuery object.
|
|
65
|
+
*/ const paramsToQuery = (params)=>{
|
|
66
|
+
const query = {};
|
|
67
|
+
if (params.compoundCondition) {
|
|
68
|
+
query.compoundCondition = JSON.parse(params.compoundCondition);
|
|
69
|
+
}
|
|
70
|
+
if (params.refs) {
|
|
71
|
+
query.refs = JSON.parse(params.refs);
|
|
72
|
+
}
|
|
73
|
+
if (params.limit) {
|
|
74
|
+
query.limit = Number(params.limit);
|
|
75
|
+
}
|
|
76
|
+
if (params.offset) {
|
|
77
|
+
query.offset = Number(params.offset);
|
|
78
|
+
}
|
|
79
|
+
if (params.aggs) {
|
|
80
|
+
query.aggs = JSON.parse(params.aggs);
|
|
81
|
+
}
|
|
82
|
+
if (params.events) {
|
|
83
|
+
query.events = JSON.parse(params.events, dateTimeReviver);
|
|
84
|
+
}
|
|
85
|
+
return query;
|
|
86
|
+
};
|
|
87
|
+
const isRefQueryMatch = (refKey, queryRef, references)=>{
|
|
88
|
+
logger.trace('doesRefMatch', {
|
|
89
|
+
queryRef,
|
|
90
|
+
references
|
|
91
|
+
});
|
|
92
|
+
logger.debug('Comparing Ref', {
|
|
93
|
+
refKey,
|
|
94
|
+
itemRef: references[refKey],
|
|
95
|
+
queryRef
|
|
96
|
+
});
|
|
97
|
+
return KUtils.isItemKeyEqual(queryRef, references[refKey]);
|
|
98
|
+
};
|
|
99
|
+
const isCompoundConditionQueryMatch = (queryCondition, item)=>{
|
|
100
|
+
if (queryCondition.compoundType === 'AND') {
|
|
101
|
+
// If this is an AND compound condition, we need to check if all of the conditions match
|
|
102
|
+
return queryCondition.conditions.every((condition)=>ItemQuery.isCondition(condition) ? isConditionQueryMatch(condition, item) : isCompoundConditionQueryMatch(condition, item));
|
|
103
|
+
} else {
|
|
104
|
+
// If this is an OR compound condition, we need to check if any of the conditions match
|
|
105
|
+
return queryCondition.conditions.some((condition)=>ItemQuery.isCondition(condition) ? isConditionQueryMatch(condition, item) : isCompoundConditionQueryMatch(condition, item));
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const isConditionQueryMatch = (queryCondition, item)=>{
|
|
109
|
+
const propKey = queryCondition.column;
|
|
110
|
+
logger.trace('doesConditionMatch', {
|
|
111
|
+
propKey,
|
|
112
|
+
queryCondition,
|
|
113
|
+
item
|
|
114
|
+
});
|
|
115
|
+
// eslint-disable-next-line no-undefined
|
|
116
|
+
if (item[propKey] === undefined) {
|
|
117
|
+
logger.debug('Item does not contain prop under key', {
|
|
118
|
+
propKey,
|
|
119
|
+
item
|
|
120
|
+
});
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
logger.debug('Comparing Condition', {
|
|
124
|
+
propKey,
|
|
125
|
+
itemProp: item[propKey],
|
|
126
|
+
queryCondition
|
|
127
|
+
});
|
|
128
|
+
let result = false;
|
|
129
|
+
switch(queryCondition.operator){
|
|
130
|
+
case '==':
|
|
131
|
+
result = item[propKey] === queryCondition.value;
|
|
132
|
+
break;
|
|
133
|
+
case '!=':
|
|
134
|
+
result = item[propKey] !== queryCondition.value;
|
|
135
|
+
break;
|
|
136
|
+
case '>':
|
|
137
|
+
result = item[propKey] > queryCondition.value;
|
|
138
|
+
break;
|
|
139
|
+
case '>=':
|
|
140
|
+
result = item[propKey] >= queryCondition.value;
|
|
141
|
+
break;
|
|
142
|
+
case '<':
|
|
143
|
+
result = item[propKey] < queryCondition.value;
|
|
144
|
+
break;
|
|
145
|
+
case '<=':
|
|
146
|
+
result = item[propKey] <= queryCondition.value;
|
|
147
|
+
break;
|
|
148
|
+
case 'in':
|
|
149
|
+
result = queryCondition.value.includes(item[propKey]);
|
|
150
|
+
break;
|
|
151
|
+
case 'not-in':
|
|
152
|
+
result = !queryCondition.value.includes(item[propKey]);
|
|
153
|
+
break;
|
|
154
|
+
case 'array-contains':
|
|
155
|
+
result = item[propKey].includes(queryCondition.value);
|
|
156
|
+
break;
|
|
157
|
+
case 'array-contains-any':
|
|
158
|
+
result = queryCondition.value.some((value)=>item[propKey].includes(value));
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
return result;
|
|
162
|
+
};
|
|
163
|
+
const isAggQueryMatch = (aggKey, aggQuery, agg)=>{
|
|
164
|
+
const aggItem = agg.item;
|
|
165
|
+
logger.debug('Comparing Agg', {
|
|
166
|
+
aggKey,
|
|
167
|
+
aggItem,
|
|
168
|
+
aggQuery
|
|
169
|
+
});
|
|
170
|
+
// Fancy, right? This is a recursive call to isQueryMatch
|
|
171
|
+
return isQueryMatch(aggItem, aggQuery);
|
|
172
|
+
};
|
|
173
|
+
const isEventQueryMatch = (eventKey, eventQuery, item)=>{
|
|
174
|
+
if (!item.events[eventKey]) {
|
|
175
|
+
logger.debug('Item does not contain event under key', {
|
|
176
|
+
eventKey,
|
|
177
|
+
events: item.events
|
|
178
|
+
});
|
|
179
|
+
return false;
|
|
180
|
+
} else {
|
|
181
|
+
const itemEvent = item.events[eventKey];
|
|
182
|
+
if (itemEvent.at !== null) {
|
|
183
|
+
if (eventQuery.start && !(eventQuery.start.getTime() <= itemEvent.at.getTime())) {
|
|
184
|
+
logger.debug('Item date before event start query', {
|
|
185
|
+
eventQuery,
|
|
186
|
+
itemEvent
|
|
187
|
+
});
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
if (eventQuery.end && !(eventQuery.end.getTime() > itemEvent.at.getTime())) {
|
|
191
|
+
logger.debug('Item date after event end query', {
|
|
192
|
+
eventQuery,
|
|
193
|
+
itemEvent
|
|
194
|
+
});
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
logger.debug('Item event does contains a null at', {
|
|
199
|
+
itemEvent
|
|
200
|
+
});
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const isQueryMatch = (item, query)=>{
|
|
207
|
+
logger.trace('isMatch', {
|
|
208
|
+
item,
|
|
209
|
+
query
|
|
210
|
+
});
|
|
211
|
+
if (query.refs && item.refs) {
|
|
212
|
+
for(const key in query.refs){
|
|
213
|
+
const queryRef = query.refs[key];
|
|
214
|
+
if (!isRefQueryMatch(key, queryRef, item.refs)) return false;
|
|
215
|
+
}
|
|
216
|
+
} else if (query.refs && !item.refs) {
|
|
217
|
+
logger.debug('Query contains refs but item does not have refs', {
|
|
218
|
+
query,
|
|
219
|
+
item
|
|
220
|
+
});
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
if (query.compoundCondition && item) {
|
|
224
|
+
if (!isCompoundConditionQueryMatch(query.compoundCondition, item)) return false;
|
|
225
|
+
}
|
|
226
|
+
if (query.events && item.events) {
|
|
227
|
+
for(const key in query.events){
|
|
228
|
+
const queryEvent = query.events[key];
|
|
229
|
+
if (!isEventQueryMatch(key, queryEvent, item)) return false;
|
|
230
|
+
}
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
if (query.aggs && item.aggs) {
|
|
234
|
+
for(const key in query.aggs){
|
|
235
|
+
const aggQuery = query.aggs[key];
|
|
236
|
+
if (item.aggs[key] && !isAggQueryMatch(key, aggQuery, item.aggs[key])) return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (query.aggs && !item.aggs) {
|
|
240
|
+
logger.debug('Query contains aggs but item does not have aggs', {
|
|
241
|
+
query,
|
|
242
|
+
item
|
|
243
|
+
});
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
// If it hasn't returned false by now, it must be a match
|
|
247
|
+
return true;
|
|
248
|
+
};
|
|
249
|
+
const abbrevQuery = (query)=>{
|
|
250
|
+
const abbrev = [
|
|
251
|
+
'IQ'
|
|
252
|
+
];
|
|
253
|
+
if (query) {
|
|
254
|
+
if (query.refs) {
|
|
255
|
+
for(const key in query.refs){
|
|
256
|
+
const ref = abbrevRef(key, query.refs[key]);
|
|
257
|
+
abbrev.push(ref);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (query.compoundCondition) {
|
|
261
|
+
const props = abbrevCompoundCondition(query.compoundCondition);
|
|
262
|
+
abbrev.push(props);
|
|
263
|
+
}
|
|
264
|
+
if (query.aggs) {
|
|
265
|
+
for(const key in query.aggs){
|
|
266
|
+
const agg = abbrevAgg(key, query.aggs[key]);
|
|
267
|
+
abbrev.push(agg);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (query.events) {
|
|
271
|
+
const events = `(E${Object.keys(query.events).join(',')})`;
|
|
272
|
+
abbrev.push(events);
|
|
273
|
+
}
|
|
274
|
+
if (query.limit) {
|
|
275
|
+
abbrev.push(`L${query.limit}`);
|
|
276
|
+
}
|
|
277
|
+
if (query.offset) {
|
|
278
|
+
abbrev.push(`O${query.offset}`);
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
abbrev.push('(empty)');
|
|
282
|
+
}
|
|
283
|
+
return abbrev.join(' ');
|
|
284
|
+
};
|
|
285
|
+
const abbrevRef = (key, ref)=>{
|
|
286
|
+
if (KUtils.isPriKey(ref)) {
|
|
287
|
+
const priKey = ref;
|
|
288
|
+
return `R(${key},${priKey.kt},${priKey.pk})`;
|
|
289
|
+
} else {
|
|
290
|
+
const comKey = ref;
|
|
291
|
+
return `R(${key},${JSON.stringify(comKey)})`;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const abbrevAgg = (key, agg)=>{
|
|
295
|
+
return `A(${key},${abbrevQuery(agg)})`;
|
|
296
|
+
};
|
|
297
|
+
const abbrevCompoundCondition = (compoundCondition)=>{
|
|
298
|
+
return `CC(${compoundCondition.compoundType},` + `${compoundCondition.conditions ? compoundCondition.conditions.map(abbrevCondition).join(',') : 'No Conditions'})`;
|
|
299
|
+
};
|
|
300
|
+
const abbrevCondition = (condition)=>{
|
|
301
|
+
if (ItemQuery.isCondition(condition)) {
|
|
302
|
+
return `(${condition.column},${condition.value},${condition.operator})`;
|
|
303
|
+
} else {
|
|
304
|
+
return abbrevCompoundCondition(condition);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
exports.abbrevAgg = abbrevAgg;
|
|
309
|
+
exports.abbrevCompoundCondition = abbrevCompoundCondition;
|
|
310
|
+
exports.abbrevCondition = abbrevCondition;
|
|
311
|
+
exports.abbrevQuery = abbrevQuery;
|
|
312
|
+
exports.abbrevRef = abbrevRef;
|
|
313
|
+
exports.isQueryMatch = isQueryMatch;
|
|
314
|
+
exports.paramsToQuery = paramsToQuery;
|
|
315
|
+
exports.queryToParams = queryToParams;
|
|
316
|
+
//# sourceMappingURL=IQUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IQUtils.js","sources":["../../../src/item/IQUtils.ts"],"sourcesContent":["import { Item, ReferenceItem, References } from \"@/items\";\nimport { isItemKeyEqual, isPriKey } from \"@/key/KUtils\";\nimport { ComKey, PriKey } from \"@/keys\";\nimport LibLogger from \"@/logger\";\nimport { DateTime } from \"luxon\";\nimport { CompoundCondition, Condition, EventQuery, isCondition, ItemQuery, QueryParams } from \"./ItemQuery\";\n\nconst logger = LibLogger.get('IQUtils');\n\n/**\n * When we query or search, we're sending a GET request. This converts everything in ItemQuery into a flat\n * object that can be sent over a GET request.\n *\n * Note that there is some discussion about this. Evidently Elastic supports search with POST, but that also\n * feels like a bit of a hack. It's not a RESTful way to do things. So we're sticking with GET for now.\n *\n * For reference, look at RFC 9110 \"HTTP Semantics\", June which clarified on top of and RFC 7231. It's possible\n * but there are so many caveats and conditions in the standard, it's not worth it.\n *\n * Anticipating the next question - \"isn't there a limit to the length of a URL?\" The specification does not\n * specify a limit, and there are limits in various browsers and servers - Apache is 4,000 chars, Chrome is 2M chars.\n * Short answer is that if this query is being used to craft something that complex, it is probably a better idea\n * to provide an action or a custom query endpoint on the server.\n *\n * @param query\n * @returns QueryParams ready to be get over a GET request.\n */\nexport const queryToParams = (query: ItemQuery): QueryParams => {\n const params: QueryParams = {};\n if (query.compoundCondition) {\n params.compoundCondition = JSON.stringify(query.compoundCondition);\n }\n if (query.refs) {\n params.refs = JSON.stringify(query.refs);\n }\n if (query.limit) {\n params.limit = query.limit;\n }\n if (query.offset) {\n params.offset = query.offset;\n }\n if (query.aggs) {\n params.aggs = JSON.stringify(query.aggs);\n }\n if (query.events) {\n params.events = JSON.stringify(query.events);\n }\n return params;\n}\n\n// This is a dateTimeReviver used for JSON parse - when we convert a param back to a query, we need this.\nconst dateTimeReviver = function (key: string, value: string) {\n if (typeof value === 'string') {\n const parsedDate = DateTime.fromISO(value);\n if (parsedDate.isValid) {\n return parsedDate.toJSDate();;\n }\n }\n return value;\n}\n\n/**\n * This method translates from a flat QueryParams object with stringify'd JSON back to a full ItemQuery.\n *\n * @param params Parameters sent over a GET request\n * @returns A fully hydrated ItemQuery object.\n */\nexport const paramsToQuery = (params: QueryParams): ItemQuery => {\n const query: ItemQuery = {};\n if (params.compoundCondition) {\n query.compoundCondition = JSON.parse(params.compoundCondition as string) as CompoundCondition;\n }\n if (params.refs) {\n query.refs = JSON.parse(params.refs as string) as References;\n }\n if (params.limit) {\n query.limit = Number(params.limit);\n }\n if (params.offset) {\n query.offset = Number(params.offset);\n }\n if (params.aggs) {\n query.aggs = JSON.parse(params.aggs as string) as Record<string, ItemQuery>;\n }\n if (params.events) {\n query.events = JSON.parse(params.events as string, dateTimeReviver) as Record<string, { start?: Date, end?: Date }>;\n }\n return query;\n}\n\nconst isRefQueryMatch =\n <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n >(\n refKey: string,\n queryRef: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,\n references: References,\n ): boolean => {\n logger.trace('doesRefMatch', { queryRef, references });\n logger.debug('Comparing Ref', { refKey, itemRef: references[refKey], queryRef });\n return isItemKeyEqual(queryRef, references[refKey]);\n }\n\nconst isCompoundConditionQueryMatch = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n queryCondition: CompoundCondition,\n item: Item<S, L1, L2, L3, L4, L5>,\n ): boolean => {\n if (queryCondition.compoundType === 'AND') {\n // If this is an AND compound condition, we need to check if all of the conditions match\n return queryCondition.conditions.every(\n (condition: Condition | CompoundCondition) =>\n isCondition(condition) ?\n isConditionQueryMatch(condition, item) :\n isCompoundConditionQueryMatch(condition, item)\n );\n } else {\n // If this is an OR compound condition, we need to check if any of the conditions match\n return queryCondition.conditions.some(\n (condition: Condition | CompoundCondition) =>\n isCondition(condition) ?\n isConditionQueryMatch(condition, item) :\n isCompoundConditionQueryMatch(condition, item)\n );\n }\n}\n\nconst isConditionQueryMatch = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n queryCondition: Condition,\n item: Item<S, L1, L2, L3, L4, L5>,\n ): boolean => {\n const propKey = queryCondition.column;\n logger.trace('doesConditionMatch', { propKey, queryCondition, item });\n // eslint-disable-next-line no-undefined\n if (item[propKey] === undefined) {\n logger.debug('Item does not contain prop under key', { propKey, item });\n return false;\n }\n logger.debug('Comparing Condition', { propKey, itemProp: item[propKey], queryCondition });\n let result = false;\n switch (queryCondition.operator) {\n case '==':\n result = item[propKey] === queryCondition.value;\n break;\n case '!=':\n result = item[propKey] !== queryCondition.value;\n break;\n case '>':\n result = item[propKey] > queryCondition.value;\n break;\n case '>=':\n result = item[propKey] >= queryCondition.value;\n break;\n case '<':\n result = item[propKey] < queryCondition.value;\n break;\n case '<=':\n result = item[propKey] <= queryCondition.value;\n break;\n case 'in':\n result = (queryCondition.value as unknown as string[]).includes(item[propKey] as string);\n break;\n case 'not-in':\n result = !(queryCondition.value as unknown as string[]).includes(item[propKey] as string);\n break;\n case 'array-contains':\n result = (item[propKey] as unknown as string[]).includes(queryCondition.value as string);\n break;\n case 'array-contains-any':\n result = (queryCondition.value as unknown as string[])\n .some(value => (item[propKey] as unknown as string[]).includes(value));\n break;\n }\n return result;\n}\n\nconst isAggQueryMatch = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n aggKey: string,\n aggQuery: ItemQuery,\n agg: ReferenceItem<S, L1, L2, L3, L4, L5>\n ): boolean => {\n const aggItem = agg.item;\n logger.debug('Comparing Agg', { aggKey, aggItem, aggQuery });\n // Fancy, right? This is a recursive call to isQueryMatch\n return isQueryMatch(aggItem, aggQuery);\n}\n\nconst isEventQueryMatch = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n eventKey: string,\n eventQuery: EventQuery,\n item: Item<S, L1, L2, L3, L4, L5>,\n ): boolean => {\n if (!item.events[eventKey]) {\n logger.debug('Item does not contain event under key', { eventKey, events: item.events });\n return false;\n } else {\n const itemEvent = item.events[eventKey];\n if (itemEvent.at !== null) {\n if (eventQuery.start && !(eventQuery.start.getTime() <= itemEvent.at.getTime())) {\n logger.debug('Item date before event start query', { eventQuery, itemEvent });\n return false;\n }\n if (eventQuery.end && !(eventQuery.end.getTime() > itemEvent.at.getTime())) {\n logger.debug('Item date after event end query', { eventQuery, itemEvent });\n return false;\n }\n } else {\n logger.debug('Item event does contains a null at', { itemEvent });\n return false;\n }\n return true;\n }\n}\n\nexport const isQueryMatch = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(item: Item<S, L1, L2, L3, L4, L5>, query: ItemQuery): boolean => {\n\n logger.trace('isMatch', { item, query });\n if (query.refs && item.refs) {\n for (const key in query.refs) {\n const queryRef = query.refs[key];\n if (!isRefQueryMatch(key, queryRef, item.refs)) return false;\n }\n } else if (query.refs && !item.refs) {\n logger.debug('Query contains refs but item does not have refs', { query, item });\n return false;\n }\n\n if (query.compoundCondition && item) {\n if (!isCompoundConditionQueryMatch(query.compoundCondition, item)) return false;\n }\n\n if (query.events && item.events) {\n for (const key in query.events) {\n const queryEvent = query.events[key];\n if (!isEventQueryMatch(key, queryEvent, item)) return false\n }\n return true;\n }\n\n if (query.aggs && item.aggs) {\n for (const key in query.aggs) {\n const aggQuery = query.aggs[key];\n if (item.aggs[key] && !isAggQueryMatch(key, aggQuery, item.aggs[key])) return false;\n }\n } if (query.aggs && !item.aggs) {\n logger.debug('Query contains aggs but item does not have aggs', { query, item });\n return false;\n }\n\n // If it hasn't returned false by now, it must be a match\n return true;\n}\n\nexport const abbrevQuery = (query: ItemQuery | null | undefined): string => {\n const abbrev = ['IQ'];\n if( query ) {\n if (query.refs) {\n for (const key in query.refs) {\n const ref = abbrevRef(key, query.refs[key]);\n abbrev.push(ref);\n }\n }\n if (query.compoundCondition) {\n const props = abbrevCompoundCondition(query.compoundCondition);\n abbrev.push(props);\n }\n if (query.aggs) {\n for (const key in query.aggs) {\n const agg = abbrevAgg(key, query.aggs[key]);\n abbrev.push(agg);\n }\n }\n if (query.events) {\n const events = `(E${Object.keys(query.events).join(',')})`;\n abbrev.push(events);\n }\n if (query.limit) {\n abbrev.push(`L${query.limit}`);\n }\n if (query.offset) {\n abbrev.push(`O${query.offset}`);\n }\n } else {\n abbrev.push('(empty)');\n }\n return abbrev.join(' ');\n}\n\nexport const abbrevRef = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(key: string, ref: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): string => {\n if (isPriKey(ref)) {\n const priKey = ref as PriKey<S>;\n return `R(${key},${priKey.kt},${priKey.pk})`;\n } else {\n const comKey = ref as ComKey<S, L1, L2, L3, L4, L5>;\n return `R(${key},${JSON.stringify(comKey)})`;\n }\n}\n\nexport const abbrevAgg = (key: string, agg: ItemQuery): string => {\n return `A(${key},${abbrevQuery(agg)})`;\n}\n\nexport const abbrevCompoundCondition = (compoundCondition: CompoundCondition): string => {\n return `CC(${compoundCondition.compoundType},` +\n `${compoundCondition.conditions ? compoundCondition.conditions.map(abbrevCondition).join(',') : 'No Conditions'})`;\n}\n\nexport const abbrevCondition = (condition: Condition | CompoundCondition): string => {\n if (isCondition(condition)) {\n return `(${condition.column},${condition.value},${condition.operator})`;\n } else {\n return abbrevCompoundCondition(condition);\n }\n}"],"names":["logger","LibLogger","get","queryToParams","query","params","compoundCondition","JSON","stringify","refs","limit","offset","aggs","events","dateTimeReviver","key","value","parsedDate","DateTime","fromISO","isValid","toJSDate","paramsToQuery","parse","Number","isRefQueryMatch","refKey","queryRef","references","trace","debug","itemRef","isItemKeyEqual","isCompoundConditionQueryMatch","queryCondition","item","compoundType","conditions","every","condition","isCondition","isConditionQueryMatch","some","propKey","column","undefined","itemProp","result","operator","includes","isAggQueryMatch","aggKey","aggQuery","agg","aggItem","isQueryMatch","isEventQueryMatch","eventKey","eventQuery","itemEvent","at","start","getTime","end","queryEvent","abbrevQuery","abbrev","ref","abbrevRef","push","props","abbrevCompoundCondition","abbrevAgg","Object","keys","join","isPriKey","priKey","kt","pk","comKey","map","abbrevCondition"],"mappings":";;;;;;;;;AAOA,MAAMA,MAAAA,GAASC,gBAAUC,CAAAA,GAAG,CAAC,SAAA,CAAA;AAE7B;;;;;;;;;;;;;;;;;IAkBaC,MAAAA,aAAAA,GAAgB,CAACC,KAAAA,GAAAA;AAC5B,IAAA,MAAMC,SAAsB,EAAC;IAC7B,IAAID,KAAAA,CAAME,iBAAiB,EAAE;AAC3BD,QAAAA,MAAAA,CAAOC,iBAAiB,GAAGC,IAAAA,CAAKC,SAAS,CAACJ,MAAME,iBAAiB,CAAA;AACnE;IACA,IAAIF,KAAAA,CAAMK,IAAI,EAAE;AACdJ,QAAAA,MAAAA,CAAOI,IAAI,GAAGF,IAAAA,CAAKC,SAAS,CAACJ,MAAMK,IAAI,CAAA;AACzC;IACA,IAAIL,KAAAA,CAAMM,KAAK,EAAE;QACfL,MAAOK,CAAAA,KAAK,GAAGN,KAAAA,CAAMM,KAAK;AAC5B;IACA,IAAIN,KAAAA,CAAMO,MAAM,EAAE;QAChBN,MAAOM,CAAAA,MAAM,GAAGP,KAAAA,CAAMO,MAAM;AAC9B;IACA,IAAIP,KAAAA,CAAMQ,IAAI,EAAE;AACdP,QAAAA,MAAAA,CAAOO,IAAI,GAAGL,IAAAA,CAAKC,SAAS,C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AAAA;IACtC,OAAO,CAAC,GAAG,EAAEA,iBAAkB8B,CAAAA,YAAY,CAAC,CAAC,CAAC,GAC5C,CAAA,EAAG9B,iBAAkB+B,CAAAA,UAAU,GAAG/B,iBAAkB+B,CAAAA,UAAU,CAAC4C,GAAG,CAACC,eAAAA,CAAAA,CAAiBP,IAAI,CAAC,GAAA,CAAA,GAAO,eAAgB,CAAA,CAAC,CAAC;AACtH;AAEO,MAAMO,kBAAkB,CAAC3C,SAAAA,GAAAA;AAC9B,IAAA,IAAIC,sBAAYD,SAAY,CAAA,EAAA;AAC1B,QAAA,OAAO,CAAC,CAAC,EAAEA,SAAUK,CAAAA,MAAM,CAAC,CAAC,EAAEL,SAAUvB,CAAAA,KAAK,CAAC,CAAC,EAAEuB,UAAUS,QAAQ,CAAC,CAAC,CAAC;KAClE,MAAA;AACL,QAAA,OAAOuB,uBAAwBhC,CAAAA,SAAAA,CAAAA;AACjC;AACF;;;;;;;;;;;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const KUtils = require('../key/KUtils.js');
|
|
6
|
+
const logger$1 = require('../logger.js');
|
|
7
|
+
|
|
8
|
+
const logger = logger$1.default.get('IUtils');
|
|
9
|
+
const validatePK = (input, pkType)=>{
|
|
10
|
+
logger.trace('Checking Return Type', {
|
|
11
|
+
input
|
|
12
|
+
});
|
|
13
|
+
if (Array.isArray(input)) {
|
|
14
|
+
const itemArray = input;
|
|
15
|
+
return itemArray.map((item)=>validatePK(item, pkType));
|
|
16
|
+
} else {
|
|
17
|
+
const item = input;
|
|
18
|
+
if (item) {
|
|
19
|
+
if (item.key) {
|
|
20
|
+
const keyTypeArray = KUtils.toKeyTypeArray(item.key);
|
|
21
|
+
const match = keyTypeArray[0] === pkType;
|
|
22
|
+
if (!match) {
|
|
23
|
+
logger.error('Key Type Array Mismatch', {
|
|
24
|
+
keyTypeArray,
|
|
25
|
+
pkType
|
|
26
|
+
});
|
|
27
|
+
throw new Error('Item does not have the correct primary key type');
|
|
28
|
+
} else {
|
|
29
|
+
return item;
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
logger.error('Validating PK, Item does not have a key', {
|
|
33
|
+
item
|
|
34
|
+
});
|
|
35
|
+
throw new Error('Validating PK, Item does not have a key');
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
logger.error('Validating PK, Item is undefined', {
|
|
39
|
+
item
|
|
40
|
+
});
|
|
41
|
+
throw new Error('Validating PK, Item is undefined');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const validateKeys = (item, keyTypes)=>{
|
|
46
|
+
logger.trace('Checking Return Type', {
|
|
47
|
+
item
|
|
48
|
+
});
|
|
49
|
+
if (item) {
|
|
50
|
+
if (item.key) {
|
|
51
|
+
const keyTypeArray = KUtils.toKeyTypeArray(item.key);
|
|
52
|
+
if (keyTypeArray.length !== keyTypes.length) {
|
|
53
|
+
throw new Error('Item does not have the correct number of keys');
|
|
54
|
+
} else {
|
|
55
|
+
const match = JSON.stringify(keyTypeArray) === JSON.stringify(keyTypes);
|
|
56
|
+
if (!match) {
|
|
57
|
+
logger.error('Key Type Array Mismatch', {
|
|
58
|
+
keyTypeArray,
|
|
59
|
+
thisKeyTypes: keyTypes
|
|
60
|
+
});
|
|
61
|
+
throw new Error('Item does not have the correct key types');
|
|
62
|
+
} else {
|
|
63
|
+
return item;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error('validating keys, item does not have a key: ' + JSON.stringify(item));
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
throw new Error('validating keys, item is undefined');
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const isPriItem = (item)=>{
|
|
74
|
+
return item && item.key ? KUtils.isPriKey(item.key) : false;
|
|
75
|
+
};
|
|
76
|
+
const isComItem = (item)=>{
|
|
77
|
+
return item && item.key ? KUtils.isComKey(item.key) : false;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
exports.isComItem = isComItem;
|
|
81
|
+
exports.isPriItem = isPriItem;
|
|
82
|
+
exports.validateKeys = validateKeys;
|
|
83
|
+
exports.validatePK = validatePK;
|
|
84
|
+
//# sourceMappingURL=IUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IUtils.js","sources":["../../../src/item/IUtils.ts"],"sourcesContent":["import { Item } from \"@/items\";\nimport { isComKey, isPriKey, toKeyTypeArray } from \"@/key/KUtils\";\nimport { AllItemTypeArrays, ComKey, PriKey } from \"@/keys\";\n\nimport LibLogger from '@/logger';\n\nconst logger = LibLogger.get('IUtils');\n\nexport const validatePK = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(input: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[], pkType: S):\n Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[] => {\n\n logger.trace('Checking Return Type', { input });\n\n if (Array.isArray(input)) {\n const itemArray = input as Item<S, L1, L2, L3, L4, L5>[];\n return itemArray.map((item) => validatePK(item, pkType)) as Item<S, L1, L2, L3, L4, L5>[];\n } else {\n const item = input as Item<S, L1, L2, L3, L4, L5>;\n if( item ) {\n if (item.key) {\n const keyTypeArray = toKeyTypeArray(item.key as ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>);\n const match: boolean = keyTypeArray[0] === pkType;\n if (!match) {\n logger.error('Key Type Array Mismatch', { keyTypeArray, pkType });\n throw new Error('Item does not have the correct primary key type');\n } else {\n return item;\n }\n } else {\n logger.error('Validating PK, Item does not have a key', { item });\n throw new Error('Validating PK, Item does not have a key');\n }\n } else {\n logger.error('Validating PK, Item is undefined', { item });\n throw new Error('Validating PK, Item is undefined');\n }\n }\n};\n\nexport const validateKeys = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(item: Item<S, L1, L2, L3, L4, L5>, keyTypes: AllItemTypeArrays<S, L1, L2, L3, L4, L5>):\n Item<S, L1, L2, L3, L4, L5> => {\n logger.trace('Checking Return Type', { item });\n if( item ) {\n if (item.key) {\n const keyTypeArray = toKeyTypeArray(item.key as ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>);\n if (keyTypeArray.length !== keyTypes.length) {\n throw new Error('Item does not have the correct number of keys');\n } else {\n const match: boolean = JSON.stringify(keyTypeArray) === JSON.stringify(keyTypes);\n if (!match) {\n logger.error('Key Type Array Mismatch', { keyTypeArray, thisKeyTypes: keyTypes });\n throw new Error('Item does not have the correct key types');\n } else {\n return item;\n }\n }\n } else {\n throw new Error('validating keys, item does not have a key: ' + JSON.stringify(item));\n }\n } else {\n throw new Error('validating keys, item is undefined');\n }\n};\n\nexport const isPriItem = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(item: Item<S, L1, L2, L3, L4, L5>): item is Item<S, L1, L2, L3, L4, L5> => {\n return (item && item.key) ? isPriKey(item.key as PriKey<S>) : false;\n}\n\nexport const isComItem = <\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(item: Item<S, L1, L2, L3, L4, L5>): item is Item<S, L1, L2, L3, L4, L5> => {\n return (item && item.key) ? isComKey(item.key as ComKey<S, L1, L2, L3, L4, L5>) : false;\n}"],"names":["logger","LibLogger","get","validatePK","input","pkType","trace","Array","isArray","itemArray","map","item","key","keyTypeArray","toKeyTypeArray","match","error","Error","validateKeys","keyTypes","length","JSON","stringify","thisKeyTypes","isPriItem","isPriKey","isComItem","isComKey"],"mappings":";;;;;;;AAMA,MAAMA,MAAAA,GAASC,gBAAUC,CAAAA,GAAG,CAAC,QA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;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const isCondition = (condition)=>{
|
|
6
|
+
return (typeof condition.column === 'string' && Array.isArray(condition.value) && condition.value.every((item)=>typeof item === 'string') || Array.isArray(condition.value) && condition.value.every((item)=>typeof item === 'number') || typeof condition.value === 'string' || typeof condition.value === 'number' || typeof condition.value === 'boolean' || condition.value instanceof Date) && (condition.operator ? typeof condition.operator === 'string' : true);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
exports.isCondition = isCondition;
|
|
10
|
+
//# sourceMappingURL=ItemQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemQuery.js","sources":["../../../src/item/ItemQuery.ts"],"sourcesContent":["import { References } from '@/items';\n\nexport type QueryParams = Record<string, string | number | boolean | Date>;\n\n/**\n * The operator for a condition. This is the same as the operators used in the Firestore query language.\n */\nexport type ConditionOperator =\n '==' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'not-in' | 'array-contains' | 'array-contains-any';\n\n/**\n * A single property condition is defined with a column, value, and operator.\n * This is a condition that is used in a query.\n */\nexport type Condition = {\n column: string,\n value: string[] | string | number[] | number | boolean | Date,\n operator: ConditionOperator,\n};\n\n/**\n * When applying a compound condition, the CompoundType defines the type of compound condition.\n */\nexport type CompoundType = 'AND' | 'OR';\n\n/**\n * When configuring a CompoundCondition this can contain a collection of conditions\n * that will be applied to the query. By default, this is an AND conditiion that is associated\n * with an array of Condition objects OR an array of CompoundCondition objects.\n *\n * For example, I could have { compoundType: 'AND', conditions: [{column: 'name', value: 'test', operator: '=='},\n * {column: 'age', value: 21, operator: '>='}]} which would filter the query to only include items\n * where the name is 'test' and the age is greater than or equal to 21.\n *\n * Or, I could have a { compoundType: 'OR', conditions: [{column: 'name', value: 'test', operator: '=='},\n * {column: 'age', value: 21, operator: '>='}]} which would filter the query to only include items\n * where the name is 'test' OR the age is greater than or equal to 21.\n *\n * I could also nest an OR within an AND, like this:\n * ['AND', [{column: 'name', value: 'test', operator: '=='},\n * { compoundType: 'OR', conditions: [{column: 'age', value: 21, operator: '<='},\n * {column: 'age', value: 52, operator: '>='}]}]] which would filter the query to only include items where the\n * name is 'test' and the age is less than or equal to 21 or greater than or equal to 52.\n */\nexport type CompoundCondition = {\n compoundType: CompoundType,\n conditions: Array<Condition | CompoundCondition>\n};\n\nexport const isCondition = (condition: any): condition is Condition => {\n return (\n typeof condition.column === 'string' &&\n (Array.isArray(condition.value) && condition.value.every((item: any) => typeof item === 'string')) ||\n (Array.isArray(condition.value) && condition.value.every((item: any) => typeof item === 'number')) ||\n typeof condition.value === 'string' ||\n typeof condition.value === 'number' ||\n typeof condition.value === 'boolean' ||\n condition.value instanceof Date\n ) && (condition.operator ? typeof condition.operator === 'string' : true);\n}\n\nexport type EventQuery = {\n start?: Date,\n end?: Date,\n by?: string,\n}\n\nexport type OrderDirection = 'asc' | 'desc';\n\nexport type OrderBy = {\n field: string;\n direction: OrderDirection;\n}\n\nexport type ItemQuery = {\n refs?: References;\n compoundCondition?: CompoundCondition;\n limit?: number;\n offset?: number;\n aggs?: Record<\n string,\n ItemQuery\n >;\n events?: Record<string, EventQuery>;\n orderBy?: OrderBy[];\n};\n\n"],"names":["isCondition","condition","column","Array","isArray","value","every","item","Date","operator"],"mappings":";;;;AAiDO,MAAMA,cAAc,CAACC,SAAAA,GAAAA;AAC1B,IAAA,OAAO,CACL,OAAOA,SAAAA,CAAUC,MAAM,KAAK,QAAA,IAC3BC,KAAMC,CAAAA,OAAO,CAACH,SAAAA,CAAUI,KAAK,CAAA,IAAKJ,UAAUI,KAAK,CAACC,KAAK,CAAC,CAACC,IAAAA,GAAc,OAAOA,IAAAA,KAAS,aACvFJ,KAAMC,CAAAA,OAAO,CAACH,SAAAA,CAAUI,KAAK,CAAA,IAAKJ,SAAUI,CAAAA,KAAK,CAACC,KAAK,CAAC,CAACC,IAAAA,GAAc,OAAOA,IAAAA,KAAS,QACxF,CAAA,IAAA,OAAON,UAAUI,KAAK,KAAK,QAC3B,IAAA,OAAOJ,SAAUI,CAAAA,KAAK,KAAK,QAAA,IAC3B,OAAOJ,SAAUI,CAAAA,KAAK,KAAK,SAAA,IAC3BJ,SAAUI,CAAAA,KAAK,YAAYG,IAAG,MAC1BP,SAAAA,CAAUQ,QAAQ,GAAG,OAAOR,SAAAA,CAAUQ,QAAQ,KAAK,WAAW,IAAG,CAAA;AACzE;;;;"}
|