@forgerock/sdk-request-middleware 0.0.0-beta-20250506165419
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 +7 -0
- package/LICENSE +21 -0
- package/README.md +145 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +3 -0
- package/dist/src/lib/request-mware.derived.d.ts +12 -0
- package/dist/src/lib/request-mware.derived.d.ts.map +1 -0
- package/dist/src/lib/request-mware.derived.js +15 -0
- package/dist/src/lib/request-mware.effects.d.ts +27 -0
- package/dist/src/lib/request-mware.effects.d.ts.map +1 -0
- package/dist/src/lib/request-mware.effects.js +62 -0
- package/dist/src/lib/request-mware.mock.d.ts +5 -0
- package/dist/src/lib/request-mware.mock.d.ts.map +1 -0
- package/dist/src/lib/request-mware.mock.js +96 -0
- package/dist/src/lib/request-mware.types.d.ts +20 -0
- package/dist/src/lib/request-mware.types.d.ts.map +1 -0
- package/dist/src/lib/request-mware.types.js +7 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/eslint.config.mjs +22 -0
- package/package.json +35 -0
- package/src/index.ts +3 -0
- package/src/lib/request-mware.derived.ts +19 -0
- package/src/lib/request-mware.effects.ts +88 -0
- package/src/lib/request-mware.mock.ts +98 -0
- package/src/lib/request-mware.test.ts +207 -0
- package/src/lib/request-mware.types.ts +45 -0
- package/tsconfig.json +16 -0
- package/tsconfig.lib.json +34 -0
- package/tsconfig.spec.json +41 -0
- package/typedoc.json +4 -0
- package/vite.config.ts +22 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @forgerock/sdk-request-middleware
|
|
2
|
+
|
|
3
|
+
## 0.0.0-beta-20250506165419
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#246](https://github.com/ForgeRock/ping-javascript-sdk/pull/246) [`0d54b34`](https://github.com/ForgeRock/ping-javascript-sdk/commit/0d54b3461443fcf5c5071a08578f2d418f066073) Thanks [@cerebrl](https://github.com/cerebrl)! - created effects type packages, logger, oidc, and request middleware
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ping Identity Corporation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# SDK Request Middleware
|
|
2
|
+
|
|
3
|
+
A flexible middleware system for intercepting and modifying HTTP requests in the Ping Identity JavaScript SDK.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a middleware architecture that allows developers to intercept, inspect, and modify HTTP requests before they are sent to the server. It's designed to work with Redux Toolkit's Query API, providing a familiar middleware pattern for request manipulation.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Request Interception**: Intercept outgoing API requests before they reach the server
|
|
12
|
+
- **Request Modification**: Modify URL parameters, headers, and request bodies
|
|
13
|
+
- **Action-Based Middleware**: Process requests based on specific action types
|
|
14
|
+
- **Middleware Chain**: Execute multiple middleware functions in sequence
|
|
15
|
+
- **Immutable Actions**: Prevent accidental mutation of action objects
|
|
16
|
+
- **TypeScript Support**: Built with TypeScript for better developer experience and type safety
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @forgerock/sdk-request-middleware
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { initQuery } from '@forgerock/sdk-request-middleware';
|
|
30
|
+
|
|
31
|
+
// Define your middleware functions
|
|
32
|
+
const requestMiddleware = [
|
|
33
|
+
(req, action, next) => {
|
|
34
|
+
// Add custom headers
|
|
35
|
+
req.headers.set('x-custom-header', 'custom-value');
|
|
36
|
+
|
|
37
|
+
// Continue to the next middleware
|
|
38
|
+
next();
|
|
39
|
+
},
|
|
40
|
+
(req, action, next) => {
|
|
41
|
+
// Add URL parameters
|
|
42
|
+
req.url.searchParams.set('timestamp', Date.now().toString());
|
|
43
|
+
|
|
44
|
+
// Continue to the next middleware
|
|
45
|
+
next();
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
// Create a request
|
|
50
|
+
const fetchArgs = { url: 'https://api.example.com/resource' };
|
|
51
|
+
|
|
52
|
+
// Initialize a query and apply middleware
|
|
53
|
+
const response = await initQuery(fetchArgs, 'start')
|
|
54
|
+
.applyMiddleware(requestMiddleware)
|
|
55
|
+
.applyQuery(async (args) => {
|
|
56
|
+
// Your fetch implementation here
|
|
57
|
+
return fetch(args.url, args);
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Action-Based Middleware
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { initQuery } from '@forgerock/sdk-request-middleware';
|
|
65
|
+
|
|
66
|
+
const authMiddleware = [
|
|
67
|
+
(req, action, next) => {
|
|
68
|
+
// Apply different logic based on action type
|
|
69
|
+
switch (action.type) {
|
|
70
|
+
case 'DAVINCI_START':
|
|
71
|
+
req.url.searchParams.set(...params);
|
|
72
|
+
break;
|
|
73
|
+
case 'DAVINCI_NEXT'
|
|
74
|
+
req.url.searchParams.set(...params);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Add authorization token from action payload if available
|
|
79
|
+
if (action.payload?.token) {
|
|
80
|
+
req.headers.set('Authorization', `Bearer ${action.payload.token}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
next();
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
// Use the middleware with specific action type
|
|
88
|
+
const response = await initQuery(fetchArgs, 'login')
|
|
89
|
+
.applyMiddleware(authMiddleware)
|
|
90
|
+
.applyQuery(queryCallback);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## API Reference
|
|
94
|
+
|
|
95
|
+
### `initQuery(fetchArgs, endpoint)`
|
|
96
|
+
|
|
97
|
+
Initializes a query object that can be used to apply middleware and execute HTTP requests.
|
|
98
|
+
|
|
99
|
+
**Parameters:**
|
|
100
|
+
|
|
101
|
+
- `fetchArgs`: A FetchArgs object containing the URL and any other request options
|
|
102
|
+
- `endpoint`: A string representing the endpoint being called (maps to an action type)
|
|
103
|
+
|
|
104
|
+
**Returns:**
|
|
105
|
+
A query API object with the following methods:
|
|
106
|
+
|
|
107
|
+
### `applyMiddleware(middleware)`
|
|
108
|
+
|
|
109
|
+
Applies an array of middleware functions to the request.
|
|
110
|
+
|
|
111
|
+
**Parameters:**
|
|
112
|
+
|
|
113
|
+
- `middleware`: An array of middleware functions that conform to the RequestMiddleware type
|
|
114
|
+
|
|
115
|
+
**Returns:**
|
|
116
|
+
The query API object for chaining
|
|
117
|
+
|
|
118
|
+
### `applyQuery(callback)`
|
|
119
|
+
|
|
120
|
+
Executes the request with the provided callback function.
|
|
121
|
+
|
|
122
|
+
**Parameters:**
|
|
123
|
+
|
|
124
|
+
- `callback`: A function that takes the modified request and returns a Promise with the API response
|
|
125
|
+
|
|
126
|
+
**Returns:**
|
|
127
|
+
A Promise with the result of the callback function
|
|
128
|
+
|
|
129
|
+
### RequestMiddleware Type
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
type RequestMiddleware<Type, Payload> = (
|
|
133
|
+
req: ModifiedFetchArgs,
|
|
134
|
+
action: Action<Type, Payload>,
|
|
135
|
+
next: () => ModifiedFetchArgs,
|
|
136
|
+
) => void;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Building
|
|
140
|
+
|
|
141
|
+
Run `nx build sdk-request-middleware` to build the library.
|
|
142
|
+
|
|
143
|
+
## Running unit tests
|
|
144
|
+
|
|
145
|
+
Run `nx test sdk-request-middleware` to execute the unit tests via [Vitest](https://vitest.dev/).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const actionTypes: {
|
|
2
|
+
readonly start: "DAVINCI_START";
|
|
3
|
+
readonly next: "DAVINCI_NEXT";
|
|
4
|
+
readonly flow: "DAVINCI_FLOW";
|
|
5
|
+
readonly success: "DAVINCI_SUCCESS";
|
|
6
|
+
readonly error: "DAVINCI_ERROR";
|
|
7
|
+
readonly failure: "DAVINCI_FAILURE";
|
|
8
|
+
readonly resume: "DAVINCI_RESUME";
|
|
9
|
+
};
|
|
10
|
+
export type ActionTypes = (typeof actionTypes)[keyof typeof actionTypes];
|
|
11
|
+
export type EndpointTypes = keyof typeof actionTypes;
|
|
12
|
+
//# sourceMappingURL=request-mware.derived.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-mware.derived.d.ts","sourceRoot":"","sources":["../../../src/lib/request-mware.derived.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW;;;;;;;;CAQd,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
export const actionTypes = {
|
|
8
|
+
start: 'DAVINCI_START',
|
|
9
|
+
next: 'DAVINCI_NEXT',
|
|
10
|
+
flow: 'DAVINCI_FLOW',
|
|
11
|
+
success: 'DAVINCI_SUCCESS',
|
|
12
|
+
error: 'DAVINCI_ERROR',
|
|
13
|
+
failure: 'DAVINCI_FAILURE',
|
|
14
|
+
resume: 'DAVINCI_RESUME',
|
|
15
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta, QueryReturnValue } from '@reduxjs/toolkit/query';
|
|
2
|
+
import type { ActionTypes, EndpointTypes } from './request-mware.derived.js';
|
|
3
|
+
import type { ModifiedFetchArgs, RequestMiddleware } from './request-mware.types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @function middlewareWrapper - A "Node" and "Redux" style middleware that is called just before
|
|
6
|
+
* the request is made from the SDK. This allows you access to the request for modification.
|
|
7
|
+
* @param request - A request object container of the URL and the Request Init object
|
|
8
|
+
* @param action - The action object that is passed into the middleware communicating intent
|
|
9
|
+
* @param action.type - A "Redux" style type that contains the serialized action
|
|
10
|
+
* @param action.payload - The payload of the action that can contain metadata
|
|
11
|
+
* @returns {function} - Function that takes middleware parameter & runs middleware against request
|
|
12
|
+
*/
|
|
13
|
+
export declare function middlewareWrapper(request: ModifiedFetchArgs, { type, payload }: {
|
|
14
|
+
type: ActionTypes;
|
|
15
|
+
payload?: any;
|
|
16
|
+
}): (middleware: RequestMiddleware<typeof type, typeof payload>[] | undefined) => ModifiedFetchArgs;
|
|
17
|
+
/**
|
|
18
|
+
* @function initQuery - Initializes a query object with the provided request object
|
|
19
|
+
* @param {FetchArgs} fetchArgs - The request object to initialize the query with
|
|
20
|
+
* @param {string} endpoint - The endpoint to be used for the query
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare function initQuery(fetchArgs: FetchArgs, endpoint: EndpointTypes): {
|
|
24
|
+
applyMiddleware(middleware: RequestMiddleware<ActionTypes, ModifiedFetchArgs["body"]>[] | undefined): /*elided*/ any;
|
|
25
|
+
applyQuery(callback: (request: FetchArgs) => Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>): Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=request-mware.effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-mware.effects.d.ts","sourceRoot":"","sources":["../../../src/lib/request-mware.effects.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAErF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,EAE1B,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,GACtD,CAAC,UAAU,EAAE,iBAAiB,CAAC,OAAO,IAAI,EAAE,OAAO,OAAO,CAAC,EAAE,GAAG,SAAS,KAAK,iBAAiB,CAoBjG;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa;gCAQrD,iBAAiB,CAAC,WAAW,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS;yBAUzE,CACR,OAAO,EAAE,SAAS,KACf,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;EAOrF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
import { actionTypes } from './request-mware.derived.js';
|
|
8
|
+
/**
|
|
9
|
+
* @function middlewareWrapper - A "Node" and "Redux" style middleware that is called just before
|
|
10
|
+
* the request is made from the SDK. This allows you access to the request for modification.
|
|
11
|
+
* @param request - A request object container of the URL and the Request Init object
|
|
12
|
+
* @param action - The action object that is passed into the middleware communicating intent
|
|
13
|
+
* @param action.type - A "Redux" style type that contains the serialized action
|
|
14
|
+
* @param action.payload - The payload of the action that can contain metadata
|
|
15
|
+
* @returns {function} - Function that takes middleware parameter & runs middleware against request
|
|
16
|
+
*/
|
|
17
|
+
export function middlewareWrapper(request,
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
{ type, payload }) {
|
|
20
|
+
// no mutation and no reassignment
|
|
21
|
+
const actionCopy = Object.freeze({ type, payload });
|
|
22
|
+
return (middleware) => {
|
|
23
|
+
if (!Array.isArray(middleware)) {
|
|
24
|
+
return request;
|
|
25
|
+
}
|
|
26
|
+
// Copy middleware so the `shift` below doesn't mutate source
|
|
27
|
+
const mwareCopy = middleware.map((fn) => fn);
|
|
28
|
+
function iterator() {
|
|
29
|
+
const nextMiddlewareToBeCalled = mwareCopy.shift();
|
|
30
|
+
if (nextMiddlewareToBeCalled)
|
|
31
|
+
nextMiddlewareToBeCalled(request, actionCopy, iterator);
|
|
32
|
+
return request;
|
|
33
|
+
}
|
|
34
|
+
return iterator();
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @function initQuery - Initializes a query object with the provided request object
|
|
39
|
+
* @param {FetchArgs} fetchArgs - The request object to initialize the query with
|
|
40
|
+
* @param {string} endpoint - The endpoint to be used for the query
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export function initQuery(fetchArgs, endpoint) {
|
|
44
|
+
let modifiedRequest = {
|
|
45
|
+
...fetchArgs,
|
|
46
|
+
url: new URL(fetchArgs.url),
|
|
47
|
+
headers: new Headers(fetchArgs.headers),
|
|
48
|
+
};
|
|
49
|
+
const queryApi = {
|
|
50
|
+
applyMiddleware(middleware) {
|
|
51
|
+
// Iterates and executes provided middleware functions
|
|
52
|
+
// Allow middleware to mutate `request` argument
|
|
53
|
+
const runMiddleware = middlewareWrapper(modifiedRequest, { type: actionTypes[endpoint] });
|
|
54
|
+
modifiedRequest = runMiddleware(middleware);
|
|
55
|
+
return queryApi;
|
|
56
|
+
},
|
|
57
|
+
async applyQuery(callback) {
|
|
58
|
+
return await callback({ ...modifiedRequest, url: modifiedRequest.url.toString() });
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
return queryApi;
|
|
62
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ActionTypes } from './request-mware.derived.js';
|
|
2
|
+
import type { RequestMiddleware } from './request-mware.types.js';
|
|
3
|
+
declare const middleware: RequestMiddleware<ActionTypes>[];
|
|
4
|
+
export default middleware;
|
|
5
|
+
//# sourceMappingURL=request-mware.mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-mware.mock.d.ts","sourceRoot":"","sources":["../../../src/lib/request-mware.mock.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAA6B,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAY7F,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,WAAW,CAAC,EA2E/C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
const a = 'a';
|
|
8
|
+
const b = 'b';
|
|
9
|
+
const one = '1';
|
|
10
|
+
const two = '2';
|
|
11
|
+
const add = 'ADD';
|
|
12
|
+
const reassignment = 'REASSIGNMENT';
|
|
13
|
+
const mutateAction = 'MUTATE-ACTION';
|
|
14
|
+
const middleware = [
|
|
15
|
+
(req, action, next) => {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case a:
|
|
18
|
+
case b:
|
|
19
|
+
req.url.searchParams.set('letter', 'true');
|
|
20
|
+
if (req.headers)
|
|
21
|
+
req.headers.set('x-letter', 'true');
|
|
22
|
+
break;
|
|
23
|
+
case one:
|
|
24
|
+
case two:
|
|
25
|
+
req.url.searchParams.set('letter', 'false');
|
|
26
|
+
if (req.headers)
|
|
27
|
+
req.headers.set('x-letter', 'false');
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
next();
|
|
31
|
+
},
|
|
32
|
+
(req, action, next) => {
|
|
33
|
+
switch (action.type) {
|
|
34
|
+
case a:
|
|
35
|
+
req.url.searchParams.set('char', 'a');
|
|
36
|
+
if (req.headers)
|
|
37
|
+
req.headers.set('x-char', 'a');
|
|
38
|
+
break;
|
|
39
|
+
case b:
|
|
40
|
+
req.url.searchParams.set('char', 'b');
|
|
41
|
+
if (req.headers)
|
|
42
|
+
req.headers.set('x-char', 'b');
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
next();
|
|
46
|
+
},
|
|
47
|
+
(req, action, next) => {
|
|
48
|
+
switch (action.type) {
|
|
49
|
+
case one:
|
|
50
|
+
req.url.searchParams.set('char', '1');
|
|
51
|
+
if (req.headers)
|
|
52
|
+
req.headers.set('x-char', '1');
|
|
53
|
+
break;
|
|
54
|
+
case two:
|
|
55
|
+
req.url.searchParams.set('char', '2');
|
|
56
|
+
if (req.headers)
|
|
57
|
+
req.headers.set('x-char', '2');
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
next();
|
|
61
|
+
},
|
|
62
|
+
(req, action, next) => {
|
|
63
|
+
switch (action.type) {
|
|
64
|
+
case add:
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
req.headers?.set('x-char', 'a,' + action.payload);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
next();
|
|
71
|
+
},
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
(req, action, next) => {
|
|
75
|
+
switch (action.type) {
|
|
76
|
+
case reassignment:
|
|
77
|
+
req = {
|
|
78
|
+
url: new URL('https://bad.com'),
|
|
79
|
+
headers: new Headers({ 'x-bad': 'true' }),
|
|
80
|
+
};
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
next();
|
|
84
|
+
},
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
(req, action, next) => {
|
|
88
|
+
switch (action.type) {
|
|
89
|
+
case mutateAction:
|
|
90
|
+
action.type = 'hello';
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
next();
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
export default middleware;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta, QueryReturnValue } from '@reduxjs/toolkit/query';
|
|
2
|
+
import { ActionTypes } from './request-mware.derived.js';
|
|
3
|
+
export type RequestMiddleware<Type extends ActionTypes = ActionTypes, Payload = unknown> = (req: ModifiedFetchArgs, action: Action<Type, Payload>, next: () => ModifiedFetchArgs) => void;
|
|
4
|
+
export interface QueryApi<Type extends ActionTypes = ActionTypes, Payload = unknown> {
|
|
5
|
+
applyMiddleware(middleware: RequestMiddleware<Type, Payload>[]): QueryApi<ActionTypes, unknown>;
|
|
6
|
+
applyQuery(callback: (request: FetchArgs) => Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>): Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>;
|
|
7
|
+
}
|
|
8
|
+
export interface Action<Type extends ActionTypes = ActionTypes, Payload = unknown> {
|
|
9
|
+
type: Type;
|
|
10
|
+
payload: Payload;
|
|
11
|
+
}
|
|
12
|
+
export interface ModifiedFetchArgs extends Omit<FetchArgs, 'url'> {
|
|
13
|
+
url: URL;
|
|
14
|
+
headers?: Headers;
|
|
15
|
+
}
|
|
16
|
+
export interface RequestObj {
|
|
17
|
+
url: URL;
|
|
18
|
+
init: RequestInit;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=request-mware.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-mware.types.d.ts","sourceRoot":"","sources":["../../../src/lib/request-mware.types.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,MAAM,iBAAiB,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,EAAE,OAAO,GAAG,OAAO,IAAI,CACzF,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC7B,IAAI,EAAE,MAAM,iBAAiB,KAC1B,IAAI,CAAC;AAEV,MAAM,WAAW,QAAQ,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,EAAE,OAAO,GAAG,OAAO;IACjF,eAAe,CAAC,UAAU,EAAE,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAChG,UAAU,CACR,QAAQ,EAAE,CACR,OAAO,EAAE,SAAS,KACf,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC,GAC/E,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC,CAAC;CAChF;AAED,MAAM,WAAW,MAAM,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,EAAE,OAAO,GAAG,OAAO;IAC/E,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC;IAC/D,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,WAAW,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2023.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2023.array.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.object.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2024.string.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.array.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.esnext.full.d.ts","../../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.d.ts","../../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/modules/index.d.ts","../../../../node_modules/.pnpm/redux@5.0.1/node_modules/redux/dist/redux.d.ts","../../../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/dist/immer.d.ts","../../../../node_modules/.pnpm/reselect@5.1.1/node_modules/reselect/dist/reselect.d.ts","../../../../node_modules/.pnpm/redux-thunk@3.1.0_redux@5.0.1/node_modules/redux-thunk/dist/redux-thunk.d.ts","../../../../node_modules/.pnpm/@reduxjs+toolkit@2.7.0/node_modules/@reduxjs/toolkit/dist/uncheckedindexed.ts","../../../../node_modules/.pnpm/@reduxjs+toolkit@2.7.0/node_modules/@reduxjs/toolkit/dist/index.d.ts","../../../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.cts","../../../../node_modules/.pnpm/@standard-schema+utils@0.3.0/node_modules/@standard-schema/utils/dist/index.d.cts","../../../../node_modules/.pnpm/@reduxjs+toolkit@2.7.0/node_modules/@reduxjs/toolkit/dist/query/index.d.ts","../src/lib/request-mware.derived.ts","../src/lib/request-mware.types.ts","../src/lib/request-mware.effects.ts","../src/index.ts","../src/lib/request-mware.mock.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/compatibility/disposable.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/compatibility/indexable.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/compatibility/iterators.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/compatibility/index.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/globals.typedarray.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/buffer.buffer.d.ts","../../../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/globals.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/assert.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/buffer.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/child_process.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/cluster.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/console.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/constants.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/crypto.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/dgram.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/dns.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/domain.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/dom-events.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/events.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/fs.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/http.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/http2.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/https.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/inspector.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/module.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/net.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/os.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/path.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/process.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/punycode.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/querystring.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/readline.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/repl.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/sea.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/sqlite.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/stream.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/stream/web.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/test.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/timers.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/tls.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/trace_events.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/tty.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/url.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/util.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/v8.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/vm.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/wasi.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/zlib.d.ts","../../../../node_modules/.pnpm/@types+node@22.14.1/node_modules/@types/node/index.d.ts"],"fileIdsList":[[85,86,87,88,89,104,147],[85,86,90,91,92,104,147],[83,104,147],[104,147],[91,104,147],[104,144,147],[104,146,147],[147],[104,147,152,182],[104,147,148,153,159,160,167,179,190],[104,147,148,149,159,167],[99,100,101,104,147],[104,147,150,191],[104,147,151,152,160,168],[104,147,152,179,187],[104,147,153,155,159,167],[104,146,147,154],[104,147,155,156],[104,147,159],[104,147,157,159],[104,146,147,159],[104,147,159,160,161,179,190],[104,147,159,160,161,174,179,182],[104,142,147,195],[104,142,147,155,159,162,167,179,190],[104,147,159,160,162,163,167,179,187,190],[104,147,162,164,179,187,190],[102,103,104,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196],[104,147,159,165],[104,147,166,190],[104,147,155,159,167,179],[104,147,168],[104,147,169],[104,146,147,170],[104,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196],[104,147,172],[104,147,173],[104,147,159,174,175],[104,147,174,176,191,193],[104,147,159,179,180,182],[104,147,181,182],[104,147,179,180],[104,147,182],[104,147,183],[104,144,147,179],[104,147,159,185,186],[104,147,185,186],[104,147,152,167,179,187],[104,147,188],[104,147,167,189],[104,147,162,173,190],[104,147,152,191],[104,147,179,192],[104,147,166,193],[104,147,194],[104,147,152,159,161,170,179,190,193,195],[104,147,179,196],[85,104,147],[104,114,118,147,190],[104,114,147,179,190],[104,109,147],[104,111,114,147,187,190],[104,147,167,187],[104,147,197],[104,109,147,197],[104,111,114,147,167,190],[104,106,107,110,113,147,159,179,190],[104,114,121,147],[104,106,112,147],[104,114,135,136,147],[104,110,114,147,182,190,197],[104,135,147,197],[104,108,109,147,197],[104,114,147],[104,108,109,110,111,112,113,114,115,116,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,136,137,138,139,140,141,147],[104,114,129,147],[104,114,121,122,147],[104,112,114,122,123,147],[104,113,147],[104,106,109,114,147],[104,114,118,122,123,147],[104,118,147],[104,112,114,117,147,190],[104,106,111,114,121,147],[104,147,179],[104,109,114,135,147,195,197],[84,94,95,96,104,147],[84,104,147],[84,93,94,95,104,147],[84,94,95,104,147],[84,93,94,104,147]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"e12a46ce14b817d4c9e6b2b478956452330bf00c9801b79de46f7a1815b5bd40","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"69e65d976bf166ce4a9e6f6c18f94d2424bf116e90837ace179610dbccad9b42","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"bab26767638ab3557de12c900f0b91f710c7dc40ee9793d5a27d32c04f0bf646","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"61d6a2092f48af66dbfb220e31eea8b10bc02b6932d6e529005fd2d7b3281290","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"b8f34dd1757f68e03262b1ca3ddfa668a855b872f8bdd5224d6f993a7b37dc2c","impliedFormat":99},{"version":"f734b58ea162765ff4d4a36f671ee06da898921e985a2064510f4925ec1ed062","affectsGlobalScope":true,"impliedFormat":1},{"version":"07cbc706c24fa086bcc20daee910b9afa5dc5294e14771355861686c9d5235fd","impliedFormat":1},{"version":"37f96daaddc2dd96712b2e86f3901f477ac01a5c2539b1bc07fd609d62039ee1","impliedFormat":1},{"version":"9c5c84c449a3d74e417343410ba9f1bd8bfeb32abd16945a1b3d0592ded31bc8","impliedFormat":1},{"version":"a7f09d2aaf994dbfd872eda4f2411d619217b04dbe0916202304e7a3d4b0f5f8","impliedFormat":1},{"version":"be5bb7b563c09119bd9f32b3490ab988852ffe10d4016087c094a80ddf6a0e28","impliedFormat":1},{"version":"76af14c3cce62da183aaf30375e3a4613109d16c7f16d30702f16d625a95e62c","impliedFormat":1},{"version":"4849b56231f70b71fb554853ea8b75e85495548078e570c77022d44f82a0fc04","impliedFormat":1},{"version":"a3fb5f172f75d6d910196bff78a3f223bc39ad22787b33485c143090fa5cc906","impliedFormat":1},{"version":"738cf8f1690f064ef73b0853abef3d6e9f8b3bc45d9a58da0c5e0625647dacd0","signature":"5b34b9d23911290a28d1c0e06028976290811ef9bab3a5af8df5d177e7e16414","impliedFormat":99},{"version":"cb09562ff2bff5e6584f56d7efbebf1542d0c8b66780b8f7c95feb008506b98a","signature":"cbde0254cb083bd495939157e7ae5acfd1ad7ea684f6fdf54ee4de6c5800946f","impliedFormat":99},{"version":"ac5b043bec230977c121d7a7d993e1d36d22ebfdeed8767b424383a99b78e785","signature":"7052144c8e852be2bc2fc83a1a3ba2674e89d3c7df0728a2334f1e56477af6a4","impliedFormat":99},{"version":"753c2f0a70aa6c0494e7a845d5a14e7cdad6e7e62b437b3c96fd7a63fa8a8608","impliedFormat":99},{"version":"d654385cc57fe02424060bdc49f08ccfea04b87be0382b0f7d71d885b3877505","signature":"e1b6a77690cf37cc29e1bdce80081e7f30d9e388d413e120e7ccdb3b8016ae1c","impliedFormat":99},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"030e350db2525514580ed054f712ffb22d273e6bc7eddc1bb7eda1e0ba5d395e","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"a79e62f1e20467e11a904399b8b18b18c0c6eea6b50c1168bf215356d5bebfaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"8fa51737611c21ba3a5ac02c4e1535741d58bec67c9bdf94b1837a31c97a2263","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"d2bc987ae352271d0d615a420dcf98cc886aa16b87fb2b569358c1fe0ca0773d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4f0539c58717cbc8b73acb29f9e992ab5ff20adba5f9b57130691c7f9b186a4d","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"76103716ba397bbb61f9fa9c9090dca59f39f9047cb1352b2179c5d8e7f4e8d0","impliedFormat":1},{"version":"f9677e434b7a3b14f0a9367f9dfa1227dfe3ee661792d0085523c3191ae6a1a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"4314c7a11517e221f7296b46547dbc4df047115b182f544d072bdccffa57fc72","impliedFormat":1},{"version":"115971d64632ea4742b5b115fb64ed04bcaae2c3c342f13d9ba7e3f9ee39c4e7","impliedFormat":1},{"version":"c2510f124c0293ab80b1777c44d80f812b75612f297b9857406468c0f4dafe29","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"9057f224b79846e3a95baf6dad2c8103278de2b0c5eebda23fc8188171ad2398","affectsGlobalScope":true,"impliedFormat":1},{"version":"19d5f8d3930e9f99aa2c36258bf95abbe5adf7e889e6181872d1cdba7c9a7dd5","impliedFormat":1},{"version":"e6f5a38687bebe43a4cef426b69d34373ef68be9a6b1538ec0a371e69f309354","impliedFormat":1},{"version":"a6bf63d17324010ca1fbf0389cab83f93389bb0b9a01dc8a346d092f65b3605f","impliedFormat":1},{"version":"e009777bef4b023a999b2e5b9a136ff2cde37dc3f77c744a02840f05b18be8ff","impliedFormat":1},{"version":"1e0d1f8b0adfa0b0330e028c7941b5a98c08b600efe7f14d2d2a00854fb2f393","impliedFormat":1},{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true,"impliedFormat":1},{"version":"88bc59b32d0d5b4e5d9632ac38edea23454057e643684c3c0b94511296f2998c","affectsGlobalScope":true,"impliedFormat":1},{"version":"e0476e6b51a47a8eaf5ee6ecab0d686f066f3081de9a572f1dde3b2a8a7fb055","impliedFormat":1},{"version":"1e289f30a48126935a5d408a91129a13a59c9b0f8c007a816f9f16ef821e144e","impliedFormat":1},{"version":"f96a023e442f02cf551b4cfe435805ccb0a7e13c81619d4da61ec835d03fe512","impliedFormat":1},{"version":"5135bdd72cc05a8192bd2e92f0914d7fc43ee077d1293dc622a049b7035a0afb","impliedFormat":1},{"version":"528b62e4272e3ddfb50e8eed9e359dedea0a4d171c3eb8f337f4892aac37b24b","impliedFormat":1},{"version":"6d386bc0d7f3afa1d401afc3e00ed6b09205a354a9795196caed937494a713e6","impliedFormat":1},{"version":"5b2e73adcb25865d31c21accdc8f82de1eaded23c6f73230e474df156942380e","affectsGlobalScope":true,"impliedFormat":1},{"version":"23459c1915878a7c1e86e8bdb9c187cddd3aea105b8b1dfce512f093c969bc7e","impliedFormat":1},{"version":"b1b6ee0d012aeebe11d776a155d8979730440082797695fc8e2a5c326285678f","impliedFormat":1},{"version":"45875bcae57270aeb3ebc73a5e3fb4c7b9d91d6b045f107c1d8513c28ece71c0","impliedFormat":1},{"version":"1dc73f8854e5c4506131c4d95b3a6c24d0c80336d3758e95110f4c7b5cb16397","affectsGlobalScope":true,"impliedFormat":1},{"version":"64ede330464b9fd5d35327c32dd2770e7474127ed09769655ebce70992af5f44","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f16a7e4deafa527ed9995a772bb380eb7d3c2c0fd4ae178c5263ed18394db2c","impliedFormat":1},{"version":"c6b4e0a02545304935ecbf7de7a8e056a31bb50939b5b321c9d50a405b5a0bba","impliedFormat":1},{"version":"fab29e6d649aa074a6b91e3bdf2bff484934a46067f6ee97a30fcd9762ae2213","impliedFormat":1},{"version":"8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","impliedFormat":1},{"version":"e1120271ebbc9952fdc7b2dd3e145560e52e06956345e6fdf91d70ca4886464f","impliedFormat":1},{"version":"814118df420c4e38fe5ae1b9a3bafb6e9c2aa40838e528cde908381867be6466","impliedFormat":1},{"version":"bcd0418abb8a5c9fe7db36a96ca75fc78455b0efab270ee89b8e49916eac5174","impliedFormat":1},{"version":"c878f74b6d10b267f6075c51ac1d8becd15b4aa6a58f79c0cfe3b24908357f60","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093","impliedFormat":1},{"version":"fbf68fc8057932b1c30107ebc37420f8d8dc4bef1253c4c2f9e141886c0df5ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2754d8221d77c7b382096651925eb476f1066b3348da4b73fe71ced7801edada","impliedFormat":1},{"version":"7d8b16d7f33d5081beac7a657a6d13f11a72cf094cc5e37cda1b9d8c89371951","affectsGlobalScope":true,"impliedFormat":1},{"version":"f0be1b8078cd549d91f37c30c222c2a187ac1cf981d994fb476a1adc61387b14","affectsGlobalScope":true,"impliedFormat":1},{"version":"0aaed1d72199b01234152f7a60046bc947f1f37d78d182e9ae09c4289e06a592","impliedFormat":1},{"version":"5360a27d3ebca11b224d7d3e38e3e2c63f8290cb1fcf6c3610401898f8e68bc3","impliedFormat":1},{"version":"66ba1b2c3e3a3644a1011cd530fb444a96b1b2dfe2f5e837a002d41a1a799e60","impliedFormat":1},{"version":"7e514f5b852fdbc166b539fdd1f4e9114f29911592a5eb10a94bb3a13ccac3c4","impliedFormat":1},{"version":"7d6ff413e198d25639f9f01f16673e7df4e4bd2875a42455afd4ecc02ef156da","affectsGlobalScope":true,"impliedFormat":1},{"version":"217941ef5c6fd81b77cd0073c94019a98e20777eaac6c4326156bf6b021ed547","affectsGlobalScope":true,"impliedFormat":1},{"version":"f689c4237b70ae6be5f0e4180e8833f34ace40529d1acc0676ab8fb8f70457d7","impliedFormat":1},{"version":"b02784111b3fc9c38590cd4339ff8718f9329a6f4d3fd66e9744a1dcd1d7e191","impliedFormat":1},{"version":"ac5ed35e649cdd8143131964336ab9076937fa91802ec760b3ea63b59175c10a","impliedFormat":1},{"version":"63b05afa6121657f25e99e1519596b0826cda026f09372c9100dfe21417f4bd6","affectsGlobalScope":true,"impliedFormat":1},{"version":"78dc0513cc4f1642906b74dda42146bcbd9df7401717d6e89ea6d72d12ecb539","impliedFormat":1},{"version":"ad90122e1cb599b3bc06a11710eb5489101be678f2920f2322b0ac3e195af78d","impliedFormat":1}],"root":[[94,98]],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":false,"importHelpers":true,"module":199,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"outDir":"./","skipLibCheck":true,"strict":true,"tsBuildInfoFile":"./tsconfig.lib.tsbuildinfo"},"referencedMap":[[90,1],[93,2],[89,3],[91,4],[92,5],[144,6],[145,6],[146,7],[104,8],[147,9],[148,10],[149,11],[99,4],[102,12],[100,4],[101,4],[150,13],[151,14],[152,15],[153,16],[154,17],[155,18],[156,18],[158,19],[157,20],[159,21],[160,22],[161,23],[143,24],[103,4],[162,25],[163,26],[164,27],[197,28],[165,29],[166,30],[167,31],[168,32],[169,33],[170,34],[171,35],[172,36],[173,37],[174,38],[175,38],[176,39],[177,4],[178,4],[179,40],[181,41],[180,42],[182,43],[183,44],[184,45],[185,46],[186,47],[187,48],[188,49],[189,50],[190,51],[191,52],[192,53],[193,54],[194,55],[195,56],[196,57],[105,4],[86,4],[88,58],[85,4],[87,4],[84,3],[83,4],[80,4],[81,4],[15,4],[13,4],[14,4],[19,4],[18,4],[2,4],[20,4],[21,4],[22,4],[23,4],[24,4],[25,4],[26,4],[27,4],[3,4],[28,4],[29,4],[4,4],[30,4],[34,4],[31,4],[32,4],[33,4],[35,4],[36,4],[37,4],[5,4],[38,4],[39,4],[40,4],[41,4],[6,4],[45,4],[42,4],[43,4],[44,4],[46,4],[7,4],[47,4],[52,4],[53,4],[48,4],[49,4],[50,4],[51,4],[8,4],[57,4],[54,4],[55,4],[56,4],[58,4],[9,4],[59,4],[60,4],[61,4],[63,4],[62,4],[64,4],[65,4],[10,4],[66,4],[67,4],[68,4],[11,4],[69,4],[70,4],[71,4],[72,4],[73,4],[1,4],[74,4],[75,4],[12,4],[78,4],[77,4],[82,4],[76,4],[79,4],[17,4],[16,4],[121,59],[131,60],[120,59],[141,61],[112,62],[111,63],[140,64],[134,65],[139,66],[114,67],[128,68],[113,69],[137,70],[109,71],[108,64],[138,72],[110,73],[115,74],[116,4],[119,74],[106,4],[142,75],[132,76],[123,77],[124,78],[126,79],[122,80],[125,81],[135,64],[117,82],[118,83],[127,84],[107,85],[130,76],[129,74],[133,4],[136,86],[97,87],[94,88],[96,89],[98,90],[95,91]],"latestChangedDtsFile":"./src/lib/request-mware.mock.d.ts","version":"5.7.3"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import baseConfig from '../../../eslint.config.mjs';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...baseConfig,
|
|
5
|
+
{
|
|
6
|
+
files: ['**/*.json'],
|
|
7
|
+
rules: {
|
|
8
|
+
'@nx/dependency-checks': [
|
|
9
|
+
'error',
|
|
10
|
+
{
|
|
11
|
+
ignoredFiles: [
|
|
12
|
+
'{projectRoot}/eslint.config.{js,cjs,mjs}',
|
|
13
|
+
'{projectRoot}/vite.config.{js,ts,mjs,mts}',
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
languageOptions: {
|
|
19
|
+
parser: await import('jsonc-eslint-parser'),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forgerock/sdk-request-middleware",
|
|
3
|
+
"version": "0.0.0-beta-20250506165419",
|
|
4
|
+
"private": false,
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/ForgeRock/ping-javascript-sdk.git",
|
|
8
|
+
"directory": "packages/sdk-effects/sdk-request-middleware"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
14
|
+
"import": "./dist/src/index.js",
|
|
15
|
+
"default": "./dist/src/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/src/index.js",
|
|
20
|
+
"module": "./dist/src/index.js",
|
|
21
|
+
"types": "./dist/src/index.d.ts",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@reduxjs/toolkit": "^2.2.5"
|
|
24
|
+
},
|
|
25
|
+
"nx": {
|
|
26
|
+
"tags": [
|
|
27
|
+
"scope:sdk-effects"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"lint": "pnpm nx nxLint",
|
|
32
|
+
"test": "pnpm nx nxTest",
|
|
33
|
+
"test:watch": "pnpm nx nxTest --watch"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const actionTypes = {
|
|
9
|
+
start: 'DAVINCI_START',
|
|
10
|
+
next: 'DAVINCI_NEXT',
|
|
11
|
+
flow: 'DAVINCI_FLOW',
|
|
12
|
+
success: 'DAVINCI_SUCCESS',
|
|
13
|
+
error: 'DAVINCI_ERROR',
|
|
14
|
+
failure: 'DAVINCI_FAILURE',
|
|
15
|
+
resume: 'DAVINCI_RESUME',
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export type ActionTypes = (typeof actionTypes)[keyof typeof actionTypes];
|
|
19
|
+
export type EndpointTypes = keyof typeof actionTypes;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
FetchArgs,
|
|
10
|
+
FetchBaseQueryError,
|
|
11
|
+
FetchBaseQueryMeta,
|
|
12
|
+
QueryReturnValue,
|
|
13
|
+
} from '@reduxjs/toolkit/query';
|
|
14
|
+
|
|
15
|
+
import { actionTypes } from './request-mware.derived.js';
|
|
16
|
+
|
|
17
|
+
import type { ActionTypes, EndpointTypes } from './request-mware.derived.js';
|
|
18
|
+
import type { ModifiedFetchArgs, RequestMiddleware } from './request-mware.types.js';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @function middlewareWrapper - A "Node" and "Redux" style middleware that is called just before
|
|
22
|
+
* the request is made from the SDK. This allows you access to the request for modification.
|
|
23
|
+
* @param request - A request object container of the URL and the Request Init object
|
|
24
|
+
* @param action - The action object that is passed into the middleware communicating intent
|
|
25
|
+
* @param action.type - A "Redux" style type that contains the serialized action
|
|
26
|
+
* @param action.payload - The payload of the action that can contain metadata
|
|
27
|
+
* @returns {function} - Function that takes middleware parameter & runs middleware against request
|
|
28
|
+
*/
|
|
29
|
+
export function middlewareWrapper(
|
|
30
|
+
request: ModifiedFetchArgs,
|
|
31
|
+
// eslint-disable-next-line
|
|
32
|
+
{ type, payload }: { type: ActionTypes; payload?: any },
|
|
33
|
+
): (middleware: RequestMiddleware<typeof type, typeof payload>[] | undefined) => ModifiedFetchArgs {
|
|
34
|
+
// no mutation and no reassignment
|
|
35
|
+
const actionCopy = Object.freeze({ type, payload });
|
|
36
|
+
|
|
37
|
+
return (middleware: RequestMiddleware<typeof type, typeof payload>[] | undefined) => {
|
|
38
|
+
if (!Array.isArray(middleware)) {
|
|
39
|
+
return request;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Copy middleware so the `shift` below doesn't mutate source
|
|
43
|
+
const mwareCopy = middleware.map((fn) => fn);
|
|
44
|
+
|
|
45
|
+
function iterator(): ModifiedFetchArgs {
|
|
46
|
+
const nextMiddlewareToBeCalled = mwareCopy.shift();
|
|
47
|
+
if (nextMiddlewareToBeCalled) nextMiddlewareToBeCalled(request, actionCopy, iterator);
|
|
48
|
+
return request;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return iterator();
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @function initQuery - Initializes a query object with the provided request object
|
|
57
|
+
* @param {FetchArgs} fetchArgs - The request object to initialize the query with
|
|
58
|
+
* @param {string} endpoint - The endpoint to be used for the query
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export function initQuery(fetchArgs: FetchArgs, endpoint: EndpointTypes) {
|
|
62
|
+
let modifiedRequest: ModifiedFetchArgs = {
|
|
63
|
+
...fetchArgs,
|
|
64
|
+
url: new URL(fetchArgs.url),
|
|
65
|
+
headers: new Headers(fetchArgs.headers as Record<string, string>),
|
|
66
|
+
};
|
|
67
|
+
const queryApi = {
|
|
68
|
+
applyMiddleware(
|
|
69
|
+
middleware: RequestMiddleware<ActionTypes, ModifiedFetchArgs['body']>[] | undefined,
|
|
70
|
+
) {
|
|
71
|
+
// Iterates and executes provided middleware functions
|
|
72
|
+
// Allow middleware to mutate `request` argument
|
|
73
|
+
const runMiddleware = middlewareWrapper(modifiedRequest, { type: actionTypes[endpoint] });
|
|
74
|
+
modifiedRequest = runMiddleware(middleware);
|
|
75
|
+
|
|
76
|
+
return queryApi;
|
|
77
|
+
},
|
|
78
|
+
async applyQuery(
|
|
79
|
+
callback: (
|
|
80
|
+
request: FetchArgs,
|
|
81
|
+
) => Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>,
|
|
82
|
+
) {
|
|
83
|
+
return await callback({ ...modifiedRequest, url: modifiedRequest.url.toString() });
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return queryApi;
|
|
88
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ActionTypes } from './request-mware.derived.js';
|
|
9
|
+
import type { Action, ModifiedFetchArgs, RequestMiddleware } from './request-mware.types.js';
|
|
10
|
+
|
|
11
|
+
type NextFn = () => ModifiedFetchArgs;
|
|
12
|
+
|
|
13
|
+
const a = 'a' as ActionTypes;
|
|
14
|
+
const b = 'b' as ActionTypes;
|
|
15
|
+
const one = '1' as ActionTypes;
|
|
16
|
+
const two = '2' as ActionTypes;
|
|
17
|
+
const add = 'ADD' as ActionTypes;
|
|
18
|
+
const reassignment = 'REASSIGNMENT' as ActionTypes;
|
|
19
|
+
const mutateAction = 'MUTATE-ACTION' as ActionTypes;
|
|
20
|
+
|
|
21
|
+
const middleware: RequestMiddleware<ActionTypes>[] = [
|
|
22
|
+
(req: ModifiedFetchArgs, action: Action, next: NextFn): void => {
|
|
23
|
+
switch (action.type) {
|
|
24
|
+
case a:
|
|
25
|
+
case b:
|
|
26
|
+
req.url.searchParams.set('letter', 'true');
|
|
27
|
+
if (req.headers) req.headers.set('x-letter', 'true');
|
|
28
|
+
break;
|
|
29
|
+
case one:
|
|
30
|
+
case two:
|
|
31
|
+
req.url.searchParams.set('letter', 'false');
|
|
32
|
+
if (req.headers) req.headers.set('x-letter', 'false');
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
next();
|
|
36
|
+
},
|
|
37
|
+
(req: ModifiedFetchArgs, action: Action, next: NextFn): void => {
|
|
38
|
+
switch (action.type) {
|
|
39
|
+
case a:
|
|
40
|
+
req.url.searchParams.set('char', 'a');
|
|
41
|
+
if (req.headers) req.headers.set('x-char', 'a');
|
|
42
|
+
break;
|
|
43
|
+
case b:
|
|
44
|
+
req.url.searchParams.set('char', 'b');
|
|
45
|
+
if (req.headers) req.headers.set('x-char', 'b');
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
next();
|
|
49
|
+
},
|
|
50
|
+
(req: ModifiedFetchArgs, action: Action, next: NextFn): void => {
|
|
51
|
+
switch (action.type) {
|
|
52
|
+
case one:
|
|
53
|
+
req.url.searchParams.set('char', '1');
|
|
54
|
+
if (req.headers) req.headers.set('x-char', '1');
|
|
55
|
+
break;
|
|
56
|
+
case two:
|
|
57
|
+
req.url.searchParams.set('char', '2');
|
|
58
|
+
if (req.headers) req.headers.set('x-char', '2');
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
next();
|
|
62
|
+
},
|
|
63
|
+
(req: ModifiedFetchArgs, action: Action, next: NextFn): void => {
|
|
64
|
+
switch (action.type) {
|
|
65
|
+
case add:
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
req.headers?.set('x-char', 'a,' + action.payload);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
next();
|
|
72
|
+
},
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
(req: ModifiedFetchArgs, action: Action, next: NextFn): void => {
|
|
76
|
+
switch (action.type) {
|
|
77
|
+
case reassignment:
|
|
78
|
+
req = {
|
|
79
|
+
url: new URL('https://bad.com'),
|
|
80
|
+
headers: new Headers({ 'x-bad': 'true' }),
|
|
81
|
+
};
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
next();
|
|
85
|
+
},
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
(req: ModifiedFetchArgs, action: Action, next: NextFn): void => {
|
|
89
|
+
switch (action.type) {
|
|
90
|
+
case mutateAction:
|
|
91
|
+
action.type = 'hello' as ActionTypes;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
next();
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
export default middleware;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
FetchArgs,
|
|
10
|
+
FetchBaseQueryError,
|
|
11
|
+
FetchBaseQueryMeta,
|
|
12
|
+
QueryReturnValue,
|
|
13
|
+
} from '@reduxjs/toolkit/query';
|
|
14
|
+
|
|
15
|
+
import type { ActionTypes } from './request-mware.derived.js';
|
|
16
|
+
import type { Action, ModifiedFetchArgs } from './request-mware.types.js';
|
|
17
|
+
|
|
18
|
+
import { initQuery, middlewareWrapper } from './request-mware.effects.js';
|
|
19
|
+
import middleware from './request-mware.mock.js';
|
|
20
|
+
|
|
21
|
+
type BaseQueryResponse = Promise<
|
|
22
|
+
QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>
|
|
23
|
+
>;
|
|
24
|
+
type NextFn = () => ModifiedFetchArgs;
|
|
25
|
+
|
|
26
|
+
describe('Middleware should be called with an action', () => {
|
|
27
|
+
it('should run all middleware testing action for letter and "a"', () => {
|
|
28
|
+
const runMiddleware = middlewareWrapper(
|
|
29
|
+
{ url: new URL('https://www.example.com'), headers: new Headers() },
|
|
30
|
+
{
|
|
31
|
+
type: 'a' as ActionTypes,
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
const newReq = runMiddleware(middleware);
|
|
35
|
+
expect(newReq.headers).toStrictEqual(new Headers({ 'x-letter': 'true', 'x-char': 'a' }));
|
|
36
|
+
expect(newReq.url.toString()).toBe('https://www.example.com/?letter=true&char=a');
|
|
37
|
+
});
|
|
38
|
+
it('should run all middleware testing action for number and "1"', () => {
|
|
39
|
+
const runMiddleware = middlewareWrapper(
|
|
40
|
+
{ url: new URL('https://www.example.com'), headers: new Headers() },
|
|
41
|
+
{
|
|
42
|
+
type: '1' as ActionTypes,
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
const newReq = runMiddleware(middleware);
|
|
46
|
+
expect(newReq.headers).toStrictEqual(new Headers({ 'x-letter': 'false', 'x-char': '1' }));
|
|
47
|
+
expect(newReq.url.toString()).toBe('https://www.example.com/?letter=false&char=1');
|
|
48
|
+
});
|
|
49
|
+
it('should run all middleware testing action for no match', () => {
|
|
50
|
+
const runMiddleware = middlewareWrapper(
|
|
51
|
+
{ url: new URL('https://www.example.com') },
|
|
52
|
+
{
|
|
53
|
+
type: 'z' as ActionTypes,
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
const newReq = runMiddleware(middleware);
|
|
57
|
+
expect(newReq.headers).toBeUndefined();
|
|
58
|
+
expect(newReq.url.toString()).toBe('https://www.example.com/');
|
|
59
|
+
});
|
|
60
|
+
it('should run all middleware testing add action with payload', () => {
|
|
61
|
+
const runMiddleware = middlewareWrapper(
|
|
62
|
+
{
|
|
63
|
+
url: new URL('https://www.example.com'),
|
|
64
|
+
headers: new Headers({ 'x-number': '3' }),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'ADD' as ActionTypes,
|
|
68
|
+
payload: 'b',
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
const newReq = runMiddleware(middleware);
|
|
72
|
+
expect(newReq.headers).toStrictEqual(new Headers({ 'x-number': '3', 'x-char': 'a,b' }));
|
|
73
|
+
});
|
|
74
|
+
it('should not allow middleware to mutate `action`', () => {
|
|
75
|
+
try {
|
|
76
|
+
const runMiddleware = middlewareWrapper(
|
|
77
|
+
{ url: new URL('https://www.example.com') },
|
|
78
|
+
{
|
|
79
|
+
type: 'MUTATE-ACTION' as ActionTypes,
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
runMiddleware(middleware);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
if (err instanceof TypeError) {
|
|
85
|
+
expect(err.message).toBe(
|
|
86
|
+
`Cannot assign to read only property 'type' of object '#<Object>'`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('initQuery function', () => {
|
|
94
|
+
const requestMiddleware = [
|
|
95
|
+
(req: ModifiedFetchArgs, action: Action, next: NextFn): void => {
|
|
96
|
+
switch (action.type) {
|
|
97
|
+
case 'DAVINCI_START':
|
|
98
|
+
req.url.searchParams.set('searchParam', 'abc');
|
|
99
|
+
req.headers?.set('x-new-header', '123');
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
next();
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
it('should initialize query and apply query without middleware application', async () => {
|
|
107
|
+
let resultFetchArgs = {} as FetchArgs;
|
|
108
|
+
|
|
109
|
+
const fetchArgs = { url: 'https://www.example.com' };
|
|
110
|
+
const endpoint = 'start';
|
|
111
|
+
const mockQuery = async (passedFetchArgs: FetchArgs) => {
|
|
112
|
+
resultFetchArgs = passedFetchArgs;
|
|
113
|
+
const result = Promise.resolve({
|
|
114
|
+
data: 'test',
|
|
115
|
+
meta: {},
|
|
116
|
+
error: undefined,
|
|
117
|
+
}) as BaseQueryResponse;
|
|
118
|
+
return Promise.resolve(result);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const queryApi = initQuery(fetchArgs, endpoint);
|
|
122
|
+
const response = await queryApi.applyQuery(
|
|
123
|
+
// TODO: this is being required to be passed in
|
|
124
|
+
// it probably shouldn't but we can review later
|
|
125
|
+
async (fetchArgs: FetchArgs) => await mockQuery(fetchArgs),
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
expect(resultFetchArgs.url.toString()).toBe('https://www.example.com/');
|
|
129
|
+
expect(resultFetchArgs.headers).toStrictEqual(new Headers());
|
|
130
|
+
expect(response.data).toBe('test');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('should initialize query and apply middleware', async () => {
|
|
134
|
+
let resultFetchArgs = {} as FetchArgs;
|
|
135
|
+
|
|
136
|
+
const fetchArgs = { url: 'https://www.example.com' };
|
|
137
|
+
const endpoint = 'start';
|
|
138
|
+
const mockQuery = async (passedFetchArgs: FetchArgs) => {
|
|
139
|
+
resultFetchArgs = passedFetchArgs;
|
|
140
|
+
const result = Promise.resolve({
|
|
141
|
+
data: 'test',
|
|
142
|
+
meta: {},
|
|
143
|
+
error: undefined,
|
|
144
|
+
}) as BaseQueryResponse;
|
|
145
|
+
return Promise.resolve(result);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const queryApi = initQuery(fetchArgs, endpoint).applyMiddleware(requestMiddleware);
|
|
149
|
+
const response = await queryApi.applyQuery(
|
|
150
|
+
async (fetchArgs: FetchArgs) => await mockQuery(fetchArgs),
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
expect(resultFetchArgs.url.toString()).toBe('https://www.example.com/?searchParam=abc');
|
|
154
|
+
expect(resultFetchArgs.headers).toStrictEqual(new Headers({ 'x-new-header': '123' }));
|
|
155
|
+
expect(response.data).toBe('test');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('should initialize query and handle undefined middleware', async () => {
|
|
159
|
+
let resultFetchArgs = {} as FetchArgs;
|
|
160
|
+
|
|
161
|
+
const fetchArgs = { url: 'https://www.example.com' };
|
|
162
|
+
const endpoint = 'start';
|
|
163
|
+
const mockQuery = async (passedFetchArgs: FetchArgs) => {
|
|
164
|
+
resultFetchArgs = passedFetchArgs;
|
|
165
|
+
const result = Promise.resolve({
|
|
166
|
+
data: 'test',
|
|
167
|
+
meta: {},
|
|
168
|
+
error: undefined,
|
|
169
|
+
}) as BaseQueryResponse;
|
|
170
|
+
return Promise.resolve(result);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const queryApi = initQuery(fetchArgs, endpoint).applyMiddleware(undefined);
|
|
174
|
+
const response = await queryApi.applyQuery(
|
|
175
|
+
async (fetchArgs: FetchArgs) => await mockQuery(fetchArgs),
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
expect(resultFetchArgs.url.toString()).toBe('https://www.example.com/');
|
|
179
|
+
expect(resultFetchArgs.headers).toStrictEqual(new Headers());
|
|
180
|
+
expect(response.data).toBe('test');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('should initialize query and handle unmatched action type', async () => {
|
|
184
|
+
let resultFetchArgs = {} as FetchArgs;
|
|
185
|
+
|
|
186
|
+
const fetchArgs: FetchArgs = { url: 'https://www.example.com' };
|
|
187
|
+
const endpoint = 'unknown' as 'start'; // intentionally incorrect type
|
|
188
|
+
const mockQuery = async (passedFetchArgs: FetchArgs) => {
|
|
189
|
+
resultFetchArgs = passedFetchArgs;
|
|
190
|
+
const result = Promise.resolve({
|
|
191
|
+
data: 'test',
|
|
192
|
+
meta: {},
|
|
193
|
+
error: undefined,
|
|
194
|
+
}) as BaseQueryResponse;
|
|
195
|
+
return Promise.resolve(result);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const queryApi = initQuery(fetchArgs, endpoint).applyMiddleware(requestMiddleware);
|
|
199
|
+
const response = await queryApi.applyQuery(
|
|
200
|
+
async (fetchArgs: FetchArgs) => await mockQuery(fetchArgs),
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
expect(resultFetchArgs.url.toString()).toBe('https://www.example.com/');
|
|
204
|
+
expect(resultFetchArgs.headers).toStrictEqual(new Headers());
|
|
205
|
+
expect(response.data).toBe('test');
|
|
206
|
+
});
|
|
207
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This software may be modified and distributed under the terms
|
|
5
|
+
* of the MIT license. See the LICENSE file for details.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
FetchArgs,
|
|
10
|
+
FetchBaseQueryError,
|
|
11
|
+
FetchBaseQueryMeta,
|
|
12
|
+
QueryReturnValue,
|
|
13
|
+
} from '@reduxjs/toolkit/query';
|
|
14
|
+
|
|
15
|
+
import { ActionTypes } from './request-mware.derived.js';
|
|
16
|
+
|
|
17
|
+
export type RequestMiddleware<Type extends ActionTypes = ActionTypes, Payload = unknown> = (
|
|
18
|
+
req: ModifiedFetchArgs,
|
|
19
|
+
action: Action<Type, Payload>,
|
|
20
|
+
next: () => ModifiedFetchArgs,
|
|
21
|
+
) => void;
|
|
22
|
+
|
|
23
|
+
export interface QueryApi<Type extends ActionTypes = ActionTypes, Payload = unknown> {
|
|
24
|
+
applyMiddleware(middleware: RequestMiddleware<Type, Payload>[]): QueryApi<ActionTypes, unknown>;
|
|
25
|
+
applyQuery(
|
|
26
|
+
callback: (
|
|
27
|
+
request: FetchArgs,
|
|
28
|
+
) => Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>,
|
|
29
|
+
): Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Action<Type extends ActionTypes = ActionTypes, Payload = unknown> {
|
|
33
|
+
type: Type;
|
|
34
|
+
payload: Payload;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ModifiedFetchArgs extends Omit<FetchArgs, 'url'> {
|
|
38
|
+
url: URL;
|
|
39
|
+
headers?: Headers;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface RequestObj {
|
|
43
|
+
url: URL;
|
|
44
|
+
init: RequestInit;
|
|
45
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
7
|
+
"emitDeclarationOnly": false,
|
|
8
|
+
"module": "nodenext",
|
|
9
|
+
"moduleResolution": "nodenext",
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"importHelpers": true,
|
|
13
|
+
"noImplicitOverride": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"types": ["node"]
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*.ts"],
|
|
19
|
+
"references": [],
|
|
20
|
+
"exclude": [
|
|
21
|
+
"vite.config.ts",
|
|
22
|
+
"vite.config.mts",
|
|
23
|
+
"vitest.config.ts",
|
|
24
|
+
"vitest.config.mts",
|
|
25
|
+
"src/**/*.test.ts",
|
|
26
|
+
"src/**/*.spec.ts",
|
|
27
|
+
"src/**/*.test.tsx",
|
|
28
|
+
"src/**/*.spec.tsx",
|
|
29
|
+
"src/**/*.test.js",
|
|
30
|
+
"src/**/*.spec.js",
|
|
31
|
+
"src/**/*.test.jsx",
|
|
32
|
+
"src/**/*.spec.jsx"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./out-tsc/vitest",
|
|
5
|
+
"types": [
|
|
6
|
+
"vitest/globals",
|
|
7
|
+
"vitest/importMeta",
|
|
8
|
+
"vite/client",
|
|
9
|
+
"node",
|
|
10
|
+
"vitest"
|
|
11
|
+
],
|
|
12
|
+
"module": "nodenext",
|
|
13
|
+
"moduleResolution": "nodenext",
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"strict": true,
|
|
16
|
+
"importHelpers": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noFallthroughCasesInSwitch": true
|
|
20
|
+
},
|
|
21
|
+
"include": [
|
|
22
|
+
"vite.config.ts",
|
|
23
|
+
"vite.config.mts",
|
|
24
|
+
"vitest.config.ts",
|
|
25
|
+
"vitest.config.mts",
|
|
26
|
+
"src/**/*.test.ts",
|
|
27
|
+
"src/**/*.spec.ts",
|
|
28
|
+
"src/**/*.test.tsx",
|
|
29
|
+
"src/**/*.spec.tsx",
|
|
30
|
+
"src/**/*.test.js",
|
|
31
|
+
"src/**/*.spec.js",
|
|
32
|
+
"src/**/*.test.jsx",
|
|
33
|
+
"src/**/*.spec.jsx",
|
|
34
|
+
"src/**/*.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"references": [
|
|
37
|
+
{
|
|
38
|
+
"path": "./tsconfig.lib.json"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
package/typedoc.json
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
|
|
3
|
+
export default defineConfig(() => ({
|
|
4
|
+
root: __dirname,
|
|
5
|
+
cacheDir: '../../../node_modules/.vite/packages/effects/sdk-request-middleware',
|
|
6
|
+
plugins: [],
|
|
7
|
+
// Uncomment this if you are using workers.
|
|
8
|
+
// worker: {
|
|
9
|
+
// plugins: [ nxViteTsPaths() ],
|
|
10
|
+
// },
|
|
11
|
+
test: {
|
|
12
|
+
watch: false,
|
|
13
|
+
globals: true,
|
|
14
|
+
environment: 'node',
|
|
15
|
+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
16
|
+
reporters: ['default'],
|
|
17
|
+
coverage: {
|
|
18
|
+
reportsDirectory: './test-output/vitest/coverage',
|
|
19
|
+
provider: 'v8' as const,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}));
|