@happyvertical/smrt-cli 0.51.32 → 0.51.33
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/dist/{ApiKey-BZmbOTnL-DrxlAZO2.js → ApiKey-BZmbOTnL-B5lc6Wx3.js} +2 -2
- package/dist/ApiKeyCollection-Bfb_nw81-DC5iJ1mb.js +2 -0
- package/dist/AuditLogCollection-B1YonCAP-Bk3462Oa.js +2 -0
- package/dist/{NostrIdentity-n70E0vck-5rGYvFIY.js → NostrIdentity-n70E0vck-usXX4s_K.js} +3 -3
- package/dist/NostrIdentityCollection-Ca74dkaL-EMjWAg-m.js +2 -0
- package/dist/{OidcIdentity-K8V4u0CR-dzykFMgp.js → OidcIdentity-K8V4u0CR-BVLWjf-i.js} +2 -2
- package/dist/OidcIdentityCollection-gnrLoF08-BBZE53OW.js +2 -0
- package/dist/ProfileAssetCollection-CmbeSgDi-HoBqJG3G.js +2 -0
- package/dist/{ProfileCollection-DTT4KNpQ-C3tIYhbK.js → ProfileCollection-DTT4KNpQ-CBSNj-47.js} +25 -25
- package/dist/ProfileMetadataCollection-DxX_BJKV-CmmrJM8N.js +2 -0
- package/dist/{ProfileMetafieldCollection-CMKhVi2I-C6uF97rV.js → ProfileMetafieldCollection-CMKhVi2I-fJIfcATW.js} +1 -1
- package/dist/{ProfileRelationshipCollection-DUVgaIqf-DhrHpup7.js → ProfileRelationshipCollection-DUVgaIqf-CuZEerRb.js} +1 -1
- package/dist/{ProfileRelationshipTermCollection-DtA9OM23-aafuXvJi.js → ProfileRelationshipTermCollection-DtA9OM23-BUs2ORAN.js} +1 -1
- package/dist/{ProfileRelationshipType-BRiRka6t-CiAcDP3Y.js → ProfileRelationshipType-BRiRka6t-DFa-_Qqp.js} +1 -1
- package/dist/{ProfileRelationshipTypeCollection-BdXwd7Kf-Y4bfpu34.js → ProfileRelationshipTypeCollection-BdXwd7Kf-CcvbhUWo.js} +1 -1
- package/dist/cli-generator.d.ts +243 -0
- package/dist/cli-generator.d.ts.map +1 -0
- package/dist/commands/config-export.d.ts +9 -0
- package/dist/commands/config-export.d.ts.map +1 -0
- package/dist/commands/db-command-utils.d.ts +24 -0
- package/dist/commands/db-command-utils.d.ts.map +1 -0
- package/dist/commands/db-diff.d.ts +8 -0
- package/dist/commands/db-diff.d.ts.map +1 -0
- package/dist/commands/db-drop-framework-base-tables.d.ts +28 -0
- package/dist/commands/db-drop-framework-base-tables.d.ts.map +1 -0
- package/dist/commands/db-generate.d.ts +9 -0
- package/dist/commands/db-generate.d.ts.map +1 -0
- package/dist/commands/db-history.d.ts +8 -0
- package/dist/commands/db-history.d.ts.map +1 -0
- package/dist/commands/db-materialize-tenant-hierarchy.d.ts +12 -0
- package/dist/commands/db-materialize-tenant-hierarchy.d.ts.map +1 -0
- package/dist/commands/db-migrate-actions.d.ts +338 -0
- package/dist/commands/db-migrate-actions.d.ts.map +1 -0
- package/dist/commands/db-migrate-agent-schedule-slugs.d.ts +3 -0
- package/dist/commands/db-migrate-agent-schedule-slugs.d.ts.map +1 -0
- package/dist/commands/db-migrate-int8.d.ts +11 -0
- package/dist/commands/db-migrate-int8.d.ts.map +1 -0
- package/dist/commands/db-migrate-ledger-accounts.d.ts +8 -0
- package/dist/commands/db-migrate-ledger-accounts.d.ts.map +1 -0
- package/dist/commands/db-migrate-null-equal-indexes.d.ts +3 -0
- package/dist/commands/db-migrate-null-equal-indexes.d.ts.map +1 -0
- package/dist/commands/db-migrate-uuid.d.ts +171 -0
- package/dist/commands/db-migrate-uuid.d.ts.map +1 -0
- package/dist/commands/db-orphans.d.ts +39 -0
- package/dist/commands/db-orphans.d.ts.map +1 -0
- package/dist/commands/db-parity.d.ts +70 -0
- package/dist/commands/db-parity.d.ts.map +1 -0
- package/dist/commands/db-permissions.d.ts +19 -0
- package/dist/commands/db-permissions.d.ts.map +1 -0
- package/dist/commands/db-prune.d.ts +70 -0
- package/dist/commands/db-prune.d.ts.map +1 -0
- package/dist/commands/db-rollback.d.ts +44 -0
- package/dist/commands/db-rollback.d.ts.map +1 -0
- package/dist/commands/db-status.d.ts +91 -0
- package/dist/commands/db-status.d.ts.map +1 -0
- package/dist/commands/dev-knowledge.d.ts +10 -0
- package/dist/commands/dev-knowledge.d.ts.map +1 -0
- package/dist/commands/dev-runtime.d.ts +14 -0
- package/dist/commands/dev-runtime.d.ts.map +1 -0
- package/dist/commands/dispatch.d.ts +11 -0
- package/dist/commands/dispatch.d.ts.map +1 -0
- package/dist/commands/docs-claude.d.ts +44 -0
- package/dist/commands/docs-claude.d.ts.map +1 -0
- package/dist/commands/export.d.ts +31 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/generate.d.ts +12 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/git.d.ts +41 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/gnode.d.ts +11 -0
- package/dist/commands/gnode.d.ts.map +1 -0
- package/dist/commands/index.d.ts +23 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/json-validator.d.ts +155 -0
- package/dist/commands/json-validator.d.ts.map +1 -0
- package/dist/commands/migration-failure-analysis.d.ts +12 -0
- package/dist/commands/migration-failure-analysis.d.ts.map +1 -0
- package/dist/commands/playground.d.ts +8 -0
- package/dist/commands/playground.d.ts.map +1 -0
- package/dist/commands/postgres-timestamp-migration.d.ts +11 -0
- package/dist/commands/postgres-timestamp-migration.d.ts.map +1 -0
- package/dist/commands/runtime-check-command.d.ts +5 -0
- package/dist/commands/runtime-check-command.d.ts.map +1 -0
- package/dist/commands/schema-contract.d.ts +83 -0
- package/dist/commands/schema-contract.d.ts.map +1 -0
- package/dist/commands/sti-upgrade.d.ts +51 -0
- package/dist/commands/sti-upgrade.d.ts.map +1 -0
- package/dist/commands/utilities.d.ts +134 -0
- package/dist/commands/utilities.d.ts.map +1 -0
- package/dist/commands/validation-types.d.ts +119 -0
- package/dist/commands/validation-types.d.ts.map +1 -0
- package/dist/commands/workbench.d.ts +8 -0
- package/dist/commands/workbench.d.ts.map +1 -0
- package/dist/{commands-Aw8Wv-GM.js → commands-DjkVEXmb.js} +2 -2
- package/dist/config.d.ts +70 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/discovery/index.d.ts +6 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/manifest-discovery.d.ts +67 -0
- package/dist/discovery/manifest-discovery.d.ts.map +1 -0
- package/dist/discovery/manifest-identity.d.ts +10 -0
- package/dist/discovery/manifest-identity.d.ts.map +1 -0
- package/dist/{dist-DC1d_zi0.js → dist-CYBGFt2p.js} +4 -4
- package/dist/{dist-CcLtprDR.js → dist-DD9wiC0-.js} +25 -25
- package/dist/{dist-D4TtU64x.js → dist-DJ_WTzB9.js} +2 -2
- package/dist/{dist-DXDf5-e6.js → dist-iN1z9gzn.js} +3 -3
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -9
- package/dist/loaders/class-loader.d.ts +53 -0
- package/dist/loaders/class-loader.d.ts.map +1 -0
- package/dist/loaders/git-loader.d.ts +36 -0
- package/dist/loaders/git-loader.d.ts.map +1 -0
- package/dist/loaders/index.d.ts +9 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/local-loader.d.ts +23 -0
- package/dist/loaders/local-loader.d.ts.map +1 -0
- package/dist/loaders/npm-loader.d.ts +40 -0
- package/dist/loaders/npm-loader.d.ts.map +1 -0
- package/dist/loaders/template-loader.d.ts +62 -0
- package/dist/loaders/template-loader.d.ts.map +1 -0
- package/dist/{oidcProvisioningPrimitives-0-3n3D6f-D9PpE0-s.js → oidcProvisioningPrimitives-0-3n3D6f-CJHDoAXn.js} +4 -4
- package/dist/resolveIdentity-BrJDCjYi-1VmNML6W.js +2 -0
- package/dist/runtime-check.d.ts +19 -0
- package/dist/runtime-check.d.ts.map +1 -0
- package/dist/utils/generator.d.ts +48 -0
- package/dist/utils/generator.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +10 -12
- package/dist/ApiKeyCollection-Bfb_nw81-DP5f5QpC.js +0 -2
- package/dist/AuditLogCollection-B1YonCAP-CZBxKq4A.js +0 -2
- package/dist/NostrIdentityCollection-Ca74dkaL-C6qq3z-e.js +0 -2
- package/dist/OidcIdentityCollection-gnrLoF08-CtNhKu9y.js +0 -2
- package/dist/ProfileAssetCollection-CmbeSgDi-C7T6rlyL.js +0 -2
- package/dist/ProfileMetadataCollection-DxX_BJKV-B3TOG70O.js +0 -2
- package/dist/resolveIdentity-BrJDCjYi-BafhqSQm.js +0 -2
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Database Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates JSON database files against SMRT manifest schema
|
|
5
|
+
*/
|
|
6
|
+
import { type ValidationIssue, type ValidationResults, type ValidationSummary } from './validation-types.js';
|
|
7
|
+
interface ValidatorOptions {
|
|
8
|
+
dataPath: string;
|
|
9
|
+
quickMode: boolean;
|
|
10
|
+
verbose: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolve data path from explicit argument, config, or common locations.
|
|
14
|
+
*
|
|
15
|
+
* Resolution order:
|
|
16
|
+
* 1. Explicit --data argument if provided
|
|
17
|
+
* 2. Database URL from smrt.config.js (if it looks like a directory path)
|
|
18
|
+
* 3. Common data directory patterns: ./data, ./db, ./.data, ./json-db
|
|
19
|
+
*
|
|
20
|
+
* @param explicitPath - Optional explicit path from --data CLI argument
|
|
21
|
+
* @returns Resolved absolute path to data directory, or null if:
|
|
22
|
+
* - Explicit path was provided but doesn't exist
|
|
23
|
+
* - No data directory could be auto-detected
|
|
24
|
+
* - Auto-detected directories contain no JSON files
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveDataPath(explicitPath?: string): Promise<string | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Discover JSON files in the data directory
|
|
29
|
+
*/
|
|
30
|
+
export declare function discoverJsonFiles(dataPath: string): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* JSON Database Validator class.
|
|
33
|
+
*
|
|
34
|
+
* Validates JSON database files against SMRT manifest schema, checking:
|
|
35
|
+
* - JSON structure (valid JSON, root is array)
|
|
36
|
+
* - Required fields (id, slug for sluggable objects)
|
|
37
|
+
* - Field types (string, integer, decimal, boolean, datetime, json)
|
|
38
|
+
* - STI discriminator validation (_meta_type exists and is registered)
|
|
39
|
+
* - Uniqueness within file (no duplicate IDs, no duplicate slug+context)
|
|
40
|
+
* - Constraint validation (min/max, minLength/maxLength)
|
|
41
|
+
* - Foreign key references (full mode only)
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* **Memory considerations**: All JSON files are loaded into memory for
|
|
45
|
+
* cross-file validation (FK checks). For very large datasets (>1GB total),
|
|
46
|
+
* consider using quick mode (--quick) which skips FK validation and
|
|
47
|
+
* processes files independently.
|
|
48
|
+
*
|
|
49
|
+
* **Auto-fixable validation codes**:
|
|
50
|
+
* - `MISSING_REQUIRED_FIELD`: Can be fixed if the field has a default value
|
|
51
|
+
* defined in the manifest. Other codes require manual intervention.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const validator = new JsonDatabaseValidator({
|
|
56
|
+
* dataPath: './data',
|
|
57
|
+
* quickMode: false,
|
|
58
|
+
* verbose: true
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
* const results = await validator.validate(jsonFiles);
|
|
62
|
+
* const summary = validator.generateSummary(results, duration);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare class JsonDatabaseValidator {
|
|
66
|
+
private dataPath;
|
|
67
|
+
private quickMode;
|
|
68
|
+
private verbose;
|
|
69
|
+
private loadedData;
|
|
70
|
+
constructor(options: ValidatorOptions);
|
|
71
|
+
/**
|
|
72
|
+
* Run validation on all discovered JSON files
|
|
73
|
+
*/
|
|
74
|
+
validate(jsonFiles: string[]): Promise<ValidationResults>;
|
|
75
|
+
/**
|
|
76
|
+
* Load all JSON files into memory for cross-file validation (FK checks).
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* Files that fail to load are silently skipped here but will produce
|
|
80
|
+
* validation errors when validateFile() is called. In verbose mode,
|
|
81
|
+
* load failures are logged for debugging.
|
|
82
|
+
*/
|
|
83
|
+
private loadAllFiles;
|
|
84
|
+
/**
|
|
85
|
+
* Validate a single JSON file
|
|
86
|
+
*/
|
|
87
|
+
private validateFile;
|
|
88
|
+
/**
|
|
89
|
+
* Validate a single record
|
|
90
|
+
*/
|
|
91
|
+
private validateRecord;
|
|
92
|
+
/**
|
|
93
|
+
* Validate STI-specific fields
|
|
94
|
+
*/
|
|
95
|
+
private validateSTIFields;
|
|
96
|
+
/**
|
|
97
|
+
* Validate a single field against its definition.
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* Null handling varies by field type:
|
|
101
|
+
* - Required fields: null triggers MISSING_REQUIRED_FIELD error
|
|
102
|
+
* - JSON type: null is valid (it's a valid JSON value)
|
|
103
|
+
* - Other types: null is treated as "no value" and skips validation
|
|
104
|
+
*/
|
|
105
|
+
private validateField;
|
|
106
|
+
/**
|
|
107
|
+
* Validate field type
|
|
108
|
+
*/
|
|
109
|
+
private validateFieldType;
|
|
110
|
+
/**
|
|
111
|
+
* Validate field constraints
|
|
112
|
+
*/
|
|
113
|
+
private validateConstraints;
|
|
114
|
+
/**
|
|
115
|
+
* Validate foreign key references across files (full mode only).
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* Uses Set-based lookup for target IDs (O(1) per lookup instead of O(n)),
|
|
119
|
+
* optimizing validation from O(n*m*k) to O(n*k + m) where:
|
|
120
|
+
* - n = number of records with FK fields
|
|
121
|
+
* - m = number of target records
|
|
122
|
+
* - k = number of FK fields per record
|
|
123
|
+
*
|
|
124
|
+
* Note: This method mutates the results to add FK validation issues.
|
|
125
|
+
* The validCount/invalidCount are updated to reflect records that
|
|
126
|
+
* failed FK validation (a record is counted as invalid if it has
|
|
127
|
+
* any FK errors).
|
|
128
|
+
*/
|
|
129
|
+
private validateForeignKeys;
|
|
130
|
+
/**
|
|
131
|
+
* Apply fixes to fixable issues.
|
|
132
|
+
*
|
|
133
|
+
* Currently supports auto-fixing:
|
|
134
|
+
* - MISSING_REQUIRED_FIELD: Applies default value from field definition
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* Records are matched by ID. Records identified by index only (objectId = '[index:N]')
|
|
138
|
+
* require the ID to be present and are matched by array position as a fallback.
|
|
139
|
+
*/
|
|
140
|
+
applyFixes(fixableIssues: ValidationIssue[]): Promise<number>;
|
|
141
|
+
/**
|
|
142
|
+
* Generate validation summary
|
|
143
|
+
*/
|
|
144
|
+
generateSummary(results: ValidationResults, duration: number, manifestPath?: string | null): ValidationSummary;
|
|
145
|
+
/**
|
|
146
|
+
* Create an ObjectValidationResult
|
|
147
|
+
*/
|
|
148
|
+
private createResult;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Display validation results in human-readable format
|
|
152
|
+
*/
|
|
153
|
+
export declare function displayValidationResults(summary: ValidationSummary, verbose: boolean): void;
|
|
154
|
+
export {};
|
|
155
|
+
//# sourceMappingURL=json-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-validator.d.ts","sourceRoot":"","sources":["../../src/commands/json-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAyB/B,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;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,12 @@
|
|
|
1
|
+
import type { SchemaDiff, SchemaMigrationRecord } from '@happyvertical/smrt-core/migrations';
|
|
2
|
+
export type FailedMigrationResolution = 'action_required' | 'superseded' | 'manual_review';
|
|
3
|
+
export interface FailedMigrationAssessment {
|
|
4
|
+
name: string;
|
|
5
|
+
resolution: FailedMigrationResolution;
|
|
6
|
+
kind: 'add_column' | 'drop_column' | 'alter_column' | 'add_index' | 'type_upgrade' | 'other';
|
|
7
|
+
reason: string;
|
|
8
|
+
errorMessage: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function getActionableFailedMigrationNames(diff: SchemaDiff): Set<string>;
|
|
11
|
+
export declare function assessFailedMigrations(failedMigrations: SchemaMigrationRecord[], diff: SchemaDiff | null): FailedMigrationAssessment[];
|
|
12
|
+
//# sourceMappingURL=migration-failure-analysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-failure-analysis.d.ts","sourceRoot":"","sources":["../../src/commands/migration-failure-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,UAAU,EACV,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAM7C,MAAM,MAAM,yBAAyB,GACjC,iBAAiB,GACjB,YAAY,GACZ,eAAe,CAAC;AAEpB,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,yBAAyB,CAAC;IACtC,IAAI,EACA,YAAY,GACZ,aAAa,GACb,cAAc,GACd,WAAW,GACX,cAAc,GACd,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAYD,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,UAAU,GACf,GAAG,CAAC,MAAM,CAAC,CAUb;AAWD,wBAAgB,sBAAsB,CACpC,gBAAgB,EAAE,qBAAqB,EAAE,EACzC,IAAI,EAAE,UAAU,GAAG,IAAI,GACtB,yBAAyB,EAAE,CAgD7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playground Commands
|
|
3
|
+
*
|
|
4
|
+
* Shared SMRT playground scaffolding, discovery, and host runtime helpers.
|
|
5
|
+
*/
|
|
6
|
+
import type { CLICommand } from '../cli-generator.js';
|
|
7
|
+
export declare const playgroundCommands: Record<string, CLICommand>;
|
|
8
|
+
//# sourceMappingURL=playground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/commands/playground.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA6OtD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAkMzD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fail-closed confirmation shared by PostgreSQL schema preview and migration.
|
|
3
|
+
*
|
|
4
|
+
* A `timestamp without time zone` value cannot establish its own original
|
|
5
|
+
* instant. Callers must therefore make the same explicit UTC provenance
|
|
6
|
+
* confirmation whether they are previewing or applying the conversion.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolvePostgresTimestampMigration(legacyTimezone: string | undefined): {
|
|
9
|
+
legacyTimezone: 'UTC';
|
|
10
|
+
} | undefined;
|
|
11
|
+
//# sourceMappingURL=postgres-timestamp-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-timestamp-migration.d.ts","sourceRoot":"","sources":["../../src/commands/postgres-timestamp-migration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC;IAAE,cAAc,EAAE,KAAK,CAAA;CAAE,GAAG,SAAS,CAYvC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CLICommand } from '../cli-generator.js';
|
|
2
|
+
import { type RuntimeCheckResult } from '../runtime-check.js';
|
|
3
|
+
export declare function runRuntimeCheckSafely(projectRoot: string): Promise<RuntimeCheckResult>;
|
|
4
|
+
export declare const runtimeCheckCommand: CLICommand;
|
|
5
|
+
//# sourceMappingURL=runtime-check-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-check-command.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-check-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,qBAAqB,CAAC;AAE7B,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAgB7B;AAED,eAAO,MAAM,mBAAmB,EAAE,UAejC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { SchemaContractConfig } from '@happyvertical/smrt-config';
|
|
2
|
+
import type { DatabaseInterface } from '@happyvertical/sql';
|
|
3
|
+
import type { DiscoveredManifest } from '../discovery/manifest-discovery.js';
|
|
4
|
+
export type { SchemaContractConfig };
|
|
5
|
+
export interface ContractFailure {
|
|
6
|
+
code: 'missing_local_manifest' | 'missing_required_object' | 'missing_required_field' | 'missing_required_table' | 'missing_required_column' | 'missing_required_index';
|
|
7
|
+
message: string;
|
|
8
|
+
ref?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SchemaContractReport {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
localManifest: {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
count: number;
|
|
15
|
+
paths: string[];
|
|
16
|
+
};
|
|
17
|
+
requiredObjects: Array<{
|
|
18
|
+
ref: string;
|
|
19
|
+
present: boolean;
|
|
20
|
+
qualifiedName?: string;
|
|
21
|
+
}>;
|
|
22
|
+
requiredFields: Array<{
|
|
23
|
+
ref: string;
|
|
24
|
+
present: boolean;
|
|
25
|
+
objectRef: string;
|
|
26
|
+
fieldName: string;
|
|
27
|
+
table?: string;
|
|
28
|
+
column?: string;
|
|
29
|
+
}>;
|
|
30
|
+
inferredDatabaseShape: {
|
|
31
|
+
tables: string[];
|
|
32
|
+
columns: string[];
|
|
33
|
+
indexes: string[];
|
|
34
|
+
};
|
|
35
|
+
requiredDatabaseShape: {
|
|
36
|
+
tables: Array<{
|
|
37
|
+
ref: string;
|
|
38
|
+
present?: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
columns: Array<{
|
|
41
|
+
ref: string;
|
|
42
|
+
present?: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
indexes: Array<{
|
|
45
|
+
ref: string;
|
|
46
|
+
present?: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
failures: ContractFailure[];
|
|
50
|
+
}
|
|
51
|
+
export declare class SchemaContractError extends Error {
|
|
52
|
+
report: SchemaContractReport;
|
|
53
|
+
constructor(report: SchemaContractReport);
|
|
54
|
+
}
|
|
55
|
+
export declare class UnsupportedFileMigrationsError extends Error {
|
|
56
|
+
files: string[];
|
|
57
|
+
constructor(files: string[], directory: string);
|
|
58
|
+
}
|
|
59
|
+
export declare class UnsupportedMigrationModeError extends Error {
|
|
60
|
+
mode: string;
|
|
61
|
+
source: string;
|
|
62
|
+
constructor(mode: string, source: string);
|
|
63
|
+
}
|
|
64
|
+
export declare function assertNoUnsupportedMigrationFiles(config: {
|
|
65
|
+
migrations?: {
|
|
66
|
+
directory?: string;
|
|
67
|
+
mode?: string;
|
|
68
|
+
modeByEnvironment?: {
|
|
69
|
+
development?: string;
|
|
70
|
+
test?: string;
|
|
71
|
+
staging?: string;
|
|
72
|
+
production?: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}, projectRoot?: string): Promise<void>;
|
|
76
|
+
export declare function evaluateSchemaContract(options: {
|
|
77
|
+
discovered: DiscoveredManifest[];
|
|
78
|
+
schemaContract?: SchemaContractConfig;
|
|
79
|
+
db?: DatabaseInterface;
|
|
80
|
+
}): Promise<SchemaContractReport>;
|
|
81
|
+
export declare function formatSchemaContractFailures(report: SchemaContractReport): string;
|
|
82
|
+
export declare function assertSchemaContract(report: SchemaContractReport): void;
|
|
83
|
+
//# sourceMappingURL=schema-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-contract.d.ts","sourceRoot":"","sources":["../../src/commands/schema-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,YAAY,EAAE,oBAAoB,EAAE,CAAC;AA2BrC,MAAM,WAAW,eAAe;IAC9B,IAAI,EACA,wBAAwB,GACxB,yBAAyB,GACzB,wBAAwB,GACxB,wBAAwB,GACxB,yBAAyB,GACzB,wBAAwB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,OAAO,CAAC;IACZ,aAAa,EAAE;QACb,EAAE,EAAE,OAAO,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,eAAe,EAAE,KAAK,CAAC;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,cAAc,EAAE,KAAK,CAAC;QACpB,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAA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AC,EAAE,MAAM,CAAC;YACjB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;KACH,CAAC;CACH,EACD,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,EAAE,CAAC,EAAE,iBAAiB,CAAC;CACxB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAmIhC;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,GAC3B,MAAM,CAWR;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAIvE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** A database row as returned by the raw `query` API: keyed by column name. */
|
|
2
|
+
type DbRow = Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Result of a raw `query` call. Adapters return either a bare row array or an
|
|
5
|
+
* envelope with `rows`/`rowCount`; both shapes are narrowed at the use site.
|
|
6
|
+
*/
|
|
7
|
+
type QueryResult = DbRow[] | {
|
|
8
|
+
rows?: DbRow[];
|
|
9
|
+
rowCount?: number;
|
|
10
|
+
};
|
|
11
|
+
type QueryableDb = {
|
|
12
|
+
query(sql: string, ...params: unknown[]): Promise<QueryResult>;
|
|
13
|
+
};
|
|
14
|
+
export type StiDiscriminatorUpgradeResult = {
|
|
15
|
+
action: 'skip';
|
|
16
|
+
reason: 'already-current' | 'ambiguous' | 'unregistered' | 'unqualified';
|
|
17
|
+
} | {
|
|
18
|
+
action: 'upgrade';
|
|
19
|
+
className: string;
|
|
20
|
+
currentQualifiedName: string;
|
|
21
|
+
sourceKind: 'simple' | 'stale-qualified';
|
|
22
|
+
};
|
|
23
|
+
export interface StiDiscriminatorRepairConflict {
|
|
24
|
+
tableName: string;
|
|
25
|
+
legacyMetaType: string;
|
|
26
|
+
qualifiedMetaType: string;
|
|
27
|
+
legacyId: string | null;
|
|
28
|
+
qualifiedId: string | null;
|
|
29
|
+
conflictIdentity: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface StiDiscriminatorRepairResult {
|
|
32
|
+
tableName: string;
|
|
33
|
+
legacyMetaType: string;
|
|
34
|
+
qualifiedMetaType: string;
|
|
35
|
+
checkedRows: number;
|
|
36
|
+
updatedRows: number;
|
|
37
|
+
wouldUpdateRows: number;
|
|
38
|
+
conflicts: StiDiscriminatorRepairConflict[];
|
|
39
|
+
}
|
|
40
|
+
export declare function resolveStiDiscriminatorUpgrade(metaType: string): StiDiscriminatorUpgradeResult;
|
|
41
|
+
export declare function getStiConflictIdentityColumns(className: string): string[];
|
|
42
|
+
export declare function repairStiDiscriminatorRows(options: {
|
|
43
|
+
db: QueryableDb;
|
|
44
|
+
tableName: string;
|
|
45
|
+
className: string;
|
|
46
|
+
legacyMetaType: string;
|
|
47
|
+
qualifiedMetaType: string;
|
|
48
|
+
dryRun?: boolean;
|
|
49
|
+
}): Promise<StiDiscriminatorRepairResult>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=sti-upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sti-upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/sti-upgrade.ts"],"names":[],"mappings":"AAOA,+EAA+E;AAC/E,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,WAAW,GAAG,KAAK,EAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAChE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BAA4B,CAAC,CAuExC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility CLI Commands
|
|
3
|
+
*
|
|
4
|
+
* Commands for introspection, testing, and project management
|
|
5
|
+
*/
|
|
6
|
+
import type { CLICommand } from '../cli-generator.js';
|
|
7
|
+
export declare function resolveVitestEntrypoint(fromDir?: string): string;
|
|
8
|
+
export interface ForceMigrationSelection {
|
|
9
|
+
force: boolean;
|
|
10
|
+
forceMigrations?: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Require the explicit provenance confirmation before the schema comparer may
|
|
14
|
+
* reinterpret legacy PostgreSQL timestamp-without-time-zone values as UTC
|
|
15
|
+
* instants. Omitting the option intentionally leaves the type drift manual.
|
|
16
|
+
*/
|
|
17
|
+
export { resolvePostgresTimestampMigration } from './postgres-timestamp-migration.js';
|
|
18
|
+
/**
|
|
19
|
+
* Normalize exact migration selectors from the public single/repeated CLI
|
|
20
|
+
* forms. List and wildcard syntax are deliberately rejected: every selected
|
|
21
|
+
* migration must be named by its own exact flag.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveForceMigrationSelection(force: boolean | undefined, value: unknown): ForceMigrationSelection;
|
|
24
|
+
export declare function assertForceMigrationTargetsExist(forceMigrations: readonly string[] | undefined, generatedMigrationIds: Iterable<string>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Subset of `package.json` fields the doctor command inspects when assessing
|
|
27
|
+
* project health and publish surface.
|
|
28
|
+
*/
|
|
29
|
+
interface DoctorPackageJson {
|
|
30
|
+
dependencies?: Record<string, string>;
|
|
31
|
+
devDependencies?: Record<string, string>;
|
|
32
|
+
private?: boolean;
|
|
33
|
+
main?: unknown;
|
|
34
|
+
module?: unknown;
|
|
35
|
+
svelte?: unknown;
|
|
36
|
+
types?: unknown;
|
|
37
|
+
exports?: unknown;
|
|
38
|
+
}
|
|
39
|
+
/** Outcome of the doctor's decorator-transform check. */
|
|
40
|
+
export interface DecoratorSupportAssessment {
|
|
41
|
+
status: 'ok' | 'warning' | 'error';
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Read the declared Vite major version from a project's package.json.
|
|
46
|
+
*
|
|
47
|
+
* Returns `null` when Vite is absent or the range is not a simple one whose
|
|
48
|
+
* major can be read off the front (`workspace:*`, `*`, a git URL, …); callers
|
|
49
|
+
* treat that as "unknown major" and accept either decorator recipe.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveDeclaredViteMajor(packageJson: DoctorPackageJson): number | null;
|
|
52
|
+
/**
|
|
53
|
+
* Assess whether a project's decorator transform is actually configured.
|
|
54
|
+
*
|
|
55
|
+
* The doctor used to require `experimentalDecorators` in tsconfig.json
|
|
56
|
+
* unconditionally, which contradicts the framework's own Vite 8 guidance: the
|
|
57
|
+
* oxc transform does not honor tsconfig `experimentalDecorators` (nor the
|
|
58
|
+
* pre-Vite-8 `esbuild.tsconfigRaw` recipe), so a correctly configured Vite 8
|
|
59
|
+
* project — decorators declared under `oxc.decorator` — was reported broken,
|
|
60
|
+
* and a Vite 8 project relying on tsconfig alone was reported healthy right up
|
|
61
|
+
* until the first SSR request threw `SyntaxError: Invalid or unexpected token`.
|
|
62
|
+
*
|
|
63
|
+
* The check now follows the documented recipe per Vite major:
|
|
64
|
+
* - Vite 8+: `oxc.decorator` in vite.config is the only working configuration.
|
|
65
|
+
* - Vite <8 (or no declared Vite): tsconfig `experimentalDecorators` is the
|
|
66
|
+
* legacy recipe and remains valid.
|
|
67
|
+
*/
|
|
68
|
+
export declare function assessDecoratorSupport(input: {
|
|
69
|
+
viteMajor: number | null;
|
|
70
|
+
viteConfigContent: string | null;
|
|
71
|
+
tsconfigContent: string | null;
|
|
72
|
+
}): DecoratorSupportAssessment;
|
|
73
|
+
/** One agent-addressable entry, whatever declared it. */
|
|
74
|
+
export interface AgentSurfaceEntry {
|
|
75
|
+
kind: 'model tool' | 'view intent' | 'playbook';
|
|
76
|
+
/** The name an agent addresses this entry by. */
|
|
77
|
+
name: string;
|
|
78
|
+
detail: string;
|
|
79
|
+
}
|
|
80
|
+
/** What `smrt doctor` reports about an application's agent surface. */
|
|
81
|
+
export interface AgentSurfaceReport {
|
|
82
|
+
/** Artifact the surface was read from, relative to the project root. */
|
|
83
|
+
source?: string;
|
|
84
|
+
modelTools: AgentSurfaceEntry[];
|
|
85
|
+
intents: AgentSurfaceEntry[];
|
|
86
|
+
playbooks: AgentSurfaceEntry[];
|
|
87
|
+
/** Declarations the scanner recognized but could not emit. */
|
|
88
|
+
notStatic: Array<{
|
|
89
|
+
sourceFile: string;
|
|
90
|
+
message: string;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Emitted intents whose derived WebMCP tool name something else also claims
|
|
94
|
+
* (#2725).
|
|
95
|
+
*
|
|
96
|
+
* Kept apart from {@link AgentSurfaceReport.notStatic} because the whole
|
|
97
|
+
* point of this report is which operations are present, and these ARE
|
|
98
|
+
* present — they appear in `intents` above. Listing them as "not statically
|
|
99
|
+
* emittable" would contradict the lines directly above them.
|
|
100
|
+
*
|
|
101
|
+
* "Also claimed", not "already taken": a build cannot see the provider's
|
|
102
|
+
* WebMCP `namespace`, and one dissolves a generated-tool collision entirely.
|
|
103
|
+
* Each message states that condition; this header must not assert past it.
|
|
104
|
+
*
|
|
105
|
+
* Deliberately NOT restated in `packages/cli/AGENTS.md`: that chain sits 44
|
|
106
|
+
* bytes under the 32 KB cap `pnpm check:agents-chain` enforces, so any
|
|
107
|
+
* paragraph there fails the build. `packages/scanner/AGENTS.md` carries the
|
|
108
|
+
* rule for this diagnostic, and this comment carries it for the renderer.
|
|
109
|
+
*/
|
|
110
|
+
toolNameCollisions: Array<{
|
|
111
|
+
sourceFile: string;
|
|
112
|
+
message: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Read the complete agent-addressable surface from build artifacts alone.
|
|
117
|
+
*
|
|
118
|
+
* Model tools come from the artifact's emitted `mcp` surfaces, which is where
|
|
119
|
+
* core has always recorded them; intents and playbooks come from the emitted
|
|
120
|
+
* agent surface. They are reported together because an agent does not
|
|
121
|
+
* experience them as three mechanisms — it experiences one list of things it
|
|
122
|
+
* can do.
|
|
123
|
+
*
|
|
124
|
+
* @param cwd - Project root to read artifacts from.
|
|
125
|
+
* @returns The report, or `undefined` when no artifact exists yet.
|
|
126
|
+
*/
|
|
127
|
+
export declare function readAgentSurfaceReport(cwd: string): Promise<AgentSurfaceReport | undefined>;
|
|
128
|
+
/** Render the surface report as the lines `smrt doctor` prints. */
|
|
129
|
+
export declare function renderAgentSurfaceReport(report: AgentSurfaceReport | undefined): string[];
|
|
130
|
+
/**
|
|
131
|
+
* Utility commands for CLI
|
|
132
|
+
*/
|
|
133
|
+
export declare const utilityCommands: Record<string, CLICommand>;
|
|
134
|
+
//# sourceMappingURL=utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../src/commands/utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAwItD,wBAAgB,uBAAuB,CAAC,OAAO,SAAgB,GAAG,MAAM,CAIvE;AAwLD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;AAEtF;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,GAAG,SAAS,EAC1B,KAAK,EAAE,OAAO,GACb,uBAAuB,CA2DzB;AAED,wBAAgB,gCAAgC,CAC9C,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC9C,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,GACtC,IAAI,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C/B,8DAA8D;IAC9D,SAAS,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AA4CD;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAsDzC;AAgBD,mEAAmE;AACnE,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,MAAM,EAAE,CAoCV;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA63FtD,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for JSON database validation
|
|
3
|
+
*/
|
|
4
|
+
export type ValidationSeverity = 'error' | 'warning' | 'info';
|
|
5
|
+
/**
|
|
6
|
+
* A single validation issue found during database validation
|
|
7
|
+
*/
|
|
8
|
+
export interface ValidationIssue {
|
|
9
|
+
/** Severity level of the issue */
|
|
10
|
+
severity: ValidationSeverity;
|
|
11
|
+
/** Error code for programmatic handling */
|
|
12
|
+
code: string;
|
|
13
|
+
/** Human-readable description of the issue */
|
|
14
|
+
message: string;
|
|
15
|
+
/** File path where the issue was found */
|
|
16
|
+
file?: string;
|
|
17
|
+
/** SMRT object type (class name) */
|
|
18
|
+
objectType?: string;
|
|
19
|
+
/** ID of the record with the issue */
|
|
20
|
+
objectId?: string;
|
|
21
|
+
/** Field name involved in the issue */
|
|
22
|
+
field?: string;
|
|
23
|
+
/** Expected value or type */
|
|
24
|
+
expected?: unknown;
|
|
25
|
+
/** Actual value found */
|
|
26
|
+
actual?: unknown;
|
|
27
|
+
/** Whether this issue can be automatically fixed */
|
|
28
|
+
fixable?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validation results for a single object type/file
|
|
32
|
+
*/
|
|
33
|
+
export interface ObjectValidationResult {
|
|
34
|
+
/** SMRT object type (class name) */
|
|
35
|
+
objectType: string | null;
|
|
36
|
+
/** Database table name */
|
|
37
|
+
tableName: string;
|
|
38
|
+
/** Path to the JSON file */
|
|
39
|
+
file: string;
|
|
40
|
+
/** Total number of records in the file */
|
|
41
|
+
recordCount: number;
|
|
42
|
+
/** Number of valid records */
|
|
43
|
+
validCount: number;
|
|
44
|
+
/** Number of invalid records */
|
|
45
|
+
invalidCount: number;
|
|
46
|
+
/** List of issues found */
|
|
47
|
+
issues: ValidationIssue[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Complete validation summary
|
|
51
|
+
*/
|
|
52
|
+
export interface ValidationSummary {
|
|
53
|
+
/** ISO timestamp of validation run */
|
|
54
|
+
timestamp: string;
|
|
55
|
+
/** Path to the data directory */
|
|
56
|
+
dataPath: string;
|
|
57
|
+
/** Path to manifest used for validation */
|
|
58
|
+
manifestPath: string | null;
|
|
59
|
+
/** Duration of validation in milliseconds */
|
|
60
|
+
duration: number;
|
|
61
|
+
/** Number of JSON files validated */
|
|
62
|
+
totalFiles: number;
|
|
63
|
+
/** Total number of records across all files */
|
|
64
|
+
totalRecords: number;
|
|
65
|
+
/** Number of valid records */
|
|
66
|
+
validRecords: number;
|
|
67
|
+
/** Number of invalid records */
|
|
68
|
+
invalidRecords: number;
|
|
69
|
+
/** Issue counts by severity */
|
|
70
|
+
issues: {
|
|
71
|
+
errors: number;
|
|
72
|
+
warnings: number;
|
|
73
|
+
info: number;
|
|
74
|
+
};
|
|
75
|
+
/** Per-object validation results */
|
|
76
|
+
objectResults: ObjectValidationResult[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Internal validation results before summary generation
|
|
80
|
+
*/
|
|
81
|
+
export interface ValidationResults {
|
|
82
|
+
objectResults: ObjectValidationResult[];
|
|
83
|
+
fixableIssues: ValidationIssue[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Validation error codes organized by category
|
|
87
|
+
*/
|
|
88
|
+
export declare const ValidationCodes: {
|
|
89
|
+
readonly INVALID_JSON: "INVALID_JSON";
|
|
90
|
+
readonly NOT_ARRAY: "NOT_ARRAY";
|
|
91
|
+
readonly EMPTY_OBJECT: "EMPTY_OBJECT";
|
|
92
|
+
readonly MISSING_ID: "MISSING_ID";
|
|
93
|
+
readonly DUPLICATE_ID: "DUPLICATE_ID";
|
|
94
|
+
readonly INVALID_ID_FORMAT: "INVALID_ID_FORMAT";
|
|
95
|
+
readonly MISSING_SLUG: "MISSING_SLUG";
|
|
96
|
+
readonly DUPLICATE_SLUG_CONTEXT: "DUPLICATE_SLUG_CONTEXT";
|
|
97
|
+
readonly INVALID_TYPE: "INVALID_TYPE";
|
|
98
|
+
readonly INVALID_DATE: "INVALID_DATE";
|
|
99
|
+
readonly INVALID_JSON_FIELD: "INVALID_JSON_FIELD";
|
|
100
|
+
readonly INVALID_BOOLEAN: "INVALID_BOOLEAN";
|
|
101
|
+
readonly INVALID_NUMBER: "INVALID_NUMBER";
|
|
102
|
+
readonly INVALID_INTEGER: "INVALID_INTEGER";
|
|
103
|
+
readonly MISSING_META_TYPE: "MISSING_META_TYPE";
|
|
104
|
+
readonly UNKNOWN_META_TYPE: "UNKNOWN_META_TYPE";
|
|
105
|
+
readonly INVALID_META_DATA: "INVALID_META_DATA";
|
|
106
|
+
readonly MISSING_REQUIRED_FIELD: "MISSING_REQUIRED_FIELD";
|
|
107
|
+
readonly VALUE_OUT_OF_RANGE: "VALUE_OUT_OF_RANGE";
|
|
108
|
+
readonly STRING_TOO_LONG: "STRING_TOO_LONG";
|
|
109
|
+
readonly STRING_TOO_SHORT: "STRING_TOO_SHORT";
|
|
110
|
+
readonly PATTERN_MISMATCH: "PATTERN_MISMATCH";
|
|
111
|
+
readonly INVALID_FOREIGN_KEY: "INVALID_FOREIGN_KEY";
|
|
112
|
+
readonly MISSING_FK_TABLE: "MISSING_FK_TABLE";
|
|
113
|
+
readonly ORPHANED_RECORD: "ORPHANED_RECORD";
|
|
114
|
+
readonly UNKNOWN_FIELD: "UNKNOWN_FIELD";
|
|
115
|
+
readonly MISSING_TABLE_FILE: "MISSING_TABLE_FILE";
|
|
116
|
+
readonly UNKNOWN_TABLE: "UNKNOWN_TABLE";
|
|
117
|
+
};
|
|
118
|
+
export type ValidationCode = (typeof ValidationCodes)[keyof typeof ValidationCodes];
|
|
119
|
+
//# sourceMappingURL=validation-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-types.d.ts","sourceRoot":"","sources":["../../src/commands/validation-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,UAAU,EAAE,MAAM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
1
|
+
{"version":3,"file":"workbench.d.ts","sourceRoot":"","sources":["../../src/commands/workbench.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAwXtD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA8FxD,CAAC"}
|
|
@@ -6948,7 +6948,7 @@ var dbMaterializeTenantHierarchyCommand = {
|
|
|
6948
6948
|
if (!config.database?.url || config.database.url === ":memory:") throw new Error("Database configuration required for db:materialize-tenant-hierarchy. Configure database.url in smrt.config.ts (or DATABASE_URL).");
|
|
6949
6949
|
const dbType = config.database.type || "sqlite";
|
|
6950
6950
|
const { getDatabase } = await import("@happyvertical/sql");
|
|
6951
|
-
const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-
|
|
6951
|
+
const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-DD9wiC0-.js");
|
|
6952
6952
|
db = await getDatabase({
|
|
6953
6953
|
type: dbType,
|
|
6954
6954
|
url: config.database.url
|
|
@@ -7157,7 +7157,7 @@ var dbMigrateLedgerAccountsCommand = {
|
|
|
7157
7157
|
if (dbType !== "postgres") throw new Error("db:migrate-ledger-accounts currently supports PostgreSQL only; no changes were made. See the smrt-ledgers README for SQLite.");
|
|
7158
7158
|
await autoDiscoverAndLoad();
|
|
7159
7159
|
const { getDatabase } = await import("@happyvertical/sql");
|
|
7160
|
-
const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-
|
|
7160
|
+
const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-CYBGFt2p.js");
|
|
7161
7161
|
db = await getDatabase({
|
|
7162
7162
|
type: dbType,
|
|
7163
7163
|
url: config.database.url
|