@elliemae/pui-scripting-object 1.40.4 → 1.41.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.
@@ -1,4 +1,4 @@
1
- import { IEvent, Listener } from '../event.js';
1
+ import { IEvent } from '../event.js';
2
2
  import { IScriptingObject } from '../scriptingObject.js';
3
3
  import { UserAccessRights } from './userAccessRights.js';
4
4
  import { NavigationType } from './shared.js';
@@ -206,13 +206,19 @@ export type PrintOptions = {
206
206
  */
207
207
  blob: Blob;
208
208
  };
209
- type UserInfo = {
209
+ /**
210
+ * User information
211
+ */
212
+ export type UserInfo = {
210
213
  /**
211
214
  * user id
212
215
  */
213
216
  userId: string;
214
217
  };
215
- type ActionInfo = {
218
+ /**
219
+ * Action information
220
+ */
221
+ export type ActionInfo = {
216
222
  /**
217
223
  * name of the action
218
224
  */
@@ -220,121 +226,154 @@ type ActionInfo = {
220
226
  };
221
227
  /**
222
228
  * event handler that handles user login event
229
+ * @param params event parameters
230
+ * @param params.obj application object reference
231
+ * @param params.eventName event name
232
+ * @param params.eventParams logged in user info
233
+ * @param params.eventOptions additional options related to the event
223
234
  */
224
- export type ApplicationLoginListener = Listener<IApplication, UserInfo, Record<string, unknown>, void>;
235
+ export type ApplicationLoginListener = (params: {
236
+ obj: IApplication;
237
+ eventName: string;
238
+ eventParams: UserInfo;
239
+ eventOptions?: Record<string, unknown>;
240
+ }) => void;
225
241
  /**
226
242
  * event handler that handles action completed event
243
+ * @param params event parameters
244
+ * @param params.obj application object reference
245
+ * @param params.eventName event name
246
+ * @param params.eventParams action info
247
+ * @param params.eventOptions additional options related to the event
248
+ */
249
+ export type ApplicationActionCompletedListener = (params: {
250
+ obj: IApplication;
251
+ eventName: string;
252
+ eventParams: ActionInfo;
253
+ eventOptions?: Record<string, unknown>;
254
+ }) => void;
255
+ /**
256
+ * events related to the application
227
257
  */
228
- export type ApplicationActionCompletedListener = Listener<IApplication, ActionInfo, Record<string, unknown>, void>;
229
258
  export type ApplicationEvents = {
230
- /**
231
- * event fired when the user logs in
232
- */
233
- 'application.login': ApplicationLoginListener;
234
259
  /**
235
260
  * event fired when an action is completed. actions are executed through the performAction method
261
+ *
262
+ * Use {@link ApplicationActionCompletedListener} to handle this event
236
263
  */
237
264
  'application.actioncompleted': ApplicationActionCompletedListener;
265
+ /**
266
+ * event fired when the user logs in
267
+ *
268
+ * Use {@link ApplicationLoginListener} to handle this event
269
+ */
270
+ 'application.login': ApplicationLoginListener;
238
271
  };
239
272
  /**
240
273
  * Allows access to application-level UI elements, behaviors and events
274
+ *
275
+ * See {@link ApplicationEvents} for supported events
241
276
  */
242
277
  export interface IApplication extends IScriptingObject {
278
+ /**
279
+ * notifies action completion
280
+ *
281
+ * Use {@link ApplicationActionCompletedListener} to handle this event
282
+ */
283
+ readonly ActionCompleted: IEvent;
243
284
  /**
244
285
  * notifies user login
286
+ *
287
+ * Use {@link ApplicationLoginListener} to handle this event
245
288
  */
246
289
  readonly Login: IEvent;
247
290
  /**
248
- * notifies action completion
291
+ * close a modal
249
292
  */
250
- readonly ActionCompleted: IEvent;
293
+ closeModal(): Promise<void>;
251
294
  /**
252
- * Gets descriptor for the Application
253
- * @returns application descriptor
295
+ * extends the application with a new menu item or tool
296
+ * @param extensionObj properties of the extension
254
297
  */
255
- getDescriptior(): Promise<DescriptorInfo>;
298
+ extend(extensionObj: ApplicationExtension): Promise<void>;
256
299
  /**
257
300
  * Get the context of the application
258
301
  * @returns application context
259
302
  */
260
303
  getApplicationContext(): Promise<ApplicationContext>;
261
304
  /**
262
- * Get additional information about the application
263
- * @returns application info
264
- */
265
- getInfo(): Promise<AppInfo>;
266
- /**
267
- * extends the application with a new menu item or tool
268
- * @param extensionObj properties of the extension
305
+ * Get the capabilities of the application
306
+ * @returns capabilities as key-value pairs
269
307
  */
270
- extend(extensionObj: ApplicationExtension): Promise<void>;
308
+ getCapabilities(): Promise<Capabilities>;
271
309
  /**
272
- * navigate to a location in the application
273
- * @param options navigation options
310
+ * get company settings for a particular category
311
+ * @param options options to query company settings
312
+ * @returns company settings as key value pairs. Null if category is not found
274
313
  */
275
- navigate(options: NavigationOptions): Promise<void>;
276
- performAction(action: string, options: Record<string, string>): Promise<void>;
314
+ getCompanySettings(options: CompanySettingsQueryOptions): Promise<Record<string, unknown> | null>;
277
315
  /**
278
- * open a page or document
279
- * @param options target and type of the document to open
316
+ * Gets descriptor for the Application
317
+ * @returns application descriptor
280
318
  */
281
- open(options: OpenOptions): Promise<void>;
319
+ getDescriptor(): Promise<DescriptorInfo>;
282
320
  /**
283
- * open a modal
284
- * @param options modal properties
321
+ * Get additional information about the application
322
+ * @returns application info
285
323
  */
286
- openModal(options: OpenModalOptions): Promise<void>;
324
+ getInfo(): Promise<AppInfo>;
287
325
  /**
288
- * close a modal
326
+ * @deprecated use getUserAccessRights instead
327
+ * get persona Access information for the current user
328
+ * @returns persona access information as key value pairs
289
329
  */
290
- closeModal(): Promise<void>;
330
+ getPersonaAccess(): Promise<Record<string, string>>;
291
331
  /**
292
- * get supportability of an action
293
- * @param name action name
294
- * @returns true if the action is supported
332
+ * get policy details for the current user
333
+ * @returns policy details as key value pairs
295
334
  */
296
- supportsAction(name: string): Promise<boolean>;
335
+ getPoliciesDetails(): Promise<Record<string, string>>;
297
336
  /**
298
- * get navigability to a particular page or screen
299
- * @param name page or screen name
300
- * @returns true if the page or screen is navigable
337
+ * Get access rights for the current user
338
+ * @returns user access rights (effective rights)
339
+ * @throws {Error} if operation fails
301
340
  */
302
- supportsNavigateTo(name: string): Promise<boolean>;
341
+ getUserAccessRights(): Promise<UserAccessRights>;
303
342
  /**
304
- * Get the capabilities of the application
305
- * @returns capabilities as key-value pairs
343
+ * hide wait spinner
306
344
  */
307
- getCapabilities(): Promise<Capabilities>;
345
+ hideSpinner(): Promise<void>;
308
346
  /**
309
347
  * renew the user session
310
348
  */
311
349
  keepSessionAlive(): Promise<void>;
312
350
  /**
313
- * show wait spinner
314
- * @param message message to display
351
+ * log a message to host application's logs
352
+ * @param message message to log
353
+ * @param logLevel level of the log message
315
354
  */
316
- showSpinner(message: string): Promise<void>;
355
+ log(message: string, logLevel: LogLevel): Promise<void>;
317
356
  /**
318
- * hide wait spinner
357
+ * navigate to a location in the application
358
+ * @param options navigation options
319
359
  */
320
- hideSpinner(): Promise<void>;
360
+ navigate(options: NavigationOptions): Promise<void>;
321
361
  /**
322
- * get policy details for the current user
323
- * @returns policy details as key value pairs
362
+ * open a page or document
363
+ * @param options target and type of the document to open
324
364
  */
325
- getPoliciesDetails(): Promise<Record<string, string>>;
365
+ open(options: OpenOptions): Promise<void>;
326
366
  /**
327
- * @deprecated use getUserAccessRights instead
328
- * get persona Access information for the current user
329
- * @returns persona access information as key value pairs
367
+ * open a modal
368
+ * @param options modal properties
330
369
  */
331
- getPersonaAccess(): Promise<Record<string, string>>;
370
+ openModal(options: OpenModalOptions): Promise<void>;
332
371
  /**
333
- * Get access rights for the current user
334
- * @returns user access rights (effective rights)
335
- * @throws {Error} if operation fails
372
+ * Perform an action
373
+ * @param action action name
374
+ * @param options additional options
336
375
  */
337
- getUserAccessRights(): Promise<UserAccessRights>;
376
+ performAction(action: string, options: Record<string, string>): Promise<void>;
338
377
  /**
339
378
  * Prints given document
340
379
  * @param options Print options
@@ -346,16 +385,20 @@ export interface IApplication extends IScriptingObject {
346
385
  */
347
386
  showError(message: string): Promise<void>;
348
387
  /**
349
- * log a message to host application's logs
350
- * @param message message to log
351
- * @param logLevel level of the log message
388
+ * show wait spinner
389
+ * @param message message to display
352
390
  */
353
- log(message: string, logLevel: LogLevel): Promise<void>;
391
+ showSpinner(message: string): Promise<void>;
354
392
  /**
355
- * get company settings for a particular category
356
- * @param options {CompanySettingsQueryOptions} options to query company settings
357
- * @returns company settings as key value pairs. Null if category is not found
393
+ * get supportability of an action
394
+ * @param name action name
395
+ * @returns true if the action is supported
396
+ */
397
+ supportsAction(name: string): Promise<boolean>;
398
+ /**
399
+ * get navigability to a particular page or screen
400
+ * @param name page or screen name
401
+ * @returns true if the page or screen is navigable
358
402
  */
359
- getCompanySettings(options: CompanySettingsQueryOptions): Promise<Record<string, any> | null>;
403
+ supportsNavigateTo(name: string): Promise<boolean>;
360
404
  }
361
- export {};
@@ -1,9 +1,15 @@
1
1
  import { IScriptingObject } from '../scriptingObject.js';
2
+ /**
3
+ * Personas information
4
+ */
2
5
  export type Personas = {
3
6
  entityId: string;
4
7
  entityType: string;
5
8
  entityName: string;
6
9
  };
10
+ /**
11
+ * User information
12
+ */
7
13
  export type User = {
8
14
  /**
9
15
  * unique identifier for the user
@@ -84,6 +90,9 @@ export declare enum SCOPE {
84
90
  */
85
91
  Analyzer = "Analyzer"
86
92
  }
93
+ /**
94
+ * Plugin information
95
+ */
87
96
  export type PluginInfo = {
88
97
  /**
89
98
  * unique identifier for the plugin
@@ -98,6 +107,9 @@ export type PluginInfo = {
98
107
  */
99
108
  scope: SCOPE;
100
109
  };
110
+ /**
111
+ * Token information
112
+ */
101
113
  export type TokenInfo = {
102
114
  /**
103
115
  * child access token
@@ -1,10 +1,22 @@
1
- import { IEvent, Listener } from '../event.js';
1
+ import { IEvent } from '../event.js';
2
2
  import { IScriptingObject } from '../scriptingObject.js';
3
+ /**
4
+ * metadata about the form descriptor
5
+ */
3
6
  export type FormDescriptor = {
7
+ /**
8
+ * unique id of the form
9
+ */
4
10
  id: string;
11
+ /**
12
+ * name of the form
13
+ */
5
14
  name: string;
6
15
  };
7
- type FormInfo = {
16
+ /**
17
+ * metadata about the form
18
+ */
19
+ export type FormInfo = {
8
20
  /**
9
21
  * unique id of the form
10
22
  */
@@ -12,47 +24,76 @@ type FormInfo = {
12
24
  };
13
25
  /**
14
26
  * event handler for form load event
27
+ * @param params event parameters
28
+ * @param params.obj form object reference
29
+ * @param params.eventName event name
30
+ * @param params.eventParams form info
31
+ * @param params.eventOptions additional options related to the event
15
32
  */
16
- export type FormLoadListener = Listener<IForm, FormInfo, Record<string, unknown>, void>;
33
+ export type FormLoadListener = (params: {
34
+ obj: IForm;
35
+ eventName: string;
36
+ eventParams: FormInfo;
37
+ eventOptions?: Record<string, unknown>;
38
+ }) => void;
17
39
  /**
18
40
  * event handler for form unload event
41
+ * @param params event parameters
42
+ * @param params.obj form object reference
43
+ * @param params.eventName event name
44
+ * @param params.eventParams form info
45
+ * @param params.eventOptions additional options related to the event
19
46
  */
20
- export type FormUnloadListener = Listener<IForm, FormInfo, Record<string, unknown>, void>;
47
+ export type FormUnloadListener = (params: {
48
+ obj: IForm;
49
+ eventName: string;
50
+ eventParams: FormInfo;
51
+ eventOptions?: Record<string, unknown>;
52
+ }) => void;
21
53
  /**
22
54
  * events that notifies the form's lifecycle
23
55
  */
24
56
  export type FormEvents = {
25
57
  /**
26
58
  * form is loaded and ready for user interaction
59
+ *
60
+ * Use {@link FormLoadListener} to handle this event
27
61
  */
28
62
  'form.load': FormLoadListener;
29
63
  /**
30
64
  * form is unloaded and no longer available for user interaction
65
+ *
66
+ * Use {@link FormUnloadListener} to handle this event
31
67
  */
32
68
  'form.unload': FormUnloadListener;
33
69
  };
34
70
  /**
35
71
  * Methods to get information about the custom form
72
+ *
73
+ * See {@link FormEvents} for supported events
36
74
  */
37
75
  export interface IForm extends IScriptingObject {
38
76
  /**
39
77
  * event fired when the form is loaded
78
+ *
79
+ * Use {@link FormLoadListener} to handle this event
40
80
  */
41
81
  readonly Load: IEvent;
42
82
  /**
43
83
  * event fired when the form is unloaded
84
+ *
85
+ * Use {@link FormUnloadListener} to handle this event
44
86
  */
45
87
  readonly Unload: IEvent;
46
- /**
47
- * get metadata of the form
48
- * @returns form metadata
49
- */
50
- getDescriptor(): Promise<FormDescriptor>;
51
88
  /**
52
89
  * get reference to the form's input control
53
90
  * @param id form id
54
91
  * @returns form input control object
55
92
  */
56
93
  getControl(id: string): Promise<unknown>;
94
+ /**
95
+ * get metadata of the form
96
+ * @returns form metadata
97
+ */
98
+ getDescriptor(): Promise<FormDescriptor>;
57
99
  }
58
- export {};
@@ -1,6 +1,9 @@
1
- import { IEvent, Listener } from '../event.js';
1
+ import { IEvent } from '../event.js';
2
2
  import { IScriptingObject } from '../scriptingObject.js';
3
- type StateInfo = {
3
+ /**
4
+ * state information
5
+ */
6
+ export type StateInfo = {
4
7
  /**
5
8
  * name of the key for which the value changed
6
9
  */
@@ -8,14 +11,26 @@ type StateInfo = {
8
11
  };
9
12
  /**
10
13
  * event handler for global state change event
14
+ * @param params event parameters
15
+ * @param params.obj global object reference
16
+ * @param params.eventName event name
17
+ * @param params.eventParams state info
18
+ * @param params.eventOptions additional options related to the event
11
19
  */
12
- export type GlobalChangeListener = Listener<IGlobal, StateInfo, Record<string, unknown>, void>;
20
+ export type GlobalChangeListener = (params: {
21
+ obj: IGlobal;
22
+ eventName: string;
23
+ eventParams: StateInfo;
24
+ eventOptions?: Record<string, unknown>;
25
+ }) => void;
13
26
  /**
14
27
  * events fired from Global scripting object
15
28
  */
16
29
  export type GlobalEvents = {
17
30
  /**
18
31
  * event fired when a value changes in the global store
32
+ *
33
+ * Use {@link GlobalChangeListener} to handle this event
19
34
  */
20
35
  'global.change': GlobalChangeListener;
21
36
  };
@@ -26,7 +41,7 @@ export type GlobalEvents = {
26
41
  *
27
42
  * The implementation of this object should write the global state data to the host application's sessionStore,
28
43
  * but should ensure that the state is isolated away from the host application's state variables. This should be done by creating
29
- * naming conventions for the global keyspaces, e.g. ssf.global.<key>.
44
+ * naming conventions for the global keyspaces, e.g. ssf.global.[key].
30
45
  *
31
46
  * In order to ensure that guest applications cannot consume significant amounts of sessionStorage, restrictions should be placed on
32
47
  * the number and size of the stored session state. In particular, we can start with these values:
@@ -34,23 +49,26 @@ export type GlobalEvents = {
34
49
  * Total global state should be limited to 50 values
35
50
  * This will ensure that no guest can consume more than 250 KB of sessionStorage
36
51
  *
52
+ * See {@link GlobalEvents} for supported events
37
53
  */
38
54
  export interface IGlobal extends IScriptingObject {
39
55
  /**
40
56
  * event fired when the global state changes
57
+ *
58
+ * Use {@link GlobalChangeListener} to handle this event
41
59
  */
42
60
  readonly Change: IEvent;
43
61
  /**
44
- * set a value in the global store
62
+ * get a value from the global store
45
63
  * @param key unique key to identify the value
46
- * @param value value to be stored
64
+ * @returns value stored in the global store
47
65
  */
48
- set(key: string, value: unknown): Promise<void>;
66
+ get(key: string): Promise<string>;
49
67
  /**
50
- * get a value from the global store
68
+ * set a value in the global store
51
69
  * @param key unique key to identify the value
52
- * @returns value stored in the global store
70
+ * @param value value to be stored
71
+ * @param overwrite if true, overwrite the value if it already exists. Default is false
53
72
  */
54
- get(key: string): Promise<unknown>;
73
+ set(key: string, value: unknown, overwrite?: boolean): Promise<void>;
55
74
  }
56
- export {};
@@ -6,21 +6,21 @@ import { IScriptingObject } from '../scriptingObject.js';
6
6
  */
7
7
  export interface IHttp extends IScriptingObject {
8
8
  /**
9
- * get http request
9
+ * delete http request
10
10
  * @param url url to make the call to
11
11
  * @param headersOrAccessToken http headers object or access token to be used for the call
12
12
  * @returns http response object
13
13
  * @throws error if the http call fails with non 2xx status code
14
14
  */
15
- get(url: string, headersOrAccessToken?: string | Record<string, string>): Promise<Response>;
15
+ delete(url: string, headersOrAccessToken?: string | Record<string, string>): Promise<Response>;
16
16
  /**
17
- * post http request
17
+ * get http request
18
18
  * @param url url to make the call to
19
19
  * @param headersOrAccessToken http headers object or access token to be used for the call
20
20
  * @returns http response object
21
21
  * @throws error if the http call fails with non 2xx status code
22
22
  */
23
- post(url: string, headersOrAccessToken?: string | Record<string, string>, content?: string | Record<string, string>): Promise<Response>;
23
+ get(url: string, headersOrAccessToken?: string | Record<string, string>): Promise<Response>;
24
24
  /**
25
25
  * patch http request
26
26
  * @param url url to make the call to
@@ -30,19 +30,19 @@ export interface IHttp extends IScriptingObject {
30
30
  */
31
31
  patch(url: string, headersOrAccessToken?: string | Record<string, string>, content?: string | Record<string, string>): Promise<Response>;
32
32
  /**
33
- * put http request
33
+ * post http request
34
34
  * @param url url to make the call to
35
35
  * @param headersOrAccessToken http headers object or access token to be used for the call
36
36
  * @returns http response object
37
37
  * @throws error if the http call fails with non 2xx status code
38
38
  */
39
- put(url: string, headersOrAccessToken?: string | Record<string, string>, content?: string | Record<string, string>): Promise<Response>;
39
+ post(url: string, headersOrAccessToken?: string | Record<string, string>, content?: string | Record<string, string>): Promise<Response>;
40
40
  /**
41
- * delete http request
41
+ * put http request
42
42
  * @param url url to make the call to
43
43
  * @param headersOrAccessToken http headers object or access token to be used for the call
44
44
  * @returns http response object
45
45
  * @throws error if the http call fails with non 2xx status code
46
46
  */
47
- delete(url: string, headersOrAccessToken?: string | Record<string, string>): Promise<Response>;
47
+ put(url: string, headersOrAccessToken?: string | Record<string, string>, content?: string | Record<string, string>): Promise<Response>;
48
48
  }