@datapos/datapos-shared 0.3.342 → 0.3.348
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 +2 -0
- package/dist/datapos-shared-connector.es.js +610 -0
- package/dist/datapos-shared-errors.es.js +109 -0
- package/dist/datapos-shared.es.js +14 -711
- package/dist/types/src/errors/index.d.ts +68 -48
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/utilities/index.d.ts +1 -1
- package/package.json +10 -4
- package/dist/types/src/component/dataView/OLD_ContentAuditColumn.d.ts +0 -33
- package/dist/types/src/component/dataView/OLD_PreviewColumn.d.ts +0 -5
|
@@ -1,63 +1,83 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Error classes and utilities.
|
|
3
|
+
*/
|
|
4
|
+
/** Serializable representation of an error and its cause chain.
|
|
5
|
+
* Used for logging, reporting, and transport across process or network boundaries.
|
|
6
|
+
*/
|
|
7
|
+
interface SerialisedError {
|
|
8
|
+
/** HTTP response body (Fetch errors only). */ body?: string;
|
|
9
|
+
/** Vue component name (Vue errors only). */ componentName?: string;
|
|
10
|
+
/** Vue error info string. */ info?: string;
|
|
11
|
+
/** Logical source of the error. */ locator: string;
|
|
12
|
+
/** Human-readable error message. */ message: string;
|
|
13
|
+
/** Error class or type name. */ name: string;
|
|
14
|
+
/** Stack trace, if available. */ stack?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Base class for all Data Positioning errors.
|
|
17
|
+
* All errors include a `locator` identifying the logical source of the error (module, feature, or operation).
|
|
18
|
+
*/
|
|
12
19
|
declare class DataPosError extends Error {
|
|
13
|
-
locator: string;
|
|
20
|
+
readonly locator: string; /** Logical source of the error. */
|
|
14
21
|
constructor(message: string, locator: string, options?: ErrorOptions);
|
|
15
22
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
/** Represents application-level failures.
|
|
24
|
+
* Used for errors originating from application logic, not external systems.
|
|
25
|
+
*/
|
|
26
|
+
declare class ApplicationError extends DataPosError {
|
|
19
27
|
}
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
/** Represents API-related failures.
|
|
29
|
+
* Typically thrown when backend requests fail or return invalid responses.
|
|
30
|
+
*/
|
|
31
|
+
declare class APIError extends ApplicationError {
|
|
23
32
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
constructor(message: string, locator: string, options?: ErrorOptions);
|
|
33
|
+
/** Represents engine or core processing failures. */
|
|
34
|
+
declare class EngineError extends ApplicationError {
|
|
27
35
|
}
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
/** Represents failures during HTTP requests.
|
|
37
|
+
* Includes a sanitized snapshot of the response body for diagnostic purposes.
|
|
38
|
+
*/
|
|
39
|
+
declare class FetchError extends ApplicationError {
|
|
40
|
+
readonly body?: string; /** Sanitized HTTP response body. */
|
|
41
|
+
constructor(message: string, locator: string, body?: string | null, options?: ErrorOptions);
|
|
32
42
|
}
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
componentName?: string;
|
|
36
|
-
info: string;
|
|
37
|
-
constructor(message: string, locator: string, info: string, componentName?: string, options?: ErrorOptions);
|
|
43
|
+
/** Represents operational failures not caused by application logic. */
|
|
44
|
+
declare class OperationalError extends DataPosError {
|
|
38
45
|
}
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
/** Represents Vue errors that have been explicitly handled.
|
|
47
|
+
* Used when capturing Vue error handler output with additional component context.
|
|
48
|
+
*/
|
|
49
|
+
declare class VueHandledError extends ApplicationError {
|
|
50
|
+
readonly componentName?: string; /** Vue component name, if available. */
|
|
51
|
+
readonly info: string; /** Vue error info string. */
|
|
52
|
+
constructor(message: string, locator: string, info: string, componentName?: string, options?: ErrorOptions);
|
|
42
53
|
}
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
constructor(message: string, locator: string, options?: ErrorOptions);
|
|
54
|
+
/** Represents handled window runtime errors. */
|
|
55
|
+
declare class WindowHandledRuntimeError extends ApplicationError {
|
|
46
56
|
}
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
constructor(message: string, locator: string, options?: ErrorOptions);
|
|
57
|
+
/** Represents handled window promise rejection errors. */
|
|
58
|
+
declare class WindowHandledPromiseRejectionError extends ApplicationError {
|
|
50
59
|
}
|
|
51
|
-
/**
|
|
52
|
-
|
|
60
|
+
/** Builds a {@link FetchError} from an HTTP response.
|
|
61
|
+
* The response body is eagerly read so it can be included in error logs even after the response stream is closed.
|
|
62
|
+
*/
|
|
63
|
+
declare function buildFetchError(response: {
|
|
53
64
|
status: number;
|
|
54
65
|
statusText: string;
|
|
55
66
|
text: () => Promise<string>;
|
|
56
67
|
}, message: string, locator: string): Promise<FetchError>;
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
/** Concatenates serialized error messages into a single string. */
|
|
69
|
+
declare function concatenateSerialisedErrorMessages(serialisedErrors: SerialisedError[]): string;
|
|
70
|
+
/** Normalizes an unknown thrown value into an {@link Error}.
|
|
71
|
+
* This function should be used at error boundaries to guarantee consistent error handling.
|
|
72
|
+
*/
|
|
73
|
+
declare function normalizeToError(value: unknown): Error;
|
|
74
|
+
/** Serializes an error and its cause chain into a flat structure.
|
|
75
|
+
* - Errors are ordered from outermost to root cause.
|
|
76
|
+
* - Cycles in the cause chain are safely ignored.
|
|
77
|
+
* - Messages are normalized to end with punctuation.
|
|
78
|
+
*/
|
|
79
|
+
declare function serialiseError(error?: unknown): SerialisedError[];
|
|
80
|
+
/** Exports */
|
|
81
|
+
export type { SerialisedError };
|
|
82
|
+
export { ApplicationError, APIError, EngineError, FetchError, OperationalError, VueHandledError, WindowHandledRuntimeError, WindowHandledPromiseRejectionError };
|
|
83
|
+
export { buildFetchError, concatenateSerialisedErrorMessages, normalizeToError, serialiseError };
|
|
@@ -46,9 +46,7 @@ export type { ConnectorInterfaceResult, ContextInterfaceResult, Engine, EngineCo
|
|
|
46
46
|
/** Interfaces/Types */
|
|
47
47
|
export type { SerialisedError } from './errors';
|
|
48
48
|
/** Errors */
|
|
49
|
-
export { APIError, ApplicationError, EngineError, FetchError, OperationalError, VueError, WindowRuntimeError, WindowPromiseRejectionError } from './errors';
|
|
50
49
|
/** Utilities */
|
|
51
|
-
export { buildFetchError, concatenateSerialisedErrorMessages, normalizeToError, serialiseError } from './errors';
|
|
52
50
|
/** Interfaces/Types - Event query. */
|
|
53
51
|
export type { EventQueryConfig, EventQueryLocalisedConfig } from './component/eventQuery';
|
|
54
52
|
/** Interfaces/Types */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.348",
|
|
4
4
|
"description": "A library containing common constants, types and utilities used across all Data Positioning projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jonathan Terrell <terrell.jm@gmail.com>",
|
|
@@ -14,15 +14,19 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/data-positioning/datapos-shared/issues"
|
|
16
16
|
},
|
|
17
|
-
"module": "./dist/datapos-shared.
|
|
17
|
+
"module": "./dist/datapos-shared.es.js",
|
|
18
18
|
"types": "./dist/types/src/index.d.ts",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
|
-
"import": "./dist/datapos-shared.
|
|
21
|
+
"import": "./dist/datapos-shared.es.js",
|
|
22
22
|
"types": "./dist/types/src/index.d.ts"
|
|
23
23
|
},
|
|
24
|
+
"./errors": {
|
|
25
|
+
"import": "./dist/datapos-shared-errors.es.js",
|
|
26
|
+
"types": "./dist/types/src/errors/index.d.ts"
|
|
27
|
+
},
|
|
24
28
|
"./utilities": {
|
|
25
|
-
"import": "./dist/datapos-shared
|
|
29
|
+
"import": "./dist/datapos-shared-utilities.es.js",
|
|
26
30
|
"types": "./dist/types/src/utilities/index.d.ts"
|
|
27
31
|
}
|
|
28
32
|
},
|
|
@@ -61,6 +65,8 @@
|
|
|
61
65
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
62
66
|
"sonda": "^0.10.1",
|
|
63
67
|
"type-fest": "^5.3.1",
|
|
68
|
+
"typedoc": "^0.28.15",
|
|
69
|
+
"typedoc-material-theme": "^1.4.1",
|
|
64
70
|
"typescript": "^5.9.3",
|
|
65
71
|
"valibot": "^1.2.0",
|
|
66
72
|
"vite": "^7.3.0",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { PreviewColumn } from './OLD_PreviewColumn';
|
|
2
|
-
export interface ParsedValue {
|
|
3
|
-
isValid: boolean;
|
|
4
|
-
value: bigint | boolean | number | string | null;
|
|
5
|
-
}
|
|
6
|
-
export declare class ContentAuditColumn extends PreviewColumn {
|
|
7
|
-
doCountIndividualValidValues: boolean;
|
|
8
|
-
doCountPatterns: boolean;
|
|
9
|
-
invalidValueCount: number;
|
|
10
|
-
invalidValues: {
|
|
11
|
-
recordNumber: number;
|
|
12
|
-
value: string;
|
|
13
|
-
}[];
|
|
14
|
-
isRequired: boolean;
|
|
15
|
-
isUnique: boolean;
|
|
16
|
-
maxDecimals: number;
|
|
17
|
-
maxSize: number;
|
|
18
|
-
maxValue: boolean | number | string | undefined;
|
|
19
|
-
minDecimals: number;
|
|
20
|
-
minSize: number;
|
|
21
|
-
minValue: boolean | number | string | undefined;
|
|
22
|
-
patterns: Record<string, number>;
|
|
23
|
-
validValueCount: number;
|
|
24
|
-
validValues: Record<string, number>;
|
|
25
|
-
voidValueCount: number;
|
|
26
|
-
constructor(dataUsageTypeId: string, label: string);
|
|
27
|
-
addInvalidValue(originalValue: string, recordNumber: number): string;
|
|
28
|
-
addValidValue(originalValue: string, parsedValue: ParsedValue, wholeDigitCount?: number, decimalDigitCount?: number): ParsedValue;
|
|
29
|
-
addVoidValue(): null;
|
|
30
|
-
finalise(): void;
|
|
31
|
-
private determineNumericPattern;
|
|
32
|
-
private determineTextPattern;
|
|
33
|
-
}
|