wabachi 0.1.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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -0
  3. package/dist/architecture/canon/authority.d.ts +35 -0
  4. package/dist/architecture/canon/authority.js +76 -0
  5. package/dist/architecture/canon/authority.js.map +1 -0
  6. package/dist/architecture/canon/boundaries.d.ts +31 -0
  7. package/dist/architecture/canon/boundaries.js +73 -0
  8. package/dist/architecture/canon/boundaries.js.map +1 -0
  9. package/dist/architecture/canon/codec.d.ts +10 -0
  10. package/dist/architecture/canon/codec.js +516 -0
  11. package/dist/architecture/canon/codec.js.map +1 -0
  12. package/dist/architecture/canon/constraints.d.ts +60 -0
  13. package/dist/architecture/canon/constraints.js +116 -0
  14. package/dist/architecture/canon/constraints.js.map +1 -0
  15. package/dist/architecture/canon/decisions.d.ts +62 -0
  16. package/dist/architecture/canon/decisions.js +192 -0
  17. package/dist/architecture/canon/decisions.js.map +1 -0
  18. package/dist/architecture/canon/deployment.d.ts +89 -0
  19. package/dist/architecture/canon/deployment.js +156 -0
  20. package/dist/architecture/canon/deployment.js.map +1 -0
  21. package/dist/architecture/canon/document.d.ts +60 -0
  22. package/dist/architecture/canon/document.js +106 -0
  23. package/dist/architecture/canon/document.js.map +1 -0
  24. package/dist/architecture/canon/elements.d.ts +21 -0
  25. package/dist/architecture/canon/elements.js +87 -0
  26. package/dist/architecture/canon/elements.js.map +1 -0
  27. package/dist/architecture/canon/flows.d.ts +37 -0
  28. package/dist/architecture/canon/flows.js +82 -0
  29. package/dist/architecture/canon/flows.js.map +1 -0
  30. package/dist/architecture/canon/identity.d.ts +45 -0
  31. package/dist/architecture/canon/identity.js +83 -0
  32. package/dist/architecture/canon/identity.js.map +1 -0
  33. package/dist/architecture/canon/relationships.d.ts +48 -0
  34. package/dist/architecture/canon/relationships.js +181 -0
  35. package/dist/architecture/canon/relationships.js.map +1 -0
  36. package/dist/architecture/canon/repository-mappings.d.ts +51 -0
  37. package/dist/architecture/canon/repository-mappings.js +134 -0
  38. package/dist/architecture/canon/repository-mappings.js.map +1 -0
  39. package/dist/architecture/canon/responsibilities.d.ts +40 -0
  40. package/dist/architecture/canon/responsibilities.js +89 -0
  41. package/dist/architecture/canon/responsibilities.js.map +1 -0
  42. package/dist/architecture/canon/validate.d.ts +14 -0
  43. package/dist/architecture/canon/validate.js +389 -0
  44. package/dist/architecture/canon/validate.js.map +1 -0
  45. package/dist/architecture/canon/views.d.ts +101 -0
  46. package/dist/architecture/canon/views.js +182 -0
  47. package/dist/architecture/canon/views.js.map +1 -0
  48. package/dist/architecture/cli.d.ts +2 -0
  49. package/dist/architecture/cli.js +158 -0
  50. package/dist/architecture/cli.js.map +1 -0
  51. package/dist/architecture/documentation/html.d.ts +3 -0
  52. package/dist/architecture/documentation/html.js +143 -0
  53. package/dist/architecture/documentation/html.js.map +1 -0
  54. package/dist/architecture/documentation/model.d.ts +46 -0
  55. package/dist/architecture/documentation/model.js +13 -0
  56. package/dist/architecture/documentation/model.js.map +1 -0
  57. package/dist/architecture/documentation/project.d.ts +4 -0
  58. package/dist/architecture/documentation/project.js +166 -0
  59. package/dist/architecture/documentation/project.js.map +1 -0
  60. package/dist/architecture/documentation/site.d.ts +43 -0
  61. package/dist/architecture/documentation/site.js +147 -0
  62. package/dist/architecture/documentation/site.js.map +1 -0
  63. package/dist/architecture/projection/structurizr-export.d.ts +65 -0
  64. package/dist/architecture/projection/structurizr-export.js +136 -0
  65. package/dist/architecture/projection/structurizr-export.js.map +1 -0
  66. package/dist/architecture/projection/structurizr.d.ts +34 -0
  67. package/dist/architecture/projection/structurizr.js +667 -0
  68. package/dist/architecture/projection/structurizr.js.map +1 -0
  69. package/dist/cli.d.ts +1 -0
  70. package/dist/cli.js +143 -0
  71. package/dist/cli.js.map +1 -0
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.js +6 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/runtime/correlation.d.ts +143 -0
  76. package/dist/runtime/correlation.js +919 -0
  77. package/dist/runtime/correlation.js.map +1 -0
  78. package/dist/runtime/facts.d.ts +138 -0
  79. package/dist/runtime/facts.js +614 -0
  80. package/dist/runtime/facts.js.map +1 -0
  81. package/dist/runtime/fixtureProvider.d.ts +10 -0
  82. package/dist/runtime/fixtureProvider.js +30 -0
  83. package/dist/runtime/fixtureProvider.js.map +1 -0
  84. package/dist/runtime/graftProvider.d.ts +8 -0
  85. package/dist/runtime/graftProvider.js +107 -0
  86. package/dist/runtime/graftProvider.js.map +1 -0
  87. package/dist/runtime/graftWiring.d.ts +30 -0
  88. package/dist/runtime/graftWiring.js +3 -0
  89. package/dist/runtime/graftWiring.js.map +1 -0
  90. package/dist/runtime/manifest.d.ts +17 -0
  91. package/dist/runtime/manifest.js +39 -0
  92. package/dist/runtime/manifest.js.map +1 -0
  93. package/dist/runtime/matrix.d.ts +337 -0
  94. package/dist/runtime/matrix.js +1485 -0
  95. package/dist/runtime/matrix.js.map +1 -0
  96. package/dist/runtime/observation.d.ts +36 -0
  97. package/dist/runtime/observation.js +3 -0
  98. package/dist/runtime/observation.js.map +1 -0
  99. package/dist/runtime/provider.d.ts +34 -0
  100. package/dist/runtime/provider.js +2 -0
  101. package/dist/runtime/provider.js.map +1 -0
  102. package/dist/runtime/repository.d.ts +20 -0
  103. package/dist/runtime/repository.js +55 -0
  104. package/dist/runtime/repository.js.map +1 -0
  105. package/dist/runtime/run.d.ts +21 -0
  106. package/dist/runtime/run.js +80 -0
  107. package/dist/runtime/run.js.map +1 -0
  108. package/dist/runtime/scipProvider.d.ts +11 -0
  109. package/dist/runtime/scipProvider.js +126 -0
  110. package/dist/runtime/scipProvider.js.map +1 -0
  111. package/dist/runtime/typescriptProvider.d.ts +10 -0
  112. package/dist/runtime/typescriptProvider.js +289 -0
  113. package/dist/runtime/typescriptProvider.js.map +1 -0
  114. package/dist/runtime/workflow.d.ts +30 -0
  115. package/dist/runtime/workflow.js +153 -0
  116. package/dist/runtime/workflow.js.map +1 -0
  117. package/package.json +72 -0
@@ -0,0 +1,116 @@
1
+ import { createObjectId } from "./identity.js";
2
+ /** The deliberately small set of declarative architecture constraints. */
3
+ export const CONSTRAINT_KINDS = [
4
+ "may-depend-on",
5
+ "must-not-depend-on",
6
+ "may-call",
7
+ "must-go-through",
8
+ "single-authority",
9
+ ];
10
+ function assertRecord(input, label) {
11
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
12
+ throw new TypeError(`${label} must be an object`);
13
+ }
14
+ }
15
+ function readObjectId(record, field, label) {
16
+ const value = record[field];
17
+ if (typeof value !== "string") {
18
+ throw new TypeError(`${label} ${field} must be a string`);
19
+ }
20
+ return createObjectId(value);
21
+ }
22
+ function isConstraintKind(value) {
23
+ return typeof value === "string" && CONSTRAINT_KINDS.includes(value);
24
+ }
25
+ function compareIds(left, right) {
26
+ if (left < right)
27
+ return -1;
28
+ if (left > right)
29
+ return 1;
30
+ return 0;
31
+ }
32
+ function compareConstraints(left, right) {
33
+ const kindOrder = compareIds(left.kind, right.kind);
34
+ if (kindOrder !== 0)
35
+ return kindOrder;
36
+ switch (left.kind) {
37
+ case "single-authority":
38
+ return compareIds(left.concern, right.concern);
39
+ case "must-go-through": {
40
+ const rightConstraint = right;
41
+ return (compareIds(left.source, rightConstraint.source) ||
42
+ compareIds(left.target, rightConstraint.target) ||
43
+ compareIds(left.through, rightConstraint.through));
44
+ }
45
+ default: {
46
+ const rightConstraint = right;
47
+ return compareIds(left.source, rightConstraint.source) || compareIds(left.target, rightConstraint.target);
48
+ }
49
+ }
50
+ }
51
+ function constraintKey(constraint) {
52
+ switch (constraint.kind) {
53
+ case "single-authority":
54
+ return `${constraint.kind}\u0000${constraint.concern}`;
55
+ case "must-go-through":
56
+ return `${constraint.kind}\u0000${constraint.source}\u0000${constraint.target}\u0000${constraint.through}`;
57
+ default:
58
+ return `${constraint.kind}\u0000${constraint.source}\u0000${constraint.target}`;
59
+ }
60
+ }
61
+ /** Create one typed, stable-ID constraint declaration without evaluating it. */
62
+ export function createConstraint(input) {
63
+ assertRecord(input, "constraint");
64
+ if (!isConstraintKind(input.kind)) {
65
+ throw new TypeError(`constraint kind is unsupported: ${String(input.kind)}`);
66
+ }
67
+ switch (input.kind) {
68
+ case "may-depend-on":
69
+ return Object.freeze({
70
+ kind: input.kind,
71
+ source: readObjectId(input, "source", "may-depend-on constraint"),
72
+ target: readObjectId(input, "target", "may-depend-on constraint"),
73
+ });
74
+ case "must-not-depend-on":
75
+ return Object.freeze({
76
+ kind: input.kind,
77
+ source: readObjectId(input, "source", "must-not-depend-on constraint"),
78
+ target: readObjectId(input, "target", "must-not-depend-on constraint"),
79
+ });
80
+ case "may-call":
81
+ return Object.freeze({
82
+ kind: input.kind,
83
+ source: readObjectId(input, "source", "may-call constraint"),
84
+ target: readObjectId(input, "target", "may-call constraint"),
85
+ });
86
+ case "must-go-through":
87
+ return Object.freeze({
88
+ kind: input.kind,
89
+ source: readObjectId(input, "source", "must-go-through constraint"),
90
+ target: readObjectId(input, "target", "must-go-through constraint"),
91
+ through: readObjectId(input, "through", "must-go-through constraint"),
92
+ });
93
+ case "single-authority":
94
+ return Object.freeze({
95
+ kind: input.kind,
96
+ concern: readObjectId(input, "concern", "single-authority constraint"),
97
+ });
98
+ }
99
+ }
100
+ /** Normalize declarative constraints into a frozen, deterministic set. */
101
+ export function createConstraints(inputs) {
102
+ if (!Array.isArray(inputs)) {
103
+ throw new TypeError("constraints must be an array");
104
+ }
105
+ const constraints = inputs.map(createConstraint).sort(compareConstraints);
106
+ const seen = new Set();
107
+ for (const constraint of constraints) {
108
+ const key = constraintKey(constraint);
109
+ if (seen.has(key)) {
110
+ throw new Error(`duplicate constraint: ${key.replaceAll("\u0000", " -> ")}`);
111
+ }
112
+ seen.add(key);
113
+ }
114
+ return Object.freeze(constraints);
115
+ }
116
+ //# sourceMappingURL=constraints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraints.js","sourceRoot":"","sources":["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,QAAQ,EAAE,4BAA4B,CAAC;gBACnE,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,4BAA4B,CAAC;aACtE,CAAC,CAAC;QACL,KAAK,kBAAkB;YACrB,OAAO,MAAM,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,6BAA6B,CAAC;aACvE,CAAC,CAAC;IACP,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,iBAAiB,CAAC,MAA8C;IAC9E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC1E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,62 @@
1
+ declare const DECISION_STATUSES: readonly ["proposed", "accepted", "rejected", "superseded"];
2
+ declare const DECISION_TYPES: readonly ["architecture", "constraint", "policy"];
3
+ export type DecisionStatus = (typeof DECISION_STATUSES)[number];
4
+ export type DecisionType = (typeof DECISION_TYPES)[number];
5
+ export interface ArchitectureReferenceInput {
6
+ readonly id: string;
7
+ readonly label: string;
8
+ readonly uri: string;
9
+ readonly description?: string;
10
+ }
11
+ export interface ArchitectureReference {
12
+ readonly id: string;
13
+ readonly label: string;
14
+ readonly uri: string;
15
+ readonly description?: string;
16
+ }
17
+ export interface ArchitectureDecisionInput {
18
+ readonly id: string;
19
+ readonly title: string;
20
+ readonly status: DecisionStatus;
21
+ readonly type: DecisionType;
22
+ readonly rationale: string;
23
+ readonly targetIds?: readonly string[];
24
+ readonly referenceIds?: readonly string[];
25
+ readonly supersedes?: readonly string[];
26
+ }
27
+ export interface ArchitectureDecision {
28
+ readonly id: string;
29
+ readonly title: string;
30
+ readonly status: DecisionStatus;
31
+ readonly type: DecisionType;
32
+ readonly rationale: string;
33
+ /** Canon IDs are intentionally opaque until complete-document validation. */
34
+ readonly targetIds: readonly string[];
35
+ readonly referenceIds: readonly string[];
36
+ readonly supersedes: readonly string[];
37
+ }
38
+ export interface ArchitectureReferenceAttachmentInput {
39
+ /** The target may be a canonical object or a document ID. Its existence is not checked here. */
40
+ readonly targetId: string;
41
+ readonly referenceIds: readonly string[];
42
+ }
43
+ export interface ArchitectureReferenceAttachment {
44
+ readonly targetId: string;
45
+ readonly referenceIds: readonly string[];
46
+ }
47
+ export interface ArchitectureDecisionsInput {
48
+ readonly decisions?: readonly ArchitectureDecisionInput[];
49
+ readonly references?: readonly ArchitectureReferenceInput[];
50
+ readonly referenceAttachments?: readonly ArchitectureReferenceAttachmentInput[];
51
+ }
52
+ export interface ArchitectureDecisions {
53
+ readonly decisions: readonly ArchitectureDecision[];
54
+ readonly references: readonly ArchitectureReference[];
55
+ readonly referenceAttachments: readonly ArchitectureReferenceAttachment[];
56
+ }
57
+ /**
58
+ * Creates deterministic governance metadata for architecture decisions.
59
+ * Target IDs are normalized but deliberately not resolved against a canon document.
60
+ */
61
+ export declare function createArchitectureDecisions(input?: ArchitectureDecisionsInput): ArchitectureDecisions;
62
+ export {};
@@ -0,0 +1,192 @@
1
+ import { normalizeIdentityId } from "./identity.js";
2
+ const DECISION_STATUSES = ["proposed", "accepted", "rejected", "superseded"];
3
+ const DECISION_TYPES = ["architecture", "constraint", "policy"];
4
+ function normalizeText(value, label, allowEmpty = false) {
5
+ if (typeof value !== "string") {
6
+ throw new TypeError(`${label} must be a string`);
7
+ }
8
+ const normalized = value.normalize("NFC");
9
+ if ((!allowEmpty && normalized.trim().length === 0) || /[\p{Cc}\p{Cf}\p{Cs}]/u.test(normalized)) {
10
+ throw new TypeError(`${label} is malformed`);
11
+ }
12
+ return normalized;
13
+ }
14
+ function normalizeCanonId(value, label) {
15
+ if (typeof value !== "string") {
16
+ throw new TypeError(`${label} must be a string`);
17
+ }
18
+ try {
19
+ return normalizeIdentityId(value);
20
+ }
21
+ catch {
22
+ throw new TypeError(`${label} is malformed`);
23
+ }
24
+ }
25
+ function compareCanonical(left, right) {
26
+ if (left < right)
27
+ return -1;
28
+ if (left > right)
29
+ return 1;
30
+ return 0;
31
+ }
32
+ function sortStrings(values) {
33
+ return [...values].sort(compareCanonical);
34
+ }
35
+ function uniqueSortedIds(values, label) {
36
+ const normalized = values.map((value) => normalizeCanonId(value, label));
37
+ const result = sortStrings(normalized);
38
+ for (let index = 1; index < result.length; index += 1) {
39
+ if (result[index] === result[index - 1]) {
40
+ throw new Error(`duplicate ${label}: ${result[index]}`);
41
+ }
42
+ }
43
+ return Object.freeze(result);
44
+ }
45
+ function assertRecord(value, label) {
46
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
47
+ throw new TypeError(`${label} must be an object`);
48
+ }
49
+ }
50
+ function assertStringArray(value, label) {
51
+ if (!Array.isArray(value)) {
52
+ throw new TypeError(`${label} must be an array`);
53
+ }
54
+ }
55
+ function normalizeStatus(value) {
56
+ if (typeof value !== "string" || !DECISION_STATUSES.includes(value)) {
57
+ throw new TypeError(`decision status must be one of: ${DECISION_STATUSES.join(", ")}`);
58
+ }
59
+ return value;
60
+ }
61
+ function normalizeType(value) {
62
+ if (typeof value !== "string" || !DECISION_TYPES.includes(value)) {
63
+ throw new TypeError(`decision type must be one of: ${DECISION_TYPES.join(", ")}`);
64
+ }
65
+ return value;
66
+ }
67
+ function normalizeReference(input) {
68
+ assertRecord(input, "reference");
69
+ const description = input.description === undefined ? undefined : normalizeText(input.description, "reference description", true);
70
+ return Object.freeze({
71
+ id: normalizeCanonId(input.id, "reference id"),
72
+ label: normalizeText(input.label, "reference label"),
73
+ uri: normalizeText(input.uri, "reference uri"),
74
+ ...(description === undefined ? {} : { description }),
75
+ });
76
+ }
77
+ function normalizeDecision(input) {
78
+ assertRecord(input, "decision");
79
+ const targets = input.targetIds === undefined ? [] : input.targetIds;
80
+ const references = input.referenceIds === undefined ? [] : input.referenceIds;
81
+ const supersedes = input.supersedes === undefined ? [] : input.supersedes;
82
+ assertStringArray(targets, "decision targetIds");
83
+ assertStringArray(references, "decision referenceIds");
84
+ assertStringArray(supersedes, "decision supersedes");
85
+ return Object.freeze({
86
+ id: normalizeCanonId(input.id, "decision id"),
87
+ title: normalizeText(input.title, "decision title"),
88
+ status: normalizeStatus(input.status),
89
+ type: normalizeType(input.type),
90
+ rationale: normalizeText(input.rationale, "decision rationale"),
91
+ targetIds: uniqueSortedIds(targets, "decision target id"),
92
+ referenceIds: uniqueSortedIds(references, "decision reference id"),
93
+ supersedes: uniqueSortedIds(supersedes, "superseded decision id"),
94
+ });
95
+ }
96
+ function normalizeAttachment(input) {
97
+ assertRecord(input, "reference attachment");
98
+ const references = input.referenceIds;
99
+ assertStringArray(references, "reference attachment referenceIds");
100
+ return Object.freeze({
101
+ targetId: normalizeCanonId(input.targetId, "reference attachment target id"),
102
+ referenceIds: uniqueSortedIds(references, "reference attachment reference id"),
103
+ });
104
+ }
105
+ function assertUniqueIds(records, label) {
106
+ const seen = new Set();
107
+ for (const record of records) {
108
+ if (seen.has(record.id)) {
109
+ throw new Error(`duplicate ${label}: ${record.id}`);
110
+ }
111
+ seen.add(record.id);
112
+ }
113
+ }
114
+ function assertKnownReferences(decisions, references, attachments) {
115
+ const referenceIds = new Set(references.map((reference) => reference.id));
116
+ for (const decision of decisions) {
117
+ for (const referenceId of decision.referenceIds) {
118
+ if (!referenceIds.has(referenceId)) {
119
+ throw new Error(`decision ${decision.id} references unknown reference: ${referenceId}`);
120
+ }
121
+ }
122
+ }
123
+ for (const attachment of attachments) {
124
+ for (const referenceId of attachment.referenceIds) {
125
+ if (!referenceIds.has(referenceId)) {
126
+ throw new Error(`reference attachment for ${attachment.targetId} references unknown reference: ${referenceId}`);
127
+ }
128
+ }
129
+ }
130
+ }
131
+ function assertAcyclicSupersession(decisions) {
132
+ const decisionIds = new Set(decisions.map((decision) => decision.id));
133
+ const graph = new Map(decisions.map((decision) => [decision.id, decision.supersedes]));
134
+ for (const decision of decisions) {
135
+ for (const supersededId of decision.supersedes) {
136
+ if (!decisionIds.has(supersededId)) {
137
+ throw new Error(`decision ${decision.id} supersedes unknown decision: ${supersededId}`);
138
+ }
139
+ }
140
+ }
141
+ const visiting = new Set();
142
+ const visited = new Set();
143
+ const visit = (decisionId) => {
144
+ if (visiting.has(decisionId)) {
145
+ throw new Error(`decision supersession cycle includes: ${decisionId}`);
146
+ }
147
+ if (visited.has(decisionId))
148
+ return;
149
+ visiting.add(decisionId);
150
+ for (const supersededId of graph.get(decisionId) ?? [])
151
+ visit(supersededId);
152
+ visiting.delete(decisionId);
153
+ visited.add(decisionId);
154
+ };
155
+ for (const decision of decisions)
156
+ visit(decision.id);
157
+ }
158
+ /**
159
+ * Creates deterministic governance metadata for architecture decisions.
160
+ * Target IDs are normalized but deliberately not resolved against a canon document.
161
+ */
162
+ export function createArchitectureDecisions(input = {}) {
163
+ assertRecord(input, "architecture decisions");
164
+ const rawDecisions = input.decisions === undefined ? [] : input.decisions;
165
+ const rawReferences = input.references === undefined ? [] : input.references;
166
+ const rawAttachments = input.referenceAttachments === undefined ? [] : input.referenceAttachments;
167
+ assertStringArray(rawDecisions, "decisions");
168
+ assertStringArray(rawReferences, "references");
169
+ assertStringArray(rawAttachments, "referenceAttachments");
170
+ const decisions = [...rawDecisions].map(normalizeDecision).sort((left, right) => compareCanonical(left.id, right.id));
171
+ const references = [...rawReferences]
172
+ .map(normalizeReference)
173
+ .sort((left, right) => compareCanonical(left.id, right.id));
174
+ const referenceAttachments = [...rawAttachments]
175
+ .map(normalizeAttachment)
176
+ .sort((left, right) => compareCanonical(left.targetId, right.targetId));
177
+ assertUniqueIds(decisions, "decision id");
178
+ assertUniqueIds(references, "reference id");
179
+ for (let index = 1; index < referenceAttachments.length; index += 1) {
180
+ if (referenceAttachments[index].targetId === referenceAttachments[index - 1].targetId) {
181
+ throw new Error(`duplicate reference attachment target id: ${referenceAttachments[index].targetId}`);
182
+ }
183
+ }
184
+ assertKnownReferences(decisions, references, referenceAttachments);
185
+ assertAcyclicSupersession(decisions);
186
+ return Object.freeze({
187
+ decisions: Object.freeze(decisions),
188
+ references: Object.freeze(references),
189
+ referenceAttachments: Object.freeze(referenceAttachments),
190
+ });
191
+ }
192
+ //# sourceMappingURL=decisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decisions.js","sourceRoot":"","sources":["../../../src/architecture/canon/decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAU,CAAC;AACtF,MAAM,cAAc,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAC;AAiEzE,SAAS,aAAa,CAAC,KAAc,EAAE,KAAa,EAAE,UAAU,GAAG,KAAK;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,mBAAmB,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK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C5C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpE,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,oBAAoB,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACtF,MAAM,IAAI,KAAK,CAAC,6CAA6C,oBAAoB,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACvG,CAAC;IACH,CAAC;IACD,qBAAqB,CAAC,SAAS,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC;IACnE,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;QACrC,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { type ObjectId } from "./identity.js";
2
+ declare const runtimeEnvironmentIdBrand: unique symbol;
3
+ declare const deploymentNodeIdBrand: unique symbol;
4
+ declare const deploymentInstanceIdBrand: unique symbol;
5
+ declare const infrastructureReferenceIdBrand: unique symbol;
6
+ /** An identity in the deployment namespace, not an architecture object identity. */
7
+ export type RuntimeEnvironmentId = string & {
8
+ readonly [runtimeEnvironmentIdBrand]: never;
9
+ };
10
+ export type DeploymentNodeId = string & {
11
+ readonly [deploymentNodeIdBrand]: never;
12
+ };
13
+ export type DeploymentInstanceId = string & {
14
+ readonly [deploymentInstanceIdBrand]: never;
15
+ };
16
+ export type InfrastructureReferenceId = string & {
17
+ readonly [infrastructureReferenceIdBrand]: never;
18
+ };
19
+ export interface RuntimeEnvironmentInput {
20
+ readonly id: string;
21
+ readonly displayName?: string;
22
+ }
23
+ export interface RuntimeEnvironment {
24
+ readonly kind: "runtime-environment";
25
+ readonly id: RuntimeEnvironmentId;
26
+ readonly displayName?: string;
27
+ }
28
+ export interface DeploymentNodeInput {
29
+ readonly id: string;
30
+ readonly environmentId: string;
31
+ readonly displayName?: string;
32
+ }
33
+ export interface DeploymentNode {
34
+ readonly kind: "deployment-node";
35
+ readonly id: DeploymentNodeId;
36
+ readonly environmentId: RuntimeEnvironmentId;
37
+ readonly displayName?: string;
38
+ }
39
+ export interface DeploymentInstanceInput {
40
+ readonly id: string;
41
+ readonly nodeId: string;
42
+ readonly displayName?: string;
43
+ }
44
+ export interface DeploymentInstance {
45
+ readonly kind: "deployment-instance";
46
+ readonly id: DeploymentInstanceId;
47
+ readonly nodeId: DeploymentNodeId;
48
+ readonly displayName?: string;
49
+ }
50
+ export interface InfrastructureReferenceInput {
51
+ readonly id: string;
52
+ readonly reference: string;
53
+ }
54
+ export interface InfrastructureReference {
55
+ readonly kind: "infrastructure-reference";
56
+ readonly id: InfrastructureReferenceId;
57
+ /** An opaque declaration; resolving or provisioning it is out of scope. */
58
+ readonly reference: string;
59
+ }
60
+ export interface DeploymentMappingInput {
61
+ readonly softwareElementId: string;
62
+ readonly deploymentInstanceId: string;
63
+ }
64
+ export interface DeploymentMapping {
65
+ readonly kind: "deployment-mapping";
66
+ readonly softwareElementId: ObjectId;
67
+ readonly deploymentInstanceId: DeploymentInstanceId;
68
+ }
69
+ export interface DeploymentTopologyInput {
70
+ readonly runtimeEnvironments?: readonly RuntimeEnvironmentInput[];
71
+ readonly deploymentNodes?: readonly DeploymentNodeInput[];
72
+ readonly deploymentInstances?: readonly DeploymentInstanceInput[];
73
+ readonly infrastructureReferences?: readonly InfrastructureReferenceInput[];
74
+ readonly mappings?: readonly DeploymentMappingInput[];
75
+ }
76
+ export interface DeploymentTopology {
77
+ readonly runtimeEnvironments: readonly RuntimeEnvironment[];
78
+ readonly deploymentNodes: readonly DeploymentNode[];
79
+ readonly deploymentInstances: readonly DeploymentInstance[];
80
+ readonly infrastructureReferences: readonly InfrastructureReference[];
81
+ readonly mappings: readonly DeploymentMapping[];
82
+ }
83
+ export declare function createRuntimeEnvironment(input: RuntimeEnvironmentInput): RuntimeEnvironment;
84
+ export declare function createDeploymentNode(input: DeploymentNodeInput): DeploymentNode;
85
+ export declare function createDeploymentInstance(input: DeploymentInstanceInput): DeploymentInstance;
86
+ export declare function createInfrastructureReference(input: InfrastructureReferenceInput): InfrastructureReference;
87
+ export declare function createDeploymentMapping(input: DeploymentMappingInput): DeploymentMapping;
88
+ export declare function createDeploymentTopology(input: DeploymentTopologyInput): DeploymentTopology;
89
+ export {};
@@ -0,0 +1,156 @@
1
+ import { createObjectId, normalizeIdentityId } from "./identity.js";
2
+ function assertRecord(input, label) {
3
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
4
+ throw new TypeError(`${label} must be an object`);
5
+ }
6
+ }
7
+ function normalizeDeploymentId(value, label) {
8
+ if (typeof value !== "string") {
9
+ throw new TypeError(`${label} must be a string`);
10
+ }
11
+ const normalized = normalizeIdentityId(value);
12
+ return normalized;
13
+ }
14
+ function normalizeDisplayName(value, label) {
15
+ if (value === undefined)
16
+ return undefined;
17
+ if (typeof value !== "string") {
18
+ throw new TypeError(`${label} must be a string`);
19
+ }
20
+ return value.normalize("NFC");
21
+ }
22
+ function readDisplayName(input, label) {
23
+ return normalizeDisplayName(input.displayName, `${label} displayName`);
24
+ }
25
+ function asRuntimeEnvironmentId(value) {
26
+ return normalizeDeploymentId(value, "runtime environment id");
27
+ }
28
+ function asDeploymentNodeId(value) {
29
+ return normalizeDeploymentId(value, "deployment node id");
30
+ }
31
+ function asDeploymentInstanceId(value) {
32
+ return normalizeDeploymentId(value, "deployment instance id");
33
+ }
34
+ function asInfrastructureReferenceId(value) {
35
+ return normalizeDeploymentId(value, "infrastructure reference id");
36
+ }
37
+ function compareOrdinal(left, right) {
38
+ if (left < right)
39
+ return -1;
40
+ if (left > right)
41
+ return 1;
42
+ return 0;
43
+ }
44
+ function sortById(records) {
45
+ return [...records].sort((left, right) => compareOrdinal(left.id, right.id));
46
+ }
47
+ function rejectDuplicateIds(records, label) {
48
+ const seen = new Set();
49
+ for (const record of records) {
50
+ if (seen.has(record.id)) {
51
+ throw new Error(`duplicate ${label} id: ${record.id}`);
52
+ }
53
+ seen.add(record.id);
54
+ }
55
+ }
56
+ function freezeArray(records) {
57
+ return Object.freeze([...records]);
58
+ }
59
+ export function createRuntimeEnvironment(input) {
60
+ assertRecord(input, "runtime environment");
61
+ const candidate = input;
62
+ const displayName = readDisplayName(input, "runtime environment");
63
+ const record = {
64
+ kind: "runtime-environment",
65
+ id: asRuntimeEnvironmentId(candidate.id),
66
+ ...(displayName === undefined ? {} : { displayName }),
67
+ };
68
+ return Object.freeze(record);
69
+ }
70
+ export function createDeploymentNode(input) {
71
+ assertRecord(input, "deployment node");
72
+ const candidate = input;
73
+ const displayName = readDisplayName(input, "deployment node");
74
+ const record = {
75
+ kind: "deployment-node",
76
+ id: asDeploymentNodeId(candidate.id),
77
+ environmentId: asRuntimeEnvironmentId(candidate.environmentId),
78
+ ...(displayName === undefined ? {} : { displayName }),
79
+ };
80
+ return Object.freeze(record);
81
+ }
82
+ export function createDeploymentInstance(input) {
83
+ assertRecord(input, "deployment instance");
84
+ const candidate = input;
85
+ const displayName = readDisplayName(input, "deployment instance");
86
+ const record = {
87
+ kind: "deployment-instance",
88
+ id: asDeploymentInstanceId(candidate.id),
89
+ nodeId: asDeploymentNodeId(candidate.nodeId),
90
+ ...(displayName === undefined ? {} : { displayName }),
91
+ };
92
+ return Object.freeze(record);
93
+ }
94
+ export function createInfrastructureReference(input) {
95
+ assertRecord(input, "infrastructure reference");
96
+ const candidate = input;
97
+ const reference = normalizeDeploymentId(candidate.reference, "infrastructure reference");
98
+ const record = {
99
+ kind: "infrastructure-reference",
100
+ id: asInfrastructureReferenceId(candidate.id),
101
+ reference,
102
+ };
103
+ return Object.freeze(record);
104
+ }
105
+ export function createDeploymentMapping(input) {
106
+ assertRecord(input, "deployment mapping");
107
+ const candidate = input;
108
+ const record = {
109
+ kind: "deployment-mapping",
110
+ softwareElementId: createObjectId(normalizeDeploymentId(candidate.softwareElementId, "software element id")),
111
+ deploymentInstanceId: asDeploymentInstanceId(candidate.deploymentInstanceId),
112
+ };
113
+ return Object.freeze(record);
114
+ }
115
+ function readRecords(value, label, create) {
116
+ if (value === undefined)
117
+ return [];
118
+ if (!Array.isArray(value)) {
119
+ throw new TypeError(`${label} must be an array`);
120
+ }
121
+ return value.map((record) => create(record));
122
+ }
123
+ export function createDeploymentTopology(input) {
124
+ assertRecord(input, "deployment topology");
125
+ const candidate = input;
126
+ const runtimeEnvironments = readRecords(candidate.runtimeEnvironments, "runtime environments", createRuntimeEnvironment);
127
+ const deploymentNodes = readRecords(candidate.deploymentNodes, "deployment nodes", createDeploymentNode);
128
+ const deploymentInstances = readRecords(candidate.deploymentInstances, "deployment instances", createDeploymentInstance);
129
+ const infrastructureReferences = readRecords(candidate.infrastructureReferences, "infrastructure references", createInfrastructureReference);
130
+ const mappings = readRecords(candidate.mappings, "deployment mappings", createDeploymentMapping);
131
+ rejectDuplicateIds(runtimeEnvironments, "runtime environment");
132
+ rejectDuplicateIds(deploymentNodes, "deployment node");
133
+ rejectDuplicateIds(deploymentInstances, "deployment instance");
134
+ rejectDuplicateIds(infrastructureReferences, "infrastructure reference");
135
+ const mappingKeys = new Set();
136
+ for (const mapping of mappings) {
137
+ const key = `${mapping.softwareElementId}\u0000${mapping.deploymentInstanceId}`;
138
+ if (mappingKeys.has(key)) {
139
+ throw new Error(`duplicate deployment mapping: ${mapping.softwareElementId} -> ${mapping.deploymentInstanceId}`);
140
+ }
141
+ mappingKeys.add(key);
142
+ }
143
+ return Object.freeze({
144
+ runtimeEnvironments: freezeArray(sortById(runtimeEnvironments)),
145
+ deploymentNodes: freezeArray(sortById(deploymentNodes)),
146
+ deploymentInstances: freezeArray(sortById(deploymentInstances)),
147
+ infrastructureReferences: freezeArray(sortById(infrastructureReferences)),
148
+ mappings: freezeArray([...mappings].sort((left, right) => {
149
+ const softwareOrder = compareOrdinal(left.softwareElementId, right.softwareElementId);
150
+ if (softwareOrder !== 0)
151
+ return softwareOrder;
152
+ return compareOrdinal(left.deploymentInstanceId, right.deploymentInstanceId);
153
+ })),
154
+ });
155
+ }
156
+ //# sourceMappingURL=deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../../src/architecture/canon/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAiGnF,SAAS,YAAY,CAAC,KAAc,EAAE,KAAa;IACjD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc,EAAE,KAAa;IAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,mBAAmB,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc,EAAE,KAAa;IACzD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,mBAAmB,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,eAAe,CAAC,KAAa,EAAE,KAAa;IACnD,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