@makehq/forman-schema 1.9.0 → 1.9.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 +12 -1
- package/dist/index.js +12 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,6 +45,10 @@ var FORMAN_REFERENCE_TYPES = [
|
|
|
45
45
|
function isReferenceType(type) {
|
|
46
46
|
return FORMAN_REFERENCE_TYPES.includes(type);
|
|
47
47
|
}
|
|
48
|
+
var EDITABLE_TYPES = ["select", "file", "folder", "boolean"];
|
|
49
|
+
function isEditableType(type) {
|
|
50
|
+
return EDITABLE_TYPES.includes(type);
|
|
51
|
+
}
|
|
48
52
|
function noEmpty(text) {
|
|
49
53
|
return text?.trim() || void 0;
|
|
50
54
|
}
|
|
@@ -585,7 +589,8 @@ function validateFormanField(field) {
|
|
|
585
589
|
}
|
|
586
590
|
function appendQueryString(path, domain, tail) {
|
|
587
591
|
if (path.startsWith("api://")) return path;
|
|
588
|
-
const
|
|
592
|
+
const existingParams = new Set(new URL(path).searchParams.keys());
|
|
593
|
+
const queryString = tail.filter((part) => !existingParams.has(part)).map((part) => `${encodeURIComponent(part)}={{${part}}}`).join("&");
|
|
589
594
|
if (!queryString) return path;
|
|
590
595
|
const separator = path.includes("?") ? "&" : "?";
|
|
591
596
|
return `${path}${separator}${queryString}`;
|
|
@@ -1215,6 +1220,12 @@ async function validateFormanValue(value, field, context) {
|
|
|
1215
1220
|
]
|
|
1216
1221
|
};
|
|
1217
1222
|
}
|
|
1223
|
+
if (isEditableType(normalizedField.type)) {
|
|
1224
|
+
context.roots[context.domain].fieldStates.push({
|
|
1225
|
+
path: [...context.path],
|
|
1226
|
+
state: { mode: "edit" }
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1218
1229
|
return {
|
|
1219
1230
|
valid: true,
|
|
1220
1231
|
errors: []
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,10 @@ var FORMAN_REFERENCE_TYPES = [
|
|
|
16
16
|
function isReferenceType(type) {
|
|
17
17
|
return FORMAN_REFERENCE_TYPES.includes(type);
|
|
18
18
|
}
|
|
19
|
+
var EDITABLE_TYPES = ["select", "file", "folder", "boolean"];
|
|
20
|
+
function isEditableType(type) {
|
|
21
|
+
return EDITABLE_TYPES.includes(type);
|
|
22
|
+
}
|
|
19
23
|
function noEmpty(text) {
|
|
20
24
|
return text?.trim() || void 0;
|
|
21
25
|
}
|
|
@@ -556,7 +560,8 @@ function validateFormanField(field) {
|
|
|
556
560
|
}
|
|
557
561
|
function appendQueryString(path, domain, tail) {
|
|
558
562
|
if (path.startsWith("api://")) return path;
|
|
559
|
-
const
|
|
563
|
+
const existingParams = new Set(new URL(path).searchParams.keys());
|
|
564
|
+
const queryString = tail.filter((part) => !existingParams.has(part)).map((part) => `${encodeURIComponent(part)}={{${part}}}`).join("&");
|
|
560
565
|
if (!queryString) return path;
|
|
561
566
|
const separator = path.includes("?") ? "&" : "?";
|
|
562
567
|
return `${path}${separator}${queryString}`;
|
|
@@ -1186,6 +1191,12 @@ async function validateFormanValue(value, field, context) {
|
|
|
1186
1191
|
]
|
|
1187
1192
|
};
|
|
1188
1193
|
}
|
|
1194
|
+
if (isEditableType(normalizedField.type)) {
|
|
1195
|
+
context.roots[context.domain].fieldStates.push({
|
|
1196
|
+
path: [...context.path],
|
|
1197
|
+
state: { mode: "edit" }
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1189
1200
|
return {
|
|
1190
1201
|
valid: true,
|
|
1191
1202
|
errors: []
|