@hypequery/protocol 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -97
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -1,99 +1,68 @@
|
|
|
1
1
|
# @hypequery/protocol
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
The proposed query-implementation surface keeps trusted implementation details
|
|
70
|
-
separate from public query intent. It covers Dataset SQL expressions, fixed
|
|
71
|
-
semantic plans, compiled read-only ClickHouse statements with bound input or
|
|
72
|
-
tenant parameters, and hashed Node/Python runtime references for Serve handlers
|
|
73
|
-
that cannot be lowered portably. Validation does not execute or authorize SQL.
|
|
74
|
-
|
|
75
|
-
The proposed deployment surface combines complete Dataset definitions, named
|
|
76
|
-
Serve queries, endpoint policy, and runtime artifact identities into one strict
|
|
77
|
-
versioned envelope. Dataset and Serve adapters live in their owning packages;
|
|
78
|
-
the protocol package remains deterministic and framework-independent.
|
|
79
|
-
Validated envelopes can be encoded as canonical RFC 8785 bytes and identified
|
|
80
|
-
with the deployment-v1 domain-separated SHA-256 digest.
|
|
81
|
-
|
|
82
|
-
The proposed deployment-bundle surface validates the portable manifest that
|
|
83
|
-
binds a deployment identity to exact deployment and runtime artifact files. It
|
|
84
|
-
provides canonical encoding and a separate bundle-v1 identity. Filesystem-safe
|
|
85
|
-
writing remains in the CLI, while reusable filesystem verification and
|
|
86
|
-
receiving-side intake live in `@hypequery/deployment`; this package performs no
|
|
87
|
-
I/O.
|
|
88
|
-
|
|
89
|
-
The proposed deployment-release surface binds one verified bundle identity to
|
|
90
|
-
an explicit project and environment. Its deterministic identity serves as the
|
|
91
|
-
idempotency key for authenticated deployment submission without putting
|
|
92
|
-
credentials, timestamps, release state, or provider behavior into the envelope.
|
|
93
|
-
|
|
94
|
-
## Runtime compatibility
|
|
95
|
-
|
|
96
|
-
This package is ESM-only. Consumers must load it with `import`; CommonJS
|
|
97
|
-
`require()` and a dual ESM/CommonJS build are intentionally out of scope.
|
|
98
|
-
Older tools that ignore the package `exports` map and attempt to require the
|
|
99
|
-
`main` entry may fail with `ERR_REQUIRE_ESM`.
|
|
3
|
+
`@hypequery/protocol` is the deterministic TypeScript reference implementation for Hypequery’s portable, language-neutral artifacts. It validates and canonically encodes semantic expressions, query schemas, deployment contracts, bundle manifests, release envelopes, query events, and diagnostics without connecting to a database or executing user code.
|
|
4
|
+
|
|
5
|
+
The normative source is [`specs/security-protocol`](../../specs/security-protocol/README.md). The package is pre-stable while the draft wire contracts and conformance fixtures are reviewed; the npm version is not an artifact version.
|
|
6
|
+
|
|
7
|
+
## What the protocol solves
|
|
8
|
+
|
|
9
|
+
Hypequery authoring tools, deployment systems, runtimes, and implementations in different languages need to agree on four things:
|
|
10
|
+
|
|
11
|
+
1. which values and structures are accepted;
|
|
12
|
+
2. the exact canonical bytes for an accepted artifact;
|
|
13
|
+
3. the stable identity derived from those bytes;
|
|
14
|
+
4. the failure code returned for rejected input.
|
|
15
|
+
|
|
16
|
+
This package implements those rules in TypeScript. Python and other implementations are tested against the same fixtures with `@hypequery/protocol-conformance`.
|
|
17
|
+
|
|
18
|
+
## Main surfaces
|
|
19
|
+
|
|
20
|
+
- canonical tagged values and RFC 8785 encoding
|
|
21
|
+
- strict simple and qualified logical identifiers
|
|
22
|
+
- closed semantic expression and query envelopes
|
|
23
|
+
- portable input and output schemas
|
|
24
|
+
- trusted query implementation artifacts
|
|
25
|
+
- dataset and named-query deployment contracts
|
|
26
|
+
- closed deployment bundle manifests
|
|
27
|
+
- project/environment release envelopes
|
|
28
|
+
- compiled query settings, cancellation, events, and diagnostics
|
|
29
|
+
|
|
30
|
+
The package performs no filesystem or network I/O. It does not load project source, choose credentials, connect to ClickHouse, authenticate users, resolve tenants, or host HTTP routes. Those jobs remain with the CLI, deployment package, and runtime adapters.
|
|
31
|
+
|
|
32
|
+
## Canonical values
|
|
33
|
+
|
|
34
|
+
The root export includes validation, encoding, decoding, hashing, errors, and the related immutable types:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import {
|
|
38
|
+
validateCanonicalValue,
|
|
39
|
+
encodeCanonicalValueToString,
|
|
40
|
+
decodeCanonicalValue,
|
|
41
|
+
hashCanonicalValue,
|
|
42
|
+
ProtocolValueError,
|
|
43
|
+
} from '@hypequery/protocol';
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Domain-specific identities remain separate. A raw canonical-value digest is not automatically a deployment, bundle, release, or cache identity.
|
|
47
|
+
|
|
48
|
+
## Portable analytics definitions
|
|
49
|
+
|
|
50
|
+
Expression validators cover derived formulas, comparisons, filtered aggregates, the full dataset aggregation surface, and metric/dataset query envelopes. Runtime callers provide semantic names and values; they cannot embed SQL or tenant identity in these portable query structures.
|
|
51
|
+
|
|
52
|
+
Schema validators cover the declarative Serve/Zod features that can travel between runtimes without importing Zod or executable refinements. Schema application handles defaults and unknown properties on bounded wire values.
|
|
53
|
+
|
|
54
|
+
## Deployment artifacts
|
|
55
|
+
|
|
56
|
+
A deployment combines dataset definitions, named Serve queries, endpoint policy, and runtime artifact identities in one strict versioned envelope. Bundle manifests bind that deployment and every runtime file by path, byte length, and hash. Release envelopes bind a verified bundle to one explicit project and environment.
|
|
57
|
+
|
|
58
|
+
Canonical encoders and domain-separated SHA-256 identities make these artifacts reproducible across language implementations. Filesystem-safe construction and verification live in `@hypequery/deployment` and the CLI.
|
|
59
|
+
|
|
60
|
+
## Package use
|
|
61
|
+
|
|
62
|
+
Only the root package export is public. Package SemVer and protocol versions are deliberately separate. The package is ESM-only and must be loaded with `import`.
|
|
63
|
+
|
|
64
|
+
Self-hosted `@hypequery/serve` can continue to run application source directly. Portable deployment bundles are needed for deployment, compatibility checks, and cross-runtime handoff—not for ordinary local query execution.
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
Apache-2.0.
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/protocol",
|
|
3
|
-
"version": "0.10.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.10.2",
|
|
4
|
+
"description": "Portable analytics contracts and TypeScript reference implementation for Hypequery",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hypequery",
|
|
7
|
+
"protocol",
|
|
8
|
+
"analytics",
|
|
9
|
+
"semantic-layer",
|
|
10
|
+
"typescript",
|
|
11
|
+
"canonical-json"
|
|
12
|
+
],
|
|
5
13
|
"license": "Apache-2.0",
|
|
6
14
|
"type": "module",
|
|
7
15
|
"main": "dist/index.js",
|
|
@@ -26,10 +34,10 @@
|
|
|
26
34
|
},
|
|
27
35
|
"repository": {
|
|
28
36
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/hypequery/hypequery.git",
|
|
37
|
+
"url": "git+https://github.com/hypequery/hypequery.git",
|
|
30
38
|
"directory": "packages/protocol"
|
|
31
39
|
},
|
|
32
|
-
"homepage": "https://
|
|
40
|
+
"homepage": "https://hypequery.com",
|
|
33
41
|
"bugs": {
|
|
34
42
|
"url": "https://github.com/hypequery/hypequery/issues"
|
|
35
43
|
},
|