@makehq/forman-schema 1.13.0 → 1.13.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/README.md CHANGED
@@ -185,6 +185,7 @@ const result = await validateFormanWithDomains(
185
185
  - email → string
186
186
  - file → string
187
187
  - filename → string
188
+ - filestorage → array (of UUID strings)
188
189
  - filter → array
189
190
  - folder → string
190
191
  - hidden → string
@@ -196,6 +197,7 @@ const result = await validateFormanWithDomains(
196
197
  - path → string
197
198
  - pkey → string
198
199
  - port → number
200
+ - scenario → string
199
201
  - select → string with enum
200
202
  - text → string
201
203
  - time → string
package/dist/index.cjs CHANGED
@@ -567,6 +567,7 @@ var FORMAN_TYPE_MAP = {
567
567
  email: "string",
568
568
  filename: "string",
569
569
  file: "string",
570
+ filestorage: "array",
570
571
  filter: "array",
571
572
  folder: "string",
572
573
  hidden: void 0,
@@ -578,6 +579,7 @@ var FORMAN_TYPE_MAP = {
578
579
  port: "number",
579
580
  list: "string",
580
581
  radio: "string",
582
+ scenario: "string",
581
583
  select: "string",
582
584
  udttype: "string",
583
585
  udtspec: "array",
@@ -667,6 +669,7 @@ function toJSONSchemaInternal(field, context) {
667
669
  case "dynamicCollection":
668
670
  return handleCollectionType(normalizedField, result, context);
669
671
  case "array":
672
+ case "filestorage":
670
673
  return handleArrayType(normalizedField, result, context);
671
674
  case "list":
672
675
  case "radio":
@@ -677,6 +680,7 @@ function toJSONSchemaInternal(field, context) {
677
680
  case "keychain":
678
681
  case "datastore":
679
682
  case "aiagent":
683
+ case "scenario":
680
684
  case "file":
681
685
  case "folder":
682
686
  return handleSelectOrPathType(normalizedField, result, context);
@@ -745,7 +749,15 @@ function handleCollectionType(field, result, context) {
745
749
  return result;
746
750
  }
747
751
  function handleArrayType(field, result, context) {
748
- if (field.spec) {
752
+ if (field.type === "filestorage") {
753
+ result.items = { type: "string" };
754
+ Object.defineProperty(result, "x-filestorage", {
755
+ configurable: true,
756
+ enumerable: false,
757
+ writable: true,
758
+ value: true
759
+ });
760
+ } else if (field.spec) {
749
761
  result.items = toJSONSchemaInternal(
750
762
  Array.isArray(field.spec) ? { type: "collection", spec: field.spec } : field.spec,
751
763
  {
@@ -1187,6 +1199,8 @@ var FORMAN_TYPE_MAP2 = {
1187
1199
  timestamp: "string",
1188
1200
  timezone: "string",
1189
1201
  upload: "array",
1202
+ filestorage: "array",
1203
+ scenario: "string",
1190
1204
  url: "string",
1191
1205
  uuid: "string",
1192
1206
  any: void 0
@@ -1390,6 +1404,7 @@ async function validateFormanValue(value, field, context) {
1390
1404
  case "collection":
1391
1405
  return handleCollectionType2(value, normalizedField, context);
1392
1406
  case "array":
1407
+ case "filestorage":
1393
1408
  return handleArrayType2(value, normalizedField, context);
1394
1409
  case "list":
1395
1410
  case "radio":
@@ -2084,6 +2099,14 @@ function toFormanSchema(field) {
2084
2099
  spec
2085
2100
  };
2086
2101
  case "array":
2102
+ const filestorageMarker = Object.getOwnPropertyDescriptor(field, "x-filestorage");
2103
+ if (filestorageMarker) {
2104
+ return {
2105
+ type: "filestorage",
2106
+ label: noEmpty(field.title),
2107
+ help: noEmpty(field.description)
2108
+ };
2109
+ }
2087
2110
  const filterLogic = Object.getOwnPropertyDescriptor(field, "x-filter");
2088
2111
  if (filterLogic) {
2089
2112
  return {
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import { JSONSchema7 } from 'json-schema';
3
3
  /**
4
4
  * Valid Forman Schema field types
5
5
  */
6
- type FormanSchemaFieldType = 'aiagent' | 'account' | 'hook' | 'device' | 'keychain' | 'datastore' | 'udt' | 'scenario' | 'array' | 'collection' | 'text' | 'number' | 'boolean' | 'checkbox' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | 'list' | 'radio' | 'select' | 'time' | 'timestamp' | 'timezone' | 'url' | 'uuid' | `account:${string}` | `hook:${string}` | `keychain:${string}` | `device:${string}` | 'banner' | 'markdown' | 'html' | 'separator' | string;
6
+ type FormanSchemaFieldType = 'aiagent' | 'account' | 'hook' | 'device' | 'keychain' | 'datastore' | 'udt' | 'scenario' | 'array' | 'collection' | 'text' | 'number' | 'boolean' | 'checkbox' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'filestorage' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | 'list' | 'radio' | 'select' | 'time' | 'timestamp' | 'timezone' | 'url' | 'uuid' | `account:${string}` | `hook:${string}` | `keychain:${string}` | `device:${string}` | 'banner' | 'markdown' | 'html' | 'separator' | string;
7
7
  /**
8
8
  * Validation configuration for Forman Schema fields
9
9
  */
@@ -279,4 +279,4 @@ declare function validateFormanWithDomains(domains: Record<string, {
279
279
  */
280
280
  declare function validateForman(values: Record<string, unknown>, schema: FormanSchemaField[], options?: FormanValidationOptions, restoreExtras?: Record<string, Record<string, unknown>>): Promise<FormanValidationResult>;
281
281
 
282
- export { type FormanSchemaDirectoryOption, type FormanSchemaExtendedNested, type FormanSchemaExtendedOptions, type FormanSchemaField, type FormanSchemaFieldType, type FormanSchemaNested, type FormanSchemaOption, type FormanSchemaOptionGroup, type FormanSchemaPathExtendedOptions, type FormanSchemaRPCButton, type FormanSchemaValue, toFormanSchema, toJSONSchema, validateForman, validateFormanWithDomains };
282
+ export { type FormanSchemaDirectoryOption, type FormanSchemaExtendedNested, type FormanSchemaExtendedOptions, type FormanSchemaField, type FormanSchemaFieldType, type FormanSchemaNested, type FormanSchemaOption, type FormanSchemaOptionGroup, type FormanSchemaPathExtendedOptions, type FormanSchemaRPCButton, type FormanSchemaValue, type FormanValidationOptions, type FormanValidationResult, toFormanSchema, toJSONSchema, validateForman, validateFormanWithDomains };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { JSONSchema7 } from 'json-schema';
3
3
  /**
4
4
  * Valid Forman Schema field types
5
5
  */
6
- type FormanSchemaFieldType = 'aiagent' | 'account' | 'hook' | 'device' | 'keychain' | 'datastore' | 'udt' | 'scenario' | 'array' | 'collection' | 'text' | 'number' | 'boolean' | 'checkbox' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | 'list' | 'radio' | 'select' | 'time' | 'timestamp' | 'timezone' | 'url' | 'uuid' | `account:${string}` | `hook:${string}` | `keychain:${string}` | `device:${string}` | 'banner' | 'markdown' | 'html' | 'separator' | string;
6
+ type FormanSchemaFieldType = 'aiagent' | 'account' | 'hook' | 'device' | 'keychain' | 'datastore' | 'udt' | 'scenario' | 'array' | 'collection' | 'text' | 'number' | 'boolean' | 'checkbox' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'filestorage' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | 'list' | 'radio' | 'select' | 'time' | 'timestamp' | 'timezone' | 'url' | 'uuid' | `account:${string}` | `hook:${string}` | `keychain:${string}` | `device:${string}` | 'banner' | 'markdown' | 'html' | 'separator' | string;
7
7
  /**
8
8
  * Validation configuration for Forman Schema fields
9
9
  */
@@ -279,4 +279,4 @@ declare function validateFormanWithDomains(domains: Record<string, {
279
279
  */
280
280
  declare function validateForman(values: Record<string, unknown>, schema: FormanSchemaField[], options?: FormanValidationOptions, restoreExtras?: Record<string, Record<string, unknown>>): Promise<FormanValidationResult>;
281
281
 
282
- export { type FormanSchemaDirectoryOption, type FormanSchemaExtendedNested, type FormanSchemaExtendedOptions, type FormanSchemaField, type FormanSchemaFieldType, type FormanSchemaNested, type FormanSchemaOption, type FormanSchemaOptionGroup, type FormanSchemaPathExtendedOptions, type FormanSchemaRPCButton, type FormanSchemaValue, toFormanSchema, toJSONSchema, validateForman, validateFormanWithDomains };
282
+ export { type FormanSchemaDirectoryOption, type FormanSchemaExtendedNested, type FormanSchemaExtendedOptions, type FormanSchemaField, type FormanSchemaFieldType, type FormanSchemaNested, type FormanSchemaOption, type FormanSchemaOptionGroup, type FormanSchemaPathExtendedOptions, type FormanSchemaRPCButton, type FormanSchemaValue, type FormanValidationOptions, type FormanValidationResult, toFormanSchema, toJSONSchema, validateForman, validateFormanWithDomains };
package/dist/index.js CHANGED
@@ -538,6 +538,7 @@ var FORMAN_TYPE_MAP = {
538
538
  email: "string",
539
539
  filename: "string",
540
540
  file: "string",
541
+ filestorage: "array",
541
542
  filter: "array",
542
543
  folder: "string",
543
544
  hidden: void 0,
@@ -549,6 +550,7 @@ var FORMAN_TYPE_MAP = {
549
550
  port: "number",
550
551
  list: "string",
551
552
  radio: "string",
553
+ scenario: "string",
552
554
  select: "string",
553
555
  udttype: "string",
554
556
  udtspec: "array",
@@ -638,6 +640,7 @@ function toJSONSchemaInternal(field, context) {
638
640
  case "dynamicCollection":
639
641
  return handleCollectionType(normalizedField, result, context);
640
642
  case "array":
643
+ case "filestorage":
641
644
  return handleArrayType(normalizedField, result, context);
642
645
  case "list":
643
646
  case "radio":
@@ -648,6 +651,7 @@ function toJSONSchemaInternal(field, context) {
648
651
  case "keychain":
649
652
  case "datastore":
650
653
  case "aiagent":
654
+ case "scenario":
651
655
  case "file":
652
656
  case "folder":
653
657
  return handleSelectOrPathType(normalizedField, result, context);
@@ -716,7 +720,15 @@ function handleCollectionType(field, result, context) {
716
720
  return result;
717
721
  }
718
722
  function handleArrayType(field, result, context) {
719
- if (field.spec) {
723
+ if (field.type === "filestorage") {
724
+ result.items = { type: "string" };
725
+ Object.defineProperty(result, "x-filestorage", {
726
+ configurable: true,
727
+ enumerable: false,
728
+ writable: true,
729
+ value: true
730
+ });
731
+ } else if (field.spec) {
720
732
  result.items = toJSONSchemaInternal(
721
733
  Array.isArray(field.spec) ? { type: "collection", spec: field.spec } : field.spec,
722
734
  {
@@ -1158,6 +1170,8 @@ var FORMAN_TYPE_MAP2 = {
1158
1170
  timestamp: "string",
1159
1171
  timezone: "string",
1160
1172
  upload: "array",
1173
+ filestorage: "array",
1174
+ scenario: "string",
1161
1175
  url: "string",
1162
1176
  uuid: "string",
1163
1177
  any: void 0
@@ -1361,6 +1375,7 @@ async function validateFormanValue(value, field, context) {
1361
1375
  case "collection":
1362
1376
  return handleCollectionType2(value, normalizedField, context);
1363
1377
  case "array":
1378
+ case "filestorage":
1364
1379
  return handleArrayType2(value, normalizedField, context);
1365
1380
  case "list":
1366
1381
  case "radio":
@@ -2055,6 +2070,14 @@ function toFormanSchema(field) {
2055
2070
  spec
2056
2071
  };
2057
2072
  case "array":
2073
+ const filestorageMarker = Object.getOwnPropertyDescriptor(field, "x-filestorage");
2074
+ if (filestorageMarker) {
2075
+ return {
2076
+ type: "filestorage",
2077
+ label: noEmpty(field.title),
2078
+ help: noEmpty(field.description)
2079
+ };
2080
+ }
2058
2081
  const filterLogic = Object.getOwnPropertyDescriptor(field, "x-filter");
2059
2082
  if (filterLogic) {
2060
2083
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makehq/forman-schema",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "description": "Forman Schema Tools",
5
5
  "license": "MIT",
6
6
  "author": "Make",