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

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.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);