@fjell/lib-sequelize 4.4.44 → 4.4.46
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/Options.d.ts +43 -16
- package/dist/Options.d.ts.map +1 -1
- package/dist/RowProcessor.d.ts +5 -3
- package/dist/RowProcessor.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +152 -258
- package/dist/index.js.map +4 -4
- package/dist/ops/remove.d.ts +1 -1
- package/dist/ops/remove.d.ts.map +1 -1
- package/dist/processing/ReferenceBuilder.d.ts +37 -0
- package/dist/processing/ReferenceBuilder.d.ts.map +1 -0
- package/dist/processing/index.d.ts +3 -0
- package/dist/processing/index.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/AggregationBuilder.d.ts +0 -6
- package/dist/AggregationBuilder.d.ts.map +0 -1
- package/dist/OperationContext.d.ts +0 -66
- package/dist/OperationContext.d.ts.map +0 -1
- package/dist/ReferenceBuilder.d.ts +0 -5
- package/dist/ReferenceBuilder.d.ts.map +0 -1
package/dist/ops/remove.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { ComKey, PriKey } from "@fjell/core";
|
|
|
2
2
|
import { Item } from "@fjell/core";
|
|
3
3
|
import { Definition } from "../Definition";
|
|
4
4
|
import { ModelStatic } from "sequelize";
|
|
5
|
-
export declare const getRemoveOperation: <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>(models: ModelStatic<any>[], definition: Definition<V, S, L1, L2, L3, L4, L5>,
|
|
5
|
+
export declare const getRemoveOperation: <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>(models: ModelStatic<any>[], definition: Definition<V, S, L1, L2, L3, L4, L5>, _registry: import("@fjell/lib").Registry) => (key: PriKey<S> | ComKey<S, L1, L2, L3, L4, L5>) => Promise<V>;
|
|
6
6
|
//# sourceMappingURL=remove.d.ts.map
|
package/dist/ops/remove.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/ops/remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAgC,IAAI,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA8CxC,eAAO,MAAM,kBAAkB,GAC7B,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EACrC,CAAC,SAAS,MAAM,EAChB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EAEzB,QAAQ,WAAW,CAAC,GAAG,CAAC,EAAE,EAC1B,YAAY,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAChD,
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/ops/remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAgC,IAAI,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA8CxC,eAAO,MAAM,kBAAkB,GAC7B,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EACrC,CAAC,SAAS,MAAM,EAChB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EAEzB,QAAQ,WAAW,CAAC,GAAG,CAAC,EAAE,EAC1B,YAAY,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAChD,WAAW,OAAO,YAAY,EAAE,QAAQ,WAMjC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,KAC7C,OAAO,CAAC,CAAC,CAqEb,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Item } from "@fjell/core";
|
|
2
|
+
import type { Registry } from "@fjell/lib";
|
|
3
|
+
import { OperationContext } from "@fjell/lib";
|
|
4
|
+
/**
|
|
5
|
+
* Sequelize-specific definition for a reference relationship.
|
|
6
|
+
* References in Sequelize are stored as foreign key columns (e.g., "authorId")
|
|
7
|
+
* and populated into properties on the item.
|
|
8
|
+
*/
|
|
9
|
+
export interface SequelizeReferenceDefinition {
|
|
10
|
+
/** Column name containing the foreign key value (e.g., "authorId") */
|
|
11
|
+
column: string;
|
|
12
|
+
/** Key type array of the referenced item */
|
|
13
|
+
kta: string[];
|
|
14
|
+
/** Property name to populate with the referenced item (e.g., "author") */
|
|
15
|
+
property: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build a reference by looking up a related item by its key from a column value.
|
|
19
|
+
* The referenced item will be populated directly into a property on the item.
|
|
20
|
+
*
|
|
21
|
+
* @param item - The item to populate with reference data
|
|
22
|
+
* @param referenceDefinition - Sequelize-specific definition of what to reference
|
|
23
|
+
* @param registry - Registry to look up library instances
|
|
24
|
+
* @param context - Optional operation context for caching and cycle detection
|
|
25
|
+
* @returns The item with the reference property populated
|
|
26
|
+
*/
|
|
27
|
+
export declare const buildSequelizeReference: (item: any, referenceDefinition: SequelizeReferenceDefinition, registry: Registry, context?: OperationContext) => Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Strip populated reference properties from item before writing to database.
|
|
30
|
+
* This ensures we only store the foreign key columns, not the full populated items.
|
|
31
|
+
*
|
|
32
|
+
* @param item - The item to strip references from
|
|
33
|
+
* @param referenceDefinitions - Array of reference definitions to strip
|
|
34
|
+
* @returns The item with only foreign key values (no populated items)
|
|
35
|
+
*/
|
|
36
|
+
export declare const stripSequelizeReferenceItems: <S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never>(item: Partial<Item<S, L1, L2, L3, L4, L5>>, referenceDefinitions: SequelizeReferenceDefinition[]) => Partial<Item<S, L1, L2, L3, L4, L5>>;
|
|
37
|
+
//# sourceMappingURL=ReferenceBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceBuilder.d.ts","sourceRoot":"","sources":["../../src/processing/ReferenceBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,GAAG,EACT,qBAAqB,4BAA4B,EACjD,UAAU,QAAQ,EAClB,UAAU,gBAAgB,iBA0G3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACvC,CAAC,SAAS,MAAM,EAChB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EAEvB,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAC1C,sBAAsB,4BAA4B,EAAE,KACnD,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAWvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/processing/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjell/lib-sequelize",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.46",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"library",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@fjell/core": "^4.4.42",
|
|
45
|
-
"@fjell/lib": "^4.4.
|
|
45
|
+
"@fjell/lib": "^4.4.47",
|
|
46
46
|
"@fjell/logging": "^4.4.47",
|
|
47
|
-
"@fjell/registry": "^4.4.
|
|
47
|
+
"@fjell/registry": "^4.4.42",
|
|
48
48
|
"dayjs": "^1.11.13",
|
|
49
49
|
"deepmerge": "^4.3.1",
|
|
50
50
|
"sequelize": "^6.37.7",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Item } from "@fjell/core";
|
|
2
|
-
import * as Library from "@fjell/lib";
|
|
3
|
-
import { AggregationDefinition } from "./Options";
|
|
4
|
-
import { OperationContext } from "./OperationContext";
|
|
5
|
-
export declare const buildAggregation: (item: Item, aggregationDefinition: AggregationDefinition, registry: Library.Registry, context?: OperationContext) => Promise<any>;
|
|
6
|
-
//# sourceMappingURL=AggregationBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AggregationBuilder.d.ts","sourceRoot":"","sources":["../src/AggregationBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,IAAI,EAAe,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAkB,gBAAgB,EAAgB,MAAM,oBAAoB,CAAC;AAKpF,eAAO,MAAM,gBAAgB,GAC3B,MAAM,IAAI,EACV,uBAAuB,qBAAqB,EAC5C,UAAU,OAAO,CAAC,QAAQ,EAC1B,UAAU,gBAAgB,iBA2D3B,CAAA"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ComKey, Item, PriKey } from "@fjell/core";
|
|
2
|
-
export type ItemKey = PriKey<any> | ComKey<any, any, any, any, any, any>;
|
|
3
|
-
export interface OperationContext {
|
|
4
|
-
/**
|
|
5
|
-
* Set of serialized keys that are currently being processed.
|
|
6
|
-
* Used to detect circular dependencies.
|
|
7
|
-
*/
|
|
8
|
-
inProgress: Set<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Cache of fully loaded objects keyed by serialized key.
|
|
11
|
-
* Used to avoid duplicate work and provide already-loaded objects.
|
|
12
|
-
* Can store individual items, arrays, or any other values.
|
|
13
|
-
*/
|
|
14
|
-
cache: Map<string, any>;
|
|
15
|
-
/**
|
|
16
|
-
* Add a key to the in-progress set
|
|
17
|
-
*/
|
|
18
|
-
markInProgress(key: ItemKey): void;
|
|
19
|
-
/**
|
|
20
|
-
* Remove a key from the in-progress set
|
|
21
|
-
*/
|
|
22
|
-
markComplete(key: ItemKey): void;
|
|
23
|
-
/**
|
|
24
|
-
* Check if a key is currently being processed (cycle detection)
|
|
25
|
-
*/
|
|
26
|
-
isInProgress(key: ItemKey): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Get a cached object by key
|
|
29
|
-
*/
|
|
30
|
-
getCached(key: ItemKey): Item<any, any, any, any, any, any> | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Cache a loaded object by key
|
|
33
|
-
*/
|
|
34
|
-
setCached(key: ItemKey, item: Item<any, any, any, any, any, any>): void;
|
|
35
|
-
/**
|
|
36
|
-
* Check if an object is cached
|
|
37
|
-
*/
|
|
38
|
-
isCached(key: ItemKey): boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Serialize an ItemKey to a string for use in sets and maps
|
|
42
|
-
*/
|
|
43
|
-
export declare const serializeKey: (key: ItemKey) => string;
|
|
44
|
-
/**
|
|
45
|
-
* Create a new OperationContext
|
|
46
|
-
*/
|
|
47
|
-
export declare const createOperationContext: () => OperationContext;
|
|
48
|
-
/**
|
|
49
|
-
* Context Manager for sharing context across operations without changing public interfaces
|
|
50
|
-
* Uses AsyncLocalStorage to properly maintain context across async boundaries
|
|
51
|
-
*/
|
|
52
|
-
declare class ContextManager {
|
|
53
|
-
private asyncLocalStorage;
|
|
54
|
-
/**
|
|
55
|
-
* Get the current context if one is set
|
|
56
|
-
*/
|
|
57
|
-
getCurrentContext(): OperationContext | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* Execute a function with a specific context set as current
|
|
60
|
-
* The context will be available to all async operations within the function
|
|
61
|
-
*/
|
|
62
|
-
withContext<T>(context: OperationContext, fn: () => Promise<T>): Promise<T>;
|
|
63
|
-
}
|
|
64
|
-
export declare const contextManager: ContextManager;
|
|
65
|
-
export {};
|
|
66
|
-
//# sourceMappingURL=OperationContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OperationContext.d.ts","sourceRoot":"","sources":["../src/OperationContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMnD,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAExB;;;;OAIG;IACH,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IAEpC;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IAExE;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExE;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,KAAG,MAU3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO,gBA+CzC,CAAC;AAEF;;;GAGG;AACH,cAAM,cAAc;IAClB,OAAO,CAAC,iBAAiB,CAA6C;IAEtE;;OAEG;IACH,iBAAiB,IAAI,gBAAgB,GAAG,SAAS;IAQjD;;;OAGG;IACG,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAIlF;AAGD,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ReferenceDefinition } from "./Options";
|
|
2
|
-
import * as Library from "@fjell/lib";
|
|
3
|
-
import { OperationContext } from "./OperationContext";
|
|
4
|
-
export declare const buildReference: (item: any, referenceDefinition: ReferenceDefinition, registry: Library.Registry, context?: OperationContext) => Promise<any>;
|
|
5
|
-
//# sourceMappingURL=ReferenceBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReferenceBuilder.d.ts","sourceRoot":"","sources":["../src/ReferenceBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKtD,eAAO,MAAM,cAAc,GACzB,MAAM,GAAG,EACT,qBAAqB,mBAAmB,EACxC,UAAU,OAAO,CAAC,QAAQ,EAC1B,UAAU,gBAAgB,iBA4G3B,CAAA"}
|