@bonsae/nrg 0.4.0 → 0.5.0

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.
@@ -203,9 +203,13 @@ var NodeRedValidator = class extends Validator {
203
203
  constructor(RED) {
204
204
  super({
205
205
  customKeywords: [
206
- { keyword: "skip-validation", schemaType: "boolean", valid: true },
207
206
  {
208
- keyword: "node-type",
207
+ keyword: "x-nrg-skip-validation",
208
+ schemaType: "boolean",
209
+ valid: true
210
+ },
211
+ {
212
+ keyword: "x-nrg-node-type",
209
213
  type: "string",
210
214
  validate: (schemaValue, dataValue) => {
211
215
  if (!dataValue) return true;
@@ -651,34 +655,23 @@ var import_typebox = require("@sinclair/typebox");
651
655
  var import_rules = require("ajv/dist/compile/rules");
652
656
  function NodeRef(nodeClass, options) {
653
657
  return {
654
- ...SchemaType.String({
658
+ ...import_typebox.Type.String({
655
659
  description: options?.description || `Reference to ${nodeClass.type}`,
656
660
  format: "node-id"
657
661
  }),
658
- "node-type": nodeClass.type,
662
+ "x-nrg-node-type": nodeClass.type,
659
663
  ...options,
660
664
  [import_typebox.Kind]: "NodeRef"
661
665
  };
662
666
  }
663
667
  function TypedInput(options) {
664
- const { types, ...rest } = options ?? {};
665
668
  return {
666
669
  ...TypedInputSchema,
667
- ...rest,
668
- ...types ? { "x-typed-types": types } : {},
670
+ ...options,
669
671
  [import_typebox.Kind]: "TypedInput"
670
672
  };
671
673
  }
672
- var _OriginalString = import_typebox.Type.String.bind(import_typebox.Type);
673
- function StringWithLang(options) {
674
- const { lang, ...rest } = options ?? {};
675
- return _OriginalString({
676
- ...rest,
677
- ...lang ? { "x-editor-language": lang } : {}
678
- });
679
- }
680
674
  var SchemaType = Object.assign({}, import_typebox.Type, {
681
- String: StringWithLang,
682
675
  NodeRef,
683
676
  TypedInput
684
677
  });
@@ -686,7 +679,7 @@ function markNonValidatable(schema) {
686
679
  const type = schema.type;
687
680
  const hasInvalidType = type !== void 0 && (Array.isArray(type) ? !type.every(import_rules.isJSONType) : !(0, import_rules.isJSONType)(type));
688
681
  if (hasInvalidType) {
689
- schema["skip-validation"] = true;
682
+ schema["x-nrg-skip-validation"] = true;
690
683
  if (schema.default !== void 0) {
691
684
  schema._default = schema.default;
692
685
  delete schema.default;