@dxos/plugin-client 0.14.0 → 0.16.0-next-60712ab191a99ba90316cc4be753e9e11b17100a

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.
Files changed (132) hide show
  1. package/dist/lib/Account.mjs +1 -42
  2. package/dist/lib/AccountCache.mjs +1 -30
  3. package/dist/lib/CliLogin.mjs +1 -78
  4. package/dist/lib/ClientAction.mjs +1 -75
  5. package/dist/lib/ClientCapabilities.mjs +1 -60
  6. package/dist/lib/ClientEvents.mjs +1 -25
  7. package/dist/lib/ClientOperation.mjs +1 -196
  8. package/dist/lib/ClientOptions.mjs +1 -7
  9. package/dist/lib/ClientPlugin.mjs +1 -16
  10. package/dist/lib/PasskeyError.mjs +1 -99
  11. package/dist/lib/capabilities.browser.mjs +2 -1
  12. package/dist/lib/capabilities.browser.mjs.map +1 -1
  13. package/dist/lib/capabilities.mjs +2 -1
  14. package/dist/lib/capabilities.mjs.map +1 -1
  15. package/dist/lib/capabilities.node.mjs +2 -1
  16. package/dist/lib/capabilities.node.mjs.map +1 -1
  17. package/dist/lib/capabilities.tauri.mjs +2 -1
  18. package/dist/lib/capabilities.tauri.mjs.map +1 -1
  19. package/dist/lib/chunk-Account.mjs +42 -0
  20. package/dist/lib/chunk-Account.mjs.map +1 -0
  21. package/dist/lib/chunk-AccountCache.mjs +30 -0
  22. package/dist/lib/chunk-AccountCache.mjs.map +1 -0
  23. package/dist/lib/chunk-AccountContainer.mjs.map +1 -1
  24. package/dist/lib/chunk-CliLogin.mjs +78 -0
  25. package/dist/lib/chunk-CliLogin.mjs.map +1 -0
  26. package/dist/lib/chunk-CliLoginDialog.mjs.map +1 -1
  27. package/dist/lib/chunk-ClientAction.mjs +75 -0
  28. package/dist/lib/chunk-ClientAction.mjs.map +1 -0
  29. package/dist/lib/chunk-ClientCapabilities.mjs +60 -0
  30. package/dist/lib/chunk-ClientCapabilities.mjs.map +1 -0
  31. package/dist/lib/chunk-ClientEvents.mjs +25 -0
  32. package/dist/lib/chunk-ClientEvents.mjs.map +1 -0
  33. package/dist/lib/chunk-ClientOperation.mjs +196 -0
  34. package/dist/lib/chunk-ClientOperation.mjs.map +1 -0
  35. package/dist/lib/chunk-ClientOptions.mjs +7 -0
  36. package/dist/lib/chunk-ClientOptions.mjs.map +1 -0
  37. package/dist/lib/chunk-ClientPlugin.mjs +16 -0
  38. package/dist/lib/chunk-ClientPlugin.mjs.map +1 -0
  39. package/dist/lib/chunk-ContactPickerContainer.mjs +6 -3
  40. package/dist/lib/chunk-ContactPickerContainer.mjs.map +1 -1
  41. package/dist/lib/chunk-DevicesContainer.mjs.map +1 -1
  42. package/dist/lib/chunk-InvitationsContainer.mjs +1 -3
  43. package/dist/lib/chunk-InvitationsContainer.mjs.map +1 -1
  44. package/dist/lib/chunk-JoinDialog.mjs +3 -10
  45. package/dist/lib/chunk-JoinDialog.mjs.map +1 -1
  46. package/dist/lib/chunk-PasskeyError.mjs +99 -0
  47. package/dist/lib/chunk-PasskeyError.mjs.map +1 -0
  48. package/dist/lib/chunk-RecoveryCredentialsContainer.mjs +13 -8
  49. package/dist/lib/chunk-RecoveryCredentialsContainer.mjs.map +1 -1
  50. package/dist/lib/chunk-ResetDialog.mjs +14 -10
  51. package/dist/lib/chunk-ResetDialog.mjs.map +1 -1
  52. package/dist/lib/chunk-client.mjs +71 -13
  53. package/dist/lib/chunk-client.mjs.map +1 -1
  54. package/dist/lib/chunk-create-agent.mjs +1 -1
  55. package/dist/lib/chunk-create-identity.mjs +1 -1
  56. package/dist/lib/chunk-create-passkey.mjs +1 -1
  57. package/dist/lib/chunk-create-recovery-code.mjs +1 -1
  58. package/dist/lib/chunk-grant-service-access.mjs +1 -1
  59. package/dist/lib/chunk-halo.mjs.map +1 -1
  60. package/dist/lib/chunk-join-identity.mjs +1 -1
  61. package/dist/lib/chunk-layer-specs.mjs.map +1 -1
  62. package/dist/lib/chunk-open-usage.mjs +1 -1
  63. package/dist/lib/chunk-recover-identity.mjs +1 -1
  64. package/dist/lib/chunk-redeem-passkey.mjs +1 -1
  65. package/dist/lib/chunk-redeem-token.mjs +1 -1
  66. package/dist/lib/chunk-reset-storage.mjs +1 -1
  67. package/dist/lib/chunk-revoke-recovery-credential.mjs +1 -1
  68. package/dist/lib/chunk-share-identity.mjs +1 -1
  69. package/dist/lib/chunk-space-replication-progress.mjs +2 -2
  70. package/dist/lib/chunk-space-replication-progress.mjs.map +1 -1
  71. package/dist/lib/chunk-update-profile.mjs +1 -1
  72. package/dist/lib/commands.node.mjs.map +1 -1
  73. package/dist/lib/components.mjs +4 -15
  74. package/dist/lib/components.mjs.map +1 -1
  75. package/dist/lib/index.mjs +1 -1
  76. package/dist/lib/meta.mjs.map +1 -1
  77. package/dist/lib/ns/HaloServices.mjs +1 -2
  78. package/dist/lib/operations.mjs +1 -1
  79. package/dist/lib/testing.mjs.map +1 -1
  80. package/dist/lib/translations.mjs +0 -1
  81. package/dist/lib/translations.mjs.map +1 -1
  82. package/dist/lib/types.mjs +9 -9
  83. package/dist/types/src/capabilities/client.d.ts +1 -1
  84. package/dist/types/src/capabilities/client.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
  87. package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -1
  88. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/unsaved-changes.d.ts +19 -0
  90. package/dist/types/src/capabilities/unsaved-changes.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/unsaved-changes.test.d.ts +2 -0
  92. package/dist/types/src/capabilities/unsaved-changes.test.d.ts.map +1 -0
  93. package/dist/types/src/components/DevicesForm/DevicesForm.d.ts +2 -2
  94. package/dist/types/src/components/DevicesForm/DevicesForm.d.ts.map +1 -1
  95. package/dist/types/src/components/DevicesForm/DevicesForm.stories.d.ts +7 -2
  96. package/dist/types/src/components/DevicesForm/DevicesForm.stories.d.ts.map +1 -1
  97. package/dist/types/src/containers/ContactPickerContainer/ContactPickerContainer.d.ts.map +1 -1
  98. package/dist/types/src/containers/ContactPickerContainer/ContactPickerContainer.stories.d.ts +2 -2
  99. package/dist/types/src/containers/ContactsContainer/ContactsContainer.stories.d.ts +2 -2
  100. package/dist/types/src/containers/DevicesContainer/DevicesContainer.stories.d.ts +2 -2
  101. package/dist/types/src/containers/JoinDialog/JoinDialog.d.ts.map +1 -1
  102. package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.d.ts.map +1 -1
  103. package/dist/types/src/translations.d.ts.map +1 -1
  104. package/dist/types/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +43 -43
  106. package/src/capabilities/client.ts +24 -4
  107. package/src/capabilities/gen/browser.ts +1 -0
  108. package/src/capabilities/gen/node.ts +1 -0
  109. package/src/capabilities/gen/tauri.ts +1 -0
  110. package/src/capabilities/index.ts +1 -0
  111. package/src/capabilities/space-replication-progress.ts +8 -7
  112. package/src/capabilities/unsaved-changes.test.ts +35 -0
  113. package/src/capabilities/unsaved-changes.ts +47 -0
  114. package/src/components/DevicesForm/DevicesForm.stories.tsx +45 -1
  115. package/src/components/DevicesForm/DevicesForm.tsx +3 -10
  116. package/src/containers/ContactPickerContainer/ContactPickerContainer.tsx +9 -2
  117. package/src/containers/InvitationsContainer/InvitationsContainer.tsx +2 -2
  118. package/src/containers/JoinDialog/JoinDialog.tsx +9 -18
  119. package/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.tsx +4 -2
  120. package/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.tsx +24 -17
  121. package/src/containers/ResetDialog/ResetDialog.tsx +8 -10
  122. package/src/translations.ts +0 -1
  123. package/dist/lib/Account.mjs.map +0 -1
  124. package/dist/lib/AccountCache.mjs.map +0 -1
  125. package/dist/lib/CliLogin.mjs.map +0 -1
  126. package/dist/lib/ClientAction.mjs.map +0 -1
  127. package/dist/lib/ClientCapabilities.mjs.map +0 -1
  128. package/dist/lib/ClientEvents.mjs.map +0 -1
  129. package/dist/lib/ClientOperation.mjs.map +0 -1
  130. package/dist/lib/ClientOptions.mjs.map +0 -1
  131. package/dist/lib/ClientPlugin.mjs.map +0 -1
  132. package/dist/lib/PasskeyError.mjs.map +0 -1
@@ -1,42 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import { getEnvString } from "@dxos/config";
3
- import * as GraphPath from "@dxos/app-toolkit/GraphPath";
4
- //#region src/types/Account.ts
5
- var Account_exports = /* @__PURE__ */ __exportAll({
6
- Account: () => Account,
7
- Contacts: () => Contacts,
8
- Devices: () => Devices,
9
- Invitations: () => Invitations,
10
- Profile: () => Profile,
11
- Security: () => Security,
12
- Usage: () => Usage,
13
- getHubUrl: () => getHubUrl,
14
- id: () => id,
15
- isAuthEnabled: () => isAuthEnabled,
16
- path: () => path,
17
- workspacePath: () => workspacePath
18
- });
19
- /** Pinned (non-space) workspace ID anchoring the account's graph subtree, and its URL workspace token. */
20
- var id = "dxos:account";
21
- /** Panel ids, relative to the account workspace they hang off. Each is also its own singleton URL key. */
22
- var Profile = "profile";
23
- var Devices = "devices";
24
- var Contacts = "contacts";
25
- var Security = "security";
26
- var Account = "account";
27
- var Invitations = "invitations";
28
- var Usage = "usage";
29
- /** The account's own workspace path. */
30
- var workspacePath = GraphPath.getSpacePath(id);
31
- /** A panel's qualified path, which its surface matches on. */
32
- var path = (panel) => GraphPath.getSpacePath(id, panel);
33
- /**
34
- * The hub backing accounts, or `undefined` where none is configured.
35
- */
36
- var getHubUrl = (config) => getEnvString(config, "DX_HUB_URL");
37
- /** Whether this profile has an account service to authenticate against. */
38
- var isAuthEnabled = (config) => !!getHubUrl(config);
39
- //#endregion
40
- export { Account, Contacts, Devices, Invitations, Profile, Security, Usage, getHubUrl, id, isAuthEnabled, path, Account_exports as t, workspacePath };
41
-
42
- //# sourceMappingURL=Account.mjs.map
1
+ export { t as Account, r as Contacts, i as Devices, a as Invitations, o as Profile, s as Security, c as Usage, l as getHubUrl, u as id, d as isAuthEnabled, f as path, p as workspacePath } from "./chunk-Account.mjs";
@@ -1,30 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import * as Schema from "effect/Schema";
3
- //#region src/types/AccountCache.ts
4
- var AccountCache_exports = /* @__PURE__ */ __exportAll({ AccountCache: () => AccountCache });
5
- var AccountCacheValue = Schema.Struct({
6
- identityDid: Schema.String,
7
- email: Schema.String,
8
- emailVerified: Schema.Boolean,
9
- /** ISO timestamp. */
10
- createdAt: Schema.String,
11
- invitationsRemaining: Schema.Number
12
- });
13
- var AccountCacheInvitation = Schema.Struct({
14
- code: Schema.String,
15
- /** ISO timestamp. */
16
- createdAt: Schema.String,
17
- redeemedByIdentityDid: Schema.optional(Schema.String),
18
- /** ISO timestamp. */
19
- redeemedAt: Schema.optional(Schema.String)
20
- });
21
- var AccountCache = Schema.Struct({
22
- account: Schema.optional(AccountCacheValue),
23
- invitations: Schema.optional(Schema.Array(AccountCacheInvitation)),
24
- /** Epoch ms when the cache was last refreshed. */
25
- fetchedAt: Schema.optional(Schema.Number)
26
- });
27
- //#endregion
28
- export { AccountCache, AccountCache_exports as t };
29
-
30
- //# sourceMappingURL=AccountCache.mjs.map
1
+ export { t as AccountCache } from "./chunk-AccountCache.mjs";
@@ -1,78 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- //#region src/types/CliLogin.ts
3
- var CliLogin_exports = /* @__PURE__ */ __exportAll({
4
- CALLBACK_PARAM: () => CALLBACK_PARAM,
5
- CALLBACK_PATH: () => CALLBACK_PATH,
6
- INVITATION_CODE_PARAM: () => INVITATION_CODE_PARAM,
7
- RESPONSE_STATE_PARAM: () => RESPONSE_STATE_PARAM,
8
- STATE_PARAM: () => STATE_PARAM,
9
- createAuthorizeUrl: () => createAuthorizeUrl,
10
- createCallbackUrl: () => createCallbackUrl,
11
- createState: () => createState,
12
- isValidState: () => isValidState,
13
- parseCallback: () => parseCallback
14
- });
15
- /**
16
- * Contract between `dx account login --method composer` and the Composer page that approves it.
17
- *
18
- * The CLI opens `<composer>/?cliLogin=<callback>&cliLoginState=<state>`; once the user approves,
19
- * Composer creates a device invitation and hands its code to `<callback>?invitationCode=…&state=…`.
20
- * Both sides import this module so the parameter names cannot drift apart.
21
- */
22
- /** Query param carrying the CLI's loopback callback URL. */
23
- var CALLBACK_PARAM = "cliLogin";
24
- /** Query param carrying the CLI's one-time state, shown on both sides so the user can match them. */
25
- var STATE_PARAM = "cliLoginState";
26
- /** Callback query params written by Composer. */
27
- var INVITATION_CODE_PARAM = "invitationCode";
28
- var RESPONSE_STATE_PARAM = "state";
29
- /** Path the CLI's loopback server answers on. */
30
- var CALLBACK_PATH = "/cli-login";
31
- var LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
32
- "localhost",
33
- "127.0.0.1",
34
- "[::1]"
35
- ]);
36
- /**
37
- * Parses a callback URL, accepting only plain-HTTP loopback targets.
38
- *
39
- * The invitation code is a bearer credential for the identity, so it may only ever be delivered to
40
- * this machine: a link crafted by someone else then admits nothing, because the victim's own
41
- * loopback port has nobody listening for it (the same rule the hub applies to passkey callbacks).
42
- */
43
- var parseCallback = (value) => {
44
- if (!value) return;
45
- try {
46
- const url = new URL(value);
47
- return url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname) && url.pathname === "/cli-login" ? url : void 0;
48
- } catch {
49
- return;
50
- }
51
- };
52
- /** The state is short and human-comparable, so it doubles as the code the user matches by eye. */
53
- var isValidState = (value) => !!value && /^[A-Z0-9]{4}-[A-Z0-9]{4}$/.test(value);
54
- var STATE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
55
- /** Generates a state token in the `XXXX-XXXX` form {@link isValidState} accepts. */
56
- var createState = () => {
57
- const bytes = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(8));
58
- const chars = Array.from(bytes, (byte) => STATE_ALPHABET[byte % 32]);
59
- return `${chars.slice(0, 4).join("")}-${chars.slice(4).join("")}`;
60
- };
61
- /** URL the CLI opens: Composer's origin with the callback and state attached. */
62
- var createAuthorizeUrl = (composerUrl, callback, state) => {
63
- const url = new URL(composerUrl);
64
- url.searchParams.set(CALLBACK_PARAM, callback);
65
- url.searchParams.set(STATE_PARAM, state);
66
- return url;
67
- };
68
- /** URL Composer calls back on, carrying the invitation code and echoing the state. */
69
- var createCallbackUrl = (callback, invitationCode, state) => {
70
- const url = new URL(callback);
71
- url.searchParams.set(INVITATION_CODE_PARAM, invitationCode);
72
- url.searchParams.set(RESPONSE_STATE_PARAM, state);
73
- return url;
74
- };
75
- //#endregion
76
- export { CALLBACK_PARAM, CALLBACK_PATH, INVITATION_CODE_PARAM, RESPONSE_STATE_PARAM, STATE_PARAM, createAuthorizeUrl, createCallbackUrl, createState, isValidState, parseCallback, CliLogin_exports as t };
77
-
78
- //# sourceMappingURL=CliLogin.mjs.map
1
+ export { t as CALLBACK_PARAM, n as CALLBACK_PATH, i as INVITATION_CODE_PARAM, a as RESPONSE_STATE_PARAM, o as STATE_PARAM, s as createAuthorizeUrl, c as createCallbackUrl, l as createState, u as isValidState, d as parseCallback } from "./chunk-CliLogin.mjs";
@@ -1,75 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import { meta } from "#meta";
3
- import * as Schema from "effect/Schema";
4
- import { IdentityDid, SpaceId } from "@dxos/keys";
5
- //#region src/types/ClientAction.ts
6
- var ClientAction_exports = /* @__PURE__ */ __exportAll({
7
- CreateAgent: () => CreateAgent,
8
- CreateIdentity: () => CreateIdentity,
9
- CreatePasskey: () => CreatePasskey,
10
- CreateRecoveryCode: () => CreateRecoveryCode,
11
- JoinIdentity: () => JoinIdentity,
12
- RecoverIdentity: () => RecoverIdentity,
13
- RedeemPasskey: () => RedeemPasskey,
14
- RedeemToken: () => RedeemToken,
15
- ResetStorage: () => ResetStorage,
16
- ShareIdentity: () => ShareIdentity
17
- });
18
- var IdentitySchema = Schema.Struct({
19
- identityDid: IdentityDid,
20
- spaceId: Schema.optional(SpaceId),
21
- profile: Schema.optional(Schema.Struct({
22
- displayName: Schema.optional(Schema.String),
23
- avatarCid: Schema.optional(Schema.String),
24
- data: Schema.optional(Schema.Record(Schema.String, Schema.Any))
25
- }))
26
- });
27
- var ProfileSchema = Schema.Struct({
28
- displayName: Schema.optional(Schema.String),
29
- avatarCid: Schema.optional(Schema.String),
30
- data: Schema.optional(Schema.Record(Schema.String, Schema.Any))
31
- });
32
- var CreateIdentity = class extends Schema.TaggedClass()(`${meta.profile.key}.action.create-identity`, {
33
- input: ProfileSchema,
34
- output: IdentitySchema
35
- }) {};
36
- var JoinIdentity = class extends Schema.TaggedClass()(`${meta.profile.key}.action.join-identity`, {
37
- input: Schema.Struct({ invitationCode: Schema.optional(Schema.String) }),
38
- output: Schema.Void
39
- }) {};
40
- var ShareIdentity = class extends Schema.TaggedClass()(`${meta.profile.key}.action.share-identity`, {
41
- input: Schema.Void,
42
- output: Schema.Void
43
- }) {};
44
- var RecoverIdentity = class extends Schema.TaggedClass()(`${meta.profile.key}.action.recover-identity`, {
45
- input: Schema.Void,
46
- output: Schema.Void
47
- }) {};
48
- var ResetStorage = class extends Schema.TaggedClass()(`${meta.profile.key}.action.reset-storage`, {
49
- input: Schema.Struct({ mode: Schema.optional(Schema.String) }),
50
- output: Schema.Void
51
- }) {};
52
- var CreateAgent = class extends Schema.TaggedClass()(`${meta.profile.key}.action.create-agent`, {
53
- input: Schema.Void,
54
- output: Schema.Void
55
- }) {};
56
- var CreateRecoveryCode = class extends Schema.TaggedClass()(`${meta.profile.key}.action.create-recovery-code`, {
57
- input: Schema.Void,
58
- output: Schema.Void
59
- }) {};
60
- var CreatePasskey = class extends Schema.TaggedClass()(`${meta.profile.key}.action.create-passkey`, {
61
- input: Schema.Void,
62
- output: Schema.Void
63
- }) {};
64
- var RedeemPasskey = class extends Schema.TaggedClass()(`${meta.profile.key}.action.redeem-passkey`, {
65
- input: Schema.Void,
66
- output: Schema.Void
67
- }) {};
68
- var RedeemToken = class extends Schema.TaggedClass()(`${meta.profile.key}.action.redeem-token`, {
69
- input: Schema.Struct({ token: Schema.String }),
70
- output: Schema.Void
71
- }) {};
72
- //#endregion
73
- export { CreateAgent, CreateIdentity, CreatePasskey, CreateRecoveryCode, JoinIdentity, RecoverIdentity, RedeemPasskey, RedeemToken, ResetStorage, ShareIdentity, ClientAction_exports as t };
74
-
75
- //# sourceMappingURL=ClientAction.mjs.map
1
+ export { n as CreateAgent, r as CreateIdentity, i as CreatePasskey, a as CreateRecoveryCode, o as JoinIdentity, s as RecoverIdentity, c as RedeemPasskey, l as RedeemToken, u as ResetStorage, d as ShareIdentity } from "./chunk-ClientAction.mjs";
@@ -1,60 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import * as Capability from "@dxos/app-framework/Capability";
3
- import { meta } from "#meta";
4
- //#region src/types/ClientCapabilities.ts
5
- var ClientCapabilities_exports = /* @__PURE__ */ __exportAll({
6
- AccountCache: () => AccountCache,
7
- Client: () => Client,
8
- Config: () => Config,
9
- EdgeHttpClient: () => EdgeHttpClient,
10
- HubHttpClient: () => HubHttpClient,
11
- Hypergraph: () => Hypergraph,
12
- IdentityService: () => IdentityService,
13
- InitializeTimeout: () => InitializeTimeout,
14
- Migration: () => Migration,
15
- OnIdentityDeleted: () => OnIdentityDeleted,
16
- Schema: () => Schema,
17
- SchemaRegistered: () => SchemaRegistered,
18
- SpaceService: () => SpaceService
19
- });
20
- var Client = Capability.makeSingleton()(`${meta.profile.key}.capability.client`);
21
- var Schema = Capability.make()(`${meta.profile.key}.capability.schema`);
22
- /**
23
- * The effective `initializeTimeout` the client capability resolved. Consumers that wait on
24
- * `client.waitUntilInitialized()` bound themselves by this rather than the default, so a host that
25
- * widens the client's initialization budget does not have its layers time out underneath it.
26
- */
27
- var InitializeTimeout = Capability.makeSingleton()(`${meta.profile.key}.capability.initializeTimeout`);
28
- /**
29
- * Ordering marker for modules that create typed objects: requiring `Schema` only orders after the
30
- * schema PROVIDERS, which says nothing about `SchemaDefs`, the fellow consumer that registers them.
31
- * `true` rather than `void` — the loader reads an `undefined` implementation as not contributed.
32
- */
33
- var SchemaRegistered = Capability.makeSingleton()(`${meta.profile.key}.capability.schemaRegistered`);
34
- var Migration = Capability.make()(`${meta.profile.key}.capability.migration`);
35
- var AccountCache = Capability.makeSingleton()(`${meta.profile.key}.capability.accountCache`);
36
- var OnIdentityDeleted = Capability.make()(`${meta.profile.key}.capability.onIdentityDeleted`);
37
- var HubHttpClient = Capability.makeSingleton()(`${meta.profile.key}.capability.hubHttpClient`);
38
- /**
39
- * The client's runtime configuration, for consumers that need a config value (e.g. the EDGE URL)
40
- * without depending on `@dxos/client`. Contributed once the client has initialized.
41
- */
42
- var Config = Capability.makeSingleton()(`${meta.profile.key}.capability.config`);
43
- /**
44
- * The EDGE HTTP client, for consumers that call EDGE endpoints without depending on `@dxos/client`.
45
- * Absent when the config names no EDGE URL.
46
- */
47
- var EdgeHttpClient = Capability.makeSingleton()(`${meta.profile.key}.capability.edgeHttpClient`);
48
- /** The cross-space ECHO graph, for imperative consumers that must find a space's database by id. */
49
- var Hypergraph = Capability.makeSingleton()(`${meta.profile.key}.capability.hypergraph`);
50
- /**
51
- * The HALO Identity service instance, for imperative (non-React, non-Effect-layer) consumers
52
- * that need identity access without depending on `@dxos/client`.
53
- */
54
- var IdentityService = Capability.makeSingleton()(`${meta.profile.key}.capability.identityService`);
55
- /** The HALO Space service instance, for imperative consumers. */
56
- var SpaceService = Capability.makeSingleton()(`${meta.profile.key}.capability.spaceService`);
57
- //#endregion
58
- export { AccountCache, Client, Config, EdgeHttpClient, HubHttpClient, Hypergraph, IdentityService, InitializeTimeout, Migration, OnIdentityDeleted, Schema, SchemaRegistered, SpaceService, ClientCapabilities_exports as t };
59
-
60
- //# sourceMappingURL=ClientCapabilities.mjs.map
1
+ export { t as AccountCache, n as Client, i as Config, a as EdgeHttpClient, o as HubHttpClient, s as Hypergraph, c as IdentityService, l as InitializeTimeout, u as Migration, d as OnIdentityDeleted, f as Schema, p as SchemaRegistered, m as SpaceService } from "./chunk-ClientCapabilities.mjs";
@@ -1,25 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import { meta } from "#meta";
3
- import * as ActivationEvent from "@dxos/app-framework/ActivationEvent";
4
- //#region src/types/ClientEvents.ts
5
- var ClientEvents_exports = /* @__PURE__ */ __exportAll({
6
- IdentityCreated: () => IdentityCreated,
7
- Initialized: () => Initialized,
8
- SpacesAvailable: () => SpacesAvailable
9
- });
10
- /**
11
- * Runtime event: `client.initialize()` (forked off the startup pass) has completed. Modules
12
- * whose activation bodies need an initialized client (sync `halo`/`spaces` reads) ride this
13
- * instead of the startup dependency pass, which no longer implies initialization.
14
- */
15
- var Initialized = ActivationEvent.make(`${meta.profile.key}.event.initialized`);
16
- var IdentityCreated = ActivationEvent.make(`${meta.profile.key}.event.identityCreated`);
17
- /**
18
- * Runtime event: the space list is observable. The spaces themselves may still be opening, so a
19
- * module that reads a space's properties waits for that space rather than for this.
20
- */
21
- var SpacesAvailable = ActivationEvent.make(`${meta.profile.key}.event.spacesAvailable`);
22
- //#endregion
23
- export { IdentityCreated, Initialized, SpacesAvailable, ClientEvents_exports as t };
24
-
25
- //# sourceMappingURL=ClientEvents.mjs.map
1
+ export { n as IdentityCreated, r as Initialized, i as SpacesAvailable } from "./chunk-ClientEvents.mjs";
@@ -1,196 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import * as Capability from "@dxos/app-framework/Capability";
3
- import { Identity } from "@dxos/halo";
4
- import * as Schema from "effect/Schema";
5
- import * as Operation from "@dxos/compute/Operation";
6
- import { DXN, IdentityDid, SpaceId } from "@dxos/keys";
7
- //#region src/types/ClientOperation.ts
8
- var ClientOperation_exports = /* @__PURE__ */ __exportAll({
9
- CreateAgent: () => CreateAgent,
10
- CreateIdentity: () => CreateIdentity,
11
- CreatePasskey: () => CreatePasskey,
12
- CreateRecoveryCode: () => CreateRecoveryCode,
13
- GrantServiceAccess: () => GrantServiceAccess,
14
- JoinIdentity: () => JoinIdentity,
15
- OpenUsage: () => OpenUsage,
16
- RecoverIdentity: () => RecoverIdentity,
17
- RedeemPasskey: () => RedeemPasskey,
18
- RedeemToken: () => RedeemToken,
19
- ResetStorage: () => ResetStorage,
20
- RevokeRecoveryCredential: () => RevokeRecoveryCredential,
21
- ShareIdentity: () => ShareIdentity,
22
- UpdateProfile: () => UpdateProfile
23
- });
24
- var IdentitySchema = Schema.Struct({
25
- identityDid: IdentityDid,
26
- spaceId: Schema.optional(SpaceId),
27
- profile: Schema.optional(Schema.Struct({
28
- displayName: Schema.optional(Schema.String),
29
- avatarCid: Schema.optional(Schema.String),
30
- data: Schema.optional(Schema.Record(Schema.String, Schema.Any))
31
- }))
32
- });
33
- var ProfileSchema = Schema.Struct({
34
- displayName: Schema.optional(Schema.String),
35
- avatarCid: Schema.optional(Schema.String),
36
- data: Schema.optional(Schema.Record(Schema.String, Schema.Any))
37
- });
38
- var CreateIdentity = Operation.make({
39
- meta: {
40
- key: DXN.make("org.dxos.operation.client.createIdentity"),
41
- name: "Create Identity",
42
- icon: "ph--user--regular"
43
- },
44
- services: [Capability.Service, Identity.Service],
45
- input: ProfileSchema,
46
- output: IdentitySchema
47
- });
48
- var UpdateProfile = Operation.make({
49
- meta: {
50
- key: DXN.make("org.dxos.operation.client.updateProfile"),
51
- name: "Update Profile",
52
- icon: "ph--user--regular"
53
- },
54
- services: [Identity.Service],
55
- input: ProfileSchema,
56
- output: Schema.Void
57
- });
58
- var JoinIdentity = Operation.make({
59
- meta: {
60
- key: DXN.make("org.dxos.operation.client.joinIdentity"),
61
- name: "Join Identity",
62
- icon: "ph--sign-in--regular"
63
- },
64
- services: [Capability.Service],
65
- input: Schema.Struct({ invitationCode: Schema.optional(Schema.String) }),
66
- output: Schema.Void
67
- });
68
- var ShareIdentity = Operation.make({
69
- meta: {
70
- key: DXN.make("org.dxos.operation.client.shareIdentity"),
71
- name: "Share Identity",
72
- icon: "ph--share-network--regular"
73
- },
74
- services: [Capability.Service],
75
- input: Schema.Void,
76
- output: Schema.Void
77
- });
78
- var OpenUsage = Operation.make({
79
- meta: {
80
- key: DXN.make("org.dxos.operation.client.openUsage"),
81
- name: "Open Usage",
82
- icon: "ph--chart-bar--regular"
83
- },
84
- services: [Capability.Service],
85
- input: Schema.Void,
86
- output: Schema.Void
87
- });
88
- var RecoverIdentity = Operation.make({
89
- meta: {
90
- key: DXN.make("org.dxos.operation.client.recoverIdentity"),
91
- name: "Recover Identity",
92
- icon: "ph--key--regular"
93
- },
94
- services: [Capability.Service],
95
- input: Schema.Void,
96
- output: Schema.Void
97
- });
98
- var ResetStorage = Operation.make({
99
- meta: {
100
- key: DXN.make("org.dxos.operation.client.resetStorage"),
101
- name: "Reset Storage",
102
- icon: "ph--warning--regular"
103
- },
104
- services: [Capability.Service],
105
- input: Schema.Struct({
106
- mode: Schema.optional(Schema.String),
107
- /** Device invitation to accept once the identity is deleted (`join-new-identity` only). */
108
- invitationCode: Schema.optional(Schema.String)
109
- }),
110
- output: Schema.Void
111
- });
112
- var CreateAgent = Operation.make({
113
- meta: {
114
- key: DXN.make("org.dxos.operation.client.createAgent"),
115
- name: "Create Agent",
116
- icon: "ph--brain--regular"
117
- },
118
- services: [Capability.Service],
119
- input: Schema.Void,
120
- output: Schema.Void
121
- });
122
- var GrantServiceAccess = Operation.make({
123
- meta: {
124
- key: DXN.make("org.dxos.operation.client.grantServiceAccess"),
125
- name: "Grant Service Access",
126
- icon: "ph--key--regular"
127
- },
128
- services: [Identity.Service],
129
- input: Schema.Struct({
130
- /** Target server name (e.g. `hub.dxos.network`). */
131
- serverName: Schema.String,
132
- /** Capabilities to grant (e.g. `['composer:beta']`). */
133
- capabilities: Schema.Array(Schema.String)
134
- }),
135
- output: Schema.Void
136
- });
137
- var CreateRecoveryCode = Operation.make({
138
- meta: {
139
- key: DXN.make("org.dxos.operation.client.createRecoveryCode"),
140
- name: "Create Recovery Code",
141
- icon: "ph--key--regular"
142
- },
143
- services: [Capability.Service, Identity.Service],
144
- input: Schema.Void,
145
- output: Schema.Void
146
- });
147
- var CreatePasskey = Operation.make({
148
- meta: {
149
- key: DXN.make("org.dxos.operation.client.createPasskey"),
150
- name: "Create Passkey",
151
- icon: "ph--key--regular"
152
- },
153
- services: [Capability.Service, Identity.Service],
154
- input: Schema.Void,
155
- output: Schema.Void
156
- });
157
- var RevokeRecoveryCredential = Operation.make({
158
- meta: {
159
- key: DXN.make("org.dxos.operation.client.revokeRecoveryCredential"),
160
- name: "Revoke Recovery Credential",
161
- icon: "ph--key--regular"
162
- },
163
- services: [Capability.Service, Identity.Service],
164
- input: Schema.Struct({
165
- /**
166
- * Lookup key of the credential to revoke, as hex. Constrained to a full key because
167
- * `PublicKey.from` silently drops non-hex characters rather than rejecting them, so an
168
- * unvalidated string would decode to some other key instead of failing.
169
- */
170
- lookupKey: Schema.String.check(Schema.isPattern(/^[0-9a-fA-F]{64}$/u)) }),
171
- output: Schema.Void
172
- });
173
- var RedeemPasskey = Operation.make({
174
- meta: {
175
- key: DXN.make("org.dxos.operation.client.redeemPasskey"),
176
- name: "Redeem Passkey",
177
- icon: "ph--key--regular"
178
- },
179
- services: [Capability.Service, Identity.Service],
180
- input: Schema.Void,
181
- output: Schema.Void
182
- });
183
- var RedeemToken = Operation.make({
184
- meta: {
185
- key: DXN.make("org.dxos.operation.client.redeemToken"),
186
- name: "Redeem Token",
187
- icon: "ph--lock--regular"
188
- },
189
- services: [Capability.Service, Identity.Service],
190
- input: Schema.Struct({ token: Schema.String }),
191
- output: Schema.Void
192
- });
193
- //#endregion
194
- export { CreateAgent, CreateIdentity, CreatePasskey, CreateRecoveryCode, GrantServiceAccess, JoinIdentity, OpenUsage, RecoverIdentity, RedeemPasskey, RedeemToken, ResetStorage, RevokeRecoveryCredential, ShareIdentity, UpdateProfile, ClientOperation_exports as t };
195
-
196
- //# sourceMappingURL=ClientOperation.mjs.map
1
+ export { n as CreateAgent, r as CreateIdentity, i as CreatePasskey, a as CreateRecoveryCode, o as GrantServiceAccess, s as JoinIdentity, c as OpenUsage, l as RecoverIdentity, u as RedeemPasskey, d as RedeemToken, f as ResetStorage, p as RevokeRecoveryCredential, m as ShareIdentity, h as UpdateProfile } from "./chunk-ClientOperation.mjs";
@@ -1,7 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- //#region src/types/ClientOptions.ts
3
- var ClientOptions_exports = /* @__PURE__ */ __exportAll({});
4
- //#endregion
5
- export { ClientOptions_exports as t };
6
-
7
- //# sourceMappingURL=ClientOptions.mjs.map
1
+ import "./chunk-ClientOptions.mjs";
@@ -1,16 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import * as Plugin from "@dxos/app-framework/Plugin";
3
- import { meta as meta$1 } from "#meta";
4
- //#region src/ClientPlugin.ts
5
- var ClientPlugin_exports = /* @__PURE__ */ __exportAll({
6
- make: () => make,
7
- meta: () => meta
8
- });
9
- /** Plugin metadata, available without loading the plugin body. */
10
- var meta = meta$1;
11
- /** Constructs the plugin; the body loads on first enable. */
12
- var make = Plugin.lazy(meta, () => import("#plugin"));
13
- //#endregion
14
- export { make, meta, ClientPlugin_exports as t };
15
-
16
- //# sourceMappingURL=ClientPlugin.mjs.map
1
+ export { n as make, r as meta } from "./chunk-ClientPlugin.mjs";
@@ -1,99 +1 @@
1
- import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import * as Effect from "effect/Effect";
3
- import { BaseError, isCancellation } from "@dxos/errors";
4
- import * as Duration from "effect/Duration";
5
- import { log } from "@dxos/log";
6
- import * as NativePasskey from "@dxos/app-toolkit/NativePasskey";
7
- //#region src/types/PasskeyError.ts
8
- var PasskeyError_exports = /* @__PURE__ */ __exportAll({
9
- Dismissed: () => Dismissed,
10
- LoginFailed: () => LoginFailed,
11
- NATIVE_PROMPT_TIMEOUT: () => NATIVE_PROMPT_TIMEOUT,
12
- RegistrationFailed: () => RegistrationFailed,
13
- Rejected: () => Rejected,
14
- TimedOut: () => TimedOut,
15
- Unavailable: () => Unavailable,
16
- classify: () => classify,
17
- fromAssertion: () => fromAssertion,
18
- fromRegistration: () => fromRegistration,
19
- report: () => report,
20
- timeoutNativePrompt: () => timeoutNativePrompt
21
- });
22
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-client/src/types/PasskeyError.ts";
23
- /**
24
- * The platform prompt produced no assertion. WebAuthn reports a dismissed prompt and
25
- * "this device has no passkey for this site" identically, so the two cannot be told apart.
26
- */
27
- var Dismissed = class extends BaseError.extend("PasskeyDismissedError", "No passkey was presented") {
28
- /** Marks a dismissal as a cancellation so a generic reporter (the process runtime) can see it too. */
29
- cancellation = true;
30
- };
31
- /** The assertion was refused: the passkey is not registered as a recovery credential for any identity. */
32
- var Rejected = class extends BaseError.extend("PasskeyRejectedError", "Passkey was not accepted") {};
33
- /** Passkey login failed before an assertion could be checked (service unreachable, unusable authenticator response). */
34
- var LoginFailed = class extends BaseError.extend("PasskeyLoginError", "Passkey login failed") {};
35
- /** Creating a passkey failed for a reason other than the user dismissing the prompt. */
36
- var RegistrationFailed = class extends BaseError.extend("PasskeyRegistrationError", "Passkey could not be created") {};
37
- /** The native prompt never answered. The bridge cannot cancel it, so its sheet may still be on screen. */
38
- var TimedOut = class extends BaseError.extend("PasskeyTimedOutError", "The passkey prompt did not respond") {};
39
- /** This host cannot complete a passkey request, so none was started. */
40
- var Unavailable = class extends BaseError.extend("PasskeyUnavailableError", "Passkeys are not available in this build") {};
41
- /** Longest a native prompt may stay unanswered; the WebAuthn ceremony ceiling. */
42
- var NATIVE_PROMPT_TIMEOUT = Duration.minutes(5);
43
- /** Abandon a native passkey call that never answers. */
44
- var timeoutNativePrompt = (effect, duration = NATIVE_PROMPT_TIMEOUT) => Effect.timeoutOrElse(effect, {
45
- duration,
46
- orElse: () => Effect.fail(new TimedOut())
47
- });
48
- /**
49
- * What the macOS bridge rejects with for every `ASAuthorizationError`, a cancel included: it collapses
50
- * each into one plain string per ceremony, so a cancel cannot be told apart from a failure.
51
- */
52
- var NATIVE_BRIDGE_REJECTIONS = ["Registration failed", "Login failed"];
53
- /**
54
- * Whether the authenticator rejected because the prompt was dismissed. WebAuthn reports a dismissed
55
- * prompt and "no credential for this site" as the same `NotAllowedError`; the macOS bridge's generic
56
- * rejections are just as ambiguous, so both read as dismissals.
57
- */
58
- var isDismissal = (error) => {
59
- if (NativePasskey.isNativePasskeyError(error)) return error.cancelled;
60
- const name = error instanceof DOMException ? error.name : void 0;
61
- return name === "NotAllowedError" || name === "AbortError" || NATIVE_BRIDGE_REJECTIONS.includes(String(error)) || /cancell?ed/i.test(String(error));
62
- };
63
- /** Classify a rejection from the authenticator while logging in. */
64
- var fromAssertion = (error) => isDismissal(error) ? new Dismissed({ cause: error }) : new LoginFailed({ cause: error });
65
- /** Classify a rejection from the authenticator while creating a passkey. */
66
- var fromRegistration = (error) => isDismissal(error) ? new Dismissed({ cause: error }) : new RegistrationFailed({ cause: error });
67
- /**
68
- * Classify an error returned by the `RedeemPasskey` or `CreatePasskey` operation.
69
- * Anything unrecognized is reported as a generic failure rather than swallowed.
70
- */
71
- var classify = (error) => {
72
- if (Dismissed.is(error) || isCancellation(error)) return "dismissed";
73
- if (Rejected.is(error)) return "rejected";
74
- return "failed";
75
- };
76
- /**
77
- * Report a failed redemption and classify it for the UI. A dismissed prompt is the user closing a
78
- * dialog, so it reports at `info` — at `error` it swamps the production error stream (DX-1281).
79
- */
80
- var report = (error) => {
81
- const failure = classify(error);
82
- if (failure === "dismissed") log.info("passkey prompt dismissed", { error }, {
83
- "~LogMeta": "~LogMeta",
84
- F: __dxlog_file,
85
- L: 116,
86
- S: void 0
87
- });
88
- else log.catch(error, void 0, {
89
- "~LogMeta": "~LogMeta",
90
- F: __dxlog_file,
91
- L: 118,
92
- S: void 0
93
- });
94
- return failure;
95
- };
96
- //#endregion
97
- export { Dismissed, LoginFailed, NATIVE_PROMPT_TIMEOUT, RegistrationFailed, Rejected, TimedOut, Unavailable, classify, fromAssertion, fromRegistration, report, PasskeyError_exports as t, timeoutNativePrompt };
98
-
99
- //# sourceMappingURL=PasskeyError.mjs.map
1
+ export { t as Dismissed, n as LoginFailed, r as NATIVE_PROMPT_TIMEOUT, a as RegistrationFailed, o as Rejected, s as TimedOut, c as Unavailable, l as classify, u as fromAssertion, d as fromRegistration, f as report, p as timeoutNativePrompt } from "./chunk-PasskeyError.mjs";
@@ -30,7 +30,8 @@ var Client = Capability.lazyModule("Client", {
30
30
  ClientCapabilities.InitializeTimeout,
31
31
  Capabilities.Layer,
32
32
  ClientCapabilities.IdentityService,
33
- ClientCapabilities.SpaceService
33
+ ClientCapabilities.SpaceService,
34
+ AppCapabilities.UnsavedChanges
34
35
  ],
35
36
  environments: [
36
37
  "browser",