@squidcloud/client 1.0.34 → 1.0.35
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/api-call.context.d.ts +12 -12
- package/dist/common/src/api.types.d.ts +23 -23
- package/dist/common/src/application.schemas.d.ts +883 -883
- package/dist/common/src/application.types.d.ts +205 -205
- package/dist/common/src/backend-function.schemas.d.ts +3 -3
- package/dist/common/src/backend-function.types.d.ts +7 -7
- package/dist/common/src/backend-run.types.d.ts +66 -66
- package/dist/common/src/bundle-api.types.d.ts +64 -64
- package/dist/common/src/bundle-data.types.d.ts +46 -46
- package/dist/common/src/communication.types.d.ts +4 -4
- package/dist/common/src/context.types.d.ts +31 -31
- package/dist/common/src/document.types.d.ts +35 -35
- package/dist/common/src/graphql.context.d.ts +6 -6
- package/dist/common/src/graphql.types.d.ts +16 -16
- package/dist/common/src/http-status.enum.d.ts +50 -50
- package/dist/common/src/index.d.ts +49 -49
- package/dist/common/src/integration.types.d.ts +316 -319
- package/dist/common/src/logger.types.d.ts +21 -21
- package/dist/common/src/metrics.types.d.ts +58 -58
- package/dist/common/src/mutation.context.d.ts +10 -10
- package/dist/common/src/mutation.schemas.d.ts +5 -5
- package/dist/common/src/mutation.types.d.ts +72 -72
- package/dist/common/src/named-query.context.d.ts +4 -4
- package/dist/common/src/named-query.schemas.d.ts +3 -3
- package/dist/common/src/named-query.types.d.ts +9 -9
- package/dist/common/src/query/index.d.ts +2 -2
- package/dist/common/src/query/query-context.d.ts +37 -37
- package/dist/common/src/query/simple-query-builder.d.ts +90 -90
- package/dist/common/src/query.schemas.d.ts +5 -5
- package/dist/common/src/query.types.d.ts +118 -118
- package/dist/common/src/regions.d.ts +22 -22
- package/dist/common/src/schema/schema.types.d.ts +54 -54
- package/dist/common/src/secret.schemas.d.ts +6 -6
- package/dist/common/src/secret.types.d.ts +40 -40
- package/dist/common/src/security.types.d.ts +3 -3
- package/dist/common/src/socket.schemas.d.ts +3 -3
- package/dist/common/src/socket.types.d.ts +68 -68
- package/dist/common/src/time-units.d.ts +5 -5
- package/dist/common/src/trigger.types.d.ts +15 -15
- package/dist/common/src/types.d.ts +15 -15
- package/dist/common/src/utils/array.d.ts +8 -8
- package/dist/common/src/utils/assert.d.ts +8 -8
- package/dist/common/src/utils/error.d.ts +4 -4
- package/dist/common/src/utils/http.d.ts +2 -2
- package/dist/common/src/utils/id.d.ts +2 -2
- package/dist/common/src/utils/lock.manager.d.ts +14 -14
- package/dist/common/src/utils/nullish.d.ts +1 -1
- package/dist/common/src/utils/object.d.ts +6 -6
- package/dist/common/src/utils/serialization.d.ts +6 -6
- package/dist/common/src/utils/transforms.d.ts +18 -18
- package/dist/common/src/utils/validation.d.ts +30 -30
- package/dist/common/src/webhook-response.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
- package/dist/typescript-client/src/api.manager.d.ts +14 -14
- package/dist/typescript-client/src/backend-function.manager.d.ts +13 -13
- package/dist/typescript-client/src/collection-reference.d.ts +53 -53
- package/dist/typescript-client/src/collection-reference.factory.d.ts +16 -16
- package/dist/typescript-client/src/data.manager.d.ts +166 -166
- package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
- package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
- package/dist/typescript-client/src/document-reference.d.ts +100 -100
- package/dist/typescript-client/src/document-reference.factory.d.ts +9 -9
- package/dist/typescript-client/src/document-store.d.ts +11 -11
- package/dist/typescript-client/src/graphql-client.d.ts +12 -12
- package/dist/typescript-client/src/graphql-client.factory.d.ts +9 -9
- package/dist/typescript-client/src/index.d.ts +7 -7
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +11 -11
- package/dist/typescript-client/src/mutation/mutation.spec.d.ts +1 -1
- package/dist/typescript-client/src/named-query.manager.d.ts +13 -13
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +71 -71
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +67 -60
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +59 -59
- package/dist/typescript-client/src/query/query-subscription.manager.spec.d.ts +1 -1
- package/dist/typescript-client/src/query/query.spec.d.ts +1 -1
- package/dist/typescript-client/src/query/query.types.d.ts +14 -14
- package/dist/typescript-client/src/rpc.manager.d.ts +30 -30
- package/dist/typescript-client/src/socket.manager.d.ts +27 -27
- package/dist/typescript-client/src/squid.d.ts +173 -173
- package/dist/typescript-client/src/state/action.applier.d.ts +7 -7
- package/dist/typescript-client/src/state/actions.d.ts +29 -29
- package/dist/typescript-client/src/state/path_trie.d.ts +27 -27
- package/dist/typescript-client/src/state/state.service.d.ts +22 -22
- package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
- package/dist/typescript-client/src/testing/fake-rpc.manager.d.ts +20 -20
- package/dist/typescript-client/src/testing/fake-socket.manager.d.ts +9 -9
- package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -1
- package/dist/typescript-client/src/testing/squid-env-setup.d.ts +79 -79
- package/dist/typescript-client/src/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JSONSchemaType } from 'ajv';
|
|
2
|
-
import { Query, QueryRequest, QueryUnsubscribeRequest } from './query.types';
|
|
3
|
-
export declare const QuerySchema: JSONSchemaType<Query>;
|
|
4
|
-
export declare const QueryRequestSchema: JSONSchemaType<QueryRequest>;
|
|
5
|
-
export declare const QueryUnsubscribeRequestSchema: JSONSchemaType<QueryUnsubscribeRequest>;
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { Query, QueryRequest, QueryUnsubscribeRequest } from './query.types';
|
|
3
|
+
export declare const QuerySchema: JSONSchemaType<Query>;
|
|
4
|
+
export declare const QueryRequestSchema: JSONSchemaType<QueryRequest>;
|
|
5
|
+
export declare const QueryUnsubscribeRequestSchema: JSONSchemaType<QueryUnsubscribeRequest>;
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import { TriggerId } from './application.types';
|
|
2
|
-
import { AppId, ClientId, ClientRequestId, IntegrationId } from './communication.types';
|
|
3
|
-
import { CollectionName, FieldName, PrimitiveFieldType, SquidDocument } from './document.types';
|
|
4
|
-
export type Conditions<Doc = any, F extends FieldName<Doc> = any> = Array<Condition<Doc, F>>;
|
|
5
|
-
export interface Condition<Doc = any, F extends FieldName<Doc> = any> {
|
|
6
|
-
fieldName: F;
|
|
7
|
-
operator: Operator;
|
|
8
|
-
value: Doc[F] | null;
|
|
9
|
-
}
|
|
10
|
-
export type Operator = '==' | '>=' | '<=' | '>' | '<' | '!=';
|
|
11
|
-
export type ContextConditions<Doc = any, F extends FieldName<Doc> = any> = Array<ContextCondition<Doc, F>>;
|
|
12
|
-
export type GenericValue<Doc = any, F extends FieldName<Doc> = any, O extends AllOperators = any> = O extends 'in' ? Array<Doc[F]> | null : O extends 'not in' ? Array<Doc[F]> | null : Doc[F] | null;
|
|
13
|
-
export type ContextCondition<Doc = any, F extends FieldName<Doc> = any> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
14
|
-
interface InContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
15
|
-
operator: 'in';
|
|
16
|
-
value: Array<Doc[F]>;
|
|
17
|
-
}
|
|
18
|
-
interface NotInContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
19
|
-
operator: 'not in';
|
|
20
|
-
value: Array<Doc[F]>;
|
|
21
|
-
}
|
|
22
|
-
interface OtherContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator'> {
|
|
23
|
-
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
24
|
-
}
|
|
25
|
-
export interface GeneralCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
26
|
-
operator: AllOperators;
|
|
27
|
-
value: any;
|
|
28
|
-
}
|
|
29
|
-
export type GeneralConditions<Doc = any, F extends FieldName<Doc> = any> = Array<GeneralCondition<Doc, F>>;
|
|
30
|
-
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
31
|
-
export type AllOperators = Operator | 'in' | 'not in';
|
|
32
|
-
export interface FieldSort<Doc> {
|
|
33
|
-
fieldName: FieldName<Doc>;
|
|
34
|
-
asc: boolean;
|
|
35
|
-
}
|
|
36
|
-
interface RegularQueryKey {
|
|
37
|
-
queryType: 'query';
|
|
38
|
-
clientId: string;
|
|
39
|
-
clientRequestId: string;
|
|
40
|
-
}
|
|
41
|
-
interface TriggerKey {
|
|
42
|
-
queryType: 'trigger';
|
|
43
|
-
triggerId: TriggerId;
|
|
44
|
-
}
|
|
45
|
-
export type QueryKey = RegularQueryKey | TriggerKey;
|
|
46
|
-
export interface Query<Doc = any> {
|
|
47
|
-
collectionName: CollectionName;
|
|
48
|
-
integrationId: string;
|
|
49
|
-
conditions: Conditions<Doc>;
|
|
50
|
-
sortOrder: Array<FieldSort<Doc>>;
|
|
51
|
-
limit: number;
|
|
52
|
-
}
|
|
53
|
-
export type QuerySubscriptionId = `${ClientId}_${ClientRequestId}`;
|
|
54
|
-
export interface QueryRequest {
|
|
55
|
-
clientId: ClientId;
|
|
56
|
-
clientRequestId: ClientRequestId;
|
|
57
|
-
query: Query;
|
|
58
|
-
subscribe: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface QueryUnsubscribeRequest {
|
|
61
|
-
clientId: ClientId;
|
|
62
|
-
clientRequestId: ClientRequestId;
|
|
63
|
-
}
|
|
64
|
-
interface QueryMetadata {
|
|
65
|
-
condCount: number;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Example query mapping:
|
|
69
|
-
* {
|
|
70
|
-
* unconditional: ['cid_123'],
|
|
71
|
-
* conditional: {
|
|
72
|
-
* age: {
|
|
73
|
-
* '==': {
|
|
74
|
-
* 10: ['cid2_321'],
|
|
75
|
-
* 11: ['cid2_321'],
|
|
76
|
-
* 12: ['cid2_321'],
|
|
77
|
-
* },
|
|
78
|
-
* '>': {
|
|
79
|
-
* 20: ['cid_456']
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
* },
|
|
83
|
-
* queriesMetadata: {
|
|
84
|
-
* 'cid_123': {
|
|
85
|
-
* condCount: 0
|
|
86
|
-
* },
|
|
87
|
-
* 'cid2_321': {
|
|
88
|
-
* condCount: 1
|
|
89
|
-
* },
|
|
90
|
-
* 'cid2_456': {
|
|
91
|
-
* condCount: 1
|
|
92
|
-
* }
|
|
93
|
-
* }
|
|
94
|
-
* }
|
|
95
|
-
*/
|
|
96
|
-
export type QueryMapping<T extends string> = {
|
|
97
|
-
unconditional: Array<T>;
|
|
98
|
-
conditional: Record<FieldName, Record<Operator, Record<PrimitiveFieldType & string, Array<T>>>>;
|
|
99
|
-
queriesMetadata: Record<T, QueryMetadata>;
|
|
100
|
-
};
|
|
101
|
-
export declare abstract class QueryMappingManager<T> {
|
|
102
|
-
abstract addQuery(appId: AppId, query: Query, key: T): Promise<void>;
|
|
103
|
-
abstract removeQuery(appId: AppId, key: T): Promise<Query | undefined>;
|
|
104
|
-
abstract findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T> | undefined>;
|
|
105
|
-
}
|
|
106
|
-
export declare abstract class SimpleQueryMappingManager<T extends string> extends QueryMappingManager<T> {
|
|
107
|
-
abstract getMapping(appId: AppId, collectionName: CollectionName, integrationId: IntegrationId): Promise<QueryMapping<T> | undefined> | (QueryMapping<T> | undefined);
|
|
108
|
-
findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T>>;
|
|
109
|
-
}
|
|
110
|
-
export declare function findQueriesForDocumentSync<T extends string>(mapping: QueryMapping<T>, doc: SquidDocument): Array<T>;
|
|
111
|
-
export declare function compareOperator(conditionValue: PrimitiveFieldType, valueInDocument: PrimitiveFieldType, operator: Operator): boolean;
|
|
112
|
-
/** Returns a unique identifier for the query which includes both the client id and the client request id. */
|
|
113
|
-
export declare function getQuerySubscriptionId(clientId: string, clientRequestId: string): QuerySubscriptionId;
|
|
114
|
-
export declare function parseQuerySubscriptionId(querySubscriptionId: QuerySubscriptionId): {
|
|
115
|
-
clientId: string;
|
|
116
|
-
clientRequestId: string;
|
|
117
|
-
};
|
|
118
|
-
export {};
|
|
1
|
+
import { TriggerId } from './application.types';
|
|
2
|
+
import { AppId, ClientId, ClientRequestId, IntegrationId } from './communication.types';
|
|
3
|
+
import { CollectionName, FieldName, PrimitiveFieldType, SquidDocument } from './document.types';
|
|
4
|
+
export type Conditions<Doc = any, F extends FieldName<Doc> = any> = Array<Condition<Doc, F>>;
|
|
5
|
+
export interface Condition<Doc = any, F extends FieldName<Doc> = any> {
|
|
6
|
+
fieldName: F;
|
|
7
|
+
operator: Operator;
|
|
8
|
+
value: Doc[F] | null;
|
|
9
|
+
}
|
|
10
|
+
export type Operator = '==' | '>=' | '<=' | '>' | '<' | '!=';
|
|
11
|
+
export type ContextConditions<Doc = any, F extends FieldName<Doc> = any> = Array<ContextCondition<Doc, F>>;
|
|
12
|
+
export type GenericValue<Doc = any, F extends FieldName<Doc> = any, O extends AllOperators = any> = O extends 'in' ? Array<Doc[F]> | null : O extends 'not in' ? Array<Doc[F]> | null : Doc[F] | null;
|
|
13
|
+
export type ContextCondition<Doc = any, F extends FieldName<Doc> = any> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
14
|
+
interface InContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
15
|
+
operator: 'in';
|
|
16
|
+
value: Array<Doc[F]>;
|
|
17
|
+
}
|
|
18
|
+
interface NotInContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
19
|
+
operator: 'not in';
|
|
20
|
+
value: Array<Doc[F]>;
|
|
21
|
+
}
|
|
22
|
+
interface OtherContextCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator'> {
|
|
23
|
+
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
24
|
+
}
|
|
25
|
+
export interface GeneralCondition<Doc = any, F extends FieldName<Doc> = any> extends Omit<Condition<Doc, F>, 'operator' | 'value'> {
|
|
26
|
+
operator: AllOperators;
|
|
27
|
+
value: any;
|
|
28
|
+
}
|
|
29
|
+
export type GeneralConditions<Doc = any, F extends FieldName<Doc> = any> = Array<GeneralCondition<Doc, F>>;
|
|
30
|
+
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
31
|
+
export type AllOperators = Operator | 'in' | 'not in';
|
|
32
|
+
export interface FieldSort<Doc> {
|
|
33
|
+
fieldName: FieldName<Doc>;
|
|
34
|
+
asc: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface RegularQueryKey {
|
|
37
|
+
queryType: 'query';
|
|
38
|
+
clientId: string;
|
|
39
|
+
clientRequestId: string;
|
|
40
|
+
}
|
|
41
|
+
interface TriggerKey {
|
|
42
|
+
queryType: 'trigger';
|
|
43
|
+
triggerId: TriggerId;
|
|
44
|
+
}
|
|
45
|
+
export type QueryKey = RegularQueryKey | TriggerKey;
|
|
46
|
+
export interface Query<Doc = any> {
|
|
47
|
+
collectionName: CollectionName;
|
|
48
|
+
integrationId: string;
|
|
49
|
+
conditions: Conditions<Doc>;
|
|
50
|
+
sortOrder: Array<FieldSort<Doc>>;
|
|
51
|
+
limit: number;
|
|
52
|
+
}
|
|
53
|
+
export type QuerySubscriptionId = `${ClientId}_${ClientRequestId}`;
|
|
54
|
+
export interface QueryRequest {
|
|
55
|
+
clientId: ClientId;
|
|
56
|
+
clientRequestId: ClientRequestId;
|
|
57
|
+
query: Query;
|
|
58
|
+
subscribe: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface QueryUnsubscribeRequest {
|
|
61
|
+
clientId: ClientId;
|
|
62
|
+
clientRequestId: ClientRequestId;
|
|
63
|
+
}
|
|
64
|
+
interface QueryMetadata {
|
|
65
|
+
condCount: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Example query mapping:
|
|
69
|
+
* {
|
|
70
|
+
* unconditional: ['cid_123'],
|
|
71
|
+
* conditional: {
|
|
72
|
+
* age: {
|
|
73
|
+
* '==': {
|
|
74
|
+
* 10: ['cid2_321'],
|
|
75
|
+
* 11: ['cid2_321'],
|
|
76
|
+
* 12: ['cid2_321'],
|
|
77
|
+
* },
|
|
78
|
+
* '>': {
|
|
79
|
+
* 20: ['cid_456']
|
|
80
|
+
* }
|
|
81
|
+
* }
|
|
82
|
+
* },
|
|
83
|
+
* queriesMetadata: {
|
|
84
|
+
* 'cid_123': {
|
|
85
|
+
* condCount: 0
|
|
86
|
+
* },
|
|
87
|
+
* 'cid2_321': {
|
|
88
|
+
* condCount: 1
|
|
89
|
+
* },
|
|
90
|
+
* 'cid2_456': {
|
|
91
|
+
* condCount: 1
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
* }
|
|
95
|
+
*/
|
|
96
|
+
export type QueryMapping<T extends string> = {
|
|
97
|
+
unconditional: Array<T>;
|
|
98
|
+
conditional: Record<FieldName, Record<Operator, Record<PrimitiveFieldType & string, Array<T>>>>;
|
|
99
|
+
queriesMetadata: Record<T, QueryMetadata>;
|
|
100
|
+
};
|
|
101
|
+
export declare abstract class QueryMappingManager<T> {
|
|
102
|
+
abstract addQuery(appId: AppId, query: Query, key: T): Promise<void>;
|
|
103
|
+
abstract removeQuery(appId: AppId, key: T): Promise<Query | undefined>;
|
|
104
|
+
abstract findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T> | undefined>;
|
|
105
|
+
}
|
|
106
|
+
export declare abstract class SimpleQueryMappingManager<T extends string> extends QueryMappingManager<T> {
|
|
107
|
+
abstract getMapping(appId: AppId, collectionName: CollectionName, integrationId: IntegrationId): Promise<QueryMapping<T> | undefined> | (QueryMapping<T> | undefined);
|
|
108
|
+
findQueriesForDocument(appId: AppId, doc: SquidDocument, collectionName: CollectionName, integrationId: IntegrationId): Promise<Array<T>>;
|
|
109
|
+
}
|
|
110
|
+
export declare function findQueriesForDocumentSync<T extends string>(mapping: QueryMapping<T>, doc: SquidDocument): Array<T>;
|
|
111
|
+
export declare function compareOperator(conditionValue: PrimitiveFieldType, valueInDocument: PrimitiveFieldType, operator: Operator): boolean;
|
|
112
|
+
/** Returns a unique identifier for the query which includes both the client id and the client request id. */
|
|
113
|
+
export declare function getQuerySubscriptionId(clientId: string, clientRequestId: string): QuerySubscriptionId;
|
|
114
|
+
export declare function parseQuerySubscriptionId(querySubscriptionId: QuerySubscriptionId): {
|
|
115
|
+
clientId: string;
|
|
116
|
+
clientRequestId: string;
|
|
117
|
+
};
|
|
118
|
+
export {};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export type SquidCloudId = 'aws' | 'gcp' | 'azure';
|
|
2
|
-
/** The list of supported Squid regions. */
|
|
3
|
-
export type SupportedSquidRegion = 'us-east-1.aws' | 'local';
|
|
4
|
-
export declare const supportedSquidRegions: Array<SupportedSquidRegion>;
|
|
5
|
-
export interface SquidCloudRegion {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
export interface SquidSupportedCloud {
|
|
10
|
-
id: SquidCloudId;
|
|
11
|
-
name: string;
|
|
12
|
-
icon: string;
|
|
13
|
-
regions: Array<SquidCloudRegion>;
|
|
14
|
-
tooltip?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const squidSupportedRegionMap: Record<SupportedSquidRegion, SquidCloudRegion>;
|
|
17
|
-
export declare function getSquidSupportedCloudMap(isLocal?: boolean): Record<SquidCloudId, SquidSupportedCloud>;
|
|
18
|
-
export declare function convertToSquidRegion(cloudId: SquidCloudId, region: string): SupportedSquidRegion;
|
|
19
|
-
export declare function convertFromSquidRegion(regionAndCloud: SupportedSquidRegion): {
|
|
20
|
-
cloudId: SquidCloudId;
|
|
21
|
-
region: string;
|
|
22
|
-
};
|
|
1
|
+
export type SquidCloudId = 'aws' | 'gcp' | 'azure';
|
|
2
|
+
/** The list of supported Squid regions. */
|
|
3
|
+
export type SupportedSquidRegion = 'us-east-1.aws' | 'local';
|
|
4
|
+
export declare const supportedSquidRegions: Array<SupportedSquidRegion>;
|
|
5
|
+
export interface SquidCloudRegion {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SquidSupportedCloud {
|
|
10
|
+
id: SquidCloudId;
|
|
11
|
+
name: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
regions: Array<SquidCloudRegion>;
|
|
14
|
+
tooltip?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const squidSupportedRegionMap: Record<SupportedSquidRegion, SquidCloudRegion>;
|
|
17
|
+
export declare function getSquidSupportedCloudMap(isLocal?: boolean): Record<SquidCloudId, SquidSupportedCloud>;
|
|
18
|
+
export declare function convertToSquidRegion(cloudId: SquidCloudId, region: string): SupportedSquidRegion;
|
|
19
|
+
export declare function convertFromSquidRegion(regionAndCloud: SupportedSquidRegion): {
|
|
20
|
+
cloudId: SquidCloudId;
|
|
21
|
+
region: string;
|
|
22
|
+
};
|
|
@@ -1,54 +1,54 @@
|
|
|
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';
|
|
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
|
-
/**
|
|
12
|
-
* The default value will be applied (default to 'empty'):
|
|
13
|
-
* 'always' - no matter what the client sent, both on update and insert. In case of readOnly - applies only on insert.
|
|
14
|
-
* 'empty' - only if the value of the filed is empty (undefined)
|
|
15
|
-
* 'updateOrEmpty' - no matter what the client sent, updating the record will use the default value
|
|
16
|
-
*/
|
|
17
|
-
applyDefaultValueOn?: 'always' | 'empty' | 'updateOrEmpty';
|
|
18
|
-
isDate?: boolean;
|
|
19
|
-
isJSON?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Applies to the top level schema, a record in a nested object, or a regular property.
|
|
22
|
-
* Basically, whether this property can participate in an insert mutation.
|
|
23
|
-
*/
|
|
24
|
-
insertable?: boolean;
|
|
25
|
-
/** Applies to the top level schema or a record in a nested object. */
|
|
26
|
-
deletable?: boolean;
|
|
27
|
-
};
|
|
28
|
-
export type PropertySchema = ConvertDeep<JSONSchema>;
|
|
29
|
-
export type TopLevelPropertySchema = PropertySchema & {
|
|
30
|
-
primaryKey?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the property is computed based on other properties or some formula.
|
|
33
|
-
* If true, readonly also needs to be true and this field should not be part of an insert statement.
|
|
34
|
-
*/
|
|
35
|
-
isComputed?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the default value generated by the database. CURRENT_DATE is something generated by the database vs
|
|
38
|
-
* 'Hello' which is a constant.
|
|
39
|
-
*/
|
|
40
|
-
isDefaultComputed?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The database data type that is represented by this property. This is often different from the actual property
|
|
43
|
-
* type, with is a Javascript primitive. For example, for a SMALLINT the dataType would be 'smallint', but the type
|
|
44
|
-
* would be 'integer'.
|
|
45
|
-
*/
|
|
46
|
-
dataType?: string;
|
|
47
|
-
};
|
|
48
|
-
export type CollectionSchema = ConvertDeep<JSONSchema> & {
|
|
49
|
-
properties?: Record<string, TopLevelPropertySchema>;
|
|
50
|
-
};
|
|
51
|
-
export declare function compileSchema<S extends CollectionSchema>(schema: S): any;
|
|
52
|
-
export declare function validateSchema<S extends CollectionSchema>(schema: S, data: any, updatedPaths?: Array<string>, dataBefore?: any): void;
|
|
53
|
-
export declare function findMatchingPropertiesForKey<S extends CollectionSchema | PropertySchema>(schema: S, key: string): Array<PropertySchema>;
|
|
54
|
-
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';
|
|
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
|
+
/**
|
|
12
|
+
* The default value will be applied (default to 'empty'):
|
|
13
|
+
* 'always' - no matter what the client sent, both on update and insert. In case of readOnly - applies only on insert.
|
|
14
|
+
* 'empty' - only if the value of the filed is empty (undefined)
|
|
15
|
+
* 'updateOrEmpty' - no matter what the client sent, updating the record will use the default value
|
|
16
|
+
*/
|
|
17
|
+
applyDefaultValueOn?: 'always' | 'empty' | 'updateOrEmpty';
|
|
18
|
+
isDate?: boolean;
|
|
19
|
+
isJSON?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Applies to the top level schema, a record in a nested object, or a regular property.
|
|
22
|
+
* Basically, whether this property can participate in an insert mutation.
|
|
23
|
+
*/
|
|
24
|
+
insertable?: boolean;
|
|
25
|
+
/** Applies to the top level schema or a record in a nested object. */
|
|
26
|
+
deletable?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type PropertySchema = ConvertDeep<JSONSchema>;
|
|
29
|
+
export type TopLevelPropertySchema = PropertySchema & {
|
|
30
|
+
primaryKey?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the property is computed based on other properties or some formula.
|
|
33
|
+
* If true, readonly also needs to be true and this field should not be part of an insert statement.
|
|
34
|
+
*/
|
|
35
|
+
isComputed?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the default value generated by the database. CURRENT_DATE is something generated by the database vs
|
|
38
|
+
* 'Hello' which is a constant.
|
|
39
|
+
*/
|
|
40
|
+
isDefaultComputed?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The database data type that is represented by this property. This is often different from the actual property
|
|
43
|
+
* type, with is a Javascript primitive. For example, for a SMALLINT the dataType would be 'smallint', but the type
|
|
44
|
+
* would be 'integer'.
|
|
45
|
+
*/
|
|
46
|
+
dataType?: string;
|
|
47
|
+
};
|
|
48
|
+
export type CollectionSchema = Omit<ConvertDeep<JSONSchema>, 'properties'> & {
|
|
49
|
+
properties?: Record<string, TopLevelPropertySchema>;
|
|
50
|
+
};
|
|
51
|
+
export declare function compileSchema<S extends CollectionSchema>(schema: S): any;
|
|
52
|
+
export declare function validateSchema<S extends CollectionSchema>(schema: S, data: any, updatedPaths?: Array<string>, dataBefore?: any): void;
|
|
53
|
+
export declare function findMatchingPropertiesForKey<S extends CollectionSchema | PropertySchema>(schema: S, key: string): Array<PropertySchema>;
|
|
54
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { JSONSchemaType } from 'ajv';
|
|
2
|
-
import { DeleteApiKeyRequest, DeleteCustomSecretRequest, GenerateNewApiKeyRequest, SetCustomSecretRequest } from './secret.types';
|
|
3
|
-
export declare const SetCustomSecretRequestSchema: JSONSchemaType<SetCustomSecretRequest>;
|
|
4
|
-
export declare const DeleteCustomSecretRequestSchema: JSONSchemaType<DeleteCustomSecretRequest>;
|
|
5
|
-
export declare const DeleteApiKeyRequestSchema: JSONSchemaType<DeleteApiKeyRequest>;
|
|
6
|
-
export declare const GenerateNewApiKeyRequestSchema: JSONSchemaType<GenerateNewApiKeyRequest>;
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { DeleteApiKeyRequest, DeleteCustomSecretRequest, GenerateNewApiKeyRequest, SetCustomSecretRequest } from './secret.types';
|
|
3
|
+
export declare const SetCustomSecretRequestSchema: JSONSchemaType<SetCustomSecretRequest>;
|
|
4
|
+
export declare const DeleteCustomSecretRequestSchema: JSONSchemaType<DeleteCustomSecretRequest>;
|
|
5
|
+
export declare const DeleteApiKeyRequestSchema: JSONSchemaType<DeleteApiKeyRequest>;
|
|
6
|
+
export declare const GenerateNewApiKeyRequestSchema: JSONSchemaType<GenerateNewApiKeyRequest>;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/** The secret key, an alias for a string. */
|
|
2
|
-
export type SecretKey = string;
|
|
3
|
-
/** The secret value. */
|
|
4
|
-
export type SecretValue = string | number | boolean;
|
|
5
|
-
export type SecretTimestamp = number;
|
|
6
|
-
export type ApiKeyName = string;
|
|
7
|
-
export type ApiKey = string;
|
|
8
|
-
export interface ApplicationSecrets {
|
|
9
|
-
custom: Record<SecretKey, SecretEntry>;
|
|
10
|
-
apiKeys: Record<SecretKey, SecretEntry>;
|
|
11
|
-
}
|
|
12
|
-
export interface SystemSecrets {
|
|
13
|
-
sharedMongo: Record<SecretKey, SecretValue>;
|
|
14
|
-
}
|
|
15
|
-
export interface SecretMetadata {
|
|
16
|
-
key: SecretKey;
|
|
17
|
-
lastUpdated: SecretTimestamp;
|
|
18
|
-
}
|
|
19
|
-
export interface SecretEntry extends SecretMetadata {
|
|
20
|
-
value: SecretValue;
|
|
21
|
-
}
|
|
22
|
-
export type SetCustomSecretRequest = Omit<SecretEntry, 'lastUpdated'>;
|
|
23
|
-
export interface DeleteCustomSecretRequest {
|
|
24
|
-
key: SecretKey;
|
|
25
|
-
}
|
|
26
|
-
export interface GetApiKeyRequest {
|
|
27
|
-
apiKeyName: ApiKeyName;
|
|
28
|
-
}
|
|
29
|
-
export interface GetApiKeyResponse {
|
|
30
|
-
apiKey: string | undefined;
|
|
31
|
-
}
|
|
32
|
-
export type DeleteApiKeyRequest = Pick<SecretMetadata, 'key'>;
|
|
33
|
-
export interface ListApplicationSecretMetadataResponse {
|
|
34
|
-
custom: SecretMetadata[];
|
|
35
|
-
apiKeys: SecretMetadata[];
|
|
36
|
-
}
|
|
37
|
-
export type GenerateNewApiKeyRequest = Pick<SecretMetadata, 'key'>;
|
|
38
|
-
export interface GenerateNewApiKeyResponse {
|
|
39
|
-
apiKey: string;
|
|
40
|
-
}
|
|
1
|
+
/** The secret key, an alias for a string. */
|
|
2
|
+
export type SecretKey = string;
|
|
3
|
+
/** The secret value. */
|
|
4
|
+
export type SecretValue = string | number | boolean;
|
|
5
|
+
export type SecretTimestamp = number;
|
|
6
|
+
export type ApiKeyName = string;
|
|
7
|
+
export type ApiKey = string;
|
|
8
|
+
export interface ApplicationSecrets {
|
|
9
|
+
custom: Record<SecretKey, SecretEntry>;
|
|
10
|
+
apiKeys: Record<SecretKey, SecretEntry>;
|
|
11
|
+
}
|
|
12
|
+
export interface SystemSecrets {
|
|
13
|
+
sharedMongo: Record<SecretKey, SecretValue>;
|
|
14
|
+
}
|
|
15
|
+
export interface SecretMetadata {
|
|
16
|
+
key: SecretKey;
|
|
17
|
+
lastUpdated: SecretTimestamp;
|
|
18
|
+
}
|
|
19
|
+
export interface SecretEntry extends SecretMetadata {
|
|
20
|
+
value: SecretValue;
|
|
21
|
+
}
|
|
22
|
+
export type SetCustomSecretRequest = Omit<SecretEntry, 'lastUpdated'>;
|
|
23
|
+
export interface DeleteCustomSecretRequest {
|
|
24
|
+
key: SecretKey;
|
|
25
|
+
}
|
|
26
|
+
export interface GetApiKeyRequest {
|
|
27
|
+
apiKeyName: ApiKeyName;
|
|
28
|
+
}
|
|
29
|
+
export interface GetApiKeyResponse {
|
|
30
|
+
apiKey: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
export type DeleteApiKeyRequest = Pick<SecretMetadata, 'key'>;
|
|
33
|
+
export interface ListApplicationSecretMetadataResponse {
|
|
34
|
+
custom: SecretMetadata[];
|
|
35
|
+
apiKeys: SecretMetadata[];
|
|
36
|
+
}
|
|
37
|
+
export type GenerateNewApiKeyRequest = Pick<SecretMetadata, 'key'>;
|
|
38
|
+
export interface GenerateNewApiKeyResponse {
|
|
39
|
+
apiKey: string;
|
|
40
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface SecureNamedQueryRequest {
|
|
2
|
-
params: Record<string, any>;
|
|
3
|
-
}
|
|
1
|
+
export interface SecureNamedQueryRequest {
|
|
2
|
+
params: Record<string, any>;
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { JSONSchemaType } from 'ajv';
|
|
2
|
-
import { MessageFromClient } from './socket.types';
|
|
3
|
-
export declare const MessageFromClientSchema: JSONSchemaType<MessageFromClient>;
|
|
1
|
+
import { JSONSchemaType } from 'ajv';
|
|
2
|
+
import { MessageFromClient } from './socket.types';
|
|
3
|
+
export declare const MessageFromClientSchema: JSONSchemaType<MessageFromClient>;
|