@elliemae/pui-scripting-object 1.6.1 → 1.7.0

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/index.js CHANGED
@@ -21,6 +21,7 @@ __reExport(lib_exports, require("./form.js"), module.exports);
21
21
  __reExport(lib_exports, require("./global.js"), module.exports);
22
22
  __reExport(lib_exports, require("./http.js"), module.exports);
23
23
  __reExport(lib_exports, require("./loan.js"), module.exports);
24
+ __reExport(lib_exports, require("./loanv2.js"), module.exports);
24
25
  __reExport(lib_exports, require("./module.js"), module.exports);
25
26
  __reExport(lib_exports, require("./script.js"), module.exports);
26
27
  __reExport(lib_exports, require("./session.js"), module.exports);
package/dist/cjs/loan.js CHANGED
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -13,4 +17,14 @@ var __copyProps = (to, from, except, desc) => {
13
17
  };
14
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
19
  var loan_exports = {};
20
+ __export(loan_exports, {
21
+ LoanLevelActions: () => LoanLevelActions
22
+ });
16
23
  module.exports = __toCommonJS(loan_exports);
24
+ var LoanLevelActions = /* @__PURE__ */ ((LoanLevelActions2) => {
25
+ LoanLevelActions2["UPDATE_CORRESPONDENT_BALANCE"] = "updateCorrespondentBalance";
26
+ LoanLevelActions2["UPDATE_CORRESPONDENT_FEES"] = "updateCorrespondentFees";
27
+ LoanLevelActions2["COPY_ITEMIZATION_TO_STATE_DISCLOSURE"] = "copyItemizationToStateDisclosure";
28
+ LoanLevelActions2["CALCULATE_EEM_MORTGAGE"] = "calculateEEMMortgage";
29
+ return LoanLevelActions2;
30
+ })(LoanLevelActions || {});
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var loanv2_exports = {};
20
+ __export(loanv2_exports, {
21
+ FieldErrorType: () => FieldErrorType
22
+ });
23
+ module.exports = __toCommonJS(loanv2_exports);
24
+ var FieldErrorType = /* @__PURE__ */ ((FieldErrorType2) => {
25
+ FieldErrorType2["ACCESS"] = "access";
26
+ FieldErrorType2["VALUE"] = "value";
27
+ return FieldErrorType2;
28
+ })(FieldErrorType || {});
package/dist/esm/index.js CHANGED
@@ -4,6 +4,7 @@ export * from "./form.js";
4
4
  export * from "./global.js";
5
5
  export * from "./http.js";
6
6
  export * from "./loan.js";
7
+ export * from "./loanv2.js";
7
8
  export * from "./module.js";
8
9
  export * from "./script.js";
9
10
  export * from "./session.js";
package/dist/esm/loan.js CHANGED
@@ -0,0 +1,10 @@
1
+ var LoanLevelActions = /* @__PURE__ */ ((LoanLevelActions2) => {
2
+ LoanLevelActions2["UPDATE_CORRESPONDENT_BALANCE"] = "updateCorrespondentBalance";
3
+ LoanLevelActions2["UPDATE_CORRESPONDENT_FEES"] = "updateCorrespondentFees";
4
+ LoanLevelActions2["COPY_ITEMIZATION_TO_STATE_DISCLOSURE"] = "copyItemizationToStateDisclosure";
5
+ LoanLevelActions2["CALCULATE_EEM_MORTGAGE"] = "calculateEEMMortgage";
6
+ return LoanLevelActions2;
7
+ })(LoanLevelActions || {});
8
+ export {
9
+ LoanLevelActions
10
+ };
@@ -0,0 +1,8 @@
1
+ var FieldErrorType = /* @__PURE__ */ ((FieldErrorType2) => {
2
+ FieldErrorType2["ACCESS"] = "access";
3
+ FieldErrorType2["VALUE"] = "value";
4
+ return FieldErrorType2;
5
+ })(FieldErrorType || {});
6
+ export {
7
+ FieldErrorType
8
+ };
@@ -4,6 +4,7 @@ export * from './form.js';
4
4
  export * from './global.js';
5
5
  export * from './http.js';
6
6
  export * from './loan.js';
7
+ export * from './loanv2.js';
7
8
  export * from './module.js';
8
9
  export * from './script.js';
9
10
  export * from './session.js';
@@ -11,9 +11,13 @@ export declare type FieldOptions = {
11
11
  */
12
12
  value: string;
13
13
  };
14
- export declare type SetFieldResponse = {
15
- failed: string[];
16
- };
14
+ export declare type LoanObject = Record<string, any>;
15
+ export declare enum LoanLevelActions {
16
+ UPDATE_CORRESPONDENT_BALANCE = "updateCorrespondentBalance",
17
+ UPDATE_CORRESPONDENT_FEES = "updateCorrespondentFees",
18
+ COPY_ITEMIZATION_TO_STATE_DISCLOSURE = "copyItemizationToStateDisclosure",
19
+ CALCULATE_EEM_MORTGAGE = "calculateEEMMortgage"
20
+ }
17
21
  /**
18
22
  * The Loan object provides methods for interacting with an open loan in the application's editor screen(s).
19
23
  */
@@ -28,20 +32,20 @@ export interface ILoan {
28
32
  * :-----:|:-----: |:-----: |:-----: |:-----: |
29
33
  * | all | ✔ | ✔ | ✔ | ✖️ |
30
34
  */
31
- all(): Promise<Record<string, any>>;
32
- apply(loan: Record<string, string>): Promise<void>;
35
+ all(): Promise<LoanObject>;
33
36
  /**
34
- * Commit all pending changes for the current loan
35
- *
36
- * @returns v3 Loan Object
37
- * @throws {Error} if the loan is not in a valid state or if there are business rule violations
37
+ * Applies a partial loan object to the current loan,
38
+ */
39
+ apply(loan: LoanObject): Promise<void>;
40
+ /**
41
+ * Commit all pending changes on the current loan
38
42
  *
39
43
  * #### Product Compatibility:
40
44
  * | | Encompass | Encompass Web | TPO | Consumer Connect |
41
45
  * :-----:|:-----: |:-----: |:-----: |:-----: |
42
46
  * | all | ✔ | ✔ | ✔ | ✖️ |
43
47
  */
44
- commit(): Promise<Record<string, any>>;
48
+ commit(): Promise<void>;
45
49
  getField(id: string): Promise<string>;
46
50
  /**
47
51
  * get options for list of fields
@@ -83,30 +87,86 @@ export interface ILoan {
83
87
  * ```
84
88
  */
85
89
  getFieldOptions(fieldIds: string[]): Promise<Record<string, FieldOptions[]>>;
90
+ /**
91
+ * Returns the value of a single field using its field ID.
92
+ *
93
+ * @param ids The field ID of the fields to retrieve.
94
+ */
86
95
  getFields(ids: string[]): Promise<Record<string, string>>;
87
96
  /**
88
97
  * Set the values of one or more fields on the Loan.
89
98
  *
90
99
  * @param fields list of field ids and their values
91
- * @returns list of field ids that failed to set
92
- * @throws {Error} if operation fails due to network error
93
100
  */
94
- setFields(fields: Record<string, string>): Promise<SetFieldResponse>;
101
+ setFields(fields: Record<string, string>): Promise<void>;
102
+ /**
103
+ * Syncs the loan workspace with any changes made by other users.
104
+ */
95
105
  merge(): Promise<void>;
106
+ /**
107
+ * Indicates if the loan is editable or in a read-only state.
108
+ */
96
109
  isReadOnly(): Promise<boolean>;
110
+ /**
111
+ * Applies or removes the calculation lock on a loan field. In this way you can enable or disable the lock on a loan field programmatically. Parameters are: ID of the field you want to apply or remove the calculation lock and the status you want to set the lock to
112
+ *
113
+ * @param fieldId ID of the field you want to apply or remove the calculation lock
114
+ * @param lock
115
+ */
97
116
  applyLock(fieldId: string, lock: boolean): Promise<void>;
117
+ /**
118
+ * Executes calculations and business rules
119
+ */
98
120
  calculate(): Promise<void>;
121
+ /**
122
+ * Returns an object with current application selected
123
+ */
99
124
  getCurrentApplication(): Promise<Record<string, string>>;
100
- execAction(type: string): Promise<void>;
125
+ /**
126
+ * Execute loan level action, this is specific to v3 stateful implementation
127
+ */
128
+ execAction(type: LoanLevelActions): Promise<LoanObject>;
129
+ /**
130
+ * Returns an object reference of type LoanCollection. Argument "name" is required & used to get specific collection like BorrowerEmployer, Escrow etc.
131
+ *
132
+ * @param name collection template name
133
+ */
101
134
  getCollection(name: string): Promise<Record<string, string>>;
102
135
  getLockSnapshot(): Promise<Record<string, string>>;
103
136
  }
137
+ /**
138
+ * This event is fired prior to saving and pending changes to the loan. The guest can use this event to perform custom validation and, via the feedback mechanism, prevent the loan from being saved
139
+ */
104
140
  export declare type LoanPreCommitListener = (cause: string) => boolean;
141
+ /**
142
+ * This event is fired after pending changes to the loan are committed
143
+ */
105
144
  export declare type LoanCommittedListener = (cause: string) => void;
145
+ /**
146
+ * This event is fired for each change made by the user in the UI
147
+ */
106
148
  export declare type LoanChangeListener = () => void;
149
+ /**
150
+ * This event is fired after the loan is sync'ed within any saved state made outside of the user's workspace. This event should fire after any call to calculate() or merge(), assuming any changes are made to the loan
151
+ */
107
152
  export declare type LoanSyncListener = () => void;
153
+ /**
154
+ * Fired after the loan is opened and ready for user interaction
155
+ */
108
156
  export declare type LoanOpenListener = () => void;
157
+ /**
158
+ * Fired just prior to closing the loan in the UI
159
+ */
109
160
  export declare type LoanCloseListener = () => boolean;
161
+ /**
162
+ * This event is fired after a milestone is completed by the user and committed to the server
163
+ */
110
164
  export declare type LoanMilestoneCompletedListener = (name: string) => void;
165
+ /**
166
+ * This event is fired when the user attempts to complete a milestone and allows for custom validation, and cancellation, of the process
167
+ */
111
168
  export declare type LoanPreMilestoneCompleteListener = (name: string) => boolean;
169
+ /**
170
+ * This event is fired when a borrower pair changes
171
+ */
112
172
  export declare type LoanApplicationSelectedListener = () => void;
@@ -0,0 +1,61 @@
1
+ import { ILoan, LoanObject } from './loan.js';
2
+ export declare enum FieldErrorType {
3
+ /**
4
+ * access related error
5
+ */
6
+ ACCESS = "access",
7
+ /**
8
+ * errors related to Field Data Entry Rules violation of the Active Ruleset
9
+ */
10
+ VALUE = "value"
11
+ }
12
+ export declare type FieldErrors = {
13
+ id: string;
14
+ contractPath: string;
15
+ type: FieldErrorType;
16
+ description: string;
17
+ };
18
+ export declare type SetFieldResponse = {
19
+ /**
20
+ * List of fields not meeting data, access or required rule criteria
21
+ */
22
+ errors: FieldErrors[];
23
+ };
24
+ /**
25
+ * All operations on a loan are stateful. This means loan changes are not committed until the loan.commit is called
26
+ */
27
+ export interface ILoanV2 extends Omit<ILoan, 'commit' | 'setFields' | 'merge'> {
28
+ /**
29
+ * Commit all pending changes on the current loan
30
+ *
31
+ * @returns v3 Loan Object
32
+ * @throws {Error} if the loan is not in a valid state or if there are business rule violations
33
+ *
34
+ * #### Product Compatibility:
35
+ * | | Encompass | Encompass Web | TPO | Consumer Connect |
36
+ * :-----:|:-----: |:-----: |:-----: |:-----: |
37
+ * | commit | ✖️ | ✖️ | ✖️ | ✖️ |
38
+ */
39
+ commit(): Promise<LoanObject>;
40
+ /**
41
+ * Syncs the loan workspace with any changes made by other users
42
+ * #### Product Compatibility:
43
+ * | | Encompass | Encompass Web | TPO | Consumer Connect |
44
+ * :-----:|:-----: |:-----: |:-----: |:-----: |
45
+ * | merge | ✖️ | ✖️ | ✖️ | ✖️ |
46
+ */
47
+ merge(): Promise<LoanObject>;
48
+ /**
49
+ * Set the values of one or more fields on the Loan.
50
+ *
51
+ * @param fields list of field ids and their values
52
+ * @returns list of field ids that failed to set
53
+ * @throws {Error} if operation fails due to network error
54
+ *
55
+ * #### Product Compatibility:
56
+ * | | Encompass | Encompass Web | TPO | Consumer Connect |
57
+ * :-----:|:-----: |:-----: |:-----: |:-----: |
58
+ * | setFields | ✖️ | ✖️ | ✖️ | ✖️ |
59
+ */
60
+ setFields(fields: Record<string, string>): Promise<SetFieldResponse>;
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-scripting-object",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Typescript defintions for Scripting Objects",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/cjs/index.js",