@hypequery/protocol 0.0.0-canary-20260719200737 → 0.2.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.
- package/README.md +9 -23
- package/dist/deployments/index.d.ts +0 -2
- package/dist/deployments/index.d.ts.map +1 -1
- package/dist/deployments/index.js +0 -1
- package/dist/deployments/validate.d.ts.map +1 -1
- package/dist/deployments/validate.js +3 -13
- package/dist/index.d.ts +2 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/package.json +1 -1
- package/dist/bundles/codec.d.ts +0 -13
- package/dist/bundles/codec.d.ts.map +0 -1
- package/dist/bundles/codec.js +0 -25
- package/dist/bundles/errors.d.ts +0 -8
- package/dist/bundles/errors.d.ts.map +0 -1
- package/dist/bundles/errors.js +0 -13
- package/dist/bundles/index.d.ts +0 -7
- package/dist/bundles/index.d.ts.map +0 -1
- package/dist/bundles/index.js +0 -4
- package/dist/bundles/limits.d.ts +0 -4
- package/dist/bundles/limits.d.ts.map +0 -1
- package/dist/bundles/limits.js +0 -22
- package/dist/bundles/types.d.ts +0 -35
- package/dist/bundles/types.d.ts.map +0 -1
- package/dist/bundles/types.js +0 -1
- package/dist/bundles/validate.d.ts +0 -3
- package/dist/bundles/validate.d.ts.map +0 -1
- package/dist/bundles/validate.js +0 -155
- package/dist/deployments/codec.d.ts +0 -18
- package/dist/deployments/codec.d.ts.map +0 -1
- package/dist/deployments/codec.js +0 -35
- package/dist/releases/codec.d.ts +0 -13
- package/dist/releases/codec.d.ts.map +0 -1
- package/dist/releases/codec.js +0 -25
- package/dist/releases/errors.d.ts +0 -8
- package/dist/releases/errors.d.ts.map +0 -1
- package/dist/releases/errors.js +0 -13
- package/dist/releases/index.d.ts +0 -7
- package/dist/releases/index.d.ts.map +0 -1
- package/dist/releases/index.js +0 -4
- package/dist/releases/limits.d.ts +0 -4
- package/dist/releases/limits.d.ts.map +0 -1
- package/dist/releases/limits.js +0 -18
- package/dist/releases/types.d.ts +0 -19
- package/dist/releases/types.d.ts.map +0 -1
- package/dist/releases/types.js +0 -1
- package/dist/releases/validate.d.ts +0 -4
- package/dist/releases/validate.d.ts.map +0 -1
- package/dist/releases/validate.js +0 -85
package/README.md
CHANGED
|
@@ -5,11 +5,10 @@ Hypequery artifacts.
|
|
|
5
5
|
|
|
6
6
|
## Current status
|
|
7
7
|
|
|
8
|
-
This package contains proposed version 1 tagged
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
drafts do not yet establish a stable Cloud protocol.
|
|
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.
|
|
13
12
|
|
|
14
13
|
The normative source is
|
|
15
14
|
[`specs/security-protocol`](../../specs/security-protocol/README.md).
|
|
@@ -18,10 +17,11 @@ The normative source is
|
|
|
18
17
|
|
|
19
18
|
The package contains deterministic, framework-independent implementations of
|
|
20
19
|
accepted protocol rules. The current implementation provides strict tagged
|
|
21
|
-
value validation, RFC 8785 canonical encoding, duplicate-aware decoding,
|
|
22
|
-
portable logical identifiers,
|
|
23
|
-
|
|
24
|
-
|
|
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.
|
|
25
25
|
|
|
26
26
|
It will not connect to ClickHouse, execute queries, load project source, access
|
|
27
27
|
credentials or the environment, perform network or filesystem I/O, implement
|
|
@@ -74,20 +74,6 @@ The proposed deployment surface combines complete Dataset definitions, named
|
|
|
74
74
|
Serve queries, endpoint policy, and runtime artifact identities into one strict
|
|
75
75
|
versioned envelope. Dataset and Serve adapters live in their owning packages;
|
|
76
76
|
the protocol package remains deterministic and framework-independent.
|
|
77
|
-
Validated envelopes can be encoded as canonical RFC 8785 bytes and identified
|
|
78
|
-
with the deployment-v1 domain-separated SHA-256 digest.
|
|
79
|
-
|
|
80
|
-
The proposed deployment-bundle surface validates the portable manifest that
|
|
81
|
-
binds a deployment identity to exact deployment and runtime artifact files. It
|
|
82
|
-
provides canonical encoding and a separate bundle-v1 identity. Filesystem-safe
|
|
83
|
-
writing remains in the CLI, while reusable filesystem verification and
|
|
84
|
-
receiving-side intake live in `@hypequery/deployment`; this package performs no
|
|
85
|
-
I/O.
|
|
86
|
-
|
|
87
|
-
The proposed deployment-release surface binds one verified bundle identity to
|
|
88
|
-
an explicit project and environment. Its deterministic identity serves as the
|
|
89
|
-
idempotency key for authenticated deployment submission without putting
|
|
90
|
-
credentials, timestamps, release state, or provider behavior into the envelope.
|
|
91
77
|
|
|
92
78
|
## Runtime compatibility
|
|
93
79
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { ProtocolDeploymentError } from './errors.js';
|
|
2
|
-
export { PROTOCOL_DEPLOYMENT_IDENTITY_DOMAIN, encodeProtocolDeploymentContract, encodeProtocolDeploymentContractToString, hashProtocolDeploymentContract, prepareProtocolDeploymentContract, } from './codec.js';
|
|
3
|
-
export type { PreparedProtocolDeploymentContract } from './codec.js';
|
|
4
2
|
export { DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS } from './limits.js';
|
|
5
3
|
export { validateProtocolDatasetContract, validateProtocolDeploymentContract, } from './validate.js';
|
|
6
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';
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { ProtocolDeploymentError } from './errors.js';
|
|
2
|
-
export { PROTOCOL_DEPLOYMENT_IDENTITY_DOMAIN, encodeProtocolDeploymentContract, encodeProtocolDeploymentContractToString, hashProtocolDeploymentContract, prepareProtocolDeploymentContract, } from './codec.js';
|
|
3
2
|
export { DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS } from './limits.js';
|
|
4
3
|
export { validateProtocolDatasetContract, validateProtocolDeploymentContract, } from './validate.js';
|
|
@@ -1 +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;
|
|
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;AA6epB,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,uBAAuB,CAEzB;AAmKD,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,0BAA0B,CAgC5B"}
|
|
@@ -333,15 +333,6 @@ function validateMetric(input, path, limits) {
|
|
|
333
333
|
if ((value.kind === 'grained-metric') !== (value.grain !== undefined)) {
|
|
334
334
|
deploymentError('HQ_DEPLOYMENT_INVALID_VALUE', `${path}.grain`);
|
|
335
335
|
}
|
|
336
|
-
const grain = value.grain === undefined
|
|
337
|
-
? undefined
|
|
338
|
-
: parseGrain(value.grain, `${path}.grain`);
|
|
339
|
-
if (grain !== undefined && grains.length === 0) {
|
|
340
|
-
deploymentError('HQ_DEPLOYMENT_INVALID_VALUE', `${path}.grains`);
|
|
341
|
-
}
|
|
342
|
-
if (grain !== undefined && !grains.includes(grain)) {
|
|
343
|
-
deploymentError('HQ_DEPLOYMENT_INVALID_VALUE', `${path}.grain`);
|
|
344
|
-
}
|
|
345
336
|
const result = {
|
|
346
337
|
name: identifier(value.name, `${path}.name`),
|
|
347
338
|
kind: value.kind,
|
|
@@ -351,8 +342,8 @@ function validateMetric(input, path, limits) {
|
|
|
351
342
|
grains,
|
|
352
343
|
endpoint: validateEndpoint(value.endpoint, `${path}.endpoint`, limits),
|
|
353
344
|
};
|
|
354
|
-
if (grain !== undefined)
|
|
355
|
-
result.grain = grain;
|
|
345
|
+
if (value.grain !== undefined)
|
|
346
|
+
result.grain = parseGrain(value.grain, `${path}.grain`);
|
|
356
347
|
optionalText(value.label, 'label', result, path, limits);
|
|
357
348
|
optionalText(value.description, 'description', result, path, limits);
|
|
358
349
|
return freezeRecord(result);
|
|
@@ -449,8 +440,7 @@ function validateReferences(contract) {
|
|
|
449
440
|
|| metric.filters.some(filter => !filters.has(filter))) {
|
|
450
441
|
deploymentError('HQ_DEPLOYMENT_INVALID_REFERENCE', `$.datasets[${datasetIndex}].metrics[${metricIndex}]`);
|
|
451
442
|
}
|
|
452
|
-
if (
|
|
453
|
-
&& dataset.timeField === undefined) {
|
|
443
|
+
if (metric.grains.length > 0 && dataset.timeField === undefined) {
|
|
454
444
|
deploymentError('HQ_DEPLOYMENT_INVALID_REFERENCE', `$.datasets[${datasetIndex}].metrics[${metricIndex}].grains`);
|
|
455
445
|
}
|
|
456
446
|
if (dataset.tenant.kind === 'required' && metric.endpoint.tenant.kind !== 'required') {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,11 +7,7 @@ export type { ProtocolSchema, ProtocolSchemaErrorCode, ProtocolSchemaLimits, Pro
|
|
|
7
7
|
export type { ProtocolAggregation, ProtocolBinaryOperator, ProtocolComparisonOperator, ProtocolDatasetQuery, ProtocolExpression, ProtocolExpressionErrorCode, ProtocolExpressionLimits, ProtocolExpressionOptions, ProtocolFunctionName, ProtocolMetricQuery, ProtocolOrderBy, ProtocolSemanticQuery, ProtocolTimeGrain, } from './expressions/index.js';
|
|
8
8
|
export type { ProtocolIdentifier, ProtocolIdentifierErrorCode, ProtocolQualifiedIdentifier, } from './identifiers/index.js';
|
|
9
9
|
export { DEFAULT_PROTOCOL_QUERY_IMPLEMENTATION_LIMITS, ProtocolQueryImplementationError, validateProtocolQueryImplementation, validateProtocolSqlExpression, } from './query-implementations/index.js';
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export type { PreparedProtocolDeploymentReleaseEnvelope, ProtocolDeploymentReleaseEnvelope, ProtocolDeploymentReleaseErrorCode, ProtocolDeploymentReleaseLimits, ProtocolDeploymentReleaseOptions, ProtocolDeploymentReleaseTarget, } from './releases/index.js';
|
|
13
|
-
export type { PreparedProtocolDeploymentBundleManifest, ProtocolDeploymentBundleArtifact, ProtocolDeploymentBundleDeployment, ProtocolDeploymentBundleErrorCode, ProtocolDeploymentBundleFile, ProtocolDeploymentBundleLimits, ProtocolDeploymentBundleManifest, ProtocolDeploymentBundleOptions, } from './bundles/index.js';
|
|
14
|
-
export { DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS, PROTOCOL_DEPLOYMENT_IDENTITY_DOMAIN, ProtocolDeploymentError, encodeProtocolDeploymentContract, encodeProtocolDeploymentContractToString, hashProtocolDeploymentContract, prepareProtocolDeploymentContract, validateProtocolDatasetContract, validateProtocolDeploymentContract, } from './deployments/index.js';
|
|
15
|
-
export type { PreparedProtocolDeploymentContract, ProtocolAccessPolicy, ProtocolDatasetContract, ProtocolDatasetDimension, ProtocolDatasetFieldSource, ProtocolDatasetFieldType, ProtocolDatasetFilter, ProtocolDatasetLimits, ProtocolDatasetMeasure, ProtocolDatasetMetric, ProtocolDatasetRelationship, ProtocolDatasetTenantPolicy, ProtocolDeploymentContract, ProtocolDeploymentErrorCode, ProtocolDeploymentLimits, ProtocolDeploymentOptions, ProtocolEndpointPolicy, ProtocolEndpointTenantPolicy, ProtocolNamedQueryContract, ProtocolRuntimeArtifact, } from './deployments/index.js';
|
|
10
|
+
export { DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS, ProtocolDeploymentError, validateProtocolDatasetContract, validateProtocolDeploymentContract, } from './deployments/index.js';
|
|
11
|
+
export type { ProtocolAccessPolicy, ProtocolDatasetContract, ProtocolDatasetDimension, ProtocolDatasetFieldSource, ProtocolDatasetFieldType, ProtocolDatasetFilter, ProtocolDatasetLimits, ProtocolDatasetMeasure, ProtocolDatasetMetric, ProtocolDatasetRelationship, ProtocolDatasetTenantPolicy, ProtocolDeploymentContract, ProtocolDeploymentErrorCode, ProtocolDeploymentLimits, ProtocolDeploymentOptions, ProtocolEndpointPolicy, ProtocolEndpointTenantPolicy, ProtocolNamedQueryContract, ProtocolRuntimeArtifact, } from './deployments/index.js';
|
|
16
12
|
export type { ProtocolQueryImplementation, ProtocolQueryImplementationErrorCode, ProtocolQueryImplementationLimits, ProtocolQueryImplementationOptions, ProtocolSqlDialect, ProtocolSqlExpression, ProtocolSqlParameter, ProtocolSqlParameterSource, ProtocolSqlTenantPolicy, } from './query-implementations/index.js';
|
|
17
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAC5B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,EACvB,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,4CAA4C,EAC5C,gCAAgC,EAChC,mCAAmC,EACnC,6BAA6B,GAC9B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAC5B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,EACvB,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,4CAA4C,EAC5C,gCAAgC,EAChC,mCAAmC,EACnC,6BAA6B,GAC9B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,wBAAwB,CAAC;AAEhC,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,wBAAwB,CAAC;AAEhC,YAAY,EACV,2BAA2B,EAC3B,oCAAoC,EACpC,iCAAiC,EACjC,kCAAkC,EAClC,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,4 @@ export { PROTOCOL_IDENTIFIER_LIMITS, ProtocolIdentifierError, isProtocolIdentifi
|
|
|
3
3
|
export { DEFAULT_PROTOCOL_EXPRESSION_LIMITS, ProtocolExpressionError, validateProtocolExpression, validateProtocolSemanticQuery, } from './expressions/index.js';
|
|
4
4
|
export { DEFAULT_PROTOCOL_SCHEMA_LIMITS, ProtocolSchemaError, validateProtocolSchema, } from './schemas/index.js';
|
|
5
5
|
export { DEFAULT_PROTOCOL_QUERY_IMPLEMENTATION_LIMITS, ProtocolQueryImplementationError, validateProtocolQueryImplementation, validateProtocolSqlExpression, } from './query-implementations/index.js';
|
|
6
|
-
export {
|
|
7
|
-
export { DEFAULT_PROTOCOL_DEPLOYMENT_RELEASE_LIMITS, PROTOCOL_DEPLOYMENT_RELEASE_IDENTITY_DOMAIN, ProtocolDeploymentReleaseError, encodeProtocolDeploymentReleaseEnvelope, encodeProtocolDeploymentReleaseEnvelopeToString, hashProtocolDeploymentReleaseEnvelope, prepareProtocolDeploymentReleaseEnvelope, validateProtocolDeploymentReleaseEnvelope, validateProtocolDeploymentReleaseTarget, } from './releases/index.js';
|
|
8
|
-
export { DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS, PROTOCOL_DEPLOYMENT_IDENTITY_DOMAIN, ProtocolDeploymentError, encodeProtocolDeploymentContract, encodeProtocolDeploymentContractToString, hashProtocolDeploymentContract, prepareProtocolDeploymentContract, validateProtocolDatasetContract, validateProtocolDeploymentContract, } from './deployments/index.js';
|
|
6
|
+
export { DEFAULT_PROTOCOL_DEPLOYMENT_LIMITS, ProtocolDeploymentError, validateProtocolDatasetContract, validateProtocolDeploymentContract, } from './deployments/index.js';
|
package/package.json
CHANGED
package/dist/bundles/codec.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentBundleManifest, ProtocolDeploymentBundleOptions } from './types.js';
|
|
2
|
-
export declare const PROTOCOL_DEPLOYMENT_BUNDLE_IDENTITY_DOMAIN = "hypequery:deployment-bundle:v1\0";
|
|
3
|
-
export interface PreparedProtocolDeploymentBundleManifest {
|
|
4
|
-
readonly manifest: ProtocolDeploymentBundleManifest;
|
|
5
|
-
readonly canonical: string;
|
|
6
|
-
readonly bytes: Uint8Array;
|
|
7
|
-
readonly identity: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function prepareProtocolDeploymentBundleManifest(input: unknown, options?: ProtocolDeploymentBundleOptions): PreparedProtocolDeploymentBundleManifest;
|
|
10
|
-
export declare function encodeProtocolDeploymentBundleManifest(input: unknown, options?: ProtocolDeploymentBundleOptions): Uint8Array;
|
|
11
|
-
export declare function encodeProtocolDeploymentBundleManifestToString(input: unknown, options?: ProtocolDeploymentBundleOptions): string;
|
|
12
|
-
export declare function hashProtocolDeploymentBundleManifest(input: unknown, options?: ProtocolDeploymentBundleOptions): string;
|
|
13
|
-
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/bundles/codec.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,YAAY,CAAC;AAKpB,eAAO,MAAM,0CAA0C,qCAAqC,CAAC;AAE7F,MAAM,WAAW,wCAAwC;IACvD,QAAQ,CAAC,QAAQ,EAAE,gCAAgC,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,+BAAoC,GAC5C,wCAAwC,CAS1C;AAED,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,+BAAoC,GAC5C,UAAU,CAEZ;AAED,wBAAgB,8CAA8C,CAC5D,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,+BAAoC,GAC5C,MAAM,CAER;AAED,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,+BAAoC,GAC5C,MAAM,CAER"}
|
package/dist/bundles/codec.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { sha256 } from '@noble/hashes/sha2';
|
|
2
|
-
import { bytesToHex } from '@noble/hashes/utils';
|
|
3
|
-
import { serializeJcs } from '../values/jcs.js';
|
|
4
|
-
import { validateProtocolDeploymentBundleManifest } from './validate.js';
|
|
5
|
-
const textEncoder = new TextEncoder();
|
|
6
|
-
export const PROTOCOL_DEPLOYMENT_BUNDLE_IDENTITY_DOMAIN = 'hypequery:deployment-bundle:v1\0';
|
|
7
|
-
export function prepareProtocolDeploymentBundleManifest(input, options = {}) {
|
|
8
|
-
const manifest = validateProtocolDeploymentBundleManifest(input, options);
|
|
9
|
-
const canonical = serializeJcs(manifest);
|
|
10
|
-
const bytes = textEncoder.encode(canonical);
|
|
11
|
-
const identity = bytesToHex(sha256.create()
|
|
12
|
-
.update(textEncoder.encode(PROTOCOL_DEPLOYMENT_BUNDLE_IDENTITY_DOMAIN))
|
|
13
|
-
.update(bytes)
|
|
14
|
-
.digest());
|
|
15
|
-
return Object.freeze({ manifest, canonical, bytes, identity });
|
|
16
|
-
}
|
|
17
|
-
export function encodeProtocolDeploymentBundleManifest(input, options = {}) {
|
|
18
|
-
return prepareProtocolDeploymentBundleManifest(input, options).bytes;
|
|
19
|
-
}
|
|
20
|
-
export function encodeProtocolDeploymentBundleManifestToString(input, options = {}) {
|
|
21
|
-
return prepareProtocolDeploymentBundleManifest(input, options).canonical;
|
|
22
|
-
}
|
|
23
|
-
export function hashProtocolDeploymentBundleManifest(input, options = {}) {
|
|
24
|
-
return prepareProtocolDeploymentBundleManifest(input, options).identity;
|
|
25
|
-
}
|
package/dist/bundles/errors.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentBundleErrorCode } from './types.js';
|
|
2
|
-
export declare class ProtocolDeploymentBundleError extends TypeError {
|
|
3
|
-
readonly code: ProtocolDeploymentBundleErrorCode;
|
|
4
|
-
readonly path: string;
|
|
5
|
-
constructor(code: ProtocolDeploymentBundleErrorCode, path?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare function bundleError(code: ProtocolDeploymentBundleErrorCode, path?: string): never;
|
|
8
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/bundles/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAEpE,qBAAa,6BAA8B,SAAQ,SAAS;IAC1D,QAAQ,CAAC,IAAI,EAAE,iCAAiC,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,iCAAiC,EAAE,IAAI,SAAM;CAMhE;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,iCAAiC,EACvC,IAAI,SAAM,GACT,KAAK,CAEP"}
|
package/dist/bundles/errors.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export class ProtocolDeploymentBundleError extends TypeError {
|
|
2
|
-
code;
|
|
3
|
-
path;
|
|
4
|
-
constructor(code, path = '$') {
|
|
5
|
-
super(`${code} at ${path}`);
|
|
6
|
-
this.name = 'ProtocolDeploymentBundleError';
|
|
7
|
-
this.code = code;
|
|
8
|
-
this.path = path;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export function bundleError(code, path = '$') {
|
|
12
|
-
throw new ProtocolDeploymentBundleError(code, path);
|
|
13
|
-
}
|
package/dist/bundles/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { ProtocolDeploymentBundleError } from './errors.js';
|
|
2
|
-
export { PROTOCOL_DEPLOYMENT_BUNDLE_IDENTITY_DOMAIN, encodeProtocolDeploymentBundleManifest, encodeProtocolDeploymentBundleManifestToString, hashProtocolDeploymentBundleManifest, prepareProtocolDeploymentBundleManifest, } from './codec.js';
|
|
3
|
-
export type { PreparedProtocolDeploymentBundleManifest } from './codec.js';
|
|
4
|
-
export { DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS } from './limits.js';
|
|
5
|
-
export { validateProtocolDeploymentBundleManifest } from './validate.js';
|
|
6
|
-
export type { ProtocolDeploymentBundleArtifact, ProtocolDeploymentBundleDeployment, ProtocolDeploymentBundleErrorCode, ProtocolDeploymentBundleFile, ProtocolDeploymentBundleLimits, ProtocolDeploymentBundleManifest, ProtocolDeploymentBundleOptions, } from './types.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,0CAA0C,EAC1C,sCAAsC,EACtC,8CAA8C,EAC9C,oCAAoC,EACpC,uCAAuC,GACxC,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,wCAAwC,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,yCAAyC,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,wCAAwC,EAAE,MAAM,eAAe,CAAC;AACzE,YAAY,EACV,gCAAgC,EAChC,kCAAkC,EAClC,iCAAiC,EACjC,4BAA4B,EAC5B,8BAA8B,EAC9B,gCAAgC,EAChC,+BAA+B,GAChC,MAAM,YAAY,CAAC"}
|
package/dist/bundles/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { ProtocolDeploymentBundleError } from './errors.js';
|
|
2
|
-
export { PROTOCOL_DEPLOYMENT_BUNDLE_IDENTITY_DOMAIN, encodeProtocolDeploymentBundleManifest, encodeProtocolDeploymentBundleManifestToString, hashProtocolDeploymentBundleManifest, prepareProtocolDeploymentBundleManifest, } from './codec.js';
|
|
3
|
-
export { DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS } from './limits.js';
|
|
4
|
-
export { validateProtocolDeploymentBundleManifest } from './validate.js';
|
package/dist/bundles/limits.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentBundleLimits, ProtocolDeploymentBundleOptions } from './types.js';
|
|
2
|
-
export declare const DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS: Readonly<ProtocolDeploymentBundleLimits>;
|
|
3
|
-
export declare function resolveDeploymentBundleLimits(options?: ProtocolDeploymentBundleOptions): Readonly<ProtocolDeploymentBundleLimits>;
|
|
4
|
-
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/bundles/limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,yCAAyC,EACtD,QAAQ,CAAC,8BAA8B,CAMrC,CAAC;AAEH,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,+BAAoC,GAC5C,QAAQ,CAAC,8BAA8B,CAAC,CAe1C"}
|
package/dist/bundles/limits.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS = Object.freeze({
|
|
2
|
-
maxArtifacts: 100,
|
|
3
|
-
maxPathBytes: 1_024,
|
|
4
|
-
maxDeploymentBytes: 16 * 1_024 * 1_024,
|
|
5
|
-
maxArtifactBytes: 128 * 1_024 * 1_024,
|
|
6
|
-
maxTotalBytes: 256 * 1_024 * 1_024,
|
|
7
|
-
});
|
|
8
|
-
export function resolveDeploymentBundleLimits(options = {}) {
|
|
9
|
-
const result = { ...DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS };
|
|
10
|
-
for (const key of Object.keys(result)) {
|
|
11
|
-
const value = options.limits?.[key];
|
|
12
|
-
if (value === undefined)
|
|
13
|
-
continue;
|
|
14
|
-
const maximum = DEFAULT_PROTOCOL_DEPLOYMENT_BUNDLE_LIMITS[key];
|
|
15
|
-
if (!Number.isSafeInteger(value) || value < 1 || value > maximum) {
|
|
16
|
-
throw new RangeError(`${key} must be a positive safe integer no greater than ${maximum} `
|
|
17
|
-
+ '(the deployment bundle v1 maximum)');
|
|
18
|
-
}
|
|
19
|
-
result[key] = value;
|
|
20
|
-
}
|
|
21
|
-
return Object.freeze(result);
|
|
22
|
-
}
|
package/dist/bundles/types.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface ProtocolDeploymentBundleFile {
|
|
2
|
-
readonly path: string;
|
|
3
|
-
readonly sha256: string;
|
|
4
|
-
readonly byteLength: number;
|
|
5
|
-
}
|
|
6
|
-
export interface ProtocolDeploymentBundleDeployment extends ProtocolDeploymentBundleFile {
|
|
7
|
-
readonly identity: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ProtocolDeploymentBundleArtifact extends ProtocolDeploymentBundleFile {
|
|
10
|
-
readonly runtime: 'node' | 'python';
|
|
11
|
-
}
|
|
12
|
-
export interface ProtocolDeploymentBundleManifest {
|
|
13
|
-
readonly kind: 'hypequery-deployment-bundle';
|
|
14
|
-
readonly version: 1;
|
|
15
|
-
readonly deployment: ProtocolDeploymentBundleDeployment;
|
|
16
|
-
readonly artifacts: readonly ProtocolDeploymentBundleArtifact[];
|
|
17
|
-
}
|
|
18
|
-
export interface ProtocolDeploymentBundleLimits {
|
|
19
|
-
readonly maxArtifacts: number;
|
|
20
|
-
readonly maxPathBytes: number;
|
|
21
|
-
readonly maxDeploymentBytes: number;
|
|
22
|
-
readonly maxArtifactBytes: number;
|
|
23
|
-
readonly maxTotalBytes: number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Validation budgets for a deployment bundle manifest.
|
|
27
|
-
*
|
|
28
|
-
* Values may tighten the fixed bundle-v1 safety ceilings but cannot raise
|
|
29
|
-
* them. These are parser budgets, not deployment capacity settings.
|
|
30
|
-
*/
|
|
31
|
-
export interface ProtocolDeploymentBundleOptions {
|
|
32
|
-
readonly limits?: Partial<ProtocolDeploymentBundleLimits>;
|
|
33
|
-
}
|
|
34
|
-
export type ProtocolDeploymentBundleErrorCode = 'HQ_BUNDLE_TYPE' | 'HQ_BUNDLE_UNKNOWN_FIELD' | 'HQ_BUNDLE_INVALID_VERSION' | 'HQ_BUNDLE_INVALID_VALUE' | 'HQ_BUNDLE_INVALID_PATH' | 'HQ_BUNDLE_INVALID_REFERENCE' | 'HQ_BUNDLE_TOO_MANY_ITEMS' | 'HQ_BUNDLE_TOO_LARGE' | 'HQ_BUNDLE_UNSAFE_OBJECT';
|
|
35
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bundles/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,kCAAmC,SAAQ,4BAA4B;IACtF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gCAAiC,SAAQ,4BAA4B;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC;CACrC;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,IAAI,EAAE,6BAA6B,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,kCAAkC,CAAC;IACxD,QAAQ,CAAC,SAAS,EAAE,SAAS,gCAAgC,EAAE,CAAC;CACjE;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAC3D;AAED,MAAM,MAAM,iCAAiC,GACzC,gBAAgB,GAChB,yBAAyB,GACzB,2BAA2B,GAC3B,yBAAyB,GACzB,wBAAwB,GACxB,6BAA6B,GAC7B,0BAA0B,GAC1B,qBAAqB,GACrB,yBAAyB,CAAC"}
|
package/dist/bundles/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentBundleManifest, ProtocolDeploymentBundleOptions } from './types.js';
|
|
2
|
-
export declare function validateProtocolDeploymentBundleManifest(input: unknown, options?: ProtocolDeploymentBundleOptions): ProtocolDeploymentBundleManifest;
|
|
3
|
-
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/bundles/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,YAAY,CAAC;AA4HpB,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,+BAAoC,GAC5C,gCAAgC,CAwClC"}
|
package/dist/bundles/validate.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { bundleError } from './errors.js';
|
|
2
|
-
import { resolveDeploymentBundleLimits } from './limits.js';
|
|
3
|
-
const textEncoder = new TextEncoder();
|
|
4
|
-
const SHA256_PATTERN = /^[0-9a-f]{64}$/;
|
|
5
|
-
const PATH_SEGMENT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
6
|
-
const WINDOWS_RESERVED_NAME = /^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i;
|
|
7
|
-
function requireRecord(input, path) {
|
|
8
|
-
if (typeof input !== 'object' || input === null || Array.isArray(input)) {
|
|
9
|
-
bundleError('HQ_BUNDLE_TYPE', path);
|
|
10
|
-
}
|
|
11
|
-
const prototype = Object.getPrototypeOf(input);
|
|
12
|
-
if (prototype !== Object.prototype && prototype !== null) {
|
|
13
|
-
bundleError('HQ_BUNDLE_UNSAFE_OBJECT', path);
|
|
14
|
-
}
|
|
15
|
-
if (Object.getOwnPropertySymbols(input).length > 0) {
|
|
16
|
-
bundleError('HQ_BUNDLE_UNSAFE_OBJECT', path);
|
|
17
|
-
}
|
|
18
|
-
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(input))) {
|
|
19
|
-
if (!descriptor.enumerable || !('value' in descriptor)) {
|
|
20
|
-
bundleError('HQ_BUNDLE_UNSAFE_OBJECT', path);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return input;
|
|
24
|
-
}
|
|
25
|
-
function requireArray(input, path, maxItems) {
|
|
26
|
-
if (!Array.isArray(input))
|
|
27
|
-
bundleError('HQ_BUNDLE_TYPE', path);
|
|
28
|
-
if (Object.getPrototypeOf(input) !== Array.prototype
|
|
29
|
-
|| Object.getOwnPropertySymbols(input).length > 0) {
|
|
30
|
-
bundleError('HQ_BUNDLE_UNSAFE_OBJECT', path);
|
|
31
|
-
}
|
|
32
|
-
if (input.length > maxItems)
|
|
33
|
-
bundleError('HQ_BUNDLE_TOO_MANY_ITEMS', path);
|
|
34
|
-
const descriptors = Object.getOwnPropertyDescriptors(input);
|
|
35
|
-
for (let index = 0; index < input.length; index += 1) {
|
|
36
|
-
const descriptor = descriptors[String(index)];
|
|
37
|
-
if (!descriptor || !descriptor.enumerable || !('value' in descriptor)) {
|
|
38
|
-
bundleError('HQ_BUNDLE_UNSAFE_OBJECT', `${path}[${index}]`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (Object.keys(input).length !== input.length
|
|
42
|
-
|| Object.getOwnPropertyNames(input).length !== input.length + 1) {
|
|
43
|
-
bundleError('HQ_BUNDLE_UNSAFE_OBJECT', path);
|
|
44
|
-
}
|
|
45
|
-
return input;
|
|
46
|
-
}
|
|
47
|
-
function exactFields(value, required, path) {
|
|
48
|
-
const allowed = new Set(required);
|
|
49
|
-
for (const key of Object.keys(value)) {
|
|
50
|
-
if (!allowed.has(key))
|
|
51
|
-
bundleError('HQ_BUNDLE_UNKNOWN_FIELD', `${path}.${key}`);
|
|
52
|
-
}
|
|
53
|
-
for (const key of required) {
|
|
54
|
-
if (!Object.hasOwn(value, key))
|
|
55
|
-
bundleError('HQ_BUNDLE_TYPE', `${path}.${key}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function freezeRecord(entries) {
|
|
59
|
-
return Object.freeze(Object.assign(Object.create(null), entries));
|
|
60
|
-
}
|
|
61
|
-
function digest(value, path) {
|
|
62
|
-
if (typeof value !== 'string')
|
|
63
|
-
bundleError('HQ_BUNDLE_TYPE', path);
|
|
64
|
-
if (!SHA256_PATTERN.test(value))
|
|
65
|
-
bundleError('HQ_BUNDLE_INVALID_VALUE', path);
|
|
66
|
-
return value;
|
|
67
|
-
}
|
|
68
|
-
function byteLength(value, path, maximum) {
|
|
69
|
-
if (!Number.isSafeInteger(value) || value < 1) {
|
|
70
|
-
bundleError('HQ_BUNDLE_INVALID_VALUE', path);
|
|
71
|
-
}
|
|
72
|
-
if (value > maximum)
|
|
73
|
-
bundleError('HQ_BUNDLE_TOO_LARGE', path);
|
|
74
|
-
return value;
|
|
75
|
-
}
|
|
76
|
-
function relativePath(value, path, maxBytes) {
|
|
77
|
-
if (typeof value !== 'string')
|
|
78
|
-
bundleError('HQ_BUNDLE_TYPE', path);
|
|
79
|
-
if (value.length > maxBytes || textEncoder.encode(value).byteLength > maxBytes) {
|
|
80
|
-
bundleError('HQ_BUNDLE_TOO_LARGE', path);
|
|
81
|
-
}
|
|
82
|
-
const segments = value.split('/');
|
|
83
|
-
if (segments.some(segment => !PATH_SEGMENT_PATTERN.test(segment)
|
|
84
|
-
|| segment.endsWith('.')
|
|
85
|
-
|| WINDOWS_RESERVED_NAME.test(segment))) {
|
|
86
|
-
bundleError('HQ_BUNDLE_INVALID_PATH', path);
|
|
87
|
-
}
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
function validateDeployment(input, path, limits) {
|
|
91
|
-
const value = requireRecord(input, path);
|
|
92
|
-
exactFields(value, ['path', 'identity', 'sha256', 'byteLength'], path);
|
|
93
|
-
return freezeRecord({
|
|
94
|
-
path: relativePath(value.path, `${path}.path`, limits.maxPathBytes),
|
|
95
|
-
identity: digest(value.identity, `${path}.identity`),
|
|
96
|
-
sha256: digest(value.sha256, `${path}.sha256`),
|
|
97
|
-
byteLength: byteLength(value.byteLength, `${path}.byteLength`, limits.maxDeploymentBytes),
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function validateArtifact(input, path, limits) {
|
|
101
|
-
const value = requireRecord(input, path);
|
|
102
|
-
exactFields(value, ['runtime', 'path', 'sha256', 'byteLength'], path);
|
|
103
|
-
if (value.runtime !== 'node' && value.runtime !== 'python') {
|
|
104
|
-
if (typeof value.runtime !== 'string')
|
|
105
|
-
bundleError('HQ_BUNDLE_TYPE', `${path}.runtime`);
|
|
106
|
-
bundleError('HQ_BUNDLE_INVALID_VALUE', `${path}.runtime`);
|
|
107
|
-
}
|
|
108
|
-
return freezeRecord({
|
|
109
|
-
runtime: value.runtime,
|
|
110
|
-
path: relativePath(value.path, `${path}.path`, limits.maxPathBytes),
|
|
111
|
-
sha256: digest(value.sha256, `${path}.sha256`),
|
|
112
|
-
byteLength: byteLength(value.byteLength, `${path}.byteLength`, limits.maxArtifactBytes),
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
export function validateProtocolDeploymentBundleManifest(input, options = {}) {
|
|
116
|
-
const limits = resolveDeploymentBundleLimits(options);
|
|
117
|
-
const value = requireRecord(input, '$');
|
|
118
|
-
exactFields(value, ['kind', 'version', 'deployment', 'artifacts'], '$');
|
|
119
|
-
if (value.kind !== 'hypequery-deployment-bundle') {
|
|
120
|
-
if (typeof value.kind !== 'string')
|
|
121
|
-
bundleError('HQ_BUNDLE_TYPE', '$.kind');
|
|
122
|
-
bundleError('HQ_BUNDLE_INVALID_VALUE', '$.kind');
|
|
123
|
-
}
|
|
124
|
-
if (value.version !== 1) {
|
|
125
|
-
if (typeof value.version !== 'number')
|
|
126
|
-
bundleError('HQ_BUNDLE_TYPE', '$.version');
|
|
127
|
-
bundleError('HQ_BUNDLE_INVALID_VERSION', '$.version');
|
|
128
|
-
}
|
|
129
|
-
const deployment = validateDeployment(value.deployment, '$.deployment', limits);
|
|
130
|
-
const artifacts = Object.freeze(requireArray(value.artifacts, '$.artifacts', limits.maxArtifacts)
|
|
131
|
-
.map((artifact, index) => validateArtifact(artifact, `$.artifacts[${index}]`, limits)));
|
|
132
|
-
const paths = [deployment.path, ...artifacts.map(artifact => artifact.path)];
|
|
133
|
-
if (new Set(paths).size !== paths.length
|
|
134
|
-
|| new Set(paths.map(bundlePath => bundlePath.toLowerCase())).size !== paths.length) {
|
|
135
|
-
bundleError('HQ_BUNDLE_INVALID_REFERENCE', '$.artifacts');
|
|
136
|
-
}
|
|
137
|
-
if (new Set(artifacts.map(artifact => artifact.sha256)).size !== artifacts.length) {
|
|
138
|
-
bundleError('HQ_BUNDLE_INVALID_REFERENCE', '$.artifacts');
|
|
139
|
-
}
|
|
140
|
-
const sortedPaths = artifacts.map(artifact => artifact.path).sort();
|
|
141
|
-
if (artifacts.some((artifact, index) => artifact.path !== sortedPaths[index])) {
|
|
142
|
-
bundleError('HQ_BUNDLE_INVALID_VALUE', '$.artifacts');
|
|
143
|
-
}
|
|
144
|
-
const totalBytes = deployment.byteLength
|
|
145
|
-
+ artifacts.reduce((total, artifact) => total + artifact.byteLength, 0);
|
|
146
|
-
if (!Number.isSafeInteger(totalBytes) || totalBytes > limits.maxTotalBytes) {
|
|
147
|
-
bundleError('HQ_BUNDLE_TOO_LARGE', '$');
|
|
148
|
-
}
|
|
149
|
-
return freezeRecord({
|
|
150
|
-
kind: 'hypequery-deployment-bundle',
|
|
151
|
-
version: 1,
|
|
152
|
-
deployment,
|
|
153
|
-
artifacts,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentContract, ProtocolDeploymentOptions } from './types.js';
|
|
2
|
-
/** Domain prefix for deployment contract v1 identities. */
|
|
3
|
-
export declare const PROTOCOL_DEPLOYMENT_IDENTITY_DOMAIN = "hypequery:deployment:v1\0";
|
|
4
|
-
export interface PreparedProtocolDeploymentContract {
|
|
5
|
-
readonly contract: ProtocolDeploymentContract;
|
|
6
|
-
readonly canonical: string;
|
|
7
|
-
readonly bytes: Uint8Array;
|
|
8
|
-
readonly identity: string;
|
|
9
|
-
}
|
|
10
|
-
/** Validates and serializes once, returning every deployment artifact representation. */
|
|
11
|
-
export declare function prepareProtocolDeploymentContract(input: unknown, options?: ProtocolDeploymentOptions): PreparedProtocolDeploymentContract;
|
|
12
|
-
/** Validates a deployment contract and returns canonical RFC 8785 UTF-8 bytes. */
|
|
13
|
-
export declare function encodeProtocolDeploymentContract(input: unknown, options?: ProtocolDeploymentOptions): Uint8Array;
|
|
14
|
-
/** String form of the canonical deployment contract bytes. */
|
|
15
|
-
export declare function encodeProtocolDeploymentContractToString(input: unknown, options?: ProtocolDeploymentOptions): string;
|
|
16
|
-
/** Domain-separated SHA-256 identity of a validated deployment contract. */
|
|
17
|
-
export declare function hashProtocolDeploymentContract(input: unknown, options?: ProtocolDeploymentOptions): string;
|
|
18
|
-
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/deployments/codec.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAKxF,2DAA2D;AAC3D,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AAE/E,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,yFAAyF;AACzF,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,kCAAkC,CAcpC;AAED,kFAAkF;AAClF,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,UAAU,CAEZ;AAED,8DAA8D;AAC9D,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAER;AAED,4EAA4E;AAC5E,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAER"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { sha256 } from '@noble/hashes/sha2';
|
|
2
|
-
import { bytesToHex } from '@noble/hashes/utils';
|
|
3
|
-
import { serializeJcs } from '../values/jcs.js';
|
|
4
|
-
import { validateProtocolDeploymentContract } from './validate.js';
|
|
5
|
-
const textEncoder = new TextEncoder();
|
|
6
|
-
/** Domain prefix for deployment contract v1 identities. */
|
|
7
|
-
export const PROTOCOL_DEPLOYMENT_IDENTITY_DOMAIN = 'hypequery:deployment:v1\0';
|
|
8
|
-
/** Validates and serializes once, returning every deployment artifact representation. */
|
|
9
|
-
export function prepareProtocolDeploymentContract(input, options = {}) {
|
|
10
|
-
const contract = validateProtocolDeploymentContract(input, options);
|
|
11
|
-
const canonical = serializeJcs(contract);
|
|
12
|
-
const bytes = textEncoder.encode(canonical);
|
|
13
|
-
const identity = bytesToHex(sha256.create()
|
|
14
|
-
.update(textEncoder.encode(PROTOCOL_DEPLOYMENT_IDENTITY_DOMAIN))
|
|
15
|
-
.update(bytes)
|
|
16
|
-
.digest());
|
|
17
|
-
return Object.freeze({
|
|
18
|
-
contract,
|
|
19
|
-
canonical,
|
|
20
|
-
bytes,
|
|
21
|
-
identity,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/** Validates a deployment contract and returns canonical RFC 8785 UTF-8 bytes. */
|
|
25
|
-
export function encodeProtocolDeploymentContract(input, options = {}) {
|
|
26
|
-
return prepareProtocolDeploymentContract(input, options).bytes;
|
|
27
|
-
}
|
|
28
|
-
/** String form of the canonical deployment contract bytes. */
|
|
29
|
-
export function encodeProtocolDeploymentContractToString(input, options = {}) {
|
|
30
|
-
return prepareProtocolDeploymentContract(input, options).canonical;
|
|
31
|
-
}
|
|
32
|
-
/** Domain-separated SHA-256 identity of a validated deployment contract. */
|
|
33
|
-
export function hashProtocolDeploymentContract(input, options = {}) {
|
|
34
|
-
return prepareProtocolDeploymentContract(input, options).identity;
|
|
35
|
-
}
|
package/dist/releases/codec.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentReleaseEnvelope, ProtocolDeploymentReleaseOptions } from './types.js';
|
|
2
|
-
export declare const PROTOCOL_DEPLOYMENT_RELEASE_IDENTITY_DOMAIN = "hypequery:deployment-release:v1\0";
|
|
3
|
-
export interface PreparedProtocolDeploymentReleaseEnvelope {
|
|
4
|
-
readonly release: ProtocolDeploymentReleaseEnvelope;
|
|
5
|
-
readonly canonical: string;
|
|
6
|
-
readonly bytes: Uint8Array;
|
|
7
|
-
readonly identity: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function prepareProtocolDeploymentReleaseEnvelope(input: unknown, options?: ProtocolDeploymentReleaseOptions): PreparedProtocolDeploymentReleaseEnvelope;
|
|
10
|
-
export declare function encodeProtocolDeploymentReleaseEnvelope(input: unknown, options?: ProtocolDeploymentReleaseOptions): Uint8Array;
|
|
11
|
-
export declare function encodeProtocolDeploymentReleaseEnvelopeToString(input: unknown, options?: ProtocolDeploymentReleaseOptions): string;
|
|
12
|
-
export declare function hashProtocolDeploymentReleaseEnvelope(input: unknown, options?: ProtocolDeploymentReleaseOptions): string;
|
|
13
|
-
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/releases/codec.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iCAAiC,EACjC,gCAAgC,EACjC,MAAM,YAAY,CAAC;AAKpB,eAAO,MAAM,2CAA2C,sCAAsC,CAAC;AAE/F,MAAM,WAAW,yCAAyC;IACxD,QAAQ,CAAC,OAAO,EAAE,iCAAiC,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,gCAAqC,GAC7C,yCAAyC,CAS3C;AAED,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,gCAAqC,GAC7C,UAAU,CAEZ;AAED,wBAAgB,+CAA+C,CAC7D,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,gCAAqC,GAC7C,MAAM,CAER;AAED,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,gCAAqC,GAC7C,MAAM,CAER"}
|
package/dist/releases/codec.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { sha256 } from '@noble/hashes/sha2';
|
|
2
|
-
import { bytesToHex } from '@noble/hashes/utils';
|
|
3
|
-
import { serializeJcs } from '../values/jcs.js';
|
|
4
|
-
import { validateProtocolDeploymentReleaseEnvelope } from './validate.js';
|
|
5
|
-
const textEncoder = new TextEncoder();
|
|
6
|
-
export const PROTOCOL_DEPLOYMENT_RELEASE_IDENTITY_DOMAIN = 'hypequery:deployment-release:v1\0';
|
|
7
|
-
export function prepareProtocolDeploymentReleaseEnvelope(input, options = {}) {
|
|
8
|
-
const release = validateProtocolDeploymentReleaseEnvelope(input, options);
|
|
9
|
-
const canonical = serializeJcs(release);
|
|
10
|
-
const bytes = textEncoder.encode(canonical);
|
|
11
|
-
const identity = bytesToHex(sha256.create()
|
|
12
|
-
.update(textEncoder.encode(PROTOCOL_DEPLOYMENT_RELEASE_IDENTITY_DOMAIN))
|
|
13
|
-
.update(bytes)
|
|
14
|
-
.digest());
|
|
15
|
-
return Object.freeze({ release, canonical, bytes, identity });
|
|
16
|
-
}
|
|
17
|
-
export function encodeProtocolDeploymentReleaseEnvelope(input, options = {}) {
|
|
18
|
-
return prepareProtocolDeploymentReleaseEnvelope(input, options).bytes;
|
|
19
|
-
}
|
|
20
|
-
export function encodeProtocolDeploymentReleaseEnvelopeToString(input, options = {}) {
|
|
21
|
-
return prepareProtocolDeploymentReleaseEnvelope(input, options).canonical;
|
|
22
|
-
}
|
|
23
|
-
export function hashProtocolDeploymentReleaseEnvelope(input, options = {}) {
|
|
24
|
-
return prepareProtocolDeploymentReleaseEnvelope(input, options).identity;
|
|
25
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentReleaseErrorCode } from './types.js';
|
|
2
|
-
export declare class ProtocolDeploymentReleaseError extends TypeError {
|
|
3
|
-
readonly code: ProtocolDeploymentReleaseErrorCode;
|
|
4
|
-
readonly path: string;
|
|
5
|
-
constructor(code: ProtocolDeploymentReleaseErrorCode, path?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare function releaseError(code: ProtocolDeploymentReleaseErrorCode, path?: string): never;
|
|
8
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/releases/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAC;AAErE,qBAAa,8BAA+B,SAAQ,SAAS;IAC3D,QAAQ,CAAC,IAAI,EAAE,kCAAkC,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,kCAAkC,EAAE,IAAI,SAAM;CAMjE;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,kCAAkC,EACxC,IAAI,SAAM,GACT,KAAK,CAEP"}
|
package/dist/releases/errors.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export class ProtocolDeploymentReleaseError extends TypeError {
|
|
2
|
-
code;
|
|
3
|
-
path;
|
|
4
|
-
constructor(code, path = '$') {
|
|
5
|
-
super(`${code} at ${path}`);
|
|
6
|
-
this.name = 'ProtocolDeploymentReleaseError';
|
|
7
|
-
this.code = code;
|
|
8
|
-
this.path = path;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export function releaseError(code, path = '$') {
|
|
12
|
-
throw new ProtocolDeploymentReleaseError(code, path);
|
|
13
|
-
}
|
package/dist/releases/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { ProtocolDeploymentReleaseError } from './errors.js';
|
|
2
|
-
export { PROTOCOL_DEPLOYMENT_RELEASE_IDENTITY_DOMAIN, encodeProtocolDeploymentReleaseEnvelope, encodeProtocolDeploymentReleaseEnvelopeToString, hashProtocolDeploymentReleaseEnvelope, prepareProtocolDeploymentReleaseEnvelope, } from './codec.js';
|
|
3
|
-
export type { PreparedProtocolDeploymentReleaseEnvelope } from './codec.js';
|
|
4
|
-
export { DEFAULT_PROTOCOL_DEPLOYMENT_RELEASE_LIMITS } from './limits.js';
|
|
5
|
-
export { validateProtocolDeploymentReleaseEnvelope, validateProtocolDeploymentReleaseTarget, } from './validate.js';
|
|
6
|
-
export type { ProtocolDeploymentReleaseEnvelope, ProtocolDeploymentReleaseErrorCode, ProtocolDeploymentReleaseLimits, ProtocolDeploymentReleaseOptions, ProtocolDeploymentReleaseTarget, } from './types.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/releases/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,2CAA2C,EAC3C,uCAAuC,EACvC,+CAA+C,EAC/C,qCAAqC,EACrC,wCAAwC,GACzC,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,yCAAyC,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,0CAA0C,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EACL,yCAAyC,EACzC,uCAAuC,GACxC,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,iCAAiC,EACjC,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,+BAA+B,GAChC,MAAM,YAAY,CAAC"}
|
package/dist/releases/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { ProtocolDeploymentReleaseError } from './errors.js';
|
|
2
|
-
export { PROTOCOL_DEPLOYMENT_RELEASE_IDENTITY_DOMAIN, encodeProtocolDeploymentReleaseEnvelope, encodeProtocolDeploymentReleaseEnvelopeToString, hashProtocolDeploymentReleaseEnvelope, prepareProtocolDeploymentReleaseEnvelope, } from './codec.js';
|
|
3
|
-
export { DEFAULT_PROTOCOL_DEPLOYMENT_RELEASE_LIMITS } from './limits.js';
|
|
4
|
-
export { validateProtocolDeploymentReleaseEnvelope, validateProtocolDeploymentReleaseTarget, } from './validate.js';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentReleaseLimits, ProtocolDeploymentReleaseOptions } from './types.js';
|
|
2
|
-
export declare const DEFAULT_PROTOCOL_DEPLOYMENT_RELEASE_LIMITS: Readonly<ProtocolDeploymentReleaseLimits>;
|
|
3
|
-
export declare function resolveDeploymentReleaseLimits(options?: ProtocolDeploymentReleaseOptions): Readonly<ProtocolDeploymentReleaseLimits>;
|
|
4
|
-
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/releases/limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,0CAA0C,EACvD,QAAQ,CAAC,+BAA+B,CAEtC,CAAC;AAEH,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,gCAAqC,GAC7C,QAAQ,CAAC,+BAA+B,CAAC,CAe3C"}
|
package/dist/releases/limits.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_PROTOCOL_DEPLOYMENT_RELEASE_LIMITS = Object.freeze({
|
|
2
|
-
maxTargetBytes: 128,
|
|
3
|
-
});
|
|
4
|
-
export function resolveDeploymentReleaseLimits(options = {}) {
|
|
5
|
-
const result = { ...DEFAULT_PROTOCOL_DEPLOYMENT_RELEASE_LIMITS };
|
|
6
|
-
for (const key of Object.keys(result)) {
|
|
7
|
-
const value = options.limits?.[key];
|
|
8
|
-
if (value === undefined)
|
|
9
|
-
continue;
|
|
10
|
-
const maximum = DEFAULT_PROTOCOL_DEPLOYMENT_RELEASE_LIMITS[key];
|
|
11
|
-
if (!Number.isSafeInteger(value) || value < 1 || value > maximum) {
|
|
12
|
-
throw new RangeError(`${key} must be a positive safe integer no greater than ${maximum} `
|
|
13
|
-
+ '(the deployment release v1 maximum)');
|
|
14
|
-
}
|
|
15
|
-
result[key] = value;
|
|
16
|
-
}
|
|
17
|
-
return Object.freeze(result);
|
|
18
|
-
}
|
package/dist/releases/types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface ProtocolDeploymentReleaseTarget {
|
|
2
|
-
readonly project: string;
|
|
3
|
-
readonly environment: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ProtocolDeploymentReleaseEnvelope {
|
|
6
|
-
readonly kind: 'hypequery-deployment-release';
|
|
7
|
-
readonly version: 1;
|
|
8
|
-
readonly bundleIdentity: string;
|
|
9
|
-
readonly target: ProtocolDeploymentReleaseTarget;
|
|
10
|
-
}
|
|
11
|
-
export interface ProtocolDeploymentReleaseLimits {
|
|
12
|
-
readonly maxTargetBytes: number;
|
|
13
|
-
}
|
|
14
|
-
/** Parser budgets that may tighten, but not raise, release-envelope v1 limits. */
|
|
15
|
-
export interface ProtocolDeploymentReleaseOptions {
|
|
16
|
-
readonly limits?: Partial<ProtocolDeploymentReleaseLimits>;
|
|
17
|
-
}
|
|
18
|
-
export type ProtocolDeploymentReleaseErrorCode = 'HQ_RELEASE_TYPE' | 'HQ_RELEASE_UNKNOWN_FIELD' | 'HQ_RELEASE_INVALID_VERSION' | 'HQ_RELEASE_INVALID_VALUE' | 'HQ_RELEASE_TOO_LARGE' | 'HQ_RELEASE_UNSAFE_OBJECT';
|
|
19
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/releases/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,IAAI,EAAE,8BAA8B,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,+BAA+B,CAAC;CAClD;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,kFAAkF;AAClF,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC,CAAC;CAC5D;AAED,MAAM,MAAM,kCAAkC,GAC1C,iBAAiB,GACjB,0BAA0B,GAC1B,4BAA4B,GAC5B,0BAA0B,GAC1B,sBAAsB,GACtB,0BAA0B,CAAC"}
|
package/dist/releases/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ProtocolDeploymentReleaseEnvelope, ProtocolDeploymentReleaseOptions, ProtocolDeploymentReleaseTarget } from './types.js';
|
|
2
|
-
export declare function validateProtocolDeploymentReleaseTarget(input: unknown, options?: ProtocolDeploymentReleaseOptions): ProtocolDeploymentReleaseTarget;
|
|
3
|
-
export declare function validateProtocolDeploymentReleaseEnvelope(input: unknown, options?: ProtocolDeploymentReleaseOptions): ProtocolDeploymentReleaseEnvelope;
|
|
4
|
-
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/releases/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iCAAiC,EACjC,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,YAAY,CAAC;AA6DpB,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,gCAAqC,GAC7C,+BAA+B,CAKjC;AAED,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,gCAAqC,GAC7C,iCAAiC,CAwBnC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { releaseError } from './errors.js';
|
|
2
|
-
import { resolveDeploymentReleaseLimits } from './limits.js';
|
|
3
|
-
const SHA256_PATTERN = /^[0-9a-f]{64}$/;
|
|
4
|
-
const TARGET_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]*$/;
|
|
5
|
-
const textEncoder = new TextEncoder();
|
|
6
|
-
function requireRecord(input, path) {
|
|
7
|
-
if (typeof input !== 'object' || input === null || Array.isArray(input)) {
|
|
8
|
-
releaseError('HQ_RELEASE_TYPE', path);
|
|
9
|
-
}
|
|
10
|
-
const prototype = Object.getPrototypeOf(input);
|
|
11
|
-
if (prototype !== Object.prototype && prototype !== null) {
|
|
12
|
-
releaseError('HQ_RELEASE_UNSAFE_OBJECT', path);
|
|
13
|
-
}
|
|
14
|
-
if (Object.getOwnPropertySymbols(input).length > 0) {
|
|
15
|
-
releaseError('HQ_RELEASE_UNSAFE_OBJECT', path);
|
|
16
|
-
}
|
|
17
|
-
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(input))) {
|
|
18
|
-
if (!descriptor.enumerable || !('value' in descriptor)) {
|
|
19
|
-
releaseError('HQ_RELEASE_UNSAFE_OBJECT', path);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return input;
|
|
23
|
-
}
|
|
24
|
-
function exactFields(value, required, path) {
|
|
25
|
-
const allowed = new Set(required);
|
|
26
|
-
for (const key of Object.keys(value)) {
|
|
27
|
-
if (!allowed.has(key))
|
|
28
|
-
releaseError('HQ_RELEASE_UNKNOWN_FIELD', `${path}.${key}`);
|
|
29
|
-
}
|
|
30
|
-
for (const key of required) {
|
|
31
|
-
if (!Object.hasOwn(value, key))
|
|
32
|
-
releaseError('HQ_RELEASE_TYPE', `${path}.${key}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function freezeRecord(entries) {
|
|
36
|
-
return Object.freeze(Object.assign(Object.create(null), entries));
|
|
37
|
-
}
|
|
38
|
-
function targetToken(value, path, maximum) {
|
|
39
|
-
if (typeof value !== 'string')
|
|
40
|
-
releaseError('HQ_RELEASE_TYPE', path);
|
|
41
|
-
if (value.length > maximum || textEncoder.encode(value).byteLength > maximum) {
|
|
42
|
-
releaseError('HQ_RELEASE_TOO_LARGE', path);
|
|
43
|
-
}
|
|
44
|
-
if (!TARGET_PATTERN.test(value))
|
|
45
|
-
releaseError('HQ_RELEASE_INVALID_VALUE', path);
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
function validateTargetWithMaximum(input, maximum) {
|
|
49
|
-
const value = requireRecord(input, '$.target');
|
|
50
|
-
exactFields(value, ['project', 'environment'], '$.target');
|
|
51
|
-
return freezeRecord({
|
|
52
|
-
project: targetToken(value.project, '$.target.project', maximum),
|
|
53
|
-
environment: targetToken(value.environment, '$.target.environment', maximum),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
export function validateProtocolDeploymentReleaseTarget(input, options = {}) {
|
|
57
|
-
return validateTargetWithMaximum(input, resolveDeploymentReleaseLimits(options).maxTargetBytes);
|
|
58
|
-
}
|
|
59
|
-
export function validateProtocolDeploymentReleaseEnvelope(input, options = {}) {
|
|
60
|
-
const limits = resolveDeploymentReleaseLimits(options);
|
|
61
|
-
const value = requireRecord(input, '$');
|
|
62
|
-
exactFields(value, ['kind', 'version', 'bundleIdentity', 'target'], '$');
|
|
63
|
-
if (value.kind !== 'hypequery-deployment-release') {
|
|
64
|
-
if (typeof value.kind !== 'string')
|
|
65
|
-
releaseError('HQ_RELEASE_TYPE', '$.kind');
|
|
66
|
-
releaseError('HQ_RELEASE_INVALID_VALUE', '$.kind');
|
|
67
|
-
}
|
|
68
|
-
if (value.version !== 1) {
|
|
69
|
-
if (typeof value.version !== 'number')
|
|
70
|
-
releaseError('HQ_RELEASE_TYPE', '$.version');
|
|
71
|
-
releaseError('HQ_RELEASE_INVALID_VERSION', '$.version');
|
|
72
|
-
}
|
|
73
|
-
if (typeof value.bundleIdentity !== 'string') {
|
|
74
|
-
releaseError('HQ_RELEASE_TYPE', '$.bundleIdentity');
|
|
75
|
-
}
|
|
76
|
-
if (!SHA256_PATTERN.test(value.bundleIdentity)) {
|
|
77
|
-
releaseError('HQ_RELEASE_INVALID_VALUE', '$.bundleIdentity');
|
|
78
|
-
}
|
|
79
|
-
return freezeRecord({
|
|
80
|
-
kind: 'hypequery-deployment-release',
|
|
81
|
-
version: 1,
|
|
82
|
-
bundleIdentity: value.bundleIdentity,
|
|
83
|
-
target: validateTargetWithMaximum(value.target, limits.maxTargetBytes),
|
|
84
|
-
});
|
|
85
|
-
}
|