@dynamatix/cat-shared 0.0.128 → 0.0.129

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,282 +1,286 @@
1
- import mongoose from 'mongoose';
2
-
3
- const optionSchema = new mongoose.Schema({
4
- label: { type: mongoose.Schema.Types.Mixed },
5
- value: { type: mongoose.Schema.Types.Mixed },
6
- text: { type: mongoose.Schema.Types.Mixed }
7
-
8
- }, { _id: false });
9
-
10
- const formfieldSchema = new mongoose.Schema({
11
- isFutureDateBlocked: {
12
- type: Boolean,
13
- },
14
- addToPayload: {
15
- type: Boolean,
16
- default: false
17
- },
18
- fieldName: {
19
- type: String,
20
- required: true,
21
- trim: true
22
- },
23
- isHidden: {
24
- type: Boolean,
25
- default: false
26
- },
27
- isEditable: {
28
- type: Boolean,
29
- default: true
30
- },
31
- size: {
32
- type: Number,
33
- default: 6,
34
- enum: [3, 4, 6, 8, 10, 12],
35
- },
36
- layout: {
37
- type: String,
38
- enum: ['horizontal', 'vertical'],
39
- },
40
- label: {
41
- type: String,
42
- required: true,
43
- trim: true
44
- },
45
- dataType: {
46
- type: String,
47
- required: true,
48
- enum: ['text-area', 'counter-input', 'string', 'number', 'boolean-check', 'boolean-radio', 'percentage', 'date', 'array', 'object', 'select', 'radio', 'drop-down', 'sort-code', 'post-code', 'pound', 'lookup', 'multi-select', 'email', 'phone', 'internationalPhone', 'account-number', 'table-text-area'] // Added common form field types
49
- },
50
- isRequired: {
51
- type: Boolean,
52
- default: false
53
- },
54
- helpText: {
55
- type: String,
56
- default: null
57
- },
58
- isForceUpdate: {
59
- type: Boolean,
60
- default: false
61
- },
62
- isShowClearIcon: {
63
- type: Boolean,
64
- default: true
65
- },
66
- requiredErrorMessage: {
67
- type: String,
68
- default: 'Field is required'
69
- },
70
- defaultValue: {
71
- type: mongoose.Schema.Types.Mixed
72
- },
73
- validationRules: [{
74
- type: mongoose.Schema.Types.Mixed,
75
- default: {}
76
- }],
77
- visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
78
- type: mongoose.Schema.Types.Mixed,
79
- default: null
80
- },
81
- options: [optionSchema],
82
- section: {
83
- type: String,
84
- default: null
85
- },
86
- keyIconClass: {
87
- type: String,
88
- default: null
89
- },
90
- keyIconStyle: {
91
- type: Object,
92
- default: null
93
- },
94
- // Ex: sort-code, post-code, pound, drop-down, lookup
95
- uiHint: {
96
- type: String
97
- },
98
- list: {
99
- name: { // Lookup.BusinessType, DocumentType(collection)
100
- type: String
101
- },
102
- label: { // name
103
- type: String
104
- },
105
- value: { // _id
106
- type: String
107
- },
108
- listFilterQuery: { // MongoDB query ex: applicationId:applicationId
109
- type: mongoose.Schema.Types.Mixed,
110
- default: null
111
- },
112
- dynamicSource: {
113
- sourceMapping: [{
114
- sourceField: {
115
- type: String,
116
- default: null
117
- },
118
- sourceValue: { type: mongoose.Schema.Types.Mixed },
119
- listName: { type: String }, // The collection name to use when source field has this value
120
- fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
121
- }]
122
- }
123
- },
124
- isSyncEnabled: { // Fixed typo (was isSyncEnabed)
125
- type: Boolean,
126
- default: true
127
- },
128
- dataElement: { //<collectionName>.<fieldName>
129
- type: String,
130
- default: null
131
- },
132
- syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
133
- type: String,
134
- default: null
135
- },
136
- isHtmlContent: {
137
- type: Boolean,
138
- default: false
139
- },
140
- syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
141
- order: {
142
- type: Number,
143
- default: 0
144
- },
145
- maxLength: {
146
- type: Number,
147
- default: null,
148
- min: 0
149
- },
150
- maxValue: { // this is not required used only when given else ignore ex- 100% max
151
- type: mongoose.Schema.Types.Mixed
152
- },
153
- minValue: { // this is not required used only when given else ignore ex- 0% min
154
- type: Number
155
- },
156
- isReadOnly: {
157
- type: Boolean,
158
- default: false
159
- },
160
- readOnlyCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
161
- type: mongoose.Schema.Types.Mixed,
162
- default: null
163
- },
164
- collectionName: { // name of collection for field if field doesnt belong to main collection
165
- type: String,
166
- default: null
167
- },
168
- foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
169
- type: String,
170
- default: null
171
- },
172
- shouldfilterOptionsAfterAdd: {
173
- type: Boolean,
174
- default: false
175
- },
176
- shouldfilterOptionsAfterDelete: {
177
- type: Boolean,
178
- default: false
179
- },
180
- computedExpression: String,
181
- }, { timestamps: true, _id: false });
182
-
183
- const formConfigurationSchema = new mongoose.Schema({
184
- formName: {
185
- type: String,
186
- required: true,
187
- trim: true,
188
- unique: true // Consider making form names unique
189
- },
190
- collectionName: {
191
- type: String,
192
- required: true
193
- },
194
- sectionLayout: {
195
- type: String,
196
- trim: true
197
- },
198
- parentKey: String,
199
- populations: [Object],
200
- visibilityCondition: {
201
- type: mongoose.Schema.Types.Mixed,
202
- default: null
203
- },
204
- sections: [{
205
- sectionName: {
206
- type: String,
207
- trim: true
208
- },
209
- sectionLabel: {
210
- type: String,
211
- trim: true
212
- },
213
- isArray: {
214
- type: Boolean,
215
- default: false
216
- },
217
- isTable: {
218
- type: Boolean,
219
- default: false
220
- },
221
- dataFromSectionName: {
222
- type: Boolean,
223
- default: false
224
- },
225
- fields: [formfieldSchema],
226
- order: {
227
- type: Number,
228
- default: 0
229
- },
230
- visibilityCondition: { // Added section-level visibility
231
- type: mongoose.Schema.Types.Mixed,
232
- default: null
233
- },
234
- sections: [{
235
- sectionName: {
236
- type: String,
237
- trim: true
238
- },
239
- sectionLabel: {
240
- type: String,
241
- trim: true
242
- },
243
- fields: [formfieldSchema],
244
- order: {
245
- type: Number,
246
- default: 0
247
- },
248
- isTable: {
249
- type: Boolean,
250
- default: false
251
- },
252
- visibilityCondition: { // Added section-level visibility
253
- type: mongoose.Schema.Types.Mixed,
254
- default: null
255
- }
256
- }]
257
- }],
258
- isActive: { // Consider adding status flag
259
- type: Boolean,
260
- default: true
261
- },
262
- isActiveRecordOnly: {
263
- type: Boolean,
264
- default: false
265
- },
266
- isDeleteApprivoSync: {
267
- type: Boolean,
268
- default: true
269
- },
270
- isCreateApprivoSync: {
271
- type: Boolean,
272
- default: true
273
- },
274
- version: { // Consider adding versioning
275
- type: Number,
276
- default: 1
277
- }
278
- }, { timestamps: true });
279
-
280
- const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
281
-
282
- export default FormConfigurationModel;
1
+ import mongoose from 'mongoose';
2
+
3
+ const optionSchema = new mongoose.Schema({
4
+ label: { type: mongoose.Schema.Types.Mixed },
5
+ value: { type: mongoose.Schema.Types.Mixed },
6
+ text: { type: mongoose.Schema.Types.Mixed }
7
+
8
+ }, { _id: false });
9
+
10
+ const formfieldSchema = new mongoose.Schema({
11
+ isFutureDateBlocked: {
12
+ type: Boolean,
13
+ },
14
+ addToPayload: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ fieldName: {
19
+ type: String,
20
+ required: true,
21
+ trim: true
22
+ },
23
+ isHidden: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ isEditable: {
28
+ type: Boolean,
29
+ default: true
30
+ },
31
+ size: {
32
+ type: Number,
33
+ default: 6,
34
+ enum: [3, 4, 6, 8, 10, 12],
35
+ },
36
+ layout: {
37
+ type: String,
38
+ enum: ['horizontal', 'vertical'],
39
+ },
40
+ label: {
41
+ type: String,
42
+ required: true,
43
+ trim: true
44
+ },
45
+ dataType: {
46
+ type: String,
47
+ required: true,
48
+ enum: ['text-area', 'counter-input', 'string', 'number', 'boolean-check', 'boolean-radio', 'percentage', 'date', 'array', 'object', 'select', 'radio', 'drop-down', 'sort-code', 'post-code', 'pound', 'lookup', 'multi-select', 'email', 'phone', 'internationalPhone', 'account-number', 'table-text-area'] // Added common form field types
49
+ },
50
+ isRequired: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ helpText: {
55
+ type: String,
56
+ default: null
57
+ },
58
+ isForceUpdate: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ isShowClearIcon: {
63
+ type: Boolean,
64
+ default: true
65
+ },
66
+ requiredErrorMessage: {
67
+ type: String,
68
+ default: 'Field is required'
69
+ },
70
+ defaultValue: {
71
+ type: mongoose.Schema.Types.Mixed
72
+ },
73
+ lookupDefaultValue: {
74
+ lookupGroupName: { type: String },
75
+ lookupName: { type: String }
76
+ },
77
+ validationRules: [{
78
+ type: mongoose.Schema.Types.Mixed,
79
+ default: {}
80
+ }],
81
+ visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
82
+ type: mongoose.Schema.Types.Mixed,
83
+ default: null
84
+ },
85
+ options: [optionSchema],
86
+ section: {
87
+ type: String,
88
+ default: null
89
+ },
90
+ keyIconClass: {
91
+ type: String,
92
+ default: null
93
+ },
94
+ keyIconStyle: {
95
+ type: Object,
96
+ default: null
97
+ },
98
+ // Ex: sort-code, post-code, pound, drop-down, lookup
99
+ uiHint: {
100
+ type: String
101
+ },
102
+ list: {
103
+ name: { // Lookup.BusinessType, DocumentType(collection)
104
+ type: String
105
+ },
106
+ label: { // name
107
+ type: String
108
+ },
109
+ value: { // _id
110
+ type: String
111
+ },
112
+ listFilterQuery: { // MongoDB query ex: applicationId:applicationId
113
+ type: mongoose.Schema.Types.Mixed,
114
+ default: null
115
+ },
116
+ dynamicSource: {
117
+ sourceMapping: [{
118
+ sourceField: {
119
+ type: String,
120
+ default: null
121
+ },
122
+ sourceValue: { type: mongoose.Schema.Types.Mixed },
123
+ listName: { type: String }, // The collection name to use when source field has this value
124
+ fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
125
+ }]
126
+ }
127
+ },
128
+ isSyncEnabled: { // Fixed typo (was isSyncEnabed)
129
+ type: Boolean,
130
+ default: true
131
+ },
132
+ dataElement: { //<collectionName>.<fieldName>
133
+ type: String,
134
+ default: null
135
+ },
136
+ syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
137
+ type: String,
138
+ default: null
139
+ },
140
+ isHtmlContent: {
141
+ type: Boolean,
142
+ default: false
143
+ },
144
+ syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
145
+ order: {
146
+ type: Number,
147
+ default: 0
148
+ },
149
+ maxLength: {
150
+ type: Number,
151
+ default: null,
152
+ min: 0
153
+ },
154
+ maxValue: { // this is not required used only when given else ignore ex- 100% max
155
+ type: mongoose.Schema.Types.Mixed
156
+ },
157
+ minValue: { // this is not required used only when given else ignore ex- 0% min
158
+ type: Number
159
+ },
160
+ isReadOnly: {
161
+ type: Boolean,
162
+ default: false
163
+ },
164
+ readOnlyCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
165
+ type: mongoose.Schema.Types.Mixed,
166
+ default: null
167
+ },
168
+ collectionName: { // name of collection for field if field doesnt belong to main collection
169
+ type: String,
170
+ default: null
171
+ },
172
+ foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
173
+ type: String,
174
+ default: null
175
+ },
176
+ shouldfilterOptionsAfterAdd: {
177
+ type: Boolean,
178
+ default: false
179
+ },
180
+ shouldfilterOptionsAfterDelete: {
181
+ type: Boolean,
182
+ default: false
183
+ },
184
+ computedExpression: String,
185
+ }, { timestamps: true, _id: false });
186
+
187
+ const formConfigurationSchema = new mongoose.Schema({
188
+ formName: {
189
+ type: String,
190
+ required: true,
191
+ trim: true,
192
+ unique: true // Consider making form names unique
193
+ },
194
+ collectionName: {
195
+ type: String,
196
+ required: true
197
+ },
198
+ sectionLayout: {
199
+ type: String,
200
+ trim: true
201
+ },
202
+ parentKey: String,
203
+ populations: [Object],
204
+ visibilityCondition: {
205
+ type: mongoose.Schema.Types.Mixed,
206
+ default: null
207
+ },
208
+ sections: [{
209
+ sectionName: {
210
+ type: String,
211
+ trim: true
212
+ },
213
+ sectionLabel: {
214
+ type: String,
215
+ trim: true
216
+ },
217
+ isArray: {
218
+ type: Boolean,
219
+ default: false
220
+ },
221
+ isTable: {
222
+ type: Boolean,
223
+ default: false
224
+ },
225
+ dataFromSectionName: {
226
+ type: Boolean,
227
+ default: false
228
+ },
229
+ fields: [formfieldSchema],
230
+ order: {
231
+ type: Number,
232
+ default: 0
233
+ },
234
+ visibilityCondition: { // Added section-level visibility
235
+ type: mongoose.Schema.Types.Mixed,
236
+ default: null
237
+ },
238
+ sections: [{
239
+ sectionName: {
240
+ type: String,
241
+ trim: true
242
+ },
243
+ sectionLabel: {
244
+ type: String,
245
+ trim: true
246
+ },
247
+ fields: [formfieldSchema],
248
+ order: {
249
+ type: Number,
250
+ default: 0
251
+ },
252
+ isTable: {
253
+ type: Boolean,
254
+ default: false
255
+ },
256
+ visibilityCondition: { // Added section-level visibility
257
+ type: mongoose.Schema.Types.Mixed,
258
+ default: null
259
+ }
260
+ }]
261
+ }],
262
+ isActive: { // Consider adding status flag
263
+ type: Boolean,
264
+ default: true
265
+ },
266
+ isActiveRecordOnly: {
267
+ type: Boolean,
268
+ default: false
269
+ },
270
+ isDeleteApprivoSync: {
271
+ type: Boolean,
272
+ default: true
273
+ },
274
+ isCreateApprivoSync: {
275
+ type: Boolean,
276
+ default: true
277
+ },
278
+ version: { // Consider adding versioning
279
+ type: Number,
280
+ default: 1
281
+ }
282
+ }, { timestamps: true });
283
+
284
+ const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
285
+
286
+ export default FormConfigurationModel;
package/models/index.js CHANGED
@@ -1,11 +1,11 @@
1
- export { default as AuditConfigModel } from './audit-config.model.js';
2
- export { default as AuditModel } from './audit.model.js';
3
- export { default as ValueReferenceMapModel } from './value-reference-map.model.js';
4
- export { default as FormConfigurationModel } from './form-configuration.model.js';
5
- export { default as DocumentTypeModel } from './document-type.model.js';
6
- export { default as DocumentModel } from './document.model.js';
7
- export { default as WorkflowAlertModel } from './workflow-alert.model.js';
8
- export { default as WorkflowConfigModel } from './workflow-config.model.js';
9
- export { default as DocumentHistoryModel } from './document-history.model.js';
10
- export { default as MetaModel } from './meta.model.js';
1
+ export { default as AuditConfigModel } from './audit-config.model.js';
2
+ export { default as AuditModel } from './audit.model.js';
3
+ export { default as ValueReferenceMapModel } from './value-reference-map.model.js';
4
+ export { default as FormConfigurationModel } from './form-configuration.model.js';
5
+ export { default as DocumentTypeModel } from './document-type.model.js';
6
+ export { default as DocumentModel } from './document.model.js';
7
+ export { default as WorkflowAlertModel } from './workflow-alert.model.js';
8
+ export { default as WorkflowConfigModel } from './workflow-config.model.js';
9
+ export { default as DocumentHistoryModel } from './document-history.model.js';
10
+ export { default as MetaModel } from './meta.model.js';
11
11
  export { default as PropertyMetaDataModel } from './property-metadata.model.js';
@@ -1,10 +1,10 @@
1
- import mongoose from 'mongoose';
2
-
3
- const metaSchema = new mongoose.Schema({
4
- solutionId: { type: String, required: true },
5
- solutionName: { type: String, required: true },
6
- solutionDescription: { type: String },
7
- }, { timestamps: true });
8
-
9
- const MetaModel = mongoose.models.Meta || mongoose.model('Meta', metaSchema);
1
+ import mongoose from 'mongoose';
2
+
3
+ const metaSchema = new mongoose.Schema({
4
+ solutionId: { type: String, required: true },
5
+ solutionName: { type: String, required: true },
6
+ solutionDescription: { type: String },
7
+ }, { timestamps: true });
8
+
9
+ const MetaModel = mongoose.models.Meta || mongoose.model('Meta', metaSchema);
10
10
  export default MetaModel;