add schema for manifests

This commit is contained in:
Jacob Overgaard
2022-08-24 16:03:35 +02:00
parent a185c1a885
commit d1b3f9464e
3 changed files with 163 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
import './installer';
import './manifests';
import './server';
import './upgrader';
import './user';

View File

@@ -0,0 +1,53 @@
import { body, defaultResponse, endpoint, response } from '@airtasker/spot';
import { ProblemDetails } from './models';
@endpoint({ method: 'GET', path: '/manifests' })
export class Manifests {
@response({ status: 200 })
response(@body body: ManifestsResponse) {}
@defaultResponse
default(@body body: ProblemDetails) {}
}
export type Manifest = IManifestElement | IManifestEntrypoint;
export type ManifestStandardTypes = 'section' | 'propertyEditorUI' | 'dashboard';
export interface ManifestsResponse {
manifests: Manifest[];
}
export interface IManifest {
type: string;
}
export interface MetaSection {
pathname: string;
weight: number;
}
export interface MetaPropertyEditorUI {
icon: string;
group: string;
}
export interface MetaDashboard {
sections: string[];
pathname: string;
weight: number;
}
export interface IManifestElement extends IManifest {
type: ManifestStandardTypes;
alias: string;
name: string;
js: string;
elementName: string;
meta: MetaSection | MetaPropertyEditorUI | MetaDashboard;
}
export interface IManifestEntrypoint extends IManifest {
type: 'entrypoint';
js: string;
}