@openfin/core 33.76.36 → 33.76.38

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.
Files changed (271) hide show
  1. package/OpenFin.d.ts +1 -1
  2. package/README.md +29 -4
  3. package/fin.d.ts +2 -2
  4. package/{src → out}/GlobalOpenFin.d.ts +1 -1
  5. package/out/mock-alpha.d.ts +16112 -0
  6. package/out/mock-beta.d.ts +16112 -0
  7. package/out/mock-public.d.ts +16112 -0
  8. package/out/mock.d.ts +16797 -0
  9. package/out/mock.js +17104 -0
  10. package/package.json +30 -23
  11. package/LICENSE +0 -13
  12. package/NOTICE +0 -16
  13. package/openfin-core-33.76.36.tgz +0 -0
  14. package/src/OpenFin.d.ts +0 -3091
  15. package/src/OpenFin.js +0 -2
  16. package/src/api/api-exposer/api-consumer.d.ts +0 -28
  17. package/src/api/api-exposer/api-consumer.js +0 -28
  18. package/src/api/api-exposer/api-exposer.d.ts +0 -35
  19. package/src/api/api-exposer/api-exposer.js +0 -38
  20. package/src/api/api-exposer/decorators.d.ts +0 -10
  21. package/src/api/api-exposer/decorators.js +0 -18
  22. package/src/api/api-exposer/index.d.ts +0 -4
  23. package/src/api/api-exposer/index.js +0 -20
  24. package/src/api/api-exposer/strategies/index.d.ts +0 -1
  25. package/src/api/api-exposer/strategies/index.js +0 -17
  26. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
  27. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
  28. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
  29. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
  30. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
  31. package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
  32. package/src/api/application/Factory.d.ts +0 -196
  33. package/src/api/application/Factory.js +0 -278
  34. package/src/api/application/Instance.d.ts +0 -692
  35. package/src/api/application/Instance.js +0 -821
  36. package/src/api/application/index.d.ts +0 -12
  37. package/src/api/application/index.js +0 -28
  38. package/src/api/base.d.ts +0 -117
  39. package/src/api/base.js +0 -246
  40. package/src/api/clipboard/index.d.ts +0 -172
  41. package/src/api/clipboard/index.js +0 -200
  42. package/src/api/events/application.d.ts +0 -158
  43. package/src/api/events/application.js +0 -14
  44. package/src/api/events/base.d.ts +0 -42
  45. package/src/api/events/base.js +0 -2
  46. package/src/api/events/channel.d.ts +0 -35
  47. package/src/api/events/channel.js +0 -7
  48. package/src/api/events/emitterMap.d.ts +0 -11
  49. package/src/api/events/emitterMap.js +0 -35
  50. package/src/api/events/eventAggregator.d.ts +0 -5
  51. package/src/api/events/eventAggregator.js +0 -35
  52. package/src/api/events/externalApplication.d.ts +0 -24
  53. package/src/api/events/externalApplication.js +0 -7
  54. package/src/api/events/frame.d.ts +0 -35
  55. package/src/api/events/frame.js +0 -2
  56. package/src/api/events/globalHotkey.d.ts +0 -25
  57. package/src/api/events/globalHotkey.js +0 -2
  58. package/src/api/events/platform.d.ts +0 -34
  59. package/src/api/events/platform.js +0 -10
  60. package/src/api/events/system.d.ts +0 -126
  61. package/src/api/events/system.js +0 -15
  62. package/src/api/events/typedEventEmitter.d.ts +0 -20
  63. package/src/api/events/typedEventEmitter.js +0 -2
  64. package/src/api/events/view.d.ts +0 -92
  65. package/src/api/events/view.js +0 -12
  66. package/src/api/events/webcontents.d.ts +0 -277
  67. package/src/api/events/webcontents.js +0 -13
  68. package/src/api/events/window.d.ts +0 -421
  69. package/src/api/events/window.js +0 -12
  70. package/src/api/external-application/Factory.d.ts +0 -34
  71. package/src/api/external-application/Factory.js +0 -47
  72. package/src/api/external-application/Instance.d.ts +0 -110
  73. package/src/api/external-application/Instance.js +0 -117
  74. package/src/api/external-application/index.d.ts +0 -12
  75. package/src/api/external-application/index.js +0 -28
  76. package/src/api/fin.d.ts +0 -54
  77. package/src/api/fin.js +0 -45
  78. package/src/api/frame/Factory.d.ts +0 -54
  79. package/src/api/frame/Factory.js +0 -86
  80. package/src/api/frame/Instance.d.ts +0 -136
  81. package/src/api/frame/Instance.js +0 -143
  82. package/src/api/frame/index.d.ts +0 -14
  83. package/src/api/frame/index.js +0 -30
  84. package/src/api/global-hotkey/index.d.ts +0 -106
  85. package/src/api/global-hotkey/index.js +0 -132
  86. package/src/api/interappbus/channel/channel.d.ts +0 -285
  87. package/src/api/interappbus/channel/channel.js +0 -334
  88. package/src/api/interappbus/channel/channels-docs.d.ts +0 -342
  89. package/src/api/interappbus/channel/channels-docs.js +0 -401
  90. package/src/api/interappbus/channel/client.d.ts +0 -117
  91. package/src/api/interappbus/channel/client.js +0 -181
  92. package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
  93. package/src/api/interappbus/channel/connection-manager.js +0 -246
  94. package/src/api/interappbus/channel/index.d.ts +0 -189
  95. package/src/api/interappbus/channel/index.js +0 -333
  96. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
  97. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
  98. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
  99. package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
  100. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
  101. package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
  102. package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
  103. package/src/api/interappbus/channel/protocols/index.js +0 -2
  104. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
  105. package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
  106. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
  107. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
  108. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
  109. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
  110. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
  111. package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
  112. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
  113. package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
  114. package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
  115. package/src/api/interappbus/channel/protocols/strategy.js +0 -2
  116. package/src/api/interappbus/channel/provider.d.ts +0 -206
  117. package/src/api/interappbus/channel/provider.js +0 -338
  118. package/src/api/interappbus/index.d.ts +0 -120
  119. package/src/api/interappbus/index.js +0 -210
  120. package/src/api/interop/Factory.d.ts +0 -57
  121. package/src/api/interop/Factory.js +0 -96
  122. package/src/api/interop/InteropBroker.d.ts +0 -665
  123. package/src/api/interop/InteropBroker.js +0 -1313
  124. package/src/api/interop/InteropClient.d.ts +0 -502
  125. package/src/api/interop/InteropClient.js +0 -683
  126. package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
  127. package/src/api/interop/SessionContextGroupBroker.js +0 -108
  128. package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
  129. package/src/api/interop/SessionContextGroupClient.js +0 -86
  130. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
  131. package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
  132. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
  133. package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
  134. package/src/api/interop/fdc3/documentationStub.d.ts +0 -14
  135. package/src/api/interop/fdc3/documentationStub.js +0 -17
  136. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -205
  137. package/src/api/interop/fdc3/fdc3-1.2.js +0 -435
  138. package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -298
  139. package/src/api/interop/fdc3/fdc3-2.0.js +0 -479
  140. package/src/api/interop/fdc3/fdc3.d.ts +0 -12
  141. package/src/api/interop/fdc3/fdc3.js +0 -35
  142. package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
  143. package/src/api/interop/fdc3/overrideCheck.js +0 -32
  144. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
  145. package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
  146. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
  147. package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
  148. package/src/api/interop/fdc3/utils.d.ts +0 -45
  149. package/src/api/interop/fdc3/utils.js +0 -239
  150. package/src/api/interop/fdc3/versions.d.ts +0 -1
  151. package/src/api/interop/fdc3/versions.js +0 -2
  152. package/src/api/interop/index.d.ts +0 -12
  153. package/src/api/interop/index.js +0 -28
  154. package/src/api/interop/utils.d.ts +0 -18
  155. package/src/api/interop/utils.js +0 -61
  156. package/src/api/me.d.ts +0 -40
  157. package/src/api/me.js +0 -134
  158. package/src/api/platform/Factory.d.ts +0 -171
  159. package/src/api/platform/Factory.js +0 -240
  160. package/src/api/platform/Instance.d.ts +0 -653
  161. package/src/api/platform/Instance.js +0 -834
  162. package/src/api/platform/common-utils.d.ts +0 -7
  163. package/src/api/platform/common-utils.js +0 -16
  164. package/src/api/platform/index.d.ts +0 -12
  165. package/src/api/platform/index.js +0 -28
  166. package/src/api/platform/layout/Factory.d.ts +0 -91
  167. package/src/api/platform/layout/Factory.js +0 -151
  168. package/src/api/platform/layout/Instance.d.ts +0 -192
  169. package/src/api/platform/layout/Instance.js +0 -224
  170. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
  171. package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
  172. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
  173. package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
  174. package/src/api/platform/layout/entities/layout-entities.d.ts +0 -427
  175. package/src/api/platform/layout/entities/layout-entities.js +0 -504
  176. package/src/api/platform/layout/entities/shapes.d.ts +0 -6
  177. package/src/api/platform/layout/entities/shapes.js +0 -2
  178. package/src/api/platform/layout/index.d.ts +0 -11
  179. package/src/api/platform/layout/index.js +0 -27
  180. package/src/api/platform/layout/layout.constants.d.ts +0 -1
  181. package/src/api/platform/layout/layout.constants.js +0 -4
  182. package/src/api/platform/layout/shapes.d.ts +0 -16
  183. package/src/api/platform/layout/shapes.js +0 -2
  184. package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
  185. package/src/api/platform/layout/utils/layout-traversal.js +0 -65
  186. package/src/api/platform/provider.d.ts +0 -510
  187. package/src/api/platform/provider.js +0 -2
  188. package/src/api/snapshot-source/Factory.d.ts +0 -53
  189. package/src/api/snapshot-source/Factory.js +0 -81
  190. package/src/api/snapshot-source/Instance.d.ts +0 -53
  191. package/src/api/snapshot-source/Instance.js +0 -154
  192. package/src/api/snapshot-source/index.d.ts +0 -12
  193. package/src/api/snapshot-source/index.js +0 -28
  194. package/src/api/snapshot-source/utils.d.ts +0 -2
  195. package/src/api/snapshot-source/utils.js +0 -6
  196. package/src/api/system/index.d.ts +0 -1468
  197. package/src/api/system/index.js +0 -1851
  198. package/src/api/view/Factory.d.ts +0 -88
  199. package/src/api/view/Factory.js +0 -141
  200. package/src/api/view/Instance.d.ts +0 -601
  201. package/src/api/view/Instance.js +0 -671
  202. package/src/api/view/index.d.ts +0 -12
  203. package/src/api/view/index.js +0 -28
  204. package/src/api/webcontents/main.d.ts +0 -922
  205. package/src/api/webcontents/main.js +0 -1046
  206. package/src/api/window/Factory.d.ts +0 -96
  207. package/src/api/window/Factory.js +0 -142
  208. package/src/api/window/Instance.d.ts +0 -1598
  209. package/src/api/window/Instance.js +0 -1851
  210. package/src/api/window/index.d.ts +0 -14
  211. package/src/api/window/index.js +0 -30
  212. package/src/browser.d.ts +0 -10
  213. package/src/browser.js +0 -36
  214. package/src/environment/browser.d.ts +0 -29
  215. package/src/environment/browser.js +0 -60
  216. package/src/environment/environment.d.ts +0 -33
  217. package/src/environment/environment.js +0 -4
  218. package/src/environment/mockEnvironment.d.ts +0 -27
  219. package/src/environment/mockEnvironment.js +0 -61
  220. package/src/environment/node-env.d.ts +0 -29
  221. package/src/environment/node-env.js +0 -72
  222. package/src/fdc3.d.ts +0 -3
  223. package/src/fdc3.js +0 -9
  224. package/src/mock.d.ts +0 -3
  225. package/src/mock.js +0 -18
  226. package/src/namespaces.d.ts +0 -22
  227. package/src/namespaces.js +0 -26
  228. package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
  229. package/src/shapes/ERROR_BOX_TYPES.js +0 -2
  230. package/src/shapes/WebOptions.d.ts +0 -13
  231. package/src/shapes/WebOptions.js +0 -2
  232. package/src/shapes/WindowOptions.d.ts +0 -43
  233. package/src/shapes/WindowOptions.js +0 -2
  234. package/src/shapes/protocol.d.ts +0 -204
  235. package/src/shapes/protocol.js +0 -2
  236. package/src/transport/mockWire.d.ts +0 -11
  237. package/src/transport/mockWire.js +0 -26
  238. package/src/transport/transport-errors.d.ts +0 -31
  239. package/src/transport/transport-errors.js +0 -79
  240. package/src/transport/transport.d.ts +0 -73
  241. package/src/transport/transport.js +0 -219
  242. package/src/transport/wire.d.ts +0 -77
  243. package/src/transport/wire.js +0 -36
  244. package/src/util/asyncFilter.d.ts +0 -1
  245. package/src/util/asyncFilter.js +0 -7
  246. package/src/util/channel-api-relay.d.ts +0 -13
  247. package/src/util/channel-api-relay.js +0 -47
  248. package/src/util/errors.d.ts +0 -10
  249. package/src/util/errors.js +0 -12
  250. package/src/util/exhaustive.d.ts +0 -1
  251. package/src/util/exhaustive.js +0 -7
  252. package/src/util/http.d.ts +0 -11
  253. package/src/util/http.js +0 -90
  254. package/src/util/inaccessibleObject.d.ts +0 -2
  255. package/src/util/inaccessibleObject.js +0 -49
  256. package/src/util/lazy.d.ts +0 -34
  257. package/src/util/lazy.js +0 -54
  258. package/src/util/normalize-config.d.ts +0 -3
  259. package/src/util/normalize-config.js +0 -52
  260. package/src/util/promises.d.ts +0 -5
  261. package/src/util/promises.js +0 -27
  262. package/src/util/ref-counter.d.ts +0 -7
  263. package/src/util/ref-counter.js +0 -52
  264. package/src/util/reversible-map.d.ts +0 -11
  265. package/src/util/reversible-map.js +0 -49
  266. package/src/util/runtimeVersioning.d.ts +0 -3
  267. package/src/util/runtimeVersioning.js +0 -25
  268. package/src/util/utilTypes.d.ts +0 -8
  269. package/src/util/utilTypes.js +0 -2
  270. package/src/util/validate.d.ts +0 -3
  271. package/src/util/validate.js +0 -11
@@ -1,77 +0,0 @@
1
- /// <reference types="node" />
2
- import EventEmitter = NodeJS.EventEmitter;
3
- export type Wire = EventEmitter & {
4
- connect(address: string, WsConstructor: typeof WebSocket): Promise<any>;
5
- connectSync(): any;
6
- send(data: any): Promise<any>;
7
- shutdown(): Promise<void>;
8
- getPort(): string;
9
- };
10
- export type WireConstructor = {
11
- new (onmessage: (data: any) => void): Wire;
12
- };
13
- export type RuntimeConfig = {
14
- version: string;
15
- fallbackVersion?: string;
16
- securityRealm?: string;
17
- verboseLogging?: boolean;
18
- arguments?: string;
19
- rvmDir?: string;
20
- };
21
- export type ServiceConfig = {
22
- name: string;
23
- manifestUrl: string;
24
- };
25
- export type BaseConfig = {
26
- uuid?: string;
27
- address?: string;
28
- name?: string;
29
- nonPersistent?: boolean;
30
- runtimeClient?: boolean;
31
- licenseKey?: string;
32
- client?: any;
33
- manifestUrl?: string;
34
- startupApp?: any;
35
- lrsUrl?: string;
36
- assetsUrl?: string;
37
- devToolsPort?: number;
38
- installerUI?: boolean;
39
- runtime?: RuntimeConfig;
40
- services?: ServiceConfig[];
41
- appAssets?: [
42
- {
43
- src: string;
44
- alias: string;
45
- target: string;
46
- version: string;
47
- args: string;
48
- }
49
- ];
50
- customItems?: [any];
51
- timeout?: number;
52
- };
53
- export type ConfigWithUuid = BaseConfig & {
54
- uuid: string;
55
- };
56
- export type ExistingConnectConfig = ConfigWithUuid & {
57
- address: string;
58
- };
59
- export type ConfigWithRuntime = BaseConfig & {
60
- runtime: RuntimeConfig;
61
- };
62
- export type ExternalConfig = BaseConfig & {
63
- manifestUrl: string;
64
- };
65
- export type NewConnectConfig = ConfigWithUuid & ConfigWithRuntime;
66
- export type PortDiscoveryConfig = (ExternalConfig & ConfigWithRuntime) | NewConnectConfig;
67
- export type ConnectConfig = ExistingConnectConfig | NewConnectConfig | ExternalConfig;
68
- export type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
69
- export interface RemoteConfig extends ExistingConnectConfig {
70
- token: string;
71
- }
72
- export declare function isExternalConfig(config: ConnectConfig): config is ExternalConfig;
73
- export declare function isExistingConnectConfig(config: any): config is ExistingConnectConfig;
74
- export declare function isRemoteConfig(config: any): config is RemoteConfig;
75
- export declare function isNewConnectConfig(config: any): config is NewConnectConfig;
76
- export declare function isPortDiscoveryConfig(config: any): config is PortDiscoveryConfig;
77
- export declare function isInternalConnectConfig(config: any): config is InternalConnectConfig;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isInternalConnectConfig = exports.isPortDiscoveryConfig = exports.isNewConnectConfig = exports.isRemoteConfig = exports.isExistingConnectConfig = exports.isExternalConfig = void 0;
4
- function isExternalConfig(config) {
5
- if (typeof config.manifestUrl === 'string') {
6
- return true;
7
- }
8
- return false;
9
- }
10
- exports.isExternalConfig = isExternalConfig;
11
- function isExistingConnectConfig(config) {
12
- return hasUuid(config) && typeof config.address === 'string';
13
- }
14
- exports.isExistingConnectConfig = isExistingConnectConfig;
15
- function isRemoteConfig(config) {
16
- return isExistingConnectConfig(config) && typeof config.token === 'string';
17
- }
18
- exports.isRemoteConfig = isRemoteConfig;
19
- function hasUuid(config) {
20
- return typeof config.uuid === 'string';
21
- }
22
- function hasRuntimeVersion(config) {
23
- return config.runtime && typeof config.runtime.version === 'string';
24
- }
25
- function isNewConnectConfig(config) {
26
- return hasUuid(config) && hasRuntimeVersion(config);
27
- }
28
- exports.isNewConnectConfig = isNewConnectConfig;
29
- function isPortDiscoveryConfig(config) {
30
- return (isExternalConfig(config) && hasRuntimeVersion(config)) || isNewConnectConfig(config);
31
- }
32
- exports.isPortDiscoveryConfig = isPortDiscoveryConfig;
33
- function isInternalConnectConfig(config) {
34
- return isExistingConnectConfig(config) || isNewConnectConfig(config);
35
- }
36
- exports.isInternalConnectConfig = isInternalConnectConfig;
@@ -1 +0,0 @@
1
- export declare function asyncFilter<T>(values: T[], callback: (value: T) => Promise<boolean>): Promise<T[]>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asyncFilter = void 0;
4
- async function asyncFilter(values, callback) {
5
- return Promise.all(values.map(callback)).then((results) => values.filter((_, i) => results[i]));
6
- }
7
- exports.asyncFilter = asyncFilter;
@@ -1,13 +0,0 @@
1
- import type * as OpenFin from '../OpenFin';
2
- /**
3
- * @internal
4
- * Create a channel relay for a given channel exposition, allowing a single provider to route
5
- * actions to the designated clients.
6
- *
7
- * Designed to be used in conjunction with @expose
8
- *
9
- * @param channelProvider The channel provider to relay the actions on.
10
- * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
11
- */
12
- export declare const relayChannelClientApi: (channelProvider: OpenFin.ChannelProvider, relayId: string) => Promise<void>;
13
- export declare const createRelayedDispatch: (client: OpenFin.ChannelClient, target: OpenFin.Identity, relayId: string, relayErrorMsg?: string) => OpenFin.ChannelClient['dispatch'];
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRelayedDispatch = exports.relayChannelClientApi = void 0;
4
- const EXPECTED_ERRORS = [
5
- 'no longer connected',
6
- 'RTCDataChannel closed unexpectedly',
7
- 'The client you are trying to dispatch from is disconnected from the target provider',
8
- ];
9
- // Checks possible error messages that we want to trap, client error message can originate
10
- // from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
11
- const isDisconnectedError = (errorMsg) => {
12
- return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
13
- };
14
- /**
15
- * @internal
16
- * Create a channel relay for a given channel exposition, allowing a single provider to route
17
- * actions to the designated clients.
18
- *
19
- * Designed to be used in conjunction with @expose
20
- *
21
- * @param channelProvider The channel provider to relay the actions on.
22
- * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
23
- */
24
- const relayChannelClientApi = async (channelProvider, relayId) => {
25
- channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
26
- return channelProvider.dispatch(target, action, payload);
27
- });
28
- await Promise.resolve();
29
- };
30
- exports.relayChannelClientApi = relayChannelClientApi;
31
- const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
32
- try {
33
- return await client.dispatch(`relay:${relayId}`, {
34
- action,
35
- payload,
36
- target
37
- });
38
- }
39
- catch (e) {
40
- if (isDisconnectedError(e.message) && relayErrorMsg) {
41
- throw new Error(relayErrorMsg);
42
- }
43
- ;
44
- throw e;
45
- }
46
- };
47
- exports.createRelayedDispatch = createRelayedDispatch;
@@ -1,10 +0,0 @@
1
- /**
2
- * This function converts JS errors into plain objects
3
- */
4
- export type ErrorPlainObject = {
5
- stack?: string;
6
- message: string;
7
- name?: string;
8
- toString(): string;
9
- };
10
- export declare function errorToPOJO(error: Error): ErrorPlainObject;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.errorToPOJO = void 0;
4
- function errorToPOJO(error) {
5
- return {
6
- stack: error.stack,
7
- name: error.name,
8
- message: error.message,
9
- toString: error.toString
10
- };
11
- }
12
- exports.errorToPOJO = errorToPOJO;
@@ -1 +0,0 @@
1
- export declare function exhaustiveCheck(value: string, allowed?: string[]): never;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exhaustiveCheck = void 0;
4
- function exhaustiveCheck(value, allowed) {
5
- throw new Error(`Unsupported value: ${value}${allowed ? `\n Supported values are: ${allowed.join('')}` : ''}`);
6
- }
7
- exports.exhaustiveCheck = exhaustiveCheck;
@@ -1,11 +0,0 @@
1
- import { ClientRequestArgs } from 'http';
2
- export declare const getProxy: () => {
3
- port: string;
4
- host: string;
5
- username: string;
6
- password: string;
7
- };
8
- export declare const getRequestOptions: (url: string) => ClientRequestArgs;
9
- export declare const fetch: (url: string) => Promise<string>;
10
- export declare const downloadFile: (url: string, writeLocation: string) => Promise<void>;
11
- export declare const fetchJson: (url: string) => Promise<any>;
package/src/util/http.js DELETED
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchJson = exports.downloadFile = exports.fetch = exports.getRequestOptions = exports.getProxy = void 0;
4
- const node_url_1 = require("node:url"); // This must explicitly use node builtin to avoid accidentally bundling npm:url.
5
- const fs = require("fs");
6
- const getProxyVar = () => {
7
- return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
8
- };
9
- const getProxy = () => {
10
- const parsedUrl = new node_url_1.URL(getProxyVar());
11
- return {
12
- port: parsedUrl.port,
13
- host: parsedUrl.hostname,
14
- username: parsedUrl.username,
15
- password: parsedUrl.password
16
- };
17
- };
18
- exports.getProxy = getProxy;
19
- const getRequestOptions = (url) => {
20
- const parsedUrl = new node_url_1.URL(url);
21
- let options;
22
- if (getProxyVar() && parsedUrl.hostname !== 'localhost' && parsedUrl.hostname.substring(0, 3) !== '127') {
23
- options = {};
24
- const proxy = (0, exports.getProxy)();
25
- options.host = proxy.host;
26
- options.port = proxy.port;
27
- options.path = url;
28
- options.headers = { Host: parsedUrl.hostname };
29
- if (proxy.username && proxy.password) {
30
- const auth = `Basic ${Buffer.from(`${proxy.username}:${proxy.password}`).toString('base64')}`;
31
- Object.assign(options.headers, { 'Proxy-Authorization': auth });
32
- }
33
- }
34
- else {
35
- options = parsedUrl;
36
- }
37
- return options;
38
- };
39
- exports.getRequestOptions = getRequestOptions;
40
- const fetch = async (url) => {
41
- var _a;
42
- const requestUrl = getProxyVar() ? getProxyVar() : url;
43
- const proto = (0, node_url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
44
- const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
45
- return new Promise((resolve, reject) => {
46
- const options = (0, exports.getRequestOptions)(url);
47
- const request = fetcher.get(options, (response) => {
48
- if (response.statusCode < 200 || response.statusCode > 299) {
49
- reject(new Error(`Failed to load url: ${url}, status code:${response.statusCode}`));
50
- }
51
- const body = [];
52
- response.on('data', (chunk) => {
53
- body.push(chunk);
54
- });
55
- response.on('end', () => resolve(body.join('')));
56
- });
57
- request.on('error', (err) => {
58
- reject(err);
59
- });
60
- });
61
- };
62
- exports.fetch = fetch;
63
- const downloadFile = async (url, writeLocation) => {
64
- var _a;
65
- const requestUrl = getProxyVar() ? getProxyVar() : url;
66
- const proto = (0, node_url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
67
- const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
68
- return new Promise((resolve, reject) => {
69
- try {
70
- const options = (0, exports.getRequestOptions)(url);
71
- fetcher.get(options, (response) => {
72
- const file = fs.createWriteStream(writeLocation);
73
- response.pipe(file);
74
- file.on('finish', () => {
75
- file.close();
76
- resolve();
77
- });
78
- });
79
- }
80
- catch (e) {
81
- reject(e);
82
- }
83
- });
84
- };
85
- exports.downloadFile = downloadFile;
86
- const fetchJson = async (url) => {
87
- const res = await (0, exports.fetch)(url);
88
- return JSON.parse(res);
89
- };
90
- exports.fetchJson = fetchJson;
@@ -1,2 +0,0 @@
1
- export declare function createUnusableObject(message: string): Record<any, never>;
2
- export declare function createWarningObject<T extends {}>(message: string, obj: T): T;
@@ -1,49 +0,0 @@
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;
@@ -1,34 +0,0 @@
1
- /**
2
- * Handy class for managing asynchronous dependencies of classes.
3
- *
4
- * Will call the producer function once and only once when getValue is called,
5
- * returning the resultant value for every subsequent call.
6
- */
7
- export declare class Lazy<T> {
8
- private producerFn;
9
- constructor(producerFn: () => T);
10
- private value;
11
- /**
12
- * Lazily get the value returned by the producer.
13
- * @returns The value returned from the producer function
14
- */
15
- getValue(): T;
16
- }
17
- /**
18
- * Handy class for managing asynchronous dependencies of classes.
19
- *
20
- * Will call asynchronous producer only after `getValue` is called. If the
21
- * deferred code errors, we can try it again by re-calling `getValue` after
22
- * the promise rejects.
23
- */
24
- export declare class AsyncRetryableLazy<T> {
25
- private producerFn;
26
- constructor(producerFn: () => Promise<T>);
27
- private promise?;
28
- /**
29
- * Lazily get the value returned by the async producer.
30
- *
31
- * @returns The value returned from the producer function
32
- */
33
- getValue(): Promise<T>;
34
- }
package/src/util/lazy.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AsyncRetryableLazy = exports.Lazy = void 0;
4
- /**
5
- * Handy class for managing asynchronous dependencies of classes.
6
- *
7
- * Will call the producer function once and only once when getValue is called,
8
- * returning the resultant value for every subsequent call.
9
- */
10
- class Lazy {
11
- // eslint-disable-next-line
12
- constructor(producerFn) {
13
- this.producerFn = producerFn;
14
- }
15
- /**
16
- * Lazily get the value returned by the producer.
17
- * @returns The value returned from the producer function
18
- */
19
- getValue() {
20
- if (!this.value) {
21
- this.value = this.producerFn();
22
- }
23
- return this.value;
24
- }
25
- }
26
- exports.Lazy = Lazy;
27
- /**
28
- * Handy class for managing asynchronous dependencies of classes.
29
- *
30
- * Will call asynchronous producer only after `getValue` is called. If the
31
- * deferred code errors, we can try it again by re-calling `getValue` after
32
- * the promise rejects.
33
- */
34
- class AsyncRetryableLazy {
35
- // eslint-disable-next-line
36
- constructor(producerFn) {
37
- this.producerFn = producerFn;
38
- }
39
- /**
40
- * Lazily get the value returned by the async producer.
41
- *
42
- * @returns The value returned from the producer function
43
- */
44
- async getValue() {
45
- if (!this.promise) {
46
- this.promise = this.producerFn().catch((e) => {
47
- delete this.promise;
48
- throw e;
49
- });
50
- }
51
- return this.promise;
52
- }
53
- }
54
- exports.AsyncRetryableLazy = AsyncRetryableLazy;
@@ -1,3 +0,0 @@
1
- import { ConnectConfig, ExternalConfig, InternalConnectConfig } from '../transport/wire';
2
- export declare function normalizeConfig(config: ConnectConfig): Promise<InternalConnectConfig | ExternalConfig>;
3
- export declare function validateConfig(config: ConnectConfig): Promise<InternalConnectConfig>;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateConfig = exports.normalizeConfig = void 0;
4
- const fs = require("fs");
5
- const node_url_1 = require("node:url"); // This must explicitly use node builtin to avoid accidentally bundling npm:url
6
- const wire_1 = require("../transport/wire");
7
- const promises_1 = require("./promises");
8
- const http_1 = require("./http");
9
- async function readLocalConfig(location) {
10
- let pathToFile = location;
11
- if (location.startsWith('file')) {
12
- pathToFile = (0, node_url_1.fileURLToPath)(location);
13
- }
14
- const txt = await (0, promises_1.promisify)(fs.readFile)(pathToFile);
15
- return JSON.parse(txt.toString());
16
- }
17
- async function loadConfig(config) {
18
- try {
19
- return await (0, http_1.fetchJson)(config.manifestUrl);
20
- }
21
- catch (e) {
22
- try {
23
- return await readLocalConfig(config.manifestUrl);
24
- }
25
- catch (error) {
26
- throw new Error(`Could not locate JSON at supplied manifestUrl: ${config.manifestUrl}`);
27
- }
28
- }
29
- }
30
- async function normalizeConfig(config) {
31
- const testThisConfig = config;
32
- if ((0, wire_1.isExternalConfig)(config)) {
33
- const loadedConfig = await loadConfig(config);
34
- testThisConfig.runtime = loadedConfig.runtime;
35
- if (typeof loadedConfig.assetsUrl === 'string') {
36
- testThisConfig.assetsUrl = loadedConfig.assetsUrl;
37
- }
38
- if (Array.isArray(loadedConfig.services)) {
39
- testThisConfig.services = loadedConfig.services;
40
- }
41
- }
42
- return testThisConfig;
43
- }
44
- exports.normalizeConfig = normalizeConfig;
45
- async function validateConfig(config) {
46
- const normalized = await normalizeConfig(config);
47
- if ((0, wire_1.isInternalConnectConfig)(normalized)) {
48
- return normalized;
49
- }
50
- throw new Error('Invalid Config');
51
- }
52
- exports.validateConfig = validateConfig;
@@ -1,5 +0,0 @@
1
- export declare function promisify(func: Function): (...args: any[]) => Promise<any>;
2
- export declare function promiseMap<T, S>(arr: T[], asyncF: (x: T, i: number, r: T[]) => Promise<S>): Promise<S[]>;
3
- export type asyncF<T> = (...args: any[]) => Promise<T>;
4
- export declare function serial<T>(arr: asyncF<T>[]): Promise<T[]>;
5
- export declare function promiseMapSerial<T>(arr: any[], func: asyncF<T>): Promise<T[]>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promiseMapSerial = exports.serial = exports.promiseMap = exports.promisify = void 0;
4
- function promisify(func) {
5
- return (...args) => new Promise((resolve, reject) => {
6
- func(...args, (err, val) => (err ? reject(err) : resolve(val)));
7
- });
8
- }
9
- exports.promisify = promisify;
10
- async function promiseMap(arr, asyncF) {
11
- return Promise.all(arr.map(asyncF));
12
- }
13
- exports.promiseMap = promiseMap;
14
- async function serial(arr) {
15
- const ret = [];
16
- for (const func of arr) {
17
- // eslint-disable-next-line no-await-in-loop
18
- const next = await func();
19
- ret.push(next);
20
- }
21
- return ret;
22
- }
23
- exports.serial = serial;
24
- async function promiseMapSerial(arr, func) {
25
- return serial(arr.map((value, index, array) => () => func(value, index, array)));
26
- }
27
- exports.promiseMapSerial = promiseMapSerial;
@@ -1,7 +0,0 @@
1
- export declare class RefCounter {
2
- topicRefMap: Map<any, any>;
3
- incRefCount(key: string): number;
4
- decRefCount(key: string): number;
5
- actOnFirst(key: string, firstAction: () => any, nonFirstAction: () => {}): any;
6
- actOnLast(key: string, lastAction: () => any, nonLastAction: () => {}): any;
7
- }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RefCounter = void 0;
4
- class RefCounter {
5
- constructor() {
6
- this.topicRefMap = new Map();
7
- }
8
- // returns the ref count after incrementing
9
- incRefCount(key) {
10
- const refCount = this.topicRefMap.get(key);
11
- let returnCount;
12
- if (!refCount) {
13
- this.topicRefMap.set(key, 1);
14
- returnCount = 1;
15
- }
16
- else {
17
- const newRefCount = refCount + 1;
18
- returnCount = newRefCount;
19
- this.topicRefMap.set(key, newRefCount);
20
- }
21
- return returnCount;
22
- }
23
- // returns the ref count after decrementing, or -1 if the key already had no references
24
- decRefCount(key) {
25
- const refCount = this.topicRefMap.get(key);
26
- let returnCount;
27
- if (refCount) {
28
- const newRefCount = refCount - 1;
29
- this.topicRefMap.set(key, newRefCount);
30
- returnCount = newRefCount;
31
- }
32
- else {
33
- returnCount = -1;
34
- }
35
- return returnCount;
36
- }
37
- // Execute firstAction if it is the first such ref, else execute nonFirstAction.
38
- // In either case the return value is that of the action executed
39
- actOnFirst(key, firstAction, nonFirstAction) {
40
- const numRefs = this.incRefCount(key);
41
- const isFirstRef = numRefs === 1;
42
- return isFirstRef ? firstAction() : nonFirstAction();
43
- }
44
- // Execute lastAction if it is the first such ref, else execute nonLastAction.
45
- // In either case the return value is that of the action executed
46
- actOnLast(key, lastAction, nonLastAction) {
47
- const numRefs = this.decRefCount(key);
48
- const isLastRef = numRefs === 0;
49
- return isLastRef ? lastAction() : nonLastAction();
50
- }
51
- }
52
- exports.RefCounter = RefCounter;
@@ -1,11 +0,0 @@
1
- export declare class ReversibleMap<TKey extends string | number | symbol, TValue extends Object | string | number> {
2
- private readonly valueToKey;
3
- private readonly keyToValue;
4
- setUnique: (key: TKey, value: TValue) => void;
5
- getKey: (value: TValue) => TKey;
6
- getValue(key: TKey): TValue;
7
- deleteKey: (key: TKey) => TValue | undefined;
8
- deleteValue: (value: TValue) => TKey | undefined;
9
- hasKey: (key: TKey) => boolean;
10
- hasValue: (value: TValue) => boolean;
11
- }