@vectros-ai/cli 0.16.0 → 0.19.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/AUTHORING.md +56 -11
- package/CHANGELOG.md +191 -0
- package/README.md +66 -7
- package/THIRD-PARTY-NOTICES.md +4 -4
- package/dist/cli.js +895 -161
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +895 -161
- package/dist/cli.mjs.map +1 -1
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -4108,7 +4108,7 @@ var AuthClient = class {
|
|
|
4108
4108
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
|
|
4109
4109
|
}
|
|
4110
4110
|
/**
|
|
4111
|
-
* Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. A root API key (`sk_`) is exempt from
|
|
4111
|
+
* Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. Minting a key bound to your OWN principal needs nothing further; minting one bound to a DIFFERENT principal additionally requires the `delegate-mint` capability (`granted_capabilities`) on your credential — without it the request is refused. A root API key (`sk_`) is exempt from all three bounds.
|
|
4112
4112
|
*
|
|
4113
4113
|
* @param {Vectros.CreateScopedKeyRequest} request
|
|
4114
4114
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5604,7 +5604,7 @@ var AuthClient = class {
|
|
|
5604
5604
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
|
|
5605
5605
|
}
|
|
5606
5606
|
/**
|
|
5607
|
-
* Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key sees every context.
|
|
5607
|
+
* Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key sees every context. An ordinary bootstrap credential that didn't specify a context resolves to the `default` app context specifically, not every context — so this call returns 404 for an issuer registered under any other context unless you re-minted the bootstrap token pinned to that context.
|
|
5608
5608
|
*
|
|
5609
5609
|
* @param {Vectros.GetIssuerRequest} request
|
|
5610
5610
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5661,6 +5661,73 @@ var AuthClient = class {
|
|
|
5661
5661
|
}
|
|
5662
5662
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
|
|
5663
5663
|
}
|
|
5664
|
+
/**
|
|
5665
|
+
* Updates the mutable fields of a registered issuer: `subClaim`, `emailClaim`, `status` (`active`/`suspended` — a suspended issuer's tokens are rejected identically to an unregistered issuer at exchange time), and `selfSignupPolicies`. Fields omitted from the body are left unchanged (partial update). `issuer`, `jwksUri`, `audience`, and `contextId` are trust-anchor / routing-pin fields and are immutable via this route — supplying a value that differs from the current registration is rejected with 400; supplying the current value back is a no-op. Rotating a trust anchor requires deleting and re-registering the issuer, which is itself refused while any user is bound through it. Requires a root API key or the bootstrap's provisioning capability, gated identically to every other operation on this surface. A credential confined to one app context may only update an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may update any issuer.
|
|
5666
|
+
*
|
|
5667
|
+
* @param {Vectros.IssuerUpdateRequest} request
|
|
5668
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
5669
|
+
*
|
|
5670
|
+
* @throws {@link Vectros.BadRequestError}
|
|
5671
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
5672
|
+
* @throws {@link Vectros.NotFoundError}
|
|
5673
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
5674
|
+
*
|
|
5675
|
+
* @example
|
|
5676
|
+
* await client.auth.updateIssuer({
|
|
5677
|
+
* issuerId: "auth0-prod"
|
|
5678
|
+
* })
|
|
5679
|
+
*/
|
|
5680
|
+
updateIssuer(request, requestOptions) {
|
|
5681
|
+
return HttpResponsePromise.fromPromise(this.__updateIssuer(request, requestOptions));
|
|
5682
|
+
}
|
|
5683
|
+
async __updateIssuer(request, requestOptions) {
|
|
5684
|
+
const { issuerId, ..._body } = request;
|
|
5685
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
5686
|
+
const _headers = mergeHeaders(
|
|
5687
|
+
_authRequest.headers,
|
|
5688
|
+
this._options?.headers,
|
|
5689
|
+
requestOptions?.headers
|
|
5690
|
+
);
|
|
5691
|
+
const _response = await fetcher({
|
|
5692
|
+
url: url_exports.join(
|
|
5693
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
5694
|
+
`v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
|
|
5695
|
+
),
|
|
5696
|
+
method: "PUT",
|
|
5697
|
+
headers: _headers,
|
|
5698
|
+
contentType: "application/json",
|
|
5699
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
5700
|
+
requestType: "json",
|
|
5701
|
+
body: _body,
|
|
5702
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
5703
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
5704
|
+
abortSignal: requestOptions?.abortSignal,
|
|
5705
|
+
fetchFn: this._options?.fetch,
|
|
5706
|
+
logging: this._options.logging
|
|
5707
|
+
});
|
|
5708
|
+
if (_response.ok) {
|
|
5709
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
5710
|
+
}
|
|
5711
|
+
if (_response.error.reason === "status-code") {
|
|
5712
|
+
switch (_response.error.statusCode) {
|
|
5713
|
+
case 400:
|
|
5714
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
5715
|
+
case 403:
|
|
5716
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
5717
|
+
case 404:
|
|
5718
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
5719
|
+
case 429:
|
|
5720
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
5721
|
+
default:
|
|
5722
|
+
throw new VectrosError({
|
|
5723
|
+
statusCode: _response.error.statusCode,
|
|
5724
|
+
body: _response.error.body,
|
|
5725
|
+
rawResponse: _response.rawResponse
|
|
5726
|
+
});
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/auth/issuers/{issuerId}");
|
|
5730
|
+
}
|
|
5664
5731
|
/**
|
|
5665
5732
|
* Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context may only deregister an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may deregister any issuer. Refused if any user account was ever created or matched via this issuer (by a prior self-signup or accepted invite, through `POST /v1/auth/token/exchange`) — that access cannot be silently orphaned. Deactivate the affected users first if you intend to cut off their access, or register a replacement issuer before removing this one. An issuer that has never been used for an exchange (no bound users yet) can always be deregistered.
|
|
5666
5733
|
*
|
|
@@ -5731,7 +5798,7 @@ var AuthClient = class {
|
|
|
5731
5798
|
);
|
|
5732
5799
|
}
|
|
5733
5800
|
/**
|
|
5734
|
-
* Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only the issuers registered in that context; a root API key sees every context. Returns a `{data, nextCursor}` envelope.
|
|
5801
|
+
* Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only the issuers registered in that context; a root API key sees every context. An ordinary bootstrap credential that didn't specify a context resolves to the `default` app context specifically, not every context — so this call returns an empty page for a tenant whose issuers are all registered under a different context unless you re-minted the bootstrap token pinned to that context. Returns a `{data, nextCursor}` envelope.
|
|
5735
5802
|
*
|
|
5736
5803
|
* @param {Vectros.ListIssuersRequest} request
|
|
5737
5804
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5788,7 +5855,7 @@ var AuthClient = class {
|
|
|
5788
5855
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
|
|
5789
5856
|
}
|
|
5790
5857
|
/**
|
|
5791
|
-
* Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`.
|
|
5858
|
+
* Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. A credential authorized only via the provisioning capability may register only against the app context it is bound to; naming a different one returns 403. A root API key is unaffected and may register against any of its contexts. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant. If `issuerId` collides with a registration owned by a different app context than the one you're confined to, the request fails with 400 rather than returning that context's configuration. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`.
|
|
5792
5859
|
*
|
|
5793
5860
|
* @param {Vectros.IssuerRequest} request
|
|
5794
5861
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5973,6 +6040,7 @@ var AuthClient = class {
|
|
|
5973
6040
|
*
|
|
5974
6041
|
* @throws {@link Vectros.BadRequestError}
|
|
5975
6042
|
* @throws {@link Vectros.ForbiddenError}
|
|
6043
|
+
* @throws {@link Vectros.NotFoundError}
|
|
5976
6044
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
5977
6045
|
*
|
|
5978
6046
|
* @example
|
|
@@ -6026,6 +6094,8 @@ var AuthClient = class {
|
|
|
6026
6094
|
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6027
6095
|
case 403:
|
|
6028
6096
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6097
|
+
case 404:
|
|
6098
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6029
6099
|
case 429:
|
|
6030
6100
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
6031
6101
|
default:
|
|
@@ -6039,7 +6109,7 @@ var AuthClient = class {
|
|
|
6039
6109
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token");
|
|
6040
6110
|
}
|
|
6041
6111
|
/**
|
|
6042
|
-
* Invite a new member to one of your app contexts by email
|
|
6112
|
+
* Invite a new member to one of your app contexts by email, OR grant an existing member access to an additional app context by inviting their same email again. Idempotent on the combination of context and email: re-inviting the same email into the SAME context rotates the token and resends the invitation rather than creating a duplicate — this requires the `users:r` and `users:u` scopes in addition to `users:c`, because resending rotates a credential on an existing invitation and invalidates any link already sent. Without them the collision returns 409 instead, with no invitation details and no change to the outstanding invitation. Inviting the SAME email into a DIFFERENT app context in this tenant, where that email already resolves to an existing member: if that member is active AND already has (or, once accepted, will have) a credential that works for the new context's own identity provider, this immediately grants them access to the new context (no email is sent — there is nothing to accept, `emailSent` is false) — this additionally requires the `users:r` scope (no `users:u`, since nothing is mutated), because the response names the existing member's userId, a fact about them your credential could not otherwise learn through this endpoint. If that active member's ONLY existing credential is for a DIFFERENT identity provider than the one the new context uses, a normal, independent invitation is created instead (its own new member id, a real token/accept link) — attaching them silently would leave no way for them to ever actually sign in to that context. If the existing member's original invitation is still pending, this attaches the new context's access to that same outstanding invitation and rotates its token (`users:r`+`users:u`, same as an ordinary resend — both the disclosure and the credential rotation apply here). A SUSPENDED member's email does not get new-context access this way — reactivate them explicitly first. Returns HTTP 201 in every one of those cases. Returns 409 if that email already belongs to an active or suspended member of THIS specific app context, already has a PENDING invitation for THIS specific app context, or resolves to an existing member elsewhere in the tenant and your token lacks the additional scope the grant/attach requires (`users:r`, or `users:r`+`users:u` for the still-pending case). An email that already has an identity in your OTHER tenant (test vs. live) is not a collision either — it creates an additional, independent membership in this tenant for that same identity. When `sendEmail` is false, the response includes the raw token and a ready-to-use accept link so you can deliver the invitation through your own email provider. Requires the `users:c` scope.
|
|
6043
6113
|
*
|
|
6044
6114
|
* @param {Vectros.CreateInviteRequest} request
|
|
6045
6115
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -6177,6 +6247,83 @@ var AuthClient = class {
|
|
|
6177
6247
|
}
|
|
6178
6248
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
|
|
6179
6249
|
}
|
|
6250
|
+
/**
|
|
6251
|
+
* Re-mints the presented `st_*` scoped token with one or more `identity.<namespace>` values changed — for a caller whose ROLE explicitly grants assuming those values (an invited hr-admin, a multi-org case-handler) and needs to change which value new writes place records under. The request body names one or more namespaces in canonical `scope:<namespace>` form, e.g. `{"scope:org": "orgB"}` — each value must be a plain literal, never a `${{ ... }}` placeholder. When you name MORE THAN ONE namespace, a single one of your roles must grant all of them together: the combination is never assembled from two different roles, because no role author would have vouched for it. `st_*`-only — a root API key or `ssk_*` scoped API key gets 403; neither needs this (root already has full authority, and an `ssk_*`'s identity shape is not what this resolves against).
|
|
6252
|
+
*
|
|
6253
|
+
* **Only an original token may assume.** A token produced BY this endpoint cannot assume again (403) — every assume starts from the token you exchanged for, so the identity you end up with is always one a single role explicitly granted rather than a combination reached by chaining calls. Keep your original token if you need to switch more than once, or exchange for a new one.
|
|
6254
|
+
*
|
|
6255
|
+
* **Entitlement is checked LIVE, against your roles as they are right now** — not against a copy frozen into your token when it was minted. The requested value must be explicitly granted by a role's `assumable` field for that namespace: a POINT check against the one value requested, and a deliberately separate, explicitly-authored question from what the role's `data_scope` permits reading or writing. Holding broad `data_scope` reach in a namespace does NOT by itself grant assuming any value in it.
|
|
6256
|
+
*
|
|
6257
|
+
* **What is preserved, and what is not.** Every clause of your token that does not reference a requested namespace is preserved verbatim, as are all other claims (`partner_user_id`, `context_id`, mint attribution). Clauses that DO reference a requested namespace are kept only if they come from a role that authorized the new value. A role that does not authorize it loses all of its clauses touching that namespace — including any scoped to the value you already held. Assume into a value one role grants and you keep that role's reach, not the reach of roles that never vouched for it.
|
|
6258
|
+
*
|
|
6259
|
+
* The re-minted token's `exp` is IDENTICAL to the presented token's — this call can never extend a session's life. A fresh, independently-revocable `jti` is stamped on every call, and (except when the presented token predates jti support and has none to chain from) the token also carries a `root_jti` revocation-lineage claim so revoking the token you started from closes every value ever assumed from it. Uses the ordinary Vectros `{"message":...}` error shape, not the OAuth envelope `POST /v1/auth/token/exchange` uses — this endpoint's caller is always Vectros-SDK code already holding a bearer token, never generic OAuth tooling.
|
|
6260
|
+
*
|
|
6261
|
+
* @param {Record<string, unknown>} request
|
|
6262
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6263
|
+
*
|
|
6264
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6265
|
+
* @throws {@link Vectros.UnauthorizedError}
|
|
6266
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
6267
|
+
* @throws {@link Vectros.ConflictError}
|
|
6268
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
6269
|
+
*
|
|
6270
|
+
* @example
|
|
6271
|
+
* await client.auth.assumeToken({
|
|
6272
|
+
* "scope:org": "orgB"
|
|
6273
|
+
* })
|
|
6274
|
+
*/
|
|
6275
|
+
assumeToken(request, requestOptions) {
|
|
6276
|
+
return HttpResponsePromise.fromPromise(this.__assumeToken(request, requestOptions));
|
|
6277
|
+
}
|
|
6278
|
+
async __assumeToken(request, requestOptions) {
|
|
6279
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6280
|
+
const _headers = mergeHeaders(
|
|
6281
|
+
_authRequest.headers,
|
|
6282
|
+
this._options?.headers,
|
|
6283
|
+
requestOptions?.headers
|
|
6284
|
+
);
|
|
6285
|
+
const _response = await fetcher({
|
|
6286
|
+
url: url_exports.join(
|
|
6287
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6288
|
+
"v1/auth/token/assume"
|
|
6289
|
+
),
|
|
6290
|
+
method: "POST",
|
|
6291
|
+
headers: _headers,
|
|
6292
|
+
contentType: "application/json",
|
|
6293
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
6294
|
+
requestType: "json",
|
|
6295
|
+
body: request,
|
|
6296
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6297
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6298
|
+
abortSignal: requestOptions?.abortSignal,
|
|
6299
|
+
fetchFn: this._options?.fetch,
|
|
6300
|
+
logging: this._options.logging
|
|
6301
|
+
});
|
|
6302
|
+
if (_response.ok) {
|
|
6303
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
6304
|
+
}
|
|
6305
|
+
if (_response.error.reason === "status-code") {
|
|
6306
|
+
switch (_response.error.statusCode) {
|
|
6307
|
+
case 400:
|
|
6308
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6309
|
+
case 401:
|
|
6310
|
+
throw new UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
6311
|
+
case 403:
|
|
6312
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6313
|
+
case 409:
|
|
6314
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
6315
|
+
case 429:
|
|
6316
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
6317
|
+
default:
|
|
6318
|
+
throw new VectrosError({
|
|
6319
|
+
statusCode: _response.error.statusCode,
|
|
6320
|
+
body: _response.error.body,
|
|
6321
|
+
rawResponse: _response.rawResponse
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
}
|
|
6325
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token/assume");
|
|
6326
|
+
}
|
|
6180
6327
|
/**
|
|
6181
6328
|
* RFC 8693 OAuth 2.0 Token Exchange. Trades a JWT issued by a third-party identity provider you've registered (`POST /v1/auth/issuers`) for a Vectros `st_*` scoped bearer token — no Vectros credential required to call this endpoint. The exchanged token's scope is resolved entirely server-side from the matched user's access profile; this endpoint accepts no caller-supplied scope, resource, or audience parameter (RFC 8693 §2.1's `resource`/`audience`/`scope` are not used in v1 — the registered `(issuer, audience)` pair alone pins the target tenant and app context). On a first-time login (no existing Vectros identity for this subject), two opt-in binding paths exist: `invite_token` (a `PENDING` sub-user invitation), and — if the registration declares one or more self-signup policies — `signup_type` (a brand-new user is created and bound to the policy's configured role). If `invite_token` is present at all, it is the ONLY path tried — a failed invite never falls through to self-signup. Neither field is required for a subject with an existing identity. If your issuer is registered against more than one app context (each via its own audience), `context_id` selects which one to target; omit it when your token's `aud` claim matches only one registered context — the common case, unaffected by this field. Uses the OAuth-standard error envelope (`{"error":..., "error_description":...}`, RFC 6749 §5.2), NOT this API's usual `{"message":...}` shape — its client is generic OAuth tooling, not the Vectros SDK.
|
|
6182
6329
|
*
|
|
@@ -6254,9 +6401,9 @@ var ComplianceClient = class {
|
|
|
6254
6401
|
* @param {Vectros.ErasureRequest} request
|
|
6255
6402
|
* @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6256
6403
|
*
|
|
6404
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6257
6405
|
* @throws {@link Vectros.ForbiddenError}
|
|
6258
6406
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6259
|
-
* @throws {@link Vectros.NotImplementedError}
|
|
6260
6407
|
*
|
|
6261
6408
|
* @example
|
|
6262
6409
|
* await client.compliance.createErasureRequest({
|
|
@@ -6295,12 +6442,12 @@ var ComplianceClient = class {
|
|
|
6295
6442
|
}
|
|
6296
6443
|
if (_response.error.reason === "status-code") {
|
|
6297
6444
|
switch (_response.error.statusCode) {
|
|
6445
|
+
case 400:
|
|
6446
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6298
6447
|
case 403:
|
|
6299
6448
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6300
6449
|
case 429:
|
|
6301
6450
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
6302
|
-
case 501:
|
|
6303
|
-
throw new NotImplementedError(_response.error.body, _response.rawResponse);
|
|
6304
6451
|
default:
|
|
6305
6452
|
throw new VectrosError({
|
|
6306
6453
|
statusCode: _response.error.statusCode,
|
|
@@ -6319,7 +6466,6 @@ var ComplianceClient = class {
|
|
|
6319
6466
|
*
|
|
6320
6467
|
* @throws {@link Vectros.ForbiddenError}
|
|
6321
6468
|
* @throws {@link Vectros.NotFoundError}
|
|
6322
|
-
* @throws {@link Vectros.NotImplementedError}
|
|
6323
6469
|
*
|
|
6324
6470
|
* @example
|
|
6325
6471
|
* await client.compliance.getErasureRequest({
|
|
@@ -6360,8 +6506,6 @@ var ComplianceClient = class {
|
|
|
6360
6506
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6361
6507
|
case 404:
|
|
6362
6508
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6363
|
-
case 501:
|
|
6364
|
-
throw new NotImplementedError(_response.error.body, _response.rawResponse);
|
|
6365
6509
|
default:
|
|
6366
6510
|
throw new VectrosError({
|
|
6367
6511
|
statusCode: _response.error.statusCode,
|
|
@@ -8201,7 +8345,7 @@ var IdentityClient = class {
|
|
|
8201
8345
|
);
|
|
8202
8346
|
}
|
|
8203
8347
|
/**
|
|
8204
|
-
* Retrieves a single scope-namespace registration by name.
|
|
8348
|
+
* Retrieves a single scope-namespace registration by name.
|
|
8205
8349
|
*
|
|
8206
8350
|
* @param {Vectros.GetNamespaceRequest} request
|
|
8207
8351
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8394,7 +8538,7 @@ var IdentityClient = class {
|
|
|
8394
8538
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
|
|
8395
8539
|
}
|
|
8396
8540
|
/**
|
|
8397
|
-
* Returns the scope namespaces in your account
|
|
8541
|
+
* Returns the scope namespaces registered in your account. Returns a `{data, nextCursor}` envelope.
|
|
8398
8542
|
*
|
|
8399
8543
|
* @param {Vectros.ListNamespacesRequest} request
|
|
8400
8544
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8445,7 +8589,7 @@ var IdentityClient = class {
|
|
|
8445
8589
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
|
|
8446
8590
|
}
|
|
8447
8591
|
/**
|
|
8448
|
-
* Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key or the CLI bootstrap's provisioning
|
|
8592
|
+
* Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key or one of the CLI bootstrap's two provisioning capabilities — never an ordinary partner-grantable scope. A bootstrap credential's registration is confined to its own app context UNLESS it additionally holds the tenant-wide namespace-provisioning capability and `contextId` is omitted, in which case it may register a TENANT-WIDE namespace (visible to every context). `org` and `client` are reserved names, registered the same way as any other namespace.
|
|
8449
8593
|
*
|
|
8450
8594
|
* @param {Vectros.RegisterNamespaceRequest} request
|
|
8451
8595
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8515,7 +8659,7 @@ var IdentityClient = class {
|
|
|
8515
8659
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
|
|
8516
8660
|
}
|
|
8517
8661
|
/**
|
|
8518
|
-
* Returns a paginated list of the users in your account. Pass `externalId` to look up a single user by your own identifier. To filter on schema-declared lookup fields, supply `type` and `field` together with one lookup mode: `value` (exact match), `from`+`to` (range), or `prefix`. Requires the `users:r` scope.
|
|
8662
|
+
* Returns a paginated list of the users in your account. Pass `externalId` to look up a single user by your own identifier. To filter on schema-declared lookup fields, supply `type` and `field` together with one lookup mode: `value` (exact match), `from`+`to` (range), or `prefix`. Requires the `users:r` scope. A context-confined credential only sees users who hold an access profile in the credential's own app context — others are silently absent from the page, not an error.
|
|
8519
8663
|
*
|
|
8520
8664
|
* @param {Vectros.ListUsersRequest} request
|
|
8521
8665
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8580,7 +8724,7 @@ var IdentityClient = class {
|
|
|
8580
8724
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users");
|
|
8581
8725
|
}
|
|
8582
8726
|
/**
|
|
8583
|
-
* Creates a user identity in your account. The operation is idempotent on `externalId`: if a user with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing user was returned) tells the two apart. To overwrite an existing user's mutable fields (email, status, payload, schema binding) instead of returning it unchanged, set `?upsert=true` (this also requires the `users:u` scope). Requires the `users:c` scope to create. Being returned the existing user on a collision is a read of that user's data and additionally requires the `users:r` scope — a credential holding `users:c` alone receives a `400` ("already exists") on collision instead of the user.
|
|
8727
|
+
* Creates a user identity in your account. The operation is idempotent on `externalId`: if a user with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing user was returned) tells the two apart. To overwrite an existing user's mutable fields (email, status, payload, schema binding) instead of returning it unchanged, set `?upsert=true` (this also requires the `users:u` scope). Requires the `users:c` scope to create. Being returned the existing user on a collision is a read of that user's data and additionally requires the `users:r` scope — a credential holding `users:c` alone receives a `400` ("already exists") on collision instead of the user. A context-confined credential additionally receives the collision echo (or, with `?upsert=true`, is allowed to overwrite) only when the colliding user holds an access profile in the credential's own app context — a cross-context collision otherwise gets the same uniform `400` instead of the other context's user data. One narrow exception on the plain (non-upsert) echo only: the CLI's no-code bootstrap credential can be echoed a colliding user across app contexts, needed for a blueprint to idempotently re-apply against a service principal it provisioned in a non-default context; this does not extend to `?upsert=true`.
|
|
8584
8728
|
*
|
|
8585
8729
|
* @param {Vectros.CreateUserRequest} request
|
|
8586
8730
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8704,7 +8848,7 @@ var IdentityClient = class {
|
|
|
8704
8848
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/{id}");
|
|
8705
8849
|
}
|
|
8706
8850
|
/**
|
|
8707
|
-
* Updates mutable fields on an existing user (such as email, status, payload, or schema binding). The `type` field is immutable after creation, and `email` cannot be changed while an invitation to that user is still outstanding — revoke the invitation, or invite the new address instead. This endpoint also activates an invited user: a PUT that moves a PENDING user to ACTIVE and carries `inviteToken`, `externalSubject`, and `emailVerifiedAttestation=true` completes the invitation. Requires the `users:u` scope.
|
|
8851
|
+
* Updates mutable fields on an existing user (such as email, status, payload, or schema binding). The `type` field is immutable after creation, and `email` cannot be changed while an invitation to that user is still outstanding — revoke the invitation, or invite the new address instead. This endpoint also activates an invited user: a PUT that moves a PENDING user to ACTIVE and carries `inviteToken`, `externalSubject`, and `emailVerifiedAttestation=true` completes the invitation. **`externalSubject` set this way is NOT an authentication binding and does not enable sign-in anywhere** — not the Vectros DevPortal/Admin App/web apps, and not `/v1/auth/token/exchange` either; both are granted only by the invitee authenticating themselves. If the invitee needs dev-portal/web-app access, send them the invitation link and let them accept it directly. If the invitee needs to sign in via token exchange, have them redeem `inviteToken` themselves at `/v1/auth/token/exchange` with their own credential — Vectros verifies it there and computes its own value for this field from the verified credential. The value you send here is stored exactly as-is, with no normalization, and does NOT automatically match or deduplicate against what a later token-exchange sign-in computes for the same real-world identity. Call this endpoint directly only if you run your own backend and want Vectros to record which of your own users a given account corresponds to — treat this field as informational for that purpose, not as a way to pre-authorize sign-in. Requires the `users:u` scope.
|
|
8708
8852
|
*
|
|
8709
8853
|
* @param {Vectros.UpdateUserRequest} request
|
|
8710
8854
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8771,7 +8915,7 @@ var IdentityClient = class {
|
|
|
8771
8915
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
|
|
8772
8916
|
}
|
|
8773
8917
|
/**
|
|
8774
|
-
* Permanently deletes a user identity. This cannot be undone. If the user is a pending invitation, the associated access profile created for that invitation is also removed. Requires the `users:d` scope. Deleting your account's last OWNER is refused (409) — an account must always retain at least one owner.
|
|
8918
|
+
* Permanently deletes a user identity. This cannot be undone. If the user is a pending invitation, the associated access profile created for that invitation is also removed. Requires the `users:d` scope. Deleting your account's last OWNER is refused (409) — an account must always retain at least one owner. Called by a context-confined credential, deletion is also refused (409) when the user holds access in an app context other than the caller's own — remove the user from the caller's own context first, or use a credential with cross-context reach.
|
|
8775
8919
|
*
|
|
8776
8920
|
* @param {Vectros.DeleteUserRequest} request
|
|
8777
8921
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8832,7 +8976,7 @@ var IdentityClient = class {
|
|
|
8832
8976
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/users/{id}");
|
|
8833
8977
|
}
|
|
8834
8978
|
/**
|
|
8835
|
-
* Looks up users by a schema lookup field, with the query criteria carried in the request body rather than the URL. Use this when looking up by a sensitive (blind-indexed) field: the value is blind-indexed server-side and never appears in the URL, request logs, or proxies. The query semantics are identical to the GET /v1/users lookup, which rejects sensitive-field values and directs you here. Returns a page in the `{data, nextCursor}` envelope. Requires the `users:r` scope.
|
|
8979
|
+
* Looks up users by a schema lookup field, with the query criteria carried in the request body rather than the URL. Use this when looking up by a sensitive (blind-indexed) field: the value is blind-indexed server-side and never appears in the URL, request logs, or proxies. The query semantics are identical to the GET /v1/users lookup, which rejects sensitive-field values and directs you here. Returns a page in the `{data, nextCursor}` envelope. Requires the `users:r` scope. A context-confined credential only sees users who hold an access profile in the credential's own app context — others are silently absent from the page, not an error.
|
|
8836
8980
|
*
|
|
8837
8981
|
* @param {Vectros.IdentityLookupRequest} request
|
|
8838
8982
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -9275,14 +9419,14 @@ var RecordsClient = class {
|
|
|
9275
9419
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
9276
9420
|
}
|
|
9277
9421
|
/**
|
|
9278
|
-
*
|
|
9422
|
+
* Fetches multiple records by ID in one call (`ids`, maximum 100). The response contains only the records you can access — any id that does not exist, belongs to another account/AppContext, or is outside your token's scope is silently omitted, with no per-id existence signal, matching the not-found behavior of the single-record GET. Payloads are hydrated the same way a by-id GET hydrates them (payloads externalized to object storage are rehydrated for this response). Requires the `records:r` scope (and, for a scoped token, `records:r:<type>` per record type).
|
|
9279
9423
|
*
|
|
9280
9424
|
* @param {Vectros.BatchGetRequest} request
|
|
9281
9425
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9282
9426
|
*
|
|
9427
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9283
9428
|
* @throws {@link Vectros.ForbiddenError}
|
|
9284
9429
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
9285
|
-
* @throws {@link Vectros.NotImplementedError}
|
|
9286
9430
|
*
|
|
9287
9431
|
* @example
|
|
9288
9432
|
* await client.records.batchGetRecords()
|
|
@@ -9319,12 +9463,12 @@ var RecordsClient = class {
|
|
|
9319
9463
|
}
|
|
9320
9464
|
if (_response.error.reason === "status-code") {
|
|
9321
9465
|
switch (_response.error.statusCode) {
|
|
9466
|
+
case 400:
|
|
9467
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9322
9468
|
case 403:
|
|
9323
9469
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9324
9470
|
case 429:
|
|
9325
9471
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9326
|
-
case 501:
|
|
9327
|
-
throw new NotImplementedError(_response.error.body, _response.rawResponse);
|
|
9328
9472
|
default:
|
|
9329
9473
|
throw new VectrosError({
|
|
9330
9474
|
statusCode: _response.error.statusCode,
|
|
@@ -10138,7 +10282,7 @@ var SchemasClient = class {
|
|
|
10138
10282
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
10139
10283
|
}
|
|
10140
10284
|
/**
|
|
10141
|
-
* Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `scope` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by
|
|
10285
|
+
* Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `scope` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by `surface=user` lists your account-wide identity schemas regardless of the calling context (a `user`-surfaced schema always has one tenant-wide home). Filtering by `surface=entity` reads your own app context's entity schemas AND the tenant-wide home together, newest first, through a single cursor — an entity schema may live in either home depending on where its namespace is placed (see `POST /v1/namespaces`). Filtering by `record` or `document` lists within the calling context only. Requires the `schemas:r` scope.
|
|
10142
10286
|
*
|
|
10143
10287
|
* @param {Vectros.ListSchemasRequest} request
|
|
10144
10288
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -10426,6 +10570,7 @@ var SchemasClient = class {
|
|
|
10426
10570
|
* @param {Vectros.DeleteSchemaRequest} request
|
|
10427
10571
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
10428
10572
|
*
|
|
10573
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
10429
10574
|
* @throws {@link Vectros.NotFoundError}
|
|
10430
10575
|
* @throws {@link Vectros.ConflictError}
|
|
10431
10576
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
@@ -10465,6 +10610,8 @@ var SchemasClient = class {
|
|
|
10465
10610
|
}
|
|
10466
10611
|
if (_response.error.reason === "status-code") {
|
|
10467
10612
|
switch (_response.error.statusCode) {
|
|
10613
|
+
case 403:
|
|
10614
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
10468
10615
|
case 404:
|
|
10469
10616
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
10470
10617
|
case 409:
|
|
@@ -10933,7 +11080,26 @@ var GrantedCapabilitiesSchema = z.array(z.string().min(1)).optional().superRefin
|
|
|
10933
11080
|
var BlueprintAccessProfileSchema = z.object({
|
|
10934
11081
|
// Validated structurally here; the SCOPE GATE (in @vectros-ai/cli) is
|
|
10935
11082
|
// what enforces the data-plane-only security boundary.
|
|
10936
|
-
|
|
11083
|
+
//
|
|
11084
|
+
// Optional now: mutually exclusive with `roleIds` below (the
|
|
11085
|
+
// `.superRefine` on this schema enforces the XOR, mirroring the platform's
|
|
11086
|
+
// own `AccessProfileDB.validateScopesXorRole`). Exactly one of the two
|
|
11087
|
+
// authors this profile's grant.
|
|
11088
|
+
allowedActions: z.array(z.string().min(1)).min(1).optional(),
|
|
11089
|
+
// Additive role composition: this profile's effective grant is
|
|
11090
|
+
// each named role's own clauses, concatenated in the order listed, instead of
|
|
11091
|
+
// an inline clause authored here. Every id must name a role this SAME
|
|
11092
|
+
// blueprint declares in `roles` (`lintAccessProfileRoleIds` below — the
|
|
11093
|
+
// authoring-time mirror of the platform's same-`(tenantId, contextId)`
|
|
11094
|
+
// check, trivially satisfied here since a blueprint's own `roles` are
|
|
11095
|
+
// always created in its own `contextId`); duplicates are rejected outright
|
|
11096
|
+
// rather than silently deduplicated. Mutually exclusive
|
|
11097
|
+
// with `allowedActions`/`dataScope`/`capabilities` — a role-referencing
|
|
11098
|
+
// profile has no inline clause of its own to carry a dataScope or
|
|
11099
|
+
// capability grant; author those on the referenced Role instead, where
|
|
11100
|
+
// every profile referencing it picks them up uniformly (mirrors how
|
|
11101
|
+
// `assumable` already works for a `roleId`-referencing profile).
|
|
11102
|
+
roleIds: z.array(z.string().min(1)).min(1).optional(),
|
|
10937
11103
|
// Optional ownership binding: { userId: [...], "scope:org": [...], "scope:client": [...] }.
|
|
10938
11104
|
// A `null` element in a value list is the documented NULL SENTINEL — it
|
|
10939
11105
|
// grants access to TENANT-LEVEL (owner-less) records IN ADDITION to the
|
|
@@ -10981,13 +11147,54 @@ var BlueprintAccessProfileSchema = z.object({
|
|
|
10981
11147
|
// a person is bound to. The gate should weigh the two separately rather
|
|
10982
11148
|
// than reuse one policy for both.
|
|
10983
11149
|
capabilities: GrantedCapabilitiesSchema
|
|
10984
|
-
}).strict()
|
|
11150
|
+
}).strict().superRefine((ap, ctx) => {
|
|
11151
|
+
const hasInline = ap.allowedActions !== void 0;
|
|
11152
|
+
const hasRoleIds = ap.roleIds !== void 0;
|
|
11153
|
+
if (hasInline === hasRoleIds) {
|
|
11154
|
+
ctx.addIssue({
|
|
11155
|
+
code: z.ZodIssueCode.custom,
|
|
11156
|
+
path: ["roleIds"],
|
|
11157
|
+
message: hasInline ? "accessProfile carries both 'allowedActions' and 'roleIds' \u2014 provide exactly one: an inline clause (allowedActions, optionally dataScope/capabilities) OR a role composition (roleIds), never both" : "accessProfile carries neither 'allowedActions' nor 'roleIds' \u2014 provide exactly one: an inline clause (allowedActions, optionally dataScope/capabilities) OR a role composition (roleIds)"
|
|
11158
|
+
});
|
|
11159
|
+
return;
|
|
11160
|
+
}
|
|
11161
|
+
if (hasRoleIds) {
|
|
11162
|
+
if (ap.dataScope !== void 0) {
|
|
11163
|
+
ctx.addIssue({
|
|
11164
|
+
code: z.ZodIssueCode.custom,
|
|
11165
|
+
path: ["dataScope"],
|
|
11166
|
+
message: "accessProfile.dataScope is not valid alongside 'roleIds' \u2014 a role-composed profile has no inline clause of its own; author dataScope on the referenced role's clause instead"
|
|
11167
|
+
});
|
|
11168
|
+
}
|
|
11169
|
+
if (ap.capabilities !== void 0) {
|
|
11170
|
+
ctx.addIssue({
|
|
11171
|
+
code: z.ZodIssueCode.custom,
|
|
11172
|
+
path: ["capabilities"],
|
|
11173
|
+
message: "accessProfile.capabilities is not valid alongside 'roleIds' \u2014 a role-composed profile has no inline clause of its own; author capabilities on the referenced role's clause instead"
|
|
11174
|
+
});
|
|
11175
|
+
}
|
|
11176
|
+
}
|
|
11177
|
+
});
|
|
10985
11178
|
var BlueprintRoleClauseSchema = z.object({
|
|
10986
11179
|
allowedActions: z.array(z.string().min(1)).min(1),
|
|
10987
11180
|
dataScope: z.record(z.array(z.union([z.string().min(1), z.null()]))).optional(),
|
|
11181
|
+
dataScopeRef: z.string().min(1).optional(),
|
|
10988
11182
|
capabilities: GrantedCapabilitiesSchema
|
|
10989
|
-
}).strict()
|
|
11183
|
+
}).strict().superRefine((c, ctx) => {
|
|
11184
|
+
if (c.dataScope !== void 0 && c.dataScopeRef !== void 0) {
|
|
11185
|
+
ctx.addIssue({
|
|
11186
|
+
code: z.ZodIssueCode.custom,
|
|
11187
|
+
path: ["dataScopeRef"],
|
|
11188
|
+
message: "a clause may declare 'dataScope' OR 'dataScopeRef', not both \u2014 dataScopeRef is sugar for an inline dataScope fragment, so the two are alternatives for the same slot, not additive"
|
|
11189
|
+
});
|
|
11190
|
+
}
|
|
11191
|
+
});
|
|
11192
|
+
var BlueprintFragmentsSchema = z.record(
|
|
11193
|
+
z.record(z.array(z.union([z.string().min(1), z.null()])))
|
|
11194
|
+
);
|
|
10990
11195
|
var BlueprintRolesSchema = z.record(z.array(BlueprintRoleClauseSchema).min(1));
|
|
11196
|
+
var BlueprintRoleAssumableSchema = z.record(z.array(z.string().min(1)).min(1));
|
|
11197
|
+
var BlueprintRoleAssumableMapSchema = z.record(BlueprintRoleAssumableSchema);
|
|
10991
11198
|
var IDENTITY_NAMESPACE_RE = /^[a-z][a-z0-9_-]{1,31}$/;
|
|
10992
11199
|
var FORBIDDEN_IDENTITY_NAMESPACES = /* @__PURE__ */ new Set(["record", "document", "entity", "user"]);
|
|
10993
11200
|
var IdentityKindSchema = z.string().min(1).superRefine((val, ctx) => {
|
|
@@ -11051,6 +11258,14 @@ var BlueprintIssuerSchema = z.object({
|
|
|
11051
11258
|
subClaim: z.string().min(1).optional(),
|
|
11052
11259
|
/** The claim carrying the subject's email (first-login invite matching). Platform defaults to 'email' when omitted. */
|
|
11053
11260
|
emailClaim: z.string().min(1).optional(),
|
|
11261
|
+
/**
|
|
11262
|
+
* The IdP's OIDC userinfo endpoint. Optional. Presented tokens are access tokens, which under
|
|
11263
|
+
* OIDC don't carry `email` unless the IdP was specifically configured to add it — if
|
|
11264
|
+
* `emailClaim` misses on the presented token, and `userinfoUri` is configured, Vectros falls
|
|
11265
|
+
* back to calling this endpoint (with the presented token as the bearer credential) and reads
|
|
11266
|
+
* `emailClaim` from its JSON response instead. Omit to leave the fallback disabled.
|
|
11267
|
+
*/
|
|
11268
|
+
userinfoUri: z.string().min(1).optional(),
|
|
11054
11269
|
/**
|
|
11055
11270
|
* Opt-in self-service signup: a list of {signupType, roleId} pairs. When a first-time exchange
|
|
11056
11271
|
* caller presents no invite token but names a signupType matching one of these (or omits it and
|
|
@@ -11080,6 +11295,24 @@ var BlueprintNamespaceSchema = z.object({
|
|
|
11080
11295
|
* free-form strings validated by grammar only.
|
|
11081
11296
|
*/
|
|
11082
11297
|
entityBacked: z.boolean().optional(),
|
|
11298
|
+
/**
|
|
11299
|
+
* Request the platform's TENANT-WIDE registration form instead of this
|
|
11300
|
+
* blueprint's own context — visible to every context in the account, not
|
|
11301
|
+
* just the one this blueprint provisions. `false`/omitted (the default)
|
|
11302
|
+
* is the ordinary, context-owned registration every other namespace here
|
|
11303
|
+
* gets. Mutually exclusive with any future context-targeting field this
|
|
11304
|
+
* schema may grow — there is exactly one way to say "not my own context"
|
|
11305
|
+
* today.
|
|
11306
|
+
*
|
|
11307
|
+
* A blueprint declaring this does NOT get it automatically: the applying
|
|
11308
|
+
* credential must separately hold a platform capability granted only to
|
|
11309
|
+
* an account OWNER, and the CLI refuses to even request it unless
|
|
11310
|
+
* explicitly told to (see `--allow-tenant-wide-namespaces`) — no flag,
|
|
11311
|
+
* no request, regardless of what this field says. Setting this to `true`
|
|
11312
|
+
* states the blueprint's INTENT; it is not, on its own, a grant of
|
|
11313
|
+
* anything.
|
|
11314
|
+
*/
|
|
11315
|
+
tenantWide: z.boolean().optional(),
|
|
11083
11316
|
/**
|
|
11084
11317
|
* This namespace's position in your account's specificity order (used to
|
|
11085
11318
|
* break a tie when a caller holds two scope dimensions at once). Required
|
|
@@ -11263,7 +11496,7 @@ function lintSelfTokenPlacement(value, ctx) {
|
|
|
11263
11496
|
ctx.addIssue({
|
|
11264
11497
|
code: z.ZodIssueCode.custom,
|
|
11265
11498
|
path: path4,
|
|
11266
|
-
message: "'${{ self.* }}' / '${{ member.* }}' is a runtime placeholder \u2014 it is only valid inside a roles[].dataScope value"
|
|
11499
|
+
message: "'${{ self.* }}' / '${{ member.* }}' is a runtime placeholder \u2014 it is only valid inside a roles[].dataScope value, a roleAssumable[] value, or a fragments[] value"
|
|
11267
11500
|
});
|
|
11268
11501
|
}
|
|
11269
11502
|
return;
|
|
@@ -11274,7 +11507,10 @@ function lintSelfTokenPlacement(value, ctx) {
|
|
|
11274
11507
|
}
|
|
11275
11508
|
if (node && typeof node === "object") {
|
|
11276
11509
|
for (const [k, v] of Object.entries(node)) {
|
|
11277
|
-
const
|
|
11510
|
+
const inRoleDataScopeClause = path4.length === 3 && path4[0] === "roles" && k === "dataScope";
|
|
11511
|
+
const inRoleAssumable = path4.length === 0 && k === "roleAssumable";
|
|
11512
|
+
const inFragments = path4.length === 0 && k === "fragments";
|
|
11513
|
+
const entering = inRoleDataScope || inRoleDataScopeClause || inRoleAssumable || inFragments;
|
|
11278
11514
|
walk(v, [...path4, k], entering);
|
|
11279
11515
|
}
|
|
11280
11516
|
}
|
|
@@ -11445,6 +11681,140 @@ function lintDataScopeKeys(value, ctx) {
|
|
|
11445
11681
|
}
|
|
11446
11682
|
});
|
|
11447
11683
|
}
|
|
11684
|
+
for (const [name, fragment] of Object.entries(bp.fragments ?? {})) {
|
|
11685
|
+
for (const key of Object.keys(fragment ?? {})) {
|
|
11686
|
+
lintDataScopeKey(key, ["fragments", name, key], ctx);
|
|
11687
|
+
}
|
|
11688
|
+
}
|
|
11689
|
+
}
|
|
11690
|
+
function lintDataScopeRefs(value, ctx) {
|
|
11691
|
+
const bp = value;
|
|
11692
|
+
const declared = new Set(Object.keys(bp.fragments ?? {}));
|
|
11693
|
+
for (const [roleId, clauses] of Object.entries(bp.roles ?? {})) {
|
|
11694
|
+
clauses.forEach((clause, i) => {
|
|
11695
|
+
if (clause.dataScopeRef === void 0) return;
|
|
11696
|
+
if (!declared.has(clause.dataScopeRef)) {
|
|
11697
|
+
ctx.addIssue({
|
|
11698
|
+
code: z.ZodIssueCode.custom,
|
|
11699
|
+
path: ["roles", roleId, i, "dataScopeRef"],
|
|
11700
|
+
message: `dataScopeRef '${clause.dataScopeRef}' is not declared in fragments \u2014 declared fragments: ` + (declared.size ? [...declared].join(", ") : "(none)")
|
|
11701
|
+
});
|
|
11702
|
+
}
|
|
11703
|
+
});
|
|
11704
|
+
}
|
|
11705
|
+
}
|
|
11706
|
+
var BARE_SELF_PLACEHOLDER_RE = /^\$\{\{\s*self\.[^}]*?\s*\}\}$/;
|
|
11707
|
+
var UNDER_SELF_PLACEHOLDER_RE = /^\$\{\{\s*under\.self\.userId\s*\}\}$/;
|
|
11708
|
+
var UNDER_SELF_SCOPE_PLACEHOLDER_RE = /^\$\{\{\s*under\.self\.scope\.[a-z][a-z0-9_-]{1,31}\s*\}\}$/;
|
|
11709
|
+
var MEMBER_SCOPE_PLACEHOLDER_RE = /^\$\{\{\s*member\.scope\.[a-z][a-z0-9_-]{1,31}(?::[a-z][a-z0-9_-]{1,31})?\s*\}\}$/;
|
|
11710
|
+
var ANY_PLACEHOLDER_RE = /^\$\{\{\s*any\s*\}\}$/;
|
|
11711
|
+
function assumableValueError(publicKey, v) {
|
|
11712
|
+
if (UNDER_SELF_PLACEHOLDER_RE.test(v) || MEMBER_SCOPE_PLACEHOLDER_RE.test(v)) return null;
|
|
11713
|
+
if (UNDER_SELF_SCOPE_PLACEHOLDER_RE.test(v)) {
|
|
11714
|
+
return `assumable['${publicKey}'] value '${v}' resolves against your own current value for that namespace, which an assume can itself change \u2014 so what this grant admits would depend on what was last assumed. Use '\${{ under.self.userId }}', '\${{ member.scope.<namespace>[:level] }}', or a plain literal, all of which mean the same thing before and after an assume. ('\${{ under.self.scope.<namespace> }}' remains valid in dataScope, where it is re-derived per write)`;
|
|
11715
|
+
}
|
|
11716
|
+
if (ANY_PLACEHOLDER_RE.test(v)) {
|
|
11717
|
+
return `assumable['${publicKey}'] value '${v}' is not a concrete value and cannot be authored as an assumable grant \u2014 name the specific value(s) holders of this role may become`;
|
|
11718
|
+
}
|
|
11719
|
+
if (BARE_SELF_PLACEHOLDER_RE.test(v)) {
|
|
11720
|
+
return `assumable['${publicKey}'] value '${v}' is the bare self placeholder, which is tautological here \u2014 it can only ever equal whatever identity currently is, never a distinct value to become. Use '\${{ under.self.userId }}', '\${{ member.scope.<namespace>[:level] }}', or a plain literal instead`;
|
|
11721
|
+
}
|
|
11722
|
+
if (SELF_TOKEN_RE.test(v)) {
|
|
11723
|
+
return `assumable['${publicKey}'] value '${v}' is not a recognized runtime placeholder \u2014 use '\${{ under.self.userId }}' or '\${{ member.scope.<namespace>[:level] }}'`;
|
|
11724
|
+
}
|
|
11725
|
+
if (!SCOPE_VALUE_RE.test(v)) {
|
|
11726
|
+
return `assumable['${publicKey}'] value '${v}' is not a valid scope value \u2014 1-128 characters, starting with a letter or digit and continuing with letters, digits, '_' or '-'`;
|
|
11727
|
+
}
|
|
11728
|
+
return null;
|
|
11729
|
+
}
|
|
11730
|
+
function lintAccessProfileRoleIds(value, ctx) {
|
|
11731
|
+
const bp = value;
|
|
11732
|
+
const roleIds = bp.accessProfile?.roleIds;
|
|
11733
|
+
if (!roleIds) return;
|
|
11734
|
+
const declaredRoles = new Set(Object.keys(bp.roles ?? {}));
|
|
11735
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11736
|
+
roleIds.forEach((roleId, i) => {
|
|
11737
|
+
const path4 = ["accessProfile", "roleIds", i];
|
|
11738
|
+
if (!declaredRoles.has(roleId)) {
|
|
11739
|
+
ctx.addIssue({
|
|
11740
|
+
code: z.ZodIssueCode.custom,
|
|
11741
|
+
path: path4,
|
|
11742
|
+
message: `accessProfile.roleIds names '${roleId}', which is not a role this blueprint declares in roles \u2014 ` + (declaredRoles.size ? `declared roles: ${[...declaredRoles].join(", ")}` : "declared roles: (none)")
|
|
11743
|
+
});
|
|
11744
|
+
}
|
|
11745
|
+
if (seen.has(roleId)) {
|
|
11746
|
+
ctx.addIssue({
|
|
11747
|
+
code: z.ZodIssueCode.custom,
|
|
11748
|
+
path: path4,
|
|
11749
|
+
message: `accessProfile.roleIds names '${roleId}' more than once \u2014 remove the duplicate`
|
|
11750
|
+
});
|
|
11751
|
+
}
|
|
11752
|
+
seen.add(roleId);
|
|
11753
|
+
});
|
|
11754
|
+
}
|
|
11755
|
+
function lintRoleAssumable(value, ctx) {
|
|
11756
|
+
const bp = value;
|
|
11757
|
+
const declaredRoles = new Set(Object.keys(bp.roles ?? {}));
|
|
11758
|
+
for (const [roleId, assumable] of Object.entries(bp.roleAssumable ?? {})) {
|
|
11759
|
+
if (!declaredRoles.has(roleId)) {
|
|
11760
|
+
ctx.addIssue({
|
|
11761
|
+
code: z.ZodIssueCode.custom,
|
|
11762
|
+
path: ["roleAssumable", roleId],
|
|
11763
|
+
message: `roleAssumable names '${roleId}', which is not a role this blueprint declares in roles \u2014 ` + (declaredRoles.size ? `declared roles: ${[...declaredRoles].join(", ")}` : "declared roles: (none)")
|
|
11764
|
+
});
|
|
11765
|
+
continue;
|
|
11766
|
+
}
|
|
11767
|
+
for (const [key, values] of Object.entries(assumable)) {
|
|
11768
|
+
const path4 = ["roleAssumable", roleId, key];
|
|
11769
|
+
if (key === "userId") {
|
|
11770
|
+
ctx.addIssue({
|
|
11771
|
+
code: z.ZodIssueCode.custom,
|
|
11772
|
+
path: path4,
|
|
11773
|
+
message: "assumable cannot name the principal ('userId') \u2014 the principal is never assumable via /assume, and a grant for it would save but could never be exercised"
|
|
11774
|
+
});
|
|
11775
|
+
continue;
|
|
11776
|
+
}
|
|
11777
|
+
const ns = key.startsWith("scope:") ? key.slice("scope:".length) : null;
|
|
11778
|
+
const nsError = ns === null ? null : scopeNamespaceGrammarError(ns);
|
|
11779
|
+
if (ns === null || nsError !== null) {
|
|
11780
|
+
ctx.addIssue({
|
|
11781
|
+
code: z.ZodIssueCode.custom,
|
|
11782
|
+
path: path4,
|
|
11783
|
+
message: ns === null ? `'${key}' is not allowed \u2014 assumable keys must be a namespaced 'scope:<namespace>' key (the principal cannot be named)` : `assumable['${key}'] ${nsError}`
|
|
11784
|
+
});
|
|
11785
|
+
continue;
|
|
11786
|
+
}
|
|
11787
|
+
if (!Array.isArray(values)) continue;
|
|
11788
|
+
values.forEach((v, i) => {
|
|
11789
|
+
if (typeof v !== "string") return;
|
|
11790
|
+
const err = assumableValueError(key, v);
|
|
11791
|
+
if (err) ctx.addIssue({ code: z.ZodIssueCode.custom, path: [...path4, i], message: err });
|
|
11792
|
+
});
|
|
11793
|
+
}
|
|
11794
|
+
}
|
|
11795
|
+
}
|
|
11796
|
+
function expandDataScopeRefs(bp) {
|
|
11797
|
+
if (!bp.roles) return bp;
|
|
11798
|
+
const fragments = bp.fragments ?? {};
|
|
11799
|
+
let changedAnyRole = false;
|
|
11800
|
+
const roles = {};
|
|
11801
|
+
for (const [roleId, clauses] of Object.entries(bp.roles)) {
|
|
11802
|
+
let changedThisRole = false;
|
|
11803
|
+
const expandedClauses = clauses.map((clause) => {
|
|
11804
|
+
if (clause.dataScopeRef === void 0) return clause;
|
|
11805
|
+
changedThisRole = true;
|
|
11806
|
+
const { dataScopeRef, ...rest } = clause;
|
|
11807
|
+
if (!(dataScopeRef in fragments)) {
|
|
11808
|
+
throw new Error(
|
|
11809
|
+
`expandDataScopeRefs: dataScopeRef '${dataScopeRef}' does not resolve against fragments \u2014 this should have been caught by lintDataScopeRefs before parseBlueprint reaches this function`
|
|
11810
|
+
);
|
|
11811
|
+
}
|
|
11812
|
+
return { ...rest, dataScope: fragments[dataScopeRef] };
|
|
11813
|
+
});
|
|
11814
|
+
roles[roleId] = changedThisRole ? expandedClauses : clauses;
|
|
11815
|
+
changedAnyRole = changedAnyRole || changedThisRole;
|
|
11816
|
+
}
|
|
11817
|
+
return changedAnyRole ? { ...bp, roles } : bp;
|
|
11448
11818
|
}
|
|
11449
11819
|
function lintSeedSurfaces(value, ctx) {
|
|
11450
11820
|
const bp = value;
|
|
@@ -11515,6 +11885,24 @@ var BlueprintSchema = z.object({
|
|
|
11515
11885
|
seed: z.array(BlueprintSeedRecordSchema).optional(),
|
|
11516
11886
|
/** Optional multi-clause roles, bound to principals via `access grant --role`. */
|
|
11517
11887
|
roles: BlueprintRolesSchema.optional(),
|
|
11888
|
+
/**
|
|
11889
|
+
* Optional roleId → `POST /v1/auth/token/assume`
|
|
11890
|
+
* entitlement grant, mirroring the platform's role create/update request
|
|
11891
|
+
* and response shape for this field. Kept separate from `roles` rather
|
|
11892
|
+
* than folded into a role entry — see {@link BlueprintRoleAssumableMapSchema}'s
|
|
11893
|
+
* own doc comment for why. Every key must name a role this blueprint
|
|
11894
|
+
* declares in `roles` (`lintRoleAssumable`).
|
|
11895
|
+
*/
|
|
11896
|
+
roleAssumable: BlueprintRoleAssumableMapSchema.optional(),
|
|
11897
|
+
/**
|
|
11898
|
+
* Optional named `dataScope` fragments, each
|
|
11899
|
+
* referenceable from a role clause via `dataScopeRef: <name>` instead of
|
|
11900
|
+
* repeating the same map inline. Purely local authoring sugar: not a
|
|
11901
|
+
* provisioned resource (absent from `BLUEPRINT_FIELD_PHASES`), and never
|
|
11902
|
+
* survives `parseBlueprint` as a live reference — see
|
|
11903
|
+
* {@link expandDataScopeRefs}.
|
|
11904
|
+
*/
|
|
11905
|
+
fragments: BlueprintFragmentsSchema.optional(),
|
|
11518
11906
|
/** Optional principals ensured-exist at apply; referenced via ${{ identities.* }}. */
|
|
11519
11907
|
identities: IdentitiesDeclSchema.optional(),
|
|
11520
11908
|
/**
|
|
@@ -11539,6 +11927,9 @@ var BlueprintSchema = z.object({
|
|
|
11539
11927
|
lintIdentityOverrides(bp, ctx);
|
|
11540
11928
|
lintNamespacedScopeArrays(bp, ctx);
|
|
11541
11929
|
lintDataScopeKeys(bp, ctx);
|
|
11930
|
+
lintDataScopeRefs(bp, ctx);
|
|
11931
|
+
lintRoleAssumable(bp, ctx);
|
|
11932
|
+
lintAccessProfileRoleIds(bp, ctx);
|
|
11542
11933
|
lintSeedSurfaces(bp, ctx);
|
|
11543
11934
|
lintIdentitySurfaces(bp, ctx);
|
|
11544
11935
|
lintIssuerContext(bp, ctx);
|
|
@@ -11578,7 +11969,7 @@ function parseBlueprint(input) {
|
|
|
11578
11969
|
throw new BlueprintValidationError(`Malformed blueprint:
|
|
11579
11970
|
${renderIssues(issues)}`, issues);
|
|
11580
11971
|
}
|
|
11581
|
-
return result.data;
|
|
11972
|
+
return expandDataScopeRefs(result.data);
|
|
11582
11973
|
}
|
|
11583
11974
|
function contextNameOf(blueprint) {
|
|
11584
11975
|
return blueprint.contextName ?? `MCP \u2014 ${blueprint.name}`;
|
|
@@ -11698,6 +12089,7 @@ var WHOLE_TOKEN_RE = /^\$\{\{\s*([A-Za-z_]\w*)\.([A-Za-z_]\w*)\s*\}\}$/;
|
|
|
11698
12089
|
var TOKEN_SCAN_RE = /\$\$\{\{|\$\{\{([\s\S]*?)\}\}|\$\{\{/g;
|
|
11699
12090
|
var INNER_REF_RE = /^([A-Za-z_]\w*)\.([A-Za-z_]\w*)$/;
|
|
11700
12091
|
var DEFERRED_NAMESPACES = /* @__PURE__ */ new Set(["self", "identities", "under", "member"]);
|
|
12092
|
+
var DEFERRED_BARE_TOKENS = /* @__PURE__ */ new Set(["any"]);
|
|
11701
12093
|
var DEFERRED_NS_ALTERNATION = [...DEFERRED_NAMESPACES].join("|");
|
|
11702
12094
|
var DEFERRED_INNER_RE = new RegExp(
|
|
11703
12095
|
`^(?:${DEFERRED_NS_ALTERNATION})(?:\\.[A-Za-z_]\\w*)+(?::[A-Za-z_]\\w*)?$`
|
|
@@ -11759,7 +12151,7 @@ function interpolate(str, ctx, path4) {
|
|
|
11759
12151
|
});
|
|
11760
12152
|
} else {
|
|
11761
12153
|
const inner = (m[1] ?? "").trim();
|
|
11762
|
-
if (DEFERRED_INNER_RE.test(inner)) {
|
|
12154
|
+
if (DEFERRED_INNER_RE.test(inner) || DEFERRED_BARE_TOKENS.has(inner)) {
|
|
11763
12155
|
out += m[0];
|
|
11764
12156
|
last = TOKEN_SCAN_RE.lastIndex;
|
|
11765
12157
|
continue;
|
|
@@ -14057,7 +14449,12 @@ async function resolveAuthContext(opts) {
|
|
|
14057
14449
|
const baseUrl = envToBaseUrl(opts.env, opts.baseUrl ?? process.env.VECTROS_API_BASE_URL);
|
|
14058
14450
|
const cognitoToken = await resolveCognitoToken(opts.env, opts.token);
|
|
14059
14451
|
const tenant = opts.tenant ?? "live";
|
|
14060
|
-
const bridge = opts.provisioning ? await mintBridgeToken({
|
|
14452
|
+
const bridge = opts.provisioning ? await mintBridgeToken({
|
|
14453
|
+
cognitoToken,
|
|
14454
|
+
apiBaseUrl: baseUrl,
|
|
14455
|
+
tenant,
|
|
14456
|
+
...opts.context ? { contextId: opts.context } : {}
|
|
14457
|
+
}) : await mintContextToken({ cognitoToken, apiBaseUrl: baseUrl, contextId: opts.context ?? "default", tenant });
|
|
14061
14458
|
const client = new VectrosClient({ token: bridge.token, environment: baseUrl });
|
|
14062
14459
|
const identity = await resolveIdentity({ log: opts.log, apiKey: bridge.token, environment: baseUrl });
|
|
14063
14460
|
return {
|
|
@@ -14199,6 +14596,9 @@ var SELF_QUALIFIED_OPS = /* @__PURE__ */ new Map([
|
|
|
14199
14596
|
var UNQUALIFIABLE_WITH_ANY_TAIL = /* @__PURE__ */ new Map([
|
|
14200
14597
|
["profiles", /* @__PURE__ */ new Set(["r"])]
|
|
14201
14598
|
]);
|
|
14599
|
+
var CAPABILITY_UNLOCKED_OPS = /* @__PURE__ */ new Map([
|
|
14600
|
+
["profiles", /* @__PURE__ */ new Map([["c", "member-lifecycle"]])]
|
|
14601
|
+
]);
|
|
14202
14602
|
var VALID_OPS = /* @__PURE__ */ new Set(["c", "r", "u", "d"]);
|
|
14203
14603
|
var DATA_PLANE_SET = new Set(DATA_PLANE_ALLOWLIST);
|
|
14204
14604
|
var CONTROL_PLANE_SET = new Set(KNOWN_CONTROL_PLANE_RESOURCES);
|
|
@@ -14268,7 +14668,7 @@ function firstInvalidOp(ops) {
|
|
|
14268
14668
|
}
|
|
14269
14669
|
return void 0;
|
|
14270
14670
|
}
|
|
14271
|
-
function evaluateScopeToken(action) {
|
|
14671
|
+
function evaluateScopeToken(action, capabilities) {
|
|
14272
14672
|
const token = action.trim();
|
|
14273
14673
|
if (token.length === 0) {
|
|
14274
14674
|
return { action, reason: "empty scope token" };
|
|
@@ -14319,9 +14719,12 @@ function evaluateScopeToken(action) {
|
|
|
14319
14719
|
if (admittedOps?.has(ch)) continue;
|
|
14320
14720
|
if (selfOnlyOps?.has(ch)) {
|
|
14321
14721
|
if (isSelfQualified) continue;
|
|
14722
|
+
const unlockCapability = CAPABILITY_UNLOCKED_OPS.get(resource)?.get(ch);
|
|
14723
|
+
if (unlockCapability && qualifier === void 0 && capabilities?.includes(unlockCapability)) continue;
|
|
14724
|
+
const capabilityHintApplies = unlockCapability && !capabilities?.includes(unlockCapability);
|
|
14322
14725
|
return {
|
|
14323
14726
|
action,
|
|
14324
|
-
reason: `requests control-plane scope '${resource}:${ch}' without the required ':self' qualifier. A bare or arbitrarily-qualified '${resource}:${ch}' is outside the narrow allowlist (${admittedHint}) admitted for this resource \u2014 only '${resource}:${ch}:self' is
|
|
14727
|
+
reason: `requests control-plane scope '${resource}:${ch}' without the required ':self' qualifier. A bare or arbitrarily-qualified '${resource}:${ch}' is outside the narrow allowlist (${admittedHint}) admitted for this resource \u2014 only '${resource}:${ch}:self' is` + (capabilityHintApplies ? `, or this SAME clause also declaring 'capabilities: [${unlockCapability}]'` : unlockCapability ? ` (declaring 'capabilities: [${unlockCapability}]' does not help here \u2014 that capability only unlocks the BARE, unqualified form, never a literal-qualified one like this)` : "") + `. That operation must otherwise be done deliberately in the developer portal, never via the bootstrap loader`
|
|
14325
14728
|
};
|
|
14326
14729
|
}
|
|
14327
14730
|
return {
|
|
@@ -14354,11 +14757,11 @@ function evaluateScopeToken(action) {
|
|
|
14354
14757
|
}
|
|
14355
14758
|
return null;
|
|
14356
14759
|
}
|
|
14357
|
-
function evaluateScopeGate(allowedActions) {
|
|
14760
|
+
function evaluateScopeGate(allowedActions, capabilities) {
|
|
14358
14761
|
const accepted = [];
|
|
14359
14762
|
const rejected = [];
|
|
14360
14763
|
for (const action of allowedActions) {
|
|
14361
|
-
const rejection = evaluateScopeToken(action);
|
|
14764
|
+
const rejection = evaluateScopeToken(action, capabilities);
|
|
14362
14765
|
if (rejection) {
|
|
14363
14766
|
rejected.push(rejection);
|
|
14364
14767
|
} else {
|
|
@@ -14367,22 +14770,34 @@ function evaluateScopeGate(allowedActions) {
|
|
|
14367
14770
|
}
|
|
14368
14771
|
return { ok: rejected.length === 0, accepted, rejected };
|
|
14369
14772
|
}
|
|
14370
|
-
function assertScopeGate(allowedActions) {
|
|
14371
|
-
const result = evaluateScopeGate(allowedActions);
|
|
14773
|
+
function assertScopeGate(allowedActions, capabilities) {
|
|
14774
|
+
const result = evaluateScopeGate(allowedActions, capabilities);
|
|
14372
14775
|
if (!result.ok) {
|
|
14373
14776
|
throw new ScopeGateError(result.rejected);
|
|
14374
14777
|
}
|
|
14375
14778
|
}
|
|
14376
14779
|
function assertBlueprintGates(blueprint) {
|
|
14377
|
-
|
|
14378
|
-
|
|
14780
|
+
if (blueprint.accessProfile.allowedActions !== void 0) {
|
|
14781
|
+
assertScopeGate(blueprint.accessProfile.allowedActions, blueprint.accessProfile.capabilities);
|
|
14782
|
+
assertCapabilityGate(blueprint.accessProfile.capabilities);
|
|
14783
|
+
}
|
|
14379
14784
|
for (const clauses of Object.values(blueprint.roles ?? {})) {
|
|
14380
14785
|
for (const clause of clauses) {
|
|
14381
|
-
assertScopeGate(clause.allowedActions);
|
|
14786
|
+
assertScopeGate(clause.allowedActions, clause.capabilities);
|
|
14382
14787
|
assertCapabilityGate(clause.capabilities);
|
|
14383
14788
|
}
|
|
14384
14789
|
}
|
|
14385
14790
|
}
|
|
14791
|
+
function effectiveAccessProfileActions(blueprint) {
|
|
14792
|
+
if (blueprint.accessProfile.allowedActions !== void 0) {
|
|
14793
|
+
return [...blueprint.accessProfile.allowedActions];
|
|
14794
|
+
}
|
|
14795
|
+
const out = [];
|
|
14796
|
+
for (const roleId of blueprint.accessProfile.roleIds ?? []) {
|
|
14797
|
+
for (const clause of blueprint.roles?.[roleId] ?? []) out.push(...clause.allowedActions);
|
|
14798
|
+
}
|
|
14799
|
+
return out;
|
|
14800
|
+
}
|
|
14386
14801
|
|
|
14387
14802
|
// src/machine-id.ts
|
|
14388
14803
|
import { promises as fs } from "fs";
|
|
@@ -14487,7 +14902,8 @@ async function resolveApplyTimeIdentities(blueprint, client, log) {
|
|
|
14487
14902
|
function actionOf(created) {
|
|
14488
14903
|
return created ? "created" : "reconciled";
|
|
14489
14904
|
}
|
|
14490
|
-
async function registerNamespaceIdempotently(client,
|
|
14905
|
+
async function registerNamespaceIdempotently(client, blueprintContextId, decl) {
|
|
14906
|
+
const contextIdForRequest = decl.tenantWide ? void 0 : blueprintContextId;
|
|
14491
14907
|
const body = {
|
|
14492
14908
|
namespace: decl.namespace,
|
|
14493
14909
|
entityBacked: decl.entityBacked,
|
|
@@ -14503,6 +14919,7 @@ async function registerNamespaceIdempotently(client, contextIdForRequest, decl)
|
|
|
14503
14919
|
} catch (err) {
|
|
14504
14920
|
const info = extractServerError(err);
|
|
14505
14921
|
if (info.statusCode !== 400) throw err;
|
|
14922
|
+
if (decl.tenantWide) throw err;
|
|
14506
14923
|
let existing;
|
|
14507
14924
|
try {
|
|
14508
14925
|
existing = await client.getNamespace({ namespace: decl.namespace, contextId: contextIdForRequest });
|
|
@@ -14667,20 +15084,24 @@ function assertNoUnresolvedIdentities(blueprint) {
|
|
|
14667
15084
|
);
|
|
14668
15085
|
}
|
|
14669
15086
|
}
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
15087
|
+
var TenantWideNamespacesNotAllowedError = class extends Error {
|
|
15088
|
+
constructor(message) {
|
|
15089
|
+
super(message);
|
|
15090
|
+
this.name = "TenantWideNamespacesNotAllowedError";
|
|
15091
|
+
}
|
|
15092
|
+
};
|
|
15093
|
+
function assertTenantWideNamespacesAllowed(blueprint, allow) {
|
|
15094
|
+
if (allow) return;
|
|
15095
|
+
const names = (blueprint.namespaces ?? []).filter((ns) => ns.tenantWide === true).map((ns) => ns.namespace);
|
|
15096
|
+
if (names.length === 0) return;
|
|
15097
|
+
throw new TenantWideNamespacesNotAllowedError(
|
|
15098
|
+
`Blueprint declares namespace${names.length > 1 ? "s" : ""} ${names.map((n) => `'${n}'`).join(", ")} as tenantWide: true \u2014 visible to every context in the account, not just this blueprint's own. Refusing to request that registration without an explicit opt-in. Re-run with --allow-tenant-wide-namespaces once you've confirmed that's actually intended (only an account OWNER's credential can complete it either way \u2014 this flag doesn't change who's allowed, only whether this run tries).`
|
|
15099
|
+
);
|
|
15100
|
+
}
|
|
15101
|
+
async function provisionContext(client, input) {
|
|
15102
|
+
const { blueprint, allowTenantWideNamespaces = false, readExistingKey, confirmExistingPrincipal, log } = input;
|
|
14682
15103
|
assertBlueprintGates(blueprint);
|
|
14683
|
-
|
|
15104
|
+
assertTenantWideNamespacesAllowed(blueprint, allowTenantWideNamespaces);
|
|
14684
15105
|
const ctxResp = await client.auth.createAppContext({ body: { contextId: blueprint.contextId, name: contextNameOf(blueprint) } });
|
|
14685
15106
|
const contextAction = actionOf(ctxResp.created);
|
|
14686
15107
|
log.debug({ component: "loader", contextId: blueprint.contextId, contextAction }, "app-context ensured");
|
|
@@ -14719,10 +15140,10 @@ async function runLoader(client, input) {
|
|
|
14719
15140
|
"existing-principal collision confirmed (or unwired) \u2014 proceeding with any further write to this principal"
|
|
14720
15141
|
);
|
|
14721
15142
|
}
|
|
14722
|
-
const needsContextPinnedBootstrap = (blueprint.
|
|
15143
|
+
const needsContextPinnedBootstrap = (blueprint.namespaces ?? []).length > 0;
|
|
14723
15144
|
const ctxBootstrapClient = needsContextPinnedBootstrap ? input.remintBootstrapForContext ? await input.remintBootstrapForContext(blueprint.contextId) : client : void 0;
|
|
14724
15145
|
if (ctxBootstrapClient && input.remintBootstrapForContext) {
|
|
14725
|
-
log.debug({ component: "loader", contextId: blueprint.contextId }, "re-minted context-pinned bootstrap client");
|
|
15146
|
+
log.debug({ component: "loader", contextId: blueprint.contextId }, "re-minted context-pinned bootstrap client (namespaces)");
|
|
14726
15147
|
}
|
|
14727
15148
|
const namespaceActions = [];
|
|
14728
15149
|
for (const ns of blueprint.namespaces ?? []) {
|
|
@@ -14730,8 +15151,43 @@ async function runLoader(client, input) {
|
|
|
14730
15151
|
namespaceActions.push({ namespace: ns.namespace, action });
|
|
14731
15152
|
log.debug({ component: "loader", namespace: ns.namespace, contextId: blueprint.contextId, action }, "namespace ensured");
|
|
14732
15153
|
}
|
|
15154
|
+
return { contextAction, servicePrincipalUserId: userId, userAction, namespaceActions, ctxBootstrapClient };
|
|
15155
|
+
}
|
|
15156
|
+
async function runLoader(client, input) {
|
|
15157
|
+
const {
|
|
15158
|
+
blueprint,
|
|
15159
|
+
tenantId,
|
|
15160
|
+
machineId,
|
|
15161
|
+
rotate = false,
|
|
15162
|
+
skipSeed = false,
|
|
15163
|
+
allowTenantWideNamespaces = false,
|
|
15164
|
+
readExistingKey,
|
|
15165
|
+
persistMintedKey,
|
|
15166
|
+
confirmExistingPrincipal,
|
|
15167
|
+
log
|
|
15168
|
+
} = input;
|
|
15169
|
+
assertNoUnresolvedIdentities(blueprint);
|
|
15170
|
+
const provisioned = input.provisioned ?? await provisionContext(client, {
|
|
15171
|
+
blueprint,
|
|
15172
|
+
allowTenantWideNamespaces,
|
|
15173
|
+
remintBootstrapForContext: input.remintBootstrapForContext,
|
|
15174
|
+
readExistingKey,
|
|
15175
|
+
confirmExistingPrincipal,
|
|
15176
|
+
log
|
|
15177
|
+
});
|
|
15178
|
+
const { contextAction, servicePrincipalUserId: userId, userAction, namespaceActions } = provisioned;
|
|
15179
|
+
assertBlueprintGates(blueprint);
|
|
15180
|
+
const needsContextPinnedBootstrapForIssuers = (blueprint.issuers ?? []).length > 0;
|
|
15181
|
+
const ctxBootstrapClient = provisioned.ctxBootstrapClient ?? (needsContextPinnedBootstrapForIssuers ? input.remintBootstrapForContext ? await input.remintBootstrapForContext(blueprint.contextId) : client : void 0);
|
|
15182
|
+
if (ctxBootstrapClient && !provisioned.ctxBootstrapClient && input.remintBootstrapForContext) {
|
|
15183
|
+
log.debug({ component: "loader", contextId: blueprint.contextId }, "re-minted context-pinned bootstrap client (issuers)");
|
|
15184
|
+
}
|
|
14733
15185
|
const issuerActions = [];
|
|
14734
15186
|
for (const issuer of blueprint.issuers ?? []) {
|
|
15187
|
+
const selfSignupPolicies = issuer.selfSignupPolicies?.map((p) => ({
|
|
15188
|
+
signup_type: p.signupType,
|
|
15189
|
+
role_id: p.roleId
|
|
15190
|
+
}));
|
|
14735
15191
|
const issuerResp = await ctxBootstrapClient.auth.registerIssuer({
|
|
14736
15192
|
issuerId: issuer.issuerId,
|
|
14737
15193
|
issuer: issuer.issuer,
|
|
@@ -14740,18 +15196,26 @@ async function runLoader(client, input) {
|
|
|
14740
15196
|
contextId: issuer.contextId,
|
|
14741
15197
|
subClaim: issuer.subClaim,
|
|
14742
15198
|
emailClaim: issuer.emailClaim,
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
role_id: p.roleId
|
|
14746
|
-
}))
|
|
15199
|
+
userinfoUri: issuer.userinfoUri,
|
|
15200
|
+
selfSignupPolicies
|
|
14747
15201
|
});
|
|
14748
15202
|
const action = actionOf(issuerResp.created);
|
|
14749
15203
|
issuerActions.push({ issuerId: issuer.issuerId, action });
|
|
14750
15204
|
if (action === "reconciled") {
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
15205
|
+
await ctxBootstrapClient.auth.updateIssuer({
|
|
15206
|
+
issuerId: issuer.issuerId,
|
|
15207
|
+
// Trust-anchor/routing-pin fields — echoed back, never actually
|
|
15208
|
+
// changed here (the platform rejects a differing value).
|
|
15209
|
+
issuer: issuer.issuer,
|
|
15210
|
+
jwksUri: issuer.jwksUri,
|
|
15211
|
+
audience: issuer.audience,
|
|
15212
|
+
contextId: issuer.contextId,
|
|
15213
|
+
subClaim: issuer.subClaim,
|
|
15214
|
+
emailClaim: issuer.emailClaim,
|
|
15215
|
+
userinfoUri: issuer.userinfoUri,
|
|
15216
|
+
selfSignupPolicies
|
|
15217
|
+
});
|
|
15218
|
+
log.debug({ component: "loader", issuerId: issuer.issuerId }, "issuer already registered \u2014 reconciled safe fields to the declared values");
|
|
14755
15219
|
} else {
|
|
14756
15220
|
log.debug({ component: "loader", issuerId: issuer.issuerId, action }, "issuer registered");
|
|
14757
15221
|
}
|
|
@@ -14791,10 +15255,35 @@ async function runLoader(client, input) {
|
|
|
14791
15255
|
schemaActions.push({ typeName: s.typeName, action: actionOf(resp.created) });
|
|
14792
15256
|
log.debug({ component: "loader", typeName: s.typeName, schemaId: resp.id, action: actionOf(resp.created) }, "schema ensured (upsert)");
|
|
14793
15257
|
}
|
|
14794
|
-
const
|
|
15258
|
+
const roleIds = [];
|
|
15259
|
+
const roleActions = [];
|
|
15260
|
+
for (const [roleId, clauses] of Object.entries(blueprint.roles ?? {})) {
|
|
15261
|
+
const roleResp = await ctxClient.auth.createRole({
|
|
15262
|
+
contextId: blueprint.contextId,
|
|
15263
|
+
upsert: true,
|
|
15264
|
+
body: {
|
|
15265
|
+
roleId,
|
|
15266
|
+
// Blueprint roles carry no display name → default it to the roleId.
|
|
15267
|
+
name: roleId,
|
|
15268
|
+
scopes: toRoleScopeClauses(clauses),
|
|
15269
|
+
assumable: blueprint.roleAssumable?.[roleId]
|
|
15270
|
+
}
|
|
15271
|
+
});
|
|
15272
|
+
roleIds.push(roleId);
|
|
15273
|
+
roleActions.push({ roleId, action: actionOf(roleResp.created) });
|
|
15274
|
+
log.debug({ component: "loader", roleId, clauses: clauses.length, action: actionOf(roleResp.created) }, "role ensured (upsert)");
|
|
15275
|
+
}
|
|
15276
|
+
const profileBody = blueprint.accessProfile.roleIds ? {
|
|
15277
|
+
principalId: `usr_${userId}`,
|
|
15278
|
+
roleIds: blueprint.accessProfile.roleIds,
|
|
15279
|
+
identityOverrides: blueprint.accessProfile.identityOverrides
|
|
15280
|
+
} : {
|
|
14795
15281
|
principalId: `usr_${userId}`,
|
|
14796
15282
|
scopes: [
|
|
14797
15283
|
{
|
|
15284
|
+
// Non-null: this is the `else` branch of the roleIds XOR above —
|
|
15285
|
+
// `@vectros-ai/blueprints`' BlueprintAccessProfileSchema guarantees
|
|
15286
|
+
// allowedActions is set whenever roleIds is not.
|
|
14798
15287
|
allowed_actions: blueprint.accessProfile.allowedActions,
|
|
14799
15288
|
// Pass dataScope straight through to the wire. The blueprint type is
|
|
14800
15289
|
// Record<string, (string|null)[]> — a `null` element is the NULL
|
|
@@ -14828,22 +15317,6 @@ async function runLoader(client, input) {
|
|
|
14828
15317
|
body: profileBody
|
|
14829
15318
|
});
|
|
14830
15319
|
log.debug({ component: "loader", principalId: `usr_${userId}`, accessProfileId: profile.id, profileAction }, "access profile ensured + reconciled to declared scopes");
|
|
14831
|
-
const roleIds = [];
|
|
14832
|
-
const roleActions = [];
|
|
14833
|
-
for (const [roleId, clauses] of Object.entries(blueprint.roles ?? {})) {
|
|
14834
|
-
const roleResp = await ctxClient.auth.createRole({
|
|
14835
|
-
contextId: blueprint.contextId,
|
|
14836
|
-
body: {
|
|
14837
|
-
roleId,
|
|
14838
|
-
// Blueprint roles carry no display name → default it to the roleId.
|
|
14839
|
-
name: roleId,
|
|
14840
|
-
scopes: toRoleScopeClauses(clauses)
|
|
14841
|
-
}
|
|
14842
|
-
});
|
|
14843
|
-
roleIds.push(roleId);
|
|
14844
|
-
roleActions.push({ roleId, action: actionOf(roleResp.created) });
|
|
14845
|
-
log.debug({ component: "loader", roleId, clauses: clauses.length, action: actionOf(roleResp.created) }, "role ensured");
|
|
14846
|
-
}
|
|
14847
15320
|
const keyName = keyNameFor(blueprint.name, machineId);
|
|
14848
15321
|
let keyAction = "created";
|
|
14849
15322
|
let revokedKeyId;
|
|
@@ -14954,6 +15427,11 @@ async function runLoader(client, input) {
|
|
|
14954
15427
|
seedIndexFailures
|
|
14955
15428
|
};
|
|
14956
15429
|
}
|
|
15430
|
+
function renderPlanDataScope(ds) {
|
|
15431
|
+
const entries = Object.entries(ds ?? {});
|
|
15432
|
+
if (entries.length === 0) return "(none \u2014 unconstrained)";
|
|
15433
|
+
return entries.map(([dim, values]) => `${dim}=[${values.map((v) => v === null ? "null" : v).join(", ")}]`).join(", ");
|
|
15434
|
+
}
|
|
14957
15435
|
function buildPlan(blueprint, opts = {}) {
|
|
14958
15436
|
const steps = [];
|
|
14959
15437
|
steps.push({ kind: "context", summary: `context '${blueprint.contextId}' (${contextNameOf(blueprint)})` });
|
|
@@ -14962,7 +15440,7 @@ function buildPlan(blueprint, opts = {}) {
|
|
|
14962
15440
|
summary: `principal '${blueprint.servicePrincipal.externalId}' (SERVICE)`
|
|
14963
15441
|
});
|
|
14964
15442
|
for (const ns of blueprint.namespaces ?? []) {
|
|
14965
|
-
const ownerNote = `owned by '${blueprint.contextId}'`;
|
|
15443
|
+
const ownerNote = ns.tenantWide ? "TENANT-WIDE \u2014 visible to every context" : `owned by '${blueprint.contextId}'`;
|
|
14966
15444
|
const entityNote = ns.entityBacked ? ", entity-backed" : "";
|
|
14967
15445
|
const membershipNote = ns.membershipRecordType ? `, membership: ${ns.membershipRecordType}.${ns.membershipTargetField}` + (ns.membershipLevelField ? ` (levels: ${ns.membershipLevels?.join("/")})` : "") : "";
|
|
14968
15446
|
steps.push({
|
|
@@ -14990,20 +15468,40 @@ function buildPlan(blueprint, opts = {}) {
|
|
|
14990
15468
|
summary: `schema '${s.typeName}' (${s.fields.length} field${s.fields.length === 1 ? "" : "s"}, ${indexNote})${lookupNote}${surfaceNote}${sensitiveNote}`
|
|
14991
15469
|
});
|
|
14992
15470
|
}
|
|
14993
|
-
const actions = blueprint.accessProfile.allowedActions;
|
|
14994
|
-
const scopeNote = blueprint.accessProfile.dataScope && Object.keys(blueprint.accessProfile.dataScope).length ? ` dataScope: ${Object.keys(blueprint.accessProfile.dataScope).join(", ")}` : "";
|
|
14995
|
-
const capabilityNote = blueprint.accessProfile.capabilities?.length ? ` capabilities: [${blueprint.accessProfile.capabilities.join(", ")}]` : "";
|
|
14996
|
-
steps.push({
|
|
14997
|
-
kind: "profile",
|
|
14998
|
-
summary: `profile scopes [${actions.join(", ")}] (data-plane \u2713)${scopeNote}${capabilityNote}`
|
|
14999
|
-
});
|
|
15000
15471
|
for (const [roleId, clauses] of Object.entries(blueprint.roles ?? {})) {
|
|
15001
15472
|
const actionSet = [...new Set(clauses.flatMap((c) => c.allowedActions))];
|
|
15002
15473
|
const capSet = [...new Set(clauses.flatMap((c) => c.capabilities ?? []))];
|
|
15003
15474
|
const roleCapabilityNote = capSet.length ? `, capabilities [${capSet.join(", ")}]` : "";
|
|
15475
|
+
const clauseLines = clauses.map((c, i) => {
|
|
15476
|
+
const capNote = c.capabilities?.length ? `, capabilities [${c.capabilities.join(", ")}]` : "";
|
|
15477
|
+
return ` clause ${i + 1}: actions [${c.allowedActions.join(", ")}], dataScope: ${renderPlanDataScope(c.dataScope)}${capNote}`;
|
|
15478
|
+
});
|
|
15479
|
+
const assumable = blueprint.roleAssumable?.[roleId];
|
|
15480
|
+
const assumableLine = assumable ? `
|
|
15481
|
+
assumable: ${renderPlanDataScope(assumable)}` : "";
|
|
15004
15482
|
steps.push({
|
|
15005
15483
|
kind: "role",
|
|
15006
|
-
summary: `role '${roleId}' (${clauses.length} clause${clauses.length === 1 ? "" : "s"}, actions [${actionSet.join(", ")}]${roleCapabilityNote})
|
|
15484
|
+
summary: `role '${roleId}' (${clauses.length} clause${clauses.length === 1 ? "" : "s"}, actions [${actionSet.join(", ")}]${roleCapabilityNote})
|
|
15485
|
+
` + clauseLines.join("\n") + assumableLine
|
|
15486
|
+
});
|
|
15487
|
+
}
|
|
15488
|
+
const roleIdsNote = blueprint.accessProfile.roleIds;
|
|
15489
|
+
if (roleIdsNote) {
|
|
15490
|
+
steps.push({
|
|
15491
|
+
kind: "profile",
|
|
15492
|
+
summary: `profile via role(s) [${roleIdsNote.join(", ")}] (composed \u2014 each role's own clauses, concatenated in order)`
|
|
15493
|
+
});
|
|
15494
|
+
} else {
|
|
15495
|
+
const actions = blueprint.accessProfile.allowedActions ?? [];
|
|
15496
|
+
const scopeNote = blueprint.accessProfile.dataScope && Object.keys(blueprint.accessProfile.dataScope).length ? ` dataScope: ${Object.keys(blueprint.accessProfile.dataScope).join(", ")}` : "";
|
|
15497
|
+
const capabilityNote = blueprint.accessProfile.capabilities?.length ? ` capabilities: [${blueprint.accessProfile.capabilities.join(", ")}]` : "";
|
|
15498
|
+
const allDataPlane = !actions.some(
|
|
15499
|
+
(a) => KNOWN_CONTROL_PLANE_RESOURCES.includes(a.split(":", 1)[0])
|
|
15500
|
+
);
|
|
15501
|
+
const planeNote = allDataPlane ? " (data-plane \u2713)" : " (includes a control-plane exception)";
|
|
15502
|
+
steps.push({
|
|
15503
|
+
kind: "profile",
|
|
15504
|
+
summary: `profile scopes [${actions.join(", ")}]${planeNote}${scopeNote}${capabilityNote}`
|
|
15007
15505
|
});
|
|
15008
15506
|
}
|
|
15009
15507
|
steps.push({ kind: "key", summary: `key ${blueprint.name}-<machine> (mint 1 scoped ssk_*)` });
|
|
@@ -15026,8 +15524,10 @@ function renderPlan(blueprint, steps) {
|
|
|
15026
15524
|
];
|
|
15027
15525
|
if (steps.some((s) => s.kind === "issuer")) {
|
|
15028
15526
|
legendLines.push(
|
|
15029
|
-
` Exception:
|
|
15030
|
-
`
|
|
15527
|
+
` Exception: an issuer's trust-anchor fields (issuer, jwksUri, audience,`,
|
|
15528
|
+
` contextId) are immutable once registered \u2014 only subClaim/emailClaim/`,
|
|
15529
|
+
` userinfoUri/selfSignupPolicies actually reconcile on a re-apply (status is not`,
|
|
15530
|
+
` authorable in a blueprint at all).`
|
|
15031
15531
|
);
|
|
15032
15532
|
}
|
|
15033
15533
|
if (steps.some((s) => s.kind === "namespace")) {
|
|
@@ -15036,6 +15536,12 @@ function renderPlan(blueprint, steps) {
|
|
|
15036
15536
|
` an existing registration converges silently, but one that disagrees FAILS`,
|
|
15037
15537
|
` the apply rather than reconciling it.`
|
|
15038
15538
|
);
|
|
15539
|
+
if (steps.some((s) => s.kind === "namespace" && /TENANT-WIDE/.test(s.summary))) {
|
|
15540
|
+
legendLines.push(
|
|
15541
|
+
` Stricter still for a TENANT-WIDE namespace: it never converges, even on an`,
|
|
15542
|
+
` exact match \u2014 any existing registration of that name fails the apply.`
|
|
15543
|
+
);
|
|
15544
|
+
}
|
|
15039
15545
|
}
|
|
15040
15546
|
const legend = legendLines.join("\n");
|
|
15041
15547
|
const lines = steps.map((s) => ` + ${s.summary}`);
|
|
@@ -17099,6 +17605,7 @@ function parseBootstrapArgs(argv) {
|
|
|
17099
17605
|
useScopedToken: false,
|
|
17100
17606
|
blankSlate: false,
|
|
17101
17607
|
noSeed: false,
|
|
17608
|
+
allowTenantWideNamespaces: false,
|
|
17102
17609
|
client: "desktop",
|
|
17103
17610
|
tenant: "live",
|
|
17104
17611
|
help: false
|
|
@@ -17160,6 +17667,9 @@ function parseBootstrapArgs(argv) {
|
|
|
17160
17667
|
case "--no-seed":
|
|
17161
17668
|
args.noSeed = true;
|
|
17162
17669
|
break;
|
|
17670
|
+
case "--allow-tenant-wide-namespaces":
|
|
17671
|
+
args.allowTenantWideNamespaces = true;
|
|
17672
|
+
break;
|
|
17163
17673
|
case "--tenant": {
|
|
17164
17674
|
const v = argv[++i];
|
|
17165
17675
|
if (v !== "test" && v !== "live") {
|
|
@@ -17241,15 +17751,6 @@ function reconcileTally(items, noun) {
|
|
|
17241
17751
|
if (reconciled) seg.push(`${reconciled} reconciled`);
|
|
17242
17752
|
return `${items.length} ${noun}${items.length === 1 ? "" : "s"} (${seg.join(", ")})`;
|
|
17243
17753
|
}
|
|
17244
|
-
function issuerTally(items) {
|
|
17245
|
-
if (items.length === 0) return null;
|
|
17246
|
-
const created = items.filter((i) => i.action === "created").length;
|
|
17247
|
-
const unchanged = items.length - created;
|
|
17248
|
-
const seg = [];
|
|
17249
|
-
if (created) seg.push(`${created} created`);
|
|
17250
|
-
if (unchanged) seg.push(`${unchanged} already registered \u2014 unchanged (issuers cannot be updated once registered)`);
|
|
17251
|
-
return `${items.length} issuer${items.length === 1 ? "" : "s"} (${seg.join(", ")})`;
|
|
17252
|
-
}
|
|
17253
17754
|
function namespaceTally(items) {
|
|
17254
17755
|
if (items.length === 0) return null;
|
|
17255
17756
|
const created = items.filter((i) => i.action === "created").length;
|
|
@@ -17263,7 +17764,9 @@ function applyOutcomeSummary(result) {
|
|
|
17263
17764
|
const parts = [
|
|
17264
17765
|
reconcileTally(result.schemaActions, "schema"),
|
|
17265
17766
|
reconcileTally(result.roleActions, "role"),
|
|
17266
|
-
|
|
17767
|
+
// #1023 — the platform's PUT /v1/auth/issuers/{issuerId} makes an issuer's
|
|
17768
|
+
// 'reconciled' mean the same "updated to match" as every other kind here.
|
|
17769
|
+
reconcileTally(result.issuerActions, "issuer"),
|
|
17267
17770
|
namespaceTally(result.namespaceActions),
|
|
17268
17771
|
`profile ${result.profileAction}`
|
|
17269
17772
|
].filter((p) => p !== null);
|
|
@@ -17296,6 +17799,14 @@ Options:
|
|
|
17296
17799
|
sample seed records \u2014 the right choice for a production context
|
|
17297
17800
|
(a blueprint's seeds are illustrative, not real data). Unlike
|
|
17298
17801
|
--blank, the schemas are still created.
|
|
17802
|
+
--allow-tenant-wide-namespaces
|
|
17803
|
+
Required to apply a blueprint that declares a namespace with
|
|
17804
|
+
tenantWide: true \u2014 visible to every context in the account, not
|
|
17805
|
+
just this one. Without it, bootstrap refuses before provisioning
|
|
17806
|
+
anything, naming the namespace(s). Only an account OWNER's
|
|
17807
|
+
credential can actually complete the registration either way \u2014
|
|
17808
|
+
this flag doesn't change who's allowed, only whether this run
|
|
17809
|
+
tries. Never needed for a blueprint with no tenantWide namespace.
|
|
17299
17810
|
--tenant test|live Which tenant the minted key scopes to (default: live).
|
|
17300
17811
|
'test' provisions into your isolated test tenant \u2014 a
|
|
17301
17812
|
dry-run before pointing real data at the same blueprint.
|
|
@@ -17478,11 +17989,16 @@ ${BOOTSTRAP_HELP}
|
|
|
17478
17989
|
}
|
|
17479
17990
|
throw err;
|
|
17480
17991
|
}
|
|
17481
|
-
const
|
|
17482
|
-
|
|
17992
|
+
const roleNote = blueprint.accessProfile.roleIds ? ` via role(s) [${blueprint.accessProfile.roleIds.join(", ")}]` : "";
|
|
17993
|
+
const acceptedActions = effectiveAccessProfileActions(blueprint);
|
|
17994
|
+
const allDataPlane = !acceptedActions.some(
|
|
17995
|
+
(a) => KNOWN_CONTROL_PLANE_RESOURCES.includes(a.split(":", 1)[0])
|
|
17996
|
+
);
|
|
17997
|
+
process.stdout.write(
|
|
17998
|
+
`
|
|
17483
17999
|
Blueprint: ${blueprint.name}
|
|
17484
|
-
\u2714 Scope gate: [${
|
|
17485
|
-
|
|
18000
|
+
\u2714 Scope gate: [${acceptedActions.join(", ")}]${roleNote}` + (allDataPlane ? " \u2014 all data-plane \u2713\n" : " \u2014 includes a narrow, allowlisted control-plane exception (see above)\n")
|
|
18001
|
+
);
|
|
17486
18002
|
if (blueprint.accessProfile.capabilities?.length) {
|
|
17487
18003
|
const capGate = evaluateCapabilityGate(blueprint.accessProfile.capabilities);
|
|
17488
18004
|
process.stdout.write(` \u2714 Capability gate: [${capGate.accepted.join(", ")}] \u2014 granted \u2713
|
|
@@ -17538,6 +18054,7 @@ ${renderPlan(blueprint, planSteps)}
|
|
|
17538
18054
|
process.stdout.write(` \u2714 Bootstrap token minted (5-min TTL, ${args.tenant} tenant)
|
|
17539
18055
|
`);
|
|
17540
18056
|
const pingIdentity = deps.resolveIdentity ?? resolveIdentity;
|
|
18057
|
+
const provision = deps.provisionContext ?? provisionContext;
|
|
17541
18058
|
const resolveIdentities = deps.resolveApplyTimeIdentities ?? resolveApplyTimeIdentities;
|
|
17542
18059
|
const loader = deps.runLoader ?? runLoader;
|
|
17543
18060
|
const client = new VectrosClient({ token: bridge.token, environment: baseUrl });
|
|
@@ -17548,11 +18065,6 @@ ${renderPlan(blueprint, planSteps)}
|
|
|
17548
18065
|
"Could not resolve tenantId from /v1/ping \u2014 the extended ping (tenant_id) must be deployed for bootstrap."
|
|
17549
18066
|
);
|
|
17550
18067
|
}
|
|
17551
|
-
const resolvedBlueprint = await resolveIdentities(
|
|
17552
|
-
blueprint,
|
|
17553
|
-
client,
|
|
17554
|
-
log
|
|
17555
|
-
);
|
|
17556
18068
|
let keyring;
|
|
17557
18069
|
let keyringOpenError;
|
|
17558
18070
|
try {
|
|
@@ -17627,6 +18139,27 @@ ${renderPlan(blueprint, planSteps)}
|
|
|
17627
18139
|
);
|
|
17628
18140
|
}
|
|
17629
18141
|
};
|
|
18142
|
+
const remintBootstrapForContext = buildRemintBootstrapForContext({
|
|
18143
|
+
cognitoToken,
|
|
18144
|
+
apiBaseUrl: baseUrl,
|
|
18145
|
+
tenant: args.tenant,
|
|
18146
|
+
useScopedToken: args.useScopedToken,
|
|
18147
|
+
mintBridge
|
|
18148
|
+
});
|
|
18149
|
+
const confirmExistingPrincipal = buildConfirmExistingPrincipal(args, promptCtx.prompt, isTty);
|
|
18150
|
+
const provisioned = await provision(client, {
|
|
18151
|
+
blueprint,
|
|
18152
|
+
allowTenantWideNamespaces: args.allowTenantWideNamespaces,
|
|
18153
|
+
remintBootstrapForContext,
|
|
18154
|
+
readExistingKey,
|
|
18155
|
+
confirmExistingPrincipal,
|
|
18156
|
+
log
|
|
18157
|
+
});
|
|
18158
|
+
const resolvedBlueprint = await resolveIdentities(
|
|
18159
|
+
blueprint,
|
|
18160
|
+
provisioned.ctxBootstrapClient ?? client,
|
|
18161
|
+
log
|
|
18162
|
+
);
|
|
17630
18163
|
const machineId = await resolveMachineId();
|
|
17631
18164
|
const result = await loader(client, {
|
|
17632
18165
|
blueprint: resolvedBlueprint,
|
|
@@ -17634,22 +18167,18 @@ ${renderPlan(blueprint, planSteps)}
|
|
|
17634
18167
|
machineId,
|
|
17635
18168
|
rotate: args.rotate,
|
|
17636
18169
|
skipSeed: noSeed,
|
|
18170
|
+
allowTenantWideNamespaces: args.allowTenantWideNamespaces,
|
|
17637
18171
|
readExistingKey,
|
|
17638
18172
|
persistMintedKey,
|
|
17639
|
-
|
|
17640
|
-
|
|
17641
|
-
apiBaseUrl: baseUrl,
|
|
17642
|
-
tenant: args.tenant,
|
|
17643
|
-
useScopedToken: args.useScopedToken,
|
|
17644
|
-
mintBridge
|
|
17645
|
-
}),
|
|
18173
|
+
provisioned,
|
|
18174
|
+
remintBootstrapForContext,
|
|
17646
18175
|
remintForContext: buildRemintForContext({
|
|
17647
18176
|
cognitoToken,
|
|
17648
18177
|
apiBaseUrl: baseUrl,
|
|
17649
18178
|
tenant: args.tenant,
|
|
17650
18179
|
mintContext
|
|
17651
18180
|
}),
|
|
17652
|
-
confirmExistingPrincipal
|
|
18181
|
+
confirmExistingPrincipal,
|
|
17653
18182
|
log
|
|
17654
18183
|
});
|
|
17655
18184
|
process.stdout.write(
|
|
@@ -17740,9 +18269,18 @@ ${codeAddHint}`);
|
|
|
17740
18269
|
return 3;
|
|
17741
18270
|
}
|
|
17742
18271
|
if (err instanceof BlueprintIdentityError || err instanceof UnresolvedIdentitiesError) {
|
|
18272
|
+
process.stderr.write(
|
|
18273
|
+
`
|
|
18274
|
+
\u2716 ${err.message}
|
|
18275
|
+
The app-context, service principal, and any declared namespaces were already provisioned. No schemas, profile, roles, key, or seed records were.
|
|
18276
|
+
`
|
|
18277
|
+
);
|
|
18278
|
+
return 2;
|
|
18279
|
+
}
|
|
18280
|
+
if (err instanceof TenantWideNamespacesNotAllowedError) {
|
|
17743
18281
|
process.stderr.write(`
|
|
17744
18282
|
\u2716 ${err.message}
|
|
17745
|
-
|
|
18283
|
+
Nothing was provisioned.
|
|
17746
18284
|
`);
|
|
17747
18285
|
return 2;
|
|
17748
18286
|
}
|
|
@@ -17817,11 +18355,14 @@ function assertIdentityOverrideValues(overrides, flag) {
|
|
|
17817
18355
|
}
|
|
17818
18356
|
}
|
|
17819
18357
|
function placeholderScopeNamespace(value) {
|
|
17820
|
-
const
|
|
17821
|
-
|
|
18358
|
+
const self2 = /^\$\{\{\s*(?:under\.)?self\.scope\.([^\s}]+)\s*\}\}$/.exec(value);
|
|
18359
|
+
if (self2) return self2[1];
|
|
18360
|
+
const member = MEMBER_SCOPE_PLACEHOLDER_RE2.exec(value);
|
|
18361
|
+
return member ? member[1] : null;
|
|
17822
18362
|
}
|
|
17823
18363
|
var SELF_PLACEHOLDER_RE = /^\$\{\{\s*self\.(?:userId|partnerUserId|scope\.[a-z][a-z0-9_-]{1,31})\s*\}\}$/;
|
|
17824
|
-
var
|
|
18364
|
+
var UNDER_SELF_PLACEHOLDER_RE2 = /^\$\{\{\s*under\.self\.(?:userId|partnerUserId|scope\.[a-z][a-z0-9_-]{1,31})\s*\}\}$/;
|
|
18365
|
+
var MEMBER_SCOPE_PLACEHOLDER_RE2 = /^\$\{\{\s*member\.scope\.([a-z][a-z0-9_-]{1,31})(?::[a-z][a-z0-9_-]{1,31})?\s*\}\}$/;
|
|
17825
18366
|
|
|
17826
18367
|
// src/lint.ts
|
|
17827
18368
|
var ENUM_COMPATIBLE_TYPES = /* @__PURE__ */ new Set(["enum", "string", "string[]"]);
|
|
@@ -17959,7 +18500,7 @@ function lintBlueprint(bp) {
|
|
|
17959
18500
|
}
|
|
17960
18501
|
}
|
|
17961
18502
|
}
|
|
17962
|
-
{
|
|
18503
|
+
if (bp.accessProfile.allowedActions !== void 0) {
|
|
17963
18504
|
const reached = ownerScopedReachWithoutDataScope(bp.accessProfile.allowedActions, ds);
|
|
17964
18505
|
if (reached.length > 0) findings.push(unconstrainedReachFinding("accessProfile", reached));
|
|
17965
18506
|
}
|
|
@@ -18010,7 +18551,12 @@ function lintBlueprint(bp) {
|
|
|
18010
18551
|
}
|
|
18011
18552
|
var ROLE_ID_RE = /^[a-z][a-z0-9-]{2,30}$/;
|
|
18012
18553
|
var PLACEHOLDER_SHAPED_RE = /^\s*\$\{\{.*\}\}\s*$/s;
|
|
18013
|
-
var RECOGNIZED_PLACEHOLDER_RES = [
|
|
18554
|
+
var RECOGNIZED_PLACEHOLDER_RES = [
|
|
18555
|
+
/^\$\{\{\s*any\s*\}\}$/,
|
|
18556
|
+
SELF_PLACEHOLDER_RE,
|
|
18557
|
+
UNDER_SELF_PLACEHOLDER_RE2,
|
|
18558
|
+
MEMBER_SCOPE_PLACEHOLDER_RE2
|
|
18559
|
+
];
|
|
18014
18560
|
var BLUEPRINT_TOKEN_RE = /^\s*\$\{\{\s*(identities|inputs|vectros|ns)\./;
|
|
18015
18561
|
function placeholderFinding(where, key, value) {
|
|
18016
18562
|
if (typeof value !== "string" || !PLACEHOLDER_SHAPED_RE.test(value)) return null;
|
|
@@ -18028,7 +18574,7 @@ function placeholderFinding(where, key, value) {
|
|
|
18028
18574
|
return {
|
|
18029
18575
|
severity: "error",
|
|
18030
18576
|
rule: "datascope-unknown-placeholder",
|
|
18031
|
-
message: `${where}: dataScope.${key} value '${value}' is not a placeholder the platform recognizes \u2014 it will be rejected at apply. Valid: \${{ any }}, \${{ self.userId }}, \${{ self.scope.<namespace> }}, \${{ under.self.userId }}, \${{ under.self.scope.<namespace> }}. Spelling is exact and lowercase; use a plain value for a literal owner id.`
|
|
18577
|
+
message: `${where}: dataScope.${key} value '${value}' is not a placeholder the platform recognizes \u2014 it will be rejected at apply. Valid: \${{ any }}, \${{ self.userId }}, \${{ self.scope.<namespace> }}, \${{ under.self.userId }}, \${{ under.self.scope.<namespace> }}, \${{ member.scope.<namespace> }}, \${{ member.scope.<namespace>:<level> }}. Spelling is exact and lowercase; use a plain value for a literal owner id.`
|
|
18032
18578
|
};
|
|
18033
18579
|
}
|
|
18034
18580
|
var OWNER_SCOPED_RESOURCES = /* @__PURE__ */ new Set(["records", "documents", "entities"]);
|
|
@@ -18274,11 +18820,11 @@ async function runValidate(args) {
|
|
|
18274
18820
|
}
|
|
18275
18821
|
const blueprint = await resolveAndValidate(args.file, "validate", supplied);
|
|
18276
18822
|
if (!blueprint) return 2;
|
|
18277
|
-
const gate = evaluateScopeGate(blueprint.accessProfile.allowedActions);
|
|
18278
18823
|
const capGate = evaluateCapabilityGate(blueprint.accessProfile.capabilities);
|
|
18279
18824
|
const warnCount = lintBlueprint(blueprint).length;
|
|
18825
|
+
const roleNote = blueprint.accessProfile.roleIds ? ` via role(s) [${blueprint.accessProfile.roleIds.join(", ")}]` : "";
|
|
18280
18826
|
process.stdout.write(
|
|
18281
|
-
` \u2714 '${blueprint.name}' is valid \u2014 structural \u2713, scope gate \u2713 [${
|
|
18827
|
+
` \u2714 '${blueprint.name}' is valid \u2014 structural \u2713, scope gate \u2713 [${effectiveAccessProfileActions(blueprint).join(", ")}]${roleNote}` + (capGate.accepted.length ? `, capability gate \u2713 [${capGate.accepted.join(", ")}]` : "") + `, lint \u2713` + (warnCount ? ` (${warnCount} warning${warnCount === 1 ? "" : "s"})` : "") + "\n"
|
|
18282
18828
|
);
|
|
18283
18829
|
return 0;
|
|
18284
18830
|
}
|
|
@@ -19149,6 +19695,52 @@ async function runIdentityDelete(opts, deps = {}) {
|
|
|
19149
19695
|
}
|
|
19150
19696
|
});
|
|
19151
19697
|
}
|
|
19698
|
+
function renderInvite(v) {
|
|
19699
|
+
return formatKeyValues([
|
|
19700
|
+
["userId", v.userId],
|
|
19701
|
+
["inviteExpiresAt", v.inviteExpiresAt],
|
|
19702
|
+
["emailSent", v.emailSent === void 0 ? void 0 : String(v.emailSent)],
|
|
19703
|
+
["inviteToken", v.inviteToken],
|
|
19704
|
+
["acceptLink", v.acceptLink]
|
|
19705
|
+
]);
|
|
19706
|
+
}
|
|
19707
|
+
async function runIdentityInvite(opts, deps = {}) {
|
|
19708
|
+
const sendEmail = !opts.noSendEmail;
|
|
19709
|
+
if (sendEmail && !opts.acceptUrl) {
|
|
19710
|
+
process.stderr.write(
|
|
19711
|
+
" \u2716 --accept-url is required unless --no-send-email is given (the platform delivers the invitation email itself and needs somewhere to point it).\n"
|
|
19712
|
+
);
|
|
19713
|
+
return 2;
|
|
19714
|
+
}
|
|
19715
|
+
return withAuth(opts, deps, async (auth) => {
|
|
19716
|
+
const client = auth.client;
|
|
19717
|
+
try {
|
|
19718
|
+
const invite = await client.auth.createInvite({
|
|
19719
|
+
email: opts.email,
|
|
19720
|
+
contextId: opts.context,
|
|
19721
|
+
accessProfile: { roleId: opts.role },
|
|
19722
|
+
firstName: opts.firstName,
|
|
19723
|
+
acceptUrl: opts.acceptUrl,
|
|
19724
|
+
sendEmail
|
|
19725
|
+
});
|
|
19726
|
+
if (opts.json) {
|
|
19727
|
+
process.stdout.write(`${formatJson(invite)}
|
|
19728
|
+
`);
|
|
19729
|
+
return 0;
|
|
19730
|
+
}
|
|
19731
|
+
process.stdout.write(
|
|
19732
|
+
`
|
|
19733
|
+
\u2714 Invited '${opts.email}' to '${opts.context}' as '${opts.role}'
|
|
19734
|
+
${renderInvite(invite)}
|
|
19735
|
+
`
|
|
19736
|
+
);
|
|
19737
|
+
return 0;
|
|
19738
|
+
} catch (err) {
|
|
19739
|
+
process.stderr.write(formatCliError(err, { action: "identity invite failed" }));
|
|
19740
|
+
return 1;
|
|
19741
|
+
}
|
|
19742
|
+
});
|
|
19743
|
+
}
|
|
19152
19744
|
|
|
19153
19745
|
// src/commands/access.ts
|
|
19154
19746
|
function assertPrincipalShape(principal) {
|
|
@@ -19167,20 +19759,24 @@ async function resolvePrincipalArg(raw, auth) {
|
|
|
19167
19759
|
}
|
|
19168
19760
|
return self2.principalId;
|
|
19169
19761
|
}
|
|
19762
|
+
function roleSummary(p) {
|
|
19763
|
+
if (p.roleIds?.length) return p.roleIds.join(", ");
|
|
19764
|
+
return p.roleId;
|
|
19765
|
+
}
|
|
19170
19766
|
function renderProfile(p) {
|
|
19171
19767
|
return formatKeyValues([
|
|
19172
19768
|
["context", p.contextId],
|
|
19173
19769
|
["principal", p.principalId],
|
|
19174
|
-
["role", p
|
|
19770
|
+
["role", roleSummary(p)],
|
|
19175
19771
|
["scopes", p.scopes?.length ? `${p.scopes.length} clause(s)` : void 0],
|
|
19176
19772
|
["status", p.status]
|
|
19177
19773
|
]);
|
|
19178
19774
|
}
|
|
19179
19775
|
async function runAccessGrant(opts, deps = {}) {
|
|
19180
|
-
const hasRole = Boolean(opts.role);
|
|
19776
|
+
const hasRole = Boolean(opts.role?.length);
|
|
19181
19777
|
const hasActions = Boolean(opts.actions);
|
|
19182
19778
|
if (hasRole === hasActions) {
|
|
19183
|
-
process.stderr.write(" \u2716 Provide exactly one of --role <roleId> or --actions <csv>.\n");
|
|
19779
|
+
process.stderr.write(" \u2716 Provide exactly one of --role <roleId> (repeatable) or --actions <csv>.\n");
|
|
19184
19780
|
return 2;
|
|
19185
19781
|
}
|
|
19186
19782
|
if (hasActions && splitCsv(opts.actions).length === 0) {
|
|
@@ -19220,7 +19816,11 @@ async function runAccessGrant(opts, deps = {}) {
|
|
|
19220
19816
|
upsert: true,
|
|
19221
19817
|
body: {
|
|
19222
19818
|
principalId: principal,
|
|
19223
|
-
|
|
19819
|
+
// Always send the plural `roleIds`, even for a single
|
|
19820
|
+
// `--role`: it is a strict superset of the deprecated singular
|
|
19821
|
+
// `roleId` (equivalent to `roleIds: ["<value>"]`), and the platform
|
|
19822
|
+
// reads it uniformly regardless of how many roles compose.
|
|
19823
|
+
roleIds: opts.role,
|
|
19224
19824
|
scopes,
|
|
19225
19825
|
identityOverrides
|
|
19226
19826
|
}
|
|
@@ -19232,7 +19832,7 @@ async function runAccessGrant(opts, deps = {}) {
|
|
|
19232
19832
|
}
|
|
19233
19833
|
process.stdout.write(
|
|
19234
19834
|
`
|
|
19235
|
-
\u2714 Granted ${principal} in '${opts.context}'` + (hasRole ? ` via role
|
|
19835
|
+
\u2714 Granted ${principal} in '${opts.context}'` + (hasRole ? ` via role(s) [${opts.role.join(", ")}]` : ` with ${splitCsv(opts.actions).length} action(s)`) + `
|
|
19236
19836
|
${renderProfile(profile)}
|
|
19237
19837
|
`
|
|
19238
19838
|
);
|
|
@@ -19301,7 +19901,7 @@ async function runAccessList(opts, deps = {}) {
|
|
|
19301
19901
|
"\n" + formatTable(rows, [
|
|
19302
19902
|
{ header: "context", get: (r) => r.contextId },
|
|
19303
19903
|
{ header: "principal", get: (r) => r.principalId },
|
|
19304
|
-
{ header: "role", get: (r) => r
|
|
19904
|
+
{ header: "role", get: (r) => roleSummary(r) ?? (r.scopes?.length ? "(inline)" : void 0) },
|
|
19305
19905
|
{ header: "status", get: (r) => r.status }
|
|
19306
19906
|
]) + "\n"
|
|
19307
19907
|
);
|
|
@@ -19349,6 +19949,7 @@ ${renderProfile(p)}
|
|
|
19349
19949
|
var SELF = /* @__PURE__ */ Symbol("self");
|
|
19350
19950
|
var ANY = /* @__PURE__ */ Symbol("any");
|
|
19351
19951
|
var UNDER_SELF = /* @__PURE__ */ Symbol("under.self");
|
|
19952
|
+
var MEMBER = /* @__PURE__ */ Symbol("member.scope");
|
|
19352
19953
|
function canonicalDim(key) {
|
|
19353
19954
|
if (key === "userId" || key === "partnerUserId") return "user";
|
|
19354
19955
|
return key;
|
|
@@ -19378,7 +19979,8 @@ function normalizeClauses(raw) {
|
|
|
19378
19979
|
if (val === null) return null;
|
|
19379
19980
|
const s = String(val);
|
|
19380
19981
|
if (ANY_TOKEN_RE.test(s)) return ANY;
|
|
19381
|
-
if (
|
|
19982
|
+
if (UNDER_SELF_PLACEHOLDER_RE2.test(s)) return UNDER_SELF;
|
|
19983
|
+
if (MEMBER_SCOPE_PLACEHOLDER_RE2.test(s)) return MEMBER;
|
|
19382
19984
|
return SELF_PLACEHOLDER_RE.test(s) ? SELF : s;
|
|
19383
19985
|
});
|
|
19384
19986
|
if (!isRecognizedOwnershipKey(k)) unrecognizedDims.push(k);
|
|
@@ -19433,7 +20035,7 @@ function buildArchetypes(clauses) {
|
|
|
19433
20035
|
const set = scopeDims.get(dim) ?? /* @__PURE__ */ new Set();
|
|
19434
20036
|
set.add(SELF);
|
|
19435
20037
|
for (const v of values) {
|
|
19436
|
-
if (v === null || v === ANY || v === UNDER_SELF) continue;
|
|
20038
|
+
if (v === null || v === ANY || v === UNDER_SELF || v === MEMBER) continue;
|
|
19437
20039
|
set.add(v);
|
|
19438
20040
|
}
|
|
19439
20041
|
scopeDims.set(dim, set);
|
|
@@ -19460,6 +20062,7 @@ function listAdmits(allowed, recordValue) {
|
|
|
19460
20062
|
if (a === SELF) return recordValue === SELF;
|
|
19461
20063
|
if (a === ANY) return recordValue !== void 0;
|
|
19462
20064
|
if (a === UNDER_SELF) return false;
|
|
20065
|
+
if (a === MEMBER) return false;
|
|
19463
20066
|
return recordValue === a;
|
|
19464
20067
|
});
|
|
19465
20068
|
}
|
|
@@ -19485,7 +20088,7 @@ function undecidableDims(clauses) {
|
|
|
19485
20088
|
const dims = /* @__PURE__ */ new Set();
|
|
19486
20089
|
for (const c of clauses) {
|
|
19487
20090
|
for (const [dim, values] of Object.entries(c.dataScope)) {
|
|
19488
|
-
if (values.includes(UNDER_SELF)) dims.add(dim);
|
|
20091
|
+
if (values.includes(UNDER_SELF) || values.includes(MEMBER)) dims.add(dim);
|
|
19489
20092
|
}
|
|
19490
20093
|
}
|
|
19491
20094
|
return [...dims];
|
|
@@ -19518,6 +20121,7 @@ function renderDataScope(ds) {
|
|
|
19518
20121
|
if (v === SELF) return "self";
|
|
19519
20122
|
if (v === ANY) return "any";
|
|
19520
20123
|
if (v === UNDER_SELF) return "under-self";
|
|
20124
|
+
if (v === MEMBER) return "member";
|
|
19521
20125
|
if (v === null) return "null";
|
|
19522
20126
|
return v;
|
|
19523
20127
|
});
|
|
@@ -19549,14 +20153,25 @@ async function runAccessExplain(opts, deps = {}) {
|
|
|
19549
20153
|
const profile = await client.auth.getAccessProfile({ contextId: opts.context, principalId: principal });
|
|
19550
20154
|
let rawClauses = profile.scopes ?? [];
|
|
19551
20155
|
let via = "inline scopes";
|
|
19552
|
-
|
|
19553
|
-
|
|
19554
|
-
|
|
19555
|
-
|
|
20156
|
+
const roleIds = profile.roleIds ?? (profile.roleId ? [profile.roleId] : []);
|
|
20157
|
+
if (roleIds.length > 0) {
|
|
20158
|
+
const roleClauses = [];
|
|
20159
|
+
for (const roleId of roleIds) {
|
|
20160
|
+
const role = await client.auth.getRole({ contextId: opts.context, roleId });
|
|
20161
|
+
roleClauses.push(...role.scopes ?? []);
|
|
20162
|
+
}
|
|
20163
|
+
rawClauses = roleClauses;
|
|
20164
|
+
via = roleIds.length === 1 ? `role '${roleIds[0]}'` : `role(s) [${roleIds.join(", ")}]`;
|
|
19556
20165
|
}
|
|
19557
20166
|
const clauses = normalizeClauses(rawClauses);
|
|
19558
20167
|
const rows = explainClauses(clauses);
|
|
19559
20168
|
const undecidable = undecidableDims(clauses);
|
|
20169
|
+
const hasUnderSelfUndecidable = clauses.some(
|
|
20170
|
+
(c) => Object.values(c.dataScope).some((values) => values.includes(UNDER_SELF))
|
|
20171
|
+
);
|
|
20172
|
+
const hasMemberUndecidable = clauses.some(
|
|
20173
|
+
(c) => Object.values(c.dataScope).some((values) => values.includes(MEMBER))
|
|
20174
|
+
);
|
|
19560
20175
|
if (opts.json) {
|
|
19561
20176
|
process.stdout.write(
|
|
19562
20177
|
`${formatJson({
|
|
@@ -19613,10 +20228,7 @@ async function runAccessExplain(opts, deps = {}) {
|
|
|
19613
20228
|
]) + (undecidable.length > 0 ? `
|
|
19614
20229
|
|
|
19615
20230
|
\u26A0 UNDECIDED offline: ${undecidable.join(", ")}
|
|
19616
|
-
A clause matching on
|
|
19617
|
-
so rows granted through it are shown as NO above. Read those cells as "cannot tell here",
|
|
19618
|
-
NOT as a denial \u2014 the matrix under-reports this clause.
|
|
19619
|
-
` : "") + '\n\n \u26A0 READ ONLY: "granted?"/"actions" model whether a row can be READ, not whether a c/u/d\n verb shown there can actually WRITE that row\'s exact shape \u2014 the platform requires a clause\n to name a dimension to place a value into it, while reads are never narrowed by a dimension a\n clause omits. A create/update verb next to a row is advisory: it names which records exist to\n act on, not that a specific write will succeed.\n\n\n NOTE: this matrix models the OWNERSHIP dimensions only \u2014 "granted?" says a row\'s ownership\n shape matches a clause, and "record types" (above) says which `records:` types that grant\n actually reaches; "all" reaches every type, "\u2014" means no `records:` action grants this row at\n all. Search/RAG visibility is a separate, still-unmodeled narrowing: it is bounded per row by\n the SAME clause\'s typed read grants \u2014 a row shown with `search:r` is searchable only for the\n content types that clause can read.\n Preview only \u2014 computed client-side from the documented matching rules; the platform decides at request time.\n'
|
|
20231
|
+
` + (hasUnderSelfUndecidable ? " A clause matching on `${{ under.self.* }}` needs the server's parent graph, which this\n preview does not have, so rows granted through it are shown as NO above.\n" : "") + (hasMemberUndecidable ? " A clause matching on `${{ member.scope.<ns>[:<level>] }}` needs a live per-request read of\n this account's membership records, which this preview does not have, so rows granted\n through it are shown as NO above.\n" : "") + ' Read those cells as "cannot tell here", NOT as a denial \u2014 the matrix under-reports\n whichever clause(s) above are responsible.\n' : "") + '\n\n \u26A0 READ ONLY: "granted?"/"actions" model whether a row can be READ, not whether a c/u/d\n verb shown there can actually WRITE that row\'s exact shape \u2014 the platform requires a clause\n to name a dimension to place a value into it, while reads are never narrowed by a dimension a\n clause omits. A create/update verb next to a row is advisory: it names which records exist to\n act on, not that a specific write will succeed.\n\n\n NOTE: this matrix models the OWNERSHIP dimensions only \u2014 "granted?" says a row\'s ownership\n shape matches a clause, and "record types" (above) says which `records:` types that grant\n actually reaches; "all" reaches every type, "\u2014" means no `records:` action grants this row at\n all. Search/RAG visibility is a separate, still-unmodeled narrowing: it is bounded per row by\n the SAME clause\'s typed read grants \u2014 a row shown with `search:r` is searchable only for the\n content types that clause can read.\n Preview only \u2014 computed client-side from the documented matching rules; the platform decides at request time.\n'
|
|
19620
20232
|
);
|
|
19621
20233
|
return 0;
|
|
19622
20234
|
} catch (err) {
|
|
@@ -19634,7 +20246,8 @@ function renderRole(r) {
|
|
|
19634
20246
|
["name", r.name],
|
|
19635
20247
|
["context", r.contextId],
|
|
19636
20248
|
["description", r.description],
|
|
19637
|
-
["scopes", r.scopes?.length ? `${r.scopes.length} clause(s)` : void 0]
|
|
20249
|
+
["scopes", r.scopes?.length ? `${r.scopes.length} clause(s)` : void 0],
|
|
20250
|
+
["assumable", r.assumable && Object.keys(r.assumable).length ? formatJson(r.assumable) : void 0]
|
|
19638
20251
|
]);
|
|
19639
20252
|
}
|
|
19640
20253
|
async function runRoleCreate(opts, deps = {}) {
|
|
@@ -19905,6 +20518,75 @@ ${renderContext(ctx)}
|
|
|
19905
20518
|
});
|
|
19906
20519
|
}
|
|
19907
20520
|
|
|
20521
|
+
// src/commands/issuers.ts
|
|
20522
|
+
function renderSelfSignup(policies) {
|
|
20523
|
+
if (!policies || policies.length === 0) return "\u2014";
|
|
20524
|
+
return policies.map((p) => `${p.signup_type} \u2192 ${p.role_id}`).join(", ");
|
|
20525
|
+
}
|
|
20526
|
+
function renderIssuer(i) {
|
|
20527
|
+
return formatKeyValues([
|
|
20528
|
+
["issuerId", i.issuerId],
|
|
20529
|
+
["issuer", i.issuer],
|
|
20530
|
+
["jwksUri", i.jwksUri],
|
|
20531
|
+
["audience", i.audience],
|
|
20532
|
+
["contextId", i.contextId],
|
|
20533
|
+
["subClaim", i.subClaim],
|
|
20534
|
+
["emailClaim", i.emailClaim],
|
|
20535
|
+
["userinfoUri", i.userinfoUri],
|
|
20536
|
+
["status", i.status],
|
|
20537
|
+
["createdAt", i.createdAt],
|
|
20538
|
+
["selfSignup", renderSelfSignup(i.selfSignupPolicies)]
|
|
20539
|
+
]);
|
|
20540
|
+
}
|
|
20541
|
+
async function runIssuersList(opts, deps = {}) {
|
|
20542
|
+
return withAuth({ ...opts, provisioning: true, context: opts.context }, deps, async (auth) => {
|
|
20543
|
+
const client = auth.client;
|
|
20544
|
+
try {
|
|
20545
|
+
const rows = await drainPages(
|
|
20546
|
+
(startFrom) => client.auth.listIssuers({ limit: PAGE_LIMIT, ...startFrom ? { startFrom } : {} })
|
|
20547
|
+
);
|
|
20548
|
+
if (opts.json) {
|
|
20549
|
+
process.stdout.write(`${formatJson(rows)}
|
|
20550
|
+
`);
|
|
20551
|
+
return 0;
|
|
20552
|
+
}
|
|
20553
|
+
process.stdout.write(
|
|
20554
|
+
"\n" + formatTable(rows, [
|
|
20555
|
+
{ header: "issuerId", get: (i) => i.issuerId },
|
|
20556
|
+
{ header: "issuer", get: (i) => i.issuer },
|
|
20557
|
+
{ header: "audience", get: (i) => i.audience },
|
|
20558
|
+
{ header: "status", get: (i) => i.status },
|
|
20559
|
+
{ header: "self-signup", get: (i) => renderSelfSignup(i.selfSignupPolicies) }
|
|
20560
|
+
]) + "\n"
|
|
20561
|
+
);
|
|
20562
|
+
return 0;
|
|
20563
|
+
} catch (err) {
|
|
20564
|
+
process.stderr.write(formatCliError(err, { action: "issuers list failed" }));
|
|
20565
|
+
return 1;
|
|
20566
|
+
}
|
|
20567
|
+
});
|
|
20568
|
+
}
|
|
20569
|
+
async function runIssuersGet(opts, deps = {}) {
|
|
20570
|
+
return withAuth({ ...opts, provisioning: true, context: opts.context }, deps, async (auth) => {
|
|
20571
|
+
const client = auth.client;
|
|
20572
|
+
try {
|
|
20573
|
+
const issuer = await client.auth.getIssuer({ issuerId: opts.issuerId });
|
|
20574
|
+
if (opts.json) {
|
|
20575
|
+
process.stdout.write(`${formatJson(issuer)}
|
|
20576
|
+
`);
|
|
20577
|
+
return 0;
|
|
20578
|
+
}
|
|
20579
|
+
process.stdout.write(`
|
|
20580
|
+
${renderIssuer(issuer)}
|
|
20581
|
+
`);
|
|
20582
|
+
return 0;
|
|
20583
|
+
} catch (err) {
|
|
20584
|
+
process.stderr.write(formatCliError(err, { action: "issuers get failed" }));
|
|
20585
|
+
return 1;
|
|
20586
|
+
}
|
|
20587
|
+
});
|
|
20588
|
+
}
|
|
20589
|
+
|
|
19908
20590
|
// src/commands/login.ts
|
|
19909
20591
|
import { createServer } from "http";
|
|
19910
20592
|
import open from "open";
|
|
@@ -20126,7 +20808,7 @@ async function runAssertions(client, bootstrapClient, deps, blueprint, tenantId,
|
|
|
20126
20808
|
const assertions = [];
|
|
20127
20809
|
try {
|
|
20128
20810
|
const ping = await deps.pingWithKey(result.rawKey);
|
|
20129
|
-
const wantActions = blueprint
|
|
20811
|
+
const wantActions = effectiveAccessProfileActions(blueprint);
|
|
20130
20812
|
const got = ping.allowedActions ?? [];
|
|
20131
20813
|
const missing = wantActions.filter((a) => !got.includes(a));
|
|
20132
20814
|
const ok = ping.principalType === "scoped_key" && ping.tenantId === tenantId && missing.length === 0;
|
|
@@ -20360,15 +21042,21 @@ async function runBlueprintHarness(client, input, deps) {
|
|
|
20360
21042
|
const readExistingKey = async () => void 0;
|
|
20361
21043
|
const persistMintedKey = async () => {
|
|
20362
21044
|
};
|
|
21045
|
+
const provisioned = await provisionContext(client, {
|
|
21046
|
+
blueprint: input.blueprint,
|
|
21047
|
+
remintBootstrapForContext,
|
|
21048
|
+
readExistingKey,
|
|
21049
|
+
log
|
|
21050
|
+
});
|
|
20363
21051
|
const blueprint = await resolveApplyTimeIdentities(
|
|
20364
21052
|
input.blueprint,
|
|
20365
|
-
client,
|
|
21053
|
+
provisioned.ctxBootstrapClient ?? client,
|
|
20366
21054
|
log
|
|
20367
21055
|
);
|
|
20368
21056
|
const remint = remintForContext ?? (async () => client);
|
|
20369
21057
|
const remintBootstrap = remintBootstrapForContext ?? (async () => client);
|
|
20370
21058
|
const hasIssuers = (blueprint.issuers ?? []).length > 0;
|
|
20371
|
-
const hasNamespaces =
|
|
21059
|
+
const hasNamespaces = provisioned.namespaceActions.length > 0;
|
|
20372
21060
|
let contextSnapshot;
|
|
20373
21061
|
if (remintForContext) {
|
|
20374
21062
|
try {
|
|
@@ -20412,6 +21100,7 @@ async function runBlueprintHarness(client, input, deps) {
|
|
|
20412
21100
|
readExistingKey,
|
|
20413
21101
|
persistMintedKey,
|
|
20414
21102
|
log,
|
|
21103
|
+
provisioned,
|
|
20415
21104
|
remintForContext,
|
|
20416
21105
|
remintBootstrapForContext
|
|
20417
21106
|
});
|
|
@@ -20630,12 +21319,13 @@ async function issueOrRotateKey(client, tenantId, context, userId, keyName) {
|
|
|
20630
21319
|
return { key: rotated, revokedKeyId: existing?.keyId };
|
|
20631
21320
|
}
|
|
20632
21321
|
async function runJoin(opts, deps = {}) {
|
|
20633
|
-
const hasRole = Boolean(opts.role);
|
|
21322
|
+
const hasRole = Boolean(opts.role?.length);
|
|
20634
21323
|
const hasActions = Boolean(opts.actions);
|
|
20635
21324
|
if (hasRole === hasActions) {
|
|
20636
|
-
process.stderr.write(" \u2716 Provide exactly one of --role <roleId> or --actions <csv>.\n");
|
|
21325
|
+
process.stderr.write(" \u2716 Provide exactly one of --role <roleId> (repeatable) or --actions <csv>.\n");
|
|
20637
21326
|
return 2;
|
|
20638
21327
|
}
|
|
21328
|
+
const roleDisplay = opts.role?.join(", ");
|
|
20639
21329
|
if (hasActions && splitCsv(opts.actions).length === 0) {
|
|
20640
21330
|
process.stderr.write(" \u2716 --actions needs at least one action (an empty/blank list grants nothing).\n");
|
|
20641
21331
|
return 2;
|
|
@@ -20683,7 +21373,10 @@ async function runJoin(opts, deps = {}) {
|
|
|
20683
21373
|
upsert: true,
|
|
20684
21374
|
body: {
|
|
20685
21375
|
principalId,
|
|
20686
|
-
|
|
21376
|
+
// Always send the plural `roleIds`, even for a single
|
|
21377
|
+
// `--role`: a strict superset of the deprecated singular `roleId`,
|
|
21378
|
+
// read uniformly by the platform regardless of how many compose.
|
|
21379
|
+
roleIds: opts.role,
|
|
20687
21380
|
scopes,
|
|
20688
21381
|
identityOverrides
|
|
20689
21382
|
}
|
|
@@ -20702,7 +21395,7 @@ async function runJoin(opts, deps = {}) {
|
|
|
20702
21395
|
alias,
|
|
20703
21396
|
context,
|
|
20704
21397
|
principalId,
|
|
20705
|
-
role:
|
|
21398
|
+
role: roleDisplay,
|
|
20706
21399
|
keyId: existingEntry.keyId,
|
|
20707
21400
|
reused: true,
|
|
20708
21401
|
tenant,
|
|
@@ -20723,7 +21416,7 @@ async function runJoin(opts, deps = {}) {
|
|
|
20723
21416
|
const willActivate = await determineActivateDecision(keyring, { tenant, explicitActivate: opts.activate });
|
|
20724
21417
|
const { entry } = await storeMintedKey(
|
|
20725
21418
|
keyring,
|
|
20726
|
-
{ alias, context, principalId, role:
|
|
21419
|
+
{ alias, context, principalId, role: roleDisplay, keyId: key.keyId, env: auth.env },
|
|
20727
21420
|
key.rawKey,
|
|
20728
21421
|
{ activate: willActivate, revokedKeyId }
|
|
20729
21422
|
);
|
|
@@ -20731,7 +21424,7 @@ async function runJoin(opts, deps = {}) {
|
|
|
20731
21424
|
alias,
|
|
20732
21425
|
context,
|
|
20733
21426
|
principalId,
|
|
20734
|
-
role:
|
|
21427
|
+
role: roleDisplay,
|
|
20735
21428
|
keyId: entry.keyId,
|
|
20736
21429
|
reused: false,
|
|
20737
21430
|
tenant,
|
|
@@ -20770,9 +21463,9 @@ function emitJoined(opts) {
|
|
|
20770
21463
|
|
|
20771
21464
|
// src/build-info.ts
|
|
20772
21465
|
var BUILD_INFO = {
|
|
20773
|
-
cli: true ? "0.
|
|
20774
|
-
sdk: true ? "0.
|
|
20775
|
-
blueprints: true ? "0.
|
|
21466
|
+
cli: true ? "0.19.0" : "dev",
|
|
21467
|
+
sdk: true ? "0.41.0" : "dev",
|
|
21468
|
+
blueprints: true ? "0.16.0" : "dev"
|
|
20776
21469
|
};
|
|
20777
21470
|
function formatBuildInfo() {
|
|
20778
21471
|
return `vectros ${BUILD_INFO.cli} (sdk ${BUILD_INFO.sdk}, blueprints ${BUILD_INFO.blueprints})`;
|
|
@@ -20852,12 +21545,13 @@ function buildProgram(deps = {}) {
|
|
|
20852
21545
|
registerAccessCommands(program, deps);
|
|
20853
21546
|
registerRoleCommands(program, deps);
|
|
20854
21547
|
registerContextCommands(program, deps);
|
|
21548
|
+
registerIssuersCommands(program, deps);
|
|
20855
21549
|
registerJoinCommand(program, deps);
|
|
20856
21550
|
registerKeyringCommands(program);
|
|
20857
21551
|
return program;
|
|
20858
21552
|
}
|
|
20859
21553
|
function registerJoinCommand(program, deps) {
|
|
20860
|
-
const join3 = program.command("join").description("Enroll a principal in a context (grant + key) and keep the key in the keyring.").argument("<context>", "the app context to join").option("--role <roleId>", "reference a Role to grant (XOR --actions)").option("--actions <csv>", "inline single-clause actions to grant, comma-separated (XOR --role)").option("--as <principal>", "who to enroll: 'me' (default) or an explicit 'usr_<id>'", "me").option("--scope <ns:value>", "identity override: a scope the member acts under (repeatable, e.g. org:<id>)", collect, []).option("--alias <name>", "keyring entry name (defaults to the context id)").option("--tenant <tenant>", "target tenant: 'test' or 'live' (default live)").option(
|
|
21554
|
+
const join3 = program.command("join").description("Enroll a principal in a context (grant + key) and keep the key in the keyring.").argument("<context>", "the app context to join").option("--role <roleId>", "reference a Role to grant (repeatable \u2014 2+ compose additively; XOR --actions)", collect, []).option("--actions <csv>", "inline single-clause actions to grant, comma-separated (XOR --role)").option("--as <principal>", "who to enroll: 'me' (default) or an explicit 'usr_<id>'", "me").option("--scope <ns:value>", "identity override: a scope the member acts under (repeatable, e.g. org:<id>)", collect, []).option("--alias <name>", "keyring entry name (defaults to the context id)").option("--tenant <tenant>", "target tenant: 'test' or 'live' (default live)").option(
|
|
20861
21555
|
"--activate",
|
|
20862
21556
|
"force the freshly-stored key to become your active identity, even over a currently-active LIVE credential (the one case --tenant test does NOT do automatically)"
|
|
20863
21557
|
).option("--no-activate", "store the key without activating it, regardless of tenant");
|
|
@@ -20991,6 +21685,27 @@ function registerContextCommands(program, deps) {
|
|
|
20991
21685
|
}
|
|
20992
21686
|
);
|
|
20993
21687
|
}
|
|
21688
|
+
function registerIssuersCommands(program, deps) {
|
|
21689
|
+
const issuers = program.command("issuers").description("Inspect registered third-party IdP issuers (token-exchange trust anchors).");
|
|
21690
|
+
const list = issuers.command("list").description("List issuers registered in one app context.").requiredOption("--context <c>", "app context the issuer(s) are registered under").option("--tenant <tenant>", "tenant to read: 'test' or 'live' (default live)");
|
|
21691
|
+
addCommonAuthOptions(list).action(
|
|
21692
|
+
async (flags) => {
|
|
21693
|
+
const tenant = parseTenantFlag(flags.tenant);
|
|
21694
|
+
process.exit(
|
|
21695
|
+
await runIssuersList({ ...toCommonOptions(flags), context: flags.context, tenant }, deps)
|
|
21696
|
+
);
|
|
21697
|
+
}
|
|
21698
|
+
);
|
|
21699
|
+
const get = issuers.command("get").description("Show one registered issuer.").argument("<issuerId>").requiredOption("--context <c>", "app context the issuer is registered under").option("--tenant <tenant>", "tenant to read: 'test' or 'live' (default live)");
|
|
21700
|
+
addCommonAuthOptions(get).action(
|
|
21701
|
+
async (issuerId, flags) => {
|
|
21702
|
+
const tenant = parseTenantFlag(flags.tenant);
|
|
21703
|
+
process.exit(
|
|
21704
|
+
await runIssuersGet({ ...toCommonOptions(flags), context: flags.context, issuerId, tenant }, deps)
|
|
21705
|
+
);
|
|
21706
|
+
}
|
|
21707
|
+
);
|
|
21708
|
+
}
|
|
20994
21709
|
function registerRoleCommands(program, deps) {
|
|
20995
21710
|
const role = program.command("role").description("Manage context-scoped roles (reusable scope rules; bind via `access grant --role`).");
|
|
20996
21711
|
const create = role.command("create").description("Create (idempotent by roleId) a single-clause role from --actions.").requiredOption("--context <c>", "app context").requiredOption("--role-id <id>", "role id (3-31 chars; lowercase letter + lowercase/digit/dash)").requiredOption("--name <name>", "human-readable name").requiredOption("--actions <csv>", "allowed actions, comma-separated (e.g. records:cru,search:r)").option(
|
|
@@ -21027,7 +21742,7 @@ function registerRoleCommands(program, deps) {
|
|
|
21027
21742
|
}
|
|
21028
21743
|
function registerAccessCommands(program, deps) {
|
|
21029
21744
|
const access2 = program.command("access").description("Manage access bindings: principal \u2194 context \u2194 role/scopes.");
|
|
21030
|
-
const grant = access2.command("grant").description("Bind a principal to a context via a role or inline actions.").requiredOption("--principal <p>", "principal: 'usr_<userId>', 'key_<keyId>', or 'me' (your own user)").requiredOption("--context <c>", "app context").option("--role <roleId>", "reference a Role (XOR --actions)").option("--actions <csv>", "inline single-clause actions, comma-separated (XOR --role)").option("--scope <ns:value>", "identity override: a scope the principal acts under (repeatable, e.g. org:<id>)", collect, []).option("--identity-overrides <json>", "general identity overrides as a JSON object (merged over --scope)");
|
|
21745
|
+
const grant = access2.command("grant").description("Bind a principal to a context via a role or inline actions.").requiredOption("--principal <p>", "principal: 'usr_<userId>', 'key_<keyId>', or 'me' (your own user)").requiredOption("--context <c>", "app context").option("--role <roleId>", "reference a Role (repeatable \u2014 2+ compose additively; XOR --actions)", collect, []).option("--actions <csv>", "inline single-clause actions, comma-separated (XOR --role)").option("--scope <ns:value>", "identity override: a scope the principal acts under (repeatable, e.g. org:<id>)", collect, []).option("--identity-overrides <json>", "general identity overrides as a JSON object (merged over --scope)");
|
|
21031
21746
|
addCommonAuthOptions(grant).action(
|
|
21032
21747
|
async (flags) => {
|
|
21033
21748
|
process.exit(
|
|
@@ -21108,6 +21823,25 @@ function registerIdentityCommands(program, deps) {
|
|
|
21108
21823
|
addAuthOptions(del).action(async (flags) => {
|
|
21109
21824
|
process.exit(await runIdentityDelete({ ...toCommonOptions(flags), type: flags.type, id: flags.id }, deps));
|
|
21110
21825
|
});
|
|
21826
|
+
const invite = identity.command("invite").description("Onboard a person into a context by email (POST /v1/users/invite) \u2014 no root key required.").requiredOption("--context <contextId>", "the app context the invitee will operate in").requiredOption("--role <roleId>", "an existing Role in that context; the invitee inherits its scopes").requiredOption("--email <email>", "the invitee's email address").option("--first-name <name>", "personalizes the invitation email greeting").option("--accept-url <url>", "your accept-invite landing page (required unless --no-send-email)").option("--no-send-email", "skip platform delivery; the response carries the raw inviteToken/acceptLink instead");
|
|
21827
|
+
addCommonAuthOptions(invite).action(
|
|
21828
|
+
async (flags) => {
|
|
21829
|
+
process.exit(
|
|
21830
|
+
await runIdentityInvite(
|
|
21831
|
+
{
|
|
21832
|
+
...toCommonOptions(flags),
|
|
21833
|
+
context: flags.context,
|
|
21834
|
+
role: flags.role,
|
|
21835
|
+
email: flags.email,
|
|
21836
|
+
firstName: flags.firstName,
|
|
21837
|
+
acceptUrl: flags.acceptUrl,
|
|
21838
|
+
noSendEmail: flags.sendEmail === false
|
|
21839
|
+
},
|
|
21840
|
+
deps
|
|
21841
|
+
)
|
|
21842
|
+
);
|
|
21843
|
+
}
|
|
21844
|
+
);
|
|
21111
21845
|
}
|
|
21112
21846
|
function addKeyDestinationOptions(cmd) {
|
|
21113
21847
|
return cmd.addOption(new Option("--format <fmt>", "how to emit the secret").choices(KEY_FORMATS).default("human")).option(
|