@serve.zone/interfaces 31.9.0 → 32.0.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/.smartconfig.json +1 -0
- package/changelog.md +467 -0
- package/dist_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/appstore/types.d.ts +4 -6
- package/dist_ts/appstore/types.js +5 -5
- package/dist_ts/data/backup.d.ts +3 -26
- package/dist_ts/data/cluster.d.ts +36 -11
- package/dist_ts/data/cluster.js +33 -22
- package/dist_ts/data/clusteringress.d.ts +8 -0
- package/dist_ts/data/clusteringress.js +13 -8
- package/dist_ts/data/clusternode.d.ts +121 -74
- package/dist_ts/data/clusternode.js +109 -132
- package/dist_ts/data/coremail.d.ts +3 -7
- package/dist_ts/data/coremail.js +2 -2
- package/dist_ts/data/coremail.runtime.d.ts +0 -1
- package/dist_ts/data/coremail.runtime.js +5 -22
- package/dist_ts/data/deploymentadoption.d.ts +0 -2
- package/dist_ts/data/deploymentadoption.js +40 -6
- package/dist_ts/data/deploymentoperation.js +16 -3
- package/dist_ts/data/deploymentpreflight.d.ts +0 -2
- package/dist_ts/data/deploymentpreflight.js +1 -1
- package/dist_ts/data/immutableimage.d.ts +38 -21
- package/dist_ts/data/immutableimage.js +45 -5
- package/dist_ts/data/index.d.ts +1 -1
- package/dist_ts/data/isolatedrestore.d.ts +139 -21
- package/dist_ts/data/isolatedrestore.golden.d.ts +0 -1
- package/dist_ts/data/isolatedrestore.golden.js +6 -9
- package/dist_ts/data/isolatedrestore.js +176 -40
- package/dist_ts/data/mail.d.ts +1 -1
- package/dist_ts/data/networkaddressplan.d.ts +8 -8
- package/dist_ts/data/networkaddressplan.js +4 -4
- package/dist_ts/data/networkauthority.d.ts +20 -22
- package/dist_ts/data/networkauthority.js +26 -28
- package/dist_ts/data/networkcredential.d.ts +10 -10
- package/dist_ts/data/networkcredential.js +16 -16
- package/dist_ts/data/networkdelivery.d.ts +18 -18
- package/dist_ts/data/networkdelivery.js +16 -16
- package/dist_ts/data/networklease.d.ts +18 -7
- package/dist_ts/data/networklease.js +29 -7
- package/dist_ts/data/networknode.d.ts +2 -2
- package/dist_ts/data/networkprojection.d.ts +59 -60
- package/dist_ts/data/networkprojection.js +53 -57
- package/dist_ts/data/networkprotection.d.ts +27 -28
- package/dist_ts/data/networkprotection.js +36 -36
- package/dist_ts/data/networkrouter.d.ts +11 -11
- package/dist_ts/data/networkrouter.js +1 -1
- package/dist_ts/data/networksigning.d.ts +16 -18
- package/dist_ts/data/networksigning.js +20 -21
- package/dist_ts/data/nodecredential.d.ts +4 -6
- package/dist_ts/data/nodeenrollment.d.ts +35 -40
- package/dist_ts/data/nodeenrollment.js +57 -72
- package/dist_ts/data/privatenetwork.d.ts +21 -24
- package/dist_ts/data/privatenetwork.js +39 -54
- package/dist_ts/data/runtimeassignment.d.ts +50 -34
- package/dist_ts/data/runtimeassignment.js +79 -45
- package/dist_ts/data/runtimeconfig.d.ts +21 -22
- package/dist_ts/data/runtimeconfig.js +24 -24
- package/dist_ts/data/runtimesession.d.ts +100 -62
- package/dist_ts/data/runtimesession.js +98 -79
- package/dist_ts/data/runtimeterminalreceipt.d.ts +28 -29
- package/dist_ts/data/runtimeterminalreceipt.js +42 -42
- package/dist_ts/data/secret.d.ts +18 -25
- package/dist_ts/data/secret.js +12 -52
- package/dist_ts/data/servicecredential.d.ts +14 -16
- package/dist_ts/data/servicecredential.js +17 -28
- package/dist_ts/data/serviceruntime.d.ts +7 -7
- package/dist_ts/data/serviceruntime.js +4 -4
- package/dist_ts/data/sparknodereport.d.ts +27 -14
- package/dist_ts/data/sparknodereport.js +35 -28
- package/dist_ts/data/webpush.d.ts +0 -1
- package/dist_ts/index.d.ts +2 -1
- package/dist_ts/index.js +3 -2
- package/dist_ts/platform/objectstorageretention.d.ts +21 -24
- package/dist_ts/platform/objectstorageretention.js +6 -18
- package/dist_ts/platform/storage.d.ts +1 -3
- package/dist_ts/platform/storagemigration.d.ts +0 -7
- package/dist_ts/platform/storagemigration.golden.d.ts +0 -1
- package/dist_ts/platform/storagemigration.golden.js +8 -12
- package/dist_ts/platform/storagemigration.js +6 -51
- package/dist_ts/platform/types.d.ts +2 -2
- package/dist_ts/private/canonicaljson.d.ts +9 -1
- package/dist_ts/private/canonicaljson.js +14 -2
- package/dist_ts/private/dataproperties.d.ts +62 -0
- package/dist_ts/private/dataproperties.js +117 -0
- package/dist_ts/private/networkcontract.d.ts +10 -10
- package/dist_ts/private/networkcontract.js +1 -1
- package/dist_ts/private/releaseversion.d.ts +37 -0
- package/dist_ts/private/releaseversion.js +48 -0
- package/dist_ts/private/runtimepolicy.d.ts +2 -2
- package/dist_ts/private/runtimepolicy.js +1 -1
- package/dist_ts/private/tokenlist.d.ts +9 -0
- package/dist_ts/private/tokenlist.js +23 -0
- package/dist_ts/protocol.d.ts +137 -0
- package/dist_ts/protocol.js +255 -0
- package/dist_ts/requests/admin.d.ts +8 -8
- package/dist_ts/requests/backup.d.ts +102 -112
- package/dist_ts/requests/cluster.d.ts +10 -10
- package/dist_ts/requests/clusteringress.d.ts +9 -0
- package/dist_ts/requests/clusteringress.js +1 -1
- package/dist_ts/requests/config.d.ts +3 -3
- package/dist_ts/requests/corestore.d.ts +0 -3
- package/dist_ts/requests/corestore.js +5 -9
- package/dist_ts/requests/network.d.ts +30 -30
- package/dist_ts/requests/node.d.ts +15 -28
- package/dist_ts/requests/pallet.d.ts +13 -13
- package/dist_ts/requests/runtimesession.d.ts +53 -41
- package/dist_ts/requests/secret.d.ts +4 -5
- package/dist_ts/requests/secret.js +1 -5
- package/dist_ts/runtime.corestore.d.ts +56 -74
- package/dist_ts/runtime.corestore.databaseexportpackage.d.ts +30 -36
- package/dist_ts/runtime.corestore.databaseexportpackage.golden.d.ts +11 -12
- package/dist_ts/runtime.corestore.databaseexportpackage.golden.js +54 -71
- package/dist_ts/runtime.corestore.databaseexportpackage.js +9 -25
- package/dist_ts/runtime.corestore.js +35 -135
- package/dist_ts/runtime.corestore.relay.js +2 -7
- package/dist_ts/runtime.d.ts +38 -48
- package/dist_ts/runtime.js +20 -77
- package/dist_ts/runtime.networkprojection.d.ts +4 -4
- package/dist_ts/runtime.networkprojection.js +18 -18
- package/dist_ts/runtime.workloadinit.d.ts +23 -24
- package/dist_ts/runtime.workloadinit.js +6 -13
- package/package.json +2 -2
- package/readme.md +421 -270
- package/ts/00_commitinfo_data.ts +3 -3
- package/ts/appstore/types.ts +4 -6
- package/ts/data/backup.ts +3 -38
- package/ts/data/cluster.ts +51 -34
- package/ts/data/clusteringress.ts +12 -12
- package/ts/data/clusternode.ts +204 -232
- package/ts/data/coremail.runtime.ts +4 -21
- package/ts/data/coremail.ts +3 -7
- package/ts/data/deploymentadoption.ts +46 -4
- package/ts/data/deploymentoperation.ts +16 -1
- package/ts/data/deploymentpreflight.ts +0 -2
- package/ts/data/immutableimage.ts +71 -24
- package/ts/data/index.ts +1 -1
- package/ts/data/isolatedrestore.golden.ts +5 -9
- package/ts/data/isolatedrestore.ts +339 -54
- package/ts/data/mail.ts +1 -1
- package/ts/data/networkaddressplan.ts +13 -13
- package/ts/data/networkauthority.ts +42 -46
- package/ts/data/networkcredential.ts +24 -24
- package/ts/data/networkdelivery.ts +27 -27
- package/ts/data/networklease.ts +40 -13
- package/ts/data/networknode.ts +2 -2
- package/ts/data/networkprojection.ts +119 -124
- package/ts/data/networkprotection.ts +54 -55
- package/ts/data/networkrouter.ts +14 -14
- package/ts/data/networksigning.ts +29 -32
- package/ts/data/nodecredential.ts +4 -6
- package/ts/data/nodeenrollment.ts +96 -114
- package/ts/data/privatenetwork.ts +58 -74
- package/ts/data/runtimeassignment.ts +143 -94
- package/ts/data/runtimeconfig.ts +45 -46
- package/ts/data/runtimesession.ts +185 -138
- package/ts/data/runtimeterminalreceipt.ts +72 -73
- package/ts/data/secret.ts +28 -76
- package/ts/data/servicecredential.ts +33 -43
- package/ts/data/serviceruntime.ts +11 -11
- package/ts/data/sparknodereport.ts +48 -36
- package/ts/data/webpush.ts +0 -1
- package/ts/index.ts +2 -0
- package/ts/platform/objectstorageretention.ts +36 -55
- package/ts/platform/storage.ts +1 -3
- package/ts/platform/storagemigration.golden.ts +7 -11
- package/ts/platform/storagemigration.ts +5 -55
- package/ts/platform/types.ts +2 -2
- package/ts/private/canonicaljson.ts +13 -1
- package/ts/private/dataproperties.ts +139 -0
- package/ts/private/networkcontract.ts +9 -9
- package/ts/private/releaseversion.ts +70 -0
- package/ts/private/runtimepolicy.ts +2 -2
- package/ts/private/tokenlist.ts +30 -0
- package/ts/protocol.ts +364 -0
- package/ts/requests/admin.ts +11 -11
- package/ts/requests/backup.ts +112 -117
- package/ts/requests/cluster.ts +13 -13
- package/ts/requests/clusteringress.ts +9 -0
- package/ts/requests/config.ts +3 -3
- package/ts/requests/corestore.ts +4 -16
- package/ts/requests/network.ts +40 -40
- package/ts/requests/node.ts +21 -38
- package/ts/requests/pallet.ts +17 -17
- package/ts/requests/runtimesession.ts +63 -51
- package/ts/requests/secret.ts +5 -10
- package/ts/runtime.corestore.databaseexportpackage.golden.ts +77 -95
- package/ts/runtime.corestore.databaseexportpackage.ts +51 -73
- package/ts/runtime.corestore.relay.ts +1 -10
- package/ts/runtime.corestore.ts +118 -268
- package/ts/runtime.networkprojection.ts +30 -30
- package/ts/runtime.ts +83 -158
- package/ts/runtime.workloadinit.ts +36 -48
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.d.ts +0 -902
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.d.ts +0 -35
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.js +0 -315
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.js +0 -3315
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.d.ts +0 -291
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.d.ts +0 -30
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.js +0 -408
- package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.js +0 -1126
- package/ts/runtime.cloudlylegacydeploymentsettlement.golden.ts +0 -421
- package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.ts +0 -510
- package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.ts +0 -2470
- package/ts/runtime.cloudlylegacydeploymentsettlement.ts +0 -6630
package/ts/data/runtimeconfig.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
IImmutableContainerInvocation,
|
|
3
|
+
IImmutableContainerInvocationPlatformEvidence,
|
|
4
4
|
TSha256Digest,
|
|
5
5
|
} from './immutableimage.js';
|
|
6
6
|
import {
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
validateImmutableContainerInvocation,
|
|
10
10
|
verifyImmutableContainerInvocationDigest,
|
|
11
11
|
} from './immutableimage.js';
|
|
12
|
-
import type {
|
|
13
|
-
import {
|
|
12
|
+
import type { IRuntimeAssignment, IRuntimeAuthorityReference } from './runtimeassignment.js';
|
|
13
|
+
import { snapshotRuntimeAssignment, validateRuntimeAssignment } from './runtimeassignment.js';
|
|
14
14
|
import { canonicalizeStrictJson, createCanonicalJsonSha256Hex } from '../private/canonicaljson.js';
|
|
15
15
|
import {
|
|
16
16
|
assertRuntimeReadiness, isBoundedInteger, isExactRecord, isRuntimeCpuMillis, isRuntimeIdentityNumber,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from '../private/runtimepolicy.js';
|
|
19
19
|
|
|
20
20
|
/** A container target only; declaration does not publish a host or gateway port. */
|
|
21
|
-
export interface
|
|
21
|
+
export interface IRuntimeConfigTargetPort {
|
|
22
22
|
name: string;
|
|
23
23
|
port: number;
|
|
24
24
|
/** Inclusive; equal to port for a single port. */
|
|
@@ -26,7 +26,7 @@ export interface IRuntimeConfigTargetPortV1 {
|
|
|
26
26
|
protocol: 'tcp' | 'udp';
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export interface
|
|
29
|
+
export interface IRuntimeConfigReadinessTiming {
|
|
30
30
|
/** Measured from the evidenced container start; no probes before this delay. */
|
|
31
31
|
initialDelayMs: number;
|
|
32
32
|
/** Failures during this startup grace cannot mark the workload unhealthy. */
|
|
@@ -41,7 +41,7 @@ export interface IRuntimeConfigReadinessTimingV1 {
|
|
|
41
41
|
failureThreshold: number;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export type
|
|
44
|
+
export type TRuntimeConfigReadiness = IRuntimeConfigReadinessTiming & (
|
|
45
45
|
| { kind: 'process' }
|
|
46
46
|
| { kind: 'tcp'; targetPort: string; port: number }
|
|
47
47
|
| {
|
|
@@ -64,7 +64,7 @@ export type TRuntimeConfigReadinessV1 = IRuntimeConfigReadinessTimingV1 & (
|
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
-
export interface
|
|
67
|
+
export interface IRuntimeConfigLogPolicy {
|
|
68
68
|
/** Maximum UTF-8 bytes in one captured stdout/stderr line. */
|
|
69
69
|
maximumLineBytes: number;
|
|
70
70
|
/** Maximum bytes waiting for delivery; overflow requires explicit evidence. */
|
|
@@ -80,8 +80,7 @@ export interface IRuntimeConfigLogPolicyV1 {
|
|
|
80
80
|
* Secrets, network identity and storage claims remain separately assignment-bound
|
|
81
81
|
* owner references. This document contains no registry credentials or host paths.
|
|
82
82
|
*/
|
|
83
|
-
export interface
|
|
84
|
-
schemaVersion: 1;
|
|
83
|
+
export interface IRuntimeConfig extends IRuntimeAuthorityReference {
|
|
85
84
|
organizationId: string;
|
|
86
85
|
serviceId: string;
|
|
87
86
|
image: {
|
|
@@ -89,7 +88,7 @@ export interface IRuntimeConfigV1 extends IRuntimeAuthorityReferenceV1 {
|
|
|
89
88
|
repository: string;
|
|
90
89
|
/** Root descriptor digest, which may be an OCI platform index. */
|
|
91
90
|
imageDigest: TSha256Digest;
|
|
92
|
-
invocation:
|
|
91
|
+
invocation: IImmutableContainerInvocation;
|
|
93
92
|
};
|
|
94
93
|
/** Complete effective public environment; secret values must never be inlined. */
|
|
95
94
|
environment: Record<string, string>;
|
|
@@ -110,25 +109,25 @@ export interface IRuntimeConfigV1 extends IRuntimeAuthorityReferenceV1 {
|
|
|
110
109
|
/** Numeric override paired with runAsUser, or null for the image identity policy. */
|
|
111
110
|
runAsGroup: number | null;
|
|
112
111
|
/** Sorted unique names, with no overlapping ranges for the same transport. */
|
|
113
|
-
targetPorts:
|
|
114
|
-
readiness:
|
|
112
|
+
targetPorts: IRuntimeConfigTargetPort[];
|
|
113
|
+
readiness: TRuntimeConfigReadiness;
|
|
115
114
|
/**
|
|
116
115
|
* SmartData owns log metadata and SmartBucket owns archived payloads. This
|
|
117
116
|
* policy does not authorize persistent local files. Any CRI log capture uses
|
|
118
117
|
* disposable process-local transport artifacts and must evidence bounded
|
|
119
118
|
* buffering, backpressure and lost data; it must not silently truncate logs.
|
|
120
119
|
*/
|
|
121
|
-
logs:
|
|
120
|
+
logs: IRuntimeConfigLogPolicy;
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
export interface
|
|
125
|
-
config:
|
|
126
|
-
assignment:
|
|
127
|
-
platformEvidence:
|
|
123
|
+
export interface IRuntimeConfigAssignmentBinding {
|
|
124
|
+
config: IRuntimeConfig;
|
|
125
|
+
assignment: IRuntimeAssignment;
|
|
126
|
+
platformEvidence: IImmutableContainerInvocationPlatformEvidence;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
export const
|
|
131
|
-
digestDomain: 'serve.zone/runtime-config
|
|
129
|
+
export const runtimeConfigContract = Object.freeze({
|
|
130
|
+
digestDomain: 'serve.zone/runtime-config',
|
|
132
131
|
maximumCanonicalBytes: 262_144,
|
|
133
132
|
maximumEnvironmentEntries: 128,
|
|
134
133
|
maximumTargetPorts: 64,
|
|
@@ -153,9 +152,9 @@ const snapshotBoundedJson = (valueArg: unknown): unknown => {
|
|
|
153
152
|
let stringBytes = 0;
|
|
154
153
|
const ancestors = new Set<object>();
|
|
155
154
|
const accountString = (value: string): void => {
|
|
156
|
-
if (value.length >
|
|
155
|
+
if (value.length > runtimeConfigContract.maximumCanonicalBytes) fail('runtime config string is oversized');
|
|
157
156
|
stringBytes += encoder.encode(value).byteLength;
|
|
158
|
-
if (stringBytes >
|
|
157
|
+
if (stringBytes > runtimeConfigContract.maximumCanonicalBytes) fail('runtime config is oversized');
|
|
159
158
|
};
|
|
160
159
|
const copy = (value: unknown, depth: number): unknown => {
|
|
161
160
|
if (++nodes > 8192 || depth > 12) fail('runtime config exceeds structural bounds');
|
|
@@ -202,20 +201,20 @@ const snapshotBoundedJson = (valueArg: unknown): unknown => {
|
|
|
202
201
|
} finally { ancestors.delete(value); }
|
|
203
202
|
};
|
|
204
203
|
const canonical = canonicalizeStrictJson(copy(valueArg, 0), fail);
|
|
205
|
-
if (encoder.encode(canonical).byteLength >
|
|
204
|
+
if (encoder.encode(canonical).byteLength > runtimeConfigContract.maximumCanonicalBytes) {
|
|
206
205
|
fail('runtime config canonical JSON is oversized');
|
|
207
206
|
}
|
|
208
207
|
return JSON.parse(canonical);
|
|
209
208
|
};
|
|
210
209
|
|
|
211
|
-
const assertConfig = (valueArg: unknown):
|
|
212
|
-
if (!isExactRecord(valueArg, ['
|
|
210
|
+
const assertConfig = (valueArg: unknown): IRuntimeConfig => {
|
|
211
|
+
if (!isExactRecord(valueArg, ['id', 'generation', 'organizationId', 'serviceId',
|
|
213
212
|
'image', 'environment', 'workingDirectory', 'cpuMillis', 'memoryBytes', 'readonlyRootfs',
|
|
214
213
|
'runAsUser', 'runAsGroup', 'targetPorts', 'readiness', 'logs', 'digest'])
|
|
215
|
-
||
|
|
214
|
+
|| !isIdentifier(valueArg.id)
|
|
216
215
|
|| !isBoundedInteger(valueArg.generation, 1, Number.MAX_SAFE_INTEGER)
|
|
217
216
|
|| !isIdentifier(valueArg.organizationId) || !isIdentifier(valueArg.serviceId)
|
|
218
|
-
|| !isDigest(valueArg.digest)) fail('runtime config must use its exact
|
|
217
|
+
|| !isDigest(valueArg.digest)) fail('runtime config must use its exact schema');
|
|
219
218
|
const image = valueArg.image;
|
|
220
219
|
if (!isExactRecord(image, ['registryHost', 'repository', 'imageDigest', 'invocation'])
|
|
221
220
|
|| typeof image.registryHost !== 'string' || image.registryHost.length > 253
|
|
@@ -228,7 +227,7 @@ const assertConfig = (valueArg: unknown): IRuntimeConfigV1 => {
|
|
|
228
227
|
image.imageDigest as TSha256Digest);
|
|
229
228
|
const environment = valueArg.environment;
|
|
230
229
|
if (!environment || typeof environment !== 'object' || Array.isArray(environment)
|
|
231
|
-
|| Object.keys(environment).length >
|
|
230
|
+
|| Object.keys(environment).length > runtimeConfigContract.maximumEnvironmentEntries) {
|
|
232
231
|
fail('runtime config requires an explicit bounded nonsecret environment');
|
|
233
232
|
}
|
|
234
233
|
for (const [key, value] of Object.entries(environment)) {
|
|
@@ -249,11 +248,11 @@ const assertConfig = (valueArg: unknown): IRuntimeConfigV1 => {
|
|
|
249
248
|
fail('runtime config requires canonical directory and explicit resource and identity policies');
|
|
250
249
|
}
|
|
251
250
|
const ports = valueArg.targetPorts;
|
|
252
|
-
if (!Array.isArray(ports) || ports.length >
|
|
251
|
+
if (!Array.isArray(ports) || ports.length > runtimeConfigContract.maximumTargetPorts) {
|
|
253
252
|
fail('runtime config target ports must be a bounded array');
|
|
254
253
|
}
|
|
255
254
|
let previousName = '';
|
|
256
|
-
const validatedPorts:
|
|
255
|
+
const validatedPorts: IRuntimeConfigTargetPort[] = [];
|
|
257
256
|
for (const port of ports) {
|
|
258
257
|
if (!isExactRecord(port, ['name', 'port', 'portEnd', 'protocol'])
|
|
259
258
|
|| !isRuntimePortName(port.name) || port.name <= previousName
|
|
@@ -264,7 +263,7 @@ const assertConfig = (valueArg: unknown): IRuntimeConfigV1 => {
|
|
|
264
263
|
fail('runtime config target ports require sorted unique names and nonoverlapping transport ranges');
|
|
265
264
|
}
|
|
266
265
|
previousName = port.name;
|
|
267
|
-
validatedPorts.push(port as unknown as
|
|
266
|
+
validatedPorts.push(port as unknown as IRuntimeConfigTargetPort);
|
|
268
267
|
}
|
|
269
268
|
assertRuntimeReadiness(valueArg.readiness, (targetPortArg, portArg) => validatedPorts.some((targetArg) =>
|
|
270
269
|
targetArg.name === targetPortArg && targetArg.protocol === 'tcp'
|
|
@@ -272,35 +271,35 @@ const assertConfig = (valueArg: unknown): IRuntimeConfigV1 => {
|
|
|
272
271
|
if (!isRuntimeLogPolicy(valueArg.logs)) {
|
|
273
272
|
fail('runtime config logs require explicit bounded line, buffer and retention limits');
|
|
274
273
|
}
|
|
275
|
-
return valueArg as unknown as
|
|
274
|
+
return valueArg as unknown as IRuntimeConfig;
|
|
276
275
|
};
|
|
277
276
|
|
|
278
277
|
/**
|
|
279
278
|
* Detached exact-schema snapshot for synchronous persistence assertions. Digest
|
|
280
279
|
* integrity, scope authorization, admission and runtime readiness are not implied.
|
|
281
280
|
*/
|
|
282
|
-
export const
|
|
281
|
+
export const snapshotRuntimeConfig = (valueArg: unknown): IRuntimeConfig =>
|
|
283
282
|
assertConfig(snapshotBoundedJson(valueArg));
|
|
284
283
|
|
|
285
284
|
/** Domain-separated canonical JSON excludes only the config's own digest. */
|
|
286
|
-
export const
|
|
287
|
-
const { digest: _digest, ...payload } =
|
|
285
|
+
export const computeRuntimeConfigDigest = async (configArg: IRuntimeConfig): Promise<TSha256Digest> => {
|
|
286
|
+
const { digest: _digest, ...payload } = snapshotRuntimeConfig(configArg);
|
|
288
287
|
return `sha256:${await createCanonicalJsonSha256Hex(canonicalizeStrictJson({
|
|
289
|
-
domain:
|
|
288
|
+
domain: runtimeConfigContract.digestDomain, payload,
|
|
290
289
|
}, fail), fail)}`;
|
|
291
290
|
};
|
|
292
291
|
|
|
293
|
-
const validateSnapshot = async (configArg:
|
|
292
|
+
const validateSnapshot = async (configArg: IRuntimeConfig): Promise<string[]> => {
|
|
294
293
|
if (!await verifyImmutableContainerInvocationDigest(configArg.image.invocation)) {
|
|
295
294
|
return ['runtime config immutable invocation digest does not match'];
|
|
296
295
|
}
|
|
297
|
-
return configArg.digest === await
|
|
296
|
+
return configArg.digest === await computeRuntimeConfigDigest(configArg)
|
|
298
297
|
? [] : ['runtime config digest does not match'];
|
|
299
298
|
};
|
|
300
299
|
|
|
301
|
-
export const
|
|
302
|
-
try { return await validateSnapshot(
|
|
303
|
-
catch { return ['runtime config must use its exact canonical
|
|
300
|
+
export const validateRuntimeConfig = async (valueArg: unknown): Promise<string[]> => {
|
|
301
|
+
try { return await validateSnapshot(snapshotRuntimeConfig(valueArg)); }
|
|
302
|
+
catch { return ['runtime config must use its exact canonical schema']; }
|
|
304
303
|
};
|
|
305
304
|
|
|
306
305
|
/**
|
|
@@ -310,13 +309,13 @@ export const validateRuntimeConfigV1 = async (valueArg: unknown): Promise<string
|
|
|
310
309
|
* controller, durably admit the attempt, resolve other owner references, and
|
|
311
310
|
* verify runtime and readiness evidence before effects or route publication.
|
|
312
311
|
*/
|
|
313
|
-
export const
|
|
312
|
+
export const bindRuntimeConfigToAssignment = async (
|
|
314
313
|
configArg: unknown, assignmentArg: unknown,
|
|
315
|
-
): Promise<
|
|
316
|
-
const config =
|
|
317
|
-
const assignment =
|
|
314
|
+
): Promise<IRuntimeConfigAssignmentBinding> => {
|
|
315
|
+
const config = snapshotRuntimeConfig(configArg);
|
|
316
|
+
const assignment = snapshotRuntimeAssignment(snapshotBoundedJson(assignmentArg));
|
|
318
317
|
if ((await validateSnapshot(config)).length !== 0
|
|
319
|
-
|| (await
|
|
318
|
+
|| (await validateRuntimeAssignment(assignment)).length !== 0) {
|
|
320
319
|
fail('runtime config binding requires valid config, invocation and assignment digests');
|
|
321
320
|
}
|
|
322
321
|
const reference = assignment.workload.config;
|