From 91888f694ba65a8fbb48fdc8de17fe89ed61afbf Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 21 May 2021 17:04:29 +0200 Subject: [PATCH 01/24] [plugin][core] Fixed entry point, work on plugin definitions * Entry point is now in source, no need to compile, this is done by Flaschengeist when included * Added `id` property to plugins * Required modules now support version dependencies --- package.json | 13 ++++--- src/index.d.ts | 2 -- src/index.ts | 1 - tsconfig.json | 3 +- {src => types}/flaschengeist.d.ts | 0 types/index.d.ts | 3 ++ {src => types}/plugin.d.ts | 57 +++++++++++++++++++------------ 7 files changed, 45 insertions(+), 34 deletions(-) delete mode 100644 src/index.d.ts delete mode 100644 src/index.ts rename {src => types}/flaschengeist.d.ts (100%) create mode 100644 types/index.d.ts rename {src => types}/plugin.d.ts (66%) diff --git a/package.json b/package.json index f857d18..fc3646a 100644 --- a/package.json +++ b/package.json @@ -13,20 +13,19 @@ "type": "git", "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-typings" }, - "main": "dist/index.js", - "typings": "dist/index.d.ts", + "typings": "types/index.d.ts", "scripts": { - "build": "tsc", + "valid": "tsc --noEmit", "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, "devDependencies": { "prettier": "^2.3.0", - "typescript": "^4.2.4", - "vue": "^3.0.11", - "vue-router": "^4.0.8" + "typescript": "^4.2.4" }, "peerDependencies": { - "flaschengeist": "^2.0.0-alpha.1" + "flaschengeist": "^2.0.0-alpha.1", + "vue": "^3.0.11", + "vue-router": "^4.0.8" }, "prettier": { "singleQuote": true, diff --git a/src/index.d.ts b/src/index.d.ts deleted file mode 100644 index 0f87dc5..0000000 --- a/src/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// \ No newline at end of file diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index a022b03..0000000 --- a/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -/// \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 5311e73..ded90b4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,9 +4,8 @@ "target": "esnext", "module": "esnext", "declaration": true, - "outDir": "./dist", "strict": true, - "moduleResolution": "node" + "moduleResolution": "Node" }, "exclude": [ "node_modules", diff --git a/src/flaschengeist.d.ts b/types/flaschengeist.d.ts similarity index 100% rename from src/flaschengeist.d.ts rename to types/flaschengeist.d.ts diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..9784f83 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,3 @@ +/// + +export * from "./plugin" diff --git a/src/plugin.d.ts b/types/plugin.d.ts similarity index 66% rename from src/plugin.d.ts rename to types/plugin.d.ts index d041af8..2ad5cc8 100644 --- a/src/plugin.d.ts +++ b/types/plugin.d.ts @@ -1,18 +1,31 @@ -import { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router'; -import { Component } from 'vue'; +import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router'; +import type { Component } from '@vue/runtime-core'; -declare namespace FG_Plugin { +type Join = + T extends [] ? '' : + T extends [string | number | boolean | bigint] ? `${T[0]}` : + T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : + string; +type BVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'> +type Version = BVersion | Join<[BVersion, string], '-'> + +export namespace FG_Plugin { /** * Interface defining a Flaschengeist plugin */ - interface Plugin { + export interface Plugin { + /** Unique identifier for this plugin, we recommend using a FQN like com.example.my_plugin */ + id: string, + /** Arbitrary name of the plugin used inside admin view etc */ name: string; + /** Version of this plugin, used for dependencies. MUST be semver parsable */ version: string; + /** Widgets provided by this plugin */ widgets: Widget[]; - /** Pther frontend modules needed for this plugin to work correctly */ - requiredModules: string[]; + /** Other frontend modules needed for this plugin to work correctly */ + requiredModules: [string, Version?][]; /** Backend modules needed for this plugin to work correctly */ - requiredBackendModules: string[]; + requiredBackendModules: [string, Version?][]; /** Menu entries for authenticated users */ innerRoutes?: MenuRoute[]; /** Public menu entries (without authentification) */ @@ -26,7 +39,7 @@ declare namespace FG_Plugin { /** * Defines the loaded state of the Flaschengeist */ - interface Flaschengeist { + export interface Flaschengeist { /** All loaded plugins */ plugins: LoadedPlugin[]; /** All routes, combined from all plugins */ @@ -44,7 +57,7 @@ declare namespace FG_Plugin { /** * Interface for a frontend notification */ - interface Notification extends FG.Notification { + export interface Notification extends FG.Notification { /** If set a button for accepting will be shown, this function will get called before deleting the notification */ accept?(): Promise; /** If set this function is called before the notification gets deleted */ @@ -67,30 +80,30 @@ declare namespace FG_Plugin { /** * Defines a shortcut link */ - interface Shortcut { + export interface Shortcut { link: RouteRecordName; icon: string; permissions?: string[]; } - /** - * Defines a main menu entry along with the route - * Used when defining a plugin - */ - interface MenuRoute extends MenuEntry { - route: NamedRouteRecordRaw; - shortcut?: boolean; - children?: this[]; - } - type NamedRouteRecordRaw = RouteRecordRaw & { name: RouteRecordName; }; + /** + * Defines a main menu entry along with the route + * Used when defining a plugin + */ + export interface MenuRoute extends MenuEntry { + route: NamedRouteRecordRaw; + shortcut?: boolean; + children?: this[]; + } + /** * Defines a menu entry in the main menu */ - interface MenuLink extends MenuEntry { + export interface MenuLink extends MenuEntry { /** Name of the target route */ link: RouteRecordName; } @@ -108,7 +121,7 @@ declare namespace FG_Plugin { /** * Widget object for the dashboard */ - interface Widget { + export interface Widget { name: string; priority: number; permissions: FG.Permission[]; -- 2.40.1 From 0ee466efb9593c664096178893f3ac0189a17bd2 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 25 May 2021 15:46:04 +0200 Subject: [PATCH 02/24] [deps] peer depend on api package instead of main package --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index fc3646a..16f3667 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,7 @@ "typescript": "^4.2.4" }, "peerDependencies": { - "flaschengeist": "^2.0.0-alpha.1", - "vue": "^3.0.11", - "vue-router": "^4.0.8" + "@flaschengeist/api": "^1.0.0-alpha.1" }, "prettier": { "singleQuote": true, -- 2.40.1 From 131063dae8f69fd38123003857b568be138917e7 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 25 May 2021 16:48:14 +0200 Subject: [PATCH 03/24] [plugin] Plugins only can require backend modules *BREAKING* Frontend module dependencies are resolved by the package.json peerDependencies. This breaks current behaviour as the backend property is merged into the "frontend". --- types/plugin.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 2ad5cc8..13929fa 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -1,13 +1,17 @@ import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router'; import type { Component } from '@vue/runtime-core'; +/* This is some sort of PEP440 subset */ type Join = T extends [] ? '' : T extends [string | number | boolean | bigint] ? `${T[0]}` : T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : string; -type BVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'> -type Version = BVersion | Join<[BVersion, string], '-'> +type BaseVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'> +type PreRelease = Join<[["a"|"b"|"rc"], number], "."> +type PRVersion = BaseVersion | `${BaseVersion}${PreRelease}` +/** A PEP440 subset used to describe backend module versions */ +export type PEP440Version = PRVersion | `${PRVersion}.dev${number}` export namespace FG_Plugin { /** @@ -22,10 +26,8 @@ export namespace FG_Plugin { version: string; /** Widgets provided by this plugin */ widgets: Widget[]; - /** Other frontend modules needed for this plugin to work correctly */ - requiredModules: [string, Version?][]; /** Backend modules needed for this plugin to work correctly */ - requiredBackendModules: [string, Version?][]; + requiredModules: [string, PEP440Version?][]; /** Menu entries for authenticated users */ innerRoutes?: MenuRoute[]; /** Public menu entries (without authentification) */ -- 2.40.1 From 1f1d0fe32e1bc429edbf32ae33e48f312a025f60 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 25 May 2021 16:53:13 +0200 Subject: [PATCH 04/24] [deps] No need for peerDependency --- package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 16f3667..92734b3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "license": "MIT", - "version": "0.0.1", + "version": "1.0.0-alpha.1", "name": "@flaschengeist/types", "author": "Ferdinand ", "homepage": "https://flaschengeist.dev/Flaschengeist", @@ -22,9 +22,6 @@ "prettier": "^2.3.0", "typescript": "^4.2.4" }, - "peerDependencies": { - "@flaschengeist/api": "^1.0.0-alpha.1" - }, "prettier": { "singleQuote": true, "semi": true, -- 2.40.1 From 6ab3bf2ad567afd6bce27c32e6127038e7b77328 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 26 May 2021 16:55:24 +0200 Subject: [PATCH 05/24] [format] Run prettier --- types/index.d.ts | 2 +- types/plugin.d.ts | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 9784f83..b9624c7 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,3 +1,3 @@ /// -export * from "./plugin" +export * from './plugin'; diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 13929fa..2c3a99d 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -2,16 +2,18 @@ import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-rout import type { Component } from '@vue/runtime-core'; /* This is some sort of PEP440 subset */ -type Join = - T extends [] ? '' : - T extends [string | number | boolean | bigint] ? `${T[0]}` : - T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : - string; -type BaseVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'> -type PreRelease = Join<[["a"|"b"|"rc"], number], "."> -type PRVersion = BaseVersion | `${BaseVersion}${PreRelease}` +type Join = T extends [] + ? '' + : T extends [string | number | boolean | bigint] + ? `${T[0]}` + : T extends [string | number | boolean | bigint, ...infer U] + ? `${T[0]}${D}${Join}` + : string; +type BaseVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'>; +type PreRelease = Join<[['a' | 'b' | 'rc'], number], '.'>; +type PRVersion = BaseVersion | `${BaseVersion}${PreRelease}`; /** A PEP440 subset used to describe backend module versions */ -export type PEP440Version = PRVersion | `${PRVersion}.dev${number}` +export type PEP440Version = PRVersion | `${PRVersion}.dev${number}`; export namespace FG_Plugin { /** @@ -19,7 +21,7 @@ export namespace FG_Plugin { */ export interface Plugin { /** Unique identifier for this plugin, we recommend using a FQN like com.example.my_plugin */ - id: string, + id: string; /** Arbitrary name of the plugin used inside admin view etc */ name: string; /** Version of this plugin, used for dependencies. MUST be semver parsable */ -- 2.40.1 From fddbe60b45de52a28150b4b14b1f6c40f2de08b6 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 26 May 2021 16:55:53 +0200 Subject: [PATCH 06/24] [core] Only export types for @flaschengeist/api --- types/flaschengeist.d.ts | 105 +-------------------------------------- 1 file changed, 1 insertion(+), 104 deletions(-) diff --git a/types/flaschengeist.d.ts b/types/flaschengeist.d.ts index 0b0a806..96bc55f 100644 --- a/types/flaschengeist.d.ts +++ b/types/flaschengeist.d.ts @@ -3,7 +3,7 @@ declare namespace FG { id: number; plugin: string; text: string; - data?: unknown; + data?: any; time: Date; } interface User { @@ -31,107 +31,4 @@ declare namespace FG { name: string; permissions: Array; } - interface Transaction { - id: number; - time: Date; - amount: number; - reversal_id?: number; - author_id?: string; - sender_id?: string; - original_id?: number; - receiver_id?: string; - } - interface Event { - id: number; - start: Date; - end?: Date; - name?: string; - description?: string; - type: EventType | number; - is_template: boolean; - jobs: Array; - } - interface EventType { - id: number; - name: string; - } - interface Invite { - id: number; - job_id: number; - invitee_id: string; - sender_id: string; - } - interface Job { - id: number; - start: Date; - end?: Date; - type: JobType | number; - comment?: string; - services: Array; - required_services: number; - } - interface JobType { - id: number; - name: string; - } - interface Service { - userid: string; - is_backup: boolean; - value: number; - } - interface Drink { - id: number; - article_id?: string; - package_size?: number; - name: string; - volume?: number; - cost_per_volume?: number; - cost_per_package?: number; - tags?: Array; - type?: DrinkType; - volumes: Array; - uuid: string; - receipt?: Array; - } - interface DrinkIngredient { - id: number; - volume: number; - ingredient_id: number; - } - interface DrinkPrice { - id: number; - price: number; - public: boolean; - description?: string; - } - interface DrinkPriceVolume { - id: number; - volume: number; - min_prices: Array; - prices: Array; - ingredients: Array; - } - interface DrinkType { - id: number; - name: string; - } - interface ExtraIngredient { - id: number; - name: string; - price: number; - } - interface Ingredient { - id: number; - drink_ingredient?: DrinkIngredient; - extra_ingredient?: ExtraIngredient; - } - interface MinPrices { - percentage: number; - price: number; - } - interface Tag { - id: number; - name: string; - color: string; - } } -- 2.40.1 From 618d543dbb580a8029ce6ff4596c5c303a35d8d3 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 26 May 2021 17:17:49 +0200 Subject: [PATCH 07/24] [docs] Added README --- README.md | 13 +++++++++++++ package.json | 11 ++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2211b6e --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Flaschengeist types + +This package provides the TypeScript typings needed for developing with the [Flaschengeist](https://flaschengeist.dev/Flaschengeist/flaschengeist) and the [Flaschengeist-Plugin](https://flaschengeist.dev/Flaschengeist/flaschengeist-frontend) API. + +## License + +Licensed under the MIT license, see [LICENSE](./LICENSE) for more details. + +## Development + +Feel free to report bugs, issues and feature requests using the [Issues function](https://flaschengeist.dev/Flaschengeist/flaschengeist/issues). + +Please follow our [general development guide](https://flaschengeist.dev/Flaschengeist/flaschengeist/wiki/Development#general-development). diff --git a/package.json b/package.json index 92734b3..eedaa71 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,16 @@ { - "private": true, "license": "MIT", "version": "1.0.0-alpha.1", "name": "@flaschengeist/types", - "author": "Ferdinand ", - "homepage": "https://flaschengeist.dev/Flaschengeist", + "author": "Ferdinand Thiessen ", + "homepage": "https://flaschengeist.dev/", "description": "Flaschengeist TypeScript typings", "bugs": { "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist/issues" }, "repository": { "type": "git", - "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-typings" + "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-types" }, "typings": "types/index.d.ts", "scripts": { @@ -20,7 +19,9 @@ }, "devDependencies": { "prettier": "^2.3.0", - "typescript": "^4.2.4" + "typescript": "^4.2.4", + "vue": "^3.0.11", + "vue-router": "^4.0.8" }, "prettier": { "singleQuote": true, -- 2.40.1 From f5288cb8d33eb6da4102c6acee22c0cc3cbf2268 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 29 Jul 2021 18:14:49 +0200 Subject: [PATCH 08/24] [plugin] Allow ordering MenuLinks, widgets: renamed priority to order --- package.json | 10 ++++++---- types/plugin.d.ts | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index eedaa71..ed871ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.1", + "version": "1.0.0-alpha.2", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", @@ -17,11 +17,13 @@ "valid": "tsc --noEmit", "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, + "dependencies": { + "vue": "^3.1.5", + "vue-router": "^4.0.10" + }, "devDependencies": { "prettier": "^2.3.0", - "typescript": "^4.2.4", - "vue": "^3.0.11", - "vue-router": "^4.0.8" + "typescript": "^4.2.4" }, "prettier": { "singleQuote": true, diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 2c3a99d..0af00eb 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -110,6 +110,11 @@ export namespace FG_Plugin { export interface MenuLink extends MenuEntry { /** Name of the target route */ link: RouteRecordName; + /** + * Order inside the menu, higher numbers come ahead of lower numbers + * @todo: Promote to required with first beta + */ + order?: number; } /** @@ -127,7 +132,16 @@ export namespace FG_Plugin { */ export interface Widget { name: string; - priority: number; + /** + * @deprecated Deprecated in favor of order + * @todo Remove with beta 1 + */ + priority?: number; + /** + * Default order on the dashboard, higher numbers come ahead of lower numbers + * @todo Promote to required if priority is removed + */ + order?: number; permissions: FG.Permission[]; widget: Component; } -- 2.40.1 From 7cc03a31f7cda1770b44551c5e6cf231f43c034c Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 30 Aug 2021 11:53:23 +0200 Subject: [PATCH 09/24] [deps] Update vue dependency --- package.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ed871ed..21b8e6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.2", + "version": "1.0.0-alpha.3", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", @@ -12,18 +12,19 @@ "type": "git", "url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-types" }, + "flat": true, "typings": "types/index.d.ts", "scripts": { "valid": "tsc --noEmit", "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, "dependencies": { - "vue": "^3.1.5", - "vue-router": "^4.0.10" + "vue": "^3.2.4", + "vue-router": "^4.0.11" }, "devDependencies": { - "prettier": "^2.3.0", - "typescript": "^4.2.4" + "prettier": "^2.3.2", + "typescript": "^4.3.5" }, "prettier": { "singleQuote": true, -- 2.40.1 From 1c921322ae0c8ba5c464f0c255867c51f143616f Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 30 Aug 2021 14:12:33 +0200 Subject: [PATCH 10/24] Fix dependencies --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 21b8e6e..cd9aea3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", @@ -18,9 +18,9 @@ "valid": "tsc --noEmit", "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, - "dependencies": { - "vue": "^3.2.4", - "vue-router": "^4.0.11" + "peerDependencies": { + "vue": "~3.2.4", + "vue-router": "~4.0.11" }, "devDependencies": { "prettier": "^2.3.2", -- 2.40.1 From 84f66ab86a689b0daed9848ffecd53bece67885b Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 11 Nov 2021 13:34:17 +0100 Subject: [PATCH 11/24] [plugin] Add ID to loaded plugins --- types/plugin.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 0af00eb..e595f82 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -76,6 +76,7 @@ export namespace FG_Plugin { * Loaded Flaschengeist plugin */ interface LoadedPlugin { + id: string; name: string; version: string; notification(msg: FG.Notification): FG_Plugin.Notification; -- 2.40.1 From a3f4be8ce6d21e1d74384d2a3d5d891c6feac4bd Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 11 Nov 2021 13:34:33 +0100 Subject: [PATCH 12/24] [deps] Update dependencies, increase version --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cd9aea3..4087cff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.4", + "version": "1.0.0-alpha.5", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", @@ -19,12 +19,12 @@ "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, "peerDependencies": { - "vue": "~3.2.4", - "vue-router": "~4.0.11" + "vue": "^3.2.4", + "vue-router": "^4.0.11" }, "devDependencies": { - "prettier": "^2.3.2", - "typescript": "^4.3.5" + "prettier": "^2.4.1", + "typescript": "^4.4.4" }, "prettier": { "singleQuote": true, -- 2.40.1 From c37f4db2418a469608a80062a6d1baf7a0bde18a Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 24 Nov 2021 14:34:03 +0100 Subject: [PATCH 13/24] [plugin] Modifications on Plugin Notification * Add function called before Notification gets dismissed * Promises can have any type, we do not need to force void return type --- package.json | 4 ++-- types/plugin.d.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4087cff..2b927e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.5", + "version": "1.0.0-alpha.6", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", @@ -24,7 +24,7 @@ }, "devDependencies": { "prettier": "^2.4.1", - "typescript": "^4.4.4" + "typescript": "^4.5.2" }, "prettier": { "singleQuote": true, diff --git a/types/plugin.d.ts b/types/plugin.d.ts index e595f82..78d4cf3 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -62,10 +62,12 @@ export namespace FG_Plugin { * Interface for a frontend notification */ export interface Notification extends FG.Notification { - /** If set a button for accepting will be shown, this function will get called before deleting the notification */ - accept?(): Promise; - /** If set this function is called before the notification gets deleted */ - reject?(): Promise; + /** If set, a button for accepting will be shown, this function will get called before deleting the notification */ + accept?(): Promise; + /** If set, a reject button is shown and this function is called before the notification gets deleted */ + reject?(): Promise; + /** If set, this function is called before the notification gets deleted */ + dismiss?(): Promise; /** If set the notification text is interpreted as a link to this location */ link?: RouteLocationRaw; /** If set this icon is used */ -- 2.40.1 From 9094b38a8ac2ecafba39c77ed3ba5db14bd1276e Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 25 Nov 2021 13:39:44 +0100 Subject: [PATCH 14/24] Add pagination types --- package.json | 2 +- types/flaschengeist.d.ts | 14 ++++++++++++++ types/plugin.d.ts | 11 ++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2b927e1..56a4889 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.6", + "version": "1.0.0-alpha.7", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", diff --git a/types/flaschengeist.d.ts b/types/flaschengeist.d.ts index 96bc55f..9715d78 100644 --- a/types/flaschengeist.d.ts +++ b/types/flaschengeist.d.ts @@ -1,3 +1,7 @@ +/** + * Types used for communicating with the API + */ + declare namespace FG { interface Notification { id: number; @@ -31,4 +35,14 @@ declare namespace FG { name: string; permissions: Array; } + interface PaginationFilter { + limit?: number; + offset?: number; + from?: Date; + to?: Date; + } + interface PaginationResponse { + result: T[]; + count: number; + } } diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 78d4cf3..ec54211 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -1,6 +1,11 @@ import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router'; import type { Component } from '@vue/runtime-core'; +/** + * Types used for defining custom plugins and loading those plugins + * + Additional types for plugin interaction with the core + */ + /* This is some sort of PEP440 subset */ type Join = T extends [] ? '' @@ -114,7 +119,7 @@ export namespace FG_Plugin { /** Name of the target route */ link: RouteRecordName; /** - * Order inside the menu, higher numbers come ahead of lower numbers + * Order inside the menu, higher numbers come ahead of lower numbers * @todo: Promote to required with first beta */ order?: number; @@ -141,9 +146,9 @@ export namespace FG_Plugin { */ priority?: number; /** - * Default order on the dashboard, higher numbers come ahead of lower numbers + * Default order on the dashboard, higher numbers come ahead of lower numbers * @todo Promote to required if priority is removed - */ + */ order?: number; permissions: FG.Permission[]; widget: Component; -- 2.40.1 From a21475a0d490e5d47ece33fc66a611a628c5f5bd Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 25 Nov 2021 15:29:34 +0100 Subject: [PATCH 15/24] Add "descending" to filter args --- package.json | 2 +- types/flaschengeist.d.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 56a4889..d01715f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.7", + "version": "1.0.0-alpha.8", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", diff --git a/types/flaschengeist.d.ts b/types/flaschengeist.d.ts index 9715d78..9230e64 100644 --- a/types/flaschengeist.d.ts +++ b/types/flaschengeist.d.ts @@ -40,6 +40,8 @@ declare namespace FG { offset?: number; from?: Date; to?: Date; + /** Default to ascending */ + descending?: boolean; } interface PaginationResponse { result: T[]; -- 2.40.1 From 471fb486d56ddd84956f21d6bdd7cfd928b99fbb Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 26 Nov 2021 23:04:15 +0100 Subject: [PATCH 16/24] Add types for backend response --- package.json | 2 +- types/PEP440.d.ts | 14 ++++++++++++++ types/flaschengeist.d.ts | 9 +++++++++ types/index.d.ts | 1 + types/plugin.d.ts | 15 +-------------- 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 types/PEP440.d.ts diff --git a/package.json b/package.json index d01715f..b6249d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.8", + "version": "1.0.0-alpha.9", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", diff --git a/types/PEP440.d.ts b/types/PEP440.d.ts new file mode 100644 index 0000000..f5c0a18 --- /dev/null +++ b/types/PEP440.d.ts @@ -0,0 +1,14 @@ +/* This is some sort of PEP440 subset */ +type Join = T extends [] + ? '' + : T extends [string | number | boolean | bigint] + ? `${T[0]}` + : T extends [string | number | boolean | bigint, ...infer U] + ? `${T[0]}${D}${Join}` + : string; +type BaseVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'>; +type PreRelease = Join<[['a' | 'b' | 'rc'], number], '.'>; +type PRVersion = BaseVersion | `${BaseVersion}${PreRelease}`; + +/** A PEP440 subset used to describe backend module versions */ +declare type PEP440Version = PRVersion | `${PRVersion}.dev${number}`; \ No newline at end of file diff --git a/types/flaschengeist.d.ts b/types/flaschengeist.d.ts index 9230e64..4133763 100644 --- a/types/flaschengeist.d.ts +++ b/types/flaschengeist.d.ts @@ -1,8 +1,17 @@ +/// /** * Types used for communicating with the API */ declare namespace FG { + interface BackendPlugin { + permissions: string[]; + version: PEP440Version; + } + interface Backend { + plugins: {[key: string]: BackendPlugin}; + version: PEP440Version; + } interface Notification { id: number; plugin: string; diff --git a/types/index.d.ts b/types/index.d.ts index b9624c7..b79cf34 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,3 +1,4 @@ /// +/// export * from './plugin'; diff --git a/types/plugin.d.ts b/types/plugin.d.ts index ec54211..e66a8f1 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -1,3 +1,4 @@ +/// import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router'; import type { Component } from '@vue/runtime-core'; @@ -6,20 +7,6 @@ import type { Component } from '@vue/runtime-core'; * + Additional types for plugin interaction with the core */ -/* This is some sort of PEP440 subset */ -type Join = T extends [] - ? '' - : T extends [string | number | boolean | bigint] - ? `${T[0]}` - : T extends [string | number | boolean | bigint, ...infer U] - ? `${T[0]}${D}${Join}` - : string; -type BaseVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'>; -type PreRelease = Join<[['a' | 'b' | 'rc'], number], '.'>; -type PRVersion = BaseVersion | `${BaseVersion}${PreRelease}`; -/** A PEP440 subset used to describe backend module versions */ -export type PEP440Version = PRVersion | `${PRVersion}.dev${number}`; - export namespace FG_Plugin { /** * Interface defining a Flaschengeist plugin -- 2.40.1 From bd7472526373db0514e1f25dff5b0184e609afd1 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 5 Dec 2021 14:21:18 +0100 Subject: [PATCH 17/24] Sync with backend, added deleted prop to users --- types/PEP440.d.ts | 2 +- types/api.d.ts | 27 ++++++++++++++++++++++ types/index.d.ts | 3 ++- types/{flaschengeist.d.ts => models.d.ts} | 28 ++--------------------- 4 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 types/api.d.ts rename types/{flaschengeist.d.ts => models.d.ts} (53%) diff --git a/types/PEP440.d.ts b/types/PEP440.d.ts index f5c0a18..f55b2b9 100644 --- a/types/PEP440.d.ts +++ b/types/PEP440.d.ts @@ -11,4 +11,4 @@ type PreRelease = Join<[['a' | 'b' | 'rc'], number], '.'>; type PRVersion = BaseVersion | `${BaseVersion}${PreRelease}`; /** A PEP440 subset used to describe backend module versions */ -declare type PEP440Version = PRVersion | `${PRVersion}.dev${number}`; \ No newline at end of file +declare type PEP440Version = PRVersion | `${PRVersion}.dev${number}`; diff --git a/types/api.d.ts b/types/api.d.ts new file mode 100644 index 0000000..2d473bb --- /dev/null +++ b/types/api.d.ts @@ -0,0 +1,27 @@ +/// +/** + * Types used for communicating with the API + */ + +declare namespace FG { + interface BackendPlugin { + permissions: string[]; + version: PEP440Version; + } + interface Backend { + plugins: { [key: string]: BackendPlugin }; + version: PEP440Version; + } + interface PaginationFilter { + limit?: number; + offset?: number; + from?: Date; + to?: Date; + /** Default to ascending */ + descending?: boolean; + } + interface PaginationResponse { + result: T[]; + count: number; + } +} diff --git a/types/index.d.ts b/types/index.d.ts index b79cf34..2995593 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,4 +1,5 @@ -/// +/// +/// /// export * from './plugin'; diff --git a/types/flaschengeist.d.ts b/types/models.d.ts similarity index 53% rename from types/flaschengeist.d.ts rename to types/models.d.ts index 4133763..c8972c8 100644 --- a/types/flaschengeist.d.ts +++ b/types/models.d.ts @@ -1,17 +1,5 @@ -/// -/** - * Types used for communicating with the API - */ - +/** Models exported from backend */ declare namespace FG { - interface BackendPlugin { - permissions: string[]; - version: PEP440Version; - } - interface Backend { - plugins: {[key: string]: BackendPlugin}; - version: PEP440Version; - } interface Notification { id: number; plugin: string; @@ -21,6 +9,7 @@ declare namespace FG { } interface User { userid: string; + deleted: boolean; display_name: string; firstname: string; lastname: string; @@ -28,7 +17,6 @@ declare namespace FG { birthday?: Date; roles: Array; permissions?: Array; - avatar_url?: string; } interface Session { expires: Date; @@ -44,16 +32,4 @@ declare namespace FG { name: string; permissions: Array; } - interface PaginationFilter { - limit?: number; - offset?: number; - from?: Date; - to?: Date; - /** Default to ascending */ - descending?: boolean; - } - interface PaginationResponse { - result: T[]; - count: number; - } } -- 2.40.1 From 56823952d4fed551545a0de3b1dbc77e3ea9ccaf Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 5 Dec 2021 14:24:34 +0100 Subject: [PATCH 18/24] Tag a new alpha version, update dependencies --- .npmignore | 2 ++ package.json | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..7cb793f --- /dev/null +++ b/.npmignore @@ -0,0 +1,2 @@ +yarn-error.log +yarn.lock \ No newline at end of file diff --git a/package.json b/package.json index b6249d2..7a0eedb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.9", + "version": "1.0.0-alpha.10", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", @@ -19,11 +19,11 @@ "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, "peerDependencies": { - "vue": "^3.2.4", + "vue": "^3.2.20", "vue-router": "^4.0.11" }, "devDependencies": { - "prettier": "^2.4.1", + "prettier": "^2.5.1", "typescript": "^4.5.2" }, "prettier": { -- 2.40.1 From 71949bbd2024716aeab6d90c271ecdf3737ddb9d Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 6 Dec 2021 01:32:43 +0100 Subject: [PATCH 19/24] chore(package): rename scripts to align with other packages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a0eedb..789fede 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "typings": "types/index.d.ts", "scripts": { "valid": "tsc --noEmit", - "pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" + "format": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, "peerDependencies": { "vue": "^3.2.20", -- 2.40.1 From b2c93cda2af9b091687eb209438fc07801a00b06 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 14 Dec 2021 15:57:25 +0100 Subject: [PATCH 20/24] feat(ci): Added woodpecker CI --- .woodpecker/deploy.yml | 16 ++++++++++++++++ README.md | 1 + package.json | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .woodpecker/deploy.yml diff --git a/.woodpecker/deploy.yml b/.woodpecker/deploy.yml new file mode 100644 index 0000000..0416e64 --- /dev/null +++ b/.woodpecker/deploy.yml @@ -0,0 +1,16 @@ +pipeline: + validate: + image: node:lts-alpine + commands: + - yarn install + - yarn valid + deploy: + image: node:lts-alpine + commands: + - echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > .npmrc + - yarn publish --non-interactive + secrets: [ node_auth_token ] + when: + event: tag + tag: v* + diff --git a/README.md b/README.md index 2211b6e..76621e3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Flaschengeist types +![status-badge](https://ci.os-sc.org/api/badges/Flaschengeist/flaschengeist-types/status.svg) This package provides the TypeScript typings needed for developing with the [Flaschengeist](https://flaschengeist.dev/Flaschengeist/flaschengeist) and the [Flaschengeist-Plugin](https://flaschengeist.dev/Flaschengeist/flaschengeist-frontend) API. diff --git a/package.json b/package.json index 789fede..a7c0c9c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "typings": "types/index.d.ts", "scripts": { "valid": "tsc --noEmit", - "format": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" + "format": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'" }, "peerDependencies": { "vue": "^3.2.20", -- 2.40.1 From 7f0d124d310d9ca168ba352bcd33e4ea82720667 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 14 Dec 2021 17:37:50 +0100 Subject: [PATCH 21/24] chore(ui): Add missing packages to devel packages --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a7c0c9c..1dc8229 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,11 @@ "vue-router": "^4.0.11" }, "devDependencies": { + "@babel/types": "^7.16.0", "prettier": "^2.5.1", - "typescript": "^4.5.2" + "typescript": "^4.5.2", + "vue": "^3.2.26", + "vue-router": "^4.0.12" }, "prettier": { "singleQuote": true, -- 2.40.1 From 74a4c7c8d80f8acbaf430115978b4d027980cca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 16 Jan 2024 19:55:03 +0100 Subject: [PATCH 22/24] update version to 1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1dc8229..dc72835 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0-alpha.10", + "version": "1.0.0", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", -- 2.40.1 From 87775602f5e2480cc4c0907f77d65064bbe151f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 14:05:58 +0200 Subject: [PATCH 23/24] [feat] add settingWidgets --- types/models.d.ts | 3 +++ types/plugin.d.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/types/models.d.ts b/types/models.d.ts index c8972c8..3ac8bfa 100644 --- a/types/models.d.ts +++ b/types/models.d.ts @@ -1,5 +1,8 @@ /** Models exported from backend */ declare namespace FG { + interface UserSettings { + display_name: string; + } interface Notification { id: number; plugin: string; diff --git a/types/plugin.d.ts b/types/plugin.d.ts index e66a8f1..5d33c11 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -20,6 +20,8 @@ export namespace FG_Plugin { version: string; /** Widgets provided by this plugin */ widgets: Widget[]; + /** Widget for settings provided by this plugin **/ + settingsWidgets?: Widget[]; /** Backend modules needed for this plugin to work correctly */ requiredModules: [string, PEP440Version?][]; /** Menu entries for authenticated users */ @@ -141,3 +143,4 @@ export namespace FG_Plugin { widget: Component; } } + -- 2.40.1 From 9eb3191824077f85ac07d939b8a0c61a31ffa66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 15:24:48 +0200 Subject: [PATCH 24/24] update to v1.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dc72835..1a6f939 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "license": "MIT", - "version": "1.0.0", + "version": "1.1.0", "name": "@flaschengeist/types", "author": "Ferdinand Thiessen ", "homepage": "https://flaschengeist.dev/", -- 2.40.1