@tspvivek/baasix-sdk 0.1.0-alpha.1 → 0.1.0-alpha.2

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 CHANGED
@@ -20,6 +20,9 @@ Official JavaScript/TypeScript SDK for [Baasix](https://www.baasix.com) Backend-
20
20
  - 🔀 **Workflows** - Execute and monitor workflow executions
21
21
  - 👥 **User & Role Management** - Admin operations for users and roles
22
22
  - 📊 **Reports** - Generate reports with aggregations
23
+ - 🔔 **Notifications** - User notification system with realtime delivery
24
+ - 🗃️ **Migrations** - Database schema migration management
25
+ - 🔃 **Sort/Reorder** - Drag-and-drop style item reordering
23
26
 
24
27
  ## Installation
25
28
 
@@ -716,22 +719,36 @@ await baasix.roles.update(roleId, { description: 'Updated description' });
716
719
 
717
720
  ```typescript
718
721
  // Import from CSV file
719
- const result = await baasix.items('products').importCSV(csvFile, {
720
- delimiter: ',',
721
- skipFirstRow: true,
722
- });
723
- console.log(`Created: ${result.created}, Errors: ${result.errors.length}`);
722
+ const result = await baasix.items('products').importCSV(csvFile);
723
+ console.log(`Imported: ${result.imported}, Failed: ${result.failed}`);
724
724
 
725
725
  // Import from JSON file
726
726
  const result = await baasix.items('products').importJSON(jsonFile);
727
727
 
728
- // Import from data array
729
- const result = await baasix.items('products').importData([
728
+ // Bulk create from data array
729
+ const ids = await baasix.items('products').createMany([
730
730
  { name: 'Product 1', price: 29.99 },
731
731
  { name: 'Product 2', price: 39.99 },
732
732
  ]);
733
733
  ```
734
734
 
735
+ ## Sort / Reorder Items
736
+
737
+ ```typescript
738
+ // Move item1 before item2
739
+ await baasix.items('products').sortItem('item1-uuid', 'item2-uuid');
740
+
741
+ // Move item1 after item2
742
+ await baasix.items('products').sortItem('item1-uuid', 'item2-uuid', 'after');
743
+
744
+ // Reorder multiple items (set explicit order)
745
+ await baasix.items('products').reorder([
746
+ 'item3-uuid',
747
+ 'item1-uuid',
748
+ 'item2-uuid'
749
+ ]);
750
+ ```
751
+
735
752
  ## Migrations (Admin)
736
753
 
737
754
  ```typescript
@@ -739,31 +756,66 @@ const result = await baasix.items('products').importData([
739
756
  const status = await baasix.migrations.status();
740
757
  console.log(`Pending: ${status.pendingCount}`);
741
758
 
759
+ // Get pending migrations
760
+ const pending = await baasix.migrations.pending();
761
+
742
762
  // Run pending migrations
743
- if (status.hasPending) {
744
- const result = await baasix.migrations.run();
745
- console.log(`Ran ${result.migrationsRun.length} migrations`);
746
- }
763
+ const result = await baasix.migrations.run();
764
+ console.log(`Completed: ${result.summary.completed}`);
765
+
766
+ // Run with options
767
+ const result = await baasix.migrations.run({
768
+ step: 1, // Run only 1 migration
769
+ dryRun: true, // Preview without executing
770
+ });
771
+
772
+ // Rollback a specific migration
773
+ await baasix.migrations.rollback('20231201000000');
747
774
 
748
775
  // Rollback last batch
749
- const rollback = await baasix.migrations.rollbackLast();
776
+ await baasix.migrations.rollbackBatch();
777
+
778
+ // Create new migration file
779
+ const { filepath } = await baasix.migrations.create('add_status_column', {
780
+ type: 'schema',
781
+ description: 'Add status column to orders',
782
+ });
783
+
784
+ // Mark migrations as completed (without running)
785
+ await baasix.migrations.markCompleted('20231201000000');
786
+ await baasix.migrations.markAllCompleted();
750
787
  ```
751
788
 
752
789
  ## Notifications
753
790
 
754
791
  ```typescript
755
- // Get notifications
792
+ // Get user notifications
756
793
  const { data } = await baasix.notifications.find({
757
794
  limit: 20,
758
- seen: false,
795
+ filter: { seen: { eq: false } },
759
796
  });
760
797
 
761
- // Mark as seen
762
- await baasix.notifications.markAsSeen('notification-uuid');
763
- await baasix.notifications.markAllSeen();
764
-
765
798
  // Get unread count
766
799
  const count = await baasix.notifications.getUnreadCount();
800
+
801
+ // Mark notifications as seen
802
+ await baasix.notifications.markAsSeen(['id1', 'id2']);
803
+ // Or mark all as seen
804
+ await baasix.notifications.markAsSeen();
805
+
806
+ // Delete notifications
807
+ await baasix.notifications.delete(['id1', 'id2']);
808
+
809
+ // Send notification (admin only)
810
+ await baasix.notifications.send({
811
+ type: 'alert',
812
+ title: 'System Update',
813
+ message: 'Maintenance scheduled for tonight',
814
+ userIds: ['user1-uuid', 'user2-uuid'],
815
+ });
816
+
817
+ // Cleanup old notifications (admin only)
818
+ await baasix.notifications.cleanup(30); // older than 30 days
767
819
  ```
768
820
 
769
821
  ## Custom Storage Adapter
package/dist/index.cjs CHANGED
@@ -1607,38 +1607,23 @@ var ItemsModule = class {
1607
1607
  * const fileInput = document.querySelector('input[type="file"]');
1608
1608
  * const file = fileInput.files[0];
1609
1609
  *
1610
- * const result = await baasix.items('products').importCSV(file, {
1611
- * delimiter: ',',
1612
- * skipFirstRow: true
1613
- * });
1610
+ * const result = await baasix.items('products').importCSV(file);
1614
1611
  *
1615
- * console.log(`Imported ${result.created} items`);
1612
+ * console.log(`Imported ${result.imported} items`);
1616
1613
  * ```
1617
1614
  */
1618
- async importCSV(file, options) {
1615
+ async importCSV(file) {
1619
1616
  const formData = new FormData();
1620
1617
  if (file instanceof File) {
1621
- formData.append("file", file);
1618
+ formData.append("csvFile", file);
1622
1619
  } else {
1623
- formData.append("file", file);
1624
- }
1625
- if (options?.delimiter) {
1626
- formData.append("delimiter", options.delimiter);
1627
- }
1628
- if (options?.skipFirstRow !== void 0) {
1629
- formData.append("skipFirstRow", String(options.skipFirstRow));
1630
- }
1631
- if (options?.dateFormat) {
1632
- formData.append("dateFormat", options.dateFormat);
1633
- }
1634
- if (options?.fieldMapping) {
1635
- formData.append("fieldMapping", JSON.stringify(options.fieldMapping));
1620
+ formData.append("csvFile", file);
1636
1621
  }
1637
1622
  const response = await this.client.post(
1638
- `/items/${this.collection}/import/csv`,
1623
+ `/items/${this.collection}/import-csv`,
1639
1624
  formData
1640
1625
  );
1641
- return response.data;
1626
+ return response.results;
1642
1627
  }
1643
1628
  /**
1644
1629
  * Import items from a JSON file
@@ -1648,24 +1633,21 @@ var ItemsModule = class {
1648
1633
  * const file = fileInput.files[0]; // JSON file
1649
1634
  * const result = await baasix.items('products').importJSON(file);
1650
1635
  *
1651
- * console.log(`Imported ${result.created} items`);
1636
+ * console.log(`Imported ${result.imported} items`);
1652
1637
  * ```
1653
1638
  */
1654
- async importJSON(file, options) {
1639
+ async importJSON(file) {
1655
1640
  const formData = new FormData();
1656
1641
  if (file instanceof File) {
1657
- formData.append("file", file);
1642
+ formData.append("jsonFile", file);
1658
1643
  } else {
1659
- formData.append("file", file);
1660
- }
1661
- if (options?.fieldMapping) {
1662
- formData.append("fieldMapping", JSON.stringify(options.fieldMapping));
1644
+ formData.append("jsonFile", file);
1663
1645
  }
1664
1646
  const response = await this.client.post(
1665
- `/items/${this.collection}/import/json`,
1647
+ `/items/${this.collection}/import-json`,
1666
1648
  formData
1667
1649
  );
1668
- return response.data;
1650
+ return response.results;
1669
1651
  }
1670
1652
  /**
1671
1653
  * Import items from an array of objects
@@ -1691,19 +1673,22 @@ var ItemsModule = class {
1691
1673
  // Sort Operations
1692
1674
  // ===================
1693
1675
  /**
1694
- * Sort/reorder items (move item before another)
1676
+ * Sort/reorder items (move item before or after another)
1695
1677
  *
1696
1678
  * @example
1697
1679
  * ```typescript
1698
1680
  * // Move item1 before item2
1699
1681
  * await baasix.items('products').sortItem('item1-uuid', 'item2-uuid');
1682
+ *
1683
+ * // Move item1 after item2
1684
+ * await baasix.items('products').sortItem('item1-uuid', 'item2-uuid', 'after');
1700
1685
  * ```
1701
1686
  */
1702
- async sortItem(itemId, beforeItemId) {
1703
- await this.client.post("/utils/sort", {
1704
- collection: this.collection,
1687
+ async sortItem(itemId, targetItemId, mode = "before") {
1688
+ await this.client.post(`/utils/sort/${this.collection}`, {
1705
1689
  item: itemId,
1706
- to: beforeItemId
1690
+ to: targetItemId,
1691
+ mode
1707
1692
  });
1708
1693
  }
1709
1694
  /**
@@ -1721,10 +1706,10 @@ var ItemsModule = class {
1721
1706
  */
1722
1707
  async reorder(orderedIds) {
1723
1708
  for (let i = 1; i < orderedIds.length; i++) {
1724
- await this.client.post("/utils/sort", {
1725
- collection: this.collection,
1709
+ await this.client.post(`/utils/sort/${this.collection}`, {
1726
1710
  item: orderedIds[i],
1727
- to: orderedIds[i - 1]
1711
+ to: orderedIds[i - 1],
1712
+ mode: "after"
1728
1713
  });
1729
1714
  }
1730
1715
  }
@@ -2004,10 +1989,13 @@ var SchemasModule = class {
2004
1989
  * ```typescript
2005
1990
  * const { data } = await baasix.schemas.find();
2006
1991
  * console.log(data.map(s => s.collectionName));
1992
+ *
1993
+ * // With pagination
1994
+ * const { data } = await baasix.schemas.find({ page: 1, limit: 50 });
2007
1995
  * ```
2008
1996
  */
2009
- async find() {
2010
- return this.client.get("/schemas");
1997
+ async find(params) {
1998
+ return this.client.get("/schemas", { params });
2011
1999
  }
2012
2000
  /**
2013
2001
  * Get schema for a specific collection
@@ -2150,6 +2138,23 @@ var SchemasModule = class {
2150
2138
  `/schemas/${collection}/relationships/${relationshipName}`
2151
2139
  );
2152
2140
  }
2141
+ /**
2142
+ * Update a relationship
2143
+ *
2144
+ * @example
2145
+ * ```typescript
2146
+ * await baasix.schemas.updateRelationship('posts', 'author', {
2147
+ * alias: 'authoredPosts',
2148
+ * onDelete: 'CASCADE'
2149
+ * });
2150
+ * ```
2151
+ */
2152
+ async updateRelationship(collection, relationshipName, data) {
2153
+ await this.client.patch(
2154
+ `/schemas/${collection}/relationships/${relationshipName}`,
2155
+ data
2156
+ );
2157
+ }
2153
2158
  /**
2154
2159
  * Create an index on a collection
2155
2160
  *
@@ -2278,71 +2283,56 @@ var NotificationsModule = class {
2278
2283
  });
2279
2284
  }
2280
2285
  /**
2281
- * Get a single notification by ID
2282
- */
2283
- async findOne(id) {
2284
- const response = await this.client.get(
2285
- `/notifications/${id}`
2286
- );
2287
- return response.data;
2288
- }
2289
- /**
2290
- * Mark a notification as seen
2291
- *
2292
- * @example
2293
- * ```typescript
2294
- * await baasix.notifications.markAsSeen('notification-uuid');
2295
- * ```
2296
- */
2297
- async markAsSeen(id) {
2298
- await this.client.patch(`/notifications/${id}/seen`, { seen: true });
2299
- }
2300
- /**
2301
- * Mark multiple notifications as seen
2302
- *
2303
- * @example
2304
- * ```typescript
2305
- * await baasix.notifications.markManySeen(['id1', 'id2', 'id3']);
2306
- * ```
2307
- */
2308
- async markManySeen(ids) {
2309
- await Promise.all(ids.map((id) => this.markAsSeen(id)));
2310
- }
2311
- /**
2312
- * Mark all notifications as seen
2286
+ * Get unread notification count
2313
2287
  *
2314
2288
  * @example
2315
2289
  * ```typescript
2316
- * await baasix.notifications.markAllSeen();
2290
+ * const count = await baasix.notifications.getUnreadCount();
2317
2291
  * ```
2318
2292
  */
2319
- async markAllSeen() {
2320
- await this.client.post("/notifications/seen-all");
2293
+ async getUnreadCount() {
2294
+ const response = await this.client.get(
2295
+ "/notifications/unread/count"
2296
+ );
2297
+ return response.count;
2321
2298
  }
2322
2299
  /**
2323
- * Get unread notification count
2300
+ * Mark notifications as seen
2324
2301
  *
2325
2302
  * @example
2326
2303
  * ```typescript
2327
- * const count = await baasix.notifications.getUnreadCount();
2304
+ * // Mark specific notifications as seen
2305
+ * await baasix.notifications.markAsSeen(['id1', 'id2']);
2306
+ *
2307
+ * // Mark all notifications as seen
2308
+ * await baasix.notifications.markAsSeen();
2328
2309
  * ```
2329
2310
  */
2330
- async getUnreadCount() {
2331
- const response = await this.client.get(
2332
- "/notifications/unread-count"
2311
+ async markAsSeen(notificationIds) {
2312
+ const response = await this.client.post(
2313
+ "/notifications/mark-seen",
2314
+ { notificationIds }
2333
2315
  );
2334
- return response.data.count;
2316
+ return { count: response.count };
2335
2317
  }
2336
2318
  /**
2337
- * Delete a notification
2319
+ * Delete notifications for the current user
2338
2320
  *
2339
2321
  * @example
2340
2322
  * ```typescript
2341
- * await baasix.notifications.delete('notification-uuid');
2323
+ * // Delete specific notifications
2324
+ * await baasix.notifications.delete(['id1', 'id2']);
2325
+ *
2326
+ * // Delete all notifications
2327
+ * await baasix.notifications.delete();
2342
2328
  * ```
2343
2329
  */
2344
- async delete(id) {
2345
- await this.client.delete(`/notifications/${id}`);
2330
+ async delete(notificationIds) {
2331
+ const response = await this.client.delete(
2332
+ "/notifications",
2333
+ { params: notificationIds ? { notificationIds } : void 0 }
2334
+ );
2335
+ return { count: response.count };
2346
2336
  }
2347
2337
  /**
2348
2338
  * Send a notification to users (requires admin permissions)
@@ -2359,7 +2349,30 @@ var NotificationsModule = class {
2359
2349
  * ```
2360
2350
  */
2361
2351
  async send(data) {
2362
- await this.client.post("/notifications/send", data);
2352
+ const response = await this.client.post(
2353
+ "/notifications/send",
2354
+ data
2355
+ );
2356
+ return { notificationIds: response.notificationIds };
2357
+ }
2358
+ /**
2359
+ * Cleanup old notifications (requires admin permissions)
2360
+ *
2361
+ * @example
2362
+ * ```typescript
2363
+ * // Clean up notifications older than 30 days (default)
2364
+ * await baasix.notifications.cleanup();
2365
+ *
2366
+ * // Clean up notifications older than 7 days
2367
+ * await baasix.notifications.cleanup(7);
2368
+ * ```
2369
+ */
2370
+ async cleanup(days = 30) {
2371
+ const response = await this.client.post(
2372
+ "/notifications/cleanup",
2373
+ { days }
2374
+ );
2375
+ return { count: response.count };
2363
2376
  }
2364
2377
  };
2365
2378
 
@@ -3716,15 +3729,21 @@ var MigrationsModule = class {
3716
3729
  return response.data;
3717
3730
  }
3718
3731
  /**
3719
- * Get all completed migrations
3732
+ * Get all migrations with optional filtering
3720
3733
  *
3721
3734
  * @example
3722
3735
  * ```typescript
3736
+ * // Get all migrations
3723
3737
  * const migrations = await baasix.migrations.list();
3738
+ *
3739
+ * // Get completed migrations
3740
+ * const completed = await baasix.migrations.list({ status: 'completed' });
3724
3741
  * ```
3725
3742
  */
3726
- async list() {
3727
- const response = await this.client.get("/migrations");
3743
+ async list(options) {
3744
+ const response = await this.client.get("/migrations", {
3745
+ params: options
3746
+ });
3728
3747
  return response.data;
3729
3748
  }
3730
3749
  /**
@@ -3742,31 +3761,34 @@ var MigrationsModule = class {
3742
3761
  return response.data;
3743
3762
  }
3744
3763
  /**
3745
- * Check if there are pending migrations
3764
+ * Check if migrations are needed
3746
3765
  *
3747
3766
  * @example
3748
3767
  * ```typescript
3749
- * const needsMigration = await baasix.migrations.hasPending();
3768
+ * const check = await baasix.migrations.check();
3769
+ * if (check.hasPending) {
3770
+ * console.log('Migrations needed');
3771
+ * }
3750
3772
  * ```
3751
3773
  */
3752
- async hasPending() {
3774
+ async check() {
3753
3775
  const response = await this.client.get(
3754
3776
  "/migrations/check"
3755
3777
  );
3756
- return response.data.hasPending;
3778
+ return response.data;
3757
3779
  }
3758
3780
  /**
3759
- * Get a specific migration by name
3781
+ * Get a specific migration by version
3760
3782
  *
3761
3783
  * @example
3762
3784
  * ```typescript
3763
- * const migration = await baasix.migrations.get('20231201_create_users');
3785
+ * const migration = await baasix.migrations.get('20231201000000');
3764
3786
  * ```
3765
3787
  */
3766
- async get(name) {
3788
+ async get(version) {
3767
3789
  try {
3768
3790
  const response = await this.client.get(
3769
- `/migrations/${encodeURIComponent(name)}`
3791
+ `/migrations/${encodeURIComponent(version)}`
3770
3792
  );
3771
3793
  return response.data;
3772
3794
  } catch {
@@ -3778,14 +3800,20 @@ var MigrationsModule = class {
3778
3800
  *
3779
3801
  * @example
3780
3802
  * ```typescript
3803
+ * // Run all pending migrations
3781
3804
  * const result = await baasix.migrations.run();
3782
- * console.log(`Ran ${result.migrationsRun.length} migrations`);
3805
+ *
3806
+ * // Run with options
3807
+ * const result = await baasix.migrations.run({
3808
+ * step: 1, // Run only 1 migration
3809
+ * dryRun: true // Preview without executing
3810
+ * });
3783
3811
  * ```
3784
3812
  */
3785
- async run() {
3813
+ async run(options) {
3786
3814
  const response = await this.client.post(
3787
3815
  "/migrations/run",
3788
- {}
3816
+ options || {}
3789
3817
  );
3790
3818
  return response.data;
3791
3819
  }
@@ -3794,13 +3822,13 @@ var MigrationsModule = class {
3794
3822
  *
3795
3823
  * @example
3796
3824
  * ```typescript
3797
- * const result = await baasix.migrations.rollback('20231201_create_users');
3825
+ * const result = await baasix.migrations.rollback('20231201000000');
3798
3826
  * ```
3799
3827
  */
3800
- async rollback(name) {
3828
+ async rollback(version) {
3801
3829
  const response = await this.client.post(
3802
- "/migrations/rollback",
3803
- { name }
3830
+ `/migrations/rollback/${encodeURIComponent(version)}`,
3831
+ {}
3804
3832
  );
3805
3833
  return response.data;
3806
3834
  }
@@ -3809,12 +3837,12 @@ var MigrationsModule = class {
3809
3837
  *
3810
3838
  * @example
3811
3839
  * ```typescript
3812
- * const result = await baasix.migrations.rollbackLast();
3840
+ * const result = await baasix.migrations.rollbackBatch();
3813
3841
  * ```
3814
3842
  */
3815
- async rollbackLast() {
3843
+ async rollbackBatch() {
3816
3844
  const response = await this.client.post(
3817
- "/migrations/rollback-last",
3845
+ "/migrations/rollback-batch",
3818
3846
  {}
3819
3847
  );
3820
3848
  return response.data;
@@ -3824,37 +3852,91 @@ var MigrationsModule = class {
3824
3852
  *
3825
3853
  * @example
3826
3854
  * ```typescript
3827
- * const migrationName = await baasix.migrations.create('add_status_column');
3855
+ * const { filepath } = await baasix.migrations.create('add_status_column', {
3856
+ * type: 'schema',
3857
+ * description: 'Add status column to orders'
3858
+ * });
3828
3859
  * ```
3829
3860
  */
3830
- async create(name) {
3861
+ async create(name, options) {
3831
3862
  const response = await this.client.post(
3832
3863
  "/migrations/create",
3833
- { name }
3864
+ { name, ...options }
3834
3865
  );
3835
- return response.data.name;
3866
+ return response.data;
3836
3867
  }
3837
3868
  /**
3838
- * Mark a migration as complete (without running it)
3869
+ * Mark a specific migration as completed without running it
3870
+ * Useful for existing installations that already have the changes
3839
3871
  *
3840
3872
  * @example
3841
3873
  * ```typescript
3842
- * await baasix.migrations.markComplete('20231201_create_users');
3874
+ * await baasix.migrations.markCompleted('20231201000000');
3843
3875
  * ```
3844
3876
  */
3845
- async markComplete(name) {
3846
- await this.client.post("/migrations/mark-complete", { name });
3877
+ async markCompleted(version, metadata) {
3878
+ const response = await this.client.post(
3879
+ `/migrations/mark-completed/${encodeURIComponent(version)}`,
3880
+ { metadata }
3881
+ );
3882
+ return response.data;
3847
3883
  }
3848
3884
  /**
3849
- * Mark all pending migrations as complete
3885
+ * Mark all pending migrations as completed
3886
+ * Useful for bringing an existing database up to date without running migrations
3850
3887
  *
3851
3888
  * @example
3852
3889
  * ```typescript
3853
- * await baasix.migrations.markAllComplete();
3890
+ * // Mark all pending
3891
+ * await baasix.migrations.markAllCompleted();
3892
+ *
3893
+ * // Mark up to a specific version
3894
+ * await baasix.migrations.markAllCompleted('20231201000000');
3895
+ * ```
3896
+ */
3897
+ async markAllCompleted(toVersion) {
3898
+ const response = await this.client.post(
3899
+ "/migrations/mark-all-completed",
3900
+ { toVersion }
3901
+ );
3902
+ return response.data;
3903
+ }
3904
+ };
3905
+
3906
+ // src/modules/server.ts
3907
+ var ServerModule = class {
3908
+ client;
3909
+ constructor(config) {
3910
+ this.client = config.client;
3911
+ }
3912
+ /**
3913
+ * Get server information including project settings
3914
+ *
3915
+ * @example
3916
+ * ```typescript
3917
+ * const info = await baasix.server.info();
3918
+ * console.log('Project:', info.project?.name);
3919
+ * console.log('Version:', info.version);
3920
+ * ```
3921
+ */
3922
+ async info() {
3923
+ return this.client.get("/");
3924
+ }
3925
+ /**
3926
+ * Check server health
3927
+ *
3928
+ * @example
3929
+ * ```typescript
3930
+ * const isHealthy = await baasix.server.health();
3854
3931
  * ```
3855
3932
  */
3856
- async markAllComplete() {
3857
- await this.client.post("/migrations/mark-all-complete", {});
3933
+ async health() {
3934
+ try {
3935
+ await this.client.get("/health");
3936
+ return true;
3937
+ } catch {
3938
+ return false;
3939
+ }
3858
3940
  }
3859
3941
  };
3860
3942
 
@@ -3933,6 +4015,7 @@ var Baasix = class {
3933
4015
  roles;
3934
4016
  users;
3935
4017
  migrations;
4018
+ server;
3936
4019
  // Items module factory cache
3937
4020
  itemsModules = /* @__PURE__ */ new Map();
3938
4021
  constructor(config) {
@@ -3981,6 +4064,7 @@ var Baasix = class {
3981
4064
  this.roles = new RolesModule({ client: this.httpClient });
3982
4065
  this.users = new UsersModule({ client: this.httpClient });
3983
4066
  this.migrations = new MigrationsModule({ client: this.httpClient });
4067
+ this.server = new ServerModule({ client: this.httpClient });
3984
4068
  this.realtime = new RealtimeModule({
3985
4069
  client: this.httpClient,
3986
4070
  storage: this.storage,
@@ -4109,6 +4193,23 @@ var Baasix = class {
4109
4193
  this.httpClient.updateConfig({ tenantId: void 0 });
4110
4194
  await this.storage.remove(STORAGE_KEYS.TENANT);
4111
4195
  }
4196
+ /**
4197
+ * Set a static token (convenience method that delegates to auth.setToken)
4198
+ *
4199
+ * @example
4200
+ * ```typescript
4201
+ * baasix.setToken('your-api-token');
4202
+ * ```
4203
+ */
4204
+ async setToken(token) {
4205
+ return this.auth.setToken(token);
4206
+ }
4207
+ /**
4208
+ * Get the current auth token
4209
+ */
4210
+ async getToken() {
4211
+ return this.storage.get(STORAGE_KEYS.ACCESS_TOKEN);
4212
+ }
4112
4213
  /**
4113
4214
  * Get the base URL
4114
4215
  */