@makehq/forman-schema 1.6.0 → 1.7.1

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 CHANGED
@@ -67,7 +67,7 @@ var API_ENDPOINTS = {
67
67
  aiagent: "api://ai-agents/v1/agents",
68
68
  datastore: "api://data-stores",
69
69
  hook: "api://hooks/{{kind}}",
70
- device: "api://devices",
70
+ device: "api://devices/{{kind}}",
71
71
  keychain: "api://keys/{{kind}}",
72
72
  udt: "api://data-structures",
73
73
  scenario: "api://scenario-list"
@@ -238,6 +238,7 @@ var FORMAN_TYPE_MAP = {
238
238
  collection: "object",
239
239
  dynamicCollection: "object",
240
240
  text: "string",
241
+ editor: "string",
241
242
  number: "number",
242
243
  boolean: "boolean",
243
244
  date: "string",
@@ -309,6 +310,7 @@ function toJSONSchemaInternal(field, context = createDefaultContext()) {
309
310
  case "select":
310
311
  case "account":
311
312
  case "hook":
313
+ case "device":
312
314
  case "keychain":
313
315
  case "datastore":
314
316
  case "aiagent":
@@ -327,6 +329,12 @@ function handleCollectionType(field, result, context) {
327
329
  required: []
328
330
  });
329
331
  function addField(subField, tail) {
332
+ if (typeof subField === "string") {
333
+ const value = { $ref: appendQueryString(subField, context.domain, tail || context.tail) };
334
+ result.allOf ||= [];
335
+ result.allOf.push(value);
336
+ return;
337
+ }
330
338
  if (isVisualType(subField.type)) {
331
339
  return;
332
340
  }
@@ -499,9 +507,7 @@ function handleSelectType(field, result, context) {
499
507
  }
500
508
  }
501
509
  if (nested && domain && domain !== context.domain) {
502
- if (typeof nested === "string" || nestedContainsStrings) {
503
- throw new SchemaConversionError("Dynamic nested fields with domain change are not supported.");
504
- }
510
+ const normalizedNested = typeof nested === "string" ? [nested] : nested;
505
511
  let root = context.roots[domain];
506
512
  if (!root) {
507
513
  const buffer = [];
@@ -512,7 +518,7 @@ function handleSelectType(field, result, context) {
512
518
  }
513
519
  };
514
520
  }
515
- root.addFields(nested, [...context.tail, field.name]);
521
+ root.addFields(normalizedNested, [...context.tail, field.name]);
516
522
  } else if (nested) {
517
523
  Object.defineProperty(result, "x-nested", {
518
524
  configurable: true,
@@ -567,6 +573,7 @@ function handlePrimitiveType(field, result) {
567
573
  var FORMAN_TYPE_MAP2 = {
568
574
  account: "number",
569
575
  hook: "number",
576
+ device: "number",
570
577
  keychain: "number",
571
578
  datastore: "number",
572
579
  aiagent: "string",
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' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | 'select' | 'time' | 'timestamp' | 'timezone' | 'url' | 'uuid' | `account:${string}` | `hook:${string}` | `keychain:${string}` | 'banner' | 'markdown' | 'html' | 'separator' | string;
6
+ type FormanSchemaFieldType = 'aiagent' | 'account' | 'hook' | 'device' | 'keychain' | 'datastore' | 'udt' | 'scenario' | 'array' | 'collection' | 'text' | 'number' | 'boolean' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | '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
  */
@@ -146,7 +146,7 @@ type FormanSchemaNested = (FormanSchemaField | string)[] | string | FormanSchema
146
146
  */
147
147
  type FormanSchemaExtendedNested = {
148
148
  /** Store for the nested fields */
149
- store: FormanSchemaField[] | string;
149
+ store: (FormanSchemaField | string)[] | string;
150
150
  /** Domain for the nested fields */
151
151
  domain?: string;
152
152
  };
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' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | 'select' | 'time' | 'timestamp' | 'timezone' | 'url' | 'uuid' | `account:${string}` | `hook:${string}` | `keychain:${string}` | 'banner' | 'markdown' | 'html' | 'separator' | string;
6
+ type FormanSchemaFieldType = 'aiagent' | 'account' | 'hook' | 'device' | 'keychain' | 'datastore' | 'udt' | 'scenario' | 'array' | 'collection' | 'text' | 'number' | 'boolean' | 'date' | 'json' | 'buffer' | 'cert' | 'color' | 'email' | 'filename' | 'file' | 'filter' | 'folder' | 'hidden' | 'integer' | 'uinteger' | 'path' | 'pkey' | 'port' | '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
  */
@@ -146,7 +146,7 @@ type FormanSchemaNested = (FormanSchemaField | string)[] | string | FormanSchema
146
146
  */
147
147
  type FormanSchemaExtendedNested = {
148
148
  /** Store for the nested fields */
149
- store: FormanSchemaField[] | string;
149
+ store: (FormanSchemaField | string)[] | string;
150
150
  /** Domain for the nested fields */
151
151
  domain?: string;
152
152
  };
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ var API_ENDPOINTS = {
38
38
  aiagent: "api://ai-agents/v1/agents",
39
39
  datastore: "api://data-stores",
40
40
  hook: "api://hooks/{{kind}}",
41
- device: "api://devices",
41
+ device: "api://devices/{{kind}}",
42
42
  keychain: "api://keys/{{kind}}",
43
43
  udt: "api://data-structures",
44
44
  scenario: "api://scenario-list"
@@ -209,6 +209,7 @@ var FORMAN_TYPE_MAP = {
209
209
  collection: "object",
210
210
  dynamicCollection: "object",
211
211
  text: "string",
212
+ editor: "string",
212
213
  number: "number",
213
214
  boolean: "boolean",
214
215
  date: "string",
@@ -280,6 +281,7 @@ function toJSONSchemaInternal(field, context = createDefaultContext()) {
280
281
  case "select":
281
282
  case "account":
282
283
  case "hook":
284
+ case "device":
283
285
  case "keychain":
284
286
  case "datastore":
285
287
  case "aiagent":
@@ -298,6 +300,12 @@ function handleCollectionType(field, result, context) {
298
300
  required: []
299
301
  });
300
302
  function addField(subField, tail) {
303
+ if (typeof subField === "string") {
304
+ const value = { $ref: appendQueryString(subField, context.domain, tail || context.tail) };
305
+ result.allOf ||= [];
306
+ result.allOf.push(value);
307
+ return;
308
+ }
301
309
  if (isVisualType(subField.type)) {
302
310
  return;
303
311
  }
@@ -470,9 +478,7 @@ function handleSelectType(field, result, context) {
470
478
  }
471
479
  }
472
480
  if (nested && domain && domain !== context.domain) {
473
- if (typeof nested === "string" || nestedContainsStrings) {
474
- throw new SchemaConversionError("Dynamic nested fields with domain change are not supported.");
475
- }
481
+ const normalizedNested = typeof nested === "string" ? [nested] : nested;
476
482
  let root = context.roots[domain];
477
483
  if (!root) {
478
484
  const buffer = [];
@@ -483,7 +489,7 @@ function handleSelectType(field, result, context) {
483
489
  }
484
490
  };
485
491
  }
486
- root.addFields(nested, [...context.tail, field.name]);
492
+ root.addFields(normalizedNested, [...context.tail, field.name]);
487
493
  } else if (nested) {
488
494
  Object.defineProperty(result, "x-nested", {
489
495
  configurable: true,
@@ -538,6 +544,7 @@ function handlePrimitiveType(field, result) {
538
544
  var FORMAN_TYPE_MAP2 = {
539
545
  account: "number",
540
546
  hook: "number",
547
+ device: "number",
541
548
  keychain: "number",
542
549
  datastore: "number",
543
550
  aiagent: "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makehq/forman-schema",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "Forman Schema Tools",
5
5
  "license": "MIT",
6
6
  "author": "Make",