@squidcloud/client 1.0.338 → 1.0.340

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 (87) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +287 -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 +73 -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 +8 -1
  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 +24 -30
  27. package/dist/typescript-client/src/api-client.d.ts +1 -0
  28. package/dist/typescript-client/src/auth.manager.d.ts +4 -1
  29. package/dist/typescript-client/src/collection-reference.d.ts +2 -0
  30. package/dist/typescript-client/src/connection-details.d.ts +1 -0
  31. package/dist/typescript-client/src/destruct.manager.d.ts +1 -21
  32. package/dist/typescript-client/src/distributed-lock.manager.d.ts +4 -1
  33. package/dist/typescript-client/src/document-reference.d.ts +1 -0
  34. package/dist/typescript-client/src/document-store.d.ts +1 -17
  35. package/dist/typescript-client/src/extraction-client.d.ts +1 -0
  36. package/dist/typescript-client/src/integration-client.d.ts +1 -0
  37. package/dist/typescript-client/src/observability-client.d.ts +5 -1
  38. package/dist/typescript-client/src/personal-storage-client.d.ts +23 -4
  39. package/dist/typescript-client/src/public-types.d.ts +1 -4
  40. package/dist/typescript-client/src/query/deserializer.d.ts +1 -0
  41. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +34 -8
  42. package/dist/typescript-client/src/query/pagination.d.ts +10 -10
  43. package/dist/typescript-client/src/query/query-builder.factory.d.ts +12 -4
  44. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +1 -12
  45. package/dist/typescript-client/src/query/query.types.d.ts +2 -93
  46. package/dist/typescript-client/src/query/snapshot-emitter.d.ts +1 -0
  47. package/dist/typescript-client/src/query-utils.d.ts +5 -1
  48. package/dist/typescript-client/src/queue.manager.d.ts +1 -0
  49. package/dist/typescript-client/src/scheduler-client.d.ts +1 -0
  50. package/dist/typescript-client/src/secret.client.d.ts +2 -0
  51. package/dist/typescript-client/src/squid.d.ts +16 -4
  52. package/dist/typescript-client/src/storage-client.d.ts +9 -9
  53. package/dist/typescript-client/src/types.d.ts +4 -1
  54. package/dist/typescript-client/src/version.d.ts +2 -2
  55. package/package.json +6 -2
  56. package/dist/internal-common/src/metric-name.d.ts +0 -9
  57. package/dist/internal-common/src/public-types/application.public-types.d.ts +0 -94
  58. package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +0 -33
  59. package/dist/internal-common/src/public-types/mutation.public-types.d.ts +0 -54
  60. package/dist/internal-common/src/public-types/storage.types.d.ts +0 -9
  61. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -21
  62. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -18
  63. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -127
  64. package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -1
  65. package/dist/internal-common/src/types/ai-assistant.types.d.ts +0 -1
  66. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -53
  67. package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
  68. package/dist/internal-common/src/types/communication.types.d.ts +0 -1
  69. package/dist/internal-common/src/types/document.types.d.ts +0 -1
  70. package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
  71. package/dist/internal-common/src/types/observability.types.d.ts +0 -71
  72. package/dist/internal-common/src/types/query.types.d.ts +0 -10
  73. package/dist/internal-common/src/types/secret.types.d.ts +0 -2
  74. package/dist/internal-common/src/types/socket.types.d.ts +0 -1
  75. package/dist/internal-common/src/types/time-units.d.ts +0 -1
  76. package/dist/internal-common/src/utils/array.d.ts +0 -1
  77. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
  78. package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
  79. package/dist/internal-common/src/utils/http.d.ts +0 -1
  80. package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
  81. package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
  82. package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
  83. package/dist/internal-common/src/utils/object.d.ts +0 -49
  84. package/dist/internal-common/src/utils/serialization.d.ts +0 -5
  85. package/dist/internal-common/src/utils/squid.constants.d.ts +0 -1
  86. package/dist/internal-common/src/utils/validation.d.ts +0 -19
  87. package/dist/internal-common/src/websocket.impl.d.ts +0 -26
@@ -1,9 +1,24 @@
1
1
  import { AiGenerateImageOptions } from './public-types';
2
2
  /**
3
- * AiImageClient provides methods for AI-powered image processing.
3
+ * AiImageClient provides methods for AI-powered image processing,
4
+ * such as generating images from text prompts and removing backgrounds.
5
+ * @category AI
4
6
  */
5
7
  export declare class AiImageClient {
6
8
  private readonly rpcManager;
9
+ /**
10
+ * Generates an image based on a given text prompt and options.
11
+ *
12
+ * @param prompt - A natural language description of the desired image.
13
+ * @param options - Configuration options for image generation (e.g., size, style).
14
+ * @returns A Promise that resolves to a base64-encoded image string.
15
+ */
7
16
  generate(prompt: string, options: AiGenerateImageOptions): Promise<string>;
17
+ /**
18
+ * Removes the background from an image file.
19
+ *
20
+ * @param file - The image file to process.
21
+ * @returns A Promise that resolves to a base64-encoded image string with the background removed.
22
+ */
8
23
  removeBackground(file: File): Promise<string>;
9
24
  }
@@ -2,51 +2,97 @@ import { MmEntity, MmEntityMatch, MmFindMatchesOptions, MmListEntitiesOptions, M
2
2
  /**
3
3
  * Client for the AI Matchmaking service. This service allows you to create matchmakers and insert entities into them.
4
4
  * The service will then find matches for the entities.
5
+ * @category AI
5
6
  */
6
7
  export declare class AiMatchMakingClient {
7
8
  private readonly rpcManager;
8
9
  /**
9
- * Creates a new matchmaker with the given id, description, and categories.
10
- * @param matchMaker The matchmaker to create.
10
+ * Creates a new matchmaker with the given metadata.
11
+ *
12
+ * @param matchMaker - Object describing the matchmaker including ID, description (used as AI instructions), and categories.
13
+ * @returns A MatchMaker instance to perform entity-level operations.
11
14
  */
12
15
  createMatchMaker(matchMaker: MmMatchMaker): Promise<MatchMaker>;
13
16
  /**
14
17
  * Retrieves an existing matchmaker by its ID.
18
+ *
19
+ * @param matchMakerId - ID of the matchmaker to retrieve.
20
+ * @returns A MatchMaker instance if found, otherwise undefined.
15
21
  */
16
22
  getMatchMaker(matchMakerId: string): Promise<MatchMaker | undefined>;
23
+ /**
24
+ * Lists all existing matchmakers.
25
+ */
17
26
  listMatchMakers(): Promise<Array<MmMatchMaker>>;
18
27
  }
19
28
  /**
20
29
  * Represents a matchmaker. You can insert entities into the matchmaker and find matches for them.
30
+ *
31
+ * A matchmaker has one or more categories. When inserting an entity, it is assigned to a category.
32
+ * When finding matches, you can specify which categories to use for source and target.
33
+ *
34
+ * The matchmaker description is used as a prompt or instruction to the AI to guide the matchmaking behavior.
35
+ * @category AI
21
36
  */
22
37
  export declare class MatchMaker {
23
38
  private readonly matchMaker;
24
39
  private readonly rpcManager;
25
40
  readonly id: string;
26
- /** Adds a new entity to the matchmaker - replaces existing entity with the same ID if exists. */
41
+ /**
42
+ * Adds a new entity to the matchmaker, replacing existing entity with the same ID if it exists.
43
+ *
44
+ * @param entity - The entity to insert.
45
+ */
27
46
  insertEntity(entity: MmEntity): Promise<void>;
28
47
  /**
29
- * Adds a new entities to the matchmaker - replaces existing entities with the same ID if exists.
30
- * This method is more efficient than calling insertEntity multiple times.
48
+ * Inserts multiple entities into the matchmaker. Replaces existing entities with matching IDs.
49
+ *
50
+ * @param entities - Array of entities to insert.
31
51
  */
32
52
  insertManyEntities(entities: Array<MmEntity>): Promise<void>;
53
+ /**
54
+ * Deletes the matchmaker and all its associated data.
55
+ */
33
56
  delete(): Promise<void>;
57
+ /**
58
+ * Deletes a specific entity from the matchmaker.
59
+ *
60
+ * @param entityId - The ID of the entity to delete.
61
+ */
34
62
  deleteEntity(entityId: string): Promise<void>;
35
- /** Finds matches for the given entity id. */
63
+ /**
64
+ * Finds matches for an entity already inserted into the matchmaker.
65
+ *
66
+ * @param entityId - ID of the entity to match.
67
+ * @param options - Optional filters and controls for matching.
68
+ * @returns Array of entity matches.
69
+ */
36
70
  findMatches(entityId: string, options?: MmFindMatchesOptions): Promise<Array<MmEntityMatch>>;
37
- /** Finds matches for the given entity. */
71
+ /**
72
+ * Finds matches for an entity not yet inserted into the matchmaker.
73
+ *
74
+ * @param entity - The entity object (excluding ID and metadata).
75
+ * @param options - Optional filters and controls for matching.
76
+ * @returns Array of entity matches.
77
+ */
38
78
  findMatchesForEntity(entity: Omit<MmEntity, 'metadata' | 'id'>, options?: MmFindMatchesOptions): Promise<Array<MmEntityMatch>>;
39
79
  /**
40
- * Lists entities in the matchmaker that match the given category ID and the provided options.
41
- * The results are ordered by the entity id.
80
+ * Lists entities currently in the matchmaker that belong to the specified category.
81
+ *
82
+ * @param categoryId - The category to filter entities by.
83
+ * @param options - Pagination and filtering options.
84
+ * @returns Array of entities in the category.
42
85
  */
43
86
  listEntities(categoryId: string, options?: MmListEntitiesOptions): Promise<Array<MmEntity>>;
44
87
  /**
45
- * Returns the entity with the given ID.
88
+ * Retrieves a single entity from the matchmaker by its ID.
89
+ *
90
+ * @param entityId - ID of the entity to retrieve.
91
+ * @returns The entity if found, or undefined.
46
92
  */
47
93
  getEntity(entityId: string): Promise<MmEntity | undefined>;
48
94
  /**
49
- * Returns an object with the matchmaker details.
95
+ * Returns the matchmaker metadata including description, categories, and ID.
50
96
  */
51
97
  getMatchMakerDetails(): MmMatchMaker;
52
98
  }
@@ -2,6 +2,7 @@ import { AiChatModelName, ApiOptions, IntegrationId } from './public-types';
2
2
  /**
3
3
  * Request to execute an AI query using a specific integration.
4
4
  * Supports additional query execution options.
5
+ * @category AI
5
6
  */
6
7
  export interface ExecuteAiQueryRequest {
7
8
  /** ID of the integration to execute the AI query. */
@@ -11,35 +12,10 @@ export interface ExecuteAiQueryRequest {
11
12
  /** Additional options for query execution. */
12
13
  options?: ExecuteAiQueryOptions;
13
14
  }
14
- /**
15
- * Request to execute an AI query across multiple integrations.
16
- * Allows querying multiple sources simultaneously.
17
- */
18
- export interface ExecuteAiQueryMultiRequest {
19
- /** IDs of multiple integrations to execute the AI query across. */
20
- integrationIds: Array<IntegrationId>;
21
- /** User-provided prompt for the AI query. */
22
- prompt: string;
23
- /** Additional options for query execution. */
24
- options?: ExecuteAiQueryOptions;
25
- }
26
- /**
27
- * Request to execute an AI-powered API call.
28
- * Allows specifying allowed endpoints and whether to provide an explanation.
29
- */
30
- export interface ExecuteAiApiRequest {
31
- /** ID of the integration used for executing the API call. */
32
- integrationId: IntegrationId;
33
- /** User-provided prompt for the AI-powered API request. */
34
- prompt: string;
35
- /** List of allowed API endpoints for execution. */
36
- allowedEndpoints?: string[];
37
- /** Whether to provide an explanation for the API response. */
38
- provideExplanation?: boolean;
39
- }
40
15
  /**
41
16
  * Options for configuring AI query execution.
42
17
  * Includes instructions, model overrides, and additional execution settings.
18
+ * @category AI
43
19
  */
44
20
  export interface ExecuteAiQueryOptions {
45
21
  /** Custom instructions to modify AI query behavior. */
@@ -58,6 +34,7 @@ export interface ExecuteAiQueryOptions {
58
34
  /**
59
35
  * Response from an AI query execution.
60
36
  * Contains the generated answer, optional explanation, and executed query details.
37
+ * @category AI
61
38
  */
62
39
  export interface ExecuteAiQueryResponse {
63
40
  /** AI-generated answer for the query. */
@@ -73,14 +50,22 @@ export interface ExecuteAiQueryResponse {
73
50
  /** Indicates whether the query execution was successful. */
74
51
  success: boolean;
75
52
  }
76
- interface ExecutedQuery {
53
+ /**
54
+ * Details of an executed query, including the query text and result type.
55
+ * @category AI
56
+ */
57
+ export interface ExecutedQuery {
58
+ /** Text of the executed query. */
77
59
  query: string;
60
+ /** The markdown type of the result (sql, mongo, etc.). */
78
61
  markdownType: string;
62
+ /** URL to access raw results from the query execution. */
79
63
  rawResultsUrl?: string;
80
64
  }
81
65
  /**
82
66
  * Response from executing an AI query across multiple integrations.
83
67
  * Includes answers and explanations for each executed query.
68
+ * @category AI
84
69
  */
85
70
  export interface ExecuteAiQueryMultiResponse {
86
71
  /** AI-generated answer for the multi-integration query. */
@@ -92,16 +77,26 @@ export interface ExecuteAiQueryMultiResponse {
92
77
  /** Indicates whether the query execution was successful. */
93
78
  success: boolean;
94
79
  }
95
- interface ApiResult {
80
+ /**
81
+ * The AI API call response
82
+ * @category AI
83
+ */
84
+ export interface AiApiResult {
85
+ /** ID of the executed API endpoint. */
96
86
  endpointId: string;
87
+ /** Name of the executed API endpoint. */
97
88
  responseBody: string;
89
+ /** Status code of the executed API request. */
98
90
  responseStatusCode: number;
91
+ /** Request body of the executed API request. */
99
92
  requestBody: any;
93
+ /** Request options of the executed API request. */
100
94
  requestOptions: ApiOptions;
101
95
  }
102
96
  /**
103
97
  * Response from executing an AI-powered API request.
104
98
  * Includes the AI-generated answer and details of executed API calls.
99
+ * @category AI
105
100
  */
106
101
  export interface ExecuteAiApiResponse {
107
102
  /** AI-generated answer for the API request. */
@@ -109,10 +104,9 @@ export interface ExecuteAiApiResponse {
109
104
  /** Optional explanation for the AI-generated API response. */
110
105
  explanation?: string;
111
106
  /** List of executed API requests and their results. */
112
- executedApis?: Array<ApiResult>;
107
+ executedApis?: Array<AiApiResult>;
113
108
  /** Markdown format type of the executed query response. */
114
109
  queryMarkdownType?: string;
115
110
  /** Indicates whether the API request execution was successful. */
116
111
  success: boolean;
117
112
  }
118
- export {};
@@ -5,6 +5,7 @@ import { ApiOptions } from '../../internal-common/src/public-types/api-client.pu
5
5
  /**
6
6
  * ApiClient facilitates making HTTP API requests to external integrations,
7
7
  * supporting various HTTP methods such as GET, POST, PUT, PATCH, and DELETE.
8
+ * @category Platform
8
9
  */
9
10
  export declare class ApiClient {
10
11
  private readonly rpcManager;
@@ -1,5 +1,8 @@
1
1
  import { IntegrationId } from './public-types';
2
- /** Holds authentication token for the specified integration. */
2
+ /**
3
+ * Holds authentication token for the specified integration.
4
+ * @category Auth
5
+ */
3
6
  export interface AuthData {
4
7
  /** Authentication token for the specified integration. */
5
8
  token: string | undefined;
@@ -9,6 +9,7 @@ import { SnapshotEmitter } from './query/snapshot-emitter';
9
9
  * Read more about docId in the
10
10
  * {@link https://docs.squid.cloud/docs/api-reference/client-sdk-reference/classes/CollectionReference#doc
11
11
  * documentation}.
12
+ * @category Database
12
13
  */
13
14
  export interface DocIdAndData<T extends DocumentData> {
14
15
  /** Optional document ID. If not provided, it may be generated by the server. */
@@ -24,6 +25,7 @@ export interface DocIdAndData<T extends DocumentData> {
24
25
  * Read more about collection references in the
25
26
  * {@link https://docs.getsquid.ai/docs/client-sdk/database/collection-reference documentation}.
26
27
  * @typeParam T The type of the document data.
28
+ * @category Database
27
29
  */
28
30
  export declare class CollectionReference<T extends DocumentData> {
29
31
  private readonly collectionName;
@@ -2,6 +2,7 @@ import { Observable } from 'rxjs';
2
2
  import { ClientId } from '../../internal-common/src/public-types/communication.public-types';
3
3
  /**
4
4
  * Provides information about the connection to the Squid Server.
5
+ * @category Platform
5
6
  */
6
7
  export declare class ConnectionDetails {
7
8
  private readonly clientIdService;
@@ -1,21 +1 @@
1
- import { Observable } from 'rxjs';
2
- /**
3
- * A function that performs cleanup or resource deallocation.
4
- * Can return a promise for asynchronous cleanup.
5
- */
6
- export type DestructorFn = () => Promise<void> | void;
7
- /**
8
- * DestructManager handles the execution of pre-destruction and destruction
9
- * tasks, ensuring proper cleanup of resources in an orderly manner.
10
- */
11
- export declare class DestructManager {
12
- private readonly preDestructors;
13
- private readonly destructors;
14
- private readonly isDestructedSubject;
15
- get isDestructing(): boolean;
16
- observeIsDestructing(): Observable<void>;
17
- onPreDestruct(fn: DestructorFn): void;
18
- onDestruct(fn: DestructorFn): void;
19
- destruct(): Promise<void>;
20
- reportDestructed(): void;
21
- }
1
+ export {};
@@ -1,5 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
- /** A handler for a distributed lock that can be released. */
2
+ /**
3
+ * A handler for a distributed lock that can be released.
4
+ * @category Platform
5
+ */
3
6
  export interface DistributedLock {
4
7
  /** Releases the lock. */
5
8
  release(): void;
@@ -11,6 +11,7 @@ import { DeepRecord, Paths } from '../../internal-common/src/public-types/typesc
11
11
  * Read more about document references in the
12
12
  * {@link https://docs.getsquid.ai/docs/client-sdk/database/document-reference documentation}.
13
13
  * @typeParam T The type of the document data.
14
+ * @category Database
14
15
  */
15
16
  export declare class DocumentReference<T extends DocumentData = any> {
16
17
  private _squidDocId;
@@ -1,17 +1 @@
1
- import { Query, SquidDocId, SquidDocument } from './public-types';
2
- /**
3
- * DocumentStore manages the storage, retrieval, sorting, and migration
4
- * of documents, ensuring efficient access and manipulation of stored data.
5
- */
6
- export declare class DocumentStore {
7
- private readonly squidDocIdToDoc;
8
- saveDocument(squidDocId: SquidDocId, properties: SquidDocument | undefined): SquidDocument | undefined;
9
- hasData(squidDocId: SquidDocId): boolean;
10
- getDocument(squidDocId: SquidDocId): SquidDocument;
11
- getDocumentOrUndefined(squidDocId: SquidDocId): SquidDocument | undefined;
12
- private compareSquidDocs;
13
- group(sortedDocs: SquidDocument[], sortFieldNames: string[]): SquidDocument[][];
14
- sortAndLimitDocs(docIdSet: Set<SquidDocId>, query: Query): Array<SquidDocument>;
15
- private removeInternalProperties;
16
- migrateDocId(squidDocId: SquidDocId, newSquidDocId: SquidDocId): void;
17
- }
1
+ export {};
@@ -2,6 +2,7 @@ import { DocumentTextDataResponse, ExtractDataFromDocumentFileOptions } from '..
2
2
  /**
3
3
  * ExtractionClient provides methods for extracting structured data
4
4
  * from document files using AI-driven processing.
5
+ * @category Platform
5
6
  */
6
7
  export declare class ExtractionClient {
7
8
  private readonly rpcManager;
@@ -2,6 +2,7 @@ import { IntegrationId, IntegrationInfo, IntegrationType } from './public-types'
2
2
  /**
3
3
  * IntegrationClient manages integrations within an application,
4
4
  * providing methods for listing, retrieving, updating, and deleting integrations.
5
+ * @category Platform
5
6
  */
6
7
  export declare class IntegrationClient {
7
8
  private readonly rpcManager;
@@ -1,5 +1,8 @@
1
1
  import { QueryMetricsRequest, QueryMetricsResponse } from '../../internal-common/src/public-types/metric.public-types';
2
- /** A client for reporting user metrics and querying both application-related Squid and user metrics. */
2
+ /**
3
+ * A client for reporting user metrics and querying both application-related Squid and user metrics.
4
+ * @category Platform
5
+ */
3
6
  export declare class ObservabilityClient {
4
7
  private readonly rpcManager;
5
8
  private pendingPromises;
@@ -35,5 +38,6 @@ export interface Metric<MetricNameType = string> {
35
38
  /**
36
39
  * MetricReport represents a single metric event with some optional fields.
37
40
  * These optional fields are automatically populated by Squid with default values.
41
+ * @category Platform
38
42
  */
39
43
  export type MetricReport<MetricNameType = string> = Omit<Metric<MetricNameType>, 'tags' | 'timestamp'> & Partial<Pick<Metric, 'tags' | 'timestamp'>>;
@@ -1,21 +1,41 @@
1
1
  import { AiContextMetadata } from '../../internal-common/src/public-types/ai-agent.public-types';
2
2
  import { DocumentTextDataResponse } from '../../internal-common/src/public-types/extraction.public-types';
3
- interface PsGetAccessTokenResponse {
3
+ /**
4
+ * Response to a request to get the access token for a personal storage service.
5
+ * @category Personal Storage
6
+ */
7
+ export interface PsGetAccessTokenResponse {
8
+ /** The access token for the personal storage service. */
4
9
  accessToken: string;
10
+ /** The expiration time of the access token. */
5
11
  expirationTime: Date;
6
12
  }
7
- type PsDocumentType = 'file' | 'folder';
8
- interface PsIndexedDocument {
13
+ /**
14
+ * The type of a document in personal storage.
15
+ * @category Personal Storage
16
+ */
17
+ export type PsDocumentType = 'file' | 'folder';
18
+ /**
19
+ * A document indexed for AI processing (as part of the personal storage connector).
20
+ * @category Personal Storage
21
+ */
22
+ export interface PsIndexedDocument {
23
+ /** The ID of the document. */
9
24
  id: string;
25
+ /** The name of the document. */
10
26
  name: string;
27
+ /** The type of the document (file or folder). */
11
28
  type: PsDocumentType;
29
+ /** Metadata stored about the document */
12
30
  metadata: AiContextMetadata;
31
+ /** The ID of the parent folder of the document. */
13
32
  folderDocumentId?: string;
14
33
  }
15
34
  /**
16
35
  * Client to handle personal storage integrations such as Google Drive or Microsoft OneDrive.
17
36
  * Provides methods for saving authentication tokens, indexing documents or folders for AI processing,
18
37
  * and unindexing documents from AI processing.
38
+ * @category Personal Storage
19
39
  */
20
40
  export declare class PersonalStorageClient {
21
41
  private readonly integrationId;
@@ -63,4 +83,3 @@ export declare class PersonalStorageClient {
63
83
  */
64
84
  unindexDocument(documentId: string, identifier: string, agentId: string): Promise<void>;
65
85
  }
66
- export {};
@@ -1,8 +1,6 @@
1
1
  export * from '../../internal-common/src/public-types/ai-assistant.public-types';
2
2
  export * from '../../internal-common/src/public-types/ai-agent.public-types';
3
3
  export * from '../../internal-common/src/public-types/api-client.public-types';
4
- export * from '../../internal-common/src/public-types/application.public-types';
5
- export * from '../../internal-common/src/public-types/bundle-data.public-types';
6
4
  export * from '../../internal-common/src/public-types/code-executor.public-types';
7
5
  export * from '../../internal-common/src/public-types/communication.public-types';
8
6
  export * from '../../internal-common/src/public-types/context.public-types';
@@ -11,7 +9,6 @@ export * from '../../internal-common/src/public-types/http-status.enum';
11
9
  export * from '../../internal-common/src/public-types/integration.public-types';
12
10
  export * from '../../internal-common/src/public-types/integrations/api.public-types';
13
11
  export * from '../../internal-common/src/public-types/metric.public-types';
14
- export * from '../../internal-common/src/public-types/mutation.public-types';
15
12
  export * from '../../internal-common/src/public-types/openapi.public-types';
16
13
  export * from '../../internal-common/src/public-types/query.public-types';
17
14
  export * from '../../internal-common/src/public-types/regions.public-types';
@@ -20,7 +17,7 @@ export * from '../../internal-common/src/public-types/secret.public-types';
20
17
  export * from '../../internal-common/src/public-types/serialized-query.public-types';
21
18
  export * from '../../internal-common/src/public-types/scheduler.public-types';
22
19
  export * from '../../internal-common/src/public-types/socket.public-types';
23
- export * from '../../internal-common/src/public-types/storage.types';
24
20
  export * from '../../internal-common/src/public-types/typescript.public-types';
25
21
  export * from '../../internal-common/src/public-types/extraction.public-types';
26
22
  export * from '../../internal-common/src/public-types/ai-matchmaking.types';
23
+ export * from '../../internal-common/src/public-types/backend.public-types';
@@ -5,5 +5,6 @@ import { SnapshotEmitter } from './snapshot-emitter';
5
5
  * Deserialize a serialized query into a snapshot emitter.
6
6
  * @param squid - The Squid instance.
7
7
  * @param serializedQuery - The serialized query.
8
+ * @category Database
8
9
  */
9
10
  export declare function deserializeQuery<ReturnType = any>(squid: Squid, serializedQuery: SerializedQuery): SnapshotEmitter<ReturnType>;
@@ -4,12 +4,18 @@ import { BaseQueryBuilder, HasDereference, QueryBuilder } from './query-builder.
4
4
  import { Alias, DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query, SerializedJoinQuery, SimpleCondition } from '../public-types';
5
5
  import { Pagination, PaginationOptions } from './pagination';
6
6
  import { SnapshotEmitter } from './snapshot-emitter';
7
- type WithDocumentReferences<T extends Record<any, DocumentData>> = {
7
+ /**
8
+ * Represents the result of a join query where each property is a document reference,
9
+ * grouped by alias instead of containing DocumentData.
10
+ * @category Database
11
+ */
12
+ export type WithDocumentReferences<T extends Record<any, DocumentData>> = {
8
13
  [k in keyof T]: DocumentReference<Required<T>[k]>;
9
14
  };
10
15
  /**
11
16
  * Defines the fields used for joining two collections in a query.
12
17
  * Specifies the left and right fields that establish the join relationship.
18
+ * @category Database
13
19
  */
14
20
  export interface JoinFields<ReturnType> {
15
21
  /** Field from the left collection to be used in the join. */
@@ -20,6 +26,7 @@ export interface JoinFields<ReturnType> {
20
26
  /**
21
27
  * Options for configuring a join query.
22
28
  * Specifies aliasing and whether the join is inner or outer.
29
+ * @category Database
23
30
  */
24
31
  export interface JoinOptions {
25
32
  /** Alias for the left collection in the join. */
@@ -27,9 +34,21 @@ export interface JoinOptions {
27
34
  /** Whether the join should be an inner join (default is outer join). */
28
35
  isInner?: boolean;
29
36
  }
30
- type Grouped<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, RootAlias extends Alias> = Aliases[RootAlias] extends [] ? Required<ReturnType>[RootAlias] : Record<RootAlias, Required<ReturnType>[RootAlias]> & OtherGroups<Aliases, ReturnType, Aliases[RootAlias]>;
31
- type OtherGroups<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, ManyRootAliases extends Alias[]> = ManyRootAliases extends [infer First extends Alias, ...infer Rest extends Alias[]] ? Record<First, Array<Grouped<Aliases, ReturnType, First>>> & OtherGroups<Aliases, ReturnType, Rest> : Record<Alias, never>;
32
- interface HasGrouped {
37
+ /**
38
+ * A join query result that has been grouped by alias.
39
+ * @category Database
40
+ */
41
+ export type Grouped<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, RootAlias extends Alias> = Aliases[RootAlias] extends [] ? Required<ReturnType>[RootAlias] : Record<RootAlias, Required<ReturnType>[RootAlias]> & OtherGroups<Aliases, ReturnType, Aliases[RootAlias]>;
42
+ /**
43
+ * A helper type for Groups.
44
+ * @category Database
45
+ */
46
+ export type OtherGroups<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, ManyRootAliases extends Alias[]> = ManyRootAliases extends [infer First extends Alias, ...infer Rest extends Alias[]] ? Record<First, Array<Grouped<Aliases, ReturnType, First>>> & OtherGroups<Aliases, ReturnType, Rest> : Record<Alias, never>;
47
+ /**
48
+ * A join query result that has been grouped by alias.
49
+ * @category Database
50
+ */
51
+ export interface HasGrouped {
33
52
  /**
34
53
  * Transforms this join query result to a nested data structure. For example, a join between teachers and students
35
54
  * normally returns a result of the form:
@@ -54,6 +73,7 @@ interface HasGrouped {
54
73
  * To learn more about join queries, see the
55
74
  * {@link https://docs.getsquid.ai/docs/client-sdk/database/queries#joining-data-across-collections-and-integrations
56
75
  * documentation}.
76
+ * @category Database
57
77
  */
58
78
  export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, LatestAlias extends Alias, RootAlias extends Alias> extends BaseQueryBuilder<ReturnType> implements SnapshotEmitter<WithDocumentReferences<ReturnType>>, HasGrouped, HasDereference {
59
79
  private readonly collectionName;
@@ -136,9 +156,12 @@ export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, Re
136
156
  paginate(options?: Partial<PaginationOptions>): Pagination<WithDocumentReferences<ReturnType>>;
137
157
  hasIsInner(): boolean;
138
158
  }
139
- declare class DereferencedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<ReturnType>, HasGrouped {
159
+ /**
160
+ * A join query result that has been grouped by alias and returns the DocumentData.
161
+ * @category Database
162
+ */
163
+ export declare class DereferencedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<ReturnType>, HasGrouped {
140
164
  private readonly joinQueryBuilder;
141
- constructor(joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>);
142
165
  /** @inheritDoc */
143
166
  grouped(): SnapshotEmitter<Grouped<Aliases, ReturnType, RootAlias>>;
144
167
  /** @inheritDoc */
@@ -157,7 +180,11 @@ declare class DereferencedJoin<Aliases extends Record<Alias, Alias[]>, ReturnTyp
157
180
  paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
158
181
  serialize(): SerializedJoinQuery;
159
182
  }
160
- declare class GroupedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>, HasDereference {
183
+ /**
184
+ * A join query result that has been grouped by alias.
185
+ * @category Database
186
+ */
187
+ export declare class GroupedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>, HasDereference {
161
188
  readonly joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
162
189
  /** internal */
163
190
  constructor(joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>);
@@ -180,4 +207,3 @@ declare class GroupedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType ext
180
207
  serialize(): SerializedJoinQuery;
181
208
  paginate(options?: Partial<PaginationOptions>): Pagination<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>;
182
209
  }
183
- export {};
@@ -1,5 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
- /** The state of a pagination. */
2
+ /**
3
+ * The state of a pagination.
4
+ * @category Database
5
+ */
3
6
  export interface PaginationState<ReturnType> {
4
7
  /** The page data. */
5
8
  data: Array<ReturnType>;
@@ -8,22 +11,20 @@ export interface PaginationState<ReturnType> {
8
11
  /** Whether there is a previous page. */
9
12
  hasPrev: boolean;
10
13
  }
11
- /** Pagination options */
14
+ /**
15
+ * Pagination options.
16
+ * @category Database
17
+ */
12
18
  export interface PaginationOptions {
13
19
  /** Whether to show real-time updates. Defaults to true. */
14
20
  subscribe: boolean;
15
21
  /** The number of items in a page. Defaults to 100. */
16
22
  pageSize: number;
17
23
  }
18
- interface InternalState<ReturnType> {
19
- data: ReturnType[];
20
- extractedData: any[];
21
- numBefore: number;
22
- numAfter: number;
23
- }
24
24
  /**
25
25
  * Pagination provides a paginated view over a dataset, supporting navigation
26
26
  * through pages, real-time updates, and sorting based on predefined criteria.
27
+ * @category Database
27
28
  */
28
29
  export declare class Pagination<ReturnType> {
29
30
  private readonly paginateOptions;
@@ -43,7 +44,7 @@ export declare class Pagination<ReturnType> {
43
44
  private internalStateToState;
44
45
  /** Unsubscribes from the pagination. */
45
46
  unsubscribe(): void;
46
- prevInternal(internalState: InternalState<ReturnType>): void;
47
+ private prevInternal;
47
48
  /** Returns a promise that resolves when the previous page of data is available. */
48
49
  prev(): Promise<PaginationState<ReturnType>>;
49
50
  /** Returns a promise that resolves when the next page of data is available. */
@@ -62,4 +63,3 @@ export declare class Pagination<ReturnType> {
62
63
  */
63
64
  last(): Promise<PaginationState<ReturnType>>;
64
65
  }
65
- export {};