@baasix/sdk 0.1.6 → 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/dist/index.js CHANGED
@@ -2582,6 +2582,37 @@ var PermissionsModule = class {
2582
2582
  async reloadCache() {
2583
2583
  await this.client.post("/permissions/reload");
2584
2584
  }
2585
+ /**
2586
+ * Export all permissions (admin only)
2587
+ *
2588
+ * @example
2589
+ * ```typescript
2590
+ * const exported = await baasix.permissions.export();
2591
+ * // Save to file or transfer
2592
+ * ```
2593
+ */
2594
+ async export() {
2595
+ const response = await this.client.post("/permissions-export", {});
2596
+ return response.data;
2597
+ }
2598
+ /**
2599
+ * Import permissions from exported data (admin only)
2600
+ *
2601
+ * @example
2602
+ * ```typescript
2603
+ * const result = await baasix.permissions.import(exportedData, {
2604
+ * overwrite: true
2605
+ * });
2606
+ * console.log('Imported:', result.imported, 'permissions');
2607
+ * ```
2608
+ */
2609
+ async import(data, options) {
2610
+ const response = await this.client.post("/permissions-import", {
2611
+ ...data,
2612
+ ...options
2613
+ });
2614
+ return response.data;
2615
+ }
2585
2616
  };
2586
2617
 
2587
2618
  // src/modules/settings.ts
@@ -2648,6 +2679,73 @@ var SettingsModule = class {
2648
2679
  async set(key, value) {
2649
2680
  return this.update({ [key]: value });
2650
2681
  }
2682
+ /**
2683
+ * Get settings by application URL (useful for multi-tenant apps)
2684
+ *
2685
+ * @example
2686
+ * ```typescript
2687
+ * const settings = await baasix.settings.getByAppUrl('https://myapp.example.com');
2688
+ * ```
2689
+ */
2690
+ async getByAppUrl(appUrl) {
2691
+ const response = await this.client.get(
2692
+ "/settings/by-app-url",
2693
+ { params: { appUrl } }
2694
+ );
2695
+ return response.data;
2696
+ }
2697
+ /**
2698
+ * Get email branding settings for the current tenant
2699
+ *
2700
+ * @example
2701
+ * ```typescript
2702
+ * const branding = await baasix.settings.getBranding();
2703
+ * console.log(branding.logo, branding.primaryColor);
2704
+ * ```
2705
+ */
2706
+ async getBranding() {
2707
+ const response = await this.client.get(
2708
+ "/settings/branding"
2709
+ );
2710
+ return response.data;
2711
+ }
2712
+ /**
2713
+ * Test email configuration by sending a test email
2714
+ *
2715
+ * @example
2716
+ * ```typescript
2717
+ * await baasix.settings.testEmail('admin@example.com');
2718
+ * ```
2719
+ */
2720
+ async testEmail(to) {
2721
+ const response = await this.client.post(
2722
+ "/settings/test-email",
2723
+ { to }
2724
+ );
2725
+ return response;
2726
+ }
2727
+ /**
2728
+ * Reload settings cache (admin only)
2729
+ *
2730
+ * @example
2731
+ * ```typescript
2732
+ * await baasix.settings.reload();
2733
+ * ```
2734
+ */
2735
+ async reload() {
2736
+ await this.client.post("/settings/reload");
2737
+ }
2738
+ /**
2739
+ * Delete tenant settings (admin only, multi-tenant)
2740
+ *
2741
+ * @example
2742
+ * ```typescript
2743
+ * await baasix.settings.deleteTenant();
2744
+ * ```
2745
+ */
2746
+ async deleteTenant() {
2747
+ await this.client.delete("/settings/tenant");
2748
+ }
2651
2749
  };
2652
2750
 
2653
2751
  // src/modules/reports.ts
@@ -3025,6 +3123,159 @@ var WorkflowsModule = class {
3025
3123
  ...overrides
3026
3124
  });
3027
3125
  }
3126
+ /**
3127
+ * Execute a specific node in a workflow
3128
+ *
3129
+ * @example
3130
+ * ```typescript
3131
+ * const result = await baasix.workflows.executeNode(
3132
+ * 'workflow-uuid',
3133
+ * 'node-id',
3134
+ * { inputData: 'value' }
3135
+ * );
3136
+ * ```
3137
+ */
3138
+ async executeNode(workflowId, nodeId, triggerData) {
3139
+ const response = await this.client.post(
3140
+ `/workflows/${workflowId}/nodes/${nodeId}/execute`,
3141
+ { triggerData }
3142
+ );
3143
+ return response.data;
3144
+ }
3145
+ /**
3146
+ * Get execution logs for a specific execution
3147
+ *
3148
+ * @example
3149
+ * ```typescript
3150
+ * const logs = await baasix.workflows.getExecutionLogs(
3151
+ * 'workflow-uuid',
3152
+ * 'execution-uuid'
3153
+ * );
3154
+ * ```
3155
+ */
3156
+ async getExecutionLogs(workflowId, executionId) {
3157
+ const response = await this.client.get(
3158
+ `/workflows/${workflowId}/executions/${executionId}/logs`
3159
+ );
3160
+ return response.data;
3161
+ }
3162
+ /**
3163
+ * Get workflow statistics
3164
+ *
3165
+ * @example
3166
+ * ```typescript
3167
+ * const stats = await baasix.workflows.getStats('workflow-uuid');
3168
+ * console.log(stats.totalExecutions, stats.successRate);
3169
+ * ```
3170
+ */
3171
+ async getStats(id) {
3172
+ const response = await this.client.get(`/workflows/${id}/stats`);
3173
+ return response.data;
3174
+ }
3175
+ /**
3176
+ * Validate a workflow definition
3177
+ *
3178
+ * @example
3179
+ * ```typescript
3180
+ * const result = await baasix.workflows.validate({
3181
+ * name: 'My Workflow',
3182
+ * nodes: [...],
3183
+ * edges: [...]
3184
+ * });
3185
+ * if (result.valid) {
3186
+ * console.log('Workflow is valid');
3187
+ * } else {
3188
+ * console.log('Errors:', result.errors);
3189
+ * }
3190
+ * ```
3191
+ */
3192
+ async validate(workflow) {
3193
+ const response = await this.client.post(
3194
+ "/workflows/validate",
3195
+ workflow
3196
+ );
3197
+ return response;
3198
+ }
3199
+ /**
3200
+ * Export a single workflow
3201
+ *
3202
+ * @example
3203
+ * ```typescript
3204
+ * const exported = await baasix.workflows.export('workflow-uuid');
3205
+ * // Save to file or transfer
3206
+ * ```
3207
+ */
3208
+ async export(id) {
3209
+ const response = await this.client.get(
3210
+ `/workflows/${id}/export`
3211
+ );
3212
+ return response.data;
3213
+ }
3214
+ /**
3215
+ * Export multiple workflows
3216
+ *
3217
+ * @example
3218
+ * ```typescript
3219
+ * // Export all workflows
3220
+ * const exported = await baasix.workflows.exportAll();
3221
+ *
3222
+ * // Export specific workflows
3223
+ * const exported = await baasix.workflows.exportAll({
3224
+ * ids: ['workflow-1', 'workflow-2']
3225
+ * });
3226
+ * ```
3227
+ */
3228
+ async exportAll(options) {
3229
+ const response = await this.client.post(
3230
+ "/workflows/export",
3231
+ options || {}
3232
+ );
3233
+ return response.data;
3234
+ }
3235
+ /**
3236
+ * Preview workflow import without applying changes
3237
+ *
3238
+ * @example
3239
+ * ```typescript
3240
+ * const preview = await baasix.workflows.importPreview(file);
3241
+ * console.log('Will import:', preview.workflows.length, 'workflows');
3242
+ * console.log('Conflicts:', preview.conflicts);
3243
+ * ```
3244
+ */
3245
+ async importPreview(file) {
3246
+ const formData = new FormData();
3247
+ if (file instanceof File) {
3248
+ formData.append("file", file);
3249
+ } else {
3250
+ formData.append("file", file);
3251
+ }
3252
+ const response = await this.client.post("/workflows/import/preview", formData);
3253
+ return response.data;
3254
+ }
3255
+ /**
3256
+ * Import workflows from a file
3257
+ *
3258
+ * @example
3259
+ * ```typescript
3260
+ * const result = await baasix.workflows.import(file, {
3261
+ * overwrite: true
3262
+ * });
3263
+ * console.log('Imported:', result.imported, 'workflows');
3264
+ * ```
3265
+ */
3266
+ async import(file, options) {
3267
+ const formData = new FormData();
3268
+ if (file instanceof File) {
3269
+ formData.append("file", file);
3270
+ } else {
3271
+ formData.append("file", file);
3272
+ }
3273
+ if (options?.overwrite !== void 0) {
3274
+ formData.append("overwrite", String(options.overwrite));
3275
+ }
3276
+ const response = await this.client.post("/workflows/import", formData);
3277
+ return response.data;
3278
+ }
3028
3279
  };
3029
3280
 
3030
3281
  // src/modules/realtime.ts