Compare commits
No commits in common. "7c1630649a8483fd1872d53e1e238ed10b0b66fc" and "ac5dc4d634ca2944884a2c3e648dca2211ffccef" have entirely different histories.
7c1630649a
...
ac5dc4d634
|
@ -0,0 +1,4 @@
|
|||
node_modules/
|
||||
dist/
|
||||
# We do not rely on specific version, no need to share this
|
||||
yarn.lock
|
32
LICENSE
32
LICENSE
|
@ -1,19 +1,21 @@
|
|||
MIT License Copyright (c) <year> <copyright holders>
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
Copyright 2021 Tim Gröger | Flaschengeist Developers
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# flaschengeist-types
|
||||
|
||||
Typescript typings for Flaschengeist and @flaschengeist/api
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"version": "0.0.1",
|
||||
"name": "@flaschengeist/types",
|
||||
"author": "Ferdinand <rpm@fthiessen.de>",
|
||||
"homepage": "https://flaschengeist.dev/Flaschengeist",
|
||||
"description": "Flaschengeist TypeScript typings",
|
||||
"bugs": {
|
||||
"url": "https://flaschengeist.dev/Flaschengeist/flaschengeist/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-typings"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/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"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"flaschengeist": "^2.0.0-alpha.1"
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true,
|
||||
"semi": true,
|
||||
"printWidth": 100,
|
||||
"arrowParens": "always"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
/// <reference path="plugin.d.ts" />
|
||||
/// <reference path="flaschengeist.d.ts" />
|
|
@ -0,0 +1 @@
|
|||
/// <reference path="index.d.ts" />
|
|
@ -0,0 +1,117 @@
|
|||
import { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router';
|
||||
import { Component } from 'vue';
|
||||
|
||||
declare namespace FG_Plugin {
|
||||
/**
|
||||
* Interface defining a Flaschengeist plugin
|
||||
*/
|
||||
interface Plugin {
|
||||
name: string;
|
||||
version: string;
|
||||
widgets: Widget[];
|
||||
/** Pther frontend modules needed for this plugin to work correctly */
|
||||
requiredModules: string[];
|
||||
/** Backend modules needed for this plugin to work correctly */
|
||||
requiredBackendModules: string[];
|
||||
/** Menu entries for authenticated users */
|
||||
innerRoutes?: MenuRoute[];
|
||||
/** Public menu entries (without authentification) */
|
||||
outerRoutes?: MenuRoute[];
|
||||
/** Routes without menu links, for internal usage */
|
||||
internalRoutes?: NamedRouteRecordRaw[];
|
||||
/** Handle notifications, defaults to boot/plugins.ts:translateNotification() */
|
||||
notification?(msg: FG.Notification): FG_Plugin.Notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the loaded state of the Flaschengeist
|
||||
*/
|
||||
interface Flaschengeist {
|
||||
/** All loaded plugins */
|
||||
plugins: LoadedPlugin[];
|
||||
/** All routes, combined from all plugins */
|
||||
routes: RouteRecordRaw[];
|
||||
/** All menu entries */
|
||||
menuLinks: MenuLink[];
|
||||
/** All inner shortcuts */
|
||||
shortcuts: Shortcut[];
|
||||
/** All outer shortcuts */
|
||||
outerShortcuts: Shortcut[];
|
||||
/** All widgets */
|
||||
widgets: Widget[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>;
|
||||
/** If set the notification text is interpreted as a link to this location */
|
||||
link?: RouteLocationRaw;
|
||||
/** If set this icon is used */
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loaded Flaschengeist plugin
|
||||
*/
|
||||
interface LoadedPlugin {
|
||||
name: string;
|
||||
version: string;
|
||||
notification(msg: FG.Notification): FG_Plugin.Notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a shortcut link
|
||||
*/
|
||||
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 menu entry in the main menu
|
||||
*/
|
||||
interface MenuLink extends MenuEntry {
|
||||
/** Name of the target route */
|
||||
link: RouteRecordName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base interface for internal use
|
||||
*/
|
||||
interface MenuEntry {
|
||||
title: string | (() => string);
|
||||
icon: string;
|
||||
permissions?: string[];
|
||||
children?: this[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget object for the dashboard
|
||||
*/
|
||||
interface Widget {
|
||||
name: string;
|
||||
priority: number;
|
||||
permissions: FG.Permission[];
|
||||
widget: Component;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue