@makehq/forman-schema 1.2.1 → 1.2.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/index.cjs +7 -2
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,9 +35,14 @@ function isObject(value) {
|
|
|
35
35
|
|
|
36
36
|
// src/forman.ts
|
|
37
37
|
var SchemaConversionError = class extends Error {
|
|
38
|
+
/** Field that caused the error */
|
|
39
|
+
field;
|
|
40
|
+
/**
|
|
41
|
+
* @param message The error message
|
|
42
|
+
* @param field The field that caused the error
|
|
43
|
+
*/
|
|
38
44
|
constructor(message, field) {
|
|
39
45
|
super(message);
|
|
40
|
-
this.field = field;
|
|
41
46
|
this.name = "SchemaConversionError";
|
|
42
47
|
}
|
|
43
48
|
};
|
|
@@ -292,7 +297,7 @@ function handleSelectType(field, result, context) {
|
|
|
292
297
|
configurable: true,
|
|
293
298
|
enumerable: true,
|
|
294
299
|
writable: true,
|
|
295
|
-
value: typeof nested === "string" ? { $ref: nested } : toJSONSchemaInternal(
|
|
300
|
+
value: typeof nested === "string" ? { $ref: appendQueryString(nested, context.domain, [...context.tail, field.name]) } : toJSONSchemaInternal(
|
|
296
301
|
{ type: "collection", spec: nested },
|
|
297
302
|
{
|
|
298
303
|
...context,
|
package/dist/index.d.cts
CHANGED
|
@@ -48,7 +48,13 @@ type FormanSchemaField = {
|
|
|
48
48
|
/** Validation rules */
|
|
49
49
|
validate?: FormanSchemaValidation;
|
|
50
50
|
} & Record<`x-${string}`, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Valid Forman Schema values
|
|
53
|
+
*/
|
|
51
54
|
type FormanSchemaValue = string | number | boolean | null;
|
|
55
|
+
/**
|
|
56
|
+
* Option for a select field
|
|
57
|
+
*/
|
|
52
58
|
type FormanSchemaOption = {
|
|
53
59
|
/** Option value */
|
|
54
60
|
value: FormanSchemaValue;
|
|
@@ -57,15 +63,26 @@ type FormanSchemaOption = {
|
|
|
57
63
|
/** Nested fields for this option */
|
|
58
64
|
nested?: FormanSchemaNested;
|
|
59
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Extended options for a select field
|
|
68
|
+
*/
|
|
60
69
|
type FormanSchemaExtendedOptions = {
|
|
61
70
|
/** Store for the options */
|
|
62
71
|
store: FormanSchemaOption[] | string;
|
|
63
72
|
/** Nested fields for every option */
|
|
64
73
|
nested?: FormanSchemaNested;
|
|
65
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Nested fields
|
|
77
|
+
*/
|
|
66
78
|
type FormanSchemaNested = FormanSchemaField[] | string | FormanSchemaExtendedNested;
|
|
79
|
+
/**
|
|
80
|
+
* Extended nested fields
|
|
81
|
+
*/
|
|
67
82
|
type FormanSchemaExtendedNested = {
|
|
83
|
+
/** Store for the nested fields */
|
|
68
84
|
store: FormanSchemaField[] | string;
|
|
85
|
+
/** Domain for the nested fields */
|
|
69
86
|
domain?: string;
|
|
70
87
|
};
|
|
71
88
|
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,13 @@ type FormanSchemaField = {
|
|
|
48
48
|
/** Validation rules */
|
|
49
49
|
validate?: FormanSchemaValidation;
|
|
50
50
|
} & Record<`x-${string}`, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Valid Forman Schema values
|
|
53
|
+
*/
|
|
51
54
|
type FormanSchemaValue = string | number | boolean | null;
|
|
55
|
+
/**
|
|
56
|
+
* Option for a select field
|
|
57
|
+
*/
|
|
52
58
|
type FormanSchemaOption = {
|
|
53
59
|
/** Option value */
|
|
54
60
|
value: FormanSchemaValue;
|
|
@@ -57,15 +63,26 @@ type FormanSchemaOption = {
|
|
|
57
63
|
/** Nested fields for this option */
|
|
58
64
|
nested?: FormanSchemaNested;
|
|
59
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Extended options for a select field
|
|
68
|
+
*/
|
|
60
69
|
type FormanSchemaExtendedOptions = {
|
|
61
70
|
/** Store for the options */
|
|
62
71
|
store: FormanSchemaOption[] | string;
|
|
63
72
|
/** Nested fields for every option */
|
|
64
73
|
nested?: FormanSchemaNested;
|
|
65
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Nested fields
|
|
77
|
+
*/
|
|
66
78
|
type FormanSchemaNested = FormanSchemaField[] | string | FormanSchemaExtendedNested;
|
|
79
|
+
/**
|
|
80
|
+
* Extended nested fields
|
|
81
|
+
*/
|
|
67
82
|
type FormanSchemaExtendedNested = {
|
|
83
|
+
/** Store for the nested fields */
|
|
68
84
|
store: FormanSchemaField[] | string;
|
|
85
|
+
/** Domain for the nested fields */
|
|
69
86
|
domain?: string;
|
|
70
87
|
};
|
|
71
88
|
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,14 @@ function isObject(value) {
|
|
|
8
8
|
|
|
9
9
|
// src/forman.ts
|
|
10
10
|
var SchemaConversionError = class extends Error {
|
|
11
|
+
/** Field that caused the error */
|
|
12
|
+
field;
|
|
13
|
+
/**
|
|
14
|
+
* @param message The error message
|
|
15
|
+
* @param field The field that caused the error
|
|
16
|
+
*/
|
|
11
17
|
constructor(message, field) {
|
|
12
18
|
super(message);
|
|
13
|
-
this.field = field;
|
|
14
19
|
this.name = "SchemaConversionError";
|
|
15
20
|
}
|
|
16
21
|
};
|
|
@@ -265,7 +270,7 @@ function handleSelectType(field, result, context) {
|
|
|
265
270
|
configurable: true,
|
|
266
271
|
enumerable: true,
|
|
267
272
|
writable: true,
|
|
268
|
-
value: typeof nested === "string" ? { $ref: nested } : toJSONSchemaInternal(
|
|
273
|
+
value: typeof nested === "string" ? { $ref: appendQueryString(nested, context.domain, [...context.tail, field.name]) } : toJSONSchemaInternal(
|
|
269
274
|
{ type: "collection", spec: nested },
|
|
270
275
|
{
|
|
271
276
|
...context,
|