@flashbacktech/tsclient 0.4.63 → 0.4.65

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
@@ -335,6 +335,33 @@ var OrganizationClient = class {
335
335
  );
336
336
  return unwrapData(res);
337
337
  }
338
+ /**
339
+ * Platform-admin only: list every outstanding org + member invite (founding-
340
+ * owner invites from `inviteOrg` and members added via `addUserToOrg`) with
341
+ * derived status, newest first. Cancelled invites (soft-deleted) and live
342
+ * non-invited orgs are excluded. Returns 403 unless platform admin.
343
+ */
344
+ async listOrgInvites() {
345
+ const res = await this.http.get("/admin/org-invites");
346
+ return res.data ?? [];
347
+ }
348
+ /**
349
+ * Platform-admin only: re-send an invite — mints a fresh 7-day token and
350
+ * re-emails the link. Returns 403 unless platform admin; 404 when no pending
351
+ * invite exists; 409 once the invite has been redeemed.
352
+ */
353
+ resendOrgInvite(userId) {
354
+ return this.http.post(`/admin/org-invites/${userId}/resend`, {});
355
+ }
356
+ /**
357
+ * Platform-admin only: cancel a pending invite. Soft-deletes the invited user
358
+ * (and the shell org, for a never-redeemed founding-owner invite with no other
359
+ * members) and revokes the token, freeing the email for re-invite. Returns 403
360
+ * unless platform admin; 404 when absent; 409 once the invite has been redeemed.
361
+ */
362
+ cancelOrgInvite(userId) {
363
+ return this.http.post(`/admin/org-invites/${userId}/cancel`, {});
364
+ }
338
365
  /**
339
366
  * Platform-admin only: enable or disable the debug surface for an org.
340
367
  * Returns the updated org entry with the new allowDebug value.
@@ -1426,6 +1453,60 @@ var ResellerClient = class {
1426
1453
  }
1427
1454
  };
1428
1455
 
1456
+ // src/modules/platformAdmin/PlatformAdminClient.ts
1457
+ var PlatformAdminClient = class {
1458
+ constructor(http) {
1459
+ this.http = http;
1460
+ }
1461
+ // --- Global backend settings (open registration + free-tier credits) ---
1462
+ /** Current global settings. */
1463
+ async getPlatformSettings() {
1464
+ const res = await this.http.get("/admin/platform-settings");
1465
+ return unwrapData(res);
1466
+ }
1467
+ /** Update the global settings. */
1468
+ async updatePlatformSettings(body) {
1469
+ const res = await this.http.put("/admin/platform-settings", {
1470
+ body
1471
+ });
1472
+ return unwrapData(res);
1473
+ }
1474
+ // --- Chat-model selection (bridged to cloud-agent) ---
1475
+ /** Current model selection (provider priority + per-provider/role models). */
1476
+ async getModelSelection() {
1477
+ const res = await this.http.get("/admin/model-selection");
1478
+ return unwrapData(res);
1479
+ }
1480
+ /** Full replace of the model selection. Returns the fresh selection. */
1481
+ async putModelSelection(body) {
1482
+ const res = await this.http.put("/admin/model-selection", { body });
1483
+ return unwrapData(res);
1484
+ }
1485
+ /** Upsert a single (provider, role) → model slot. Returns the fresh selection. */
1486
+ async patchModelSelection(body) {
1487
+ const res = await this.http.patch("/admin/model-selection", {
1488
+ body
1489
+ });
1490
+ return unwrapData(res);
1491
+ }
1492
+ // --- Model pricing / surcharge (bridged to cloud-agent) ---
1493
+ /** All model_pricing rows. */
1494
+ async listModelPricing() {
1495
+ const res = await this.http.get(
1496
+ "/admin/model-pricing"
1497
+ );
1498
+ return unwrapData(res).pricing ?? [];
1499
+ }
1500
+ /** Upsert one model_pricing row. Returns the fresh list. */
1501
+ async putModelPricing(row) {
1502
+ const res = await this.http.put(
1503
+ "/admin/model-pricing",
1504
+ { body: row }
1505
+ );
1506
+ return unwrapData(res).pricing ?? [];
1507
+ }
1508
+ };
1509
+
1429
1510
  // src/client.ts
1430
1511
  var AgentEngineFacade = class {
1431
1512
  constructor(templates, scheduledTasks) {
@@ -1461,6 +1542,7 @@ var CloudAgentClient = class {
1461
1542
  this.budgets = new BudgetsClient(this.http);
1462
1543
  this.referrals = new ReferralsClient(this.http);
1463
1544
  this.reseller = new ResellerClient(this.http);
1545
+ this.platformAdmin = new PlatformAdminClient(this.http);
1464
1546
  }
1465
1547
  };
1466
1548
 
@@ -2310,6 +2392,7 @@ exports.MFAType = MFAType;
2310
2392
  exports.NotImplementedError = NotImplementedError;
2311
2393
  exports.OrgRoles = OrgRoles;
2312
2394
  exports.PROVIDER_CATALOG = PROVIDER_CATALOG;
2395
+ exports.PlatformAdminClient = PlatformAdminClient;
2313
2396
  exports.ProviderType = ProviderType;
2314
2397
  exports.ReferralsClient = ReferralsClient;
2315
2398
  exports.ResellerClient = ResellerClient;