@warp-drive/core 5.6.0-alpha.18 → 5.6.0-alpha.5
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/README.md +7 -8
- package/declarations/index.d.ts +3 -14
- package/declarations/index.d.ts.map +1 -0
- package/declarations/request/-private/context.d.ts +35 -34
- package/declarations/request/-private/context.d.ts.map +1 -0
- package/declarations/request/-private/debug.d.ts +3 -2
- package/declarations/request/-private/debug.d.ts.map +1 -0
- package/declarations/request/-private/fetch.d.ts +36 -24
- package/declarations/request/-private/fetch.d.ts.map +1 -0
- package/declarations/request/-private/future.d.ts +4 -3
- package/declarations/request/-private/future.d.ts.map +1 -0
- package/declarations/request/-private/manager.d.ts +132 -159
- package/declarations/request/-private/manager.d.ts.map +1 -0
- package/declarations/request/-private/promise-cache.d.ts +13 -21
- package/declarations/request/-private/promise-cache.d.ts.map +1 -0
- package/declarations/request/-private/types.d.ts +123 -124
- package/declarations/request/-private/types.d.ts.map +1 -0
- package/declarations/request/-private/utils.d.ts +9 -8
- package/declarations/request/-private/utils.d.ts.map +1 -0
- package/declarations/request.d.ts +433 -5
- package/declarations/request.d.ts.map +1 -0
- package/declarations/types/-private.d.ts +8 -16
- package/declarations/types/-private.d.ts.map +1 -0
- package/declarations/types/cache/aliases.d.ts +1 -11
- package/declarations/types/cache/aliases.d.ts.map +1 -0
- package/declarations/types/cache/change.d.ts +5 -4
- package/declarations/types/cache/change.d.ts.map +1 -0
- package/declarations/types/cache/mutations.d.ts +28 -51
- package/declarations/types/cache/mutations.d.ts.map +1 -0
- package/declarations/types/cache/operations.d.ts +47 -60
- package/declarations/types/cache/operations.d.ts.map +1 -0
- package/declarations/types/cache/relationship.d.ts +9 -11
- package/declarations/types/cache/relationship.d.ts.map +1 -0
- package/declarations/types/cache.d.ts +484 -495
- package/declarations/types/cache.d.ts.map +1 -0
- package/declarations/types/graph.d.ts +40 -31
- package/declarations/types/graph.d.ts.map +1 -0
- package/declarations/types/identifier.d.ts +82 -83
- package/declarations/types/identifier.d.ts.map +1 -0
- package/declarations/types/json/raw.d.ts +2 -1
- package/declarations/types/json/raw.d.ts.map +1 -0
- package/declarations/types/params.d.ts +5 -4
- package/declarations/types/params.d.ts.map +1 -0
- package/declarations/types/record.d.ts +76 -117
- package/declarations/types/record.d.ts.map +1 -0
- package/declarations/types/record.type-test.d.ts +2 -0
- package/declarations/types/record.type-test.d.ts.map +1 -0
- package/declarations/types/request.d.ts +266 -289
- package/declarations/types/request.d.ts.map +1 -0
- package/declarations/types/request.type-test.d.ts +2 -0
- package/declarations/types/request.type-test.d.ts.map +1 -0
- package/declarations/types/runtime.d.ts +9 -8
- package/declarations/types/runtime.d.ts.map +1 -0
- package/declarations/types/schema/concepts.d.ts +13 -19
- package/declarations/types/schema/concepts.d.ts.map +1 -0
- package/declarations/types/schema/fields.d.ts +1741 -1712
- package/declarations/types/schema/fields.d.ts.map +1 -0
- package/declarations/types/schema/fields.type-test.d.ts +1 -0
- package/declarations/types/schema/fields.type-test.d.ts.map +1 -0
- package/declarations/types/spec/document.d.ts +22 -28
- package/declarations/types/spec/document.d.ts.map +1 -0
- package/declarations/types/spec/error.d.ts +17 -16
- package/declarations/types/spec/error.d.ts.map +1 -0
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/spec/json-api-raw.d.ts.map +1 -0
- package/declarations/types/symbols.d.ts +75 -74
- package/declarations/types/symbols.d.ts.map +1 -0
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types/utils.d.ts.map +1 -0
- package/declarations/types.d.ts +7 -10
- package/declarations/types.d.ts.map +1 -0
- package/dist/{context-COmAnXUQ.js → context-DE5sFezZ.js} +2 -2
- package/dist/context-DE5sFezZ.js.map +1 -0
- package/dist/index.js +104 -37
- package/dist/index.js.map +1 -0
- package/dist/request.js +1 -1
- package/dist/request.js.map +1 -0
- package/dist/types/-private.js +3 -3
- package/dist/types/-private.js.map +1 -0
- package/dist/types/cache/aliases.js.map +1 -0
- package/dist/types/cache/change.js.map +1 -0
- package/dist/types/cache/mutations.js.map +1 -0
- package/dist/types/cache/operations.js.map +1 -0
- package/dist/types/cache/relationship.js.map +1 -0
- package/dist/types/cache.js.map +1 -0
- package/dist/types/graph.js.map +1 -0
- package/dist/types/identifier.js.map +1 -0
- package/dist/types/json/raw.js.map +1 -0
- package/dist/types/params.js.map +1 -0
- package/dist/types/record.js +1 -1
- package/dist/types/record.js.map +1 -0
- package/dist/types/request.js +2 -2
- package/dist/types/request.js.map +1 -0
- package/dist/types/runtime.js +1 -1
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/schema/concepts.js.map +1 -0
- package/dist/types/schema/fields.js +41 -8
- package/dist/types/schema/fields.js.map +1 -0
- package/dist/types/schema/fields.type-test.js.map +1 -0
- package/dist/types/spec/document.js.map +1 -0
- package/dist/types/spec/error.js.map +1 -0
- package/dist/types/spec/json-api-raw.js.map +1 -0
- package/dist/types/symbols.js +3 -3
- package/dist/types/symbols.js.map +1 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +8 -11
- package/cjs-dist/addon-shim.cjs +0 -1
- package/cjs-dist/cjs-set-config.cjs +0 -1
- package/declarations/build-config/babel-macros.d.ts +0 -1
- package/declarations/build-config/canary-features.d.ts +0 -1
- package/declarations/build-config/debugging.d.ts +0 -1
- package/declarations/build-config/deprecations.d.ts +0 -1
- package/declarations/build-config/env.d.ts +0 -1
- package/declarations/build-config/macros.d.ts +0 -1
- package/declarations/build-config.d.ts +0 -1
- package/declarations/configure.d.ts +0 -7
- package/declarations/graph/-private/-diff.d.ts +0 -32
- package/declarations/graph/-private/-edge-definition.d.ts +0 -148
- package/declarations/graph/-private/-state.d.ts +0 -96
- package/declarations/graph/-private/-utils.d.ts +0 -31
- package/declarations/graph/-private/coerce-id.d.ts +0 -10
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -18
- package/declarations/graph/-private/edges/collection.d.ts +0 -39
- package/declarations/graph/-private/edges/implicit.d.ts +0 -43
- package/declarations/graph/-private/edges/resource.d.ts +0 -24
- package/declarations/graph/-private/graph.d.ts +0 -90
- package/declarations/graph/-private/normalize-link.d.ts +0 -8
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
- package/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
- package/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
- package/declarations/graph/-private/operations/replace-related-records.d.ts +0 -62
- package/declarations/graph/-private/operations/update-relationship.d.ts +0 -13
- package/declarations/graph/-private.d.ts +0 -13
- package/declarations/reactive/-private/document.d.ts +0 -146
- package/declarations/reactive/-private/fields/compute.d.ts +0 -43
- package/declarations/reactive/-private/fields/extension.d.ts +0 -8
- package/declarations/reactive/-private/fields/managed-array.d.ts +0 -22
- package/declarations/reactive/-private/fields/managed-object.d.ts +0 -21
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
- package/declarations/reactive/-private/hooks.d.ts +0 -5
- package/declarations/reactive/-private/record.d.ts +0 -64
- package/declarations/reactive/-private/schema.d.ts +0 -271
- package/declarations/reactive/-private/symbols.d.ts +0 -36
- package/declarations/reactive/-private.d.ts +0 -1
- package/declarations/reactive.d.ts +0 -4
- package/declarations/store/-private/cache-handler/handler.d.ts +0 -62
- package/declarations/store/-private/cache-handler/types.d.ts +0 -98
- package/declarations/store/-private/cache-handler/utils.d.ts +0 -32
- package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
- package/declarations/store/-private/caches/identifier-cache.d.ts +0 -304
- package/declarations/store/-private/caches/instance-cache.d.ts +0 -65
- package/declarations/store/-private/caches/resource-utils.d.ts +0 -9
- package/declarations/store/-private/debug/utils.d.ts +0 -6
- package/declarations/store/-private/default-cache-policy.d.ts +0 -384
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -25
- package/declarations/store/-private/managers/cache-manager.d.ts +0 -443
- package/declarations/store/-private/managers/notification-manager.d.ts +0 -98
- package/declarations/store/-private/managers/record-array-manager.d.ts +0 -97
- package/declarations/store/-private/network/request-cache.d.ts +0 -107
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -263
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -176
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -169
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -35
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -277
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -261
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
- package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -126
- package/declarations/store/-private/store-service.d.ts +0 -1605
- package/declarations/store/-private/utils/coerce-id.d.ts +0 -10
- package/declarations/store/-private/utils/construct-resource.d.ts +0 -6
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/declarations/store/-private.d.ts +0 -31
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -99
- package/declarations/store/-types/q/ds-model.d.ts +0 -21
- package/declarations/store/-types/q/identifier.d.ts +0 -20
- package/declarations/store/-types/q/record-instance.d.ts +0 -23
- package/declarations/store/-types/q/schema-service.d.ts +0 -354
- package/declarations/store/-types/q/store.d.ts +0 -32
- package/declarations/store.d.ts +0 -1
- package/declarations/utils/string.d.ts +0 -48
- package/dist/build-config/babel-macros.js +0 -1
- package/dist/build-config/canary-features.js +0 -1
- package/dist/build-config/debugging.js +0 -1
- package/dist/build-config/deprecations.js +0 -1
- package/dist/build-config/env.js +0 -1
- package/dist/build-config/macros.js +0 -1
- package/dist/build-config.js +0 -1
- package/dist/configure-B48bFHOl.js +0 -181
- package/dist/configure.js +0 -1
- package/dist/graph/-private.js +0 -3372
- package/dist/handler-C2T-IyJK.js +0 -339
- package/dist/reactive/-private.js +0 -1
- package/dist/reactive.js +0 -1988
- package/dist/request-state-CjLph1LP.js +0 -8139
- package/dist/store/-private.js +0 -3
- package/dist/store.js +0 -545
- package/dist/symbols-SIstXMLI.js +0 -44
- package/dist/utils/string.js +0 -92
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/README.md +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/github-header.svg +0 -444
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
|
@@ -1,91 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { IS_FUTURE, RequestContext, RequestInfo, ResponseInfo, StructuredDataDocument } from "../../types/request.js";
|
|
1
|
+
import type { StableDocumentIdentifier } from '../../types/identifier';
|
|
2
|
+
import type { IS_FUTURE, RequestContext, RequestInfo, ResponseInfo, StructuredDataDocument } from '../../types/request';
|
|
4
3
|
export interface GodContext {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
controller: AbortController;
|
|
5
|
+
response: ResponseInfo | null;
|
|
6
|
+
stream: ReadableStream | Promise<ReadableStream | null> | null;
|
|
7
|
+
hasRequestedStream: boolean;
|
|
8
|
+
id: number;
|
|
9
|
+
identifier: StableDocumentIdentifier | null;
|
|
11
10
|
}
|
|
12
11
|
export type Deferred<T> = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
resolve(v: T): void;
|
|
13
|
+
reject(v: unknown): void;
|
|
14
|
+
promise: Promise<T>;
|
|
16
15
|
};
|
|
17
16
|
export type ManagedRequestPriority = {
|
|
18
|
-
|
|
17
|
+
blocking: boolean;
|
|
19
18
|
};
|
|
20
19
|
export type DeferredStream = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
resolve(v: ReadableStream | null): void;
|
|
21
|
+
reject(v: unknown): void;
|
|
22
|
+
promise: Promise<ReadableStream | null> & {
|
|
23
|
+
sizeHint?: number;
|
|
24
|
+
};
|
|
26
25
|
};
|
|
27
26
|
/**
|
|
28
|
-
* A Future is a
|
|
29
|
-
* while providing the ability to
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
33
|
-
|
|
27
|
+
* A Future is a Promise which resolves to a StructuredDocument
|
|
28
|
+
* while providing the ability to `abort` the underlying request,
|
|
29
|
+
* `getStream` the response before the outer promise resolves;
|
|
30
|
+
*
|
|
31
|
+
* @class Future
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
34
|
export interface Future<T> extends Promise<StructuredDataDocument<T>> {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*/
|
|
79
|
-
id: number;
|
|
35
|
+
[IS_FUTURE]: true;
|
|
36
|
+
/**
|
|
37
|
+
* Cancel this request by firing the AbortController's signal.
|
|
38
|
+
*
|
|
39
|
+
* @param {String} [reason] optional reason for aborting the request
|
|
40
|
+
* @public
|
|
41
|
+
* @return {void}
|
|
42
|
+
*/
|
|
43
|
+
abort(reason?: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Get the response stream, if any, once made available.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* @return {Promise<ReadableStream | null>}
|
|
49
|
+
*/
|
|
50
|
+
getStream(): Promise<ReadableStream | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Run a callback when this request completes. Use sparingly,
|
|
53
|
+
* mostly useful for instrumentation and infrastructure.
|
|
54
|
+
*
|
|
55
|
+
* @param cb the callback to run
|
|
56
|
+
* @public
|
|
57
|
+
* @return {void}
|
|
58
|
+
*/
|
|
59
|
+
onFinalize(cb: () => void): void;
|
|
60
|
+
/**
|
|
61
|
+
* The identifier of the associated request, if any, as
|
|
62
|
+
* assigned by the CacheHandler.
|
|
63
|
+
*
|
|
64
|
+
* @property lid
|
|
65
|
+
* @type {StableDocumentIdentifier | null}
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
lid: StableDocumentIdentifier | null;
|
|
69
|
+
/**
|
|
70
|
+
* The id of the associated request, if any, as assigned
|
|
71
|
+
* by the RequestManager
|
|
72
|
+
*
|
|
73
|
+
* @property id
|
|
74
|
+
* @type {Number}
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
id: number;
|
|
80
78
|
}
|
|
81
79
|
export type DeferredFuture<T> = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
resolve(v: StructuredDataDocument<T>): void;
|
|
81
|
+
reject(v: unknown): void;
|
|
82
|
+
promise: Future<T>;
|
|
85
83
|
};
|
|
86
84
|
export type NextFn<P = unknown> = (req: RequestInfo) => Future<P>;
|
|
87
85
|
/**
|
|
88
|
-
* Requests are fulfilled by handlers. A handler receives the request context
|
|
86
|
+
* Requests are fulfilled by handlers. A handler receives the request context
|
|
89
87
|
as well as a `next` function with which to pass along a request to the next
|
|
90
88
|
handler if it so chooses.
|
|
91
89
|
|
|
@@ -99,7 +97,7 @@ that it can then compose how it sees fit with its own response.
|
|
|
99
97
|
type NextFn<P> = (req: RequestInfo) => Future<P>;
|
|
100
98
|
|
|
101
99
|
interface Handler {
|
|
102
|
-
async request<T>(context: RequestContext, next: NextFn<P>): T;
|
|
100
|
+
async request<T>(context: RequestContext, next: NextFn<P>): T;
|
|
103
101
|
}
|
|
104
102
|
```
|
|
105
103
|
|
|
@@ -107,10 +105,10 @@ async request<T>(context: RequestContext, next: NextFn<P>): T;
|
|
|
107
105
|
|
|
108
106
|
```ts
|
|
109
107
|
interface RequestContext<T> {
|
|
110
|
-
readonly request: RequestInfo;
|
|
108
|
+
readonly request: RequestInfo;
|
|
111
109
|
|
|
112
|
-
setStream(stream: ReadableStream | Promise<ReadableStream>): void;
|
|
113
|
-
setResponse(response: Response | ResponseInfo): void;
|
|
110
|
+
setStream(stream: ReadableStream | Promise<ReadableStream>): void;
|
|
111
|
+
setResponse(response: Response | ResponseInfo): void;
|
|
114
112
|
}
|
|
115
113
|
```
|
|
116
114
|
|
|
@@ -123,13 +121,13 @@ response content before passing along the chunk downstream.
|
|
|
123
121
|
|
|
124
122
|
```ts
|
|
125
123
|
const FetchHandler = {
|
|
126
|
-
async request(context) {
|
|
127
|
-
const response = await fetch(context.request);
|
|
128
|
-
context.setResponse(reponse);
|
|
129
|
-
context.setStream(response.clone().body);
|
|
124
|
+
async request(context) {
|
|
125
|
+
const response = await fetch(context.request);
|
|
126
|
+
context.setResponse(reponse);
|
|
127
|
+
context.setStream(response.clone().body);
|
|
130
128
|
|
|
131
|
-
return response.json();
|
|
132
|
-
}
|
|
129
|
+
return response.json();
|
|
130
|
+
}
|
|
133
131
|
}
|
|
134
132
|
```
|
|
135
133
|
|
|
@@ -140,13 +138,13 @@ return response.json();
|
|
|
140
138
|
For context, it helps to understand a few of the use-cases that RequestManager
|
|
141
139
|
is intended to allow.
|
|
142
140
|
|
|
143
|
-
- to manage and return streaming content (such as video files)
|
|
144
|
-
- to fulfill a request from multiple sources or by splitting one request into multiple requests
|
|
145
|
-
- for instance one API call for a user and another for the user's friends
|
|
146
|
-
- or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB etc.) and the rest from another source (a different API, a WebWorker, etc.)
|
|
147
|
-
- to coalesce multiple requests
|
|
148
|
-
- to decorate a request with additional info
|
|
149
|
-
- e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.
|
|
141
|
+
- to manage and return streaming content (such as video files)
|
|
142
|
+
- to fulfill a request from multiple sources or by splitting one request into multiple requests
|
|
143
|
+
- for instance one API call for a user and another for the user's friends
|
|
144
|
+
- or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB etc.) and the rest from another source (a different API, a WebWorker, etc.)
|
|
145
|
+
- to coalesce multiple requests
|
|
146
|
+
- to decorate a request with additional info
|
|
147
|
+
- e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.
|
|
150
148
|
|
|
151
149
|
----
|
|
152
150
|
|
|
@@ -186,51 +184,52 @@ Request handlers are registered by configuring the manager via `use`
|
|
|
186
184
|
|
|
187
185
|
```ts
|
|
188
186
|
const manager = new RequestManager()
|
|
189
|
-
.use([Handler1, Handler2]);
|
|
187
|
+
.use([Handler1, Handler2]);
|
|
190
188
|
```
|
|
191
189
|
|
|
192
190
|
Handlers will be invoked in the order they are registered ("fifo", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.
|
|
193
191
|
|
|
194
192
|
|
|
195
|
-
@class (Interface) Handler
|
|
196
|
-
@public
|
|
193
|
+
@class (Interface) Handler
|
|
194
|
+
@public
|
|
197
195
|
*/
|
|
198
196
|
export interface Handler {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Method to implement to handle requests. Receives the request
|
|
199
|
+
* context and a nextFn to call to pass-along the request to
|
|
200
|
+
* other handlers.
|
|
201
|
+
*
|
|
202
|
+
* @public
|
|
203
|
+
* @param context
|
|
204
|
+
* @param next
|
|
205
|
+
*/
|
|
206
|
+
request<T = unknown>(context: RequestContext, next: NextFn<T>): Promise<T | StructuredDataDocument<T>> | Future<T>;
|
|
209
207
|
}
|
|
210
208
|
/**
|
|
211
|
-
* The CacheHandler is identical to other handlers ecxept that it
|
|
212
|
-
* is allowed to return a value synchronously. This is useful for
|
|
213
|
-
* features like reducing microtask queueing when de-duping.
|
|
214
|
-
*
|
|
215
|
-
* A RequestManager may only have one CacheHandler, registered via
|
|
216
|
-
* `manager.useCache(CacheHandler)`.
|
|
217
|
-
*
|
|
218
|
-
* @class (Interface) CacheHandler
|
|
219
|
-
* @public
|
|
220
|
-
*/
|
|
209
|
+
* The CacheHandler is identical to other handlers ecxept that it
|
|
210
|
+
* is allowed to return a value synchronously. This is useful for
|
|
211
|
+
* features like reducing microtask queueing when de-duping.
|
|
212
|
+
*
|
|
213
|
+
* A RequestManager may only have one CacheHandler, registered via
|
|
214
|
+
* `manager.useCache(CacheHandler)`.
|
|
215
|
+
*
|
|
216
|
+
* @class (Interface) CacheHandler
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
221
219
|
export interface CacheHandler {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
220
|
+
/**
|
|
221
|
+
* Method to implement to handle requests. Receives the request
|
|
222
|
+
* context and a nextFn to call to pass-along the request to
|
|
223
|
+
* other handlers.
|
|
224
|
+
*
|
|
225
|
+
* @public
|
|
226
|
+
* @param context
|
|
227
|
+
* @param next
|
|
228
|
+
*/
|
|
229
|
+
request<T = unknown>(context: RequestContext, next: NextFn<T>): Promise<T | StructuredDataDocument<T>> | Future<T> | T;
|
|
232
230
|
}
|
|
233
231
|
export interface RequestResponse<T> {
|
|
234
|
-
|
|
232
|
+
result: T;
|
|
235
233
|
}
|
|
236
234
|
export type GenericCreateArgs = Record<string | symbol, unknown>;
|
|
235
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/request/-private/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import type { RequestInfo, StructuredDataDocument } from
|
|
2
|
-
import { ContextOwner } from
|
|
3
|
-
import type { DeferredFuture, Future, GodContext, Handler } from
|
|
1
|
+
import type { RequestInfo, StructuredDataDocument } from '../../types/request';
|
|
2
|
+
import { ContextOwner } from './context';
|
|
3
|
+
import type { DeferredFuture, Future, GodContext, Handler } from './types';
|
|
4
4
|
export declare const IS_CACHE_HANDLER: "___(unique) Symbol(IS_CACHE_HANDLER)";
|
|
5
5
|
export declare function curryFuture<T>(owner: ContextOwner, inbound: Future<T>, outbound: DeferredFuture<T>): Future<T>;
|
|
6
6
|
export interface HttpErrorProps extends DOMException {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
code: number;
|
|
8
|
+
name: string;
|
|
9
|
+
status: number;
|
|
10
|
+
statusText: string;
|
|
11
|
+
isRequestError: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare function enhanceReason(reason?: string): DOMException;
|
|
14
14
|
export declare function handleOutcome<T>(owner: ContextOwner, inbound: Promise<T | StructuredDataDocument<T>>, outbound: DeferredFuture<T>): Future<T>;
|
|
15
15
|
export declare function executeNextHandler<T>(wares: Readonly<Handler[]>, request: RequestInfo, i: number, god: GodContext): Future<T>;
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/request/-private/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,sBAAsB,EAGvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAW,YAAY,EAAE,MAAM,WAAW,CAAC;AAIlD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE3E,eAAO,MAAM,gBAAgB,wCAAiE,CAAC;AAC/F,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAuC9G;AA4BD,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAE3D;AAED,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAC/C,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAC1B,MAAM,CAAC,CAAC,CAAC,CA6CX;AAMD,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,EAC1B,OAAO,EAAE,WAAW,EACpB,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,UAAU,GACd,MAAM,CAAC,CAAC,CAAC,CAmDX"}
|