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