@doany-ai/sdk 0.1.0

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 (75) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +60 -0
  3. package/dist/client.d.ts +96 -0
  4. package/dist/client.js +395 -0
  5. package/dist/client.types.d.ts +149 -0
  6. package/dist/client.types.js +1 -0
  7. package/dist/index.d.ts +17 -0
  8. package/dist/index.js +5 -0
  9. package/dist/modules/agents.d.ts +2 -0
  10. package/dist/modules/agents.js +89 -0
  11. package/dist/modules/agents.types.d.ts +397 -0
  12. package/dist/modules/agents.types.js +1 -0
  13. package/dist/modules/ai-gateway.d.ts +2 -0
  14. package/dist/modules/ai-gateway.js +13 -0
  15. package/dist/modules/ai-gateway.types.d.ts +88 -0
  16. package/dist/modules/ai-gateway.types.js +1 -0
  17. package/dist/modules/analytics.d.ts +20 -0
  18. package/dist/modules/analytics.js +284 -0
  19. package/dist/modules/analytics.types.d.ts +122 -0
  20. package/dist/modules/analytics.types.js +1 -0
  21. package/dist/modules/app-logs.d.ts +11 -0
  22. package/dist/modules/app-logs.js +27 -0
  23. package/dist/modules/app-logs.types.d.ts +46 -0
  24. package/dist/modules/app-logs.types.js +1 -0
  25. package/dist/modules/app.types.d.ts +142 -0
  26. package/dist/modules/app.types.js +1 -0
  27. package/dist/modules/auth.d.ts +13 -0
  28. package/dist/modules/auth.js +240 -0
  29. package/dist/modules/auth.types.d.ts +517 -0
  30. package/dist/modules/auth.types.js +1 -0
  31. package/dist/modules/connectors.d.ts +20 -0
  32. package/dist/modules/connectors.js +98 -0
  33. package/dist/modules/connectors.types.d.ts +376 -0
  34. package/dist/modules/connectors.types.js +1 -0
  35. package/dist/modules/custom-integrations.d.ts +11 -0
  36. package/dist/modules/custom-integrations.js +32 -0
  37. package/dist/modules/custom-integrations.types.d.ts +89 -0
  38. package/dist/modules/custom-integrations.types.js +1 -0
  39. package/dist/modules/entities.d.ts +20 -0
  40. package/dist/modules/entities.js +163 -0
  41. package/dist/modules/entities.types.d.ts +702 -0
  42. package/dist/modules/entities.types.js +1 -0
  43. package/dist/modules/functions.d.ts +12 -0
  44. package/dist/modules/functions.js +79 -0
  45. package/dist/modules/functions.types.d.ts +150 -0
  46. package/dist/modules/functions.types.js +1 -0
  47. package/dist/modules/integrations.d.ts +11 -0
  48. package/dist/modules/integrations.js +77 -0
  49. package/dist/modules/integrations.types.d.ts +418 -0
  50. package/dist/modules/integrations.types.js +1 -0
  51. package/dist/modules/sso.d.ts +11 -0
  52. package/dist/modules/sso.js +22 -0
  53. package/dist/modules/sso.types.d.ts +68 -0
  54. package/dist/modules/sso.types.js +1 -0
  55. package/dist/modules/types.d.ts +5 -0
  56. package/dist/modules/types.js +5 -0
  57. package/dist/modules/users.d.ts +16 -0
  58. package/dist/modules/users.js +23 -0
  59. package/dist/types.d.ts +72 -0
  60. package/dist/types.js +1 -0
  61. package/dist/utils/auth-utils.d.ts +117 -0
  62. package/dist/utils/auth-utils.js +189 -0
  63. package/dist/utils/auth-utils.types.d.ts +146 -0
  64. package/dist/utils/auth-utils.types.js +1 -0
  65. package/dist/utils/axios-client.d.ts +100 -0
  66. package/dist/utils/axios-client.js +202 -0
  67. package/dist/utils/axios-client.types.d.ts +28 -0
  68. package/dist/utils/axios-client.types.js +1 -0
  69. package/dist/utils/common.d.ts +4 -0
  70. package/dist/utils/common.js +11 -0
  71. package/dist/utils/sharedInstance.d.ts +1 -0
  72. package/dist/utils/sharedInstance.js +15 -0
  73. package/dist/utils/socket-utils.d.ts +47 -0
  74. package/dist/utils/socket-utils.js +170 -0
  75. package/package.json +54 -0
@@ -0,0 +1,418 @@
1
+ import { CustomIntegrationsModule } from "./custom-integrations.types.js";
2
+ /**
3
+ * Function signature for calling an integration endpoint.
4
+ *
5
+ * If any parameter is a `File` object, the request will automatically be
6
+ * sent as `multipart/form-data`. Otherwise, it will be sent as JSON.
7
+ *
8
+ * @param data - An object containing named parameters for the integration endpoint.
9
+ * @returns Promise resolving to the integration endpoint's response.
10
+ */
11
+ export type IntegrationEndpointFunction = (data: Record<string, any>) => Promise<any>;
12
+ /**
13
+ * A package containing integration endpoints.
14
+ *
15
+ * An integration package is a collection of endpoint functions indexed by endpoint name.
16
+ * Both `Core` and `custom` are integration packages that implement this structure.
17
+ *
18
+ * @example **Core package**
19
+ * ```typescript
20
+ * await base44.integrations.Core.InvokeLLM({
21
+ * prompt: 'Explain quantum computing',
22
+ * model: 'gpt_5'
23
+ * });
24
+ * ```
25
+ *
26
+ * @example **custom package**
27
+ * ```typescript
28
+ * await base44.integrations.custom.call(
29
+ * 'github',
30
+ * 'get:/repos/{owner}/{repo}',
31
+ * { pathParams: { owner: 'myorg', repo: 'myrepo' } }
32
+ * );
33
+ * ```
34
+ */
35
+ export type IntegrationPackage = {
36
+ [endpointName: string]: IntegrationEndpointFunction;
37
+ };
38
+ /**
39
+ * Parameters for the InvokeLLM function.
40
+ */
41
+ export interface InvokeLLMParams {
42
+ /** The prompt text to send to the model */
43
+ prompt: string;
44
+ /** Optionally specify a model to override the app-level model setting for this specific call.
45
+ *
46
+ * Options: `"gpt_5_mini"`, `"gemini_3_flash"`, `"gpt_5_4"`, `"gpt_5_5"`, `"gemini_3_1_pro"`, `"claude_sonnet_4_6"`, `"claude_opus_4_6"`, `"claude_opus_4_7"`, `"claude_opus_4_8"`
47
+ */
48
+ model?: 'gpt_5_mini' | 'gemini_3_flash' | 'gpt_5_4' | 'gpt_5_5' | 'gemini_3_1_pro' | 'claude_sonnet_4_6' | 'claude_opus_4_6' | 'claude_opus_4_7' | 'claude_opus_4_8';
49
+ /** If set to `true`, the LLM will use Google Search, Maps, and News to gather real-time context before answering.
50
+ * @default false
51
+ */
52
+ add_context_from_internet?: boolean;
53
+ /** If you want structured data back, provide a [JSON schema object](https://json-schema.org/understanding-json-schema/reference/object) here. If provided, the function returns a JSON object; otherwise, it returns a string. */
54
+ response_json_schema?: object;
55
+ /** A list of file URLs (uploaded via UploadFile) to provide as context/attachments to the LLM. Do not use this together with `add_context_from_internet`. */
56
+ file_urls?: string[];
57
+ }
58
+ /**
59
+ * Parameters for the GenerateImage function.
60
+ */
61
+ export interface GenerateImageParams {
62
+ /** Description of the image to generate. */
63
+ prompt: string;
64
+ }
65
+ export interface GenerateImageResult {
66
+ /** URL of the generated image. */
67
+ url: string;
68
+ }
69
+ /**
70
+ * Parameters for the UploadFile function.
71
+ */
72
+ export interface UploadFileParams {
73
+ /** The file object to upload. */
74
+ file: File;
75
+ }
76
+ export interface UploadFileResult {
77
+ /** URL of the uploaded file. */
78
+ file_url: string;
79
+ }
80
+ /**
81
+ * Parameters for the SendEmail function.
82
+ */
83
+ export interface SendEmailParams {
84
+ /** Recipient email address. */
85
+ to: string;
86
+ /** Email subject line. */
87
+ subject: string;
88
+ /** Plain text email body content. */
89
+ body: string;
90
+ /** The name of the sender. If omitted, the app's name will be used. */
91
+ from_name?: string;
92
+ }
93
+ export type SendEmailResult = any;
94
+ /**
95
+ * Parameters for the ExtractDataFromUploadedFile function.
96
+ */
97
+ export interface ExtractDataFromUploadedFileParams {
98
+ /** The URL of the uploaded file to extract data from. */
99
+ file_url: string;
100
+ /** A [JSON schema object](https://json-schema.org/understanding-json-schema/reference/object) defining what data fields you want to extract. */
101
+ json_schema: object;
102
+ }
103
+ export type ExtractDataFromUploadedFileResult = object;
104
+ /**
105
+ * Parameters for the UploadPrivateFile function.
106
+ */
107
+ export interface UploadPrivateFileParams {
108
+ /** The file object to upload. */
109
+ file: File;
110
+ }
111
+ export interface UploadPrivateFileResult {
112
+ /** URI of the uploaded private file, used to create a signed URL. */
113
+ file_uri: string;
114
+ }
115
+ /**
116
+ * Parameters for the CreateFileSignedUrl function.
117
+ */
118
+ export interface CreateFileSignedUrlParams {
119
+ /** URI of the uploaded private file. */
120
+ file_uri: string;
121
+ /** How long the signed URL should be valid for, in seconds.
122
+ * @default 300 (5 minutes)
123
+ */
124
+ expires_in?: number;
125
+ }
126
+ export interface CreateFileSignedUrlResult {
127
+ /** Temporary signed URL to access the private file. */
128
+ signed_url: string;
129
+ }
130
+ /**
131
+ * Core package containing built-in Base44 integration functions.
132
+ */
133
+ export interface CoreIntegrations {
134
+ /**
135
+ * Generate text or structured JSON data using AI models.
136
+ *
137
+ * @param params - Parameters for the LLM invocation
138
+ * @returns Promise resolving to a string (when no schema provided) or an object (when schema provided).
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * // Basic prompt
143
+ * const response = await base44.integrations.Core.InvokeLLM({
144
+ * prompt: "Write a haiku about coding."
145
+ * });
146
+ * ```
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * // Prompt with internet context
151
+ * const response = await base44.integrations.Core.InvokeLLM({
152
+ * prompt: "What is the current stock price of Wix and what was the latest major news about it?",
153
+ * add_context_from_internet: true
154
+ * });
155
+ * ```
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * // Structured JSON response
160
+ * const response = await base44.integrations.Core.InvokeLLM({
161
+ * prompt: "Analyze the sentiment of this review: 'The service was slow but the food was amazing.'",
162
+ * response_json_schema: {
163
+ * type: "object",
164
+ * properties: {
165
+ * sentiment: { type: "string", enum: ["positive", "negative", "mixed"] },
166
+ * score: { type: "number", description: "Score from 1-10" },
167
+ * key_points: { type: "array", items: { type: "string" } }
168
+ * }
169
+ * }
170
+ * });
171
+ * // Returns object: { sentiment: "mixed", score: 7, key_points: ["slow service", "amazing food"] }
172
+ * ```
173
+ */
174
+ InvokeLLM(params: InvokeLLMParams): Promise<string | object>;
175
+ /**
176
+ * Create AI-generated images from text prompts.
177
+ *
178
+ * Images are generated as PNG files at approximately 1024px on the shorter side. The
179
+ * exact dimensions vary by aspect ratio.
180
+ *
181
+ * Prompts that violate the AI provider's content policy will be refused.
182
+ *
183
+ * @param params - Parameters for image generation
184
+ * @returns Promise resolving to an object containing the URL of the generated PNG image.
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * // Generate an image from a text prompt
189
+ * const {url} = await base44.integrations.Core.GenerateImage({
190
+ * prompt: "A serene mountain landscape with a lake in the foreground"
191
+ * });
192
+ * console.log(url); // https://...generated_image.png
193
+ * ```
194
+ */
195
+ GenerateImage(params: GenerateImageParams): Promise<GenerateImageResult>;
196
+ /**
197
+ * Upload files to public storage and get a URL.
198
+ *
199
+ * @param params - Parameters for file upload
200
+ * @returns Promise resolving to an object containing the uploaded file URL.
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * // Upload a file in React
205
+ * const handleFileUpload = async (event: React.ChangeEvent<HTMLInputElement>) => {
206
+ * const file = event.target.files?.[0];
207
+ * if (!file) return;
208
+ *
209
+ * const { file_url } = await base44.integrations.Core.UploadFile({ file });
210
+ * console.log(file_url); // https://...uploaded_file.pdf
211
+ * };
212
+ * ```
213
+ */
214
+ UploadFile(params: UploadFileParams): Promise<UploadFileResult>;
215
+ /**
216
+ * Send emails to registered users of your app.
217
+ *
218
+ * @param params - Parameters for sending email
219
+ * @returns Promise resolving when the email is sent.
220
+ */
221
+ SendEmail(params: SendEmailParams): Promise<SendEmailResult>;
222
+ /**
223
+ * Extract structured data from uploaded files based on the specified schema.
224
+ *
225
+ * Start by uploading the file to public storage using the {@linkcode UploadFile | UploadFile()} function. Then, use the `file_url` parameter to extract structured data from the uploaded file.
226
+ *
227
+ * @param params - Parameters for data extraction
228
+ * @returns Promise resolving to the extracted data.
229
+ *
230
+ * @example
231
+ * ```typescript
232
+ * // Extract data from an already uploaded file
233
+ * const result = await base44.integrations.Core.ExtractDataFromUploadedFile({
234
+ * file_url: "https://example.com/files/invoice.pdf",
235
+ * json_schema: {
236
+ * type: "object",
237
+ * properties: {
238
+ * invoice_number: { type: "string" },
239
+ * total_amount: { type: "number" },
240
+ * date: { type: "string" },
241
+ * vendor_name: { type: "string" }
242
+ * }
243
+ * }
244
+ * });
245
+ * console.log(result); // { invoice_number: "INV-12345", total_amount: 1250.00, ... }
246
+ * ```
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * // Upload a file and extract data in React
251
+ * const handleFileExtraction = async (event: React.ChangeEvent<HTMLInputElement>) => {
252
+ * const file = event.target.files?.[0];
253
+ * if (!file) return;
254
+ *
255
+ * // First, upload the file
256
+ * const { file_url } = await base44.integrations.Core.UploadFile({ file });
257
+ *
258
+ * // Then extract structured data from it
259
+ * const result = await base44.integrations.Core.ExtractDataFromUploadedFile({
260
+ * file_url,
261
+ * json_schema: {
262
+ * type: "object",
263
+ * properties: {
264
+ * summary: {
265
+ * type: "string",
266
+ * description: "A brief summary of the file content"
267
+ * },
268
+ * keywords: {
269
+ * type: "array",
270
+ * items: { type: "string" }
271
+ * },
272
+ * document_type: {
273
+ * type: "string"
274
+ * }
275
+ * }
276
+ * }
277
+ * });
278
+ * console.log(result); // { summary: "...", keywords: [...], document_type: "..." }
279
+ * };
280
+ * ```
281
+ */
282
+ ExtractDataFromUploadedFile(params: ExtractDataFromUploadedFileParams): Promise<ExtractDataFromUploadedFileResult>;
283
+ /**
284
+ * Upload files to private storage that requires a signed URL to access.
285
+ *
286
+ * Create a signed URL to access uploaded files using the {@linkcode CreateFileSignedUrl | CreateFileSignedUrl()} function.
287
+ *
288
+ * @param params - Parameters for private file upload
289
+ * @returns Promise resolving to an object with a `file_uri` used to create a signed URL to access the uploaded file.
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * // Upload a private file
294
+ * const { file_uri } = await base44.integrations.Core.UploadPrivateFile({ file });
295
+ * console.log(file_uri); // "private/user123/document.pdf"
296
+ * ```
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * // Upload a private file and create a signed URL
301
+ * const handlePrivateUpload = async (event: React.ChangeEvent<HTMLInputElement>) => {
302
+ * const file = event.target.files?.[0];
303
+ * if (!file) return;
304
+ *
305
+ * // Upload to private storage
306
+ * const { file_uri } = await base44.integrations.Core.UploadPrivateFile({ file });
307
+ *
308
+ * // Create a signed URL that expires in 1 hour (3600 seconds)
309
+ * const { signed_url } = await base44.integrations.Core.CreateFileSignedUrl({
310
+ * file_uri,
311
+ * expires_in: 3600
312
+ * });
313
+ *
314
+ * console.log(signed_url); // Temporary URL to access the private file
315
+ * };
316
+ * ```
317
+ */
318
+ UploadPrivateFile(params: UploadPrivateFileParams): Promise<UploadPrivateFileResult>;
319
+ /**
320
+ * Generate temporary access links for private files.
321
+ *
322
+ * Start by uploading the file to private storage using the {@linkcode UploadPrivateFile | UploadPrivateFile()} function. Then, use the `file_uri` parameter to create a signed URL to access the uploaded file.
323
+ *
324
+ * @param params - Parameters for creating signed URL
325
+ * @returns Promise resolving to an object with a temporary `signed_url`.
326
+ *
327
+ * @example
328
+ * ```typescript
329
+ * // Create a signed URL for a private file
330
+ * const { signed_url } = await base44.integrations.Core.CreateFileSignedUrl({
331
+ * file_uri: "private/user123/document.pdf",
332
+ * expires_in: 7200 // URL expires in 2 hours
333
+ * });
334
+ * console.log(signed_url); // https://...?signature=...
335
+ * ```
336
+ */
337
+ CreateFileSignedUrl(params: CreateFileSignedUrlParams): Promise<CreateFileSignedUrlResult>;
338
+ }
339
+ /**
340
+ * Integrations module for calling integration methods.
341
+ *
342
+ * This module provides access to integration methods for interacting with external services. Unlike the connectors module that gives you raw OAuth tokens, integrations provide pre-built functions that Base44 executes on your behalf.
343
+ *
344
+ * ## Integration Types
345
+ *
346
+ * There are two types of integrations:
347
+ *
348
+ * - **Built-in integrations** (`Core`): Pre-built functions provided by Base44 for common tasks such as AI-powered text generation, image creation, file uploads, and email. Access core integration methods using:
349
+ * ```
350
+ * base44.integrations.Core.FunctionName(params)
351
+ * ```
352
+ *
353
+ * - **Custom workspace integrations** (`custom`): Pre-configured external APIs set up by workspace administrators. Workspace integration calls are proxied through Base44's backend, so credentials are never exposed to the frontend. Access custom workspace integration methods using:
354
+ * ```
355
+ * base44.integrations.custom.call(slug, operationId, params)
356
+ * ```
357
+ *
358
+ * <Info>To call a custom workspace integration, it must be pre-configured by a workspace administrator who imports an OpenAPI specification. Learn more about [custom workspace integrations](/documentation/integrations/managing-workspace-integrations).</Info>
359
+ *
360
+ * ## Authentication Modes
361
+ *
362
+ * This module is available to use with a client in all authentication modes:
363
+ *
364
+ * - **Anonymous or User authentication** (`base44.integrations`): Integration methods are invoked with the current user's permissions. Anonymous users invoke methods without authentication, while authenticated users invoke methods with their authentication context.
365
+ * - **Service role authentication** (`base44.asServiceRole.integrations`): Integration methods are invoked with the service role for backend code that needs elevated permissions.
366
+ */
367
+ export type IntegrationsModule = {
368
+ /**
369
+ * Core package containing built-in Base44 integration functions.
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * const response = await base44.integrations.Core.InvokeLLM({
374
+ * prompt: 'Explain quantum computing',
375
+ * model: 'gpt_5'
376
+ * });
377
+ * ```
378
+ */
379
+ Core: CoreIntegrations;
380
+ /**
381
+ * Workspace integrations module for calling pre-configured external APIs.
382
+ *
383
+ * @example
384
+ * ```typescript
385
+ * const result = await base44.integrations.custom.call(
386
+ * 'github',
387
+ * 'get:/repos/{owner}/{repo}',
388
+ * { pathParams: { owner: 'myorg', repo: 'myrepo' } }
389
+ * );
390
+ * ```
391
+ */
392
+ custom: CustomIntegrationsModule;
393
+ } & {
394
+ /**
395
+ * Access to additional integration packages.
396
+ *
397
+ * Allows accessing integration packages as properties. This enables both `Core` and `custom` packages,
398
+ * as well as any future integration packages that may be added.
399
+ *
400
+ * @example **Use Core integrations**
401
+ * ```typescript
402
+ * const response = await base44.integrations.Core.InvokeLLM({
403
+ * prompt: 'Explain quantum computing',
404
+ * model: 'gpt_5'
405
+ * });
406
+ * ```
407
+ *
408
+ * @example **Use custom integrations**
409
+ * ```typescript
410
+ * const result = await base44.integrations.custom.call(
411
+ * 'github',
412
+ * 'get:/repos/{owner}/{repo}',
413
+ * { pathParams: { owner: 'myorg', repo: 'myrepo' } }
414
+ * );
415
+ * ```
416
+ */
417
+ [packageName: string]: IntegrationPackage;
418
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { SsoModule } from "./sso.types";
3
+ /**
4
+ * Creates the SSO module for the Base44 SDK.
5
+ *
6
+ * @param axios - Axios instance
7
+ * @param appId - Application ID
8
+ * @returns SSO module with authentication methods
9
+ * @internal
10
+ */
11
+ export declare function createSsoModule(axios: AxiosInstance, appId: string): SsoModule;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Creates the SSO module for the Base44 SDK.
3
+ *
4
+ * @param axios - Axios instance
5
+ * @param appId - Application ID
6
+ * @returns SSO module with authentication methods
7
+ * @internal
8
+ */
9
+ export function createSsoModule(axios, appId) {
10
+ return {
11
+ // Get SSO access token for a specific user
12
+ async getAccessToken(userid) {
13
+ const url = `/apps/${appId}/auth/sso/accesstoken/${userid}`;
14
+ return axios.get(url);
15
+ },
16
+ // Get the stored SSO OIDC ID token for a specific user
17
+ async getIdToken(userid) {
18
+ const url = `/apps/${appId}/auth/sso/idtoken/${userid}`;
19
+ return axios.get(url);
20
+ },
21
+ };
22
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Response from SSO access token endpoint.
3
+ * @internal
4
+ */
5
+ export interface SsoAccessTokenResponse {
6
+ access_token: string;
7
+ }
8
+ /**
9
+ * SSO (Single Sign-On) module for managing SSO authentication.
10
+ *
11
+ * This module provides methods for retrieving SSO tokens for users. These
12
+ * tokens allow you to authenticate Base44 users with external systems or
13
+ * services.
14
+ *
15
+ * This module is only available to use with a client in service role authentication mode, which means it can only be used in backend environments.
16
+ *
17
+ * @internal
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // Access SSO module with service role
22
+ * const response = await base44.asServiceRole.sso.getAccessToken('user_123');
23
+ * console.log(response.data.access_token);
24
+ * ```
25
+ */
26
+ export interface SsoModule {
27
+ /**
28
+ * Gets SSO access token for a specific user.
29
+ *
30
+ * Retrieves a Single Sign-On access token that can be used to authenticate
31
+ * a user with external services or systems.
32
+ *
33
+ * @param userid - The user ID to get the access token for.
34
+ * @returns Promise resolving to the SSO access token response.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // Get SSO access token for a user
39
+ * const response = await base44.asServiceRole.sso.getAccessToken('user_123');
40
+ * console.log(response.access_token);
41
+ * ```
42
+ */
43
+ getAccessToken(userid: string): Promise<SsoAccessTokenResponse>;
44
+ /**
45
+ * Gets the stored SSO OIDC ID token for the current app user.
46
+ *
47
+ * The service-role client must include an on-behalf-of token for the same
48
+ * user specified by `userid`. This method returns the stored token as-is and
49
+ * does not refresh it.
50
+ *
51
+ * @param userid - The current app user's ID.
52
+ * @returns Promise resolving to the raw ID-token string.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * import { createClientFromRequest } from 'npm:@base44/sdk';
57
+ *
58
+ * Deno.serve(async (req) => {
59
+ * const base44 = createClientFromRequest(req);
60
+ * const user = await base44.auth.me();
61
+ * const idToken = await base44.asServiceRole.sso.getIdToken(user.id);
62
+ *
63
+ * return Response.json({ idToken });
64
+ * });
65
+ * ```
66
+ */
67
+ getIdToken(userid: string): Promise<string>;
68
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from "./app.types.js";
2
+ export * from "./agents.types.js";
3
+ export * from "./ai-gateway.types.js";
4
+ export * from "./connectors.types.js";
5
+ export * from "./analytics.types.js";
@@ -0,0 +1,5 @@
1
+ export * from "./app.types.js";
2
+ export * from "./agents.types.js";
3
+ export * from "./ai-gateway.types.js";
4
+ export * from "./connectors.types.js";
5
+ export * from "./analytics.types.js";
@@ -0,0 +1,16 @@
1
+ import { AxiosInstance } from "axios";
2
+ /**
3
+ * Creates the users module for the Base44 SDK
4
+ * @param {AxiosInstance} axios - Axios instance
5
+ * @param {string} appId - Application ID
6
+ * @returns {Object} Users module
7
+ */
8
+ export declare function createUsersModule(axios: AxiosInstance, appId: string): {
9
+ /**
10
+ * Invite a user to the application
11
+ * @param {string} user_email - User's email address
12
+ * @param {'user'|'admin'} role - User's role (user or admin)
13
+ * @returns {Promise<any>}
14
+ */
15
+ inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
16
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates the users module for the Base44 SDK
3
+ * @param {AxiosInstance} axios - Axios instance
4
+ * @param {string} appId - Application ID
5
+ * @returns {Object} Users module
6
+ */
7
+ export function createUsersModule(axios, appId) {
8
+ return {
9
+ /**
10
+ * Invite a user to the application
11
+ * @param {string} user_email - User's email address
12
+ * @param {'user'|'admin'} role - User's role (user or admin)
13
+ * @returns {Promise<any>}
14
+ */
15
+ async inviteUser(user_email, role) {
16
+ if (role !== "user" && role !== "admin") {
17
+ throw new Error(`Invalid role: "${role}". Role must be either "user" or "admin".`);
18
+ }
19
+ const response = await axios.post(`/apps/${appId}/runtime/users/invite-user`, { user_email, role });
20
+ return response;
21
+ },
22
+ };
23
+ }
@@ -0,0 +1,72 @@
1
+ export * from "./modules/types.js";
2
+ /**
3
+ * Parameters for filtering, sorting, and paginating agent model data.
4
+ *
5
+ * Used in the agents module for querying agent conversations. Provides a structured way to specify query criteria, sorting, pagination, and field selection.
6
+ *
7
+ * @property q - Query object with field-value pairs for filtering.
8
+ * @property sort - Sort parameter. For example, "-created_date" for descending order.
9
+ * @property sort_by - Alternative sort parameter. Use either `sort` or `sort_by`.
10
+ * @property limit - Maximum number of results to return.
11
+ * @property skip - Number of results to skip. Used for pagination.
12
+ * @property fields - Array of field names to include in the response.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // Filter conversations by agent name
17
+ * const conversations = await base44.agents.listConversations({
18
+ * q: { agent_name: 'support-bot' }
19
+ * });
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Filter conversations with sorting
25
+ * const conversations = await base44.agents.listConversations({
26
+ * q: { status: 'active' },
27
+ * sort: '-created_at' // Sort by created_at descending
28
+ * });
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // Filter conversations with pagination
34
+ * const conversations = await base44.agents.listConversations({
35
+ * q: { agent_name: 'support-bot' },
36
+ * limit: 20, // Get 20 results
37
+ * skip: 40 // Skip first 40 (page 3)
38
+ * });
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Filter conversations with field selection
44
+ * const conversations = await base44.agents.listConversations({
45
+ * q: { status: 'active' },
46
+ * fields: ['id', 'agent_name', 'created_at']
47
+ * });
48
+ * ```
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // Filter conversations with multiple filters
53
+ * const conversations = await base44.agents.listConversations({
54
+ * q: {
55
+ * agent_name: 'support-bot',
56
+ * 'metadata.priority': 'high',
57
+ * status: 'active'
58
+ * },
59
+ * sort: '-updated_at',
60
+ * limit: 50,
61
+ * skip: 0
62
+ * });
63
+ * ```
64
+ */
65
+ export interface ModelFilterParams {
66
+ q?: Record<string, any>;
67
+ sort?: string | null;
68
+ sort_by?: string | null;
69
+ limit?: number | null;
70
+ skip?: number | null;
71
+ fields?: string[] | null;
72
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./modules/types.js";