@player-tools/devtools-client 0.2.1--canary.11.202 → 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) => {
@@ -174,7 +177,10 @@ function handleMessage(store, message) {
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
@@ -6,27 +6,15 @@ import { AsyncThunk, ActionReducerMapBuilder } from '@reduxjs/toolkit';
6
6
  declare type RuntimeRPCRequestHandlers = {
7
7
  [key in Runtime.RuntimeRPCTypes]: RPCRequestHandler<any>;
8
8
  };
9
- /**
10
- *
11
- */
12
9
  declare const buildRPCRequests: (onRequestMessage: (message: RPCRequestMessageEvent<Runtime.RuntimeRPC>) => void) => RuntimeRPCRequestHandlers;
13
10
 
14
11
  declare type AsyncRPCActions = {
15
12
  [key in Runtime.RuntimeRPCTypes]: AsyncThunk<Extract<Runtime.RuntimeRPC, {
16
- /**
17
- *
18
- */
19
13
  type: key;
20
14
  }>['result'], Extract<Runtime.RuntimeRPC, {
21
- /**
22
- *
23
- */
24
15
  type: key;
25
- }>['params'], {}>;
16
+ }>['params'], any>;
26
17
  };
27
- /**
28
- *
29
- */
30
18
  declare const buildRPCActions: (handlers: RuntimeRPCRequestHandlers) => AsyncRPCActions;
31
19
 
32
20
  declare const GET_INFO_DETAILS = "GET_INFO_DETAILS";
@@ -36,22 +24,15 @@ declare const GET_DATA_BINDING_DETAILS = "GET_DATA_BINDING_DETAILS";
36
24
  declare const GET_CONSOLE_EVAL = "GET_CONSOLE_EVAL";
37
25
  declare const START_PROFILER = "START_PROFILER";
38
26
  declare const STOP_PROFILER = "STOP_PROFILER";
39
- /**
40
- *
41
- */
42
27
  declare const buildAliases: (actions: AsyncRPCActions) => () => (next: any) => (action: any) => any;
43
28
 
44
29
  /**
45
30
  * Callback function that adds cases for async actions for the player.
46
- *
47
31
  * @param playerReducerCallback
48
32
  * @returns
49
33
  */
50
34
  declare const buildPlayerReducerCallback: (actions: AsyncRPCActions) => (builder: ActionReducerMapBuilder<PlayersState>) => void;
51
35
 
52
- /**
53
- *
54
- */
55
36
  declare function handleMessage(store: Store, message: Message): void;
56
37
 
57
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 };
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) => {
@@ -171,7 +174,10 @@ function handleMessage(store, message) {
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.202",
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.202",
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,5 +1,4 @@
1
- import type { AsyncThunk } from '@reduxjs/toolkit';
2
- import { createAsyncThunk } from '@reduxjs/toolkit';
1
+ import { type AsyncThunk, createAsyncThunk } from '@reduxjs/toolkit';
3
2
  import {
4
3
  Runtime,
5
4
  createLogger,
@@ -11,72 +10,29 @@ const logger = createLogger(BACKGROUND_SOURCE);
11
10
 
12
11
  export type AsyncRPCActions = {
13
12
  [key in Runtime.RuntimeRPCTypes]: AsyncThunk<
14
- Extract<
15
- Runtime.RuntimeRPC,
16
- {
17
- /**
18
- *
19
- */
20
- type: key;
21
- }
22
- >['result'],
23
- Extract<
24
- Runtime.RuntimeRPC,
25
- {
26
- /**
27
- *
28
- */
29
- type: key;
30
- }
31
- >['params'],
32
- {}
13
+ Extract<Runtime.RuntimeRPC, { type: key }>['result'],
14
+ Extract<Runtime.RuntimeRPC, { type: key }>['params'],
15
+ any
33
16
  >;
34
17
  };
35
18
 
36
- /**
37
- *
38
- */
39
19
  export const buildRPCActions = (
40
20
  handlers: RuntimeRPCRequestHandlers
41
21
  ): AsyncRPCActions =>
42
- Runtime.RuntimeRPCTypes.reduce(
43
- (acc, rpcType) => (
44
- // TODO: Fix this
45
- // @ts-ignore
46
- (acc[rpcType] = createAsyncThunk<
47
- Extract<
48
- Runtime.RuntimeRPC,
49
- {
50
- /**
51
- *
52
- */
53
- type: typeof rpcType;
54
- }
55
- >['result'],
56
- Extract<
57
- Runtime.RuntimeRPC,
58
- {
59
- /**
60
- *
61
- */
62
- type: typeof rpcType;
63
- }
64
- >['params']
65
- >(rpcType, async (params) => {
66
- logger.log(`Requesting ${rpcType}`, params);
67
- const data = (await handlers[rpcType].call(params)) as Extract<
68
- Runtime.RuntimeRPC,
69
- {
70
- /**
71
- *
72
- */
73
- type: typeof rpcType;
74
- }
75
- >['result'];
76
- logger.log(`Response from ${rpcType}`, data);
77
- return data;
78
- })),
79
- acc
80
- ),
81
- {} as AsyncRPCActions
82
- );
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);
@@ -16,10 +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
- /**
20
- *
21
- */
22
- const alias = (aliases: any) => () => (next: any) => (action: any) => {
19
+ const _alias = (aliases: any) => () => (next: any) => (action: any) => {
23
20
  const alias = aliases[action.type];
24
21
 
25
22
  if (alias) {
@@ -29,11 +26,8 @@ const alias = (aliases: any) => () => (next: any) => (action: any) => {
29
26
  return next(action);
30
27
  };
31
28
 
32
- /**
33
- *
34
- */
35
29
  export const buildAliases = (actions: AsyncRPCActions) =>
36
- alias({
30
+ _alias({
37
31
  GET_INFO_DETAILS: (action: AliasAction) =>
38
32
  actions['player-runtime-info-request'](action.payload),
39
33
  GET_CONFIG_DETAILS: (action: ConfigAction) =>
@@ -1,5 +1,5 @@
1
- import type { Message } from '@player-tools/devtools-common';
2
1
  import {
2
+ type Message,
3
3
  clearStore,
4
4
  playerFlowStartAction,
5
5
  playerInitAction,
@@ -15,9 +15,6 @@ export * from './actions';
15
15
  export * from './aliases';
16
16
  export * from './reducers';
17
17
 
18
- /**
19
- *
20
- */
21
18
  export function handleMessage(store: Store, message: Message) {
22
19
  switch (message.type) {
23
20
  case 'runtime-init':
@@ -4,7 +4,6 @@ import type { AsyncRPCActions } from './actions';
4
4
 
5
5
  /**
6
6
  * Callback function that adds cases for async actions for the player.
7
- *
8
7
  * @param playerReducerCallback
9
8
  * @returns
10
9
  */
package/src/rpc/index.ts CHANGED
@@ -1,34 +1,21 @@
1
- import type {
2
- Runtime as PlayerRuntime,
3
- RPCRequestMessageEvent,
4
- RPCRequestHandler,
5
- } from '@player-tools/devtools-common';
6
1
  import {
2
+ type RPCRequestMessageEvent,
3
+ type RPCRequestHandler,
7
4
  createRPCRequest,
8
- PANEL_SOURCE,
9
5
  Runtime,
6
+ PANEL_SOURCE,
10
7
  } from '@player-tools/devtools-common';
11
8
 
12
9
  export type RuntimeRPCRequestHandlers = {
13
10
  [key in Runtime.RuntimeRPCTypes]: RPCRequestHandler<any>;
14
11
  };
15
12
 
16
- /**
17
- *
18
- */
19
13
  export const buildRPCRequests = (
20
14
  onRequestMessage: (
21
- message: RPCRequestMessageEvent<PlayerRuntime.RuntimeRPC>
15
+ message: RPCRequestMessageEvent<Runtime.RuntimeRPC>
22
16
  ) => void
23
17
  ): RuntimeRPCRequestHandlers =>
24
- Runtime.RuntimeRPCTypes.reduce(
25
- (acc, rpcType) => (
26
- (acc[rpcType] = createRPCRequest(
27
- rpcType,
28
- PANEL_SOURCE,
29
- onRequestMessage
30
- )),
31
- acc
32
- ),
33
- {} as RuntimeRPCRequestHandlers
34
- );
18
+ Runtime.RuntimeRPCTypes.reduce((acc, rpcType) => {
19
+ acc[rpcType] = createRPCRequest(rpcType, PANEL_SOURCE, onRequestMessage);
20
+ return acc;
21
+ }, {} as RuntimeRPCRequestHandlers);