rxjs-poll 1.1.2 → 1.1.4

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 CHANGED
@@ -1,216 +1,197 @@
1
- # RxJS Polling Operator
2
-
3
- <a href="https://www.npmjs.com/package/rxjs-poll" target="_blank" rel="noopener noreferrer nofollow"><img alt="NPM Version" src="https://img.shields.io/npm/v/rxjs-poll"></a>
4
- <a href="https://bundlephobia.com/package/rxjs-poll@latest" target="_blank" rel="noopener noreferrer nofollow"><img alt="NPM Bundle Size" src="https://img.shields.io/bundlephobia/minzip/rxjs-poll?label=gzip"></a>
5
- <a href="https://github.com/mmustra/rxjs-poll/tree/main/tests" target="_blank" rel="noopener noreferrer nofollow"><img alt="Codecov" src="https://img.shields.io/codecov/c/gh/mmustra/rxjs-poll?token=H9R97BLFQI"></a>
6
- <a href="https://github.com/mmustra/rxjs-poll/issues" target="_blank" rel="noopener noreferrer nofollow"><img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/mmustra/rxjs-poll"></a>
7
-
8
- Library provides RxJS operator that can do polling on any completed source.
9
-
10
- **rxjs-poll** features:
11
-
12
- - Two types of polling; `repeat` and `interval`
13
- - Delay/retry can be a **static**, **random** or **dynamic** number
14
- - Any **delay/backoff strategy** you can think of
15
- - Background mode (browser only) to **pause/resume polling** on page visibility
16
- - Consecutive rule for **different retry attempts** approach
17
- - Config **input guard** for unexpected values
18
- - Supports browser and node environment
19
- - Compatible with RxJS v7+
20
- - Provides cjs and esm
21
-
22
- ## Installation
23
-
24
- ```shell
25
- npm install rxjs-poll --save
26
- ```
27
-
28
- ## Usage
29
-
30
- Let's say that you want to poll fun facts about cats. This is the request:
31
-
32
- ```typescript
33
- import { ajax } from 'rxjs/ajax';
34
- import { map } from 'rxjs';
35
-
36
- interface CatFact {
37
- fact: string;
38
- length: number;
39
- }
40
-
41
- const request$ = ajax<CatFact>({ url: 'https://catfact.ninja/fact' }).pipe(
42
- map(({ response }) => response)
43
- );
44
- ```
45
-
46
- ### Default
47
-
48
- Plug and play, just add an operator to your pipe and poll.
49
-
50
- [Demo](https://stackblitz.com/edit/rxjs-6nrm8l?devToolsHeight=100&file=index.ts)
51
-
52
- ```typescript
53
- import { poll } from 'rxjs-poll';
54
- import { takeWhile } from 'rxjs';
55
-
56
- request$
57
- .pipe(
58
- poll(),
59
- takeWhile(({ length }) => length < 200, true)
60
- )
61
- .subscribe({ next: console.log });
62
- ```
63
-
64
- ### Basic
65
-
66
- With a config file you can customize polling to your specific needs.
67
-
68
- [Demo](https://stackblitz.com/edit/rxjs-obywba?devToolsHeight=100&file=index.ts)
69
-
70
- ```typescript
71
- import { poll } from 'rxjs-poll';
72
- import { takeWhile } from 'rxjs';
73
-
74
- request$
75
- .pipe(
76
- poll({
77
- type: 'interval', // Drops uncompleted source after delay
78
- retries: Infinity, // Will never throw
79
- delay: [1000, 2000], // Random delay with min and max values
80
- }),
81
- takeWhile(({ length }) => length < 200, true)
82
- )
83
- .subscribe({ next: console.log });
84
- ```
85
-
86
- ### Advance
87
-
88
- Use delay function with provided [state](#PollState) when you need unique delay or backoff strategies for polling/retrying.
89
-
90
- [Demo](https://stackblitz.com/edit/rxjs-awthuj?devtoolsheight=100&file=index.ts)
91
-
92
- ```typescript
93
- import { poll } from 'rxjs-poll';
94
- import { takeWhile } from 'rxjs';
95
-
96
- request$
97
- .pipe(
98
- poll({
99
- retries: 6,
100
- delay: ({ value, error, consecutiveRetries }) => {
101
- const delay = 1000;
102
-
103
- if (error) {
104
- // Exponential backoff strategy
105
- // With 6 retries, throws after ~1min of consecutive errors
106
- return Math.pow(2, consecutiveRetries - 1) * delay;
107
- }
108
-
109
- // Faster polls for shorter facts
110
- return value.length < 100 ? delay * 0.3 : delay;
111
- },
112
- }),
113
- takeWhile(({ length }) => length < 200, true)
114
- )
115
- .subscribe({ next: console.log });
116
- ```
117
-
118
- ## API
119
-
120
- ### poll(config)
121
-
122
- It is a mono type operator function that will poll once a **source completes**. If the source is not completed, the operator will wait until that happens. First emission is sent immediately, then the polling will start. Values will emit until stopped by the user.
123
-
124
- ```typescript
125
- source$.pipe(poll({ type: 'repeat', retries: 10 }));
126
- ```
127
-
128
- ### PollConfig
129
-
130
- Configuration object used to setup polling mechanism. Any non-assigned, negative or invalid values will be replaced with default configuration values.
131
-
132
- ```typescript
133
- interface PollConfig {
134
- /**
135
- * Poller type
136
- *
137
- * repeat - polls after current source completes
138
- * interval - polls in intervals and drops source that is not complete
139
- */
140
- type: 'repeat' | 'interval';
141
-
142
- /**
143
- * Delay between polls and retries
144
- *
145
- * Use static or random number with min and max values. If you need
146
- * dynamic number, use function and return either static or random number.
147
- * Numbers should be positive and finate.
148
- */
149
- delay:
150
- | number
151
- | [number | number]
152
- | ((state: PollState) => number | [number | number]);
153
-
154
- /**
155
- * Number of retries
156
- *
157
- * Number of retries before it will throw. Number should be positive, but
158
- * it can be Infinity if you don't care about errors.
159
- */
160
- retries: number;
161
-
162
- /**
163
- * Retry's counting approach
164
- *
165
- * If true, then only consecutive error count will be checked against
166
- * retires. Consecutive error count is reset to 0 on successful response.
167
- * If false, then any number of errors will be checked against retires.
168
- */
169
- isConsecutiveRule: boolean;
170
-
171
- /**
172
- * Pause/resume polling - browser only
173
- *
174
- * Polling can be paused/resumed depending on page visibility.
175
- * ex. If this is false and you switch to another tab, polling is paused.
176
- * Once you go back, polling resumes.
177
- */
178
- isBackgroundMode: boolan;
179
- }
180
- ```
181
-
182
- #### Defaults
183
-
184
- ```typescript
185
- const config: PollConfig = {
186
- type: 'repeat',
187
- delay: 1000,
188
- retries: 3,
189
- isConsecutiveRule: true,
190
- isBackgroundMode: false,
191
- };
192
- ```
193
-
194
- ### PollState
195
-
196
- Provided as argument of delay function. Use it to set delay for polls and retries.
197
-
198
- ```typescript
199
- interface PollState<T> {
200
- polls: number; // current count of successful polls
201
- retries: number; // current count of retries
202
- consecutiveRetries: number; // current count of consecutive retries
203
- value: T; // value emitted from the source
204
- error: any | null; // "any" when retrying and "null" when polling
205
- }
206
-
207
- // polls + retries = total attempts
208
- ```
209
-
210
- ## Credits
211
-
212
- This library is inspired by the [rx-polling](https://github.com/jiayihu/rx-polling) that creates Observable for polling.
213
-
214
- ## License
215
-
216
- [MIT](LICENSE)
1
+ # RxJS Polling Operator
2
+
3
+ <a href="https://www.npmjs.com/package/rxjs-poll" target="_blank" rel="noopener noreferrer nofollow"><img alt="NPM Version" src="https://img.shields.io/npm/v/rxjs-poll"></a>
4
+ <a href="https://bundlephobia.com/package/rxjs-poll@latest" target="_blank" rel="noopener noreferrer nofollow"><img alt="NPM Bundle Size" src="https://img.shields.io/bundlephobia/minzip/rxjs-poll?label=gzip"></a>
5
+ <a href="https://github.com/mmustra/rxjs-poll/tree/main/tests" target="_blank" rel="noopener noreferrer nofollow"><img alt="Codecov" src="https://img.shields.io/codecov/c/gh/mmustra/rxjs-poll?token=H9R97BLFQI"></a>
6
+ <a href="https://github.com/mmustra/rxjs-poll/issues" target="_blank" rel="noopener noreferrer nofollow"><img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/mmustra/rxjs-poll"></a>
7
+ <a href="https://github.com/mmustra/rxjs-poll/commits/main" target="_blank" rel="noopener noreferrer nofollow"><img alt="GitHub last commit (branch)" src="https://img.shields.io/github/last-commit/mmustra/rxjs-poll/main?label=activity"></a>
8
+
9
+ A flexible RxJS operator library that enables polling on any completed observable source with advanced configuration options.
10
+
11
+ ## 🌟 Features
12
+
13
+ - **Two polling modes**: `repeat` and `interval` to suit different use cases
14
+ - **Flexible delay configuration**: Use static, random, or dynamic delay values
15
+ - **Custom backoff strategies**: Implement any delay/backoff logic you need
16
+ - **Background mode**: Automatically pause/resume polling based on page visibility (browser only)
17
+ - **Consecutive error handling**: Configure how retry attempts are managed
18
+ - **Input validation**: Guards against unexpected configuration values
19
+ - **Cross-platform**: Works in both browser and Node.js environments
20
+ - **Modern compatibility**: Compatible with RxJS v7+
21
+ - **Multiple module formats**: Supports CommonJS (CJS) and ES Modules (ESM)
22
+
23
+ ## 📦 Installation
24
+
25
+ ```shell
26
+ npm install rxjs-poll --save
27
+ ```
28
+
29
+ ## 🔄 How It Works
30
+
31
+ The emission(s) passes through until the source completes. Once the source completes, polling begins according to your configuration. Depending on the type: `repeat` mode waits for source to complete before polling again, while `interval` mode polls at fixed intervals, canceling ongoing operations. Error handling respects retry settings and consecutive rules.
32
+
33
+ ## 📚 Usage Examples
34
+
35
+ ### Default Configuration
36
+
37
+ [▶️ Live Demo](https://stackblitz.com/edit/rxjs-6nrm8l?devToolsHeight=100&file=index.ts)
38
+
39
+ Plug and play - just add the operator to your pipe and start polling.
40
+
41
+ ```typescript
42
+ import { poll } from 'rxjs-poll';
43
+ import { takeWhile } from 'rxjs';
44
+
45
+ request$
46
+ .pipe(
47
+ poll(), // Use default settings
48
+ takeWhile(({ length }) => length < 200, true)
49
+ )
50
+ .subscribe({ next: console.log });
51
+ ```
52
+
53
+ ### Custom Configuration
54
+
55
+ [▶️ Live Demo](https://stackblitz.com/edit/rxjs-obywba?devToolsHeight=100&file=index.ts)
56
+
57
+ Customize polling behavior with a configuration object:
58
+
59
+ ```typescript
60
+ import { poll } from 'rxjs-poll';
61
+ import { takeWhile } from 'rxjs';
62
+
63
+ request$
64
+ .pipe(
65
+ poll({
66
+ type: 'interval', // Drops uncompleted source after delay
67
+ retries: Infinity, // Will never throw
68
+ delay: [1000, 2000], // Random delay between 1 and 2 seconds
69
+ }),
70
+ takeWhile(({ length }) => length < 200, true)
71
+ )
72
+ .subscribe({ next: console.log });
73
+ ```
74
+
75
+ ### Advanced Strategies
76
+
77
+ [▶️ Live Demo](https://stackblitz.com/edit/rxjs-awthuj?devtoolsheight=100&file=index.ts)
78
+
79
+ Implement complex polling strategies with dynamic delay functions:
80
+
81
+ ```typescript
82
+ import { poll } from 'rxjs-poll';
83
+ import { takeWhile } from 'rxjs';
84
+
85
+ request$
86
+ .pipe(
87
+ poll({
88
+ retries: 6,
89
+ delay: ({ value, error, consecutiveRetries }) => {
90
+ const baseDelay = 1000;
91
+
92
+ if (error) {
93
+ // Exponential backoff strategy
94
+ // With 6 retries, throws after ~1min of consecutive errors
95
+ return Math.pow(2, consecutiveRetries - 1) * baseDelay;
96
+ }
97
+
98
+ // Adaptive polling based on response data
99
+ return value.length < 100 ? baseDelay * 0.3 : baseDelay;
100
+ },
101
+ }),
102
+ takeWhile(({ length }) => length < 200, true)
103
+ )
104
+ .subscribe({ next: console.log });
105
+ ```
106
+
107
+ ## 📋 API Reference
108
+
109
+ ### `poll(config?: PollConfig)`
110
+
111
+ Creates a polling operator that will begin polling once the source observable completes.
112
+
113
+ #### PollConfig
114
+
115
+ ```typescript
116
+ interface PollConfig {
117
+ /**
118
+ * Defines the polling behavior:
119
+ * - 'repeat': Polls after current source completes
120
+ * - 'interval': Polls in intervals, dropping any ongoing source operations
121
+ * @default 'repeat'
122
+ */
123
+ type?: 'repeat' | 'interval';
124
+
125
+ /**
126
+ * Delay between polls and retries in milliseconds
127
+ *
128
+ * Can be:
129
+ * - A static number (e.g., 1000 for 1 second)
130
+ * - An array with [min, max] for random delay
131
+ * - A function returning either of the above based on state
132
+ * @default 1000
133
+ */
134
+ delay?:
135
+ | number
136
+ | [number, number]
137
+ | ((state: PollState) => number | [number, number]);
138
+
139
+ /**
140
+ * Maximum number of retry attempts before throwing an error
141
+ * Use Infinity to keep retrying indefinitely
142
+ * @default 3
143
+ */
144
+ retries?: number;
145
+
146
+ /**
147
+ * Controls how retries are counted:
148
+ * - true: Only consecutive errors count toward retry limit
149
+ * (resets counter on success)
150
+ * - false: All errors count toward retry limit regardless of
151
+ * successful responses between them
152
+ * @default true
153
+ */
154
+ isConsecutiveRule?: boolean;
155
+
156
+ /**
157
+ * [Browser only] Controls polling behavior when page isn't visible
158
+ * - true: Continue polling when tab/window isn't focused
159
+ * - false: Pause polling when tab/window loses focus, resume when focus returns
160
+ * @default false
161
+ */
162
+ isBackgroundMode?: boolean;
163
+ }
164
+ ```
165
+
166
+ ### PollState
167
+
168
+ State object passed to dynamic delay functions:
169
+
170
+ ```typescript
171
+ interface PollState<T> {
172
+ /** Number of successful poll operations */
173
+ polls: number;
174
+
175
+ /** Total number of retry attempts */
176
+ retries: number;
177
+
178
+ /** Number of consecutive retry attempts without success */
179
+ consecutiveRetries: number;
180
+
181
+ /** Latest value emitted from the source */
182
+ value: T;
183
+
184
+ /** Error object when retrying, null during normal polling */
185
+ error: any | null;
186
+ }
187
+
188
+ // Note: polls + retries = total attempts
189
+ ```
190
+
191
+ ## 🙌 Credits
192
+
193
+ This library is inspired by [rx-polling](https://github.com/jiayihu/rx-polling), which creates an Observable for polling.
194
+
195
+ ## 📄 License
196
+
197
+ [MIT](LICENSE)
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.controlConfig = exports.normalizeConfig = void 0;
3
+ exports.controlConfig = void 0;
4
+ exports.normalizeConfig = normalizeConfig;
4
5
  var utils_1 = require("./utils");
5
6
  function normalizeConfig(config) {
6
7
  var _a;
@@ -12,7 +13,6 @@ function normalizeConfig(config) {
12
13
  isBackgroundMode: Boolean(config === null || config === void 0 ? void 0 : config.isBackgroundMode),
13
14
  };
14
15
  }
15
- exports.normalizeConfig = normalizeConfig;
16
16
  function delayProducer(delayFunc) {
17
17
  return function (state) {
18
18
  var delay = delayFunc(Object.assign({}, state));
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/common/config.ts"],"names":[],"mappings":";;;AAAA,iCAA8F;AAE9F,SAAgB,eAAe,CAAI,MAA4B;;IAC7D,OAAO;QACL,IAAI,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,qBAAa,CAAC,IAAI;QACxC,QAAQ,EAAE,IAAA,kBAAU,EAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CA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AAA,oBAAY,EAAC,eAAe,CAAC,EAA7B,CAA6B,CAAC;AACrD,CAAC;AAEY,QAAA,aAAa,GAA2B;IACnD,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,CAAC;IACV,iBAAiB,EAAE,IAAI;IACvB,gBAAgB,EAAE,KAAK;CACxB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPoller$ = exports.visibilityState$ = void 0;
3
+ exports.visibilityState$ = void 0;
4
+ exports.getPoller$ = getPoller$;
4
5
  var rxjs_1 = require("rxjs");
5
6
  var utils_1 = require("./utils");
6
7
  exports.visibilityState$ = pageVisibility$().pipe((0, rxjs_1.shareReplay)({ bufferSize: 1, refCount: true }));
@@ -15,7 +16,6 @@ function getPoller$(type, source$, getDelay) {
15
16
  }))
16
17
  : dynamicInterval$(function () { return getDelay(lastValue); }).pipe((0, rxjs_1.switchMap)(function () { return completed$; }));
17
18
  }
18
- exports.getPoller$ = getPoller$;
19
19
  function pageVisibility$() {
20
20
  return (0, utils_1.isBrowser)() ? (0, rxjs_1.fromEvent)(document, 'visibilitychange').pipe((0, rxjs_1.startWith)(null), (0, rxjs_1.map)(utils_1.isDocumentVisible)) : (0, rxjs_1.of)(true);
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"observables.js","sourceRoot":"","sources":["../../../src/common/observables.ts"],"names":[],"mappings":";;;AAAA,6BAAuH;AAGvH,iCAAuD;AAE1C,QAAA,gBAAgB,GAAG,eAAe,EAAE,CAAC,IAAI,CAAC,IAAA,kBAAW,EAAC,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAEvG,SAAgB,UAAU,CAAI,IAAc,EAAE,OAAsB,EAAE,QAA8B;IAClG,IAAI,SAAY,CAAC;IACjB,IAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAC7B,IAAA,eAA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";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDocumentVisible = exports.isBrowser = exports.isNil = exports.isFunction = exports.randomNumber = exports.sampleNumber = exports.normalizeNumber = void 0;
3
+ exports.normalizeNumber = normalizeNumber;
4
+ exports.sampleNumber = sampleNumber;
5
+ exports.randomNumber = randomNumber;
6
+ exports.isFunction = isFunction;
7
+ exports.isNil = isNil;
8
+ exports.isBrowser = isBrowser;
9
+ exports.isDocumentVisible = isDocumentVisible;
4
10
  function normalizeNumber(value, defaultValue, isFinite) {
5
11
  if (defaultValue === void 0) { defaultValue = 0; }
6
12
  if (isFinite === void 0) { isFinite = true; }
@@ -16,29 +22,22 @@ function normalizeNumber(value, defaultValue, isFinite) {
16
22
  }
17
23
  return Math.abs(singleValue);
18
24
  }
19
- exports.normalizeNumber = normalizeNumber;
20
25
  function sampleNumber(value) {
21
26
  return Array.isArray(value) ? randomNumber.apply(void 0, value) : value;
22
27
  }
23
- exports.sampleNumber = sampleNumber;
24
28
  function randomNumber(min, max) {
25
29
  return Math.floor(Math.random() * (max - min + 1)) + min;
26
30
  }
27
- exports.randomNumber = randomNumber;
28
31
  function isFunction(value) {
29
32
  return typeof value === 'function';
30
33
  }
31
- exports.isFunction = isFunction;
32
34
  function isNil(value) {
33
35
  return value == null;
34
36
  }
35
- exports.isNil = isNil;
36
37
  function isBrowser() {
37
38
  return typeof window !== 'undefined' && typeof window.document !== 'undefined';
38
39
  }
39
- exports.isBrowser = isBrowser;
40
40
  function isDocumentVisible() {
41
41
  return !document.hidden;
42
42
  }
43
- exports.isDocumentVisible = isDocumentVisible;
44
43
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/common/utils.ts"],"names":[],"mappings":";;;AAOA,SAAgB,eAAe,CAC7B,KAAkC,EAClC,YAAgB,EAChB,QAAe;IADf,6BAAA,EAAA,gBAAgB;IAChB,yBAAA,EAAA,eAAe;IAEf,IAAI,KAAK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GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3D,CAAC;AAED,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,SAAgB,KAAK,CAAC,KAAU;IAE9B,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED,SAAgB,SAAS;IACvB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AACjF,CAAC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC1B,CAAC"}
package/dist/cjs/poll.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.poll = void 0;
3
+ exports.poll = poll;
4
4
  var rxjs_1 = require("rxjs");
5
5
  var config_1 = require("./common/config");
6
6
  var observables_1 = require("./common/observables");
@@ -39,5 +39,4 @@ function poll(config) {
39
39
  }));
40
40
  };
41
41
  }
42
- exports.poll = poll;
43
42
  //# sourceMappingURL=poll.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"poll.js","sourceRoot":"","sources":["../../src/poll.ts"],"names":[],"mappings":";;;AAAA,6BAAqG;AAErG,0CAAmF;AACnF,oDAAoE;AA8BpE,SAAgB,IAAI,CAAI,MAA4B;IAClD,OAAO,UAAC,OAAO;QACP,IAAA,KAAmE,IAAA,wBAAe,EAAC,MAAM,CAAC,EAAxF,IAAI,UAAA,EAAE,OAAO,aAAA,EAAE,gBAAgB,sBAAA,EAAE,iBAAiB,uBAAA,EAAE,QAAQ,cAA4B,CAAC;QACjG,IAAM,QAAQ,GAAa,iBAAiB,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC;QAChF,IAAM,KAAK,GAAiB;YAC1B,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,CAAC;YACV,kBAAkB,EAA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C,kBAAkB,IAAI,CAAC,CAAC;wBAG9B,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC,CAAC,CAAC,IAAA,YAAK,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;oBACtF,CAAC;iBACF,CAAC,EACF,IAAA,UAAG,EAAC;oBACF,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;oBACnB,KAAK,CAAC,kBAAkB,GAAG,CAAC,CAAC;gBAC/B,CAAC,CAAC,CACH;gBACH,CAAC,CAAC,YAAK;QAlBT,CAkBS,CACV,CACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,102 +1,103 @@
1
- {
2
- "name": "rxjs-poll",
3
- "version": "1.1.2",
4
- "description": "RxJS operator for polling",
5
- "keywords": [
6
- "rxjs",
7
- "operator",
8
- "poll",
9
- "polling",
10
- "long-polling",
11
- "network",
12
- "http",
13
- "ajax"
14
- ],
15
- "author": {
16
- "name": "Marin Muštra",
17
- "url": "https://www.linkedin.com/in/marin-mustra"
18
- },
19
- "license": "MIT",
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/mmustra/rxjs-poll.git"
23
- },
24
- "bugs": {
25
- "url": "https://github.com/mmustra/rxjs-poll/issues"
26
- },
27
- "scripts": {
28
- "release": "release-it",
29
- "build": "npm run util:clean:dist && npm run build:esm && npm run build:cjs && npm run build:types && npm run util:packageJson",
30
- "build:esm": "tsc -p ./ts-configs/tsconfig.esm.json",
31
- "build:cjs": "tsc -p ./ts-configs/tsconfig.cjs.json",
32
- "build:types": "tsc -p ./ts-configs/tsconfig.types.json",
33
- "prepare": "is-ci || husky",
34
- "prepublishOnly": "npm run build",
35
- "test": "jest --verbose",
36
- "test:coverage": "npm run util:clean:coverage && npm run test -- --collect-coverage",
37
- "lint": "eslint ./src ./tests --ext .js,.ts",
38
- "lint:fix": "npm run lint -- --fix",
39
- "util:packageJson": "ts-node ./scripts/generate-package-json.ts",
40
- "util:clean:dist": "fse remove ./dist",
41
- "util:clean:coverage": "fse remove ./coverage",
42
- "util:commitlint": "commitlint",
43
- "util:lint-staged": "lint-staged"
44
- },
45
- "main": "./dist/cjs/index.js",
46
- "module": "./dist/esm/index.js",
47
- "types": "./dist/types/index.d.ts",
48
- "sideEffects": false,
49
- "files": [
50
- "dist/**/*"
51
- ],
52
- "exports": {
53
- ".": {
54
- "types": "./dist/types/index.d.ts",
55
- "node": "./dist/cjs/index.js",
56
- "require": "./dist/cjs/index.js",
57
- "import": "./dist/esm/index.js",
58
- "default": "./dist/esm/index.js"
59
- }
60
- },
61
- "lint-staged": {
62
- "*.{js,ts}": [
63
- "npm run lint:fix"
64
- ]
65
- },
66
- "peerDependencies": {
67
- "rxjs": ">=7 || ^8.0.0-alpha.0 || ^8.0.0-beta.0 || ^8.0.0-rc.0"
68
- },
69
- "devDependencies": {
70
- "@atao60/fse-cli": "^0.1.9",
71
- "@commitlint/cli": "^19.3.0",
72
- "@commitlint/config-conventional": "^19.2.2",
73
- "@commitlint/types": "^19.0.3",
74
- "@release-it/conventional-changelog": "^8.0.1",
75
- "@types/fs-extra": "^11.0.4",
76
- "@types/jest": "^29.5.12",
77
- "@types/node": "^20.12.10",
78
- "@typescript-eslint/eslint-plugin": "^7.8.0",
79
- "@typescript-eslint/parser": "^7.8.0",
80
- "eslint": "^8.57.0",
81
- "eslint-config-prettier": "^9.1.0",
82
- "eslint-config-xo": "^0.45.0",
83
- "eslint-config-xo-typescript": "^4.0.0",
84
- "eslint-plugin-import": "^2.29.1",
85
- "eslint-plugin-jest-formatting": "^3.1.0",
86
- "eslint-plugin-prettier": "^5.1.3",
87
- "eslint-plugin-simple-import-sort": "^12.1.0",
88
- "eslint-plugin-unused-imports": "^3.2.0",
89
- "fs-extra": "^11.2.0",
90
- "husky": "^9.0.11",
91
- "is-ci": "^3.0.1",
92
- "jest": "^29.7.0",
93
- "jest-environment-jsdom": "^29.7.0",
94
- "jest-environment-node": "^29.7.0",
95
- "lint-staged": "^15.2.2",
96
- "release-it": "^17.2.1",
97
- "rxjs": "^7.8.1",
98
- "ts-jest": "^29.1.2",
99
- "ts-node": "^10.9.2",
100
- "typescript": "^5.4.5"
101
- }
102
- }
1
+ {
2
+ "name": "rxjs-poll",
3
+ "version": "1.1.4",
4
+ "description": "RxJS operator for polling",
5
+ "keywords": [
6
+ "rxjs",
7
+ "operator",
8
+ "poll",
9
+ "polling",
10
+ "long-polling",
11
+ "network",
12
+ "http",
13
+ "ajax"
14
+ ],
15
+ "author": {
16
+ "name": "Marin Muštra",
17
+ "url": "https://www.linkedin.com/in/marin-mustra"
18
+ },
19
+ "license": "MIT",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/mmustra/rxjs-poll.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/mmustra/rxjs-poll/issues"
26
+ },
27
+ "scripts": {
28
+ "release": "release-it",
29
+ "build": "npm run util:clean:dist && npm run build:esm && npm run build:cjs && npm run build:types && npm run util:packageJson",
30
+ "build:esm": "tsc -p ./ts-configs/tsconfig.esm.json",
31
+ "build:cjs": "tsc -p ./ts-configs/tsconfig.cjs.json",
32
+ "build:types": "tsc -p ./ts-configs/tsconfig.types.json",
33
+ "prepare": "is-ci || husky",
34
+ "prepublishOnly": "npm run build",
35
+ "test": "jest --verbose",
36
+ "test:coverage": "npm run util:clean:coverage && npm run test -- --collect-coverage",
37
+ "lint": "eslint ./src ./tests",
38
+ "lint:fix": "npm run lint -- --fix",
39
+ "util:packageJson": "cross-env TS_NODE_PROJECT='./ts-configs/tsconfig.scripts.json' ts-node ./scripts/generate-package-json.ts",
40
+ "util:clean:dist": "rimraf ./dist --no-preserve-root --no-interactive",
41
+ "util:clean:coverage": "rimraf ./coverage --no-preserve-root --no-interactive",
42
+ "util:commitlint": "commitlint",
43
+ "util:lint-staged": "lint-staged"
44
+ },
45
+ "main": "./dist/cjs/index.js",
46
+ "module": "./dist/esm/index.js",
47
+ "types": "./dist/types/index.d.ts",
48
+ "sideEffects": false,
49
+ "files": [
50
+ "dist/**/*"
51
+ ],
52
+ "exports": {
53
+ ".": {
54
+ "types": "./dist/types/index.d.ts",
55
+ "node": "./dist/cjs/index.js",
56
+ "require": "./dist/cjs/index.js",
57
+ "import": "./dist/esm/index.js",
58
+ "default": "./dist/esm/index.js"
59
+ }
60
+ },
61
+ "lint-staged": {
62
+ "*.{js,ts}": [
63
+ "npm run lint:fix"
64
+ ]
65
+ },
66
+ "peerDependencies": {
67
+ "rxjs": ">=7 || ^8.0.0-alpha.0 || ^8.0.0-beta.0 || ^8.0.0-rc.0"
68
+ },
69
+ "devDependencies": {
70
+ "@commitlint/cli": "^19.8.1",
71
+ "@commitlint/config-conventional": "^19.8.1",
72
+ "@commitlint/types": "^19.8.1",
73
+ "@release-it/conventional-changelog": "^10.0.1",
74
+ "@types/fs-extra": "^11.0.4",
75
+ "@types/jest": "^29.5.14",
76
+ "@types/node": "^24.0.1",
77
+ "@typescript-eslint/eslint-plugin": "^8.34.0",
78
+ "@typescript-eslint/parser": "^8.34.0",
79
+ "cross-env": "^7.0.3",
80
+ "eslint": "^9.29.0",
81
+ "eslint-config-prettier": "^10.1.5",
82
+ "eslint-config-xo": "^0.47.0",
83
+ "eslint-config-xo-typescript": "^8.0.1",
84
+ "eslint-plugin-import": "^2.31.0",
85
+ "eslint-plugin-jest-formatting": "^3.1.0",
86
+ "eslint-plugin-prettier": "^5.4.1",
87
+ "eslint-plugin-simple-import-sort": "^12.1.1",
88
+ "eslint-plugin-unused-imports": "^4.1.4",
89
+ "fs-extra": "^11.3.0",
90
+ "husky": "^9.1.7",
91
+ "is-ci": "^4.1.0",
92
+ "jest": "^30.0.0",
93
+ "jest-environment-jsdom": "^30.0.0",
94
+ "jest-environment-node": "^30.0.0",
95
+ "lint-staged": "^16.1.1",
96
+ "release-it": "^19.0.3",
97
+ "rimraf": "^6.0.1",
98
+ "rxjs": "^7.8.2",
99
+ "ts-jest": "^29.4.0",
100
+ "ts-node": "^10.9.2",
101
+ "typescript": "^5.8.3"
102
+ }
103
+ }