@serve.zone/interfaces 32.4.0 → 32.6.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/changelog.md +80 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/cluster.d.ts +4 -5
- package/dist_ts/data/cluster.js +6 -14
- package/dist_ts/data/clusteringress.js +9 -8
- package/dist_ts/data/clusternode.d.ts +6 -1
- package/dist_ts/data/clusternode.js +32 -5
- package/dist_ts/data/clustervpn.d.ts +11 -0
- package/dist_ts/data/clustervpn.js +19 -8
- package/dist_ts/data/isolatedrestore.js +12 -4
- package/dist_ts/data/networkaddressplan.d.ts +21 -15
- package/dist_ts/data/networkaddressplan.js +27 -20
- package/dist_ts/data/networkauthority.js +9 -3
- package/dist_ts/data/networkcredential.d.ts +0 -7
- package/dist_ts/data/networkcredential.js +5 -22
- package/dist_ts/data/networklease.js +3 -3
- package/dist_ts/data/networknode.js +3 -3
- package/dist_ts/data/networkprojection.js +8 -3
- package/dist_ts/data/nodeenrollment.js +4 -2
- package/dist_ts/data/noderetirement.js +3 -3
- package/dist_ts/data/runtimeassignment.d.ts +12 -0
- package/dist_ts/data/runtimeassignment.js +29 -4
- package/dist_ts/data/runtimesession.js +3 -2
- package/dist_ts/data/serviceruntime.js +6 -5
- package/dist_ts/data/sparknodereport.js +6 -3
- package/dist_ts/private/networkcontract.d.ts +2 -0
- package/dist_ts/private/networkcontract.js +8 -2
- package/dist_ts/private/nodeidentifier.d.ts +22 -0
- package/dist_ts/private/nodeidentifier.js +23 -0
- package/dist_ts/requests/corestore.js +4 -4
- package/dist_ts/runtime.js +7 -4
- package/package.json +1 -1
- package/readme.md +60 -24
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/cluster.ts +9 -21
- package/ts/data/clusteringress.ts +8 -7
- package/ts/data/clusternode.ts +32 -4
- package/ts/data/clustervpn.ts +28 -9
- package/ts/data/isolatedrestore.ts +12 -3
- package/ts/data/networkaddressplan.ts +32 -25
- package/ts/data/networkauthority.ts +8 -2
- package/ts/data/networkcredential.ts +4 -29
- package/ts/data/networklease.ts +2 -2
- package/ts/data/networknode.ts +2 -2
- package/ts/data/networkprojection.ts +6 -2
- package/ts/data/nodeenrollment.ts +4 -2
- package/ts/data/noderetirement.ts +2 -2
- package/ts/data/runtimeassignment.ts +26 -3
- package/ts/data/runtimesession.ts +3 -2
- package/ts/data/serviceruntime.ts +6 -5
- package/ts/data/sparknodereport.ts +7 -2
- package/ts/private/networkcontract.ts +6 -1
- package/ts/private/nodeidentifier.ts +25 -0
- package/ts/requests/corestore.ts +3 -3
- package/ts/runtime.ts +6 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one vocabulary a node of a cluster is named in.
|
|
3
|
+
*
|
|
4
|
+
* It lives beside the canonical JSON and data-property helpers rather than in a contract module
|
|
5
|
+
* because every family reads it — the node's enrollment, its runtime session, the Spark wire, its
|
|
6
|
+
* assignments, the private network contract and the relay block — and a second spelling of the rule
|
|
7
|
+
* is a second answer to which nodes exist.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* True when a value is exactly a node id: the URL alphabet, a leading `-` or `_` included,
|
|
12
|
+
* one to 128 characters.
|
|
13
|
+
*
|
|
14
|
+
* These contracts disagreed with themselves about what a node may be called: enrollment, the
|
|
15
|
+
* session registration and the Spark wire admit a separator-led node id, which makes this the
|
|
16
|
+
* vocabulary a stored node id is written in, while the assignment and the network members read
|
|
17
|
+
* that same id by the canonical identifier vocabulary — whose first character must be
|
|
18
|
+
* alphanumeric — and refuse it, and with it the assignment, the runtime network and, because one
|
|
19
|
+
* refused egress owner fails the whole pass, its entire cluster's protected authority. A
|
|
20
|
+
* controller now keeps the first character alphanumeric where it mints, so the ids this one
|
|
21
|
+
* vocabulary serves are the ones already stored under the members that admit them.
|
|
22
|
+
*/
|
|
23
|
+
export const isClusterNodeId = (valueArg: unknown): valueArg is string => (
|
|
24
|
+
typeof valueArg === 'string' && /^[A-Za-z0-9_-]{1,128}$/.test(valueArg)
|
|
25
|
+
);
|
package/ts/requests/corestore.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as plugins from '../plugins.js';
|
|
2
2
|
import type { IIdentity } from '../data/user.js';
|
|
3
3
|
import { hasExactKeys } from '../private/dataproperties.js';
|
|
4
|
+
import { isClusterNodeId } from '../private/nodeidentifier.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* A provisioned corestore resource (NoSQLDB database or ObjectStorage bucket)
|
|
@@ -189,9 +190,8 @@ export const validateClusterCorestoreInventory = (
|
|
|
189
190
|
return [`${pathArg} must use its exact schema`];
|
|
190
191
|
}
|
|
191
192
|
const errors: string[] = [];
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
errors.push(`${pathArg} nodeId must be a bounded identifier`);
|
|
193
|
+
if (!isClusterNodeId(valueArg.nodeId)) {
|
|
194
|
+
errors.push(`${pathArg} nodeId must be a node id`);
|
|
195
195
|
}
|
|
196
196
|
if (!Number.isSafeInteger(valueArg.checkedAt) || (valueArg.checkedAt as number) < 0) {
|
|
197
197
|
errors.push(`${pathArg} checkedAt must be a non-negative safe integer`);
|
package/ts/runtime.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
} from './data/clusternode.js';
|
|
30
30
|
import { isCoreflowRuntimeCapabilityList, isSha256Digest } from './data/immutableimage.js';
|
|
31
31
|
import { hasExactKeys } from './private/dataproperties.js';
|
|
32
|
+
import { isClusterNodeId } from './private/nodeidentifier.js';
|
|
32
33
|
import type {
|
|
33
34
|
IWorkloadInitActiveApprovalAuthority,
|
|
34
35
|
IWorkloadInitApprovalAuthorityReference,
|
|
@@ -759,8 +760,10 @@ const validateRuntimeTargets = (
|
|
|
759
760
|
errors.push(`${pathArg}[${index}] must use its exact schema`);
|
|
760
761
|
continue;
|
|
761
762
|
}
|
|
762
|
-
if (!
|
|
763
|
-
|
|
763
|
+
if (!isClusterNodeId(targetArg.cloudlyNodeId)) {
|
|
764
|
+
errors.push(`${pathArg}[${index}].cloudlyNodeId must be a node id`);
|
|
765
|
+
}
|
|
766
|
+
if (!isRuntimeIdentifier(targetArg.swarmClusterId)
|
|
764
767
|
|| !isRuntimeIdentifier(targetArg.swarmNodeId)
|
|
765
768
|
|| !isRuntimeIdentifier(targetArg.nodeName)) {
|
|
766
769
|
errors.push(`${pathArg}[${index}] node identity must be canonical`);
|
|
@@ -768,7 +771,7 @@ const validateRuntimeTargets = (
|
|
|
768
771
|
if (!runtimePlatforms.has(targetArg.platform as TImmutableContainerPlatform)) {
|
|
769
772
|
errors.push(`${pathArg}[${index}].platform must be supported`);
|
|
770
773
|
}
|
|
771
|
-
if (
|
|
774
|
+
if (isClusterNodeId(targetArg.cloudlyNodeId)
|
|
772
775
|
&& isRuntimeIdentifier(targetArg.swarmClusterId)
|
|
773
776
|
&& isRuntimeIdentifier(targetArg.swarmNodeId)
|
|
774
777
|
&& isRuntimeIdentifier(targetArg.nodeName)
|