@tiangong-lca/cli 0.1.0 → 0.1.2
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 +58 -6
- package/dist/src/batch.d.ts +6 -0
- package/dist/src/batch.js +6 -0
- package/dist/src/batch.js.map +1 -0
- package/dist/src/cli.d.ts +161 -0
- package/dist/src/cli.js +130 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/command-spec.d.ts +90 -0
- package/dist/src/command-spec.js +400 -0
- package/dist/src/command-spec.js.map +1 -0
- package/dist/src/lib/artifacts.d.ts +9 -0
- package/dist/src/lib/auth-identity-receipt.d.ts +160 -0
- package/dist/src/lib/auth-identity-receipt.js +634 -0
- package/dist/src/lib/auth-identity-receipt.js.map +1 -0
- package/dist/src/lib/batch/attempt-recovery.d.ts +12 -0
- package/dist/src/lib/batch/attempt-recovery.js +183 -0
- package/dist/src/lib/batch/attempt-recovery.js.map +1 -0
- package/dist/src/lib/batch/canonical-contracts.d.ts +21 -0
- package/dist/src/lib/batch/canonical-contracts.js +180 -0
- package/dist/src/lib/batch/canonical-contracts.js.map +1 -0
- package/dist/src/lib/batch/engine.d.ts +2 -0
- package/dist/src/lib/batch/engine.js +294 -0
- package/dist/src/lib/batch/engine.js.map +1 -0
- package/dist/src/lib/batch/errors.d.ts +51 -0
- package/dist/src/lib/batch/errors.js +81 -0
- package/dist/src/lib/batch/errors.js.map +1 -0
- package/dist/src/lib/batch/item-projection.d.ts +10 -0
- package/dist/src/lib/batch/item-projection.js +118 -0
- package/dist/src/lib/batch/item-projection.js.map +1 -0
- package/dist/src/lib/batch/run-lock.d.ts +4 -0
- package/dist/src/lib/batch/run-lock.js +155 -0
- package/dist/src/lib/batch/run-lock.js.map +1 -0
- package/dist/src/lib/batch/scheduler-runtime.d.ts +29 -0
- package/dist/src/lib/batch/scheduler-runtime.js +114 -0
- package/dist/src/lib/batch/scheduler-runtime.js.map +1 -0
- package/dist/src/lib/batch/types.d.ts +183 -0
- package/dist/src/lib/batch/types.js +2 -0
- package/dist/src/lib/batch/types.js.map +1 -0
- package/dist/src/lib/dataset-author.d.ts +39 -0
- package/dist/src/lib/dataset-bilingual.d.ts +165 -0
- package/dist/src/lib/dataset-classification.d.ts +279 -0
- package/dist/src/lib/dataset-command.d.ts +53 -0
- package/dist/src/lib/dataset-contract.d.ts +82 -0
- package/dist/src/lib/dataset-curation-queue.d.ts +219 -0
- package/dist/src/lib/dataset-evidence-search.d.ts +134 -0
- package/dist/src/lib/dataset-import-lca.d.ts +136 -0
- package/dist/src/lib/dataset-local.d.ts +23 -0
- package/dist/src/lib/dataset-maintenance-alias-request.d.ts +12 -0
- package/dist/src/lib/dataset-maintenance-alias-rewrite.d.ts +111 -0
- package/dist/src/lib/dataset-maintenance-apply.d.ts +458 -0
- package/dist/src/lib/dataset-maintenance-clear-account.d.ts +161 -0
- package/dist/src/lib/dataset-maintenance-contract.d.ts +317 -0
- package/dist/src/lib/dataset-maintenance-derivatives.d.ts +48 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.d.ts +50 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-capture.d.ts +110 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-command.d.ts +15 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-contract.d.ts +387 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.d.ts +456 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-freeze.d.ts +99 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-plan.d.ts +85 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-recovery.d.ts +268 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-run.d.ts +123 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-seal.d.ts +50 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-verify.d.ts +85 -0
- package/dist/src/lib/dataset-maintenance-flow-identity-wire.d.ts +32 -0
- package/dist/src/lib/dataset-maintenance-pagination.d.ts +58 -0
- package/dist/src/lib/dataset-maintenance-plan.d.ts +40 -0
- package/dist/src/lib/dataset-maintenance-protected-artifacts.d.ts +16 -0
- package/dist/src/lib/dataset-maintenance-protected-before.d.ts +71 -0
- package/dist/src/lib/dataset-maintenance-protected-contract.d.ts +385 -0
- package/dist/src/lib/dataset-maintenance-protected-freeze.d.ts +148 -0
- package/dist/src/lib/dataset-maintenance-protected-preparation.d.ts +76 -0
- package/dist/src/lib/dataset-maintenance-protected-run.d.ts +252 -0
- package/dist/src/lib/dataset-maintenance-protected-seal.d.ts +93 -0
- package/dist/src/lib/dataset-maintenance-protected-toolchain.d.ts +31 -0
- package/dist/src/lib/dataset-maintenance-protected-verify.d.ts +99 -0
- package/dist/src/lib/dataset-maintenance-remote.d.ts +212 -0
- package/dist/src/lib/dataset-maintenance-support-validation.d.ts +18 -0
- package/dist/src/lib/dataset-maintenance-verify.d.ts +102 -0
- package/dist/src/lib/dataset-patch.d.ts +193 -0
- package/dist/src/lib/dataset-references-rewrite.d.ts +77 -0
- package/dist/src/lib/dataset-remote-refresh.d.ts +64 -0
- package/dist/src/lib/dataset-remote-verify.d.ts +168 -0
- package/dist/src/lib/dataset-save-draft-run.d.ts +283 -0
- package/dist/src/lib/dataset-save-draft-run.js +54 -21
- package/dist/src/lib/dataset-save-draft-run.js.map +1 -1
- package/dist/src/lib/dataset-source-upload-attachments.d.ts +109 -0
- package/dist/src/lib/dataset-validate.d.ts +62 -0
- package/dist/src/lib/dotenv.d.ts +6 -0
- package/dist/src/lib/env.d.ts +59 -0
- package/dist/src/lib/errors.d.ts +18 -0
- package/dist/src/lib/flow-build-alias-map.d.ts +80 -0
- package/dist/src/lib/flow-fetch-rows.d.ts +70 -0
- package/dist/src/lib/flow-get.d.ts +35 -0
- package/dist/src/lib/flow-governance.d.ts +22 -0
- package/dist/src/lib/flow-list.d.ts +57 -0
- package/dist/src/lib/flow-materialize-decisions.d.ts +67 -0
- package/dist/src/lib/flow-payload-validation.d.ts +32 -0
- package/dist/src/lib/flow-publish-reviewed-data.d.ts +262 -0
- package/dist/src/lib/flow-publish-version.d.ts +193 -0
- package/dist/src/lib/flow-qa.d.ts +289 -0
- package/dist/src/lib/flow-read.d.ts +70 -0
- package/dist/src/lib/flow-regen-product.d.ts +431 -0
- package/dist/src/lib/flow-remediate.d.ts +133 -0
- package/dist/src/lib/http.d.ts +25 -0
- package/dist/src/lib/http.js.map +1 -1
- package/dist/src/lib/identity-preflight.d.ts +235 -0
- package/dist/src/lib/io.d.ts +2 -0
- package/dist/src/lib/kb-search.d.ts +23 -0
- package/dist/src/lib/lca-release.d.ts +105 -0
- package/dist/src/lib/lifecyclemodel-auto-build.d.ts +223 -0
- package/dist/src/lib/lifecyclemodel-bundle-save.d.ts +71 -0
- package/dist/src/lib/lifecyclemodel-graph.d.ts +91 -0
- package/dist/src/lib/lifecyclemodel-orchestrate.d.ts +349 -0
- package/dist/src/lib/lifecyclemodel-publish-build.d.ts +77 -0
- package/dist/src/lib/lifecyclemodel-publish-resulting-process.d.ts +27 -0
- package/dist/src/lib/lifecyclemodel-qa.d.ts +206 -0
- package/dist/src/lib/lifecyclemodel-resulting-process.d.ts +204 -0
- package/dist/src/lib/lifecyclemodel-save-draft-run.d.ts +96 -0
- package/dist/src/lib/lifecyclemodel-validate-build.d.ts +78 -0
- package/dist/src/lib/llm.d.ts +51 -0
- package/dist/src/lib/package-version.d.ts +3 -0
- package/dist/src/lib/process-auto-build.d.ts +168 -0
- package/dist/src/lib/process-batch-build.d.ts +97 -0
- package/dist/src/lib/process-dedup-review.d.ts +253 -0
- package/dist/src/lib/process-flow-build-plan.d.ts +108 -0
- package/dist/src/lib/process-get.d.ts +26 -0
- package/dist/src/lib/process-list.d.ts +87 -0
- package/dist/src/lib/process-payload-validation.d.ts +27 -0
- package/dist/src/lib/process-publish-build.d.ts +148 -0
- package/dist/src/lib/process-qa.d.ts +243 -0
- package/dist/src/lib/process-refresh-references.d.ts +179 -0
- package/dist/src/lib/process-required-fields.d.ts +142 -0
- package/dist/src/lib/process-resume-build.d.ts +77 -0
- package/dist/src/lib/process-save-draft-run.d.ts +72 -0
- package/dist/src/lib/process-save-draft.d.ts +53 -0
- package/dist/src/lib/process-scope-statistics.d.ts +210 -0
- package/dist/src/lib/process-verify-rows.d.ts +71 -0
- package/dist/src/lib/publish.d.ts +219 -0
- package/dist/src/lib/remote.d.ts +19 -0
- package/dist/src/lib/run.d.ts +60 -0
- package/dist/src/lib/runtime-rulesets.d.ts +29 -0
- package/dist/src/lib/state-lock.d.ts +25 -0
- package/dist/src/lib/state-lock.js +23 -1
- package/dist/src/lib/state-lock.js.map +1 -1
- package/dist/src/lib/supabase-client.d.ts +47 -0
- package/dist/src/lib/supabase-data-api-contract.d.ts +304 -0
- package/dist/src/lib/supabase-data-api-replay.d.ts +74 -0
- package/dist/src/lib/supabase-json-ordered-write.d.ts +65 -0
- package/dist/src/lib/supabase-rest.d.ts +26 -0
- package/dist/src/lib/supabase-session.d.ts +115 -0
- package/dist/src/lib/tidas-languages.d.ts +3 -0
- package/dist/src/lib/tidas-sdk-package-validator.d.ts +111 -0
- package/dist/src/lib/tidas-sdk-validation.d.ts +42 -0
- package/dist/src/lib/unstructured.d.ts +32 -0
- package/dist/src/lib/user-api-key.d.ts +16 -0
- package/dist/src/lib/validation.d.ts +82 -0
- package/dist/src/main.d.ts +4 -0
- package/package.json +17 -3
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { type FlowRecord, type JsonRecord } from './flow-governance.js';
|
|
2
|
+
import { type FlowPublishVersionReport, type RunFlowPublishVersionOptions } from './flow-publish-version.js';
|
|
3
|
+
import type { FetchLike } from './http.js';
|
|
4
|
+
import { type SupabaseJsonOrderedWriteOperation } from './supabase-json-ordered-write.js';
|
|
5
|
+
export type FlowPublishPolicy = 'skip' | 'append_only_bump' | 'upsert_current_version';
|
|
6
|
+
export type ProcessPublishPolicy = FlowPublishPolicy;
|
|
7
|
+
type FlowPublishVersionCompatMode = 'dry_run' | 'commit';
|
|
8
|
+
type FlowVersionMapEntry = {
|
|
9
|
+
id: string;
|
|
10
|
+
source_version: string;
|
|
11
|
+
target_version: string;
|
|
12
|
+
};
|
|
13
|
+
type ProcessIdentity = {
|
|
14
|
+
id: string;
|
|
15
|
+
version: string;
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
type FlowIndex = {
|
|
19
|
+
byUuidVersion: Record<string, FlowRecord>;
|
|
20
|
+
};
|
|
21
|
+
type SkippedUnchangedFlowRow = {
|
|
22
|
+
entity_type: 'flow';
|
|
23
|
+
entity_id: string;
|
|
24
|
+
entity_name: string;
|
|
25
|
+
version: string;
|
|
26
|
+
reason: 'unchanged_vs_original_rows_file';
|
|
27
|
+
};
|
|
28
|
+
type PreparedFlowPlan = {
|
|
29
|
+
entity_type: 'flow';
|
|
30
|
+
entity_id: string;
|
|
31
|
+
entity_name: string;
|
|
32
|
+
original_version: string;
|
|
33
|
+
publish_version: string;
|
|
34
|
+
version_strategy: 'keep_current' | 'bump';
|
|
35
|
+
publish_policy: FlowPublishPolicy;
|
|
36
|
+
row: JsonRecord;
|
|
37
|
+
};
|
|
38
|
+
type PreparedProcessPlan = {
|
|
39
|
+
entity_type: 'process';
|
|
40
|
+
entity_id: string;
|
|
41
|
+
entity_name: string;
|
|
42
|
+
original_version: string;
|
|
43
|
+
publish_version: string;
|
|
44
|
+
version_strategy: 'keep_current' | 'bump';
|
|
45
|
+
publish_policy: ProcessPublishPolicy;
|
|
46
|
+
row: JsonRecord;
|
|
47
|
+
};
|
|
48
|
+
type ProcessFlowRefRewriteEvidence = {
|
|
49
|
+
process_id: string;
|
|
50
|
+
process_version_before_publish: string;
|
|
51
|
+
process_name: string;
|
|
52
|
+
exchange_internal_id: string;
|
|
53
|
+
source_flow_id: string;
|
|
54
|
+
source_flow_version: string;
|
|
55
|
+
target_flow_id: string;
|
|
56
|
+
target_flow_version: string;
|
|
57
|
+
target_flow_name: string;
|
|
58
|
+
};
|
|
59
|
+
type FlowPublishSuccessRow = {
|
|
60
|
+
id: string;
|
|
61
|
+
version: string;
|
|
62
|
+
operation: 'would_insert' | 'would_update_existing' | 'insert' | 'update_existing' | 'update_after_insert_error';
|
|
63
|
+
};
|
|
64
|
+
type FlowPublishFailureReason = {
|
|
65
|
+
validator: string;
|
|
66
|
+
stage: string;
|
|
67
|
+
path: string;
|
|
68
|
+
message: string;
|
|
69
|
+
code: string;
|
|
70
|
+
visible_user_id?: string;
|
|
71
|
+
visible_state_code?: string;
|
|
72
|
+
};
|
|
73
|
+
type FlowPublishFailureRow = {
|
|
74
|
+
id: unknown;
|
|
75
|
+
user_id?: unknown;
|
|
76
|
+
json_ordered: JsonRecord;
|
|
77
|
+
reason: FlowPublishFailureReason[];
|
|
78
|
+
state_code?: unknown;
|
|
79
|
+
};
|
|
80
|
+
type FlowReviewedPublishFiles = {
|
|
81
|
+
prepared_flow_rows: string;
|
|
82
|
+
prepared_process_rows: string;
|
|
83
|
+
flow_version_map: string;
|
|
84
|
+
skipped_unchanged_flow_rows: string;
|
|
85
|
+
process_ref_rewrite_evidence: string;
|
|
86
|
+
success_list: string;
|
|
87
|
+
remote_failed: string;
|
|
88
|
+
flow_publish_version_report: string;
|
|
89
|
+
report: string;
|
|
90
|
+
};
|
|
91
|
+
export type FlowReviewedPublishRowReport = {
|
|
92
|
+
entity_type: 'flow';
|
|
93
|
+
id: string;
|
|
94
|
+
name: string;
|
|
95
|
+
original_version: string;
|
|
96
|
+
publish_version: string;
|
|
97
|
+
publish_policy: FlowPublishPolicy;
|
|
98
|
+
version_strategy: 'keep_current' | 'bump';
|
|
99
|
+
status: 'prepared' | 'inserted' | 'updated' | 'failed';
|
|
100
|
+
operation?: FlowPublishSuccessRow['operation'];
|
|
101
|
+
error?: unknown;
|
|
102
|
+
};
|
|
103
|
+
export type FlowReviewedPublishProcessRowReport = {
|
|
104
|
+
entity_type: 'process';
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
original_version: string;
|
|
108
|
+
publish_version: string;
|
|
109
|
+
publish_policy: ProcessPublishPolicy;
|
|
110
|
+
version_strategy: 'keep_current' | 'bump';
|
|
111
|
+
status: 'prepared' | 'inserted' | 'updated' | 'skipped_existing' | 'failed';
|
|
112
|
+
operation?: SupabaseJsonOrderedWriteOperation;
|
|
113
|
+
error?: unknown;
|
|
114
|
+
};
|
|
115
|
+
export type FlowReviewedPublishDataReport = {
|
|
116
|
+
schema_version: 1;
|
|
117
|
+
generated_at_utc: string;
|
|
118
|
+
status: 'prepared_flow_publish_reviewed_data' | 'completed_flow_publish_reviewed_data' | 'completed_flow_publish_reviewed_data_with_failures';
|
|
119
|
+
mode: FlowPublishVersionCompatMode;
|
|
120
|
+
flow_rows_file: string | null;
|
|
121
|
+
process_rows_file: string | null;
|
|
122
|
+
original_flow_rows_file: string | null;
|
|
123
|
+
out_dir: string;
|
|
124
|
+
flow_publish_policy: FlowPublishPolicy;
|
|
125
|
+
process_publish_policy: ProcessPublishPolicy;
|
|
126
|
+
rewrite_process_flow_refs: boolean;
|
|
127
|
+
counts: {
|
|
128
|
+
input_flow_rows: number;
|
|
129
|
+
input_process_rows: number;
|
|
130
|
+
original_flow_rows: number;
|
|
131
|
+
prepared_flow_rows: number;
|
|
132
|
+
prepared_process_rows: number;
|
|
133
|
+
skipped_unchanged_flow_rows: number;
|
|
134
|
+
rewritten_process_flow_refs: number;
|
|
135
|
+
flow_publish_reports: number;
|
|
136
|
+
process_publish_reports: number;
|
|
137
|
+
success_count: number;
|
|
138
|
+
failure_count: number;
|
|
139
|
+
};
|
|
140
|
+
max_workers: number;
|
|
141
|
+
target_user_id_override: string | null;
|
|
142
|
+
files: FlowReviewedPublishFiles;
|
|
143
|
+
flow_reports: FlowReviewedPublishRowReport[];
|
|
144
|
+
process_reports: FlowReviewedPublishProcessRowReport[];
|
|
145
|
+
skipped_unchanged_flow_rows: SkippedUnchangedFlowRow[];
|
|
146
|
+
};
|
|
147
|
+
export type RunFlowReviewedPublishDataOptions = {
|
|
148
|
+
flowRowsFile?: string | null;
|
|
149
|
+
originalFlowRowsFile?: string | null;
|
|
150
|
+
processRowsFile?: string | null;
|
|
151
|
+
outDir: string;
|
|
152
|
+
flowPublishPolicy?: FlowPublishPolicy;
|
|
153
|
+
processPublishPolicy?: ProcessPublishPolicy;
|
|
154
|
+
rewriteProcessFlowRefs?: boolean;
|
|
155
|
+
commit?: boolean;
|
|
156
|
+
maxWorkers?: number;
|
|
157
|
+
targetUserId?: string | null;
|
|
158
|
+
env?: NodeJS.ProcessEnv;
|
|
159
|
+
fetchImpl?: FetchLike;
|
|
160
|
+
timeoutMs?: number;
|
|
161
|
+
now?: Date;
|
|
162
|
+
validateFlowPayloadImpl?: RunFlowPublishVersionOptions['validateFlowPayloadImpl'];
|
|
163
|
+
runFlowPublishVersionImpl?: (options: RunFlowPublishVersionOptions) => Promise<FlowPublishVersionReport>;
|
|
164
|
+
};
|
|
165
|
+
declare function assert_input_file(inputFile: string, code: string, message?: string): string;
|
|
166
|
+
declare function assert_optional_input_file(inputFile: string | null | undefined, code: string): string | null;
|
|
167
|
+
declare function assert_out_dir(outDir: string): string;
|
|
168
|
+
declare function clone_json<T>(value: T): T;
|
|
169
|
+
declare function json_equal(left: unknown, right: unknown): boolean;
|
|
170
|
+
declare function normalize_publish_policy(value: FlowPublishPolicy | string | undefined, label?: string, code?: string): FlowPublishPolicy;
|
|
171
|
+
declare function bump_ilcd_version(version: string): string;
|
|
172
|
+
declare function set_flow_version(row: JsonRecord, newVersion: string): void;
|
|
173
|
+
declare function process_dataset_from_row(row: JsonRecord): JsonRecord;
|
|
174
|
+
declare function extract_process_identity(row: JsonRecord): ProcessIdentity;
|
|
175
|
+
declare function exchange_records(processRow: JsonRecord): JsonRecord[];
|
|
176
|
+
declare function set_process_version(row: JsonRecord, newVersion: string): void;
|
|
177
|
+
declare function build_flow_index(rows: JsonRecord[]): FlowIndex;
|
|
178
|
+
declare function build_local_dataset_uri(datasetKind: string, uuidValue: string, version: string): string;
|
|
179
|
+
declare function preserve_short_description_shape(existing: unknown, target: JsonRecord): unknown;
|
|
180
|
+
declare function flow_reference_from_record(record: FlowRecord): JsonRecord;
|
|
181
|
+
declare function patched_flow_reference(currentRef: unknown, record: FlowRecord): JsonRecord;
|
|
182
|
+
declare function build_output_files(outDir: string): FlowReviewedPublishFiles;
|
|
183
|
+
declare function status_from_mode(mode: FlowPublishVersionCompatMode, failureCount: number): FlowReviewedPublishDataReport['status'];
|
|
184
|
+
declare function prepare_flow_rows(options: {
|
|
185
|
+
rows: JsonRecord[];
|
|
186
|
+
policy: FlowPublishPolicy;
|
|
187
|
+
originalRows: JsonRecord[];
|
|
188
|
+
}): {
|
|
189
|
+
preparedRows: JsonRecord[];
|
|
190
|
+
plans: PreparedFlowPlan[];
|
|
191
|
+
flowVersionMap: Record<string, FlowVersionMapEntry>;
|
|
192
|
+
skippedUnchangedRows: SkippedUnchangedFlowRow[];
|
|
193
|
+
};
|
|
194
|
+
declare function prepare_process_rows(options: {
|
|
195
|
+
rows: JsonRecord[];
|
|
196
|
+
policy: ProcessPublishPolicy;
|
|
197
|
+
rewriteRefs: boolean;
|
|
198
|
+
preparedFlowRows: JsonRecord[];
|
|
199
|
+
flowVersionMap: Record<string, FlowVersionMapEntry>;
|
|
200
|
+
}): {
|
|
201
|
+
preparedRows: JsonRecord[];
|
|
202
|
+
plans: PreparedProcessPlan[];
|
|
203
|
+
rewriteEvidence: ProcessFlowRefRewriteEvidence[];
|
|
204
|
+
};
|
|
205
|
+
declare function process_publish_payload_from_row(row: JsonRecord): JsonRecord;
|
|
206
|
+
declare function build_process_commit_success_report(plan: PreparedProcessPlan, operation: SupabaseJsonOrderedWriteOperation): FlowReviewedPublishProcessRowReport;
|
|
207
|
+
declare function build_process_commit_failure_report(plan: PreparedProcessPlan, error: unknown): FlowReviewedPublishProcessRowReport;
|
|
208
|
+
declare function normalize_process_commit_failure(error: unknown): unknown;
|
|
209
|
+
declare function shift_queue<T>(queue: Map<string, T[]>, key: string | null): T | null;
|
|
210
|
+
declare function map_with_concurrency<T, R>(items: T[], maxWorkers: number, worker: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
211
|
+
declare function map_commit_reports(plans: PreparedFlowPlan[], successes: FlowPublishSuccessRow[], failures: FlowPublishFailureRow[]): FlowReviewedPublishRowReport[];
|
|
212
|
+
declare function build_compat_report(options: {
|
|
213
|
+
now: Date;
|
|
214
|
+
mode: FlowPublishVersionCompatMode;
|
|
215
|
+
preparedRows: number;
|
|
216
|
+
successCount: number;
|
|
217
|
+
failureCount: number;
|
|
218
|
+
maxWorkers: number;
|
|
219
|
+
targetUserId: string | null;
|
|
220
|
+
files: FlowReviewedPublishFiles;
|
|
221
|
+
}): FlowPublishVersionReport;
|
|
222
|
+
declare function commit_process_plans(options: {
|
|
223
|
+
plans: PreparedProcessPlan[];
|
|
224
|
+
maxWorkers: number;
|
|
225
|
+
env: NodeJS.ProcessEnv;
|
|
226
|
+
fetchImpl: FetchLike;
|
|
227
|
+
timeoutMs?: number;
|
|
228
|
+
}): Promise<FlowReviewedPublishProcessRowReport[]>;
|
|
229
|
+
export declare function runFlowReviewedPublishData(options: RunFlowReviewedPublishDataOptions): Promise<FlowReviewedPublishDataReport>;
|
|
230
|
+
export declare const __testInternals: {
|
|
231
|
+
assert_input_file: typeof assert_input_file;
|
|
232
|
+
assert_optional_input_file: typeof assert_optional_input_file;
|
|
233
|
+
assert_out_dir: typeof assert_out_dir;
|
|
234
|
+
clone_json: typeof clone_json;
|
|
235
|
+
json_equal: typeof json_equal;
|
|
236
|
+
normalize_publish_policy: typeof normalize_publish_policy;
|
|
237
|
+
bump_ilcd_version: typeof bump_ilcd_version;
|
|
238
|
+
set_flow_version: typeof set_flow_version;
|
|
239
|
+
process_dataset_from_row: typeof process_dataset_from_row;
|
|
240
|
+
extract_process_identity: typeof extract_process_identity;
|
|
241
|
+
exchange_records: typeof exchange_records;
|
|
242
|
+
set_process_version: typeof set_process_version;
|
|
243
|
+
build_flow_index: typeof build_flow_index;
|
|
244
|
+
build_local_dataset_uri: typeof build_local_dataset_uri;
|
|
245
|
+
preserve_short_description_shape: typeof preserve_short_description_shape;
|
|
246
|
+
flow_reference_from_record: typeof flow_reference_from_record;
|
|
247
|
+
patched_flow_reference: typeof patched_flow_reference;
|
|
248
|
+
build_output_files: typeof build_output_files;
|
|
249
|
+
status_from_mode: typeof status_from_mode;
|
|
250
|
+
prepare_flow_rows: typeof prepare_flow_rows;
|
|
251
|
+
prepare_process_rows: typeof prepare_process_rows;
|
|
252
|
+
build_compat_report: typeof build_compat_report;
|
|
253
|
+
map_commit_reports: typeof map_commit_reports;
|
|
254
|
+
shift_queue: typeof shift_queue;
|
|
255
|
+
process_publish_payload_from_row: typeof process_publish_payload_from_row;
|
|
256
|
+
build_process_commit_success_report: typeof build_process_commit_success_report;
|
|
257
|
+
build_process_commit_failure_report: typeof build_process_commit_failure_report;
|
|
258
|
+
normalize_process_commit_failure: typeof normalize_process_commit_failure;
|
|
259
|
+
map_with_concurrency: typeof map_with_concurrency;
|
|
260
|
+
commit_process_plans: typeof commit_process_plans;
|
|
261
|
+
};
|
|
262
|
+
export {};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { type DatasetCommandTransport } from './dataset-command.js';
|
|
2
|
+
import { type FlowPayloadValidationIssue, type FlowPayloadValidationResult } from './flow-payload-validation.js';
|
|
3
|
+
import { type JsonRecord } from './flow-governance.js';
|
|
4
|
+
import type { FetchLike, ResponseLike } from './http.js';
|
|
5
|
+
import { createSupabaseDataClient } from './supabase-client.js';
|
|
6
|
+
type FlowPublishMode = 'dry_run' | 'commit';
|
|
7
|
+
type FlowPublishOperation = 'would_insert' | 'would_update_existing' | 'insert' | 'update_existing' | 'update_after_insert_error';
|
|
8
|
+
type FlowPublishFailureReason = {
|
|
9
|
+
validator: 'remote_rest' | 'flow_schema' | 'import_content';
|
|
10
|
+
stage: string;
|
|
11
|
+
path: string;
|
|
12
|
+
message: string;
|
|
13
|
+
code: string;
|
|
14
|
+
visible_user_id?: string;
|
|
15
|
+
visible_state_code?: string;
|
|
16
|
+
};
|
|
17
|
+
type VisibleFlowRow = {
|
|
18
|
+
id: string;
|
|
19
|
+
version: string;
|
|
20
|
+
user_id: string;
|
|
21
|
+
state_code: number | null;
|
|
22
|
+
};
|
|
23
|
+
type SupabaseDataClient = ReturnType<typeof createSupabaseDataClient>['client'];
|
|
24
|
+
type FlowPublishFailureRow = {
|
|
25
|
+
id: unknown;
|
|
26
|
+
user_id: unknown;
|
|
27
|
+
json_ordered: JsonRecord;
|
|
28
|
+
reason: FlowPublishFailureReason[];
|
|
29
|
+
state_code: unknown;
|
|
30
|
+
};
|
|
31
|
+
type FlowPublishSuccessRow = {
|
|
32
|
+
id: string;
|
|
33
|
+
version: string;
|
|
34
|
+
operation: FlowPublishOperation;
|
|
35
|
+
};
|
|
36
|
+
type FlowPublishFiles = {
|
|
37
|
+
successList: string;
|
|
38
|
+
remoteFailed: string;
|
|
39
|
+
gateReport: string;
|
|
40
|
+
report: string;
|
|
41
|
+
};
|
|
42
|
+
type FlowPublishGateFinding = {
|
|
43
|
+
code: string;
|
|
44
|
+
severity: 'blocker';
|
|
45
|
+
methodology_rule_id: string | null;
|
|
46
|
+
message: string;
|
|
47
|
+
path: string;
|
|
48
|
+
dataset_index: number;
|
|
49
|
+
dataset_id: string | null;
|
|
50
|
+
dataset_version: string | null;
|
|
51
|
+
};
|
|
52
|
+
export type FlowPublishVersionGateReport = {
|
|
53
|
+
schema_version: 1;
|
|
54
|
+
generated_at_utc: string;
|
|
55
|
+
status: 'passed' | 'blocked';
|
|
56
|
+
ruleset_id: 'flow-publish/default';
|
|
57
|
+
ruleset_version: '1';
|
|
58
|
+
ruleset_source_version: string;
|
|
59
|
+
ruleset_rule_ids: string[];
|
|
60
|
+
validator: string;
|
|
61
|
+
counts: {
|
|
62
|
+
total: number;
|
|
63
|
+
valid: number;
|
|
64
|
+
invalid: number;
|
|
65
|
+
};
|
|
66
|
+
findings: FlowPublishGateFinding[];
|
|
67
|
+
blockers: FlowPublishGateFinding[];
|
|
68
|
+
next_action: 'query_remote_write_plan' | 'fix_flow_payloads';
|
|
69
|
+
flows: Array<{
|
|
70
|
+
index: number;
|
|
71
|
+
id: string | null;
|
|
72
|
+
version: string | null;
|
|
73
|
+
ok: boolean;
|
|
74
|
+
issue_count: number;
|
|
75
|
+
issues: FlowPayloadValidationIssue[];
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
type FlowPublishOutcome = {
|
|
79
|
+
status: 'success';
|
|
80
|
+
success: FlowPublishSuccessRow;
|
|
81
|
+
} | {
|
|
82
|
+
status: 'failure';
|
|
83
|
+
failure: FlowPublishFailureRow;
|
|
84
|
+
};
|
|
85
|
+
export type FlowPublishVersionReport = {
|
|
86
|
+
schema_version: 1;
|
|
87
|
+
generated_at_utc: string;
|
|
88
|
+
status: 'prepared_flow_publish_version' | 'completed_flow_publish_version' | 'completed_flow_publish_version_with_failures';
|
|
89
|
+
mode: FlowPublishMode;
|
|
90
|
+
input_file: string;
|
|
91
|
+
out_dir: string;
|
|
92
|
+
counts: {
|
|
93
|
+
total_rows: number;
|
|
94
|
+
success_count: number;
|
|
95
|
+
failure_count: number;
|
|
96
|
+
};
|
|
97
|
+
flow_gate: {
|
|
98
|
+
status: FlowPublishVersionGateReport['status'];
|
|
99
|
+
ruleset_id: FlowPublishVersionGateReport['ruleset_id'];
|
|
100
|
+
ruleset_version: FlowPublishVersionGateReport['ruleset_version'];
|
|
101
|
+
counts: FlowPublishVersionGateReport['counts'];
|
|
102
|
+
blocker_count: number;
|
|
103
|
+
next_action: FlowPublishVersionGateReport['next_action'];
|
|
104
|
+
};
|
|
105
|
+
operation_counts: Record<string, number>;
|
|
106
|
+
max_workers: number;
|
|
107
|
+
limit: number | null;
|
|
108
|
+
target_user_id_override: string | null;
|
|
109
|
+
files: {
|
|
110
|
+
success_list: string;
|
|
111
|
+
remote_failed: string;
|
|
112
|
+
gate_report: string;
|
|
113
|
+
report: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export type RunFlowPublishVersionOptions = {
|
|
117
|
+
inputFile: string;
|
|
118
|
+
outDir: string;
|
|
119
|
+
commit?: boolean;
|
|
120
|
+
maxWorkers?: number;
|
|
121
|
+
limit?: number;
|
|
122
|
+
targetUserId?: string | null;
|
|
123
|
+
env?: NodeJS.ProcessEnv;
|
|
124
|
+
fetchImpl?: FetchLike;
|
|
125
|
+
timeoutMs?: number;
|
|
126
|
+
now?: Date;
|
|
127
|
+
validateFlowPayloadImpl?: (payload: JsonRecord) => FlowPayloadValidationResult;
|
|
128
|
+
};
|
|
129
|
+
declare function assert_input_file(inputFile: string): string;
|
|
130
|
+
declare function assert_out_dir(outDir: string): string;
|
|
131
|
+
declare function to_positive_integer(value: number | undefined, label: string, code: string, defaultValue: number): number;
|
|
132
|
+
declare function to_non_negative_integer(value: number | undefined, label: string, code: string): number | null;
|
|
133
|
+
declare function build_output_files(outDir: string): FlowPublishFiles;
|
|
134
|
+
declare function flow_payload(row: JsonRecord): JsonRecord;
|
|
135
|
+
declare function flow_id(row: JsonRecord, payload: JsonRecord): string;
|
|
136
|
+
declare function flow_version(payload: JsonRecord): string;
|
|
137
|
+
declare function flow_version_gate_result(payload: JsonRecord): {
|
|
138
|
+
version: string | null;
|
|
139
|
+
issue: FlowPayloadValidationIssue | null;
|
|
140
|
+
};
|
|
141
|
+
declare function validate_publish_flow_row(row: JsonRecord, index: number, validate: (payload: JsonRecord) => FlowPayloadValidationResult): FlowPublishVersionGateReport['flows'][number];
|
|
142
|
+
declare function build_flow_publish_gate_report(rows: JsonRecord[], options: {
|
|
143
|
+
now: Date;
|
|
144
|
+
validateFlowPayloadImpl?: (payload: JsonRecord) => FlowPayloadValidationResult;
|
|
145
|
+
}): FlowPublishVersionGateReport;
|
|
146
|
+
declare function flow_gate_summary(gate: FlowPublishVersionGateReport): FlowPublishVersionReport['flow_gate'];
|
|
147
|
+
declare function gate_failure_rows(rows: JsonRecord[], gate: FlowPublishVersionGateReport): FlowPublishFailureRow[];
|
|
148
|
+
declare function resolve_target_user_id(row: JsonRecord, targetUserIdOverride: string | null): string | null;
|
|
149
|
+
declare function build_visible_rows_url(restBaseUrl: string, id: string, version: string): string;
|
|
150
|
+
declare function build_update_url(restBaseUrl: string, id: string, version: string): string;
|
|
151
|
+
declare function parse_response(response: ResponseLike, url: string): Promise<unknown>;
|
|
152
|
+
declare function parse_visible_rows(payload: unknown, url: string): VisibleFlowRow[];
|
|
153
|
+
declare function visible_conflict_reasons(stage: string, visibleRows: VisibleFlowRow[], targetUserId: string | null): FlowPublishFailureReason[];
|
|
154
|
+
declare function failure_row(sourceRow: JsonRecord, reasons: FlowPublishFailureReason[]): FlowPublishFailureRow;
|
|
155
|
+
declare function build_error_reasons(stage: string, error: unknown): FlowPublishFailureReason[];
|
|
156
|
+
declare function sync_one_row(options: {
|
|
157
|
+
row: JsonRecord;
|
|
158
|
+
mode: FlowPublishMode;
|
|
159
|
+
client: SupabaseDataClient;
|
|
160
|
+
restBaseUrl: string;
|
|
161
|
+
commandTransport: DatasetCommandTransport;
|
|
162
|
+
targetUserIdOverride: string | null;
|
|
163
|
+
}): Promise<FlowPublishOutcome>;
|
|
164
|
+
declare function map_with_concurrency<T, R>(items: T[], maxWorkers: number, worker: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
165
|
+
declare function status_from_mode(mode: FlowPublishMode, failureCount: number): FlowPublishVersionReport['status'];
|
|
166
|
+
export declare function runFlowPublishVersion(options: RunFlowPublishVersionOptions): Promise<FlowPublishVersionReport>;
|
|
167
|
+
export declare const __testInternals: {
|
|
168
|
+
assert_input_file: typeof assert_input_file;
|
|
169
|
+
assert_out_dir: typeof assert_out_dir;
|
|
170
|
+
to_positive_integer: typeof to_positive_integer;
|
|
171
|
+
to_non_negative_integer: typeof to_non_negative_integer;
|
|
172
|
+
build_output_files: typeof build_output_files;
|
|
173
|
+
flow_payload: typeof flow_payload;
|
|
174
|
+
flow_id: typeof flow_id;
|
|
175
|
+
flow_version: typeof flow_version;
|
|
176
|
+
flow_version_gate_result: typeof flow_version_gate_result;
|
|
177
|
+
validate_publish_flow_row: typeof validate_publish_flow_row;
|
|
178
|
+
build_flow_publish_gate_report: typeof build_flow_publish_gate_report;
|
|
179
|
+
flow_gate_summary: typeof flow_gate_summary;
|
|
180
|
+
gate_failure_rows: typeof gate_failure_rows;
|
|
181
|
+
sync_one_row: typeof sync_one_row;
|
|
182
|
+
resolve_target_user_id: typeof resolve_target_user_id;
|
|
183
|
+
build_visible_rows_url: typeof build_visible_rows_url;
|
|
184
|
+
build_update_url: typeof build_update_url;
|
|
185
|
+
parse_response: typeof parse_response;
|
|
186
|
+
parse_visible_rows: typeof parse_visible_rows;
|
|
187
|
+
visible_conflict_reasons: typeof visible_conflict_reasons;
|
|
188
|
+
failure_row: typeof failure_row;
|
|
189
|
+
build_error_reasons: typeof build_error_reasons;
|
|
190
|
+
map_with_concurrency: typeof map_with_concurrency;
|
|
191
|
+
status_from_mode: typeof status_from_mode;
|
|
192
|
+
};
|
|
193
|
+
export {};
|