@baasix/sdk 0.1.5 → 0.1.7
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/README.md +176 -2
- package/dist/index.cjs +255 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +243 -0
- package/dist/index.d.ts +243 -0
- package/dist/index.js +255 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/auth.cjs +1 -1
- package/dist/modules/auth.cjs.map +1 -1
- package/dist/modules/auth.js +1 -1
- package/dist/modules/auth.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -365,6 +365,43 @@ declare class PermissionsModule {
|
|
|
365
365
|
* ```
|
|
366
366
|
*/
|
|
367
367
|
reloadCache(): Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* Export all permissions (admin only)
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* const exported = await baasix.permissions.export();
|
|
374
|
+
* // Save to file or transfer
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
export(): Promise<{
|
|
378
|
+
permissions: Permission[];
|
|
379
|
+
exportedAt: string;
|
|
380
|
+
version: string;
|
|
381
|
+
}>;
|
|
382
|
+
/**
|
|
383
|
+
* Import permissions from exported data (admin only)
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```typescript
|
|
387
|
+
* const result = await baasix.permissions.import(exportedData, {
|
|
388
|
+
* overwrite: true
|
|
389
|
+
* });
|
|
390
|
+
* console.log('Imported:', result.imported, 'permissions');
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
import(data: {
|
|
394
|
+
permissions: Array<Partial<Permission>>;
|
|
395
|
+
}, options?: {
|
|
396
|
+
overwrite?: boolean;
|
|
397
|
+
}): Promise<{
|
|
398
|
+
imported: number;
|
|
399
|
+
skipped: number;
|
|
400
|
+
errors: Array<{
|
|
401
|
+
permission: Partial<Permission>;
|
|
402
|
+
error: string;
|
|
403
|
+
}>;
|
|
404
|
+
}>;
|
|
368
405
|
}
|
|
369
406
|
|
|
370
407
|
interface SettingsModuleConfig {
|
|
@@ -432,6 +469,55 @@ declare class SettingsModule {
|
|
|
432
469
|
* ```
|
|
433
470
|
*/
|
|
434
471
|
set<T>(key: string, value: T): Promise<Settings>;
|
|
472
|
+
/**
|
|
473
|
+
* Get settings by application URL (useful for multi-tenant apps)
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* const settings = await baasix.settings.getByAppUrl('https://myapp.example.com');
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
getByAppUrl(appUrl: string): Promise<Settings>;
|
|
481
|
+
/**
|
|
482
|
+
* Get email branding settings for the current tenant
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* const branding = await baasix.settings.getBranding();
|
|
487
|
+
* console.log(branding.logo, branding.primaryColor);
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
getBranding(): Promise<Record<string, unknown>>;
|
|
491
|
+
/**
|
|
492
|
+
* Test email configuration by sending a test email
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* ```typescript
|
|
496
|
+
* await baasix.settings.testEmail('admin@example.com');
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
testEmail(to: string): Promise<{
|
|
500
|
+
success: boolean;
|
|
501
|
+
message?: string;
|
|
502
|
+
}>;
|
|
503
|
+
/**
|
|
504
|
+
* Reload settings cache (admin only)
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```typescript
|
|
508
|
+
* await baasix.settings.reload();
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
reload(): Promise<void>;
|
|
512
|
+
/**
|
|
513
|
+
* Delete tenant settings (admin only, multi-tenant)
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```typescript
|
|
517
|
+
* await baasix.settings.deleteTenant();
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
deleteTenant(): Promise<void>;
|
|
435
521
|
}
|
|
436
522
|
|
|
437
523
|
interface ReportsModuleConfig {
|
|
@@ -771,6 +857,163 @@ declare class WorkflowsModule {
|
|
|
771
857
|
* ```
|
|
772
858
|
*/
|
|
773
859
|
duplicate(id: string, overrides?: Partial<Omit<Workflow, "id" | "createdAt" | "updatedAt">>): Promise<Workflow>;
|
|
860
|
+
/**
|
|
861
|
+
* Execute a specific node in a workflow
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* ```typescript
|
|
865
|
+
* const result = await baasix.workflows.executeNode(
|
|
866
|
+
* 'workflow-uuid',
|
|
867
|
+
* 'node-id',
|
|
868
|
+
* { inputData: 'value' }
|
|
869
|
+
* );
|
|
870
|
+
* ```
|
|
871
|
+
*/
|
|
872
|
+
executeNode(workflowId: string, nodeId: string, triggerData?: Record<string, unknown>): Promise<WorkflowExecution>;
|
|
873
|
+
/**
|
|
874
|
+
* Get execution logs for a specific execution
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* ```typescript
|
|
878
|
+
* const logs = await baasix.workflows.getExecutionLogs(
|
|
879
|
+
* 'workflow-uuid',
|
|
880
|
+
* 'execution-uuid'
|
|
881
|
+
* );
|
|
882
|
+
* ```
|
|
883
|
+
*/
|
|
884
|
+
getExecutionLogs(workflowId: string, executionId: string): Promise<Array<{
|
|
885
|
+
timestamp: string;
|
|
886
|
+
level: string;
|
|
887
|
+
message: string;
|
|
888
|
+
nodeId?: string;
|
|
889
|
+
}>>;
|
|
890
|
+
/**
|
|
891
|
+
* Get workflow statistics
|
|
892
|
+
*
|
|
893
|
+
* @example
|
|
894
|
+
* ```typescript
|
|
895
|
+
* const stats = await baasix.workflows.getStats('workflow-uuid');
|
|
896
|
+
* console.log(stats.totalExecutions, stats.successRate);
|
|
897
|
+
* ```
|
|
898
|
+
*/
|
|
899
|
+
getStats(id: string): Promise<{
|
|
900
|
+
totalExecutions: number;
|
|
901
|
+
successCount: number;
|
|
902
|
+
failedCount: number;
|
|
903
|
+
successRate: number;
|
|
904
|
+
avgExecutionTime: number;
|
|
905
|
+
}>;
|
|
906
|
+
/**
|
|
907
|
+
* Validate a workflow definition
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* ```typescript
|
|
911
|
+
* const result = await baasix.workflows.validate({
|
|
912
|
+
* name: 'My Workflow',
|
|
913
|
+
* nodes: [...],
|
|
914
|
+
* edges: [...]
|
|
915
|
+
* });
|
|
916
|
+
* if (result.valid) {
|
|
917
|
+
* console.log('Workflow is valid');
|
|
918
|
+
* } else {
|
|
919
|
+
* console.log('Errors:', result.errors);
|
|
920
|
+
* }
|
|
921
|
+
* ```
|
|
922
|
+
*/
|
|
923
|
+
validate(workflow: Partial<Workflow>): Promise<{
|
|
924
|
+
valid: boolean;
|
|
925
|
+
errors?: Array<{
|
|
926
|
+
path: string;
|
|
927
|
+
message: string;
|
|
928
|
+
}>;
|
|
929
|
+
}>;
|
|
930
|
+
/**
|
|
931
|
+
* Export a single workflow
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```typescript
|
|
935
|
+
* const exported = await baasix.workflows.export('workflow-uuid');
|
|
936
|
+
* // Save to file or transfer
|
|
937
|
+
* ```
|
|
938
|
+
*/
|
|
939
|
+
export(id: string): Promise<Workflow & {
|
|
940
|
+
exportedAt: string;
|
|
941
|
+
version: string;
|
|
942
|
+
}>;
|
|
943
|
+
/**
|
|
944
|
+
* Export multiple workflows
|
|
945
|
+
*
|
|
946
|
+
* @example
|
|
947
|
+
* ```typescript
|
|
948
|
+
* // Export all workflows
|
|
949
|
+
* const exported = await baasix.workflows.exportAll();
|
|
950
|
+
*
|
|
951
|
+
* // Export specific workflows
|
|
952
|
+
* const exported = await baasix.workflows.exportAll({
|
|
953
|
+
* ids: ['workflow-1', 'workflow-2']
|
|
954
|
+
* });
|
|
955
|
+
* ```
|
|
956
|
+
*/
|
|
957
|
+
exportAll(options?: {
|
|
958
|
+
ids?: string[];
|
|
959
|
+
includeInactive?: boolean;
|
|
960
|
+
}): Promise<{
|
|
961
|
+
workflows: Array<Workflow & {
|
|
962
|
+
exportedAt: string;
|
|
963
|
+
}>;
|
|
964
|
+
exportedAt: string;
|
|
965
|
+
version: string;
|
|
966
|
+
}>;
|
|
967
|
+
/**
|
|
968
|
+
* Preview workflow import without applying changes
|
|
969
|
+
*
|
|
970
|
+
* @example
|
|
971
|
+
* ```typescript
|
|
972
|
+
* const preview = await baasix.workflows.importPreview(file);
|
|
973
|
+
* console.log('Will import:', preview.workflows.length, 'workflows');
|
|
974
|
+
* console.log('Conflicts:', preview.conflicts);
|
|
975
|
+
* ```
|
|
976
|
+
*/
|
|
977
|
+
importPreview(file: File | {
|
|
978
|
+
uri: string;
|
|
979
|
+
name: string;
|
|
980
|
+
type: string;
|
|
981
|
+
}): Promise<{
|
|
982
|
+
workflows: Array<{
|
|
983
|
+
name: string;
|
|
984
|
+
id?: string;
|
|
985
|
+
isNew: boolean;
|
|
986
|
+
}>;
|
|
987
|
+
conflicts: Array<{
|
|
988
|
+
name: string;
|
|
989
|
+
existingId: string;
|
|
990
|
+
}>;
|
|
991
|
+
}>;
|
|
992
|
+
/**
|
|
993
|
+
* Import workflows from a file
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* ```typescript
|
|
997
|
+
* const result = await baasix.workflows.import(file, {
|
|
998
|
+
* overwrite: true
|
|
999
|
+
* });
|
|
1000
|
+
* console.log('Imported:', result.imported, 'workflows');
|
|
1001
|
+
* ```
|
|
1002
|
+
*/
|
|
1003
|
+
import(file: File | {
|
|
1004
|
+
uri: string;
|
|
1005
|
+
name: string;
|
|
1006
|
+
type: string;
|
|
1007
|
+
}, options?: {
|
|
1008
|
+
overwrite?: boolean;
|
|
1009
|
+
}): Promise<{
|
|
1010
|
+
imported: number;
|
|
1011
|
+
skipped: number;
|
|
1012
|
+
errors: Array<{
|
|
1013
|
+
name: string;
|
|
1014
|
+
error: string;
|
|
1015
|
+
}>;
|
|
1016
|
+
}>;
|
|
774
1017
|
}
|
|
775
1018
|
|
|
776
1019
|
interface SocketOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -365,6 +365,43 @@ declare class PermissionsModule {
|
|
|
365
365
|
* ```
|
|
366
366
|
*/
|
|
367
367
|
reloadCache(): Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* Export all permissions (admin only)
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* const exported = await baasix.permissions.export();
|
|
374
|
+
* // Save to file or transfer
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
export(): Promise<{
|
|
378
|
+
permissions: Permission[];
|
|
379
|
+
exportedAt: string;
|
|
380
|
+
version: string;
|
|
381
|
+
}>;
|
|
382
|
+
/**
|
|
383
|
+
* Import permissions from exported data (admin only)
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```typescript
|
|
387
|
+
* const result = await baasix.permissions.import(exportedData, {
|
|
388
|
+
* overwrite: true
|
|
389
|
+
* });
|
|
390
|
+
* console.log('Imported:', result.imported, 'permissions');
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
import(data: {
|
|
394
|
+
permissions: Array<Partial<Permission>>;
|
|
395
|
+
}, options?: {
|
|
396
|
+
overwrite?: boolean;
|
|
397
|
+
}): Promise<{
|
|
398
|
+
imported: number;
|
|
399
|
+
skipped: number;
|
|
400
|
+
errors: Array<{
|
|
401
|
+
permission: Partial<Permission>;
|
|
402
|
+
error: string;
|
|
403
|
+
}>;
|
|
404
|
+
}>;
|
|
368
405
|
}
|
|
369
406
|
|
|
370
407
|
interface SettingsModuleConfig {
|
|
@@ -432,6 +469,55 @@ declare class SettingsModule {
|
|
|
432
469
|
* ```
|
|
433
470
|
*/
|
|
434
471
|
set<T>(key: string, value: T): Promise<Settings>;
|
|
472
|
+
/**
|
|
473
|
+
* Get settings by application URL (useful for multi-tenant apps)
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* const settings = await baasix.settings.getByAppUrl('https://myapp.example.com');
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
getByAppUrl(appUrl: string): Promise<Settings>;
|
|
481
|
+
/**
|
|
482
|
+
* Get email branding settings for the current tenant
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* const branding = await baasix.settings.getBranding();
|
|
487
|
+
* console.log(branding.logo, branding.primaryColor);
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
getBranding(): Promise<Record<string, unknown>>;
|
|
491
|
+
/**
|
|
492
|
+
* Test email configuration by sending a test email
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* ```typescript
|
|
496
|
+
* await baasix.settings.testEmail('admin@example.com');
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
testEmail(to: string): Promise<{
|
|
500
|
+
success: boolean;
|
|
501
|
+
message?: string;
|
|
502
|
+
}>;
|
|
503
|
+
/**
|
|
504
|
+
* Reload settings cache (admin only)
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```typescript
|
|
508
|
+
* await baasix.settings.reload();
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
reload(): Promise<void>;
|
|
512
|
+
/**
|
|
513
|
+
* Delete tenant settings (admin only, multi-tenant)
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```typescript
|
|
517
|
+
* await baasix.settings.deleteTenant();
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
deleteTenant(): Promise<void>;
|
|
435
521
|
}
|
|
436
522
|
|
|
437
523
|
interface ReportsModuleConfig {
|
|
@@ -771,6 +857,163 @@ declare class WorkflowsModule {
|
|
|
771
857
|
* ```
|
|
772
858
|
*/
|
|
773
859
|
duplicate(id: string, overrides?: Partial<Omit<Workflow, "id" | "createdAt" | "updatedAt">>): Promise<Workflow>;
|
|
860
|
+
/**
|
|
861
|
+
* Execute a specific node in a workflow
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* ```typescript
|
|
865
|
+
* const result = await baasix.workflows.executeNode(
|
|
866
|
+
* 'workflow-uuid',
|
|
867
|
+
* 'node-id',
|
|
868
|
+
* { inputData: 'value' }
|
|
869
|
+
* );
|
|
870
|
+
* ```
|
|
871
|
+
*/
|
|
872
|
+
executeNode(workflowId: string, nodeId: string, triggerData?: Record<string, unknown>): Promise<WorkflowExecution>;
|
|
873
|
+
/**
|
|
874
|
+
* Get execution logs for a specific execution
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* ```typescript
|
|
878
|
+
* const logs = await baasix.workflows.getExecutionLogs(
|
|
879
|
+
* 'workflow-uuid',
|
|
880
|
+
* 'execution-uuid'
|
|
881
|
+
* );
|
|
882
|
+
* ```
|
|
883
|
+
*/
|
|
884
|
+
getExecutionLogs(workflowId: string, executionId: string): Promise<Array<{
|
|
885
|
+
timestamp: string;
|
|
886
|
+
level: string;
|
|
887
|
+
message: string;
|
|
888
|
+
nodeId?: string;
|
|
889
|
+
}>>;
|
|
890
|
+
/**
|
|
891
|
+
* Get workflow statistics
|
|
892
|
+
*
|
|
893
|
+
* @example
|
|
894
|
+
* ```typescript
|
|
895
|
+
* const stats = await baasix.workflows.getStats('workflow-uuid');
|
|
896
|
+
* console.log(stats.totalExecutions, stats.successRate);
|
|
897
|
+
* ```
|
|
898
|
+
*/
|
|
899
|
+
getStats(id: string): Promise<{
|
|
900
|
+
totalExecutions: number;
|
|
901
|
+
successCount: number;
|
|
902
|
+
failedCount: number;
|
|
903
|
+
successRate: number;
|
|
904
|
+
avgExecutionTime: number;
|
|
905
|
+
}>;
|
|
906
|
+
/**
|
|
907
|
+
* Validate a workflow definition
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* ```typescript
|
|
911
|
+
* const result = await baasix.workflows.validate({
|
|
912
|
+
* name: 'My Workflow',
|
|
913
|
+
* nodes: [...],
|
|
914
|
+
* edges: [...]
|
|
915
|
+
* });
|
|
916
|
+
* if (result.valid) {
|
|
917
|
+
* console.log('Workflow is valid');
|
|
918
|
+
* } else {
|
|
919
|
+
* console.log('Errors:', result.errors);
|
|
920
|
+
* }
|
|
921
|
+
* ```
|
|
922
|
+
*/
|
|
923
|
+
validate(workflow: Partial<Workflow>): Promise<{
|
|
924
|
+
valid: boolean;
|
|
925
|
+
errors?: Array<{
|
|
926
|
+
path: string;
|
|
927
|
+
message: string;
|
|
928
|
+
}>;
|
|
929
|
+
}>;
|
|
930
|
+
/**
|
|
931
|
+
* Export a single workflow
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```typescript
|
|
935
|
+
* const exported = await baasix.workflows.export('workflow-uuid');
|
|
936
|
+
* // Save to file or transfer
|
|
937
|
+
* ```
|
|
938
|
+
*/
|
|
939
|
+
export(id: string): Promise<Workflow & {
|
|
940
|
+
exportedAt: string;
|
|
941
|
+
version: string;
|
|
942
|
+
}>;
|
|
943
|
+
/**
|
|
944
|
+
* Export multiple workflows
|
|
945
|
+
*
|
|
946
|
+
* @example
|
|
947
|
+
* ```typescript
|
|
948
|
+
* // Export all workflows
|
|
949
|
+
* const exported = await baasix.workflows.exportAll();
|
|
950
|
+
*
|
|
951
|
+
* // Export specific workflows
|
|
952
|
+
* const exported = await baasix.workflows.exportAll({
|
|
953
|
+
* ids: ['workflow-1', 'workflow-2']
|
|
954
|
+
* });
|
|
955
|
+
* ```
|
|
956
|
+
*/
|
|
957
|
+
exportAll(options?: {
|
|
958
|
+
ids?: string[];
|
|
959
|
+
includeInactive?: boolean;
|
|
960
|
+
}): Promise<{
|
|
961
|
+
workflows: Array<Workflow & {
|
|
962
|
+
exportedAt: string;
|
|
963
|
+
}>;
|
|
964
|
+
exportedAt: string;
|
|
965
|
+
version: string;
|
|
966
|
+
}>;
|
|
967
|
+
/**
|
|
968
|
+
* Preview workflow import without applying changes
|
|
969
|
+
*
|
|
970
|
+
* @example
|
|
971
|
+
* ```typescript
|
|
972
|
+
* const preview = await baasix.workflows.importPreview(file);
|
|
973
|
+
* console.log('Will import:', preview.workflows.length, 'workflows');
|
|
974
|
+
* console.log('Conflicts:', preview.conflicts);
|
|
975
|
+
* ```
|
|
976
|
+
*/
|
|
977
|
+
importPreview(file: File | {
|
|
978
|
+
uri: string;
|
|
979
|
+
name: string;
|
|
980
|
+
type: string;
|
|
981
|
+
}): Promise<{
|
|
982
|
+
workflows: Array<{
|
|
983
|
+
name: string;
|
|
984
|
+
id?: string;
|
|
985
|
+
isNew: boolean;
|
|
986
|
+
}>;
|
|
987
|
+
conflicts: Array<{
|
|
988
|
+
name: string;
|
|
989
|
+
existingId: string;
|
|
990
|
+
}>;
|
|
991
|
+
}>;
|
|
992
|
+
/**
|
|
993
|
+
* Import workflows from a file
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* ```typescript
|
|
997
|
+
* const result = await baasix.workflows.import(file, {
|
|
998
|
+
* overwrite: true
|
|
999
|
+
* });
|
|
1000
|
+
* console.log('Imported:', result.imported, 'workflows');
|
|
1001
|
+
* ```
|
|
1002
|
+
*/
|
|
1003
|
+
import(file: File | {
|
|
1004
|
+
uri: string;
|
|
1005
|
+
name: string;
|
|
1006
|
+
type: string;
|
|
1007
|
+
}, options?: {
|
|
1008
|
+
overwrite?: boolean;
|
|
1009
|
+
}): Promise<{
|
|
1010
|
+
imported: number;
|
|
1011
|
+
skipped: number;
|
|
1012
|
+
errors: Array<{
|
|
1013
|
+
name: string;
|
|
1014
|
+
error: string;
|
|
1015
|
+
}>;
|
|
1016
|
+
}>;
|
|
774
1017
|
}
|
|
775
1018
|
|
|
776
1019
|
interface SocketOptions {
|