@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.
Files changed (206) hide show
  1. package/dist/cjs/index.js +1 -53942
  2. package/dist/esm/index.js +1 -0
  3. package/dist/internal-common/src/metric-name.d.ts +9 -0
  4. package/dist/internal-common/src/public-types/ai-agent-integrations.public-types.d.ts +47 -0
  5. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +895 -0
  6. package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +31 -0
  7. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +185 -0
  8. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +431 -0
  9. package/dist/internal-common/src/public-types/ai-matchmaking.public-types.d.ts +186 -0
  10. package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +170 -0
  11. package/dist/internal-common/src/public-types/api-client.public-types.d.ts +9 -0
  12. package/dist/internal-common/src/public-types/api.public-types.d.ts +91 -0
  13. package/dist/internal-common/src/public-types/backend.public-types.d.ts +50 -0
  14. package/dist/{common/src/backend-function.schemas.d.ts → internal-common/src/public-types/code-executor.public-types.d.ts} +1 -1
  15. package/dist/internal-common/src/public-types/communication.public-types.d.ts +30 -0
  16. package/dist/internal-common/src/public-types/context.public-types.d.ts +83 -0
  17. package/dist/internal-common/src/public-types/document.public-types.d.ts +71 -0
  18. package/dist/internal-common/src/public-types/external-auth/external-auth.public-types.d.ts +39 -0
  19. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +183 -0
  20. package/dist/internal-common/src/public-types/http-status.public-types.d.ts +415 -0
  21. package/dist/internal-common/src/public-types/integration.public-types.d.ts +51 -0
  22. package/dist/internal-common/src/public-types/job.public-types.d.ts +59 -0
  23. package/dist/internal-common/src/public-types/metric.public-types.d.ts +154 -0
  24. package/dist/internal-common/src/public-types/openapi.public-types.d.ts +9 -0
  25. package/dist/internal-common/src/public-types/query.public-types.d.ts +113 -0
  26. package/dist/internal-common/src/public-types/regions.public-types.d.ts +4 -0
  27. package/dist/internal-common/src/public-types/scheduler.public-types.d.ts +43 -0
  28. package/dist/{common/src/schema/schema.types.d.ts → internal-common/src/public-types/schema.public-types.d.ts} +54 -54
  29. package/dist/internal-common/src/public-types/secret.public-types.d.ts +51 -0
  30. package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +60 -0
  31. package/dist/internal-common/src/public-types/socket.public-types.d.ts +4 -0
  32. package/dist/{common/src/types.d.ts → internal-common/src/public-types/typescript.public-types.d.ts} +20 -14
  33. package/dist/internal-common/src/public-types/web.public-types.d.ts +93 -0
  34. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
  35. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +148 -0
  36. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +72 -0
  37. package/dist/{common/src/query/query-context.d.ts → internal-common/src/public-types-backend/query.public-context.d.ts} +177 -137
  38. package/dist/{common/src/ai-chatbot.schemas.d.ts → internal-common/src/public-utils/context-utils.d.ts} +1 -1
  39. package/dist/internal-common/src/public-utils/id-utils.d.ts +44 -0
  40. package/dist/internal-common/src/types/ai-agent.types.d.ts +199 -0
  41. package/dist/{common/src/mutation.schemas.d.ts → internal-common/src/types/ai-assistant.types.d.ts} +1 -1
  42. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +202 -0
  43. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +59 -0
  44. package/dist/{common/src → internal-common/src/types}/backend-function.types.d.ts +1 -1
  45. package/dist/internal-common/src/types/communication.types.d.ts +1 -0
  46. package/dist/internal-common/src/types/document.types.d.ts +1 -0
  47. package/dist/internal-common/src/types/file.types.d.ts +6 -0
  48. package/dist/internal-common/src/types/headers.types.d.ts +17 -0
  49. package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
  50. package/dist/internal-common/src/types/notification.types.d.ts +5 -0
  51. package/dist/internal-common/src/types/observability.types.d.ts +78 -0
  52. package/dist/internal-common/src/types/query.types.d.ts +13 -0
  53. package/dist/internal-common/src/types/secret.types.d.ts +7 -0
  54. package/dist/internal-common/src/types/socket.types.d.ts +1 -0
  55. package/dist/internal-common/src/types/stage.d.ts +9 -0
  56. package/dist/{common/src → internal-common/src/types}/time-units.d.ts +1 -1
  57. package/dist/internal-common/src/types/url-shortener.types.d.ts +41 -0
  58. package/dist/internal-common/src/utils/array.d.ts +7 -0
  59. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
  60. package/dist/{common → internal-common}/src/utils/global.utils.d.ts +1 -1
  61. package/dist/internal-common/src/utils/http.d.ts +5 -0
  62. package/dist/{common → internal-common}/src/utils/lock.manager.d.ts +14 -14
  63. package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
  64. package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
  65. package/dist/internal-common/src/utils/object.d.ts +58 -0
  66. package/dist/internal-common/src/utils/serialization.d.ts +17 -0
  67. package/dist/internal-common/src/utils/squid.constants.d.ts +1 -0
  68. package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
  69. package/dist/internal-common/src/utils/validation.d.ts +19 -0
  70. package/dist/{common → internal-common}/src/websocket.impl.d.ts +26 -21
  71. package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
  72. package/dist/typescript-client/src/admin-client.d.ts +23 -0
  73. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +181 -0
  74. package/dist/typescript-client/src/agent/ai-agent-client.d.ts +37 -0
  75. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +69 -0
  76. package/dist/typescript-client/src/ai-assistant-client.d.ts +72 -73
  77. package/dist/typescript-client/src/ai-audio-client.d.ts +25 -0
  78. package/dist/typescript-client/src/ai-client.d.ts +129 -0
  79. package/dist/typescript-client/src/ai-files-client.d.ts +33 -0
  80. package/dist/typescript-client/src/ai-image-client.d.ts +25 -0
  81. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +86 -0
  82. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +28 -0
  83. package/dist/typescript-client/src/ai-matchmaking-client.d.ts +99 -0
  84. package/dist/typescript-client/src/api-client.d.ts +69 -0
  85. package/dist/typescript-client/src/auth.manager.d.ts +11 -26
  86. package/dist/typescript-client/src/backend-function.manager.d.ts +1 -9
  87. package/dist/typescript-client/src/client-customization.utils.d.ts +1 -0
  88. package/dist/typescript-client/src/client-id.service.d.ts +1 -27
  89. package/dist/typescript-client/src/collection-reference.d.ts +105 -80
  90. package/dist/typescript-client/src/collection-reference.factory.d.ts +1 -13
  91. package/dist/typescript-client/src/connection-details.d.ts +24 -23
  92. package/dist/typescript-client/src/console-utils.d.ts +1 -0
  93. package/dist/typescript-client/src/data.manager.d.ts +1 -173
  94. package/dist/typescript-client/src/destruct.manager.d.ts +1 -12
  95. package/dist/typescript-client/src/distributed-lock.manager.d.ts +39 -16
  96. package/dist/typescript-client/src/document-identity.service.d.ts +1 -12
  97. package/dist/typescript-client/src/document-reference.d.ts +151 -140
  98. package/dist/typescript-client/src/document-reference.factory.d.ts +1 -13
  99. package/dist/typescript-client/src/document-store.d.ts +1 -14
  100. package/dist/typescript-client/src/execute-function-options.d.ts +73 -0
  101. package/dist/typescript-client/src/external-auth-client.d.ts +36 -0
  102. package/dist/typescript-client/src/extraction-client.d.ts +32 -0
  103. package/dist/typescript-client/src/file-args-transformer.d.ts +1 -0
  104. package/dist/typescript-client/src/file-utils.d.ts +1 -0
  105. package/dist/typescript-client/src/index.d.ts +63 -9
  106. package/dist/typescript-client/src/integration-client.d.ts +60 -0
  107. package/dist/typescript-client/src/job-client.d.ts +32 -0
  108. package/dist/typescript-client/src/mutation/mutation-sender.d.ts +1 -10
  109. package/dist/typescript-client/src/native-query-manager.d.ts +1 -7
  110. package/dist/typescript-client/src/notification-client.d.ts +20 -0
  111. package/dist/typescript-client/src/observability-client.d.ts +43 -0
  112. package/dist/typescript-client/src/public-types.d.ts +30 -0
  113. package/dist/typescript-client/src/public-utils.d.ts +1 -0
  114. package/dist/typescript-client/src/query/deserializer.d.ts +10 -3
  115. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +316 -161
  116. package/dist/typescript-client/src/query/local-query-manager.d.ts +1 -9
  117. package/dist/{common → typescript-client}/src/query/pagination.d.ts +65 -62
  118. package/dist/typescript-client/src/query/query-builder.factory.d.ts +228 -77
  119. package/dist/typescript-client/src/query/query-sender.d.ts +1 -33
  120. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +1 -130
  121. package/dist/typescript-client/src/query/query.types.d.ts +16 -49
  122. package/dist/typescript-client/src/query/snapshot-emitter.d.ts +41 -0
  123. package/dist/typescript-client/src/query-utils.d.ts +18 -0
  124. package/dist/typescript-client/src/queue.manager.d.ts +12 -0
  125. package/dist/typescript-client/src/rate-limiter.d.ts +1 -32
  126. package/dist/typescript-client/src/rpc.manager.d.ts +1 -30
  127. package/dist/typescript-client/src/scheduler-client.d.ts +31 -0
  128. package/dist/typescript-client/src/secret.client.d.ts +96 -22
  129. package/dist/typescript-client/src/socket.manager.d.ts +1 -43
  130. package/dist/typescript-client/src/squid-http-client.d.ts +11 -0
  131. package/dist/typescript-client/src/squid.d.ts +378 -269
  132. package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
  133. package/dist/typescript-client/src/storage-client.d.ts +145 -0
  134. package/dist/typescript-client/src/types.d.ts +27 -2
  135. package/dist/typescript-client/src/version.d.ts +5 -0
  136. package/dist/typescript-client/src/web-client.d.ts +63 -0
  137. package/dist/typescript-client/src/webhook.manager.d.ts +10 -0
  138. package/package.json +34 -18
  139. package/dist/common/src/ai-assistant.types.d.ts +0 -25
  140. package/dist/common/src/ai-chatbot.context.d.ts +0 -12
  141. package/dist/common/src/ai-chatbot.types.d.ts +0 -27
  142. package/dist/common/src/api-call.context.d.ts +0 -13
  143. package/dist/common/src/api.types.d.ts +0 -4
  144. package/dist/common/src/application.schemas.d.ts +0 -66
  145. package/dist/common/src/application.types.d.ts +0 -143
  146. package/dist/common/src/backend-run.types.d.ts +0 -2
  147. package/dist/common/src/bundle-api.types.d.ts +0 -43
  148. package/dist/common/src/bundle-data.types.d.ts +0 -5
  149. package/dist/common/src/communication.types.d.ts +0 -8
  150. package/dist/common/src/context.types.d.ts +0 -40
  151. package/dist/common/src/distributed-lock.context.d.ts +0 -4
  152. package/dist/common/src/document.types.d.ts +0 -22
  153. package/dist/common/src/graphql.context.d.ts +0 -7
  154. package/dist/common/src/graphql.types.d.ts +0 -9
  155. package/dist/common/src/heartbeat.types.d.ts +0 -1
  156. package/dist/common/src/http-status.enum.d.ts +0 -50
  157. package/dist/common/src/index.d.ts +0 -57
  158. package/dist/common/src/integrations/ai_chatbot.types.d.ts +0 -31
  159. package/dist/common/src/integrations/api.types.d.ts +0 -80
  160. package/dist/common/src/integrations/auth.types.d.ts +0 -47
  161. package/dist/common/src/integrations/database.types.d.ts +0 -274
  162. package/dist/common/src/integrations/index.d.ts +0 -134
  163. package/dist/common/src/integrations/observability.types.d.ts +0 -23
  164. package/dist/common/src/logger.types.d.ts +0 -21
  165. package/dist/common/src/metrics.types.d.ts +0 -1
  166. package/dist/common/src/mutation.context.d.ts +0 -14
  167. package/dist/common/src/mutation.types.d.ts +0 -53
  168. package/dist/common/src/named-query.context.d.ts +0 -4
  169. package/dist/common/src/named-query.schemas.d.ts +0 -1
  170. package/dist/common/src/named-query.types.d.ts +0 -1
  171. package/dist/common/src/native-query.context.d.ts +0 -7
  172. package/dist/common/src/native-query.types.d.ts +0 -16
  173. package/dist/common/src/query/base-query-builder.d.ts +0 -147
  174. package/dist/common/src/query/index.d.ts +0 -4
  175. package/dist/common/src/query/serialized-query.types.d.ts +0 -24
  176. package/dist/common/src/query.types.d.ts +0 -64
  177. package/dist/common/src/regions.d.ts +0 -1
  178. package/dist/common/src/secret.schemas.d.ts +0 -1
  179. package/dist/common/src/secret.types.d.ts +0 -22
  180. package/dist/common/src/security.types.d.ts +0 -1
  181. package/dist/common/src/socket.schemas.d.ts +0 -1
  182. package/dist/common/src/socket.types.d.ts +0 -5
  183. package/dist/common/src/trigger.types.d.ts +0 -1
  184. package/dist/common/src/utils/array.d.ts +0 -1
  185. package/dist/common/src/utils/assert.d.ts +0 -1
  186. package/dist/common/src/utils/error.d.ts +0 -4
  187. package/dist/common/src/utils/http.d.ts +0 -2
  188. package/dist/common/src/utils/id.d.ts +0 -2
  189. package/dist/common/src/utils/object.d.ts +0 -5
  190. package/dist/common/src/utils/serialization.d.ts +0 -6
  191. package/dist/common/src/utils/transforms.d.ts +0 -18
  192. package/dist/common/src/utils/url.d.ts +0 -1
  193. package/dist/common/src/utils/validation.d.ts +0 -25
  194. package/dist/common/src/webhook-response.d.ts +0 -1
  195. package/dist/typescript-client/src/ai-chatbot-client.d.ts +0 -174
  196. package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +0 -8
  197. package/dist/typescript-client/src/ai.types.d.ts +0 -61
  198. package/dist/typescript-client/src/api.manager.d.ts +0 -11
  199. package/dist/typescript-client/src/graphql-client.d.ts +0 -14
  200. package/dist/typescript-client/src/graphql-client.factory.d.ts +0 -11
  201. package/dist/typescript-client/src/named-query.manager.d.ts +0 -11
  202. package/dist/typescript-client/src/state/action.applier.d.ts +0 -7
  203. package/dist/typescript-client/src/state/actions.d.ts +0 -29
  204. package/dist/typescript-client/src/state/path_trie.d.ts +0 -27
  205. package/dist/typescript-client/src/state/state.service.d.ts +0 -22
  206. package/dist/typescript-client/src/testing/setup-tests.d.ts +0 -1
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -0,0 +1,145 @@
1
+ import { IntegrationId } from '../../internal-common/src/public-types/communication.public-types';
2
+ /**
3
+ * Represents a request to upload a file to a specified directory within the storage bucket.
4
+ * @category Storage
5
+ */
6
+ export interface StorageFileUploadRequest {
7
+ /** The ID of the integration where the file will be uploaded. */
8
+ integrationId: IntegrationId;
9
+ /** The directory path within the bucket where the file should be stored. */
10
+ dirPathInBucket: string;
11
+ /** Optional expiration time in seconds for the uploaded file. */
12
+ expirationInSeconds?: number;
13
+ }
14
+ /**
15
+ * Represents a request to retrieve metadata for a specific file stored in the bucket.
16
+ * @category Storage
17
+ */
18
+ export interface GetFileMetadataRequest {
19
+ /** The ID of the integration where the file is stored. */
20
+ integrationId: IntegrationId;
21
+ /** The path of the file within the bucket. */
22
+ filePathInBucket: string;
23
+ }
24
+ /**
25
+ * Represents the metadata details of a file stored in the bucket.
26
+ * @category Storage
27
+ */
28
+ export interface GetFileMetadataResponse {
29
+ /** The name of the file. */
30
+ filename: string;
31
+ /** The size of the file in bytes. */
32
+ size: number;
33
+ /** The last modified timestamp of the file. */
34
+ lastModified: Date;
35
+ /** Additional metadata associated with the file. */
36
+ metadata: Record<string, string>;
37
+ }
38
+ /**
39
+ * Represents a request to generate a temporary download URL for a file.
40
+ * @category Storage
41
+ */
42
+ export interface GetDownloadUrlRequest {
43
+ /** The ID of the integration where the file is stored. */
44
+ integrationId: IntegrationId;
45
+ /** The path of the file within the bucket. */
46
+ filePathInBucket: string;
47
+ /** Optional expiration time in seconds for the generated URL. */
48
+ urlExpirationInSeconds?: number;
49
+ }
50
+ /**
51
+ * Represents the response containing a generated download URL for a file.
52
+ * @category Storage
53
+ */
54
+ export interface GetDownloadUrlResponse {
55
+ /** The temporary URL for downloading the file. */
56
+ url: string;
57
+ }
58
+ /**
59
+ * Represents a request to delete multiple files from the storage bucket.
60
+ * @category Storage
61
+ */
62
+ export interface DeleteFilesRequest {
63
+ /** The ID of the integration where the files are stored. */
64
+ integrationId: IntegrationId;
65
+ /** An array of file paths within the bucket to be deleted. */
66
+ filePathsInBucket: Array<string>;
67
+ }
68
+ /**
69
+ * Represents details of a file within a directory in the storage bucket.
70
+ * @category Storage
71
+ */
72
+ export interface FileInDirectory {
73
+ /** The name of the file. */
74
+ filename: string;
75
+ /** The absolute path of the file within the bucket. */
76
+ absoluteFilePathInBucket: string;
77
+ /** The size of the file in bytes. */
78
+ size: number;
79
+ /** The last modified timestamp of the file. */
80
+ lastModified: Date;
81
+ }
82
+ /**
83
+ * Represents the response containing a list of directories and files within a specified directory in the storage
84
+ * bucket.
85
+ * @category Storage
86
+ */
87
+ export interface ListDirectoryContentsResponse {
88
+ /** An array of directory names present in the specified directory. */
89
+ directories: Array<string>;
90
+ /** An array of files present in the specified directory. */
91
+ files: Array<FileInDirectory>;
92
+ }
93
+ /**
94
+ * StorageClient provides methods for managing files in a storage system (like S3).
95
+ * @category Storage
96
+ */
97
+ export declare class StorageClient {
98
+ private readonly integrationId;
99
+ private readonly rpcManager;
100
+ /**
101
+ * Uploads a file to a specified directory within the bucket.
102
+ *
103
+ * @param dirPathInBucket - The directory path within the bucket where the file should be uploaded.
104
+ * @param file - The file to upload.
105
+ * @param expirationInSeconds - Optional expiration time in seconds for the upload.
106
+ * @returns A promise that resolves to void when the upload is complete.
107
+ */
108
+ uploadFile(dirPathInBucket: string, file: File, expirationInSeconds?: number): Promise<void>;
109
+ /**
110
+ * Retrieves metadata for a file located in a specified path within the bucket.
111
+ *
112
+ * @param filePathInBucket - The path of the file within the bucket.
113
+ * @returns A promise that resolves to a `GetFileMetadataResponse` containing the file's metadata.
114
+ */
115
+ getFileMetadata(filePathInBucket: string): Promise<GetFileMetadataResponse>;
116
+ /**
117
+ * Generates a URL for downloading a file from a specified path within the bucket.
118
+ *
119
+ * @param filePathInBucket - The path of the file within the bucket for which to generate the download URL.
120
+ * @param urlExpirationInSeconds - Optional expiration time in seconds for the download URL.
121
+ * @returns A promise that resolves to a `GetDownloadUrlResponse` containing the download URL.
122
+ */
123
+ getDownloadUrl(filePathInBucket: string, urlExpirationInSeconds?: number): Promise<GetDownloadUrlResponse>;
124
+ /**
125
+ * Lists the contents of a directory within the bucket.
126
+ *
127
+ * @param dirPathInBucket - The path of the directory within the bucket.
128
+ * @returns A promise that resolves to a `ListDirectoryContentsResponse` containing the directory contents.
129
+ */
130
+ listDirectoryContents(dirPathInBucket: string): Promise<ListDirectoryContentsResponse>;
131
+ /**
132
+ * Deletes a single file from a specified path within the bucket.
133
+ *
134
+ * @param filePathInBucket - The path of the file within the bucket to be deleted.
135
+ * @returns A promise that resolves to void when the file has been deleted.
136
+ */
137
+ deleteFile(filePathInBucket: string): Promise<void>;
138
+ /**
139
+ * Deletes multiple files from specified paths within the bucket.
140
+ *
141
+ * @param filePathsInBucket - An array of paths for the files within the bucket to be deleted.
142
+ * @returns A promise that resolves to void when all specified files have been deleted.
143
+ */
144
+ deleteFiles(filePathsInBucket: Array<string>): Promise<void>;
145
+ }
@@ -1,2 +1,27 @@
1
- /** A transactionId - alias for string */
2
- export type TransactionId = string;
1
+ /**
2
+ * A transactionId - alias for string
3
+ * @category Database
4
+ */
5
+ export type TransactionId = string;
6
+ /**
7
+ * Represents an error thrown during an RPC (Remote Procedure Call) made by the Squid SDK.
8
+ *
9
+ * This error contains detailed HTTP-level information such as the status code, response body,
10
+ * headers, and the request URL, allowing for better debugging and error handling in client code.
11
+ */
12
+ export declare class SquidClientError<BodyType = unknown> extends Error {
13
+ readonly statusCode: number;
14
+ readonly url?: string | undefined;
15
+ readonly headers?: Record<string, string> | undefined;
16
+ readonly body?: BodyType | undefined;
17
+ /**
18
+ * Creates a new `SquidClientError` instance.
19
+ *
20
+ * @param message - A custom error message.
21
+ * @param statusCode - The HTTP status code returned by the server (e.g., 400, 403, 422).
22
+ * @param url - The URL that was called when the error occurred.
23
+ * @param headers - The HTTP response headers.
24
+ * @param body - The parsed body of the error response.
25
+ */
26
+ constructor(message: string, statusCode: number, url?: string | undefined, headers?: Record<string, string> | undefined, body?: BodyType | undefined);
27
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The current version of the SquidCloud client package.
3
+ * @category Platform
4
+ */
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.146-beta";
@@ -0,0 +1,63 @@
1
+ import { WebAiSearchResponse, WebShortUrlBulkResponse, WebShortUrlResponse } from '../../internal-common/src/public-types/web.public-types';
2
+ /**
3
+ * WebClient provides methods to interact with web-related functionalities.
4
+ * @category Platform
5
+ */
6
+ export declare class WebClient {
7
+ private readonly rpcManager;
8
+ private readonly region;
9
+ private readonly appId;
10
+ private readonly apiKey;
11
+ private readonly consoleRegion;
12
+ /**
13
+ * Search the web using AI. Returns a response containing Markdown text and cited URLs.
14
+ * @param query The keywords or query string to search for.
15
+ */
16
+ aiSearch(query: string): Promise<WebAiSearchResponse>;
17
+ /**
18
+ * Fetch content from a URL.
19
+ * @param url The URL to fetch content from.
20
+ */
21
+ getUrlContent(url: string): Promise<string>;
22
+ /**
23
+ * Creates a shortened URL for the given URL.
24
+ *
25
+ * Defaults to a 1 day expiration if no expiry is provided via the `secondsToLive` field.
26
+ * If `secondsToLive` is set to 0, the URL will never expire.
27
+ *
28
+ * @param url The URL to shorten. It must be a valid URL and should include the protocol (start with http:// or
29
+ * https://).
30
+ * @param secondsToLive Seconds to live for the shortened URL. If set to 0, the URL will never expire. Defaults to 30
31
+ * days.
32
+ */
33
+ createShortUrl(url: string, secondsToLive?: number): Promise<WebShortUrlResponse>;
34
+ /**
35
+ * Creates shortened URLs for the given URLs.
36
+ *
37
+ * Defaults to a 1 day expiration if no expiry is provided via the `secondsToLive` field.
38
+ * If `secondsToLive` is set to 0, the URL will never expire.
39
+ *
40
+ * The parameter arrays should be of the same length and in the same order
41
+ *
42
+ * @param urls The URLs to shorten. It must be a valid URL and should include the protocol (start with http:// or
43
+ * https://).
44
+ * @param secondsToLive Seconds to live for each shortened URL. If set to 0, the URL will never expire.
45
+ */
46
+ createShortUrls(urls: string[], secondsToLive?: number): Promise<WebShortUrlBulkResponse>;
47
+ /**
48
+ * Deletes a shortened URL by its ID.
49
+ *
50
+ * The ID is the unique identifier at the end of the shortened URL.
51
+ *
52
+ * @param id The ID of the shortened URL to delete.
53
+ */
54
+ deleteShortUrl(id: string): Promise<void>;
55
+ /**
56
+ * Deletes shortened URLs by their IDs.
57
+ *
58
+ * The ID is the unique identifier at the end of the shortened URL.
59
+ *
60
+ * @param ids The IDs of the shortened URL to delete.
61
+ */
62
+ deleteShortUrls(ids: string[]): Promise<void>;
63
+ }
@@ -0,0 +1,10 @@
1
+ export interface ExecuteWebhookOptions {
2
+ /** Optional HTTP headers to include in the webhook request. */
3
+ headers?: Record<string, string>;
4
+ /** Optional query parameters to include in the webhook request. */
5
+ queryParams?: Record<string, string>;
6
+ /** Optional JSON body to send with the webhook request. */
7
+ body?: any;
8
+ /** Optional files to send with the webhook request. */
9
+ files?: File[];
10
+ }
package/package.json CHANGED
@@ -1,24 +1,33 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.145",
3
+ "version": "1.0.146-beta",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
6
7
  "types": "dist/typescript-client/src/index.d.ts",
7
8
  "files": [
8
9
  "dist/**/*"
9
10
  ],
10
11
  "scripts": {
11
- "prebuild": "rimraf dist",
12
- "build": "webpack --mode=production",
12
+ "prebuild": "del-cli dist && node inject-version.js",
13
+ "build": "webpack --mode=production && npm run keep-only-public-types && npm run check-bundle-size",
13
14
  "build:dev": "webpack --mode=development",
14
15
  "build:prod": "webpack --mode=production",
15
16
  "watch": "webpack --watch",
17
+ "lint": "eslint",
18
+ "build-and-check-public-types": "npm run build && npm run check-public-types",
19
+ "keep-only-public-types": "del-cli 'dist/internal-common/src/**' '!dist/internal-common/src/public-types' '!dist/internal-common/src/public-utils'",
20
+ "check-public-types": "tsc -p tsconfig.types.json",
21
+ "check-bundle-size": "node check-bundle-size.js",
16
22
  "test": "jest --detectOpenHandles",
17
23
  "test:watch": "jest --watch",
18
24
  "test:cov": "jest --coverage",
19
25
  "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20
26
  "test:e2e": "jest --config ./test/jest-e2e.json",
21
- "publish:public": "npm run build && npm publish --access public"
27
+ "publish:public": "npm run build && npm publish --access public",
28
+ "full-bundle-size-report": "cross-env BUILD_FULL_BUNDLE_SIZE_REPORT=1 webpack --mode=production",
29
+ "generate-docs-html": "typedoc",
30
+ "generate-docs-markdown": "typedoc --plugin typedoc-plugin-markdown --readme none --out ./reference-docs/markdown"
22
31
  },
23
32
  "keywords": [
24
33
  "typescript",
@@ -31,27 +40,34 @@
31
40
  "author": "",
32
41
  "license": "ISC",
33
42
  "dependencies": {
34
- "@apollo/client": "^3.7.4",
35
- "@squidcloud/common": "1.0.145",
36
- "@supercharge/promise-pool": "^2.3.2",
37
- "cross-fetch": "^3.1.5",
38
- "axios": "^1.6.2",
39
- "lodash": "^4.17.21",
40
- "ws": "^8.13.0"
43
+ "json-schema-typed": "^8.0.1",
44
+ "ws": "^8.18.3"
45
+ },
46
+ "optionalDependencies": {
47
+ "bufferutil": "^4.0.8",
48
+ "utf-8-validate": "^6.0.5"
41
49
  },
42
50
  "peerDependencies": {
43
51
  "rxjs": ">=7.5.7 <8.0.0"
44
52
  },
45
53
  "devDependencies": {
46
- "@types/lodash": "^4.14.186",
47
- "@webpack-cli/generators": "^3.0.0",
48
- "assertic": "^1.0.0",
49
- "copy-webpack-plugin": "^11.0.0",
54
+ "typedoc": "^0.28.10",
55
+ "typedoc-plugin-markdown": "^4.8.1",
56
+ "@supercharge/promise-pool": "^3.2.0",
57
+ "@webpack-cli/generators": "^3.0.7",
58
+ "copy-webpack-plugin": "^12.0.2",
50
59
  "cpx": "^1.5.0",
51
60
  "generate-package-json-webpack-plugin": "^2.6.0",
52
- "tsconfig-paths-webpack-plugin": "^4.0.0",
61
+ "otrie": "^1.2.2",
62
+ "tsconfig-paths-webpack-plugin": "^4.1.0",
53
63
  "tscpaths": "^0.0.9",
54
- "webpack": "^5.75.0",
55
- "webpack-cli": "^5.0.0"
64
+ "webpack": "^5.101.3",
65
+ "webpack-cli": "^5.1.4"
66
+ },
67
+ "browser": {
68
+ "ws": false
69
+ },
70
+ "engines": {
71
+ "node": ">=20.0.0"
56
72
  }
57
73
  }
@@ -1,25 +0,0 @@
1
- import { FunctionName } from './bundle-data.types';
2
- export type AssistantToolType = 'code_interpreter' | 'retrieval';
3
- export interface CreateAssistantRequest {
4
- name: string;
5
- instructions: string;
6
- functions: Array<FunctionName>;
7
- toolTypes?: Array<AssistantToolType>;
8
- }
9
- export interface DeleteAssistantRequest {
10
- assistantId: string;
11
- }
12
- export interface CreateAssistantThreadRequest {
13
- assistantId: string;
14
- }
15
- export interface DeleteThreadRequest {
16
- threadId: string;
17
- }
18
- export interface CreateAssistantThreadRequest {
19
- }
20
- export interface CreateAssistantResponse {
21
- assistantId: string;
22
- }
23
- export interface CreateAssistantThreadResponse {
24
- threadId: string;
25
- }
@@ -1,12 +0,0 @@
1
- import { AiChatbotMutationType, AiChatbotResourceType } from './ai-chatbot.types';
2
- export declare class AiChatbotChatContext {
3
- readonly prompt: string;
4
- readonly profileId: string;
5
- }
6
- /** A context provided to the security rules of an AI Chatbot mutation. */
7
- export declare class AiChatbotMutationContext {
8
- readonly type: AiChatbotMutationType;
9
- readonly resource: AiChatbotResourceType;
10
- readonly profileId: string;
11
- readonly payload: any;
12
- }
@@ -1,27 +0,0 @@
1
- /** The supported AI model names. */
2
- export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-4", "claude-2", "gpt-4-1106-preview"];
3
- export type AiModelName = (typeof AI_MODEL_NAMES)[number];
4
- /** The possible sources for the LLM provider API key. */
5
- export type ApiKeySource = 'user' | 'system';
6
- export type AiChatbotContextType = 'text' | 'url' | 'file';
7
- interface AiChatbotContextBase {
8
- type: AiChatbotContextType;
9
- data: string;
10
- }
11
- export interface AiChatbotTextContext extends AiChatbotContextBase {
12
- type: 'text';
13
- }
14
- export interface AiChatbotUrlContext extends AiChatbotContextBase {
15
- type: 'url';
16
- }
17
- export interface AiChatbotFileContext extends AiChatbotContextBase {
18
- type: 'file';
19
- }
20
- export type AiChatbotContext = AiChatbotTextContext | AiChatbotUrlContext | AiChatbotFileContext;
21
- export interface AiChatbotChatOptions {
22
- maxTokens?: number;
23
- chatId?: string;
24
- disableHistory?: boolean;
25
- includeReference?: boolean;
26
- }
27
- export {};
@@ -1,13 +0,0 @@
1
- import { ApiHeaders } from './api.types';
2
- import { ApiEndpointId, HttpMethod } from './integrations';
3
- /** The context of an API call. */
4
- export declare class ApiCallContext {
5
- readonly endpointId: ApiEndpointId;
6
- readonly url: string;
7
- readonly method: HttpMethod;
8
- readonly headers: ApiHeaders;
9
- readonly body: Record<string, any>;
10
- readonly queryParams: Record<string, string | number | boolean>;
11
- readonly pathParams: Record<string, string>;
12
- readonly serverUrlOverride: string | undefined;
13
- }
@@ -1,4 +0,0 @@
1
- /** The headers of an API call. */
2
- export type ApiHeaders = Record<string, string | number | boolean>;
3
- /** The query parameters of an API call. */
4
- export type ApiQueryParams = Record<string, string | number | boolean>;
@@ -1,66 +0,0 @@
1
- import { IntegrationSchemaType } from './integrations';
2
- export declare const UpsertIntegrationSchemaRequestSchema: {
3
- type: string;
4
- required: string[];
5
- properties: {
6
- id: {
7
- type: string;
8
- nullable: boolean;
9
- };
10
- type: {
11
- type: string;
12
- nullable: boolean;
13
- };
14
- schema: {
15
- oneOf: ({
16
- type: string;
17
- required: string[];
18
- properties: {
19
- type: {
20
- const: IntegrationSchemaType;
21
- };
22
- collections: {
23
- type: string;
24
- nullable: boolean;
25
- };
26
- baseUrl?: undefined;
27
- endpoints?: undefined;
28
- introspection?: undefined;
29
- };
30
- } | {
31
- type: string;
32
- required: string[];
33
- properties: {
34
- type: {
35
- const: IntegrationSchemaType;
36
- };
37
- baseUrl: {
38
- type: string;
39
- nullable: boolean;
40
- };
41
- endpoints: {
42
- type: string;
43
- nullable: boolean;
44
- };
45
- collections?: undefined;
46
- introspection?: undefined;
47
- };
48
- } | {
49
- type: string;
50
- required: string[];
51
- properties: {
52
- type: {
53
- const: IntegrationSchemaType;
54
- };
55
- introspection: {
56
- type: string;
57
- nullable: boolean;
58
- };
59
- collections?: undefined;
60
- baseUrl?: undefined;
61
- endpoints?: undefined;
62
- };
63
- })[];
64
- };
65
- };
66
- };
@@ -1,143 +0,0 @@
1
- import { AppId, EnvironmentId, IntegrationId } from './communication.types';
2
- import { AuthIntegrationType, DatabaseIntegrationType, IntegrationConfig, IntegrationConfigTypes, IntegrationSchema, IntegrationSchemaKeys, IntegrationSchemaTypes, IntegrationType, IntegrationTypeWithConfig } from './integrations';
3
- /** A type alias for a string that represents a webhook. */
4
- export type WebhookId = string;
5
- /** A type alias for a string that represents a named query. */
6
- export type QueryName = string;
7
- /** A type alias for a string that represents a trigger id. */
8
- export type TriggerId = string;
9
- /** A type alias for a string that represents a scheduler id. */
10
- export type SchedulerId = string;
11
- /** The supported cron expression string. */
12
- export type CronExpressionString = `${string} ${string} ${string} ${string} ${string}` | `${string} ${string} ${string} ${string}`;
13
- /** A set of predefined cron expressions. */
14
- export declare enum CronExpression {
15
- EVERY_SECOND = "* * * * * *",
16
- EVERY_5_SECONDS = "*/5 * * * * *",
17
- EVERY_10_SECONDS = "*/10 * * * * *",
18
- EVERY_30_SECONDS = "*/30 * * * * *",
19
- EVERY_MINUTE = "*/1 * * * *",
20
- EVERY_5_MINUTES = "0 */5 * * * *",
21
- EVERY_10_MINUTES = "0 */10 * * * *",
22
- EVERY_30_MINUTES = "0 */30 * * * *",
23
- EVERY_HOUR = "0 0-23/1 * * *",
24
- EVERY_2_HOURS = "0 0-23/2 * * *",
25
- EVERY_3_HOURS = "0 0-23/3 * * *",
26
- EVERY_4_HOURS = "0 0-23/4 * * *",
27
- EVERY_5_HOURS = "0 0-23/5 * * *",
28
- EVERY_6_HOURS = "0 0-23/6 * * *",
29
- EVERY_7_HOURS = "0 0-23/7 * * *",
30
- EVERY_8_HOURS = "0 0-23/8 * * *",
31
- EVERY_9_HOURS = "0 0-23/9 * * *",
32
- EVERY_10_HOURS = "0 0-23/10 * * *",
33
- EVERY_11_HOURS = "0 0-23/11 * * *",
34
- EVERY_12_HOURS = "0 0-23/12 * * *",
35
- EVERY_DAY_AT_1AM = "0 01 * * *",
36
- EVERY_DAY_AT_2AM = "0 02 * * *",
37
- EVERY_DAY_AT_3AM = "0 03 * * *",
38
- EVERY_DAY_AT_4AM = "0 04 * * *",
39
- EVERY_DAY_AT_5AM = "0 05 * * *",
40
- EVERY_DAY_AT_6AM = "0 06 * * *",
41
- EVERY_DAY_AT_7AM = "0 07 * * *",
42
- EVERY_DAY_AT_8AM = "0 08 * * *",
43
- EVERY_DAY_AT_9AM = "0 09 * * *",
44
- EVERY_DAY_AT_10AM = "0 10 * * *",
45
- EVERY_DAY_AT_11AM = "0 11 * * *",
46
- EVERY_DAY_AT_NOON = "0 12 * * *",
47
- EVERY_DAY_AT_1PM = "0 13 * * *",
48
- EVERY_DAY_AT_2PM = "0 14 * * *",
49
- EVERY_DAY_AT_3PM = "0 15 * * *",
50
- EVERY_DAY_AT_4PM = "0 16 * * *",
51
- EVERY_DAY_AT_5PM = "0 17 * * *",
52
- EVERY_DAY_AT_6PM = "0 18 * * *",
53
- EVERY_DAY_AT_7PM = "0 19 * * *",
54
- EVERY_DAY_AT_8PM = "0 20 * * *",
55
- EVERY_DAY_AT_9PM = "0 21 * * *",
56
- EVERY_DAY_AT_10PM = "0 22 * * *",
57
- EVERY_DAY_AT_11PM = "0 23 * * *",
58
- EVERY_DAY_AT_MIDNIGHT = "0 0 * * *",
59
- EVERY_WEEK = "0 0 * * 7",
60
- EVERY_WEEKDAY = "0 0 * * 1-5",
61
- EVERY_WEEKEND = "0 0 * * 6,7",
62
- EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT = "0 0 1 * *",
63
- EVERY_1ST_DAY_OF_MONTH_AT_NOON = "0 12 1 * *",
64
- EVERY_2ND_HOUR = "0 */2 * * *",
65
- EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM = "0 1-23/2 * * *",
66
- EVERY_2ND_MONTH = "0 0 1 */2 *",
67
- EVERY_QUARTER = "0 0 1 */3 *",
68
- EVERY_6_MONTHS = "0 0 1 */6 *",
69
- EVERY_YEAR = "0 0 1 1 *",
70
- EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",
71
- EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",
72
- EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM = "0 */30 10-19 * * *",
73
- MONDAY_TO_FRIDAY_AT_1AM = "0 0 01 * * 1-5",
74
- MONDAY_TO_FRIDAY_AT_2AM = "0 0 02 * * 1-5",
75
- MONDAY_TO_FRIDAY_AT_3AM = "0 0 03 * * 1-5",
76
- MONDAY_TO_FRIDAY_AT_4AM = "0 0 04 * * 1-5",
77
- MONDAY_TO_FRIDAY_AT_5AM = "0 0 05 * * 1-5",
78
- MONDAY_TO_FRIDAY_AT_6AM = "0 0 06 * * 1-5",
79
- MONDAY_TO_FRIDAY_AT_7AM = "0 0 07 * * 1-5",
80
- MONDAY_TO_FRIDAY_AT_8AM = "0 0 08 * * 1-5",
81
- MONDAY_TO_FRIDAY_AT_9AM = "0 0 09 * * 1-5",
82
- MONDAY_TO_FRIDAY_AT_09_30AM = "0 30 09 * * 1-5",
83
- MONDAY_TO_FRIDAY_AT_10AM = "0 0 10 * * 1-5",
84
- MONDAY_TO_FRIDAY_AT_11AM = "0 0 11 * * 1-5",
85
- MONDAY_TO_FRIDAY_AT_11_30AM = "0 30 11 * * 1-5",
86
- MONDAY_TO_FRIDAY_AT_12PM = "0 0 12 * * 1-5",
87
- MONDAY_TO_FRIDAY_AT_1PM = "0 0 13 * * 1-5",
88
- MONDAY_TO_FRIDAY_AT_2PM = "0 0 14 * * 1-5",
89
- MONDAY_TO_FRIDAY_AT_3PM = "0 0 15 * * 1-5",
90
- MONDAY_TO_FRIDAY_AT_4PM = "0 0 16 * * 1-5",
91
- MONDAY_TO_FRIDAY_AT_5PM = "0 0 17 * * 1-5",
92
- MONDAY_TO_FRIDAY_AT_6PM = "0 0 18 * * 1-5",
93
- MONDAY_TO_FRIDAY_AT_7PM = "0 0 19 * * 1-5",
94
- MONDAY_TO_FRIDAY_AT_8PM = "0 0 20 * * 1-5",
95
- MONDAY_TO_FRIDAY_AT_9PM = "0 0 21 * * 1-5",
96
- MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
97
- MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
98
- }
99
- export interface DeleteIntegrationRequest {
100
- integrationId: IntegrationId;
101
- }
102
- export interface UpdateAllowedHostsRequest {
103
- allowedHosts: string[];
104
- }
105
- export interface CreateEnvironmentRequest {
106
- sourceAppId: AppId;
107
- environmentId: EnvironmentId;
108
- }
109
- interface BaseUpsertIntegrationRequest<T extends IntegrationTypeWithConfig, C extends IntegrationConfig> {
110
- id: IntegrationId;
111
- type: T;
112
- config: Partial<C>;
113
- }
114
- type ConfigurationTypes = {
115
- [K in IntegrationTypeWithConfig]: IntegrationConfigTypes[K];
116
- };
117
- type UpsertIntegrationRequests = {
118
- [K in IntegrationTypeWithConfig]: BaseUpsertIntegrationRequest<K, ConfigurationTypes[K]>;
119
- };
120
- export type UpsertDataIntegrationRequest = UpsertIntegrationRequests[DatabaseIntegrationType];
121
- export type UpsertGraphQLIntegrationRequest = UpsertIntegrationRequests[IntegrationType.graphql];
122
- export type UpsertApiIntegrationRequest = UpsertIntegrationRequests[IntegrationType.api];
123
- export type UpsertAiChatbotIntegrationRequest = UpsertIntegrationRequests[IntegrationType.ai_chatbot];
124
- export type UpsertAuthIntegrationRequest = UpsertIntegrationRequests[AuthIntegrationType];
125
- interface BaseUpsertIntegrationSchemaRequest<T extends IntegrationType, S extends IntegrationSchema> {
126
- id: IntegrationId;
127
- type: T;
128
- schema: S;
129
- }
130
- type SchemaTypes = {
131
- [K in IntegrationSchemaKeys]: IntegrationSchemaTypes[K];
132
- };
133
- type UpsertIntegrationSchemaRequests = {
134
- [K in IntegrationSchemaKeys]: BaseUpsertIntegrationSchemaRequest<K, SchemaTypes[K]>;
135
- };
136
- export type UpsertIntegrationSchemaRequest = UpsertDataIntegrationSchemaRequest | UpsertGraphQLIntegrationSchemaRequest | UpsertApiIntegrationSchemaRequest;
137
- export type UpsertDataIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[DatabaseIntegrationType];
138
- export type UpsertGraphQLIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.graphql];
139
- export type UpsertApiIntegrationSchemaRequest = UpsertIntegrationSchemaRequests[IntegrationType.api];
140
- export interface GetSchemaRequest {
141
- integrationId: IntegrationId;
142
- }
143
- export {};
@@ -1,2 +0,0 @@
1
- import { ApplicationSecrets } from './secret.types';
2
- export declare function convertToRunSecrets(appSecrets: ApplicationSecrets): RunSecrets;