taon 21.0.53 → 21.0.55
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/bin/taon +5 -5
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +4 -4
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/icon-menu-taon.svg +15 -15
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-abstract-entity.js +17 -31
- package/lib-prod/base-classes/base-angular-service.js +83 -55
- package/lib-prod/base-classes/base-class.js +33 -35
- package/lib-prod/base-classes/base-context.js +17 -19
- package/lib-prod/base-classes/base-controller.js +146 -154
- package/lib-prod/base-classes/base-crud-controller.js +250 -221
- package/lib-prod/base-classes/base-custom-repository.js +7 -18
- package/lib-prod/base-classes/base-electron-service.js +49 -0
- package/lib-prod/base-classes/base-entity.js +20 -30
- package/lib-prod/base-classes/base-file-upload.middleware.js +72 -75
- package/lib-prod/base-classes/base-injector.js +176 -194
- package/lib-prod/base-classes/base-middleware.js +8 -5
- package/lib-prod/base-classes/base-migration.js +19 -22
- package/lib-prod/base-classes/base-provider.js +7 -5
- package/lib-prod/base-classes/base-repository.js +601 -573
- package/lib-prod/base-classes/base-subscriber-for-entity.js +143 -152
- package/lib-prod/base-classes/base.js +18 -0
- package/lib-prod/build-info._auto-generated_.js +26 -14
- package/lib-prod/config/controller-config.js +24 -24
- package/lib-prod/config/controller-options.js +2 -5
- package/lib-prod/config/method-config.js +6 -8
- package/lib-prod/config/param-config.js +2 -8
- package/lib-prod/constants.js +29 -25
- package/lib-prod/context-db-migrations.js +328 -324
- package/lib-prod/create-context.js +211 -146
- package/lib-prod/decorators/classes/controller-decorator.js +16 -20
- package/lib-prod/decorators/classes/entity-decorator.js +26 -47
- package/lib-prod/decorators/classes/middleware-decorator.js +14 -24
- package/lib-prod/decorators/classes/migration-decorator.js +13 -22
- package/lib-prod/decorators/classes/provider-decorator.js +13 -23
- package/lib-prod/decorators/classes/repository-decorator.js +13 -22
- package/lib-prod/decorators/classes/subscriber-decorator.js +13 -23
- package/lib-prod/decorators/decorator-abstract-opt.js +1 -4
- package/lib-prod/decorators/http/http-decorators.js +20 -5
- package/lib-prod/decorators/http/http-methods-decorators.js +91 -133
- package/lib-prod/decorators/http/http-params-decorators.js +36 -62
- package/lib-prod/dependency-injection/di-container.js +28 -29
- package/lib-prod/endpoint-context-storage.js +27 -32
- package/lib-prod/endpoint-context.js +2294 -1930
- package/lib-prod/entity-process.js +209 -198
- package/lib-prod/env/env.angular-node-app.js +66 -130
- package/lib-prod/env/env.docs-webapp.js +66 -130
- package/lib-prod/env/env.electron-app.js +66 -130
- package/lib-prod/env/env.mobile-app.js +66 -130
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
- package/lib-prod/env/env.vscode-plugin.js +66 -130
- package/lib-prod/env/index.js +6 -6
- package/lib-prod/express-types.js +1 -0
- package/lib-prod/formly/formly.models.js +1 -0
- package/lib-prod/formly/fromly.js +196 -175
- package/lib-prod/formly/type-from-entity.js +45 -52
- package/lib-prod/get-response-value.js +21 -18
- package/lib-prod/global-state/taon-global-state/index.js +6 -5
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +18 -19
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +6 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +40 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +33 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +43 -33
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +43 -44
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +20 -27
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +10 -10
- package/lib-prod/global-state/taon-transaction-registry/index.js +11 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +20 -21
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +4 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +34 -39
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +34 -54
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +7 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +29 -34
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +20 -27
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +4 -5
- package/lib-prod/helpers/class-helpers.js +210 -177
- package/lib-prod/helpers/clone-obj.js +16 -20
- package/lib-prod/helpers/taon-helpers.js +132 -114
- package/lib-prod/index._auto-generated_.js +5 -0
- package/lib-prod/index.js +248 -227
- package/lib-prod/inject.js +88 -33
- package/lib-prod/migrations/index.js +2 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
- package/lib-prod/models.js +72 -103
- package/lib-prod/orm/columns.js +58 -118
- package/lib-prod/orm/index.js +56 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +188 -186
- package/lib-prod/realtime/realtime-core.js +77 -78
- package/lib-prod/realtime/realtime-server.js +225 -240
- package/lib-prod/realtime/realtime-strategy/index.js +4 -4
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +273 -219
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +267 -240
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +26 -20
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +10 -13
- package/lib-prod/realtime/realtime-subs-manager.js +82 -90
- package/lib-prod/realtime/realtime.models.js +2 -0
- package/lib-prod/symbols.js +104 -105
- package/lib-prod/ui/index.js +1 -5
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -5
- package/lib-prod/validators.js +43 -37
- package/lib-prod.split-namespaces.json +32 -86
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -1,226 +1,280 @@
|
|
|
1
|
-
import { ipcMain } from
|
|
2
|
-
import { Symbols__NS__REALTIME } from
|
|
3
|
-
import { RealtimeStrategy } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
namespace
|
|
27
|
-
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return this.namespacesByName.get(namespace);
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
1
|
+
import { ipcMain } from 'electron'; // @backend
|
|
2
|
+
import { Symbols__NS__REALTIME } from '../../symbols';
|
|
3
|
+
import { RealtimeStrategy } from './realtime-strategy';
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region mock server ipc
|
|
6
|
+
export class MockServerIpc {
|
|
7
|
+
static { this.serverByContextName = new Map(); }
|
|
8
|
+
static from(contextName) {
|
|
9
|
+
if (!MockServerIpc.serverByContextName.has(contextName)) {
|
|
10
|
+
MockServerIpc.serverByContextName.set(contextName, new MockServerIpc(contextName));
|
|
11
|
+
}
|
|
12
|
+
return MockServerIpc.serverByContextName.get(contextName);
|
|
13
|
+
}
|
|
14
|
+
//#region constructor
|
|
15
|
+
constructor(contextName) {
|
|
16
|
+
this.contextName = contextName;
|
|
17
|
+
this.namespacesByName = new Map();
|
|
18
|
+
MockServerIpc.serverByContextName.set(contextName, this);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region of
|
|
22
|
+
of(namespace) {
|
|
23
|
+
if (!this.namespacesByName.has(namespace)) {
|
|
24
|
+
this.namespacesByName.set(namespace, new MockNamespaceIpc(namespace, this));
|
|
25
|
+
}
|
|
26
|
+
return this.namespacesByName.get(namespace);
|
|
27
|
+
}
|
|
33
28
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region mock namespace ipc
|
|
31
|
+
export class MockNamespaceIpc {
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region constructor
|
|
34
|
+
constructor(
|
|
35
|
+
/**
|
|
36
|
+
* Namespace name
|
|
37
|
+
*/
|
|
38
|
+
name, server) {
|
|
39
|
+
this.name = name;
|
|
40
|
+
this.server = server;
|
|
41
|
+
//#region fields & getters
|
|
42
|
+
this.electronClients = new Set();
|
|
43
|
+
this.roomsByRoomName = {};
|
|
44
|
+
this.namespaceEventHandlers = {};
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region on
|
|
48
|
+
on(eventName, callback) {
|
|
49
|
+
//#region @backendFunc
|
|
50
|
+
const listenKey = `(${this.name}) "${eventName}"`;
|
|
51
|
+
if (!this.namespaceEventHandlers[eventName]) {
|
|
52
|
+
this.namespaceEventHandlers[eventName] = new Set();
|
|
53
|
+
}
|
|
54
|
+
this.namespaceEventHandlers[eventName].add(callback);
|
|
55
|
+
ipcMain.on(listenKey, (eventElectron, ...args) => {
|
|
56
|
+
this.electronClients.add(eventElectron.sender);
|
|
57
|
+
const connectionListener = `(${this.name}) "connection"`;
|
|
58
|
+
if (connectionListener === listenKey) {
|
|
59
|
+
callback(this, ...args);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (eventName.includes(`:${Symbols__NS__REALTIME.KEYroomSubscribe}`)) {
|
|
63
|
+
const roomName = args[0];
|
|
64
|
+
this.join(eventElectron.sender, roomName);
|
|
65
|
+
}
|
|
66
|
+
else if (eventName.includes(`:${Symbols__NS__REALTIME.KEYroomUnsubscribe}`)) {
|
|
67
|
+
const roomName = args[0];
|
|
68
|
+
this.leave(eventElectron.sender, roomName);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
callback(...args);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
// this.emit(listenKey); // QUICK_FIX
|
|
76
|
+
//#endregion
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region off
|
|
80
|
+
off(event, callback) {
|
|
81
|
+
//#region @backendFunc
|
|
82
|
+
if (!this.namespaceEventHandlers[event]) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (callback) {
|
|
86
|
+
this.namespaceEventHandlers[event].delete(callback);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
delete this.namespaceEventHandlers[event];
|
|
90
|
+
}
|
|
91
|
+
const removeKey = `(${this.name}) "${event}"`;
|
|
92
|
+
ipcMain.removeListener(removeKey, callback);
|
|
93
|
+
//#endregion
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region emit
|
|
97
|
+
emit(eventName, ...args) {
|
|
98
|
+
//#region @backendFunc
|
|
99
|
+
const sendEventKey = `(${this.name}) "${eventName}"`;
|
|
100
|
+
for (const webContents of this.electronClients) {
|
|
101
|
+
webContents.send(sendEventKey, ...args);
|
|
102
|
+
}
|
|
103
|
+
// const allWindows = Electron.BrowserWindow.getAllWindows();
|
|
104
|
+
// allWindows.forEach((win, index) => {
|
|
105
|
+
// win.webContents.send(sendEventKey, ...args);
|
|
106
|
+
// });
|
|
107
|
+
//#endregion
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region to
|
|
111
|
+
to(roomName) {
|
|
112
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
113
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, true);
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region in
|
|
117
|
+
in(roomName) {
|
|
118
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
119
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, false);
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region join
|
|
123
|
+
join(webContents, roomName) {
|
|
124
|
+
if (!this.roomsByRoomName[roomName]) {
|
|
125
|
+
this.roomsByRoomName[roomName] = new Set();
|
|
67
126
|
}
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
to(roomName) {
|
|
96
|
-
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
97
|
-
return new RoomEmitterIpc(electronClientsInroom, this.name, true);
|
|
98
|
-
}
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region in
|
|
101
|
-
in(roomName) {
|
|
102
|
-
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
103
|
-
return new RoomEmitterIpc(electronClientsInroom, this.name, false);
|
|
104
|
-
}
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region join
|
|
107
|
-
join(webContents, roomName) {
|
|
108
|
-
if (!this.roomsByRoomName[roomName]) {
|
|
109
|
-
this.roomsByRoomName[roomName] = /* @__PURE__ */ new Set();
|
|
110
|
-
}
|
|
111
|
-
this.roomsByRoomName[roomName].add(webContents);
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region leave
|
|
115
|
-
leave(webContents, roomName) {
|
|
116
|
-
if (this.roomsByRoomName[roomName]) {
|
|
117
|
-
this.roomsByRoomName[roomName].delete(webContents);
|
|
118
|
-
if (this.roomsByRoomName[roomName].size === 0) {
|
|
119
|
-
delete this.roomsByRoomName[roomName];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region path
|
|
125
|
-
path() {
|
|
126
|
-
return this.name;
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region get nsp
|
|
130
|
-
get nsp() {
|
|
131
|
-
const self = this;
|
|
132
|
-
return {
|
|
133
|
-
get name() {
|
|
134
|
-
return self.name;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
//#endregion
|
|
127
|
+
this.roomsByRoomName[roomName].add(webContents);
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region leave
|
|
131
|
+
leave(webContents, roomName) {
|
|
132
|
+
if (this.roomsByRoomName[roomName]) {
|
|
133
|
+
this.roomsByRoomName[roomName].delete(webContents);
|
|
134
|
+
if (this.roomsByRoomName[roomName].size === 0) {
|
|
135
|
+
delete this.roomsByRoomName[roomName];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region path
|
|
141
|
+
path() {
|
|
142
|
+
return this.name;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region get nsp
|
|
146
|
+
get nsp() {
|
|
147
|
+
const self = this;
|
|
148
|
+
return {
|
|
149
|
+
get name() {
|
|
150
|
+
return self.name;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
139
154
|
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region room emitter ipc
|
|
140
157
|
class RoomEmitterIpc {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
//#region constructor
|
|
159
|
+
constructor(electronClients,
|
|
160
|
+
/**
|
|
161
|
+
* namespace name
|
|
162
|
+
*/
|
|
163
|
+
name, includeSender = false, sender = null) {
|
|
164
|
+
this.electronClients = electronClients;
|
|
165
|
+
this.name = name;
|
|
166
|
+
this.includeSender = includeSender;
|
|
167
|
+
this.sender = sender;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region emit in room
|
|
171
|
+
emit(eventName, ...args) {
|
|
172
|
+
const emitEvent = `(${this.name}) "${eventName}"`;
|
|
173
|
+
this.electronClients?.forEach(webContents => {
|
|
174
|
+
webContents.send(emitEvent, ...args);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
157
177
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region mock socket ipc
|
|
180
|
+
export class MockSocketIpc {
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region fields & getters / name
|
|
183
|
+
get name() {
|
|
184
|
+
return this.namespaceName;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region constructor
|
|
189
|
+
/**
|
|
190
|
+
* @param namespaceName instead url for ipc
|
|
191
|
+
*/
|
|
192
|
+
constructor(namespaceName) {
|
|
193
|
+
/* */
|
|
194
|
+
/* */
|
|
195
|
+
this.namespaceName = namespaceName;
|
|
196
|
+
//#region fields & getters
|
|
197
|
+
//#region fields & getters / ipc renderer
|
|
198
|
+
/* */
|
|
199
|
+
/* */
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region fields & getters / event handlers by name
|
|
202
|
+
this.socketEventHandlers = {};
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region on
|
|
206
|
+
on(eventName, callback) {
|
|
207
|
+
/* */
|
|
208
|
+
/* */
|
|
209
|
+
/* */
|
|
210
|
+
/* */
|
|
211
|
+
/* */
|
|
212
|
+
/* */
|
|
213
|
+
/* */
|
|
214
|
+
/* */
|
|
215
|
+
/* */
|
|
216
|
+
/* */
|
|
217
|
+
/* */
|
|
218
|
+
/* */
|
|
219
|
+
/* */
|
|
220
|
+
/* */
|
|
221
|
+
/* */
|
|
222
|
+
}
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region off
|
|
225
|
+
off(event, callback) {
|
|
226
|
+
/* */
|
|
227
|
+
/* */
|
|
228
|
+
/* */
|
|
229
|
+
/* */
|
|
230
|
+
/* */
|
|
231
|
+
/* */
|
|
232
|
+
/* */
|
|
233
|
+
/* */
|
|
234
|
+
/* */
|
|
235
|
+
/* */
|
|
236
|
+
/* */
|
|
237
|
+
/* */
|
|
238
|
+
/* */
|
|
239
|
+
/* */
|
|
240
|
+
/* */
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region emit
|
|
244
|
+
emit(event, ...args) {
|
|
245
|
+
/* */
|
|
246
|
+
/* */
|
|
247
|
+
/* */
|
|
248
|
+
}
|
|
193
249
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
250
|
+
//#endregion
|
|
251
|
+
/**
|
|
252
|
+
* Purpose:
|
|
253
|
+
* - backend-browser communication between 2 processes in electron mode
|
|
254
|
+
*/
|
|
255
|
+
export class RealtimeStrategyIpc extends RealtimeStrategy {
|
|
256
|
+
//#region to string
|
|
257
|
+
toString() {
|
|
258
|
+
return 'ipc';
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region constructor
|
|
262
|
+
constructor(ctx) {
|
|
263
|
+
super(ctx);
|
|
264
|
+
this.ctx = ctx;
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region server & io
|
|
268
|
+
ioServer(__, opt) {
|
|
269
|
+
const namespace = opt?.path || '/';
|
|
270
|
+
const server = MockServerIpc.from(this.ctx.contextName);
|
|
271
|
+
return server.of(namespace);
|
|
272
|
+
}
|
|
273
|
+
get ioClient() {
|
|
274
|
+
const clientIo = (__, opt) => {
|
|
275
|
+
const namespace = opt?.path || '/';
|
|
276
|
+
return new MockSocketIpc(namespace);
|
|
277
|
+
};
|
|
278
|
+
return clientIo;
|
|
279
|
+
}
|
|
220
280
|
}
|
|
221
|
-
export {
|
|
222
|
-
MockNamespaceIpc,
|
|
223
|
-
MockServerIpc,
|
|
224
|
-
MockSocketIpc,
|
|
225
|
-
RealtimeStrategyIpc
|
|
226
|
-
};
|