Skip to content

Commit

Permalink
Fix/casting (#8)
Browse files Browse the repository at this point in the history
* update casting logic

* quick type fixes, remove legacy code from demo app

* fix event registration
  • Loading branch information
BryanChrisBrown authored Jul 7, 2023
1 parent 713c8f1 commit 21f8b42
Show file tree
Hide file tree
Showing 23 changed files with 355 additions and 179 deletions.
26 changes: 13 additions & 13 deletions docs/classes/client.BridgeClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
### Properties

- [currentPlaylistIndex](client.BridgeClient.md#currentplaylistindex)
- [isConnected](client.BridgeClient.md#isconnected)
- [isDisconnecting](client.BridgeClient.md#isdisconnecting)
- [manualDisconnect](client.BridgeClient.md#manualdisconnect)
- [playlists](client.BridgeClient.md#playlists)
- [version](client.BridgeClient.md#version)
- [eventsource](client.BridgeClient.md#eventsource)
- [fallback](client.BridgeClient.md#fallback)
- [instance](client.BridgeClient.md#instance)
- [isConnected](client.BridgeClient.md#isconnected)
- [verbosity](client.BridgeClient.md#verbosity)

### Methods
Expand Down Expand Up @@ -69,6 +69,15 @@ The index of playlists that is currently active

___

### isConnected

**isConnected**: `boolean`

A boolean that stores if the Bridge session is valid or not
If the orchestration is not valid, some functions will not work

___

### isDisconnecting

**isDisconnecting**: `boolean`
Expand Down Expand Up @@ -103,7 +112,7 @@ ___

### eventsource

`Static` **eventsource**: `undefined` \| [`BridgeEventSource`](components_eventsource.BridgeEventSource.md)
`Static` **eventsource**: [`BridgeEventSource`](components_eventsource.BridgeEventSource.md)

The websocket connection to Bridge's Event Source, this returns information from Bridge

Expand All @@ -123,15 +132,6 @@ the instance of the client that we create, BridgeClient is a singleton, there ca

___

### isConnected

`Static` **isConnected**: `boolean`

A boolean that stores if the Bridge session is valid or not
If the orchestration is not valid, some functions will not work

___

### verbosity

`Static` **verbosity**: ``0`` \| ``2`` \| ``1`` \| ``3`` = `3`
Expand Down Expand Up @@ -538,7 +538,7 @@ Update the parameters of the current hologram

| Name | Type |
| :------ | :------ |
| `T` | extends ``"rows"`` \| ``"columns"`` \| ``"aspect"`` \| ``"depth_loc"`` \| ``"depth_inversion"`` \| ``"chroma_depth"`` \| ``"depthiness"`` \| ``"focus"`` \| ``"depth_cutoff"`` \| ``"zoom"`` \| ``"view_count"`` |
| `T` | extends ``"rows"`` \| ``"columns"`` \| ``"aspect"`` \| ``"depth_loc"`` \| ``"depth_inversion"`` \| ``"chroma_depth"`` \| ``"depthiness"`` \| ``"focus"`` \| ``"depth_cutoff"`` \| ``"zoom"`` \| ``"view_count"`` \| ``"crop_pos_x"`` \| ``"crop_pos_y"`` |

#### Parameters

Expand All @@ -547,7 +547,7 @@ Update the parameters of the current hologram
| `«destructured»` | `Object` |
| › `name` | `string` |
| › `parameter` | `T` |
| › `value` | { `aspect`: `number` ; `chroma_depth`: ``0`` \| ``1`` ; `columns`: `number` = QUILT\_COLS.range; `depth_cutoff?`: ``0`` \| ``1`` ; `depth_inversion`: ``0`` \| ``1`` ; `depth_loc`: ``0`` \| ``2`` \| ``1`` \| ``3`` ; `depthiness`: `number` = DEPTHINESS.range; `focus?`: `number` ; `rows`: `number` = QUILT\_ROWS.range; `view_count`: `number` ; `zoom`: `number` = ZOOM.range }[`T`] |
| › `value` | { `aspect`: `number` ; `chroma_depth`: ``0`` \| ``1`` ; `columns`: `number` = QUILT\_COLS.range; `crop_pos_x?`: `number` ; `crop_pos_y?`: `number` ; `depth_cutoff?`: ``0`` \| ``1`` ; `depth_inversion`: ``0`` \| ``1`` ; `depth_loc`: ``0`` \| ``2`` \| ``1`` \| ``3`` ; `depthiness`: `number` = DEPTHINESS.range; `focus?`: `number` ; `rows`: `number` = QUILT\_ROWS.range; `view_count`: `number` ; `zoom`: `number` = ZOOM.range }[`T`] |

#### Returns

Expand Down
11 changes: 11 additions & 0 deletions docs/classes/components_eventsource.BridgeEventSource.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ the websocket connection will send events from Bridge to the client.
### Methods

- [addMessageHandler](components_eventsource.BridgeEventSource.md#addmessagehandler)
- [connectEvent](components_eventsource.BridgeEventSource.md#connectevent)
- [connectToBridgeEventSource](components_eventsource.BridgeEventSource.md#connecttobridgeeventsource)
- [disconnectEvent](components_eventsource.BridgeEventSource.md#disconnectevent)
- [removeMessageHandler](components_eventsource.BridgeEventSource.md#removemessagehandler)
Expand Down Expand Up @@ -80,6 +81,16 @@ adds a new message handler object to the BridgeEventSource class

___

### connectEvent

**connectEvent**(): `void`

#### Returns

`void`

___

### connectToBridgeEventSource

**connectToBridgeEventSource**(`orchestration`): `Promise`<{ `success`: `boolean` }\>
Expand Down
21 changes: 19 additions & 2 deletions docs/classes/playlists_playlist.Playlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Playlist class
### Methods

- [addItem](playlists_playlist.Playlist.md#additem)
- [addPlaylistItemToBridge](playlists_playlist.Playlist.md#addplaylistitemtobridge)
- [clearItems](playlists_playlist.Playlist.md#clearitems)
- [getCurrent](playlists_playlist.Playlist.md#getcurrent)
- [getInstance](playlists_playlist.Playlist.md#getinstance)
Expand Down Expand Up @@ -73,7 +74,7 @@ ___

### addItem

**addItem**(`hologram`): `void`
**addItem**(`hologram`): `undefined` \| [`PlaylistItemType`](../modules/playlists_playlist.md#playlistitemtype)

#### Parameters

Expand All @@ -83,7 +84,23 @@ ___

#### Returns

`void`
`undefined` \| [`PlaylistItemType`](../modules/playlists_playlist.md#playlistitemtype)

___

### addPlaylistItemToBridge

**addPlaylistItemToBridge**(`item`): `Promise`<`boolean`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `item` | [`PlaylistItemType`](../modules/playlists_playlist.md#playlistitemtype) |

#### Returns

`Promise`<`boolean`\>

___

Expand Down
38 changes: 38 additions & 0 deletions docs/interfaces/schemas_defaults.defaults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[@lookingglass/bridge](../README.md) / [schemas/defaults](../modules/schemas_defaults.md) / defaults

# Interface: defaults

[schemas/defaults](../modules/schemas_defaults.md).defaults

## Table of contents

### Properties

- [max](schemas_defaults.defaults.md#max)
- [min](schemas_defaults.defaults.md#min)
- [range](schemas_defaults.defaults.md#range)
- [type](schemas_defaults.defaults.md#type)

## Properties

### max

**max**: `number`

___

### min

**min**: `number`

___

### range

**range**: `ZodEffects`<`ZodNumber`, `number`, `number`\>

___

### type

**type**: `NumberType`
2 changes: 1 addition & 1 deletion docs/modules/components_endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ ___

| Name | Type |
| :------ | :------ |
| `T` | extends ``"show_window"`` \| ``"instance_playlist"`` \| ``"instance_studio_playlist"`` \| ``"bridge_version"`` \| ``"api_version"`` \| ``"get_autostart_playlist"`` \| ``"set_named_autostart_playlist"`` \| ``"set_autostart_playlist"`` \| ``"available_output_devices"`` \| ``"enter_orchestration"`` \| ``"exit_orchestration"`` \| ``"delete_playlist"`` \| ``"insert_playlist_entry"`` \| ``"update_playlist_entry"`` \| ``"update_current_entry"`` \| ``"transport_control_play"`` \| ``"transport_control_pause"`` \| ``"transport_control_next"`` \| ``"transport_control_previous"`` \| ``"transport_control_seek_to_index"`` \| ``"play_playlist"`` |
| `T` | extends ``"show_window"`` \| ``"insert_playlist_entry"`` \| ``"instance_studio_playlist"`` \| ``"bridge_version"`` \| ``"api_version"`` \| ``"get_autostart_playlist"`` \| ``"set_named_autostart_playlist"`` \| ``"set_autostart_playlist"`` \| ``"available_output_devices"`` \| ``"enter_orchestration"`` \| ``"exit_orchestration"`` \| ``"instance_playlist"`` \| ``"delete_playlist"`` \| ``"update_playlist_entry"`` \| ``"update_current_entry"`` \| ``"transport_control_play"`` \| ``"transport_control_pause"`` \| ``"transport_control_next"`` \| ``"transport_control_previous"`` \| ``"transport_control_seek_to_index"`` \| ``"play_playlist"`` |

#### Parameters

Expand Down
7 changes: 7 additions & 0 deletions docs/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- [SyncPlayPlaylistCancelledMessageHandler](index.md#syncplayplaylistcancelledmessagehandler)
- [SyncPlayPlaylistCompleteMessageHandler](index.md#syncplayplaylistcompletemessagehandler)
- [SyncPlayPlaylistMessageHandler](index.md#syncplayplaylistmessagehandler)
- [defaults](index.md#defaults)
- [getPlayPlaylistJsonArgs](index.md#getplayplaylistjsonargs)
- [hologramFactory](index.md#hologramfactory)
- [hologramMap](index.md#hologrammap)
Expand Down Expand Up @@ -212,6 +213,12 @@ Re-exports [SyncPlayPlaylistMessageHandler](../classes/components_messageHandler

___

### defaults

Renames and re-exports [schemas/defaults](schemas_defaults.md)

___

### getPlayPlaylistJsonArgs

Re-exports [getPlayPlaylistJsonArgs](../interfaces/playlists_playlist.getPlayPlaylistJsonArgs.md)
Expand Down
83 changes: 21 additions & 62 deletions docs/modules/schemas_defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

## Table of contents

### Interfaces

- [defaults](../interfaces/schemas_defaults.defaults.md)

### Variables

- [ASPECT](schemas_defaults.md#aspect)
- [CROP\_POS\_X](schemas_defaults.md#crop_pos_x)
- [CROP\_POS\_Y](schemas_defaults.md#crop_pos_y)
- [DEPTHINESS](schemas_defaults.md#depthiness)
- [FOCUS](schemas_defaults.md#focus)
- [QUILT\_COLS](schemas_defaults.md#quilt_cols)
Expand All @@ -18,99 +24,52 @@

### ASPECT

`Const` **ASPECT**: `Object`
`Const` **ASPECT**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

for certain values we need defaults in order to define our type schemas and also clamp values.
This helps prevent sending bridge values that are out of range.
___

#### Type declaration
### CROP\_POS\_X

| Name | Type |
| :------ | :------ |
| `max` | `number` |
| `min` | `number` |
| `range` | `ZodEffects`<`ZodNumber`, `number`, `number`\> |
`Const` **CROP\_POS\_X**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

___

### DEPTHINESS
### CROP\_POS\_Y

`Const` **DEPTHINESS**: `Object`
`Const` **CROP\_POS\_Y**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

#### Type declaration
___

| Name | Type |
| :------ | :------ |
| `max` | `number` |
| `min` | `number` |
| `range` | `ZodEffects`<`ZodNumber`, `number`, `number`\> |
### DEPTHINESS

`Const` **DEPTHINESS**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

___

### FOCUS

`Const` **FOCUS**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `max` | `number` |
| `min` | `number` |
| `range` | `ZodEffects`<`ZodNumber`, `number`, `number`\> |
`Const` **FOCUS**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

___

### QUILT\_COLS

`Const` **QUILT\_COLS**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `max` | `number` |
| `min` | `number` |
| `range` | `ZodEffects`<`ZodNumber`, `number`, `number`\> |
`Const` **QUILT\_COLS**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

___

### QUILT\_ROWS

`Const` **QUILT\_ROWS**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `max` | `number` |
| `min` | `number` |
| `range` | `ZodEffects`<`ZodNumber`, `number`, `number`\> |
`Const` **QUILT\_ROWS**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

___

### QUILT\_VIEW\_COUNT

`Const` **QUILT\_VIEW\_COUNT**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `max` | `number` |
| `min` | `number` |
| `range` | `ZodEffects`<`ZodNumber`, `number`, `number`\> |
`Const` **QUILT\_VIEW\_COUNT**: [`defaults`](../interfaces/schemas_defaults.defaults.md)

___

### ZOOM

`Const` **ZOOM**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `max` | `number` |
| `min` | `number` |
| `range` | `ZodEffects`<`ZodNumber`, `number`, `number`\> |
`Const` **ZOOM**: [`defaults`](../interfaces/schemas_defaults.defaults.md)
3 changes: 2 additions & 1 deletion docs/modules/schemas_schema_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ ___

| Name | Type | Description |
| :------ | :------ | :------ |
| `Bridge Disconnected` | `z.infer`<typeof [`progressUpdateResponse`](schemas_schema_events.md#progressupdateresponse)\> | CUSTOM CLIENT EVENTS BELOW THESE ARE NOT PART OF BRIDGE |
| `Bridge Connected` | `z.infer`<typeof [`progressUpdateResponse`](schemas_schema_events.md#progressupdateresponse)\> | CUSTOM CLIENT EVENTS BELOW THESE ARE NOT PART OF BRIDGE |
| `Bridge Disconnected` | `z.infer`<typeof [`progressUpdateResponse`](schemas_schema_events.md#progressupdateresponse)\> | - |
| `Monitor Connect` | `z.infer`<typeof [`monitorConnectResponse`](schemas_schema_events.md#monitorconnectresponse)\> | - |
| `Monitor Disconnect` | `z.infer`<typeof [`progressUpdateResponse`](schemas_schema_events.md#progressupdateresponse)\> | - |
| `Playlist Delete` | `z.infer`<typeof [`deletePlaylistResponse`](schemas_schema_events.md#deleteplaylistresponse)\> | - |
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/schemas_schema_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

### hologramParamMap

• `Const` **hologramParamMap**: `ZodObject`<{ `aspect`: `ZodNumber` ; `chroma_depth`: `ZodUnion`<[`ZodLiteral`<``0``\>, `ZodLiteral`<``1``\>]\> ; `columns`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = QUILT\_COLS.range; `depth_cutoff`: `ZodOptional`<`ZodUnion`<[`ZodLiteral`<``1``\>, `ZodLiteral`<``0``\>]\>\> ; `depth_inversion`: `ZodUnion`<[`ZodLiteral`<``0``\>, `ZodLiteral`<``1``\>]\> ; `depth_loc`: `ZodUnion`<[`ZodLiteral`<``0``\>, `ZodLiteral`<``1``\>, `ZodLiteral`<``2``\>, `ZodLiteral`<``3``\>]\> ; `depthiness`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = DEPTHINESS.range; `focus`: `ZodOptional`<`ZodNumber`\> ; `rows`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = QUILT\_ROWS.range; `view_count`: `ZodNumber` ; `zoom`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = ZOOM.range }, ``"strip"``, `ZodTypeAny`, { `aspect`: `number` ; `chroma_depth`: ``0`` \| ``1`` ; `columns`: `number` = QUILT\_COLS.range; `depth_cutoff?`: ``0`` \| ``1`` ; `depth_inversion`: ``0`` \| ``1`` ; `depth_loc`: ``0`` \| ``2`` \| ``1`` \| ``3`` ; `depthiness`: `number` = DEPTHINESS.range; `focus?`: `number` ; `rows`: `number` = QUILT\_ROWS.range; `view_count`: `number` ; `zoom`: `number` = ZOOM.range }, { `aspect`: `number` ; `chroma_depth`: ``0`` \| ``1`` ; `columns`: `number` = QUILT\_COLS.range; `depth_cutoff?`: ``0`` \| ``1`` ; `depth_inversion`: ``0`` \| ``1`` ; `depth_loc`: ``0`` \| ``2`` \| ``1`` \| ``3`` ; `depthiness`: `number` = DEPTHINESS.range; `focus?`: `number` ; `rows`: `number` = QUILT\_ROWS.range; `view_count`: `number` ; `zoom`: `number` = ZOOM.range }\>
• `Const` **hologramParamMap**: `ZodObject`<{ `aspect`: `ZodNumber` ; `chroma_depth`: `ZodUnion`<[`ZodLiteral`<``0``\>, `ZodLiteral`<``1``\>]\> ; `columns`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = QUILT\_COLS.range; `crop_pos_x`: `ZodOptional`<`ZodNumber`\> ; `crop_pos_y`: `ZodOptional`<`ZodNumber`\> ; `depth_cutoff`: `ZodOptional`<`ZodUnion`<[`ZodLiteral`<``1``\>, `ZodLiteral`<``0``\>]\>\> ; `depth_inversion`: `ZodUnion`<[`ZodLiteral`<``0``\>, `ZodLiteral`<``1``\>]\> ; `depth_loc`: `ZodUnion`<[`ZodLiteral`<``0``\>, `ZodLiteral`<``1``\>, `ZodLiteral`<``2``\>, `ZodLiteral`<``3``\>]\> ; `depthiness`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = DEPTHINESS.range; `focus`: `ZodOptional`<`ZodNumber`\> ; `rows`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = QUILT\_ROWS.range; `view_count`: `ZodNumber` ; `zoom`: `ZodEffects`<`ZodNumber`, `number`, `number`\> = ZOOM.range }, ``"strip"``, `ZodTypeAny`, { `aspect`: `number` ; `chroma_depth`: ``0`` \| ``1`` ; `columns`: `number` = QUILT\_COLS.range; `crop_pos_x?`: `number` ; `crop_pos_y?`: `number` ; `depth_cutoff?`: ``0`` \| ``1`` ; `depth_inversion`: ``0`` \| ``1`` ; `depth_loc`: ``0`` \| ``2`` \| ``1`` \| ``3`` ; `depthiness`: `number` = DEPTHINESS.range; `focus?`: `number` ; `rows`: `number` = QUILT\_ROWS.range; `view_count`: `number` ; `zoom`: `number` = ZOOM.range }, { `aspect`: `number` ; `chroma_depth`: ``0`` \| ``1`` ; `columns`: `number` = QUILT\_COLS.range; `crop_pos_x?`: `number` ; `crop_pos_y?`: `number` ; `depth_cutoff?`: ``0`` \| ``1`` ; `depth_inversion`: ``0`` \| ``1`` ; `depth_loc`: ``0`` \| ``2`` \| ``1`` \| ``3`` ; `depthiness`: `number` = DEPTHINESS.range; `focus?`: `number` ; `rows`: `number` = QUILT\_ROWS.range; `view_count`: `number` ; `zoom`: `number` = ZOOM.range }\>

___

### parameterNames

`Const` **parameterNames**: `ZodUnion`<[`ZodLiteral`<``"rows"``\>, `ZodLiteral`<``"columns"``\>, `ZodLiteral`<``"aspect"``\>, `ZodLiteral`<``"view_count"``\>, `ZodLiteral`<``"depth_loc"``\>, `ZodLiteral`<``"depth_inversion"``\>, `ZodLiteral`<``"chroma_depth"``\>]\>
`Const` **parameterNames**: `ZodUnion`<[`ZodLiteral`<``"rows"``\>, `ZodLiteral`<``"columns"``\>, `ZodLiteral`<``"aspect"``\>, `ZodLiteral`<``"view_count"``\>, `ZodLiteral`<``"zoom"``\>, `ZodLiteral`<``"depth_loc"``\>, `ZodLiteral`<``"depth_inversion"``\>]\>
Loading

0 comments on commit 21f8b42

Please sign in to comment.