From bdcde5ecede06d6f49c8129330d2438bf504947e Mon Sep 17 00:00:00 2001 From: GermanBluefox Date: Tue, 14 Jan 2025 21:54:02 +0000 Subject: [PATCH] Added type to javascriptRules --- packages/types-dev/objects.d.ts | 4 +-- schemas/io-package.json | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/packages/types-dev/objects.d.ts b/packages/types-dev/objects.d.ts index 6d3702a61..f459da117 100644 --- a/packages/types-dev/objects.d.ts +++ b/packages/types-dev/objects.d.ts @@ -801,9 +801,9 @@ declare global { javascriptRules?: { /** Translations */ i18n?: boolean | Record> | Record; - /** Where to load the blocks */ + /** Where to load the blocks, like "rules/customRuleBlocks.js" */ url: string; - /** Blocks names */ + /** Rules block name, like "ActionTelegram" */ name: string; /** Load it as TypeScript module */ type?: 'module'; diff --git a/schemas/io-package.json b/schemas/io-package.json index 33a064901..535506ec5 100644 --- a/schemas/io-package.json +++ b/schemas/io-package.json @@ -958,6 +958,49 @@ ] } }, + "javascriptRules": { + "type": "object", + "properties": { + "i18n": { + "description": "Translation for the rule block", + "anyOf": [ + { + "description": "Translations will be loaded from javascriptRules.url and i18n/.json", + "const": true + }, + { + "description": "Define translations here", + "type": "object", + "patternProperties": { + ".+": { + "$ref": "#/definitions/multilingual" + } + } + } + ] + }, + "type": { + "description": "Define type='module' if rules written with TypeScript", + "type": "string", + "enum": [ + "module" + ] + }, + "url": { + "description": "Link to module, like 'rules/customRuleBlocks.js'. That means it will loaded from admin/rules directory of the adapter", + "type": "string" + }, + "name": { + "description": "Name of the module, like 'ActionTelegram'", + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "url", + "name" + ] + }, "type": { "description": "Type of the adapter", "type": "string",