@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.
Files changed (204) hide show
  1. package/.smartconfig.json +1 -0
  2. package/changelog.md +467 -0
  3. package/dist_ts/00_commitinfo_data.js +3 -3
  4. package/dist_ts/appstore/types.d.ts +4 -6
  5. package/dist_ts/appstore/types.js +5 -5
  6. package/dist_ts/data/backup.d.ts +3 -26
  7. package/dist_ts/data/cluster.d.ts +36 -11
  8. package/dist_ts/data/cluster.js +33 -22
  9. package/dist_ts/data/clusteringress.d.ts +8 -0
  10. package/dist_ts/data/clusteringress.js +13 -8
  11. package/dist_ts/data/clusternode.d.ts +121 -74
  12. package/dist_ts/data/clusternode.js +109 -132
  13. package/dist_ts/data/coremail.d.ts +3 -7
  14. package/dist_ts/data/coremail.js +2 -2
  15. package/dist_ts/data/coremail.runtime.d.ts +0 -1
  16. package/dist_ts/data/coremail.runtime.js +5 -22
  17. package/dist_ts/data/deploymentadoption.d.ts +0 -2
  18. package/dist_ts/data/deploymentadoption.js +40 -6
  19. package/dist_ts/data/deploymentoperation.js +16 -3
  20. package/dist_ts/data/deploymentpreflight.d.ts +0 -2
  21. package/dist_ts/data/deploymentpreflight.js +1 -1
  22. package/dist_ts/data/immutableimage.d.ts +38 -21
  23. package/dist_ts/data/immutableimage.js +45 -5
  24. package/dist_ts/data/index.d.ts +1 -1
  25. package/dist_ts/data/isolatedrestore.d.ts +139 -21
  26. package/dist_ts/data/isolatedrestore.golden.d.ts +0 -1
  27. package/dist_ts/data/isolatedrestore.golden.js +6 -9
  28. package/dist_ts/data/isolatedrestore.js +176 -40
  29. package/dist_ts/data/mail.d.ts +1 -1
  30. package/dist_ts/data/networkaddressplan.d.ts +8 -8
  31. package/dist_ts/data/networkaddressplan.js +4 -4
  32. package/dist_ts/data/networkauthority.d.ts +20 -22
  33. package/dist_ts/data/networkauthority.js +26 -28
  34. package/dist_ts/data/networkcredential.d.ts +10 -10
  35. package/dist_ts/data/networkcredential.js +16 -16
  36. package/dist_ts/data/networkdelivery.d.ts +18 -18
  37. package/dist_ts/data/networkdelivery.js +16 -16
  38. package/dist_ts/data/networklease.d.ts +18 -7
  39. package/dist_ts/data/networklease.js +29 -7
  40. package/dist_ts/data/networknode.d.ts +2 -2
  41. package/dist_ts/data/networkprojection.d.ts +59 -60
  42. package/dist_ts/data/networkprojection.js +53 -57
  43. package/dist_ts/data/networkprotection.d.ts +27 -28
  44. package/dist_ts/data/networkprotection.js +36 -36
  45. package/dist_ts/data/networkrouter.d.ts +11 -11
  46. package/dist_ts/data/networkrouter.js +1 -1
  47. package/dist_ts/data/networksigning.d.ts +16 -18
  48. package/dist_ts/data/networksigning.js +20 -21
  49. package/dist_ts/data/nodecredential.d.ts +4 -6
  50. package/dist_ts/data/nodeenrollment.d.ts +35 -40
  51. package/dist_ts/data/nodeenrollment.js +57 -72
  52. package/dist_ts/data/privatenetwork.d.ts +21 -24
  53. package/dist_ts/data/privatenetwork.js +39 -54
  54. package/dist_ts/data/runtimeassignment.d.ts +50 -34
  55. package/dist_ts/data/runtimeassignment.js +79 -45
  56. package/dist_ts/data/runtimeconfig.d.ts +21 -22
  57. package/dist_ts/data/runtimeconfig.js +24 -24
  58. package/dist_ts/data/runtimesession.d.ts +100 -62
  59. package/dist_ts/data/runtimesession.js +98 -79
  60. package/dist_ts/data/runtimeterminalreceipt.d.ts +28 -29
  61. package/dist_ts/data/runtimeterminalreceipt.js +42 -42
  62. package/dist_ts/data/secret.d.ts +18 -25
  63. package/dist_ts/data/secret.js +12 -52
  64. package/dist_ts/data/servicecredential.d.ts +14 -16
  65. package/dist_ts/data/servicecredential.js +17 -28
  66. package/dist_ts/data/serviceruntime.d.ts +7 -7
  67. package/dist_ts/data/serviceruntime.js +4 -4
  68. package/dist_ts/data/sparknodereport.d.ts +27 -14
  69. package/dist_ts/data/sparknodereport.js +35 -28
  70. package/dist_ts/data/webpush.d.ts +0 -1
  71. package/dist_ts/index.d.ts +2 -1
  72. package/dist_ts/index.js +3 -2
  73. package/dist_ts/platform/objectstorageretention.d.ts +21 -24
  74. package/dist_ts/platform/objectstorageretention.js +6 -18
  75. package/dist_ts/platform/storage.d.ts +1 -3
  76. package/dist_ts/platform/storagemigration.d.ts +0 -7
  77. package/dist_ts/platform/storagemigration.golden.d.ts +0 -1
  78. package/dist_ts/platform/storagemigration.golden.js +8 -12
  79. package/dist_ts/platform/storagemigration.js +6 -51
  80. package/dist_ts/platform/types.d.ts +2 -2
  81. package/dist_ts/private/canonicaljson.d.ts +9 -1
  82. package/dist_ts/private/canonicaljson.js +14 -2
  83. package/dist_ts/private/dataproperties.d.ts +62 -0
  84. package/dist_ts/private/dataproperties.js +117 -0
  85. package/dist_ts/private/networkcontract.d.ts +10 -10
  86. package/dist_ts/private/networkcontract.js +1 -1
  87. package/dist_ts/private/releaseversion.d.ts +37 -0
  88. package/dist_ts/private/releaseversion.js +48 -0
  89. package/dist_ts/private/runtimepolicy.d.ts +2 -2
  90. package/dist_ts/private/runtimepolicy.js +1 -1
  91. package/dist_ts/private/tokenlist.d.ts +9 -0
  92. package/dist_ts/private/tokenlist.js +23 -0
  93. package/dist_ts/protocol.d.ts +137 -0
  94. package/dist_ts/protocol.js +255 -0
  95. package/dist_ts/requests/admin.d.ts +8 -8
  96. package/dist_ts/requests/backup.d.ts +102 -112
  97. package/dist_ts/requests/cluster.d.ts +10 -10
  98. package/dist_ts/requests/clusteringress.d.ts +9 -0
  99. package/dist_ts/requests/clusteringress.js +1 -1
  100. package/dist_ts/requests/config.d.ts +3 -3
  101. package/dist_ts/requests/corestore.d.ts +0 -3
  102. package/dist_ts/requests/corestore.js +5 -9
  103. package/dist_ts/requests/network.d.ts +30 -30
  104. package/dist_ts/requests/node.d.ts +15 -28
  105. package/dist_ts/requests/pallet.d.ts +13 -13
  106. package/dist_ts/requests/runtimesession.d.ts +53 -41
  107. package/dist_ts/requests/secret.d.ts +4 -5
  108. package/dist_ts/requests/secret.js +1 -5
  109. package/dist_ts/runtime.corestore.d.ts +56 -74
  110. package/dist_ts/runtime.corestore.databaseexportpackage.d.ts +30 -36
  111. package/dist_ts/runtime.corestore.databaseexportpackage.golden.d.ts +11 -12
  112. package/dist_ts/runtime.corestore.databaseexportpackage.golden.js +54 -71
  113. package/dist_ts/runtime.corestore.databaseexportpackage.js +9 -25
  114. package/dist_ts/runtime.corestore.js +35 -135
  115. package/dist_ts/runtime.corestore.relay.js +2 -7
  116. package/dist_ts/runtime.d.ts +38 -48
  117. package/dist_ts/runtime.js +20 -77
  118. package/dist_ts/runtime.networkprojection.d.ts +4 -4
  119. package/dist_ts/runtime.networkprojection.js +18 -18
  120. package/dist_ts/runtime.workloadinit.d.ts +23 -24
  121. package/dist_ts/runtime.workloadinit.js +6 -13
  122. package/package.json +2 -2
  123. package/readme.md +421 -270
  124. package/ts/00_commitinfo_data.ts +3 -3
  125. package/ts/appstore/types.ts +4 -6
  126. package/ts/data/backup.ts +3 -38
  127. package/ts/data/cluster.ts +51 -34
  128. package/ts/data/clusteringress.ts +12 -12
  129. package/ts/data/clusternode.ts +204 -232
  130. package/ts/data/coremail.runtime.ts +4 -21
  131. package/ts/data/coremail.ts +3 -7
  132. package/ts/data/deploymentadoption.ts +46 -4
  133. package/ts/data/deploymentoperation.ts +16 -1
  134. package/ts/data/deploymentpreflight.ts +0 -2
  135. package/ts/data/immutableimage.ts +71 -24
  136. package/ts/data/index.ts +1 -1
  137. package/ts/data/isolatedrestore.golden.ts +5 -9
  138. package/ts/data/isolatedrestore.ts +339 -54
  139. package/ts/data/mail.ts +1 -1
  140. package/ts/data/networkaddressplan.ts +13 -13
  141. package/ts/data/networkauthority.ts +42 -46
  142. package/ts/data/networkcredential.ts +24 -24
  143. package/ts/data/networkdelivery.ts +27 -27
  144. package/ts/data/networklease.ts +40 -13
  145. package/ts/data/networknode.ts +2 -2
  146. package/ts/data/networkprojection.ts +119 -124
  147. package/ts/data/networkprotection.ts +54 -55
  148. package/ts/data/networkrouter.ts +14 -14
  149. package/ts/data/networksigning.ts +29 -32
  150. package/ts/data/nodecredential.ts +4 -6
  151. package/ts/data/nodeenrollment.ts +96 -114
  152. package/ts/data/privatenetwork.ts +58 -74
  153. package/ts/data/runtimeassignment.ts +143 -94
  154. package/ts/data/runtimeconfig.ts +45 -46
  155. package/ts/data/runtimesession.ts +185 -138
  156. package/ts/data/runtimeterminalreceipt.ts +72 -73
  157. package/ts/data/secret.ts +28 -76
  158. package/ts/data/servicecredential.ts +33 -43
  159. package/ts/data/serviceruntime.ts +11 -11
  160. package/ts/data/sparknodereport.ts +48 -36
  161. package/ts/data/webpush.ts +0 -1
  162. package/ts/index.ts +2 -0
  163. package/ts/platform/objectstorageretention.ts +36 -55
  164. package/ts/platform/storage.ts +1 -3
  165. package/ts/platform/storagemigration.golden.ts +7 -11
  166. package/ts/platform/storagemigration.ts +5 -55
  167. package/ts/platform/types.ts +2 -2
  168. package/ts/private/canonicaljson.ts +13 -1
  169. package/ts/private/dataproperties.ts +139 -0
  170. package/ts/private/networkcontract.ts +9 -9
  171. package/ts/private/releaseversion.ts +70 -0
  172. package/ts/private/runtimepolicy.ts +2 -2
  173. package/ts/private/tokenlist.ts +30 -0
  174. package/ts/protocol.ts +364 -0
  175. package/ts/requests/admin.ts +11 -11
  176. package/ts/requests/backup.ts +112 -117
  177. package/ts/requests/cluster.ts +13 -13
  178. package/ts/requests/clusteringress.ts +9 -0
  179. package/ts/requests/config.ts +3 -3
  180. package/ts/requests/corestore.ts +4 -16
  181. package/ts/requests/network.ts +40 -40
  182. package/ts/requests/node.ts +21 -38
  183. package/ts/requests/pallet.ts +17 -17
  184. package/ts/requests/runtimesession.ts +63 -51
  185. package/ts/requests/secret.ts +5 -10
  186. package/ts/runtime.corestore.databaseexportpackage.golden.ts +77 -95
  187. package/ts/runtime.corestore.databaseexportpackage.ts +51 -73
  188. package/ts/runtime.corestore.relay.ts +1 -10
  189. package/ts/runtime.corestore.ts +118 -268
  190. package/ts/runtime.networkprojection.ts +30 -30
  191. package/ts/runtime.ts +83 -158
  192. package/ts/runtime.workloadinit.ts +36 -48
  193. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.d.ts +0 -902
  194. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.d.ts +0 -35
  195. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.js +0 -315
  196. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.js +0 -3315
  197. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.d.ts +0 -291
  198. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.d.ts +0 -30
  199. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.js +0 -408
  200. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.js +0 -1126
  201. package/ts/runtime.cloudlylegacydeploymentsettlement.golden.ts +0 -421
  202. package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.ts +0 -510
  203. package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.ts +0 -2470
  204. package/ts/runtime.cloudlylegacydeploymentsettlement.ts +0 -6630
@@ -0,0 +1,137 @@
1
+ /**
2
+ * The contract this build speaks: the installed `@serve.zone/interfaces` release.
3
+ *
4
+ * There is no protocol number beside it and no per-shape version anywhere in this package. One
5
+ * release of these interfaces is exactly one contract, so naming the release is the complete
6
+ * statement about what a peer sends and what it can read.
7
+ */
8
+ export declare const protocolVersion: string;
9
+ /**
10
+ * What one side of a session speaks, and the oldest peer it accepts.
11
+ *
12
+ * Frozen across majors together with `IProtocolRefusal`: a peer built against the next major must
13
+ * still be able to read this, or the mismatch it exists to name arrives as an unreadable body and
14
+ * degrades into a generic contract rejection.
15
+ */
16
+ export interface IProtocolOffer {
17
+ /** `MAJOR.MINOR.PATCH` of the `@serve.zone/interfaces` release the sender was built against. */
18
+ interfacesVersion: string;
19
+ /**
20
+ * The oldest peer release this side accepts: in the same major as `interfacesVersion` and never
21
+ * above it. A deployable raises it in the commit that starts depending on a later minor, for the
22
+ * session kind that depends on it, which is what orders a rollout: peers first.
23
+ */
24
+ minimumPeerVersion: string;
25
+ }
26
+ /**
27
+ * Why two offers cannot serve one session, judged from the side that refuses.
28
+ *
29
+ * `peer-below-minimum` and `self-below-peer-minimum` are the same fact seen from the two sides,
30
+ * which is why both exist: a log line names who was too old without the reader having to know
31
+ * which side wrote it.
32
+ */
33
+ declare const protocolIncompatibilities: readonly ["major-mismatch", "peer-below-minimum", "self-below-peer-minimum"];
34
+ export type TProtocolIncompatibility = (typeof protocolIncompatibilities)[number];
35
+ /**
36
+ * The named refusal, carried as `TypedResponseError.errorData` on a TypedRequest hop and as the
37
+ * response body on the Spark heartbeat's refusal status. Frozen across majors.
38
+ */
39
+ export interface IProtocolRefusal {
40
+ code: 'protocol-incompatible';
41
+ /** Judged from the refusing side. */
42
+ reason: TProtocolIncompatibility;
43
+ /** The offer of the side that refused. */
44
+ refusing: IProtocolOffer;
45
+ /** The offer it refused. */
46
+ refused: IProtocolOffer;
47
+ }
48
+ export type TProtocolNegotiation = {
49
+ compatible: true;
50
+ } | {
51
+ compatible: false;
52
+ refusal: IProtocolRefusal;
53
+ };
54
+ /**
55
+ * The cadence at which a refused client offers again.
56
+ *
57
+ * Shared so that no client invents its own: a refusal stands until one of the two sides is
58
+ * upgraded, which is an operator action, so offering faster only costs connections.
59
+ */
60
+ export declare const refusedOfferRetryIntervalMs = 300000;
61
+ /**
62
+ * The status a route that carries no typed error answers a refusal with, body `IProtocolRefusal`.
63
+ *
64
+ * The Spark routes are plain HTTPS POSTs, so the refusal needs a status of its own: 422 says the
65
+ * body was read and judged, which is exactly what happened, and separates a refused offer from the
66
+ * 401 an unknown node gets and the 400 a malformed body gets.
67
+ */
68
+ export declare const protocolRefusalHttpStatus = 422;
69
+ /**
70
+ * Validates one protocol offer and names every reason it is refused.
71
+ *
72
+ * Shape and self-consistency only, like every other validator in this package: whether the peer
73
+ * that sent it may open a session is the server's decision against its own records, and whether
74
+ * the two sides can serve one is `negotiateProtocol`.
75
+ */
76
+ export declare const validateProtocolOffer: (valueArg: unknown, pathArg?: string) => string[];
77
+ /**
78
+ * Every reason the `protocol` key of a body does not carry one offer.
79
+ *
80
+ * The naming twin of `readProtocolOffer`, for a validator that lists reasons instead of throwing:
81
+ * both read that key once as a data property, so a carrier never runs an accessor a peer put on a
82
+ * body, and both judge the copy that read produced rather than the peer's object.
83
+ */
84
+ export declare const validateProtocolOfferOn: (bodyArg: unknown, pathArg?: string) => string[];
85
+ /**
86
+ * This build's offer towards one kind of peer.
87
+ *
88
+ * The spoken version is never stated by the caller: it is the installed release, so an offer
89
+ * cannot claim a contract this build does not carry. A minimum above that release, or in another
90
+ * major, is refused here — at start-up of the deployable that declared it, rather than at its
91
+ * first registration in production.
92
+ */
93
+ export declare const createProtocolOffer: (minimumPeerVersionArg: string) => IProtocolOffer;
94
+ /**
95
+ * The offer on a request or response body, read before anything else on that body.
96
+ *
97
+ * This is where the one server order on every carrier is written down, so that each carrier can
98
+ * refer to it instead of restating it: read the raw body as a bounded record, `readProtocolOffer`
99
+ * on it, `negotiateProtocol` against this server's offer for that session kind, answer a refusal,
100
+ * and only then the carrier's exact-key validator, the bearer and any mutation. The offer comes
101
+ * before the validator because every validator in this package is exact-key: a peer of a later
102
+ * major sends keys this build cannot validate, so a server that shape-checked first would answer
103
+ * an incompatible peer with a generic malformed-body rejection instead of the named refusal it
104
+ * backs off from. A carrier whose validator also checks `protocol` checks it for self-consistency
105
+ * within one major; the negotiation has already happened by then.
106
+ *
107
+ * Reads `protocol` alone and touches no other key, for that same reason. The returned offer is
108
+ * detached, so validating the rest of the body afterwards cannot change what was negotiated.
109
+ */
110
+ export declare const readProtocolOffer: (bodyArg: unknown) => IProtocolOffer;
111
+ /**
112
+ * Whether the two sides can serve one session, judged from the local side.
113
+ *
114
+ * Pure, and the order of the three checks is part of the contract: a major mismatch is reported as
115
+ * a major mismatch even when a minimum would also fail, because that is the fact an operator acts
116
+ * on. The two minimum rules are mirror images — one of them holding means the other holds on the
117
+ * peer, and they can never hold at once, since that would need each version to be below the other.
118
+ * An offer whose versions are not release versions is refused by throwing, at the caller that
119
+ * passed it, rather than named as an incompatibility between two peers.
120
+ */
121
+ export declare const negotiateProtocol: (localArg: IProtocolOffer, remoteArg: IProtocolOffer) => TProtocolNegotiation;
122
+ /**
123
+ * The refusal inside an error payload or a response body, or `null` when the value is not one.
124
+ *
125
+ * Every transport hands it over as plain JSON, so this reads a value that survived serialization
126
+ * and answers `null` for everything else: that is how a client tells a protocol refusal, which it
127
+ * must not retry quickly, apart from every other error a server may return.
128
+ */
129
+ export declare const readProtocolRefusal: (valueArg: unknown) => IProtocolRefusal | null;
130
+ /**
131
+ * One line naming both sides, for the log a refusal is judged from.
132
+ *
133
+ * It opens with the code, which is the text prefix frozen across majors, so a refusal stays
134
+ * recognisable in a log written by a build nobody runs any more.
135
+ */
136
+ export declare const describeProtocolRefusal: (refusalArg: IProtocolRefusal) => string;
137
+ export {};
@@ -0,0 +1,255 @@
1
+ import { commitinfo } from './00_commitinfo_data.js';
2
+ import { isPlainRecord, readDataProperty, readExactDataRecord, } from './private/dataproperties.js';
3
+ import { compareReleaseVersions, isReleaseVersion, maximumReleaseVersionLength, parseReleaseVersion, } from './private/releaseversion.js';
4
+ /**
5
+ * The contract this build speaks: the installed `@serve.zone/interfaces` release.
6
+ *
7
+ * There is no protocol number beside it and no per-shape version anywhere in this package. One
8
+ * release of these interfaces is exactly one contract, so naming the release is the complete
9
+ * statement about what a peer sends and what it can read.
10
+ */
11
+ export const protocolVersion = commitinfo.version;
12
+ const protocolOfferKeys = ['interfacesVersion', 'minimumPeerVersion'];
13
+ /**
14
+ * Why two offers cannot serve one session, judged from the side that refuses.
15
+ *
16
+ * `peer-below-minimum` and `self-below-peer-minimum` are the same fact seen from the two sides,
17
+ * which is why both exist: a log line names who was too old without the reader having to know
18
+ * which side wrote it.
19
+ */
20
+ const protocolIncompatibilities = [
21
+ 'major-mismatch',
22
+ 'peer-below-minimum',
23
+ 'self-below-peer-minimum',
24
+ ];
25
+ const protocolRefusalKeys = ['code', 'reason', 'refusing', 'refused'];
26
+ /**
27
+ * The cadence at which a refused client offers again.
28
+ *
29
+ * Shared so that no client invents its own: a refusal stands until one of the two sides is
30
+ * upgraded, which is an operator action, so offering faster only costs connections.
31
+ */
32
+ export const refusedOfferRetryIntervalMs = 300_000;
33
+ /**
34
+ * The status a route that carries no typed error answers a refusal with, body `IProtocolRefusal`.
35
+ *
36
+ * The Spark routes are plain HTTPS POSTs, so the refusal needs a status of its own: 422 says the
37
+ * body was read and judged, which is exactly what happened, and separates a refused offer from the
38
+ * 401 an unknown node gets and the 400 a malformed body gets.
39
+ */
40
+ export const protocolRefusalHttpStatus = 422;
41
+ const exactSchemaMessage = (pathArg) => `${pathArg} must use its exact schema`;
42
+ const releaseVersionMessage = (pathArg) => (`${pathArg} must be a MAJOR.MINOR.PATCH release version of at most `
43
+ + `${maximumReleaseVersionLength} characters, without prerelease or build metadata`);
44
+ const requireReleaseVersion = (valueArg, pathArg) => {
45
+ const version = parseReleaseVersion(valueArg);
46
+ if (version === null) {
47
+ throw new Error(releaseVersionMessage(pathArg));
48
+ }
49
+ return version;
50
+ };
51
+ /**
52
+ * The one place an offer is built: frozen, over two values that were read once and then judged.
53
+ *
54
+ * Every offer this module hands out comes from here, so what a caller holds shares nothing with
55
+ * the body it arrived on and cannot change under a session that was already negotiated.
56
+ */
57
+ const buildProtocolOffer = (interfacesVersionArg, minimumPeerVersionArg) => Object.freeze({
58
+ interfacesVersion: interfacesVersionArg,
59
+ minimumPeerVersion: minimumPeerVersionArg,
60
+ });
61
+ /** Every reason two values are not one offer, in the order a reader fixes them. */
62
+ const offerErrors = (interfacesVersionArg, minimumPeerVersionArg, pathArg) => {
63
+ const spoken = parseReleaseVersion(interfacesVersionArg);
64
+ const minimum = parseReleaseVersion(minimumPeerVersionArg);
65
+ if (spoken === null || minimum === null) {
66
+ return [
67
+ ...(spoken === null ? [releaseVersionMessage(`${pathArg} interfacesVersion`)] : []),
68
+ ...(minimum === null ? [releaseVersionMessage(`${pathArg} minimumPeerVersion`)] : []),
69
+ ];
70
+ }
71
+ return [
72
+ ...(spoken.major !== minimum.major
73
+ ? [`${pathArg} minimumPeerVersion must be in the same major as interfacesVersion`]
74
+ : []),
75
+ ...(compareReleaseVersions(minimum, spoken) > 0
76
+ ? [`${pathArg} minimumPeerVersion must not be above interfacesVersion`]
77
+ : []),
78
+ ];
79
+ };
80
+ /**
81
+ * Reads both fields once and judges those two values.
82
+ *
83
+ * The copy is built from what was judged rather than read again from the source: an offer arrives
84
+ * on a body a peer wrote, and the session must be served by the offer the validator saw. A field
85
+ * that is not plain data is refused by `readExactDataRecord` instead of run, so reading an offer
86
+ * never executes a peer's code and cannot observe two different values.
87
+ */
88
+ const readOffer = (valueArg, pathArg = 'protocol offer') => {
89
+ const offer = readExactDataRecord(valueArg, protocolOfferKeys);
90
+ if (offer === null) {
91
+ return { offer: null, errors: [exactSchemaMessage(pathArg)] };
92
+ }
93
+ const interfacesVersion = offer.interfacesVersion;
94
+ const minimumPeerVersion = offer.minimumPeerVersion;
95
+ // The grammar is judged first because the rules below compare two releases, and a value that
96
+ // names none cannot be compared to one.
97
+ if (!isReleaseVersion(interfacesVersion) || !isReleaseVersion(minimumPeerVersion)) {
98
+ return { offer: null, errors: offerErrors(interfacesVersion, minimumPeerVersion, pathArg) };
99
+ }
100
+ const errors = offerErrors(interfacesVersion, minimumPeerVersion, pathArg);
101
+ return errors.length > 0
102
+ ? { offer: null, errors }
103
+ : { offer: buildProtocolOffer(interfacesVersion, minimumPeerVersion), errors };
104
+ };
105
+ /**
106
+ * Validates one protocol offer and names every reason it is refused.
107
+ *
108
+ * Shape and self-consistency only, like every other validator in this package: whether the peer
109
+ * that sent it may open a session is the server's decision against its own records, and whether
110
+ * the two sides can serve one is `negotiateProtocol`.
111
+ */
112
+ export const validateProtocolOffer = (valueArg, pathArg = 'protocol offer') => readOffer(valueArg, pathArg).errors;
113
+ /**
114
+ * Every reason the `protocol` key of a body does not carry one offer.
115
+ *
116
+ * The naming twin of `readProtocolOffer`, for a validator that lists reasons instead of throwing:
117
+ * both read that key once as a data property, so a carrier never runs an accessor a peer put on a
118
+ * body, and both judge the copy that read produced rather than the peer's object.
119
+ */
120
+ export const validateProtocolOfferOn = (bodyArg, pathArg = 'protocol offer') => validateProtocolOffer(readDataProperty(bodyArg, 'protocol')?.value, pathArg);
121
+ /** One valid offer, detached and inert, or the first reason the value is not one. */
122
+ const requireProtocolOffer = (valueArg, pathArg) => {
123
+ const read = readOffer(valueArg, pathArg);
124
+ if (read.offer === null) {
125
+ throw new Error(read.errors[0]);
126
+ }
127
+ return read.offer;
128
+ };
129
+ /**
130
+ * This build's offer towards one kind of peer.
131
+ *
132
+ * The spoken version is never stated by the caller: it is the installed release, so an offer
133
+ * cannot claim a contract this build does not carry. A minimum above that release, or in another
134
+ * major, is refused here — at start-up of the deployable that declared it, rather than at its
135
+ * first registration in production.
136
+ */
137
+ export const createProtocolOffer = (minimumPeerVersionArg) => (requireProtocolOffer({
138
+ interfacesVersion: protocolVersion,
139
+ minimumPeerVersion: minimumPeerVersionArg,
140
+ }, 'protocol offer'));
141
+ /**
142
+ * The offer on a request or response body, read before anything else on that body.
143
+ *
144
+ * This is where the one server order on every carrier is written down, so that each carrier can
145
+ * refer to it instead of restating it: read the raw body as a bounded record, `readProtocolOffer`
146
+ * on it, `negotiateProtocol` against this server's offer for that session kind, answer a refusal,
147
+ * and only then the carrier's exact-key validator, the bearer and any mutation. The offer comes
148
+ * before the validator because every validator in this package is exact-key: a peer of a later
149
+ * major sends keys this build cannot validate, so a server that shape-checked first would answer
150
+ * an incompatible peer with a generic malformed-body rejection instead of the named refusal it
151
+ * backs off from. A carrier whose validator also checks `protocol` checks it for self-consistency
152
+ * within one major; the negotiation has already happened by then.
153
+ *
154
+ * Reads `protocol` alone and touches no other key, for that same reason. The returned offer is
155
+ * detached, so validating the rest of the body afterwards cannot change what was negotiated.
156
+ */
157
+ export const readProtocolOffer = (bodyArg) => {
158
+ if (!isPlainRecord(bodyArg)) {
159
+ throw new Error('protocol offer must be carried as the protocol key of a body record');
160
+ }
161
+ // One data property, read once: a `protocol` key that is an accessor carries no offer this
162
+ // module will serve a session from, exactly like a key that is missing or malformed.
163
+ return requireProtocolOffer(readDataProperty(bodyArg, 'protocol')?.value, 'protocol offer');
164
+ };
165
+ /**
166
+ * The one place an `IProtocolRefusal` is built: frozen, over two offers this module already
167
+ * detached, so a refusal states what was judged and nothing a caller can change afterwards.
168
+ */
169
+ const buildProtocolRefusal = (reasonArg, refusingArg, refusedArg) => Object.freeze({
170
+ code: 'protocol-incompatible',
171
+ reason: reasonArg,
172
+ refusing: refusingArg,
173
+ refused: refusedArg,
174
+ });
175
+ /**
176
+ * One side, read exactly once.
177
+ *
178
+ * Only the grammar is judged here: whether two offers can serve one session is the decision this
179
+ * feeds, and a side whose own two versions disagree still has to get a named answer rather than a
180
+ * different error. Reading once is what lets the refusal state what was judged while each caller
181
+ * goes on holding, and changing, its own offer object.
182
+ */
183
+ const readNegotiatingSide = (offerArg, pathArg) => {
184
+ const { interfacesVersion, minimumPeerVersion } = offerArg;
185
+ const spoken = requireReleaseVersion(interfacesVersion, `${pathArg} interfacesVersion`);
186
+ const minimum = requireReleaseVersion(minimumPeerVersion, `${pathArg} minimumPeerVersion`);
187
+ return { offer: buildProtocolOffer(interfacesVersion, minimumPeerVersion), spoken, minimum };
188
+ };
189
+ /**
190
+ * Whether the two sides can serve one session, judged from the local side.
191
+ *
192
+ * Pure, and the order of the three checks is part of the contract: a major mismatch is reported as
193
+ * a major mismatch even when a minimum would also fail, because that is the fact an operator acts
194
+ * on. The two minimum rules are mirror images — one of them holding means the other holds on the
195
+ * peer, and they can never hold at once, since that would need each version to be below the other.
196
+ * An offer whose versions are not release versions is refused by throwing, at the caller that
197
+ * passed it, rather than named as an incompatibility between two peers.
198
+ */
199
+ export const negotiateProtocol = (localArg, remoteArg) => {
200
+ const local = readNegotiatingSide(localArg, 'local protocol offer');
201
+ const remote = readNegotiatingSide(remoteArg, 'remote protocol offer');
202
+ const refuse = (reasonArg) => ({
203
+ compatible: false,
204
+ refusal: buildProtocolRefusal(reasonArg, local.offer, remote.offer),
205
+ });
206
+ if (local.spoken.major !== remote.spoken.major) {
207
+ return refuse('major-mismatch');
208
+ }
209
+ if (compareReleaseVersions(remote.spoken, local.minimum) < 0) {
210
+ return refuse('peer-below-minimum');
211
+ }
212
+ if (compareReleaseVersions(local.spoken, remote.minimum) < 0) {
213
+ return refuse('self-below-peer-minimum');
214
+ }
215
+ return { compatible: true };
216
+ };
217
+ const isProtocolIncompatibility = (valueArg) => (protocolIncompatibilities.some((reasonArg) => reasonArg === valueArg));
218
+ /**
219
+ * The refusal inside an error payload or a response body, or `null` when the value is not one.
220
+ *
221
+ * Every transport hands it over as plain JSON, so this reads a value that survived serialization
222
+ * and answers `null` for everything else: that is how a client tells a protocol refusal, which it
223
+ * must not retry quickly, apart from every other error a server may return.
224
+ */
225
+ export const readProtocolRefusal = (valueArg) => {
226
+ const refusal = readExactDataRecord(valueArg, protocolRefusalKeys);
227
+ if (refusal === null) {
228
+ return null;
229
+ }
230
+ // Every field is read once and both offers are judged as copies, so what a client waits on is
231
+ // what its own check answered `null` or a refusal for.
232
+ const code = refusal.code;
233
+ const reason = refusal.reason;
234
+ if (code !== 'protocol-incompatible' || !isProtocolIncompatibility(reason)) {
235
+ return null;
236
+ }
237
+ const refusing = readOffer(refusal.refusing).offer;
238
+ const refused = readOffer(refusal.refused).offer;
239
+ if (refusing === null || refused === null) {
240
+ return null;
241
+ }
242
+ return buildProtocolRefusal(reason, refusing, refused);
243
+ };
244
+ /**
245
+ * One line naming both sides, for the log a refusal is judged from.
246
+ *
247
+ * It opens with the code, which is the text prefix frozen across majors, so a refusal stays
248
+ * recognisable in a log written by a build nobody runs any more.
249
+ */
250
+ export const describeProtocolRefusal = (refusalArg) => (`${refusalArg.code} (${refusalArg.reason}): `
251
+ + `refusing side speaks ${refusalArg.refusing.interfacesVersion} `
252
+ + `and accepts from ${refusalArg.refusing.minimumPeerVersion}; `
253
+ + `refused side speaks ${refusalArg.refused.interfacesVersion} `
254
+ + `and accepts from ${refusalArg.refused.minimumPeerVersion}`);
255
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdG9jb2wuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm90b2NvbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDckQsT0FBTyxFQUNMLGFBQWEsRUFBRSxnQkFBZ0IsRUFBRSxtQkFBbUIsR0FDckQsTUFBTSw2QkFBNkIsQ0FBQztBQUNyQyxPQUFPLEVBQ0wsc0JBQXNCLEVBQ3RCLGdCQUFnQixFQUNoQiwyQkFBMkIsRUFDM0IsbUJBQW1CLEdBRXBCLE1BQU0sNkJBQTZCLENBQUM7QUFFckM7Ozs7OztHQU1HO0FBQ0gsTUFBTSxDQUFDLE1BQU0sZUFBZSxHQUFXLFVBQVUsQ0FBQyxPQUFPLENBQUM7QUFvQjFELE1BQU0saUJBQWlCLEdBQUcsQ0FBQyxtQkFBbUIsRUFBRSxvQkFBb0IsQ0FBVSxDQUFDO0FBRS9FOzs7Ozs7R0FNRztBQUNILE1BQU0seUJBQXlCLEdBQUc7SUFDaEMsZ0JBQWdCO0lBQ2hCLG9CQUFvQjtJQUNwQix5QkFBeUI7Q0FDakIsQ0FBQztBQWtCWCxNQUFNLG1CQUFtQixHQUFHLENBQUMsTUFBTSxFQUFFLFFBQVEsRUFBRSxVQUFVLEVBQUUsU0FBUyxDQUFVLENBQUM7QUFNL0U7Ozs7O0dBS0c7QUFDSCxNQUFNLENBQUMsTUFBTSwyQkFBMkIsR0FBRyxPQUFPLENBQUM7QUFFbkQ7Ozs7Ozt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BQztRQUMxQyxPQUFPLElBQUksQ0FBQztJQUNkLENBQUM7SUFDRCxPQUFPLG9CQUFvQixDQUFDLE1BQU0sRUFBRSxRQUFRLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDekQsQ0FBQyxDQUFDO0FBRUY7Ozs7O0dBS0c7QUFDSCxNQUFNLENBQUMsTUFBTSx1QkFBdUIsR0FBRyxDQUFDLFVBQTRCLEVBQVUsRUFBRSxDQUFDLENBQy9FLEdBQUcsVUFBVSxDQUFDLElBQUksS0FBSyxVQUFVLENBQUMsTUFBTSxLQUFLO01BQzNDLHdCQUF3QixVQUFVLENBQUMsUUFBUSxDQUFDLGlCQUFpQixHQUFHO01BQ2hFLG9CQUFvQixVQUFVLENBQUMsUUFBUSxDQUFDLGtCQUFrQixJQUFJO01BQzlELHVCQUF1QixVQUFVLENBQUMsT0FBTyxDQUFDLGlCQUFpQixHQUFHO01BQzlELG9CQUFvQixVQUFVLENBQUMsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQzlELENBQUMifQ==
@@ -1,15 +1,15 @@
1
1
  import * as plugins from '../plugins.js';
2
2
  import type { IIdentity, IIdentityCredential, IServiceDeploymentGrant } from '../data/user.js';
3
- import type { IServiceMachineCredentialMetadataV1, IServiceMachineCredentialMutationResultV1, TServiceMachineCredentialMutationV1 } from '../data/servicecredential.js';
4
- export interface IReq_Admin_GetServiceMachineCredentialV1 extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_GetServiceMachineCredentialV1> {
5
- method: 'getServiceMachineCredentialV1';
3
+ import type { IServiceMachineCredentialMetadata, IServiceMachineCredentialMutationResult, TServiceMachineCredentialMutation } from '../data/servicecredential.js';
4
+ export interface IReq_Admin_GetServiceMachineCredential extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_GetServiceMachineCredential> {
5
+ method: 'getServiceMachineCredential';
6
6
  request: {
7
7
  identity: IIdentityCredential;
8
8
  organizationId: string;
9
9
  serviceId: string;
10
10
  };
11
11
  response: {
12
- credential: IServiceMachineCredentialMetadataV1 | null;
12
+ credential: IServiceMachineCredentialMetadata | null;
13
13
  };
14
14
  }
15
15
  /**
@@ -17,13 +17,13 @@ export interface IReq_Admin_GetServiceMachineCredentialV1 extends plugins.typedr
17
17
  * encrypted SecretSet delivery and the replay receipt in one fenced transaction.
18
18
  * No bearer is returned. Existing legacy deployment/cluster credentials are separate.
19
19
  */
20
- export interface IReq_Admin_MutateServiceMachineCredentialV1 extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_MutateServiceMachineCredentialV1> {
21
- method: 'mutateServiceMachineCredentialV1';
20
+ export interface IReq_Admin_MutateServiceMachineCredential extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_MutateServiceMachineCredential> {
21
+ method: 'mutateServiceMachineCredential';
22
22
  request: {
23
23
  identity: IIdentityCredential;
24
- mutation: TServiceMachineCredentialMutationV1;
24
+ mutation: TServiceMachineCredentialMutation;
25
25
  };
26
- response: IServiceMachineCredentialMutationResultV1;
26
+ response: IServiceMachineCredentialMutationResult;
27
27
  }
28
28
  /** Backend-owned human credential metadata; never includes a password verifier. */
29
29
  export interface IHumanCredentialMetadata {