@crvouga/mockingbird-service-slack 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-E3KVT7RM.js → chunk-HFE7BTAF.js} +2 -2
- package/dist/{chunk-5ZFXMEU3.js → chunk-W77D4YOJ.js} +75 -6
- package/dist/chunk-W77D4YOJ.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-5ZFXMEU3.js.map +0 -7
- /package/dist/{chunk-E3KVT7RM.js.map → chunk-HFE7BTAF.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-slack
|
|
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
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
parseDuration,
|
|
9
9
|
resolveAdminPrefix,
|
|
10
10
|
unbindSocketTransport
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-W77D4YOJ.js";
|
|
12
12
|
|
|
13
13
|
// ../../adapters/node/dist/cli.js
|
|
14
14
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
@@ -1137,4 +1137,4 @@ export {
|
|
|
1137
1137
|
createServer2 as createServer,
|
|
1138
1138
|
serveTarget
|
|
1139
1139
|
};
|
|
1140
|
-
//# sourceMappingURL=chunk-
|
|
1140
|
+
//# sourceMappingURL=chunk-HFE7BTAF.js.map
|
|
@@ -827,7 +827,40 @@ var decodeBody = (contentType, bytes) => {
|
|
|
827
827
|
return { kind: "bytes", value: bytes };
|
|
828
828
|
};
|
|
829
829
|
var readBody = async (message) => {
|
|
830
|
-
|
|
830
|
+
if (!(message instanceof Request) || !message.body) {
|
|
831
|
+
if (message instanceof Request)
|
|
832
|
+
message.signal.throwIfAborted();
|
|
833
|
+
return decodeBody(message.headers.get("content-type"), new Uint8Array(await message.arrayBuffer()));
|
|
834
|
+
}
|
|
835
|
+
message.signal.throwIfAborted();
|
|
836
|
+
const reader = message.body.getReader();
|
|
837
|
+
const cancel = () => {
|
|
838
|
+
void reader.cancel(message.signal.reason).catch(() => {
|
|
839
|
+
});
|
|
840
|
+
};
|
|
841
|
+
message.signal.addEventListener("abort", cancel, { once: true });
|
|
842
|
+
const chunks = [];
|
|
843
|
+
let size = 0;
|
|
844
|
+
try {
|
|
845
|
+
for (; ; ) {
|
|
846
|
+
message.signal.throwIfAborted();
|
|
847
|
+
const { done, value } = await reader.read();
|
|
848
|
+
message.signal.throwIfAborted();
|
|
849
|
+
if (done)
|
|
850
|
+
break;
|
|
851
|
+
chunks.push(value);
|
|
852
|
+
size += value.byteLength;
|
|
853
|
+
}
|
|
854
|
+
} finally {
|
|
855
|
+
message.signal.removeEventListener("abort", cancel);
|
|
856
|
+
reader.releaseLock();
|
|
857
|
+
}
|
|
858
|
+
const bytes = new Uint8Array(size);
|
|
859
|
+
let offset = 0;
|
|
860
|
+
for (const chunk of chunks) {
|
|
861
|
+
bytes.set(chunk, offset);
|
|
862
|
+
offset += chunk.byteLength;
|
|
863
|
+
}
|
|
831
864
|
return decodeBody(message.headers.get("content-type"), bytes);
|
|
832
865
|
};
|
|
833
866
|
|
|
@@ -1542,7 +1575,42 @@ var verifyOperations = (document2, handlers) => {
|
|
|
1542
1575
|
}
|
|
1543
1576
|
return problems;
|
|
1544
1577
|
};
|
|
1545
|
-
var
|
|
1578
|
+
var escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1579
|
+
var serviceRoute = (template) => {
|
|
1580
|
+
const names = [];
|
|
1581
|
+
let pattern = "", end = 0;
|
|
1582
|
+
for (const match of template.matchAll(/\{([^}]+)\}/g)) {
|
|
1583
|
+
pattern += `${escapePattern(template.slice(end, match.index))}([^/]+?)`;
|
|
1584
|
+
const name = match[1];
|
|
1585
|
+
if (!name)
|
|
1586
|
+
throw new Error(`Invalid OpenAPI route template: ${template}`);
|
|
1587
|
+
names.push(name);
|
|
1588
|
+
end = match.index + match[0].length;
|
|
1589
|
+
}
|
|
1590
|
+
pattern += escapePattern(template.slice(end));
|
|
1591
|
+
const matcher = new RegExp(`^${pattern}$`);
|
|
1592
|
+
const path = template.split("/").map((segment, index) => {
|
|
1593
|
+
if (!segment.includes("{"))
|
|
1594
|
+
return segment;
|
|
1595
|
+
const literal = /^\{([^}]+)\}$/.exec(segment);
|
|
1596
|
+
if (literal)
|
|
1597
|
+
return `:${literal[1]}`;
|
|
1598
|
+
let expression = "", offset = 0;
|
|
1599
|
+
for (const match of segment.matchAll(/\{[^}]+\}/g)) {
|
|
1600
|
+
expression += `${escapePattern(segment.slice(offset, match.index))}[^/]+?`;
|
|
1601
|
+
offset = match.index + match[0].length;
|
|
1602
|
+
}
|
|
1603
|
+
expression += escapePattern(segment.slice(offset));
|
|
1604
|
+
return `:mockingbirdSegment${index}{${expression}}`;
|
|
1605
|
+
}).join("/");
|
|
1606
|
+
return {
|
|
1607
|
+
path,
|
|
1608
|
+
params: (pathname) => {
|
|
1609
|
+
const values = matcher.exec(pathname);
|
|
1610
|
+
return Object.fromEntries(names.map((name, index) => [name, decodeURIComponent(values?.[index + 1] ?? "")]));
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
};
|
|
1546
1614
|
var routeOrder = (a, b) => {
|
|
1547
1615
|
const sa = a.path.split("/");
|
|
1548
1616
|
const sb = b.path.split("/");
|
|
@@ -1577,6 +1645,7 @@ var createService = (options) => {
|
|
|
1577
1645
|
for (const operation of operations) {
|
|
1578
1646
|
const metadata = operationMetadata(operation.operation);
|
|
1579
1647
|
const handler = options.handlers[operation.operationId];
|
|
1648
|
+
const registeredRoute = serviceRoute(operation.path);
|
|
1580
1649
|
const route = async (c) => {
|
|
1581
1650
|
const request = c.req.raw;
|
|
1582
1651
|
if (!metadata.supported || !handler) {
|
|
@@ -1586,7 +1655,7 @@ var createService = (options) => {
|
|
|
1586
1655
|
const context = {
|
|
1587
1656
|
request,
|
|
1588
1657
|
url,
|
|
1589
|
-
params:
|
|
1658
|
+
params: registeredRoute.params(url.pathname),
|
|
1590
1659
|
query: queryOf(url),
|
|
1591
1660
|
body: await readBody(request),
|
|
1592
1661
|
sqlite: options.sqlite,
|
|
@@ -1598,7 +1667,7 @@ var createService = (options) => {
|
|
|
1598
1667
|
const short = await options.before?.(context);
|
|
1599
1668
|
return withIssues(request, short ?? await handler(context));
|
|
1600
1669
|
};
|
|
1601
|
-
app.on(operation.method.toUpperCase(),
|
|
1670
|
+
app.on(operation.method.toUpperCase(), registeredRoute.path, route);
|
|
1602
1671
|
}
|
|
1603
1672
|
return {
|
|
1604
1673
|
app,
|
|
@@ -2067,7 +2136,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
2067
2136
|
};
|
|
2068
2137
|
|
|
2069
2138
|
// ../core/dist/version.js
|
|
2070
|
-
var PACKAGE_VERSION = true ? "2.
|
|
2139
|
+
var PACKAGE_VERSION = true ? "2.2.0" : UNRELEASED_VERSION;
|
|
2071
2140
|
|
|
2072
2141
|
// ../core/dist/webhooks.js
|
|
2073
2142
|
var json5 = (status, body) => new Response(JSON.stringify(body), {
|
|
@@ -4020,4 +4089,4 @@ export {
|
|
|
4020
4089
|
slackCredential,
|
|
4021
4090
|
SlackAPI
|
|
4022
4091
|
};
|
|
4023
|
-
//# sourceMappingURL=chunk-
|
|
4092
|
+
//# sourceMappingURL=chunk-W77D4YOJ.js.map
|