@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.
- package/build/server/index.cjs +10 -17
- package/build/server/resources/nrg-client.js +3387 -3211
- package/build/vite/index.js +8 -6
- package/package.json +1 -1
- package/src/core/client/app.vue +2 -8
- package/src/core/client/components/node-red-config-input.vue +22 -0
- package/src/core/client/components/node-red-editor-input.vue +22 -0
- package/src/core/client/components/node-red-input-label.vue +53 -0
- package/src/core/client/components/node-red-input.vue +22 -0
- package/src/core/client/components/node-red-json-schema-form.vue +89 -44
- package/src/core/client/components/node-red-select-input.vue +22 -0
- package/src/core/client/components/node-red-typed-input.vue +22 -0
- package/src/core/client/index.ts +2 -0
- package/src/core/server/schemas/type.ts +5 -19
- package/src/core/server/schemas/types/index.ts +9 -1
- package/src/core/server/utils.ts +2 -2
- package/src/core/server/validator.ts +6 -2
- package/src/vite/client/build.ts +9 -7
- package/src/vite/client/plugins/node-definitions-inliner.ts +1 -1
package/build/server/index.cjs
CHANGED
|
@@ -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: "
|
|
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
|
-
...
|
|
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
|
-
...
|
|
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;
|