@squidcloud/local-backend 1.0.40 → 1.0.41

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 (172) 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 +207 -207
  4. package/dist/common/src/ai-assistant.schemas.js +196 -196
  5. package/dist/common/src/ai-assistant.types.d.ts +80 -80
  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 +1168 -1168
  12. package/dist/common/src/application.schemas.js +741 -741
  13. package/dist/common/src/application.types.d.ts +228 -228
  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 +73 -73
  21. package/dist/common/src/bundle-api.types.d.ts +71 -71
  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 +54 -54
  42. package/dist/common/src/index.js +70 -70
  43. package/dist/common/src/integrations/ai_assistant.types.d.ts +30 -30
  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 +236 -236
  50. package/dist/common/src/integrations/database.types.js +2 -2
  51. package/dist/common/src/integrations/index.d.ts +101 -101
  52. package/dist/common/src/integrations/index.js +105 -105
  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/{simple-query-builder.d.ts → base-query-builder.d.ts} +25 -29
  72. package/dist/common/src/query/base-query-builder.js +37 -0
  73. package/dist/common/src/query/base-query-builder.js.map +1 -0
  74. package/dist/common/src/query/index.d.ts +2 -2
  75. package/dist/common/src/query/index.js +18 -18
  76. package/dist/common/src/query/index.js.map +1 -1
  77. package/dist/common/src/query/query-context.d.ts +24 -24
  78. package/dist/common/src/query/query-context.js +158 -158
  79. package/dist/common/src/query.schemas.d.ts +6 -6
  80. package/dist/common/src/query.schemas.js +96 -96
  81. package/dist/common/src/query.types.d.ts +92 -92
  82. package/dist/common/src/query.types.js +134 -134
  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 +32 -32
  89. package/dist/common/src/secret.types.d.ts +49 -49
  90. package/dist/common/src/secret.types.js +5 -5
  91. package/dist/common/src/security.types.d.ts +3 -3
  92. package/dist/common/src/security.types.js +2 -2
  93. package/dist/common/src/socket.schemas.d.ts +3 -3
  94. package/dist/common/src/socket.schemas.js +58 -58
  95. package/dist/common/src/socket.types.d.ts +108 -108
  96. package/dist/common/src/socket.types.js +2 -2
  97. package/dist/common/src/time-units.d.ts +5 -5
  98. package/dist/common/src/time-units.js +8 -8
  99. package/dist/common/src/trigger.types.d.ts +15 -15
  100. package/dist/common/src/trigger.types.js +2 -2
  101. package/dist/common/src/types.d.ts +15 -15
  102. package/dist/common/src/types.js +2 -2
  103. package/dist/common/src/utils/array.d.ts +8 -8
  104. package/dist/common/src/utils/array.js +51 -51
  105. package/dist/common/src/utils/assert.d.ts +8 -8
  106. package/dist/common/src/utils/assert.js +49 -49
  107. package/dist/common/src/utils/error.d.ts +4 -4
  108. package/dist/common/src/utils/error.js +10 -10
  109. package/dist/common/src/utils/http.d.ts +2 -2
  110. package/dist/common/src/utils/http.js +38 -38
  111. package/dist/common/src/utils/id.d.ts +2 -2
  112. package/dist/common/src/utils/id.js +21 -21
  113. package/dist/common/src/utils/lock.manager.d.ts +9 -9
  114. package/dist/common/src/utils/lock.manager.js +39 -39
  115. package/dist/common/src/utils/nullish.d.ts +1 -1
  116. package/dist/common/src/utils/nullish.js +7 -7
  117. package/dist/common/src/utils/object.d.ts +6 -6
  118. package/dist/common/src/utils/object.js +89 -89
  119. package/dist/common/src/utils/serialization.d.ts +6 -6
  120. package/dist/common/src/utils/serialization.js +77 -77
  121. package/dist/common/src/utils/transforms.d.ts +18 -18
  122. package/dist/common/src/utils/transforms.js +92 -92
  123. package/dist/common/src/utils/url.d.ts +1 -1
  124. package/dist/common/src/utils/url.js +15 -15
  125. package/dist/common/src/utils/validation.d.ts +17 -17
  126. package/dist/common/src/utils/validation.js +209 -209
  127. package/dist/common/src/webhook-response.d.ts +7 -7
  128. package/dist/common/src/webhook-response.js +7 -7
  129. package/dist/internal-common/src/async-queue.d.ts +4 -4
  130. package/dist/internal-common/src/async-queue.js +17 -17
  131. package/dist/internal-common/src/code-executor.types.d.ts +13 -13
  132. package/dist/internal-common/src/code-executor.types.js +2 -2
  133. package/dist/internal-common/src/environment/environment.types.d.ts +74 -74
  134. package/dist/internal-common/src/environment/environment.types.js +2 -2
  135. package/dist/internal-common/src/environment/index.d.ts +6 -6
  136. package/dist/internal-common/src/environment/index.js +25 -25
  137. package/dist/internal-common/src/environment/local.environment.d.ts +2 -2
  138. package/dist/internal-common/src/environment/local.environment.js +62 -62
  139. package/dist/internal-common/src/index.d.ts +11 -11
  140. package/dist/internal-common/src/index.js +29 -29
  141. package/dist/internal-common/src/kafka/kafka.manager.d.ts +22 -22
  142. package/dist/internal-common/src/kafka/kafka.manager.js +128 -128
  143. package/dist/internal-common/src/kafka/kafka.types.d.ts +17 -17
  144. package/dist/internal-common/src/kafka/kafka.types.js +2 -2
  145. package/dist/internal-common/src/kafka-observability-publisher.d.ts +11 -11
  146. package/dist/internal-common/src/kafka-observability-publisher.js +20 -20
  147. package/dist/internal-common/src/local-dev.types.d.ts +31 -31
  148. package/dist/internal-common/src/local-dev.types.js +2 -2
  149. package/dist/internal-common/src/observability-publisher.d.ts +9 -9
  150. package/dist/internal-common/src/observability-publisher.js +58 -58
  151. package/dist/internal-common/src/observability.types.d.ts +17 -17
  152. package/dist/internal-common/src/observability.types.js +2 -2
  153. package/dist/internal-common/src/shutdown.manager.d.ts +20 -20
  154. package/dist/internal-common/src/shutdown.manager.js +76 -76
  155. package/dist/internal-common/src/utils.d.ts +5 -5
  156. package/dist/internal-common/src/utils.js +29 -29
  157. package/dist/local-backend/src/index.d.ts +4 -4
  158. package/dist/local-backend/src/index.js +20 -20
  159. package/dist/local-backend/src/local-backend-socket.service.d.ts +18 -18
  160. package/dist/local-backend/src/local-backend-socket.service.js +108 -108
  161. package/dist/local-backend/src/local-backend.app.d.ts +2 -2
  162. package/dist/local-backend/src/local-backend.app.js +19 -19
  163. package/dist/local-backend/src/local-backend.controller.d.ts +8 -8
  164. package/dist/local-backend/src/local-backend.controller.js +49 -49
  165. package/dist/local-backend/src/local-backend.module.d.ts +8 -8
  166. package/dist/local-backend/src/local-backend.module.js +53 -53
  167. package/dist/local-backend/src/local-backend.service.d.ts +15 -15
  168. package/dist/local-backend/src/local-backend.service.js +165 -165
  169. package/dist/tsconfig.build.tsbuildinfo +1 -1
  170. package/package.json +1 -1
  171. package/dist/common/src/query/simple-query-builder.js +0 -115
  172. package/dist/common/src/query/simple-query-builder.js.map +0 -1
@@ -1,159 +1,159 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QueryContext = void 0;
4
- const _ = require("lodash");
5
- const lodash_1 = require("lodash");
6
- const query_types_1 = require("../query.types");
7
- const CompareTable = {
8
- 'in:in': (a, b) => a.every((c) => b.includes(c)),
9
- 'in:not in': (a, b) => a.every((c) => !b.includes(c)),
10
- 'not in:not in': (a, b) => b.every((c) => a.includes(c)),
11
- '>:not in': (a, b) => b.every((c) => a >= c),
12
- '>=:not in': (a, b) => b.every((c) => a > c),
13
- '<:not in': (a, b) => b.every((c) => a <= c),
14
- '<=:not in': (a, b) => b.every((c) => a < c),
15
- '>:>': (a, b) => a >= b,
16
- '>=:>': (a, b) => a > b,
17
- 'in:>': (a, b) => a.every((c) => c > b),
18
- '>:>=': (a, b) => a >= b,
19
- '>=:>=': (a, b) => a >= b,
20
- 'in:>=': (a, b) => a.every((c) => c >= b),
21
- '<:<': (a, b) => a <= b,
22
- '<=:<': (a, b) => a < b,
23
- 'in:<': (a, b) => a.every((c) => c < b),
24
- '<:<=': (a, b) => a <= b,
25
- '<=:<=': (a, b) => a <= b,
26
- 'in:<=': (a, b) => a.every((c) => c <= b),
27
- };
28
- class QueryContext {
29
- constructor(query) {
30
- this.query = query;
31
- this.query = query;
32
- this.parsedConditions = this.parseConditions(this.query.conditions);
33
- }
34
- get integrationId() {
35
- return this.query.integrationId;
36
- }
37
- get collectionName() {
38
- return this.query.collectionName;
39
- }
40
- get limit() {
41
- return this.query.limit;
42
- }
43
- sortedBy(sorts) {
44
- const mismatch = sorts.find((fieldSort, index) => {
45
- var _a;
46
- return !(0, lodash_1.isEqual)(this.query.sortOrder[index], Object.assign(Object.assign({}, fieldSort), { asc: (_a = fieldSort.asc) !== null && _a !== void 0 ? _a : true }));
47
- });
48
- return !mismatch;
49
- }
50
- sortedByExact(sorts) {
51
- if (sorts.length !== this.query.sortOrder.length)
52
- return false;
53
- return this.sortedBy(sorts);
54
- }
55
- isSubqueryOf(fieldName, operator, value) {
56
- return this.isSubqueryOfCondition({
57
- fieldName,
58
- operator,
59
- value,
60
- });
61
- }
62
- isSubqueryOfCondition(condition) {
63
- const conditions = this.parsedConditions.filter((c) => c.fieldName === condition.fieldName);
64
- return !!conditions.find((c) => this.evaluateSubset(c, condition));
65
- }
66
- isSubqueryOfConditions(conditions) {
67
- const parsedConditions = this.parseConditions(conditions);
68
- return parsedConditions.every((c) => this.isSubqueryOfCondition(c));
69
- }
70
- isSubqueryOfQuery(query) {
71
- if (query.collectionName !== this.collectionName || query.integrationId !== this.integrationId)
72
- return false;
73
- const subsetOfConditions = this.isSubqueryOfConditions(query.conditions);
74
- const subsetOfOrder = this.sortedBy(query.sortOrder);
75
- const withinLimit = query.limit === -1 || (this.limit > -1 && this.limit < query.limit);
76
- return subsetOfConditions && subsetOfOrder && withinLimit;
77
- }
78
- getConditionsFor(...fieldNames) {
79
- return this.parsedConditions.filter((cond) => fieldNames.includes(cond.fieldName));
80
- }
81
- getConditionsForField(fieldName) {
82
- return this.parsedConditions.filter((cond) => cond.fieldName === fieldName);
83
- }
84
- documentMatchesQuery(doc) {
85
- for (const contextCondition of this.parsedConditions) {
86
- const fieldNameOrPath = contextCondition.fieldName;
87
- const operator = contextCondition.operator;
88
- const valueInDoc = _.get(doc, fieldNameOrPath);
89
- if (operator === 'in') {
90
- if (contextCondition.value.includes(valueInDoc)) {
91
- continue;
92
- }
93
- return false;
94
- }
95
- else if (operator === 'not in') {
96
- if (contextCondition.value.includes(valueInDoc)) {
97
- return false;
98
- }
99
- continue;
100
- }
101
- if (!(0, query_types_1.compareOperator)(contextCondition.value, valueInDoc, operator)) {
102
- return false;
103
- }
104
- }
105
- return true;
106
- }
107
- evaluateSubset(queryCondition, testCondition) {
108
- const { operator: queryOperator, value: queryValue } = queryCondition;
109
- const { operator, value } = this.parseConditions([testCondition])[0];
110
- const compareFunction = CompareTable[`${queryOperator}:${operator}`];
111
- if (!compareFunction)
112
- return false;
113
- return compareFunction(queryValue, value);
114
- }
115
- evaluateIncludes(queryCondition, testCondition) {
116
- const { operator: queryOperator, value: queryValue } = queryCondition;
117
- const { operator, value } = this.parseConditions([testCondition])[0];
118
- const sortedQueryValue = Array.isArray(queryValue) ? queryValue.sort() : queryValue;
119
- const sortedValue = Array.isArray(value) ? value.sort() : value;
120
- return operator === queryOperator && (0, lodash_1.isEqual)(sortedValue, sortedQueryValue);
121
- }
122
- parseConditions(conditions) {
123
- const parsedConditions = [];
124
- const inMap = new Map();
125
- const notInMap = new Map();
126
- conditions.forEach((c) => {
127
- switch (c.operator) {
128
- case '==':
129
- case 'in':
130
- inMap.set(c.fieldName, (inMap.get(c.fieldName) || []).concat(c.value));
131
- break;
132
- case '!=':
133
- case 'not in':
134
- notInMap.set(c.fieldName, (notInMap.get(c.fieldName) || []).concat(c.value));
135
- break;
136
- default:
137
- parsedConditions.push(c);
138
- break;
139
- }
140
- });
141
- inMap.forEach((value, fieldName) => {
142
- parsedConditions.push({
143
- fieldName,
144
- operator: 'in',
145
- value: value,
146
- });
147
- });
148
- notInMap.forEach((value, fieldName) => {
149
- parsedConditions.push({
150
- fieldName,
151
- operator: 'not in',
152
- value: value,
153
- });
154
- });
155
- return parsedConditions;
156
- }
157
- }
158
- exports.QueryContext = QueryContext;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueryContext = void 0;
4
+ const _ = require("lodash");
5
+ const lodash_1 = require("lodash");
6
+ const query_types_1 = require("../query.types");
7
+ const CompareTable = {
8
+ 'in:in': (a, b) => a.every((c) => b.includes(c)),
9
+ 'in:not in': (a, b) => a.every((c) => !b.includes(c)),
10
+ 'not in:not in': (a, b) => b.every((c) => a.includes(c)),
11
+ '>:not in': (a, b) => b.every((c) => a >= c),
12
+ '>=:not in': (a, b) => b.every((c) => a > c),
13
+ '<:not in': (a, b) => b.every((c) => a <= c),
14
+ '<=:not in': (a, b) => b.every((c) => a < c),
15
+ '>:>': (a, b) => a >= b,
16
+ '>=:>': (a, b) => a > b,
17
+ 'in:>': (a, b) => a.every((c) => c > b),
18
+ '>:>=': (a, b) => a >= b,
19
+ '>=:>=': (a, b) => a >= b,
20
+ 'in:>=': (a, b) => a.every((c) => c >= b),
21
+ '<:<': (a, b) => a <= b,
22
+ '<=:<': (a, b) => a < b,
23
+ 'in:<': (a, b) => a.every((c) => c < b),
24
+ '<:<=': (a, b) => a <= b,
25
+ '<=:<=': (a, b) => a <= b,
26
+ 'in:<=': (a, b) => a.every((c) => c <= b),
27
+ };
28
+ class QueryContext {
29
+ constructor(query) {
30
+ this.query = query;
31
+ this.query = query;
32
+ this.parsedConditions = this.parseConditions(this.query.conditions);
33
+ }
34
+ get integrationId() {
35
+ return this.query.integrationId;
36
+ }
37
+ get collectionName() {
38
+ return this.query.collectionName;
39
+ }
40
+ get limit() {
41
+ return this.query.limit;
42
+ }
43
+ sortedBy(sorts) {
44
+ const mismatch = sorts.find((fieldSort, index) => {
45
+ var _a;
46
+ return !(0, lodash_1.isEqual)(this.query.sortOrder[index], Object.assign(Object.assign({}, fieldSort), { asc: (_a = fieldSort.asc) !== null && _a !== void 0 ? _a : true }));
47
+ });
48
+ return !mismatch;
49
+ }
50
+ sortedByExact(sorts) {
51
+ if (sorts.length !== this.query.sortOrder.length)
52
+ return false;
53
+ return this.sortedBy(sorts);
54
+ }
55
+ isSubqueryOf(fieldName, operator, value) {
56
+ return this.isSubqueryOfCondition({
57
+ fieldName,
58
+ operator,
59
+ value,
60
+ });
61
+ }
62
+ isSubqueryOfCondition(condition) {
63
+ const conditions = this.parsedConditions.filter((c) => c.fieldName === condition.fieldName);
64
+ return !!conditions.find((c) => this.evaluateSubset(c, condition));
65
+ }
66
+ isSubqueryOfConditions(conditions) {
67
+ const parsedConditions = this.parseConditions(conditions);
68
+ return parsedConditions.every((c) => this.isSubqueryOfCondition(c));
69
+ }
70
+ isSubqueryOfQuery(query) {
71
+ if (query.collectionName !== this.collectionName || query.integrationId !== this.integrationId)
72
+ return false;
73
+ const subsetOfConditions = this.isSubqueryOfConditions(query.conditions);
74
+ const subsetOfOrder = this.sortedBy(query.sortOrder);
75
+ const withinLimit = query.limit === -1 || (this.limit > -1 && this.limit < query.limit);
76
+ return subsetOfConditions && subsetOfOrder && withinLimit;
77
+ }
78
+ getConditionsFor(...fieldNames) {
79
+ return this.parsedConditions.filter((cond) => fieldNames.includes(cond.fieldName));
80
+ }
81
+ getConditionsForField(fieldName) {
82
+ return this.parsedConditions.filter((cond) => cond.fieldName === fieldName);
83
+ }
84
+ documentMatchesQuery(doc) {
85
+ for (const contextCondition of this.parsedConditions) {
86
+ const fieldNameOrPath = contextCondition.fieldName;
87
+ const operator = contextCondition.operator;
88
+ const valueInDoc = _.get(doc, fieldNameOrPath);
89
+ if (operator === 'in') {
90
+ if (contextCondition.value.includes(valueInDoc)) {
91
+ continue;
92
+ }
93
+ return false;
94
+ }
95
+ else if (operator === 'not in') {
96
+ if (contextCondition.value.includes(valueInDoc)) {
97
+ return false;
98
+ }
99
+ continue;
100
+ }
101
+ if (!(0, query_types_1.compareOperator)(contextCondition.value, valueInDoc, operator)) {
102
+ return false;
103
+ }
104
+ }
105
+ return true;
106
+ }
107
+ evaluateSubset(queryCondition, testCondition) {
108
+ const { operator: queryOperator, value: queryValue } = queryCondition;
109
+ const { operator, value } = this.parseConditions([testCondition])[0];
110
+ const compareFunction = CompareTable[`${queryOperator}:${operator}`];
111
+ if (!compareFunction)
112
+ return false;
113
+ return compareFunction(queryValue, value);
114
+ }
115
+ evaluateIncludes(queryCondition, testCondition) {
116
+ const { operator: queryOperator, value: queryValue } = queryCondition;
117
+ const { operator, value } = this.parseConditions([testCondition])[0];
118
+ const sortedQueryValue = Array.isArray(queryValue) ? queryValue.sort() : queryValue;
119
+ const sortedValue = Array.isArray(value) ? value.sort() : value;
120
+ return operator === queryOperator && (0, lodash_1.isEqual)(sortedValue, sortedQueryValue);
121
+ }
122
+ parseConditions(conditions) {
123
+ const parsedConditions = [];
124
+ const inMap = new Map();
125
+ const notInMap = new Map();
126
+ conditions.forEach((c) => {
127
+ switch (c.operator) {
128
+ case '==':
129
+ case 'in':
130
+ inMap.set(c.fieldName, (inMap.get(c.fieldName) || []).concat(c.value));
131
+ break;
132
+ case '!=':
133
+ case 'not in':
134
+ notInMap.set(c.fieldName, (notInMap.get(c.fieldName) || []).concat(c.value));
135
+ break;
136
+ default:
137
+ parsedConditions.push(c);
138
+ break;
139
+ }
140
+ });
141
+ inMap.forEach((value, fieldName) => {
142
+ parsedConditions.push({
143
+ fieldName,
144
+ operator: 'in',
145
+ value: value,
146
+ });
147
+ });
148
+ notInMap.forEach((value, fieldName) => {
149
+ parsedConditions.push({
150
+ fieldName,
151
+ operator: 'not in',
152
+ value: value,
153
+ });
154
+ });
155
+ return parsedConditions;
156
+ }
157
+ }
158
+ exports.QueryContext = QueryContext;
159
159
  //# sourceMappingURL=query-context.js.map
@@ -1,6 +1,6 @@
1
- import { JSONSchemaType } from 'ajv';
2
- import { Query, QueryRegisterRequest, QueryRequest, QueryUnsubscribeRequest } from './query.types';
3
- export declare const QuerySchema: JSONSchemaType<Query>;
4
- export declare const QueryRequestSchema: JSONSchemaType<QueryRequest>;
5
- export declare const QueryUnsubscribeRequestSchema: JSONSchemaType<QueryUnsubscribeRequest>;
6
- export declare const QueryRegisterRequestSchema: JSONSchemaType<QueryRegisterRequest>;
1
+ import { JSONSchemaType } from 'ajv';
2
+ import { Query, QueryRegisterRequest, QueryRequest, QueryUnsubscribeRequest } from './query.types';
3
+ export declare const QuerySchema: JSONSchemaType<Query>;
4
+ export declare const QueryRequestSchema: JSONSchemaType<QueryRequest>;
5
+ export declare const QueryUnsubscribeRequestSchema: JSONSchemaType<QueryUnsubscribeRequest>;
6
+ export declare const QueryRegisterRequestSchema: JSONSchemaType<QueryRegisterRequest>;
@@ -1,97 +1,97 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QueryRegisterRequestSchema = exports.QueryUnsubscribeRequestSchema = exports.QueryRequestSchema = exports.QuerySchema = void 0;
4
- exports.QuerySchema = {
5
- $id: 'querySchema',
6
- type: 'object',
7
- required: ['collectionName', 'integrationId'],
8
- properties: {
9
- collectionName: { type: 'string', nullable: false },
10
- integrationId: { type: 'string', nullable: false },
11
- conditions: {
12
- type: 'array',
13
- nullable: false,
14
- items: {
15
- type: 'object',
16
- nullable: false,
17
- required: ['fieldName', 'operator', 'value'],
18
- properties: {
19
- fieldName: { type: 'string', nullable: false },
20
- operator: {
21
- type: 'string',
22
- nullable: false,
23
- enum: ['==', '>=', '<=', '>', '<', '!=', 'like', 'not like', 'like_cs', 'not like_cs'],
24
- },
25
- value: {
26
- $ref: 'querySchema#/definitions/conditionValueSchema',
27
- },
28
- },
29
- },
30
- },
31
- sortOrder: {
32
- type: 'array',
33
- nullable: false,
34
- items: {
35
- type: 'object',
36
- required: ['fieldName', 'asc'],
37
- properties: {
38
- fieldName: { type: 'string' },
39
- asc: { type: 'boolean' },
40
- },
41
- },
42
- },
43
- limit: { type: 'number', nullable: false },
44
- },
45
- definitions: {
46
- conditionValueSchema: {
47
- oneOf: [
48
- { type: 'null', nullable: true },
49
- { type: 'string', nullable: false },
50
- { type: 'number', nullable: false },
51
- { type: 'boolean', nullable: false },
52
- {
53
- type: 'array',
54
- nullable: false,
55
- items: {
56
- $ref: 'querySchema#/definitions/conditionValueSchema',
57
- },
58
- },
59
- {
60
- type: 'object',
61
- nullable: false,
62
- patternProperties: {
63
- '[0-9a-zA-Z\\$_\\-\\.]{1,64}': {
64
- $ref: 'querySchema#/definitions/conditionValueSchema',
65
- },
66
- },
67
- },
68
- ],
69
- },
70
- },
71
- };
72
- exports.QueryRequestSchema = {
73
- type: 'object',
74
- required: ['clientRequestId', 'query', 'subscribe'],
75
- properties: {
76
- clientRequestId: { type: 'string', nullable: false },
77
- query: exports.QuerySchema,
78
- subscribe: { type: 'boolean', nullable: false },
79
- },
80
- };
81
- exports.QueryUnsubscribeRequestSchema = {
82
- type: 'object',
83
- required: ['clientRequestId'],
84
- properties: {
85
- clientRequestId: { type: 'string', nullable: false },
86
- },
87
- };
88
- exports.QueryRegisterRequestSchema = {
89
- type: 'object',
90
- required: ['clientRequestId', 'query', 'parentClientRequestId'],
91
- properties: {
92
- clientRequestId: { type: 'string', nullable: false },
93
- query: exports.QuerySchema,
94
- parentClientRequestId: { type: 'string', nullable: false },
95
- },
96
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueryRegisterRequestSchema = exports.QueryUnsubscribeRequestSchema = exports.QueryRequestSchema = exports.QuerySchema = void 0;
4
+ exports.QuerySchema = {
5
+ $id: 'querySchema',
6
+ type: 'object',
7
+ required: ['collectionName', 'integrationId'],
8
+ properties: {
9
+ collectionName: { type: 'string', nullable: false },
10
+ integrationId: { type: 'string', nullable: false },
11
+ conditions: {
12
+ type: 'array',
13
+ nullable: false,
14
+ items: {
15
+ type: 'object',
16
+ nullable: false,
17
+ required: ['fieldName', 'operator', 'value'],
18
+ properties: {
19
+ fieldName: { type: 'string', nullable: false },
20
+ operator: {
21
+ type: 'string',
22
+ nullable: false,
23
+ enum: ['==', '>=', '<=', '>', '<', '!=', 'like', 'not like', 'like_cs', 'not like_cs'],
24
+ },
25
+ value: {
26
+ $ref: 'querySchema#/definitions/conditionValueSchema',
27
+ },
28
+ },
29
+ },
30
+ },
31
+ sortOrder: {
32
+ type: 'array',
33
+ nullable: false,
34
+ items: {
35
+ type: 'object',
36
+ required: ['fieldName', 'asc'],
37
+ properties: {
38
+ fieldName: { type: 'string' },
39
+ asc: { type: 'boolean' },
40
+ },
41
+ },
42
+ },
43
+ limit: { type: 'number', nullable: false },
44
+ },
45
+ definitions: {
46
+ conditionValueSchema: {
47
+ oneOf: [
48
+ { type: 'null', nullable: true },
49
+ { type: 'string', nullable: false },
50
+ { type: 'number', nullable: false },
51
+ { type: 'boolean', nullable: false },
52
+ {
53
+ type: 'array',
54
+ nullable: false,
55
+ items: {
56
+ $ref: 'querySchema#/definitions/conditionValueSchema',
57
+ },
58
+ },
59
+ {
60
+ type: 'object',
61
+ nullable: false,
62
+ patternProperties: {
63
+ '[0-9a-zA-Z\\$_\\-\\.]{1,64}': {
64
+ $ref: 'querySchema#/definitions/conditionValueSchema',
65
+ },
66
+ },
67
+ },
68
+ ],
69
+ },
70
+ },
71
+ };
72
+ exports.QueryRequestSchema = {
73
+ type: 'object',
74
+ required: ['clientRequestId', 'query', 'subscribe'],
75
+ properties: {
76
+ clientRequestId: { type: 'string', nullable: false },
77
+ query: exports.QuerySchema,
78
+ subscribe: { type: 'boolean', nullable: false },
79
+ },
80
+ };
81
+ exports.QueryUnsubscribeRequestSchema = {
82
+ type: 'object',
83
+ required: ['clientRequestId'],
84
+ properties: {
85
+ clientRequestId: { type: 'string', nullable: false },
86
+ },
87
+ };
88
+ exports.QueryRegisterRequestSchema = {
89
+ type: 'object',
90
+ required: ['clientRequestId', 'query', 'parentClientRequestId'],
91
+ properties: {
92
+ clientRequestId: { type: 'string', nullable: false },
93
+ query: exports.QuerySchema,
94
+ parentClientRequestId: { type: 'string', nullable: false },
95
+ },
96
+ };
97
97
  //# sourceMappingURL=query.schemas.js.map