@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
@@ -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
  }
@@ -1,59 +1,112 @@
1
1
  import { AiChatModelName, ApiOptions, IntegrationId } from './public-types';
2
+ /**
3
+ * Request to execute an AI query using a specific integration.
4
+ * Supports additional query execution options.
5
+ * @category AI
6
+ */
2
7
  export interface ExecuteAiQueryRequest {
8
+ /** ID of the integration to execute the AI query. */
3
9
  integrationId: IntegrationId;
10
+ /** User-provided prompt for the AI query. */
4
11
  prompt: string;
12
+ /** Additional options for query execution. */
5
13
  options?: ExecuteAiQueryOptions;
6
14
  }
7
- export interface ExecuteAiQueryMultiRequest {
8
- integrationIds: Array<IntegrationId>;
9
- prompt: string;
10
- options?: ExecuteAiQueryOptions;
11
- }
12
- export interface ExecuteAiApiRequest {
13
- integrationId: IntegrationId;
14
- prompt: string;
15
- allowedEndpoints?: string[];
16
- provideExplanation?: boolean;
17
- }
15
+ /**
16
+ * Options for configuring AI query execution.
17
+ * Includes instructions, model overrides, and additional execution settings.
18
+ * @category AI
19
+ */
18
20
  export interface ExecuteAiQueryOptions {
21
+ /** Custom instructions to modify AI query behavior. */
19
22
  instructions?: string;
23
+ /** List of collections to use in the AI query. */
20
24
  collectionsToUse?: Array<string>;
25
+ /** Whether to enable raw results output. */
21
26
  enableRawResults?: boolean;
27
+ /** Whether to enable code interpreter for query execution. */
22
28
  enableCodeInterpreter?: boolean;
29
+ /** Specific AI model override for the query execution. */
23
30
  overrideModel?: AiChatModelName;
31
+ /** Whether to generate a step-by-step walkthrough for the response. */
24
32
  generateWalkthrough?: boolean;
25
33
  }
34
+ /**
35
+ * Response from an AI query execution.
36
+ * Contains the generated answer, optional explanation, and executed query details.
37
+ * @category AI
38
+ */
26
39
  export interface ExecuteAiQueryResponse {
40
+ /** AI-generated answer for the query. */
27
41
  answer: string;
42
+ /** Optional explanation for the AI-generated answer. */
28
43
  explanation?: string;
44
+ /** Query executed by the AI, if applicable. */
29
45
  executedQuery?: string;
46
+ /** Markdown format type of the executed query response. */
30
47
  queryMarkdownType?: string;
48
+ /** URL to access raw results from the query execution. */
31
49
  rawResultsUrl?: string;
50
+ /** Indicates whether the query execution was successful. */
32
51
  success: boolean;
33
52
  }
34
- 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. */
35
59
  query: string;
60
+ /** The markdown type of the result (sql, mongo, etc.). */
36
61
  markdownType: string;
62
+ /** URL to access raw results from the query execution. */
37
63
  rawResultsUrl?: string;
38
64
  }
65
+ /**
66
+ * Response from executing an AI query across multiple integrations.
67
+ * Includes answers and explanations for each executed query.
68
+ * @category AI
69
+ */
39
70
  export interface ExecuteAiQueryMultiResponse {
71
+ /** AI-generated answer for the multi-integration query. */
40
72
  answer: string;
73
+ /** Optional explanation for the AI-generated response. */
41
74
  explanation?: string;
75
+ /** List of executed queries with details. */
42
76
  executedQueries: Array<ExecutedQuery>;
77
+ /** Indicates whether the query execution was successful. */
43
78
  success: boolean;
44
79
  }
45
- interface ApiResult {
80
+ /**
81
+ * The AI API call response
82
+ * @category AI
83
+ */
84
+ export interface AiApiResult {
85
+ /** ID of the executed API endpoint. */
46
86
  endpointId: string;
87
+ /** Name of the executed API endpoint. */
47
88
  responseBody: string;
89
+ /** Status code of the executed API request. */
48
90
  responseStatusCode: number;
91
+ /** Request body of the executed API request. */
49
92
  requestBody: any;
93
+ /** Request options of the executed API request. */
50
94
  requestOptions: ApiOptions;
51
95
  }
96
+ /**
97
+ * Response from executing an AI-powered API request.
98
+ * Includes the AI-generated answer and details of executed API calls.
99
+ * @category AI
100
+ */
52
101
  export interface ExecuteAiApiResponse {
102
+ /** AI-generated answer for the API request. */
53
103
  answer: string;
104
+ /** Optional explanation for the AI-generated API response. */
54
105
  explanation?: string;
55
- executedApis?: Array<ApiResult>;
106
+ /** List of executed API requests and their results. */
107
+ executedApis?: Array<AiApiResult>;
108
+ /** Markdown format type of the executed query response. */
56
109
  queryMarkdownType?: string;
110
+ /** Indicates whether the API request execution was successful. */
57
111
  success: boolean;
58
112
  }
59
- 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,6 +1,11 @@
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 {
7
+ /** Authentication token for the specified integration. */
4
8
  token: string | undefined;
9
+ /** Optional integration ID associated with the authentication. */
5
10
  integrationId?: IntegrationId;
6
11
  }
@@ -9,9 +9,12 @@ 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> {
15
+ /** Optional document ID. If not provided, it may be generated by the server. */
14
16
  id?: DocIdOrDocIdObj;
17
+ /** Data associated with the document. */
15
18
  data: T;
16
19
  }
17
20
  /**
@@ -22,6 +25,7 @@ export interface DocIdAndData<T extends DocumentData> {
22
25
  * Read more about collection references in the
23
26
  * {@link https://docs.getsquid.ai/docs/client-sdk/database/collection-reference documentation}.
24
27
  * @typeParam T The type of the document data.
28
+ * @category Database
25
29
  */
26
30
  export declare class CollectionReference<T extends DocumentData> {
27
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,5 +1 @@
1
- import { DocTimestamp } from './public-types';
2
- export interface DocTimestampMetadata {
3
- timestamp: DocTimestamp;
4
- expireTimestamp?: number;
5
- }
1
+ export {};
@@ -1,17 +1 @@
1
- import { Observable } from 'rxjs';
2
- export type DestructorFn = () => Promise<void> | void;
3
- /**
4
- * DestructManager handles the execution of pre-destruction and destruction
5
- * tasks, ensuring proper cleanup of resources in an orderly manner.
6
- */
7
- export declare class DestructManager {
8
- private readonly preDestructors;
9
- private readonly destructors;
10
- private readonly isDestructedSubject;
11
- get isDestructing(): boolean;
12
- observeIsDestructing(): Observable<void>;
13
- onPreDestruct(fn: DestructorFn): void;
14
- onDestruct(fn: DestructorFn): void;
15
- destruct(): Promise<void>;
16
- reportDestructed(): void;
17
- }
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,20 +4,51 @@ 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
  };
15
+ /**
16
+ * Defines the fields used for joining two collections in a query.
17
+ * Specifies the left and right fields that establish the join relationship.
18
+ * @category Database
19
+ */
10
20
  export interface JoinFields<ReturnType> {
21
+ /** Field from the left collection to be used in the join. */
11
22
  left: FieldName;
23
+ /** Field from the right collection to be used in the join. */
12
24
  right: keyof ReturnType & FieldName;
13
25
  }
26
+ /**
27
+ * Options for configuring a join query.
28
+ * Specifies aliasing and whether the join is inner or outer.
29
+ * @category Database
30
+ */
14
31
  export interface JoinOptions {
32
+ /** Alias for the left collection in the join. */
15
33
  leftAlias: Alias;
34
+ /** Whether the join should be an inner join (default is outer join). */
16
35
  isInner?: boolean;
17
36
  }
18
- 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]>;
19
- 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>;
20
- 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 {
21
52
  /**
22
53
  * Transforms this join query result to a nested data structure. For example, a join between teachers and students
23
54
  * normally returns a result of the form:
@@ -42,6 +73,7 @@ interface HasGrouped {
42
73
  * To learn more about join queries, see the
43
74
  * {@link https://docs.getsquid.ai/docs/client-sdk/database/queries#joining-data-across-collections-and-integrations
44
75
  * documentation}.
76
+ * @category Database
45
77
  */
46
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 {
47
79
  private readonly collectionName;
@@ -124,9 +156,12 @@ export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, Re
124
156
  paginate(options?: Partial<PaginationOptions>): Pagination<WithDocumentReferences<ReturnType>>;
125
157
  hasIsInner(): boolean;
126
158
  }
127
- 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 {
128
164
  private readonly joinQueryBuilder;
129
- constructor(joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>);
130
165
  /** @inheritDoc */
131
166
  grouped(): SnapshotEmitter<Grouped<Aliases, ReturnType, RootAlias>>;
132
167
  /** @inheritDoc */
@@ -145,7 +180,11 @@ declare class DereferencedJoin<Aliases extends Record<Alias, Alias[]>, ReturnTyp
145
180
  paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
146
181
  serialize(): SerializedJoinQuery;
147
182
  }
148
- 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 {
149
188
  readonly joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
150
189
  /** internal */
151
190
  constructor(joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>);
@@ -168,4 +207,3 @@ declare class GroupedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType ext
168
207
  serialize(): SerializedJoinQuery;
169
208
  paginate(options?: Partial<PaginationOptions>): Pagination<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>;
170
209
  }
171
- 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 {};