mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 13:44:12 +00:00
feat: export package to help api consumers (#1624)
This commit is contained in:
committed by
Carlos Valente
parent
a5d628af0c
commit
5716fc31cf
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"version": "4.0.0-beta.3",
|
||||
"name": "ontime-types",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
@@ -7,7 +8,8 @@
|
||||
"description": "shared typings for ontime",
|
||||
"scripts": {
|
||||
"cleanup": "rm -rf .turbo && rm -rf node_modules",
|
||||
"lint": "eslint . --quiet"
|
||||
"lint": "eslint . --quiet",
|
||||
"build": "tsc"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
@@ -16,6 +18,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "catalog:",
|
||||
"@typescript-eslint/parser": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
"typescript": "catalog:",
|
||||
"ts-essentials": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,174 @@
|
||||
import type { DeepPartial } from 'ts-essentials';
|
||||
|
||||
import type { OntimeEvent } from '../../definitions/core/OntimeEntry.js';
|
||||
import type { SimpleDirection, SimplePlayback } from '../../definitions/runtime/AuxTimer.type.js';
|
||||
import type { MessageState } from '../../definitions/runtime/MessageControl.type.js';
|
||||
import type { OffsetMode } from '../../definitions/runtime/Offset.type.js';
|
||||
import type { RuntimeStore } from '../../definitions/runtime/RuntimeStore.type.js';
|
||||
|
||||
export type VersionAction = {
|
||||
tag: 'version';
|
||||
payload: undefined;
|
||||
};
|
||||
export type VersionResponse = {
|
||||
tag: 'version';
|
||||
payload: string;
|
||||
};
|
||||
|
||||
export type PollAction = {
|
||||
tag: 'poll';
|
||||
payload: undefined;
|
||||
};
|
||||
export type PollResponse = {
|
||||
tag: 'poll';
|
||||
payload: RuntimeStore;
|
||||
};
|
||||
|
||||
export type ChangeAction = {
|
||||
tag: 'change';
|
||||
payload: { [x: string]: Partial<OntimeEvent> };
|
||||
};
|
||||
export type ChangeResponse = {
|
||||
tag: 'change';
|
||||
payload: 'success' | 'throttled';
|
||||
};
|
||||
|
||||
export type MessageAction = {
|
||||
tag: 'message';
|
||||
payload: DeepPartial<MessageState>;
|
||||
};
|
||||
export type MessageResponse = {
|
||||
tag: 'message';
|
||||
payload: MessageState;
|
||||
};
|
||||
|
||||
export type StartAction = {
|
||||
tag: 'start';
|
||||
payload: undefined | { index: number } | { id: string } | { cue: string } | 'next' | 'previous';
|
||||
};
|
||||
export type StartResponse = {
|
||||
tag: 'start';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type PauseAction = {
|
||||
tag: 'pause';
|
||||
payload: undefined;
|
||||
};
|
||||
export type PauseResponse = {
|
||||
tag: 'pause';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type StopAction = {
|
||||
tag: 'stop';
|
||||
payload: undefined;
|
||||
};
|
||||
export type StopResponse = {
|
||||
tag: 'stop';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type ReloadAction = {
|
||||
tag: 'reload';
|
||||
payload: undefined;
|
||||
};
|
||||
export type ReloadResponse = {
|
||||
tag: 'reload';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type RollAction = {
|
||||
tag: 'roll';
|
||||
payload: undefined;
|
||||
};
|
||||
export type RollResponse = {
|
||||
tag: 'roll';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type LoadAction = {
|
||||
tag: 'load';
|
||||
payload: { index: number } | { id: string } | { cue: string } | 'next' | 'previous';
|
||||
};
|
||||
export type LoadResponse = {
|
||||
tag: 'load';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type AddtimeAction = {
|
||||
tag: 'addtime';
|
||||
payload: { add: number } | { remove: number } | number;
|
||||
};
|
||||
export type AddtimeResponse = {
|
||||
tag: 'addtime';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type AuxtimerAction = {
|
||||
tag: 'auxtimer';
|
||||
payload:
|
||||
| { '1': SimplePlayback }
|
||||
| { '1': { duration?: number; addtime?: number; direction?: SimpleDirection } }
|
||||
| { '2': SimplePlayback }
|
||||
| { '2': { duration?: number; addtime?: number; direction?: SimpleDirection } }
|
||||
| { '3': SimplePlayback }
|
||||
| { '3': { duration?: number; addtime?: number; direction?: SimpleDirection } };
|
||||
};
|
||||
|
||||
export type AuxtimerResponse = {
|
||||
tag: 'auxtimer';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type ClientAction = {
|
||||
tag: 'client';
|
||||
payload: { target: string } & ({ rename: string } | { redirect: string } | { identify: string });
|
||||
};
|
||||
export type ClientResponse = {
|
||||
tag: 'client';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type OffsetmodeAction = {
|
||||
tag: 'offsetmode';
|
||||
payload: OffsetMode;
|
||||
};
|
||||
export type OffsetmodeResponse = {
|
||||
tag: 'offsetmode';
|
||||
payload: 'success';
|
||||
};
|
||||
|
||||
export type ApiAction =
|
||||
| 'version'
|
||||
| 'poll'
|
||||
| 'change'
|
||||
| 'message'
|
||||
| 'start'
|
||||
| 'pause'
|
||||
| 'stop'
|
||||
| 'reload'
|
||||
| 'roll'
|
||||
| 'load'
|
||||
| 'addtime'
|
||||
| 'auxtimer'
|
||||
| 'client'
|
||||
| 'offsetmode';
|
||||
| VersionAction
|
||||
| PollAction
|
||||
| ChangeAction
|
||||
| MessageAction
|
||||
| StartAction
|
||||
| PauseAction
|
||||
| StopAction
|
||||
| ReloadAction
|
||||
| RollAction
|
||||
| LoadAction
|
||||
| AddtimeAction
|
||||
| AuxtimerAction
|
||||
| ClientAction
|
||||
| OffsetmodeAction;
|
||||
|
||||
export type ApiResponse =
|
||||
| VersionResponse
|
||||
| PollResponse
|
||||
| ChangeResponse
|
||||
| MessageResponse
|
||||
| StartResponse
|
||||
| PauseResponse
|
||||
| StopResponse
|
||||
| ReloadResponse
|
||||
| RollResponse
|
||||
| LoadResponse
|
||||
| AddtimeResponse
|
||||
| AuxtimerResponse
|
||||
| ClientResponse
|
||||
| OffsetmodeResponse;
|
||||
|
||||
export type ApiActionTag = ApiAction['tag'];
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type {
|
||||
AutomationSettings,
|
||||
CustomFields,
|
||||
ProjectData,
|
||||
ProjectRundowns,
|
||||
Settings,
|
||||
URLPreset,
|
||||
ViewSettings,
|
||||
} from '../index.js';
|
||||
|
||||
import type { AutomationSettings } from './core/Automation.type.js';
|
||||
import type { CustomFields } from './core/CustomFields.type.js';
|
||||
import type { ProjectData } from './core/ProjectData.type.js';
|
||||
import type { ProjectRundowns } from './core/Rundown.type.js';
|
||||
import type { Settings } from './core/Settings.type.js';
|
||||
import type { URLPreset } from './core/UrlPreset.type.js';
|
||||
import type { ViewSettings } from './core/Views.type.js';
|
||||
|
||||
export type DatabaseModel = {
|
||||
rundowns: ProjectRundowns;
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import type { EndAction, EntryCustomFields, MaybeNumber, TimerType, TimeStrategy, Trigger } from '../../index.js';
|
||||
import type { MaybeNumber } from '../../utils/utils.type.js';
|
||||
import type { EndAction } from '../EndAction.type.js';
|
||||
import type { TimerType } from '../TimerType.type.js';
|
||||
import type { TimeStrategy } from '../TimeStrategy.type.js';
|
||||
import type { Trigger } from './Automation.type.js';
|
||||
import type { EntryCustomFields } from './CustomFields.type.js';
|
||||
|
||||
export type EntryId = string;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MaybeNumber } from '../../index.js';
|
||||
import type { MaybeNumber } from '../../utils/utils.type.js';
|
||||
import type { Playback } from './Playback.type.js';
|
||||
|
||||
export enum TimerPhase {
|
||||
|
||||
@@ -90,7 +90,7 @@ export type { LinkOptions } from './api/session-controller/BackendResponse.type.
|
||||
export { MessageTag } from './api/websocket/data.type.js';
|
||||
export type { WsPacketToServer, WsPacketToClient } from './api/websocket/data.type.js';
|
||||
export { RefetchKey } from './api/websocket/refetch.type.js';
|
||||
export type { ApiAction } from './api/websocket/api.type.js';
|
||||
export type { ApiAction, ApiActionTag, ApiResponse } from './api/websocket/api.type.js';
|
||||
// SERVER RUNTIME
|
||||
export { type Log, LogLevel, type LogMessage, LogOrigin } from './definitions/runtime/Logger.type.js';
|
||||
export { Playback } from './definitions/runtime/Playback.type.js';
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node10",
|
||||
"resolveJsonModule": false,
|
||||
"isolatedModules": false,
|
||||
"skipLibCheck": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"allowUnreachableCode": false,
|
||||
"allowUnusedLabels": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"allowJs": true,
|
||||
"declaration": true,
|
||||
"outDir": "dist",
|
||||
},
|
||||
"include": [
|
||||
"src/index.ts",
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules", "dist"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user