mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 04:13:47 +00:00
create universal Subscription
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { TimerLifeCycle, OscSubscription } from 'ontime-types';
|
||||
import { TimerLifeCycle, Subscription } from 'ontime-types';
|
||||
|
||||
export type TimerLifeCycleKey = keyof typeof TimerLifeCycle;
|
||||
|
||||
export default interface IIntegration {
|
||||
subscriptions: OscSubscription;
|
||||
subscriptions: Subscription;
|
||||
init: (config: unknown) => OperationReturn;
|
||||
dispatch: (action: TimerLifeCycleKey, state?: object) => OperationReturn;
|
||||
emit: (...args: unknown[]) => unknown;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ArgumentType, Client, Message } from 'node-osc';
|
||||
import { OSCSettings, OscSubscription } from 'ontime-types';
|
||||
import { OSCSettings, Subscription } from 'ontime-types';
|
||||
|
||||
import IIntegration, { TimerLifeCycleKey } from './IIntegration.js';
|
||||
import { parseTemplateNested } from './integrationUtils.js';
|
||||
@@ -15,7 +15,7 @@ type Action = TimerLifeCycleKey | string;
|
||||
*/
|
||||
export class OscIntegration implements IIntegration {
|
||||
protected oscClient: null | Client;
|
||||
subscriptions: OscSubscription;
|
||||
subscriptions: Subscription;
|
||||
|
||||
constructor() {
|
||||
this.oscClient = null;
|
||||
@@ -57,7 +57,7 @@ export class OscIntegration implements IIntegration {
|
||||
}
|
||||
}
|
||||
|
||||
initSubscriptions(subscriptionOptions: OscSubscription) {
|
||||
initSubscriptions(subscriptionOptions: Subscription) {
|
||||
if (validateOscObject(subscriptionOptions)) {
|
||||
this.subscriptions = { ...subscriptionOptions };
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
EndAction,
|
||||
OntimeRundown,
|
||||
OSCSettings,
|
||||
OscSubscription,
|
||||
OscSubscriptionOptions,
|
||||
Subscription,
|
||||
SubscriptionOptions,
|
||||
ProjectData,
|
||||
Settings,
|
||||
TimerLifeCycle,
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { TimerLifeCycleKey } from './TimerLifecycle.type.js';
|
||||
|
||||
export type OscSubscriptionOptions = { message: string; enabled: boolean };
|
||||
export type OscSubscription = { [key in TimerLifeCycleKey]: OscSubscriptionOptions[] };
|
||||
import { Subscription } from './Subscription.type.js';
|
||||
|
||||
export interface OSCSettings {
|
||||
portIn: number;
|
||||
@@ -9,5 +6,5 @@ export interface OSCSettings {
|
||||
targetIP: string;
|
||||
enabledIn: boolean;
|
||||
enabledOut: boolean;
|
||||
subscriptions: OscSubscription;
|
||||
subscriptions: Subscription;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { TimerLifeCycleKey } from './TimerLifecycle.type.js';
|
||||
|
||||
export type SubscriptionOptions = { message: string; enabled: boolean };
|
||||
export type Subscription = { [key in TimerLifeCycleKey]: SubscriptionOptions[] };
|
||||
@@ -28,9 +28,10 @@ export type { Alias } from './definitions/core/Alias.type.js';
|
||||
// ---> User Fields
|
||||
export type { UserFields } from './definitions/core/UserFields.type.js';
|
||||
|
||||
// ---> Integration, Subscription
|
||||
export type { Subscription, SubscriptionOptions } from './definitions/core/Subscription.type.js';
|
||||
// ---> OSC
|
||||
export type { OSCSettings, OscSubscription, OscSubscriptionOptions } from './definitions/core/OscSettings.type.js';
|
||||
|
||||
export type { OSCSettings } from './definitions/core/OscSettings.type.js';
|
||||
// ---> HTTP
|
||||
|
||||
// SERVER RUNTIME
|
||||
|
||||
Reference in New Issue
Block a user