@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,109 @@
|
|
|
1
|
+
import type { FetchLike } from './http.js';
|
|
2
|
+
type JsonObject = Record<string, unknown>;
|
|
3
|
+
export type DigitalFileRefKind = 'local' | 'remote' | 'empty';
|
|
4
|
+
export type DigitalFileReference = {
|
|
5
|
+
source_id: string | null;
|
|
6
|
+
source_version: string | null;
|
|
7
|
+
original_uri: string;
|
|
8
|
+
kind: DigitalFileRefKind;
|
|
9
|
+
resolved_file: string | null;
|
|
10
|
+
bucket_key: string | null;
|
|
11
|
+
rewritten_uri: string | null;
|
|
12
|
+
status: 'rewritten' | 'left_as_is' | 'unresolved';
|
|
13
|
+
};
|
|
14
|
+
export type AttachmentFileReport = {
|
|
15
|
+
bucket_key: string;
|
|
16
|
+
source_path: string;
|
|
17
|
+
size_bytes: number;
|
|
18
|
+
content_type: string;
|
|
19
|
+
referenced_by: string[];
|
|
20
|
+
status: 'planned' | 'uploaded' | 'verified' | 'failed';
|
|
21
|
+
error: string | null;
|
|
22
|
+
};
|
|
23
|
+
export type DatasetSourceUploadAttachmentsReport = {
|
|
24
|
+
schema_version: 1;
|
|
25
|
+
generated_at_utc: string;
|
|
26
|
+
status: 'planned_attachment_upload' | 'uploaded_attachments' | 'completed_with_failures' | 'completed_with_unresolved_refs';
|
|
27
|
+
mode: 'dry-run' | 'commit';
|
|
28
|
+
bucket: string;
|
|
29
|
+
external_docs_dir: string;
|
|
30
|
+
summary: {
|
|
31
|
+
sources_scanned: number;
|
|
32
|
+
local_refs: number;
|
|
33
|
+
remote_refs: number;
|
|
34
|
+
unresolved_refs: number;
|
|
35
|
+
files_planned: number;
|
|
36
|
+
files_uploaded: number;
|
|
37
|
+
files_failed: number;
|
|
38
|
+
sources_rewritten: number;
|
|
39
|
+
};
|
|
40
|
+
files: AttachmentFileReport[];
|
|
41
|
+
references: DigitalFileReference[];
|
|
42
|
+
artifacts: {
|
|
43
|
+
report: string;
|
|
44
|
+
rewritten_sources: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type RunDatasetSourceUploadAttachmentsOptions = {
|
|
48
|
+
inputPath: string;
|
|
49
|
+
externalDocsDir: string;
|
|
50
|
+
outDir?: string | null;
|
|
51
|
+
bucket?: string | null;
|
|
52
|
+
commit?: boolean;
|
|
53
|
+
verify?: boolean;
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
env: NodeJS.ProcessEnv;
|
|
56
|
+
fetchImpl: FetchLike;
|
|
57
|
+
now?: Date;
|
|
58
|
+
};
|
|
59
|
+
declare function trimToken(value: unknown): string | null;
|
|
60
|
+
declare function caughtErrorMessage(error: unknown): string;
|
|
61
|
+
declare function normalizeTimeoutMs(value: number | undefined): number;
|
|
62
|
+
export declare function classifyDigitalFileUri(uri: unknown): DigitalFileRefKind;
|
|
63
|
+
export declare function digitalFileBasename(uri: string): string;
|
|
64
|
+
export declare function mimeTypeForFile(fileName: string): string;
|
|
65
|
+
declare function buildExternalDocsIndex(externalDocsDir: string): Map<string, string>;
|
|
66
|
+
declare function digitalFileNode(row: JsonObject): JsonObject | null;
|
|
67
|
+
declare function sourceIdentity(row: JsonObject): {
|
|
68
|
+
id: string | null;
|
|
69
|
+
version: string | null;
|
|
70
|
+
};
|
|
71
|
+
declare function entryUri(entry: unknown): string;
|
|
72
|
+
declare function withRewrittenUri(entry: unknown, rewrittenUri: string): unknown;
|
|
73
|
+
export type ResolvedReference = {
|
|
74
|
+
reference: DigitalFileReference;
|
|
75
|
+
entryIndex: number;
|
|
76
|
+
};
|
|
77
|
+
declare function resolveReferences(identity: {
|
|
78
|
+
id: string | null;
|
|
79
|
+
version: string | null;
|
|
80
|
+
}, entries: unknown[], fileIndex: Map<string, string>, bucket: string): ResolvedReference[];
|
|
81
|
+
export declare function digitalFileEntries(value: unknown): unknown[];
|
|
82
|
+
declare function rewriteDigitalFileValue(value: unknown, resolved: ResolvedReference[]): unknown;
|
|
83
|
+
declare function loadSourceRows(inputPath: string): {
|
|
84
|
+
path: string;
|
|
85
|
+
row: JsonObject;
|
|
86
|
+
}[];
|
|
87
|
+
declare function parseJson(text: string, file: string): unknown;
|
|
88
|
+
declare function parseRowObject(text: string, file: string): JsonObject;
|
|
89
|
+
export declare function runDatasetSourceUploadAttachments(options: RunDatasetSourceUploadAttachmentsOptions): Promise<DatasetSourceUploadAttachmentsReport>;
|
|
90
|
+
export declare const __testInternals: {
|
|
91
|
+
buildExternalDocsIndex: typeof buildExternalDocsIndex;
|
|
92
|
+
caughtErrorMessage: typeof caughtErrorMessage;
|
|
93
|
+
classifyDigitalFileUri: typeof classifyDigitalFileUri;
|
|
94
|
+
digitalFileBasename: typeof digitalFileBasename;
|
|
95
|
+
digitalFileEntries: typeof digitalFileEntries;
|
|
96
|
+
digitalFileNode: typeof digitalFileNode;
|
|
97
|
+
entryUri: typeof entryUri;
|
|
98
|
+
loadSourceRows: typeof loadSourceRows;
|
|
99
|
+
mimeTypeForFile: typeof mimeTypeForFile;
|
|
100
|
+
normalizeTimeoutMs: typeof normalizeTimeoutMs;
|
|
101
|
+
parseJson: typeof parseJson;
|
|
102
|
+
parseRowObject: typeof parseRowObject;
|
|
103
|
+
resolveReferences: typeof resolveReferences;
|
|
104
|
+
rewriteDigitalFileValue: typeof rewriteDigitalFileValue;
|
|
105
|
+
sourceIdentity: typeof sourceIdentity;
|
|
106
|
+
trimToken: typeof trimToken;
|
|
107
|
+
withRewrittenUri: typeof withRewrittenUri;
|
|
108
|
+
};
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type DatasetKind, type DatasetRowInput } from './dataset-local.js';
|
|
2
|
+
import { type SafeParseSchema, type SdkValidationFactory } from './tidas-sdk-validation.js';
|
|
3
|
+
type DatasetValidateType = 'auto' | DatasetKind;
|
|
4
|
+
export type DatasetValidateIssue = {
|
|
5
|
+
path: string;
|
|
6
|
+
message: string;
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
export type DatasetValidateRowReport = {
|
|
10
|
+
index: number;
|
|
11
|
+
id: string | null;
|
|
12
|
+
version: string | null;
|
|
13
|
+
type: DatasetKind | null;
|
|
14
|
+
status: 'valid' | 'invalid';
|
|
15
|
+
validator: string | null;
|
|
16
|
+
issue_count: number;
|
|
17
|
+
issues: DatasetValidateIssue[];
|
|
18
|
+
};
|
|
19
|
+
export type DatasetValidateReport = {
|
|
20
|
+
generated_at_utc: string;
|
|
21
|
+
input_path: string;
|
|
22
|
+
requested_type: DatasetValidateType;
|
|
23
|
+
status: 'completed' | 'completed_with_failures';
|
|
24
|
+
counts: {
|
|
25
|
+
total: number;
|
|
26
|
+
valid: number;
|
|
27
|
+
invalid: number;
|
|
28
|
+
by_type: Record<DatasetKind, number>;
|
|
29
|
+
};
|
|
30
|
+
files: {
|
|
31
|
+
report: string | null;
|
|
32
|
+
valid_rows: string | null;
|
|
33
|
+
invalid_rows: string | null;
|
|
34
|
+
};
|
|
35
|
+
rows: DatasetValidateRowReport[];
|
|
36
|
+
};
|
|
37
|
+
export type RunDatasetValidateOptions = {
|
|
38
|
+
inputPath: string;
|
|
39
|
+
type?: string | null;
|
|
40
|
+
outDir?: string | null;
|
|
41
|
+
rawInput?: unknown;
|
|
42
|
+
now?: Date;
|
|
43
|
+
schemas?: Partial<Record<DatasetKind, SafeParseSchema>>;
|
|
44
|
+
};
|
|
45
|
+
export declare function collectImportContentIssues(payload: unknown): DatasetValidateIssue[];
|
|
46
|
+
declare function normalizeType(value: string | null | undefined): DatasetValidateType;
|
|
47
|
+
declare function schemaForKind(kind: DatasetKind, schemas: Partial<Record<DatasetKind, SafeParseSchema>> | undefined): {
|
|
48
|
+
validator: string;
|
|
49
|
+
schema: SafeParseSchema;
|
|
50
|
+
createEntity: SdkValidationFactory | null;
|
|
51
|
+
};
|
|
52
|
+
declare function validateRow(row: DatasetRowInput, requestedType: DatasetValidateType, schemas: Partial<Record<DatasetKind, SafeParseSchema>> | undefined): DatasetValidateRowReport;
|
|
53
|
+
export declare function runDatasetValidate(options: RunDatasetValidateOptions): Promise<DatasetValidateReport>;
|
|
54
|
+
export declare const __testInternals: {
|
|
55
|
+
ENTITY_FACTORY_EXPORTS: Record<DatasetKind, "CAS_NUMBER_CHECKSUM_ERROR_CODE" | "CAS_NUMBER_PATTERN" | "CHINESE_CHARACTER_RE" | "ContactCategorySchema" | "ContactSchema" | "DEFAULT_VALIDATION_CONFIG" | "DEFAULT_XML_PARSE_OPTIONS" | "DEFAULT_XML_UNPARSE_OPTIONS" | "ErrorSeverity" | "FlowElementaryCategorySchema" | "FlowProductCategorySchema" | "FlowPropertyCategorySchema" | "FlowPropertySchema" | "FlowSchema" | "LCIAMethodCategorySchema" | "LCIAMethodSchema" | "LifeCycleModelSchema" | "LocationCategorySchema" | "ProcessCategorySchema" | "ProcessSchema" | "SUPPORTED_CATEGORIES" | "SourceCategorySchema" | "SourceSchema" | "TIDAS_LANGUAGE_CODES" | "TIDAS_LANGUAGE_CODE_SET" | "TidasContact" | "TidasEntity" | "TidasFlow" | "TidasFlowProperty" | "TidasLCIAMethod" | "TidasLifeCycleModel" | "TidasProcess" | "TidasSource" | "TidasUnitGroup" | "UnitGroupCategorySchema" | "UnitGroupSchema" | "ValidationUtils" | "batchSuggest" | "buildCategoryReport" | "buildPackageReport" | "categoryValidate" | "collectClassificationIssues" | "collectFlowSchemaGapIssues" | "collectLocalizedTextIssues" | "compareMethodologyWithSchema" | "convertDirectory" | "convertFormat" | "copyEilcdAssets" | "copyRuntimeAssetDir" | "copyTidasAssets" | "createContact" | "createContactFromJSON" | "createContactsBatch" | "createFlow" | "createFlowFromJSON" | "createFlowPropertiesBatch" | "createFlowProperty" | "createFlowPropertyFromJSON" | "createFlowsBatch" | "createLCIAMethod" | "createLCIAMethodFromJSON" | "createLCIAMethodsBatch" | "createLifeCycleModel" | "createLifeCycleModelFromJSON" | "createLifeCycleModelsBatch" | "createProcess" | "createProcessFromJSON" | "createProcessesBatch" | "createSource" | "createSourceFromJSON" | "createSourcesBatch" | "createStaticValidationMethod" | "createTidasEntity" | "createUnitGroup" | "createUnitGroupFromJSON" | "createUnitGroupsBatch" | "createValidationMethod" | "datasetFromXml" | "datasetToXml" | "deepClone" | "default" | "extractMethodologyPaths" | "extractSchemaPaths" | "get" | "getAvailableDataTypes" | "getAvailableTidasContractKinds" | "getGlobalValidationConfig" | "getGlobalValidationMode" | "getTidasContractPack" | "getTidasMethodologyData" | "getTidasMethodologyText" | "getTidasRuntimeRuleset" | "getTidasSchemaData" | "getTidasSchemaText" | "globalConfig" | "isValidCASNumber" | "loadConfigFromEnvironment" | "merge" | "normalizeMethodologyPath" | "normalizeTidasContractKind" | "parseWithZod" | "parseXml" | "resetGlobalConfig" | "resolveRuntimeAssetDir" | "resolveRuntimeAssetsDir" | "set" | "setGlobalValidationConfig" | "setGlobalValidationMode" | "suggestData" | "suggestRawData" | "summarizeIssues" | "unparseXml" | "updatePath" | "validateBatch" | "validateBundledMethodologies" | "validateElementaryFlowsClassificationHierarchy" | "validateLocalizedTextLanguageConstraints" | "validateMethodologySchemaParity" | "validatePackageDir" | "validateProcessesClassificationHierarchy" | "validateProductFlowsClassificationHierarchy" | "validateSourcesClassificationHierarchy" | "validateSuggestionApiKey" | "validateWithZod">;
|
|
56
|
+
SCHEMA_EXPORTS: Record<DatasetKind, "CAS_NUMBER_CHECKSUM_ERROR_CODE" | "CAS_NUMBER_PATTERN" | "CHINESE_CHARACTER_RE" | "ContactCategorySchema" | "ContactSchema" | "DEFAULT_VALIDATION_CONFIG" | "DEFAULT_XML_PARSE_OPTIONS" | "DEFAULT_XML_UNPARSE_OPTIONS" | "ErrorSeverity" | "FlowElementaryCategorySchema" | "FlowProductCategorySchema" | "FlowPropertyCategorySchema" | "FlowPropertySchema" | "FlowSchema" | "LCIAMethodCategorySchema" | "LCIAMethodSchema" | "LifeCycleModelSchema" | "LocationCategorySchema" | "ProcessCategorySchema" | "ProcessSchema" | "SUPPORTED_CATEGORIES" | "SourceCategorySchema" | "SourceSchema" | "TIDAS_LANGUAGE_CODES" | "TIDAS_LANGUAGE_CODE_SET" | "TidasContact" | "TidasEntity" | "TidasFlow" | "TidasFlowProperty" | "TidasLCIAMethod" | "TidasLifeCycleModel" | "TidasProcess" | "TidasSource" | "TidasUnitGroup" | "UnitGroupCategorySchema" | "UnitGroupSchema" | "ValidationUtils" | "batchSuggest" | "buildCategoryReport" | "buildPackageReport" | "categoryValidate" | "collectClassificationIssues" | "collectFlowSchemaGapIssues" | "collectLocalizedTextIssues" | "compareMethodologyWithSchema" | "convertDirectory" | "convertFormat" | "copyEilcdAssets" | "copyRuntimeAssetDir" | "copyTidasAssets" | "createContact" | "createContactFromJSON" | "createContactsBatch" | "createFlow" | "createFlowFromJSON" | "createFlowPropertiesBatch" | "createFlowProperty" | "createFlowPropertyFromJSON" | "createFlowsBatch" | "createLCIAMethod" | "createLCIAMethodFromJSON" | "createLCIAMethodsBatch" | "createLifeCycleModel" | "createLifeCycleModelFromJSON" | "createLifeCycleModelsBatch" | "createProcess" | "createProcessFromJSON" | "createProcessesBatch" | "createSource" | "createSourceFromJSON" | "createSourcesBatch" | "createStaticValidationMethod" | "createTidasEntity" | "createUnitGroup" | "createUnitGroupFromJSON" | "createUnitGroupsBatch" | "createValidationMethod" | "datasetFromXml" | "datasetToXml" | "deepClone" | "default" | "extractMethodologyPaths" | "extractSchemaPaths" | "get" | "getAvailableDataTypes" | "getAvailableTidasContractKinds" | "getGlobalValidationConfig" | "getGlobalValidationMode" | "getTidasContractPack" | "getTidasMethodologyData" | "getTidasMethodologyText" | "getTidasRuntimeRuleset" | "getTidasSchemaData" | "getTidasSchemaText" | "globalConfig" | "isValidCASNumber" | "loadConfigFromEnvironment" | "merge" | "normalizeMethodologyPath" | "normalizeTidasContractKind" | "parseWithZod" | "parseXml" | "resetGlobalConfig" | "resolveRuntimeAssetDir" | "resolveRuntimeAssetsDir" | "set" | "setGlobalValidationConfig" | "setGlobalValidationMode" | "suggestData" | "suggestRawData" | "summarizeIssues" | "unparseXml" | "updatePath" | "validateBatch" | "validateBundledMethodologies" | "validateElementaryFlowsClassificationHierarchy" | "validateLocalizedTextLanguageConstraints" | "validateMethodologySchemaParity" | "validatePackageDir" | "validateProcessesClassificationHierarchy" | "validateProductFlowsClassificationHierarchy" | "validateSourcesClassificationHierarchy" | "validateSuggestionApiKey" | "validateWithZod">;
|
|
57
|
+
collectImportContentIssues: typeof collectImportContentIssues;
|
|
58
|
+
normalizeType: typeof normalizeType;
|
|
59
|
+
schemaForKind: typeof schemaForKind;
|
|
60
|
+
validateRow: typeof validateRow;
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type EnvSpec = {
|
|
2
|
+
key: string;
|
|
3
|
+
required: boolean;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
};
|
|
7
|
+
export type ResolvedEnv = {
|
|
8
|
+
key: string;
|
|
9
|
+
source: 'env' | 'default' | 'missing';
|
|
10
|
+
value: string | null;
|
|
11
|
+
present: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const ENV_KEYS: {
|
|
14
|
+
readonly apiBaseUrl: 'TIANGONG_LCA_API_BASE_URL';
|
|
15
|
+
readonly apiKey: 'TIANGONG_LCA_API_KEY';
|
|
16
|
+
readonly region: 'TIANGONG_LCA_REGION';
|
|
17
|
+
readonly supabasePublishableKey: 'TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY';
|
|
18
|
+
readonly sessionFile: 'TIANGONG_LCA_SESSION_FILE';
|
|
19
|
+
readonly disableSessionCache: 'TIANGONG_LCA_DISABLE_SESSION_CACHE';
|
|
20
|
+
readonly forceReauth: 'TIANGONG_LCA_FORCE_REAUTH';
|
|
21
|
+
};
|
|
22
|
+
export declare const ENV_SPECS: EnvSpec[];
|
|
23
|
+
export type DoctorCheck = {
|
|
24
|
+
key: string;
|
|
25
|
+
description: string;
|
|
26
|
+
required: boolean;
|
|
27
|
+
source: ResolvedEnv['source'];
|
|
28
|
+
present: boolean;
|
|
29
|
+
valuePreview: string | null;
|
|
30
|
+
};
|
|
31
|
+
export type DoctorReport = {
|
|
32
|
+
ok: boolean;
|
|
33
|
+
loadedDotEnv: boolean;
|
|
34
|
+
dotEnvPath: string;
|
|
35
|
+
dotEnvKeysLoaded: number;
|
|
36
|
+
checks: DoctorCheck[];
|
|
37
|
+
};
|
|
38
|
+
export type RuntimeEnv = {
|
|
39
|
+
apiBaseUrl: string | null;
|
|
40
|
+
apiKey: string | null;
|
|
41
|
+
region: string;
|
|
42
|
+
supabasePublishableKey: string | null;
|
|
43
|
+
sessionFile: string | null;
|
|
44
|
+
disableSessionCache: boolean;
|
|
45
|
+
forceReauth: boolean;
|
|
46
|
+
};
|
|
47
|
+
declare function parseBooleanEnv(value: string | null): boolean;
|
|
48
|
+
export declare function resolveEnv(spec: EnvSpec, env: NodeJS.ProcessEnv): ResolvedEnv;
|
|
49
|
+
export declare function readRuntimeEnv(env: NodeJS.ProcessEnv): RuntimeEnv;
|
|
50
|
+
export declare function maskSecret(value: string | null): string | null;
|
|
51
|
+
export declare function buildDoctorReport(env: NodeJS.ProcessEnv, dotEnvStatus: {
|
|
52
|
+
loaded: boolean;
|
|
53
|
+
path: string;
|
|
54
|
+
count: number;
|
|
55
|
+
}): DoctorReport;
|
|
56
|
+
export declare const __testInternals: {
|
|
57
|
+
parseBooleanEnv: typeof parseBooleanEnv;
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class CliError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly exitCode: number;
|
|
4
|
+
readonly details?: unknown;
|
|
5
|
+
constructor(message: string, options?: {
|
|
6
|
+
code?: string;
|
|
7
|
+
exitCode?: number;
|
|
8
|
+
details?: unknown;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export type ErrorPayload = {
|
|
12
|
+
error: {
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
details?: unknown;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function toErrorPayload(error: unknown): ErrorPayload;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type FlowRecord, type JsonRecord } from './flow-governance.js';
|
|
2
|
+
type FlowIndex = {
|
|
3
|
+
records: FlowRecord[];
|
|
4
|
+
byUuid: Record<string, FlowRecord[]>;
|
|
5
|
+
byUuidVersion: Record<string, FlowRecord>;
|
|
6
|
+
byName: Record<string, FlowRecord[]>;
|
|
7
|
+
};
|
|
8
|
+
export type FlowBuildAliasMapFiles = {
|
|
9
|
+
out_dir: string;
|
|
10
|
+
alias_plan: string;
|
|
11
|
+
alias_plan_jsonl: string;
|
|
12
|
+
flow_alias_map: string;
|
|
13
|
+
manual_review_queue: string;
|
|
14
|
+
summary: string;
|
|
15
|
+
};
|
|
16
|
+
export type FlowBuildAliasMapSummary = {
|
|
17
|
+
old_flow_count: number;
|
|
18
|
+
new_flow_count: number;
|
|
19
|
+
alias_entries_versioned: number;
|
|
20
|
+
alias_entries_uuid_only: number;
|
|
21
|
+
manual_review_count: number;
|
|
22
|
+
decision_counts: Record<string, number>;
|
|
23
|
+
};
|
|
24
|
+
export type FlowAliasPlanAction = {
|
|
25
|
+
old_flow_id: string;
|
|
26
|
+
old_flow_version: string;
|
|
27
|
+
old_flow_name: string;
|
|
28
|
+
old_flow_type: string;
|
|
29
|
+
decision: 'no_alias_needed' | 'alias_map_entry' | 'manual_review';
|
|
30
|
+
reason: string;
|
|
31
|
+
target_flow_id?: string;
|
|
32
|
+
target_flow_version?: string;
|
|
33
|
+
target_flow_name?: string;
|
|
34
|
+
target_flow_type?: string;
|
|
35
|
+
candidate_refs?: Array<Record<string, string>>;
|
|
36
|
+
};
|
|
37
|
+
export type FlowBuildAliasMapReport = {
|
|
38
|
+
schema_version: 1;
|
|
39
|
+
generated_at_utc: string;
|
|
40
|
+
status: 'completed_local_flow_build_alias_map';
|
|
41
|
+
old_flow_files: string[];
|
|
42
|
+
new_flow_files: string[];
|
|
43
|
+
seed_alias_map_file: string | null;
|
|
44
|
+
out_dir: string;
|
|
45
|
+
summary: FlowBuildAliasMapSummary;
|
|
46
|
+
files: FlowBuildAliasMapFiles;
|
|
47
|
+
};
|
|
48
|
+
export type RunFlowBuildAliasMapOptions = {
|
|
49
|
+
oldFlowFiles: string[];
|
|
50
|
+
newFlowFiles: string[];
|
|
51
|
+
seedAliasMapFile?: string | null;
|
|
52
|
+
outDir: string;
|
|
53
|
+
};
|
|
54
|
+
type FlowBuildAliasMapDeps = {
|
|
55
|
+
now?: () => Date;
|
|
56
|
+
};
|
|
57
|
+
declare function assertInputFile(inputFile: string, requiredCode: string, missingCode: string): string;
|
|
58
|
+
declare function assertInputFiles(inputFiles: string[], requiredCode: string, missingCode: string): string[];
|
|
59
|
+
declare function assertOutDir(outDir: string): string;
|
|
60
|
+
declare function readJsonObjectFile(filePath: string, requiredCode: string, missingCode: string, invalidCode: string): JsonRecord;
|
|
61
|
+
declare function buildFlowIndex(rows: JsonRecord[]): FlowIndex;
|
|
62
|
+
declare function aliasLookup(aliasMap: JsonRecord, flowUuid: string, flowVersion: string | null): JsonRecord | null;
|
|
63
|
+
declare function candidateRef(record: FlowRecord, includeType?: boolean): Record<string, string>;
|
|
64
|
+
declare function planAlias(oldRecord: FlowRecord, newIndex: FlowIndex, seedAliasMap: JsonRecord): FlowAliasPlanAction;
|
|
65
|
+
declare function buildDecisionCounts(actions: FlowAliasPlanAction[]): Record<string, number>;
|
|
66
|
+
declare function buildOutputFiles(outDir: string): FlowBuildAliasMapFiles;
|
|
67
|
+
export declare function runFlowBuildAliasMap(options: RunFlowBuildAliasMapOptions, deps?: FlowBuildAliasMapDeps): Promise<FlowBuildAliasMapReport>;
|
|
68
|
+
export declare const __testInternals: {
|
|
69
|
+
assertInputFile: typeof assertInputFile;
|
|
70
|
+
assertInputFiles: typeof assertInputFiles;
|
|
71
|
+
assertOutDir: typeof assertOutDir;
|
|
72
|
+
readJsonObjectFile: typeof readJsonObjectFile;
|
|
73
|
+
buildFlowIndex: typeof buildFlowIndex;
|
|
74
|
+
aliasLookup: typeof aliasLookup;
|
|
75
|
+
candidateRef: typeof candidateRef;
|
|
76
|
+
planAlias: typeof planAlias;
|
|
77
|
+
buildDecisionCounts: typeof buildDecisionCounts;
|
|
78
|
+
buildOutputFiles: typeof buildOutputFiles;
|
|
79
|
+
};
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type JsonRecord } from './flow-governance.js';
|
|
2
|
+
import type { FetchLike } from './http.js';
|
|
3
|
+
import { type SupabaseFlowLookup } from './flow-read.js';
|
|
4
|
+
type FlowFetchRef = {
|
|
5
|
+
id: string;
|
|
6
|
+
version: string | null;
|
|
7
|
+
userId: string | null;
|
|
8
|
+
stateCode: number | null;
|
|
9
|
+
clusterId: string | null;
|
|
10
|
+
source: string | null;
|
|
11
|
+
};
|
|
12
|
+
type FlowFetchMaterializationContext = {
|
|
13
|
+
input_index: number;
|
|
14
|
+
requested_ref: {
|
|
15
|
+
id: string;
|
|
16
|
+
version: string | null;
|
|
17
|
+
user_id: string | null;
|
|
18
|
+
state_code: number | null;
|
|
19
|
+
cluster_id: string | null;
|
|
20
|
+
source: string | null;
|
|
21
|
+
};
|
|
22
|
+
resolution: SupabaseFlowLookup['resolution'];
|
|
23
|
+
source_url: string;
|
|
24
|
+
resolved_flow_id: string;
|
|
25
|
+
resolved_version: string;
|
|
26
|
+
};
|
|
27
|
+
type FlowFetchSummaryStatus = 'completed_flow_row_materialization' | 'completed_flow_row_materialization_with_gaps';
|
|
28
|
+
export type RunFlowFetchRowsOptions = {
|
|
29
|
+
refsFile: string;
|
|
30
|
+
outDir: string;
|
|
31
|
+
allowLatestFallback?: boolean;
|
|
32
|
+
env?: NodeJS.ProcessEnv;
|
|
33
|
+
fetchImpl?: FetchLike;
|
|
34
|
+
timeoutMs?: number;
|
|
35
|
+
now?: Date;
|
|
36
|
+
};
|
|
37
|
+
export type FlowFetchRowsReport = {
|
|
38
|
+
schema_version: 1;
|
|
39
|
+
generated_at_utc: string;
|
|
40
|
+
status: FlowFetchSummaryStatus;
|
|
41
|
+
refs_file: string;
|
|
42
|
+
out_dir: string;
|
|
43
|
+
allow_latest_fallback: boolean;
|
|
44
|
+
requested_ref_count: number;
|
|
45
|
+
resolved_ref_count: number;
|
|
46
|
+
qa_input_row_count: number;
|
|
47
|
+
duplicate_qa_input_rows_collapsed: number;
|
|
48
|
+
missing_ref_count: number;
|
|
49
|
+
ambiguous_ref_count: number;
|
|
50
|
+
resolution_counts: Record<SupabaseFlowLookup['resolution'], number>;
|
|
51
|
+
files: {
|
|
52
|
+
resolved_flow_rows: string;
|
|
53
|
+
qa_input_rows: string;
|
|
54
|
+
fetch_summary: string;
|
|
55
|
+
missing_flow_refs: string;
|
|
56
|
+
ambiguous_flow_refs: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
declare function normalizeToken(value: unknown): string | null;
|
|
60
|
+
declare function normalizeOptionalNonNegativeInteger(value: unknown, label: string, code: string): number | null;
|
|
61
|
+
declare function normalizeFlowFetchRef(row: JsonRecord, index: number): FlowFetchRef;
|
|
62
|
+
declare function toRequestedRefSummary(ref: FlowFetchRef): FlowFetchMaterializationContext['requested_ref'];
|
|
63
|
+
export declare function runFlowFetchRows(options: RunFlowFetchRowsOptions): Promise<FlowFetchRowsReport>;
|
|
64
|
+
export declare const __testInternals: {
|
|
65
|
+
normalizeFlowFetchRef: typeof normalizeFlowFetchRef;
|
|
66
|
+
normalizeOptionalNonNegativeInteger: typeof normalizeOptionalNonNegativeInteger;
|
|
67
|
+
normalizeToken: typeof normalizeToken;
|
|
68
|
+
toRequestedRefSummary: typeof toRequestedRefSummary;
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { FetchLike } from './http.js';
|
|
2
|
+
import { type SupabaseFlowLookup } from './flow-read.js';
|
|
3
|
+
type JsonObject = Record<string, unknown>;
|
|
4
|
+
export type RunFlowGetOptions = {
|
|
5
|
+
flowId: string;
|
|
6
|
+
version?: string | null;
|
|
7
|
+
userId?: string | null;
|
|
8
|
+
stateCode?: number | null;
|
|
9
|
+
env?: NodeJS.ProcessEnv;
|
|
10
|
+
fetchImpl?: FetchLike;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
now?: Date;
|
|
13
|
+
};
|
|
14
|
+
export type FlowGetReport = {
|
|
15
|
+
schema_version: 1;
|
|
16
|
+
generated_at_utc: string;
|
|
17
|
+
status: 'resolved_remote_flow';
|
|
18
|
+
flow_id: string;
|
|
19
|
+
requested_version: string | null;
|
|
20
|
+
requested_user_id: string | null;
|
|
21
|
+
requested_state_code: number | null;
|
|
22
|
+
resolved_version: string;
|
|
23
|
+
resolution: SupabaseFlowLookup['resolution'];
|
|
24
|
+
source_url: string;
|
|
25
|
+
modified_at: string | null;
|
|
26
|
+
user_id: string | null;
|
|
27
|
+
state_code: number | null;
|
|
28
|
+
flow: JsonObject;
|
|
29
|
+
};
|
|
30
|
+
declare function normalizeToken(value: string | null | undefined): string | null;
|
|
31
|
+
export declare function runFlowGet(options: RunFlowGetOptions): Promise<FlowGetReport>;
|
|
32
|
+
export declare const __testInternals: {
|
|
33
|
+
normalizeToken: typeof normalizeToken;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type JsonRecord = Record<string, unknown>;
|
|
2
|
+
export declare function isRecord(value: unknown): value is JsonRecord;
|
|
3
|
+
export type FlowRecord = {
|
|
4
|
+
id: string;
|
|
5
|
+
version: string;
|
|
6
|
+
name: string;
|
|
7
|
+
flowType: string;
|
|
8
|
+
shortDescription: JsonRecord | null;
|
|
9
|
+
row: JsonRecord;
|
|
10
|
+
};
|
|
11
|
+
export declare function listify<T>(value: T | T[] | null | undefined): T[];
|
|
12
|
+
export declare function deepGet(value: unknown, pathParts: string[], defaultValue?: unknown): unknown;
|
|
13
|
+
export declare function coerceText(value: unknown): string;
|
|
14
|
+
export declare function firstLangEntry(value: unknown, fallback?: string): JsonRecord | null;
|
|
15
|
+
export declare function normalizeText(value: string): string;
|
|
16
|
+
export declare function datasetPayloadFromRow(row: JsonRecord): JsonRecord;
|
|
17
|
+
export declare function flowDatasetFromRow(row: JsonRecord): JsonRecord;
|
|
18
|
+
export declare function extractFlowRecord(row: JsonRecord): FlowRecord;
|
|
19
|
+
export declare function loadRowsFromFile(filePath: string): JsonRecord[];
|
|
20
|
+
export declare const __testInternals: {
|
|
21
|
+
isRecord: typeof isRecord;
|
|
22
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { FetchLike } from './http.js';
|
|
2
|
+
type JsonObject = Record<string, unknown>;
|
|
3
|
+
export type RunFlowListOptions = {
|
|
4
|
+
ids?: string[];
|
|
5
|
+
version?: string | null;
|
|
6
|
+
userId?: string | null;
|
|
7
|
+
stateCodes?: number[];
|
|
8
|
+
typeOfDataset?: string[];
|
|
9
|
+
limit?: number | null;
|
|
10
|
+
offset?: number | null;
|
|
11
|
+
all?: boolean;
|
|
12
|
+
pageSize?: number | null;
|
|
13
|
+
order?: string | null;
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
fetchImpl?: FetchLike;
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
now?: Date;
|
|
18
|
+
};
|
|
19
|
+
export type FlowListReport = {
|
|
20
|
+
schema_version: 1;
|
|
21
|
+
generated_at_utc: string;
|
|
22
|
+
status: 'listed_remote_flows';
|
|
23
|
+
filters: {
|
|
24
|
+
ids: string[];
|
|
25
|
+
requested_version: string | null;
|
|
26
|
+
requested_user_id: string | null;
|
|
27
|
+
requested_state_codes: number[];
|
|
28
|
+
requested_type_of_dataset: string[];
|
|
29
|
+
order: string;
|
|
30
|
+
all: boolean;
|
|
31
|
+
limit: number | null;
|
|
32
|
+
offset: number;
|
|
33
|
+
page_size: number | null;
|
|
34
|
+
};
|
|
35
|
+
count: number;
|
|
36
|
+
source_urls: string[];
|
|
37
|
+
rows: Array<{
|
|
38
|
+
id: string;
|
|
39
|
+
version: string;
|
|
40
|
+
user_id: string | null;
|
|
41
|
+
state_code: number | null;
|
|
42
|
+
modified_at: string | null;
|
|
43
|
+
flow: JsonObject;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
declare function normalizeToken(value: string | null | undefined): string | null;
|
|
47
|
+
declare function nowIso(now?: Date): string;
|
|
48
|
+
declare function toPositiveInteger(value: number | null | undefined, label: string, code: string): number;
|
|
49
|
+
declare function toNonNegativeInteger(value: number | null | undefined, label: string, code: string): number;
|
|
50
|
+
export declare function runFlowList(options: RunFlowListOptions): Promise<FlowListReport>;
|
|
51
|
+
export declare const __testInternals: {
|
|
52
|
+
normalizeToken: typeof normalizeToken;
|
|
53
|
+
nowIso: typeof nowIso;
|
|
54
|
+
toPositiveInteger: typeof toPositiveInteger;
|
|
55
|
+
toNonNegativeInteger: typeof toNonNegativeInteger;
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type FlowRecord, type JsonRecord } from './flow-governance.js';
|
|
2
|
+
type FlowRef = {
|
|
3
|
+
id: string;
|
|
4
|
+
version: string;
|
|
5
|
+
};
|
|
6
|
+
type SupportedDecision = 'merge_keep_one' | 'keep_distinct' | 'blocked_missing_db_flow';
|
|
7
|
+
type NormalizedDecision = {
|
|
8
|
+
clusterId: string;
|
|
9
|
+
decision: SupportedDecision;
|
|
10
|
+
reason: string | null;
|
|
11
|
+
canonicalRef: FlowRef | null;
|
|
12
|
+
memberRefs: FlowRef[];
|
|
13
|
+
};
|
|
14
|
+
type IndexedFlowRow = {
|
|
15
|
+
key: string;
|
|
16
|
+
row: JsonRecord;
|
|
17
|
+
record: FlowRecord;
|
|
18
|
+
};
|
|
19
|
+
type FlowMaterializeDecisionsFiles = {
|
|
20
|
+
canonical_map: string;
|
|
21
|
+
rewrite_plan: string;
|
|
22
|
+
semantic_merge_seed: string;
|
|
23
|
+
summary: string;
|
|
24
|
+
blocked_clusters: string;
|
|
25
|
+
};
|
|
26
|
+
type FlowMaterializeDecisionCounts = {
|
|
27
|
+
input_decisions: number;
|
|
28
|
+
materialized_clusters: number;
|
|
29
|
+
blocked_clusters: number;
|
|
30
|
+
canonical_map_entries: number;
|
|
31
|
+
rewrite_actions: number;
|
|
32
|
+
seed_alias_entries: number;
|
|
33
|
+
decision_counts: Record<SupportedDecision, number>;
|
|
34
|
+
blocked_reason_counts: Record<string, number>;
|
|
35
|
+
};
|
|
36
|
+
export type FlowMaterializeDecisionsReport = {
|
|
37
|
+
schema_version: 1;
|
|
38
|
+
generated_at_utc: string;
|
|
39
|
+
status: 'completed_local_flow_decision_materialization' | 'completed_local_flow_decision_materialization_with_blocked_clusters';
|
|
40
|
+
decision_file: string;
|
|
41
|
+
flow_rows_file: string;
|
|
42
|
+
out_dir: string;
|
|
43
|
+
counts: FlowMaterializeDecisionCounts;
|
|
44
|
+
files: FlowMaterializeDecisionsFiles;
|
|
45
|
+
};
|
|
46
|
+
export type RunFlowMaterializeDecisionsOptions = {
|
|
47
|
+
decisionFile: string;
|
|
48
|
+
flowRowsFile: string;
|
|
49
|
+
outDir: string;
|
|
50
|
+
now?: Date;
|
|
51
|
+
};
|
|
52
|
+
declare function parseFlowRefString(value: string, code: string): FlowRef;
|
|
53
|
+
declare function parseFlowRefLike(value: unknown, code: string): FlowRef | null;
|
|
54
|
+
declare function uniqueFlowRefs(refs: FlowRef[]): FlowRef[];
|
|
55
|
+
declare function parseDecisionRow(row: JsonRecord, index: number): NormalizedDecision;
|
|
56
|
+
declare function buildFlowIndex(rows: JsonRecord[]): Map<string, IndexedFlowRow>;
|
|
57
|
+
declare function buildOutputFiles(outDir: string): FlowMaterializeDecisionsFiles;
|
|
58
|
+
export declare function runFlowMaterializeDecisions(options: RunFlowMaterializeDecisionsOptions): Promise<FlowMaterializeDecisionsReport>;
|
|
59
|
+
export declare const __testInternals: {
|
|
60
|
+
parseDecisionRow: typeof parseDecisionRow;
|
|
61
|
+
parseFlowRefLike: typeof parseFlowRefLike;
|
|
62
|
+
parseFlowRefString: typeof parseFlowRefString;
|
|
63
|
+
uniqueFlowRefs: typeof uniqueFlowRefs;
|
|
64
|
+
buildFlowIndex: typeof buildFlowIndex;
|
|
65
|
+
buildOutputFiles: typeof buildOutputFiles;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type SafeParseSchema, type SdkValidationFactory } from './tidas-sdk-validation.js';
|
|
2
|
+
type JsonObject = Record<string, unknown>;
|
|
3
|
+
export declare const FLOW_SCHEMA_VALIDATOR = "@tiangong-lca/tidas-sdk/FlowSchema";
|
|
4
|
+
export type FlowPayloadValidationIssue = {
|
|
5
|
+
path: string;
|
|
6
|
+
message: string;
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
export type FlowPayloadValidationResult = {
|
|
10
|
+
ok: true;
|
|
11
|
+
validator: string;
|
|
12
|
+
issue_count: 0;
|
|
13
|
+
issues: [];
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
validator: string;
|
|
17
|
+
issue_count: number;
|
|
18
|
+
issues: FlowPayloadValidationIssue[];
|
|
19
|
+
};
|
|
20
|
+
declare function getFlowSchema(sdk?: {
|
|
21
|
+
FlowSchema?: SafeParseSchema;
|
|
22
|
+
}): SafeParseSchema;
|
|
23
|
+
declare function getFlowFactory(sdk?: {
|
|
24
|
+
createFlow?: unknown;
|
|
25
|
+
}): SdkValidationFactory | null;
|
|
26
|
+
export declare function summarizeFlowPayloadValidation(result: FlowPayloadValidationResult): string;
|
|
27
|
+
export declare function validateFlowPayload(payload: JsonObject, schema?: SafeParseSchema, createEntity?: SdkValidationFactory | null): FlowPayloadValidationResult;
|
|
28
|
+
export declare const __testInternals: {
|
|
29
|
+
getFlowSchema: typeof getFlowSchema;
|
|
30
|
+
getFlowFactory: typeof getFlowFactory;
|
|
31
|
+
};
|
|
32
|
+
export {};
|