@t4h.framework/webhook 0.2.7 → 0.2.9
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.
|
@@ -1,134 +1,99 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: framework-webhook
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Suspends a T4H Framework workflow until a third party calls back over HTTP,
|
|
5
|
+
with webhook() and WebhookActivity from @t4h.framework/webhook. Use when a
|
|
6
|
+
workflow must send a request to a partner and wait for its callback (payment
|
|
7
|
+
provider, document signing, long partner job), or when the user mentions the
|
|
8
|
+
<<callbackUrl>> placeholder, callback auth (hmac, basic, header, bearer, jwt,
|
|
9
|
+
jwks), a callback body schema, timeoutInMs, callback.dispatch,
|
|
10
|
+
{ wait: false }, WebhookDispatchError or WebhookTimeoutError.
|
|
10
11
|
---
|
|
11
12
|
|
|
12
13
|
# @t4h.framework/webhook
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
`framework/packages/webhook`. Peer dependency: `@t4h.framework/core`.
|
|
15
|
+
## Wait for a partner callback
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
1. Declare the callback credential with `type: Secret` in the `EnvDesign` in
|
|
18
|
+
`src/constants/environments.ts`. A token for the outbound
|
|
19
|
+
`request.headers` is `type: String`, because `headers` takes strings.
|
|
20
|
+
2. Call `webhook()` in the workflow body. Put `<<callbackUrl>>` where the
|
|
21
|
+
partner expects the URL to call back.
|
|
22
|
+
3. Read `callback.body` (typed by `schema`) and `callback.dispatch` (the
|
|
23
|
+
partner's answer to the request).
|
|
18
24
|
|
|
19
25
|
```typescript
|
|
20
|
-
import { webhook
|
|
21
|
-
import
|
|
22
|
-
```
|
|
26
|
+
import { webhook } from '@t4h.framework/webhook'
|
|
27
|
+
import Type from 'typebox'
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
import { environments } from '../constants/environments.js'
|
|
25
30
|
|
|
26
|
-
```typescript
|
|
27
31
|
const callback = await webhook({
|
|
28
32
|
request: {
|
|
29
33
|
url: 'https://partner.example.com/jobs',
|
|
34
|
+
headers: { authorization: `Bearer ${environments.PARTNER_TOKEN}` },
|
|
30
35
|
body: { json: { notifyUrl: '<<callbackUrl>>' } },
|
|
31
36
|
},
|
|
32
|
-
auth: {
|
|
37
|
+
auth: {
|
|
38
|
+
type: 'hmac',
|
|
39
|
+
secret: environments.PARTNER_WEBHOOK_SECRET,
|
|
40
|
+
header: 'x-hub-signature-256',
|
|
41
|
+
signaturePrefix: 'sha256=',
|
|
42
|
+
},
|
|
33
43
|
schema: Type.Object({ status: Type.String() }),
|
|
34
|
-
timeoutInMs:
|
|
44
|
+
timeoutInMs: 7 * 24 * 60 * 60 * 1000,
|
|
35
45
|
})
|
|
36
46
|
```
|
|
37
47
|
|
|
38
|
-
`
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
- Omit `request` when the partner already knows the URL (inbound only).
|
|
49
|
+
- Pass `{ wait: false }` as the second argument to get a handle, do other
|
|
50
|
+
work, then `await handle.wait()`.
|
|
51
|
+
- The fields of `auth` by type: `hmac` in **framework-hmac**, `jwt` and `jwks`
|
|
52
|
+
in **framework-jwks**. `basic`, `header` and `bearer` are built into the
|
|
53
|
+
core.
|
|
54
|
+
|
|
55
|
+
## Traps
|
|
56
|
+
|
|
57
|
+
- `auth` credentials (`secret`, `password`, `value`, `token`) are `Secret`s:
|
|
58
|
+
pass the `environments` entry whole. Do not read the value.
|
|
59
|
+
- A value in `request.headers` is a plain string and goes into the history.
|
|
60
|
+
- `schema` is the schema of the callback BODY, not of the dispatch answer. The
|
|
61
|
+
host refuses a body that does not match; your code never sees it.
|
|
62
|
+
- `timeoutInMs` is milliseconds. Without it, the activity sets no timeout.
|
|
63
|
+
- A dispatch with a network error or status 400 or more makes `webhook()`
|
|
64
|
+
throw `WebhookDispatchError` (`status`, `message`). No callback before the
|
|
65
|
+
timeout throws `WebhookTimeoutError`. Catch them in the workflow if the
|
|
66
|
+
workflow must continue.
|
|
67
|
+
- The request body is `{ json }` or `{ text }`, not a raw object.
|
|
68
|
+
`method` defaults to `POST`.
|
|
69
|
+
- `callback.headers` keys are lower case.
|
|
70
|
+
- The host must provide `GetActivityCallbackUrlClaim` (core) and
|
|
71
|
+
`HttpClientRequestClaim` (`@t4h.framework/http`). An invalid callback URL
|
|
72
|
+
throws `WebhookCallbackUrlError`.
|
|
73
|
+
- Partners cannot reach `localhost`. In development, use a local stub that
|
|
74
|
+
calls the `<<callbackUrl>>` it receives.
|
|
75
|
+
|
|
76
|
+
## Test
|
|
77
|
+
|
|
78
|
+
With `TestWorkflowEnvironment`, mock the activity like any async activity:
|
|
42
79
|
|
|
43
80
|
```typescript
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
it types `callback.body`.
|
|
54
|
-
- Rejections surface as errors from `await webhook()`: `WebhookDispatchError`
|
|
55
|
-
(`status?`, `message`) or `WebhookTimeoutError`. The stored output is
|
|
56
|
-
`{ reason: 'dispatch_failed', status?, message }` or `{ reason: 'timeout' }`.
|
|
57
|
-
- `webhook(options, { wait: false })` sends the request and returns a
|
|
58
|
-
`WebhookHandle` instead of suspending; do other work, then
|
|
59
|
-
`await handle.wait()`.
|
|
60
|
-
- The pending payload is only the partner's answer to the request. A workflow
|
|
61
|
-
that needs its own callback URL puts `<<callbackUrl>>` in the request body
|
|
62
|
-
and reads it back from `callback.dispatch`.
|
|
63
|
-
- Secrets come from `env`, never literals.
|
|
64
|
-
|
|
65
|
-
## Auth cheat sheet
|
|
66
|
-
|
|
67
|
-
- GitHub: `{ type: 'hmac', header: 'x-hub-signature-256', signaturePrefix: 'sha256=' }`
|
|
68
|
-
- Shopify: `{ type: 'hmac', header: 'x-shopify-hmac-sha256', signatureFormat: 'base64' }`
|
|
69
|
-
- Slack: `{ type: 'hmac', header: 'x-slack-signature', signaturePrefix: 'v0=', timestampHeader: 'x-slack-request-timestamp', toleranceInSeconds: 300, signedPayload: 'v0:{timestamp}:{body}' }`
|
|
70
|
-
- Fixed credentials: `basic`, `header`, `bearer`
|
|
71
|
-
- Google Pub/Sub push style: `{ type: 'jwt', jwksUri, issuer, audience }`
|
|
72
|
-
|
|
73
|
-
## How it fits the core
|
|
74
|
-
|
|
75
|
-
Every pending async activity can be advanced from outside through
|
|
76
|
-
`POST .../activities/:activityId/callbacks?token=…`. `WebhookActivity` only
|
|
77
|
-
adds the outbound request: `bootstrap` reads the URL from the core
|
|
78
|
-
`GetActivityCallbackUrlClaim`, sends `request` with `HttpClientRequestClaim`,
|
|
79
|
-
and returns `pending({ payload: dispatch, schema, auth, timeoutAt })`.
|
|
80
|
-
`advance` receives the parsed body as payload, the bootstrap pending (for
|
|
81
|
-
`dispatch`) and `{ method, headers }` as the third argument
|
|
82
|
-
(`AsyncActivityAdvanceContext`).
|
|
83
|
-
|
|
84
|
-
## Host contract
|
|
85
|
-
|
|
86
|
-
The callbacks route belongs to the core and serves every async activity; the
|
|
87
|
-
helpers below live in the `AsyncActivityCallback` namespace of `@t4h.framework/core`, not
|
|
88
|
-
in this package.
|
|
89
|
-
|
|
90
|
-
1. `GetActivityCallbackUrlClaim.getActivityCallbackUrl()`: absolute `http(s)`
|
|
91
|
-
URL of the current activity's callbacks route with
|
|
92
|
-
`?token=AsyncActivityCallback.deriveToken(secret, activityId)`. Nothing stored.
|
|
93
|
-
2. Callback route: `AsyncActivityCallback.isTokenValid` **first** (404 if the token was
|
|
94
|
-
never minted) → activity/pending lookup (503 + `Retry-After` if the pending
|
|
95
|
-
is not visible yet: the partner called back before the tick committed) →
|
|
96
|
-
`AsyncActivityCallback.authorize(pending.auth, { method, headers, rawBody }, authorizers)`
|
|
97
|
-
(401) → advance with `AsyncActivityCallback.parseBody(contentType, rawBody)` and
|
|
98
|
-
`{ method, headers: AsyncActivityCallback.flattenHeaders(headers) }`. 410 when no longer pending,
|
|
99
|
-
202 otherwise (repeats included).
|
|
100
|
-
3. `authorizers` is `{ hmac, jwt }` with the default exports of
|
|
101
|
-
`@t4h.framework/hmac/callback` and `@t4h.framework/jwks/callback`; `basic`,
|
|
102
|
-
`header` and `bearer` are built into the core. A declared type without a
|
|
103
|
-
authorizer throws `AsyncActivityCallbackAuthorizerMissingException`.
|
|
104
|
-
4. Verification needs the **raw body**; parse JSON only after it.
|
|
105
|
-
|
|
106
|
-
The dev server implements this in `packages/dev` (`DevGetActivityCallbackUrlClaim`,
|
|
107
|
-
`CallbackTokenService`, `CallbackAuthorizersService`,
|
|
108
|
-
`CreateWorkflowRunAsyncActivityPendingCallback`, route
|
|
109
|
-
`POST /projects/:project/workflows/:workflow/runs/:run/activities/:activity/callbacks`).
|
|
110
|
-
|
|
111
|
-
## Testing
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
import { mockAsync, fulfilled } from '@t4h.framework/core/testing'
|
|
115
|
-
|
|
116
|
-
mockAsync().on(
|
|
117
|
-
WebhookActivity,
|
|
118
|
-
fulfilled({ method: 'POST', headers: {}, body }),
|
|
119
|
-
)
|
|
81
|
+
import { fulfilled, mockAsync } from '@t4h.framework/core/testing'
|
|
82
|
+
import { WebhookActivity } from '@t4h.framework/webhook'
|
|
83
|
+
|
|
84
|
+
await env.execute(workflow, input, {
|
|
85
|
+
mockAsyncActivity: mockAsync().on(
|
|
86
|
+
WebhookActivity,
|
|
87
|
+
fulfilled({ method: 'POST', headers: {}, body: { status: 'signed' } }),
|
|
88
|
+
),
|
|
89
|
+
})
|
|
120
90
|
```
|
|
121
91
|
|
|
122
|
-
|
|
92
|
+
See the **framework-workflow-testing** skill for the harness.
|
|
123
93
|
|
|
124
|
-
|
|
125
|
-
Claim.run(
|
|
126
|
-
[
|
|
127
|
-
{ provide: HttpClientRequestClaim, value: fakeHttpClaim },
|
|
128
|
-
{ provide: GetActivityCallbackUrlClaim, value: fakeCallbackUrlClaim },
|
|
129
|
-
],
|
|
130
|
-
() => activity.bootstrap(input),
|
|
131
|
-
)
|
|
132
|
-
```
|
|
94
|
+
## Reference
|
|
133
95
|
|
|
134
|
-
|
|
96
|
+
- Guide: <https://tech4humans-brasil.github.io/framework/webhook/>
|
|
97
|
+
- Types: `node_modules/@t4h.framework/webhook/dist/webhook.d.ts`
|
|
98
|
+
- Callback `auth` types: `AsyncActivityCallbackAuth` in
|
|
99
|
+
`node_modules/@t4h.framework/core/dist/`
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @t4h.framework/webhook
|
|
2
2
|
|
|
3
|
+
## 0.2.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#257](https://github.com/tech4humans-brasil/framework/pull/257) [`586bfb4`](https://github.com/tech4humans-brasil/framework/commit/586bfb4663f4a478527ee0c8db360603f034d615) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The webhook README is now short and links to the site. The site page now describes the outbound request body and the claims that the host must provide, and gives a 410 answer for a callback after the activity was advanced.
|
|
8
|
+
|
|
9
|
+
## 0.2.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#243](https://github.com/tech4humans-brasil/framework/pull/243) [`0ffd663`](https://github.com/tech4humans-brasil/framework/commit/0ffd663ce8369edd7b54206cb3216568ad1de471) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The README examples read each value from `environments`, an `EnvDesign` in `src/constants/environments.ts`, and pass each credential as a `Secret`. They no longer use `process.env`, the raw `env` from the core or a literal in a `Secret` field. The jwks README describes the real context fields (`signature`, `rawPayload`) and says that a token that `jwt.verify` rejects throws.
|
|
14
|
+
|
|
15
|
+
- [#240](https://github.com/tech4humans-brasil/framework/pull/240) [`0606115`](https://github.com/tech4humans-brasil/framework/commit/0606115e2e0baa994e9f0ed3559ee54ecac88e44) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The skills do not repeat a rule that a lint rule, `tsc` or a runtime error already enforces. Each such rule is now one line that names the gate. The examples that broke a gate (`process.env`, `as any`, an inline secret, an `EnvDesign` in a workflow file, `ref.output` before `wait()`) are correct now.
|
|
16
|
+
|
|
17
|
+
- [#228](https://github.com/tech4humans-brasil/framework/pull/228) [`d29e1ab`](https://github.com/tech4humans-brasil/framework/commit/d29e1ab29a039b13c3e4b075472bd615566ae75e) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Uses exact types and `unknown` in place of `any`, and checks external data with guards.
|
|
18
|
+
- harness: the fix-issues prompt lists each sensor as `- checkTypes: PASS`. Before, it printed `- 0: [object Object]`.
|
|
19
|
+
- hmac: an algorithm name such as `constructor` throws `Unsupported algorithm`.
|
|
20
|
+
- oidc: a discovery response with no `introspection_endpoint`, or a null introspection body, throws a clear error.
|
|
21
|
+
- `HttpRequestActivity.toOutput` takes `HttpRequestActivityOutput` in place of `any`.
|
|
22
|
+
|
|
3
23
|
## 0.2.7
|
|
4
24
|
|
|
5
25
|
## 0.2.6
|
package/README.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# @t4h.framework/webhook
|
|
2
2
|
|
|
3
|
-
Suspend a workflow until a third party calls back over HTTP.
|
|
3
|
+
Suspend a T4H Framework workflow until a third party calls back over HTTP. The
|
|
4
|
+
host verifies the callback before the workflow sees it.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @t4h.framework/webhook @t4h.framework/core @t4h.framework/http
|
|
10
|
+
```
|
|
4
11
|
|
|
5
12
|
## Usage
|
|
6
13
|
|
|
@@ -8,38 +15,28 @@ Suspend a workflow until a third party calls back over HTTP.
|
|
|
8
15
|
import { webhook } from '@t4h.framework/webhook'
|
|
9
16
|
import Type from 'typebox'
|
|
10
17
|
|
|
18
|
+
import { environments } from './constants/environments.js'
|
|
19
|
+
|
|
11
20
|
const callback = await webhook({
|
|
12
21
|
request: {
|
|
13
22
|
url: 'https://partner.example.com/jobs',
|
|
14
23
|
body: { json: { callback: '<<callbackUrl>>' } },
|
|
15
24
|
},
|
|
16
|
-
auth: {
|
|
25
|
+
auth: {
|
|
26
|
+
type: 'hmac',
|
|
27
|
+
secret: environments.PARTNER_SECRET,
|
|
28
|
+
header: 'x-signature',
|
|
29
|
+
},
|
|
17
30
|
schema: Type.Object({ status: Type.String() }),
|
|
18
31
|
timeoutInMs: 24 * 60 * 60 * 1000,
|
|
19
32
|
})
|
|
20
33
|
|
|
21
|
-
callback.
|
|
22
|
-
callback.body.status // typed by the schema
|
|
34
|
+
callback.body.status
|
|
23
35
|
```
|
|
24
36
|
|
|
25
|
-
|
|
26
|
-
`
|
|
27
|
-
when the partner posts to it. The callback must carry the token in the URL and
|
|
28
|
-
pass the `auth` you declared; the body must match `schema`.
|
|
29
|
-
|
|
30
|
-
A failed request throws `WebhookDispatchError` and a callback that never
|
|
31
|
-
arrives before `timeoutInMs` throws `WebhookTimeoutError`, so the workflow
|
|
32
|
-
never sees a callback that did not happen.
|
|
33
|
-
|
|
34
|
-
Supported `auth`: `hmac` (GitHub, Shopify, Slack style), `basic`, `header`,
|
|
35
|
-
`bearer`, `jwt` (bearer JWT verified with a JWKS) and `jwks` (detached
|
|
36
|
-
signature verified with a JWKS key).
|
|
37
|
+
Declare `PARTNER_SECRET` with `type: Secret` in the `EnvDesign` in
|
|
38
|
+
`src/constants/environments.ts`.
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
suspending; you get a handle and call `handle.wait()` later.
|
|
40
|
+
## Documentation
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
route, both defined by `@t4h.framework/core` and shared by every async
|
|
43
|
-
activity; the outbound request goes through `HttpClientRequestClaim` from
|
|
44
|
-
`@t4h.framework/http`. Peer dependencies: `@t4h.framework/core` and
|
|
45
|
-
`@t4h.framework/http`.
|
|
42
|
+
<https://tech4humans-brasil.github.io/framework/webhook/>
|
|
@@ -19,7 +19,7 @@ export declare const WEBHOOK_DISPATCH_TIMEOUT_IN_MS = 60000;
|
|
|
19
19
|
export declare class WebhookActivity<TSchema extends Type.TSchema = Type.TSchema> extends AsyncActivity<readonly [options: WebhookOptions<TSchema>], WebhookActivityInput, WebhookCallbackOutput | WebhookRejectedOutput, WebhookCallback<Type.Static<TSchema>>, WebhookDispatchResponse | undefined, TSchema> {
|
|
20
20
|
private readonly [WEBHOOK_ACTIVITY_CLAIMS];
|
|
21
21
|
toInput(options: WebhookOptions<TSchema>): WebhookActivityInput;
|
|
22
|
-
bootstrap(input: WebhookActivityInput): Promise<AsyncActivityResultPending<WebhookDispatchResponse | undefined, TSchema> | import("@t4h.framework/core").AsyncActivityResultRejected<
|
|
22
|
+
bootstrap(input: WebhookActivityInput): Promise<AsyncActivityResultPending<WebhookDispatchResponse | undefined, TSchema> | import("@t4h.framework/core").AsyncActivityResultRejected<import("@t4h.framework/core").SerializableOrVoid>>;
|
|
23
23
|
private dispatch;
|
|
24
24
|
advance(payload: Type.Static<TSchema>, bootstrap: AsyncActivityResultPending<WebhookDispatchResponse | undefined>, context?: AsyncActivityAdvanceContext): import("@t4h.framework/core").AsyncActivityResultFulfilled<WebhookRejectedOutput | WebhookCallbackOutput | undefined>;
|
|
25
25
|
toOutput(output: WebhookCallbackOutput | WebhookRejectedOutput): WebhookCallback<Type.Static<TSchema>>;
|
|
@@ -69,7 +69,7 @@ export class WebhookActivity extends AsyncActivity {
|
|
|
69
69
|
return {
|
|
70
70
|
reason: 'dispatch_failed',
|
|
71
71
|
status: response.status,
|
|
72
|
-
message: `Dispatch to ${dispatch.url} answered ${response.status}`,
|
|
72
|
+
message: `Dispatch to ${dispatch.url} answered ${String(response.status)}`,
|
|
73
73
|
};
|
|
74
74
|
return {
|
|
75
75
|
status: response.status,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookActivity.js","sourceRoot":"","sources":["../../src/activities/WebhookActivity.ts"],"names":[],"mappings":"AA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YACvB,IAAI,EAAE,MAAM,CAAC,IAA4B;YACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAA;IACH,CAAC;CACF;AAoBD,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,OAAgC,EAChC,EAAE,IAAI,GAAG,IAAI,KAAyB,EAAE;IAExC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CACrC,eAAqD,EACrD,OAAO,CACR,CAAA;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;AACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/webhook",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Webhook module for the T4H Framework",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/webhook",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc --project tsconfig.build.json",
|
|
28
28
|
"check-types": "tsc --noEmit",
|
|
29
|
+
"check-package": "publint --strict && attw --pack . --profile esm-only",
|
|
30
|
+
"lint": "eslint . --max-warnings 0",
|
|
29
31
|
"prepublishOnly": "yarn build",
|
|
30
32
|
"test": "vitest run",
|
|
31
33
|
"test:watch": "vitest"
|
|
@@ -34,8 +36,8 @@
|
|
|
34
36
|
"typebox": "^1.1.6"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@t4h.framework/core": "^0.
|
|
38
|
-
"@t4h.framework/http": "^0.
|
|
39
|
+
"@t4h.framework/core": "^0.21.0",
|
|
40
|
+
"@t4h.framework/http": "^0.8.1",
|
|
39
41
|
"typescript": "^5.9.3",
|
|
40
42
|
"vitest": "^4.0.18"
|
|
41
43
|
},
|