reactor-core-ts 3.2.1 → 3.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.
Files changed (34) hide show
  1. package/LICENSE.md +56 -0
  2. package/README.md +5 -0
  3. package/dist/core/demand.js +2 -2
  4. package/dist/core/demand.js.map +1 -1
  5. package/dist/internal/deep-value.d.ts +9 -0
  6. package/dist/internal/deep-value.d.ts.map +1 -0
  7. package/dist/internal/deep-value.js +159 -0
  8. package/dist/internal/deep-value.js.map +1 -0
  9. package/dist/internal/iterable-transform.d.ts +8 -1
  10. package/dist/internal/iterable-transform.d.ts.map +1 -1
  11. package/dist/internal/iterable-transform.js +7 -5
  12. package/dist/internal/iterable-transform.js.map +1 -1
  13. package/dist/publisher/flux.d.ts.map +1 -1
  14. package/dist/publisher/flux.js +92 -22
  15. package/dist/publisher/flux.js.map +1 -1
  16. package/dist/publisher/operators/lifecycle.d.ts.map +1 -1
  17. package/dist/publisher/operators/lifecycle.js +29 -3
  18. package/dist/publisher/operators/lifecycle.js.map +1 -1
  19. package/dist/publisher/operators/lift.d.ts +42 -0
  20. package/dist/publisher/operators/lift.d.ts.map +1 -0
  21. package/dist/publisher/operators/lift.js +343 -0
  22. package/dist/publisher/operators/lift.js.map +1 -0
  23. package/dist/publisher/operators/selection.d.ts +5 -0
  24. package/dist/publisher/operators/selection.d.ts.map +1 -1
  25. package/dist/publisher/operators/selection.js +8 -0
  26. package/dist/publisher/operators/selection.js.map +1 -1
  27. package/dist/publisher/operators/side-effect.d.ts.map +1 -1
  28. package/dist/publisher/operators/side-effect.js +34 -9
  29. package/dist/publisher/operators/side-effect.js.map +1 -1
  30. package/dist/publisher/operators/transform.d.ts.map +1 -1
  31. package/dist/publisher/operators/transform.js +3 -2
  32. package/dist/publisher/operators/transform.js.map +1 -1
  33. package/dist/subscription/iterable-subscription.js +1 -1
  34. package/package.json +2 -1
package/LICENSE.md ADDED
@@ -0,0 +1,56 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+
6
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7
+
8
+ This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
9
+
10
+ 0. Additional Definitions.
11
+ As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
12
+
13
+ “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
14
+
15
+ An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
16
+
17
+ A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
18
+
19
+ The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
20
+
21
+ The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
22
+
23
+ 1. Exception to Section 3 of the GNU GPL.
24
+ You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
25
+
26
+ 2. Conveying Modified Versions.
27
+ If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
28
+
29
+ a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
30
+ b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
31
+ 3. Object Code Incorporating Material from Library Header Files.
32
+ The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
33
+
34
+ a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
35
+ b) Accompany the object code with a copy of the GNU GPL and this license document.
36
+ 4. Combined Works.
37
+ You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
38
+
39
+ a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
40
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
41
+ c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
42
+ d) Do one of the following:
43
+ 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
44
+ 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
45
+ e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
46
+ 5. Combined Libraries.
47
+ You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
48
+
49
+ a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
50
+ b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
51
+ 6. Revised Versions of the GNU Lesser General Public License.
52
+ The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
53
+
54
+ Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
55
+
56
+ If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
package/README.md CHANGED
@@ -442,6 +442,7 @@ Every row below includes a minimal example.
442
442
  | `skipUntilOther` | Drop values until another publisher signals. | `Flux.interval(100).skipUntilOther(Mono.delay(300))` |
443
443
  | `distinct` | Keep the first value for each key. | `Flux.just(1, 1, 2).distinct()` |
444
444
  | `distinctUntilChanged` | Drop only adjacent duplicates. | `Flux.just(1, 1, 2, 1).distinctUntilChanged()` |
445
+ | `distinctUntilChangedDeep` | Drop adjacent values with equal nested state. | `users.distinctUntilChangedDeep()` |
445
446
  | `elementAt` | Pick a value by index. | `Flux.just("a", "b").elementAt(1)` |
446
447
  | `defaultIfEmpty` | Emit a fallback value if empty. | `Flux.empty<number>().defaultIfEmpty(0)` |
447
448
  | `switchIfEmpty` | Switch to another source if empty. | `Flux.empty<number>().switchIfEmpty(Flux.just(1))` |
@@ -452,6 +453,10 @@ Every row below includes a minimal example.
452
453
  | `transformDeferredContextual` | Transform per subscription with `Context`. | `Flux.just(1).transformDeferredContextual((f, ctx) => f.map(v => [v, ctx.get("id")]))` |
453
454
  | `hide` | Hide implementation identity. | `Flux.just(1).hide()` |
454
455
 
456
+ `distinctUntilChangedDeep` snapshots arrays, enumerable properties of ordinary
457
+ objects, and local `Date`, `RegExp`, `Map` and `Set` values. Other object types
458
+ keep identity-comparison semantics.
459
+
455
460
  ### Flux Flattening And Combining Methods
456
461
 
457
462
  | Method | What it does and why | Example |
@@ -5,8 +5,8 @@
5
5
  */
6
6
  /** Validates and normalizes a Reactive Streams request amount. */
7
7
  function normalizeRequest(n) {
8
- if (!Number.isFinite(n)) return Number.POSITIVE_INFINITY;
9
- if (!Number.isInteger(n) || n <= 0) throw new RangeError("request amount must be a strictly positive integer");
8
+ if (n === Number.POSITIVE_INFINITY) return Number.POSITIVE_INFINITY;
9
+ if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) throw new RangeError("request amount must be a strictly positive integer");
10
10
  return n;
11
11
  }
12
12
  /** Adds demand values with saturation at positive infinity. */
@@ -1 +1 @@
1
- {"version":3,"file":"demand.js","names":[],"sources":["../../src/core/demand.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Reactive Streams core contracts and disposable helpers.\n */\n/** Validates and normalizes a Reactive Streams request amount. */\nexport function normalizeRequest(n: number): number {\n if (!Number.isFinite(n)) {\n return Number.POSITIVE_INFINITY;\n }\n if (!Number.isInteger(n) || n <= 0) {\n throw new RangeError(\"request amount must be a strictly positive integer\");\n }\n return n;\n}\n\n/** Adds demand values with saturation at positive infinity. */\nexport function addCap(a: number, b: number): number {\n if (a === Number.POSITIVE_INFINITY || b === Number.POSITIVE_INFINITY) {\n return Number.POSITIVE_INFINITY;\n }\n const next = a + b;\n return next >= Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : next;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,iBAAiB,GAAmB;CAChD,IAAI,CAAC,OAAO,SAAS,CAAC,GAClB,OAAO,OAAO;CAElB,IAAI,CAAC,OAAO,UAAU,CAAC,KAAK,KAAK,GAC7B,MAAM,IAAI,WAAW,oDAAoD;CAE7E,OAAO;AACX;;AAGA,SAAgB,OAAO,GAAW,GAAmB;CACjD,IAAI,MAAM,OAAO,qBAAqB,MAAM,OAAO,mBAC/C,OAAO,OAAO;CAElB,MAAM,OAAO,IAAI;CACjB,OAAO,QAAQ,OAAO,mBAAmB,OAAO,oBAAoB;AACxE"}
1
+ {"version":3,"file":"demand.js","names":[],"sources":["../../src/core/demand.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Reactive Streams core contracts and disposable helpers.\n */\n/** Validates and normalizes a Reactive Streams request amount. */\nexport function normalizeRequest(n: number): number {\n if (n === Number.POSITIVE_INFINITY) {\n return Number.POSITIVE_INFINITY;\n }\n if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) {\n throw new RangeError(\"request amount must be a strictly positive integer\");\n }\n return n;\n}\n\n/** Adds demand values with saturation at positive infinity. */\nexport function addCap(a: number, b: number): number {\n if (a === Number.POSITIVE_INFINITY || b === Number.POSITIVE_INFINITY) {\n return Number.POSITIVE_INFINITY;\n }\n const next = a + b;\n return next >= Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : next;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,iBAAiB,GAAmB;CAChD,IAAI,MAAM,OAAO,mBACb,OAAO,OAAO;CAElB,IAAI,CAAC,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,KAAK,KAAK,GACpD,MAAM,IAAI,WAAW,oDAAoD;CAE7E,OAAO;AACX;;AAGA,SAAgB,OAAO,GAAW,GAAmB;CACjD,IAAI,MAAM,OAAO,qBAAqB,MAAM,OAAO,mBAC/C,OAAO,OAAO;CAElB,MAAM,OAAO,IAAI;CACjB,OAAO,QAAQ,OAAO,mBAAmB,OAAO,oBAAoB;AACxE"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Internal helpers for snapshotting and comparing nested JavaScript values.
4
+ */
5
+ /** Creates a detached snapshot of nested enumerable state and supported mutable value types. */
6
+ export declare function snapshotDeep(value: unknown): unknown;
7
+ /** Compares nested enumerable state, supported mutable values, cycles and shared references. */
8
+ export declare function deepEqual(left: unknown, right: unknown): boolean;
9
+ //# sourceMappingURL=deep-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-value.d.ts","sourceRoot":"","sources":["../../src/internal/deep-value.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,gGAAgG;AAChG,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAkEpD;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAyEhE"}
@@ -0,0 +1,159 @@
1
+ //#region src/internal/deep-value.ts
2
+ /** Retains reliable kind metadata for snapshots whose prototypes may contain stateful getters. */
3
+ var SNAPSHOT_KINDS = /* @__PURE__ */ new WeakMap();
4
+ /** Creates a detached snapshot of nested enumerable state and supported mutable value types. */
5
+ function snapshotDeep(value) {
6
+ const snapshots = /* @__PURE__ */ new Map();
7
+ function snapshotValue(current) {
8
+ if (!isObject(current) || typeof current === "function") return current;
9
+ if (snapshots.has(current)) return snapshots.get(current);
10
+ const kind = valueKind(current);
11
+ let snapshot;
12
+ switch (kind) {
13
+ case "array":
14
+ snapshot = new Array(current.length);
15
+ break;
16
+ case "date":
17
+ snapshot = new Date(current.getTime());
18
+ break;
19
+ case "regexp": {
20
+ const source = current;
21
+ const regexp = new RegExp(source.source, source.flags);
22
+ regexp.lastIndex = source.lastIndex;
23
+ snapshot = regexp;
24
+ break;
25
+ }
26
+ case "map":
27
+ snapshot = /* @__PURE__ */ new Map();
28
+ break;
29
+ case "set":
30
+ snapshot = /* @__PURE__ */ new Set();
31
+ break;
32
+ case "record":
33
+ snapshot = Object.create(Object.getPrototypeOf(current));
34
+ break;
35
+ case "opaque": return current;
36
+ }
37
+ if (kind === "array") Object.setPrototypeOf(snapshot, Object.getPrototypeOf(current));
38
+ SNAPSHOT_KINDS.set(snapshot, kind);
39
+ snapshots.set(current, snapshot);
40
+ if (kind === "map") {
41
+ const source = current;
42
+ const target = snapshot;
43
+ for (const [key, entryValue] of source) target.set(snapshotValue(key), snapshotValue(entryValue));
44
+ } else if (kind === "set") {
45
+ const source = current;
46
+ const target = snapshot;
47
+ for (const entryValue of source) target.add(snapshotValue(entryValue));
48
+ }
49
+ copyEnumerableState(current, snapshot, snapshotValue);
50
+ return snapshot;
51
+ }
52
+ return snapshotValue(value);
53
+ }
54
+ /** Compares nested enumerable state, supported mutable values, cycles and shared references. */
55
+ function deepEqual(left, right) {
56
+ const leftToRight = /* @__PURE__ */ new Map();
57
+ const rightToLeft = /* @__PURE__ */ new Map();
58
+ function equal(leftValue, rightValue) {
59
+ if (Object.is(leftValue, rightValue)) {
60
+ if (isObject(leftValue)) {
61
+ if (leftToRight.has(leftValue) || rightToLeft.has(leftValue)) return leftToRight.get(leftValue) === leftValue && rightToLeft.get(leftValue) === leftValue;
62
+ leftToRight.set(leftValue, leftValue);
63
+ rightToLeft.set(leftValue, leftValue);
64
+ }
65
+ return true;
66
+ }
67
+ if (!isObject(leftValue) || !isObject(rightValue)) return false;
68
+ if (typeof leftValue === "function" || typeof rightValue === "function") return false;
69
+ if (Object.getPrototypeOf(leftValue) !== Object.getPrototypeOf(rightValue)) return false;
70
+ const kind = valueKind(leftValue);
71
+ if (kind === "opaque" || kind !== valueKind(rightValue)) return false;
72
+ if (leftToRight.has(leftValue) || rightToLeft.has(rightValue)) return leftToRight.get(leftValue) === rightValue && rightToLeft.get(rightValue) === leftValue;
73
+ leftToRight.set(leftValue, rightValue);
74
+ rightToLeft.set(rightValue, leftValue);
75
+ switch (kind) {
76
+ case "array":
77
+ if (leftValue.length !== rightValue.length) return false;
78
+ break;
79
+ case "date":
80
+ if (!Object.is(leftValue.getTime(), rightValue.getTime())) return false;
81
+ break;
82
+ case "regexp": {
83
+ const leftRegExp = leftValue;
84
+ const rightRegExp = rightValue;
85
+ if (leftRegExp.source !== rightRegExp.source || leftRegExp.flags !== rightRegExp.flags || leftRegExp.lastIndex !== rightRegExp.lastIndex) return false;
86
+ break;
87
+ }
88
+ case "map":
89
+ if (!equalMap(leftValue, rightValue, equal)) return false;
90
+ break;
91
+ case "set":
92
+ if (!equalSet(leftValue, rightValue, equal)) return false;
93
+ break;
94
+ case "record": break;
95
+ }
96
+ return equalEnumerableState(leftValue, rightValue, equal);
97
+ }
98
+ return equal(left, right);
99
+ }
100
+ /** Returns true for non-null object and function values. */
101
+ function isObject(value) {
102
+ return typeof value === "object" && value !== null || typeof value === "function";
103
+ }
104
+ /** Classifies values with observable state supported by the deep snapshot. */
105
+ function valueKind(value) {
106
+ const snapshotKind = SNAPSHOT_KINDS.get(value);
107
+ if (snapshotKind) return snapshotKind;
108
+ if (Array.isArray(value)) return "array";
109
+ const prototype = Object.getPrototypeOf(value);
110
+ if (value instanceof Date && prototype === Date.prototype) return "date";
111
+ if (value instanceof RegExp && prototype === RegExp.prototype) return "regexp";
112
+ if (value instanceof Map && prototype === Map.prototype) return "map";
113
+ if (value instanceof Set && prototype === Set.prototype) return "set";
114
+ return Object.prototype.toString.call(value) === "[object Object]" ? "record" : "opaque";
115
+ }
116
+ /** Copies enumerable own properties without retaining nested object references. */
117
+ function copyEnumerableState(source, target, snapshot) {
118
+ for (const key of enumerableKeys(source)) if (!Object.prototype.hasOwnProperty.call(target, key)) Object.defineProperty(target, key, {
119
+ configurable: true,
120
+ enumerable: true,
121
+ value: snapshot(Reflect.get(source, key)),
122
+ writable: true
123
+ });
124
+ }
125
+ /** Compares enumerable own properties in linear time. */
126
+ function equalEnumerableState(left, right, equal) {
127
+ const leftKeys = enumerableKeys(left);
128
+ if (leftKeys.length !== enumerableKeys(right).length) return false;
129
+ for (const key of leftKeys) if (!Object.prototype.propertyIsEnumerable.call(right, key) || !equal(Reflect.get(left, key), Reflect.get(right, key))) return false;
130
+ return true;
131
+ }
132
+ /** Lists enumerable string and symbol properties owned by a value. */
133
+ function enumerableKeys(value) {
134
+ return Reflect.ownKeys(value).filter((key) => Object.prototype.propertyIsEnumerable.call(value, key));
135
+ }
136
+ /** Compares Maps in their observable iteration order. */
137
+ function equalMap(left, right, equal) {
138
+ if (left.size !== right.size) return false;
139
+ const rightEntries = right.entries();
140
+ for (const [leftKey, leftValue] of left) {
141
+ const rightEntry = rightEntries.next();
142
+ if (rightEntry.done || !equal(leftKey, rightEntry.value[0]) || !equal(leftValue, rightEntry.value[1])) return false;
143
+ }
144
+ return true;
145
+ }
146
+ /** Compares Sets in their observable iteration order. */
147
+ function equalSet(left, right, equal) {
148
+ if (left.size !== right.size) return false;
149
+ const rightValues = right.values();
150
+ for (const leftValue of left) {
151
+ const rightValue = rightValues.next();
152
+ if (rightValue.done || !equal(leftValue, rightValue.value)) return false;
153
+ }
154
+ return true;
155
+ }
156
+ //#endregion
157
+ export { deepEqual, snapshotDeep };
158
+
159
+ //# sourceMappingURL=deep-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-value.js","names":[],"sources":["../../src/internal/deep-value.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Internal helpers for snapshotting and comparing nested JavaScript values.\n */\n\n/** Value categories whose mutable state can be captured without retaining the source object. */\ntype DeepValueKind = \"array\" | \"date\" | \"regexp\" | \"map\" | \"set\" | \"record\" | \"opaque\";\n\n/** Retains reliable kind metadata for snapshots whose prototypes may contain stateful getters. */\nconst SNAPSHOT_KINDS = new WeakMap<object, DeepValueKind>();\n\n/** Creates a detached snapshot of nested enumerable state and supported mutable value types. */\nexport function snapshotDeep(value: unknown): unknown {\n const snapshots = new Map<object, unknown>();\n\n function snapshotValue(current: unknown): unknown {\n if (!isObject(current) || typeof current === \"function\") {\n return current;\n }\n\n if (snapshots.has(current)) {\n return snapshots.get(current);\n }\n\n const kind = valueKind(current);\n let snapshot: object;\n switch (kind) {\n case \"array\":\n snapshot = new Array((current as unknown[]).length);\n break;\n case \"date\":\n snapshot = new Date((current as unknown as Date).getTime());\n break;\n case \"regexp\": {\n const source = current as unknown as RegExp;\n const regexp = new RegExp(source.source, source.flags);\n regexp.lastIndex = source.lastIndex;\n snapshot = regexp;\n break;\n }\n case \"map\":\n snapshot = new Map();\n break;\n case \"set\":\n snapshot = new Set();\n break;\n case \"record\":\n snapshot = Object.create(Object.getPrototypeOf(current)) as object;\n break;\n case \"opaque\":\n return current;\n }\n\n if (kind === \"array\") {\n Object.setPrototypeOf(snapshot, Object.getPrototypeOf(current));\n }\n SNAPSHOT_KINDS.set(snapshot, kind);\n snapshots.set(current, snapshot);\n\n if (kind === \"map\") {\n const source = current as unknown as Map<unknown, unknown>;\n const target = snapshot as Map<unknown, unknown>;\n for (const [key, entryValue] of source) {\n target.set(snapshotValue(key), snapshotValue(entryValue));\n }\n } else if (kind === \"set\") {\n const source = current as unknown as Set<unknown>;\n const target = snapshot as Set<unknown>;\n for (const entryValue of source) {\n target.add(snapshotValue(entryValue));\n }\n }\n\n copyEnumerableState(current, snapshot, snapshotValue);\n return snapshot;\n }\n\n return snapshotValue(value);\n}\n\n/** Compares nested enumerable state, supported mutable values, cycles and shared references. */\nexport function deepEqual(left: unknown, right: unknown): boolean {\n const leftToRight = new Map<object, object>();\n const rightToLeft = new Map<object, object>();\n\n function equal(leftValue: unknown, rightValue: unknown): boolean {\n if (Object.is(leftValue, rightValue)) {\n if (isObject(leftValue)) {\n if (leftToRight.has(leftValue) || rightToLeft.has(leftValue)) {\n return leftToRight.get(leftValue) === leftValue && rightToLeft.get(leftValue) === leftValue;\n }\n leftToRight.set(leftValue, leftValue);\n rightToLeft.set(leftValue, leftValue);\n }\n return true;\n }\n if (!isObject(leftValue) || !isObject(rightValue)) {\n return false;\n }\n if (typeof leftValue === \"function\" || typeof rightValue === \"function\") {\n return false;\n }\n if (Object.getPrototypeOf(leftValue) !== Object.getPrototypeOf(rightValue)) {\n return false;\n }\n\n const kind = valueKind(leftValue);\n if (kind === \"opaque\" || kind !== valueKind(rightValue)) {\n return false;\n }\n if (leftToRight.has(leftValue) || rightToLeft.has(rightValue)) {\n return leftToRight.get(leftValue) === rightValue && rightToLeft.get(rightValue) === leftValue;\n }\n leftToRight.set(leftValue, rightValue);\n rightToLeft.set(rightValue, leftValue);\n\n switch (kind) {\n case \"array\":\n if ((leftValue as unknown[]).length !== (rightValue as unknown[]).length) {\n return false;\n }\n break;\n case \"date\":\n if (!Object.is((leftValue as Date).getTime(), (rightValue as Date).getTime())) {\n return false;\n }\n break;\n case \"regexp\": {\n const leftRegExp = leftValue as RegExp;\n const rightRegExp = rightValue as RegExp;\n if (leftRegExp.source !== rightRegExp.source\n || leftRegExp.flags !== rightRegExp.flags\n || leftRegExp.lastIndex !== rightRegExp.lastIndex) {\n return false;\n }\n break;\n }\n case \"map\":\n if (!equalMap(leftValue as Map<unknown, unknown>, rightValue as Map<unknown, unknown>, equal)) {\n return false;\n }\n break;\n case \"set\":\n if (!equalSet(leftValue as Set<unknown>, rightValue as Set<unknown>, equal)) {\n return false;\n }\n break;\n case \"record\":\n break;\n }\n return equalEnumerableState(leftValue, rightValue, equal);\n }\n\n return equal(left, right);\n}\n\n/** Returns true for non-null object and function values. */\nfunction isObject(value: unknown): value is object {\n return (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n}\n\n/** Classifies values with observable state supported by the deep snapshot. */\nfunction valueKind(value: object): DeepValueKind {\n const snapshotKind = SNAPSHOT_KINDS.get(value);\n if (snapshotKind) {\n return snapshotKind;\n }\n if (Array.isArray(value)) {\n return \"array\";\n }\n const prototype = Object.getPrototypeOf(value);\n if (value instanceof Date && prototype === Date.prototype) {\n return \"date\";\n }\n if (value instanceof RegExp && prototype === RegExp.prototype) {\n return \"regexp\";\n }\n if (value instanceof Map && prototype === Map.prototype) {\n return \"map\";\n }\n if (value instanceof Set && prototype === Set.prototype) {\n return \"set\";\n }\n return Object.prototype.toString.call(value) === \"[object Object]\" ? \"record\" : \"opaque\";\n}\n\n/** Copies enumerable own properties without retaining nested object references. */\nfunction copyEnumerableState(source: object, target: object, snapshot: (value: unknown) => unknown): void {\n for (const key of enumerableKeys(source)) {\n if (!Object.prototype.hasOwnProperty.call(target, key)) {\n Object.defineProperty(target, key, {\n configurable: true,\n enumerable: true,\n value: snapshot(Reflect.get(source, key)),\n writable: true\n });\n }\n }\n}\n\n/** Compares enumerable own properties in linear time. */\nfunction equalEnumerableState(\n left: object,\n right: object,\n equal: (left: unknown, right: unknown) => boolean\n): boolean {\n const leftKeys = enumerableKeys(left);\n if (leftKeys.length !== enumerableKeys(right).length) {\n return false;\n }\n for (const key of leftKeys) {\n if (!Object.prototype.propertyIsEnumerable.call(right, key)\n || !equal(Reflect.get(left, key), Reflect.get(right, key))) {\n return false;\n }\n }\n return true;\n}\n\n/** Lists enumerable string and symbol properties owned by a value. */\nfunction enumerableKeys(value: object): PropertyKey[] {\n return Reflect.ownKeys(value).filter(key => Object.prototype.propertyIsEnumerable.call(value, key));\n}\n\n/** Compares Maps in their observable iteration order. */\nfunction equalMap(\n left: Map<unknown, unknown>,\n right: Map<unknown, unknown>,\n equal: (left: unknown, right: unknown) => boolean\n): boolean {\n if (left.size !== right.size) {\n return false;\n }\n const rightEntries = right.entries();\n for (const [leftKey, leftValue] of left) {\n const rightEntry = rightEntries.next();\n if (rightEntry.done || !equal(leftKey, rightEntry.value[0]) || !equal(leftValue, rightEntry.value[1])) {\n return false;\n }\n }\n return true;\n}\n\n/** Compares Sets in their observable iteration order. */\nfunction equalSet(\n left: Set<unknown>,\n right: Set<unknown>,\n equal: (left: unknown, right: unknown) => boolean\n): boolean {\n if (left.size !== right.size) {\n return false;\n }\n const rightValues = right.values();\n for (const leftValue of left) {\n const rightValue = rightValues.next();\n if (rightValue.done || !equal(leftValue, rightValue.value)) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";;AASA,IAAM,iCAAiB,IAAI,QAA+B;;AAG1D,SAAgB,aAAa,OAAyB;CAClD,MAAM,4BAAY,IAAI,IAAqB;CAE3C,SAAS,cAAc,SAA2B;EAC9C,IAAI,CAAC,SAAS,OAAO,KAAK,OAAO,YAAY,YACzC,OAAO;EAGX,IAAI,UAAU,IAAI,OAAO,GACrB,OAAO,UAAU,IAAI,OAAO;EAGhC,MAAM,OAAO,UAAU,OAAO;EAC9B,IAAI;EACJ,QAAQ,MAAR;GACI,KAAK;IACD,WAAW,I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;CACnC,KAAK,MAAM,CAAC,SAAS,cAAc,MAAM;EACrC,MAAM,aAAa,aAAa,KAAK;EACrC,IAAI,WAAW,QAAQ,CAAC,MAAM,SAAS,WAAW,MAAM,EAAE,KAAK,CAAC,MAAM,WAAW,WAAW,MAAM,EAAE,GAChG,OAAO;CAEf;CACA,OAAO;AACX;;AAGA,SAAS,SACL,MACA,OACA,OACO;CACP,IAAI,KAAK,SAAS,MAAM,MACpB,OAAO;CAEX,MAAM,cAAc,MAAM,OAAO;CACjC,KAAK,MAAM,aAAa,MAAM;EAC1B,MAAM,aAAa,YAAY,KAAK;EACpC,IAAI,WAAW,QAAQ,CAAC,MAAM,WAAW,WAAW,KAAK,GACrD,OAAO;CAEf;CACA,OAAO;AACX"}
@@ -3,6 +3,13 @@
3
3
  * Internal iterable transformation helpers.
4
4
  */
5
5
  import { type AnyIterable } from "./iterable.js";
6
+ /** Defines how adjacent selected keys are compared and retained. */
7
+ export interface DistinctUntilChangedStrategy<K> {
8
+ /** Returns true when adjacent keys represent the same state. */
9
+ equals(previous: unknown, current: K): boolean;
10
+ /** Captures the state retained for the next comparison. */
11
+ snapshot(value: K): unknown;
12
+ }
6
13
  /** Maps an iterable, preserving synchronous iteration when possible. */
7
14
  export declare function mapIterable<T, R>(source: AnyIterable<T>, mapper: (value: T) => R): AnyIterable<R>;
8
15
  /** Filters an iterable, preserving synchronous iteration when possible. */
@@ -18,7 +25,7 @@ export declare function skipWhileIterable<T>(source: AnyIterable<T>, predicate:
18
25
  /** Keeps the first value for every selected key, preserving synchronous iteration when possible. */
19
26
  export declare function distinctIterable<T, K>(source: AnyIterable<T>, keySelector: (value: T) => K): AnyIterable<T>;
20
27
  /** Keeps values whose selected key differs from the previous key. */
21
- export declare function distinctUntilChangedIterable<T, K>(source: AnyIterable<T>, keySelector: (value: T) => K): AnyIterable<T>;
28
+ export declare function distinctUntilChangedIterable<T, K>(source: AnyIterable<T>, keySelector: (value: T) => K, strategy?: DistinctUntilChangedStrategy<K>): AnyIterable<T>;
22
29
  /** Emits a fallback value when the source is empty. */
23
30
  export declare function defaultIfEmptyIterable<T>(source: AnyIterable<T>, defaultValue: T): AnyIterable<T>;
24
31
  //# sourceMappingURL=iterable-transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"iterable-transform.d.ts","sourceRoot":"","sources":["../../src/internal/iterable-transform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,KAAK,WAAW,EAAkB,MAAM,wBAAwB,CAAC;AAEzE,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAajG;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAiB1G;AAED,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAmB7G;AAED,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAmB7G;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAuBrF;AAED,mGAAmG;AACnG,wBAAgB,i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EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EAC5B,QAAQ,CAAC,EAAE,4BAA4B,CAAC,CAAC,CAAC,GAC3C,WAAW,CAAC,CAAC,CAAC,CA6BhB;AAED,uDAAuD;AACvD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAuBjG"}
@@ -108,15 +108,17 @@ function distinctIterable(source, keySelector) {
108
108
  })();
109
109
  }
110
110
  /** Keeps values whose selected key differs from the previous key. */
111
- function distinctUntilChangedIterable(source, keySelector) {
111
+ function distinctUntilChangedIterable(source, keySelector, strategy) {
112
+ const equals = strategy?.equals ?? Object.is;
113
+ const snapshot = strategy?.snapshot ?? ((value) => value);
112
114
  if (isAsyncIterable(source)) return (async function* () {
113
115
  let hasPrevious = false;
114
116
  let previous;
115
117
  for await (const value of source) {
116
118
  const key = keySelector(value);
117
- if (!hasPrevious || !Object.is(previous, key)) {
119
+ if (!hasPrevious || !equals(previous, key)) {
118
120
  hasPrevious = true;
119
- previous = key;
121
+ previous = snapshot(key);
120
122
  yield value;
121
123
  }
122
124
  }
@@ -126,9 +128,9 @@ function distinctUntilChangedIterable(source, keySelector) {
126
128
  let previous;
127
129
  for (const value of source) {
128
130
  const key = keySelector(value);
129
- if (!hasPrevious || !Object.is(previous, key)) {
131
+ if (!hasPrevious || !equals(previous, key)) {
130
132
  hasPrevious = true;
131
- previous = key;
133
+ previous = snapshot(key);
132
134
  yield value;
133
135
  }
134
136
  }
@@ -1 +1 @@
1
- {"version":3,"file":"iterable-transform.js","names":[],"sources":["../../src/internal/iterable-transform.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Internal iterable transformation helpers.\n */\nimport {type AnyIterable, isAsyncIterable} from \"@/internal/iterable.js\";\n\n/** Maps an iterable, preserving synchronous iteration when possible. */\nexport function mapIterable<T, R>(source: AnyIterable<T>, mapper: (value: T) => R): AnyIterable<R> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n yield mapper(value);\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n yield mapper(value);\n }\n })();\n}\n\n/** Filters an iterable, preserving synchronous iteration when possible. */\nexport function filterIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n if (predicate(value)) {\n yield value;\n }\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n if (predicate(value)) {\n yield value;\n }\n }\n })();\n}\n\n/** Takes values while a predicate returns true, preserving synchronous iteration when possible. */\nexport function takeWhileIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n if (!predicate(value)) {\n return;\n }\n yield value;\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n if (!predicate(value)) {\n return;\n }\n yield value;\n }\n })();\n}\n\n/** Takes values until a predicate returns true, preserving synchronous iteration when possible. */\nexport function takeUntilIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n yield value;\n if (predicate(value)) {\n return;\n }\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n yield value;\n if (predicate(value)) {\n return;\n }\n }\n })();\n}\n\n/** Skips a fixed number of values, preserving synchronous iteration when possible. */\nexport function skipIterable<T>(source: AnyIterable<T>, count: number): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let skipped = 0;\n for await (const value of source) {\n if (skipped < count) {\n skipped += 1;\n } else {\n yield value;\n }\n }\n })();\n }\n return (function* () {\n let skipped = 0;\n for (const value of source) {\n if (skipped < count) {\n skipped += 1;\n } else {\n yield value;\n }\n }\n })();\n}\n\n/** Skips values while a predicate returns true, preserving synchronous iteration when possible. */\nexport function skipWhileIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let skipping = true;\n for await (const value of source) {\n if (skipping && predicate(value)) {\n continue;\n }\n skipping = false;\n yield value;\n }\n })();\n }\n return (function* () {\n let skipping = true;\n for (const value of source) {\n if (skipping && predicate(value)) {\n continue;\n }\n skipping = false;\n yield value;\n }\n })();\n}\n\n/** Keeps the first value for every selected key, preserving synchronous iteration when possible. */\nexport function distinctIterable<T, K>(source: AnyIterable<T>, keySelector: (value: T) => K): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n const seen = new Set<K>();\n for await (const value of source) {\n const key = keySelector(value);\n if (!seen.has(key)) {\n seen.add(key);\n yield value;\n }\n }\n })();\n }\n return (function* () {\n const seen = new Set<K>();\n for (const value of source) {\n const key = keySelector(value);\n if (!seen.has(key)) {\n seen.add(key);\n yield value;\n }\n }\n })();\n}\n\n/** Keeps values whose selected key differs from the previous key. */\nexport function distinctUntilChangedIterable<T, K>(\n source: AnyIterable<T>,\n keySelector: (value: T) => K\n): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let hasPrevious = false;\n let previous: K | undefined;\n for await (const value of source) {\n const key = keySelector(value);\n if (!hasPrevious || !Object.is(previous, key)) {\n hasPrevious = true;\n previous = key;\n yield value;\n }\n }\n })();\n }\n return (function* () {\n let hasPrevious = false;\n let previous: K | undefined;\n for (const value of source) {\n const key = keySelector(value);\n if (!hasPrevious || !Object.is(previous, key)) {\n hasPrevious = true;\n previous = key;\n yield value;\n }\n }\n })();\n}\n\n/** Emits a fallback value when the source is empty. */\nexport function defaultIfEmptyIterable<T>(source: AnyIterable<T>, defaultValue: T): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let empty = true;\n for await (const value of source) {\n empty = false;\n yield value;\n }\n if (empty) {\n yield defaultValue;\n }\n })();\n }\n return (function* () {\n let empty = true;\n for (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zB,QAAQ,mBAAmB;EACvB,IAAI,cAAc;EAClB,IAAI;EACJ,WAAW,MAAM,SAAS,QAAQ;GAC9B,MAAM,MAAM,YAAY,KAAK;GAC7B,IAAI,CAAC,eAAe,CAAC,OAAO,GAAG,UAAU,GAAG,GAAG;IAC3C,cAAc;IACd,WAAW;IACX,MAAM;GACV;EACJ;CACJ,EAAA,CAAG;CAEP,QAAQ,aAAa;EACjB,IAAI,cAAc;EAClB,IAAI;EACJ,KAAK,MAAM,SAAS,QAAQ;GACxB,MAAM,MAAM,YAAY,KAAK;GAC7B,IAAI,CAAC,eAAe,CAAC,OAAO,GAAG,UAAU,GAAG,GAAG;IAC3C,cAAc;IACd,WAAW;IACX,MAAM;GACV;EACJ;CACJ,EAAA,CAAG;AACP;;AAGA,SAAgB,uBAA0B,QAAwB,cAAiC;CAC/F,IAAI,gBAAmB,MAAM,GACzB,QAAQ,mBAAmB;EACvB,IAAI,QAAQ;EACZ,WAAW,MAAM,SAAS,QAAQ;GAC9B,QAAQ;GACR,MAAM;EACV;EACA,IAAI,OACA,MAAM;CAEd,EAAA,CAAG;CAEP,QAAQ,aAAa;EACjB,IAAI,QAAQ;EACZ,KAAK,MAAM,SAAS,QAAQ;GACxB,QAAQ;GACR,MAAM;EACV;EACA,IAAI,OACA,MAAM;CAEd,EAAA,CAAG;AACP"}
1
+ {"version":3,"file":"iterable-transform.js","names":[],"sources":["../../src/internal/iterable-transform.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Internal iterable transformation helpers.\n */\nimport {type AnyIterable, isAsyncIterable} from \"@/internal/iterable.js\";\n\n/** Defines how adjacent selected keys are compared and retained. */\nexport interface DistinctUntilChangedStrategy<K> {\n /** Returns true when adjacent keys represent the same state. */\n equals(previous: unknown, current: K): boolean;\n\n /** Captures the state retained for the next comparison. */\n snapshot(value: K): unknown;\n}\n\n/** Maps an iterable, preserving synchronous iteration when possible. */\nexport function mapIterable<T, R>(source: AnyIterable<T>, mapper: (value: T) => R): AnyIterable<R> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n yield mapper(value);\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n yield mapper(value);\n }\n })();\n}\n\n/** Filters an iterable, preserving synchronous iteration when possible. */\nexport function filterIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n if (predicate(value)) {\n yield value;\n }\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n if (predicate(value)) {\n yield value;\n }\n }\n })();\n}\n\n/** Takes values while a predicate returns true, preserving synchronous iteration when possible. */\nexport function takeWhileIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n if (!predicate(value)) {\n return;\n }\n yield value;\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n if (!predicate(value)) {\n return;\n }\n yield value;\n }\n })();\n}\n\n/** Takes values until a predicate returns true, preserving synchronous iteration when possible. */\nexport function takeUntilIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n for await (const value of source) {\n yield value;\n if (predicate(value)) {\n return;\n }\n }\n })();\n }\n return (function* () {\n for (const value of source) {\n yield value;\n if (predicate(value)) {\n return;\n }\n }\n })();\n}\n\n/** Skips a fixed number of values, preserving synchronous iteration when possible. */\nexport function skipIterable<T>(source: AnyIterable<T>, count: number): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let skipped = 0;\n for await (const value of source) {\n if (skipped < count) {\n skipped += 1;\n } else {\n yield value;\n }\n }\n })();\n }\n return (function* () {\n let skipped = 0;\n for (const value of source) {\n if (skipped < count) {\n skipped += 1;\n } else {\n yield value;\n }\n }\n })();\n}\n\n/** Skips values while a predicate returns true, preserving synchronous iteration when possible. */\nexport function skipWhileIterable<T>(source: AnyIterable<T>, predicate: (value: T) => boolean): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let skipping = true;\n for await (const value of source) {\n if (skipping && predicate(value)) {\n continue;\n }\n skipping = false;\n yield value;\n }\n })();\n }\n return (function* () {\n let skipping = true;\n for (const value of source) {\n if (skipping && predicate(value)) {\n continue;\n }\n skipping = false;\n yield value;\n }\n })();\n}\n\n/** Keeps the first value for every selected key, preserving synchronous iteration when possible. */\nexport function distinctIterable<T, K>(source: AnyIterable<T>, keySelector: (value: T) => K): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n const seen = new Set<K>();\n for await (const value of source) {\n const key = keySelector(value);\n if (!seen.has(key)) {\n seen.add(key);\n yield value;\n }\n }\n })();\n }\n return (function* () {\n const seen = new Set<K>();\n for (const value of source) {\n const key = keySelector(value);\n if (!seen.has(key)) {\n seen.add(key);\n yield value;\n }\n }\n })();\n}\n\n/** Keeps values whose selected key differs from the previous key. */\nexport function distinctUntilChangedIterable<T, K>(\n source: AnyIterable<T>,\n keySelector: (value: T) => K,\n strategy?: DistinctUntilChangedStrategy<K>\n): AnyIterable<T> {\n const equals = strategy?.equals ?? Object.is;\n const snapshot = strategy?.snapshot ?? ((value: K): unknown => value);\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let hasPrevious = false;\n let previous: unknown;\n for await (const value of source) {\n const key = keySelector(value);\n if (!hasPrevious || !equals(previous, key)) {\n hasPrevious = true;\n previous = snapshot(key);\n yield value;\n }\n }\n })();\n }\n return (function* () {\n let hasPrevious = false;\n let previous: unknown;\n for (const value of source) {\n const key = keySelector(value);\n if (!hasPrevious || !equals(previous, key)) {\n hasPrevious = true;\n previous = snapshot(key);\n yield value;\n }\n }\n })();\n}\n\n/** Emits a fallback value when the source is empty. */\nexport function defaultIfEmptyIterable<T>(source: AnyIterable<T>, defaultValue: T): AnyIterable<T> {\n if (isAsyncIterable<T>(source)) {\n return (async function* () {\n let empty = true;\n for await (const value of source) {\n empty = false;\n yield value;\n }\n if (empty) {\n yield defaultValue;\n }\n })();\n }\n return (function* () {\n let empty = true;\n for (const value of source) {\n empty = false;\n yield value;\n }\n if (empty) {\n yield defaultValue;\n }\n })();\n}\n"],"mappings":";;;;;;;AAgBA,SAAgB,YAAkB,QAAwB,QAAyC;CAC/F,IAAI,gBAAmB,MAAM,GACzB,QAAQ,mBAAmB;EACvB,WAAW,MAAM,SAAS,QACtB,MAAM,OAAO,KAAK;CAE1B,EAAA,CAAG;CAEP,QAAQ,aAAa;EACjB,KAAK,MAAM,SAAS,QAChB,MAAM,OAAO,KAAK;CAE1B,EAAA,CAAG;AACP;;AAGA,SAAgB,eAAkB,QAAwB,WAAkD;CACxG,IAAI,gBAAmB,MAAM,GACzB,QAAQ,mBAAmB;EACvB,WAAW,MAAM,SAAS,QACtB,IAAI,UAAU,KAAK,GACf,MAAM;CAGlB,EAAA,CAAG;CAEP,QAAQ,aAAa;EACjB,KAAK,MAAM,SAAS,QAChB,IAAI,UAAU,KAAK,GACf,MAAM;CAGlB,EAAA,CAAG;AACP;;AAGA,SAAgB,kBAAqB,QAAwB,WAAkD;CAC3G,IAAI,gBAAmB,MAAM,GACzB,QAAQ,mBAAmB;EACvB,WAAW,MAAM,SAAS,QAAQ;GAC9B,IAAI,CAAC,UAAU,KAAK,GAChB;GAEJ,MAAM;EACV;CACJ,EAAA,CAAG;CAEP,QAAQ,aAAa;EACjB,KAAK,MAAM,SAAS,QAAQ;GACxB,IAAI,CAAC,UAAU,KAAK,GAChB;GAEJ,MAAM;EACV;CACJ,EAAA,CAAG;AACP;;AAGA,SAAgB,kBAAqB,QAAwB,WAAkD;CAC3G,IAAI,gBAAmB,MAAM,GACzB,QAAQ,mBAAmB;EACvB,WAAW,MAAM,SAAS,QAAQ;GAC9B,MAAM;GACN,IAAI,UAAU,KAAK,GACf;EAER;CACJ,EAAA,CAAG;CAEP,QAAQ,aAAa;EACjB,KAAK,MAAM,SAAS,QAAQ;GACxB,MAAM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E,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;IA4BvH,wEAAwE;IACxE,SAAS,CAAC,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAMzD;IAED,qFAAqF;IAC9E,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,OAAyB,GAAG,WAAW,CAAC,CAAC,CAAC,CAEtF;IAED,gDAAgD;IACzC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAoBhD;IAED,8CAA8C;IACvC,UAAU,IAAI,aAAa,CAAC,CAAC,CAAC,CAEpC;IAED,yCAAyC;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAEnC;IAED,4EAA4E;IAC/D,SAAS,IAAI,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAE/C;CACJ"}
@@ -3,6 +3,7 @@ import { Context } from "../context/context.js";
3
3
  import { EMPTY_ITERABLE, closeAsyncIterator, isAsyncIterable, isIterable, neverIterable, toAsyncIterator } from "../internal/iterable.js";
4
4
  import { mapIterable } from "../internal/iterable-transform.js";
5
5
  import { BooleanDisposable } from "../core/boolean-disposable.js";
6
+ import { addCap } from "../core/demand.js";
6
7
  import { CompositeError } from "../errors/classes.js";
7
8
  import { asError, throwIfNullish } from "../errors/helpers.js";
8
9
  import { firstValueFrom, raceWithAbort } from "../internal/abort.js";
@@ -65,9 +66,9 @@ var Flux = class Flux {
65
66
  static from(input) {
66
67
  throwIfNullish(input, "input");
67
68
  if (input instanceof Flux) return input;
69
+ if (typeof input.subscribe === "function") return fromPublisher(input);
68
70
  if (isAsyncIterable(input)) return new Flux(() => input);
69
71
  if (isIterable(input)) return Flux.fromIterable(input);
70
- if (typeof input.subscribe === "function") return fromPublisher(input);
71
72
  if (typeof input.then === "function") return new Flux(async function* (signal) {
72
73
  const value = await raceWithAbort(Promise.resolve(input), signal);
73
74
  if (value !== void 0 && value !== null) yield value;
@@ -552,31 +553,100 @@ function throwUnhandledSubscriberError(error) {
552
553
  }
553
554
  /** Adapts a Reactive Streams publisher to the Flux async-iteration model. */
554
555
  function fromPublisher(publisher) {
555
- return new Flux((signal, context) => {
556
- const queue = new AsyncQueue(signal);
556
+ return new PublisherFlux(publisher);
557
+ }
558
+ /** Flux adapter that keeps Reactive Streams subscriptions on their native demand path. */
559
+ var PublisherFlux = class extends Flux {
560
+ /** Creates a direct Flux adapter for a Reactive Streams publisher. */
561
+ constructor(publisher) {
562
+ super((signal) => publisherAsyncIterable(publisher, signal));
563
+ _defineProperty(this, "publisher", void 0);
564
+ this.publisher = publisher;
565
+ }
566
+ /** Subscribes directly so request amounts are not converted to iterator pulls. */
567
+ subscribeActual(subscriber) {
568
+ this.publisher.subscribe(subscriber);
569
+ }
570
+ };
571
+ /** Adapts a publisher to pull-based async iteration without requesting it unboundedly. */
572
+ function publisherAsyncIterable(publisher, signal) {
573
+ return {
574
+ /** Creates one pull-based iterator and its dedicated publisher subscription. */
575
+ [Symbol.asyncIterator]() {
576
+ const queue = new AsyncQueue();
557
577
  let subscription;
558
- publisher.subscribe({
559
- /** Captures upstream subscription and requests unbounded demand. */
560
- onSubscribe(nextSubscription) {
561
- subscription = nextSubscription;
562
- nextSubscription.request(Number.POSITIVE_INFINITY);
563
- },
564
- /** Pushes upstream values into the bridge queue. */
565
- onNext(value) {
566
- queue.push(value);
567
- },
568
- /** Fails the bridge queue with the upstream error. */
569
- onError(error) {
578
+ let pendingDemand = 0;
579
+ let terminated = signal.aborted;
580
+ const cleanup = () => signal.removeEventListener("abort", cancel);
581
+ const cancel = () => {
582
+ if (terminated) return;
583
+ terminated = true;
584
+ cleanup();
585
+ subscription?.cancel();
586
+ queue.return();
587
+ };
588
+ if (terminated) queue.complete();
589
+ else {
590
+ signal.addEventListener("abort", cancel, { once: true });
591
+ try {
592
+ publisher.subscribe({
593
+ /** Stores the upstream and drains any pulls made before onSubscribe. */
594
+ onSubscribe(nextSubscription) {
595
+ if (subscription || terminated) {
596
+ nextSubscription.cancel();
597
+ return;
598
+ }
599
+ subscription = nextSubscription;
600
+ if (pendingDemand > 0) {
601
+ const request = pendingDemand;
602
+ pendingDemand = 0;
603
+ nextSubscription.request(request);
604
+ }
605
+ },
606
+ /** Queues one publisher value for an async iterator pull. */
607
+ onNext(value) {
608
+ queue.push(value);
609
+ },
610
+ /** Propagates the terminal publisher error to the iterator. */
611
+ onError(error) {
612
+ if (terminated) return;
613
+ terminated = true;
614
+ cleanup();
615
+ queue.error(error);
616
+ },
617
+ /** Completes the iterator when the publisher completes. */
618
+ onComplete() {
619
+ if (terminated) return;
620
+ terminated = true;
621
+ cleanup();
622
+ queue.complete();
623
+ }
624
+ });
625
+ } catch (error) {
626
+ terminated = true;
627
+ cleanup();
570
628
  queue.error(error);
629
+ }
630
+ }
631
+ return {
632
+ /** Requests exactly one upstream item for one iterator pull. */
633
+ next() {
634
+ if (!terminated) if (subscription) subscription.request(1);
635
+ else pendingDemand = addCap(pendingDemand, 1);
636
+ return queue.next();
571
637
  },
572
- /** Completes the bridge queue when upstream completes. */
573
- onComplete() {
574
- queue.complete();
638
+ /** Cancels upstream when iteration stops early. */
639
+ return() {
640
+ cancel();
641
+ return queue.return();
642
+ },
643
+ /** Cancels upstream and rejects the iterator with the supplied error. */
644
+ throw(error) {
645
+ cancel();
646
+ return Promise.reject(error);
575
647
  }
576
- });
577
- signal.addEventListener("abort", () => subscription?.cancel(), { once: true });
578
- return queue;
579
- });
648
+ };
649
+ } };
580
650
  }
581
651
  /** Adapts publisher inputs to Flux instances without callback allocation. */
582
652
  function toFluxArray(sources) {