@crvouga/mockingbird-service-aws-speech 3.6.0 → 3.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-PFJYH66F.js → chunk-KGBYMBBR.js} +103 -22
- package/dist/chunk-KGBYMBBR.js.map +7 -0
- package/dist/{chunk-M7JQW4G3.js → chunk-ML4QWID2.js} +2 -2
- package/dist/cli.js +103 -12
- package/dist/cli.js.map +3 -3
- 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-PFJYH66F.js.map +0 -7
- /package/dist/{chunk-M7JQW4G3.js.map → chunk-ML4QWID2.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KGBYMBBR.js";
|
|
4
4
|
|
|
5
5
|
// src/h2c.ts
|
|
6
6
|
import {
|
|
@@ -305,4 +305,4 @@ export {
|
|
|
305
305
|
createServer,
|
|
306
306
|
serveTarget
|
|
307
307
|
};
|
|
308
|
-
//# sourceMappingURL=chunk-
|
|
308
|
+
//# sourceMappingURL=chunk-ML4QWID2.js.map
|
package/dist/cli.js
CHANGED
|
@@ -2,22 +2,36 @@
|
|
|
2
2
|
import {
|
|
3
3
|
listenH2c,
|
|
4
4
|
serveTarget
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ML4QWID2.js";
|
|
6
6
|
import {
|
|
7
7
|
createClock,
|
|
8
8
|
normalizeBootControls,
|
|
9
9
|
normalizeControls,
|
|
10
|
+
normalizeIdBase,
|
|
10
11
|
ownedTransport,
|
|
11
12
|
parseDuration,
|
|
12
13
|
parseFaultHeader,
|
|
13
14
|
resolveAdminPrefix,
|
|
14
15
|
restoreClock
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-KGBYMBBR.js";
|
|
16
17
|
|
|
17
18
|
// ../../adapters/node/dist/cli.js
|
|
18
19
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
19
20
|
import { parseArgs } from "node:util";
|
|
20
21
|
|
|
22
|
+
// ../../adapters/node/dist/boot-settings.js
|
|
23
|
+
var checkSettings = (target, settings, label) => {
|
|
24
|
+
if (!target.parseSettings)
|
|
25
|
+
throw new Error(`${label}: ${target.name} takes no boot settings`);
|
|
26
|
+
try {
|
|
27
|
+
return target.parseSettings(settings);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
throw new Error(`${label}: ${error instanceof Error ? error.message : String(error)}`, {
|
|
30
|
+
cause: error
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
21
35
|
// ../../adapters/node/dist/fleet.js
|
|
22
36
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
23
37
|
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
@@ -2667,6 +2681,9 @@ var fleet_config_schema_default = {
|
|
|
2667
2681
|
adminControls: {
|
|
2668
2682
|
$ref: "#/$defs/controls"
|
|
2669
2683
|
},
|
|
2684
|
+
idBase: {
|
|
2685
|
+
$ref: "#/$defs/idBase"
|
|
2686
|
+
},
|
|
2670
2687
|
namespace: {
|
|
2671
2688
|
type: "string",
|
|
2672
2689
|
pattern: "^[A-Za-z0-9_.-]{1,64}$"
|
|
@@ -2756,6 +2773,12 @@ var fleet_config_schema_default = {
|
|
|
2756
2773
|
adminControls: {
|
|
2757
2774
|
$ref: "#/$defs/controls"
|
|
2758
2775
|
},
|
|
2776
|
+
idBase: {
|
|
2777
|
+
$ref: "#/$defs/idBase"
|
|
2778
|
+
},
|
|
2779
|
+
settings: {
|
|
2780
|
+
type: "object"
|
|
2781
|
+
},
|
|
2759
2782
|
fixtures: {
|
|
2760
2783
|
type: "object"
|
|
2761
2784
|
},
|
|
@@ -2802,6 +2825,18 @@ var fleet_config_schema_default = {
|
|
|
2802
2825
|
}
|
|
2803
2826
|
}
|
|
2804
2827
|
},
|
|
2828
|
+
idBase: {
|
|
2829
|
+
anyOf: [
|
|
2830
|
+
{
|
|
2831
|
+
type: "integer",
|
|
2832
|
+
minimum: 0
|
|
2833
|
+
},
|
|
2834
|
+
{
|
|
2835
|
+
type: "string",
|
|
2836
|
+
pattern: "^(boot|[0-9]+)$"
|
|
2837
|
+
}
|
|
2838
|
+
]
|
|
2839
|
+
},
|
|
2805
2840
|
controls: {
|
|
2806
2841
|
type: "object",
|
|
2807
2842
|
additionalProperties: false,
|
|
@@ -2951,6 +2986,8 @@ async function preflightFleet(config, options) {
|
|
|
2951
2986
|
throw new Error("protected archive policy requires a protected repository; configure its protector before startup");
|
|
2952
2987
|
resolveAdminPrefix(config.adminPrefix);
|
|
2953
2988
|
normalizeBootControls(config.adminControls);
|
|
2989
|
+
if (config.idBase !== void 0)
|
|
2990
|
+
normalizeIdBase(config.idBase, "idBase");
|
|
2954
2991
|
const targets = /* @__PURE__ */ new Map();
|
|
2955
2992
|
const ports = /* @__PURE__ */ new Set();
|
|
2956
2993
|
for (const [name, entry] of Object.entries(config.services)) {
|
|
@@ -2982,6 +3019,13 @@ async function preflightFleet(config, options) {
|
|
|
2982
3019
|
throw new Error("invalid protocol namespace selector");
|
|
2983
3020
|
}
|
|
2984
3021
|
}
|
|
3022
|
+
if (entry.idBase !== void 0)
|
|
3023
|
+
normalizeIdBase(entry.idBase, "idBase");
|
|
3024
|
+
if (entry.settings !== void 0) {
|
|
3025
|
+
if (protocol !== "http" || !("create" in target))
|
|
3026
|
+
throw new Error("settings: only HTTP services take boot settings");
|
|
3027
|
+
checkSettings(target, entry.settings, "settings");
|
|
3028
|
+
}
|
|
2985
3029
|
const port = entry.port ?? target.defaultPort;
|
|
2986
3030
|
if (port !== 0) {
|
|
2987
3031
|
const key = `${entry.host ?? "127.0.0.1"}:${port}`;
|
|
@@ -3017,7 +3061,7 @@ async function preflightFleet(config, options) {
|
|
|
3017
3061
|
break;
|
|
3018
3062
|
}
|
|
3019
3063
|
}
|
|
3020
|
-
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.
|
|
3064
|
+
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.7.0" });
|
|
3021
3065
|
} catch (error) {
|
|
3022
3066
|
throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
3023
3067
|
}
|
|
@@ -3337,6 +3381,7 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3337
3381
|
options.onLog?.(entry2);
|
|
3338
3382
|
},
|
|
3339
3383
|
...entry.adminControls !== void 0 ? { adminControls: entry.adminControls } : {},
|
|
3384
|
+
...entry.settings !== void 0 ? { settings: checkSettings(target, entry.settings, "settings") } : {},
|
|
3340
3385
|
...entry.fixtures !== void 0 ? { fixtures: entry.fixtures } : {},
|
|
3341
3386
|
...(advertisedHttpBase(entry) ?? entry.baseUrl) !== void 0 ? { baseUrl: advertisedHttpBase(entry) ?? entry.baseUrl } : {}
|
|
3342
3387
|
});
|
|
@@ -3355,6 +3400,8 @@ var httpChild = async (target, entry, options, admission, generation, privateAcc
|
|
|
3355
3400
|
].some((method) => typeof created[method] !== "function"))
|
|
3356
3401
|
throw new Error("HTTP target does not implement the fleet runtime protocol; build/install matching supported service versions");
|
|
3357
3402
|
const runtime = created;
|
|
3403
|
+
if (entry.idBase !== void 0)
|
|
3404
|
+
runtime.setIdBase?.(entry.idBase);
|
|
3358
3405
|
const unobserve = runtime.webhooks?.observeDeliveries(observer.delivery);
|
|
3359
3406
|
if (options.outbound && runtime.webhooks)
|
|
3360
3407
|
runtime.webhooks.setTransportPolicy(ownedTransport(options.outbound));
|
|
@@ -3953,6 +4000,7 @@ async function startFleet(config, options) {
|
|
|
3953
4000
|
...entry,
|
|
3954
4001
|
adminPrefix: resolveAdminPrefix(entry.adminPrefix ?? adminPrefix),
|
|
3955
4002
|
...adminKey !== void 0 ? { adminKey } : {},
|
|
4003
|
+
...(entry.idBase ?? config.idBase) !== void 0 ? { idBase: entry.idBase ?? config.idBase } : {},
|
|
3956
4004
|
// Fleet-wide controls, with the service's own keys replacing them.
|
|
3957
4005
|
...config.adminControls !== void 0 || entry.adminControls !== void 0 ? { adminControls: { ...config.adminControls, ...entry.adminControls } } : {}
|
|
3958
4006
|
}, options, (namespace, request) => management?.admit(namespace, request), (namespace) => management?.generation(namespace), (namespace, request) => management?.privateRequest(namespace, request) ?? false, {
|
|
@@ -4637,6 +4685,16 @@ var COMMON_SERVE_OPTIONS = {
|
|
|
4637
4685
|
value: "<seed>",
|
|
4638
4686
|
description: "Seed for every random choice (env MOCKINGBIRD_SEED)"
|
|
4639
4687
|
},
|
|
4688
|
+
"id-base": {
|
|
4689
|
+
type: "string",
|
|
4690
|
+
value: "<n|boot>",
|
|
4691
|
+
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)"
|
|
4692
|
+
},
|
|
4693
|
+
settings: {
|
|
4694
|
+
type: "string",
|
|
4695
|
+
value: "<json|file>",
|
|
4696
|
+
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)"
|
|
4697
|
+
},
|
|
4640
4698
|
"admin-controls": {
|
|
4641
4699
|
type: "string",
|
|
4642
4700
|
value: "<json|file>",
|
|
@@ -4731,19 +4789,40 @@ var readJsonFile = async (path, label) => {
|
|
|
4731
4789
|
}
|
|
4732
4790
|
};
|
|
4733
4791
|
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4792
|
+
var readJsonOption = async (source, label) => {
|
|
4793
|
+
const trimmed = source.trim();
|
|
4794
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
4795
|
+
try {
|
|
4796
|
+
return JSON.parse(trimmed);
|
|
4797
|
+
} catch {
|
|
4798
|
+
throw new Error(`${label}: not valid JSON`);
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
return readJsonFile(source, label);
|
|
4802
|
+
};
|
|
4803
|
+
var resolveServeIdBase = (values, env = process.env) => {
|
|
4804
|
+
const source = asString(values["id-base"]) ?? env.MOCKINGBIRD_ID_BASE;
|
|
4805
|
+
if (source === void 0 || source.trim() === "")
|
|
4806
|
+
return void 0;
|
|
4807
|
+
normalizeIdBase(source.trim(), "--id-base");
|
|
4808
|
+
return source.trim();
|
|
4809
|
+
};
|
|
4810
|
+
var resolveServeSettings = async (target, values, env = process.env) => {
|
|
4811
|
+
const flag = asString(values.settings);
|
|
4812
|
+
const source = flag ?? env.MOCKINGBIRD_SETTINGS;
|
|
4813
|
+
if (source === void 0 || source.trim() === "")
|
|
4814
|
+
return void 0;
|
|
4815
|
+
const label = flag !== void 0 ? "--settings" : "MOCKINGBIRD_SETTINGS";
|
|
4816
|
+
const parsed = await readJsonOption(source, label);
|
|
4817
|
+
if (!isObject2(parsed))
|
|
4818
|
+
throw new Error(`${label}: expected a JSON object`);
|
|
4819
|
+
return checkSettings(target, parsed, label);
|
|
4820
|
+
};
|
|
4734
4821
|
var resolveServeControls = async (values, env = process.env, base) => {
|
|
4735
4822
|
const source = asString(values["admin-controls"]) ?? env.MOCKINGBIRD_ADMIN_CONTROLS;
|
|
4736
4823
|
let document = isObject2(base) ? { ...base } : {};
|
|
4737
4824
|
if (source !== void 0 && source.trim() !== "") {
|
|
4738
|
-
|
|
4739
|
-
if (source.trim().startsWith("{")) {
|
|
4740
|
-
try {
|
|
4741
|
-
parsed = JSON.parse(source);
|
|
4742
|
-
} catch {
|
|
4743
|
-
throw new Error("--admin-controls: not valid JSON");
|
|
4744
|
-
}
|
|
4745
|
-
} else
|
|
4746
|
-
parsed = await readJsonFile(source, "--admin-controls");
|
|
4825
|
+
const parsed = source.trim().startsWith("{") ? await readJsonOption(source, "--admin-controls") : await readJsonFile(source, "--admin-controls");
|
|
4747
4826
|
if (!isObject2(parsed))
|
|
4748
4827
|
throw new Error("--admin-controls: expected a JSON object");
|
|
4749
4828
|
document = { ...document, ...parsed };
|
|
@@ -4793,8 +4872,11 @@ var start = async (target, values, config) => {
|
|
|
4793
4872
|
adminKey: config.adminKey,
|
|
4794
4873
|
seed: config.seed,
|
|
4795
4874
|
onLog: formatLog(config.log),
|
|
4875
|
+
...config.settings !== void 0 ? { settings: config.settings } : {},
|
|
4796
4876
|
...config.adminControls !== void 0 ? { adminControls: config.adminControls } : {}
|
|
4797
4877
|
});
|
|
4878
|
+
if (config.idBase !== void 0)
|
|
4879
|
+
runtime.setIdBase?.(config.idBase);
|
|
4798
4880
|
const listening = await listen(runtime, { port: config.port, host: config.host });
|
|
4799
4881
|
target.listening?.(listening);
|
|
4800
4882
|
console.log(`${target.name} emulator listening on ${listening.url}`);
|
|
@@ -4840,6 +4922,11 @@ var serveCommand = (target) => ({
|
|
|
4840
4922
|
const adminControls = await resolveServeControls(values, process.env, config.adminControls);
|
|
4841
4923
|
if (adminControls !== void 0)
|
|
4842
4924
|
config.adminControls = adminControls;
|
|
4925
|
+
if (values.settings !== void 0)
|
|
4926
|
+
throw new Error("--settings serves a single service; give each service its own `settings` in the config");
|
|
4927
|
+
const idBase = config.idBase ?? resolveServeIdBase(values);
|
|
4928
|
+
if (idBase !== void 0)
|
|
4929
|
+
config.idBase = idBase;
|
|
4843
4930
|
const fleet = await startFleet(config, {
|
|
4844
4931
|
load: (name) => loadTarget(name, target),
|
|
4845
4932
|
onLog: formatLog(config.log ?? log),
|
|
@@ -4869,8 +4956,12 @@ var serveCommand = (target) => ({
|
|
|
4869
4956
|
let listening;
|
|
4870
4957
|
try {
|
|
4871
4958
|
const adminControls = await resolveServeControls(values);
|
|
4959
|
+
const idBase = resolveServeIdBase(values);
|
|
4960
|
+
const settings = await resolveServeSettings(target, values);
|
|
4872
4961
|
listening = await start(target, values, {
|
|
4873
4962
|
...adminControls !== void 0 ? { adminControls } : {},
|
|
4963
|
+
...idBase !== void 0 ? { idBase } : {},
|
|
4964
|
+
...settings !== void 0 ? { settings } : {},
|
|
4874
4965
|
adminPrefix: resolveAdminPrefix(asString(values["admin-prefix"]) ?? process.env.MOCKINGBIRD_ADMIN_PREFIX),
|
|
4875
4966
|
port: port === void 0 ? target.defaultPort : Number.parseInt(port, 10),
|
|
4876
4967
|
host: asString(values.host) ?? "127.0.0.1",
|