Skip to content

Commit

Permalink
Merge pull request #57 from qorelanguage/bugfix/locale-powered-apps
Browse files Browse the repository at this point in the history
Bump version to 0.5.3 and enhance IQoreAppShared interface for required properties
  • Loading branch information
Foxhoundn authored Jan 31, 2025
2 parents 0190540 + d25d44f commit e967ab7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qoretechnologies/ts-toolkit",
"version": "0.5.2",
"version": "0.5.3",
"description": "Utility library to interact with Qorus Integration Engine & Qore Language",
"keywords": [
"qoretechnologies",
Expand Down
34 changes: 34 additions & 0 deletions src/qore/QoreAppCreator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
IQoreAppSharedNotLocalized,
TQoreAppAction,
TQoreAppEventAction,
TQoreAppNonEventAction,
Expand All @@ -10,20 +11,53 @@ import {
export class QoreAppCreator {
/* Creates a trigger function to be used in an App */
public static createTrigger<TOptions extends TQoreOptions>(
trigger: TQoreAppEventAction<TOptions> & IQoreAppSharedNotLocalized,
): TQoreAppEventAction<TOptions> & IQoreAppSharedNotLocalized {
return trigger;
}

/* Creates a trigger function to be used in an App
with localized strings, this does not require manually
providing display_name, desc, and short_desc but instead
requires the proper translations to be available in the localization file
*/
public static createLocalizedTrigger<TOptions extends TQoreOptions>(
trigger: TQoreAppEventAction<TOptions>,
): TQoreAppEventAction<TOptions> {
return trigger;
}

/* Creates an action function to be used in an App */
public static createAction<TOptions extends TQoreOptions>(
action: TQoreAppNonEventAction<TOptions> & IQoreAppSharedNotLocalized,
): TQoreAppNonEventAction<TOptions> & IQoreAppSharedNotLocalized {
return action;
}

/* Creates an action function to be used in an App
with localized strings, this does not require manually
providing display_name, desc, and short_desc but instead
requires the proper translations to be available in the localization file
*/
public static createLocalizedAction<TOptions extends TQoreOptions>(
action: TQoreAppNonEventAction<TOptions>,
): TQoreAppNonEventAction<TOptions> {
return action;
}

/* Creates an App with triggers and actions */
public static createApp<Actions extends TQoreAppAction<any>[]>(
app: TQoreAppWithActions<Actions> & IQoreAppSharedNotLocalized,
): TQoreAppWithActions<Actions> & IQoreAppSharedNotLocalized {
return app;
}

/* Creates an App with triggers and actions
with localized strings, this does not require manually
providing display_name, desc, and short_desc but instead
requires the proper translations to be available in the localization file
*/
public static createLocalizedApp<Actions extends TQoreAppAction<any>[]>(
app: TQoreAppWithActions<Actions>,
): TQoreAppWithActions<Actions> {
return app;
Expand Down
8 changes: 4 additions & 4 deletions src/types/qore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export interface IQoreAppShared {
desc?: string;
}

export interface IQoreAppSharedWithRequiredDescriptions {
display_name?: string;
export interface IQoreAppSharedNotLocalized {
display_name: string;
short_desc: string;
desc: string;
}
Expand Down Expand Up @@ -238,7 +238,7 @@ export type TStringWithFirstUpperCaseCharacter = `${TFirstAppCharacter}${string}

export interface IQoreApp<
RestModifierOptions extends Record<string, IQoreConnectionOption> = Record<string, IQoreConnectionOption>,
> extends IQoreAppSharedWithRequiredDescriptions {
> extends IQoreAppShared {
name: TStringWithFirstUpperCaseCharacter;
logo: string;
logo_file_name: string;
Expand Down Expand Up @@ -285,7 +285,7 @@ export const QoreAppActionCodeToLocale: {
};

export interface IQoreBaseAppAction<CustomConnOptions extends TCustomConnOptions = TCustomConnOptions>
extends IQoreAppSharedWithRequiredDescriptions {
extends IQoreAppShared {
app: string;
action: string;
action_code: EQoreAppActionCode;
Expand Down

0 comments on commit e967ab7

Please sign in to comment.