@tiangong-lca/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +368 -0
- package/bin/tiangong.d.ts +1 -0
- package/bin/tiangong.js +32 -0
- package/dist/scripts/assert-full-coverage.js +77 -0
- package/dist/scripts/assert-full-coverage.js.map +1 -0
- package/dist/src/cli.js +2740 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/lib/artifacts.js +86 -0
- package/dist/src/lib/artifacts.js.map +1 -0
- package/dist/src/lib/dotenv.js +36 -0
- package/dist/src/lib/dotenv.js.map +1 -0
- package/dist/src/lib/env.js +139 -0
- package/dist/src/lib/env.js.map +1 -0
- package/dist/src/lib/errors.js +38 -0
- package/dist/src/lib/errors.js.map +1 -0
- package/dist/src/lib/flow-build-alias-map.js +299 -0
- package/dist/src/lib/flow-build-alias-map.js.map +1 -0
- package/dist/src/lib/flow-get.js +81 -0
- package/dist/src/lib/flow-get.js.map +1 -0
- package/dist/src/lib/flow-governance.js +164 -0
- package/dist/src/lib/flow-governance.js.map +1 -0
- package/dist/src/lib/flow-list.js +187 -0
- package/dist/src/lib/flow-list.js.map +1 -0
- package/dist/src/lib/flow-publish-reviewed-data.js +808 -0
- package/dist/src/lib/flow-publish-reviewed-data.js.map +1 -0
- package/dist/src/lib/flow-publish-version.js +541 -0
- package/dist/src/lib/flow-publish-version.js.map +1 -0
- package/dist/src/lib/flow-read.js +310 -0
- package/dist/src/lib/flow-read.js.map +1 -0
- package/dist/src/lib/flow-regen-product.js +1396 -0
- package/dist/src/lib/flow-regen-product.js.map +1 -0
- package/dist/src/lib/flow-remediate.js +821 -0
- package/dist/src/lib/flow-remediate.js.map +1 -0
- package/dist/src/lib/http.js +45 -0
- package/dist/src/lib/http.js.map +1 -0
- package/dist/src/lib/io.js +30 -0
- package/dist/src/lib/io.js.map +1 -0
- package/dist/src/lib/kb-search.js +83 -0
- package/dist/src/lib/kb-search.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-auto-build.js +1328 -0
- package/dist/src/lib/lifecyclemodel-auto-build.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-orchestrate.js +1556 -0
- package/dist/src/lib/lifecyclemodel-orchestrate.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-publish-build.js +296 -0
- package/dist/src/lib/lifecyclemodel-publish-build.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-publish-resulting-process.js +101 -0
- package/dist/src/lib/lifecyclemodel-publish-resulting-process.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-resulting-process.js +1152 -0
- package/dist/src/lib/lifecyclemodel-resulting-process.js.map +1 -0
- package/dist/src/lib/lifecyclemodel-validate-build.js +238 -0
- package/dist/src/lib/lifecyclemodel-validate-build.js.map +1 -0
- package/dist/src/lib/llm.js +383 -0
- package/dist/src/lib/llm.js.map +1 -0
- package/dist/src/lib/process-auto-build.js +717 -0
- package/dist/src/lib/process-auto-build.js.map +1 -0
- package/dist/src/lib/process-batch-build.js +409 -0
- package/dist/src/lib/process-batch-build.js.map +1 -0
- package/dist/src/lib/process-get.js +66 -0
- package/dist/src/lib/process-get.js.map +1 -0
- package/dist/src/lib/process-publish-build.js +451 -0
- package/dist/src/lib/process-publish-build.js.map +1 -0
- package/dist/src/lib/process-resume-build.js +364 -0
- package/dist/src/lib/process-resume-build.js.map +1 -0
- package/dist/src/lib/publish.js +562 -0
- package/dist/src/lib/publish.js.map +1 -0
- package/dist/src/lib/remote.js +88 -0
- package/dist/src/lib/remote.js.map +1 -0
- package/dist/src/lib/review-flow.js +1110 -0
- package/dist/src/lib/review-flow.js.map +1 -0
- package/dist/src/lib/review-lifecyclemodel.js +727 -0
- package/dist/src/lib/review-lifecyclemodel.js.map +1 -0
- package/dist/src/lib/review-process.js +702 -0
- package/dist/src/lib/review-process.js.map +1 -0
- package/dist/src/lib/run.js +106 -0
- package/dist/src/lib/run.js.map +1 -0
- package/dist/src/lib/state-lock.js +150 -0
- package/dist/src/lib/state-lock.js.map +1 -0
- package/dist/src/lib/supabase-client.js +269 -0
- package/dist/src/lib/supabase-client.js.map +1 -0
- package/dist/src/lib/supabase-json-ordered-write.js +186 -0
- package/dist/src/lib/supabase-json-ordered-write.js.map +1 -0
- package/dist/src/lib/supabase-rest.js +138 -0
- package/dist/src/lib/supabase-rest.js.map +1 -0
- package/dist/src/lib/supabase-session.js +424 -0
- package/dist/src/lib/supabase-session.js.map +1 -0
- package/dist/src/lib/tidas-sdk-package-validator.js +493 -0
- package/dist/src/lib/tidas-sdk-package-validator.js.map +1 -0
- package/dist/src/lib/unstructured.js +203 -0
- package/dist/src/lib/unstructured.js.map +1 -0
- package/dist/src/lib/user-api-key.js +75 -0
- package/dist/src/lib/user-api-key.js.map +1 -0
- package/dist/src/lib/validation.js +191 -0
- package/dist/src/lib/validation.js.map +1 -0
- package/dist/src/main.js +38 -0
- package/dist/src/main.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,808 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { writeJsonArtifact, writeJsonLinesArtifact } from './artifacts.js';
|
|
4
|
+
import { CliError } from './errors.js';
|
|
5
|
+
import { coerceText, datasetPayloadFromRow, deepGet, extractFlowRecord, isRecord, listify, loadRowsFromFile, } from './flow-governance.js';
|
|
6
|
+
import { runFlowPublishVersion, } from './flow-publish-version.js';
|
|
7
|
+
import { hasSupabaseRestRuntime, syncSupabaseJsonOrderedRecord, } from './supabase-json-ordered-write.js';
|
|
8
|
+
const DEFAULT_MAX_WORKERS = 4;
|
|
9
|
+
const LEGACY_OUTPUT_PREFIX = 'flows_tidas_sdk_plus_classification';
|
|
10
|
+
function assert_input_file(inputFile, code, message = 'Missing required input file value.') {
|
|
11
|
+
if (!inputFile) {
|
|
12
|
+
throw new CliError(message, {
|
|
13
|
+
code,
|
|
14
|
+
exitCode: 2,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const resolved = path.resolve(inputFile);
|
|
18
|
+
if (!existsSync(resolved)) {
|
|
19
|
+
throw new CliError(`Input file not found: ${resolved}`, {
|
|
20
|
+
code,
|
|
21
|
+
exitCode: 2,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return resolved;
|
|
25
|
+
}
|
|
26
|
+
function assert_optional_input_file(inputFile, code) {
|
|
27
|
+
if (!inputFile) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const resolved = path.resolve(inputFile);
|
|
31
|
+
if (!existsSync(resolved)) {
|
|
32
|
+
throw new CliError(`Input file not found: ${resolved}`, {
|
|
33
|
+
code,
|
|
34
|
+
exitCode: 2,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return resolved;
|
|
38
|
+
}
|
|
39
|
+
function assert_out_dir(outDir) {
|
|
40
|
+
if (!outDir) {
|
|
41
|
+
throw new CliError('Missing required --out-dir value.', {
|
|
42
|
+
code: 'FLOW_PUBLISH_REVIEWED_OUT_DIR_REQUIRED',
|
|
43
|
+
exitCode: 2,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return path.resolve(outDir);
|
|
47
|
+
}
|
|
48
|
+
function clone_json(value) {
|
|
49
|
+
if (value === undefined) {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
return JSON.parse(JSON.stringify(value));
|
|
53
|
+
}
|
|
54
|
+
function json_equal(left, right) {
|
|
55
|
+
if (left === right) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
59
|
+
if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return left.every((value, index) => json_equal(value, right[index]));
|
|
63
|
+
}
|
|
64
|
+
if (!isRecord(left) || !isRecord(right)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
const leftKeys = Object.keys(left).sort();
|
|
68
|
+
const rightKeys = Object.keys(right).sort();
|
|
69
|
+
if (leftKeys.length !== rightKeys.length) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return leftKeys.every((key, index) => key === rightKeys[index] && json_equal(left[key], right[key]));
|
|
73
|
+
}
|
|
74
|
+
function normalize_publish_policy(value, label = '--flow-publish-policy', code = 'FLOW_PUBLISH_REVIEWED_POLICY_INVALID') {
|
|
75
|
+
if (value === undefined || value === '') {
|
|
76
|
+
return 'append_only_bump';
|
|
77
|
+
}
|
|
78
|
+
if (value === 'skip' || value === 'append_only_bump' || value === 'upsert_current_version') {
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
throw new CliError(`Expected ${label} to be one of: skip, append_only_bump, upsert_current_version.`, {
|
|
82
|
+
code,
|
|
83
|
+
exitCode: 2,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function bump_ilcd_version(version) {
|
|
87
|
+
const parts = String(version || '')
|
|
88
|
+
.trim()
|
|
89
|
+
.split('.');
|
|
90
|
+
if (parts.length !== 3 || !parts.every((part) => /^\d+$/u.test(part))) {
|
|
91
|
+
return '01.01.001';
|
|
92
|
+
}
|
|
93
|
+
const [head, middle, tail] = parts;
|
|
94
|
+
return `${Number.parseInt(head, 10).toString().padStart(head.length, '0')}.${Number.parseInt(middle, 10)
|
|
95
|
+
.toString()
|
|
96
|
+
.padStart(middle.length, '0')}.${(Number.parseInt(tail, 10) + 1)
|
|
97
|
+
.toString()
|
|
98
|
+
.padStart(tail.length, '0')}`;
|
|
99
|
+
}
|
|
100
|
+
function set_flow_version(row, newVersion) {
|
|
101
|
+
const payload = datasetPayloadFromRow(row);
|
|
102
|
+
const dataset = isRecord(payload.flowDataSet) ? payload.flowDataSet : payload;
|
|
103
|
+
const administrativeInformation = isRecord(dataset.administrativeInformation)
|
|
104
|
+
? dataset.administrativeInformation
|
|
105
|
+
: {};
|
|
106
|
+
if (!isRecord(dataset.administrativeInformation)) {
|
|
107
|
+
dataset.administrativeInformation = administrativeInformation;
|
|
108
|
+
}
|
|
109
|
+
const publicationAndOwnership = isRecord(administrativeInformation.publicationAndOwnership)
|
|
110
|
+
? administrativeInformation.publicationAndOwnership
|
|
111
|
+
: {};
|
|
112
|
+
if (!isRecord(administrativeInformation.publicationAndOwnership)) {
|
|
113
|
+
administrativeInformation.publicationAndOwnership = publicationAndOwnership;
|
|
114
|
+
}
|
|
115
|
+
publicationAndOwnership['common:dataSetVersion'] = newVersion;
|
|
116
|
+
row.version = newVersion;
|
|
117
|
+
}
|
|
118
|
+
function process_dataset_from_row(row) {
|
|
119
|
+
const payload = datasetPayloadFromRow(row);
|
|
120
|
+
return isRecord(payload.processDataSet) ? payload.processDataSet : payload;
|
|
121
|
+
}
|
|
122
|
+
function extract_process_identity(row) {
|
|
123
|
+
const dataset = process_dataset_from_row(row);
|
|
124
|
+
const info = deepGet(dataset, ['processInformation', 'dataSetInformation'], {});
|
|
125
|
+
const id = coerceText(row.id) || coerceText(info['common:UUID']);
|
|
126
|
+
const version = coerceText(row.version) ||
|
|
127
|
+
coerceText(deepGet(dataset, [
|
|
128
|
+
'administrativeInformation',
|
|
129
|
+
'publicationAndOwnership',
|
|
130
|
+
'common:dataSetVersion',
|
|
131
|
+
])) ||
|
|
132
|
+
'01.00.000';
|
|
133
|
+
const nameBlock = deepGet(info, ['name', 'baseName']) ?? deepGet(info, ['name']) ?? info.name;
|
|
134
|
+
const name = coerceText(nameBlock) || id;
|
|
135
|
+
return {
|
|
136
|
+
id,
|
|
137
|
+
version,
|
|
138
|
+
name,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function exchange_records(processRow) {
|
|
142
|
+
const dataset = process_dataset_from_row(processRow);
|
|
143
|
+
return listify(deepGet(dataset, ['exchanges', 'exchange'], [])).filter(isRecord);
|
|
144
|
+
}
|
|
145
|
+
function set_process_version(row, newVersion) {
|
|
146
|
+
const payload = datasetPayloadFromRow(row);
|
|
147
|
+
const dataset = isRecord(payload.processDataSet) ? payload.processDataSet : payload;
|
|
148
|
+
const administrativeInformation = isRecord(dataset.administrativeInformation)
|
|
149
|
+
? dataset.administrativeInformation
|
|
150
|
+
: {};
|
|
151
|
+
if (!isRecord(dataset.administrativeInformation)) {
|
|
152
|
+
dataset.administrativeInformation = administrativeInformation;
|
|
153
|
+
}
|
|
154
|
+
const publicationAndOwnership = isRecord(administrativeInformation.publicationAndOwnership)
|
|
155
|
+
? administrativeInformation.publicationAndOwnership
|
|
156
|
+
: {};
|
|
157
|
+
if (!isRecord(administrativeInformation.publicationAndOwnership)) {
|
|
158
|
+
administrativeInformation.publicationAndOwnership = publicationAndOwnership;
|
|
159
|
+
}
|
|
160
|
+
publicationAndOwnership['common:dataSetVersion'] = newVersion;
|
|
161
|
+
row.version = newVersion;
|
|
162
|
+
}
|
|
163
|
+
function build_flow_index(rows) {
|
|
164
|
+
const byUuidVersion = {};
|
|
165
|
+
for (const row of rows) {
|
|
166
|
+
const record = extractFlowRecord(row);
|
|
167
|
+
byUuidVersion[`${record.id}@${record.version}`] = record;
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
byUuidVersion,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function build_local_dataset_uri(datasetKind, uuidValue, version) {
|
|
174
|
+
if (!uuidValue) {
|
|
175
|
+
return '';
|
|
176
|
+
}
|
|
177
|
+
const folderMap = {
|
|
178
|
+
flow: 'flows',
|
|
179
|
+
'flow data set': 'flows',
|
|
180
|
+
};
|
|
181
|
+
const folder = folderMap[datasetKind.trim().toLowerCase()] ?? 'datasets';
|
|
182
|
+
const versionText = version.trim() || '01.00.000';
|
|
183
|
+
return `../${folder}/${uuidValue}_${versionText}.xml`;
|
|
184
|
+
}
|
|
185
|
+
function preserve_short_description_shape(existing, target) {
|
|
186
|
+
if (Array.isArray(existing)) {
|
|
187
|
+
if (existing.length > 0 && isRecord(existing[0])) {
|
|
188
|
+
const patched = clone_json(existing[0]);
|
|
189
|
+
patched['@xml:lang'] =
|
|
190
|
+
coerceText(target['@xml:lang']) || coerceText(patched['@xml:lang']) || 'en';
|
|
191
|
+
patched['#text'] = coerceText(target['#text']);
|
|
192
|
+
return [patched];
|
|
193
|
+
}
|
|
194
|
+
return [clone_json(target)];
|
|
195
|
+
}
|
|
196
|
+
if (isRecord(existing)) {
|
|
197
|
+
const patched = clone_json(existing);
|
|
198
|
+
patched['@xml:lang'] =
|
|
199
|
+
coerceText(target['@xml:lang']) || coerceText(patched['@xml:lang']) || 'en';
|
|
200
|
+
patched['#text'] = coerceText(target['#text']);
|
|
201
|
+
return patched;
|
|
202
|
+
}
|
|
203
|
+
return clone_json(target);
|
|
204
|
+
}
|
|
205
|
+
function flow_reference_from_record(record) {
|
|
206
|
+
const targetShortDescription = record.shortDescription ??
|
|
207
|
+
{
|
|
208
|
+
'@xml:lang': 'en',
|
|
209
|
+
'#text': record.name,
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
'@type': 'flow data set',
|
|
213
|
+
'@refObjectId': record.id,
|
|
214
|
+
'@version': record.version,
|
|
215
|
+
'@uri': build_local_dataset_uri('flow data set', record.id, record.version),
|
|
216
|
+
'common:shortDescription': clone_json(targetShortDescription),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function patched_flow_reference(currentRef, record) {
|
|
220
|
+
const current = isRecord(currentRef) ? clone_json(currentRef) : {};
|
|
221
|
+
const target = flow_reference_from_record(record);
|
|
222
|
+
current['@type'] = coerceText(current['@type']) || coerceText(target['@type']);
|
|
223
|
+
current['@refObjectId'] = target['@refObjectId'];
|
|
224
|
+
current['@version'] = target['@version'];
|
|
225
|
+
current['@uri'] = target['@uri'];
|
|
226
|
+
current['common:shortDescription'] = preserve_short_description_shape(current['common:shortDescription'], target['common:shortDescription']);
|
|
227
|
+
return current;
|
|
228
|
+
}
|
|
229
|
+
function build_output_files(outDir) {
|
|
230
|
+
return {
|
|
231
|
+
prepared_flow_rows: path.join(outDir, 'prepared-flow-rows.json'),
|
|
232
|
+
prepared_process_rows: path.join(outDir, 'prepared-process-rows.json'),
|
|
233
|
+
flow_version_map: path.join(outDir, 'flow-version-map.json'),
|
|
234
|
+
skipped_unchanged_flow_rows: path.join(outDir, 'skipped-unchanged-flow-rows.json'),
|
|
235
|
+
process_ref_rewrite_evidence: path.join(outDir, 'process-flow-ref-rewrite-evidence.jsonl'),
|
|
236
|
+
success_list: path.join(outDir, `${LEGACY_OUTPUT_PREFIX}_mcp_success_list.json`),
|
|
237
|
+
remote_failed: path.join(outDir, `${LEGACY_OUTPUT_PREFIX}_remote_validation_failed.jsonl`),
|
|
238
|
+
flow_publish_version_report: path.join(outDir, `${LEGACY_OUTPUT_PREFIX}_mcp_sync_report.json`),
|
|
239
|
+
report: path.join(outDir, 'publish-report.json'),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function status_from_mode(mode, failureCount) {
|
|
243
|
+
if (mode === 'dry_run') {
|
|
244
|
+
return 'prepared_flow_publish_reviewed_data';
|
|
245
|
+
}
|
|
246
|
+
return failureCount > 0
|
|
247
|
+
? 'completed_flow_publish_reviewed_data_with_failures'
|
|
248
|
+
: 'completed_flow_publish_reviewed_data';
|
|
249
|
+
}
|
|
250
|
+
function prepare_flow_rows(options) {
|
|
251
|
+
if (options.policy === 'skip') {
|
|
252
|
+
return {
|
|
253
|
+
preparedRows: [],
|
|
254
|
+
plans: [],
|
|
255
|
+
flowVersionMap: {},
|
|
256
|
+
skippedUnchangedRows: [],
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const originalMap = new Map();
|
|
260
|
+
for (const row of options.originalRows) {
|
|
261
|
+
const record = extractFlowRecord(row);
|
|
262
|
+
if (record.id && record.version) {
|
|
263
|
+
originalMap.set(`${record.id}@${record.version}`, row);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const preparedRows = [];
|
|
267
|
+
const plans = [];
|
|
268
|
+
const flowVersionMap = {};
|
|
269
|
+
const skippedUnchangedRows = [];
|
|
270
|
+
for (const row of options.rows) {
|
|
271
|
+
const working = clone_json(row);
|
|
272
|
+
const record = extractFlowRecord(working);
|
|
273
|
+
const originalRow = record.id && record.version ? originalMap.get(`${record.id}@${record.version}`) : undefined;
|
|
274
|
+
if (originalRow && json_equal(datasetPayloadFromRow(originalRow), datasetPayloadFromRow(row))) {
|
|
275
|
+
skippedUnchangedRows.push({
|
|
276
|
+
entity_type: 'flow',
|
|
277
|
+
entity_id: record.id,
|
|
278
|
+
entity_name: record.name,
|
|
279
|
+
version: record.version,
|
|
280
|
+
reason: 'unchanged_vs_original_rows_file',
|
|
281
|
+
});
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
let publishVersion = record.version;
|
|
285
|
+
let versionStrategy = 'keep_current';
|
|
286
|
+
if (options.policy === 'append_only_bump') {
|
|
287
|
+
publishVersion = bump_ilcd_version(record.version);
|
|
288
|
+
set_flow_version(working, publishVersion);
|
|
289
|
+
versionStrategy = 'bump';
|
|
290
|
+
if (record.id && record.version) {
|
|
291
|
+
flowVersionMap[`${record.id}@${record.version}`] = {
|
|
292
|
+
id: record.id,
|
|
293
|
+
source_version: record.version,
|
|
294
|
+
target_version: publishVersion,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
preparedRows.push(working);
|
|
299
|
+
plans.push({
|
|
300
|
+
entity_type: 'flow',
|
|
301
|
+
entity_id: record.id,
|
|
302
|
+
entity_name: record.name,
|
|
303
|
+
original_version: record.version,
|
|
304
|
+
publish_version: publishVersion,
|
|
305
|
+
version_strategy: versionStrategy,
|
|
306
|
+
publish_policy: options.policy,
|
|
307
|
+
row: working,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
preparedRows,
|
|
312
|
+
plans,
|
|
313
|
+
flowVersionMap,
|
|
314
|
+
skippedUnchangedRows,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function prepare_process_rows(options) {
|
|
318
|
+
if (options.policy === 'skip') {
|
|
319
|
+
return {
|
|
320
|
+
preparedRows: [],
|
|
321
|
+
plans: [],
|
|
322
|
+
rewriteEvidence: [],
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
const preparedRows = options.rows.map((row) => clone_json(row));
|
|
326
|
+
const rewriteEvidence = [];
|
|
327
|
+
if (options.rewriteRefs &&
|
|
328
|
+
preparedRows.length > 0 &&
|
|
329
|
+
options.preparedFlowRows.length > 0 &&
|
|
330
|
+
Object.keys(options.flowVersionMap).length > 0) {
|
|
331
|
+
const targetIndex = build_flow_index(options.preparedFlowRows).byUuidVersion;
|
|
332
|
+
for (const row of preparedRows) {
|
|
333
|
+
const processIdentity = extract_process_identity(row);
|
|
334
|
+
for (const exchange of exchange_records(row)) {
|
|
335
|
+
const currentRef = isRecord(exchange.referenceToFlowDataSet)
|
|
336
|
+
? exchange.referenceToFlowDataSet
|
|
337
|
+
: null;
|
|
338
|
+
if (!currentRef) {
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
const flowId = coerceText(currentRef['@refObjectId']);
|
|
342
|
+
const flowVersion = coerceText(currentRef['@version']);
|
|
343
|
+
const mapped = options.flowVersionMap[`${flowId}@${flowVersion}`];
|
|
344
|
+
if (!mapped) {
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
const targetRecord = targetIndex[`${mapped.id}@${mapped.target_version}`];
|
|
348
|
+
if (!targetRecord) {
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
exchange.referenceToFlowDataSet = patched_flow_reference(currentRef, targetRecord);
|
|
352
|
+
rewriteEvidence.push({
|
|
353
|
+
process_id: processIdentity.id,
|
|
354
|
+
process_version_before_publish: processIdentity.version,
|
|
355
|
+
process_name: processIdentity.name,
|
|
356
|
+
exchange_internal_id: coerceText(exchange['@dataSetInternalID']),
|
|
357
|
+
source_flow_id: flowId,
|
|
358
|
+
source_flow_version: flowVersion,
|
|
359
|
+
target_flow_id: mapped.id,
|
|
360
|
+
target_flow_version: mapped.target_version,
|
|
361
|
+
target_flow_name: targetRecord.name,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
const plans = [];
|
|
367
|
+
for (const row of preparedRows) {
|
|
368
|
+
const record = extract_process_identity(row);
|
|
369
|
+
let publishVersion = record.version;
|
|
370
|
+
let versionStrategy = 'keep_current';
|
|
371
|
+
if (options.policy === 'append_only_bump') {
|
|
372
|
+
publishVersion = bump_ilcd_version(record.version);
|
|
373
|
+
set_process_version(row, publishVersion);
|
|
374
|
+
versionStrategy = 'bump';
|
|
375
|
+
}
|
|
376
|
+
plans.push({
|
|
377
|
+
entity_type: 'process',
|
|
378
|
+
entity_id: record.id,
|
|
379
|
+
entity_name: record.name,
|
|
380
|
+
original_version: record.version,
|
|
381
|
+
publish_version: publishVersion,
|
|
382
|
+
version_strategy: versionStrategy,
|
|
383
|
+
publish_policy: options.policy,
|
|
384
|
+
row,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
preparedRows,
|
|
389
|
+
plans,
|
|
390
|
+
rewriteEvidence,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function build_local_row_report(plan) {
|
|
394
|
+
return {
|
|
395
|
+
entity_type: 'flow',
|
|
396
|
+
id: plan.entity_id,
|
|
397
|
+
name: plan.entity_name,
|
|
398
|
+
original_version: plan.original_version,
|
|
399
|
+
publish_version: plan.publish_version,
|
|
400
|
+
publish_policy: plan.publish_policy,
|
|
401
|
+
version_strategy: plan.version_strategy,
|
|
402
|
+
status: 'prepared',
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function build_local_process_row_report(plan) {
|
|
406
|
+
return {
|
|
407
|
+
entity_type: 'process',
|
|
408
|
+
id: plan.entity_id,
|
|
409
|
+
name: plan.entity_name,
|
|
410
|
+
original_version: plan.original_version,
|
|
411
|
+
publish_version: plan.publish_version,
|
|
412
|
+
publish_policy: plan.publish_policy,
|
|
413
|
+
version_strategy: plan.version_strategy,
|
|
414
|
+
status: 'prepared',
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function process_publish_payload_from_row(row) {
|
|
418
|
+
const payload = datasetPayloadFromRow(row);
|
|
419
|
+
const dataset = isRecord(payload.processDataSet) ? payload.processDataSet : payload;
|
|
420
|
+
return {
|
|
421
|
+
processDataSet: clone_json(dataset),
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function build_process_commit_success_report(plan, operation) {
|
|
425
|
+
return {
|
|
426
|
+
entity_type: 'process',
|
|
427
|
+
id: plan.entity_id,
|
|
428
|
+
name: plan.entity_name,
|
|
429
|
+
original_version: plan.original_version,
|
|
430
|
+
publish_version: plan.publish_version,
|
|
431
|
+
publish_policy: plan.publish_policy,
|
|
432
|
+
version_strategy: plan.version_strategy,
|
|
433
|
+
status: operation === 'insert'
|
|
434
|
+
? 'inserted'
|
|
435
|
+
: operation === 'skipped_existing'
|
|
436
|
+
? 'skipped_existing'
|
|
437
|
+
: 'updated',
|
|
438
|
+
operation,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function build_process_commit_failure_report(plan, error) {
|
|
442
|
+
return {
|
|
443
|
+
entity_type: 'process',
|
|
444
|
+
id: plan.entity_id,
|
|
445
|
+
name: plan.entity_name,
|
|
446
|
+
original_version: plan.original_version,
|
|
447
|
+
publish_version: plan.publish_version,
|
|
448
|
+
publish_policy: plan.publish_policy,
|
|
449
|
+
version_strategy: plan.version_strategy,
|
|
450
|
+
status: 'failed',
|
|
451
|
+
error,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function normalize_process_commit_failure(error) {
|
|
455
|
+
if (error instanceof CliError && error.code === 'REMOTE_REQUEST_FAILED') {
|
|
456
|
+
if (typeof error.details === 'string' && error.details.trim()) {
|
|
457
|
+
return error.details;
|
|
458
|
+
}
|
|
459
|
+
if (error.message.startsWith('HTTP 0 returned') && isRecord(error.details)) {
|
|
460
|
+
const detailMessage = typeof error.details.message === 'string' ? error.details.message.trim() : '';
|
|
461
|
+
const normalized = detailMessage.replace(/^(?:FetchError|Error):\s*/u, '').trim();
|
|
462
|
+
if (normalized && normalized !== 'undefined') {
|
|
463
|
+
return normalized;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return error instanceof Error ? error.message : error;
|
|
468
|
+
}
|
|
469
|
+
function build_commit_success_report(plan, success) {
|
|
470
|
+
return {
|
|
471
|
+
entity_type: 'flow',
|
|
472
|
+
id: plan.entity_id,
|
|
473
|
+
name: plan.entity_name,
|
|
474
|
+
original_version: plan.original_version,
|
|
475
|
+
publish_version: plan.publish_version,
|
|
476
|
+
publish_policy: plan.publish_policy,
|
|
477
|
+
version_strategy: plan.version_strategy,
|
|
478
|
+
status: success.operation === 'insert' ? 'inserted' : 'updated',
|
|
479
|
+
operation: success.operation,
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
function build_commit_failure_report(plan, failure) {
|
|
483
|
+
return {
|
|
484
|
+
entity_type: 'flow',
|
|
485
|
+
id: plan.entity_id,
|
|
486
|
+
name: plan.entity_name,
|
|
487
|
+
original_version: plan.original_version,
|
|
488
|
+
publish_version: plan.publish_version,
|
|
489
|
+
publish_policy: plan.publish_policy,
|
|
490
|
+
version_strategy: plan.version_strategy,
|
|
491
|
+
status: 'failed',
|
|
492
|
+
error: failure.reason,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
function build_flow_key(id, version) {
|
|
496
|
+
if (!id || !version) {
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
return `${id}@${version}`;
|
|
500
|
+
}
|
|
501
|
+
function queue_by_key(items, keyFn) {
|
|
502
|
+
const queued = new Map();
|
|
503
|
+
for (const item of items) {
|
|
504
|
+
const key = keyFn(item);
|
|
505
|
+
if (!key) {
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
const queue = queued.get(key) ?? [];
|
|
509
|
+
queue.push(item);
|
|
510
|
+
queued.set(key, queue);
|
|
511
|
+
}
|
|
512
|
+
return queued;
|
|
513
|
+
}
|
|
514
|
+
function failure_key(row) {
|
|
515
|
+
const record = extractFlowRecord(row);
|
|
516
|
+
return build_flow_key(record.id, record.version);
|
|
517
|
+
}
|
|
518
|
+
function success_key(row) {
|
|
519
|
+
return build_flow_key(row.id, row.version);
|
|
520
|
+
}
|
|
521
|
+
function shift_queue(queue, key) {
|
|
522
|
+
if (!key) {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
const items = queue.get(key);
|
|
526
|
+
if (!items?.length) {
|
|
527
|
+
return null;
|
|
528
|
+
}
|
|
529
|
+
const [first, ...rest] = items;
|
|
530
|
+
if (rest.length) {
|
|
531
|
+
queue.set(key, rest);
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
queue.delete(key);
|
|
535
|
+
}
|
|
536
|
+
return first ?? null;
|
|
537
|
+
}
|
|
538
|
+
async function map_with_concurrency(items, maxWorkers, worker) {
|
|
539
|
+
const results = new Array(items.length);
|
|
540
|
+
const workerCount = Math.min(Math.max(1, maxWorkers), Math.max(items.length, 1));
|
|
541
|
+
let nextIndex = 0;
|
|
542
|
+
async function runWorker() {
|
|
543
|
+
while (true) {
|
|
544
|
+
const currentIndex = nextIndex;
|
|
545
|
+
nextIndex += 1;
|
|
546
|
+
if (currentIndex >= items.length) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
results[currentIndex] = await worker(items[currentIndex], currentIndex);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
await Promise.all(Array.from({ length: workerCount }, () => runWorker()));
|
|
553
|
+
return results;
|
|
554
|
+
}
|
|
555
|
+
function map_commit_reports(plans, successes, failures) {
|
|
556
|
+
const successQueue = queue_by_key(successes, success_key);
|
|
557
|
+
const failureQueue = queue_by_key(failures, failure_key);
|
|
558
|
+
const unkeyedFailures = failures.filter((failure) => failure_key(failure) === null);
|
|
559
|
+
return plans.map((plan) => {
|
|
560
|
+
const key = build_flow_key(plan.entity_id, plan.publish_version);
|
|
561
|
+
const success = shift_queue(successQueue, key);
|
|
562
|
+
if (success) {
|
|
563
|
+
return build_commit_success_report(plan, success);
|
|
564
|
+
}
|
|
565
|
+
const failure = shift_queue(failureQueue, key) ?? (key ? null : (unkeyedFailures.shift() ?? null));
|
|
566
|
+
if (failure) {
|
|
567
|
+
return build_commit_failure_report(plan, failure);
|
|
568
|
+
}
|
|
569
|
+
return {
|
|
570
|
+
...build_local_row_report(plan),
|
|
571
|
+
status: 'failed',
|
|
572
|
+
error: [
|
|
573
|
+
{
|
|
574
|
+
code: 'UNMATCHED_PUBLISH_RESULT',
|
|
575
|
+
message: 'Publish result was missing for prepared flow row.',
|
|
576
|
+
},
|
|
577
|
+
],
|
|
578
|
+
};
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function build_compat_report(options) {
|
|
582
|
+
let status;
|
|
583
|
+
if (options.mode === 'dry_run') {
|
|
584
|
+
status = 'prepared_flow_publish_version';
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
status =
|
|
588
|
+
options.failureCount > 0
|
|
589
|
+
? 'completed_flow_publish_version_with_failures'
|
|
590
|
+
: 'completed_flow_publish_version';
|
|
591
|
+
}
|
|
592
|
+
return {
|
|
593
|
+
schema_version: 1,
|
|
594
|
+
generated_at_utc: options.now.toISOString(),
|
|
595
|
+
status,
|
|
596
|
+
mode: options.mode,
|
|
597
|
+
input_file: options.files.prepared_flow_rows,
|
|
598
|
+
out_dir: path.dirname(options.files.report),
|
|
599
|
+
counts: {
|
|
600
|
+
total_rows: options.preparedRows,
|
|
601
|
+
success_count: options.successCount,
|
|
602
|
+
failure_count: options.failureCount,
|
|
603
|
+
},
|
|
604
|
+
operation_counts: {},
|
|
605
|
+
max_workers: options.maxWorkers,
|
|
606
|
+
limit: null,
|
|
607
|
+
target_user_id_override: options.targetUserId,
|
|
608
|
+
files: {
|
|
609
|
+
success_list: options.files.success_list,
|
|
610
|
+
remote_failed: options.files.remote_failed,
|
|
611
|
+
report: options.files.flow_publish_version_report,
|
|
612
|
+
},
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
async function commit_process_plans(options) {
|
|
616
|
+
return map_with_concurrency(options.plans, options.maxWorkers, async (plan) => {
|
|
617
|
+
try {
|
|
618
|
+
const result = await syncSupabaseJsonOrderedRecord({
|
|
619
|
+
table: 'processes',
|
|
620
|
+
id: plan.entity_id,
|
|
621
|
+
version: plan.publish_version,
|
|
622
|
+
payload: process_publish_payload_from_row(plan.row),
|
|
623
|
+
writeMode: plan.publish_policy === 'append_only_bump'
|
|
624
|
+
? 'append_only_insert'
|
|
625
|
+
: 'upsert_current_version',
|
|
626
|
+
env: options.env,
|
|
627
|
+
fetchImpl: options.fetchImpl,
|
|
628
|
+
timeoutMs: options.timeoutMs,
|
|
629
|
+
});
|
|
630
|
+
return build_process_commit_success_report(plan, result.operation);
|
|
631
|
+
}
|
|
632
|
+
catch (error) {
|
|
633
|
+
return build_process_commit_failure_report(plan, normalize_process_commit_failure(error));
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
export async function runFlowReviewedPublishData(options) {
|
|
638
|
+
const flowRowsFile = assert_optional_input_file(options.flowRowsFile, 'FLOW_PUBLISH_REVIEWED_FLOW_ROWS_NOT_FOUND');
|
|
639
|
+
const processRowsFile = assert_optional_input_file(options.processRowsFile, 'FLOW_PUBLISH_REVIEWED_PROCESS_ROWS_NOT_FOUND');
|
|
640
|
+
if (!flowRowsFile && !processRowsFile) {
|
|
641
|
+
throw new CliError('Provide at least one of --flow-rows-file or --process-rows-file.', {
|
|
642
|
+
code: 'FLOW_PUBLISH_REVIEWED_INPUT_REQUIRED',
|
|
643
|
+
exitCode: 2,
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
const originalFlowRowsFile = assert_optional_input_file(options.originalFlowRowsFile, 'FLOW_PUBLISH_REVIEWED_ORIGINAL_ROWS_NOT_FOUND');
|
|
647
|
+
const outDir = assert_out_dir(options.outDir);
|
|
648
|
+
const flowPublishPolicy = normalize_publish_policy(options.flowPublishPolicy);
|
|
649
|
+
const processPublishPolicy = normalize_publish_policy(options.processPublishPolicy, '--process-publish-policy', 'FLOW_PUBLISH_REVIEWED_PROCESS_POLICY_INVALID');
|
|
650
|
+
const rewriteProcessFlowRefs = options.rewriteProcessFlowRefs !== false;
|
|
651
|
+
const mode = options.commit ? 'commit' : 'dry_run';
|
|
652
|
+
const maxWorkers = options.maxWorkers ?? DEFAULT_MAX_WORKERS;
|
|
653
|
+
const targetUserId = typeof options.targetUserId === 'string' && options.targetUserId.trim()
|
|
654
|
+
? options.targetUserId.trim()
|
|
655
|
+
: null;
|
|
656
|
+
const now = options.now ?? new Date();
|
|
657
|
+
const files = build_output_files(outDir);
|
|
658
|
+
const inputFlowRows = flowRowsFile ? loadRowsFromFile(flowRowsFile) : [];
|
|
659
|
+
const originalFlowRows = originalFlowRowsFile ? loadRowsFromFile(originalFlowRowsFile) : [];
|
|
660
|
+
const inputProcessRows = processRowsFile ? loadRowsFromFile(processRowsFile) : [];
|
|
661
|
+
const prepared = prepare_flow_rows({
|
|
662
|
+
rows: inputFlowRows,
|
|
663
|
+
policy: flowPublishPolicy,
|
|
664
|
+
originalRows: originalFlowRows,
|
|
665
|
+
});
|
|
666
|
+
const preparedProcesses = prepare_process_rows({
|
|
667
|
+
rows: inputProcessRows,
|
|
668
|
+
policy: processPublishPolicy,
|
|
669
|
+
rewriteRefs: rewriteProcessFlowRefs,
|
|
670
|
+
preparedFlowRows: prepared.preparedRows,
|
|
671
|
+
flowVersionMap: prepared.flowVersionMap,
|
|
672
|
+
});
|
|
673
|
+
writeJsonArtifact(files.prepared_flow_rows, prepared.preparedRows);
|
|
674
|
+
writeJsonArtifact(files.prepared_process_rows, preparedProcesses.preparedRows);
|
|
675
|
+
writeJsonArtifact(files.flow_version_map, prepared.flowVersionMap);
|
|
676
|
+
writeJsonArtifact(files.skipped_unchanged_flow_rows, prepared.skippedUnchangedRows);
|
|
677
|
+
writeJsonLinesArtifact(files.process_ref_rewrite_evidence, preparedProcesses.rewriteEvidence);
|
|
678
|
+
let flowReports = prepared.plans.map(build_local_row_report);
|
|
679
|
+
let processReports = preparedProcesses.plans.map(build_local_process_row_report);
|
|
680
|
+
if (options.commit && prepared.preparedRows.length > 0) {
|
|
681
|
+
const publishImpl = options.runFlowPublishVersionImpl ?? runFlowPublishVersion;
|
|
682
|
+
await publishImpl({
|
|
683
|
+
inputFile: files.prepared_flow_rows,
|
|
684
|
+
outDir,
|
|
685
|
+
commit: true,
|
|
686
|
+
maxWorkers,
|
|
687
|
+
targetUserId,
|
|
688
|
+
env: options.env,
|
|
689
|
+
fetchImpl: options.fetchImpl,
|
|
690
|
+
timeoutMs: options.timeoutMs,
|
|
691
|
+
now,
|
|
692
|
+
});
|
|
693
|
+
const successRows = loadRowsFromFile(files.success_list);
|
|
694
|
+
const failureRows = loadRowsFromFile(files.remote_failed);
|
|
695
|
+
flowReports = map_commit_reports(prepared.plans, successRows, failureRows);
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
writeJsonArtifact(files.success_list, []);
|
|
699
|
+
writeJsonLinesArtifact(files.remote_failed, []);
|
|
700
|
+
const compatReport = build_compat_report({
|
|
701
|
+
now,
|
|
702
|
+
mode,
|
|
703
|
+
preparedRows: prepared.preparedRows.length,
|
|
704
|
+
successCount: 0,
|
|
705
|
+
failureCount: 0,
|
|
706
|
+
maxWorkers,
|
|
707
|
+
targetUserId,
|
|
708
|
+
files,
|
|
709
|
+
});
|
|
710
|
+
writeJsonArtifact(files.flow_publish_version_report, compatReport);
|
|
711
|
+
}
|
|
712
|
+
if (options.commit && preparedProcesses.preparedRows.length > 0) {
|
|
713
|
+
if (!options.fetchImpl) {
|
|
714
|
+
throw new CliError('Process commit requires a fetch implementation in flow publish-reviewed-data.', {
|
|
715
|
+
code: 'FLOW_PUBLISH_REVIEWED_PROCESS_FETCH_REQUIRED',
|
|
716
|
+
exitCode: 2,
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
const runtimeEnv = options.env;
|
|
720
|
+
if (!runtimeEnv || !hasSupabaseRestRuntime(runtimeEnv)) {
|
|
721
|
+
throw new CliError('Process commit requires TIANGONG_LCA_API_BASE_URL, TIANGONG_LCA_API_KEY, and TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY.', {
|
|
722
|
+
code: 'FLOW_PUBLISH_REVIEWED_PROCESS_RUNTIME_REQUIRED',
|
|
723
|
+
exitCode: 2,
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
processReports = await commit_process_plans({
|
|
727
|
+
plans: preparedProcesses.plans,
|
|
728
|
+
maxWorkers,
|
|
729
|
+
env: runtimeEnv,
|
|
730
|
+
fetchImpl: options.fetchImpl,
|
|
731
|
+
timeoutMs: options.timeoutMs,
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
const successCount = flowReports.filter((report) => report.status === 'inserted' || report.status === 'updated')
|
|
735
|
+
.length +
|
|
736
|
+
processReports.filter((report) => report.status === 'inserted' ||
|
|
737
|
+
report.status === 'updated' ||
|
|
738
|
+
report.status === 'skipped_existing').length;
|
|
739
|
+
const failureCount = flowReports.filter((report) => report.status === 'failed').length +
|
|
740
|
+
processReports.filter((report) => report.status === 'failed').length;
|
|
741
|
+
const report = {
|
|
742
|
+
schema_version: 1,
|
|
743
|
+
generated_at_utc: now.toISOString(),
|
|
744
|
+
status: status_from_mode(mode, failureCount),
|
|
745
|
+
mode,
|
|
746
|
+
flow_rows_file: flowRowsFile,
|
|
747
|
+
process_rows_file: processRowsFile,
|
|
748
|
+
original_flow_rows_file: originalFlowRowsFile,
|
|
749
|
+
out_dir: outDir,
|
|
750
|
+
flow_publish_policy: flowPublishPolicy,
|
|
751
|
+
process_publish_policy: processPublishPolicy,
|
|
752
|
+
rewrite_process_flow_refs: rewriteProcessFlowRefs,
|
|
753
|
+
counts: {
|
|
754
|
+
input_flow_rows: inputFlowRows.length,
|
|
755
|
+
input_process_rows: inputProcessRows.length,
|
|
756
|
+
original_flow_rows: originalFlowRows.length,
|
|
757
|
+
prepared_flow_rows: prepared.preparedRows.length,
|
|
758
|
+
prepared_process_rows: preparedProcesses.preparedRows.length,
|
|
759
|
+
skipped_unchanged_flow_rows: prepared.skippedUnchangedRows.length,
|
|
760
|
+
rewritten_process_flow_refs: preparedProcesses.rewriteEvidence.length,
|
|
761
|
+
flow_publish_reports: flowReports.length,
|
|
762
|
+
process_publish_reports: processReports.length,
|
|
763
|
+
success_count: successCount,
|
|
764
|
+
failure_count: failureCount,
|
|
765
|
+
},
|
|
766
|
+
max_workers: maxWorkers,
|
|
767
|
+
target_user_id_override: targetUserId,
|
|
768
|
+
files,
|
|
769
|
+
flow_reports: flowReports,
|
|
770
|
+
process_reports: processReports,
|
|
771
|
+
skipped_unchanged_flow_rows: prepared.skippedUnchangedRows,
|
|
772
|
+
};
|
|
773
|
+
writeJsonArtifact(files.report, report);
|
|
774
|
+
return report;
|
|
775
|
+
}
|
|
776
|
+
export const __testInternals = {
|
|
777
|
+
assert_input_file,
|
|
778
|
+
assert_optional_input_file,
|
|
779
|
+
assert_out_dir,
|
|
780
|
+
clone_json,
|
|
781
|
+
json_equal,
|
|
782
|
+
normalize_publish_policy,
|
|
783
|
+
bump_ilcd_version,
|
|
784
|
+
set_flow_version,
|
|
785
|
+
process_dataset_from_row,
|
|
786
|
+
extract_process_identity,
|
|
787
|
+
exchange_records,
|
|
788
|
+
set_process_version,
|
|
789
|
+
build_flow_index,
|
|
790
|
+
build_local_dataset_uri,
|
|
791
|
+
preserve_short_description_shape,
|
|
792
|
+
flow_reference_from_record,
|
|
793
|
+
patched_flow_reference,
|
|
794
|
+
build_output_files,
|
|
795
|
+
status_from_mode,
|
|
796
|
+
prepare_flow_rows,
|
|
797
|
+
prepare_process_rows,
|
|
798
|
+
build_compat_report,
|
|
799
|
+
map_commit_reports,
|
|
800
|
+
shift_queue,
|
|
801
|
+
process_publish_payload_from_row,
|
|
802
|
+
build_process_commit_success_report,
|
|
803
|
+
build_process_commit_failure_report,
|
|
804
|
+
normalize_process_commit_failure,
|
|
805
|
+
map_with_concurrency,
|
|
806
|
+
commit_process_plans,
|
|
807
|
+
};
|
|
808
|
+
//# sourceMappingURL=flow-publish-reviewed-data.js.map
|