@lwrjs/diagnostics 0.17.2-alpha.3 → 0.17.2-alpha.30
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/build/cjs/descriptions/application.cjs +1 -6
- package/build/cjs/descriptions/index.cjs +3 -1
- package/build/cjs/descriptions/invalid.cjs +20 -0
- package/build/cjs/errors.cjs +9 -2
- package/build/cjs/logger.cjs +5 -2
- package/build/es/descriptions/application.d.ts +1 -6
- package/build/es/descriptions/application.js +1 -6
- package/build/es/descriptions/index.d.ts +6 -3
- package/build/es/descriptions/index.js +2 -0
- package/build/es/descriptions/invalid.d.ts +9 -0
- package/build/es/descriptions/invalid.js +9 -0
- package/build/es/errors.d.ts +5 -2
- package/build/es/errors.js +10 -3
- package/build/es/logger.js +5 -1
- package/package.json +6 -6
|
@@ -11,12 +11,7 @@ __export(exports, {
|
|
|
11
11
|
application: () => application
|
|
12
12
|
});
|
|
13
13
|
var application = {
|
|
14
|
-
|
|
15
|
-
INVALID_API_VERSION: (apiVersion, expectedVersion) => `400: API Version "${escape(apiVersion)}" is not supported. Expected "${expectedVersion}"`,
|
|
16
|
-
INVALID_ENVIRONMENT: (environment) => `400: Environment "${escape(environment)}" is not supported`,
|
|
17
|
-
INVALID_SPECIFIER: (specifier) => `400: Unable to resolve specifier "${escape(specifier)}" because it contains path traversal`,
|
|
18
|
-
PRELOAD_MODULE: (specifier) => `Invalid preload module: ${escape(specifier)}`,
|
|
19
|
-
INVALID_MODE: (mode) => `No configuration found for server mode - ${escape(mode)}`,
|
|
14
|
+
PRELOAD_DATA_ERROR: (id, error) => `Preloading data for "${id}" failed: ${error}`,
|
|
20
15
|
SSR_ERROR: (specifier, error) => `Server-side rendering for "${specifier}" failed: ${error}`,
|
|
21
16
|
SSR_TIMEOUT: (specifier, time) => `Server side rendering or data prefetching for '${escape(specifier)}' timed out after ${time}ms`,
|
|
22
17
|
ROUTE_HANDLER_ERROR: (route, error) => `An error occurred executing route handler for "${route}": "${error}"`
|
|
@@ -30,9 +30,11 @@ var import_config = __toModule(require("./config.cjs"));
|
|
|
30
30
|
var import_unresolvable = __toModule(require("./unresolvable.cjs"));
|
|
31
31
|
var import_server = __toModule(require("./server.cjs"));
|
|
32
32
|
var import_application = __toModule(require("./application.cjs"));
|
|
33
|
+
var import_invalid = __toModule(require("./invalid.cjs"));
|
|
33
34
|
var descriptions = {
|
|
34
35
|
CONFIG: import_config.config,
|
|
35
36
|
UNRESOLVABLE: import_unresolvable.unresolvable,
|
|
36
37
|
SERVER: import_server.server,
|
|
37
|
-
APPLICATION: import_application.application
|
|
38
|
+
APPLICATION: import_application.application,
|
|
39
|
+
INVALID: import_invalid.invalid
|
|
38
40
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// packages/@lwrjs/diagnostics/src/descriptions/invalid.ts
|
|
9
|
+
__markAsModule(exports);
|
|
10
|
+
__export(exports, {
|
|
11
|
+
invalid: () => invalid
|
|
12
|
+
});
|
|
13
|
+
var invalid = {
|
|
14
|
+
INVALID_JSON: () => "400: Accept header and json query parameter are incompatible",
|
|
15
|
+
INVALID_API_VERSION: (apiVersion, expectedVersion) => `400: API Version "${escape(apiVersion)}" is not supported. Expected "${expectedVersion}"`,
|
|
16
|
+
INVALID_ENVIRONMENT: (environment) => `400: Environment "${escape(environment)}" is not supported`,
|
|
17
|
+
INVALID_SPECIFIER: (specifier) => `400: Unable to resolve specifier "${escape(specifier)}" because it contains path traversal`,
|
|
18
|
+
PRELOAD_MODULE: (specifier) => `Invalid preload module: ${escape(specifier)}`,
|
|
19
|
+
INVALID_MODE: (mode) => `No configuration found for server mode - ${escape(mode)}`
|
|
20
|
+
};
|
package/build/cjs/errors.cjs
CHANGED
|
@@ -12,6 +12,7 @@ __export(exports, {
|
|
|
12
12
|
LwrApplicationError: () => LwrApplicationError,
|
|
13
13
|
LwrConfigError: () => LwrConfigError,
|
|
14
14
|
LwrError: () => LwrError,
|
|
15
|
+
LwrInvalidError: () => LwrInvalidError,
|
|
15
16
|
LwrServerError: () => LwrServerError,
|
|
16
17
|
LwrStatusError: () => LwrStatusError,
|
|
17
18
|
LwrUnresolvableError: () => LwrUnresolvableError,
|
|
@@ -38,6 +39,12 @@ var LwrApplicationError = class extends LwrError {
|
|
|
38
39
|
this.name = "LwrApplicationError";
|
|
39
40
|
}
|
|
40
41
|
};
|
|
42
|
+
var LwrInvalidError = class extends LwrError {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
this.name = "LwrInvalidError";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
41
48
|
var LwrUnresolvableError = class extends LwrError {
|
|
42
49
|
constructor(message, type) {
|
|
43
50
|
super(message);
|
|
@@ -46,11 +53,11 @@ var LwrUnresolvableError = class extends LwrError {
|
|
|
46
53
|
}
|
|
47
54
|
};
|
|
48
55
|
var LwrStatusError = class extends LwrError {
|
|
49
|
-
constructor(message, status,
|
|
56
|
+
constructor(message, status, headers) {
|
|
50
57
|
super(message);
|
|
51
58
|
this.name = "LwrStatusError";
|
|
52
59
|
this.status = status;
|
|
53
|
-
this.
|
|
60
|
+
this.headers = headers;
|
|
54
61
|
}
|
|
55
62
|
};
|
|
56
63
|
var DiagnosticsError = class extends LwrError {
|
package/build/cjs/logger.cjs
CHANGED
|
@@ -108,10 +108,13 @@ var stringifyError = (error, count = 0) => {
|
|
|
108
108
|
diagnostics: error.diagnostics,
|
|
109
109
|
stack: error.stack
|
|
110
110
|
});
|
|
111
|
+
} else if (error instanceof AggregateError) {
|
|
112
|
+
const childErrors = error.errors.reduce((msg, e) => msg += `
|
|
113
|
+
${stringifyError(e)}`, "");
|
|
114
|
+
return (decodeMessage(error.message) || error.name) + childErrors;
|
|
111
115
|
} else if (error.message) {
|
|
112
116
|
const message = error.message;
|
|
113
|
-
const cause = error.cause && count < 1 ? `
|
|
114
|
-
Cause: ${stringifyError(error.cause, 1)}` : "";
|
|
117
|
+
const cause = error.cause && count < 1 ? ` Cause: ${stringifyError(error.cause, 1)}` : "";
|
|
115
118
|
return decodeMessage(message) + cause;
|
|
116
119
|
} else if (typeof error === "string" || error instanceof String) {
|
|
117
120
|
return decodeMessage(error);
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export declare const application: {
|
|
2
|
-
|
|
3
|
-
INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => string;
|
|
4
|
-
INVALID_ENVIRONMENT: (environment: string) => string;
|
|
5
|
-
INVALID_SPECIFIER: (specifier: string) => string;
|
|
6
|
-
PRELOAD_MODULE: (specifier: string) => string;
|
|
7
|
-
INVALID_MODE: (mode: string) => string;
|
|
2
|
+
PRELOAD_DATA_ERROR: (id: string, error: string) => string;
|
|
8
3
|
SSR_ERROR: (specifier: string, error: string) => string;
|
|
9
4
|
SSR_TIMEOUT: (specifier: string, time: number) => string;
|
|
10
5
|
ROUTE_HANDLER_ERROR: (route: string, error: string) => string;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export const application = {
|
|
2
|
-
|
|
3
|
-
INVALID_API_VERSION: (apiVersion, expectedVersion) => `400: API Version "${escape(apiVersion)}" is not supported. Expected "${expectedVersion}"`,
|
|
4
|
-
INVALID_ENVIRONMENT: (environment) => `400: Environment "${escape(environment)}" is not supported`,
|
|
5
|
-
INVALID_SPECIFIER: (specifier) => `400: Unable to resolve specifier "${escape(specifier)}" because it contains path traversal`,
|
|
6
|
-
PRELOAD_MODULE: (specifier) => `Invalid preload module: ${escape(specifier)}`,
|
|
7
|
-
INVALID_MODE: (mode) => `No configuration found for server mode - ${escape(mode)}`,
|
|
2
|
+
PRELOAD_DATA_ERROR: (id, error) => `Preloading data for "${id}" failed: ${error}`,
|
|
8
3
|
SSR_ERROR: (specifier, error) => `Server-side rendering for "${specifier}" failed: ${error}`,
|
|
9
4
|
SSR_TIMEOUT: (specifier, time) => `Server side rendering or data prefetching for '${escape(specifier)}' timed out after ${time}ms`,
|
|
10
5
|
ROUTE_HANDLER_ERROR: (route, error) => `An error occurred executing route handler for "${route}": "${error}"`,
|
|
@@ -49,15 +49,18 @@ export declare const descriptions: {
|
|
|
49
49
|
SERVER_ERROR: (name: string) => string;
|
|
50
50
|
};
|
|
51
51
|
APPLICATION: {
|
|
52
|
+
PRELOAD_DATA_ERROR: (id: string, error: string) => string;
|
|
53
|
+
SSR_ERROR: (specifier: string, error: string) => string;
|
|
54
|
+
SSR_TIMEOUT: (specifier: string, time: number) => string;
|
|
55
|
+
ROUTE_HANDLER_ERROR: (route: string, error: string) => string;
|
|
56
|
+
};
|
|
57
|
+
INVALID: {
|
|
52
58
|
INVALID_JSON: () => string;
|
|
53
59
|
INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => string;
|
|
54
60
|
INVALID_ENVIRONMENT: (environment: string) => string;
|
|
55
61
|
INVALID_SPECIFIER: (specifier: string) => string;
|
|
56
62
|
PRELOAD_MODULE: (specifier: string) => string;
|
|
57
63
|
INVALID_MODE: (mode: string) => string;
|
|
58
|
-
SSR_ERROR: (specifier: string, error: string) => string;
|
|
59
|
-
SSR_TIMEOUT: (specifier: string, time: number) => string;
|
|
60
|
-
ROUTE_HANDLER_ERROR: (route: string, error: string) => string;
|
|
61
64
|
};
|
|
62
65
|
};
|
|
63
66
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,10 +2,12 @@ import { config } from './config.js';
|
|
|
2
2
|
import { unresolvable } from './unresolvable.js';
|
|
3
3
|
import { server } from './server.js';
|
|
4
4
|
import { application } from './application.js';
|
|
5
|
+
import { invalid } from './invalid.js';
|
|
5
6
|
export const descriptions = {
|
|
6
7
|
CONFIG: config,
|
|
7
8
|
UNRESOLVABLE: unresolvable,
|
|
8
9
|
SERVER: server,
|
|
9
10
|
APPLICATION: application,
|
|
11
|
+
INVALID: invalid,
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const invalid: {
|
|
2
|
+
INVALID_JSON: () => string;
|
|
3
|
+
INVALID_API_VERSION: (apiVersion: string, expectedVersion: any) => string;
|
|
4
|
+
INVALID_ENVIRONMENT: (environment: string) => string;
|
|
5
|
+
INVALID_SPECIFIER: (specifier: string) => string;
|
|
6
|
+
PRELOAD_MODULE: (specifier: string) => string;
|
|
7
|
+
INVALID_MODE: (mode: string) => string;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=invalid.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const invalid = {
|
|
2
|
+
INVALID_JSON: () => '400: Accept header and json query parameter are incompatible',
|
|
3
|
+
INVALID_API_VERSION: (apiVersion, expectedVersion) => `400: API Version "${escape(apiVersion)}" is not supported. Expected "${expectedVersion}"`,
|
|
4
|
+
INVALID_ENVIRONMENT: (environment) => `400: Environment "${escape(environment)}" is not supported`,
|
|
5
|
+
INVALID_SPECIFIER: (specifier) => `400: Unable to resolve specifier "${escape(specifier)}" because it contains path traversal`,
|
|
6
|
+
PRELOAD_MODULE: (specifier) => `Invalid preload module: ${escape(specifier)}`,
|
|
7
|
+
INVALID_MODE: (mode) => `No configuration found for server mode - ${escape(mode)}`,
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=invalid.js.map
|
package/build/es/errors.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export declare class LwrServerError extends LwrError {
|
|
|
9
9
|
export declare class LwrApplicationError extends LwrError {
|
|
10
10
|
name: string;
|
|
11
11
|
}
|
|
12
|
+
export declare class LwrInvalidError extends LwrError {
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
12
15
|
export declare class LwrUnresolvableError extends LwrError {
|
|
13
16
|
name: string;
|
|
14
17
|
type: string;
|
|
@@ -17,8 +20,8 @@ export declare class LwrUnresolvableError extends LwrError {
|
|
|
17
20
|
export declare class LwrStatusError extends LwrError {
|
|
18
21
|
name: string;
|
|
19
22
|
status: 301 | 302 | 429 | 503;
|
|
20
|
-
|
|
21
|
-
constructor(message: undefined | string, status: 301 | 302 | 429 | 503,
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
constructor(message: undefined | string, status: 301 | 302 | 429 | 503, headers?: Record<string, string>);
|
|
22
25
|
}
|
|
23
26
|
type Position = {
|
|
24
27
|
line: number;
|
package/build/es/errors.js
CHANGED
|
@@ -16,13 +16,20 @@ export class LwrServerError extends LwrError {
|
|
|
16
16
|
this.name = 'LwrServerError';
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
//
|
|
19
|
+
// 500 - app layer does not affect availability
|
|
20
20
|
export class LwrApplicationError extends LwrError {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
23
|
this.name = 'LwrApplicationError';
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
// 400
|
|
27
|
+
export class LwrInvalidError extends LwrError {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.name = 'LwrInvalidError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
26
33
|
// 404
|
|
27
34
|
export class LwrUnresolvableError extends LwrError {
|
|
28
35
|
constructor(message, type) {
|
|
@@ -33,11 +40,11 @@ export class LwrUnresolvableError extends LwrError {
|
|
|
33
40
|
}
|
|
34
41
|
// 301, 302, 429, 503
|
|
35
42
|
export class LwrStatusError extends LwrError {
|
|
36
|
-
constructor(message, status,
|
|
43
|
+
constructor(message, status, headers) {
|
|
37
44
|
super(message);
|
|
38
45
|
this.name = 'LwrStatusError';
|
|
39
46
|
this.status = status;
|
|
40
|
-
this.
|
|
47
|
+
this.headers = headers;
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
export class DiagnosticsError extends LwrError {
|
package/build/es/logger.js
CHANGED
|
@@ -80,9 +80,13 @@ export const stringifyError = (error, count = 0) => {
|
|
|
80
80
|
stack: error.stack,
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
+
else if (error instanceof AggregateError) {
|
|
84
|
+
const childErrors = error.errors.reduce((msg, e) => (msg += `\n${stringifyError(e)}`), '');
|
|
85
|
+
return (decodeMessage(error.message) || error.name) + childErrors;
|
|
86
|
+
}
|
|
83
87
|
else if (error.message) {
|
|
84
88
|
const message = error.message;
|
|
85
|
-
const cause = error.cause && count < 1 ?
|
|
89
|
+
const cause = error.cause && count < 1 ? ` Cause: ${stringifyError(error.cause, 1)}` : '';
|
|
86
90
|
// Message may have been encoded to prevent XSS
|
|
87
91
|
return decodeMessage(message) + cause;
|
|
88
92
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.17.2-alpha.
|
|
7
|
+
"version": "0.17.2-alpha.30",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"test": "jest"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@lwrjs/types": "0.17.2-alpha.
|
|
39
|
-
"jest": "
|
|
40
|
-
"ts-jest": "^
|
|
38
|
+
"@lwrjs/types": "0.17.2-alpha.30",
|
|
39
|
+
"jest": "29.7.0",
|
|
40
|
+
"ts-jest": "^29.2.6",
|
|
41
41
|
"typescript": "^4.9.5"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
44
|
+
"node": ">=20.0.0"
|
|
45
45
|
},
|
|
46
46
|
"volta": {
|
|
47
47
|
"extends": "../../../package.json"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "818bbb13d2d4b14d128c4c4f23229c9ce7458a23"
|
|
50
50
|
}
|