@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,165 @@
|
|
|
1
|
+
import { materializeDatasetRows, type DatasetKind } from './dataset-local.js';
|
|
2
|
+
import { type DatasetValidateReport, type RunDatasetValidateOptions } from './dataset-validate.js';
|
|
3
|
+
import { type FlowQaReport, type RunFlowQaOptions } from './flow-qa.js';
|
|
4
|
+
import { type ProcessQaReport, type RunProcessQaOptions } from './process-qa.js';
|
|
5
|
+
type BilingualDatasetType = 'auto' | DatasetKind;
|
|
6
|
+
type BilingualStatus = 'completed' | 'blocked';
|
|
7
|
+
type ScanSeverity = 'warning' | 'blocker';
|
|
8
|
+
export type BilingualTranslationUnit = {
|
|
9
|
+
schema_version: 1;
|
|
10
|
+
unit_id: string;
|
|
11
|
+
row_index: number;
|
|
12
|
+
dataset_type: DatasetKind | null;
|
|
13
|
+
dataset_id: string | null;
|
|
14
|
+
dataset_version: string | null;
|
|
15
|
+
field_path: string;
|
|
16
|
+
source_lang: string;
|
|
17
|
+
target_lang: string;
|
|
18
|
+
source_text: string;
|
|
19
|
+
current_target_text: string | null;
|
|
20
|
+
context: {
|
|
21
|
+
root_field: string | null;
|
|
22
|
+
sibling_keys: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type DatasetBilingualExtractReport = {
|
|
26
|
+
schema_version: 1;
|
|
27
|
+
generated_at_utc: string;
|
|
28
|
+
input_path: string;
|
|
29
|
+
requested_type: BilingualDatasetType;
|
|
30
|
+
source_lang: string;
|
|
31
|
+
target_lang: string;
|
|
32
|
+
unit_count: number;
|
|
33
|
+
row_count: number;
|
|
34
|
+
files: {
|
|
35
|
+
translation_units: string | null;
|
|
36
|
+
report: string | null;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type TranslationEvidenceEntry = {
|
|
40
|
+
unit_id: string;
|
|
41
|
+
row_index: number;
|
|
42
|
+
dataset_type: DatasetKind | null;
|
|
43
|
+
dataset_id: string | null;
|
|
44
|
+
dataset_version: string | null;
|
|
45
|
+
field_path: string;
|
|
46
|
+
source_lang: string;
|
|
47
|
+
target_lang: string;
|
|
48
|
+
source_text: string;
|
|
49
|
+
translated_text: string;
|
|
50
|
+
basis: string | null;
|
|
51
|
+
review_status: string | null;
|
|
52
|
+
reviewer: string | null;
|
|
53
|
+
};
|
|
54
|
+
export type DatasetBilingualApplyReport = {
|
|
55
|
+
schema_version: 1;
|
|
56
|
+
generated_at_utc: string;
|
|
57
|
+
input_path: string;
|
|
58
|
+
translations_path: string;
|
|
59
|
+
out_path: string;
|
|
60
|
+
target_lang: string;
|
|
61
|
+
status: BilingualStatus;
|
|
62
|
+
row_count: number;
|
|
63
|
+
translation_count: number;
|
|
64
|
+
applied_count: number;
|
|
65
|
+
skipped_count: number;
|
|
66
|
+
blockers: Array<{
|
|
67
|
+
code: string;
|
|
68
|
+
message: string;
|
|
69
|
+
unit_id?: string;
|
|
70
|
+
}>;
|
|
71
|
+
files: {
|
|
72
|
+
translated_rows: string;
|
|
73
|
+
translation_evidence: string | null;
|
|
74
|
+
report: string | null;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export type BilingualScanFinding = {
|
|
78
|
+
code: string;
|
|
79
|
+
severity: ScanSeverity;
|
|
80
|
+
row_index: number;
|
|
81
|
+
dataset_type: DatasetKind | null;
|
|
82
|
+
dataset_id: string | null;
|
|
83
|
+
dataset_version: string | null;
|
|
84
|
+
field_path: string;
|
|
85
|
+
lang: string | null;
|
|
86
|
+
message: string;
|
|
87
|
+
text_preview: string;
|
|
88
|
+
};
|
|
89
|
+
export type DatasetBilingualValidateReport = {
|
|
90
|
+
schema_version: 1;
|
|
91
|
+
generated_at_utc: string;
|
|
92
|
+
input_path: string;
|
|
93
|
+
requested_type: BilingualDatasetType;
|
|
94
|
+
status: BilingualStatus;
|
|
95
|
+
row_count: number;
|
|
96
|
+
scan: {
|
|
97
|
+
finding_count: number;
|
|
98
|
+
blocker_count: number;
|
|
99
|
+
warning_count: number;
|
|
100
|
+
findings: BilingualScanFinding[];
|
|
101
|
+
};
|
|
102
|
+
schema_gate: {
|
|
103
|
+
status: DatasetValidateReport['status'];
|
|
104
|
+
valid: number;
|
|
105
|
+
invalid: number;
|
|
106
|
+
report_file: string | null;
|
|
107
|
+
};
|
|
108
|
+
qa_gate: {
|
|
109
|
+
status: 'completed' | 'not_run';
|
|
110
|
+
process_report_file: string | null;
|
|
111
|
+
flow_report_file: string | null;
|
|
112
|
+
};
|
|
113
|
+
files: {
|
|
114
|
+
report: string | null;
|
|
115
|
+
findings: string | null;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export type RunDatasetBilingualExtractOptions = {
|
|
119
|
+
inputPath: string;
|
|
120
|
+
type?: string | null;
|
|
121
|
+
outDir?: string | null;
|
|
122
|
+
sourceLang?: string | null;
|
|
123
|
+
targetLang?: string | null;
|
|
124
|
+
rawInput?: unknown;
|
|
125
|
+
now?: Date;
|
|
126
|
+
};
|
|
127
|
+
export type RunDatasetBilingualApplyOptions = {
|
|
128
|
+
inputPath: string;
|
|
129
|
+
translationsPath: string;
|
|
130
|
+
outPath: string;
|
|
131
|
+
outDir?: string | null;
|
|
132
|
+
targetLang?: string | null;
|
|
133
|
+
rawInput?: unknown;
|
|
134
|
+
rawTranslations?: unknown;
|
|
135
|
+
now?: Date;
|
|
136
|
+
};
|
|
137
|
+
export type RunDatasetBilingualValidateOptions = {
|
|
138
|
+
inputPath: string;
|
|
139
|
+
type?: string | null;
|
|
140
|
+
outDir?: string | null;
|
|
141
|
+
rawInput?: unknown;
|
|
142
|
+
now?: Date;
|
|
143
|
+
datasetValidateImpl?: (options: RunDatasetValidateOptions) => Promise<DatasetValidateReport>;
|
|
144
|
+
processQaImpl?: (options: RunProcessQaOptions) => Promise<ProcessQaReport>;
|
|
145
|
+
flowQaImpl?: (options: RunFlowQaOptions) => Promise<FlowQaReport>;
|
|
146
|
+
schemas?: RunDatasetValidateOptions['schemas'];
|
|
147
|
+
};
|
|
148
|
+
declare function normalizeType(value: string | null | undefined): BilingualDatasetType;
|
|
149
|
+
declare function pointerFromSegments(segments: string[]): string;
|
|
150
|
+
declare function segmentsFromPointer(pointer: string): string[];
|
|
151
|
+
declare function rawLangOf(value: unknown): string | null;
|
|
152
|
+
declare function collectTranslationUnits(rows: ReturnType<typeof materializeDatasetRows>, sourceLang: string, targetLang: string): BilingualTranslationUnit[];
|
|
153
|
+
declare function scanRows(rows: ReturnType<typeof materializeDatasetRows>): BilingualScanFinding[];
|
|
154
|
+
export declare function runDatasetBilingualExtract(options: RunDatasetBilingualExtractOptions): Promise<DatasetBilingualExtractReport>;
|
|
155
|
+
export declare function runDatasetBilingualApply(options: RunDatasetBilingualApplyOptions): Promise<DatasetBilingualApplyReport>;
|
|
156
|
+
export declare function runDatasetBilingualValidate(options: RunDatasetBilingualValidateOptions): Promise<DatasetBilingualValidateReport>;
|
|
157
|
+
export declare const __testInternals: {
|
|
158
|
+
collectTranslationUnits: typeof collectTranslationUnits;
|
|
159
|
+
normalizeType: typeof normalizeType;
|
|
160
|
+
pointerFromSegments: typeof pointerFromSegments;
|
|
161
|
+
rawLangOf: typeof rawLangOf;
|
|
162
|
+
segmentsFromPointer: typeof segmentsFromPointer;
|
|
163
|
+
scanRows: typeof scanRows;
|
|
164
|
+
};
|
|
165
|
+
export {};
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { type JsonObject } from './dataset-local.js';
|
|
2
|
+
export type DatasetClassificationType = 'contact' | 'flow-elementary' | 'flow-product' | 'flowproperty' | 'lciamethod' | 'location' | 'process' | 'source' | 'unitgroup';
|
|
3
|
+
type ClassificationValueKey = '@catId' | '@classId' | '@code';
|
|
4
|
+
export type ClassificationEntry = {
|
|
5
|
+
level: number;
|
|
6
|
+
code: string;
|
|
7
|
+
text: string;
|
|
8
|
+
value_key: ClassificationValueKey;
|
|
9
|
+
};
|
|
10
|
+
export type ClassificationPathEntry = {
|
|
11
|
+
'@level': string;
|
|
12
|
+
'@classId'?: string;
|
|
13
|
+
'@catId'?: string;
|
|
14
|
+
'@code'?: string;
|
|
15
|
+
'#text': string;
|
|
16
|
+
};
|
|
17
|
+
export type DatasetClassificationChildrenReport = {
|
|
18
|
+
schema_version: 1;
|
|
19
|
+
generated_at_utc: string;
|
|
20
|
+
status: 'completed' | 'blocked';
|
|
21
|
+
command: 'dataset classification children';
|
|
22
|
+
category_type: DatasetClassificationType;
|
|
23
|
+
schema_file: string;
|
|
24
|
+
parent_code: string | null;
|
|
25
|
+
query: string | null;
|
|
26
|
+
counts: {
|
|
27
|
+
children: number;
|
|
28
|
+
returned: number;
|
|
29
|
+
};
|
|
30
|
+
children: Array<ClassificationEntry & {
|
|
31
|
+
path: ClassificationPathEntry[];
|
|
32
|
+
}>;
|
|
33
|
+
blockers: Array<{
|
|
34
|
+
code: string;
|
|
35
|
+
message: string;
|
|
36
|
+
}>;
|
|
37
|
+
files?: {
|
|
38
|
+
report: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type DatasetClassificationPathReport = {
|
|
42
|
+
schema_version: 1;
|
|
43
|
+
generated_at_utc: string;
|
|
44
|
+
status: 'completed' | 'blocked';
|
|
45
|
+
command: 'dataset classification path';
|
|
46
|
+
category_type: DatasetClassificationType;
|
|
47
|
+
schema_file: string;
|
|
48
|
+
code: string;
|
|
49
|
+
path: ClassificationPathEntry[];
|
|
50
|
+
blockers: Array<{
|
|
51
|
+
code: string;
|
|
52
|
+
message: string;
|
|
53
|
+
}>;
|
|
54
|
+
files?: {
|
|
55
|
+
report: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type DatasetClassificationApplyReport = {
|
|
59
|
+
schema_version: 1;
|
|
60
|
+
generated_at_utc: string;
|
|
61
|
+
status: 'completed' | 'blocked';
|
|
62
|
+
command: 'dataset classification apply';
|
|
63
|
+
input_path: string;
|
|
64
|
+
decisions_path: string;
|
|
65
|
+
out_path: string;
|
|
66
|
+
default_category_type: DatasetClassificationType | null;
|
|
67
|
+
counts: {
|
|
68
|
+
rows: number;
|
|
69
|
+
decisions: number;
|
|
70
|
+
applied: number;
|
|
71
|
+
blockers: number;
|
|
72
|
+
};
|
|
73
|
+
blockers: DatasetClassificationBlocker[];
|
|
74
|
+
files: {
|
|
75
|
+
classified_rows: string;
|
|
76
|
+
evidence: string;
|
|
77
|
+
report: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export type DatasetClassificationAuditFinding = {
|
|
81
|
+
row_index: number;
|
|
82
|
+
dataset_id: string | null;
|
|
83
|
+
dataset_version: string | null;
|
|
84
|
+
path: string;
|
|
85
|
+
value: string;
|
|
86
|
+
status: 'valid' | 'invalid';
|
|
87
|
+
description: string | null;
|
|
88
|
+
};
|
|
89
|
+
export type DatasetClassificationAuditReport = {
|
|
90
|
+
schema_version: 1;
|
|
91
|
+
generated_at_utc: string;
|
|
92
|
+
status: 'completed' | 'blocked';
|
|
93
|
+
command: 'dataset classification audit';
|
|
94
|
+
category_type: DatasetClassificationType;
|
|
95
|
+
schema_file: string;
|
|
96
|
+
input_path: string;
|
|
97
|
+
counts: {
|
|
98
|
+
rows: number;
|
|
99
|
+
location_targets: number;
|
|
100
|
+
valid: number;
|
|
101
|
+
invalid: number;
|
|
102
|
+
};
|
|
103
|
+
findings: DatasetClassificationAuditFinding[];
|
|
104
|
+
blockers: DatasetClassificationBlocker[];
|
|
105
|
+
files?: {
|
|
106
|
+
findings: string;
|
|
107
|
+
report: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export type DatasetClassificationBlocker = {
|
|
111
|
+
code: string;
|
|
112
|
+
message: string;
|
|
113
|
+
decision_index?: number;
|
|
114
|
+
row_index?: number;
|
|
115
|
+
dataset_id?: string | null;
|
|
116
|
+
dataset_version?: string | null;
|
|
117
|
+
};
|
|
118
|
+
export type RunDatasetClassificationChildrenOptions = {
|
|
119
|
+
type: string;
|
|
120
|
+
parent?: string | null;
|
|
121
|
+
query?: string | null;
|
|
122
|
+
limit?: number | null;
|
|
123
|
+
outDir?: string | null;
|
|
124
|
+
now?: Date;
|
|
125
|
+
};
|
|
126
|
+
export type RunDatasetClassificationPathOptions = {
|
|
127
|
+
type: string;
|
|
128
|
+
code: string;
|
|
129
|
+
outDir?: string | null;
|
|
130
|
+
now?: Date;
|
|
131
|
+
};
|
|
132
|
+
export type RunDatasetClassificationAuditOptions = {
|
|
133
|
+
inputPath: string;
|
|
134
|
+
type: string;
|
|
135
|
+
outDir?: string | null;
|
|
136
|
+
rawInput?: unknown;
|
|
137
|
+
now?: Date;
|
|
138
|
+
};
|
|
139
|
+
export type RunDatasetClassificationApplyOptions = {
|
|
140
|
+
inputPath: string;
|
|
141
|
+
decisionsPath: string;
|
|
142
|
+
outPath: string;
|
|
143
|
+
type?: string | null;
|
|
144
|
+
outDir?: string | null;
|
|
145
|
+
rawInput?: unknown;
|
|
146
|
+
rawDecisions?: unknown;
|
|
147
|
+
now?: Date;
|
|
148
|
+
};
|
|
149
|
+
type CategoryConfig = {
|
|
150
|
+
type: DatasetClassificationType;
|
|
151
|
+
schemaFile: string;
|
|
152
|
+
defaultValueKey: ClassificationValueKey;
|
|
153
|
+
target: 'common:category' | 'common:class' | 'location';
|
|
154
|
+
};
|
|
155
|
+
type ClassificationNavigator = {
|
|
156
|
+
entries: ClassificationEntry[];
|
|
157
|
+
entriesByCode: Map<string, ClassificationEntry>;
|
|
158
|
+
childMap: Map<string, ClassificationEntry[]>;
|
|
159
|
+
parentMap: Map<string, ClassificationEntry | null>;
|
|
160
|
+
};
|
|
161
|
+
type NormalizedDecision = {
|
|
162
|
+
decisionIndex: number;
|
|
163
|
+
rowIndex: number | null;
|
|
164
|
+
datasetId: string | null;
|
|
165
|
+
datasetVersion: string | null;
|
|
166
|
+
categoryType: DatasetClassificationType;
|
|
167
|
+
path: ClassificationPathEntry[];
|
|
168
|
+
targetPath: string | null;
|
|
169
|
+
basis: string | null;
|
|
170
|
+
evidence: unknown;
|
|
171
|
+
};
|
|
172
|
+
type LocationTarget = {
|
|
173
|
+
path: string;
|
|
174
|
+
parentPath: string;
|
|
175
|
+
parent: JsonObject;
|
|
176
|
+
key: string;
|
|
177
|
+
value: string;
|
|
178
|
+
};
|
|
179
|
+
type PreparedClassificationRow = {
|
|
180
|
+
index: number;
|
|
181
|
+
row: JsonObject;
|
|
182
|
+
payload: JsonObject;
|
|
183
|
+
rootKey: string | null;
|
|
184
|
+
informationKey: string | null;
|
|
185
|
+
id: string | null;
|
|
186
|
+
version: string | null;
|
|
187
|
+
};
|
|
188
|
+
declare function normalizeType(value: unknown): DatasetClassificationType;
|
|
189
|
+
declare function schemasDir(candidatesOverride?: string[]): string;
|
|
190
|
+
declare function lastSchemaPropertyName(schemaPathSegments: string[]): string | null;
|
|
191
|
+
declare function collectLocationRefKeysFromSchema(value: unknown, schemaPathSegments: string[], keys: Set<string>): void;
|
|
192
|
+
declare function locationTargetKeys(): Set<string>;
|
|
193
|
+
declare function isJsonSchemaFileName(fileName: string): boolean;
|
|
194
|
+
declare function constText(value: unknown): string | null;
|
|
195
|
+
declare function collectEntriesFromNode(node: unknown, defaultValueKey: ClassificationValueKey, entries: ClassificationEntry[]): void;
|
|
196
|
+
declare function loadEntries(type: DatasetClassificationType): {
|
|
197
|
+
config: CategoryConfig;
|
|
198
|
+
schema: string;
|
|
199
|
+
entries: ClassificationEntry[];
|
|
200
|
+
};
|
|
201
|
+
declare function buildNavigator(entries: ClassificationEntry[]): ClassificationNavigator;
|
|
202
|
+
declare function navigatorFor(type: DatasetClassificationType): {
|
|
203
|
+
config: CategoryConfig;
|
|
204
|
+
schema: string;
|
|
205
|
+
navigator: ClassificationNavigator;
|
|
206
|
+
};
|
|
207
|
+
declare function pathForCode(navigator: ClassificationNavigator, code: string): ClassificationEntry[];
|
|
208
|
+
declare function toPathEntry(entry: ClassificationEntry): ClassificationPathEntry;
|
|
209
|
+
declare function classCode(value: unknown): string | null;
|
|
210
|
+
declare function normalizeTargetPath(value: unknown): string | null;
|
|
211
|
+
declare function decisionTargetPath(decision: JsonObject): string | null;
|
|
212
|
+
declare function normalizePathFromClasses(type: DatasetClassificationType, classes: unknown): ClassificationPathEntry[];
|
|
213
|
+
declare function normalizePathFromDecision(type: DatasetClassificationType, decision: JsonObject): ClassificationPathEntry[];
|
|
214
|
+
declare function normalizeDecisionType(decision: JsonObject, fallbackType: DatasetClassificationType | null): DatasetClassificationType | null;
|
|
215
|
+
declare function normalizeStructuredDecisions(value: unknown): JsonObject[];
|
|
216
|
+
declare function readDecisions(pathValue: string, rawInput?: unknown): JsonObject[];
|
|
217
|
+
declare function prepareRows(inputPath: string, rawInput?: unknown): PreparedClassificationRow[];
|
|
218
|
+
declare function classificationContainer(row: PreparedClassificationRow, type: DatasetClassificationType): JsonObject | null;
|
|
219
|
+
declare function currentClassification(row: PreparedClassificationRow, type: DatasetClassificationType): unknown;
|
|
220
|
+
declare function setClassification(row: PreparedClassificationRow, type: DatasetClassificationType, classificationPath: ClassificationPathEntry[]): boolean;
|
|
221
|
+
declare function locationTargetStringValue(value: unknown): {
|
|
222
|
+
parent: JsonObject | null;
|
|
223
|
+
key: string | null;
|
|
224
|
+
pathSuffix: Array<string | number>;
|
|
225
|
+
value: string;
|
|
226
|
+
} | null;
|
|
227
|
+
declare function collectLocationTargets(value: unknown, pathSegments?: Array<string | number>, targets?: LocationTarget[]): LocationTarget[];
|
|
228
|
+
declare function locationCodeFromPath(classificationPath: ClassificationPathEntry[]): string | null;
|
|
229
|
+
declare function resolveLocationTarget(row: PreparedClassificationRow, decision: NormalizedDecision): LocationTarget[];
|
|
230
|
+
declare function targetPathSegments(targetPath: string): string[];
|
|
231
|
+
declare function createMissingLocationTarget(row: PreparedClassificationRow, targetPath: string): LocationTarget | null;
|
|
232
|
+
declare function decisionMatchesRow(decision: NormalizedDecision, row: PreparedClassificationRow): boolean;
|
|
233
|
+
declare function normalizeDecision(decision: JsonObject, decisionIndex: number, fallbackType: DatasetClassificationType | null, blockers: DatasetClassificationBlocker[]): NormalizedDecision | null;
|
|
234
|
+
declare function maybeWriteReport<T extends {
|
|
235
|
+
files?: {
|
|
236
|
+
report: string;
|
|
237
|
+
};
|
|
238
|
+
}>(report: T, outDir: string | null | undefined, filename: string): T;
|
|
239
|
+
export declare function runDatasetClassificationChildren(options: RunDatasetClassificationChildrenOptions): Promise<DatasetClassificationChildrenReport>;
|
|
240
|
+
export declare function runDatasetClassificationPath(options: RunDatasetClassificationPathOptions): Promise<DatasetClassificationPathReport>;
|
|
241
|
+
export declare function runDatasetClassificationAudit(options: RunDatasetClassificationAuditOptions): Promise<DatasetClassificationAuditReport>;
|
|
242
|
+
export declare function runDatasetClassificationApply(options: RunDatasetClassificationApplyOptions): Promise<DatasetClassificationApplyReport>;
|
|
243
|
+
export declare const __testInternals: {
|
|
244
|
+
buildNavigator: typeof buildNavigator;
|
|
245
|
+
classCode: typeof classCode;
|
|
246
|
+
classificationContainer: typeof classificationContainer;
|
|
247
|
+
collectEntriesFromNode: typeof collectEntriesFromNode;
|
|
248
|
+
collectLocationRefKeysFromSchema: typeof collectLocationRefKeysFromSchema;
|
|
249
|
+
collectLocationTargets: typeof collectLocationTargets;
|
|
250
|
+
constText: typeof constText;
|
|
251
|
+
createMissingLocationTarget: typeof createMissingLocationTarget;
|
|
252
|
+
currentClassification: typeof currentClassification;
|
|
253
|
+
decisionMatchesRow: typeof decisionMatchesRow;
|
|
254
|
+
decisionTargetPath: typeof decisionTargetPath;
|
|
255
|
+
isJsonSchemaFileName: typeof isJsonSchemaFileName;
|
|
256
|
+
lastSchemaPropertyName: typeof lastSchemaPropertyName;
|
|
257
|
+
loadEntries: typeof loadEntries;
|
|
258
|
+
locationCodeFromPath: typeof locationCodeFromPath;
|
|
259
|
+
locationTargetStringValue: typeof locationTargetStringValue;
|
|
260
|
+
locationTargetKeys: typeof locationTargetKeys;
|
|
261
|
+
maybeWriteReport: typeof maybeWriteReport;
|
|
262
|
+
navigatorFor: typeof navigatorFor;
|
|
263
|
+
normalizeDecision: typeof normalizeDecision;
|
|
264
|
+
normalizeDecisionType: typeof normalizeDecisionType;
|
|
265
|
+
normalizePathFromClasses: typeof normalizePathFromClasses;
|
|
266
|
+
normalizePathFromDecision: typeof normalizePathFromDecision;
|
|
267
|
+
normalizeStructuredDecisions: typeof normalizeStructuredDecisions;
|
|
268
|
+
normalizeTargetPath: typeof normalizeTargetPath;
|
|
269
|
+
normalizeType: typeof normalizeType;
|
|
270
|
+
pathForCode: typeof pathForCode;
|
|
271
|
+
prepareRows: typeof prepareRows;
|
|
272
|
+
readDecisions: typeof readDecisions;
|
|
273
|
+
resolveLocationTarget: typeof resolveLocationTarget;
|
|
274
|
+
schemasDir: typeof schemasDir;
|
|
275
|
+
setClassification: typeof setClassification;
|
|
276
|
+
targetPathSegments: typeof targetPathSegments;
|
|
277
|
+
toPathEntry: typeof toPathEntry;
|
|
278
|
+
};
|
|
279
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FetchLike } from './http.js';
|
|
2
|
+
import { type SupabaseDataRuntime } from './supabase-client.js';
|
|
3
|
+
type JsonObject = Record<string, unknown>;
|
|
4
|
+
export type DatasetCommandTable = 'contacts' | 'sources' | 'unitgroups' | 'flowproperties' | 'flows' | 'processes' | 'lifecyclemodels';
|
|
5
|
+
export type DatasetCommandTransport = {
|
|
6
|
+
functionsBaseUrl: string;
|
|
7
|
+
publishableKey: string;
|
|
8
|
+
accessToken: string;
|
|
9
|
+
fetchImpl: FetchLike;
|
|
10
|
+
timeoutMs: number;
|
|
11
|
+
};
|
|
12
|
+
declare function readOptionalRuleVerification(extraData?: JsonObject): boolean | null | undefined;
|
|
13
|
+
declare function readOptionalModelId(extraData: JsonObject | undefined, allowNull: boolean): string | null | undefined;
|
|
14
|
+
export declare function deriveSupabaseFunctionsBaseUrl(apiBaseUrl: string): string;
|
|
15
|
+
export declare function buildDatasetCommandTransport(options: {
|
|
16
|
+
runtime: SupabaseDataRuntime;
|
|
17
|
+
fetchImpl: FetchLike;
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
}): Promise<DatasetCommandTransport>;
|
|
20
|
+
export declare function resolveDatasetCommandTransport(options: {
|
|
21
|
+
env: NodeJS.ProcessEnv;
|
|
22
|
+
fetchImpl: FetchLike;
|
|
23
|
+
timeoutMs: number;
|
|
24
|
+
}): Promise<DatasetCommandTransport>;
|
|
25
|
+
export declare function createDatasetRecord(options: {
|
|
26
|
+
transport: DatasetCommandTransport;
|
|
27
|
+
table: DatasetCommandTable;
|
|
28
|
+
id: string;
|
|
29
|
+
payload: JsonObject;
|
|
30
|
+
extraData?: JsonObject;
|
|
31
|
+
beforeDispatch?: () => void;
|
|
32
|
+
}): Promise<JsonObject>;
|
|
33
|
+
export declare function saveDraftDatasetRecord(options: {
|
|
34
|
+
transport: DatasetCommandTransport;
|
|
35
|
+
table: DatasetCommandTable;
|
|
36
|
+
id: string;
|
|
37
|
+
version: string;
|
|
38
|
+
payload: JsonObject;
|
|
39
|
+
extraData?: JsonObject;
|
|
40
|
+
beforeDispatch?: () => void;
|
|
41
|
+
}): Promise<JsonObject>;
|
|
42
|
+
export declare function deleteDatasetRecord(options: {
|
|
43
|
+
transport: DatasetCommandTransport;
|
|
44
|
+
table: DatasetCommandTable;
|
|
45
|
+
id: string;
|
|
46
|
+
version: string;
|
|
47
|
+
}): Promise<JsonObject>;
|
|
48
|
+
export declare const __testInternals: {
|
|
49
|
+
deriveSupabaseFunctionsBaseUrl: typeof deriveSupabaseFunctionsBaseUrl;
|
|
50
|
+
readOptionalModelId: typeof readOptionalModelId;
|
|
51
|
+
readOptionalRuleVerification: typeof readOptionalRuleVerification;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export type DatasetContractInclude = 'schema' | 'methodology' | 'ruleset';
|
|
2
|
+
export type DatasetContractProfile = 'default' | 'ai-import';
|
|
3
|
+
export type DatasetContractMode = 'contract' | 'context-pack';
|
|
4
|
+
export type DatasetContractReport = {
|
|
5
|
+
schema_version: 1;
|
|
6
|
+
status: 'completed';
|
|
7
|
+
generated_at_utc: string;
|
|
8
|
+
mode: DatasetContractMode;
|
|
9
|
+
requested_type: string;
|
|
10
|
+
type: string;
|
|
11
|
+
profile: DatasetContractProfile;
|
|
12
|
+
includes: DatasetContractInclude[];
|
|
13
|
+
source: 'sdk-contract-api' | 'sdk-runtime-assets';
|
|
14
|
+
manifest: unknown;
|
|
15
|
+
files: {
|
|
16
|
+
manifest: string;
|
|
17
|
+
schema: string | null;
|
|
18
|
+
methodology: string | null;
|
|
19
|
+
ruleset: string | null;
|
|
20
|
+
ai_context_json: string | null;
|
|
21
|
+
ai_context_markdown: string | null;
|
|
22
|
+
report: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type RunDatasetContractOptions = {
|
|
26
|
+
type: string | undefined;
|
|
27
|
+
include?: string | string[] | undefined;
|
|
28
|
+
profile?: string | undefined;
|
|
29
|
+
outDir: string | null | undefined;
|
|
30
|
+
mode: DatasetContractMode;
|
|
31
|
+
now?: Date;
|
|
32
|
+
sdkModule?: Record<string, unknown>;
|
|
33
|
+
runtimeAssetsRoot?: string;
|
|
34
|
+
};
|
|
35
|
+
type ContractPack = {
|
|
36
|
+
manifest: unknown;
|
|
37
|
+
schemaText?: string;
|
|
38
|
+
methodologyText?: string;
|
|
39
|
+
runtimeRuleset?: unknown;
|
|
40
|
+
aiContext?: unknown;
|
|
41
|
+
};
|
|
42
|
+
type CanonicalKind = 'contact' | 'flow' | 'flowproperty' | 'lciamethod' | 'lifecyclemodel' | 'process' | 'source' | 'unitgroup';
|
|
43
|
+
export declare function runDatasetContract(options: RunDatasetContractOptions): Promise<DatasetContractReport>;
|
|
44
|
+
declare function normalizeType(value: string | undefined): CanonicalKind;
|
|
45
|
+
declare function normalizeIncludes(value: string | string[] | undefined): DatasetContractInclude[];
|
|
46
|
+
declare function normalizeProfile(value: string): DatasetContractProfile;
|
|
47
|
+
declare function loadFallbackContractPack(options: {
|
|
48
|
+
type: CanonicalKind;
|
|
49
|
+
includes: DatasetContractInclude[];
|
|
50
|
+
profile: DatasetContractProfile;
|
|
51
|
+
includeAiContext: boolean;
|
|
52
|
+
runtimeAssetsRoot?: string;
|
|
53
|
+
}): ContractPack;
|
|
54
|
+
declare function resolveSdkRuntimeAssetsRoot(candidatesOverride?: string[], sdkEntryOverride?: string): string;
|
|
55
|
+
declare function resolveCliRepoRoot(candidatesOverride?: string[]): string;
|
|
56
|
+
declare function filterRuntimeRuleset(source: Record<string, unknown>, type: CanonicalKind): unknown | undefined;
|
|
57
|
+
declare function artifactManifest(name: string, content: string): {
|
|
58
|
+
name: string;
|
|
59
|
+
sha256: string;
|
|
60
|
+
bytes: number;
|
|
61
|
+
};
|
|
62
|
+
declare function buildAiContext(options: {
|
|
63
|
+
type: CanonicalKind;
|
|
64
|
+
profile: DatasetContractProfile;
|
|
65
|
+
schemaText?: string;
|
|
66
|
+
methodologyText?: string;
|
|
67
|
+
runtimeRuleset?: unknown;
|
|
68
|
+
}): unknown;
|
|
69
|
+
declare function renderAiContextMarkdown(type: CanonicalKind, pack: ContractPack): string;
|
|
70
|
+
export declare const __testInternals: {
|
|
71
|
+
artifactManifest: typeof artifactManifest;
|
|
72
|
+
buildAiContext: typeof buildAiContext;
|
|
73
|
+
filterRuntimeRuleset: typeof filterRuntimeRuleset;
|
|
74
|
+
loadFallbackContractPack: typeof loadFallbackContractPack;
|
|
75
|
+
renderAiContextMarkdown: typeof renderAiContextMarkdown;
|
|
76
|
+
resolveCliRepoRoot: typeof resolveCliRepoRoot;
|
|
77
|
+
resolveSdkRuntimeAssetsRoot: typeof resolveSdkRuntimeAssetsRoot;
|
|
78
|
+
normalizeIncludes: typeof normalizeIncludes;
|
|
79
|
+
normalizeProfile: typeof normalizeProfile;
|
|
80
|
+
normalizeType: typeof normalizeType;
|
|
81
|
+
};
|
|
82
|
+
export {};
|