@baasix/sdk 0.1.17 → 0.1.19

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.cjs CHANGED
@@ -1223,6 +1223,25 @@ var QueryBuilder = class {
1223
1223
  }
1224
1224
  return this;
1225
1225
  }
1226
+ /**
1227
+ * Control whether the total record count is computed for this query.
1228
+ *
1229
+ * Pass `false` to skip the COUNT query (the response `totalCount` will be
1230
+ * `null`) — useful for read-heavy or infinite-scroll lists where the total
1231
+ * isn't needed. Pass `true` to force the count even when the deployment
1232
+ * default (env `COUNT_BY_DEFAULT`) is off. When omitted, the server default
1233
+ * applies.
1234
+ *
1235
+ * @example
1236
+ * ```typescript
1237
+ * // Skip the count for a faster list query
1238
+ * const { data } = await items.filter({ status: { eq: 'active' } }).withCount(false).get();
1239
+ * ```
1240
+ */
1241
+ withCount(enabled = true) {
1242
+ this.queryParams.count = enabled;
1243
+ return this;
1244
+ }
1226
1245
  /**
1227
1246
  * Include soft-deleted items
1228
1247
  *
@@ -1348,6 +1367,9 @@ var QueryBuilder = class {
1348
1367
  if (this.queryParams.groupBy) {
1349
1368
  params.groupBy = this.queryParams.groupBy;
1350
1369
  }
1370
+ if (this.queryParams.count !== void 0) {
1371
+ params.count = this.queryParams.count;
1372
+ }
1351
1373
  return params;
1352
1374
  }
1353
1375
  };
@@ -2384,6 +2406,42 @@ var NotificationsModule = class {
2384
2406
  );
2385
2407
  return { count: response.count };
2386
2408
  }
2409
+ /**
2410
+ * Mark notifications as unseen (unread)
2411
+ *
2412
+ * @example
2413
+ * ```typescript
2414
+ * // Mark specific notifications as unseen
2415
+ * await baasix.notifications.markAsUnseen(['id1', 'id2']);
2416
+ *
2417
+ * // Mark all notifications as unseen
2418
+ * await baasix.notifications.markAsUnseen();
2419
+ * ```
2420
+ */
2421
+ async markAsUnseen(notificationIds) {
2422
+ const response = await this.client.post(
2423
+ "/notifications/mark-unseen",
2424
+ { notificationIds }
2425
+ );
2426
+ return { count: response.count };
2427
+ }
2428
+ /**
2429
+ * Get the per-type notification link templates configured in settings
2430
+ * (`metadata.notificationLinks`). Templates may contain `{{field}}`
2431
+ * placeholders resolved from the notification (including `data.*` paths).
2432
+ *
2433
+ * @example
2434
+ * ```typescript
2435
+ * const links = await baasix.notifications.getLinks();
2436
+ * // { task_assigned: '/pages/?slug=tasks&id={{data.taskId}}' }
2437
+ * ```
2438
+ */
2439
+ async getLinks() {
2440
+ const response = await this.client.get(
2441
+ "/notifications/links"
2442
+ );
2443
+ return response.data ?? {};
2444
+ }
2387
2445
  /**
2388
2446
  * Delete notifications for the current user
2389
2447
  *
@@ -2690,10 +2748,11 @@ var SettingsModule = class {
2690
2748
  * });
2691
2749
  * ```
2692
2750
  */
2693
- async update(settings) {
2751
+ async update(settings, options) {
2694
2752
  const response = await this.client.patch(
2695
2753
  "/settings",
2696
- settings
2754
+ settings,
2755
+ options?.tenantId !== void 0 && options?.tenantId !== null ? { params: { tenant_id: options.tenantId } } : void 0
2697
2756
  );
2698
2757
  return response.data;
2699
2758
  }
@@ -4699,15 +4758,23 @@ var ServerModule = class {
4699
4758
  /**
4700
4759
  * Get server information including project settings
4701
4760
  *
4761
+ * @param tenantId - Optional tenant ID to fetch tenant-merged project settings
4762
+ *
4702
4763
  * @example
4703
4764
  * ```typescript
4704
4765
  * const info = await baasix.server.info();
4705
4766
  * console.log('Project:', info.project?.name);
4706
4767
  * console.log('Version:', info.version);
4768
+ *
4769
+ * // Tenant-aware: settings merged for the given tenant
4770
+ * const tenantInfo = await baasix.server.info("tenant-uuid");
4707
4771
  * ```
4708
4772
  */
4709
- async info() {
4710
- return this.client.get("/");
4773
+ async info(tenantId) {
4774
+ return this.client.get(
4775
+ "/",
4776
+ tenantId ? { params: { tenant_id: tenantId } } : void 0
4777
+ );
4711
4778
  }
4712
4779
  /**
4713
4780
  * Check server health