@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,147 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
3
- import { Operator } from '../query.types';
4
- import { SerializedQuery } from './serialized-query.types';
5
- import { PaginationOptions, Pagination } from './pagination';
6
- export interface SnapshotEmitter<ReturnType> {
7
- /**
8
- * Returns a promise that resolves to the query results.
9
- *
10
- * @returns A promise that resolves to the query results.
11
- */
12
- snapshot(): Promise<Array<ReturnType>>;
13
- /**
14
- * Returns an observable that emits the query results and updates whenever the query results change unless
15
- * `subscribe=false` is provided.
16
- *
17
- * Important: Make sure to unsubscribe from the observable when you are done with it.
18
- *
19
- * @param subscribe Whether to subscribe to changes to the query results. Defaults to `true`.
20
- * @returns An observable for the query results.
21
- */
22
- snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
23
- /**
24
- * Returns the results of the query based on the data that is currently available on the client. This method is useful
25
- * for synchronously accessing data that has already been fetched by another query. The method will return an empty
26
- * array if data has not yet been populated.
27
- *
28
- * @returns An array of query results.
29
- */
30
- peek(): Array<ReturnType>;
31
- limit(limit: number): SnapshotEmitter<ReturnType>;
32
- /**
33
- * Returns a pagination wrapper for this query.
34
- * @param options The pagination options. Defaults to `{ subscribe: true, pageSize: 100 }`.
35
- */
36
- paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
37
- serialize(): SerializedQuery;
38
- }
39
- /** Query builder base class. */
40
- export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
41
- /**
42
- * Adds a condition to the query.
43
- * @param fieldName The name of the field to query.
44
- * @param operator The operator to use.
45
- * @param value The value to compare against.
46
- * @returns The query builder.
47
- */
48
- abstract where(fieldName: (keyof MyDocType & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
49
- /**
50
- * A shortcut for where(fieldName, '==', value)
51
- *
52
- * @param fieldName The name of the field to query.
53
- * @param value The value to compare against.
54
- * @returns The query builder.
55
- */
56
- eq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
57
- /**
58
- * A shortcut for where(fieldName, '!=', value)
59
- * @param fieldName The name of the field to query.
60
- * @param value The value to compare against.
61
- * @returns The query builder.
62
- */
63
- neq(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
64
- /**
65
- * A shortcut for where(fieldName, 'in', value)
66
- * @param fieldName The name of the field to query.
67
- * @param value An array of values to compare against.
68
- * @returns The query builder.
69
- */
70
- in(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
71
- /**
72
- * A shortcut for where(fieldName, 'not in', value)
73
- * @param fieldName The name of the field to query.
74
- * @param value An array of values to compare against.
75
- * @returns The query builder.
76
- */
77
- nin(fieldName: (keyof MyDocType & FieldName) | string, value: Array<PrimitiveFieldType>): this;
78
- /**
79
- * A shortcut for where(fieldName, '>', value)
80
- * @param fieldName The name of the field to query.
81
- * @param value The value to compare against.
82
- * @returns The query builder.
83
- */
84
- gt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
85
- /**
86
- * A shortcut for where(fieldName, '>=', value)
87
- * @param fieldName The name of the field to query.
88
- * @param value The value to compare against.
89
- * @returns The query builder.
90
- */
91
- gte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
92
- /**
93
- * A shortcut for where(fieldName, '<', value)
94
- * @param fieldName The name of the field to query.
95
- * @param value The value to compare against.
96
- * @returns The query builder.
97
- */
98
- lt(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
99
- /**
100
- * A shortcut for where(fieldName, '<=', value)
101
- * @param fieldName The name of the field to query.
102
- * @param value The value to compare against.
103
- * @returns The query builder.
104
- */
105
- lte(fieldName: (keyof MyDocType & FieldName) | string, value: PrimitiveFieldType): this;
106
- /**
107
- * A shortcut for where(fieldName, 'like', pattern).
108
- *
109
- * @param fieldName The name of the field to query.
110
- * @param pattern The pattern to compare against. '%' is the only allowed wildcard
111
- * @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
112
- * @returns The query builder.
113
- */
114
- like(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
115
- /**
116
- * A shortcut for where(fieldName, 'not like', pattern).
117
- *
118
- * @param fieldName The name of the field to query.
119
- * @param pattern The pattern to compare against. '%' is the only allowed wildcard
120
- * @param caseSensitive Whether to use case-sensitive comparison. Defaults to true.
121
- * @returns The query builder.
122
- */
123
- notLike(fieldName: (keyof MyDocType & FieldName) | string, pattern: string, caseSensitive?: boolean): this;
124
- /**
125
- * Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
126
- * if none is provided.
127
- * @param limit The limit to set.
128
- * @returns The query builder.
129
- */
130
- abstract limit(limit: number): this;
131
- /**
132
- * Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
133
- * determines the order in which they are applied.
134
- * @param fieldName The name of the field to sort by.
135
- * @param asc Whether to sort in ascending order. Defaults to true.
136
- * @returns The query builder.
137
- */
138
- abstract sortBy(fieldName: keyof MyDocType & FieldName, asc?: boolean): this;
139
- }
140
- export interface HasDereference {
141
- /**
142
- * Dereferences the document references in the result of this query. For example, collection.query().snapshot()
143
- * returns an array of DocumentReference objects, but collection.query().dereference().snapshot() returns an array of
144
- * the actual document data.
145
- */
146
- dereference(): any;
147
- }
@@ -1,4 +0,0 @@
1
- export * from './query-context';
2
- export * from './base-query-builder';
3
- export * from './serialized-query.types';
4
- export * from './pagination';
@@ -1,24 +0,0 @@
1
- import { DocumentData } from '../document.types';
2
- import { Query, Alias, JoinCondition } from '../query.types';
3
- export type SerializedSimpleQuery = {
4
- type: 'simple';
5
- query: Query;
6
- dereference: boolean;
7
- };
8
- export type SerializedJoinQuery = {
9
- type: 'join';
10
- grouped: boolean;
11
- dereference: boolean;
12
- root: {
13
- alias: Alias;
14
- query: Query;
15
- };
16
- leftToRight: Record<Alias, Alias[]>;
17
- joins: Record<Alias, Query<DocumentData>>;
18
- joinConditions: Record<Alias, JoinCondition>;
19
- };
20
- export type SerializedMergedQuery = {
21
- type: 'merged';
22
- queries: Array<SerializedQuery>;
23
- };
24
- export type SerializedQuery = SerializedSimpleQuery | SerializedJoinQuery | SerializedMergedQuery;
@@ -1,64 +0,0 @@
1
- import { ClientRequestId } from './communication.types';
2
- import { CollectionName, DocumentData, FieldName } from './document.types';
3
- import { Paths } from './types';
4
- /**
5
- * An alias for a join result. This is used to disambiguate fields in the result.
6
- */
7
- export type Alias = string;
8
- /**
9
- * A join condition.
10
- * The join conditions defines the alias for the left side of the join and the field names to join on.
11
- */
12
- export interface JoinCondition {
13
- leftAlias: Alias;
14
- left: FieldName;
15
- right: FieldName;
16
- isInner: boolean;
17
- }
18
- /** A list of query conditions. */
19
- export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
20
- export type Conditions<Doc extends DocumentData = any> = Array<Condition<Doc>>;
21
- /** A single field query condition. */
22
- export interface SimpleCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>, MyOperator = Operator> {
23
- fieldName: F;
24
- operator: MyOperator;
25
- value: any;
26
- }
27
- /**
28
- * A composite fields query condition.
29
- * Just a list of simple conditions with specific set of operators. It should be
30
- * evaluated this way:
31
- * If A, B, C are the conditions and A` = A with '==' operator:
32
- * A || (A' && B) || (A' && B' && C)
33
- */
34
- export interface CompositeCondition<Doc extends DocumentData = any> {
35
- fields: Array<SimpleCondition<Doc, Paths<Doc>, CompositeConditionOperator>>;
36
- }
37
- export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
38
- type CompositeConditionOperator = '>=' | '<=' | '>' | '<';
39
- /** An operator in a query condition. */
40
- export type Operator = '==' | '!=' | CompositeConditionOperator | 'like' | 'not like' | 'like_cs' | 'not like_cs';
41
- /** A definition of a sort by a filed. */
42
- export interface FieldSort<Doc> {
43
- fieldName: FieldName<Doc>;
44
- asc: boolean;
45
- }
46
- /** A query object. */
47
- export interface Query<Doc extends DocumentData = any> {
48
- collectionName: CollectionName;
49
- integrationId: string;
50
- conditions: Conditions<Doc>;
51
- sortOrder: Array<FieldSort<Doc>>;
52
- limit: number;
53
- limitBy?: {
54
- limit: number;
55
- fields: Array<FieldName<Doc>>;
56
- reverseSort: boolean;
57
- };
58
- }
59
- export interface QueryRegisterRequest {
60
- clientRequestId: ClientRequestId;
61
- query: Query;
62
- parentClientRequestId: ClientRequestId;
63
- }
64
- export {};
@@ -1 +0,0 @@
1
- export type SupportedSquidRegion = (typeof SupportedSquidRegions)[number];
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- /** The secret key, an alias for a string. */
2
- export type SecretKey = string;
3
- /** The secret value. */
4
- export type SecretValue = string | number | boolean;
5
- /** A type alias for an ApiKey. */
6
- export type ApiKey = string;
7
- export type SetSecretEntry = {
8
- key: SecretKey;
9
- value?: SecretValue;
10
- };
11
- export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
12
- export declare const APP_API_KEY = "APP_API_KEY";
13
- export interface SecretEntry<T extends SecretValue = SecretValue> extends SecretMetadata {
14
- value: T;
15
- }
16
- export interface ApiKeyEntry extends SecretMetadata {
17
- value: string;
18
- }
19
- export interface SetSecretRequestEntry {
20
- key: SecretKey;
21
- value: SecretValue;
22
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export declare enum ClientConnectionState {
2
- CONNECTED = "CONNECTED",
3
- DISCONNECTED = "DISCONNECTED",
4
- REMOVED = "REMOVED"
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export declare class CodeExecutionError extends Error {
2
- readonly details?: string | undefined;
3
- constructor(error: string, details?: string | undefined);
4
- }
@@ -1,2 +0,0 @@
1
- export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
2
- export declare function getApplicationHttpHeaders(regionPrefix: string, appId: string): Record<string, string>;
@@ -1,2 +0,0 @@
1
- export declare function generateId(): string;
2
- export declare function generateShortId(length?: number): string;
@@ -1,5 +0,0 @@
1
- export declare function getInPath(obj: any, path: string, delimiter?: string): any;
2
- export declare function setInPath(obj: any, path: string, value: any, delimiter?: string): void;
3
- export declare function deleteInPath(obj: any, path: string, delimiter?: string): void;
4
- export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
5
- export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
@@ -1,6 +0,0 @@
1
- export declare function normalizeJsonAsString(json: any): string;
2
- export declare function serializeObj(obj: any): string;
3
- export declare function deserializeObj<T = any>(str: string): T;
4
- export declare function encodeValueForMapping(value: any): string;
5
- export declare function decodeValueForMapping(encodedString: string): any;
6
- export declare function recodeValue(value: any): any;
@@ -1,18 +0,0 @@
1
- export declare function unchanged(any: any): any;
2
- export declare function booleanToInt(boolean: boolean): number;
3
- export declare function intToBoolean(int: number): boolean;
4
- export declare function stringToNumber(string: string): number;
5
- export declare function numberToString(number: number): string;
6
- export declare function bufferToString(buffer: ArrayBuffer): string;
7
- export declare function stringToBuffer(string: string): ArrayBuffer;
8
- export declare function stringToJSON(string: string): JSON;
9
- export declare function JSONToString(json: JSON): string;
10
- export declare function moneyStringToNumber(money: string): number;
11
- export declare function daysPastEpochToDate(days: number): Date;
12
- export declare function msToDate(ms: number): Date;
13
- export declare function isoStringToDate(string: string): Date;
14
- export declare function base64ToString(string: string): string;
15
- export declare function base64ToBinary(string: string): string;
16
- export declare function kafkaConnectStringToInterval(string: string): Record<string, number>;
17
- export declare function msPastMidnightToTimeString(ms: number): string;
18
- export declare function dateToTimeString(date: Date): string;
@@ -1 +0,0 @@
1
- export declare function appendQueryParams(url: string, queryParams: Record<string, any>): string;
@@ -1,25 +0,0 @@
1
- import { OpenIdProvider } from '../application.types';
2
- import { HttpStatus } from '../http-status.enum';
3
- export type StatusCode = HttpStatus.BAD_REQUEST | HttpStatus.NOT_FOUND | HttpStatus.FORBIDDEN | HttpStatus.UNAUTHORIZED | HttpStatus.CONFLICT;
4
- export declare class ValidationError extends Error {
5
- readonly statusCode: StatusCode;
6
- readonly details?: any;
7
- constructor(error: string, statusCode: StatusCode, details?: Record<string, any>);
8
- }
9
- export declare function validateFieldSort(fieldSort: any): void;
10
- export declare function validateOpenIdProvider(openIdProvider: OpenIdProvider | undefined): OpenIdProvider;
11
- export declare function validateOpenIdProviderType(providerType: any): void;
12
- export declare function validateMutations(mutations: any): void;
13
- export declare function validateQueryLimit(limit: any): void;
14
- /** Returns true if the value is not an empty string (undefined/null are considered empty). */
15
- export declare function isNotEmpty(value: string | undefined | null): value is string;
16
- /**
17
- * All type names returned by 'typeof' supported by JavaScript:
18
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}.
19
- * and a few other supported types.
20
- */
21
- export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function';
22
- /** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */
23
- export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean;
24
- /** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */
25
- export declare function hasOnlyKeys(obj: object, keys: string[]): boolean;
@@ -1 +0,0 @@
1
- export {};
@@ -1,174 +0,0 @@
1
- import { AiChatbotChatOptions, AiChatbotContext, AiModelName, IntegrationId } from '@squidcloud/common';
2
- import { Observable } from 'rxjs';
3
- import { RpcManager } from './rpc.manager';
4
- import { SocketManager } from './socket.manager';
5
- export declare class AiChatbotClient {
6
- private readonly rpcManager;
7
- private readonly socketManager;
8
- private readonly integrationId;
9
- private readonly ongoingChatSequences;
10
- constructor(rpcManager: RpcManager, socketManager: SocketManager, integrationId: IntegrationId);
11
- /**
12
- * Retrieves a profile reference for the provided id. A profile reference
13
- * can be used to create and update profiles, add instructions and context
14
- * and start chats.
15
- *
16
- * @param id - The id of the profile.
17
- * @returns The profile reference.
18
- */
19
- profile(id: string): AiChatbotProfileReference;
20
- /**
21
- * Sends a prompt to the specified profile id.
22
- *
23
- * @param profileId - The profile id.
24
- * @param prompt - The prompt.
25
- * @param options - The options to send to the chat model.
26
- * @returns An observable that emits when a new response token is received. The emitted value is the entire response
27
- * that has been received so far.
28
- */
29
- chat(profileId: string, prompt: string, options?: AiChatbotChatOptions): Observable<string>;
30
- private handleChatResponse;
31
- }
32
- export declare class AiChatbotProfileReference {
33
- private readonly client;
34
- private readonly integrationId;
35
- private readonly profileId;
36
- constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string);
37
- /**
38
- * Sends a prompt to the current profile.
39
- *
40
- * @param prompt - The prompt.
41
- * @param options - The chat options.
42
- * @returns An observable that emits when a new response token is received. The emitted value is the entire response
43
- * that has been received so far.
44
- */
45
- chat(prompt: string, options?: AiChatbotChatOptions): Observable<string>;
46
- /**
47
- * Retrieves a context reference for the current profile. A context reference can be used to add a new context entry
48
- * to the profile, or update/delete an existing entry context.
49
- *
50
- * @param id - The id of the context entry. If no id is passed, an id will be
51
- * generated and the reference will point to a new context entry.
52
- * @returns The context reference.
53
- */
54
- context(id?: string): AiChatbotContextReference;
55
- /**
56
- * Retrieves an instruction reference for the current profile. An instruction reference can be used to add a new
57
- * instruction entry to the profile, or update/delete an existing instruction entry.
58
- *
59
- * @param id - The id of the instruction entry. If no id is passed, an id will be
60
- * generated and the reference will point to a new instruction entry.
61
- * @returns The instruction reference.
62
- */
63
- instruction(id?: string): AiChatbotInstructionReference;
64
- /**
65
- * Adds a new profile to the chat bot. This will result in an error if a profile already exists with the same id.
66
- *
67
- * @param data An object containing options for creating the profile.
68
- * @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
69
- * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
70
- * @returns A promise that resolves when the profile is successfully created.
71
- */
72
- insert(data: {
73
- modelName: AiModelName;
74
- isPublic: boolean;
75
- }): Promise<void>;
76
- /**
77
- * Updates an existing chatbot profile. This will result in an error if a profile has not yet been created for the
78
- * current profile id.
79
- *
80
- * @param data An object containing options for updating the profile.
81
- * @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
82
- * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
83
- * @returns A promise that resolves when the profile is successfully updated.
84
- */
85
- update(data: {
86
- modelName?: AiModelName;
87
- isPublic?: boolean;
88
- }): Promise<void>;
89
- /**
90
- * Deletes an existing chatbot profile. This will result in an error if a profile has not yet been created for the
91
- * current profile id.
92
- *
93
- * @returns A promise that resolves when the profile is successfully deleted.
94
- */
95
- delete(): Promise<void>;
96
- }
97
- declare class AiChatbotContextReference {
98
- private readonly client;
99
- private readonly integrationId;
100
- private readonly profileId;
101
- private readonly id;
102
- constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string, id?: string);
103
- /**
104
- * Adds a new context entry to the chatbot profile. This will result in an error if an entry already exists with
105
- * the same id.
106
- *
107
- * @param data An object containing options for creating the entry.
108
- * @param data.title - The title of the entry.
109
- * @param data.context - The context data.
110
- * @param file - The file to insert.
111
- * @returns A promise that resolves when the context is successfully created.
112
- */
113
- insert(data: {
114
- title: string;
115
- context: AiChatbotContext;
116
- }, file?: File): Promise<void>;
117
- /**
118
- * Updates an existing context entry on the chatbot profile. This will result in an error if an entry has not yet
119
- * been created for the current context id.
120
- *
121
- * @param data An object containing options for updated the entry.
122
- * @param data.title - The title of the entry.
123
- * @param data.context - The context data.
124
- * @returns A promise that resolves when the context is successfully updated.
125
- */
126
- update(data: {
127
- title?: string;
128
- context?: AiChatbotContext;
129
- }): Promise<void>;
130
- /**
131
- * Deletes an existing context entry on the chatbot profile. This will result in an error if an entry has not yet
132
- * been created for the current context id.
133
- *
134
- * @returns A promise that resolves when the context is successfully deleted.
135
- */
136
- delete(): Promise<void>;
137
- }
138
- declare class AiChatbotInstructionReference {
139
- private readonly client;
140
- private readonly integrationId;
141
- private readonly profileId;
142
- private readonly id;
143
- constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string, id?: string);
144
- /**
145
- * Adds a new instruction entry to the chatbot profile. This will result in an error if an entry already exists with
146
- * the same id.
147
- *
148
- * @param data An object containing options for creating the entry.
149
- * @param data.instruction - The instruction data.
150
- * @returns A promise that resolves when the instruction is successfully created.
151
- */
152
- insert(data: {
153
- instruction: string;
154
- }): Promise<void>;
155
- /**
156
- * Updates an existing instruction entry on the chatbot profile. This will result in an error if an entry has not
157
- * yet been created for the current instruction id.
158
- *
159
- * @param data An object containing options for updated the entry.
160
- * @param data.instruction - The instruction data.
161
- * @returns A promise that resolves when the instruction is successfully updated.
162
- */
163
- update(data: {
164
- instruction: string;
165
- }): Promise<void>;
166
- /**
167
- * Deletes an existing instruction entry on the chatbot profile. This will result in an error if an entry has not
168
- * yet been created for the current instruction id.
169
- *
170
- * @returns A promise that resolves when the instruction is successfully deleted.
171
- */
172
- delete(): Promise<void>;
173
- }
174
- export {};
@@ -1,8 +0,0 @@
1
- import { RpcManager } from './rpc.manager';
2
- import { SocketManager } from './socket.manager';
3
- export declare class AiChatbotClientFactory {
4
- private readonly rpcManager;
5
- private readonly socketManager;
6
- private readonly chatbotsMap;
7
- constructor(rpcManager: RpcManager, socketManager: SocketManager);
8
- }
@@ -1,61 +0,0 @@
1
- import { IntegrationId } from '@squidcloud/common';
2
- import { AiChatbotClient } from './ai-chatbot-client';
3
- import { AiChatbotClientFactory } from './ai-chatbot-client.factory';
4
- import { RpcManager } from './rpc.manager';
5
- import { AiAssistantClient } from './ai-assistant-client';
6
- export interface ExecuteAiQueryRequest {
7
- integrationId: IntegrationId;
8
- prompt: string;
9
- }
10
- export interface ExecuteAiQueryResponse {
11
- answer: string;
12
- explanation?: string;
13
- executedQuery?: string;
14
- }
15
- /**
16
- * AiClient class serves as a facade for interacting with different AI services.
17
- * It provides simplified access to AI chatbot and assistant functionalities
18
- * through its methods.
19
- */
20
- export declare class AiClient {
21
- private readonly aiChatbotClientFactory;
22
- private readonly rpcManager;
23
- private readonly aiAssistantClient;
24
- constructor(aiChatbotClientFactory: AiChatbotClientFactory, rpcManager: RpcManager);
25
- /**
26
- * Retrieves an AI chatbot client for a specific AI integration.
27
- * @param aiIntegrationId - The identifier for the AI integration.
28
- * @returns An instance of AiChatbotClient associated with the given AI integration ID.
29
- */
30
- chatbot(aiIntegrationId: IntegrationId): AiChatbotClient;
31
- /**
32
- * Retrieves the AI assistant client.
33
- * @returns An instance of AiAssistantClient.
34
- */
35
- assistant(): AiAssistantClient;
36
- /**
37
- * Executes an AI query using a specific DB integration, sending a prompt to the AI and returning its response.
38
- * This function allows for direct interaction with the AI's capabilities by sending text prompts and receiving
39
- * the AI's responses, which can be used for various applications such as automating tasks, generating content,
40
- * or obtaining information.
41
- *
42
- * @param integrationId The identifier for the DB integration which is used to direct the query to the
43
- * appropriate DB.
44
- * @param prompt The text prompt to send to the AI. This should be formulated in a way that the AI can
45
- * understand and respond to, taking into account the nature of the task or the information
46
- * sought.
47
- * @returns A promise that resolves to an `ExecuteAiQueryResponse`. This response includes the AI's
48
- * reply to the provided prompt, along with any other relevant information that is part of
49
- * the AI's response. The promise can be awaited to handle the response asynchronously.
50
- *
51
- * @example
52
- * ```
53
- * const response = await ai().executeAiQuery(myDbIntegrationId, "How many transactions ran yesterday?");
54
- * console.log(response);
55
- * ```
56
- *
57
- * For more details on the usage and capabilities of the AI Assistant, refer to the documentation provided at
58
- * {@link https://docs.squid.cloud/docs/ai}.
59
- */
60
- executeAiQuery(integrationId: IntegrationId, prompt: string): Promise<ExecuteAiQueryResponse>;
61
- }
@@ -1,11 +0,0 @@
1
- import { ApiEndpointId, IntegrationId } from '@squidcloud/common';
2
- import { Observable } from 'rxjs';
3
- import { RpcManager } from './rpc.manager';
4
- import { ClientIdService } from './client-id.service';
5
- export declare class ApiManager {
6
- private readonly clientIdService;
7
- private readonly rpcManager;
8
- private readonly apiServerUrlOverrideMapping;
9
- constructor(clientIdService: ClientIdService, rpcManager: RpcManager, apiServerUrlOverrideMapping?: Record<IntegrationId, string>);
10
- callApiAndSubscribe<T>(integrationId: IntegrationId, endpointId: ApiEndpointId, request: Record<string, any>): Observable<T>;
11
- }
@@ -1,14 +0,0 @@
1
- import { GraphQLRequest, IntegrationId, SupportedSquidRegion } from '@squidcloud/common';
2
- import { RpcManager } from './rpc.manager';
3
- /** A GraphQL client that can be used to query and mutate data. */
4
- export declare class GraphQLClient {
5
- private readonly rpcManager;
6
- private readonly region;
7
- private readonly appId;
8
- private readonly client;
9
- constructor(rpcManager: RpcManager, integrationId: IntegrationId, region: SupportedSquidRegion, appId: string);
10
- /** Executes a GraphQL query and returns a promise with the result. */
11
- query<T = any>(request: GraphQLRequest): Promise<T>;
12
- /** Executes a GraphQL mutation and returns a promise with the result. */
13
- mutate<T = Record<string, any>>(request: GraphQLRequest): Promise<T | null | undefined>;
14
- }