@crvouga/mockingbird-service-eventbridge 1.6.0 → 1.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/CHANGELOG.md +7 -1
- package/dist/{chunk-3MFLVQL3.js → chunk-LYDM4GWT.js} +103 -12
- package/dist/chunk-LYDM4GWT.js.map +7 -0
- package/dist/{chunk-V3532EMQ.js → chunk-S3JSAF35.js} +111 -27
- package/dist/chunk-S3JSAF35.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +28 -0
- package/dist/index.js +1 -1
- package/dist/server.d.ts +69 -0
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-3MFLVQL3.js.map +0 -7
- package/dist/chunk-V3532EMQ.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-eventbridge
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.7.0 (2026-10-19)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- resolve the agent-reported issue queue in one batch ([25c52b6](https://github.com/crvouga/mockingbird/commit/25c52b668a53ddb80b968419601a20abf33f956b))
|
|
8
|
+
|
|
9
|
+
## 1.6.0 (2026-10-16)
|
|
4
10
|
|
|
5
11
|
### Features
|
|
6
12
|
|
|
@@ -4,17 +4,31 @@ import {
|
|
|
4
4
|
createRuntime2,
|
|
5
5
|
normalizeBootControls,
|
|
6
6
|
normalizeControls,
|
|
7
|
+
normalizeIdBase,
|
|
7
8
|
ownedTransport,
|
|
8
9
|
parseDuration,
|
|
9
10
|
parseFaultHeader,
|
|
10
11
|
resolveAdminPrefix,
|
|
11
12
|
restoreClock
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-S3JSAF35.js";
|
|
13
14
|
|
|
14
15
|
// ../../adapters/node/dist/cli.js
|
|
15
16
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
16
17
|
import { parseArgs } from "node:util";
|
|
17
18
|
|
|
19
|
+
// ../../adapters/node/dist/boot-settings.js
|
|
20
|
+
var checkSettings = (target, settings, label) => {
|
|
21
|
+
if (!target.parseSettings)
|
|
22
|
+
throw new Error(`${label}: ${target.name} takes no boot settings`);
|
|
23
|
+
try {
|
|
24
|
+
return target.parseSettings(settings);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw new Error(`${label}: ${error instanceof Error ? error.message : String(error)}`, {
|
|
27
|
+
cause: error
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
18
32
|
// ../../adapters/node/dist/fleet.js
|
|
19
33
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
20
34
|
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
@@ -2664,6 +2678,9 @@ var fleet_config_schema_default = {
|
|
|
2664
2678
|
adminControls: {
|
|
2665
2679
|
$ref: "#/$defs/controls"
|
|
2666
2680
|
},
|
|
2681
|
+
idBase: {
|
|
2682
|
+
$ref: "#/$defs/idBase"
|
|
2683
|
+
},
|
|
2667
2684
|
namespace: {
|
|
2668
2685
|
type: "string",
|
|
2669
2686
|
pattern: "^[A-Za-z0-9_.-]{1,64}$"
|
|
@@ -2753,6 +2770,12 @@ var fleet_config_schema_default = {
|
|
|
2753
2770
|
adminControls: {
|
|
2754
2771
|
$ref: "#/$defs/controls"
|
|
2755
2772
|
},
|
|
2773
|
+
idBase: {
|
|
2774
|
+
$ref: "#/$defs/idBase"
|
|
2775
|
+
},
|
|
2776
|
+
settings: {
|
|
2777
|
+
type: "object"
|
|
2778
|
+
},
|
|
2756
2779
|
fixtures: {
|
|
2757
2780
|
type: "object"
|
|
2758
2781
|
},
|
|
@@ -2799,6 +2822,18 @@ var fleet_config_schema_default = {
|
|
|
2799
2822
|
}
|
|
2800
2823
|
}
|
|
2801
2824
|
},
|
|
2825
|
+
idBase: {
|
|
2826
|
+
anyOf: [
|
|
2827
|
+
{
|
|
2828
|
+
type: "integer",
|
|
2829
|
+
minimum: 0
|
|
2830
|
+
},
|
|
2831
|
+
{
|
|
2832
|
+
type: "string",
|
|
2833
|
+
pattern: "^(boot|[0-9]+)$"
|
|
2834
|
+
}
|
|
2835
|
+
]
|
|
2836
|
+
},
|
|
2802
2837
|
controls: {
|
|
2803
2838
|
type: "object",
|
|
2804
2839
|
additionalProperties: false,
|
|
@@ -2948,6 +2983,8 @@ async function preflightFleet(config, options) {
|
|
|
2948
2983
|
throw new Error("protected archive policy requires a protected repository; configure its protector before startup");
|
|
2949
2984
|
resolveAdminPrefix(config.adminPrefix);
|
|
2950
2985
|
normalizeBootControls(config.adminControls);
|
|
2986
|
+
if (config.idBase !== void 0)
|
|
2987
|
+
normalizeIdBase(config.idBase, "idBase");
|
|
2951
2988
|
const targets = /* @__PURE__ */ new Map();
|
|
2952
2989
|
const ports = /* @__PURE__ */ new Set();
|
|
2953
2990
|
for (const [name, entry] of Object.entries(config.services)) {
|
|
@@ -2979,6 +3016,13 @@ async function preflightFleet(config, options) {
|
|
|
2979
3016
|
throw new Error("invalid protocol namespace selector");
|
|
2980
3017
|
}
|
|
2981
3018
|
}
|
|
3019
|
+
if (entry.idBase !== void 0)
|
|
3020
|
+
normalizeIdBase(entry.idBase, "idBase");
|
|
3021
|
+
if (entry.settings !== void 0) {
|
|
3022
|
+
if (protocol !== "http" || !("create" in target))
|
|
3023
|
+
throw new Error("settings: only HTTP services take boot settings");
|
|
3024
|
+
checkSettings(target, entry.settings, "settings");
|
|
3025
|
+
}
|
|
2982
3026
|
const port = entry.port ?? target.defaultPort;
|
|
2983
3027
|
if (port !== 0) {
|
|
2984
3028
|
const key = `${entry.host ?? "127.0.0.1"}:${port}`;
|
|
@@ -3014,7 +3058,7 @@ async function preflightFleet(config, options) {
|
|
|
3014
3058
|
break;
|
|
3015
3059
|
}
|
|
3016
3060
|
}
|
|
3017
|
-
targets.set(name, { ...target, packageVersion: packageVersion ?? "1.
|
|
3061
|
+
targets.set(name, { ...target, packageVersion: packageVersion ?? "1.7.0" });
|
|
3018
3062
|
} catch (error) {
|
|
3019
3063
|
throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
3020
3064
|
}
|
|
@@ -3334,6 +3378,7 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3334
3378
|
options.onLog?.(entry2);
|
|
3335
3379
|
},
|
|
3336
3380
|
...entry.adminControls !== void 0 ? { adminControls: entry.adminControls } : {},
|
|
3381
|
+
...entry.settings !== void 0 ? { settings: checkSettings(target, entry.settings, "settings") } : {},
|
|
3337
3382
|
...entry.fixtures !== void 0 ? { fixtures: entry.fixtures } : {},
|
|
3338
3383
|
...(advertisedHttpBase(entry) ?? entry.baseUrl) !== void 0 ? { baseUrl: advertisedHttpBase(entry) ?? entry.baseUrl } : {}
|
|
3339
3384
|
});
|
|
@@ -3352,6 +3397,8 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3352
3397
|
].some((method) => typeof created[method] !== "function"))
|
|
3353
3398
|
throw new Error("HTTP target does not implement the fleet runtime protocol; build/install matching supported service versions");
|
|
3354
3399
|
const runtime = created;
|
|
3400
|
+
if (entry.idBase !== void 0)
|
|
3401
|
+
runtime.setIdBase?.(entry.idBase);
|
|
3355
3402
|
const unobserve = runtime.webhooks?.observeDeliveries(observer.delivery);
|
|
3356
3403
|
if (options.outbound && runtime.webhooks)
|
|
3357
3404
|
runtime.webhooks.setTransportPolicy(ownedTransport(options.outbound));
|
|
@@ -3950,6 +3997,7 @@ async function startFleet(config, options) {
|
|
|
3950
3997
|
...entry,
|
|
3951
3998
|
adminPrefix: resolveAdminPrefix(entry.adminPrefix ?? adminPrefix),
|
|
3952
3999
|
...adminKey !== void 0 ? { adminKey } : {},
|
|
4000
|
+
...(entry.idBase ?? config.idBase) !== void 0 ? { idBase: entry.idBase ?? config.idBase } : {},
|
|
3953
4001
|
// Fleet-wide controls, with the service's own keys replacing them.
|
|
3954
4002
|
...config.adminControls !== void 0 || entry.adminControls !== void 0 ? { adminControls: { ...config.adminControls, ...entry.adminControls } } : {}
|
|
3955
4003
|
}, options, (namespace, request) => management?.admit(namespace, request), (namespace) => management?.generation(namespace), (namespace, request) => management?.privateRequest(namespace, request) ?? false, {
|
|
@@ -4634,6 +4682,16 @@ var COMMON_SERVE_OPTIONS = {
|
|
|
4634
4682
|
value: "<seed>",
|
|
4635
4683
|
description: "Seed for every random choice (env MOCKINGBIRD_SEED)"
|
|
4636
4684
|
},
|
|
4685
|
+
"id-base": {
|
|
4686
|
+
type: "string",
|
|
4687
|
+
value: "<n|boot>",
|
|
4688
|
+
description: "Start generated ids at this base so a restart does not reissue the last boot's ids; boot derives one from the clock (env MOCKINGBIRD_ID_BASE; default 0, the same ids every boot)"
|
|
4689
|
+
},
|
|
4690
|
+
settings: {
|
|
4691
|
+
type: "string",
|
|
4692
|
+
value: "<json|file>",
|
|
4693
|
+
description: "Service settings to boot with, as JSON or a JSON file; every namespace starts from them (env MOCKINGBIRD_SETTINGS; only for services that declare settings)"
|
|
4694
|
+
},
|
|
4637
4695
|
"admin-controls": {
|
|
4638
4696
|
type: "string",
|
|
4639
4697
|
value: "<json|file>",
|
|
@@ -4728,19 +4786,40 @@ var readJsonFile = async (path, label) => {
|
|
|
4728
4786
|
}
|
|
4729
4787
|
};
|
|
4730
4788
|
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4789
|
+
var readJsonOption = async (source, label) => {
|
|
4790
|
+
const trimmed = source.trim();
|
|
4791
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
4792
|
+
try {
|
|
4793
|
+
return JSON.parse(trimmed);
|
|
4794
|
+
} catch {
|
|
4795
|
+
throw new Error(`${label}: not valid JSON`);
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4798
|
+
return readJsonFile(source, label);
|
|
4799
|
+
};
|
|
4800
|
+
var resolveServeIdBase = (values, env = process.env) => {
|
|
4801
|
+
const source = asString(values["id-base"]) ?? env.MOCKINGBIRD_ID_BASE;
|
|
4802
|
+
if (source === void 0 || source.trim() === "")
|
|
4803
|
+
return void 0;
|
|
4804
|
+
normalizeIdBase(source.trim(), "--id-base");
|
|
4805
|
+
return source.trim();
|
|
4806
|
+
};
|
|
4807
|
+
var resolveServeSettings = async (target, values, env = process.env) => {
|
|
4808
|
+
const flag = asString(values.settings);
|
|
4809
|
+
const source = flag ?? env.MOCKINGBIRD_SETTINGS;
|
|
4810
|
+
if (source === void 0 || source.trim() === "")
|
|
4811
|
+
return void 0;
|
|
4812
|
+
const label = flag !== void 0 ? "--settings" : "MOCKINGBIRD_SETTINGS";
|
|
4813
|
+
const parsed = await readJsonOption(source, label);
|
|
4814
|
+
if (!isObject2(parsed))
|
|
4815
|
+
throw new Error(`${label}: expected a JSON object`);
|
|
4816
|
+
return checkSettings(target, parsed, label);
|
|
4817
|
+
};
|
|
4731
4818
|
var resolveServeControls = async (values, env = process.env, base) => {
|
|
4732
4819
|
const source = asString(values["admin-controls"]) ?? env.MOCKINGBIRD_ADMIN_CONTROLS;
|
|
4733
4820
|
let document = isObject2(base) ? { ...base } : {};
|
|
4734
4821
|
if (source !== void 0 && source.trim() !== "") {
|
|
4735
|
-
|
|
4736
|
-
if (source.trim().startsWith("{")) {
|
|
4737
|
-
try {
|
|
4738
|
-
parsed = JSON.parse(source);
|
|
4739
|
-
} catch {
|
|
4740
|
-
throw new Error("--admin-controls: not valid JSON");
|
|
4741
|
-
}
|
|
4742
|
-
} else
|
|
4743
|
-
parsed = await readJsonFile(source, "--admin-controls");
|
|
4822
|
+
const parsed = source.trim().startsWith("{") ? await readJsonOption(source, "--admin-controls") : await readJsonFile(source, "--admin-controls");
|
|
4744
4823
|
if (!isObject2(parsed))
|
|
4745
4824
|
throw new Error("--admin-controls: expected a JSON object");
|
|
4746
4825
|
document = { ...document, ...parsed };
|
|
@@ -4790,8 +4869,11 @@ var start = async (target, values, config) => {
|
|
|
4790
4869
|
adminKey: config.adminKey,
|
|
4791
4870
|
seed: config.seed,
|
|
4792
4871
|
onLog: formatLog(config.log),
|
|
4872
|
+
...config.settings !== void 0 ? { settings: config.settings } : {},
|
|
4793
4873
|
...config.adminControls !== void 0 ? { adminControls: config.adminControls } : {}
|
|
4794
4874
|
});
|
|
4875
|
+
if (config.idBase !== void 0)
|
|
4876
|
+
runtime.setIdBase?.(config.idBase);
|
|
4795
4877
|
const listening = await listen(runtime, { port: config.port, host: config.host });
|
|
4796
4878
|
target.listening?.(listening);
|
|
4797
4879
|
console.log(`${target.name} emulator listening on ${listening.url}`);
|
|
@@ -4837,6 +4919,11 @@ var serveCommand = (target) => ({
|
|
|
4837
4919
|
const adminControls = await resolveServeControls(values, process.env, config.adminControls);
|
|
4838
4920
|
if (adminControls !== void 0)
|
|
4839
4921
|
config.adminControls = adminControls;
|
|
4922
|
+
if (values.settings !== void 0)
|
|
4923
|
+
throw new Error("--settings serves a single service; give each service its own `settings` in the config");
|
|
4924
|
+
const idBase = config.idBase ?? resolveServeIdBase(values);
|
|
4925
|
+
if (idBase !== void 0)
|
|
4926
|
+
config.idBase = idBase;
|
|
4840
4927
|
const fleet = await startFleet(config, {
|
|
4841
4928
|
load: (name) => loadTarget(name, target),
|
|
4842
4929
|
onLog: formatLog(config.log ?? log),
|
|
@@ -4866,8 +4953,12 @@ var serveCommand = (target) => ({
|
|
|
4866
4953
|
let listening;
|
|
4867
4954
|
try {
|
|
4868
4955
|
const adminControls = await resolveServeControls(values);
|
|
4956
|
+
const idBase = resolveServeIdBase(values);
|
|
4957
|
+
const settings = await resolveServeSettings(target, values);
|
|
4869
4958
|
listening = await start(target, values, {
|
|
4870
4959
|
...adminControls !== void 0 ? { adminControls } : {},
|
|
4960
|
+
...idBase !== void 0 ? { idBase } : {},
|
|
4961
|
+
...settings !== void 0 ? { settings } : {},
|
|
4871
4962
|
adminPrefix: resolveAdminPrefix(asString(values["admin-prefix"]) ?? process.env.MOCKINGBIRD_ADMIN_PREFIX),
|
|
4872
4963
|
port: port === void 0 ? target.defaultPort : Number.parseInt(port, 10),
|
|
4873
4964
|
host: asString(values.host) ?? "127.0.0.1",
|
|
@@ -4920,4 +5011,4 @@ export {
|
|
|
4920
5011
|
createServer3 as createServer2,
|
|
4921
5012
|
serveTarget
|
|
4922
5013
|
};
|
|
4923
|
-
//# sourceMappingURL=chunk-
|
|
5014
|
+
//# sourceMappingURL=chunk-LYDM4GWT.js.map
|