@hypequery/protocol 0.1.0 → 0.2.1
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 +50 -9
- package/dist/deployments/errors.d.ts +8 -0
- package/dist/deployments/errors.d.ts.map +1 -0
- package/dist/deployments/errors.js +13 -0
- package/dist/deployments/index.d.ts +5 -0
- package/dist/deployments/index.d.ts.map +1 -0
- package/dist/deployments/index.js +3 -0
- package/dist/deployments/limits.d.ts +4 -0
- package/dist/deployments/limits.d.ts.map +1 -0
- package/dist/deployments/limits.js +23 -0
- package/dist/deployments/types.d.ts +148 -0
- package/dist/deployments/types.d.ts.map +1 -0
- package/dist/deployments/types.js +1 -0
- package/dist/deployments/validate.d.ts +4 -0
- package/dist/deployments/validate.d.ts.map +1 -0
- package/dist/deployments/validate.js +537 -0
- package/dist/expressions/errors.d.ts +8 -0
- package/dist/expressions/errors.d.ts.map +1 -0
- package/dist/expressions/errors.js +13 -0
- package/dist/expressions/index.d.ts +5 -0
- package/dist/expressions/index.d.ts.map +1 -0
- package/dist/expressions/index.js +3 -0
- package/dist/expressions/limits.d.ts +4 -0
- package/dist/expressions/limits.d.ts.map +1 -0
- package/dist/expressions/limits.js +17 -0
- package/dist/expressions/types.d.ts +77 -0
- package/dist/expressions/types.d.ts.map +1 -0
- package/dist/expressions/types.js +1 -0
- package/dist/expressions/validate.d.ts +4 -0
- package/dist/expressions/validate.d.ts.map +1 -0
- package/dist/expressions/validate.js +338 -0
- package/dist/identifiers/identifiers.d.ts +14 -0
- package/dist/identifiers/identifiers.d.ts.map +1 -0
- package/dist/identifiers/identifiers.js +87 -0
- package/dist/identifiers/index.d.ts +4 -0
- package/dist/identifiers/index.d.ts.map +1 -0
- package/dist/identifiers/index.js +2 -0
- package/dist/identifiers/types.d.ts +16 -0
- package/dist/identifiers/types.d.ts.map +1 -0
- package/dist/identifiers/types.js +5 -0
- package/dist/index.d.ts +12 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/query-implementations/errors.d.ts +8 -0
- package/dist/query-implementations/errors.d.ts.map +1 -0
- package/dist/query-implementations/errors.js +13 -0
- package/dist/query-implementations/index.d.ts +5 -0
- package/dist/query-implementations/index.d.ts.map +1 -0
- package/dist/query-implementations/index.js +3 -0
- package/dist/query-implementations/limits.d.ts +4 -0
- package/dist/query-implementations/limits.d.ts.map +1 -0
- package/dist/query-implementations/limits.js +22 -0
- package/dist/query-implementations/types.d.ts +57 -0
- package/dist/query-implementations/types.d.ts.map +1 -0
- package/dist/query-implementations/types.js +1 -0
- package/dist/query-implementations/validate.d.ts +4 -0
- package/dist/query-implementations/validate.d.ts.map +1 -0
- package/dist/query-implementations/validate.js +248 -0
- package/dist/schemas/errors.d.ts +8 -0
- package/dist/schemas/errors.d.ts.map +1 -0
- package/dist/schemas/errors.js +13 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/limits.d.ts +4 -0
- package/dist/schemas/limits.d.ts.map +1 -0
- package/dist/schemas/limits.js +20 -0
- package/dist/schemas/types.d.ts +60 -0
- package/dist/schemas/types.d.ts.map +1 -0
- package/dist/schemas/types.js +1 -0
- package/dist/schemas/validate.d.ts +3 -0
- package/dist/schemas/validate.d.ts.map +1 -0
- package/dist/schemas/validate.js +391 -0
- package/dist/values/codec.d.ts +13 -0
- package/dist/values/codec.d.ts.map +1 -0
- package/dist/values/codec.js +39 -0
- package/dist/values/errors.d.ts +8 -0
- package/dist/values/errors.d.ts.map +1 -0
- package/dist/values/errors.js +13 -0
- package/dist/values/index.d.ts +7 -0
- package/dist/values/index.d.ts.map +1 -0
- package/dist/values/index.js +4 -0
- package/dist/values/jcs.d.ts +2 -0
- package/dist/values/jcs.d.ts.map +1 -0
- package/dist/values/jcs.js +23 -0
- package/dist/values/limits.d.ts +4 -0
- package/dist/values/limits.d.ts.map +1 -0
- package/dist/values/limits.js +26 -0
- package/dist/values/parser.d.ts +3 -0
- package/dist/values/parser.d.ts.map +1 -0
- package/dist/values/parser.js +254 -0
- package/dist/values/snapshot.d.ts +3 -0
- package/dist/values/snapshot.d.ts.map +1 -0
- package/dist/values/snapshot.js +96 -0
- package/dist/values/types.d.ts +78 -0
- package/dist/values/types.d.ts.map +1 -0
- package/dist/values/types.js +1 -0
- package/dist/values/validate.d.ts +7 -0
- package/dist/values/validate.d.ts.map +1 -0
- package/dist/values/validate.js +332 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -5,20 +5,23 @@ Hypequery artifacts.
|
|
|
5
5
|
|
|
6
6
|
## Current status
|
|
7
7
|
|
|
8
|
-
This package
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
This package now contains the proposed version 1 tagged ClickHouse value codec.
|
|
9
|
+
The API remains pre-stable while the language-neutral specification and
|
|
10
|
+
conformance fixtures are reviewed. It does not yet define an executable
|
|
11
|
+
deployment bundle or a stable Cloud protocol.
|
|
12
12
|
|
|
13
13
|
The normative source is
|
|
14
14
|
[`specs/security-protocol`](../../specs/security-protocol/README.md).
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Scope
|
|
17
17
|
|
|
18
|
-
The package
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
and
|
|
18
|
+
The package contains deterministic, framework-independent implementations of
|
|
19
|
+
accepted protocol rules. The current implementation provides strict tagged
|
|
20
|
+
value validation, RFC 8785 canonical encoding, duplicate-aware decoding, a raw
|
|
21
|
+
SHA-256 conformance digest, draft portable logical identifiers, and a proposed
|
|
22
|
+
closed dataset expression/query AST. Artifact envelopes and compatibility
|
|
23
|
+
checks will follow in separate changes. A closed portable query-schema tree
|
|
24
|
+
provides the next layer for named-query input and output contracts.
|
|
22
25
|
|
|
23
26
|
It will not connect to ClickHouse, execute queries, load project source, access
|
|
24
27
|
credentials or the environment, perform network or filesystem I/O, implement
|
|
@@ -34,6 +37,44 @@ Only the root package export is public. Deep imports from `src` or `dist` are
|
|
|
34
37
|
unsupported. Package SemVer and protocol/artifact versions are separate; an
|
|
35
38
|
installed npm version never determines an artifact's identity.
|
|
36
39
|
|
|
40
|
+
The proposed tagged-value surface exports:
|
|
41
|
+
|
|
42
|
+
- `validateCanonicalValue`
|
|
43
|
+
- `encodeCanonicalValue` and `encodeCanonicalValueToString`
|
|
44
|
+
- `decodeCanonicalValue`
|
|
45
|
+
- `hashCanonicalValue`
|
|
46
|
+
- `ProtocolValueError` and stable error-code types
|
|
47
|
+
- tagged-value, option, and limit types
|
|
48
|
+
|
|
49
|
+
The raw conformance digest is not a deployment identity or shared cache key.
|
|
50
|
+
Those domains require separate, versioned, domain-separated contracts.
|
|
51
|
+
|
|
52
|
+
The proposed identifier surface exports strict parse, guard, split, and join
|
|
53
|
+
helpers for simple and dot-qualified logical identifiers. Identifiers are
|
|
54
|
+
ASCII, case-sensitive, preserved exactly, and are not SQL identifiers.
|
|
55
|
+
|
|
56
|
+
The proposed expression surface exports strict validators and immutable types
|
|
57
|
+
for derived formulas, comparisons, filtered aggregations, all current dataset
|
|
58
|
+
aggregations, and dataset/metric query envelopes. It intentionally excludes
|
|
59
|
+
caller-supplied SQL and tenant identity; consumers validate names and policy
|
|
60
|
+
against a dataset contract before execution.
|
|
61
|
+
|
|
62
|
+
The proposed schema surface exports strict types and validation for portable
|
|
63
|
+
query input/output schemas. It covers the current declarative Serve/Zod schema
|
|
64
|
+
features without depending on Zod or embedding executable transforms and
|
|
65
|
+
refinements.
|
|
66
|
+
|
|
67
|
+
The proposed query-implementation surface keeps trusted implementation details
|
|
68
|
+
separate from public query intent. It covers Dataset SQL expressions, fixed
|
|
69
|
+
semantic plans, compiled read-only ClickHouse statements with bound input or
|
|
70
|
+
tenant parameters, and hashed Node/Python runtime references for Serve handlers
|
|
71
|
+
that cannot be lowered portably. Validation does not execute or authorize SQL.
|
|
72
|
+
|
|
73
|
+
The proposed deployment surface combines complete Dataset definitions, named
|
|
74
|
+
Serve queries, endpoint policy, and runtime artifact identities into one strict
|
|
75
|
+
versioned envelope. Dataset and Serve adapters live in their owning packages;
|
|
76
|
+
the protocol package remains deterministic and framework-independent.
|
|
77
|
+
|
|
37
78
|
## Runtime compatibility
|
|
38
79
|
|
|
39
80
|
This package is ESM-only. Consumers must load it with `import`; CommonJS
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProtocolDeploymentErrorCode } from './types.js';
|
|
2
|
+
export declare class ProtocolDeploymentError extends TypeError {
|
|
3
|
+
readonly code: ProtocolDeploymentErrorCode;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
constructor(code: ProtocolDeploymentErrorCode, path?: string);
|
|
6
|
+
}
|
|
7
|
+
export declare function deploymentError(code: ProtocolDeploymentErrorCode, path?: string): never;
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/deployments/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,qBAAa,uBAAwB,SAAQ,SAAS;IACpD,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,2BAA2B,EAAE,IAAI,SAAM;CAM1D;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,2BAA2B,EACjC,IAAI,SAAM,GACT,KAAK,CAEP"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class ProtocolDeploymentError extends TypeError {
|
|
2
|
+
code;
|
|
3
|
+
path;
|
|
4
|
+
constructor(code, path = '$') {
|
|
5
|
+
super(`${code} at ${path}`);
|
|
6
|
+
this.name = 'ProtocolDeploymentError';
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.path = path;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function deploymentError(code, path = '$') {
|
|
12
|
+
throw new ProtocolDeploymentError(code, path);
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ProtocolDeploymentError } from './errors.js';
|
|
2
|
+
export { DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS } from './limits.js';
|
|
3
|
+
export { validateProtocolDatasetContract, validateProtocolDeploymentContract, } from './validate.js';
|
|
4
|
+
export type { ProtocolAccessPolicy, ProtocolDatasetContract, ProtocolDatasetDimension, ProtocolDatasetFieldSource, ProtocolDatasetFieldType, ProtocolDatasetFilter, ProtocolDatasetLimits, ProtocolDatasetMeasure, ProtocolDatasetMetric, ProtocolDatasetRelationship, ProtocolDatasetTenantPolicy, ProtocolDeploymentContract, ProtocolDeploymentErrorCode, ProtocolDeploymentLimits, ProtocolDeploymentOptions, ProtocolEndpointPolicy, ProtocolEndpointTenantPolicy, ProtocolNamedQueryContract, ProtocolRuntimeArtifact, } from './types.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deployments/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProtocolDeploymentLimits, ProtocolDeploymentOptions } from './types.js';
|
|
2
|
+
export declare const DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS: Readonly<ProtocolDeploymentLimits>;
|
|
3
|
+
export declare function resolveDeploymentLimits(options?: ProtocolDeploymentOptions): Readonly<ProtocolDeploymentLimits>;
|
|
4
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/deployments/limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEtF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,wBAAwB,CAQhF,CAAC;AAEH,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,yBAA8B,GACtC,QAAQ,CAAC,wBAAwB,CAAC,CAcpC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS = Object.freeze({
|
|
2
|
+
maxDatasets: 100,
|
|
3
|
+
maxQueries: 1_000,
|
|
4
|
+
maxArtifacts: 100,
|
|
5
|
+
maxDatasetItems: 1_000,
|
|
6
|
+
maxTextBytes: 4_096,
|
|
7
|
+
maxSourceBytes: 1_024,
|
|
8
|
+
maxPathBytes: 2_048,
|
|
9
|
+
});
|
|
10
|
+
export function resolveDeploymentLimits(options = {}) {
|
|
11
|
+
const result = { ...DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS };
|
|
12
|
+
for (const key of Object.keys(result)) {
|
|
13
|
+
const value = options.limits?.[key];
|
|
14
|
+
if (value === undefined)
|
|
15
|
+
continue;
|
|
16
|
+
const maximum = DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS[key];
|
|
17
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > maximum) {
|
|
18
|
+
throw new RangeError(`${key} must be a positive safe integer no greater than ${maximum} (the deployment contract v1 maximum)`);
|
|
19
|
+
}
|
|
20
|
+
result[key] = value;
|
|
21
|
+
}
|
|
22
|
+
return Object.freeze(result);
|
|
23
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { ProtocolExpression, ProtocolTimeGrain } from '../expressions/index.js';
|
|
2
|
+
import type { ProtocolIdentifier, ProtocolQualifiedIdentifier } from '../identifiers/index.js';
|
|
3
|
+
import type { ProtocolQueryImplementation, ProtocolSqlExpression } from '../query-implementations/index.js';
|
|
4
|
+
import type { ProtocolSchema } from '../schemas/index.js';
|
|
5
|
+
export type ProtocolDatasetFieldType = 'string' | 'number' | 'boolean' | 'timestamp';
|
|
6
|
+
export type ProtocolAccessPolicy = {
|
|
7
|
+
readonly kind: 'public';
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'authenticated';
|
|
10
|
+
readonly roles: readonly string[];
|
|
11
|
+
readonly scopes: readonly string[];
|
|
12
|
+
};
|
|
13
|
+
export type ProtocolEndpointTenantPolicy = {
|
|
14
|
+
readonly kind: 'not-required';
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'required' | 'optional';
|
|
17
|
+
readonly mode: 'auto-inject' | 'manual';
|
|
18
|
+
readonly column?: string;
|
|
19
|
+
};
|
|
20
|
+
export interface ProtocolEndpointPolicy {
|
|
21
|
+
readonly access: ProtocolAccessPolicy;
|
|
22
|
+
readonly tenant: ProtocolEndpointTenantPolicy;
|
|
23
|
+
readonly cacheTtlMs?: number;
|
|
24
|
+
readonly maxLimit?: number;
|
|
25
|
+
readonly path?: string;
|
|
26
|
+
}
|
|
27
|
+
export type ProtocolDatasetTenantPolicy = {
|
|
28
|
+
readonly kind: 'required';
|
|
29
|
+
readonly field: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'not-required';
|
|
32
|
+
};
|
|
33
|
+
export type ProtocolDatasetFieldSource = {
|
|
34
|
+
readonly kind: 'column';
|
|
35
|
+
readonly column: string;
|
|
36
|
+
} | ProtocolSqlExpression;
|
|
37
|
+
export interface ProtocolDatasetDimension {
|
|
38
|
+
readonly name: ProtocolIdentifier;
|
|
39
|
+
readonly type: ProtocolDatasetFieldType;
|
|
40
|
+
readonly source: ProtocolDatasetFieldSource;
|
|
41
|
+
readonly filterable: boolean;
|
|
42
|
+
readonly groupable: boolean;
|
|
43
|
+
readonly label?: string;
|
|
44
|
+
readonly description?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ProtocolDatasetMeasure {
|
|
47
|
+
readonly name: ProtocolIdentifier;
|
|
48
|
+
readonly aggregation: 'sum' | 'count' | 'countDistinct' | 'avg' | 'min' | 'max' | 'argMax' | 'argMin' | 'percentile' | 'stddev' | 'variance';
|
|
49
|
+
readonly field: ProtocolQualifiedIdentifier;
|
|
50
|
+
readonly argField?: ProtocolQualifiedIdentifier;
|
|
51
|
+
readonly level?: number;
|
|
52
|
+
readonly sql?: ProtocolSqlExpression;
|
|
53
|
+
readonly filters: readonly ProtocolExpression[];
|
|
54
|
+
readonly label?: string;
|
|
55
|
+
readonly description?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface ProtocolDatasetFilter {
|
|
58
|
+
readonly name: ProtocolIdentifier;
|
|
59
|
+
readonly field: ProtocolQualifiedIdentifier;
|
|
60
|
+
readonly operators: readonly ('eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'notIn' | 'between' | 'like')[];
|
|
61
|
+
readonly label?: string;
|
|
62
|
+
readonly description?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ProtocolDatasetRelationship {
|
|
65
|
+
readonly name: ProtocolIdentifier;
|
|
66
|
+
readonly kind: 'belongsTo' | 'hasMany' | 'hasOne';
|
|
67
|
+
readonly target: ProtocolIdentifier;
|
|
68
|
+
readonly from: ProtocolQualifiedIdentifier;
|
|
69
|
+
readonly to: ProtocolQualifiedIdentifier;
|
|
70
|
+
readonly queryable: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface ProtocolDatasetMetric {
|
|
73
|
+
readonly name: ProtocolIdentifier;
|
|
74
|
+
readonly kind: 'metric' | 'derived-metric' | 'grained-metric';
|
|
75
|
+
readonly expression: ProtocolExpression;
|
|
76
|
+
readonly dimensions: readonly ProtocolQualifiedIdentifier[];
|
|
77
|
+
readonly filters: readonly ProtocolIdentifier[];
|
|
78
|
+
readonly grains: readonly ProtocolTimeGrain[];
|
|
79
|
+
readonly grain?: ProtocolTimeGrain;
|
|
80
|
+
readonly label?: string;
|
|
81
|
+
readonly description?: string;
|
|
82
|
+
readonly endpoint: ProtocolEndpointPolicy;
|
|
83
|
+
}
|
|
84
|
+
export interface ProtocolDatasetLimits {
|
|
85
|
+
readonly maxDimensions?: number;
|
|
86
|
+
readonly maxMeasures?: number;
|
|
87
|
+
readonly maxFilters?: number;
|
|
88
|
+
readonly maxResultSize?: number;
|
|
89
|
+
}
|
|
90
|
+
export interface ProtocolDatasetContract {
|
|
91
|
+
readonly name: ProtocolIdentifier;
|
|
92
|
+
readonly source: string;
|
|
93
|
+
readonly tenant: ProtocolDatasetTenantPolicy;
|
|
94
|
+
readonly timeField?: ProtocolQualifiedIdentifier;
|
|
95
|
+
readonly dimensions: readonly ProtocolDatasetDimension[];
|
|
96
|
+
readonly measures: readonly ProtocolDatasetMeasure[];
|
|
97
|
+
readonly filters: readonly ProtocolDatasetFilter[];
|
|
98
|
+
readonly metrics: readonly ProtocolDatasetMetric[];
|
|
99
|
+
readonly relationships: readonly ProtocolDatasetRelationship[];
|
|
100
|
+
readonly limits?: ProtocolDatasetLimits;
|
|
101
|
+
readonly endpoint?: ProtocolEndpointPolicy;
|
|
102
|
+
}
|
|
103
|
+
export interface ProtocolNamedQueryContract {
|
|
104
|
+
readonly name: ProtocolIdentifier;
|
|
105
|
+
readonly input: ProtocolSchema;
|
|
106
|
+
readonly output: ProtocolSchema;
|
|
107
|
+
readonly implementation: ProtocolQueryImplementation;
|
|
108
|
+
readonly endpoint: ProtocolEndpointPolicy & {
|
|
109
|
+
readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
110
|
+
readonly path: string;
|
|
111
|
+
};
|
|
112
|
+
readonly summary?: string;
|
|
113
|
+
readonly description?: string;
|
|
114
|
+
readonly tags: readonly string[];
|
|
115
|
+
}
|
|
116
|
+
export interface ProtocolRuntimeArtifact {
|
|
117
|
+
readonly runtime: 'node' | 'python';
|
|
118
|
+
readonly artifactSha256: string;
|
|
119
|
+
}
|
|
120
|
+
export interface ProtocolDeploymentContract {
|
|
121
|
+
readonly kind: 'hypequery-deployment';
|
|
122
|
+
readonly version: 1;
|
|
123
|
+
readonly datasets: readonly ProtocolDatasetContract[];
|
|
124
|
+
readonly queries: readonly ProtocolNamedQueryContract[];
|
|
125
|
+
readonly artifacts: readonly ProtocolRuntimeArtifact[];
|
|
126
|
+
}
|
|
127
|
+
export interface ProtocolDeploymentLimits {
|
|
128
|
+
readonly maxDatasets: number;
|
|
129
|
+
readonly maxQueries: number;
|
|
130
|
+
readonly maxArtifacts: number;
|
|
131
|
+
readonly maxDatasetItems: number;
|
|
132
|
+
readonly maxTextBytes: number;
|
|
133
|
+
readonly maxSourceBytes: number;
|
|
134
|
+
readonly maxPathBytes: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Validation budgets for a deployment contract.
|
|
138
|
+
*
|
|
139
|
+
* Each configured value must be a positive safe integer no greater than the
|
|
140
|
+
* corresponding value in `DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS`. These options
|
|
141
|
+
* may tighten the deployment-contract v1 conformance limits, but cannot raise
|
|
142
|
+
* them; they are not deployment capacity settings.
|
|
143
|
+
*/
|
|
144
|
+
export interface ProtocolDeploymentOptions {
|
|
145
|
+
readonly limits?: Partial<ProtocolDeploymentLimits>;
|
|
146
|
+
}
|
|
147
|
+
export type ProtocolDeploymentErrorCode = 'HQ_DEPLOYMENT_TYPE' | 'HQ_DEPLOYMENT_UNKNOWN_FIELD' | 'HQ_DEPLOYMENT_INVALID_VERSION' | 'HQ_DEPLOYMENT_INVALID_IDENTIFIER' | 'HQ_DEPLOYMENT_INVALID_VALUE' | 'HQ_DEPLOYMENT_INVALID_REFERENCE' | 'HQ_DEPLOYMENT_TOO_MANY_ITEMS' | 'HQ_DEPLOYMENT_TOO_LARGE' | 'HQ_DEPLOYMENT_UNSAFE_OBJECT';
|
|
148
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/deployments/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;AAErF,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IACE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC,CAAC;AAEN,MAAM,MAAM,4BAA4B,GACpC;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE,GACjC;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,QAAQ,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1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,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACrD;AAED,MAAM,MAAM,2BAA2B,GACnC,oBAAoB,GACpB,6BAA6B,GAC7B,+BAA+B,GAC/B,kCAAkC,GAClC,6BAA6B,GAC7B,iCAAiC,GACjC,8BAA8B,GAC9B,yBAAyB,GACzB,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProtocolDatasetContract, ProtocolDeploymentContract, ProtocolDeploymentOptions } from './types.js';
|
|
2
|
+
export declare function validateProtocolDatasetContract(input: unknown, options?: ProtocolDeploymentOptions): ProtocolDatasetContract;
|
|
3
|
+
export declare function validateProtocolDeploymentContract(input: unknown, options?: ProtocolDeploymentOptions): ProtocolDeploymentContract;
|
|
4
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/deployments/validate.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAEV,uBAAuB,EASvB,0BAA0B,EAE1B,yBAAyB,EAK1B,MAAM,YAAY,CAAC;AAsfpB,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,uBAAuB,CAEzB;AAoKD,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,0BAA0B,CAgC5B"}
|