@doany-ai/sdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +28 -28
- package/dist/client.js +45 -37
- package/dist/client.types.d.ts +11 -11
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/modules/agents.types.d.ts +12 -12
- package/dist/modules/ai-gateway.types.d.ts +12 -12
- package/dist/modules/analytics.d.ts +1 -1
- package/dist/modules/analytics.js +1 -1
- package/dist/modules/analytics.types.d.ts +4 -4
- package/dist/modules/app-logs.d.ts +1 -1
- package/dist/modules/app-logs.js +1 -1
- package/dist/modules/app-logs.types.d.ts +3 -3
- package/dist/modules/auth.d.ts +1 -1
- package/dist/modules/auth.js +4 -4
- package/dist/modules/auth.types.d.ts +32 -32
- package/dist/modules/connectors.d.ts +1 -1
- package/dist/modules/connectors.js +1 -1
- package/dist/modules/connectors.types.d.ts +18 -18
- package/dist/modules/custom-integrations.d.ts +1 -1
- package/dist/modules/custom-integrations.js +1 -1
- package/dist/modules/custom-integrations.types.d.ts +5 -5
- package/dist/modules/entities.d.ts +1 -1
- package/dist/modules/entities.js +4 -4
- package/dist/modules/entities.types.d.ts +36 -36
- package/dist/modules/functions.d.ts +1 -1
- package/dist/modules/functions.js +1 -1
- package/dist/modules/functions.types.d.ts +8 -8
- package/dist/modules/integrations.d.ts +1 -1
- package/dist/modules/integrations.js +1 -1
- package/dist/modules/integrations.types.d.ts +27 -27
- package/dist/modules/sso.d.ts +1 -1
- package/dist/modules/sso.js +1 -1
- package/dist/modules/sso.types.d.ts +7 -7
- package/dist/modules/users.d.ts +1 -1
- package/dist/modules/users.js +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/utils/auth-utils.d.ts +7 -7
- package/dist/utils/auth-utils.js +10 -10
- package/dist/utils/auth-utils.types.d.ts +7 -7
- package/dist/utils/axios-client.d.ts +10 -10
- package/dist/utils/axios-client.js +14 -14
- package/dist/utils/axios-client.types.d.ts +4 -4
- package/dist/utils/sharedInstance.js +6 -6
- package/dist/utils/socket-utils.js +1 -1
- package/package.json +1 -1
|
@@ -88,7 +88,7 @@ export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${key
|
|
|
88
88
|
* Entity filter query type system.
|
|
89
89
|
*
|
|
90
90
|
* `EntityFilterQuery<T>` keeps field names tied to the entity schema while
|
|
91
|
-
* allowing
|
|
91
|
+
* allowing Doany's documented filtering syntax. Each field can use an exact
|
|
92
92
|
* value, `null`, an array shorthand for matching any listed value, or a
|
|
93
93
|
* field-level operator object. Root-level `$and`, `$or`, and `$nor` combine
|
|
94
94
|
* nested filter queries.
|
|
@@ -183,7 +183,7 @@ export interface EntityTypeRegistry {
|
|
|
183
183
|
* // Combine your schema with server fields (id, created_date, etc.)
|
|
184
184
|
* type TaskRecord = EntityRecord['Task'];
|
|
185
185
|
*
|
|
186
|
-
* const task: TaskRecord = await
|
|
186
|
+
* const task: TaskRecord = await doany.entities.Task.create({
|
|
187
187
|
* title: 'My task',
|
|
188
188
|
* status: 'pending'
|
|
189
189
|
* });
|
|
@@ -223,26 +223,26 @@ export interface EntityHandler<T = any> {
|
|
|
223
223
|
* @example
|
|
224
224
|
* ```typescript
|
|
225
225
|
* // Get all records
|
|
226
|
-
* const records = await
|
|
226
|
+
* const records = await doany.entities.MyEntity.list();
|
|
227
227
|
* ```
|
|
228
228
|
*
|
|
229
229
|
* @example
|
|
230
230
|
* ```typescript
|
|
231
231
|
* // Get first 10 records sorted by date
|
|
232
|
-
* const recentRecords = await
|
|
232
|
+
* const recentRecords = await doany.entities.MyEntity.list('-created_date', 10);
|
|
233
233
|
* ```
|
|
234
234
|
*
|
|
235
235
|
* @example
|
|
236
236
|
* ```typescript
|
|
237
237
|
* // Get paginated results
|
|
238
238
|
* // Skip first 20, get next 10
|
|
239
|
-
* const page3 = await
|
|
239
|
+
* const page3 = await doany.entities.MyEntity.list('-created_date', 10, 20);
|
|
240
240
|
* ```
|
|
241
241
|
*
|
|
242
242
|
* @example
|
|
243
243
|
* ```typescript
|
|
244
244
|
* // Get only specific fields
|
|
245
|
-
* const fields = await
|
|
245
|
+
* const fields = await doany.entities.MyEntity.list('-created_date', 10, 0, ['name', 'status']);
|
|
246
246
|
* ```
|
|
247
247
|
*/
|
|
248
248
|
list<K extends keyof T = keyof T>(sort?: SortField<T>, limit?: number, skip?: number, fields?: K[]): Promise<Pick<T, K>[]>;
|
|
@@ -269,7 +269,7 @@ export interface EntityHandler<T = any> {
|
|
|
269
269
|
* @example
|
|
270
270
|
* ```typescript
|
|
271
271
|
* // Filter by single field
|
|
272
|
-
* const activeRecords = await
|
|
272
|
+
* const activeRecords = await doany.entities.MyEntity.filter({
|
|
273
273
|
* status: 'active'
|
|
274
274
|
* });
|
|
275
275
|
* ```
|
|
@@ -277,7 +277,7 @@ export interface EntityHandler<T = any> {
|
|
|
277
277
|
* @example
|
|
278
278
|
* ```typescript
|
|
279
279
|
* // Filter by multiple fields
|
|
280
|
-
* const filteredRecords = await
|
|
280
|
+
* const filteredRecords = await doany.entities.MyEntity.filter({
|
|
281
281
|
* priority: 'high',
|
|
282
282
|
* status: 'active'
|
|
283
283
|
* });
|
|
@@ -286,7 +286,7 @@ export interface EntityHandler<T = any> {
|
|
|
286
286
|
* @example
|
|
287
287
|
* ```typescript
|
|
288
288
|
* // Filter by any matching value
|
|
289
|
-
* const records = await
|
|
289
|
+
* const records = await doany.entities.MyEntity.filter({
|
|
290
290
|
* external_id: ['item-1', 'item-2']
|
|
291
291
|
* });
|
|
292
292
|
* ```
|
|
@@ -294,7 +294,7 @@ export interface EntityHandler<T = any> {
|
|
|
294
294
|
* @example
|
|
295
295
|
* ```typescript
|
|
296
296
|
* // Filter with query operators
|
|
297
|
-
* const popularRecords = await
|
|
297
|
+
* const popularRecords = await doany.entities.MyEntity.filter({
|
|
298
298
|
* count: { $gte: 100 },
|
|
299
299
|
* external_id: { $in: ['item-1', 'item-2'] }
|
|
300
300
|
* });
|
|
@@ -303,7 +303,7 @@ export interface EntityHandler<T = any> {
|
|
|
303
303
|
* @example
|
|
304
304
|
* ```typescript
|
|
305
305
|
* // Filter with logical operators
|
|
306
|
-
* const records = await
|
|
306
|
+
* const records = await doany.entities.MyEntity.filter({
|
|
307
307
|
* $or: [
|
|
308
308
|
* { name: 'Example item' },
|
|
309
309
|
* { slug: 'example-item' }
|
|
@@ -314,7 +314,7 @@ export interface EntityHandler<T = any> {
|
|
|
314
314
|
* @example
|
|
315
315
|
* ```typescript
|
|
316
316
|
* // Filter null values
|
|
317
|
-
* const recordsWithoutDescription = await
|
|
317
|
+
* const recordsWithoutDescription = await doany.entities.MyEntity.filter({
|
|
318
318
|
* description: null
|
|
319
319
|
* });
|
|
320
320
|
* ```
|
|
@@ -322,7 +322,7 @@ export interface EntityHandler<T = any> {
|
|
|
322
322
|
* @example
|
|
323
323
|
* ```typescript
|
|
324
324
|
* // Filter with sorting and pagination
|
|
325
|
-
* const results = await
|
|
325
|
+
* const results = await doany.entities.MyEntity.filter(
|
|
326
326
|
* { status: 'active' },
|
|
327
327
|
* '-created_date',
|
|
328
328
|
* 20,
|
|
@@ -333,7 +333,7 @@ export interface EntityHandler<T = any> {
|
|
|
333
333
|
* @example
|
|
334
334
|
* ```typescript
|
|
335
335
|
* // Filter with specific fields
|
|
336
|
-
* const fields = await
|
|
336
|
+
* const fields = await doany.entities.MyEntity.filter(
|
|
337
337
|
* { priority: 'high' },
|
|
338
338
|
* '-created_date',
|
|
339
339
|
* 10,
|
|
@@ -354,7 +354,7 @@ export interface EntityHandler<T = any> {
|
|
|
354
354
|
* @example
|
|
355
355
|
* ```typescript
|
|
356
356
|
* // Get record by ID
|
|
357
|
-
* const record = await
|
|
357
|
+
* const record = await doany.entities.MyEntity.get('entity-123');
|
|
358
358
|
* console.log(record.name);
|
|
359
359
|
* ```
|
|
360
360
|
*/
|
|
@@ -370,7 +370,7 @@ export interface EntityHandler<T = any> {
|
|
|
370
370
|
* @example
|
|
371
371
|
* ```typescript
|
|
372
372
|
* // Create a new record
|
|
373
|
-
* const newRecord = await
|
|
373
|
+
* const newRecord = await doany.entities.MyEntity.create({
|
|
374
374
|
* name: 'My Item',
|
|
375
375
|
* status: 'active',
|
|
376
376
|
* priority: 'high'
|
|
@@ -397,7 +397,7 @@ export interface EntityHandler<T = any> {
|
|
|
397
397
|
* @example
|
|
398
398
|
* ```typescript
|
|
399
399
|
* // Update single field
|
|
400
|
-
* const updated = await
|
|
400
|
+
* const updated = await doany.entities.MyEntity.update('entity-123', {
|
|
401
401
|
* status: 'completed'
|
|
402
402
|
* });
|
|
403
403
|
* ```
|
|
@@ -405,7 +405,7 @@ export interface EntityHandler<T = any> {
|
|
|
405
405
|
* @example
|
|
406
406
|
* ```typescript
|
|
407
407
|
* // Update multiple fields
|
|
408
|
-
* const updated = await
|
|
408
|
+
* const updated = await doany.entities.MyEntity.update('entity-123', {
|
|
409
409
|
* name: 'Updated name',
|
|
410
410
|
* priority: 'low',
|
|
411
411
|
* status: 'active'
|
|
@@ -424,7 +424,7 @@ export interface EntityHandler<T = any> {
|
|
|
424
424
|
* @example
|
|
425
425
|
* ```typescript
|
|
426
426
|
* // Delete a record
|
|
427
|
-
* const result = await
|
|
427
|
+
* const result = await doany.entities.MyEntity.delete('entity-123');
|
|
428
428
|
* console.log('Deleted:', result.success);
|
|
429
429
|
* ```
|
|
430
430
|
*/
|
|
@@ -442,7 +442,7 @@ export interface EntityHandler<T = any> {
|
|
|
442
442
|
* @example
|
|
443
443
|
* ```typescript
|
|
444
444
|
* // Delete by multiple criteria
|
|
445
|
-
* const result = await
|
|
445
|
+
* const result = await doany.entities.MyEntity.deleteMany({
|
|
446
446
|
* status: 'completed',
|
|
447
447
|
* priority: 'low'
|
|
448
448
|
* });
|
|
@@ -462,7 +462,7 @@ export interface EntityHandler<T = any> {
|
|
|
462
462
|
* @example
|
|
463
463
|
* ```typescript
|
|
464
464
|
* // Create multiple records at once
|
|
465
|
-
* const result = await
|
|
465
|
+
* const result = await doany.entities.MyEntity.bulkCreate([
|
|
466
466
|
* { name: 'Item 1', status: 'active' },
|
|
467
467
|
* { name: 'Item 2', status: 'active' },
|
|
468
468
|
* { name: 'Item 3', status: 'completed' }
|
|
@@ -503,7 +503,7 @@ export interface EntityHandler<T = any> {
|
|
|
503
503
|
* ```typescript
|
|
504
504
|
* // Basic usage
|
|
505
505
|
* // Archive all completed orders
|
|
506
|
-
* const result = await
|
|
506
|
+
* const result = await doany.entities.Order.updateMany(
|
|
507
507
|
* { status: 'completed' },
|
|
508
508
|
* { $set: { status: 'archived' } }
|
|
509
509
|
* );
|
|
@@ -514,7 +514,7 @@ export interface EntityHandler<T = any> {
|
|
|
514
514
|
* ```typescript
|
|
515
515
|
* // Multiple query operators
|
|
516
516
|
* // Flag urgent items that haven't been handled yet
|
|
517
|
-
* const result = await
|
|
517
|
+
* const result = await doany.entities.Task.updateMany(
|
|
518
518
|
* { priority: { $in: ['high', 'critical'] }, status: { $ne: 'done' } },
|
|
519
519
|
* { $set: { flagged: true } }
|
|
520
520
|
* );
|
|
@@ -524,7 +524,7 @@ export interface EntityHandler<T = any> {
|
|
|
524
524
|
* ```typescript
|
|
525
525
|
* // Multiple update operators
|
|
526
526
|
* // Close out sales records and bump the view count
|
|
527
|
-
* const result = await
|
|
527
|
+
* const result = await doany.entities.Deal.updateMany(
|
|
528
528
|
* { category: 'sales' },
|
|
529
529
|
* { $set: { status: 'done' }, $inc: { view_count: 1 } }
|
|
530
530
|
* );
|
|
@@ -539,7 +539,7 @@ export interface EntityHandler<T = any> {
|
|
|
539
539
|
* let hasMore = true;
|
|
540
540
|
* let totalUpdated = 0;
|
|
541
541
|
* while (hasMore) {
|
|
542
|
-
* const result = await
|
|
542
|
+
* const result = await doany.entities.Job.updateMany(
|
|
543
543
|
* { status: 'pending' },
|
|
544
544
|
* { $set: { status: 'processed' } }
|
|
545
545
|
* );
|
|
@@ -569,7 +569,7 @@ export interface EntityHandler<T = any> {
|
|
|
569
569
|
* ```typescript
|
|
570
570
|
* // Basic usage
|
|
571
571
|
* // Update three invoices with different statuses and amounts
|
|
572
|
-
* const updated = await
|
|
572
|
+
* const updated = await doany.entities.Invoice.bulkUpdate([
|
|
573
573
|
* { id: 'inv-1', status: 'paid', amount: 999 },
|
|
574
574
|
* { id: 'inv-2', status: 'cancelled' },
|
|
575
575
|
* { id: 'inv-3', amount: 450 }
|
|
@@ -583,7 +583,7 @@ export interface EntityHandler<T = any> {
|
|
|
583
583
|
* const allUpdates = reassignments.map(r => ({ id: r.taskId, owner: r.newOwner }));
|
|
584
584
|
* for (let i = 0; i < allUpdates.length; i += 500) {
|
|
585
585
|
* const batch = allUpdates.slice(i, i + 500);
|
|
586
|
-
* await
|
|
586
|
+
* await doany.entities.Task.bulkUpdate(batch);
|
|
587
587
|
* }
|
|
588
588
|
* ```
|
|
589
589
|
*/
|
|
@@ -605,7 +605,7 @@ export interface EntityHandler<T = any> {
|
|
|
605
605
|
* const handleFileImport = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
606
606
|
* const file = event.target.files?.[0];
|
|
607
607
|
* if (file) {
|
|
608
|
-
* const result = await
|
|
608
|
+
* const result = await doany.entities.MyEntity.importEntities(file);
|
|
609
609
|
* if (result.status === 'success' && result.output) {
|
|
610
610
|
* console.log(`Imported ${result.output.length} records`);
|
|
611
611
|
* }
|
|
@@ -631,7 +631,7 @@ export interface EntityHandler<T = any> {
|
|
|
631
631
|
* @example
|
|
632
632
|
* ```typescript
|
|
633
633
|
* // Subscribe to all Task changes
|
|
634
|
-
* const unsubscribe =
|
|
634
|
+
* const unsubscribe = doany.entities.Task.subscribe((event) => {
|
|
635
635
|
* console.log(`Task ${event.id} was ${event.type}d:`, event.data);
|
|
636
636
|
* });
|
|
637
637
|
*
|
|
@@ -660,18 +660,18 @@ type DynamicEntitiesModule = {
|
|
|
660
660
|
* Each entity gets a handler with full CRUD operations and additional utility methods.
|
|
661
661
|
*
|
|
662
662
|
* Entities are accessed dynamically using the pattern:
|
|
663
|
-
* `
|
|
663
|
+
* `doany.entities.EntityName.method()`
|
|
664
664
|
*
|
|
665
665
|
* This module is available to use with a client in all authentication modes:
|
|
666
666
|
*
|
|
667
|
-
* - **Anonymous or User authentication** (`
|
|
668
|
-
* - **Service role authentication** (`
|
|
667
|
+
* - **Anonymous or User authentication** (`doany.entities`): Access is scoped to the current user's permissions. Anonymous users can only access public entities, while authenticated users can access entities they have permission to view or modify.
|
|
668
|
+
* - **Service role authentication** (`doany.asServiceRole.entities`): Operations bypass entity access rules and field-level security entirely. Can read and write any record in any entity.
|
|
669
669
|
*
|
|
670
670
|
* ## Entity Handlers
|
|
671
671
|
*
|
|
672
|
-
* An entity handler is the object you get when you access an entity through `
|
|
672
|
+
* An entity handler is the object you get when you access an entity through `doany.entities.EntityName`. Every entity in your app automatically gets a handler with CRUD methods for managing records.
|
|
673
673
|
*
|
|
674
|
-
* For example, `
|
|
674
|
+
* For example, `doany.entities.Task` is an entity handler for Task records, and `doany.entities.User` is an entity handler for User records. Each handler provides methods like `list()`, `create()`, `update()`, and `delete()`.
|
|
675
675
|
*
|
|
676
676
|
* You don't need to instantiate or import entity handlers. They're automatically available for every entity you create in your app.
|
|
677
677
|
*
|
|
@@ -689,13 +689,13 @@ type DynamicEntitiesModule = {
|
|
|
689
689
|
* ```typescript
|
|
690
690
|
* // Get all records from the MyEntity entity
|
|
691
691
|
* // Get all records the current user has permissions to view
|
|
692
|
-
* const myRecords = await
|
|
692
|
+
* const myRecords = await doany.entities.MyEntity.list();
|
|
693
693
|
* ```
|
|
694
694
|
*
|
|
695
695
|
* @example
|
|
696
696
|
* ```typescript
|
|
697
697
|
* // List every user, bypassing the User entity's access rules
|
|
698
|
-
* const allUsers = await
|
|
698
|
+
* const allUsers = await doany.asServiceRole.entities.User.list();
|
|
699
699
|
* ```
|
|
700
700
|
*/
|
|
701
701
|
export type EntitiesModule = TypedEntitiesModule & DynamicEntitiesModule;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { FunctionsModule, FunctionsModuleConfig } from "./functions.types";
|
|
3
3
|
/**
|
|
4
|
-
* Creates the functions module for the
|
|
4
|
+
* Creates the functions module for the Doany SDK.
|
|
5
5
|
*
|
|
6
6
|
* @param axios - Axios instance
|
|
7
7
|
* @param appId - Application ID
|
|
@@ -10,7 +10,7 @@ export interface FunctionNameRegistry {
|
|
|
10
10
|
* ```typescript
|
|
11
11
|
* // Using generated function name types
|
|
12
12
|
* // With generated types, you get autocomplete on function names
|
|
13
|
-
* await
|
|
13
|
+
* await doany.functions.invoke('calculateTotal', { items: ['item1', 'item2'] });
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
export type FunctionName = keyof FunctionNameRegistry extends never ? string : keyof FunctionNameRegistry;
|
|
@@ -39,8 +39,8 @@ export interface FunctionsModuleConfig {
|
|
|
39
39
|
*
|
|
40
40
|
* This module is available to use with a client in all authentication modes:
|
|
41
41
|
*
|
|
42
|
-
* - **Anonymous or User authentication** (`
|
|
43
|
-
* - **Service role authentication** (`
|
|
42
|
+
* - **Anonymous or User authentication** (`doany.functions`): Functions are invoked with the current user's permissions. Anonymous users invoke functions without authentication, while authenticated users invoke functions with their authentication context.
|
|
43
|
+
* - **Service role authentication** (`doany.asServiceRole.functions`): Functions are invoked with the service role for backend code that needs elevated permissions.
|
|
44
44
|
*
|
|
45
45
|
* ## Generated Types
|
|
46
46
|
*
|
|
@@ -64,7 +64,7 @@ export interface FunctionsModule {
|
|
|
64
64
|
* @example
|
|
65
65
|
* ```typescript
|
|
66
66
|
* // Basic function call
|
|
67
|
-
* const result = await
|
|
67
|
+
* const result = await doany.functions.invoke('calculateTotal', {
|
|
68
68
|
* items: ['item1', 'item2'],
|
|
69
69
|
* });
|
|
70
70
|
* console.log(result.data.total);
|
|
@@ -76,7 +76,7 @@ export interface FunctionsModule {
|
|
|
76
76
|
* const handleFileUpload = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
77
77
|
* const file = event.target.files?.[0];
|
|
78
78
|
* if (file) {
|
|
79
|
-
* const processedImage = await
|
|
79
|
+
* const processedImage = await doany.functions.invoke('processImage', {
|
|
80
80
|
* image: file,
|
|
81
81
|
* filter: 'grayscale',
|
|
82
82
|
* quality: 80
|
|
@@ -101,7 +101,7 @@ export interface FunctionsModule {
|
|
|
101
101
|
* @example
|
|
102
102
|
* ```typescript
|
|
103
103
|
* // Stream an SSE response
|
|
104
|
-
* const response = await
|
|
104
|
+
* const response = await doany.functions.fetch('/chat', {
|
|
105
105
|
* method: 'POST',
|
|
106
106
|
* headers: { 'Content-Type': 'application/json' },
|
|
107
107
|
* body: JSON.stringify({ prompt: 'Hello!' }),
|
|
@@ -120,7 +120,7 @@ export interface FunctionsModule {
|
|
|
120
120
|
* @example
|
|
121
121
|
* ```typescript
|
|
122
122
|
* // PUT request
|
|
123
|
-
* const response = await
|
|
123
|
+
* const response = await doany.functions.fetch('/users/profile', {
|
|
124
124
|
* method: 'PUT',
|
|
125
125
|
* headers: { 'Content-Type': 'application/json' },
|
|
126
126
|
* body: JSON.stringify({ name: 'Jane', role: 'admin' }),
|
|
@@ -136,7 +136,7 @@ export interface FunctionsModule {
|
|
|
136
136
|
* @example
|
|
137
137
|
* ```typescript
|
|
138
138
|
* // Download a binary file
|
|
139
|
-
* const response = await
|
|
139
|
+
* const response = await doany.functions.fetch('/export/report');
|
|
140
140
|
* const blob = await response.blob();
|
|
141
141
|
*
|
|
142
142
|
* const url = URL.createObjectURL(blob);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { IntegrationsModule } from "./integrations.types.js";
|
|
3
3
|
/**
|
|
4
|
-
* Creates the integrations module for the
|
|
4
|
+
* Creates the integrations module for the Doany SDK.
|
|
5
5
|
*
|
|
6
6
|
* @param axios - Axios instance
|
|
7
7
|
* @param appId - Application ID
|
|
@@ -17,7 +17,7 @@ export type IntegrationEndpointFunction = (data: Record<string, any>) => Promise
|
|
|
17
17
|
*
|
|
18
18
|
* @example **Core package**
|
|
19
19
|
* ```typescript
|
|
20
|
-
* await
|
|
20
|
+
* await doany.integrations.Core.InvokeLLM({
|
|
21
21
|
* prompt: 'Explain quantum computing',
|
|
22
22
|
* model: 'gpt_5'
|
|
23
23
|
* });
|
|
@@ -25,7 +25,7 @@ export type IntegrationEndpointFunction = (data: Record<string, any>) => Promise
|
|
|
25
25
|
*
|
|
26
26
|
* @example **custom package**
|
|
27
27
|
* ```typescript
|
|
28
|
-
* await
|
|
28
|
+
* await doany.integrations.custom.call(
|
|
29
29
|
* 'github',
|
|
30
30
|
* 'get:/repos/{owner}/{repo}',
|
|
31
31
|
* { pathParams: { owner: 'myorg', repo: 'myrepo' } }
|
|
@@ -128,7 +128,7 @@ export interface CreateFileSignedUrlResult {
|
|
|
128
128
|
signed_url: string;
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
|
-
* Core package containing built-in
|
|
131
|
+
* Core package containing built-in Doany integration functions.
|
|
132
132
|
*/
|
|
133
133
|
export interface CoreIntegrations {
|
|
134
134
|
/**
|
|
@@ -140,7 +140,7 @@ export interface CoreIntegrations {
|
|
|
140
140
|
* @example
|
|
141
141
|
* ```typescript
|
|
142
142
|
* // Basic prompt
|
|
143
|
-
* const response = await
|
|
143
|
+
* const response = await doany.integrations.Core.InvokeLLM({
|
|
144
144
|
* prompt: "Write a haiku about coding."
|
|
145
145
|
* });
|
|
146
146
|
* ```
|
|
@@ -148,7 +148,7 @@ export interface CoreIntegrations {
|
|
|
148
148
|
* @example
|
|
149
149
|
* ```typescript
|
|
150
150
|
* // Prompt with internet context
|
|
151
|
-
* const response = await
|
|
151
|
+
* const response = await doany.integrations.Core.InvokeLLM({
|
|
152
152
|
* prompt: "What is the current stock price of Wix and what was the latest major news about it?",
|
|
153
153
|
* add_context_from_internet: true
|
|
154
154
|
* });
|
|
@@ -157,7 +157,7 @@ export interface CoreIntegrations {
|
|
|
157
157
|
* @example
|
|
158
158
|
* ```typescript
|
|
159
159
|
* // Structured JSON response
|
|
160
|
-
* const response = await
|
|
160
|
+
* const response = await doany.integrations.Core.InvokeLLM({
|
|
161
161
|
* prompt: "Analyze the sentiment of this review: 'The service was slow but the food was amazing.'",
|
|
162
162
|
* response_json_schema: {
|
|
163
163
|
* type: "object",
|
|
@@ -186,7 +186,7 @@ export interface CoreIntegrations {
|
|
|
186
186
|
* @example
|
|
187
187
|
* ```typescript
|
|
188
188
|
* // Generate an image from a text prompt
|
|
189
|
-
* const {url} = await
|
|
189
|
+
* const {url} = await doany.integrations.Core.GenerateImage({
|
|
190
190
|
* prompt: "A serene mountain landscape with a lake in the foreground"
|
|
191
191
|
* });
|
|
192
192
|
* console.log(url); // https://...generated_image.png
|
|
@@ -206,7 +206,7 @@ export interface CoreIntegrations {
|
|
|
206
206
|
* const file = event.target.files?.[0];
|
|
207
207
|
* if (!file) return;
|
|
208
208
|
*
|
|
209
|
-
* const { file_url } = await
|
|
209
|
+
* const { file_url } = await doany.integrations.Core.UploadFile({ file });
|
|
210
210
|
* console.log(file_url); // https://...uploaded_file.pdf
|
|
211
211
|
* };
|
|
212
212
|
* ```
|
|
@@ -230,7 +230,7 @@ export interface CoreIntegrations {
|
|
|
230
230
|
* @example
|
|
231
231
|
* ```typescript
|
|
232
232
|
* // Extract data from an already uploaded file
|
|
233
|
-
* const result = await
|
|
233
|
+
* const result = await doany.integrations.Core.ExtractDataFromUploadedFile({
|
|
234
234
|
* file_url: "https://example.com/files/invoice.pdf",
|
|
235
235
|
* json_schema: {
|
|
236
236
|
* type: "object",
|
|
@@ -253,10 +253,10 @@ export interface CoreIntegrations {
|
|
|
253
253
|
* if (!file) return;
|
|
254
254
|
*
|
|
255
255
|
* // First, upload the file
|
|
256
|
-
* const { file_url } = await
|
|
256
|
+
* const { file_url } = await doany.integrations.Core.UploadFile({ file });
|
|
257
257
|
*
|
|
258
258
|
* // Then extract structured data from it
|
|
259
|
-
* const result = await
|
|
259
|
+
* const result = await doany.integrations.Core.ExtractDataFromUploadedFile({
|
|
260
260
|
* file_url,
|
|
261
261
|
* json_schema: {
|
|
262
262
|
* type: "object",
|
|
@@ -291,7 +291,7 @@ export interface CoreIntegrations {
|
|
|
291
291
|
* @example
|
|
292
292
|
* ```typescript
|
|
293
293
|
* // Upload a private file
|
|
294
|
-
* const { file_uri } = await
|
|
294
|
+
* const { file_uri } = await doany.integrations.Core.UploadPrivateFile({ file });
|
|
295
295
|
* console.log(file_uri); // "private/user123/document.pdf"
|
|
296
296
|
* ```
|
|
297
297
|
*
|
|
@@ -303,10 +303,10 @@ export interface CoreIntegrations {
|
|
|
303
303
|
* if (!file) return;
|
|
304
304
|
*
|
|
305
305
|
* // Upload to private storage
|
|
306
|
-
* const { file_uri } = await
|
|
306
|
+
* const { file_uri } = await doany.integrations.Core.UploadPrivateFile({ file });
|
|
307
307
|
*
|
|
308
308
|
* // Create a signed URL that expires in 1 hour (3600 seconds)
|
|
309
|
-
* const { signed_url } = await
|
|
309
|
+
* const { signed_url } = await doany.integrations.Core.CreateFileSignedUrl({
|
|
310
310
|
* file_uri,
|
|
311
311
|
* expires_in: 3600
|
|
312
312
|
* });
|
|
@@ -327,7 +327,7 @@ export interface CoreIntegrations {
|
|
|
327
327
|
* @example
|
|
328
328
|
* ```typescript
|
|
329
329
|
* // Create a signed URL for a private file
|
|
330
|
-
* const { signed_url } = await
|
|
330
|
+
* const { signed_url } = await doany.integrations.Core.CreateFileSignedUrl({
|
|
331
331
|
* file_uri: "private/user123/document.pdf",
|
|
332
332
|
* expires_in: 7200 // URL expires in 2 hours
|
|
333
333
|
* });
|
|
@@ -339,20 +339,20 @@ export interface CoreIntegrations {
|
|
|
339
339
|
/**
|
|
340
340
|
* Integrations module for calling integration methods.
|
|
341
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
|
|
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 Doany executes on your behalf.
|
|
343
343
|
*
|
|
344
344
|
* ## Integration Types
|
|
345
345
|
*
|
|
346
346
|
* There are two types of integrations:
|
|
347
347
|
*
|
|
348
|
-
* - **Built-in integrations** (`Core`): Pre-built functions provided by
|
|
348
|
+
* - **Built-in integrations** (`Core`): Pre-built functions provided by Doany for common tasks such as AI-powered text generation, image creation, file uploads, and email. Access core integration methods using:
|
|
349
349
|
* ```
|
|
350
|
-
*
|
|
350
|
+
* doany.integrations.Core.FunctionName(params)
|
|
351
351
|
* ```
|
|
352
352
|
*
|
|
353
|
-
* - **Custom workspace integrations** (`custom`): Pre-configured external APIs set up by workspace administrators. Workspace integration calls are proxied through
|
|
353
|
+
* - **Custom workspace integrations** (`custom`): Pre-configured external APIs set up by workspace administrators. Workspace integration calls are proxied through Doany's backend, so credentials are never exposed to the frontend. Access custom workspace integration methods using:
|
|
354
354
|
* ```
|
|
355
|
-
*
|
|
355
|
+
* doany.integrations.custom.call(slug, operationId, params)
|
|
356
356
|
* ```
|
|
357
357
|
*
|
|
358
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>
|
|
@@ -361,16 +361,16 @@ export interface CoreIntegrations {
|
|
|
361
361
|
*
|
|
362
362
|
* This module is available to use with a client in all authentication modes:
|
|
363
363
|
*
|
|
364
|
-
* - **Anonymous or User authentication** (`
|
|
365
|
-
* - **Service role authentication** (`
|
|
364
|
+
* - **Anonymous or User authentication** (`doany.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** (`doany.asServiceRole.integrations`): Integration methods are invoked with the service role for backend code that needs elevated permissions.
|
|
366
366
|
*/
|
|
367
367
|
export type IntegrationsModule = {
|
|
368
368
|
/**
|
|
369
|
-
* Core package containing built-in
|
|
369
|
+
* Core package containing built-in Doany integration functions.
|
|
370
370
|
*
|
|
371
371
|
* @example
|
|
372
372
|
* ```typescript
|
|
373
|
-
* const response = await
|
|
373
|
+
* const response = await doany.integrations.Core.InvokeLLM({
|
|
374
374
|
* prompt: 'Explain quantum computing',
|
|
375
375
|
* model: 'gpt_5'
|
|
376
376
|
* });
|
|
@@ -382,7 +382,7 @@ export type IntegrationsModule = {
|
|
|
382
382
|
*
|
|
383
383
|
* @example
|
|
384
384
|
* ```typescript
|
|
385
|
-
* const result = await
|
|
385
|
+
* const result = await doany.integrations.custom.call(
|
|
386
386
|
* 'github',
|
|
387
387
|
* 'get:/repos/{owner}/{repo}',
|
|
388
388
|
* { pathParams: { owner: 'myorg', repo: 'myrepo' } }
|
|
@@ -399,7 +399,7 @@ export type IntegrationsModule = {
|
|
|
399
399
|
*
|
|
400
400
|
* @example **Use Core integrations**
|
|
401
401
|
* ```typescript
|
|
402
|
-
* const response = await
|
|
402
|
+
* const response = await doany.integrations.Core.InvokeLLM({
|
|
403
403
|
* prompt: 'Explain quantum computing',
|
|
404
404
|
* model: 'gpt_5'
|
|
405
405
|
* });
|
|
@@ -407,7 +407,7 @@ export type IntegrationsModule = {
|
|
|
407
407
|
*
|
|
408
408
|
* @example **Use custom integrations**
|
|
409
409
|
* ```typescript
|
|
410
|
-
* const result = await
|
|
410
|
+
* const result = await doany.integrations.custom.call(
|
|
411
411
|
* 'github',
|
|
412
412
|
* 'get:/repos/{owner}/{repo}',
|
|
413
413
|
* { pathParams: { owner: 'myorg', repo: 'myrepo' } }
|
package/dist/modules/sso.d.ts
CHANGED
package/dist/modules/sso.js
CHANGED
|
@@ -9,7 +9,7 @@ export interface SsoAccessTokenResponse {
|
|
|
9
9
|
* SSO (Single Sign-On) module for managing SSO authentication.
|
|
10
10
|
*
|
|
11
11
|
* This module provides methods for retrieving SSO tokens for users. These
|
|
12
|
-
* tokens allow you to authenticate
|
|
12
|
+
* tokens allow you to authenticate Doany users with external systems or
|
|
13
13
|
* services.
|
|
14
14
|
*
|
|
15
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.
|
|
@@ -19,7 +19,7 @@ export interface SsoAccessTokenResponse {
|
|
|
19
19
|
* @example
|
|
20
20
|
* ```typescript
|
|
21
21
|
* // Access SSO module with service role
|
|
22
|
-
* const response = await
|
|
22
|
+
* const response = await doany.asServiceRole.sso.getAccessToken('user_123');
|
|
23
23
|
* console.log(response.data.access_token);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
@@ -36,7 +36,7 @@ export interface SsoModule {
|
|
|
36
36
|
* @example
|
|
37
37
|
* ```typescript
|
|
38
38
|
* // Get SSO access token for a user
|
|
39
|
-
* const response = await
|
|
39
|
+
* const response = await doany.asServiceRole.sso.getAccessToken('user_123');
|
|
40
40
|
* console.log(response.access_token);
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
@@ -53,12 +53,12 @@ export interface SsoModule {
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```typescript
|
|
56
|
-
* import { createClientFromRequest } from 'npm:@
|
|
56
|
+
* import { createClientFromRequest } from 'npm:@doany/sdk';
|
|
57
57
|
*
|
|
58
58
|
* Deno.serve(async (req) => {
|
|
59
|
-
* const
|
|
60
|
-
* const user = await
|
|
61
|
-
* const idToken = await
|
|
59
|
+
* const doany = createClientFromRequest(req);
|
|
60
|
+
* const user = await doany.auth.me();
|
|
61
|
+
* const idToken = await doany.asServiceRole.sso.getIdToken(user.id);
|
|
62
62
|
*
|
|
63
63
|
* return Response.json({ idToken });
|
|
64
64
|
* });
|
package/dist/modules/users.d.ts
CHANGED
package/dist/modules/users.js
CHANGED