@tinycloud/node-sdk 3.7.0-beta.4 → 3.8.0-beta.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.
@@ -1,6 +1,6 @@
1
1
  import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
2
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';
3
+ import { T as TinyCloudNode } from './TinyCloudNode-ggmlnSfI.cjs';
4
4
  import '@tinycloud/sdk-core';
5
5
  import '@tinycloud/sdk-services/kv/replication';
6
6
  import '@tinycloud/sdk-services';
@@ -1,6 +1,6 @@
1
1
  import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
2
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';
3
+ import { T as TinyCloudNode } from './TinyCloudNode-BtKzLDJX.js';
4
4
  import '@tinycloud/sdk-core';
5
5
  import '@tinycloud/sdk-services/kv/replication';
6
6
  import '@tinycloud/sdk-services';
package/dist/index.cjs CHANGED
@@ -19019,6 +19019,7 @@ var NodeUserAuthorization = class {
19019
19019
  this.includeAccountRegistryPermissions = config.includeAccountRegistryPermissions ?? true;
19020
19020
  this.replication = config.replication?.enabled === true ? config.replication : void 0;
19021
19021
  this.establishReplicaStamp = config.establishReplicaStamp;
19022
+ this.additionalRawAbilities = config.additionalRawAbilities;
19022
19023
  this._manifest = config.manifest;
19023
19024
  this._capabilityRequest = config.capabilityRequest;
19024
19025
  this.sessionManager = config.sessionManager ?? this.wasm.createSessionManager();
@@ -19449,7 +19450,18 @@ var NodeUserAuthorization = class {
19449
19450
  defaultEncryptionNetworkId(address, chainId) {
19450
19451
  return `urn:tinycloud:encryption:${(0, import_sdk_core5.pkhDid)(address, chainId)}:default`;
19451
19452
  }
19453
+ /** Sign-in capabilities plus the caller's additional top-level resource abilities. */
19452
19454
  resolveSignInCapabilities(address, chainId) {
19455
+ const base2 = this.resolveBaseSignInCapabilities(address, chainId);
19456
+ const extra = this.additionalRawAbilities;
19457
+ if (extra === void 0 || Object.keys(extra).length === 0) return base2;
19458
+ const rawAbilities = { ...base2.rawAbilities ?? {} };
19459
+ for (const [resource, actions] of Object.entries(extra)) {
19460
+ for (const action of actions) addRawAbility(rawAbilities, resource, action);
19461
+ }
19462
+ return { ...base2, rawAbilities };
19463
+ }
19464
+ resolveBaseSignInCapabilities(address, chainId) {
19453
19465
  const request = this.getCapabilityRequest();
19454
19466
  if (request === void 0) {
19455
19467
  const defaultNetworkId = this.defaultEncryptionNetworkId(address, chainId);
@@ -21676,6 +21688,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21676
21688
  this._bootstrapStatus = {
21677
21689
  skipped: false
21678
21690
  };
21691
+ this._freshEncryptionNetworkCreated = false;
21679
21692
  /**
21680
21693
  * Turns every service's storage rejections into one `storage.full` event,
21681
21694
  * and remembers whose storage is full so sign-in and listing skip their
@@ -21839,6 +21852,10 @@ var _TinyCloudNode = class _TinyCloudNode {
21839
21852
  get bootstrapStatus() {
21840
21853
  return this._bootstrapStatus;
21841
21854
  }
21855
+ /** Whether the last sign-in's fresh account bootstrap created its encryption network. */
21856
+ get freshEncryptionNetworkCreated() {
21857
+ return this._freshEncryptionNetworkCreated;
21858
+ }
21842
21859
  /**
21843
21860
  * Subscribe to `storage.full`. It fires on the first write any service had
21844
21861
  * rejected because the owner's TinyCloud storage is full
@@ -22041,6 +22058,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22041
22058
  signStrategy: config.signStrategy ?? { type: "auto-sign" },
22042
22059
  wasmBindings: this.wasmBindings,
22043
22060
  ...config.replication?.enabled === true ? { establishReplicaStamp: this.establishReplicaStamp } : {},
22061
+ ...config.additionalRawAbilities === void 0 ? {} : { additionalRawAbilities: config.additionalRawAbilities },
22044
22062
  sessionManager: this.sessionManager,
22045
22063
  sessionStorage: config.sessionStorage ?? new MemorySessionStorage(),
22046
22064
  domain: this.siweDomain,
@@ -22606,6 +22624,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22606
22624
  async bootstrapAccountIfNeeded() {
22607
22625
  this._bootstrapSkipped = false;
22608
22626
  this._bootstrapStatus = { skipped: false };
22627
+ this._freshEncryptionNetworkCreated = false;
22609
22628
  if (this.config.autoBootstrapAccount === false) {
22610
22629
  this._bootstrapStatus = { skipped: true, reason: "auto-bootstrap-disabled" };
22611
22630
  return false;
@@ -22895,6 +22914,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22895
22914
  }
22896
22915
  if (step.kind === "encryption-network-create") {
22897
22916
  await this.ensureEncryptionNetwork(step.networkId, { assumeMissing: mode === "fresh" });
22917
+ if (mode === "fresh") this._freshEncryptionNetworkCreated = true;
22898
22918
  }
22899
22919
  if (step.kind === "secret-records-schema") {
22900
22920
  const db = this.sqlForSpace(step.spaceId).db(step.database);