@ankhorage/studio 5.10.12 → 5.11.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/README.md +2 -1
- package/apm/update.json +1 -1
- package/dist/bindingSchemaModel.js +3 -0
- package/dist/bindingSchemaModel.js.map +1 -1
- package/dist/features/authoring-engine/adapters/inbound/AuthoringEditor.d.ts.map +1 -1
- package/dist/features/authoring-engine/adapters/inbound/AuthoringEditor.js +47 -1
- package/dist/features/authoring-engine/adapters/inbound/AuthoringEditor.js.map +1 -1
- package/dist/features/authoring-engine/adapters/outbound/resolveContractsAuthoringStructure.d.ts.map +1 -1
- package/dist/features/authoring-engine/adapters/outbound/resolveContractsAuthoringStructure.js +17 -11
- package/dist/features/authoring-engine/adapters/outbound/resolveContractsAuthoringStructure.js.map +1 -1
- package/dist/features/authoring-engine/application/use-cases/applyAuthoringMutationToStructure.d.ts +1 -1
- package/dist/features/authoring-engine/application/use-cases/applyAuthoringMutationToStructure.d.ts.map +1 -1
- package/dist/features/authoring-engine/application/use-cases/applyAuthoringMutationToStructure.js +183 -50
- package/dist/features/authoring-engine/application/use-cases/applyAuthoringMutationToStructure.js.map +1 -1
- package/dist/features/authoring-engine/application/use-cases/createInitialAuthoringValue.d.ts.map +1 -1
- package/dist/features/authoring-engine/application/use-cases/createInitialAuthoringValue.js +8 -0
- package/dist/features/authoring-engine/application/use-cases/createInitialAuthoringValue.js.map +1 -1
- package/dist/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.d.ts +4 -0
- package/dist/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.d.ts.map +1 -0
- package/dist/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.js +14 -0
- package/dist/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.js.map +1 -0
- package/dist/features/authoring-engine/application/use-cases/deriveAuthoringModel.d.ts.map +1 -1
- package/dist/features/authoring-engine/application/use-cases/deriveAuthoringModel.js +126 -24
- package/dist/features/authoring-engine/application/use-cases/deriveAuthoringModel.js.map +1 -1
- package/dist/features/authoring-engine/utils/isAuthoringCollectionKeyAllowed.d.ts +4 -0
- package/dist/features/authoring-engine/utils/isAuthoringCollectionKeyAllowed.d.ts.map +1 -0
- package/dist/features/authoring-engine/utils/isAuthoringCollectionKeyAllowed.js +7 -0
- package/dist/features/authoring-engine/utils/isAuthoringCollectionKeyAllowed.js.map +1 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringCollectionKey.d.ts +4 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringCollectionKey.d.ts.map +1 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringCollectionKey.js +11 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringCollectionKey.js.map +1 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringUnion.d.ts +17 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringUnion.d.ts.map +1 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringUnion.js +66 -0
- package/dist/features/authoring-engine/utils/resolveAuthoringUnion.js.map +1 -0
- package/dist/manifestState.d.ts.map +1 -1
- package/dist/manifestState.js +2 -5
- package/dist/manifestState.js.map +1 -1
- package/dist/mediaAuthoringModel.d.ts.map +1 -1
- package/dist/mediaAuthoringModel.js +2 -5
- package/dist/mediaAuthoringModel.js.map +1 -1
- package/dist/projectIdentity.d.ts.map +1 -1
- package/dist/projectIdentity.js +2 -6
- package/dist/projectIdentity.js.map +1 -1
- package/dist/types/authoring-engine.d.ts +34 -2
- package/dist/types/authoring-engine.d.ts.map +1 -1
- package/dist/ui/admin/pages/SecretsAdminPage.d.ts.map +1 -1
- package/dist/ui/admin/pages/SecretsAdminPage.js +3 -9
- package/dist/ui/admin/pages/SecretsAdminPage.js.map +1 -1
- package/package.json +4 -4
package/dist/features/authoring-engine/application/use-cases/applyAuthoringMutationToStructure.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { deleteOwnProperty, isRecord, readOwnProperty, setOwnProperty, } from '@ankhorage/utility/object';
|
|
2
|
+
import { isAuthoringCollectionKeyAllowed } from '../../utils/isAuthoringCollectionKeyAllowed';
|
|
3
|
+
import { resolveAuthoringCollectionKey } from '../../utils/resolveAuthoringCollectionKey';
|
|
4
|
+
import { resolveAuthoringUnion } from '../../utils/resolveAuthoringUnion';
|
|
2
5
|
import { applyAuthoringMutation } from './applyAuthoringMutation';
|
|
3
|
-
/*** Apply one neutral mutation against owner structure,
|
|
6
|
+
/*** Apply one neutral mutation against owner structure, preserving collection identity and active union semantics. */
|
|
4
7
|
export function applyAuthoringMutationToStructure(current, structure, mutation) {
|
|
5
8
|
if (!isRecord(current)) {
|
|
6
9
|
return rejected(mutation, 'Structured authoring mutations require object state.');
|
|
7
10
|
}
|
|
11
|
+
const pathValidation = validateMutationPath(structure, current, mutation.path, mutation);
|
|
12
|
+
if (!pathValidation.ok)
|
|
13
|
+
return pathValidation;
|
|
8
14
|
if (mutation.kind === 'rename-key') {
|
|
9
|
-
const validation = validateValueMapRename(structure, mutation);
|
|
15
|
+
const validation = validateValueMapRename(current, structure, mutation);
|
|
10
16
|
if (!validation.ok)
|
|
11
17
|
return validation;
|
|
12
18
|
}
|
|
@@ -18,100 +24,223 @@ export function applyAuthoringMutationToStructure(current, structure, mutation)
|
|
|
18
24
|
const applied = applyAuthoringMutation(prepared.value, mutation);
|
|
19
25
|
if (!applied.ok)
|
|
20
26
|
return applied;
|
|
27
|
+
const validation = validateStructuredValue(structure, applied.value, mutation, []);
|
|
28
|
+
if (!validation.ok)
|
|
29
|
+
return validation;
|
|
21
30
|
return {
|
|
22
31
|
ok: true,
|
|
23
32
|
value: normalizeStructuredValue(structure, applied.value, mutation.kind === 'unset'),
|
|
24
33
|
};
|
|
25
34
|
}
|
|
35
|
+
/*** Reject mutations that target a stable entity identity field, including nested active unions. */
|
|
36
|
+
function validateMutationPath(structure, value, path, mutation) {
|
|
37
|
+
if (path.length === 0)
|
|
38
|
+
return { ok: true };
|
|
39
|
+
const effective = resolveEffectiveStructure(structure, value, mutation);
|
|
40
|
+
if (!effective.ok)
|
|
41
|
+
return effective;
|
|
42
|
+
const [segment, ...remaining] = path;
|
|
43
|
+
if (!segment)
|
|
44
|
+
return rejected(mutation, 'Structured authoring mutation path is empty.');
|
|
45
|
+
if (effective.structure.kind === 'entity-registry' &&
|
|
46
|
+
effective.structure.identityField !== undefined &&
|
|
47
|
+
remaining.at(0) === effective.structure.identityField) {
|
|
48
|
+
return rejected(mutation, 'Entity-registry identity fields are immutable.');
|
|
49
|
+
}
|
|
50
|
+
const child = resolveChildStructure(effective.structure, segment);
|
|
51
|
+
if (!child || remaining.length === 0)
|
|
52
|
+
return { ok: true };
|
|
53
|
+
const childValue = isRecord(value) ? readOwnProperty(value, segment) : undefined;
|
|
54
|
+
return validateMutationPath(child, childValue, remaining, mutation);
|
|
55
|
+
}
|
|
26
56
|
/*** Validate one keyed rename against the owner map structure before applying it. */
|
|
27
|
-
function validateValueMapRename(structure, mutation) {
|
|
28
|
-
const target = resolveStructureAtPath(structure, mutation.path);
|
|
29
|
-
if (target
|
|
57
|
+
function validateValueMapRename(current, structure, mutation) {
|
|
58
|
+
const target = resolveStructureAtPath(structure, current, mutation.path, mutation);
|
|
59
|
+
if (!target.ok)
|
|
60
|
+
return target;
|
|
61
|
+
if (target.structure.kind !== 'value-map') {
|
|
30
62
|
return rejected(mutation, 'Authoring key rename requires a value-map target.');
|
|
31
63
|
}
|
|
32
|
-
|
|
33
|
-
|
|
64
|
+
const key = resolveAuthoringCollectionKey(target.structure.key);
|
|
65
|
+
if (!key || !isAuthoringCollectionKeyAllowed(key, mutation.toKey)) {
|
|
66
|
+
return rejected(mutation, 'Value-map key "' + mutation.toKey + '" is not allowed by the owner structure.');
|
|
34
67
|
}
|
|
35
68
|
return { ok: true };
|
|
36
69
|
}
|
|
37
|
-
/*** Resolve one owner structure node at a canonical
|
|
38
|
-
function resolveStructureAtPath(structure, path) {
|
|
39
|
-
|
|
40
|
-
|
|
70
|
+
/*** Resolve one owner structure node at a canonical path, selecting active union variants from state. */
|
|
71
|
+
function resolveStructureAtPath(structure, value, path, mutation) {
|
|
72
|
+
const effective = resolveEffectiveStructure(structure, value, mutation);
|
|
73
|
+
if (!effective.ok || path.length === 0)
|
|
74
|
+
return effective;
|
|
41
75
|
const [segment, ...remaining] = path;
|
|
42
76
|
if (!segment)
|
|
43
|
-
return
|
|
44
|
-
const child = resolveChildStructure(structure, segment);
|
|
45
|
-
|
|
77
|
+
return rejected(mutation, 'Structured authoring mutation path is empty.');
|
|
78
|
+
const child = resolveChildStructure(effective.structure, segment);
|
|
79
|
+
if (!child)
|
|
80
|
+
return rejected(mutation, 'Unknown authoring path segment "' + segment + '".');
|
|
81
|
+
const childValue = isRecord(value) ? readOwnProperty(value, segment) : undefined;
|
|
82
|
+
return resolveStructureAtPath(child, childValue, remaining, mutation);
|
|
46
83
|
}
|
|
47
|
-
/*** Materialize missing object/
|
|
84
|
+
/*** Materialize missing object/map/registry ancestors only when owner structure authorizes the path. */
|
|
48
85
|
function materializeMutationPath(current, structure, path, mutation) {
|
|
86
|
+
const effective = resolveEffectiveStructure(structure, current, mutation);
|
|
87
|
+
if (!effective.ok)
|
|
88
|
+
return effective;
|
|
49
89
|
const [segment, ...remaining] = path;
|
|
50
90
|
if (!segment)
|
|
51
91
|
return rejected(mutation, 'Structured authoring mutation path is empty.');
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
return rejected(mutation,
|
|
92
|
+
const child = resolveChildStructure(effective.structure, segment);
|
|
93
|
+
if (!child) {
|
|
94
|
+
return rejected(mutation, 'Authoring path segment "' + segment + '" is not allowed by the owner structure.');
|
|
55
95
|
}
|
|
56
96
|
if (remaining.length === 0)
|
|
57
97
|
return { ok: true, value: current };
|
|
58
98
|
const existing = readOwnProperty(current, segment);
|
|
59
99
|
if (existing !== undefined && !isRecord(existing)) {
|
|
60
|
-
return rejected(mutation,
|
|
100
|
+
return rejected(mutation, 'Cannot materialize through non-object authoring path segment "' + segment + '".');
|
|
61
101
|
}
|
|
62
|
-
const nested = materializeMutationPath(isRecord(existing) ? existing : {},
|
|
102
|
+
const nested = materializeMutationPath(isRecord(existing) ? existing : {}, child, remaining, mutation);
|
|
63
103
|
if (!nested.ok)
|
|
64
104
|
return nested;
|
|
65
105
|
const value = { ...current };
|
|
66
106
|
setOwnProperty(value, segment, nested.value);
|
|
67
107
|
return { ok: true, value };
|
|
68
108
|
}
|
|
69
|
-
/*** Resolve
|
|
109
|
+
/*** Resolve an active union variant or preserve a non-union structure unchanged. */
|
|
110
|
+
function resolveEffectiveStructure(structure, value, mutation) {
|
|
111
|
+
if (structure.kind !== 'union')
|
|
112
|
+
return { ok: true, structure };
|
|
113
|
+
const resolved = resolveAuthoringUnion(structure, value, mutation.path);
|
|
114
|
+
if (!resolved.ok || resolved.selected === undefined) {
|
|
115
|
+
return rejected(mutation, resolved.ok
|
|
116
|
+
? 'Select a union variant before editing its fields.'
|
|
117
|
+
: resolved.diagnostic.message);
|
|
118
|
+
}
|
|
119
|
+
return { ok: true, structure: resolved.selected.structure };
|
|
120
|
+
}
|
|
121
|
+
/*** Resolve one structural child for fixed object, value-map, or entity-registry semantics. */
|
|
70
122
|
function resolveChildStructure(structure, segment) {
|
|
71
123
|
if (structure.kind === 'object') {
|
|
72
124
|
return structure.fields.find((field) => field.name === segment)?.structure;
|
|
73
125
|
}
|
|
74
|
-
if (structure.kind !== 'value-map'
|
|
126
|
+
if (structure.kind !== 'value-map' && structure.kind !== 'entity-registry')
|
|
75
127
|
return undefined;
|
|
128
|
+
const key = resolveAuthoringCollectionKey(structure.key);
|
|
129
|
+
return key && isAuthoringCollectionKeyAllowed(key, segment) ? structure.value : undefined;
|
|
130
|
+
}
|
|
131
|
+
/*** Validate registry identity and active discriminated unions after a mutation is applied. */
|
|
132
|
+
function validateStructuredValue(structure, value, mutation, path) {
|
|
133
|
+
if (value === undefined)
|
|
134
|
+
return { ok: true };
|
|
135
|
+
if (structure.kind === 'union')
|
|
136
|
+
return validateUnionValue(structure, value, mutation, path);
|
|
137
|
+
if (structure.kind === 'entity-registry') {
|
|
138
|
+
return validateEntityRegistryValue(structure, value, mutation, path);
|
|
139
|
+
}
|
|
140
|
+
if (!isRecord(value))
|
|
141
|
+
return { ok: true };
|
|
142
|
+
if (structure.kind === 'object') {
|
|
143
|
+
for (const field of structure.fields) {
|
|
144
|
+
const current = readOwnProperty(value, field.name);
|
|
145
|
+
const result = validateStructuredValue(field.structure, current, mutation, [
|
|
146
|
+
...path,
|
|
147
|
+
field.name,
|
|
148
|
+
]);
|
|
149
|
+
if (!result.ok)
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (structure.kind === 'value-map') {
|
|
154
|
+
for (const [key, current] of Object.entries(value)) {
|
|
155
|
+
const result = validateStructuredValue(structure.value, current, mutation, [...path, key]);
|
|
156
|
+
if (!result.ok)
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return { ok: true };
|
|
161
|
+
}
|
|
162
|
+
/*** Validate one entity registry including record key to owner identity-field consistency. */
|
|
163
|
+
function validateEntityRegistryValue(structure, value, mutation, path) {
|
|
164
|
+
if (!isRecord(value))
|
|
165
|
+
return rejectedAt(mutation, path, 'Expected entity-registry object.');
|
|
166
|
+
const key = resolveAuthoringCollectionKey(structure.key);
|
|
167
|
+
if (!key)
|
|
168
|
+
return rejectedAt(mutation, path, 'Unsupported entity-registry key semantics.');
|
|
169
|
+
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
170
|
+
if (!isAuthoringCollectionKeyAllowed(key, entryKey)) {
|
|
171
|
+
return rejectedAt(mutation, [...path, entryKey], 'Invalid entity-registry key.');
|
|
172
|
+
}
|
|
173
|
+
if (structure.identityField !== undefined) {
|
|
174
|
+
if (!isRecord(entryValue)) {
|
|
175
|
+
return rejectedAt(mutation, [...path, entryKey], 'Entity-registry value must be an object.');
|
|
176
|
+
}
|
|
177
|
+
if (readOwnProperty(entryValue, structure.identityField) !== entryKey) {
|
|
178
|
+
return rejectedAt(mutation, [...path, entryKey, structure.identityField], 'Entity-registry key must match its owner identity field.');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const nested = validateStructuredValue(structure.value, entryValue, mutation, [
|
|
182
|
+
...path,
|
|
183
|
+
entryKey,
|
|
184
|
+
]);
|
|
185
|
+
if (!nested.ok)
|
|
186
|
+
return nested;
|
|
76
187
|
}
|
|
77
|
-
return
|
|
188
|
+
return { ok: true };
|
|
78
189
|
}
|
|
79
|
-
/*** Validate one
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return (structure
|
|
86
|
-
structure.values.some((value) => typeof value === 'string' && value === key));
|
|
190
|
+
/*** Validate one union value against its selected owner variant and recurse through that structure. */
|
|
191
|
+
function validateUnionValue(structure, value, mutation, path) {
|
|
192
|
+
const resolved = resolveAuthoringUnion(structure, value, path);
|
|
193
|
+
if (!resolved.ok || resolved.selected === undefined) {
|
|
194
|
+
return rejectedAt(mutation, resolved.ok ? path : resolved.diagnostic.path, resolved.ok ? 'Union value has no selected variant.' : resolved.diagnostic.message);
|
|
195
|
+
}
|
|
196
|
+
return validateStructuredValue(resolved.selected.structure, value, mutation, path);
|
|
87
197
|
}
|
|
88
198
|
/*** Normalize known owner structure recursively while preserving unknown sibling fields. */
|
|
89
199
|
function normalizeStructuredValue(structure, value, pruneEmptyOverrides) {
|
|
90
200
|
if (!isRecord(value))
|
|
91
201
|
return value;
|
|
202
|
+
if (structure.kind === 'union') {
|
|
203
|
+
const resolved = resolveAuthoringUnion(structure, value, []);
|
|
204
|
+
return resolved.ok && resolved.selected
|
|
205
|
+
? normalizeStructuredValue(resolved.selected.structure, value, pruneEmptyOverrides)
|
|
206
|
+
: value;
|
|
207
|
+
}
|
|
92
208
|
if (structure.kind === 'object') {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
209
|
+
return normalizeObject(structure, value, pruneEmptyOverrides);
|
|
210
|
+
}
|
|
211
|
+
if (structure.kind === 'entity-registry') {
|
|
212
|
+
return normalizeCollection(structure.value, value, pruneEmptyOverrides, false);
|
|
213
|
+
}
|
|
214
|
+
if (structure.kind === 'value-map') {
|
|
215
|
+
return normalizeCollection(structure.value, value, pruneEmptyOverrides, true);
|
|
216
|
+
}
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
/*** Normalize fixed object fields and prune empty optional override containers. */
|
|
220
|
+
function normalizeObject(structure, value, pruneEmptyOverrides) {
|
|
221
|
+
const normalized = { ...value };
|
|
222
|
+
for (const field of structure.fields) {
|
|
223
|
+
const current = readOwnProperty(normalized, field.name);
|
|
224
|
+
if (current === undefined)
|
|
225
|
+
continue;
|
|
226
|
+
const next = normalizeStructuredValue(field.structure, current, pruneEmptyOverrides);
|
|
227
|
+
if (pruneEmptyOverrides && field.optional && isEmptyRecord(next)) {
|
|
228
|
+
deleteOwnProperty(normalized, field.name);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
setOwnProperty(normalized, field.name, next);
|
|
105
232
|
}
|
|
106
|
-
return normalized;
|
|
107
233
|
}
|
|
108
|
-
|
|
109
|
-
|
|
234
|
+
return normalized;
|
|
235
|
+
}
|
|
236
|
+
/*** Normalize keyed values while pruning empty map overrides but never deleting stable entities. */
|
|
237
|
+
function normalizeCollection(valueStructure, value, pruneEmptyOverrides, pruneEntries) {
|
|
110
238
|
const normalized = {};
|
|
111
239
|
for (const [key, current] of Object.entries(value)) {
|
|
112
|
-
const next = normalizeStructuredValue(
|
|
113
|
-
if (pruneEmptyOverrides && shouldPruneEmptyMapValue(
|
|
240
|
+
const next = normalizeStructuredValue(valueStructure, current, pruneEmptyOverrides);
|
|
241
|
+
if (pruneEntries && pruneEmptyOverrides && shouldPruneEmptyMapValue(valueStructure, next)) {
|
|
114
242
|
continue;
|
|
243
|
+
}
|
|
115
244
|
setOwnProperty(normalized, key, next);
|
|
116
245
|
}
|
|
117
246
|
return normalized;
|
|
@@ -126,14 +255,18 @@ function shouldPruneEmptyMapValue(structure, value) {
|
|
|
126
255
|
function isEmptyRecord(value) {
|
|
127
256
|
return isRecord(value) && Object.keys(value).length === 0;
|
|
128
257
|
}
|
|
129
|
-
/*** Create one structure-aware mutation rejection
|
|
258
|
+
/*** Create one structure-aware mutation rejection at the mutation's requested path. */
|
|
130
259
|
function rejected(mutation, message) {
|
|
260
|
+
return rejectedAt(mutation, mutation.path, message);
|
|
261
|
+
}
|
|
262
|
+
/*** Create one structure-aware mutation rejection at an exact owner-semantic path. */
|
|
263
|
+
function rejectedAt(mutation, path, message) {
|
|
131
264
|
return {
|
|
132
265
|
ok: false,
|
|
133
266
|
diagnostic: {
|
|
134
267
|
code: 'mutation-rejected',
|
|
135
268
|
message,
|
|
136
|
-
path
|
|
269
|
+
path,
|
|
137
270
|
},
|
|
138
271
|
};
|
|
139
272
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyAuthoringMutationToStructure.js","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/applyAuthoringMutationToStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,cAAc,GACf,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,6HAA6H;AAC7H,MAAM,UAAU,iCAAiC,CAC/C,OAAU,EACV,SAA6B,EAC7B,QAA2B;IAE3B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC,QAAQ,EAAE,sDAAsD,CAAC,CAAC;IACpF,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACnC,MAA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AAC,CAAC;QACrF,IAAI,mBAAmB,IAAI,wBAAwB,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC;YAAE,SAAS;QACrF,cAAc,CAAC,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,iGAAiG;AACjG,SAAS,wBAAwB,CAAC,SAA6B,EAAE,KAAc;IAC7E,OAAO,CACL,aAAa,CAAC,KAAK,CAAC;QACpB,SAAS,CAAC,IAAI,KAAK,QAAQ;QAC3B,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,0FAA0F;AAC1F,SAAS,QAAQ,CAAC,QAA2B,EAAE,OAAe;IAC5D,OAAO;QACL,EAAE,EAAE,KAAK;QACT,UAAU,EAAE;YACV,IAAI,EAAE,mBAAmB;YACzB,OAAO;YACP,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB;KACF,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"applyAuthoringMutationToStructure.js","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/applyAuthoringMutationToStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,cAAc,GACf,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,O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iGAAiG;AACjG,SAAS,wBAAwB,CAAC,SAA6B,EAAE,KAAc;IAC7E,OAAO,CACL,aAAa,CAAC,KAAK,CAAC;QACpB,SAAS,CAAC,IAAI,KAAK,QAAQ;QAC3B,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,uFAAuF;AACvF,SAAS,QAAQ,CAAC,QAA2B,EAAE,OAAe;IAC5D,OAAO,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAED,sFAAsF;AACtF,SAAS,UAAU,CACjB,QAA2B,EAC3B,IAAuB,EACvB,OAAe;IAEf,OAAO;QACL,EAAE,EAAE,KAAK;QACT,UAAU,EAAE;YACV,IAAI,EAAE,mBAAmB;YACzB,OAAO;YACP,IAAI;SACL;KACF,CAAC;AACJ,CAAC"}
|
package/dist/features/authoring-engine/application/use-cases/createInitialAuthoringValue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInitialAuthoringValue.d.ts","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/createInitialAuthoringValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"createInitialAuthoringValue.d.ts","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/createInitialAuthoringValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAG7F,mGAAmG;AACnG,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,kBAAkB,GAC5B,cAAc,GAAG,SAAS,CAgC5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveAuthoringUnion } from '../../utils/resolveAuthoringUnion';
|
|
1
2
|
/*** Create one deterministic structurally valid initial value for generic collection insertion. */
|
|
2
3
|
export function createInitialAuthoringValue(structure) {
|
|
3
4
|
switch (structure.kind) {
|
|
@@ -16,7 +17,14 @@ export function createInitialAuthoringValue(structure) {
|
|
|
16
17
|
case 'ordered-list':
|
|
17
18
|
return [];
|
|
18
19
|
case 'value-map':
|
|
20
|
+
case 'entity-registry':
|
|
19
21
|
return {};
|
|
22
|
+
case 'union': {
|
|
23
|
+
const resolved = resolveAuthoringUnion(structure, undefined, []);
|
|
24
|
+
return resolved.ok && resolved.variants[0]
|
|
25
|
+
? createInitialAuthoringValue(resolved.variants[0].structure)
|
|
26
|
+
: undefined;
|
|
27
|
+
}
|
|
20
28
|
case 'object': {
|
|
21
29
|
const entries = structure.fields
|
|
22
30
|
.filter((field) => !field.optional)
|
package/dist/features/authoring-engine/application/use-cases/createInitialAuthoringValue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInitialAuthoringValue.js","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/createInitialAuthoringValue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createInitialAuthoringValue.js","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/createInitialAuthoringValue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,mGAAmG;AACnG,MAAM,UAAU,2BAA2B,CACzC,SAA6B;IAE7B,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,QAAQ;YACX,IAAI,SAAS,CAAC,UAAU,KAAK,SAAS;gBAAE,OAAO,KAAK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AK,aAAa;YAChB,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
package/dist/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AuthoringStructure, AuthoringValue } from '../../../../types/authoring-engine';
|
|
2
|
+
/*** Create one registry entity and materialize its owner identity field from the stable record key. */
|
|
3
|
+
export declare function createInitialEntityRegistryValue(structure: AuthoringStructure, identityField: string | undefined, key: string): AuthoringValue | undefined;
|
|
4
|
+
//# sourceMappingURL=createInitialEntityRegistryValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInitialEntityRegistryValue.d.ts","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAG7F,uGAAuG;AACvG,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,kBAAkB,EAC7B,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,GAAG,EAAE,MAAM,GACV,cAAc,GAAG,SAAS,CAQ5B"}
|
package/dist/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isRecord, setOwnProperty } from '@ankhorage/utility/object';
|
|
2
|
+
import { createInitialAuthoringValue } from './createInitialAuthoringValue';
|
|
3
|
+
/*** Create one registry entity and materialize its owner identity field from the stable record key. */
|
|
4
|
+
export function createInitialEntityRegistryValue(structure, identityField, key) {
|
|
5
|
+
const initial = createInitialAuthoringValue(structure);
|
|
6
|
+
if (!identityField)
|
|
7
|
+
return initial;
|
|
8
|
+
if (!isRecord(initial))
|
|
9
|
+
return undefined;
|
|
10
|
+
const value = { ...initial };
|
|
11
|
+
setOwnProperty(value, identityField, key);
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=createInitialEntityRegistryValue.js.map
|
package/dist/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInitialEntityRegistryValue.js","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/createInitialEntityRegistryValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,uGAAuG;AACvG,MAAM,UAAU,gCAAgC,CAC9C,SAA6B,EAC7B,aAAiC,EACjC,GAAW;IAEX,MAAM,OAAO,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACvD,IAAI,CAAC,aAAa;QAAE,OAAO,OAAO,CAAC;IACnC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAEzC,MAAM,KAAK,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IAC7B,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deriveAuthoringModel.d.ts","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/deriveAuthoringModel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"deriveAuthoringModel.d.ts","sourceRoot":"","sources":["../../../../../src/features/authoring-engine/application/use-cases/deriveAuthoringModel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,aAAa,EAEb,2BAA2B,EAG3B,kBAAkB,EAEnB,MAAM,oCAAoC,CAAC;AAK5C,mGAAmG;AACnG,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,2BAA2B,CAAC;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG,aAAa,CAUhB"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { isRecord } from '@ankhorage/utility/object';
|
|
1
|
+
import { isRecord, readOwnProperty } from '@ankhorage/utility/object';
|
|
2
|
+
import { isAuthoringCollectionKeyAllowed } from '../../utils/isAuthoringCollectionKeyAllowed';
|
|
3
|
+
import { resolveAuthoringCollectionKey } from '../../utils/resolveAuthoringCollectionKey';
|
|
4
|
+
import { resolveAuthoringUnion } from '../../utils/resolveAuthoringUnion';
|
|
2
5
|
/*** Derive one UI-neutral authoring model from neutral structure semantics and a runtime value. */
|
|
3
6
|
export function deriveAuthoringModel(args) {
|
|
4
7
|
return deriveNode({
|
|
@@ -99,6 +102,54 @@ function deriveNode(args) {
|
|
|
99
102
|
}
|
|
100
103
|
: unsupportedValue(base, value.diagnostic);
|
|
101
104
|
}
|
|
105
|
+
case 'entity-registry': {
|
|
106
|
+
const { identityField, value: valueStructure } = args.structure;
|
|
107
|
+
const value = readEntityRegistryValue(args.structure.key, identityField, args.value, args.optional, args.path);
|
|
108
|
+
if (!value.ok)
|
|
109
|
+
return unsupportedValue(base, value.diagnostic);
|
|
110
|
+
return {
|
|
111
|
+
...base,
|
|
112
|
+
kind: 'entity-registry',
|
|
113
|
+
key: value.key,
|
|
114
|
+
valueStructure,
|
|
115
|
+
...(identityField === undefined ? {} : { identityField }),
|
|
116
|
+
entries: value.entries.map(([key, entryValue]) => ({
|
|
117
|
+
key,
|
|
118
|
+
value: deriveNode({
|
|
119
|
+
structure: valueStructure,
|
|
120
|
+
value: entryValue,
|
|
121
|
+
policy: withRegistryIdentityReadOnly(resolvePresentationFieldPolicy(args.policy?.fields, key), identityField),
|
|
122
|
+
path: [...args.path, key],
|
|
123
|
+
label: key,
|
|
124
|
+
optional: false,
|
|
125
|
+
inheritedReadOnly: readOnly,
|
|
126
|
+
}),
|
|
127
|
+
})),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
case 'union': {
|
|
131
|
+
const resolved = resolveAuthoringUnion(args.structure, args.value, args.path);
|
|
132
|
+
if (!resolved.ok)
|
|
133
|
+
return unsupportedValue(base, resolved.diagnostic);
|
|
134
|
+
return {
|
|
135
|
+
...base,
|
|
136
|
+
kind: 'union',
|
|
137
|
+
discriminator: resolved.discriminator,
|
|
138
|
+
variants: resolved.variants,
|
|
139
|
+
selected: resolved.selected?.value,
|
|
140
|
+
value: resolved.selected === undefined
|
|
141
|
+
? undefined
|
|
142
|
+
: deriveNode({
|
|
143
|
+
structure: withoutUnionDiscriminator(resolved.selected.structure, resolved.discriminator),
|
|
144
|
+
value: args.value,
|
|
145
|
+
policy: args.policy,
|
|
146
|
+
path: args.path,
|
|
147
|
+
label: args.label,
|
|
148
|
+
optional: false,
|
|
149
|
+
inheritedReadOnly: readOnly,
|
|
150
|
+
}),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
102
153
|
case 'object': {
|
|
103
154
|
if (args.value !== undefined && !isRecord(args.value)) {
|
|
104
155
|
return unsupportedValue(base, {
|
|
@@ -221,11 +272,19 @@ function readSetValue(member, value, optional) {
|
|
|
221
272
|
}
|
|
222
273
|
/*** Validate keyed value-map state while keeping key identity distinct from collection order. */
|
|
223
274
|
function readValueMapValue(keyStructure, value, optional) {
|
|
224
|
-
const key =
|
|
225
|
-
if (!key
|
|
226
|
-
return
|
|
275
|
+
const key = resolveAuthoringCollectionKey(keyStructure);
|
|
276
|
+
if (!key) {
|
|
277
|
+
return {
|
|
278
|
+
ok: false,
|
|
279
|
+
diagnostic: {
|
|
280
|
+
code: 'unsupported-structure',
|
|
281
|
+
message: 'Value-map authoring requires scalar-string or finite-string-choice keys.',
|
|
282
|
+
path: [],
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
}
|
|
227
286
|
if (value === undefined && optional)
|
|
228
|
-
return { ok: true, key
|
|
287
|
+
return { ok: true, key, entries: [] };
|
|
229
288
|
if (!isRecord(value)) {
|
|
230
289
|
return {
|
|
231
290
|
ok: false,
|
|
@@ -237,7 +296,7 @@ function readValueMapValue(keyStructure, value, optional) {
|
|
|
237
296
|
};
|
|
238
297
|
}
|
|
239
298
|
const entries = Object.entries(value).sort(([left], [right]) => left.localeCompare(right));
|
|
240
|
-
const invalid = entries.find(([candidate]) => !
|
|
299
|
+
const invalid = entries.find(([candidate]) => !isAuthoringCollectionKeyAllowed(key, candidate));
|
|
241
300
|
if (invalid) {
|
|
242
301
|
return {
|
|
243
302
|
ok: false,
|
|
@@ -248,40 +307,83 @@ function readValueMapValue(keyStructure, value, optional) {
|
|
|
248
307
|
},
|
|
249
308
|
};
|
|
250
309
|
}
|
|
251
|
-
return { ok: true, key
|
|
310
|
+
return { ok: true, key, entries };
|
|
252
311
|
}
|
|
253
312
|
/*** Merge authored entries with presentation-only inherited keys without materializing defaults. */
|
|
254
313
|
function mergeValueMapEntries(authoredEntries, fields, key) {
|
|
255
314
|
const authoredKeys = new Set(authoredEntries.map(([entryKey]) => entryKey));
|
|
256
|
-
const inheritedKeys = Object.keys(fields ?? {}).filter((candidate) => !authoredKeys.has(candidate) &&
|
|
315
|
+
const inheritedKeys = Object.keys(fields ?? {}).filter((candidate) => !authoredKeys.has(candidate) && isAuthoringCollectionKeyAllowed(key, candidate));
|
|
257
316
|
return [
|
|
258
317
|
...authoredEntries.map(([entryKey, value]) => [entryKey, value, true]),
|
|
259
318
|
...inheritedKeys.map((entryKey) => [entryKey, undefined, false]),
|
|
260
319
|
].sort(([left], [right]) => left.localeCompare(right));
|
|
261
320
|
}
|
|
262
|
-
/***
|
|
263
|
-
function
|
|
264
|
-
|
|
265
|
-
|
|
321
|
+
/*** Validate one stable entity registry without assigning semantic meaning to record order. */
|
|
322
|
+
function readEntityRegistryValue(keyStructure, identityField, value, optional, path) {
|
|
323
|
+
const key = resolveAuthoringCollectionKey(keyStructure);
|
|
324
|
+
if (!key) {
|
|
325
|
+
return {
|
|
326
|
+
ok: false,
|
|
327
|
+
diagnostic: {
|
|
328
|
+
code: 'unsupported-structure',
|
|
329
|
+
message: 'Entity-registry authoring requires scalar-string or finite-string-choice keys.',
|
|
330
|
+
path,
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
if (value === undefined && optional)
|
|
335
|
+
return { ok: true, key, entries: [] };
|
|
336
|
+
if (!isRecord(value)) {
|
|
337
|
+
return {
|
|
338
|
+
ok: false,
|
|
339
|
+
diagnostic: {
|
|
340
|
+
code: 'invalid-value',
|
|
341
|
+
message: 'Expected entity-registry object.',
|
|
342
|
+
path,
|
|
343
|
+
},
|
|
344
|
+
};
|
|
266
345
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
if (
|
|
270
|
-
return
|
|
346
|
+
const entries = Object.entries(value).sort(([left], [right]) => left.localeCompare(right));
|
|
347
|
+
for (const [entryKey, entryValue] of entries) {
|
|
348
|
+
if (!isAuthoringCollectionKeyAllowed(key, entryKey)) {
|
|
349
|
+
return registryInvalid(path, 'Invalid entity-registry key "' + entryKey + '".');
|
|
350
|
+
}
|
|
351
|
+
if (identityField !== undefined) {
|
|
352
|
+
if (!isRecord(entryValue)) {
|
|
353
|
+
return registryInvalid(path, 'Entity-registry identity requires object values.');
|
|
354
|
+
}
|
|
355
|
+
if (readOwnProperty(entryValue, identityField) !== entryKey) {
|
|
356
|
+
return registryInvalid([...path, entryKey, identityField], 'Entity-registry key must match owner identity field "' + identityField + '".');
|
|
357
|
+
}
|
|
271
358
|
}
|
|
272
359
|
}
|
|
360
|
+
return { ok: true, key, entries };
|
|
361
|
+
}
|
|
362
|
+
/*** Build one entity-registry invalid-value result with an exact authored path. */
|
|
363
|
+
function registryInvalid(path, message) {
|
|
364
|
+
return { ok: false, diagnostic: { code: 'invalid-value', message, path } };
|
|
365
|
+
}
|
|
366
|
+
/*** Keep an entity identity field immutable inside its keyed detail editor. */
|
|
367
|
+
function withRegistryIdentityReadOnly(policy, identityField) {
|
|
368
|
+
if (!identityField)
|
|
369
|
+
return policy;
|
|
370
|
+
const identityPolicy = resolvePresentationFieldPolicy(policy?.fields, identityField);
|
|
273
371
|
return {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
path: [],
|
|
372
|
+
...policy,
|
|
373
|
+
fields: {
|
|
374
|
+
...policy?.fields,
|
|
375
|
+
[identityField]: { ...identityPolicy, readOnly: true },
|
|
279
376
|
},
|
|
280
377
|
};
|
|
281
378
|
}
|
|
282
|
-
/***
|
|
283
|
-
function
|
|
284
|
-
|
|
379
|
+
/*** Remove the union discriminator from detail rendering because variant selection owns it. */
|
|
380
|
+
function withoutUnionDiscriminator(structure, discriminator) {
|
|
381
|
+
if (structure.kind !== 'object')
|
|
382
|
+
return structure;
|
|
383
|
+
return {
|
|
384
|
+
...structure,
|
|
385
|
+
fields: structure.fields.filter((field) => field.name !== discriminator),
|
|
386
|
+
};
|
|
285
387
|
}
|
|
286
388
|
/*** Validate one ordered primitive list while preserving authored order and duplicates. */
|
|
287
389
|
function readOrderedListValue(item, value, optional) {
|