mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
feat: export package to help api consumers (#1624)
This commit is contained in:
committed by
Carlos Valente
parent
a5d628af0c
commit
5716fc31cf
@@ -0,0 +1 @@
|
||||
*.tgz
|
||||
@@ -0,0 +1,17 @@
|
||||
# Ontime Resolver
|
||||
|
||||
Congratulations! You got this far into Ontime's rabbit hole and want to manage your installation.
|
||||
|
||||
The Resolver is an attempt to expose our ontime's api so it is easier to integrate with
|
||||
|
||||
## Links
|
||||
- [Ontime's repository](https://github.com/cpvalente/ontime)
|
||||
- [Ontime's documentation](https://docs.getontime.no/)
|
||||
- [Ontime's website](https://getontime.no/)
|
||||
|
||||
## Sponsoring
|
||||
You can help the development of this project or say thank you with a one time donation. \
|
||||
See the [terms of donations](https://github.com/cpvalente/ontime/blob/master/SPONSOR.md)
|
||||
|
||||
[](https://github.com/sponsors/cpvalente)
|
||||
[](https://www.buymeacoffee.com/cpvalente)
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@getontime/resolver",
|
||||
"version": "4.0.0-beta.3",
|
||||
"type": "module",
|
||||
"repository": "https://github.com/cpvalente/ontime",
|
||||
"types": "./dist/main.d.ts",
|
||||
"main": "./dist/main.js",
|
||||
"private": true,
|
||||
"description": "shared typings for ontime",
|
||||
"scripts": {
|
||||
"lint": "eslint . --quiet",
|
||||
"prebuild": "pnpm rimraf ./dist",
|
||||
"build": "tsup && pnpm rimraf ./dist/index.js",
|
||||
"postbuild": "pnpm rimraf ./dist/index.d.ts"
|
||||
},
|
||||
"keywords": ["ontime", "resolver", "parser"],
|
||||
"author": "",
|
||||
"license": "AGPL-3.0-only",
|
||||
"devDependencies": {
|
||||
"@sprout2000/esbuild-copy-plugin": "^1.1.19",
|
||||
"@typescript-eslint/parser": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"tsup": "^8.5.0",
|
||||
"rimraf": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"ontime-types": "workspace:^4.0.0"
|
||||
},
|
||||
"files": ["dist"]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// api
|
||||
export { MessageTag, RefetchKey } from 'ontime-types';
|
||||
export type { ApiAction, ApiActionTag, ApiResponse } from 'ontime-types';
|
||||
export type { WsPacketToClient, WsPacketToServer } from 'ontime-types';
|
||||
|
||||
// stores
|
||||
export type { RuntimeStore, TimerState, MessageState, RundownState, Offset } from 'ontime-types';
|
||||
export { TimerPhase, Playback, runtimeStorePlaceholder, OffsetMode } from 'ontime-types';
|
||||
|
||||
// aux timer
|
||||
export type { SimpleTimerState } from 'ontime-types';
|
||||
export { SimplePlayback, SimpleDirection } from 'ontime-types';
|
||||
|
||||
// entries
|
||||
export type { OntimeEvent, OntimeGroup, EntryCustomFields, CustomFields, Rundown } from 'ontime-types';
|
||||
export { SupportedEntry, isOntimeEvent, isOntimeGroup, isOntimeDelay, isOntimeMilestone } from 'ontime-types';
|
||||
|
||||
// functions
|
||||
export { isWsPacketToClient } from './websocket.js';
|
||||
export type { SocketSender } from './websocket.js';
|
||||
@@ -0,0 +1,18 @@
|
||||
import { ApiAction, ApiActionTag, MessageTag, WsPacketToClient, WsPacketToServer } from 'ontime-types';
|
||||
|
||||
/**
|
||||
* A helper type for sending correct websocket messages to ontime
|
||||
*/
|
||||
export type SocketSender = <T extends MessageTag | ApiActionTag>(
|
||||
tag: T,
|
||||
payload: T extends MessageTag
|
||||
? Pick<WsPacketToServer & { tag: T }, 'payload'>['payload']
|
||||
: Pick<ApiAction & { tag: T }, 'payload'>['payload'],
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* a soft type guard for WS packets
|
||||
*/
|
||||
export function isWsPacketToClient(data: unknown): data is WsPacketToClient {
|
||||
return typeof data === 'object' && data !== null && 'tag' in data && 'payload' in data;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "preserve",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"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",
|
||||
"sourceMap": true,
|
||||
"baseUrl": "src",
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
import copyPlugin from '@sprout2000/esbuild-copy-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
clean: false, //we can't use clean as i dose so after the copy plugin runs
|
||||
entry: ['src/main.ts'],
|
||||
outDir: 'dist',
|
||||
bundle: true,
|
||||
|
||||
dts: { resolve: true },
|
||||
format: 'esm',
|
||||
target: 'esnext',
|
||||
platform: 'node',
|
||||
esbuildPlugins: [
|
||||
copyPlugin.copyPlugin({
|
||||
src: './node_modules/ontime-types/dist',
|
||||
dest: './dist',
|
||||
}),
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user