@outfoxx/sunday 2.0.0-beta.17 → 2.0.0-beta.19
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 +191 -30
- package/build/client-settings.d.ts +6 -7
- package/build/client-settings.js +58 -28
- package/build/client-settings.js.map +1 -1
- package/build/event-parser.d.ts +21 -8
- package/build/event-parser.js +93 -121
- package/build/event-parser.js.map +1 -1
- package/build/fetch-copy.d.ts +15 -0
- package/build/fetch-copy.js +70 -0
- package/build/fetch-copy.js.map +1 -0
- package/build/fetch-event-source.d.ts +6 -5
- package/build/fetch-event-source.js +168 -137
- package/build/fetch-event-source.js.map +1 -1
- package/build/fetch-oauth-token-provider.js +61 -19
- package/build/fetch-oauth-token-provider.js.map +1 -1
- package/build/fetch-transport.d.ts +14 -6
- package/build/fetch-transport.js +126 -168
- package/build/fetch-transport.js.map +1 -1
- package/build/fetch.js +5 -0
- package/build/fetch.js.map +1 -1
- package/build/index.d.ts +7 -2
- package/build/index.js +6 -2
- package/build/index.js.map +1 -1
- package/build/request-adapter.d.ts +8 -0
- package/build/{token-manager-factory.js → request-adapter.js} +1 -1
- package/build/request-adapter.js.map +1 -0
- package/build/request-adapters.d.ts +25 -8
- package/build/request-adapters.js +126 -14
- package/build/request-adapters.js.map +1 -1
- package/build/request-body.d.ts +24 -0
- package/build/request-body.js +104 -0
- package/build/request-body.js.map +1 -0
- package/build/request-cancellation-error.d.ts +13 -0
- package/build/request-cancellation-error.js +43 -0
- package/build/request-cancellation-error.js.map +1 -0
- package/build/request-execution.d.ts +18 -0
- package/build/request-execution.js +108 -0
- package/build/request-execution.js.map +1 -0
- package/build/request-security.d.ts +9 -3
- package/build/request-security.js +101 -36
- package/build/request-security.js.map +1 -1
- package/build/response-adapter.d.ts +10 -0
- package/build/response-adapter.js +15 -0
- package/build/response-adapter.js.map +1 -0
- package/build/response-adapters.d.ts +13 -0
- package/build/response-adapters.js +75 -0
- package/build/response-adapters.js.map +1 -0
- package/build/token-manager.d.ts +13 -4
- package/build/token-manager.js +110 -33
- package/build/token-manager.js.map +1 -1
- package/build/token-provider.d.ts +8 -1
- package/build/token-provider.js +71 -0
- package/build/token-provider.js.map +1 -1
- package/build/transport.d.ts +3 -3
- package/build/util/abort.d.ts +3 -0
- package/build/util/abort.js +42 -0
- package/build/util/abort.js.map +1 -0
- package/build/util/native-fetch.d.ts +2 -0
- package/build/util/native-fetch.js +39 -0
- package/build/util/native-fetch.js.map +1 -0
- package/build/util/owned-body.d.ts +12 -0
- package/build/util/owned-body.js +243 -0
- package/build/util/owned-body.js.map +1 -0
- package/package.json +9 -6
- package/build/token-manager-factory.d.ts +0 -9
- package/build/token-manager-factory.js.map +0 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { withAbort } from './abort.js';
|
|
15
|
+
const bodies = new WeakMap();
|
|
16
|
+
/** @internal Owns only application streams, preserving byte-stream capability and backpressure. */
|
|
17
|
+
export function ownBody(source, signal) {
|
|
18
|
+
const existing = bodies.get(source)?.owner;
|
|
19
|
+
if (existing) {
|
|
20
|
+
existing.observe(signal);
|
|
21
|
+
return source;
|
|
22
|
+
}
|
|
23
|
+
const owner = new BodyOwner(source);
|
|
24
|
+
bodies.set(owner.stream, { source: owner.stream, owner });
|
|
25
|
+
owner.observe(signal);
|
|
26
|
+
return owner.stream;
|
|
27
|
+
}
|
|
28
|
+
/** @internal Transfers body metadata and retires unused native branches without consuming the active body. */
|
|
29
|
+
export function inheritBody(source, target, previousBody) {
|
|
30
|
+
if (source && target.body) {
|
|
31
|
+
const reference = bodies.get(source) ?? { source };
|
|
32
|
+
// Bun leaves a new tee branch on the input. Ownership has transferred, so retire that
|
|
33
|
+
// unused branch immediately to prevent buffering and to let later cancellation reach the source.
|
|
34
|
+
if (previousBody && previousBody !== source && previousBody !== target.body)
|
|
35
|
+
void cancelStream(previousBody);
|
|
36
|
+
bodies.set(target.body, reference);
|
|
37
|
+
if (target instanceof Request)
|
|
38
|
+
reference.owner?.observe(target.signal);
|
|
39
|
+
}
|
|
40
|
+
bodyReads(target);
|
|
41
|
+
}
|
|
42
|
+
/** @internal Recognizes constructor-transferred bodies even when a runtime creates a new stream handle. */
|
|
43
|
+
export function sameBody(left, right) {
|
|
44
|
+
return (left === right ||
|
|
45
|
+
!!(left &&
|
|
46
|
+
right &&
|
|
47
|
+
(bodies.get(left)?.source ?? left) ===
|
|
48
|
+
(bodies.get(right)?.source ?? right)));
|
|
49
|
+
}
|
|
50
|
+
/** @internal Restores errors only at a native read/fetch boundary, never around application callbacks. */
|
|
51
|
+
export async function nativeBodyOperation(body, action) {
|
|
52
|
+
const owner = body && bodies.get(body)?.owner;
|
|
53
|
+
try {
|
|
54
|
+
// Start the native operation immediately to retain synchronous bodyUsed/locking behavior.
|
|
55
|
+
const operation = action();
|
|
56
|
+
// A stop can win before withAbort invokes its callback; observe the native result regardless.
|
|
57
|
+
void operation.catch(() => undefined);
|
|
58
|
+
// WebKit can leave an in-flight native bulk read pending after its stream errors.
|
|
59
|
+
return await (owner && !owner.failure.signal.aborted
|
|
60
|
+
? withAbort(() => operation, owner.failure.signal)
|
|
61
|
+
: operation);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw owner?.failure.signal.aborted
|
|
65
|
+
? owner.failure.signal.reason.error
|
|
66
|
+
: error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** @internal Gives native bulk reads exact source errors and request reads cooperative cancellation. */
|
|
70
|
+
export function bodyReads(value) {
|
|
71
|
+
if (!value.body)
|
|
72
|
+
return;
|
|
73
|
+
const request = value instanceof Request;
|
|
74
|
+
if (!request && !bodies.get(value.body)?.owner)
|
|
75
|
+
return;
|
|
76
|
+
const prototype = request ? Request.prototype : Response.prototype;
|
|
77
|
+
for (const name of [
|
|
78
|
+
'arrayBuffer',
|
|
79
|
+
'blob',
|
|
80
|
+
'bytes',
|
|
81
|
+
'formData',
|
|
82
|
+
'json',
|
|
83
|
+
'text',
|
|
84
|
+
]) {
|
|
85
|
+
const native = prototype[name];
|
|
86
|
+
// Preserve custom overrides and avoid decorating an instance twice.
|
|
87
|
+
if (!native || value[name] !== native)
|
|
88
|
+
continue;
|
|
89
|
+
Object.defineProperty(value, name, {
|
|
90
|
+
configurable: true,
|
|
91
|
+
writable: true,
|
|
92
|
+
value: async function () {
|
|
93
|
+
if (this !== value || this.bodyUsed || !this.body || this.body.locked)
|
|
94
|
+
return native.call(this);
|
|
95
|
+
if (this instanceof Request && !bodies.get(this.body)?.owner) {
|
|
96
|
+
// Defer ownership until the adapter actually reads. Unread Blob/string requests keep
|
|
97
|
+
// their native replayable sources, including native redirects and follow-ups.
|
|
98
|
+
const body = ownBody(this.body, this.signal);
|
|
99
|
+
bodies.set(this.body, bodies.get(body));
|
|
100
|
+
const response = new Response(body, { headers: this.headers });
|
|
101
|
+
const read = Response.prototype[name];
|
|
102
|
+
return nativeBodyOperation(body, () => read.call(response));
|
|
103
|
+
}
|
|
104
|
+
return nativeBodyOperation(this.body, () => native.call(this));
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** @internal Disposes transferred bodies without waiting for user cleanup or replacing the original error. */
|
|
110
|
+
export function discardBody(value, reason) {
|
|
111
|
+
try {
|
|
112
|
+
const body = value.body;
|
|
113
|
+
if (!body)
|
|
114
|
+
return;
|
|
115
|
+
const reference = bodies.get(body);
|
|
116
|
+
if (reference?.owner) {
|
|
117
|
+
reference.owner.stop(reason);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
void cancelStream(body, reason);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// Custom body accessors must not replace the operation's error either.
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function cancelStream(stream, reason) {
|
|
127
|
+
try {
|
|
128
|
+
if (!stream.locked)
|
|
129
|
+
await stream.cancel(reason);
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Cleanup failures must not replace the operation's outcome.
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
class BodyOwner {
|
|
136
|
+
source;
|
|
137
|
+
stream;
|
|
138
|
+
// Wrap the original value because abort(undefined) would create a different AbortError.
|
|
139
|
+
failure = new AbortController();
|
|
140
|
+
reader;
|
|
141
|
+
controller;
|
|
142
|
+
closed = false;
|
|
143
|
+
listeners = new Map();
|
|
144
|
+
// WebKit can recreate a native Request.body wrapper if only its reader remains reachable.
|
|
145
|
+
// Keep the source handle alive so ownership lookups survive garbage collection during reads.
|
|
146
|
+
constructor(source) {
|
|
147
|
+
this.source = source;
|
|
148
|
+
// Keep the selected reader: some byte producers can only fill a supplied BYOB view.
|
|
149
|
+
let bytes = false;
|
|
150
|
+
try {
|
|
151
|
+
this.reader = this.source.getReader({ mode: 'byob' });
|
|
152
|
+
bytes = true;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (this.source.locked)
|
|
156
|
+
throw error;
|
|
157
|
+
this.reader = this.source.getReader();
|
|
158
|
+
}
|
|
159
|
+
const underlying = {
|
|
160
|
+
start: (controller) => {
|
|
161
|
+
this.controller = controller;
|
|
162
|
+
},
|
|
163
|
+
pull: () => this.pull(),
|
|
164
|
+
cancel: (reason) => this.cancel(reason),
|
|
165
|
+
};
|
|
166
|
+
// Do not read ahead on behalf of a consumer. Native Response methods still collect whole chunks.
|
|
167
|
+
this.stream = bytes
|
|
168
|
+
? new ReadableStream({ ...underlying, type: 'bytes', autoAllocateChunkSize: 64 * 1024 }, { highWaterMark: 0 })
|
|
169
|
+
: new ReadableStream(underlying, { highWaterMark: 0 });
|
|
170
|
+
}
|
|
171
|
+
observe(signal) {
|
|
172
|
+
if (!signal || this.closed || this.listeners.has(signal))
|
|
173
|
+
return;
|
|
174
|
+
if (signal.aborted) {
|
|
175
|
+
this.stop(signal.reason);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const abort = () => this.stop(signal.reason);
|
|
179
|
+
this.listeners.set(signal, abort);
|
|
180
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
181
|
+
}
|
|
182
|
+
cancel(reason) {
|
|
183
|
+
if (this.closed)
|
|
184
|
+
return;
|
|
185
|
+
// Cleanup cannot delay or replace the original failure, even if user cleanup never settles.
|
|
186
|
+
void this.reader.cancel(reason).catch(() => undefined);
|
|
187
|
+
this.finish();
|
|
188
|
+
}
|
|
189
|
+
stop(reason) {
|
|
190
|
+
if (this.closed)
|
|
191
|
+
return;
|
|
192
|
+
this.failure.abort({ error: reason });
|
|
193
|
+
this.controller.error(reason);
|
|
194
|
+
this.cancel(reason);
|
|
195
|
+
}
|
|
196
|
+
async pull() {
|
|
197
|
+
try {
|
|
198
|
+
const byob = 'byobRequest' in this.controller
|
|
199
|
+
? this.controller.byobRequest
|
|
200
|
+
: undefined;
|
|
201
|
+
// Auto-allocation supplies a view for default/bulk consumers too. Forward the returned
|
|
202
|
+
// view because the source reader transfers its buffer, detaching the original view.
|
|
203
|
+
const result = byob
|
|
204
|
+
? await this.reader.read(byob.view)
|
|
205
|
+
: await this.reader.read();
|
|
206
|
+
if (this.closed)
|
|
207
|
+
return;
|
|
208
|
+
if (result.done) {
|
|
209
|
+
this.controller.close();
|
|
210
|
+
if (byob)
|
|
211
|
+
byob.respondWithNewView(result.value);
|
|
212
|
+
this.finish();
|
|
213
|
+
}
|
|
214
|
+
else if (byob) {
|
|
215
|
+
byob.respondWithNewView(result.value);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
this.controller.enqueue(result.value);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
if (this.closed)
|
|
223
|
+
return;
|
|
224
|
+
this.failure.abort({ error });
|
|
225
|
+
this.controller.error(error);
|
|
226
|
+
this.finish();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
finish() {
|
|
230
|
+
this.closed = true;
|
|
231
|
+
for (const [signal, listener] of this.listeners)
|
|
232
|
+
signal.removeEventListener('abort', listener);
|
|
233
|
+
this.listeners.clear();
|
|
234
|
+
try {
|
|
235
|
+
this.reader.releaseLock();
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
// Bun leaves pending BYOB reads unsettled after cancel(), and refuses lock release.
|
|
239
|
+
// The output is already terminated; native cleanup must not replace that outcome.
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=owned-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned-body.js","sourceRoot":"","sources":["../../src/util/owned-body.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAOvC,MAAM,MAAM,GAAG,IAAI,OAAO,EAA6C,CAAC;AAExE,mGAAmG;AACnG,MAAM,UAAU,OAAO,CACrB,MAAkC,EAClC,MAAoB;IAEpB,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,CAA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 The framework of REST for TypeScript/JavaScript",
|
|
5
|
-
"packageManager": "bun@1.
|
|
5
|
+
"packageManager": "bun@1.4.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "build/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"./oauth-wire": null
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=22"
|
|
21
|
+
"node": ">=22",
|
|
22
|
+
"bun": ">=1.4.0"
|
|
22
23
|
},
|
|
23
24
|
"files": [
|
|
24
25
|
"build",
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"typecheck": "tsc -p tsconfig.build.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
32
33
|
"build": "tsc -p tsconfig.build.json",
|
|
33
34
|
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
34
|
-
"check": "bun run lint && bun run typecheck && bun run test && bun run build",
|
|
35
|
+
"check": "bun run lint && bun run typecheck && bun run test && bun run build && bun run smoke:adapters:node && bun run smoke:adapters:bun",
|
|
35
36
|
"clean": "rimraf build docs reports",
|
|
36
37
|
"pretty": "prettier src test",
|
|
37
38
|
"lint": "mkdir -p reports && eslint -f json -o reports/lint.json src test",
|
|
@@ -41,7 +42,9 @@
|
|
|
41
42
|
"publish:dry-run": "bun publish --dry-run",
|
|
42
43
|
"smoke:esm:bun": "bun ./tools/ci/esm-smoke.mjs",
|
|
43
44
|
"smoke:esm:node": "node ./tools/ci/esm-smoke.mjs",
|
|
44
|
-
"build:stub": "dts-bundle-generator --project tools/stub/tsconfig.json --no-check --out-file tools/stub/out/index.d.ts tools/stub/index.ts"
|
|
45
|
+
"build:stub": "dts-bundle-generator --project tools/stub/tsconfig.json --no-check --out-file tools/stub/out/index.d.ts tools/stub/index.ts",
|
|
46
|
+
"smoke:adapters:node": "node ./tools/ci/adapters-smoke.mjs",
|
|
47
|
+
"smoke:adapters:bun": "bun ./tools/ci/adapters-smoke.mjs"
|
|
45
48
|
},
|
|
46
49
|
"husky": {
|
|
47
50
|
"hooks": {
|
|
@@ -86,7 +89,7 @@
|
|
|
86
89
|
"globals": "^17.3.0",
|
|
87
90
|
"husky": "^9.1.7",
|
|
88
91
|
"lint-staged": "^16.2.7",
|
|
89
|
-
"playwright": "1.
|
|
92
|
+
"playwright": "1.65.0",
|
|
90
93
|
"prettier": "^3.8.1",
|
|
91
94
|
"pretty-quick": "^4.2.2",
|
|
92
95
|
"rimraf": "^6.1.3",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TokenManager } from './token-manager.js';
|
|
2
|
-
import { TokenProvider } from './token-provider.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a manager from resolved providers without token acquisition or storage I/O.
|
|
5
|
-
* Supply the native manager's store, expirySkewMs and now options here.
|
|
6
|
-
* Called once for secured settings and never when there are no selected providers.
|
|
7
|
-
* The application owns the returned manager and its store/session lifecycle.
|
|
8
|
-
*/
|
|
9
|
-
export type TokenManagerFactory = (providers: Readonly<Record<string, TokenProvider>>) => TokenManager;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-manager-factory.js","sourceRoot":"","sources":["../src/token-manager-factory.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC"}
|