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