@hypequery/protocol-conformance 0.0.0-canary-20260722115402
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/LICENSE +201 -0
- package/README.md +40 -0
- package/dist/adapters/generators.d.ts +13 -0
- package/dist/adapters/generators.d.ts.map +1 -0
- package/dist/adapters/generators.js +366 -0
- package/dist/adapters/reference.d.ts +6 -0
- package/dist/adapters/reference.d.ts.map +1 -0
- package/dist/adapters/reference.js +172 -0
- package/dist/adapters/stdio.d.ts +17 -0
- package/dist/adapters/stdio.d.ts.map +1 -0
- package/dist/adapters/stdio.js +80 -0
- package/dist/bin/conformance.d.ts +3 -0
- package/dist/bin/conformance.d.ts.map +1 -0
- package/dist/bin/conformance.js +84 -0
- package/dist/bin/reference-adapter.d.ts +3 -0
- package/dist/bin/reference-adapter.d.ts.map +1 -0
- package/dist/bin/reference-adapter.js +16 -0
- package/dist/compare.d.ts +3 -0
- package/dist/compare.d.ts.map +1 -0
- package/dist/compare.js +125 -0
- package/dist/fs.d.ts +11 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +36 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/manifest.d.ts +13 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +118 -0
- package/dist/report.d.ts +4 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +23 -0
- package/dist/runner.d.ts +12 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +197 -0
- package/dist/types.d.ts +84 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/fixtures/deployment-bundles-v1/README.md +61 -0
- package/fixtures/deployment-bundles-v1/identity.json +7 -0
- package/fixtures/deployment-bundles-v1/rejections.json +11 -0
- package/fixtures/deployment-bundles-v1/success.json +23 -0
- package/fixtures/deployment-releases-v1/README.md +36 -0
- package/fixtures/deployment-releases-v1/identity.json +7 -0
- package/fixtures/deployment-releases-v1/rejections.json +8 -0
- package/fixtures/deployment-releases-v1/success.json +14 -0
- package/fixtures/deployments-v1/README.md +77 -0
- package/fixtures/deployments-v1/identity.json +7 -0
- package/fixtures/deployments-v1/rejections.json +12 -0
- package/fixtures/deployments-v1/success.json +81 -0
- package/fixtures/expressions-v1/README.md +25 -0
- package/fixtures/expressions-v1/rejections.json +17 -0
- package/fixtures/expressions-v1/success.json +47 -0
- package/fixtures/fuzz-seeds-v1/README.md +29 -0
- package/fixtures/fuzz-seeds-v1/sql-expressions.json +32 -0
- package/fixtures/fuzz-seeds-v1/structured-values.json +32 -0
- package/fixtures/fuzz-seeds-v1/value-sources.json +191 -0
- package/fixtures/identifiers-v1/README.md +15 -0
- package/fixtures/identifiers-v1/rejections.json +58 -0
- package/fixtures/identifiers-v1/success.json +26 -0
- package/fixtures/manifest.json +117 -0
- package/fixtures/query-diagnostics-v1/README.md +49 -0
- package/fixtures/query-diagnostics-v1/rejections.json +13 -0
- package/fixtures/query-diagnostics-v1/success.json +27 -0
- package/fixtures/query-events-v1/README.md +60 -0
- package/fixtures/query-events-v1/rejections.json +18 -0
- package/fixtures/query-events-v1/success.json +40 -0
- package/fixtures/query-implementations-v1/README.md +33 -0
- package/fixtures/query-implementations-v1/rejections.json +80 -0
- package/fixtures/query-implementations-v1/success.json +96 -0
- package/fixtures/query-schemas-v1/README.md +25 -0
- package/fixtures/query-schemas-v1/rejections.json +15 -0
- package/fixtures/query-schemas-v1/success.json +17 -0
- package/fixtures/sql-portability-v1/README.md +15 -0
- package/fixtures/sql-portability-v1/non-portable.json +146 -0
- package/fixtures/sql-portability-v1/portable.json +346 -0
- package/fixtures/tagged-values-v1/README.md +44 -0
- package/fixtures/tagged-values-v1/rejections.json +298 -0
- package/fixtures/tagged-values-v1/success.json +262 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are advised to review the applicable
|
|
150
|
+
documentation for the specific language governing permissions and
|
|
151
|
+
limitations under each license.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024 hypequery
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @hypequery/protocol-conformance
|
|
2
|
+
|
|
3
|
+
Cross-language conformance runner and TypeScript reference adapter for the
|
|
4
|
+
Hypequery security protocol. It drives any implementation of the protocol
|
|
5
|
+
against the language-neutral fixtures in `specs/security-protocol/fixtures/`
|
|
6
|
+
and checks the results against the pinned expectations.
|
|
7
|
+
|
|
8
|
+
See [RFC 0012](../../specs/security-protocol/rfc/0012-cross-language-conformance.md)
|
|
9
|
+
for the manifest schema, the adapter wire protocol, and the pass criteria.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
# Run the whole suite against the bundled TypeScript reference adapter.
|
|
15
|
+
hypequery-protocol-conformance run -- hypequery-protocol-reference-adapter
|
|
16
|
+
|
|
17
|
+
# Run against another implementation (any language). Everything after `--`
|
|
18
|
+
# is the adapter command, spawned without a shell.
|
|
19
|
+
hypequery-protocol-conformance run --fixtures ./fixtures -- python -m my_impl.adapter
|
|
20
|
+
|
|
21
|
+
# Restrict to families, skip or isolate the fuzz corpus, emit JSON.
|
|
22
|
+
hypequery-protocol-conformance run --families sql-portability-v1 --skip-fuzz \
|
|
23
|
+
--report json -- node ./adapter.mjs
|
|
24
|
+
|
|
25
|
+
# List the enumerated case counts per family.
|
|
26
|
+
hypequery-protocol-conformance list
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Exit codes: `0` all cases passed, `1` conformance failures, `2` setup or
|
|
30
|
+
protocol error.
|
|
31
|
+
|
|
32
|
+
## Writing an adapter
|
|
33
|
+
|
|
34
|
+
An adapter reads newline-delimited JSON on stdin and writes it on stdout. It
|
|
35
|
+
answers a `hello` with the families it supports, then one `result` per `case`.
|
|
36
|
+
The `createStdioAdapter` helper implements the loop; a handler maps
|
|
37
|
+
`(family, role, case)` to `{ ok: true, output? }`, `{ ok: false, code }`, or
|
|
38
|
+
`{ skipped: true, reason }`. The bundled fixture snapshot means a pinned
|
|
39
|
+
package version is a pinned conformance target; pass `--fixtures` to test
|
|
40
|
+
against newer or local specs.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Spec = Record<string, unknown>;
|
|
2
|
+
export declare function materializeTaggedValue(spec: Spec): unknown;
|
|
3
|
+
export declare function materializeIdentifier(spec: Spec): string;
|
|
4
|
+
export declare function materializeExpression(spec: Spec): unknown;
|
|
5
|
+
export declare function materializeSchema(spec: Spec): unknown;
|
|
6
|
+
export declare function materializeImplementation(spec: Spec): unknown;
|
|
7
|
+
export declare function materializeEvent(spec: Spec): unknown;
|
|
8
|
+
export declare function materializeDiagnostics(spec: Spec): unknown;
|
|
9
|
+
export declare function materializeDeployment(spec: Spec): unknown;
|
|
10
|
+
export declare function materializeBundle(spec: Spec): unknown;
|
|
11
|
+
export declare function materializeRelease(spec: Spec): unknown;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=generators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../src/adapters/generators.ts"],"names":[],"mappings":"AAIA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAkBpC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAyB1D;AAID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAMxD;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAiCzD;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CA2BrD;AAgBD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAuB7D;AAkBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAyBpD;AAeD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAoB1D;AA2BD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAwDzD;AAkBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAmBrD;AAaD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAgBtD"}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// Deterministic materialization of `generator` fixture cases, implemented from
|
|
2
|
+
// the normative fixture-README semantics (RFC 0012). Each family's generators
|
|
3
|
+
// mirror the transforms documented in its README; keep the two in lockstep.
|
|
4
|
+
function repeat(value, count) {
|
|
5
|
+
return value.repeat(count);
|
|
6
|
+
}
|
|
7
|
+
function accessorObject(kind, property = 'kind') {
|
|
8
|
+
const object = {};
|
|
9
|
+
Object.defineProperty(object, property, { enumerable: true, get: () => kind });
|
|
10
|
+
return object;
|
|
11
|
+
}
|
|
12
|
+
// --- tagged-values-v1 (also used by the value-sources fuzz corpus) ---
|
|
13
|
+
function taggedArray(values) {
|
|
14
|
+
return { $hypequery: { type: 'array', version: 1, values } };
|
|
15
|
+
}
|
|
16
|
+
export function materializeTaggedValue(spec) {
|
|
17
|
+
switch (spec.type) {
|
|
18
|
+
case 'nested-array': {
|
|
19
|
+
let value = spec.leaf;
|
|
20
|
+
for (let depth = 0; depth < spec.depth; depth += 1)
|
|
21
|
+
value = taggedArray([value]);
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
case 'array':
|
|
25
|
+
return taggedArray(Array.from({ length: spec.items }, () => spec.value));
|
|
26
|
+
case 'array-tree':
|
|
27
|
+
return taggedArray(Array.from({ length: spec.branches }, () => taggedArray(Array.from({ length: spec.itemsPerBranch }, () => spec.value))));
|
|
28
|
+
case 'non-finite-float':
|
|
29
|
+
if (spec.value === 'NaN')
|
|
30
|
+
return Number.NaN;
|
|
31
|
+
if (spec.value === 'Infinity')
|
|
32
|
+
return Number.POSITIVE_INFINITY;
|
|
33
|
+
if (spec.value === '-Infinity')
|
|
34
|
+
return Number.NEGATIVE_INFINITY;
|
|
35
|
+
throw new Error(`Unknown non-finite float: ${String(spec.value)}`);
|
|
36
|
+
case 'repeat-string':
|
|
37
|
+
return repeat(spec.utf8, spec.count);
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`Unknown tagged-value generator: ${String(spec.type)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// --- identifiers-v1 ---
|
|
43
|
+
export function materializeIdentifier(spec) {
|
|
44
|
+
if (spec.type === 'repeat-string')
|
|
45
|
+
return repeat(spec.value, spec.count);
|
|
46
|
+
if (spec.type === 'qualified-segments') {
|
|
47
|
+
return Array.from({ length: spec.count }, () => spec.segment).join('.');
|
|
48
|
+
}
|
|
49
|
+
throw new Error(`Unknown identifier generator: ${String(spec.type)}`);
|
|
50
|
+
}
|
|
51
|
+
// --- expressions-v1 ---
|
|
52
|
+
const EXPR_LITERAL = { kind: 'literal', value: false };
|
|
53
|
+
export function materializeExpression(spec) {
|
|
54
|
+
switch (spec.type) {
|
|
55
|
+
case 'nested-not': {
|
|
56
|
+
let value = EXPR_LITERAL;
|
|
57
|
+
for (let i = 0; i < spec.depth; i += 1) {
|
|
58
|
+
value = { kind: 'logical', operator: 'not', operand: value };
|
|
59
|
+
}
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
case 'logical-operands':
|
|
63
|
+
return {
|
|
64
|
+
kind: 'logical',
|
|
65
|
+
operator: 'and',
|
|
66
|
+
operands: Array.from({ length: spec.count }, () => ({ ...EXPR_LITERAL })),
|
|
67
|
+
};
|
|
68
|
+
case 'logical-tree':
|
|
69
|
+
return {
|
|
70
|
+
kind: 'logical',
|
|
71
|
+
operator: 'and',
|
|
72
|
+
operands: Array.from({ length: 10 }, () => ({
|
|
73
|
+
kind: 'logical',
|
|
74
|
+
operator: 'and',
|
|
75
|
+
operands: Array.from({ length: 100 }, () => ({ ...EXPR_LITERAL })),
|
|
76
|
+
})),
|
|
77
|
+
};
|
|
78
|
+
case 'unsafe-accessor': {
|
|
79
|
+
const value = { kind: 'reference' };
|
|
80
|
+
Object.defineProperty(value, 'name', { enumerable: true, get: () => 'orders' });
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
default:
|
|
84
|
+
throw new Error(`Unknown expression generator: ${String(spec.type)}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// --- query-schemas-v1 ---
|
|
88
|
+
export function materializeSchema(spec) {
|
|
89
|
+
switch (spec.type) {
|
|
90
|
+
case 'nested-array': {
|
|
91
|
+
let value = { kind: 'any' };
|
|
92
|
+
for (let i = 0; i < spec.depth; i += 1)
|
|
93
|
+
value = { kind: 'array', items: value };
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
case 'union-tree':
|
|
97
|
+
return {
|
|
98
|
+
kind: 'union',
|
|
99
|
+
variants: Array.from({ length: 10 }, () => ({
|
|
100
|
+
kind: 'union',
|
|
101
|
+
variants: Array.from({ length: 100 }, () => ({ kind: 'any' })),
|
|
102
|
+
})),
|
|
103
|
+
};
|
|
104
|
+
case 'enum-values':
|
|
105
|
+
return {
|
|
106
|
+
kind: 'enum',
|
|
107
|
+
values: Array.from({ length: spec.count }, (_, i) => `v${i}`),
|
|
108
|
+
};
|
|
109
|
+
case 'description':
|
|
110
|
+
return { kind: 'string', description: repeat('a', spec.bytes) };
|
|
111
|
+
case 'unsafe-accessor':
|
|
112
|
+
return accessorObject('string');
|
|
113
|
+
default:
|
|
114
|
+
throw new Error(`Unknown schema generator: ${String(spec.type)}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// --- query-implementations-v1 ---
|
|
118
|
+
function compiledSql(parameters) {
|
|
119
|
+
return {
|
|
120
|
+
kind: 'compiled-sql',
|
|
121
|
+
dialect: 'clickhouse',
|
|
122
|
+
operation: 'select',
|
|
123
|
+
statement: 'SELECT 1',
|
|
124
|
+
parameters,
|
|
125
|
+
readSources: [],
|
|
126
|
+
tenant: { kind: 'not-required' },
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export function materializeImplementation(spec) {
|
|
130
|
+
switch (spec.type) {
|
|
131
|
+
case 'parameters':
|
|
132
|
+
return compiledSql(Array.from({ length: spec.count }, (_, i) => ({
|
|
133
|
+
name: `param${i}`,
|
|
134
|
+
source: { kind: 'input', path: `param${i}` },
|
|
135
|
+
clickHouseType: 'String',
|
|
136
|
+
})));
|
|
137
|
+
case 'sql-expression':
|
|
138
|
+
return {
|
|
139
|
+
kind: 'sql-expression',
|
|
140
|
+
dialect: 'clickhouse',
|
|
141
|
+
sql: repeat('a', spec.bytes),
|
|
142
|
+
output: { kind: 'string' },
|
|
143
|
+
dependencies: [],
|
|
144
|
+
};
|
|
145
|
+
case 'unsafe-accessor':
|
|
146
|
+
return accessorObject('semantic-plan');
|
|
147
|
+
default:
|
|
148
|
+
throw new Error(`Unknown implementation generator: ${String(spec.type)}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// --- query-events-v1 ---
|
|
152
|
+
function baseEvent() {
|
|
153
|
+
return {
|
|
154
|
+
kind: 'hypequery-query-event',
|
|
155
|
+
version: 1,
|
|
156
|
+
eventId: '0'.repeat(64),
|
|
157
|
+
occurredAt: '2026-07-20T12:34:56.789Z',
|
|
158
|
+
target: { project: 'project_1', environment: 'production' },
|
|
159
|
+
queryName: 'daily_revenue',
|
|
160
|
+
operation: 'query',
|
|
161
|
+
outcome: 'success',
|
|
162
|
+
durationMs: 182,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export function materializeEvent(spec) {
|
|
166
|
+
const value = baseEvent();
|
|
167
|
+
switch (spec.type) {
|
|
168
|
+
case 'wrong-root-type': return [];
|
|
169
|
+
case 'missing-required-field': {
|
|
170
|
+
delete value.durationMs;
|
|
171
|
+
return value;
|
|
172
|
+
}
|
|
173
|
+
case 'unknown-sql-field': return { ...value, sql: 'SELECT 1' };
|
|
174
|
+
case 'unknown-parameters-field': return { ...value, parameters: { start: '2026-01-01' } };
|
|
175
|
+
case 'unknown-raw-tenant-field': return { ...value, tenantId: 'acme' };
|
|
176
|
+
case 'newer-version': return { ...value, version: 2 };
|
|
177
|
+
case 'malformed-event-id': return { ...value, eventId: 'bad' };
|
|
178
|
+
case 'invalid-occurred-at': return { ...value, occurredAt: '2026-13-40T99:99:99Z' };
|
|
179
|
+
case 'failure-without-category': return { ...value, outcome: 'failure' };
|
|
180
|
+
case 'success-with-category': return { ...value, errorCategory: 'internal' };
|
|
181
|
+
case 'unknown-error-category': return { ...value, outcome: 'failure', errorCategory: 'exploded' };
|
|
182
|
+
case 'negative-duration': return { ...value, durationMs: -1 };
|
|
183
|
+
case 'invalid-target': return { ...value, target: { project: 'has space', environment: 'production' } };
|
|
184
|
+
case 'invalid-query-name': return { ...value, queryName: 'not an identifier' };
|
|
185
|
+
case 'oversized-correlation-id': return { ...value, correlationId: repeat('x', 2_049) };
|
|
186
|
+
case 'unsafe-accessor': {
|
|
187
|
+
const unsafe = baseEvent();
|
|
188
|
+
Object.defineProperty(unsafe, 'kind', { enumerable: true, get: () => 'hypequery-query-event' });
|
|
189
|
+
return unsafe;
|
|
190
|
+
}
|
|
191
|
+
default: throw new Error(`Unknown event generator: ${String(spec.type)}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// --- query-diagnostics-v1 ---
|
|
195
|
+
function baseDiagnostics() {
|
|
196
|
+
return {
|
|
197
|
+
kind: 'hypequery-query-diagnostics',
|
|
198
|
+
version: 1,
|
|
199
|
+
eventId: '0'.repeat(64),
|
|
200
|
+
queryId: '1'.repeat(64),
|
|
201
|
+
terminalReason: 'completed',
|
|
202
|
+
attempts: 1,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export function materializeDiagnostics(spec) {
|
|
206
|
+
const value = baseDiagnostics();
|
|
207
|
+
switch (spec.type) {
|
|
208
|
+
case 'wrong-root-type': return [];
|
|
209
|
+
case 'missing-required-field': {
|
|
210
|
+
delete value.attempts;
|
|
211
|
+
return value;
|
|
212
|
+
}
|
|
213
|
+
case 'unknown-result-field': return { ...value, rows: [[1, 2]] };
|
|
214
|
+
case 'unknown-credentials-field': return { ...value, password: 'hunter2' };
|
|
215
|
+
case 'newer-version': return { ...value, version: 2 };
|
|
216
|
+
case 'malformed-query-id': return { ...value, queryId: 'bad' };
|
|
217
|
+
case 'unknown-terminal-reason': return { ...value, terminalReason: 'exploded' };
|
|
218
|
+
case 'zero-attempts': return { ...value, attempts: 0 };
|
|
219
|
+
case 'control-character-message': return { ...value, safeMessage: 'bad\u0007message' };
|
|
220
|
+
case 'oversized-debug-query': return { ...value, debugQuery: repeat('x', 4_097) };
|
|
221
|
+
case 'unsafe-accessor': {
|
|
222
|
+
const unsafe = baseDiagnostics();
|
|
223
|
+
Object.defineProperty(unsafe, 'kind', { enumerable: true, get: () => 'hypequery-query-diagnostics' });
|
|
224
|
+
return unsafe;
|
|
225
|
+
}
|
|
226
|
+
default: throw new Error(`Unknown diagnostics generator: ${String(spec.type)}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// --- deployments-v1 ---
|
|
230
|
+
function minimalDataset(name = 'orders') {
|
|
231
|
+
return {
|
|
232
|
+
name,
|
|
233
|
+
source: 'orders',
|
|
234
|
+
tenant: { kind: 'not-required' },
|
|
235
|
+
dimensions: [],
|
|
236
|
+
measures: [],
|
|
237
|
+
filters: [],
|
|
238
|
+
metrics: [],
|
|
239
|
+
relationships: [],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function baseDeployment() {
|
|
243
|
+
return {
|
|
244
|
+
kind: 'hypequery-deployment',
|
|
245
|
+
version: 1,
|
|
246
|
+
datasets: [minimalDataset()],
|
|
247
|
+
queries: [],
|
|
248
|
+
artifacts: [],
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
export function materializeDeployment(spec) {
|
|
252
|
+
const value = baseDeployment();
|
|
253
|
+
switch (spec.type) {
|
|
254
|
+
case 'wrong-root-type': return [];
|
|
255
|
+
case 'unknown-root-field': return { ...value, extra: true };
|
|
256
|
+
case 'unsupported-version': return { ...value, version: 2 };
|
|
257
|
+
case 'invalid-dataset-identifier': return { ...value, datasets: [minimalDataset('bad-name')] };
|
|
258
|
+
case 'invalid-relationship-queryability':
|
|
259
|
+
return {
|
|
260
|
+
...value,
|
|
261
|
+
datasets: [{
|
|
262
|
+
...minimalDataset(),
|
|
263
|
+
relationships: [{
|
|
264
|
+
name: 'items', kind: 'hasMany', target: 'orders', from: 'id', to: 'order_id', queryable: true,
|
|
265
|
+
}],
|
|
266
|
+
}],
|
|
267
|
+
};
|
|
268
|
+
case 'missing-runtime-artifact':
|
|
269
|
+
return {
|
|
270
|
+
...value,
|
|
271
|
+
queries: [{
|
|
272
|
+
name: 'health',
|
|
273
|
+
input: { kind: 'any' },
|
|
274
|
+
output: { kind: 'any' },
|
|
275
|
+
implementation: {
|
|
276
|
+
kind: 'runtime-reference', runtime: 'node', artifactSha256: '0'.repeat(64), entrypoint: 'queries.health',
|
|
277
|
+
},
|
|
278
|
+
endpoint: { access: { kind: 'public' }, tenant: { kind: 'not-required' }, method: 'GET', path: '/health' },
|
|
279
|
+
tags: [],
|
|
280
|
+
}],
|
|
281
|
+
};
|
|
282
|
+
case 'ambiguous-query-route': {
|
|
283
|
+
const namedQuery = (name) => ({
|
|
284
|
+
name,
|
|
285
|
+
input: { kind: 'void' },
|
|
286
|
+
output: { kind: 'void' },
|
|
287
|
+
implementation: {
|
|
288
|
+
kind: 'semantic-plan',
|
|
289
|
+
query: { kind: 'dataset', dataset: 'orders', dimensions: [], measures: [], filters: [], orderBy: [] },
|
|
290
|
+
},
|
|
291
|
+
endpoint: { access: { kind: 'public' }, tenant: { kind: 'not-required' }, method: 'GET', path: '/same' },
|
|
292
|
+
tags: [],
|
|
293
|
+
});
|
|
294
|
+
return { ...value, queries: [namedQuery('first'), namedQuery('second')] };
|
|
295
|
+
}
|
|
296
|
+
case 'too-many-datasets':
|
|
297
|
+
return { ...value, datasets: Array.from({ length: 101 }, (_, i) => minimalDataset(`dataset_${i}`)) };
|
|
298
|
+
case 'source-too-large':
|
|
299
|
+
return { ...value, datasets: [{ ...minimalDataset(), source: repeat('a', 1_025) }] };
|
|
300
|
+
case 'unsafe-accessor': {
|
|
301
|
+
const unsafe = baseDeployment();
|
|
302
|
+
Object.defineProperty(unsafe, 'kind', { enumerable: true, get: () => 'hypequery-deployment' });
|
|
303
|
+
return unsafe;
|
|
304
|
+
}
|
|
305
|
+
default: throw new Error(`Unknown deployment generator: ${String(spec.type)}`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// --- deployment-bundles-v1 ---
|
|
309
|
+
function bundleArtifact(index = 0) {
|
|
310
|
+
const sha256 = index.toString(16).padStart(64, '0');
|
|
311
|
+
return { runtime: 'node', path: `artifacts/${sha256}.mjs`, sha256, byteLength: 1 };
|
|
312
|
+
}
|
|
313
|
+
function baseManifest() {
|
|
314
|
+
return {
|
|
315
|
+
kind: 'hypequery-deployment-bundle',
|
|
316
|
+
version: 1,
|
|
317
|
+
deployment: { path: 'deployment.json', identity: '1'.repeat(64), sha256: '2'.repeat(64), byteLength: 1 },
|
|
318
|
+
artifacts: [bundleArtifact()],
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
export function materializeBundle(spec) {
|
|
322
|
+
const value = baseManifest();
|
|
323
|
+
const deployment = value.deployment;
|
|
324
|
+
switch (spec.type) {
|
|
325
|
+
case 'wrong-root-type': return [];
|
|
326
|
+
case 'unknown-root-field': return { ...value, extra: true };
|
|
327
|
+
case 'unsupported-version': return { ...value, version: 2 };
|
|
328
|
+
case 'malformed-digest': return { ...value, deployment: { ...deployment, identity: 'bad' } };
|
|
329
|
+
case 'traversal-path': return { ...value, deployment: { ...deployment, path: '../deployment.json' } };
|
|
330
|
+
case 'duplicate-path': return { ...value, artifacts: [{ ...bundleArtifact(), path: deployment.path }] };
|
|
331
|
+
case 'too-many-artifacts': return { ...value, artifacts: Array.from({ length: 101 }, (_, i) => bundleArtifact(i)) };
|
|
332
|
+
case 'deployment-too-large': return { ...value, deployment: { ...deployment, byteLength: (16 * 1024 * 1024) + 1 } };
|
|
333
|
+
case 'unsafe-accessor': {
|
|
334
|
+
const unsafe = baseManifest();
|
|
335
|
+
Object.defineProperty(unsafe, 'kind', { enumerable: true, get: () => 'hypequery-deployment-bundle' });
|
|
336
|
+
return unsafe;
|
|
337
|
+
}
|
|
338
|
+
default: throw new Error(`Unknown bundle generator: ${String(spec.type)}`);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// --- deployment-releases-v1 ---
|
|
342
|
+
function baseRelease() {
|
|
343
|
+
return {
|
|
344
|
+
kind: 'hypequery-deployment-release',
|
|
345
|
+
version: 1,
|
|
346
|
+
bundleIdentity: '0'.repeat(64),
|
|
347
|
+
target: { project: 'project_1', environment: 'production' },
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
export function materializeRelease(spec) {
|
|
351
|
+
const value = baseRelease();
|
|
352
|
+
const target = value.target;
|
|
353
|
+
switch (spec.type) {
|
|
354
|
+
case 'wrong-root-type': return [];
|
|
355
|
+
case 'unknown-root-field': return { ...value, extra: true };
|
|
356
|
+
case 'unsupported-version': return { ...value, version: 2 };
|
|
357
|
+
case 'malformed-bundle-identity': return { ...value, bundleIdentity: 'bad' };
|
|
358
|
+
case 'target-too-large': return { ...value, target: { ...target, project: `p${repeat('a', 128)}` } };
|
|
359
|
+
case 'unsafe-accessor': {
|
|
360
|
+
const unsafe = baseRelease();
|
|
361
|
+
Object.defineProperty(unsafe, 'kind', { enumerable: true, get: () => 'hypequery-deployment-release' });
|
|
362
|
+
return unsafe;
|
|
363
|
+
}
|
|
364
|
+
default: throw new Error(`Unknown release generator: ${String(spec.type)}`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FixtureRole, HandlerResult } from '../types.js';
|
|
2
|
+
type Case = Record<string, unknown>;
|
|
3
|
+
export declare const REFERENCE_FAMILIES: readonly ["tagged-values-v1", "identifiers-v1", "expressions-v1", "query-schemas-v1", "query-implementations-v1", "query-events-v1", "query-diagnostics-v1", "deployments-v1", "deployment-bundles-v1", "deployment-releases-v1"];
|
|
4
|
+
export declare function referenceHandle(family: string, role: FixtureRole, c: Case, section?: string): HandlerResult;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/adapters/reference.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAc9D,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA0BpC,eAAO,MAAM,kBAAkB,mOAWrB,CAAC;AAEX,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,EACjB,CAAC,EAAE,IAAI,EACP,OAAO,CAAC,EAAE,MAAM,GACf,aAAa,CAkCf"}
|