@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"missing-path-variable.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/missing-path-variable.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"missing-path-variable.cjs","names":["createReactLayoutError"],"sources":["../../src/errors/missing-path-variable.ts"],"sourcesContent":["import { type } from 'arktype';\nimport { createReactLayoutError } from './react-layout-error';\n\nconst context = type({\n path: 'string',\n 'providedVariables?': 'string[]',\n scope: \"'pathVariable'\",\n variable: 'string',\n});\n\nexport type MissingPathVariableContext = typeof context.infer;\n\n/** Thrown when a required layout path variable was not provided. */\nexport class MissingPathVariableError extends createReactLayoutError({\n code: 'missingPathVariable',\n scope: 'pathVariable',\n})\n .defineContext(context)\n .implement(({ context, scope }) => {\n const providedMessage =\n context.providedVariables && context.providedVariables.length > 0\n ? ` Provided variables were ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(context.providedVariables.map((provided) => `$${provided}`))}.`\n : ' No path variables were provided.';\n\n return `[${scope}]: Path \"${context.path}\" requires $${context.variable}.${providedMessage}`;\n }) {}\n"],"mappings":";;;;AAGA,MAAM,4BAAe;CACnB,MAAM;CACN,sBAAsB;CACtB,OAAO;CACP,UAAU;AACZ,CAAC;;AAKD,IAAa,2BAAb,cAA8CA,kDAAuB;CACnE,MAAM;CACN,OAAO;AACT,CAAC,EACE,cAAc,OAAO,EACrB,WAAW,EAAE,SAAS,YAAY;CACjC,MAAM,kBACJ,QAAQ,qBAAqB,QAAQ,kBAAkB,SAAS,IAC5D,4BAA4B,IAAI,KAAK,WAAW,MAAM;EACpD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,QAAQ,kBAAkB,KAAK,aAAa,IAAI,UAAU,CAAC,EAAE,KACvE;CAEN,OAAO,IAAI,MAAM,WAAW,QAAQ,KAAK,cAAc,QAAQ,SAAS,GAAG;AAC7E,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/missing-path-variable.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
declare const context: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
|
+
path: string;
|
|
6
|
+
scope: "pathVariable";
|
|
7
|
+
variable: string;
|
|
8
|
+
providedVariables?: string[] | undefined;
|
|
9
|
+
}, {}>;
|
|
10
|
+
type MissingPathVariableContext = typeof context.infer;
|
|
11
|
+
declare const MissingPathVariableError_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: string;
|
|
95
|
+
scope: "pathVariable";
|
|
7
96
|
variable: string;
|
|
97
|
+
providedVariables?: string[] | undefined;
|
|
98
|
+
}, {
|
|
8
99
|
path: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
100
|
+
scope: "pathVariable";
|
|
101
|
+
variable: string;
|
|
102
|
+
providedVariables?: string[] | undefined;
|
|
103
|
+
}>;
|
|
12
104
|
/** Thrown when a required layout path variable was not provided. */
|
|
13
105
|
declare class MissingPathVariableError extends MissingPathVariableError_base {}
|
|
14
106
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"missing-path-variable.d.cts","names":[],"sources":["../../src/errors/missing-path-variable.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"missing-path-variable.d.cts","names":[],"sources":["../../src/errors/missing-path-variable.ts"],"mappings":";;;cAGM,OAAA,gDAAO,UAAA;;;;;;KAOD,0BAAA,UAAoC,OAAA,CAAQ,KAAK;AAAA,cAAC,6BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGjD,wBAAA,SAAiC,6BAe1C"}
|
|
@@ -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/missing-path-variable.d.ts
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
declare const context: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
|
+
path: string;
|
|
6
|
+
scope: "pathVariable";
|
|
7
|
+
variable: string;
|
|
8
|
+
providedVariables?: string[] | undefined;
|
|
9
|
+
}, {}>;
|
|
10
|
+
type MissingPathVariableContext = typeof context.infer;
|
|
11
|
+
declare const MissingPathVariableError_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: string;
|
|
95
|
+
scope: "pathVariable";
|
|
7
96
|
variable: string;
|
|
97
|
+
providedVariables?: string[] | undefined;
|
|
98
|
+
}, {
|
|
8
99
|
path: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
100
|
+
scope: "pathVariable";
|
|
101
|
+
variable: string;
|
|
102
|
+
providedVariables?: string[] | undefined;
|
|
103
|
+
}>;
|
|
12
104
|
/** Thrown when a required layout path variable was not provided. */
|
|
13
105
|
declare class MissingPathVariableError extends MissingPathVariableError_base {}
|
|
14
106
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"missing-path-variable.d.mts","names":[],"sources":["../../src/errors/missing-path-variable.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"missing-path-variable.d.mts","names":[],"sources":["../../src/errors/missing-path-variable.ts"],"mappings":";;;cAGM,OAAA,gDAAO,UAAA;;;;;;KAOD,0BAAA,UAAoC,OAAA,CAAQ,KAAK;AAAA,cAAC,6BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGjD,wBAAA,SAAiC,6BAe1C"}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { createReactLayoutError } from "./react-layout-error.mjs";
|
|
2
|
+
import { type } from "arktype";
|
|
2
3
|
|
|
3
4
|
//#region src/errors/missing-path-variable.ts
|
|
4
|
-
const
|
|
5
|
+
const context = type({
|
|
6
|
+
path: "string",
|
|
7
|
+
"providedVariables?": "string[]",
|
|
8
|
+
scope: "'pathVariable'",
|
|
9
|
+
variable: "string"
|
|
10
|
+
});
|
|
5
11
|
/** Thrown when a required layout path variable was not provided. */
|
|
6
12
|
var MissingPathVariableError = class extends createReactLayoutError({
|
|
7
13
|
code: "missingPathVariable",
|
|
8
|
-
scope
|
|
9
|
-
})((
|
|
10
|
-
|
|
14
|
+
scope: "pathVariable"
|
|
15
|
+
}).defineContext(context).implement(({ context, scope }) => {
|
|
16
|
+
const providedMessage = context.providedVariables && context.providedVariables.length > 0 ? ` Provided variables were ${new Intl.ListFormat("en", {
|
|
11
17
|
style: "long",
|
|
12
18
|
type: "disjunction"
|
|
13
|
-
}).format(providedVariables.map((provided) => `$${provided}`))}.` : " No path variables were provided."
|
|
19
|
+
}).format(context.providedVariables.map((provided) => `$${provided}`))}.` : " No path variables were provided.";
|
|
20
|
+
return `[${scope}]: Path "${context.path}" requires $${context.variable}.${providedMessage}`;
|
|
14
21
|
}) {};
|
|
15
22
|
|
|
16
23
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"missing-path-variable.mjs","names":[],"sources":["../../src/errors/missing-path-variable.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"missing-path-variable.mjs","names":[],"sources":["../../src/errors/missing-path-variable.ts"],"sourcesContent":["import { type } from 'arktype';\nimport { createReactLayoutError } from './react-layout-error';\n\nconst context = type({\n path: 'string',\n 'providedVariables?': 'string[]',\n scope: \"'pathVariable'\",\n variable: 'string',\n});\n\nexport type MissingPathVariableContext = typeof context.infer;\n\n/** Thrown when a required layout path variable was not provided. */\nexport class MissingPathVariableError extends createReactLayoutError({\n code: 'missingPathVariable',\n scope: 'pathVariable',\n})\n .defineContext(context)\n .implement(({ context, scope }) => {\n const providedMessage =\n context.providedVariables && context.providedVariables.length > 0\n ? ` Provided variables were ${new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n }).format(context.providedVariables.map((provided) => `$${provided}`))}.`\n : ' No path variables were provided.';\n\n return `[${scope}]: Path \"${context.path}\" requires $${context.variable}.${providedMessage}`;\n }) {}\n"],"mappings":";;;;AAGA,MAAM,UAAU,KAAK;CACnB,MAAM;CACN,sBAAsB;CACtB,OAAO;CACP,UAAU;AACZ,CAAC;;AAKD,IAAa,2BAAb,cAA8C,uBAAuB;CACnE,MAAM;CACN,OAAO;AACT,CAAC,EACE,cAAc,OAAO,EACrB,WAAW,EAAE,SAAS,YAAY;CACjC,MAAM,kBACJ,QAAQ,qBAAqB,QAAQ,kBAAkB,SAAS,IAC5D,4BAA4B,IAAI,KAAK,WAAW,MAAM;EACpD,OAAO;EACP,MAAM;CACR,CAAC,EAAE,OAAO,QAAQ,kBAAkB,KAAK,aAAa,IAAI,UAAU,CAAC,EAAE,KACvE;CAEN,OAAO,IAAI,MAAM,WAAW,QAAQ,KAAK,cAAc,QAAQ,SAAS,GAAG;AAC7E,CAAC,EAAE,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
let _jfdevelops_create_error = require("@jfdevelops/create-error");
|
|
2
|
+
let arktype = require("arktype");
|
|
1
3
|
|
|
2
4
|
//#region src/errors/react-layout-error.ts
|
|
3
5
|
function makeJsonSafe(value) {
|
|
@@ -6,49 +8,42 @@ function makeJsonSafe(value) {
|
|
|
6
8
|
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, nestedValue]) => [key, makeJsonSafe(nestedValue)]));
|
|
7
9
|
return value;
|
|
8
10
|
}
|
|
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
|
-
renderMessage(renderer) {
|
|
47
|
-
return (renderer ?? defaultRenderer)(this.scope, this.context);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
}
|
|
11
|
+
/** @internal */
|
|
12
|
+
const createReactLayoutError = (0, _jfdevelops_create_error.createError)({
|
|
13
|
+
definition: (0, arktype.type)({
|
|
14
|
+
code: "string",
|
|
15
|
+
scope: "string"
|
|
16
|
+
}),
|
|
17
|
+
data: {
|
|
18
|
+
property: "context",
|
|
19
|
+
resolve: ({ definition, input }) => typeof input === "object" && input !== null ? {
|
|
20
|
+
...input,
|
|
21
|
+
scope: definition.scope
|
|
22
|
+
} : input
|
|
23
|
+
},
|
|
24
|
+
message: ({ definition, data, implementation }) => implementation({
|
|
25
|
+
context: data,
|
|
26
|
+
scope: definition.scope
|
|
27
|
+
}),
|
|
28
|
+
properties: ({ definition, data, implementation }) => ({
|
|
29
|
+
code: definition.code,
|
|
30
|
+
scope: definition.scope,
|
|
31
|
+
renderMessage(renderer = (scope, context) => implementation({
|
|
32
|
+
context,
|
|
33
|
+
scope
|
|
34
|
+
})) {
|
|
35
|
+
return renderer(definition.scope, data);
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
toJSON: (error) => ({
|
|
39
|
+
name: error.name,
|
|
40
|
+
code: error.code,
|
|
41
|
+
scope: error.scope,
|
|
42
|
+
message: error.message,
|
|
43
|
+
context: makeJsonSafe(error.context)
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
const ReactLayoutError = createReactLayoutError.Error;
|
|
52
47
|
|
|
53
48
|
//#endregion
|
|
54
49
|
exports.ReactLayoutError = ReactLayoutError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-layout-error.cjs","names":[],"sources":["../../src/errors/react-layout-error.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"react-layout-error.cjs","names":[],"sources":["../../src/errors/react-layout-error.ts"],"sourcesContent":["import { createError } from '@jfdevelops/create-error';\nimport { type } from 'arktype';\n\nfunction makeJsonSafe(value: unknown): unknown {\n if (value === undefined) {\n return null;\n }\n\n if (Array.isArray(value)) {\n return value.map(makeJsonSafe);\n }\n\n if (value && typeof value === 'object') {\n return Object.fromEntries(\n Object.entries(value).map(([key, nestedValue]) => [\n key,\n makeJsonSafe(nestedValue),\n ]),\n );\n }\n\n return value;\n}\n\n/** @internal */\nexport const createReactLayoutError = createError({\n definition: type({ code: 'string', scope: 'string' }),\n data: {\n property: 'context',\n resolve: ({ definition, input }) =>\n typeof input === 'object' && input !== null\n ? { ...input, scope: definition.scope }\n : input,\n },\n message: ({ definition, data, implementation }) =>\n implementation({ context: data, scope: definition.scope }),\n properties: ({ definition, data, implementation }) => ({\n code: definition.code,\n scope: definition.scope,\n renderMessage(\n renderer: (\n scope: typeof definition.scope,\n context: typeof data,\n ) => string = (scope, context) => implementation({ context, scope }),\n ) {\n return renderer(definition.scope, data);\n },\n }),\n toJSON: (error) => ({\n name: error.name,\n code: error.code,\n scope: error.scope,\n message: error.message,\n context: makeJsonSafe(error.context),\n }),\n});\n\nexport const ReactLayoutError = createReactLayoutError.Error;\n"],"mappings":";;;;AAGA,SAAS,aAAa,OAAyB;CAC7C,IAAI,UAAU,QACZ,OAAO;CAGT,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,IAAI,YAAY;CAG/B,IAAI,SAAS,OAAO,UAAU,UAC5B,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,EAAE,KAAK,CAAC,KAAK,iBAAiB,CAChD,KACA,aAAa,WAAW,CAC1B,CAAC,CACH;CAGF,OAAO;AACT;;AAGA,MAAa,mEAAqC;CAChD,8BAAiB;EAAE,MAAM;EAAU,OAAO;CAAS,CAAC;CACpD,MAAM;EACJ,UAAU;EACV,UAAU,EAAE,YAAY,YACtB,OAAO,UAAU,YAAY,UAAU,OACnC;GAAE,GAAG;GAAO,OAAO,WAAW;EAAM,IACpC;CACR;CACA,UAAU,EAAE,YAAY,MAAM,qBAC5B,eAAe;EAAE,SAAS;EAAM,OAAO,WAAW;CAAM,CAAC;CAC3D,aAAa,EAAE,YAAY,MAAM,sBAAsB;EACrD,MAAM,WAAW;EACjB,OAAO,WAAW;EAClB,cACE,YAGe,OAAO,YAAY,eAAe;GAAE;GAAS;EAAM,CAAC,GACnE;GACA,OAAO,SAAS,WAAW,OAAO,IAAI;EACxC;CACF;CACA,SAAS,WAAW;EAClB,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,SAAS,MAAM;EACf,SAAS,aAAa,MAAM,OAAO;CACrC;AACF,CAAC;AAED,MAAa,mBAAmB,uBAAuB"}
|
|
@@ -1,46 +1,89 @@
|
|
|
1
|
+
import { FamilyErrorClass } from "../node_modules/.pnpm/@jfdevelops_create-error@0.2.0_patch_hash_afc71b16c3f866f54416d30f467784ddc31736feb04f281a5fc4772ea422f4a9/node_modules/@jfdevelops/create-error/dist/types.cjs";
|
|
2
|
+
|
|
1
3
|
//#region src/errors/react-layout-error.d.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
declare const ReactLayoutError: FamilyErrorClass<import("@jfdevelops/create-error/types").FamilyError<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
|
+
code: string;
|
|
6
|
+
scope: string;
|
|
7
|
+
}, {}>, {
|
|
8
|
+
definition: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
9
|
+
code: string;
|
|
10
|
+
scope: string;
|
|
11
|
+
}, {}>;
|
|
12
|
+
} & {
|
|
13
|
+
data: {
|
|
14
|
+
readonly property: "context";
|
|
15
|
+
readonly resolve: ({
|
|
16
|
+
definition,
|
|
17
|
+
input
|
|
18
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
19
|
+
code: string;
|
|
20
|
+
scope: string;
|
|
21
|
+
}, {}>>) => {
|
|
22
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
23
|
+
};
|
|
20
24
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
message: ({
|
|
26
|
+
definition,
|
|
27
|
+
data,
|
|
28
|
+
implementation
|
|
29
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
30
|
+
code: string;
|
|
31
|
+
scope: string;
|
|
32
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
33
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
34
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
35
|
+
}>;
|
|
36
|
+
} & {
|
|
37
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
38
|
+
code: string;
|
|
39
|
+
scope: string;
|
|
40
|
+
}, {}>>): {
|
|
41
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
42
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
43
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
44
|
+
};
|
|
45
|
+
} & {
|
|
46
|
+
toJSON(error: import("@jfdevelops/create-error/types").BlueprintErrorTemplate<NoInfer<{
|
|
47
|
+
data: {
|
|
48
|
+
readonly property: "context";
|
|
49
|
+
readonly resolve: ({
|
|
50
|
+
definition,
|
|
51
|
+
input
|
|
52
|
+
}: import("@jfdevelops/create-error/types").ResolveContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
53
|
+
code: string;
|
|
54
|
+
scope: string;
|
|
55
|
+
}, {}>>) => {
|
|
56
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
message: ({
|
|
60
|
+
definition,
|
|
61
|
+
data,
|
|
62
|
+
implementation
|
|
63
|
+
}: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
64
|
+
code: string;
|
|
65
|
+
scope: string;
|
|
66
|
+
}, {}>>) => string & import("@jfdevelops/create-error/types").TypeSlot<"implementationArgument", {
|
|
67
|
+
readonly context: import("@jfdevelops/create-error/types").DataSlot;
|
|
68
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
69
|
+
}>;
|
|
70
|
+
} & {
|
|
71
|
+
properties(context: import("@jfdevelops/create-error/types").BlueprintContext<import("arktype/internal/variants/object.ts").ObjectType<{
|
|
72
|
+
code: string;
|
|
73
|
+
scope: string;
|
|
74
|
+
}, {}>>): {
|
|
75
|
+
readonly code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
76
|
+
readonly scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
77
|
+
readonly renderMessage: (renderer?: (scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">, context: import("@jfdevelops/create-error/types").DataSlot) => string) => string;
|
|
78
|
+
};
|
|
79
|
+
}>>): {
|
|
35
80
|
name: string;
|
|
36
|
-
code:
|
|
37
|
-
scope:
|
|
81
|
+
code: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "code">;
|
|
82
|
+
scope: string & import("@jfdevelops/create-error/types").TypeSlot<"definition", "scope">;
|
|
38
83
|
message: string;
|
|
39
84
|
context: unknown;
|
|
40
85
|
};
|
|
41
|
-
}
|
|
42
|
-
/** Creates a context-only React Layout error class with a default renderer. */
|
|
43
|
-
declare function createReactLayoutError<const Options extends CreateReactLayoutErrorOptions>(options: Options): ReactLayoutErrorRendererFactory<Options['code'], Options['scope']>;
|
|
86
|
+
}>>;
|
|
44
87
|
//#endregion
|
|
45
|
-
export {
|
|
88
|
+
export { ReactLayoutError };
|
|
46
89
|
//# sourceMappingURL=react-layout-error.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-layout-error.d.cts","names":[],"sources":["../../src/errors/react-layout-error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"react-layout-error.d.cts","names":[],"sources":["../../src/errors/react-layout-error.ts"],"mappings":";;;cAyDa,gBAAA,4DAAgB,WAAA,+CAAA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAhBrB,KAAA,oDAAK,QAAA,yBACL,OAAA,2CAAO,QAAA;EAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CADP,KAAA,oDAAK,QAAA,yBACL,OAAA,2CAAO,QAAA;IAAA;EAAA"}
|