two-stroke 1.1.5 → 1.1.7
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/package.json +1 -1
- package/src/index.ts +9 -1
- package/src/test.ts +11 -0
- package/src/types.ts +2 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -381,11 +381,18 @@ export function twoStroke<T extends Env>(title: string, release: string) {
|
|
|
381
381
|
params,
|
|
382
382
|
});
|
|
383
383
|
},
|
|
384
|
-
delete<
|
|
384
|
+
delete<
|
|
385
|
+
O extends ZodSchema,
|
|
386
|
+
A,
|
|
387
|
+
P extends string,
|
|
388
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
389
|
+
PP extends ZodObject<any> | undefined,
|
|
390
|
+
>(
|
|
385
391
|
auth: Route<T, A>["auth"],
|
|
386
392
|
path: P,
|
|
387
393
|
output: O,
|
|
388
394
|
handler: Handler<T, undefined, O, A, P>,
|
|
395
|
+
params?: PP,
|
|
389
396
|
) {
|
|
390
397
|
routes.push({
|
|
391
398
|
auth,
|
|
@@ -396,6 +403,7 @@ export function twoStroke<T extends Env>(title: string, release: string) {
|
|
|
396
403
|
),
|
|
397
404
|
output,
|
|
398
405
|
handler,
|
|
406
|
+
params,
|
|
399
407
|
});
|
|
400
408
|
},
|
|
401
409
|
};
|
package/src/test.ts
CHANGED
|
@@ -15,6 +15,8 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
|
|
|
15
15
|
fetchMock.disableNetConnect();
|
|
16
16
|
|
|
17
17
|
const config = toml.parse(fs.readFileSync("wrangler.toml", "utf8")) as {
|
|
18
|
+
compatibility_date: string;
|
|
19
|
+
compatibility_flags: string[];
|
|
18
20
|
queues?: {
|
|
19
21
|
consumers?: { queue: string }[];
|
|
20
22
|
producers?: { queue: string; binding: string }[];
|
|
@@ -23,11 +25,14 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
|
|
|
23
25
|
kv_namespaces?: { binding: string }[];
|
|
24
26
|
d1_databases?: { binding: string }[];
|
|
25
27
|
services?: { binding: string; service: string }[];
|
|
28
|
+
durable_objects?: { bindings?: { name: string; class_name: string }[] };
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
const miniflare = new Miniflare({
|
|
29
32
|
modules: true,
|
|
30
33
|
scriptPath: "dist/index.js",
|
|
34
|
+
compatibilityDate: config.compatibility_date,
|
|
35
|
+
compatibilityFlags: config.compatibility_flags,
|
|
31
36
|
bindings: {
|
|
32
37
|
TOKEN_HASH:
|
|
33
38
|
"djAxlhzT1IU9QIP3UKdipECQPAGGoPQK86/GnTBcbHLtPC3ni6JkTQ/iIeF0KG0y1CZ+J+9W",
|
|
@@ -47,6 +52,12 @@ export const setupTests = async <Paths extends {}>(bindings: Env) => {
|
|
|
47
52
|
(config.services ?? []).map(({ binding, service }) => [binding, service]),
|
|
48
53
|
),
|
|
49
54
|
fetchMock,
|
|
55
|
+
durableObjects: Object.fromEntries(
|
|
56
|
+
(config.durable_objects?.bindings ?? []).map(({ name, class_name }) => [
|
|
57
|
+
name,
|
|
58
|
+
class_name,
|
|
59
|
+
]),
|
|
60
|
+
),
|
|
50
61
|
});
|
|
51
62
|
|
|
52
63
|
const url = await miniflare.ready;
|