@calimero-network/mero-react 11.0.4 → 11.1.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/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties } from 'react';
3
- import * as _calimero_network_mero_js from '@calimero-network/mero-js';
4
- import { CloudPolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, CloudRetryOptions, CallResult, ViewResult, AppInfo, OrgInfo, ConsentRequest, ConsentStarted, OpenConsentOptions, ConsentResult, BlobInfo } from '@calimero-network/mero-js';
3
+ import { CloudPolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, CloudRetryOptions, CallResult, ViewResult, AppInfo, PackageInfo, OrgInfo, ConsentRequest, ConsentStarted, OpenConsentOptions, ConsentResult, BlobInfo } from '@calimero-network/mero-js';
5
4
  export * from '@calimero-network/mero-js';
6
5
 
7
6
  /**
@@ -440,6 +439,12 @@ declare function followEvents(f: Follow): Promise<void>;
440
439
  */
441
440
  declare function useSubscription(appIds: string | string[] | null | undefined, callback: (event: AppEvent) => void, options?: SubscriptionOptions): void;
442
441
 
442
+ /** What `useUpgradeApp().upgrade` resolves: the upgrade's log index and outcome. */
443
+ interface AppUpgradeResult {
444
+ index: number;
445
+ status: string;
446
+ error: unknown;
447
+ }
443
448
  /** The app instances this account can see. Was `useContexts`. */
444
449
  declare function useApps(filter?: {
445
450
  package?: string;
@@ -495,17 +500,13 @@ interface UpgradeTarget {
495
500
  * (`useConsent` with `upgradeConsent`).
496
501
  */
497
502
  declare function useUpgradeApp(appId?: string | null, options?: MutationOptions): {
498
- upgrade: (target: UpgradeTarget) => Promise<{
499
- index: number;
500
- status: string;
501
- error: unknown;
502
- } | null>;
503
+ upgrade: (target: UpgradeTarget) => Promise<AppUpgradeResult | null>;
503
504
  loading: boolean;
504
505
  error: Error | null;
505
506
  failure: Failure | null;
506
507
  };
507
508
  /** The installed package releases. */
508
- declare function usePackages(): ResourceState<_calimero_network_mero_js.PackageInfo[]>;
509
+ declare function usePackages(): ResourceState<PackageInfo[]>;
509
510
 
510
511
  type OrgRole = 'guest' | 'member' | 'admin' | 'owner';
511
512
  type TeamJoin = 'everyone' | 'invite';
@@ -607,7 +608,11 @@ declare function useUpdateTeam(options?: MutationOptions): {
607
608
  failure: Failure | null;
608
609
  update: (orgId: string, teamId: string, change: TeamUpdate) => Promise<boolean | null>;
609
610
  };
610
- /** Delete a team. Was `useDeleteGroup`. */
611
+ /**
612
+ * Delete a team, the teams below it and their apps. Was `useDeleteGroup`.
613
+ * Asks for the passkey only when one of those teams holds apps (the node
614
+ * answers `412 CONFIRM_REQUIRED`); a team with no apps goes without one.
615
+ */
611
616
  declare function useDeleteTeam(options?: MutationOptions): {
612
617
  loading: boolean;
613
618
  error: Error | null;
@@ -733,7 +738,12 @@ declare function useConsent(options?: MutationOptions): {
733
738
  failure: Failure | null;
734
739
  request: (req: ConsentRequest) => Promise<ConsentStarted | null>;
735
740
  open: (req: ConsentRequest, how?: ((url: string) => void) | OpenConsentOptions) => Promise<ConsentStarted | null>;
736
- check: (requestId: string) => Promise<ConsentResult | null>;
741
+ check: (requestId: string) => Promise<{
742
+ requestId: string;
743
+ kind: "release" | "upgrade" | "outbound";
744
+ status: "pending" | "approved" | "declined";
745
+ decidedAt: number | null;
746
+ } | null>;
737
747
  wait: (requestId: string, waitOptions?: WaitOptions) => Promise<ConsentResult | null>;
738
748
  cancel: () => void | undefined;
739
749
  started: ConsentStarted | null;
@@ -882,7 +892,8 @@ interface CreateApiKeyInput {
882
892
  /**
883
893
  * The account's API keys, for agents and servers: list them, create one
884
894
  * (approved with the passkey; needs a passkey session, not an API key) and
885
- * revoke one. `create` resolves `{ keyId, key }`, and the key is shown once.
895
+ * revoke one (also approved with the passkey). `create` resolves
896
+ * `{ keyId, key }`, and the key is shown once.
886
897
  */
887
898
  declare function useApiKeys(options?: MutationOptions): {
888
899
  loading: boolean;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties } from 'react';
3
- import * as _calimero_network_mero_js from '@calimero-network/mero-js';
4
- import { CloudPolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, CloudRetryOptions, CallResult, ViewResult, AppInfo, OrgInfo, ConsentRequest, ConsentStarted, OpenConsentOptions, ConsentResult, BlobInfo } from '@calimero-network/mero-js';
3
+ import { CloudPolicy, CalimeroClient, CalimeroClientOptions, CalimeroSession, PasskeyProvider, CloudRetryOptions, CallResult, ViewResult, AppInfo, PackageInfo, OrgInfo, ConsentRequest, ConsentStarted, OpenConsentOptions, ConsentResult, BlobInfo } from '@calimero-network/mero-js';
5
4
  export * from '@calimero-network/mero-js';
6
5
 
7
6
  /**
@@ -440,6 +439,12 @@ declare function followEvents(f: Follow): Promise<void>;
440
439
  */
441
440
  declare function useSubscription(appIds: string | string[] | null | undefined, callback: (event: AppEvent) => void, options?: SubscriptionOptions): void;
442
441
 
442
+ /** What `useUpgradeApp().upgrade` resolves: the upgrade's log index and outcome. */
443
+ interface AppUpgradeResult {
444
+ index: number;
445
+ status: string;
446
+ error: unknown;
447
+ }
443
448
  /** The app instances this account can see. Was `useContexts`. */
444
449
  declare function useApps(filter?: {
445
450
  package?: string;
@@ -495,17 +500,13 @@ interface UpgradeTarget {
495
500
  * (`useConsent` with `upgradeConsent`).
496
501
  */
497
502
  declare function useUpgradeApp(appId?: string | null, options?: MutationOptions): {
498
- upgrade: (target: UpgradeTarget) => Promise<{
499
- index: number;
500
- status: string;
501
- error: unknown;
502
- } | null>;
503
+ upgrade: (target: UpgradeTarget) => Promise<AppUpgradeResult | null>;
503
504
  loading: boolean;
504
505
  error: Error | null;
505
506
  failure: Failure | null;
506
507
  };
507
508
  /** The installed package releases. */
508
- declare function usePackages(): ResourceState<_calimero_network_mero_js.PackageInfo[]>;
509
+ declare function usePackages(): ResourceState<PackageInfo[]>;
509
510
 
510
511
  type OrgRole = 'guest' | 'member' | 'admin' | 'owner';
511
512
  type TeamJoin = 'everyone' | 'invite';
@@ -607,7 +608,11 @@ declare function useUpdateTeam(options?: MutationOptions): {
607
608
  failure: Failure | null;
608
609
  update: (orgId: string, teamId: string, change: TeamUpdate) => Promise<boolean | null>;
609
610
  };
610
- /** Delete a team. Was `useDeleteGroup`. */
611
+ /**
612
+ * Delete a team, the teams below it and their apps. Was `useDeleteGroup`.
613
+ * Asks for the passkey only when one of those teams holds apps (the node
614
+ * answers `412 CONFIRM_REQUIRED`); a team with no apps goes without one.
615
+ */
611
616
  declare function useDeleteTeam(options?: MutationOptions): {
612
617
  loading: boolean;
613
618
  error: Error | null;
@@ -733,7 +738,12 @@ declare function useConsent(options?: MutationOptions): {
733
738
  failure: Failure | null;
734
739
  request: (req: ConsentRequest) => Promise<ConsentStarted | null>;
735
740
  open: (req: ConsentRequest, how?: ((url: string) => void) | OpenConsentOptions) => Promise<ConsentStarted | null>;
736
- check: (requestId: string) => Promise<ConsentResult | null>;
741
+ check: (requestId: string) => Promise<{
742
+ requestId: string;
743
+ kind: "release" | "upgrade" | "outbound";
744
+ status: "pending" | "approved" | "declined";
745
+ decidedAt: number | null;
746
+ } | null>;
737
747
  wait: (requestId: string, waitOptions?: WaitOptions) => Promise<ConsentResult | null>;
738
748
  cancel: () => void | undefined;
739
749
  started: ConsentStarted | null;
@@ -882,7 +892,8 @@ interface CreateApiKeyInput {
882
892
  /**
883
893
  * The account's API keys, for agents and servers: list them, create one
884
894
  * (approved with the passkey; needs a passkey session, not an API key) and
885
- * revoke one. `create` resolves `{ keyId, key }`, and the key is shown once.
895
+ * revoke one (also approved with the passkey). `create` resolves
896
+ * `{ keyId, key }`, and the key is shown once.
886
897
  */
887
898
  declare function useApiKeys(options?: MutationOptions): {
888
899
  loading: boolean;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createContext, useState, useEffect, useMemo, useRef, useCallback, useContext, useId } from 'react';
2
- import { CalimeroClient, AppError, TrapError, LoginRequired, ConfirmRequired, ConfirmCancelled, WrongNode, UnavailableError, NotFound, ReleaseDeadlineError, ConsentStale, ArgsTooLarge, IdempotencyMismatch, CalimeroError, DirectoryError, SealedTransportError, browserPasskey, consentReturn } from '@calimero-network/mero-js';
2
+ import { CalimeroClient, AppError, TrapError, LoginRequired, ConfirmRequired, ConfirmCancelled, WrongNode, UnavailableError, NotFound, ReleaseDeadlineError, ConsentStale, ArgsTooLarge, IdempotencyMismatch, CalimeroError, DirectoryError, SealedTransportError, browserPasskey, consentReturn, presenceState, passkeyConfirm } from '@calimero-network/mero-js';
3
3
  export * from '@calimero-network/mero-js';
4
4
  import { jsx, jsxs } from 'react/jsx-runtime';
5
5
 
@@ -540,6 +540,9 @@ var NoAppError = class extends Error {
540
540
  this.name = "NoAppError";
541
541
  }
542
542
  };
543
+ function confirmWith(passkey) {
544
+ return { confirm: passkeyConfirm(passkey) };
545
+ }
543
546
  function toError(error) {
544
547
  return error instanceof Error ? error : new Error(String(error));
545
548
  }
@@ -640,12 +643,21 @@ function useClientAction(options) {
640
643
  );
641
644
  return { withClient, loading: action.loading, error: action.error, failure: action.failure };
642
645
  }
646
+ function viewOf(client, app, method, args, options) {
647
+ return client.apps.view({
648
+ app,
649
+ method,
650
+ args,
651
+ consistency: options.stale ? "stale" : void 0,
652
+ minIndex: options.minIndex
653
+ });
654
+ }
643
655
  function useApp(appId) {
644
656
  const { client: anyClient, passkey } = useMero();
645
657
  const client = useSignedInClient();
646
658
  const id = useAppId(appId);
647
659
  const info = useResource(
648
- client && id ? () => client.getApp(id) : null,
660
+ client && id ? () => client.apps.get({ app: id }) : null,
649
661
  null,
650
662
  [client, id]
651
663
  );
@@ -653,7 +665,10 @@ function useApp(appId) {
653
665
  (method, args = {}, options = {}) => {
654
666
  if (!anyClient) return Promise.reject(new NotConnectedError("connected"));
655
667
  if (!id) return Promise.reject(new NoAppError());
656
- return options.confirm ? anyClient.callConfirmed(id, method, args, passkey, options.idempotencyKey) : anyClient.call(id, method, args, options.idempotencyKey);
668
+ return anyClient.apps.call(
669
+ { app: id, method, args, idempotencyKey: options.idempotencyKey },
670
+ options.confirm ? confirmWith(passkey) : void 0
671
+ );
657
672
  },
658
673
  [anyClient, id, passkey]
659
674
  );
@@ -661,7 +676,7 @@ function useApp(appId) {
661
676
  (method, args = {}, options = {}) => {
662
677
  if (!anyClient) return Promise.reject(new NotConnectedError("connected"));
663
678
  if (!id) return Promise.reject(new NoAppError());
664
- return anyClient.view(id, method, args, options);
679
+ return viewOf(anyClient, id, method, args, options);
665
680
  },
666
681
  [anyClient, id]
667
682
  );
@@ -689,7 +704,7 @@ function useView(method, args = {}, options = {}) {
689
704
  const argsKey = JSON.stringify(args ?? {});
690
705
  const { stale, minIndex, enabled = true } = options;
691
706
  const resource = useResource(
692
- client && id && enabled ? () => client.view(id, method, JSON.parse(argsKey), { stale, minIndex }) : null,
707
+ client && id && enabled ? () => viewOf(client, id, method, JSON.parse(argsKey), { stale, minIndex }) : null,
693
708
  null,
694
709
  [client, id, method, argsKey, stale, minIndex, enabled]
695
710
  );
@@ -702,7 +717,11 @@ function useView(method, args = {}, options = {}) {
702
717
  function useAppAbi(appId) {
703
718
  const client = useSignedInClient();
704
719
  const id = useAppId(appId);
705
- return useResource(client && id ? () => client.appAbi(id) : null, null, [client, id]);
720
+ return useResource(
721
+ client && id ? () => client.apps.abi({ app: id }) : null,
722
+ null,
723
+ [client, id]
724
+ );
706
725
  }
707
726
  var LIVE = Number.MAX_SAFE_INTEGER;
708
727
  function position(id) {
@@ -802,16 +821,27 @@ function useSubscription(appIds, callback, options = {}) {
802
821
  function useApps(filter = {}) {
803
822
  const client = useSignedInClient();
804
823
  const { package: pkg, bundle } = filter;
805
- return useResource(client ? () => client.listApps({ package: pkg, bundle }) : null, [], [client, pkg, bundle]);
824
+ return useResource(
825
+ client ? async () => (await client.apps.list({ package: pkg || void 0, bundle: bundle || void 0 })).apps : null,
826
+ [],
827
+ [client, pkg, bundle]
828
+ );
806
829
  }
807
830
  function useCreateApp(options) {
808
831
  const client = useSignedInClient();
809
832
  const action = useAsyncAction(options);
810
833
  const create = useCallback(
811
- (input) => action.run(() => {
834
+ (input) => action.run(async () => {
812
835
  if (!client) throw new NotConnectedError();
813
836
  const { name, bundle, ...rest } = input;
814
- return client.createApp(name, bundle, rest);
837
+ const target = typeof bundle === "string" ? { bundle } : bundle;
838
+ const { appId } = await client.apps.create({
839
+ name,
840
+ ...target,
841
+ ...rest,
842
+ access: rest.access
843
+ });
844
+ return appId;
815
845
  }),
816
846
  [client, action.run]
817
847
  );
@@ -823,7 +853,7 @@ function useDeleteApp(options) {
823
853
  const remove = useCallback(
824
854
  (appId) => action.run(async () => {
825
855
  if (!client) throw new NotConnectedError();
826
- await client.deleteApp(appId);
856
+ await client.apps.delete({ app: appId });
827
857
  return true;
828
858
  }),
829
859
  [client, action.run]
@@ -836,7 +866,7 @@ function useSetAppMetadata(options) {
836
866
  const setMetadata = useCallback(
837
867
  (appId, metadata) => action.run(async () => {
838
868
  if (!client) throw new NotConnectedError();
839
- await client.setAppMetadata(appId, metadata);
869
+ await client.apps.metadata({ app: appId, metadata });
840
870
  return true;
841
871
  }),
842
872
  [client, action.run]
@@ -849,10 +879,10 @@ function useUpgradeApp(appId, options) {
849
879
  const id = useAppId(appId);
850
880
  const action = useAsyncAction(options);
851
881
  const upgrade = useCallback(
852
- (target) => action.run(() => {
882
+ (target) => action.run(async () => {
853
883
  if (!client) throw new NotConnectedError();
854
884
  if (!id) throw new Error("No app to upgrade.");
855
- return client.upgradeApp(id, target, passkey);
885
+ return await client.apps.upgrade({ app: id, ...target }, confirmWith(passkey));
856
886
  }),
857
887
  [client, id, passkey, action.run]
858
888
  );
@@ -860,15 +890,26 @@ function useUpgradeApp(appId, options) {
860
890
  }
861
891
  function usePackages() {
862
892
  const client = useSignedInClient();
863
- return useResource(client ? () => client.packages() : null, [], [client]);
893
+ return useResource(
894
+ client ? async () => (await client.packages.list()).packages : null,
895
+ [],
896
+ [client]
897
+ );
864
898
  }
865
899
  function useOrg(orgId) {
866
900
  const client = useSignedInClient();
867
- return useResource(client && orgId ? () => client.getOrg(orgId) : null, null, [client, orgId]);
901
+ return useResource(
902
+ client && orgId ? async () => await client.orgs.get({ org: orgId }) : null,
903
+ null,
904
+ [client, orgId]
905
+ );
868
906
  }
869
907
  function useCreateOrg(options) {
870
908
  const { withClient, ...state } = useClientAction(options);
871
- const create = useCallback((name) => withClient((c) => c.createOrg(name)), [withClient]);
909
+ const create = useCallback(
910
+ (name) => withClient(async (c) => (await c.orgs.create({ name })).orgId),
911
+ [withClient]
912
+ );
872
913
  return { create, ...state };
873
914
  }
874
915
  function useDeleteOrg(options) {
@@ -876,7 +917,7 @@ function useDeleteOrg(options) {
876
917
  const { withClient, ...state } = useClientAction(options);
877
918
  const deleteOrg = useCallback(
878
919
  (orgId) => withClient(async (c) => {
879
- await c.deleteOrg(orgId, passkey);
920
+ await c.orgs.delete({ org: orgId }, confirmWith(passkey));
880
921
  return true;
881
922
  }),
882
923
  [withClient, passkey]
@@ -888,7 +929,7 @@ function useSetMember(options) {
888
929
  const { withClient, ...state } = useClientAction(options);
889
930
  const setMember = useCallback(
890
931
  (orgId, account, role) => withClient(async (c) => {
891
- await c.setMember(orgId, account, role, passkey);
932
+ await c.orgs.setMember({ org: orgId, account, role }, confirmWith(passkey));
892
933
  return true;
893
934
  }),
894
935
  [withClient, passkey]
@@ -899,7 +940,9 @@ function useRemoveMember(options) {
899
940
  const { passkey } = useMero();
900
941
  const { withClient, ...state } = useClientAction(options);
901
942
  const removeMember = useCallback(
902
- (orgId, account) => withClient((c) => c.removeMember(orgId, account, passkey)),
943
+ (orgId, account) => withClient(
944
+ async (c) => await c.orgs.removeMember({ org: orgId, account }, confirmWith(passkey))
945
+ ),
903
946
  [withClient, passkey]
904
947
  );
905
948
  return { removeMember, ...state };
@@ -908,7 +951,7 @@ function useSetOrgMetadata(options) {
908
951
  const { withClient, ...state } = useClientAction(options);
909
952
  const setMetadata = useCallback(
910
953
  (orgId, metadata) => withClient(async (c) => {
911
- await c.setOrgMetadata(orgId, metadata);
954
+ await c.orgs.metadata({ org: orgId, metadata });
912
955
  return true;
913
956
  }),
914
957
  [withClient]
@@ -919,7 +962,7 @@ function useSetMemberMetadata(options) {
919
962
  const { withClient, ...state } = useClientAction(options);
920
963
  const setMetadata = useCallback(
921
964
  (orgId, account, metadata) => withClient(async (c) => {
922
- await c.setMemberMetadata(orgId, account, metadata);
965
+ await c.orgs.memberMetadata({ org: orgId, account, metadata });
923
966
  return true;
924
967
  }),
925
968
  [withClient]
@@ -931,7 +974,7 @@ function useSetCapabilities(options) {
931
974
  const { withClient, ...state } = useClientAction(options);
932
975
  const setCapabilities = useCallback(
933
976
  (orgId, capabilities, at = {}) => withClient(async (c) => {
934
- await c.setCapabilities(orgId, capabilities, passkey, at);
977
+ await c.orgs.capabilities({ org: orgId, capabilities, ...at }, confirmWith(passkey));
935
978
  return true;
936
979
  }),
937
980
  [withClient, passkey]
@@ -941,7 +984,7 @@ function useSetCapabilities(options) {
941
984
  function useTeam(orgId, teamId) {
942
985
  const client = useSignedInClient();
943
986
  return useResource(
944
- client && orgId && teamId ? () => client.getTeam(orgId, teamId) : null,
987
+ client && orgId && teamId ? () => client.orgs.teamGet({ org: orgId, team: teamId }) : null,
945
988
  null,
946
989
  [client, orgId, teamId]
947
990
  );
@@ -949,7 +992,7 @@ function useTeam(orgId, teamId) {
949
992
  function useCreateTeam(options) {
950
993
  const { withClient, ...state } = useClientAction(options);
951
994
  const create = useCallback(
952
- ({ orgId, name, join = "invite", parent }) => withClient((c) => c.createTeam(orgId, name, join, parent)),
995
+ ({ orgId, name, join = "invite", parent }) => withClient(async (c) => (await c.orgs.teamCreate({ org: orgId, name, join, parent })).teamId),
953
996
  [withClient]
954
997
  );
955
998
  return { create, ...state };
@@ -958,7 +1001,7 @@ function useUpdateTeam(options) {
958
1001
  const { withClient, ...state } = useClientAction(options);
959
1002
  const update = useCallback(
960
1003
  (orgId, teamId, change) => withClient(async (c) => {
961
- await c.updateTeam(orgId, teamId, change);
1004
+ await c.orgs.teamUpdate({ org: orgId, team: teamId, ...change });
962
1005
  return true;
963
1006
  }),
964
1007
  [withClient]
@@ -966,13 +1009,14 @@ function useUpdateTeam(options) {
966
1009
  return { update, ...state };
967
1010
  }
968
1011
  function useDeleteTeam(options) {
1012
+ const { passkey } = useMero();
969
1013
  const { withClient, ...state } = useClientAction(options);
970
1014
  const deleteTeam = useCallback(
971
1015
  (orgId, teamId) => withClient(async (c) => {
972
- await c.deleteTeam(orgId, teamId);
1016
+ await c.orgs.teamDelete({ org: orgId, team: teamId }, confirmWith(passkey));
973
1017
  return true;
974
1018
  }),
975
- [withClient]
1019
+ [withClient, passkey]
976
1020
  );
977
1021
  return { deleteTeam, ...state };
978
1022
  }
@@ -981,7 +1025,7 @@ function useSetTeamMember(options) {
981
1025
  const { withClient, ...state } = useClientAction(options);
982
1026
  const setTeamMember = useCallback(
983
1027
  (orgId, teamId, account, row = {}) => withClient(async (c) => {
984
- await c.setTeamMember(orgId, teamId, account, passkey, row);
1028
+ await c.orgs.teamSetMember({ org: orgId, team: teamId, account, ...row }, confirmWith(passkey));
985
1029
  return true;
986
1030
  }),
987
1031
  [withClient, passkey]
@@ -993,7 +1037,7 @@ function useRemoveTeamMember(options) {
993
1037
  const { withClient, ...state } = useClientAction(options);
994
1038
  const removeTeamMember = useCallback(
995
1039
  (orgId, teamId, account) => withClient(async (c) => {
996
- await c.removeTeamMember(orgId, teamId, account, passkey);
1040
+ await c.orgs.teamRemoveMember({ org: orgId, team: teamId, account }, confirmWith(passkey));
997
1041
  return true;
998
1042
  }),
999
1043
  [withClient, passkey]
@@ -1038,7 +1082,7 @@ function useCreateInvite(options) {
1038
1082
  const { withClient, ...state } = useClientAction(options);
1039
1083
  const create = useCallback(
1040
1084
  ({ orgId, role = "member", teams = [], ttlSecs, uses, linkBase }) => withClient(async (c) => {
1041
- const token = await c.invite(orgId, role, passkey, teams, { ttlSecs, uses });
1085
+ const { token } = await c.orgs.inviteCreate({ org: orgId, role, teams, ttlSecs, uses }, confirmWith(passkey));
1042
1086
  return { token, link: inviteLink(token, linkBase) };
1043
1087
  }),
1044
1088
  [withClient, passkey]
@@ -1047,7 +1091,10 @@ function useCreateInvite(options) {
1047
1091
  }
1048
1092
  function useRedeemInvite(options) {
1049
1093
  const { withClient, ...state } = useClientAction(options);
1050
- const redeem = useCallback((token) => withClient((c) => c.redeemInvite(token)), [withClient]);
1094
+ const redeem = useCallback(
1095
+ (token) => withClient(async (c) => await c.orgs.inviteRedeem({ token })),
1096
+ [withClient]
1097
+ );
1051
1098
  return { redeem, ...state };
1052
1099
  }
1053
1100
  function useInviteRedemption({ autoRedeem = true } = {}) {
@@ -1078,7 +1125,7 @@ function useInviteRedemption({ autoRedeem = true } = {}) {
1078
1125
  setStatus("redeeming");
1079
1126
  setFailure(null);
1080
1127
  try {
1081
- const answer = await client.redeemInvite(token);
1128
+ const answer = await client.orgs.inviteRedeem({ token });
1082
1129
  setResult(answer);
1083
1130
  setStatus("redeemed");
1084
1131
  session()?.removeItem(STASH_KEY);
@@ -1122,7 +1169,7 @@ function useConsent(options) {
1122
1169
  }, []);
1123
1170
  const request = useCallback(
1124
1171
  (req) => withClient(async (c) => {
1125
- const answer = await c.requestConsent(req);
1172
+ const answer = await c.consent.pageCreate({ body: req });
1126
1173
  setStarted(answer);
1127
1174
  setResult(null);
1128
1175
  return answer;
@@ -1148,7 +1195,7 @@ function useConsent(options) {
1148
1195
  );
1149
1196
  const check = useCallback(
1150
1197
  (requestId) => withClient(async (c) => {
1151
- const answer = await c.consentResult(requestId);
1198
+ const answer = await c.consent.pageResult({ request: requestId });
1152
1199
  setResult(answer);
1153
1200
  return answer;
1154
1201
  }),
@@ -1198,7 +1245,7 @@ function useUploadBlob(options = {}) {
1198
1245
  const upload = useCallback(
1199
1246
  (data) => withClient(async (c) => {
1200
1247
  if (!id) throw new Error("No app to store the blob in.");
1201
- return c.uploadBlob(id, await bytesOf(data));
1248
+ return c.apps.blobUpload({ app: id, body: await bytesOf(data), contentType: "application/octet-stream" });
1202
1249
  }),
1203
1250
  [withClient, id]
1204
1251
  );
@@ -1208,7 +1255,7 @@ function useBlobInfo(blobId, options = {}) {
1208
1255
  const client = useSignedInClient();
1209
1256
  const id = useAppId(options.appId);
1210
1257
  return useResource(
1211
- client && id && blobId ? () => client.blobInfo(id, blobId) : null,
1258
+ client && id && blobId ? () => client.apps.blobInfo({ app: id, id: blobId }) : null,
1212
1259
  null,
1213
1260
  [client, id, blobId]
1214
1261
  );
@@ -1216,7 +1263,11 @@ function useBlobInfo(blobId, options = {}) {
1216
1263
  function useBlobs(appId) {
1217
1264
  const client = useSignedInClient();
1218
1265
  const id = useAppId(appId);
1219
- return useResource(client && id ? () => client.listBlobs(id) : null, [], [client, id]);
1266
+ return useResource(
1267
+ client && id ? async () => (await client.apps.blobList({ app: id })).blobs : null,
1268
+ [],
1269
+ [client, id]
1270
+ );
1220
1271
  }
1221
1272
  function useBlobUrl(blobId, options = {}) {
1222
1273
  const client = useSignedInClient();
@@ -1245,7 +1296,7 @@ function useDeleteBlob(options = {}) {
1245
1296
  const deleteBlob = useCallback(
1246
1297
  (blobId) => withClient(async (c) => {
1247
1298
  if (!id) throw new Error("No app.");
1248
- await c.deleteBlob(id, blobId);
1299
+ await c.apps.blobDelete({ app: id, id: blobId });
1249
1300
  return true;
1250
1301
  }),
1251
1302
  [withClient, id]
@@ -1336,7 +1387,8 @@ function useEphemeral(appId, options = {}) {
1336
1387
  seq.current += 1;
1337
1388
  const bytes = value === null ? null : codecRef.current.encode(value);
1338
1389
  lastSent.current = Date.now();
1339
- client.publishPresence(id, seq.current, bytes).then(
1390
+ const state2 = presenceState(bytes);
1391
+ client.apps.presencePublish({ app: id, seq: seq.current, state: state2 }).then(
1340
1392
  () => setError(null),
1341
1393
  (e) => setError(e instanceof Error ? e : new Error(String(e)))
1342
1394
  );
@@ -1386,7 +1438,7 @@ function useEphemeral(appId, options = {}) {
1386
1438
  function useAccount() {
1387
1439
  const client = useSignedInClient();
1388
1440
  const { accountId } = useMero();
1389
- const me = useResource(client ? () => client.me() : null, null, [client, accountId]);
1441
+ const me = useResource(client ? () => client.auth.me() : null, null, [client, accountId]);
1390
1442
  return { accountId, ...me };
1391
1443
  }
1392
1444
  function usePasskeys(options) {
@@ -1398,14 +1450,14 @@ function usePasskeys(options) {
1398
1450
  );
1399
1451
  const remove = useCallback(
1400
1452
  (credentialId) => withClient(async (c) => {
1401
- await c.removePasskey(credentialId, passkey);
1453
+ await c.auth.passkeyRemove({ cred: credentialId }, confirmWith(passkey));
1402
1454
  return true;
1403
1455
  }),
1404
1456
  [withClient, passkey]
1405
1457
  );
1406
1458
  const label = useCallback(
1407
1459
  (credentialId, name) => withClient(async (c) => {
1408
- await c.labelPasskey(credentialId, name);
1460
+ await c.auth.passkeyLabel({ cred: credentialId, label: name });
1409
1461
  return true;
1410
1462
  }),
1411
1463
  [withClient]
@@ -1415,15 +1467,16 @@ function usePasskeys(options) {
1415
1467
  function useApiKeys(options) {
1416
1468
  const client = useSignedInClient();
1417
1469
  const { passkey, accountId } = useMero();
1418
- const keys = useResource(client ? () => client.listApiKeys() : null, [], [
1419
- client,
1420
- accountId
1421
- ]);
1470
+ const keys = useResource(
1471
+ client ? async () => (await client.auth.apikeyList()).keys : null,
1472
+ [],
1473
+ [client, accountId]
1474
+ );
1422
1475
  const { refetch } = keys;
1423
1476
  const { withClient, ...state } = useClientAction(options);
1424
1477
  const create = useCallback(
1425
1478
  (input = {}) => withClient(async (c) => {
1426
- const created = await c.createApiKey(input, passkey);
1479
+ const created = await c.auth.apikeyCreate({ ...input }, confirmWith(passkey));
1427
1480
  void refetch();
1428
1481
  return created;
1429
1482
  }),
@@ -1431,11 +1484,11 @@ function useApiKeys(options) {
1431
1484
  );
1432
1485
  const revoke = useCallback(
1433
1486
  (keyId) => withClient(async (c) => {
1434
- await c.revokeApiKey(keyId);
1487
+ await c.auth.apikeyRevoke({ key: keyId }, confirmWith(passkey));
1435
1488
  void refetch();
1436
1489
  return true;
1437
1490
  }),
1438
- [withClient, refetch]
1491
+ [withClient, passkey, refetch]
1439
1492
  );
1440
1493
  return {
1441
1494
  keys: keys.data,