@squidcloud/client 1.0.145 → 1.0.146-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -53942
- package/dist/esm/index.js +1 -0
- package/dist/internal-common/src/metric-name.d.ts +9 -0
- package/dist/internal-common/src/public-types/ai-agent-integrations.public-types.d.ts +47 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +895 -0
- package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +31 -0
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +185 -0
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +431 -0
- package/dist/internal-common/src/public-types/ai-matchmaking.public-types.d.ts +186 -0
- package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +170 -0
- package/dist/internal-common/src/public-types/api-client.public-types.d.ts +9 -0
- package/dist/internal-common/src/public-types/api.public-types.d.ts +91 -0
- package/dist/internal-common/src/public-types/backend.public-types.d.ts +50 -0
- package/dist/{common/src/backend-function.schemas.d.ts → internal-common/src/public-types/code-executor.public-types.d.ts} +1 -1
- package/dist/internal-common/src/public-types/communication.public-types.d.ts +30 -0
- package/dist/internal-common/src/public-types/context.public-types.d.ts +83 -0
- package/dist/internal-common/src/public-types/document.public-types.d.ts +71 -0
- package/dist/internal-common/src/public-types/external-auth/external-auth.public-types.d.ts +39 -0
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +183 -0
- package/dist/internal-common/src/public-types/http-status.public-types.d.ts +415 -0
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +51 -0
- package/dist/internal-common/src/public-types/job.public-types.d.ts +59 -0
- package/dist/internal-common/src/public-types/metric.public-types.d.ts +154 -0
- package/dist/internal-common/src/public-types/openapi.public-types.d.ts +9 -0
- package/dist/internal-common/src/public-types/query.public-types.d.ts +113 -0
- package/dist/internal-common/src/public-types/regions.public-types.d.ts +4 -0
- package/dist/internal-common/src/public-types/scheduler.public-types.d.ts +43 -0
- package/dist/{common/src/schema/schema.types.d.ts → internal-common/src/public-types/schema.public-types.d.ts} +54 -54
- package/dist/internal-common/src/public-types/secret.public-types.d.ts +51 -0
- package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +60 -0
- package/dist/internal-common/src/public-types/socket.public-types.d.ts +4 -0
- package/dist/{common/src/types.d.ts → internal-common/src/public-types/typescript.public-types.d.ts} +20 -14
- package/dist/internal-common/src/public-types/web.public-types.d.ts +93 -0
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +148 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +72 -0
- package/dist/{common/src/query/query-context.d.ts → internal-common/src/public-types-backend/query.public-context.d.ts} +177 -137
- package/dist/{common/src/ai-chatbot.schemas.d.ts → internal-common/src/public-utils/context-utils.d.ts} +1 -1
- package/dist/internal-common/src/public-utils/id-utils.d.ts +44 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +199 -0
- package/dist/{common/src/mutation.schemas.d.ts → internal-common/src/types/ai-assistant.types.d.ts} +1 -1
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +202 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +59 -0
- package/dist/{common/src → internal-common/src/types}/backend-function.types.d.ts +1 -1
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/headers.types.d.ts +17 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/notification.types.d.ts +5 -0
- package/dist/internal-common/src/types/observability.types.d.ts +78 -0
- package/dist/internal-common/src/types/query.types.d.ts +13 -0
- package/dist/internal-common/src/types/secret.types.d.ts +7 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/stage.d.ts +9 -0
- package/dist/{common/src → internal-common/src/types}/time-units.d.ts +1 -1
- package/dist/internal-common/src/types/url-shortener.types.d.ts +41 -0
- package/dist/internal-common/src/utils/array.d.ts +7 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/{common → internal-common}/src/utils/global.utils.d.ts +1 -1
- package/dist/internal-common/src/utils/http.d.ts +5 -0
- package/dist/{common → internal-common}/src/utils/lock.manager.d.ts +14 -14
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +58 -0
- package/dist/internal-common/src/utils/serialization.d.ts +17 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +1 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +19 -0
- package/dist/{common → internal-common}/src/websocket.impl.d.ts +26 -21
- package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
- package/dist/typescript-client/src/admin-client.d.ts +23 -0
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +181 -0
- package/dist/typescript-client/src/agent/ai-agent-client.d.ts +37 -0
- package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +69 -0
- package/dist/typescript-client/src/ai-assistant-client.d.ts +72 -73
- package/dist/typescript-client/src/ai-audio-client.d.ts +25 -0
- package/dist/typescript-client/src/ai-client.d.ts +129 -0
- package/dist/typescript-client/src/ai-files-client.d.ts +33 -0
- package/dist/typescript-client/src/ai-image-client.d.ts +25 -0
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +86 -0
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +28 -0
- package/dist/typescript-client/src/ai-matchmaking-client.d.ts +99 -0
- package/dist/typescript-client/src/api-client.d.ts +69 -0
- package/dist/typescript-client/src/auth.manager.d.ts +11 -26
- package/dist/typescript-client/src/backend-function.manager.d.ts +1 -9
- package/dist/typescript-client/src/client-customization.utils.d.ts +1 -0
- package/dist/typescript-client/src/client-id.service.d.ts +1 -27
- package/dist/typescript-client/src/collection-reference.d.ts +105 -80
- package/dist/typescript-client/src/collection-reference.factory.d.ts +1 -13
- package/dist/typescript-client/src/connection-details.d.ts +24 -23
- package/dist/typescript-client/src/console-utils.d.ts +1 -0
- package/dist/typescript-client/src/data.manager.d.ts +1 -173
- package/dist/typescript-client/src/destruct.manager.d.ts +1 -12
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +39 -16
- package/dist/typescript-client/src/document-identity.service.d.ts +1 -12
- package/dist/typescript-client/src/document-reference.d.ts +151 -140
- package/dist/typescript-client/src/document-reference.factory.d.ts +1 -13
- package/dist/typescript-client/src/document-store.d.ts +1 -14
- package/dist/typescript-client/src/execute-function-options.d.ts +73 -0
- package/dist/typescript-client/src/external-auth-client.d.ts +36 -0
- package/dist/typescript-client/src/extraction-client.d.ts +32 -0
- package/dist/typescript-client/src/file-args-transformer.d.ts +1 -0
- package/dist/typescript-client/src/file-utils.d.ts +1 -0
- package/dist/typescript-client/src/index.d.ts +63 -9
- package/dist/typescript-client/src/integration-client.d.ts +60 -0
- package/dist/typescript-client/src/job-client.d.ts +32 -0
- package/dist/typescript-client/src/mutation/mutation-sender.d.ts +1 -10
- package/dist/typescript-client/src/native-query-manager.d.ts +1 -7
- package/dist/typescript-client/src/notification-client.d.ts +20 -0
- package/dist/typescript-client/src/observability-client.d.ts +43 -0
- package/dist/typescript-client/src/public-types.d.ts +30 -0
- package/dist/typescript-client/src/public-utils.d.ts +1 -0
- package/dist/typescript-client/src/query/deserializer.d.ts +10 -3
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +316 -161
- package/dist/typescript-client/src/query/local-query-manager.d.ts +1 -9
- package/dist/{common → typescript-client}/src/query/pagination.d.ts +65 -62
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +228 -77
- package/dist/typescript-client/src/query/query-sender.d.ts +1 -33
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +1 -130
- package/dist/typescript-client/src/query/query.types.d.ts +16 -49
- package/dist/typescript-client/src/query/snapshot-emitter.d.ts +41 -0
- package/dist/typescript-client/src/query-utils.d.ts +18 -0
- package/dist/typescript-client/src/queue.manager.d.ts +12 -0
- package/dist/typescript-client/src/rate-limiter.d.ts +1 -32
- package/dist/typescript-client/src/rpc.manager.d.ts +1 -30
- package/dist/typescript-client/src/scheduler-client.d.ts +31 -0
- package/dist/typescript-client/src/secret.client.d.ts +96 -22
- package/dist/typescript-client/src/socket.manager.d.ts +1 -43
- package/dist/typescript-client/src/squid-http-client.d.ts +11 -0
- package/dist/typescript-client/src/squid.d.ts +378 -269
- package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
- package/dist/typescript-client/src/storage-client.d.ts +145 -0
- package/dist/typescript-client/src/types.d.ts +27 -2
- package/dist/typescript-client/src/version.d.ts +5 -0
- package/dist/typescript-client/src/web-client.d.ts +63 -0
- package/dist/typescript-client/src/webhook.manager.d.ts +10 -0
- package/package.json +34 -18
- package/dist/common/src/ai-assistant.types.d.ts +0 -25
- package/dist/common/src/ai-chatbot.context.d.ts +0 -12
- package/dist/common/src/ai-chatbot.types.d.ts +0 -27
- package/dist/common/src/api-call.context.d.ts +0 -13
- package/dist/common/src/api.types.d.ts +0 -4
- package/dist/common/src/application.schemas.d.ts +0 -66
- package/dist/common/src/application.types.d.ts +0 -143
- package/dist/common/src/backend-run.types.d.ts +0 -2
- package/dist/common/src/bundle-api.types.d.ts +0 -43
- package/dist/common/src/bundle-data.types.d.ts +0 -5
- package/dist/common/src/communication.types.d.ts +0 -8
- package/dist/common/src/context.types.d.ts +0 -40
- package/dist/common/src/distributed-lock.context.d.ts +0 -4
- package/dist/common/src/document.types.d.ts +0 -22
- package/dist/common/src/graphql.context.d.ts +0 -7
- package/dist/common/src/graphql.types.d.ts +0 -9
- package/dist/common/src/heartbeat.types.d.ts +0 -1
- package/dist/common/src/http-status.enum.d.ts +0 -50
- package/dist/common/src/index.d.ts +0 -57
- package/dist/common/src/integrations/ai_chatbot.types.d.ts +0 -31
- package/dist/common/src/integrations/api.types.d.ts +0 -80
- package/dist/common/src/integrations/auth.types.d.ts +0 -47
- package/dist/common/src/integrations/database.types.d.ts +0 -274
- package/dist/common/src/integrations/index.d.ts +0 -134
- package/dist/common/src/integrations/observability.types.d.ts +0 -23
- package/dist/common/src/logger.types.d.ts +0 -21
- package/dist/common/src/metrics.types.d.ts +0 -1
- package/dist/common/src/mutation.context.d.ts +0 -14
- package/dist/common/src/mutation.types.d.ts +0 -53
- package/dist/common/src/named-query.context.d.ts +0 -4
- package/dist/common/src/named-query.schemas.d.ts +0 -1
- package/dist/common/src/named-query.types.d.ts +0 -1
- package/dist/common/src/native-query.context.d.ts +0 -7
- package/dist/common/src/native-query.types.d.ts +0 -16
- package/dist/common/src/query/base-query-builder.d.ts +0 -147
- package/dist/common/src/query/index.d.ts +0 -4
- package/dist/common/src/query/serialized-query.types.d.ts +0 -24
- package/dist/common/src/query.types.d.ts +0 -64
- package/dist/common/src/regions.d.ts +0 -1
- package/dist/common/src/secret.schemas.d.ts +0 -1
- package/dist/common/src/secret.types.d.ts +0 -22
- package/dist/common/src/security.types.d.ts +0 -1
- package/dist/common/src/socket.schemas.d.ts +0 -1
- package/dist/common/src/socket.types.d.ts +0 -5
- package/dist/common/src/trigger.types.d.ts +0 -1
- package/dist/common/src/utils/array.d.ts +0 -1
- package/dist/common/src/utils/assert.d.ts +0 -1
- package/dist/common/src/utils/error.d.ts +0 -4
- package/dist/common/src/utils/http.d.ts +0 -2
- package/dist/common/src/utils/id.d.ts +0 -2
- package/dist/common/src/utils/object.d.ts +0 -5
- package/dist/common/src/utils/serialization.d.ts +0 -6
- package/dist/common/src/utils/transforms.d.ts +0 -18
- package/dist/common/src/utils/url.d.ts +0 -1
- package/dist/common/src/utils/validation.d.ts +0 -25
- package/dist/common/src/webhook-response.d.ts +0 -1
- package/dist/typescript-client/src/ai-chatbot-client.d.ts +0 -174
- package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +0 -8
- package/dist/typescript-client/src/ai.types.d.ts +0 -61
- package/dist/typescript-client/src/api.manager.d.ts +0 -11
- package/dist/typescript-client/src/graphql-client.d.ts +0 -14
- package/dist/typescript-client/src/graphql-client.factory.d.ts +0 -11
- package/dist/typescript-client/src/named-query.manager.d.ts +0 -11
- package/dist/typescript-client/src/state/action.applier.d.ts +0 -7
- package/dist/typescript-client/src/state/actions.d.ts +0 -29
- package/dist/typescript-client/src/state/path_trie.d.ts +0 -27
- package/dist/typescript-client/src/state/state.service.d.ts +0 -22
- package/dist/typescript-client/src/testing/setup-tests.d.ts +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request to search the web.
|
|
3
|
+
*/
|
|
4
|
+
export interface WebAiSearchRequest {
|
|
5
|
+
/** The search query. */
|
|
6
|
+
query: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Represents a cited URL in the search response.
|
|
10
|
+
*/
|
|
11
|
+
export interface WebAiSearchCitedUrl {
|
|
12
|
+
/** The URL of the cited resource. */
|
|
13
|
+
url: string;
|
|
14
|
+
/** The title of the cited resource. */
|
|
15
|
+
title: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Response from a web search.
|
|
19
|
+
*/
|
|
20
|
+
export interface WebAiSearchResponse {
|
|
21
|
+
/** The search result content in Markdown format. */
|
|
22
|
+
markdownText: string;
|
|
23
|
+
/** A list of cited URLs included in the search response. */
|
|
24
|
+
citedUrls: Array<WebAiSearchCitedUrl>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Request to fetch content from a URL.
|
|
28
|
+
*/
|
|
29
|
+
export interface WebGetUrlContentRequest {
|
|
30
|
+
/** The URL to fetch content from. */
|
|
31
|
+
url: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Response from fetching content from a URL.
|
|
35
|
+
*/
|
|
36
|
+
export interface WebGetUrlContentResponse {
|
|
37
|
+
/** The content fetched from the URL in Markdown format. */
|
|
38
|
+
markdownText: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Request to create a shortened URL.
|
|
42
|
+
*/
|
|
43
|
+
export interface WebShortUrlRequest {
|
|
44
|
+
/** The URL to shorten. It must be a valid URL and should include the protocol (start with http:// or https://). */
|
|
45
|
+
url: string;
|
|
46
|
+
/** Seconds to live for the shortened URL. If set to 0, the URL will never expire. Defaults to 1 day. */
|
|
47
|
+
secondsToLive?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Request to create shortened URLs.
|
|
51
|
+
*/
|
|
52
|
+
export interface WebShortUrlBulkRequest {
|
|
53
|
+
/** The URLs to shorten. They must be valid URLs and should include the protocol (start with http:// or https://). */
|
|
54
|
+
urls: string[];
|
|
55
|
+
/** Seconds to live for all shortened URLs. If set to 0, the URLs will never expire. Defaults to 1 day. */
|
|
56
|
+
secondsToLive?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Response with the newly created shortened URL.
|
|
60
|
+
*/
|
|
61
|
+
export interface WebShortUrlResponse {
|
|
62
|
+
/** The ID of the shortened URL. */
|
|
63
|
+
id: string;
|
|
64
|
+
/** The full valid shortened URL. */
|
|
65
|
+
shortUrl: string;
|
|
66
|
+
/** The time when the shortened URL will expire. */
|
|
67
|
+
expiry: Date | null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Response with the newly created shortened URL.
|
|
71
|
+
*/
|
|
72
|
+
export interface WebShortUrlBulkResponse {
|
|
73
|
+
/** The IDs of the shortened URLs. */
|
|
74
|
+
ids: string[];
|
|
75
|
+
/** List of full valid shortened URLs. */
|
|
76
|
+
shortUrls: string[];
|
|
77
|
+
/** The time when the shortened URLs will expire. */
|
|
78
|
+
expiry: Date | null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Request to delete a shortened URL.
|
|
82
|
+
*/
|
|
83
|
+
export interface WebShortUrlDeleteRequest {
|
|
84
|
+
/** The ID of the shortened URL to delete. */
|
|
85
|
+
id: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Request to delete a shortened URL.
|
|
89
|
+
*/
|
|
90
|
+
export interface WebShortUrlBulkDeleteRequest {
|
|
91
|
+
/** The IDs of the shortened URLs to delete. */
|
|
92
|
+
ids: string[];
|
|
93
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApiOptions } from '../public-types/api-client.public-types';
|
|
2
|
+
import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types';
|
|
3
|
+
import { IntegrationId } from '../public-types/communication.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
|
+
/**
|
|
16
|
+
* Represents a request to call an API through a specified integration and endpoint.
|
|
17
|
+
* Includes optional method override and additional request options.
|
|
18
|
+
*/
|
|
19
|
+
export interface CallApiRequest<BodyType = any> {
|
|
20
|
+
/** The identifier of the integration through which the API is called. */
|
|
21
|
+
integrationId: IntegrationId;
|
|
22
|
+
/** Target API endpoint to invoke. */
|
|
23
|
+
endpointId: ApiEndpointId;
|
|
24
|
+
/** Optional request payload. */
|
|
25
|
+
body?: BodyType;
|
|
26
|
+
/** Optional HTTP method override. Default is POST. */
|
|
27
|
+
overrideMethod?: HttpMethod;
|
|
28
|
+
/** Additional request options. */
|
|
29
|
+
options: ApiOptions;
|
|
30
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types';
|
|
2
|
+
import { Paths } from '../public-types/typescript.public-types';
|
|
3
|
+
/**
|
|
4
|
+
* The mutation type.
|
|
5
|
+
* @category Database
|
|
6
|
+
*/
|
|
7
|
+
export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"];
|
|
8
|
+
/**
|
|
9
|
+
* @category Database
|
|
10
|
+
*/
|
|
11
|
+
export type MutationType = (typeof MUTATION_TYPES)[number];
|
|
12
|
+
interface BaseMutation {
|
|
13
|
+
type: MutationType;
|
|
14
|
+
squidDocIdObj: SquidDocIdObj;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A mutation on a document.
|
|
18
|
+
* @category Database
|
|
19
|
+
*/
|
|
20
|
+
export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
|
|
21
|
+
/**
|
|
22
|
+
* Represents a delete mutation on a document.
|
|
23
|
+
* @category Database
|
|
24
|
+
*/
|
|
25
|
+
export interface DeleteMutation extends BaseMutation {
|
|
26
|
+
/** Specifies that the mutation is a deletion. */
|
|
27
|
+
type: 'delete';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Represents an update mutation on a document.
|
|
31
|
+
* @category Database
|
|
32
|
+
*/
|
|
33
|
+
export interface UpdateMutation<T = any> extends BaseMutation {
|
|
34
|
+
/** Specifies that the mutation is an update. */
|
|
35
|
+
type: 'update';
|
|
36
|
+
/** The updated properties */
|
|
37
|
+
properties: {
|
|
38
|
+
[key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents an insert mutation on a document.
|
|
43
|
+
* @category Database
|
|
44
|
+
*/
|
|
45
|
+
export interface InsertMutation<T = any> extends BaseMutation {
|
|
46
|
+
/** Specifies that the mutation is an insertion. */
|
|
47
|
+
type: 'insert';
|
|
48
|
+
/** The inserted document */
|
|
49
|
+
properties: T;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A representation of a single property update.
|
|
53
|
+
* @category Database
|
|
54
|
+
*/
|
|
55
|
+
export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
|
|
56
|
+
/**
|
|
57
|
+
* A value update property mutation.
|
|
58
|
+
* @category Database
|
|
59
|
+
*/
|
|
60
|
+
export interface ValueUpdatePropertyMutation<Value = any> {
|
|
61
|
+
/** Specifies that the mutation updates a value. */
|
|
62
|
+
type: 'update';
|
|
63
|
+
/** New value to be set. */
|
|
64
|
+
value: Value;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Applying a numeric function to a property.
|
|
68
|
+
* @category Database
|
|
69
|
+
*/
|
|
70
|
+
export interface ApplyNumericFnPropertyMutation {
|
|
71
|
+
/** Specifies that the mutation applies a numeric function. */
|
|
72
|
+
type: 'applyNumericFn';
|
|
73
|
+
/** Numeric function to apply. */
|
|
74
|
+
fn: 'increment';
|
|
75
|
+
/** Value to use in the numeric function. */
|
|
76
|
+
value: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A property update that removes a property from a document.
|
|
80
|
+
* @category Database
|
|
81
|
+
*/
|
|
82
|
+
export interface RemovePropertyMutation {
|
|
83
|
+
/** Specifies that the mutation removes a property. */
|
|
84
|
+
type: 'removeProperty';
|
|
85
|
+
}
|
|
86
|
+
interface ApplyExtendString {
|
|
87
|
+
/** Specifies that the mutation applies a string function. */
|
|
88
|
+
type: 'applyStringFn';
|
|
89
|
+
/** String function to extend the existing string. */
|
|
90
|
+
fn: 'extendString';
|
|
91
|
+
/** String value to append. */
|
|
92
|
+
value: string;
|
|
93
|
+
}
|
|
94
|
+
interface ApplyTrimString {
|
|
95
|
+
/** Specifies that the mutation applies a string function. */
|
|
96
|
+
type: 'applyStringFn';
|
|
97
|
+
/** String function to trim the existing string. */
|
|
98
|
+
fn: 'trim';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A property mutation that modifies a string.
|
|
102
|
+
* @category Database
|
|
103
|
+
*/
|
|
104
|
+
export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
|
|
105
|
+
/**
|
|
106
|
+
* The before and after documents of a document change.
|
|
107
|
+
* @category Database
|
|
108
|
+
*/
|
|
109
|
+
export interface BeforeAndAfterDocs<T = SquidDocument> {
|
|
110
|
+
/** Document state before the mutation. */
|
|
111
|
+
before: T | undefined;
|
|
112
|
+
/** Document state after the mutation. */
|
|
113
|
+
after: T | undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The mutation context that will be provided to the security function.
|
|
117
|
+
* @category Database
|
|
118
|
+
*/
|
|
119
|
+
export declare class MutationContext<T = any> {
|
|
120
|
+
readonly mutation: Mutation<T>;
|
|
121
|
+
readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
|
|
122
|
+
readonly serverTimeStamp: Date;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the state of the document before the mutation was applied.
|
|
125
|
+
*/
|
|
126
|
+
get before(): T | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Returns the state of the document after the mutation was applied.
|
|
129
|
+
*/
|
|
130
|
+
get after(): T | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the type of the mutation (insert, update, or delete).
|
|
133
|
+
*/
|
|
134
|
+
getMutationType(): MutationType;
|
|
135
|
+
/** Returns true if the mutation affects the provided path. */
|
|
136
|
+
affectsPath(path: Paths<T>): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Find all affected paths starting from a root path.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* doc before - { a: { b: 1, c: 2 }, d: 3 }
|
|
142
|
+
* doc after - { a: { b: 1, c: 3 }, d: 4 }
|
|
143
|
+
* doc.affectedPaths('a') // ['a.c']
|
|
144
|
+
*/
|
|
145
|
+
affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
|
|
146
|
+
private checkPath;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the type of native query request, either relational, elastic or MongoDB.
|
|
4
|
+
* @category Database
|
|
5
|
+
*/
|
|
6
|
+
export type NativeQueryRequestType = 'relational' | 'mongo' | 'elasticsearch' | 'pure';
|
|
7
|
+
interface BaseNativeQueryContext {
|
|
8
|
+
/** Type of the native query request. */
|
|
9
|
+
type: NativeQueryRequestType;
|
|
10
|
+
/** Identifier for the integration. */
|
|
11
|
+
integrationId: IntegrationId;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Context for executing a relational database query.
|
|
15
|
+
* @category Database
|
|
16
|
+
*/
|
|
17
|
+
export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
|
|
18
|
+
/** Specifies that the query is for a relational database. */
|
|
19
|
+
type: 'relational';
|
|
20
|
+
/** SQL query string to be executed. */
|
|
21
|
+
query: string;
|
|
22
|
+
/** Parameters to be used in the query. */
|
|
23
|
+
params: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Context for executing a MongoDB query.
|
|
27
|
+
* @category Database
|
|
28
|
+
*/
|
|
29
|
+
export interface MongoNativeQueryContext extends BaseNativeQueryContext {
|
|
30
|
+
/** Specifies that the query is for a Mongo database. */
|
|
31
|
+
type: 'mongo';
|
|
32
|
+
/** Name of the MongoDB collection to query. */
|
|
33
|
+
collectionName: string;
|
|
34
|
+
/** Array of aggregation pipeline stages. */
|
|
35
|
+
aggregationPipeline: Array<any | undefined>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Context for executing an Elasticsearch query.
|
|
39
|
+
* @category Database
|
|
40
|
+
*/
|
|
41
|
+
export interface ElasticsearchNativeQueryContext {
|
|
42
|
+
/** Specifies that the query is for an Elasticsearch database. */
|
|
43
|
+
type: 'elasticsearch';
|
|
44
|
+
/** Elasticsearch index to query. */
|
|
45
|
+
index: string;
|
|
46
|
+
/** Elasticsearch query string. */
|
|
47
|
+
endpoint?: string;
|
|
48
|
+
/** HTTP method to use for the request. */
|
|
49
|
+
method?: 'GET' | 'POST';
|
|
50
|
+
/** Body of the request. */
|
|
51
|
+
body: Record<string, any>;
|
|
52
|
+
/** Headers to include in the request. */
|
|
53
|
+
integrationId: IntegrationId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Context for executing a pure database query.
|
|
57
|
+
* @category Database
|
|
58
|
+
*/
|
|
59
|
+
export interface PureNativeQueryContext extends BaseNativeQueryContext {
|
|
60
|
+
/** Specifies that the query is for a relational database. */
|
|
61
|
+
type: 'pure';
|
|
62
|
+
/** SQL query string to be executed. */
|
|
63
|
+
query: string;
|
|
64
|
+
/** Parameters to be used in the query. */
|
|
65
|
+
params: Record<string, any>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Union type representing either a relational or MongoDB native query context.
|
|
69
|
+
* @category Database
|
|
70
|
+
*/
|
|
71
|
+
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext | PureNativeQueryContext;
|
|
72
|
+
export {};
|