@tinycloud/operations 0.3.2-beta.9 → 0.3.3-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.
@@ -209,9 +209,6 @@ var import_zod2 = require("zod");
209
209
  // ../sdk-core/src/manifest.ts
210
210
  var import_ms = __toESM(require_ms(), 1);
211
211
 
212
- // ../sdk-services/dist/index.js
213
- var import_zod = require("zod");
214
-
215
212
  // ../bootstrap/dist/index.js
216
213
  var CAPABILITIES = [
217
214
  { urn: "tinycloud.kv/get", service: "tinycloud.kv", status: "active" },
@@ -620,28 +617,6 @@ function withCapabilitiesReadForSpaces(resources) {
620
617
  }))
621
618
  ]);
622
619
  }
623
- function accountRegistryPermissions() {
624
- return [
625
- {
626
- service: "tinycloud.kv",
627
- space: ACCOUNT_REGISTRY_SPACE,
628
- path: ACCOUNT_REGISTRY_PATH,
629
- actions: [KV.GET, KV.PUT, KV.LIST]
630
- },
631
- {
632
- service: "tinycloud.kv",
633
- space: ACCOUNT_REGISTRY_SPACE,
634
- path: "spaces/",
635
- actions: [KV.GET, KV.PUT, KV.LIST]
636
- },
637
- {
638
- service: "tinycloud.sql",
639
- space: ACCOUNT_REGISTRY_SPACE,
640
- path: "account",
641
- actions: [SQL.READ, SQL.WRITE, SQL.SCHEMA]
642
- }
643
- ];
644
- }
645
620
  function composeManifestRequest(inputs, options = {}) {
646
621
  if (!Array.isArray(inputs) || inputs.length === 0) {
647
622
  throw new Error("composeManifestRequest requires at least one manifest");
@@ -655,7 +630,12 @@ function composeManifestRequest(inputs, options = {}) {
655
630
  return explicit.flatMap((entry) => expandPermissionEntry(entry, prefix, space));
656
631
  });
657
632
  if (includeAccountRegistryPermissions) {
658
- resources.push(...accountRegistryPermissions());
633
+ resources.push(
634
+ ...ACCOUNT_MANIFEST_PERMISSIONS.map((resource) => ({
635
+ ...resource,
636
+ actions: [...resource.actions]
637
+ }))
638
+ );
659
639
  }
660
640
  const manifestsByAppId = /* @__PURE__ */ new Map();
661
641
  for (const manifest of manifests) {
@@ -683,11 +663,60 @@ function composeBootstrapSpaceManifest(space) {
683
663
  includeAccountRegistryPermissions: false
684
664
  });
685
665
  }
666
+ var ACCOUNT_MANIFEST_PERMISSIONS = Object.freeze([
667
+ {
668
+ service: "tinycloud.kv",
669
+ space: ACCOUNT_REGISTRY_SPACE,
670
+ path: ACCOUNT_REGISTRY_PATH,
671
+ actions: [KV.GET, KV.PUT, KV.LIST]
672
+ },
673
+ {
674
+ service: "tinycloud.kv",
675
+ space: ACCOUNT_REGISTRY_SPACE,
676
+ path: "spaces/",
677
+ actions: [KV.GET, KV.PUT, KV.LIST]
678
+ },
679
+ {
680
+ service: "tinycloud.kv",
681
+ space: ACCOUNT_REGISTRY_SPACE,
682
+ path: "system/bootstrap/complete",
683
+ actions: [KV.GET, KV.PUT]
684
+ },
685
+ {
686
+ service: "tinycloud.delegation",
687
+ space: ACCOUNT_REGISTRY_SPACE,
688
+ path: "",
689
+ actions: ["tinycloud.delegation/list"]
690
+ },
691
+ {
692
+ service: "tinycloud.sql",
693
+ space: ACCOUNT_REGISTRY_SPACE,
694
+ path: "account",
695
+ actions: [SQL.READ, SQL.WRITE, SQL.SCHEMA]
696
+ },
697
+ {
698
+ service: "tinycloud.capabilities",
699
+ space: ACCOUNT_REGISTRY_SPACE,
700
+ path: "",
701
+ actions: [CAPABILITIES2.READ]
702
+ }
703
+ ]);
704
+ var BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST = composeBootstrapSpaceManifest(BOOTSTRAP_DEFAULT_SPACE);
705
+ var BOOTSTRAP_WIDENED_DEFAULT_SESSION_REQUEST = {
706
+ ...BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST,
707
+ resources: [
708
+ ...BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST.resources,
709
+ ...ACCOUNT_MANIFEST_PERMISSIONS.map((resource) => ({
710
+ ...resource,
711
+ actions: [...resource.actions]
712
+ }))
713
+ ]
714
+ };
686
715
  var BOOTSTRAP_SESSION_REQUESTS = Object.freeze(
687
716
  Object.fromEntries(
688
717
  BOOTSTRAP_SPACE_NAMES.map((space) => [
689
718
  space,
690
- composeBootstrapSpaceManifest(space)
719
+ space === BOOTSTRAP_DEFAULT_SPACE ? BOOTSTRAP_WIDENED_DEFAULT_SESSION_REQUEST : composeBootstrapSpaceManifest(space)
691
720
  ])
692
721
  )
693
722
  );
@@ -718,6 +747,7 @@ var BOOTSTRAP_ALLOWLIST = Object.freeze(
718
747
  );
719
748
 
720
749
  // ../sdk-services/dist/index.js
750
+ var import_zod = require("zod");
721
751
  var import_decrypt_transport_response_error = __toESM(require_decrypt_transport_response_error(), 1);
722
752
  var ErrorCodes = {
723
753
  // Common errors
@@ -6532,7 +6562,10 @@ var EncryptionService = class extends BaseService {
6532
6562
  const descriptor = usable.data;
6533
6563
  const networkPublicKey = base64Decode2(descriptor.publicEncryptionKey);
6534
6564
  const result = encryptToNetwork(this.crypto, {
6535
- networkId,
6565
+ // Discovery returns the node's canonical network identifier. Persist
6566
+ // that spelling in the envelope so a later response can be compared
6567
+ // byte-for-byte (notably for checksummed did:pkh principals).
6568
+ networkId: descriptor.networkId,
6536
6569
  networkPublicKey,
6537
6570
  plaintext,
6538
6571
  ...options?.aad !== void 0 ? { aad: options.aad } : {},