@squidcloud/client 1.0.168 → 1.0.169
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 +17 -10
- 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-context.d.ts +12 -0
- package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +31 -0
- package/dist/internal-common/src/public-types/api-call.public-context.d.ts +14 -0
- package/dist/internal-common/src/public-types/application.public-types.d.ts +149 -0
- package/dist/internal-common/src/public-types/base-query-builder.public-types.d.ts +147 -0
- package/dist/internal-common/src/public-types/bundle-api.public-types.d.ts +57 -0
- package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +8 -0
- package/dist/internal-common/src/public-types/communication.public-types.d.ts +12 -0
- package/dist/internal-common/src/public-types/context.public-types.d.ts +40 -0
- package/dist/internal-common/src/public-types/distributed-lock.public-context.d.ts +4 -0
- package/dist/internal-common/src/public-types/document.public-types.d.ts +32 -0
- package/dist/internal-common/src/public-types/graphql.public-context.d.ts +7 -0
- package/dist/internal-common/src/public-types/graphql.public-types.d.ts +9 -0
- package/dist/internal-common/src/public-types/http-status.enum.d.ts +50 -0
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +61 -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 +206 -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 +70 -0
- package/dist/internal-common/src/public-types/mutation.public-context.d.ts +14 -0
- package/dist/internal-common/src/public-types/mutation.public-types.d.ts +53 -0
- package/dist/internal-common/src/public-types/native-query.public-context.d.ts +7 -0
- package/dist/internal-common/src/public-types/native-query.public-types.d.ts +16 -0
- package/dist/internal-common/src/public-types/pagination.public-types.d.ts +62 -0
- package/dist/internal-common/src/public-types/query.public-context.d.ts +137 -0
- package/dist/internal-common/src/public-types/query.public-types.d.ts +64 -0
- package/dist/internal-common/src/public-types/regions.public-types.d.ts +5 -0
- package/dist/internal-common/src/public-types/schema.public-types.d.ts +46 -0
- package/dist/internal-common/src/public-types/secret.public-types.d.ts +16 -0
- package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +24 -0
- package/dist/internal-common/src/public-types/socket.public-types.d.ts +5 -0
- package/dist/internal-common/src/public-types/topic.public-context.d.ts +10 -0
- package/dist/internal-common/src/public-types/typescript.public-types.d.ts +15 -0
- package/dist/internal-common/src/public-utils/id-utils.d.ts +6 -0
- package/dist/internal-common/src/types/ai-assistant.types.d.ts +1 -0
- package/dist/internal-common/src/types/ai-chatbot.types.d.ts +1 -0
- package/dist/internal-common/src/types/api.types.d.ts +2 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/types/backend-run.types.d.ts +1 -0
- package/dist/internal-common/src/types/bundle-data.types.d.ts +1 -0
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/openapi.types.d.ts +1 -0
- package/dist/internal-common/src/types/query.types.d.ts +1 -0
- package/dist/internal-common/src/types/secret.types.d.ts +11 -0
- package/dist/internal-common/src/types/socket.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 +24 -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 +168 -0
- package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +1 -0
- package/dist/typescript-client/src/ai.types.d.ts +60 -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 +1 -0
- package/dist/typescript-client/src/connection-details.d.ts +23 -0
- package/dist/typescript-client/src/data.manager.d.ts +5 -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 +1 -0
- package/dist/typescript-client/src/document-reference.d.ts +149 -0
- package/dist/typescript-client/src/document-reference.factory.d.ts +1 -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 +1 -0
- package/dist/typescript-client/src/native-query-manager.d.ts +7 -0
- package/dist/typescript-client/src/public-types.d.ts +37 -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 +1 -0
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +77 -0
- package/dist/typescript-client/src/query/query-sender.d.ts +1 -0
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +2 -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 +23 -0
- package/dist/typescript-client/src/socket.manager.d.ts +1 -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 +6 -0
- package/package.json +3 -1
package/dist/cjs/index.js
CHANGED
|
@@ -30353,6 +30353,7 @@ function map(project, thisArg) {
|
|
|
30353
30353
|
|
|
30354
30354
|
|
|
30355
30355
|
class AiChatbotClient {
|
|
30356
|
+
/** @internal */
|
|
30356
30357
|
constructor(rpcManager, socketManager, integrationId) {
|
|
30357
30358
|
this.rpcManager = rpcManager;
|
|
30358
30359
|
this.socketManager = socketManager;
|
|
@@ -30446,6 +30447,7 @@ class AiChatbotClient {
|
|
|
30446
30447
|
}
|
|
30447
30448
|
}
|
|
30448
30449
|
class AiChatbotProfileReference {
|
|
30450
|
+
/** @internal */
|
|
30449
30451
|
constructor(client, integrationId, profileId) {
|
|
30450
30452
|
this.client = client;
|
|
30451
30453
|
this.integrationId = integrationId;
|
|
@@ -30550,6 +30552,7 @@ class AiChatbotProfileReference {
|
|
|
30550
30552
|
}
|
|
30551
30553
|
}
|
|
30552
30554
|
class AiChatbotContextReference {
|
|
30555
|
+
/** @internal */
|
|
30553
30556
|
constructor(client, integrationId, profileId, id) {
|
|
30554
30557
|
this.client = client;
|
|
30555
30558
|
this.integrationId = integrationId;
|
|
@@ -30625,6 +30628,7 @@ class AiChatbotContextReference {
|
|
|
30625
30628
|
}
|
|
30626
30629
|
}
|
|
30627
30630
|
class AiChatbotInstructionReference {
|
|
30631
|
+
/** @internal */
|
|
30628
30632
|
constructor(client, integrationId, profileId, id) {
|
|
30629
30633
|
this.client = client;
|
|
30630
30634
|
this.integrationId = integrationId;
|
|
@@ -30764,6 +30768,7 @@ function validateFieldSort(fieldSort) {
|
|
|
30764
30768
|
(0,dist.assertTruthy)(isRightType(safeFieldSort.asc, 'boolean'), 'Asc needs to be boolean');
|
|
30765
30769
|
validateFieldName(safeFieldSort.fieldName);
|
|
30766
30770
|
}
|
|
30771
|
+
/** @internal */
|
|
30767
30772
|
function validateOpenIdProvider(openIdProvider) {
|
|
30768
30773
|
assertTruthy(openIdProvider, 'INVALID_PROVIDER');
|
|
30769
30774
|
validateOpenIdProviderType(openIdProvider.providerType);
|
|
@@ -30772,6 +30777,7 @@ function validateOpenIdProvider(openIdProvider) {
|
|
|
30772
30777
|
assertTruthy(openIdProvider.domain, 'INVALID_DOMAIN');
|
|
30773
30778
|
return openIdProvider;
|
|
30774
30779
|
}
|
|
30780
|
+
/** @internal */
|
|
30775
30781
|
function validateOpenIdProviderType(providerType) {
|
|
30776
30782
|
const providerArray = ['auth0'];
|
|
30777
30783
|
assertTruthy(providerArray.includes(providerType), 'INVALID_OPEN_ID_PROVIDER_TYPE');
|
|
@@ -48197,13 +48203,13 @@ class GraphQLClient {
|
|
|
48197
48203
|
|
|
48198
48204
|
;// CONCATENATED MODULE: ./src/ai-chatbot-client.factory.ts
|
|
48199
48205
|
|
|
48206
|
+
/** @internal */
|
|
48200
48207
|
class AiChatbotClientFactory {
|
|
48201
48208
|
constructor(rpcManager, socketManager) {
|
|
48202
48209
|
this.rpcManager = rpcManager;
|
|
48203
48210
|
this.socketManager = socketManager;
|
|
48204
48211
|
this.chatbotsMap = new Map();
|
|
48205
48212
|
}
|
|
48206
|
-
/** @internal */
|
|
48207
48213
|
getChatbot(aiIntegrationId) {
|
|
48208
48214
|
let client = this.chatbotsMap.get(aiIntegrationId);
|
|
48209
48215
|
if (client)
|
|
@@ -48422,6 +48428,7 @@ class ClientIdService {
|
|
|
48422
48428
|
|
|
48423
48429
|
;// CONCATENATED MODULE: ./src/collection-reference.factory.ts
|
|
48424
48430
|
|
|
48431
|
+
/** @internal */
|
|
48425
48432
|
class CollectionReferenceFactory {
|
|
48426
48433
|
constructor(documentReferenceFactory, queryBuilderFactory, querySubscriptionManager) {
|
|
48427
48434
|
this.documentReferenceFactory = documentReferenceFactory;
|
|
@@ -48643,6 +48650,7 @@ function reduceMutations(mutations) {
|
|
|
48643
48650
|
|
|
48644
48651
|
/** Two transactions cannot run in parallel - this mutex is used for blocking a second transaction. */
|
|
48645
48652
|
const RUN_IN_TRANSACTION_MUTEX = 'dataManager_runInTransaction';
|
|
48653
|
+
/** @internal */
|
|
48646
48654
|
class DataManager {
|
|
48647
48655
|
constructor(documentStore, mutationSender, socketManager, querySubscriptionManager, queryBuilderFactory, lockManager, destructManager, documentIdentityService, querySender) {
|
|
48648
48656
|
this.documentStore = documentStore;
|
|
@@ -49472,6 +49480,7 @@ class DistributedLockImpl {
|
|
|
49472
49480
|
|
|
49473
49481
|
;// CONCATENATED MODULE: ./src/document-identity.service.ts
|
|
49474
49482
|
|
|
49483
|
+
/** @internal */
|
|
49475
49484
|
class DocumentIdentityService {
|
|
49476
49485
|
constructor(documentStore, destructManager) {
|
|
49477
49486
|
this.documentStore = documentStore;
|
|
@@ -49498,12 +49507,11 @@ class DocumentIdentityService {
|
|
|
49498
49507
|
|
|
49499
49508
|
|
|
49500
49509
|
|
|
49510
|
+
/** @internal */
|
|
49501
49511
|
class DocumentReferenceFactory {
|
|
49502
49512
|
constructor(documentIdentityService) {
|
|
49503
49513
|
this.documentIdentityService = documentIdentityService;
|
|
49504
|
-
/** @internal */
|
|
49505
49514
|
this.documents = new Map();
|
|
49506
|
-
/** @internal */
|
|
49507
49515
|
this.documentsForCollection = new Map();
|
|
49508
49516
|
this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this));
|
|
49509
49517
|
}
|
|
@@ -49522,16 +49530,10 @@ class DocumentReferenceFactory {
|
|
|
49522
49530
|
setDataManager(dataManager) {
|
|
49523
49531
|
this.dataManager = dataManager;
|
|
49524
49532
|
}
|
|
49525
|
-
/**
|
|
49526
|
-
* @internal
|
|
49527
|
-
*/
|
|
49528
49533
|
getDocumentsForCollection(integrationId, collectionName) {
|
|
49529
49534
|
const collectionKey = this.getCollectionKey(integrationId, collectionName);
|
|
49530
49535
|
return (this.documentsForCollection.get(collectionKey) || []).filter(d => d.hasData);
|
|
49531
49536
|
}
|
|
49532
|
-
/**
|
|
49533
|
-
* @internal
|
|
49534
|
-
*/
|
|
49535
49537
|
migrateDocIds(idResolutionMap) {
|
|
49536
49538
|
for (const [, reference] of this.documents) {
|
|
49537
49539
|
reference.migrateDocIds(idResolutionMap);
|
|
@@ -49679,6 +49681,7 @@ class GraphQLClientFactory {
|
|
|
49679
49681
|
|
|
49680
49682
|
|
|
49681
49683
|
|
|
49684
|
+
/** @internal */
|
|
49682
49685
|
class MutationSender {
|
|
49683
49686
|
constructor(rpcManager, lockManager, querySender) {
|
|
49684
49687
|
this.rpcManager = rpcManager;
|
|
@@ -49713,13 +49716,13 @@ class MutationSender {
|
|
|
49713
49716
|
;// CONCATENATED MODULE: ./src/query/local-query-manager.ts
|
|
49714
49717
|
|
|
49715
49718
|
|
|
49719
|
+
/** @internal */
|
|
49716
49720
|
class LocalQueryManager {
|
|
49717
49721
|
constructor(documentStore, documentReferenceFactory, querySubscriptionManager) {
|
|
49718
49722
|
this.documentStore = documentStore;
|
|
49719
49723
|
this.documentReferenceFactory = documentReferenceFactory;
|
|
49720
49724
|
this.querySubscriptionManager = querySubscriptionManager;
|
|
49721
49725
|
}
|
|
49722
|
-
/** @internal */
|
|
49723
49726
|
peek(query) {
|
|
49724
49727
|
if (!this.querySubscriptionManager.findValidParentOfQuery(query))
|
|
49725
49728
|
return [];
|
|
@@ -49829,6 +49832,7 @@ const arrayMergeCustomizer = (a, b) => {
|
|
|
49829
49832
|
// Exported only for tests
|
|
49830
49833
|
const FETCH_BEYOND_LIMIT = 100;
|
|
49831
49834
|
const LIMIT_UNDERFLOW_TRIGGER = 20;
|
|
49835
|
+
/** @internal */
|
|
49832
49836
|
class QuerySubscriptionManager {
|
|
49833
49837
|
constructor(rpcManager, clientIdService, documentStore, destructManager, documentIdentityService, querySender) {
|
|
49834
49838
|
this.rpcManager = rpcManager;
|
|
@@ -51037,6 +51041,7 @@ function createWebSocketWrapper(url, opts = {}) {
|
|
|
51037
51041
|
|
|
51038
51042
|
|
|
51039
51043
|
|
|
51044
|
+
/** @internal */
|
|
51040
51045
|
class SocketManager {
|
|
51041
51046
|
constructor(clientIdService, region, appId, messageNotificationWrapper = NOOP_FN, destructManager, authManager) {
|
|
51042
51047
|
this.clientIdService = clientIdService;
|
|
@@ -51233,6 +51238,7 @@ class SocketManager {
|
|
|
51233
51238
|
;// CONCATENATED MODULE: ./src/query/query-sender.ts
|
|
51234
51239
|
|
|
51235
51240
|
|
|
51241
|
+
/** @internal */
|
|
51236
51242
|
class QuerySender {
|
|
51237
51243
|
constructor(rpcManager, destructManager) {
|
|
51238
51244
|
this.rpcManager = rpcManager;
|
|
@@ -51462,6 +51468,7 @@ class AiAssistantClient {
|
|
|
51462
51468
|
* through its methods.
|
|
51463
51469
|
*/
|
|
51464
51470
|
class AiClient {
|
|
51471
|
+
/** @internal */
|
|
51465
51472
|
constructor(aiChatbotClientFactory, rpcManager) {
|
|
51466
51473
|
this.aiChatbotClientFactory = aiChatbotClientFactory;
|
|
51467
51474
|
this.rpcManager = rpcManager;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FunctionName } from './bundle-data.public-types';
|
|
2
|
+
export type AssistantToolType = 'code_interpreter' | 'retrieval';
|
|
3
|
+
export interface CreateAssistantRequest {
|
|
4
|
+
name: string;
|
|
5
|
+
instructions: string;
|
|
6
|
+
functions: Array<FunctionName>;
|
|
7
|
+
toolTypes?: Array<AssistantToolType>;
|
|
8
|
+
}
|
|
9
|
+
export interface DeleteAssistantRequest {
|
|
10
|
+
assistantId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CreateAssistantThreadRequest {
|
|
13
|
+
assistantId: string;
|
|
14
|
+
}
|
|
15
|
+
export interface DeleteThreadRequest {
|
|
16
|
+
threadId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateAssistantThreadRequest {
|
|
19
|
+
}
|
|
20
|
+
export interface CreateAssistantResponse {
|
|
21
|
+
assistantId: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateAssistantThreadResponse {
|
|
24
|
+
threadId: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AiChatbotMutationType, AiChatbotResourceType } from './ai-chatbot.public-types';
|
|
2
|
+
export declare class AiChatbotChatContext {
|
|
3
|
+
readonly prompt: string;
|
|
4
|
+
readonly profileId: string;
|
|
5
|
+
}
|
|
6
|
+
/** A context provided to the security rules of an AI Chatbot mutation. */
|
|
7
|
+
export declare class AiChatbotMutationContext {
|
|
8
|
+
readonly type: AiChatbotMutationType;
|
|
9
|
+
readonly resource: AiChatbotResourceType;
|
|
10
|
+
readonly profileId: string;
|
|
11
|
+
readonly payload: any;
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The supported AI model names. */
|
|
2
|
+
export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "claude-2", "gpt-4-1106-preview"];
|
|
3
|
+
export type AiModelName = (typeof AI_MODEL_NAMES)[number];
|
|
4
|
+
/** The possible sources for the LLM provider API key. */
|
|
5
|
+
export type ApiKeySource = 'user' | 'system';
|
|
6
|
+
export type AiChatbotContextType = 'text' | 'url' | 'file';
|
|
7
|
+
interface AiChatbotContextBase {
|
|
8
|
+
type: AiChatbotContextType;
|
|
9
|
+
data: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AiChatbotTextContext extends AiChatbotContextBase {
|
|
12
|
+
type: 'text';
|
|
13
|
+
}
|
|
14
|
+
export interface AiChatbotUrlContext extends AiChatbotContextBase {
|
|
15
|
+
type: 'url';
|
|
16
|
+
}
|
|
17
|
+
export interface AiChatbotFileContext extends AiChatbotContextBase {
|
|
18
|
+
type: 'file';
|
|
19
|
+
}
|
|
20
|
+
export type AiChatbotContext = AiChatbotTextContext | AiChatbotUrlContext | AiChatbotFileContext;
|
|
21
|
+
export type OpenAiResponseFormat = 'text' | 'json_object';
|
|
22
|
+
export interface AiChatbotChatOptions {
|
|
23
|
+
maxTokens?: number;
|
|
24
|
+
chatId?: string;
|
|
25
|
+
disableHistory?: boolean;
|
|
26
|
+
includeReference?: boolean;
|
|
27
|
+
responseFormat?: OpenAiResponseFormat;
|
|
28
|
+
}
|
|
29
|
+
export type AiChatbotMutationType = 'insert' | 'update' | 'delete';
|
|
30
|
+
export type AiChatbotResourceType = 'instruction' | 'context' | 'profile';
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiEndpointId, HttpMethod } from './integrations/api.types';
|
|
2
|
+
/** The headers of an API call. */
|
|
3
|
+
export type ApiHeaders = Record<string, string | number | boolean>;
|
|
4
|
+
/** The context of an API call. */
|
|
5
|
+
export declare class ApiCallContext {
|
|
6
|
+
readonly endpointId: ApiEndpointId;
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly method: HttpMethod;
|
|
9
|
+
readonly headers: ApiHeaders;
|
|
10
|
+
readonly body: Record<string, any>;
|
|
11
|
+
readonly queryParams: Record<string, string | number | boolean>;
|
|
12
|
+
readonly pathParams: Record<string, string>;
|
|
13
|
+
readonly serverUrlOverride: string | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { AuthIntegrationType, DatabaseIntegrationType, IntegrationConfig, IntegrationConfigTypes, IntegrationSchema, IntegrationSchemaKeys, IntegrationSchemaTypes, IntegrationTypeWithConfig } from './integrations/schemas';
|
|
2
|
+
import { IntegrationType } from './integration.public-types';
|
|
3
|
+
import { AppId, EnvironmentId, IntegrationId } from './communication.public-types';
|
|
4
|
+
/** A type alias for a string that represents a webhook. */
|
|
5
|
+
export type WebhookId = string;
|
|
6
|
+
/** A type alias for a string that represents a trigger id. */
|
|
7
|
+
export type TriggerId = string;
|
|
8
|
+
/** A type alias for a string that represents a scheduler id. */
|
|
9
|
+
export type SchedulerId = string;
|
|
10
|
+
/** The supported cron expression string. */
|
|
11
|
+
export type CronExpressionString = `${string} ${string} ${string} ${string} ${string}` | `${string} ${string} ${string} ${string}`;
|
|
12
|
+
/** A set of predefined cron expressions. */
|
|
13
|
+
export declare enum CronExpression {
|
|
14
|
+
EVERY_SECOND = "* * * * * *",
|
|
15
|
+
EVERY_5_SECONDS = "*/5 * * * * *",
|
|
16
|
+
EVERY_10_SECONDS = "*/10 * * * * *",
|
|
17
|
+
EVERY_30_SECONDS = "*/30 * * * * *",
|
|
18
|
+
EVERY_MINUTE = "*/1 * * * *",
|
|
19
|
+
EVERY_5_MINUTES = "0 */5 * * * *",
|
|
20
|
+
EVERY_10_MINUTES = "0 */10 * * * *",
|
|
21
|
+
EVERY_30_MINUTES = "0 */30 * * * *",
|
|
22
|
+
EVERY_HOUR = "0 0-23/1 * * *",
|
|
23
|
+
EVERY_2_HOURS = "0 0-23/2 * * *",
|
|
24
|
+
EVERY_3_HOURS = "0 0-23/3 * * *",
|
|
25
|
+
EVERY_4_HOURS = "0 0-23/4 * * *",
|
|
26
|
+
EVERY_5_HOURS = "0 0-23/5 * * *",
|
|
27
|
+
EVERY_6_HOURS = "0 0-23/6 * * *",
|
|
28
|
+
EVERY_7_HOURS = "0 0-23/7 * * *",
|
|
29
|
+
EVERY_8_HOURS = "0 0-23/8 * * *",
|
|
30
|
+
EVERY_9_HOURS = "0 0-23/9 * * *",
|
|
31
|
+
EVERY_10_HOURS = "0 0-23/10 * * *",
|
|
32
|
+
EVERY_11_HOURS = "0 0-23/11 * * *",
|
|
33
|
+
EVERY_12_HOURS = "0 0-23/12 * * *",
|
|
34
|
+
EVERY_DAY_AT_1AM = "0 01 * * *",
|
|
35
|
+
EVERY_DAY_AT_2AM = "0 02 * * *",
|
|
36
|
+
EVERY_DAY_AT_3AM = "0 03 * * *",
|
|
37
|
+
EVERY_DAY_AT_4AM = "0 04 * * *",
|
|
38
|
+
EVERY_DAY_AT_5AM = "0 05 * * *",
|
|
39
|
+
EVERY_DAY_AT_6AM = "0 06 * * *",
|
|
40
|
+
EVERY_DAY_AT_7AM = "0 07 * * *",
|
|
41
|
+
EVERY_DAY_AT_8AM = "0 08 * * *",
|
|
42
|
+
EVERY_DAY_AT_9AM = "0 09 * * *",
|
|
43
|
+
EVERY_DAY_AT_10AM = "0 10 * * *",
|
|
44
|
+
EVERY_DAY_AT_11AM = "0 11 * * *",
|
|
45
|
+
EVERY_DAY_AT_NOON = "0 12 * * *",
|
|
46
|
+
EVERY_DAY_AT_1PM = "0 13 * * *",
|
|
47
|
+
EVERY_DAY_AT_2PM = "0 14 * * *",
|
|
48
|
+
EVERY_DAY_AT_3PM = "0 15 * * *",
|
|
49
|
+
EVERY_DAY_AT_4PM = "0 16 * * *",
|
|
50
|
+
EVERY_DAY_AT_5PM = "0 17 * * *",
|
|
51
|
+
EVERY_DAY_AT_6PM = "0 18 * * *",
|
|
52
|
+
EVERY_DAY_AT_7PM = "0 19 * * *",
|
|
53
|
+
EVERY_DAY_AT_8PM = "0 20 * * *",
|
|
54
|
+
EVERY_DAY_AT_9PM = "0 21 * * *",
|
|
55
|
+
EVERY_DAY_AT_10PM = "0 22 * * *",
|
|
56
|
+
EVERY_DAY_AT_11PM = "0 23 * * *",
|
|
57
|
+
EVERY_DAY_AT_MIDNIGHT = "0 0 * * *",
|
|
58
|
+
EVERY_WEEK = "0 0 * * 7",
|
|
59
|
+
EVERY_WEEKDAY = "0 0 * * 1-5",
|
|
60
|
+
EVERY_WEEKEND = "0 0 * * 6,7",
|
|
61
|
+
EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT = "0 0 1 * *",
|
|
62
|
+
EVERY_1ST_DAY_OF_MONTH_AT_NOON = "0 12 1 * *",
|
|
63
|
+
EVERY_2ND_HOUR = "0 */2 * * *",
|
|
64
|
+
EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM = "0 1-23/2 * * *",
|
|
65
|
+
EVERY_2ND_MONTH = "0 0 1 */2 *",
|
|
66
|
+
EVERY_QUARTER = "0 0 1 */3 *",
|
|
67
|
+
EVERY_6_MONTHS = "0 0 1 */6 *",
|
|
68
|
+
EVERY_YEAR = "0 0 1 1 *",
|
|
69
|
+
EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",
|
|
70
|
+
EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",
|
|
71
|
+
EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM = "0 */30 10-19 * * *",
|
|
72
|
+
MONDAY_TO_FRIDAY_AT_1AM = "0 0 01 * * 1-5",
|
|
73
|
+
MONDAY_TO_FRIDAY_AT_2AM = "0 0 02 * * 1-5",
|
|
74
|
+
MONDAY_TO_FRIDAY_AT_3AM = "0 0 03 * * 1-5",
|
|
75
|
+
MONDAY_TO_FRIDAY_AT_4AM = "0 0 04 * * 1-5",
|
|
76
|
+
MONDAY_TO_FRIDAY_AT_5AM = "0 0 05 * * 1-5",
|
|
77
|
+
MONDAY_TO_FRIDAY_AT_6AM = "0 0 06 * * 1-5",
|
|
78
|
+
MONDAY_TO_FRIDAY_AT_7AM = "0 0 07 * * 1-5",
|
|
79
|
+
MONDAY_TO_FRIDAY_AT_8AM = "0 0 08 * * 1-5",
|
|
80
|
+
MONDAY_TO_FRIDAY_AT_9AM = "0 0 09 * * 1-5",
|
|
81
|
+
MONDAY_TO_FRIDAY_AT_09_30AM = "0 30 09 * * 1-5",
|
|
82
|
+
MONDAY_TO_FRIDAY_AT_10AM = "0 0 10 * * 1-5",
|
|
83
|
+
MONDAY_TO_FRIDAY_AT_11AM = "0 0 11 * * 1-5",
|
|
84
|
+
MONDAY_TO_FRIDAY_AT_11_30AM = "0 30 11 * * 1-5",
|
|
85
|
+
MONDAY_TO_FRIDAY_AT_12PM = "0 0 12 * * 1-5",
|
|
86
|
+
MONDAY_TO_FRIDAY_AT_1PM = "0 0 13 * * 1-5",
|
|
87
|
+
MONDAY_TO_FRIDAY_AT_2PM = "0 0 14 * * 1-5",
|
|
88
|
+
MONDAY_TO_FRIDAY_AT_3PM = "0 0 15 * * 1-5",
|
|
89
|
+
MONDAY_TO_FRIDAY_AT_4PM = "0 0 16 * * 1-5",
|
|
90
|
+
MONDAY_TO_FRIDAY_AT_5PM = "0 0 17 * * 1-5",
|
|
91
|
+
MONDAY_TO_FRIDAY_AT_6PM = "0 0 18 * * 1-5",
|
|
92
|
+
MONDAY_TO_FRIDAY_AT_7PM = "0 0 19 * * 1-5",
|
|
93
|
+
MONDAY_TO_FRIDAY_AT_8PM = "0 0 20 * * 1-5",
|
|
94
|
+
MONDAY_TO_FRIDAY_AT_9PM = "0 0 21 * * 1-5",
|
|
95
|
+
MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
|
|
96
|
+
MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
|
|
97
|
+
}
|
|
98
|
+
export interface DeleteIntegrationRequest {
|
|
99
|
+
integrationId: IntegrationId;
|
|
100
|
+
}
|
|
101
|
+
export interface UpdateAllowedHostsRequest {
|
|
102
|
+
allowedHosts: string[];
|
|
103
|
+
}
|
|
104
|
+
export interface CreateEnvironmentRequest {
|
|
105
|
+
sourceAppId: AppId;
|
|
106
|
+
environmentId: EnvironmentId;
|
|
107
|
+
}
|
|
108
|
+
export interface UpdateApplicationCodeRequest {
|
|
109
|
+
appId: AppId;
|
|
110
|
+
openApiSpecStr?: string;
|
|
111
|
+
openApiControllersStr?: string;
|
|
112
|
+
}
|
|
113
|
+
interface BaseUpsertIntegrationRequest<T extends IntegrationTypeWithConfig, C extends IntegrationConfig> {
|
|
114
|
+
id: IntegrationId;
|
|
115
|
+
type: T;
|
|
116
|
+
config: Partial<C>;
|
|
117
|
+
}
|
|
118
|
+
type ConfigurationTypes = {
|
|
119
|
+
[K in IntegrationTypeWithConfig]: IntegrationConfigTypes[K];
|
|
120
|
+
};
|
|
121
|
+
type UpsertIntegrationRequests = {
|
|
122
|
+
[K in IntegrationTypeWithConfig]: BaseUpsertIntegrationRequest<K, ConfigurationTypes[K]>;
|
|
123
|
+
};
|
|
124
|
+
export type UpsertDataIntegrationRequest = UpsertIntegrationRequests[DatabaseIntegrationType];
|
|
125
|
+
export type UpsertGraphQLIntegrationRequest = UpsertIntegrationRequests[IntegrationType.graphql];
|
|
126
|
+
export type UpsertApiIntegrationRequest = UpsertIntegrationRequests[IntegrationType.api];
|
|
127
|
+
export type UpsertAiChatbotIntegrationRequest = UpsertIntegrationRequests[IntegrationType.ai_chatbot];
|
|
128
|
+
export type UpsertKafkaIntegrationRequest = UpsertIntegrationRequests[IntegrationType.kafka];
|
|
129
|
+
export type UpsertConfluentIntegrationRequest = UpsertIntegrationRequests[IntegrationType.confluent];
|
|
130
|
+
export type UpsertAuthIntegrationRequest = UpsertIntegrationRequests[AuthIntegrationType];
|
|
131
|
+
interface BaseUpsertIntegrationSchemaRequest<T extends IntegrationType, S extends IntegrationSchema> {
|
|
132
|
+
id: IntegrationId;
|
|
133
|
+
type: T;
|
|
134
|
+
schema: S;
|
|
135
|
+
}
|
|
136
|
+
type SchemaTypes = {
|
|
137
|
+
[K in IntegrationSchemaKeys]: IntegrationSchemaTypes[K];
|
|
138
|
+
};
|
|
139
|
+
type UpsertIntegrationSchemaRequests = {
|
|
140
|
+
[K in IntegrationSchemaKeys]: BaseUpsertIntegrationSchemaRequest<K, SchemaTypes[K]>;
|
|
141
|
+
};
|
|
142
|
+
export type UpsertIntegrationSchemaRequest = UpsertDataIntegrationSchemaRequest | UpsertGraphQLIntegrationSchemaRequest | UpsertApiIntegrationSchemaRequest;
|
|
143
|
+
export type UpsertDataIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[DatabaseIntegrationType];
|
|
144
|
+
export type UpsertGraphQLIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.graphql];
|
|
145
|
+
export type UpsertApiIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.api];
|
|
146
|
+
export interface GetSchemaRequest {
|
|
147
|
+
integrationId: IntegrationId;
|
|
148
|
+
}
|
|
149
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { SerializedQuery } from './serialized-query.public-types';
|
|
3
|
+
import { Pagination, PaginationOptions } from './pagination.public-types';
|
|
4
|
+
import { Operator } from './query.public-types';
|
|
5
|
+
import { DocumentData, FieldName, PrimitiveFieldType } from './document.public-types';
|
|
6
|
+
export interface SnapshotEmitter<ReturnType> {
|
|
7
|
+
/**
|
|
8
|
+
* Returns a promise that resolves to the query results.
|
|
9
|
+
*
|
|
10
|
+
* @returns A promise that resolves to the query results.
|
|
11
|
+
*/
|
|
12
|
+
snapshot(): Promise<Array<ReturnType>>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns an observable that emits the query results and updates whenever the query results change unless
|
|
15
|
+
* `subscribe=false` is provided.
|
|
16
|
+
*
|
|
17
|
+
* Important: Make sure to unsubscribe from the observable when you are done with it.
|
|
18
|
+
*
|
|
19
|
+
* @param subscribe Whether to subscribe to changes to the query results. Defaults to `true`.
|
|
20
|
+
* @returns An observable for the query results.
|
|
21
|
+
*/
|
|
22
|
+
snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the results of the query based on the data that is currently available on the client. This method is useful
|
|
25
|
+
* for synchronously accessing data that has already been fetched by another query. The method will return an empty
|
|
26
|
+
* array if data has not yet been populated.
|
|
27
|
+
*
|
|
28
|
+
* @returns An array of query results.
|
|
29
|
+
*/
|
|
30
|
+
peek(): Array<ReturnType>;
|
|
31
|
+
limit(limit: number): SnapshotEmitter<ReturnType>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a pagination wrapper for this query.
|
|
34
|
+
* @param options The pagination options. Defaults to `{ subscribe: true, pageSize: 100 }`.
|
|
35
|
+
*/
|
|
36
|
+
paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
|
|
37
|
+
serialize(): SerializedQuery;
|
|
38
|
+
}
|
|
39
|
+
/** Query builder base class. */
|
|
40
|
+
export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
41
|
+
/**
|
|
42
|
+
* Adds a condition to the query.
|
|
43
|
+
* @param fieldName The name of the field to query.
|
|
44
|
+
* @param operator The operator to use.
|
|
45
|
+
* @param value The value to compare against.
|
|
46
|
+
* @returns The query builder.
|
|
47
|
+
*/
|
|
48
|
+
abstract where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
|
|
49
|
+
/**
|
|
50
|
+
* A shortcut for where(fieldName, '==', value)
|
|
51
|
+
*
|
|
52
|
+
* @param fieldName The name of the field to query.
|
|
53
|
+
* @param value The value to compare against.
|
|
54
|
+
* @returns The query builder.
|
|
55
|
+
*/
|
|
56
|
+
eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
57
|
+
/**
|
|
58
|
+
* A shortcut for where(fieldName, '!=', value)
|
|
59
|
+
* @param fieldName The name of the field to query.
|
|
60
|
+
* @param value The value to compare against.
|
|
61
|
+
* @returns The query builder.
|
|
62
|
+
*/
|
|
63
|
+
neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
64
|
+
/**
|
|
65
|
+
* A shortcut for where(fieldName, 'in', value)
|
|
66
|
+
* @param fieldName The name of the field to query.
|
|
67
|
+
* @param value An array of values to compare against.
|
|
68
|
+
* @returns The query builder.
|
|
69
|
+
*/
|
|
70
|
+
in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
71
|
+
/**
|
|
72
|
+
* A shortcut for where(fieldName, 'not in', value)
|
|
73
|
+
* @param fieldName The name of the field to query.
|
|
74
|
+
* @param value An array of values to compare against.
|
|
75
|
+
* @returns The query builder.
|
|
76
|
+
*/
|
|
77
|
+
nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
|
|
78
|
+
/**
|
|
79
|
+
* A shortcut for where(fieldName, '>', value)
|
|
80
|
+
* @param fieldName The name of the field to query.
|
|
81
|
+
* @param value The value to compare against.
|
|
82
|
+
* @returns The query builder.
|
|
83
|
+
*/
|
|
84
|
+
gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
85
|
+
/**
|
|
86
|
+
* A shortcut for where(fieldName, '>=', value)
|
|
87
|
+
* @param fieldName The name of the field to query.
|
|
88
|
+
* @param value The value to compare against.
|
|
89
|
+
* @returns The query builder.
|
|
90
|
+
*/
|
|
91
|
+
gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
92
|
+
/**
|
|
93
|
+
* A shortcut for where(fieldName, '<', value)
|
|
94
|
+
* @param fieldName The name of the field to query.
|
|
95
|
+
* @param value The value to compare against.
|
|
96
|
+
* @returns The query builder.
|
|
97
|
+
*/
|
|
98
|
+
lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
99
|
+
/**
|
|
100
|
+
* A shortcut for where(fieldName, '<=', value)
|
|
101
|
+
* @param fieldName The name of the field to query.
|
|
102
|
+
* @param value The value to compare against.
|
|
103
|
+
* @returns The query builder.
|
|
104
|
+
*/
|
|
105
|
+
lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
|
|
106
|
+
/**
|
|
107
|
+
* A shortcut for where(fieldName, 'like', pattern).
|
|
108
|
+
*
|
|
109
|
+
* @param fieldName The name of the field to query.
|
|
110
|
+
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
111
|
+
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
112
|
+
* @returns The query builder.
|
|
113
|
+
*/
|
|
114
|
+
like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
115
|
+
/**
|
|
116
|
+
* A shortcut for where(fieldName, 'not like', pattern).
|
|
117
|
+
*
|
|
118
|
+
* @param fieldName The name of the field to query.
|
|
119
|
+
* @param pattern The pattern to compare against. '%' is the only allowed wildcard
|
|
120
|
+
* @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
|
|
121
|
+
* @returns The query builder.
|
|
122
|
+
*/
|
|
123
|
+
notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
|
|
124
|
+
/**
|
|
125
|
+
* Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
|
|
126
|
+
* if none is provided.
|
|
127
|
+
* @param limit The limit to set.
|
|
128
|
+
* @returns The query builder.
|
|
129
|
+
*/
|
|
130
|
+
abstract limit(limit: number): this;
|
|
131
|
+
/**
|
|
132
|
+
* Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
|
|
133
|
+
* determines the order in which they are applied.
|
|
134
|
+
* @param fieldName The name of the field to sort by.
|
|
135
|
+
* @param asc Whether to sort in ascending order. Defaults to true.
|
|
136
|
+
* @returns The query builder.
|
|
137
|
+
*/
|
|
138
|
+
abstract sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
|
|
139
|
+
}
|
|
140
|
+
export interface HasDereference {
|
|
141
|
+
/**
|
|
142
|
+
* Dereferences the document references in the result of this query. For example, collection.query().snapshot()
|
|
143
|
+
* returns an array of DocumentReference objects, but collection.query().dereference().snapshot() returns an array of
|
|
144
|
+
* the actual document data.
|
|
145
|
+
*/
|
|
146
|
+
dereference(): any;
|
|
147
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MutationContext } from './mutation.public-context';
|
|
2
|
+
import { ApiCallContext } from './api-call.public-context';
|
|
3
|
+
import { QueryContext } from './query.public-context';
|
|
4
|
+
import { AiChatbotActionType, DatabaseActionType, TopicActionType } from './bundle-data.public-types';
|
|
5
|
+
import { ClientConnectionState } from './socket.public-types';
|
|
6
|
+
import { DocumentData } from './document.public-types';
|
|
7
|
+
import { MutationType } from './mutation.public-types';
|
|
8
|
+
import { ClientId, SquidDocId } from './communication.public-types';
|
|
9
|
+
import { TopicReadContext, TopicWriteContext } from './topic.public-context';
|
|
10
|
+
import { NativeQueryContext } from './native-query.public-context';
|
|
11
|
+
import { DistributedLockContext } from './distributed-lock.public-context';
|
|
12
|
+
import { GraphqlContext } from './graphql.public-context';
|
|
13
|
+
import { AiChatbotChatContext, AiChatbotMutationContext } from './ai-chatbot.public-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 interface SquidFile {
|
|
50
|
+
data: Uint8Array;
|
|
51
|
+
fieldName: string;
|
|
52
|
+
mimetype: string;
|
|
53
|
+
originalName: string;
|
|
54
|
+
size: number;
|
|
55
|
+
encoding?: string;
|
|
56
|
+
}
|
|
57
|
+
export type ActionMethodDecorator<U> = <T extends U>(target: Object, propertyName: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
|
|
8
|
+
export type FunctionName = string;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export type SquidDeveloperId = string;
|
|
6
|
+
/** @deprecated. Use ENVIRONMENT_IDS. */
|
|
7
|
+
export declare const allEnvironmentIds: Array<EnvironmentId>;
|
|
8
|
+
/** A type alias for an integration id. */
|
|
9
|
+
export type IntegrationId = string;
|
|
10
|
+
export type ClientId = string;
|
|
11
|
+
export type SquidDocId = string;
|
|
12
|
+
export type ClientRequestId = string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AppId, ClientId } from './communication.public-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
|
+
}
|