@jfdevelops/react-layout 0.21.0 → 0.22.2
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/create-config/create-resource-links.cjs +50 -20
- package/dist/create-config/create-resource-links.cjs.map +1 -1
- package/dist/create-config/create-resource-links.d.cts +18 -2
- package/dist/create-config/create-resource-links.d.cts.map +1 -1
- package/dist/create-config/create-resource-links.d.mts +18 -2
- package/dist/create-config/create-resource-links.d.mts.map +1 -1
- package/dist/create-config/create-resource-links.mjs +51 -20
- package/dist/create-config/create-resource-links.mjs.map +1 -1
- package/dist/create-config/define-layout.cjs +3 -2
- package/dist/create-config/define-layout.cjs.map +1 -1
- package/dist/create-config/define-layout.d.cts.map +1 -1
- package/dist/create-config/define-layout.d.mts.map +1 -1
- package/dist/create-config/define-layout.mjs +3 -2
- package/dist/create-config/define-layout.mjs.map +1 -1
- package/dist/create-config/for-paths/builder.cjs +6 -6
- package/dist/create-config/for-paths/builder.cjs.map +1 -1
- package/dist/create-config/for-paths/builder.mjs +6 -6
- package/dist/create-config/for-paths/builder.mjs.map +1 -1
- package/dist/create-config/for-resource.cjs +2 -1
- package/dist/create-config/for-resource.cjs.map +1 -1
- package/dist/create-config/for-resource.d.cts.map +1 -1
- package/dist/create-config/for-resource.d.mts.map +1 -1
- package/dist/create-config/for-resource.mjs +2 -1
- package/dist/create-config/for-resource.mjs.map +1 -1
- package/dist/create-config/for-resources/create-for-resources.cjs +15 -14
- package/dist/create-config/for-resources/create-for-resources.cjs.map +1 -1
- package/dist/create-config/for-resources/create-for-resources.mjs +15 -14
- package/dist/create-config/for-resources/create-for-resources.mjs.map +1 -1
- package/dist/create-config/index.d.cts +1 -1
- package/dist/create-config/index.d.mts +1 -1
- package/dist/errors/invalid-component.cjs +15 -7
- package/dist/errors/invalid-component.cjs.map +1 -1
- package/dist/errors/invalid-component.d.cts +106 -10
- package/dist/errors/invalid-component.d.cts.map +1 -1
- package/dist/errors/invalid-component.d.mts +106 -10
- package/dist/errors/invalid-component.d.mts.map +1 -1
- package/dist/errors/invalid-component.mjs +15 -7
- package/dist/errors/invalid-component.mjs.map +1 -1
- package/dist/errors/invalid-config.cjs +8 -3
- package/dist/errors/invalid-config.cjs.map +1 -1
- package/dist/errors/invalid-config.d.cts +96 -6
- package/dist/errors/invalid-config.d.cts.map +1 -1
- package/dist/errors/invalid-config.d.mts +96 -6
- package/dist/errors/invalid-config.d.mts.map +1 -1
- package/dist/errors/invalid-config.mjs +8 -3
- package/dist/errors/invalid-config.mjs.map +1 -1
- package/dist/errors/invalid-path.cjs +11 -5
- package/dist/errors/invalid-path.cjs.map +1 -1
- package/dist/errors/invalid-path.d.cts +100 -8
- package/dist/errors/invalid-path.d.cts.map +1 -1
- package/dist/errors/invalid-path.d.mts +100 -8
- package/dist/errors/invalid-path.d.mts.map +1 -1
- package/dist/errors/invalid-path.mjs +11 -5
- package/dist/errors/invalid-path.mjs.map +1 -1
- package/dist/errors/invalid-resource.cjs +11 -5
- package/dist/errors/invalid-resource.cjs.map +1 -1
- package/dist/errors/invalid-resource.d.cts +100 -8
- package/dist/errors/invalid-resource.d.cts.map +1 -1
- package/dist/errors/invalid-resource.d.mts +100 -8
- package/dist/errors/invalid-resource.d.mts.map +1 -1
- package/dist/errors/invalid-resource.mjs +11 -5
- package/dist/errors/invalid-resource.mjs.map +1 -1
- package/dist/errors/invalid-sub-resource.cjs +12 -5
- package/dist/errors/invalid-sub-resource.cjs.map +1 -1
- package/dist/errors/invalid-sub-resource.d.cts +103 -9
- package/dist/errors/invalid-sub-resource.d.cts.map +1 -1
- package/dist/errors/invalid-sub-resource.d.mts +103 -9
- package/dist/errors/invalid-sub-resource.d.mts.map +1 -1
- package/dist/errors/invalid-sub-resource.mjs +12 -5
- package/dist/errors/invalid-sub-resource.mjs.map +1 -1
- package/dist/errors/layout-configuration-error.cjs +17 -0
- package/dist/errors/layout-configuration-error.cjs.map +1 -0
- package/dist/errors/layout-configuration-error.d.cts +99 -0
- package/dist/errors/layout-configuration-error.d.cts.map +1 -0
- package/dist/errors/layout-configuration-error.d.mts +99 -0
- package/dist/errors/layout-configuration-error.d.mts.map +1 -0
- package/dist/errors/layout-configuration-error.mjs +17 -0
- package/dist/errors/layout-configuration-error.mjs.map +1 -0
- package/dist/errors/missing-path-variable.cjs +12 -5
- package/dist/errors/missing-path-variable.cjs.map +1 -1
- package/dist/errors/missing-path-variable.d.cts +99 -7
- package/dist/errors/missing-path-variable.d.cts.map +1 -1
- package/dist/errors/missing-path-variable.d.mts +99 -7
- package/dist/errors/missing-path-variable.d.mts.map +1 -1
- package/dist/errors/missing-path-variable.mjs +12 -5
- package/dist/errors/missing-path-variable.mjs.map +1 -1
- package/dist/errors/react-layout-error.cjs +38 -43
- package/dist/errors/react-layout-error.cjs.map +1 -1
- package/dist/errors/react-layout-error.d.cts +81 -38
- package/dist/errors/react-layout-error.d.cts.map +1 -1
- package/dist/errors/react-layout-error.d.mts +81 -38
- package/dist/errors/react-layout-error.d.mts.map +1 -1
- package/dist/errors/react-layout-error.mjs +39 -43
- package/dist/errors/react-layout-error.mjs.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +4 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +5 -4
- package/dist/node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.d.cts +107 -0
- package/dist/node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.d.mts +107 -0
- package/dist/node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.d.mts.map +1 -0
- package/dist/resource.cjs +2 -1
- package/dist/resource.cjs.map +1 -1
- package/dist/resource.d.cts.map +1 -1
- package/dist/resource.d.mts.map +1 -1
- package/dist/resource.mjs +3 -1
- package/dist/resource.mjs.map +1 -1
- package/package.json +8 -6
|
@@ -1,14 +1,106 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImplementedErrorClass } from "../node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors/invalid-path.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
/** Context describing a path that is unavailable to React Layout. */
|
|
6
|
-
interface InvalidPathContext extends ReactLayoutErrorContext<typeof scope> {
|
|
4
|
+
declare const context: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
7
5
|
path: unknown;
|
|
8
|
-
|
|
9
|
-
reason?: string;
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
scope: "path";
|
|
7
|
+
reason?: string | undefined;
|
|
8
|
+
validPaths?: string[] | undefined;
|
|
9
|
+
}, {}>;
|
|
10
|
+
type InvalidPathContext = typeof context.infer;
|
|
11
|
+
declare const InvalidPathError_base: ImplementedErrorClass<{
|
|
12
|
+
definition: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
13
|
+
code: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
}, {}>;
|
|
16
|
+
} & {
|
|
17
|
+
data: {
|
|
18
|
+
readonly property: "context";
|
|
19
|
+
readonly resolve: ({
|
|
20
|
+
definition,
|
|
21
|
+
input
|
|
22
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
23
|
+
code: string;
|
|
24
|
+
scope: string;
|
|
25
|
+
}, {}>>) => {
|
|
26
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
message: ({
|
|
30
|
+
definition,
|
|
31
|
+
data,
|
|
32
|
+
implementation
|
|
33
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
34
|
+
code: string;
|
|
35
|
+
scope: string;
|
|
36
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
37
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
38
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
39
|
+
}>;
|
|
40
|
+
} & {
|
|
41
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
42
|
+
code: string;
|
|
43
|
+
scope: string;
|
|
44
|
+
}, {}>>): {
|
|
45
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
46
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
47
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
toJSON(error: import("@jfdevelops/create-error/types").BlueprintErrorTemplate<NoInfer<{
|
|
51
|
+
data: {
|
|
52
|
+
readonly property: "context";
|
|
53
|
+
readonly resolve: ({
|
|
54
|
+
definition,
|
|
55
|
+
input
|
|
56
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
57
|
+
code: string;
|
|
58
|
+
scope: string;
|
|
59
|
+
}, {}>>) => {
|
|
60
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
message: ({
|
|
64
|
+
definition,
|
|
65
|
+
data,
|
|
66
|
+
implementation
|
|
67
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
68
|
+
code: string;
|
|
69
|
+
scope: string;
|
|
70
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
71
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
72
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
73
|
+
}>;
|
|
74
|
+
} & {
|
|
75
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
76
|
+
code: string;
|
|
77
|
+
scope: string;
|
|
78
|
+
}, {}>>): {
|
|
79
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
80
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
81
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
82
|
+
};
|
|
83
|
+
}>>): {
|
|
84
|
+
name: string;
|
|
85
|
+
code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
86
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
87
|
+
message: string;
|
|
88
|
+
context: unknown;
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
readonly code: string;
|
|
92
|
+
readonly scope: string;
|
|
93
|
+
}, {
|
|
94
|
+
path: unknown;
|
|
95
|
+
scope: "path";
|
|
96
|
+
reason?: string | undefined;
|
|
97
|
+
validPaths?: string[] | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
path: unknown;
|
|
100
|
+
scope: "path";
|
|
101
|
+
reason?: string | undefined;
|
|
102
|
+
validPaths?: string[] | undefined;
|
|
103
|
+
}>;
|
|
12
104
|
/** Thrown when a requested layout path is invalid or unavailable. */
|
|
13
105
|
declare class InvalidPathError extends InvalidPathError_base {}
|
|
14
106
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-path.d.cts","names":[],"sources":["../../src/errors/invalid-path.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"invalid-path.d.cts","names":[],"sources":["../../src/errors/invalid-path.ts"],"mappings":";;;cAGM,OAAA,gDAAO,UAAA;;;;;;KAOD,kBAAA,UAA4B,OAAA,CAAQ,KAAK;AAAA,cAAC,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGzC,gBAAA,SAAyB,qBAkBlC"}
|
|
@@ -1,14 +1,106 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImplementedErrorClass } from "../node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors/invalid-path.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
/** Context describing a path that is unavailable to React Layout. */
|
|
6
|
-
interface InvalidPathContext extends ReactLayoutErrorContext<typeof scope> {
|
|
4
|
+
declare const context: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
7
5
|
path: unknown;
|
|
8
|
-
|
|
9
|
-
reason?: string;
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
scope: "path";
|
|
7
|
+
reason?: string | undefined;
|
|
8
|
+
validPaths?: string[] | undefined;
|
|
9
|
+
}, {}>;
|
|
10
|
+
type InvalidPathContext = typeof context.infer;
|
|
11
|
+
declare const InvalidPathError_base: ImplementedErrorClass<{
|
|
12
|
+
definition: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
13
|
+
code: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
}, {}>;
|
|
16
|
+
} & {
|
|
17
|
+
data: {
|
|
18
|
+
readonly property: "context";
|
|
19
|
+
readonly resolve: ({
|
|
20
|
+
definition,
|
|
21
|
+
input
|
|
22
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
23
|
+
code: string;
|
|
24
|
+
scope: string;
|
|
25
|
+
}, {}>>) => {
|
|
26
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
message: ({
|
|
30
|
+
definition,
|
|
31
|
+
data,
|
|
32
|
+
implementation
|
|
33
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
34
|
+
code: string;
|
|
35
|
+
scope: string;
|
|
36
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
37
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
38
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
39
|
+
}>;
|
|
40
|
+
} & {
|
|
41
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
42
|
+
code: string;
|
|
43
|
+
scope: string;
|
|
44
|
+
}, {}>>): {
|
|
45
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
46
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
47
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
toJSON(error: import("@jfdevelops/create-error/types").BlueprintErrorTemplate<NoInfer<{
|
|
51
|
+
data: {
|
|
52
|
+
readonly property: "context";
|
|
53
|
+
readonly resolve: ({
|
|
54
|
+
definition,
|
|
55
|
+
input
|
|
56
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
57
|
+
code: string;
|
|
58
|
+
scope: string;
|
|
59
|
+
}, {}>>) => {
|
|
60
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
message: ({
|
|
64
|
+
definition,
|
|
65
|
+
data,
|
|
66
|
+
implementation
|
|
67
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
68
|
+
code: string;
|
|
69
|
+
scope: string;
|
|
70
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
71
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
72
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
73
|
+
}>;
|
|
74
|
+
} & {
|
|
75
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
76
|
+
code: string;
|
|
77
|
+
scope: string;
|
|
78
|
+
}, {}>>): {
|
|
79
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
80
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
81
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
82
|
+
};
|
|
83
|
+
}>>): {
|
|
84
|
+
name: string;
|
|
85
|
+
code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
86
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
87
|
+
message: string;
|
|
88
|
+
context: unknown;
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
readonly code: string;
|
|
92
|
+
readonly scope: string;
|
|
93
|
+
}, {
|
|
94
|
+
path: unknown;
|
|
95
|
+
scope: "path";
|
|
96
|
+
reason?: string | undefined;
|
|
97
|
+
validPaths?: string[] | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
path: unknown;
|
|
100
|
+
scope: "path";
|
|
101
|
+
reason?: string | undefined;
|
|
102
|
+
validPaths?: string[] | undefined;
|
|
103
|
+
}>;
|
|
12
104
|
/** Thrown when a requested layout path is invalid or unavailable. */
|
|
13
105
|
declare class InvalidPathError extends InvalidPathError_base {}
|
|
14
106
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-path.d.mts","names":[],"sources":["../../src/errors/invalid-path.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"invalid-path.d.mts","names":[],"sources":["../../src/errors/invalid-path.ts"],"mappings":";;;cAGM,OAAA,gDAAO,UAAA;;;;;;KAOD,kBAAA,UAA4B,OAAA,CAAQ,KAAK;AAAA,cAAC,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGzC,gBAAA,SAAyB,qBAkBlC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { createReactLayoutError } from "./react-layout-error.mjs";
|
|
2
|
+
import { type } from "arktype";
|
|
2
3
|
|
|
3
4
|
//#region src/errors/invalid-path.ts
|
|
4
|
-
const
|
|
5
|
+
const context = type({
|
|
6
|
+
path: "unknown",
|
|
7
|
+
"reason?": "string",
|
|
8
|
+
scope: "'path'",
|
|
9
|
+
"validPaths?": "string[]"
|
|
10
|
+
});
|
|
5
11
|
/** Thrown when a requested layout path is invalid or unavailable. */
|
|
6
12
|
var InvalidPathError = class extends createReactLayoutError({
|
|
7
13
|
code: "invalidPath",
|
|
8
|
-
scope
|
|
9
|
-
})((
|
|
10
|
-
return `[${scope}]: Path ${JSON.stringify(path) ?? `"${String(path)}"`} is not available.${reason ? ` ${reason}` : ""}${validPaths && validPaths.length > 0 ? ` Available paths are ${new Intl.ListFormat("en", {
|
|
14
|
+
scope: "path"
|
|
15
|
+
}).defineContext(context).implement(({ context, scope }) => {
|
|
16
|
+
return `[${scope}]: Path ${JSON.stringify(context.path) ?? `"${String(context.path)}"`} is not available.${context.reason ? ` ${context.reason}` : ""}${context.validPaths && context.validPaths.length > 0 ? ` Available paths are ${new Intl.ListFormat("en", {
|
|
11
17
|
style: "long",
|
|
12
18
|
type: "disjunction"
|
|
13
|
-
}).format(validPaths)}.` : ""}`;
|
|
19
|
+
}).format(context.validPaths)}.` : ""}`;
|
|
14
20
|
}) {};
|
|
15
21
|
|
|
16
22
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-path.mjs","names":[],"sources":["../../src/errors/invalid-path.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"invalid-path.mjs","names":[],"sources":["../../src/errors/invalid-path.ts"],"sourcesContent":["import { type } from 'arktype';\nimport { createReactLayoutError } from './react-layout-error';\n\nconst context = type({\n path: 'unknown',\n 'reason?': 'string',\n scope: \"'path'\",\n 'validPaths?': 'string[]',\n});\n\nexport type InvalidPathContext = typeof context.infer;\n\n/** Thrown when a requested layout path is invalid or unavailable. */\nexport class InvalidPathError extends createReactLayoutError({\n code: 'invalidPath',\n scope: 'path',\n})\n .defineContext(context)\n .implement(({ context, scope }) => {\n const quotedPath =\n JSON.stringify(context.path) ?? `\"${String(context.path)}\"`;\n const reasonMessage = context.reason ? ` ${context.reason}` : '';\n const validPathsMessage =\n context.validPaths && context.validPaths.length > 0\n ? ` Available paths are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(context.validPaths)}.`\n : '';\n\n return `[${scope}]: Path ${quotedPath} is not available.${reasonMessage}${validPathsMessage}`;\n }) {}\n"],"mappings":";;;;AAGA,MAAM,UAAU,KAAK;CACnB,MAAM;CACN,WAAW;CACX,OAAO;CACP,eAAe;AACjB,CAAC;;AAKD,IAAa,mBAAb,cAAsC,uBAAuB;CAC3D,MAAM;CACN,OAAO;AACT,CAAC,EACE,cAAc,OAAO,EACrB,WAAW,EAAE,SAAS,YAAY;CAYjC,OAAO,IAAI,MAAM,UAVf,KAAK,UAAU,QAAQ,IAAI,KAAK,IAAI,OAAO,QAAQ,IAAI,EAAE,GAUrB,oBAThB,QAAQ,SAAS,IAAI,QAAQ,WAAW,KAE5D,QAAQ,cAAc,QAAQ,WAAW,SAAS,IAC9C,wBAAwB,IAAI,KAAK,WAAW,MAAM;EAChD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,QAAQ,UAAU,EAAE,KAC9B;AAGR,CAAC,EAAE,CAAC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
const require_react_layout_error = require('./react-layout-error.cjs');
|
|
2
|
+
let arktype = require("arktype");
|
|
2
3
|
|
|
3
4
|
//#region src/errors/invalid-resource.ts
|
|
4
|
-
const
|
|
5
|
+
const context = (0, arktype.type)({
|
|
6
|
+
"reason?": "string",
|
|
7
|
+
resource: "unknown",
|
|
8
|
+
scope: "'resource'",
|
|
9
|
+
"validResources?": "string[]"
|
|
10
|
+
});
|
|
5
11
|
/** Thrown when a requested layout resource is invalid or unavailable. */
|
|
6
12
|
var InvalidResourceError = class extends require_react_layout_error.createReactLayoutError({
|
|
7
13
|
code: "invalidResource",
|
|
8
|
-
scope
|
|
9
|
-
})((
|
|
10
|
-
return `[${scope}]: Resource ${JSON.stringify(resource) ?? `"${String(resource)}"`} is not available.${reason ? ` ${reason}` : ""}${validResources && validResources.length > 0 ? ` Available resources are ${new Intl.ListFormat("en", {
|
|
14
|
+
scope: "resource"
|
|
15
|
+
}).defineContext(context).implement(({ context, scope }) => {
|
|
16
|
+
return `[${scope}]: Resource ${JSON.stringify(context.resource) ?? `"${String(context.resource)}"`} is not available.${context.reason ? ` ${context.reason}` : ""}${context.validResources && context.validResources.length > 0 ? ` Available resources are ${new Intl.ListFormat("en", {
|
|
11
17
|
style: "long",
|
|
12
18
|
type: "disjunction"
|
|
13
|
-
}).format(validResources)}.` : ""}`;
|
|
19
|
+
}).format(context.validResources)}.` : ""}`;
|
|
14
20
|
}) {};
|
|
15
21
|
|
|
16
22
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-resource.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/invalid-resource.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"invalid-resource.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/invalid-resource.ts"],"sourcesContent":["import { type } from 'arktype';\nimport { createReactLayoutError } from './react-layout-error';\n\nconst context = type({\n 'reason?': 'string',\n resource: 'unknown',\n scope: \"'resource'\",\n 'validResources?': 'string[]',\n});\n\nexport type InvalidResourceContext = typeof context.infer;\n\n/** Thrown when a requested layout resource is invalid or unavailable. */\nexport class InvalidResourceError extends createReactLayoutError({\n code: 'invalidResource',\n scope: 'resource',\n})\n .defineContext(context)\n .implement(({ context, scope }) => {\n const quotedResource =\n JSON.stringify(context.resource) ?? `\"${String(context.resource)}\"`;\n const reasonMessage = context.reason ? ` ${context.reason}` : '';\n const validResourcesMessage =\n context.validResources && context.validResources.length > 0\n ? ` Available resources are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(context.validResources)}.`\n : '';\n\n return `[${scope}]: Resource ${quotedResource} is not available.${reasonMessage}${validResourcesMessage}`;\n }) {}\n"],"mappings":";;;;AAGA,MAAM,4BAAe;CACnB,WAAW;CACX,UAAU;CACV,OAAO;CACP,mBAAmB;AACrB,CAAC;;AAKD,IAAa,uBAAb,cAA0CA,kDAAuB;CAC/D,MAAM;CACN,OAAO;AACT,CAAC,EACE,cAAc,OAAO,EACrB,WAAW,EAAE,SAAS,YAAY;CAYjC,OAAO,IAAI,MAAM,cAVf,KAAK,UAAU,QAAQ,QAAQ,KAAK,IAAI,OAAO,QAAQ,QAAQ,EAAE,GAUrB,oBATxB,QAAQ,SAAS,IAAI,QAAQ,WAAW,KAE5D,QAAQ,kBAAkB,QAAQ,eAAe,SAAS,IACtD,4BAA4B,IAAI,KAAK,WAAW,MAAM;EACpD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,QAAQ,cAAc,EAAE,KAClC;AAGR,CAAC,EAAE,CAAC"}
|
|
@@ -1,14 +1,106 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImplementedErrorClass } from "../node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors/invalid-resource.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
/** Context describing a resource that is unavailable to React Layout. */
|
|
6
|
-
interface InvalidResourceContext extends ReactLayoutErrorContext<typeof scope> {
|
|
4
|
+
declare const context: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
7
5
|
resource: unknown;
|
|
8
|
-
|
|
9
|
-
reason?: string;
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
scope: "resource";
|
|
7
|
+
reason?: string | undefined;
|
|
8
|
+
validResources?: string[] | undefined;
|
|
9
|
+
}, {}>;
|
|
10
|
+
type InvalidResourceContext = typeof context.infer;
|
|
11
|
+
declare const InvalidResourceError_base: ImplementedErrorClass<{
|
|
12
|
+
definition: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
13
|
+
code: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
}, {}>;
|
|
16
|
+
} & {
|
|
17
|
+
data: {
|
|
18
|
+
readonly property: "context";
|
|
19
|
+
readonly resolve: ({
|
|
20
|
+
definition,
|
|
21
|
+
input
|
|
22
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
23
|
+
code: string;
|
|
24
|
+
scope: string;
|
|
25
|
+
}, {}>>) => {
|
|
26
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
message: ({
|
|
30
|
+
definition,
|
|
31
|
+
data,
|
|
32
|
+
implementation
|
|
33
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
34
|
+
code: string;
|
|
35
|
+
scope: string;
|
|
36
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
37
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
38
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
39
|
+
}>;
|
|
40
|
+
} & {
|
|
41
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
42
|
+
code: string;
|
|
43
|
+
scope: string;
|
|
44
|
+
}, {}>>): {
|
|
45
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
46
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
47
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
toJSON(error: import("@jfdevelops/create-error/types").BlueprintErrorTemplate<NoInfer<{
|
|
51
|
+
data: {
|
|
52
|
+
readonly property: "context";
|
|
53
|
+
readonly resolve: ({
|
|
54
|
+
definition,
|
|
55
|
+
input
|
|
56
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
57
|
+
code: string;
|
|
58
|
+
scope: string;
|
|
59
|
+
}, {}>>) => {
|
|
60
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
message: ({
|
|
64
|
+
definition,
|
|
65
|
+
data,
|
|
66
|
+
implementation
|
|
67
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
68
|
+
code: string;
|
|
69
|
+
scope: string;
|
|
70
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
71
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
72
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
73
|
+
}>;
|
|
74
|
+
} & {
|
|
75
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
76
|
+
code: string;
|
|
77
|
+
scope: string;
|
|
78
|
+
}, {}>>): {
|
|
79
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
80
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
81
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
82
|
+
};
|
|
83
|
+
}>>): {
|
|
84
|
+
name: string;
|
|
85
|
+
code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
86
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
87
|
+
message: string;
|
|
88
|
+
context: unknown;
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
readonly code: string;
|
|
92
|
+
readonly scope: string;
|
|
93
|
+
}, {
|
|
94
|
+
resource: unknown;
|
|
95
|
+
scope: "resource";
|
|
96
|
+
reason?: string | undefined;
|
|
97
|
+
validResources?: string[] | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
resource: unknown;
|
|
100
|
+
scope: "resource";
|
|
101
|
+
reason?: string | undefined;
|
|
102
|
+
validResources?: string[] | undefined;
|
|
103
|
+
}>;
|
|
12
104
|
/** Thrown when a requested layout resource is invalid or unavailable. */
|
|
13
105
|
declare class InvalidResourceError extends InvalidResourceError_base {}
|
|
14
106
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-resource.d.cts","names":[],"sources":["../../src/errors/invalid-resource.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"invalid-resource.d.cts","names":[],"sources":["../../src/errors/invalid-resource.ts"],"mappings":";;;cAGM,OAAA,gDAAO,UAAA;;;;;;KAOD,sBAAA,UAAgC,OAAA,CAAQ,KAAK;AAAA,cAAC,yBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAG7C,oBAAA,SAA6B,yBAkBtC"}
|
|
@@ -1,14 +1,106 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImplementedErrorClass } from "../node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors/invalid-resource.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
/** Context describing a resource that is unavailable to React Layout. */
|
|
6
|
-
interface InvalidResourceContext extends ReactLayoutErrorContext<typeof scope> {
|
|
4
|
+
declare const context: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
7
5
|
resource: unknown;
|
|
8
|
-
|
|
9
|
-
reason?: string;
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
scope: "resource";
|
|
7
|
+
reason?: string | undefined;
|
|
8
|
+
validResources?: string[] | undefined;
|
|
9
|
+
}, {}>;
|
|
10
|
+
type InvalidResourceContext = typeof context.infer;
|
|
11
|
+
declare const InvalidResourceError_base: ImplementedErrorClass<{
|
|
12
|
+
definition: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
13
|
+
code: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
}, {}>;
|
|
16
|
+
} & {
|
|
17
|
+
data: {
|
|
18
|
+
readonly property: "context";
|
|
19
|
+
readonly resolve: ({
|
|
20
|
+
definition,
|
|
21
|
+
input
|
|
22
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
23
|
+
code: string;
|
|
24
|
+
scope: string;
|
|
25
|
+
}, {}>>) => {
|
|
26
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
message: ({
|
|
30
|
+
definition,
|
|
31
|
+
data,
|
|
32
|
+
implementation
|
|
33
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
34
|
+
code: string;
|
|
35
|
+
scope: string;
|
|
36
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
37
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
38
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
39
|
+
}>;
|
|
40
|
+
} & {
|
|
41
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
42
|
+
code: string;
|
|
43
|
+
scope: string;
|
|
44
|
+
}, {}>>): {
|
|
45
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
46
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
47
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
toJSON(error: import("@jfdevelops/create-error/types").BlueprintErrorTemplate<NoInfer<{
|
|
51
|
+
data: {
|
|
52
|
+
readonly property: "context";
|
|
53
|
+
readonly resolve: ({
|
|
54
|
+
definition,
|
|
55
|
+
input
|
|
56
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
57
|
+
code: string;
|
|
58
|
+
scope: string;
|
|
59
|
+
}, {}>>) => {
|
|
60
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
message: ({
|
|
64
|
+
definition,
|
|
65
|
+
data,
|
|
66
|
+
implementation
|
|
67
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
68
|
+
code: string;
|
|
69
|
+
scope: string;
|
|
70
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
71
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
72
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
73
|
+
}>;
|
|
74
|
+
} & {
|
|
75
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
76
|
+
code: string;
|
|
77
|
+
scope: string;
|
|
78
|
+
}, {}>>): {
|
|
79
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
80
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
81
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
82
|
+
};
|
|
83
|
+
}>>): {
|
|
84
|
+
name: string;
|
|
85
|
+
code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
86
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
87
|
+
message: string;
|
|
88
|
+
context: unknown;
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
readonly code: string;
|
|
92
|
+
readonly scope: string;
|
|
93
|
+
}, {
|
|
94
|
+
resource: unknown;
|
|
95
|
+
scope: "resource";
|
|
96
|
+
reason?: string | undefined;
|
|
97
|
+
validResources?: string[] | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
resource: unknown;
|
|
100
|
+
scope: "resource";
|
|
101
|
+
reason?: string | undefined;
|
|
102
|
+
validResources?: string[] | undefined;
|
|
103
|
+
}>;
|
|
12
104
|
/** Thrown when a requested layout resource is invalid or unavailable. */
|
|
13
105
|
declare class InvalidResourceError extends InvalidResourceError_base {}
|
|
14
106
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-resource.d.mts","names":[],"sources":["../../src/errors/invalid-resource.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"invalid-resource.d.mts","names":[],"sources":["../../src/errors/invalid-resource.ts"],"mappings":";;;cAGM,OAAA,gDAAO,UAAA;;;;;;KAOD,sBAAA,UAAgC,OAAA,CAAQ,KAAK;AAAA,cAAC,yBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAG7C,oBAAA,SAA6B,yBAkBtC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { createReactLayoutError } from "./react-layout-error.mjs";
|
|
2
|
+
import { type } from "arktype";
|
|
2
3
|
|
|
3
4
|
//#region src/errors/invalid-resource.ts
|
|
4
|
-
const
|
|
5
|
+
const context = type({
|
|
6
|
+
"reason?": "string",
|
|
7
|
+
resource: "unknown",
|
|
8
|
+
scope: "'resource'",
|
|
9
|
+
"validResources?": "string[]"
|
|
10
|
+
});
|
|
5
11
|
/** Thrown when a requested layout resource is invalid or unavailable. */
|
|
6
12
|
var InvalidResourceError = class extends createReactLayoutError({
|
|
7
13
|
code: "invalidResource",
|
|
8
|
-
scope
|
|
9
|
-
})((
|
|
10
|
-
return `[${scope}]: Resource ${JSON.stringify(resource) ?? `"${String(resource)}"`} is not available.${reason ? ` ${reason}` : ""}${validResources && validResources.length > 0 ? ` Available resources are ${new Intl.ListFormat("en", {
|
|
14
|
+
scope: "resource"
|
|
15
|
+
}).defineContext(context).implement(({ context, scope }) => {
|
|
16
|
+
return `[${scope}]: Resource ${JSON.stringify(context.resource) ?? `"${String(context.resource)}"`} is not available.${context.reason ? ` ${context.reason}` : ""}${context.validResources && context.validResources.length > 0 ? ` Available resources are ${new Intl.ListFormat("en", {
|
|
11
17
|
style: "long",
|
|
12
18
|
type: "disjunction"
|
|
13
|
-
}).format(validResources)}.` : ""}`;
|
|
19
|
+
}).format(context.validResources)}.` : ""}`;
|
|
14
20
|
}) {};
|
|
15
21
|
|
|
16
22
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-resource.mjs","names":[],"sources":["../../src/errors/invalid-resource.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"invalid-resource.mjs","names":[],"sources":["../../src/errors/invalid-resource.ts"],"sourcesContent":["import { type } from 'arktype';\nimport { createReactLayoutError } from './react-layout-error';\n\nconst context = type({\n 'reason?': 'string',\n resource: 'unknown',\n scope: \"'resource'\",\n 'validResources?': 'string[]',\n});\n\nexport type InvalidResourceContext = typeof context.infer;\n\n/** Thrown when a requested layout resource is invalid or unavailable. */\nexport class InvalidResourceError extends createReactLayoutError({\n code: 'invalidResource',\n scope: 'resource',\n})\n .defineContext(context)\n .implement(({ context, scope }) => {\n const quotedResource =\n JSON.stringify(context.resource) ?? `\"${String(context.resource)}\"`;\n const reasonMessage = context.reason ? ` ${context.reason}` : '';\n const validResourcesMessage =\n context.validResources && context.validResources.length > 0\n ? ` Available resources are ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(context.validResources)}.`\n : '';\n\n return `[${scope}]: Resource ${quotedResource} is not available.${reasonMessage}${validResourcesMessage}`;\n }) {}\n"],"mappings":";;;;AAGA,MAAM,UAAU,KAAK;CACnB,WAAW;CACX,UAAU;CACV,OAAO;CACP,mBAAmB;AACrB,CAAC;;AAKD,IAAa,uBAAb,cAA0C,uBAAuB;CAC/D,MAAM;CACN,OAAO;AACT,CAAC,EACE,cAAc,OAAO,EACrB,WAAW,EAAE,SAAS,YAAY;CAYjC,OAAO,IAAI,MAAM,cAVf,KAAK,UAAU,QAAQ,QAAQ,KAAK,IAAI,OAAO,QAAQ,QAAQ,EAAE,GAUrB,oBATxB,QAAQ,SAAS,IAAI,QAAQ,WAAW,KAE5D,QAAQ,kBAAkB,QAAQ,eAAe,SAAS,IACtD,4BAA4B,IAAI,KAAK,WAAW,MAAM;EACpD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,QAAQ,cAAc,EAAE,KAClC;AAGR,CAAC,EAAE,CAAC"}
|