@witnium-tech/witniumchain 0.10.0 → 0.11.0
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.mts +79 -68
- package/dist/index.d.ts +79 -68
- package/dist/index.js +0 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -273,43 +273,6 @@ var WitniumchainClient = class {
|
|
|
273
273
|
return this.req("GET", "/v1/orgs/me/users", { auth: "OrgApiKey" });
|
|
274
274
|
}
|
|
275
275
|
// ────────────────────────────────────────────────────────────────────────
|
|
276
|
-
// Admin (/v1/admin/organizations/*)
|
|
277
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
278
|
-
createOrganization(body) {
|
|
279
|
-
return this.req("POST", "/v1/admin/organizations", {
|
|
280
|
-
auth: "AdminToken",
|
|
281
|
-
body
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
setOrgAccountType(id, body) {
|
|
285
|
-
return this.req(
|
|
286
|
-
"PATCH",
|
|
287
|
-
`/v1/admin/organizations/${encodeURIComponent(id)}/account-type`,
|
|
288
|
-
{ auth: "AdminToken", body }
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
verifyOrganization(id) {
|
|
292
|
-
return this.req(
|
|
293
|
-
"PATCH",
|
|
294
|
-
`/v1/admin/organizations/${encodeURIComponent(id)}/verify`,
|
|
295
|
-
{ auth: "AdminToken" }
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
rotateOrgApiKey(id) {
|
|
299
|
-
return this.req(
|
|
300
|
-
"POST",
|
|
301
|
-
`/v1/admin/organizations/${encodeURIComponent(id)}/rotate-key`,
|
|
302
|
-
{ auth: "AdminToken" }
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
adjustOrgCredits(id, body) {
|
|
306
|
-
return this.req(
|
|
307
|
-
"POST",
|
|
308
|
-
`/v1/admin/organizations/${encodeURIComponent(id)}/adjust-credits`,
|
|
309
|
-
{ auth: "AdminToken", body }
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
313
276
|
// Delegated keys (/v1/users/me/delegated-keys/*)
|
|
314
277
|
// ────────────────────────────────────────────────────────────────────────
|
|
315
278
|
listDelegatedKeys(query) {
|
|
@@ -1199,15 +1162,6 @@ var WitniumchainClient = class {
|
|
|
1199
1162
|
headers["authorization"] = `Bearer ${this.cfg.orgApiKey}`;
|
|
1200
1163
|
return;
|
|
1201
1164
|
}
|
|
1202
|
-
case "AdminToken": {
|
|
1203
|
-
if (!this.cfg.adminToken) {
|
|
1204
|
-
throw new Error(
|
|
1205
|
-
`WitniumchainClient: ${method} ${path} requires an admin token. Pass \`adminToken\` to the constructor.`
|
|
1206
|
-
);
|
|
1207
|
-
}
|
|
1208
|
-
headers["authorization"] = `Bearer ${this.cfg.adminToken}`;
|
|
1209
|
-
return;
|
|
1210
|
-
}
|
|
1211
1165
|
case "SignedRequest": {
|
|
1212
1166
|
if (!this.cfg.signedRequest) {
|
|
1213
1167
|
throw new Error(
|
|
@@ -1494,60 +1448,6 @@ async function sha256Hex(input) {
|
|
|
1494
1448
|
return out;
|
|
1495
1449
|
}
|
|
1496
1450
|
|
|
1497
|
-
// src/admin-client.ts
|
|
1498
|
-
var WitniumchainAdminClient = class {
|
|
1499
|
-
inner;
|
|
1500
|
-
constructor(config) {
|
|
1501
|
-
if (!config.adminToken) {
|
|
1502
|
-
throw new Error("WitniumchainAdminClient: adminToken is required");
|
|
1503
|
-
}
|
|
1504
|
-
this.inner = new WitniumchainClient({
|
|
1505
|
-
baseUrl: config.baseUrl,
|
|
1506
|
-
adminToken: config.adminToken,
|
|
1507
|
-
timeout: config.timeout,
|
|
1508
|
-
fetch: config.fetch
|
|
1509
|
-
});
|
|
1510
|
-
}
|
|
1511
|
-
/**
|
|
1512
|
-
* Mint a new organisation. The returned `apiKey` is shown ONCE — the server
|
|
1513
|
-
* only retains its SHA-256 hash. Persist it before the response leaves
|
|
1514
|
-
* scope; there is no recovery path.
|
|
1515
|
-
*
|
|
1516
|
-
* @param body Organisation seed: name, email, optional accountType and
|
|
1517
|
-
* signup credit grant, optional skip-email-verification flag.
|
|
1518
|
-
*/
|
|
1519
|
-
createOrganization(body) {
|
|
1520
|
-
return this.inner.createOrganization(body);
|
|
1521
|
-
}
|
|
1522
|
-
/** Flip an org between `metered` (Stripe checkout + credit ledger) and `unlimited` (flat-fee). */
|
|
1523
|
-
setAccountType(orgId, accountType) {
|
|
1524
|
-
return this.inner.setOrgAccountType(orgId, { accountType });
|
|
1525
|
-
}
|
|
1526
|
-
/** Mark an org's email as verified. Prerequisite for the org to create users. */
|
|
1527
|
-
verifyEmail(orgId) {
|
|
1528
|
-
return this.inner.verifyOrganization(orgId);
|
|
1529
|
-
}
|
|
1530
|
-
/**
|
|
1531
|
-
* Rotate the org's API key. The previous `wcorg_live_…` is invalidated and
|
|
1532
|
-
* the new key is returned ONCE — same one-time-secret semantics as
|
|
1533
|
-
* {@link createOrganization}.
|
|
1534
|
-
*/
|
|
1535
|
-
rotateApiKey(orgId) {
|
|
1536
|
-
return this.inner.rotateOrgApiKey(orgId);
|
|
1537
|
-
}
|
|
1538
|
-
/**
|
|
1539
|
-
* Apply a signed credit delta to an org's ledger. Positive `delta` grants
|
|
1540
|
-
* credits (goodwill, migration backfill); negative claws them back.
|
|
1541
|
-
* Recorded as `reason: adjustment` with the supplied `note`.
|
|
1542
|
-
*
|
|
1543
|
-
* Use sparingly — this bypasses Stripe and should be auditable from the
|
|
1544
|
-
* `note` alone.
|
|
1545
|
-
*/
|
|
1546
|
-
adjustCredits(orgId, delta, note) {
|
|
1547
|
-
return this.inner.adjustOrgCredits(orgId, { delta, note });
|
|
1548
|
-
}
|
|
1549
|
-
};
|
|
1550
|
-
|
|
1551
1451
|
// src/chain-admin-client.ts
|
|
1552
1452
|
var WitniumchainChainAdminClient = class {
|
|
1553
1453
|
baseUrl;
|
|
@@ -1738,6 +1638,6 @@ function buildRevokeSigningKeyPayload(args) {
|
|
|
1738
1638
|
});
|
|
1739
1639
|
}
|
|
1740
1640
|
|
|
1741
|
-
export { DelegatedKeys, MfaNamespace, MfaRecoveryCodes, MfaTotp, OWNER_OP, OauthNamespace, OauthSessions, OrgMembers, OrgUsers, SigningKeys, Subscriptions,
|
|
1641
|
+
export { DelegatedKeys, MfaNamespace, MfaRecoveryCodes, MfaTotp, OWNER_OP, OauthNamespace, OauthSessions, OrgMembers, OrgUsers, SigningKeys, Subscriptions, WitniumchainApiError, WitniumchainChainAdminClient, WitniumchainClient, WitniumchainOrgClient, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
|
|
1742
1642
|
//# sourceMappingURL=index.mjs.map
|
|
1743
1643
|
//# sourceMappingURL=index.mjs.map
|