@inhuman.tools/plexus-expectations 0.0.0-stage → 0.1.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/LICENSE.md +7 -0
- package/README.md +144 -2
- package/dist/driver/ExpectationActor.d.ts +56 -0
- package/dist/driver/ExpectationActor.d.ts.map +1 -0
- package/dist/driver/ExpectationActor.js +210 -0
- package/dist/driver/ExpectationActor.js.map +1 -0
- package/dist/driver/PEWDriver.d.ts +144 -0
- package/dist/driver/PEWDriver.d.ts.map +1 -0
- package/dist/driver/PEWDriver.js +303 -0
- package/dist/driver/PEWDriver.js.map +1 -0
- package/dist/driver/PEWDriverConnection.d.ts +139 -0
- package/dist/driver/PEWDriverConnection.d.ts.map +1 -0
- package/dist/driver/PEWDriverConnection.js +298 -0
- package/dist/driver/PEWDriverConnection.js.map +1 -0
- package/dist/driver/actor-machine.d.ts +28 -0
- package/dist/driver/actor-machine.d.ts.map +1 -0
- package/dist/driver/actor-machine.js +50 -0
- package/dist/driver/actor-machine.js.map +1 -0
- package/dist/driver/connection-miss.d.ts +9 -0
- package/dist/driver/connection-miss.d.ts.map +1 -0
- package/dist/driver/connection-miss.js +13 -0
- package/dist/driver/connection-miss.js.map +1 -0
- package/dist/driver/index.d.ts +6 -0
- package/dist/driver/index.d.ts.map +1 -0
- package/dist/driver/index.js +5 -0
- package/dist/driver/index.js.map +1 -0
- package/dist/error-with-invariant.d.ts +9 -0
- package/dist/error-with-invariant.d.ts.map +1 -0
- package/dist/error-with-invariant.js +12 -0
- package/dist/error-with-invariant.js.map +1 -0
- package/dist/executor/index.d.ts +4 -0
- package/dist/executor/index.d.ts.map +1 -0
- package/dist/executor/index.js +4 -0
- package/dist/executor/index.js.map +1 -0
- package/dist/executor/kernel-intern.d.ts +16 -0
- package/dist/executor/kernel-intern.d.ts.map +1 -0
- package/dist/executor/kernel-intern.js +98 -0
- package/dist/executor/kernel-intern.js.map +1 -0
- package/dist/executor/orchestrator.d.ts +97 -0
- package/dist/executor/orchestrator.d.ts.map +1 -0
- package/dist/executor/orchestrator.js +465 -0
- package/dist/executor/orchestrator.js.map +1 -0
- package/dist/executor/types.d.ts +8 -0
- package/dist/executor/types.d.ts.map +1 -0
- package/dist/executor/types.js +2 -0
- package/dist/executor/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/connection.d.ts +4 -0
- package/dist/schemas/connection.d.ts.map +1 -0
- package/dist/schemas/connection.js +4 -0
- package/dist/schemas/connection.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/shared/attention.d.ts +27 -0
- package/dist/shared/attention.d.ts.map +1 -0
- package/dist/shared/attention.js +116 -0
- package/dist/shared/attention.js.map +1 -0
- package/dist/shared/control.d.ts +4 -0
- package/dist/shared/control.d.ts.map +1 -0
- package/dist/shared/control.js +2 -0
- package/dist/shared/control.js.map +1 -0
- package/dist/shared/index.d.ts +7 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +7 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/map-field-awareness.d.ts +19 -0
- package/dist/shared/map-field-awareness.d.ts.map +1 -0
- package/dist/shared/map-field-awareness.js +58 -0
- package/dist/shared/map-field-awareness.js.map +1 -0
- package/dist/shared/models/ApprovableExpectation.d.ts +15 -0
- package/dist/shared/models/ApprovableExpectation.d.ts.map +1 -0
- package/dist/shared/models/ApprovableExpectation.js +138 -0
- package/dist/shared/models/ApprovableExpectation.js.map +1 -0
- package/dist/shared/models/ConnectionSpec.d.ts +44 -0
- package/dist/shared/models/ConnectionSpec.d.ts.map +1 -0
- package/dist/shared/models/ConnectionSpec.js +180 -0
- package/dist/shared/models/ConnectionSpec.js.map +1 -0
- package/dist/shared/models/DriverSpec.d.ts +45 -0
- package/dist/shared/models/DriverSpec.d.ts.map +1 -0
- package/dist/shared/models/DriverSpec.js +221 -0
- package/dist/shared/models/DriverSpec.js.map +1 -0
- package/dist/shared/models/IntrospectingPlexusModel.d.ts +8 -0
- package/dist/shared/models/IntrospectingPlexusModel.d.ts.map +1 -0
- package/dist/shared/models/IntrospectingPlexusModel.js +48 -0
- package/dist/shared/models/IntrospectingPlexusModel.js.map +1 -0
- package/dist/shared/models/Job.d.ts +85 -0
- package/dist/shared/models/Job.d.ts.map +1 -0
- package/dist/shared/models/Job.js +261 -0
- package/dist/shared/models/Job.js.map +1 -0
- package/dist/shared/models/ProgrammaticJob.d.ts +6 -0
- package/dist/shared/models/ProgrammaticJob.d.ts.map +1 -0
- package/dist/shared/models/ProgrammaticJob.js +80 -0
- package/dist/shared/models/ProgrammaticJob.js.map +1 -0
- package/dist/shared/models/WorkContainer.d.ts +36 -0
- package/dist/shared/models/WorkContainer.d.ts.map +1 -0
- package/dist/shared/models/WorkContainer.js +140 -0
- package/dist/shared/models/WorkContainer.js.map +1 -0
- package/dist/shared/models/WorkExpectation.d.ts +63 -0
- package/dist/shared/models/WorkExpectation.d.ts.map +1 -0
- package/dist/shared/models/WorkExpectation.js +290 -0
- package/dist/shared/models/WorkExpectation.js.map +1 -0
- package/dist/shared/models/WorkExpectationWithIntrospection.d.ts +4 -0
- package/dist/shared/models/WorkExpectationWithIntrospection.d.ts.map +1 -0
- package/dist/shared/models/WorkExpectationWithIntrospection.js +28 -0
- package/dist/shared/models/WorkExpectationWithIntrospection.js.map +1 -0
- package/dist/shared/models/index.d.ts +7 -0
- package/dist/shared/models/index.d.ts.map +1 -0
- package/dist/shared/models/index.js +6 -0
- package/dist/shared/models/index.js.map +1 -0
- package/dist/shared/models/jsonRecord.d.ts +14 -0
- package/dist/shared/models/jsonRecord.d.ts.map +1 -0
- package/dist/shared/models/jsonRecord.js +46 -0
- package/dist/shared/models/jsonRecord.js.map +1 -0
- package/dist/shared/resolution.d.ts +39 -0
- package/dist/shared/resolution.d.ts.map +1 -0
- package/dist/shared/resolution.js +124 -0
- package/dist/shared/resolution.js.map +1 -0
- package/dist/shared/revalidation-demand.d.ts +27 -0
- package/dist/shared/revalidation-demand.d.ts.map +1 -0
- package/dist/shared/revalidation-demand.js +116 -0
- package/dist/shared/revalidation-demand.js.map +1 -0
- package/dist/shared/role.d.ts +12 -0
- package/dist/shared/role.d.ts.map +1 -0
- package/dist/shared/role.js +21 -0
- package/dist/shared/role.js.map +1 -0
- package/dist/shared/types.d.ts +43 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +12 -0
- package/dist/shared/types.js.map +1 -0
- package/package.json +79 -3
- package/src/driver/ExpectationActor.ts +244 -0
- package/src/driver/PEWDriver.ts +302 -0
- package/src/driver/actor-machine.ts +54 -0
- package/src/driver/connection-miss.ts +13 -0
- package/src/driver/index.ts +5 -0
- package/src/executor/index.ts +3 -0
- package/src/executor/kernel-intern.ts +121 -0
- package/src/executor/orchestrator.ts +463 -0
- package/src/executor/types.ts +3 -0
- package/src/index.ts +1 -0
- package/src/schemas/connection.ts +4 -0
- package/src/schemas/index.ts +1 -0
- package/src/shared/control.ts +4 -0
- package/src/shared/index.ts +6 -0
- package/src/shared/map-field-awareness.ts +65 -0
- package/src/shared/models/ConnectionSpec.ts +84 -0
- package/src/shared/models/DriverSpec.ts +102 -0
- package/src/shared/models/Job.ts +192 -0
- package/src/shared/models/WorkContainer.ts +90 -0
- package/src/shared/models/WorkExpectation.ts +229 -0
- package/src/shared/models/index.ts +6 -0
- package/src/shared/models/jsonRecord.ts +49 -0
- package/src/shared/revalidation-demand.ts +121 -0
- package/src/shared/role.ts +32 -0
- package/src/shared/types.ts +57 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
36
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
37
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* YAML connection inventory. Settings ride a private synced bag; the public
|
|
41
|
+
* face is {@link configuration} (deep-readonly get, whole-bag set).
|
|
42
|
+
* Secrets never live here. PEW process facts are `readyState` / `error`
|
|
43
|
+
* plus {@link live}. YAML file fill does not touch process facts.
|
|
44
|
+
*/
|
|
45
|
+
import { PlexusModel, syncing } from "@here.build/plexus";
|
|
46
|
+
import { computed } from "mobx";
|
|
47
|
+
import { readJsonRecord, writeJsonRecord } from "./jsonRecord.js";
|
|
48
|
+
let ConnectionSpec = (() => {
|
|
49
|
+
var _a, _b, _c, _d, _e;
|
|
50
|
+
let _classDecorators = [syncing("@inhuman.tools/plexus-expectations:ConnectionSpec")];
|
|
51
|
+
let _classDescriptor;
|
|
52
|
+
let _classExtraInitializers = [];
|
|
53
|
+
let _classThis;
|
|
54
|
+
let _classSuper = PlexusModel;
|
|
55
|
+
let _instanceExtraInitializers = [];
|
|
56
|
+
let _driver_decorators;
|
|
57
|
+
let _driver_initializers = [];
|
|
58
|
+
let _driver_extraInitializers = [];
|
|
59
|
+
let _name_decorators;
|
|
60
|
+
let _name_initializers = [];
|
|
61
|
+
let _name_extraInitializers = [];
|
|
62
|
+
let _annotation_decorators;
|
|
63
|
+
let _annotation_initializers = [];
|
|
64
|
+
let _annotation_extraInitializers = [];
|
|
65
|
+
let _configurationMap_decorators;
|
|
66
|
+
let _configurationMap_initializers = [];
|
|
67
|
+
let _configurationMap_extraInitializers = [];
|
|
68
|
+
let _readyState_decorators;
|
|
69
|
+
let _readyState_initializers = [];
|
|
70
|
+
let _readyState_extraInitializers = [];
|
|
71
|
+
let _error_decorators;
|
|
72
|
+
let _error_initializers = [];
|
|
73
|
+
let _error_extraInitializers = [];
|
|
74
|
+
let _liveMap_decorators;
|
|
75
|
+
let _liveMap_initializers = [];
|
|
76
|
+
let _liveMap_extraInitializers = [];
|
|
77
|
+
let _get_configuration_decorators;
|
|
78
|
+
let _private_writeConfiguration_decorators;
|
|
79
|
+
let _private_writeConfiguration_descriptor;
|
|
80
|
+
let _get_live_decorators;
|
|
81
|
+
let _private_writeLive_decorators;
|
|
82
|
+
let _private_writeLive_descriptor;
|
|
83
|
+
let _stampProcess_decorators;
|
|
84
|
+
var ConnectionSpec = class extends _classSuper {
|
|
85
|
+
static { _classThis = this; }
|
|
86
|
+
static {
|
|
87
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
88
|
+
_driver_decorators = [syncing];
|
|
89
|
+
_name_decorators = [syncing];
|
|
90
|
+
_annotation_decorators = [syncing];
|
|
91
|
+
_configurationMap_decorators = [(_a = syncing).record.bind(_a)];
|
|
92
|
+
_readyState_decorators = [syncing];
|
|
93
|
+
_error_decorators = [syncing];
|
|
94
|
+
_liveMap_decorators = [(_b = syncing).record.bind(_b)];
|
|
95
|
+
_get_configuration_decorators = [computed];
|
|
96
|
+
_private_writeConfiguration_decorators = [(_c = syncing).action.bind(_c)];
|
|
97
|
+
_get_live_decorators = [computed];
|
|
98
|
+
_private_writeLive_decorators = [(_d = syncing).action.bind(_d)];
|
|
99
|
+
_stampProcess_decorators = [(_e = syncing).action.bind(_e)];
|
|
100
|
+
__esDecorate(this, null, _driver_decorators, { kind: "accessor", name: "driver", static: false, private: false, access: { has: obj => "driver" in obj, get: obj => obj.driver, set: (obj, value) => { obj.driver = value; } }, metadata: _metadata }, _driver_initializers, _driver_extraInitializers);
|
|
101
|
+
__esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
102
|
+
__esDecorate(this, null, _annotation_decorators, { kind: "accessor", name: "annotation", static: false, private: false, access: { has: obj => "annotation" in obj, get: obj => obj.annotation, set: (obj, value) => { obj.annotation = value; } }, metadata: _metadata }, _annotation_initializers, _annotation_extraInitializers);
|
|
103
|
+
__esDecorate(this, null, _configurationMap_decorators, { kind: "accessor", name: "configurationMap", static: false, private: false, access: { has: obj => "configurationMap" in obj, get: obj => obj.configurationMap, set: (obj, value) => { obj.configurationMap = value; } }, metadata: _metadata }, _configurationMap_initializers, _configurationMap_extraInitializers);
|
|
104
|
+
__esDecorate(this, null, _readyState_decorators, { kind: "accessor", name: "readyState", static: false, private: false, access: { has: obj => "readyState" in obj, get: obj => obj.readyState, set: (obj, value) => { obj.readyState = value; } }, metadata: _metadata }, _readyState_initializers, _readyState_extraInitializers);
|
|
105
|
+
__esDecorate(this, null, _error_decorators, { kind: "accessor", name: "error", static: false, private: false, access: { has: obj => "error" in obj, get: obj => obj.error, set: (obj, value) => { obj.error = value; } }, metadata: _metadata }, _error_initializers, _error_extraInitializers);
|
|
106
|
+
__esDecorate(this, null, _liveMap_decorators, { kind: "accessor", name: "liveMap", static: false, private: false, access: { has: obj => "liveMap" in obj, get: obj => obj.liveMap, set: (obj, value) => { obj.liveMap = value; } }, metadata: _metadata }, _liveMap_initializers, _liveMap_extraInitializers);
|
|
107
|
+
__esDecorate(this, null, _get_configuration_decorators, { kind: "getter", name: "configuration", static: false, private: false, access: { has: obj => "configuration" in obj, get: obj => obj.configuration }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
108
|
+
__esDecorate(this, _private_writeConfiguration_descriptor = { value: __setFunctionName(function (settings) {
|
|
109
|
+
writeJsonRecord(this.configurationMap, settings);
|
|
110
|
+
}, "#writeConfiguration") }, _private_writeConfiguration_decorators, { kind: "method", name: "#writeConfiguration", static: false, private: true, access: { has: obj => #writeConfiguration in obj, get: obj => obj.#writeConfiguration }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
111
|
+
__esDecorate(this, null, _get_live_decorators, { kind: "getter", name: "live", static: false, private: false, access: { has: obj => "live" in obj, get: obj => obj.live }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
112
|
+
__esDecorate(this, _private_writeLive_descriptor = { value: __setFunctionName(function (next) {
|
|
113
|
+
writeJsonRecord(this.liveMap, next);
|
|
114
|
+
}, "#writeLive") }, _private_writeLive_decorators, { kind: "method", name: "#writeLive", static: false, private: true, access: { has: obj => #writeLive in obj, get: obj => obj.#writeLive }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
115
|
+
__esDecorate(this, null, _stampProcess_decorators, { kind: "method", name: "stampProcess", static: false, private: false, access: { has: obj => "stampProcess" in obj, get: obj => obj.stampProcess }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
116
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
117
|
+
ConnectionSpec = _classThis = _classDescriptor.value;
|
|
118
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
119
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
120
|
+
}
|
|
121
|
+
get id() {
|
|
122
|
+
return this.parentFieldKey ?? "";
|
|
123
|
+
}
|
|
124
|
+
/** Only `failed` is a problem. */
|
|
125
|
+
get issue() {
|
|
126
|
+
return this.readyState === "failed" ? "failed" : false;
|
|
127
|
+
}
|
|
128
|
+
#driver_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _driver_initializers, void 0));
|
|
129
|
+
/** YAML `driver:` resolves to this entity. */
|
|
130
|
+
get driver() { return this.#driver_accessor_storage; }
|
|
131
|
+
set driver(value) { this.#driver_accessor_storage = value; }
|
|
132
|
+
#name_accessor_storage = (__runInitializers(this, _driver_extraInitializers), __runInitializers(this, _name_initializers, ""));
|
|
133
|
+
get name() { return this.#name_accessor_storage; }
|
|
134
|
+
set name(value) { this.#name_accessor_storage = value; }
|
|
135
|
+
#annotation_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _annotation_initializers, ""));
|
|
136
|
+
get annotation() { return this.#annotation_accessor_storage; }
|
|
137
|
+
set annotation(value) { this.#annotation_accessor_storage = value; }
|
|
138
|
+
#configurationMap_accessor_storage = (__runInitializers(this, _annotation_extraInitializers), __runInitializers(this, _configurationMap_initializers, {}));
|
|
139
|
+
get configurationMap() { return this.#configurationMap_accessor_storage; }
|
|
140
|
+
set configurationMap(value) { this.#configurationMap_accessor_storage = value; }
|
|
141
|
+
#readyState_accessor_storage = (__runInitializers(this, _configurationMap_extraInitializers), __runInitializers(this, _readyState_initializers, null));
|
|
142
|
+
/** PEW instance self-report. `null` = never ensured. YAML fill does not touch this. */
|
|
143
|
+
get readyState() { return this.#readyState_accessor_storage; }
|
|
144
|
+
set readyState(value) { this.#readyState_accessor_storage = value; }
|
|
145
|
+
#error_accessor_storage = (__runInitializers(this, _readyState_extraInitializers), __runInitializers(this, _error_initializers, ""));
|
|
146
|
+
get error() { return this.#error_accessor_storage; }
|
|
147
|
+
set error(value) { this.#error_accessor_storage = value; }
|
|
148
|
+
#liveMap_accessor_storage = (__runInitializers(this, _error_extraInitializers), __runInitializers(this, _liveMap_initializers, {}));
|
|
149
|
+
get liveMap() { return this.#liveMap_accessor_storage; }
|
|
150
|
+
set liveMap(value) { this.#liveMap_accessor_storage = value; }
|
|
151
|
+
/** Frozen through; assign the whole bag to write. */
|
|
152
|
+
get configuration() {
|
|
153
|
+
return readJsonRecord(this.configurationMap);
|
|
154
|
+
}
|
|
155
|
+
set configuration(settings) {
|
|
156
|
+
this.#writeConfiguration(settings);
|
|
157
|
+
}
|
|
158
|
+
get #writeConfiguration() { return _private_writeConfiguration_descriptor.value; }
|
|
159
|
+
get live() {
|
|
160
|
+
return readJsonRecord(this.liveMap);
|
|
161
|
+
}
|
|
162
|
+
set live(next) {
|
|
163
|
+
this.#writeLive(next);
|
|
164
|
+
}
|
|
165
|
+
get #writeLive() { return _private_writeLive_descriptor.value; }
|
|
166
|
+
/** Process self-report. YAML fill does not call this. */
|
|
167
|
+
stampProcess(next) {
|
|
168
|
+
this.readyState = next.readyState;
|
|
169
|
+
this.error = next.error;
|
|
170
|
+
this.live = next.live;
|
|
171
|
+
}
|
|
172
|
+
constructor() {
|
|
173
|
+
super(...arguments);
|
|
174
|
+
__runInitializers(this, _liveMap_extraInitializers);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
return ConnectionSpec = _classThis;
|
|
178
|
+
})();
|
|
179
|
+
export { ConnectionSpec };
|
|
180
|
+
//# sourceMappingURL=ConnectionSpec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionSpec.js","sourceRoot":"","sources":["../../../src/shared/models/ConnectionSpec.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * YAML connection inventory. Settings ride a private synced bag; the public\n * face is {@link configuration} (deep-readonly get, whole-bag set).\n * Secrets never live here. PEW process facts are `readyState` / `error`\n * plus {@link live}. YAML file fill does not touch process facts.\n */\nimport { PlexusModel, syncing } from \"@here.build/plexus\";\nimport { computed } from \"mobx\";\n\nimport type { ReadyState, SpecCatalog } from \"../types.js\";\nimport { DriverSpec } from \"./DriverSpec.js\";\nimport { readJsonRecord, writeJsonRecord, type LiveFacts } from \"./jsonRecord.js\";\n\nexport type ConfigurationAtom = string | number | boolean | null;\nexport type ConfigurationValue =\n | ConfigurationAtom\n | readonly ConfigurationValue[]\n | { readonly [key: string]: ConfigurationValue };\nexport type ConnectionConfiguration = { readonly [key: string]: ConfigurationValue };\n\n@syncing(\"@inhuman.tools/plexus-expectations:ConnectionSpec\")\nexport class ConnectionSpec extends PlexusModel<SpecCatalog | null> {\n get id(): string {\n return (this.parentFieldKey as string | null) ?? \"\";\n }\n\n /** Only `failed` is a problem. */\n get issue(): \"failed\" | false {\n return this.readyState === \"failed\" ? \"failed\" : false;\n }\n\n /** YAML `driver:` resolves to this entity. */\n @syncing accessor driver!: DriverSpec;\n @syncing accessor name: string = \"\";\n @syncing accessor annotation: string = \"\";\n @syncing.record private accessor configurationMap: Record<string, string> = {};\n\n /** PEW instance self-report. `null` = never ensured. YAML fill does not touch this. */\n @syncing accessor readyState: ReadyState = null;\n @syncing accessor error: string = \"\";\n @syncing.record private accessor liveMap: Record<string, string> = {};\n\n /** Frozen through; assign the whole bag to write. */\n @computed\n get configuration(): ConnectionConfiguration {\n return readJsonRecord(this.configurationMap) as ConnectionConfiguration;\n }\n\n set configuration(settings: Readonly<Record<string, unknown>> | undefined) {\n this.#writeConfiguration(settings);\n }\n\n @syncing.action\n #writeConfiguration(settings: Readonly<Record<string, unknown>> | undefined): void {\n writeJsonRecord(this.configurationMap, settings);\n }\n\n @computed\n get live(): LiveFacts {\n return readJsonRecord(this.liveMap) as LiveFacts;\n }\n\n set live(next: Readonly<Record<string, unknown>> | undefined) {\n this.#writeLive(next);\n }\n\n @syncing.action\n #writeLive(next: Readonly<Record<string, unknown>> | undefined): void {\n writeJsonRecord(this.liveMap, next);\n }\n\n /** Process self-report. YAML fill does not call this. */\n @syncing.action\n stampProcess(next: {\n readonly readyState: ReadyState;\n readonly error: string;\n readonly live: Readonly<Record<string, unknown>> | undefined;\n }): void {\n this.readyState = next.readyState;\n this.error = next.error;\n this.live = next.live;\n }\n}\n\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advertised driver inventory. `can` is a plexus list — file tokens, no load required.
|
|
3
|
+
* PEW process facts are `readyState` / `error` / `offersJson` plus {@link live}.
|
|
4
|
+
* YAML file fill does not touch process facts.
|
|
5
|
+
*/
|
|
6
|
+
import { PlexusModel } from "@here.build/plexus";
|
|
7
|
+
import type { ReadyState, SpecCatalog } from "../types.js";
|
|
8
|
+
import { type LiveFacts } from "./jsonRecord.js";
|
|
9
|
+
/** How a new connection of this driver is offered, before the class loads. */
|
|
10
|
+
export type DriverMultiplicity = "add-by-default" | "add-as-secondary";
|
|
11
|
+
export declare class DriverSpec extends PlexusModel<SpecCatalog | null> {
|
|
12
|
+
#private;
|
|
13
|
+
accessor name: string;
|
|
14
|
+
accessor description: string;
|
|
15
|
+
accessor importPath: string;
|
|
16
|
+
/** Expectation kind names this driver handles. Not tool names. */
|
|
17
|
+
accessor abilityClaim: string[];
|
|
18
|
+
accessor multiplicity: DriverMultiplicity;
|
|
19
|
+
/** Module-load self-report. `null` = never loaded. YAML fill does not touch this. */
|
|
20
|
+
accessor readyState: ReadyState;
|
|
21
|
+
accessor error: string;
|
|
22
|
+
/** Offer list JSON. Null = no offers. */
|
|
23
|
+
private accessor offersJson;
|
|
24
|
+
private accessor liveMap;
|
|
25
|
+
get live(): LiveFacts;
|
|
26
|
+
set live(next: Readonly<Record<string, unknown>> | undefined);
|
|
27
|
+
/**
|
|
28
|
+
* Module-load self-report. Omitted `offersJson` / `live` stay
|
|
29
|
+
* (failure must not wipe a previous load).
|
|
30
|
+
*/
|
|
31
|
+
stampLoad(next: {
|
|
32
|
+
readonly readyState: ReadyState;
|
|
33
|
+
readonly error: string;
|
|
34
|
+
readonly offersJson?: string | null;
|
|
35
|
+
readonly live?: Readonly<Record<string, unknown>>;
|
|
36
|
+
}): void;
|
|
37
|
+
/**
|
|
38
|
+
* Class-bootstrap offers. Null, blank, and the string `"null"` are no offers.
|
|
39
|
+
* A non-string cell or malformed JSON throws: a silent [] hides a driver defect.
|
|
40
|
+
*/
|
|
41
|
+
get offers(): readonly object[];
|
|
42
|
+
set offers(next: readonly object[] | null);
|
|
43
|
+
}
|
|
44
|
+
export declare function readDriverOffers(raw: unknown): object[];
|
|
45
|
+
//# sourceMappingURL=DriverSpec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DriverSpec.d.ts","sourceRoot":"","sources":["../../../src/shared/models/DriverSpec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAW,MAAM,oBAAoB,CAAC;AAI1D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAElF,8EAA8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAEvE,qBACa,UAAW,SAAQ,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAM;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAM;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAM;IAC1C,kEAAkE;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAM;IAC1C,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAsB;IAExE,qFAAqF;IAC5E,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAQ;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAM;IACrC,yCAAyC;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IAEtE,IACI,IAAI,IAAI,SAAS,CAEpB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EAE3D;IAOD;;;OAGG;IAEH,SAAS,CAAC,IAAI,EAAE;QACd,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;QAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACnD,GAAG,IAAI;IAOR;;;OAGG;IACH,IACI,MAAM,IAAI,SAAS,MAAM,EAAE,CAE9B;IAED,IAAI,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,EAExC;CAMF;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAoBvD"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
36
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
37
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Advertised driver inventory. `can` is a plexus list — file tokens, no load required.
|
|
41
|
+
* PEW process facts are `readyState` / `error` / `offersJson` plus {@link live}.
|
|
42
|
+
* YAML file fill does not touch process facts.
|
|
43
|
+
*/
|
|
44
|
+
import { PlexusModel, syncing } from "@here.build/plexus";
|
|
45
|
+
import { computed } from "mobx";
|
|
46
|
+
import invariant from "tiny-invariant";
|
|
47
|
+
import { readJsonRecord, writeJsonRecord } from "./jsonRecord.js";
|
|
48
|
+
let DriverSpec = (() => {
|
|
49
|
+
var _a, _b, _c, _d, _e;
|
|
50
|
+
let _classDecorators = [syncing("@inhuman.tools/plexus-expectations:DriverSpec")];
|
|
51
|
+
let _classDescriptor;
|
|
52
|
+
let _classExtraInitializers = [];
|
|
53
|
+
let _classThis;
|
|
54
|
+
let _classSuper = PlexusModel;
|
|
55
|
+
let _instanceExtraInitializers = [];
|
|
56
|
+
let _name_decorators;
|
|
57
|
+
let _name_initializers = [];
|
|
58
|
+
let _name_extraInitializers = [];
|
|
59
|
+
let _description_decorators;
|
|
60
|
+
let _description_initializers = [];
|
|
61
|
+
let _description_extraInitializers = [];
|
|
62
|
+
let _importPath_decorators;
|
|
63
|
+
let _importPath_initializers = [];
|
|
64
|
+
let _importPath_extraInitializers = [];
|
|
65
|
+
let _abilityClaim_decorators;
|
|
66
|
+
let _abilityClaim_initializers = [];
|
|
67
|
+
let _abilityClaim_extraInitializers = [];
|
|
68
|
+
let _multiplicity_decorators;
|
|
69
|
+
let _multiplicity_initializers = [];
|
|
70
|
+
let _multiplicity_extraInitializers = [];
|
|
71
|
+
let _readyState_decorators;
|
|
72
|
+
let _readyState_initializers = [];
|
|
73
|
+
let _readyState_extraInitializers = [];
|
|
74
|
+
let _error_decorators;
|
|
75
|
+
let _error_initializers = [];
|
|
76
|
+
let _error_extraInitializers = [];
|
|
77
|
+
let _offersJson_decorators;
|
|
78
|
+
let _offersJson_initializers = [];
|
|
79
|
+
let _offersJson_extraInitializers = [];
|
|
80
|
+
let _liveMap_decorators;
|
|
81
|
+
let _liveMap_initializers = [];
|
|
82
|
+
let _liveMap_extraInitializers = [];
|
|
83
|
+
let _get_live_decorators;
|
|
84
|
+
let _private_writeLive_decorators;
|
|
85
|
+
let _private_writeLive_descriptor;
|
|
86
|
+
let _stampLoad_decorators;
|
|
87
|
+
let _get_offers_decorators;
|
|
88
|
+
let _private_writeOffers_decorators;
|
|
89
|
+
let _private_writeOffers_descriptor;
|
|
90
|
+
var DriverSpec = class extends _classSuper {
|
|
91
|
+
static { _classThis = this; }
|
|
92
|
+
static {
|
|
93
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
94
|
+
_name_decorators = [syncing];
|
|
95
|
+
_description_decorators = [syncing];
|
|
96
|
+
_importPath_decorators = [syncing];
|
|
97
|
+
_abilityClaim_decorators = [(_a = syncing).list.bind(_a)];
|
|
98
|
+
_multiplicity_decorators = [syncing];
|
|
99
|
+
_readyState_decorators = [syncing];
|
|
100
|
+
_error_decorators = [syncing];
|
|
101
|
+
_offersJson_decorators = [syncing];
|
|
102
|
+
_liveMap_decorators = [(_b = syncing).record.bind(_b)];
|
|
103
|
+
_get_live_decorators = [computed];
|
|
104
|
+
_private_writeLive_decorators = [(_c = syncing).action.bind(_c)];
|
|
105
|
+
_stampLoad_decorators = [(_d = syncing).action.bind(_d)];
|
|
106
|
+
_get_offers_decorators = [computed];
|
|
107
|
+
_private_writeOffers_decorators = [(_e = syncing).action.bind(_e)];
|
|
108
|
+
__esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
109
|
+
__esDecorate(this, null, _description_decorators, { kind: "accessor", name: "description", static: false, private: false, access: { has: obj => "description" in obj, get: obj => obj.description, set: (obj, value) => { obj.description = value; } }, metadata: _metadata }, _description_initializers, _description_extraInitializers);
|
|
110
|
+
__esDecorate(this, null, _importPath_decorators, { kind: "accessor", name: "importPath", static: false, private: false, access: { has: obj => "importPath" in obj, get: obj => obj.importPath, set: (obj, value) => { obj.importPath = value; } }, metadata: _metadata }, _importPath_initializers, _importPath_extraInitializers);
|
|
111
|
+
__esDecorate(this, null, _abilityClaim_decorators, { kind: "accessor", name: "abilityClaim", static: false, private: false, access: { has: obj => "abilityClaim" in obj, get: obj => obj.abilityClaim, set: (obj, value) => { obj.abilityClaim = value; } }, metadata: _metadata }, _abilityClaim_initializers, _abilityClaim_extraInitializers);
|
|
112
|
+
__esDecorate(this, null, _multiplicity_decorators, { kind: "accessor", name: "multiplicity", static: false, private: false, access: { has: obj => "multiplicity" in obj, get: obj => obj.multiplicity, set: (obj, value) => { obj.multiplicity = value; } }, metadata: _metadata }, _multiplicity_initializers, _multiplicity_extraInitializers);
|
|
113
|
+
__esDecorate(this, null, _readyState_decorators, { kind: "accessor", name: "readyState", static: false, private: false, access: { has: obj => "readyState" in obj, get: obj => obj.readyState, set: (obj, value) => { obj.readyState = value; } }, metadata: _metadata }, _readyState_initializers, _readyState_extraInitializers);
|
|
114
|
+
__esDecorate(this, null, _error_decorators, { kind: "accessor", name: "error", static: false, private: false, access: { has: obj => "error" in obj, get: obj => obj.error, set: (obj, value) => { obj.error = value; } }, metadata: _metadata }, _error_initializers, _error_extraInitializers);
|
|
115
|
+
__esDecorate(this, null, _offersJson_decorators, { kind: "accessor", name: "offersJson", static: false, private: false, access: { has: obj => "offersJson" in obj, get: obj => obj.offersJson, set: (obj, value) => { obj.offersJson = value; } }, metadata: _metadata }, _offersJson_initializers, _offersJson_extraInitializers);
|
|
116
|
+
__esDecorate(this, null, _liveMap_decorators, { kind: "accessor", name: "liveMap", static: false, private: false, access: { has: obj => "liveMap" in obj, get: obj => obj.liveMap, set: (obj, value) => { obj.liveMap = value; } }, metadata: _metadata }, _liveMap_initializers, _liveMap_extraInitializers);
|
|
117
|
+
__esDecorate(this, null, _get_live_decorators, { kind: "getter", name: "live", static: false, private: false, access: { has: obj => "live" in obj, get: obj => obj.live }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
118
|
+
__esDecorate(this, _private_writeLive_descriptor = { value: __setFunctionName(function (next) {
|
|
119
|
+
writeJsonRecord(this.liveMap, next);
|
|
120
|
+
}, "#writeLive") }, _private_writeLive_decorators, { kind: "method", name: "#writeLive", static: false, private: true, access: { has: obj => #writeLive in obj, get: obj => obj.#writeLive }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
121
|
+
__esDecorate(this, null, _stampLoad_decorators, { kind: "method", name: "stampLoad", static: false, private: false, access: { has: obj => "stampLoad" in obj, get: obj => obj.stampLoad }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
122
|
+
__esDecorate(this, null, _get_offers_decorators, { kind: "getter", name: "offers", static: false, private: false, access: { has: obj => "offers" in obj, get: obj => obj.offers }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
123
|
+
__esDecorate(this, _private_writeOffers_descriptor = { value: __setFunctionName(function (next) {
|
|
124
|
+
this.offersJson = next == null ? null : JSON.stringify(next);
|
|
125
|
+
}, "#writeOffers") }, _private_writeOffers_decorators, { kind: "method", name: "#writeOffers", static: false, private: true, access: { has: obj => #writeOffers in obj, get: obj => obj.#writeOffers }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
126
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
127
|
+
DriverSpec = _classThis = _classDescriptor.value;
|
|
128
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
129
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
130
|
+
}
|
|
131
|
+
#name_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _name_initializers, ""));
|
|
132
|
+
get name() { return this.#name_accessor_storage; }
|
|
133
|
+
set name(value) { this.#name_accessor_storage = value; }
|
|
134
|
+
#description_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _description_initializers, ""));
|
|
135
|
+
get description() { return this.#description_accessor_storage; }
|
|
136
|
+
set description(value) { this.#description_accessor_storage = value; }
|
|
137
|
+
#importPath_accessor_storage = (__runInitializers(this, _description_extraInitializers), __runInitializers(this, _importPath_initializers, ""));
|
|
138
|
+
get importPath() { return this.#importPath_accessor_storage; }
|
|
139
|
+
set importPath(value) { this.#importPath_accessor_storage = value; }
|
|
140
|
+
#abilityClaim_accessor_storage = (__runInitializers(this, _importPath_extraInitializers), __runInitializers(this, _abilityClaim_initializers, []));
|
|
141
|
+
/** Expectation kind names this driver handles. Not tool names. */
|
|
142
|
+
get abilityClaim() { return this.#abilityClaim_accessor_storage; }
|
|
143
|
+
set abilityClaim(value) { this.#abilityClaim_accessor_storage = value; }
|
|
144
|
+
#multiplicity_accessor_storage = (__runInitializers(this, _abilityClaim_extraInitializers), __runInitializers(this, _multiplicity_initializers, "add-as-secondary"));
|
|
145
|
+
get multiplicity() { return this.#multiplicity_accessor_storage; }
|
|
146
|
+
set multiplicity(value) { this.#multiplicity_accessor_storage = value; }
|
|
147
|
+
#readyState_accessor_storage = (__runInitializers(this, _multiplicity_extraInitializers), __runInitializers(this, _readyState_initializers, null));
|
|
148
|
+
/** Module-load self-report. `null` = never loaded. YAML fill does not touch this. */
|
|
149
|
+
get readyState() { return this.#readyState_accessor_storage; }
|
|
150
|
+
set readyState(value) { this.#readyState_accessor_storage = value; }
|
|
151
|
+
#error_accessor_storage = (__runInitializers(this, _readyState_extraInitializers), __runInitializers(this, _error_initializers, ""));
|
|
152
|
+
get error() { return this.#error_accessor_storage; }
|
|
153
|
+
set error(value) { this.#error_accessor_storage = value; }
|
|
154
|
+
#offersJson_accessor_storage = (__runInitializers(this, _error_extraInitializers), __runInitializers(this, _offersJson_initializers, null));
|
|
155
|
+
/** Offer list JSON. Null = no offers. */
|
|
156
|
+
get offersJson() { return this.#offersJson_accessor_storage; }
|
|
157
|
+
set offersJson(value) { this.#offersJson_accessor_storage = value; }
|
|
158
|
+
#liveMap_accessor_storage = (__runInitializers(this, _offersJson_extraInitializers), __runInitializers(this, _liveMap_initializers, {}));
|
|
159
|
+
get liveMap() { return this.#liveMap_accessor_storage; }
|
|
160
|
+
set liveMap(value) { this.#liveMap_accessor_storage = value; }
|
|
161
|
+
get live() {
|
|
162
|
+
return readJsonRecord(this.liveMap);
|
|
163
|
+
}
|
|
164
|
+
set live(next) {
|
|
165
|
+
this.#writeLive(next);
|
|
166
|
+
}
|
|
167
|
+
get #writeLive() { return _private_writeLive_descriptor.value; }
|
|
168
|
+
/**
|
|
169
|
+
* Module-load self-report. Omitted `offersJson` / `live` stay
|
|
170
|
+
* (failure must not wipe a previous load).
|
|
171
|
+
*/
|
|
172
|
+
stampLoad(next) {
|
|
173
|
+
this.readyState = next.readyState;
|
|
174
|
+
this.error = next.error;
|
|
175
|
+
if (next.offersJson !== undefined)
|
|
176
|
+
this.offersJson = next.offersJson;
|
|
177
|
+
if (next.live !== undefined)
|
|
178
|
+
this.live = next.live;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Class-bootstrap offers. Null, blank, and the string `"null"` are no offers.
|
|
182
|
+
* A non-string cell or malformed JSON throws: a silent [] hides a driver defect.
|
|
183
|
+
*/
|
|
184
|
+
get offers() {
|
|
185
|
+
return readDriverOffers(this.offersJson);
|
|
186
|
+
}
|
|
187
|
+
set offers(next) {
|
|
188
|
+
this.#writeOffers(next);
|
|
189
|
+
}
|
|
190
|
+
get #writeOffers() { return _private_writeOffers_descriptor.value; }
|
|
191
|
+
constructor() {
|
|
192
|
+
super(...arguments);
|
|
193
|
+
__runInitializers(this, _liveMap_extraInitializers);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
return DriverSpec = _classThis;
|
|
197
|
+
})();
|
|
198
|
+
export { DriverSpec };
|
|
199
|
+
export function readDriverOffers(raw) {
|
|
200
|
+
if (raw == null)
|
|
201
|
+
return [];
|
|
202
|
+
invariant(typeof raw === "string", "harness/kernel/offers: offersJson must be a JSON string");
|
|
203
|
+
const text = raw.trim();
|
|
204
|
+
if (text === "" || text === "null")
|
|
205
|
+
return [];
|
|
206
|
+
let parsed;
|
|
207
|
+
try {
|
|
208
|
+
parsed = JSON.parse(text);
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
throw new Error(`harness/kernel/offers: offersJson is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
212
|
+
}
|
|
213
|
+
invariant(Array.isArray(parsed), "harness/kernel/offers: offersJson must be a JSON array of offer objects");
|
|
214
|
+
for (const item of parsed) {
|
|
215
|
+
invariant(typeof item === "object", "harness/kernel/offers: offersJson entries must be objects");
|
|
216
|
+
invariant(item !== null, "harness/kernel/offers: offersJson entries cannot be null");
|
|
217
|
+
invariant(!Array.isArray(item), "harness/kernel/offers: offersJson entries cannot be arrays");
|
|
218
|
+
}
|
|
219
|
+
return parsed;
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=DriverSpec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DriverSpec.js","sourceRoot":"","sources":["../../../src/shared/models/DriverSpec.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Advertised driver inventory. `can` is a plexus list — file tokens, no load required.\n * PEW process facts are `readyState` / `error` / `offersJson` plus {@link live}.\n * YAML file fill does not touch process facts.\n */\nimport { PlexusModel, syncing } from \"@here.build/plexus\";\nimport { computed } from \"mobx\";\nimport invariant from \"tiny-invariant\";\n\nimport type { ReadyState, SpecCatalog } from \"../types.js\";\nimport { readJsonRecord, writeJsonRecord, type LiveFacts } from \"./jsonRecord.js\";\n\n/** How a new connection of this driver is offered, before the class loads. */\nexport type DriverMultiplicity = \"add-by-default\" | \"add-as-secondary\";\n\n@syncing(\"@inhuman.tools/plexus-expectations:DriverSpec\")\nexport class DriverSpec extends PlexusModel<SpecCatalog | null> {\n @syncing accessor name: string = \"\";\n @syncing accessor description: string = \"\";\n @syncing accessor importPath: string = \"\";\n /** Expectation kind names this driver handles. Not tool names. */\n @syncing.list accessor abilityClaim: string[] = [];\n @syncing accessor multiplicity: DriverMultiplicity = \"add-as-secondary\";\n\n /** Module-load self-report. `null` = never loaded. YAML fill does not touch this. */\n @syncing accessor readyState: ReadyState = null;\n @syncing accessor error: string = \"\";\n /** Offer list JSON. Null = no offers. */\n @syncing private accessor offersJson: string | null = null;\n @syncing.record private accessor liveMap: Record<string, string> = {};\n\n @computed\n get live(): LiveFacts {\n return readJsonRecord(this.liveMap) as LiveFacts;\n }\n\n set live(next: Readonly<Record<string, unknown>> | undefined) {\n this.#writeLive(next);\n }\n\n @syncing.action\n #writeLive(next: Readonly<Record<string, unknown>> | undefined): void {\n writeJsonRecord(this.liveMap, next);\n }\n\n /**\n * Module-load self-report. Omitted `offersJson` / `live` stay\n * (failure must not wipe a previous load).\n */\n @syncing.action\n stampLoad(next: {\n readonly readyState: ReadyState;\n readonly error: string;\n readonly offersJson?: string | null;\n readonly live?: Readonly<Record<string, unknown>>;\n }): void {\n this.readyState = next.readyState;\n this.error = next.error;\n if (next.offersJson !== undefined) this.offersJson = next.offersJson;\n if (next.live !== undefined) this.live = next.live;\n }\n\n /**\n * Class-bootstrap offers. Null, blank, and the string `\"null\"` are no offers.\n * A non-string cell or malformed JSON throws: a silent [] hides a driver defect.\n */\n @computed\n get offers(): readonly object[] {\n return readDriverOffers(this.offersJson);\n }\n\n set offers(next: readonly object[] | null) {\n this.#writeOffers(next);\n }\n\n @syncing.action\n #writeOffers(next: readonly object[] | null): void {\n this.offersJson = next == null ? null : JSON.stringify(next);\n }\n}\n\nexport function readDriverOffers(raw: unknown): object[] {\n if (raw == null) return [];\n invariant(typeof raw === \"string\", \"harness/kernel/offers: offersJson must be a JSON string\");\n const text = raw.trim();\n if (text === \"\" || text === \"null\") return [];\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch (error) {\n throw new Error(\n `harness/kernel/offers: offersJson is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n invariant(Array.isArray(parsed), \"harness/kernel/offers: offersJson must be a JSON array of offer objects\");\n for (const item of parsed) {\n invariant(typeof item === \"object\", \"harness/kernel/offers: offersJson entries must be objects\");\n invariant(item !== null, \"harness/kernel/offers: offersJson entries cannot be null\");\n invariant(!Array.isArray(item), \"harness/kernel/offers: offersJson entries cannot be arrays\");\n }\n return parsed as object[];\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Plexus, type PlexusAwareness, PlexusModel } from "@here.build/plexus";
|
|
2
|
+
export type AwarenessOfPlexus<P extends Plexus<any, any>> = P extends Plexus<any, infer Awareness> ? Awareness : never;
|
|
3
|
+
export declare abstract class IntrospectingPlexusModel<P extends Plexus<any, any> = Plexus<any, any>, Parent extends PlexusModel | null = any> extends PlexusModel<Parent> {
|
|
4
|
+
get plexus(): P | null;
|
|
5
|
+
get awareness(): PlexusAwareness<AwarenessOfPlexus<P>> | null;
|
|
6
|
+
getUniqueLanePresence<T extends string & keyof AwarenessOfPlexus<P>>(lane: T): AwarenessOfPlexus<P>[T] | null;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=IntrospectingPlexusModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntrospectingPlexusModel.d.ts","sourceRoot":"","sources":["../../../src/shared/models/IntrospectingPlexusModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,WAAW,EAEZ,MAAM,oBAAoB,CAAC;AAG5B,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,MAAM,SAAS,CAAC,GAC9F,SAAS,GACT,KAAK,CAAC;AAEV,8BACsB,wBAAwB,CAC5C,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7C,MAAM,SAAS,WAAW,GAAG,IAAI,GAAG,GAAG,CACvC,SAAQ,WAAW,CAAC,MAAM,CAAC;IAC3B,IAAI,MAAM,IAAI,CAAC,GAAG,IAAI,CAOrB;IAED,IAAI,SAAS,IAAI,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAE5D;IAED,qBAAqB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,iBAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAS5G;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { FieldAwareness, PlexusModel, syncing, } from "@here.build/plexus";
|
|
3
|
+
import { docPlexus } from "@here.build/plexus/internals";
|
|
4
|
+
let IntrospectingPlexusModel = (() => {
|
|
5
|
+
let _classDecorators = [syncing("@inhuman.tools/plexus-expectations:IntrospectingPlexusModel")];
|
|
6
|
+
let _classDescriptor;
|
|
7
|
+
let _classExtraInitializers = [];
|
|
8
|
+
let _classThis;
|
|
9
|
+
let _classSuper = PlexusModel;
|
|
10
|
+
var IntrospectingPlexusModel = class extends _classSuper {
|
|
11
|
+
static { _classThis = this; }
|
|
12
|
+
static {
|
|
13
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
14
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
15
|
+
IntrospectingPlexusModel = _classThis = _classDescriptor.value;
|
|
16
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
17
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
18
|
+
}
|
|
19
|
+
get plexus() {
|
|
20
|
+
const doc = this.__doc__;
|
|
21
|
+
if (!doc)
|
|
22
|
+
return null;
|
|
23
|
+
const plexus = docPlexus.get(doc);
|
|
24
|
+
if (!plexus)
|
|
25
|
+
return null;
|
|
26
|
+
// docPlexus is untyped over root/awareness — narrow at the entity boundary.
|
|
27
|
+
return plexus;
|
|
28
|
+
}
|
|
29
|
+
get awareness() {
|
|
30
|
+
return this.plexus?.awareness ?? null;
|
|
31
|
+
}
|
|
32
|
+
getUniqueLanePresence(lane) {
|
|
33
|
+
const hub = this.awareness;
|
|
34
|
+
if (hub == null)
|
|
35
|
+
return null;
|
|
36
|
+
const field = new FieldAwareness(hub, lane);
|
|
37
|
+
for (const id of field.clientIds) {
|
|
38
|
+
const value = field.getOther(id);
|
|
39
|
+
if (value !== undefined)
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return IntrospectingPlexusModel = _classThis;
|
|
46
|
+
})();
|
|
47
|
+
export { IntrospectingPlexusModel };
|
|
48
|
+
//# sourceMappingURL=IntrospectingPlexusModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntrospectingPlexusModel.js","sourceRoot":"","sources":["../../../src/shared/models/IntrospectingPlexusModel.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EAGd,WAAW,EACX,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;IAOnC,wBAAwB;4BAD7C,OAAO,CAAC,6DAA6D,CAAC;;;;sBAI7D,WAAW;wCAAnB,SAAQ,WAAmB;;;;YAH7B,6KA2BC;;;YA3BqB,uDAAwB;;QAI5C,IAAI,MAAM;YACR,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;YACzB,IAAI,CAAC,GAAG;gBAAE,OAAO,IAAI,CAAC;YACtB,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzB,4EAA4E;YAC5E,OAAO,MAAW,CAAC;QACrB,CAAC;QAED,IAAI,SAAS;YACX,OAAO,IAAI,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI,CAAC;QACxC,CAAC;QAED,qBAAqB,CAAgD,IAAO;YAC1E,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;YAC3B,IAAI,GAAG,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAC;YAC7B,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC5C,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;gBACjC,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACjC,IAAI,KAAK,KAAK,SAAS;oBAAE,OAAO,KAAK,CAAC;YACxC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;;;;SA1BmB,wBAAwB","sourcesContent":["import {\n FieldAwareness,\n type Plexus,\n type PlexusAwareness,\n PlexusModel,\n syncing,\n} from \"@here.build/plexus\";\nimport { docPlexus } from \"@here.build/plexus/internals\";\n\nexport type AwarenessOfPlexus<P extends Plexus<any, any>> = P extends Plexus<any, infer Awareness>\n ? Awareness\n : never;\n\n@syncing(\"@inhuman.tools/plexus-expectations:IntrospectingPlexusModel\")\nexport abstract class IntrospectingPlexusModel<\n P extends Plexus<any, any> = Plexus<any, any>,\n Parent extends PlexusModel | null = any,\n> extends PlexusModel<Parent> {\n get plexus(): P | null {\n const doc = this.__doc__;\n if (!doc) return null;\n const plexus = docPlexus.get(doc);\n if (!plexus) return null;\n // docPlexus is untyped over root/awareness — narrow at the entity boundary.\n return plexus as P;\n }\n\n get awareness(): PlexusAwareness<AwarenessOfPlexus<P>> | null {\n return this.plexus?.awareness ?? null;\n }\n\n getUniqueLanePresence<T extends string & keyof AwarenessOfPlexus<P>>(lane: T): AwarenessOfPlexus<P>[T] | null {\n const hub = this.awareness;\n if (hub == null) return null;\n const field = new FieldAwareness(hub, lane);\n for (const id of field.clientIds) {\n const value = field.getOther(id);\n if (value !== undefined) return value;\n }\n return null;\n }\n}\n"]}
|