@3fv/electron-utility-process-manager 1.0.6 → 1.0.8
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/README.md +53 -2
- package/lib/cjs/index.js +17 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/main/UPMMainService.js +24 -12
- package/lib/cjs/main/UPMMainService.js.map +1 -1
- package/lib/cjs/main/UPMMainServiceManager.js +17 -7
- package/lib/cjs/main/UPMMainServiceManager.js.map +1 -1
- package/lib/cjs/node/UPMNodeProcess.js +17 -7
- package/lib/cjs/node/UPMNodeProcess.js.map +1 -1
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/renderer/UPMRendererClientFactory.js +17 -7
- package/lib/cjs/renderer/UPMRendererClientFactory.js.map +1 -1
- package/lib/mjs/main/UPMMainService.js +5 -3
- package/lib/mjs/main/UPMMainService.js.map +1 -1
- package/lib/mjs/package.json +1 -0
- package/package.json +81 -43
- package/src/common/clients.ts +276 -0
- package/src/common/guards.ts +11 -0
- package/src/common/index.ts +3 -0
- package/src/common/types.ts +106 -0
- package/src/index.ts +8 -0
- package/src/main/UPMMainService.ts +454 -0
- package/src/main/UPMMainServiceManager.ts +178 -0
- package/src/main/index.ts +2 -0
- package/src/node/UPMNodeProcess.ts +164 -0
- package/src/node/index.ts +3 -0
- package/src/renderer/UPMRendererClientFactory.ts +57 -0
- package/src/renderer/index.ts +4 -0
- package/.prettierrc.js +0 -14
- package/examples/lib-examples/complex/complex-main.d.ts +0 -1
- package/examples/lib-examples/complex/complex-main.js +0 -108
- package/examples/lib-examples/complex/complex-main.js.map +0 -1
- package/examples/lib-examples/complex/complex-node.d.ts +0 -1
- package/examples/lib-examples/complex/complex-node.js +0 -17
- package/examples/lib-examples/complex/complex-node.js.map +0 -1
- package/examples/lib-examples/complex/complex-renderer.d.ts +0 -1
- package/examples/lib-examples/complex/complex-renderer.js +0 -18
- package/examples/lib-examples/complex/complex-renderer.js.map +0 -1
- package/examples/lib-examples/complex/complex-types.d.ts +0 -3
- package/examples/lib-examples/complex/complex-types.js +0 -3
- package/examples/lib-examples/complex/complex-types.js.map +0 -1
- package/examples/lib-examples/simple/simple-main.d.ts +0 -1
- package/examples/lib-examples/simple/simple-main.js +0 -113
- package/examples/lib-examples/simple/simple-main.js.map +0 -1
- package/examples/lib-examples/simple/simple-node.d.ts +0 -1
- package/examples/lib-examples/simple/simple-node.js +0 -17
- package/examples/lib-examples/simple/simple-node.js.map +0 -1
- package/examples/lib-examples/simple/simple-renderer.d.ts +0 -1
- package/examples/lib-examples/simple/simple-renderer.js +0 -17
- package/examples/lib-examples/simple/simple-renderer.js.map +0 -1
- package/jest.config.js +0 -20
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { assert, isPromise } from "@3fv/guard"
|
|
2
|
+
import { match } from "ts-pattern"
|
|
3
|
+
import * as UPM from "../common/index.js"
|
|
4
|
+
import Tracer from "tracer"
|
|
5
|
+
import { Future } from "@3fv/prelude-ts"
|
|
6
|
+
|
|
7
|
+
const log = Tracer.colorConsole()
|
|
8
|
+
|
|
9
|
+
export class UPMNodeProcess
|
|
10
|
+
{
|
|
11
|
+
readonly processPort = process.parentPort
|
|
12
|
+
|
|
13
|
+
private readonly clientPorts_ = new Map<string, Electron.MessagePortMain>()
|
|
14
|
+
|
|
15
|
+
private readonly requestHandlers_ = new Map<string, UPM.RequestHandler>()
|
|
16
|
+
|
|
17
|
+
private readonly eventHandlers_ = Array<UPM.EventHandler>()
|
|
18
|
+
|
|
19
|
+
private onServiceClientPort(clientId: string, port: Electron.MessagePortMain) {
|
|
20
|
+
log.info(`Received new client port for clientId (${clientId})`)
|
|
21
|
+
assert(!this.clientPorts_.has(clientId), `port already registered for clientId(${clientId})`)
|
|
22
|
+
|
|
23
|
+
port.on("message", (ev: Electron.MessageEvent) => {
|
|
24
|
+
const envelope = (
|
|
25
|
+
ev.data?.message ?? ev.data
|
|
26
|
+
) as UPM.NodeEnvelope,
|
|
27
|
+
{ channel, payload } = envelope
|
|
28
|
+
log.info(`Message received on client port (${clientId})`, envelope)
|
|
29
|
+
|
|
30
|
+
assert(
|
|
31
|
+
channel === UPM.IPCChannel.UPMServiceMessage,
|
|
32
|
+
`Only IPCChannel.UPMServiceMessage are allowed on client ports: ${channel}`
|
|
33
|
+
)
|
|
34
|
+
Future.of(this.onServiceMessage(clientId, port, payload))
|
|
35
|
+
.onFailure(err => log.error(`Unable to handle message`, err))
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
port.on("close", () => {
|
|
39
|
+
this.clientPorts_.delete(clientId)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
port.start()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private async onServiceMessage(clientId: string, port: UPM.Port, payload: UPM.Message<any, any>) {
|
|
46
|
+
log.info(`onServiceMessage from (clientId=${clientId})`, payload)
|
|
47
|
+
const { messageId, kind, args, eventData, type } = payload
|
|
48
|
+
await match(kind)
|
|
49
|
+
.with(UPM.MessageKind.Request, async () => {
|
|
50
|
+
try {
|
|
51
|
+
assert(
|
|
52
|
+
this.requestHandlers_.has(type),
|
|
53
|
+
`Unknown request handler (${type})`
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const handler = this.requestHandlers_.get(type)
|
|
57
|
+
const result = await handler(type, messageId, ...args as any),
|
|
58
|
+
msg:UPM.NodeMessage = {
|
|
59
|
+
channel: UPM.IPCChannel.UPMServiceMessage,
|
|
60
|
+
payload: {
|
|
61
|
+
type,
|
|
62
|
+
kind: UPM.MessageKind.Response,
|
|
63
|
+
messageId,
|
|
64
|
+
result
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
port.postMessage(msg)
|
|
69
|
+
} catch (err) {
|
|
70
|
+
log.error(`Unable to handle message`, err)
|
|
71
|
+
const msg:UPM.NodeMessage = {
|
|
72
|
+
channel: UPM.IPCChannel.UPMServiceMessage,
|
|
73
|
+
payload:
|
|
74
|
+
{
|
|
75
|
+
type,
|
|
76
|
+
kind: UPM.MessageKind.Response,
|
|
77
|
+
messageId,
|
|
78
|
+
result: null,
|
|
79
|
+
error: err.message ?? err.toString()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
port.postMessage(msg)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
.with(UPM.MessageKind.Event, async () => {
|
|
86
|
+
try {
|
|
87
|
+
for (const handler of this.eventHandlers_) {
|
|
88
|
+
let res = handler(clientId, port, eventData)
|
|
89
|
+
if (isPromise(res)) {
|
|
90
|
+
const resPromise = res as Promise<boolean>
|
|
91
|
+
res = await resPromise
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (res === true) {
|
|
95
|
+
log.info(`Successfully handled (${messageId}) event`)
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
} catch (err) {
|
|
101
|
+
log.error(`Unable to handle event (${messageId})`, err)
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
.otherwise(async kind => {
|
|
105
|
+
log.error(`Message kind (${kind}) is invalid here`)
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private onMessage(port: UPM.Port, message: Electron.MessageEvent) {
|
|
110
|
+
log.info(`Message received on utilityProcess`, message.data)
|
|
111
|
+
const { channel, payload } = (
|
|
112
|
+
message.data?.message ?? message.data
|
|
113
|
+
) as UPM.NodeEnvelope
|
|
114
|
+
match(channel)
|
|
115
|
+
.when(c => c === UPM.IPCChannel.UPMServiceMessage, () => this.onServiceMessage("main", port, payload))
|
|
116
|
+
.when(
|
|
117
|
+
c => c === UPM.IPCChannel.UPMServiceNewClient,
|
|
118
|
+
() => this.onServiceClientPort(payload.clientId, message.ports[0])
|
|
119
|
+
)
|
|
120
|
+
.otherwise(c => {
|
|
121
|
+
log.error(`Unknown channel (${c})`)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private constructor() {
|
|
127
|
+
this.processPort.on("message", (message: Electron.MessageEvent) => this.onMessage(this.processPort, message))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
addRequestHandler<
|
|
131
|
+
ReqMap extends UPM.MessageRequestMap = any,
|
|
132
|
+
Type extends UPM.MessageRequestNames<ReqMap> = UPM.MessageRequestNames<ReqMap>
|
|
133
|
+
>(type: Type, handler: UPM.RequestHandler<ReqMap, Type>) {
|
|
134
|
+
log.info(`Registering request handler for type (${type.toString()})`)
|
|
135
|
+
this.requestHandlers_.set(type as string, handler)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
addEventHandler(handler: UPM.EventHandler) {
|
|
139
|
+
log.info(`Registering event handler`)
|
|
140
|
+
this.eventHandlers_.push(handler)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Singleton instance
|
|
145
|
+
*
|
|
146
|
+
* @private
|
|
147
|
+
*/
|
|
148
|
+
private static sInstance_: UPMNodeProcess = null
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get singleton instance
|
|
152
|
+
*/
|
|
153
|
+
static get(): UPMNodeProcess {
|
|
154
|
+
if (!this.sInstance_) {
|
|
155
|
+
this.sInstance_ = new UPMNodeProcess()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return this.sInstance_
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const upmNodeProcess = UPMNodeProcess.get()
|
|
163
|
+
|
|
164
|
+
export default upmNodeProcess
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as UPM from "../common/index.js"
|
|
2
|
+
import { Deferred } from "@3fv/deferred"
|
|
3
|
+
import { ipcRenderer } from "electron"
|
|
4
|
+
import { assert } from "@3fv/guard"
|
|
5
|
+
import Tracer from "tracer"
|
|
6
|
+
|
|
7
|
+
const log = Tracer.colorConsole()
|
|
8
|
+
|
|
9
|
+
export class UPMRendererClientFactory {
|
|
10
|
+
|
|
11
|
+
static async createClient<
|
|
12
|
+
ReqMap extends UPM.MessageRequestMap = any,
|
|
13
|
+
MType extends UPM.MessageRequestNames<ReqMap> = UPM.MessageRequestNames<ReqMap>
|
|
14
|
+
>(serviceName: string, clientId: string = "renderer"): Promise<UPM.MessagePortClient<ReqMap, MType>> {
|
|
15
|
+
const deferred = new Deferred<UPM.MessagePortClient<ReqMap,MType>>()
|
|
16
|
+
|
|
17
|
+
const onNewClient = (ev: Electron.IpcRendererEvent, data:{serviceName: string, clientId: string}) => {
|
|
18
|
+
try {
|
|
19
|
+
const {serviceName: portServiceName, clientId: portClientId} = data
|
|
20
|
+
|
|
21
|
+
log.info(`Received new client & port for (service=${serviceName},portServiceName=${portServiceName},clientId=${clientId},portClientId=${portClientId})`)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if (serviceName === portServiceName && clientId === portClientId) {
|
|
25
|
+
log.info(`Matched client & service`)
|
|
26
|
+
if (ev.ports.length !== 1) {
|
|
27
|
+
deferred.reject(Error("A least 1 port must be transferred"))
|
|
28
|
+
} else {
|
|
29
|
+
const port = ev.ports[0]
|
|
30
|
+
deferred.resolve(new UPM.MessagePortClient(clientId, port))
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} catch (err) {
|
|
34
|
+
log.error(`OnNewClient error`, err)
|
|
35
|
+
deferred.reject(err)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
ipcRenderer.on(UPM.IPCChannel.UPMServiceNewClient, onNewClient)
|
|
41
|
+
ipcRenderer.send(UPM.IPCChannel.UPMServiceNewClient,serviceName, clientId)
|
|
42
|
+
|
|
43
|
+
const serviceClient = await deferred.promise
|
|
44
|
+
assert(!!serviceClient.port, "Port should be valid after new client resolve")
|
|
45
|
+
} catch (err) {
|
|
46
|
+
deferred.reject(err)
|
|
47
|
+
throw err
|
|
48
|
+
} finally {
|
|
49
|
+
ipcRenderer.off(UPM.IPCChannel.UPMServiceNewClient, onNewClient)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return deferred.promise
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default UPMRendererClientFactory
|
package/.prettierrc.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports = {
|
|
3
|
-
"trailingComma": "none",
|
|
4
|
-
"tabWidth": 2,
|
|
5
|
-
embeddedLanguageFormatting: "auto",
|
|
6
|
-
printWidth: 60,
|
|
7
|
-
"semi": false,
|
|
8
|
-
"singleQuote": false,
|
|
9
|
-
// parser: "typescript",
|
|
10
|
-
parser: "babel",
|
|
11
|
-
bracketSpacing: true,
|
|
12
|
-
useTabs: false,
|
|
13
|
-
proseWrap: "always"
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
// Modules to control application life and create native browser window
|
|
30
|
-
const electron_1 = require("electron");
|
|
31
|
-
const electron_utility_process_manager_1 = require("@3fv/electron-utility-process-manager");
|
|
32
|
-
const tracer_1 = __importDefault(require("tracer"));
|
|
33
|
-
const path_1 = __importDefault(require("path"));
|
|
34
|
-
const log = tracer_1.default.colorConsole();
|
|
35
|
-
let upmService = null;
|
|
36
|
-
/**
|
|
37
|
-
* Boilerplate
|
|
38
|
-
*
|
|
39
|
-
* > Note: this can be done via a preload script,
|
|
40
|
-
* but for the sake of simplicity, we are just
|
|
41
|
-
* disabling all security here
|
|
42
|
-
*
|
|
43
|
-
* @returns {Promise<void>}
|
|
44
|
-
*/
|
|
45
|
-
async function createWindow() {
|
|
46
|
-
const mainWindow = new electron_1.BrowserWindow({
|
|
47
|
-
width: 1000,
|
|
48
|
-
height: 1000,
|
|
49
|
-
webPreferences: {
|
|
50
|
-
contextIsolation: false,
|
|
51
|
-
nodeIntegration: true,
|
|
52
|
-
sandbox: false,
|
|
53
|
-
devTools: true
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
// Load the sample page
|
|
57
|
-
const htmlFile = path_1.default.resolve(__dirname, "..", "..", "..", "examples", "complex", "complex-renderer.html");
|
|
58
|
-
mainWindow.webContents.openDevTools({ mode: "right" });
|
|
59
|
-
await mainWindow.loadFile(htmlFile);
|
|
60
|
-
}
|
|
61
|
-
async function start() {
|
|
62
|
-
const upm = await Promise.resolve().then(() => __importStar(require("@3fv/electron-utility-process-manager/main")));
|
|
63
|
-
const upmManager = upm.upmMainServiceManager;
|
|
64
|
-
Object.assign(global, {
|
|
65
|
-
upm,
|
|
66
|
-
upmManager
|
|
67
|
-
});
|
|
68
|
-
log.info("UPM manager ready, now creating service", upmManager);
|
|
69
|
-
upmService = await upmManager.createService("complex", path_1.default.join(__dirname, "complex-node.js"));
|
|
70
|
-
log.info("UPM service ready");
|
|
71
|
-
upmService.sendEvent("test123");
|
|
72
|
-
const clientPort = upmManager.createMainChannel("complex", "main-channel-01");
|
|
73
|
-
log.info("Start the client port");
|
|
74
|
-
if (electron_utility_process_manager_1.UPM.isMessagePort(clientPort))
|
|
75
|
-
clientPort.start();
|
|
76
|
-
log.info("Post a message directly");
|
|
77
|
-
clientPort.postMessage({
|
|
78
|
-
channel: electron_utility_process_manager_1.UPM.IPCChannel.UPMServiceMessage,
|
|
79
|
-
payload: { kind: electron_utility_process_manager_1.UPM.MessageKind.Event, messageId: -1, data: { test: "test456" } }
|
|
80
|
-
});
|
|
81
|
-
log.info("Send event via the UPMMainService wrapper");
|
|
82
|
-
upmService.sendEvent({ test: "test789" }, clientPort);
|
|
83
|
-
log.info(`Creating port client`);
|
|
84
|
-
const messageClient = upmManager.createMainClient("complex", "main-client-01"), serviceClient = messageClient.getServiceClient();
|
|
85
|
-
log.info(`Send request/response: ping`);
|
|
86
|
-
const msgPongResult = await messageClient.executeRequest("ping", "main");
|
|
87
|
-
log.info(`msgPongResult=${msgPongResult}`);
|
|
88
|
-
const servicePongResult = await serviceClient.ping("main");
|
|
89
|
-
log.info(`servicePongResult=${servicePongResult}`);
|
|
90
|
-
log.info(`Create the window/renderer`);
|
|
91
|
-
await createWindow();
|
|
92
|
-
electron_1.app.on("activate", function () {
|
|
93
|
-
if (electron_1.BrowserWindow.getAllWindows().length === 0)
|
|
94
|
-
createWindow();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
// When App is READY
|
|
98
|
-
electron_1.app.whenReady().then(start);
|
|
99
|
-
// Quit when all windows are closed, except on macOS. There, it's common
|
|
100
|
-
// for applications and their menu bar to stay active until the user quits
|
|
101
|
-
// explicitly with Cmd + Q.
|
|
102
|
-
electron_1.app.on("window-all-closed", function () {
|
|
103
|
-
if (process.platform !== "darwin")
|
|
104
|
-
electron_1.app.quit();
|
|
105
|
-
});
|
|
106
|
-
// In this file you can include the rest of your app's specific main process
|
|
107
|
-
// code. You can also put them in separate files and require them here.
|
|
108
|
-
//# sourceMappingURL=complex-main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complex-main.js","sourceRoot":"","sources":["../../complex/complex-main.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const tracer_1 = __importDefault(require("tracer"));
|
|
7
|
-
const node_1 = __importDefault(require("@3fv/electron-utility-process-manager/node"));
|
|
8
|
-
const log = tracer_1.default.console();
|
|
9
|
-
node_1.default.addEventHandler((clientId, port, payload) => {
|
|
10
|
-
log.info(`Received event from (${clientId})`, payload);
|
|
11
|
-
return true;
|
|
12
|
-
});
|
|
13
|
-
node_1.default.addRequestHandler("ping", async (type, messageId, what) => {
|
|
14
|
-
log.info(`Ping request received (${messageId})`, what);
|
|
15
|
-
return `pong: ${what}`;
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=complex-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complex-node.js","sourceRoot":"","sources":["../../complex/complex-node.ts"],"names":[],"mappings":";;;;;AACA,oDAA2B;AAC3B,sFAAuE;AAEvE,MAAM,GAAG,GAAG,gBAAM,CAAC,OAAO,EAAE,CAAA;AAE5B,cAAc,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACzD,GAAG,CAAC,IAAI,CAAC,wBAAwB,QAAQ,GAAG,EAAE,OAAO,CAAC,CAAA;IACtD,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA;AAEF,cAAc,CAAC,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAY,EAAE,EAAE;IAC/E,GAAG,CAAC,IAAI,CAAC,0BAA0B,SAAS,GAAG,EAAE,IAAI,CAAC,CAAA;IACtD,OAAO,SAAS,IAAI,EAAE,CAAA;AACxB,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const renderer_1 = __importDefault(require("@3fv/electron-utility-process-manager/renderer"));
|
|
7
|
-
const tracer_1 = __importDefault(require("tracer"));
|
|
8
|
-
const log = tracer_1.default.colorConsole();
|
|
9
|
-
document.querySelector("#root").innerHTML = `complex-renderer-example`;
|
|
10
|
-
async function complexExampleUPM() {
|
|
11
|
-
const messageClient = await renderer_1.default.createClient("complex", `${process.type}-01`), serviceClient = messageClient.getServiceClient();
|
|
12
|
-
const messageResult = await messageClient.executeRequest("ping", process.type), serviceResult = await serviceClient.ping(process.type);
|
|
13
|
-
log.info(`messageResult=${messageResult}`);
|
|
14
|
-
log.info(`serviceResult=${serviceResult}`);
|
|
15
|
-
}
|
|
16
|
-
complexExampleUPM()
|
|
17
|
-
.catch(err => log.error(`renderer error: ${err.message}`, err));
|
|
18
|
-
//# sourceMappingURL=complex-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complex-renderer.js","sourceRoot":"","sources":["../../complex/complex-renderer.ts"],"names":[],"mappings":";;;;;AAAA,8FAAqF;AACrF,oDAA2B;AAG3B,MAAM,GAAG,GAAG,gBAAM,CAAC,YAAY,EAAE,CAAA;AAEjC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,SAAS,GAAG,0BAA0B,CAAA;AAEtE,KAAK,UAAU,iBAAiB;IAC9B,MAAM,aAAa,GAAG,MAAM,kBAAwB,CAAC,YAAY,CAAyB,SAAS,EAAC,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,EACvH,aAAa,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAA;IAElD,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAC5E,aAAa,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAExD,GAAG,CAAC,IAAI,CAAC,iBAAiB,aAAa,EAAE,CAAC,CAAA;IAC1C,GAAG,CAAC,IAAI,CAAC,iBAAiB,aAAa,EAAE,CAAC,CAAA;AAC5C,CAAC;AAED,iBAAiB,EAAE;KAChB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complex-types.js","sourceRoot":"","sources":["../../complex/complex-types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
// Modules to control application life and create native browser window
|
|
30
|
-
const electron_1 = require("electron");
|
|
31
|
-
const electron_utility_process_manager_1 = require("@3fv/electron-utility-process-manager");
|
|
32
|
-
const tracer_1 = __importDefault(require("tracer"));
|
|
33
|
-
const path_1 = __importDefault(require("path"));
|
|
34
|
-
const log = tracer_1.default.colorConsole();
|
|
35
|
-
let upmService = null;
|
|
36
|
-
/**
|
|
37
|
-
* Boilerplate
|
|
38
|
-
*
|
|
39
|
-
* > Note: this can be done via a preload script,
|
|
40
|
-
* but for the sake of simplicity, we are just
|
|
41
|
-
* disabling all security here
|
|
42
|
-
*
|
|
43
|
-
* @returns {Promise<void>}
|
|
44
|
-
*/
|
|
45
|
-
async function createWindow() {
|
|
46
|
-
const mainWindow = new electron_1.BrowserWindow({
|
|
47
|
-
width: 1000,
|
|
48
|
-
height: 1000,
|
|
49
|
-
webPreferences: {
|
|
50
|
-
contextIsolation: false,
|
|
51
|
-
nodeIntegration: true,
|
|
52
|
-
sandbox: false,
|
|
53
|
-
devTools: true
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
// Load the sample page
|
|
57
|
-
const htmlFile = path_1.default.resolve(__dirname, "..", "..", "..", "examples", "simple", "simple-renderer.html");
|
|
58
|
-
mainWindow.webContents.openDevTools({ mode: "right" });
|
|
59
|
-
await mainWindow.loadFile(htmlFile);
|
|
60
|
-
}
|
|
61
|
-
async function start() {
|
|
62
|
-
const upm = await Promise.resolve().then(() => __importStar(require("@3fv/electron-utility-process-manager/main")));
|
|
63
|
-
const upmManager = upm.upmMainServiceManager;
|
|
64
|
-
Object.assign(global, {
|
|
65
|
-
upm,
|
|
66
|
-
upmManager
|
|
67
|
-
});
|
|
68
|
-
log.info("UPM manager ready, now creating service", upmManager);
|
|
69
|
-
const entryFile = path_1.default.join(__dirname, "simple-node.js");
|
|
70
|
-
upmService = await upmManager.createService("simple", entryFile, {
|
|
71
|
-
// ENABLE DEBUGGING (standard node.js inspect config)
|
|
72
|
-
// inspect: {
|
|
73
|
-
// break: true,
|
|
74
|
-
// port: 9449
|
|
75
|
-
// }
|
|
76
|
-
});
|
|
77
|
-
log.info("UPM service ready");
|
|
78
|
-
upmService.sendEvent("test123");
|
|
79
|
-
const clientPort = upmManager.createMainChannel("simple", "main-channel-01");
|
|
80
|
-
log.info("Start the client port");
|
|
81
|
-
if (electron_utility_process_manager_1.UPM.isMessagePort(clientPort))
|
|
82
|
-
clientPort.start();
|
|
83
|
-
log.info("Post a message directly");
|
|
84
|
-
clientPort.postMessage({
|
|
85
|
-
channel: electron_utility_process_manager_1.UPM.IPCChannel.UPMServiceMessage,
|
|
86
|
-
payload: { kind: electron_utility_process_manager_1.UPM.MessageKind.Event, messageId: -1, data: { test: "test456" } }
|
|
87
|
-
});
|
|
88
|
-
log.info("Send event via the UPMMainService wrapper");
|
|
89
|
-
upmService.sendEvent({ test: "test789" }, clientPort);
|
|
90
|
-
log.info(`Creating port client`);
|
|
91
|
-
const client = upmManager.createMainClient("simple", "main-client-01");
|
|
92
|
-
log.info(`Send request/response: ping`);
|
|
93
|
-
const pongResult = await client.executeRequest("ping", "main");
|
|
94
|
-
log.info(`Received pong response`, pongResult);
|
|
95
|
-
log.info(`Create the window/renderer`);
|
|
96
|
-
await createWindow();
|
|
97
|
-
electron_1.app.on("activate", function () {
|
|
98
|
-
if (electron_1.BrowserWindow.getAllWindows().length === 0)
|
|
99
|
-
createWindow();
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
// When App is READY
|
|
103
|
-
electron_1.app.whenReady().then(start);
|
|
104
|
-
// Quit when all windows are closed, except on macOS. There, it's common
|
|
105
|
-
// for applications and their menu bar to stay active until the user quits
|
|
106
|
-
// explicitly with Cmd + Q.
|
|
107
|
-
electron_1.app.on("window-all-closed", function () {
|
|
108
|
-
if (process.platform !== "darwin")
|
|
109
|
-
electron_1.app.quit();
|
|
110
|
-
});
|
|
111
|
-
// In this file you can include the rest of your app's specific main process
|
|
112
|
-
// code. You can also put them in separate files and require them here.
|
|
113
|
-
//# sourceMappingURL=simple-main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple-main.js","sourceRoot":"","sources":["../../simple/simple-main.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const tracer_1 = __importDefault(require("tracer"));
|
|
7
|
-
const node_1 = __importDefault(require("@3fv/electron-utility-process-manager/node"));
|
|
8
|
-
const log = tracer_1.default.console();
|
|
9
|
-
node_1.default.addEventHandler((clientId, port, payload) => {
|
|
10
|
-
log.info(`Received event from (${clientId})`, payload);
|
|
11
|
-
return true;
|
|
12
|
-
});
|
|
13
|
-
node_1.default.addRequestHandler("ping", async (type, messageId, what) => {
|
|
14
|
-
log.info(`Ping request received (${messageId})`, what);
|
|
15
|
-
return `pong: ${what}`;
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=simple-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple-node.js","sourceRoot":"","sources":["../../simple/simple-node.ts"],"names":[],"mappings":";;;;;AACA,oDAA2B;AAC3B,sFAAuE;AAEvE,MAAM,GAAG,GAAG,gBAAM,CAAC,OAAO,EAAE,CAAA;AAE5B,cAAc,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACzD,GAAG,CAAC,IAAI,CAAC,wBAAwB,QAAQ,GAAG,EAAE,OAAO,CAAC,CAAA;IACtD,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA;AAEF,cAAc,CAAC,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAY,EAAE,EAAE;IAC/E,GAAG,CAAC,IAAI,CAAC,0BAA0B,SAAS,GAAG,EAAE,IAAI,CAAC,CAAA;IACtD,OAAO,SAAS,IAAI,EAAE,CAAA;AACxB,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const renderer_1 = __importDefault(require("@3fv/electron-utility-process-manager/renderer"));
|
|
7
|
-
const tracer_1 = __importDefault(require("tracer"));
|
|
8
|
-
const log = tracer_1.default.colorConsole();
|
|
9
|
-
document.querySelector("#root").innerHTML = `simple-renderer-example`;
|
|
10
|
-
async function simpleExampleUPM() {
|
|
11
|
-
const client = await renderer_1.default.createClient("simple", `${process.type}-01`);
|
|
12
|
-
const result = await client.executeRequest("ping", process.type);
|
|
13
|
-
log.info(`Result: ${result}`);
|
|
14
|
-
}
|
|
15
|
-
simpleExampleUPM()
|
|
16
|
-
.catch(err => log.error(`renderer error: ${err.message}`, err));
|
|
17
|
-
//# sourceMappingURL=simple-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple-renderer.js","sourceRoot":"","sources":["../../simple/simple-renderer.ts"],"names":[],"mappings":";;;;;AAAA,8FAAqF;AACrF,oDAA2B;AAE3B,MAAM,GAAG,GAAG,gBAAM,CAAC,YAAY,EAAE,CAAA;AAEjC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,SAAS,GAAG,yBAAyB,CAAA;AAErE,KAAK,UAAU,gBAAgB;IAC7B,MAAM,MAAM,GAAG,MAAM,kBAAwB,CAAC,YAAY,CAAC,QAAQ,EAAC,GAAG,OAAO,CAAC,IAAI,KAAK,CAAC,CAAA;IACzF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;IAChE,GAAG,CAAC,IAAI,CAAC,WAAW,MAAM,EAAE,CAAC,CAAA;AAC/B,CAAC;AAED,gBAAgB,EAAE;KACf,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC,CAAA"}
|
package/jest.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const { defaults: tsjPreset } = require('ts-jest/presets');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
verbose: true,
|
|
6
|
-
testMatch: ["**/lib/cjs/**/*.spec.js"],
|
|
7
|
-
moduleDirectories: [
|
|
8
|
-
"node_modules",
|
|
9
|
-
"lib/cjs"
|
|
10
|
-
],
|
|
11
|
-
|
|
12
|
-
transform: {
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
moduleFileExtensions: [
|
|
16
|
-
"ts",
|
|
17
|
-
"tsx",
|
|
18
|
-
"js"
|
|
19
|
-
]
|
|
20
|
-
}
|