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,466 @@
|
|
|
1
|
+
import type { IsDefault } from './canonicalize.js';
|
|
2
|
+
import { type DocLawViolation } from './docLaws.js';
|
|
3
|
+
import { IMPLEMENTED_ANSWER_OP_TYPES } from './answerOperations.js';
|
|
4
|
+
import { IMPLEMENTED_OP_TYPES } from './operations.js';
|
|
5
|
+
import type { BindingTarget, QnrTemplateDocument } from './templateDocument.js';
|
|
6
|
+
export declare const qnrTemplateDocumentSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
7
|
+
documentId: string;
|
|
8
|
+
revision: number;
|
|
9
|
+
meta?: {
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
title?: string | undefined;
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
settings?: {
|
|
14
|
+
[x: string]: unknown;
|
|
15
|
+
journal?: {
|
|
16
|
+
requires_activity_id?: boolean | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
recipient?: {
|
|
19
|
+
ask_for_phone_nr?: boolean | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
instancePolicy?: {
|
|
23
|
+
requiredAccessLevel?: 1 | 2 | 3 | 4 | undefined;
|
|
24
|
+
invitationRequired?: boolean | undefined;
|
|
25
|
+
initiator?: "coordinator" | "recipient" | undefined;
|
|
26
|
+
template_update_mode?: "always" | "ask" | "never" | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
presentationProfiles?: Record<string, unknown> | undefined;
|
|
29
|
+
compatibility?: {
|
|
30
|
+
consentTemplateIds?: string[] | undefined;
|
|
31
|
+
smsTemplateIds?: string[] | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
questionsById?: {
|
|
35
|
+
[x: string]: {
|
|
36
|
+
[x: string]: unknown;
|
|
37
|
+
type: "BooleanQuestion" | "Chart" | "CheckBoxes" | "DateField" | "DocumentUpload" | "Dropdown" | "Emoticons" | "ExpressionQuestion" | "FormatNumber" | "LinearScale" | "Link" | "QuestionGrid" | "RadioButtons" | "Readonly" | "Space" | "TextLong" | "TextShort" | "Title" | "Widget";
|
|
38
|
+
subtype?: "EMAIL" | "ORDINARY" | undefined;
|
|
39
|
+
label?: string | undefined;
|
|
40
|
+
required?: boolean | undefined;
|
|
41
|
+
defaultValue?: string | number | boolean | undefined;
|
|
42
|
+
grid?: {
|
|
43
|
+
columnIds?: string[] | undefined;
|
|
44
|
+
minRows?: number | undefined;
|
|
45
|
+
maxRows?: number | undefined;
|
|
46
|
+
singleRow?: boolean | undefined;
|
|
47
|
+
deletableRows?: boolean | undefined;
|
|
48
|
+
alwaysNew?: boolean | undefined;
|
|
49
|
+
timestamps?: boolean | undefined;
|
|
50
|
+
editable?: boolean | undefined;
|
|
51
|
+
rowTitle?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
presentation?: {
|
|
54
|
+
[x: string]: unknown;
|
|
55
|
+
headerTabId?: string | undefined;
|
|
56
|
+
defaultColumnWidthsByQuestionId?: Record<string, number> | undefined;
|
|
57
|
+
} | undefined;
|
|
58
|
+
};
|
|
59
|
+
} | undefined;
|
|
60
|
+
questionOrder: string[];
|
|
61
|
+
gridRowsById?: {
|
|
62
|
+
[x: string]: {
|
|
63
|
+
[x: string]: unknown;
|
|
64
|
+
label?: string | undefined;
|
|
65
|
+
cells?: Record<string, string | number | boolean> | undefined;
|
|
66
|
+
};
|
|
67
|
+
} | undefined;
|
|
68
|
+
gridRowOrderByQuestionId?: Record<string, string[]> | undefined;
|
|
69
|
+
alternativesById?: {
|
|
70
|
+
[x: string]: {
|
|
71
|
+
[x: string]: unknown;
|
|
72
|
+
label?: string | undefined;
|
|
73
|
+
value?: string | number | boolean | undefined;
|
|
74
|
+
};
|
|
75
|
+
} | undefined;
|
|
76
|
+
alternativeOrderByQuestionId?: Record<string, string[]> | undefined;
|
|
77
|
+
tabsById?: {
|
|
78
|
+
[x: string]: {
|
|
79
|
+
[x: string]: unknown;
|
|
80
|
+
label?: string | undefined;
|
|
81
|
+
};
|
|
82
|
+
} | undefined;
|
|
83
|
+
tabOrder?: string[] | undefined;
|
|
84
|
+
actionsById?: {
|
|
85
|
+
[x: string]: {
|
|
86
|
+
[x: string]: unknown;
|
|
87
|
+
kind?: string | undefined;
|
|
88
|
+
};
|
|
89
|
+
} | undefined;
|
|
90
|
+
visibilityRulesById?: {
|
|
91
|
+
[x: string]: {
|
|
92
|
+
[x: string]: unknown;
|
|
93
|
+
condition: {
|
|
94
|
+
[x: string]: unknown;
|
|
95
|
+
sourceQuestionId: string;
|
|
96
|
+
alternativeId?: string | undefined;
|
|
97
|
+
operator?: string | undefined;
|
|
98
|
+
value?: string | number | boolean | undefined;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
} | undefined;
|
|
102
|
+
visibilityRuleOrderByQuestionId?: Record<string, string[]> | undefined;
|
|
103
|
+
highlightRulesById?: {
|
|
104
|
+
[x: string]: {
|
|
105
|
+
[x: string]: unknown;
|
|
106
|
+
condition: {
|
|
107
|
+
[x: string]: unknown;
|
|
108
|
+
sourceQuestionId: string;
|
|
109
|
+
alternativeId?: string | undefined;
|
|
110
|
+
operator?: string | undefined;
|
|
111
|
+
value?: string | number | boolean | undefined;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
} | undefined;
|
|
115
|
+
highlightRuleOrderByQuestionId?: Record<string, string[]> | undefined;
|
|
116
|
+
dataMappingsById?: {
|
|
117
|
+
[x: string]: {
|
|
118
|
+
sourceId: string;
|
|
119
|
+
rootNodeId: string;
|
|
120
|
+
bindingOrder?: string[] | undefined;
|
|
121
|
+
};
|
|
122
|
+
} | undefined;
|
|
123
|
+
mappingNodesById?: {
|
|
124
|
+
[x: string]: {
|
|
125
|
+
[x: string]: unknown;
|
|
126
|
+
entityId: string;
|
|
127
|
+
parentNodeId?: string | undefined;
|
|
128
|
+
relationshipId?: string | undefined;
|
|
129
|
+
filterOrder?: string[] | undefined;
|
|
130
|
+
};
|
|
131
|
+
} | undefined;
|
|
132
|
+
mappingBindingsById?: {
|
|
133
|
+
[x: string]: {
|
|
134
|
+
[x: string]: unknown;
|
|
135
|
+
nodeId: string;
|
|
136
|
+
fieldId: string;
|
|
137
|
+
target: {
|
|
138
|
+
kind: "question";
|
|
139
|
+
questionId: string;
|
|
140
|
+
} | {
|
|
141
|
+
kind: "gridColumn";
|
|
142
|
+
gridQuestionId: string;
|
|
143
|
+
columnQuestionId: string;
|
|
144
|
+
};
|
|
145
|
+
cardinality?: string | undefined;
|
|
146
|
+
onMissing?: string | undefined;
|
|
147
|
+
onMany?: string | undefined;
|
|
148
|
+
};
|
|
149
|
+
} | undefined;
|
|
150
|
+
mappingFiltersById?: {
|
|
151
|
+
[x: string]: {
|
|
152
|
+
fieldId: string;
|
|
153
|
+
operator: string;
|
|
154
|
+
value?: string | number | boolean | undefined;
|
|
155
|
+
};
|
|
156
|
+
} | undefined;
|
|
157
|
+
}, {}>;
|
|
158
|
+
export declare const qnrAnswerDocumentSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
159
|
+
documentId: string;
|
|
160
|
+
revision: number;
|
|
161
|
+
answersByQuestionId?: Record<string, string | number | boolean | (string | number | boolean)[] | null> | undefined;
|
|
162
|
+
gridAnswersByQuestionId?: Record<string, Record<string, Record<string, string | number | boolean | (string | number | boolean)[] | null>>> | undefined;
|
|
163
|
+
answerGridRowsById?: {
|
|
164
|
+
[x: string]: {
|
|
165
|
+
questionGridId: string;
|
|
166
|
+
entityRef?: string | undefined;
|
|
167
|
+
deleted: true;
|
|
168
|
+
};
|
|
169
|
+
} | undefined;
|
|
170
|
+
answerGridRowOrderByQuestionId?: Record<string, string[]> | undefined;
|
|
171
|
+
}, {}>;
|
|
172
|
+
export declare const templateOpSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
173
|
+
type: "template.updateMeta";
|
|
174
|
+
patch: Record<string, string | number | boolean | (string | number | boolean)[] | Record<string, unknown> | null>;
|
|
175
|
+
} | {
|
|
176
|
+
type: "template.updateSettings";
|
|
177
|
+
patch: Record<string, string | number | boolean | (string | number | boolean)[] | Record<string, unknown> | null>;
|
|
178
|
+
} | {
|
|
179
|
+
type: "question.create";
|
|
180
|
+
questionId: string;
|
|
181
|
+
questionType: "BooleanQuestion" | "Chart" | "CheckBoxes" | "DateField" | "DocumentUpload" | "Dropdown" | "Emoticons" | "ExpressionQuestion" | "FormatNumber" | "LinearScale" | "Link" | "QuestionGrid" | "RadioButtons" | "Readonly" | "Space" | "TextLong" | "TextShort" | "Title" | "Widget";
|
|
182
|
+
atIndex?: number | undefined;
|
|
183
|
+
} | {
|
|
184
|
+
type: "question.updateField";
|
|
185
|
+
questionId: string;
|
|
186
|
+
field: string;
|
|
187
|
+
value: string | number | boolean | (string | number | boolean)[] | null;
|
|
188
|
+
} | {
|
|
189
|
+
type: "question.move";
|
|
190
|
+
questionId: string;
|
|
191
|
+
toIndex: number;
|
|
192
|
+
} | {
|
|
193
|
+
type: "question.delete";
|
|
194
|
+
questionId: string;
|
|
195
|
+
} | {
|
|
196
|
+
type: "gridRow.create";
|
|
197
|
+
questionId: string;
|
|
198
|
+
rowId: string;
|
|
199
|
+
label?: string | undefined;
|
|
200
|
+
atIndex?: number | undefined;
|
|
201
|
+
} | {
|
|
202
|
+
type: "gridRow.move";
|
|
203
|
+
questionId: string;
|
|
204
|
+
rowId: string;
|
|
205
|
+
afterRowId: string | null;
|
|
206
|
+
} | {
|
|
207
|
+
type: "gridRow.delete";
|
|
208
|
+
questionId: string;
|
|
209
|
+
rowId: string;
|
|
210
|
+
} | {
|
|
211
|
+
type: "gridRow.updateCell";
|
|
212
|
+
questionId: string;
|
|
213
|
+
rowId: string;
|
|
214
|
+
columnQuestionId: string;
|
|
215
|
+
value: string | number | boolean | (string | number | boolean)[] | null;
|
|
216
|
+
} | {
|
|
217
|
+
type: "alternative.create";
|
|
218
|
+
questionId: string;
|
|
219
|
+
alternativeId: string;
|
|
220
|
+
label?: string | undefined;
|
|
221
|
+
atIndex?: number | undefined;
|
|
222
|
+
} | {
|
|
223
|
+
type: "alternative.updateField";
|
|
224
|
+
questionId: string;
|
|
225
|
+
alternativeId: string;
|
|
226
|
+
field: string;
|
|
227
|
+
value: string | number | boolean | (string | number | boolean)[] | null;
|
|
228
|
+
} | {
|
|
229
|
+
type: "alternative.move";
|
|
230
|
+
questionId: string;
|
|
231
|
+
alternativeId: string;
|
|
232
|
+
toIndex: number;
|
|
233
|
+
} | {
|
|
234
|
+
type: "alternative.delete";
|
|
235
|
+
questionId: string;
|
|
236
|
+
alternativeId: string;
|
|
237
|
+
} | {
|
|
238
|
+
type: "tab.create";
|
|
239
|
+
tabId: string;
|
|
240
|
+
label?: string | undefined;
|
|
241
|
+
atIndex?: number | undefined;
|
|
242
|
+
} | {
|
|
243
|
+
type: "tab.updateField";
|
|
244
|
+
tabId: string;
|
|
245
|
+
field: string;
|
|
246
|
+
value: string | number | boolean | (string | number | boolean)[] | null;
|
|
247
|
+
} | {
|
|
248
|
+
type: "tab.move";
|
|
249
|
+
tabId: string;
|
|
250
|
+
toIndex: number;
|
|
251
|
+
} | {
|
|
252
|
+
type: "tab.delete";
|
|
253
|
+
tabId: string;
|
|
254
|
+
} | {
|
|
255
|
+
type: "action.create";
|
|
256
|
+
actionId: string;
|
|
257
|
+
kind?: string | undefined;
|
|
258
|
+
} | {
|
|
259
|
+
type: "action.updateField";
|
|
260
|
+
actionId: string;
|
|
261
|
+
field: string;
|
|
262
|
+
value: string | number | boolean | (string | number | boolean)[] | null;
|
|
263
|
+
} | {
|
|
264
|
+
type: "action.delete";
|
|
265
|
+
actionId: string;
|
|
266
|
+
} | {
|
|
267
|
+
type: "dataMapping.create";
|
|
268
|
+
mappingId: string;
|
|
269
|
+
sourceId: string;
|
|
270
|
+
rootNodeId: string;
|
|
271
|
+
} | {
|
|
272
|
+
type: "dataMapping.delete";
|
|
273
|
+
mappingId: string;
|
|
274
|
+
} | {
|
|
275
|
+
type: "mappingNode.create";
|
|
276
|
+
nodeId: string;
|
|
277
|
+
entityId: string;
|
|
278
|
+
parentNodeId?: string | undefined;
|
|
279
|
+
relationshipId?: string | undefined;
|
|
280
|
+
} | {
|
|
281
|
+
type: "mappingNode.update";
|
|
282
|
+
nodeId: string;
|
|
283
|
+
patch: {
|
|
284
|
+
entityId?: string | undefined;
|
|
285
|
+
parentNodeId?: string | null | undefined;
|
|
286
|
+
relationshipId?: string | null | undefined;
|
|
287
|
+
filterOrder?: string[] | undefined;
|
|
288
|
+
};
|
|
289
|
+
} | {
|
|
290
|
+
type: "mappingNode.delete";
|
|
291
|
+
nodeId: string;
|
|
292
|
+
} | {
|
|
293
|
+
type: "mappingBinding.create";
|
|
294
|
+
bindingId: string;
|
|
295
|
+
nodeId: string;
|
|
296
|
+
fieldId: string;
|
|
297
|
+
target: {
|
|
298
|
+
kind: "question";
|
|
299
|
+
questionId: string;
|
|
300
|
+
} | {
|
|
301
|
+
kind: "gridColumn";
|
|
302
|
+
gridQuestionId: string;
|
|
303
|
+
columnQuestionId: string;
|
|
304
|
+
};
|
|
305
|
+
} | {
|
|
306
|
+
type: "mappingBinding.update";
|
|
307
|
+
bindingId: string;
|
|
308
|
+
patch: {
|
|
309
|
+
nodeId?: string | undefined;
|
|
310
|
+
fieldId?: string | undefined;
|
|
311
|
+
target?: {
|
|
312
|
+
kind: "question";
|
|
313
|
+
questionId: string;
|
|
314
|
+
} | {
|
|
315
|
+
kind: "gridColumn";
|
|
316
|
+
gridQuestionId: string;
|
|
317
|
+
columnQuestionId: string;
|
|
318
|
+
} | undefined;
|
|
319
|
+
};
|
|
320
|
+
} | {
|
|
321
|
+
type: "mappingBinding.delete";
|
|
322
|
+
bindingId: string;
|
|
323
|
+
} | {
|
|
324
|
+
type: "mappingFilter.set";
|
|
325
|
+
filterId: string;
|
|
326
|
+
nodeId: string;
|
|
327
|
+
fieldId: string;
|
|
328
|
+
operator: string;
|
|
329
|
+
value: string | number | boolean;
|
|
330
|
+
} | {
|
|
331
|
+
type: "mappingFilter.delete";
|
|
332
|
+
filterId: string;
|
|
333
|
+
} | {
|
|
334
|
+
type: "visibilityRule.set";
|
|
335
|
+
ruleId: string;
|
|
336
|
+
questionId: string;
|
|
337
|
+
condition: {
|
|
338
|
+
[x: string]: unknown;
|
|
339
|
+
sourceQuestionId: string;
|
|
340
|
+
alternativeId?: string | undefined;
|
|
341
|
+
operator?: string | undefined;
|
|
342
|
+
value?: string | number | boolean | undefined;
|
|
343
|
+
};
|
|
344
|
+
} | {
|
|
345
|
+
type: "visibilityRule.delete";
|
|
346
|
+
ruleId: string;
|
|
347
|
+
} | {
|
|
348
|
+
type: "highlightRule.set";
|
|
349
|
+
ruleId: string;
|
|
350
|
+
questionId: string;
|
|
351
|
+
condition: {
|
|
352
|
+
[x: string]: unknown;
|
|
353
|
+
sourceQuestionId: string;
|
|
354
|
+
alternativeId?: string | undefined;
|
|
355
|
+
operator?: string | undefined;
|
|
356
|
+
value?: string | number | boolean | undefined;
|
|
357
|
+
};
|
|
358
|
+
} | {
|
|
359
|
+
type: "highlightRule.delete";
|
|
360
|
+
ruleId: string;
|
|
361
|
+
}, {}>;
|
|
362
|
+
export declare const answerOpSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
363
|
+
type: "answer.set";
|
|
364
|
+
questionId: string;
|
|
365
|
+
value: string | number | boolean | (string | number | boolean)[] | null;
|
|
366
|
+
} | {
|
|
367
|
+
type: "answer.clear";
|
|
368
|
+
questionId: string;
|
|
369
|
+
} | {
|
|
370
|
+
type: "gridRow.add";
|
|
371
|
+
questionId: string;
|
|
372
|
+
rowId: string;
|
|
373
|
+
afterRowId?: string | undefined;
|
|
374
|
+
} | {
|
|
375
|
+
type: "gridRow.move";
|
|
376
|
+
questionId: string;
|
|
377
|
+
rowId: string;
|
|
378
|
+
afterRowId: string | null;
|
|
379
|
+
} | {
|
|
380
|
+
type: "gridRow.remove";
|
|
381
|
+
questionId: string;
|
|
382
|
+
rowId: string;
|
|
383
|
+
} | {
|
|
384
|
+
type: "gridAnswer.set";
|
|
385
|
+
questionId: string;
|
|
386
|
+
rowId: string;
|
|
387
|
+
columnQuestionId: string;
|
|
388
|
+
value: string | number | boolean | (string | number | boolean)[] | null;
|
|
389
|
+
}, {}>;
|
|
390
|
+
/**
|
|
391
|
+
* The op names the schemas actually validate, extracted from the JSON Schema output. The
|
|
392
|
+
* parity test asserts these equal `IMPLEMENTED_OP_TYPES` — a vocabulary member added to the
|
|
393
|
+
* TS union but forgotten in the schemas (or vice versa) is a red build, not a runtime gap.
|
|
394
|
+
*/
|
|
395
|
+
export declare const SCHEMA_TEMPLATE_OP_TYPES: readonly string[];
|
|
396
|
+
export declare const SCHEMA_ANSWER_OP_TYPES: readonly string[];
|
|
397
|
+
/** A schema position where a DOC-LAW violation is reported (path follows the JSON pointer). */
|
|
398
|
+
export type SchemaViolation = {
|
|
399
|
+
law: 'DOC-LAW-1' | 'DOC-LAW-2';
|
|
400
|
+
/** Path into the JSON Schema document; `[]` marks array element positions. */
|
|
401
|
+
path: string;
|
|
402
|
+
detail: string;
|
|
403
|
+
};
|
|
404
|
+
type JsonSchemaNode = {
|
|
405
|
+
$ref?: string;
|
|
406
|
+
$defs?: Record<string, JsonSchemaNode>;
|
|
407
|
+
type?: string | string[];
|
|
408
|
+
const?: unknown;
|
|
409
|
+
enum?: unknown[];
|
|
410
|
+
properties?: Record<string, JsonSchemaNode>;
|
|
411
|
+
additionalProperties?: JsonSchemaNode | boolean;
|
|
412
|
+
items?: JsonSchemaNode | JsonSchemaNode[];
|
|
413
|
+
prefixItems?: JsonSchemaNode[];
|
|
414
|
+
anyOf?: JsonSchemaNode[];
|
|
415
|
+
oneOf?: JsonSchemaNode[];
|
|
416
|
+
allOf?: JsonSchemaNode[];
|
|
417
|
+
not?: JsonSchemaNode;
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* The DOC-LAW-1/2 schema lint (plan TASK-003). Walks the JSON Schema output of a document
|
|
421
|
+
* schema and reports every array-of-objects (DOC-LAW-1) and every position that allows
|
|
422
|
+
* `null` (DOC-LAW-2). `allowNullAt` names the DOC-LAW-2 exception positions — the answer
|
|
423
|
+
* document's answer-value leaves (OQ-V2-24); the template document allows none.
|
|
424
|
+
*
|
|
425
|
+
* It is a contract test, not a runtime guard: validation of incoming documents happens on
|
|
426
|
+
* the schema itself, and a payload can only fail the law by failing the schema.
|
|
427
|
+
*/
|
|
428
|
+
export declare const findSchemaDocLawViolations: (schemaJson: JsonSchemaNode, options?: {
|
|
429
|
+
allowNullAt?: (path: string) => boolean;
|
|
430
|
+
}) => SchemaViolation[];
|
|
431
|
+
/** The template document admits no explicit null anywhere (DOC-LAW-2, strict scope). */
|
|
432
|
+
export declare const findTemplateSchemaDocLawViolations: () => SchemaViolation[];
|
|
433
|
+
/** The answer document's answer-value leaves are the one legal null home (OQ-V2-24). */
|
|
434
|
+
export declare const findAnswerSchemaDocLawViolations: () => SchemaViolation[];
|
|
435
|
+
export declare const templateDocumentIsDefault: IsDefault;
|
|
436
|
+
/**
|
|
437
|
+
* The instance-side half of the default lint: every present-and-default field on a stored
|
|
438
|
+
* template document, ready for the contract test to reject. Complements
|
|
439
|
+
* `findDocLawViolations` (which owns null/empty collections); this one owns defaults.
|
|
440
|
+
*/
|
|
441
|
+
export declare const findDocLawDefaultViolations: (document: QnrTemplateDocument) => DocLawViolation[];
|
|
442
|
+
/**
|
|
443
|
+
* The §2.2a cardinality invariant as an executable check: at most one binding per target.
|
|
444
|
+
* The reducer enforces it on `mappingBinding.create/update`; this validator covers every
|
|
445
|
+
* other writer (import, direct document writes) so the invariant is total.
|
|
446
|
+
*/
|
|
447
|
+
export declare const findDuplicateBindingTargets: (document: QnrTemplateDocument) => Array<{
|
|
448
|
+
target: BindingTarget;
|
|
449
|
+
bindingIds: string[];
|
|
450
|
+
}>;
|
|
451
|
+
export type Validation<T> = {
|
|
452
|
+
ok: true;
|
|
453
|
+
value: T;
|
|
454
|
+
} | {
|
|
455
|
+
ok: false;
|
|
456
|
+
summary: string;
|
|
457
|
+
};
|
|
458
|
+
export declare const validateTemplateDocument: (value: unknown) => Validation<QnrTemplateDocument>;
|
|
459
|
+
/**
|
|
460
|
+
* Full template-document admission check for the contract test: schema + DOC-LAW-1/2 lints +
|
|
461
|
+
* default lint + binding uniqueness. A document passes only in its canonical minimal form.
|
|
462
|
+
*/
|
|
463
|
+
export declare const findTemplateDocumentContractViolations: (document: QnrTemplateDocument) => DocLawViolation[];
|
|
464
|
+
export declare const findDuplicateBindingTargetsSummary: (document: QnrTemplateDocument) => string[];
|
|
465
|
+
export { IMPLEMENTED_OP_TYPES, IMPLEMENTED_ANSWER_OP_TYPES };
|
|
466
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/collaboration/schemas.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAiL/E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqBpC,CAAA;AAIF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;MAalC,CAAA;AAIF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAyF5B,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;MAa1B,CAAA;AAiBD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAkC,CAAA;AACxF,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EA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