@squidcloud/client 1.0.337 → 1.0.339

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 (89) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +290 -62
  3. package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +9 -2
  4. package/dist/internal-common/src/public-types/ai-matchmaking.types.d.ts +6 -0
  5. package/dist/internal-common/src/public-types/backend.public-types.d.ts +13 -0
  6. package/dist/internal-common/src/public-types/communication.public-types.d.ts +7 -0
  7. package/dist/internal-common/src/public-types/context.public-types.d.ts +12 -1
  8. package/dist/internal-common/src/public-types/document.public-types.d.ts +42 -12
  9. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +21 -0
  10. package/dist/internal-common/src/public-types/integration.public-types.d.ts +16 -2
  11. package/dist/internal-common/src/public-types/integrations/api.public-types.d.ts +0 -11
  12. package/dist/internal-common/src/public-types/query.public-types.d.ts +35 -7
  13. package/dist/internal-common/src/public-types/scheduler.public-types.d.ts +13 -4
  14. package/dist/internal-common/src/public-types/secret.public-types.d.ts +24 -7
  15. package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +12 -0
  16. package/dist/internal-common/src/public-types/typescript.public-types.d.ts +0 -3
  17. package/dist/typescript-client/src/admin-client.d.ts +1 -0
  18. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +77 -2
  19. package/dist/typescript-client/src/agent/ai-agent-client.d.ts +1 -0
  20. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +30 -0
  21. package/dist/typescript-client/src/ai-assistant-client.d.ts +3 -2
  22. package/dist/typescript-client/src/ai-audio-client.d.ts +15 -0
  23. package/dist/typescript-client/src/ai-client.d.ts +5 -0
  24. package/dist/typescript-client/src/ai-image-client.d.ts +16 -1
  25. package/dist/typescript-client/src/ai-matchmaking-client.d.ts +57 -11
  26. package/dist/typescript-client/src/ai.types.d.ts +68 -15
  27. package/dist/typescript-client/src/api-client.d.ts +1 -0
  28. package/dist/typescript-client/src/auth.manager.d.ts +6 -1
  29. package/dist/typescript-client/src/collection-reference.d.ts +4 -0
  30. package/dist/typescript-client/src/connection-details.d.ts +1 -0
  31. package/dist/typescript-client/src/data.manager.d.ts +1 -5
  32. package/dist/typescript-client/src/destruct.manager.d.ts +1 -17
  33. package/dist/typescript-client/src/distributed-lock.manager.d.ts +4 -1
  34. package/dist/typescript-client/src/document-reference.d.ts +1 -0
  35. package/dist/typescript-client/src/document-store.d.ts +1 -17
  36. package/dist/typescript-client/src/extraction-client.d.ts +1 -0
  37. package/dist/typescript-client/src/integration-client.d.ts +1 -0
  38. package/dist/typescript-client/src/observability-client.d.ts +5 -1
  39. package/dist/typescript-client/src/personal-storage-client.d.ts +23 -4
  40. package/dist/typescript-client/src/public-types.d.ts +1 -4
  41. package/dist/typescript-client/src/query/deserializer.d.ts +1 -0
  42. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +46 -8
  43. package/dist/typescript-client/src/query/pagination.d.ts +10 -10
  44. package/dist/typescript-client/src/query/query-builder.factory.d.ts +12 -4
  45. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +1 -2
  46. package/dist/typescript-client/src/query/query.types.d.ts +8 -52
  47. package/dist/typescript-client/src/query/snapshot-emitter.d.ts +5 -0
  48. package/dist/typescript-client/src/query-utils.d.ts +5 -1
  49. package/dist/typescript-client/src/queue.manager.d.ts +5 -0
  50. package/dist/typescript-client/src/scheduler-client.d.ts +1 -0
  51. package/dist/typescript-client/src/secret.client.d.ts +2 -0
  52. package/dist/typescript-client/src/squid-http-client.d.ts +4 -0
  53. package/dist/typescript-client/src/squid.d.ts +16 -4
  54. package/dist/typescript-client/src/storage-client.d.ts +55 -4
  55. package/dist/typescript-client/src/types.d.ts +4 -1
  56. package/dist/typescript-client/src/version.d.ts +2 -1
  57. package/package.json +6 -2
  58. package/dist/internal-common/src/metric-name.d.ts +0 -9
  59. package/dist/internal-common/src/public-types/application.public-types.d.ts +0 -94
  60. package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +0 -33
  61. package/dist/internal-common/src/public-types/mutation.public-types.d.ts +0 -54
  62. package/dist/internal-common/src/public-types/storage.types.d.ts +0 -9
  63. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -21
  64. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -18
  65. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -127
  66. package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -1
  67. package/dist/internal-common/src/types/ai-assistant.types.d.ts +0 -1
  68. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -53
  69. package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
  70. package/dist/internal-common/src/types/communication.types.d.ts +0 -1
  71. package/dist/internal-common/src/types/document.types.d.ts +0 -1
  72. package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
  73. package/dist/internal-common/src/types/observability.types.d.ts +0 -71
  74. package/dist/internal-common/src/types/query.types.d.ts +0 -10
  75. package/dist/internal-common/src/types/secret.types.d.ts +0 -2
  76. package/dist/internal-common/src/types/socket.types.d.ts +0 -1
  77. package/dist/internal-common/src/types/time-units.d.ts +0 -1
  78. package/dist/internal-common/src/utils/array.d.ts +0 -1
  79. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
  80. package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
  81. package/dist/internal-common/src/utils/http.d.ts +0 -1
  82. package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
  83. package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
  84. package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
  85. package/dist/internal-common/src/utils/object.d.ts +0 -49
  86. package/dist/internal-common/src/utils/serialization.d.ts +0 -5
  87. package/dist/internal-common/src/utils/squid.constants.d.ts +0 -1
  88. package/dist/internal-common/src/utils/validation.d.ts +0 -19
  89. package/dist/internal-common/src/websocket.impl.d.ts +0 -26
@@ -4,7 +4,8 @@ import { DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query
4
4
  import { Pagination, PaginationOptions } from './pagination';
5
5
  import { SnapshotEmitter } from './snapshot-emitter';
6
6
  /**
7
- * Interface used solely for @inheritDoc
7
+ * Interface used solely for inheritDoc
8
+ * @category Database
8
9
  */
9
10
  export interface HasDereference {
10
11
  /**
@@ -16,6 +17,7 @@ export interface HasDereference {
16
17
  }
17
18
  /**
18
19
  * Query builder base class.
20
+ * @category Database
19
21
  */
20
22
  export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
21
23
  /**
@@ -129,7 +131,6 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
129
131
  * @returns The query builder.
130
132
  */
131
133
  arrayNotIncludes(fieldName: (keyof MyDocType & FieldName) | string, values: Array<PrimitiveFieldType>): this;
132
- throwIfInvalidLikePattern(pattern: string): void;
133
134
  /**
134
135
  * Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
135
136
  * if none is provided.
@@ -149,8 +150,12 @@ export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
149
150
  * Returns the query object built by this query builder.
150
151
  */
151
152
  abstract build(): Query;
153
+ private throwIfInvalidLikePattern;
152
154
  }
153
- /** A query builder that can be used to build a query that returns a list of documents. */
155
+ /**
156
+ * A query builder that can be used to build a query that returns a list of documents.
157
+ * @category Database
158
+ */
154
159
  export declare class QueryBuilder<DocumentType extends DocumentData> extends BaseQueryBuilder<DocumentType> implements SnapshotEmitter<DocumentReference<DocumentType>>, HasDereference {
155
160
  private readonly collectionName;
156
161
  private readonly integrationId;
@@ -209,7 +214,10 @@ export declare class QueryBuilder<DocumentType extends DocumentData> extends Bas
209
214
  serialize(): SerializedSimpleQuery;
210
215
  paginate(options?: Partial<PaginationOptions>): Pagination<DocumentReference<DocumentType>>;
211
216
  }
212
- /** Describes the changes to a query result. */
217
+ /**
218
+ * Describes the changes to a query result.
219
+ * @category Database
220
+ */
213
221
  export declare class Changes<DocumentType extends DocumentData> {
214
222
  /** The newly inserted documents to the query result */
215
223
  readonly inserts: Array<DocumentReference<DocumentType>>;
@@ -1,2 +1 @@
1
- export declare const FETCH_BEYOND_LIMIT = 100;
2
- export declare const LIMIT_UNDERFLOW_TRIGGER = 20;
1
+ export {};
@@ -1,60 +1,16 @@
1
- import { BehaviorSubject, Observable, ReplaySubject } from 'rxjs';
2
- import { Alias, ClientRequestId, JoinCondition, Query, SquidDocument } from '../public-types';
1
+ import { Alias, SquidDocument } from '../public-types';
3
2
  /**
4
- * Defines the state and behavior of an ongoing query, including
5
- * query dependencies, data streaming, join conditions, and limit
6
- * underflow handling for dynamic data fetching.
3
+ * Represents a collection of documents associated with a specific alias
4
+ * in a query, typically used in joined query results.
5
+ * @category Database
7
6
  */
8
- export interface OngoingQuery {
9
- clientRequestId: ClientRequestId;
10
- query: Query;
11
- supportedQueries: Array<OngoingQuery>;
12
- supportingOngoingQuery?: OngoingQuery;
13
- gotInitialResponse: boolean;
14
- activated: boolean;
15
- joinCondition?: JoinCondition;
16
- alias: Alias;
17
- dataSubject: BehaviorSubject<Array<SquidDocument> | null>;
18
- queryRegistered: BehaviorSubject<boolean>;
19
- /**
20
- * In case that this query is a parent of another query (that is, the other query is a subset of this query), this
21
- * query should not be unsubscribed from the server until we registered the child query in the server.
22
- */
23
- unsubscribeBlockerCount: BehaviorSubject<number>;
24
- subscribe: boolean;
25
- /**
26
- * In case of joins, and if this ongoing query is the root, this field emits all the supported observables
27
- * for example `A.join(B, {...some join condition...}).join(C, {...some join condition}`.
28
- * This field will emit [A.subject.pipe(), B.subject.pipe(), C.subject.pipe()]. Any new supported queries will be
29
- * added here.
30
- */
31
- allObservables?: ReplaySubject<Array<Observable<DocsAndAlias>>>;
32
- isEmptyForJoin: boolean;
7
+ export interface DocsAndAlias {
33
8
  /**
34
- * If the query is a supporting query (right side of the join) and the query has '==' condition on the join column,
35
- * there is no need to emit a new query when additional values are added to the left side of the join since the right
36
- * side will not change.
9
+ * An array of documents retrieved as part of the query.
37
10
  */
38
- canExpandForJoin: boolean;
39
- done: boolean;
40
- isInFlight: boolean;
41
- forceFetchFromServer: boolean;
11
+ docs: Array<SquidDocument>;
42
12
  /**
43
- * If there's a limit, we request `limit + FETCH_BEYOND_LIMIT` documents from the server.
44
- * If we got that many documents, that means there may be even more. In that case, if our result set goes below
45
- * `limit + LIMIT_UNDERFLOW_TRIGGER` documents (due to local or remote deletions), we need to resend the query to the
46
- * server to potentially get more documents.
47
- * If the number of documents is less than `limit + FETCH_BEYOND_LIMIT`, that means there are not that many documents
48
- * on the server, so we don't need to resend the query regardless of how small our result size is or becomes.
13
+ * The alias associated with the documents in a joined query context.
49
14
  */
50
- limitUnderflowState: LimitUnderflowState;
51
- }
52
- export declare enum LimitUnderflowState {
53
- UNKNOWN = 0,
54
- DISABLED = 1,
55
- ENABLED = 2
56
- }
57
- export interface DocsAndAlias {
58
- docs: Array<SquidDocument>;
59
15
  alias: Alias;
60
16
  }
@@ -1,6 +1,11 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { SerializedQuery } from '../../../internal-common/src/public-types/serialized-query.public-types';
3
3
  import { Pagination, PaginationOptions } from './pagination';
4
+ /**
5
+ * Interface for emitting query results in a reactive manner,
6
+ * supporting both synchronous and asynchronous access.
7
+ * @category Database
8
+ */
4
9
  export interface SnapshotEmitter<ReturnType> {
5
10
  /**
6
11
  * Returns a promise that resolves to the query results.
@@ -1,6 +1,9 @@
1
1
  import { DocumentData } from '../../internal-common/src/public-types/document.public-types';
2
2
  import { QueryBuilder } from './query/query-builder.factory';
3
- /** Result of the `visitQueryResults` function. */
3
+ /**
4
+ * Result of the `visitQueryResults` function.
5
+ * @category Database
6
+ */
4
7
  export interface VisitQueryResultsStats {
5
8
  /** Count of documents visited. */
6
9
  count: number;
@@ -10,5 +13,6 @@ export interface VisitQueryResultsStats {
10
13
  /**
11
14
  * Reads all objects from the query in a safe way (with pagination) and calls callback() on every object.
12
15
  * The iteration is interrupted if error is thrown.
16
+ * @category Database
13
17
  */
14
18
  export declare function visitQueryResults<T extends DocumentData>(query: QueryBuilder<T>, callback: (t: T) => Promise<unknown>, pageSize?: number): Promise<VisitQueryResultsStats>;
@@ -1,4 +1,9 @@
1
1
  import { Observable } from 'rxjs';
2
+ /**
3
+ * Interface defining the operations available for a queue manager.
4
+ * Allows producing and consuming messages from a queue.
5
+ * @category Queue
6
+ */
2
7
  export interface QueueManager<T> {
3
8
  /** Publish messages to the queue */
4
9
  produce(messages: T[]): Promise<void>;
@@ -2,6 +2,7 @@ import { SchedulerInfo } from './public-types';
2
2
  /**
3
3
  * SchedulerClient provides methods to manage schedulers,
4
4
  * including listing, enabling, and disabling scheduled tasks.
5
+ * @category Platform
5
6
  */
6
7
  export declare class SchedulerClient {
7
8
  private readonly rpcManager;
@@ -2,6 +2,7 @@ import { SecretEntry, SecretKey, SecretValue, SetSecretRequestEntry } from './pu
2
2
  /**
3
3
  * SecretClient provides methods for managing secrets, including retrieval,
4
4
  * update, and deletion of stored secrets and API keys.
5
+ * @category Secret
5
6
  */
6
7
  export declare class SecretClient {
7
8
  private readonly rpcManager;
@@ -34,6 +35,7 @@ export declare class SecretClient {
34
35
  /**
35
36
  * ApiKeysSecretClient manages API key secrets, providing methods
36
37
  * for retrieval, creation, and deletion of API keys.
38
+ * @category Secret
37
39
  */
38
40
  export declare class ApiKeysSecretClient {
39
41
  private readonly rpcManager;
@@ -1,7 +1,11 @@
1
1
  /** A response object with type T for the body. */
2
2
  export interface HttpResponse<BodyType = unknown> {
3
+ /** HTTP status code of the response. */
3
4
  status: number;
5
+ /** HTTP status text of the response. */
4
6
  statusText: string;
7
+ /** Headers included in the response. */
5
8
  headers: Record<string, string>;
9
+ /** Response body, typed as `BodyType`. */
6
10
  body: BodyType;
7
11
  }
@@ -12,7 +12,10 @@ import { PersonalStorageClient } from './personal-storage-client';
12
12
  import { SchedulerClient } from './scheduler-client';
13
13
  import { AdminClient } from './admin-client';
14
14
  import { AiClient } from './ai-client';
15
- /** The different options that can be used to initialize a Squid instance. */
15
+ /**
16
+ * The different options that can be used to initialize a Squid instance.
17
+ * @category Platform
18
+ */
16
19
  export interface SquidOptions {
17
20
  /**
18
21
  * A function that can be used to wrap messages coming from Squid to the application. This is useful for
@@ -54,7 +57,10 @@ export interface SquidOptions {
54
57
  */
55
58
  squidDeveloperId?: SquidDeveloperId;
56
59
  }
57
- /** Authentication data provider for Squid requests. */
60
+ /**
61
+ * Authentication data provider for Squid requests.
62
+ * @category Authentication
63
+ */
58
64
  export interface SquidAuthProvider {
59
65
  /**
60
66
  * Returns a valid AccessToken or undefined if there is no active authorized session.
@@ -75,6 +81,8 @@ export interface SquidAuthProvider {
75
81
  * capabilities.
76
82
  * All public Squid functions are bound to `this` and can be used with a destructuring patterns,
77
83
  * like `const {setAuthProvider} = useSquid()`
84
+ *
85
+ * @category Platform
78
86
  */
79
87
  export declare class Squid {
80
88
  readonly options: SquidOptions;
@@ -171,7 +179,8 @@ export declare class Squid {
171
179
  * {@link https://docs.getsquid.ai/docs/backend/executables/ documentation}.
172
180
  *
173
181
  * Files support:
174
- * - To send a file to the backend, simply include it as one of the parameters; it will be received as a {@link SquidFile}.
182
+ * - To send a file to the backend, simply include it as one of the parameters; it will be received as a `SquidFile`
183
+ * on the backend.
175
184
  * - Arrays of files can also be passed directly as parameters.
176
185
  *
177
186
  * @param functionName - The name of the backend function to execute.
@@ -179,7 +188,7 @@ export declare class Squid {
179
188
  * @returns A promise that resolves to the result of the backend function.
180
189
  * @typeParam T - The expected type of the result returned by the backend function.
181
190
  */
182
- executeFunction<T = any>(functionName: string, ...params: any[]): Promise<T>;
191
+ executeFunction<T = any>(functionName: string, ...params: Array<any | File>): Promise<T>;
183
192
  /**
184
193
  * Executes a native relational query with the given parameters and returns a promise with the result.
185
194
  * See https://docs.getsquid.ai/docs/client-sdk/database/native-queries.
@@ -206,6 +215,9 @@ export declare class Squid {
206
215
  * @returns A set of AI specific clients.
207
216
  */
208
217
  ai(): AiClient;
218
+ /**
219
+ * Returns a set of functionality for interacting with API integrations.
220
+ */
209
221
  api(): ApiClient;
210
222
  admin(): AdminClient;
211
223
  storage(integrationId?: IntegrationId): StorageClient;
@@ -1,47 +1,98 @@
1
1
  import { IntegrationId } from '../../internal-common/src/public-types/communication.public-types';
2
+ /**
3
+ * Represents a request to upload a file to a specified directory within the storage bucket.
4
+ * @category Storage
5
+ */
2
6
  export interface StorageFileUploadRequest {
7
+ /** The ID of the integration where the file will be uploaded. */
3
8
  integrationId: IntegrationId;
9
+ /** The directory path within the bucket where the file should be stored. */
4
10
  dirPathInBucket: string;
11
+ /** Optional expiration time in seconds for the uploaded file. */
5
12
  expirationInSeconds?: number;
6
13
  }
14
+ /**
15
+ * Represents a request to retrieve metadata for a specific file stored in the bucket.
16
+ * @category Storage
17
+ */
7
18
  export interface GetFileMetadataRequest {
19
+ /** The ID of the integration where the file is stored. */
8
20
  integrationId: IntegrationId;
21
+ /** The path of the file within the bucket. */
9
22
  filePathInBucket: string;
10
23
  }
24
+ /**
25
+ * Represents the metadata details of a file stored in the bucket.
26
+ * @category Storage
27
+ */
11
28
  export interface GetFileMetadataResponse {
29
+ /** The name of the file. */
12
30
  filename: string;
31
+ /** The size of the file in bytes. */
13
32
  size: number;
33
+ /** The last modified timestamp of the file. */
14
34
  lastModified: Date;
35
+ /** Additional metadata associated with the file. */
15
36
  metadata: Record<string, string>;
16
37
  }
38
+ /**
39
+ * Represents a request to generate a temporary download URL for a file.
40
+ * @category Storage
41
+ */
17
42
  export interface GetDownloadUrlRequest {
43
+ /** The ID of the integration where the file is stored. */
18
44
  integrationId: IntegrationId;
45
+ /** The path of the file within the bucket. */
19
46
  filePathInBucket: string;
47
+ /** Optional expiration time in seconds for the generated URL. */
20
48
  urlExpirationInSeconds?: number;
21
49
  }
50
+ /**
51
+ * Represents the response containing a generated download URL for a file.
52
+ * @category Storage
53
+ */
22
54
  export interface GetDownloadUrlResponse {
55
+ /** The temporary URL for downloading the file. */
23
56
  url: string;
24
57
  }
58
+ /**
59
+ * Represents a request to delete multiple files from the storage bucket.
60
+ * @category Storage
61
+ */
25
62
  export interface DeleteFilesRequest {
63
+ /** The ID of the integration where the files are stored. */
26
64
  integrationId: IntegrationId;
65
+ /** An array of file paths within the bucket to be deleted. */
27
66
  filePathsInBucket: Array<string>;
28
67
  }
29
- export interface ListDirectoryContentsRequest {
30
- integrationId: IntegrationId;
31
- dirPathInBucket: string;
32
- }
68
+ /**
69
+ * Represents details of a file within a directory in the storage bucket.
70
+ * @category Storage
71
+ */
33
72
  export interface FileInDirectory {
73
+ /** The name of the file. */
34
74
  filename: string;
75
+ /** The absolute path of the file within the bucket. */
35
76
  absoluteFilePathInBucket: string;
77
+ /** The size of the file in bytes. */
36
78
  size: number;
79
+ /** The last modified timestamp of the file. */
37
80
  lastModified: Date;
38
81
  }
82
+ /**
83
+ * Represents the response containing a list of directories and files within a specified directory in the storage
84
+ * bucket.
85
+ * @category Storage
86
+ */
39
87
  export interface ListDirectoryContentsResponse {
88
+ /** An array of directory names present in the specified directory. */
40
89
  directories: Array<string>;
90
+ /** An array of files present in the specified directory. */
41
91
  files: Array<FileInDirectory>;
42
92
  }
43
93
  /**
44
94
  * StorageClient provides methods for managing files in a storage system (like S3).
95
+ * @category Storage
45
96
  */
46
97
  export declare class StorageClient {
47
98
  private readonly integrationId;
@@ -1,2 +1,5 @@
1
- /** A transactionId - alias for string */
1
+ /**
2
+ * A transactionId - alias for string
3
+ * @category Database
4
+ */
2
5
  export type TransactionId = string;
@@ -1 +1,2 @@
1
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.337";
1
+ /** The current version of the SquidCloud client package. @category Platform */
2
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.339";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.337",
3
+ "version": "1.0.339",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",
@@ -24,7 +24,9 @@
24
24
  "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
25
25
  "test:e2e": "jest --config ./test/jest-e2e.json",
26
26
  "publish:public": "npm run build && npm publish --access public",
27
- "full-bundle-size-report": "cross-env BUILD_FULL_BUNDLE_SIZE_REPORT=1 webpack --mode=production"
27
+ "full-bundle-size-report": "cross-env BUILD_FULL_BUNDLE_SIZE_REPORT=1 webpack --mode=production",
28
+ "generate-docs-html": "typedoc",
29
+ "generate-docs-markdown": "typedoc --plugin typedoc-plugin-markdown --readme none --out ./generated-docs/markdown"
28
30
  },
29
31
  "keywords": [
30
32
  "typescript",
@@ -48,6 +50,8 @@
48
50
  "rxjs": ">=7.5.7 <8.0.0"
49
51
  },
50
52
  "devDependencies": {
53
+ "typedoc": "^0.28.0",
54
+ "typedoc-plugin-markdown": "^4.5.2",
51
55
  "@supercharge/promise-pool": "^3.2.0",
52
56
  "@webpack-cli/generators": "^3.0.7",
53
57
  "copy-webpack-plugin": "^12.0.2",
@@ -1,9 +0,0 @@
1
- /**
2
- * Names of the Squid metrics.
3
- * Should be in sync with MetricName.kt.
4
- * See MetricName.kt for documentation on each value.
5
- */
6
- export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatOutcome_count", "squid_aiImageGeneration_count", "squid_aiImageGeneration_time", "squid_aiRemoveBackground_count", "squid_aiRemoveBackground_time", "squid_aiAudioTranscribe_count", "squid_aiAudioTranscribe_time", "squid_aiAudioCreateSpeech_count", "squid_aiAudioCreateSpeech_time", "squid_aiIntegrationData_count", "squid_aiIntegrationData_time", "squid_aiIntegrationApi_count", "squid_aiIntegrationApi_time", "squid_apiControllerCall_count", "squid_apiControllerCall_time", "squid_built_in_db_size", "squid_codeInitialization_count", "squid_codeInitialization_time", "squid_deleteApiKey_count", "squid_deleteApiKey_time", "squid_deleteSecret_count", "squid_deleteSecret_time", "squid_discoverGraphQLConnectionSchema_count", "squid_discoverGraphQLConnectionSchema_time", "squid_discoverOpenApiSchema_count", "squid_discoverOpenApiSchema_time", "squid_discoverOpenApiSchemaFromFile_count", "squid_discoverOpenApiSchemaFromFile_time", "squid_executeBackendFunction_count", "squid_executeBackendFunction_time", "squid_getAiChatbotProfiles_count", "squid_getAiChatbotProfiles_time", "squid_getAllApiKeys_count", "squid_getAllApiKeys_time", "squid_getAllSecrets_count", "squid_getAllSecrets_time", "squid_getAppApiKey_count", "squid_getAppApiKey_time", "squid_getSecret_count", "squid_getSecret_time", "squid_graphql_count", "squid_graphql_time", "squid_graphqlQuery_count", "squid_graphqlQuery_time", "squid_integrationCount_value", "squid_acquireLock_count", "squid_releaseLock_count", "squid_mutate_count", "squid_mutate_time", "squid_metricQuery_count", "squid_metricQuery_time", "squid_metricReport_count", "squid_metricReport_time", "squid_nativeQuery_count", "squid_nativeQuery_time", "squid_openapi_count", "squid_openapi_time", "squid_produceTopicMessage_count", "squid_produceTopicMessage_time", "squid_query_count", "squid_query_time", "squid_registerQuery_count", "squid_registerQuery_time", "squid_rerankChunks_count", "squid_rerankChunks_time", "squid_schedulerJob_count", "squid_schedulerJob_time", "squid_schema_size", "squid_secrets_entries", "squid_storageDeleteFiles_count", "squid_storageDeleteFiles_time", "squid_storageGetDownloadUrl_count", "squid_storageGetDownloadUrl_time", "squid_storageGetFileMetadata_count", "squid_storageGetFileMetadata_time", "squid_storageListDirectoryContents_count", "squid_storageListDirectoryContents_time", "squid_storageUploadFile_count", "squid_storageUploadFile_time", "squid_subscribeToTopic_count", "squid_subscribeToTopic_time", "squid_testGraphQLConnection_count", "squid_testGraphQLConnection_time", "squid_trigger_count", "squid_trigger_time", "squid_upsertApiKey_count", "squid_upsertApiKey_time", "squid_upsertSecret_count", "squid_upsertSecret_time", "squid_vectorChunks_count", "squid_vectorChunks_time", "squid_webhook_count", "squid_webhook_time"];
7
- export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
8
- /** Common prefix for all Squid metrics. */
9
- export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
@@ -1,94 +0,0 @@
1
- /** A type alias for a string that represents a webhook. */
2
- export type WebhookId = string;
3
- /** A type alias for a string that represents a trigger id. */
4
- export type TriggerId = string;
5
- /** A type alias for a string that represents a scheduler id. */
6
- export type SchedulerId = string;
7
- /** The supported cron expression string. */
8
- export type CronExpressionString = `${string} ${string} ${string} ${string} ${string}` | `${string} ${string} ${string} ${string}`;
9
- /** A set of predefined cron expressions. */
10
- export declare enum CronExpression {
11
- EVERY_SECOND = "* * * * * *",
12
- EVERY_5_SECONDS = "*/5 * * * * *",
13
- EVERY_10_SECONDS = "*/10 * * * * *",
14
- EVERY_30_SECONDS = "*/30 * * * * *",
15
- EVERY_MINUTE = "*/1 * * * *",
16
- EVERY_5_MINUTES = "0 */5 * * * *",
17
- EVERY_10_MINUTES = "0 */10 * * * *",
18
- EVERY_30_MINUTES = "0 */30 * * * *",
19
- EVERY_HOUR = "0 0-23/1 * * *",
20
- EVERY_2_HOURS = "0 0-23/2 * * *",
21
- EVERY_3_HOURS = "0 0-23/3 * * *",
22
- EVERY_4_HOURS = "0 0-23/4 * * *",
23
- EVERY_5_HOURS = "0 0-23/5 * * *",
24
- EVERY_6_HOURS = "0 0-23/6 * * *",
25
- EVERY_7_HOURS = "0 0-23/7 * * *",
26
- EVERY_8_HOURS = "0 0-23/8 * * *",
27
- EVERY_9_HOURS = "0 0-23/9 * * *",
28
- EVERY_10_HOURS = "0 0-23/10 * * *",
29
- EVERY_11_HOURS = "0 0-23/11 * * *",
30
- EVERY_12_HOURS = "0 0-23/12 * * *",
31
- EVERY_DAY_AT_1AM = "0 01 * * *",
32
- EVERY_DAY_AT_2AM = "0 02 * * *",
33
- EVERY_DAY_AT_3AM = "0 03 * * *",
34
- EVERY_DAY_AT_4AM = "0 04 * * *",
35
- EVERY_DAY_AT_5AM = "0 05 * * *",
36
- EVERY_DAY_AT_6AM = "0 06 * * *",
37
- EVERY_DAY_AT_7AM = "0 07 * * *",
38
- EVERY_DAY_AT_8AM = "0 08 * * *",
39
- EVERY_DAY_AT_9AM = "0 09 * * *",
40
- EVERY_DAY_AT_10AM = "0 10 * * *",
41
- EVERY_DAY_AT_11AM = "0 11 * * *",
42
- EVERY_DAY_AT_NOON = "0 12 * * *",
43
- EVERY_DAY_AT_1PM = "0 13 * * *",
44
- EVERY_DAY_AT_2PM = "0 14 * * *",
45
- EVERY_DAY_AT_3PM = "0 15 * * *",
46
- EVERY_DAY_AT_4PM = "0 16 * * *",
47
- EVERY_DAY_AT_5PM = "0 17 * * *",
48
- EVERY_DAY_AT_6PM = "0 18 * * *",
49
- EVERY_DAY_AT_7PM = "0 19 * * *",
50
- EVERY_DAY_AT_8PM = "0 20 * * *",
51
- EVERY_DAY_AT_9PM = "0 21 * * *",
52
- EVERY_DAY_AT_10PM = "0 22 * * *",
53
- EVERY_DAY_AT_11PM = "0 23 * * *",
54
- EVERY_DAY_AT_MIDNIGHT = "0 0 * * *",
55
- EVERY_WEEK = "0 0 * * 7",
56
- EVERY_WEEKDAY = "0 0 * * 1-5",
57
- EVERY_WEEKEND = "0 0 * * 6,7",
58
- EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT = "0 0 1 * *",
59
- EVERY_1ST_DAY_OF_MONTH_AT_NOON = "0 12 1 * *",
60
- EVERY_2ND_HOUR = "0 */2 * * *",
61
- EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM = "0 1-23/2 * * *",
62
- EVERY_2ND_MONTH = "0 0 1 */2 *",
63
- EVERY_QUARTER = "0 0 1 */3 *",
64
- EVERY_6_MONTHS = "0 0 1 */6 *",
65
- EVERY_YEAR = "0 0 1 1 *",
66
- EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",
67
- EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",
68
- EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM = "0 */30 10-19 * * *",
69
- MONDAY_TO_FRIDAY_AT_1AM = "0 0 01 * * 1-5",
70
- MONDAY_TO_FRIDAY_AT_2AM = "0 0 02 * * 1-5",
71
- MONDAY_TO_FRIDAY_AT_3AM = "0 0 03 * * 1-5",
72
- MONDAY_TO_FRIDAY_AT_4AM = "0 0 04 * * 1-5",
73
- MONDAY_TO_FRIDAY_AT_5AM = "0 0 05 * * 1-5",
74
- MONDAY_TO_FRIDAY_AT_6AM = "0 0 06 * * 1-5",
75
- MONDAY_TO_FRIDAY_AT_7AM = "0 0 07 * * 1-5",
76
- MONDAY_TO_FRIDAY_AT_8AM = "0 0 08 * * 1-5",
77
- MONDAY_TO_FRIDAY_AT_9AM = "0 0 09 * * 1-5",
78
- MONDAY_TO_FRIDAY_AT_09_30AM = "0 30 09 * * 1-5",
79
- MONDAY_TO_FRIDAY_AT_10AM = "0 0 10 * * 1-5",
80
- MONDAY_TO_FRIDAY_AT_11AM = "0 0 11 * * 1-5",
81
- MONDAY_TO_FRIDAY_AT_11_30AM = "0 30 11 * * 1-5",
82
- MONDAY_TO_FRIDAY_AT_12PM = "0 0 12 * * 1-5",
83
- MONDAY_TO_FRIDAY_AT_1PM = "0 0 13 * * 1-5",
84
- MONDAY_TO_FRIDAY_AT_2PM = "0 0 14 * * 1-5",
85
- MONDAY_TO_FRIDAY_AT_3PM = "0 0 15 * * 1-5",
86
- MONDAY_TO_FRIDAY_AT_4PM = "0 0 16 * * 1-5",
87
- MONDAY_TO_FRIDAY_AT_5PM = "0 0 17 * * 1-5",
88
- MONDAY_TO_FRIDAY_AT_6PM = "0 0 18 * * 1-5",
89
- MONDAY_TO_FRIDAY_AT_7PM = "0 0 19 * * 1-5",
90
- MONDAY_TO_FRIDAY_AT_8PM = "0 0 20 * * 1-5",
91
- MONDAY_TO_FRIDAY_AT_9PM = "0 0 21 * * 1-5",
92
- MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
93
- MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
94
- }
@@ -1,33 +0,0 @@
1
- import { IntegrationType } from './integration.public-types';
2
- /** The different types of actions that can be performed on a database. */
3
- export type DatabaseActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
4
- /** The different types of actions that can be performed for storage. */
5
- export type StorageActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
6
- /** The different types of actions that can be performed on a topic. */
7
- export type TopicActionType = 'read' | 'write' | 'all';
8
- /** The different type of actions for metrics. */
9
- export type MetricActionType = 'write' | 'all';
10
- export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
11
- export interface AiFunctionParam {
12
- name: string;
13
- description: string;
14
- type: AiFunctionParamType;
15
- required: boolean;
16
- }
17
- /** Additional optional readonly metadata for AI function. */
18
- export interface AiFunctionAttributes {
19
- /**
20
- * Type of integration this function is used for.
21
- * Functions with defined 'integrationType' require 'integrationId' to be passed as part of the function context.
22
- */
23
- integrationType?: Array<IntegrationType>;
24
- }
25
- export type TopicName = string;
26
- export type FunctionName = string;
27
- /** Function name with the contextual data. The data must be a serializable JSON. */
28
- export interface FunctionNameWithContext {
29
- name: FunctionName;
30
- context: Record<string, unknown>;
31
- }
32
- export type ServiceName = string;
33
- export type ServiceFunctionName = `${ServiceName}:${FunctionName}`;
@@ -1,54 +0,0 @@
1
- import { SquidDocIdObj } from './document.public-types';
2
- interface BaseMutation {
3
- type: MutationType;
4
- squidDocIdObj: SquidDocIdObj;
5
- }
6
- /** A mutation on a document. */
7
- export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
8
- /** The mutation type. */
9
- export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"];
10
- export type MutationType = (typeof MUTATION_TYPES)[number];
11
- export interface DeleteMutation extends BaseMutation {
12
- type: 'delete';
13
- }
14
- export interface UpdateMutation<T = any> extends BaseMutation {
15
- type: 'update';
16
- /** The updated properties */
17
- properties: {
18
- [key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
19
- };
20
- }
21
- export interface InsertMutation<T = any> extends BaseMutation {
22
- type: 'insert';
23
- /** The inserted document */
24
- properties: T;
25
- }
26
- /** A representation of a single property update */
27
- export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
28
- /** A value update property mutation */
29
- export interface ValueUpdatePropertyMutation<Value = any> {
30
- type: 'update';
31
- value: Value;
32
- }
33
- /** Applying a numeric function to a property */
34
- export interface ApplyNumericFnPropertyMutation {
35
- type: 'applyNumericFn';
36
- fn: 'increment';
37
- value: number;
38
- }
39
- /** A property update that removes a property from a document */
40
- export interface RemovePropertyMutation {
41
- type: 'removeProperty';
42
- }
43
- interface ApplyExtendString {
44
- type: 'applyStringFn';
45
- fn: 'extendString';
46
- value: string;
47
- }
48
- interface ApplyTrimString {
49
- type: 'applyStringFn';
50
- fn: 'trim';
51
- }
52
- /** A property mutation that modifies a string */
53
- export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
54
- export {};
@@ -1,9 +0,0 @@
1
- import { IntegrationId } from './communication.public-types';
2
- import { StorageActionType } from './bundle-data.public-types';
3
- export type StorageFunctionality = 'fileUpload' | 'getFileMetadata' | 'getDownloadUrl' | 'deleteFiles' | 'listDirectoryContents';
4
- export interface StorageContext {
5
- integrationId: IntegrationId;
6
- pathsInBucket: Array<string>;
7
- action: StorageActionType;
8
- functionality: StorageFunctionality;
9
- }
@@ -1,21 +0,0 @@
1
- import { ApiEndpointId, HttpMethod } from '../public-types/integrations/api.public-types';
2
- import { IntegrationId } from '../public-types/communication.public-types';
3
- import { ApiOptions } from '../public-types/api-client.public-types';
4
- /** The headers of an API call. */
5
- export type ApiHeaders = Record<string, string | number | boolean>;
6
- /** The context of an API call. */
7
- export declare class ApiCallContext {
8
- readonly integrationId: IntegrationId;
9
- readonly endpointId: ApiEndpointId;
10
- readonly url: string;
11
- readonly method: HttpMethod;
12
- readonly body: unknown;
13
- readonly options: ApiOptions;
14
- }
15
- export interface CallApiRequest<BodyType = any> {
16
- integrationId: IntegrationId;
17
- endpointId: ApiEndpointId;
18
- body?: BodyType;
19
- overrideMethod?: HttpMethod;
20
- options: ApiOptions;
21
- }