@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.d.cts CHANGED
@@ -146,6 +146,7 @@ declare class NotificationsModule {
146
146
  limit?: number;
147
147
  page?: number;
148
148
  filter?: Record<string, unknown>;
149
+ sort?: string[] | Record<string, "asc" | "desc">;
149
150
  }): Promise<PaginatedResponse<Notification>>;
150
151
  /**
151
152
  * Get unread notification count
@@ -171,6 +172,33 @@ declare class NotificationsModule {
171
172
  markAsSeen(notificationIds?: string[]): Promise<{
172
173
  count: number;
173
174
  }>;
175
+ /**
176
+ * Mark notifications as unseen (unread)
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * // Mark specific notifications as unseen
181
+ * await baasix.notifications.markAsUnseen(['id1', 'id2']);
182
+ *
183
+ * // Mark all notifications as unseen
184
+ * await baasix.notifications.markAsUnseen();
185
+ * ```
186
+ */
187
+ markAsUnseen(notificationIds?: string[]): Promise<{
188
+ count: number;
189
+ }>;
190
+ /**
191
+ * Get the per-type notification link templates configured in settings
192
+ * (`metadata.notificationLinks`). Templates may contain `{{field}}`
193
+ * placeholders resolved from the notification (including `data.*` paths).
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * const links = await baasix.notifications.getLinks();
198
+ * // { task_assigned: '/pages/?slug=tasks&id={{data.taskId}}' }
199
+ * ```
200
+ */
201
+ getLinks(): Promise<Record<string, string>>;
174
202
  /**
175
203
  * Delete notifications for the current user
176
204
  *
@@ -459,7 +487,9 @@ declare class SettingsModule {
459
487
  * });
460
488
  * ```
461
489
  */
462
- update(settings: Partial<Settings>): Promise<Settings>;
490
+ update(settings: Partial<Settings>, options?: {
491
+ tenantId?: string | number;
492
+ }): Promise<Settings>;
463
493
  /**
464
494
  * Set a specific setting
465
495
  *
@@ -2066,14 +2096,19 @@ declare class ServerModule {
2066
2096
  /**
2067
2097
  * Get server information including project settings
2068
2098
  *
2099
+ * @param tenantId - Optional tenant ID to fetch tenant-merged project settings
2100
+ *
2069
2101
  * @example
2070
2102
  * ```typescript
2071
2103
  * const info = await baasix.server.info();
2072
2104
  * console.log('Project:', info.project?.name);
2073
2105
  * console.log('Version:', info.version);
2106
+ *
2107
+ * // Tenant-aware: settings merged for the given tenant
2108
+ * const tenantInfo = await baasix.server.info("tenant-uuid");
2074
2109
  * ```
2075
2110
  */
2076
- info(): Promise<ServerInfo>;
2111
+ info(tenantId?: string): Promise<ServerInfo>;
2077
2112
  /**
2078
2113
  * Check server health
2079
2114
  *
package/dist/index.d.ts CHANGED
@@ -146,6 +146,7 @@ declare class NotificationsModule {
146
146
  limit?: number;
147
147
  page?: number;
148
148
  filter?: Record<string, unknown>;
149
+ sort?: string[] | Record<string, "asc" | "desc">;
149
150
  }): Promise<PaginatedResponse<Notification>>;
150
151
  /**
151
152
  * Get unread notification count
@@ -171,6 +172,33 @@ declare class NotificationsModule {
171
172
  markAsSeen(notificationIds?: string[]): Promise<{
172
173
  count: number;
173
174
  }>;
175
+ /**
176
+ * Mark notifications as unseen (unread)
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * // Mark specific notifications as unseen
181
+ * await baasix.notifications.markAsUnseen(['id1', 'id2']);
182
+ *
183
+ * // Mark all notifications as unseen
184
+ * await baasix.notifications.markAsUnseen();
185
+ * ```
186
+ */
187
+ markAsUnseen(notificationIds?: string[]): Promise<{
188
+ count: number;
189
+ }>;
190
+ /**
191
+ * Get the per-type notification link templates configured in settings
192
+ * (`metadata.notificationLinks`). Templates may contain `{{field}}`
193
+ * placeholders resolved from the notification (including `data.*` paths).
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * const links = await baasix.notifications.getLinks();
198
+ * // { task_assigned: '/pages/?slug=tasks&id={{data.taskId}}' }
199
+ * ```
200
+ */
201
+ getLinks(): Promise<Record<string, string>>;
174
202
  /**
175
203
  * Delete notifications for the current user
176
204
  *
@@ -459,7 +487,9 @@ declare class SettingsModule {
459
487
  * });
460
488
  * ```
461
489
  */
462
- update(settings: Partial<Settings>): Promise<Settings>;
490
+ update(settings: Partial<Settings>, options?: {
491
+ tenantId?: string | number;
492
+ }): Promise<Settings>;
463
493
  /**
464
494
  * Set a specific setting
465
495
  *
@@ -2066,14 +2096,19 @@ declare class ServerModule {
2066
2096
  /**
2067
2097
  * Get server information including project settings
2068
2098
  *
2099
+ * @param tenantId - Optional tenant ID to fetch tenant-merged project settings
2100
+ *
2069
2101
  * @example
2070
2102
  * ```typescript
2071
2103
  * const info = await baasix.server.info();
2072
2104
  * console.log('Project:', info.project?.name);
2073
2105
  * console.log('Version:', info.version);
2106
+ *
2107
+ * // Tenant-aware: settings merged for the given tenant
2108
+ * const tenantInfo = await baasix.server.info("tenant-uuid");
2074
2109
  * ```
2075
2110
  */
2076
- info(): Promise<ServerInfo>;
2111
+ info(tenantId?: string): Promise<ServerInfo>;
2077
2112
  /**
2078
2113
  * Check server health
2079
2114
  *
package/dist/index.js CHANGED
@@ -1221,6 +1221,25 @@ var QueryBuilder = class {
1221
1221
  }
1222
1222
  return this;
1223
1223
  }
1224
+ /**
1225
+ * Control whether the total record count is computed for this query.
1226
+ *
1227
+ * Pass `false` to skip the COUNT query (the response `totalCount` will be
1228
+ * `null`) — useful for read-heavy or infinite-scroll lists where the total
1229
+ * isn't needed. Pass `true` to force the count even when the deployment
1230
+ * default (env `COUNT_BY_DEFAULT`) is off. When omitted, the server default
1231
+ * applies.
1232
+ *
1233
+ * @example
1234
+ * ```typescript
1235
+ * // Skip the count for a faster list query
1236
+ * const { data } = await items.filter({ status: { eq: 'active' } }).withCount(false).get();
1237
+ * ```
1238
+ */
1239
+ withCount(enabled = true) {
1240
+ this.queryParams.count = enabled;
1241
+ return this;
1242
+ }
1224
1243
  /**
1225
1244
  * Include soft-deleted items
1226
1245
  *
@@ -1346,6 +1365,9 @@ var QueryBuilder = class {
1346
1365
  if (this.queryParams.groupBy) {
1347
1366
  params.groupBy = this.queryParams.groupBy;
1348
1367
  }
1368
+ if (this.queryParams.count !== void 0) {
1369
+ params.count = this.queryParams.count;
1370
+ }
1349
1371
  return params;
1350
1372
  }
1351
1373
  };
@@ -2382,6 +2404,42 @@ var NotificationsModule = class {
2382
2404
  );
2383
2405
  return { count: response.count };
2384
2406
  }
2407
+ /**
2408
+ * Mark notifications as unseen (unread)
2409
+ *
2410
+ * @example
2411
+ * ```typescript
2412
+ * // Mark specific notifications as unseen
2413
+ * await baasix.notifications.markAsUnseen(['id1', 'id2']);
2414
+ *
2415
+ * // Mark all notifications as unseen
2416
+ * await baasix.notifications.markAsUnseen();
2417
+ * ```
2418
+ */
2419
+ async markAsUnseen(notificationIds) {
2420
+ const response = await this.client.post(
2421
+ "/notifications/mark-unseen",
2422
+ { notificationIds }
2423
+ );
2424
+ return { count: response.count };
2425
+ }
2426
+ /**
2427
+ * Get the per-type notification link templates configured in settings
2428
+ * (`metadata.notificationLinks`). Templates may contain `{{field}}`
2429
+ * placeholders resolved from the notification (including `data.*` paths).
2430
+ *
2431
+ * @example
2432
+ * ```typescript
2433
+ * const links = await baasix.notifications.getLinks();
2434
+ * // { task_assigned: '/pages/?slug=tasks&id={{data.taskId}}' }
2435
+ * ```
2436
+ */
2437
+ async getLinks() {
2438
+ const response = await this.client.get(
2439
+ "/notifications/links"
2440
+ );
2441
+ return response.data ?? {};
2442
+ }
2385
2443
  /**
2386
2444
  * Delete notifications for the current user
2387
2445
  *
@@ -2688,10 +2746,11 @@ var SettingsModule = class {
2688
2746
  * });
2689
2747
  * ```
2690
2748
  */
2691
- async update(settings) {
2749
+ async update(settings, options) {
2692
2750
  const response = await this.client.patch(
2693
2751
  "/settings",
2694
- settings
2752
+ settings,
2753
+ options?.tenantId !== void 0 && options?.tenantId !== null ? { params: { tenant_id: options.tenantId } } : void 0
2695
2754
  );
2696
2755
  return response.data;
2697
2756
  }
@@ -4697,15 +4756,23 @@ var ServerModule = class {
4697
4756
  /**
4698
4757
  * Get server information including project settings
4699
4758
  *
4759
+ * @param tenantId - Optional tenant ID to fetch tenant-merged project settings
4760
+ *
4700
4761
  * @example
4701
4762
  * ```typescript
4702
4763
  * const info = await baasix.server.info();
4703
4764
  * console.log('Project:', info.project?.name);
4704
4765
  * console.log('Version:', info.version);
4766
+ *
4767
+ * // Tenant-aware: settings merged for the given tenant
4768
+ * const tenantInfo = await baasix.server.info("tenant-uuid");
4705
4769
  * ```
4706
4770
  */
4707
- async info() {
4708
- return this.client.get("/");
4771
+ async info(tenantId) {
4772
+ return this.client.get(
4773
+ "/",
4774
+ tenantId ? { params: { tenant_id: tenantId } } : void 0
4775
+ );
4709
4776
  }
4710
4777
  /**
4711
4778
  * Check server health