@angular-helpers/worker-http 21.2.2 → 21.2.3
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 +5 -5
- package/fesm2022/angular-helpers-worker-http-backend.mjs +6 -6
- package/fesm2022/angular-helpers-worker-http-interceptors.mjs +2 -0
- package/fesm2022/angular-helpers-worker-http-serializer.mjs +5 -7
- package/fesm2022/angular-helpers-worker-http-transport.mjs +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ ng add @angular-helpers/worker-http --installEsbuildPlugin=true
|
|
|
75
75
|
### Manual installation
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
|
|
78
|
+
pnpm add @angular-helpers/worker-http
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
Then follow the setup in the `/backend` section below.
|
|
@@ -320,7 +320,7 @@ import { structuredCloneSerializer } from '@angular-helpers/worker-http/serializ
|
|
|
320
320
|
|
|
321
321
|
#### `createSerovalSerializer()` — Full type fidelity
|
|
322
322
|
|
|
323
|
-
Requires `seroval` as an optional peer dependency (`
|
|
323
|
+
Requires `seroval` as an optional peer dependency (`pnpm add seroval`).
|
|
324
324
|
|
|
325
325
|
Supports: `Date`, `Map`, `Set`, `BigInt`, `RegExp`, circular references, and more.
|
|
326
326
|
|
|
@@ -338,7 +338,7 @@ const original = serializer.deserialize(payload);
|
|
|
338
338
|
|
|
339
339
|
#### `createToonSerializer()` — Token-Oriented Object Notation
|
|
340
340
|
|
|
341
|
-
Requires `@toon-format/toon` as an optional peer dependency (`
|
|
341
|
+
Requires `@toon-format/toon` as an optional peer dependency (`pnpm add @toon-format/toon`).
|
|
342
342
|
|
|
343
343
|
[TOON](https://toonformat.dev) declares object keys once and emits values as CSV-like rows. For uniform arrays of objects (the most common API response shape — `User[]`, `Product[]`, paginated lists), it cuts payload size by **30–60%** compared to JSON, with negligible parsing overhead.
|
|
344
344
|
|
|
@@ -821,8 +821,8 @@ generation), so the only variable being compared is **where** the work runs.
|
|
|
821
821
|
To run locally:
|
|
822
822
|
|
|
823
823
|
```bash
|
|
824
|
-
|
|
825
|
-
|
|
824
|
+
pnpm run build:workers
|
|
825
|
+
pnpm start
|
|
826
826
|
# open https://localhost:4200/demo/worker-http-benchmark
|
|
827
827
|
```
|
|
828
828
|
|
|
@@ -341,10 +341,10 @@ class WorkerHttpBackend extends HttpBackend {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
345
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
344
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: WorkerHttpBackend, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
345
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: WorkerHttpBackend });
|
|
346
346
|
}
|
|
347
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: WorkerHttpBackend, decorators: [{
|
|
348
348
|
type: Injectable
|
|
349
349
|
}] });
|
|
350
350
|
|
|
@@ -402,10 +402,10 @@ class WorkerHttpClient {
|
|
|
402
402
|
}
|
|
403
403
|
return { ...rest, context: ctx };
|
|
404
404
|
}
|
|
405
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
406
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.
|
|
405
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: WorkerHttpClient, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
406
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: WorkerHttpClient });
|
|
407
407
|
}
|
|
408
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
408
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: WorkerHttpClient, decorators: [{
|
|
409
409
|
type: Injectable
|
|
410
410
|
}] });
|
|
411
411
|
|
|
@@ -134,10 +134,12 @@ function attachPortLoop(port, chain) {
|
|
|
134
134
|
const data = event.data ?? {};
|
|
135
135
|
if (data.type === 'batch') {
|
|
136
136
|
for (const msg of data.messages || []) {
|
|
137
|
+
// oxlint-disable-next-line no-console
|
|
137
138
|
processMessage(msg).catch(console.error);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
else {
|
|
142
|
+
// oxlint-disable-next-line no-console
|
|
141
143
|
processMessage(data).catch(console.error);
|
|
142
144
|
}
|
|
143
145
|
};
|
|
@@ -22,12 +22,11 @@ let cachedSeroval = null;
|
|
|
22
22
|
async function loadSeroval() {
|
|
23
23
|
if (!cachedSeroval) {
|
|
24
24
|
try {
|
|
25
|
-
// Dynamic import
|
|
26
|
-
|
|
27
|
-
cachedSeroval = (await import(/* @vite-ignore */ id));
|
|
25
|
+
// Dynamic import — allows seroval to be an optional peer dep
|
|
26
|
+
cachedSeroval = (await import('seroval'));
|
|
28
27
|
}
|
|
29
28
|
catch {
|
|
30
|
-
throw new Error('seroval is required
|
|
29
|
+
throw new Error('seroval is required to serialize complex types (Date, Map, Set, RegExp). Install it with: npm install seroval');
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
return cachedSeroval;
|
|
@@ -75,9 +74,8 @@ let cachedToon = null;
|
|
|
75
74
|
async function loadToon() {
|
|
76
75
|
if (!cachedToon) {
|
|
77
76
|
try {
|
|
78
|
-
// Dynamic import
|
|
79
|
-
|
|
80
|
-
cachedToon = (await import(/* @vite-ignore */ id));
|
|
77
|
+
// Dynamic import — allows @toon-format/toon to be an optional peer dep
|
|
78
|
+
cachedToon = (await import('@toon-format/toon'));
|
|
81
79
|
}
|
|
82
80
|
catch {
|
|
83
81
|
throw new Error('@toon-format/toon is required as a peer dependency. ' +
|
|
@@ -252,6 +252,7 @@ function createWorkerTransport(config) {
|
|
|
252
252
|
}
|
|
253
253
|
if (streamsPolyfill && !polyfillLoaded) {
|
|
254
254
|
loadStreamsPolyfill().catch((err) => {
|
|
255
|
+
// oxlint-disable-next-line no-console
|
|
255
256
|
console.warn('[worker-http] Streams polyfill failed to load:', err);
|
|
256
257
|
});
|
|
257
258
|
}
|
|
@@ -356,6 +357,7 @@ function createWorkerTransport(config) {
|
|
|
356
357
|
polyfillLoaded = true;
|
|
357
358
|
}
|
|
358
359
|
catch (err) {
|
|
360
|
+
// oxlint-disable-next-line no-console
|
|
359
361
|
console.warn('[worker-http] Failed to load streams polyfill:', err);
|
|
360
362
|
}
|
|
361
363
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-helpers/worker-http",
|
|
3
|
-
"version": "21.2.
|
|
3
|
+
"version": "21.2.3",
|
|
4
4
|
"description": "Angular HTTP over Web Workers — off-main-thread HTTP pipelines with configurable interceptors, WebCrypto security, and pluggable serialization",
|
|
5
5
|
"schematics": "./schematics/collection.json",
|
|
6
6
|
"exports": {
|
|
@@ -106,4 +106,4 @@
|
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"tslib": "^2.3.0"
|
|
108
108
|
}
|
|
109
|
-
}
|
|
109
|
+
}
|