@calimero-network/mero-react 11.1.0 → 11.1.2

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/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties } from 'react';
3
- import { CloudPolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, CloudRetryOptions, CallResult, ViewResult, AppInfo, PackageInfo, OrgInfo, ConsentRequest, ConsentStarted, OpenConsentOptions, ConsentResult, BlobInfo } from '@calimero-network/mero-js';
3
+ import * as _calimero_network_mero_js from '@calimero-network/mero-js';
4
+ import { NodePolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, RetryOptions, CallResult, ViewResult, ConsentRequest, OpenConsentOptions } from '@calimero-network/mero-js';
4
5
  export * from '@calimero-network/mero-js';
5
6
 
6
7
  /**
@@ -11,7 +12,7 @@ export * from '@calimero-network/mero-js';
11
12
  /** How the provider decides which nodes to trust. */
12
13
  interface PolicyOptions {
13
14
  /** The full policy, as mero-js takes it. Wins over `minReleaseVersion`. */
14
- policy?: CloudPolicy;
15
+ policy?: NodePolicy;
15
16
  /**
16
17
  * The oldest mero-tee release to trust (e.g. `2.3.109`): shorthand for
17
18
  * `policy: { release: { minReleaseVersion } }`.
@@ -27,7 +28,7 @@ interface PolicyOptions {
27
28
  * The policy for {@link PolicyOptions}. Throws when nothing says what to trust:
28
29
  * a client that trusted every quote would not be verifying anything.
29
30
  */
30
- declare function resolvePolicy({ policy, minReleaseVersion, allowMock }: PolicyOptions): CloudPolicy;
31
+ declare function resolvePolicy({ policy, minReleaseVersion, allowMock }: PolicyOptions): NodePolicy;
31
32
  /**
32
33
  * A `CalimeroClient` that reports every session it takes: a sign-in, a sign-up
33
34
  * and the refreshes the client makes by itself on a `401` (single-flight, any
@@ -210,7 +211,7 @@ interface MeroProviderConfig extends PolicyOptions {
210
211
  /** The `fetch` the client sends attestation and sealed envelopes with. */
211
212
  fetch?: typeof fetch;
212
213
  /** How calls and views retry a `503` or a dropped connection. */
213
- retry?: CloudRetryOptions;
214
+ retry?: RetryOptions;
214
215
  /**
215
216
  * Use this client instead of building one (tests, or an app that needs a
216
217
  * client configured beyond these props). Session reporting is then the
@@ -349,7 +350,15 @@ declare function useApp(appId?: string | null): {
349
350
  */
350
351
  declare function useExecute(appId?: string | null, options?: MutationOptions): {
351
352
  execute: <T = unknown>(method: string, args?: unknown, callOptions?: CallOptions) => Promise<T | null>;
352
- call: (method: string, args?: unknown, callOptions?: CallOptions) => Promise<CallResult | null>;
353
+ call: (method: string, args?: unknown, callOptions?: CallOptions) => Promise<{
354
+ index: number;
355
+ result: unknown;
356
+ events: {
357
+ kind: string;
358
+ data: unknown;
359
+ }[];
360
+ receipt: _calimero_network_mero_js.ApiComponents["schemas"]["Receipt"];
361
+ } | null>;
353
362
  loading: boolean;
354
363
  error: Error | null;
355
364
  failure: Failure | null;
@@ -449,7 +458,16 @@ interface AppUpgradeResult {
449
458
  declare function useApps(filter?: {
450
459
  package?: string;
451
460
  bundle?: string;
452
- }): ResourceState<AppInfo[]>;
461
+ }): ResourceState<{
462
+ appId: string;
463
+ name: string;
464
+ owner: string;
465
+ org: string | null;
466
+ bundle: string;
467
+ package: string | null;
468
+ version: string | null;
469
+ deployment?: string | null;
470
+ }[]>;
453
471
  interface CreateAppInput {
454
472
  name: string;
455
473
  /** A bundle hash, or a package release (`{ package, version? }`). */
@@ -506,13 +524,72 @@ declare function useUpgradeApp(appId?: string | null, options?: MutationOptions)
506
524
  failure: Failure | null;
507
525
  };
508
526
  /** The installed package releases. */
509
- declare function usePackages(): ResourceState<PackageInfo[]>;
527
+ declare function usePackages(): ResourceState<{
528
+ package: string;
529
+ signerId: string;
530
+ owner: string;
531
+ latest: string;
532
+ versions: {
533
+ version: string;
534
+ mpk: string;
535
+ size: number;
536
+ source: "registry" | "upload";
537
+ services: {
538
+ [key: string]: string;
539
+ };
540
+ metadata: unknown;
541
+ outbound: string[];
542
+ installedBy: string;
543
+ installedAt: number;
544
+ }[];
545
+ }[]>;
510
546
 
511
547
  type OrgRole = 'guest' | 'member' | 'admin' | 'owner';
512
548
  type TeamJoin = 'everyone' | 'invite';
513
549
  type TeamRole = 'lead' | 'member' | 'readOnly';
514
550
  /** An organization: members, teams, metadata, release approvers. Was `useNamespace`. */
515
- declare function useOrg(orgId?: string | null): ResourceState<OrgInfo | null>;
551
+ declare function useOrg(orgId?: string | null): ResourceState<{
552
+ orgId: string;
553
+ name: string;
554
+ members: {
555
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["OrgRole"];
556
+ };
557
+ teams: {
558
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["Team"];
559
+ };
560
+ defaultCapabilities: number;
561
+ capabilities: {
562
+ [key: string]: number;
563
+ };
564
+ approvedReleases: string[];
565
+ outboundApprovals: {
566
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["OutboundApproval"];
567
+ };
568
+ metadata: unknown;
569
+ memberMetadata: {
570
+ [key: string]: unknown;
571
+ };
572
+ upgradeRuns: {
573
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["UpgradeRun"];
574
+ };
575
+ recovery?: {
576
+ publicKey: string;
577
+ setAt: number;
578
+ pending: {
579
+ account: string;
580
+ startedAt: number;
581
+ readyAt: number;
582
+ } | null;
583
+ };
584
+ allApps?: string[];
585
+ mode?: "legacy" | "standalone" | "shared";
586
+ releaseApprovers?: string[];
587
+ publishes?: string[];
588
+ newWorkStopped?: {
589
+ release: string;
590
+ after: string;
591
+ } | null;
592
+ } | null>;
516
593
  /** Create an organization; resolves its id. Was `useCreateNamespace`. */
517
594
  declare function useCreateOrg(options?: MutationOptions): {
518
595
  loading: boolean;
@@ -736,19 +813,44 @@ declare function useConsent(options?: MutationOptions): {
736
813
  loading: boolean;
737
814
  error: Error | null;
738
815
  failure: Failure | null;
739
- request: (req: ConsentRequest) => Promise<ConsentStarted | null>;
740
- open: (req: ConsentRequest, how?: ((url: string) => void) | OpenConsentOptions) => Promise<ConsentStarted | null>;
816
+ request: (req: ConsentRequest) => Promise<{
817
+ requestId: string;
818
+ url: string;
819
+ code: string;
820
+ expiresAt: number;
821
+ } | null>;
822
+ open: (req: ConsentRequest, how?: ((url: string) => void) | OpenConsentOptions) => Promise<{
823
+ requestId: string;
824
+ url: string;
825
+ code: string;
826
+ expiresAt: number;
827
+ } | null>;
741
828
  check: (requestId: string) => Promise<{
742
829
  requestId: string;
743
830
  kind: "release" | "upgrade" | "outbound";
744
831
  status: "pending" | "approved" | "declined";
745
832
  decidedAt: number | null;
746
833
  } | null>;
747
- wait: (requestId: string, waitOptions?: WaitOptions) => Promise<ConsentResult | null>;
834
+ wait: (requestId: string, waitOptions?: WaitOptions) => Promise<{
835
+ requestId: string;
836
+ kind: "release" | "upgrade" | "outbound";
837
+ status: "pending" | "approved" | "declined";
838
+ decidedAt: number | null;
839
+ } | null>;
748
840
  cancel: () => void | undefined;
749
- started: ConsentStarted | null;
841
+ started: {
842
+ requestId: string;
843
+ url: string;
844
+ code: string;
845
+ expiresAt: number;
846
+ } | null;
750
847
  code: string | null;
751
- result: ConsentResult | null;
848
+ result: {
849
+ requestId: string;
850
+ kind: "release" | "upgrade" | "outbound";
851
+ status: "pending" | "approved" | "declined";
852
+ decidedAt: number | null;
853
+ } | null;
752
854
  returned: {
753
855
  requestId: string;
754
856
  result: "approved" | "declined";
@@ -775,9 +877,17 @@ declare function useUploadBlob(options?: BlobHookOptions & MutationOptions): {
775
877
  } | null>;
776
878
  };
777
879
  /** A blob's size and ids. */
778
- declare function useBlobInfo(blobId?: string | null, options?: BlobHookOptions): ResourceState<BlobInfo | null>;
880
+ declare function useBlobInfo(blobId?: string | null, options?: BlobHookOptions): ResourceState<{
881
+ blobId: string;
882
+ id: string;
883
+ size: number;
884
+ } | null>;
779
885
  /** The app's blobs. */
780
- declare function useBlobs(appId?: string | null): ResourceState<BlobInfo[]>;
886
+ declare function useBlobs(appId?: string | null): ResourceState<{
887
+ blobId: string;
888
+ id: string;
889
+ size: number;
890
+ }[]>;
781
891
  /**
782
892
  * An object URL for a blob, for an `<img>` or a download link. The bytes come
783
893
  * over the sealed channel, so a plain URL to the node would not work. Revoked
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties } from 'react';
3
- import { CloudPolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, CloudRetryOptions, CallResult, ViewResult, AppInfo, PackageInfo, OrgInfo, ConsentRequest, ConsentStarted, OpenConsentOptions, ConsentResult, BlobInfo } from '@calimero-network/mero-js';
3
+ import * as _calimero_network_mero_js from '@calimero-network/mero-js';
4
+ import { NodePolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, RetryOptions, CallResult, ViewResult, ConsentRequest, OpenConsentOptions } from '@calimero-network/mero-js';
4
5
  export * from '@calimero-network/mero-js';
5
6
 
6
7
  /**
@@ -11,7 +12,7 @@ export * from '@calimero-network/mero-js';
11
12
  /** How the provider decides which nodes to trust. */
12
13
  interface PolicyOptions {
13
14
  /** The full policy, as mero-js takes it. Wins over `minReleaseVersion`. */
14
- policy?: CloudPolicy;
15
+ policy?: NodePolicy;
15
16
  /**
16
17
  * The oldest mero-tee release to trust (e.g. `2.3.109`): shorthand for
17
18
  * `policy: { release: { minReleaseVersion } }`.
@@ -27,7 +28,7 @@ interface PolicyOptions {
27
28
  * The policy for {@link PolicyOptions}. Throws when nothing says what to trust:
28
29
  * a client that trusted every quote would not be verifying anything.
29
30
  */
30
- declare function resolvePolicy({ policy, minReleaseVersion, allowMock }: PolicyOptions): CloudPolicy;
31
+ declare function resolvePolicy({ policy, minReleaseVersion, allowMock }: PolicyOptions): NodePolicy;
31
32
  /**
32
33
  * A `CalimeroClient` that reports every session it takes: a sign-in, a sign-up
33
34
  * and the refreshes the client makes by itself on a `401` (single-flight, any
@@ -210,7 +211,7 @@ interface MeroProviderConfig extends PolicyOptions {
210
211
  /** The `fetch` the client sends attestation and sealed envelopes with. */
211
212
  fetch?: typeof fetch;
212
213
  /** How calls and views retry a `503` or a dropped connection. */
213
- retry?: CloudRetryOptions;
214
+ retry?: RetryOptions;
214
215
  /**
215
216
  * Use this client instead of building one (tests, or an app that needs a
216
217
  * client configured beyond these props). Session reporting is then the
@@ -349,7 +350,15 @@ declare function useApp(appId?: string | null): {
349
350
  */
350
351
  declare function useExecute(appId?: string | null, options?: MutationOptions): {
351
352
  execute: <T = unknown>(method: string, args?: unknown, callOptions?: CallOptions) => Promise<T | null>;
352
- call: (method: string, args?: unknown, callOptions?: CallOptions) => Promise<CallResult | null>;
353
+ call: (method: string, args?: unknown, callOptions?: CallOptions) => Promise<{
354
+ index: number;
355
+ result: unknown;
356
+ events: {
357
+ kind: string;
358
+ data: unknown;
359
+ }[];
360
+ receipt: _calimero_network_mero_js.ApiComponents["schemas"]["Receipt"];
361
+ } | null>;
353
362
  loading: boolean;
354
363
  error: Error | null;
355
364
  failure: Failure | null;
@@ -449,7 +458,16 @@ interface AppUpgradeResult {
449
458
  declare function useApps(filter?: {
450
459
  package?: string;
451
460
  bundle?: string;
452
- }): ResourceState<AppInfo[]>;
461
+ }): ResourceState<{
462
+ appId: string;
463
+ name: string;
464
+ owner: string;
465
+ org: string | null;
466
+ bundle: string;
467
+ package: string | null;
468
+ version: string | null;
469
+ deployment?: string | null;
470
+ }[]>;
453
471
  interface CreateAppInput {
454
472
  name: string;
455
473
  /** A bundle hash, or a package release (`{ package, version? }`). */
@@ -506,13 +524,72 @@ declare function useUpgradeApp(appId?: string | null, options?: MutationOptions)
506
524
  failure: Failure | null;
507
525
  };
508
526
  /** The installed package releases. */
509
- declare function usePackages(): ResourceState<PackageInfo[]>;
527
+ declare function usePackages(): ResourceState<{
528
+ package: string;
529
+ signerId: string;
530
+ owner: string;
531
+ latest: string;
532
+ versions: {
533
+ version: string;
534
+ mpk: string;
535
+ size: number;
536
+ source: "registry" | "upload";
537
+ services: {
538
+ [key: string]: string;
539
+ };
540
+ metadata: unknown;
541
+ outbound: string[];
542
+ installedBy: string;
543
+ installedAt: number;
544
+ }[];
545
+ }[]>;
510
546
 
511
547
  type OrgRole = 'guest' | 'member' | 'admin' | 'owner';
512
548
  type TeamJoin = 'everyone' | 'invite';
513
549
  type TeamRole = 'lead' | 'member' | 'readOnly';
514
550
  /** An organization: members, teams, metadata, release approvers. Was `useNamespace`. */
515
- declare function useOrg(orgId?: string | null): ResourceState<OrgInfo | null>;
551
+ declare function useOrg(orgId?: string | null): ResourceState<{
552
+ orgId: string;
553
+ name: string;
554
+ members: {
555
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["OrgRole"];
556
+ };
557
+ teams: {
558
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["Team"];
559
+ };
560
+ defaultCapabilities: number;
561
+ capabilities: {
562
+ [key: string]: number;
563
+ };
564
+ approvedReleases: string[];
565
+ outboundApprovals: {
566
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["OutboundApproval"];
567
+ };
568
+ metadata: unknown;
569
+ memberMetadata: {
570
+ [key: string]: unknown;
571
+ };
572
+ upgradeRuns: {
573
+ [key: string]: _calimero_network_mero_js.ApiComponents["schemas"]["UpgradeRun"];
574
+ };
575
+ recovery?: {
576
+ publicKey: string;
577
+ setAt: number;
578
+ pending: {
579
+ account: string;
580
+ startedAt: number;
581
+ readyAt: number;
582
+ } | null;
583
+ };
584
+ allApps?: string[];
585
+ mode?: "legacy" | "standalone" | "shared";
586
+ releaseApprovers?: string[];
587
+ publishes?: string[];
588
+ newWorkStopped?: {
589
+ release: string;
590
+ after: string;
591
+ } | null;
592
+ } | null>;
516
593
  /** Create an organization; resolves its id. Was `useCreateNamespace`. */
517
594
  declare function useCreateOrg(options?: MutationOptions): {
518
595
  loading: boolean;
@@ -736,19 +813,44 @@ declare function useConsent(options?: MutationOptions): {
736
813
  loading: boolean;
737
814
  error: Error | null;
738
815
  failure: Failure | null;
739
- request: (req: ConsentRequest) => Promise<ConsentStarted | null>;
740
- open: (req: ConsentRequest, how?: ((url: string) => void) | OpenConsentOptions) => Promise<ConsentStarted | null>;
816
+ request: (req: ConsentRequest) => Promise<{
817
+ requestId: string;
818
+ url: string;
819
+ code: string;
820
+ expiresAt: number;
821
+ } | null>;
822
+ open: (req: ConsentRequest, how?: ((url: string) => void) | OpenConsentOptions) => Promise<{
823
+ requestId: string;
824
+ url: string;
825
+ code: string;
826
+ expiresAt: number;
827
+ } | null>;
741
828
  check: (requestId: string) => Promise<{
742
829
  requestId: string;
743
830
  kind: "release" | "upgrade" | "outbound";
744
831
  status: "pending" | "approved" | "declined";
745
832
  decidedAt: number | null;
746
833
  } | null>;
747
- wait: (requestId: string, waitOptions?: WaitOptions) => Promise<ConsentResult | null>;
834
+ wait: (requestId: string, waitOptions?: WaitOptions) => Promise<{
835
+ requestId: string;
836
+ kind: "release" | "upgrade" | "outbound";
837
+ status: "pending" | "approved" | "declined";
838
+ decidedAt: number | null;
839
+ } | null>;
748
840
  cancel: () => void | undefined;
749
- started: ConsentStarted | null;
841
+ started: {
842
+ requestId: string;
843
+ url: string;
844
+ code: string;
845
+ expiresAt: number;
846
+ } | null;
750
847
  code: string | null;
751
- result: ConsentResult | null;
848
+ result: {
849
+ requestId: string;
850
+ kind: "release" | "upgrade" | "outbound";
851
+ status: "pending" | "approved" | "declined";
852
+ decidedAt: number | null;
853
+ } | null;
752
854
  returned: {
753
855
  requestId: string;
754
856
  result: "approved" | "declined";
@@ -775,9 +877,17 @@ declare function useUploadBlob(options?: BlobHookOptions & MutationOptions): {
775
877
  } | null>;
776
878
  };
777
879
  /** A blob's size and ids. */
778
- declare function useBlobInfo(blobId?: string | null, options?: BlobHookOptions): ResourceState<BlobInfo | null>;
880
+ declare function useBlobInfo(blobId?: string | null, options?: BlobHookOptions): ResourceState<{
881
+ blobId: string;
882
+ id: string;
883
+ size: number;
884
+ } | null>;
779
885
  /** The app's blobs. */
780
- declare function useBlobs(appId?: string | null): ResourceState<BlobInfo[]>;
886
+ declare function useBlobs(appId?: string | null): ResourceState<{
887
+ blobId: string;
888
+ id: string;
889
+ size: number;
890
+ }[]>;
781
891
  /**
782
892
  * An object URL for a blob, for an `<img>` or a download link. The bytes come
783
893
  * over the sealed channel, so a plain URL to the node would not work. Revoked