Compare commits

..

24 Commits

Author SHA1 Message Date
Tim Gröger 9eb3191824 update to v1.1.0 2024-10-08 15:24:48 +02:00
Tim Gröger 87775602f5 [feat] add settingWidgets 2024-10-08 14:05:58 +02:00
Tim Gröger 74a4c7c8d8 update version to 1.0.0 2024-01-16 19:55:03 +01:00
Ferdinand Thiessen 7f0d124d31 chore(ui): Add missing packages to devel packages
continuous-integration/woodpecker the build was successful Details
2021-12-14 17:40:09 +01:00
Ferdinand Thiessen b2c93cda2a feat(ci): Added woodpecker CI
continuous-integration/woodpecker the build failed Details
2021-12-14 17:36:31 +01:00
Ferdinand Thiessen 71949bbd20 chore(package): rename scripts to align with other packages 2021-12-06 01:32:43 +01:00
Ferdinand Thiessen 56823952d4 Tag a new alpha version, update dependencies 2021-12-05 14:24:34 +01:00
Ferdinand Thiessen bd74725263 Sync with backend, added deleted prop to users 2021-12-05 14:21:18 +01:00
Ferdinand Thiessen 471fb486d5 Add types for backend response 2021-11-26 23:06:26 +01:00
Ferdinand Thiessen a21475a0d4 Add "descending" to filter args 2021-11-25 15:29:34 +01:00
Ferdinand Thiessen 9094b38a8a Add pagination types 2021-11-25 13:39:44 +01:00
Ferdinand Thiessen c37f4db241 [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
2021-11-24 14:34:22 +01:00
Ferdinand Thiessen a3f4be8ce6 [deps] Update dependencies, increase version 2021-11-11 13:34:33 +01:00
Ferdinand Thiessen 84f66ab86a [plugin] Add ID to loaded plugins 2021-11-11 13:34:17 +01:00
Ferdinand Thiessen 1c921322ae Fix dependencies 2021-08-30 14:12:33 +02:00
Ferdinand Thiessen 7cc03a31f7 [deps] Update vue dependency 2021-08-30 11:53:23 +02:00
Ferdinand Thiessen f5288cb8d3 [plugin] Allow ordering MenuLinks, widgets: renamed priority to order 2021-07-29 18:14:49 +02:00
Ferdinand Thiessen 618d543dbb [docs] Added README 2021-05-26 17:19:05 +02:00
Ferdinand Thiessen fddbe60b45 [core] Only export types for @flaschengeist/api 2021-05-26 16:55:53 +02:00
Ferdinand Thiessen 6ab3bf2ad5 [format] Run prettier 2021-05-26 16:55:24 +02:00
Ferdinand Thiessen 1f1d0fe32e [deps] No need for peerDependency 2021-05-25 16:53:13 +02:00
Ferdinand Thiessen 131063dae8 [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".
2021-05-25 16:48:14 +02:00
Ferdinand Thiessen 0ee466efb9 [deps] peer depend on api package instead of main package 2021-05-25 15:46:04 +02:00
Ferdinand Thiessen 91888f694b [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
2021-05-21 17:04:29 +02:00
13 changed files with 190 additions and 185 deletions

2
.npmignore Normal file
View File

@ -0,0 +1,2 @@
yarn-error.log
yarn.lock

16
.woodpecker/deploy.yml Normal file
View File

@ -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*

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# 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.
## 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).

View File

@ -1,32 +1,33 @@
{
"private": true,
"license": "MIT",
"version": "0.0.1",
"version": "1.1.0",
"name": "@flaschengeist/types",
"author": "Ferdinand <rpm@fthiessen.de>",
"homepage": "https://flaschengeist.dev/Flaschengeist",
"author": "Ferdinand Thiessen <rpm@fthiessen.de>",
"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"
},
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"flat": true,
"typings": "types/index.d.ts",
"scripts": {
"build": "tsc",
"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"
"valid": "tsc --noEmit",
"format": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'"
},
"peerDependencies": {
"flaschengeist": "^2.0.0-alpha.1"
"vue": "^3.2.20",
"vue-router": "^4.0.11"
},
"devDependencies": {
"@babel/types": "^7.16.0",
"prettier": "^2.5.1",
"typescript": "^4.5.2",
"vue": "^3.2.26",
"vue-router": "^4.0.12"
},
"prettier": {
"singleQuote": true,

137
src/flaschengeist.d.ts vendored
View File

@ -1,137 +0,0 @@
declare namespace FG {
interface Notification {
id: number;
plugin: string;
text: string;
data?: unknown;
time: Date;
}
interface User {
userid: string;
display_name: string;
firstname: string;
lastname: string;
mail: string;
birthday?: Date;
roles: Array<string>;
permissions?: Array<string>;
avatar_url?: string;
}
interface Session {
expires: Date;
token: string;
lifetime: number;
browser: string;
platform: string;
userid: string;
}
type Permission = string;
interface Role {
id: number;
name: string;
permissions: Array<Permission>;
}
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<Job>;
}
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<Service>;
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<Tag>;
type?: DrinkType;
volumes: Array<DrinkPriceVolume>;
uuid: string;
receipt?: Array<string>;
}
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<MinPrices>;
prices: Array<DrinkPrice>;
ingredients: Array<Ingredient>;
}
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
src/index.d.ts vendored
View File

@ -1,2 +0,0 @@
/// <reference path="plugin.d.ts" />
/// <reference path="flaschengeist.d.ts" />

View File

@ -1 +0,0 @@
/// <reference path="index.d.ts" />

View File

@ -4,9 +4,8 @@
"target": "esnext",
"module": "esnext",
"declaration": true,
"outDir": "./dist",
"strict": true,
"moduleResolution": "node"
"moduleResolution": "Node"
},
"exclude": [
"node_modules",

14
types/PEP440.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
/* This is some sort of PEP440 subset */
type Join<T extends unknown[], D extends string> = T extends []
? ''
: T extends [string | number | boolean | bigint]
? `${T[0]}`
: T extends [string | number | boolean | bigint, ...infer U]
? `${T[0]}${D}${Join<U, D>}`
: 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}`;

27
types/api.d.ts vendored Normal file
View File

@ -0,0 +1,27 @@
/// <reference path="PEP440.d.ts" />
/**
* 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<T> {
result: T[];
count: number;
}
}

5
types/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/// <reference path="api.d.ts" />
/// <reference path="models.d.ts" />
/// <reference path="PEP440.d.ts" />
export * from './plugin';

38
types/models.d.ts vendored Normal file
View File

@ -0,0 +1,38 @@
/** Models exported from backend */
declare namespace FG {
interface UserSettings {
display_name: string;
}
interface Notification {
id: number;
plugin: string;
text: string;
data?: any;
time: Date;
}
interface User {
userid: string;
deleted: boolean;
display_name: string;
firstname: string;
lastname: string;
mail: string;
birthday?: Date;
roles: Array<string>;
permissions?: Array<string>;
}
interface Session {
expires: Date;
token: string;
lifetime: number;
browser: string;
platform: string;
userid: string;
}
type Permission = string;
interface Role {
id: number;
name: string;
permissions: Array<Permission>;
}
}

View File

@ -1,18 +1,29 @@
import { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router';
import { Component } from 'vue';
/// <reference path="PEP440.d.ts" />
import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router';
import type { Component } from '@vue/runtime-core';
declare namespace FG_Plugin {
/**
* Types used for defining custom plugins and loading those plugins
* + Additional types for plugin interaction with the core
*/
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[];
/** Widget for settings provided by this plugin **/
settingsWidgets?: Widget[];
/** Backend modules needed for this plugin to work correctly */
requiredBackendModules: string[];
requiredModules: [string, PEP440Version?][];
/** Menu entries for authenticated users */
innerRoutes?: MenuRoute[];
/** Public menu entries (without authentification) */
@ -26,7 +37,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,11 +55,13 @@ declare namespace FG_Plugin {
/**
* Interface for a frontend notification
*/
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<void>;
/** If set this function is called before the notification gets deleted */
reject?(): Promise<void>;
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<any>;
/** If set, a reject button is shown and this function is called before the notification gets deleted */
reject?(): Promise<any>;
/** If set, this function is called before the notification gets deleted */
dismiss?(): Promise<any>;
/** If set the notification text is interpreted as a link to this location */
link?: RouteLocationRaw;
/** If set this icon is used */
@ -59,6 +72,7 @@ declare namespace FG_Plugin {
* Loaded Flaschengeist plugin
*/
interface LoadedPlugin {
id: string;
name: string;
version: string;
notification(msg: FG.Notification): FG_Plugin.Notification;
@ -67,32 +81,37 @@ 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;
/**
* Order inside the menu, higher numbers come ahead of lower numbers
* @todo: Promote to required with first beta
*/
order?: number;
}
/**
@ -108,10 +127,20 @@ declare namespace FG_Plugin {
/**
* Widget object for the dashboard
*/
interface Widget {
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;
}
}