@calimero-network/mero-js 35.5.0 → 35.7.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 CHANGED
@@ -78,7 +78,7 @@ environment.
78
78
 
79
79
  `CalimeroClient.connect({ cluster, policy })` is the recommended way to reach a
80
80
  Calimero Cloud cluster. It reads the cluster's nodes from the public node
81
- directory (`DEFAULT_DIRECTORY`, `https://manager.cloud.calimero.network/api/v2/directory`;
81
+ directory (`DEFAULT_DIRECTORY`, `https://manager.cloud.calimero.network/api/directory`;
82
82
  `directory` names another), puts those in `zone` first when you give one, and
83
83
  orders each group at random, weighted by the directory's weight. A cluster the
84
84
  directory does not know, or one with no usable node, throws `DirectoryError`.
@@ -335,8 +335,11 @@ export declare function withdrawConsent(scope: ReportScope, version: string, ret
335
335
  export declare function upgradeConsent(app: string, toVersion: string, returnTo: string): ConsentRequest & {
336
336
  kind: 'upgrade';
337
337
  };
338
- /** The consent request that creates an organization named `name`; its outcome names the new `orgId`. */
339
- export declare function createOrgConsent(name: string, returnTo: string): ConsentRequest & {
338
+ /**
339
+ * The consent request that creates an organization named `name`; its outcome names the new `orgId`.
340
+ * `capabilities` (`ORG_CAPABILITIES` bits) is what members get unless set for them, in place of the default.
341
+ */
342
+ export declare function createOrgConsent(name: string, returnTo: string, capabilities?: number): ConsentRequest & {
340
343
  kind: 'createOrg';
341
344
  };
342
345
  /** The consent request that creates an invite to `subject.org`; its outcome carries the invite's `token`. */
@@ -207,9 +207,12 @@ export function withdrawConsent(scope, version, returnTo) {
207
207
  export function upgradeConsent(app, toVersion, returnTo) {
208
208
  return { kind: 'upgrade', subject: { app, toVersion }, returnTo };
209
209
  }
210
- /** The consent request that creates an organization named `name`; its outcome names the new `orgId`. */
211
- export function createOrgConsent(name, returnTo) {
212
- return { kind: 'createOrg', subject: { name }, returnTo };
210
+ /**
211
+ * The consent request that creates an organization named `name`; its outcome names the new `orgId`.
212
+ * `capabilities` (`ORG_CAPABILITIES` bits) is what members get unless set for them, in place of the default.
213
+ */
214
+ export function createOrgConsent(name, returnTo, capabilities) {
215
+ return { kind: 'createOrg', subject: capabilities === undefined ? { name } : { name, capabilities }, returnTo };
213
216
  }
214
217
  /** The consent request that creates an invite to `subject.org`; its outcome carries the invite's `token`. */
215
218
  export function createInviteConsent(subject, returnTo) {
@@ -29,6 +29,8 @@ export declare const ORG_CAPABILITIES: {
29
29
  * (`client.orgs.publisher`). Organization-wide only. Bit 9 is left unused.
30
30
  */
31
31
  readonly APPROVE_RELEASES: number;
32
+ /** Create a restricted team below a team one writes, without leading it; the creator leads the new team. */
33
+ readonly CREATE_CHILD_TEAM: number;
32
34
  };
33
35
  export type OrgCapability = keyof typeof ORG_CAPABILITIES;
34
36
  /** What a member holds unless an admin says otherwise. */
@@ -29,6 +29,8 @@ export const ORG_CAPABILITIES = {
29
29
  * (`client.orgs.publisher`). Organization-wide only. Bit 9 is left unused.
30
30
  */
31
31
  APPROVE_RELEASES: 1 << 10,
32
+ /** Create a restricted team below a team one writes, without leading it; the creator leads the new team. */
33
+ CREATE_CHILD_TEAM: 1 << 11,
32
34
  };
33
35
  /** What a member holds unless an admin says otherwise. */
34
36
  export const DEFAULT_ORG_CAPABILITIES = ORG_CAPABILITIES.JOIN_OPEN_TEAMS;
@@ -2728,7 +2728,7 @@ export interface paths {
2728
2728
  put?: never;
2729
2729
  /**
2730
2730
  * Create an organization
2731
- * @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.
2731
+ * @description `recoveryKey` is the public half of an organization recovery key. `capabilities` (bits) is what members can do unless set for them, in place of the default; `409 FEATURE_NOT_ACTIVE` below cluster version 1.0.0-rc.29. Every account also has a personal organization from sign-up (`personal` in `/auth/me`), which this does not make.
2732
2732
  *
2733
2733
  * **Who:** a passkey session (an API key is refused).
2734
2734
  */
@@ -2906,7 +2906,7 @@ export interface paths {
2906
2906
  put?: never;
2907
2907
  /**
2908
2908
  * Make an invite
2909
- * @description A token for `role` and `teams`, `uses` times within `ttlSecs`; `allApps` (an admin's) also gives every app added later. `412` first.
2909
+ * @description A token for `role` and `teams`, `uses` times within `ttlSecs`; `allApps` (an admin's) also gives every app added later; `capabilities` (bits) is what a new member gets as their own setting, no more than the creator holds (`403`), and `409 FEATURE_NOT_ACTIVE` below cluster version 1.0.0-rc.29. `412` first.
2910
2910
  *
2911
2911
  * **Who:** a passkey session (an API key is refused). **Step-up:** answers `412 CONFIRM_REQUIRED` first; send the same request again with `confirm`, a passkey assertion over `details.challenge`.
2912
2912
  */
@@ -10310,6 +10310,8 @@ export interface operations {
10310
10310
  kind: "createOrg";
10311
10311
  subject: {
10312
10312
  name: string;
10313
+ /** Format: int64 */
10314
+ capabilities?: number;
10313
10315
  };
10314
10316
  returnTo: string;
10315
10317
  } | {
@@ -10325,6 +10327,8 @@ export interface operations {
10325
10327
  /** Format: int64 */
10326
10328
  uses?: number;
10327
10329
  allApps?: boolean;
10330
+ /** Format: int64 */
10331
+ capabilities?: number;
10328
10332
  };
10329
10333
  returnTo: string;
10330
10334
  } | {
@@ -10445,7 +10449,7 @@ export interface operations {
10445
10449
  };
10446
10450
  };
10447
10451
  };
10448
- /** @description `BAD_REQUEST`: the request is malformed */
10452
+ /** @description `BAD_REQUEST`: the request is malformed; `UNKNOWN_CAPABILITIES` */
10449
10453
  400: {
10450
10454
  headers: {
10451
10455
  [name: string]: unknown;
@@ -10463,7 +10467,7 @@ export interface operations {
10463
10467
  "application/json": components["schemas"]["Error"];
10464
10468
  };
10465
10469
  };
10466
- /** @description `FORBIDDEN`: the credential may not do this (scope, role, governance, read-only) */
10470
+ /** @description `CANNOT_GRANT_UNHELD`; `FORBIDDEN`: the credential may not do this (scope, role, governance, read-only) */
10467
10471
  403: {
10468
10472
  headers: {
10469
10473
  [name: string]: unknown;
@@ -10472,6 +10476,15 @@ export interface operations {
10472
10476
  "application/json": components["schemas"]["Error"];
10473
10477
  };
10474
10478
  };
10479
+ /** @description `FEATURE_NOT_ACTIVE`. `details` of `FEATURE_NOT_ACTIVE`: a `FeatureNotActive`. */
10480
+ 409: {
10481
+ headers: {
10482
+ [name: string]: unknown;
10483
+ };
10484
+ content: {
10485
+ "application/json": components["schemas"]["Error"];
10486
+ };
10487
+ };
10475
10488
  /** @description `TOO_LARGE` */
10476
10489
  413: {
10477
10490
  headers: {
@@ -14057,6 +14070,8 @@ export interface operations {
14057
14070
  "application/json": {
14058
14071
  name: string;
14059
14072
  recoveryKey?: string;
14073
+ /** Format: int64 */
14074
+ capabilities?: number;
14060
14075
  };
14061
14076
  };
14062
14077
  };
@@ -14072,7 +14087,7 @@ export interface operations {
14072
14087
  };
14073
14088
  };
14074
14089
  };
14075
- /** @description `BAD_REQUEST`: the request is malformed */
14090
+ /** @description `BAD_REQUEST`: the request is malformed; `UNKNOWN_CAPABILITIES` */
14076
14091
  400: {
14077
14092
  headers: {
14078
14093
  [name: string]: unknown;
@@ -14099,6 +14114,15 @@ export interface operations {
14099
14114
  "application/json": components["schemas"]["Error"];
14100
14115
  };
14101
14116
  };
14117
+ /** @description `FEATURE_NOT_ACTIVE`. `details` of `FEATURE_NOT_ACTIVE`: a `FeatureNotActive`. */
14118
+ 409: {
14119
+ headers: {
14120
+ [name: string]: unknown;
14121
+ };
14122
+ content: {
14123
+ "application/json": components["schemas"]["Error"];
14124
+ };
14125
+ };
14102
14126
  /** @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) */
14103
14127
  421: {
14104
14128
  headers: {
@@ -14873,6 +14897,8 @@ export interface operations {
14873
14897
  /** Format: int64 */
14874
14898
  uses?: number;
14875
14899
  allApps?: boolean;
14900
+ /** Format: int64 */
14901
+ capabilities?: number;
14876
14902
  confirm?: components["schemas"]["Confirm"];
14877
14903
  };
14878
14904
  };
@@ -14889,7 +14915,7 @@ export interface operations {
14889
14915
  };
14890
14916
  };
14891
14917
  };
14892
- /** @description `EXPIRED_CHALLENGE`; `UNKNOWN_CHALLENGE`; `WRONG_CHALLENGE` */
14918
+ /** @description `EXPIRED_CHALLENGE`; `UNKNOWN_CAPABILITIES`; `UNKNOWN_CHALLENGE`; `WRONG_CHALLENGE` */
14893
14919
  400: {
14894
14920
  headers: {
14895
14921
  [name: string]: unknown;
@@ -14907,7 +14933,7 @@ export interface operations {
14907
14933
  "application/json": components["schemas"]["Error"];
14908
14934
  };
14909
14935
  };
14910
- /** @description `FORBIDDEN`: the credential may not do this (scope, role, governance, read-only) */
14936
+ /** @description `CANNOT_GRANT_UNHELD`; `FORBIDDEN`: the credential may not do this (scope, role, governance, read-only) */
14911
14937
  403: {
14912
14938
  headers: {
14913
14939
  [name: string]: unknown;