update to 1.1.0 #1
|
@ -0,0 +1,2 @@
|
|||
yarn-error.log
|
||||
yarn.lock
|
|
@ -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*
|
||||
|
|
@ -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).
|
33
package.json
33
package.json
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
/// <reference path="plugin.d.ts" />
|
||||
/// <reference path="flaschengeist.d.ts" />
|
|
@ -1 +0,0 @@
|
|||
/// <reference path="index.d.ts" />
|
|
@ -4,9 +4,8 @@
|
|||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"moduleResolution": "node"
|
||||
"moduleResolution": "Node"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
|
|
@ -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}`;
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
/// <reference path="api.d.ts" />
|
||||
/// <reference path="models.d.ts" />
|
||||
/// <reference path="PEP440.d.ts" />
|
||||
|
||||
export * from './plugin';
|
|
@ -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>;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue