@fjell/lib-sequelize 4.4.14 → 4.4.16

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.
Files changed (91) hide show
  1. package/dist/{types/Operations.d.ts → Operations.d.ts} +5 -5
  2. package/dist/{types/SequelizeLibraryFactory.d.ts → SequelizeLibraryFactory.d.ts} +4 -4
  3. package/dist/{types/contained → contained}/SequelizeLibrary.d.ts +4 -4
  4. package/dist/index.js +1488 -0
  5. package/dist/index.js.map +7 -0
  6. package/dist/logger.d.ts +2 -0
  7. package/dist/{types/ops → ops}/all.d.ts +3 -3
  8. package/dist/{types/ops → ops}/create.d.ts +3 -3
  9. package/dist/{types/ops → ops}/find.d.ts +3 -3
  10. package/dist/{types/ops → ops}/get.d.ts +1 -1
  11. package/dist/{types/ops → ops}/one.d.ts +3 -3
  12. package/dist/{types/ops → ops}/remove.d.ts +4 -3
  13. package/dist/{types/ops → ops}/update.d.ts +3 -3
  14. package/dist/{types/primary → primary}/SequelizeLibrary.d.ts +4 -4
  15. package/package.json +17 -20
  16. package/dist/cjs/AggregationBuilder.cjs +0 -65
  17. package/dist/cjs/Coordinate.cjs +0 -24
  18. package/dist/cjs/Definition.cjs +0 -25
  19. package/dist/cjs/EventCoordinator.cjs +0 -54
  20. package/dist/cjs/KeyMaster.cjs +0 -151
  21. package/dist/cjs/OperationContext.cjs +0 -161
  22. package/dist/cjs/Operations.cjs +0 -34
  23. package/dist/cjs/Options.cjs +0 -46
  24. package/dist/cjs/QueryBuilder.cjs +0 -296
  25. package/dist/cjs/ReferenceBuilder.cjs +0 -76
  26. package/dist/cjs/RowProcessor.cjs +0 -56
  27. package/dist/cjs/SequelizeLibrary.cjs +0 -56
  28. package/dist/cjs/SequelizeLibraryFactory.cjs +0 -25
  29. package/dist/cjs/contained/SequelizeLibrary.cjs +0 -31
  30. package/dist/cjs/contained/index.cjs +0 -11
  31. package/dist/cjs/index.cjs +0 -26
  32. package/dist/cjs/logger.cjs +0 -10
  33. package/dist/cjs/ops/all.cjs +0 -145
  34. package/dist/cjs/ops/create.cjs +0 -252
  35. package/dist/cjs/ops/find.cjs +0 -47
  36. package/dist/cjs/ops/get.cjs +0 -92
  37. package/dist/cjs/ops/one.cjs +0 -27
  38. package/dist/cjs/ops/remove.cjs +0 -114
  39. package/dist/cjs/ops/update.cjs +0 -120
  40. package/dist/cjs/primary/SequelizeLibrary.cjs +0 -41
  41. package/dist/cjs/primary/index.cjs +0 -11
  42. package/dist/cjs/util/general.cjs +0 -48
  43. package/dist/cjs/util/relationshipUtils.cjs +0 -117
  44. package/dist/es/AggregationBuilder.js +0 -61
  45. package/dist/es/Coordinate.js +0 -19
  46. package/dist/es/Definition.js +0 -21
  47. package/dist/es/EventCoordinator.js +0 -48
  48. package/dist/es/KeyMaster.js +0 -146
  49. package/dist/es/OperationContext.js +0 -155
  50. package/dist/es/Operations.js +0 -30
  51. package/dist/es/Options.js +0 -23
  52. package/dist/es/QueryBuilder.js +0 -290
  53. package/dist/es/ReferenceBuilder.js +0 -72
  54. package/dist/es/RowProcessor.js +0 -52
  55. package/dist/es/SequelizeLibrary.js +0 -32
  56. package/dist/es/SequelizeLibraryFactory.js +0 -21
  57. package/dist/es/contained/SequelizeLibrary.js +0 -26
  58. package/dist/es/contained/index.js +0 -2
  59. package/dist/es/index.js +0 -11
  60. package/dist/es/logger.js +0 -6
  61. package/dist/es/ops/all.js +0 -141
  62. package/dist/es/ops/create.js +0 -248
  63. package/dist/es/ops/find.js +0 -43
  64. package/dist/es/ops/get.js +0 -88
  65. package/dist/es/ops/one.js +0 -23
  66. package/dist/es/ops/remove.js +0 -110
  67. package/dist/es/ops/update.js +0 -116
  68. package/dist/es/primary/SequelizeLibrary.js +0 -36
  69. package/dist/es/primary/index.js +0 -2
  70. package/dist/es/util/general.js +0 -44
  71. package/dist/es/util/relationshipUtils.js +0 -112
  72. package/dist/index.cjs +0 -1853
  73. package/dist/index.cjs.map +0 -1
  74. package/dist/types/AggregationBuilder.d.ts +0 -5
  75. package/dist/types/EventCoordinator.d.ts +0 -6
  76. package/dist/types/KeyMaster.d.ts +0 -4
  77. package/dist/types/OperationContext.d.ts +0 -72
  78. package/dist/types/QueryBuilder.d.ts +0 -12
  79. package/dist/types/ReferenceBuilder.d.ts +0 -4
  80. package/dist/types/RowProcessor.d.ts +0 -6
  81. package/dist/types/logger.d.ts +0 -2
  82. package/dist/types/util/general.d.ts +0 -4
  83. package/dist/types/util/relationshipUtils.d.ts +0 -21
  84. package/dist/{types/Coordinate.d.ts → Coordinate.d.ts} +0 -0
  85. package/dist/{types/Definition.d.ts → Definition.d.ts} +0 -0
  86. package/dist/{types/Options.d.ts → Options.d.ts} +1 -1
  87. package/dist/{types/Registry.d.ts → Registry.d.ts} +0 -0
  88. package/dist/{types/SequelizeLibrary.d.ts → SequelizeLibrary.d.ts} +1 -1
  89. /package/dist/{types/contained → contained}/index.d.ts +0 -0
  90. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
  91. /package/dist/{types/primary → primary}/index.d.ts +0 -0
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const registry = require('@fjell/registry');
6
- const logger$1 = require('./logger.cjs');
7
-
8
- const logger = logger$1.default.get('Coordinate');
9
- const SCOPE_SEQUELIZE = 'sequelize';
10
- const createCoordinate = (kta, scopes)=>{
11
- logger.debug('createCoordinate', {
12
- kta,
13
- scopes
14
- });
15
- const coordinate = registry.createCoordinate(kta, [
16
- SCOPE_SEQUELIZE,
17
- ...scopes || []
18
- ]);
19
- return coordinate;
20
- };
21
-
22
- exports.SCOPE_SEQUELIZE = SCOPE_SEQUELIZE;
23
- exports.createCoordinate = createCoordinate;
24
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29vcmRpbmF0ZS5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const Options = require('./Options.cjs');
6
- const logger$1 = require('./logger.cjs');
7
- const Coordinate = require('./Coordinate.cjs');
8
-
9
- const logger = logger$1.default.get('lib-sequelize', 'Definition');
10
- const createDefinition = (kta, scopes, libOptions)=>{
11
- logger.debug('createDefinition', {
12
- kta,
13
- scopes,
14
- libOptions
15
- });
16
- const coordinate = Coordinate.createCoordinate(kta, scopes);
17
- const options = Options.createOptions(libOptions);
18
- return {
19
- coordinate,
20
- options
21
- };
22
- };
23
-
24
- exports.createDefinition = createDefinition;
25
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGVmaW5pdGlvbi5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- require('deepmerge');
6
- const logger$1 = require('./logger.cjs');
7
-
8
- const logger = logger$1.default.get("sequelize", "EventCoordinator");
9
- //#endregion
10
- const populateEvents = (item)=>{
11
- const events = {
12
- created: {
13
- at: item.createdAt || null
14
- },
15
- updated: {
16
- at: item.updatedAt || null
17
- },
18
- deleted: {
19
- at: null
20
- }
21
- };
22
- item.events = events;
23
- return item;
24
- };
25
- const extractEvents = (item)=>{
26
- logger.default('Extracting Events to database fields', {
27
- item
28
- });
29
- if (item.events) {
30
- var _item_events_created, _item_events_updated, _item_events_deleted;
31
- if ((_item_events_created = item.events.created) === null || _item_events_created === void 0 ? void 0 : _item_events_created.at) {
32
- item.createdAt = item.events.created.at;
33
- }
34
- if ((_item_events_updated = item.events.updated) === null || _item_events_updated === void 0 ? void 0 : _item_events_updated.at) {
35
- item.updatedAt = item.events.updated.at;
36
- }
37
- if ((_item_events_deleted = item.events.deleted) === null || _item_events_deleted === void 0 ? void 0 : _item_events_deleted.at) {
38
- item.deletedAt = item.events.deleted.at;
39
- }
40
- }
41
- return item;
42
- };
43
- const removeEvents = (item)=>{
44
- logger.default('Removing Events', {
45
- item
46
- });
47
- delete item.events;
48
- return item;
49
- };
50
-
51
- exports.extractEvents = extractEvents;
52
- exports.populateEvents = populateEvents;
53
- exports.removeEvents = removeEvents;
54
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZlbnRDb29yZGluYXRvci5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
@@ -1,151 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const logger$1 = require('./logger.cjs');
6
- const relationshipUtils = require('./util/relationshipUtils.cjs');
7
-
8
- const logger = logger$1.default.get('sequelize', 'KeyMaster');
9
- // Helper function to extract location key value from item
10
- const extractLocationKeyValue = (model, item, locatorType, kta)=>{
11
- logger.default('Extracting location key value', {
12
- locatorType,
13
- kta
14
- });
15
- const relationshipInfo = relationshipUtils.buildRelationshipPath(model, locatorType, kta, true);
16
- if (!relationshipInfo.found) {
17
- throw new Error(`Location key '${locatorType}' cannot be resolved on model '${model.name}' or through its relationships.`);
18
- }
19
- if (relationshipInfo.isDirect) {
20
- // Direct foreign key field
21
- const foreignKeyField = `${locatorType}Id`;
22
- const value = item[foreignKeyField];
23
- if (typeof value === 'undefined' || value === null) {
24
- throw new Error(`Direct foreign key field '${foreignKeyField}' is missing or null in item`);
25
- }
26
- return value;
27
- } else {
28
- // Need to traverse relationship hierarchy
29
- // Find the path through the key type array
30
- const locatorIndex = kta.indexOf(locatorType);
31
- if (locatorIndex === -1) {
32
- throw new Error(`Locator type '${locatorType}' not found in key type array`);
33
- }
34
- // Start from the current item (index 0 in kta)
35
- let currentObject = item;
36
- // Traverse through each intermediate relationship to reach the target
37
- for(let i = 1; i < locatorIndex; i++){
38
- const intermediateType = kta[i];
39
- // Check if the intermediate relationship object is loaded
40
- if (currentObject[intermediateType] && typeof currentObject[intermediateType] === 'object') {
41
- currentObject = currentObject[intermediateType];
42
- } else {
43
- // Try the foreign key approach if the relationship object isn't loaded
44
- const foreignKeyField = `${intermediateType}Id`;
45
- if (typeof currentObject[foreignKeyField] !== 'undefined' && currentObject[foreignKeyField] !== null) {
46
- // We have the foreign key but not the loaded object, we can't traverse further
47
- throw new Error(`Intermediate relationship '${intermediateType}' is not loaded. Cannot traverse to '${locatorType}'. Either include the relationship in your query or ensure it's loaded.`);
48
- }
49
- throw new Error(`Intermediate relationship '${intermediateType}' is missing in the relationship chain. Expected path: ${kta.slice(0, locatorIndex + 1).join(' → ')}`);
50
- }
51
- }
52
- // Now extract the target locator value from the current object
53
- // First try to get it from the loaded relationship object
54
- if (currentObject[locatorType] && typeof currentObject[locatorType] === 'object' && typeof currentObject[locatorType].id !== 'undefined') {
55
- return currentObject[locatorType].id;
56
- }
57
- // If the relationship object isn't loaded, try the foreign key field
58
- const foreignKeyField = `${locatorType}Id`;
59
- if (typeof currentObject[foreignKeyField] !== 'undefined' && currentObject[foreignKeyField] !== null) {
60
- return currentObject[foreignKeyField];
61
- }
62
- throw new Error(`Unable to extract location key for '${locatorType}'. Neither the relationship object nor direct foreign key is available. Traversal path: ${kta.slice(0, locatorIndex + 1).join(' → ')}`);
63
- }
64
- };
65
- const removeKey = (item)=>{
66
- logger.default('Removing Key', {
67
- item
68
- });
69
- delete item.key;
70
- return item;
71
- };
72
- // export const populateKey = <
73
- // S extends string,
74
- // L1 extends string = never,
75
- // L2 extends string = never,
76
- // L3 extends string = never,
77
- // L4 extends string = never,
78
- // L5 extends string = never
79
- // >(
80
- // item: ItemProperties<S, L1, L2, L3, L4, L5>,
81
- // keyTypes: AllItemTypeArrays<S, L1, L2, L3, L4, L5>
82
- // ): ItemProperties<S, L1, L2, L3, L4, L5> => {
83
- // if (keyTypes.length === 1) {
84
- // item.key = { kt: keyTypes[0], pk: item.id };
85
- // delete item.id;
86
- // } else if (keyTypes.length === 2) {
87
- // item.key = {
88
- // kt: keyTypes[0], pk: item.id,
89
- // // TODO: Shouldn't this be inspecting the model to get the primary key type?
90
- // loc: [{ kt: keyTypes[1], lk: item[keyTypes[1] + 'Id'] }],
91
- // };
92
- // delete item.id;
93
- // delete item[keyTypes[1] + 'Id'];
94
- // } else {
95
- // throw new Error('Not implemented');
96
- // }
97
- // return item;
98
- // }
99
- const addKey = (model, item, keyTypes)=>{
100
- logger.default('Adding Key', {
101
- item
102
- });
103
- const key = {};
104
- const modelClass = model.constructor;
105
- const primaryKeyAttr = modelClass.primaryKeyAttribute;
106
- if (Array.isArray(keyTypes) && keyTypes.length > 1) {
107
- const type = [
108
- ...keyTypes
109
- ];
110
- const pkType = type.shift();
111
- Object.assign(key, {
112
- kt: pkType,
113
- pk: item[primaryKeyAttr]
114
- });
115
- // Build location keys for composite key
116
- const locationKeys = [];
117
- for (const locatorType of type){
118
- try {
119
- const lk = extractLocationKeyValue(modelClass, item, locatorType, keyTypes);
120
- locationKeys.push({
121
- kt: locatorType,
122
- lk
123
- });
124
- } catch (error) {
125
- const errorMessage = error instanceof Error ? error.message : String(error);
126
- logger.error(`Failed to extract location key for '${locatorType}'`, {
127
- error: errorMessage,
128
- item,
129
- keyTypes
130
- });
131
- throw error;
132
- }
133
- }
134
- Object.assign(key, {
135
- loc: locationKeys
136
- });
137
- } else {
138
- Object.assign(key, {
139
- kt: keyTypes[0],
140
- pk: item[primaryKeyAttr]
141
- });
142
- }
143
- Object.assign(item, {
144
- key
145
- });
146
- return item;
147
- };
148
-
149
- exports.addKey = addKey;
150
- exports.removeKey = removeKey;
151
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiS2V5TWFzdGVyLmNqcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
@@ -1,161 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const logger$1 = require('./logger.cjs');
6
-
7
- function _define_property(obj, key, value) {
8
- if (key in obj) {
9
- Object.defineProperty(obj, key, {
10
- value: value,
11
- enumerable: true,
12
- configurable: true,
13
- writable: true
14
- });
15
- } else {
16
- obj[key] = value;
17
- }
18
- return obj;
19
- }
20
- const logger = logger$1.default.get('sequelize', 'OperationContext');
21
- /**
22
- * Serialize an ItemKey to a string for use in sets and maps
23
- */ const serializeKey = (key)=>{
24
- if ('pk' in key && 'kt' in key && !('loc' in key)) {
25
- // PriKey
26
- return `${key.kt}:${key.pk}`;
27
- } else if ('pk' in key && 'kt' in key && 'loc' in key) {
28
- // ComKey
29
- const locStr = key.loc.map((l)=>`${l.kt}:${l.lk}`).join(',');
30
- return `${key.kt}:${key.pk}|${locStr}`;
31
- }
32
- throw new Error(`Unsupported key type: ${JSON.stringify(key)}`);
33
- };
34
- /**
35
- * Create a new OperationContext
36
- */ const createOperationContext = ()=>{
37
- const inProgress = new Set();
38
- const cache = new Map();
39
- return {
40
- inProgress,
41
- cache,
42
- markInProgress (key) {
43
- const serialized = serializeKey(key);
44
- logger.default('Marking key as in progress', {
45
- key,
46
- serialized
47
- });
48
- inProgress.add(serialized);
49
- },
50
- markComplete (key) {
51
- const serialized = serializeKey(key);
52
- logger.default('Marking key as complete', {
53
- key,
54
- serialized
55
- });
56
- inProgress.delete(serialized);
57
- },
58
- isInProgress (key) {
59
- const serialized = serializeKey(key);
60
- const result = inProgress.has(serialized);
61
- logger.default('Checking if key is in progress', {
62
- key,
63
- serialized,
64
- result
65
- });
66
- return result;
67
- },
68
- getCached (key) {
69
- const serialized = serializeKey(key);
70
- const result = cache.get(serialized);
71
- logger.default('Getting cached item', {
72
- key,
73
- serialized,
74
- found: !!result
75
- });
76
- return result;
77
- },
78
- setCached (key, item) {
79
- const serialized = serializeKey(key);
80
- logger.default('Caching item', {
81
- key,
82
- serialized
83
- });
84
- cache.set(serialized, item);
85
- },
86
- isCached (key) {
87
- const serialized = serializeKey(key);
88
- const result = cache.has(serialized);
89
- logger.default('Checking if key is cached', {
90
- key,
91
- serialized,
92
- result
93
- });
94
- return result;
95
- }
96
- };
97
- };
98
- /**
99
- * Context Manager for sharing context across operations without changing public interfaces
100
- */ class ContextManager {
101
- /**
102
- * Set the current context for the current operation chain
103
- */ setCurrentContext(context) {
104
- const contextId = Math.random().toString(36).substring(7);
105
- this.contexts.set(contextId, context);
106
- this.currentContextId = contextId;
107
- logger.default('Set current context', {
108
- contextId
109
- });
110
- return contextId;
111
- }
112
- /**
113
- * Get the current context if one is set
114
- */ getCurrentContext() {
115
- if (this.currentContextId) {
116
- const context = this.contexts.get(this.currentContextId);
117
- logger.default('Got current context', {
118
- contextId: this.currentContextId,
119
- found: !!context
120
- });
121
- return context;
122
- }
123
- return;
124
- }
125
- /**
126
- * Clear the current context
127
- */ clearCurrentContext() {
128
- if (this.currentContextId) {
129
- logger.default('Clearing current context', {
130
- contextId: this.currentContextId
131
- });
132
- this.contexts.delete(this.currentContextId);
133
- this.currentContextId = null;
134
- }
135
- }
136
- /**
137
- * Execute a function with a specific context set as current
138
- */ async withContext(context, fn) {
139
- const previousContextId = this.currentContextId;
140
- this.setCurrentContext(context);
141
- try {
142
- return await fn();
143
- } finally{
144
- this.clearCurrentContext();
145
- if (previousContextId) {
146
- this.currentContextId = previousContextId;
147
- }
148
- }
149
- }
150
- constructor(){
151
- _define_property(this, "contexts", new Map());
152
- _define_property(this, "currentContextId", null);
153
- }
154
- }
155
- // Global context manager instance
156
- const contextManager = new ContextManager();
157
-
158
- exports.contextManager = contextManager;
159
- exports.createOperationContext = createOperationContext;
160
- exports.serializeKey = serializeKey;
161
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT3BlcmF0aW9uQ29udGV4dC5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
@@ -1,34 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const all = require('./ops/all.cjs');
6
- const create = require('./ops/create.cjs');
7
- const find = require('./ops/find.cjs');
8
- const get = require('./ops/get.cjs');
9
- const one = require('./ops/one.cjs');
10
- const remove = require('./ops/remove.cjs');
11
- const update = require('./ops/update.cjs');
12
-
13
- const createOperations = (models, coordinate, registry, options)=>{
14
- const operations = {};
15
- // Create a definition-like object for backward compatibility with existing operation functions
16
- const definition = {
17
- coordinate,
18
- options
19
- };
20
- operations.all = all.getAllOperation(models, definition, registry);
21
- operations.one = one.getOneOperation(models, definition, registry);
22
- operations.create = create.getCreateOperation(models, definition, registry);
23
- operations.update = update.getUpdateOperation(models, definition, registry);
24
- operations.get = get.getGetOperation(models, definition, registry);
25
- operations.remove = remove.getRemoveOperation(models, definition);
26
- operations.find = find.getFindOperation(models, definition, registry);
27
- operations.upsert = async ()=>{
28
- throw new Error('Not implemented');
29
- };
30
- return operations;
31
- };
32
-
33
- exports.createOperations = createOperations;
34
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT3BlcmF0aW9ucy5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const Library = require('@fjell/lib');
6
-
7
- function _interopNamespaceDefault(e) {
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
9
- if (e) {
10
- for (const k in e) {
11
- if (k !== 'default') {
12
- const d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: () => e[k]
16
- });
17
- }
18
- }
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
-
24
- const Library__namespace = /*#__PURE__*/_interopNamespaceDefault(Library);
25
-
26
- const DEFAULT_SEQUELIZE_OPTIONS = {
27
- deleteOnRemove: false,
28
- references: [],
29
- aggregations: []
30
- };
31
- const createOptions = (sequelizeOptions)=>{
32
- // Create the base lib options
33
- const baseOptions = Library__namespace.createOptions(sequelizeOptions);
34
- var _sequelizeOptions_deleteOnRemove, _sequelizeOptions_references, _sequelizeOptions_aggregations;
35
- // Add Sequelize-specific defaults
36
- const result = {
37
- ...baseOptions,
38
- deleteOnRemove: (_sequelizeOptions_deleteOnRemove = sequelizeOptions === null || sequelizeOptions === void 0 ? void 0 : sequelizeOptions.deleteOnRemove) !== null && _sequelizeOptions_deleteOnRemove !== void 0 ? _sequelizeOptions_deleteOnRemove : DEFAULT_SEQUELIZE_OPTIONS.deleteOnRemove,
39
- references: (_sequelizeOptions_references = sequelizeOptions === null || sequelizeOptions === void 0 ? void 0 : sequelizeOptions.references) !== null && _sequelizeOptions_references !== void 0 ? _sequelizeOptions_references : DEFAULT_SEQUELIZE_OPTIONS.references,
40
- aggregations: (_sequelizeOptions_aggregations = sequelizeOptions === null || sequelizeOptions === void 0 ? void 0 : sequelizeOptions.aggregations) !== null && _sequelizeOptions_aggregations !== void 0 ? _sequelizeOptions_aggregations : DEFAULT_SEQUELIZE_OPTIONS.aggregations
41
- };
42
- return result;
43
- };
44
-
45
- exports.createOptions = createOptions;
46
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT3B0aW9ucy5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9