@listen-fire/engine 0.12.13 → 0.13.1
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/dist/public/adapter-config.d.ts +1 -1
- package/dist/public/adapter-config.js +2 -3
- package/dist/public/adapter.d.ts +1 -1
- package/dist/public/adapter.js +3 -2
- package/dist/public/embed.d.ts +0 -1
- package/dist/public/embed.js +2 -5
- package/dist/public/inbound.d.ts +1 -1
- package/dist/public/inbound.js +6 -4
- package/dist/public/movement-engine.d.ts +1 -1
- package/dist/public/movement-engine.js +1 -2
- package/dist/public/run-host.d.ts +0 -1
- package/dist/public/run-host.js +3 -4
- package/dist/public/testing.d.ts +1 -0
- package/dist/public/testing.js +2 -1
- package/dist/services/embed/in_process_host.d.ts +1 -1
- package/dist/services/embed/in_process_host.js +11 -2
- package/dist/services/embed/introspect.d.ts +1 -1
- package/dist/services/embed/introspect.js +37 -0
- package/dist/services/inbound/contract.d.ts +10 -7
- package/dist/services/inbound/contract.js +106 -113
- package/dist/services/inbound/deliver.d.ts +51 -26
- package/dist/services/inbound/deliver.js +76 -81
- package/dist/services/inbound/push.d.ts +17 -32
- package/dist/services/inbound/push.js +22 -51
- package/dist/services/inbound/verify.d.ts +3 -0
- package/dist/services/inbound/verify.js +15 -2
- package/dist/services/loop_guard/contract.js +7 -50
- package/dist/services/loop_guard/loop_guard.d.ts +0 -22
- package/dist/services/loop_guard/loop_guard.js +10 -26
- package/dist/services/loop_guard/rpc_loop_guard.d.ts +1 -2
- package/dist/services/loop_guard/rpc_loop_guard.js +0 -4
- package/dist/services/movement_engine/binding.d.ts +1 -17
- package/dist/services/movement_engine/host.d.ts +20 -43
- package/dist/services/movement_engine/host_adapter.js +1 -2
- package/dist/services/movement_engine/host_kit.d.ts +3 -3
- package/dist/services/movement_engine/run_types.d.ts +12 -15
- package/dist/services/movement_engine/rust_engine.d.ts +1 -6
- package/dist/services/movement_engine/rust_engine.js +3 -16
- package/dist/services/movement_engine/rust_host.js +60 -53
- package/dist/services/movement_engine/rust_run.d.ts +1 -9
- package/dist/services/movement_engine/rust_run.js +1 -14
- package/dist/services/movement_engine/rust_wire.d.ts +1 -2
- package/dist/services/movement_engine/rust_wire.js +3 -20
- package/dist/services/movement_engine/segment_context.d.ts +1 -2
- package/dist/services/movement_engine/segment_context.js +1 -9
- package/dist/services/movement_engine/test_host.d.ts +2 -1
- package/dist/services/movement_engine/test_host.js +4 -4
- package/dist/services/run_host/contract.d.ts +4 -14
- package/dist/services/run_host/contract.js +312 -322
- package/dist/services/run_host/drain.d.ts +38 -31
- package/dist/services/run_host/drain.js +94 -65
- package/dist/services/run_host/memory_store.d.ts +6 -4
- package/dist/services/run_host/memory_store.js +469 -69
- package/dist/services/run_host/rpc_store.d.ts +33 -37
- package/dist/services/run_host/rpc_store.js +104 -58
- package/dist/services/run_host/rules.d.ts +97 -41
- package/dist/services/run_host/rules.js +192 -68
- package/dist/services/run_host/store.d.ts +420 -144
- package/dist/services/run_host/store.js +32 -3
- package/dist/services/run_host/store_waits.d.ts +14 -0
- package/dist/services/run_host/store_waits.js +385 -0
- package/dist/services/translation_graph/adapters/remote/index.d.ts +12 -20
- package/dist/services/translation_graph/adapters/remote/index.js +12 -26
- package/dist/services/translation_graph/engine/adapter_table.d.ts +6 -0
- package/dist/services/translation_graph/engine/adapter_table.js +18 -7
- package/dist/services/translation_graph/movement/catalog_snapshot.d.ts +5 -19
- package/dist/services/translation_graph/movement/catalog_snapshot.js +7 -75
- package/dist/services/translation_graph/movement/schema_projection.d.ts +10 -7
- package/dist/services/translation_graph/movement/schema_projection.js +99 -53
- package/dist/services/translation_graph/triggers/listen_config.d.ts +0 -54
- package/dist/services/translation_graph/triggers/listen_config.js +1 -104
- package/dist/services/translation_graph/triggers/listen_plans.d.ts +172 -0
- package/dist/services/translation_graph/triggers/listen_plans.js +287 -0
- package/dist/services/translation_graph/triggers/trigger_event.d.ts +2 -0
- package/dist/services/translation_graph/triggers/trigger_event.js +2 -0
- package/package.json +4 -4
- package/dist/services/run_host/callbacks.d.ts +0 -156
- package/dist/services/run_host/callbacks.js +0 -266
- package/dist/services/translation_graph/movement/file_listeners.d.ts +0 -27
- package/dist/services/translation_graph/movement/file_listeners.js +0 -113
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '@listen-fire/engine-contracts/
|
|
1
|
+
export * from '@listen-fire/engine-contracts/config_blocks';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// How an adapter's configuration is declared and validated: the config blocks
|
|
3
|
-
// a
|
|
4
|
-
// them).
|
|
3
|
+
// a construction form is built from (and the zod schema derived from them).
|
|
5
4
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
5
|
if (k2 === undefined) k2 = k;
|
|
7
6
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -17,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
17
16
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
17
|
};
|
|
19
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
__exportStar(require("@listen-fire/engine-contracts/
|
|
19
|
+
__exportStar(require("@listen-fire/engine-contracts/config_blocks"), exports);
|
package/dist/public/adapter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '../services/translation_graph/adapter';
|
|
2
2
|
export { normalizeAdapterType } from '../services/translation_graph/adapter_type';
|
|
3
|
-
export * from '@listen-fire/engine-contracts/
|
|
3
|
+
export * from '@listen-fire/engine-contracts/arrivals';
|
|
4
4
|
export { newDryRunRehearsal, wrapAdapterForDryRun, type CapturedWrite, type DryRunRehearsal, type DryRunWriteSink, } from '../services/translation_graph/engine/dry_run_adapter';
|
|
5
5
|
export * from '@listen-fire/engine-contracts/mutation_context';
|
|
6
6
|
export { ADAPTER_TEAM_HEADER, RemoteProtocolError, RemoteResponseShapeError, RemoteTransportError, authHeader, parseWireResult, postRpc, type AuthStrategy, } from '../services/translation_graph/protocol/client';
|
package/dist/public/adapter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// What an adapter is: its manifest, the live instance a run calls, the
|
|
3
|
-
//
|
|
3
|
+
// arrivals capability (adapter protocol 2.5), the dry-run wrapper, and the
|
|
4
|
+
// type name rules.
|
|
4
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
6
|
if (k2 === undefined) k2 = k;
|
|
6
7
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -20,7 +21,7 @@ exports.postRpc = exports.parseWireResult = exports.authHeader = exports.RemoteT
|
|
|
20
21
|
__exportStar(require("../services/translation_graph/adapter"), exports);
|
|
21
22
|
var adapter_type_1 = require("../services/translation_graph/adapter_type");
|
|
22
23
|
Object.defineProperty(exports, "normalizeAdapterType", { enumerable: true, get: function () { return adapter_type_1.normalizeAdapterType; } });
|
|
23
|
-
__exportStar(require("@listen-fire/engine-contracts/
|
|
24
|
+
__exportStar(require("@listen-fire/engine-contracts/arrivals"), exports);
|
|
24
25
|
var dry_run_adapter_1 = require("../services/translation_graph/engine/dry_run_adapter");
|
|
25
26
|
Object.defineProperty(exports, "newDryRunRehearsal", { enumerable: true, get: function () { return dry_run_adapter_1.newDryRunRehearsal; } });
|
|
26
27
|
Object.defineProperty(exports, "wrapAdapterForDryRun", { enumerable: true, get: function () { return dry_run_adapter_1.wrapAdapterForDryRun; } });
|
package/dist/public/embed.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { CredentialNotTenants, type CredentialOwnership } from '../services/tran
|
|
|
3
3
|
export { introspectAdapter } from '../services/embed/introspect';
|
|
4
4
|
export { memoryRunHostStore } from '../services/run_host/memory_store';
|
|
5
5
|
export { InMemoryWriteLocks, type WriteLocks } from '../services/write_locks/write_locks';
|
|
6
|
-
export { collectFileListeners, type FileListener } from '../services/translation_graph/movement/file_listeners';
|
|
7
6
|
export { MovementEngineError, isCheckFailure, type MovementEngineErrorCode } from '../services/movement_engine/errors';
|
|
8
7
|
export { pricedModels, type ExtractCallModelClient, type ModelClient } from '../services/embed/models';
|
|
9
8
|
export type { LlmCallInput, LlmCallResult } from '../services/translation_graph/engine/batched_extraction/llm_call';
|
package/dist/public/embed.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Embedding the engine in another product's own process: the in-process host
|
|
3
3
|
// to fill with the embedder's own parts (its adapters, models, files, parks),
|
|
4
4
|
// the write locks it starts from, the instance schema it reads off each
|
|
5
|
-
// adapter it loaded,
|
|
6
|
-
// (its `listen` statements), and an in-memory store for runs that `await` or
|
|
5
|
+
// adapter it loaded, and an in-memory store for runs that `await` or
|
|
7
6
|
// `sleep`. docs/embedding.md walks through it.
|
|
8
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.pricedModels = exports.isCheckFailure = exports.MovementEngineError = exports.
|
|
8
|
+
exports.pricedModels = exports.isCheckFailure = exports.MovementEngineError = exports.InMemoryWriteLocks = exports.memoryRunHostStore = exports.introspectAdapter = exports.CredentialNotTenants = exports.inProcessHost = void 0;
|
|
10
9
|
var in_process_host_1 = require("../services/embed/in_process_host");
|
|
11
10
|
Object.defineProperty(exports, "inProcessHost", { enumerable: true, get: function () { return in_process_host_1.inProcessHost; } });
|
|
12
11
|
var adapter_table_1 = require("../services/translation_graph/engine/adapter_table");
|
|
@@ -17,8 +16,6 @@ var memory_store_1 = require("../services/run_host/memory_store");
|
|
|
17
16
|
Object.defineProperty(exports, "memoryRunHostStore", { enumerable: true, get: function () { return memory_store_1.memoryRunHostStore; } });
|
|
18
17
|
var write_locks_1 = require("../services/write_locks/write_locks");
|
|
19
18
|
Object.defineProperty(exports, "InMemoryWriteLocks", { enumerable: true, get: function () { return write_locks_1.InMemoryWriteLocks; } });
|
|
20
|
-
var file_listeners_1 = require("../services/translation_graph/movement/file_listeners");
|
|
21
|
-
Object.defineProperty(exports, "collectFileListeners", { enumerable: true, get: function () { return file_listeners_1.collectFileListeners; } });
|
|
22
19
|
var errors_1 = require("../services/movement_engine/errors");
|
|
23
20
|
Object.defineProperty(exports, "MovementEngineError", { enumerable: true, get: function () { return errors_1.MovementEngineError; } });
|
|
24
21
|
Object.defineProperty(exports, "isCheckFailure", { enumerable: true, get: function () { return errors_1.isCheckFailure; } });
|
package/dist/public/inbound.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from '../services/translation_graph/triggers/types';
|
|
2
2
|
export * from '../services/translation_graph/triggers/trigger_event';
|
|
3
3
|
export * from '../services/translation_graph/triggers/listen_config';
|
|
4
|
+
export * from '../services/translation_graph/triggers/listen_plans';
|
|
4
5
|
export * from '../services/translation_graph/engine/inbound/discriminate';
|
|
5
6
|
export * from '../services/webhook_sync/remote_inbound';
|
|
6
7
|
export * from '../services/inbound/verify';
|
|
@@ -8,4 +9,3 @@ export * from '../services/inbound/deliver';
|
|
|
8
9
|
export * from '../services/inbound/push';
|
|
9
10
|
export * from '../services/inbound/shared';
|
|
10
11
|
export * from '../services/inbound/contract';
|
|
11
|
-
export * from '../services/translation_graph/movement/file_listeners';
|
package/dist/public/inbound.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Inbound events: the trigger event a run starts from, the
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// Inbound events: the trigger event a run starts from, the connection each
|
|
3
|
+
// listen is on, the plans its check answers for its listens and the judge of
|
|
4
|
+
// whether an arrival fires one, which connection's deliveries a listen hears,
|
|
5
|
+
// discrimination, the remote delivery signature, and the doors a module
|
|
6
|
+
// pushes through.
|
|
5
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
8
|
if (k2 === undefined) k2 = k;
|
|
7
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -20,6 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
22
|
__exportStar(require("../services/translation_graph/triggers/types"), exports);
|
|
21
23
|
__exportStar(require("../services/translation_graph/triggers/trigger_event"), exports);
|
|
22
24
|
__exportStar(require("../services/translation_graph/triggers/listen_config"), exports);
|
|
25
|
+
__exportStar(require("../services/translation_graph/triggers/listen_plans"), exports);
|
|
23
26
|
__exportStar(require("../services/translation_graph/engine/inbound/discriminate"), exports);
|
|
24
27
|
__exportStar(require("../services/webhook_sync/remote_inbound"), exports);
|
|
25
28
|
__exportStar(require("../services/inbound/verify"), exports);
|
|
@@ -27,4 +30,3 @@ __exportStar(require("../services/inbound/deliver"), exports);
|
|
|
27
30
|
__exportStar(require("../services/inbound/push"), exports);
|
|
28
31
|
__exportStar(require("../services/inbound/shared"), exports);
|
|
29
32
|
__exportStar(require("../services/inbound/contract"), exports);
|
|
30
|
-
__exportStar(require("../services/translation_graph/movement/file_listeners"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { resumeMovement, runMovement, settleRaceFrame } from '../services/movement_engine/rust_run';
|
|
2
2
|
export { MovementRunFailed, RunCancelledSignal, runFailureCause } from '../services/movement_engine/errors';
|
|
3
3
|
export type { CancelGate, MovementRunResult, MovementWriteRecord, ParkSink, ResumeMovementInput, RunLimitPause, RunMovementInput, } from '../services/movement_engine/run_types';
|
|
4
4
|
export { assertEngineConfigured } from '../services/movement_engine/rust_engine';
|
|
@@ -29,10 +29,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
return result;
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.ENGINE_VERSION = exports.checkInputOf = exports.throwIfBlocking = exports.parsePinned = exports.checkPinnedInRust = exports.checkAnswerInRust = exports.programCheck = exports.assertEngineConfigured = exports.runFailureCause = exports.RunCancelledSignal = exports.MovementRunFailed = exports.settleRaceFrame = exports.runMovement = exports.resumeMovement =
|
|
32
|
+
exports.ENGINE_VERSION = exports.checkInputOf = exports.throwIfBlocking = exports.parsePinned = exports.checkPinnedInRust = exports.checkAnswerInRust = exports.programCheck = exports.assertEngineConfigured = exports.runFailureCause = exports.RunCancelledSignal = exports.MovementRunFailed = exports.settleRaceFrame = exports.runMovement = exports.resumeMovement = void 0;
|
|
33
33
|
const movement_lang_1 = require("@listen-fire/movement-lang");
|
|
34
34
|
var rust_run_1 = require("../services/movement_engine/rust_run");
|
|
35
|
-
Object.defineProperty(exports, "fireCallbackBody", { enumerable: true, get: function () { return rust_run_1.fireCallbackBody; } });
|
|
36
35
|
Object.defineProperty(exports, "resumeMovement", { enumerable: true, get: function () { return rust_run_1.resumeMovement; } });
|
|
37
36
|
Object.defineProperty(exports, "runMovement", { enumerable: true, get: function () { return rust_run_1.runMovement; } });
|
|
38
37
|
Object.defineProperty(exports, "settleRaceFrame", { enumerable: true, get: function () { return rust_run_1.settleRaceFrame; } });
|
package/dist/public/run-host.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// The run host: the store a shell keeps for parked runs, joins,
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// The run host: the store a shell keeps for parked runs, joins, the waits
|
|
3
|
+
// their awaits read and the arrivals logged for them, and work; the rules and
|
|
4
|
+
// drain loop that advance a run over it.
|
|
5
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
6
|
if (k2 === undefined) k2 = k;
|
|
7
7
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -22,4 +22,3 @@ __exportStar(require("../services/run_host/memory_store"), exports);
|
|
|
22
22
|
__exportStar(require("../services/run_host/rules"), exports);
|
|
23
23
|
__exportStar(require("../services/run_host/lease"), exports);
|
|
24
24
|
__exportStar(require("../services/run_host/drain"), exports);
|
|
25
|
-
__exportStar(require("../services/run_host/callbacks"), exports);
|
package/dist/public/testing.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from '../services/movement_engine/test_host';
|
|
2
2
|
export * from '../services/run_host/contract';
|
|
3
|
+
export * from '../services/run_host/store_waits';
|
|
3
4
|
export * from '../services/browser/contract';
|
|
4
5
|
export * from '../services/browser/fake_browser';
|
|
5
6
|
export * from '../services/limiter/contract';
|
package/dist/public/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// For test files only: a ready test host, its fakes, the run host's contract
|
|
3
|
-
// cases a store implementation must pass, and the browser slot's contract
|
|
3
|
+
// cases and the waits cases a store implementation must pass, and the browser slot's contract
|
|
4
4
|
// cases with a scripted page to hold a module to them without a browser, and
|
|
5
5
|
// the limiter slot's contract cases a limiter implementation must pass.
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.RpcStoreBackend = void 0;
|
|
22
22
|
__exportStar(require("../services/movement_engine/test_host"), exports);
|
|
23
23
|
__exportStar(require("../services/run_host/contract"), exports);
|
|
24
|
+
__exportStar(require("../services/run_host/store_waits"), exports);
|
|
24
25
|
__exportStar(require("../services/browser/contract"), exports);
|
|
25
26
|
__exportStar(require("../services/browser/fake_browser"), exports);
|
|
26
27
|
__exportStar(require("../services/limiter/contract"), exports);
|
|
@@ -17,7 +17,7 @@ export interface InProcessHostOptions {
|
|
|
17
17
|
credentials?: CredentialOwnership;
|
|
18
18
|
/** The models slot: the model calls a run makes. Absent ⇒ refused by name. */
|
|
19
19
|
llm?: Partial<EngineHost['llm']>;
|
|
20
|
-
/** The store slot's run half: where parks,
|
|
20
|
+
/** The store slot's run half: where parks, waits and pinned texts go.
|
|
21
21
|
* Absent ⇒ a run that parks fails (it has no durable substrate). */
|
|
22
22
|
park?: Partial<EngineHost['park']>;
|
|
23
23
|
control?: Partial<EngineHost['control']>;
|
|
@@ -58,7 +58,7 @@ function inProcessHost(options = {}) {
|
|
|
58
58
|
},
|
|
59
59
|
park: {
|
|
60
60
|
...(park.sink !== undefined ? { sink: park.sink } : {}),
|
|
61
|
-
...(park.
|
|
61
|
+
...(park.waits !== undefined ? { waits: park.waits } : {}),
|
|
62
62
|
...(park.sources !== undefined ? { sources: park.sources } : {}),
|
|
63
63
|
wake: park.wake ?? refused('park.wake'),
|
|
64
64
|
bindings: park.bindings ?? {
|
|
@@ -92,7 +92,16 @@ function inProcessHost(options = {}) {
|
|
|
92
92
|
return (0, host_kit_1.actingPrincipalOf)(await resolve({
|
|
93
93
|
teamId: segments.facts(segmentId).teamId,
|
|
94
94
|
...(triggerId !== undefined ? { triggerId } : {}),
|
|
95
|
-
|
|
95
|
+
// The module's own candidates where it offers them (an API lookup,
|
|
96
|
+
// a mail's relays); else who acted on the arrival, as its module
|
|
97
|
+
// said at the door (adapter protocol 2.7).
|
|
98
|
+
getCandidates: async () => {
|
|
99
|
+
if (table.offers({ segmentId, instance, method: 'getActorCandidates' })) {
|
|
100
|
+
return table.answer({ segmentId, instance, method: 'getActorCandidates', args: { event } });
|
|
101
|
+
}
|
|
102
|
+
const actor = event.arrival?.actor;
|
|
103
|
+
return actor === undefined ? [] : [{ identity: actor, source: 'originator' }];
|
|
104
|
+
},
|
|
96
105
|
}));
|
|
97
106
|
},
|
|
98
107
|
},
|
|
@@ -2,7 +2,7 @@ import type { InstanceSchema } from '@listen-fire/movement-lang';
|
|
|
2
2
|
import type { Adapter, AdapterManifest } from '../translation_graph/adapter';
|
|
3
3
|
/** The instance schema `adapter` answers today, with the projection's notes
|
|
4
4
|
* (a name two entries share, a type it could not describe). */
|
|
5
|
-
export declare function introspectAdapter(adapter: Adapter, manifest: Pick<AdapterManifest, 'adapterType' | 'methods'>): Promise<{
|
|
5
|
+
export declare function introspectAdapter(adapter: Adapter, manifest: Pick<AdapterManifest, 'adapterType' | 'methods' | 'listenSettingsBecome'>): Promise<{
|
|
6
6
|
schema: InstanceSchema;
|
|
7
7
|
notes: string[];
|
|
8
8
|
}>;
|
|
@@ -6,13 +6,50 @@
|
|
|
6
6
|
// them of the adapter it loaded in process.
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.introspectAdapter = introspectAdapter;
|
|
9
|
+
const catalog_1 = require("@listen-fire/engine-contracts/catalog");
|
|
9
10
|
const schema_projection_1 = require("../translation_graph/movement/schema_projection");
|
|
10
11
|
/** The instance schema `adapter` answers today, with the projection's notes
|
|
11
12
|
* (a name two entries share, a type it could not describe). */
|
|
12
13
|
async function introspectAdapter(adapter, manifest) {
|
|
14
|
+
const retiredInManifest = (0, catalog_1.retiredEntryKey)(manifest.adapterType, manifest, catalog_1.RETIRED_MANIFEST_KEYS);
|
|
15
|
+
if (retiredInManifest !== undefined)
|
|
16
|
+
throw new Error(`${manifest.adapterType}: ${retiredInManifest}`);
|
|
13
17
|
const entries = await adapter.listEntryPoints();
|
|
18
|
+
for (const entry of entries) {
|
|
19
|
+
const refusal = (0, catalog_1.retiredEntryKey)(entry.typeId, entry, catalog_1.RETIRED_ENTRY_KEYS);
|
|
20
|
+
if (refusal !== undefined)
|
|
21
|
+
throw new Error(`${manifest.adapterType}: ${refusal}`);
|
|
22
|
+
}
|
|
14
23
|
const described = await Promise.all(entries.map(async (entry) => [entry.typeId, await adapter.describe(entry.typeId)]));
|
|
15
24
|
const descriptors = new Map(described.flatMap(([typeId, descriptor]) => (descriptor ? [[typeId, descriptor]] : [])));
|
|
25
|
+
for (const [typeId, descriptor] of descriptors) {
|
|
26
|
+
for (const field of descriptor.fields) {
|
|
27
|
+
const refusal = (0, catalog_1.unreadableOwnedField)(field) ?? (0, catalog_1.unreadableRecordField)(field);
|
|
28
|
+
if (refusal !== undefined)
|
|
29
|
+
throw new Error(`${manifest.adapterType} describes '${typeId}': ${refusal}`);
|
|
30
|
+
}
|
|
31
|
+
for (const reference of descriptor.references) {
|
|
32
|
+
const refusal = (0, catalog_1.undeclaredArrivalField)(reference, descriptors) ??
|
|
33
|
+
(0, catalog_1.unreadableLiteralsFrom)(reference, descriptors) ??
|
|
34
|
+
(0, catalog_1.unreadableAnswerShapeFrom)(reference, descriptor, descriptors) ??
|
|
35
|
+
(0, catalog_1.unreadableListening)({ reference, owner: typeId }, entries, descriptors);
|
|
36
|
+
if (refusal !== undefined)
|
|
37
|
+
throw new Error(`${manifest.adapterType} describes '${typeId}': ${refusal}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (const entry of entries) {
|
|
41
|
+
const refusal = (0, catalog_1.unreadableListening)({ entry }, entries, descriptors);
|
|
42
|
+
if (refusal !== undefined)
|
|
43
|
+
throw new Error(`${manifest.adapterType} lists '${entry.typeId}': ${refusal}`);
|
|
44
|
+
}
|
|
45
|
+
const ambiguous = (0, catalog_1.ambiguousArrivals)(entries, descriptors);
|
|
46
|
+
if (ambiguous !== undefined)
|
|
47
|
+
throw new Error(`${manifest.adapterType} declares ${ambiguous}`);
|
|
48
|
+
if (manifest.listenSettingsBecome !== undefined) {
|
|
49
|
+
const refusal = (0, catalog_1.unreadableSettingsBecome)(manifest.listenSettingsBecome, entries, descriptors);
|
|
50
|
+
if (refusal !== undefined)
|
|
51
|
+
throw new Error(`${manifest.adapterType} declares ${refusal}`);
|
|
52
|
+
}
|
|
16
53
|
return (0, schema_projection_1.instanceSchemaFromDescriptors)({
|
|
17
54
|
adapterType: manifest.adapterType,
|
|
18
55
|
entries,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Arrival } from '@listen-fire/engine-contracts';
|
|
1
2
|
import type { DiscriminableEvent } from '../translation_graph/adapter';
|
|
2
3
|
import type { DeliveryHost, InboundIntercept, InboundStore } from './deliver';
|
|
3
4
|
import type { PushStore } from './push';
|
|
@@ -33,12 +34,13 @@ export interface ContractWorld {
|
|
|
33
34
|
faults: {
|
|
34
35
|
/** Capturing the event whose payload has `fail: true` throws. */
|
|
35
36
|
captureMarked?: boolean;
|
|
36
|
-
/**
|
|
37
|
+
/** Keeping a delivery with any captured event throws. */
|
|
37
38
|
enqueue?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
/** Keeping the delivery that captured the event whose payload has
|
|
40
|
+
* `fail: true` throws, the first time only: the sender's retry is kept. */
|
|
41
|
+
enqueueMarkedOnce?: boolean;
|
|
42
|
+
/** Keeping a delivery's arrivals throws. */
|
|
43
|
+
logArrivals?: boolean;
|
|
42
44
|
};
|
|
43
45
|
/** The subscription's deliveries are synthetic: no signature check, drained before the ack. */
|
|
44
46
|
synthetic?: boolean;
|
|
@@ -47,7 +49,8 @@ export interface ContractWorld {
|
|
|
47
49
|
export interface ContractObservations {
|
|
48
50
|
captured: number;
|
|
49
51
|
enqueued: number;
|
|
50
|
-
|
|
52
|
+
/** Every arrival logged, in order. */
|
|
53
|
+
arrivals: Arrival[];
|
|
51
54
|
checkpoints: unknown[];
|
|
52
55
|
notified: number;
|
|
53
56
|
}
|
|
@@ -83,6 +86,6 @@ export declare const DELIVERY_RECEIPT_CONTRACT_CASES: DeliveryReceiptContractCas
|
|
|
83
86
|
export declare function memoryInboundStores(arranged: ContractWorld): {
|
|
84
87
|
store: InboundStore<DiscriminableEvent>;
|
|
85
88
|
host: DeliveryHost<DiscriminableEvent>;
|
|
86
|
-
push: PushStore
|
|
89
|
+
push: PushStore;
|
|
87
90
|
observed(): ContractObservations;
|
|
88
91
|
};
|