@typed-sql/core 2.0.0 → 2.1.0

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 (34) hide show
  1. package/CHANGELOG.md +236 -0
  2. package/dist/packages/core/src/artifact-compatibility.d.ts +46 -0
  3. package/dist/packages/core/src/artifact-compatibility.d.ts.map +1 -0
  4. package/dist/packages/core/src/artifact-compatibility.js +168 -0
  5. package/dist/packages/core/src/artifact-compatibility.js.map +1 -0
  6. package/dist/packages/core/src/debug.d.ts +39 -0
  7. package/dist/packages/core/src/debug.d.ts.map +1 -0
  8. package/dist/packages/core/src/debug.js +87 -0
  9. package/dist/packages/core/src/debug.js.map +1 -0
  10. package/dist/packages/core/src/diagnostics.d.ts +112 -0
  11. package/dist/packages/core/src/diagnostics.d.ts.map +1 -1
  12. package/dist/packages/core/src/diagnostics.js +28 -0
  13. package/dist/packages/core/src/diagnostics.js.map +1 -1
  14. package/dist/packages/core/src/dialect-capabilities.d.ts +63 -0
  15. package/dist/packages/core/src/dialect-capabilities.d.ts.map +1 -0
  16. package/dist/packages/core/src/dialect-capabilities.js +287 -0
  17. package/dist/packages/core/src/dialect-capabilities.js.map +1 -0
  18. package/dist/packages/core/src/index.d.ts +10 -4
  19. package/dist/packages/core/src/index.d.ts.map +1 -1
  20. package/dist/packages/core/src/index.js +4 -1
  21. package/dist/packages/core/src/index.js.map +1 -1
  22. package/dist/packages/core/src/query.d.ts +43 -5
  23. package/dist/packages/core/src/query.d.ts.map +1 -1
  24. package/dist/packages/core/src/query.js +182 -9
  25. package/dist/packages/core/src/query.js.map +1 -1
  26. package/dist/packages/core/src/resolver.d.ts +10 -3
  27. package/dist/packages/core/src/resolver.d.ts.map +1 -1
  28. package/dist/packages/core/src/resolver.js +95 -3
  29. package/dist/packages/core/src/resolver.js.map +1 -1
  30. package/dist/packages/core/src/types.d.ts +89 -1
  31. package/dist/packages/core/src/types.d.ts.map +1 -1
  32. package/dist/packages/core/src/types.js +9 -0
  33. package/dist/packages/core/src/types.js.map +1 -1
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,241 @@
1
1
  # @typed-sql/core
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1041bfa: Add the versioned, serializable source-analysis service shared by batch checks and editor tooling.
8
+ Results carry deterministic source, project, schema, type-policy, grammar, and capability identities;
9
+ cancellation and source, query-count, structural-variant, and generated-declaration limits fail closed.
10
+ - 1041bfa: Add a grammar-neutral serialized artifact compatibility identity and deterministic compatibility outcomes, and use the shared identity contract for query-manifest cache reuse.
11
+ - 1041bfa: Add structured opt-in debug events and confirmed support-bundle generation with privacy-safe default redaction.
12
+ - 1041bfa: Allow non-empty arrays of typed SQL fragments to be interpolated directly as homogeneous,
13
+ comma-separated structure. Add fail-closed compiler analysis for direct map callbacks and fragment
14
+ literals, cardinality-independent artifacts, bounded prepared-cardinality caches, shared grammar
15
+ conformance, and runtime limits while preserving ordinary arrays as single bound values.
16
+ - 1041bfa: Add neutral column charset and collation evidence, generated versioned MySQL built-in catalogs,
17
+ catalog-backed type and function availability, MySQL collation coercibility, and signed/unsigned
18
+ numeric expression resolution.
19
+ Conformance v2 now compares grammar analysis against the neutral resolved-column contract while
20
+ allowing grammar-owned result evidence.
21
+ - 1041bfa: Resolve PostgreSQL operators and snapshot v2 routines through a grammar-owned candidate selector
22
+ that uses canonical types, cast contexts, preferred categories, unknown-literal rules, domains,
23
+ arrays, ranges, enums, and the `anyelement` and `anycompatible` polymorphic families.
24
+ Named, defaulted, expanded-variadic, and explicit-variadic routine calls now select against snapshot
25
+ argument evidence, while known invalid explicit casts produce a stable diagnostic.
26
+ The versioned core catalog now recognizes PostgreSQL temporal, bit-string, network, geometric,
27
+ full-text, XML, range, multirange, object-identifier, and related scalar types. Unary numeric and
28
+ bitwise operators, plus binary integer and bit-string operators, now resolve through typed
29
+ candidates and reject invalid operands. Date, timestamp, time, and interval arithmetic now uses
30
+ asymmetric PostgreSQL signatures, with parameter inference deferred until candidate selection.
31
+ Built-in range/multirange containment and arithmetic, network containment and address arithmetic,
32
+ full-text search composition, JSON-path predicates and deletion, and their multi-character tokens
33
+ now use exact grammar-owned signatures.
34
+ Geometric transformation, position, intersection, distance, containment, and relationship operators
35
+ now resolve through their exact operand and result signatures, including prefix forms.
36
+ Numeric promotion, mathematical prefix, bit-string shift, binary/JSON/text concatenation, money,
37
+ `pg_lsn`, and tuple-identifier operators now use catalog-derived signatures and coercions.
38
+ Array subscripts infer nullable element types, slices preserve the array type, omitted bounds are
39
+ represented explicitly, index parameters infer `integer`, and nested array mappings retain every dimension.
40
+ `ANY`, `SOME`, and `ALL` comparisons now resolve array elements or single-column subqueries through
41
+ the operator catalog, while row comparisons validate arity and select an operator for each field pair.
42
+ Parenthesized composite field selection now uses snapshot v2 field evidence for its database type,
43
+ TypeScript type, nullability, parameter context, and unknown-field diagnostics.
44
+ `COLLATE` now preserves collatable expression types, and `AT TIME ZONE` resolves PostgreSQL's exact
45
+ timestamp, timestamp-with-time-zone, and time-with-time-zone conversions with text or interval zones.
46
+ PostgreSQL 17 and newer also resolve and version-gate the corresponding `AT LOCAL` forms.
47
+ Scalar and row-valued `IN` lists and subqueries now validate equality candidates, numeric literals,
48
+ row arity, composite field comparability, nullability, and per-position parameter contexts.
49
+ The versioned cast catalogs now include every direct `pg_cast` conversion among shipped core types
50
+ for PostgreSQL 14 through 18, including the PostgreSQL 15 geometric removal and PostgreSQL 18
51
+ integer/bytea additions. Automatic assignment-to-string and explicit string I/O casts follow the
52
+ server's fallback conversion rules.
53
+ PostgreSQL interval literals now parse prefix precision, every valid field and field-range qualifier,
54
+ suffix second precision, and qualified interval cast types while retaining typed-literal source spans.
55
+ All forms resolve through the canonical `interval` type, and invalid field ranges fail during parsing.
56
+ JSON, JSONB, and JSONPATH typed literals now preserve their grammar-owned cast form. The core catalog
57
+ and resolver cover `jsonb_path_exists`, `jsonb_path_match`, query-array, query-first, and set-returning
58
+ query variants, including timezone-aware forms, optional variables/silent arguments, and nullability.
59
+ Database parameter identities are now retained even when their configured TypeScript mapping is
60
+ `unknown`, so JSON and other deliberately opaque codecs still produce typed prepared parameters.
61
+ PostgreSQL 17 and newer now parse and resolve the grammar-owned `JSON_EXISTS` SQL/JSON expression,
62
+ including formatted inputs, `PASSING` variables, error behavior, parameter identities, nullability,
63
+ and server-version diagnostics.
64
+ The grammar-owned PostgreSQL 17 `JSON_QUERY` form also resolves returning types, JSON output formats,
65
+ wrapper and quote behavior, constant `ON EMPTY` and `ON ERROR` defaults, and exact output nullability.
66
+ PostgreSQL 17 `JSON_VALUE` now resolves scalar return types and behaviors while preserving its
67
+ always-possible SQL null result for JSON null and rejecting unsupported collection or format clauses.
68
+ PostgreSQL 16 and newer now parse and resolve the standard `JSON_OBJECT` and `JSON_ARRAY`
69
+ constructors, including key/value and query forms, null handling, unique-key declarations, formatted
70
+ inputs, encoded returns, parameter identities, non-null output types, and server-version diagnostics.
71
+ Legacy and quoted `json_object(...)` calls remain ordinary catalog-backed routine calls.
72
+ PostgreSQL 17 and newer also own `JSON`, `JSON_SCALAR`, and `JSON_SERIALIZE`, including JSON-compatible
73
+ inputs, uniqueness declarations, scalar and composite conversion, string or binary returns, UTF-8
74
+ encoding, parameter inference, null propagation, and version diagnostics. The overlapping pre-17
75
+ functional `json(...)` cast keeps its earlier cast semantics.
76
+ PostgreSQL 16 and newer now own `IS JSON` and `IS NOT JSON` predicates across value, scalar,
77
+ array, object, and unique-key constraints, with JSON-compatible input validation, text parameter
78
+ inference, SQL-null propagation, and server-version diagnostics.
79
+ PostgreSQL 16 and newer now also own the standard `JSON_OBJECTAGG` and `JSON_ARRAYAGG` grammar,
80
+ including null and uniqueness clauses, aggregate-local ordering, `FILTER`, `OVER`, formatted inputs,
81
+ encoded returns, grouping validation, parameter inference, nullable empty-input results, and
82
+ server-version diagnostics.
83
+ PostgreSQL 17 `JSON_TABLE` now owns its table-reference grammar and resolves root, ordinality,
84
+ scalar, formatted, `EXISTS`, and nested columns with implicit lateral scope, alias lists, declared
85
+ types, behavior validation, nested null-padding, and server-version diagnostics.
86
+
87
+ Expose optional routine argument names and default evidence through the neutral resolver bridge so
88
+ grammar packages can implement named, defaulted, and variadic call selection.
89
+ - 1041bfa: Complete PostgreSQL DML parsing and analysis for identity overriding, `ON CONFLICT` targets and the
90
+ `excluded` namespace, row assignments, source-aware update/delete returning, versioned `MERGE`, and
91
+ PostgreSQL 18 old/new `RETURNING` aliases. Version-dependent forms now use server-major evidence and
92
+ fail closed when that evidence is absent or outside the feature's supported range. Snapshot v2 index
93
+ evidence now verifies expression, operator-class, collation, and partial-predicate conflict targets,
94
+ while insert/select, update, and merge writes propagate parameter types and reject known-incompatible
95
+ source types.
96
+
97
+ The neutral resolver snapshot bridge now exposes optional index and constraint-deferrability evidence
98
+ so grammar packages can consume schema v2 conflict-target metadata without importing schema internals.
99
+ - 1041bfa: Add canonical schema snapshot format 2 with isolated v1/v2 codecs, conservative v1 upgrades,
100
+ neutral relation/constraint/index/type/routine evidence, and complete provider introspection.
101
+ Resolvers now consume structural write and routine evidence, while drift, compatibility, manifests,
102
+ verification proofs, and plan artifacts bind to the schema format and canonical hash.
103
+ - 1041bfa: Add deterministic versioned dialect capability states backed by normalized server versions,
104
+ settings, extensions, and compile options. Query manifests now invalidate on capability changes and
105
+ record evidence for capabilities each query uses, while the CLI exposes a human-readable capability
106
+ report. The boolean capability map remains available as an additive migration bridge.
107
+
108
+ ### Patch Changes
109
+
110
+ - 1041bfa: Harden PostgreSQL execution with policy-owned scalar and array codecs, runtime extension codec OID
111
+ resolution, generated-snapshot compatibility checks, bounded per-connection prepared-statement
112
+ caches with schema and search-path invalidation, and structured driver failure classifications.
113
+ Keep the shared `TSQ230` diagnostic registry text grammar-neutral.
114
+ - 1041bfa: Resolve SQLite core built-ins, operators, coercions, arities, nullability, and in-band function
115
+ release boundaries from SQLite-owned catalog data. Add a stable diagnostic for invalid SQLite
116
+ built-in invocations and fail closed when version-gated functions lack usable server evidence.
117
+
118
+ ## 2.1.0-rc.1
119
+
120
+ ### Patch Changes
121
+
122
+ - Publish the coherent 2.1.0-rc.1 release-candidate train.
123
+
124
+ ## 2.1.0-rc.0
125
+
126
+ ### Minor Changes
127
+
128
+ - 58bd4d1: Add the versioned, serializable source-analysis service shared by batch checks and editor tooling.
129
+ Results carry deterministic source, project, schema, type-policy, grammar, and capability identities;
130
+ cancellation and source, query-count, structural-variant, and generated-declaration limits fail closed.
131
+ - 58aa9ef: Add a grammar-neutral serialized artifact compatibility identity and deterministic compatibility outcomes, and use the shared identity contract for query-manifest cache reuse.
132
+ - 65b662f: Add structured opt-in debug events and confirmed support-bundle generation with privacy-safe default redaction.
133
+ - e433feb: Allow non-empty arrays of typed SQL fragments to be interpolated directly as homogeneous,
134
+ comma-separated structure. Add fail-closed compiler analysis for direct map callbacks and fragment
135
+ literals, cardinality-independent artifacts, bounded prepared-cardinality caches, shared grammar
136
+ conformance, and runtime limits while preserving ordinary arrays as single bound values.
137
+ - 0efc90c: Add neutral column charset and collation evidence, generated versioned MySQL built-in catalogs,
138
+ catalog-backed type and function availability, MySQL collation coercibility, and signed/unsigned
139
+ numeric expression resolution.
140
+ Conformance v2 now compares grammar analysis against the neutral resolved-column contract while
141
+ allowing grammar-owned result evidence.
142
+ - 6f5b977: Resolve PostgreSQL operators and snapshot v2 routines through a grammar-owned candidate selector
143
+ that uses canonical types, cast contexts, preferred categories, unknown-literal rules, domains,
144
+ arrays, ranges, enums, and the `anyelement` and `anycompatible` polymorphic families.
145
+ Named, defaulted, expanded-variadic, and explicit-variadic routine calls now select against snapshot
146
+ argument evidence, while known invalid explicit casts produce a stable diagnostic.
147
+ The versioned core catalog now recognizes PostgreSQL temporal, bit-string, network, geometric,
148
+ full-text, XML, range, multirange, object-identifier, and related scalar types. Unary numeric and
149
+ bitwise operators, plus binary integer and bit-string operators, now resolve through typed
150
+ candidates and reject invalid operands. Date, timestamp, time, and interval arithmetic now uses
151
+ asymmetric PostgreSQL signatures, with parameter inference deferred until candidate selection.
152
+ Built-in range/multirange containment and arithmetic, network containment and address arithmetic,
153
+ full-text search composition, JSON-path predicates and deletion, and their multi-character tokens
154
+ now use exact grammar-owned signatures.
155
+ Geometric transformation, position, intersection, distance, containment, and relationship operators
156
+ now resolve through their exact operand and result signatures, including prefix forms.
157
+ Numeric promotion, mathematical prefix, bit-string shift, binary/JSON/text concatenation, money,
158
+ `pg_lsn`, and tuple-identifier operators now use catalog-derived signatures and coercions.
159
+ Array subscripts infer nullable element types, slices preserve the array type, omitted bounds are
160
+ represented explicitly, index parameters infer `integer`, and nested array mappings retain every dimension.
161
+ `ANY`, `SOME`, and `ALL` comparisons now resolve array elements or single-column subqueries through
162
+ the operator catalog, while row comparisons validate arity and select an operator for each field pair.
163
+ Parenthesized composite field selection now uses snapshot v2 field evidence for its database type,
164
+ TypeScript type, nullability, parameter context, and unknown-field diagnostics.
165
+ `COLLATE` now preserves collatable expression types, and `AT TIME ZONE` resolves PostgreSQL's exact
166
+ timestamp, timestamp-with-time-zone, and time-with-time-zone conversions with text or interval zones.
167
+ PostgreSQL 17 and newer also resolve and version-gate the corresponding `AT LOCAL` forms.
168
+ Scalar and row-valued `IN` lists and subqueries now validate equality candidates, numeric literals,
169
+ row arity, composite field comparability, nullability, and per-position parameter contexts.
170
+ The versioned cast catalogs now include every direct `pg_cast` conversion among shipped core types
171
+ for PostgreSQL 14 through 18, including the PostgreSQL 15 geometric removal and PostgreSQL 18
172
+ integer/bytea additions. Automatic assignment-to-string and explicit string I/O casts follow the
173
+ server's fallback conversion rules.
174
+ PostgreSQL interval literals now parse prefix precision, every valid field and field-range qualifier,
175
+ suffix second precision, and qualified interval cast types while retaining typed-literal source spans.
176
+ All forms resolve through the canonical `interval` type, and invalid field ranges fail during parsing.
177
+ JSON, JSONB, and JSONPATH typed literals now preserve their grammar-owned cast form. The core catalog
178
+ and resolver cover `jsonb_path_exists`, `jsonb_path_match`, query-array, query-first, and set-returning
179
+ query variants, including timezone-aware forms, optional variables/silent arguments, and nullability.
180
+ Database parameter identities are now retained even when their configured TypeScript mapping is
181
+ `unknown`, so JSON and other deliberately opaque codecs still produce typed prepared parameters.
182
+ PostgreSQL 17 and newer now parse and resolve the grammar-owned `JSON_EXISTS` SQL/JSON expression,
183
+ including formatted inputs, `PASSING` variables, error behavior, parameter identities, nullability,
184
+ and server-version diagnostics.
185
+ The grammar-owned PostgreSQL 17 `JSON_QUERY` form also resolves returning types, JSON output formats,
186
+ wrapper and quote behavior, constant `ON EMPTY` and `ON ERROR` defaults, and exact output nullability.
187
+ PostgreSQL 17 `JSON_VALUE` now resolves scalar return types and behaviors while preserving its
188
+ always-possible SQL null result for JSON null and rejecting unsupported collection or format clauses.
189
+ PostgreSQL 16 and newer now parse and resolve the standard `JSON_OBJECT` and `JSON_ARRAY`
190
+ constructors, including key/value and query forms, null handling, unique-key declarations, formatted
191
+ inputs, encoded returns, parameter identities, non-null output types, and server-version diagnostics.
192
+ Legacy and quoted `json_object(...)` calls remain ordinary catalog-backed routine calls.
193
+ PostgreSQL 17 and newer also own `JSON`, `JSON_SCALAR`, and `JSON_SERIALIZE`, including JSON-compatible
194
+ inputs, uniqueness declarations, scalar and composite conversion, string or binary returns, UTF-8
195
+ encoding, parameter inference, null propagation, and version diagnostics. The overlapping pre-17
196
+ functional `json(...)` cast keeps its earlier cast semantics.
197
+ PostgreSQL 16 and newer now own `IS JSON` and `IS NOT JSON` predicates across value, scalar,
198
+ array, object, and unique-key constraints, with JSON-compatible input validation, text parameter
199
+ inference, SQL-null propagation, and server-version diagnostics.
200
+ PostgreSQL 16 and newer now also own the standard `JSON_OBJECTAGG` and `JSON_ARRAYAGG` grammar,
201
+ including null and uniqueness clauses, aggregate-local ordering, `FILTER`, `OVER`, formatted inputs,
202
+ encoded returns, grouping validation, parameter inference, nullable empty-input results, and
203
+ server-version diagnostics.
204
+ PostgreSQL 17 `JSON_TABLE` now owns its table-reference grammar and resolves root, ordinality,
205
+ scalar, formatted, `EXISTS`, and nested columns with implicit lateral scope, alias lists, declared
206
+ types, behavior validation, nested null-padding, and server-version diagnostics.
207
+
208
+ Expose optional routine argument names and default evidence through the neutral resolver bridge so
209
+ grammar packages can implement named, defaulted, and variadic call selection.
210
+ - 1c64475: Complete PostgreSQL DML parsing and analysis for identity overriding, `ON CONFLICT` targets and the
211
+ `excluded` namespace, row assignments, source-aware update/delete returning, versioned `MERGE`, and
212
+ PostgreSQL 18 old/new `RETURNING` aliases. Version-dependent forms now use server-major evidence and
213
+ fail closed when that evidence is absent or outside the feature's supported range. Snapshot v2 index
214
+ evidence now verifies expression, operator-class, collation, and partial-predicate conflict targets,
215
+ while insert/select, update, and merge writes propagate parameter types and reject known-incompatible
216
+ source types.
217
+
218
+ The neutral resolver snapshot bridge now exposes optional index and constraint-deferrability evidence
219
+ so grammar packages can consume schema v2 conflict-target metadata without importing schema internals.
220
+ - 1c64475: Add canonical schema snapshot format 2 with isolated v1/v2 codecs, conservative v1 upgrades,
221
+ neutral relation/constraint/index/type/routine evidence, and complete provider introspection.
222
+ Resolvers now consume structural write and routine evidence, while drift, compatibility, manifests,
223
+ verification proofs, and plan artifacts bind to the schema format and canonical hash.
224
+ - 1c64475: Add deterministic versioned dialect capability states backed by normalized server versions,
225
+ settings, extensions, and compile options. Query manifests now invalidate on capability changes and
226
+ record evidence for capabilities each query uses, while the CLI exposes a human-readable capability
227
+ report. The boolean capability map remains available as an additive migration bridge.
228
+
229
+ ### Patch Changes
230
+
231
+ - ff0e3bb: Harden PostgreSQL execution with policy-owned scalar and array codecs, runtime extension codec OID
232
+ resolution, generated-snapshot compatibility checks, bounded per-connection prepared-statement
233
+ caches with schema and search-path invalidation, and structured driver failure classifications.
234
+ Keep the shared `TSQ230` diagnostic registry text grammar-neutral.
235
+ - 1c64475: Resolve SQLite core built-ins, operators, coercions, arities, nullability, and in-band function
236
+ release boundaries from SQLite-owned catalog data. Add a stable diagnostic for invalid SQLite
237
+ built-in invocations and fail closed when version-gated functions lack usable server evidence.
238
+
3
239
  ## 2.0.0
4
240
 
5
241
  ### Major Changes
@@ -0,0 +1,46 @@
1
+ export declare const ARTIFACT_COMPATIBILITY_IDENTITY_FORMAT_VERSION: 1;
2
+ export declare const CORE_ARTIFACT_COMPATIBILITY_VERSION: "typed-sql-core-v1";
3
+ export type ArtifactCompatibilityOutcome = "compatible" | "requires-reanalysis" | "requires-reintrospection" | "unsupported-target" | "corrupt-artifact";
4
+ export interface ArtifactCompatibilityIdentity {
5
+ readonly formatVersion: typeof ARTIFACT_COMPATIBILITY_IDENTITY_FORMAT_VERSION;
6
+ readonly artifact: {
7
+ readonly kind: string;
8
+ readonly version: string;
9
+ readonly algorithm?: string;
10
+ };
11
+ readonly producer: {
12
+ readonly core: string;
13
+ readonly compiler?: string;
14
+ };
15
+ readonly grammar: {
16
+ readonly id: string;
17
+ readonly version: string;
18
+ readonly catalogRevision?: string;
19
+ readonly capabilityFingerprint: string;
20
+ };
21
+ readonly server?: {
22
+ readonly product: string;
23
+ readonly version: string;
24
+ readonly capabilityFingerprint: string;
25
+ };
26
+ readonly schema: {
27
+ readonly formatVersion: 1 | 2;
28
+ readonly hash: string;
29
+ };
30
+ readonly typePolicyHash: string;
31
+ readonly runtimeSettingsHash?: string;
32
+ readonly source?: {
33
+ readonly hash: string;
34
+ readonly query?: string;
35
+ };
36
+ readonly extensions?: Readonly<Record<string, unknown>>;
37
+ }
38
+ export interface ArtifactCompatibilityAssessment {
39
+ readonly outcome: ArtifactCompatibilityOutcome;
40
+ readonly reasons: readonly string[];
41
+ readonly candidate?: ArtifactCompatibilityIdentity;
42
+ }
43
+ export declare function parseArtifactCompatibilityIdentity(value: unknown): ArtifactCompatibilityIdentity;
44
+ export declare function serializeArtifactCompatibilityIdentity(identity: ArtifactCompatibilityIdentity): string;
45
+ export declare function assessArtifactCompatibility(referenceValue: ArtifactCompatibilityIdentity, candidateValue: unknown): ArtifactCompatibilityAssessment;
46
+ //# sourceMappingURL=artifact-compatibility.d.ts.map
@@ -0,0 +1 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IACF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,4BAA4B,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,6BAA6B,CAAC;CACpD;AAoCD,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,6BAA6B,CA0FhG;AAED,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,6BAA6B,GAAG,MAAM,CAEtG;AAED,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,6BAA6B,EAC7C,cAAc,EAAE,OAAO,GACtB,+BAA+B,CAwDjC"}
@@ -0,0 +1,168 @@
1
+ export const ARTIFACT_COMPATIBILITY_IDENTITY_FORMAT_VERSION = 1;
2
+ export const CORE_ARTIFACT_COMPATIBILITY_VERSION = "typed-sql-core-v1";
3
+ const record = (value) => typeof value === "object" && value !== null;
4
+ function keys(value, allowed, path) {
5
+ const unknown = Object.keys(value).filter((key) => !allowed.includes(key));
6
+ if (unknown.length > 0)
7
+ throw new TypeError(`${path} contains unknown fields: ${unknown.sort().join(", ")}`);
8
+ }
9
+ function text(value, path) {
10
+ if (typeof value !== "string" || value.length === 0 || value.includes("\0")) {
11
+ throw new TypeError(`${path} must be a non-empty string without null bytes`);
12
+ }
13
+ return value;
14
+ }
15
+ function object(value, path) {
16
+ if (!record(value) || Array.isArray(value))
17
+ throw new TypeError(`${path} must be an object`);
18
+ return value;
19
+ }
20
+ function jsonValue(value, path) {
21
+ if (value === null || typeof value === "string" || typeof value === "boolean")
22
+ return value;
23
+ if (typeof value === "number") {
24
+ if (!Number.isFinite(value))
25
+ throw new TypeError(`${path} must contain finite JSON numbers`);
26
+ return value;
27
+ }
28
+ if (Array.isArray(value))
29
+ return value.map((item, index) => jsonValue(item, `${path}[${index}]`));
30
+ const source = object(value, path);
31
+ return Object.fromEntries(Object.keys(source)
32
+ .sort()
33
+ .map((key) => [key, jsonValue(source[key], `${path}.${key}`)]));
34
+ }
35
+ export function parseArtifactCompatibilityIdentity(value) {
36
+ const root = object(value, "artifact compatibility identity");
37
+ keys(root, [
38
+ "formatVersion",
39
+ "artifact",
40
+ "producer",
41
+ "grammar",
42
+ "server",
43
+ "schema",
44
+ "typePolicyHash",
45
+ "runtimeSettingsHash",
46
+ "source",
47
+ "extensions",
48
+ ], "artifact compatibility identity");
49
+ if (root.formatVersion !== ARTIFACT_COMPATIBILITY_IDENTITY_FORMAT_VERSION) {
50
+ throw new TypeError(`Unsupported artifact compatibility identity format ${String(root.formatVersion)}`);
51
+ }
52
+ const artifact = object(root.artifact, "identity.artifact");
53
+ keys(artifact, ["kind", "version", "algorithm"], "identity.artifact");
54
+ const producer = object(root.producer, "identity.producer");
55
+ keys(producer, ["core", "compiler"], "identity.producer");
56
+ const grammar = object(root.grammar, "identity.grammar");
57
+ keys(grammar, ["id", "version", "catalogRevision", "capabilityFingerprint"], "identity.grammar");
58
+ const schema = object(root.schema, "identity.schema");
59
+ keys(schema, ["formatVersion", "hash"], "identity.schema");
60
+ if (schema.formatVersion !== 1 && schema.formatVersion !== 2) {
61
+ throw new TypeError("identity.schema.formatVersion must be 1 or 2");
62
+ }
63
+ const server = root.server === undefined ? undefined : object(root.server, "identity.server");
64
+ if (server !== undefined)
65
+ keys(server, ["product", "version", "capabilityFingerprint"], "identity.server");
66
+ const source = root.source === undefined ? undefined : object(root.source, "identity.source");
67
+ if (source !== undefined)
68
+ keys(source, ["hash", "query"], "identity.source");
69
+ const extensions = root.extensions === undefined
70
+ ? undefined
71
+ : jsonValue(object(root.extensions, "identity.extensions"), "identity.extensions");
72
+ return Object.freeze({
73
+ formatVersion: ARTIFACT_COMPATIBILITY_IDENTITY_FORMAT_VERSION,
74
+ artifact: Object.freeze({
75
+ kind: text(artifact.kind, "identity.artifact.kind"),
76
+ version: text(artifact.version, "identity.artifact.version"),
77
+ ...(artifact.algorithm === undefined
78
+ ? {}
79
+ : { algorithm: text(artifact.algorithm, "identity.artifact.algorithm") }),
80
+ }),
81
+ producer: Object.freeze({
82
+ core: text(producer.core, "identity.producer.core"),
83
+ ...(producer.compiler === undefined ? {} : { compiler: text(producer.compiler, "identity.producer.compiler") }),
84
+ }),
85
+ grammar: Object.freeze({
86
+ id: text(grammar.id, "identity.grammar.id"),
87
+ version: text(grammar.version, "identity.grammar.version"),
88
+ ...(grammar.catalogRevision === undefined
89
+ ? {}
90
+ : { catalogRevision: text(grammar.catalogRevision, "identity.grammar.catalogRevision") }),
91
+ capabilityFingerprint: text(grammar.capabilityFingerprint, "identity.grammar.capabilityFingerprint"),
92
+ }),
93
+ ...(server === undefined
94
+ ? {}
95
+ : {
96
+ server: Object.freeze({
97
+ product: text(server.product, "identity.server.product"),
98
+ version: text(server.version, "identity.server.version"),
99
+ capabilityFingerprint: text(server.capabilityFingerprint, "identity.server.capabilityFingerprint"),
100
+ }),
101
+ }),
102
+ schema: Object.freeze({
103
+ formatVersion: schema.formatVersion,
104
+ hash: text(schema.hash, "identity.schema.hash"),
105
+ }),
106
+ typePolicyHash: text(root.typePolicyHash, "identity.typePolicyHash"),
107
+ ...(root.runtimeSettingsHash === undefined
108
+ ? {}
109
+ : { runtimeSettingsHash: text(root.runtimeSettingsHash, "identity.runtimeSettingsHash") }),
110
+ ...(source === undefined
111
+ ? {}
112
+ : {
113
+ source: Object.freeze({
114
+ hash: text(source.hash, "identity.source.hash"),
115
+ ...(source.query === undefined ? {} : { query: text(source.query, "identity.source.query") }),
116
+ }),
117
+ }),
118
+ ...(extensions === undefined ? {} : { extensions: Object.freeze(extensions) }),
119
+ });
120
+ }
121
+ export function serializeArtifactCompatibilityIdentity(identity) {
122
+ return `${JSON.stringify(parseArtifactCompatibilityIdentity(identity), null, 2)}\n`;
123
+ }
124
+ export function assessArtifactCompatibility(referenceValue, candidateValue) {
125
+ const reference = parseArtifactCompatibilityIdentity(referenceValue);
126
+ let candidate;
127
+ try {
128
+ candidate = parseArtifactCompatibilityIdentity(candidateValue);
129
+ }
130
+ catch {
131
+ return Object.freeze({ outcome: "corrupt-artifact", reasons: Object.freeze(["identity-invalid"]) });
132
+ }
133
+ const unsupported = [];
134
+ const reintrospection = [];
135
+ const reanalysis = [];
136
+ const compare = (left, right, reason, target) => {
137
+ if (left !== undefined && left !== right)
138
+ target.push(reason);
139
+ };
140
+ compare(reference.artifact.kind, candidate.artifact.kind, "artifact-kind-changed", unsupported);
141
+ compare(reference.artifact.version, candidate.artifact.version, "artifact-version-changed", unsupported);
142
+ compare(reference.artifact.algorithm, candidate.artifact.algorithm, "artifact-algorithm-changed", unsupported);
143
+ compare(reference.producer.core, candidate.producer.core, "core-compatibility-changed", unsupported);
144
+ compare(reference.producer.compiler, candidate.producer.compiler, "compiler-compatibility-changed", reanalysis);
145
+ compare(reference.grammar.id, candidate.grammar.id, "grammar-changed", unsupported);
146
+ compare(reference.grammar.version, candidate.grammar.version, "grammar-version-changed", reintrospection);
147
+ compare(reference.grammar.catalogRevision, candidate.grammar.catalogRevision, "catalog-revision-changed", reintrospection);
148
+ compare(reference.grammar.capabilityFingerprint, candidate.grammar.capabilityFingerprint, "grammar-capabilities-changed", reintrospection);
149
+ compare(reference.server?.product, candidate.server?.product, "server-product-changed", reintrospection);
150
+ compare(reference.server?.version, candidate.server?.version, "server-version-changed", reintrospection);
151
+ compare(reference.server?.capabilityFingerprint, candidate.server?.capabilityFingerprint, "server-capabilities-changed", reintrospection);
152
+ if (reference.schema.formatVersion !== candidate.schema.formatVersion)
153
+ reintrospection.push("schema-format-changed");
154
+ compare(reference.schema.hash, candidate.schema.hash, "schema-changed", reanalysis);
155
+ compare(reference.typePolicyHash, candidate.typePolicyHash, "type-policy-changed", reanalysis);
156
+ compare(reference.runtimeSettingsHash, candidate.runtimeSettingsHash, "runtime-settings-changed", reintrospection);
157
+ compare(reference.source?.hash, candidate.source?.hash, "source-changed", reanalysis);
158
+ compare(reference.source?.query, candidate.source?.query, "query-changed", reanalysis);
159
+ const [outcome, reasons] = unsupported.length > 0
160
+ ? ["unsupported-target", unsupported]
161
+ : reintrospection.length > 0
162
+ ? ["requires-reintrospection", reintrospection]
163
+ : reanalysis.length > 0
164
+ ? ["requires-reanalysis", reanalysis]
165
+ : ["compatible", []];
166
+ return Object.freeze({ outcome, reasons: Object.freeze(reasons), candidate });
167
+ }
168
+ //# sourceMappingURL=artifact-compatibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-compatibility.js","sourceRoot":"","sources":["../../../../src/artifact-compatibility.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAAU,CAAC;AACzE,MAAM,CAAC,MAAM,mCAAmC,GAAG,mBAA4B,CAAC;AAkDhF,MAAM,MAAM,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAEjH,SAAS,IAAI,CAAC,KAA8B,EAAE,OAA0B,EAAE,IAAY;IACpF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3E,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,6BAA6B,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,C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AAC,CAAC;IACpF,OAAO,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;IAC/F,OAAO,CAAC,SAAS,CAAC,mBAAmB,EAAE,SAAS,CAAC,mBAAmB,EAAE,0BAA0B,EAAE,eAAe,CAAC,CAAC;IACnH,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACtF,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;IACvF,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GACtB,WAAW,CAAC,MAAM,GAAG,CAAC;QACpB,CAAC,CAAE,CAAC,oBAAoB,EAAE,WAAW,CAAW;QAChD,CAAC,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;YAC1B,CAAC,CAAE,CAAC,0BAA0B,EAAE,eAAe,CAAW;YAC1D,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;gBACrB,CAAC,CAAE,CAAC,qBAAqB,EAAE,UAAU,CAAW;gBAChD,CAAC,CAAE,CAAC,YAAY,EAAE,EAAE,CAAW,CAAC;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,39 @@
1
+ export declare const SUPPORT_BUNDLE_FORMAT_VERSION: 1;
2
+ export interface DebugRedactionOptions {
3
+ readonly includeSql?: boolean;
4
+ readonly includeIdentifiers?: boolean;
5
+ readonly includePaths?: boolean;
6
+ readonly includeDebugText?: boolean;
7
+ }
8
+ export interface DebugEventInput {
9
+ readonly phase: string;
10
+ readonly event: string;
11
+ readonly durationMilliseconds?: number;
12
+ readonly cache?: Readonly<Record<string, number>>;
13
+ readonly capability?: string;
14
+ readonly failure?: {
15
+ readonly code: string;
16
+ readonly classification: string;
17
+ };
18
+ readonly context?: unknown;
19
+ }
20
+ export interface DebugEvent extends Omit<DebugEventInput, "context"> {
21
+ readonly context?: unknown;
22
+ }
23
+ export interface SupportBundle {
24
+ readonly formatVersion: typeof SUPPORT_BUNDLE_FORMAT_VERSION;
25
+ readonly redaction: "default";
26
+ readonly inventory: {
27
+ readonly eventCount: number;
28
+ readonly phases: readonly string[];
29
+ readonly events: readonly string[];
30
+ readonly contextIncluded: boolean;
31
+ };
32
+ readonly environment: unknown;
33
+ readonly events: readonly DebugEvent[];
34
+ }
35
+ export declare function redactDebugContext(value: unknown, options?: DebugRedactionOptions): unknown;
36
+ export declare function createDebugEvent(input: DebugEventInput, options?: DebugRedactionOptions): DebugEvent;
37
+ export declare function createSupportBundle(events: readonly DebugEventInput[], environment?: unknown): SupportBundle;
38
+ export declare function serializeSupportBundle(bundle: SupportBundle): string;
39
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../../src/debug.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AAExD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,K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M,EAAE,aAAa,GAAG,MAAM,CAEpE"}
@@ -0,0 +1,87 @@
1
+ export const SUPPORT_BUNDLE_FORMAT_VERSION = 1;
2
+ const sensitiveKey = /(?:authorization|cookie|credential|password|secret|token|connection|string|dsn|parameter|params|values?)/iu;
3
+ const sqlKey = /(?:sql|query|source|statement|text)/iu;
4
+ const identifierKey = /(?:identifier|table|column|schema|relation|namespace)/iu;
5
+ const pathKey = /(?:file|path|cwd|root|uri|directory)/iu;
6
+ const safeTextKey = /^(?:backend|capability|category|classification|code|event|kind|operation|phase|releaseTrack|status|support|version)$/u;
7
+ function redact(value, options, key, seen, depth) {
8
+ if (depth > 8)
9
+ return "[redacted:depth-limit]";
10
+ if (sensitiveKey.test(key))
11
+ return "[redacted:sensitive]";
12
+ if (sqlKey.test(key) && options.includeSql !== true)
13
+ return "[redacted:sql]";
14
+ if (identifierKey.test(key) && options.includeIdentifiers !== true)
15
+ return "[redacted:identifier]";
16
+ if (pathKey.test(key) && options.includePaths !== true)
17
+ return "[redacted:path]";
18
+ if (value === null || typeof value === "boolean" || typeof value === "number")
19
+ return typeof value === "number" && !Number.isFinite(value) ? "[redacted:non-json-number]" : value;
20
+ if (typeof value === "string")
21
+ return options.includeDebugText === true || safeTextKey.test(key) ? value : "[redacted:text]";
22
+ if (typeof value !== "object")
23
+ return `[redacted:${typeof value}]`;
24
+ if (seen.has(value))
25
+ return "[redacted:cycle]";
26
+ seen.add(value);
27
+ if (Array.isArray(value))
28
+ return Object.freeze(value.slice(0, 256).map((item) => redact(item, options, key, seen, depth + 1)));
29
+ const entries = Object.entries(value)
30
+ .sort(([left], [right]) => left.localeCompare(right))
31
+ .slice(0, 256)
32
+ .map(([name, item]) => [name, redact(item, options, name, seen, depth + 1)]);
33
+ return Object.freeze(Object.fromEntries(entries));
34
+ }
35
+ export function redactDebugContext(value, options = {}) {
36
+ return redact(value, options, "context", new WeakSet(), 0);
37
+ }
38
+ function requiredText(value, path) {
39
+ if (typeof value !== "string" || value.length === 0)
40
+ throw new TypeError(`${path} must be a non-empty string`);
41
+ return value;
42
+ }
43
+ export function createDebugEvent(input, options = {}) {
44
+ const phase = requiredText(input.phase, "Debug event phase");
45
+ const event = requiredText(input.event, "Debug event name");
46
+ if (input.durationMilliseconds !== undefined &&
47
+ (!Number.isFinite(input.durationMilliseconds) || input.durationMilliseconds < 0)) {
48
+ throw new TypeError("Debug event durationMilliseconds must be a non-negative finite number");
49
+ }
50
+ return Object.freeze({
51
+ phase,
52
+ event,
53
+ ...(input.durationMilliseconds === undefined ? {} : { durationMilliseconds: input.durationMilliseconds }),
54
+ ...(input.cache === undefined
55
+ ? {}
56
+ : { cache: redactDebugContext(input.cache) }),
57
+ ...(input.capability === undefined ? {} : { capability: requiredText(input.capability, "Debug event capability") }),
58
+ ...(input.failure === undefined
59
+ ? {}
60
+ : {
61
+ failure: Object.freeze({
62
+ code: requiredText(input.failure.code, "Debug event failure code"),
63
+ classification: requiredText(input.failure.classification, "Debug event failure classification"),
64
+ }),
65
+ }),
66
+ ...(input.context === undefined ? {} : { context: redactDebugContext(input.context, options) }),
67
+ });
68
+ }
69
+ export function createSupportBundle(events, environment = {}) {
70
+ const redactedEvents = Object.freeze(events.map((event) => createDebugEvent(event)));
71
+ return Object.freeze({
72
+ formatVersion: SUPPORT_BUNDLE_FORMAT_VERSION,
73
+ redaction: "default",
74
+ inventory: Object.freeze({
75
+ eventCount: redactedEvents.length,
76
+ phases: Object.freeze([...new Set(redactedEvents.map(({ phase }) => phase))].sort()),
77
+ events: Object.freeze([...new Set(redactedEvents.map(({ event }) => event))].sort()),
78
+ contextIncluded: redactedEvents.some(({ context }) => context !== undefined),
79
+ }),
80
+ environment: redactDebugContext(environment),
81
+ events: redactedEvents,
82
+ });
83
+ }
84
+ export function serializeSupportBundle(bundle) {
85
+ return `${JSON.stringify(bundle, null, 2)}\n`;
86
+ }
87
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":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