@hypequery/deployment 0.3.0 → 0.4.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 CHANGED
@@ -245,4 +245,51 @@ remote-sandbox isolation behind the same lifecycle interface.
245
245
  The reference worker is a lifecycle boundary, not a hostile-code security
246
246
  sandbox. Only trusted deployment code should use it directly.
247
247
 
248
+ ## Data-plane execution
249
+
250
+ `createDeploymentDataPlane` executes named-query routes from one validated,
251
+ immutable deployment contract. It applies bounded input defaults and unknown
252
+ property behavior, enforces access and tenant policy, dispatches the declared
253
+ implementation kind through an injected adapter, and validates output before
254
+ returning it.
255
+
256
+ ```ts
257
+ import {
258
+ createDeploymentDataPlane,
259
+ createDeploymentRuntimeSupervisorExecutor,
260
+ } from '@hypequery/deployment';
261
+
262
+ const executeRuntimeReference = createDeploymentRuntimeSupervisorExecutor({
263
+ supervisor,
264
+ target,
265
+ activationRevision: snapshot.activation.revision,
266
+ argument: ({ input, principal, tenant }) => ({ input, principal, tenant }),
267
+ });
268
+
269
+ const dataPlane = createDeploymentDataPlane({
270
+ deployment: snapshot.deployment,
271
+ authenticate,
272
+ resolveTenant,
273
+ executeSemanticPlan,
274
+ executeCompiledSql,
275
+ executeRuntimeReference,
276
+ });
277
+
278
+ const result = await dataPlane.execute({
279
+ method: 'POST',
280
+ path: '/analytics/queries/orders',
281
+ credentials,
282
+ input: { status: 'paid' },
283
+ });
284
+ ```
285
+
286
+ The runtime-supervisor adapter requires the exact activation revision used to
287
+ construct the data plane. A later activation therefore cannot accidentally run
288
+ against stale route or schema metadata. Argument mapping remains explicit so a
289
+ host can preserve the handler contract of its chosen runtime.
290
+
291
+ Semantic-plan and compiled-SQL adapters own database execution. The core passes
292
+ only validated values, the fixed implementation artifact, and closed typed SQL
293
+ parameter bindings; it does not select credentials or interpolate SQL.
294
+
248
295
  The package is ESM-only and requires Node.js 20 or newer.
@@ -0,0 +1,5 @@
1
+ import { type ProtocolSchemaValueLimits } from '@hypequery/protocol';
2
+ export type DeploymentDataPlaneLimits = ProtocolSchemaValueLimits;
3
+ export declare const DEFAULT_DEPLOYMENT_DATA_PLANE_LIMITS: Readonly<ProtocolSchemaValueLimits>;
4
+ export declare function resolveDeploymentDataPlaneLimits(input?: Partial<DeploymentDataPlaneLimits>): Readonly<DeploymentDataPlaneLimits>;
5
+ //# sourceMappingURL=data-plane-limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-plane-limits.d.ts","sourceRoot":"","sources":["../src/data-plane-limits.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AAElE,eAAO,MAAM,oCAAoC,qCAAuC,CAAC;AAEzF,wBAAgB,gCAAgC,CAC9C,KAAK,GAAE,OAAO,CAAC,yBAAyB,CAAM,GAC7C,QAAQ,CAAC,yBAAyB,CAAC,CAErC"}
@@ -0,0 +1,5 @@
1
+ import { DEFAULT_PROTOCOL_SCHEMA_VALUE_LIMITS, resolveProtocolSchemaValueLimits, } from '@hypequery/protocol';
2
+ export const DEFAULT_DEPLOYMENT_DATA_PLANE_LIMITS = DEFAULT_PROTOCOL_SCHEMA_VALUE_LIMITS;
3
+ export function resolveDeploymentDataPlaneLimits(input = {}) {
4
+ return resolveProtocolSchemaValueLimits({ limits: input });
5
+ }
@@ -0,0 +1,13 @@
1
+ import type { ProtocolDeploymentReleaseTarget } from '@hypequery/protocol';
2
+ import type { DeploymentRuntimeReferenceExecutionInput } from './data-plane.js';
3
+ import type { DeploymentRuntimeSupervisor } from './runtime-supervisor.js';
4
+ export interface DeploymentRuntimeSupervisorExecutorOptions {
5
+ readonly supervisor: DeploymentRuntimeSupervisor;
6
+ readonly target: ProtocolDeploymentReleaseTarget;
7
+ /** The immutable activation generation used to build the matching data plane. */
8
+ readonly activationRevision: string;
9
+ /** Convert provider-neutral execution context into the runtime handler's argument contract. */
10
+ readonly argument: (input: DeploymentRuntimeReferenceExecutionInput) => unknown;
11
+ }
12
+ export declare function createDeploymentRuntimeSupervisorExecutor(options: DeploymentRuntimeSupervisorExecutorOptions): (input: DeploymentRuntimeReferenceExecutionInput) => Promise<unknown>;
13
+ //# sourceMappingURL=data-plane-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-plane-runtime.d.ts","sourceRoot":"","sources":["../src/data-plane-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EACV,wCAAwC,EACzC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,WAAW,0CAA0C;IACzD,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,+BAA+B,CAAC;IACjD,iFAAiF;IACjF,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,wCAAwC,KAAK,OAAO,CAAC;CACjF;AAED,wBAAgB,yCAAyC,CACvD,OAAO,EAAE,0CAA0C,GAClD,CAAC,KAAK,EAAE,wCAAwC,KAAK,OAAO,CAAC,OAAO,CAAC,CAWvE"}
@@ -0,0 +1,12 @@
1
+ export function createDeploymentRuntimeSupervisorExecutor(options) {
2
+ if (!/^[0-9a-f]{64}$/.test(options.activationRevision)) {
3
+ throw new RangeError('activationRevision must be a lowercase SHA-256 identity');
4
+ }
5
+ return async (input) => await options.supervisor.invoke({
6
+ target: options.target,
7
+ activationRevision: options.activationRevision,
8
+ query: input.query.name,
9
+ argument: options.argument(input),
10
+ signal: input.signal,
11
+ });
12
+ }
@@ -0,0 +1,78 @@
1
+ import type { ProtocolDeploymentContract, ProtocolNamedQueryContract, ProtocolQueryImplementation } from '@hypequery/protocol';
2
+ import { type DeploymentDataPlaneLimits } from './data-plane-limits.js';
3
+ export type DeploymentDataPlaneErrorCode = 'HQ_DATA_PLANE_CONFIGURATION' | 'HQ_DATA_PLANE_ROUTE_NOT_FOUND' | 'HQ_DATA_PLANE_METHOD_NOT_ALLOWED' | 'HQ_DATA_PLANE_UNAUTHENTICATED' | 'HQ_DATA_PLANE_FORBIDDEN' | 'HQ_DATA_PLANE_TENANT_REQUIRED' | 'HQ_DATA_PLANE_INPUT_INVALID' | 'HQ_DATA_PLANE_OUTPUT_INVALID' | 'HQ_DATA_PLANE_EXECUTOR_UNAVAILABLE' | 'HQ_DATA_PLANE_EXECUTION_FAILED' | 'HQ_DATA_PLANE_ABORTED';
4
+ export declare class DeploymentDataPlaneError extends Error {
5
+ readonly code: DeploymentDataPlaneErrorCode;
6
+ readonly path?: string;
7
+ constructor(code: DeploymentDataPlaneErrorCode, message: string, options?: {
8
+ readonly path?: string;
9
+ readonly cause?: unknown;
10
+ });
11
+ }
12
+ export interface DeploymentDataPlanePrincipal {
13
+ readonly subject?: string;
14
+ readonly roles?: readonly string[];
15
+ readonly scopes?: readonly string[];
16
+ readonly claims?: Readonly<Record<string, unknown>>;
17
+ }
18
+ export interface DeploymentDataPlaneRequest {
19
+ readonly method: string;
20
+ readonly path: string;
21
+ readonly input?: unknown;
22
+ readonly credentials?: unknown;
23
+ readonly signal?: AbortSignal;
24
+ }
25
+ export interface DeploymentDataPlaneAuthenticationInput {
26
+ readonly credentials: unknown;
27
+ readonly request: DeploymentDataPlaneRequest;
28
+ readonly query: ProtocolNamedQueryContract;
29
+ }
30
+ export interface DeploymentDataPlaneTenantInput {
31
+ readonly principal: DeploymentDataPlanePrincipal | null;
32
+ readonly request: DeploymentDataPlaneRequest;
33
+ readonly query: ProtocolNamedQueryContract;
34
+ }
35
+ export interface DeploymentDataPlaneExecutionInput {
36
+ readonly query: ProtocolNamedQueryContract;
37
+ readonly input: unknown;
38
+ readonly principal: DeploymentDataPlanePrincipal | null;
39
+ readonly tenant: unknown;
40
+ readonly request: DeploymentDataPlaneRequest;
41
+ readonly signal?: AbortSignal;
42
+ }
43
+ export interface DeploymentSemanticPlanExecutionInput extends DeploymentDataPlaneExecutionInput {
44
+ readonly implementation: Extract<ProtocolQueryImplementation, {
45
+ readonly kind: 'semantic-plan';
46
+ }>;
47
+ readonly deployment: ProtocolDeploymentContract;
48
+ }
49
+ export interface DeploymentCompiledSqlExecutionInput extends DeploymentDataPlaneExecutionInput {
50
+ readonly implementation: Extract<ProtocolQueryImplementation, {
51
+ readonly kind: 'compiled-sql';
52
+ }>;
53
+ readonly parameters: Readonly<Record<string, unknown>>;
54
+ }
55
+ export interface DeploymentRuntimeReferenceExecutionInput extends DeploymentDataPlaneExecutionInput {
56
+ readonly implementation: Extract<ProtocolQueryImplementation, {
57
+ readonly kind: 'runtime-reference';
58
+ }>;
59
+ }
60
+ export interface DeploymentDataPlaneResult {
61
+ readonly query: string;
62
+ readonly output: unknown;
63
+ readonly cacheTtlMs?: number;
64
+ }
65
+ export interface DeploymentDataPlane {
66
+ execute(request: DeploymentDataPlaneRequest): Promise<DeploymentDataPlaneResult>;
67
+ }
68
+ export interface DeploymentDataPlaneOptions {
69
+ readonly deployment: ProtocolDeploymentContract;
70
+ readonly authenticate?: (input: DeploymentDataPlaneAuthenticationInput) => Promise<DeploymentDataPlanePrincipal | null>;
71
+ readonly resolveTenant?: (input: DeploymentDataPlaneTenantInput) => Promise<unknown>;
72
+ readonly executeSemanticPlan?: (input: DeploymentSemanticPlanExecutionInput) => Promise<unknown>;
73
+ readonly executeCompiledSql?: (input: DeploymentCompiledSqlExecutionInput) => Promise<unknown>;
74
+ readonly executeRuntimeReference?: (input: DeploymentRuntimeReferenceExecutionInput) => Promise<unknown>;
75
+ readonly limits?: Partial<DeploymentDataPlaneLimits>;
76
+ }
77
+ export declare function createDeploymentDataPlane(options: DeploymentDataPlaneOptions): DeploymentDataPlane;
78
+ //# sourceMappingURL=data-plane.d.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{ createProtocolSchemaValueParser, ProtocolSchemaValueError, validateProtocolDeploymentContract, } from '@hypequery/protocol';
2
+ import { resolveDeploymentDataPlaneLimits, } from './data-plane-limits.js';
3
+ export class DeploymentDataPlaneError extends Error {
4
+ code;
5
+ path;
6
+ constructor(code, message, options = {}) {
7
+ super(message, options.cause === undefined ? undefined : { cause: options.cause });
8
+ this.name = 'DeploymentDataPlaneError';
9
+ this.code = code;
10
+ this.path = options.path;
11
+ }
12
+ }
13
+ function dataPlaneError(code, message, cause, path) {
14
+ return new DeploymentDataPlaneError(code, message, { cause, path });
15
+ }
16
+ function throwIfAborted(signal) {
17
+ if (signal?.aborted) {
18
+ throw dataPlaneError('HQ_DATA_PLANE_ABORTED', 'The data-plane request was aborted.', signal.reason);
19
+ }
20
+ }
21
+ function frozenRecord(entries) {
22
+ return Object.freeze(Object.assign(Object.create(null), entries));
23
+ }
24
+ function valueAtPath(input, path) {
25
+ let value = input;
26
+ for (const segment of path.split('.')) {
27
+ if (typeof value !== 'object' || value === null || Array.isArray(value)
28
+ || !Object.hasOwn(value, segment))
29
+ return undefined;
30
+ value = value[segment];
31
+ }
32
+ return value;
33
+ }
34
+ function sqlParameters(query, input, tenant) {
35
+ if (query.implementation.kind !== 'compiled-sql')
36
+ return Object.freeze({});
37
+ const values = Object.create(null);
38
+ for (const parameter of query.implementation.parameters) {
39
+ const value = parameter.source.kind === 'tenant'
40
+ ? tenant
41
+ : valueAtPath(input, parameter.source.path);
42
+ if (value === undefined) {
43
+ throw dataPlaneError('HQ_DATA_PLANE_INPUT_INVALID', 'A required compiled SQL binding is missing.', undefined, parameter.source.kind === 'input' ? `$.${parameter.source.path}` : '$.tenant');
44
+ }
45
+ values[parameter.name] = value;
46
+ }
47
+ return frozenRecord(values);
48
+ }
49
+ function routeTable(deployment, limits) {
50
+ const routes = new Map();
51
+ for (const query of deployment.queries) {
52
+ routes.set(`${query.endpoint.method}\0${query.endpoint.path}`, Object.freeze({
53
+ query,
54
+ input: createProtocolSchemaValueParser(query.input, { limits }),
55
+ output: createProtocolSchemaValueParser(query.output, { limits }),
56
+ }));
57
+ }
58
+ return routes;
59
+ }
60
+ function missing(values, actual) {
61
+ const available = new Set(actual ?? []);
62
+ return values.filter(value => !available.has(value));
63
+ }
64
+ export function createDeploymentDataPlane(options) {
65
+ let deployment;
66
+ try {
67
+ deployment = validateProtocolDeploymentContract(options.deployment);
68
+ }
69
+ catch (error) {
70
+ throw dataPlaneError('HQ_DATA_PLANE_CONFIGURATION', 'The deployment data plane requires a valid deployment contract.', error);
71
+ }
72
+ const limits = resolveDeploymentDataPlaneLimits(options.limits);
73
+ const routes = routeTable(deployment, limits);
74
+ const paths = new Set(deployment.queries.map(query => query.endpoint.path));
75
+ return Object.freeze({
76
+ async execute(request) {
77
+ throwIfAborted(request.signal);
78
+ const route = routes.get(`${request.method}\0${request.path}`);
79
+ if (!route) {
80
+ if (paths.has(request.path)) {
81
+ throw dataPlaneError('HQ_DATA_PLANE_METHOD_NOT_ALLOWED', 'The deployment route does not support this method.');
82
+ }
83
+ throw dataPlaneError('HQ_DATA_PLANE_ROUTE_NOT_FOUND', 'The deployment route was not found.');
84
+ }
85
+ const { query } = route;
86
+ let principal = null;
87
+ if (query.endpoint.access.kind === 'authenticated' && !options.authenticate) {
88
+ throw dataPlaneError('HQ_DATA_PLANE_CONFIGURATION', 'An authenticator is required for this deployment route.');
89
+ }
90
+ if (options.authenticate
91
+ && (query.endpoint.access.kind === 'authenticated' || request.credentials !== undefined)) {
92
+ try {
93
+ principal = await options.authenticate({ credentials: request.credentials, request, query });
94
+ }
95
+ catch (error) {
96
+ throw dataPlaneError('HQ_DATA_PLANE_UNAUTHENTICATED', 'Authentication failed.', error);
97
+ }
98
+ }
99
+ throwIfAborted(request.signal);
100
+ if (query.endpoint.access.kind === 'authenticated') {
101
+ if (!principal) {
102
+ throw dataPlaneError('HQ_DATA_PLANE_UNAUTHENTICATED', 'Authentication is required.');
103
+ }
104
+ if (missing(query.endpoint.access.roles, principal.roles).length > 0
105
+ || missing(query.endpoint.access.scopes, principal.scopes).length > 0) {
106
+ throw dataPlaneError('HQ_DATA_PLANE_FORBIDDEN', 'The principal lacks required access.');
107
+ }
108
+ }
109
+ let tenant;
110
+ if (query.endpoint.tenant.kind !== 'not-required') {
111
+ if (!options.resolveTenant) {
112
+ if (query.endpoint.tenant.kind === 'required') {
113
+ throw dataPlaneError('HQ_DATA_PLANE_CONFIGURATION', 'A tenant resolver is required for this deployment route.');
114
+ }
115
+ }
116
+ else {
117
+ try {
118
+ tenant = await options.resolveTenant({ principal, request, query });
119
+ }
120
+ catch (error) {
121
+ throw dataPlaneError('HQ_DATA_PLANE_FORBIDDEN', 'Tenant resolution failed.', error);
122
+ }
123
+ }
124
+ if (query.endpoint.tenant.kind === 'required' && (tenant === undefined || tenant === null)) {
125
+ throw dataPlaneError('HQ_DATA_PLANE_TENANT_REQUIRED', 'Tenant context is required.');
126
+ }
127
+ }
128
+ throwIfAborted(request.signal);
129
+ let input;
130
+ try {
131
+ input = route.input.parse(request.input);
132
+ }
133
+ catch (error) {
134
+ if (error instanceof ProtocolSchemaValueError) {
135
+ throw dataPlaneError('HQ_DATA_PLANE_INPUT_INVALID', 'The request input does not match the deployment schema.', error, error.path);
136
+ }
137
+ throw error;
138
+ }
139
+ const common = { query, input, principal, tenant, request, signal: request.signal };
140
+ let output;
141
+ try {
142
+ switch (query.implementation.kind) {
143
+ case 'semantic-plan':
144
+ if (!options.executeSemanticPlan)
145
+ throw dataPlaneError('HQ_DATA_PLANE_EXECUTOR_UNAVAILABLE', 'No semantic-plan executor is configured.');
146
+ output = await options.executeSemanticPlan({
147
+ ...common,
148
+ implementation: query.implementation,
149
+ deployment,
150
+ });
151
+ break;
152
+ case 'compiled-sql':
153
+ if (!options.executeCompiledSql)
154
+ throw dataPlaneError('HQ_DATA_PLANE_EXECUTOR_UNAVAILABLE', 'No compiled SQL executor is configured.');
155
+ output = await options.executeCompiledSql({
156
+ ...common,
157
+ implementation: query.implementation,
158
+ parameters: sqlParameters(query, input, tenant),
159
+ });
160
+ break;
161
+ case 'runtime-reference':
162
+ if (!options.executeRuntimeReference)
163
+ throw dataPlaneError('HQ_DATA_PLANE_EXECUTOR_UNAVAILABLE', 'No runtime-reference executor is configured.');
164
+ output = await options.executeRuntimeReference({
165
+ ...common,
166
+ implementation: query.implementation,
167
+ });
168
+ break;
169
+ }
170
+ }
171
+ catch (error) {
172
+ if (error instanceof DeploymentDataPlaneError)
173
+ throw error;
174
+ if (request.signal?.aborted) {
175
+ throw dataPlaneError('HQ_DATA_PLANE_ABORTED', 'The data-plane request was aborted.', error);
176
+ }
177
+ throw dataPlaneError('HQ_DATA_PLANE_EXECUTION_FAILED', 'Deployment query execution failed.', error);
178
+ }
179
+ try {
180
+ output = route.output.parse(output);
181
+ }
182
+ catch (error) {
183
+ if (error instanceof ProtocolSchemaValueError) {
184
+ throw dataPlaneError('HQ_DATA_PLANE_OUTPUT_INVALID', 'The query output does not match the deployment schema.', error, error.path);
185
+ }
186
+ throw error;
187
+ }
188
+ const publicCacheTtlMs = query.endpoint.access.kind === 'public'
189
+ && query.endpoint.tenant.kind === 'not-required'
190
+ && principal === null
191
+ ? query.endpoint.cacheTtlMs
192
+ : undefined;
193
+ return Object.freeze({
194
+ query: query.name,
195
+ output,
196
+ ...(publicCacheTtlMs === undefined ? {} : { cacheTtlMs: publicCacheTtlMs }),
197
+ });
198
+ },
199
+ });
200
+ }
package/dist/index.d.ts CHANGED
@@ -22,4 +22,10 @@ export type { DeploymentRuntimeArtifactSnapshot, DeploymentRuntimeMaterializatio
22
22
  export { createDeploymentRuntimeSupervisor, DeploymentRuntimeSupervisorError, } from './runtime-supervisor.js';
23
23
  export type { DeploymentRuntimeFactory, DeploymentRuntimeInstance, DeploymentRuntimeInstanceInvocation, DeploymentRuntimeInvocation, DeploymentRuntimeReconcileResult, DeploymentRuntimeStatus, DeploymentRuntimeSupervisor, DeploymentRuntimeSupervisorErrorCode, DeploymentRuntimeSupervisorOptions, } from './runtime-supervisor.js';
24
24
  export type { DeploymentAuthenticationInput, DeploymentAuthenticator, DeploymentAuthorizationInput, DeploymentAuthorizer, DeploymentIntake, DeploymentIntakeOptions, DeploymentIntakeRequest, DeploymentIntakeResponse, DeploymentSubmissionResponse, DeploymentSubmissionStore, VerifiedDeploymentSubmission, } from './types.js';
25
+ export { createDeploymentDataPlane, DeploymentDataPlaneError, } from './data-plane.js';
26
+ export type { DeploymentCompiledSqlExecutionInput, DeploymentDataPlane, DeploymentDataPlaneAuthenticationInput, DeploymentDataPlaneErrorCode, DeploymentDataPlaneExecutionInput, DeploymentDataPlaneOptions, DeploymentDataPlanePrincipal, DeploymentDataPlaneRequest, DeploymentDataPlaneResult, DeploymentDataPlaneTenantInput, DeploymentRuntimeReferenceExecutionInput, DeploymentSemanticPlanExecutionInput, } from './data-plane.js';
27
+ export { DEFAULT_DEPLOYMENT_DATA_PLANE_LIMITS, resolveDeploymentDataPlaneLimits, } from './data-plane-limits.js';
28
+ export type { DeploymentDataPlaneLimits } from './data-plane-limits.js';
29
+ export { createDeploymentRuntimeSupervisorExecutor } from './data-plane-runtime.js';
30
+ export type { DeploymentRuntimeSupervisorExecutorOptions } from './data-plane-runtime.js';
25
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4CAA4C,EAC5C,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,6BAA6B,EAC7B,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,6CAA6C,GAC9C,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,wBA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C,YAAY,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,4BAA4B,EAC5B,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,mCAAmC,EACnC,mBAAmB,EACnB,sCAAsC,EACtC,4BAA4B,EAC5B,iCAAiC,EACjC,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,yBAAyB,EACzB,8BAA8B,EAC9B,wCAAwC,EACxC,oCAAoC,GACrC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,yCAAyC,EAAE,MAAM,yBAAyB,CAAC;AACpF,YAAY,EAAE,0CAA0C,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -10,3 +10,6 @@ export { DEFAULT_DEPLOYMENT_INTAKE_LIMITS, resolveDeploymentIntakeLimits, } from
10
10
  export { createNodeWorkerDeploymentRuntimeFactory, NodeDeploymentRuntimeError, } from './node-runtime-factory.js';
11
11
  export { createDeploymentRuntimeMaterializer, DeploymentRuntimeMaterializationError, } from './runtime-materialization.js';
12
12
  export { createDeploymentRuntimeSupervisor, DeploymentRuntimeSupervisorError, } from './runtime-supervisor.js';
13
+ export { createDeploymentDataPlane, DeploymentDataPlaneError, } from './data-plane.js';
14
+ export { DEFAULT_DEPLOYMENT_DATA_PLANE_LIMITS, resolveDeploymentDataPlaneLimits, } from './data-plane-limits.js';
15
+ export { createDeploymentRuntimeSupervisorExecutor } from './data-plane-runtime.js';
@@ -27,6 +27,8 @@ export interface DeploymentRuntimeFactory {
27
27
  }
28
28
  export interface DeploymentRuntimeInvocation {
29
29
  readonly target: ProtocolDeploymentReleaseTarget;
30
+ /** Reject the invocation unless this exact activation generation is active. */
31
+ readonly activationRevision?: string;
30
32
  readonly query: string;
31
33
  readonly argument: unknown;
32
34
  readonly signal?: AbortSignal;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-supervisor.d.ts","sourceRoot":"","sources":["../src/runtime-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EACV,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AAOtC,MAAM,MAAM,oCAAoC,GAC5C,qCAAqC,GACrC,8BAA8B,GAC9B,sBAAsB,GACtB,4BAA4B,GAC5B,iCAAiC,GACjC,yBAAyB,GACzB,0BAA0B,GAC1B,8BAA8B,GAC9B,+BAA+B,GAC/B,oBAAoB,CAAC;AAEzB,qBAAa,gCAAiC,SAAQ,KAAK;IACzD,QAAQ,CAAC,IAAI,EAAE,oCAAoC,CAAC;gBAGlD,IAAI,EAAE,oCAAoC,EAC1C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;CAM7C;AAED,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,6BAA6B,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,MAAM,CAAC,KAAK,EAAE,mCAAmC,G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untimeSupervisor(options) {
203
203
  if (!generation) {
204
204
  throw supervisorError('HQ_RUNTIME_NOT_READY', 'No deployment runtime is ready for target.');
205
205
  }
206
+ if (input.activationRevision !== undefined
207
+ && generation.snapshot.activation.revision !== input.activationRevision) {
208
+ throw supervisorError('HQ_RUNTIME_NOT_READY', 'The requested deployment runtime generation is not ready for target.');
209
+ }
206
210
  const resolved = binding(generation.snapshot, input.query);
207
211
  generation.inFlight += 1;
208
212
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypequery/deployment",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Provider-neutral deployment verification and intake for Hypequery",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  "README.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@hypequery/protocol": "0.6.0"
21
+ "@hypequery/protocol": "0.7.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.5.0",