@player-tools/devtools-client 0.2.1--canary.11.226 → 0.2.1-next.3

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.cjs.js CHANGED
@@ -12,14 +12,14 @@ const GET_DATA_BINDING_DETAILS = "GET_DATA_BINDING_DETAILS";
12
12
  const GET_CONSOLE_EVAL = "GET_CONSOLE_EVAL";
13
13
  const START_PROFILER = "START_PROFILER";
14
14
  const STOP_PROFILER = "STOP_PROFILER";
15
- const alias = (aliases) => () => (next) => (action) => {
16
- const alias2 = aliases[action.type];
17
- if (alias2) {
18
- return next(alias2(action));
15
+ const _alias = (aliases) => () => (next) => (action) => {
16
+ const alias = aliases[action.type];
17
+ if (alias) {
18
+ return next(alias(action));
19
19
  }
20
20
  return next(action);
21
21
  };
22
- const buildAliases = (actions) => alias({
22
+ const buildAliases = (actions) => _alias({
23
23
  GET_INFO_DETAILS: (action) => actions["player-runtime-info-request"](action.payload),
24
24
  GET_CONFIG_DETAILS: (action) => actions["player-config-request"](action.payload),
25
25
  GET_VIEW_DETAILS: (action) => actions["player-view-details-request"](action.payload),
@@ -50,12 +50,15 @@ var __async = (__this, __arguments, generator) => {
50
50
  });
51
51
  };
52
52
  const logger = devtoolsCommon.createLogger(devtoolsCommon.BACKGROUND_SOURCE);
53
- const buildRPCActions = (handlers) => devtoolsCommon.Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => (acc[rpcType] = toolkit.createAsyncThunk(rpcType, (params) => __async(undefined, null, function* () {
54
- logger.log(`Requesting ${rpcType}`, params);
55
- const data = yield handlers[rpcType].call(params);
56
- logger.log(`Response from ${rpcType}`, data);
57
- return data;
58
- })), acc), {});
53
+ const buildRPCActions = (handlers) => devtoolsCommon.Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => {
54
+ acc[rpcType] = toolkit.createAsyncThunk(rpcType, (params) => __async(undefined, null, function* () {
55
+ logger.log(`Requesting ${rpcType}`, params);
56
+ const data = yield handlers[rpcType].call(params);
57
+ logger.log(`Response from ${rpcType}`, data);
58
+ return data;
59
+ }));
60
+ return acc;
61
+ }, {});
59
62
 
60
63
  const buildPlayerReducerCallback = (actions) => (builder) => {
61
64
  builder.addCase(actions["player-runtime-info-request"].fulfilled, (state, action) => {
@@ -169,12 +172,15 @@ function handleMessage(store, message) {
169
172
  break;
170
173
  }
171
174
  default:
172
- console.warn("Unhandled event: " + JSON.stringify(message));
175
+ console.warn(`Unhandled event: ${JSON.stringify(message)}`);
173
176
  break;
174
177
  }
175
178
  }
176
179
 
177
- const buildRPCRequests = (onRequestMessage) => devtoolsCommon.Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => (acc[rpcType] = devtoolsCommon.createRPCRequest(rpcType, devtoolsCommon.PANEL_SOURCE, onRequestMessage), acc), {});
180
+ const buildRPCRequests = (onRequestMessage) => devtoolsCommon.Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => {
181
+ acc[rpcType] = devtoolsCommon.createRPCRequest(rpcType, devtoolsCommon.PANEL_SOURCE, onRequestMessage);
182
+ return acc;
183
+ }, {});
178
184
 
179
185
  exports.GET_CONFIG_DETAILS = GET_CONFIG_DETAILS;
180
186
  exports.GET_CONSOLE_EVAL = GET_CONSOLE_EVAL;
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare type AsyncRPCActions = {
13
13
  type: key;
14
14
  }>['result'], Extract<Runtime.RuntimeRPC, {
15
15
  type: key;
16
- }>['params'], {}>;
16
+ }>['params'], any>;
17
17
  };
18
18
  declare const buildRPCActions: (handlers: RuntimeRPCRequestHandlers) => AsyncRPCActions;
19
19
 
package/dist/index.esm.js CHANGED
@@ -9,14 +9,14 @@ const GET_DATA_BINDING_DETAILS = "GET_DATA_BINDING_DETAILS";
9
9
  const GET_CONSOLE_EVAL = "GET_CONSOLE_EVAL";
10
10
  const START_PROFILER = "START_PROFILER";
11
11
  const STOP_PROFILER = "STOP_PROFILER";
12
- const alias = (aliases) => () => (next) => (action) => {
13
- const alias2 = aliases[action.type];
14
- if (alias2) {
15
- return next(alias2(action));
12
+ const _alias = (aliases) => () => (next) => (action) => {
13
+ const alias = aliases[action.type];
14
+ if (alias) {
15
+ return next(alias(action));
16
16
  }
17
17
  return next(action);
18
18
  };
19
- const buildAliases = (actions) => alias({
19
+ const buildAliases = (actions) => _alias({
20
20
  GET_INFO_DETAILS: (action) => actions["player-runtime-info-request"](action.payload),
21
21
  GET_CONFIG_DETAILS: (action) => actions["player-config-request"](action.payload),
22
22
  GET_VIEW_DETAILS: (action) => actions["player-view-details-request"](action.payload),
@@ -47,12 +47,15 @@ var __async = (__this, __arguments, generator) => {
47
47
  });
48
48
  };
49
49
  const logger = createLogger(BACKGROUND_SOURCE);
50
- const buildRPCActions = (handlers) => Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => (acc[rpcType] = createAsyncThunk(rpcType, (params) => __async(undefined, null, function* () {
51
- logger.log(`Requesting ${rpcType}`, params);
52
- const data = yield handlers[rpcType].call(params);
53
- logger.log(`Response from ${rpcType}`, data);
54
- return data;
55
- })), acc), {});
50
+ const buildRPCActions = (handlers) => Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => {
51
+ acc[rpcType] = createAsyncThunk(rpcType, (params) => __async(undefined, null, function* () {
52
+ logger.log(`Requesting ${rpcType}`, params);
53
+ const data = yield handlers[rpcType].call(params);
54
+ logger.log(`Response from ${rpcType}`, data);
55
+ return data;
56
+ }));
57
+ return acc;
58
+ }, {});
56
59
 
57
60
  const buildPlayerReducerCallback = (actions) => (builder) => {
58
61
  builder.addCase(actions["player-runtime-info-request"].fulfilled, (state, action) => {
@@ -166,12 +169,15 @@ function handleMessage(store, message) {
166
169
  break;
167
170
  }
168
171
  default:
169
- console.warn("Unhandled event: " + JSON.stringify(message));
172
+ console.warn(`Unhandled event: ${JSON.stringify(message)}`);
170
173
  break;
171
174
  }
172
175
  }
173
176
 
174
- const buildRPCRequests = (onRequestMessage) => Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => (acc[rpcType] = createRPCRequest(rpcType, PANEL_SOURCE, onRequestMessage), acc), {});
177
+ const buildRPCRequests = (onRequestMessage) => Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => {
178
+ acc[rpcType] = createRPCRequest(rpcType, PANEL_SOURCE, onRequestMessage);
179
+ return acc;
180
+ }, {});
175
181
 
176
182
  export { GET_CONFIG_DETAILS, GET_CONSOLE_EVAL, GET_DATA_BINDING_DETAILS, GET_INFO_DETAILS, GET_VIEW_DETAILS, START_PROFILER, STOP_PROFILER, buildAliases, buildPlayerReducerCallback, buildRPCActions, buildRPCRequests, handleMessage };
177
183
  //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@player-tools/devtools-client",
3
- "version": "0.2.1--canary.11.226",
3
+ "version": "0.2.1-next.3",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -8,7 +8,7 @@
8
8
  "peerDependencies": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.6.1",
11
- "@player-tools/devtools-common": "0.2.1--canary.11.226",
11
+ "@player-tools/devtools-common": "0.2.1-next.3",
12
12
  "@babel/runtime": "7.15.4"
13
13
  },
14
14
  "main": "dist/index.cjs.js",
@@ -1,10 +1,10 @@
1
- import { createAsyncThunk, AsyncThunk } from '@reduxjs/toolkit';
1
+ import { type AsyncThunk, createAsyncThunk } from '@reduxjs/toolkit';
2
2
  import {
3
3
  Runtime,
4
4
  createLogger,
5
5
  BACKGROUND_SOURCE,
6
6
  } from '@player-tools/devtools-common';
7
- import { RuntimeRPCRequestHandlers } from '../rpc';
7
+ import type { RuntimeRPCRequestHandlers } from '../rpc';
8
8
 
9
9
  const logger = createLogger(BACKGROUND_SOURCE);
10
10
 
@@ -12,30 +12,27 @@ export type AsyncRPCActions = {
12
12
  [key in Runtime.RuntimeRPCTypes]: AsyncThunk<
13
13
  Extract<Runtime.RuntimeRPC, { type: key }>['result'],
14
14
  Extract<Runtime.RuntimeRPC, { type: key }>['params'],
15
- {}
15
+ any
16
16
  >;
17
17
  };
18
18
 
19
19
  export const buildRPCActions = (
20
20
  handlers: RuntimeRPCRequestHandlers
21
21
  ): AsyncRPCActions =>
22
- Runtime.RuntimeRPCTypes.reduce(
23
- (acc, rpcType) => (
24
- // TODO: Fix this
25
- // @ts-ignore
26
- (acc[rpcType] = createAsyncThunk<
27
- Extract<Runtime.RuntimeRPC, { type: typeof rpcType }>['result'],
28
- Extract<Runtime.RuntimeRPC, { type: typeof rpcType }>['params']
29
- >(rpcType, async (params) => {
30
- logger.log(`Requesting ${rpcType}`, params);
31
- const data = (await handlers[rpcType].call(params)) as Extract<
32
- Runtime.RuntimeRPC,
33
- { type: typeof rpcType }
34
- >['result'];
35
- logger.log(`Response from ${rpcType}`, data);
36
- return data;
37
- })),
38
- acc
39
- ),
40
- {} as AsyncRPCActions
41
- );
22
+ Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => {
23
+ // TODO: Fix this
24
+ // @ts-ignore
25
+ acc[rpcType] = createAsyncThunk<
26
+ Extract<Runtime.RuntimeRPC, { type: typeof rpcType }>['result'],
27
+ Extract<Runtime.RuntimeRPC, { type: typeof rpcType }>['params']
28
+ >(rpcType, async (params) => {
29
+ logger.log(`Requesting ${rpcType}`, params);
30
+ const data = (await handlers[rpcType].call(params)) as Extract<
31
+ Runtime.RuntimeRPC,
32
+ { type: typeof rpcType }
33
+ >['result'];
34
+ logger.log(`Response from ${rpcType}`, data);
35
+ return data;
36
+ });
37
+ return acc;
38
+ }, {} as AsyncRPCActions);
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  AliasAction,
3
3
  ConfigAction,
4
4
  DataBindingAction,
@@ -6,7 +6,7 @@ import {
6
6
  StartProfilerAction,
7
7
  StopProfilerAction,
8
8
  } from '@player-tools/devtools-common';
9
- import { AsyncRPCActions } from './actions';
9
+ import type { AsyncRPCActions } from './actions';
10
10
 
11
11
  export const GET_INFO_DETAILS = 'GET_INFO_DETAILS';
12
12
  export const GET_CONFIG_DETAILS = 'GET_CONFIG_DETAILS';
@@ -16,7 +16,7 @@ export const GET_CONSOLE_EVAL = 'GET_CONSOLE_EVAL';
16
16
  export const START_PROFILER = 'START_PROFILER';
17
17
  export const STOP_PROFILER = 'STOP_PROFILER';
18
18
 
19
- const alias = (aliases: any) => () => (next: any) => (action: any) => {
19
+ const _alias = (aliases: any) => () => (next: any) => (action: any) => {
20
20
  const alias = aliases[action.type];
21
21
 
22
22
  if (alias) {
@@ -27,7 +27,7 @@ const alias = (aliases: any) => () => (next: any) => (action: any) => {
27
27
  };
28
28
 
29
29
  export const buildAliases = (actions: AsyncRPCActions) =>
30
- alias({
30
+ _alias({
31
31
  GET_INFO_DETAILS: (action: AliasAction) =>
32
32
  actions['player-runtime-info-request'](action.payload),
33
33
  GET_CONFIG_DETAILS: (action: ConfigAction) =>
@@ -1,6 +1,6 @@
1
1
  import {
2
+ type Message,
2
3
  clearStore,
3
- Message,
4
4
  playerFlowStartAction,
5
5
  playerInitAction,
6
6
  playerRemoveAction,
@@ -8,7 +8,7 @@ import {
8
8
  playerViewUpdateAction,
9
9
  selectedPlayerAction,
10
10
  } from '@player-tools/devtools-common';
11
- import { Store } from 'redux';
11
+ import type { Store } from 'redux';
12
12
  import { GET_DATA_BINDING_DETAILS } from './aliases';
13
13
 
14
14
  export * from './actions';
@@ -64,7 +64,7 @@ export function handleMessage(store: Store, message: Message) {
64
64
  }
65
65
 
66
66
  default:
67
- console.warn('Unhandled event: ' + JSON.stringify(message));
67
+ console.warn(`Unhandled event: ${JSON.stringify(message)}`);
68
68
  break;
69
69
  }
70
70
  }
@@ -1,7 +1,6 @@
1
- /* eslint-disable no-param-reassign */
2
- import { ActionReducerMapBuilder } from '@reduxjs/toolkit';
3
- import { PlayersState } from '@player-tools/devtools-common';
4
- import { AsyncRPCActions } from './actions';
1
+ import type { ActionReducerMapBuilder } from '@reduxjs/toolkit';
2
+ import type { PlayersState } from '@player-tools/devtools-common';
3
+ import type { AsyncRPCActions } from './actions';
5
4
 
6
5
  /**
7
6
  * Callback function that adds cases for async actions for the player.
package/src/rpc/index.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import {
2
+ type RPCRequestMessageEvent,
3
+ type RPCRequestHandler,
2
4
  createRPCRequest,
3
- PANEL_SOURCE,
4
- Runtime as PlayerRuntime,
5
- RPCRequestMessageEvent,
6
- RPCRequestHandler,
7
5
  Runtime,
6
+ PANEL_SOURCE,
8
7
  } from '@player-tools/devtools-common';
9
8
 
10
9
  export type RuntimeRPCRequestHandlers = {
@@ -13,17 +12,10 @@ export type RuntimeRPCRequestHandlers = {
13
12
 
14
13
  export const buildRPCRequests = (
15
14
  onRequestMessage: (
16
- message: RPCRequestMessageEvent<PlayerRuntime.RuntimeRPC>
15
+ message: RPCRequestMessageEvent<Runtime.RuntimeRPC>
17
16
  ) => void
18
17
  ): RuntimeRPCRequestHandlers =>
19
- Runtime.RuntimeRPCTypes.reduce(
20
- (acc, rpcType) => (
21
- (acc[rpcType] = createRPCRequest(
22
- rpcType,
23
- PANEL_SOURCE,
24
- onRequestMessage
25
- )),
26
- acc
27
- ),
28
- {} as RuntimeRPCRequestHandlers
29
- );
18
+ Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => {
19
+ acc[rpcType] = createRPCRequest(rpcType, PANEL_SOURCE, onRequestMessage);
20
+ return acc;
21
+ }, {} as RuntimeRPCRequestHandlers);