@flashbacktech/tsclient 0.4.54 → 0.4.56

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
@@ -597,6 +597,35 @@ var CredentialsClient = class {
597
597
  delete(credentialId) {
598
598
  return this.http.delete(`/credentials/${credentialId}`);
599
599
  }
600
+ /**
601
+ * listOrgNotify returns the org-scoped notification credentials (Slack /
602
+ * Teams / PagerDuty / SMTP, workspaceId NULL) — the channels the org owns
603
+ * for platform-event notifications, managed on Settings → System
604
+ * notifications. Distinct from project-scoped notify credentials.
605
+ */
606
+ async listOrgNotify() {
607
+ const res = await this.http.get(
608
+ "/credentials/org-notify"
609
+ );
610
+ return res.credentials ?? res.data ?? [];
611
+ }
612
+ /**
613
+ * createOrgNotify creates an org-scoped notification credential. The body is
614
+ * the universal credential shape minus projectId/workspaceId (the server
615
+ * pins workspaceId to NULL); provider must be a notify transport.
616
+ */
617
+ async createOrgNotify(body) {
618
+ const res = await this.http.post(
619
+ "/credentials/org-notify",
620
+ { body }
621
+ );
622
+ const value = res.data ?? res.credential;
623
+ if (!value) throw new Error("createOrgNotify response missing body.");
624
+ return value;
625
+ }
626
+ deleteOrgNotify(credentialId) {
627
+ return this.http.delete(`/credentials/org-notify/${credentialId}`);
628
+ }
600
629
  /**
601
630
  * providers fetches the server-side catalog. The tsclient ships its
602
631
  * own catalog mirror in ./providers.ts that the frontend can use
@@ -1215,6 +1244,129 @@ var BudgetsClient = class {
1215
1244
  }
1216
1245
  };
1217
1246
 
1247
+ // src/modules/referrals/ReferralsClient.ts
1248
+ var ReferralsClient = class {
1249
+ constructor(http) {
1250
+ this.http = http;
1251
+ }
1252
+ /** Mint a new referral code for the caller's org. */
1253
+ async mintCode(body = {}) {
1254
+ const res = await this.http.post("/referrals/codes", { body });
1255
+ return unwrapData(res);
1256
+ }
1257
+ /** List the caller org's codes with per-code redeemed/qualified counts. */
1258
+ async listCodes() {
1259
+ const res = await this.http.get("/referrals/codes");
1260
+ return res.data ?? [];
1261
+ }
1262
+ /** Activate or deactivate one of the caller org's codes. */
1263
+ async setCodeActive(codeId, isActive) {
1264
+ const res = await this.http.patch(
1265
+ `/referrals/codes/${codeId}`,
1266
+ { body: { isActive } }
1267
+ );
1268
+ return unwrapData(res);
1269
+ }
1270
+ /** Caller org's referral summary as referrer (redemptions, qualified, credits earned). */
1271
+ async stats() {
1272
+ const res = await this.http.get("/referrals/stats");
1273
+ return unwrapData(res);
1274
+ }
1275
+ /**
1276
+ * Redeem a referral code for the caller's org. Fails (4xx with an
1277
+ * `error_code`) when a guard rejects it: `code_inactive`, `self_referral`,
1278
+ * `already_redeemed`, `already_associated`, or `has_purchases`.
1279
+ */
1280
+ async redeem(body) {
1281
+ const res = await this.http.post(
1282
+ "/referrals/redeem",
1283
+ { body }
1284
+ );
1285
+ return unwrapData(res);
1286
+ }
1287
+ };
1288
+
1289
+ // src/modules/reseller/ResellerClient.ts
1290
+ var ResellerClient = class {
1291
+ constructor(http) {
1292
+ this.http = http;
1293
+ }
1294
+ // --- Reseller self-service (org.isReseller) ---
1295
+ /** Orgs associated to the caller reseller, with gross + commission rollups. */
1296
+ async listAssociatedOrgs() {
1297
+ const res = await this.http.get("/reseller/associated-orgs");
1298
+ return res.data ?? [];
1299
+ }
1300
+ /** The caller reseller's commission ledger. */
1301
+ async listCommissions() {
1302
+ const res = await this.http.get("/reseller/commissions");
1303
+ return res.data ?? [];
1304
+ }
1305
+ /** The caller reseller's payout history. */
1306
+ async listPayouts() {
1307
+ const res = await this.http.get("/reseller/payouts");
1308
+ return res.data ?? [];
1309
+ }
1310
+ // --- Platform-admin only ---
1311
+ /** List all reseller orgs with aggregate performance. */
1312
+ async listResellers() {
1313
+ const res = await this.http.get("/admin/resellers");
1314
+ return res.data ?? [];
1315
+ }
1316
+ /** Designate an org as a reseller (optionally with a per-reseller bps override). */
1317
+ async setReseller(orgId, body = {}) {
1318
+ const res = await this.http.post(
1319
+ `/admin/orgs/${orgId}/reseller`,
1320
+ { body }
1321
+ );
1322
+ return unwrapData(res);
1323
+ }
1324
+ /** Revoke an org's reseller status. */
1325
+ async revokeReseller(orgId) {
1326
+ const res = await this.http.delete(`/admin/orgs/${orgId}/reseller`);
1327
+ return unwrapData(res);
1328
+ }
1329
+ /** End an org's reseller association (stamps resellerDetachedAt). */
1330
+ async detachAssociation(orgId) {
1331
+ const res = await this.http.post(
1332
+ `/admin/orgs/${orgId}/detach-reseller`,
1333
+ { body: {} }
1334
+ );
1335
+ return unwrapData(res);
1336
+ }
1337
+ /** The billing-program-config journal, newest first. */
1338
+ async getProgramConfig() {
1339
+ const res = await this.http.get(
1340
+ "/admin/billing-program-config"
1341
+ );
1342
+ return res.data ?? [];
1343
+ }
1344
+ /** Append a new program-config period (closes the prior open row). */
1345
+ async appendProgramConfig(body) {
1346
+ const res = await this.http.post(
1347
+ "/admin/billing-program-config",
1348
+ { body }
1349
+ );
1350
+ return unwrapData(res);
1351
+ }
1352
+ /** Draft payouts from accrued commissions in the given period. */
1353
+ async generatePayouts(body) {
1354
+ const res = await this.http.post(
1355
+ "/admin/reseller-payouts/generate",
1356
+ { body }
1357
+ );
1358
+ return res.data ?? [];
1359
+ }
1360
+ /** Approve or mark-paid a payout (and optionally record an external ref). */
1361
+ async updatePayout(payoutId, body) {
1362
+ const res = await this.http.patch(
1363
+ `/admin/reseller-payouts/${payoutId}`,
1364
+ { body }
1365
+ );
1366
+ return unwrapData(res);
1367
+ }
1368
+ };
1369
+
1218
1370
  // src/client.ts
1219
1371
  var AgentEngineFacade = class {
1220
1372
  constructor(templates, scheduledTasks) {
@@ -1248,6 +1400,8 @@ var CloudAgentClient = class {
1248
1400
  this.billing = new BillingFacade(new SubscriptionsClient(this.http), new CreditsClient(this.http));
1249
1401
  this.usage = new UsageClient(this.http);
1250
1402
  this.budgets = new BudgetsClient(this.http);
1403
+ this.referrals = new ReferralsClient(this.http);
1404
+ this.reseller = new ResellerClient(this.http);
1251
1405
  }
1252
1406
  };
1253
1407
 
@@ -2098,6 +2252,8 @@ exports.NotImplementedError = NotImplementedError;
2098
2252
  exports.OrgRoles = OrgRoles;
2099
2253
  exports.PROVIDER_CATALOG = PROVIDER_CATALOG;
2100
2254
  exports.ProviderType = ProviderType;
2255
+ exports.ReferralsClient = ReferralsClient;
2256
+ exports.ResellerClient = ResellerClient;
2101
2257
  exports.ResourcesClient = ResourcesClient;
2102
2258
  exports.computeDisplayHint = computeDisplayHint;
2103
2259
  exports.getProvider = getProvider;