@squidcloud/client 1.0.159 → 1.0.160
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/cjs/index.js +90 -31
- package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +25 -0
- package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +29 -0
- package/dist/internal-common/src/public-types/api-call.context.d.ts +13 -0
- package/dist/internal-common/src/public-types/api.types.d.ts +4 -0
- package/dist/internal-common/src/public-types/application.types.d.ts +149 -0
- package/dist/internal-common/src/public-types/backend-run.types.d.ts +2 -0
- package/dist/internal-common/src/public-types/base-query-builder.d.ts +147 -0
- package/dist/internal-common/src/public-types/bundle-api.types.d.ts +49 -0
- package/dist/internal-common/src/public-types/bundle-data.types.d.ts +11 -0
- package/dist/internal-common/src/public-types/communication.types.d.ts +10 -0
- package/dist/internal-common/src/public-types/context.types.d.ts +40 -0
- package/dist/internal-common/src/public-types/distributed-lock.context.d.ts +4 -0
- package/dist/internal-common/src/public-types/document.types.d.ts +22 -0
- package/dist/internal-common/src/public-types/graphql.context.d.ts +7 -0
- package/dist/internal-common/src/public-types/graphql.types.d.ts +9 -0
- package/dist/internal-common/src/public-types/heartbeat.types.d.ts +1 -0
- package/dist/internal-common/src/public-types/http-status.enum.d.ts +50 -0
- package/dist/internal-common/src/public-types/integration-types.d.ts +62 -0
- package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.d.ts +32 -0
- package/dist/internal-common/src/public-types/integrations/api.types.d.ts +81 -0
- package/dist/internal-common/src/public-types/integrations/auth.types.d.ts +54 -0
- package/dist/internal-common/src/public-types/integrations/database.types.d.ts +275 -0
- package/dist/internal-common/src/public-types/integrations/observability.types.d.ts +24 -0
- package/dist/internal-common/src/public-types/integrations/queue-types.d.ts +40 -0
- package/dist/internal-common/src/public-types/integrations/schemas.d.ts +79 -0
- package/dist/internal-common/src/public-types/logger.types.d.ts +21 -0
- package/dist/internal-common/src/public-types/metrics.types.d.ts +1 -0
- package/dist/internal-common/src/public-types/mutation.context.d.ts +14 -0
- package/dist/internal-common/src/public-types/mutation.types.d.ts +53 -0
- package/dist/internal-common/src/public-types/native-query.context.d.ts +7 -0
- package/dist/internal-common/src/public-types/native-query.types.d.ts +16 -0
- package/dist/internal-common/src/public-types/openapi.types.d.ts +1 -0
- package/dist/internal-common/src/public-types/pagination.d.ts +62 -0
- package/dist/internal-common/src/public-types/query-context.d.ts +137 -0
- package/dist/internal-common/src/public-types/query.types.d.ts +64 -0
- package/dist/internal-common/src/public-types/regions.d.ts +1 -0
- package/dist/internal-common/src/public-types/secret.types.d.ts +22 -0
- package/dist/internal-common/src/public-types/serialized-query.types.d.ts +24 -0
- package/dist/internal-common/src/public-types/socket.types.d.ts +12 -0
- package/dist/internal-common/src/public-types/topic.context.d.ts +1 -0
- package/dist/internal-common/src/public-types/types.d.ts +14 -0
- package/dist/internal-common/src/public-utils/id-utils.d.ts +6 -0
- package/dist/internal-common/src/schema/schema.types.d.ts +54 -0
- package/dist/internal-common/src/types/ai-assistant.types.d.ts +1 -0
- package/dist/internal-common/src/types/ai-chatbot.context.d.ts +12 -0
- package/dist/internal-common/src/types/ai-chatbot.types.d.ts +1 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/utils/array.d.ts +1 -0
- package/dist/internal-common/src/utils/assert.d.ts +1 -0
- package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
- package/dist/internal-common/src/utils/http.d.ts +2 -0
- package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
- package/dist/internal-common/src/utils/object.d.ts +5 -0
- package/dist/internal-common/src/utils/serialization.d.ts +5 -0
- package/dist/internal-common/src/utils/validation.d.ts +27 -0
- package/dist/internal-common/src/websocket.impl.d.ts +21 -0
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -0
- package/dist/typescript-client/src/ai-assistant-client.d.ts +73 -0
- package/dist/typescript-client/src/ai-chatbot-client.d.ts +174 -0
- package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +8 -0
- package/dist/typescript-client/src/ai.types.d.ts +63 -0
- package/dist/typescript-client/src/api.manager.d.ts +11 -0
- package/dist/typescript-client/src/auth.manager.d.ts +27 -0
- package/dist/typescript-client/src/backend-function.manager.d.ts +9 -0
- package/dist/typescript-client/src/backend-transforms.d.ts +0 -0
- package/dist/typescript-client/src/client-id.service.d.ts +27 -0
- package/dist/typescript-client/src/collection-reference.d.ts +80 -0
- package/dist/typescript-client/src/collection-reference.factory.d.ts +13 -0
- package/dist/typescript-client/src/connection-details.d.ts +23 -0
- package/dist/typescript-client/src/data.manager.d.ts +175 -0
- package/dist/typescript-client/src/destruct.manager.d.ts +13 -0
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +16 -0
- package/dist/typescript-client/src/document-identity.service.d.ts +12 -0
- package/dist/typescript-client/src/document-reference.d.ts +148 -0
- package/dist/typescript-client/src/document-reference.factory.d.ts +13 -0
- package/dist/typescript-client/src/document-store.d.ts +14 -0
- package/dist/typescript-client/src/graphql-client.d.ts +14 -0
- package/dist/typescript-client/src/graphql-client.factory.d.ts +11 -0
- package/dist/typescript-client/src/index.d.ts +11 -0
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +11 -0
- package/dist/typescript-client/src/native-query-manager.d.ts +7 -0
- package/dist/typescript-client/src/public-types.d.ts +41 -0
- package/dist/typescript-client/src/public-utils.d.ts +1 -0
- package/dist/typescript-client/src/query/deserializer.d.ts +3 -0
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +161 -0
- package/dist/typescript-client/src/query/local-query-manager.d.ts +9 -0
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +77 -0
- package/dist/typescript-client/src/query/query-sender.d.ts +33 -0
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +131 -0
- package/dist/typescript-client/src/query/query.types.d.ts +49 -0
- package/dist/typescript-client/src/queue.manager.d.ts +7 -0
- package/dist/typescript-client/src/rate-limiter.d.ts +32 -0
- package/dist/typescript-client/src/rpc.manager.d.ts +30 -0
- package/dist/typescript-client/src/secret.client.d.ts +22 -0
- package/dist/typescript-client/src/socket.manager.d.ts +43 -0
- package/dist/typescript-client/src/squid.d.ts +245 -0
- package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -0
- package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -0
- package/dist/typescript-client/src/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MutationContext } from './mutation.context';
|
|
2
|
+
import { ApiCallContext } from './api-call.context';
|
|
3
|
+
import { GraphqlContext } from './graphql.context';
|
|
4
|
+
import { DistributedLockContext } from './distributed-lock.context';
|
|
5
|
+
import { NativeQueryContext } from './native-query.context';
|
|
6
|
+
import { QueryContext } from './query-context';
|
|
7
|
+
import { AiChatbotActionType, DatabaseActionType, TopicActionType } from './bundle-data.types';
|
|
8
|
+
import { ClientId } from './communication.types';
|
|
9
|
+
import { DocumentData, SquidDocId } from './document.types';
|
|
10
|
+
import { MutationType } from './mutation.types';
|
|
11
|
+
import { ClientConnectionState } from './socket.types';
|
|
12
|
+
import { TopicReadContext, TopicWriteContext } from './topic.context';
|
|
13
|
+
import { AiChatbotChatContext, AiChatbotMutationContext } from '../types/ai-chatbot.context';
|
|
14
|
+
export type SecureDatabaseAction<T extends DatabaseActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? ((context: QueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: MutationContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
15
|
+
export type SecureTopicAction<T extends TopicActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? ((context: TopicReadContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: TopicWriteContext<T>) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
16
|
+
export type SecureApiAction = ((context: ApiCallContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
17
|
+
export type SecureNativeQueryAction = ((context: NativeQueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
18
|
+
export type SecureDistributedLockAction = ((context: DistributedLockContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
19
|
+
export type SecureGraphQLAction = ((context: GraphqlContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
20
|
+
export type SecureAiChatbotAction<T extends AiChatbotActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'chat' ? ((context: AiChatbotChatContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: AiChatbotMutationContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
21
|
+
export type ClientConnectionStateChangeAction = (clientId: ClientId, clientConnectionState: ClientConnectionState) => Promise<void> | void;
|
|
22
|
+
export type ExecutableAction = (...args: any[]) => any;
|
|
23
|
+
export type AiFunctionAction<T extends Record<string, any> = any> = (params: T) => any;
|
|
24
|
+
export type TriggerAction = ((request: TriggerRequest) => void | Promise<void>) | (() => void | Promise<void>);
|
|
25
|
+
/** The context provided to a trigger function. */
|
|
26
|
+
export interface TriggerRequest<T extends DocumentData = any> {
|
|
27
|
+
squidDocId: SquidDocId;
|
|
28
|
+
mutationType: MutationType;
|
|
29
|
+
docBefore?: T;
|
|
30
|
+
docAfter?: T;
|
|
31
|
+
}
|
|
32
|
+
export type SchedulerAction = () => void | Promise<void>;
|
|
33
|
+
export type WebhookAction = ((request: WebhookRequest) => any) | (() => any);
|
|
34
|
+
/** The context provided to a webhook function. */
|
|
35
|
+
export interface WebhookRequest<T = any> {
|
|
36
|
+
body: T;
|
|
37
|
+
rawBody?: string;
|
|
38
|
+
queryParams: Record<string, string>;
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
httpMethod: 'post' | 'get' | 'put' | 'delete';
|
|
41
|
+
files?: Array<SquidFile>;
|
|
42
|
+
}
|
|
43
|
+
export interface WebhookResponse {
|
|
44
|
+
headers: Record<string, any>;
|
|
45
|
+
body: any;
|
|
46
|
+
statusCode: number;
|
|
47
|
+
__isWebhookResponse__: true;
|
|
48
|
+
}
|
|
49
|
+
export type ActionMethodDecorator<U> = <T extends U>(target: Object, propertyName: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The different types of actions that can be performed on a database. */
|
|
2
|
+
export type DatabaseActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
|
|
3
|
+
/** The different types of actions that can be performed on a topic. */
|
|
4
|
+
export type TopicActionType = 'read' | 'write' | 'all';
|
|
5
|
+
/** The different types of actions that can be performed on an AI chatbot. */
|
|
6
|
+
export type AiChatbotActionType = 'chat' | 'mutate' | 'all';
|
|
7
|
+
export interface LocalBackendData {
|
|
8
|
+
applicationBundleData: ApplicationBundleData;
|
|
9
|
+
openApiSpecStr?: string;
|
|
10
|
+
}
|
|
11
|
+
export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A type alias for an application id. */
|
|
2
|
+
export type AppId = string;
|
|
3
|
+
export declare const ENVIRONMENT_IDS: readonly ["dev", "prod"];
|
|
4
|
+
export type EnvironmentId = (typeof ENVIRONMENT_IDS)[number];
|
|
5
|
+
/** @deprecated. Use ENVIRONMENT_IDS. */
|
|
6
|
+
export declare const allEnvironmentIds: Array<EnvironmentId>;
|
|
7
|
+
/** A type alias for an integration id. */
|
|
8
|
+
export type IntegrationId = string;
|
|
9
|
+
export type ChatId = string;
|
|
10
|
+
export type SquidDeveloperId = string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AppId, ClientId } from './communication.types';
|
|
2
|
+
export type AuthType = 'Bearer' | 'ApiKey';
|
|
3
|
+
/**
|
|
4
|
+
* The payload of a JWT token in case an auth token was used.
|
|
5
|
+
*/
|
|
6
|
+
export interface AuthWithBearer {
|
|
7
|
+
type: 'Bearer';
|
|
8
|
+
userId: string;
|
|
9
|
+
expiration: number;
|
|
10
|
+
attributes: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The authentication object for the current request in case an API key is used.
|
|
14
|
+
*/
|
|
15
|
+
export interface AuthWithApiKey {
|
|
16
|
+
type: 'ApiKey';
|
|
17
|
+
apiKey: string;
|
|
18
|
+
}
|
|
19
|
+
/** The authentication object for the current request. */
|
|
20
|
+
export type Auth = AuthWithBearer | AuthWithApiKey;
|
|
21
|
+
export interface AuthToken {
|
|
22
|
+
type: AuthType;
|
|
23
|
+
token: string;
|
|
24
|
+
integrationId?: string;
|
|
25
|
+
}
|
|
26
|
+
/** The context of a request to a service. */
|
|
27
|
+
export interface RunContext {
|
|
28
|
+
/** Your applicationId. */
|
|
29
|
+
appId: AppId;
|
|
30
|
+
/**
|
|
31
|
+
* The id of the client that initiated this request. This is only relevant in cases that the request was initiated by
|
|
32
|
+
* a client such as when securing an api call or a DB operation. This id will not be available for triggers,
|
|
33
|
+
* schedulers, webhooks and other functions that are not directly initiated by a user action.
|
|
34
|
+
*/
|
|
35
|
+
clientId?: ClientId;
|
|
36
|
+
/** The IP address of the client that initiated this request. */
|
|
37
|
+
sourceIp?: string;
|
|
38
|
+
/** The headers of the request. */
|
|
39
|
+
headers?: Record<string, any>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IntegrationId } from './communication.types';
|
|
2
|
+
/** A type alias for a field name. */
|
|
3
|
+
export type FieldName<T = any> = string & keyof T;
|
|
4
|
+
/** A type alias for a document id as string. */
|
|
5
|
+
export type DocId = string;
|
|
6
|
+
/** A type alias for a document id object when the ID is a composite of primary keys. */
|
|
7
|
+
export type DocIdObj = Record<FieldName, any>;
|
|
8
|
+
/** A type alias for a collection name. */
|
|
9
|
+
export type CollectionName = string;
|
|
10
|
+
/** The full document id, including the collection name and the integration id. */
|
|
11
|
+
export interface SquidDocIdObj {
|
|
12
|
+
collectionName: CollectionName;
|
|
13
|
+
docId: DocId;
|
|
14
|
+
integrationId: IntegrationId;
|
|
15
|
+
}
|
|
16
|
+
/** The before and after documents of a document change. */
|
|
17
|
+
export interface BeforeAndAfterDocs<T = SquidDocument> {
|
|
18
|
+
before: T | undefined;
|
|
19
|
+
after: T | undefined;
|
|
20
|
+
}
|
|
21
|
+
/** A generic document data type. */
|
|
22
|
+
export type DocumentData = Record<FieldName, any | undefined>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The context provided to a secure GraphQL function. */
|
|
2
|
+
export declare class GraphqlContext {
|
|
3
|
+
readonly isGraphiQL: boolean;
|
|
4
|
+
readonly query: string | undefined;
|
|
5
|
+
readonly variables: string | Record<string, any> | undefined;
|
|
6
|
+
readonly operationName: string | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { type ExecutionResult, type IntrospectionQuery } from 'graphql';
|
|
2
|
+
export interface GraphQLRequest {
|
|
3
|
+
operationName?: string;
|
|
4
|
+
query?: string;
|
|
5
|
+
variables?: string | Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export interface SecureGraphQLRequest extends GraphQLRequest {
|
|
8
|
+
isGraphiQL: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkAllHeartbeatProviders(heartbeatProviders: Record<string, HeartbeatProvider>): Promise<void>;
|
|
@@ -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,62 @@
|
|
|
1
|
+
export declare enum IntegrationCategory {
|
|
2
|
+
'database' = "database",
|
|
3
|
+
'queue' = "queue",
|
|
4
|
+
'api' = "api",
|
|
5
|
+
'observability' = "observability",
|
|
6
|
+
'crm' = "crm",
|
|
7
|
+
'auth' = "auth",
|
|
8
|
+
'ai' = "ai"
|
|
9
|
+
}
|
|
10
|
+
export declare enum IntegrationType {
|
|
11
|
+
'built_in_db' = "built_in_db",
|
|
12
|
+
'mongo' = "mongo",
|
|
13
|
+
'mysql' = "mysql",
|
|
14
|
+
'mssql' = "mssql",
|
|
15
|
+
'postgres' = "postgres",
|
|
16
|
+
'cockroach' = "cockroach",
|
|
17
|
+
'api' = "api",
|
|
18
|
+
'graphql' = "graphql",
|
|
19
|
+
'snowflake' = "snowflake",
|
|
20
|
+
'datadog' = "datadog",
|
|
21
|
+
'newrelic' = "newrelic",
|
|
22
|
+
'auth0' = "auth0",
|
|
23
|
+
'jwt_rsa' = "jwt_rsa",
|
|
24
|
+
'jwt_hmac' = "jwt_hmac",
|
|
25
|
+
'ai_chatbot' = "ai_chatbot",
|
|
26
|
+
'cognito' = "cognito",
|
|
27
|
+
'okta' = "okta",
|
|
28
|
+
'descope' = "descope",
|
|
29
|
+
'kafka' = "kafka",
|
|
30
|
+
'confluent' = "confluent",
|
|
31
|
+
'built_in_queue' = "built_in_queue",
|
|
32
|
+
'algolia' = "algolia",
|
|
33
|
+
'elastic_observability' = "elastic_observability",
|
|
34
|
+
'elastic_search' = "elastic_search",
|
|
35
|
+
'elastic_enterprise_search' = "elastic_enterprise_search",
|
|
36
|
+
'sentry' = "sentry",
|
|
37
|
+
'sap_hana' = "sap_hana",
|
|
38
|
+
'salesforce_crm' = "salesforce_crm",
|
|
39
|
+
'documentdb' = "documentdb",
|
|
40
|
+
'dynamodb' = "dynamodb",
|
|
41
|
+
'cassandra' = "cassandra",
|
|
42
|
+
'clickhouse' = "clickhouse",
|
|
43
|
+
'alloydb' = "alloydb",
|
|
44
|
+
'spanner' = "spanner",
|
|
45
|
+
'db2' = "db2",
|
|
46
|
+
'mariadb' = "mariadb",
|
|
47
|
+
'oracledb' = "oracledb",
|
|
48
|
+
'pinot' = "pinot",
|
|
49
|
+
'redis' = "redis",
|
|
50
|
+
'xata' = "xata",
|
|
51
|
+
'azure_sql' = "azure_sql",
|
|
52
|
+
'azure_postgresql' = "azure_postgresql",
|
|
53
|
+
'azure_cosmosdb' = "azure_cosmosdb",
|
|
54
|
+
'firestore' = "firestore",
|
|
55
|
+
'bigquery' = "bigquery",
|
|
56
|
+
'cloudsql' = "cloudsql"
|
|
57
|
+
}
|
|
58
|
+
export declare enum IntegrationSchemaType {
|
|
59
|
+
'data' = "data",
|
|
60
|
+
'api' = "api",
|
|
61
|
+
'graphql' = "graphql"
|
|
62
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseIntegrationConfig } from './schemas';
|
|
2
|
+
import { AiModelName } from '../ai-chatbot.public-types';
|
|
3
|
+
import { IntegrationId } from '../communication.types';
|
|
4
|
+
import { IntegrationType } from '../integration-types';
|
|
5
|
+
export interface AiChatbotIntegrationConfig extends BaseIntegrationConfig {
|
|
6
|
+
type: IntegrationType.ai_chatbot;
|
|
7
|
+
configuration: AiChatbotConfiguration;
|
|
8
|
+
}
|
|
9
|
+
export type AiChatbotConfiguration = {
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
};
|
|
12
|
+
export type AiChatbotProfileMetadata = {
|
|
13
|
+
modelName: AiModelName;
|
|
14
|
+
isPublic: boolean;
|
|
15
|
+
strictContext: boolean;
|
|
16
|
+
instructions: Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
export type AiChatbotContextMetadata = {
|
|
19
|
+
title: string;
|
|
20
|
+
text: string;
|
|
21
|
+
preview: boolean;
|
|
22
|
+
sizeBytes?: number;
|
|
23
|
+
};
|
|
24
|
+
export interface AiChatbotProfile extends AiChatbotProfileMetadata {
|
|
25
|
+
contexts: Record<string, AiChatbotContextMetadata>;
|
|
26
|
+
}
|
|
27
|
+
export interface AiChatbotProfiles {
|
|
28
|
+
profiles: Record<string, AiChatbotProfile>;
|
|
29
|
+
}
|
|
30
|
+
export interface GetAiChatbotProfilesRequest {
|
|
31
|
+
integrationId: IntegrationId;
|
|
32
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { FieldName } from '../document.types';
|
|
2
|
+
import { IntrospectionQuery } from '../graphql.types';
|
|
3
|
+
import { BaseIntegrationConfig, BaseIntegrationSchema } from './schemas';
|
|
4
|
+
import { IntegrationSchemaType, IntegrationType } from '../integration-types';
|
|
5
|
+
export type HttpMethod = 'post' | 'get' | 'delete' | 'patch' | 'put';
|
|
6
|
+
export type ApiEndpointId = string;
|
|
7
|
+
export type ApiParameterLocation = 'query' | 'body' | 'header' | 'path';
|
|
8
|
+
export type ApiResponseParameterLocation = 'header' | 'body';
|
|
9
|
+
export type ApiInjectionParameterLocation = 'header' | 'query';
|
|
10
|
+
export type FieldPath = string;
|
|
11
|
+
export type IntegrationApiEndpoints = Record<ApiEndpointId, ApiEndpoint>;
|
|
12
|
+
export interface IntegrationGraphQLSchema extends BaseIntegrationSchema {
|
|
13
|
+
type: IntegrationSchemaType.graphql;
|
|
14
|
+
introspection: IntrospectionQuery;
|
|
15
|
+
}
|
|
16
|
+
export interface IntegrationApiSchema extends BaseIntegrationSchema {
|
|
17
|
+
type: IntegrationSchemaType.api;
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
endpoints: IntegrationApiEndpoints;
|
|
20
|
+
injectionSchema?: ApiInjectionSchema;
|
|
21
|
+
}
|
|
22
|
+
export interface ApiRequestField {
|
|
23
|
+
location: ApiParameterLocation;
|
|
24
|
+
}
|
|
25
|
+
export interface ApiResponseField {
|
|
26
|
+
location: ApiResponseParameterLocation;
|
|
27
|
+
path?: FieldPath;
|
|
28
|
+
}
|
|
29
|
+
export type ApiInjectionFieldType = 'secret' | 'regular';
|
|
30
|
+
export interface ApiInjectionField {
|
|
31
|
+
value: string;
|
|
32
|
+
type: ApiInjectionFieldType;
|
|
33
|
+
location: ApiInjectionParameterLocation;
|
|
34
|
+
}
|
|
35
|
+
export interface GraphQLConnectionOptions {
|
|
36
|
+
baseUrl: string;
|
|
37
|
+
injectionSchema?: ApiInjectionSchema;
|
|
38
|
+
}
|
|
39
|
+
export type ApiInjectionSchema = Record<FieldName, ApiInjectionField>;
|
|
40
|
+
export interface OpenApiDiscoveryOptions {
|
|
41
|
+
openApiSpecUrl: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ApiEndpoint {
|
|
44
|
+
relativePath: string;
|
|
45
|
+
method: HttpMethod;
|
|
46
|
+
requestSchema?: Record<FieldName, ApiRequestField>;
|
|
47
|
+
responseSchema?: Record<FieldPath, ApiResponseField>;
|
|
48
|
+
injectionSchema?: ApiInjectionSchema;
|
|
49
|
+
}
|
|
50
|
+
export interface HttpApiIntegrationConfig extends BaseIntegrationConfig {
|
|
51
|
+
type: IntegrationType.api;
|
|
52
|
+
configuration?: {
|
|
53
|
+
discoveryOptions: OpenApiDiscoveryOptions;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface GraphQLIntegrationConfig extends BaseIntegrationConfig {
|
|
57
|
+
type: IntegrationType.graphql;
|
|
58
|
+
configuration: {
|
|
59
|
+
connectionOptions: GraphQLConnectionOptions;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface DiscoverGraphQLConnectionSchemaRequest {
|
|
63
|
+
integrationType: IntegrationType.graphql;
|
|
64
|
+
connectionOptions: GraphQLConnectionOptions;
|
|
65
|
+
}
|
|
66
|
+
export interface DiscoverOpenApiSchemaRequest {
|
|
67
|
+
integrationType: IntegrationType.api;
|
|
68
|
+
discoveryOptions: OpenApiDiscoveryOptions;
|
|
69
|
+
}
|
|
70
|
+
export interface TestGraphQLDataConnectionRequest {
|
|
71
|
+
type: IntegrationType.graphql;
|
|
72
|
+
configuration: {
|
|
73
|
+
connectionOptions: GraphQLConnectionOptions;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export interface DiscoverGraphQLConnectionSchemaResponse {
|
|
77
|
+
schema: IntegrationGraphQLSchema;
|
|
78
|
+
}
|
|
79
|
+
export interface DiscoverOpenApiSchemaResponse {
|
|
80
|
+
schema: IntegrationApiSchema;
|
|
81
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { BaseIntegrationConfig } from './schemas';
|
|
2
|
+
import { IntegrationType } from '../integration-types';
|
|
3
|
+
export interface Auth0IntegrationConfig extends BaseIntegrationConfig {
|
|
4
|
+
type: IntegrationType.auth0;
|
|
5
|
+
configuration: {
|
|
6
|
+
/** Auth0 domain. Used to build JWKS URL (https://$domain/.well-known/jwks.json) to check the JWT token signature.*/
|
|
7
|
+
domain: string;
|
|
8
|
+
/**
|
|
9
|
+
* The Auth0 audience is a parameter that ensures the JWT token is intended for the specific backend being accessed.
|
|
10
|
+
*
|
|
11
|
+
* Note: the audience for the web-app auth token is equal to the Auth0 web client id: it means that the web app
|
|
12
|
+
* client is a target audience for the JWT token. Such JWT tokens (ID tokens) should not be sent to the backend:
|
|
13
|
+
* backend calls should use another kind of JWT tokens (access tokens) issued by Auth0 for the backends.
|
|
14
|
+
*/
|
|
15
|
+
clientId: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface CognitoIntegrationConfig extends BaseIntegrationConfig {
|
|
19
|
+
type: IntegrationType.cognito;
|
|
20
|
+
configuration: {
|
|
21
|
+
region: string;
|
|
22
|
+
userPoolId: string;
|
|
23
|
+
appClientId: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface OktaIntegrationConfig extends BaseIntegrationConfig {
|
|
27
|
+
type: IntegrationType.okta;
|
|
28
|
+
configuration: {
|
|
29
|
+
domain: string;
|
|
30
|
+
clientId: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface JwtRsaIntegrationConfig extends BaseIntegrationConfig {
|
|
34
|
+
type: IntegrationType.jwt_rsa;
|
|
35
|
+
configuration: {
|
|
36
|
+
jwksUri: string;
|
|
37
|
+
validations?: {
|
|
38
|
+
aud?: string;
|
|
39
|
+
iss?: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface JwtHmacIntegrationConfig extends BaseIntegrationConfig {
|
|
44
|
+
type: IntegrationType.jwt_hmac;
|
|
45
|
+
configuration: {
|
|
46
|
+
verifyUri?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface DescopeIntegrationConfig extends BaseIntegrationConfig {
|
|
50
|
+
type: IntegrationType.descope;
|
|
51
|
+
configuration: {
|
|
52
|
+
projectId: string;
|
|
53
|
+
};
|
|
54
|
+
}
|