@prisma-next/core-control-plane 0.3.0-dev.4 → 0.3.0-dev.5

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.
Files changed (49) hide show
  1. package/dist/config-types.d.ts +68 -0
  2. package/dist/config-types.d.ts.map +1 -0
  3. package/dist/config-validation.d.ts +10 -0
  4. package/dist/config-validation.d.ts.map +1 -0
  5. package/dist/emission/canonicalization.d.ts +6 -0
  6. package/dist/emission/canonicalization.d.ts.map +1 -0
  7. package/dist/emission/emit.d.ts +5 -0
  8. package/dist/emission/emit.d.ts.map +1 -0
  9. package/dist/emission/hashing.d.ts +17 -0
  10. package/dist/emission/hashing.d.ts.map +1 -0
  11. package/dist/emission/types.d.ts +16 -0
  12. package/dist/emission/types.d.ts.map +1 -0
  13. package/dist/errors.d.ts +183 -0
  14. package/dist/errors.d.ts.map +1 -0
  15. package/dist/exports/config-types.d.ts +3 -70
  16. package/dist/exports/config-types.d.ts.map +1 -0
  17. package/dist/exports/config-validation.d.ts +2 -18
  18. package/dist/exports/config-validation.d.ts.map +1 -0
  19. package/dist/exports/emission.d.ts +5 -42
  20. package/dist/exports/emission.d.ts.map +1 -0
  21. package/dist/exports/errors.d.ts +3 -184
  22. package/dist/exports/errors.d.ts.map +1 -0
  23. package/dist/exports/schema-view.d.ts +2 -87
  24. package/dist/exports/schema-view.d.ts.map +1 -0
  25. package/dist/exports/types.d.ts +2 -589
  26. package/dist/exports/types.d.ts.map +1 -0
  27. package/dist/migrations.d.ts +190 -0
  28. package/dist/migrations.d.ts.map +1 -0
  29. package/dist/schema-view.d.ts +86 -0
  30. package/dist/schema-view.d.ts.map +1 -0
  31. package/dist/types.d.ts +400 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/package.json +7 -6
  34. package/src/config-types.ts +157 -0
  35. package/src/config-validation.ts +270 -0
  36. package/src/emission/canonicalization.ts +253 -0
  37. package/src/emission/emit.ts +118 -0
  38. package/src/emission/hashing.ts +57 -0
  39. package/src/emission/types.ts +17 -0
  40. package/src/errors.ts +426 -0
  41. package/src/exports/config-types.ts +5 -0
  42. package/src/exports/config-validation.ts +1 -0
  43. package/src/exports/emission.ts +6 -0
  44. package/src/exports/errors.ts +22 -0
  45. package/src/exports/schema-view.ts +1 -0
  46. package/src/exports/types.ts +37 -0
  47. package/src/migrations.ts +247 -0
  48. package/src/schema-view.ts +95 -0
  49. package/src/types.ts +512 -0
@@ -1,184 +1,3 @@
1
- /**
2
- * CLI error envelope for output formatting.
3
- * This is the serialized form of a CliStructuredError.
4
- */
5
- interface CliErrorEnvelope {
6
- readonly code: string;
7
- readonly domain: string;
8
- readonly severity: 'error' | 'warn' | 'info';
9
- readonly summary: string;
10
- readonly why: string | undefined;
11
- readonly fix: string | undefined;
12
- readonly where: {
13
- readonly path: string | undefined;
14
- readonly line: number | undefined;
15
- } | undefined;
16
- readonly meta: Record<string, unknown> | undefined;
17
- readonly docsUrl: string | undefined;
18
- }
19
- /**
20
- * Minimal conflict data structure expected by CLI output.
21
- */
22
- interface CliErrorConflict {
23
- readonly kind: string;
24
- readonly summary: string;
25
- readonly why?: string;
26
- }
27
- /**
28
- * Structured CLI error that contains all information needed for error envelopes.
29
- * Call sites throw these errors with full context.
30
- */
31
- declare class CliStructuredError extends Error {
32
- readonly code: string;
33
- readonly domain: 'CLI' | 'RTM';
34
- readonly severity: 'error' | 'warn' | 'info';
35
- readonly why: string | undefined;
36
- readonly fix: string | undefined;
37
- readonly where: {
38
- readonly path: string | undefined;
39
- readonly line: number | undefined;
40
- } | undefined;
41
- readonly meta: Record<string, unknown> | undefined;
42
- readonly docsUrl: string | undefined;
43
- constructor(code: string, summary: string, options?: {
44
- readonly domain?: 'CLI' | 'RTM';
45
- readonly severity?: 'error' | 'warn' | 'info';
46
- readonly why?: string;
47
- readonly fix?: string;
48
- readonly where?: {
49
- readonly path?: string;
50
- readonly line?: number;
51
- };
52
- readonly meta?: Record<string, unknown>;
53
- readonly docsUrl?: string;
54
- });
55
- /**
56
- * Converts this error to a CLI error envelope for output formatting.
57
- */
58
- toEnvelope(): CliErrorEnvelope;
59
- }
60
- /**
61
- * Config file not found or missing.
62
- */
63
- declare function errorConfigFileNotFound(configPath?: string, options?: {
64
- readonly why?: string;
65
- }): CliStructuredError;
66
- /**
67
- * Contract configuration missing from config.
68
- */
69
- declare function errorContractConfigMissing(options?: {
70
- readonly why?: string;
71
- }): CliStructuredError;
72
- /**
73
- * Contract validation failed.
74
- */
75
- declare function errorContractValidationFailed(reason: string, options?: {
76
- readonly where?: {
77
- readonly path?: string;
78
- readonly line?: number;
79
- };
80
- }): CliStructuredError;
81
- /**
82
- * File not found.
83
- */
84
- declare function errorFileNotFound(filePath: string, options?: {
85
- readonly why?: string;
86
- readonly fix?: string;
87
- readonly docsUrl?: string;
88
- }): CliStructuredError;
89
- /**
90
- * Database URL is required but not provided.
91
- */
92
- declare function errorDatabaseUrlRequired(options?: {
93
- readonly why?: string;
94
- }): CliStructuredError;
95
- /**
96
- * Query runner factory is required but not provided in config.
97
- */
98
- declare function errorQueryRunnerFactoryRequired(options?: {
99
- readonly why?: string;
100
- }): CliStructuredError;
101
- /**
102
- * Family verify.readMarker is required but not provided.
103
- */
104
- declare function errorFamilyReadMarkerSqlRequired(options?: {
105
- readonly why?: string;
106
- }): CliStructuredError;
107
- /**
108
- * JSON output format not supported.
109
- */
110
- declare function errorJsonFormatNotSupported(options: {
111
- readonly command: string;
112
- readonly format: string;
113
- readonly supportedFormats: readonly string[];
114
- }): CliStructuredError;
115
- /**
116
- * Driver is required for DB-connected commands but not provided.
117
- */
118
- declare function errorDriverRequired(options?: {
119
- readonly why?: string;
120
- }): CliStructuredError;
121
- /**
122
- * Contract requires extension packs that are not provided by config descriptors.
123
- */
124
- declare function errorContractMissingExtensionPacks(options: {
125
- readonly missingExtensionPacks: readonly string[];
126
- readonly providedComponentIds: readonly string[];
127
- }): CliStructuredError;
128
- /**
129
- * Migration planning failed due to conflicts.
130
- */
131
- declare function errorMigrationPlanningFailed(options: {
132
- readonly conflicts: readonly CliErrorConflict[];
133
- readonly why?: string;
134
- }): CliStructuredError;
135
- /**
136
- * Target does not support migrations (missing createPlanner/createRunner).
137
- */
138
- declare function errorTargetMigrationNotSupported(options?: {
139
- readonly why?: string;
140
- }): CliStructuredError;
141
- /**
142
- * Config validation error (missing required fields).
143
- */
144
- declare function errorConfigValidation(field: string, options?: {
145
- readonly why?: string;
146
- }): CliStructuredError;
147
- /**
148
- * Contract marker not found in database.
149
- */
150
- declare function errorMarkerMissing(options?: {
151
- readonly why?: string;
152
- readonly dbUrl?: string;
153
- }): CliStructuredError;
154
- /**
155
- * Contract hash does not match database marker.
156
- */
157
- declare function errorHashMismatch(options?: {
158
- readonly why?: string;
159
- readonly expected?: string;
160
- readonly actual?: string;
161
- }): CliStructuredError;
162
- /**
163
- * Contract target does not match config target.
164
- */
165
- declare function errorTargetMismatch(expected: string, actual: string, options?: {
166
- readonly why?: string;
167
- }): CliStructuredError;
168
- /**
169
- * Generic runtime error.
170
- */
171
- declare function errorRuntime(summary: string, options?: {
172
- readonly why?: string;
173
- readonly fix?: string;
174
- readonly meta?: Record<string, unknown>;
175
- }): CliStructuredError;
176
- /**
177
- * Generic unexpected error.
178
- */
179
- declare function errorUnexpected(message: string, options?: {
180
- readonly why?: string;
181
- readonly fix?: string;
182
- }): CliStructuredError;
183
-
184
- export { type CliErrorConflict, type CliErrorEnvelope, CliStructuredError, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed, errorDatabaseUrlRequired, errorDriverRequired, errorFamilyReadMarkerSqlRequired, errorFileNotFound, errorHashMismatch, errorJsonFormatNotSupported, errorMarkerMissing, errorMigrationPlanningFailed, errorQueryRunnerFactoryRequired, errorRuntime, errorTargetMigrationNotSupported, errorTargetMismatch, errorUnexpected };
1
+ export type { CliErrorConflict, CliErrorEnvelope } from '../errors';
2
+ export { CliStructuredError, errorConfigFileNotFound, errorConfigValidation, errorContractConfigMissing, errorContractMissingExtensionPacks, errorContractValidationFailed, errorDatabaseUrlRequired, errorDriverRequired, errorFamilyReadMarkerSqlRequired, errorFileNotFound, errorHashMismatch, errorJsonFormatNotSupported, errorMarkerMissing, errorMigrationPlanningFailed, errorQueryRunnerFactoryRequired, errorRuntime, errorTargetMigrationNotSupported, errorTargetMismatch, errorUnexpected, } from '../errors';
3
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/exports/errors.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,kCAAkC,EAClC,6BAA6B,EAC7B,wBAAwB,EACxB,mBAAmB,EACnB,gCAAgC,EAChC,iBAAiB,EACjB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAC/B,YAAY,EACZ,gCAAgC,EAChC,mBAAmB,EACnB,eAAe,GAChB,MAAM,WAAW,CAAC"}
@@ -1,87 +1,2 @@
1
- /**
2
- * Core schema view types for family-agnostic schema visualization.
3
- *
4
- * These types provide a minimal, generic, tree-shaped representation of schemas
5
- * across families, designed for CLI visualization and lightweight tooling.
6
- *
7
- * Families can optionally project their family-specific Schema IR into this
8
- * core view via the `toSchemaView` method on `FamilyInstance`.
9
- *
10
- * ## Example: SQL Family Mapping
11
- *
12
- * For the SQL family, `SqlSchemaIR` can be mapped to `CoreSchemaView` as follows:
13
- *
14
- * ```ts
15
- * // SqlSchemaIR structure:
16
- * // {
17
- * // tables: { user: { columns: {...}, primaryKey: {...}, ... }, ... },
18
- * // extensions: ['pgvector'],
19
- * // annotations: {...}
20
- * // }
21
- *
22
- * // CoreSchemaView mapping:
23
- * // {
24
- * // root: {
25
- * // kind: 'root',
26
- * // id: 'sql-schema',
27
- * // label: 'sql schema (tables: 2)',
28
- * // children: [
29
- * // {
30
- * // kind: 'entity',
31
- * // id: 'table-user',
32
- * // label: 'table user',
33
- * // meta: { primaryKey: ['id'], ... },
34
- * // children: [
35
- * // {
36
- * // kind: 'field',
37
- * // id: 'column-id',
38
- * // label: 'id: int4 (pg/int4@1, not null)',
39
- * // meta: { nativeType: 'int4', codecId: 'pg/int4@1', nullable: false, ... }
40
- * // },
41
- * // {
42
- * // kind: 'index',
43
- * // id: 'index-user-email',
44
- * // label: 'index user_email_unique',
45
- * // meta: { columns: ['email'], unique: true, ... }
46
- * // }
47
- * // ]
48
- * // },
49
- * // {
50
- * // kind: 'extension',
51
- * // id: 'extension-pgvector',
52
- * // label: 'extension pgvector',
53
- * // meta: { ... }
54
- * // }
55
- * // ]
56
- * // }
57
- * // }
58
- * ```
59
- *
60
- * This mapping demonstrates that the core view types are expressive enough
61
- * to represent SQL schemas without being SQL-specific.
62
- */
63
- /**
64
- * Node kinds for schema tree nodes.
65
- * Designed to be generic enough for SQL, document, KV, and future families.
66
- */
67
- type SchemaNodeKind = 'root' | 'namespace' | 'collection' | 'entity' | 'field' | 'index' | 'extension';
68
- /**
69
- * A node in the schema tree.
70
- * Tree-shaped structure good for Command Tree-style CLI output.
71
- */
72
- interface SchemaTreeNode {
73
- readonly kind: SchemaNodeKind;
74
- readonly id: string;
75
- readonly label: string;
76
- readonly meta?: Record<string, unknown>;
77
- readonly children?: readonly SchemaTreeNode[];
78
- }
79
- /**
80
- * Core schema view providing a family-agnostic tree representation of a schema.
81
- * Used by CLI and cross-family tooling for visualization.
82
- */
83
- interface CoreSchemaView {
84
- readonly root: SchemaTreeNode;
85
- }
86
-
87
- export type { CoreSchemaView, SchemaNodeKind, SchemaTreeNode };
1
+ export type { CoreSchemaView, SchemaNodeKind, SchemaTreeNode } from '../schema-view';
2
+ //# sourceMappingURL=schema-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-view.d.ts","sourceRoot":"","sources":["../../src/exports/schema-view.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}