@player-tools/devtools-client 0.2.1--canary.11.202 → 0.2.1--canary.11.226
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 +1 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.esm.js +1 -1
- package/package.json +2 -2
- package/src/redux/actions.ts +7 -48
- package/src/redux/aliases.ts +2 -8
- package/src/redux/index.ts +3 -6
- package/src/redux/reducers.ts +4 -4
- package/src/rpc/index.ts +3 -8
package/dist/index.cjs.js
CHANGED
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
16
|
}>['params'], {}>;
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-tools/devtools-client",
|
|
3
|
-
"version": "0.2.1--canary.11.
|
|
3
|
+
"version": "0.2.1--canary.11.226",
|
|
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.
|
|
11
|
+
"@player-tools/devtools-common": "0.2.1--canary.11.226",
|
|
12
12
|
"@babel/runtime": "7.15.4"
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/index.cjs.js",
|
package/src/redux/actions.ts
CHANGED
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
1
|
+
import { createAsyncThunk, AsyncThunk } from '@reduxjs/toolkit';
|
|
3
2
|
import {
|
|
4
3
|
Runtime,
|
|
5
4
|
createLogger,
|
|
6
5
|
BACKGROUND_SOURCE,
|
|
7
6
|
} from '@player-tools/devtools-common';
|
|
8
|
-
import
|
|
7
|
+
import { RuntimeRPCRequestHandlers } from '../rpc';
|
|
9
8
|
|
|
10
9
|
const logger = createLogger(BACKGROUND_SOURCE);
|
|
11
10
|
|
|
12
11
|
export type AsyncRPCActions = {
|
|
13
12
|
[key in Runtime.RuntimeRPCTypes]: AsyncThunk<
|
|
14
|
-
Extract<
|
|
15
|
-
|
|
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'],
|
|
13
|
+
Extract<Runtime.RuntimeRPC, { type: key }>['result'],
|
|
14
|
+
Extract<Runtime.RuntimeRPC, { type: key }>['params'],
|
|
32
15
|
{}
|
|
33
16
|
>;
|
|
34
17
|
};
|
|
35
18
|
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
19
|
export const buildRPCActions = (
|
|
40
20
|
handlers: RuntimeRPCRequestHandlers
|
|
41
21
|
): AsyncRPCActions =>
|
|
@@ -44,34 +24,13 @@ export const buildRPCActions = (
|
|
|
44
24
|
// TODO: Fix this
|
|
45
25
|
// @ts-ignore
|
|
46
26
|
(acc[rpcType] = createAsyncThunk<
|
|
47
|
-
Extract<
|
|
48
|
-
|
|
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']
|
|
27
|
+
Extract<Runtime.RuntimeRPC, { type: typeof rpcType }>['result'],
|
|
28
|
+
Extract<Runtime.RuntimeRPC, { type: typeof rpcType }>['params']
|
|
65
29
|
>(rpcType, async (params) => {
|
|
66
30
|
logger.log(`Requesting ${rpcType}`, params);
|
|
67
31
|
const data = (await handlers[rpcType].call(params)) as Extract<
|
|
68
32
|
Runtime.RuntimeRPC,
|
|
69
|
-
{
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
type: typeof rpcType;
|
|
74
|
-
}
|
|
33
|
+
{ type: typeof rpcType }
|
|
75
34
|
>['result'];
|
|
76
35
|
logger.log(`Response from ${rpcType}`, data);
|
|
77
36
|
return data;
|
package/src/redux/aliases.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
AliasAction,
|
|
3
3
|
ConfigAction,
|
|
4
4
|
DataBindingAction,
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
StartProfilerAction,
|
|
7
7
|
StopProfilerAction,
|
|
8
8
|
} from '@player-tools/devtools-common';
|
|
9
|
-
import
|
|
9
|
+
import { 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,9 +16,6 @@ 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
19
|
const alias = (aliases: any) => () => (next: any) => (action: any) => {
|
|
23
20
|
const alias = aliases[action.type];
|
|
24
21
|
|
|
@@ -29,9 +26,6 @@ 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
30
|
alias({
|
|
37
31
|
GET_INFO_DETAILS: (action: AliasAction) =>
|
package/src/redux/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Message } from '@player-tools/devtools-common';
|
|
2
1
|
import {
|
|
3
2
|
clearStore,
|
|
3
|
+
Message,
|
|
4
4
|
playerFlowStartAction,
|
|
5
5
|
playerInitAction,
|
|
6
6
|
playerRemoveAction,
|
|
@@ -8,16 +8,13 @@ import {
|
|
|
8
8
|
playerViewUpdateAction,
|
|
9
9
|
selectedPlayerAction,
|
|
10
10
|
} from '@player-tools/devtools-common';
|
|
11
|
-
import
|
|
11
|
+
import { Store } from 'redux';
|
|
12
12
|
import { GET_DATA_BINDING_DETAILS } from './aliases';
|
|
13
13
|
|
|
14
14
|
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':
|
|
@@ -67,7 +64,7 @@ export function handleMessage(store: Store, message: Message) {
|
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
default:
|
|
70
|
-
console.warn(
|
|
67
|
+
console.warn('Unhandled event: ' + JSON.stringify(message));
|
|
71
68
|
break;
|
|
72
69
|
}
|
|
73
70
|
}
|
package/src/redux/reducers.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Callback function that adds cases for async actions for the player.
|
|
7
|
-
*
|
|
8
8
|
* @param playerReducerCallback
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
package/src/rpc/index.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Runtime as PlayerRuntime,
|
|
3
|
-
RPCRequestMessageEvent,
|
|
4
|
-
RPCRequestHandler,
|
|
5
|
-
} from '@player-tools/devtools-common';
|
|
6
1
|
import {
|
|
7
2
|
createRPCRequest,
|
|
8
3
|
PANEL_SOURCE,
|
|
4
|
+
Runtime as PlayerRuntime,
|
|
5
|
+
RPCRequestMessageEvent,
|
|
6
|
+
RPCRequestHandler,
|
|
9
7
|
Runtime,
|
|
10
8
|
} from '@player-tools/devtools-common';
|
|
11
9
|
|
|
@@ -13,9 +11,6 @@ export type RuntimeRPCRequestHandlers = {
|
|
|
13
11
|
[key in Runtime.RuntimeRPCTypes]: RPCRequestHandler<any>;
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
14
|
export const buildRPCRequests = (
|
|
20
15
|
onRequestMessage: (
|
|
21
16
|
message: RPCRequestMessageEvent<PlayerRuntime.RuntimeRPC>
|