asma-core-helpers 0.20.0 → 0.21.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/lib/collaboration/answerOperations.d.ts +11 -0
- package/lib/collaboration/answerOperations.d.ts.map +1 -1
- package/lib/collaboration/answerOperations.js +1 -0
- package/lib/collaboration/answerOperations.js.map +1 -1
- package/lib/collaboration/applyOperation.d.ts +5 -0
- package/lib/collaboration/applyOperation.d.ts.map +1 -1
- package/lib/collaboration/applyOperation.js +281 -67
- package/lib/collaboration/applyOperation.js.map +1 -1
- package/lib/collaboration/conflicts.d.ts +37 -0
- package/lib/collaboration/conflicts.d.ts.map +1 -0
- package/lib/collaboration/conflicts.js +2 -0
- package/lib/collaboration/conflicts.js.map +1 -0
- package/lib/collaboration/index.d.ts +14 -5
- package/lib/collaboration/index.d.ts.map +1 -1
- package/lib/collaboration/index.js +14 -5
- package/lib/collaboration/index.js.map +1 -1
- package/lib/collaboration/instanceLifecycle.d.ts +31 -0
- package/lib/collaboration/instanceLifecycle.d.ts.map +1 -0
- package/lib/collaboration/instanceLifecycle.js +27 -0
- package/lib/collaboration/instanceLifecycle.js.map +1 -0
- package/lib/collaboration/operations.d.ts +15 -7
- package/lib/collaboration/operations.d.ts.map +1 -1
- package/lib/collaboration/operations.js +2 -1
- package/lib/collaboration/operations.js.map +1 -1
- package/lib/collaboration/schemas.d.ts +466 -0
- package/lib/collaboration/schemas.d.ts.map +1 -0
- package/lib/collaboration/schemas.js +450 -0
- package/lib/collaboration/schemas.js.map +1 -0
- package/lib/collaboration/templateDocument.d.ts +25 -8
- package/lib/collaboration/templateDocument.d.ts.map +1 -1
- package/lib/collaboration/templateDocument.js +4 -0
- package/lib/collaboration/templateDocument.js.map +1 -1
- package/lib/collaboration/testHelpers/documentGenerator.d.ts +40 -0
- package/lib/collaboration/testHelpers/documentGenerator.d.ts.map +1 -0
- package/lib/collaboration/testHelpers/documentGenerator.js +199 -0
- package/lib/collaboration/testHelpers/documentGenerator.js.map +1 -0
- package/lib/collaboration/testHelpers/seededRandom.d.ts +13 -0
- package/lib/collaboration/testHelpers/seededRandom.d.ts.map +1 -0
- package/lib/collaboration/testHelpers/seededRandom.js +41 -0
- package/lib/collaboration/testHelpers/seededRandom.js.map +1 -0
- package/lib/helpers/EnvironmentsUrls.d.ts +0 -3
- package/lib/helpers/EnvironmentsUrls.d.ts.map +1 -1
- package/lib/helpers/EnvironmentsUrls.js +0 -3
- package/lib/helpers/EnvironmentsUrls.js.map +1 -1
- package/lib/helpers/generateEnvConfigsBindings.d.ts +1 -4
- package/lib/helpers/generateEnvConfigsBindings.d.ts.map +1 -1
- package/lib/helpers/generateEnvConfigsBindings.js.map +1 -1
- package/package.json +1 -1
- package/src/collaboration/answerOperations.ts +13 -0
- package/src/collaboration/applyOperation.test.ts +292 -0
- package/src/collaboration/applyOperation.ts +320 -66
- package/src/collaboration/conflicts.ts +40 -0
- package/src/collaboration/index.ts +14 -5
- package/src/collaboration/instanceLifecycle.ts +38 -0
- package/src/collaboration/operations.ts +13 -4
- package/src/collaboration/property.test.ts +156 -0
- package/src/collaboration/schemas.test.ts +236 -0
- package/src/collaboration/schemas.ts +587 -0
- package/src/collaboration/templateDocument.ts +30 -4
- package/src/collaboration/testHelpers/documentGenerator.ts +240 -0
- package/src/collaboration/testHelpers/seededRandom.ts +42 -0
- package/src/helpers/EnvironmentsUrls.ts +0 -3
- package/src/helpers/generateEnvConfigsBindings.ts +1 -4
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
import { findDocLawViolations } from './docLaws.js';
|
|
3
|
+
import { IMPLEMENTED_ANSWER_OP_TYPES } from './answerOperations.js';
|
|
4
|
+
import { IMPLEMENTED_OP_TYPES } from './operations.js';
|
|
5
|
+
import { QUESTION_TYPES } from './questionTypes.js';
|
|
6
|
+
import { bindingTargetKey } from './templateDocument.js';
|
|
7
|
+
/**
|
|
8
|
+
* The ArkType schemas for the two hashed documents and both op vocabularies (plan TASK-003),
|
|
9
|
+
* plus the mechanical DOC-LAW enforcement the plan calls the "schema lint".
|
|
10
|
+
*
|
|
11
|
+
* Three enforcement layers, deliberately layered (the docLaws.ts header explains why the
|
|
12
|
+
* instance lint alone is not enough — and why the schema lint alone is not either):
|
|
13
|
+
*
|
|
14
|
+
* 1. **The schemas themselves** — typed document positions, closed discriminators, no `null`
|
|
15
|
+
* in document positions. Because a question's per-type bag is genuinely open, the schemas
|
|
16
|
+
* carry `[string]: unknown` index signatures; validation never sees inside those bags.
|
|
17
|
+
* 2. **`findSchemaDocLawViolations`** — walks the schema's JSON Schema output and rejects
|
|
18
|
+
* *any* array-of-objects (DOC-LAW-1) or `null` (DOC-LAW-2) in a document schema. It runs
|
|
19
|
+
* over the schema, not over instances, so it is total: a shape can never violate the law
|
|
20
|
+
* "in an untested payload". The answer document is the named DOC-LAW-2 exception (OQ-V2-24):
|
|
21
|
+
* `null` is legal at answer-value leaves only.
|
|
22
|
+
* 3. **`findDocLawDefaultViolations` + `templateDocumentIsDefault`** — the DOC-LAW-2 default
|
|
23
|
+
* half: "no key present with its own default value". `templateDocumentIsDefault` feeds
|
|
24
|
+
* `reduceToMinimalForm` so a spelled-out default and its absence hash identically, and
|
|
25
|
+
* `findDocLawDefaultViolations` reports the same fact on a stored document so the
|
|
26
|
+
* contract test can reject it before it reaches storage.
|
|
27
|
+
*
|
|
28
|
+
* The storage-side guard is the plan's `document <> jsonb_strip_nulls(document)` (catches
|
|
29
|
+
* explicit null object fields only); the schema lint owns everything else.
|
|
30
|
+
*
|
|
31
|
+
* @see asma-modules/_docs/editor/qnrs/cross/2026-07-12-21-40-plan-qnr-stage2-new-model-editor-and-sync.md:563 — TASK-003
|
|
32
|
+
* @see asma-modules/_docs/editor/qnrs/cross/2026-07-12-20-20-architecture-qnr-v2-model-collaboration-sync.md:193 — DOC-LAW-1
|
|
33
|
+
* @see asma-modules/_docs/editor/qnrs/cross/2026-07-12-20-20-architecture-qnr-v2-model-collaboration-sync.md:195 — DOC-LAW-2
|
|
34
|
+
*/
|
|
35
|
+
// ─────────────────────────────── atoms ───────────────────────────────
|
|
36
|
+
const docScalar = 'string | number | boolean';
|
|
37
|
+
/** `OpValue` — the op layer keeps the explicit-unset tri-state DOC-LAW-2 bans in documents. */
|
|
38
|
+
const opValue = 'string | number | boolean | (string | number | boolean)[] | null';
|
|
39
|
+
/** `AnswerValue` — `null` is the deliberate-clear marker, legal in answer state only. */
|
|
40
|
+
const answerValue = 'string | number | boolean | (string | number | boolean)[] | null';
|
|
41
|
+
/** A byId collection — `Record<Id, X>`, DOC-LAW-1's keyed shape. */
|
|
42
|
+
const recordOf = (value) => ({ '[string]': value });
|
|
43
|
+
// ─────────────────────────────── template document ───────────────────────────────
|
|
44
|
+
const ruleConditionSchema = type({
|
|
45
|
+
sourceQuestionId: 'string',
|
|
46
|
+
alternativeId: 'string?',
|
|
47
|
+
operator: 'string?',
|
|
48
|
+
"value?": docScalar,
|
|
49
|
+
...{ '[string]': 'unknown' },
|
|
50
|
+
});
|
|
51
|
+
const visibilityRuleSchema = type({
|
|
52
|
+
condition: ruleConditionSchema,
|
|
53
|
+
...{ '[string]': 'unknown' },
|
|
54
|
+
});
|
|
55
|
+
const highlightRuleSchema = type({
|
|
56
|
+
condition: ruleConditionSchema,
|
|
57
|
+
...{ '[string]': 'unknown' },
|
|
58
|
+
});
|
|
59
|
+
const questionGridConfigSchema = type({
|
|
60
|
+
columnIds: 'string[]?',
|
|
61
|
+
minRows: 'number?',
|
|
62
|
+
maxRows: 'number?',
|
|
63
|
+
singleRow: 'boolean?',
|
|
64
|
+
deletableRows: 'boolean?',
|
|
65
|
+
alwaysNew: 'boolean?',
|
|
66
|
+
timestamps: 'boolean?',
|
|
67
|
+
editable: 'boolean?',
|
|
68
|
+
rowTitle: 'string?',
|
|
69
|
+
});
|
|
70
|
+
const questionGridPresentationSchema = type({
|
|
71
|
+
headerTabId: 'string?',
|
|
72
|
+
defaultColumnWidthsByQuestionId: 'Record<string, number>?',
|
|
73
|
+
...{ '[string]': 'unknown' },
|
|
74
|
+
});
|
|
75
|
+
const qnrQuestionSchema = type({
|
|
76
|
+
type: type.enumerated(...QUESTION_TYPES),
|
|
77
|
+
"subtype?": type.enumerated('ORDINARY', 'EMAIL'),
|
|
78
|
+
"label?": 'string',
|
|
79
|
+
"required?": 'boolean',
|
|
80
|
+
"defaultValue?": docScalar,
|
|
81
|
+
"grid?": questionGridConfigSchema,
|
|
82
|
+
"presentation?": questionGridPresentationSchema,
|
|
83
|
+
...{ '[string]': 'unknown' },
|
|
84
|
+
});
|
|
85
|
+
const qnrAlternativeSchema = type({
|
|
86
|
+
"label?": 'string',
|
|
87
|
+
"value?": docScalar,
|
|
88
|
+
...{ '[string]': 'unknown' },
|
|
89
|
+
});
|
|
90
|
+
const qnrGridRowSchema = type({
|
|
91
|
+
label: 'string?',
|
|
92
|
+
cells: 'Record<string, string | number | boolean>?',
|
|
93
|
+
...{ '[string]': 'unknown' },
|
|
94
|
+
});
|
|
95
|
+
const qnrTabSchema = type({
|
|
96
|
+
label: 'string?',
|
|
97
|
+
...{ '[string]': 'unknown' },
|
|
98
|
+
});
|
|
99
|
+
const qnrActionSchema = type({
|
|
100
|
+
kind: 'string?',
|
|
101
|
+
...{ '[string]': 'unknown' },
|
|
102
|
+
});
|
|
103
|
+
const mappingNodeSchema = type({
|
|
104
|
+
entityId: 'string',
|
|
105
|
+
parentNodeId: 'string?',
|
|
106
|
+
relationshipId: 'string?',
|
|
107
|
+
filterOrder: 'string[]?',
|
|
108
|
+
...{ '[string]': 'unknown' },
|
|
109
|
+
});
|
|
110
|
+
const bindingTargetSchema = type.or(type({ kind: '"question"', questionId: 'string' }), type({ kind: '"gridColumn"', gridQuestionId: 'string', columnQuestionId: 'string' }));
|
|
111
|
+
const mappingBindingSchema = type({
|
|
112
|
+
nodeId: 'string',
|
|
113
|
+
fieldId: 'string',
|
|
114
|
+
target: bindingTargetSchema,
|
|
115
|
+
cardinality: 'string?',
|
|
116
|
+
onMissing: 'string?',
|
|
117
|
+
onMany: 'string?',
|
|
118
|
+
...{ '[string]': 'unknown' },
|
|
119
|
+
});
|
|
120
|
+
const mappingFilterSchema = type({
|
|
121
|
+
fieldId: 'string',
|
|
122
|
+
operator: 'string',
|
|
123
|
+
"value?": docScalar,
|
|
124
|
+
});
|
|
125
|
+
const dataMappingSchema = type({
|
|
126
|
+
sourceId: 'string',
|
|
127
|
+
rootNodeId: 'string',
|
|
128
|
+
bindingOrder: 'string[]?',
|
|
129
|
+
});
|
|
130
|
+
const qnrTemplateMetaSchema = type({
|
|
131
|
+
title: 'string?',
|
|
132
|
+
description: 'string?',
|
|
133
|
+
"settings?": type({
|
|
134
|
+
"journal?": type({
|
|
135
|
+
requires_activity_id: 'boolean?',
|
|
136
|
+
}),
|
|
137
|
+
"recipient?": type({
|
|
138
|
+
ask_for_phone_nr: 'boolean?',
|
|
139
|
+
}),
|
|
140
|
+
...{ '[string]': 'unknown' },
|
|
141
|
+
}),
|
|
142
|
+
"instancePolicy?": type({
|
|
143
|
+
"requiredAccessLevel?": '1 | 2 | 3 | 4',
|
|
144
|
+
invitationRequired: 'boolean?',
|
|
145
|
+
"initiator?": '"coordinator" | "recipient"',
|
|
146
|
+
"template_update_mode?": '"never" | "always" | "ask"',
|
|
147
|
+
}),
|
|
148
|
+
presentationProfiles: 'Record<string, unknown>?',
|
|
149
|
+
"compatibility?": type({
|
|
150
|
+
consentTemplateIds: 'string[]?',
|
|
151
|
+
smsTemplateIds: 'string[]?',
|
|
152
|
+
}),
|
|
153
|
+
...{ '[string]': 'unknown' },
|
|
154
|
+
});
|
|
155
|
+
export const qnrTemplateDocumentSchema = type({
|
|
156
|
+
documentId: 'string',
|
|
157
|
+
revision: 'number',
|
|
158
|
+
"meta?": qnrTemplateMetaSchema,
|
|
159
|
+
"questionsById?": recordOf(qnrQuestionSchema),
|
|
160
|
+
questionOrder: 'string[]',
|
|
161
|
+
"gridRowsById?": recordOf(qnrGridRowSchema),
|
|
162
|
+
gridRowOrderByQuestionId: 'Record<string, string[]>?',
|
|
163
|
+
"alternativesById?": recordOf(qnrAlternativeSchema),
|
|
164
|
+
alternativeOrderByQuestionId: 'Record<string, string[]>?',
|
|
165
|
+
"tabsById?": recordOf(qnrTabSchema),
|
|
166
|
+
tabOrder: 'string[]?',
|
|
167
|
+
"actionsById?": recordOf(qnrActionSchema),
|
|
168
|
+
"visibilityRulesById?": recordOf(visibilityRuleSchema),
|
|
169
|
+
visibilityRuleOrderByQuestionId: 'Record<string, string[]>?',
|
|
170
|
+
"highlightRulesById?": recordOf(highlightRuleSchema),
|
|
171
|
+
highlightRuleOrderByQuestionId: 'Record<string, string[]>?',
|
|
172
|
+
"dataMappingsById?": recordOf(dataMappingSchema),
|
|
173
|
+
"mappingNodesById?": recordOf(mappingNodeSchema),
|
|
174
|
+
"mappingBindingsById?": recordOf(mappingBindingSchema),
|
|
175
|
+
"mappingFiltersById?": recordOf(mappingFilterSchema),
|
|
176
|
+
});
|
|
177
|
+
// ─────────────────────────────── answer document ───────────────────────────────
|
|
178
|
+
export const qnrAnswerDocumentSchema = type({
|
|
179
|
+
documentId: 'string',
|
|
180
|
+
revision: 'number',
|
|
181
|
+
answersByQuestionId: `Record<string, ${answerValue}>?`,
|
|
182
|
+
gridAnswersByQuestionId: `Record<string, Record<string, Record<string, ${answerValue}>>>?`,
|
|
183
|
+
"answerGridRowsById?": recordOf(type({
|
|
184
|
+
questionGridId: 'string',
|
|
185
|
+
entityRef: 'string?',
|
|
186
|
+
deleted: 'true',
|
|
187
|
+
})),
|
|
188
|
+
answerGridRowOrderByQuestionId: 'Record<string, string[]>?',
|
|
189
|
+
});
|
|
190
|
+
// ─────────────────────────────── op vocabularies ───────────────────────────────
|
|
191
|
+
export const templateOpSchema = type.or(type({ type: '"template.updateMeta"', patch: `Record<string, ${opValue} | Record<string, unknown>>` }), type({ type: '"template.updateSettings"', patch: `Record<string, ${opValue} | Record<string, unknown>>` }), type({
|
|
192
|
+
type: '"question.create"',
|
|
193
|
+
questionId: 'string',
|
|
194
|
+
questionType: type.enumerated(...QUESTION_TYPES),
|
|
195
|
+
atIndex: 'number?',
|
|
196
|
+
}), type({ type: '"question.updateField"', questionId: 'string', field: 'string', value: opValue }), type({ type: '"question.move"', questionId: 'string', toIndex: 'number' }), type({ type: '"question.delete"', questionId: 'string' }), type({ type: '"gridRow.create"', questionId: 'string', rowId: 'string', label: 'string?', atIndex: 'number?' }), type({ type: '"gridRow.move"', questionId: 'string', rowId: 'string', afterRowId: 'string | null' }), type({ type: '"gridRow.delete"', questionId: 'string', rowId: 'string' }), type({
|
|
197
|
+
type: '"gridRow.updateCell"',
|
|
198
|
+
questionId: 'string',
|
|
199
|
+
rowId: 'string',
|
|
200
|
+
columnQuestionId: 'string',
|
|
201
|
+
value: opValue,
|
|
202
|
+
}), type({ type: '"alternative.create"', questionId: 'string', alternativeId: 'string', label: 'string?', atIndex: 'number?' }), type({
|
|
203
|
+
type: '"alternative.updateField"',
|
|
204
|
+
questionId: 'string',
|
|
205
|
+
alternativeId: 'string',
|
|
206
|
+
field: 'string',
|
|
207
|
+
value: opValue,
|
|
208
|
+
}), type({ type: '"alternative.move"', questionId: 'string', alternativeId: 'string', toIndex: 'number' }), type({ type: '"alternative.delete"', questionId: 'string', alternativeId: 'string' }), type({ type: '"tab.create"', tabId: 'string', label: 'string?', atIndex: 'number?' }), type({ type: '"tab.updateField"', tabId: 'string', field: 'string', value: opValue }), type({ type: '"tab.move"', tabId: 'string', toIndex: 'number' }), type({ type: '"tab.delete"', tabId: 'string' }), type({ type: '"action.create"', actionId: 'string', kind: 'string?' }), type({ type: '"action.updateField"', actionId: 'string', field: 'string', value: opValue }), type({ type: '"action.delete"', actionId: 'string' }), type({ type: '"dataMapping.create"', mappingId: 'string', sourceId: 'string', rootNodeId: 'string' }), type({ type: '"dataMapping.delete"', mappingId: 'string' }), type({
|
|
209
|
+
type: '"mappingNode.create"',
|
|
210
|
+
nodeId: 'string',
|
|
211
|
+
entityId: 'string',
|
|
212
|
+
parentNodeId: 'string?',
|
|
213
|
+
relationshipId: 'string?',
|
|
214
|
+
}), type({
|
|
215
|
+
type: '"mappingNode.update"',
|
|
216
|
+
nodeId: 'string',
|
|
217
|
+
patch: type({
|
|
218
|
+
entityId: 'string?',
|
|
219
|
+
"parentNodeId?": 'string | null',
|
|
220
|
+
"relationshipId?": 'string | null',
|
|
221
|
+
filterOrder: 'string[]?',
|
|
222
|
+
}),
|
|
223
|
+
}), type({ type: '"mappingNode.delete"', nodeId: 'string' }), type({
|
|
224
|
+
type: '"mappingBinding.create"',
|
|
225
|
+
bindingId: 'string',
|
|
226
|
+
nodeId: 'string',
|
|
227
|
+
fieldId: 'string',
|
|
228
|
+
target: bindingTargetSchema,
|
|
229
|
+
}), type({
|
|
230
|
+
type: '"mappingBinding.update"',
|
|
231
|
+
bindingId: 'string',
|
|
232
|
+
patch: type({
|
|
233
|
+
nodeId: 'string?',
|
|
234
|
+
fieldId: 'string?',
|
|
235
|
+
"target?": bindingTargetSchema,
|
|
236
|
+
}),
|
|
237
|
+
}), type({ type: '"mappingBinding.delete"', bindingId: 'string' }), type({
|
|
238
|
+
type: '"mappingFilter.set"',
|
|
239
|
+
filterId: 'string',
|
|
240
|
+
nodeId: 'string',
|
|
241
|
+
fieldId: 'string',
|
|
242
|
+
operator: 'string',
|
|
243
|
+
value: docScalar,
|
|
244
|
+
}), type({ type: '"mappingFilter.delete"', filterId: 'string' }), type({ type: '"visibilityRule.set"', ruleId: 'string', questionId: 'string', condition: ruleConditionSchema }), type({ type: '"visibilityRule.delete"', ruleId: 'string' }), type({ type: '"highlightRule.set"', ruleId: 'string', questionId: 'string', condition: ruleConditionSchema }), type({ type: '"highlightRule.delete"', ruleId: 'string' }));
|
|
245
|
+
export const answerOpSchema = type.or(type({ type: '"answer.set"', questionId: 'string', value: answerValue }), type({ type: '"answer.clear"', questionId: 'string' }), type({ type: '"gridRow.add"', questionId: 'string', rowId: 'string', afterRowId: 'string?' }), type({ type: '"gridRow.move"', questionId: 'string', rowId: 'string', afterRowId: 'string | null' }), type({ type: '"gridRow.remove"', questionId: 'string', rowId: 'string' }), type({
|
|
246
|
+
type: '"gridAnswer.set"',
|
|
247
|
+
questionId: 'string',
|
|
248
|
+
rowId: 'string',
|
|
249
|
+
columnQuestionId: 'string',
|
|
250
|
+
value: answerValue,
|
|
251
|
+
}));
|
|
252
|
+
const opTypeNames = (schema) => {
|
|
253
|
+
const json = schema.toJsonSchema();
|
|
254
|
+
const members = json.anyOf ?? [json];
|
|
255
|
+
return members
|
|
256
|
+
.map((member) => member.properties?.type?.const)
|
|
257
|
+
.filter((value) => typeof value === 'string');
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* The op names the schemas actually validate, extracted from the JSON Schema output. The
|
|
261
|
+
* parity test asserts these equal `IMPLEMENTED_OP_TYPES` — a vocabulary member added to the
|
|
262
|
+
* TS union but forgotten in the schemas (or vice versa) is a red build, not a runtime gap.
|
|
263
|
+
*/
|
|
264
|
+
export const SCHEMA_TEMPLATE_OP_TYPES = opTypeNames(templateOpSchema);
|
|
265
|
+
export const SCHEMA_ANSWER_OP_TYPES = opTypeNames(answerOpSchema);
|
|
266
|
+
const primitiveTypeOf = (value) => typeof value === 'object' && value !== null ? 'object' : typeof value;
|
|
267
|
+
/**
|
|
268
|
+
* The JSON-schema-level types a node can match. A union node contributes the union of its
|
|
269
|
+
* branches' types (so a primitive union never collapses to 'object', which would turn an
|
|
270
|
+
* array-of-primitives into a false DOC-LAW-1 finding); an object-shaped node is 'object'.
|
|
271
|
+
*/
|
|
272
|
+
const nodeTypes = (node, depth = 0) => {
|
|
273
|
+
if (node.type !== undefined)
|
|
274
|
+
return Array.isArray(node.type) ? node.type : [node.type];
|
|
275
|
+
if (node.enum !== undefined)
|
|
276
|
+
return [...new Set(node.enum.map(primitiveTypeOf))];
|
|
277
|
+
if (node.const !== undefined)
|
|
278
|
+
return [primitiveTypeOf(node.const)];
|
|
279
|
+
if (depth > 20)
|
|
280
|
+
return [];
|
|
281
|
+
const merged = [];
|
|
282
|
+
for (const branches of [node.anyOf ?? [], node.oneOf ?? [], node.allOf ?? []]) {
|
|
283
|
+
for (const branch of branches)
|
|
284
|
+
merged.push(...nodeTypes(branch, depth + 1));
|
|
285
|
+
}
|
|
286
|
+
if (node.properties !== undefined || node.additionalProperties !== undefined || node.not !== undefined) {
|
|
287
|
+
merged.push('object');
|
|
288
|
+
}
|
|
289
|
+
return [...new Set(merged)];
|
|
290
|
+
};
|
|
291
|
+
const joinSchemaPath = (parent, key) => (parent === '' ? key : `${parent}.${key}`);
|
|
292
|
+
/**
|
|
293
|
+
* The DOC-LAW-1/2 schema lint (plan TASK-003). Walks the JSON Schema output of a document
|
|
294
|
+
* schema and reports every array-of-objects (DOC-LAW-1) and every position that allows
|
|
295
|
+
* `null` (DOC-LAW-2). `allowNullAt` names the DOC-LAW-2 exception positions — the answer
|
|
296
|
+
* document's answer-value leaves (OQ-V2-24); the template document allows none.
|
|
297
|
+
*
|
|
298
|
+
* It is a contract test, not a runtime guard: validation of incoming documents happens on
|
|
299
|
+
* the schema itself, and a payload can only fail the law by failing the schema.
|
|
300
|
+
*/
|
|
301
|
+
export const findSchemaDocLawViolations = (schemaJson, options = {}) => {
|
|
302
|
+
const violations = [];
|
|
303
|
+
const seen = new Set();
|
|
304
|
+
const resolveRef = (ref) => {
|
|
305
|
+
if (!ref.startsWith('#/$defs/'))
|
|
306
|
+
return undefined;
|
|
307
|
+
const name = ref.slice('#/$defs/'.length);
|
|
308
|
+
return schemaJson.$defs?.[name];
|
|
309
|
+
};
|
|
310
|
+
const walk = (node, path) => {
|
|
311
|
+
if (typeof node === 'boolean' || node === undefined)
|
|
312
|
+
return;
|
|
313
|
+
if (seen.has(node))
|
|
314
|
+
return;
|
|
315
|
+
seen.add(node);
|
|
316
|
+
const resolved = node.$ref !== undefined ? (resolveRef(node.$ref) ?? node) : node;
|
|
317
|
+
if (resolved !== node) {
|
|
318
|
+
walk(resolved, path);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const types = nodeTypes(resolved);
|
|
322
|
+
if (types.includes('null') || resolved.enum?.includes(null) || resolved.const === null) {
|
|
323
|
+
if (!options.allowNullAt?.(path)) {
|
|
324
|
+
violations.push({ law: 'DOC-LAW-2', path, detail: 'schema allows explicit null; absent is the only encoding of "not set"' });
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (types.includes('array')) {
|
|
328
|
+
const items = Array.isArray(resolved.items) ? resolved.items : resolved.items !== undefined ? [resolved.items] : [];
|
|
329
|
+
const itemTypes = [...new Set(items.flatMap((item) => (typeof item === 'object' ? nodeTypes(item) : [])))];
|
|
330
|
+
if (itemTypes.some((t) => t === 'object' || t === 'array')) {
|
|
331
|
+
violations.push({
|
|
332
|
+
law: 'DOC-LAW-1',
|
|
333
|
+
path,
|
|
334
|
+
detail: 'array of objects; use <x>ById plus a primitive order array',
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
for (const [key, child] of Object.entries(resolved.properties ?? {}))
|
|
339
|
+
walk(child, joinSchemaPath(path, key));
|
|
340
|
+
for (const branch of resolved.anyOf ?? [])
|
|
341
|
+
walk(branch, path);
|
|
342
|
+
for (const branch of resolved.oneOf ?? [])
|
|
343
|
+
walk(branch, path);
|
|
344
|
+
for (const branch of resolved.allOf ?? [])
|
|
345
|
+
walk(branch, path);
|
|
346
|
+
if (resolved.not !== undefined)
|
|
347
|
+
walk(resolved.not, path);
|
|
348
|
+
if (typeof resolved.additionalProperties === 'object')
|
|
349
|
+
walk(resolved.additionalProperties, `${path}[]`);
|
|
350
|
+
if (Array.isArray(resolved.items)) {
|
|
351
|
+
for (const item of resolved.items)
|
|
352
|
+
walk(item, `${path}[]`);
|
|
353
|
+
}
|
|
354
|
+
else if (typeof resolved.items === 'object') {
|
|
355
|
+
walk(resolved.items, `${path}[]`);
|
|
356
|
+
}
|
|
357
|
+
for (const item of resolved.prefixItems ?? [])
|
|
358
|
+
walk(item, `${path}[]`);
|
|
359
|
+
};
|
|
360
|
+
walk(schemaJson, '');
|
|
361
|
+
return violations;
|
|
362
|
+
};
|
|
363
|
+
/** The template document admits no explicit null anywhere (DOC-LAW-2, strict scope). */
|
|
364
|
+
export const findTemplateSchemaDocLawViolations = () => findSchemaDocLawViolations(qnrTemplateDocumentSchema.toJsonSchema());
|
|
365
|
+
/** The answer document's answer-value leaves are the one legal null home (OQ-V2-24). */
|
|
366
|
+
export const findAnswerSchemaDocLawViolations = () => findSchemaDocLawViolations(qnrAnswerDocumentSchema.toJsonSchema(), {
|
|
367
|
+
allowNullAt: (path) => path.startsWith('answersByQuestionId') || path.startsWith('gridAnswersByQuestionId'),
|
|
368
|
+
});
|
|
369
|
+
// ─────────────────────────────── DOC-LAW-2 defaults ───────────────────────────────
|
|
370
|
+
/**
|
|
371
|
+
* The template document's default registry (DOC-LAW-2: "no key present with its own default
|
|
372
|
+
* value"). Boolean flags whose legacy encoding is a `true | undefined` sentinel (M-069) have
|
|
373
|
+
* `false` as their default — the stored minimal form omits them, and canonicalization must
|
|
374
|
+
* hash a spelled-out `false` identically to its absence.
|
|
375
|
+
*
|
|
376
|
+
* Fields WITHOUT a declared default here are deliberately absent: no default is asserted
|
|
377
|
+
* where the legacy semantics do not prove one (e.g. `grid.deletableRows`, `grid.editable`).
|
|
378
|
+
*/
|
|
379
|
+
const TEMPLATE_DOCUMENT_DEFAULT_PATHS = [
|
|
380
|
+
'required', // question-level (M-063: dedupe of the `@deprecated` dual; sentinel semantics)
|
|
381
|
+
'requires_activity_id', // settings.journal (M-007 aliases; conservative OR resolves to required)
|
|
382
|
+
'ask_for_phone_nr', // settings.recipient (recipient requirement, sentinel semantics)
|
|
383
|
+
'invitationRequired', // instancePolicy (open level-1 is invitation-free — OQ-V2-2)
|
|
384
|
+
'singleRow', // question.grid (legacy composite flag, sentinel semantics — OQ-V2-17)
|
|
385
|
+
'alwaysNew', // question.grid (legacy base flag)
|
|
386
|
+
'timestamps', // question.grid (legacy composite `row_timestamps`)
|
|
387
|
+
];
|
|
388
|
+
export const templateDocumentIsDefault = (path, value) => value === false && TEMPLATE_DOCUMENT_DEFAULT_PATHS.some((name) => path.endsWith(`.${name}`));
|
|
389
|
+
/**
|
|
390
|
+
* The instance-side half of the default lint: every present-and-default field on a stored
|
|
391
|
+
* template document, ready for the contract test to reject. Complements
|
|
392
|
+
* `findDocLawViolations` (which owns null/empty collections); this one owns defaults.
|
|
393
|
+
*/
|
|
394
|
+
export const findDocLawDefaultViolations = (document) => {
|
|
395
|
+
const violations = [];
|
|
396
|
+
const walk = (value, path) => {
|
|
397
|
+
if (value === null || typeof value !== 'object')
|
|
398
|
+
return;
|
|
399
|
+
if (Array.isArray(value)) {
|
|
400
|
+
value.forEach((member, index) => walk(member, `${path}.${index}`));
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
for (const [key, member] of Object.entries(value)) {
|
|
404
|
+
const memberPath = path === '' ? key : `${path}.${key}`;
|
|
405
|
+
if (templateDocumentIsDefault(memberPath, member)) {
|
|
406
|
+
violations.push({ law: 'DOC-LAW-2', path: memberPath, detail: 'key present with its own default value' });
|
|
407
|
+
}
|
|
408
|
+
walk(member, memberPath);
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
walk(document, '');
|
|
412
|
+
return violations;
|
|
413
|
+
};
|
|
414
|
+
// ─────────────────────────────── binding-target uniqueness ───────────────────────────────
|
|
415
|
+
/**
|
|
416
|
+
* The §2.2a cardinality invariant as an executable check: at most one binding per target.
|
|
417
|
+
* The reducer enforces it on `mappingBinding.create/update`; this validator covers every
|
|
418
|
+
* other writer (import, direct document writes) so the invariant is total.
|
|
419
|
+
*/
|
|
420
|
+
export const findDuplicateBindingTargets = (document) => {
|
|
421
|
+
const byTarget = new Map();
|
|
422
|
+
for (const [bindingId, binding] of Object.entries(document.mappingBindingsById ?? {})) {
|
|
423
|
+
const key = bindingTargetKey(binding.target);
|
|
424
|
+
const entry = byTarget.get(key);
|
|
425
|
+
if (entry === undefined)
|
|
426
|
+
byTarget.set(key, { target: binding.target, bindingIds: [bindingId] });
|
|
427
|
+
else
|
|
428
|
+
entry.bindingIds.push(bindingId);
|
|
429
|
+
}
|
|
430
|
+
return [...byTarget.values()].filter((entry) => entry.bindingIds.length > 1);
|
|
431
|
+
};
|
|
432
|
+
const validate = (schema) => (value) => {
|
|
433
|
+
const out = schema(value);
|
|
434
|
+
if (out instanceof type.errors)
|
|
435
|
+
return { ok: false, summary: out.summary };
|
|
436
|
+
return { ok: true, value: out };
|
|
437
|
+
};
|
|
438
|
+
export const validateTemplateDocument = validate(qnrTemplateDocumentSchema);
|
|
439
|
+
/**
|
|
440
|
+
* Full template-document admission check for the contract test: schema + DOC-LAW-1/2 lints +
|
|
441
|
+
* default lint + binding uniqueness. A document passes only in its canonical minimal form.
|
|
442
|
+
*/
|
|
443
|
+
export const findTemplateDocumentContractViolations = (document) => [
|
|
444
|
+
...findDocLawViolations(document),
|
|
445
|
+
...findDocLawDefaultViolations(document),
|
|
446
|
+
];
|
|
447
|
+
export const findDuplicateBindingTargetsSummary = (document) => findDuplicateBindingTargets(document).map(({ target, bindingIds }) => `${bindingTargetKey(target)} bound by [${bindingIds.join(', ')}]`);
|
|
448
|
+
// Referenced by the parity test without importing node internals into the browser bundle.
|
|
449
|
+
export { IMPLEMENTED_OP_TYPES, IMPLEMENTED_ANSWER_OP_TYPES };
|
|
450
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/collaboration/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,SAAS,CAAA;AAGzC,OAAO,EAAE,oBAAoB,EAAwB,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;A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TemplateMeta = {
|
|
|
77
77
|
[key: string]: unknown;
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
80
|
-
* The per-question-type configuration of a `QuestionGrid` (OQ-V2-17) — the
|
|
81
|
-
*
|
|
80
|
+
* The per-question-type configuration of a `QuestionGrid` (OQ-V2-17) — the grid's own
|
|
81
|
+
* structure and row repeat policy. Lives at `question.grid.*`.
|
|
82
|
+
*
|
|
83
|
+
* `singleRow` is kept as the authored boolean rather than normalized to `maxRows: 1`
|
|
84
|
+
* (OQ-V2-17's "single_row → max 1"): the legacy flag also drives the add/remove-row UI,
|
|
85
|
+
* so the derivation happens at read time and the document stores the intent.
|
|
82
86
|
*/
|
|
83
87
|
export type QuestionGridConfig = {
|
|
88
|
+
/** The grid's columns — the simple child questions, in authored order (OQ-V2-17: `grid.columnIds`). */
|
|
89
|
+
columnIds?: QuestionId[];
|
|
84
90
|
minRows?: number;
|
|
85
91
|
maxRows?: number;
|
|
86
|
-
/** `single_row` in OQ-V2-17 prose —
|
|
92
|
+
/** `single_row` in OQ-V2-17 prose — at most one row, no add/remove-row UI. */
|
|
87
93
|
singleRow?: boolean;
|
|
88
94
|
deletableRows?: boolean;
|
|
89
95
|
alwaysNew?: boolean;
|
|
90
96
|
timestamps?: boolean;
|
|
97
|
+
/** M-117: legacy `CompositeQuestion.editable` / `row_title`. */
|
|
98
|
+
editable?: boolean;
|
|
99
|
+
rowTitle?: string;
|
|
91
100
|
};
|
|
92
101
|
/**
|
|
93
102
|
* Grid-owned presentation (OQ-V2-17/25): row-editor layout, filters, grid actions,
|
|
@@ -178,6 +187,8 @@ export type BindingTarget = {
|
|
|
178
187
|
gridQuestionId: QuestionId;
|
|
179
188
|
columnQuestionId: QuestionId;
|
|
180
189
|
};
|
|
190
|
+
/** Serialises a binding target so the "one binding per target" invariant is checkable. */
|
|
191
|
+
export declare const bindingTargetKey: (target: BindingTarget) => string;
|
|
181
192
|
export type MappingBinding = {
|
|
182
193
|
nodeId: NodeId;
|
|
183
194
|
fieldId: string;
|
|
@@ -193,6 +204,16 @@ export type MappingFilter = {
|
|
|
193
204
|
operator: string;
|
|
194
205
|
value?: DocScalar;
|
|
195
206
|
};
|
|
207
|
+
/**
|
|
208
|
+
* One mapping root (§2.2a): a binding set over one traversal tree. `sourceId` names the
|
|
209
|
+
* concrete data source (never an abstract `'journal'` — OQ-V2-42); two entries may share
|
|
210
|
+
* one `sourceId` when a template binds two disjoint roots of the same source.
|
|
211
|
+
*/
|
|
212
|
+
export type QnrDataMapping = {
|
|
213
|
+
sourceId: string;
|
|
214
|
+
rootNodeId: NodeId;
|
|
215
|
+
bindingOrder?: BindingId[];
|
|
216
|
+
};
|
|
196
217
|
export type QnrTemplateDocument = {
|
|
197
218
|
documentId: string;
|
|
198
219
|
revision: number;
|
|
@@ -210,11 +231,7 @@ export type QnrTemplateDocument = {
|
|
|
210
231
|
visibilityRuleOrderByQuestionId?: Record<QuestionId, VisibilityRuleId[]>;
|
|
211
232
|
highlightRulesById?: Record<HighlightRuleId, HighlightRule>;
|
|
212
233
|
highlightRuleOrderByQuestionId?: Record<QuestionId, HighlightRuleId[]>;
|
|
213
|
-
dataMappingsById?: Record<MappingId,
|
|
214
|
-
sourceId: string;
|
|
215
|
-
rootNodeId: NodeId;
|
|
216
|
-
bindingOrder?: BindingId[];
|
|
217
|
-
}>;
|
|
234
|
+
dataMappingsById?: Record<MappingId, QnrDataMapping>;
|
|
218
235
|
mappingNodesById?: Record<NodeId, MappingNode>;
|
|
219
236
|
mappingBindingsById?: Record<BindingId, MappingBinding>;
|
|
220
237
|
mappingFiltersById?: Record<FilterId, MappingFilter>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateDocument.d.ts","sourceRoot":"","sources":["../../src/collaboration/templateDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEvE,MAAM,MAAM,UAAU,G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AW,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;CAC5C,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,eAAgB,MAAM,KAAG,mBAIzD,CAAA"}
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
* @see asma-modules/_docs/editor/qnrs/cross/2026-07-12-20-20-architecture-qnr-v2-model-collaboration-sync.md:193 (DOC-LAW-1)
|
|
12
12
|
* @see asma-modules/_docs/editor/qnrs/cross/2026-07-12-20-20-architecture-qnr-v2-model-collaboration-sync.md:214 (§2.2a mapping graph)
|
|
13
13
|
*/
|
|
14
|
+
/** Serialises a binding target so the "one binding per target" invariant is checkable. */
|
|
15
|
+
export const bindingTargetKey = (target) => target.kind === 'question'
|
|
16
|
+
? `question:${target.questionId}`
|
|
17
|
+
: `gridColumn:${target.gridQuestionId}:${target.columnQuestionId}`;
|
|
14
18
|
/**
|
|
15
19
|
* A new family's document. `questionOrder` is present-and-empty rather than absent
|
|
16
20
|
* because it is the document's only structural array and every reader indexes it; an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateDocument.js","sourceRoot":"","sources":["../../src/collaboration/templateDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"templateDocument.js","sourceRoot":"","sources":["../../src/collaboration/templateDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8KH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAqB,EAAU,EAAE,CAC9D,MAAM,CAAC,IAAI,KAAK,UAAU;IACtB,CAAC,CAAC,YAAY,MAAM,CAAC,UAAU,EAAE;IACjC,CAAC,CAAC,cAAc,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAA;AAsE1E;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,UAAkB,EAAuB,EAAE,CAAC,CAAC;IAC/E,UAAU;IACV,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,EAAE;CACpB,CAAC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { TemplateOp } from '../operations.js';
|
|
2
|
+
/**
|
|
3
|
+
* A seeded generator of authoring op sequences for the property tests.
|
|
4
|
+
*
|
|
5
|
+
* The generator keeps its own pools of "known" ids so most generated ops target things that
|
|
6
|
+
* exist (the reducer still throws on the genuinely conflicting ones — that is fine and is
|
|
7
|
+
* part of what the tests exercise). It is pure in the seed: the same seed yields the same
|
|
8
|
+
* sequence, which is what the determinism tests rely on.
|
|
9
|
+
*
|
|
10
|
+
* The op mix is intentionally broad and mildly unrealistic (renames without a preceding
|
|
11
|
+
* create, moves to random indices, rules set on any question) — the point is coverage of
|
|
12
|
+
* the reducer's conflict paths, not a faithful editing session.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DOCUMENT_ID = "tpl-prop";
|
|
15
|
+
type IdPools = {
|
|
16
|
+
questions: string[];
|
|
17
|
+
grids: string[];
|
|
18
|
+
gridRows: string[];
|
|
19
|
+
alternatives: string[];
|
|
20
|
+
tabs: string[];
|
|
21
|
+
actions: string[];
|
|
22
|
+
nodes: string[];
|
|
23
|
+
bindings: string[];
|
|
24
|
+
filters: string[];
|
|
25
|
+
visibilityRules: string[];
|
|
26
|
+
highlightRules: string[];
|
|
27
|
+
};
|
|
28
|
+
export type GeneratedSequence = {
|
|
29
|
+
ops: TemplateOp[];
|
|
30
|
+
/** Whether each op was applied (false = the reducer rejected it — expected conflicts). */
|
|
31
|
+
outcomes: boolean[];
|
|
32
|
+
pools: IdPools;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Generates `count` ops. `applyOnce` is the reducer's `applyOperation` guarded to return
|
|
36
|
+
* `null` on OperationConflictError, so the generator can feed back which ids now exist.
|
|
37
|
+
*/
|
|
38
|
+
export declare const generateOpSequence: (seed: number, count: number, applyOnce: (op: TemplateOp) => boolean) => GeneratedSequence;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=documentGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentGenerator.d.ts","sourceRoot":"","sources":["../../../src/collaboration/testHelpers/documentGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,WAAW,aAAa,CAAA;AAcrC,KAAK,OAAO,GAAG;IACX,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,cAAc,EAAE,MAAM,EAAE,CAAA;CAC3B,CAAA;AAyCD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,GAAG,EAAE,UAAU,EAAE,CAAA;IACjB,0FAA0F;IAC1F,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,SACrB,MAAM,SACL,MAAM,aACF,CAAC,EAAE,EAAE,UAAU,KAAK,OAAO,KACvC,iBAeF,CAAA"}
|