From ae830134eef626da1413803ccc4a4e7503faee1e Mon Sep 17 00:00:00 2001 From: Foxhoundn Date: Sat, 14 Dec 2024 16:20:37 +0100 Subject: [PATCH 1/2] Bump version to 0.4.12, update reqore dependency, and refine form type definitions --- package.json | 10 +++++----- src/types/forms.ts | 34 +++++++++++++++++++++++----------- src/types/qorus.ts | 14 ++++++++++++-- yarn.lock | 8 ++++---- 4 files changed, 44 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 1dccdc2..29487c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@qoretechnologies/ts-toolkit", - "version": "0.4.11", + "version": "0.4.12", "description": "Utility library to interact with Qorus Integration Engine & Qore Language", "keywords": [ "qoretechnologies", @@ -20,9 +20,6 @@ ], "testTimeout": 60000 }, - "pre-commit": [ - "updatePullRequestVersion" - ], "pre-push": [ "lint", "build:test" @@ -60,7 +57,7 @@ "devDependencies": { "@babel/core": "^7.20.2", "@chromatic-com/storybook": "^1", - "@qoretechnologies/reqore": "^0.48.4", + "@qoretechnologies/reqore": "^0.48.20", "@storybook/addon-actions": "^8.2.7", "@storybook/addon-essentials": "^8.2.7", "@storybook/addon-interactions": "^8.2.7", @@ -107,6 +104,9 @@ "typescript": "^4.7.4", "webpack-node-externals": "^3.0.0" }, + "peerDependencies": { + "@qoretechnologies/reqore": "^0.48.0" + }, "dependencies": { "async": "^3.2.4", "cron-validator": "^1.3.1", diff --git a/src/types/forms.ts b/src/types/forms.ts index 1591024..031688b 100644 --- a/src/types/forms.ts +++ b/src/types/forms.ts @@ -1,3 +1,6 @@ +import { IReqorePanelProps } from '@qoretechnologies/reqore/dist/components/Panel'; +import { TReqoreIntent } from '@qoretechnologies/reqore/dist/constants/theme'; +import { IReqoreAutoFocusRules } from '@qoretechnologies/reqore/dist/hooks/useAutoFocus'; import { IQorusExpression } from './expressions'; import { TQorusType } from './qorus'; @@ -18,20 +21,29 @@ export type TQorusForm = export type TQorusFlatForm = Record; -export interface IQorusFormFieldMessage { +export interface IQorusFormFieldMessage { title?: string; content: string; - intent?: Intent; + intent?: TReqoreIntent; } -export interface IQorusAllowedValue { +export interface IQorusAllowedValue = Record> { display_name: string; short_desc?: string; desc?: string; value: unknown; + name?: string; + disabled?: boolean; + intent?: TReqoreIntent; + badge?: IReqorePanelProps['badge']; + messages?: IQorusFormFieldMessage; + actions?: IReqorePanelProps['actions']; + metadata?: IMetadata; } -export interface IQorusFormFieldSchema { +export type TQorusFormFieldOnChangeEvents = 'refetch'; + +export interface IQorusFormFieldSchema { type: TQorusType | TQorusType[]; element_type?: TQorusType; value?: unknown | IQorusExpression; @@ -47,7 +59,7 @@ export interface IQorusFormFieldSchema { allowed_values?: IQorusAllowedValue[]; allowed_values_creatable?: boolean; allowed_schemes?: IQorusAllowedValue[]; - arg_schema?: IQorusFormSchema; + arg_schema?: IQorusFormSchema; supports_templates?: boolean; supports_references?: boolean; @@ -59,7 +71,7 @@ export interface IQorusFormFieldSchema { depends_on?: string[] | string[][]; has_dependents?: boolean; - on_change?: string[]; + on_change?: TQorusFormFieldOnChangeEvents[]; display_name?: string; short_desc?: string; @@ -68,12 +80,12 @@ export interface IQorusFormFieldSchema { disabled?: boolean; readonly?: boolean; - intent?: Intent; + intent?: TReqoreIntent; metadata?: Record; rules?: ['valid_identifier']; - messages?: IQorusFormFieldMessage[]; - focusRules?: FocusRules; + messages?: IQorusFormFieldMessage[]; + focusRules?: IReqoreAutoFocusRules; markdown?: boolean; get_message?: { @@ -92,8 +104,8 @@ export interface IQorusFormFieldSchema { }; } -export interface IQorusFormSchema { - [optionName: string]: IQorusFormFieldSchema; +export interface IQorusFormSchema { + [optionName: string]: IQorusFormFieldSchema; } export interface IQorusFormOperator { diff --git a/src/types/qorus.ts b/src/types/qorus.ts index 1e848af..40d2d06 100644 --- a/src/types/qorus.ts +++ b/src/types/qorus.ts @@ -1,7 +1,16 @@ export type TQorusInterfaces = 'mapper' | 'workflow' | 'service' | 'job' | 'connection'; /* Types used in UIs, these are not 1:1 to Qore types */ -export type TQorusStringCompatibleUIType = 'binary' | 'date' | 'url' | 'email' | 'string' | 'file-as-string'; +export type TQorusStringCompatibleUIType = + | 'binary' + | 'date' + | 'url' + | 'email' + | 'string' + | 'file-as-string' + | 'long-string' + | 'enum' + | 'url'; export type TQorusNumberCompatibleUIType = 'int' | 'integer' | 'float' | 'number'; export type TQorusListCompatibleUIType = 'list' | 'range'; export type TQorusHashCompatibleUIType = 'hash' | 'data' | 'rgbcolor'; @@ -19,4 +28,5 @@ export type TQorusType = | TQorusNullCompatibleUIType | TQorusAnyCompatibleUIType | TQorusBooleanCompatibleUIType - | TQorusSpecialUIType; + | TQorusSpecialUIType + | 'context'; diff --git a/yarn.lock b/yarn.lock index 554ae24..2871393 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2040,10 +2040,10 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45" integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw== -"@qoretechnologies/reqore@^0.48.4": - version "0.48.4" - resolved "https://registry.yarnpkg.com/@qoretechnologies/reqore/-/reqore-0.48.4.tgz#fbf2e4f259e1e88805819043ba131c8947f7ba16" - integrity sha512-Z4oqteVa3GfOJEZlBPeNzkBUKy6VXcRjRBWed88Q+X4eOLjK0o5JiUv1O0XmCg89EuDxxGr2GIryV0LlBrG3Nw== +"@qoretechnologies/reqore@^0.48.20": + version "0.48.20" + resolved "https://registry.yarnpkg.com/@qoretechnologies/reqore/-/reqore-0.48.20.tgz#566d40a560693a140ea2cc5b29175ff5d7785042" + integrity sha512-oeLCrOLAKSdH14UBN7pMa+6H9Mt108Z3WvkAUta4q450yYnZa1fScfCiRll0CD0++gdxgvRuvtsgA6c6rynhFQ== dependencies: "@internationalized/date" "^3.5.3" "@popperjs/core" "^2.11.6" From 6829c71f56e44efdad3ee854aff3df5b5df1176a Mon Sep 17 00:00:00 2001 From: Foxhoundn Date: Sat, 14 Dec 2024 16:22:26 +0100 Subject: [PATCH 2/2] Add icon and image properties to IQorusAllowedValue interface --- src/types/forms.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/types/forms.ts b/src/types/forms.ts index 031688b..afcbbf6 100644 --- a/src/types/forms.ts +++ b/src/types/forms.ts @@ -1,6 +1,7 @@ import { IReqorePanelProps } from '@qoretechnologies/reqore/dist/components/Panel'; import { TReqoreIntent } from '@qoretechnologies/reqore/dist/constants/theme'; import { IReqoreAutoFocusRules } from '@qoretechnologies/reqore/dist/hooks/useAutoFocus'; +import { IReqoreIconName } from '@qoretechnologies/reqore/dist/types/icons'; import { IQorusExpression } from './expressions'; import { TQorusType } from './qorus'; @@ -38,6 +39,8 @@ export interface IQorusAllowedValue = Reco badge?: IReqorePanelProps['badge']; messages?: IQorusFormFieldMessage; actions?: IReqorePanelProps['actions']; + icon?: IReqoreIconName; + image?: string; metadata?: IMetadata; }