@squidcloud/backend 1.0.0
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/backend/src/actions.d.ts +13 -0
- package/dist/backend/src/index.d.ts +3 -0
- package/dist/backend/src/metadata.d.ts +234 -0
- package/dist/backend/src/project.d.ts +4 -0
- package/dist/backend/src/service.d.ts +10 -0
- package/dist/common/src/api.types.d.ts +10 -0
- package/dist/common/src/application.schemas.d.ts +608 -0
- package/dist/common/src/application.types.d.ts +120 -0
- package/dist/common/src/backend-function.schemas.d.ts +3 -0
- package/dist/common/src/backend-function.types.d.ts +7 -0
- package/dist/common/src/bundle-api.types.d.ts +86 -0
- package/dist/common/src/bundle-data.types.d.ts +45 -0
- package/dist/common/src/communication.types.d.ts +4 -0
- package/dist/common/src/context.types.d.ts +22 -0
- package/dist/common/src/document.types.d.ts +29 -0
- package/dist/common/src/graphql.types.d.ts +8 -0
- package/dist/common/src/http-status.enum.d.ts +50 -0
- package/dist/common/src/index.d.ts +40 -0
- package/dist/common/src/integration.types.d.ts +247 -0
- package/dist/common/src/logger.types.d.ts +22 -0
- package/dist/common/src/metrics.schemas.d.ts +3 -0
- package/dist/common/src/metrics.types.d.ts +52 -0
- package/dist/common/src/mutation.context.d.ts +14 -0
- package/dist/common/src/mutation.schemas.d.ts +5 -0
- package/dist/common/src/mutation.types.d.ts +66 -0
- package/dist/common/src/named-query.schemas.d.ts +3 -0
- package/dist/common/src/named-query.types.d.ts +9 -0
- package/dist/common/src/query/index.d.ts +2 -0
- package/dist/common/src/query/query-context.d.ts +41 -0
- package/dist/common/src/query/simple-query-builder.d.ts +14 -0
- package/dist/common/src/query.schemas.d.ts +5 -0
- package/dist/common/src/query.types.d.ts +118 -0
- package/dist/common/src/schema/schema.types.d.ts +34 -0
- package/dist/common/src/secret.schemas.d.ts +6 -0
- package/dist/common/src/secret.types.d.ts +30 -0
- package/dist/common/src/socket.schemas.d.ts +3 -0
- package/dist/common/src/socket.types.d.ts +68 -0
- package/dist/common/src/time-units.d.ts +5 -0
- package/dist/common/src/trigger.types.d.ts +17 -0
- package/dist/common/src/types.d.ts +15 -0
- package/dist/common/src/utils/array.d.ts +7 -0
- package/dist/common/src/utils/assert.d.ts +6 -0
- package/dist/common/src/utils/error.d.ts +4 -0
- package/dist/common/src/utils/lock.manager.d.ts +14 -0
- package/dist/common/src/utils/object.d.ts +4 -0
- package/dist/common/src/utils/serialization.d.ts +5 -0
- package/dist/common/src/utils/url.d.ts +1 -0
- package/dist/common/src/utils/validation.d.ts +30 -0
- package/dist/index.js +12 -0
- package/dist/index.js.LICENSE.txt +38 -0
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -0
- package/dist/typescript-client/src/api.manager.d.ts +14 -0
- package/dist/typescript-client/src/backend-function.manager.d.ts +13 -0
- package/dist/typescript-client/src/collection-reference.d.ts +16 -0
- package/dist/typescript-client/src/collection-reference.factory.d.ts +11 -0
- package/dist/typescript-client/src/data.manager.d.ts +140 -0
- package/dist/typescript-client/src/db.dao.d.ts +20 -0
- package/dist/typescript-client/src/destruct.manager.d.ts +7 -0
- package/dist/typescript-client/src/document-reference.d.ts +18 -0
- package/dist/typescript-client/src/document-reference.factory.d.ts +9 -0
- package/dist/typescript-client/src/graphql-client.d.ts +9 -0
- package/dist/typescript-client/src/graphql-client.factory.d.ts +9 -0
- package/dist/typescript-client/src/index.d.ts +4 -0
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +11 -0
- package/dist/typescript-client/src/named-query.manager.d.ts +13 -0
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +41 -0
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +55 -0
- package/dist/typescript-client/src/query/query.types.d.ts +7 -0
- package/dist/typescript-client/src/rpc.manager.d.ts +23 -0
- package/dist/typescript-client/src/socket.manager.d.ts +27 -0
- package/dist/typescript-client/src/squid.d.ts +48 -0
- package/dist/typescript-client/src/state/action.applier.d.ts +7 -0
- package/dist/typescript-client/src/state/actions.d.ts +29 -0
- package/dist/typescript-client/src/state/path_trie.d.ts +27 -0
- package/dist/typescript-client/src/state/state.service.d.ts +22 -0
- package/dist/typescript-client/src/types.d.ts +2 -0
- package/package.json +26 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ApplicationBundleData, ServiceFunctionName } from './bundle-data.types';
|
|
2
|
+
import { AppId, IntegrationId } from './communication.types';
|
|
3
|
+
import { CollectionName } from './document.types';
|
|
4
|
+
import { ApiEndpoint, ApiEndpointId, GraphQLConnectionOptions, Integration, IntegrationDataSchema, IntegrationGraphQLSchema, IntegrationType, MongoConnectionSecretOptions, MssqlConnectionSecretOptions, MySqlConnectionSecretOptions, PostgresConnectionSecretOptions } from './integration.types';
|
|
5
|
+
export type WebhookId = string;
|
|
6
|
+
export type QueryName = string;
|
|
7
|
+
export type TriggerId = string;
|
|
8
|
+
export type SchedulerId = string;
|
|
9
|
+
export type CronExpression = string;
|
|
10
|
+
export type OpenIdProviderType = 'auth0';
|
|
11
|
+
export type CodeUrl = string;
|
|
12
|
+
export interface TriggerConfig {
|
|
13
|
+
integrationId: IntegrationId;
|
|
14
|
+
collectionName: CollectionName;
|
|
15
|
+
functionName: ServiceFunctionName;
|
|
16
|
+
}
|
|
17
|
+
export interface SchedulerConfig {
|
|
18
|
+
functionName: ServiceFunctionName;
|
|
19
|
+
cronExpression: CronExpression;
|
|
20
|
+
}
|
|
21
|
+
export interface WebhookConfig {
|
|
22
|
+
functionName: ServiceFunctionName;
|
|
23
|
+
}
|
|
24
|
+
export interface OpenIdProvider {
|
|
25
|
+
providerType: OpenIdProviderType;
|
|
26
|
+
clientId: string;
|
|
27
|
+
domain: string;
|
|
28
|
+
}
|
|
29
|
+
export interface Application {
|
|
30
|
+
appId: AppId;
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
updatedAt: Date;
|
|
33
|
+
allowedHosts: string[];
|
|
34
|
+
openIdProvider?: OpenIdProvider;
|
|
35
|
+
integrations: Record<IntegrationId, Integration>;
|
|
36
|
+
bundleMetadata?: ApplicationBundleData;
|
|
37
|
+
}
|
|
38
|
+
export interface UpdateOpenIdProviderRequest {
|
|
39
|
+
openIdProvider: OpenIdProvider;
|
|
40
|
+
}
|
|
41
|
+
export interface CreateApplicationResponse {
|
|
42
|
+
appId: AppId;
|
|
43
|
+
}
|
|
44
|
+
export type UpsertIntegrationRequest = UpsertMongoDbIntegrationRequest | UpsertMssqlIntegrationRequest | UpsertMySqlIntegrationRequest | UpsertPostgresIntegrationRequest | UpsertCockroachIntegrationRequest | UpsertGraphQLIntegrationRequest | UpsertApiIntegrationRequest;
|
|
45
|
+
interface BaseUpsertIntegrationRequest {
|
|
46
|
+
id: IntegrationId;
|
|
47
|
+
type: IntegrationType;
|
|
48
|
+
secured?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface BaseUpsertDataIntegrationRequest extends BaseUpsertIntegrationRequest {
|
|
51
|
+
supportsExternalChanges?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface UpsertMongoDbIntegrationRequest extends BaseUpsertDataIntegrationRequest {
|
|
54
|
+
type: IntegrationType.mongo;
|
|
55
|
+
schema?: IntegrationDataSchema;
|
|
56
|
+
configuration: {
|
|
57
|
+
connectionOptions: {
|
|
58
|
+
secrets: MongoConnectionSecretOptions;
|
|
59
|
+
ssl?: {
|
|
60
|
+
certificateFile: string;
|
|
61
|
+
validate: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface UpsertMySqlIntegrationRequest extends BaseUpsertDataIntegrationRequest {
|
|
67
|
+
type: IntegrationType.mysql;
|
|
68
|
+
schema?: IntegrationDataSchema;
|
|
69
|
+
configuration: {
|
|
70
|
+
connectionOptions: {
|
|
71
|
+
secrets: MySqlConnectionSecretOptions;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface UpsertMssqlIntegrationRequest extends BaseUpsertDataIntegrationRequest {
|
|
76
|
+
type: IntegrationType.mssql;
|
|
77
|
+
schema?: IntegrationDataSchema;
|
|
78
|
+
configuration: {
|
|
79
|
+
connectionOptions: {
|
|
80
|
+
secrets: MssqlConnectionSecretOptions;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export interface UpsertPostgresIntegrationRequest extends BaseUpsertDataIntegrationRequest {
|
|
85
|
+
type: IntegrationType.postgres;
|
|
86
|
+
schema?: IntegrationDataSchema;
|
|
87
|
+
configuration: {
|
|
88
|
+
connectionOptions: {
|
|
89
|
+
secrets: PostgresConnectionSecretOptions;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface UpsertCockroachIntegrationRequest extends BaseUpsertDataIntegrationRequest {
|
|
94
|
+
type: IntegrationType.cockroach;
|
|
95
|
+
schema?: IntegrationDataSchema;
|
|
96
|
+
configuration: {
|
|
97
|
+
connectionOptions: {
|
|
98
|
+
secrets: PostgresConnectionSecretOptions;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export interface UpsertGraphQLIntegrationRequest extends BaseUpsertIntegrationRequest {
|
|
103
|
+
type: IntegrationType.graphql;
|
|
104
|
+
schema?: IntegrationGraphQLSchema;
|
|
105
|
+
configuration: {
|
|
106
|
+
connectionOptions: GraphQLConnectionOptions;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export interface UpsertApiIntegrationRequest extends BaseUpsertIntegrationRequest {
|
|
110
|
+
type: IntegrationType.api;
|
|
111
|
+
baseUrl: string;
|
|
112
|
+
endpoints: Record<ApiEndpointId, ApiEndpoint>;
|
|
113
|
+
}
|
|
114
|
+
export interface DeleteIntegrationRequest {
|
|
115
|
+
integrationId: IntegrationId;
|
|
116
|
+
}
|
|
117
|
+
export interface UpdateAllowedHostsRequest {
|
|
118
|
+
allowedHosts: string[];
|
|
119
|
+
}
|
|
120
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ActionType } from './bundle-data.types';
|
|
2
|
+
import { DocType, FullDocIdStr, UserFacingDocType } from './document.types';
|
|
3
|
+
import { ApiEndpoint, ApiEndpointId, ApiIntegration } from './integration.types';
|
|
4
|
+
import { Mutation, MutationType } from './mutation.types';
|
|
5
|
+
import { RunContext } from './context.types';
|
|
6
|
+
import { Logger } from './logger.types';
|
|
7
|
+
import { SecretKey } from './secret.types';
|
|
8
|
+
import { QueryContext } from './query';
|
|
9
|
+
import { MutationContext } from './mutation.context';
|
|
10
|
+
export type DocHash = string;
|
|
11
|
+
export type SecurityResponse = {
|
|
12
|
+
docsToHash: Record<FullDocIdStr, DocHash | undefined>;
|
|
13
|
+
rulesPassed: true;
|
|
14
|
+
} | {
|
|
15
|
+
rulesPassed: false;
|
|
16
|
+
};
|
|
17
|
+
export interface ServiceConfig {
|
|
18
|
+
context: RunContext;
|
|
19
|
+
logger: Logger;
|
|
20
|
+
secrets: Record<SecretKey, any>;
|
|
21
|
+
backendApiKey: string;
|
|
22
|
+
}
|
|
23
|
+
export type SecureDatabaseAction<T extends ActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? (request?: SecureDatabaseReadRequest) => boolean | Promise<boolean> : (request?: SecureDatabaseWriteRequest) => boolean | Promise<boolean>;
|
|
24
|
+
export interface SecureDatabaseReadRequest<T = any> {
|
|
25
|
+
queryContext: QueryContext<T>;
|
|
26
|
+
}
|
|
27
|
+
export interface SecureDatabaseWriteRequest<T extends UserFacingDocType = any> {
|
|
28
|
+
mutationContext: MutationContext<T>;
|
|
29
|
+
}
|
|
30
|
+
export type SecureApiAction = (request?: SecureApiRequest) => boolean | Promise<boolean>;
|
|
31
|
+
export interface SecureApiRequest {
|
|
32
|
+
endpointId: ApiEndpointId;
|
|
33
|
+
endpoint: ApiEndpoint;
|
|
34
|
+
apiIntegration: ApiIntegration;
|
|
35
|
+
request: Record<string, any>;
|
|
36
|
+
serverUrlOverride: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
export type SecureExecutableAction = (request?: SecureExecutableRequest) => boolean | Promise<boolean>;
|
|
39
|
+
export interface SecureExecutableRequest {
|
|
40
|
+
params: any[];
|
|
41
|
+
}
|
|
42
|
+
export type SecureNamedQueryAction = (request?: SecureNamedQueryRequest) => boolean | Promise<boolean>;
|
|
43
|
+
export interface SecureNamedQueryRequest {
|
|
44
|
+
params: Record<string, any>;
|
|
45
|
+
}
|
|
46
|
+
export type SecureGraphQLAction = (request?: SecureGraphQLRequest) => boolean | Promise<boolean>;
|
|
47
|
+
export interface SecureGraphQLRequest {
|
|
48
|
+
isGraphiQL: boolean;
|
|
49
|
+
query?: string;
|
|
50
|
+
operationName?: string;
|
|
51
|
+
variables?: string | Record<string, any>;
|
|
52
|
+
}
|
|
53
|
+
export type TransformDatabaseAction<T extends ActionType> = T extends 'read' ? (request?: TransformDatabaseReadRequest) => TransformDatabaseReadResponse | Promise<TransformDatabaseReadResponse> : (request?: TransformDatabaseWriteRequest) => TransformDatabaseWriteResponse | Promise<TransformDatabaseWriteResponse>;
|
|
54
|
+
export interface TransformDatabaseReadRequest {
|
|
55
|
+
documents: Array<DocType>;
|
|
56
|
+
}
|
|
57
|
+
export interface TransformDatabaseWriteRequest {
|
|
58
|
+
mutations: Array<Mutation>;
|
|
59
|
+
}
|
|
60
|
+
export type TransformDatabaseReadResponse = Array<DocType>;
|
|
61
|
+
export type TransformDatabaseWriteResponse = Array<Mutation>;
|
|
62
|
+
export type ExecutableAction = (...args: any[]) => any;
|
|
63
|
+
export type TriggerAction = (request?: TriggerRequest) => void | Promise<void>;
|
|
64
|
+
export interface TriggerRequest<T extends UserFacingDocType = any> {
|
|
65
|
+
fullDocId: FullDocIdStr;
|
|
66
|
+
mutationType: MutationType;
|
|
67
|
+
docBefore?: T;
|
|
68
|
+
docAfter?: T;
|
|
69
|
+
}
|
|
70
|
+
export type SchedulerAction = () => void | Promise<void>;
|
|
71
|
+
export type WebhookAction = (request?: WebhookRequest) => any;
|
|
72
|
+
export interface WebhookRequest {
|
|
73
|
+
body: any;
|
|
74
|
+
queryParams: Record<string, string>;
|
|
75
|
+
headers: Record<string, string>;
|
|
76
|
+
files: Array<SquidFile>;
|
|
77
|
+
}
|
|
78
|
+
export interface SquidFile {
|
|
79
|
+
data: Uint8Array;
|
|
80
|
+
fieldName: string;
|
|
81
|
+
mimetype: string;
|
|
82
|
+
originalName: string;
|
|
83
|
+
size: number;
|
|
84
|
+
encoding?: string;
|
|
85
|
+
}
|
|
86
|
+
export type ActionMethodDecorator<U> = <T extends U>(target: Object, propertyName: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { QueryName, SchedulerConfig, SchedulerId, TriggerConfig, TriggerId, WebhookConfig, WebhookId } from './application.types';
|
|
2
|
+
import { IntegrationId } from './communication.types';
|
|
3
|
+
import { CollectionName } from './document.types';
|
|
4
|
+
import { ApiEndpointId } from './integration.types';
|
|
5
|
+
export type ActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
|
|
6
|
+
export type ServiceName = string;
|
|
7
|
+
export type FunctionName = string;
|
|
8
|
+
export type ServiceFunctionName = `${ServiceName}:${FunctionName}`;
|
|
9
|
+
export interface ApplicationBundleData {
|
|
10
|
+
databases: Record<IntegrationId, DatabaseMetadata>;
|
|
11
|
+
apis: Record<ApiEndpointId, ApiMetadata>;
|
|
12
|
+
graphql: Record<IntegrationId, GraphQLMetadata>;
|
|
13
|
+
executables: Record<FunctionName, ExecutableMetadata>;
|
|
14
|
+
triggers: Record<TriggerId, TriggerConfig>;
|
|
15
|
+
schedulers: Record<SchedulerId, SchedulerConfig>;
|
|
16
|
+
webhooks: Record<WebhookId, WebhookConfig>;
|
|
17
|
+
namedQueries: Record<IntegrationId, Record<QueryName, NamedQueryMetadata>>;
|
|
18
|
+
}
|
|
19
|
+
export interface DatabaseMetadata {
|
|
20
|
+
collections: Record<CollectionName, CollectionMetadata>;
|
|
21
|
+
security?: Record<ActionType, Array<ServiceFunctionName>>;
|
|
22
|
+
transform?: Record<ActionType, DatabaseTransformMetadata>;
|
|
23
|
+
}
|
|
24
|
+
export interface CollectionMetadata {
|
|
25
|
+
security?: Record<ActionType, Array<ServiceFunctionName>>;
|
|
26
|
+
transform?: Record<ActionType, DatabaseTransformMetadata>;
|
|
27
|
+
}
|
|
28
|
+
export interface DatabaseTransformMetadata {
|
|
29
|
+
serviceFunction: ServiceFunctionName;
|
|
30
|
+
}
|
|
31
|
+
export interface ExecutableMetadata {
|
|
32
|
+
security?: Array<ServiceFunctionName>;
|
|
33
|
+
serviceFunction: ServiceFunctionName;
|
|
34
|
+
}
|
|
35
|
+
export interface NamedQueryMetadata {
|
|
36
|
+
security?: Array<ServiceFunctionName>;
|
|
37
|
+
queryString: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ApiMetadata {
|
|
40
|
+
security: Array<ServiceFunctionName>;
|
|
41
|
+
}
|
|
42
|
+
interface GraphQLMetadata {
|
|
43
|
+
security: Array<ServiceFunctionName>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type AuthType = 'Bearer' | 'ApiKey';
|
|
2
|
+
export interface AuthWithBearer {
|
|
3
|
+
type: 'Bearer';
|
|
4
|
+
userId: string;
|
|
5
|
+
expiration: number;
|
|
6
|
+
attributes: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
export interface AuthWithApiKey {
|
|
9
|
+
type: 'ApiKey';
|
|
10
|
+
apiKey: string;
|
|
11
|
+
}
|
|
12
|
+
export type Auth = AuthWithBearer | AuthWithApiKey;
|
|
13
|
+
export interface AuthToken {
|
|
14
|
+
type: AuthType;
|
|
15
|
+
token: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RunContext {
|
|
18
|
+
appId: string;
|
|
19
|
+
sourceIp?: string;
|
|
20
|
+
headers?: Record<string, any>;
|
|
21
|
+
auth?: Auth;
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IntegrationId } from './communication.types';
|
|
2
|
+
export type FieldName<T = any> = string & keyof T;
|
|
3
|
+
export type PrimitiveFieldType = string | number | boolean | null;
|
|
4
|
+
export type FieldType = PrimitiveFieldType | Array<FieldType> | {
|
|
5
|
+
[key: string]: FieldType;
|
|
6
|
+
};
|
|
7
|
+
export type DocId = string;
|
|
8
|
+
export type DocIdObj = Record<FieldName, any>;
|
|
9
|
+
export type CollectionName = string;
|
|
10
|
+
export type DocTimestamp = number;
|
|
11
|
+
export interface FullDocId {
|
|
12
|
+
collectionName: CollectionName;
|
|
13
|
+
docId: DocId;
|
|
14
|
+
integrationId: IntegrationId;
|
|
15
|
+
}
|
|
16
|
+
export interface BeforeAndAfterDocs<T = DocType> {
|
|
17
|
+
before: T | undefined;
|
|
18
|
+
after: T | undefined;
|
|
19
|
+
}
|
|
20
|
+
export type FullDocIdStr = string;
|
|
21
|
+
export interface DocType {
|
|
22
|
+
__docId__: DocId;
|
|
23
|
+
__ts__: DocTimestamp;
|
|
24
|
+
[fieldName: string]: FieldType | undefined;
|
|
25
|
+
}
|
|
26
|
+
export type UserFacingDocType = Record<FieldName, any | undefined>;
|
|
27
|
+
export declare function parseFullDocId(fullDocIdStr: FullDocIdStr): FullDocId;
|
|
28
|
+
export declare function getFullDocIdStr(fullDocId: FullDocId): FullDocIdStr;
|
|
29
|
+
export declare function getFullDocIdStr(docId: DocId, collectionName: CollectionName, integrationId: IntegrationId): FullDocIdStr;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IntrospectionQuery } from 'graphql';
|
|
2
|
+
export { ExecutionResult, IntrospectionQuery } from 'graphql';
|
|
3
|
+
export interface GraphQLRequest {
|
|
4
|
+
operationName?: string;
|
|
5
|
+
query?: string;
|
|
6
|
+
variables?: string | Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
export declare const EmptyIntrospection: IntrospectionQuery;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare enum HttpStatus {
|
|
2
|
+
CONTINUE = 100,
|
|
3
|
+
SWITCHING_PROTOCOLS = 101,
|
|
4
|
+
PROCESSING = 102,
|
|
5
|
+
EARLYHINTS = 103,
|
|
6
|
+
OK = 200,
|
|
7
|
+
CREATED = 201,
|
|
8
|
+
ACCEPTED = 202,
|
|
9
|
+
NON_AUTHORITATIVE_INFORMATION = 203,
|
|
10
|
+
NO_CONTENT = 204,
|
|
11
|
+
RESET_CONTENT = 205,
|
|
12
|
+
PARTIAL_CONTENT = 206,
|
|
13
|
+
AMBIGUOUS = 300,
|
|
14
|
+
MOVED_PERMANENTLY = 301,
|
|
15
|
+
FOUND = 302,
|
|
16
|
+
SEE_OTHER = 303,
|
|
17
|
+
NOT_MODIFIED = 304,
|
|
18
|
+
TEMPORARY_REDIRECT = 307,
|
|
19
|
+
PERMANENT_REDIRECT = 308,
|
|
20
|
+
BAD_REQUEST = 400,
|
|
21
|
+
UNAUTHORIZED = 401,
|
|
22
|
+
PAYMENT_REQUIRED = 402,
|
|
23
|
+
FORBIDDEN = 403,
|
|
24
|
+
NOT_FOUND = 404,
|
|
25
|
+
METHOD_NOT_ALLOWED = 405,
|
|
26
|
+
NOT_ACCEPTABLE = 406,
|
|
27
|
+
PROXY_AUTHENTICATION_REQUIRED = 407,
|
|
28
|
+
REQUEST_TIMEOUT = 408,
|
|
29
|
+
CONFLICT = 409,
|
|
30
|
+
GONE = 410,
|
|
31
|
+
LENGTH_REQUIRED = 411,
|
|
32
|
+
PRECONDITION_FAILED = 412,
|
|
33
|
+
PAYLOAD_TOO_LARGE = 413,
|
|
34
|
+
URI_TOO_LONG = 414,
|
|
35
|
+
UNSUPPORTED_MEDIA_TYPE = 415,
|
|
36
|
+
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
|
37
|
+
EXPECTATION_FAILED = 417,
|
|
38
|
+
I_AM_A_TEAPOT = 418,
|
|
39
|
+
MISDIRECTED = 421,
|
|
40
|
+
UNPROCESSABLE_ENTITY = 422,
|
|
41
|
+
FAILED_DEPENDENCY = 424,
|
|
42
|
+
PRECONDITION_REQUIRED = 428,
|
|
43
|
+
TOO_MANY_REQUESTS = 429,
|
|
44
|
+
INTERNAL_SERVER_ERROR = 500,
|
|
45
|
+
NOT_IMPLEMENTED = 501,
|
|
46
|
+
BAD_GATEWAY = 502,
|
|
47
|
+
SERVICE_UNAVAILABLE = 503,
|
|
48
|
+
GATEWAY_TIMEOUT = 504,
|
|
49
|
+
HTTP_VERSION_NOT_SUPPORTED = 505
|
|
50
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export * from './api.types';
|
|
2
|
+
export * from './application.schemas';
|
|
3
|
+
export * from './application.types';
|
|
4
|
+
export * from './backend-function.schemas';
|
|
5
|
+
export * from './backend-function.types';
|
|
6
|
+
export * from './named-query.schemas';
|
|
7
|
+
export * from './named-query.types';
|
|
8
|
+
export * from './bundle-api.types';
|
|
9
|
+
export * from './bundle-data.types';
|
|
10
|
+
export * from './communication.types';
|
|
11
|
+
export * from './context.types';
|
|
12
|
+
export * from './document.types';
|
|
13
|
+
export * from './graphql.types';
|
|
14
|
+
export * from './http-status.enum';
|
|
15
|
+
export * from './integration.types';
|
|
16
|
+
export * from './logger.types';
|
|
17
|
+
export * from './mutation.schemas';
|
|
18
|
+
export * from './mutation.types';
|
|
19
|
+
export * from './mutation.context';
|
|
20
|
+
export * from './metrics.types';
|
|
21
|
+
export * from './metrics.schemas';
|
|
22
|
+
export * from './query';
|
|
23
|
+
export * from './query.schemas';
|
|
24
|
+
export * from './query.types';
|
|
25
|
+
export * from './schema/schema.types';
|
|
26
|
+
export * from './secret.schemas';
|
|
27
|
+
export * from './secret.types';
|
|
28
|
+
export * from './socket.schemas';
|
|
29
|
+
export * from './socket.types';
|
|
30
|
+
export * from './time-units';
|
|
31
|
+
export * from './trigger.types';
|
|
32
|
+
export * from './types';
|
|
33
|
+
export * from './utils/array';
|
|
34
|
+
export * from './utils/assert';
|
|
35
|
+
export * from './utils/lock.manager';
|
|
36
|
+
export * from './utils/object';
|
|
37
|
+
export * from './utils/serialization';
|
|
38
|
+
export * from './utils/validation';
|
|
39
|
+
export * from './utils/error';
|
|
40
|
+
export * from './utils/url';
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { IntegrationId } from './communication.types';
|
|
2
|
+
import { FieldName } from './document.types';
|
|
3
|
+
import { IntrospectionQuery } from './graphql.types';
|
|
4
|
+
import { CollectionSchema } from './schema/schema.types';
|
|
5
|
+
export interface MongoConnectionSecretOptions {
|
|
6
|
+
password?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MongoConnectionOptions {
|
|
9
|
+
secrets: MongoConnectionSecretOptions;
|
|
10
|
+
connectionString: string;
|
|
11
|
+
user?: string;
|
|
12
|
+
replicaSet?: string;
|
|
13
|
+
ssl?: {
|
|
14
|
+
certificateFile: string;
|
|
15
|
+
validate: boolean;
|
|
16
|
+
};
|
|
17
|
+
maxPoolSize?: number;
|
|
18
|
+
minPoolSize?: number;
|
|
19
|
+
socketTimeoutMS?: number;
|
|
20
|
+
serverSelectionTimeoutMS?: number;
|
|
21
|
+
keepAlive?: boolean;
|
|
22
|
+
directConnection?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface MySqlConnectionSecretOptions {
|
|
25
|
+
password: string;
|
|
26
|
+
}
|
|
27
|
+
export interface MssqlConnectionSecretOptions {
|
|
28
|
+
password: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PostgresConnectionSecretOptions {
|
|
31
|
+
password: string;
|
|
32
|
+
sslCertificate?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface MySqlConnectionOptions {
|
|
35
|
+
secrets: MySqlConnectionSecretOptions;
|
|
36
|
+
host: string;
|
|
37
|
+
user: string;
|
|
38
|
+
database: string;
|
|
39
|
+
connectionLimit?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface MssqlConnectionOptions {
|
|
42
|
+
secrets: MssqlConnectionSecretOptions;
|
|
43
|
+
host: string;
|
|
44
|
+
user: string;
|
|
45
|
+
schema: string;
|
|
46
|
+
database: string;
|
|
47
|
+
connectionLimit?: number;
|
|
48
|
+
sslEnabled?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface PostgresConnectionOptions {
|
|
51
|
+
host: string;
|
|
52
|
+
user: string;
|
|
53
|
+
database: string;
|
|
54
|
+
schema?: string;
|
|
55
|
+
sslEnabled?: boolean;
|
|
56
|
+
secrets: PostgresConnectionSecretOptions;
|
|
57
|
+
}
|
|
58
|
+
export interface GraphQLConnectionOptions {
|
|
59
|
+
baseUrl: string;
|
|
60
|
+
}
|
|
61
|
+
export declare enum IntegrationType {
|
|
62
|
+
'internal' = "internal",
|
|
63
|
+
'mongo' = "mongo",
|
|
64
|
+
'mysql' = "mysql",
|
|
65
|
+
'mssql' = "mssql",
|
|
66
|
+
'postgres' = "postgres",
|
|
67
|
+
'cockroach' = "cockroach",
|
|
68
|
+
'api' = "api",
|
|
69
|
+
'graphql' = "graphql"
|
|
70
|
+
}
|
|
71
|
+
export type DataIntegration = MySqlIntegration | MssqlIntegration | MongoIntegration | InternalIntegration | PostgresIntegration | CockroachIntegration;
|
|
72
|
+
export type Integration = DataIntegration | ApiIntegration | GraphQLIntegration;
|
|
73
|
+
type TableName = string;
|
|
74
|
+
export interface IntegrationDataSchema {
|
|
75
|
+
collections: Record<TableName, CollectionSchema>;
|
|
76
|
+
}
|
|
77
|
+
export interface IntegrationGraphQLSchema {
|
|
78
|
+
introspection: IntrospectionQuery;
|
|
79
|
+
}
|
|
80
|
+
export type IntegrationSchema = IntegrationDataSchema | IntegrationGraphQLSchema;
|
|
81
|
+
interface BaseIntegration {
|
|
82
|
+
id: IntegrationId;
|
|
83
|
+
type: IntegrationType;
|
|
84
|
+
creationDate: Date;
|
|
85
|
+
updateDate: Date;
|
|
86
|
+
secured: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface BaseDataIntegration extends BaseIntegration {
|
|
89
|
+
schema?: IntegrationDataSchema;
|
|
90
|
+
supportsExternalChanges: boolean;
|
|
91
|
+
}
|
|
92
|
+
export declare function isDataIntegration(integration: any): integration is BaseDataIntegration;
|
|
93
|
+
export type HttpMethod = 'post' | 'get' | 'delete' | 'patch' | 'put';
|
|
94
|
+
export type ApiEndpointId = string;
|
|
95
|
+
export type ApiParameterLocation = 'query' | 'body' | 'header' | 'path';
|
|
96
|
+
export type FieldPath = string;
|
|
97
|
+
export interface ApiRequestField {
|
|
98
|
+
paramLocation?: ApiParameterLocation;
|
|
99
|
+
fieldNameInRequest?: FieldName;
|
|
100
|
+
}
|
|
101
|
+
export interface ApiResponseField {
|
|
102
|
+
paramLocation: 'body' | 'header';
|
|
103
|
+
fieldPathInResponse?: FieldPath;
|
|
104
|
+
}
|
|
105
|
+
export interface ApiEndpoint {
|
|
106
|
+
relativePath: string;
|
|
107
|
+
method: HttpMethod;
|
|
108
|
+
requestSchema?: Record<FieldName, ApiRequestField>;
|
|
109
|
+
responseSchema?: Record<FieldPath, ApiResponseField>;
|
|
110
|
+
}
|
|
111
|
+
export interface ApiIntegration extends BaseIntegration {
|
|
112
|
+
type: IntegrationType.api;
|
|
113
|
+
baseUrl: string;
|
|
114
|
+
endpoints: Record<ApiEndpointId, ApiEndpoint>;
|
|
115
|
+
}
|
|
116
|
+
export interface GraphQLIntegration extends BaseIntegration {
|
|
117
|
+
type: IntegrationType.graphql;
|
|
118
|
+
schema?: IntegrationGraphQLSchema;
|
|
119
|
+
configuration: {
|
|
120
|
+
connectionOptions: GraphQLConnectionOptions;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export interface MySqlIntegrationConfiguration {
|
|
124
|
+
connectionOptions: MySqlConnectionOptions;
|
|
125
|
+
}
|
|
126
|
+
export interface MssqlIntegrationConfiguration {
|
|
127
|
+
connectionOptions: MssqlConnectionOptions;
|
|
128
|
+
}
|
|
129
|
+
export interface PostgresIntegrationConfiguration {
|
|
130
|
+
connectionOptions: PostgresConnectionOptions;
|
|
131
|
+
}
|
|
132
|
+
export interface MongoIntegrationConfiguration {
|
|
133
|
+
connectionOptions: MongoConnectionOptions;
|
|
134
|
+
}
|
|
135
|
+
export interface MySqlIntegration extends BaseDataIntegration {
|
|
136
|
+
type: IntegrationType.mysql;
|
|
137
|
+
configuration: MySqlIntegrationConfiguration;
|
|
138
|
+
schema: IntegrationDataSchema;
|
|
139
|
+
supportsExternalChanges: true;
|
|
140
|
+
}
|
|
141
|
+
export interface MssqlIntegration extends BaseDataIntegration {
|
|
142
|
+
type: IntegrationType.mssql;
|
|
143
|
+
configuration: MssqlIntegrationConfiguration;
|
|
144
|
+
schema: IntegrationDataSchema;
|
|
145
|
+
supportsExternalChanges: true;
|
|
146
|
+
}
|
|
147
|
+
export interface BasePostgresIntegration extends BaseDataIntegration {
|
|
148
|
+
type: IntegrationType.postgres | IntegrationType.cockroach;
|
|
149
|
+
configuration: PostgresIntegrationConfiguration;
|
|
150
|
+
schema: IntegrationDataSchema;
|
|
151
|
+
}
|
|
152
|
+
export interface PostgresIntegration extends BasePostgresIntegration {
|
|
153
|
+
type: IntegrationType.postgres;
|
|
154
|
+
supportsExternalChanges: true;
|
|
155
|
+
}
|
|
156
|
+
export interface CockroachIntegration extends BasePostgresIntegration {
|
|
157
|
+
type: IntegrationType.cockroach;
|
|
158
|
+
supportsExternalChanges: false;
|
|
159
|
+
}
|
|
160
|
+
export interface InternalIntegration extends BaseDataIntegration {
|
|
161
|
+
type: IntegrationType.internal;
|
|
162
|
+
}
|
|
163
|
+
export interface MongoIntegration extends BaseDataIntegration {
|
|
164
|
+
type: IntegrationType.mongo;
|
|
165
|
+
configuration: MongoIntegrationConfiguration;
|
|
166
|
+
supportsExternalChanges: true;
|
|
167
|
+
}
|
|
168
|
+
export interface InternalIntegration extends BaseDataIntegration {
|
|
169
|
+
type: IntegrationType.internal;
|
|
170
|
+
}
|
|
171
|
+
export interface TestDataConnectionResponse {
|
|
172
|
+
success: boolean;
|
|
173
|
+
errorMessage?: string;
|
|
174
|
+
}
|
|
175
|
+
interface TestMongoDataConnectionRequest {
|
|
176
|
+
type: IntegrationType.mongo;
|
|
177
|
+
configuration: {
|
|
178
|
+
connectionOptions: MongoConnectionOptions;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
interface TestMysqlDataConnectionRequest {
|
|
182
|
+
type: IntegrationType.mysql;
|
|
183
|
+
configuration: {
|
|
184
|
+
connectionOptions: MySqlConnectionOptions;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
interface TestMssqlDataConnectionRequest {
|
|
188
|
+
type: IntegrationType.mssql;
|
|
189
|
+
configuration: {
|
|
190
|
+
connectionOptions: MssqlConnectionOptions;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
interface TestPostgresDataConnectionRequest {
|
|
194
|
+
type: IntegrationType.postgres;
|
|
195
|
+
configuration: {
|
|
196
|
+
connectionOptions: PostgresConnectionOptions;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
interface TestCockroachDataConnectionRequest {
|
|
200
|
+
type: IntegrationType.cockroach;
|
|
201
|
+
configuration: {
|
|
202
|
+
connectionOptions: PostgresConnectionOptions;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export type TestDataConnectionRequest = TestMongoDataConnectionRequest | TestMysqlDataConnectionRequest | TestMssqlDataConnectionRequest | TestCockroachDataConnectionRequest | TestPostgresDataConnectionRequest;
|
|
206
|
+
export interface DiscoverDataConnectionSchemaResponse {
|
|
207
|
+
schema: IntegrationDataSchema;
|
|
208
|
+
}
|
|
209
|
+
export interface DiscoverGraphQLConnectionSchemaResponse {
|
|
210
|
+
schema: IntegrationGraphQLSchema;
|
|
211
|
+
}
|
|
212
|
+
interface DiscoverMongoDataConnectionSchemaRequest {
|
|
213
|
+
integrationType: IntegrationType.mongo;
|
|
214
|
+
connectionOptions: MongoConnectionOptions;
|
|
215
|
+
}
|
|
216
|
+
interface DiscoverInternalDataConnectionSchemaRequest {
|
|
217
|
+
integrationType: IntegrationType.internal;
|
|
218
|
+
}
|
|
219
|
+
interface DiscoverMysqlDataConnectionSchemaRequest {
|
|
220
|
+
integrationType: IntegrationType.mysql;
|
|
221
|
+
connectionOptions: MySqlConnectionOptions;
|
|
222
|
+
}
|
|
223
|
+
interface DiscoverMssqlDataConnectionSchemaRequest {
|
|
224
|
+
integrationType: IntegrationType.mssql;
|
|
225
|
+
connectionOptions: MssqlConnectionOptions;
|
|
226
|
+
}
|
|
227
|
+
export interface DiscoverGraphQLConnectionSchemaRequest {
|
|
228
|
+
integrationType: IntegrationType.graphql;
|
|
229
|
+
connectionOptions: GraphQLConnectionOptions;
|
|
230
|
+
}
|
|
231
|
+
interface DiscoverPostgresDataConnectionSchemaRequest {
|
|
232
|
+
integrationType: IntegrationType.postgres;
|
|
233
|
+
connectionOptions: PostgresConnectionOptions;
|
|
234
|
+
}
|
|
235
|
+
interface DiscoverCockroachDataConnectionSchemaRequest {
|
|
236
|
+
integrationType: IntegrationType.cockroach;
|
|
237
|
+
connectionOptions: PostgresConnectionOptions;
|
|
238
|
+
}
|
|
239
|
+
export type DiscoverDataConnectionSchemaRequest = DiscoverMongoDataConnectionSchemaRequest | DiscoverInternalDataConnectionSchemaRequest | DiscoverMysqlDataConnectionSchemaRequest | DiscoverMssqlDataConnectionSchemaRequest | DiscoverCockroachDataConnectionSchemaRequest | DiscoverPostgresDataConnectionSchemaRequest;
|
|
240
|
+
export interface DiscoverOpenApiEndpointsRequest {
|
|
241
|
+
openApiSpecUrl: string;
|
|
242
|
+
}
|
|
243
|
+
export interface DiscoverOpenApiEndpointsResponse {
|
|
244
|
+
baseUrl: string;
|
|
245
|
+
endpoints: Record<ApiEndpointId, ApiEndpoint>;
|
|
246
|
+
}
|
|
247
|
+
export {};
|