@squidcloud/local-backend 1.0.65 → 1.0.67

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 (182) hide show
  1. package/dist/common/src/ai-assistant.context.d.ts +13 -13
  2. package/dist/common/src/ai-assistant.context.js +19 -19
  3. package/dist/common/src/ai-assistant.schemas.d.ts +243 -243
  4. package/dist/common/src/ai-assistant.schemas.js +210 -210
  5. package/dist/common/src/ai-assistant.types.d.ts +90 -90
  6. package/dist/common/src/ai-assistant.types.js +11 -11
  7. package/dist/common/src/api-call.context.d.ts +13 -13
  8. package/dist/common/src/api-call.context.js +16 -16
  9. package/dist/common/src/api.types.d.ts +23 -23
  10. package/dist/common/src/api.types.js +2 -2
  11. package/dist/common/src/application.schemas.d.ts +1312 -1312
  12. package/dist/common/src/application.schemas.js +860 -860
  13. package/dist/common/src/application.types.d.ts +186 -186
  14. package/dist/common/src/application.types.js +89 -89
  15. package/dist/common/src/backend-function.schemas.d.ts +3 -3
  16. package/dist/common/src/backend-function.schemas.js +12 -12
  17. package/dist/common/src/backend-function.types.d.ts +6 -6
  18. package/dist/common/src/backend-function.types.js +2 -2
  19. package/dist/common/src/backend-run.types.d.ts +54 -54
  20. package/dist/common/src/backend-run.types.js +96 -96
  21. package/dist/common/src/bundle-api.types.d.ts +63 -63
  22. package/dist/common/src/bundle-api.types.js +2 -2
  23. package/dist/common/src/bundle-data.types.d.ts +59 -59
  24. package/dist/common/src/bundle-data.types.js +2 -2
  25. package/dist/common/src/communication.types.d.ts +18 -18
  26. package/dist/common/src/communication.types.js +40 -40
  27. package/dist/common/src/context.types.d.ts +24 -24
  28. package/dist/common/src/context.types.js +2 -2
  29. package/dist/common/src/distributed-lock.context.d.ts +5 -5
  30. package/dist/common/src/distributed-lock.context.js +10 -10
  31. package/dist/common/src/document.types.d.ts +32 -32
  32. package/dist/common/src/document.types.js +50 -50
  33. package/dist/common/src/graphql.context.d.ts +14 -14
  34. package/dist/common/src/graphql.context.js +12 -12
  35. package/dist/common/src/graphql.types.d.ts +11 -11
  36. package/dist/common/src/graphql.types.js +34 -34
  37. package/dist/common/src/heartbeat.types.d.ts +4 -4
  38. package/dist/common/src/heartbeat.types.js +16 -16
  39. package/dist/common/src/http-status.enum.d.ts +50 -50
  40. package/dist/common/src/http-status.enum.js +54 -54
  41. package/dist/common/src/index.d.ts +55 -55
  42. package/dist/common/src/index.js +71 -71
  43. package/dist/common/src/integrations/ai_assistant.types.d.ts +24 -24
  44. package/dist/common/src/integrations/ai_assistant.types.js +2 -2
  45. package/dist/common/src/integrations/api.types.d.ts +80 -80
  46. package/dist/common/src/integrations/api.types.js +2 -2
  47. package/dist/common/src/integrations/auth.types.d.ts +39 -39
  48. package/dist/common/src/integrations/auth.types.js +2 -2
  49. package/dist/common/src/integrations/database.types.d.ts +231 -231
  50. package/dist/common/src/integrations/database.types.js +2 -2
  51. package/dist/common/src/integrations/index.d.ts +124 -124
  52. package/dist/common/src/integrations/index.js +111 -111
  53. package/dist/common/src/integrations/observability.types.d.ts +23 -23
  54. package/dist/common/src/integrations/observability.types.js +23 -23
  55. package/dist/common/src/logger.types.d.ts +21 -21
  56. package/dist/common/src/logger.types.js +11 -11
  57. package/dist/common/src/metrics.types.d.ts +73 -73
  58. package/dist/common/src/metrics.types.js +11 -11
  59. package/dist/common/src/mutation.context.d.ts +13 -13
  60. package/dist/common/src/mutation.context.js +26 -26
  61. package/dist/common/src/mutation.schemas.d.ts +5 -5
  62. package/dist/common/src/mutation.schemas.js +114 -114
  63. package/dist/common/src/mutation.types.d.ts +63 -63
  64. package/dist/common/src/mutation.types.js +142 -142
  65. package/dist/common/src/named-query.context.d.ts +4 -4
  66. package/dist/common/src/named-query.context.js +9 -9
  67. package/dist/common/src/named-query.schemas.d.ts +3 -3
  68. package/dist/common/src/named-query.schemas.js +13 -13
  69. package/dist/common/src/named-query.types.d.ts +8 -8
  70. package/dist/common/src/named-query.types.js +2 -2
  71. package/dist/common/src/query/base-query-builder.d.ts +37 -37
  72. package/dist/common/src/query/base-query-builder.js +36 -36
  73. package/dist/common/src/query/index.d.ts +4 -4
  74. package/dist/common/src/query/index.js +20 -20
  75. package/dist/common/src/query/pagination.d.ts +42 -42
  76. package/dist/common/src/query/pagination.js +164 -164
  77. package/dist/common/src/query/query-context.d.ts +47 -47
  78. package/dist/common/src/query/query-context.js +159 -159
  79. package/dist/common/src/query/serialized-query.types.d.ts +24 -24
  80. package/dist/common/src/query/serialized-query.types.js +2 -2
  81. package/dist/common/src/query.types.d.ts +86 -86
  82. package/dist/common/src/query.types.js +153 -153
  83. package/dist/common/src/regions.d.ts +21 -21
  84. package/dist/common/src/regions.js +46 -46
  85. package/dist/common/src/schema/schema.types.d.ts +30 -30
  86. package/dist/common/src/schema/schema.types.js +172 -172
  87. package/dist/common/src/secret.schemas.d.ts +6 -6
  88. package/dist/common/src/secret.schemas.js +38 -32
  89. package/dist/common/src/secret.schemas.js.map +1 -1
  90. package/dist/common/src/secret.types.d.ts +49 -49
  91. package/dist/common/src/secret.types.js +5 -5
  92. package/dist/common/src/security.types.d.ts +3 -3
  93. package/dist/common/src/security.types.js +2 -2
  94. package/dist/common/src/socket.schemas.d.ts +3 -3
  95. package/dist/common/src/socket.schemas.js +58 -58
  96. package/dist/common/src/socket.types.d.ts +112 -112
  97. package/dist/common/src/socket.types.js +2 -2
  98. package/dist/common/src/time-units.d.ts +5 -5
  99. package/dist/common/src/time-units.js +8 -8
  100. package/dist/common/src/trigger.types.d.ts +15 -15
  101. package/dist/common/src/trigger.types.js +2 -2
  102. package/dist/common/src/types.d.ts +21 -21
  103. package/dist/common/src/types.js +2 -2
  104. package/dist/common/src/utils/array.d.ts +8 -8
  105. package/dist/common/src/utils/array.js +54 -54
  106. package/dist/common/src/utils/assert.d.ts +8 -8
  107. package/dist/common/src/utils/assert.js +49 -49
  108. package/dist/common/src/utils/error.d.ts +4 -4
  109. package/dist/common/src/utils/error.js +10 -10
  110. package/dist/common/src/utils/global.utils.d.ts +10 -10
  111. package/dist/common/src/utils/global.utils.js +46 -46
  112. package/dist/common/src/utils/http.d.ts +2 -2
  113. package/dist/common/src/utils/http.js +41 -40
  114. package/dist/common/src/utils/http.js.map +1 -1
  115. package/dist/common/src/utils/id.d.ts +2 -2
  116. package/dist/common/src/utils/id.js +21 -21
  117. package/dist/common/src/utils/lock.manager.d.ts +9 -9
  118. package/dist/common/src/utils/lock.manager.js +39 -39
  119. package/dist/common/src/utils/nullish.d.ts +2 -2
  120. package/dist/common/src/utils/nullish.js +11 -11
  121. package/dist/common/src/utils/object.d.ts +5 -5
  122. package/dist/common/src/utils/object.js +75 -75
  123. package/dist/common/src/utils/serialization.d.ts +6 -6
  124. package/dist/common/src/utils/serialization.js +77 -77
  125. package/dist/common/src/utils/transforms.d.ts +18 -18
  126. package/dist/common/src/utils/transforms.js +92 -92
  127. package/dist/common/src/utils/url.d.ts +1 -1
  128. package/dist/common/src/utils/url.js +15 -15
  129. package/dist/common/src/utils/validation.d.ts +17 -17
  130. package/dist/common/src/utils/validation.js +209 -209
  131. package/dist/common/src/webhook-response.d.ts +6 -6
  132. package/dist/common/src/webhook-response.js +2 -2
  133. package/dist/common/src/websocket.impl.d.ts +21 -21
  134. package/dist/common/src/websocket.impl.js +76 -76
  135. package/dist/internal-common/src/async-queue.d.ts +4 -4
  136. package/dist/internal-common/src/async-queue.js +17 -17
  137. package/dist/internal-common/src/code-executor.types.d.ts +13 -13
  138. package/dist/internal-common/src/code-executor.types.js +2 -2
  139. package/dist/internal-common/src/dao.types.d.ts +46 -46
  140. package/dist/internal-common/src/dao.types.js +2 -2
  141. package/dist/internal-common/src/environment/environment.types.d.ts +74 -74
  142. package/dist/internal-common/src/environment/environment.types.js +2 -2
  143. package/dist/internal-common/src/environment/index.d.ts +6 -6
  144. package/dist/internal-common/src/environment/index.js +27 -27
  145. package/dist/internal-common/src/environment/local.environment.d.ts +2 -2
  146. package/dist/internal-common/src/environment/local.environment.js +62 -62
  147. package/dist/internal-common/src/filters/custom-exception.filter.d.ts +6 -6
  148. package/dist/internal-common/src/filters/custom-exception.filter.js +44 -44
  149. package/dist/internal-common/src/index.d.ts +14 -14
  150. package/dist/internal-common/src/index.js +32 -32
  151. package/dist/internal-common/src/interceptors/body.interceptor.d.ts +5 -5
  152. package/dist/internal-common/src/interceptors/body.interceptor.js +24 -24
  153. package/dist/internal-common/src/kafka/kafka.manager.d.ts +22 -22
  154. package/dist/internal-common/src/kafka/kafka.manager.js +129 -129
  155. package/dist/internal-common/src/kafka/kafka.types.d.ts +17 -17
  156. package/dist/internal-common/src/kafka/kafka.types.js +2 -2
  157. package/dist/internal-common/src/kafka-observability-publisher.d.ts +11 -11
  158. package/dist/internal-common/src/kafka-observability-publisher.js +20 -20
  159. package/dist/internal-common/src/local-dev.types.d.ts +35 -35
  160. package/dist/internal-common/src/local-dev.types.js +2 -2
  161. package/dist/internal-common/src/observability-publisher.d.ts +9 -9
  162. package/dist/internal-common/src/observability-publisher.js +58 -58
  163. package/dist/internal-common/src/observability.types.d.ts +17 -17
  164. package/dist/internal-common/src/observability.types.js +2 -2
  165. package/dist/internal-common/src/shutdown.manager.d.ts +20 -20
  166. package/dist/internal-common/src/shutdown.manager.js +75 -75
  167. package/dist/internal-common/src/utils.d.ts +5 -5
  168. package/dist/internal-common/src/utils.js +29 -29
  169. package/dist/local-backend/src/index.d.ts +4 -4
  170. package/dist/local-backend/src/index.js +20 -20
  171. package/dist/local-backend/src/local-backend-socket.service.d.ts +19 -19
  172. package/dist/local-backend/src/local-backend-socket.service.js +110 -110
  173. package/dist/local-backend/src/local-backend.app.d.ts +2 -2
  174. package/dist/local-backend/src/local-backend.app.js +19 -19
  175. package/dist/local-backend/src/local-backend.controller.d.ts +8 -8
  176. package/dist/local-backend/src/local-backend.controller.js +49 -49
  177. package/dist/local-backend/src/local-backend.module.d.ts +8 -8
  178. package/dist/local-backend/src/local-backend.module.js +53 -53
  179. package/dist/local-backend/src/local-backend.service.d.ts +15 -15
  180. package/dist/local-backend/src/local-backend.service.js +165 -165
  181. package/dist/tsconfig.build.tsbuildinfo +1 -1
  182. package/package.json +1 -1
@@ -1,143 +1,143 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reduceMutations = exports.convertInsertToUpdate = exports.applyUpdateMutation = exports.mergeMutations = exports.sortUpdateMutationProperties = void 0;
4
- const _ = require("lodash");
5
- const rxjs_1 = require("rxjs");
6
- const assert_1 = require("./utils/assert");
7
- const object_1 = require("./utils/object");
8
- function applyStringFn(initialValue, propertyMutation) {
9
- switch (propertyMutation.fn) {
10
- case 'trim':
11
- if (typeof initialValue !== 'string')
12
- return initialValue;
13
- return initialValue.trim();
14
- case 'extendString':
15
- if (initialValue === null || initialValue === undefined)
16
- return propertyMutation.value;
17
- return initialValue + propertyMutation.value;
18
- default:
19
- throw new Error('Unknown string function: ' + JSON.stringify(propertyMutation));
20
- }
21
- }
22
- function applyNumericFn(initialValue, propertyMutation) {
23
- switch (propertyMutation.fn) {
24
- case 'increment':
25
- if (initialValue === null || initialValue === undefined)
26
- return propertyMutation.value;
27
- return initialValue + propertyMutation.value;
28
- default:
29
- throw new Error('Unknown numeric function: ' + JSON.stringify(propertyMutation));
30
- }
31
- }
32
- function applyPropertyMutation(property, propertyMutation) {
33
- switch (propertyMutation.type) {
34
- case 'applyNumericFn':
35
- return applyNumericFn(property, propertyMutation);
36
- case 'applyStringFn':
37
- return applyStringFn(property, propertyMutation);
38
- case 'update':
39
- return typeof propertyMutation.value === 'object' ? _.cloneDeep(propertyMutation.value) : propertyMutation.value;
40
- case 'removeProperty':
41
- return undefined;
42
- default:
43
- throw new Error('Unknown property mutation type: ' + JSON.stringify(propertyMutation));
44
- }
45
- }
46
- function sortUpdateMutationProperties(updateMutation) {
47
- return Object.entries(updateMutation.properties).sort(([propA], [propB]) => {
48
- const propADots = propA.split('.').length;
49
- const propBDots = propB.split('.').length;
50
- return propADots - propBDots;
51
- });
52
- }
53
- exports.sortUpdateMutationProperties = sortUpdateMutationProperties;
54
- function mergeMutations(mutationA, mutationB) {
55
- if (mutationB.type === 'insert')
56
- return mutationB;
57
- if (mutationB.type === 'delete')
58
- return mutationB;
59
- if (mutationA.type === 'delete')
60
- throw new Error('Cannot delete and then update');
61
- (0, assert_1.assertTruthy)(mutationB.type === 'update', 'Invalid mutation type');
62
- if (mutationA.type === 'update')
63
- return mergeUpdateMutations(mutationA, mutationB);
64
- const result = _.cloneDeep(mutationA);
65
- for (const [fieldName, propertyMutationsAr] of sortUpdateMutationProperties(mutationB)) {
66
- const propertyMutations = propertyMutationsAr;
67
- for (const propertyMutation of propertyMutations) {
68
- const value = applyPropertyMutation((0, object_1.getInPath)(result.properties, fieldName), propertyMutation);
69
- if (value === undefined) {
70
- (0, object_1.deleteInPath)(result.properties, fieldName);
71
- }
72
- else {
73
- (0, object_1.setInPath)(result.properties, fieldName, value);
74
- }
75
- }
76
- }
77
- return result;
78
- }
79
- exports.mergeMutations = mergeMutations;
80
- function mergeUpdateMutations(mutationA, mutationB) {
81
- const result = _.cloneDeep(mutationA);
82
- mutationB = _.cloneDeep(mutationB);
83
- for (const [aPropName] of sortUpdateMutationProperties(result)) {
84
- const aPropNameDots = aPropName.split('.').length;
85
- const isOverriddenByMutationB = Object.entries(mutationB.properties).some(([bPropName]) => {
86
- return aPropName.startsWith(bPropName + '.') && aPropNameDots > bPropName.split('.').length;
87
- });
88
- if (isOverriddenByMutationB) {
89
- delete result.properties[aPropName];
90
- }
91
- }
92
- for (const [bPropName, bPropValues] of sortUpdateMutationProperties(mutationB)) {
93
- result.properties[bPropName] = [...(result.properties[bPropName] || []), ...bPropValues];
94
- }
95
- return result;
96
- }
97
- function applyUpdateMutation(doc, updateMutation) {
98
- if (!doc)
99
- return undefined;
100
- const result = Object.assign({}, doc);
101
- const entries = sortUpdateMutationProperties(updateMutation);
102
- for (const [fieldName, propertyMutationsAr] of entries) {
103
- const propertyMutations = propertyMutationsAr;
104
- for (const propertyMutation of propertyMutations) {
105
- const value = applyPropertyMutation((0, object_1.getInPath)(result, fieldName), propertyMutation);
106
- if (value === undefined) {
107
- (0, object_1.deleteInPath)(result, fieldName);
108
- }
109
- else {
110
- (0, object_1.setInPath)(result, fieldName, value);
111
- }
112
- }
113
- }
114
- return result;
115
- }
116
- exports.applyUpdateMutation = applyUpdateMutation;
117
- function convertInsertToUpdate(insertMutation) {
118
- const result = {
119
- type: 'update',
120
- squidDocIdObj: insertMutation.squidDocIdObj,
121
- properties: {},
122
- };
123
- for (const [key, value] of Object.entries(insertMutation.properties)) {
124
- result.properties[key] = [{ type: 'update', value }];
125
- }
126
- return result;
127
- }
128
- exports.convertInsertToUpdate = convertInsertToUpdate;
129
- function reduceMutations(mutations) {
130
- let result = [];
131
- (0, rxjs_1.from)(mutations)
132
- .pipe((0, rxjs_1.groupBy)((mutation) => {
133
- return `${mutation.squidDocIdObj.integrationId}${mutation.squidDocIdObj.collectionName}/${mutation.squidDocIdObj.docId}`;
134
- }), (0, rxjs_1.mergeMap)((mutationsGroup) => mutationsGroup.pipe((0, rxjs_1.reduce)((mutationA, mutationB) => {
135
- return mergeMutations(mutationA, mutationB);
136
- }))), (0, rxjs_1.toArray)())
137
- .subscribe((value) => {
138
- result = value;
139
- });
140
- return result;
141
- }
142
- exports.reduceMutations = reduceMutations;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reduceMutations = exports.convertInsertToUpdate = exports.applyUpdateMutation = exports.mergeMutations = exports.sortUpdateMutationProperties = void 0;
4
+ const _ = require("lodash");
5
+ const rxjs_1 = require("rxjs");
6
+ const assert_1 = require("./utils/assert");
7
+ const object_1 = require("./utils/object");
8
+ function applyStringFn(initialValue, propertyMutation) {
9
+ switch (propertyMutation.fn) {
10
+ case 'trim':
11
+ if (typeof initialValue !== 'string')
12
+ return initialValue;
13
+ return initialValue.trim();
14
+ case 'extendString':
15
+ if (initialValue === null || initialValue === undefined)
16
+ return propertyMutation.value;
17
+ return initialValue + propertyMutation.value;
18
+ default:
19
+ throw new Error('Unknown string function: ' + JSON.stringify(propertyMutation));
20
+ }
21
+ }
22
+ function applyNumericFn(initialValue, propertyMutation) {
23
+ switch (propertyMutation.fn) {
24
+ case 'increment':
25
+ if (initialValue === null || initialValue === undefined)
26
+ return propertyMutation.value;
27
+ return initialValue + propertyMutation.value;
28
+ default:
29
+ throw new Error('Unknown numeric function: ' + JSON.stringify(propertyMutation));
30
+ }
31
+ }
32
+ function applyPropertyMutation(property, propertyMutation) {
33
+ switch (propertyMutation.type) {
34
+ case 'applyNumericFn':
35
+ return applyNumericFn(property, propertyMutation);
36
+ case 'applyStringFn':
37
+ return applyStringFn(property, propertyMutation);
38
+ case 'update':
39
+ return typeof propertyMutation.value === 'object' ? _.cloneDeep(propertyMutation.value) : propertyMutation.value;
40
+ case 'removeProperty':
41
+ return undefined;
42
+ default:
43
+ throw new Error('Unknown property mutation type: ' + JSON.stringify(propertyMutation));
44
+ }
45
+ }
46
+ function sortUpdateMutationProperties(updateMutation) {
47
+ return Object.entries(updateMutation.properties).sort(([propA], [propB]) => {
48
+ const propADots = propA.split('.').length;
49
+ const propBDots = propB.split('.').length;
50
+ return propADots - propBDots;
51
+ });
52
+ }
53
+ exports.sortUpdateMutationProperties = sortUpdateMutationProperties;
54
+ function mergeMutations(mutationA, mutationB) {
55
+ if (mutationB.type === 'insert')
56
+ return mutationB;
57
+ if (mutationB.type === 'delete')
58
+ return mutationB;
59
+ if (mutationA.type === 'delete')
60
+ throw new Error('Cannot delete and then update');
61
+ (0, assert_1.assertTruthy)(mutationB.type === 'update', 'Invalid mutation type');
62
+ if (mutationA.type === 'update')
63
+ return mergeUpdateMutations(mutationA, mutationB);
64
+ const result = _.cloneDeep(mutationA);
65
+ for (const [fieldName, propertyMutationsAr] of sortUpdateMutationProperties(mutationB)) {
66
+ const propertyMutations = propertyMutationsAr;
67
+ for (const propertyMutation of propertyMutations) {
68
+ const value = applyPropertyMutation((0, object_1.getInPath)(result.properties, fieldName), propertyMutation);
69
+ if (value === undefined) {
70
+ (0, object_1.deleteInPath)(result.properties, fieldName);
71
+ }
72
+ else {
73
+ (0, object_1.setInPath)(result.properties, fieldName, value);
74
+ }
75
+ }
76
+ }
77
+ return result;
78
+ }
79
+ exports.mergeMutations = mergeMutations;
80
+ function mergeUpdateMutations(mutationA, mutationB) {
81
+ const result = _.cloneDeep(mutationA);
82
+ mutationB = _.cloneDeep(mutationB);
83
+ for (const [aPropName] of sortUpdateMutationProperties(result)) {
84
+ const aPropNameDots = aPropName.split('.').length;
85
+ const isOverriddenByMutationB = Object.entries(mutationB.properties).some(([bPropName]) => {
86
+ return aPropName.startsWith(bPropName + '.') && aPropNameDots > bPropName.split('.').length;
87
+ });
88
+ if (isOverriddenByMutationB) {
89
+ delete result.properties[aPropName];
90
+ }
91
+ }
92
+ for (const [bPropName, bPropValues] of sortUpdateMutationProperties(mutationB)) {
93
+ result.properties[bPropName] = [...(result.properties[bPropName] || []), ...bPropValues];
94
+ }
95
+ return result;
96
+ }
97
+ function applyUpdateMutation(doc, updateMutation) {
98
+ if (!doc)
99
+ return undefined;
100
+ const result = Object.assign({}, doc);
101
+ const entries = sortUpdateMutationProperties(updateMutation);
102
+ for (const [fieldName, propertyMutationsAr] of entries) {
103
+ const propertyMutations = propertyMutationsAr;
104
+ for (const propertyMutation of propertyMutations) {
105
+ const value = applyPropertyMutation((0, object_1.getInPath)(result, fieldName), propertyMutation);
106
+ if (value === undefined) {
107
+ (0, object_1.deleteInPath)(result, fieldName);
108
+ }
109
+ else {
110
+ (0, object_1.setInPath)(result, fieldName, value);
111
+ }
112
+ }
113
+ }
114
+ return result;
115
+ }
116
+ exports.applyUpdateMutation = applyUpdateMutation;
117
+ function convertInsertToUpdate(insertMutation) {
118
+ const result = {
119
+ type: 'update',
120
+ squidDocIdObj: insertMutation.squidDocIdObj,
121
+ properties: {},
122
+ };
123
+ for (const [key, value] of Object.entries(insertMutation.properties)) {
124
+ result.properties[key] = [{ type: 'update', value }];
125
+ }
126
+ return result;
127
+ }
128
+ exports.convertInsertToUpdate = convertInsertToUpdate;
129
+ function reduceMutations(mutations) {
130
+ let result = [];
131
+ (0, rxjs_1.from)(mutations)
132
+ .pipe((0, rxjs_1.groupBy)((mutation) => {
133
+ return `${mutation.squidDocIdObj.integrationId}${mutation.squidDocIdObj.collectionName}/${mutation.squidDocIdObj.docId}`;
134
+ }), (0, rxjs_1.mergeMap)((mutationsGroup) => mutationsGroup.pipe((0, rxjs_1.reduce)((mutationA, mutationB) => {
135
+ return mergeMutations(mutationA, mutationB);
136
+ }))), (0, rxjs_1.toArray)())
137
+ .subscribe((value) => {
138
+ result = value;
139
+ });
140
+ return result;
141
+ }
142
+ exports.reduceMutations = reduceMutations;
143
143
  //# sourceMappingURL=mutation.types.js.map
@@ -1,4 +1,4 @@
1
- export declare class NamedQueryContext {
2
- readonly params: Record<string, any>;
3
- constructor(params: Record<string, any>);
4
- }
1
+ export declare class NamedQueryContext {
2
+ readonly params: Record<string, any>;
3
+ constructor(params: Record<string, any>);
4
+ }
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NamedQueryContext = void 0;
4
- class NamedQueryContext {
5
- constructor(params) {
6
- this.params = params;
7
- }
8
- }
9
- exports.NamedQueryContext = NamedQueryContext;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NamedQueryContext = void 0;
4
+ class NamedQueryContext {
5
+ constructor(params) {
6
+ this.params = params;
7
+ }
8
+ }
9
+ exports.NamedQueryContext = NamedQueryContext;
10
10
  //# sourceMappingURL=named-query.context.js.map
@@ -1,3 +1,3 @@
1
- import { JSONSchemaType } from 'ajv';
2
- import { ExecuteNamedQueryRequest } from './named-query.types';
3
- export declare const ExecuteNamedQueryRequestSchema: JSONSchemaType<ExecuteNamedQueryRequest>;
1
+ import { JSONSchemaType } from 'ajv';
2
+ import { ExecuteNamedQueryRequest } from './named-query.types';
3
+ export declare const ExecuteNamedQueryRequestSchema: JSONSchemaType<ExecuteNamedQueryRequest>;
@@ -1,14 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExecuteNamedQueryRequestSchema = void 0;
4
- exports.ExecuteNamedQueryRequestSchema = {
5
- type: 'object',
6
- required: ['integrationId', 'queryName', 'paramsRecordStr', 'clientRequestId'],
7
- properties: {
8
- integrationId: { type: 'string', nullable: false },
9
- queryName: { type: 'string', nullable: false },
10
- paramsRecordStr: { type: 'string', nullable: false },
11
- clientRequestId: { type: 'string', nullable: false },
12
- },
13
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecuteNamedQueryRequestSchema = void 0;
4
+ exports.ExecuteNamedQueryRequestSchema = {
5
+ type: 'object',
6
+ required: ['integrationId', 'queryName', 'paramsRecordStr', 'clientRequestId'],
7
+ properties: {
8
+ integrationId: { type: 'string', nullable: false },
9
+ queryName: { type: 'string', nullable: false },
10
+ paramsRecordStr: { type: 'string', nullable: false },
11
+ clientRequestId: { type: 'string', nullable: false },
12
+ },
13
+ };
14
14
  //# sourceMappingURL=named-query.schemas.js.map
@@ -1,8 +1,8 @@
1
- import { ClientRequestId, IntegrationId } from './communication.types';
2
- import { QueryName } from './application.types';
3
- export interface ExecuteNamedQueryRequest {
4
- integrationId: IntegrationId;
5
- queryName: QueryName;
6
- paramsRecordStr: string;
7
- clientRequestId: ClientRequestId;
8
- }
1
+ import { ClientRequestId, IntegrationId } from './communication.types';
2
+ import { QueryName } from './application.types';
3
+ export interface ExecuteNamedQueryRequest {
4
+ integrationId: IntegrationId;
5
+ queryName: QueryName;
6
+ paramsRecordStr: string;
7
+ clientRequestId: ClientRequestId;
8
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=named-query.types.js.map
@@ -1,37 +1,37 @@
1
- import { Observable } from 'rxjs';
2
- import { DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
3
- import { FieldSort, Operator, SimpleCondition } from '../query.types';
4
- import { SerializedQuery } from './serialized-query.types';
5
- import { PaginationOptions, Pagination } from './pagination';
6
- export interface SnapshotEmitter<ReturnType> {
7
- snapshot(): Promise<Array<ReturnType>>;
8
- snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
9
- peek(): Array<ReturnType>;
10
- clone(): SnapshotEmitter<ReturnType>;
11
- getSortOrders(): Array<FieldSort<any>>;
12
- addCompositeCondition(conditions: Array<SimpleCondition>): SnapshotEmitter<ReturnType>;
13
- limit(limit: number): SnapshotEmitter<ReturnType>;
14
- getLimit(): number;
15
- flipSortOrder(): SnapshotEmitter<ReturnType>;
16
- extractData(data: ReturnType): any;
17
- paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
18
- serialize(): SerializedQuery;
19
- }
20
- export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
21
- abstract where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
22
- eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
23
- neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
24
- in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
25
- nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
26
- gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
27
- gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
28
- lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
29
- lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
30
- like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
31
- notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
32
- abstract limit(limit: number): this;
33
- abstract sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
34
- }
35
- export interface HasDereference {
36
- dereference(): any;
37
- }
1
+ import { Observable } from 'rxjs';
2
+ import { DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
3
+ import { FieldSort, Operator, SimpleCondition } from '../query.types';
4
+ import { SerializedQuery } from './serialized-query.types';
5
+ import { PaginationOptions, Pagination } from './pagination';
6
+ export interface SnapshotEmitter<ReturnType> {
7
+ snapshot(): Promise<Array<ReturnType>>;
8
+ snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
9
+ peek(): Array<ReturnType>;
10
+ clone(): SnapshotEmitter<ReturnType>;
11
+ getSortOrders(): Array<FieldSort<any>>;
12
+ addCompositeCondition(conditions: Array<SimpleCondition>): SnapshotEmitter<ReturnType>;
13
+ limit(limit: number): SnapshotEmitter<ReturnType>;
14
+ getLimit(): number;
15
+ flipSortOrder(): SnapshotEmitter<ReturnType>;
16
+ extractData(data: ReturnType): any;
17
+ paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
18
+ serialize(): SerializedQuery;
19
+ }
20
+ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
21
+ abstract where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
22
+ eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
23
+ neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
24
+ in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
25
+ nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
26
+ gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
27
+ gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
28
+ lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
29
+ lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
30
+ like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
31
+ notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
32
+ abstract limit(limit: number): this;
33
+ abstract sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
34
+ }
35
+ export interface HasDereference {
36
+ dereference(): any;
37
+ }
@@ -1,37 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseQueryBuilder = void 0;
4
- class BaseQueryBuilder {
5
- eq(fieldName, value) {
6
- return this.where(fieldName, '==', value);
7
- }
8
- neq(fieldName, value) {
9
- return this.where(fieldName, '!=', value);
10
- }
11
- in(fieldName, value) {
12
- return this.where(fieldName, 'in', value);
13
- }
14
- nin(fieldName, value) {
15
- return this.where(fieldName, 'not in', value);
16
- }
17
- gt(fieldName, value) {
18
- return this.where(fieldName, '>', value);
19
- }
20
- gte(fieldName, value) {
21
- return this.where(fieldName, '>=', value);
22
- }
23
- lt(fieldName, value) {
24
- return this.where(fieldName, '<', value);
25
- }
26
- lte(fieldName, value) {
27
- return this.where(fieldName, '<=', value);
28
- }
29
- like(fieldName, pattern, caseSensitive) {
30
- return this.where(fieldName, caseSensitive ? 'like_cs' : 'like', pattern);
31
- }
32
- notLike(fieldName, pattern, caseSensitive) {
33
- return this.where(fieldName, caseSensitive ? 'not like_cs' : 'not like', pattern);
34
- }
35
- }
36
- exports.BaseQueryBuilder = BaseQueryBuilder;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseQueryBuilder = void 0;
4
+ class BaseQueryBuilder {
5
+ eq(fieldName, value) {
6
+ return this.where(fieldName, '==', value);
7
+ }
8
+ neq(fieldName, value) {
9
+ return this.where(fieldName, '!=', value);
10
+ }
11
+ in(fieldName, value) {
12
+ return this.where(fieldName, 'in', value);
13
+ }
14
+ nin(fieldName, value) {
15
+ return this.where(fieldName, 'not in', value);
16
+ }
17
+ gt(fieldName, value) {
18
+ return this.where(fieldName, '>', value);
19
+ }
20
+ gte(fieldName, value) {
21
+ return this.where(fieldName, '>=', value);
22
+ }
23
+ lt(fieldName, value) {
24
+ return this.where(fieldName, '<', value);
25
+ }
26
+ lte(fieldName, value) {
27
+ return this.where(fieldName, '<=', value);
28
+ }
29
+ like(fieldName, pattern, caseSensitive) {
30
+ return this.where(fieldName, caseSensitive ? 'like_cs' : 'like', pattern);
31
+ }
32
+ notLike(fieldName, pattern, caseSensitive) {
33
+ return this.where(fieldName, caseSensitive ? 'not like_cs' : 'not like', pattern);
34
+ }
35
+ }
36
+ exports.BaseQueryBuilder = BaseQueryBuilder;
37
37
  //# sourceMappingURL=base-query-builder.js.map
@@ -1,4 +1,4 @@
1
- export * from './query-context';
2
- export * from './base-query-builder';
3
- export * from './serialized-query.types';
4
- export * from './pagination';
1
+ export * from './query-context';
2
+ export * from './base-query-builder';
3
+ export * from './serialized-query.types';
4
+ export * from './pagination';
@@ -1,21 +1,21 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./query-context"), exports);
18
- __exportStar(require("./base-query-builder"), exports);
19
- __exportStar(require("./serialized-query.types"), exports);
20
- __exportStar(require("./pagination"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./query-context"), exports);
18
+ __exportStar(require("./base-query-builder"), exports);
19
+ __exportStar(require("./serialized-query.types"), exports);
20
+ __exportStar(require("./pagination"), exports);
21
21
  //# sourceMappingURL=index.js.map