rxjs-poll 2.0.9 → 2.1.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/README.md
CHANGED
|
@@ -141,11 +141,13 @@ interface PollConfig {
|
|
|
141
141
|
* calculate time per state's `pollCount`.
|
|
142
142
|
* @default 'constant'
|
|
143
143
|
*/
|
|
144
|
-
strategy: 'constant' | 'random' | 'dynamic';
|
|
144
|
+
strategy: 'constant' | 'linear' | 'exponential' | 'random' | 'dynamic';
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* Time (ms) depending on strategy:
|
|
148
148
|
* - constant: number
|
|
149
|
+
* - linear: number
|
|
150
|
+
* - exponential: number
|
|
149
151
|
* - random: [min, max]
|
|
150
152
|
* - dynamic: (state) => number | [min, max]
|
|
151
153
|
* @default 1000
|
|
@@ -35,11 +35,15 @@ export type PollConfig<T> = {
|
|
|
35
35
|
*
|
|
36
36
|
* **Strategy:**
|
|
37
37
|
* - "constant": Fixed timing
|
|
38
|
+
* - "linear": Linearly increasing timing
|
|
39
|
+
* - "exponential": Exponentially increasing timing
|
|
38
40
|
* - "random": Random timing within a range
|
|
39
41
|
* - "dynamic": Custom function-based timing
|
|
40
42
|
*
|
|
41
43
|
* **Time:**
|
|
42
44
|
* - "constant": number
|
|
45
|
+
* - "linear": number
|
|
46
|
+
* - "exponential": number
|
|
43
47
|
* - "random": [min, max]
|
|
44
48
|
* - "dynamic": (state) => number | [min, max]
|
|
45
49
|
*
|
|
@@ -54,7 +58,7 @@ export type PollDelayConfig<T> = {
|
|
|
54
58
|
strategy: Extract<StrategyType, 'random'>;
|
|
55
59
|
} | {
|
|
56
60
|
time: number;
|
|
57
|
-
strategy:
|
|
61
|
+
strategy: Exclude<StrategyType, 'dynamic' | 'random'>;
|
|
58
62
|
};
|
|
59
63
|
/**
|
|
60
64
|
* Type-safe retry configuration with strategy-specific time constraints and optional settings.
|
|
@@ -81,16 +85,7 @@ export type PollDelayConfig<T> = {
|
|
|
81
85
|
* @template T - Type of the observable value being polled
|
|
82
86
|
* @default { strategy: "exponential", time: 1000, limit: 3, consecutiveOnly: true }
|
|
83
87
|
*/
|
|
84
|
-
export type PollRetryConfig<T> = (
|
|
85
|
-
time: DynamicFunction<T>;
|
|
86
|
-
strategy: Extract<StrategyType, 'dynamic'>;
|
|
87
|
-
} | {
|
|
88
|
-
time: MinMax;
|
|
89
|
-
strategy: Extract<StrategyType, 'random'>;
|
|
90
|
-
} | {
|
|
91
|
-
time: number;
|
|
92
|
-
strategy: Exclude<StrategyType, 'dynamic' | 'random'>;
|
|
93
|
-
}) & {
|
|
88
|
+
export type PollRetryConfig<T> = (PollDelayConfig<T> & {
|
|
94
89
|
limit?: number;
|
|
95
90
|
consecutiveOnly?: boolean;
|
|
96
91
|
}) | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.type.d.ts","sourceRoot":"","sources":["../../../src/types/config.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,GAAG,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACjC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,GAAG,CAAC;CACjC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"config.type.d.ts","sourceRoot":"","sources":["../../../src/types/config.type.ts"],"names":[],"m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AAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAElF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,GAAG;IAC5D,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAClC,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;IACpC,KAAK,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;IACpC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IACzC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAC3C,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IACzC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAC3C,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC"}
|
|
@@ -15,7 +15,7 @@ export type PollType = (typeof pollType)[keyof typeof pollType];
|
|
|
15
15
|
* Current polling state information available to timing functions
|
|
16
16
|
*/
|
|
17
17
|
export type PollState<T> = {
|
|
18
|
-
/** Latest value from the source. For "interval" polling
|
|
18
|
+
/** Latest value from the source. For "interval" polling type, first emission is undefined. */
|
|
19
19
|
value: T | undefined;
|
|
20
20
|
/** Latest error when retrying */
|
|
21
21
|
error: any | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rxjs-poll",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A flexible RxJS operator library that enables polling on any completed observable source with advanced timing and retry strategies",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rxjs",
|
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"main": "./dist/cjs/index.js",
|
|
62
62
|
"module": "./dist/esm/index.js",
|
|
63
|
+
"jsdelivr": "./dist/umd/index.min.js",
|
|
64
|
+
"unpkg": "./dist/umd/index.min.js",
|
|
63
65
|
"types": "./dist/types/index.d.ts",
|
|
64
66
|
"sideEffects": false,
|
|
65
67
|
"files": [
|
|
@@ -92,38 +94,38 @@
|
|
|
92
94
|
"rxjs": ">=7 || ^8.0.0-alpha.0 || ^8.0.0-beta.0 || ^8.0.0-rc.0"
|
|
93
95
|
},
|
|
94
96
|
"devDependencies": {
|
|
95
|
-
"@commitlint/cli": "
|
|
96
|
-
"@commitlint/config-conventional": "
|
|
97
|
-
"@commitlint/types": "
|
|
98
|
-
"@release-it/conventional-changelog": "
|
|
99
|
-
"@rollup/plugin-terser": "
|
|
100
|
-
"@rollup/plugin-typescript": "
|
|
101
|
-
"@types/fs-extra": "
|
|
102
|
-
"@types/jest": "
|
|
103
|
-
"@types/node": "
|
|
104
|
-
"@typescript-eslint/eslint-plugin": "
|
|
105
|
-
"@typescript-eslint/parser": "
|
|
106
|
-
"cross-env": "
|
|
107
|
-
"eslint": "
|
|
108
|
-
"eslint-config-prettier": "
|
|
109
|
-
"eslint-plugin-import": "
|
|
110
|
-
"eslint-plugin-jest-formatting": "
|
|
111
|
-
"eslint-plugin-prettier": "
|
|
112
|
-
"eslint-plugin-simple-import-sort": "
|
|
113
|
-
"eslint-plugin-unused-imports": "
|
|
114
|
-
"fs-extra": "
|
|
115
|
-
"husky": "
|
|
116
|
-
"is-ci": "
|
|
117
|
-
"jest": "
|
|
118
|
-
"jest-environment-jsdom": "
|
|
119
|
-
"jest-environment-node": "
|
|
120
|
-
"lint-staged": "
|
|
121
|
-
"release-it": "
|
|
122
|
-
"rimraf": "
|
|
123
|
-
"rollup": "
|
|
124
|
-
"rxjs": "
|
|
125
|
-
"ts-jest": "
|
|
126
|
-
"ts-node": "
|
|
127
|
-
"typescript": "
|
|
97
|
+
"@commitlint/cli": "20.3.0",
|
|
98
|
+
"@commitlint/config-conventional": "20.3.0",
|
|
99
|
+
"@commitlint/types": "20.2.0",
|
|
100
|
+
"@release-it/conventional-changelog": "10.0.1",
|
|
101
|
+
"@rollup/plugin-terser": "0.4.4",
|
|
102
|
+
"@rollup/plugin-typescript": "12.3.0",
|
|
103
|
+
"@types/fs-extra": "11.0.4",
|
|
104
|
+
"@types/jest": "30.0.0",
|
|
105
|
+
"@types/node": "25.0.3",
|
|
106
|
+
"@typescript-eslint/eslint-plugin": "8.51.0",
|
|
107
|
+
"@typescript-eslint/parser": "8.51.0",
|
|
108
|
+
"cross-env": "10.1.0",
|
|
109
|
+
"eslint": "9.39.2",
|
|
110
|
+
"eslint-config-prettier": "10.1.8",
|
|
111
|
+
"eslint-plugin-import": "2.32.0",
|
|
112
|
+
"eslint-plugin-jest-formatting": "3.1.0",
|
|
113
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
114
|
+
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
115
|
+
"eslint-plugin-unused-imports": "4.3.0",
|
|
116
|
+
"fs-extra": "11.3.3",
|
|
117
|
+
"husky": "9.1.7",
|
|
118
|
+
"is-ci": "4.1.0",
|
|
119
|
+
"jest": "30.2.0",
|
|
120
|
+
"jest-environment-jsdom": "30.2.0",
|
|
121
|
+
"jest-environment-node": "30.2.0",
|
|
122
|
+
"lint-staged": "16.2.7",
|
|
123
|
+
"release-it": "19.2.2",
|
|
124
|
+
"rimraf": "6.1.2",
|
|
125
|
+
"rollup": "4.54.0",
|
|
126
|
+
"rxjs": "7.8.2",
|
|
127
|
+
"ts-jest": "29.4.6",
|
|
128
|
+
"ts-node": "10.9.2",
|
|
129
|
+
"typescript": "5.9.3"
|
|
128
130
|
}
|
|
129
131
|
}
|