@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.
package/dist/artifacts.js CHANGED
@@ -185,9 +185,6 @@ import { z as z2 } from "zod";
185
185
  // ../sdk-core/src/manifest.ts
186
186
  var import_ms = __toESM(require_ms(), 1);
187
187
 
188
- // ../sdk-services/dist/index.js
189
- import { z } from "zod";
190
-
191
188
  // ../bootstrap/dist/index.js
192
189
  var CAPABILITIES = [
193
190
  { urn: "tinycloud.kv/get", service: "tinycloud.kv", status: "active" },
@@ -596,28 +593,6 @@ function withCapabilitiesReadForSpaces(resources) {
596
593
  }))
597
594
  ]);
598
595
  }
599
- function accountRegistryPermissions() {
600
- return [
601
- {
602
- service: "tinycloud.kv",
603
- space: ACCOUNT_REGISTRY_SPACE,
604
- path: ACCOUNT_REGISTRY_PATH,
605
- actions: [KV.GET, KV.PUT, KV.LIST]
606
- },
607
- {
608
- service: "tinycloud.kv",
609
- space: ACCOUNT_REGISTRY_SPACE,
610
- path: "spaces/",
611
- actions: [KV.GET, KV.PUT, KV.LIST]
612
- },
613
- {
614
- service: "tinycloud.sql",
615
- space: ACCOUNT_REGISTRY_SPACE,
616
- path: "account",
617
- actions: [SQL.READ, SQL.WRITE, SQL.SCHEMA]
618
- }
619
- ];
620
- }
621
596
  function composeManifestRequest(inputs, options = {}) {
622
597
  if (!Array.isArray(inputs) || inputs.length === 0) {
623
598
  throw new Error("composeManifestRequest requires at least one manifest");
@@ -631,7 +606,12 @@ function composeManifestRequest(inputs, options = {}) {
631
606
  return explicit.flatMap((entry) => expandPermissionEntry(entry, prefix, space));
632
607
  });
633
608
  if (includeAccountRegistryPermissions) {
634
- resources.push(...accountRegistryPermissions());
609
+ resources.push(
610
+ ...ACCOUNT_MANIFEST_PERMISSIONS.map((resource) => ({
611
+ ...resource,
612
+ actions: [...resource.actions]
613
+ }))
614
+ );
635
615
  }
636
616
  const manifestsByAppId = /* @__PURE__ */ new Map();
637
617
  for (const manifest of manifests) {
@@ -659,11 +639,60 @@ function composeBootstrapSpaceManifest(space) {
659
639
  includeAccountRegistryPermissions: false
660
640
  });
661
641
  }
642
+ var ACCOUNT_MANIFEST_PERMISSIONS = Object.freeze([
643
+ {
644
+ service: "tinycloud.kv",
645
+ space: ACCOUNT_REGISTRY_SPACE,
646
+ path: ACCOUNT_REGISTRY_PATH,
647
+ actions: [KV.GET, KV.PUT, KV.LIST]
648
+ },
649
+ {
650
+ service: "tinycloud.kv",
651
+ space: ACCOUNT_REGISTRY_SPACE,
652
+ path: "spaces/",
653
+ actions: [KV.GET, KV.PUT, KV.LIST]
654
+ },
655
+ {
656
+ service: "tinycloud.kv",
657
+ space: ACCOUNT_REGISTRY_SPACE,
658
+ path: "system/bootstrap/complete",
659
+ actions: [KV.GET, KV.PUT]
660
+ },
661
+ {
662
+ service: "tinycloud.delegation",
663
+ space: ACCOUNT_REGISTRY_SPACE,
664
+ path: "",
665
+ actions: ["tinycloud.delegation/list"]
666
+ },
667
+ {
668
+ service: "tinycloud.sql",
669
+ space: ACCOUNT_REGISTRY_SPACE,
670
+ path: "account",
671
+ actions: [SQL.READ, SQL.WRITE, SQL.SCHEMA]
672
+ },
673
+ {
674
+ service: "tinycloud.capabilities",
675
+ space: ACCOUNT_REGISTRY_SPACE,
676
+ path: "",
677
+ actions: [CAPABILITIES2.READ]
678
+ }
679
+ ]);
680
+ var BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST = composeBootstrapSpaceManifest(BOOTSTRAP_DEFAULT_SPACE);
681
+ var BOOTSTRAP_WIDENED_DEFAULT_SESSION_REQUEST = {
682
+ ...BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST,
683
+ resources: [
684
+ ...BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST.resources,
685
+ ...ACCOUNT_MANIFEST_PERMISSIONS.map((resource) => ({
686
+ ...resource,
687
+ actions: [...resource.actions]
688
+ }))
689
+ ]
690
+ };
662
691
  var BOOTSTRAP_SESSION_REQUESTS = Object.freeze(
663
692
  Object.fromEntries(
664
693
  BOOTSTRAP_SPACE_NAMES.map((space) => [
665
694
  space,
666
- composeBootstrapSpaceManifest(space)
695
+ space === BOOTSTRAP_DEFAULT_SPACE ? BOOTSTRAP_WIDENED_DEFAULT_SESSION_REQUEST : composeBootstrapSpaceManifest(space)
667
696
  ])
668
697
  )
669
698
  );
@@ -694,6 +723,7 @@ var BOOTSTRAP_ALLOWLIST = Object.freeze(
694
723
  );
695
724
 
696
725
  // ../sdk-services/dist/index.js
726
+ import { z } from "zod";
697
727
  var import_decrypt_transport_response_error = __toESM(require_decrypt_transport_response_error(), 1);
698
728
  var ErrorCodes = {
699
729
  // Common errors
@@ -6508,7 +6538,10 @@ var EncryptionService = class extends BaseService {
6508
6538
  const descriptor = usable.data;
6509
6539
  const networkPublicKey = base64Decode2(descriptor.publicEncryptionKey);
6510
6540
  const result = encryptToNetwork(this.crypto, {
6511
- networkId,
6541
+ // Discovery returns the node's canonical network identifier. Persist
6542
+ // that spelling in the envelope so a later response can be compared
6543
+ // byte-for-byte (notably for checksummed did:pkh principals).
6544
+ networkId: descriptor.networkId,
6512
6545
  networkPublicKey,
6513
6546
  plaintext,
6514
6547
  ...options?.aad !== void 0 ? { aad: options.aad } : {},