@openfin/core 29.73.7 → 29.73.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/OpenFin.d.ts +2 -2
- package/src/api/interop/Factory.d.ts +1 -0
- package/src/api/interop/Factory.js +16 -2
- package/src/api/interop/InteropBroker.d.ts +7 -33
- package/src/api/interop/InteropBroker.js +21 -32
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
package/package.json
CHANGED
package/src/OpenFin.d.ts
CHANGED
|
@@ -660,8 +660,8 @@ export declare type LayoutOptions = {
|
|
|
660
660
|
headerHeight?: number;
|
|
661
661
|
};
|
|
662
662
|
};
|
|
663
|
-
export declare type OverrideCallback<T extends any = PlatformProvider, U extends T = T> = (arg: Constructor<T
|
|
664
|
-
export declare type Constructor<T = {}> = new (
|
|
663
|
+
export declare type OverrideCallback<T extends any = PlatformProvider, U extends T = T> = (arg: Constructor<T>) => U | Promise<U>;
|
|
664
|
+
export declare type Constructor<T = {}> = new () => T;
|
|
665
665
|
export declare type HostContextChangedReasons = 'updated' | 'reparented';
|
|
666
666
|
export declare type WindowCreationReason = 'tearout' | 'create-view-without-target' | 'api-call' | 'app-creation' | 'restore' | 'apply-snapshot';
|
|
667
667
|
export declare type PlatformProvider = {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
4
|
+
const inaccessibleObject_1 = require("../../util/inaccessibleObject");
|
|
3
5
|
const base_1 = require("../base");
|
|
4
6
|
const InteropBroker_1 = require("./InteropBroker");
|
|
5
7
|
const InteropClient_1 = require("./InteropClient");
|
|
6
8
|
const overrideCheck_1 = require("./fdc3/overrideCheck");
|
|
7
|
-
const defaultOverride = (Class
|
|
9
|
+
const defaultOverride = (Class) => new Class();
|
|
10
|
+
const BrokerParamAccessError = 'You have attempted to use or modify InteropBroker parameters, which is not allowed. You are likely using an older InteropBroker override scheme. Please consult our Interop docs for guidance on migrating to the new override scheme.';
|
|
8
11
|
/**
|
|
9
12
|
* @typedef { object } InteropConfig
|
|
10
13
|
* @summary Information relevant to the Interop Broker.
|
|
@@ -27,11 +30,15 @@ class InteropModule extends base_1.Base {
|
|
|
27
30
|
* @static
|
|
28
31
|
*/
|
|
29
32
|
async init(name, override = defaultOverride) {
|
|
33
|
+
var _a;
|
|
30
34
|
this.wire.sendAction('interop-init').catch((e) => {
|
|
31
35
|
// don't expose, analytics-only call
|
|
32
36
|
});
|
|
33
37
|
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
34
38
|
const options = await this.fin.Application.getCurrentSync().getInfo();
|
|
39
|
+
const opts = (_a = options.initialOptions.interopBrokerConfiguration) !== null && _a !== void 0 ? _a : {};
|
|
40
|
+
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
|
41
|
+
const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
|
|
35
42
|
let provider;
|
|
36
43
|
const getProvider = () => {
|
|
37
44
|
if (!provider) {
|
|
@@ -39,7 +46,14 @@ class InteropModule extends base_1.Base {
|
|
|
39
46
|
}
|
|
40
47
|
return provider;
|
|
41
48
|
};
|
|
42
|
-
const
|
|
49
|
+
const throwingGetProvider = async () => {
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
throw new Error(BrokerParamAccessError);
|
|
52
|
+
};
|
|
53
|
+
const OverrideableBroker = InteropBroker_1.InteropBroker.createClosedConstructor(this.wire, getProvider, opts);
|
|
54
|
+
// We need to use these objects because removing them entirely would be a breaking change and we want an informative error
|
|
55
|
+
// @ts-expect-error
|
|
56
|
+
const broker = await override(OverrideableBroker, objectThatThrows, throwingGetProvider, warningOptsClone);
|
|
43
57
|
(0, overrideCheck_1.overrideCheck)(broker, (0, overrideCheck_1.getDefaultViewFdc3VersionFromAppInfo)(options));
|
|
44
58
|
return broker;
|
|
45
59
|
}
|
|
@@ -2,7 +2,7 @@ import { TargetApp } from './fdc3/shapes/fdc3v1';
|
|
|
2
2
|
import { AppIdentifier } from './fdc3/shapes/fdc3v2';
|
|
3
3
|
import { Base } from '../base';
|
|
4
4
|
import type Transport from '../../transport/transport';
|
|
5
|
-
|
|
5
|
+
declare type Identity = OpenFin.Identity;
|
|
6
6
|
/**
|
|
7
7
|
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking **THE INTEROP API IS EXPERIMENTAL. IF YOU WOULD LIKE TO USE IT, PLEASE USE OUR DEFAULT IMPLEMENTATION IN BROWSER**}
|
|
8
8
|
*
|
|
@@ -102,7 +102,7 @@ import Identity = OpenFin.Identity;
|
|
|
102
102
|
* };
|
|
103
103
|
* return new Override();
|
|
104
104
|
* },
|
|
105
|
-
* interopOverride: async (InteropBroker
|
|
105
|
+
* interopOverride: async (InteropBroker) => {
|
|
106
106
|
* class Override extends InteropBroker {
|
|
107
107
|
* async joinContextGroup(channelName = 'default', target) {
|
|
108
108
|
* console.log('before super joinContextGroup')
|
|
@@ -111,37 +111,7 @@ import Identity = OpenFin.Identity;
|
|
|
111
111
|
* }
|
|
112
112
|
* }
|
|
113
113
|
*
|
|
114
|
-
*
|
|
115
|
-
* {
|
|
116
|
-
* id: 'green',
|
|
117
|
-
* displayMetadata: {
|
|
118
|
-
* color: '#00CC88',
|
|
119
|
-
* name: 'green'
|
|
120
|
-
* }
|
|
121
|
-
* },
|
|
122
|
-
* {
|
|
123
|
-
* id: 'purple',
|
|
124
|
-
* displayMetadata: {
|
|
125
|
-
* color: '#8C61FF',
|
|
126
|
-
* name: 'purple'
|
|
127
|
-
* }
|
|
128
|
-
* },
|
|
129
|
-
* {
|
|
130
|
-
* id: 'orange',
|
|
131
|
-
* displayMetadata: {
|
|
132
|
-
* color: '#FF8C4C',
|
|
133
|
-
* name: 'orange'
|
|
134
|
-
* }
|
|
135
|
-
* },
|
|
136
|
-
* {
|
|
137
|
-
* id: 'red',
|
|
138
|
-
* displayMetadata: {
|
|
139
|
-
* color: '#FF5E60',
|
|
140
|
-
* name: 'red'
|
|
141
|
-
* }
|
|
142
|
-
* }
|
|
143
|
-
* ];
|
|
144
|
-
* return new Override(provider, options, ...args);
|
|
114
|
+
* return new Override();
|
|
145
115
|
* }
|
|
146
116
|
* });
|
|
147
117
|
* ```
|
|
@@ -161,6 +131,9 @@ export declare class InteropBroker extends Base {
|
|
|
161
131
|
private channel;
|
|
162
132
|
private logging;
|
|
163
133
|
constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
|
|
134
|
+
static createClosedConstructor(...args: ConstructorParameters<typeof InteropBroker>): {
|
|
135
|
+
new (): InteropBroker;
|
|
136
|
+
};
|
|
164
137
|
/**
|
|
165
138
|
* SetContextOptions interface
|
|
166
139
|
* @typedef { object } SetContextOptions
|
|
@@ -465,3 +438,4 @@ export declare class InteropBroker extends Base {
|
|
|
465
438
|
*/
|
|
466
439
|
isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean> | boolean;
|
|
467
440
|
}
|
|
441
|
+
export {};
|
|
@@ -4,6 +4,7 @@ exports.InteropBroker = void 0;
|
|
|
4
4
|
const base_1 = require("../base");
|
|
5
5
|
const SessionContextGroupBroker_1 = require("./SessionContextGroupBroker");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
7
8
|
let contextGroups = [
|
|
8
9
|
{
|
|
9
10
|
id: 'green',
|
|
@@ -147,7 +148,7 @@ let contextGroups = [
|
|
|
147
148
|
* };
|
|
148
149
|
* return new Override();
|
|
149
150
|
* },
|
|
150
|
-
* interopOverride: async (InteropBroker
|
|
151
|
+
* interopOverride: async (InteropBroker) => {
|
|
151
152
|
* class Override extends InteropBroker {
|
|
152
153
|
* async joinContextGroup(channelName = 'default', target) {
|
|
153
154
|
* console.log('before super joinContextGroup')
|
|
@@ -156,37 +157,7 @@ let contextGroups = [
|
|
|
156
157
|
* }
|
|
157
158
|
* }
|
|
158
159
|
*
|
|
159
|
-
*
|
|
160
|
-
* {
|
|
161
|
-
* id: 'green',
|
|
162
|
-
* displayMetadata: {
|
|
163
|
-
* color: '#00CC88',
|
|
164
|
-
* name: 'green'
|
|
165
|
-
* }
|
|
166
|
-
* },
|
|
167
|
-
* {
|
|
168
|
-
* id: 'purple',
|
|
169
|
-
* displayMetadata: {
|
|
170
|
-
* color: '#8C61FF',
|
|
171
|
-
* name: 'purple'
|
|
172
|
-
* }
|
|
173
|
-
* },
|
|
174
|
-
* {
|
|
175
|
-
* id: 'orange',
|
|
176
|
-
* displayMetadata: {
|
|
177
|
-
* color: '#FF8C4C',
|
|
178
|
-
* name: 'orange'
|
|
179
|
-
* }
|
|
180
|
-
* },
|
|
181
|
-
* {
|
|
182
|
-
* id: 'red',
|
|
183
|
-
* displayMetadata: {
|
|
184
|
-
* color: '#FF5E60',
|
|
185
|
-
* name: 'red'
|
|
186
|
-
* }
|
|
187
|
-
* }
|
|
188
|
-
* ];
|
|
189
|
-
* return new Override(provider, options, ...args);
|
|
160
|
+
* return new Override();
|
|
190
161
|
* }
|
|
191
162
|
* });
|
|
192
163
|
* ```
|
|
@@ -215,6 +186,24 @@ class InteropBroker extends base_1.Base {
|
|
|
215
186
|
this.setContextGroupMap();
|
|
216
187
|
this.setupChannelProvider();
|
|
217
188
|
}
|
|
189
|
+
static createClosedConstructor(...args) {
|
|
190
|
+
return class OverrideableBroker extends InteropBroker {
|
|
191
|
+
constructor(...unused) {
|
|
192
|
+
if (unused.length) {
|
|
193
|
+
const [_ignore1, ignore2, opts] = unused;
|
|
194
|
+
if (opts && typeof opts === 'object' && !(0, lodash_1.isEqual)(opts, args[2])) {
|
|
195
|
+
// eslint-disable-next-line no-console
|
|
196
|
+
console.warn('You have modified the parameters of the InteropOverride constructor. This behavior is deprecated and will be removed in a future version. You can modify these options in your manifest. Please consult our Interop docs for guidance on migrating to the new override scheme.');
|
|
197
|
+
super(args[0], args[1], opts);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// eslint-disable-next-line no-console
|
|
201
|
+
console.warn('You are attempting to pass arguments to the InteropOverride constructor. This is not necessary, and these passed arguments will be ignored. You are likely using an older InteropBroker override scheme. Please consult our Interop docs for guidance on migrating to the new override scheme.');
|
|
202
|
+
}
|
|
203
|
+
super(...args);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
218
207
|
/*
|
|
219
208
|
Client API
|
|
220
209
|
*/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWarningObject = exports.createUnusableObject = void 0;
|
|
4
|
+
function createUnusableObject(message) {
|
|
5
|
+
const handle = () => {
|
|
6
|
+
throw new Error(message);
|
|
7
|
+
};
|
|
8
|
+
return new Proxy({}, {
|
|
9
|
+
apply: handle,
|
|
10
|
+
construct: handle,
|
|
11
|
+
defineProperty: handle,
|
|
12
|
+
deleteProperty: handle,
|
|
13
|
+
get: handle,
|
|
14
|
+
getOwnPropertyDescriptor: handle,
|
|
15
|
+
getPrototypeOf: handle,
|
|
16
|
+
has: handle,
|
|
17
|
+
isExtensible: handle,
|
|
18
|
+
ownKeys: handle,
|
|
19
|
+
preventExtensions: handle,
|
|
20
|
+
set: handle,
|
|
21
|
+
setPrototypeOf: handle
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.createUnusableObject = createUnusableObject;
|
|
25
|
+
function createWarningObject(message, obj) {
|
|
26
|
+
return new Proxy(obj, {
|
|
27
|
+
get: (...args) => {
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
29
|
+
console.warn(message);
|
|
30
|
+
return Reflect.get(...args);
|
|
31
|
+
},
|
|
32
|
+
set: (...args) => {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.warn(message);
|
|
35
|
+
return Reflect.set(...args);
|
|
36
|
+
},
|
|
37
|
+
getOwnPropertyDescriptor: (...args) => {
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
console.warn(message);
|
|
40
|
+
return Reflect.getOwnPropertyDescriptor(...args);
|
|
41
|
+
},
|
|
42
|
+
ownKeys: (...args) => {
|
|
43
|
+
// eslint-disable-next-line no-console
|
|
44
|
+
console.warn(message);
|
|
45
|
+
return Reflect.ownKeys(...args);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.createWarningObject = createWarningObject;
|