@tinycloud/node-sdk 2.11.0-beta.4 → 2.11.0-beta.5

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
@@ -19140,7 +19140,10 @@ var _TinyCloudNode = class _TinyCloudNode {
19140
19140
  * Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
19141
19141
  * true when bootstrap did not complete (interactive signer, auto-sign
19142
19142
  * denied, or a bootstrap step failed); `reason` carries the cause so apps
19143
- * can surface a "finish account setup" call-to-action.
19143
+ * can surface a "finish account setup" call-to-action. `warnings` is
19144
+ * present when bootstrap completed, but one or more steps recovered from
19145
+ * an ambiguous failure (e.g. a KV batch write reconciled via per-space
19146
+ * fallback) — clean vs. recovered runs are otherwise byte-identical.
19144
19147
  */
19145
19148
  this._bootstrapStatus = {
19146
19149
  skipped: false
@@ -19581,7 +19584,13 @@ var _TinyCloudNode = class _TinyCloudNode {
19581
19584
  return false;
19582
19585
  }
19583
19586
  try {
19584
- await this.runAccountBootstrap(steps);
19587
+ const warnings = await this.runAccountBootstrap(steps);
19588
+ if (warnings.length > 0) {
19589
+ this._bootstrapStatus = { skipped: false, warnings };
19590
+ this.notificationHandler.warning(
19591
+ `Account bootstrap completed with warnings: ${warnings.map((w) => `${w.stepId} (${w.kind}: ${w.code})`).join("; ")}`
19592
+ );
19593
+ }
19585
19594
  } catch (err) {
19586
19595
  const reason = err instanceof Error ? err.message : String(err);
19587
19596
  this._bootstrapSkipped = true;
@@ -19630,6 +19639,7 @@ var _TinyCloudNode = class _TinyCloudNode {
19630
19639
  const auth = this.auth;
19631
19640
  const sessions = /* @__PURE__ */ new Map();
19632
19641
  const rawAbilitiesBySpace = /* @__PURE__ */ new Map();
19642
+ const warnings = [];
19633
19643
  const primarySession = auth.tinyCloudSession;
19634
19644
  const defaultSpaceId = this.ownedSpaceId("default");
19635
19645
  const canReusePrimaryBootstrapSession = primarySession?.spaceId === defaultSpaceId && auth.capabilityRequest === import_sdk_core7.BOOTSTRAP_SESSION_REQUESTS.default;
@@ -19691,20 +19701,29 @@ var _TinyCloudNode = class _TinyCloudNode {
19691
19701
  }
19692
19702
  }
19693
19703
  if (step.kind === "seed-spaces") {
19694
- for (const space of step.spaces) {
19695
- const registered = await this.account.spaces.register({
19704
+ const registered = await this.account.spaces.registerBatch(
19705
+ step.spaces.map((space) => ({
19696
19706
  spaceId: space.spaceId,
19697
19707
  name: space.name,
19698
19708
  ownerDid: this.did,
19699
19709
  type: "owned",
19700
19710
  permissions: ["*"],
19701
19711
  status: "active"
19712
+ }))
19713
+ );
19714
+ if (!registered.ok) {
19715
+ throw new Error(
19716
+ `Failed to seed account spaces: ${registered.error.message}`
19717
+ );
19718
+ }
19719
+ const batchError = registered.data.recoveredFromBatchError;
19720
+ if (batchError) {
19721
+ warnings.push({
19722
+ stepId: step.id,
19723
+ kind: "batch-write-reconciled",
19724
+ code: batchError.code,
19725
+ message: batchError.message
19702
19726
  });
19703
- if (!registered.ok) {
19704
- throw new Error(
19705
- `Failed to seed account space ${space.spaceId}: ${registered.error.message}`
19706
- );
19707
- }
19708
19727
  }
19709
19728
  }
19710
19729
  if (step.kind === "seed-applications") {
@@ -19740,6 +19759,7 @@ var _TinyCloudNode = class _TinyCloudNode {
19740
19759
  }
19741
19760
  }
19742
19761
  }
19762
+ return warnings;
19743
19763
  }
19744
19764
  registerBootstrapRuntimeGrant(session, request, rawAbilities) {
19745
19765
  const operations = [];
@@ -20865,6 +20885,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20865
20885
  if (this._serviceContext) {
20866
20886
  const spaceScopedContext = this._serviceGraph.track(new import_sdk_core7.ServiceContext({
20867
20887
  invoke: this._serviceContext.invoke,
20888
+ invokeAny: this._serviceContext.invokeAny,
20868
20889
  fetch: this._serviceContext.fetch,
20869
20890
  hosts: this._serviceContext.hosts,
20870
20891
  telemetry: this.config.telemetry