@elliemae/microfe-common 2.9.9 → 2.16.5
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/dist/cjs/event.js +29 -15
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/messageType.js +7 -6
- package/dist/cjs/proxy.js +53 -0
- package/dist/cjs/scriptingObject.js +2 -1
- package/dist/cjs/scriptingObjectManager.js +12 -36
- package/dist/esm/event.js +29 -15
- package/dist/esm/index.js +5 -1
- package/dist/esm/messageType.js +7 -6
- package/dist/esm/proxy.js +33 -0
- package/dist/esm/scriptingObject.js +2 -1
- package/dist/esm/scriptingObjectManager.js +12 -36
- package/dist/types/lib/event.d.ts +119 -22
- package/dist/types/lib/guest.d.ts +8 -39
- package/dist/types/lib/index.d.ts +5 -3
- package/dist/types/lib/messageType.d.ts +7 -6
- package/dist/types/lib/proxy.d.ts +25 -0
- package/dist/types/lib/scriptingObject.d.ts +6 -0
- package/dist/types/lib/scriptingObjectManager.d.ts +6 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
|
|
2
2
|
import { LogLevels } from '@elliemae/pui-diagnostics';
|
|
3
|
-
import { EventListeners
|
|
3
|
+
import { EventListeners } from './common.js';
|
|
4
|
+
import { IEventManager } from './event.js';
|
|
4
5
|
import { ScriptingObjects } from './scriptingObjectManager.js';
|
|
5
6
|
/**
|
|
6
7
|
* parameters for connecting to the host
|
|
@@ -11,36 +12,10 @@ export type ConnectParam = {
|
|
|
11
12
|
*/
|
|
12
13
|
window?: Window;
|
|
13
14
|
} & Record<string, any>;
|
|
14
|
-
/**
|
|
15
|
-
* parameters for subscribing to an event
|
|
16
|
-
*/
|
|
17
|
-
export type SubscribeParam<EventId, EventListener extends Listener<any, any, any, any>> = {
|
|
18
|
-
/**
|
|
19
|
-
* unique id of the event
|
|
20
|
-
*/
|
|
21
|
-
eventId: EventId;
|
|
22
|
-
/**
|
|
23
|
-
* event listener
|
|
24
|
-
*/
|
|
25
|
-
callback: EventListener;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* parameters for unsubscribing from an event
|
|
29
|
-
*/
|
|
30
|
-
export type UnsubscribeParam<EventId> = {
|
|
31
|
-
/**
|
|
32
|
-
* unique id of the event
|
|
33
|
-
*/
|
|
34
|
-
eventId: EventId;
|
|
35
|
-
/**
|
|
36
|
-
* subscription token
|
|
37
|
-
*/
|
|
38
|
-
token: string;
|
|
39
|
-
};
|
|
40
15
|
/**
|
|
41
16
|
* Interface for SSF guest
|
|
42
17
|
*/
|
|
43
|
-
export interface ISSFGuest<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> {
|
|
18
|
+
export interface ISSFGuest<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> extends IEventManager<AppEvents> {
|
|
44
19
|
/**
|
|
45
20
|
* Initialize guest using script
|
|
46
21
|
* @param scriptUri uri of the script
|
|
@@ -67,6 +42,11 @@ export interface ISSFGuest<AppObjects extends ScriptingObjects = Partial<Scripti
|
|
|
67
42
|
* @returns scripting object proxy
|
|
68
43
|
*/
|
|
69
44
|
getObject: <Id extends Extract<keyof AppObjects, string>>(objectId: Id) => Promise<AppObjects[Id]>;
|
|
45
|
+
/**
|
|
46
|
+
* Get names of scripting objects exposed by the host
|
|
47
|
+
* @returns scripting objects exposed by the host
|
|
48
|
+
*/
|
|
49
|
+
listObjects: () => Promise<keyof AppObjects>;
|
|
70
50
|
/**
|
|
71
51
|
* remove the guest from the host
|
|
72
52
|
*/
|
|
@@ -76,15 +56,4 @@ export interface ISSFGuest<AppObjects extends ScriptingObjects = Partial<Scripti
|
|
|
76
56
|
* @param {LogLevels} logLevel - log level
|
|
77
57
|
*/
|
|
78
58
|
setLogLevel: (logLevel: LogLevels) => void;
|
|
79
|
-
/**
|
|
80
|
-
* subscribe to an scripting object event
|
|
81
|
-
* @param {SubscribeParam<EventId, AppEvents[EventId]>} param - parameters for subscribing to an event
|
|
82
|
-
* @returns subscription token
|
|
83
|
-
*/
|
|
84
|
-
subscribe: <EventId extends Extract<keyof AppEvents, string>>(param: SubscribeParam<EventId, AppEvents[EventId]>) => string;
|
|
85
|
-
/**
|
|
86
|
-
* unsubscribe from an scripting object event
|
|
87
|
-
* @param {UnsubscribeParam<EventId>} param - parameters for unsubscribing from an event
|
|
88
|
-
*/
|
|
89
|
-
unsubscribe: <EventId extends Extract<keyof AppEvents, string>>(param: UnsubscribeParam<EventId>) => void;
|
|
90
59
|
}
|
|
@@ -2,11 +2,13 @@ export { Remoting, sendMessage } from './remoting.js';
|
|
|
2
2
|
export type { ListenerCallback, ListenerCallbackParams, ListenParam, InvokeParam, RaiseExceptionParam, RespondParam, SendParam, AddSenderParam, } from './remoting.js';
|
|
3
3
|
export type { RemotingEventMessage } from './remotingEventMessage.js';
|
|
4
4
|
export { getEventId, ProxyEvent } from './event.js';
|
|
5
|
-
export type { IScriptingObjectProxyEvent, EventParam } from './event.js';
|
|
5
|
+
export type { IScriptingObjectProxyEvent, EventParam, DispatchEventParam, EventOptions, SubscribeParam, UnsubscribeParam, IEventManager, } from './event.js';
|
|
6
6
|
export { Event } from './event.js';
|
|
7
|
-
export { ScriptingObject } from './scriptingObject.js';
|
|
7
|
+
export { ScriptingObject, isPublicFunction } from './scriptingObject.js';
|
|
8
|
+
export type { ScriptingObjects } from './scriptingObject.js';
|
|
8
9
|
export { MessageType } from './messageType.js';
|
|
9
10
|
export type { EventListeners, Listener } from './common.js';
|
|
10
|
-
export type { ISSFGuest, ConnectParam
|
|
11
|
+
export type { ISSFGuest, ConnectParam } from './guest.js';
|
|
11
12
|
export { ScriptingObjectManager } from './scriptingObjectManager.js';
|
|
12
13
|
export type { AddScriptingObjectParams, GetObjectParams, GuestContext, } from './scriptingObjectManager.js';
|
|
14
|
+
export { ScriptingObjectProxy, isScriptingObjectProxy } from './proxy.js';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export declare enum MessageType {
|
|
2
|
-
GuestReady = "guest:ready",
|
|
3
2
|
GuestClose = "guest:close",
|
|
3
|
+
GuestFocus = "guest:focus",
|
|
4
|
+
GuestReady = "guest:ready",
|
|
4
5
|
GuestReadyComplete = "guest:readyComplete",
|
|
5
6
|
GuestResize = "guest:resize",
|
|
6
|
-
GuestFocus = "guest:focus",
|
|
7
7
|
HandShake = "handshake",
|
|
8
8
|
HandShakeAck = "handshake:ack",
|
|
9
|
-
|
|
10
|
-
ObjectGet = "object:get",
|
|
11
|
-
ObjectEvent = "object:event",
|
|
9
|
+
HostClose = "host:close",
|
|
12
10
|
HostConfig = "host:config",
|
|
13
|
-
|
|
11
|
+
ListObjects = "list:objects",
|
|
12
|
+
ObjectEvent = "object:event",
|
|
13
|
+
ObjectGet = "object:get",
|
|
14
|
+
ObjectInvoke = "object:invoke"
|
|
14
15
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IScriptingObjectProxy } from '@elliemae/pui-scripting-object';
|
|
2
|
+
/**
|
|
3
|
+
* Scripting Object Proxy implementation
|
|
4
|
+
*/
|
|
5
|
+
export declare class ScriptingObjectProxy implements IScriptingObjectProxy {
|
|
6
|
+
/**
|
|
7
|
+
* proxy type
|
|
8
|
+
*/
|
|
9
|
+
readonly __TYPE__ = "Proxy";
|
|
10
|
+
/**
|
|
11
|
+
* unique id of scripting object
|
|
12
|
+
*/
|
|
13
|
+
readonly id: string;
|
|
14
|
+
/**
|
|
15
|
+
* type of scripting object
|
|
16
|
+
*/
|
|
17
|
+
readonly objectType: string;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new instance of the Scripting Object Proxy
|
|
20
|
+
* @param objectId unique id of scripting object
|
|
21
|
+
* @param objectType type of scripting object
|
|
22
|
+
*/
|
|
23
|
+
constructor(objectId: string, objectType: string);
|
|
24
|
+
}
|
|
25
|
+
export declare const isScriptingObjectProxy: (value: any) => value is IScriptingObjectProxy;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RemotingScriptingObject, IScriptingObject } from '@elliemae/pui-scripting-object';
|
|
2
2
|
export type GenericFunction = (...args: unknown[]) => unknown;
|
|
3
|
+
export declare const isPublicFunction: (value: any, fnName: string) => value is GenericFunction;
|
|
3
4
|
/**
|
|
4
5
|
* Base class for all scripting objects
|
|
5
6
|
*/
|
|
@@ -33,3 +34,8 @@ export declare class ScriptingObject implements IScriptingObject {
|
|
|
33
34
|
*/
|
|
34
35
|
dispose: () => void;
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* collection of scripting objects
|
|
40
|
+
*/
|
|
41
|
+
export type ScriptingObjects = Record<string, IScriptingObject>;
|
|
@@ -79,6 +79,12 @@ export declare class ScriptingObjectManager<AppObjects extends ScriptingObjects
|
|
|
79
79
|
* @returns proxied scripting object reference
|
|
80
80
|
*/
|
|
81
81
|
getObject: <ObjectId extends Extract<keyof AppObjects, string>>(objectId: ObjectId, guest?: GuestContext) => AppObjects[ObjectId] | null;
|
|
82
|
+
/**
|
|
83
|
+
* list name of scripting objects for the given guest
|
|
84
|
+
* @param guestId unique id of the guest
|
|
85
|
+
* @returns name of scripting objects for the given guest
|
|
86
|
+
*/
|
|
87
|
+
listScriptingObjects: (guestId: string) => Extract<keyof AppObjects, string>[];
|
|
82
88
|
/**
|
|
83
89
|
* removes scripting object
|
|
84
90
|
* @param objectId unique id of the scripting object
|