@inflatable-cookie/longhorn 0.6.0 → 0.7.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/README.md +2 -2
- package/package.json +1 -7
- package/src/agent-control/generated/protocol.ts +228 -0
- package/src/agent-control/index.ts +1 -5
- package/src/agent-control/selection.ts +10 -8
- package/src/agent-control/shim.ts +149 -77
- package/src/bridge/generated/fields.ts +1 -1
- package/src/bridge/generated/protocol.ts +55 -4
- package/src/bridge/generated/variant-fields.ts +1 -1
- package/src/bridge/job.ts +49 -2
- package/src/bridge/runtime/connection.ts +11 -14
- package/src/bridge/stream/connection.ts +14 -23
- package/src/bridge/stream/tracker.ts +5 -0
- package/src/bridge/supervision.ts +102 -80
- package/src/bridge/validation/base.ts +7 -27
- package/src/bridge/validation/negotiation.ts +1 -6
- package/src/bridge/validation/operations.ts +2 -14
- package/src/commands/client.ts +16 -2
- package/src/commands/controller.ts +96 -58
- package/src/commands/generated/fields.ts +4 -4
- package/src/commands/generated/protocol.ts +24 -1
- package/src/commands/generated/variant-fields.ts +1 -1
- package/src/commands/keyboard.ts +4 -13
- package/src/commands/physical-code.ts +11 -0
- package/src/commands/ports.ts +2 -1
- package/src/commands/projectors.ts +52 -29
- package/src/commands/validation.ts +408 -188
- package/src/config/client.ts +3 -3
- package/src/config/generated/base.ts +22 -6
- package/src/config/generated/fields.ts +2 -1
- package/src/config/generated/label-template.ts +1 -1
- package/src/config/generated/labels.ts +1 -1
- package/src/config/generated/protocol.ts +1 -1
- package/src/config/generated/restore.ts +35 -12
- package/src/config/generated/variant-fields.ts +1 -1
- package/src/config/validation/commands.ts +11 -13
- package/src/config/validation/outcomes.ts +147 -46
- package/src/config/validation/primitives.ts +11 -39
- package/src/config/validation/projection.ts +44 -44
- package/src/core/connection.ts +124 -29
- package/src/core/controller-lifecycle.ts +144 -0
- package/src/core/generated/identifiers.ts +4 -0
- package/src/core/identifiers.ts +40 -0
- package/src/core/index.ts +10 -1
- package/src/core/json-value.ts +58 -0
- package/src/core/listeners.ts +35 -0
- package/src/core/record.ts +76 -0
- package/src/core/transport.ts +10 -1
- package/src/core/wire-copy.ts +1 -0
- package/src/history/client.ts +11 -7
- package/src/history/controller.ts +72 -74
- package/src/history/generated/fields.ts +2 -1
- package/src/history/generated/protocol.ts +8 -5
- package/src/history/generated/variant-fields.ts +1 -1
- package/src/history/ports.ts +7 -2
- package/src/history/validation.ts +15 -37
- package/src/history-tree/client.ts +15 -13
- package/src/history-tree/controller.ts +131 -90
- package/src/history-tree/generated/fields.ts +3 -1
- package/src/history-tree/generated/protocol.ts +43 -7
- package/src/history-tree/generated/variant-fields.ts +7 -1
- package/src/history-tree/ports.ts +9 -4
- package/src/history-tree/validation.ts +44 -35
- package/src/layout/generated/protocol.ts +2 -1
- package/src/layout/generated/variant-fields.ts +47 -0
- package/src/layout/index.ts +1 -1
- package/src/layout/ratio.ts +9 -2
- package/src/layout/validation.ts +88 -13
- package/src/licence/client.ts +11 -7
- package/src/licence/controller.ts +64 -43
- package/src/licence/generated/fields.ts +2 -1
- package/src/licence/generated/protocol.ts +8 -4
- package/src/licence/generated/variant-fields.ts +1 -1
- package/src/licence/key.ts +2 -6
- package/src/licence/ports.ts +7 -2
- package/src/licence/validation.ts +27 -20
- package/src/native-content/client.ts +32 -1
- package/src/native-content/generated/fields.ts +4 -4
- package/src/native-content/generated/protocol.ts +16 -5
- package/src/native-content/generated/variant-fields.ts +1 -1
- package/src/native-content/ports.ts +2 -1
- package/src/native-content/validation/base.ts +16 -46
- package/src/native-content/validation/messages.ts +3 -0
- package/src/notifications/client.ts +17 -39
- package/src/notifications/controller.ts +266 -165
- package/src/notifications/generated/fields.ts +2 -1
- package/src/notifications/generated/labels.ts +1 -1
- package/src/notifications/generated/protocol.ts +5 -1
- package/src/notifications/generated/variant-fields.ts +1 -1
- package/src/notifications/ports.ts +2 -1
- package/src/notifications/tone.ts +1 -1
- package/src/notifications/validation.ts +41 -51
- package/src/operation/bridge.ts +79 -19
- package/src/operation/client.ts +17 -45
- package/src/operation/controller.ts +38 -59
- package/src/operation/generated/fields.ts +2 -1
- package/src/operation/generated/labels.ts +1 -1
- package/src/operation/generated/protocol.ts +5 -1
- package/src/operation/generated/variant-fields.ts +1 -1
- package/src/operation/ports.ts +2 -1
- package/src/operation/validation.ts +48 -50
- package/src/settings/connection.ts +10 -14
- package/src/settings/generated/fields.ts +2 -1
- package/src/settings/generated/protocol.ts +5 -1
- package/src/settings/generated/variant-fields.ts +1 -1
- package/src/settings/validation/authority.ts +2 -2
- package/src/settings/validation/command.ts +5 -4
- package/src/settings/validation/primitives.ts +32 -67
- package/src/settings/validation/registry.ts +13 -11
- package/src/surface-transfer/generated/fields.ts +1 -1
- package/src/surface-transfer/generated/protocol.ts +3 -3
- package/src/surface-transfer/generated/variant-fields.ts +1 -1
- package/src/surface-transfer/validation.ts +76 -53
- package/src/surfaces/client.ts +26 -38
- package/src/surfaces/generated/fields.ts +1 -1
- package/src/surfaces/generated/protocol.ts +1 -1
- package/src/surfaces/generated/variant-fields.ts +1 -1
- package/src/surfaces/validation.ts +198 -61
- package/src/transfer/connection.ts +25 -39
- package/src/transfer/generated/fields.ts +2 -1
- package/src/transfer/generated/protocol.ts +9 -1
- package/src/transfer/generated/variant-fields.ts +1 -1
- package/src/transfer/index.ts +8 -1
- package/src/transfer/payload.ts +12 -9
- package/src/transfer/validation.ts +146 -60
- package/src/update/client.ts +43 -16
- package/src/update/controller.ts +187 -104
- package/src/update/generated/fields.ts +2 -1
- package/src/update/generated/protocol.ts +19 -7
- package/src/update/generated/variant-fields.ts +3 -2
- package/src/update/ports.ts +11 -7
- package/src/update/serialized.ts +8 -6
- package/src/update/validation.ts +18 -28
package/src/update/validation.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkWireFields, readWireRecord, wireVariantFields } from "../core/record.ts";
|
|
2
2
|
import { UPDATE_FIELDS } from "./generated/fields.ts";
|
|
3
3
|
import {
|
|
4
4
|
UPDATE_AVAILABILITY_STATES,
|
|
@@ -73,6 +73,7 @@ export function assertUpdateOutcome(value: unknown): asserts value is UpdateOutc
|
|
|
73
73
|
exact(root, "$", variantFields("UpdateOutcomeProjection", root, "$"));
|
|
74
74
|
if (root.status === "rejected") {
|
|
75
75
|
oneOf(root.code, "$.code", UPDATE_REJECTION_CODES);
|
|
76
|
+
optionalString(root.detail, "$.detail");
|
|
76
77
|
}
|
|
77
78
|
assertUpdateSnapshot(root.snapshot);
|
|
78
79
|
}
|
|
@@ -159,14 +160,14 @@ function availability(value: unknown, path: string): void {
|
|
|
159
160
|
oneOf(root.reason, `${path}.reason`, UPDATE_OFFER_REASONS);
|
|
160
161
|
optionalString(root.notes, `${path}.notes`);
|
|
161
162
|
}
|
|
162
|
-
//
|
|
163
|
-
// read to say anything useful: "you are on 1.3.0-nightly.4 and production
|
|
164
|
-
// publishes 1.2.9" is the whole message, and Card 154 calls it the single
|
|
165
|
-
// most likely support question the feature generates.
|
|
163
|
+
// The surface needs both versions to explain why the channel has no offer.
|
|
166
164
|
if (root.state === "aheadOfChannel") {
|
|
167
165
|
version(root.installed, `${path}.installed`);
|
|
168
166
|
version(root.channel, `${path}.channel`);
|
|
169
167
|
}
|
|
168
|
+
if (root.state === "unavailableForTarget") {
|
|
169
|
+
version(root.version, `${path}.version`);
|
|
170
|
+
}
|
|
170
171
|
if (root.state === "withheldByRollout") {
|
|
171
172
|
version(root.version, `${path}.version`);
|
|
172
173
|
}
|
|
@@ -213,25 +214,18 @@ function commandBase(value: unknown, expected: ReadonlyArray<string>): void {
|
|
|
213
214
|
positive(root.authorityEpoch, "$.authorityEpoch");
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
/**
|
|
217
|
-
* Allowed keys for one variant, from the generated map.
|
|
218
|
-
*
|
|
219
|
-
* A missing entry means the generator failed to read the union, not that a
|
|
220
|
-
* consumer sent something odd — every caller runs `oneOf` over the
|
|
221
|
-
* discriminant first, so an unknown one is already rejected by then.
|
|
222
|
-
*/
|
|
223
217
|
function variantFields(
|
|
224
218
|
type: string,
|
|
225
219
|
value: Record<string, unknown>,
|
|
226
220
|
path: string,
|
|
227
221
|
): ReadonlyArray<string> {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
222
|
+
return wireVariantFields(
|
|
223
|
+
UPDATE_VARIANT_FIELDS,
|
|
224
|
+
UPDATE_VARIANT_FIELDS_DISCRIMINANTS,
|
|
225
|
+
type,
|
|
226
|
+
value,
|
|
227
|
+
(discriminant) => fail(path, `no generated fields for ${type}.${String(discriminant)}`),
|
|
228
|
+
);
|
|
235
229
|
}
|
|
236
230
|
|
|
237
231
|
function noPayload(value: unknown): void {
|
|
@@ -251,21 +245,17 @@ function noPayload(value: unknown): void {
|
|
|
251
245
|
visit(value, "$");
|
|
252
246
|
}
|
|
253
247
|
function object(value: unknown, path: string): Record<string, unknown> {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
return value;
|
|
248
|
+
const result = readWireRecord(value, () => fail(path, "expected object"));
|
|
249
|
+
return result;
|
|
258
250
|
}
|
|
259
251
|
function exact(
|
|
260
252
|
value: Record<string, unknown>,
|
|
261
253
|
path: string,
|
|
262
254
|
expected: ReadonlyArray<string>,
|
|
263
255
|
): void {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
fail(path, `unexpected keys: ${actual.join(",")}`);
|
|
268
|
-
}
|
|
256
|
+
checkWireFields(value, expected, () =>
|
|
257
|
+
fail(path, `unexpected keys: ${Object.keys(value).sort().join(",")}`),
|
|
258
|
+
);
|
|
269
259
|
}
|
|
270
260
|
function protocol(value: unknown, path: string): void {
|
|
271
261
|
if (value !== UPDATE_PROTOCOL_VERSION) {
|