run402 2.41.1 → 2.43.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/lib/operator.mjs +75 -7
- package/lib/org.mjs +150 -67
- package/lib/projects.mjs +156 -13
- package/lib/status.mjs +5 -2
- package/package.json +1 -1
- package/sdk/dist/control-plane-credentials.d.ts +1 -1
- package/sdk/dist/control-plane-credentials.js +1 -1
- package/sdk/dist/index.d.ts +16 -7
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +19 -8
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/namespaces/operator.d.ts +101 -0
- package/sdk/dist/namespaces/operator.d.ts.map +1 -1
- package/sdk/dist/namespaces/operator.js +60 -1
- package/sdk/dist/namespaces/operator.js.map +1 -1
- package/sdk/dist/namespaces/org.d.ts +73 -35
- package/sdk/dist/namespaces/org.d.ts.map +1 -1
- package/sdk/dist/namespaces/org.js +122 -71
- package/sdk/dist/namespaces/org.js.map +1 -1
- package/sdk/dist/namespaces/org.types.d.ts +51 -17
- package/sdk/dist/namespaces/org.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/org.types.js +7 -4
- package/sdk/dist/namespaces/org.types.js.map +1 -1
- package/sdk/dist/namespaces/projects.d.ts +44 -16
- package/sdk/dist/namespaces/projects.d.ts.map +1 -1
- package/sdk/dist/namespaces/projects.js +72 -28
- package/sdk/dist/namespaces/projects.js.map +1 -1
- package/sdk/dist/namespaces/projects.types.d.ts +98 -10
- package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
- package/sdk/dist/node/index.d.ts +3 -1
- package/sdk/dist/node/index.d.ts.map +1 -1
- package/sdk/dist/node/index.js +2 -1
- package/sdk/dist/node/index.js.map +1 -1
- package/sdk/dist/node/operator-claim.d.ts +49 -0
- package/sdk/dist/node/operator-claim.d.ts.map +1 -0
- package/sdk/dist/node/operator-claim.js +77 -0
- package/sdk/dist/node/operator-claim.js.map +1 -0
- package/sdk/dist/scoped.d.ts +3 -2
- package/sdk/dist/scoped.d.ts.map +1 -1
- package/sdk/dist/scoped.js +5 -2
- package/sdk/dist/scoped.js.map +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Gateway contract: kychee-com/run402-private#443 (RFC 8628 device-auth bridge).
|
|
19
19
|
*/
|
|
20
|
-
import { ApiError, NetworkError } from "../errors.js";
|
|
20
|
+
import { ApiError, LocalError, NetworkError } from "../errors.js";
|
|
21
21
|
import { OperatorSession } from "./operator-session.js";
|
|
22
22
|
const POLL_ERROR_CODES = new Set([
|
|
23
23
|
"authorization_pending",
|
|
@@ -25,6 +25,58 @@ const POLL_ERROR_CODES = new Set([
|
|
|
25
25
|
"access_denied",
|
|
26
26
|
"expired_token",
|
|
27
27
|
]);
|
|
28
|
+
/**
|
|
29
|
+
* Wallet-owned org claim — `r.operator.claimWalletOrg.*`. The isomorphic
|
|
30
|
+
* (raw-proof) seam: `challenge` issues a nonce; `submit` posts the dual proof
|
|
31
|
+
* (control-plane session bearer + a fresh `SIGN-IN-WITH-X` wallet signature). The
|
|
32
|
+
* Node convenience `signWalletOrgClaim` / `claimWalletOrg` in `@run402/sdk/node`
|
|
33
|
+
* runs the whole dance (read session → challenge → sign → submit).
|
|
34
|
+
*/
|
|
35
|
+
export class ClaimWalletOrg {
|
|
36
|
+
client;
|
|
37
|
+
constructor(client) {
|
|
38
|
+
this.client = client;
|
|
39
|
+
}
|
|
40
|
+
/** Request a single-use challenge nonce the wallet must sign (`POST …/claim-wallet-org/challenge`). */
|
|
41
|
+
async challenge(input) {
|
|
42
|
+
if (!input?.wallet) {
|
|
43
|
+
throw new LocalError("claimWalletOrg.challenge requires { wallet }", "requesting wallet-org claim challenge");
|
|
44
|
+
}
|
|
45
|
+
return this.client.request("/agent/v1/operator/claim-wallet-org/challenge", {
|
|
46
|
+
method: "POST",
|
|
47
|
+
body: { wallet: input.wallet },
|
|
48
|
+
...(input.token ? { headers: { Authorization: `Bearer ${input.token}` }, withAuth: false } : {}),
|
|
49
|
+
context: "requesting wallet-org claim challenge",
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Execute the claim (`POST …/claim-wallet-org`) carrying both proofs: the
|
|
54
|
+
* control-plane session bearer (the human) and the `SIGN-IN-WITH-X` wallet
|
|
55
|
+
* signature. Returns a discriminated {@link ClaimResult}; a `select_org` result
|
|
56
|
+
* is returned (not thrown). Throws {@link StepUpRequiredError} when the session
|
|
57
|
+
* is not passkey-fresh, and `ApiError` (`WALLET_PROOF_INVALID`) on a bad proof.
|
|
58
|
+
*/
|
|
59
|
+
async submit(input) {
|
|
60
|
+
if (!input?.siwx) {
|
|
61
|
+
throw new LocalError("claimWalletOrg.submit requires { siwx } (the SIGN-IN-WITH-X proof)", "claiming wallet org");
|
|
62
|
+
}
|
|
63
|
+
const headers = { "SIGN-IN-WITH-X": input.siwx };
|
|
64
|
+
if (input.token)
|
|
65
|
+
headers.Authorization = `Bearer ${input.token}`;
|
|
66
|
+
const body = {};
|
|
67
|
+
if (input.orgId !== undefined)
|
|
68
|
+
body.org_id = input.orgId;
|
|
69
|
+
if (input.displayName !== undefined)
|
|
70
|
+
body.display_name = input.displayName;
|
|
71
|
+
return this.client.request("/agent/v1/operator/claim-wallet-org", {
|
|
72
|
+
method: "POST",
|
|
73
|
+
body,
|
|
74
|
+
headers,
|
|
75
|
+
withAuth: !input.token,
|
|
76
|
+
context: "claiming wallet org",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
28
80
|
export class Operator {
|
|
29
81
|
client;
|
|
30
82
|
/**
|
|
@@ -36,9 +88,16 @@ export class Operator {
|
|
|
36
88
|
* CLI write-login below. See {@link OperatorSession}.
|
|
37
89
|
*/
|
|
38
90
|
session;
|
|
91
|
+
/**
|
|
92
|
+
* Wallet-owned org claim (v1.82): `r.operator.claimWalletOrg.challenge()` +
|
|
93
|
+
* `.submit()`. The raw dual-proof seam; the Node convenience `claimWalletOrg`
|
|
94
|
+
* in `@run402/sdk/node` runs the full dance.
|
|
95
|
+
*/
|
|
96
|
+
claimWalletOrg;
|
|
39
97
|
constructor(client) {
|
|
40
98
|
this.client = client;
|
|
41
99
|
this.session = new OperatorSession(client);
|
|
100
|
+
this.claimWalletOrg = new ClaimWalletOrg(client);
|
|
42
101
|
}
|
|
43
102
|
/**
|
|
44
103
|
* Begin the device-authorization flow. Unauthenticated. Returns the codes the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.js","sourceRoot":"","sources":["../../src/namespaces/operator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"operator.js","sourceRoot":"","sources":["../../src/namespaces/operator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA+FxD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,uBAAuB;IACvB,WAAW;IACX,eAAe;IACf,eAAe;CAChB,CAAC,CAAC;AAgFH;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,uGAAuG;IACvG,KAAK,CAAC,SAAS,CAAC,KAA0B;QACxC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,UAAU,CAAC,8CAA8C,EAAE,uCAAuC,CAAC,CAAC;QAChH,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAiB,+CAA+C,EAAE;YAC1F,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,MAAM,E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B;SACrC,CAAC,CAAC;IACL,CAAC;IAED,6EAA6E;IAC7E,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,gEAAgE;IAChE,8EAA8E;IAC9E,+DAA+D;IAE/D;;;;OAIG;IACH,oBAAoB,CAAC,MAA0B;QAC7C,MAAM,CAAC,GAAG,IAAI,eAAe,CAAC;YAC5B,YAAY,EAAE,MAAM,CAAC,WAAW;YAChC,cAAc,EAAE,MAAM,CAAC,aAAa;YACpC,qBAAqB,EAAE,MAAM;YAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,yCAAyC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;IACvF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAwB;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsB,mCAAmC,EAAE;YACnF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,aAAa,EAAE,MAAM,CAAC,YAAY;gBAClC,YAAY,EAAE,MAAM,CAAC,WAAW;gBAChC,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB;YACD,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,mCAAmC;SAC7C,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,73 +1,111 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `org` namespace — the org-owned control plane (gateway v1.77
|
|
3
|
-
*
|
|
4
|
-
* invites (owner-gated), and read the control-plane audit trail. All routes use
|
|
5
|
-
* the existing SIWX auth; authorization is a membership lookup, never
|
|
6
|
-
* `wallet == signer`.
|
|
2
|
+
* `org` namespace — the org-owned control plane (gateway v1.77+, first-class in
|
|
3
|
+
* v1.82). Mirrors the `r.projects` / `r.project(id)` idiom:
|
|
7
4
|
*
|
|
8
|
-
*
|
|
9
|
-
* `r.org
|
|
10
|
-
*
|
|
5
|
+
* - `r.orgs` — collection + identity: `create`, `list`, `whoami`.
|
|
6
|
+
* - `r.org(id)` — a resource-scoped sub-client (id pre-bound): `get`,
|
|
7
|
+
* `rename`, `members.*`, `invites.*`, `audit`.
|
|
8
|
+
*
|
|
9
|
+
* All routes use the existing SIWX (or control-plane-session) auth; authorization
|
|
10
|
+
* is a membership lookup, never `wallet == signer`. Mutations (`create`,
|
|
11
|
+
* `rename`, member/invite changes) are step-up gated server-side and may return
|
|
12
|
+
* `STEP_UP_REQUIRED` when driven by a stale control-plane session.
|
|
11
13
|
*/
|
|
12
14
|
import type { Client } from "../kernel.js";
|
|
13
|
-
import type { AddMemberInput, AuditEvent, AuditOptions, CreateInviteInput, MemberMutationResult, MemberRevokeResult, OrgInvite, OrgInviteRevokeResult, OrgMember, OrgMembership, OrgRole, WhoAmIResult } from "./org.types.js";
|
|
14
|
-
/** Member management — `r.org.members.*`. */
|
|
15
|
+
import type { AddMemberInput, AuditEvent, AuditOptions, CreateInviteInput, CreateOrgInput, MemberMutationResult, MemberRevokeResult, OrgDetail, OrgInvite, OrgInviteRevokeResult, OrgMember, OrgMembership, OrgRole, OrgSummary, WhoAmIResult } from "./org.types.js";
|
|
16
|
+
/** Member management — `r.org(id).members.*`. The org id is bound at construction. */
|
|
15
17
|
export declare class OrgMembers {
|
|
16
18
|
private readonly client;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
private readonly orgId;
|
|
20
|
+
constructor(client: Client, orgId: string);
|
|
21
|
+
/** List members of the org (`GET /orgs/v1/:org_id/members`). Any active member. */
|
|
22
|
+
list(): Promise<OrgMember[]>;
|
|
20
23
|
/**
|
|
21
|
-
* Add a member by wallet (`POST /orgs/v1/:
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* Add a member by wallet (`POST /orgs/v1/:org_id/members`). Requires an active
|
|
25
|
+
* `owner` membership. A brand-new wallet is provisioned as a `human` principal;
|
|
26
|
+
* `role` defaults to `"developer"` server-side.
|
|
24
27
|
*/
|
|
25
|
-
add(
|
|
28
|
+
add(input: AddMemberInput): Promise<MemberMutationResult>;
|
|
26
29
|
/**
|
|
27
30
|
* Change a member's role (`PATCH …/members/:principal_id`). Requires `owner`;
|
|
28
31
|
* demoting the org's only active owner fails with `409 LAST_OWNER`.
|
|
29
32
|
*/
|
|
30
|
-
setRole(
|
|
33
|
+
setRole(principalId: string, role: OrgRole): Promise<MemberMutationResult>;
|
|
31
34
|
/**
|
|
32
35
|
* Revoke a member (`DELETE …/members/:principal_id`) — one row, status
|
|
33
36
|
* `revoked`, no key rotation. Requires `owner`; revoking the org's only active
|
|
34
37
|
* owner fails with `409 LAST_OWNER`.
|
|
35
38
|
*/
|
|
36
|
-
revoke(
|
|
39
|
+
revoke(principalId: string): Promise<MemberRevokeResult>;
|
|
37
40
|
}
|
|
38
|
-
/** Email-invite management — `r.org.invites.*`. */
|
|
41
|
+
/** Email-invite management — `r.org(id).invites.*`. The org id is bound at construction. */
|
|
39
42
|
export declare class OrgInvites {
|
|
40
43
|
private readonly client;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
private readonly orgId;
|
|
45
|
+
constructor(client: Client, orgId: string);
|
|
46
|
+
/** List pending email invites (`GET /orgs/v1/:org_id/invites`). Any active member. */
|
|
47
|
+
list(): Promise<OrgInvite[]>;
|
|
44
48
|
/**
|
|
45
49
|
* Invite a person by email (`POST …/invites`); claimed at their first login.
|
|
46
50
|
* Requires `owner` (plus step-up when driven by a control-plane session).
|
|
47
51
|
*/
|
|
48
|
-
create(
|
|
52
|
+
create(input: CreateInviteInput): Promise<OrgInvite>;
|
|
49
53
|
/** Revoke a pending invite by its pending principal id (`DELETE …/invites/:principal_id`). Requires `owner`. */
|
|
50
|
-
revoke(
|
|
54
|
+
revoke(principalId: string): Promise<OrgInviteRevokeResult>;
|
|
51
55
|
}
|
|
52
|
-
|
|
56
|
+
/**
|
|
57
|
+
* A resource-scoped org sub-client returned by `r.org(id)`. The org id is bound
|
|
58
|
+
* at construction; instance operations take no repeated id argument. Mirrors the
|
|
59
|
+
* project-scoped `r.project(id)` shape (narrower scope).
|
|
60
|
+
*/
|
|
61
|
+
export declare class ScopedOrg {
|
|
53
62
|
private readonly client;
|
|
54
|
-
/** Member management (`r.org.members.*`). */
|
|
63
|
+
/** Member management (`r.org(id).members.*`). */
|
|
55
64
|
readonly members: OrgMembers;
|
|
56
|
-
/** Email-invite management (`r.org.invites.*`). */
|
|
65
|
+
/** Email-invite management (`r.org(id).invites.*`). */
|
|
57
66
|
readonly invites: OrgInvites;
|
|
67
|
+
/** The org id this sub-client is bound to. Read-only. */
|
|
68
|
+
readonly orgId: string;
|
|
69
|
+
constructor(client: Client, orgId: string);
|
|
70
|
+
/**
|
|
71
|
+
* Read this org (`GET /orgs/v1/:org_id`) — `{ org_id, display_name, tier, role }`.
|
|
72
|
+
* Any active member may view; a non-member (including a guessed id) gets the
|
|
73
|
+
* same non-revealing `403`.
|
|
74
|
+
*/
|
|
75
|
+
get(): Promise<OrgDetail>;
|
|
76
|
+
/**
|
|
77
|
+
* Rename this org (`PATCH /orgs/v1/:org_id`). Owner-only + step-up gated. Pass
|
|
78
|
+
* `null` or `""` to clear the label. Returns the updated `{ org_id,
|
|
79
|
+
* display_name, tier }`.
|
|
80
|
+
*/
|
|
81
|
+
rename(displayName: string | null): Promise<OrgSummary>;
|
|
82
|
+
/**
|
|
83
|
+
* Control-plane audit trail for this org (`GET /orgs/v1/:org_id/audit`).
|
|
84
|
+
* admin+. Newest-first; page with the `before` cursor.
|
|
85
|
+
*/
|
|
86
|
+
audit(opts?: AuditOptions): Promise<AuditEvent[]>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Org collection + identity — `r.orgs.*`. Operations that are not bound to a
|
|
90
|
+
* single org: create a new org, list the caller's orgs, resolve the principal.
|
|
91
|
+
*/
|
|
92
|
+
export declare class Orgs {
|
|
93
|
+
private readonly client;
|
|
58
94
|
constructor(client: Client);
|
|
95
|
+
/**
|
|
96
|
+
* Create an empty org on the `prototype` tier (`POST /orgs/v1`); the caller
|
|
97
|
+
* becomes `owner`. Accepts only an optional `displayName` — there is no tier at
|
|
98
|
+
* create (paid tiers are a separate flow). Step-up gated; the soft per-owner
|
|
99
|
+
* free-org cap may return `FREE_ORG_OWNER_LIMIT_EXCEEDED`.
|
|
100
|
+
*/
|
|
101
|
+
create(input?: CreateOrgInput): Promise<OrgSummary>;
|
|
102
|
+
/** List the orgs the caller is an active member of (`GET /orgs/v1`), as memberships. */
|
|
103
|
+
list(): Promise<OrgMembership[]>;
|
|
59
104
|
/**
|
|
60
105
|
* Resolve the caller's control-plane principal and its org memberships
|
|
61
106
|
* (`GET /agent/v1/whoami`). This is the REMOTE identity; for the local,
|
|
62
107
|
* network-free wallet/profile identity use `r.whoami()`.
|
|
63
108
|
*/
|
|
64
109
|
whoami(): Promise<WhoAmIResult>;
|
|
65
|
-
/** List the orgs the caller is a member of (`GET /orgs/v1`), as memberships. */
|
|
66
|
-
list(): Promise<OrgMembership[]>;
|
|
67
|
-
/**
|
|
68
|
-
* Control-plane audit trail for an org (`GET /orgs/v1/:billing_account_id/audit`).
|
|
69
|
-
* admin+. Newest-first; page with the `before` cursor.
|
|
70
|
-
*/
|
|
71
|
-
audit(billingAccountId: string, opts?: AuditOptions): Promise<AuditEvent[]>;
|
|
72
110
|
}
|
|
73
111
|
//# sourceMappingURL=org.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/namespaces/org.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/namespaces/org.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,E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C;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEM,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAO1D;;;;OAIG;IACG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;IAM/B;;;;OAIG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;IAQ7D;;;OAGG;IACG,KAAK,CAAC,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAY5D;AAED;;;GAGG;AACH,qBAAa,IAAI;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C;;;;;OAKG;IACG,MAAM,CAAC,KAAK,GAAE,cAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAU7D,wFAAwF;IAClF,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAOtC;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;CAKtC"}
|
|
@@ -1,149 +1,200 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `org` namespace — the org-owned control plane (gateway v1.77
|
|
3
|
-
*
|
|
4
|
-
* invites (owner-gated), and read the control-plane audit trail. All routes use
|
|
5
|
-
* the existing SIWX auth; authorization is a membership lookup, never
|
|
6
|
-
* `wallet == signer`.
|
|
2
|
+
* `org` namespace — the org-owned control plane (gateway v1.77+, first-class in
|
|
3
|
+
* v1.82). Mirrors the `r.projects` / `r.project(id)` idiom:
|
|
7
4
|
*
|
|
8
|
-
*
|
|
9
|
-
* `r.org
|
|
10
|
-
*
|
|
5
|
+
* - `r.orgs` — collection + identity: `create`, `list`, `whoami`.
|
|
6
|
+
* - `r.org(id)` — a resource-scoped sub-client (id pre-bound): `get`,
|
|
7
|
+
* `rename`, `members.*`, `invites.*`, `audit`.
|
|
8
|
+
*
|
|
9
|
+
* All routes use the existing SIWX (or control-plane-session) auth; authorization
|
|
10
|
+
* is a membership lookup, never `wallet == signer`. Mutations (`create`,
|
|
11
|
+
* `rename`, member/invite changes) are step-up gated server-side and may return
|
|
12
|
+
* `STEP_UP_REQUIRED` when driven by a stale control-plane session.
|
|
11
13
|
*/
|
|
12
14
|
import { LocalError } from "../errors.js";
|
|
13
|
-
|
|
14
|
-
if (!billingAccountId) {
|
|
15
|
-
throw new LocalError(`${method} requires a billing_account_id`, context);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/** Member management — `r.org.members.*`. */
|
|
15
|
+
/** Member management — `r.org(id).members.*`. The org id is bound at construction. */
|
|
19
16
|
export class OrgMembers {
|
|
20
17
|
client;
|
|
21
|
-
|
|
18
|
+
orgId;
|
|
19
|
+
constructor(client, orgId) {
|
|
22
20
|
this.client = client;
|
|
21
|
+
this.orgId = orgId;
|
|
23
22
|
}
|
|
24
|
-
/** List members of
|
|
25
|
-
async list(
|
|
26
|
-
|
|
27
|
-
const res = await this.client.request(`/orgs/v1/${encodeURIComponent(billingAccountId)}/members`, { context: "listing org members" });
|
|
23
|
+
/** List members of the org (`GET /orgs/v1/:org_id/members`). Any active member. */
|
|
24
|
+
async list() {
|
|
25
|
+
const res = await this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}/members`, { context: "listing org members" });
|
|
28
26
|
return res.members ?? [];
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
|
-
* Add a member by wallet (`POST /orgs/v1/:
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* Add a member by wallet (`POST /orgs/v1/:org_id/members`). Requires an active
|
|
30
|
+
* `owner` membership. A brand-new wallet is provisioned as a `human` principal;
|
|
31
|
+
* `role` defaults to `"developer"` server-side.
|
|
34
32
|
*/
|
|
35
|
-
async add(
|
|
36
|
-
requireBa(billingAccountId, "org.members.add", "adding org member");
|
|
33
|
+
async add(input) {
|
|
37
34
|
if (!input?.wallet) {
|
|
38
|
-
throw new LocalError("org
|
|
35
|
+
throw new LocalError("org members.add requires { wallet }", "adding org member");
|
|
39
36
|
}
|
|
40
37
|
const body = { wallet: input.wallet };
|
|
41
38
|
if (input.role !== undefined)
|
|
42
39
|
body.role = input.role;
|
|
43
|
-
return this.client.request(`/orgs/v1/${encodeURIComponent(
|
|
40
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}/members`, { method: "POST", body, context: "adding org member" });
|
|
44
41
|
}
|
|
45
42
|
/**
|
|
46
43
|
* Change a member's role (`PATCH …/members/:principal_id`). Requires `owner`;
|
|
47
44
|
* demoting the org's only active owner fails with `409 LAST_OWNER`.
|
|
48
45
|
*/
|
|
49
|
-
async setRole(
|
|
50
|
-
requireBa(billingAccountId, "org.members.setRole", "setting member role");
|
|
46
|
+
async setRole(principalId, role) {
|
|
51
47
|
if (!principalId)
|
|
52
|
-
throw new LocalError("org
|
|
48
|
+
throw new LocalError("org members.setRole requires a principalId", "setting member role");
|
|
53
49
|
if (!role)
|
|
54
|
-
throw new LocalError("org
|
|
55
|
-
return this.client.request(`/orgs/v1/${encodeURIComponent(
|
|
50
|
+
throw new LocalError("org members.setRole requires a role", "setting member role");
|
|
51
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}/members/${encodeURIComponent(principalId)}`, { method: "PATCH", body: { role }, context: "setting member role" });
|
|
56
52
|
}
|
|
57
53
|
/**
|
|
58
54
|
* Revoke a member (`DELETE …/members/:principal_id`) — one row, status
|
|
59
55
|
* `revoked`, no key rotation. Requires `owner`; revoking the org's only active
|
|
60
56
|
* owner fails with `409 LAST_OWNER`.
|
|
61
57
|
*/
|
|
62
|
-
async revoke(
|
|
63
|
-
requireBa(billingAccountId, "org.members.revoke", "revoking org member");
|
|
58
|
+
async revoke(principalId) {
|
|
64
59
|
if (!principalId)
|
|
65
|
-
throw new LocalError("org
|
|
66
|
-
return this.client.request(`/orgs/v1/${encodeURIComponent(
|
|
60
|
+
throw new LocalError("org members.revoke requires a principalId", "revoking org member");
|
|
61
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}/members/${encodeURIComponent(principalId)}`, { method: "DELETE", context: "revoking org member" });
|
|
67
62
|
}
|
|
68
63
|
}
|
|
69
|
-
/** Email-invite management — `r.org.invites.*`. */
|
|
64
|
+
/** Email-invite management — `r.org(id).invites.*`. The org id is bound at construction. */
|
|
70
65
|
export class OrgInvites {
|
|
71
66
|
client;
|
|
72
|
-
|
|
67
|
+
orgId;
|
|
68
|
+
constructor(client, orgId) {
|
|
73
69
|
this.client = client;
|
|
70
|
+
this.orgId = orgId;
|
|
74
71
|
}
|
|
75
|
-
/** List pending email invites (`GET /orgs/v1/:
|
|
76
|
-
async list(
|
|
77
|
-
|
|
78
|
-
const res = await this.client.request(`/orgs/v1/${encodeURIComponent(billingAccountId)}/invites`, { context: "listing org invites" });
|
|
72
|
+
/** List pending email invites (`GET /orgs/v1/:org_id/invites`). Any active member. */
|
|
73
|
+
async list() {
|
|
74
|
+
const res = await this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}/invites`, { context: "listing org invites" });
|
|
79
75
|
return res.invites ?? [];
|
|
80
76
|
}
|
|
81
77
|
/**
|
|
82
78
|
* Invite a person by email (`POST …/invites`); claimed at their first login.
|
|
83
79
|
* Requires `owner` (plus step-up when driven by a control-plane session).
|
|
84
80
|
*/
|
|
85
|
-
async create(
|
|
86
|
-
requireBa(billingAccountId, "org.invites.create", "creating org invite");
|
|
81
|
+
async create(input) {
|
|
87
82
|
if (!input?.email)
|
|
88
|
-
throw new LocalError("org
|
|
83
|
+
throw new LocalError("org invites.create requires { email }", "creating org invite");
|
|
89
84
|
if (!input?.role)
|
|
90
|
-
throw new LocalError("org
|
|
85
|
+
throw new LocalError("org invites.create requires { role }", "creating org invite");
|
|
91
86
|
const body = { email: input.email, role: input.role };
|
|
92
87
|
if (input.inviteTtlHours !== undefined)
|
|
93
88
|
body.invite_ttl_hours = input.inviteTtlHours;
|
|
94
|
-
return this.client.request(`/orgs/v1/${encodeURIComponent(
|
|
89
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}/invites`, { method: "POST", body, context: "creating org invite" });
|
|
95
90
|
}
|
|
96
91
|
/** Revoke a pending invite by its pending principal id (`DELETE …/invites/:principal_id`). Requires `owner`. */
|
|
97
|
-
async revoke(
|
|
98
|
-
requireBa(billingAccountId, "org.invites.revoke", "revoking org invite");
|
|
92
|
+
async revoke(principalId) {
|
|
99
93
|
if (!principalId)
|
|
100
|
-
throw new LocalError("org
|
|
101
|
-
return this.client.request(`/orgs/v1/${encodeURIComponent(
|
|
94
|
+
throw new LocalError("org invites.revoke requires a principalId", "revoking org invite");
|
|
95
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}/invites/${encodeURIComponent(principalId)}`, { method: "DELETE", context: "revoking org invite" });
|
|
102
96
|
}
|
|
103
97
|
}
|
|
104
|
-
|
|
98
|
+
/**
|
|
99
|
+
* A resource-scoped org sub-client returned by `r.org(id)`. The org id is bound
|
|
100
|
+
* at construction; instance operations take no repeated id argument. Mirrors the
|
|
101
|
+
* project-scoped `r.project(id)` shape (narrower scope).
|
|
102
|
+
*/
|
|
103
|
+
export class ScopedOrg {
|
|
105
104
|
client;
|
|
106
|
-
/** Member management (`r.org.members.*`). */
|
|
105
|
+
/** Member management (`r.org(id).members.*`). */
|
|
107
106
|
members;
|
|
108
|
-
/** Email-invite management (`r.org.invites.*`). */
|
|
107
|
+
/** Email-invite management (`r.org(id).invites.*`). */
|
|
109
108
|
invites;
|
|
110
|
-
|
|
109
|
+
/** The org id this sub-client is bound to. Read-only. */
|
|
110
|
+
orgId;
|
|
111
|
+
constructor(client, orgId) {
|
|
111
112
|
this.client = client;
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
if (!orgId)
|
|
114
|
+
throw new LocalError("r.org(id) requires an org id", "scoping client to org");
|
|
115
|
+
this.orgId = orgId;
|
|
116
|
+
this.members = new OrgMembers(client, orgId);
|
|
117
|
+
this.invites = new OrgInvites(client, orgId);
|
|
114
118
|
}
|
|
115
119
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
120
|
+
* Read this org (`GET /orgs/v1/:org_id`) — `{ org_id, display_name, tier, role }`.
|
|
121
|
+
* Any active member may view; a non-member (including a guessed id) gets the
|
|
122
|
+
* same non-revealing `403`.
|
|
119
123
|
*/
|
|
120
|
-
async
|
|
121
|
-
return this.client.request(
|
|
122
|
-
context: "
|
|
124
|
+
async get() {
|
|
125
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}`, {
|
|
126
|
+
context: "reading org",
|
|
123
127
|
});
|
|
124
128
|
}
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Rename this org (`PATCH /orgs/v1/:org_id`). Owner-only + step-up gated. Pass
|
|
131
|
+
* `null` or `""` to clear the label. Returns the updated `{ org_id,
|
|
132
|
+
* display_name, tier }`.
|
|
133
|
+
*/
|
|
134
|
+
async rename(displayName) {
|
|
135
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(this.orgId)}`, {
|
|
136
|
+
method: "PATCH",
|
|
137
|
+
body: { display_name: displayName },
|
|
138
|
+
context: "renaming org",
|
|
129
139
|
});
|
|
130
|
-
return res.orgs ?? [];
|
|
131
140
|
}
|
|
132
141
|
/**
|
|
133
|
-
* Control-plane audit trail for
|
|
142
|
+
* Control-plane audit trail for this org (`GET /orgs/v1/:org_id/audit`).
|
|
134
143
|
* admin+. Newest-first; page with the `before` cursor.
|
|
135
144
|
*/
|
|
136
|
-
async audit(
|
|
137
|
-
requireBa(billingAccountId, "org.audit", "reading org audit trail");
|
|
145
|
+
async audit(opts = {}) {
|
|
138
146
|
const parts = [];
|
|
139
147
|
if (opts.limit !== undefined)
|
|
140
148
|
parts.push(`limit=${encodeURIComponent(String(opts.limit))}`);
|
|
141
149
|
if (opts.before !== undefined)
|
|
142
150
|
parts.push(`before=${encodeURIComponent(opts.before)}`);
|
|
143
151
|
const q = parts.join("&");
|
|
144
|
-
const base = `/orgs/v1/${encodeURIComponent(
|
|
152
|
+
const base = `/orgs/v1/${encodeURIComponent(this.orgId)}/audit`;
|
|
145
153
|
const res = await this.client.request(q ? `${base}?${q}` : base, { context: "reading org audit trail" });
|
|
146
154
|
return res.events ?? res.audit_events ?? [];
|
|
147
155
|
}
|
|
148
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Org collection + identity — `r.orgs.*`. Operations that are not bound to a
|
|
159
|
+
* single org: create a new org, list the caller's orgs, resolve the principal.
|
|
160
|
+
*/
|
|
161
|
+
export class Orgs {
|
|
162
|
+
client;
|
|
163
|
+
constructor(client) {
|
|
164
|
+
this.client = client;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Create an empty org on the `prototype` tier (`POST /orgs/v1`); the caller
|
|
168
|
+
* becomes `owner`. Accepts only an optional `displayName` — there is no tier at
|
|
169
|
+
* create (paid tiers are a separate flow). Step-up gated; the soft per-owner
|
|
170
|
+
* free-org cap may return `FREE_ORG_OWNER_LIMIT_EXCEEDED`.
|
|
171
|
+
*/
|
|
172
|
+
async create(input = {}) {
|
|
173
|
+
const body = {};
|
|
174
|
+
if (input.displayName !== undefined)
|
|
175
|
+
body.display_name = input.displayName;
|
|
176
|
+
return this.client.request("/orgs/v1", {
|
|
177
|
+
method: "POST",
|
|
178
|
+
body,
|
|
179
|
+
context: "creating organization",
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/** List the orgs the caller is an active member of (`GET /orgs/v1`), as memberships. */
|
|
183
|
+
async list() {
|
|
184
|
+
const res = await this.client.request("/orgs/v1", {
|
|
185
|
+
context: "listing organizations",
|
|
186
|
+
});
|
|
187
|
+
return res.orgs ?? [];
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Resolve the caller's control-plane principal and its org memberships
|
|
191
|
+
* (`GET /agent/v1/whoami`). This is the REMOTE identity; for the local,
|
|
192
|
+
* network-free wallet/profile identity use `r.whoami()`.
|
|
193
|
+
*/
|
|
194
|
+
async whoami() {
|
|
195
|
+
return this.client.request("/agent/v1/whoami", {
|
|
196
|
+
context: "resolving principal identity",
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
149
200
|
//# sourceMappingURL=org.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/namespaces/org.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/namespaces/org.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmB1C,sFAAsF;AACtF,MAAM,OAAO,UAAU;IACQ;IAAiC;IAA9D,YAA6B,MAAc,EAAmB,KAAa;QAA9C,WAAM,GAAN,MAAM,CAAQ;QAAmB,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAE/E,mFAAmF;IACnF,KAAK,CAAC,IAAI;QACR,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACnC,YAAY,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EACpD,EAAE,OAAO,EAAE,qBAAqB,EAAE,CACnC,CAAC;QACF,OAAO,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAC,KAAqB;QAC7B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,UAAU,CAAC,qCAAqC,EAAE,mBAAmB,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,IAAI,GAA4B,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/D,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS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