Add types for backend response
This commit is contained in:
parent
a21475a0d4
commit
3a6f7e9dc5
|
@ -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}`;
|
|
@ -1,8 +1,17 @@
|
|||
/// <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 Notification {
|
||||
id: number;
|
||||
plugin: string;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/// <reference path="flaschengeist.d.ts" />
|
||||
/// <reference path="PEP440.d.ts" />
|
||||
|
||||
export * from './plugin';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/// <reference path="PEP440.d.ts" />
|
||||
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 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 */
|
||||
export type PEP440Version = PRVersion | `${PRVersion}.dev${number}`;
|
||||
|
||||
export namespace FG_Plugin {
|
||||
/**
|
||||
* Interface defining a Flaschengeist plugin
|
||||
|
|
Loading…
Reference in New Issue