@squidcloud/local-backend 1.0.158 → 1.0.159
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/package.json +1 -1
- package/dist/internal-common/src/code-executor.types.d.ts +0 -15
- package/dist/internal-common/src/code-executor.types.js +0 -3
- package/dist/internal-common/src/code-executor.types.js.map +0 -1
- package/dist/internal-common/src/local-dev.types.d.ts +0 -54
- package/dist/internal-common/src/local-dev.types.js +0 -11
- package/dist/internal-common/src/local-dev.types.js.map +0 -1
- package/dist/internal-common/src/public-types/ai-chatbot.context.d.ts +0 -13
- package/dist/internal-common/src/public-types/ai-chatbot.context.js +0 -20
- package/dist/internal-common/src/public-types/ai-chatbot.context.js.map +0 -1
- package/dist/internal-common/src/public-types/ai-chatbot.types.d.ts +0 -126
- package/dist/internal-common/src/public-types/ai-chatbot.types.js +0 -28
- package/dist/internal-common/src/public-types/ai-chatbot.types.js.map +0 -1
- package/dist/internal-common/src/public-types/api-call.context.d.ts +0 -13
- package/dist/internal-common/src/public-types/api-call.context.js +0 -17
- package/dist/internal-common/src/public-types/api-call.context.js.map +0 -1
- package/dist/internal-common/src/public-types/api.types.d.ts +0 -22
- package/dist/internal-common/src/public-types/api.types.js +0 -3
- package/dist/internal-common/src/public-types/api.types.js.map +0 -1
- package/dist/internal-common/src/public-types/application.types.d.ts +0 -199
- package/dist/internal-common/src/public-types/application.types.js +0 -90
- package/dist/internal-common/src/public-types/application.types.js.map +0 -1
- package/dist/internal-common/src/public-types/backend-run.types.d.ts +0 -52
- package/dist/internal-common/src/public-types/backend-run.types.js +0 -28
- package/dist/internal-common/src/public-types/backend-run.types.js.map +0 -1
- package/dist/internal-common/src/public-types/bundle-api.types.d.ts +0 -53
- package/dist/internal-common/src/public-types/bundle-api.types.js +0 -3
- package/dist/internal-common/src/public-types/bundle-api.types.js.map +0 -1
- package/dist/internal-common/src/public-types/bundle-data.types.d.ts +0 -75
- package/dist/internal-common/src/public-types/bundle-data.types.js +0 -3
- package/dist/internal-common/src/public-types/bundle-data.types.js.map +0 -1
- package/dist/internal-common/src/public-types/communication.types.d.ts +0 -20
- package/dist/internal-common/src/public-types/communication.types.js +0 -42
- package/dist/internal-common/src/public-types/communication.types.js.map +0 -1
- package/dist/internal-common/src/public-types/context.types.d.ts +0 -24
- package/dist/internal-common/src/public-types/context.types.js +0 -3
- package/dist/internal-common/src/public-types/context.types.js.map +0 -1
- package/dist/internal-common/src/public-types/distributed-lock.context.d.ts +0 -4
- package/dist/internal-common/src/public-types/distributed-lock.context.js +0 -10
- package/dist/internal-common/src/public-types/distributed-lock.context.js.map +0 -1
- package/dist/internal-common/src/public-types/document.types.d.ts +0 -32
- package/dist/internal-common/src/public-types/document.types.js +0 -51
- package/dist/internal-common/src/public-types/document.types.js.map +0 -1
- package/dist/internal-common/src/public-types/graphql.context.d.ts +0 -14
- package/dist/internal-common/src/public-types/graphql.context.js +0 -13
- package/dist/internal-common/src/public-types/graphql.context.js.map +0 -1
- package/dist/internal-common/src/public-types/graphql.types.d.ts +0 -11
- package/dist/internal-common/src/public-types/graphql.types.js +0 -35
- package/dist/internal-common/src/public-types/graphql.types.js.map +0 -1
- package/dist/internal-common/src/public-types/http-status.enum.d.ts +0 -50
- package/dist/internal-common/src/public-types/http-status.enum.js +0 -55
- package/dist/internal-common/src/public-types/http-status.enum.js.map +0 -1
- package/dist/internal-common/src/public-types/integration-types.d.ts +0 -58
- package/dist/internal-common/src/public-types/integration-types.js +0 -65
- package/dist/internal-common/src/public-types/integration-types.js.map +0 -1
- package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.d.ts +0 -32
- package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.js +0 -3
- package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.js.map +0 -1
- package/dist/internal-common/src/public-types/integrations/api.types.d.ts +0 -81
- package/dist/internal-common/src/public-types/integrations/api.types.js +0 -3
- package/dist/internal-common/src/public-types/integrations/api.types.js.map +0 -1
- package/dist/internal-common/src/public-types/integrations/auth.types.d.ts +0 -46
- package/dist/internal-common/src/public-types/integrations/auth.types.js +0 -3
- package/dist/internal-common/src/public-types/integrations/auth.types.js.map +0 -1
- package/dist/internal-common/src/public-types/integrations/database.types.d.ts +0 -275
- package/dist/internal-common/src/public-types/integrations/database.types.js +0 -3
- package/dist/internal-common/src/public-types/integrations/database.types.js.map +0 -1
- package/dist/internal-common/src/public-types/integrations/observability.types.d.ts +0 -24
- package/dist/internal-common/src/public-types/integrations/observability.types.js +0 -24
- package/dist/internal-common/src/public-types/integrations/observability.types.js.map +0 -1
- package/dist/internal-common/src/public-types/integrations/schemas.d.ts +0 -74
- package/dist/internal-common/src/public-types/integrations/schemas.js +0 -43
- package/dist/internal-common/src/public-types/integrations/schemas.js.map +0 -1
- package/dist/internal-common/src/public-types/logger.types.d.ts +0 -21
- package/dist/internal-common/src/public-types/logger.types.js +0 -12
- package/dist/internal-common/src/public-types/logger.types.js.map +0 -1
- package/dist/internal-common/src/public-types/mutation.context.d.ts +0 -13
- package/dist/internal-common/src/public-types/mutation.context.js +0 -27
- package/dist/internal-common/src/public-types/mutation.context.js.map +0 -1
- package/dist/internal-common/src/public-types/mutation.types.d.ts +0 -63
- package/dist/internal-common/src/public-types/mutation.types.js +0 -143
- package/dist/internal-common/src/public-types/mutation.types.js.map +0 -1
- package/dist/internal-common/src/public-types/native-query.context.d.ts +0 -7
- package/dist/internal-common/src/public-types/native-query.context.js +0 -12
- package/dist/internal-common/src/public-types/native-query.context.js.map +0 -1
- package/dist/internal-common/src/public-types/openapi.types.d.ts +0 -26
- package/dist/internal-common/src/public-types/openapi.types.js +0 -3
- package/dist/internal-common/src/public-types/openapi.types.js.map +0 -1
- package/dist/internal-common/src/public-types/query-context.d.ts +0 -47
- package/dist/internal-common/src/public-types/query-context.js +0 -160
- package/dist/internal-common/src/public-types/query-context.js.map +0 -1
- package/dist/internal-common/src/public-types/query.types.d.ts +0 -86
- package/dist/internal-common/src/public-types/query.types.js +0 -98
- package/dist/internal-common/src/public-types/query.types.js.map +0 -1
- package/dist/internal-common/src/public-types/secret.types.d.ts +0 -68
- package/dist/internal-common/src/public-types/secret.types.js +0 -6
- package/dist/internal-common/src/public-types/secret.types.js.map +0 -1
- package/dist/internal-common/src/public-types/socket.types.d.ts +0 -126
- package/dist/internal-common/src/public-types/socket.types.js +0 -10
- package/dist/internal-common/src/public-types/socket.types.js.map +0 -1
- package/dist/internal-common/src/public-types/types.d.ts +0 -21
- package/dist/internal-common/src/public-types/types.js +0 -3
- package/dist/internal-common/src/public-types/types.js.map +0 -1
- package/dist/internal-common/src/schema/schema.types.d.ts +0 -30
- package/dist/internal-common/src/schema/schema.types.js +0 -167
- package/dist/internal-common/src/schema/schema.types.js.map +0 -1
- package/dist/internal-common/src/types/openapi-response.d.ts +0 -6
- package/dist/internal-common/src/types/openapi-response.js +0 -3
- package/dist/internal-common/src/types/openapi-response.js.map +0 -1
- package/dist/internal-common/src/types/security-internal.types.d.ts +0 -20
- package/dist/internal-common/src/types/security-internal.types.js +0 -3
- package/dist/internal-common/src/types/security-internal.types.js.map +0 -1
- package/dist/internal-common/src/utils/assert.d.ts +0 -3
- package/dist/internal-common/src/utils/assert.js +0 -15
- package/dist/internal-common/src/utils/assert.js.map +0 -1
- package/dist/internal-common/src/utils/backend-transforms.d.ts +0 -3
- package/dist/internal-common/src/utils/backend-transforms.js +0 -91
- package/dist/internal-common/src/utils/backend-transforms.js.map +0 -1
- package/dist/internal-common/src/utils/global.utils.d.ts +0 -11
- package/dist/internal-common/src/utils/global.utils.js +0 -51
- package/dist/internal-common/src/utils/global.utils.js.map +0 -1
- package/dist/internal-common/src/utils/http.d.ts +0 -2
- package/dist/internal-common/src/utils/http.js +0 -55
- package/dist/internal-common/src/utils/http.js.map +0 -1
- package/dist/internal-common/src/utils/object.d.ts +0 -5
- package/dist/internal-common/src/utils/object.js +0 -76
- package/dist/internal-common/src/utils/object.js.map +0 -1
- package/dist/internal-common/src/utils/serialization.d.ts +0 -5
- package/dist/internal-common/src/utils/serialization.js +0 -74
- package/dist/internal-common/src/utils/serialization.js.map +0 -1
- package/dist/internal-common/src/utils/validation.d.ts +0 -19
- package/dist/internal-common/src/utils/validation.js +0 -210
- package/dist/internal-common/src/utils/validation.js.map +0 -1
- package/dist/internal-common/src/websocket.impl.d.ts +0 -21
- package/dist/internal-common/src/websocket.impl.js +0 -80
- package/dist/internal-common/src/websocket.impl.js.map +0 -1
- package/dist/local-backend/openapi-template.hbs +0 -1
- package/dist/local-backend/package.json +0 -54
- package/dist/local-backend/src/index.d.ts +0 -4
- package/dist/local-backend/src/index.js.map +0 -1
- package/dist/local-backend/src/local-backend-socket.service.d.ts +0 -22
- package/dist/local-backend/src/local-backend-socket.service.js +0 -212
- package/dist/local-backend/src/local-backend-socket.service.js.map +0 -1
- package/dist/local-backend/src/local-backend.app.d.ts +0 -2
- package/dist/local-backend/src/local-backend.app.js +0 -26
- package/dist/local-backend/src/local-backend.app.js.map +0 -1
- package/dist/local-backend/src/local-backend.controller.d.ts +0 -8
- package/dist/local-backend/src/local-backend.controller.js +0 -49
- package/dist/local-backend/src/local-backend.controller.js.map +0 -1
- package/dist/local-backend/src/local-backend.module.d.ts +0 -8
- package/dist/local-backend/src/local-backend.module.js +0 -52
- package/dist/local-backend/src/local-backend.module.js.map +0 -1
- package/dist/local-backend/src/local-backend.service.d.ts +0 -17
- package/dist/local-backend/src/local-backend.service.js +0 -175
- package/dist/local-backend/src/local-backend.service.js.map +0 -1
- package/dist/local-backend/src/utils/shell-runner.d.ts +0 -4
- package/dist/local-backend/src/utils/shell-runner.js +0 -28
- package/dist/local-backend/src/utils/shell-runner.js.map +0 -1
- package/dist/local-backend/tsoa.json +0 -15
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,160 +0,0 @@
|
|
|
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.filter(query_types_1.isSimpleCondition));
|
|
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 simpleConditions = query.conditions.filter(query_types_1.isSimpleCondition);
|
|
74
|
-
const subsetOfConditions = this.isSubqueryOfConditions(simpleConditions);
|
|
75
|
-
const subsetOfOrder = this.sortedBy(query.sortOrder);
|
|
76
|
-
const withinLimit = query.limit === -1 || (this.limit > -1 && this.limit < query.limit);
|
|
77
|
-
return subsetOfConditions && subsetOfOrder && withinLimit;
|
|
78
|
-
}
|
|
79
|
-
getConditionsFor(...fieldNames) {
|
|
80
|
-
return this.parsedConditions.filter(cond => fieldNames.includes(cond.fieldName));
|
|
81
|
-
}
|
|
82
|
-
getConditionsForField(fieldName) {
|
|
83
|
-
return this.parsedConditions.filter(cond => cond.fieldName === fieldName);
|
|
84
|
-
}
|
|
85
|
-
documentMatchesQuery(doc) {
|
|
86
|
-
for (const contextCondition of this.parsedConditions) {
|
|
87
|
-
const fieldNameOrPath = contextCondition.fieldName;
|
|
88
|
-
const operator = contextCondition.operator;
|
|
89
|
-
const valueInDoc = _.get(doc, fieldNameOrPath);
|
|
90
|
-
if (operator === 'in') {
|
|
91
|
-
if (contextCondition.value.includes(valueInDoc)) {
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
else if (operator === 'not in') {
|
|
97
|
-
if (contextCondition.value.includes(valueInDoc)) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (!(0, query_types_1.compareOperator)(contextCondition.value, valueInDoc, operator)) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
evaluateSubset(queryCondition, testCondition) {
|
|
109
|
-
const { operator: queryOperator, value: queryValue } = queryCondition;
|
|
110
|
-
const { operator, value } = this.parseConditions([testCondition])[0];
|
|
111
|
-
const compareFunction = CompareTable[`${queryOperator}:${operator}`];
|
|
112
|
-
if (!compareFunction)
|
|
113
|
-
return false;
|
|
114
|
-
return compareFunction(queryValue, value);
|
|
115
|
-
}
|
|
116
|
-
evaluateIncludes(queryCondition, testCondition) {
|
|
117
|
-
const { operator: queryOperator, value: queryValue } = queryCondition;
|
|
118
|
-
const { operator, value } = this.parseConditions([testCondition])[0];
|
|
119
|
-
const sortedQueryValue = Array.isArray(queryValue) ? queryValue.sort() : queryValue;
|
|
120
|
-
const sortedValue = Array.isArray(value) ? value.sort() : value;
|
|
121
|
-
return operator === queryOperator && (0, lodash_1.isEqual)(sortedValue, sortedQueryValue);
|
|
122
|
-
}
|
|
123
|
-
parseConditions(conditions) {
|
|
124
|
-
const parsedConditions = [];
|
|
125
|
-
const inMap = new Map();
|
|
126
|
-
const notInMap = new Map();
|
|
127
|
-
conditions.forEach(c => {
|
|
128
|
-
switch (c.operator) {
|
|
129
|
-
case '==':
|
|
130
|
-
case 'in':
|
|
131
|
-
inMap.set(c.fieldName, (inMap.get(c.fieldName) || []).concat(c.value));
|
|
132
|
-
break;
|
|
133
|
-
case '!=':
|
|
134
|
-
case 'not in':
|
|
135
|
-
notInMap.set(c.fieldName, (notInMap.get(c.fieldName) || []).concat(c.value));
|
|
136
|
-
break;
|
|
137
|
-
default:
|
|
138
|
-
parsedConditions.push(c);
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
inMap.forEach((value, fieldName) => {
|
|
143
|
-
parsedConditions.push({
|
|
144
|
-
fieldName: fieldName,
|
|
145
|
-
operator: 'in',
|
|
146
|
-
value: value,
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
notInMap.forEach((value, fieldName) => {
|
|
150
|
-
parsedConditions.push({
|
|
151
|
-
fieldName: fieldName,
|
|
152
|
-
operator: 'not in',
|
|
153
|
-
value: value,
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
return parsedConditions;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
exports.QueryContext = QueryContext;
|
|
160
|
-
//# sourceMappingURL=query-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-context.js","sourceRoot":"","sources":["../../../../../internal-common/src/public-types/query-context.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,mCAAiC;AACjC,+CAAgH;AAkBhH,MAAM,YAAY,GAAgD;IAChE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAErD,WAAW,EAAE,CAAC,CAAC,EAA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AAC,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YACjC,gBAAgB,CAAC,IAAI,CAAC;gBACpB,SAAS,EAAE,SAAgB;gBAC3B,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,KAAY;aACpB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YACpC,gBAAgB,CAAC,IAAI,CAAC;gBACpB,SAAS,EAAE,SAAgB;gBAC3B,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,KAAY;aACpB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AArPD,oCAqPC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { CollectionName, DocumentData, FieldName, PrimitiveFieldType } from './document.types';
|
|
2
|
-
import { Paths } from './types';
|
|
3
|
-
import { TriggerId } from './application.types';
|
|
4
|
-
import { AppId, ClientId, ClientRequestId } from './communication.types';
|
|
5
|
-
export type Alias = string;
|
|
6
|
-
export interface JoinCondition {
|
|
7
|
-
leftAlias: Alias;
|
|
8
|
-
left: FieldName;
|
|
9
|
-
right: FieldName;
|
|
10
|
-
isInner: boolean;
|
|
11
|
-
}
|
|
12
|
-
export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
|
|
13
|
-
export type Conditions<Doc extends DocumentData = any> = Array<Condition<Doc>>;
|
|
14
|
-
export interface SimpleCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>, MyOperator = Operator> {
|
|
15
|
-
fieldName: F;
|
|
16
|
-
operator: MyOperator;
|
|
17
|
-
value: any;
|
|
18
|
-
}
|
|
19
|
-
export interface CompositeCondition<Doc extends DocumentData = any> {
|
|
20
|
-
fields: Array<SimpleCondition<Doc, Paths<Doc>, CompositeConditionOperator>>;
|
|
21
|
-
}
|
|
22
|
-
export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
|
|
23
|
-
type CompositeConditionOperator = '>=' | '<=' | '>' | '<';
|
|
24
|
-
export type Operator = '==' | '!=' | CompositeConditionOperator | 'like' | 'not like' | 'like_cs' | 'not like_cs';
|
|
25
|
-
export interface FieldSort<Doc> {
|
|
26
|
-
fieldName: FieldName<Doc>;
|
|
27
|
-
asc: boolean;
|
|
28
|
-
}
|
|
29
|
-
interface RegularQueryKey {
|
|
30
|
-
queryType: 'query';
|
|
31
|
-
clientId: string;
|
|
32
|
-
clientRequestId: string;
|
|
33
|
-
}
|
|
34
|
-
interface TriggerKey {
|
|
35
|
-
queryType: 'trigger';
|
|
36
|
-
triggerId: TriggerId;
|
|
37
|
-
}
|
|
38
|
-
export type QueryKey = RegularQueryKey | TriggerKey;
|
|
39
|
-
export interface Query<Doc extends DocumentData = any> {
|
|
40
|
-
collectionName: CollectionName;
|
|
41
|
-
integrationId: string;
|
|
42
|
-
conditions: Conditions<Doc>;
|
|
43
|
-
sortOrder: Array<FieldSort<Doc>>;
|
|
44
|
-
limit: number;
|
|
45
|
-
limitBy?: {
|
|
46
|
-
limit: number;
|
|
47
|
-
fields: Array<FieldName<Doc>>;
|
|
48
|
-
reverseSort: boolean;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
export type QuerySubscriptionId = `${ClientId}_${ClientRequestId}`;
|
|
52
|
-
export interface QueryRequest {
|
|
53
|
-
clientRequestId: ClientRequestId;
|
|
54
|
-
query: Query;
|
|
55
|
-
subscribe: boolean;
|
|
56
|
-
}
|
|
57
|
-
export interface QueryUnsubscribeRequest {
|
|
58
|
-
clientRequestId: ClientRequestId;
|
|
59
|
-
}
|
|
60
|
-
export interface QueryRegisterRequest {
|
|
61
|
-
clientRequestId: ClientRequestId;
|
|
62
|
-
query: Query;
|
|
63
|
-
parentClientRequestId: ClientRequestId;
|
|
64
|
-
}
|
|
65
|
-
interface QueryMetadata {
|
|
66
|
-
condCount: number;
|
|
67
|
-
}
|
|
68
|
-
export declare function encodeCondition(condition: Condition<any>): EncodedCondition;
|
|
69
|
-
export type EncodedCondition = string;
|
|
70
|
-
export type QueryMapping<QueryReferenceType extends string> = {
|
|
71
|
-
unconditional: Array<QueryReferenceType>;
|
|
72
|
-
conditional: Record<EncodedCondition, Array<QueryReferenceType>>;
|
|
73
|
-
queriesMetadata: Record<QueryReferenceType, QueryMetadata>;
|
|
74
|
-
};
|
|
75
|
-
export declare abstract class QueryMappingManager<T> {
|
|
76
|
-
abstract addQuery(appId: AppId, query: Query, key: T): Promise<void>;
|
|
77
|
-
abstract removeQuery(appId: AppId, key: T): Promise<Query | undefined>;
|
|
78
|
-
abstract removeLocalDevAppData(appId: AppId): Promise<void>;
|
|
79
|
-
}
|
|
80
|
-
export declare function compareOperator(conditionValue: PrimitiveFieldType, valueInDocument: PrimitiveFieldType, operator: Operator): boolean;
|
|
81
|
-
export declare function getQuerySubscriptionId(clientId: string, clientRequestId: string): QuerySubscriptionId;
|
|
82
|
-
export declare function parseQuerySubscriptionId(querySubscriptionId: QuerySubscriptionId): {
|
|
83
|
-
clientId: string;
|
|
84
|
-
clientRequestId: string;
|
|
85
|
-
};
|
|
86
|
-
export {};
|
|
@@ -1,98 +0,0 @@
|
|
|
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 lodash_1 = require("lodash");
|
|
5
|
-
const serialization_1 = require("../utils/serialization");
|
|
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
|
-
class QueryMappingManager {
|
|
15
|
-
}
|
|
16
|
-
exports.QueryMappingManager = QueryMappingManager;
|
|
17
|
-
function compareOperator(conditionValue, valueInDocument, operator) {
|
|
18
|
-
conditionValue = conditionValue instanceof Date ? conditionValue.getTime() : conditionValue !== null && conditionValue !== void 0 ? conditionValue : null;
|
|
19
|
-
valueInDocument = valueInDocument instanceof Date ? valueInDocument.getTime() : valueInDocument !== null && valueInDocument !== void 0 ? valueInDocument : null;
|
|
20
|
-
if (operator === '==') {
|
|
21
|
-
return lodash_1.default.isEqual(conditionValue, valueInDocument);
|
|
22
|
-
}
|
|
23
|
-
if (operator === '!=') {
|
|
24
|
-
return !lodash_1.default.isEqual(conditionValue, valueInDocument);
|
|
25
|
-
}
|
|
26
|
-
switch (operator) {
|
|
27
|
-
case '<':
|
|
28
|
-
if (lodash_1.default.isNil(conditionValue))
|
|
29
|
-
return false;
|
|
30
|
-
if (lodash_1.default.isNil(valueInDocument))
|
|
31
|
-
return true;
|
|
32
|
-
return valueInDocument < conditionValue;
|
|
33
|
-
case '<=':
|
|
34
|
-
if (lodash_1.default.isNil(valueInDocument)) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
if (lodash_1.default.isNil(conditionValue)) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
return valueInDocument <= conditionValue;
|
|
41
|
-
case '>':
|
|
42
|
-
if (lodash_1.default.isNil(valueInDocument))
|
|
43
|
-
return false;
|
|
44
|
-
if (lodash_1.default.isNil(conditionValue))
|
|
45
|
-
return true;
|
|
46
|
-
return valueInDocument > conditionValue;
|
|
47
|
-
case '>=':
|
|
48
|
-
if (lodash_1.default.isNil(conditionValue)) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
if (lodash_1.default.isNil(valueInDocument)) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
return valueInDocument >= conditionValue;
|
|
55
|
-
case 'like':
|
|
56
|
-
return (typeof valueInDocument === 'string' &&
|
|
57
|
-
typeof conditionValue === 'string' &&
|
|
58
|
-
isStringMatch(valueInDocument, conditionValue, false));
|
|
59
|
-
case 'not like':
|
|
60
|
-
return !(typeof valueInDocument === 'string' &&
|
|
61
|
-
typeof conditionValue === 'string' &&
|
|
62
|
-
isStringMatch(valueInDocument, conditionValue, false));
|
|
63
|
-
case 'like_cs':
|
|
64
|
-
return (typeof valueInDocument === 'string' &&
|
|
65
|
-
typeof conditionValue === 'string' &&
|
|
66
|
-
isStringMatch(valueInDocument, conditionValue, true));
|
|
67
|
-
case 'not like_cs':
|
|
68
|
-
return !(typeof valueInDocument === 'string' &&
|
|
69
|
-
typeof conditionValue === 'string' &&
|
|
70
|
-
isStringMatch(valueInDocument, conditionValue, true));
|
|
71
|
-
default:
|
|
72
|
-
throw new Error(`Unsupported operator comparison: ${operator}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.compareOperator = compareOperator;
|
|
76
|
-
function isStringMatch(str, pattern, caseSensitive) {
|
|
77
|
-
if (!caseSensitive) {
|
|
78
|
-
str = str.toLowerCase();
|
|
79
|
-
pattern = pattern.toLowerCase();
|
|
80
|
-
}
|
|
81
|
-
const escapedPattern = pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
82
|
-
const regexPattern = escapedPattern.replace(/%/g, '[\\s\\S]*');
|
|
83
|
-
const regex = new RegExp(`^${regexPattern}$`);
|
|
84
|
-
return regex.test(str);
|
|
85
|
-
}
|
|
86
|
-
function getQuerySubscriptionId(clientId, clientRequestId) {
|
|
87
|
-
return `${clientId}_${clientRequestId}`;
|
|
88
|
-
}
|
|
89
|
-
exports.getQuerySubscriptionId = getQuerySubscriptionId;
|
|
90
|
-
function parseQuerySubscriptionId(querySubscriptionId) {
|
|
91
|
-
const splitString = querySubscriptionId.split('_');
|
|
92
|
-
return {
|
|
93
|
-
clientId: splitString[0],
|
|
94
|
-
clientRequestId: splitString[1],
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
exports.parseQuerySubscriptionId = parseQuerySubscriptionId;
|
|
98
|
-
//# sourceMappingURL=query.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.types.js","sourceRoot":"","sources":["../../../../../internal-common/src/public-types/query.types.ts"],"names":[],"mappings":";;;AAAA,mCAAuB;AAKvB,0DAA+D;AA4C/D,SAAgB,iBAAiB,CAAC,SAAoB;IACpD,OAAO,WAAW,IAAI,SAAS,CAAC;AAClC,CAAC;AAFD,8CAEC;AAsFD,SAAgB,eAAe,CAAC,SAAyB;IACvD,OAAO,IAAA,qCAAqB,EAAC,SAAS,CAAC,CAAC;AAC1C,CAAC;AAFD,0CAEC;AAYD,MAAsB,mBAAmB;CAMxC;AAND,kDAMC;AAGD,SAAgB,eAAe,CAC7B,cAAkC,EAClC,eAAmC,EACnC,QAAkB;IAElB,cAAc,GAAG,cAAc,YAAY,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC;IACpG,eAAe,GAAG,eAAe,YAAY,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAI,CAAC;IAExG,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,OAAO,gBAAC,CAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;KACnD;IACD,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,OAAO,CAAC,gBAAC,CAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;KACpD;IAGD,QAAQ,QAAQ,EAAE;QAChB,KAAK,GAAG;YACN,IAAI,gBAAC,CAAC,KAAK,CAAC,cAAc,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC1C,IAAI,gBAAC,CAAC,KAAK,CAAC,eAAe,CAAC;gB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AC,CACN,OAAO,eAAe,KAAK,QAAQ;gBACnC,OAAO,cAAc,KAAK,QAAQ;gBAClC,aAAa,CAAC,eAAe,EAAE,cAAc,EAAE,IAAI,CAAC,CACrD,CAAC;QACJ;YACE,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,EAAE,CAAC,CAAC;KACnE;AACH,CAAC;AApED,0CAoEC;AAGD,SAAS,aAAa,CAAC,GAAW,EAAE,OAAe,EAAE,aAAsB;IACzE,IAAI,CAAC,aAAa,EAAE;QAClB,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACxB,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;KACjC;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IAIzE,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAG/D,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,YAAY,GAAG,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAMD,SAAgB,sBAAsB,CAAC,QAAgB,EAAE,eAAuB;IAC9E,OAAO,GAAG,QAAQ,IAAI,eAAe,EAAE,CAAC;AAC1C,CAAC;AAFD,wDAEC;AAGD,SAAgB,wBAAwB,CAAC,mBAAwC;IAI/E,MAAM,WAAW,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnD,OAAO;QACL,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;QACxB,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;KAChC,CAAC;AACJ,CAAC;AATD,4DASC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export type SecretKey = string;
|
|
2
|
-
export type SecretValue = string | number | boolean;
|
|
3
|
-
export type SecretTimestamp = number;
|
|
4
|
-
export type ApiKeyName = string;
|
|
5
|
-
export type ApiKey = string;
|
|
6
|
-
export type SetSecretEntry = {
|
|
7
|
-
key: SecretKey;
|
|
8
|
-
value?: SecretValue;
|
|
9
|
-
};
|
|
10
|
-
export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
|
|
11
|
-
export declare const APP_API_KEY = "APP_API_KEY";
|
|
12
|
-
export interface ApplicationSecrets {
|
|
13
|
-
custom: Record<SecretKey, SecretEntry>;
|
|
14
|
-
apiKeys: Record<SecretKey, ApiKeyEntry>;
|
|
15
|
-
}
|
|
16
|
-
export interface SystemSecrets {
|
|
17
|
-
sharedMongo: {
|
|
18
|
-
password: string;
|
|
19
|
-
};
|
|
20
|
-
datadog: {
|
|
21
|
-
appKey: string;
|
|
22
|
-
apiKey: string;
|
|
23
|
-
};
|
|
24
|
-
openai: {
|
|
25
|
-
apiKey: string;
|
|
26
|
-
};
|
|
27
|
-
anthropic: {
|
|
28
|
-
apiKey: string;
|
|
29
|
-
};
|
|
30
|
-
pinecone: {
|
|
31
|
-
apiKey: string;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export interface SecretMetadata {
|
|
35
|
-
key: SecretKey;
|
|
36
|
-
lastUpdated: SecretTimestamp;
|
|
37
|
-
}
|
|
38
|
-
export interface SecretEntry<T extends SecretValue = SecretValue> extends SecretMetadata {
|
|
39
|
-
value: T;
|
|
40
|
-
}
|
|
41
|
-
export interface ApiKeyEntry extends SecretMetadata {
|
|
42
|
-
value: string;
|
|
43
|
-
}
|
|
44
|
-
export interface SetSecretRequest {
|
|
45
|
-
entries: Array<SetSecretRequestEntry>;
|
|
46
|
-
}
|
|
47
|
-
export interface SetSecretRequestEntry {
|
|
48
|
-
key: SecretKey;
|
|
49
|
-
value: SecretValue;
|
|
50
|
-
}
|
|
51
|
-
export interface DeleteSecretRequest {
|
|
52
|
-
keys: Array<SecretKey>;
|
|
53
|
-
}
|
|
54
|
-
export interface GetCustomSecretRequest {
|
|
55
|
-
key: SecretKey;
|
|
56
|
-
}
|
|
57
|
-
export interface GetApiKeyRequest {
|
|
58
|
-
key: SecretKey;
|
|
59
|
-
}
|
|
60
|
-
export type DeleteApiKeyRequest = Pick<SecretMetadata, 'key'>;
|
|
61
|
-
export interface ListApplicationSecretMetadataResponse {
|
|
62
|
-
custom: SecretMetadata[];
|
|
63
|
-
apiKeys: SecretMetadata[];
|
|
64
|
-
}
|
|
65
|
-
export type GenerateNewApiKeyRequest = Pick<SecretMetadata, 'key'>;
|
|
66
|
-
export interface GenerateNewApiKeyResponse {
|
|
67
|
-
apiKey: string;
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"secret.types.js","sourceRoot":"","sources":["../../../../../internal-common/src/public-types/secret.types.ts"],"names":[],"mappings":";;;AAgBa,QAAA,eAAe,GAAG,kBAAkB,CAAC;AACrC,QAAA,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { ClientId, ClientRequestId, IntegrationId } from './communication.types';
|
|
2
|
-
import { AuthToken } from './context.types';
|
|
3
|
-
import { CollectionName, DocTimestamp, SquidDocId, SquidDocument } from './document.types';
|
|
4
|
-
import { MutationType } from './mutation.types';
|
|
5
|
-
export type MessageId = string;
|
|
6
|
-
export type MessageFromClientType = 'acknowledge' | 'catchup' | 'kill' | 'acquireLock' | 'releaseLock' | 'pong';
|
|
7
|
-
interface BaseMessageFromClient {
|
|
8
|
-
type: MessageFromClientType;
|
|
9
|
-
authToken?: AuthToken;
|
|
10
|
-
payload?: unknown;
|
|
11
|
-
}
|
|
12
|
-
export interface AcknowledgeMessage extends BaseMessageFromClient {
|
|
13
|
-
type: 'acknowledge';
|
|
14
|
-
payload: Array<MessageId>;
|
|
15
|
-
}
|
|
16
|
-
export interface CatchupMessage extends BaseMessageFromClient {
|
|
17
|
-
type: 'catchup';
|
|
18
|
-
}
|
|
19
|
-
export interface KillMessage extends BaseMessageFromClient {
|
|
20
|
-
type: 'kill';
|
|
21
|
-
}
|
|
22
|
-
export interface AcquireLockMessage extends BaseMessageFromClient {
|
|
23
|
-
type: 'acquireLock';
|
|
24
|
-
payload: {
|
|
25
|
-
mutex: string;
|
|
26
|
-
clientRequestId: ClientRequestId;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export interface ReleaseLockMessage extends BaseMessageFromClient {
|
|
30
|
-
type: 'releaseLock';
|
|
31
|
-
payload: {
|
|
32
|
-
lockId: string;
|
|
33
|
-
clientRequestId: ClientRequestId;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export type MessageFromClient = AcknowledgeMessage | CatchupMessage | KillMessage | AcquireLockMessage | ReleaseLockMessage;
|
|
37
|
-
export type MessageToClientType = 'mutations' | 'query' | 'backendFunction' | 'api' | 'namedQuery' | 'lockAcquired' | 'lockReleased' | 'aiChatbot' | 'ping';
|
|
38
|
-
interface BaseMessageToClient {
|
|
39
|
-
type: MessageToClientType;
|
|
40
|
-
messageId: MessageId;
|
|
41
|
-
payload: unknown;
|
|
42
|
-
}
|
|
43
|
-
export interface BackendFunctionMessageToClient extends BaseMessageToClient {
|
|
44
|
-
type: 'backendFunction';
|
|
45
|
-
clientRequestId: ClientRequestId;
|
|
46
|
-
payload: string;
|
|
47
|
-
}
|
|
48
|
-
export interface NamedQueryMessageToClient extends BaseMessageToClient {
|
|
49
|
-
type: 'namedQuery';
|
|
50
|
-
clientRequestId: ClientRequestId;
|
|
51
|
-
payload: string;
|
|
52
|
-
}
|
|
53
|
-
export interface LockAcquiredResponseMessageToClient extends BaseMessageToClient {
|
|
54
|
-
type: 'lockAcquired';
|
|
55
|
-
payload: {
|
|
56
|
-
clientRequestId: ClientRequestId;
|
|
57
|
-
lockId: string | undefined;
|
|
58
|
-
error?: string;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export interface LockReleasedResponseMessageToClient extends BaseMessageToClient {
|
|
62
|
-
type: 'lockReleased';
|
|
63
|
-
payload: {
|
|
64
|
-
clientRequestId: ClientRequestId;
|
|
65
|
-
lockId: string;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export interface AiChatbotMessageToClient extends BaseMessageToClient {
|
|
69
|
-
type: 'aiChatbot';
|
|
70
|
-
clientRequestId: ClientRequestId;
|
|
71
|
-
payload: {
|
|
72
|
-
token: string;
|
|
73
|
-
complete: boolean;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
export type MessageToClient = MutationsMessageToClient | PingMessageToClient | QueryResultMessageToClient | BackendFunctionMessageToClient | NamedQueryMessageToClient | LockAcquiredResponseMessageToClient | LockReleasedResponseMessageToClient | AiChatbotMessageToClient;
|
|
77
|
-
export interface MutationsMessageToClient extends BaseMessageToClient {
|
|
78
|
-
type: 'mutations';
|
|
79
|
-
payload: Array<MutationResultData>;
|
|
80
|
-
}
|
|
81
|
-
export interface PingMessageToClient extends BaseMessageToClient {
|
|
82
|
-
type: 'ping';
|
|
83
|
-
payload: unknown;
|
|
84
|
-
}
|
|
85
|
-
export interface MutationResultData {
|
|
86
|
-
squidDocId: SquidDocId;
|
|
87
|
-
clientRequestId: ClientRequestId;
|
|
88
|
-
mutationType: MutationType;
|
|
89
|
-
mutationTimestamp: DocTimestamp;
|
|
90
|
-
doc: SquidDocument | undefined;
|
|
91
|
-
}
|
|
92
|
-
export interface QueryResultData {
|
|
93
|
-
docs: Array<SquidDocument>;
|
|
94
|
-
integrationId: IntegrationId;
|
|
95
|
-
collectionName: CollectionName;
|
|
96
|
-
clientRequestId: ClientRequestId;
|
|
97
|
-
}
|
|
98
|
-
export interface QueryErrorData {
|
|
99
|
-
message: string;
|
|
100
|
-
statusCode: number;
|
|
101
|
-
}
|
|
102
|
-
export interface BatchQueryResultData {
|
|
103
|
-
results: Record<ClientRequestId, QueryResultData>;
|
|
104
|
-
errors: Record<ClientRequestId, QueryErrorData>;
|
|
105
|
-
}
|
|
106
|
-
export interface QueryResultMessageToClient extends BaseMessageToClient {
|
|
107
|
-
type: 'query';
|
|
108
|
-
payload: QueryResultData;
|
|
109
|
-
}
|
|
110
|
-
export interface ApiResultData {
|
|
111
|
-
success: boolean;
|
|
112
|
-
httpStatus: number;
|
|
113
|
-
payload: string;
|
|
114
|
-
}
|
|
115
|
-
export interface BackendFunctionResultData {
|
|
116
|
-
success: boolean;
|
|
117
|
-
payload: string;
|
|
118
|
-
}
|
|
119
|
-
export type PendingMessage = Omit<MessageToClient, 'messageId'>;
|
|
120
|
-
export type PendingMessages = Record<ClientId, Array<PendingMessage>>;
|
|
121
|
-
export declare enum ClientConnectionState {
|
|
122
|
-
CONNECTED = "CONNECTED",
|
|
123
|
-
DISCONNECTED = "DISCONNECTED",
|
|
124
|
-
REMOVED = "REMOVED"
|
|
125
|
-
}
|
|
126
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientConnectionState = void 0;
|
|
4
|
-
var ClientConnectionState;
|
|
5
|
-
(function (ClientConnectionState) {
|
|
6
|
-
ClientConnectionState["CONNECTED"] = "CONNECTED";
|
|
7
|
-
ClientConnectionState["DISCONNECTED"] = "DISCONNECTED";
|
|
8
|
-
ClientConnectionState["REMOVED"] = "REMOVED";
|
|
9
|
-
})(ClientConnectionState || (exports.ClientConnectionState = ClientConnectionState = {}));
|
|
10
|
-
//# sourceMappingURL=socket.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socket.types.js","sourceRoot":"","sources":["../../../../../internal-common/src/public-types/socket.types.ts"],"names":[],"mappings":";;;AAuMA,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAE/B,gDAAuB,CAAA;IAEvB,sDAA6B,CAAA;IAE7B,4CAAmB,CAAA;AACrB,CAAC,EAPW,qBAAqB,qCAArB,qBAAqB,QAOhC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface Type<T> extends Function {
|
|
2
|
-
new (...args: any[]): T;
|
|
3
|
-
}
|
|
4
|
-
export type Replace<TypeToBeChecked, KeyToBeReplaced extends keyof TypeToBeChecked, NewValueToUse> = Omit<TypeToBeChecked, KeyToBeReplaced> & {
|
|
5
|
-
[P in KeyToBeReplaced]: NewValueToUse;
|
|
6
|
-
};
|
|
7
|
-
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
8
|
-
export type WithRequired<T, K extends keyof T> = T & {
|
|
9
|
-
[P in K]-?: T[P];
|
|
10
|
-
};
|
|
11
|
-
type PropertiesWithPrefix<Prefix extends string> = {
|
|
12
|
-
[key in `${Prefix}${string}`]: any;
|
|
13
|
-
};
|
|
14
|
-
type Pred = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
15
|
-
export type DeepRecord<T, RemainingDepth extends number & keyof Pred = 5, Prefix extends string = ''> = RemainingDepth extends 0 ? PropertiesWithPrefix<Prefix> : {
|
|
16
|
-
[k in keyof T]-?: k extends string | number ? Record<`${Prefix}${k}`, T[k]> | (Required<T>[k] extends any[] ? never : Required<T>[k] extends object ? DeepRecord<Required<T>[k], Pred[RemainingDepth], `${Prefix}${k}.`> : never) : never;
|
|
17
|
-
}[keyof T];
|
|
18
|
-
export type UnionKeys<T> = T extends any ? keyof T : never;
|
|
19
|
-
export type FieldOf<T, K extends UnionKeys<T>> = Extract<T, Record<K, any>>[K];
|
|
20
|
-
export type Paths<T> = UnionKeys<DeepRecord<T>>;
|
|
21
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../internal-common/src/public-types/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,30 +0,0 @@
|
|
|
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 declare const BASIC_FIELD_TYPES: readonly ["string", "integer", "number", "boolean", "map", "array", "any"];
|
|
4
|
-
export declare const CUSTOM_FIELD_TYPES: readonly ["date", "json", "objectId"];
|
|
5
|
-
export declare const DATA_SCHEMA_FIELD_TYPES: readonly ["string", "integer", "number", "boolean", "map", "array", "any", "date", "json", "objectId"];
|
|
6
|
-
export type DataSchemaFieldType = (typeof DATA_SCHEMA_FIELD_TYPES)[number];
|
|
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 {};
|