@tiangong-lca/cli 0.0.15 → 0.0.17
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/assets/tidas-schemas/tidas_contacts.json +2 -24
- package/assets/tidas-schemas/tidas_data_types.json +28 -3
- package/assets/tidas-schemas/tidas_flows.json +6 -93
- package/assets/tidas-schemas/tidas_lciamethods.json +9 -41
- package/assets/tidas-schemas/tidas_lifecyclemodels.json +2 -46
- package/assets/tidas-schemas/tidas_processes.json +2 -46
- package/dist/src/lib/dataset-bilingual.js +22 -1
- package/dist/src/lib/dataset-bilingual.js.map +1 -1
- package/dist/src/lib/lifecyclemodel-auto-build.js +5 -15
- package/dist/src/lib/lifecyclemodel-auto-build.js.map +1 -1
- package/dist/src/lib/tidas-languages.js +189 -0
- package/dist/src/lib/tidas-languages.js.map +1 -0
- package/dist/src/lib/tidas-sdk-package-validator.js +11 -4
- package/dist/src/lib/tidas-sdk-package-validator.js.map +1 -1
- package/package.json +1 -1
|
@@ -109,30 +109,8 @@
|
|
|
109
109
|
}
|
|
110
110
|
],
|
|
111
111
|
"uniqueItems": true,
|
|
112
|
-
"
|
|
113
|
-
|
|
114
|
-
"maxContains": 1,
|
|
115
|
-
"minContains": 0,
|
|
116
|
-
"contains": {
|
|
117
|
-
"properties": {
|
|
118
|
-
"@level": {
|
|
119
|
-
"const": "0"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"maxContains": 1,
|
|
126
|
-
"minContains": 0,
|
|
127
|
-
"contains": {
|
|
128
|
-
"properties": {
|
|
129
|
-
"@level": {
|
|
130
|
-
"const": "1"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
]
|
|
112
|
+
"maxItems": 2,
|
|
113
|
+
"additionalItems": false
|
|
136
114
|
},
|
|
137
115
|
{
|
|
138
116
|
"type": "object",
|
|
@@ -11,12 +11,37 @@
|
|
|
11
11
|
"type": "string",
|
|
12
12
|
"description": "Free text with an unlimited length."
|
|
13
13
|
},
|
|
14
|
+
"Languages": {
|
|
15
|
+
"description": "TIDAS Languages enumeration.",
|
|
16
|
+
"type": "string",
|
|
17
|
+
"enum": [
|
|
18
|
+
"aa", "ab", "ae", "af", "ak", "am", "an", "ar", "as", "av",
|
|
19
|
+
"ay", "az", "ba", "be", "bg", "bh", "bi", "bm", "bn", "bo",
|
|
20
|
+
"br", "bs", "ca", "ce", "ch", "co", "cr", "cs", "cu", "cv",
|
|
21
|
+
"cy", "da", "de", "dv", "dz", "ee", "el", "en", "eo", "es",
|
|
22
|
+
"et", "eu", "fa", "ff", "fi", "fj", "fo", "fr", "fy", "ga",
|
|
23
|
+
"gd", "gl", "gn", "gu", "gv", "ha", "he", "hi", "ho", "hr",
|
|
24
|
+
"ht", "hu", "hy", "hz", "ia", "id", "ie", "ig", "ii", "ik",
|
|
25
|
+
"io", "is", "it", "iu", "ja", "jv", "ka", "kg", "ki", "kj",
|
|
26
|
+
"kk", "kl", "km", "kn", "ko", "kr", "ks", "ku", "kv", "kw",
|
|
27
|
+
"ky", "la", "lb", "lg", "li", "ln", "lo", "lt", "lu", "lv",
|
|
28
|
+
"mg", "mh", "mi", "mk", "ml", "mn", "mo", "mr", "ms", "mt",
|
|
29
|
+
"my", "na", "nb", "nd", "ne", "ng", "nl", "nn", "no", "nr",
|
|
30
|
+
"nv", "ny", "oc", "oj", "om", "or", "os", "pa", "pi", "pl",
|
|
31
|
+
"ps", "pt", "qu", "rm", "rn", "ro", "ru", "rw", "sa", "sc",
|
|
32
|
+
"sd", "se", "sg", "si", "sk", "sl", "sm", "sn", "so", "sq",
|
|
33
|
+
"sr", "ss", "st", "su", "sv", "sw", "ta", "te", "tg", "th",
|
|
34
|
+
"ti", "tk", "tl", "tn", "to", "tr", "ts", "tt", "tw", "ty",
|
|
35
|
+
"ug", "uk", "ur", "uz", "ve", "vi", "vo", "wa", "wo", "xh",
|
|
36
|
+
"yi", "yo", "za", "zh", "zu"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
14
39
|
"LocalizedTextItem": {
|
|
15
40
|
"description": "Language-tagged text with optional script checks for selected languages.",
|
|
16
41
|
"type": "object",
|
|
17
42
|
"properties": {
|
|
18
43
|
"@xml:lang": {
|
|
19
|
-
"
|
|
44
|
+
"$ref": "#/$defs/Languages"
|
|
20
45
|
},
|
|
21
46
|
"#text": {
|
|
22
47
|
"type": "string"
|
|
@@ -31,7 +56,7 @@
|
|
|
31
56
|
"if": {
|
|
32
57
|
"properties": {
|
|
33
58
|
"@xml:lang": {
|
|
34
|
-
"
|
|
59
|
+
"const": "zh"
|
|
35
60
|
}
|
|
36
61
|
},
|
|
37
62
|
"required": [
|
|
@@ -50,7 +75,7 @@
|
|
|
50
75
|
"if": {
|
|
51
76
|
"properties": {
|
|
52
77
|
"@xml:lang": {
|
|
53
|
-
"
|
|
78
|
+
"const": "en"
|
|
54
79
|
}
|
|
55
80
|
},
|
|
56
81
|
"required": [
|
|
@@ -159,41 +159,8 @@
|
|
|
159
159
|
}
|
|
160
160
|
],
|
|
161
161
|
"uniqueItems": true,
|
|
162
|
-
"
|
|
163
|
-
|
|
164
|
-
"maxContains": 1,
|
|
165
|
-
"minContains": 0,
|
|
166
|
-
"contains": {
|
|
167
|
-
"properties": {
|
|
168
|
-
"@level": {
|
|
169
|
-
"const": "0"
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
"maxContains": 1,
|
|
176
|
-
"minContains": 0,
|
|
177
|
-
"contains": {
|
|
178
|
-
"properties": {
|
|
179
|
-
"@level": {
|
|
180
|
-
"const": "1"
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"maxContains": 1,
|
|
187
|
-
"minContains": 0,
|
|
188
|
-
"contains": {
|
|
189
|
-
"properties": {
|
|
190
|
-
"@level": {
|
|
191
|
-
"const": "2"
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
]
|
|
162
|
+
"maxItems": 3,
|
|
163
|
+
"additionalItems": false
|
|
197
164
|
},
|
|
198
165
|
"common:other": {
|
|
199
166
|
"$ref": "tidas_data_types.json#/$defs/CommonOther"
|
|
@@ -336,63 +303,8 @@
|
|
|
336
303
|
}
|
|
337
304
|
],
|
|
338
305
|
"uniqueItems": true,
|
|
339
|
-
"
|
|
340
|
-
|
|
341
|
-
"maxContains": 1,
|
|
342
|
-
"minContains": 0,
|
|
343
|
-
"contains": {
|
|
344
|
-
"properties": {
|
|
345
|
-
"@level": {
|
|
346
|
-
"const": "0"
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"maxContains": 1,
|
|
353
|
-
"minContains": 0,
|
|
354
|
-
"contains": {
|
|
355
|
-
"properties": {
|
|
356
|
-
"@level": {
|
|
357
|
-
"const": "1"
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
"maxContains": 1,
|
|
364
|
-
"minContains": 0,
|
|
365
|
-
"contains": {
|
|
366
|
-
"properties": {
|
|
367
|
-
"@level": {
|
|
368
|
-
"const": "2"
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
"maxContains": 1,
|
|
375
|
-
"minContains": 0,
|
|
376
|
-
"contains": {
|
|
377
|
-
"properties": {
|
|
378
|
-
"@level": {
|
|
379
|
-
"const": "3"
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
"maxContains": 1,
|
|
386
|
-
"minContains": 0,
|
|
387
|
-
"contains": {
|
|
388
|
-
"properties": {
|
|
389
|
-
"@level": {
|
|
390
|
-
"const": "4"
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
]
|
|
306
|
+
"maxItems": 5,
|
|
307
|
+
"additionalItems": false
|
|
396
308
|
},
|
|
397
309
|
"common:other": {
|
|
398
310
|
"$ref": "tidas_data_types.json#/$defs/CommonOther"
|
|
@@ -499,7 +411,8 @@
|
|
|
499
411
|
"enum": [
|
|
500
412
|
"Elementary flow",
|
|
501
413
|
"Product flow",
|
|
502
|
-
"Waste flow"
|
|
414
|
+
"Waste flow",
|
|
415
|
+
"Other flow"
|
|
503
416
|
]
|
|
504
417
|
},
|
|
505
418
|
"common:other": {
|
|
@@ -132,41 +132,8 @@
|
|
|
132
132
|
}
|
|
133
133
|
],
|
|
134
134
|
"uniqueItems": true,
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
"maxContains": 1,
|
|
138
|
-
"minContains": 0,
|
|
139
|
-
"contains": {
|
|
140
|
-
"properties": {
|
|
141
|
-
"@level": {
|
|
142
|
-
"const": "0"
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"maxContains": 1,
|
|
149
|
-
"minContains": 0,
|
|
150
|
-
"contains": {
|
|
151
|
-
"properties": {
|
|
152
|
-
"@level": {
|
|
153
|
-
"const": "1"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"maxContains": 1,
|
|
160
|
-
"minContains": 0,
|
|
161
|
-
"contains": {
|
|
162
|
-
"properties": {
|
|
163
|
-
"@level": {
|
|
164
|
-
"const": "2"
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
]
|
|
135
|
+
"maxItems": 3,
|
|
136
|
+
"additionalItems": false
|
|
170
137
|
}
|
|
171
138
|
]
|
|
172
139
|
},
|
|
@@ -212,6 +179,7 @@
|
|
|
212
179
|
"Natural resources",
|
|
213
180
|
"Natural environment",
|
|
214
181
|
"Human health",
|
|
182
|
+
"Man-made environment",
|
|
215
183
|
"Other"
|
|
216
184
|
]
|
|
217
185
|
},
|
|
@@ -570,7 +538,7 @@
|
|
|
570
538
|
"Cross-check with other data set",
|
|
571
539
|
"Expert judgement",
|
|
572
540
|
"Mass balance",
|
|
573
|
-
"Compliance with legal
|
|
541
|
+
"Compliance with legal limits",
|
|
574
542
|
"Compliance with ISO 14040 to 14044",
|
|
575
543
|
"Documentation",
|
|
576
544
|
"Evidence collection by means of plant visits and/or interviews"
|
|
@@ -597,7 +565,7 @@
|
|
|
597
565
|
"Cross-check with other data set",
|
|
598
566
|
"Expert judgement",
|
|
599
567
|
"Mass balance",
|
|
600
|
-
"Compliance with legal
|
|
568
|
+
"Compliance with legal limits",
|
|
601
569
|
"Compliance with ISO 14040 to 14044",
|
|
602
570
|
"Documentation",
|
|
603
571
|
"Evidence collection by means of plant visits and/or interviews"
|
|
@@ -653,7 +621,7 @@
|
|
|
653
621
|
"Cross-check with other data set",
|
|
654
622
|
"Expert judgement",
|
|
655
623
|
"Mass balance",
|
|
656
|
-
"Compliance with legal
|
|
624
|
+
"Compliance with legal limits",
|
|
657
625
|
"Compliance with ISO 14040 to 14044",
|
|
658
626
|
"Documentation",
|
|
659
627
|
"Evidence collection by means of plant visits and/or interviews"
|
|
@@ -680,7 +648,7 @@
|
|
|
680
648
|
"Cross-check with other data set",
|
|
681
649
|
"Expert judgement",
|
|
682
650
|
"Mass balance",
|
|
683
|
-
"Compliance with legal
|
|
651
|
+
"Compliance with legal limits",
|
|
684
652
|
"Compliance with ISO 14040 to 14044",
|
|
685
653
|
"Documentation",
|
|
686
654
|
"Evidence collection by means of plant visits and/or interviews"
|
|
@@ -1155,7 +1123,7 @@
|
|
|
1155
1123
|
"enum": [
|
|
1156
1124
|
"undefined",
|
|
1157
1125
|
"log-normal",
|
|
1158
|
-
"
|
|
1126
|
+
"normal",
|
|
1159
1127
|
"triangular",
|
|
1160
1128
|
"uniform"
|
|
1161
1129
|
]
|
|
@@ -1245,7 +1213,7 @@
|
|
|
1245
1213
|
"enum": [
|
|
1246
1214
|
"undefined",
|
|
1247
1215
|
"log-normal",
|
|
1248
|
-
"
|
|
1216
|
+
"normal",
|
|
1249
1217
|
"triangular",
|
|
1250
1218
|
"uniform"
|
|
1251
1219
|
]
|
|
@@ -188,52 +188,8 @@
|
|
|
188
188
|
}
|
|
189
189
|
],
|
|
190
190
|
"uniqueItems": true,
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
"maxContains": 1,
|
|
194
|
-
"minContains": 0,
|
|
195
|
-
"contains": {
|
|
196
|
-
"properties": {
|
|
197
|
-
"@level": {
|
|
198
|
-
"const": "0"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"maxContains": 1,
|
|
205
|
-
"minContains": 0,
|
|
206
|
-
"contains": {
|
|
207
|
-
"properties": {
|
|
208
|
-
"@level": {
|
|
209
|
-
"const": "1"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"maxContains": 1,
|
|
216
|
-
"minContains": 0,
|
|
217
|
-
"contains": {
|
|
218
|
-
"properties": {
|
|
219
|
-
"@level": {
|
|
220
|
-
"const": "2"
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"maxContains": 1,
|
|
227
|
-
"minContains": 0,
|
|
228
|
-
"contains": {
|
|
229
|
-
"properties": {
|
|
230
|
-
"@level": {
|
|
231
|
-
"const": "3"
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
]
|
|
191
|
+
"maxItems": 4,
|
|
192
|
+
"additionalItems": false
|
|
237
193
|
},
|
|
238
194
|
"common:other": {
|
|
239
195
|
"$ref": "tidas_data_types.json#/$defs/CommonOther"
|
|
@@ -196,52 +196,8 @@
|
|
|
196
196
|
}
|
|
197
197
|
],
|
|
198
198
|
"uniqueItems": true,
|
|
199
|
-
"
|
|
200
|
-
|
|
201
|
-
"maxContains": 1,
|
|
202
|
-
"minContains": 0,
|
|
203
|
-
"contains": {
|
|
204
|
-
"properties": {
|
|
205
|
-
"@level": {
|
|
206
|
-
"const": "0"
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"maxContains": 1,
|
|
213
|
-
"minContains": 0,
|
|
214
|
-
"contains": {
|
|
215
|
-
"properties": {
|
|
216
|
-
"@level": {
|
|
217
|
-
"const": "1"
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
"maxContains": 1,
|
|
224
|
-
"minContains": 0,
|
|
225
|
-
"contains": {
|
|
226
|
-
"properties": {
|
|
227
|
-
"@level": {
|
|
228
|
-
"const": "2"
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
"maxContains": 1,
|
|
235
|
-
"minContains": 0,
|
|
236
|
-
"contains": {
|
|
237
|
-
"properties": {
|
|
238
|
-
"@level": {
|
|
239
|
-
"const": "3"
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
]
|
|
199
|
+
"maxItems": 4,
|
|
200
|
+
"additionalItems": false
|
|
245
201
|
},
|
|
246
202
|
"common:other": {
|
|
247
203
|
"$ref": "tidas_data_types.json#/$defs/CommonOther"
|
|
@@ -5,6 +5,7 @@ import { CliError } from './errors.js';
|
|
|
5
5
|
import { cloneJson, isRecord, materializeDatasetRows, readDatasetRowsInput, trimToken, } from './dataset-local.js';
|
|
6
6
|
import { runDatasetValidate, } from './dataset-validate.js';
|
|
7
7
|
import { runFlowQa } from './flow-qa.js';
|
|
8
|
+
import { TIDAS_LANGUAGE_CODE_SET } from './tidas-languages.js';
|
|
8
9
|
import { runProcessQa } from './process-qa.js';
|
|
9
10
|
const DEFAULT_SOURCE_LANG = 'en';
|
|
10
11
|
const DEFAULT_TARGET_LANG = 'zh';
|
|
@@ -40,7 +41,14 @@ function normalizeType(value) {
|
|
|
40
41
|
}
|
|
41
42
|
function normalizeLang(value, fallback) {
|
|
42
43
|
const normalized = value?.trim().toLowerCase();
|
|
43
|
-
|
|
44
|
+
const lang = normalized || fallback;
|
|
45
|
+
if (!TIDAS_LANGUAGE_CODE_SET.has(lang)) {
|
|
46
|
+
throw new CliError(`Expected language to use a TIDAS Languages enumeration value, got: ${lang}`, {
|
|
47
|
+
code: 'DATASET_BILINGUAL_LANGUAGE_NOT_IN_TIDAS_ENUM',
|
|
48
|
+
exitCode: 2,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return lang;
|
|
44
52
|
}
|
|
45
53
|
function pointerEscape(segment) {
|
|
46
54
|
return segment.replace(/~/gu, '~0').replace(/\//gu, '~1');
|
|
@@ -66,6 +74,9 @@ function textPreview(value) {
|
|
|
66
74
|
function langOf(value) {
|
|
67
75
|
return trimToken(isRecord(value) ? value['@xml:lang'] : null)?.toLowerCase() ?? null;
|
|
68
76
|
}
|
|
77
|
+
function rawLangOf(value) {
|
|
78
|
+
return trimToken(isRecord(value) ? value['@xml:lang'] : null) ?? null;
|
|
79
|
+
}
|
|
69
80
|
function textOf(value) {
|
|
70
81
|
return trimToken(isRecord(value) ? value['#text'] : null);
|
|
71
82
|
}
|
|
@@ -276,6 +287,7 @@ function writeRowsJsonl(filePath, rows) {
|
|
|
276
287
|
function scanText(node, pathSegments, visit) {
|
|
277
288
|
const findings = [];
|
|
278
289
|
if (isLangRecord(node)) {
|
|
290
|
+
const rawLang = rawLangOf(node);
|
|
279
291
|
const lang = langOf(node);
|
|
280
292
|
const text = textOf(node);
|
|
281
293
|
if (!text) {
|
|
@@ -291,6 +303,14 @@ function scanText(node, pathSegments, visit) {
|
|
|
291
303
|
lang,
|
|
292
304
|
text_preview: textPreview(text),
|
|
293
305
|
};
|
|
306
|
+
if (rawLang && !TIDAS_LANGUAGE_CODE_SET.has(rawLang)) {
|
|
307
|
+
findings.push({
|
|
308
|
+
...base,
|
|
309
|
+
code: 'localized_text_language_not_in_tidas_enum',
|
|
310
|
+
severity: 'blocker',
|
|
311
|
+
message: 'Localized text @xml:lang is not a TIDAS Languages enumeration value.',
|
|
312
|
+
});
|
|
313
|
+
}
|
|
294
314
|
if (PLACEHOLDER_RE.test(text)) {
|
|
295
315
|
findings.push({
|
|
296
316
|
...base,
|
|
@@ -539,6 +559,7 @@ export const __testInternals = {
|
|
|
539
559
|
collectTranslationUnits,
|
|
540
560
|
normalizeType,
|
|
541
561
|
pointerFromSegments,
|
|
562
|
+
rawLangOf,
|
|
542
563
|
segmentsFromPointer,
|
|
543
564
|
scanRows,
|
|
544
565
|
};
|