@crvouga/mockingbird-service-stripe 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-LUKVBQDH.js → chunk-CHK6KZV4.js} +75 -6
- package/dist/chunk-CHK6KZV4.js.map +7 -0
- package/dist/{chunk-IWIBLNQX.js → chunk-PNBTN2AA.js} +2 -2
- 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-LUKVBQDH.js.map +0 -7
- /package/dist/{chunk-IWIBLNQX.js.map → chunk-PNBTN2AA.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-stripe
|
|
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
|
|
@@ -1028,7 +1028,40 @@ var decodeBody = (contentType, bytes) => {
|
|
|
1028
1028
|
return { kind: "bytes", value: bytes };
|
|
1029
1029
|
};
|
|
1030
1030
|
var readBody = async (message) => {
|
|
1031
|
-
|
|
1031
|
+
if (!(message instanceof Request) || !message.body) {
|
|
1032
|
+
if (message instanceof Request)
|
|
1033
|
+
message.signal.throwIfAborted();
|
|
1034
|
+
return decodeBody(message.headers.get("content-type"), new Uint8Array(await message.arrayBuffer()));
|
|
1035
|
+
}
|
|
1036
|
+
message.signal.throwIfAborted();
|
|
1037
|
+
const reader = message.body.getReader();
|
|
1038
|
+
const cancel = () => {
|
|
1039
|
+
void reader.cancel(message.signal.reason).catch(() => {
|
|
1040
|
+
});
|
|
1041
|
+
};
|
|
1042
|
+
message.signal.addEventListener("abort", cancel, { once: true });
|
|
1043
|
+
const chunks = [];
|
|
1044
|
+
let size = 0;
|
|
1045
|
+
try {
|
|
1046
|
+
for (; ; ) {
|
|
1047
|
+
message.signal.throwIfAborted();
|
|
1048
|
+
const { done, value } = await reader.read();
|
|
1049
|
+
message.signal.throwIfAborted();
|
|
1050
|
+
if (done)
|
|
1051
|
+
break;
|
|
1052
|
+
chunks.push(value);
|
|
1053
|
+
size += value.byteLength;
|
|
1054
|
+
}
|
|
1055
|
+
} finally {
|
|
1056
|
+
message.signal.removeEventListener("abort", cancel);
|
|
1057
|
+
reader.releaseLock();
|
|
1058
|
+
}
|
|
1059
|
+
const bytes = new Uint8Array(size);
|
|
1060
|
+
let offset = 0;
|
|
1061
|
+
for (const chunk of chunks) {
|
|
1062
|
+
bytes.set(chunk, offset);
|
|
1063
|
+
offset += chunk.byteLength;
|
|
1064
|
+
}
|
|
1032
1065
|
return decodeBody(message.headers.get("content-type"), bytes);
|
|
1033
1066
|
};
|
|
1034
1067
|
|
|
@@ -1743,7 +1776,42 @@ var verifyOperations = (document2, handlers) => {
|
|
|
1743
1776
|
}
|
|
1744
1777
|
return problems;
|
|
1745
1778
|
};
|
|
1746
|
-
var
|
|
1779
|
+
var escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1780
|
+
var serviceRoute = (template) => {
|
|
1781
|
+
const names = [];
|
|
1782
|
+
let pattern = "", end = 0;
|
|
1783
|
+
for (const match of template.matchAll(/\{([^}]+)\}/g)) {
|
|
1784
|
+
pattern += `${escapePattern(template.slice(end, match.index))}([^/]+?)`;
|
|
1785
|
+
const name = match[1];
|
|
1786
|
+
if (!name)
|
|
1787
|
+
throw new Error(`Invalid OpenAPI route template: ${template}`);
|
|
1788
|
+
names.push(name);
|
|
1789
|
+
end = match.index + match[0].length;
|
|
1790
|
+
}
|
|
1791
|
+
pattern += escapePattern(template.slice(end));
|
|
1792
|
+
const matcher = new RegExp(`^${pattern}$`);
|
|
1793
|
+
const path = template.split("/").map((segment, index) => {
|
|
1794
|
+
if (!segment.includes("{"))
|
|
1795
|
+
return segment;
|
|
1796
|
+
const literal = /^\{([^}]+)\}$/.exec(segment);
|
|
1797
|
+
if (literal)
|
|
1798
|
+
return `:${literal[1]}`;
|
|
1799
|
+
let expression = "", offset = 0;
|
|
1800
|
+
for (const match of segment.matchAll(/\{[^}]+\}/g)) {
|
|
1801
|
+
expression += `${escapePattern(segment.slice(offset, match.index))}[^/]+?`;
|
|
1802
|
+
offset = match.index + match[0].length;
|
|
1803
|
+
}
|
|
1804
|
+
expression += escapePattern(segment.slice(offset));
|
|
1805
|
+
return `:mockingbirdSegment${index}{${expression}}`;
|
|
1806
|
+
}).join("/");
|
|
1807
|
+
return {
|
|
1808
|
+
path,
|
|
1809
|
+
params: (pathname) => {
|
|
1810
|
+
const values = matcher.exec(pathname);
|
|
1811
|
+
return Object.fromEntries(names.map((name, index) => [name, decodeURIComponent(values?.[index + 1] ?? "")]));
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
};
|
|
1747
1815
|
var routeOrder = (a, b) => {
|
|
1748
1816
|
const sa = a.path.split("/");
|
|
1749
1817
|
const sb = b.path.split("/");
|
|
@@ -1778,6 +1846,7 @@ var createService = (options) => {
|
|
|
1778
1846
|
for (const operation of operations) {
|
|
1779
1847
|
const metadata = operationMetadata(operation.operation);
|
|
1780
1848
|
const handler = options.handlers[operation.operationId];
|
|
1849
|
+
const registeredRoute = serviceRoute(operation.path);
|
|
1781
1850
|
const route = async (c) => {
|
|
1782
1851
|
const request = c.req.raw;
|
|
1783
1852
|
if (!metadata.supported || !handler) {
|
|
@@ -1787,7 +1856,7 @@ var createService = (options) => {
|
|
|
1787
1856
|
const context = {
|
|
1788
1857
|
request,
|
|
1789
1858
|
url,
|
|
1790
|
-
params:
|
|
1859
|
+
params: registeredRoute.params(url.pathname),
|
|
1791
1860
|
query: queryOf(url),
|
|
1792
1861
|
body: await readBody(request),
|
|
1793
1862
|
sqlite: options.sqlite,
|
|
@@ -1799,7 +1868,7 @@ var createService = (options) => {
|
|
|
1799
1868
|
const short = await options.before?.(context);
|
|
1800
1869
|
return withIssues(request, short ?? await handler(context));
|
|
1801
1870
|
};
|
|
1802
|
-
app.on(operation.method.toUpperCase(),
|
|
1871
|
+
app.on(operation.method.toUpperCase(), registeredRoute.path, route);
|
|
1803
1872
|
}
|
|
1804
1873
|
return {
|
|
1805
1874
|
app,
|
|
@@ -2268,7 +2337,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
2268
2337
|
};
|
|
2269
2338
|
|
|
2270
2339
|
// ../core/dist/version.js
|
|
2271
|
-
var PACKAGE_VERSION = true ? "2.
|
|
2340
|
+
var PACKAGE_VERSION = true ? "2.2.0" : UNRELEASED_VERSION;
|
|
2272
2341
|
|
|
2273
2342
|
// ../core/dist/signing.js
|
|
2274
2343
|
var encoder = new TextEncoder();
|
|
@@ -18950,4 +19019,4 @@ export {
|
|
|
18950
19019
|
createRuntime2 as createRuntime,
|
|
18951
19020
|
StripeAPI
|
|
18952
19021
|
};
|
|
18953
|
-
//# sourceMappingURL=chunk-
|
|
19022
|
+
//# sourceMappingURL=chunk-CHK6KZV4.js.map
|