@mearie/core 0.1.2 → 0.2.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/dist/index.cjs +611 -179
- package/dist/index.d.cts +117 -26
- package/dist/{index.d.ts → index.d.mts} +117 -26
- package/dist/{index.js → index.mjs} +587 -157
- package/dist/{stream-DiNE6b2z.js → make-C7I1YIXm.mjs} +52 -52
- package/dist/{stream-DXHFB0xP.cjs → make-DxW2Pxe-.cjs} +51 -51
- package/dist/stream/index.cjs +26 -25
- package/dist/stream/index.d.cts +2 -2
- package/dist/stream/{index.d.ts → index.d.mts} +2 -2
- package/dist/stream/index.mjs +3 -0
- package/package.json +3 -3
- package/dist/stream/index.js +0 -3
- /package/dist/{index-BJ3Ktp8q.d.ts → make-BhxZYW3l.d.cts} +0 -0
- /package/dist/{index-CrxalFAt.d.cts → make-Ve8TkMHJ.d.mts} +0 -0
|
@@ -8,57 +8,6 @@ function pipe(source, ...operators) {
|
|
|
8
8
|
return operators.reduce((src, operator) => operator(src), source);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/stream/operators/share.ts
|
|
13
|
-
/**
|
|
14
|
-
* Shares a single source across multiple subscribers (multicast).
|
|
15
|
-
* The source is only executed once, and all subscribers receive the same values.
|
|
16
|
-
* This is essential for deduplication and caching scenarios.
|
|
17
|
-
* @returns An operator that shares the source.
|
|
18
|
-
*/
|
|
19
|
-
const share = () => {
|
|
20
|
-
return (source) => {
|
|
21
|
-
const sinks = [];
|
|
22
|
-
let subscription = null;
|
|
23
|
-
let started = false;
|
|
24
|
-
let completed = false;
|
|
25
|
-
return (sink) => {
|
|
26
|
-
if (completed) {
|
|
27
|
-
sink.complete();
|
|
28
|
-
return { unsubscribe() {} };
|
|
29
|
-
}
|
|
30
|
-
sinks.push(sink);
|
|
31
|
-
if (!started) {
|
|
32
|
-
started = true;
|
|
33
|
-
subscription = source({
|
|
34
|
-
next(value) {
|
|
35
|
-
for (const s of [...sinks]) {
|
|
36
|
-
if (completed) break;
|
|
37
|
-
s.next(value);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
complete() {
|
|
41
|
-
if (!completed) {
|
|
42
|
-
completed = true;
|
|
43
|
-
for (const s of [...sinks]) s.complete();
|
|
44
|
-
sinks.length = 0;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return { unsubscribe() {
|
|
50
|
-
const idx = sinks.indexOf(sink);
|
|
51
|
-
if (idx !== -1) sinks.splice(idx, 1);
|
|
52
|
-
if (sinks.length === 0 && subscription) {
|
|
53
|
-
subscription.unsubscribe();
|
|
54
|
-
subscription = null;
|
|
55
|
-
started = false;
|
|
56
|
-
}
|
|
57
|
-
} };
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
11
|
//#endregion
|
|
63
12
|
//#region src/stream/operators/merge-map.ts
|
|
64
13
|
/**
|
|
@@ -476,6 +425,57 @@ const takeUntil = (notifier) => {
|
|
|
476
425
|
};
|
|
477
426
|
};
|
|
478
427
|
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/stream/operators/share.ts
|
|
430
|
+
/**
|
|
431
|
+
* Shares a single source across multiple subscribers (multicast).
|
|
432
|
+
* The source is only executed once, and all subscribers receive the same values.
|
|
433
|
+
* This is essential for deduplication and caching scenarios.
|
|
434
|
+
* @returns An operator that shares the source.
|
|
435
|
+
*/
|
|
436
|
+
const share = () => {
|
|
437
|
+
return (source) => {
|
|
438
|
+
const sinks = [];
|
|
439
|
+
let subscription = null;
|
|
440
|
+
let started = false;
|
|
441
|
+
let completed = false;
|
|
442
|
+
return (sink) => {
|
|
443
|
+
if (completed) {
|
|
444
|
+
sink.complete();
|
|
445
|
+
return { unsubscribe() {} };
|
|
446
|
+
}
|
|
447
|
+
sinks.push(sink);
|
|
448
|
+
if (!started) {
|
|
449
|
+
started = true;
|
|
450
|
+
subscription = source({
|
|
451
|
+
next(value) {
|
|
452
|
+
for (const s of [...sinks]) {
|
|
453
|
+
if (completed) break;
|
|
454
|
+
s.next(value);
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
complete() {
|
|
458
|
+
if (!completed) {
|
|
459
|
+
completed = true;
|
|
460
|
+
for (const s of [...sinks]) s.complete();
|
|
461
|
+
sinks.length = 0;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
return { unsubscribe() {
|
|
467
|
+
const idx = sinks.indexOf(sink);
|
|
468
|
+
if (idx !== -1) sinks.splice(idx, 1);
|
|
469
|
+
if (sinks.length === 0 && subscription) {
|
|
470
|
+
subscription.unsubscribe();
|
|
471
|
+
subscription = null;
|
|
472
|
+
started = false;
|
|
473
|
+
}
|
|
474
|
+
} };
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region src/stream/operators/switch-map.ts
|
|
481
481
|
const switchMap = (fn) => {
|
|
@@ -709,4 +709,4 @@ const make = (subscriber) => {
|
|
|
709
709
|
};
|
|
710
710
|
|
|
711
711
|
//#endregion
|
|
712
|
-
export {
|
|
712
|
+
export { mergeMap as C, filter as S, compose as _, finalize as a, merge as b, share as c, map as d, peek as f, subscribe as g, publish as h, fromValue as i, takeUntil as l, collect as m, fromSubscription as n, initialize as o, collectAll as p, makeSubject as r, switchMap as s, make as t, take as u, fromArray as v, pipe as w, fromPromise as x, tap as y };
|
|
@@ -9,57 +9,6 @@ function pipe(source, ...operators) {
|
|
|
9
9
|
return operators.reduce((src, operator) => operator(src), source);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/stream/operators/share.ts
|
|
14
|
-
/**
|
|
15
|
-
* Shares a single source across multiple subscribers (multicast).
|
|
16
|
-
* The source is only executed once, and all subscribers receive the same values.
|
|
17
|
-
* This is essential for deduplication and caching scenarios.
|
|
18
|
-
* @returns An operator that shares the source.
|
|
19
|
-
*/
|
|
20
|
-
const share = () => {
|
|
21
|
-
return (source) => {
|
|
22
|
-
const sinks = [];
|
|
23
|
-
let subscription = null;
|
|
24
|
-
let started = false;
|
|
25
|
-
let completed = false;
|
|
26
|
-
return (sink) => {
|
|
27
|
-
if (completed) {
|
|
28
|
-
sink.complete();
|
|
29
|
-
return { unsubscribe() {} };
|
|
30
|
-
}
|
|
31
|
-
sinks.push(sink);
|
|
32
|
-
if (!started) {
|
|
33
|
-
started = true;
|
|
34
|
-
subscription = source({
|
|
35
|
-
next(value) {
|
|
36
|
-
for (const s of [...sinks]) {
|
|
37
|
-
if (completed) break;
|
|
38
|
-
s.next(value);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
complete() {
|
|
42
|
-
if (!completed) {
|
|
43
|
-
completed = true;
|
|
44
|
-
for (const s of [...sinks]) s.complete();
|
|
45
|
-
sinks.length = 0;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return { unsubscribe() {
|
|
51
|
-
const idx = sinks.indexOf(sink);
|
|
52
|
-
if (idx !== -1) sinks.splice(idx, 1);
|
|
53
|
-
if (sinks.length === 0 && subscription) {
|
|
54
|
-
subscription.unsubscribe();
|
|
55
|
-
subscription = null;
|
|
56
|
-
started = false;
|
|
57
|
-
}
|
|
58
|
-
} };
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
12
|
//#endregion
|
|
64
13
|
//#region src/stream/operators/merge-map.ts
|
|
65
14
|
/**
|
|
@@ -477,6 +426,57 @@ const takeUntil = (notifier) => {
|
|
|
477
426
|
};
|
|
478
427
|
};
|
|
479
428
|
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/stream/operators/share.ts
|
|
431
|
+
/**
|
|
432
|
+
* Shares a single source across multiple subscribers (multicast).
|
|
433
|
+
* The source is only executed once, and all subscribers receive the same values.
|
|
434
|
+
* This is essential for deduplication and caching scenarios.
|
|
435
|
+
* @returns An operator that shares the source.
|
|
436
|
+
*/
|
|
437
|
+
const share = () => {
|
|
438
|
+
return (source) => {
|
|
439
|
+
const sinks = [];
|
|
440
|
+
let subscription = null;
|
|
441
|
+
let started = false;
|
|
442
|
+
let completed = false;
|
|
443
|
+
return (sink) => {
|
|
444
|
+
if (completed) {
|
|
445
|
+
sink.complete();
|
|
446
|
+
return { unsubscribe() {} };
|
|
447
|
+
}
|
|
448
|
+
sinks.push(sink);
|
|
449
|
+
if (!started) {
|
|
450
|
+
started = true;
|
|
451
|
+
subscription = source({
|
|
452
|
+
next(value) {
|
|
453
|
+
for (const s of [...sinks]) {
|
|
454
|
+
if (completed) break;
|
|
455
|
+
s.next(value);
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
complete() {
|
|
459
|
+
if (!completed) {
|
|
460
|
+
completed = true;
|
|
461
|
+
for (const s of [...sinks]) s.complete();
|
|
462
|
+
sinks.length = 0;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
return { unsubscribe() {
|
|
468
|
+
const idx = sinks.indexOf(sink);
|
|
469
|
+
if (idx !== -1) sinks.splice(idx, 1);
|
|
470
|
+
if (sinks.length === 0 && subscription) {
|
|
471
|
+
subscription.unsubscribe();
|
|
472
|
+
subscription = null;
|
|
473
|
+
started = false;
|
|
474
|
+
}
|
|
475
|
+
} };
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
|
|
480
480
|
//#endregion
|
|
481
481
|
//#region src/stream/operators/switch-map.ts
|
|
482
482
|
const switchMap = (fn) => {
|
package/dist/stream/index.cjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_make = require('../make-DxW2Pxe-.cjs');
|
|
2
3
|
|
|
3
|
-
exports.collect =
|
|
4
|
-
exports.collectAll =
|
|
5
|
-
exports.compose =
|
|
6
|
-
exports.filter =
|
|
7
|
-
exports.finalize =
|
|
8
|
-
exports.fromArray =
|
|
9
|
-
exports.fromPromise =
|
|
10
|
-
exports.fromSubscription =
|
|
11
|
-
exports.fromValue =
|
|
12
|
-
exports.initialize =
|
|
13
|
-
exports.make =
|
|
14
|
-
exports.makeSubject =
|
|
15
|
-
exports.map =
|
|
16
|
-
exports.merge =
|
|
17
|
-
exports.mergeMap =
|
|
18
|
-
exports.peek =
|
|
19
|
-
exports.pipe =
|
|
20
|
-
exports.publish =
|
|
21
|
-
exports.share =
|
|
22
|
-
exports.subscribe =
|
|
23
|
-
exports.switchMap =
|
|
24
|
-
exports.take =
|
|
25
|
-
exports.takeUntil =
|
|
26
|
-
exports.tap =
|
|
4
|
+
exports.collect = require_make.collect;
|
|
5
|
+
exports.collectAll = require_make.collectAll;
|
|
6
|
+
exports.compose = require_make.compose;
|
|
7
|
+
exports.filter = require_make.filter;
|
|
8
|
+
exports.finalize = require_make.finalize;
|
|
9
|
+
exports.fromArray = require_make.fromArray;
|
|
10
|
+
exports.fromPromise = require_make.fromPromise;
|
|
11
|
+
exports.fromSubscription = require_make.fromSubscription;
|
|
12
|
+
exports.fromValue = require_make.fromValue;
|
|
13
|
+
exports.initialize = require_make.initialize;
|
|
14
|
+
exports.make = require_make.make;
|
|
15
|
+
exports.makeSubject = require_make.makeSubject;
|
|
16
|
+
exports.map = require_make.map;
|
|
17
|
+
exports.merge = require_make.merge;
|
|
18
|
+
exports.mergeMap = require_make.mergeMap;
|
|
19
|
+
exports.peek = require_make.peek;
|
|
20
|
+
exports.pipe = require_make.pipe;
|
|
21
|
+
exports.publish = require_make.publish;
|
|
22
|
+
exports.share = require_make.share;
|
|
23
|
+
exports.subscribe = require_make.subscribe;
|
|
24
|
+
exports.switchMap = require_make.switchMap;
|
|
25
|
+
exports.take = require_make.take;
|
|
26
|
+
exports.takeUntil = require_make.takeUntil;
|
|
27
|
+
exports.tap = require_make.tap;
|
package/dist/stream/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as Subscription, C as Observer, D as Operator, E as pipe, O as Sink, S as publish, T as compose, _ as filter, a as makeSubject, b as collectAll, c as finalize, d as switchMap, f as mergeMap, g as take, h as takeUntil, i as Subject, k as Source, l as initialize, m as share, n as fromPromise, o as fromArray, p as merge, r as fromSubscription, s as fromValue, t as make, u as tap, v as map, w as subscribe, x as collect, y as peek } from "../
|
|
2
|
-
export { Observer, Operator, Sink, Source, Subject, Subscription, collect, collectAll, compose, filter, finalize, fromArray, fromPromise, fromSubscription, fromValue, initialize, make, makeSubject, map, merge, mergeMap, peek, pipe, publish, share, subscribe, switchMap, take, takeUntil, tap };
|
|
1
|
+
import { A as Subscription, C as Observer, D as Operator, E as pipe, O as Sink, S as publish, T as compose, _ as filter, a as makeSubject, b as collectAll, c as finalize, d as switchMap, f as mergeMap, g as take, h as takeUntil, i as Subject, k as Source, l as initialize, m as share, n as fromPromise, o as fromArray, p as merge, r as fromSubscription, s as fromValue, t as make, u as tap, v as map, w as subscribe, x as collect, y as peek } from "../make-BhxZYW3l.cjs";
|
|
2
|
+
export { type Observer, type Operator, type Sink, type Source, type Subject, type Subscription, collect, collectAll, compose, filter, finalize, fromArray, fromPromise, fromSubscription, fromValue, initialize, make, makeSubject, map, merge, mergeMap, peek, pipe, publish, share, subscribe, switchMap, take, takeUntil, tap };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as Subscription, C as Observer, D as Operator, E as pipe, O as Sink, S as publish, T as compose, _ as filter, a as makeSubject, b as collectAll, c as finalize, d as switchMap, f as mergeMap, g as take, h as takeUntil, i as Subject, k as Source, l as initialize, m as share, n as fromPromise, o as fromArray, p as merge, r as fromSubscription, s as fromValue, t as make, u as tap, v as map, w as subscribe, x as collect, y as peek } from "../
|
|
2
|
-
export { Observer, Operator, Sink, Source, Subject, Subscription, collect, collectAll, compose, filter, finalize, fromArray, fromPromise, fromSubscription, fromValue, initialize, make, makeSubject, map, merge, mergeMap, peek, pipe, publish, share, subscribe, switchMap, take, takeUntil, tap };
|
|
1
|
+
import { A as Subscription, C as Observer, D as Operator, E as pipe, O as Sink, S as publish, T as compose, _ as filter, a as makeSubject, b as collectAll, c as finalize, d as switchMap, f as mergeMap, g as take, h as takeUntil, i as Subject, k as Source, l as initialize, m as share, n as fromPromise, o as fromArray, p as merge, r as fromSubscription, s as fromValue, t as make, u as tap, v as map, w as subscribe, x as collect, y as peek } from "../make-Ve8TkMHJ.mjs";
|
|
2
|
+
export { type Observer, type Operator, type Sink, type Source, type Subject, type Subscription, collect, collectAll, compose, filter, finalize, fromArray, fromPromise, fromSubscription, fromValue, initialize, make, makeSubject, map, merge, mergeMap, peek, pipe, publish, share, subscribe, switchMap, take, takeUntil, tap };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { C as mergeMap, S as filter, _ as compose, a as finalize, b as merge, c as share, d as map, f as peek, g as subscribe, h as publish, i as fromValue, l as takeUntil, m as collect, n as fromSubscription, o as initialize, p as collectAll, r as makeSubject, s as switchMap, t as make, u as take, v as fromArray, w as pipe, x as fromPromise, y as tap } from "../make-C7I1YIXm.mjs";
|
|
2
|
+
|
|
3
|
+
export { collect, collectAll, compose, filter, finalize, fromArray, fromPromise, fromSubscription, fromValue, initialize, make, makeSubject, map, merge, mergeMap, peek, pipe, publish, share, subscribe, switchMap, take, takeUntil, tap };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearie/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Type-safe, zero-overhead GraphQL client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"README.md"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@mearie/shared": "0.
|
|
48
|
+
"@mearie/shared": "0.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"tsdown": "^0.
|
|
51
|
+
"tsdown": "^0.20.3",
|
|
52
52
|
"typescript": "^5.9.3"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
package/dist/stream/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { C as share, S as mergeMap, _ as fromArray, a as finalize, b as fromPromise, c as takeUntil, d as peek, f as collectAll, g as compose, h as subscribe, i as fromValue, l as take, m as publish, n as fromSubscription, o as initialize, p as collect, r as makeSubject, s as switchMap, t as make, u as map, v as tap, w as pipe, x as filter, y as merge } from "../stream-DiNE6b2z.js";
|
|
2
|
-
|
|
3
|
-
export { collect, collectAll, compose, filter, finalize, fromArray, fromPromise, fromSubscription, fromValue, initialize, make, makeSubject, map, merge, mergeMap, peek, pipe, publish, share, subscribe, switchMap, take, takeUntil, tap };
|
|
File without changes
|
|
File without changes
|