@interopio/browser 3.0.5 → 3.1.1
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/browser.d.ts +312 -2
- package/changelog.md +11 -0
- package/dist/browser.es.js +1780 -437
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.umd.js +1780 -437
- package/dist/browser.umd.js.map +1 -1
- package/dist/browser.umd.min.js +1 -1
- package/package.json +6 -5
package/dist/browser.es.js
CHANGED
|
@@ -13,6 +13,189 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
|
|
16
|
+
function __rest$2(s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function __awaiter$1(thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const defaultConfig = {
|
|
39
|
+
logger: "info",
|
|
40
|
+
gateway: { webPlatform: {} },
|
|
41
|
+
libraries: [],
|
|
42
|
+
exposeAPI: true
|
|
43
|
+
};
|
|
44
|
+
const parseConfig = (config) => {
|
|
45
|
+
var _a, _b, _c;
|
|
46
|
+
const isPlatformInternal = !!((_b = (_a = config === null || config === void 0 ? void 0 : config.gateway) === null || _a === void 0 ? void 0 : _a.webPlatform) === null || _b === void 0 ? void 0 : _b.port);
|
|
47
|
+
const combined = Object.assign({}, defaultConfig, config, { isPlatformInternal });
|
|
48
|
+
if (combined.systemLogger) {
|
|
49
|
+
combined.logger = (_c = combined.systemLogger.level) !== null && _c !== void 0 ? _c : "info";
|
|
50
|
+
}
|
|
51
|
+
return combined;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const checkSingleton = () => {
|
|
55
|
+
const ioConnectBrowserNamespace = window.glue42core || window.iobrowser;
|
|
56
|
+
if (ioConnectBrowserNamespace && ioConnectBrowserNamespace.webStarted) {
|
|
57
|
+
throw new Error("IoConnect Browser has already been started for this application.");
|
|
58
|
+
}
|
|
59
|
+
if (!ioConnectBrowserNamespace) {
|
|
60
|
+
window.iobrowser = { webStarted: true };
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
ioConnectBrowserNamespace.webStarted = true;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const enterprise = (config) => {
|
|
67
|
+
var _a, _b, _c;
|
|
68
|
+
const enterpriseConfig = {
|
|
69
|
+
windows: true,
|
|
70
|
+
layouts: "full",
|
|
71
|
+
appManager: "full",
|
|
72
|
+
channels: true,
|
|
73
|
+
libraries: (_a = config === null || config === void 0 ? void 0 : config.libraries) !== null && _a !== void 0 ? _a : [],
|
|
74
|
+
logger: (_c = (_b = config === null || config === void 0 ? void 0 : config.systemLogger) === null || _b === void 0 ? void 0 : _b.level) !== null && _c !== void 0 ? _c : "warn"
|
|
75
|
+
};
|
|
76
|
+
if (window.glue42gd) {
|
|
77
|
+
return window.Glue(enterpriseConfig);
|
|
78
|
+
}
|
|
79
|
+
return window.Glue(enterpriseConfig);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Wraps values in an `Ok` type.
|
|
84
|
+
*
|
|
85
|
+
* Example: `ok(5) // => {ok: true, result: 5}`
|
|
86
|
+
*/
|
|
87
|
+
var ok$1 = function (result) { return ({ ok: true, result: result }); };
|
|
88
|
+
/**
|
|
89
|
+
* Wraps errors in an `Err` type.
|
|
90
|
+
*
|
|
91
|
+
* Example: `err('on fire') // => {ok: false, error: 'on fire'}`
|
|
92
|
+
*/
|
|
93
|
+
var err$1 = function (error) { return ({ ok: false, error: error }); };
|
|
94
|
+
/**
|
|
95
|
+
* Create a `Promise` that either resolves with the result of `Ok` or rejects
|
|
96
|
+
* with the error of `Err`.
|
|
97
|
+
*/
|
|
98
|
+
var asPromise$1 = function (r) {
|
|
99
|
+
return r.ok === true ? Promise.resolve(r.result) : Promise.reject(r.error);
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Unwraps a `Result` and returns either the result of an `Ok`, or
|
|
103
|
+
* `defaultValue`.
|
|
104
|
+
*
|
|
105
|
+
* Example:
|
|
106
|
+
* ```
|
|
107
|
+
* Result.withDefault(5, number().run(json))
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* It would be nice if `Decoder` had an instance method that mirrored this
|
|
111
|
+
* function. Such a method would look something like this:
|
|
112
|
+
* ```
|
|
113
|
+
* class Decoder<A> {
|
|
114
|
+
* runWithDefault = (defaultValue: A, json: any): A =>
|
|
115
|
+
* Result.withDefault(defaultValue, this.run(json));
|
|
116
|
+
* }
|
|
117
|
+
*
|
|
118
|
+
* number().runWithDefault(5, json)
|
|
119
|
+
* ```
|
|
120
|
+
* Unfortunately, the type of `defaultValue: A` on the method causes issues
|
|
121
|
+
* with type inference on the `object` decoder in some situations. While these
|
|
122
|
+
* inference issues can be solved by providing the optional type argument for
|
|
123
|
+
* `object`s, the extra trouble and confusion doesn't seem worth it.
|
|
124
|
+
*/
|
|
125
|
+
var withDefault$1 = function (defaultValue, r) {
|
|
126
|
+
return r.ok === true ? r.result : defaultValue;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Return the successful result, or throw an error.
|
|
130
|
+
*/
|
|
131
|
+
var withException$1 = function (r) {
|
|
132
|
+
if (r.ok === true) {
|
|
133
|
+
return r.result;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw r.error;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Apply `f` to the result of an `Ok`, or pass the error through.
|
|
141
|
+
*/
|
|
142
|
+
var map$1 = function (f, r) {
|
|
143
|
+
return r.ok === true ? ok$1(f(r.result)) : r;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Apply `f` to the result of two `Ok`s, or pass an error through. If both
|
|
147
|
+
* `Result`s are errors then the first one is returned.
|
|
148
|
+
*/
|
|
149
|
+
var map2$1 = function (f, ar, br) {
|
|
150
|
+
return ar.ok === false ? ar :
|
|
151
|
+
br.ok === false ? br :
|
|
152
|
+
ok$1(f(ar.result, br.result));
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Apply `f` to the error of an `Err`, or pass the success through.
|
|
156
|
+
*/
|
|
157
|
+
var mapError$1 = function (f, r) {
|
|
158
|
+
return r.ok === true ? r : err$1(f(r.error));
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Chain together a sequence of computations that may fail, similar to a
|
|
162
|
+
* `Promise`. If the first computation fails then the error will propagate
|
|
163
|
+
* through. If it succeeds, then `f` will be applied to the value, returning a
|
|
164
|
+
* new `Result`.
|
|
165
|
+
*/
|
|
166
|
+
var andThen$1 = function (f, r) {
|
|
167
|
+
return r.ok === true ? f(r.result) : r;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/*! *****************************************************************************
|
|
171
|
+
Copyright (c) Microsoft Corporation.
|
|
172
|
+
|
|
173
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
174
|
+
purpose with or without fee is hereby granted.
|
|
175
|
+
|
|
176
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
177
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
178
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
179
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
180
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
181
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
182
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
183
|
+
***************************************************************************** */
|
|
184
|
+
/* global Reflect, Promise */
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
var __assign$2 = function() {
|
|
189
|
+
__assign$2 = Object.assign || function __assign(t) {
|
|
190
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
191
|
+
s = arguments[i];
|
|
192
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
193
|
+
}
|
|
194
|
+
return t;
|
|
195
|
+
};
|
|
196
|
+
return __assign$2.apply(this, arguments);
|
|
197
|
+
};
|
|
198
|
+
|
|
16
199
|
function __rest$1(s, e) {
|
|
17
200
|
var t = {};
|
|
18
201
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,59 +208,660 @@ function __rest$1(s, e) {
|
|
|
25
208
|
return t;
|
|
26
209
|
}
|
|
27
210
|
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
211
|
+
function isEqual$1(a, b) {
|
|
212
|
+
if (a === b) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
if (a === null && b === null) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
if (typeof (a) !== typeof (b)) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
if (typeof (a) === 'object') {
|
|
222
|
+
// Array
|
|
223
|
+
if (Array.isArray(a)) {
|
|
224
|
+
if (!Array.isArray(b)) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
if (a.length !== b.length) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
for (var i = 0; i < a.length; i++) {
|
|
231
|
+
if (!isEqual$1(a[i], b[i])) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
// Hash table
|
|
238
|
+
var keys = Object.keys(a);
|
|
239
|
+
if (keys.length !== Object.keys(b).length) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
for (var i = 0; i < keys.length; i++) {
|
|
243
|
+
if (!b.hasOwnProperty(keys[i])) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
if (!isEqual$1(a[keys[i]], b[keys[i]])) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/*
|
|
254
|
+
* Helpers
|
|
255
|
+
*/
|
|
256
|
+
var isJsonArray$1 = function (json) { return Array.isArray(json); };
|
|
257
|
+
var isJsonObject$1 = function (json) {
|
|
258
|
+
return typeof json === 'object' && json !== null && !isJsonArray$1(json);
|
|
259
|
+
};
|
|
260
|
+
var typeString$1 = function (json) {
|
|
261
|
+
switch (typeof json) {
|
|
262
|
+
case 'string':
|
|
263
|
+
return 'a string';
|
|
264
|
+
case 'number':
|
|
265
|
+
return 'a number';
|
|
266
|
+
case 'boolean':
|
|
267
|
+
return 'a boolean';
|
|
268
|
+
case 'undefined':
|
|
269
|
+
return 'undefined';
|
|
270
|
+
case 'object':
|
|
271
|
+
if (json instanceof Array) {
|
|
272
|
+
return 'an array';
|
|
273
|
+
}
|
|
274
|
+
else if (json === null) {
|
|
275
|
+
return 'null';
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
return 'an object';
|
|
279
|
+
}
|
|
280
|
+
default:
|
|
281
|
+
return JSON.stringify(json);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var expectedGot$1 = function (expected, got) {
|
|
285
|
+
return "expected " + expected + ", got " + typeString$1(got);
|
|
286
|
+
};
|
|
287
|
+
var printPath$1 = function (paths) {
|
|
288
|
+
return paths.map(function (path) { return (typeof path === 'string' ? "." + path : "[" + path + "]"); }).join('');
|
|
289
|
+
};
|
|
290
|
+
var prependAt$1 = function (newAt, _a) {
|
|
291
|
+
var at = _a.at, rest = __rest$1(_a, ["at"]);
|
|
292
|
+
return (__assign$2({ at: newAt + (at || '') }, rest));
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Decoders transform json objects with unknown structure into known and
|
|
296
|
+
* verified forms. You can create objects of type `Decoder<A>` with either the
|
|
297
|
+
* primitive decoder functions, such as `boolean()` and `string()`, or by
|
|
298
|
+
* applying higher-order decoders to the primitives, such as `array(boolean())`
|
|
299
|
+
* or `dict(string())`.
|
|
300
|
+
*
|
|
301
|
+
* Each of the decoder functions are available both as a static method on
|
|
302
|
+
* `Decoder` and as a function alias -- for example the string decoder is
|
|
303
|
+
* defined at `Decoder.string()`, but is also aliased to `string()`. Using the
|
|
304
|
+
* function aliases exported with the library is recommended.
|
|
305
|
+
*
|
|
306
|
+
* `Decoder` exposes a number of 'run' methods, which all decode json in the
|
|
307
|
+
* same way, but communicate success and failure in different ways. The `map`
|
|
308
|
+
* and `andThen` methods modify decoders without having to call a 'run' method.
|
|
309
|
+
*
|
|
310
|
+
* Alternatively, the main decoder `run()` method returns an object of type
|
|
311
|
+
* `Result<A, DecoderError>`. This library provides a number of helper
|
|
312
|
+
* functions for dealing with the `Result` type, so you can do all the same
|
|
313
|
+
* things with a `Result` as with the decoder methods.
|
|
314
|
+
*/
|
|
315
|
+
var Decoder$1 = /** @class */ (function () {
|
|
316
|
+
/**
|
|
317
|
+
* The Decoder class constructor is kept private to separate the internal
|
|
318
|
+
* `decode` function from the external `run` function. The distinction
|
|
319
|
+
* between the two functions is that `decode` returns a
|
|
320
|
+
* `Partial<DecoderError>` on failure, which contains an unfinished error
|
|
321
|
+
* report. When `run` is called on a decoder, the relevant series of `decode`
|
|
322
|
+
* calls is made, and then on failure the resulting `Partial<DecoderError>`
|
|
323
|
+
* is turned into a `DecoderError` by filling in the missing information.
|
|
324
|
+
*
|
|
325
|
+
* While hiding the constructor may seem restrictive, leveraging the
|
|
326
|
+
* provided decoder combinators and helper functions such as
|
|
327
|
+
* `andThen` and `map` should be enough to build specialized decoders as
|
|
328
|
+
* needed.
|
|
329
|
+
*/
|
|
330
|
+
function Decoder(decode) {
|
|
331
|
+
var _this = this;
|
|
332
|
+
this.decode = decode;
|
|
333
|
+
/**
|
|
334
|
+
* Run the decoder and return a `Result` with either the decoded value or a
|
|
335
|
+
* `DecoderError` containing the json input, the location of the error, and
|
|
336
|
+
* the error message.
|
|
337
|
+
*
|
|
338
|
+
* Examples:
|
|
339
|
+
* ```
|
|
340
|
+
* number().run(12)
|
|
341
|
+
* // => {ok: true, result: 12}
|
|
342
|
+
*
|
|
343
|
+
* string().run(9001)
|
|
344
|
+
* // =>
|
|
345
|
+
* // {
|
|
346
|
+
* // ok: false,
|
|
347
|
+
* // error: {
|
|
348
|
+
* // kind: 'DecoderError',
|
|
349
|
+
* // input: 9001,
|
|
350
|
+
* // at: 'input',
|
|
351
|
+
* // message: 'expected a string, got 9001'
|
|
352
|
+
* // }
|
|
353
|
+
* // }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
this.run = function (json) {
|
|
357
|
+
return mapError$1(function (error) { return ({
|
|
358
|
+
kind: 'DecoderError',
|
|
359
|
+
input: json,
|
|
360
|
+
at: 'input' + (error.at || ''),
|
|
361
|
+
message: error.message || ''
|
|
362
|
+
}); }, _this.decode(json));
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* Run the decoder as a `Promise`.
|
|
366
|
+
*/
|
|
367
|
+
this.runPromise = function (json) { return asPromise$1(_this.run(json)); };
|
|
368
|
+
/**
|
|
369
|
+
* Run the decoder and return the value on success, or throw an exception
|
|
370
|
+
* with a formatted error string.
|
|
371
|
+
*/
|
|
372
|
+
this.runWithException = function (json) { return withException$1(_this.run(json)); };
|
|
373
|
+
/**
|
|
374
|
+
* Construct a new decoder that applies a transformation to the decoded
|
|
375
|
+
* result. If the decoder succeeds then `f` will be applied to the value. If
|
|
376
|
+
* it fails the error will propagated through.
|
|
377
|
+
*
|
|
378
|
+
* Example:
|
|
379
|
+
* ```
|
|
380
|
+
* number().map(x => x * 5).run(10)
|
|
381
|
+
* // => {ok: true, result: 50}
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
this.map = function (f) {
|
|
385
|
+
return new Decoder(function (json) { return map$1(f, _this.decode(json)); });
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Chain together a sequence of decoders. The first decoder will run, and
|
|
389
|
+
* then the function will determine what decoder to run second. If the result
|
|
390
|
+
* of the first decoder succeeds then `f` will be applied to the decoded
|
|
391
|
+
* value. If it fails the error will propagate through.
|
|
392
|
+
*
|
|
393
|
+
* This is a very powerful method -- it can act as both the `map` and `where`
|
|
394
|
+
* methods, can improve error messages for edge cases, and can be used to
|
|
395
|
+
* make a decoder for custom types.
|
|
396
|
+
*
|
|
397
|
+
* Example of adding an error message:
|
|
398
|
+
* ```
|
|
399
|
+
* const versionDecoder = valueAt(['version'], number());
|
|
400
|
+
* const infoDecoder3 = object({a: boolean()});
|
|
401
|
+
*
|
|
402
|
+
* const decoder = versionDecoder.andThen(version => {
|
|
403
|
+
* switch (version) {
|
|
404
|
+
* case 3:
|
|
405
|
+
* return infoDecoder3;
|
|
406
|
+
* default:
|
|
407
|
+
* return fail(`Unable to decode info, version ${version} is not supported.`);
|
|
408
|
+
* }
|
|
409
|
+
* });
|
|
410
|
+
*
|
|
411
|
+
* decoder.run({version: 3, a: true})
|
|
412
|
+
* // => {ok: true, result: {a: true}}
|
|
413
|
+
*
|
|
414
|
+
* decoder.run({version: 5, x: 'abc'})
|
|
415
|
+
* // =>
|
|
416
|
+
* // {
|
|
417
|
+
* // ok: false,
|
|
418
|
+
* // error: {... message: 'Unable to decode info, version 5 is not supported.'}
|
|
419
|
+
* // }
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* Example of decoding a custom type:
|
|
423
|
+
* ```
|
|
424
|
+
* // nominal type for arrays with a length of at least one
|
|
425
|
+
* type NonEmptyArray<T> = T[] & { __nonEmptyArrayBrand__: void };
|
|
426
|
+
*
|
|
427
|
+
* const nonEmptyArrayDecoder = <T>(values: Decoder<T>): Decoder<NonEmptyArray<T>> =>
|
|
428
|
+
* array(values).andThen(arr =>
|
|
429
|
+
* arr.length > 0
|
|
430
|
+
* ? succeed(createNonEmptyArray(arr))
|
|
431
|
+
* : fail(`expected a non-empty array, got an empty array`)
|
|
432
|
+
* );
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
this.andThen = function (f) {
|
|
436
|
+
return new Decoder(function (json) {
|
|
437
|
+
return andThen$1(function (value) { return f(value).decode(json); }, _this.decode(json));
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Add constraints to a decoder _without_ changing the resulting type. The
|
|
442
|
+
* `test` argument is a predicate function which returns true for valid
|
|
443
|
+
* inputs. When `test` fails on an input, the decoder fails with the given
|
|
444
|
+
* `errorMessage`.
|
|
445
|
+
*
|
|
446
|
+
* ```
|
|
447
|
+
* const chars = (length: number): Decoder<string> =>
|
|
448
|
+
* string().where(
|
|
449
|
+
* (s: string) => s.length === length,
|
|
450
|
+
* `expected a string of length ${length}`
|
|
451
|
+
* );
|
|
452
|
+
*
|
|
453
|
+
* chars(5).run('12345')
|
|
454
|
+
* // => {ok: true, result: '12345'}
|
|
455
|
+
*
|
|
456
|
+
* chars(2).run('HELLO')
|
|
457
|
+
* // => {ok: false, error: {... message: 'expected a string of length 2'}}
|
|
458
|
+
*
|
|
459
|
+
* chars(12).run(true)
|
|
460
|
+
* // => {ok: false, error: {... message: 'expected a string, got a boolean'}}
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
this.where = function (test, errorMessage) {
|
|
464
|
+
return _this.andThen(function (value) { return (test(value) ? Decoder.succeed(value) : Decoder.fail(errorMessage)); });
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Decoder primitive that validates strings, and fails on all other input.
|
|
469
|
+
*/
|
|
470
|
+
Decoder.string = function () {
|
|
471
|
+
return new Decoder(function (json) {
|
|
472
|
+
return typeof json === 'string'
|
|
473
|
+
? ok$1(json)
|
|
474
|
+
: err$1({ message: expectedGot$1('a string', json) });
|
|
475
|
+
});
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Decoder primitive that validates numbers, and fails on all other input.
|
|
479
|
+
*/
|
|
480
|
+
Decoder.number = function () {
|
|
481
|
+
return new Decoder(function (json) {
|
|
482
|
+
return typeof json === 'number'
|
|
483
|
+
? ok$1(json)
|
|
484
|
+
: err$1({ message: expectedGot$1('a number', json) });
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Decoder primitive that validates booleans, and fails on all other input.
|
|
489
|
+
*/
|
|
490
|
+
Decoder.boolean = function () {
|
|
491
|
+
return new Decoder(function (json) {
|
|
492
|
+
return typeof json === 'boolean'
|
|
493
|
+
? ok$1(json)
|
|
494
|
+
: err$1({ message: expectedGot$1('a boolean', json) });
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
Decoder.constant = function (value) {
|
|
498
|
+
return new Decoder(function (json) {
|
|
499
|
+
return isEqual$1(json, value)
|
|
500
|
+
? ok$1(value)
|
|
501
|
+
: err$1({ message: "expected " + JSON.stringify(value) + ", got " + JSON.stringify(json) });
|
|
502
|
+
});
|
|
503
|
+
};
|
|
504
|
+
Decoder.object = function (decoders) {
|
|
505
|
+
return new Decoder(function (json) {
|
|
506
|
+
if (isJsonObject$1(json) && decoders) {
|
|
507
|
+
var obj = {};
|
|
508
|
+
for (var key in decoders) {
|
|
509
|
+
if (decoders.hasOwnProperty(key)) {
|
|
510
|
+
var r = decoders[key].decode(json[key]);
|
|
511
|
+
if (r.ok === true) {
|
|
512
|
+
// tslint:disable-next-line:strict-type-predicates
|
|
513
|
+
if (r.result !== undefined) {
|
|
514
|
+
obj[key] = r.result;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
else if (json[key] === undefined) {
|
|
518
|
+
return err$1({ message: "the key '" + key + "' is required but was not present" });
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
return err$1(prependAt$1("." + key, r.error));
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return ok$1(obj);
|
|
526
|
+
}
|
|
527
|
+
else if (isJsonObject$1(json)) {
|
|
528
|
+
return ok$1(json);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
return err$1({ message: expectedGot$1('an object', json) });
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
Decoder.array = function (decoder) {
|
|
536
|
+
return new Decoder(function (json) {
|
|
537
|
+
if (isJsonArray$1(json) && decoder) {
|
|
538
|
+
var decodeValue_1 = function (v, i) {
|
|
539
|
+
return mapError$1(function (err$$1) { return prependAt$1("[" + i + "]", err$$1); }, decoder.decode(v));
|
|
540
|
+
};
|
|
541
|
+
return json.reduce(function (acc, v, i) {
|
|
542
|
+
return map2$1(function (arr, result) { return arr.concat([result]); }, acc, decodeValue_1(v, i));
|
|
543
|
+
}, ok$1([]));
|
|
544
|
+
}
|
|
545
|
+
else if (isJsonArray$1(json)) {
|
|
546
|
+
return ok$1(json);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
return err$1({ message: expectedGot$1('an array', json) });
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
};
|
|
553
|
+
Decoder.tuple = function (decoders) {
|
|
554
|
+
return new Decoder(function (json) {
|
|
555
|
+
if (isJsonArray$1(json)) {
|
|
556
|
+
if (json.length !== decoders.length) {
|
|
557
|
+
return err$1({
|
|
558
|
+
message: "expected a tuple of length " + decoders.length + ", got one of length " + json.length
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
var result = [];
|
|
562
|
+
for (var i = 0; i < decoders.length; i++) {
|
|
563
|
+
var nth = decoders[i].decode(json[i]);
|
|
564
|
+
if (nth.ok) {
|
|
565
|
+
result[i] = nth.result;
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
return err$1(prependAt$1("[" + i + "]", nth.error));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return ok$1(result);
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
return err$1({ message: expectedGot$1("a tuple of length " + decoders.length, json) });
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
Decoder.union = function (ad, bd) {
|
|
579
|
+
var decoders = [];
|
|
580
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
581
|
+
decoders[_i - 2] = arguments[_i];
|
|
582
|
+
}
|
|
583
|
+
return Decoder.oneOf.apply(Decoder, [ad, bd].concat(decoders));
|
|
584
|
+
};
|
|
585
|
+
Decoder.intersection = function (ad, bd) {
|
|
586
|
+
var ds = [];
|
|
587
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
588
|
+
ds[_i - 2] = arguments[_i];
|
|
589
|
+
}
|
|
590
|
+
return new Decoder(function (json) {
|
|
591
|
+
return [ad, bd].concat(ds).reduce(function (acc, decoder) { return map2$1(Object.assign, acc, decoder.decode(json)); }, ok$1({}));
|
|
592
|
+
});
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* Escape hatch to bypass validation. Always succeeds and types the result as
|
|
596
|
+
* `any`. Useful for defining decoders incrementally, particularly for
|
|
597
|
+
* complex objects.
|
|
598
|
+
*
|
|
599
|
+
* Example:
|
|
600
|
+
* ```
|
|
601
|
+
* interface User {
|
|
602
|
+
* name: string;
|
|
603
|
+
* complexUserData: ComplexType;
|
|
604
|
+
* }
|
|
605
|
+
*
|
|
606
|
+
* const userDecoder: Decoder<User> = object({
|
|
607
|
+
* name: string(),
|
|
608
|
+
* complexUserData: anyJson()
|
|
609
|
+
* });
|
|
610
|
+
* ```
|
|
611
|
+
*/
|
|
612
|
+
Decoder.anyJson = function () { return new Decoder(function (json) { return ok$1(json); }); };
|
|
613
|
+
/**
|
|
614
|
+
* Decoder identity function which always succeeds and types the result as
|
|
615
|
+
* `unknown`.
|
|
616
|
+
*/
|
|
617
|
+
Decoder.unknownJson = function () {
|
|
618
|
+
return new Decoder(function (json) { return ok$1(json); });
|
|
619
|
+
};
|
|
620
|
+
/**
|
|
621
|
+
* Decoder for json objects where the keys are unknown strings, but the values
|
|
622
|
+
* should all be of the same type.
|
|
623
|
+
*
|
|
624
|
+
* Example:
|
|
625
|
+
* ```
|
|
626
|
+
* dict(number()).run({chocolate: 12, vanilla: 10, mint: 37});
|
|
627
|
+
* // => {ok: true, result: {chocolate: 12, vanilla: 10, mint: 37}}
|
|
628
|
+
* ```
|
|
629
|
+
*/
|
|
630
|
+
Decoder.dict = function (decoder) {
|
|
631
|
+
return new Decoder(function (json) {
|
|
632
|
+
if (isJsonObject$1(json)) {
|
|
633
|
+
var obj = {};
|
|
634
|
+
for (var key in json) {
|
|
635
|
+
if (json.hasOwnProperty(key)) {
|
|
636
|
+
var r = decoder.decode(json[key]);
|
|
637
|
+
if (r.ok === true) {
|
|
638
|
+
obj[key] = r.result;
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
return err$1(prependAt$1("." + key, r.error));
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
return ok$1(obj);
|
|
646
|
+
}
|
|
647
|
+
else {
|
|
648
|
+
return err$1({ message: expectedGot$1('an object', json) });
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
};
|
|
652
|
+
/**
|
|
653
|
+
* Decoder for values that may be `undefined`. This is primarily helpful for
|
|
654
|
+
* decoding interfaces with optional fields.
|
|
655
|
+
*
|
|
656
|
+
* Example:
|
|
657
|
+
* ```
|
|
658
|
+
* interface User {
|
|
659
|
+
* id: number;
|
|
660
|
+
* isOwner?: boolean;
|
|
661
|
+
* }
|
|
662
|
+
*
|
|
663
|
+
* const decoder: Decoder<User> = object({
|
|
664
|
+
* id: number(),
|
|
665
|
+
* isOwner: optional(boolean())
|
|
666
|
+
* });
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
Decoder.optional = function (decoder) {
|
|
670
|
+
return new Decoder(function (json) { return (json === undefined || json === null ? ok$1(undefined) : decoder.decode(json)); });
|
|
671
|
+
};
|
|
672
|
+
/**
|
|
673
|
+
* Decoder that attempts to run each decoder in `decoders` and either succeeds
|
|
674
|
+
* with the first successful decoder, or fails after all decoders have failed.
|
|
675
|
+
*
|
|
676
|
+
* Note that `oneOf` expects the decoders to all have the same return type,
|
|
677
|
+
* while `union` creates a decoder for the union type of all the input
|
|
678
|
+
* decoders.
|
|
679
|
+
*
|
|
680
|
+
* Examples:
|
|
681
|
+
* ```
|
|
682
|
+
* oneOf(string(), number().map(String))
|
|
683
|
+
* oneOf(constant('start'), constant('stop'), succeed('unknown'))
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
Decoder.oneOf = function () {
|
|
687
|
+
var decoders = [];
|
|
688
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
689
|
+
decoders[_i] = arguments[_i];
|
|
690
|
+
}
|
|
691
|
+
return new Decoder(function (json) {
|
|
692
|
+
var errors = [];
|
|
693
|
+
for (var i = 0; i < decoders.length; i++) {
|
|
694
|
+
var r = decoders[i].decode(json);
|
|
695
|
+
if (r.ok === true) {
|
|
696
|
+
return r;
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
errors[i] = r.error;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
var errorsList = errors
|
|
703
|
+
.map(function (error) { return "at error" + (error.at || '') + ": " + error.message; })
|
|
704
|
+
.join('", "');
|
|
705
|
+
return err$1({
|
|
706
|
+
message: "expected a value matching one of the decoders, got the errors [\"" + errorsList + "\"]"
|
|
707
|
+
});
|
|
708
|
+
});
|
|
709
|
+
};
|
|
710
|
+
/**
|
|
711
|
+
* Decoder that always succeeds with either the decoded value, or a fallback
|
|
712
|
+
* default value.
|
|
713
|
+
*/
|
|
714
|
+
Decoder.withDefault = function (defaultValue, decoder) {
|
|
715
|
+
return new Decoder(function (json) {
|
|
716
|
+
return ok$1(withDefault$1(defaultValue, decoder.decode(json)));
|
|
717
|
+
});
|
|
718
|
+
};
|
|
719
|
+
/**
|
|
720
|
+
* Decoder that pulls a specific field out of a json structure, instead of
|
|
721
|
+
* decoding and returning the full structure. The `paths` array describes the
|
|
722
|
+
* object keys and array indices to traverse, so that values can be pulled out
|
|
723
|
+
* of a nested structure.
|
|
724
|
+
*
|
|
725
|
+
* Example:
|
|
726
|
+
* ```
|
|
727
|
+
* const decoder = valueAt(['a', 'b', 0], string());
|
|
728
|
+
*
|
|
729
|
+
* decoder.run({a: {b: ['surprise!']}})
|
|
730
|
+
* // => {ok: true, result: 'surprise!'}
|
|
731
|
+
*
|
|
732
|
+
* decoder.run({a: {x: 'cats'}})
|
|
733
|
+
* // => {ok: false, error: {... at: 'input.a.b[0]' message: 'path does not exist'}}
|
|
734
|
+
* ```
|
|
735
|
+
*
|
|
736
|
+
* Note that the `decoder` is ran on the value found at the last key in the
|
|
737
|
+
* path, even if the last key is not found. This allows the `optional`
|
|
738
|
+
* decoder to succeed when appropriate.
|
|
739
|
+
* ```
|
|
740
|
+
* const optionalDecoder = valueAt(['a', 'b', 'c'], optional(string()));
|
|
741
|
+
*
|
|
742
|
+
* optionalDecoder.run({a: {b: {c: 'surprise!'}}})
|
|
743
|
+
* // => {ok: true, result: 'surprise!'}
|
|
744
|
+
*
|
|
745
|
+
* optionalDecoder.run({a: {b: 'cats'}})
|
|
746
|
+
* // => {ok: false, error: {... at: 'input.a.b.c' message: 'expected an object, got "cats"'}
|
|
747
|
+
*
|
|
748
|
+
* optionalDecoder.run({a: {b: {z: 1}}})
|
|
749
|
+
* // => {ok: true, result: undefined}
|
|
750
|
+
* ```
|
|
751
|
+
*/
|
|
752
|
+
Decoder.valueAt = function (paths, decoder) {
|
|
753
|
+
return new Decoder(function (json) {
|
|
754
|
+
var jsonAtPath = json;
|
|
755
|
+
for (var i = 0; i < paths.length; i++) {
|
|
756
|
+
if (jsonAtPath === undefined) {
|
|
757
|
+
return err$1({
|
|
758
|
+
at: printPath$1(paths.slice(0, i + 1)),
|
|
759
|
+
message: 'path does not exist'
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
else if (typeof paths[i] === 'string' && !isJsonObject$1(jsonAtPath)) {
|
|
763
|
+
return err$1({
|
|
764
|
+
at: printPath$1(paths.slice(0, i + 1)),
|
|
765
|
+
message: expectedGot$1('an object', jsonAtPath)
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
else if (typeof paths[i] === 'number' && !isJsonArray$1(jsonAtPath)) {
|
|
769
|
+
return err$1({
|
|
770
|
+
at: printPath$1(paths.slice(0, i + 1)),
|
|
771
|
+
message: expectedGot$1('an array', jsonAtPath)
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
jsonAtPath = jsonAtPath[paths[i]];
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return mapError$1(function (error) {
|
|
779
|
+
return jsonAtPath === undefined
|
|
780
|
+
? { at: printPath$1(paths), message: 'path does not exist' }
|
|
781
|
+
: prependAt$1(printPath$1(paths), error);
|
|
782
|
+
}, decoder.decode(jsonAtPath));
|
|
783
|
+
});
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* Decoder that ignores the input json and always succeeds with `fixedValue`.
|
|
787
|
+
*/
|
|
788
|
+
Decoder.succeed = function (fixedValue) {
|
|
789
|
+
return new Decoder(function (json) { return ok$1(fixedValue); });
|
|
790
|
+
};
|
|
791
|
+
/**
|
|
792
|
+
* Decoder that ignores the input json and always fails with `errorMessage`.
|
|
793
|
+
*/
|
|
794
|
+
Decoder.fail = function (errorMessage) {
|
|
795
|
+
return new Decoder(function (json) { return err$1({ message: errorMessage }); });
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* Decoder that allows for validating recursive data structures. Unlike with
|
|
799
|
+
* functions, decoders assigned to variables can't reference themselves
|
|
800
|
+
* before they are fully defined. We can avoid prematurely referencing the
|
|
801
|
+
* decoder by wrapping it in a function that won't be called until use, at
|
|
802
|
+
* which point the decoder has been defined.
|
|
803
|
+
*
|
|
804
|
+
* Example:
|
|
805
|
+
* ```
|
|
806
|
+
* interface Comment {
|
|
807
|
+
* msg: string;
|
|
808
|
+
* replies: Comment[];
|
|
809
|
+
* }
|
|
810
|
+
*
|
|
811
|
+
* const decoder: Decoder<Comment> = object({
|
|
812
|
+
* msg: string(),
|
|
813
|
+
* replies: lazy(() => array(decoder))
|
|
814
|
+
* });
|
|
815
|
+
* ```
|
|
816
|
+
*/
|
|
817
|
+
Decoder.lazy = function (mkDecoder) {
|
|
818
|
+
return new Decoder(function (json) { return mkDecoder().decode(json); });
|
|
819
|
+
};
|
|
820
|
+
return Decoder;
|
|
821
|
+
}());
|
|
822
|
+
|
|
823
|
+
/* tslint:disable:variable-name */
|
|
824
|
+
/** See `Decoder.string` */
|
|
825
|
+
var string$1 = Decoder$1.string;
|
|
826
|
+
/** See `Decoder.number` */
|
|
827
|
+
var number$1 = Decoder$1.number;
|
|
828
|
+
/** See `Decoder.boolean` */
|
|
829
|
+
var boolean$1 = Decoder$1.boolean;
|
|
830
|
+
/** See `Decoder.anyJson` */
|
|
831
|
+
var anyJson$1 = Decoder$1.anyJson;
|
|
832
|
+
/** See `Decoder.unknownJson` */
|
|
833
|
+
Decoder$1.unknownJson;
|
|
834
|
+
/** See `Decoder.constant` */
|
|
835
|
+
var constant$1 = Decoder$1.constant;
|
|
836
|
+
/** See `Decoder.object` */
|
|
837
|
+
var object$1 = Decoder$1.object;
|
|
838
|
+
/** See `Decoder.array` */
|
|
839
|
+
var array$1 = Decoder$1.array;
|
|
840
|
+
/** See `Decoder.tuple` */
|
|
841
|
+
Decoder$1.tuple;
|
|
842
|
+
/** See `Decoder.dict` */
|
|
843
|
+
Decoder$1.dict;
|
|
844
|
+
/** See `Decoder.optional` */
|
|
845
|
+
var optional$1 = Decoder$1.optional;
|
|
846
|
+
/** See `Decoder.oneOf` */
|
|
847
|
+
var oneOf$1 = Decoder$1.oneOf;
|
|
848
|
+
/** See `Decoder.union` */
|
|
849
|
+
Decoder$1.union;
|
|
850
|
+
/** See `Decoder.intersection` */
|
|
851
|
+
Decoder$1.intersection;
|
|
852
|
+
/** See `Decoder.withDefault` */
|
|
853
|
+
Decoder$1.withDefault;
|
|
854
|
+
/** See `Decoder.valueAt` */
|
|
855
|
+
Decoder$1.valueAt;
|
|
856
|
+
/** See `Decoder.succeed` */
|
|
857
|
+
Decoder$1.succeed;
|
|
858
|
+
/** See `Decoder.fail` */
|
|
859
|
+
Decoder$1.fail;
|
|
860
|
+
/** See `Decoder.lazy` */
|
|
861
|
+
var lazy = Decoder$1.lazy;
|
|
65
862
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const enterpriseConfig = {
|
|
69
|
-
windows: true,
|
|
70
|
-
layouts: "full",
|
|
71
|
-
appManager: "full",
|
|
72
|
-
channels: true,
|
|
73
|
-
libraries: (_a = config === null || config === void 0 ? void 0 : config.libraries) !== null && _a !== void 0 ? _a : [],
|
|
74
|
-
logger: (_c = (_b = config === null || config === void 0 ? void 0 : config.systemLogger) === null || _b === void 0 ? void 0 : _b.level) !== null && _c !== void 0 ? _c : "warn"
|
|
75
|
-
};
|
|
76
|
-
if (window.glue42gd) {
|
|
77
|
-
return window.Glue(enterpriseConfig);
|
|
78
|
-
}
|
|
79
|
-
return window.Glue(enterpriseConfig);
|
|
80
|
-
};
|
|
863
|
+
const connectBrowserAppProps = ["name", "title", "version", "customProperties", "icon", "caption", "type"];
|
|
864
|
+
const fdc3v2AppProps = ["appId", "name", "type", "details", "version", "title", "tooltip", "lang", "description", "categories", "icons", "screenshots", "contactEmail", "moreInfo", "publisher", "customConfig", "hostManifests", "interop", "localizedVersions"];
|
|
81
865
|
|
|
82
866
|
/**
|
|
83
867
|
* Wraps values in an `Ok` type.
|
|
@@ -840,7 +1624,7 @@ var array = Decoder.array;
|
|
|
840
1624
|
/** See `Decoder.tuple` */
|
|
841
1625
|
Decoder.tuple;
|
|
842
1626
|
/** See `Decoder.dict` */
|
|
843
|
-
Decoder.dict;
|
|
1627
|
+
var dict = Decoder.dict;
|
|
844
1628
|
/** See `Decoder.optional` */
|
|
845
1629
|
var optional = Decoder.optional;
|
|
846
1630
|
/** See `Decoder.oneOf` */
|
|
@@ -858,564 +1642,967 @@ Decoder.succeed;
|
|
|
858
1642
|
/** See `Decoder.fail` */
|
|
859
1643
|
Decoder.fail;
|
|
860
1644
|
/** See `Decoder.lazy` */
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
const nonEmptyStringDecoder = string().where((s) => s.length > 0, "Expected a non-empty string");
|
|
864
|
-
const nonNegativeNumberDecoder = number().where((num) => num >= 0, "Expected a non-negative number");
|
|
865
|
-
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
|
|
1645
|
+
Decoder.lazy;
|
|
1646
|
+
|
|
1647
|
+
const nonEmptyStringDecoder$1 = string().where((s) => s.length > 0, "Expected a non-empty string");
|
|
1648
|
+
const nonNegativeNumberDecoder$1 = number().where((num) => num >= 0, "Expected a non-negative number");
|
|
1649
|
+
|
|
1650
|
+
const intentDefinitionDecoder$1 = object({
|
|
1651
|
+
name: nonEmptyStringDecoder$1,
|
|
1652
|
+
displayName: optional(string()),
|
|
1653
|
+
contexts: optional(array(string())),
|
|
1654
|
+
customConfig: optional(object())
|
|
1655
|
+
});
|
|
1656
|
+
const v2TypeDecoder = oneOf(constant("web"), constant("native"), constant("citrix"), constant("onlineNative"), constant("other"));
|
|
1657
|
+
const v2DetailsDecoder = object({
|
|
1658
|
+
url: nonEmptyStringDecoder$1
|
|
1659
|
+
});
|
|
1660
|
+
const v2IconDecoder = object({
|
|
1661
|
+
src: nonEmptyStringDecoder$1,
|
|
1662
|
+
size: optional(nonEmptyStringDecoder$1),
|
|
1663
|
+
type: optional(nonEmptyStringDecoder$1)
|
|
1664
|
+
});
|
|
1665
|
+
const v2ScreenshotDecoder = object({
|
|
1666
|
+
src: nonEmptyStringDecoder$1,
|
|
1667
|
+
size: optional(nonEmptyStringDecoder$1),
|
|
1668
|
+
type: optional(nonEmptyStringDecoder$1),
|
|
1669
|
+
label: optional(nonEmptyStringDecoder$1)
|
|
1670
|
+
});
|
|
1671
|
+
const v2ListensForIntentDecoder = object({
|
|
1672
|
+
contexts: array(nonEmptyStringDecoder$1),
|
|
1673
|
+
displayName: optional(nonEmptyStringDecoder$1),
|
|
1674
|
+
resultType: optional(nonEmptyStringDecoder$1),
|
|
1675
|
+
customConfig: optional(anyJson())
|
|
1676
|
+
});
|
|
1677
|
+
const v2IntentsDecoder = object({
|
|
1678
|
+
listensFor: optional(dict(v2ListensForIntentDecoder)),
|
|
1679
|
+
raises: optional(dict(array(nonEmptyStringDecoder$1)))
|
|
1680
|
+
});
|
|
1681
|
+
const v2UserChannelDecoder = object({
|
|
1682
|
+
broadcasts: optional(array(nonEmptyStringDecoder$1)),
|
|
1683
|
+
listensFor: optional(array(nonEmptyStringDecoder$1))
|
|
1684
|
+
});
|
|
1685
|
+
const v2AppChannelDecoder = object({
|
|
1686
|
+
name: nonEmptyStringDecoder$1,
|
|
1687
|
+
description: optional(nonEmptyStringDecoder$1),
|
|
1688
|
+
broadcasts: optional(array(nonEmptyStringDecoder$1)),
|
|
1689
|
+
listensFor: optional(array(nonEmptyStringDecoder$1))
|
|
1690
|
+
});
|
|
1691
|
+
const v2InteropDecoder = object({
|
|
1692
|
+
intents: optional(v2IntentsDecoder),
|
|
1693
|
+
userChannels: optional(v2UserChannelDecoder),
|
|
1694
|
+
appChannels: optional(array(v2AppChannelDecoder))
|
|
1695
|
+
});
|
|
1696
|
+
const glue42ApplicationDetailsDecoder = object({
|
|
1697
|
+
url: nonEmptyStringDecoder$1,
|
|
1698
|
+
top: optional(number()),
|
|
1699
|
+
left: optional(number()),
|
|
1700
|
+
width: optional(nonNegativeNumberDecoder$1),
|
|
1701
|
+
height: optional(nonNegativeNumberDecoder$1)
|
|
1702
|
+
});
|
|
1703
|
+
const glue42HostManifestsBrowserDecoder = object({
|
|
1704
|
+
name: optional(nonEmptyStringDecoder$1),
|
|
1705
|
+
type: optional(nonEmptyStringDecoder$1.where((s) => s === "window", "Expected a value of window")),
|
|
1706
|
+
title: optional(nonEmptyStringDecoder$1),
|
|
1707
|
+
version: optional(nonEmptyStringDecoder$1),
|
|
1708
|
+
customProperties: optional(anyJson()),
|
|
1709
|
+
icon: optional(string()),
|
|
1710
|
+
caption: optional(string()),
|
|
1711
|
+
details: optional(glue42ApplicationDetailsDecoder),
|
|
1712
|
+
intents: optional(array(intentDefinitionDecoder$1)),
|
|
1713
|
+
hidden: optional(boolean())
|
|
1714
|
+
});
|
|
1715
|
+
const hostManifestsBrowserDecoder = oneOf(object({
|
|
1716
|
+
"Glue42": oneOf(glue42HostManifestsBrowserDecoder, anyJson())
|
|
1717
|
+
}), anyJson());
|
|
1718
|
+
const v1DefinitionDecoder = object({
|
|
1719
|
+
name: nonEmptyStringDecoder$1,
|
|
1720
|
+
appId: nonEmptyStringDecoder$1,
|
|
1721
|
+
title: optional(nonEmptyStringDecoder$1),
|
|
1722
|
+
version: optional(nonEmptyStringDecoder$1),
|
|
1723
|
+
manifest: nonEmptyStringDecoder$1,
|
|
1724
|
+
manifestType: nonEmptyStringDecoder$1,
|
|
1725
|
+
tooltip: optional(nonEmptyStringDecoder$1),
|
|
1726
|
+
description: optional(nonEmptyStringDecoder$1),
|
|
1727
|
+
contactEmail: optional(nonEmptyStringDecoder$1),
|
|
1728
|
+
supportEmail: optional(nonEmptyStringDecoder$1),
|
|
1729
|
+
publisher: optional(nonEmptyStringDecoder$1),
|
|
1730
|
+
images: optional(array(object({ url: optional(nonEmptyStringDecoder$1) }))),
|
|
1731
|
+
icons: optional(array(object({ icon: optional(nonEmptyStringDecoder$1) }))),
|
|
1732
|
+
customConfig: anyJson(),
|
|
1733
|
+
intents: optional(array(intentDefinitionDecoder$1))
|
|
1734
|
+
});
|
|
1735
|
+
const v2LocalizedDefinitionDecoder = object({
|
|
1736
|
+
appId: optional(nonEmptyStringDecoder$1),
|
|
1737
|
+
name: optional(nonEmptyStringDecoder$1),
|
|
1738
|
+
details: optional(v2DetailsDecoder),
|
|
1739
|
+
version: optional(nonEmptyStringDecoder$1),
|
|
1740
|
+
title: optional(nonEmptyStringDecoder$1),
|
|
1741
|
+
tooltip: optional(nonEmptyStringDecoder$1),
|
|
1742
|
+
lang: optional(nonEmptyStringDecoder$1),
|
|
1743
|
+
description: optional(nonEmptyStringDecoder$1),
|
|
1744
|
+
categories: optional(array(nonEmptyStringDecoder$1)),
|
|
1745
|
+
icons: optional(array(v2IconDecoder)),
|
|
1746
|
+
screenshots: optional(array(v2ScreenshotDecoder)),
|
|
1747
|
+
contactEmail: optional(nonEmptyStringDecoder$1),
|
|
1748
|
+
supportEmail: optional(nonEmptyStringDecoder$1),
|
|
1749
|
+
moreInfo: optional(nonEmptyStringDecoder$1),
|
|
1750
|
+
publisher: optional(nonEmptyStringDecoder$1),
|
|
1751
|
+
customConfig: optional(array(anyJson())),
|
|
1752
|
+
hostManifests: optional(hostManifestsBrowserDecoder),
|
|
1753
|
+
interop: optional(v2InteropDecoder)
|
|
1754
|
+
});
|
|
1755
|
+
const v2DefinitionDecoder = object({
|
|
1756
|
+
appId: nonEmptyStringDecoder$1,
|
|
1757
|
+
name: nonEmptyStringDecoder$1,
|
|
1758
|
+
type: v2TypeDecoder,
|
|
1759
|
+
details: v2DetailsDecoder,
|
|
1760
|
+
version: optional(nonEmptyStringDecoder$1),
|
|
1761
|
+
title: optional(nonEmptyStringDecoder$1),
|
|
1762
|
+
tooltip: optional(nonEmptyStringDecoder$1),
|
|
1763
|
+
lang: optional(nonEmptyStringDecoder$1),
|
|
1764
|
+
description: optional(nonEmptyStringDecoder$1),
|
|
1765
|
+
categories: optional(array(nonEmptyStringDecoder$1)),
|
|
1766
|
+
icons: optional(array(v2IconDecoder)),
|
|
1767
|
+
screenshots: optional(array(v2ScreenshotDecoder)),
|
|
1768
|
+
contactEmail: optional(nonEmptyStringDecoder$1),
|
|
1769
|
+
supportEmail: optional(nonEmptyStringDecoder$1),
|
|
1770
|
+
moreInfo: optional(nonEmptyStringDecoder$1),
|
|
1771
|
+
publisher: optional(nonEmptyStringDecoder$1),
|
|
1772
|
+
customConfig: optional(array(anyJson())),
|
|
1773
|
+
hostManifests: optional(hostManifestsBrowserDecoder),
|
|
1774
|
+
interop: optional(v2InteropDecoder),
|
|
1775
|
+
localizedVersions: optional(dict(v2LocalizedDefinitionDecoder))
|
|
1776
|
+
});
|
|
1777
|
+
const allDefinitionsDecoder = oneOf(v1DefinitionDecoder, v2DefinitionDecoder);
|
|
1778
|
+
|
|
1779
|
+
const parseDecoderErrorToStringMessage = (error) => {
|
|
1780
|
+
return `${error.kind} at ${error.at}: ${JSON.stringify(error.input)}. Reason - ${error.message}`;
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
class FDC3Service {
|
|
1784
|
+
constructor() {
|
|
1785
|
+
this.fdc3ToDesktopDefinitionType = {
|
|
1786
|
+
web: "window",
|
|
1787
|
+
native: "exe",
|
|
1788
|
+
citrix: "citrix",
|
|
1789
|
+
onlineNative: "clickonce",
|
|
1790
|
+
other: "window"
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
toApi() {
|
|
1794
|
+
return {
|
|
1795
|
+
isFdc3Definition: this.isFdc3Definition.bind(this),
|
|
1796
|
+
parseToBrowserBaseAppData: this.parseToBrowserBaseAppData.bind(this),
|
|
1797
|
+
parseToDesktopAppConfig: this.parseToDesktopAppConfig.bind(this)
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
isFdc3Definition(definition) {
|
|
1801
|
+
const decodeRes = allDefinitionsDecoder.run(definition);
|
|
1802
|
+
if (!decodeRes.ok) {
|
|
1803
|
+
return { isFdc3: false };
|
|
1804
|
+
}
|
|
1805
|
+
if (definition.appId && definition.details) {
|
|
1806
|
+
return { isFdc3: true, version: "2.0" };
|
|
1807
|
+
}
|
|
1808
|
+
if (definition.manifest) {
|
|
1809
|
+
return { isFdc3: true, version: "1.2" };
|
|
1810
|
+
}
|
|
1811
|
+
return { isFdc3: false };
|
|
1812
|
+
}
|
|
1813
|
+
parseToBrowserBaseAppData(definition) {
|
|
1814
|
+
var _a;
|
|
1815
|
+
const { isFdc3, version } = this.isFdc3Definition(definition);
|
|
1816
|
+
if (!isFdc3) {
|
|
1817
|
+
throw new Error("The passed definition is not FDC3");
|
|
1818
|
+
}
|
|
1819
|
+
const decodeRes = allDefinitionsDecoder.run(definition);
|
|
1820
|
+
if (!decodeRes.ok) {
|
|
1821
|
+
throw new Error(`Invalid FDC3 ${version} definition. Error: ${parseDecoderErrorToStringMessage(decodeRes.error)}`);
|
|
1822
|
+
}
|
|
1823
|
+
const userProperties = this.getUserPropertiesFromDefinition(definition, version);
|
|
1824
|
+
const createOptions = { url: this.getUrl(definition, version) };
|
|
1825
|
+
let baseApplicationData = {
|
|
1826
|
+
name: definition.appId,
|
|
1827
|
+
type: "window",
|
|
1828
|
+
createOptions,
|
|
1829
|
+
userProperties: Object.assign(Object.assign({}, userProperties), { intents: version === "1.2"
|
|
1830
|
+
? userProperties.intents
|
|
1831
|
+
: this.getIntentsFromV2AppDefinition(definition), details: createOptions }),
|
|
1832
|
+
title: definition.title,
|
|
1833
|
+
version: definition.version,
|
|
1834
|
+
icon: this.getIconFromDefinition(definition, version),
|
|
1835
|
+
caption: definition.description,
|
|
1836
|
+
fdc3: version === "2.0" ? Object.assign(Object.assign({}, definition), { definitionVersion: "2.0" }) : undefined,
|
|
1837
|
+
};
|
|
1838
|
+
if ((_a = definition.hostManifests) === null || _a === void 0 ? void 0 : _a["Glue42"]) {
|
|
1839
|
+
const decodeRes = glue42HostManifestsBrowserDecoder.run(definition.hostManifests["Glue42"]);
|
|
1840
|
+
if (!decodeRes.ok) {
|
|
1841
|
+
throw new Error(`Invalid FDC3 ${version} definition. Error: ${parseDecoderErrorToStringMessage(decodeRes.error)}`);
|
|
1842
|
+
}
|
|
1843
|
+
if (!Object.keys(decodeRes.result).length) {
|
|
1844
|
+
throw new Error("Invalid 'hostManifests['Glue42]' key");
|
|
1845
|
+
}
|
|
1846
|
+
baseApplicationData = this.mergeBaseAppDataWithGlueManifest(baseApplicationData, decodeRes.result);
|
|
1847
|
+
}
|
|
1848
|
+
return baseApplicationData;
|
|
1849
|
+
}
|
|
1850
|
+
parseToDesktopAppConfig(definition) {
|
|
1851
|
+
var _a, _b, _c;
|
|
1852
|
+
const { isFdc3, version } = this.isFdc3Definition(definition);
|
|
1853
|
+
if (!isFdc3) {
|
|
1854
|
+
throw new Error("The passed definition is not FDC3");
|
|
1855
|
+
}
|
|
1856
|
+
const decodeRes = allDefinitionsDecoder.run(definition);
|
|
1857
|
+
if (!decodeRes.ok) {
|
|
1858
|
+
throw new Error(`Invalid FDC3 ${version} definition. Error: ${parseDecoderErrorToStringMessage(decodeRes.error)}`);
|
|
1859
|
+
}
|
|
1860
|
+
if (version === "1.2") {
|
|
1861
|
+
const fdc3v1Definition = definition;
|
|
1862
|
+
return {
|
|
1863
|
+
name: fdc3v1Definition.appId,
|
|
1864
|
+
type: "window",
|
|
1865
|
+
details: {
|
|
1866
|
+
url: this.getUrl(definition, version)
|
|
1867
|
+
},
|
|
1868
|
+
version: fdc3v1Definition.version,
|
|
1869
|
+
title: fdc3v1Definition.title,
|
|
1870
|
+
tooltip: fdc3v1Definition.tooltip,
|
|
1871
|
+
caption: fdc3v1Definition.description,
|
|
1872
|
+
icon: (_a = fdc3v1Definition.icons) === null || _a === void 0 ? void 0 : _a[0].icon,
|
|
1873
|
+
intents: fdc3v1Definition.intents,
|
|
1874
|
+
customProperties: {
|
|
1875
|
+
manifestType: fdc3v1Definition.manifestType,
|
|
1876
|
+
images: fdc3v1Definition.images,
|
|
1877
|
+
contactEmail: fdc3v1Definition.contactEmail,
|
|
1878
|
+
supportEmail: fdc3v1Definition.supportEmail,
|
|
1879
|
+
publisher: fdc3v1Definition.publisher,
|
|
1880
|
+
icons: fdc3v1Definition.icons,
|
|
1881
|
+
customConfig: fdc3v1Definition.customConfig
|
|
1882
|
+
}
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
const fdc3v2Definition = definition;
|
|
1886
|
+
let desktopDefinition = {
|
|
1887
|
+
name: fdc3v2Definition.appId,
|
|
1888
|
+
type: this.fdc3ToDesktopDefinitionType[fdc3v2Definition.type],
|
|
1889
|
+
details: fdc3v2Definition.details,
|
|
1890
|
+
version: fdc3v2Definition.version,
|
|
1891
|
+
title: fdc3v2Definition.title,
|
|
1892
|
+
tooltip: fdc3v2Definition.tooltip,
|
|
1893
|
+
caption: fdc3v2Definition.description,
|
|
1894
|
+
icon: this.getIconFromDefinition(fdc3v2Definition, "2.0"),
|
|
1895
|
+
intents: this.getIntentsFromV2AppDefinition(fdc3v2Definition),
|
|
1896
|
+
fdc3: Object.assign(Object.assign({}, fdc3v2Definition), { definitionVersion: "2.0" })
|
|
1897
|
+
};
|
|
1898
|
+
if ((_b = fdc3v2Definition.hostManifests) === null || _b === void 0 ? void 0 : _b["Glue42"]) {
|
|
1899
|
+
if (typeof fdc3v2Definition.hostManifests["Glue42"] !== "object" || Array.isArray(fdc3v2Definition.hostManifests["Glue42"])) {
|
|
1900
|
+
throw new Error("Invalid 'hostManifests['Glue42]' key");
|
|
1901
|
+
}
|
|
1902
|
+
desktopDefinition = this.mergeDesktopConfigWithGlueManifest(desktopDefinition, (_c = fdc3v2Definition.hostManifests) === null || _c === void 0 ? void 0 : _c["Glue42"]);
|
|
1903
|
+
}
|
|
1904
|
+
return desktopDefinition;
|
|
1905
|
+
}
|
|
1906
|
+
getUserPropertiesFromDefinition(definition, version) {
|
|
1907
|
+
if (version === "1.2") {
|
|
1908
|
+
return Object.fromEntries(Object.entries(definition).filter(([key]) => !connectBrowserAppProps.includes(key)));
|
|
1909
|
+
}
|
|
1910
|
+
return Object.fromEntries(Object.entries(definition).filter(([key]) => !connectBrowserAppProps.includes(key) && !fdc3v2AppProps.includes(key)));
|
|
1911
|
+
}
|
|
1912
|
+
getUrl(definition, version) {
|
|
1913
|
+
var _a, _b;
|
|
1914
|
+
let url;
|
|
1915
|
+
if (version === "1.2") {
|
|
1916
|
+
const parsedManifest = JSON.parse(definition.manifest);
|
|
1917
|
+
url = ((_a = parsedManifest.details) === null || _a === void 0 ? void 0 : _a.url) || parsedManifest.url;
|
|
1918
|
+
}
|
|
1919
|
+
else {
|
|
1920
|
+
url = (_b = definition.details) === null || _b === void 0 ? void 0 : _b.url;
|
|
1921
|
+
}
|
|
1922
|
+
if (!url || typeof url !== "string") {
|
|
1923
|
+
throw new Error(`Invalid FDC3 ${version} definition. Provide valid 'url' under '${version === "1.2" ? "manifest" : "details"}' key`);
|
|
1924
|
+
}
|
|
1925
|
+
return url;
|
|
1926
|
+
}
|
|
1927
|
+
getIntentsFromV2AppDefinition(definition) {
|
|
1928
|
+
var _a, _b;
|
|
1929
|
+
const fdc3Intents = (_b = (_a = definition.interop) === null || _a === void 0 ? void 0 : _a.intents) === null || _b === void 0 ? void 0 : _b.listensFor;
|
|
1930
|
+
if (!fdc3Intents) {
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
const intents = Object.entries(fdc3Intents).map((fdc3Intent) => {
|
|
1934
|
+
const [intentName, intentData] = fdc3Intent;
|
|
1935
|
+
return Object.assign({ name: intentName }, intentData);
|
|
1936
|
+
});
|
|
1937
|
+
return intents;
|
|
1938
|
+
}
|
|
1939
|
+
getIconFromDefinition(definition, version) {
|
|
1940
|
+
var _a, _b, _c, _d;
|
|
1941
|
+
if (version === "1.2") {
|
|
1942
|
+
return ((_b = (_a = definition.icons) === null || _a === void 0 ? void 0 : _a.find((iconDef) => iconDef.icon)) === null || _b === void 0 ? void 0 : _b.icon) || undefined;
|
|
1943
|
+
}
|
|
1944
|
+
return ((_d = (_c = definition.icons) === null || _c === void 0 ? void 0 : _c.find((iconDef) => iconDef.src)) === null || _d === void 0 ? void 0 : _d.src) || undefined;
|
|
1945
|
+
}
|
|
1946
|
+
mergeBaseAppDataWithGlueManifest(baseAppData, hostManifestDefinition) {
|
|
1947
|
+
let baseApplicationDefinition = baseAppData;
|
|
1948
|
+
if (hostManifestDefinition.details) {
|
|
1949
|
+
const details = hostManifestDefinition.details;
|
|
1950
|
+
baseApplicationDefinition.createOptions = details;
|
|
1951
|
+
baseApplicationDefinition.userProperties.details = details;
|
|
1952
|
+
}
|
|
1953
|
+
if (Array.isArray(hostManifestDefinition.intents)) {
|
|
1954
|
+
baseApplicationDefinition.userProperties.intents = (baseApplicationDefinition.userProperties.intents || []).concat(hostManifestDefinition.intents);
|
|
1955
|
+
}
|
|
1956
|
+
baseApplicationDefinition = Object.assign(Object.assign({}, baseApplicationDefinition), hostManifestDefinition);
|
|
1957
|
+
delete baseApplicationDefinition.details;
|
|
1958
|
+
delete baseApplicationDefinition.intents;
|
|
1959
|
+
return baseApplicationDefinition;
|
|
1960
|
+
}
|
|
1961
|
+
mergeDesktopConfigWithGlueManifest(config, desktopDefinition) {
|
|
1962
|
+
let appConfig = Object.assign({}, config);
|
|
1963
|
+
appConfig = Object.assign(Object.assign({}, config), desktopDefinition);
|
|
1964
|
+
if (Array.isArray(desktopDefinition.intents)) {
|
|
1965
|
+
appConfig.intents = (config.intents || []).concat(desktopDefinition.intents);
|
|
1966
|
+
}
|
|
1967
|
+
return appConfig;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
const decoders$1 = {
|
|
1972
|
+
common: {
|
|
1973
|
+
nonEmptyStringDecoder: nonEmptyStringDecoder$1,
|
|
1974
|
+
nonNegativeNumberDecoder: nonNegativeNumberDecoder$1
|
|
1975
|
+
},
|
|
1976
|
+
fdc3: {
|
|
1977
|
+
allDefinitionsDecoder,
|
|
1978
|
+
v1DefinitionDecoder,
|
|
1979
|
+
v2DefinitionDecoder
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
|
|
1983
|
+
let IoC$1 = class IoC {
|
|
1984
|
+
constructor() {
|
|
1985
|
+
this._decoders = decoders$1;
|
|
1986
|
+
}
|
|
1987
|
+
get fdc3() {
|
|
1988
|
+
if (!this._fdc3) {
|
|
1989
|
+
this._fdc3 = new FDC3Service().toApi();
|
|
1990
|
+
}
|
|
1991
|
+
return this._fdc3;
|
|
1992
|
+
}
|
|
1993
|
+
get decoders() {
|
|
1994
|
+
return this._decoders;
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
|
|
1998
|
+
const ioc = new IoC$1();
|
|
1999
|
+
ioc.fdc3;
|
|
2000
|
+
const decoders = ioc.decoders;
|
|
2001
|
+
|
|
2002
|
+
const nonEmptyStringDecoder = string$1().where((s) => s.length > 0, "Expected a non-empty string");
|
|
2003
|
+
const nonNegativeNumberDecoder = number$1().where((num) => num >= 0, "Expected a non-negative number");
|
|
2004
|
+
const optionalNonEmptyStringDecoder = optional$1(nonEmptyStringDecoder);
|
|
2005
|
+
const libDomainDecoder = oneOf$1(constant$1("system"), constant$1("windows"), constant$1("appManager"), constant$1("layouts"), constant$1("intents"), constant$1("notifications"), constant$1("channels"), constant$1("extension"), constant$1("themes"));
|
|
2006
|
+
const windowOperationTypesDecoder = oneOf$1(constant$1("openWindow"), constant$1("windowHello"), constant$1("windowAdded"), constant$1("windowRemoved"), constant$1("getBounds"), constant$1("getFrameBounds"), constant$1("getUrl"), constant$1("moveResize"), constant$1("focus"), constant$1("close"), constant$1("getTitle"), constant$1("setTitle"), constant$1("focusChange"), constant$1("getChannel"));
|
|
2007
|
+
const appManagerOperationTypesDecoder = oneOf$1(constant$1("appHello"), constant$1("appDirectoryStateChange"), constant$1("instanceStarted"), constant$1("instanceStopped"), constant$1("applicationStart"), constant$1("instanceStop"), constant$1("clear"));
|
|
2008
|
+
const layoutsOperationTypesDecoder = oneOf$1(constant$1("layoutAdded"), constant$1("layoutChanged"), constant$1("layoutRemoved"), constant$1("get"), constant$1("getAll"), constant$1("export"), constant$1("import"), constant$1("remove"), constant$1("clientSaveRequest"), constant$1("getGlobalPermissionState"), constant$1("checkGlobalActivated"), constant$1("requestGlobalPermission"), constant$1("getDefaultGlobal"), constant$1("setDefaultGlobal"), constant$1("clearDefaultGlobal"));
|
|
2009
|
+
const notificationsOperationTypesDecoder = oneOf$1(constant$1("raiseNotification"), constant$1("requestPermission"), constant$1("notificationShow"), constant$1("notificationClick"), constant$1("getPermission"), constant$1("list"), constant$1("notificationRaised"), constant$1("notificationClosed"), constant$1("click"), constant$1("clear"), constant$1("clearAll"));
|
|
2010
|
+
const systemOperationTypesDecoder = oneOf$1(constant$1("getEnvironment"), constant$1("getBase"), constant$1("platformShutdown"));
|
|
2011
|
+
const windowRelativeDirectionDecoder = oneOf$1(constant$1("top"), constant$1("left"), constant$1("right"), constant$1("bottom"));
|
|
2012
|
+
const windowBoundsDecoder = object$1({
|
|
2013
|
+
top: number$1(),
|
|
2014
|
+
left: number$1(),
|
|
875
2015
|
width: nonNegativeNumberDecoder,
|
|
876
2016
|
height: nonNegativeNumberDecoder
|
|
877
2017
|
});
|
|
878
|
-
const windowOpenSettingsDecoder = optional(object({
|
|
879
|
-
top: optional(number()),
|
|
880
|
-
left: optional(number()),
|
|
881
|
-
width: optional(nonNegativeNumberDecoder),
|
|
882
|
-
height: optional(nonNegativeNumberDecoder),
|
|
883
|
-
context: optional(anyJson()),
|
|
884
|
-
relativeTo: optional(nonEmptyStringDecoder),
|
|
885
|
-
relativeDirection: optional(windowRelativeDirectionDecoder),
|
|
886
|
-
windowId: optional(nonEmptyStringDecoder),
|
|
887
|
-
layoutComponentId: optional(nonEmptyStringDecoder)
|
|
2018
|
+
const windowOpenSettingsDecoder = optional$1(object$1({
|
|
2019
|
+
top: optional$1(number$1()),
|
|
2020
|
+
left: optional$1(number$1()),
|
|
2021
|
+
width: optional$1(nonNegativeNumberDecoder),
|
|
2022
|
+
height: optional$1(nonNegativeNumberDecoder),
|
|
2023
|
+
context: optional$1(anyJson$1()),
|
|
2024
|
+
relativeTo: optional$1(nonEmptyStringDecoder),
|
|
2025
|
+
relativeDirection: optional$1(windowRelativeDirectionDecoder),
|
|
2026
|
+
windowId: optional$1(nonEmptyStringDecoder),
|
|
2027
|
+
layoutComponentId: optional$1(nonEmptyStringDecoder)
|
|
888
2028
|
}));
|
|
889
|
-
const openWindowConfigDecoder = object({
|
|
2029
|
+
const openWindowConfigDecoder = object$1({
|
|
890
2030
|
name: nonEmptyStringDecoder,
|
|
891
2031
|
url: nonEmptyStringDecoder,
|
|
892
2032
|
options: windowOpenSettingsDecoder
|
|
893
2033
|
});
|
|
894
|
-
const windowHelloDecoder = object({
|
|
895
|
-
windowId: optional(nonEmptyStringDecoder)
|
|
2034
|
+
const windowHelloDecoder = object$1({
|
|
2035
|
+
windowId: optional$1(nonEmptyStringDecoder)
|
|
896
2036
|
});
|
|
897
|
-
const coreWindowDataDecoder = object({
|
|
2037
|
+
const coreWindowDataDecoder = object$1({
|
|
898
2038
|
windowId: nonEmptyStringDecoder,
|
|
899
2039
|
name: nonEmptyStringDecoder
|
|
900
2040
|
});
|
|
901
|
-
const simpleWindowDecoder = object({
|
|
2041
|
+
const simpleWindowDecoder = object$1({
|
|
902
2042
|
windowId: nonEmptyStringDecoder
|
|
903
2043
|
});
|
|
904
|
-
const helloSuccessDecoder = object({
|
|
905
|
-
windows: array(coreWindowDataDecoder),
|
|
906
|
-
isWorkspaceFrame: boolean()
|
|
2044
|
+
const helloSuccessDecoder = object$1({
|
|
2045
|
+
windows: array$1(coreWindowDataDecoder),
|
|
2046
|
+
isWorkspaceFrame: boolean$1()
|
|
907
2047
|
});
|
|
908
|
-
const windowTitleConfigDecoder = object({
|
|
2048
|
+
const windowTitleConfigDecoder = object$1({
|
|
909
2049
|
windowId: nonEmptyStringDecoder,
|
|
910
|
-
title: string()
|
|
2050
|
+
title: string$1()
|
|
911
2051
|
});
|
|
912
|
-
const focusEventDataDecoder = object({
|
|
2052
|
+
const focusEventDataDecoder = object$1({
|
|
913
2053
|
windowId: nonEmptyStringDecoder,
|
|
914
|
-
hasFocus: boolean()
|
|
2054
|
+
hasFocus: boolean$1()
|
|
915
2055
|
});
|
|
916
|
-
const windowMoveResizeConfigDecoder = object({
|
|
2056
|
+
const windowMoveResizeConfigDecoder = object$1({
|
|
917
2057
|
windowId: nonEmptyStringDecoder,
|
|
918
|
-
top: optional(number()),
|
|
919
|
-
left: optional(number()),
|
|
920
|
-
width: optional(nonNegativeNumberDecoder),
|
|
921
|
-
height: optional(nonNegativeNumberDecoder),
|
|
922
|
-
relative: optional(boolean())
|
|
2058
|
+
top: optional$1(number$1()),
|
|
2059
|
+
left: optional$1(number$1()),
|
|
2060
|
+
width: optional$1(nonNegativeNumberDecoder),
|
|
2061
|
+
height: optional$1(nonNegativeNumberDecoder),
|
|
2062
|
+
relative: optional$1(boolean$1())
|
|
923
2063
|
});
|
|
924
|
-
const windowBoundsResultDecoder = object({
|
|
2064
|
+
const windowBoundsResultDecoder = object$1({
|
|
925
2065
|
windowId: nonEmptyStringDecoder,
|
|
926
|
-
bounds: object({
|
|
927
|
-
top: number(),
|
|
928
|
-
left: number(),
|
|
2066
|
+
bounds: object$1({
|
|
2067
|
+
top: number$1(),
|
|
2068
|
+
left: number$1(),
|
|
929
2069
|
width: nonNegativeNumberDecoder,
|
|
930
2070
|
height: nonNegativeNumberDecoder
|
|
931
2071
|
})
|
|
932
2072
|
});
|
|
933
|
-
const frameWindowBoundsResultDecoder = object({
|
|
934
|
-
bounds: object({
|
|
935
|
-
top: number(),
|
|
936
|
-
left: number(),
|
|
2073
|
+
const frameWindowBoundsResultDecoder = object$1({
|
|
2074
|
+
bounds: object$1({
|
|
2075
|
+
top: number$1(),
|
|
2076
|
+
left: number$1(),
|
|
937
2077
|
width: nonNegativeNumberDecoder,
|
|
938
2078
|
height: nonNegativeNumberDecoder
|
|
939
2079
|
})
|
|
940
2080
|
});
|
|
941
|
-
const windowUrlResultDecoder = object({
|
|
2081
|
+
const windowUrlResultDecoder = object$1({
|
|
942
2082
|
windowId: nonEmptyStringDecoder,
|
|
943
2083
|
url: nonEmptyStringDecoder
|
|
944
2084
|
});
|
|
945
|
-
const anyDecoder = anyJson();
|
|
946
|
-
const boundsDecoder = object({
|
|
947
|
-
top: optional(number()),
|
|
948
|
-
left: optional(number()),
|
|
949
|
-
width: optional(nonNegativeNumberDecoder),
|
|
950
|
-
height: optional(nonNegativeNumberDecoder)
|
|
2085
|
+
const anyDecoder = anyJson$1();
|
|
2086
|
+
const boundsDecoder = object$1({
|
|
2087
|
+
top: optional$1(number$1()),
|
|
2088
|
+
left: optional$1(number$1()),
|
|
2089
|
+
width: optional$1(nonNegativeNumberDecoder),
|
|
2090
|
+
height: optional$1(nonNegativeNumberDecoder)
|
|
951
2091
|
});
|
|
952
|
-
const instanceDataDecoder = object({
|
|
2092
|
+
const instanceDataDecoder = object$1({
|
|
953
2093
|
id: nonEmptyStringDecoder,
|
|
954
2094
|
applicationName: nonEmptyStringDecoder
|
|
955
2095
|
});
|
|
956
|
-
const applicationDetailsDecoder = object({
|
|
2096
|
+
const applicationDetailsDecoder = object$1({
|
|
957
2097
|
url: nonEmptyStringDecoder,
|
|
958
|
-
top: optional(number()),
|
|
959
|
-
left: optional(number()),
|
|
960
|
-
width: optional(nonNegativeNumberDecoder),
|
|
961
|
-
height: optional(nonNegativeNumberDecoder)
|
|
2098
|
+
top: optional$1(number$1()),
|
|
2099
|
+
left: optional$1(number$1()),
|
|
2100
|
+
width: optional$1(nonNegativeNumberDecoder),
|
|
2101
|
+
height: optional$1(nonNegativeNumberDecoder)
|
|
962
2102
|
});
|
|
963
|
-
const intentDefinitionDecoder = object({
|
|
2103
|
+
const intentDefinitionDecoder = object$1({
|
|
964
2104
|
name: nonEmptyStringDecoder,
|
|
965
|
-
displayName: optional(string()),
|
|
966
|
-
contexts: optional(array(string())),
|
|
967
|
-
customConfig: optional(object())
|
|
2105
|
+
displayName: optional$1(string$1()),
|
|
2106
|
+
contexts: optional$1(array$1(string$1())),
|
|
2107
|
+
customConfig: optional$1(object$1())
|
|
968
2108
|
});
|
|
969
|
-
|
|
2109
|
+
object$1({
|
|
970
2110
|
name: nonEmptyStringDecoder,
|
|
971
|
-
title: optional(nonEmptyStringDecoder),
|
|
972
|
-
version: optional(nonEmptyStringDecoder),
|
|
973
|
-
appId: optional(nonEmptyStringDecoder),
|
|
2111
|
+
title: optional$1(nonEmptyStringDecoder),
|
|
2112
|
+
version: optional$1(nonEmptyStringDecoder),
|
|
2113
|
+
appId: optional$1(nonEmptyStringDecoder),
|
|
974
2114
|
manifest: nonEmptyStringDecoder,
|
|
975
2115
|
manifestType: nonEmptyStringDecoder,
|
|
976
|
-
tooltip: optional(nonEmptyStringDecoder),
|
|
977
|
-
description: optional(nonEmptyStringDecoder),
|
|
978
|
-
contactEmail: optional(nonEmptyStringDecoder),
|
|
979
|
-
supportEmail: optional(nonEmptyStringDecoder),
|
|
980
|
-
publisher: optional(nonEmptyStringDecoder),
|
|
981
|
-
images: optional(array(object({ url: optional(nonEmptyStringDecoder) }))),
|
|
982
|
-
icons: optional(array(object({ icon: optional(nonEmptyStringDecoder) }))),
|
|
983
|
-
customConfig: anyJson(),
|
|
984
|
-
intents: optional(array(intentDefinitionDecoder))
|
|
2116
|
+
tooltip: optional$1(nonEmptyStringDecoder),
|
|
2117
|
+
description: optional$1(nonEmptyStringDecoder),
|
|
2118
|
+
contactEmail: optional$1(nonEmptyStringDecoder),
|
|
2119
|
+
supportEmail: optional$1(nonEmptyStringDecoder),
|
|
2120
|
+
publisher: optional$1(nonEmptyStringDecoder),
|
|
2121
|
+
images: optional$1(array$1(object$1({ url: optional$1(nonEmptyStringDecoder) }))),
|
|
2122
|
+
icons: optional$1(array$1(object$1({ icon: optional$1(nonEmptyStringDecoder) }))),
|
|
2123
|
+
customConfig: anyJson$1(),
|
|
2124
|
+
intents: optional$1(array$1(intentDefinitionDecoder))
|
|
985
2125
|
});
|
|
986
|
-
const applicationDefinitionDecoder = object({
|
|
2126
|
+
const applicationDefinitionDecoder = object$1({
|
|
987
2127
|
name: nonEmptyStringDecoder,
|
|
988
2128
|
type: nonEmptyStringDecoder.where((s) => s === "window", "Expected a value of window"),
|
|
989
|
-
title: optional(nonEmptyStringDecoder),
|
|
990
|
-
version: optional(nonEmptyStringDecoder),
|
|
991
|
-
customProperties: optional(anyJson()),
|
|
992
|
-
icon: optional(string()),
|
|
993
|
-
caption: optional(string()),
|
|
2129
|
+
title: optional$1(nonEmptyStringDecoder),
|
|
2130
|
+
version: optional$1(nonEmptyStringDecoder),
|
|
2131
|
+
customProperties: optional$1(anyJson$1()),
|
|
2132
|
+
icon: optional$1(string$1()),
|
|
2133
|
+
caption: optional$1(string$1()),
|
|
994
2134
|
details: applicationDetailsDecoder,
|
|
995
|
-
intents: optional(array(intentDefinitionDecoder)),
|
|
996
|
-
hidden: optional(boolean())
|
|
2135
|
+
intents: optional$1(array$1(intentDefinitionDecoder)),
|
|
2136
|
+
hidden: optional$1(boolean$1()),
|
|
2137
|
+
fdc3: optional$1(decoders.fdc3.v2DefinitionDecoder)
|
|
997
2138
|
});
|
|
998
|
-
const allApplicationDefinitionsDecoder = oneOf(applicationDefinitionDecoder,
|
|
999
|
-
object({
|
|
1000
|
-
definitions: array(allApplicationDefinitionsDecoder),
|
|
1001
|
-
mode: oneOf(constant("replace"), constant("merge"))
|
|
2139
|
+
const allApplicationDefinitionsDecoder = oneOf$1(applicationDefinitionDecoder, decoders.fdc3.v2DefinitionDecoder, decoders.fdc3.v1DefinitionDecoder);
|
|
2140
|
+
object$1({
|
|
2141
|
+
definitions: array$1(allApplicationDefinitionsDecoder),
|
|
2142
|
+
mode: oneOf$1(constant$1("replace"), constant$1("merge"))
|
|
1002
2143
|
});
|
|
1003
|
-
const appRemoveConfigDecoder = object({
|
|
2144
|
+
const appRemoveConfigDecoder = object$1({
|
|
1004
2145
|
name: nonEmptyStringDecoder
|
|
1005
2146
|
});
|
|
1006
|
-
const appsExportOperationDecoder = object({
|
|
1007
|
-
definitions: array(applicationDefinitionDecoder)
|
|
2147
|
+
const appsExportOperationDecoder = object$1({
|
|
2148
|
+
definitions: array$1(applicationDefinitionDecoder)
|
|
1008
2149
|
});
|
|
1009
|
-
const applicationDataDecoder = object({
|
|
2150
|
+
const applicationDataDecoder = object$1({
|
|
1010
2151
|
name: nonEmptyStringDecoder,
|
|
1011
2152
|
type: nonEmptyStringDecoder.where((s) => s === "window", "Expected a value of window"),
|
|
1012
|
-
instances: array(instanceDataDecoder),
|
|
1013
|
-
userProperties: optional(anyJson()),
|
|
1014
|
-
title: optional(nonEmptyStringDecoder),
|
|
1015
|
-
version: optional(nonEmptyStringDecoder),
|
|
1016
|
-
icon: optional(nonEmptyStringDecoder),
|
|
1017
|
-
caption: optional(nonEmptyStringDecoder)
|
|
2153
|
+
instances: array$1(instanceDataDecoder),
|
|
2154
|
+
userProperties: optional$1(anyJson$1()),
|
|
2155
|
+
title: optional$1(nonEmptyStringDecoder),
|
|
2156
|
+
version: optional$1(nonEmptyStringDecoder),
|
|
2157
|
+
icon: optional$1(nonEmptyStringDecoder),
|
|
2158
|
+
caption: optional$1(nonEmptyStringDecoder)
|
|
1018
2159
|
});
|
|
1019
|
-
const baseApplicationDataDecoder = object({
|
|
2160
|
+
const baseApplicationDataDecoder = object$1({
|
|
1020
2161
|
name: nonEmptyStringDecoder,
|
|
1021
2162
|
type: nonEmptyStringDecoder.where((s) => s === "window", "Expected a value of window"),
|
|
1022
|
-
userProperties: anyJson(),
|
|
1023
|
-
title: optional(nonEmptyStringDecoder),
|
|
1024
|
-
version: optional(nonEmptyStringDecoder),
|
|
1025
|
-
icon: optional(nonEmptyStringDecoder),
|
|
1026
|
-
caption: optional(nonEmptyStringDecoder)
|
|
2163
|
+
userProperties: anyJson$1(),
|
|
2164
|
+
title: optional$1(nonEmptyStringDecoder),
|
|
2165
|
+
version: optional$1(nonEmptyStringDecoder),
|
|
2166
|
+
icon: optional$1(nonEmptyStringDecoder),
|
|
2167
|
+
caption: optional$1(nonEmptyStringDecoder)
|
|
1027
2168
|
});
|
|
1028
|
-
const appDirectoryStateChangeDecoder = object({
|
|
1029
|
-
appsAdded: array(baseApplicationDataDecoder),
|
|
1030
|
-
appsChanged: array(baseApplicationDataDecoder),
|
|
1031
|
-
appsRemoved: array(baseApplicationDataDecoder)
|
|
2169
|
+
const appDirectoryStateChangeDecoder = object$1({
|
|
2170
|
+
appsAdded: array$1(baseApplicationDataDecoder),
|
|
2171
|
+
appsChanged: array$1(baseApplicationDataDecoder),
|
|
2172
|
+
appsRemoved: array$1(baseApplicationDataDecoder)
|
|
1032
2173
|
});
|
|
1033
|
-
const appHelloSuccessDecoder = object({
|
|
1034
|
-
apps: array(applicationDataDecoder)
|
|
2174
|
+
const appHelloSuccessDecoder = object$1({
|
|
2175
|
+
apps: array$1(applicationDataDecoder),
|
|
2176
|
+
initialChannelId: optional$1(nonEmptyStringDecoder)
|
|
1035
2177
|
});
|
|
1036
|
-
const basicInstanceDataDecoder = object({
|
|
2178
|
+
const basicInstanceDataDecoder = object$1({
|
|
1037
2179
|
id: nonEmptyStringDecoder
|
|
1038
2180
|
});
|
|
1039
|
-
const applicationStartConfigDecoder = object({
|
|
2181
|
+
const applicationStartConfigDecoder = object$1({
|
|
1040
2182
|
name: nonEmptyStringDecoder,
|
|
1041
|
-
waitForAGMReady: boolean(),
|
|
1042
|
-
id: optional(nonEmptyStringDecoder),
|
|
1043
|
-
context: optional(anyJson()),
|
|
1044
|
-
top: optional(number()),
|
|
1045
|
-
left: optional(number()),
|
|
1046
|
-
width: optional(nonNegativeNumberDecoder),
|
|
1047
|
-
height: optional(nonNegativeNumberDecoder),
|
|
1048
|
-
relativeTo: optional(nonEmptyStringDecoder),
|
|
1049
|
-
relativeDirection: optional(
|
|
1050
|
-
forceChromeTab: optional(boolean()),
|
|
1051
|
-
layoutComponentId: optional(nonEmptyStringDecoder)
|
|
2183
|
+
waitForAGMReady: boolean$1(),
|
|
2184
|
+
id: optional$1(nonEmptyStringDecoder),
|
|
2185
|
+
context: optional$1(anyJson$1()),
|
|
2186
|
+
top: optional$1(number$1()),
|
|
2187
|
+
left: optional$1(number$1()),
|
|
2188
|
+
width: optional$1(nonNegativeNumberDecoder),
|
|
2189
|
+
height: optional$1(nonNegativeNumberDecoder),
|
|
2190
|
+
relativeTo: optional$1(nonEmptyStringDecoder),
|
|
2191
|
+
relativeDirection: optional$1(windowRelativeDirectionDecoder),
|
|
2192
|
+
forceChromeTab: optional$1(boolean$1()),
|
|
2193
|
+
layoutComponentId: optional$1(nonEmptyStringDecoder),
|
|
2194
|
+
channelId: optional$1(nonEmptyStringDecoder)
|
|
1052
2195
|
});
|
|
1053
|
-
const layoutTypeDecoder = oneOf(constant("Global"), constant("Activity"), constant("ApplicationDefault"), constant("Swimlane"), constant("Workspace"));
|
|
1054
|
-
const componentTypeDecoder = oneOf(constant("application"), constant("activity"));
|
|
1055
|
-
const windowComponentStateDecoder = object({
|
|
1056
|
-
context: optional(anyJson()),
|
|
2196
|
+
const layoutTypeDecoder = oneOf$1(constant$1("Global"), constant$1("Activity"), constant$1("ApplicationDefault"), constant$1("Swimlane"), constant$1("Workspace"));
|
|
2197
|
+
const componentTypeDecoder = oneOf$1(constant$1("application"), constant$1("activity"));
|
|
2198
|
+
const windowComponentStateDecoder = object$1({
|
|
2199
|
+
context: optional$1(anyJson$1()),
|
|
1057
2200
|
bounds: windowBoundsDecoder,
|
|
1058
|
-
createArgs: object({
|
|
1059
|
-
name: optional(nonEmptyStringDecoder),
|
|
1060
|
-
url: optional(nonEmptyStringDecoder),
|
|
1061
|
-
context: optional(anyJson())
|
|
2201
|
+
createArgs: object$1({
|
|
2202
|
+
name: optional$1(nonEmptyStringDecoder),
|
|
2203
|
+
url: optional$1(nonEmptyStringDecoder),
|
|
2204
|
+
context: optional$1(anyJson$1())
|
|
1062
2205
|
}),
|
|
1063
|
-
windowState: optional(nonEmptyStringDecoder),
|
|
1064
|
-
restoreState: optional(nonEmptyStringDecoder),
|
|
2206
|
+
windowState: optional$1(nonEmptyStringDecoder),
|
|
2207
|
+
restoreState: optional$1(nonEmptyStringDecoder),
|
|
1065
2208
|
instanceId: nonEmptyStringDecoder,
|
|
1066
|
-
isCollapsed: optional(boolean()),
|
|
1067
|
-
isSticky: optional(boolean()),
|
|
1068
|
-
restoreSettings: object({
|
|
1069
|
-
groupId: optional(nonEmptyStringDecoder),
|
|
1070
|
-
groupZOrder: optional(number())
|
|
2209
|
+
isCollapsed: optional$1(boolean$1()),
|
|
2210
|
+
isSticky: optional$1(boolean$1()),
|
|
2211
|
+
restoreSettings: object$1({
|
|
2212
|
+
groupId: optional$1(nonEmptyStringDecoder),
|
|
2213
|
+
groupZOrder: optional$1(number$1())
|
|
1071
2214
|
})
|
|
1072
2215
|
});
|
|
1073
|
-
const windowLayoutComponentDecoder = object({
|
|
1074
|
-
type: constant("window"),
|
|
1075
|
-
componentType: optional(componentTypeDecoder),
|
|
2216
|
+
const windowLayoutComponentDecoder = object$1({
|
|
2217
|
+
type: constant$1("window"),
|
|
2218
|
+
componentType: optional$1(componentTypeDecoder),
|
|
1076
2219
|
application: nonEmptyStringDecoder,
|
|
1077
2220
|
state: windowComponentStateDecoder
|
|
1078
2221
|
});
|
|
1079
|
-
const windowLayoutItemDecoder = object({
|
|
1080
|
-
type: constant("window"),
|
|
1081
|
-
config: object({
|
|
2222
|
+
const windowLayoutItemDecoder = object$1({
|
|
2223
|
+
type: constant$1("window"),
|
|
2224
|
+
config: object$1({
|
|
1082
2225
|
appName: nonEmptyStringDecoder,
|
|
1083
|
-
url: optional(nonEmptyStringDecoder),
|
|
1084
|
-
title: optional(string()),
|
|
1085
|
-
allowExtract: optional(boolean()),
|
|
1086
|
-
allowReorder: optional(boolean()),
|
|
1087
|
-
showCloseButton: optional(boolean()),
|
|
1088
|
-
isMaximized: optional(boolean())
|
|
2226
|
+
url: optional$1(nonEmptyStringDecoder),
|
|
2227
|
+
title: optional$1(string$1()),
|
|
2228
|
+
allowExtract: optional$1(boolean$1()),
|
|
2229
|
+
allowReorder: optional$1(boolean$1()),
|
|
2230
|
+
showCloseButton: optional$1(boolean$1()),
|
|
2231
|
+
isMaximized: optional$1(boolean$1())
|
|
1089
2232
|
})
|
|
1090
2233
|
});
|
|
1091
|
-
const groupLayoutItemDecoder = object({
|
|
1092
|
-
type: constant("group"),
|
|
1093
|
-
config: anyJson(),
|
|
1094
|
-
children: array(oneOf(windowLayoutItemDecoder))
|
|
2234
|
+
const groupLayoutItemDecoder = object$1({
|
|
2235
|
+
type: constant$1("group"),
|
|
2236
|
+
config: anyJson$1(),
|
|
2237
|
+
children: array$1(oneOf$1(windowLayoutItemDecoder))
|
|
1095
2238
|
});
|
|
1096
|
-
const columnLayoutItemDecoder = object({
|
|
1097
|
-
type: constant("column"),
|
|
1098
|
-
config: anyJson(),
|
|
1099
|
-
children: array(oneOf(groupLayoutItemDecoder, windowLayoutItemDecoder, lazy(() => columnLayoutItemDecoder), lazy(() => rowLayoutItemDecoder)))
|
|
2239
|
+
const columnLayoutItemDecoder = object$1({
|
|
2240
|
+
type: constant$1("column"),
|
|
2241
|
+
config: anyJson$1(),
|
|
2242
|
+
children: array$1(oneOf$1(groupLayoutItemDecoder, windowLayoutItemDecoder, lazy(() => columnLayoutItemDecoder), lazy(() => rowLayoutItemDecoder)))
|
|
1100
2243
|
});
|
|
1101
|
-
const rowLayoutItemDecoder = object({
|
|
1102
|
-
type: constant("row"),
|
|
1103
|
-
config: anyJson(),
|
|
1104
|
-
children: array(oneOf(columnLayoutItemDecoder, groupLayoutItemDecoder, windowLayoutItemDecoder, lazy(() => rowLayoutItemDecoder)))
|
|
2244
|
+
const rowLayoutItemDecoder = object$1({
|
|
2245
|
+
type: constant$1("row"),
|
|
2246
|
+
config: anyJson$1(),
|
|
2247
|
+
children: array$1(oneOf$1(columnLayoutItemDecoder, groupLayoutItemDecoder, windowLayoutItemDecoder, lazy(() => rowLayoutItemDecoder)))
|
|
1105
2248
|
});
|
|
1106
|
-
const workspaceLayoutComponentStateDecoder = object({
|
|
1107
|
-
config: anyJson(),
|
|
1108
|
-
context: anyJson(),
|
|
1109
|
-
children: array(oneOf(rowLayoutItemDecoder, columnLayoutItemDecoder, groupLayoutItemDecoder, windowLayoutItemDecoder))
|
|
2249
|
+
const workspaceLayoutComponentStateDecoder = object$1({
|
|
2250
|
+
config: anyJson$1(),
|
|
2251
|
+
context: anyJson$1(),
|
|
2252
|
+
children: array$1(oneOf$1(rowLayoutItemDecoder, columnLayoutItemDecoder, groupLayoutItemDecoder, windowLayoutItemDecoder))
|
|
1110
2253
|
});
|
|
1111
|
-
const workspaceLayoutComponentDecoder = object({
|
|
1112
|
-
type: constant("Workspace"),
|
|
1113
|
-
application: optional(nonEmptyStringDecoder),
|
|
2254
|
+
const workspaceLayoutComponentDecoder = object$1({
|
|
2255
|
+
type: constant$1("Workspace"),
|
|
2256
|
+
application: optional$1(nonEmptyStringDecoder),
|
|
1114
2257
|
state: workspaceLayoutComponentStateDecoder
|
|
1115
2258
|
});
|
|
1116
|
-
const workspaceFrameComponentStateDecoder = object({
|
|
2259
|
+
const workspaceFrameComponentStateDecoder = object$1({
|
|
1117
2260
|
bounds: windowBoundsDecoder,
|
|
1118
2261
|
instanceId: nonEmptyStringDecoder,
|
|
1119
2262
|
selectedWorkspace: nonNegativeNumberDecoder,
|
|
1120
|
-
workspaces: array(workspaceLayoutComponentStateDecoder),
|
|
1121
|
-
windowState: optional(nonEmptyStringDecoder),
|
|
1122
|
-
restoreState: optional(nonEmptyStringDecoder),
|
|
1123
|
-
context: optional(anyJson())
|
|
2263
|
+
workspaces: array$1(workspaceLayoutComponentStateDecoder),
|
|
2264
|
+
windowState: optional$1(nonEmptyStringDecoder),
|
|
2265
|
+
restoreState: optional$1(nonEmptyStringDecoder),
|
|
2266
|
+
context: optional$1(anyJson$1())
|
|
1124
2267
|
});
|
|
1125
|
-
const workspaceFrameComponentDecoder = object({
|
|
1126
|
-
type: constant("workspaceFrame"),
|
|
2268
|
+
const workspaceFrameComponentDecoder = object$1({
|
|
2269
|
+
type: constant$1("workspaceFrame"),
|
|
1127
2270
|
application: nonEmptyStringDecoder,
|
|
1128
|
-
componentType: optional(componentTypeDecoder),
|
|
2271
|
+
componentType: optional$1(componentTypeDecoder),
|
|
1129
2272
|
state: workspaceFrameComponentStateDecoder
|
|
1130
2273
|
});
|
|
1131
|
-
const glueLayoutDecoder = object({
|
|
2274
|
+
const glueLayoutDecoder = object$1({
|
|
1132
2275
|
name: nonEmptyStringDecoder,
|
|
1133
2276
|
type: layoutTypeDecoder,
|
|
1134
|
-
components: array(oneOf(windowLayoutComponentDecoder, workspaceLayoutComponentDecoder, workspaceFrameComponentDecoder)),
|
|
1135
|
-
context: optional(anyJson()),
|
|
1136
|
-
metadata: optional(anyJson()),
|
|
1137
|
-
version: optional(number())
|
|
2277
|
+
components: array$1(oneOf$1(windowLayoutComponentDecoder, workspaceLayoutComponentDecoder, workspaceFrameComponentDecoder)),
|
|
2278
|
+
context: optional$1(anyJson$1()),
|
|
2279
|
+
metadata: optional$1(anyJson$1()),
|
|
2280
|
+
version: optional$1(number$1())
|
|
1138
2281
|
});
|
|
1139
|
-
const newLayoutOptionsDecoder = object({
|
|
2282
|
+
const newLayoutOptionsDecoder = object$1({
|
|
1140
2283
|
name: nonEmptyStringDecoder,
|
|
1141
|
-
context: optional(anyJson()),
|
|
1142
|
-
metadata: optional(anyJson()),
|
|
1143
|
-
instances: optional(array(nonEmptyStringDecoder)),
|
|
1144
|
-
ignoreInstances: optional(array(nonEmptyStringDecoder))
|
|
2284
|
+
context: optional$1(anyJson$1()),
|
|
2285
|
+
metadata: optional$1(anyJson$1()),
|
|
2286
|
+
instances: optional$1(array$1(nonEmptyStringDecoder)),
|
|
2287
|
+
ignoreInstances: optional$1(array$1(nonEmptyStringDecoder))
|
|
1145
2288
|
});
|
|
1146
|
-
const restoreOptionsDecoder = object({
|
|
2289
|
+
const restoreOptionsDecoder = object$1({
|
|
1147
2290
|
name: nonEmptyStringDecoder,
|
|
1148
|
-
context: optional(anyJson()),
|
|
1149
|
-
closeRunningInstance: optional(boolean()),
|
|
1150
|
-
closeMe: optional(boolean()),
|
|
1151
|
-
timeout: optional(nonNegativeNumberDecoder)
|
|
2291
|
+
context: optional$1(anyJson$1()),
|
|
2292
|
+
closeRunningInstance: optional$1(boolean$1()),
|
|
2293
|
+
closeMe: optional$1(boolean$1()),
|
|
2294
|
+
timeout: optional$1(nonNegativeNumberDecoder)
|
|
1152
2295
|
});
|
|
1153
|
-
const layoutSummaryDecoder = object({
|
|
2296
|
+
const layoutSummaryDecoder = object$1({
|
|
1154
2297
|
name: nonEmptyStringDecoder,
|
|
1155
2298
|
type: layoutTypeDecoder,
|
|
1156
|
-
context: optional(anyJson()),
|
|
1157
|
-
metadata: optional(anyJson())
|
|
2299
|
+
context: optional$1(anyJson$1()),
|
|
2300
|
+
metadata: optional$1(anyJson$1())
|
|
1158
2301
|
});
|
|
1159
|
-
const simpleLayoutConfigDecoder = object({
|
|
2302
|
+
const simpleLayoutConfigDecoder = object$1({
|
|
1160
2303
|
name: nonEmptyStringDecoder,
|
|
1161
2304
|
type: layoutTypeDecoder
|
|
1162
2305
|
});
|
|
1163
|
-
const saveLayoutConfigDecoder = object({
|
|
2306
|
+
const saveLayoutConfigDecoder = object$1({
|
|
1164
2307
|
layout: newLayoutOptionsDecoder
|
|
1165
2308
|
});
|
|
1166
|
-
const restoreLayoutConfigDecoder = object({
|
|
2309
|
+
const restoreLayoutConfigDecoder = object$1({
|
|
1167
2310
|
layout: restoreOptionsDecoder
|
|
1168
2311
|
});
|
|
1169
|
-
const getAllLayoutsConfigDecoder = object({
|
|
2312
|
+
const getAllLayoutsConfigDecoder = object$1({
|
|
1170
2313
|
type: layoutTypeDecoder
|
|
1171
2314
|
});
|
|
1172
|
-
const allLayoutsFullConfigDecoder = object({
|
|
1173
|
-
layouts: array(glueLayoutDecoder)
|
|
2315
|
+
const allLayoutsFullConfigDecoder = object$1({
|
|
2316
|
+
layouts: array$1(glueLayoutDecoder)
|
|
1174
2317
|
});
|
|
1175
|
-
const importModeDecoder = oneOf(constant("replace"), constant("merge"));
|
|
1176
|
-
const layoutsImportConfigDecoder = object({
|
|
1177
|
-
layouts: array(glueLayoutDecoder),
|
|
2318
|
+
const importModeDecoder = oneOf$1(constant$1("replace"), constant$1("merge"));
|
|
2319
|
+
const layoutsImportConfigDecoder = object$1({
|
|
2320
|
+
layouts: array$1(glueLayoutDecoder),
|
|
1178
2321
|
mode: importModeDecoder,
|
|
1179
|
-
isManagerOperation: optional(boolean())
|
|
2322
|
+
isManagerOperation: optional$1(boolean$1())
|
|
1180
2323
|
});
|
|
1181
|
-
const allLayoutsSummariesResultDecoder = object({
|
|
1182
|
-
summaries: array(layoutSummaryDecoder)
|
|
2324
|
+
const allLayoutsSummariesResultDecoder = object$1({
|
|
2325
|
+
summaries: array$1(layoutSummaryDecoder)
|
|
1183
2326
|
});
|
|
1184
|
-
const simpleLayoutResultDecoder = object({
|
|
2327
|
+
const simpleLayoutResultDecoder = object$1({
|
|
1185
2328
|
layout: glueLayoutDecoder
|
|
1186
2329
|
});
|
|
1187
|
-
const optionalSimpleLayoutResult = object({
|
|
1188
|
-
layout: optional(glueLayoutDecoder)
|
|
2330
|
+
const optionalSimpleLayoutResult = object$1({
|
|
2331
|
+
layout: optional$1(glueLayoutDecoder)
|
|
1189
2332
|
});
|
|
1190
|
-
const setDefaultGlobalConfigDecoder = object({
|
|
2333
|
+
const setDefaultGlobalConfigDecoder = object$1({
|
|
1191
2334
|
name: nonEmptyStringDecoder
|
|
1192
2335
|
});
|
|
1193
|
-
const intentsOperationTypesDecoder = oneOf(constant("findIntent"), constant("getIntents"), constant("raiseIntent"), constant("raise"));
|
|
1194
|
-
const intentHandlerDecoder = object({
|
|
2336
|
+
const intentsOperationTypesDecoder = oneOf$1(constant$1("findIntent"), constant$1("getIntents"), constant$1("raiseIntent"), constant$1("raise"));
|
|
2337
|
+
const intentHandlerDecoder = object$1({
|
|
1195
2338
|
applicationName: nonEmptyStringDecoder,
|
|
1196
|
-
applicationTitle: optional(string()),
|
|
1197
|
-
applicationDescription: optional(string()),
|
|
1198
|
-
applicationIcon: optional(string()),
|
|
1199
|
-
type: oneOf(constant("app"), constant("instance")),
|
|
1200
|
-
displayName: optional(string()),
|
|
1201
|
-
contextTypes: optional(array(nonEmptyStringDecoder)),
|
|
1202
|
-
instanceId: optional(string()),
|
|
1203
|
-
instanceTitle: optional(string()),
|
|
1204
|
-
resultType: optional(string())
|
|
2339
|
+
applicationTitle: optional$1(string$1()),
|
|
2340
|
+
applicationDescription: optional$1(string$1()),
|
|
2341
|
+
applicationIcon: optional$1(string$1()),
|
|
2342
|
+
type: oneOf$1(constant$1("app"), constant$1("instance")),
|
|
2343
|
+
displayName: optional$1(string$1()),
|
|
2344
|
+
contextTypes: optional$1(array$1(nonEmptyStringDecoder)),
|
|
2345
|
+
instanceId: optional$1(string$1()),
|
|
2346
|
+
instanceTitle: optional$1(string$1()),
|
|
2347
|
+
resultType: optional$1(string$1())
|
|
1205
2348
|
});
|
|
1206
|
-
object({
|
|
1207
|
-
applicationName: string(),
|
|
1208
|
-
applicationIcon: optional(string()),
|
|
1209
|
-
instanceId: optional(string()),
|
|
2349
|
+
object$1({
|
|
2350
|
+
applicationName: string$1(),
|
|
2351
|
+
applicationIcon: optional$1(string$1()),
|
|
2352
|
+
instanceId: optional$1(string$1()),
|
|
1210
2353
|
});
|
|
1211
|
-
const intentResolverResponseDecoder = object({
|
|
2354
|
+
const intentResolverResponseDecoder = object$1({
|
|
1212
2355
|
intent: nonEmptyStringDecoder,
|
|
1213
2356
|
handler: intentHandlerDecoder
|
|
1214
2357
|
});
|
|
1215
|
-
const intentDecoder = object({
|
|
2358
|
+
const intentDecoder = object$1({
|
|
1216
2359
|
name: nonEmptyStringDecoder,
|
|
1217
|
-
handlers: array(intentHandlerDecoder)
|
|
2360
|
+
handlers: array$1(intentHandlerDecoder)
|
|
1218
2361
|
});
|
|
1219
|
-
const intentTargetDecoder = oneOf(constant("startNew"), constant("reuse"), object({
|
|
1220
|
-
app: optional(nonEmptyStringDecoder),
|
|
1221
|
-
instance: optional(nonEmptyStringDecoder)
|
|
2362
|
+
const intentTargetDecoder = oneOf$1(constant$1("startNew"), constant$1("reuse"), object$1({
|
|
2363
|
+
app: optional$1(nonEmptyStringDecoder),
|
|
2364
|
+
instance: optional$1(nonEmptyStringDecoder)
|
|
1222
2365
|
}));
|
|
1223
|
-
const intentContextDecoder = object({
|
|
1224
|
-
type: optional(nonEmptyStringDecoder),
|
|
1225
|
-
data: optional(anyJson())
|
|
2366
|
+
const intentContextDecoder = object$1({
|
|
2367
|
+
type: optional$1(nonEmptyStringDecoder),
|
|
2368
|
+
data: optional$1(anyJson$1())
|
|
1226
2369
|
});
|
|
1227
|
-
const intentsDecoder = array(intentDecoder);
|
|
1228
|
-
const wrappedIntentsDecoder = object({
|
|
2370
|
+
const intentsDecoder = array$1(intentDecoder);
|
|
2371
|
+
const wrappedIntentsDecoder = object$1({
|
|
1229
2372
|
intents: intentsDecoder
|
|
1230
2373
|
});
|
|
1231
|
-
const intentFilterDecoder = object({
|
|
1232
|
-
name: optional(nonEmptyStringDecoder),
|
|
1233
|
-
contextType: optional(nonEmptyStringDecoder),
|
|
1234
|
-
resultType: optional(nonEmptyStringDecoder)
|
|
2374
|
+
const intentFilterDecoder = object$1({
|
|
2375
|
+
name: optional$1(nonEmptyStringDecoder),
|
|
2376
|
+
contextType: optional$1(nonEmptyStringDecoder),
|
|
2377
|
+
resultType: optional$1(nonEmptyStringDecoder)
|
|
1235
2378
|
});
|
|
1236
|
-
const findFilterDecoder = oneOf(nonEmptyStringDecoder, intentFilterDecoder);
|
|
1237
|
-
const wrappedIntentFilterDecoder = object({
|
|
1238
|
-
filter: optional(intentFilterDecoder)
|
|
2379
|
+
const findFilterDecoder = oneOf$1(nonEmptyStringDecoder, intentFilterDecoder);
|
|
2380
|
+
const wrappedIntentFilterDecoder = object$1({
|
|
2381
|
+
filter: optional$1(intentFilterDecoder)
|
|
1239
2382
|
});
|
|
1240
|
-
const intentRequestDecoder = object({
|
|
2383
|
+
const intentRequestDecoder = object$1({
|
|
1241
2384
|
intent: nonEmptyStringDecoder,
|
|
1242
|
-
target: optional(intentTargetDecoder),
|
|
1243
|
-
context: optional(intentContextDecoder),
|
|
1244
|
-
options: optional(windowOpenSettingsDecoder),
|
|
1245
|
-
handlers: optional(array(intentHandlerDecoder)),
|
|
1246
|
-
timeout: optional(nonNegativeNumberDecoder),
|
|
1247
|
-
waitUserResponseIndefinitely: optional(boolean())
|
|
2385
|
+
target: optional$1(intentTargetDecoder),
|
|
2386
|
+
context: optional$1(intentContextDecoder),
|
|
2387
|
+
options: optional$1(windowOpenSettingsDecoder),
|
|
2388
|
+
handlers: optional$1(array$1(intentHandlerDecoder)),
|
|
2389
|
+
timeout: optional$1(nonNegativeNumberDecoder),
|
|
2390
|
+
waitUserResponseIndefinitely: optional$1(boolean$1())
|
|
1248
2391
|
});
|
|
1249
|
-
const raiseRequestDecoder = oneOf(nonEmptyStringDecoder, intentRequestDecoder);
|
|
1250
|
-
const intentRequestResolverConfigDecoder = object({
|
|
1251
|
-
enabled: boolean(),
|
|
2392
|
+
const raiseRequestDecoder = oneOf$1(nonEmptyStringDecoder, intentRequestDecoder);
|
|
2393
|
+
const intentRequestResolverConfigDecoder = object$1({
|
|
2394
|
+
enabled: boolean$1(),
|
|
1252
2395
|
appName: nonEmptyStringDecoder,
|
|
1253
|
-
waitResponseTimeout: number()
|
|
2396
|
+
waitResponseTimeout: number$1()
|
|
1254
2397
|
});
|
|
1255
|
-
const raiseIntentRequestDecoder = object({
|
|
2398
|
+
const raiseIntentRequestDecoder = object$1({
|
|
1256
2399
|
intentRequest: intentRequestDecoder,
|
|
1257
2400
|
resolverConfig: intentRequestResolverConfigDecoder
|
|
1258
2401
|
});
|
|
1259
|
-
const intentResultDecoder = object({
|
|
2402
|
+
const intentResultDecoder = object$1({
|
|
1260
2403
|
request: intentRequestDecoder,
|
|
1261
2404
|
handler: intentHandlerDecoder,
|
|
1262
|
-
result: anyJson()
|
|
2405
|
+
result: anyJson$1()
|
|
1263
2406
|
});
|
|
1264
|
-
const AddIntentListenerRequestDecoder = object({
|
|
2407
|
+
const AddIntentListenerRequestDecoder = object$1({
|
|
1265
2408
|
intent: nonEmptyStringDecoder,
|
|
1266
|
-
contextTypes: optional(array(nonEmptyStringDecoder)),
|
|
1267
|
-
displayName: optional(string()),
|
|
1268
|
-
icon: optional(string()),
|
|
1269
|
-
description: optional(string()),
|
|
1270
|
-
resultType: optional(string())
|
|
2409
|
+
contextTypes: optional$1(array$1(nonEmptyStringDecoder)),
|
|
2410
|
+
displayName: optional$1(string$1()),
|
|
2411
|
+
icon: optional$1(string$1()),
|
|
2412
|
+
description: optional$1(string$1()),
|
|
2413
|
+
resultType: optional$1(string$1())
|
|
1271
2414
|
});
|
|
1272
|
-
const AddIntentListenerDecoder = oneOf(nonEmptyStringDecoder, AddIntentListenerRequestDecoder);
|
|
2415
|
+
const AddIntentListenerDecoder = oneOf$1(nonEmptyStringDecoder, AddIntentListenerRequestDecoder);
|
|
1273
2416
|
const channelNameDecoder = (channelNames) => {
|
|
1274
2417
|
return nonEmptyStringDecoder.where(s => channelNames.includes(s), "Expected a valid channel name");
|
|
1275
2418
|
};
|
|
1276
|
-
const interopActionSettingsDecoder = object({
|
|
2419
|
+
const interopActionSettingsDecoder = object$1({
|
|
1277
2420
|
method: nonEmptyStringDecoder,
|
|
1278
|
-
arguments: optional(anyJson()),
|
|
1279
|
-
target: optional(oneOf(constant("all"), constant("best")))
|
|
2421
|
+
arguments: optional$1(anyJson$1()),
|
|
2422
|
+
target: optional$1(oneOf$1(constant$1("all"), constant$1("best")))
|
|
1280
2423
|
});
|
|
1281
|
-
const glue42NotificationActionDecoder = object({
|
|
1282
|
-
action: string(),
|
|
2424
|
+
const glue42NotificationActionDecoder = object$1({
|
|
2425
|
+
action: string$1(),
|
|
1283
2426
|
title: nonEmptyStringDecoder,
|
|
1284
|
-
icon: optional(string()),
|
|
1285
|
-
interop: optional(interopActionSettingsDecoder)
|
|
2427
|
+
icon: optional$1(string$1()),
|
|
2428
|
+
interop: optional$1(interopActionSettingsDecoder)
|
|
1286
2429
|
});
|
|
1287
|
-
const notificationDefinitionDecoder = object({
|
|
1288
|
-
badge: optional(string()),
|
|
1289
|
-
body: optional(string()),
|
|
1290
|
-
data: optional(anyJson()),
|
|
1291
|
-
dir: optional(oneOf(constant("auto"), constant("ltr"), constant("rtl"))),
|
|
1292
|
-
icon: optional(string()),
|
|
1293
|
-
image: optional(string()),
|
|
1294
|
-
lang: optional(string()),
|
|
1295
|
-
renotify: optional(boolean()),
|
|
1296
|
-
requireInteraction: optional(boolean()),
|
|
1297
|
-
silent: optional(boolean()),
|
|
1298
|
-
tag: optional(string()),
|
|
1299
|
-
timestamp: optional(nonNegativeNumberDecoder),
|
|
1300
|
-
vibrate: optional(array(number()))
|
|
2430
|
+
const notificationDefinitionDecoder = object$1({
|
|
2431
|
+
badge: optional$1(string$1()),
|
|
2432
|
+
body: optional$1(string$1()),
|
|
2433
|
+
data: optional$1(anyJson$1()),
|
|
2434
|
+
dir: optional$1(oneOf$1(constant$1("auto"), constant$1("ltr"), constant$1("rtl"))),
|
|
2435
|
+
icon: optional$1(string$1()),
|
|
2436
|
+
image: optional$1(string$1()),
|
|
2437
|
+
lang: optional$1(string$1()),
|
|
2438
|
+
renotify: optional$1(boolean$1()),
|
|
2439
|
+
requireInteraction: optional$1(boolean$1()),
|
|
2440
|
+
silent: optional$1(boolean$1()),
|
|
2441
|
+
tag: optional$1(string$1()),
|
|
2442
|
+
timestamp: optional$1(nonNegativeNumberDecoder),
|
|
2443
|
+
vibrate: optional$1(array$1(number$1()))
|
|
1301
2444
|
});
|
|
1302
|
-
const glue42NotificationOptionsDecoder = object({
|
|
2445
|
+
const glue42NotificationOptionsDecoder = object$1({
|
|
1303
2446
|
title: nonEmptyStringDecoder,
|
|
1304
|
-
clickInterop: optional(interopActionSettingsDecoder),
|
|
1305
|
-
actions: optional(array(glue42NotificationActionDecoder)),
|
|
1306
|
-
focusPlatformOnDefaultClick: optional(boolean()),
|
|
1307
|
-
badge: optional(string()),
|
|
1308
|
-
body: optional(string()),
|
|
1309
|
-
data: optional(anyJson()),
|
|
1310
|
-
dir: optional(oneOf(constant("auto"), constant("ltr"), constant("rtl"))),
|
|
1311
|
-
icon: optional(string()),
|
|
1312
|
-
image: optional(string()),
|
|
1313
|
-
lang: optional(string()),
|
|
1314
|
-
renotify: optional(boolean()),
|
|
1315
|
-
requireInteraction: optional(boolean()),
|
|
1316
|
-
silent: optional(boolean()),
|
|
1317
|
-
tag: optional(string()),
|
|
1318
|
-
timestamp: optional(nonNegativeNumberDecoder),
|
|
1319
|
-
vibrate: optional(array(number())),
|
|
1320
|
-
severity: optional(oneOf(constant("Low"), constant("None"), constant("Medium"), constant("High"), constant("Critical"))),
|
|
1321
|
-
showToast: optional(boolean()),
|
|
1322
|
-
showInPanel: optional(boolean())
|
|
2447
|
+
clickInterop: optional$1(interopActionSettingsDecoder),
|
|
2448
|
+
actions: optional$1(array$1(glue42NotificationActionDecoder)),
|
|
2449
|
+
focusPlatformOnDefaultClick: optional$1(boolean$1()),
|
|
2450
|
+
badge: optional$1(string$1()),
|
|
2451
|
+
body: optional$1(string$1()),
|
|
2452
|
+
data: optional$1(anyJson$1()),
|
|
2453
|
+
dir: optional$1(oneOf$1(constant$1("auto"), constant$1("ltr"), constant$1("rtl"))),
|
|
2454
|
+
icon: optional$1(string$1()),
|
|
2455
|
+
image: optional$1(string$1()),
|
|
2456
|
+
lang: optional$1(string$1()),
|
|
2457
|
+
renotify: optional$1(boolean$1()),
|
|
2458
|
+
requireInteraction: optional$1(boolean$1()),
|
|
2459
|
+
silent: optional$1(boolean$1()),
|
|
2460
|
+
tag: optional$1(string$1()),
|
|
2461
|
+
timestamp: optional$1(nonNegativeNumberDecoder),
|
|
2462
|
+
vibrate: optional$1(array$1(number$1())),
|
|
2463
|
+
severity: optional$1(oneOf$1(constant$1("Low"), constant$1("None"), constant$1("Medium"), constant$1("High"), constant$1("Critical"))),
|
|
2464
|
+
showToast: optional$1(boolean$1()),
|
|
2465
|
+
showInPanel: optional$1(boolean$1())
|
|
1323
2466
|
});
|
|
1324
|
-
const channelContextDecoder = object({
|
|
2467
|
+
const channelContextDecoder = object$1({
|
|
1325
2468
|
name: nonEmptyStringDecoder,
|
|
1326
|
-
meta: object({
|
|
2469
|
+
meta: object$1({
|
|
1327
2470
|
color: nonEmptyStringDecoder
|
|
1328
2471
|
}),
|
|
1329
|
-
data: optional(object()),
|
|
2472
|
+
data: optional$1(object$1()),
|
|
1330
2473
|
});
|
|
1331
|
-
const raiseNotificationDecoder = object({
|
|
2474
|
+
const raiseNotificationDecoder = object$1({
|
|
1332
2475
|
settings: glue42NotificationOptionsDecoder,
|
|
1333
2476
|
id: nonEmptyStringDecoder
|
|
1334
2477
|
});
|
|
1335
|
-
const raiseNotificationResultDecoder = object({
|
|
2478
|
+
const raiseNotificationResultDecoder = object$1({
|
|
1336
2479
|
settings: glue42NotificationOptionsDecoder
|
|
1337
2480
|
});
|
|
1338
|
-
const permissionRequestResultDecoder = object({
|
|
1339
|
-
permissionGranted: boolean()
|
|
2481
|
+
const permissionRequestResultDecoder = object$1({
|
|
2482
|
+
permissionGranted: boolean$1()
|
|
1340
2483
|
});
|
|
1341
|
-
const permissionQueryResultDecoder = object({
|
|
1342
|
-
permission: oneOf(constant("default"), constant("granted"), constant("denied"))
|
|
2484
|
+
const permissionQueryResultDecoder = object$1({
|
|
2485
|
+
permission: oneOf$1(constant$1("default"), constant$1("granted"), constant$1("denied"))
|
|
1343
2486
|
});
|
|
1344
|
-
const notificationEventPayloadDecoder = object({
|
|
2487
|
+
const notificationEventPayloadDecoder = object$1({
|
|
1345
2488
|
definition: notificationDefinitionDecoder,
|
|
1346
|
-
action: optional(string()),
|
|
1347
|
-
id: optional(nonEmptyStringDecoder)
|
|
2489
|
+
action: optional$1(string$1()),
|
|
2490
|
+
id: optional$1(nonEmptyStringDecoder)
|
|
1348
2491
|
});
|
|
1349
|
-
const platformSaveRequestConfigDecoder = object({
|
|
1350
|
-
layoutType: oneOf(constant("Global"), constant("Workspace")),
|
|
2492
|
+
const platformSaveRequestConfigDecoder = object$1({
|
|
2493
|
+
layoutType: oneOf$1(constant$1("Global"), constant$1("Workspace")),
|
|
1351
2494
|
layoutName: nonEmptyStringDecoder,
|
|
1352
|
-
context: optional(anyJson())
|
|
2495
|
+
context: optional$1(anyJson$1())
|
|
1353
2496
|
});
|
|
1354
|
-
const saveRequestClientResponseDecoder = object({
|
|
1355
|
-
windowContext: optional(anyJson()),
|
|
2497
|
+
const saveRequestClientResponseDecoder = object$1({
|
|
2498
|
+
windowContext: optional$1(anyJson$1()),
|
|
1356
2499
|
});
|
|
1357
|
-
const permissionStateResultDecoder = object({
|
|
1358
|
-
state: oneOf(constant("prompt"), constant("denied"), constant("granted"))
|
|
2500
|
+
const permissionStateResultDecoder = object$1({
|
|
2501
|
+
state: oneOf$1(constant$1("prompt"), constant$1("denied"), constant$1("granted"))
|
|
1359
2502
|
});
|
|
1360
|
-
const simpleAvailabilityResultDecoder = object({
|
|
1361
|
-
isAvailable: boolean()
|
|
2503
|
+
const simpleAvailabilityResultDecoder = object$1({
|
|
2504
|
+
isAvailable: boolean$1()
|
|
1362
2505
|
});
|
|
1363
|
-
const simpleItemIdDecoder = object({
|
|
2506
|
+
const simpleItemIdDecoder = object$1({
|
|
1364
2507
|
itemId: nonEmptyStringDecoder
|
|
1365
2508
|
});
|
|
1366
|
-
const operationCheckResultDecoder = object({
|
|
1367
|
-
isSupported: boolean()
|
|
2509
|
+
const operationCheckResultDecoder = object$1({
|
|
2510
|
+
isSupported: boolean$1()
|
|
1368
2511
|
});
|
|
1369
|
-
const operationCheckConfigDecoder = object({
|
|
2512
|
+
const operationCheckConfigDecoder = object$1({
|
|
1370
2513
|
operation: nonEmptyStringDecoder
|
|
1371
2514
|
});
|
|
1372
|
-
const workspaceFrameBoundsResultDecoder = object({
|
|
2515
|
+
const workspaceFrameBoundsResultDecoder = object$1({
|
|
1373
2516
|
bounds: windowBoundsDecoder
|
|
1374
2517
|
});
|
|
1375
|
-
const themeDecoder = object({
|
|
2518
|
+
const themeDecoder = object$1({
|
|
1376
2519
|
displayName: nonEmptyStringDecoder,
|
|
1377
2520
|
name: nonEmptyStringDecoder
|
|
1378
2521
|
});
|
|
1379
|
-
const simpleThemeResponseDecoder = object({
|
|
2522
|
+
const simpleThemeResponseDecoder = object$1({
|
|
1380
2523
|
theme: themeDecoder
|
|
1381
2524
|
});
|
|
1382
|
-
const allThemesResponseDecoder = object({
|
|
1383
|
-
themes: array(themeDecoder)
|
|
2525
|
+
const allThemesResponseDecoder = object$1({
|
|
2526
|
+
themes: array$1(themeDecoder)
|
|
1384
2527
|
});
|
|
1385
|
-
const selectThemeConfigDecoder = object({
|
|
2528
|
+
const selectThemeConfigDecoder = object$1({
|
|
1386
2529
|
name: nonEmptyStringDecoder
|
|
1387
2530
|
});
|
|
1388
|
-
const notificationsDataDecoder = object({
|
|
2531
|
+
const notificationsDataDecoder = object$1({
|
|
1389
2532
|
id: nonEmptyStringDecoder,
|
|
1390
2533
|
title: nonEmptyStringDecoder,
|
|
1391
|
-
clickInterop: optional(interopActionSettingsDecoder),
|
|
1392
|
-
actions: optional(array(glue42NotificationActionDecoder)),
|
|
1393
|
-
focusPlatformOnDefaultClick: optional(boolean()),
|
|
1394
|
-
badge: optional(string()),
|
|
1395
|
-
body: optional(string()),
|
|
1396
|
-
data: optional(anyJson()),
|
|
1397
|
-
dir: optional(oneOf(constant("auto"), constant("ltr"), constant("rtl"))),
|
|
1398
|
-
icon: optional(string()),
|
|
1399
|
-
image: optional(string()),
|
|
1400
|
-
lang: optional(string()),
|
|
1401
|
-
renotify: optional(boolean()),
|
|
1402
|
-
requireInteraction: optional(boolean()),
|
|
1403
|
-
silent: optional(boolean()),
|
|
1404
|
-
tag: optional(string()),
|
|
1405
|
-
timestamp: optional(nonNegativeNumberDecoder),
|
|
1406
|
-
vibrate: optional(array(number())),
|
|
1407
|
-
severity: optional(oneOf(constant("Low"), constant("None"), constant("Medium"), constant("High"), constant("Critical"))),
|
|
1408
|
-
showToast: optional(boolean()),
|
|
1409
|
-
showInPanel: optional(boolean())
|
|
2534
|
+
clickInterop: optional$1(interopActionSettingsDecoder),
|
|
2535
|
+
actions: optional$1(array$1(glue42NotificationActionDecoder)),
|
|
2536
|
+
focusPlatformOnDefaultClick: optional$1(boolean$1()),
|
|
2537
|
+
badge: optional$1(string$1()),
|
|
2538
|
+
body: optional$1(string$1()),
|
|
2539
|
+
data: optional$1(anyJson$1()),
|
|
2540
|
+
dir: optional$1(oneOf$1(constant$1("auto"), constant$1("ltr"), constant$1("rtl"))),
|
|
2541
|
+
icon: optional$1(string$1()),
|
|
2542
|
+
image: optional$1(string$1()),
|
|
2543
|
+
lang: optional$1(string$1()),
|
|
2544
|
+
renotify: optional$1(boolean$1()),
|
|
2545
|
+
requireInteraction: optional$1(boolean$1()),
|
|
2546
|
+
silent: optional$1(boolean$1()),
|
|
2547
|
+
tag: optional$1(string$1()),
|
|
2548
|
+
timestamp: optional$1(nonNegativeNumberDecoder),
|
|
2549
|
+
vibrate: optional$1(array$1(number$1())),
|
|
2550
|
+
severity: optional$1(oneOf$1(constant$1("Low"), constant$1("None"), constant$1("Medium"), constant$1("High"), constant$1("Critical"))),
|
|
2551
|
+
showToast: optional$1(boolean$1()),
|
|
2552
|
+
showInPanel: optional$1(boolean$1())
|
|
1410
2553
|
});
|
|
1411
|
-
const simpleNotificationDataDecoder = object({
|
|
2554
|
+
const simpleNotificationDataDecoder = object$1({
|
|
1412
2555
|
notification: notificationsDataDecoder
|
|
1413
2556
|
});
|
|
1414
|
-
const allNotificationsDataDecoder = object({
|
|
1415
|
-
notifications: array(notificationsDataDecoder)
|
|
2557
|
+
const allNotificationsDataDecoder = object$1({
|
|
2558
|
+
notifications: array$1(notificationsDataDecoder)
|
|
1416
2559
|
});
|
|
1417
|
-
const simpleNotificationSelectDecoder = object({
|
|
2560
|
+
const simpleNotificationSelectDecoder = object$1({
|
|
1418
2561
|
id: nonEmptyStringDecoder
|
|
2562
|
+
});
|
|
2563
|
+
const getWindowIdsOnChannelDataDecoder = object$1({
|
|
2564
|
+
channel: nonEmptyStringDecoder
|
|
2565
|
+
});
|
|
2566
|
+
const getWindowIdsOnChannelResultDecoder = object$1({
|
|
2567
|
+
windowIds: array$1(nonEmptyStringDecoder)
|
|
2568
|
+
});
|
|
2569
|
+
const channelsOperationTypesDecoder = oneOf$1(constant$1("addChannel"), constant$1("getMyChannel"), constant$1("getWindowIdsOnChannel"), constant$1("getWindowIdsWithChannels"), constant$1("joinChannel"));
|
|
2570
|
+
const getMyChanelResultDecoder = object$1({
|
|
2571
|
+
channel: optional$1(nonEmptyStringDecoder)
|
|
2572
|
+
});
|
|
2573
|
+
const windowWithChannelFilterDecoder = object$1({
|
|
2574
|
+
application: optional$1(nonEmptyStringDecoder),
|
|
2575
|
+
channels: optional$1(array$1(nonEmptyStringDecoder)),
|
|
2576
|
+
windowIds: optional$1(array$1(nonEmptyStringDecoder))
|
|
2577
|
+
});
|
|
2578
|
+
const wrappedWindowWithChannelFilterDecoder = object$1({
|
|
2579
|
+
filter: optional$1(windowWithChannelFilterDecoder)
|
|
2580
|
+
});
|
|
2581
|
+
const getWindowIdsWithChannelsResultDecoder = object$1({
|
|
2582
|
+
windowIdsWithChannels: array$1(object$1({
|
|
2583
|
+
application: nonEmptyStringDecoder,
|
|
2584
|
+
channel: optional$1(nonEmptyStringDecoder),
|
|
2585
|
+
windowId: nonEmptyStringDecoder
|
|
2586
|
+
}))
|
|
2587
|
+
});
|
|
2588
|
+
const startApplicationContextDecoder = optional$1(anyJson$1());
|
|
2589
|
+
const startApplicationOptionsDecoder = optional$1(object$1({
|
|
2590
|
+
top: optional$1(number$1()),
|
|
2591
|
+
left: optional$1(number$1()),
|
|
2592
|
+
width: optional$1(nonNegativeNumberDecoder),
|
|
2593
|
+
height: optional$1(nonNegativeNumberDecoder),
|
|
2594
|
+
relativeTo: optional$1(nonEmptyStringDecoder),
|
|
2595
|
+
relativeDirection: optional$1(windowRelativeDirectionDecoder),
|
|
2596
|
+
waitForAGMReady: optional$1(boolean$1()),
|
|
2597
|
+
channelId: optional$1(nonEmptyStringDecoder),
|
|
2598
|
+
reuseId: optional$1(nonEmptyStringDecoder),
|
|
2599
|
+
}));
|
|
2600
|
+
const joinChannelDataDecoder = object$1({
|
|
2601
|
+
channel: nonEmptyStringDecoder,
|
|
2602
|
+
windowId: nonEmptyStringDecoder
|
|
2603
|
+
});
|
|
2604
|
+
const windowChannelResultDecoder = object$1({
|
|
2605
|
+
channel: optional$1(nonEmptyStringDecoder),
|
|
1419
2606
|
});
|
|
1420
2607
|
|
|
1421
2608
|
const operations$8 = {
|
|
@@ -1431,7 +2618,8 @@ const operations$8 = {
|
|
|
1431
2618
|
close: { name: "close", dataDecoder: simpleWindowDecoder },
|
|
1432
2619
|
getTitle: { name: "getTitle", dataDecoder: simpleWindowDecoder, resultDecoder: windowTitleConfigDecoder },
|
|
1433
2620
|
setTitle: { name: "setTitle", dataDecoder: windowTitleConfigDecoder },
|
|
1434
|
-
focusChange: { name: "focusChange", dataDecoder: focusEventDataDecoder }
|
|
2621
|
+
focusChange: { name: "focusChange", dataDecoder: focusEventDataDecoder },
|
|
2622
|
+
getChannel: { name: "getChannel", dataDecoder: simpleWindowDecoder, resultDecoder: windowChannelResultDecoder },
|
|
1435
2623
|
};
|
|
1436
2624
|
|
|
1437
2625
|
function getDefaultExportFromCjs$1 (x) {
|
|
@@ -1598,7 +2786,8 @@ class WebWindowModel {
|
|
|
1598
2786
|
updateContext: this.updateContext.bind(this),
|
|
1599
2787
|
setContext: this.setContext.bind(this),
|
|
1600
2788
|
onContextUpdated: this.onContextUpdated.bind(this),
|
|
1601
|
-
onFocusChanged: this.onFocusChanged.bind(this)
|
|
2789
|
+
onFocusChanged: this.onFocusChanged.bind(this),
|
|
2790
|
+
getChannel: this.getChannel.bind(this),
|
|
1602
2791
|
};
|
|
1603
2792
|
return this.me;
|
|
1604
2793
|
});
|
|
@@ -1645,10 +2834,10 @@ class WebWindowModel {
|
|
|
1645
2834
|
return this.me;
|
|
1646
2835
|
}
|
|
1647
2836
|
if (typeof top !== "undefined") {
|
|
1648
|
-
number().runWithException(top);
|
|
2837
|
+
number$1().runWithException(top);
|
|
1649
2838
|
}
|
|
1650
2839
|
if (typeof left !== "undefined") {
|
|
1651
|
-
number().runWithException(left);
|
|
2840
|
+
number$1().runWithException(left);
|
|
1652
2841
|
}
|
|
1653
2842
|
const commandArgs = Object.assign({}, { top, left }, { windowId: this.id, relative: true });
|
|
1654
2843
|
yield this._bridge.send("windows", operations$8.moveResize, commandArgs);
|
|
@@ -1720,6 +2909,12 @@ class WebWindowModel {
|
|
|
1720
2909
|
};
|
|
1721
2910
|
return this.registry.add("context-updated", wrappedCallback);
|
|
1722
2911
|
}
|
|
2912
|
+
getChannel() {
|
|
2913
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
2914
|
+
const result = yield this._bridge.send("windows", operations$8.getChannel, { windowId: this.id }, undefined, { includeOperationCheck: true });
|
|
2915
|
+
return result.channel;
|
|
2916
|
+
});
|
|
2917
|
+
}
|
|
1723
2918
|
}
|
|
1724
2919
|
|
|
1725
2920
|
const systemOperations = {
|
|
@@ -1790,6 +2985,7 @@ class WindowsController {
|
|
|
1790
2985
|
this.ioc = ioc;
|
|
1791
2986
|
this.bridge = ioc.bridge;
|
|
1792
2987
|
this.instanceId = coreGlue.interop.instance.instance;
|
|
2988
|
+
this.channelsController = ioc.channelsController;
|
|
1793
2989
|
this.logger.trace(`set the public window id: ${this.publicWindowId}, set the bridge operations and ioc, registering with the platform now`);
|
|
1794
2990
|
this.platformRegistration = this.registerWithPlatform();
|
|
1795
2991
|
yield this.platformRegistration;
|
|
@@ -1863,6 +3059,7 @@ class WindowsController {
|
|
|
1863
3059
|
operations$8.getUrl.execute = this.handleGetUrl.bind(this);
|
|
1864
3060
|
operations$8.moveResize.execute = this.handleMoveResize.bind(this);
|
|
1865
3061
|
operations$8.setTitle.execute = this.handleSetTitle.bind(this);
|
|
3062
|
+
operations$8.getChannel.execute = this.handleGetChannel.bind(this);
|
|
1866
3063
|
}
|
|
1867
3064
|
my() {
|
|
1868
3065
|
return Object.assign({}, this.me);
|
|
@@ -2068,6 +3265,15 @@ class WindowsController {
|
|
|
2068
3265
|
window.addEventListener("focus", this.focusEventHandler);
|
|
2069
3266
|
window.addEventListener("blur", this.focusEventHandler);
|
|
2070
3267
|
}
|
|
3268
|
+
handleGetChannel() {
|
|
3269
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
3270
|
+
if (!this.me) {
|
|
3271
|
+
throw new Error("This window cannot report it's channel, because it is not a Glue Window, most likely because it is an iframe");
|
|
3272
|
+
}
|
|
3273
|
+
const channel = this.channelsController.my();
|
|
3274
|
+
return Object.assign({}, (channel ? { channel } : {}));
|
|
3275
|
+
});
|
|
3276
|
+
}
|
|
2071
3277
|
}
|
|
2072
3278
|
|
|
2073
3279
|
const GlueWebPlatformControlName = "T42.Web.Platform.Control";
|
|
@@ -2285,6 +3491,8 @@ class AppManagerController {
|
|
|
2285
3491
|
this.addOperationsExecutors();
|
|
2286
3492
|
this.ioc = ioc;
|
|
2287
3493
|
this.bridge = ioc.bridge;
|
|
3494
|
+
this.channelsController = ioc.channelsController;
|
|
3495
|
+
this.sessionController = ioc.sessionController;
|
|
2288
3496
|
this.platformRegistration = this.registerWithPlatform();
|
|
2289
3497
|
yield this.platformRegistration;
|
|
2290
3498
|
this.logger.trace("registration with the platform successful, attaching the appManager property to glue and returning");
|
|
@@ -2322,6 +3530,10 @@ class AppManagerController {
|
|
|
2322
3530
|
startApplication(appName, context, options) {
|
|
2323
3531
|
var _a;
|
|
2324
3532
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
3533
|
+
const channels = yield this.channelsController.all();
|
|
3534
|
+
if ((options === null || options === void 0 ? void 0 : options.channelId) && !channels.includes(options.channelId)) {
|
|
3535
|
+
throw new Error(`The channel with name "${options.channelId}" doesn't exist!`);
|
|
3536
|
+
}
|
|
2325
3537
|
const startOptions = {
|
|
2326
3538
|
name: appName,
|
|
2327
3539
|
waitForAGMReady: (_a = options === null || options === void 0 ? void 0 : options.waitForAGMReady) !== null && _a !== void 0 ? _a : true,
|
|
@@ -2334,7 +3546,8 @@ class AppManagerController {
|
|
|
2334
3546
|
relativeDirection: options === null || options === void 0 ? void 0 : options.relativeDirection,
|
|
2335
3547
|
id: options === null || options === void 0 ? void 0 : options.reuseId,
|
|
2336
3548
|
forceChromeTab: options === null || options === void 0 ? void 0 : options.forceTab,
|
|
2337
|
-
layoutComponentId: options === null || options === void 0 ? void 0 : options.layoutComponentId
|
|
3549
|
+
layoutComponentId: options === null || options === void 0 ? void 0 : options.layoutComponentId,
|
|
3550
|
+
channelId: options === null || options === void 0 ? void 0 : options.channelId
|
|
2338
3551
|
};
|
|
2339
3552
|
const openResult = yield this.bridge.send("appManager", operations$7.applicationStart, startOptions);
|
|
2340
3553
|
const app = this.applications.find((a) => a.name === openResult.applicationName);
|
|
@@ -2515,6 +3728,16 @@ class AppManagerController {
|
|
|
2515
3728
|
getApplications() {
|
|
2516
3729
|
return this.applications.slice();
|
|
2517
3730
|
}
|
|
3731
|
+
joinInitialChannel(initialChannelId) {
|
|
3732
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
3733
|
+
try {
|
|
3734
|
+
yield this.channelsController.join(initialChannelId);
|
|
3735
|
+
}
|
|
3736
|
+
catch (error) {
|
|
3737
|
+
this.logger.warn(`Application instance ${this.me} was unable to join the ${initialChannelId} channel. Reason: ${JSON.stringify(error)}`);
|
|
3738
|
+
}
|
|
3739
|
+
});
|
|
3740
|
+
}
|
|
2518
3741
|
registerWithPlatform() {
|
|
2519
3742
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
2520
3743
|
const result = yield this.bridge.send("appManager", operations$7.appHello, { windowId: this.publicWindowId }, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
|
|
@@ -2526,6 +3749,11 @@ class AppManagerController {
|
|
|
2526
3749
|
}, []);
|
|
2527
3750
|
this.me = this.findMyInstance();
|
|
2528
3751
|
this.logger.trace(`all applications were parsed and saved. I am ${this.me ? "NOT a" : "a"} valid instance`);
|
|
3752
|
+
const { channels: channelsStorageData } = this.sessionController.getWindowData();
|
|
3753
|
+
const channel = channelsStorageData ? channelsStorageData.currentName : result.initialChannelId;
|
|
3754
|
+
if (channel) {
|
|
3755
|
+
yield this.joinInitialChannel(channel);
|
|
3756
|
+
}
|
|
2529
3757
|
});
|
|
2530
3758
|
}
|
|
2531
3759
|
findMyInstance() {
|
|
@@ -2535,6 +3763,7 @@ class AppManagerController {
|
|
|
2535
3763
|
return foundInstance;
|
|
2536
3764
|
}
|
|
2537
3765
|
}
|
|
3766
|
+
return undefined;
|
|
2538
3767
|
}
|
|
2539
3768
|
}
|
|
2540
3769
|
|
|
@@ -2613,7 +3842,9 @@ class ApplicationModel {
|
|
|
2613
3842
|
}
|
|
2614
3843
|
start(context, options) {
|
|
2615
3844
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
2616
|
-
|
|
3845
|
+
const verifiedContext = startApplicationContextDecoder.runWithException(context);
|
|
3846
|
+
const verifiedOptions = startApplicationOptionsDecoder.runWithException(options);
|
|
3847
|
+
return this.controller.startApplication(this.data.name, verifiedContext, verifiedOptions);
|
|
2617
3848
|
});
|
|
2618
3849
|
}
|
|
2619
3850
|
}
|
|
@@ -3538,7 +4769,7 @@ class IntentsController {
|
|
|
3538
4769
|
};
|
|
3539
4770
|
let intentFlag = {};
|
|
3540
4771
|
if (typeof intent === "object") {
|
|
3541
|
-
const rest = __rest$
|
|
4772
|
+
const rest = __rest$2(intent, ["intent"]);
|
|
3542
4773
|
intentFlag = rest;
|
|
3543
4774
|
}
|
|
3544
4775
|
registerPromise = this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
|
|
@@ -3568,7 +4799,7 @@ class IntentsController {
|
|
|
3568
4799
|
this.myIntents.add(intentName);
|
|
3569
4800
|
let intentFlag = {};
|
|
3570
4801
|
if (typeof intent === "object") {
|
|
3571
|
-
const rest = __rest$
|
|
4802
|
+
const rest = __rest$2(intent, ["intent"]);
|
|
3572
4803
|
intentFlag = rest;
|
|
3573
4804
|
}
|
|
3574
4805
|
try {
|
|
@@ -3656,6 +4887,10 @@ const latestFDC3Type = "latest_fdc3_type";
|
|
|
3656
4887
|
|
|
3657
4888
|
const operations$3 = {
|
|
3658
4889
|
addChannel: { name: "addChannel", dataDecoder: channelContextDecoder },
|
|
4890
|
+
getMyChannel: { name: "getMyChannel", resultDecoder: getMyChanelResultDecoder },
|
|
4891
|
+
getWindowIdsOnChannel: { name: "getWindowIdsOnChannel", dataDecoder: getWindowIdsOnChannelDataDecoder, resultDecoder: getWindowIdsOnChannelResultDecoder },
|
|
4892
|
+
getWindowIdsWithChannels: { name: "getWindowIdsWithChannels", dataDecoder: wrappedWindowWithChannelFilterDecoder, resultDecoder: getWindowIdsWithChannelsResultDecoder },
|
|
4893
|
+
joinChannel: { name: "joinChannel", dataDecoder: joinChannelDataDecoder },
|
|
3659
4894
|
};
|
|
3660
4895
|
|
|
3661
4896
|
class ChannelsController {
|
|
@@ -3673,6 +4908,7 @@ class ChannelsController {
|
|
|
3673
4908
|
callback(context.data, context, extraData === null || extraData === void 0 ? void 0 : extraData.updaterId);
|
|
3674
4909
|
});
|
|
3675
4910
|
}
|
|
4911
|
+
return undefined;
|
|
3676
4912
|
})
|
|
3677
4913
|
.then((un) => {
|
|
3678
4914
|
if (un && typeof un === "function") {
|
|
@@ -3685,19 +4921,36 @@ class ChannelsController {
|
|
|
3685
4921
|
handlePlatformShutdown() {
|
|
3686
4922
|
this.registry.clear();
|
|
3687
4923
|
}
|
|
4924
|
+
addOperationsExecutors() {
|
|
4925
|
+
operations$3.getMyChannel.execute = this.handleGetMyChannel.bind(this);
|
|
4926
|
+
operations$3.joinChannel.execute = this.handleJoinChannel.bind(this);
|
|
4927
|
+
}
|
|
3688
4928
|
start(coreGlue, ioc) {
|
|
3689
4929
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
3690
4930
|
this.logger = coreGlue.logger.subLogger("channels.controller.web");
|
|
3691
4931
|
this.logger.trace("starting the web channels controller");
|
|
3692
4932
|
this.contexts = coreGlue.contexts;
|
|
4933
|
+
this.addOperationsExecutors();
|
|
3693
4934
|
this.bridge = ioc.bridge;
|
|
4935
|
+
this.windowsController = ioc.windowsController;
|
|
4936
|
+
this.sessionController = ioc.sessionController;
|
|
3694
4937
|
this.logger.trace("no need for platform registration, attaching the channels property to glue and returning");
|
|
3695
4938
|
const api = this.toApi();
|
|
3696
4939
|
coreGlue.channels = api;
|
|
3697
4940
|
});
|
|
3698
4941
|
}
|
|
3699
|
-
handleBridgeMessage() {
|
|
4942
|
+
handleBridgeMessage(args) {
|
|
3700
4943
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
4944
|
+
const operationName = channelsOperationTypesDecoder.runWithException(args.operation);
|
|
4945
|
+
const operation = operations$3[operationName];
|
|
4946
|
+
if (!operation.execute) {
|
|
4947
|
+
return;
|
|
4948
|
+
}
|
|
4949
|
+
let operationData = args.data;
|
|
4950
|
+
if (operation.dataDecoder) {
|
|
4951
|
+
operationData = operation.dataDecoder.runWithException(args.data);
|
|
4952
|
+
}
|
|
4953
|
+
return yield operation.execute(operationData);
|
|
3701
4954
|
});
|
|
3702
4955
|
}
|
|
3703
4956
|
list() {
|
|
@@ -3710,13 +4963,28 @@ class ChannelsController {
|
|
|
3710
4963
|
my() {
|
|
3711
4964
|
return this.current();
|
|
3712
4965
|
}
|
|
3713
|
-
|
|
4966
|
+
handleGetMyChannel() {
|
|
4967
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
4968
|
+
const channel = this.my();
|
|
4969
|
+
return channel ? { channel } : {};
|
|
4970
|
+
});
|
|
4971
|
+
}
|
|
4972
|
+
join(name, windowId) {
|
|
3714
4973
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
3715
4974
|
const channelNames = this.getAllChannelNames();
|
|
3716
4975
|
channelNameDecoder(channelNames).runWithException(name);
|
|
3717
|
-
|
|
4976
|
+
optionalNonEmptyStringDecoder.runWithException(windowId);
|
|
4977
|
+
if (!windowId || windowId === this.windowsController.my().id) {
|
|
4978
|
+
yield this.switchToChannel(name);
|
|
4979
|
+
}
|
|
4980
|
+
else {
|
|
4981
|
+
yield this.bridge.send("channels", operations$3.joinChannel, { channel: name, windowId }, undefined, { includeOperationCheck: true });
|
|
4982
|
+
}
|
|
3718
4983
|
});
|
|
3719
4984
|
}
|
|
4985
|
+
handleJoinChannel({ channel, windowId }) {
|
|
4986
|
+
return this.join(channel, windowId);
|
|
4987
|
+
}
|
|
3720
4988
|
onChanged(callback) {
|
|
3721
4989
|
return this.changed(callback);
|
|
3722
4990
|
}
|
|
@@ -3739,7 +5007,10 @@ class ChannelsController {
|
|
|
3739
5007
|
my: this.my.bind(this),
|
|
3740
5008
|
changed: this.changed.bind(this),
|
|
3741
5009
|
onChanged: this.onChanged.bind(this),
|
|
3742
|
-
add: this.add.bind(this)
|
|
5010
|
+
add: this.add.bind(this),
|
|
5011
|
+
getMy: this.getMy.bind(this),
|
|
5012
|
+
getWindowsOnChannel: this.getWindowsOnChannel.bind(this),
|
|
5013
|
+
getWindowsWithChannels: this.getWindowsWithChannels.bind(this),
|
|
3743
5014
|
};
|
|
3744
5015
|
return Object.freeze(api);
|
|
3745
5016
|
}
|
|
@@ -3769,6 +5040,7 @@ class ChannelsController {
|
|
|
3769
5040
|
});
|
|
3770
5041
|
}
|
|
3771
5042
|
this.registry.execute(this.ChangedKey, name);
|
|
5043
|
+
this.sessionController.setWindowData({ currentName: name }, "channels");
|
|
3772
5044
|
});
|
|
3773
5045
|
}
|
|
3774
5046
|
updateData(name, data) {
|
|
@@ -3855,7 +5127,7 @@ class ChannelsController {
|
|
|
3855
5127
|
const contextName = this.createContextName(name);
|
|
3856
5128
|
const channelContext = yield this.contexts.get(contextName);
|
|
3857
5129
|
if (channelContext.latest_fdc3_type) {
|
|
3858
|
-
const rest = __rest$
|
|
5130
|
+
const rest = __rest$2(channelContext, ["latest_fdc3_type"]);
|
|
3859
5131
|
return Object.assign({}, rest);
|
|
3860
5132
|
}
|
|
3861
5133
|
return channelContext;
|
|
@@ -3881,6 +5153,39 @@ class ChannelsController {
|
|
|
3881
5153
|
return channelContext;
|
|
3882
5154
|
});
|
|
3883
5155
|
}
|
|
5156
|
+
getMy() {
|
|
5157
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
5158
|
+
if (!this.currentChannelName) {
|
|
5159
|
+
return;
|
|
5160
|
+
}
|
|
5161
|
+
return this.get(this.currentChannelName);
|
|
5162
|
+
});
|
|
5163
|
+
}
|
|
5164
|
+
getWindowsOnChannel(channel) {
|
|
5165
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
5166
|
+
const channelNames = this.getAllChannelNames();
|
|
5167
|
+
channelNameDecoder(channelNames).runWithException(channel);
|
|
5168
|
+
const { windowIds } = yield this.bridge.send("channels", operations$3.getWindowIdsOnChannel, { channel }, undefined, { includeOperationCheck: true });
|
|
5169
|
+
const result = windowIds.reduce((windows, windowId) => {
|
|
5170
|
+
const window = this.windowsController.findById(windowId);
|
|
5171
|
+
return window ? [...windows, window] : windows;
|
|
5172
|
+
}, []);
|
|
5173
|
+
return result;
|
|
5174
|
+
});
|
|
5175
|
+
}
|
|
5176
|
+
getWindowsWithChannels(filter) {
|
|
5177
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
5178
|
+
const operationData = filter !== undefined
|
|
5179
|
+
? { filter: windowWithChannelFilterDecoder.runWithException(filter) }
|
|
5180
|
+
: {};
|
|
5181
|
+
const { windowIdsWithChannels } = yield this.bridge.send("channels", operations$3.getWindowIdsWithChannels, operationData, undefined, { includeOperationCheck: true });
|
|
5182
|
+
const result = windowIdsWithChannels.reduce((windowsWithChannels, { application, channel, windowId }) => {
|
|
5183
|
+
const window = this.windowsController.findById(windowId);
|
|
5184
|
+
return window ? [...windowsWithChannels, { application, channel, window }] : windowsWithChannels;
|
|
5185
|
+
}, []);
|
|
5186
|
+
return result;
|
|
5187
|
+
});
|
|
5188
|
+
}
|
|
3884
5189
|
}
|
|
3885
5190
|
|
|
3886
5191
|
const operations$2 = {
|
|
@@ -3963,10 +5268,10 @@ class Notification {
|
|
|
3963
5268
|
}
|
|
3964
5269
|
}
|
|
3965
5270
|
|
|
3966
|
-
oneOf(constant("clientHello"));
|
|
3967
|
-
const extensionConfigDecoder = object({
|
|
3968
|
-
widget: object({
|
|
3969
|
-
inject: boolean()
|
|
5271
|
+
oneOf$1(constant$1("clientHello"));
|
|
5272
|
+
const extensionConfigDecoder = object$1({
|
|
5273
|
+
widget: object$1({
|
|
5274
|
+
inject: boolean$1()
|
|
3970
5275
|
})
|
|
3971
5276
|
});
|
|
3972
5277
|
|
|
@@ -4452,6 +5757,7 @@ class LegacyIntentsHelper {
|
|
|
4452
5757
|
catch (error) {
|
|
4453
5758
|
this.logger.trace(`Failure to get my window bounds: ${JSON.stringify(error)}`);
|
|
4454
5759
|
}
|
|
5760
|
+
return undefined;
|
|
4455
5761
|
});
|
|
4456
5762
|
}
|
|
4457
5763
|
tryGetWorkspaceBasedBounds() {
|
|
@@ -4466,6 +5772,7 @@ class LegacyIntentsHelper {
|
|
|
4466
5772
|
catch (error) {
|
|
4467
5773
|
this.logger.trace(`Failure to get my workspace frame window bounds: ${JSON.stringify(error)}`);
|
|
4468
5774
|
}
|
|
5775
|
+
return undefined;
|
|
4469
5776
|
});
|
|
4470
5777
|
}
|
|
4471
5778
|
subscribeOnInstanceStopped(instance) {
|
|
@@ -4641,6 +5948,35 @@ class ThemesController {
|
|
|
4641
5948
|
}
|
|
4642
5949
|
}
|
|
4643
5950
|
|
|
5951
|
+
class SessionStorageController {
|
|
5952
|
+
constructor() {
|
|
5953
|
+
this.sessionStorage = window.sessionStorage;
|
|
5954
|
+
}
|
|
5955
|
+
get allNamespaces() {
|
|
5956
|
+
return [{ namespace: this.windowNamespace, defaultValue: {} }];
|
|
5957
|
+
}
|
|
5958
|
+
configure(config) {
|
|
5959
|
+
this.windowId = config.windowId;
|
|
5960
|
+
this.allNamespaces.forEach(({ namespace, defaultValue }) => {
|
|
5961
|
+
const data = this.sessionStorage.getItem(namespace);
|
|
5962
|
+
if (!data) {
|
|
5963
|
+
this.sessionStorage.setItem(namespace, JSON.stringify(defaultValue));
|
|
5964
|
+
}
|
|
5965
|
+
});
|
|
5966
|
+
}
|
|
5967
|
+
get windowNamespace() {
|
|
5968
|
+
return `io_connect_window_${this.windowId}`;
|
|
5969
|
+
}
|
|
5970
|
+
getWindowData() {
|
|
5971
|
+
return JSON.parse(this.sessionStorage.getItem(this.windowNamespace));
|
|
5972
|
+
}
|
|
5973
|
+
setWindowData(data, key) {
|
|
5974
|
+
const allData = this.getWindowData();
|
|
5975
|
+
allData[key] = data;
|
|
5976
|
+
this.sessionStorage.setItem(this.windowNamespace, JSON.stringify(allData));
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
|
|
4644
5980
|
class IoC {
|
|
4645
5981
|
constructor() {
|
|
4646
5982
|
this.controllers = {
|
|
@@ -4739,6 +6075,12 @@ class IoC {
|
|
|
4739
6075
|
}
|
|
4740
6076
|
return this._preferredConnectionController;
|
|
4741
6077
|
}
|
|
6078
|
+
get sessionController() {
|
|
6079
|
+
if (!this._sessionController) {
|
|
6080
|
+
this._sessionController = new SessionStorageController();
|
|
6081
|
+
}
|
|
6082
|
+
return this._sessionController;
|
|
6083
|
+
}
|
|
4742
6084
|
get config() {
|
|
4743
6085
|
return this._webConfig;
|
|
4744
6086
|
}
|
|
@@ -4774,7 +6116,7 @@ class IoC {
|
|
|
4774
6116
|
}
|
|
4775
6117
|
}
|
|
4776
6118
|
|
|
4777
|
-
var version$2 = "3.
|
|
6119
|
+
var version$2 = "3.1.1";
|
|
4778
6120
|
|
|
4779
6121
|
const createFactoryFunction = (coreFactoryFunction) => {
|
|
4780
6122
|
return (userConfig) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
@@ -4787,6 +6129,7 @@ const createFactoryFunction = (coreFactoryFunction) => {
|
|
|
4787
6129
|
const glue = yield PromiseWrap(() => coreFactoryFunction(config, { version: version$2 }), 30000, "Glue Web initialization timed out, because core didn't resolve");
|
|
4788
6130
|
const logger = glue.logger.subLogger("web.main.controller");
|
|
4789
6131
|
ioc.defineGlue(glue);
|
|
6132
|
+
ioc.sessionController.configure({ windowId: glue.interop.instance.instance });
|
|
4790
6133
|
yield ioc.preferredConnectionController.start(config);
|
|
4791
6134
|
yield ioc.bridge.start(ioc.controllers);
|
|
4792
6135
|
ioc.defineConfig(config);
|
|
@@ -8416,7 +9759,7 @@ var ContextMessageReplaySpec = {
|
|
|
8416
9759
|
}
|
|
8417
9760
|
};
|
|
8418
9761
|
|
|
8419
|
-
var version = "6.0
|
|
9762
|
+
var version = "6.1.0";
|
|
8420
9763
|
|
|
8421
9764
|
function prepareConfig (configuration, ext, glue42gd) {
|
|
8422
9765
|
var _a, _b, _c, _d;
|