@calimero-network/mero-js 34.0.0 → 35.0.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/README.md +2 -1
- package/dist/client/approvals.d.ts +112 -82
- package/dist/client/approvals.js +40 -0
- package/dist/client/calimero-client.js +0 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +1 -1
- package/dist/generated/api.d.ts +19 -200
- package/dist/generated/methods.d.ts +0 -16
- package/dist/generated/methods.js +0 -16
- package/dist/index.browser.mjs +3 -3
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +40 -16
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +40 -16
- package/dist/index.mjs.map +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ flows and streams a single route cannot be:
|
|
|
110
110
|
- **Organization recovery**: `startRecovery(org, seed)` (the seed signs here and never leaves the process); `newRecoverySeed`, `recoveryPublicKey`.
|
|
111
111
|
- **Blobs**: `downloadBlob(app, id)`, `downloadBlobGranted(app, id, grant)` (bytes; `client.apps.blobDownload` answers a `Blob` with its type).
|
|
112
112
|
- **Streams**: `events(app, from?, signal?)`, `presenceStream(app, signal?)`.
|
|
113
|
-
- **Approvals from an app**: `pendingApprovals(org?)`, `appsReportAll(org)`, then `openConsentPage(request, …)` to send the user to the node's consent page, and `waitForConsent(requestId)`; back on `returnTo`, `resumeConsent()` reads the decision on the request this page started from the node (never from the URL) and refuses a return for another request, one still pending, or one a newer request replaced (`CONSENT_REPLACED`: an account has one undecided request per node). Besides releases, upgrades and outbound hosts, `createOrgConsent`, `createInviteConsent` and `acceptInviteConsent` ask for a new organization, an invite or joining with one; the result's `outcome` (`{ orgId }`, `{ token }`, `{ org }`) is typed by `kind`. Show the answer's `code` to the user before sending them to `url` (`openConsentPage`'s `confirm` hook); they should see the same code on the page (`confirmationCode(requestId)` checks it). See [Ask your users to approve node images and app upgrades](https://calimero-network.github.io/mero-js/guides/user-approvals/).
|
|
113
|
+
- **Approvals from an app**: `pendingApprovals(org?)`, `appsReportAll(org)`, then `openConsentPage(request, …)` to send the user to the node's consent page, and `waitForConsent(requestId)`; back on `returnTo`, `resumeConsent()` reads the decision on the request this page started from the node (never from the URL) and refuses a return for another request, one still pending, or one a newer request replaced (`CONSENT_REPLACED`: an account has one undecided request per node). Besides releases, upgrades and outbound hosts, `createOrgConsent`, `createInviteConsent` and `acceptInviteConsent` ask for a new organization, an invite or joining with one, and `leaveOrgConsent`, `removeMemberConsent`, `setMemberRoleConsent`, `setMemberTeamsConsent`, `removeMemberTeamsConsent`, `revokeInviteConsent`, `renameOrgConsent`, `deleteOrgConsent`, `setCapabilitiesConsent` and `setAllAppsConsent` for managing one; the result's `outcome` (`{ orgId }`, `{ token }`, `{ org }`, a rename's `{ orgId, name }`, a deletion's `{ apps }`) is typed by `kind`. Show the answer's `code` to the user before sending them to `url` (`openConsentPage`'s `confirm` hook); they should see the same code on the page (`confirmationCode(requestId)` checks it). See [Ask your users to approve node images and app upgrades](https://calimero-network.github.io/mero-js/guides/user-approvals/).
|
|
114
114
|
|
|
115
115
|
Refusals are typed (`LoginRequired`, `PasskeyUnknownHere`, `WrongNode`, `NotFound`, `ConfirmRequired`, `ConfirmCancelled`, `ConfirmPromptBlocked`,
|
|
116
116
|
`ArgsTooLarge`, `IdempotencyMismatch`, `ReleaseDeadlineError`, `RuntimeTooOld`, `ConsentStale`, `AppError`, `TrapError`,
|
|
@@ -355,6 +355,7 @@ pnpm test:unit # unit tests, against a stand-in node over a real sealed channe
|
|
|
355
355
|
pnpm lint
|
|
356
356
|
pnpm typecheck
|
|
357
357
|
pnpm typecheck:consumer
|
|
358
|
+
pnpm typecheck:tests
|
|
358
359
|
```
|
|
359
360
|
|
|
360
361
|
The cluster tests (`tests/cluster`) start three `merod run --dev` nodes and
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* [consent page](https://calimero-network.github.io/core/protocol/consent-page/)
|
|
15
15
|
* and [governance](https://calimero-network.github.io/core/protocol/governance/).
|
|
16
16
|
*/
|
|
17
|
-
import type { ApiAnswer } from '../routes/types.js';
|
|
17
|
+
import type { ApiAnswer, ApiSchema } from '../routes/types.js';
|
|
18
|
+
import type { operations } from '../generated/api.js';
|
|
18
19
|
/**
|
|
19
20
|
* Who holds one decision on a cluster (core's `Authority`), fixed at genesis
|
|
20
21
|
* and attested by every replica. `owner`: the parties around each app, with a
|
|
@@ -115,70 +116,54 @@ export declare function publisherBindingBytes(cluster: string, org: string, sign
|
|
|
115
116
|
export type ConsentScope = 'account' | {
|
|
116
117
|
org: string;
|
|
117
118
|
};
|
|
118
|
-
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
} | {
|
|
137
|
-
kind: 'outbound';
|
|
138
|
-
scope: ConsentScope;
|
|
139
|
-
/** `package`: a package-bound session's own when left out; `prefixes`: every one the latest release declares. */
|
|
140
|
-
subject: {
|
|
141
|
-
package?: string;
|
|
142
|
-
prefixes?: string[];
|
|
143
|
-
};
|
|
144
|
-
returnTo: string;
|
|
145
|
-
} | {
|
|
146
|
-
/** A new organization, owned by whoever approves. Outcome: `{ orgId }`. */
|
|
147
|
-
kind: 'createOrg';
|
|
148
|
-
subject: {
|
|
149
|
-
name: string;
|
|
150
|
-
};
|
|
151
|
-
returnTo: string;
|
|
152
|
-
} | {
|
|
153
|
-
/** A new invite to `subject.org`. Outcome: `{ token }`. */
|
|
154
|
-
kind: 'createInvite';
|
|
155
|
-
subject: InviteConsentSubject;
|
|
156
|
-
returnTo: string;
|
|
157
|
-
} | {
|
|
158
|
-
/** Joining an organization with an invite's `token`. Outcome: `{ org }`. */
|
|
159
|
-
kind: 'acceptInvite';
|
|
160
|
-
subject: {
|
|
161
|
-
token: string;
|
|
162
|
-
};
|
|
163
|
-
returnTo: string;
|
|
164
|
-
};
|
|
119
|
+
/**
|
|
120
|
+
* What the app asks its user to approve (`POST /consent/requests`), by
|
|
121
|
+
* `kind`: the route's generated body. Unknown fields are refused. Build one
|
|
122
|
+
* with the helpers below (`releaseConsent`, `createOrgConsent`, ...), each
|
|
123
|
+
* typed as the kind it builds.
|
|
124
|
+
*
|
|
125
|
+
* - `release`, `upgrade`, `outbound`: a release approval (or withdrawal), an
|
|
126
|
+
* app upgrade, outbound prefixes.
|
|
127
|
+
* - `createOrg`, `createInvite`, `acceptInvite` (core#5014): a new
|
|
128
|
+
* organization, an invite, joining with one.
|
|
129
|
+
* - `leaveOrg`, `removeMember`, `setMemberRole`, `setMemberTeams`,
|
|
130
|
+
* `removeMemberTeams`, `revokeInvite`, `renameOrg`, `deleteOrg`,
|
|
131
|
+
* `setCapabilities`, `setAllApps` (core#5018): managing an organization.
|
|
132
|
+
*
|
|
133
|
+
* `returnTo` is where the page sends the person back: the package's frontend
|
|
134
|
+
* origin, or one its manifest names.
|
|
135
|
+
*/
|
|
136
|
+
export type ConsentRequest = NonNullable<operations['consent_page_create']['requestBody']>['content']['application/json'];
|
|
165
137
|
/** A consent request's kind. */
|
|
166
138
|
export type ConsentKind = ConsentRequest['kind'];
|
|
167
|
-
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
139
|
+
/** The consent request of kind `K`. */
|
|
140
|
+
type ConsentRequestOf<K extends ConsentKind> = Extract<ConsentRequest, {
|
|
141
|
+
kind: K;
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* What a `createInvite` consent request asks for: `org`, `role`, and
|
|
145
|
+
* optionally `teams` to join, `ttlSecs` it lasts, `uses` it allows and
|
|
146
|
+
* `allApps`, every app of the organization.
|
|
147
|
+
*/
|
|
148
|
+
export type InviteConsentSubject = ConsentRequestOf<'createInvite'>['subject'];
|
|
149
|
+
/** A role an invite gives (core's `Role`, short of `owner`). */
|
|
150
|
+
export type InviteRole = InviteConsentSubject['role'];
|
|
151
|
+
/** A member's role in an organization (core's `Role`). */
|
|
152
|
+
export type OrgRole = ApiSchema<'OrgRole'>;
|
|
153
|
+
/** A member's role in a team (core's `TeamRole`). */
|
|
154
|
+
export type TeamRole = ApiSchema<'TeamRole'>;
|
|
155
|
+
/**
|
|
156
|
+
* One team row a `setMemberTeams` consent request sets: `team`, and the
|
|
157
|
+
* member's `role` and `capabilities` bits (`ORG_CAPABILITIES`) there,
|
|
158
|
+
* each the team's default when left out.
|
|
159
|
+
*/
|
|
160
|
+
export type MemberTeamConsent = ConsentRequestOf<'setMemberTeams'>['subject']['teams'][number];
|
|
161
|
+
/**
|
|
162
|
+
* Whose capability bits (`ORG_CAPABILITIES`) a `setCapabilities`
|
|
163
|
+
* consent request sets: with `account`, that member's (organization-wide, or
|
|
164
|
+
* in `team`); without, a default (the organization's, or `team`'s).
|
|
165
|
+
*/
|
|
166
|
+
export type CapabilitiesConsentSubject = ConsentRequestOf<'setCapabilities'>['subject'];
|
|
182
167
|
/** The node's answer to a consent request: send the person to `url`. */
|
|
183
168
|
export type ConsentStarted = ApiAnswer<'consent_page_create'>;
|
|
184
169
|
/** How {@link CalimeroClient.openConsentPage} sends the person to the page. */
|
|
@@ -202,30 +187,35 @@ export interface OpenConsentOptions {
|
|
|
202
187
|
export declare function confirmationCode(requestId: string): Promise<string>;
|
|
203
188
|
/**
|
|
204
189
|
* What an approval made, by kind (`outcome` on {@link ConsentResult}, once
|
|
205
|
-
* approved): `
|
|
206
|
-
* `
|
|
190
|
+
* approved): `createOrg`, `createInvite`, `acceptInvite`, `renameOrg` and
|
|
191
|
+
* `deleteOrg` make something; the other kinds nothing. An invite's `token` is
|
|
192
|
+
* a credential: keep it out of logs.
|
|
207
193
|
*/
|
|
208
194
|
export interface ConsentOutcomes {
|
|
209
195
|
release: never;
|
|
210
196
|
upgrade: never;
|
|
211
197
|
outbound: never;
|
|
212
|
-
createOrg:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
198
|
+
createOrg: Required<Pick<GeneratedOutcome, 'orgId'>>;
|
|
199
|
+
createInvite: Required<Pick<GeneratedOutcome, 'token'>>;
|
|
200
|
+
acceptInvite: Required<Pick<GeneratedOutcome, 'org'>>;
|
|
201
|
+
leaveOrg: never;
|
|
202
|
+
removeMember: never;
|
|
203
|
+
setMemberRole: never;
|
|
204
|
+
setMemberTeams: never;
|
|
205
|
+
removeMemberTeams: never;
|
|
206
|
+
revokeInvite: never;
|
|
207
|
+
renameOrg: Required<Pick<GeneratedOutcome, 'orgId' | 'name'>>;
|
|
208
|
+
/** The apps deleted with the organization. */
|
|
209
|
+
deleteOrg: Required<Pick<GeneratedOutcome, 'apps'>>;
|
|
210
|
+
setCapabilities: never;
|
|
211
|
+
setAllApps: never;
|
|
221
212
|
}
|
|
222
|
-
/**
|
|
223
|
-
|
|
224
|
-
|
|
213
|
+
/** The route's generated answer, whose one `outcome` has every kind's fields optional. */
|
|
214
|
+
type GeneratedResult = ApiAnswer<'consent_page_result'>;
|
|
215
|
+
type GeneratedOutcome = NonNullable<GeneratedResult['outcome']>;
|
|
216
|
+
/** `GET /consent/{id}/result` for a request of kind `K`: `requestId`, `status`, and `decidedAt` (Unix seconds; `null` while pending). */
|
|
217
|
+
export interface ConsentResultOf<K extends ConsentKind> extends Omit<GeneratedResult, 'kind' | 'outcome'> {
|
|
225
218
|
kind: K;
|
|
226
|
-
status: 'pending' | 'approved' | 'declined';
|
|
227
|
-
/** Unix seconds; `null` while pending. */
|
|
228
|
-
decidedAt: number | null;
|
|
229
219
|
/** What the approval made, once approved, for the kinds that make something. */
|
|
230
220
|
outcome?: ConsentOutcomes[K];
|
|
231
221
|
}
|
|
@@ -234,8 +224,7 @@ export interface ConsentResultOf<K extends ConsentKind> {
|
|
|
234
224
|
* `if (r.kind === 'createOrg') r.outcome?.orgId`. Read `outcome` only from
|
|
235
225
|
* this sealed answer, never from the page's redirect, which carries none.
|
|
236
226
|
*
|
|
237
|
-
*
|
|
238
|
-
* organization kinds (core#5014) yet; the next openapi-sync brings them.
|
|
227
|
+
* The generated answer, with `outcome` typed by kind.
|
|
239
228
|
*/
|
|
240
229
|
export type ConsentResult = {
|
|
241
230
|
[K in ConsentKind]: ConsentResultOf<K>;
|
|
@@ -354,3 +343,44 @@ export declare function createInviteConsent(subject: InviteConsentSubject, retur
|
|
|
354
343
|
export declare function acceptInviteConsent(token: string, returnTo: string): ConsentRequest & {
|
|
355
344
|
kind: 'acceptInvite';
|
|
356
345
|
};
|
|
346
|
+
/** The consent request that has the person leave `org`. */
|
|
347
|
+
export declare function leaveOrgConsent(org: string, returnTo: string): ConsentRequest & {
|
|
348
|
+
kind: 'leaveOrg';
|
|
349
|
+
};
|
|
350
|
+
/** The consent request that removes `account` from `org`. */
|
|
351
|
+
export declare function removeMemberConsent(org: string, account: string, returnTo: string): ConsentRequest & {
|
|
352
|
+
kind: 'removeMember';
|
|
353
|
+
};
|
|
354
|
+
/** The consent request that gives the member `account` of `org` the role `role`. */
|
|
355
|
+
export declare function setMemberRoleConsent(org: string, account: string, role: OrgRole, returnTo: string): ConsentRequest & {
|
|
356
|
+
kind: 'setMemberRole';
|
|
357
|
+
};
|
|
358
|
+
/** The consent request that sets the member `account`'s rows in teams of `org`. */
|
|
359
|
+
export declare function setMemberTeamsConsent(org: string, account: string, teams: MemberTeamConsent[], returnTo: string): ConsentRequest & {
|
|
360
|
+
kind: 'setMemberTeams';
|
|
361
|
+
};
|
|
362
|
+
/** The consent request that removes the member `account` from `teams` of `org`. */
|
|
363
|
+
export declare function removeMemberTeamsConsent(org: string, account: string, teams: string[], returnTo: string): ConsentRequest & {
|
|
364
|
+
kind: 'removeMemberTeams';
|
|
365
|
+
};
|
|
366
|
+
/** The consent request that revokes the invite `inviteKey` of `org`. */
|
|
367
|
+
export declare function revokeInviteConsent(org: string, inviteKey: string, returnTo: string): ConsentRequest & {
|
|
368
|
+
kind: 'revokeInvite';
|
|
369
|
+
};
|
|
370
|
+
/** The consent request that renames `org` to `name`; its outcome is `{ orgId, name }`. */
|
|
371
|
+
export declare function renameOrgConsent(org: string, name: string, returnTo: string): ConsentRequest & {
|
|
372
|
+
kind: 'renameOrg';
|
|
373
|
+
};
|
|
374
|
+
/** The consent request that deletes `org`; its outcome lists the `apps` deleted with it. */
|
|
375
|
+
export declare function deleteOrgConsent(org: string, returnTo: string): ConsentRequest & {
|
|
376
|
+
kind: 'deleteOrg';
|
|
377
|
+
};
|
|
378
|
+
/** The consent request that sets capability bits in `subject.org` ({@link CapabilitiesConsentSubject}). */
|
|
379
|
+
export declare function setCapabilitiesConsent(subject: CapabilitiesConsentSubject, returnTo: string): ConsentRequest & {
|
|
380
|
+
kind: 'setCapabilities';
|
|
381
|
+
};
|
|
382
|
+
/** The consent request that gives the member `account` of `org` every app (`allApps: true`), or takes it back. */
|
|
383
|
+
export declare function setAllAppsConsent(org: string, account: string, allApps: boolean, returnTo: string): ConsentRequest & {
|
|
384
|
+
kind: 'setAllApps';
|
|
385
|
+
};
|
|
386
|
+
export {};
|
package/dist/client/approvals.js
CHANGED
|
@@ -212,3 +212,43 @@ export function createInviteConsent(subject, returnTo) {
|
|
|
212
212
|
export function acceptInviteConsent(token, returnTo) {
|
|
213
213
|
return { kind: 'acceptInvite', subject: { token }, returnTo };
|
|
214
214
|
}
|
|
215
|
+
/** The consent request that has the person leave `org`. */
|
|
216
|
+
export function leaveOrgConsent(org, returnTo) {
|
|
217
|
+
return { kind: 'leaveOrg', subject: { org }, returnTo };
|
|
218
|
+
}
|
|
219
|
+
/** The consent request that removes `account` from `org`. */
|
|
220
|
+
export function removeMemberConsent(org, account, returnTo) {
|
|
221
|
+
return { kind: 'removeMember', subject: { org, account }, returnTo };
|
|
222
|
+
}
|
|
223
|
+
/** The consent request that gives the member `account` of `org` the role `role`. */
|
|
224
|
+
export function setMemberRoleConsent(org, account, role, returnTo) {
|
|
225
|
+
return { kind: 'setMemberRole', subject: { org, account, role }, returnTo };
|
|
226
|
+
}
|
|
227
|
+
/** The consent request that sets the member `account`'s rows in teams of `org`. */
|
|
228
|
+
export function setMemberTeamsConsent(org, account, teams, returnTo) {
|
|
229
|
+
return { kind: 'setMemberTeams', subject: { org, account, teams }, returnTo };
|
|
230
|
+
}
|
|
231
|
+
/** The consent request that removes the member `account` from `teams` of `org`. */
|
|
232
|
+
export function removeMemberTeamsConsent(org, account, teams, returnTo) {
|
|
233
|
+
return { kind: 'removeMemberTeams', subject: { org, account, teams }, returnTo };
|
|
234
|
+
}
|
|
235
|
+
/** The consent request that revokes the invite `inviteKey` of `org`. */
|
|
236
|
+
export function revokeInviteConsent(org, inviteKey, returnTo) {
|
|
237
|
+
return { kind: 'revokeInvite', subject: { org, inviteKey }, returnTo };
|
|
238
|
+
}
|
|
239
|
+
/** The consent request that renames `org` to `name`; its outcome is `{ orgId, name }`. */
|
|
240
|
+
export function renameOrgConsent(org, name, returnTo) {
|
|
241
|
+
return { kind: 'renameOrg', subject: { org, name }, returnTo };
|
|
242
|
+
}
|
|
243
|
+
/** The consent request that deletes `org`; its outcome lists the `apps` deleted with it. */
|
|
244
|
+
export function deleteOrgConsent(org, returnTo) {
|
|
245
|
+
return { kind: 'deleteOrg', subject: { org }, returnTo };
|
|
246
|
+
}
|
|
247
|
+
/** The consent request that sets capability bits in `subject.org` ({@link CapabilitiesConsentSubject}). */
|
|
248
|
+
export function setCapabilitiesConsent(subject, returnTo) {
|
|
249
|
+
return { kind: 'setCapabilities', subject, returnTo };
|
|
250
|
+
}
|
|
251
|
+
/** The consent request that gives the member `account` of `org` every app (`allApps: true`), or takes it back. */
|
|
252
|
+
export function setAllAppsConsent(org, account, allApps, returnTo) {
|
|
253
|
+
return { kind: 'setAllApps', subject: { org, account, allApps }, returnTo };
|
|
254
|
+
}
|
|
@@ -521,8 +521,6 @@ export class CalimeroClient {
|
|
|
521
521
|
throw new Error('no window to open the consent page in; pass `navigate`');
|
|
522
522
|
w.location.assign(url);
|
|
523
523
|
});
|
|
524
|
-
// The organization kinds (core#5014) are typed by hand in approvals.ts
|
|
525
|
-
// until the vendored OpenAPI document names them.
|
|
526
524
|
const started = await this.consent.pageCreate({ body: request });
|
|
527
525
|
if (started.code !== undefined) {
|
|
528
526
|
const expected = await confirmationCode(started.requestId);
|
package/dist/client/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { AttestationDoc, NodePolicy, NodeReleasePolicy } from '../runtime/a
|
|
|
11
11
|
export { browserPasskey, b64url, fromB64url, passkeyConfirm } from '../runtime/passkey.js';
|
|
12
12
|
export { MAX_RECOVERY_NONCE_BYTES, RECOVERY_DOMAIN, newRecoverySeed, parseRecoverySeed, recoveryMessage, recoveryPublicKey, recoverySeedText, signRecovery, } from './recovery-key.js';
|
|
13
13
|
export type { ConfirmCallback, ConfirmChallenge, PasskeyConfirmOptions, AssertionJSON, PasskeyCreateOptions, PasskeyGetOptions, PasskeyProvider, PasskeyUserVerification, RegistrationJSON, } from '../runtime/passkey.js';
|
|
14
|
-
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
15
|
-
export type { ActorKind, AppsReport, Authority, ConsentKind, ConsentOutcomes, ConsentRequest, ConsentResult, ConsentResultOf, ConsentScope, ConsentStarted, InviteConsentSubject, InviteRole, OpenConsentOptions, ResumeConsentOptions, Governance, LatestBlocked, PageOptions, PendingApprovals, PendingRelease, PendingUpgrade, ReleaseDeadline, ReleaseRules, ReportScope, ReportedApp, ReportedBundle, RuntimeShortNode, } from './approvals.js';
|
|
14
|
+
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, deleteOrgConsent, leaveOrgConsent, removeMemberConsent, removeMemberTeamsConsent, renameOrgConsent, revokeInviteConsent, setAllAppsConsent, setCapabilitiesConsent, setMemberRoleConsent, setMemberTeamsConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
15
|
+
export type { ActorKind, AppsReport, Authority, CapabilitiesConsentSubject, ConsentKind, ConsentOutcomes, ConsentRequest, ConsentResult, ConsentResultOf, ConsentScope, ConsentStarted, InviteConsentSubject, InviteRole, MemberTeamConsent, OrgRole, TeamRole, OpenConsentOptions, ResumeConsentOptions, Governance, LatestBlocked, PageOptions, PendingApprovals, PendingRelease, PendingUpgrade, ReleaseDeadline, ReleaseRules, ReportScope, ReportedApp, ReportedBundle, RuntimeShortNode, } from './approvals.js';
|
|
16
16
|
export { DEFAULT_ORG_CAPABILITIES, ORG_CAPABILITIES, orgCapabilities } from './capabilities.js';
|
|
17
17
|
export type { OrgCapability } from './capabilities.js';
|
package/dist/client/index.js
CHANGED
|
@@ -14,5 +14,5 @@ export { AppError, ArgsTooLarge, BadOrigin, CalimeroError, ClusterNotUpgraded, C
|
|
|
14
14
|
export { claimedRelease, fetchAttestedKey, freshCollateral, MOCK_QUOTE_HEADER } from '../runtime/attestation.js';
|
|
15
15
|
export { browserPasskey, b64url, fromB64url, passkeyConfirm } from '../runtime/passkey.js';
|
|
16
16
|
export { MAX_RECOVERY_NONCE_BYTES, RECOVERY_DOMAIN, newRecoverySeed, parseRecoverySeed, recoveryMessage, recoveryPublicKey, recoverySeedText, signRecovery, } from './recovery-key.js';
|
|
17
|
-
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
17
|
+
export { CONSENT_STORAGE_KEY, MAX_REPORT_PAGE, RELEASE_VERIFIER, acceptInviteConsent, compareVersions, confirmationCode, consentReturn, createInviteConsent, createOrgConsent, deleteOrgConsent, leaveOrgConsent, removeMemberConsent, removeMemberTeamsConsent, renameOrgConsent, revokeInviteConsent, setAllAppsConsent, setCapabilitiesConsent, setMemberRoleConsent, setMemberTeamsConsent, pageQuery, pendingApprovalsFrom, publisherBindingBytes, publisherBindingMessage, releaseConsent, releaseNotesUrl, stalledBy, upgradeConsent, verifyReleaseUrl, withdrawConsent, withoutConsentReturn, } from './approvals.js';
|
|
18
18
|
export { DEFAULT_ORG_CAPABILITIES, ORG_CAPABILITIES, orgCapabilities } from './capabilities.js';
|
package/dist/generated/api.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface paths {
|
|
|
20
20
|
put?: never;
|
|
21
21
|
/**
|
|
22
22
|
* Create an app instance
|
|
23
|
-
* @description From a release (`package`, `version`, `service`), a deployment's offer (`deployment`), or an uploaded `bundle`; in an organization (`org`) or the caller's
|
|
23
|
+
* @description From a release (`package`, `version`, `service`), a deployment's offer (`deployment`), or an uploaded `bundle`; in an organization (`org`), or, naming none, the caller's personal organization. Every app is in an organization. `initArgs` go to the app's `init` and `metadata` is kept as given (both free-form JSON). Answers once `init` committed; `compute` says whether the app has a compute component.
|
|
24
24
|
*
|
|
25
25
|
* **Who:** an installer (an account holder, or an unscoped API key that is not read-only).
|
|
26
26
|
*/
|
|
@@ -1106,7 +1106,7 @@ export interface paths {
|
|
|
1106
1106
|
};
|
|
1107
1107
|
/**
|
|
1108
1108
|
* The account's own apps
|
|
1109
|
-
* @description
|
|
1109
|
+
* @description The apps the account owns, in any organization (a package-bound session: its package's), with its personal organization's `approvedReleases`: each app's release, the newer releases it may upgrade to, its last upgrade, its replicas' releases and `lastWriteAt`.
|
|
1110
1110
|
*
|
|
1111
1111
|
* **Who:** signed in (a session or an API key).
|
|
1112
1112
|
*/
|
|
@@ -1198,7 +1198,7 @@ export interface paths {
|
|
|
1198
1198
|
};
|
|
1199
1199
|
/**
|
|
1200
1200
|
* The caller's account
|
|
1201
|
-
* @description The account, its passkeys (with `addedAt` and `lastSignInAt`), organizations, approvals
|
|
1201
|
+
* @description The account, its passkeys (with `addedAt` and `lastSignInAt`), organizations (`personal`: the one made at sign-up, where its instances go unless they name another; its approvals are that organization's), recovery state, and how the caller came (`via`).
|
|
1202
1202
|
*
|
|
1203
1203
|
* **Who:** signed in (a session or an API key).
|
|
1204
1204
|
*/
|
|
@@ -1211,26 +1211,6 @@ export interface paths {
|
|
|
1211
1211
|
patch?: never;
|
|
1212
1212
|
trace?: never;
|
|
1213
1213
|
};
|
|
1214
|
-
"/auth/outbound": {
|
|
1215
|
-
parameters: {
|
|
1216
|
-
query?: never;
|
|
1217
|
-
header?: never;
|
|
1218
|
-
path?: never;
|
|
1219
|
-
cookie?: never;
|
|
1220
|
-
};
|
|
1221
|
-
get?: never;
|
|
1222
|
-
put?: never;
|
|
1223
|
-
/**
|
|
1224
|
-
* Approve outbound prefixes for the account's apps
|
|
1225
|
-
* @description **Who:** an account holder (a passkey session not bound to an app's frontend). **Step-up:** answers `412 CONFIRM_REQUIRED` first; send the same request again with `confirm`, a passkey assertion over `details.challenge`.
|
|
1226
|
-
*/
|
|
1227
|
-
post: operations["account_outbound_approval"];
|
|
1228
|
-
delete?: never;
|
|
1229
|
-
options?: never;
|
|
1230
|
-
head?: never;
|
|
1231
|
-
patch?: never;
|
|
1232
|
-
trace?: never;
|
|
1233
|
-
};
|
|
1234
1214
|
"/auth/passkey/login/begin": {
|
|
1235
1215
|
parameters: {
|
|
1236
1216
|
query?: never;
|
|
@@ -1523,28 +1503,6 @@ export interface paths {
|
|
|
1523
1503
|
patch?: never;
|
|
1524
1504
|
trace?: never;
|
|
1525
1505
|
};
|
|
1526
|
-
"/auth/releases": {
|
|
1527
|
-
parameters: {
|
|
1528
|
-
query?: never;
|
|
1529
|
-
header?: never;
|
|
1530
|
-
path?: never;
|
|
1531
|
-
cookie?: never;
|
|
1532
|
-
};
|
|
1533
|
-
get?: never;
|
|
1534
|
-
put?: never;
|
|
1535
|
-
/**
|
|
1536
|
-
* Approve a mero-tee release for the account's apps
|
|
1537
|
-
* @description Where the owner holds release approvals; `412` first.
|
|
1538
|
-
*
|
|
1539
|
-
* **Who:** an account holder (a passkey session not bound to an app's frontend). **Step-up:** answers `412 CONFIRM_REQUIRED` first; send the same request again with `confirm`, a passkey assertion over `details.challenge`.
|
|
1540
|
-
*/
|
|
1541
|
-
post: operations["account_release_approval"];
|
|
1542
|
-
delete?: never;
|
|
1543
|
-
options?: never;
|
|
1544
|
-
head?: never;
|
|
1545
|
-
patch?: never;
|
|
1546
|
-
trace?: never;
|
|
1547
|
-
};
|
|
1548
1506
|
"/auth/sessions": {
|
|
1549
1507
|
parameters: {
|
|
1550
1508
|
query?: never;
|
|
@@ -1828,7 +1786,7 @@ export interface paths {
|
|
|
1828
1786
|
};
|
|
1829
1787
|
/**
|
|
1830
1788
|
* The organizations a deployment serves
|
|
1831
|
-
* @description For its managers: each organization with instances from it, its name (`null` when unknown), member counts (`activeMembers30d`: active in the last 30 days), its instances and the releases they run, and when its first was created (RFC 3339); instances outside an organization are only counted (`outsideOrgs`). Never who the members are.
|
|
1789
|
+
* @description For its managers: each organization with instances from it, its name (`null` when unknown), member counts (`activeMembers30d`: active in the last 30 days), its instances and the releases they run, and when its first was created (RFC 3339); instances outside an organization, or in a personal organization, are only counted (`outsideOrgs`). Never who the members are.
|
|
1832
1790
|
*
|
|
1833
1791
|
* **Who:** signed in (a session or an API key).
|
|
1834
1792
|
*/
|
|
@@ -2726,7 +2684,7 @@ export interface paths {
|
|
|
2726
2684
|
put?: never;
|
|
2727
2685
|
/**
|
|
2728
2686
|
* Create an organization
|
|
2729
|
-
* @description `recoveryKey` is the public half of an organization recovery key.
|
|
2687
|
+
* @description `recoveryKey` is the public half of an organization recovery key. Every account also has a personal organization from sign-up (`personal` in `/auth/me`), which this does not make.
|
|
2730
2688
|
*
|
|
2731
2689
|
* **Who:** a passkey session (an API key is refused).
|
|
2732
2690
|
*/
|
|
@@ -4413,7 +4371,7 @@ export interface components {
|
|
|
4413
4371
|
proofKey: string;
|
|
4414
4372
|
};
|
|
4415
4373
|
};
|
|
4416
|
-
/** @description An organization as `GET /orgs/{org}` answers it. `members` maps each account to its role, `capabilities` and `defaultCapabilities` are capability bits, `outboundApprovals` is keyed by package signer, `upgradeRuns` by run id; `recovery` is absent when the organization set no recovery key, `allApps` when no member gets every app added later. */
|
|
4374
|
+
/** @description An organization as `GET /orgs/{org}` answers it. `members` maps each account to its role, `capabilities` and `defaultCapabilities` are capability bits, `outboundApprovals` is keyed by package signer, `upgradeRuns` by run id; `recovery` is absent when the organization set no recovery key, `allApps` when no member gets every app added later, `personal` unless it is its owner's personal organization (where instances created without naming an organization go). */
|
|
4417
4375
|
Org: {
|
|
4418
4376
|
orgId: string;
|
|
4419
4377
|
name: string;
|
|
@@ -4453,6 +4411,7 @@ export interface components {
|
|
|
4453
4411
|
} | null;
|
|
4454
4412
|
};
|
|
4455
4413
|
allApps?: string[];
|
|
4414
|
+
personal?: boolean;
|
|
4456
4415
|
/** @enum {string} */
|
|
4457
4416
|
mode?: "legacy" | "standalone" | "shared";
|
|
4458
4417
|
releaseApprovers?: string[];
|
|
@@ -4553,11 +4512,12 @@ export interface components {
|
|
|
4553
4512
|
prefixes: string[];
|
|
4554
4513
|
reviewed: string[];
|
|
4555
4514
|
};
|
|
4556
|
-
/** @description The scope whose approvals cover an app: its organization
|
|
4515
|
+
/** @description The scope whose approvals cover an app: its organization (`personal: true` when it is its owner's personal organization). `account` is only `GET /auth/apps`' own scope: the apps the account owns, wherever they are. */
|
|
4557
4516
|
AppScope: {
|
|
4558
4517
|
/** @enum {string} */
|
|
4559
4518
|
kind: "org";
|
|
4560
4519
|
org: string;
|
|
4520
|
+
personal?: boolean;
|
|
4561
4521
|
} | {
|
|
4562
4522
|
/** @enum {string} */
|
|
4563
4523
|
kind: "account";
|
|
@@ -8932,16 +8892,13 @@ export interface operations {
|
|
|
8932
8892
|
orgId: string;
|
|
8933
8893
|
name: string;
|
|
8934
8894
|
role: components["schemas"]["OrgRole"];
|
|
8895
|
+
personal?: boolean;
|
|
8935
8896
|
}[];
|
|
8936
8897
|
/** @enum {string} */
|
|
8937
8898
|
via: "session" | "apiKey";
|
|
8938
8899
|
passkeyId: string | null;
|
|
8939
8900
|
app?: string | null;
|
|
8940
8901
|
origin?: string | null;
|
|
8941
|
-
approvedReleases: string[];
|
|
8942
|
-
outboundApprovals: {
|
|
8943
|
-
[key: string]: components["schemas"]["OutboundApproval"];
|
|
8944
|
-
};
|
|
8945
8902
|
recoveryCode?: boolean;
|
|
8946
8903
|
recoveryPending?: {
|
|
8947
8904
|
accountId: string;
|
|
@@ -8983,80 +8940,6 @@ export interface operations {
|
|
|
8983
8940
|
};
|
|
8984
8941
|
};
|
|
8985
8942
|
};
|
|
8986
|
-
account_outbound_approval: {
|
|
8987
|
-
parameters: {
|
|
8988
|
-
query?: never;
|
|
8989
|
-
header?: never;
|
|
8990
|
-
path?: never;
|
|
8991
|
-
cookie?: never;
|
|
8992
|
-
};
|
|
8993
|
-
requestBody: {
|
|
8994
|
-
content: {
|
|
8995
|
-
"application/json": {
|
|
8996
|
-
package: string;
|
|
8997
|
-
prefixes?: components["schemas"]["OutboundSelection"];
|
|
8998
|
-
replace?: boolean;
|
|
8999
|
-
confirm?: components["schemas"]["Confirm"];
|
|
9000
|
-
};
|
|
9001
|
-
};
|
|
9002
|
-
};
|
|
9003
|
-
responses: {
|
|
9004
|
-
/** @description OK */
|
|
9005
|
-
200: {
|
|
9006
|
-
headers: {
|
|
9007
|
-
[name: string]: unknown;
|
|
9008
|
-
};
|
|
9009
|
-
content: {
|
|
9010
|
-
"application/json": components["schemas"]["OutboundApproved"];
|
|
9011
|
-
};
|
|
9012
|
-
};
|
|
9013
|
-
/** @description `EXPIRED_CHALLENGE`; `UNKNOWN_CHALLENGE` */
|
|
9014
|
-
400: {
|
|
9015
|
-
headers: {
|
|
9016
|
-
[name: string]: unknown;
|
|
9017
|
-
};
|
|
9018
|
-
content: {
|
|
9019
|
-
"application/json": components["schemas"]["Error"];
|
|
9020
|
-
};
|
|
9021
|
-
};
|
|
9022
|
-
/** @description `UNAUTHENTICATED`: no, unknown, expired or revoked credential */
|
|
9023
|
-
401: {
|
|
9024
|
-
headers: {
|
|
9025
|
-
[name: string]: unknown;
|
|
9026
|
-
};
|
|
9027
|
-
content: {
|
|
9028
|
-
"application/json": components["schemas"]["Error"];
|
|
9029
|
-
};
|
|
9030
|
-
};
|
|
9031
|
-
/** @description `FORBIDDEN`: the credential may not do this (scope, role, governance, read-only) */
|
|
9032
|
-
403: {
|
|
9033
|
-
headers: {
|
|
9034
|
-
[name: string]: unknown;
|
|
9035
|
-
};
|
|
9036
|
-
content: {
|
|
9037
|
-
"application/json": components["schemas"]["Error"];
|
|
9038
|
-
};
|
|
9039
|
-
};
|
|
9040
|
-
/** @description `CONFIRM_REQUIRED`: a passkey assertion is needed; `details` carries the challenge. `details` of `CONFIRM_REQUIRED`: a `ConfirmRequired`. */
|
|
9041
|
-
412: {
|
|
9042
|
-
headers: {
|
|
9043
|
-
[name: string]: unknown;
|
|
9044
|
-
};
|
|
9045
|
-
content: {
|
|
9046
|
-
"application/json": components["schemas"]["Error"];
|
|
9047
|
-
};
|
|
9048
|
-
};
|
|
9049
|
-
/** @description `WRONG_NODE`: this node runs a release the account's owners have not approved, so it neither issues nor takes the account's sessions; send it to another node of the cluster (no `details`; nothing was spent) */
|
|
9050
|
-
421: {
|
|
9051
|
-
headers: {
|
|
9052
|
-
[name: string]: unknown;
|
|
9053
|
-
};
|
|
9054
|
-
content: {
|
|
9055
|
-
"application/json": components["schemas"]["Error"];
|
|
9056
|
-
};
|
|
9057
|
-
};
|
|
9058
|
-
};
|
|
9059
|
-
};
|
|
9060
8943
|
login_begin: {
|
|
9061
8944
|
parameters: {
|
|
9062
8945
|
query?: never;
|
|
@@ -9975,79 +9858,6 @@ export interface operations {
|
|
|
9975
9858
|
};
|
|
9976
9859
|
};
|
|
9977
9860
|
};
|
|
9978
|
-
account_release_approval: {
|
|
9979
|
-
parameters: {
|
|
9980
|
-
query?: never;
|
|
9981
|
-
header?: never;
|
|
9982
|
-
path?: never;
|
|
9983
|
-
cookie?: never;
|
|
9984
|
-
};
|
|
9985
|
-
requestBody: {
|
|
9986
|
-
content: {
|
|
9987
|
-
"application/json": {
|
|
9988
|
-
version: string;
|
|
9989
|
-
approved?: boolean;
|
|
9990
|
-
confirm?: components["schemas"]["Confirm"];
|
|
9991
|
-
};
|
|
9992
|
-
};
|
|
9993
|
-
};
|
|
9994
|
-
responses: {
|
|
9995
|
-
/** @description OK */
|
|
9996
|
-
200: {
|
|
9997
|
-
headers: {
|
|
9998
|
-
[name: string]: unknown;
|
|
9999
|
-
};
|
|
10000
|
-
content: {
|
|
10001
|
-
"application/json": components["schemas"]["ApprovedReleases"];
|
|
10002
|
-
};
|
|
10003
|
-
};
|
|
10004
|
-
/** @description `EXPIRED_CHALLENGE`; `UNKNOWN_CHALLENGE` */
|
|
10005
|
-
400: {
|
|
10006
|
-
headers: {
|
|
10007
|
-
[name: string]: unknown;
|
|
10008
|
-
};
|
|
10009
|
-
content: {
|
|
10010
|
-
"application/json": components["schemas"]["Error"];
|
|
10011
|
-
};
|
|
10012
|
-
};
|
|
10013
|
-
/** @description `UNAUTHENTICATED`: no, unknown, expired or revoked credential */
|
|
10014
|
-
401: {
|
|
10015
|
-
headers: {
|
|
10016
|
-
[name: string]: unknown;
|
|
10017
|
-
};
|
|
10018
|
-
content: {
|
|
10019
|
-
"application/json": components["schemas"]["Error"];
|
|
10020
|
-
};
|
|
10021
|
-
};
|
|
10022
|
-
/** @description `FORBIDDEN`: the credential may not do this (scope, role, governance, read-only) */
|
|
10023
|
-
403: {
|
|
10024
|
-
headers: {
|
|
10025
|
-
[name: string]: unknown;
|
|
10026
|
-
};
|
|
10027
|
-
content: {
|
|
10028
|
-
"application/json": components["schemas"]["Error"];
|
|
10029
|
-
};
|
|
10030
|
-
};
|
|
10031
|
-
/** @description `CONFIRM_REQUIRED`: a passkey assertion is needed; `details` carries the challenge. `details` of `CONFIRM_REQUIRED`: a `ConfirmRequired`. */
|
|
10032
|
-
412: {
|
|
10033
|
-
headers: {
|
|
10034
|
-
[name: string]: unknown;
|
|
10035
|
-
};
|
|
10036
|
-
content: {
|
|
10037
|
-
"application/json": components["schemas"]["Error"];
|
|
10038
|
-
};
|
|
10039
|
-
};
|
|
10040
|
-
/** @description `WRONG_NODE`: this node runs a release the account's owners have not approved, so it neither issues nor takes the account's sessions; send it to another node of the cluster (no `details`; nothing was spent) */
|
|
10041
|
-
421: {
|
|
10042
|
-
headers: {
|
|
10043
|
-
[name: string]: unknown;
|
|
10044
|
-
};
|
|
10045
|
-
content: {
|
|
10046
|
-
"application/json": components["schemas"]["Error"];
|
|
10047
|
-
};
|
|
10048
|
-
};
|
|
10049
|
-
};
|
|
10050
|
-
};
|
|
10051
9861
|
sessions_list: {
|
|
10052
9862
|
parameters: {
|
|
10053
9863
|
query?: never;
|
|
@@ -14036,6 +13846,15 @@ export interface operations {
|
|
|
14036
13846
|
};
|
|
14037
13847
|
};
|
|
14038
13848
|
};
|
|
13849
|
+
/** @description `BAD_REQUEST`: the request is malformed */
|
|
13850
|
+
400: {
|
|
13851
|
+
headers: {
|
|
13852
|
+
[name: string]: unknown;
|
|
13853
|
+
};
|
|
13854
|
+
content: {
|
|
13855
|
+
"application/json": components["schemas"]["Error"];
|
|
13856
|
+
};
|
|
13857
|
+
};
|
|
14039
13858
|
/** @description `UNAUTHENTICATED`: no, unknown, expired or revoked credential */
|
|
14040
13859
|
401: {
|
|
14041
13860
|
headers: {
|