@ekomerc/storefront 0.1.2 → 0.1.3
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/dist/README.md +679 -0
- package/dist/errors.d.cts +74 -0
- package/dist/errors.d.ts +74 -80
- package/dist/index.d.cts +1493 -0
- package/dist/index.d.ts +1493 -1603
- package/dist/package.json +45 -0
- package/dist/types.d.cts +656 -0
- package/dist/types.d.ts +656 -1
- package/package.json +8 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all Storefront SDK errors
|
|
3
|
+
*/
|
|
4
|
+
declare class StorefrontError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
constructor(message: string, code: string, options?: {
|
|
7
|
+
cause?: Error;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Network error - fetch failed, connection issues
|
|
12
|
+
*/
|
|
13
|
+
declare class NetworkError extends StorefrontError {
|
|
14
|
+
constructor(message: string, options?: {
|
|
15
|
+
cause?: Error;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Authentication error - invalid/revoked API key, 401/403 responses
|
|
20
|
+
*/
|
|
21
|
+
declare class AuthError extends StorefrontError {
|
|
22
|
+
constructor(message: string, options?: {
|
|
23
|
+
cause?: Error;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Validation error - userErrors from mutations
|
|
28
|
+
*/
|
|
29
|
+
declare class ValidationError extends StorefrontError {
|
|
30
|
+
readonly userErrors: Array<{
|
|
31
|
+
field: string | null;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
constructor(message: string, userErrors: Array<{
|
|
35
|
+
field: string | null;
|
|
36
|
+
message: string;
|
|
37
|
+
}>, options?: {
|
|
38
|
+
cause?: Error;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Not found error - resource doesn't exist
|
|
43
|
+
*/
|
|
44
|
+
declare class NotFoundError extends StorefrontError {
|
|
45
|
+
constructor(message: string, options?: {
|
|
46
|
+
cause?: Error;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* State error - invalid cart state transition
|
|
51
|
+
*/
|
|
52
|
+
declare class StateError extends StorefrontError {
|
|
53
|
+
readonly state: string;
|
|
54
|
+
constructor(message: string, state: string, options?: {
|
|
55
|
+
cause?: Error;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* GraphQL error - unexpected GraphQL errors
|
|
60
|
+
*/
|
|
61
|
+
declare class GraphQLError extends StorefrontError {
|
|
62
|
+
readonly graphqlErrors: Array<{
|
|
63
|
+
message: string;
|
|
64
|
+
path?: readonly (string | number)[];
|
|
65
|
+
}>;
|
|
66
|
+
constructor(message: string, graphqlErrors: Array<{
|
|
67
|
+
message: string;
|
|
68
|
+
path?: readonly (string | number)[];
|
|
69
|
+
}>, options?: {
|
|
70
|
+
cause?: Error;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { AuthError, GraphQLError, NetworkError, NotFoundError, StateError, StorefrontError, ValidationError };
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,80 +1,74 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}>, options?: {
|
|
76
|
-
cause?: Error;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { }
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all Storefront SDK errors
|
|
3
|
+
*/
|
|
4
|
+
declare class StorefrontError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
constructor(message: string, code: string, options?: {
|
|
7
|
+
cause?: Error;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Network error - fetch failed, connection issues
|
|
12
|
+
*/
|
|
13
|
+
declare class NetworkError extends StorefrontError {
|
|
14
|
+
constructor(message: string, options?: {
|
|
15
|
+
cause?: Error;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Authentication error - invalid/revoked API key, 401/403 responses
|
|
20
|
+
*/
|
|
21
|
+
declare class AuthError extends StorefrontError {
|
|
22
|
+
constructor(message: string, options?: {
|
|
23
|
+
cause?: Error;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Validation error - userErrors from mutations
|
|
28
|
+
*/
|
|
29
|
+
declare class ValidationError extends StorefrontError {
|
|
30
|
+
readonly userErrors: Array<{
|
|
31
|
+
field: string | null;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
constructor(message: string, userErrors: Array<{
|
|
35
|
+
field: string | null;
|
|
36
|
+
message: string;
|
|
37
|
+
}>, options?: {
|
|
38
|
+
cause?: Error;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Not found error - resource doesn't exist
|
|
43
|
+
*/
|
|
44
|
+
declare class NotFoundError extends StorefrontError {
|
|
45
|
+
constructor(message: string, options?: {
|
|
46
|
+
cause?: Error;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* State error - invalid cart state transition
|
|
51
|
+
*/
|
|
52
|
+
declare class StateError extends StorefrontError {
|
|
53
|
+
readonly state: string;
|
|
54
|
+
constructor(message: string, state: string, options?: {
|
|
55
|
+
cause?: Error;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* GraphQL error - unexpected GraphQL errors
|
|
60
|
+
*/
|
|
61
|
+
declare class GraphQLError extends StorefrontError {
|
|
62
|
+
readonly graphqlErrors: Array<{
|
|
63
|
+
message: string;
|
|
64
|
+
path?: readonly (string | number)[];
|
|
65
|
+
}>;
|
|
66
|
+
constructor(message: string, graphqlErrors: Array<{
|
|
67
|
+
message: string;
|
|
68
|
+
path?: readonly (string | number)[];
|
|
69
|
+
}>, options?: {
|
|
70
|
+
cause?: Error;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { AuthError, GraphQLError, NetworkError, NotFoundError, StateError, StorefrontError, ValidationError };
|