@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.
@@ -1400,14 +1400,30 @@ declare class TinyCloudNode {
1400
1400
  */
1401
1401
  private readonly storageFull;
1402
1402
  /**
1403
- * Subscribe to `storage.full`. It fires once, on the first write any
1404
- * service had rejected because the owner's TinyCloud storage is full
1403
+ * Subscribe to `storage.full`. It fires on the first write any service had
1404
+ * rejected because the owner's TinyCloud storage is full
1405
1405
  * (`STORAGE_QUOTA_EXCEEDED` or `STORAGE_LIMIT_REACHED`), so an app can show
1406
- * one read-only banner. Reads keep working. It fires again only after
1407
- * `storage.status()` has reported space again for every owner whose write
1408
- * was rejected. Returns the unsubscribe function.
1406
+ * one read-only banner. Reads keep working. For the signed-in account's own
1407
+ * storage it fires once per episode: the episode ends only when a write to
1408
+ * that storage succeeds, or on sign-out. A `storage.status()` read does not
1409
+ * end it. A rejection on another owner's delegated space fires once per
1410
+ * owner, until that owner's `storage.status()` reports space again. Returns
1411
+ * the unsubscribe function.
1409
1412
  */
1410
1413
  on(event: "storage.full", handler: (event: StorageFullEvent) => void): () => void;
1414
+ /**
1415
+ * Storage episode state for the UI mount. @internal
1416
+ *
1417
+ * `current()` returns the own-storage rejection that started the episode, or
1418
+ * undefined. `subscribe` calls its listener when the own episode starts or
1419
+ * ends; read `current()` inside it. `subscribeDelegated` calls its listener
1420
+ * once per delegated owner found full, until that owner is cleared.
1421
+ */
1422
+ get storageEpisode(): {
1423
+ current(): StorageFullEvent | undefined;
1424
+ subscribe(listener: () => void): () => void;
1425
+ subscribeDelegated(listener: () => void): () => void;
1426
+ };
1411
1427
  /** Owner key of the account the current session's own storage belongs to. */
1412
1428
  private currentStorageOwner;
1413
1429
  /**
@@ -1400,14 +1400,30 @@ declare class TinyCloudNode {
1400
1400
  */
1401
1401
  private readonly storageFull;
1402
1402
  /**
1403
- * Subscribe to `storage.full`. It fires once, on the first write any
1404
- * service had rejected because the owner's TinyCloud storage is full
1403
+ * Subscribe to `storage.full`. It fires on the first write any service had
1404
+ * rejected because the owner's TinyCloud storage is full
1405
1405
  * (`STORAGE_QUOTA_EXCEEDED` or `STORAGE_LIMIT_REACHED`), so an app can show
1406
- * one read-only banner. Reads keep working. It fires again only after
1407
- * `storage.status()` has reported space again for every owner whose write
1408
- * was rejected. Returns the unsubscribe function.
1406
+ * one read-only banner. Reads keep working. For the signed-in account's own
1407
+ * storage it fires once per episode: the episode ends only when a write to
1408
+ * that storage succeeds, or on sign-out. A `storage.status()` read does not
1409
+ * end it. A rejection on another owner's delegated space fires once per
1410
+ * owner, until that owner's `storage.status()` reports space again. Returns
1411
+ * the unsubscribe function.
1409
1412
  */
1410
1413
  on(event: "storage.full", handler: (event: StorageFullEvent) => void): () => void;
1414
+ /**
1415
+ * Storage episode state for the UI mount. @internal
1416
+ *
1417
+ * `current()` returns the own-storage rejection that started the episode, or
1418
+ * undefined. `subscribe` calls its listener when the own episode starts or
1419
+ * ends; read `current()` inside it. `subscribeDelegated` calls its listener
1420
+ * once per delegated owner found full, until that owner is cleared.
1421
+ */
1422
+ get storageEpisode(): {
1423
+ current(): StorageFullEvent | undefined;
1424
+ subscribe(listener: () => void): () => void;
1425
+ subscribeDelegated(listener: () => void): () => void;
1426
+ };
1411
1427
  /** Owner key of the account the current session's own storage belongs to. */
1412
1428
  private currentStorageOwner;
1413
1429
  /**
@@ -1,7 +1,7 @@
1
1
  import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
2
2
  import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
3
3
  import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-u_PobKS1.cjs';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-DD7qjyLU.cjs';
5
5
 
6
6
  /** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
7
7
  declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
@@ -1,7 +1,7 @@
1
1
  import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
2
2
  import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
3
3
  import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-CclYdOh4.js';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-Cw00iiSP.js';
5
5
 
6
6
  /** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
7
7
  declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
package/dist/core.cjs CHANGED
@@ -3854,7 +3854,10 @@ var _TinyCloudNode = class _TinyCloudNode {
3854
3854
  * and remembers whose storage is full so sign-in and listing skip their
3855
3855
  * best-effort writes. Lives as long as this instance, across sign-ins.
3856
3856
  */
3857
- this.storageFull = new import_sdk_core11.StorageFullMonitor((spaceId) => spaceOwnerKey(spaceId) ?? spaceId);
3857
+ this.storageFull = new import_sdk_core11.StorageFullMonitor(
3858
+ (spaceId) => spaceOwnerKey(spaceId) ?? spaceId,
3859
+ () => this.currentStorageOwner()
3860
+ );
3858
3861
  this.invokeWithRuntimePermissions = (session, service, path, action, facts) => {
3859
3862
  const operation = {
3860
3863
  spaceId: session.spaceId,
@@ -4010,12 +4013,15 @@ var _TinyCloudNode = class _TinyCloudNode {
4010
4013
  return this._bootstrapStatus;
4011
4014
  }
4012
4015
  /**
4013
- * Subscribe to `storage.full`. It fires once, on the first write any
4014
- * service had rejected because the owner's TinyCloud storage is full
4016
+ * Subscribe to `storage.full`. It fires on the first write any service had
4017
+ * rejected because the owner's TinyCloud storage is full
4015
4018
  * (`STORAGE_QUOTA_EXCEEDED` or `STORAGE_LIMIT_REACHED`), so an app can show
4016
- * one read-only banner. Reads keep working. It fires again only after
4017
- * `storage.status()` has reported space again for every owner whose write
4018
- * was rejected. Returns the unsubscribe function.
4019
+ * one read-only banner. Reads keep working. For the signed-in account's own
4020
+ * storage it fires once per episode: the episode ends only when a write to
4021
+ * that storage succeeds, or on sign-out. A `storage.status()` read does not
4022
+ * end it. A rejection on another owner's delegated space fires once per
4023
+ * owner, until that owner's `storage.status()` reports space again. Returns
4024
+ * the unsubscribe function.
4019
4025
  */
4020
4026
  on(event, handler) {
4021
4027
  if (event !== "storage.full") {
@@ -4023,6 +4029,21 @@ var _TinyCloudNode = class _TinyCloudNode {
4023
4029
  }
4024
4030
  return this.storageFull.on(handler);
4025
4031
  }
4032
+ /**
4033
+ * Storage episode state for the UI mount. @internal
4034
+ *
4035
+ * `current()` returns the own-storage rejection that started the episode, or
4036
+ * undefined. `subscribe` calls its listener when the own episode starts or
4037
+ * ends; read `current()` inside it. `subscribeDelegated` calls its listener
4038
+ * once per delegated owner found full, until that owner is cleared.
4039
+ */
4040
+ get storageEpisode() {
4041
+ return {
4042
+ current: () => this.storageFull.rejection,
4043
+ subscribe: (listener) => this.storageFull.onEpisode(listener),
4044
+ subscribeDelegated: (listener) => this.storageFull.onDelegated(listener)
4045
+ };
4046
+ }
4026
4047
  /** Owner key of the account the current session's own storage belongs to. */
4027
4048
  currentStorageOwner() {
4028
4049
  return spaceOwnerKey(this._serviceContext?.session?.spaceId ?? this.currentTinyCloudSession()?.spaceId);