@fjell/core 4.4.35 → 4.4.36
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/dist/index.js +0 -1
- package/package.json +7 -1
- package/dist/AItemService.d.ts +0 -8
- package/dist/dictionary.d.ts +0 -22
- package/dist/index.d.ts +0 -11
- package/dist/index.js.map +0 -7
- package/dist/item/IFactory.d.ts +0 -16
- package/dist/item/IQFactory.d.ts +0 -23
- package/dist/item/IQUtils.d.ts +0 -35
- package/dist/item/IUtils.d.ts +0 -10
- package/dist/item/ItemQuery.d.ts +0 -62
- package/dist/items.d.ts +0 -59
- package/dist/key/KUtils.d.ts +0 -40
- package/dist/keys.d.ts +0 -66
- package/dist/logger.d.ts +0 -2
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjell/core",
|
|
3
3
|
"description": "Core Item and Key Framework for Fjell",
|
|
4
|
-
"version": "4.4.
|
|
4
|
+
"version": "4.4.36",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"core",
|
|
7
7
|
"fjell"
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
"module": "./dist/index.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./browser": {
|
|
14
19
|
"types": "./dist/index.d.ts",
|
|
15
20
|
"import": "./dist/index.js"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
23
|
+
"browser": "./dist/index.js",
|
|
18
24
|
"type": "module",
|
|
19
25
|
"scripts": {
|
|
20
26
|
"lint": "eslint . --ext .ts --fix",
|
package/dist/AItemService.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AllItemTypeArrays } from "./keys";
|
|
2
|
-
export declare class AItemService<S extends string, L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> {
|
|
3
|
-
private pkType;
|
|
4
|
-
private parentService;
|
|
5
|
-
constructor(pkType: S, parentService?: AItemService<L1, L2, L3, L4, L5, never>);
|
|
6
|
-
getPkType: () => S;
|
|
7
|
-
getKeyTypes: () => AllItemTypeArrays<S, L1, L2, L3, L4, L5>;
|
|
8
|
-
}
|
package/dist/dictionary.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
interface DictionaryEntry<T, V> {
|
|
2
|
-
originalKey: T;
|
|
3
|
-
value: V;
|
|
4
|
-
}
|
|
5
|
-
export declare class Dictionary<T, V> {
|
|
6
|
-
protected map: {
|
|
7
|
-
[key: string]: DictionaryEntry<T, V>;
|
|
8
|
-
};
|
|
9
|
-
protected hashFunction: (key: T) => string;
|
|
10
|
-
constructor(map?: {
|
|
11
|
-
[key: string]: V;
|
|
12
|
-
}, hashFunction?: (key: T) => string);
|
|
13
|
-
set(key: T, item: V): void;
|
|
14
|
-
get(key: T): V | null;
|
|
15
|
-
private keysEqual;
|
|
16
|
-
delete(key: T): void;
|
|
17
|
-
keys(): T[];
|
|
18
|
-
values(): V[];
|
|
19
|
-
includesKey(key: T): boolean;
|
|
20
|
-
clone(): Dictionary<T, V>;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from "./dictionary";
|
|
2
|
-
export * from "./keys";
|
|
3
|
-
export * from "./items";
|
|
4
|
-
export { IFactory } from "./item/IFactory";
|
|
5
|
-
export { AItemService } from "./AItemService";
|
|
6
|
-
export * from './key/KUtils';
|
|
7
|
-
export * from './item/IFactory';
|
|
8
|
-
export * from './item/IQFactory';
|
|
9
|
-
export * from './item/IQUtils';
|
|
10
|
-
export * from './item/IUtils';
|
|
11
|
-
export * from './item/ItemQuery';
|
package/dist/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/logger.ts", "../src/dictionary.ts", "../src/item/IFactory.ts", "../src/key/KUtils.ts", "../src/AItemService.ts", "../src/item/ItemQuery.ts", "../src/item/IQFactory.ts", "../src/item/IQUtils.ts", "../src/item/IUtils.ts"],
|
|
4
|
-
"sourcesContent": ["import Logging from '@fjell/logging';\n\nconst LibLogger = Logging.getLogger('@fjell/core');\n\nexport default LibLogger;\n", "import LibLogger from \"./logger\";\n\nconst logger = LibLogger.get(\"Dictionary\");\n\ninterface DictionaryEntry<T, V> {\n originalKey: T;\n value: V;\n}\n\nexport class Dictionary<T, V> {\n protected map: { [key: string]: DictionaryEntry<T, V> } = {}\n protected hashFunction = (key: T) => JSON.stringify(key);\n\n constructor(map?: { [key: string]: V }, hashFunction?: (key: T) => string) {\n if (hashFunction) {\n this.hashFunction = hashFunction\n }\n if (map) {\n // Convert legacy map format to new format\n Object.entries(map).forEach(([hashedKey, value]) => {\n try {\n // Try to parse the key if it looks like JSON\n const originalKey = JSON.parse(hashedKey) as T;\n this.map[hashedKey] = { originalKey, value };\n } catch {\n // If parsing fails, we can't recover the original key\n logger.warning('Cannot recover original key from legacy map entry', { hashedKey });\n }\n });\n }\n }\n\n public set(key: T, item: V): void {\n logger.trace('set', { key, item });\n const hashedKey = this.hashFunction(key);\n this.map[hashedKey] = { originalKey: key, value: item };\n }\n\n public get(key: T): V | null {\n logger.trace('get', { key });\n const hashedKey = this.hashFunction(key);\n const entry = this.map[hashedKey];\n // Check if entry exists AND the original key matches the requested key\n return entry && this.keysEqual(entry.originalKey, key) ? entry.value : null;\n }\n\n private keysEqual(key1: T, key2: T): boolean {\n // For basic equality check - this works for primitives and object references\n // For deep equality, users can provide a custom hash function that avoids collisions\n return key1 === key2;\n }\n\n public delete(key: T): void {\n logger.trace('delete', { key });\n const hashedKey = this.hashFunction(key);\n delete this.map[hashedKey];\n }\n\n public keys(): T[] {\n return Object.values(this.map).map(entry => entry.originalKey);\n }\n\n public values(): V[] {\n return Object.values(this.map).map(entry => entry.value);\n }\n\n public includesKey(key: T): boolean {\n const hashedKey = this.hashFunction(key);\n const entry = this.map[hashedKey];\n return entry ? this.keysEqual(entry.originalKey, key) : false;\n }\n\n public clone(): Dictionary<T, V> {\n const clonedMap: { [key: string]: V } = {};\n Object.entries(this.map).forEach(([hashedKey, entry]) => {\n clonedMap[hashedKey] = entry.value;\n });\n\n const clone = new Dictionary<T, V>(clonedMap, this.hashFunction);\n // Copy the entries directly to preserve original keys\n clone.map = Object.assign({}, this.map);\n return clone;\n }\n}\n", "import deepmerge from 'deepmerge';\nimport { Item } from '../items';\nimport { primaryType } from '../key/KUtils';\nimport { ComKey, PriKey } from '../keys';\n\nexport class IFactory<\n V extends Item<S, L1, L2, L3, L4, L5>,\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 private item: any = {\n };\n\n public constructor(props: Record<string, any> = {}) {\n this.item = deepmerge(this.item, props);\n }\n\n public addRef(i: Item<any, any|never, any|never, any|never, any|never, any|never>, name?: string) {\n const ik: ComKey<any, any|never, any|never, any|never, any|never, any|never> | PriKey<any> = i.key;\n\n const refName = name || primaryType(ik);\n if (!this.item.refs) {\n this.item.refs = {};\n }\n this.item.refs[refName] = ik;\n return this;\n }\n\n public static addRef<\n V extends Item<S, L1, L2, L3, L4, L5>,\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 >(i: V, name?: string) {\n return new IFactory<V, S, L1, L2, L3, L4, L5>().addRef(i, name);\n }\n\n public addDefaultEvents() {\n if (!this.item.events) {\n this.item.events = {};\n }\n const now = new Date();\n if (!this.item.events.created) {\n this.item.events.created = { at: now };\n }\n if (!this.item.events.updated) {\n this.item.events.updated = { at: now };\n }\n if (!this.item.events.deleted) {\n this.item.events.deleted = { at: null };\n }\n return this;\n }\n\n public addEvent(\n name: string,\n at: Date | null,\n by?: ComKey<any, any|never, any|never, any|never, any|never, any|never> | PriKey<any>\n ) {\n if (!this.item.events) {\n this.item.events = {};\n }\n this.item.events[name] = { at, by };\n return this;\n }\n\n public static addEvent<\n V extends Item<S, L1, L2, L3, L4, L5>,\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 >(name: string, at: Date | null, by?: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) {\n return new IFactory<V, S, L1, L2, L3, L4, L5>().addEvent(name, at, by);\n }\n\n public addProp(name: string, value: string | number | boolean | Date) {\n this.item[name] = value;\n return this;\n }\n\n public static addProp<\n V extends Item<S, L1, L2, L3, L4, L5>,\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 >(name: string, value: string | number | boolean | Date) {\n return new IFactory<V, S, L1, L2, L3, L4, L5>().addProp(name, value);\n }\n\n public addProps(props: Record<string, any>) {\n this.item = deepmerge(this.item, props);\n return this;\n }\n\n public static addProps<\n V extends Item<S, L1, L2, L3, L4, L5>,\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 >(props: Record<string, any>) {\n return new IFactory<V, S, L1, L2, L3, L4, L5>().addProps(props);\n }\n\n toItem(): V {\n return this.item as V;\n }\n}", "/* eslint-disable no-undefined */\nimport {\n ComKey,\n LocKey,\n LocKeyArray,\n PriKey\n} from \"../keys\";\n\nimport LibLogger from \"../logger\";\n\nconst logger = LibLogger.get('KUtils');\n\n// Normalize a key value to string for consistent comparison and hashing\nconst normalizeKeyValue = (value: string | number): string => {\n return String(value);\n};\n\n// Normalized hash function for Dictionary that converts pk/lk values to strings\nexport const createNormalizedHashFunction = <T>() => {\n return (key: T): string => {\n if (typeof key === 'object' && key !== null) {\n // Create a normalized version of the key with string values\n const normalizedKey = JSON.parse(JSON.stringify(key));\n\n // Normalize pk values\n if ('pk' in normalizedKey && (normalizedKey.pk !== undefined && normalizedKey.pk !== null)) {\n normalizedKey.pk = normalizeKeyValue(normalizedKey.pk);\n }\n\n // Normalize lk values\n if ('lk' in normalizedKey && (normalizedKey.lk !== undefined && normalizedKey.lk !== null)) {\n normalizedKey.lk = normalizeKeyValue(normalizedKey.lk);\n }\n\n // Normalize loc array lk values\n if ('loc' in normalizedKey && Array.isArray(normalizedKey.loc)) {\n normalizedKey.loc = normalizedKey.loc.map((locItem: any) => {\n if (locItem && 'lk' in locItem && (locItem.lk !== undefined && locItem.lk !== null)) {\n return { ...locItem, lk: normalizeKeyValue(locItem.lk) };\n }\n return locItem;\n });\n }\n\n return JSON.stringify(normalizedKey);\n }\n return JSON.stringify(key);\n };\n};\n\n// Normalized comparison functions\nexport const isPriKeyEqualNormalized = <\n S extends string,\n>(a: PriKey<S>, b: PriKey<S>): boolean => {\n logger.trace('isPriKeyEqualNormalized', { a, b });\n return a && b &&\n normalizeKeyValue(a.pk) === normalizeKeyValue(b.pk) &&\n a.kt === b.kt;\n};\n\nexport const isLocKeyEqualNormalized = <\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(a: LocKey<L1 | L2 | L3 | L4 | L5>, b: LocKey<L1 | L2 | L3 | L4 | L5>): boolean => {\n logger.trace('isLocKeyEqualNormalized', { a, b });\n return a && b &&\n normalizeKeyValue(a.lk) === normalizeKeyValue(b.lk) &&\n a.kt === b.kt;\n};\n\nexport const isComKeyEqualNormalized = <\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>(a: ComKey<S, L1, L2, L3, L4, L5>, b: ComKey<S, L1, L2, L3, L4, L5>): boolean => {\n logger.trace('isComKeyEqualNormalized', { a, b });\n if (a && b && isPriKeyEqualNormalized({ kt: a.kt, pk: a.pk } as PriKey<S>, { kt: b.kt, pk: b.pk } as PriKey<S>)) {\n if (a.loc.length === b.loc.length) {\n for (let i = 0; i < a.loc.length; i++) {\n if (!isLocKeyEqualNormalized<L1, L2, L3, L4, L5>(a.loc[i], b.loc[i])) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n};\n\nexport const isItemKeyEqualNormalized = <\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>(a: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, b: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): boolean => {\n logger.trace('isItemKeyEqualNormalized', { a, b });\n if (isComKey(a) && isComKey(b)) {\n return isComKeyEqualNormalized(a as ComKey<S, L1, L2, L3, L4, L5>, b as ComKey<S, L1, L2, L3, L4, L5>);\n } else if (isPriKey(a) && isPriKey(b)) {\n if (isComKey(a) || isComKey(b)) {\n return false;\n } else {\n return isPriKeyEqualNormalized(a as PriKey<S>, b as PriKey<S>);\n }\n } else {\n return false;\n }\n};\n\n// Original comparison functions (kept for backward compatibility)\nexport const isItemKeyEqual = <\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>(a: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, b: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): boolean => {\n logger.trace('isKeyEqual', { a, b });\n if (isComKey(a) && isComKey(b)) {\n return isComKeyEqual(a as ComKey<S, L1, L2, L3, L4, L5>, b as ComKey<S, L1, L2, L3, L4, L5>);\n } else if (isPriKey(a) && isPriKey(b)) {\n if (isComKey(a) || isComKey(b)) {\n return false;\n } else {\n return isPriKeyEqual(a as PriKey<S>, b as PriKey<S>);\n }\n } else {\n return false;\n }\n};\n\nexport const isPriKeyEqual = <\n S extends string,\n>(a: PriKey<S>, b: PriKey<S>): boolean => {\n logger.trace('isPriKeyEqual', { a, b });\n return a && b && a.pk === b.pk && a.kt === b.kt;\n}\n\nexport const isLocKeyEqual = <\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(a: LocKey<L1 | L2 | L3 | L4 | L5>, b: LocKey<L1 | L2 | L3 | L4 | L5>): boolean => {\n logger.trace('isLocKeyEqual', { a, b });\n return a && b && a.lk === b.lk && a.kt === b.kt;\n}\n\nexport const isComKeyEqual = <\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>(a: ComKey<S, L1, L2, L3, L4, L5>, b: ComKey<S, L1, L2, L3, L4, L5>): boolean => {\n logger.trace('isComKeyEqual', { a, b });\n if (a && b && isPriKeyEqual({ kt: a.kt, pk: a.pk } as PriKey<S>, { kt: b.kt, pk: b.pk } as PriKey<S>)) {\n if (a.loc.length === b.loc.length) {\n for (let i = 0; i < a.loc.length; i++) {\n if (!isLocKeyEqual<L1, L2, L3, L4, L5>(a.loc[i], b.loc[i])) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n}\n\nexport const isItemKey = (key: any): boolean => {\n logger.trace('isItemKey', { key });\n return key !== undefined && (isComKey(key) || isPriKey(key));\n}\n\nexport const isComKey = (key: any): boolean => {\n logger.trace('isComKey', { key });\n return key !== undefined &&\n (key.pk !== undefined && key.kt !== undefined) && (key.loc !== undefined && key.loc.length > 0);\n}\n\nexport const isPriKey = (key: any): boolean => {\n logger.trace('isPriKey', { key });\n return key !== undefined &&\n (key.pk !== undefined && key.kt !== undefined) && (key.loc === undefined || key.loc.length === 0);\n}\n\nexport const isLocKey = (key: any): boolean => {\n logger.trace('isLocKey', { key });\n return key !== undefined && (key.lk !== undefined && key.kt !== undefined);\n}\n\nexport const generateKeyArray = <\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: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | []):\n Array<PriKey<S> | LocKey<L1 | L2 | L3 | L4 | L5>> => {\n logger.trace('generateKeyArray', { key });\n const keys: Array<PriKey<S> | LocKey<L1 | L2 | L3 | L4 | L5>> = [];\n\n if (isComKey(key) || isPriKey(key)) {\n // console.log('it is an item key');\n if (isComKey(key)) {\n // console.log('it is a composite key');\n const comKey = key as ComKey<S, L1, L2, L3, L4, L5>;\n keys.push({ pk: comKey.pk, kt: comKey.kt });\n for (let i = 0; i < comKey.loc.length; i++) {\n keys.push(comKey.loc[i]);\n }\n } else {\n keys.push(key as PriKey<S>);\n }\n } else {\n // console.log('is is an array, length: ' + key.length);\n const locKeys = key as LocKey<L1 | L2 | L3 | L4 | L5>[];\n for (let i = 0; i < locKeys.length; i++) {\n // console.log('Pushing a key');\n keys.push(locKeys[i]);\n }\n }\n return keys;\n}\n\n// TODO: Exactly the same as in ContainedItemLib\nexport const constructPriKey = <S extends string>(\n pk: string | number | PriKey<S>,\n kt: S,\n) => {\n logger.trace('constructPriKey', { pk, kt });\n let pri: PriKey<S>;\n if (typeof pk === 'string' || typeof pk === 'number') {\n pri = { kt: kt as S, pk: pk };\n } else {\n pri = pk;\n }\n return pri;\n}\n\n// TODO: Exactly the same as in ContainedItemLib\nexport const cPK = constructPriKey;\n\nexport const toKeyTypeArray = <\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>(ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>):\n string[] => {\n logger.trace('toKeyTypeArray', { ik });\n if (isComKey(ik)) {\n const ck = ik as ComKey<S, L1, L2, L3, L4, L5>;\n return [ck.kt, ...ck.loc.map((l: LocKey<L1 | L2 | L3 | L4 | L5>) => l.kt)];\n } else {\n return [(ik as PriKey<S>).kt];\n }\n}\n\nexport const abbrevIK = <\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>(ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): string => {\n logger.trace('abbrevIK', { ik });\n if (ik) {\n if (isComKey(ik)) {\n const ck = ik as ComKey<S, L1, L2, L3, L4, L5>;\n return `${ck.kt}:${ck.pk}:${ck.loc.map((l: LocKey<L1 | L2 | L3 | L4 | L5>) => `${l.kt}:${l.lk}`).join(',')}`;\n } else {\n return `${(ik as PriKey<S>).kt}:${(ik as PriKey<S>).pk}`;\n }\n } else {\n return 'null IK';\n }\n}\n\nexport const abbrevLKA = <\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(keyArray: Array<LocKey<L1 | L2 | L3 | L4 | L5>> | null): string => {\n logger.trace('abbrevLKA', { keyArray });\n if (keyArray === undefined || keyArray === null) {\n return 'null LKA';\n } else {\n return keyArray.map(key => {\n if (key) {\n return `${key.kt}:${key.lk}`;\n } else {\n return key;\n }\n }).join(',');\n }\n}\n\nexport const primaryType = <\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>(ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): string => {\n logger.trace('primaryType', { ik });\n if (isComKey(ik)) {\n return (ik as ComKey<S, L1, L2, L3, L4, L5>).kt;\n } else {\n return (ik as PriKey<S>).kt;\n }\n}\n\n/**\n *\n * @param ik ItemKey to be used as a basis for a location\n * @returns\n */\nexport const itemKeyToLocKeyArray =\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 >(ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>): LocKeyArray<S, L1, L2, L3, L4> => {\n logger.trace('itemKeyToLocKeyArray', { ik: abbrevIK(ik) });\n let lka: Array<LocKey<L1 | L2 | L3 | L4 | L5>> = [];\n if (isComKey(ik)) {\n const ck = ik as ComKey<S, L1, L2, L3, L4, L5>;\n lka = [{ kt: ck.kt, lk: ck.pk } as unknown as LocKey<L1 | L2 | L3 | L4 | L5>, ...ck.loc];\n } else {\n const pk = ik as PriKey<S>;\n lka = [{ kt: pk.kt, lk: pk.pk } as unknown as LocKey<L1 | L2 | L3 | L4 | L5>];\n }\n logger.trace('itemKeyToLocKeyArray Results', { ik: abbrevIK(ik), lka: abbrevLKA(lka) });\n return lka as LocKeyArray<S, L1, L2, L3, L4>;\n }\n\nexport const ikToLKA = itemKeyToLocKeyArray;\n\n/**\n * Sometimes you need to take a location key array and convert it to the item key that points to the containing item.\n * @param lka A location key array\n * @returns An item key corresponding to the containing item this location refers to.\n */\nexport const locKeyArrayToItemKey =\n <\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n >(lka: LocKeyArray<L1, L2, L3, L4, L5>):\n PriKey<L1> | ComKey<L1, L2, L3, L4, L5> => {\n logger.trace('locKeyArrayToItemKey', { lka: abbrevLKA(lka as Array<LocKey<L1 | L2 | L3 | L4 | L5>>) });\n\n if (lka && lka.length === 1) {\n const priKey = cPK(lka[0].lk, lka[0].kt);\n return priKey as PriKey<L1>;\n } else if (lka && lka.length > 1 && lka[0] !== undefined) {\n const locs = lka.slice(1);\n const priKey = cPK(lka[0].lk, lka[0].kt);\n const comKey = { kt: priKey.kt, pk: priKey.pk, loc: locs as unknown as LocKeyArray<L2, L3, L4, L5> };\n return comKey as ComKey<L1, L2, L3, L4, L5>;\n } else {\n throw new Error('locKeyArrayToItemKey: lka is undefined or empty');\n }\n }\n\n// TODO: This is annoying that we have to check for '' and 'null'\nexport const isValidPriKey = <S extends string>(key: PriKey<S>): boolean => {\n const valid = (key !== undefined && key !== null)\n && (key.pk !== undefined && key.pk !== null && key.pk !== '' && key.pk !== 'null')\n && (key.kt !== undefined && key.kt !== null && key.kt !== '' && key.kt !== 'null');\n return valid;\n}\n\n// TODO: This is annoying that we have to check for '' and 'null'\nexport const isValidLocKey = <\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(key: LocKey<L1 | L2 | L3 | L4 | L5>): boolean => {\n const valid = (key !== undefined && key !== null)\n && (key.lk !== undefined && key.lk !== null && key.lk !== '' && key.lk !== 'null')\n && (key.kt !== undefined && key.kt !== null && key.kt !== '' && key.kt !== 'null');\n return valid;\n}\n\nexport const isValidLocKeyArray = <\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(keyArray: Array<LocKey<L1 | L2 | L3 | L4 | L5>>): boolean => {\n return (keyArray !== undefined && keyArray !== null) && keyArray.every(isValidLocKey);\n}\n\nexport const isValidComKey = <\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: ComKey<S, L1, L2, L3, L4, L5>): boolean => {\n return (key !== undefined\n && key !== null) && isValidPriKey(key) && isValidLocKeyArray(key.loc as Array<LocKey<L1 | L2 | L3 | L4 | L5>>);\n}\n\nexport const isValidItemKey = <\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: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): boolean => {\n return (isComKey(key) &&\n isValidComKey(key as ComKey<S, L1, L2, L3, L4, L5>)) || (isPriKey(key) && isValidPriKey(key as PriKey<S>));\n}\n\nexport const lkaToIK = locKeyArrayToItemKey;\n", "import { AllItemTypeArrays } from \"./keys\";\n\nexport class AItemService<\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> {\n\n private pkType: S;\n private parentService: AItemService<L1, L2, L3, L4, L5, never> | null = null;\n\n constructor(\n pkType: S,\n parentService?: AItemService<L1, L2, L3, L4, L5, never>,\n ) {\n this.pkType = pkType;\n if (parentService) {\n this.parentService = parentService;\n }\n }\n\n public getPkType = (): S => {\n return this.pkType;\n }\n\n public getKeyTypes = (): AllItemTypeArrays<S, L1, L2, L3, L4, L5> => {\n let keyTypes: readonly string[] = [this.getPkType()];\n\n if (this.parentService) {\n keyTypes = keyTypes.concat(this.parentService.getKeyTypes());\n }\n return keyTypes as AllItemTypeArrays<S, L1, L2, L3, L4, L5>;\n }\n\n}\n", "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", "import { cPK } from '../key/KUtils';\nimport {\n CompoundType,\n Condition,\n ConditionOperator,\n EventQuery,\n isCondition,\n ItemQuery,\n OrderDirection\n} from \"./ItemQuery\";\n\nexport class IQFactory {\n\n private query: ItemQuery = {};\n\n public constructor(query: ItemQuery = {}) {\n this.query = query;\n }\n\n public orderBy(field: string, direction: OrderDirection = 'asc') {\n if (!this.query.orderBy) {\n this.query.orderBy = [];\n }\n this.query.orderBy.push({ field, direction });\n return this;\n }\n\n public agg(name: string, query: ItemQuery) {\n if (!this.query.aggs) {\n this.query.aggs = {};\n }\n this.query.aggs[name] = query;\n return this;\n }\n\n public event(name: string, query: EventQuery) {\n if (!this.query.events) {\n this.query.events = {};\n }\n this.query.events[name] = query;\n return this;\n }\n\n public conditions(conditions: Condition[], compoundType: CompoundType = 'AND') {\n for (const condition of conditions) {\n if (!isCondition(condition)) {\n throw new Error(`Invalid condition: ${JSON.stringify(condition)}`);\n }\n }\n if (!this.query.compoundCondition) {\n // If there is no top-level compound condition, create one\n // with the given compound type. This will mostly likely be the most common case.\n this.query.compoundCondition = {\n compoundType,\n conditions: conditions,\n };\n } else {\n // If there is already a top-level compound condition, create a new compound condition\n // and add it to the conditions array of the top-level compound condition.\n const compoundCondition = {\n compoundType,\n conditions,\n };\n this.query.compoundCondition.conditions.push(compoundCondition);\n }\n return this;\n }\n\n public limit(limit: number) {\n this.query.limit = limit;\n return this;\n }\n\n public offset(offset: number) {\n this.query.offset = offset;\n return this;\n }\n\n // TODO: right now, we're only supporting PK refs for queries. Should add support for CKs\n public pk(kt: string, pk: string, name?: string) {\n if (!this.query.refs) {\n this.query.refs = {};\n }\n const refName = name || kt;\n this.query.refs[refName] = cPK<string>(pk, kt);\n return this;\n }\n\n public condition(\n column: string,\n value: string[] | string | number[] | number | boolean | Date,\n operator: ConditionOperator = '==',\n ) {\n const condition: Condition = { column, value, operator };\n if (isCondition(condition)) {\n if (!this.query.compoundCondition) {\n // If there is no top-level compound condition, create one\n // with the default compound type of 'AND'.\n this.query.compoundCondition = {\n compoundType: 'AND',\n conditions: [],\n };\n }\n this.query.compoundCondition.conditions.push(condition);\n return this;\n } else {\n throw new Error(`Invalid condition: ${JSON.stringify(condition)}`);\n }\n }\n\n public static all() {\n const iqFactory = new IQFactory();\n return iqFactory;\n }\n\n public static orderBy(field: string, direction: OrderDirection = 'asc') {\n const iqFactory = new IQFactory();\n return iqFactory.orderBy(field, direction);\n }\n\n public static agg(name: string, query: ItemQuery) {\n const iqFactory = new IQFactory();\n return iqFactory.agg(name, query);\n }\n\n public static event(name: string, query: EventQuery) {\n const iqFactory = new IQFactory();\n return iqFactory.event(name, query);\n }\n\n public static limit(limit: number) {\n const iqFactory = new IQFactory();\n return iqFactory.limit(limit);\n }\n\n public static offset(offset: number) {\n const iqFactory = new IQFactory();\n return iqFactory.offset(offset);\n }\n\n public static pk(kt: string, pk: string, name?: string) {\n const iqFactory = new IQFactory();\n return iqFactory.pk(kt, pk, name);\n }\n\n public static condition(\n column: string,\n value: string[] | string | number[] | number | boolean | Date,\n operator: ConditionOperator = '=='\n ) {\n const iqFactory = new IQFactory();\n return iqFactory.condition(column, value, operator);\n }\n\n public static conditions(conditions: Condition[], compoundType: CompoundType = 'AND') {\n const iqFactory = new IQFactory();\n return iqFactory.conditions(conditions, compoundType);\n }\n\n toQuery() {\n return this.query;\n }\n}", "import { Item, ReferenceItem, References } from \"../items\";\nimport { isItemKeyEqual, isPriKey } from \"../key/KUtils\";\nimport { ComKey, PriKey } from \"../keys\";\nimport LibLogger from \"../logger\";\nimport * as luxon 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 = luxon.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}\n", "/* eslint-disable indent */\n \nimport { 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\nconst validatePKForItem = <\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>, pkType: S): Item<S, L1, L2, L3, L4, L5> => {\n if (!item) {\n logger.error('Validating PK, Item is undefined', { item });\n throw new Error('Validating PK, Item is undefined');\n }\n if (!item.key) {\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\n const keyTypeArray = toKeyTypeArray(item.key as ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>);\n if (keyTypeArray[0] !== pkType) {\n logger.error('Key Type Array Mismatch', { keyTypeArray, pkType });\n throw new Error(`Item does not have the correct primary key type. Expected ${pkType}, got ${keyTypeArray[0]}`);\n }\n return item;\n};\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>(\n input: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[],\n pkType: S,\n): Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[] => {\n logger.trace('Checking Return Type', { input });\n\n if (Array.isArray(input)) {\n return input.map((item) => validatePKForItem(item, pkType));\n }\n return validatePKForItem(input, pkType);\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>(\n item: Item<S, L1, L2, L3, L4, L5>,\n 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 throw new Error('validating keys, item is undefined');\n }\n if (!item.key) {\n throw new Error('validating keys, item does not have a key: ' + JSON.stringify(item));\n }\n\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. Expected ${keyTypes.length}, but got ${keyTypeArray.length}`);\n }\n\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. Expected [${keyTypes.join(', ')}], but got [${keyTypeArray.join(', ')}]`);\n }\n return item;\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>(\n item: Item<S, L1, L2, L3, L4, L5>,\n): item is Item<S> & { key: PriKey<S> } => {\n return !!(item && item.key && isPriKey(item.key));\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>(\n item: Item<S, L1, L2, L3, L4, L5>,\n): item is Item<S, L1, L2, L3, L4, L5> & { key: ComKey<S, L1, L2, L3, L4, L5> } => {\n return !!(item && item.key && isComKey(item.key));\n};"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,aAAa;AAEpB,IAAM,YAAY,QAAQ,UAAU,aAAa;AAEjD,IAAO,iBAAQ;;;ACFf,IAAM,SAAS,eAAU,IAAI,YAAY;AAOlC,IAAM,aAAN,MAAM,YAAiB;AAAA,EAClB,MAAgD,CAAC;AAAA,EACjD,eAAe,CAAC,QAAW,KAAK,UAAU,GAAG;AAAA,EAEvD,YAAY,KAA4B,cAAmC;AACzE,QAAI,cAAc;AAChB,WAAK,eAAe;AAAA,IACtB;AACA,QAAI,KAAK;AAEP,aAAO,QAAQ,GAAG,EAAE,QAAQ,CAAC,CAAC,WAAW,KAAK,MAAM;AAClD,YAAI;AAEF,gBAAM,cAAc,KAAK,MAAM,SAAS;AACxC,eAAK,IAAI,SAAS,IAAI,EAAE,aAAa,MAAM;AAAA,QAC7C,QAAQ;AAEN,iBAAO,QAAQ,qDAAqD,EAAE,UAAU,CAAC;AAAA,QACnF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEO,IAAI,KAAQ,MAAe;AAChC,WAAO,MAAM,OAAO,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AC7C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AACA,MAAI,CAAC,KAAK,KAAK;AACb,UAAM,IAAI,MAAM,gDAAgD,KAAK,UAAU,IAAI,CAAC;AAAA,EACtF;AAEA,QAAM,eAAe,eAAe,KAAK,GAAgD;AACzF,MAAI,aAAa,WAAW,SAAS,QAAQ;AAC3C,UAAM,IAAI,MAAM,2DAA2D,SAAS,MAAM,aAAa,aAAa,MAAM,EAAE;AAAA,EAC9H;AAEA,QAAM,QAAiB,KAAK,UAAU,YAAY,MAAM,KAAK,UAAU,QAAQ;AAC/E,MAAI,CAAC,OAAO;AACV,IAAAA,QAAO,MAAM,2BAA2B,EAAE,cAAc,cAAc,SAAS,CAAC;AAChF,UAAM,IAAI,MAAM,uDAAuD,SAAS,KAAK,IAAI,CAAC,eAAe,aAAa,KAAK,IAAI,CAAC,GAAG;AAAA,EACrI;AACA,SAAO;AACT;AAEO,IAAM,YAAY,CAQvB,SACyC;AACzC,SAAO,CAAC,EAAE,QAAQ,KAAK,OAAO,SAAS,KAAK,GAAG;AACjD;AAEO,IAAM,YAAY,CAQvB,SACiF;AACjF,SAAO,CAAC,EAAE,QAAQ,KAAK,OAAO,SAAS,KAAK,GAAG;AACjD;",
|
|
6
|
-
"names": ["logger", "logger", "logger"]
|
|
7
|
-
}
|
package/dist/item/IFactory.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Item } from '../items';
|
|
2
|
-
import { ComKey, PriKey } from '../keys';
|
|
3
|
-
export declare class IFactory<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> {
|
|
4
|
-
private item;
|
|
5
|
-
constructor(props?: Record<string, any>);
|
|
6
|
-
addRef(i: Item<any, any | never, any | never, any | never, any | never, any | never>, name?: string): this;
|
|
7
|
-
static addRef<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(i: V, name?: string): IFactory<V, S, L1, L2, L3, L4, L5>;
|
|
8
|
-
addDefaultEvents(): this;
|
|
9
|
-
addEvent(name: string, at: Date | null, by?: ComKey<any, any | never, any | never, any | never, any | never, any | never> | PriKey<any>): this;
|
|
10
|
-
static addEvent<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(name: string, at: Date | null, by?: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): IFactory<V, S, L1, L2, L3, L4, L5>;
|
|
11
|
-
addProp(name: string, value: string | number | boolean | Date): this;
|
|
12
|
-
static addProp<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(name: string, value: string | number | boolean | Date): IFactory<V, S, L1, L2, L3, L4, L5>;
|
|
13
|
-
addProps(props: Record<string, any>): this;
|
|
14
|
-
static addProps<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(props: Record<string, any>): IFactory<V, S, L1, L2, L3, L4, L5>;
|
|
15
|
-
toItem(): V;
|
|
16
|
-
}
|
package/dist/item/IQFactory.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CompoundType, Condition, ConditionOperator, EventQuery, ItemQuery, OrderDirection } from "./ItemQuery";
|
|
2
|
-
export declare class IQFactory {
|
|
3
|
-
private query;
|
|
4
|
-
constructor(query?: ItemQuery);
|
|
5
|
-
orderBy(field: string, direction?: OrderDirection): this;
|
|
6
|
-
agg(name: string, query: ItemQuery): this;
|
|
7
|
-
event(name: string, query: EventQuery): this;
|
|
8
|
-
conditions(conditions: Condition[], compoundType?: CompoundType): this;
|
|
9
|
-
limit(limit: number): this;
|
|
10
|
-
offset(offset: number): this;
|
|
11
|
-
pk(kt: string, pk: string, name?: string): this;
|
|
12
|
-
condition(column: string, value: string[] | string | number[] | number | boolean | Date, operator?: ConditionOperator): this;
|
|
13
|
-
static all(): IQFactory;
|
|
14
|
-
static orderBy(field: string, direction?: OrderDirection): IQFactory;
|
|
15
|
-
static agg(name: string, query: ItemQuery): IQFactory;
|
|
16
|
-
static event(name: string, query: EventQuery): IQFactory;
|
|
17
|
-
static limit(limit: number): IQFactory;
|
|
18
|
-
static offset(offset: number): IQFactory;
|
|
19
|
-
static pk(kt: string, pk: string, name?: string): IQFactory;
|
|
20
|
-
static condition(column: string, value: string[] | string | number[] | number | boolean | Date, operator?: ConditionOperator): IQFactory;
|
|
21
|
-
static conditions(conditions: Condition[], compoundType?: CompoundType): IQFactory;
|
|
22
|
-
toQuery(): ItemQuery;
|
|
23
|
-
}
|
package/dist/item/IQUtils.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Item } from "../items";
|
|
2
|
-
import { ComKey, PriKey } from "../keys";
|
|
3
|
-
import { CompoundCondition, Condition, ItemQuery, QueryParams } from "./ItemQuery";
|
|
4
|
-
/**
|
|
5
|
-
* When we query or search, we're sending a GET request. This converts everything in ItemQuery into a flat
|
|
6
|
-
* object that can be sent over a GET request.
|
|
7
|
-
*
|
|
8
|
-
* Note that there is some discussion about this. Evidently Elastic supports search with POST, but that also
|
|
9
|
-
* feels like a bit of a hack. It's not a RESTful way to do things. So we're sticking with GET for now.
|
|
10
|
-
*
|
|
11
|
-
* For reference, look at RFC 9110 "HTTP Semantics", June which clarified on top of and RFC 7231. It's possible
|
|
12
|
-
* but there are so many caveats and conditions in the standard, it's not worth it.
|
|
13
|
-
*
|
|
14
|
-
* Anticipating the next question - "isn't there a limit to the length of a URL?" The specification does not
|
|
15
|
-
* specify a limit, and there are limits in various browsers and servers - Apache is 4,000 chars, Chrome is 2M chars.
|
|
16
|
-
* Short answer is that if this query is being used to craft something that complex, it is probably a better idea
|
|
17
|
-
* to provide an action or a custom query endpoint on the server.
|
|
18
|
-
*
|
|
19
|
-
* @param query
|
|
20
|
-
* @returns QueryParams ready to be get over a GET request.
|
|
21
|
-
*/
|
|
22
|
-
export declare const queryToParams: (query: ItemQuery) => QueryParams;
|
|
23
|
-
/**
|
|
24
|
-
* This method translates from a flat QueryParams object with stringify'd JSON back to a full ItemQuery.
|
|
25
|
-
*
|
|
26
|
-
* @param params Parameters sent over a GET request
|
|
27
|
-
* @returns A fully hydrated ItemQuery object.
|
|
28
|
-
*/
|
|
29
|
-
export declare const paramsToQuery: (params: QueryParams) => ItemQuery;
|
|
30
|
-
export declare const isQueryMatch: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(item: Item<S, L1, L2, L3, L4, L5>, query: ItemQuery) => boolean;
|
|
31
|
-
export declare const abbrevQuery: (query: ItemQuery | null | undefined) => string;
|
|
32
|
-
export declare const abbrevRef: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(key: string, ref: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => string;
|
|
33
|
-
export declare const abbrevAgg: (key: string, agg: ItemQuery) => string;
|
|
34
|
-
export declare const abbrevCompoundCondition: (compoundCondition: CompoundCondition) => string;
|
|
35
|
-
export declare const abbrevCondition: (condition: Condition | CompoundCondition) => string;
|
package/dist/item/IUtils.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Item } from "../items";
|
|
2
|
-
import { AllItemTypeArrays, ComKey, PriKey } from "../keys";
|
|
3
|
-
export declare const validatePK: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(input: Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[], pkType: S) => Item<S, L1, L2, L3, L4, L5> | Item<S, L1, L2, L3, L4, L5>[];
|
|
4
|
-
export declare const validateKeys: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(item: Item<S, L1, L2, L3, L4, L5>, keyTypes: AllItemTypeArrays<S, L1, L2, L3, L4, L5>) => Item<S, L1, L2, L3, L4, L5>;
|
|
5
|
-
export declare const isPriItem: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(item: Item<S, L1, L2, L3, L4, L5>) => item is Item<S> & {
|
|
6
|
-
key: PriKey<S>;
|
|
7
|
-
};
|
|
8
|
-
export declare const isComItem: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(item: Item<S, L1, L2, L3, L4, L5>) => item is Item<S, L1, L2, L3, L4, L5> & {
|
|
9
|
-
key: ComKey<S, L1, L2, L3, L4, L5>;
|
|
10
|
-
};
|
package/dist/item/ItemQuery.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { References } from '../items';
|
|
2
|
-
export type QueryParams = Record<string, string | number | boolean | Date>;
|
|
3
|
-
/**
|
|
4
|
-
* The operator for a condition. This is the same as the operators used in the Firestore query language.
|
|
5
|
-
*/
|
|
6
|
-
export type ConditionOperator = '==' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'not-in' | 'array-contains' | 'array-contains-any';
|
|
7
|
-
/**
|
|
8
|
-
* A single property condition is defined with a column, value, and operator.
|
|
9
|
-
* This is a condition that is used in a query.
|
|
10
|
-
*/
|
|
11
|
-
export type Condition = {
|
|
12
|
-
column: string;
|
|
13
|
-
value: string[] | string | number[] | number | boolean | Date;
|
|
14
|
-
operator: ConditionOperator;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* When applying a compound condition, the CompoundType defines the type of compound condition.
|
|
18
|
-
*/
|
|
19
|
-
export type CompoundType = 'AND' | 'OR';
|
|
20
|
-
/**
|
|
21
|
-
* When configuring a CompoundCondition this can contain a collection of conditions
|
|
22
|
-
* that will be applied to the query. By default, this is an AND conditiion that is associated
|
|
23
|
-
* with an array of Condition objects OR an array of CompoundCondition objects.
|
|
24
|
-
*
|
|
25
|
-
* For example, I could have { compoundType: 'AND', conditions: [{column: 'name', value: 'test', operator: '=='},
|
|
26
|
-
* {column: 'age', value: 21, operator: '>='}]} which would filter the query to only include items
|
|
27
|
-
* where the name is 'test' and the age is greater than or equal to 21.
|
|
28
|
-
*
|
|
29
|
-
* Or, I could have a { compoundType: 'OR', conditions: [{column: 'name', value: 'test', operator: '=='},
|
|
30
|
-
* {column: 'age', value: 21, operator: '>='}]} which would filter the query to only include items
|
|
31
|
-
* where the name is 'test' OR the age is greater than or equal to 21.
|
|
32
|
-
*
|
|
33
|
-
* I could also nest an OR within an AND, like this:
|
|
34
|
-
* ['AND', [{column: 'name', value: 'test', operator: '=='},
|
|
35
|
-
* { compoundType: 'OR', conditions: [{column: 'age', value: 21, operator: '<='},
|
|
36
|
-
* {column: 'age', value: 52, operator: '>='}]}]] which would filter the query to only include items where the
|
|
37
|
-
* name is 'test' and the age is less than or equal to 21 or greater than or equal to 52.
|
|
38
|
-
*/
|
|
39
|
-
export type CompoundCondition = {
|
|
40
|
-
compoundType: CompoundType;
|
|
41
|
-
conditions: Array<Condition | CompoundCondition>;
|
|
42
|
-
};
|
|
43
|
-
export declare const isCondition: (condition: any) => condition is Condition;
|
|
44
|
-
export type EventQuery = {
|
|
45
|
-
start?: Date;
|
|
46
|
-
end?: Date;
|
|
47
|
-
by?: string;
|
|
48
|
-
};
|
|
49
|
-
export type OrderDirection = 'asc' | 'desc';
|
|
50
|
-
export type OrderBy = {
|
|
51
|
-
field: string;
|
|
52
|
-
direction: OrderDirection;
|
|
53
|
-
};
|
|
54
|
-
export type ItemQuery = {
|
|
55
|
-
refs?: References;
|
|
56
|
-
compoundCondition?: CompoundCondition;
|
|
57
|
-
limit?: number;
|
|
58
|
-
offset?: number;
|
|
59
|
-
aggs?: Record<string, ItemQuery>;
|
|
60
|
-
events?: Record<string, EventQuery>;
|
|
61
|
-
orderBy?: OrderBy[];
|
|
62
|
-
};
|
package/dist/items.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ComKey, PriKey } from './keys';
|
|
2
|
-
export type RecursivePartial<T> = {
|
|
3
|
-
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
|
|
4
|
-
};
|
|
5
|
-
export type Identified<S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = {
|
|
6
|
-
key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* This is a generic item event, and it's designed to make sure we have the ability to define not just
|
|
10
|
-
* the required fields, but also the optional fields.
|
|
11
|
-
*/
|
|
12
|
-
export interface ItemEvent {
|
|
13
|
-
at: Date | null;
|
|
14
|
-
by?: ComKey<any, any | never, any | never, any | never, any | never, any | never> | PriKey<any>;
|
|
15
|
-
agg?: Item<any, any, any, any, any, any>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* This is a required item event, and it's here mainly to define that there are events that must be present.
|
|
19
|
-
*/
|
|
20
|
-
export interface RequiredItemEvent extends ItemEvent {
|
|
21
|
-
at: Date;
|
|
22
|
-
}
|
|
23
|
-
export type Evented = Record<string, ItemEvent>;
|
|
24
|
-
export interface Timestamped extends Evented {
|
|
25
|
-
created: RequiredItemEvent;
|
|
26
|
-
updated: RequiredItemEvent;
|
|
27
|
-
}
|
|
28
|
-
export interface Deletable extends Partial<Evented> {
|
|
29
|
-
deleted: ItemEvent;
|
|
30
|
-
}
|
|
31
|
-
export type ManagedEvents = Timestamped & Deletable;
|
|
32
|
-
export type References = Record<string, ComKey<string, string | never, string | never, string | never, string | never, string | never> | PriKey<string>>;
|
|
33
|
-
export type ReferenceItem<S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = {
|
|
34
|
-
key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>;
|
|
35
|
-
item: Item<S, L1, L2, L3, L4, L5>;
|
|
36
|
-
};
|
|
37
|
-
export type ReferenceItems = Record<string, ReferenceItem<string, string | never, string | never, string | never, string | never, string | never>>;
|
|
38
|
-
export interface Item<S extends string = never, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> extends Identified<S, L1, L2, L3, L4, L5> {
|
|
39
|
-
events: ManagedEvents & Evented;
|
|
40
|
-
aggs?: ReferenceItems;
|
|
41
|
-
refs?: References;
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Interface for properties that can be added to items
|
|
46
|
-
*/
|
|
47
|
-
export interface Propertied {
|
|
48
|
-
name: string;
|
|
49
|
-
value: number;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Type for item properties without the key - equivalent to Partial<Item> without the key
|
|
53
|
-
*/
|
|
54
|
-
export type ItemProperties<S extends string = never, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = Partial<Omit<Item<S, L1, L2, L3, L4, L5>, 'key'>>;
|
|
55
|
-
/**
|
|
56
|
-
* Type for item properties without the key - equivalent to Partial<Item> without the key
|
|
57
|
-
* This is an alias for ItemProperties for backward compatibility
|
|
58
|
-
*/
|
|
59
|
-
export type TypesProperties<S extends string = never, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = Partial<Omit<Item<S, L1, L2, L3, L4, L5>, 'key'>>;
|
package/dist/key/KUtils.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ComKey, LocKey, LocKeyArray, PriKey } from "../keys";
|
|
2
|
-
export declare const createNormalizedHashFunction: <T>() => (key: T) => string;
|
|
3
|
-
export declare const isPriKeyEqualNormalized: <S extends string>(a: PriKey<S>, b: PriKey<S>) => boolean;
|
|
4
|
-
export declare const isLocKeyEqualNormalized: <L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(a: LocKey<L1 | L2 | L3 | L4 | L5>, b: LocKey<L1 | L2 | L3 | L4 | L5>) => boolean;
|
|
5
|
-
export declare const isComKeyEqualNormalized: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(a: ComKey<S, L1, L2, L3, L4, L5>, b: ComKey<S, L1, L2, L3, L4, L5>) => boolean;
|
|
6
|
-
export declare const isItemKeyEqualNormalized: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(a: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, b: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => boolean;
|
|
7
|
-
export declare const isItemKeyEqual: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(a: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, b: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => boolean;
|
|
8
|
-
export declare const isPriKeyEqual: <S extends string>(a: PriKey<S>, b: PriKey<S>) => boolean;
|
|
9
|
-
export declare const isLocKeyEqual: <L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(a: LocKey<L1 | L2 | L3 | L4 | L5>, b: LocKey<L1 | L2 | L3 | L4 | L5>) => boolean;
|
|
10
|
-
export declare const isComKeyEqual: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(a: ComKey<S, L1, L2, L3, L4, L5>, b: ComKey<S, L1, L2, L3, L4, L5>) => boolean;
|
|
11
|
-
export declare const isItemKey: (key: any) => boolean;
|
|
12
|
-
export declare const isComKey: (key: any) => boolean;
|
|
13
|
-
export declare const isPriKey: (key: any) => boolean;
|
|
14
|
-
export declare const isLocKey: (key: any) => boolean;
|
|
15
|
-
export declare const generateKeyArray: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S> | LocKeyArray<L1, L2, L3, L4, L5> | []) => Array<PriKey<S> | LocKey<L1 | L2 | L3 | L4 | L5>>;
|
|
16
|
-
export declare const constructPriKey: <S extends string>(pk: string | number | PriKey<S>, kt: S) => PriKey<S>;
|
|
17
|
-
export declare const cPK: <S extends string>(pk: string | number | PriKey<S>, kt: S) => PriKey<S>;
|
|
18
|
-
export declare const toKeyTypeArray: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>) => string[];
|
|
19
|
-
export declare const abbrevIK: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => string;
|
|
20
|
-
export declare const abbrevLKA: <L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(keyArray: Array<LocKey<L1 | L2 | L3 | L4 | L5>> | null) => string;
|
|
21
|
-
export declare const primaryType: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(ik: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => string;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param ik ItemKey to be used as a basis for a location
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
export declare const itemKeyToLocKeyArray: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>) => LocKeyArray<S, L1, L2, L3, L4>;
|
|
28
|
-
export declare const ikToLKA: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(ik: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>) => LocKeyArray<S, L1, L2, L3, L4>;
|
|
29
|
-
/**
|
|
30
|
-
* Sometimes you need to take a location key array and convert it to the item key that points to the containing item.
|
|
31
|
-
* @param lka A location key array
|
|
32
|
-
* @returns An item key corresponding to the containing item this location refers to.
|
|
33
|
-
*/
|
|
34
|
-
export declare const locKeyArrayToItemKey: <L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(lka: LocKeyArray<L1, L2, L3, L4, L5>) => PriKey<L1> | ComKey<L1, L2, L3, L4, L5>;
|
|
35
|
-
export declare const isValidPriKey: <S extends string>(key: PriKey<S>) => boolean;
|
|
36
|
-
export declare const isValidLocKey: <L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(key: LocKey<L1 | L2 | L3 | L4 | L5>) => boolean;
|
|
37
|
-
export declare const isValidLocKeyArray: <L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(keyArray: Array<LocKey<L1 | L2 | L3 | L4 | L5>>) => boolean;
|
|
38
|
-
export declare const isValidComKey: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(key: ComKey<S, L1, L2, L3, L4, L5>) => boolean;
|
|
39
|
-
export declare const isValidItemKey: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => boolean;
|
|
40
|
-
export declare const lkaToIK: <L1 extends string, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(lka: LocKeyArray<L1, L2, L3, L4, L5>) => PriKey<L1> | ComKey<L1, L2, L3, L4, L5>;
|
package/dist/keys.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
2
|
-
export interface ComKey<S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> {
|
|
3
|
-
readonly kt: S;
|
|
4
|
-
readonly pk: UUID | string | number;
|
|
5
|
-
readonly loc: LocKeyArray<L1, L2, L3, L4, L5>;
|
|
6
|
-
}
|
|
7
|
-
export interface PriKey<S extends string> {
|
|
8
|
-
readonly kt: S;
|
|
9
|
-
readonly pk: UUID | string | number;
|
|
10
|
-
}
|
|
11
|
-
export interface LocKey<L extends string> {
|
|
12
|
-
readonly kt: L;
|
|
13
|
-
readonly lk: UUID | string | number;
|
|
14
|
-
}
|
|
15
|
-
export type LocKeyArray<L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = ([L5] extends [never] ? ([L4] extends [never] ? ([L3] extends [never] ? ([L2] extends [never] ? ([L1] extends [never] ? [
|
|
16
|
-
] | never : [
|
|
17
|
-
LocKey<L1>
|
|
18
|
-
]) : [
|
|
19
|
-
LocKey<L1>,
|
|
20
|
-
LocKey<L2>
|
|
21
|
-
]) : [
|
|
22
|
-
LocKey<L1>,
|
|
23
|
-
LocKey<L2>,
|
|
24
|
-
LocKey<L3>
|
|
25
|
-
]) : [
|
|
26
|
-
LocKey<L1>,
|
|
27
|
-
LocKey<L2>,
|
|
28
|
-
LocKey<L3>,
|
|
29
|
-
LocKey<L4>
|
|
30
|
-
]) : [
|
|
31
|
-
LocKey<L1>,
|
|
32
|
-
LocKey<L2>,
|
|
33
|
-
LocKey<L3>,
|
|
34
|
-
LocKey<L4>,
|
|
35
|
-
LocKey<L5>
|
|
36
|
-
]);
|
|
37
|
-
export type ItemTypeArray<S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = ([L5] extends [never] ? ([L4] extends [never] ? ([L3] extends [never] ? ([L2] extends [never] ? ([L1] extends [never] ? [
|
|
38
|
-
S
|
|
39
|
-
] : [
|
|
40
|
-
S,
|
|
41
|
-
L1
|
|
42
|
-
]) : [
|
|
43
|
-
S,
|
|
44
|
-
L1,
|
|
45
|
-
L2
|
|
46
|
-
]) : [
|
|
47
|
-
S,
|
|
48
|
-
L1,
|
|
49
|
-
L2,
|
|
50
|
-
L3
|
|
51
|
-
]) : [
|
|
52
|
-
S,
|
|
53
|
-
L1,
|
|
54
|
-
L2,
|
|
55
|
-
L3,
|
|
56
|
-
L4
|
|
57
|
-
]) : [
|
|
58
|
-
S,
|
|
59
|
-
L1,
|
|
60
|
-
L2,
|
|
61
|
-
L3,
|
|
62
|
-
L4,
|
|
63
|
-
L5
|
|
64
|
-
]);
|
|
65
|
-
export type AllItemTypeArrays<S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = readonly [S] | readonly [S, L1] | readonly [S, L1, L2] | readonly [S, L1, L2, L3] | readonly [S, L1, L2, L3, L4] | readonly [S, L1, L2, L3, L4, L5];
|
|
66
|
-
export type AllLocTypeArrays<L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = readonly [] | readonly [L1] | readonly [L1, L2] | readonly [L1, L2, L3] | readonly [L1, L2, L3, L4] | readonly [L1, L2, L3, L4, L5];
|
package/dist/logger.d.ts
DELETED