@fjell/lib-sequelize 4.4.70 → 4.4.71
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/RowProcessor.d.ts.map +1 -1
- package/dist/index.js +97 -20
- package/dist/index.js.map +4 -4
- package/dist/ops/all.d.ts.map +1 -1
- package/dist/ops/create.d.ts.map +1 -1
- package/dist/ops/update.d.ts.map +1 -1
- package/dist/processing/AggsAdapter.d.ts +47 -0
- package/dist/processing/AggsAdapter.d.ts.map +1 -0
- package/dist/processing/RefsAdapter.d.ts +11 -7
- package/dist/processing/RefsAdapter.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/ops/all.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../src/ops/all.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAoD,MAAM,aAAa,CAAC;AAK1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAA0B,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAM,MAAM,WAAW,CAAC;AAgC5C,eAAO,MAAM,eAAe,GAC1B,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,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAC/B,YAAY,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAA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":"","sources":["../../src/ops/create.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,YAAY,EAAsB,IAAI,EAAuB,MAAM,aAAa,CAAC;AAGvH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/ops/create.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,YAAY,EAAsB,IAAI,EAAuB,MAAM,aAAa,CAAC;AAGvH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA4DxC,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,EAEhD,UAAU,OAAO,CAAC,QAAQ,KACzB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAqLvC,CAAA"}
|
package/dist/ops/update.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/ops/update.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,IAAI,EAEJ,YAAY,EAEb,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAM,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/ops/update.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,IAAI,EAEJ,YAAY,EAEb,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAM,MAAM,WAAW,CAAC;AAgC5C,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,EAEhD,UAAU,OAAO,CAAC,QAAQ,KACzB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAmIvC,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AggsAdapter: Transparent wrapper for aggregations
|
|
3
|
+
*
|
|
4
|
+
* This module provides transparent conversion between direct aggregation properties
|
|
5
|
+
* and a unified aggs structure pattern. The wrapper is completely confined to the
|
|
6
|
+
* library boundaries - items are automatically wrapped when leaving libraries and
|
|
7
|
+
* unwrapped when entering.
|
|
8
|
+
*
|
|
9
|
+
* Key Principles:
|
|
10
|
+
* - Transparency: Users never need to think about wrapping/unwrapping
|
|
11
|
+
* - Boundary Confinement: All complexity stays within library boundaries
|
|
12
|
+
* - Automatic: Wrapping happens on output, unwrapping happens on input
|
|
13
|
+
* - Unified API: External code always sees aggs structure, regardless of backend
|
|
14
|
+
*/
|
|
15
|
+
import { Item } from "@fjell/core";
|
|
16
|
+
import { AggregationDefinition } from "@fjell/lib";
|
|
17
|
+
/**
|
|
18
|
+
* Converts an item to include an aggs structure.
|
|
19
|
+
* Aggregation properties are moved from direct properties to aggs[name].
|
|
20
|
+
*
|
|
21
|
+
* This is called automatically when items leave libraries (e.g., returned
|
|
22
|
+
* from operations). The aggs structure is added transparently - external
|
|
23
|
+
* code always sees items with aggs structure.
|
|
24
|
+
*
|
|
25
|
+
* @param item - The item (plain object)
|
|
26
|
+
* @param aggregationDefinitions - Array of AggregationDefinition configs
|
|
27
|
+
* @returns The item with an aggs structure added
|
|
28
|
+
*/
|
|
29
|
+
export declare function addAggsToItem<T extends Item<any, any, any, any, any, any>>(item: T, aggregationDefinitions: AggregationDefinition[]): T & {
|
|
30
|
+
aggs: Record<string, any>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Removes the aggs structure from an item, converting it back to
|
|
34
|
+
* direct properties. This is mainly for consistency since aggregations
|
|
35
|
+
* are read-only and typically not written back.
|
|
36
|
+
*
|
|
37
|
+
* This is called automatically when items enter libraries (e.g., passed
|
|
38
|
+
* to create/update operations). The aggs structure is removed transparently.
|
|
39
|
+
*
|
|
40
|
+
* @param item - The item with aggs structure
|
|
41
|
+
* @param aggregationDefinitions - Array of AggregationDefinition configs
|
|
42
|
+
* @returns The item without aggs structure, with aggregations as direct properties
|
|
43
|
+
*/
|
|
44
|
+
export declare function removeAggsFromItem<T extends Partial<Item<any, any, any, any, any, any>> & {
|
|
45
|
+
aggs?: Record<string, any>;
|
|
46
|
+
}>(item: T, aggregationDefinitions: AggregationDefinition[]): T;
|
|
47
|
+
//# sourceMappingURL=AggsAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AggsAdapter.d.ts","sourceRoot":"","sources":["../../src/processing/AggsAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAKnD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACxE,IAAI,EAAE,CAAC,EACP,sBAAsB,EAAE,qBAAqB,EAAE,GAC9C,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAqCnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EACvH,IAAI,EAAE,CAAC,EACP,sBAAsB,EAAE,qBAAqB,EAAE,GAC9C,CAAC,CAuBH"}
|
|
@@ -14,21 +14,22 @@
|
|
|
14
14
|
import { ComKey, Item, PriKey } from "@fjell/core";
|
|
15
15
|
import { SequelizeReferenceDefinition } from "./ReferenceBuilder";
|
|
16
16
|
/**
|
|
17
|
-
* Type for a reference structure
|
|
17
|
+
* Type for a reference structure with flattened item properties.
|
|
18
|
+
* When populated, item properties are merged directly onto the reference object.
|
|
19
|
+
* This allows access via refs.name.property instead of refs.name.item.property.
|
|
18
20
|
*/
|
|
19
21
|
export type ItemReference = {
|
|
20
22
|
key: PriKey<any> | ComKey<any, any, any, any, any, any>;
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
+
} & Partial<Omit<Item<any, any, any, any, any, any>, 'key'>>;
|
|
23
24
|
/**
|
|
24
25
|
* Builds a key structure (PriKey or ComKey) from a foreign key value and reference definition.
|
|
25
26
|
* This converts Sequelize's foreign key column pattern to Fjell's key structure.
|
|
26
27
|
*/
|
|
27
28
|
export declare function buildKeyFromForeignKey(refDef: SequelizeReferenceDefinition, foreignKeyValue: any, item: any): PriKey<any> | ComKey<any, any, any, any, any, any>;
|
|
28
29
|
/**
|
|
29
|
-
* Converts a Sequelize item to include a
|
|
30
|
+
* Converts a Sequelize item to include a flattened refs structure.
|
|
30
31
|
* Foreign key columns are moved to refs[name].key, and populated references
|
|
31
|
-
*
|
|
32
|
+
* have their properties merged directly onto refs[name] (not nested under item).
|
|
32
33
|
*
|
|
33
34
|
* This is called automatically when items leave the Sequelize library (e.g., returned
|
|
34
35
|
* from operations). The refs structure is added transparently - external code always
|
|
@@ -45,6 +46,9 @@ export declare function addRefsToSequelizeItem<T extends Item<any, any, any, any
|
|
|
45
46
|
* Updates foreign key columns in a Sequelize item based on refs structure.
|
|
46
47
|
* This is used when writing items that have been modified via the refs structure.
|
|
47
48
|
*
|
|
49
|
+
* With flattened references, item properties are directly on the reference object,
|
|
50
|
+
* so we reconstruct the item if properties beyond 'key' are present.
|
|
51
|
+
*
|
|
48
52
|
* @param item - The Sequelize item to update
|
|
49
53
|
* @param refs - The refs structure containing updated reference keys
|
|
50
54
|
* @param referenceDefinitions - Array of SequelizeReferenceDefinition configs
|
|
@@ -62,9 +66,9 @@ export declare function updateForeignKeysFromRefs(item: any, refs: Record<string
|
|
|
62
66
|
* @param referenceDefinitions - Array of SequelizeReferenceDefinition configs
|
|
63
67
|
* @returns The item without refs structure, with foreign keys updated from refs if present
|
|
64
68
|
*/
|
|
65
|
-
export declare function removeRefsFromSequelizeItem<T extends Item<any, any, any, any, any, any>>(item: T & {
|
|
69
|
+
export declare function removeRefsFromSequelizeItem<T extends Item<any, any, any, any, any, any>>(item: Partial<T> & {
|
|
66
70
|
refs?: Record<string, ItemReference>;
|
|
67
|
-
}, referenceDefinitions: SequelizeReferenceDefinition[]): T
|
|
71
|
+
}, referenceDefinitions: SequelizeReferenceDefinition[]): Partial<T>;
|
|
68
72
|
/**
|
|
69
73
|
* Creates a Proxy wrapper around a Sequelize item that provides dynamic refs access.
|
|
70
74
|
* This allows reading and writing refs structure while maintaining compatibility
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefsAdapter.d.ts","sourceRoot":"","sources":["../../src/processing/RefsAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAsB,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAKlE
|
|
1
|
+
{"version":3,"file":"RefsAdapter.d.ts","sourceRoot":"","sources":["../../src/processing/RefsAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAsB,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAKlE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;CACzD,GAAG,OAAO,CAAC,IAAI,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AI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC1E,IAAI,EAAE,CAAC,EACP,oBAAoB,EAAE,4BAA4B,EAAE,GACnD,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAAE,CAyC7C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjell/lib-sequelize",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.71",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"library",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"docs:test": "cd docs && npm run test"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@fjell/core": "^4.4.
|
|
45
|
-
"@fjell/lib": "^4.4.
|
|
44
|
+
"@fjell/core": "^4.4.66",
|
|
45
|
+
"@fjell/lib": "^4.4.75",
|
|
46
46
|
"@fjell/logging": "^4.4.59",
|
|
47
|
-
"@fjell/registry": "^4.4.
|
|
47
|
+
"@fjell/registry": "^4.4.72",
|
|
48
48
|
"dayjs": "^1.11.13",
|
|
49
49
|
"deepmerge": "^4.3.1",
|
|
50
50
|
"sequelize": "^6.37.7",
|