@aiot-nexus/plugin-sdk 2.0.2 → 2.1.0
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 +18 -8
- package/dev-host/main.js +134 -7
- package/dev-host/plugin-host.js +1 -427
- package/dist/.generated/plugin-framework-version.d.ts +1 -1
- package/dist/.generated/plugin-framework-version.js +1 -1
- package/dist/.generated/plugin-manifest.schema.json +1 -1
- package/dist/internal/src-electron/main/core/runtime-result.js +42 -0
- package/dist/internal/src-electron/main/plugins/plugin-electron-facade-broker.js +890 -0
- package/dist/internal/src-electron/plugin-host-bootstrap.js +417 -0
- package/dist/internal/src-electron/shared/contracts.js +2 -0
- package/dist/internal/src-electron/shared/plugin-electron-facade-client.js +181 -0
- package/dist/internal/src-electron/shared/plugin-electron-facade-descriptors.js +70 -0
- package/dist/internal/src-electron/shared/plugin-electron-facade.js +243 -0
- package/dist/internal/src-electron/shared/plugin-rpc.js +245 -0
- package/dist/src/electron-facade.d.ts +4 -0
- package/dist/src/electron-facade.js +56 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +2 -1
- package/dist/src/nexus-dev.js +5 -4
- package/dist/src/scaffold.js +2 -2
- package/dist/src/types.d.ts +86 -2
- package/dist/src/web-dev.js +2 -2
- package/package.json +7 -2
- package/templates/minimal/README.md.tmpl +35 -2
- package/templates/minimal/src/main.ts.tmpl +2 -1
- package/templates/sqlite/README.md.tmpl +30 -2
- package/templates/sqlite/src/better-sqlite3.d.ts +12 -1
- package/templates/sqlite/src/main.ts.tmpl +939 -124
- package/templates/sqlite/src/renderer/app.ts.tmpl +688 -181
- package/templates/sqlite/src/renderer/index.html +40 -22
- package/templates/sqlite/src/renderer/plugin.css +302 -90
package/dev-host/plugin-host.js
CHANGED
|
@@ -1,430 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const protocolVersion = 2;
|
|
7
|
-
const operationPattern = /^[a-z][A-Za-z0-9]*(?:\.[a-z][A-Za-z0-9]*){1,4}$/;
|
|
8
|
-
const implementedPermissions = new Set(["businessLog", "settings"]);
|
|
9
|
-
const routeGuardPermissions = new Set(["filesystem", "udp", "serial", "dialog"]);
|
|
10
|
-
const port = process.parentPort;
|
|
11
|
-
|
|
12
|
-
if (!port) {
|
|
13
|
-
process.stderr.write("[nexus-plugin-dev-worker] utility process parent port is unavailable.\n");
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const operations = new Map();
|
|
18
|
-
const pendingHostRequests = new Map();
|
|
19
|
-
const inFlightOperations = new Set();
|
|
20
|
-
let initialized = false;
|
|
21
|
-
let ready = false;
|
|
22
|
-
let shuttingDown = false;
|
|
23
|
-
let exiting = false;
|
|
24
|
-
let pluginId = "";
|
|
25
|
-
let pluginDirectory = "";
|
|
26
|
-
let pluginDataDirectory = "";
|
|
27
|
-
let manifest;
|
|
28
|
-
let hostVersion = "";
|
|
29
|
-
let hostApiVersion = "";
|
|
30
|
-
let pluginModule;
|
|
31
|
-
let requestSequence = 0;
|
|
32
|
-
|
|
33
|
-
port.on("message", function handleParentMessage(event) {
|
|
34
|
-
void handleMessage(readMessageData(event));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
process.once("uncaughtException", function handleUncaughtException(error) {
|
|
38
|
-
failProcess(errorMessage(error));
|
|
39
|
-
});
|
|
40
|
-
process.once("unhandledRejection", function handleUnhandledRejection(reason) {
|
|
41
|
-
failProcess(errorMessage(reason));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
async function handleMessage(message) {
|
|
45
|
-
if (exiting || !isRecord(message) || message.protocolVersion !== protocolVersion || typeof message.type !== "string") {
|
|
46
|
-
if (!exiting) {
|
|
47
|
-
failProcess("Plugin worker RPC message is invalid.");
|
|
48
|
-
}
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (message.type === "initialize") {
|
|
52
|
-
await initialize(message);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (message.type === "hostResult") {
|
|
56
|
-
handleHostResult(message);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (message.type === "invoke") {
|
|
60
|
-
await invokeTracked(message);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (message.type === "shutdown") {
|
|
64
|
-
await shutdown(message);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
failProcess("Plugin worker RPC message direction is invalid.");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function initialize(message) {
|
|
71
|
-
if (initialized || shuttingDown || !isWorkerRequestId(message.requestId) || !isRecord(message.payload)) {
|
|
72
|
-
failProcess("Plugin worker initialize request is invalid.");
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const payload = message.payload;
|
|
76
|
-
if (typeof payload.pluginId !== "string"
|
|
77
|
-
|| typeof payload.pluginDirectory !== "string"
|
|
78
|
-
|| typeof payload.pluginDataDirectory !== "string"
|
|
79
|
-
|| !isRecord(payload.manifest)
|
|
80
|
-
|| typeof payload.hostVersion !== "string"
|
|
81
|
-
|| typeof payload.hostApiVersion !== "string") {
|
|
82
|
-
failProcess("Plugin worker initialize payload is invalid.");
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
initialized = true;
|
|
86
|
-
pluginId = payload.pluginId;
|
|
87
|
-
pluginDirectory = payload.pluginDirectory;
|
|
88
|
-
pluginDataDirectory = payload.pluginDataDirectory;
|
|
89
|
-
manifest = payload.manifest;
|
|
90
|
-
hostVersion = payload.hostVersion;
|
|
91
|
-
hostApiVersion = payload.hostApiVersion;
|
|
92
|
-
try {
|
|
93
|
-
if (typeof manifest.mainEntry !== "string" || !manifest.mainEntry) {
|
|
94
|
-
throw new Error("Plugin manifest does not declare mainEntry.");
|
|
95
|
-
}
|
|
96
|
-
const mainEntryPath = path.resolve(pluginDirectory, manifest.mainEntry);
|
|
97
|
-
pluginModule = require(mainEntryPath);
|
|
98
|
-
const activate = typeof pluginModule.activate === "function"
|
|
99
|
-
? pluginModule.activate
|
|
100
|
-
: pluginModule.default && typeof pluginModule.default.activate === "function"
|
|
101
|
-
? pluginModule.default.activate
|
|
102
|
-
: undefined;
|
|
103
|
-
if (activate) {
|
|
104
|
-
await activate({
|
|
105
|
-
pluginId,
|
|
106
|
-
pluginDirectory,
|
|
107
|
-
manifest,
|
|
108
|
-
host: createHostApi()
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
if (exiting || shuttingDown) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
ready = true;
|
|
115
|
-
post({
|
|
116
|
-
protocolVersion,
|
|
117
|
-
type: "ready",
|
|
118
|
-
requestId: message.requestId,
|
|
119
|
-
payload: {
|
|
120
|
-
operations: Array.from(operations.keys()),
|
|
121
|
-
activatedAtUtc: new Date().toISOString()
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
} catch (error) {
|
|
125
|
-
failProcess(errorMessage(error));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
async function invoke(message) {
|
|
130
|
-
if (!isWorkerRequestId(message.requestId) || !isRecord(message.payload)) {
|
|
131
|
-
failProcess("Plugin worker invoke request is invalid.");
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (!ready || shuttingDown) {
|
|
135
|
-
sendResult(message.requestId, fail("PluginWorkerNotReady", "Plugin worker is not ready."));
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const payload = message.payload;
|
|
139
|
-
if (typeof payload.operation !== "string" || !isSafeOperationName(payload.operation)) {
|
|
140
|
-
sendResult(message.requestId, fail("InvalidRequest", "Plugin renderer operation name is invalid."));
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const handler = operations.get(payload.operation);
|
|
144
|
-
if (!handler) {
|
|
145
|
-
sendResult(message.requestId, fail("NotFound", "Plugin renderer operation was not registered.", { operation: payload.operation }));
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
try {
|
|
149
|
-
const value = await handler({
|
|
150
|
-
pluginId,
|
|
151
|
-
surface: payload.surface,
|
|
152
|
-
contributionId: payload.contributionId,
|
|
153
|
-
operation: payload.operation,
|
|
154
|
-
input: isRecord(payload.input) ? payload.input : undefined
|
|
155
|
-
});
|
|
156
|
-
sendResult(message.requestId, normalizeResult(value));
|
|
157
|
-
} catch (error) {
|
|
158
|
-
sendResult(message.requestId, fail("UnexpectedFailure", "Plugin renderer operation failed.", {
|
|
159
|
-
pluginId,
|
|
160
|
-
operation: payload.operation,
|
|
161
|
-
message: errorMessage(error)
|
|
162
|
-
}));
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async function invokeTracked(message) {
|
|
167
|
-
const operation = invoke(message);
|
|
168
|
-
inFlightOperations.add(operation);
|
|
169
|
-
try {
|
|
170
|
-
await operation;
|
|
171
|
-
} finally {
|
|
172
|
-
inFlightOperations.delete(operation);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
async function shutdown(message) {
|
|
177
|
-
if (shuttingDown || !isWorkerRequestId(message.requestId)) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
shuttingDown = true;
|
|
181
|
-
try {
|
|
182
|
-
await Promise.allSettled(Array.from(inFlightOperations));
|
|
183
|
-
const deactivate = pluginModule && (typeof pluginModule.deactivate === "function"
|
|
184
|
-
? pluginModule.deactivate
|
|
185
|
-
: pluginModule.default && typeof pluginModule.default.deactivate === "function"
|
|
186
|
-
? pluginModule.default.deactivate
|
|
187
|
-
: undefined);
|
|
188
|
-
if (deactivate) {
|
|
189
|
-
await deactivate(isRecord(message.payload) && typeof message.payload.reason === "string" ? message.payload.reason : "quit");
|
|
190
|
-
}
|
|
191
|
-
sendResult(message.requestId, ok(true));
|
|
192
|
-
} catch (error) {
|
|
193
|
-
sendResult(message.requestId, fail("UnexpectedFailure", "Plugin shutdown failed.", errorMessage(error)));
|
|
194
|
-
}
|
|
195
|
-
disposePendingRequests();
|
|
196
|
-
setImmediate(function exitAfterShutdown() {
|
|
197
|
-
exiting = true;
|
|
198
|
-
process.exit(0);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function createHostApi() {
|
|
203
|
-
function unsupported(permission) {
|
|
204
|
-
const target = {
|
|
205
|
-
permission,
|
|
206
|
-
supportState: permissionSupportState(permission),
|
|
207
|
-
describe: function describe() {
|
|
208
|
-
return requestHost("getCapabilityStatus", { permission });
|
|
209
|
-
},
|
|
210
|
-
unsupported: function unsupportedOperation(operation) {
|
|
211
|
-
return requestHost("unsupportedCapability", {
|
|
212
|
-
permission,
|
|
213
|
-
...(typeof operation === "string" ? { operation } : {})
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
return new Proxy(target, {
|
|
218
|
-
get: function get(apiTarget, property) {
|
|
219
|
-
if (property in apiTarget) {
|
|
220
|
-
return Reflect.get(apiTarget, property);
|
|
221
|
-
}
|
|
222
|
-
if (typeof property === "symbol" || property === "then") {
|
|
223
|
-
return undefined;
|
|
224
|
-
}
|
|
225
|
-
return function callUnsupportedOperation() {
|
|
226
|
-
return apiTarget.unsupported(property);
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return {
|
|
233
|
-
hostVersion,
|
|
234
|
-
hostApiVersion,
|
|
235
|
-
pluginId,
|
|
236
|
-
pluginDataDirectory,
|
|
237
|
-
hasPermission: function hasPermission(permission) {
|
|
238
|
-
return Array.isArray(manifest.permissions) && manifest.permissions.includes(permission);
|
|
239
|
-
},
|
|
240
|
-
registerRendererMethod: async function registerRendererMethod(name, handler) {
|
|
241
|
-
if (!isSafeOperationName(name) || typeof handler !== "function") {
|
|
242
|
-
return fail("InvalidRequest", "Plugin renderer operation registration is invalid.");
|
|
243
|
-
}
|
|
244
|
-
if (operations.has(name)) {
|
|
245
|
-
return fail("InvalidRequest", "Plugin renderer operation is already registered.");
|
|
246
|
-
}
|
|
247
|
-
operations.set(name, handler);
|
|
248
|
-
return ok(true);
|
|
249
|
-
},
|
|
250
|
-
getCapabilityStatus: function getCapabilityStatus(permission) {
|
|
251
|
-
return requestHost("getCapabilityStatus", { permission: typeof permission === "string" ? permission : String(permission) });
|
|
252
|
-
},
|
|
253
|
-
unsupportedCapability: function unsupportedCapability(permission, operation) {
|
|
254
|
-
return requestHost("unsupportedCapability", {
|
|
255
|
-
permission: typeof permission === "string" ? permission : String(permission),
|
|
256
|
-
...(typeof operation === "string" ? { operation } : {})
|
|
257
|
-
});
|
|
258
|
-
},
|
|
259
|
-
log: function log(level, message, exception) {
|
|
260
|
-
return requestHost("log", { level, message, ...(exception ? { exception } : {}) });
|
|
261
|
-
},
|
|
262
|
-
getSettings: function getSettings() {
|
|
263
|
-
return requestHost("getSettings");
|
|
264
|
-
},
|
|
265
|
-
updateSettings: function updateSettings(values) {
|
|
266
|
-
return requestHost("updateSettings", { values: sanitizeJsonValue(values) });
|
|
267
|
-
},
|
|
268
|
-
filesystem: unsupported("filesystem"),
|
|
269
|
-
udp: unsupported("udp"),
|
|
270
|
-
serial: unsupported("serial"),
|
|
271
|
-
dialog: unsupported("dialog"),
|
|
272
|
-
externalProcess: unsupported("externalProcess")
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function requestHost(method, params) {
|
|
277
|
-
if (exiting) {
|
|
278
|
-
return Promise.resolve(fail("PluginWorkerExited", "Plugin worker is stopping."));
|
|
279
|
-
}
|
|
280
|
-
const requestId = pluginId + "-host-" + String(++requestSequence);
|
|
281
|
-
return new Promise(function waitForHostResult(resolve, reject) {
|
|
282
|
-
pendingHostRequests.set(requestId, { resolve, reject });
|
|
283
|
-
try {
|
|
284
|
-
post({
|
|
285
|
-
protocolVersion,
|
|
286
|
-
type: "hostRequest",
|
|
287
|
-
requestId,
|
|
288
|
-
payload: { method, ...(params ? { params: sanitizeJsonValue(params) } : {}) }
|
|
289
|
-
});
|
|
290
|
-
} catch (error) {
|
|
291
|
-
pendingHostRequests.delete(requestId);
|
|
292
|
-
reject(error);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function handleHostResult(message) {
|
|
298
|
-
if (!isWorkerRequestId(message.requestId) || !isNexusResult(message.result)) {
|
|
299
|
-
failProcess("Plugin worker Host API result is invalid.");
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
const pending = pendingHostRequests.get(message.requestId);
|
|
303
|
-
if (!pending) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
pendingHostRequests.delete(message.requestId);
|
|
307
|
-
pending.resolve(message.result);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function sendResult(requestId, result) {
|
|
311
|
-
post({ protocolVersion, type: "result", requestId, result: normalizeResult(result) });
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function post(message) {
|
|
315
|
-
port.postMessage(message);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function failProcess(message) {
|
|
319
|
-
if (exiting) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
exiting = true;
|
|
323
|
-
try {
|
|
324
|
-
post({ protocolVersion, type: "fatal", payload: { message: message || "Plugin worker failed." } });
|
|
325
|
-
} catch {
|
|
326
|
-
// The parent may already be gone.
|
|
327
|
-
}
|
|
328
|
-
disposePendingRequests();
|
|
329
|
-
setImmediate(function exitAfterFatal() {
|
|
330
|
-
process.exit(1);
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function disposePendingRequests() {
|
|
335
|
-
const result = fail("PluginWorkerExited", "Plugin worker stopped.");
|
|
336
|
-
for (const pending of pendingHostRequests.values()) {
|
|
337
|
-
pending.resolve(result);
|
|
338
|
-
}
|
|
339
|
-
pendingHostRequests.clear();
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function normalizeResult(value) {
|
|
343
|
-
if (isNexusResult(value)) {
|
|
344
|
-
if (value.ok) {
|
|
345
|
-
return ok(sanitizeJsonValue(value.value));
|
|
346
|
-
}
|
|
347
|
-
return fail(value.error.code, value.error.message, value.error.details === undefined ? undefined : sanitizeJsonValue(value.error.details));
|
|
348
|
-
}
|
|
349
|
-
return ok(sanitizeJsonValue(value));
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
function ok(value) {
|
|
353
|
-
return { ok: true, value: sanitizeJsonValue(value) };
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function fail(code, message, details) {
|
|
357
|
-
return {
|
|
358
|
-
ok: false,
|
|
359
|
-
error: {
|
|
360
|
-
code,
|
|
361
|
-
message,
|
|
362
|
-
...(details === undefined ? {} : { details: sanitizeJsonValue(details) })
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
function isNexusResult(value) {
|
|
368
|
-
if (!isRecord(value) || typeof value.ok !== "boolean") {
|
|
369
|
-
return false;
|
|
370
|
-
}
|
|
371
|
-
return value.ok
|
|
372
|
-
? Object.prototype.hasOwnProperty.call(value, "value")
|
|
373
|
-
: isRecord(value.error) && typeof value.error.code === "string" && typeof value.error.message === "string";
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function isWorkerRequestId(value) {
|
|
377
|
-
return typeof value === "string"
|
|
378
|
-
&& value.length > 0
|
|
379
|
-
&& value.length <= 128
|
|
380
|
-
&& /^[A-Za-z0-9._:-]+$/.test(value);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function isSafeOperationName(value) {
|
|
384
|
-
return typeof value === "string"
|
|
385
|
-
&& value.length <= 80
|
|
386
|
-
&& operationPattern.test(value)
|
|
387
|
-
&& value.split(".").every(function isSafePart(part) {
|
|
388
|
-
return part !== "constructor" && part !== "prototype" && part !== "__proto__";
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function permissionSupportState(permission) {
|
|
393
|
-
if (implementedPermissions.has(permission)) {
|
|
394
|
-
return "implemented";
|
|
395
|
-
}
|
|
396
|
-
if (routeGuardPermissions.has(permission)) {
|
|
397
|
-
return "routeGuard";
|
|
398
|
-
}
|
|
399
|
-
return "reserved";
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function sanitizeJsonValue(value) {
|
|
403
|
-
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
404
|
-
return value;
|
|
405
|
-
}
|
|
406
|
-
if (typeof value === "number") {
|
|
407
|
-
return Number.isFinite(value) ? value : null;
|
|
408
|
-
}
|
|
409
|
-
if (Array.isArray(value)) {
|
|
410
|
-
return value.map(sanitizeJsonValue);
|
|
411
|
-
}
|
|
412
|
-
if (isRecord(value)) {
|
|
413
|
-
return Object.fromEntries(Object.entries(value)
|
|
414
|
-
.filter(function removeUndefined(entry) { return entry[1] !== undefined; })
|
|
415
|
-
.map(function sanitizeEntry(entry) { return [entry[0], sanitizeJsonValue(entry[1])]; }));
|
|
416
|
-
}
|
|
417
|
-
return null;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function isRecord(value) {
|
|
421
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
function readMessageData(event) {
|
|
425
|
-
return isRecord(event) && Object.prototype.hasOwnProperty.call(event, "data") ? event.data : event;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
function errorMessage(error) {
|
|
429
|
-
return error instanceof Error ? error.message : String(error);
|
|
430
|
-
}
|
|
4
|
+
require("../dist/internal/src-electron/plugin-host-bootstrap.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PLUGIN_FRAMEWORK_VERSION = "2.
|
|
1
|
+
export declare const PLUGIN_FRAMEWORK_VERSION = "2.1.0";
|
|
2
2
|
export declare const PLUGIN_MANIFEST_SCHEMA_VERSION = 1;
|
|
3
3
|
export declare const PLUGIN_COMPATIBLE_VERSION_PATTERN = "^(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))?(\\.(0|[1-9][0-9]*))?$";
|
|
4
4
|
export interface ParsedPluginVersion {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPluginFrameworkVersionCompatible = exports.comparePluginVersions = exports.parsePluginCompatibleVersion = exports.PLUGIN_COMPATIBLE_VERSION_PATTERN = exports.PLUGIN_MANIFEST_SCHEMA_VERSION = exports.PLUGIN_FRAMEWORK_VERSION = void 0;
|
|
4
|
-
exports.PLUGIN_FRAMEWORK_VERSION = "2.
|
|
4
|
+
exports.PLUGIN_FRAMEWORK_VERSION = "2.1.0";
|
|
5
5
|
exports.PLUGIN_MANIFEST_SCHEMA_VERSION = 1;
|
|
6
6
|
exports.PLUGIN_COMPATIBLE_VERSION_PATTERN = "^(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))?(\\.(0|[1-9][0-9]*))?$";
|
|
7
7
|
function parsePluginCompatibleVersion(value) {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"permissions": {
|
|
34
34
|
"type": "array",
|
|
35
35
|
"items": {
|
|
36
|
-
"enum": ["businessLog", "settings", "filesystem", "udp", "serial", "externalProcess", "dialog"]
|
|
36
|
+
"enum": ["businessLog", "settings", "filesystem", "udp", "serial", "externalProcess", "dialog", "electronHostControl"]
|
|
37
37
|
},
|
|
38
38
|
"uniqueItems": true
|
|
39
39
|
},
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fail = exports.ok = exports.StatusCodes = void 0;
|
|
4
|
+
exports.StatusCodes = {
|
|
5
|
+
InvalidRequest: "InvalidRequest",
|
|
6
|
+
NotFound: "NotFound",
|
|
7
|
+
UnexpectedFailure: "UnexpectedFailure",
|
|
8
|
+
ExternalAppDefinitionMissing: "ExternalAppDefinitionMissing",
|
|
9
|
+
ExternalAppDisabled: "ExternalAppDisabled",
|
|
10
|
+
ExternalAppLaunchSettingsMissing: "ExternalAppLaunchSettingsMissing",
|
|
11
|
+
ExternalAppExecutableNotConfigured: "ExternalAppExecutableNotConfigured",
|
|
12
|
+
ExternalAppExecutableInvalid: "ExternalAppExecutableInvalid",
|
|
13
|
+
ExternalAppExecutableMissing: "ExternalAppExecutableMissing",
|
|
14
|
+
ExternalAppWorkingDirectoryInvalid: "ExternalAppWorkingDirectoryInvalid",
|
|
15
|
+
ExternalAppWorkingDirectoryMissing: "ExternalAppWorkingDirectoryMissing",
|
|
16
|
+
ExternalAppStartFailed: "ExternalAppStartFailed",
|
|
17
|
+
DirectoryMissing: "DirectoryMissing",
|
|
18
|
+
PluginBlocked: "PluginBlocked",
|
|
19
|
+
PluginManifestInvalid: "PluginManifestInvalid",
|
|
20
|
+
PluginIncompatible: "PluginIncompatible",
|
|
21
|
+
PluginPermissionDenied: "PluginPermissionDenied",
|
|
22
|
+
PluginCapabilityUnsupported: "PluginCapabilityUnsupported",
|
|
23
|
+
PluginMainEntryFailed: "PluginMainEntryFailed",
|
|
24
|
+
ToolFileReadFailed: "ToolFileReadFailed",
|
|
25
|
+
XxbpDeferred: "XxbpDeferred",
|
|
26
|
+
XxbpInvalidRemotePath: "XxbpInvalidRemotePath",
|
|
27
|
+
XxbpToolUnavailable: "XxbpToolUnavailable",
|
|
28
|
+
XxbpCommandFailed: "XxbpCommandFailed",
|
|
29
|
+
XxbpCommandTimeout: "XxbpCommandTimeout",
|
|
30
|
+
XxbpOperationCancelled: "XxbpOperationCancelled",
|
|
31
|
+
XxbpDevicesSessionMissing: "XxbpDevicesSessionMissing",
|
|
32
|
+
XxbpResultFileMissing: "XxbpResultFileMissing",
|
|
33
|
+
XxbpNonTextFile: "XxbpNonTextFile"
|
|
34
|
+
};
|
|
35
|
+
function ok(value) {
|
|
36
|
+
return { ok: true, value };
|
|
37
|
+
}
|
|
38
|
+
exports.ok = ok;
|
|
39
|
+
function fail(code, message, details) {
|
|
40
|
+
return { ok: false, error: { code, message, details } };
|
|
41
|
+
}
|
|
42
|
+
exports.fail = fail;
|