@empire-builder-kit/nx 1.0.0-rc.46 → 1.0.0-rc.47

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.
Files changed (174) hide show
  1. package/generators.json +11 -1
  2. package/package.json +3 -3
  3. package/src/aws-authority/stage-authority.d.ts +30 -2
  4. package/src/aws-authority/stage-authority.js +220 -25
  5. package/src/developer-agent/generator-planning.js +99 -6
  6. package/src/developer-agent/model.d.ts +7 -3
  7. package/src/developer-agent/model.js +1 -0
  8. package/src/developer-agent/operation-registry.d.ts +1 -0
  9. package/src/developer-agent/operation-registry.js +43 -2
  10. package/src/developer-agent/planning.js +5 -2
  11. package/src/developer-agent/preview-changes.js +10 -0
  12. package/src/developer-agent/validation.js +7 -3
  13. package/src/developer-agent/workspace-inspection.js +51 -4
  14. package/src/executors/deployment-plan/deployment-plan.js +3 -0
  15. package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
  16. package/src/executors/dev-doctor/dev-doctor.js +136 -49
  17. package/src/executors/dev-setup/dev-setup.d.ts +18 -1
  18. package/src/executors/dev-setup/dev-setup.js +320 -196
  19. package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
  20. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
  21. package/src/executors/infrastructure-plan/infrastructure-plan.js +10 -3
  22. package/src/executors/local-deploy/local-deploy.d.ts +15 -0
  23. package/src/executors/local-deploy/local-deploy.js +96 -14
  24. package/src/executors/sst-lifecycle/logging-preflight.js +12 -1
  25. package/src/executors/sst-lifecycle/run-sst-command.js +51 -5
  26. package/src/foundation/cost-estimate.js +1 -1
  27. package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
  28. package/src/foundation/identity-domain-parent-ready.js +333 -0
  29. package/src/foundation/identity-domain.d.ts +94 -0
  30. package/src/foundation/identity-domain.js +115 -0
  31. package/src/foundation/index.d.ts +2 -0
  32. package/src/foundation/index.js +7 -0
  33. package/src/foundation/preflight.js +17 -1
  34. package/src/foundation/root-site-readiness.d.ts +27 -0
  35. package/src/foundation/root-site-readiness.js +78 -0
  36. package/src/foundation/root-site.d.ts +81 -0
  37. package/src/foundation/root-site.js +268 -0
  38. package/src/generators/framework-prerequisites.d.ts +2 -0
  39. package/src/generators/framework-prerequisites.js +34 -0
  40. package/src/generators/function/function-registration.d.ts +24 -0
  41. package/src/generators/function/function-registration.js +66 -0
  42. package/src/generators/function/function.d.ts +16 -1
  43. package/src/generators/function/function.js +101 -18
  44. package/src/generators/function/schema.d.ts +1 -0
  45. package/src/generators/function/schema.json +6 -0
  46. package/src/generators/function-access/function-access.d.ts +14 -0
  47. package/src/generators/function-access/function-access.js +141 -0
  48. package/src/generators/function-access/schema.d.ts +6 -0
  49. package/src/generators/function-access/schema.json +25 -0
  50. package/src/generators/post-generation-install.d.ts +1 -1
  51. package/src/generators/post-generation-install.js +1 -1
  52. package/src/generators/preset/dependency-overrides.d.ts +1 -1
  53. package/src/generators/preset/dependency-overrides.js +1 -1
  54. package/src/generators/preset/workspace-files-adopter-skills.js +14 -0
  55. package/src/generators/preset/workspace-files-developer-agent.js +17 -11
  56. package/src/generators/preset/workspace-files-stage-authority.js +58 -1
  57. package/src/generators/preset/workspace-files-thin-deploy.d.ts +11 -0
  58. package/src/generators/preset/workspace-files-thin-deploy.js +47 -4
  59. package/src/generators/preset/workspace-files-thin-docs.js +33 -5
  60. package/src/generators/preset/workspace-files.js +207 -13
  61. package/src/generators/repository-policy/repository-policy.js +2 -1
  62. package/src/generators/repository-policy/schema.d.ts +2 -0
  63. package/src/generators/repository-policy/schema.json +7 -2
  64. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -0
  65. package/src/generators/site/built-in-site-documentation-files.js +92 -0
  66. package/src/generators/site/built-in-site-files.d.ts +8 -0
  67. package/src/generators/site/built-in-site-files.js +40 -0
  68. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -0
  69. package/src/generators/site/built-in-site-infrastructure-files.js +275 -0
  70. package/src/generators/site/built-in-site-plan.d.ts +19 -0
  71. package/src/generators/site/built-in-site-plan.js +65 -0
  72. package/src/generators/site/built-in-site-project-files.d.ts +3 -0
  73. package/src/generators/site/built-in-site-project-files.js +258 -0
  74. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  75. package/src/generators/site/built-in-site-script-files.js +306 -0
  76. package/src/generators/site/built-in-site-shared.d.ts +9 -0
  77. package/src/generators/site/built-in-site-shared.js +21 -0
  78. package/src/generators/site/built-in-site-smoke-files.d.ts +2 -0
  79. package/src/generators/site/built-in-site-smoke-files.js +37 -0
  80. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -0
  81. package/src/generators/site/built-in-site-sst-config-files.js +39 -0
  82. package/src/generators/site/built-in-site-web-files.d.ts +2 -0
  83. package/src/generators/site/built-in-site-web-files.js +284 -0
  84. package/src/generators/site/schema.d.ts +4 -0
  85. package/src/generators/site/schema.json +20 -0
  86. package/src/generators/site/site.d.ts +13 -0
  87. package/src/generators/site/site.js +221 -0
  88. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +9 -0
  89. package/src/generators/slice/built-in-plan-alarm-identity.js +8 -1
  90. package/src/generators/slice/built-in-plan-api-contract-files.js +18 -0
  91. package/src/generators/slice/built-in-plan-async-work-files.js +18 -0
  92. package/src/generators/slice/built-in-plan-data-files.js +116 -11
  93. package/src/generators/slice/built-in-plan-foundation-files.d.ts +12 -0
  94. package/src/generators/slice/built-in-plan-foundation-files.js +114 -5
  95. package/src/generators/slice/built-in-plan-frontend-files.js +2 -271
  96. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +6 -0
  97. package/src/generators/slice/built-in-plan-frontend-header-proof.js +282 -0
  98. package/src/generators/slice/built-in-plan-infrastructure-files.js +151 -237
  99. package/src/generators/slice/built-in-plan-key-value-cleanup.js +4 -3
  100. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +29 -0
  101. package/src/generators/slice/built-in-plan-log-group-helpers.js +130 -0
  102. package/src/generators/slice/built-in-plan-metadata-files.js +21 -4
  103. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +5 -0
  104. package/src/generators/slice/built-in-plan-next-build-authority.js +124 -0
  105. package/src/generators/slice/built-in-plan-operations-files.d.ts +6 -0
  106. package/src/generators/slice/built-in-plan-operations-files.js +107 -219
  107. package/src/generators/slice/built-in-plan-performance-files.js +6 -1
  108. package/src/generators/slice/built-in-plan-reliability-files.js +12 -8
  109. package/src/generators/slice/built-in-plan-shared.d.ts +1 -1
  110. package/src/generators/slice/built-in-plan-shared.js +1 -1
  111. package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
  112. package/src/generators/slice/built-in-plan-sst-config.js +160 -0
  113. package/src/generators/slice/built-in-plan-testing-files.js +92 -49
  114. package/src/generators/slice/built-in-plan-verification-files.js +15 -4
  115. package/src/generators/slice/built-in-plan-web-files.js +65 -0
  116. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +35 -0
  117. package/src/generators/slice/deployed-smoke-diagnostics.js +189 -0
  118. package/src/generators/slice/deployed-smoke-readiness.d.ts +7 -0
  119. package/src/generators/slice/deployed-smoke-readiness.js +118 -23
  120. package/src/generators/slice/persistence-contract.js +2 -2
  121. package/src/generators/slice/pnpm-launch-script.d.ts +13 -0
  122. package/src/generators/slice/pnpm-launch-script.js +28 -0
  123. package/src/generators/slice/slice.js +27 -0
  124. package/src/generators/upgrade/custom-domain-notice.d.ts +19 -0
  125. package/src/generators/upgrade/custom-domain-notice.js +38 -0
  126. package/src/generators/upgrade/external-blueprint-compositions.d.ts +84 -0
  127. package/src/generators/upgrade/external-blueprint-compositions.js +478 -0
  128. package/src/generators/upgrade/framework-package-upgrade.d.ts +58 -0
  129. package/src/generators/upgrade/framework-package-upgrade.js +78 -0
  130. package/src/generators/upgrade/function-authentication-notice.d.ts +29 -0
  131. package/src/generators/upgrade/function-authentication-notice.js +74 -0
  132. package/src/generators/upgrade/schema.json +2 -2
  133. package/src/generators/upgrade/upgrade-plan.d.ts +52 -0
  134. package/src/generators/upgrade/upgrade-plan.js +406 -0
  135. package/src/generators/upgrade/upgrade.d.ts +1 -35
  136. package/src/generators/upgrade/upgrade.js +259 -593
  137. package/src/generators/workload/workload.js +60 -4
  138. package/src/git-policy/github-bootstrap.d.ts +6 -5
  139. package/src/git-policy/github-bootstrap.js +6 -4
  140. package/src/local-dev/fleet-process.d.ts +9 -2
  141. package/src/local-dev/fleet-process.js +27 -7
  142. package/src/local-dev/gateway-daemon.d.ts +1 -1
  143. package/src/local-dev/gateway-daemon.js +6 -4
  144. package/src/local-dev/portless.d.ts +5 -0
  145. package/src/local-dev/portless.js +5 -0
  146. package/src/local-dev/process-group.d.ts +10 -0
  147. package/src/local-dev/process-group.js +33 -0
  148. package/src/local-dev/tls.js +31 -2
  149. package/src/local-dev/trust-store.d.ts +42 -0
  150. package/src/local-dev/trust-store.js +87 -0
  151. package/src/ownership/composition.d.ts +7 -0
  152. package/src/ownership/composition.js +64 -56
  153. package/src/ownership/index.d.ts +1 -0
  154. package/src/ownership/index.js +1 -0
  155. package/src/ownership/record.d.ts +19 -0
  156. package/src/ownership/record.js +26 -2
  157. package/src/ownership/site-record.d.ts +18 -0
  158. package/src/ownership/site-record.js +105 -0
  159. package/src/repository-policy/deployment-plan.d.ts +3 -0
  160. package/src/repository-policy/deployment-plan.js +33 -4
  161. package/src/repository-policy/index.d.ts +1 -0
  162. package/src/repository-policy/index.js +1 -0
  163. package/src/repository-policy/policy.d.ts +13 -1
  164. package/src/repository-policy/policy.js +55 -1
  165. package/src/repository-policy/public-dns.d.ts +65 -0
  166. package/src/repository-policy/public-dns.js +168 -0
  167. package/src/schemas/generated-ownership-v2.json +6 -0
  168. package/src/schemas/repository-policy-v1.json +67 -1
  169. package/src/supply-chain/blueprint-trust-git.js +24 -0
  170. package/src/supply-chain/blueprint-verification-authority.js +21 -3
  171. package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
  172. package/src/work-markers/work-markers.js +4 -1
  173. package/src/workspace-deployment/ownership.d.ts +15 -0
  174. package/src/workspace-deployment/ownership.js +19 -3
@@ -3,83 +3,86 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.restampProductSliceOwnership = restampProductSliceOwnership;
4
4
  exports.restampFoundationOwnership = restampFoundationOwnership;
5
5
  exports.restampWorkspaceOwnership = restampWorkspaceOwnership;
6
+ exports.restampSiteOwnership = restampSiteOwnership;
6
7
  exports.recordCompositionOwnership = recordCompositionOwnership;
7
8
  const deterministic_order_js_1 = require("../deterministic-order.js");
8
9
  const node_path_1 = require("node:path");
9
10
  const json_ownership_js_1 = require("./json-ownership.js");
10
11
  const foundation_record_js_1 = require("./foundation-record.js");
11
12
  const record_js_1 = require("./record.js");
13
+ const site_record_js_1 = require("./site-record.js");
12
14
  const workspace_record_js_1 = require("./workspace-record.js");
13
15
  function json(value) {
14
16
  return `${JSON.stringify(value, null, 2)}\n`;
15
17
  }
16
- function restampProductSliceOwnership(tree, slice, options = {}) {
17
- const root = node_path_1.posix.join('packages', slice);
18
- const ownershipPath = node_path_1.posix.join(root, '.ebk/ownership.json');
19
- const source = tree.read(ownershipPath, 'utf8');
18
+ // One restamper for every ownership record kind. Each kind keeps its own
19
+ // validator, so the root site record stays stricter than the others.
20
+ function restampOwnershipRecord(tree, record) {
21
+ const source = tree.read(record.ownershipPath, 'utf8');
20
22
  if (source === null) {
21
- throw new Error(`Product Slice ownership metadata is missing at ${ownershipPath}.`);
23
+ throw new Error(`${record.label} ownership metadata is missing${record.namesMissingRecordPath ? ` at ${record.ownershipPath}` : ''}.`);
22
24
  }
23
- const result = (0, record_js_1.validateGeneratedOwnershipRecord)(JSON.parse(source));
25
+ const result = record.validate(JSON.parse(source));
24
26
  if (!result.valid) {
25
- throw new Error('Product Slice ownership metadata is invalid after generation.');
27
+ throw new Error(`${record.label} ownership metadata is invalid after generation.`);
26
28
  }
27
- tree.write(ownershipPath, json({
29
+ const paths = result.value.paths.map((entry) => {
30
+ if (record.preserveSeeded && entry.mode === 'seeded') {
31
+ return entry;
32
+ }
33
+ const contents = tree.read(record.root === '' ? entry.path : node_path_1.posix.join(record.root, entry.path), 'utf8');
34
+ if (contents === null) {
35
+ throw new Error(`Generated ${record.pathLabel} path does not exist: ${entry.path}.`);
36
+ }
37
+ return { ...entry, sha256: (0, json_ownership_js_1.hashOwnedContent)(contents, entry) };
38
+ });
39
+ tree.write(record.ownershipPath, json({
28
40
  ...result.value,
29
- paths: result.value.paths.map((entry) => {
30
- if (options.preserveSeeded && entry.mode === 'seeded') {
31
- return entry;
32
- }
33
- const contents = tree.read(node_path_1.posix.join(root, entry.path), 'utf8');
34
- if (contents === null) {
35
- throw new Error(`Generated owned path does not exist: ${entry.path}.`);
36
- }
37
- return { ...entry, sha256: (0, json_ownership_js_1.hashOwnedContent)(contents, entry) };
38
- }),
41
+ paths: record.sortPaths
42
+ ? paths.sort((left, right) => (0, deterministic_order_js_1.compareUtf16)(left.path, right.path))
43
+ : paths,
39
44
  }));
40
45
  }
46
+ function restampProductSliceOwnership(tree, slice, options = {}) {
47
+ const root = node_path_1.posix.join('packages', slice);
48
+ restampOwnershipRecord(tree, {
49
+ label: 'Product Slice',
50
+ namesMissingRecordPath: true,
51
+ ownershipPath: node_path_1.posix.join(root, '.ebk/ownership.json'),
52
+ pathLabel: 'owned',
53
+ preserveSeeded: options.preserveSeeded,
54
+ root,
55
+ validate: record_js_1.validateGeneratedOwnershipRecord,
56
+ });
57
+ }
41
58
  function restampFoundationOwnership(tree) {
42
59
  const root = 'packages/foundation';
43
- const ownershipPath = node_path_1.posix.join(root, '.ebk/ownership.json');
44
- const source = tree.read(ownershipPath, 'utf8');
45
- if (source === null) {
46
- throw new Error('Standard Foundation ownership metadata is missing.');
47
- }
48
- const result = (0, foundation_record_js_1.validateFoundationOwnershipRecord)(JSON.parse(source));
49
- if (!result.valid) {
50
- throw new Error('Standard Foundation ownership metadata is invalid after generation.');
51
- }
52
- tree.write(ownershipPath, json({
53
- ...result.value,
54
- paths: result.value.paths.map((entry) => {
55
- const contents = tree.read(node_path_1.posix.join(root, entry.path), 'utf8');
56
- if (contents === null) {
57
- throw new Error(`Generated Foundation path does not exist: ${entry.path}.`);
58
- }
59
- return { ...entry, sha256: (0, json_ownership_js_1.hashOwnedContent)(contents, entry) };
60
- }),
61
- }));
60
+ restampOwnershipRecord(tree, {
61
+ label: 'Standard Foundation',
62
+ ownershipPath: node_path_1.posix.join(root, '.ebk/ownership.json'),
63
+ pathLabel: 'Foundation',
64
+ root,
65
+ validate: foundation_record_js_1.validateFoundationOwnershipRecord,
66
+ });
62
67
  }
63
68
  function restampWorkspaceOwnership(tree) {
64
- const ownershipPath = '.ebk/ownership.json';
65
- const source = tree.read(ownershipPath, 'utf8');
66
- if (source === null) {
67
- throw new Error('Workspace ownership metadata is missing.');
68
- }
69
- const result = (0, workspace_record_js_1.validateWorkspaceOwnershipRecord)(JSON.parse(source));
70
- if (!result.valid) {
71
- throw new Error('Workspace ownership metadata is invalid after generation.');
72
- }
73
- tree.write(ownershipPath, json({
74
- ...result.value,
75
- paths: result.value.paths.map((entry) => {
76
- const contents = tree.read(entry.path, 'utf8');
77
- if (contents === null) {
78
- throw new Error(`Generated workspace path does not exist: ${entry.path}.`);
79
- }
80
- return { ...entry, sha256: (0, json_ownership_js_1.hashOwnedContent)(contents, entry) };
81
- }),
82
- }));
69
+ restampOwnershipRecord(tree, {
70
+ label: 'Workspace',
71
+ ownershipPath: '.ebk/ownership.json',
72
+ pathLabel: 'workspace',
73
+ root: '',
74
+ validate: workspace_record_js_1.validateWorkspaceOwnershipRecord,
75
+ });
76
+ }
77
+ function restampSiteOwnership(tree) {
78
+ restampOwnershipRecord(tree, {
79
+ label: 'Root site',
80
+ ownershipPath: site_record_js_1.SITE_OWNERSHIP_PATH,
81
+ pathLabel: 'root site',
82
+ root: node_path_1.posix.dirname(node_path_1.posix.dirname(site_record_js_1.SITE_OWNERSHIP_PATH)),
83
+ sortPaths: true,
84
+ validate: site_record_js_1.validateSiteOwnershipRecord,
85
+ });
83
86
  }
84
87
  function recordCompositionOwnership(tree, options) {
85
88
  const root = node_path_1.posix.join('packages', options.slice);
@@ -127,6 +130,11 @@ function recordCompositionOwnership(tree, options) {
127
130
  if (previous && previous.feature !== composition.feature) {
128
131
  throw new Error(`Composition ${composition.kind} ${composition.name} is already bound to feature ${previous.feature}.`);
129
132
  }
133
+ if (previous &&
134
+ previous.authentication !== composition.authentication &&
135
+ options.allowAccessChange !== true) {
136
+ throw new Error(`Composition ${composition.kind} ${composition.name} is recorded as ${previous.authentication ?? 'signed-in'}; only function-access changes who may call it.`);
137
+ }
130
138
  compositions.set(identity, composition);
131
139
  }
132
140
  const ownership = {
@@ -3,4 +3,5 @@ export * from './foundation-record.js';
3
3
  export * from './hash.js';
4
4
  export * from './json-ownership.js';
5
5
  export * from './record.js';
6
+ export * from './site-record.js';
6
7
  export * from './workspace-record.js';
@@ -6,5 +6,6 @@ tslib_1.__exportStar(require("./foundation-record.js"), exports);
6
6
  tslib_1.__exportStar(require("./hash.js"), exports);
7
7
  tslib_1.__exportStar(require("./json-ownership.js"), exports);
8
8
  tslib_1.__exportStar(require("./record.js"), exports);
9
+ tslib_1.__exportStar(require("./site-record.js"), exports);
9
10
  tslib_1.__exportStar(require("./workspace-record.js"), exports);
10
11
  //# sourceMappingURL=index.js.map
@@ -7,7 +7,14 @@ export declare const GENERATED_COMPOSITION_KINDS: readonly ["function", "job", "
7
7
  export type GeneratedPathMode = (typeof GENERATED_PATH_MODES)[number];
8
8
  export type GeneratedPathOrigin = (typeof GENERATED_PATH_ORIGINS)[number];
9
9
  export type GeneratedCompositionKind = (typeof GENERATED_COMPOSITION_KINDS)[number];
10
+ /**
11
+ * A Function's recorded access. Only an anonymous Function records it; an
12
+ * absent field means signed-in, so every Function recorded before the field
13
+ * existed requires a signed-in caller.
14
+ */
15
+ export declare const ANONYMOUS_FUNCTION_AUTHENTICATION = "anonymous";
10
16
  export interface GeneratedCompositionOwnership {
17
+ authentication?: typeof ANONYMOUS_FUNCTION_AUTHENTICATION;
11
18
  feature: string;
12
19
  kind: GeneratedCompositionKind;
13
20
  name: string;
@@ -78,7 +85,19 @@ export declare const generatedOwnershipSchema: {
78
85
  readonly compositions: {
79
86
  readonly items: {
80
87
  readonly additionalProperties: false;
88
+ readonly dependentSchemas: {
89
+ readonly authentication: {
90
+ readonly properties: {
91
+ readonly kind: {
92
+ readonly const: "function";
93
+ };
94
+ };
95
+ };
96
+ };
81
97
  readonly properties: {
98
+ readonly authentication: {
99
+ readonly const: "anonymous";
100
+ };
82
101
  readonly feature: {
83
102
  readonly pattern: string;
84
103
  readonly type: "string";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generatedOwnershipSchema = exports.managedJsonPointersSchema = exports.GENERATED_COMPOSITION_KINDS = exports.GENERATED_PATH_ORIGINS = exports.GENERATED_PATH_MODES = exports.GENERATED_OWNERSHIP_SCHEMA_VERSION = void 0;
3
+ exports.generatedOwnershipSchema = exports.managedJsonPointersSchema = exports.ANONYMOUS_FUNCTION_AUTHENTICATION = exports.GENERATED_COMPOSITION_KINDS = exports.GENERATED_PATH_ORIGINS = exports.GENERATED_PATH_MODES = exports.GENERATED_OWNERSHIP_SCHEMA_VERSION = void 0;
4
4
  exports.validateManagedJsonPointers = validateManagedJsonPointers;
5
5
  exports.validateGeneratedOwnershipRecord = validateGeneratedOwnershipRecord;
6
6
  const index_js_1 = require("../foundation/index.js");
@@ -19,6 +19,12 @@ exports.GENERATED_COMPOSITION_KINDS = [
19
19
  'job',
20
20
  'service',
21
21
  ];
22
+ /**
23
+ * A Function's recorded access. Only an anonymous Function records it; an
24
+ * absent field means signed-in, so every Function recorded before the field
25
+ * existed requires a signed-in caller.
26
+ */
27
+ exports.ANONYMOUS_FUNCTION_AUTHENTICATION = 'anonymous';
22
28
  function validateManagedJsonPointers(entry, path, issues) {
23
29
  if (entry.managedJsonPointers === undefined)
24
30
  return;
@@ -80,13 +86,27 @@ function validateCompositions(value, paths, issues) {
80
86
  return;
81
87
  }
82
88
  for (const key of Object.keys(entry)) {
83
- if (!['feature', 'kind', 'name'].includes(key)) {
89
+ if (!['authentication', 'feature', 'kind', 'name'].includes(key)) {
84
90
  issues.push({
85
91
  message: 'is not an allowed property',
86
92
  path: `${path}.${key}`,
87
93
  });
88
94
  }
89
95
  }
96
+ if (entry.authentication !== undefined) {
97
+ if (entry.kind !== 'function') {
98
+ issues.push({
99
+ message: 'is recorded only for a function',
100
+ path: `${path}.authentication`,
101
+ });
102
+ }
103
+ else if (entry.authentication !== exports.ANONYMOUS_FUNCTION_AUTHENTICATION) {
104
+ issues.push({
105
+ message: 'must equal anonymous; a signed-in function records no authentication',
106
+ path: `${path}.authentication`,
107
+ });
108
+ }
109
+ }
90
110
  if (typeof entry.feature !== 'string' ||
91
111
  !compositionNamePattern.test(entry.feature)) {
92
112
  issues.push({
@@ -368,7 +388,11 @@ exports.generatedOwnershipSchema = {
368
388
  compositions: {
369
389
  items: {
370
390
  additionalProperties: false,
391
+ dependentSchemas: {
392
+ authentication: { properties: { kind: { const: 'function' } } },
393
+ },
371
394
  properties: {
395
+ authentication: { const: exports.ANONYMOUS_FUNCTION_AUTHENTICATION },
372
396
  feature: {
373
397
  pattern: compositionNamePattern.source,
374
398
  type: 'string',
@@ -0,0 +1,18 @@
1
+ import { type ValidationResult } from '../validation.js';
2
+ import { type GeneratedPathOwnership } from './record.js';
3
+ /**
4
+ * Ownership of the workspace root site at packages/site. The record is told
5
+ * apart from a Product Slice record by its kind: a Slice record names its
6
+ * Slice and has no kind. It keeps the generated schema version, so workspace
7
+ * health and every hash-checking scanner read it with the same rules.
8
+ */
9
+ export declare const SITE_OWNERSHIP_SCHEMA_VERSION: 2;
10
+ export declare const SITE_OWNERSHIP_PATH: "packages/site/.ebk/ownership.json";
11
+ export interface SiteOwnershipRecord {
12
+ frameworkVersion: string;
13
+ kind: 'site';
14
+ paths: GeneratedPathOwnership[];
15
+ schemaVersion: typeof SITE_OWNERSHIP_SCHEMA_VERSION;
16
+ }
17
+ export declare function isSiteOwnershipRecord(value: unknown): boolean;
18
+ export declare function validateSiteOwnershipRecord(value: unknown): ValidationResult<SiteOwnershipRecord>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SITE_OWNERSHIP_PATH = exports.SITE_OWNERSHIP_SCHEMA_VERSION = void 0;
4
+ exports.isSiteOwnershipRecord = isSiteOwnershipRecord;
5
+ exports.validateSiteOwnershipRecord = validateSiteOwnershipRecord;
6
+ const validation_js_1 = require("../validation.js");
7
+ const hash_js_1 = require("./hash.js");
8
+ const record_js_1 = require("./record.js");
9
+ /**
10
+ * Ownership of the workspace root site at packages/site. The record is told
11
+ * apart from a Product Slice record by its kind: a Slice record names its
12
+ * Slice and has no kind. It keeps the generated schema version, so workspace
13
+ * health and every hash-checking scanner read it with the same rules.
14
+ */
15
+ exports.SITE_OWNERSHIP_SCHEMA_VERSION = 2;
16
+ exports.SITE_OWNERSHIP_PATH = 'packages/site/.ebk/ownership.json';
17
+ function isSafeSitePath(value) {
18
+ return (value !== '' &&
19
+ !value.startsWith('/') &&
20
+ !value.startsWith('\\') &&
21
+ !value.split(/[\\/]/).includes('..'));
22
+ }
23
+ function isSiteOwnershipRecord(value) {
24
+ return (0, validation_js_1.isRecord)(value) && value.kind === 'site';
25
+ }
26
+ function validateSiteOwnershipRecord(value) {
27
+ if (!(0, validation_js_1.isRecord)(value)) {
28
+ return {
29
+ valid: false,
30
+ issues: [{ message: 'must be an object', path: 'ownership' }],
31
+ };
32
+ }
33
+ const issues = [];
34
+ for (const key of Object.keys(value)) {
35
+ if (!['frameworkVersion', 'kind', 'paths', 'schemaVersion'].includes(key)) {
36
+ issues.push({
37
+ message: 'is not an allowed property',
38
+ path: `ownership.${key}`,
39
+ });
40
+ }
41
+ }
42
+ if (value.schemaVersion !== exports.SITE_OWNERSHIP_SCHEMA_VERSION) {
43
+ issues.push({ message: 'must equal 2', path: 'ownership.schemaVersion' });
44
+ }
45
+ if (value.kind !== 'site') {
46
+ issues.push({ message: 'must equal site', path: 'ownership.kind' });
47
+ }
48
+ if (typeof value.frameworkVersion !== 'string' ||
49
+ value.frameworkVersion.trim() === '') {
50
+ issues.push({
51
+ message: 'must be a non-empty string',
52
+ path: 'ownership.frameworkVersion',
53
+ });
54
+ }
55
+ if (!Array.isArray(value.paths)) {
56
+ issues.push({ message: 'must be an array', path: 'ownership.paths' });
57
+ }
58
+ else {
59
+ const seen = new Set();
60
+ value.paths.forEach((entry, index) => {
61
+ const entryPath = `ownership.paths[${index}]`;
62
+ if (!(0, validation_js_1.isRecord)(entry)) {
63
+ issues.push({ message: 'must be an object', path: entryPath });
64
+ return;
65
+ }
66
+ if (typeof entry.path !== 'string' || !isSafeSitePath(entry.path)) {
67
+ issues.push({
68
+ message: 'must be a safe site-relative path',
69
+ path: `${entryPath}.path`,
70
+ });
71
+ }
72
+ else if (seen.has(entry.path)) {
73
+ issues.push({
74
+ message: 'must not duplicate a path',
75
+ path: `${entryPath}.path`,
76
+ });
77
+ }
78
+ else {
79
+ seen.add(entry.path);
80
+ }
81
+ if (!record_js_1.GENERATED_PATH_MODES.includes(entry.mode)) {
82
+ issues.push({
83
+ message: 'must equal managed or seeded',
84
+ path: `${entryPath}.mode`,
85
+ });
86
+ }
87
+ if (entry.origin !== 'framework') {
88
+ issues.push({
89
+ message: 'must equal framework',
90
+ path: `${entryPath}.origin`,
91
+ });
92
+ }
93
+ if (typeof entry.sha256 !== 'string' ||
94
+ !hash_js_1.GENERATED_CONTENT_HASH_PATTERN.test(entry.sha256)) {
95
+ issues.push({
96
+ message: 'must be a lowercase SHA-256 digest',
97
+ path: `${entryPath}.sha256`,
98
+ });
99
+ }
100
+ (0, record_js_1.validateManagedJsonPointers)(entry, entryPath, issues);
101
+ });
102
+ }
103
+ return (0, validation_js_1.validationResult)(value, issues);
104
+ }
105
+ //# sourceMappingURL=site-record.js.map
@@ -17,6 +17,9 @@ export interface ProtectedDeploymentPlan {
17
17
  foundationProject?: string;
18
18
  orderedProjects: string[];
19
19
  productionApprovalMode: ProductionApprovalMode;
20
+ /** The workspace root site, deployed after the Foundation. It is never
21
+ * a Slice project, so it takes no release-candidate or container path. */
22
+ siteProject?: string;
20
23
  sliceProjects: string[];
21
24
  stage: ProtectedDeploymentStage;
22
25
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROTECTED_DEPLOYMENT_STAGES = exports.PROTECTED_DEPLOYMENT_ACTIONS = void 0;
4
4
  exports.createProtectedDeploymentPlan = createProtectedDeploymentPlan;
5
+ const root_site_js_1 = require("../foundation/root-site.js");
5
6
  const policy_js_1 = require("./policy.js");
6
7
  exports.PROTECTED_DEPLOYMENT_ACTIONS = [
7
8
  'deploy',
@@ -51,19 +52,28 @@ function createProtectedDeploymentPlan(policy, options) {
51
52
  .filter((project) => hasTag(project, 'type:slice') &&
52
53
  supportsAction(project, options.action))
53
54
  .sort(compareCodePoints);
55
+ const sites = options.projects.filter((project) => hasTag(project, 'type:site') && supportsAction(project, options.action));
56
+ if (sites.length > 1 || sites.some(({ name }) => name !== root_site_js_1.ROOT_SITE_NAME)) {
57
+ throw new Error(`Protected deployment planning accepts one root site, the ${root_site_js_1.ROOT_SITE_NAME} project.`);
58
+ }
59
+ const site = sites[0];
54
60
  if (options.action === 'remove' || options.action === 'unlock') {
55
61
  if (!options.requestedProject) {
56
62
  throw new Error(`Protected ${options.action} requires one explicit registered --project; batch recovery is not implicit.`);
57
63
  }
58
- const selected = [foundation, ...slices].find(({ name }) => name === options.requestedProject);
64
+ const selected = [foundation, ...(site ? [site] : []), ...slices].find(({ name }) => name === options.requestedProject);
59
65
  if (!selected) {
60
- throw new Error(`Protected ${options.action} project ${options.requestedProject} is not a registered Foundation or Product Slice with that target.`);
66
+ throw new Error(`Protected ${options.action} project ${options.requestedProject} is not a registered Foundation, root site or Product Slice with that target.`);
61
67
  }
62
68
  const decision = (0, policy_js_1.evaluateRepositoryPolicyRequest)(policy, {
63
69
  action: options.action,
64
70
  projects: [
65
71
  {
66
- kind: selected === foundation ? 'foundation' : 'slice',
72
+ kind: selected === foundation
73
+ ? 'foundation'
74
+ : selected === site
75
+ ? 'site'
76
+ : 'slice',
67
77
  name: selected.name,
68
78
  },
69
79
  ],
@@ -87,13 +97,18 @@ function createProtectedDeploymentPlan(policy, options) {
87
97
  : {}),
88
98
  orderedProjects: [selected.name],
89
99
  productionApprovalMode: policy.productionApproval.mode,
90
- sliceProjects: selected === foundation ? [] : [selected.name],
100
+ ...(selected === site ? { siteProject: site.name } : {}),
101
+ sliceProjects: selected === foundation || selected === site ? [] : [selected.name],
91
102
  stage: options.stage,
92
103
  };
93
104
  }
94
105
  if (options.requestedProject) {
95
106
  throw new Error(`Protected ${options.action} derives its complete project set from committed policy; --project cannot narrow or expand it.`);
96
107
  }
108
+ // site is reserved for the root site; only its remove stays planned.
109
+ if (slices.some(({ name }) => name === root_site_js_1.ROOT_SITE_NAME)) {
110
+ throw new Error(`Product Slice ${root_site_js_1.ROOT_SITE_NAME} cannot ${options.action}: ${root_site_js_1.ROOT_SITE_NAME} is reserved for the workspace root site. ${root_site_js_1.ROOT_SITE_RENAME_GUIDANCE}`);
111
+ }
97
112
  const selectedSlices = options.stage === 'production'
98
113
  ? slices.filter(({ name }) => {
99
114
  const status = policy.slices[name]?.productionStatus;
@@ -107,6 +122,9 @@ function createProtectedDeploymentPlan(policy, options) {
107
122
  if (missingPolicyEntries.length > 0) {
108
123
  throw new Error(`Registered Product Slices are missing explicit blocked, pilot, or ready production policy entries: ${missingPolicyEntries.join(', ')}.`);
109
124
  }
125
+ if (site && policy.site === undefined) {
126
+ throw new Error('The registered root site is missing an explicit blocked or ready production policy member: site.productionStatus.');
127
+ }
110
128
  for (const [name, entry] of Object.entries(policy.slices)) {
111
129
  if ((entry.productionStatus === 'pilot' ||
112
130
  entry.productionStatus === 'ready') &&
@@ -115,8 +133,17 @@ function createProtectedDeploymentPlan(policy, options) {
115
133
  }
116
134
  }
117
135
  }
136
+ // Production deploys the root site only while its policy says ready.
137
+ const selectedSite = site &&
138
+ (options.stage !== 'production' ||
139
+ policy.site?.productionStatus === 'ready')
140
+ ? site
141
+ : undefined;
118
142
  const selectedProjects = [
119
143
  { kind: 'foundation', name: foundation.name },
144
+ ...(selectedSite
145
+ ? [{ kind: 'site', name: selectedSite.name }]
146
+ : []),
120
147
  ...selectedSlices.map(({ name }) => ({ kind: 'slice', name })),
121
148
  ];
122
149
  const decision = (0, policy_js_1.evaluateRepositoryPolicyRequest)(policy, {
@@ -140,9 +167,11 @@ function createProtectedDeploymentPlan(policy, options) {
140
167
  foundationProject: foundation.name,
141
168
  orderedProjects: [
142
169
  foundation.name,
170
+ ...(selectedSite ? [selectedSite.name] : []),
143
171
  ...selectedSlices.map(({ name }) => name),
144
172
  ],
145
173
  productionApprovalMode: policy.productionApproval.mode,
174
+ ...(selectedSite ? { siteProject: selectedSite.name } : {}),
146
175
  sliceProjects: selectedSlices.map(({ name }) => name),
147
176
  stage: options.stage,
148
177
  };
@@ -2,3 +2,4 @@ export * from './aurora-preflight.js';
2
2
  export * from './deployment-plan.js';
3
3
  export * from './foundation-profile.js';
4
4
  export * from './policy.js';
5
+ export * from './public-dns.js';
@@ -5,4 +5,5 @@ tslib_1.__exportStar(require("./aurora-preflight.js"), exports);
5
5
  tslib_1.__exportStar(require("./deployment-plan.js"), exports);
6
6
  tslib_1.__exportStar(require("./foundation-profile.js"), exports);
7
7
  tslib_1.__exportStar(require("./policy.js"), exports);
8
+ tslib_1.__exportStar(require("./public-dns.js"), exports);
8
9
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import { type ValidationIssue, type ValidationResult } from '../validation.js';
2
+ import { type RepositoryPublicDns } from './public-dns.js';
2
3
  export declare const REPOSITORY_POLICY_FILE: "ebk.repository-policy.json";
3
4
  export declare const REPOSITORY_POLICY_SCHEMA_VERSION: 1;
4
5
  export declare const REPOSITORY_POLICY_SCHEMA_URL: "./node_modules/@empire-builder-kit/nx/schemas/repository-policy-v1.json";
@@ -7,6 +8,8 @@ export declare const PRODUCTION_APPROVAL_MODES: readonly ["promotion-pr", "envir
7
8
  export declare const PRODUCTION_FOUNDATION_PROFILES: readonly ["cost-optimized", "balanced", "standard"];
8
9
  export declare const DEFAULT_RECOVERY_PRODUCTION_FOUNDATION_PROFILE: "standard";
9
10
  export declare const SLICE_PRODUCTION_STATUSES: readonly ["blocked", "pilot", "ready"];
11
+ /** The root site has no pilot posture: production serves it or skips it. */
12
+ export declare const ROOT_SITE_PRODUCTION_STATUSES: readonly ["blocked", "ready"];
10
13
  export declare const REPOSITORY_MODE_PRESETS: readonly ["incubation", "controlled-production", "operational"];
11
14
  export declare const DEPLOYMENT_PROFILES: readonly ["starter", "production-isolated", "fully-isolated"];
12
15
  /** How work reaches production. protected-pair keeps develop and main with a
@@ -22,6 +25,7 @@ export type ProductionAccess = (typeof PRODUCTION_ACCESS_VALUES)[number];
22
25
  export type ProductionApprovalMode = (typeof PRODUCTION_APPROVAL_MODES)[number];
23
26
  export type ProductionFoundationProfile = (typeof PRODUCTION_FOUNDATION_PROFILES)[number];
24
27
  export type SliceProductionStatus = (typeof SLICE_PRODUCTION_STATUSES)[number];
28
+ export type RootSiteProductionStatus = (typeof ROOT_SITE_PRODUCTION_STATUSES)[number];
25
29
  export type RepositoryModePreset = (typeof REPOSITORY_MODE_PRESETS)[number];
26
30
  export type DeploymentProfile = (typeof DEPLOYMENT_PROFILES)[number];
27
31
  export type CanonicalDeploymentStage = 'development' | 'staging' | 'production';
@@ -54,10 +58,16 @@ export interface RepositoryOperatingPolicy {
54
58
  productionApproval: {
55
59
  mode: ProductionApprovalMode;
56
60
  };
61
+ /** Optional per-stage public Route 53 binding (aws partition only). */
62
+ publicDns?: RepositoryPublicDns;
57
63
  productionFoundation: {
58
64
  profile: ProductionFoundationProfile;
59
65
  };
60
66
  schemaVersion: typeof REPOSITORY_POLICY_SCHEMA_VERSION;
67
+ /** Optional production posture of the workspace root site; absent is blocked. */
68
+ site?: {
69
+ productionStatus: RootSiteProductionStatus;
70
+ };
61
71
  slices: Record<string, {
62
72
  productionStatus: SliceProductionStatus;
63
73
  }>;
@@ -74,7 +84,7 @@ export interface RepositoryOperatingPolicy {
74
84
  }
75
85
  export type RepositoryPolicyLifecycleAction = 'deploy' | 'dev' | 'migrate' | 'refresh' | 'remove' | 'unlock';
76
86
  export interface RepositoryPolicyProject {
77
- kind: 'foundation' | 'slice';
87
+ kind: 'foundation' | 'site' | 'slice';
78
88
  name: string;
79
89
  }
80
90
  export interface RepositoryPolicyRequest {
@@ -96,6 +106,7 @@ export interface RepositoryPolicyChange {
96
106
  productionAccess?: ProductionAccess;
97
107
  productionApprovalMode?: ProductionApprovalMode;
98
108
  productionFoundationProfile?: ProductionFoundationProfile;
109
+ site?: RootSiteProductionStatus;
99
110
  slices?: Readonly<Record<string, SliceProductionStatus>>;
100
111
  }
101
112
  export declare function validateRepositoryOperatingPolicy(value: unknown): ValidationResult<RepositoryOperatingPolicy>;
@@ -109,5 +120,6 @@ export declare function validateRepositoryOperatingPolicyMigrationProvenance(inp
109
120
  export declare function readRepositoryOperatingPolicy(workspaceRoot: string): RepositoryOperatingPolicy;
110
121
  export declare function createIncubationRepositoryPolicy(deploymentProfile?: DeploymentProfile, workspaceDeploymentId?: string): RepositoryOperatingPolicy;
111
122
  export declare function applyRepositoryPolicyChange(current: RepositoryOperatingPolicy, change: RepositoryPolicyChange): RepositoryOperatingPolicy;
123
+ export declare function rootSiteProductionStatus(policy: Pick<RepositoryOperatingPolicy, 'site'>): RootSiteProductionStatus;
112
124
  export declare function evaluateRepositoryPolicyRequest(policy: RepositoryOperatingPolicy, request: RepositoryPolicyRequest): RepositoryPolicyDecision;
113
125
  export declare function assertRepositoryPolicyRequest(workspaceRoot: string, request: RepositoryPolicyRequest): RepositoryPolicyDecision;