@squidcloud/local-backend 1.0.46 → 1.0.48
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 +207 -207
- package/dist/common/src/ai-assistant.schemas.js +196 -196
- package/dist/common/src/ai-assistant.types.d.ts +80 -80
- 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 +1168 -1168
- package/dist/common/src/application.schemas.js +741 -741
- package/dist/common/src/application.types.d.ts +228 -228
- package/dist/common/src/application.types.js +89 -89
- 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 +73 -73
- package/dist/common/src/bundle-api.types.d.ts +71 -71
- package/dist/common/src/bundle-api.types.js +2 -2
- package/dist/common/src/bundle-data.types.d.ts +59 -59
- 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/index.d.ts +53 -53
- package/dist/common/src/index.js +69 -69
- package/dist/common/src/integrations/ai_assistant.types.d.ts +30 -30
- 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 +236 -236
- package/dist/common/src/integrations/database.types.js +2 -2
- package/dist/common/src/integrations/index.d.ts +101 -101
- package/dist/common/src/integrations/index.js +105 -105
- 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/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 +63 -63
- package/dist/common/src/query/base-query-builder.js +294 -289
- package/dist/common/src/query/base-query-builder.js.map +1 -1
- package/dist/common/src/query/index.d.ts +2 -2
- package/dist/common/src/query/index.js +18 -18
- 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.types.d.ts +74 -74
- 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 +6 -6
- package/dist/common/src/secret.schemas.js +32 -32
- package/dist/common/src/secret.types.d.ts +49 -49
- 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 +108 -108
- package/dist/common/src/socket.types.js +2 -2
- 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 +51 -51
- 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/http.d.ts +2 -2
- package/dist/common/src/utils/http.js +38 -38
- 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 +1 -1
- package/dist/common/src/utils/nullish.js +7 -7
- package/dist/common/src/utils/object.d.ts +6 -6
- package/dist/common/src/utils/object.js +89 -89
- 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 +7 -7
- package/dist/common/src/webhook-response.js +7 -7
- 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/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/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/kafka/kafka.manager.d.ts +22 -22
- package/dist/internal-common/src/kafka/kafka.manager.js +128 -128
- 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 +31 -31
- 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/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 +18 -18
- package/dist/local-backend/src/local-backend-socket.service.js +108 -108
- 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.module.d.ts +8 -8
- package/dist/local-backend/src/local-backend.module.js +53 -53
- package/dist/local-backend/src/local-backend.service.d.ts +15 -15
- package/dist/local-backend/src/local-backend.service.js +165 -165
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { TriggerId } from './application.types';
|
|
2
|
-
import { AppId, ClientId, ClientRequestId } from './communication.types';
|
|
3
|
-
import { CollectionName, DocumentData, FieldName, PrimitiveFieldType } from './document.types';
|
|
4
|
-
import { Paths } from './types';
|
|
5
|
-
export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
|
|
6
|
-
export type Conditions<Doc extends DocumentData = any> = Array<Condition<Doc>>;
|
|
7
|
-
export interface SimpleCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>, MyOperator = Operator> {
|
|
8
|
-
fieldName: F;
|
|
9
|
-
operator: MyOperator;
|
|
10
|
-
value: any;
|
|
11
|
-
}
|
|
12
|
-
export interface CompositeCondition<Doc extends DocumentData = any> {
|
|
13
|
-
fields: Array<SimpleCondition<Doc, Paths<Doc>, CompositeConditionOperator>>;
|
|
14
|
-
}
|
|
15
|
-
export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
|
|
16
|
-
type CompositeConditionOperator = '>=' | '<=' | '>' | '<';
|
|
17
|
-
export type Operator = '==' | '!=' | CompositeConditionOperator | 'like' | 'not like' | 'like_cs' | 'not like_cs';
|
|
18
|
-
export interface FieldSort<Doc> {
|
|
19
|
-
fieldName: FieldName<Doc>;
|
|
20
|
-
asc: boolean;
|
|
21
|
-
}
|
|
22
|
-
interface RegularQueryKey {
|
|
23
|
-
queryType: 'query';
|
|
24
|
-
clientId: string;
|
|
25
|
-
clientRequestId: string;
|
|
26
|
-
}
|
|
27
|
-
interface TriggerKey {
|
|
28
|
-
queryType: 'trigger';
|
|
29
|
-
triggerId: TriggerId;
|
|
30
|
-
}
|
|
31
|
-
export type QueryKey = RegularQueryKey | TriggerKey;
|
|
32
|
-
export interface Query<Doc extends DocumentData = any> {
|
|
33
|
-
collectionName: CollectionName;
|
|
34
|
-
integrationId: string;
|
|
35
|
-
conditions: Conditions<Doc>;
|
|
36
|
-
sortOrder: Array<FieldSort<Doc>>;
|
|
37
|
-
limit: number;
|
|
38
|
-
}
|
|
39
|
-
export type QuerySubscriptionId = `${ClientId}_${ClientRequestId}`;
|
|
40
|
-
export interface QueryRequest {
|
|
41
|
-
clientRequestId: ClientRequestId;
|
|
42
|
-
query: Query;
|
|
43
|
-
subscribe: boolean;
|
|
44
|
-
}
|
|
45
|
-
export interface QueryUnsubscribeRequest {
|
|
46
|
-
clientRequestId: ClientRequestId;
|
|
47
|
-
}
|
|
48
|
-
export interface QueryRegisterRequest {
|
|
49
|
-
clientRequestId: ClientRequestId;
|
|
50
|
-
query: Query;
|
|
51
|
-
parentClientRequestId: ClientRequestId;
|
|
52
|
-
}
|
|
53
|
-
interface QueryMetadata {
|
|
54
|
-
condCount: number;
|
|
55
|
-
}
|
|
56
|
-
export declare function encodeCondition(condition: Condition<any>): EncodedCondition;
|
|
57
|
-
export type EncodedCondition = string;
|
|
58
|
-
export type QueryMapping<QueryReferenceType extends string> = {
|
|
59
|
-
unconditional: Array<QueryReferenceType>;
|
|
60
|
-
conditional: Record<EncodedCondition, Array<QueryReferenceType>>;
|
|
61
|
-
queriesMetadata: Record<QueryReferenceType, QueryMetadata>;
|
|
62
|
-
};
|
|
63
|
-
export declare abstract class QueryMappingManager<T> {
|
|
64
|
-
abstract addQuery(appId: AppId, query: Query, key: T): Promise<void>;
|
|
65
|
-
abstract removeQuery(appId: AppId, key: T): Promise<Query | undefined>;
|
|
66
|
-
abstract removeLocalDevAppData(appId: AppId): Promise<void>;
|
|
67
|
-
}
|
|
68
|
-
export declare function compareOperator(conditionValue: PrimitiveFieldType, valueInDocument: PrimitiveFieldType, operator: Operator): boolean;
|
|
69
|
-
export declare function getQuerySubscriptionId(clientId: string, clientRequestId: string): QuerySubscriptionId;
|
|
70
|
-
export declare function parseQuerySubscriptionId(querySubscriptionId: QuerySubscriptionId): {
|
|
71
|
-
clientId: string;
|
|
72
|
-
clientRequestId: string;
|
|
73
|
-
};
|
|
74
|
-
export {};
|
|
1
|
+
import { TriggerId } from './application.types';
|
|
2
|
+
import { AppId, ClientId, ClientRequestId } from './communication.types';
|
|
3
|
+
import { CollectionName, DocumentData, FieldName, PrimitiveFieldType } from './document.types';
|
|
4
|
+
import { Paths } from './types';
|
|
5
|
+
export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
|
|
6
|
+
export type Conditions<Doc extends DocumentData = any> = Array<Condition<Doc>>;
|
|
7
|
+
export interface SimpleCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>, MyOperator = Operator> {
|
|
8
|
+
fieldName: F;
|
|
9
|
+
operator: MyOperator;
|
|
10
|
+
value: any;
|
|
11
|
+
}
|
|
12
|
+
export interface CompositeCondition<Doc extends DocumentData = any> {
|
|
13
|
+
fields: Array<SimpleCondition<Doc, Paths<Doc>, CompositeConditionOperator>>;
|
|
14
|
+
}
|
|
15
|
+
export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
|
|
16
|
+
type CompositeConditionOperator = '>=' | '<=' | '>' | '<';
|
|
17
|
+
export type Operator = '==' | '!=' | CompositeConditionOperator | 'like' | 'not like' | 'like_cs' | 'not like_cs';
|
|
18
|
+
export interface FieldSort<Doc> {
|
|
19
|
+
fieldName: FieldName<Doc>;
|
|
20
|
+
asc: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface RegularQueryKey {
|
|
23
|
+
queryType: 'query';
|
|
24
|
+
clientId: string;
|
|
25
|
+
clientRequestId: string;
|
|
26
|
+
}
|
|
27
|
+
interface TriggerKey {
|
|
28
|
+
queryType: 'trigger';
|
|
29
|
+
triggerId: TriggerId;
|
|
30
|
+
}
|
|
31
|
+
export type QueryKey = RegularQueryKey | TriggerKey;
|
|
32
|
+
export interface Query<Doc extends DocumentData = any> {
|
|
33
|
+
collectionName: CollectionName;
|
|
34
|
+
integrationId: string;
|
|
35
|
+
conditions: Conditions<Doc>;
|
|
36
|
+
sortOrder: Array<FieldSort<Doc>>;
|
|
37
|
+
limit: number;
|
|
38
|
+
}
|
|
39
|
+
export type QuerySubscriptionId = `${ClientId}_${ClientRequestId}`;
|
|
40
|
+
export interface QueryRequest {
|
|
41
|
+
clientRequestId: ClientRequestId;
|
|
42
|
+
query: Query;
|
|
43
|
+
subscribe: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface QueryUnsubscribeRequest {
|
|
46
|
+
clientRequestId: ClientRequestId;
|
|
47
|
+
}
|
|
48
|
+
export interface QueryRegisterRequest {
|
|
49
|
+
clientRequestId: ClientRequestId;
|
|
50
|
+
query: Query;
|
|
51
|
+
parentClientRequestId: ClientRequestId;
|
|
52
|
+
}
|
|
53
|
+
interface QueryMetadata {
|
|
54
|
+
condCount: number;
|
|
55
|
+
}
|
|
56
|
+
export declare function encodeCondition(condition: Condition<any>): EncodedCondition;
|
|
57
|
+
export type EncodedCondition = string;
|
|
58
|
+
export type QueryMapping<QueryReferenceType extends string> = {
|
|
59
|
+
unconditional: Array<QueryReferenceType>;
|
|
60
|
+
conditional: Record<EncodedCondition, Array<QueryReferenceType>>;
|
|
61
|
+
queriesMetadata: Record<QueryReferenceType, QueryMetadata>;
|
|
62
|
+
};
|
|
63
|
+
export declare abstract class QueryMappingManager<T> {
|
|
64
|
+
abstract addQuery(appId: AppId, query: Query, key: T): Promise<void>;
|
|
65
|
+
abstract removeQuery(appId: AppId, key: T): Promise<Query | undefined>;
|
|
66
|
+
abstract removeLocalDevAppData(appId: AppId): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
export declare function compareOperator(conditionValue: PrimitiveFieldType, valueInDocument: PrimitiveFieldType, operator: Operator): boolean;
|
|
69
|
+
export declare function getQuerySubscriptionId(clientId: string, clientRequestId: string): QuerySubscriptionId;
|
|
70
|
+
export declare function parseQuerySubscriptionId(querySubscriptionId: QuerySubscriptionId): {
|
|
71
|
+
clientId: string;
|
|
72
|
+
clientRequestId: string;
|
|
73
|
+
};
|
|
74
|
+
export {};
|
|
@@ -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 {};
|