@player-tools/devtools-client 0.2.1 → 0.2.2--canary.17.363

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,21 +1,40 @@
1
- import { Runtime, RPCRequestHandler, RPCRequestMessageEvent, PlayersState, Message } from '@player-tools/devtools-common';
2
- export * from '@player-tools/devtools-common';
3
- import { Store } from 'redux';
4
- import { AsyncThunk, ActionReducerMapBuilder } from '@reduxjs/toolkit';
1
+ import * as _reduxjs_toolkit from '@reduxjs/toolkit';
2
+ import { AsyncThunk, ActionCreatorWithPayload, AnyAction, ActionReducerMapBuilder, Middleware, Dispatch, EnhancedStore } from '@reduxjs/toolkit';
3
+ import * as _player_tools_devtools_common from '@player-tools/devtools-common';
4
+ import { Methods as Methods$1, Events as Events$1, Message, ProfilerNode } from '@player-tools/devtools-common';
5
+ import * as _reduxjs_toolkit_dist_createReducer from '@reduxjs/toolkit/dist/createReducer';
6
+ import * as _player_ui_types from '@player-ui/types';
7
+ import { View, Flow } from '@player-ui/types';
8
+ import * as reselect from 'reselect';
5
9
 
6
- declare type RuntimeRPCRequestHandlers = {
7
- [key in Runtime.RuntimeRPCTypes]: RPCRequestHandler<any>;
10
+ declare namespace Methods {
11
+ /** Type describing an object containing async thunks for each Method defined */
12
+ type MethodThunks = {
13
+ [key in Methods$1.Method["type"]]: AsyncThunk<Methods$1.ByType<key>['result'], Methods$1.ByType<key>, any>;
14
+ };
15
+ type MethodHandler = <T extends Methods$1.MethodTypes>(method: Methods$1.ByType<T>) => Promise<Methods$1.ByType<T>['result']>;
16
+ const buildAsyncThunks: (onMethodRequest: MethodHandler) => MethodThunks;
17
+ }
18
+ declare namespace Events {
19
+ /** Redux actions associated against all possible event types */
20
+ type EventActions = {
21
+ [key in Events$1.EventTypes]: ActionCreatorWithPayload<Events$1.ByType<key>, key>;
22
+ };
23
+ export interface EventAction<T extends Events$1.EventTypes = Events$1.EventTypes> extends AnyAction {
24
+ payload: Events$1.ByType<T>;
25
+ }
26
+ /** Redux actions associated against all defined event types */
27
+ export const actions: EventActions;
28
+ export {};
29
+ }
30
+ declare const Actions: {
31
+ 'selected-player': _reduxjs_toolkit.ActionCreatorWithOptionalPayload<string | undefined, string>;
32
+ 'player-timeline-event': ActionCreatorWithPayload<Events$1.TimelineEvents, string>;
33
+ 'clear-selected-data-details': _reduxjs_toolkit.ActionCreatorWithoutPayload<"clear-selected-data-details">;
34
+ 'clear-console': _reduxjs_toolkit.ActionCreatorWithoutPayload<"clear-console">;
35
+ 'clear-logs': _reduxjs_toolkit.ActionCreatorWithoutPayload<"clear-logs">;
36
+ 'clear-store': _reduxjs_toolkit.ActionCreatorWithoutPayload<"clear-store">;
8
37
  };
9
- declare const buildRPCRequests: (onRequestMessage: (message: RPCRequestMessageEvent<Runtime.RuntimeRPC>) => void) => RuntimeRPCRequestHandlers;
10
-
11
- declare type AsyncRPCActions = {
12
- [key in Runtime.RuntimeRPCTypes]: AsyncThunk<Extract<Runtime.RuntimeRPC, {
13
- type: key;
14
- }>['result'], Extract<Runtime.RuntimeRPC, {
15
- type: key;
16
- }>['params'], any>;
17
- };
18
- declare const buildRPCActions: (handlers: RuntimeRPCRequestHandlers) => AsyncRPCActions;
19
38
 
20
39
  declare const GET_INFO_DETAILS = "GET_INFO_DETAILS";
21
40
  declare const GET_CONFIG_DETAILS = "GET_CONFIG_DETAILS";
@@ -24,15 +43,287 @@ declare const GET_DATA_BINDING_DETAILS = "GET_DATA_BINDING_DETAILS";
24
43
  declare const GET_CONSOLE_EVAL = "GET_CONSOLE_EVAL";
25
44
  declare const START_PROFILER = "START_PROFILER";
26
45
  declare const STOP_PROFILER = "STOP_PROFILER";
27
- declare const buildAliases: (actions: AsyncRPCActions) => () => (next: any) => (action: any) => any;
46
+ interface MethodAction<T extends Methods$1.MethodTypes> {
47
+ payload: Methods$1.ByType<T>;
48
+ }
49
+ declare const buildAliases: (methods: Methods.MethodThunks) => () => (next: any) => (action: any) => any;
50
+
51
+ declare function handleMessage(message: Message): void;
52
+
53
+ declare type ActivePlayerState = {
54
+ /**
55
+ * state associated with player config
56
+ */
57
+ configState?: Methods$1.PlayerConfigMethod['result'] | null;
58
+ /**
59
+ * Flow related Information of the player.
60
+ */
61
+ flowInfo?: Methods$1.PlayerRuntimeInfoMethod['result'] | null;
62
+ /**
63
+ * A collection of all the events associated with the running player instance.
64
+ */
65
+ timelineEvents: Array<Events$1.TimelineEvents>;
66
+ /**
67
+ * View related information of the player.
68
+ */
69
+ view?: View | undefined;
70
+ /**
71
+ * State assocaited with the data of the player
72
+ */
73
+ dataState: DataState;
74
+ /**
75
+ * State associated with the console evaluations.
76
+ */
77
+ consoleState: ConsoleState;
78
+ /**
79
+ * profiler related information of the player
80
+ */
81
+ profilerInfo?: ProfilerNode | null;
82
+ };
83
+ declare type PlayersState = {
84
+ /**
85
+ * This represents the currently selected player id.
86
+ */
87
+ selectedPlayerId: string | null;
88
+ /**
89
+ * Collection of all the players active on the web page.
90
+ */
91
+ activePlayers: Record<string, ActivePlayerState>;
92
+ /**
93
+ * Web Player version
94
+ */
95
+ version: string;
96
+ };
97
+ declare type StoreState = {
98
+ /**
99
+ * State related to all the players on the web page.
100
+ */
101
+ players: PlayersState;
102
+ };
103
+ declare type FlowInfoState = {
104
+ /**
105
+ * Current Flow Id.
106
+ */
107
+ currentFlowID?: string;
108
+ /**
109
+ * Current Flow State
110
+ */
111
+ currentFlowState?: string;
112
+ /**
113
+ * Current View Id.
114
+ */
115
+ currentViewID?: string;
116
+ /**
117
+ * Current FLow
118
+ */
119
+ currentFlow?: Flow;
120
+ };
121
+ declare type DataState = {
122
+ /**
123
+ * The binding selected on the Data panel.
124
+ */
125
+ selectedBinding?: Methods$1.PlayerDataBindingMethod['result'];
126
+ /**
127
+ * All the bindings in the data state.
128
+ */
129
+ allBindings?: Methods$1.PlayerDataBindingMethod['result'];
130
+ };
131
+ interface ConsoleState {
132
+ /**
133
+ * History of all the console evaluations
134
+ */
135
+ history: Array<{
136
+ /**
137
+ * Unique Id representing a Console evaluation.
138
+ */
139
+ id: string;
140
+ /**
141
+ * Expression being evaluated.
142
+ */
143
+ expression: string;
144
+ /**
145
+ * Result of the console evaluation.
146
+ */
147
+ result: Methods$1.PlayerExpressionMethod['result'];
148
+ }>;
149
+ }
28
150
 
151
+ declare const methodsReducer: (methods: Methods.MethodThunks) => (builder: ActionReducerMapBuilder<PlayersState>) => void;
152
+ declare const eventsReducer: (builder: ActionReducerMapBuilder<PlayersState>) => void;
153
+ declare const actionsReducer: (builder: ActionReducerMapBuilder<PlayersState>) => void;
154
+ declare const playersReducer: (methods: Methods.MethodThunks) => _reduxjs_toolkit_dist_createReducer.ReducerWithInitialState<PlayersState>;
155
+
156
+ declare const selectPlayerVersion: ((state: {
157
+ players: PlayersState;
158
+ }) => string) & reselect.OutputSelectorFields<(args_0: PlayersState) => string & {
159
+ clearCache: () => void;
160
+ }> & {
161
+ clearCache: () => void;
162
+ };
163
+ declare const selectPlayerIds: ((state: {
164
+ players: PlayersState;
165
+ }) => string[]) & reselect.OutputSelectorFields<(args_0: Record<string, ActivePlayerState>) => string[] & {
166
+ clearCache: () => void;
167
+ }> & {
168
+ clearCache: () => void;
169
+ };
29
170
  /**
30
- * Callback function that adds cases for async actions for the player.
31
- * @param playerReducerCallback
32
- * @returns
171
+ * Selects the selected/currently active player Id.
33
172
  */
34
- declare const buildPlayerReducerCallback: (actions: AsyncRPCActions) => (builder: ActionReducerMapBuilder<PlayersState>) => void;
173
+ declare const selectSelectedPlayerId: ((state: {
174
+ players: PlayersState;
175
+ }) => string | null) & reselect.OutputSelectorFields<(args_0: PlayersState) => string & {
176
+ clearCache: () => void;
177
+ }> & {
178
+ clearCache: () => void;
179
+ };
180
+ declare const selectCurrentPlayer: ((state: {
181
+ players: PlayersState;
182
+ }) => ActivePlayerState | null) & reselect.OutputSelectorFields<(args_0: Record<string, ActivePlayerState>, args_1: string | null) => ActivePlayerState & {
183
+ clearCache: () => void;
184
+ }> & {
185
+ clearCache: () => void;
186
+ };
187
+ declare const selectConfig: ((state: {
188
+ players: PlayersState;
189
+ }) => {
190
+ plugins?: string[] | undefined;
191
+ schema?: any;
192
+ expressions?: any;
193
+ } | null) & reselect.OutputSelectorFields<(args_0: ActivePlayerState | null) => {
194
+ plugins?: string[] | undefined;
195
+ schema?: any;
196
+ expressions?: any;
197
+ } & {
198
+ clearCache: () => void;
199
+ }> & {
200
+ clearCache: () => void;
201
+ };
202
+ declare const selectFlowInfo: ((state: {
203
+ players: PlayersState;
204
+ }) => {
205
+ currentFlowID?: string | undefined;
206
+ currentFlowState?: string | undefined;
207
+ currentViewID?: string | undefined;
208
+ currentFlow?: _player_ui_types.Flow<_player_ui_types.Asset<string>> | undefined;
209
+ } | null | undefined) & reselect.OutputSelectorFields<(args_0: ActivePlayerState | null) => {
210
+ currentFlowID?: string | undefined;
211
+ currentFlowState?: string | undefined;
212
+ currentViewID?: string | undefined;
213
+ currentFlow?: _player_ui_types.Flow<_player_ui_types.Asset<string>> | undefined;
214
+ } & {
215
+ clearCache: () => void;
216
+ }> & {
217
+ clearCache: () => void;
218
+ };
219
+ declare const selectCurrentFlow: ((state: {
220
+ players: PlayersState;
221
+ }) => _player_ui_types.Flow<_player_ui_types.Asset<string>> | undefined) & reselect.OutputSelectorFields<(args_0: {
222
+ currentFlowID?: string | undefined;
223
+ currentFlowState?: string | undefined;
224
+ currentViewID?: string | undefined;
225
+ currentFlow?: _player_ui_types.Flow<_player_ui_types.Asset<string>> | undefined;
226
+ } | null | undefined) => _player_ui_types.Flow<_player_ui_types.Asset<string>> & {
227
+ clearCache: () => void;
228
+ }> & {
229
+ clearCache: () => void;
230
+ };
231
+ declare const selectCurrentTopic: ((state: {
232
+ players: PlayersState;
233
+ }) => unknown) & reselect.OutputSelectorFields<(args_0: _player_ui_types.Flow<_player_ui_types.Asset<string>> | undefined) => {
234
+ clearCache: () => void;
235
+ }> & {
236
+ clearCache: () => void;
237
+ };
238
+ declare const selectEvents: ((state: {
239
+ players: PlayersState;
240
+ }) => _player_tools_devtools_common.Events.TimelineEvents[]) & reselect.OutputSelectorFields<(args_0: ActivePlayerState | null) => _player_tools_devtools_common.Events.TimelineEvents[] & {
241
+ clearCache: () => void;
242
+ }> & {
243
+ clearCache: () => void;
244
+ };
245
+ declare const selectView: ((state: {
246
+ players: PlayersState;
247
+ }) => (_player_ui_types.Asset<string> & {
248
+ validation?: _player_ui_types.Validation.CrossfieldReference[] | undefined;
249
+ }) | null | undefined) & reselect.OutputSelectorFields<(args_0: ActivePlayerState | null) => _player_ui_types.Asset<string> & {
250
+ validation?: _player_ui_types.Validation.CrossfieldReference[] | undefined;
251
+ } & {
252
+ clearCache: () => void;
253
+ }> & {
254
+ clearCache: () => void;
255
+ };
256
+ declare const selectAllBindings: ((state: {
257
+ players: PlayersState;
258
+ }) => {
259
+ binding: string;
260
+ value: {
261
+ currentValue?: any;
262
+ formattedValue?: any;
263
+ modelValue?: any;
264
+ };
265
+ type?: _player_ui_types.Schema.DataType<unknown> | undefined;
266
+ validation?: any;
267
+ } | undefined) & reselect.OutputSelectorFields<(args_0: DataState | undefined) => {
268
+ binding: string;
269
+ value: {
270
+ currentValue?: any;
271
+ formattedValue?: any;
272
+ modelValue?: any;
273
+ };
274
+ type?: _player_ui_types.Schema.DataType<unknown> | undefined;
275
+ validation?: any;
276
+ } & {
277
+ clearCache: () => void;
278
+ }> & {
279
+ clearCache: () => void;
280
+ };
281
+ declare const selectSelectedBinding: ((state: {
282
+ players: PlayersState;
283
+ }) => {
284
+ binding: string;
285
+ value: {
286
+ currentValue?: any;
287
+ formattedValue?: any;
288
+ modelValue?: any;
289
+ };
290
+ type?: _player_ui_types.Schema.DataType<unknown> | undefined;
291
+ validation?: any;
292
+ } | undefined) & reselect.OutputSelectorFields<(args_0: DataState | undefined) => {
293
+ binding: string;
294
+ value: {
295
+ currentValue?: any;
296
+ formattedValue?: any;
297
+ modelValue?: any;
298
+ };
299
+ type?: _player_ui_types.Schema.DataType<unknown> | undefined;
300
+ validation?: any;
301
+ } & {
302
+ clearCache: () => void;
303
+ }> & {
304
+ clearCache: () => void;
305
+ };
306
+ declare const selectConsole: ((state: {
307
+ players: PlayersState;
308
+ }) => ConsoleState) & reselect.OutputSelectorFields<(args_0: ActivePlayerState | null) => ConsoleState & {
309
+ clearCache: () => void;
310
+ }> & {
311
+ clearCache: () => void;
312
+ };
313
+ declare const selectProfiler: ((state: {
314
+ players: PlayersState;
315
+ }) => _player_tools_devtools_common.ProfilerNode | null | undefined) & reselect.OutputSelectorFields<(args_0: ActivePlayerState | null) => _player_tools_devtools_common.ProfilerNode & {
316
+ clearCache: () => void;
317
+ }> & {
318
+ clearCache: () => void;
319
+ };
35
320
 
36
- declare function handleMessage(store: Store, message: Message): void;
321
+ /**
322
+ * This function returns the players store. Accepts optional middleware and callback to enhance the store.
323
+ * @param middleware : Middleware to be added to the store. Optional.
324
+ * @param additionalReducers Additional reducers to be added to the store. Optional
325
+ * @returns
326
+ */
327
+ declare const createDevtoolsStore: (onMethodRequest: Methods.MethodHandler, middleware?: Middleware<any, StoreState, Dispatch<AnyAction>>, additionalReducers?: any) => EnhancedStore<StoreState, any, Middleware<any, StoreState, Dispatch<AnyAction>>[]>;
37
328
 
38
- export { AsyncRPCActions, GET_CONFIG_DETAILS, GET_CONSOLE_EVAL, GET_DATA_BINDING_DETAILS, GET_INFO_DETAILS, GET_VIEW_DETAILS, RuntimeRPCRequestHandlers, START_PROFILER, STOP_PROFILER, buildAliases, buildPlayerReducerCallback, buildRPCActions, buildRPCRequests, handleMessage };
329
+ export { Actions, ActivePlayerState, ConsoleState, DataState, Events, FlowInfoState, GET_CONFIG_DETAILS, GET_CONSOLE_EVAL, GET_DATA_BINDING_DETAILS, GET_INFO_DETAILS, GET_VIEW_DETAILS, MethodAction, Methods, PlayersState, START_PROFILER, STOP_PROFILER, StoreState, actionsReducer, buildAliases, createDevtoolsStore, eventsReducer, handleMessage, methodsReducer, playersReducer, selectAllBindings, selectConfig, selectConsole, selectCurrentFlow, selectCurrentPlayer, selectCurrentTopic, selectEvents, selectFlowInfo, selectPlayerIds, selectPlayerVersion, selectProfiler, selectSelectedBinding, selectSelectedPlayerId, selectView };