Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to 0.4.12, update reqore dependency, and refine form type definitions #52

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -20,9 +20,6 @@
],
"testTimeout": 60000
},
"pre-commit": [
"updatePullRequestVersion"
],
"pre-push": [
"lint",
"build:test"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
37 changes: 26 additions & 11 deletions src/types/forms.ts
Original file line number Diff line number Diff line change
@@ -1,3 +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';

Expand All @@ -18,20 +22,31 @@ export type TQorusForm =

export type TQorusFlatForm = Record<string, any>;

export interface IQorusFormFieldMessage<Intent> {
export interface IQorusFormFieldMessage {
title?: string;
content: string;
intent?: Intent;
intent?: TReqoreIntent;
}

export interface IQorusAllowedValue {
export interface IQorusAllowedValue<IMetadata extends Record<string, any> = Record<string, any>> {
display_name: string;
short_desc?: string;
desc?: string;
value: unknown;
name?: string;
disabled?: boolean;
intent?: TReqoreIntent;
badge?: IReqorePanelProps['badge'];
messages?: IQorusFormFieldMessage;
actions?: IReqorePanelProps['actions'];
icon?: IReqoreIconName;
image?: string;
metadata?: IMetadata;
}

export interface IQorusFormFieldSchema<Intent, FocusRules> {
export type TQorusFormFieldOnChangeEvents = 'refetch';

export interface IQorusFormFieldSchema {
type: TQorusType | TQorusType[];
element_type?: TQorusType;
value?: unknown | IQorusExpression;
Expand All @@ -47,7 +62,7 @@ export interface IQorusFormFieldSchema<Intent, FocusRules> {
allowed_values?: IQorusAllowedValue[];
allowed_values_creatable?: boolean;
allowed_schemes?: IQorusAllowedValue[];
arg_schema?: IQorusFormSchema<Intent, FocusRules>;
arg_schema?: IQorusFormSchema;

supports_templates?: boolean;
supports_references?: boolean;
Expand All @@ -59,7 +74,7 @@ export interface IQorusFormFieldSchema<Intent, FocusRules> {

depends_on?: string[] | string[][];
has_dependents?: boolean;
on_change?: string[];
on_change?: TQorusFormFieldOnChangeEvents[];

display_name?: string;
short_desc?: string;
Expand All @@ -68,12 +83,12 @@ export interface IQorusFormFieldSchema<Intent, FocusRules> {
disabled?: boolean;
readonly?: boolean;

intent?: Intent;
intent?: TReqoreIntent;
metadata?: Record<string, any>;
rules?: ['valid_identifier'];

messages?: IQorusFormFieldMessage<Intent>[];
focusRules?: FocusRules;
messages?: IQorusFormFieldMessage[];
focusRules?: IReqoreAutoFocusRules;
markdown?: boolean;

get_message?: {
Expand All @@ -92,8 +107,8 @@ export interface IQorusFormFieldSchema<Intent, FocusRules> {
};
}

export interface IQorusFormSchema<Intent, FocusRules> {
[optionName: string]: IQorusFormFieldSchema<Intent, FocusRules>;
export interface IQorusFormSchema {
[optionName: string]: IQorusFormFieldSchema;
}

export interface IQorusFormOperator {
Expand Down
14 changes: 12 additions & 2 deletions src/types/qorus.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -19,4 +28,5 @@ export type TQorusType =
| TQorusNullCompatibleUIType
| TQorusAnyCompatibleUIType
| TQorusBooleanCompatibleUIType
| TQorusSpecialUIType;
| TQorusSpecialUIType
| 'context';
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading