@tinycloud/node-sdk 3.7.0-beta.2 → 3.7.0-beta.4

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.
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/encryption-keys.ts
21
+ var encryption_keys_exports = {};
22
+ __export(encryption_keys_exports, {
23
+ NamedKeyClient: () => import_named_keys2.NamedKeyClient,
24
+ NamedKeyError: () => import_named_keys2.NamedKeyError,
25
+ buildKeyAdminFacts: () => import_named_keys2.buildKeyAdminFacts,
26
+ buildKeyDescribeFacts: () => import_named_keys2.buildKeyDescribeFacts,
27
+ createNamedKeyClient: () => createNamedKeyClient
28
+ });
29
+ module.exports = __toCommonJS(encryption_keys_exports);
30
+ var import_named_keys = require("@tinycloud/sdk-services/encryption/named-keys");
31
+ var import_named_keys2 = require("@tinycloud/sdk-services/encryption/named-keys");
32
+ function createNamedKeyClient(node, options = {}) {
33
+ const internals = node;
34
+ for (const hook of ["signRawNetworkAuthorization", "createEncryptionCrypto"]) {
35
+ if (typeof internals[hook] !== "function") {
36
+ throw new import_named_keys.NamedKeyError(
37
+ "NODE_HOOK_MISSING",
38
+ `TinyCloudNode.${hook} is not available; named keys cannot sign invocations`
39
+ );
40
+ }
41
+ }
42
+ const signer = internals;
43
+ const host = node.hosts[0];
44
+ if (host === void 0) throw new Error("TinyCloud node host has not been resolved");
45
+ const config = {
46
+ host,
47
+ crypto: signer.createEncryptionCrypto(),
48
+ fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
49
+ defaultNetworkId: () => options.networkId ?? node.getDefaultEncryptionNetworkId(),
50
+ signInvocation: (input) => signer.signRawNetworkAuthorization({
51
+ targetNode: input.targetNode,
52
+ networkId: input.resource,
53
+ action: input.action,
54
+ facts: input.facts
55
+ }),
56
+ decryptRoot: (envelope) => {
57
+ const delegationCid = node.session?.delegationCid;
58
+ if (delegationCid === void 0) {
59
+ return Promise.reject(new Error("Not signed in. Call signIn() first."));
60
+ }
61
+ return node.encryption.decryptEnvelope(envelope, { proofs: [delegationCid] });
62
+ }
63
+ };
64
+ return new import_named_keys.NamedKeyClient(config);
65
+ }
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ NamedKeyClient,
69
+ NamedKeyError,
70
+ buildKeyAdminFacts,
71
+ buildKeyDescribeFacts,
72
+ createNamedKeyClient
73
+ });
74
+ //# sourceMappingURL=encryption-keys.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/encryption-keys.ts"],"sourcesContent":["/**\n * Named encryption keys for a signed-in {@link TinyCloudNode}.\n *\n * Lives on its own subpath (`@tinycloud/node-sdk/encryption-keys`) so the\n * default root bundle does not carry it. Everything is dark unless the node's\n * `/info` `features` lists `encryption-named-keys-v1`; see the client in\n * `@tinycloud/sdk-services/encryption/named-keys` for the rules.\n *\n * The client signs through the node's existing raw-resource invocation path\n * (the same one network admin and decrypt use) and reuses its encryption\n * crypto, so both are reached through a narrow structural view of the node.\n */\n\nimport {\n NamedKeyClient,\n NamedKeyError,\n type NamedKeyClientConfig,\n} from \"@tinycloud/sdk-services/encryption/named-keys\";\nimport type { EncryptionCrypto } from \"@tinycloud/sdk-services\";\nimport type { TinyCloudNode } from \"./TinyCloudNode\";\n\nexport {\n NamedKeyClient,\n NamedKeyError,\n buildKeyAdminFacts,\n buildKeyDescribeFacts,\n type DecryptManyResult,\n type KeyCallOptions,\n type KeyDescriptor,\n type KeyEncryptOptions,\n type NamedKeyEnvelope,\n type NamedKeyErrorCode,\n type PublicKeyDescriptor,\n} from \"@tinycloud/sdk-services/encryption/named-keys\";\n\ninterface NodeSigningInternals {\n signRawNetworkAuthorization(input: {\n targetNode: string;\n networkId: string;\n action: string;\n facts: object;\n }): Promise<{ authorization: string; invocationCid: string }>;\n createEncryptionCrypto(): EncryptionCrypto;\n}\n\nexport interface CreateNamedKeyClientOptions {\n /** Network used when a call does not name one. Defaults to the node's default network. */\n networkId?: string;\n /** Override `fetch` (tests). */\n fetch?: typeof fetch;\n}\n\n/**\n * Build a named-key client bound to a signed-in node.\n *\n * `signInvocation` passes the EXACT key URN as the invocation's single\n * resource (the signer's `networkId` argument is the capability `with`); the\n * real network id travels in the facts.\n */\nexport function createNamedKeyClient(\n node: TinyCloudNode,\n options: CreateNamedKeyClientOptions = {},\n): NamedKeyClient {\n const internals = node as unknown as Partial<NodeSigningInternals>;\n for (const hook of [\"signRawNetworkAuthorization\", \"createEncryptionCrypto\"] as const) {\n if (typeof internals[hook] !== \"function\") {\n throw new NamedKeyError(\n \"NODE_HOOK_MISSING\",\n `TinyCloudNode.${hook} is not available; named keys cannot sign invocations`,\n );\n }\n }\n const signer = internals as NodeSigningInternals;\n const host = node.hosts[0];\n if (host === undefined) throw new Error(\"TinyCloud node host has not been resolved\");\n const config: NamedKeyClientConfig = {\n host,\n crypto: signer.createEncryptionCrypto(),\n fetch: options.fetch ?? globalThis.fetch.bind(globalThis),\n defaultNetworkId: () => options.networkId ?? node.getDefaultEncryptionNetworkId(),\n signInvocation: (input) =>\n signer.signRawNetworkAuthorization({\n targetNode: input.targetNode,\n networkId: input.resource,\n action: input.action,\n facts: input.facts,\n }),\n decryptRoot: (envelope) => {\n const delegationCid = node.session?.delegationCid;\n if (delegationCid === undefined) {\n return Promise.reject(new Error(\"Not signed in. Call signIn() first.\"));\n }\n return node.encryption.decryptEnvelope(envelope, { proofs: [delegationCid] });\n },\n };\n return new NamedKeyClient(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,wBAIO;AAIP,IAAAA,qBAYO;AA0BA,SAAS,qBACd,MACA,UAAuC,CAAC,GACxB;AAChB,QAAM,YAAY;AAClB,aAAW,QAAQ,CAAC,+BAA+B,wBAAwB,GAAY;AACrF,QAAI,OAAO,UAAU,IAAI,MAAM,YAAY;AACzC,YAAM,IAAI;AAAA,QACR;AAAA,QACA,iBAAiB,IAAI;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS;AACf,QAAM,OAAO,KAAK,MAAM,CAAC;AACzB,MAAI,SAAS,OAAW,OAAM,IAAI,MAAM,2CAA2C;AACnF,QAAM,SAA+B;AAAA,IACnC;AAAA,IACA,QAAQ,OAAO,uBAAuB;AAAA,IACtC,OAAO,QAAQ,SAAS,WAAW,MAAM,KAAK,UAAU;AAAA,IACxD,kBAAkB,MAAM,QAAQ,aAAa,KAAK,8BAA8B;AAAA,IAChF,gBAAgB,CAAC,UACf,OAAO,4BAA4B;AAAA,MACjC,YAAY,MAAM;AAAA,MAClB,WAAW,MAAM;AAAA,MACjB,QAAQ,MAAM;AAAA,MACd,OAAO,MAAM;AAAA,IACf,CAAC;AAAA,IACH,aAAa,CAAC,aAAa;AACzB,YAAM,gBAAgB,KAAK,SAAS;AACpC,UAAI,kBAAkB,QAAW;AAC/B,eAAO,QAAQ,OAAO,IAAI,MAAM,qCAAqC,CAAC;AAAA,MACxE;AACA,aAAO,KAAK,WAAW,gBAAgB,UAAU,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC;AAAA,IAC9E;AAAA,EACF;AACA,SAAO,IAAI,iCAAe,MAAM;AAClC;","names":["import_named_keys"]}
@@ -0,0 +1,38 @@
1
+ import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
2
+ export { DecryptManyResult, KeyCallOptions, KeyDescriptor, KeyEncryptOptions, NamedKeyClient, NamedKeyEnvelope, NamedKeyError, NamedKeyErrorCode, PublicKeyDescriptor, buildKeyAdminFacts, buildKeyDescribeFacts } from '@tinycloud/sdk-services/encryption/named-keys';
3
+ import { T as TinyCloudNode } from './TinyCloudNode-DD7qjyLU.cjs';
4
+ import '@tinycloud/sdk-core';
5
+ import '@tinycloud/sdk-services/kv/replication';
6
+ import '@tinycloud/sdk-services';
7
+ import 'events';
8
+ import './delegation-0LKZkmP2.cjs';
9
+
10
+ /**
11
+ * Named encryption keys for a signed-in {@link TinyCloudNode}.
12
+ *
13
+ * Lives on its own subpath (`@tinycloud/node-sdk/encryption-keys`) so the
14
+ * default root bundle does not carry it. Everything is dark unless the node's
15
+ * `/info` `features` lists `encryption-named-keys-v1`; see the client in
16
+ * `@tinycloud/sdk-services/encryption/named-keys` for the rules.
17
+ *
18
+ * The client signs through the node's existing raw-resource invocation path
19
+ * (the same one network admin and decrypt use) and reuses its encryption
20
+ * crypto, so both are reached through a narrow structural view of the node.
21
+ */
22
+
23
+ interface CreateNamedKeyClientOptions {
24
+ /** Network used when a call does not name one. Defaults to the node's default network. */
25
+ networkId?: string;
26
+ /** Override `fetch` (tests). */
27
+ fetch?: typeof fetch;
28
+ }
29
+ /**
30
+ * Build a named-key client bound to a signed-in node.
31
+ *
32
+ * `signInvocation` passes the EXACT key URN as the invocation's single
33
+ * resource (the signer's `networkId` argument is the capability `with`); the
34
+ * real network id travels in the facts.
35
+ */
36
+ declare function createNamedKeyClient(node: TinyCloudNode, options?: CreateNamedKeyClientOptions): NamedKeyClient;
37
+
38
+ export { type CreateNamedKeyClientOptions, createNamedKeyClient };
@@ -0,0 +1,38 @@
1
+ import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
2
+ export { DecryptManyResult, KeyCallOptions, KeyDescriptor, KeyEncryptOptions, NamedKeyClient, NamedKeyEnvelope, NamedKeyError, NamedKeyErrorCode, PublicKeyDescriptor, buildKeyAdminFacts, buildKeyDescribeFacts } from '@tinycloud/sdk-services/encryption/named-keys';
3
+ import { T as TinyCloudNode } from './TinyCloudNode-Cw00iiSP.js';
4
+ import '@tinycloud/sdk-core';
5
+ import '@tinycloud/sdk-services/kv/replication';
6
+ import '@tinycloud/sdk-services';
7
+ import 'events';
8
+ import './delegation-0LKZkmP2.js';
9
+
10
+ /**
11
+ * Named encryption keys for a signed-in {@link TinyCloudNode}.
12
+ *
13
+ * Lives on its own subpath (`@tinycloud/node-sdk/encryption-keys`) so the
14
+ * default root bundle does not carry it. Everything is dark unless the node's
15
+ * `/info` `features` lists `encryption-named-keys-v1`; see the client in
16
+ * `@tinycloud/sdk-services/encryption/named-keys` for the rules.
17
+ *
18
+ * The client signs through the node's existing raw-resource invocation path
19
+ * (the same one network admin and decrypt use) and reuses its encryption
20
+ * crypto, so both are reached through a narrow structural view of the node.
21
+ */
22
+
23
+ interface CreateNamedKeyClientOptions {
24
+ /** Network used when a call does not name one. Defaults to the node's default network. */
25
+ networkId?: string;
26
+ /** Override `fetch` (tests). */
27
+ fetch?: typeof fetch;
28
+ }
29
+ /**
30
+ * Build a named-key client bound to a signed-in node.
31
+ *
32
+ * `signInvocation` passes the EXACT key URN as the invocation's single
33
+ * resource (the signer's `networkId` argument is the capability `with`); the
34
+ * real network id travels in the facts.
35
+ */
36
+ declare function createNamedKeyClient(node: TinyCloudNode, options?: CreateNamedKeyClientOptions): NamedKeyClient;
37
+
38
+ export { type CreateNamedKeyClientOptions, createNamedKeyClient };
@@ -0,0 +1,53 @@
1
+ // src/encryption-keys.ts
2
+ import {
3
+ NamedKeyClient,
4
+ NamedKeyError
5
+ } from "@tinycloud/sdk-services/encryption/named-keys";
6
+ import {
7
+ NamedKeyClient as NamedKeyClient2,
8
+ NamedKeyError as NamedKeyError2,
9
+ buildKeyAdminFacts,
10
+ buildKeyDescribeFacts
11
+ } from "@tinycloud/sdk-services/encryption/named-keys";
12
+ function createNamedKeyClient(node, options = {}) {
13
+ const internals = node;
14
+ for (const hook of ["signRawNetworkAuthorization", "createEncryptionCrypto"]) {
15
+ if (typeof internals[hook] !== "function") {
16
+ throw new NamedKeyError(
17
+ "NODE_HOOK_MISSING",
18
+ `TinyCloudNode.${hook} is not available; named keys cannot sign invocations`
19
+ );
20
+ }
21
+ }
22
+ const signer = internals;
23
+ const host = node.hosts[0];
24
+ if (host === void 0) throw new Error("TinyCloud node host has not been resolved");
25
+ const config = {
26
+ host,
27
+ crypto: signer.createEncryptionCrypto(),
28
+ fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
29
+ defaultNetworkId: () => options.networkId ?? node.getDefaultEncryptionNetworkId(),
30
+ signInvocation: (input) => signer.signRawNetworkAuthorization({
31
+ targetNode: input.targetNode,
32
+ networkId: input.resource,
33
+ action: input.action,
34
+ facts: input.facts
35
+ }),
36
+ decryptRoot: (envelope) => {
37
+ const delegationCid = node.session?.delegationCid;
38
+ if (delegationCid === void 0) {
39
+ return Promise.reject(new Error("Not signed in. Call signIn() first."));
40
+ }
41
+ return node.encryption.decryptEnvelope(envelope, { proofs: [delegationCid] });
42
+ }
43
+ };
44
+ return new NamedKeyClient(config);
45
+ }
46
+ export {
47
+ NamedKeyClient2 as NamedKeyClient,
48
+ NamedKeyError2 as NamedKeyError,
49
+ buildKeyAdminFacts,
50
+ buildKeyDescribeFacts,
51
+ createNamedKeyClient
52
+ };
53
+ //# sourceMappingURL=encryption-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/encryption-keys.ts"],"sourcesContent":["/**\n * Named encryption keys for a signed-in {@link TinyCloudNode}.\n *\n * Lives on its own subpath (`@tinycloud/node-sdk/encryption-keys`) so the\n * default root bundle does not carry it. Everything is dark unless the node's\n * `/info` `features` lists `encryption-named-keys-v1`; see the client in\n * `@tinycloud/sdk-services/encryption/named-keys` for the rules.\n *\n * The client signs through the node's existing raw-resource invocation path\n * (the same one network admin and decrypt use) and reuses its encryption\n * crypto, so both are reached through a narrow structural view of the node.\n */\n\nimport {\n NamedKeyClient,\n NamedKeyError,\n type NamedKeyClientConfig,\n} from \"@tinycloud/sdk-services/encryption/named-keys\";\nimport type { EncryptionCrypto } from \"@tinycloud/sdk-services\";\nimport type { TinyCloudNode } from \"./TinyCloudNode\";\n\nexport {\n NamedKeyClient,\n NamedKeyError,\n buildKeyAdminFacts,\n buildKeyDescribeFacts,\n type DecryptManyResult,\n type KeyCallOptions,\n type KeyDescriptor,\n type KeyEncryptOptions,\n type NamedKeyEnvelope,\n type NamedKeyErrorCode,\n type PublicKeyDescriptor,\n} from \"@tinycloud/sdk-services/encryption/named-keys\";\n\ninterface NodeSigningInternals {\n signRawNetworkAuthorization(input: {\n targetNode: string;\n networkId: string;\n action: string;\n facts: object;\n }): Promise<{ authorization: string; invocationCid: string }>;\n createEncryptionCrypto(): EncryptionCrypto;\n}\n\nexport interface CreateNamedKeyClientOptions {\n /** Network used when a call does not name one. Defaults to the node's default network. */\n networkId?: string;\n /** Override `fetch` (tests). */\n fetch?: typeof fetch;\n}\n\n/**\n * Build a named-key client bound to a signed-in node.\n *\n * `signInvocation` passes the EXACT key URN as the invocation's single\n * resource (the signer's `networkId` argument is the capability `with`); the\n * real network id travels in the facts.\n */\nexport function createNamedKeyClient(\n node: TinyCloudNode,\n options: CreateNamedKeyClientOptions = {},\n): NamedKeyClient {\n const internals = node as unknown as Partial<NodeSigningInternals>;\n for (const hook of [\"signRawNetworkAuthorization\", \"createEncryptionCrypto\"] as const) {\n if (typeof internals[hook] !== \"function\") {\n throw new NamedKeyError(\n \"NODE_HOOK_MISSING\",\n `TinyCloudNode.${hook} is not available; named keys cannot sign invocations`,\n );\n }\n }\n const signer = internals as NodeSigningInternals;\n const host = node.hosts[0];\n if (host === undefined) throw new Error(\"TinyCloud node host has not been resolved\");\n const config: NamedKeyClientConfig = {\n host,\n crypto: signer.createEncryptionCrypto(),\n fetch: options.fetch ?? globalThis.fetch.bind(globalThis),\n defaultNetworkId: () => options.networkId ?? node.getDefaultEncryptionNetworkId(),\n signInvocation: (input) =>\n signer.signRawNetworkAuthorization({\n targetNode: input.targetNode,\n networkId: input.resource,\n action: input.action,\n facts: input.facts,\n }),\n decryptRoot: (envelope) => {\n const delegationCid = node.session?.delegationCid;\n if (delegationCid === undefined) {\n return Promise.reject(new Error(\"Not signed in. Call signIn() first.\"));\n }\n return node.encryption.decryptEnvelope(envelope, { proofs: [delegationCid] });\n },\n };\n return new NamedKeyClient(config);\n}\n"],"mappings":";AAaA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAIP;AAAA,EACE,kBAAAA;AAAA,EACA,iBAAAC;AAAA,EACA;AAAA,EACA;AAAA,OAQK;AA0BA,SAAS,qBACd,MACA,UAAuC,CAAC,GACxB;AAChB,QAAM,YAAY;AAClB,aAAW,QAAQ,CAAC,+BAA+B,wBAAwB,GAAY;AACrF,QAAI,OAAO,UAAU,IAAI,MAAM,YAAY;AACzC,YAAM,IAAI;AAAA,QACR;AAAA,QACA,iBAAiB,IAAI;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS;AACf,QAAM,OAAO,KAAK,MAAM,CAAC;AACzB,MAAI,SAAS,OAAW,OAAM,IAAI,MAAM,2CAA2C;AACnF,QAAM,SAA+B;AAAA,IACnC;AAAA,IACA,QAAQ,OAAO,uBAAuB;AAAA,IACtC,OAAO,QAAQ,SAAS,WAAW,MAAM,KAAK,UAAU;AAAA,IACxD,kBAAkB,MAAM,QAAQ,aAAa,KAAK,8BAA8B;AAAA,IAChF,gBAAgB,CAAC,UACf,OAAO,4BAA4B;AAAA,MACjC,YAAY,MAAM;AAAA,MAClB,WAAW,MAAM;AAAA,MACjB,QAAQ,MAAM;AAAA,MACd,OAAO,MAAM;AAAA,IACf,CAAC;AAAA,IACH,aAAa,CAAC,aAAa;AACzB,YAAM,gBAAgB,KAAK,SAAS;AACpC,UAAI,kBAAkB,QAAW;AAC/B,eAAO,QAAQ,OAAO,IAAI,MAAM,qCAAqC,CAAC;AAAA,MACxE;AACA,aAAO,KAAK,WAAW,gBAAgB,UAAU,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC;AAAA,IAC9E;AAAA,EACF;AACA,SAAO,IAAI,eAAe,MAAM;AAClC;","names":["NamedKeyClient","NamedKeyError"]}
package/dist/index.cjs CHANGED
@@ -21681,7 +21681,10 @@ var _TinyCloudNode = class _TinyCloudNode {
21681
21681
  * and remembers whose storage is full so sign-in and listing skip their
21682
21682
  * best-effort writes. Lives as long as this instance, across sign-ins.
21683
21683
  */
21684
- this.storageFull = new import_sdk_core10.StorageFullMonitor((spaceId) => spaceOwnerKey(spaceId) ?? spaceId);
21684
+ this.storageFull = new import_sdk_core10.StorageFullMonitor(
21685
+ (spaceId) => spaceOwnerKey(spaceId) ?? spaceId,
21686
+ () => this.currentStorageOwner()
21687
+ );
21685
21688
  this.invokeWithRuntimePermissions = (session, service, path, action, facts) => {
21686
21689
  const operation = {
21687
21690
  spaceId: session.spaceId,
@@ -21837,12 +21840,15 @@ var _TinyCloudNode = class _TinyCloudNode {
21837
21840
  return this._bootstrapStatus;
21838
21841
  }
21839
21842
  /**
21840
- * Subscribe to `storage.full`. It fires once, on the first write any
21841
- * service had rejected because the owner's TinyCloud storage is full
21843
+ * Subscribe to `storage.full`. It fires on the first write any service had
21844
+ * rejected because the owner's TinyCloud storage is full
21842
21845
  * (`STORAGE_QUOTA_EXCEEDED` or `STORAGE_LIMIT_REACHED`), so an app can show
21843
- * one read-only banner. Reads keep working. It fires again only after
21844
- * `storage.status()` has reported space again for every owner whose write
21845
- * was rejected. Returns the unsubscribe function.
21846
+ * one read-only banner. Reads keep working. For the signed-in account's own
21847
+ * storage it fires once per episode: the episode ends only when a write to
21848
+ * that storage succeeds, or on sign-out. A `storage.status()` read does not
21849
+ * end it. A rejection on another owner's delegated space fires once per
21850
+ * owner, until that owner's `storage.status()` reports space again. Returns
21851
+ * the unsubscribe function.
21846
21852
  */
21847
21853
  on(event, handler) {
21848
21854
  if (event !== "storage.full") {
@@ -21850,6 +21856,21 @@ var _TinyCloudNode = class _TinyCloudNode {
21850
21856
  }
21851
21857
  return this.storageFull.on(handler);
21852
21858
  }
21859
+ /**
21860
+ * Storage episode state for the UI mount. @internal
21861
+ *
21862
+ * `current()` returns the own-storage rejection that started the episode, or
21863
+ * undefined. `subscribe` calls its listener when the own episode starts or
21864
+ * ends; read `current()` inside it. `subscribeDelegated` calls its listener
21865
+ * once per delegated owner found full, until that owner is cleared.
21866
+ */
21867
+ get storageEpisode() {
21868
+ return {
21869
+ current: () => this.storageFull.rejection,
21870
+ subscribe: (listener) => this.storageFull.onEpisode(listener),
21871
+ subscribeDelegated: (listener) => this.storageFull.onDelegated(listener)
21872
+ };
21873
+ }
21853
21874
  /** Owner key of the account the current session's own storage belongs to. */
21854
21875
  currentStorageOwner() {
21855
21876
  return spaceOwnerKey(this._serviceContext?.session?.spaceId ?? this.currentTinyCloudSession()?.spaceId);