@crvouga/mockingbird-service-aws-speech 2.1.0 → 2.2.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 +10 -4
- package/dist/{chunk-K2735QZT.js → chunk-CSQ6IOJ4.js} +2 -2
- package/dist/{chunk-XGXJSBVS.js → chunk-Z54NCXKN.js} +75 -6
- package/dist/chunk-Z54NCXKN.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-XGXJSBVS.js.map +0 -7
- /package/dist/{chunk-K2735QZT.js.map → chunk-CSQ6IOJ4.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-aws-speech
|
|
2
2
|
|
|
3
|
+
## 2.2.0 (2026-10-05)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- add scripted local API mock ([4a76a11](https://github.com/crvouga/mockingbird/commit/4a76a114e2efad45934e0a93cf29576fd418e15c))
|
|
8
|
+
|
|
9
|
+
### Fixes and improvements
|
|
10
|
+
|
|
11
|
+
- support embedded route parameters ([127cad9](https://github.com/crvouga/mockingbird/commit/127cad997ef106950c1b866070eea191ba54403f))
|
|
12
|
+
|
|
3
13
|
## 2.1.0 (2026-10-04)
|
|
4
14
|
|
|
5
15
|
### Features
|
|
@@ -12,10 +22,6 @@
|
|
|
12
22
|
- fill the embedded viewport ([c1a35a4](https://github.com/crvouga/mockingbird/commit/c1a35a4789389ee9cd06c286d09bd47c4d06c71e))
|
|
13
23
|
- make dialog cleanup immediate ([0c1a3c5](https://github.com/crvouga/mockingbird/commit/0c1a3c5b12584d50c19dcae595b951b8e5417b9c))
|
|
14
24
|
|
|
15
|
-
### Dependencies
|
|
16
|
-
|
|
17
|
-
- `@crvouga/mockingbird-service-sqlite`
|
|
18
|
-
|
|
19
25
|
## 2.0.0 (2026-10-04)
|
|
20
26
|
|
|
21
27
|
### ⚠️ Breaking changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Z54NCXKN.js";
|
|
4
4
|
|
|
5
5
|
// src/h2c.ts
|
|
6
6
|
import {
|
|
@@ -304,4 +304,4 @@ export {
|
|
|
304
304
|
createServer,
|
|
305
305
|
serveTarget
|
|
306
306
|
};
|
|
307
|
-
//# sourceMappingURL=chunk-
|
|
307
|
+
//# sourceMappingURL=chunk-CSQ6IOJ4.js.map
|
|
@@ -828,7 +828,40 @@ var decodeBody = (contentType, bytes) => {
|
|
|
828
828
|
return { kind: "bytes", value: bytes };
|
|
829
829
|
};
|
|
830
830
|
var readBody = async (message) => {
|
|
831
|
-
|
|
831
|
+
if (!(message instanceof Request) || !message.body) {
|
|
832
|
+
if (message instanceof Request)
|
|
833
|
+
message.signal.throwIfAborted();
|
|
834
|
+
return decodeBody(message.headers.get("content-type"), new Uint8Array(await message.arrayBuffer()));
|
|
835
|
+
}
|
|
836
|
+
message.signal.throwIfAborted();
|
|
837
|
+
const reader = message.body.getReader();
|
|
838
|
+
const cancel = () => {
|
|
839
|
+
void reader.cancel(message.signal.reason).catch(() => {
|
|
840
|
+
});
|
|
841
|
+
};
|
|
842
|
+
message.signal.addEventListener("abort", cancel, { once: true });
|
|
843
|
+
const chunks = [];
|
|
844
|
+
let size = 0;
|
|
845
|
+
try {
|
|
846
|
+
for (; ; ) {
|
|
847
|
+
message.signal.throwIfAborted();
|
|
848
|
+
const { done, value } = await reader.read();
|
|
849
|
+
message.signal.throwIfAborted();
|
|
850
|
+
if (done)
|
|
851
|
+
break;
|
|
852
|
+
chunks.push(value);
|
|
853
|
+
size += value.byteLength;
|
|
854
|
+
}
|
|
855
|
+
} finally {
|
|
856
|
+
message.signal.removeEventListener("abort", cancel);
|
|
857
|
+
reader.releaseLock();
|
|
858
|
+
}
|
|
859
|
+
const bytes = new Uint8Array(size);
|
|
860
|
+
let offset = 0;
|
|
861
|
+
for (const chunk of chunks) {
|
|
862
|
+
bytes.set(chunk, offset);
|
|
863
|
+
offset += chunk.byteLength;
|
|
864
|
+
}
|
|
832
865
|
return decodeBody(message.headers.get("content-type"), bytes);
|
|
833
866
|
};
|
|
834
867
|
|
|
@@ -1473,7 +1506,42 @@ var verifyOperations = (document2, handlers) => {
|
|
|
1473
1506
|
}
|
|
1474
1507
|
return problems;
|
|
1475
1508
|
};
|
|
1476
|
-
var
|
|
1509
|
+
var escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1510
|
+
var serviceRoute = (template) => {
|
|
1511
|
+
const names = [];
|
|
1512
|
+
let pattern = "", end = 0;
|
|
1513
|
+
for (const match of template.matchAll(/\{([^}]+)\}/g)) {
|
|
1514
|
+
pattern += `${escapePattern(template.slice(end, match.index))}([^/]+?)`;
|
|
1515
|
+
const name = match[1];
|
|
1516
|
+
if (!name)
|
|
1517
|
+
throw new Error(`Invalid OpenAPI route template: ${template}`);
|
|
1518
|
+
names.push(name);
|
|
1519
|
+
end = match.index + match[0].length;
|
|
1520
|
+
}
|
|
1521
|
+
pattern += escapePattern(template.slice(end));
|
|
1522
|
+
const matcher = new RegExp(`^${pattern}$`);
|
|
1523
|
+
const path = template.split("/").map((segment, index) => {
|
|
1524
|
+
if (!segment.includes("{"))
|
|
1525
|
+
return segment;
|
|
1526
|
+
const literal = /^\{([^}]+)\}$/.exec(segment);
|
|
1527
|
+
if (literal)
|
|
1528
|
+
return `:${literal[1]}`;
|
|
1529
|
+
let expression = "", offset = 0;
|
|
1530
|
+
for (const match of segment.matchAll(/\{[^}]+\}/g)) {
|
|
1531
|
+
expression += `${escapePattern(segment.slice(offset, match.index))}[^/]+?`;
|
|
1532
|
+
offset = match.index + match[0].length;
|
|
1533
|
+
}
|
|
1534
|
+
expression += escapePattern(segment.slice(offset));
|
|
1535
|
+
return `:mockingbirdSegment${index}{${expression}}`;
|
|
1536
|
+
}).join("/");
|
|
1537
|
+
return {
|
|
1538
|
+
path,
|
|
1539
|
+
params: (pathname) => {
|
|
1540
|
+
const values = matcher.exec(pathname);
|
|
1541
|
+
return Object.fromEntries(names.map((name, index) => [name, decodeURIComponent(values?.[index + 1] ?? "")]));
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1477
1545
|
var routeOrder = (a, b) => {
|
|
1478
1546
|
const sa = a.path.split("/");
|
|
1479
1547
|
const sb = b.path.split("/");
|
|
@@ -1508,6 +1576,7 @@ var createService = (options) => {
|
|
|
1508
1576
|
for (const operation of operations) {
|
|
1509
1577
|
const metadata = operationMetadata(operation.operation);
|
|
1510
1578
|
const handler = options.handlers[operation.operationId];
|
|
1579
|
+
const registeredRoute = serviceRoute(operation.path);
|
|
1511
1580
|
const route = async (c) => {
|
|
1512
1581
|
const request = c.req.raw;
|
|
1513
1582
|
if (!metadata.supported || !handler) {
|
|
@@ -1517,7 +1586,7 @@ var createService = (options) => {
|
|
|
1517
1586
|
const context = {
|
|
1518
1587
|
request,
|
|
1519
1588
|
url,
|
|
1520
|
-
params:
|
|
1589
|
+
params: registeredRoute.params(url.pathname),
|
|
1521
1590
|
query: queryOf(url),
|
|
1522
1591
|
body: await readBody(request),
|
|
1523
1592
|
sqlite: options.sqlite,
|
|
@@ -1529,7 +1598,7 @@ var createService = (options) => {
|
|
|
1529
1598
|
const short = await options.before?.(context);
|
|
1530
1599
|
return withIssues(request, short ?? await handler(context));
|
|
1531
1600
|
};
|
|
1532
|
-
app.on(operation.method.toUpperCase(),
|
|
1601
|
+
app.on(operation.method.toUpperCase(), registeredRoute.path, route);
|
|
1533
1602
|
}
|
|
1534
1603
|
return {
|
|
1535
1604
|
app,
|
|
@@ -1998,7 +2067,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
1998
2067
|
};
|
|
1999
2068
|
|
|
2000
2069
|
// ../core/dist/version.js
|
|
2001
|
-
var PACKAGE_VERSION = true ? "2.
|
|
2070
|
+
var PACKAGE_VERSION = true ? "2.2.0" : UNRELEASED_VERSION;
|
|
2002
2071
|
|
|
2003
2072
|
// ../core/dist/signing.js
|
|
2004
2073
|
var encoder = new TextEncoder();
|
|
@@ -4283,4 +4352,4 @@ export {
|
|
|
4283
4352
|
accessKeyCredential,
|
|
4284
4353
|
SpeechAPI
|
|
4285
4354
|
};
|
|
4286
|
-
//# sourceMappingURL=chunk-
|
|
4355
|
+
//# sourceMappingURL=chunk-Z54NCXKN.js.map
|