@primmel/primmel 1.12.0 → 1.14.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/dist/src/check-rules.d.ts.map +1 -1
- package/dist/src/check-rules.js +115 -0
- package/dist/src/check-rules.js.map +1 -1
- package/dist/src/check.d.ts.map +1 -1
- package/dist/src/check.js +896 -0
- package/dist/src/check.js.map +1 -1
- package/dist/src/model-diff.d.ts.map +1 -1
- package/dist/src/model-diff.js +40 -0
- package/dist/src/model-diff.js.map +1 -1
- package/dist/src/ser-des/config/applicationDeclaration.d.ts +5 -0
- package/dist/src/ser-des/config/applicationDeclaration.d.ts.map +1 -0
- package/dist/src/ser-des/config/applicationDeclaration.js +102 -0
- package/dist/src/ser-des/config/applicationDeclaration.js.map +1 -0
- package/dist/src/ser-des/config/aspect.d.ts +5 -0
- package/dist/src/ser-des/config/aspect.d.ts.map +1 -0
- package/dist/src/ser-des/config/aspect.js +128 -0
- package/dist/src/ser-des/config/aspect.js.map +1 -0
- package/dist/src/ser-des/config/calculation.d.ts.map +1 -1
- package/dist/src/ser-des/config/calculation.js +134 -18
- package/dist/src/ser-des/config/calculation.js.map +1 -1
- package/dist/src/ser-des/config/calculationContext.d.ts +5 -0
- package/dist/src/ser-des/config/calculationContext.d.ts.map +1 -0
- package/dist/src/ser-des/config/calculationContext.js +62 -0
- package/dist/src/ser-des/config/calculationContext.js.map +1 -0
- package/dist/src/ser-des/config/certificateTemplate.d.ts +5 -0
- package/dist/src/ser-des/config/certificateTemplate.d.ts.map +1 -0
- package/dist/src/ser-des/config/certificateTemplate.js +195 -0
- package/dist/src/ser-des/config/certificateTemplate.js.map +1 -0
- package/dist/src/ser-des/config/commonTestCondition.d.ts +5 -0
- package/dist/src/ser-des/config/commonTestCondition.d.ts.map +1 -0
- package/dist/src/ser-des/config/commonTestCondition.js +75 -0
- package/dist/src/ser-des/config/commonTestCondition.js.map +1 -0
- package/dist/src/ser-des/config/evaluationDimension.d.ts +5 -0
- package/dist/src/ser-des/config/evaluationDimension.d.ts.map +1 -0
- package/dist/src/ser-des/config/evaluationDimension.js +128 -0
- package/dist/src/ser-des/config/evaluationDimension.js.map +1 -0
- package/dist/src/ser-des/config/evaluationProfile.d.ts +5 -0
- package/dist/src/ser-des/config/evaluationProfile.d.ts.map +1 -0
- package/dist/src/ser-des/config/evaluationProfile.js +61 -0
- package/dist/src/ser-des/config/evaluationProfile.js.map +1 -0
- package/dist/src/ser-des/config/formulaNote.d.ts +5 -0
- package/dist/src/ser-des/config/formulaNote.d.ts.map +1 -0
- package/dist/src/ser-des/config/formulaNote.js +66 -0
- package/dist/src/ser-des/config/formulaNote.js.map +1 -0
- package/dist/src/ser-des/config/identitySlot.d.ts +5 -0
- package/dist/src/ser-des/config/identitySlot.d.ts.map +1 -0
- package/dist/src/ser-des/config/identitySlot.js +120 -0
- package/dist/src/ser-des/config/identitySlot.js.map +1 -0
- package/dist/src/ser-des/config/index.d.ts.map +1 -1
- package/dist/src/ser-des/config/index.js +200 -0
- package/dist/src/ser-des/config/index.js.map +1 -1
- package/dist/src/ser-des/config/partAnnex.d.ts +5 -0
- package/dist/src/ser-des/config/partAnnex.d.ts.map +1 -0
- package/dist/src/ser-des/config/partAnnex.js +91 -0
- package/dist/src/ser-des/config/partAnnex.js.map +1 -0
- package/dist/src/ser-des/config/promiseSet.d.ts +5 -0
- package/dist/src/ser-des/config/promiseSet.d.ts.map +1 -0
- package/dist/src/ser-des/config/promiseSet.js +46 -0
- package/dist/src/ser-des/config/promiseSet.js.map +1 -0
- package/dist/src/ser-des/config/selectionRules.d.ts +9 -0
- package/dist/src/ser-des/config/selectionRules.d.ts.map +1 -0
- package/dist/src/ser-des/config/selectionRules.js +372 -0
- package/dist/src/ser-des/config/selectionRules.js.map +1 -0
- package/dist/src/ser-des/config/storyline.d.ts +7 -0
- package/dist/src/ser-des/config/storyline.d.ts.map +1 -0
- package/dist/src/ser-des/config/storyline.js +264 -0
- package/dist/src/ser-des/config/storyline.js.map +1 -0
- package/dist/src/ser-des/config/subject.d.ts +18 -1
- package/dist/src/ser-des/config/subject.d.ts.map +1 -1
- package/dist/src/ser-des/config/subject.js +270 -61
- package/dist/src/ser-des/config/subject.js.map +1 -1
- package/dist/src/ser-des/config/testReport.d.ts +7 -0
- package/dist/src/ser-des/config/testReport.d.ts.map +1 -0
- package/dist/src/ser-des/config/testReport.js +322 -0
- package/dist/src/ser-des/config/testReport.js.map +1 -0
- package/dist/src/ser-des/config/verificationPathway.d.ts +5 -0
- package/dist/src/ser-des/config/verificationPathway.d.ts.map +1 -0
- package/dist/src/ser-des/config/verificationPathway.js +361 -0
- package/dist/src/ser-des/config/verificationPathway.js.map +1 -0
- package/dist/src/ser-des/config/workflowConfig.d.ts +5 -0
- package/dist/src/ser-des/config/workflowConfig.d.ts.map +1 -0
- package/dist/src/ser-des/config/workflowConfig.js +129 -0
- package/dist/src/ser-des/config/workflowConfig.js.map +1 -0
- package/dist/src/ser-des/package.d.ts +10 -0
- package/dist/src/ser-des/package.d.ts.map +1 -1
- package/dist/src/ser-des/package.js +166 -12
- package/dist/src/ser-des/package.js.map +1 -1
- package/dist/src/ser-des/parse.d.ts.map +1 -1
- package/dist/src/ser-des/parse.js +29 -0
- package/dist/src/ser-des/parse.js.map +1 -1
- package/dist/src/ser-des/types.d.ts +37 -0
- package/dist/src/ser-des/types.d.ts.map +1 -1
- package/dist/src/types/ApplicationDeclaration.d.ts +23 -0
- package/dist/src/types/ApplicationDeclaration.d.ts.map +1 -0
- package/dist/src/types/ApplicationDeclaration.js +32 -0
- package/dist/src/types/ApplicationDeclaration.js.map +1 -0
- package/dist/src/types/Aspect.d.ts +30 -0
- package/dist/src/types/Aspect.d.ts.map +1 -0
- package/dist/src/types/Aspect.js +41 -0
- package/dist/src/types/Aspect.js.map +1 -0
- package/dist/src/types/Calculation.d.ts +35 -0
- package/dist/src/types/Calculation.d.ts.map +1 -1
- package/dist/src/types/CalculationContext.d.ts +17 -0
- package/dist/src/types/CalculationContext.d.ts.map +1 -0
- package/dist/src/types/CalculationContext.js +34 -0
- package/dist/src/types/CalculationContext.js.map +1 -0
- package/dist/src/types/CertificateTemplate.d.ts +46 -0
- package/dist/src/types/CertificateTemplate.d.ts.map +1 -0
- package/dist/src/types/CertificateTemplate.js +46 -0
- package/dist/src/types/CertificateTemplate.js.map +1 -0
- package/dist/src/types/CommonTestCondition.d.ts +15 -0
- package/dist/src/types/CommonTestCondition.d.ts.map +1 -0
- package/dist/src/types/CommonTestCondition.js +22 -0
- package/dist/src/types/CommonTestCondition.js.map +1 -0
- package/dist/src/types/EvaluationDimension.d.ts +32 -0
- package/dist/src/types/EvaluationDimension.d.ts.map +1 -0
- package/dist/src/types/EvaluationDimension.js +38 -0
- package/dist/src/types/EvaluationDimension.js.map +1 -0
- package/dist/src/types/EvaluationProfile.d.ts +10 -0
- package/dist/src/types/EvaluationProfile.d.ts.map +1 -0
- package/dist/src/types/EvaluationProfile.js +25 -0
- package/dist/src/types/EvaluationProfile.js.map +1 -0
- package/dist/src/types/IdentitySlot.d.ts +24 -0
- package/dist/src/types/IdentitySlot.d.ts.map +1 -0
- package/dist/src/types/IdentitySlot.js +34 -0
- package/dist/src/types/IdentitySlot.js.map +1 -0
- package/dist/src/types/PartAnnex.d.ts +18 -0
- package/dist/src/types/PartAnnex.d.ts.map +1 -0
- package/dist/src/types/PartAnnex.js +29 -0
- package/dist/src/types/PartAnnex.js.map +1 -0
- package/dist/src/types/PromiseSet.d.ts +8 -0
- package/dist/src/types/PromiseSet.d.ts.map +1 -0
- package/dist/src/types/PromiseSet.js +35 -0
- package/dist/src/types/PromiseSet.js.map +1 -0
- package/dist/src/types/SelectionRules.d.ts +73 -0
- package/dist/src/types/SelectionRules.d.ts.map +1 -0
- package/dist/src/types/SelectionRules.js +55 -0
- package/dist/src/types/SelectionRules.js.map +1 -0
- package/dist/src/types/Standard.d.ts +73 -0
- package/dist/src/types/Standard.d.ts.map +1 -1
- package/dist/src/types/Storyline.d.ts +62 -0
- package/dist/src/types/Storyline.d.ts.map +1 -0
- package/dist/src/types/Storyline.js +51 -0
- package/dist/src/types/Storyline.js.map +1 -0
- package/dist/src/types/Subject.d.ts +64 -1
- package/dist/src/types/Subject.d.ts.map +1 -1
- package/dist/src/types/Symbol.d.ts +17 -0
- package/dist/src/types/Symbol.d.ts.map +1 -1
- package/dist/src/types/TestReport.d.ts +71 -0
- package/dist/src/types/TestReport.d.ts.map +1 -0
- package/dist/src/types/TestReport.js +73 -0
- package/dist/src/types/TestReport.js.map +1 -0
- package/dist/src/types/VerificationPathway.d.ts +63 -0
- package/dist/src/types/VerificationPathway.d.ts.map +1 -0
- package/dist/src/types/VerificationPathway.js +56 -0
- package/dist/src/types/VerificationPathway.js.map +1 -0
- package/dist/src/types/WorkflowConfig.d.ts +34 -0
- package/dist/src/types/WorkflowConfig.d.ts.map +1 -0
- package/dist/src/types/WorkflowConfig.js +47 -0
- package/dist/src/types/WorkflowConfig.js.map +1 -0
- package/dist-browser/index.mjs +2391 -934
- package/dist-cli/primmel.mjs +9364 -5469
- package/package.json +1 -1
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
3
|
+
// The selection-rule constructs (smart TODO.roadmap/40 batch 3; the
|
|
4
|
+
// packages-as-SSOT epic) — `lab_selection_criterion`,
|
|
5
|
+
// `sample_selection_rule`, and `specimen_governance_rule` in ONE file
|
|
6
|
+
// (the schemeType.ts two-construct precedent; types/SelectionRules.ts
|
|
7
|
+
// carries the banner and the grammar sketches). The weight /
|
|
8
|
+
// parameter_type / match-operator / test_kind vocabularies are
|
|
9
|
+
// parse-enforced (the fail-closed precedent); the model_field
|
|
10
|
+
// resolutions and the operator-conditional facets are check-enforced
|
|
11
|
+
// (C139) — the codec stays total. The applicability / selector /
|
|
12
|
+
// constraint strings are prose or pseudo-code — never resolved.
|
|
13
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.dumpSpecimenGovernanceRule = exports.parseSpecimenGovernanceRule = exports.dumpSampleSelectionRule = exports.parseSampleSelectionRule = exports.dumpLabSelectionCriterion = exports.parseLabSelectionCriterion = void 0;
|
|
16
|
+
const tokenize_1 = require("../tokenize");
|
|
17
|
+
const parse_block_1 = require("../parse-block");
|
|
18
|
+
const field_parser_1 = require("./field-parser");
|
|
19
|
+
const CRITERION_WEIGHTS = ['required', 'preferred'];
|
|
20
|
+
const CRITERION_PARAMETER_TYPES = [
|
|
21
|
+
'dimension',
|
|
22
|
+
'parameter',
|
|
23
|
+
'operational',
|
|
24
|
+
];
|
|
25
|
+
const MATCH_OPERATORS = [
|
|
26
|
+
'has_capability',
|
|
27
|
+
'capability_from_field',
|
|
28
|
+
'capability_covers_value',
|
|
29
|
+
'capability_prefix_match',
|
|
30
|
+
'always_pass',
|
|
31
|
+
];
|
|
32
|
+
const SAMPLE_TEST_KINDS = [
|
|
33
|
+
'full_evaluation',
|
|
34
|
+
'partial_evaluation',
|
|
35
|
+
'deduplicate',
|
|
36
|
+
'humidity',
|
|
37
|
+
'digital_additional',
|
|
38
|
+
];
|
|
39
|
+
function readStringMap(block) {
|
|
40
|
+
const out = {};
|
|
41
|
+
const t = (0, tokenize_1.default)((0, tokenize_1.unwrapBlock)(block));
|
|
42
|
+
for (let i = 0; i + 1 < t.length; i += 2) {
|
|
43
|
+
const k = (0, tokenize_1.stripWrapping)((0, field_parser_1.stripColon)(t[i]));
|
|
44
|
+
if (k) {
|
|
45
|
+
out[k] = (0, tokenize_1.stripWrapping)(t[i + 1]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
// ── lab_selection_criterion ─────────────────────────────────────────
|
|
51
|
+
const parseLabSelectionCriterion = (id, data) => {
|
|
52
|
+
const c = {
|
|
53
|
+
id,
|
|
54
|
+
weight: '',
|
|
55
|
+
parameterType: '',
|
|
56
|
+
label: '',
|
|
57
|
+
description: '',
|
|
58
|
+
appliesWhen: null,
|
|
59
|
+
match: null,
|
|
60
|
+
};
|
|
61
|
+
(0, parse_block_1.forEachEntry)(data, (keyword, value) => {
|
|
62
|
+
if (keyword === 'weight') {
|
|
63
|
+
const w = (0, tokenize_1.stripWrapping)(value());
|
|
64
|
+
if (!CRITERION_WEIGHTS.includes(w)) {
|
|
65
|
+
throw new Error(`Parsing error: lab_selection_criterion. ID ${id}: Unknown weight "${w}" (valid: ${CRITERION_WEIGHTS.join(', ')})`);
|
|
66
|
+
}
|
|
67
|
+
c.weight = w;
|
|
68
|
+
}
|
|
69
|
+
else if (keyword === 'parameter_type') {
|
|
70
|
+
const p = (0, tokenize_1.stripWrapping)(value());
|
|
71
|
+
if (!CRITERION_PARAMETER_TYPES.includes(p)) {
|
|
72
|
+
throw new Error(`Parsing error: lab_selection_criterion. ID ${id}: Unknown parameter_type "${p}" (valid: ${CRITERION_PARAMETER_TYPES.join(', ')})`);
|
|
73
|
+
}
|
|
74
|
+
c.parameterType = p;
|
|
75
|
+
}
|
|
76
|
+
else if (keyword === 'label') {
|
|
77
|
+
c.label = (0, tokenize_1.stripWrapping)(value());
|
|
78
|
+
}
|
|
79
|
+
else if (keyword === 'description') {
|
|
80
|
+
c.description = (0, tokenize_1.stripWrapping)(value());
|
|
81
|
+
}
|
|
82
|
+
else if (keyword === 'applies_when') {
|
|
83
|
+
const aw = {
|
|
84
|
+
modelField: '',
|
|
85
|
+
in: [],
|
|
86
|
+
equals: '',
|
|
87
|
+
notNull: null,
|
|
88
|
+
};
|
|
89
|
+
(0, parse_block_1.forEachEntry)((0, tokenize_1.unwrapBlock)(value()), (k2, v2) => {
|
|
90
|
+
if (k2 === 'model_field') {
|
|
91
|
+
aw.modelField = (0, tokenize_1.stripWrapping)(v2());
|
|
92
|
+
}
|
|
93
|
+
else if (k2 === 'in') {
|
|
94
|
+
aw.in = (0, tokenize_1.default)((0, tokenize_1.stripWrapping)(v2()))
|
|
95
|
+
.map(field_parser_1.stripColon)
|
|
96
|
+
.map(tokenize_1.stripWrapping)
|
|
97
|
+
.filter(s => s.length > 0);
|
|
98
|
+
}
|
|
99
|
+
else if (k2 === 'equals') {
|
|
100
|
+
aw.equals = (0, tokenize_1.stripWrapping)(v2());
|
|
101
|
+
}
|
|
102
|
+
else if (k2 === 'not_null') {
|
|
103
|
+
aw.notNull = v2() === 'true';
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
}, { construct: 'lab_selection_criterion applies_when', id });
|
|
110
|
+
c.appliesWhen = aw;
|
|
111
|
+
}
|
|
112
|
+
else if (keyword === 'match') {
|
|
113
|
+
const m = {
|
|
114
|
+
operator: '',
|
|
115
|
+
requiredCapability: '',
|
|
116
|
+
requiredCapabilityPrefix: '',
|
|
117
|
+
modelField: '',
|
|
118
|
+
labCapabilityPrefix: '',
|
|
119
|
+
};
|
|
120
|
+
(0, parse_block_1.forEachEntry)((0, tokenize_1.unwrapBlock)(value()), (k2, v2) => {
|
|
121
|
+
if (k2 === 'operator') {
|
|
122
|
+
const o = (0, tokenize_1.stripWrapping)(v2());
|
|
123
|
+
if (!MATCH_OPERATORS.includes(o)) {
|
|
124
|
+
throw new Error(`Parsing error: lab_selection_criterion. ID ${id}: Unknown match operator "${o}" (valid: ${MATCH_OPERATORS.join(', ')})`);
|
|
125
|
+
}
|
|
126
|
+
m.operator = o;
|
|
127
|
+
}
|
|
128
|
+
else if (k2 === 'required_capability') {
|
|
129
|
+
m.requiredCapability = (0, tokenize_1.stripWrapping)(v2());
|
|
130
|
+
}
|
|
131
|
+
else if (k2 === 'required_capability_prefix') {
|
|
132
|
+
m.requiredCapabilityPrefix = (0, tokenize_1.stripWrapping)(v2());
|
|
133
|
+
}
|
|
134
|
+
else if (k2 === 'model_field') {
|
|
135
|
+
m.modelField = (0, tokenize_1.stripWrapping)(v2());
|
|
136
|
+
}
|
|
137
|
+
else if (k2 === 'lab_capability_prefix') {
|
|
138
|
+
m.labCapabilityPrefix = (0, tokenize_1.stripWrapping)(v2());
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
return true;
|
|
144
|
+
}, { construct: 'lab_selection_criterion match', id });
|
|
145
|
+
c.match = m;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
151
|
+
}, { construct: 'lab_selection_criterion', id });
|
|
152
|
+
return ctx => {
|
|
153
|
+
ctx.labSelectionCriteria[id] = c;
|
|
154
|
+
return ctx;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
exports.parseLabSelectionCriterion = parseLabSelectionCriterion;
|
|
158
|
+
const dumpLabSelectionCriterion = function (c) {
|
|
159
|
+
let out = 'lab_selection_criterion ' + (0, field_parser_1.dumpBareSafe)(c.id) + ' {\n';
|
|
160
|
+
if (c.weight) {
|
|
161
|
+
out += ' weight ' + c.weight + '\n';
|
|
162
|
+
}
|
|
163
|
+
if (c.parameterType) {
|
|
164
|
+
out += ' parameter_type ' + c.parameterType + '\n';
|
|
165
|
+
}
|
|
166
|
+
if (c.label) {
|
|
167
|
+
out += ' label "' + (0, tokenize_1.escapeString)(c.label) + '"\n';
|
|
168
|
+
}
|
|
169
|
+
if (c.description) {
|
|
170
|
+
out += ' description "' + (0, tokenize_1.escapeString)(c.description) + '"\n';
|
|
171
|
+
}
|
|
172
|
+
if (c.appliesWhen) {
|
|
173
|
+
let line = ' applies_when { model_field ' +
|
|
174
|
+
(0, field_parser_1.dumpBareSafe)(c.appliesWhen.modelField);
|
|
175
|
+
if (c.appliesWhen.in.length > 0) {
|
|
176
|
+
line += ' in { ' + c.appliesWhen.in.map(field_parser_1.dumpBareSafe).join(' ') + ' }';
|
|
177
|
+
}
|
|
178
|
+
if (c.appliesWhen.equals) {
|
|
179
|
+
line += ' equals ' + (0, field_parser_1.dumpBareSafe)(c.appliesWhen.equals);
|
|
180
|
+
}
|
|
181
|
+
if (c.appliesWhen.notNull !== null) {
|
|
182
|
+
line += ' not_null ' + (c.appliesWhen.notNull ? 'true' : 'false');
|
|
183
|
+
}
|
|
184
|
+
out += line + ' }\n';
|
|
185
|
+
}
|
|
186
|
+
if (c.match) {
|
|
187
|
+
out += ' match {\n';
|
|
188
|
+
if (c.match.operator) {
|
|
189
|
+
out += ' operator ' + c.match.operator + '\n';
|
|
190
|
+
}
|
|
191
|
+
if (c.match.requiredCapability) {
|
|
192
|
+
out +=
|
|
193
|
+
' required_capability "' +
|
|
194
|
+
(0, tokenize_1.escapeString)(c.match.requiredCapability) +
|
|
195
|
+
'"\n';
|
|
196
|
+
}
|
|
197
|
+
if (c.match.requiredCapabilityPrefix) {
|
|
198
|
+
out +=
|
|
199
|
+
' required_capability_prefix "' +
|
|
200
|
+
(0, tokenize_1.escapeString)(c.match.requiredCapabilityPrefix) +
|
|
201
|
+
'"\n';
|
|
202
|
+
}
|
|
203
|
+
if (c.match.modelField) {
|
|
204
|
+
out += ' model_field ' + (0, field_parser_1.dumpBareSafe)(c.match.modelField) + '\n';
|
|
205
|
+
}
|
|
206
|
+
if (c.match.labCapabilityPrefix) {
|
|
207
|
+
out +=
|
|
208
|
+
' lab_capability_prefix "' +
|
|
209
|
+
(0, tokenize_1.escapeString)(c.match.labCapabilityPrefix) +
|
|
210
|
+
'"\n';
|
|
211
|
+
}
|
|
212
|
+
out += ' }\n';
|
|
213
|
+
}
|
|
214
|
+
out += '}\n';
|
|
215
|
+
return out;
|
|
216
|
+
};
|
|
217
|
+
exports.dumpLabSelectionCriterion = dumpLabSelectionCriterion;
|
|
218
|
+
// ── sample_selection_rule ───────────────────────────────────────────
|
|
219
|
+
const parseSampleSelectionRule = (id, data) => {
|
|
220
|
+
const r = {
|
|
221
|
+
id,
|
|
222
|
+
step: '',
|
|
223
|
+
rule: '',
|
|
224
|
+
rationale: '',
|
|
225
|
+
applicability: '',
|
|
226
|
+
selector: '',
|
|
227
|
+
testKind: '',
|
|
228
|
+
singleSample: null,
|
|
229
|
+
additionalTests: {},
|
|
230
|
+
post: '',
|
|
231
|
+
};
|
|
232
|
+
(0, parse_block_1.forEachEntry)(data, (keyword, value) => {
|
|
233
|
+
if (keyword === 'step') {
|
|
234
|
+
r.step = (0, tokenize_1.stripWrapping)(value());
|
|
235
|
+
}
|
|
236
|
+
else if (keyword === 'rule') {
|
|
237
|
+
r.rule = (0, tokenize_1.stripWrapping)(value());
|
|
238
|
+
}
|
|
239
|
+
else if (keyword === 'rationale') {
|
|
240
|
+
r.rationale = (0, tokenize_1.stripWrapping)(value());
|
|
241
|
+
}
|
|
242
|
+
else if (keyword === 'applicability') {
|
|
243
|
+
r.applicability = (0, tokenize_1.stripWrapping)(value());
|
|
244
|
+
}
|
|
245
|
+
else if (keyword === 'selector') {
|
|
246
|
+
r.selector = (0, tokenize_1.stripWrapping)(value());
|
|
247
|
+
}
|
|
248
|
+
else if (keyword === 'test_kind') {
|
|
249
|
+
const k = (0, tokenize_1.stripWrapping)(value());
|
|
250
|
+
if (!SAMPLE_TEST_KINDS.includes(k)) {
|
|
251
|
+
throw new Error(`Parsing error: sample_selection_rule. ID ${id}: Unknown test_kind "${k}" (valid: ${SAMPLE_TEST_KINDS.join(', ')})`);
|
|
252
|
+
}
|
|
253
|
+
r.testKind = k;
|
|
254
|
+
}
|
|
255
|
+
else if (keyword === 'single_sample') {
|
|
256
|
+
r.singleSample = value() === 'true';
|
|
257
|
+
}
|
|
258
|
+
else if (keyword === 'additional_tests') {
|
|
259
|
+
r.additionalTests = readStringMap(value());
|
|
260
|
+
}
|
|
261
|
+
else if (keyword === 'post') {
|
|
262
|
+
r.post = (0, tokenize_1.stripWrapping)(value());
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
}, { construct: 'sample_selection_rule', id });
|
|
269
|
+
return ctx => {
|
|
270
|
+
ctx.sampleSelectionRules[id] = r;
|
|
271
|
+
return ctx;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
exports.parseSampleSelectionRule = parseSampleSelectionRule;
|
|
275
|
+
const dumpSampleSelectionRule = function (r) {
|
|
276
|
+
let out = 'sample_selection_rule ' + (0, field_parser_1.dumpBareSafe)(r.id) + ' {\n';
|
|
277
|
+
if (r.step) {
|
|
278
|
+
out += ' step "' + (0, tokenize_1.escapeString)(r.step) + '"\n';
|
|
279
|
+
}
|
|
280
|
+
if (r.rule) {
|
|
281
|
+
out += ' rule "' + (0, tokenize_1.escapeString)(r.rule) + '"\n';
|
|
282
|
+
}
|
|
283
|
+
if (r.rationale) {
|
|
284
|
+
out += ' rationale "' + (0, tokenize_1.escapeString)(r.rationale) + '"\n';
|
|
285
|
+
}
|
|
286
|
+
if (r.applicability) {
|
|
287
|
+
out += ' applicability "' + (0, tokenize_1.escapeString)(r.applicability) + '"\n';
|
|
288
|
+
}
|
|
289
|
+
if (r.selector) {
|
|
290
|
+
out += ' selector "' + (0, tokenize_1.escapeString)(r.selector) + '"\n';
|
|
291
|
+
}
|
|
292
|
+
if (r.testKind) {
|
|
293
|
+
out += ' test_kind ' + r.testKind + '\n';
|
|
294
|
+
}
|
|
295
|
+
if (r.singleSample !== null) {
|
|
296
|
+
out += ' single_sample ' + (r.singleSample ? 'true' : 'false') + '\n';
|
|
297
|
+
}
|
|
298
|
+
const tests = Object.keys(r.additionalTests);
|
|
299
|
+
if (tests.length > 0) {
|
|
300
|
+
out +=
|
|
301
|
+
' additional_tests { ' +
|
|
302
|
+
tests
|
|
303
|
+
.map(k => (0, field_parser_1.dumpBareSafe)(k) + ' "' + (0, tokenize_1.escapeString)(r.additionalTests[k]) + '"')
|
|
304
|
+
.join(' ') +
|
|
305
|
+
' }\n';
|
|
306
|
+
}
|
|
307
|
+
if (r.post) {
|
|
308
|
+
out += ' post "' + (0, tokenize_1.escapeString)(r.post) + '"\n';
|
|
309
|
+
}
|
|
310
|
+
out += '}\n';
|
|
311
|
+
return out;
|
|
312
|
+
};
|
|
313
|
+
exports.dumpSampleSelectionRule = dumpSampleSelectionRule;
|
|
314
|
+
// ── specimen_governance_rule ────────────────────────────────────────
|
|
315
|
+
const parseSpecimenGovernanceRule = (id, data) => {
|
|
316
|
+
const r = {
|
|
317
|
+
id,
|
|
318
|
+
rule: '',
|
|
319
|
+
rationale: '',
|
|
320
|
+
applicability: '',
|
|
321
|
+
constraint: '',
|
|
322
|
+
post: '',
|
|
323
|
+
};
|
|
324
|
+
(0, parse_block_1.forEachEntry)(data, (keyword, value) => {
|
|
325
|
+
if (keyword === 'rule') {
|
|
326
|
+
r.rule = (0, tokenize_1.stripWrapping)(value());
|
|
327
|
+
}
|
|
328
|
+
else if (keyword === 'rationale') {
|
|
329
|
+
r.rationale = (0, tokenize_1.stripWrapping)(value());
|
|
330
|
+
}
|
|
331
|
+
else if (keyword === 'applicability') {
|
|
332
|
+
r.applicability = (0, tokenize_1.stripWrapping)(value());
|
|
333
|
+
}
|
|
334
|
+
else if (keyword === 'constraint') {
|
|
335
|
+
r.constraint = (0, tokenize_1.stripWrapping)(value());
|
|
336
|
+
}
|
|
337
|
+
else if (keyword === 'post') {
|
|
338
|
+
r.post = (0, tokenize_1.stripWrapping)(value());
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
}, { construct: 'specimen_governance_rule', id });
|
|
345
|
+
return ctx => {
|
|
346
|
+
ctx.specimenGovernanceRules[id] = r;
|
|
347
|
+
return ctx;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
exports.parseSpecimenGovernanceRule = parseSpecimenGovernanceRule;
|
|
351
|
+
const dumpSpecimenGovernanceRule = function (r) {
|
|
352
|
+
let out = 'specimen_governance_rule ' + (0, field_parser_1.dumpBareSafe)(r.id) + ' {\n';
|
|
353
|
+
if (r.rule) {
|
|
354
|
+
out += ' rule "' + (0, tokenize_1.escapeString)(r.rule) + '"\n';
|
|
355
|
+
}
|
|
356
|
+
if (r.rationale) {
|
|
357
|
+
out += ' rationale "' + (0, tokenize_1.escapeString)(r.rationale) + '"\n';
|
|
358
|
+
}
|
|
359
|
+
if (r.applicability) {
|
|
360
|
+
out += ' applicability "' + (0, tokenize_1.escapeString)(r.applicability) + '"\n';
|
|
361
|
+
}
|
|
362
|
+
if (r.constraint) {
|
|
363
|
+
out += ' constraint "' + (0, tokenize_1.escapeString)(r.constraint) + '"\n';
|
|
364
|
+
}
|
|
365
|
+
if (r.post) {
|
|
366
|
+
out += ' post "' + (0, tokenize_1.escapeString)(r.post) + '"\n';
|
|
367
|
+
}
|
|
368
|
+
out += '}\n';
|
|
369
|
+
return out;
|
|
370
|
+
};
|
|
371
|
+
exports.dumpSpecimenGovernanceRule = dumpSpecimenGovernanceRule;
|
|
372
|
+
//# sourceMappingURL=selectionRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectionRules.js","sourceRoot":"","sources":["../../../../src/ser-des/config/selectionRules.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,oEAAoE;AACpE,sDAAsD;AACtD,sEAAsE;AACtE,sEAAsE;AACtE,6DAA6D;AAC7D,+DAA+D;AAC/D,8DAA8D;AAC9D,qEAAqE;AACrE,iEAAiE;AACjE,gEAAgE;AAChE,wEAAwE;;;AAGxE,0CAIqB;AACrB,gDAA8C;AAC9C,iDAA0D;AAO1D,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,WAAW,CAAU,CAAC;AAE7D,MAAM,yBAAyB,GAAG;IAChC,WAAW;IACX,WAAW;IACX,aAAa;CACL,CAAC;AAEX,MAAM,eAAe,GAAG;IACtB,gBAAgB;IAChB,uBAAuB;IACvB,yBAAyB;IACzB,yBAAyB;IACzB,aAAa;CACL,CAAC;AAEX,MAAM,iBAAiB,GAAG;IACxB,iBAAiB;IACjB,oBAAoB;IACpB,aAAa;IACb,UAAU;IACV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,0 +1,7 @@
|
|
|
1
|
+
import type { Dumper, Parser } from '../types';
|
|
2
|
+
import Storyline, { DemoWorld } from '../../types/Storyline';
|
|
3
|
+
export declare const parseDemoWorld: Parser;
|
|
4
|
+
export declare const dumpDemoWorld: Dumper<DemoWorld>;
|
|
5
|
+
export declare const parseStoryline: Parser;
|
|
6
|
+
export declare const dumpStoryline: Dumper<Storyline>;
|
|
7
|
+
//# sourceMappingURL=storyline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storyline.d.ts","sourceRoot":"","sources":["../../../../src/ser-des/config/storyline.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAS/C,OAAO,SAAS,EAAE,EAChB,SAAS,EAIV,MAAM,uBAAuB,CAAC;AA2E/B,eAAO,MAAM,cAAc,EAAE,MA6B5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,CAuB3C,CAAC;AAuBF,eAAO,MAAM,cAAc,EAAE,MAkE5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,CAsC3C,CAAC"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
3
|
+
// `demo_world` + `storyline` constructs (smart TODO.roadmap/40 batch 4;
|
|
4
|
+
// the packages-as-SSOT epic) — the sample-data demo seeds as native
|
|
5
|
+
// constructs (types/Storyline.ts carries the banner, the grammar
|
|
6
|
+
// sketch, and the deliberate instance-non-unification note).
|
|
7
|
+
//
|
|
8
|
+
// The record-value sub-grammar follows the quantity.ts dumpScalarToken
|
|
9
|
+
// conventions: numbers bare, whitespace/brace-carrying strings quoted,
|
|
10
|
+
// `{ … }` lists of scalars. The participants sections and the subject
|
|
11
|
+
// slot kinds are OPEN — the grammar never enumerates program content.
|
|
12
|
+
//
|
|
13
|
+
// Cross-references stay strings at parse and resolve at check time
|
|
14
|
+
// (C129); the codecs stay total.
|
|
15
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.dumpStoryline = exports.parseStoryline = exports.dumpDemoWorld = exports.parseDemoWorld = void 0;
|
|
18
|
+
const tokenize_1 = require("../tokenize");
|
|
19
|
+
const parse_block_1 = require("../parse-block");
|
|
20
|
+
const field_parser_1 = require("./field-parser");
|
|
21
|
+
const quantity_1 = require("./quantity");
|
|
22
|
+
// ── the record-value sub-grammar ─────────────────────────────────────
|
|
23
|
+
/** Read one field value: `{ … }` list of scalars, or one scalar. */
|
|
24
|
+
function readRecordValue(token) {
|
|
25
|
+
if (token.startsWith('{')) {
|
|
26
|
+
return (0, tokenize_1.default)((0, tokenize_1.unwrapBlock)(token))
|
|
27
|
+
.filter(s => s.length > 0)
|
|
28
|
+
.map(quantity_1.coerceValueToken);
|
|
29
|
+
}
|
|
30
|
+
return (0, quantity_1.coerceValueToken)(token);
|
|
31
|
+
}
|
|
32
|
+
/** Read a record-shaped block (`key value` pairs, values scalar or
|
|
33
|
+
* braced list), preserving authored order. */
|
|
34
|
+
function readRecordFields(block) {
|
|
35
|
+
const fields = {};
|
|
36
|
+
const t = (0, tokenize_1.default)(block);
|
|
37
|
+
let i = 0;
|
|
38
|
+
while (i < t.length) {
|
|
39
|
+
const key = t[i++];
|
|
40
|
+
if (i >= t.length) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
fields[(0, field_parser_1.stripColon)(key)] = readRecordValue(t[i++]);
|
|
44
|
+
}
|
|
45
|
+
return fields;
|
|
46
|
+
}
|
|
47
|
+
function dumpRecordFields(fields, indent) {
|
|
48
|
+
let out = '';
|
|
49
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
50
|
+
if (Array.isArray(value)) {
|
|
51
|
+
out +=
|
|
52
|
+
indent + key + ' { ' + value.map(quantity_1.dumpScalarToken).join(' ') + ' }\n';
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
out += indent + key + ' ' + (0, quantity_1.dumpScalarToken)(value) + '\n';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
// ── demo_world ───────────────────────────────────────────────────────
|
|
61
|
+
function parseParticipants(block) {
|
|
62
|
+
const sections = [];
|
|
63
|
+
const t = (0, tokenize_1.default)(block);
|
|
64
|
+
let i = 0;
|
|
65
|
+
while (i < t.length) {
|
|
66
|
+
const sid = (0, tokenize_1.stripWrapping)(t[i++]);
|
|
67
|
+
if (i >= t.length || !t[i].startsWith('{')) {
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
const section = { id: sid, entries: [] };
|
|
71
|
+
const st = (0, tokenize_1.default)((0, tokenize_1.unwrapBlock)(t[i++]));
|
|
72
|
+
let j = 0;
|
|
73
|
+
while (j < st.length) {
|
|
74
|
+
const eid = (0, tokenize_1.stripWrapping)(st[j++]);
|
|
75
|
+
if (j >= st.length || !st[j].startsWith('{')) {
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
section.entries.push({
|
|
79
|
+
id: eid,
|
|
80
|
+
fields: readRecordFields((0, tokenize_1.unwrapBlock)(st[j++])),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
sections.push(section);
|
|
84
|
+
}
|
|
85
|
+
return sections;
|
|
86
|
+
}
|
|
87
|
+
const parseDemoWorld = (id, data) => {
|
|
88
|
+
const world = {
|
|
89
|
+
id,
|
|
90
|
+
standard: '',
|
|
91
|
+
description: '',
|
|
92
|
+
participants: [],
|
|
93
|
+
};
|
|
94
|
+
(0, parse_block_1.forEachEntry)(data, (keyword, value) => {
|
|
95
|
+
if (keyword === 'standard') {
|
|
96
|
+
world.standard = (0, tokenize_1.stripWrapping)(value());
|
|
97
|
+
}
|
|
98
|
+
else if (keyword === 'description') {
|
|
99
|
+
world.description = (0, tokenize_1.stripWrapping)(value());
|
|
100
|
+
}
|
|
101
|
+
else if (keyword === 'participants') {
|
|
102
|
+
world.participants = parseParticipants((0, tokenize_1.unwrapBlock)(value()));
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}, { construct: 'demo_world', id });
|
|
109
|
+
return ctx => {
|
|
110
|
+
ctx.demoWorlds[id] = world;
|
|
111
|
+
return ctx;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
exports.parseDemoWorld = parseDemoWorld;
|
|
115
|
+
const dumpDemoWorld = function (w) {
|
|
116
|
+
let out = 'demo_world ' + w.id + ' {\n';
|
|
117
|
+
if (w.standard) {
|
|
118
|
+
out += ' standard ' + (0, field_parser_1.dumpBareSafe)(w.standard) + '\n';
|
|
119
|
+
}
|
|
120
|
+
if (w.description) {
|
|
121
|
+
out += ' description "' + (0, tokenize_1.escapeString)(w.description) + '"\n';
|
|
122
|
+
}
|
|
123
|
+
if (w.participants.length > 0) {
|
|
124
|
+
out += ' participants {\n';
|
|
125
|
+
for (const s of w.participants) {
|
|
126
|
+
out += ' ' + (0, field_parser_1.dumpBareSafe)(s.id) + ' {\n';
|
|
127
|
+
for (const e of s.entries) {
|
|
128
|
+
out += ' ' + (0, field_parser_1.dumpBareSafe)(e.id) + ' {\n';
|
|
129
|
+
out += dumpRecordFields(e.fields, ' ');
|
|
130
|
+
out += ' }\n';
|
|
131
|
+
}
|
|
132
|
+
out += ' }\n';
|
|
133
|
+
}
|
|
134
|
+
out += ' }\n';
|
|
135
|
+
}
|
|
136
|
+
out += '}\n';
|
|
137
|
+
return out;
|
|
138
|
+
};
|
|
139
|
+
exports.dumpDemoWorld = dumpDemoWorld;
|
|
140
|
+
// ── storyline ────────────────────────────────────────────────────────
|
|
141
|
+
function parseSubjectEntries(block) {
|
|
142
|
+
const entries = [];
|
|
143
|
+
const t = (0, tokenize_1.default)(block);
|
|
144
|
+
let i = 0;
|
|
145
|
+
while (i < t.length) {
|
|
146
|
+
const kind = (0, tokenize_1.stripWrapping)(t[i++]);
|
|
147
|
+
if (i >= t.length) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
const eid = (0, tokenize_1.stripWrapping)(t[i++]);
|
|
151
|
+
const entry = { kind, id: eid, fields: {} };
|
|
152
|
+
if (i < t.length && t[i].startsWith('{')) {
|
|
153
|
+
entry.fields = readRecordFields((0, tokenize_1.unwrapBlock)(t[i++]));
|
|
154
|
+
}
|
|
155
|
+
entries.push(entry);
|
|
156
|
+
}
|
|
157
|
+
return entries;
|
|
158
|
+
}
|
|
159
|
+
const parseStoryline = (id, data) => {
|
|
160
|
+
const storyline = {
|
|
161
|
+
id,
|
|
162
|
+
name: '',
|
|
163
|
+
idPrefix: '',
|
|
164
|
+
party: { laboratory: '', authority: '' },
|
|
165
|
+
subject: [],
|
|
166
|
+
records: [],
|
|
167
|
+
notes: [],
|
|
168
|
+
};
|
|
169
|
+
(0, parse_block_1.forEachEntry)(data, (keyword, value, peek) => {
|
|
170
|
+
if (keyword === 'name') {
|
|
171
|
+
storyline.name = (0, tokenize_1.stripWrapping)(value());
|
|
172
|
+
}
|
|
173
|
+
else if (keyword === 'id_prefix') {
|
|
174
|
+
storyline.idPrefix = (0, tokenize_1.stripWrapping)(value());
|
|
175
|
+
}
|
|
176
|
+
else if (keyword === 'party') {
|
|
177
|
+
const pt = (0, tokenize_1.default)((0, tokenize_1.unwrapBlock)(value()));
|
|
178
|
+
for (let j = 0; j + 1 < pt.length; j += 2) {
|
|
179
|
+
if (pt[j] === 'laboratory') {
|
|
180
|
+
storyline.party.laboratory = (0, tokenize_1.stripWrapping)(pt[j + 1]);
|
|
181
|
+
}
|
|
182
|
+
else if (pt[j] === 'authority') {
|
|
183
|
+
storyline.party.authority = (0, tokenize_1.stripWrapping)(pt[j + 1]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (keyword === 'subject') {
|
|
188
|
+
storyline.subject = parseSubjectEntries((0, tokenize_1.unwrapBlock)(value()));
|
|
189
|
+
}
|
|
190
|
+
else if (keyword === 'record') {
|
|
191
|
+
// record <store> <id> { … } — a three-token facet claiming
|
|
192
|
+
// through peek/value manually (value() consumes one token per
|
|
193
|
+
// call).
|
|
194
|
+
const store = (0, tokenize_1.stripWrapping)(value());
|
|
195
|
+
const idHead = peek();
|
|
196
|
+
if (idHead === undefined || idHead.startsWith('{')) {
|
|
197
|
+
throw new Error(`Parsing error: storyline. ID ${id}: record ${store} is missing its id and block`);
|
|
198
|
+
}
|
|
199
|
+
const rid = (0, tokenize_1.stripWrapping)(value());
|
|
200
|
+
const blockHead = peek();
|
|
201
|
+
if (blockHead === undefined || !blockHead.startsWith('{')) {
|
|
202
|
+
throw new Error(`Parsing error: storyline. ID ${id}: record ${store} ${rid} is missing its block`);
|
|
203
|
+
}
|
|
204
|
+
storyline.records.push({
|
|
205
|
+
store,
|
|
206
|
+
id: rid,
|
|
207
|
+
fields: readRecordFields((0, tokenize_1.unwrapBlock)(value())),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else if (keyword === 'note') {
|
|
211
|
+
storyline.notes.push((0, tokenize_1.stripWrapping)(value()));
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
return true;
|
|
217
|
+
}, { construct: 'storyline', id });
|
|
218
|
+
return ctx => {
|
|
219
|
+
ctx.storylines[id] = storyline;
|
|
220
|
+
return ctx;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
exports.parseStoryline = parseStoryline;
|
|
224
|
+
const dumpStoryline = function (s) {
|
|
225
|
+
let out = 'storyline ' + s.id + ' {\n';
|
|
226
|
+
if (s.name) {
|
|
227
|
+
out += ' name "' + (0, tokenize_1.escapeString)(s.name) + '"\n';
|
|
228
|
+
}
|
|
229
|
+
if (s.idPrefix) {
|
|
230
|
+
out += ' id_prefix ' + (0, field_parser_1.dumpBareSafe)(s.idPrefix) + '\n';
|
|
231
|
+
}
|
|
232
|
+
if (s.party.laboratory || s.party.authority) {
|
|
233
|
+
out += ' party {';
|
|
234
|
+
if (s.party.laboratory) {
|
|
235
|
+
out += ' laboratory ' + (0, field_parser_1.dumpBareSafe)(s.party.laboratory);
|
|
236
|
+
}
|
|
237
|
+
if (s.party.authority) {
|
|
238
|
+
out += ' authority ' + (0, field_parser_1.dumpBareSafe)(s.party.authority);
|
|
239
|
+
}
|
|
240
|
+
out += ' }\n';
|
|
241
|
+
}
|
|
242
|
+
if (s.subject.length > 0) {
|
|
243
|
+
out += ' subject {\n';
|
|
244
|
+
for (const e of s.subject) {
|
|
245
|
+
out += ' ' + (0, field_parser_1.dumpBareSafe)(e.kind) + ' ' + (0, field_parser_1.dumpBareSafe)(e.id) + ' {\n';
|
|
246
|
+
out += dumpRecordFields(e.fields, ' ');
|
|
247
|
+
out += ' }\n';
|
|
248
|
+
}
|
|
249
|
+
out += ' }\n';
|
|
250
|
+
}
|
|
251
|
+
for (const r of s.records) {
|
|
252
|
+
out +=
|
|
253
|
+
' record ' + (0, field_parser_1.dumpBareSafe)(r.store) + ' ' + (0, field_parser_1.dumpBareSafe)(r.id) + ' {\n';
|
|
254
|
+
out += dumpRecordFields(r.fields, ' ');
|
|
255
|
+
out += ' }\n';
|
|
256
|
+
}
|
|
257
|
+
for (const n of s.notes) {
|
|
258
|
+
out += ' note "' + (0, tokenize_1.escapeString)(n) + '"\n';
|
|
259
|
+
}
|
|
260
|
+
out += '}\n';
|
|
261
|
+
return out;
|
|
262
|
+
};
|
|
263
|
+
exports.dumpStoryline = dumpStoryline;
|
|
264
|
+
//# sourceMappingURL=storyline.js.map
|