@serve.zone/interfaces 32.74.0 → 32.76.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 +26 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/controller.d.ts +70 -0
- package/dist_ts/data/controller.js +44 -0
- package/dist_ts/data/gateway.d.ts +64 -1
- package/dist_ts/data/gateway.js +87 -2
- package/dist_ts/data/gatewayconnector.d.ts +278 -0
- package/dist_ts/data/gatewayconnector.js +418 -0
- package/dist_ts/data/index.d.ts +2 -0
- package/dist_ts/data/index.js +3 -1
- package/dist_ts/data/location.d.ts +3 -1
- package/dist_ts/data/location.js +7 -5
- package/dist_ts/private/controllercontract.d.ts +8 -0
- package/dist_ts/private/controllercontract.js +50 -0
- package/dist_ts/requests/baremetal.d.ts +2 -1
- package/dist_ts/requests/cluster.d.ts +5 -3
- package/dist_ts/requests/gateway.d.ts +9 -5
- package/dist_ts/requests/gatewayconnector.d.ts +133 -0
- package/dist_ts/requests/gatewayconnector.js +2 -0
- package/dist_ts/requests/index.d.ts +2 -1
- package/dist_ts/requests/index.js +3 -2
- package/dist_ts/requests/node.d.ts +4 -1
- package/dist_ts/runtime.corestore.database.d.ts +23 -0
- package/dist_ts/runtime.corestore.database.js +41 -0
- package/dist_ts/runtime.d.ts +1 -0
- package/dist_ts/runtime.js +2 -1
- package/package.json +2 -2
- package/readme.md +129 -6
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/controller.ts +106 -0
- package/ts/data/gateway.ts +137 -2
- package/ts/data/gatewayconnector.ts +714 -0
- package/ts/data/index.ts +2 -0
- package/ts/data/location.ts +6 -4
- package/ts/private/controllercontract.ts +59 -0
- package/ts/requests/baremetal.ts +2 -1
- package/ts/requests/cluster.ts +5 -3
- package/ts/requests/gateway.ts +9 -5
- package/ts/requests/gatewayconnector.ts +168 -0
- package/ts/requests/index.ts +2 -0
- package/ts/requests/node.ts +4 -1
- package/ts/runtime.corestore.database.ts +64 -0
- package/ts/runtime.ts +1 -0
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
import {
|
|
2
|
+
canonicalizeStrictJson,
|
|
3
|
+
createCanonicalJsonSha256Hex,
|
|
4
|
+
} from '../private/canonicaljson.js';
|
|
5
|
+
import {
|
|
6
|
+
validateControllerCounter,
|
|
7
|
+
validateControllerIdentifier,
|
|
8
|
+
validateControllerNonNegativeInteger,
|
|
9
|
+
} from '../private/controllercontract.js';
|
|
10
|
+
import { readDataElements, readDataProperty, readExactDataRecord } from '../private/dataproperties.js';
|
|
11
|
+
import { parseCanonicalIpAddress } from '../private/ipaddress.js';
|
|
12
|
+
import type { TCompleteKeyList } from '../private/keylist.js';
|
|
13
|
+
import { networkDigest } from '../private/networkcontract.js';
|
|
14
|
+
import { isCanonicalTokenList } from '../private/tokenlist.js';
|
|
15
|
+
import { type IControllerPeerSet, validateControllerPeerSet } from './controller.js';
|
|
16
|
+
import type { TSha256Digest } from './immutableimage.js';
|
|
17
|
+
import { isReleaseVersion } from './releaseversion.js';
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* The gateway connector (AGL-1182): a gateway (dcrouter) dials its controller (Cloudly) on the
|
|
21
|
+
* controller's typedsocket server, authenticates with `registerCloudlyClientSession` as the machine
|
|
22
|
+
* identity it received at adoption, and then says hello with `registerGatewaySession`. Nothing
|
|
23
|
+
* dials an adopted gateway. Over that socket the controller pushes the whole desired state of the
|
|
24
|
+
* gateway's controller-owned areas, the gateway applies it area by area and reports what it
|
|
25
|
+
* applied in its status document. A gateway that cannot reach its controller serves the state it
|
|
26
|
+
* applied last.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Every configuration area of a gateway, in the one order a gateway applies a desired state's
|
|
31
|
+
* areas in. Each area is one whole table with exactly one owner per gateway: the gateway itself or
|
|
32
|
+
* its controller.
|
|
33
|
+
*/
|
|
34
|
+
export const gatewayConfigAreaApplyOrder = Object.freeze([
|
|
35
|
+
'security', 'dns', 'routes', 'mail', 'edges',
|
|
36
|
+
] as const);
|
|
37
|
+
|
|
38
|
+
/** One configuration area of a gateway. */
|
|
39
|
+
export type TGatewayConfigArea = typeof gatewayConfigAreaApplyOrder[number];
|
|
40
|
+
|
|
41
|
+
/** True for one of `gatewayConfigAreaApplyOrder`. */
|
|
42
|
+
export const isGatewayConfigArea = (valueArg: unknown): valueArg is TGatewayConfigArea => (
|
|
43
|
+
(gatewayConfigAreaApplyOrder as readonly unknown[]).includes(valueArg)
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const gatewayConnectorContract = Object.freeze({
|
|
47
|
+
/** The digest domain of `computeGatewayAreaTableDigest`. */
|
|
48
|
+
areaTableDigestDomain: 'serve.zone/gateway-area-table',
|
|
49
|
+
/** A gateway pushes its status document at most once in this many milliseconds. */
|
|
50
|
+
minimumStatusPushIntervalMs: 5_000,
|
|
51
|
+
/** Each of `publicIps`, `proxyIps` and `forwardSourceAddresses`. */
|
|
52
|
+
maximumAddresses: 64,
|
|
53
|
+
/** Ranges per transport in `IGatewayStatusDocument.listeningPorts`; a range of any width counts once. */
|
|
54
|
+
maximumListeningPortRanges: 1024,
|
|
55
|
+
maximumDnsZones: 1024,
|
|
56
|
+
maximumHostnameLength: 253,
|
|
57
|
+
maximumRefusalDetailLength: 1024,
|
|
58
|
+
maximumStorageBackendLength: 64,
|
|
59
|
+
maximumStoragePathLength: 4096,
|
|
60
|
+
} as const);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* One gateway as its controller records it.
|
|
64
|
+
*
|
|
65
|
+
* `connection` says how the two reach each other. A `legacy` gateway is the dcrouter the
|
|
66
|
+
* controller still dials at its URL as the named gateway client. An `adopted` gateway dials the
|
|
67
|
+
* controller and is never dialled, so it carries no URL.
|
|
68
|
+
*/
|
|
69
|
+
export interface IGateway {
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
/** The location the gateway stands in (`data.ILocation`); every gateway stands in one. */
|
|
73
|
+
locationId: string;
|
|
74
|
+
forwardSourceAddresses: string[];
|
|
75
|
+
connection:
|
|
76
|
+
| { kind: 'legacy'; url: string; gatewayClientId: string }
|
|
77
|
+
| {
|
|
78
|
+
kind: 'adopted';
|
|
79
|
+
/** Unix milliseconds on the controller's clock. */
|
|
80
|
+
adoptedAt: number;
|
|
81
|
+
/** The machine identity the gateway authenticates as. */
|
|
82
|
+
machineUserId: string;
|
|
83
|
+
/** Raised by every re-adoption; the previous generation is dead from then on. */
|
|
84
|
+
credentialGeneration: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** What a gateway states about itself when it is adopted (`adoptGateway`). */
|
|
89
|
+
export interface IGatewayAdoptionFacts {
|
|
90
|
+
/** The dcrouter release the gateway runs (`data.isReleaseVersion`). */
|
|
91
|
+
dcrouterVersion: string;
|
|
92
|
+
/** The release of this package the gateway speaks (`data.isReleaseVersion`). */
|
|
93
|
+
interfacesVersion: string;
|
|
94
|
+
/** The host name of the gateway's machine: dot-separated RFC 1123 labels. */
|
|
95
|
+
hostname: string;
|
|
96
|
+
/** Canonical IPv4 or IPv6 addresses, each at most once. */
|
|
97
|
+
publicIps: string[];
|
|
98
|
+
/** Canonical IPv4 or IPv6 addresses, each at most once. */
|
|
99
|
+
proxyIps: string[];
|
|
100
|
+
/** Canonical IPv4 or IPv6 addresses, each at most once. */
|
|
101
|
+
forwardSourceAddresses: string[];
|
|
102
|
+
/**
|
|
103
|
+
* The areas this gateway can take from a controller, as a canonical token list (sorted by
|
|
104
|
+
* `compareWireTokens`, each once). A controller never pushes an area the gateway does not name.
|
|
105
|
+
*/
|
|
106
|
+
controllerAreas: TGatewayConfigArea[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** One whole area table of a desired state. */
|
|
110
|
+
export interface IGatewayAreaTable {
|
|
111
|
+
area: TGatewayConfigArea;
|
|
112
|
+
/** `computeGatewayAreaTableDigest(area, content)`. */
|
|
113
|
+
digest: TSha256Digest;
|
|
114
|
+
/**
|
|
115
|
+
* The whole table, strict canonical JSON. Untyped in this contract: each area's content type and
|
|
116
|
+
* validator ship with the release that moves that area to the controller.
|
|
117
|
+
*/
|
|
118
|
+
content: unknown;
|
|
119
|
+
/**
|
|
120
|
+
* Set on the push that moves the area from the gateway to the controller: the digest
|
|
121
|
+
* `exportGatewayArea` answered. The gateway applies it only while its local table still has that
|
|
122
|
+
* digest and refuses `local-changed-since-export` otherwise. `null` on every other push.
|
|
123
|
+
*/
|
|
124
|
+
takeover: { localDigest: TSha256Digest } | null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The whole desired state a controller pushes to one gateway (`applyDesiredState`).
|
|
129
|
+
*
|
|
130
|
+
* Documents are ordered by `(epoch, revision)` (`data.compareControllerRevisionOrder`): a newer one
|
|
131
|
+
* is applied, an equal one is an idempotent replay answered with the stored report, and an older
|
|
132
|
+
* one is refused `stale`.
|
|
133
|
+
*/
|
|
134
|
+
export interface IGatewayDesiredState {
|
|
135
|
+
gatewayId: string;
|
|
136
|
+
controllerId: string;
|
|
137
|
+
epoch: number;
|
|
138
|
+
revision: number;
|
|
139
|
+
/** One table per controller-owned area, each area at most once. */
|
|
140
|
+
areas: IGatewayAreaTable[];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Every reason a gateway refuses an area of a desired state. Each is reported per area in
|
|
145
|
+
* `IGatewayAreaApplyState.refusal`.
|
|
146
|
+
*/
|
|
147
|
+
export const gatewayApplyRefusals = Object.freeze([
|
|
148
|
+
/** The document is older than the one the gateway applied, by `(epoch, revision)`. */
|
|
149
|
+
'stale',
|
|
150
|
+
/** The document comes from another controller than the one that adopted the gateway. */
|
|
151
|
+
'controller-mismatch',
|
|
152
|
+
/** A table failed validation; a gateway validates every table first and then applies none. */
|
|
153
|
+
'invalid-table',
|
|
154
|
+
/** The document carries an area the gateway does not take from a controller (`controllerAreas`). */
|
|
155
|
+
'unsupported-area',
|
|
156
|
+
/** A takeover's `localDigest` is no longer the digest of the gateway's local table. */
|
|
157
|
+
'local-changed-since-export',
|
|
158
|
+
/** Applying a valid table failed; this area and every later one keep their previous tables. */
|
|
159
|
+
'apply-failed',
|
|
160
|
+
] as const);
|
|
161
|
+
|
|
162
|
+
/** One of the reasons a gateway refuses an area of a desired state. */
|
|
163
|
+
export type TGatewayApplyRefusal = typeof gatewayApplyRefusals[number];
|
|
164
|
+
|
|
165
|
+
/** True for one of `gatewayApplyRefusals`. */
|
|
166
|
+
export const isGatewayApplyRefusal = (valueArg: unknown): valueArg is TGatewayApplyRefusal => (
|
|
167
|
+
(gatewayApplyRefusals as readonly unknown[]).includes(valueArg)
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
/** Where one area of one gateway stands after the last desired state it received. */
|
|
171
|
+
export interface IGatewayAreaApplyState {
|
|
172
|
+
area: TGatewayConfigArea;
|
|
173
|
+
/** Who writes the area on this gateway. It moves to `controller` once and never back. */
|
|
174
|
+
owner: 'gateway' | 'controller';
|
|
175
|
+
/** The digest of the table the gateway serves for the area; `null` while it serves none. */
|
|
176
|
+
digest: TSha256Digest | null;
|
|
177
|
+
/** The controller revision of that table; `null` for a table no controller pushed. */
|
|
178
|
+
revision: number | null;
|
|
179
|
+
/**
|
|
180
|
+
* `applied` with no refusal; `rejected` with the refusal; `not-attempted` for an area a gateway
|
|
181
|
+
* did not reach because an earlier area of the same document was refused.
|
|
182
|
+
*/
|
|
183
|
+
state: 'applied' | 'rejected' | 'not-attempted';
|
|
184
|
+
refusal: { reason: TGatewayApplyRefusal; detail: string } | null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** What a gateway applied, as `applyDesiredState` answers and the status document carries it. */
|
|
188
|
+
export interface IGatewayApplyReport {
|
|
189
|
+
/** The epoch of the last document applied whole; `null` before the first. */
|
|
190
|
+
epoch: number | null;
|
|
191
|
+
/**
|
|
192
|
+
* The revision of the last document applied whole; `null` before the first. It advances only
|
|
193
|
+
* when every area of a document is applied, so a gateway applied revision N exactly when this is
|
|
194
|
+
* at least N.
|
|
195
|
+
*/
|
|
196
|
+
appliedRevision: number | null;
|
|
197
|
+
/** Each area at most once. */
|
|
198
|
+
areas: IGatewayAreaApplyState[];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* An inclusive range of ports a gateway listens on, as a route's `match.ports` states it
|
|
203
|
+
* (SmartProxy's `{ from, to }`); one port is `{ from: port, to: port }`.
|
|
204
|
+
*/
|
|
205
|
+
export interface IGatewayPortRange {
|
|
206
|
+
/** 1 to 65535. */
|
|
207
|
+
from: number;
|
|
208
|
+
/** `from` to 65535. */
|
|
209
|
+
to: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Every port a gateway listens on, per socket transport; each list in the canonical range form:
|
|
214
|
+
* sorted by `from`, and each range starts at least two ports after the previous one ends, so ranges
|
|
215
|
+
* neither overlap nor touch (a gateway merges `{ 80, 80 }` and `{ 81, 81 }` into `{ 80, 81 }`), at
|
|
216
|
+
* most `gatewayConnectorContract.maximumListeningPortRanges` ranges per transport.
|
|
217
|
+
*
|
|
218
|
+
* A gateway reports every public socket it has open, not only its SmartProxy routes. dcrouter
|
|
219
|
+
* derives a route's transports as its inbound proxy listener keys do: `match.transport` `udp` is
|
|
220
|
+
* udp, `all` is both, `tcp` or absent is tcp. QUIC and HTTP/3 count under udp. Each transport is
|
|
221
|
+
* merged on its own, never across transports, so one port may appear in both lists.
|
|
222
|
+
*/
|
|
223
|
+
export interface IGatewayListeningPorts {
|
|
224
|
+
tcp: IGatewayPortRange[];
|
|
225
|
+
udp: IGatewayPortRange[];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Everything a gateway reports about itself, in one document (`pushGatewayStatus`). It is also
|
|
230
|
+
* what the gateway's own status page and CLI read.
|
|
231
|
+
*/
|
|
232
|
+
export interface IGatewayStatusDocument {
|
|
233
|
+
gatewayId: string;
|
|
234
|
+
/** `data.isReleaseVersion`. */
|
|
235
|
+
dcrouterVersion: string;
|
|
236
|
+
/** `data.isReleaseVersion`. */
|
|
237
|
+
interfacesVersion: string;
|
|
238
|
+
/** The controller the gateway stored. */
|
|
239
|
+
controller: IControllerPeerSet;
|
|
240
|
+
/** Unix milliseconds since the current controller connection; `null` while disconnected. */
|
|
241
|
+
connectedSince: number | null;
|
|
242
|
+
applied: IGatewayApplyReport;
|
|
243
|
+
/** Unix milliseconds of the last whole apply; `null` before the first. */
|
|
244
|
+
appliedAt: number | null;
|
|
245
|
+
publicIps: string[];
|
|
246
|
+
proxyIps: string[];
|
|
247
|
+
forwardSourceAddresses: string[];
|
|
248
|
+
/** Every port the gateway listens on, per transport (`IGatewayListeningPorts`). */
|
|
249
|
+
listeningPorts: IGatewayListeningPorts;
|
|
250
|
+
storage: { backend: string; path: string | null };
|
|
251
|
+
/** Each zone at most once. */
|
|
252
|
+
dnsZones: { zone: string; recordsServed: number }[];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* The hello a gateway sends after `registerCloudlyClientSession` on its socket. The gateway is the
|
|
257
|
+
* one the verified machine identity names and is never a field here.
|
|
258
|
+
*/
|
|
259
|
+
export interface IRegisterGatewaySessionRequest {
|
|
260
|
+
/**
|
|
261
|
+
* Counts up once per attempt within one gateway process and restarts at 0 with the process; a
|
|
262
|
+
* controller refuses one that does not advance.
|
|
263
|
+
*/
|
|
264
|
+
registrationSequence: number;
|
|
265
|
+
/** `data.isReleaseVersion`. */
|
|
266
|
+
dcrouterVersion: string;
|
|
267
|
+
/** `data.isReleaseVersion`. */
|
|
268
|
+
interfacesVersion: string;
|
|
269
|
+
/** As in `IGatewayAdoptionFacts.controllerAreas`. */
|
|
270
|
+
controllerAreas: TGatewayConfigArea[];
|
|
271
|
+
/** The controller and epoch the gateway stored; `null` when it stored none. */
|
|
272
|
+
known: { controllerId: string; epoch: number } | null;
|
|
273
|
+
applied: IGatewayApplyReport;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** One area table as the gateway holds it locally, as `exportGatewayArea` answers it. */
|
|
277
|
+
export interface IGatewayAreaExport {
|
|
278
|
+
area: TGatewayConfigArea;
|
|
279
|
+
/** `computeGatewayAreaTableDigest(area, content)`. */
|
|
280
|
+
digest: TSha256Digest;
|
|
281
|
+
content: unknown;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const failAreaTable = (reasonArg: string): never => {
|
|
285
|
+
throw new Error(`Gateway area table digest input rejected: ${reasonArg}.`);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The canonical JSON an area table digest hashes: the digest domain, the area and the whole
|
|
290
|
+
* content. Throws for an unknown area and for content that is not strict canonical JSON (safe
|
|
291
|
+
* integers only, no `undefined`, no cycle, no accessor).
|
|
292
|
+
*/
|
|
293
|
+
export const createGatewayAreaTableDigestInput = (areaArg: TGatewayConfigArea, contentArg: unknown): string => {
|
|
294
|
+
if (!isGatewayConfigArea(areaArg)) {
|
|
295
|
+
failAreaTable('unknown area');
|
|
296
|
+
}
|
|
297
|
+
return canonicalizeStrictJson({
|
|
298
|
+
domain: gatewayConnectorContract.areaTableDigestDomain,
|
|
299
|
+
area: areaArg,
|
|
300
|
+
content: contentArg,
|
|
301
|
+
}, failAreaTable, 'gateway area table');
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* `sha256:<hex>` of `createGatewayAreaTableDigestInput`, through Web Crypto. The controller and the
|
|
306
|
+
* gateway digest a table with this one function, so an exported local table and the controller's
|
|
307
|
+
* compiled table of the same content have the same digest.
|
|
308
|
+
*/
|
|
309
|
+
export const computeGatewayAreaTableDigest = async (
|
|
310
|
+
areaArg: TGatewayConfigArea,
|
|
311
|
+
contentArg: unknown,
|
|
312
|
+
): Promise<TSha256Digest> => `sha256:${await createCanonicalJsonSha256Hex(
|
|
313
|
+
createGatewayAreaTableDigestInput(areaArg, contentArg), failAreaTable,
|
|
314
|
+
)}`;
|
|
315
|
+
|
|
316
|
+
const adoptionFactsKeyList = [
|
|
317
|
+
'dcrouterVersion', 'interfacesVersion', 'hostname', 'publicIps', 'proxyIps', 'forwardSourceAddresses',
|
|
318
|
+
'controllerAreas',
|
|
319
|
+
] as const;
|
|
320
|
+
const adoptionFactsKeys: TCompleteKeyList<IGatewayAdoptionFacts, typeof adoptionFactsKeyList> = adoptionFactsKeyList;
|
|
321
|
+
const areaTableKeyList = ['area', 'digest', 'content', 'takeover'] as const;
|
|
322
|
+
const areaTableKeys: TCompleteKeyList<IGatewayAreaTable, typeof areaTableKeyList> = areaTableKeyList;
|
|
323
|
+
const desiredStateKeyList = ['gatewayId', 'controllerId', 'epoch', 'revision', 'areas'] as const;
|
|
324
|
+
const desiredStateKeys: TCompleteKeyList<IGatewayDesiredState, typeof desiredStateKeyList> = desiredStateKeyList;
|
|
325
|
+
const areaApplyStateKeyList = ['area', 'owner', 'digest', 'revision', 'state', 'refusal'] as const;
|
|
326
|
+
const areaApplyStateKeys: TCompleteKeyList<IGatewayAreaApplyState, typeof areaApplyStateKeyList> =
|
|
327
|
+
areaApplyStateKeyList;
|
|
328
|
+
const applyReportKeyList = ['epoch', 'appliedRevision', 'areas'] as const;
|
|
329
|
+
const applyReportKeys: TCompleteKeyList<IGatewayApplyReport, typeof applyReportKeyList> = applyReportKeyList;
|
|
330
|
+
const statusDocumentKeyList = [
|
|
331
|
+
'gatewayId', 'dcrouterVersion', 'interfacesVersion', 'controller', 'connectedSince', 'applied', 'appliedAt',
|
|
332
|
+
'publicIps', 'proxyIps', 'forwardSourceAddresses', 'listeningPorts', 'storage', 'dnsZones',
|
|
333
|
+
] as const;
|
|
334
|
+
const statusDocumentKeys: TCompleteKeyList<IGatewayStatusDocument, typeof statusDocumentKeyList> =
|
|
335
|
+
statusDocumentKeyList;
|
|
336
|
+
const registerSessionKeyList = [
|
|
337
|
+
'registrationSequence', 'dcrouterVersion', 'interfacesVersion', 'controllerAreas', 'known', 'applied',
|
|
338
|
+
] as const;
|
|
339
|
+
const registerSessionKeys: TCompleteKeyList<IRegisterGatewaySessionRequest, typeof registerSessionKeyList> =
|
|
340
|
+
registerSessionKeyList;
|
|
341
|
+
const areaExportKeyList = ['area', 'digest', 'content'] as const;
|
|
342
|
+
const areaExportKeys: TCompleteKeyList<IGatewayAreaExport, typeof areaExportKeyList> = areaExportKeyList;
|
|
343
|
+
|
|
344
|
+
const areaOwners: readonly IGatewayAreaApplyState['owner'][] = ['controller', 'gateway'];
|
|
345
|
+
const areaApplyStates: readonly IGatewayAreaApplyState['state'][] = ['applied', 'rejected', 'not-attempted'];
|
|
346
|
+
const hostnameLabel = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?$/;
|
|
347
|
+
const dnsZoneLabel = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
348
|
+
|
|
349
|
+
const validateArea = (valueArg: unknown, pathArg: string): string[] => (
|
|
350
|
+
isGatewayConfigArea(valueArg) ? [] : [`${pathArg} must be one of ${gatewayConfigAreaApplyOrder.join(', ')}`]
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
const validateDigest = (valueArg: unknown, pathArg: string): string[] => {
|
|
354
|
+
try {
|
|
355
|
+
networkDigest(valueArg);
|
|
356
|
+
return [];
|
|
357
|
+
} catch {
|
|
358
|
+
return [`${pathArg} must be sha256: followed by 64 lowercase hex digits`];
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
const validateNullable = (
|
|
363
|
+
valueArg: unknown,
|
|
364
|
+
pathArg: string,
|
|
365
|
+
validateArg: (valueArg: unknown, pathArg: string) => string[],
|
|
366
|
+
): string[] => (valueArg === null ? [] : validateArg(valueArg, pathArg));
|
|
367
|
+
|
|
368
|
+
const validateVersion = (valueArg: unknown, pathArg: string): string[] => (
|
|
369
|
+
isReleaseVersion(valueArg) ? [] : [`${pathArg} must be a release version such as 1.2.3`]
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
const validateBoundedString = (valueArg: unknown, pathArg: string, maximumLengthArg: number): string[] => (
|
|
373
|
+
typeof valueArg === 'string' && valueArg.length > 0 && valueArg.length <= maximumLengthArg
|
|
374
|
+
? []
|
|
375
|
+
: [`${pathArg} must be a string of 1 to ${maximumLengthArg} characters`]
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
const validateControllerAreas = (valueArg: unknown, pathArg: string): string[] => (
|
|
379
|
+
isCanonicalTokenList(valueArg, gatewayConfigAreaApplyOrder)
|
|
380
|
+
? []
|
|
381
|
+
: [`${pathArg} must list areas of ${gatewayConfigAreaApplyOrder.join(', ')} sorted, each once`]
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
const validateAddresses = (valueArg: unknown, pathArg: string): string[] => {
|
|
385
|
+
const addresses = readDataElements(valueArg, gatewayConnectorContract.maximumAddresses);
|
|
386
|
+
if (addresses === null) {
|
|
387
|
+
return [`${pathArg} must be a dense list of at most ${gatewayConnectorContract.maximumAddresses} addresses`];
|
|
388
|
+
}
|
|
389
|
+
const errors = addresses.flatMap((addressArg, indexArg) => (
|
|
390
|
+
parseCanonicalIpAddress(addressArg) === null
|
|
391
|
+
? [`${pathArg}[${indexArg}] must be a canonical IPv4 or IPv6 address`]
|
|
392
|
+
: []
|
|
393
|
+
));
|
|
394
|
+
if (new Set(addresses).size !== addresses.length) {
|
|
395
|
+
errors.push(`${pathArg} must name each address once`);
|
|
396
|
+
}
|
|
397
|
+
return errors;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* A dense, bounded list whose every entry is validated and whose entries name each value of
|
|
402
|
+
* `keyArg` at most once. An entry that does not carry the key as data is refused by its own
|
|
403
|
+
* validator and left out of the repetition check.
|
|
404
|
+
*/
|
|
405
|
+
const validateKeyedList = (
|
|
406
|
+
valueArg: unknown,
|
|
407
|
+
pathArg: string,
|
|
408
|
+
maximumLengthArg: number,
|
|
409
|
+
keyArg: string,
|
|
410
|
+
validateEntryArg: (valueArg: unknown, pathArg: string) => string[],
|
|
411
|
+
): string[] => {
|
|
412
|
+
const entries = readDataElements(valueArg, maximumLengthArg);
|
|
413
|
+
if (entries === null) {
|
|
414
|
+
return [`${pathArg} must be a dense list of at most ${maximumLengthArg} entries`];
|
|
415
|
+
}
|
|
416
|
+
const errors = entries.flatMap((entryArg, indexArg) => validateEntryArg(entryArg, `${pathArg}[${indexArg}]`));
|
|
417
|
+
const keys = entries.flatMap((entryArg) => {
|
|
418
|
+
const property = readDataProperty(entryArg, keyArg);
|
|
419
|
+
return property === null ? [] : [property.value];
|
|
420
|
+
});
|
|
421
|
+
if (new Set(keys).size !== keys.length) {
|
|
422
|
+
errors.push(`${pathArg} must name each ${keyArg} once`);
|
|
423
|
+
}
|
|
424
|
+
return errors;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
const validateStrictJson = (valueArg: unknown, pathArg: string): string[] => {
|
|
428
|
+
try {
|
|
429
|
+
canonicalizeStrictJson(valueArg, failAreaTable, pathArg);
|
|
430
|
+
return [];
|
|
431
|
+
} catch {
|
|
432
|
+
return [`${pathArg} must be strict canonical JSON: safe integers only, no undefined, cycle or accessor`];
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
const validateAreaTable = (valueArg: unknown, pathArg: string): string[] => {
|
|
437
|
+
const record = readExactDataRecord(valueArg, areaTableKeys);
|
|
438
|
+
if (record === null) {
|
|
439
|
+
return [`${pathArg} must use its exact schema`];
|
|
440
|
+
}
|
|
441
|
+
const errors = [
|
|
442
|
+
...validateArea(record.area, `${pathArg} area`),
|
|
443
|
+
...validateDigest(record.digest, `${pathArg} digest`),
|
|
444
|
+
...validateStrictJson(record.content, `${pathArg} content`),
|
|
445
|
+
];
|
|
446
|
+
if (record.takeover !== null) {
|
|
447
|
+
const takeover = readExactDataRecord(record.takeover, ['localDigest']);
|
|
448
|
+
errors.push(...(takeover === null
|
|
449
|
+
? [`${pathArg} takeover must be null or use its exact schema`]
|
|
450
|
+
: validateDigest(takeover.localDigest, `${pathArg} takeover localDigest`)));
|
|
451
|
+
}
|
|
452
|
+
return errors;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Validates one desired state and names every reason it is refused.
|
|
457
|
+
*
|
|
458
|
+
* The envelope only: every table's digest has the digest form and its content is strict canonical
|
|
459
|
+
* JSON, but whether the digest is `computeGatewayAreaTableDigest` of the content, what the content
|
|
460
|
+
* of an area must hold, and how the document orders against the one applied are the gateway's to
|
|
461
|
+
* judge (`invalid-table`, `stale`).
|
|
462
|
+
*/
|
|
463
|
+
export const validateGatewayDesiredState = (
|
|
464
|
+
valueArg: unknown,
|
|
465
|
+
pathArg = 'gateway desired state',
|
|
466
|
+
): string[] => {
|
|
467
|
+
const record = readExactDataRecord(valueArg, desiredStateKeys);
|
|
468
|
+
if (record === null) {
|
|
469
|
+
return [`${pathArg} must use its exact schema`];
|
|
470
|
+
}
|
|
471
|
+
return [
|
|
472
|
+
...validateControllerIdentifier(record.gatewayId, `${pathArg} gatewayId`),
|
|
473
|
+
...validateControllerIdentifier(record.controllerId, `${pathArg} controllerId`),
|
|
474
|
+
...validateControllerCounter(record.epoch, `${pathArg} epoch`),
|
|
475
|
+
...validateControllerCounter(record.revision, `${pathArg} revision`),
|
|
476
|
+
...validateKeyedList(record.areas, `${pathArg} areas`, gatewayConfigAreaApplyOrder.length, 'area',
|
|
477
|
+
validateAreaTable),
|
|
478
|
+
];
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const validateAreaApplyState = (valueArg: unknown, pathArg: string): string[] => {
|
|
482
|
+
const record = readExactDataRecord(valueArg, areaApplyStateKeys);
|
|
483
|
+
if (record === null) {
|
|
484
|
+
return [`${pathArg} must use its exact schema`];
|
|
485
|
+
}
|
|
486
|
+
const errors = [
|
|
487
|
+
...validateArea(record.area, `${pathArg} area`),
|
|
488
|
+
...(areaOwners.some((ownerArg) => ownerArg === record.owner)
|
|
489
|
+
? []
|
|
490
|
+
: [`${pathArg} owner must be one of ${areaOwners.join(', ')}`]),
|
|
491
|
+
...validateNullable(record.digest, `${pathArg} digest`, validateDigest),
|
|
492
|
+
...validateNullable(record.revision, `${pathArg} revision`, validateControllerCounter),
|
|
493
|
+
];
|
|
494
|
+
if (!areaApplyStates.some((stateArg) => stateArg === record.state)) {
|
|
495
|
+
errors.push(`${pathArg} state must be one of ${areaApplyStates.join(', ')}`);
|
|
496
|
+
}
|
|
497
|
+
if (record.refusal === null) {
|
|
498
|
+
if (record.state === 'rejected') {
|
|
499
|
+
errors.push(`${pathArg} refusal must name why a rejected area was refused`);
|
|
500
|
+
}
|
|
501
|
+
return errors;
|
|
502
|
+
}
|
|
503
|
+
if (record.state === 'applied') {
|
|
504
|
+
errors.push(`${pathArg} refusal must be null for an applied area`);
|
|
505
|
+
}
|
|
506
|
+
const refusal = readExactDataRecord(record.refusal, ['reason', 'detail']);
|
|
507
|
+
if (refusal === null) {
|
|
508
|
+
errors.push(`${pathArg} refusal must be null or use its exact schema`);
|
|
509
|
+
return errors;
|
|
510
|
+
}
|
|
511
|
+
if (!isGatewayApplyRefusal(refusal.reason)) {
|
|
512
|
+
errors.push(`${pathArg} refusal reason must be one of ${gatewayApplyRefusals.join(', ')}`);
|
|
513
|
+
}
|
|
514
|
+
errors.push(...validateBoundedString(refusal.detail, `${pathArg} refusal detail`,
|
|
515
|
+
gatewayConnectorContract.maximumRefusalDetailLength));
|
|
516
|
+
return errors;
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
/** Validates one apply report and names every reason it is refused. */
|
|
520
|
+
export const validateGatewayApplyReport = (
|
|
521
|
+
valueArg: unknown,
|
|
522
|
+
pathArg = 'gateway apply report',
|
|
523
|
+
): string[] => {
|
|
524
|
+
const record = readExactDataRecord(valueArg, applyReportKeys);
|
|
525
|
+
if (record === null) {
|
|
526
|
+
return [`${pathArg} must use its exact schema`];
|
|
527
|
+
}
|
|
528
|
+
return [
|
|
529
|
+
...validateNullable(record.epoch, `${pathArg} epoch`, validateControllerCounter),
|
|
530
|
+
...validateNullable(record.appliedRevision, `${pathArg} appliedRevision`, validateControllerCounter),
|
|
531
|
+
...validateKeyedList(record.areas, `${pathArg} areas`, gatewayConfigAreaApplyOrder.length, 'area',
|
|
532
|
+
validateAreaApplyState),
|
|
533
|
+
];
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
/** Validates the facts a gateway states at adoption and names every reason they are refused. */
|
|
537
|
+
export const validateGatewayAdoptionFacts = (
|
|
538
|
+
valueArg: unknown,
|
|
539
|
+
pathArg = 'gateway adoption facts',
|
|
540
|
+
): string[] => {
|
|
541
|
+
const record = readExactDataRecord(valueArg, adoptionFactsKeys);
|
|
542
|
+
if (record === null) {
|
|
543
|
+
return [`${pathArg} must use its exact schema`];
|
|
544
|
+
}
|
|
545
|
+
const hostname = record.hostname;
|
|
546
|
+
return [
|
|
547
|
+
...validateVersion(record.dcrouterVersion, `${pathArg} dcrouterVersion`),
|
|
548
|
+
...validateVersion(record.interfacesVersion, `${pathArg} interfacesVersion`),
|
|
549
|
+
...(typeof hostname === 'string'
|
|
550
|
+
&& hostname.length <= gatewayConnectorContract.maximumHostnameLength
|
|
551
|
+
&& hostname.split('.').every((labelArg) => hostnameLabel.test(labelArg))
|
|
552
|
+
? []
|
|
553
|
+
: [`${pathArg} hostname must be at most ${gatewayConnectorContract.maximumHostnameLength} characters `
|
|
554
|
+
+ 'of dot-separated RFC 1123 labels']),
|
|
555
|
+
...validateAddresses(record.publicIps, `${pathArg} publicIps`),
|
|
556
|
+
...validateAddresses(record.proxyIps, `${pathArg} proxyIps`),
|
|
557
|
+
...validateAddresses(record.forwardSourceAddresses, `${pathArg} forwardSourceAddresses`),
|
|
558
|
+
...validateControllerAreas(record.controllerAreas, `${pathArg} controllerAreas`),
|
|
559
|
+
];
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
/** The range as data, or the reason it is refused. */
|
|
563
|
+
const readPortRange = (valueArg: unknown, pathArg: string): IGatewayPortRange | string => {
|
|
564
|
+
const record = readExactDataRecord(valueArg, ['from', 'to']);
|
|
565
|
+
if (record === null) {
|
|
566
|
+
return `${pathArg} must use its exact schema`;
|
|
567
|
+
}
|
|
568
|
+
const { from, to } = record;
|
|
569
|
+
return typeof from === 'number' && typeof to === 'number' && Number.isSafeInteger(from)
|
|
570
|
+
&& Number.isSafeInteger(to) && from >= 1 && from <= to && to <= 65535
|
|
571
|
+
? { from, to }
|
|
572
|
+
: `${pathArg} must be integers with 1 <= from <= to <= 65535`;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
const validateListeningPorts = (valueArg: unknown, pathArg: string): string[] => {
|
|
576
|
+
const maximum = gatewayConnectorContract.maximumListeningPortRanges;
|
|
577
|
+
const elements = readDataElements(valueArg, maximum);
|
|
578
|
+
if (elements === null) {
|
|
579
|
+
return [`${pathArg} must be a dense list of at most ${maximum} port ranges`];
|
|
580
|
+
}
|
|
581
|
+
const ranges = elements.map((elementArg, indexArg) => readPortRange(elementArg, `${pathArg}[${indexArg}]`));
|
|
582
|
+
const errors = ranges.filter((rangeArg): rangeArg is string => typeof rangeArg === 'string');
|
|
583
|
+
if (errors.length > 0) {
|
|
584
|
+
return errors;
|
|
585
|
+
}
|
|
586
|
+
const valid = ranges.filter((rangeArg): rangeArg is IGatewayPortRange => typeof rangeArg !== 'string');
|
|
587
|
+
for (let index = 1; index < valid.length; index++) {
|
|
588
|
+
if (valid[index].from <= valid[index - 1].to + 1) {
|
|
589
|
+
errors.push(`${pathArg}[${index}] must start at least two ports after ${pathArg}[${index - 1}] ends `
|
|
590
|
+
+ '(sorted by from, overlapping and touching ranges merged)');
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return errors;
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
const validateListeningPortsPerTransport = (valueArg: unknown, pathArg: string): string[] => {
|
|
597
|
+
const record = readExactDataRecord(valueArg, ['tcp', 'udp']);
|
|
598
|
+
if (record === null) {
|
|
599
|
+
return [`${pathArg} must use its exact schema`];
|
|
600
|
+
}
|
|
601
|
+
return [
|
|
602
|
+
...validateListeningPorts(record.tcp, `${pathArg}.tcp`),
|
|
603
|
+
...validateListeningPorts(record.udp, `${pathArg}.udp`),
|
|
604
|
+
];
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
const validateDnsZone = (valueArg: unknown, pathArg: string): string[] => {
|
|
608
|
+
const record = readExactDataRecord(valueArg, ['zone', 'recordsServed']);
|
|
609
|
+
if (record === null) {
|
|
610
|
+
return [`${pathArg} must use its exact schema`];
|
|
611
|
+
}
|
|
612
|
+
const zone = record.zone;
|
|
613
|
+
return [
|
|
614
|
+
...(typeof zone === 'string'
|
|
615
|
+
&& zone.length <= gatewayConnectorContract.maximumHostnameLength
|
|
616
|
+
&& zone.split('.').every((labelArg) => dnsZoneLabel.test(labelArg))
|
|
617
|
+
? []
|
|
618
|
+
: [`${pathArg} zone must be at most ${gatewayConnectorContract.maximumHostnameLength} characters `
|
|
619
|
+
+ 'of dot-separated lowercase RFC 1123 labels']),
|
|
620
|
+
...validateControllerNonNegativeInteger(record.recordsServed, `${pathArg} recordsServed`),
|
|
621
|
+
];
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Validates one status document and names every reason it is refused. A controller stores a
|
|
626
|
+
* status document only when this returns no errors.
|
|
627
|
+
*/
|
|
628
|
+
export const validateGatewayStatusDocument = (
|
|
629
|
+
valueArg: unknown,
|
|
630
|
+
pathArg = 'gateway status document',
|
|
631
|
+
): string[] => {
|
|
632
|
+
const record = readExactDataRecord(valueArg, statusDocumentKeys);
|
|
633
|
+
if (record === null) {
|
|
634
|
+
return [`${pathArg} must use its exact schema`];
|
|
635
|
+
}
|
|
636
|
+
const errors = [
|
|
637
|
+
...validateControllerIdentifier(record.gatewayId, `${pathArg} gatewayId`),
|
|
638
|
+
...validateVersion(record.dcrouterVersion, `${pathArg} dcrouterVersion`),
|
|
639
|
+
...validateVersion(record.interfacesVersion, `${pathArg} interfacesVersion`),
|
|
640
|
+
...validateControllerPeerSet(record.controller, `${pathArg} controller`),
|
|
641
|
+
...validateNullable(record.connectedSince, `${pathArg} connectedSince`, validateControllerNonNegativeInteger),
|
|
642
|
+
...validateGatewayApplyReport(record.applied, `${pathArg} applied`),
|
|
643
|
+
...validateNullable(record.appliedAt, `${pathArg} appliedAt`, validateControllerNonNegativeInteger),
|
|
644
|
+
...validateAddresses(record.publicIps, `${pathArg} publicIps`),
|
|
645
|
+
...validateAddresses(record.proxyIps, `${pathArg} proxyIps`),
|
|
646
|
+
...validateAddresses(record.forwardSourceAddresses, `${pathArg} forwardSourceAddresses`),
|
|
647
|
+
...validateListeningPortsPerTransport(record.listeningPorts, `${pathArg} listeningPorts`),
|
|
648
|
+
...validateKeyedList(record.dnsZones, `${pathArg} dnsZones`, gatewayConnectorContract.maximumDnsZones,
|
|
649
|
+
'zone', validateDnsZone),
|
|
650
|
+
];
|
|
651
|
+
const storage = readExactDataRecord(record.storage, ['backend', 'path']);
|
|
652
|
+
if (storage === null) {
|
|
653
|
+
errors.push(`${pathArg} storage must use its exact schema`);
|
|
654
|
+
return errors;
|
|
655
|
+
}
|
|
656
|
+
errors.push(...validateBoundedString(storage.backend, `${pathArg} storage backend`,
|
|
657
|
+
gatewayConnectorContract.maximumStorageBackendLength));
|
|
658
|
+
errors.push(...validateNullable(storage.path, `${pathArg} storage path`, (pathValueArg, fieldArg) => (
|
|
659
|
+
validateBoundedString(pathValueArg, fieldArg, gatewayConnectorContract.maximumStoragePathLength)
|
|
660
|
+
)));
|
|
661
|
+
return errors;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Validates one gateway session hello and names every reason it is refused.
|
|
666
|
+
*
|
|
667
|
+
* Shape only: whether the sequence advances, and whether `known` names this controller at an
|
|
668
|
+
* epoch it may hold, is the controller's to decide against the session it holds.
|
|
669
|
+
*/
|
|
670
|
+
export const validateRegisterGatewaySessionRequest = (
|
|
671
|
+
valueArg: unknown,
|
|
672
|
+
pathArg = 'gateway session registration',
|
|
673
|
+
): string[] => {
|
|
674
|
+
const record = readExactDataRecord(valueArg, registerSessionKeys);
|
|
675
|
+
if (record === null) {
|
|
676
|
+
return [`${pathArg} must use its exact schema`];
|
|
677
|
+
}
|
|
678
|
+
const errors = [
|
|
679
|
+
...validateControllerNonNegativeInteger(record.registrationSequence, `${pathArg} registrationSequence`),
|
|
680
|
+
...validateVersion(record.dcrouterVersion, `${pathArg} dcrouterVersion`),
|
|
681
|
+
...validateVersion(record.interfacesVersion, `${pathArg} interfacesVersion`),
|
|
682
|
+
...validateControllerAreas(record.controllerAreas, `${pathArg} controllerAreas`),
|
|
683
|
+
...validateGatewayApplyReport(record.applied, `${pathArg} applied`),
|
|
684
|
+
];
|
|
685
|
+
if (record.known !== null) {
|
|
686
|
+
const known = readExactDataRecord(record.known, ['controllerId', 'epoch']);
|
|
687
|
+
errors.push(...(known === null
|
|
688
|
+
? [`${pathArg} known must be null or use its exact schema`]
|
|
689
|
+
: [
|
|
690
|
+
...validateControllerIdentifier(known.controllerId, `${pathArg} known controllerId`),
|
|
691
|
+
...validateControllerCounter(known.epoch, `${pathArg} known epoch`),
|
|
692
|
+
]));
|
|
693
|
+
}
|
|
694
|
+
return errors;
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Validates one exported area table and names every reason it is refused. Whether the digest is
|
|
699
|
+
* `computeGatewayAreaTableDigest` of the content is the controller's to check.
|
|
700
|
+
*/
|
|
701
|
+
export const validateGatewayAreaExport = (
|
|
702
|
+
valueArg: unknown,
|
|
703
|
+
pathArg = 'gateway area export',
|
|
704
|
+
): string[] => {
|
|
705
|
+
const record = readExactDataRecord(valueArg, areaExportKeys);
|
|
706
|
+
if (record === null) {
|
|
707
|
+
return [`${pathArg} must use its exact schema`];
|
|
708
|
+
}
|
|
709
|
+
return [
|
|
710
|
+
...validateArea(record.area, `${pathArg} area`),
|
|
711
|
+
...validateDigest(record.digest, `${pathArg} digest`),
|
|
712
|
+
...validateStrictJson(record.content, `${pathArg} content`),
|
|
713
|
+
];
|
|
714
|
+
};
|