@equinor/fusion-framework-module-http 8.0.5 → 8.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +7 -0
- package/dist/esm/configurator.js +8 -1
- package/dist/esm/configurator.js.map +1 -1
- package/dist/esm/lib/client/client.js +50 -7
- package/dist/esm/lib/client/client.js.map +1 -1
- package/dist/esm/lib/operators/HttpMiddlewareHandler.js +45 -0
- package/dist/esm/lib/operators/HttpMiddlewareHandler.js.map +1 -0
- package/dist/esm/lib/operators/index.js +1 -0
- package/dist/esm/lib/operators/index.js.map +1 -1
- package/dist/esm/mock/create-open-api-mock-middleware.js +33 -0
- package/dist/esm/mock/create-open-api-mock-middleware.js.map +1 -0
- package/dist/esm/mock/create-router-middleware.js +97 -0
- package/dist/esm/mock/create-router-middleware.js.map +1 -0
- package/dist/esm/mock/index.js +20 -0
- package/dist/esm/mock/index.js.map +1 -0
- package/dist/esm/mock/resolve-open-api-mock-response.js +20 -0
- package/dist/esm/mock/resolve-open-api-mock-response.js.map +1 -0
- package/dist/esm/provider.js +9 -2
- package/dist/esm/provider.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/configurator.d.ts +28 -1
- package/dist/types/lib/client/client.d.ts +26 -2
- package/dist/types/lib/operators/HttpMiddlewareHandler.d.ts +24 -0
- package/dist/types/lib/operators/index.d.ts +1 -0
- package/dist/types/lib/operators/types.d.ts +74 -1
- package/dist/types/mock/create-open-api-mock-middleware.d.ts +28 -0
- package/dist/types/mock/create-router-middleware.d.ts +73 -0
- package/dist/types/mock/index.d.ts +20 -0
- package/dist/types/mock/resolve-open-api-mock-response.d.ts +27 -0
- package/dist/types/provider.d.ts +11 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/testing.md +78 -0
- package/package.json +11 -4
- package/src/configurator.ts +41 -1
- package/src/lib/client/client.ts +59 -7
- package/src/lib/operators/HttpMiddlewareHandler.ts +58 -0
- package/src/lib/operators/index.ts +1 -0
- package/src/lib/operators/types.ts +87 -1
- package/src/mock/create-open-api-mock-middleware.ts +40 -0
- package/src/mock/create-router-middleware.ts +158 -0
- package/src/mock/index.ts +26 -0
- package/src/mock/resolve-open-api-mock-response.ts +36 -0
- package/src/provider.ts +17 -2
- package/src/version.ts +1 -1
- package/tests/HttpClient.test.ts +46 -0
- package/tests/HttpMiddlewareHandler.test.ts +58 -0
- package/tests/mock/adapters.test.ts +62 -0
- package/tests/mock/router-middleware.test.ts +135 -0
- package/vitest.config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 8.1.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2836e0b: Add a `./mock` entry point built on `addMiddleware` on the real `HttpClientConfigurator`, so answering a request in a test doesn't mean swapping out a separate configurator.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
configurator.configureHttpClient("catalog", {
|
|
11
|
+
baseUri: "https://api.example.com",
|
|
12
|
+
});
|
|
13
|
+
configurator.http.addMiddleware(async (uri, init, next) =>
|
|
14
|
+
uri === "https://api.example.com/items"
|
|
15
|
+
? Response.json([{ id: 1 }])
|
|
16
|
+
: next(uri, init),
|
|
17
|
+
);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`addMiddleware` wraps `_performFetch` rather than replacing it, so the exact same client and configuration a real app registers is what a test exercises — only the boundary that would reach the network is short-circuited, and a middleware that calls `next(uri, init)` falls through to the real call (or the next middleware) unchanged.
|
|
21
|
+
|
|
22
|
+
Two adapters are included for building a middleware:
|
|
23
|
+
|
|
24
|
+
- `createRouterMiddleware(baseUri, build)` — a minimal Express-like router (`.get`/`.post`/`.put`/`.patch`/`.delete`/`.on`, `:id`-style path params) for one base URI, with no dependency on a real routing library.
|
|
25
|
+
- `createOpenApiMockMiddleware(openApiMock)` — adapts an `@equinor/fusion-openapi-mock` instance, so a real `openapi.json`/`openapi.yaml` fakes every response with no handlers written at all.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { createRouterMiddleware } from "@equinor/fusion-framework-module-http/mock";
|
|
29
|
+
|
|
30
|
+
configurator.http.addMiddleware(
|
|
31
|
+
createRouterMiddleware("https://context.example.com", (router) => {
|
|
32
|
+
router.get("/contexts/:id", ({ params }) =>
|
|
33
|
+
Response.json({ id: params.id }),
|
|
34
|
+
);
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`@equinor/fusion-framework`'s `FrameworkMockConfigurator` gains a matching `.http` accessor, backed by the same real `IHttpClientConfigurator`.
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- e8aae1f: Internal: publish every package on the `next` pre-release tag so the whole framework can be installed as a coherent set.
|
|
44
|
+
|
|
45
|
+
Packages without their own changes are bumped only to receive a `-next.N` version and the `next` dist-tag on npm. Install with:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm add @equinor/fusion-framework-react-app@next
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- 2836e0b: Fix `HttpClient.abort()` not cancelling the underlying network call when middleware is registered. `next(...)` resolves through a `Promise`, so a middleware calling it created a subscription to `_performFetch` outside the tree the `takeUntil(this._abort$)` teardown reaches -- the outer request settled, but the real `fetch` kept running. `abort()` now also aborts a per-request `AbortSignal` combined into the request `init`, so `_performFetch` (`fromFetch` by default) is cancelled directly regardless of whether middleware severed the RxJS subscription chain.
|
|
52
|
+
- Updated dependencies [e8aae1f]
|
|
53
|
+
- Updated dependencies [2836e0b]
|
|
54
|
+
- Updated dependencies [2836e0b]
|
|
55
|
+
- Updated dependencies [2836e0b]
|
|
56
|
+
- Updated dependencies [2836e0b]
|
|
57
|
+
- Updated dependencies [2836e0b]
|
|
58
|
+
- Updated dependencies [2836e0b]
|
|
59
|
+
- Updated dependencies [2836e0b]
|
|
60
|
+
- Updated dependencies [2836e0b]
|
|
61
|
+
- Updated dependencies [2836e0b]
|
|
62
|
+
- Updated dependencies [2836e0b]
|
|
63
|
+
- Updated dependencies [2836e0b]
|
|
64
|
+
- @equinor/fusion-framework-module@6.1.3-next.0
|
|
65
|
+
- @equinor/fusion-framework-module-msal@11.0.0-next.0
|
|
66
|
+
|
|
3
67
|
## 8.0.5
|
|
4
68
|
|
|
5
69
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -193,12 +193,19 @@ See [Server-Sent Events](docs/server-sent-events.md) for `sse$()` usage, event f
|
|
|
193
193
|
|
|
194
194
|
Native fetch errors can still surface as well, including abort and network failures.
|
|
195
195
|
|
|
196
|
+
## Testing
|
|
197
|
+
|
|
198
|
+
Register a short-circuiting middleware through `configurator.http.addMiddleware(...)` to answer requests without touching the network — no separate mock client or configurator is needed. `createOpenApiMockMiddleware` (`@equinor/fusion-framework-module-http/mock`) adapts an `@equinor/fusion-openapi-mock` instance into one for faking an entire OpenAPI document.
|
|
199
|
+
|
|
200
|
+
See [Testing](docs/testing.md) for the middleware contract and `createOpenApiMockMiddleware`.
|
|
201
|
+
|
|
196
202
|
## Advanced Guides
|
|
197
203
|
|
|
198
204
|
- [Client Configuration](docs/client-configuration.md): named clients, `configureHttpClient`, `configureHttp`, `onCreate`, custom client classes, and ad-hoc clients
|
|
199
205
|
- [Observable Patterns](docs/observable-patterns.md): `fetch$`, `json$`, `request$`, `response$`, cancellation, and RxJS composition
|
|
200
206
|
- [Selectors and Handlers](docs/selectors-and-handlers.md): `jsonSelector`, `blobSelector`, request handlers, response handlers, and built-in operators
|
|
201
207
|
- [Server-Sent Events](docs/server-sent-events.md): `sse$`, `createSseSelector`, `sseMap`, event filtering, heartbeats, and abort behavior
|
|
208
|
+
- [Testing](docs/testing.md): the middleware contract, `addMiddleware`, and `createOpenApiMockMiddleware`
|
|
202
209
|
|
|
203
210
|
## Things To Remember
|
|
204
211
|
|
package/dist/esm/configurator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { capitalizeRequestMethodOperator, requestValidationOperator, HttpRequestHandler, } from './lib/operators';
|
|
1
|
+
import { capitalizeRequestMethodOperator, requestValidationOperator, HttpMiddlewareHandler, HttpRequestHandler, } from './lib/operators';
|
|
2
2
|
/** @inheritdoc */
|
|
3
3
|
export class HttpClientConfigurator {
|
|
4
4
|
/** Named client configurations keyed by client name. */
|
|
@@ -20,6 +20,8 @@ export class HttpClientConfigurator {
|
|
|
20
20
|
// validate the request object
|
|
21
21
|
'request-validation': requestValidationOperator(),
|
|
22
22
|
});
|
|
23
|
+
/** Default middleware chain cloned into each created client instance. */
|
|
24
|
+
defaultHttpMiddlewareHandler = new HttpMiddlewareHandler();
|
|
23
25
|
/**
|
|
24
26
|
* Creates a configurator with the default client constructor.
|
|
25
27
|
* @param client - The default client constructor used when `ctor` is not configured per client.
|
|
@@ -32,6 +34,11 @@ export class HttpClientConfigurator {
|
|
|
32
34
|
return Object.keys(this._clients).includes(name);
|
|
33
35
|
}
|
|
34
36
|
/** @inheritdoc */
|
|
37
|
+
addMiddleware(middleware) {
|
|
38
|
+
this.defaultHttpMiddlewareHandler.use(middleware);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/** @inheritdoc */
|
|
35
42
|
configureClient(name, args) {
|
|
36
43
|
const argFn = typeof args === 'string' ? { baseUri: args } : args;
|
|
37
44
|
const options = typeof argFn === 'function' ? { onCreate: argFn } : argFn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurator.js","sourceRoot":"","sources":["../../src/configurator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"configurator.js","sourceRoot":"","sources":["../../src/configurator.ts"],"names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AAC,CAAC,CAAC,KAAK,CAAC;QAC1E,4FAA4F;QAC5F,+EAA+E;QAC/E,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG;YACpB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACtB,GAAI,OAAiD;SACtD,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { firstValueFrom, of, Subject } from 'rxjs';
|
|
2
|
-
import { switchMap, takeUntil, tap } from 'rxjs/operators';
|
|
1
|
+
import { finalize, firstValueFrom, of, Subject } from 'rxjs';
|
|
2
|
+
import { switchMap, take, takeUntil, tap } from 'rxjs/operators';
|
|
3
3
|
import { fromFetch } from 'rxjs/fetch';
|
|
4
|
-
import { HttpRequestHandler, HttpResponseHandler } from '../operators';
|
|
4
|
+
import { HttpMiddlewareHandler, HttpRequestHandler, HttpResponseHandler } from '../operators';
|
|
5
5
|
import { blobSelector, jsonSelector } from '../selectors';
|
|
6
6
|
import { HttpResponseError } from '../../errors/index.js';
|
|
7
7
|
import { createSseSelector, } from '../selectors/create-sse-selector';
|
|
@@ -18,6 +18,12 @@ export class HttpClient {
|
|
|
18
18
|
* This property is part of the `HttpClientCreateOptions` configuration object used to create an `HttpClient` instance.
|
|
19
19
|
*/
|
|
20
20
|
responseHandler;
|
|
21
|
+
/**
|
|
22
|
+
* Middleware wrapping the network call, for cross-cutting concerns such as retries,
|
|
23
|
+
* caching, or telemetry. This property is part of the `HttpClientCreateOptions`
|
|
24
|
+
* configuration object used to create an `HttpClient` instance.
|
|
25
|
+
*/
|
|
26
|
+
middlewareHandler;
|
|
21
27
|
/**
|
|
22
28
|
* A stream of requests that are about to be executed.
|
|
23
29
|
* This property is used internally by the `HttpClient` class to manage the lifecycle of requests.
|
|
@@ -56,6 +62,7 @@ export class HttpClient {
|
|
|
56
62
|
this.uri = uri;
|
|
57
63
|
this.requestHandler = new HttpRequestHandler(options?.requestHandler);
|
|
58
64
|
this.responseHandler = new HttpResponseHandler(options?.responseHandler);
|
|
65
|
+
this.middlewareHandler = new HttpMiddlewareHandler(options?.middlewareHandler);
|
|
59
66
|
this._init();
|
|
60
67
|
}
|
|
61
68
|
/**
|
|
@@ -227,7 +234,9 @@ export class HttpClient {
|
|
|
227
234
|
/**
|
|
228
235
|
* Aborts any ongoing HTTP requests made by this `IHttpClient` instance.
|
|
229
236
|
* This will trigger the `takeUntil` operator in the `_fetch$` method,
|
|
230
|
-
* causing any in-flight requests to be cancelled
|
|
237
|
+
* causing any in-flight requests to be cancelled, and abort the
|
|
238
|
+
* per-request `AbortSignal` passed through to `_performFetch`, so the
|
|
239
|
+
* underlying network call is cancelled even behind registered middleware.
|
|
231
240
|
*/
|
|
232
241
|
abort() {
|
|
233
242
|
this._abort$.next();
|
|
@@ -252,11 +261,26 @@ export class HttpClient {
|
|
|
252
261
|
*/
|
|
253
262
|
_fetch$(path, args) {
|
|
254
263
|
const { selector, ...options } = args || {};
|
|
264
|
+
// A registered middleware's `next(...)` resolves through a `Promise` (see
|
|
265
|
+
// `HttpMiddlewareHandler`), which `firstValueFrom` fulfils via its own independent
|
|
266
|
+
// subscription to `_performFetch` — one the `takeUntil(this._abort$)` below never reaches,
|
|
267
|
+
// since it sits outside the subscription tree that `takeUntil` tears down. Combining this
|
|
268
|
+
// controller's signal into the request `init` lets `_performFetch` (`fromFetch` by default)
|
|
269
|
+
// abort the underlying network call directly, regardless of whether middleware severed the
|
|
270
|
+
// RxJS teardown chain.
|
|
271
|
+
const abortController = new AbortController();
|
|
272
|
+
// abort only fires once per request; the subscription is torn down in `finalize` below
|
|
273
|
+
const abort = this._abort$.pipe(take(1)).subscribe(() => abortController.abort());
|
|
274
|
+
const callerSignal = options.signal;
|
|
275
|
+
const signal = callerSignal
|
|
276
|
+
? AbortSignal.any([callerSignal, abortController.signal])
|
|
277
|
+
: abortController.signal;
|
|
255
278
|
// `fromFetch` yields the raw fetch `Response`, but `responseHandler.process()` (called via
|
|
256
279
|
// `_prepareResponse`) expects the pipeline's generic `TResponse` shape — cast through
|
|
257
280
|
// `unknown` since the two are only compatible after that processing step.
|
|
258
281
|
const response$ = of({
|
|
259
282
|
...options,
|
|
283
|
+
signal,
|
|
260
284
|
path,
|
|
261
285
|
uri: this._resolveUrl(path),
|
|
262
286
|
}).pipe(
|
|
@@ -264,8 +288,8 @@ export class HttpClient {
|
|
|
264
288
|
switchMap((x) => this._prepareRequest(x)),
|
|
265
289
|
/** push request to event buss */
|
|
266
290
|
tap((x) => this._request$.next(x)),
|
|
267
|
-
/** execute request */
|
|
268
|
-
switchMap(({ uri, path: _path, ...init }) =>
|
|
291
|
+
/** execute request through registered middleware, terminating at _performFetch */
|
|
292
|
+
switchMap(({ uri, path: _path, ...init }) => this.middlewareHandler.process(uri, init, (u, i) => this._performFetch(u, i))),
|
|
269
293
|
/** prepare response, allow extensions to modify response */
|
|
270
294
|
switchMap((x) => this._prepareResponse(x)),
|
|
271
295
|
/** push response to event buss */
|
|
@@ -286,11 +310,30 @@ export class HttpClient {
|
|
|
286
310
|
return of(response);
|
|
287
311
|
}),
|
|
288
312
|
/** cancel request on abort signal */
|
|
289
|
-
takeUntil(this._abort$)
|
|
313
|
+
takeUntil(this._abort$),
|
|
314
|
+
/** the abort signal subscription only ever fires once; tear it down once this request settles either way */
|
|
315
|
+
finalize(() => abort.unsubscribe()));
|
|
290
316
|
// The pipe above resolves to the per-call generic `T` (via the optional `selector`), but
|
|
291
317
|
// the observable's static type tracks the class-level `TResponse` — cast to the caller's `T`.
|
|
292
318
|
return response$;
|
|
293
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Performs the actual network call for a prepared request.
|
|
322
|
+
*
|
|
323
|
+
* @remarks
|
|
324
|
+
* Isolated from {@link _fetch$} so a test double can replace only this step —
|
|
325
|
+
* matching a request against registered route handlers instead of reaching
|
|
326
|
+
* the network — while everything around it (request preparation, the
|
|
327
|
+
* response pipeline, abort handling) runs unchanged. See
|
|
328
|
+
* `@equinor/fusion-framework-module-http/mock`.
|
|
329
|
+
*
|
|
330
|
+
* @param uri - The fully resolved URL for the request.
|
|
331
|
+
* @param init - The prepared `fetch` request options.
|
|
332
|
+
* @returns An observable of the raw `Response`, ahead of {@link _prepareResponse}.
|
|
333
|
+
*/
|
|
334
|
+
_performFetch(uri, init) {
|
|
335
|
+
return fromFetch(uri, init);
|
|
336
|
+
}
|
|
294
337
|
/**
|
|
295
338
|
* Prepares the request by passing it through the `requestHandler.process()` method.
|
|
296
339
|
* This method is an implementation detail of the `_fetch$()` method, and is not part of the public API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkB1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,iBAAiB,GAGlB,MAAM,kCAAkC,CAAC;AAmB1C,8CAA8C;AAC9C,MAAM,OAAO,UAAU;IAgEZ,GAAG;IA3DZ;;;OAGG;IACa,cAAc,CAAgC;IAE9D;;;OAGG;IACa,eAAe,CAAkC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,CAAC,IAAY;QAChC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAC5C,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CACjE,CAAC;QACF,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { firstValueFrom, from, of } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a step's result to a `Promise`, so a middleware calling `next(...)` never has to
|
|
4
|
+
* branch on whether the next step short-circuited with a plain `Response` or reached all the
|
|
5
|
+
* way to an Observable-returning network call.
|
|
6
|
+
*/
|
|
7
|
+
function toPromise(result) {
|
|
8
|
+
return result instanceof Response ? Promise.resolve(result) : firstValueFrom(from(result));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Composes registered {@link HttpMiddleware} into a single execution pipeline wrapping the
|
|
12
|
+
* network call, so retries, caching, telemetry, or circuit-breaking can wrap `_performFetch`
|
|
13
|
+
* without touching request or response payload transforms.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link HttpClient}
|
|
16
|
+
*/
|
|
17
|
+
export class HttpMiddlewareHandler {
|
|
18
|
+
#middleware;
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a handler, optionally cloning another handler's registered middleware.
|
|
21
|
+
* @param source - An existing handler to clone the registered middleware from.
|
|
22
|
+
*/
|
|
23
|
+
constructor(source) {
|
|
24
|
+
this.#middleware = source ? [...source.middleware] : [];
|
|
25
|
+
}
|
|
26
|
+
/** @inheritdoc */
|
|
27
|
+
get middleware() {
|
|
28
|
+
return this.#middleware;
|
|
29
|
+
}
|
|
30
|
+
/** @inheritdoc */
|
|
31
|
+
use(middleware) {
|
|
32
|
+
this.#middleware.push(middleware);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
/** @inheritdoc */
|
|
36
|
+
process(uri, init, terminal) {
|
|
37
|
+
// wrap outward-in so the first-registered middleware is outermost, matching a conventional middleware chain
|
|
38
|
+
const chain = this.#middleware.reduceRight((next, middleware) => (nextUri, nextInit) => middleware(nextUri, nextInit, (u, i) => toPromise(next(u, i))), terminal);
|
|
39
|
+
const result = chain(uri, init);
|
|
40
|
+
// a middleware may short-circuit with a plain Response (no ObservableInput wrapping needed)
|
|
41
|
+
return result instanceof Response ? of(result) : from(result);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default HttpMiddlewareHandler;
|
|
45
|
+
//# sourceMappingURL=HttpMiddlewareHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpMiddlewareHandler.js","sourceRoot":"","sources":["../../../../src/lib/operators/HttpMiddlewareHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAKhD;;;;GAIG;AACH,SAAS,SAAS,CAAC,MAA4C;IAC7D,OAAO,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qBAAqB;IAChC,WAAW,CAAmB;IAE9B;;;OAGG;IACH,YAAY,MAA+B;QACzC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,CAAC;IAED,kBAAkB;IAClB,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,kBAAkB;IAClB,GAAG,CAAC,UAA0B;QAC5B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kBAAkB;IAClB,OAAO,CAAC,GAAW,EAAE,IAAiB,EAAE,QAA4B;QAClE,4GAA4G;QAC5G,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CACxC,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC1C,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAChE,QAAQ,CACT,CAAC;QACF,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAChC,4FAA4F;QAC5F,OAAO,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { HttpRequestHandler } from './HttpRequestHandler';
|
|
2
2
|
export { HttpResponseHandler } from './HttpResponseHandler';
|
|
3
|
+
export { HttpMiddlewareHandler } from './HttpMiddlewareHandler';
|
|
3
4
|
export { ProcessOperators } from './ProcessOperators';
|
|
4
5
|
export { capitalizeRequestMethodOperator } from './capitalize-request-method-operator';
|
|
5
6
|
export { requestValidationOperator } from './request-validation-operator';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/operators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/operators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { resolveOpenApiMockResponse } from './resolve-open-api-mock-response';
|
|
2
|
+
/**
|
|
3
|
+
* Adapts an `OpenApiMock` into an {@link HttpMiddleware}, so
|
|
4
|
+
* `configurator.http.addMiddleware(...)` fakes every matching request
|
|
5
|
+
* straight from an OpenAPI document — no separate mock configurator needed.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* A request that matches no operation in the document falls through to
|
|
9
|
+
* `next`, so this composes with whatever else is registered — including the
|
|
10
|
+
* real network call, or another middleware further down the chain. Because
|
|
11
|
+
* `addMiddleware` wraps `_performFetch` rather than replacing it, the exact
|
|
12
|
+
* same registration also fakes requests through any client this configurator
|
|
13
|
+
* builds, so app config never has to branch on whether it's under test.
|
|
14
|
+
*
|
|
15
|
+
* @param openApiMock - Typically `createOpenApiMock(document)` from `@equinor/fusion-openapi-mock`.
|
|
16
|
+
* @returns A middleware for {@link IHttpClientConfigurator.addMiddleware}.
|
|
17
|
+
*
|
|
18
|
+
* @example Fake every operation in a spec, straight from the document
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { createOpenApiMock } from '@equinor/fusion-openapi-mock';
|
|
21
|
+
* import openapi from './openapi.json' with { type: 'json' };
|
|
22
|
+
*
|
|
23
|
+
* configurator.http.addMiddleware(createOpenApiMockMiddleware(createOpenApiMock(openapi)));
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function createOpenApiMockMiddleware(openApiMock) {
|
|
27
|
+
return async (uri, init, next) => {
|
|
28
|
+
const response = await resolveOpenApiMockResponse(openApiMock, init.method ?? 'GET', new URL(uri));
|
|
29
|
+
return response ?? next(uri, init);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default createOpenApiMockMiddleware;
|
|
33
|
+
//# sourceMappingURL=create-open-api-mock-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-open-api-mock-middleware.js","sourceRoot":"","sources":["../../../src/mock/create-open-api-mock-middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAwB,MAAM,kCAAkC,CAAC;AAEpG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,2BAA2B,CAAC,WAA4B;IACtE,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAC/B,MAAM,QAAQ,GAAG,MAAM,0BAA0B,CAC/C,WAAW,EACX,IAAI,CAAC,MAAM,IAAI,KAAK,EACpB,IAAI,GAAG,CAAC,GAAG,CAAC,CACb,CAAC;QACF,OAAO,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compiles a path template into a matching `RegExp` plus the ordered list of named parameters
|
|
3
|
+
* it captures.
|
|
4
|
+
*
|
|
5
|
+
* @param path - A path template such as `/contexts/:id`.
|
|
6
|
+
* @returns The compiled pattern and the parameter names it captures, in segment order.
|
|
7
|
+
*/
|
|
8
|
+
function compilePath(path) {
|
|
9
|
+
const keys = [];
|
|
10
|
+
const pattern = path
|
|
11
|
+
.split('/')
|
|
12
|
+
// each segment either captures a path parameter or must match literally
|
|
13
|
+
.map((segment) => {
|
|
14
|
+
// only `:name` segments become capture groups; everything else must match literally
|
|
15
|
+
if (!segment.startsWith(':')) {
|
|
16
|
+
return segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
17
|
+
}
|
|
18
|
+
keys.push(segment.slice(1));
|
|
19
|
+
return '([^/]+)';
|
|
20
|
+
})
|
|
21
|
+
.join('/');
|
|
22
|
+
return { regexp: new RegExp(`^${pattern}/?$`), keys };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Builds an {@link HttpMiddleware} that answers requests to one base URI with hand-registered
|
|
26
|
+
* route handlers, matched by method and a path template (`:id`-style segments) — a lightweight
|
|
27
|
+
* router for tests with more than a couple of routes to fake, without hand-rolling `RegExp`
|
|
28
|
+
* matching against `uri` in every middleware.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* A request outside `baseUri`, or matching no registered route, falls through to `next`, so
|
|
32
|
+
* this composes with other middleware — including the real network call, or another router
|
|
33
|
+
* for a different base URI — registered around it. Routes are tried in registration order;
|
|
34
|
+
* the first match wins.
|
|
35
|
+
*
|
|
36
|
+
* Deliberately not an MSW-compatible API — this stays inside `addMiddleware`'s own request
|
|
37
|
+
* pipeline rather than intercepting the network boundary, so it has none of MSW's response
|
|
38
|
+
* transformers, `onUnhandledRequest` diagnostics, or wildcard patterns.
|
|
39
|
+
*
|
|
40
|
+
* @param baseUri - The base URI this router answers for, e.g. `https://api.example.com`.
|
|
41
|
+
* @param build - Registers routes on the given {@link IMockRouterBuilder}.
|
|
42
|
+
* @returns A middleware for {@link IHttpClientConfigurator.addMiddleware}.
|
|
43
|
+
*
|
|
44
|
+
* @example Fake a handful of routes under one base URI
|
|
45
|
+
* ```typescript
|
|
46
|
+
* configurator.http.addMiddleware(
|
|
47
|
+
* createRouterMiddleware('https://context.example.com', (router) => {
|
|
48
|
+
* router.get('/contexts/:id/relations', () => Response.json([{ id: 'ctx-3' }]));
|
|
49
|
+
* router.get('/contexts', () => Response.json([{ id: 'ctx-2' }]));
|
|
50
|
+
* router.get('/contexts/:id', ({ params }) => Response.json({ id: params.id }));
|
|
51
|
+
* }),
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function createRouterMiddleware(baseUri, build) {
|
|
56
|
+
const routes = [];
|
|
57
|
+
const register = (method, path, handler) => {
|
|
58
|
+
const { regexp, keys } = compilePath(path);
|
|
59
|
+
routes.push({ method: method?.toUpperCase(), regexp, keys, handler });
|
|
60
|
+
return router;
|
|
61
|
+
};
|
|
62
|
+
const router = {
|
|
63
|
+
get: (path, handler) => register('GET', path, handler),
|
|
64
|
+
post: (path, handler) => register('POST', path, handler),
|
|
65
|
+
put: (path, handler) => register('PUT', path, handler),
|
|
66
|
+
patch: (path, handler) => register('PATCH', path, handler),
|
|
67
|
+
delete: (path, handler) => register('DELETE', path, handler),
|
|
68
|
+
on: register,
|
|
69
|
+
};
|
|
70
|
+
build(router);
|
|
71
|
+
const base = new URL(baseUri);
|
|
72
|
+
const basePath = base.pathname.replace(/\/$/, '');
|
|
73
|
+
return async (uri, init, next) => {
|
|
74
|
+
const url = new URL(uri);
|
|
75
|
+
// requests to a different origin, or outside this router's base path, are none of its concern
|
|
76
|
+
if (url.origin !== base.origin || !url.pathname.startsWith(basePath))
|
|
77
|
+
return next(uri, init);
|
|
78
|
+
const pathname = url.pathname.slice(basePath.length) || '/';
|
|
79
|
+
const method = (init.method ?? 'GET').toUpperCase();
|
|
80
|
+
// first registered route whose method and pattern both match wins
|
|
81
|
+
for (const route of routes) {
|
|
82
|
+
// a route registered for a specific method never answers a request for another method
|
|
83
|
+
if (route.method && route.method !== method)
|
|
84
|
+
continue;
|
|
85
|
+
const match = route.regexp.exec(pathname);
|
|
86
|
+
// pattern didn't match this pathname at all — try the next registered route
|
|
87
|
+
if (!match)
|
|
88
|
+
continue;
|
|
89
|
+
// capture groups are positional, in the same order `compilePath` recorded their names
|
|
90
|
+
const params = Object.fromEntries(route.keys.map((key, i) => [key, match[i + 1]]));
|
|
91
|
+
return route.handler({ params, url, request: new Request(uri, init) });
|
|
92
|
+
}
|
|
93
|
+
return next(uri, init);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export default createRouterMiddleware;
|
|
97
|
+
//# sourceMappingURL=create-router-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-router-middleware.js","sourceRoot":"","sources":["../../../src/mock/create-router-middleware.ts"],"names":[],"mappings":"AAmDA;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAI;SACjB,KAAK,CAAC,GAAG,CAAC;QACX,wEAAwE;SACvE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,oFAAoF;QACpF,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,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C,CAAC,CAAC,CAAC,CAAC;YACnF,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Testing utilities for the HTTP module.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Imported from `@equinor/fusion-framework-module-http/mock`, so testing
|
|
6
|
+
* utilities ship and version with the implementation they stand in for.
|
|
7
|
+
*
|
|
8
|
+
* There is no separate mock client or configurator here — register a
|
|
9
|
+
* short-circuiting `HttpMiddleware` through `configurator.http.addMiddleware(...)`
|
|
10
|
+
* on the real `HttpClientConfigurator` instead, so app config never has to
|
|
11
|
+
* branch on whether it's under test. See {@link createOpenApiMockMiddleware}
|
|
12
|
+
* for faking a whole OpenAPI document's operations that way.
|
|
13
|
+
*
|
|
14
|
+
* This entry point has no dependency on any test runner.
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
export { createOpenApiMockMiddleware } from './create-open-api-mock-middleware';
|
|
19
|
+
export { createRouterMiddleware, } from './create-router-middleware';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mock/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,EACL,sBAAsB,GAIvB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a method and URL against an `OpenApiMock`, building a `Response`
|
|
3
|
+
* from whatever it matches — shared by every adapter targeting a different
|
|
4
|
+
* middleware shape, so the method/path/query mapping and status/body wiring
|
|
5
|
+
* lives in one place.
|
|
6
|
+
*
|
|
7
|
+
* @param openApiMock - The mock to resolve against.
|
|
8
|
+
* @param method - The request's HTTP method.
|
|
9
|
+
* @param url - The request's fully resolved URL.
|
|
10
|
+
* @returns The faked `Response`, or `undefined` when no operation matches.
|
|
11
|
+
*/
|
|
12
|
+
export async function resolveOpenApiMockResponse(openApiMock, method, url) {
|
|
13
|
+
const result = await openApiMock.resolve({
|
|
14
|
+
method,
|
|
15
|
+
path: url.pathname,
|
|
16
|
+
query: Object.fromEntries(url.searchParams),
|
|
17
|
+
});
|
|
18
|
+
return result && Response.json(result.mock, { status: result.status });
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=resolve-open-api-mock-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-open-api-mock-response.js","sourceRoot":"","sources":["../../../src/mock/resolve-open-api-mock-response.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,WAA4B,EAC5B,MAAc,EACd,GAAQ;IAER,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC;QACvC,MAAM;QACN,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;KAC5C,CAAC,CAAC;IACH,OAAO,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/esm/provider.js
CHANGED
|
@@ -38,6 +38,13 @@ export class HttpClientProvider extends BaseModuleProvider {
|
|
|
38
38
|
get defaultHttpRequestHandler() {
|
|
39
39
|
return this.config.defaultHttpRequestHandler;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets the default middleware chain for the HTTP client provider.
|
|
43
|
+
* @returns The default middleware chain.
|
|
44
|
+
*/
|
|
45
|
+
get defaultHttpMiddlewareHandler() {
|
|
46
|
+
return this.config.defaultHttpMiddlewareHandler;
|
|
47
|
+
}
|
|
41
48
|
/**
|
|
42
49
|
* Creates a new `HttpClientProvider`.
|
|
43
50
|
* @param config - The configurator providing client definitions and defaults.
|
|
@@ -75,8 +82,8 @@ export class HttpClientProvider extends BaseModuleProvider {
|
|
|
75
82
|
*/
|
|
76
83
|
createClient(keyOrConfig) {
|
|
77
84
|
const config = this._resolveConfig(keyOrConfig);
|
|
78
|
-
const { baseUri, defaultScopes = [], onCreate, ctor = this.config.defaultHttpClientCtor, requestHandler = this.defaultHttpRequestHandler, responseHandler, } = config;
|
|
79
|
-
const options = { requestHandler, responseHandler };
|
|
85
|
+
const { baseUri, defaultScopes = [], onCreate, ctor = this.config.defaultHttpClientCtor, requestHandler = this.defaultHttpRequestHandler, responseHandler, middlewareHandler = this.defaultHttpMiddlewareHandler, } = config;
|
|
86
|
+
const options = { requestHandler, responseHandler, middlewareHandler };
|
|
80
87
|
const instance = new ctor(baseUri || '', options);
|
|
81
88
|
// attach the resolved default scopes onto the instance without overwriting other own properties
|
|
82
89
|
Object.assign(instance, { defaultScopes });
|
package/dist/esm/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AASA,OAAO,EAA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AE,CAAC;gBAChD,2FAA2F;gBAC3F,OAAO,CAAC,IAAI,CACV,yBAAyB,WAAW,sEAAsE;oBACxG,2BAA2B,WAAW,KAAK;oBAC3C,qDAAqD,CACxD,CAAC;gBACF,OAAO,EAAE,OAAO,EAAE,WAAW,WAAW,EAAE,EAAE,CAAC;YAC/C,CAAC;iBAAM,IAAI,CAAC,MAAM,EAAE,CAAC;gBACnB,MAAM,IAAI,uBAAuB,CAAC,sCAAsC,WAAW,GAAG,CAAC,CAAC;YAC1F,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,WAAyC,CAAC;IACnD,CAAC;CACF"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC"}
|