@squidcloud/client 1.0.168 → 1.0.170

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.
Files changed (106) hide show
  1. package/dist/cjs/index.js +24 -11
  2. package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +25 -0
  3. package/dist/internal-common/src/public-types/ai-chatbot.public-context.d.ts +12 -0
  4. package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +31 -0
  5. package/dist/internal-common/src/public-types/api-call.public-context.d.ts +14 -0
  6. package/dist/internal-common/src/public-types/application.public-types.d.ts +131 -0
  7. package/dist/internal-common/src/public-types/base-query-builder.public-types.d.ts +147 -0
  8. package/dist/internal-common/src/public-types/bundle-api.public-types.d.ts +57 -0
  9. package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +8 -0
  10. package/dist/internal-common/src/public-types/communication.public-types.d.ts +12 -0
  11. package/dist/internal-common/src/public-types/context.public-types.d.ts +40 -0
  12. package/dist/internal-common/src/public-types/distributed-lock.public-context.d.ts +4 -0
  13. package/dist/internal-common/src/public-types/document.public-types.d.ts +32 -0
  14. package/dist/internal-common/src/public-types/graphql.public-context.d.ts +7 -0
  15. package/dist/internal-common/src/public-types/graphql.public-types.d.ts +9 -0
  16. package/dist/internal-common/src/public-types/http-status.enum.d.ts +50 -0
  17. package/dist/internal-common/src/public-types/integration.public-types.d.ts +61 -0
  18. package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.d.ts +32 -0
  19. package/dist/internal-common/src/public-types/integrations/api.types.d.ts +81 -0
  20. package/dist/internal-common/src/public-types/integrations/auth.types.d.ts +54 -0
  21. package/dist/internal-common/src/public-types/integrations/database.types.d.ts +228 -0
  22. package/dist/internal-common/src/public-types/integrations/observability.types.d.ts +24 -0
  23. package/dist/internal-common/src/public-types/integrations/queue-types.d.ts +40 -0
  24. package/dist/internal-common/src/public-types/integrations/schemas.d.ts +72 -0
  25. package/dist/internal-common/src/public-types/mutation.public-context.d.ts +14 -0
  26. package/dist/internal-common/src/public-types/mutation.public-types.d.ts +53 -0
  27. package/dist/internal-common/src/public-types/native-query.public-context.d.ts +7 -0
  28. package/dist/internal-common/src/public-types/native-query.public-types.d.ts +16 -0
  29. package/dist/internal-common/src/public-types/pagination.public-types.d.ts +62 -0
  30. package/dist/internal-common/src/public-types/query.public-context.d.ts +137 -0
  31. package/dist/internal-common/src/public-types/query.public-types.d.ts +64 -0
  32. package/dist/internal-common/src/public-types/regions.public-types.d.ts +5 -0
  33. package/dist/internal-common/src/public-types/schema.public-types.d.ts +46 -0
  34. package/dist/internal-common/src/public-types/secret.public-types.d.ts +16 -0
  35. package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +24 -0
  36. package/dist/internal-common/src/public-types/socket.public-types.d.ts +5 -0
  37. package/dist/internal-common/src/public-types/topic.public-context.d.ts +10 -0
  38. package/dist/internal-common/src/public-types/typescript.public-types.d.ts +15 -0
  39. package/dist/internal-common/src/public-utils/id-utils.d.ts +6 -0
  40. package/dist/internal-common/src/types/ai-assistant.types.d.ts +1 -0
  41. package/dist/internal-common/src/types/ai-chatbot.types.d.ts +1 -0
  42. package/dist/internal-common/src/types/api.types.d.ts +2 -0
  43. package/dist/internal-common/src/types/application.types.d.ts +1 -0
  44. package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
  45. package/dist/internal-common/src/types/backend-run.types.d.ts +1 -0
  46. package/dist/internal-common/src/types/bundle-data.types.d.ts +1 -0
  47. package/dist/internal-common/src/types/communication.types.d.ts +1 -0
  48. package/dist/internal-common/src/types/document.types.d.ts +1 -0
  49. package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
  50. package/dist/internal-common/src/types/openapi.types.d.ts +1 -0
  51. package/dist/internal-common/src/types/query.types.d.ts +1 -0
  52. package/dist/internal-common/src/types/secret.types.d.ts +11 -0
  53. package/dist/internal-common/src/types/socket.types.d.ts +1 -0
  54. package/dist/internal-common/src/utils/array.d.ts +1 -0
  55. package/dist/internal-common/src/utils/assert.d.ts +1 -0
  56. package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
  57. package/dist/internal-common/src/utils/http.d.ts +2 -0
  58. package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
  59. package/dist/internal-common/src/utils/object.d.ts +5 -0
  60. package/dist/internal-common/src/utils/serialization.d.ts +5 -0
  61. package/dist/internal-common/src/utils/validation.d.ts +24 -0
  62. package/dist/internal-common/src/websocket.impl.d.ts +21 -0
  63. package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -0
  64. package/dist/typescript-client/src/ai-assistant-client.d.ts +73 -0
  65. package/dist/typescript-client/src/ai-chatbot-client.d.ts +168 -0
  66. package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +1 -0
  67. package/dist/typescript-client/src/ai.types.d.ts +60 -0
  68. package/dist/typescript-client/src/api.manager.d.ts +11 -0
  69. package/dist/typescript-client/src/auth.manager.d.ts +27 -0
  70. package/dist/typescript-client/src/backend-function.manager.d.ts +9 -0
  71. package/dist/typescript-client/src/backend-transforms.d.ts +0 -0
  72. package/dist/typescript-client/src/client-id.service.d.ts +27 -0
  73. package/dist/typescript-client/src/collection-reference.d.ts +80 -0
  74. package/dist/typescript-client/src/collection-reference.factory.d.ts +1 -0
  75. package/dist/typescript-client/src/connection-details.d.ts +23 -0
  76. package/dist/typescript-client/src/data.manager.d.ts +5 -0
  77. package/dist/typescript-client/src/destruct.manager.d.ts +13 -0
  78. package/dist/typescript-client/src/distributed-lock.manager.d.ts +16 -0
  79. package/dist/typescript-client/src/document-identity.service.d.ts +1 -0
  80. package/dist/typescript-client/src/document-reference.d.ts +149 -0
  81. package/dist/typescript-client/src/document-reference.factory.d.ts +1 -0
  82. package/dist/typescript-client/src/document-store.d.ts +14 -0
  83. package/dist/typescript-client/src/graphql-client.d.ts +14 -0
  84. package/dist/typescript-client/src/graphql-client.factory.d.ts +11 -0
  85. package/dist/typescript-client/src/index.d.ts +11 -0
  86. package/dist/typescript-client/src/mutation/mutation-sender.d.ts +1 -0
  87. package/dist/typescript-client/src/native-query-manager.d.ts +7 -0
  88. package/dist/typescript-client/src/public-types.d.ts +37 -0
  89. package/dist/typescript-client/src/public-utils.d.ts +1 -0
  90. package/dist/typescript-client/src/query/deserializer.d.ts +3 -0
  91. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +161 -0
  92. package/dist/typescript-client/src/query/local-query-manager.d.ts +1 -0
  93. package/dist/typescript-client/src/query/query-builder.factory.d.ts +77 -0
  94. package/dist/typescript-client/src/query/query-sender.d.ts +1 -0
  95. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +2 -0
  96. package/dist/typescript-client/src/query/query.types.d.ts +49 -0
  97. package/dist/typescript-client/src/queue.manager.d.ts +7 -0
  98. package/dist/typescript-client/src/rate-limiter.d.ts +32 -0
  99. package/dist/typescript-client/src/rpc.manager.d.ts +30 -0
  100. package/dist/typescript-client/src/secret.client.d.ts +23 -0
  101. package/dist/typescript-client/src/socket.manager.d.ts +1 -0
  102. package/dist/typescript-client/src/squid.d.ts +245 -0
  103. package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -0
  104. package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -0
  105. package/dist/typescript-client/src/types.d.ts +6 -0
  106. package/package.json +3 -1
package/dist/cjs/index.js CHANGED
@@ -28401,6 +28401,7 @@ var IntegrationType;
28401
28401
  IntegrationType["built_in_db"] = "built_in_db";
28402
28402
  IntegrationType["mongo"] = "mongo";
28403
28403
  IntegrationType["mysql"] = "mysql";
28404
+ IntegrationType["clickhouse"] = "clickhouse";
28404
28405
  IntegrationType["mssql"] = "mssql";
28405
28406
  IntegrationType["postgres"] = "postgres";
28406
28407
  IntegrationType["cockroach"] = "cockroach";
@@ -28430,7 +28431,6 @@ var IntegrationType;
28430
28431
  IntegrationType["documentdb"] = "documentdb";
28431
28432
  IntegrationType["dynamodb"] = "dynamodb";
28432
28433
  IntegrationType["cassandra"] = "cassandra";
28433
- IntegrationType["clickhouse"] = "clickhouse";
28434
28434
  IntegrationType["alloydb"] = "alloydb";
28435
28435
  IntegrationType["spanner"] = "spanner";
28436
28436
  IntegrationType["db2"] = "db2";
@@ -28480,6 +28480,7 @@ const DatabaseIntegrationTypes = [
28480
28480
  IntegrationType.built_in_db,
28481
28481
  IntegrationType.mongo,
28482
28482
  IntegrationType.mysql,
28483
+ IntegrationType.clickhouse,
28483
28484
  IntegrationType.bigquery,
28484
28485
  IntegrationType.mssql,
28485
28486
  IntegrationType.postgres,
@@ -30353,6 +30354,7 @@ function map(project, thisArg) {
30353
30354
 
30354
30355
 
30355
30356
  class AiChatbotClient {
30357
+ /** @internal */
30356
30358
  constructor(rpcManager, socketManager, integrationId) {
30357
30359
  this.rpcManager = rpcManager;
30358
30360
  this.socketManager = socketManager;
@@ -30446,6 +30448,7 @@ class AiChatbotClient {
30446
30448
  }
30447
30449
  }
30448
30450
  class AiChatbotProfileReference {
30451
+ /** @internal */
30449
30452
  constructor(client, integrationId, profileId) {
30450
30453
  this.client = client;
30451
30454
  this.integrationId = integrationId;
@@ -30550,6 +30553,7 @@ class AiChatbotProfileReference {
30550
30553
  }
30551
30554
  }
30552
30555
  class AiChatbotContextReference {
30556
+ /** @internal */
30553
30557
  constructor(client, integrationId, profileId, id) {
30554
30558
  this.client = client;
30555
30559
  this.integrationId = integrationId;
@@ -30625,6 +30629,7 @@ class AiChatbotContextReference {
30625
30629
  }
30626
30630
  }
30627
30631
  class AiChatbotInstructionReference {
30632
+ /** @internal */
30628
30633
  constructor(client, integrationId, profileId, id) {
30629
30634
  this.client = client;
30630
30635
  this.integrationId = integrationId;
@@ -30764,6 +30769,7 @@ function validateFieldSort(fieldSort) {
30764
30769
  (0,dist.assertTruthy)(isRightType(safeFieldSort.asc, 'boolean'), 'Asc needs to be boolean');
30765
30770
  validateFieldName(safeFieldSort.fieldName);
30766
30771
  }
30772
+ /** @internal */
30767
30773
  function validateOpenIdProvider(openIdProvider) {
30768
30774
  assertTruthy(openIdProvider, 'INVALID_PROVIDER');
30769
30775
  validateOpenIdProviderType(openIdProvider.providerType);
@@ -30772,6 +30778,7 @@ function validateOpenIdProvider(openIdProvider) {
30772
30778
  assertTruthy(openIdProvider.domain, 'INVALID_DOMAIN');
30773
30779
  return openIdProvider;
30774
30780
  }
30781
+ /** @internal */
30775
30782
  function validateOpenIdProviderType(providerType) {
30776
30783
  const providerArray = ['auth0'];
30777
30784
  assertTruthy(providerArray.includes(providerType), 'INVALID_OPEN_ID_PROVIDER_TYPE');
@@ -48197,13 +48204,13 @@ class GraphQLClient {
48197
48204
 
48198
48205
  ;// CONCATENATED MODULE: ./src/ai-chatbot-client.factory.ts
48199
48206
 
48207
+ /** @internal */
48200
48208
  class AiChatbotClientFactory {
48201
48209
  constructor(rpcManager, socketManager) {
48202
48210
  this.rpcManager = rpcManager;
48203
48211
  this.socketManager = socketManager;
48204
48212
  this.chatbotsMap = new Map();
48205
48213
  }
48206
- /** @internal */
48207
48214
  getChatbot(aiIntegrationId) {
48208
48215
  let client = this.chatbotsMap.get(aiIntegrationId);
48209
48216
  if (client)
@@ -48343,6 +48350,11 @@ function enableDebugLogs() {
48343
48350
  globalObj['SQUID_DEBUG_ENABLED'] = true;
48344
48351
  }
48345
48352
  /** @internal */
48353
+ function disableDebugLogs() {
48354
+ const globalObj = getGlobal();
48355
+ globalObj['SQUID_DEBUG_ENABLED'] = false;
48356
+ }
48357
+ /** @internal */
48346
48358
  class DebugLogger {
48347
48359
  static log(...args) {
48348
48360
  DebugLogger.info(...args);
@@ -48422,6 +48434,7 @@ class ClientIdService {
48422
48434
 
48423
48435
  ;// CONCATENATED MODULE: ./src/collection-reference.factory.ts
48424
48436
 
48437
+ /** @internal */
48425
48438
  class CollectionReferenceFactory {
48426
48439
  constructor(documentReferenceFactory, queryBuilderFactory, querySubscriptionManager) {
48427
48440
  this.documentReferenceFactory = documentReferenceFactory;
@@ -48643,6 +48656,7 @@ function reduceMutations(mutations) {
48643
48656
 
48644
48657
  /** Two transactions cannot run in parallel - this mutex is used for blocking a second transaction. */
48645
48658
  const RUN_IN_TRANSACTION_MUTEX = 'dataManager_runInTransaction';
48659
+ /** @internal */
48646
48660
  class DataManager {
48647
48661
  constructor(documentStore, mutationSender, socketManager, querySubscriptionManager, queryBuilderFactory, lockManager, destructManager, documentIdentityService, querySender) {
48648
48662
  this.documentStore = documentStore;
@@ -49472,6 +49486,7 @@ class DistributedLockImpl {
49472
49486
 
49473
49487
  ;// CONCATENATED MODULE: ./src/document-identity.service.ts
49474
49488
 
49489
+ /** @internal */
49475
49490
  class DocumentIdentityService {
49476
49491
  constructor(documentStore, destructManager) {
49477
49492
  this.documentStore = documentStore;
@@ -49498,12 +49513,11 @@ class DocumentIdentityService {
49498
49513
 
49499
49514
 
49500
49515
 
49516
+ /** @internal */
49501
49517
  class DocumentReferenceFactory {
49502
49518
  constructor(documentIdentityService) {
49503
49519
  this.documentIdentityService = documentIdentityService;
49504
- /** @internal */
49505
49520
  this.documents = new Map();
49506
- /** @internal */
49507
49521
  this.documentsForCollection = new Map();
49508
49522
  this.documentIdentityService.observeChanges().subscribe(this.migrateDocIds.bind(this));
49509
49523
  }
@@ -49522,16 +49536,10 @@ class DocumentReferenceFactory {
49522
49536
  setDataManager(dataManager) {
49523
49537
  this.dataManager = dataManager;
49524
49538
  }
49525
- /**
49526
- * @internal
49527
- */
49528
49539
  getDocumentsForCollection(integrationId, collectionName) {
49529
49540
  const collectionKey = this.getCollectionKey(integrationId, collectionName);
49530
49541
  return (this.documentsForCollection.get(collectionKey) || []).filter(d => d.hasData);
49531
49542
  }
49532
- /**
49533
- * @internal
49534
- */
49535
49543
  migrateDocIds(idResolutionMap) {
49536
49544
  for (const [, reference] of this.documents) {
49537
49545
  reference.migrateDocIds(idResolutionMap);
@@ -49679,6 +49687,7 @@ class GraphQLClientFactory {
49679
49687
 
49680
49688
 
49681
49689
 
49690
+ /** @internal */
49682
49691
  class MutationSender {
49683
49692
  constructor(rpcManager, lockManager, querySender) {
49684
49693
  this.rpcManager = rpcManager;
@@ -49713,13 +49722,13 @@ class MutationSender {
49713
49722
  ;// CONCATENATED MODULE: ./src/query/local-query-manager.ts
49714
49723
 
49715
49724
 
49725
+ /** @internal */
49716
49726
  class LocalQueryManager {
49717
49727
  constructor(documentStore, documentReferenceFactory, querySubscriptionManager) {
49718
49728
  this.documentStore = documentStore;
49719
49729
  this.documentReferenceFactory = documentReferenceFactory;
49720
49730
  this.querySubscriptionManager = querySubscriptionManager;
49721
49731
  }
49722
- /** @internal */
49723
49732
  peek(query) {
49724
49733
  if (!this.querySubscriptionManager.findValidParentOfQuery(query))
49725
49734
  return [];
@@ -49829,6 +49838,7 @@ const arrayMergeCustomizer = (a, b) => {
49829
49838
  // Exported only for tests
49830
49839
  const FETCH_BEYOND_LIMIT = 100;
49831
49840
  const LIMIT_UNDERFLOW_TRIGGER = 20;
49841
+ /** @internal */
49832
49842
  class QuerySubscriptionManager {
49833
49843
  constructor(rpcManager, clientIdService, documentStore, destructManager, documentIdentityService, querySender) {
49834
49844
  this.rpcManager = rpcManager;
@@ -51037,6 +51047,7 @@ function createWebSocketWrapper(url, opts = {}) {
51037
51047
 
51038
51048
 
51039
51049
 
51050
+ /** @internal */
51040
51051
  class SocketManager {
51041
51052
  constructor(clientIdService, region, appId, messageNotificationWrapper = NOOP_FN, destructManager, authManager) {
51042
51053
  this.clientIdService = clientIdService;
@@ -51233,6 +51244,7 @@ class SocketManager {
51233
51244
  ;// CONCATENATED MODULE: ./src/query/query-sender.ts
51234
51245
 
51235
51246
 
51247
+ /** @internal */
51236
51248
  class QuerySender {
51237
51249
  constructor(rpcManager, destructManager) {
51238
51250
  this.rpcManager = rpcManager;
@@ -51462,6 +51474,7 @@ class AiAssistantClient {
51462
51474
  * through its methods.
51463
51475
  */
51464
51476
  class AiClient {
51477
+ /** @internal */
51465
51478
  constructor(aiChatbotClientFactory, rpcManager) {
51466
51479
  this.aiChatbotClientFactory = aiChatbotClientFactory;
51467
51480
  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,131 @@
1
+ import { AuthIntegrationType, DatabaseIntegrationType, IntegrationConfig, IntegrationConfigTypes, IntegrationSchema, IntegrationSchemaKeys, IntegrationSchemaTypes, IntegrationTypeWithConfig } from './integrations/schemas';
2
+ import { IntegrationType } from './integration.public-types';
3
+ import { 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
+ interface BaseUpsertIntegrationRequest<T extends IntegrationTypeWithConfig, C extends IntegrationConfig> {
99
+ id: IntegrationId;
100
+ type: T;
101
+ config: Partial<C>;
102
+ }
103
+ type ConfigurationTypes = {
104
+ [K in IntegrationTypeWithConfig]: IntegrationConfigTypes[K];
105
+ };
106
+ type UpsertIntegrationRequests = {
107
+ [K in IntegrationTypeWithConfig]: BaseUpsertIntegrationRequest<K, ConfigurationTypes[K]>;
108
+ };
109
+ export type UpsertDataIntegrationRequest = UpsertIntegrationRequests[DatabaseIntegrationType];
110
+ export type UpsertGraphQLIntegrationRequest = UpsertIntegrationRequests[IntegrationType.graphql];
111
+ export type UpsertApiIntegrationRequest = UpsertIntegrationRequests[IntegrationType.api];
112
+ export type UpsertAiChatbotIntegrationRequest = UpsertIntegrationRequests[IntegrationType.ai_chatbot];
113
+ export type UpsertKafkaIntegrationRequest = UpsertIntegrationRequests[IntegrationType.kafka];
114
+ export type UpsertConfluentIntegrationRequest = UpsertIntegrationRequests[IntegrationType.confluent];
115
+ export type UpsertAuthIntegrationRequest = UpsertIntegrationRequests[AuthIntegrationType];
116
+ interface BaseUpsertIntegrationSchemaRequest<T extends IntegrationType, S extends IntegrationSchema> {
117
+ id: IntegrationId;
118
+ type: T;
119
+ schema: S;
120
+ }
121
+ type SchemaTypes = {
122
+ [K in IntegrationSchemaKeys]: IntegrationSchemaTypes[K];
123
+ };
124
+ type UpsertIntegrationSchemaRequests = {
125
+ [K in IntegrationSchemaKeys]: BaseUpsertIntegrationSchemaRequest<K, SchemaTypes[K]>;
126
+ };
127
+ export type UpsertIntegrationSchemaRequest = UpsertDataIntegrationSchemaRequest | UpsertGraphQLIntegrationSchemaRequest | UpsertApiIntegrationSchemaRequest;
128
+ export type UpsertDataIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[DatabaseIntegrationType];
129
+ export type UpsertGraphQLIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.graphql];
130
+ export type UpsertApiIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.api];
131
+ 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;