@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.
Files changed (55) hide show
  1. package/changelog.md +80 -0
  2. package/dist_ts/00_commitinfo_data.js +1 -1
  3. package/dist_ts/data/cluster.d.ts +4 -5
  4. package/dist_ts/data/cluster.js +6 -14
  5. package/dist_ts/data/clusteringress.js +9 -8
  6. package/dist_ts/data/clusternode.d.ts +6 -1
  7. package/dist_ts/data/clusternode.js +32 -5
  8. package/dist_ts/data/clustervpn.d.ts +11 -0
  9. package/dist_ts/data/clustervpn.js +19 -8
  10. package/dist_ts/data/isolatedrestore.js +12 -4
  11. package/dist_ts/data/networkaddressplan.d.ts +21 -15
  12. package/dist_ts/data/networkaddressplan.js +27 -20
  13. package/dist_ts/data/networkauthority.js +9 -3
  14. package/dist_ts/data/networkcredential.d.ts +0 -7
  15. package/dist_ts/data/networkcredential.js +5 -22
  16. package/dist_ts/data/networklease.js +3 -3
  17. package/dist_ts/data/networknode.js +3 -3
  18. package/dist_ts/data/networkprojection.js +8 -3
  19. package/dist_ts/data/nodeenrollment.js +4 -2
  20. package/dist_ts/data/noderetirement.js +3 -3
  21. package/dist_ts/data/runtimeassignment.d.ts +12 -0
  22. package/dist_ts/data/runtimeassignment.js +29 -4
  23. package/dist_ts/data/runtimesession.js +3 -2
  24. package/dist_ts/data/serviceruntime.js +6 -5
  25. package/dist_ts/data/sparknodereport.js +6 -3
  26. package/dist_ts/private/networkcontract.d.ts +2 -0
  27. package/dist_ts/private/networkcontract.js +8 -2
  28. package/dist_ts/private/nodeidentifier.d.ts +22 -0
  29. package/dist_ts/private/nodeidentifier.js +23 -0
  30. package/dist_ts/requests/corestore.js +4 -4
  31. package/dist_ts/runtime.js +7 -4
  32. package/package.json +1 -1
  33. package/readme.md +60 -24
  34. package/ts/00_commitinfo_data.ts +1 -1
  35. package/ts/data/cluster.ts +9 -21
  36. package/ts/data/clusteringress.ts +8 -7
  37. package/ts/data/clusternode.ts +32 -4
  38. package/ts/data/clustervpn.ts +28 -9
  39. package/ts/data/isolatedrestore.ts +12 -3
  40. package/ts/data/networkaddressplan.ts +32 -25
  41. package/ts/data/networkauthority.ts +8 -2
  42. package/ts/data/networkcredential.ts +4 -29
  43. package/ts/data/networklease.ts +2 -2
  44. package/ts/data/networknode.ts +2 -2
  45. package/ts/data/networkprojection.ts +6 -2
  46. package/ts/data/nodeenrollment.ts +4 -2
  47. package/ts/data/noderetirement.ts +2 -2
  48. package/ts/data/runtimeassignment.ts +26 -3
  49. package/ts/data/runtimesession.ts +3 -2
  50. package/ts/data/serviceruntime.ts +6 -5
  51. package/ts/data/sparknodereport.ts +7 -2
  52. package/ts/private/networkcontract.ts +6 -1
  53. package/ts/private/nodeidentifier.ts +25 -0
  54. package/ts/requests/corestore.ts +3 -3
  55. 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
+ );
@@ -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 (typeof valueArg.nodeId !== 'string'
193
- || !clusterCorestoreInventoryIdentifierPattern.test(valueArg.nodeId)) {
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 (!isRuntimeIdentifier(targetArg.cloudlyNodeId)
763
- || !isRuntimeIdentifier(targetArg.swarmClusterId)
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 (isRuntimeIdentifier(targetArg.cloudlyNodeId)
774
+ if (isClusterNodeId(targetArg.cloudlyNodeId)
772
775
  && isRuntimeIdentifier(targetArg.swarmClusterId)
773
776
  && isRuntimeIdentifier(targetArg.swarmNodeId)
774
777
  && isRuntimeIdentifier(targetArg.nodeName)