@tinycloud/web-sdk 3.17.0 → 3.19.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.
@@ -58,6 +58,10 @@ export interface EnsureOwnerRegistryRecordOptions {
58
58
  * `"needs-one"` before anything is signed.
59
59
  * 3. The record's node identity comes only from `node.activeNodeIdentity()`, never from
60
60
  * caller input: a signed record pointing at the wrong node is the real attacker gain.
61
+ * The record lists every account space (`BOOTSTRAP_SPACE_NAMES`, as OpenKey's account
62
+ * setup does) plus `node.spaceId`, all on that node, and names it as the encryption
63
+ * node. The router treats a record as complete: a space it leaves out, or a null
64
+ * encryption node, stops routing for that owner.
61
65
  * 4. An existing record is never overwritten or merged. `publishLocationRecordV2`'s
62
66
  * pre-sign re-read refuses the publish if a record has appeared since the verdict.
63
67
  * 5. `assertCurrent` runs after each await here and last in `onPrepared`, before the
@@ -68,5 +72,44 @@ export interface EnsureOwnerRegistryRecordOptions {
68
72
  * swallowed and funnelled through `onError`; this never throws.
69
73
  */
70
74
  export declare function ensureOwnerRegistryRecord(options: EnsureOwnerRegistryRecordOptions): Promise<RegistryPublishOutcome>;
75
+ /** What the owner's verified v2 record holds. Returned by `tcw.inspectOwnerRegistryRecord`. */
76
+ export type OwnerRegistryRecordState = "complete" | "incomplete" | "absent" | "unavailable";
77
+ /** Outcome of `tcw.repairOwnerRegistryRecord`. */
78
+ export type RegistryRepairOutcome = "repaired" | "already-complete" | "absent" | "needs-one" | "unavailable";
79
+ export type InspectOwnerRegistryRecordOptions = Pick<EnsureOwnerRegistryRecordOptions, "subject" | "registryUrl" | "registryChainId" | "registrySequenceStore" | "registryCacheStore" | "registryVerdictCache" | "onError" | "assertCurrent" | "fetch">;
80
+ type RecordNode = {
81
+ did: string;
82
+ url: string;
83
+ };
84
+ /**
85
+ * Read-only: the state of the owner's verified v2 record. Never signs or writes. Errors are
86
+ * reported through `onError` and return `"unavailable"`; this never throws.
87
+ */
88
+ export declare function inspectOwnerRegistryRecord(options: InspectOwnerRegistryRecordOptions): Promise<OwnerRegistryRecordState>;
89
+ /**
90
+ * True when `proposed` is exactly `current` plus the planned additions: every node, space
91
+ * membership and the encryption node of `current` unchanged; the only new things are `node`
92
+ * (if the record did not name it), the `added` spaces read-write on `node` only, and the
93
+ * encryption node when `current` had none; the sequence is the next one.
94
+ */
95
+ export declare function isRepairSuperset(proposed: Readonly<LocationRecordV2Payload>, current: Readonly<LocationRecordV2Payload>, node: RecordNode, added: readonly string[]): boolean;
96
+ /**
97
+ * Called by `tcw.repairOwnerRegistryRecord`. Completes an existing record; never creates one.
98
+ *
99
+ * 1. The record is inspected first: `"absent"`, `"already-complete"` or `"unavailable"` return
100
+ * without a signature.
101
+ * 2. An origin outside `REGISTRY_PUBLISH_ORIGINS` returns `"needs-one"` before anything is
102
+ * signed; OpenKey's sign refusal also maps to `"needs-one"`.
103
+ * 3. The node added to is the record's only node, or the active node when the record already
104
+ * names it with the same URL. Anything else is ambiguous: `"unavailable"`.
105
+ * 4. Only additions: each missing account space read-write on that node, and that node as the
106
+ * encryption node when the record has none. Existing memberships, nodes and the encryption
107
+ * node are never removed or changed.
108
+ * 5. `onPrepared` checks that the registry's live record is the one inspected and that the
109
+ * merged record is exactly it plus the planned additions with the next sequence; otherwise
110
+ * nothing is signed and the call returns `"unavailable"`.
111
+ * 6. `assertCurrent` guards as in `ensureOwnerRegistryRecord`. Never throws.
112
+ */
113
+ export declare function repairOwnerRegistryRecord(options: EnsureOwnerRegistryRecordOptions): Promise<RegistryRepairOutcome>;
71
114
  export type { LocationRecordV2, LocationRecordV2Payload };
72
115
  //# sourceMappingURL=registry-publish.d.ts.map
@@ -20,7 +20,7 @@ export interface ToastRegion {
20
20
  clearReceipts(): void;
21
21
  dispose(): void;
22
22
  }
23
- export declare const TOAST_REGION_CSS = "\n.tstack{position:fixed;bottom:calc(var(--b) + 56px);display:flex;flex-direction:column;gap:10px;width:min(400px,calc(100vw - 24px));pointer-events:none}\n.layer[data-position=\"bottom-right\"] .tstack{right:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-left\"] .tstack{left:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-center\"] .tstack{left:50%;transform:translateX(-50%)}\n.layer[data-panel-open][data-layout=\"drawer\"] .tstack{bottom:12px;width:min(396px,calc(100vw - 24px))}\n.layer[data-panel-open][data-layout=\"drawer\"][data-position=\"bottom-right\"] .tstack{right:12px}\n.layer[data-panel-open][data-layout=\"drawer\"][data-position=\"bottom-left\"] .tstack{left:12px}\n.layer[data-panel-open][data-layout=\"page\"] .tstack{bottom:24px;right:24px;left:auto;transform:none;width:min(420px,calc(100vw - 32px))}\n.layer[data-phone][data-panel-open] .tstack{bottom:calc(var(--b));left:12px;right:12px;transform:none;width:auto}\n.tstack>div{display:contents}\n.tstack .toast{display:flex;align-items:flex-start;gap:12px;box-sizing:border-box;padding:14px 8px 14px 16px;border:0;border-radius:16px;background:#fff;color:#111827;box-shadow:0 12px 32px -8px rgba(0,0,0,.3),0 0 0 1px #a1a1aa;pointer-events:auto;animation:tc-toast-in .45s cubic-bezier(.22,1,.36,1)}\n.tstack .toast__icon{display:inline-flex;flex:none;margin-top:12px}\n.tstack .toast__icon .ui-ic{width:20px;height:20px}\n.tstack .toast__body{flex:1;min-width:0;padding-top:12px;overflow-wrap:anywhere}\n.tstack .toast__title{display:block;font-weight:700}\n.tstack .toast a,.tstack .toast__copy{display:inline-flex;align-items:center;min-height:44px;margin-top:2px;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;text-decoration:underline;text-underline-offset:3px;white-space:nowrap;cursor:pointer}\n.tstack .toast__close{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.tstack .toast__close .ui-ic{width:20px;height:20px}\n.tstack .slip{margin-top:8px;padding:8px 0;border-top:2px dashed #71717a;border-bottom:2px dashed #71717a;font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,Consolas,\"Liberation Mono\",monospace;overflow-wrap:anywhere}\n.tstack .slip>div{display:block}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n@keyframes tc-toast-in{from{opacity:0;transform:translateY(14px)}}\n@media (prefers-reduced-motion:reduce){\n.tstack .toast{animation:none}\n}\n@media (prefers-color-scheme: dark){\n.tstack .toast{background:#151517;color:#fafafa;box-shadow:0 12px 32px -8px rgba(0,0,0,.6),0 0 0 1px #69696b}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n}\n";
23
+ export declare const TOAST_REGION_CSS = "\n.tstack{position:fixed;bottom:calc(var(--b) + 56px);display:flex;flex-direction:column;gap:10px;width:min(400px,calc(100vw - 24px));pointer-events:none}\n.layer[data-position=\"bottom-right\"] .tstack{right:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-left\"] .tstack{left:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-center\"] .tstack{left:50%;transform:translateX(-50%)}\n.layer[data-panel-open][data-layout=\"drawer\"] .tstack{bottom:12px;width:min(396px,calc(100vw - 24px))}\n.layer[data-panel-open][data-layout=\"drawer\"][data-position=\"bottom-right\"] .tstack{right:12px}\n.layer[data-panel-open][data-layout=\"drawer\"][data-position=\"bottom-left\"] .tstack{left:12px}\n.layer[data-panel-open][data-layout=\"page\"] .tstack{bottom:24px;right:24px;left:auto;transform:none;width:min(420px,calc(100vw - 32px))}\n.layer[data-phone][data-panel-open] .tstack{bottom:calc(var(--b));left:12px;right:12px;transform:none;width:auto}\n.tstack>div{display:contents}\n.tstack .toast{display:flex;align-items:flex-start;gap:12px;box-sizing:border-box;padding:14px 8px 14px 16px;border:0;border-radius:16px;background:#fff;color:#111827;box-shadow:0 12px 32px -8px rgba(0,0,0,.3),0 0 0 1px #a1a1aa;pointer-events:auto;animation:tc-toast-in .45s cubic-bezier(.22,1,.36,1)}\n.tstack .toast__icon{display:inline-flex;flex:none;margin-top:12px}\n.tstack .toast__icon .ui-ic{width:20px;height:20px}\n.tstack .toast__body{flex:1;min-width:0;padding-top:12px;overflow-wrap:anywhere}\n.tstack .toast__title{display:block;font-weight:700}\n.tstack .toast a,.tstack .toast__copy,.tstack .toast__action{display:inline-flex;align-items:center;min-height:44px;margin-top:2px;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;text-decoration:underline;text-underline-offset:3px;white-space:nowrap;cursor:pointer}\n.tstack .toast__close{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.tstack .toast__close .ui-ic{width:20px;height:20px}\n.tstack .slip{margin-top:8px;padding:8px 0;border-top:2px dashed #71717a;border-bottom:2px dashed #71717a;font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,Consolas,\"Liberation Mono\",monospace;overflow-wrap:anywhere}\n.tstack .slip>div{display:block}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible,.toast__action:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n@keyframes tc-toast-in{from{opacity:0;transform:translateY(14px)}}\n@media (prefers-reduced-motion:reduce){\n.tstack .toast{animation:none}\n}\n@media (prefers-color-scheme: dark){\n.tstack .toast{background:#151517;color:#fafafa;box-shadow:0 12px 32px -8px rgba(0,0,0,.6),0 0 0 1px #69696b}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible,.toast__action:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n}\n";
24
24
  /**
25
25
  * Appends the region to `layer`, after the panel's slot, so it paints over the panel. `store` is the shared toast store; `toast`
26
26
  * pushes a plain toast (used to confirm a copy) and honors `ui.toasts`.
@@ -55,6 +55,8 @@ export declare const STRINGS: {
55
55
  readonly "sync.reason.unknown": "Something went wrong with the local copy.";
56
56
  readonly "toast.done": "Done";
57
57
  readonly "toast.signed_in": "Successfully signed in";
58
+ readonly "toast.account_setup_pending": "Finish setting up your TinyCloud account";
59
+ readonly "toast.account_setup_action": "Set up";
58
60
  readonly "toast.attention": "Something needs your attention. Details are in the console.";
59
61
  readonly "toast.error_generic": "Something went wrong.";
60
62
  readonly "toast.unexpected_error": "An unexpected error occurred. Try refreshing the page.";
@@ -3,12 +3,19 @@
3
3
  * subscribes and renders. Text is a strings.ts code, never raw text.
4
4
  */
5
5
  export type ToastKind = "info" | "success" | "warning" | "error";
6
+ /** A button in the toast. Clicking it dismisses the toast, then calls `run` in the click's tick (a popup it opens is not blocked). */
7
+ export interface ToastAction {
8
+ readonly labelCode: string;
9
+ readonly run: () => void;
10
+ }
6
11
  export interface ToastRequest {
7
12
  readonly kind: ToastKind;
8
13
  /** A launcher code, or a panel or section code when the panel raises the toast. Unknown codes render the neutral line. */
9
14
  readonly textCode: string;
10
15
  readonly href?: string;
11
16
  readonly hrefLabelCode?: string;
17
+ /** A toast with an action stays until it is clicked or closed; it never auto-dismisses. */
18
+ readonly action?: ToastAction;
12
19
  }
13
20
  /** Delivers a toast to the page's host. Returns false when nothing was shown. */
14
21
  export type ToastSink = (request: ToastRequest) => boolean;
@@ -19,6 +26,7 @@ export interface ToastView {
19
26
  /** Present only when it is an absolute https URL. */
20
27
  readonly href?: string;
21
28
  readonly hrefLabelCode?: string;
29
+ readonly action?: ToastAction;
22
30
  }
23
31
  export interface ToastStoreOptions {
24
32
  /** Auto-dismiss delay per toast. Default 7000. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinycloud/web-sdk",
3
- "version": "3.17.0",
3
+ "version": "3.19.0",
4
4
  "description": "A set of tools and utilities to help you build your app with TinyCloud.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -68,11 +68,11 @@
68
68
  "@multiformats/multiaddr": "^13.0.1",
69
69
  "@multiformats/multiaddr-to-uri": "^12.0.0",
70
70
  "@noble/curves": "^1.9.7",
71
- "@tinycloud/node-sdk": "3.16.1",
71
+ "@tinycloud/node-sdk": "3.18.1",
72
72
  "@tinycloud/replica": "0.4.8",
73
- "@tinycloud/sdk-core": "3.15.0",
73
+ "@tinycloud/sdk-core": "3.18.1",
74
74
  "@tinycloud/share-envelope": "1.7.0",
75
- "@tinycloud/share-sdk": "1.6.0",
75
+ "@tinycloud/share-sdk": "1.7.0",
76
76
  "@tinycloud/web-sdk-wasm": "1.8.0",
77
77
  "axios": "^1.7.9",
78
78
  "viem": "^2.45.0",