dreaction-client-core 1.1.1 → 1.1.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/lib/client-options.d.ts +1 -1
- package/lib/index.d.ts +11 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -9
- package/lib/plugins/api-response.d.ts +1 -1
- package/lib/plugins/api-response.d.ts.map +1 -1
- package/lib/plugins/api-response.js +2 -2
- package/lib/plugins/benchmark.d.ts +1 -1
- package/lib/plugins/benchmark.d.ts.map +1 -1
- package/lib/plugins/benchmark.js +3 -3
- package/lib/plugins/clear.d.ts +2 -2
- package/lib/plugins/clear.d.ts.map +1 -1
- package/lib/plugins/clear.js +3 -3
- package/lib/plugins/image.d.ts +1 -1
- package/lib/plugins/image.d.ts.map +1 -1
- package/lib/plugins/image.js +2 -2
- package/lib/plugins/logger.js +1 -1
- package/lib/plugins/repl.d.ts +1 -1
- package/lib/plugins/repl.d.ts.map +1 -1
- package/lib/plugins/repl.js +7 -7
- package/lib/plugins/state-responses.d.ts +3 -3
- package/lib/plugins/state-responses.d.ts.map +1 -1
- package/lib/plugins/state-responses.js +20 -20
- package/lib/serialize.d.ts +1 -1
- package/package.json +3 -2
- package/src/client-options.ts +1 -1
- package/src/index.ts +24 -24
- package/src/plugins/api-response.ts +2 -2
- package/src/plugins/benchmark.ts +3 -3
- package/src/plugins/clear.ts +3 -3
- package/src/plugins/image.ts +2 -2
- package/src/plugins/logger.ts +1 -1
- package/src/plugins/repl.ts +7 -7
- package/src/plugins/state-responses.ts +23 -23
- package/src/serialize.ts +1 -1
package/lib/client-options.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { LifeCycleMethods, PluginCreator } from './';
|
|
|
2
2
|
import NodeWebSocket from 'ws';
|
|
3
3
|
type BrowserWebSocket = WebSocket;
|
|
4
4
|
/**
|
|
5
|
-
* Configuration options for the
|
|
5
|
+
* Configuration options for the DReaction Client.
|
|
6
6
|
*/
|
|
7
7
|
export interface ClientOptions<Client> extends Omit<LifeCycleMethods, 'onCommand'> {
|
|
8
8
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface DReactionCore {
|
|
|
69
69
|
/**
|
|
70
70
|
* Set the configuration options.
|
|
71
71
|
*/
|
|
72
|
-
configure: (options
|
|
72
|
+
configure: (options?: ClientOptions<this>) => ClientOptions<this>['plugins'] extends PluginCreator<this>[] ? this & InferFeaturesFromPlugins<this, ClientOptions<this>['plugins']> : this;
|
|
73
73
|
use: <P extends PluginCreator<this>>(pluginCreator: P) => this & InferFeaturesFromPlugin<this, P>;
|
|
74
74
|
connect: () => this;
|
|
75
75
|
}
|
|
@@ -84,11 +84,11 @@ export declare const corePlugins: (((dreaction: DReactionCore) => {
|
|
|
84
84
|
warn: (message: any) => void;
|
|
85
85
|
error: (message: any, stack: any) => void;
|
|
86
86
|
};
|
|
87
|
-
}) | ((
|
|
87
|
+
}) | ((dreaction: DReactionCore) => {
|
|
88
88
|
features: {
|
|
89
89
|
image: (payload: import("./plugins/image").ImagePayload) => void;
|
|
90
90
|
};
|
|
91
|
-
}) | ((
|
|
91
|
+
}) | ((dreaction: DReactionCore) => {
|
|
92
92
|
features: {
|
|
93
93
|
benchmark: (title: string) => {
|
|
94
94
|
step: (stepTitle: string) => void;
|
|
@@ -96,7 +96,7 @@ export declare const corePlugins: (((dreaction: DReactionCore) => {
|
|
|
96
96
|
last: (stopTitle: string) => void;
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
|
-
}) | ((
|
|
99
|
+
}) | ((dreaction: DReactionCore) => {
|
|
100
100
|
features: {
|
|
101
101
|
stateActionComplete: (name: import("dreaction-protocol").StateActionCompletePayload["name"], action: import("dreaction-protocol").StateActionCompletePayload["action"], important?: any) => void;
|
|
102
102
|
stateValuesResponse: (path: import("dreaction-protocol").StateValuesResponsePayload["path"], value: import("dreaction-protocol").StateValuesResponsePayload["value"], valid?: import("dreaction-protocol").StateValuesResponsePayload["value"]) => void;
|
|
@@ -104,26 +104,26 @@ export declare const corePlugins: (((dreaction: DReactionCore) => {
|
|
|
104
104
|
stateValuesChange: (changes: import("dreaction-protocol").StateValuesChangePayload["changes"]) => false | void;
|
|
105
105
|
stateBackupResponse: (state: import("dreaction-protocol").StateBackupResponsePayload["state"]) => void;
|
|
106
106
|
};
|
|
107
|
-
}) | ((
|
|
107
|
+
}) | ((dreaction: DReactionCore) => {
|
|
108
108
|
features: {
|
|
109
109
|
apiResponse: (request: {
|
|
110
110
|
status: number;
|
|
111
111
|
}, response: any, duration: number) => void;
|
|
112
112
|
};
|
|
113
|
-
}) | ((
|
|
113
|
+
}) | ((dreaction: DReactionCore) => {
|
|
114
114
|
features: {
|
|
115
115
|
clear: () => void;
|
|
116
116
|
};
|
|
117
|
-
}) | ((
|
|
117
|
+
}) | ((dreaction: DReactionCore) => {
|
|
118
118
|
onCommand: ({ type, payload }: Command) => void;
|
|
119
119
|
features: {
|
|
120
120
|
repl: (name: string, value: import("./plugins/repl").AcceptableRepls) => void;
|
|
121
121
|
};
|
|
122
122
|
}))[];
|
|
123
123
|
export type InferPluginsFromCreators<Client, PC extends PluginCreator<Client>[]> = PC extends Array<infer P extends PluginCreator<Client>> ? ReturnType<P>[] : never;
|
|
124
|
-
export interface
|
|
124
|
+
export interface DReaction extends DReactionCore {
|
|
125
125
|
}
|
|
126
|
-
export declare class
|
|
126
|
+
export declare class DReactionImpl implements Omit<DReactionCore, 'options' | 'plugins' | 'configure' | 'connect' | 'use' | 'close'> {
|
|
127
127
|
options: ClientOptions<DReactionCore>;
|
|
128
128
|
/**
|
|
129
129
|
* Are we connected to a server?
|
|
@@ -164,10 +164,10 @@ export declare class ReactotronImpl implements Omit<DReactionCore, 'options' | '
|
|
|
164
164
|
/**
|
|
165
165
|
* Set the configuration options.
|
|
166
166
|
*/
|
|
167
|
-
configure(options
|
|
167
|
+
configure(options?: ClientOptions<this>): ClientOptions<this>['plugins'] extends PluginCreator<this>[] ? this & InferFeaturesFromPlugins<this, ClientOptions<this>['plugins']> : this;
|
|
168
168
|
close(): this;
|
|
169
169
|
/**
|
|
170
|
-
* Connect to the
|
|
170
|
+
* Connect to the DReaction server.
|
|
171
171
|
*/
|
|
172
172
|
connect(): this;
|
|
173
173
|
/**
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAW9E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,oBAAY,OAAO;IACjB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAGD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,KAAK,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAC3C,MAAM,WAAW,MAAM,CAAC,MAAM,CAAE,SAAQ,gBAAgB;IACtD,QAAQ,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,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H,OAAO,CAAC,MAAM,EAAE,aAAa;IAW7B;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK;IAInC;;OAEG;IACH,GAAG,CACD,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,GACjC,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,OAAO,aAAa,CAAC;IA0DpD,eAAe,CACb,MAAM,EAAE,aAAa,GAAG,MAAM,EAC9B,UAAU,CAAC,EAAE,MAAM,IAAI,GACtB,MAAM,IAAI;CAsGd;AAGD,wBAAgB,YAAY,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa,EACvE,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAGyB,MAAM,CAC/D"}
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.DReactionImpl = exports.corePlugins = exports.ArgType = exports.hasStateResponsePlugin = exports.assertHasStateResponsePlugin = exports.assertHasLoggerPlugin = void 0;
|
|
7
7
|
exports.createClient = createClient;
|
|
8
8
|
const validate_1 = __importDefault(require("./validate"));
|
|
9
9
|
const logger_1 = __importDefault(require("./plugins/logger"));
|
|
@@ -49,7 +49,7 @@ const isReservedFeature = (value) => reservedFeatures.some((res) => res === valu
|
|
|
49
49
|
function emptyPromise() {
|
|
50
50
|
return Promise.resolve('');
|
|
51
51
|
}
|
|
52
|
-
class
|
|
52
|
+
class DReactionImpl {
|
|
53
53
|
// the configuration options
|
|
54
54
|
options;
|
|
55
55
|
/**
|
|
@@ -91,9 +91,9 @@ class ReactotronImpl {
|
|
|
91
91
|
/**
|
|
92
92
|
* Set the configuration options.
|
|
93
93
|
*/
|
|
94
|
-
configure(options) {
|
|
94
|
+
configure(options = {}) {
|
|
95
95
|
// options get merged & validated before getting set
|
|
96
|
-
const newOptions =
|
|
96
|
+
const newOptions = {
|
|
97
97
|
createSocket: null,
|
|
98
98
|
host: 'localhost',
|
|
99
99
|
port: 9600,
|
|
@@ -104,7 +104,9 @@ class ReactotronImpl {
|
|
|
104
104
|
onCommand: () => null,
|
|
105
105
|
onConnect: () => null,
|
|
106
106
|
onDisconnect: () => null,
|
|
107
|
-
|
|
107
|
+
...this.options,
|
|
108
|
+
...options,
|
|
109
|
+
};
|
|
108
110
|
(0, validate_1.default)(newOptions);
|
|
109
111
|
this.options = newOptions;
|
|
110
112
|
// if we have plugins, let's add them here
|
|
@@ -119,7 +121,7 @@ class ReactotronImpl {
|
|
|
119
121
|
return this;
|
|
120
122
|
}
|
|
121
123
|
/**
|
|
122
|
-
* Connect to the
|
|
124
|
+
* Connect to the DReaction server.
|
|
123
125
|
*/
|
|
124
126
|
connect() {
|
|
125
127
|
this.connected = true;
|
|
@@ -241,7 +243,7 @@ class ReactotronImpl {
|
|
|
241
243
|
}
|
|
242
244
|
catch {
|
|
243
245
|
this.isReady = false;
|
|
244
|
-
console.log('An error occurred communicating with
|
|
246
|
+
console.log('An error occurred communicating with dreaction. Please reload your app');
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
249
|
else {
|
|
@@ -393,9 +395,9 @@ class ReactotronImpl {
|
|
|
393
395
|
};
|
|
394
396
|
}
|
|
395
397
|
}
|
|
396
|
-
exports.
|
|
398
|
+
exports.DReactionImpl = DReactionImpl;
|
|
397
399
|
// convenience factory function
|
|
398
400
|
function createClient(options) {
|
|
399
|
-
const client = new
|
|
401
|
+
const client = new DReactionImpl();
|
|
400
402
|
return client.configure(options);
|
|
401
403
|
}
|
|
@@ -2,7 +2,7 @@ import type { DReactionCore } from '../';
|
|
|
2
2
|
/**
|
|
3
3
|
* Sends API request/response information.
|
|
4
4
|
*/
|
|
5
|
-
declare const apiResponse: () => (
|
|
5
|
+
declare const apiResponse: () => (dreaction: DReactionCore) => {
|
|
6
6
|
features: {
|
|
7
7
|
apiResponse: (request: {
|
|
8
8
|
status: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-response.d.ts","sourceRoot":"","sources":["../../src/plugins/api-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD;;GAEG;AACH,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"api-response.d.ts","sourceRoot":"","sources":["../../src/plugins/api-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD;;GAEG;AACH,QAAA,MAAM,WAAW,oBAAqB,aAAa;;+BAIlC;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,YACjB,GAAG,YACH,MAAM;;CAkBvB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
/**
|
|
4
4
|
* Sends API request/response information.
|
|
5
5
|
*/
|
|
6
|
-
const apiResponse = () => (
|
|
6
|
+
const apiResponse = () => (dreaction) => {
|
|
7
7
|
return {
|
|
8
8
|
features: {
|
|
9
9
|
apiResponse: (request, response, duration) => {
|
|
@@ -13,7 +13,7 @@ const apiResponse = () => (reactotron) => {
|
|
|
13
13
|
response.status >= 200 &&
|
|
14
14
|
response.status <= 299;
|
|
15
15
|
const important = !ok;
|
|
16
|
-
|
|
16
|
+
dreaction.send('api.response',
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
{ request, response, duration }, important);
|
|
19
19
|
},
|
|
@@ -2,7 +2,7 @@ import type { DReactionCore } from '../';
|
|
|
2
2
|
/**
|
|
3
3
|
* Runs small high-unscientific benchmarks for you.
|
|
4
4
|
*/
|
|
5
|
-
declare const benchmark: () => (
|
|
5
|
+
declare const benchmark: () => (dreaction: DReactionCore) => {
|
|
6
6
|
features: {
|
|
7
7
|
benchmark: (title: string) => {
|
|
8
8
|
step: (stepTitle: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../src/plugins/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD;;GAEG;AACH,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../src/plugins/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD;;GAEG;AACH,QAAA,MAAM,SAAS,oBAAqB,aAAa;;2BAGrB,MAAM;8BAGL,MAAM;8BAWN,MAAM;8BAAN,MAAM;;;CAUlC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/lib/plugins/benchmark.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
/**
|
|
4
4
|
* Runs small high-unscientific benchmarks for you.
|
|
5
5
|
*/
|
|
6
|
-
const benchmark = () => (
|
|
7
|
-
const { startTimer } =
|
|
6
|
+
const benchmark = () => (dreaction) => {
|
|
7
|
+
const { startTimer } = dreaction;
|
|
8
8
|
const benchmark = (title) => {
|
|
9
9
|
const steps = [];
|
|
10
10
|
const elapsed = startTimer();
|
|
@@ -20,7 +20,7 @@ const benchmark = () => (reactotron) => {
|
|
|
20
20
|
steps.push({ title, time: 0, delta: 0 });
|
|
21
21
|
const stop = (stopTitle) => {
|
|
22
22
|
step(stopTitle);
|
|
23
|
-
|
|
23
|
+
dreaction.send('benchmark.report', { title, steps });
|
|
24
24
|
};
|
|
25
25
|
return { step, stop, last: stop };
|
|
26
26
|
};
|
package/lib/plugins/clear.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DReactionCore } from '../';
|
|
2
2
|
/**
|
|
3
|
-
* Clears the
|
|
3
|
+
* Clears the dreaction server.
|
|
4
4
|
*/
|
|
5
|
-
declare const clear: () => (
|
|
5
|
+
declare const clear: () => (dreaction: DReactionCore) => {
|
|
6
6
|
features: {
|
|
7
7
|
clear: () => void;
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/plugins/clear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD;;GAEG;AACH,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/plugins/clear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD;;GAEG;AACH,QAAA,MAAM,KAAK,oBAAqB,aAAa;;;;CAM5C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/lib/plugins/clear.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
|
-
* Clears the
|
|
4
|
+
* Clears the dreaction server.
|
|
5
5
|
*/
|
|
6
|
-
const clear = () => (
|
|
6
|
+
const clear = () => (dreaction) => {
|
|
7
7
|
return {
|
|
8
8
|
features: {
|
|
9
|
-
clear: () =>
|
|
9
|
+
clear: () => dreaction.send('clear'),
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
};
|
package/lib/plugins/image.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/plugins/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/plugins/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,QAAA,MAAM,KAAK,oBAAqB,aAAa;;yBAItB,YAAY;;CAalC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/lib/plugins/image.js
CHANGED
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
/**
|
|
4
4
|
* Provides an image.
|
|
5
5
|
*/
|
|
6
|
-
const image = () => (
|
|
6
|
+
const image = () => (dreaction) => {
|
|
7
7
|
return {
|
|
8
8
|
features: {
|
|
9
9
|
// expanded just to show the specs
|
|
10
10
|
image: (payload) => {
|
|
11
11
|
const { uri, preview, filename, width, height, caption } = payload;
|
|
12
|
-
return
|
|
12
|
+
return dreaction.send('image', {
|
|
13
13
|
uri,
|
|
14
14
|
preview,
|
|
15
15
|
filename,
|
package/lib/plugins/logger.js
CHANGED
|
@@ -38,7 +38,7 @@ const hasLoggerPlugin = (dreaction) => {
|
|
|
38
38
|
exports.hasLoggerPlugin = hasLoggerPlugin;
|
|
39
39
|
const assertHasLoggerPlugin = (dreaction) => {
|
|
40
40
|
if (!(0, exports.hasLoggerPlugin)(dreaction)) {
|
|
41
|
-
throw new Error('This
|
|
41
|
+
throw new Error('This DReaction client has not had the logger plugin applied to it. Make sure that you add `use(logger())` before adding this plugin.');
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
exports.assertHasLoggerPlugin = assertHasLoggerPlugin;
|
package/lib/plugins/repl.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DReactionCore } from '../';
|
|
2
2
|
export type AcceptableRepls = object | Function | string | number;
|
|
3
|
-
declare const repl: () => (
|
|
3
|
+
declare const repl: () => (dreaction: DReactionCore) => {
|
|
4
4
|
onCommand: ({ type, payload }: import("dreaction-protocol").Command) => void;
|
|
5
5
|
features: {
|
|
6
6
|
repl: (name: string, value: AcceptableRepls) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/plugins/repl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAGjD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAElE,QAAA,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/plugins/repl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,KAAK,CAAC;AAGjD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAElE,QAAA,MAAM,IAAI,oBAAqB,aAAa;;;qBA2CzB,MAAM,SAAS,eAAe;;CAahD,CAAC;AACF,eAAe,IAAI,CAAC"}
|
package/lib/plugins/repl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const repl = () => (
|
|
3
|
+
const repl = () => (dreaction) => {
|
|
4
4
|
const myRepls = {};
|
|
5
5
|
// let currentContext = null
|
|
6
6
|
return {
|
|
@@ -9,20 +9,20 @@ const repl = () => (reactotron) => {
|
|
|
9
9
|
return;
|
|
10
10
|
switch (type.substr(5)) {
|
|
11
11
|
case 'ls':
|
|
12
|
-
|
|
12
|
+
dreaction.send('repl.ls.response', Object.keys(myRepls));
|
|
13
13
|
break;
|
|
14
14
|
// case "cd":
|
|
15
15
|
// const changeTo = myRepls.find(r => r.name === payload)
|
|
16
16
|
// if (!changeTo) {
|
|
17
|
-
//
|
|
17
|
+
// dreaction.send("repl.cd.response", "That REPL does not exist")
|
|
18
18
|
// break
|
|
19
19
|
// }
|
|
20
20
|
// currentContext = payload
|
|
21
|
-
//
|
|
21
|
+
// dreaction.send("repl.cd.response", `Change REPL to "${payload}"`)
|
|
22
22
|
// break
|
|
23
23
|
case 'execute':
|
|
24
24
|
// if (!currentContext) {
|
|
25
|
-
//
|
|
25
|
+
// dreaction.send(
|
|
26
26
|
// "repl.execute.response",
|
|
27
27
|
// "You must first select the REPL to use. Try 'ls'"
|
|
28
28
|
// )
|
|
@@ -30,10 +30,10 @@ const repl = () => (reactotron) => {
|
|
|
30
30
|
// }
|
|
31
31
|
// const currentRepl = myRepls.find(r => r.name === currentContext)
|
|
32
32
|
// if (!currentRepl) {
|
|
33
|
-
//
|
|
33
|
+
// dreaction.send("repl.execute.response", "The selected REPL no longer exists.")
|
|
34
34
|
// break
|
|
35
35
|
// }
|
|
36
|
-
|
|
36
|
+
dreaction.send('repl.execute.response', function () {
|
|
37
37
|
return eval(payload); // eslint-disable-line no-eval
|
|
38
38
|
}.call(myRepls));
|
|
39
39
|
break;
|
|
@@ -3,7 +3,7 @@ import type { DReactionCore, InferFeatures } from '../';
|
|
|
3
3
|
/**
|
|
4
4
|
* Provides helper functions for send state responses.
|
|
5
5
|
*/
|
|
6
|
-
declare const stateResponse: () => (
|
|
6
|
+
declare const stateResponse: () => (dreaction: DReactionCore) => {
|
|
7
7
|
features: {
|
|
8
8
|
stateActionComplete: (name: StateActionCompletePayload["name"], action: StateActionCompletePayload["action"], important?: any) => void;
|
|
9
9
|
stateValuesResponse: (path: StateValuesResponsePayload["path"], value: StateValuesResponsePayload["value"], valid?: StateValuesResponsePayload["value"]) => void;
|
|
@@ -15,6 +15,6 @@ declare const stateResponse: () => (reactotron: DReactionCore) => {
|
|
|
15
15
|
};
|
|
16
16
|
export type StateResponsePlugin = ReturnType<typeof stateResponse>;
|
|
17
17
|
export default stateResponse;
|
|
18
|
-
export declare const hasStateResponsePlugin: (
|
|
19
|
-
export declare const assertHasStateResponsePlugin: (
|
|
18
|
+
export declare const hasStateResponsePlugin: (dreaction: DReactionCore) => dreaction is DReactionCore & InferFeatures<DReactionCore, ReturnType<typeof stateResponse>>;
|
|
19
|
+
export declare const assertHasStateResponsePlugin: (dreaction: DReactionCore) => asserts dreaction is DReactionCore & InferFeatures<DReactionCore, ReturnType<typeof stateResponse>>;
|
|
20
20
|
//# sourceMappingURL=state-responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-responses.d.ts","sourceRoot":"","sources":["../../src/plugins/state-responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAU,aAAa,EAAE,MAAM,KAAK,CAAC;AAEhE;;GAEG;AACH,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"state-responses.d.ts","sourceRoot":"","sources":["../../src/plugins/state-responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAU,aAAa,EAAE,MAAM,KAAK,CAAC;AAEhE;;GAEG;AACH,QAAA,MAAM,aAAa,oBAAqB,aAAa;;oCAIvC,0BAA0B,CAAC,MAAM,CAAC,UAChC,0BAA0B,CAAC,QAAQ,CAAC;oCAMtC,0BAA0B,CAAC,MAAM,CAAC,SACjC,0BAA0B,CAAC,OAAO,CAAC,UACnC,0BAA0B,CAAC,OAAO,CAAC;kCAIpC,wBAAwB,CAAC,MAAM,CAAC,QAChC,wBAAwB,CAAC,MAAM,CAAC,UAC/B,wBAAwB,CAAC,OAAO,CAAC;qCAGb,wBAAwB,CAAC,SAAS,CAAC;QAIhE,gDAAgD;qCACnB,0BAA0B,CAAC,OAAO,CAAC;;CAIrE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAEnE,eAAe,aAAa,CAAC;AAE7B,eAAO,MAAM,sBAAsB,cACtB,aAAa,KACvB,SAAS,IAAI,aAAa,GAC3B,aAAa,CAAC,aAAa,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAWV,CAAC;AAEtD,eAAO,MAAM,4BAA4B,cAC5B,aAAa,KACvB,QAAQ,SAAS,IAAI,aAAa,GACnC,aAAa,CAAC,aAAa,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAM9D,CAAC"}
|
|
@@ -4,35 +4,35 @@ exports.assertHasStateResponsePlugin = exports.hasStateResponsePlugin = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Provides helper functions for send state responses.
|
|
6
6
|
*/
|
|
7
|
-
const stateResponse = () => (
|
|
7
|
+
const stateResponse = () => (dreaction) => {
|
|
8
8
|
return {
|
|
9
9
|
features: {
|
|
10
|
-
stateActionComplete: (name, action, important = false) =>
|
|
11
|
-
stateValuesResponse: (path, value, valid = true) =>
|
|
12
|
-
stateKeysResponse: (path, keys, valid = true) =>
|
|
10
|
+
stateActionComplete: (name, action, important = false) => dreaction.send('state.action.complete', { name, action }, !!important),
|
|
11
|
+
stateValuesResponse: (path, value, valid = true) => dreaction.send('state.values.response', { path, value, valid }),
|
|
12
|
+
stateKeysResponse: (path, keys, valid = true) => dreaction.send('state.keys.response', { path, keys, valid }),
|
|
13
13
|
stateValuesChange: (changes) => changes.length > 0 &&
|
|
14
|
-
|
|
14
|
+
dreaction.send('state.values.change', { changes }),
|
|
15
15
|
/** sends the state backup over to the server */
|
|
16
|
-
stateBackupResponse: (state) =>
|
|
16
|
+
stateBackupResponse: (state) => dreaction.send('state.backup.response', { state }),
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
exports.default = stateResponse;
|
|
21
|
-
const hasStateResponsePlugin = (
|
|
22
|
-
'stateActionComplete' in
|
|
23
|
-
typeof
|
|
24
|
-
'stateValuesResponse' in
|
|
25
|
-
typeof
|
|
26
|
-
'stateKeysResponse' in
|
|
27
|
-
typeof
|
|
28
|
-
'stateValuesChange' in
|
|
29
|
-
typeof
|
|
30
|
-
'stateBackupResponse' in
|
|
31
|
-
typeof
|
|
21
|
+
const hasStateResponsePlugin = (dreaction) => dreaction &&
|
|
22
|
+
'stateActionComplete' in dreaction &&
|
|
23
|
+
typeof dreaction.stateActionComplete === 'function' &&
|
|
24
|
+
'stateValuesResponse' in dreaction &&
|
|
25
|
+
typeof dreaction.stateValuesResponse === 'function' &&
|
|
26
|
+
'stateKeysResponse' in dreaction &&
|
|
27
|
+
typeof dreaction.stateKeysResponse === 'function' &&
|
|
28
|
+
'stateValuesChange' in dreaction &&
|
|
29
|
+
typeof dreaction.stateValuesChange === 'function' &&
|
|
30
|
+
'stateBackupResponse' in dreaction &&
|
|
31
|
+
typeof dreaction.stateBackupResponse === 'function';
|
|
32
32
|
exports.hasStateResponsePlugin = hasStateResponsePlugin;
|
|
33
|
-
const assertHasStateResponsePlugin = (
|
|
34
|
-
if (!(0, exports.hasStateResponsePlugin)(
|
|
35
|
-
throw new Error('This
|
|
33
|
+
const assertHasStateResponsePlugin = (dreaction) => {
|
|
34
|
+
if (!(0, exports.hasStateResponsePlugin)(dreaction)) {
|
|
35
|
+
throw new Error('This DReaction client has not had the state responses plugin applied to it. Make sure that you add `use(stateResponse())` before adding this plugin.');
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
exports.assertHasStateResponsePlugin = assertHasStateResponsePlugin;
|
package/lib/serialize.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* BigInts are not supported by JSON.stringify in Hermes android.
|
|
4
4
|
* This is a workaround.
|
|
5
5
|
* https://github.com/GoogleChromeLabs/jsbi/issues/30#issuecomment-953187833
|
|
6
|
-
* https://github.com/infinitered/
|
|
6
|
+
* https://github.com/infinitered/dreaction/issues/1436
|
|
7
7
|
*/
|
|
8
8
|
declare global {
|
|
9
9
|
interface BigInt {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dreaction-client-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
"@types/ws": "^8.5.13",
|
|
18
18
|
"eventemitter-strict": "^1.0.1",
|
|
19
19
|
"ws": "^8.18.0",
|
|
20
|
-
"dreaction-protocol": "1.0.
|
|
20
|
+
"dreaction-protocol": "1.0.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.4.5"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
+
"dev": "tsc --watch",
|
|
26
27
|
"build": "tsc",
|
|
27
28
|
"test": "vitest"
|
|
28
29
|
}
|
package/src/client-options.ts
CHANGED
|
@@ -4,7 +4,7 @@ import NodeWebSocket from 'ws';
|
|
|
4
4
|
type BrowserWebSocket = WebSocket;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Configuration options for the
|
|
7
|
+
* Configuration options for the DReaction Client.
|
|
8
8
|
*/
|
|
9
9
|
export interface ClientOptions<Client>
|
|
10
10
|
extends Omit<LifeCycleMethods, 'onCommand'> {
|
package/src/index.ts
CHANGED
|
@@ -123,7 +123,7 @@ export interface DReactionCore {
|
|
|
123
123
|
* Set the configuration options.
|
|
124
124
|
*/
|
|
125
125
|
configure: (
|
|
126
|
-
options
|
|
126
|
+
options?: ClientOptions<this>
|
|
127
127
|
) => ClientOptions<this>['plugins'] extends PluginCreator<this>[]
|
|
128
128
|
? this & InferFeaturesFromPlugins<this, ClientOptions<this>['plugins']>
|
|
129
129
|
: this;
|
|
@@ -163,8 +163,8 @@ type CorePluginFeatures = InferFeaturesFromPlugins<
|
|
|
163
163
|
typeof corePlugins
|
|
164
164
|
>;
|
|
165
165
|
|
|
166
|
-
// export interface
|
|
167
|
-
export interface
|
|
166
|
+
// export interface DReaction extends DReactionCore, CorePluginFeatures {}
|
|
167
|
+
export interface DReaction extends DReactionCore {}
|
|
168
168
|
|
|
169
169
|
// these are not for you.
|
|
170
170
|
const reservedFeatures = [
|
|
@@ -186,7 +186,7 @@ function emptyPromise() {
|
|
|
186
186
|
return Promise.resolve('');
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
export class
|
|
189
|
+
export class DReactionImpl
|
|
190
190
|
implements
|
|
191
191
|
Omit<
|
|
192
192
|
DReactionCore,
|
|
@@ -245,27 +245,27 @@ export class ReactotronImpl
|
|
|
245
245
|
* Set the configuration options.
|
|
246
246
|
*/
|
|
247
247
|
configure(
|
|
248
|
-
options: ClientOptions<this>
|
|
248
|
+
options: ClientOptions<this> = {}
|
|
249
249
|
): ClientOptions<this>['plugins'] extends PluginCreator<this>[]
|
|
250
250
|
? this & InferFeaturesFromPlugins<this, ClientOptions<this>['plugins']>
|
|
251
251
|
: this {
|
|
252
252
|
// options get merged & validated before getting set
|
|
253
|
-
const newOptions =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
253
|
+
const newOptions = {
|
|
254
|
+
createSocket: null as never,
|
|
255
|
+
host: 'localhost',
|
|
256
|
+
port: 9600,
|
|
257
|
+
name: 'dreaction-core-client',
|
|
258
|
+
secure: false,
|
|
259
|
+
plugins: corePlugins as any,
|
|
260
|
+
safeRecursion: true,
|
|
261
|
+
onCommand: () => null,
|
|
262
|
+
onConnect: () => null,
|
|
263
|
+
onDisconnect: () => null,
|
|
264
|
+
|
|
265
|
+
...this.options,
|
|
266
|
+
...options,
|
|
267
|
+
} satisfies ClientOptions<DReactionCore>;
|
|
268
|
+
|
|
269
269
|
validate(newOptions);
|
|
270
270
|
this.options = newOptions;
|
|
271
271
|
|
|
@@ -289,7 +289,7 @@ export class ReactotronImpl
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
292
|
-
* Connect to the
|
|
292
|
+
* Connect to the DReaction server.
|
|
293
293
|
*/
|
|
294
294
|
connect() {
|
|
295
295
|
this.connected = true;
|
|
@@ -447,7 +447,7 @@ export class ReactotronImpl
|
|
|
447
447
|
} catch {
|
|
448
448
|
this.isReady = false;
|
|
449
449
|
console.log(
|
|
450
|
-
'An error occurred communicating with
|
|
450
|
+
'An error occurred communicating with dreaction. Please reload your app'
|
|
451
451
|
);
|
|
452
452
|
}
|
|
453
453
|
} else {
|
|
@@ -651,6 +651,6 @@ export class ReactotronImpl
|
|
|
651
651
|
export function createClient<Client extends DReactionCore = DReactionCore>(
|
|
652
652
|
options?: ClientOptions<Client>
|
|
653
653
|
) {
|
|
654
|
-
const client = new
|
|
654
|
+
const client = new DReactionImpl();
|
|
655
655
|
return client.configure(options as never) as unknown as Client;
|
|
656
656
|
}
|
|
@@ -3,7 +3,7 @@ import type { DReactionCore, Plugin } from '../';
|
|
|
3
3
|
/**
|
|
4
4
|
* Sends API request/response information.
|
|
5
5
|
*/
|
|
6
|
-
const apiResponse = () => (
|
|
6
|
+
const apiResponse = () => (dreaction: DReactionCore) => {
|
|
7
7
|
return {
|
|
8
8
|
features: {
|
|
9
9
|
apiResponse: (
|
|
@@ -18,7 +18,7 @@ const apiResponse = () => (reactotron: DReactionCore) => {
|
|
|
18
18
|
response.status >= 200 &&
|
|
19
19
|
response.status <= 299;
|
|
20
20
|
const important = !ok;
|
|
21
|
-
|
|
21
|
+
dreaction.send(
|
|
22
22
|
'api.response',
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
{ request, response, duration },
|
package/src/plugins/benchmark.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { DReactionCore, Plugin } from '../';
|
|
|
3
3
|
/**
|
|
4
4
|
* Runs small high-unscientific benchmarks for you.
|
|
5
5
|
*/
|
|
6
|
-
const benchmark = () => (
|
|
7
|
-
const { startTimer } =
|
|
6
|
+
const benchmark = () => (dreaction: DReactionCore) => {
|
|
7
|
+
const { startTimer } = dreaction;
|
|
8
8
|
|
|
9
9
|
const benchmark = (title: string) => {
|
|
10
10
|
const steps = [] as Array<{ title: string; time: number; delta: number }>;
|
|
@@ -22,7 +22,7 @@ const benchmark = () => (reactotron: DReactionCore) => {
|
|
|
22
22
|
steps.push({ title, time: 0, delta: 0 });
|
|
23
23
|
const stop = (stopTitle: string) => {
|
|
24
24
|
step(stopTitle);
|
|
25
|
-
|
|
25
|
+
dreaction.send('benchmark.report', { title, steps });
|
|
26
26
|
};
|
|
27
27
|
return { step, stop, last: stop };
|
|
28
28
|
};
|
package/src/plugins/clear.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { DReactionCore, Plugin } from '../';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Clears the
|
|
4
|
+
* Clears the dreaction server.
|
|
5
5
|
*/
|
|
6
|
-
const clear = () => (
|
|
6
|
+
const clear = () => (dreaction: DReactionCore) => {
|
|
7
7
|
return {
|
|
8
8
|
features: {
|
|
9
|
-
clear: () =>
|
|
9
|
+
clear: () => dreaction.send('clear'),
|
|
10
10
|
},
|
|
11
11
|
} satisfies Plugin<DReactionCore>;
|
|
12
12
|
};
|
package/src/plugins/image.ts
CHANGED
|
@@ -12,13 +12,13 @@ export interface ImagePayload {
|
|
|
12
12
|
/**
|
|
13
13
|
* Provides an image.
|
|
14
14
|
*/
|
|
15
|
-
const image = () => (
|
|
15
|
+
const image = () => (dreaction: DReactionCore) => {
|
|
16
16
|
return {
|
|
17
17
|
features: {
|
|
18
18
|
// expanded just to show the specs
|
|
19
19
|
image: (payload: ImagePayload) => {
|
|
20
20
|
const { uri, preview, filename, width, height, caption } = payload;
|
|
21
|
-
return
|
|
21
|
+
return dreaction.send('image', {
|
|
22
22
|
uri,
|
|
23
23
|
preview,
|
|
24
24
|
filename,
|
package/src/plugins/logger.ts
CHANGED
|
@@ -53,7 +53,7 @@ export const assertHasLoggerPlugin = (
|
|
|
53
53
|
InferFeatures<DReactionCore, ReturnType<typeof logger>> => {
|
|
54
54
|
if (!hasLoggerPlugin(dreaction)) {
|
|
55
55
|
throw new Error(
|
|
56
|
-
'This
|
|
56
|
+
'This DReaction client has not had the logger plugin applied to it. Make sure that you add `use(logger())` before adding this plugin.'
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
};
|
package/src/plugins/repl.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { DReactionCore, Plugin } from '../';
|
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
4
4
|
export type AcceptableRepls = object | Function | string | number;
|
|
5
5
|
|
|
6
|
-
const repl = () => (
|
|
6
|
+
const repl = () => (dreaction: DReactionCore) => {
|
|
7
7
|
const myRepls: { [key: string]: AcceptableRepls } = {};
|
|
8
8
|
// let currentContext = null
|
|
9
9
|
return {
|
|
@@ -12,20 +12,20 @@ const repl = () => (reactotron: DReactionCore) => {
|
|
|
12
12
|
|
|
13
13
|
switch (type.substr(5)) {
|
|
14
14
|
case 'ls':
|
|
15
|
-
|
|
15
|
+
dreaction.send('repl.ls.response', Object.keys(myRepls));
|
|
16
16
|
break;
|
|
17
17
|
// case "cd":
|
|
18
18
|
// const changeTo = myRepls.find(r => r.name === payload)
|
|
19
19
|
// if (!changeTo) {
|
|
20
|
-
//
|
|
20
|
+
// dreaction.send("repl.cd.response", "That REPL does not exist")
|
|
21
21
|
// break
|
|
22
22
|
// }
|
|
23
23
|
// currentContext = payload
|
|
24
|
-
//
|
|
24
|
+
// dreaction.send("repl.cd.response", `Change REPL to "${payload}"`)
|
|
25
25
|
// break
|
|
26
26
|
case 'execute':
|
|
27
27
|
// if (!currentContext) {
|
|
28
|
-
//
|
|
28
|
+
// dreaction.send(
|
|
29
29
|
// "repl.execute.response",
|
|
30
30
|
// "You must first select the REPL to use. Try 'ls'"
|
|
31
31
|
// )
|
|
@@ -33,10 +33,10 @@ const repl = () => (reactotron: DReactionCore) => {
|
|
|
33
33
|
// }
|
|
34
34
|
// const currentRepl = myRepls.find(r => r.name === currentContext)
|
|
35
35
|
// if (!currentRepl) {
|
|
36
|
-
//
|
|
36
|
+
// dreaction.send("repl.execute.response", "The selected REPL no longer exists.")
|
|
37
37
|
// break
|
|
38
38
|
// }
|
|
39
|
-
|
|
39
|
+
dreaction.send(
|
|
40
40
|
'repl.execute.response',
|
|
41
41
|
function () {
|
|
42
42
|
return eval(payload); // eslint-disable-line no-eval
|
|
@@ -10,7 +10,7 @@ import type { DReactionCore, Plugin, InferFeatures } from '../';
|
|
|
10
10
|
/**
|
|
11
11
|
* Provides helper functions for send state responses.
|
|
12
12
|
*/
|
|
13
|
-
const stateResponse = () => (
|
|
13
|
+
const stateResponse = () => (dreaction: DReactionCore) => {
|
|
14
14
|
return {
|
|
15
15
|
features: {
|
|
16
16
|
stateActionComplete: (
|
|
@@ -18,27 +18,27 @@ const stateResponse = () => (reactotron: DReactionCore) => {
|
|
|
18
18
|
action: StateActionCompletePayload['action'],
|
|
19
19
|
important = false
|
|
20
20
|
) =>
|
|
21
|
-
|
|
21
|
+
dreaction.send('state.action.complete', { name, action }, !!important),
|
|
22
22
|
|
|
23
23
|
stateValuesResponse: (
|
|
24
24
|
path: StateValuesResponsePayload['path'],
|
|
25
25
|
value: StateValuesResponsePayload['value'],
|
|
26
26
|
valid: StateValuesResponsePayload['value'] = true
|
|
27
|
-
) =>
|
|
27
|
+
) => dreaction.send('state.values.response', { path, value, valid }),
|
|
28
28
|
|
|
29
29
|
stateKeysResponse: (
|
|
30
30
|
path: StateKeysResponsePayload['path'],
|
|
31
31
|
keys: StateKeysResponsePayload['keys'],
|
|
32
32
|
valid: StateKeysResponsePayload['valid'] = true
|
|
33
|
-
) =>
|
|
33
|
+
) => dreaction.send('state.keys.response', { path, keys, valid }),
|
|
34
34
|
|
|
35
35
|
stateValuesChange: (changes: StateValuesChangePayload['changes']) =>
|
|
36
36
|
changes.length > 0 &&
|
|
37
|
-
|
|
37
|
+
dreaction.send('state.values.change', { changes }),
|
|
38
38
|
|
|
39
39
|
/** sends the state backup over to the server */
|
|
40
40
|
stateBackupResponse: (state: StateBackupResponsePayload['state']) =>
|
|
41
|
-
|
|
41
|
+
dreaction.send('state.backup.response', { state }),
|
|
42
42
|
},
|
|
43
43
|
} satisfies Plugin<DReactionCore>;
|
|
44
44
|
};
|
|
@@ -48,28 +48,28 @@ export type StateResponsePlugin = ReturnType<typeof stateResponse>;
|
|
|
48
48
|
export default stateResponse;
|
|
49
49
|
|
|
50
50
|
export const hasStateResponsePlugin = (
|
|
51
|
-
|
|
52
|
-
):
|
|
51
|
+
dreaction: DReactionCore
|
|
52
|
+
): dreaction is DReactionCore &
|
|
53
53
|
InferFeatures<DReactionCore, ReturnType<typeof stateResponse>> =>
|
|
54
|
-
|
|
55
|
-
'stateActionComplete' in
|
|
56
|
-
typeof
|
|
57
|
-
'stateValuesResponse' in
|
|
58
|
-
typeof
|
|
59
|
-
'stateKeysResponse' in
|
|
60
|
-
typeof
|
|
61
|
-
'stateValuesChange' in
|
|
62
|
-
typeof
|
|
63
|
-
'stateBackupResponse' in
|
|
64
|
-
typeof
|
|
54
|
+
dreaction &&
|
|
55
|
+
'stateActionComplete' in dreaction &&
|
|
56
|
+
typeof dreaction.stateActionComplete === 'function' &&
|
|
57
|
+
'stateValuesResponse' in dreaction &&
|
|
58
|
+
typeof dreaction.stateValuesResponse === 'function' &&
|
|
59
|
+
'stateKeysResponse' in dreaction &&
|
|
60
|
+
typeof dreaction.stateKeysResponse === 'function' &&
|
|
61
|
+
'stateValuesChange' in dreaction &&
|
|
62
|
+
typeof dreaction.stateValuesChange === 'function' &&
|
|
63
|
+
'stateBackupResponse' in dreaction &&
|
|
64
|
+
typeof dreaction.stateBackupResponse === 'function';
|
|
65
65
|
|
|
66
66
|
export const assertHasStateResponsePlugin = (
|
|
67
|
-
|
|
68
|
-
): asserts
|
|
67
|
+
dreaction: DReactionCore
|
|
68
|
+
): asserts dreaction is DReactionCore &
|
|
69
69
|
InferFeatures<DReactionCore, ReturnType<typeof stateResponse>> => {
|
|
70
|
-
if (!hasStateResponsePlugin(
|
|
70
|
+
if (!hasStateResponsePlugin(dreaction)) {
|
|
71
71
|
throw new Error(
|
|
72
|
-
'This
|
|
72
|
+
'This DReaction client has not had the state responses plugin applied to it. Make sure that you add `use(stateResponse())` before adding this plugin.'
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
};
|
package/src/serialize.ts
CHANGED
|
@@ -20,7 +20,7 @@ const NEGATIVE_INFINITY = '~~~ -Infinity ~~~';
|
|
|
20
20
|
* BigInts are not supported by JSON.stringify in Hermes android.
|
|
21
21
|
* This is a workaround.
|
|
22
22
|
* https://github.com/GoogleChromeLabs/jsbi/issues/30#issuecomment-953187833
|
|
23
|
-
* https://github.com/infinitered/
|
|
23
|
+
* https://github.com/infinitered/dreaction/issues/1436
|
|
24
24
|
*/
|
|
25
25
|
declare global {
|
|
26
26
|
interface BigInt {
|