@vpmedia/simplify 1.14.0 → 1.15.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 +1 -1
- package/eslint.config.js +0 -1
- package/package.json +2 -2
- package/src/pagelifecycle/util.js +0 -12
- package/src/util/fetchRetry.js +13 -5
- package/types/pagelifecycle/util.d.ts +0 -1
- package/types/pagelifecycle/util.d.ts.map +1 -1
- package/types/util/fetchRetry.d.ts +6 -4
- package/types/util/fetchRetry.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vpmedia/simplify
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/js/@vpmedia%2Fsimplify)
|
|
4
4
|
[](https://github.com/vpmedia/simplify/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
6
|
@vpmedia/simplify TBD
|
package/eslint.config.js
CHANGED
|
@@ -51,7 +51,6 @@ export default [
|
|
|
51
51
|
...js.configs.recommended.rules,
|
|
52
52
|
...jsdocPlugin.configs['flat/recommended'].rules,
|
|
53
53
|
...unicornPlugin.configs['flat/recommended'].rules,
|
|
54
|
-
'unicorn/expiring-todo-comments': 'off',
|
|
55
54
|
'unicorn/filename-case': 'off',
|
|
56
55
|
'unicorn/no-null': 'off',
|
|
57
56
|
'unicorn/prevent-abbreviations': 'off',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/simplify",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "@vpmedia/simplify",
|
|
5
5
|
"author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@types/jest": "^29.5.14",
|
|
26
26
|
"eslint": "^9.15.0",
|
|
27
27
|
"eslint-plugin-jsdoc": "^50.5.0",
|
|
28
|
-
"eslint-plugin-unicorn": "^56.0.
|
|
28
|
+
"eslint-plugin-unicorn": "^56.0.1",
|
|
29
29
|
"globals": "^15.12.0",
|
|
30
30
|
"jest": "^29.7.0",
|
|
31
31
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -144,18 +144,6 @@ export const getDocumentState = () => {
|
|
|
144
144
|
return currentDocumentState;
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
/**
|
|
148
|
-
* Returns the event emitter instance.
|
|
149
|
-
* @returns {EventEmitter} Event emitter instance.
|
|
150
|
-
* @deprecated
|
|
151
|
-
*/
|
|
152
|
-
export const getEventEmitter = () => {
|
|
153
|
-
if (!isInitialized) {
|
|
154
|
-
initPageLifecycle();
|
|
155
|
-
}
|
|
156
|
-
return eventEmitter;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
147
|
/**
|
|
160
148
|
* Returns the event emitter instance.
|
|
161
149
|
* @returns {EventEmitter} Event emitter instance.
|
package/src/util/fetchRetry.js
CHANGED
|
@@ -10,12 +10,15 @@ export class FetchError extends Error {
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates a new FetchError instance.
|
|
12
12
|
* @param {string} message - Error message.
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
13
|
+
* @param {string | URL | Request} resource - Fetch URL.
|
|
14
|
+
* @param {RequestInit} fetchOptions - Fetch options.
|
|
15
|
+
* @param {Response} response - Fetch response.
|
|
15
16
|
*/
|
|
16
|
-
constructor(message,
|
|
17
|
+
constructor(message, resource, fetchOptions, response) {
|
|
17
18
|
super(message);
|
|
18
|
-
this.
|
|
19
|
+
this.name = 'FetchError';
|
|
20
|
+
this.resource = resource;
|
|
21
|
+
this.fetchOptions = fetchOptions;
|
|
19
22
|
this.response = response;
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -42,7 +45,12 @@ export const fetchRetry = async (resource, fetchOptions, retryOptions) => {
|
|
|
42
45
|
const response = await fetch(resource, fetchOptions);
|
|
43
46
|
if (!response.ok) {
|
|
44
47
|
logger.warn('failure', response);
|
|
45
|
-
throw new FetchError(
|
|
48
|
+
throw new FetchError(
|
|
49
|
+
`fetch ${response.url} returned status ${response.status}`,
|
|
50
|
+
resource,
|
|
51
|
+
fetchOptions,
|
|
52
|
+
response
|
|
53
|
+
);
|
|
46
54
|
}
|
|
47
55
|
logger.info('success', response);
|
|
48
56
|
return response;
|
|
@@ -2,7 +2,6 @@ export function addPageLifecycleCallback(state: import("./typedef.js").DocumentS
|
|
|
2
2
|
export function initPageLifecycle(): void;
|
|
3
3
|
export function getPageLifecycleState(): string;
|
|
4
4
|
export function getDocumentState(): import("./typedef.js").DocumentState;
|
|
5
|
-
export function getEventEmitter(): EventEmitter;
|
|
6
5
|
export function getPageLifecycleEventEmitter(): EventEmitter;
|
|
7
6
|
export function isPageLifecycleInitialized(): boolean;
|
|
8
7
|
import { EventEmitter } from 'eventemitter3';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/pagelifecycle/util.js"],"names":[],"mappings":"AAsCO,gDAHI,OAAO,cAAc,EAAE,aAAa,GAAG,OAAO,cAAc,EAAE,kBAAkB,YAChF,MAAM,IAAI,QAMpB;AAgEM,0CAsBN;AAMM,yCAFM,MAAM,CAIlB;AAMM,oCAFM,OAAO,cAAc,EAAE,aAAa,CAIhD;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/pagelifecycle/util.js"],"names":[],"mappings":"AAsCO,gDAHI,OAAO,cAAc,EAAE,aAAa,GAAG,OAAO,cAAc,EAAE,kBAAkB,YAChF,MAAM,IAAI,QAMpB;AAgEM,0CAsBN;AAMM,yCAFM,MAAM,CAIlB;AAMM,oCAFM,OAAO,cAAc,EAAE,aAAa,CAIhD;AAMM,gDAFM,YAAY,CAOxB;AAMM,8CAFM,OAAO,CAInB;6BA9J4B,eAAe"}
|
|
@@ -3,11 +3,13 @@ export class FetchError extends Error {
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new FetchError instance.
|
|
5
5
|
* @param {string} message - Error message.
|
|
6
|
-
* @param {
|
|
7
|
-
* @param {
|
|
6
|
+
* @param {string | URL | Request} resource - Fetch URL.
|
|
7
|
+
* @param {RequestInit} fetchOptions - Fetch options.
|
|
8
|
+
* @param {Response} response - Fetch response.
|
|
8
9
|
*/
|
|
9
|
-
constructor(message: string,
|
|
10
|
-
|
|
10
|
+
constructor(message: string, resource: string | URL | Request, fetchOptions: RequestInit, response: Response);
|
|
11
|
+
resource: string | URL | Request;
|
|
12
|
+
fetchOptions: RequestInit;
|
|
11
13
|
response: Response;
|
|
12
14
|
}
|
|
13
15
|
export function fetchRetry(resource: string | URL | Request, fetchOptions?: RequestInit, retryOptions?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchRetry.d.ts","sourceRoot":"","sources":["../../src/util/fetchRetry.js"],"names":[],"mappings":"AAMA,2BAA4B;AAE5B;IACE
|
|
1
|
+
{"version":3,"file":"fetchRetry.d.ts","sourceRoot":"","sources":["../../src/util/fetchRetry.js"],"names":[],"mappings":"AAMA,2BAA4B;AAE5B;IACE;;;;;;OAMG;IACH,qBALW,MAAM,YACN,MAAM,GAAG,GAAG,GAAG,OAAO,gBACtB,WAAW,YACX,QAAQ,EAQlB;IAHC,iCAAwB;IACxB,0BAAgC;IAChC,mBAAwB;CAE3B;AASM,qCALI,MAAM,GAAG,GAAG,GAAG,OAAO,iBACtB,WAAW,iBACX;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GAC5D,OAAO,CAAC,QAAQ,CAAC,CA0C7B"}
|