@squidcloud/client 1.0.142 → 1.0.144-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 (116) hide show
  1. package/dist/cjs/index.js +15649 -15749
  2. package/dist/common/src/ai-assistant.types.d.ts +25 -23
  3. package/dist/common/src/ai-chatbot.context.d.ts +12 -0
  4. package/dist/common/src/{ai-assistant.schemas.d.ts → ai-chatbot.schemas.d.ts} +1 -1
  5. package/dist/common/src/ai-chatbot.types.d.ts +25 -0
  6. package/dist/common/src/api-call.context.d.ts +13 -13
  7. package/dist/common/src/api.types.d.ts +4 -4
  8. package/dist/common/src/application.schemas.d.ts +66 -66
  9. package/dist/common/src/application.types.d.ts +143 -143
  10. package/dist/common/src/backend-function.schemas.d.ts +1 -1
  11. package/dist/common/src/backend-function.types.d.ts +1 -1
  12. package/dist/common/src/backend-run.types.d.ts +2 -2
  13. package/dist/common/src/bundle-api.types.d.ts +43 -42
  14. package/dist/common/src/bundle-data.types.d.ts +5 -4
  15. package/dist/common/src/communication.types.d.ts +8 -8
  16. package/dist/common/src/context.types.d.ts +40 -40
  17. package/dist/common/src/distributed-lock.context.d.ts +4 -4
  18. package/dist/common/src/document.types.d.ts +22 -22
  19. package/dist/common/src/graphql.context.d.ts +7 -7
  20. package/dist/common/src/graphql.types.d.ts +9 -9
  21. package/dist/common/src/heartbeat.types.d.ts +1 -1
  22. package/dist/common/src/http-status.enum.d.ts +50 -50
  23. package/dist/common/src/index.d.ts +57 -56
  24. package/dist/common/src/integrations/ai_chatbot.types.d.ts +31 -0
  25. package/dist/common/src/integrations/api.types.d.ts +80 -80
  26. package/dist/common/src/integrations/auth.types.d.ts +47 -47
  27. package/dist/common/src/integrations/database.types.d.ts +274 -274
  28. package/dist/common/src/integrations/index.d.ts +134 -134
  29. package/dist/common/src/integrations/observability.types.d.ts +23 -23
  30. package/dist/common/src/logger.types.d.ts +21 -21
  31. package/dist/common/src/metrics.types.d.ts +1 -1
  32. package/dist/common/src/mutation.context.d.ts +14 -14
  33. package/dist/common/src/mutation.schemas.d.ts +1 -1
  34. package/dist/common/src/mutation.types.d.ts +53 -53
  35. package/dist/common/src/named-query.context.d.ts +4 -4
  36. package/dist/common/src/named-query.schemas.d.ts +1 -1
  37. package/dist/common/src/named-query.types.d.ts +1 -1
  38. package/dist/common/src/native-query.context.d.ts +7 -7
  39. package/dist/common/src/native-query.types.d.ts +16 -16
  40. package/dist/common/src/query/base-query-builder.d.ts +147 -147
  41. package/dist/common/src/query/index.d.ts +4 -4
  42. package/dist/common/src/query/pagination.d.ts +62 -62
  43. package/dist/common/src/query/query-context.d.ts +137 -137
  44. package/dist/common/src/query/serialized-query.types.d.ts +24 -24
  45. package/dist/common/src/query.types.d.ts +64 -64
  46. package/dist/common/src/regions.d.ts +1 -1
  47. package/dist/common/src/schema/schema.types.d.ts +54 -54
  48. package/dist/common/src/secret.schemas.d.ts +1 -1
  49. package/dist/common/src/secret.types.d.ts +22 -22
  50. package/dist/common/src/security.types.d.ts +1 -1
  51. package/dist/common/src/socket.schemas.d.ts +1 -1
  52. package/dist/common/src/socket.types.d.ts +5 -5
  53. package/dist/common/src/time-units.d.ts +1 -1
  54. package/dist/common/src/trigger.types.d.ts +1 -1
  55. package/dist/common/src/types.d.ts +14 -14
  56. package/dist/common/src/utils/array.d.ts +1 -1
  57. package/dist/common/src/utils/assert.d.ts +1 -1
  58. package/dist/common/src/utils/error.d.ts +4 -4
  59. package/dist/common/src/utils/global.utils.d.ts +1 -1
  60. package/dist/common/src/utils/http.d.ts +2 -2
  61. package/dist/common/src/utils/id.d.ts +2 -2
  62. package/dist/common/src/utils/lock.manager.d.ts +14 -14
  63. package/dist/common/src/utils/object.d.ts +5 -5
  64. package/dist/common/src/utils/serialization.d.ts +6 -6
  65. package/dist/common/src/utils/transforms.d.ts +18 -18
  66. package/dist/common/src/utils/url.d.ts +1 -1
  67. package/dist/common/src/utils/validation.d.ts +25 -25
  68. package/dist/common/src/webhook-response.d.ts +1 -1
  69. package/dist/common/src/websocket.impl.d.ts +21 -21
  70. package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
  71. package/dist/typescript-client/src/ai-assistant-client.d.ts +11 -174
  72. package/dist/typescript-client/src/ai-chatbot-client.d.ts +174 -0
  73. package/dist/typescript-client/src/{ai-client.factory.d.ts → ai-chatbot-client.factory.d.ts} +11 -11
  74. package/dist/typescript-client/src/ai.types.d.ts +47 -10
  75. package/dist/typescript-client/src/api.manager.d.ts +11 -11
  76. package/dist/typescript-client/src/auth.manager.d.ts +33 -33
  77. package/dist/typescript-client/src/backend-function.manager.d.ts +9 -9
  78. package/dist/typescript-client/src/client-id.service.d.ts +27 -27
  79. package/dist/typescript-client/src/collection-reference.d.ts +80 -80
  80. package/dist/typescript-client/src/collection-reference.factory.d.ts +13 -13
  81. package/dist/typescript-client/src/connection-details.d.ts +23 -23
  82. package/dist/typescript-client/src/data.manager.d.ts +173 -173
  83. package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
  84. package/dist/typescript-client/src/distributed-lock.manager.d.ts +16 -16
  85. package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
  86. package/dist/typescript-client/src/document-reference.d.ts +140 -140
  87. package/dist/typescript-client/src/document-reference.factory.d.ts +13 -13
  88. package/dist/typescript-client/src/document-store.d.ts +14 -14
  89. package/dist/typescript-client/src/graphql-client.d.ts +14 -14
  90. package/dist/typescript-client/src/graphql-client.factory.d.ts +11 -11
  91. package/dist/typescript-client/src/index.d.ts +9 -9
  92. package/dist/typescript-client/src/mutation/mutation-sender.d.ts +10 -10
  93. package/dist/typescript-client/src/named-query.manager.d.ts +11 -11
  94. package/dist/typescript-client/src/native-query-manager.d.ts +7 -7
  95. package/dist/typescript-client/src/query/deserializer.d.ts +3 -3
  96. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +161 -161
  97. package/dist/typescript-client/src/query/local-query-manager.d.ts +9 -9
  98. package/dist/typescript-client/src/query/query-builder.factory.d.ts +77 -77
  99. package/dist/typescript-client/src/query/query-sender.d.ts +33 -33
  100. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +130 -130
  101. package/dist/typescript-client/src/query/query.types.d.ts +49 -49
  102. package/dist/typescript-client/src/rate-limiter.d.ts +32 -32
  103. package/dist/typescript-client/src/rpc.manager.d.ts +29 -29
  104. package/dist/typescript-client/src/secret.client.d.ts +22 -22
  105. package/dist/typescript-client/src/socket.manager.d.ts +43 -43
  106. package/dist/typescript-client/src/squid.d.ts +283 -319
  107. package/dist/typescript-client/src/state/action.applier.d.ts +7 -7
  108. package/dist/typescript-client/src/state/actions.d.ts +29 -29
  109. package/dist/typescript-client/src/state/path_trie.d.ts +27 -27
  110. package/dist/typescript-client/src/state/state.service.d.ts +22 -22
  111. package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
  112. package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -1
  113. package/dist/typescript-client/src/types.d.ts +2 -2
  114. package/package.json +2 -2
  115. package/dist/common/src/ai-assistant.context.d.ts +0 -12
  116. package/dist/common/src/integrations/ai_assistant.types.d.ts +0 -31
@@ -1,174 +1,11 @@
1
- import { AiAssistantChatOptions, AiAssistantContext, 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 AiAssistantClient {
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): AiAssistantProfileReference;
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?: AiAssistantChatOptions): Observable<string>;
30
- private handleChatResponse;
31
- }
32
- export declare class AiAssistantProfileReference {
33
- private readonly client;
34
- private readonly integrationId;
35
- private readonly profileId;
36
- constructor(client: AiAssistantClient, 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?: AiAssistantChatOptions): 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): AiAssistantContextReference;
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): AiAssistantInstructionReference;
64
- /**
65
- * Adds a new profile to the assistant. 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 assistant 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 assistant 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 AiAssistantContextReference {
98
- private readonly client;
99
- private readonly integrationId;
100
- private readonly profileId;
101
- private readonly id;
102
- constructor(client: AiAssistantClient, integrationId: IntegrationId, profileId: string, id?: string);
103
- /**
104
- * Adds a new context entry to the assistant 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: AiAssistantContext;
116
- }, file?: File): Promise<void>;
117
- /**
118
- * Updates an existing context entry on the assistant 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?: AiAssistantContext;
129
- }): Promise<void>;
130
- /**
131
- * Deletes an existing context entry on the assistant 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 AiAssistantInstructionReference {
139
- private readonly client;
140
- private readonly integrationId;
141
- private readonly profileId;
142
- private readonly id;
143
- constructor(client: AiAssistantClient, integrationId: IntegrationId, profileId: string, id?: string);
144
- /**
145
- * Adds a new instruction entry to the assistant 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 assistant 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 assistant 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
+ import { RpcManager } from './rpc.manager';
2
+ import { AssistantToolType, FunctionName } from '@squidcloud/common';
3
+ export declare class AiAssistantClient {
4
+ private readonly rpcManager;
5
+ constructor(rpcManager: RpcManager);
6
+ createAssistant(name: string, instructions: string, functions: Array<FunctionName>, toolTypes?: Array<AssistantToolType>): Promise<string>;
7
+ deleteAssistant(assistantId: string): Promise<void>;
8
+ createThread(assistantId: string): Promise<string>;
9
+ deleteThread(threadId: string): Promise<void>;
10
+ queryAssistant(assistantId: string, threadId: string, prompt: string, fileContent?: string): Promise<string>;
11
+ }
@@ -0,0 +1,174 @@
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,11 +1,11 @@
1
- import { IntegrationId } from '@squidcloud/common';
2
- import { AiAssistantClient } from './ai-assistant-client';
3
- import { RpcManager } from './rpc.manager';
4
- import { SocketManager } from './socket.manager';
5
- export declare class AiClientFactory {
6
- private readonly rpcManager;
7
- private readonly socketManager;
8
- private readonly assistantsMap;
9
- constructor(rpcManager: RpcManager, socketManager: SocketManager);
10
- getAssistant(integrationId: IntegrationId): AiAssistantClient;
11
- }
1
+ import { IntegrationId } from '@squidcloud/common';
2
+ import { AiChatbotClient } from './ai-chatbot-client';
3
+ import { RpcManager } from './rpc.manager';
4
+ import { SocketManager } from './socket.manager';
5
+ export declare class AiChatbotClientFactory {
6
+ private readonly rpcManager;
7
+ private readonly socketManager;
8
+ private readonly chatbotsMap;
9
+ constructor(rpcManager: RpcManager, socketManager: SocketManager);
10
+ getChatbot(integrationId: IntegrationId): AiChatbotClient;
11
+ }
@@ -1,10 +1,47 @@
1
- import { IntegrationId } from '@squidcloud/common';
2
- export interface ExecuteAiQueryRequest {
3
- integrationId: IntegrationId;
4
- prompt: string;
5
- }
6
- export interface ExecuteAiQueryResponse {
7
- answer: string;
8
- explanation?: string;
9
- executedQuery?: string;
10
- }
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
+ export declare class AiClient {
16
+ private readonly aiChatbotClientFactory;
17
+ private readonly rpcManager;
18
+ private readonly aiAssistantClient;
19
+ constructor(aiChatbotClientFactory: AiChatbotClientFactory, rpcManager: RpcManager);
20
+ chatbot(integrationId: IntegrationId): AiChatbotClient;
21
+ assistant(): AiAssistantClient;
22
+ /**
23
+ * Executes an AI query using a specific DB integration, sending a prompt to the AI and returning its response.
24
+ * This function allows for direct interaction with the AI's capabilities by sending text prompts and receiving
25
+ * the AI's responses, which can be used for various applications such as automating tasks, generating content,
26
+ * or obtaining information.
27
+ *
28
+ * @param integrationId The identifier for the DB integration which is used to direct the query to the
29
+ * appropriate DB.
30
+ * @param prompt The text prompt to send to the AI. This should be formulated in a way that the AI can
31
+ * understand and respond to, taking into account the nature of the task or the information
32
+ * sought.
33
+ * @returns A promise that resolves to an `ExecuteAiQueryResponse`. This response includes the AI's
34
+ * reply to the provided prompt, along with any other relevant information that is part of
35
+ * the AI's response. The promise can be awaited to handle the response asynchronously.
36
+ *
37
+ * @example
38
+ * ```
39
+ * const response = await ai().executeAiQuery(myDbIntegrationId, "How many transactions ran yesterday?");
40
+ * console.log(response);
41
+ * ```
42
+ *
43
+ * For more details on the usage and capabilities of the AI Assistant, refer to the documentation provided at
44
+ * {@link https://docs.squid.cloud/docs/ai}.
45
+ */
46
+ executeAiQuery(integrationId: IntegrationId, prompt: string): Promise<ExecuteAiQueryResponse>;
47
+ }
@@ -1,11 +1,11 @@
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
+ 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,33 +1,33 @@
1
- import { ApiKey, AuthToken, IntegrationId } from '@squidcloud/common';
2
- import { Observable } from 'rxjs';
3
- import { SquidAuthProvider } from './squid';
4
- /** Holds authentication token for the specified integration. */
5
- export interface AuthData {
6
- token: string | undefined;
7
- integrationId?: IntegrationId;
8
- }
9
- export declare class AuthManager {
10
- private readonly apiKey;
11
- private authProvider?;
12
- constructor(apiKey: ApiKey | undefined, authProvider?: SquidAuthProvider | undefined);
13
- /**
14
- * Sets a new ID token or an ID token provider.
15
- * @deprecated: Pass the provider via constructor options parameters or `setAuthTokenProvider()`.
16
- */
17
- setAuthIdToken(tokenArg: string | undefined | Promise<string | undefined> | Observable<string | undefined> | SquidAuthProvider, integrationId?: IntegrationId): void;
18
- private setAuthProviderForDeprecatedCode;
19
- /**
20
- * Sets a new auth-token provider to Squid.
21
- * All future squid backend requests will use this token provider.
22
- * Exising in-flight requests won't be affected.
23
- */
24
- setAuthProvider(authProvider: SquidAuthProvider): void;
25
- getAuthData(): Promise<AuthData>;
26
- getApiKey(): ApiKey | undefined;
27
- /**
28
- * Returns a valid AuthToken.
29
- * Tries to use `apiKey` first if set up.
30
- * Falls back to `await authTokenProvider()` result.
31
- */
32
- getToken(): Promise<AuthToken | undefined>;
33
- }
1
+ import { ApiKey, AuthToken, IntegrationId } from '@squidcloud/common';
2
+ import { Observable } from 'rxjs';
3
+ import { SquidAuthProvider } from './squid';
4
+ /** Holds authentication token for the specified integration. */
5
+ export interface AuthData {
6
+ token: string | undefined;
7
+ integrationId?: IntegrationId;
8
+ }
9
+ export declare class AuthManager {
10
+ private readonly apiKey;
11
+ private authProvider?;
12
+ constructor(apiKey: ApiKey | undefined, authProvider?: SquidAuthProvider | undefined);
13
+ /**
14
+ * Sets a new ID token or an ID token provider.
15
+ * @deprecated: Pass the provider via constructor options parameters or `setAuthTokenProvider()`.
16
+ */
17
+ setAuthIdToken(tokenArg: string | undefined | Promise<string | undefined> | Observable<string | undefined> | SquidAuthProvider, integrationId?: IntegrationId): void;
18
+ private setAuthProviderForDeprecatedCode;
19
+ /**
20
+ * Sets a new auth-token provider to Squid.
21
+ * All future squid backend requests will use this token provider.
22
+ * Exising in-flight requests won't be affected.
23
+ */
24
+ setAuthProvider(authProvider: SquidAuthProvider): void;
25
+ getAuthData(): Promise<AuthData>;
26
+ getApiKey(): ApiKey | undefined;
27
+ /**
28
+ * Returns a valid AuthToken.
29
+ * Tries to use `apiKey` first if set up.
30
+ * Falls back to `await authTokenProvider()` result.
31
+ */
32
+ getToken(): Promise<AuthToken | undefined>;
33
+ }
@@ -1,9 +1,9 @@
1
- import { Observable } from 'rxjs';
2
- import { RpcManager } from './rpc.manager';
3
- import { ClientIdService } from './client-id.service';
4
- export declare class BackendFunctionManager {
5
- private readonly clientIdService;
6
- private readonly rpcManager;
7
- constructor(clientIdService: ClientIdService, rpcManager: RpcManager);
8
- executeFunctionAndSubscribe<T>(functionName: string, ...params: any[]): Observable<T>;
9
- }
1
+ import { Observable } from 'rxjs';
2
+ import { RpcManager } from './rpc.manager';
3
+ import { ClientIdService } from './client-id.service';
4
+ export declare class BackendFunctionManager {
5
+ private readonly clientIdService;
6
+ private readonly rpcManager;
7
+ constructor(clientIdService: ClientIdService, rpcManager: RpcManager);
8
+ executeFunctionAndSubscribe<T>(functionName: string, ...params: any[]): Observable<T>;
9
+ }
@@ -1,27 +1,27 @@
1
- import { Observable } from 'rxjs';
2
- import { ClientId } from '@squidcloud/common';
3
- import { DestructManager } from './destruct.manager';
4
- /**
5
- * Whenever a squid client is created, it assigns itself a client id.
6
- * Later on, if the squid client disconnects for a specified time interval, it will generate itself a new client id.
7
- * The client id is generated before the socket is reconnected, so it is possible that the new client id is generated,
8
- * but the socket has not connected yet.
9
- *
10
- * Short-term disconnects/reconnects of the socket do not cause the client id to be regenerated.
11
- */
12
- export declare class ClientIdService {
13
- private readonly destructManager;
14
- private readonly clientTooOldSubject;
15
- private readonly clientIdSubject;
16
- private readonly isTenant;
17
- constructor(destructManager: DestructManager);
18
- observeClientId(): Observable<ClientId>;
19
- observeClientTooOld(): Observable<void>;
20
- /** there was a long-term disconnection of the socket */
21
- notifyClientTooOld(): void;
22
- notifyClientReadyToBeRegenerated(): void;
23
- observeClientReadyToBeRegenerated(): Observable<void>;
24
- getClientId(): ClientId;
25
- isClientTooOld(): boolean;
26
- private generateClientId;
27
- }
1
+ import { Observable } from 'rxjs';
2
+ import { ClientId } from '@squidcloud/common';
3
+ import { DestructManager } from './destruct.manager';
4
+ /**
5
+ * Whenever a squid client is created, it assigns itself a client id.
6
+ * Later on, if the squid client disconnects for a specified time interval, it will generate itself a new client id.
7
+ * The client id is generated before the socket is reconnected, so it is possible that the new client id is generated,
8
+ * but the socket has not connected yet.
9
+ *
10
+ * Short-term disconnects/reconnects of the socket do not cause the client id to be regenerated.
11
+ */
12
+ export declare class ClientIdService {
13
+ private readonly destructManager;
14
+ private readonly clientTooOldSubject;
15
+ private readonly clientIdSubject;
16
+ private readonly isTenant;
17
+ constructor(destructManager: DestructManager);
18
+ observeClientId(): Observable<ClientId>;
19
+ observeClientTooOld(): Observable<void>;
20
+ /** there was a long-term disconnection of the socket */
21
+ notifyClientTooOld(): void;
22
+ notifyClientReadyToBeRegenerated(): void;
23
+ observeClientReadyToBeRegenerated(): Observable<void>;
24
+ getClientId(): ClientId;
25
+ isClientTooOld(): boolean;
26
+ private generateClientId;
27
+ }