@squidcloud/local-backend 1.0.75 → 1.0.77
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/common/src/ai-assistant.context.d.ts +13 -13
- package/dist/common/src/ai-assistant.context.js +19 -19
- package/dist/common/src/ai-assistant.schemas.d.ts +243 -243
- package/dist/common/src/ai-assistant.schemas.js +210 -210
- package/dist/common/src/ai-assistant.types.d.ts +85 -85
- package/dist/common/src/ai-assistant.types.js +11 -11
- package/dist/common/src/api-call.context.d.ts +13 -13
- package/dist/common/src/api-call.context.js +16 -16
- package/dist/common/src/api.types.d.ts +23 -23
- package/dist/common/src/api.types.js +2 -2
- package/dist/common/src/application.schemas.d.ts +1332 -1312
- package/dist/common/src/application.schemas.js +880 -860
- package/dist/common/src/application.schemas.js.map +1 -1
- package/dist/common/src/application.types.d.ts +189 -186
- package/dist/common/src/application.types.js +89 -89
- package/dist/common/src/application.types.js.map +1 -1
- package/dist/common/src/backend-function.schemas.d.ts +3 -3
- package/dist/common/src/backend-function.schemas.js +12 -12
- package/dist/common/src/backend-function.types.d.ts +6 -6
- package/dist/common/src/backend-function.types.js +2 -2
- package/dist/common/src/backend-run.types.d.ts +54 -54
- package/dist/common/src/backend-run.types.js +91 -91
- package/dist/common/src/bundle-api.types.d.ts +65 -65
- package/dist/common/src/bundle-api.types.js +2 -2
- package/dist/common/src/bundle-data.types.d.ts +60 -60
- package/dist/common/src/bundle-data.types.js +2 -2
- package/dist/common/src/communication.types.d.ts +18 -18
- package/dist/common/src/communication.types.js +40 -40
- package/dist/common/src/context.types.d.ts +24 -24
- package/dist/common/src/context.types.js +2 -2
- package/dist/common/src/distributed-lock.context.d.ts +5 -5
- package/dist/common/src/distributed-lock.context.js +10 -10
- package/dist/common/src/document.types.d.ts +32 -32
- package/dist/common/src/document.types.js +50 -50
- package/dist/common/src/graphql.context.d.ts +14 -14
- package/dist/common/src/graphql.context.js +12 -12
- package/dist/common/src/graphql.types.d.ts +11 -11
- package/dist/common/src/graphql.types.js +34 -34
- package/dist/common/src/heartbeat.types.d.ts +4 -4
- package/dist/common/src/heartbeat.types.js +16 -16
- package/dist/common/src/http-status.enum.d.ts +50 -50
- package/dist/common/src/http-status.enum.js +54 -54
- package/dist/common/src/http-status.enum.js.map +1 -1
- package/dist/common/src/index.d.ts +55 -55
- package/dist/common/src/index.js +71 -71
- package/dist/common/src/integrations/ai_assistant.types.d.ts +30 -26
- package/dist/common/src/integrations/ai_assistant.types.js +2 -2
- package/dist/common/src/integrations/api.types.d.ts +80 -80
- package/dist/common/src/integrations/api.types.js +2 -2
- package/dist/common/src/integrations/auth.types.d.ts +39 -39
- package/dist/common/src/integrations/auth.types.js +2 -2
- package/dist/common/src/integrations/database.types.d.ts +231 -231
- package/dist/common/src/integrations/database.types.js +2 -2
- package/dist/common/src/integrations/index.d.ts +126 -126
- package/dist/common/src/integrations/index.js +113 -113
- package/dist/common/src/integrations/index.js.map +1 -1
- package/dist/common/src/integrations/observability.types.d.ts +23 -23
- package/dist/common/src/integrations/observability.types.js +23 -23
- package/dist/common/src/logger.types.d.ts +21 -21
- package/dist/common/src/logger.types.js +11 -11
- package/dist/common/src/logger.types.js.map +1 -1
- package/dist/common/src/metrics.types.d.ts +73 -73
- package/dist/common/src/metrics.types.js +11 -11
- package/dist/common/src/mutation.context.d.ts +13 -13
- package/dist/common/src/mutation.context.js +26 -26
- package/dist/common/src/mutation.schemas.d.ts +5 -5
- package/dist/common/src/mutation.schemas.js +114 -114
- package/dist/common/src/mutation.types.d.ts +63 -63
- package/dist/common/src/mutation.types.js +142 -142
- package/dist/common/src/named-query.context.d.ts +4 -4
- package/dist/common/src/named-query.context.js +9 -9
- package/dist/common/src/named-query.schemas.d.ts +3 -3
- package/dist/common/src/named-query.schemas.js +13 -13
- package/dist/common/src/named-query.types.d.ts +8 -8
- package/dist/common/src/named-query.types.js +2 -2
- package/dist/common/src/query/base-query-builder.d.ts +38 -37
- package/dist/common/src/query/base-query-builder.js +39 -36
- package/dist/common/src/query/base-query-builder.js.map +1 -1
- package/dist/common/src/query/index.d.ts +4 -4
- package/dist/common/src/query/index.js +20 -20
- package/dist/common/src/query/pagination.d.ts +42 -42
- package/dist/common/src/query/pagination.js +164 -164
- package/dist/common/src/query/query-context.d.ts +47 -47
- package/dist/common/src/query/query-context.js +159 -159
- package/dist/common/src/query/serialized-query.types.d.ts +24 -24
- package/dist/common/src/query/serialized-query.types.js +2 -2
- package/dist/common/src/query.types.d.ts +86 -86
- package/dist/common/src/query.types.js +153 -153
- package/dist/common/src/regions.d.ts +21 -21
- package/dist/common/src/regions.js +46 -46
- package/dist/common/src/schema/schema.types.d.ts +30 -30
- package/dist/common/src/schema/schema.types.js +172 -172
- package/dist/common/src/secret.schemas.d.ts +4 -4
- package/dist/common/src/secret.schemas.js +17 -17
- package/dist/common/src/secret.types.d.ts +65 -65
- package/dist/common/src/secret.types.js +5 -5
- package/dist/common/src/security.types.d.ts +3 -3
- package/dist/common/src/security.types.js +2 -2
- package/dist/common/src/socket.schemas.d.ts +3 -3
- package/dist/common/src/socket.schemas.js +58 -58
- package/dist/common/src/socket.types.d.ts +125 -125
- package/dist/common/src/socket.types.js +9 -9
- package/dist/common/src/socket.types.js.map +1 -1
- package/dist/common/src/time-units.d.ts +5 -5
- package/dist/common/src/time-units.js +8 -8
- package/dist/common/src/trigger.types.d.ts +15 -15
- package/dist/common/src/trigger.types.js +2 -2
- package/dist/common/src/types.d.ts +21 -21
- package/dist/common/src/types.js +2 -2
- package/dist/common/src/utils/array.d.ts +8 -8
- package/dist/common/src/utils/array.js +54 -54
- package/dist/common/src/utils/assert.d.ts +8 -8
- package/dist/common/src/utils/assert.js +49 -49
- package/dist/common/src/utils/error.d.ts +4 -4
- package/dist/common/src/utils/error.js +10 -10
- package/dist/common/src/utils/global.utils.d.ts +11 -11
- package/dist/common/src/utils/global.utils.js +50 -50
- package/dist/common/src/utils/http.d.ts +2 -2
- package/dist/common/src/utils/http.js +41 -41
- package/dist/common/src/utils/id.d.ts +2 -2
- package/dist/common/src/utils/id.js +21 -21
- package/dist/common/src/utils/lock.manager.d.ts +9 -9
- package/dist/common/src/utils/lock.manager.js +39 -39
- package/dist/common/src/utils/nullish.d.ts +2 -2
- package/dist/common/src/utils/nullish.js +11 -11
- package/dist/common/src/utils/object.d.ts +5 -5
- package/dist/common/src/utils/object.js +75 -75
- package/dist/common/src/utils/serialization.d.ts +6 -6
- package/dist/common/src/utils/serialization.js +77 -77
- package/dist/common/src/utils/transforms.d.ts +18 -18
- package/dist/common/src/utils/transforms.js +92 -92
- package/dist/common/src/utils/url.d.ts +1 -1
- package/dist/common/src/utils/url.js +15 -15
- package/dist/common/src/utils/validation.d.ts +17 -17
- package/dist/common/src/utils/validation.js +209 -209
- package/dist/common/src/webhook-response.d.ts +6 -6
- package/dist/common/src/webhook-response.js +2 -2
- package/dist/common/src/websocket.impl.d.ts +21 -21
- package/dist/common/src/websocket.impl.js +76 -76
- package/dist/internal-common/src/async-queue.d.ts +4 -4
- package/dist/internal-common/src/async-queue.js +17 -17
- package/dist/internal-common/src/code-executor.types.d.ts +13 -13
- package/dist/internal-common/src/code-executor.types.js +2 -2
- package/dist/internal-common/src/dao.types.d.ts +49 -49
- package/dist/internal-common/src/dao.types.js +2 -2
- package/dist/internal-common/src/environment/environment.types.d.ts +74 -74
- package/dist/internal-common/src/environment/environment.types.js +2 -2
- package/dist/internal-common/src/environment/index.d.ts +6 -6
- package/dist/internal-common/src/environment/index.js +27 -27
- package/dist/internal-common/src/environment/local.environment.d.ts +2 -2
- package/dist/internal-common/src/environment/local.environment.js +62 -62
- package/dist/internal-common/src/filters/custom-exception.filter.d.ts +6 -6
- package/dist/internal-common/src/filters/custom-exception.filter.js +44 -44
- package/dist/internal-common/src/filters/custom-exception.filter.js.map +1 -1
- package/dist/internal-common/src/index.d.ts +14 -14
- package/dist/internal-common/src/index.js +32 -32
- package/dist/internal-common/src/interceptors/body.interceptor.d.ts +5 -5
- package/dist/internal-common/src/interceptors/body.interceptor.js +24 -24
- package/dist/internal-common/src/interceptors/body.interceptor.js.map +1 -1
- package/dist/internal-common/src/kafka/kafka.manager.d.ts +22 -22
- package/dist/internal-common/src/kafka/kafka.manager.js +116 -116
- package/dist/internal-common/src/kafka/kafka.types.d.ts +17 -17
- package/dist/internal-common/src/kafka/kafka.types.js +2 -2
- package/dist/internal-common/src/kafka-observability-publisher.d.ts +11 -11
- package/dist/internal-common/src/kafka-observability-publisher.js +20 -20
- package/dist/internal-common/src/local-dev.types.d.ts +35 -35
- package/dist/internal-common/src/local-dev.types.js +2 -2
- package/dist/internal-common/src/observability-publisher.d.ts +9 -9
- package/dist/internal-common/src/observability-publisher.js +58 -58
- package/dist/internal-common/src/observability.types.d.ts +17 -17
- package/dist/internal-common/src/observability.types.js +2 -2
- package/dist/internal-common/src/shutdown.manager.d.ts +20 -20
- package/dist/internal-common/src/shutdown.manager.js +75 -75
- package/dist/internal-common/src/shutdown.manager.js.map +1 -1
- package/dist/internal-common/src/utils.d.ts +5 -5
- package/dist/internal-common/src/utils.js +29 -29
- package/dist/local-backend/src/index.d.ts +4 -4
- package/dist/local-backend/src/index.js +20 -20
- package/dist/local-backend/src/local-backend-socket.service.d.ts +19 -19
- package/dist/local-backend/src/local-backend-socket.service.js +110 -110
- package/dist/local-backend/src/local-backend-socket.service.js.map +1 -1
- package/dist/local-backend/src/local-backend.app.d.ts +2 -2
- package/dist/local-backend/src/local-backend.app.js +19 -19
- package/dist/local-backend/src/local-backend.controller.d.ts +8 -8
- package/dist/local-backend/src/local-backend.controller.js +49 -49
- package/dist/local-backend/src/local-backend.controller.js.map +1 -1
- package/dist/local-backend/src/local-backend.module.d.ts +8 -8
- package/dist/local-backend/src/local-backend.module.js +53 -53
- package/dist/local-backend/src/local-backend.module.js.map +1 -1
- package/dist/local-backend/src/local-backend.service.d.ts +15 -15
- package/dist/local-backend/src/local-backend.service.js +170 -170
- package/dist/local-backend/src/local-backend.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -33
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseQuerySubscriptionId = exports.getQuerySubscriptionId = exports.compareOperator = exports.QueryMappingManager = exports.encodeCondition = exports.isSimpleCondition = void 0;
|
|
4
|
-
const serialization_1 = require("./utils/serialization");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
|
-
function isSimpleCondition(condition) {
|
|
7
|
-
return 'fieldName' in condition;
|
|
8
|
-
}
|
|
9
|
-
exports.isSimpleCondition = isSimpleCondition;
|
|
10
|
-
function encodeCondition(condition) {
|
|
11
|
-
return (0, serialization_1.normalizeJsonAsString)(condition);
|
|
12
|
-
}
|
|
13
|
-
exports.encodeCondition = encodeCondition;
|
|
14
|
-
const sampleQueryMapping = {
|
|
15
|
-
unconditional: ['cid_123'],
|
|
16
|
-
conditional: {
|
|
17
|
-
[encodeCondition({
|
|
18
|
-
fields: [
|
|
19
|
-
{
|
|
20
|
-
fieldName: 'name',
|
|
21
|
-
operator: '>',
|
|
22
|
-
value: 'Yossi',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
fieldName: 'age',
|
|
26
|
-
operator: '<',
|
|
27
|
-
value: 10,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
})]: ['cid_sort_order'],
|
|
31
|
-
[encodeCondition({
|
|
32
|
-
fieldName: 'age',
|
|
33
|
-
operator: '==',
|
|
34
|
-
value: 10,
|
|
35
|
-
})]: ['cid_321'],
|
|
36
|
-
[encodeCondition({
|
|
37
|
-
fieldName: 'age',
|
|
38
|
-
operator: '==',
|
|
39
|
-
value: 11,
|
|
40
|
-
})]: ['cid_321'],
|
|
41
|
-
[encodeCondition({
|
|
42
|
-
fieldName: 'age',
|
|
43
|
-
operator: '==',
|
|
44
|
-
value: 12,
|
|
45
|
-
})]: ['cid_321'],
|
|
46
|
-
[encodeCondition({
|
|
47
|
-
fieldName: 'age',
|
|
48
|
-
operator: '>',
|
|
49
|
-
value: 20,
|
|
50
|
-
})]: ['cid_456', 'cid_789'],
|
|
51
|
-
[encodeCondition({
|
|
52
|
-
fieldName: 'age',
|
|
53
|
-
operator: '<',
|
|
54
|
-
value: 20,
|
|
55
|
-
})]: ['cid_789'],
|
|
56
|
-
[encodeCondition({
|
|
57
|
-
fieldName: 'name',
|
|
58
|
-
operator: '!=',
|
|
59
|
-
value: 'Yossi',
|
|
60
|
-
})]: ['cid_not_in'],
|
|
61
|
-
[encodeCondition({
|
|
62
|
-
fieldName: 'name',
|
|
63
|
-
operator: '!=',
|
|
64
|
-
value: 'Nir',
|
|
65
|
-
})]: ['cid_not_in'],
|
|
66
|
-
},
|
|
67
|
-
queriesMetadata: {
|
|
68
|
-
cid_123: {
|
|
69
|
-
condCount: 0,
|
|
70
|
-
},
|
|
71
|
-
cid_321: {
|
|
72
|
-
condCount: 1,
|
|
73
|
-
},
|
|
74
|
-
cid_456: {
|
|
75
|
-
condCount: 1,
|
|
76
|
-
},
|
|
77
|
-
cid_789: {
|
|
78
|
-
condCount: 2,
|
|
79
|
-
},
|
|
80
|
-
cid_sort_order: {
|
|
81
|
-
condCount: 1,
|
|
82
|
-
},
|
|
83
|
-
cid_not_in: {
|
|
84
|
-
condCount: 2,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
class QueryMappingManager {
|
|
89
|
-
}
|
|
90
|
-
exports.QueryMappingManager = QueryMappingManager;
|
|
91
|
-
function compareOperator(conditionValue, valueInDocument, operator) {
|
|
92
|
-
conditionValue = conditionValue instanceof Date ? conditionValue.getTime() : conditionValue !== null && conditionValue !== void 0 ? conditionValue : null;
|
|
93
|
-
valueInDocument = valueInDocument instanceof Date ? valueInDocument.getTime() : valueInDocument !== null && valueInDocument !== void 0 ? valueInDocument : null;
|
|
94
|
-
if (operator === '==') {
|
|
95
|
-
return lodash_1.default.isEqual(conditionValue, valueInDocument);
|
|
96
|
-
}
|
|
97
|
-
if (operator === '!=') {
|
|
98
|
-
return !lodash_1.default.isEqual(conditionValue, valueInDocument);
|
|
99
|
-
}
|
|
100
|
-
if (conditionValue === null || valueInDocument === null)
|
|
101
|
-
return false;
|
|
102
|
-
switch (operator) {
|
|
103
|
-
case '<':
|
|
104
|
-
return valueInDocument < conditionValue;
|
|
105
|
-
case '<=':
|
|
106
|
-
return valueInDocument <= conditionValue;
|
|
107
|
-
case '>':
|
|
108
|
-
return valueInDocument > conditionValue;
|
|
109
|
-
case '>=':
|
|
110
|
-
return valueInDocument >= conditionValue;
|
|
111
|
-
case 'like':
|
|
112
|
-
return (typeof valueInDocument === 'string' &&
|
|
113
|
-
typeof conditionValue === 'string' &&
|
|
114
|
-
isStringMatch(valueInDocument, conditionValue, false));
|
|
115
|
-
case 'not like':
|
|
116
|
-
return !(typeof valueInDocument === 'string' &&
|
|
117
|
-
typeof conditionValue === 'string' &&
|
|
118
|
-
isStringMatch(valueInDocument, conditionValue, false));
|
|
119
|
-
case 'like_cs':
|
|
120
|
-
return (typeof valueInDocument === 'string' &&
|
|
121
|
-
typeof conditionValue === 'string' &&
|
|
122
|
-
isStringMatch(valueInDocument, conditionValue, true));
|
|
123
|
-
case 'not like_cs':
|
|
124
|
-
return !(typeof valueInDocument === 'string' &&
|
|
125
|
-
typeof conditionValue === 'string' &&
|
|
126
|
-
isStringMatch(valueInDocument, conditionValue, true));
|
|
127
|
-
default:
|
|
128
|
-
throw new Error(`Unsupported operator comparison: ${operator}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.compareOperator = compareOperator;
|
|
132
|
-
function isStringMatch(str, pattern, caseSensitive) {
|
|
133
|
-
if (!caseSensitive) {
|
|
134
|
-
str = str.toLowerCase();
|
|
135
|
-
pattern = pattern.toLowerCase();
|
|
136
|
-
}
|
|
137
|
-
const escapedPattern = pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
138
|
-
const regexPattern = escapedPattern.replace(/%/g, '.*');
|
|
139
|
-
const regex = new RegExp(`^${regexPattern}$`);
|
|
140
|
-
return regex.test(str);
|
|
141
|
-
}
|
|
142
|
-
function getQuerySubscriptionId(clientId, clientRequestId) {
|
|
143
|
-
return `${clientId}_${clientRequestId}`;
|
|
144
|
-
}
|
|
145
|
-
exports.getQuerySubscriptionId = getQuerySubscriptionId;
|
|
146
|
-
function parseQuerySubscriptionId(querySubscriptionId) {
|
|
147
|
-
const splitString = querySubscriptionId.split('_');
|
|
148
|
-
return {
|
|
149
|
-
clientId: splitString[0],
|
|
150
|
-
clientRequestId: splitString[1],
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
exports.parseQuerySubscriptionId = parseQuerySubscriptionId;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseQuerySubscriptionId = exports.getQuerySubscriptionId = exports.compareOperator = exports.QueryMappingManager = exports.encodeCondition = exports.isSimpleCondition = void 0;
|
|
4
|
+
const serialization_1 = require("./utils/serialization");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
function isSimpleCondition(condition) {
|
|
7
|
+
return 'fieldName' in condition;
|
|
8
|
+
}
|
|
9
|
+
exports.isSimpleCondition = isSimpleCondition;
|
|
10
|
+
function encodeCondition(condition) {
|
|
11
|
+
return (0, serialization_1.normalizeJsonAsString)(condition);
|
|
12
|
+
}
|
|
13
|
+
exports.encodeCondition = encodeCondition;
|
|
14
|
+
const sampleQueryMapping = {
|
|
15
|
+
unconditional: ['cid_123'],
|
|
16
|
+
conditional: {
|
|
17
|
+
[encodeCondition({
|
|
18
|
+
fields: [
|
|
19
|
+
{
|
|
20
|
+
fieldName: 'name',
|
|
21
|
+
operator: '>',
|
|
22
|
+
value: 'Yossi',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
fieldName: 'age',
|
|
26
|
+
operator: '<',
|
|
27
|
+
value: 10,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
})]: ['cid_sort_order'],
|
|
31
|
+
[encodeCondition({
|
|
32
|
+
fieldName: 'age',
|
|
33
|
+
operator: '==',
|
|
34
|
+
value: 10,
|
|
35
|
+
})]: ['cid_321'],
|
|
36
|
+
[encodeCondition({
|
|
37
|
+
fieldName: 'age',
|
|
38
|
+
operator: '==',
|
|
39
|
+
value: 11,
|
|
40
|
+
})]: ['cid_321'],
|
|
41
|
+
[encodeCondition({
|
|
42
|
+
fieldName: 'age',
|
|
43
|
+
operator: '==',
|
|
44
|
+
value: 12,
|
|
45
|
+
})]: ['cid_321'],
|
|
46
|
+
[encodeCondition({
|
|
47
|
+
fieldName: 'age',
|
|
48
|
+
operator: '>',
|
|
49
|
+
value: 20,
|
|
50
|
+
})]: ['cid_456', 'cid_789'],
|
|
51
|
+
[encodeCondition({
|
|
52
|
+
fieldName: 'age',
|
|
53
|
+
operator: '<',
|
|
54
|
+
value: 20,
|
|
55
|
+
})]: ['cid_789'],
|
|
56
|
+
[encodeCondition({
|
|
57
|
+
fieldName: 'name',
|
|
58
|
+
operator: '!=',
|
|
59
|
+
value: 'Yossi',
|
|
60
|
+
})]: ['cid_not_in'],
|
|
61
|
+
[encodeCondition({
|
|
62
|
+
fieldName: 'name',
|
|
63
|
+
operator: '!=',
|
|
64
|
+
value: 'Nir',
|
|
65
|
+
})]: ['cid_not_in'],
|
|
66
|
+
},
|
|
67
|
+
queriesMetadata: {
|
|
68
|
+
cid_123: {
|
|
69
|
+
condCount: 0,
|
|
70
|
+
},
|
|
71
|
+
cid_321: {
|
|
72
|
+
condCount: 1,
|
|
73
|
+
},
|
|
74
|
+
cid_456: {
|
|
75
|
+
condCount: 1,
|
|
76
|
+
},
|
|
77
|
+
cid_789: {
|
|
78
|
+
condCount: 2,
|
|
79
|
+
},
|
|
80
|
+
cid_sort_order: {
|
|
81
|
+
condCount: 1,
|
|
82
|
+
},
|
|
83
|
+
cid_not_in: {
|
|
84
|
+
condCount: 2,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
class QueryMappingManager {
|
|
89
|
+
}
|
|
90
|
+
exports.QueryMappingManager = QueryMappingManager;
|
|
91
|
+
function compareOperator(conditionValue, valueInDocument, operator) {
|
|
92
|
+
conditionValue = conditionValue instanceof Date ? conditionValue.getTime() : conditionValue !== null && conditionValue !== void 0 ? conditionValue : null;
|
|
93
|
+
valueInDocument = valueInDocument instanceof Date ? valueInDocument.getTime() : valueInDocument !== null && valueInDocument !== void 0 ? valueInDocument : null;
|
|
94
|
+
if (operator === '==') {
|
|
95
|
+
return lodash_1.default.isEqual(conditionValue, valueInDocument);
|
|
96
|
+
}
|
|
97
|
+
if (operator === '!=') {
|
|
98
|
+
return !lodash_1.default.isEqual(conditionValue, valueInDocument);
|
|
99
|
+
}
|
|
100
|
+
if (conditionValue === null || valueInDocument === null)
|
|
101
|
+
return false;
|
|
102
|
+
switch (operator) {
|
|
103
|
+
case '<':
|
|
104
|
+
return valueInDocument < conditionValue;
|
|
105
|
+
case '<=':
|
|
106
|
+
return valueInDocument <= conditionValue;
|
|
107
|
+
case '>':
|
|
108
|
+
return valueInDocument > conditionValue;
|
|
109
|
+
case '>=':
|
|
110
|
+
return valueInDocument >= conditionValue;
|
|
111
|
+
case 'like':
|
|
112
|
+
return (typeof valueInDocument === 'string' &&
|
|
113
|
+
typeof conditionValue === 'string' &&
|
|
114
|
+
isStringMatch(valueInDocument, conditionValue, false));
|
|
115
|
+
case 'not like':
|
|
116
|
+
return !(typeof valueInDocument === 'string' &&
|
|
117
|
+
typeof conditionValue === 'string' &&
|
|
118
|
+
isStringMatch(valueInDocument, conditionValue, false));
|
|
119
|
+
case 'like_cs':
|
|
120
|
+
return (typeof valueInDocument === 'string' &&
|
|
121
|
+
typeof conditionValue === 'string' &&
|
|
122
|
+
isStringMatch(valueInDocument, conditionValue, true));
|
|
123
|
+
case 'not like_cs':
|
|
124
|
+
return !(typeof valueInDocument === 'string' &&
|
|
125
|
+
typeof conditionValue === 'string' &&
|
|
126
|
+
isStringMatch(valueInDocument, conditionValue, true));
|
|
127
|
+
default:
|
|
128
|
+
throw new Error(`Unsupported operator comparison: ${operator}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.compareOperator = compareOperator;
|
|
132
|
+
function isStringMatch(str, pattern, caseSensitive) {
|
|
133
|
+
if (!caseSensitive) {
|
|
134
|
+
str = str.toLowerCase();
|
|
135
|
+
pattern = pattern.toLowerCase();
|
|
136
|
+
}
|
|
137
|
+
const escapedPattern = pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
138
|
+
const regexPattern = escapedPattern.replace(/%/g, '.*');
|
|
139
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
140
|
+
return regex.test(str);
|
|
141
|
+
}
|
|
142
|
+
function getQuerySubscriptionId(clientId, clientRequestId) {
|
|
143
|
+
return `${clientId}_${clientRequestId}`;
|
|
144
|
+
}
|
|
145
|
+
exports.getQuerySubscriptionId = getQuerySubscriptionId;
|
|
146
|
+
function parseQuerySubscriptionId(querySubscriptionId) {
|
|
147
|
+
const splitString = querySubscriptionId.split('_');
|
|
148
|
+
return {
|
|
149
|
+
clientId: splitString[0],
|
|
150
|
+
clientRequestId: splitString[1],
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
exports.parseQuerySubscriptionId = parseQuerySubscriptionId;
|
|
154
154
|
//# sourceMappingURL=query.types.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export type SquidCloudId = 'aws' | 'gcp' | 'azure';
|
|
2
|
-
export declare const SupportedSquidRegions: readonly ["us-east-1.aws"];
|
|
3
|
-
export type SupportedSquidRegion = (typeof SupportedSquidRegions)[number];
|
|
4
|
-
export interface SquidCloudRegion {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
}
|
|
8
|
-
export interface SquidSupportedCloud {
|
|
9
|
-
id: SquidCloudId;
|
|
10
|
-
name: string;
|
|
11
|
-
icon: string;
|
|
12
|
-
regions: Array<SquidCloudRegion>;
|
|
13
|
-
tooltip?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare const squidSupportedRegionMap: Record<SupportedSquidRegion, SquidCloudRegion>;
|
|
16
|
-
export declare function getSquidSupportedCloudMap(): Record<SquidCloudId, SquidSupportedCloud>;
|
|
17
|
-
export declare function convertToSquidRegion(cloudId: SquidCloudId, region: string): SupportedSquidRegion;
|
|
18
|
-
export declare function convertFromSquidRegion(regionAndCloud: SupportedSquidRegion): {
|
|
19
|
-
cloudId: SquidCloudId;
|
|
20
|
-
region: string;
|
|
21
|
-
};
|
|
1
|
+
export type SquidCloudId = 'aws' | 'gcp' | 'azure';
|
|
2
|
+
export declare const SupportedSquidRegions: readonly ["us-east-1.aws"];
|
|
3
|
+
export type SupportedSquidRegion = (typeof SupportedSquidRegions)[number];
|
|
4
|
+
export interface SquidCloudRegion {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SquidSupportedCloud {
|
|
9
|
+
id: SquidCloudId;
|
|
10
|
+
name: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
regions: Array<SquidCloudRegion>;
|
|
13
|
+
tooltip?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const squidSupportedRegionMap: Record<SupportedSquidRegion, SquidCloudRegion>;
|
|
16
|
+
export declare function getSquidSupportedCloudMap(): Record<SquidCloudId, SquidSupportedCloud>;
|
|
17
|
+
export declare function convertToSquidRegion(cloudId: SquidCloudId, region: string): SupportedSquidRegion;
|
|
18
|
+
export declare function convertFromSquidRegion(regionAndCloud: SupportedSquidRegion): {
|
|
19
|
+
cloudId: SquidCloudId;
|
|
20
|
+
region: string;
|
|
21
|
+
};
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertFromSquidRegion = exports.convertToSquidRegion = exports.getSquidSupportedCloudMap = exports.squidSupportedRegionMap = exports.SupportedSquidRegions = void 0;
|
|
4
|
-
const nullish_1 = require("./utils/nullish");
|
|
5
|
-
exports.SupportedSquidRegions = ['us-east-1.aws'];
|
|
6
|
-
exports.squidSupportedRegionMap = {
|
|
7
|
-
'us-east-1.aws': { id: 'us-east-1', name: 'US East (N. Virginia)' },
|
|
8
|
-
['us-east-1.aws-dev']: { id: 'us-east-1', name: 'US East (N. Virginia - Dev)' },
|
|
9
|
-
['local']: { id: 'local', name: 'Local' },
|
|
10
|
-
};
|
|
11
|
-
function getSquidSupportedCloudMap() {
|
|
12
|
-
return {
|
|
13
|
-
aws: {
|
|
14
|
-
id: 'aws',
|
|
15
|
-
name: 'Amazon Web Services',
|
|
16
|
-
icon: 'aws_icon',
|
|
17
|
-
regions: [exports.squidSupportedRegionMap['us-east-1.aws']].filter(nullish_1.isNotNullish),
|
|
18
|
-
},
|
|
19
|
-
gcp: {
|
|
20
|
-
id: 'gcp',
|
|
21
|
-
name: 'Google Cloud Platform',
|
|
22
|
-
icon: 'gcp_icon',
|
|
23
|
-
tooltip: 'Google Cloud (GCP) support is coming soon!',
|
|
24
|
-
regions: [],
|
|
25
|
-
},
|
|
26
|
-
azure: {
|
|
27
|
-
id: 'azure',
|
|
28
|
-
name: 'Microsoft Azure',
|
|
29
|
-
icon: 'azure_icon',
|
|
30
|
-
tooltip: 'Microsoft Azure support is coming soon!',
|
|
31
|
-
regions: [],
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.getSquidSupportedCloudMap = getSquidSupportedCloudMap;
|
|
36
|
-
function convertToSquidRegion(cloudId, region) {
|
|
37
|
-
if (region === 'local')
|
|
38
|
-
return 'local';
|
|
39
|
-
return `${region}.${cloudId}`;
|
|
40
|
-
}
|
|
41
|
-
exports.convertToSquidRegion = convertToSquidRegion;
|
|
42
|
-
function convertFromSquidRegion(regionAndCloud) {
|
|
43
|
-
const splitRegion = regionAndCloud.split('.');
|
|
44
|
-
return { cloudId: splitRegion[1], region: splitRegion[0] };
|
|
45
|
-
}
|
|
46
|
-
exports.convertFromSquidRegion = convertFromSquidRegion;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertFromSquidRegion = exports.convertToSquidRegion = exports.getSquidSupportedCloudMap = exports.squidSupportedRegionMap = exports.SupportedSquidRegions = void 0;
|
|
4
|
+
const nullish_1 = require("./utils/nullish");
|
|
5
|
+
exports.SupportedSquidRegions = ['us-east-1.aws'];
|
|
6
|
+
exports.squidSupportedRegionMap = {
|
|
7
|
+
'us-east-1.aws': { id: 'us-east-1', name: 'US East (N. Virginia)' },
|
|
8
|
+
['us-east-1.aws-dev']: { id: 'us-east-1', name: 'US East (N. Virginia - Dev)' },
|
|
9
|
+
['local']: { id: 'local', name: 'Local' },
|
|
10
|
+
};
|
|
11
|
+
function getSquidSupportedCloudMap() {
|
|
12
|
+
return {
|
|
13
|
+
aws: {
|
|
14
|
+
id: 'aws',
|
|
15
|
+
name: 'Amazon Web Services',
|
|
16
|
+
icon: 'aws_icon',
|
|
17
|
+
regions: [exports.squidSupportedRegionMap['us-east-1.aws']].filter(nullish_1.isNotNullish),
|
|
18
|
+
},
|
|
19
|
+
gcp: {
|
|
20
|
+
id: 'gcp',
|
|
21
|
+
name: 'Google Cloud Platform',
|
|
22
|
+
icon: 'gcp_icon',
|
|
23
|
+
tooltip: 'Google Cloud (GCP) support is coming soon!',
|
|
24
|
+
regions: [],
|
|
25
|
+
},
|
|
26
|
+
azure: {
|
|
27
|
+
id: 'azure',
|
|
28
|
+
name: 'Microsoft Azure',
|
|
29
|
+
icon: 'azure_icon',
|
|
30
|
+
tooltip: 'Microsoft Azure support is coming soon!',
|
|
31
|
+
regions: [],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.getSquidSupportedCloudMap = getSquidSupportedCloudMap;
|
|
36
|
+
function convertToSquidRegion(cloudId, region) {
|
|
37
|
+
if (region === 'local')
|
|
38
|
+
return 'local';
|
|
39
|
+
return `${region}.${cloudId}`;
|
|
40
|
+
}
|
|
41
|
+
exports.convertToSquidRegion = convertToSquidRegion;
|
|
42
|
+
function convertFromSquidRegion(regionAndCloud) {
|
|
43
|
+
const splitRegion = regionAndCloud.split('.');
|
|
44
|
+
return { cloudId: splitRegion[1], region: splitRegion[0] };
|
|
45
|
+
}
|
|
46
|
+
exports.convertFromSquidRegion = convertFromSquidRegion;
|
|
47
47
|
//# sourceMappingURL=regions.js.map
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { JSONSchema } from 'json-schema-typed';
|
|
2
|
-
export type FieldPlaceholder = '__SQUID_SERVER_TIMESTAMP__' | '__SQUID_CLIENT_IP__' | '__SQUID_USER_ID__' | '__SQUID_API_KEY__';
|
|
3
|
-
export type BasicFieldType = 'string' | 'integer' | 'number' | 'boolean' | 'map' | 'array' | 'any';
|
|
4
|
-
export type CustomFieldType = 'date' | 'json' | 'objectId';
|
|
5
|
-
export type SupportedFieldType = BasicFieldType | CustomFieldType;
|
|
6
|
-
export declare const SUPPORTED_FIELD_TYPES_ARRAY: Array<SupportedFieldType>;
|
|
7
|
-
type ConvertDeep<T extends JSONSchema> = Exclude<T, boolean> & {
|
|
8
|
-
properties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
9
|
-
patternProperties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
10
|
-
nullable?: boolean;
|
|
11
|
-
applyDefaultValueOn?: 'always' | 'empty' | 'updateOrEmpty';
|
|
12
|
-
isDate?: boolean;
|
|
13
|
-
isJSON?: boolean;
|
|
14
|
-
insertable?: boolean;
|
|
15
|
-
deletable?: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type PropertySchema = ConvertDeep<JSONSchema>;
|
|
18
|
-
export type TopLevelPropertySchema = PropertySchema & {
|
|
19
|
-
primaryKey?: boolean;
|
|
20
|
-
isComputed?: boolean;
|
|
21
|
-
isDefaultComputed?: boolean;
|
|
22
|
-
dataType?: string;
|
|
23
|
-
};
|
|
24
|
-
export type CollectionSchema = Omit<ConvertDeep<JSONSchema>, 'properties'> & {
|
|
25
|
-
properties?: Record<string, TopLevelPropertySchema>;
|
|
26
|
-
};
|
|
27
|
-
export declare function compileSchema<S extends CollectionSchema>(schema: S): any;
|
|
28
|
-
export declare function validateSchema<S extends CollectionSchema>(schema: S, data: any, updatedPaths?: Array<string>, dataBefore?: any): void;
|
|
29
|
-
export declare function findMatchingPropertiesForKey<S extends CollectionSchema | PropertySchema>(schema: S, key: string): Array<PropertySchema>;
|
|
30
|
-
export {};
|
|
1
|
+
import { JSONSchema } from 'json-schema-typed';
|
|
2
|
+
export type FieldPlaceholder = '__SQUID_SERVER_TIMESTAMP__' | '__SQUID_CLIENT_IP__' | '__SQUID_USER_ID__' | '__SQUID_API_KEY__';
|
|
3
|
+
export type BasicFieldType = 'string' | 'integer' | 'number' | 'boolean' | 'map' | 'array' | 'any';
|
|
4
|
+
export type CustomFieldType = 'date' | 'json' | 'objectId';
|
|
5
|
+
export type SupportedFieldType = BasicFieldType | CustomFieldType;
|
|
6
|
+
export declare const SUPPORTED_FIELD_TYPES_ARRAY: Array<SupportedFieldType>;
|
|
7
|
+
type ConvertDeep<T extends JSONSchema> = Exclude<T, boolean> & {
|
|
8
|
+
properties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
9
|
+
patternProperties?: Record<string, ConvertDeep<JSONSchema>>;
|
|
10
|
+
nullable?: boolean;
|
|
11
|
+
applyDefaultValueOn?: 'always' | 'empty' | 'updateOrEmpty';
|
|
12
|
+
isDate?: boolean;
|
|
13
|
+
isJSON?: boolean;
|
|
14
|
+
insertable?: boolean;
|
|
15
|
+
deletable?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type PropertySchema = ConvertDeep<JSONSchema>;
|
|
18
|
+
export type TopLevelPropertySchema = PropertySchema & {
|
|
19
|
+
primaryKey?: boolean;
|
|
20
|
+
isComputed?: boolean;
|
|
21
|
+
isDefaultComputed?: boolean;
|
|
22
|
+
dataType?: string;
|
|
23
|
+
};
|
|
24
|
+
export type CollectionSchema = Omit<ConvertDeep<JSONSchema>, 'properties'> & {
|
|
25
|
+
properties?: Record<string, TopLevelPropertySchema>;
|
|
26
|
+
};
|
|
27
|
+
export declare function compileSchema<S extends CollectionSchema>(schema: S): any;
|
|
28
|
+
export declare function validateSchema<S extends CollectionSchema>(schema: S, data: any, updatedPaths?: Array<string>, dataBefore?: any): void;
|
|
29
|
+
export declare function findMatchingPropertiesForKey<S extends CollectionSchema | PropertySchema>(schema: S, key: string): Array<PropertySchema>;
|
|
30
|
+
export {};
|