@cortexkit/claustrum-client 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wire.d.ts +21 -1
- package/dist/wire.js +16 -0
- package/package.json +1 -1
package/dist/wire.d.ts
CHANGED
|
@@ -182,11 +182,25 @@ export declare class ClaustrumClient {
|
|
|
182
182
|
* Optional `displayName` proposes a person-facing label for operator approval. It
|
|
183
183
|
* needs a vault build with enrollment display-name support; an older vault refuses
|
|
184
184
|
* the `display_name` field as `invalid_params`. Omit it for older vaults.
|
|
185
|
+
* Optional `requestedGrants` proposes read/list permissions for operator review.
|
|
186
|
+
* Older vaults refuse `requested_grants` as `invalid_params`. Callers that want to
|
|
187
|
+
* support them must choose to retry without the field themselves; the client never
|
|
188
|
+
* silently drops permissions, since malformed grants have the same refusal code.
|
|
185
189
|
*/
|
|
186
190
|
enrollPropose(input: {
|
|
187
191
|
name: string;
|
|
188
192
|
requestSecretHash: string;
|
|
189
193
|
displayName?: string;
|
|
194
|
+
requestedGrants?: ReadonlyArray<{
|
|
195
|
+
selector: {
|
|
196
|
+
category: string;
|
|
197
|
+
exact?: never;
|
|
198
|
+
} | {
|
|
199
|
+
exact: string;
|
|
200
|
+
category?: never;
|
|
201
|
+
};
|
|
202
|
+
operation: 'read' | 'list';
|
|
203
|
+
}>;
|
|
190
204
|
}): Promise<{
|
|
191
205
|
requestId: string;
|
|
192
206
|
}>;
|
|
@@ -240,11 +254,17 @@ export declare class ClaustrumClient {
|
|
|
240
254
|
*/
|
|
241
255
|
export interface ScopedInventoryRow {
|
|
242
256
|
readonly id: string;
|
|
257
|
+
/** Vault catalog service key, not a routing provider id. */
|
|
258
|
+
readonly provider?: string;
|
|
259
|
+
readonly incarnation?: string;
|
|
260
|
+
/** First observation of the effective tier; absent when unknown. */
|
|
261
|
+
readonly planTierObservedAtMs?: number;
|
|
243
262
|
readonly categories: readonly string[];
|
|
244
263
|
readonly credentialType: string;
|
|
245
264
|
readonly serves: readonly string[];
|
|
246
265
|
/**
|
|
247
|
-
*
|
|
266
|
+
* Stored routing ids, defaulted at creation or operator-assigned; empty when unset.
|
|
267
|
+
* Always present on this type.
|
|
248
268
|
* A daemon older than the field omits it from the wire, and that decodes as empty,
|
|
249
269
|
* which is also what an unmapped credential reports.
|
|
250
270
|
*/
|
package/dist/wire.js
CHANGED
|
@@ -299,12 +299,17 @@ export class ClaustrumClient {
|
|
|
299
299
|
* Optional `displayName` proposes a person-facing label for operator approval. It
|
|
300
300
|
* needs a vault build with enrollment display-name support; an older vault refuses
|
|
301
301
|
* the `display_name` field as `invalid_params`. Omit it for older vaults.
|
|
302
|
+
* Optional `requestedGrants` proposes read/list permissions for operator review.
|
|
303
|
+
* Older vaults refuse `requested_grants` as `invalid_params`. Callers that want to
|
|
304
|
+
* support them must choose to retry without the field themselves; the client never
|
|
305
|
+
* silently drops permissions, since malformed grants have the same refusal code.
|
|
302
306
|
*/
|
|
303
307
|
async enrollPropose(input) {
|
|
304
308
|
const response = await this.#call('auth.enroll_propose', {
|
|
305
309
|
proposed_name: input.name,
|
|
306
310
|
request_secret_hash: input.requestSecretHash,
|
|
307
311
|
...(input.displayName !== undefined ? { display_name: input.displayName } : {}),
|
|
312
|
+
...(input.requestedGrants !== undefined ? { requested_grants: input.requestedGrants } : {}),
|
|
308
313
|
});
|
|
309
314
|
const result = decodeEnrollmentResult(response, this.#logger);
|
|
310
315
|
const requestId = result.request_id;
|
|
@@ -495,6 +500,14 @@ export function decodeScopedInventory(response, logUnknownClass) {
|
|
|
495
500
|
throw asCredentialError(response, 'invalid_response', logUnknownClass);
|
|
496
501
|
}
|
|
497
502
|
const authMethod = row.auth_method;
|
|
503
|
+
const provider = row.provider ?? undefined;
|
|
504
|
+
const incarnation = row.incarnation ?? undefined;
|
|
505
|
+
const planTierObservedAtMs = row.plan_tier_observed_at_ms ?? undefined;
|
|
506
|
+
if (!isOptionalString(provider) || !isOptionalString(incarnation) ||
|
|
507
|
+
(planTierObservedAtMs !== undefined &&
|
|
508
|
+
(typeof planTierObservedAtMs !== 'number' || !Number.isSafeInteger(planTierObservedAtMs)))) {
|
|
509
|
+
throw asCredentialError(response, 'invalid_response', logUnknownClass);
|
|
510
|
+
}
|
|
498
511
|
const planTierSource = row.plan_tier_source;
|
|
499
512
|
if (planTierSource !== undefined && planTierSource !== 'operator' && planTierSource !== 'detected') {
|
|
500
513
|
throw asCredentialError(response, 'invalid_response', logUnknownClass);
|
|
@@ -512,6 +525,9 @@ export function decodeScopedInventory(response, logUnknownClass) {
|
|
|
512
525
|
}
|
|
513
526
|
return {
|
|
514
527
|
id: row.id,
|
|
528
|
+
provider,
|
|
529
|
+
incarnation,
|
|
530
|
+
planTierObservedAtMs,
|
|
515
531
|
categories: strings(row.categories),
|
|
516
532
|
credentialType: row.type,
|
|
517
533
|
serves: strings(row.serves),
|