@dynamatix/cat-shared 0.0.160 → 0.0.163

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,327 +1,337 @@
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
- isPastDateBlocked: {
15
- type: Boolean,
16
- },
17
- minDate: {
18
- type: Date,
19
- },
20
- maxDate: {
21
- type: Date,
22
- },
23
- addToPayload: {
24
- type: Boolean,
25
- default: false
26
- },
27
- fieldName: {
28
- type: String,
29
- required: true,
30
- trim: true
31
- },
32
- isHidden: {
33
- type: Boolean,
34
- default: false
35
- },
36
- isEditable: {
37
- type: Boolean,
38
- default: true
39
- },
40
- size: {
41
- type: Number,
42
- default: 6,
43
- enum: [3, 4, 6, 8, 10, 12],
44
- },
45
- layout: {
46
- type: String,
47
- enum: ['horizontal', 'vertical'],
48
- },
49
- label: {
50
- type: String,
51
- required: true,
52
- trim: true
53
- },
54
- dataType: {
55
- type: String,
56
- required: true,
57
- 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', 'date-only'] // Added common form field types
58
- },
59
- isRequired: {
60
- type: Boolean,
61
- default: false
62
- },
63
- helpText: {
64
- type: String,
65
- default: null
66
- },
67
- isForceUpdate: {
68
- type: Boolean,
69
- default: false
70
- },
71
- isShowClearIcon: {
72
- type: Boolean,
73
- default: true
74
- },
75
- requiredErrorMessage: {
76
- type: String,
77
- default: 'Field is required'
78
- },
79
- defaultValue: {
80
- type: mongoose.Schema.Types.Mixed
81
- },
82
- regexValidation: {
83
- type: String,
84
- default: null
85
- },
86
- regexValidationMessage: {
87
- type: String,
88
- default: null
89
- },
90
- isProjectionAfterField: {
91
- type: Boolean,
92
- default: false
93
- },
94
- lookupDefaultValue: {
95
- lookupGroupName: { type: String },
96
- lookupName: { type: String }
97
- },
98
- validationRules: [{
99
- type: mongoose.Schema.Types.Mixed,
100
- default: {}
101
- }],
102
- placeholder: {
103
- type: String,
104
- default: null
105
- },
106
- visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
107
- type: mongoose.Schema.Types.Mixed,
108
- default: null
109
- },
110
- options: [optionSchema],
111
- section: {
112
- type: String,
113
- default: null
114
- },
115
- keyIconClass: {
116
- type: String,
117
- default: null
118
- },
119
- keyIconStyle: {
120
- type: Object,
121
- default: null
122
- },
123
- // Ex: sort-code, post-code, pound, drop-down, lookup
124
- uiHint: {
125
- type: String
126
- },
127
- list: {
128
- name: { // Lookup.BusinessType, DocumentType(collection)
129
- type: String
130
- },
131
- label: { // name
132
- type: String
133
- },
134
- value: { // _id
135
- type: String
136
- },
137
- listFilterQuery: { // MongoDB query ex: applicationId:applicationId
138
- type: mongoose.Schema.Types.Mixed,
139
- default: null
140
- },
141
- dynamicSource: {
142
- sourceMapping: [{
143
- sourceField: {
144
- type: String,
145
- default: null
146
- },
147
- sourceValue: { type: mongoose.Schema.Types.Mixed },
148
- listName: { type: String }, // The collection name to use when source field has this value
149
- fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
150
- }]
151
- }
152
- },
153
- isSyncEnabled: { // Fixed typo (was isSyncEnabed)
154
- type: Boolean,
155
- default: true
156
- },
157
- dataElement: { //<collectionName>.<fieldName>
158
- type: String,
159
- default: null
160
- },
161
- syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
162
- type: String,
163
- default: null
164
- },
165
- isHtmlContent: {
166
- type: Boolean,
167
- default: false
168
- },
169
- syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
170
- order: {
171
- type: Number,
172
- default: 0
173
- },
174
- maxLength: {
175
- type: Number,
176
- default: null,
177
- min: 0
178
- },
179
- maxValue: { // this is not required used only when given else ignore ex- 100% max
180
- type: mongoose.Schema.Types.Mixed
181
- },
182
- minValue: { // this is not required used only when given else ignore ex- 0% min
183
- type: Number
184
- },
185
- isReadOnly: {
186
- type: Boolean,
187
- default: false
188
- },
189
- isShowHiddenFields: {
190
- type: Boolean,
191
- default: false
192
- },
193
- readOnlyCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
194
- type: mongoose.Schema.Types.Mixed,
195
- default: null
196
- },
197
- collectionName: { // name of collection for field if field doesnt belong to main collection
198
- type: String,
199
- default: null
200
- },
201
- foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
202
- type: String,
203
- default: null
204
- },
205
- queryField: {
206
- type: String,
207
- default: null
208
- },
209
- shouldfilterOptionsAfterAdd: {
210
- type: Boolean,
211
- default: false
212
- },
213
- shouldfilterOptionsAfterDelete: {
214
- type: Boolean,
215
- default: false
216
- },
217
- computedExpression: String,
218
- }, { timestamps: true, _id: false });
219
-
220
- const formConfigurationSchema = new mongoose.Schema({
221
- formName: {
222
- type: String,
223
- required: true,
224
- trim: true,
225
- unique: true // Consider making form names unique
226
- },
227
- collectionName: {
228
- type: String,
229
- required: true
230
- },
231
- sectionLayout: {
232
- type: String,
233
- trim: true
234
- },
235
- parentKey: String,
236
- populations: [Object],
237
- visibilityCondition: {
238
- type: mongoose.Schema.Types.Mixed,
239
- default: null
240
- },
241
- sections: [{
242
- sectionName: {
243
- type: String,
244
- trim: true
245
- },
246
- sectionLabel: {
247
- type: String,
248
- trim: true
249
- },
250
- parentSectionName: { type: String },
251
- isArray: {
252
- type: Boolean,
253
- default: false
254
- },
255
- isTable: {
256
- type: Boolean,
257
- default: false
258
- },
259
- dataFromSectionName: {
260
- type: Boolean,
261
- default: false
262
- },
263
- fields: [formfieldSchema],
264
- order: {
265
- type: Number,
266
- default: 0
267
- },
268
- visibilityCondition: { // Added section-level visibility
269
- type: mongoose.Schema.Types.Mixed,
270
- default: null
271
- },
272
- sections: [{
273
- sectionName: {
274
- type: String,
275
- trim: true
276
- },
277
- sectionLabel: {
278
- type: String,
279
- trim: true
280
- },
281
- fields: [formfieldSchema],
282
- order: {
283
- type: Number,
284
- default: 0
285
- },
286
- isTable: {
287
- type: Boolean,
288
- default: false
289
- },
290
- visibilityCondition: { // Added section-level visibility
291
- type: mongoose.Schema.Types.Mixed,
292
- default: null
293
- }
294
- }]
295
- }],
296
- isActive: { // Consider adding status flag
297
- type: Boolean,
298
- default: true
299
- },
300
- isActiveRecordOnly: {
301
- type: Boolean,
302
- default: false
303
- },
304
- isDeleteApprivoSync: {
305
- type: Boolean,
306
- default: true
307
- },
308
- isCreateApprivoSync: {
309
- type: Boolean,
310
- default: true
311
- },
312
- version: { // Consider adding versioning
313
- type: Number,
314
- default: 1
315
- },
316
- schemaDeployment: {
317
- configSavedAt: { type: String },
318
- prRaisedAt: { type: String },
319
- mergedAt: { type: String },
320
- publishedAt: { type: String },
321
- apisUpdatedAt: { type: String }
322
- }
323
- }, { timestamps: true });
324
-
325
- const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
326
-
327
- 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
+ isPastDateBlocked: {
15
+ type: Boolean,
16
+ },
17
+ minDate: {
18
+ type: Date,
19
+ },
20
+ maxDate: {
21
+ type: Date,
22
+ },
23
+ addToPayload: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ fieldName: {
28
+ type: String,
29
+ required: true,
30
+ trim: true
31
+ },
32
+ isHidden: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ isEditable: {
37
+ type: Boolean,
38
+ default: true
39
+ },
40
+ size: {
41
+ type: Number,
42
+ default: 6,
43
+ enum: [3, 4, 6, 8, 10, 12],
44
+ },
45
+ layout: {
46
+ type: String,
47
+ enum: ['horizontal', 'vertical'],
48
+ },
49
+ label: {
50
+ type: String,
51
+ required: true,
52
+ trim: true
53
+ },
54
+ dataType: {
55
+ type: String,
56
+ required: true,
57
+ 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', 'date-only'] // Added common form field types
58
+ },
59
+ isRequired: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ helpText: {
64
+ type: String,
65
+ default: null
66
+ },
67
+ isForceUpdate: {
68
+ type: Boolean,
69
+ default: false
70
+ },
71
+ isShowClearIcon: {
72
+ type: Boolean,
73
+ default: true
74
+ },
75
+ requiredErrorMessage: {
76
+ type: String,
77
+ default: 'Field is required'
78
+ },
79
+ defaultValue: {
80
+ type: mongoose.Schema.Types.Mixed
81
+ },
82
+ regexValidation: {
83
+ type: String,
84
+ default: null
85
+ },
86
+ regexValidationMessage: {
87
+ type: String,
88
+ default: null
89
+ },
90
+ contentProjectionPosition: {
91
+ type: String,
92
+ enum: ['before', 'after'],
93
+ default: null
94
+ },
95
+ lookupDefaultValue: {
96
+ lookupGroupName: { type: String },
97
+ lookupName: { type: String }
98
+ },
99
+ validationRules: [{
100
+ type: mongoose.Schema.Types.Mixed,
101
+ default: {}
102
+ }],
103
+ placeholder: {
104
+ type: String,
105
+ default: null
106
+ },
107
+ visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
108
+ type: mongoose.Schema.Types.Mixed,
109
+ default: null
110
+ },
111
+ isCalculatedField: {
112
+ type: Boolean,
113
+ default: false
114
+ },
115
+ calculatedExpression: {
116
+ type: String,
117
+ default: null
118
+ },
119
+ options: [optionSchema],
120
+ section: {
121
+ type: String,
122
+ default: null
123
+ },
124
+ keyIconClass: {
125
+ type: String,
126
+ default: null
127
+ },
128
+ keyIconStyle: {
129
+ type: Object,
130
+ default: null
131
+ },
132
+ // Ex: sort-code, post-code, pound, drop-down, lookup
133
+ uiHint: {
134
+ type: String
135
+ },
136
+ list: {
137
+ name: { // Lookup.BusinessType, DocumentType(collection)
138
+ type: String
139
+ },
140
+ label: { // name
141
+ type: String
142
+ },
143
+ value: { // _id
144
+ type: String
145
+ },
146
+ listFilterQuery: { // MongoDB query ex: applicationId:applicationId
147
+ type: mongoose.Schema.Types.Mixed,
148
+ default: null
149
+ },
150
+ dynamicSource: {
151
+ sourceMapping: [{
152
+ sourceField: {
153
+ type: String,
154
+ default: null
155
+ },
156
+ sourceValue: { type: mongoose.Schema.Types.Mixed },
157
+ listName: { type: String }, // The collection name to use when source field has this value
158
+ fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
159
+ }]
160
+ }
161
+ },
162
+ isSyncEnabled: { // Fixed typo (was isSyncEnabed)
163
+ type: Boolean,
164
+ default: true
165
+ },
166
+ dataElement: { //<collectionName>.<fieldName>
167
+ type: String,
168
+ default: null
169
+ },
170
+ syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
171
+ type: String,
172
+ default: null
173
+ },
174
+ isHtmlContent: {
175
+ type: Boolean,
176
+ default: false
177
+ },
178
+ syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
179
+ order: {
180
+ type: Number,
181
+ default: 0
182
+ },
183
+ maxLength: {
184
+ type: Number,
185
+ default: null,
186
+ min: 0
187
+ },
188
+ maxValue: { // this is not required used only when given else ignore ex- 100% max
189
+ type: mongoose.Schema.Types.Mixed
190
+ },
191
+ minValue: { // this is not required used only when given else ignore ex- 0% min
192
+ type: Number
193
+ },
194
+ isReadOnly: {
195
+ type: Boolean,
196
+ default: false
197
+ },
198
+ isShowHiddenFields: {
199
+ type: Boolean,
200
+ default: false
201
+ },
202
+ readOnlyCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
203
+ type: mongoose.Schema.Types.Mixed,
204
+ default: null
205
+ },
206
+ collectionName: { // name of collection for field if field doesnt belong to main collection
207
+ type: String,
208
+ default: null
209
+ },
210
+ foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
211
+ type: String,
212
+ default: null
213
+ },
214
+ queryField: {
215
+ type: String,
216
+ default: null
217
+ },
218
+ shouldfilterOptionsAfterAdd: {
219
+ type: Boolean,
220
+ default: false
221
+ },
222
+ shouldfilterOptionsAfterDelete: {
223
+ type: Boolean,
224
+ default: false
225
+ },
226
+ computedExpression: String,
227
+ }, { timestamps: true, _id: false });
228
+
229
+ const formConfigurationSchema = new mongoose.Schema({
230
+ formName: {
231
+ type: String,
232
+ required: true,
233
+ trim: true,
234
+ unique: true // Consider making form names unique
235
+ },
236
+ collectionName: {
237
+ type: String,
238
+ required: true
239
+ },
240
+ sectionLayout: {
241
+ type: String,
242
+ trim: true
243
+ },
244
+ parentKey: String,
245
+ populations: [Object],
246
+ visibilityCondition: {
247
+ type: mongoose.Schema.Types.Mixed,
248
+ default: null
249
+ },
250
+ sections: [{
251
+ sectionName: {
252
+ type: String,
253
+ trim: true
254
+ },
255
+ sectionLabel: {
256
+ type: String,
257
+ trim: true
258
+ },
259
+ parentSectionName: { type: String },
260
+ isArray: {
261
+ type: Boolean,
262
+ default: false
263
+ },
264
+ isTable: {
265
+ type: Boolean,
266
+ default: false
267
+ },
268
+ dataFromSectionName: {
269
+ type: Boolean,
270
+ default: false
271
+ },
272
+ fields: [formfieldSchema],
273
+ order: {
274
+ type: Number,
275
+ default: 0
276
+ },
277
+ visibilityCondition: { // Added section-level visibility
278
+ type: mongoose.Schema.Types.Mixed,
279
+ default: null
280
+ },
281
+ sections: [{
282
+ sectionName: {
283
+ type: String,
284
+ trim: true
285
+ },
286
+ sectionLabel: {
287
+ type: String,
288
+ trim: true
289
+ },
290
+ fields: [formfieldSchema],
291
+ order: {
292
+ type: Number,
293
+ default: 0
294
+ },
295
+ isTable: {
296
+ type: Boolean,
297
+ default: false
298
+ },
299
+ visibilityCondition: { // Added section-level visibility
300
+ type: mongoose.Schema.Types.Mixed,
301
+ default: null
302
+ }
303
+ }]
304
+ }],
305
+ isActive: { // Consider adding status flag
306
+ type: Boolean,
307
+ default: true
308
+ },
309
+ isActiveRecordOnly: {
310
+ type: Boolean,
311
+ default: false
312
+ },
313
+ isDeleteApprivoSync: {
314
+ type: Boolean,
315
+ default: true
316
+ },
317
+ isCreateApprivoSync: {
318
+ type: Boolean,
319
+ default: true
320
+ },
321
+ version: { // Consider adding versioning
322
+ type: Number,
323
+ default: 1
324
+ },
325
+ schemaDeployment: {
326
+ configSavedAt: { type: String },
327
+ prRaisedAt: { type: String },
328
+ reviewedAt: { type: String },
329
+ mergedAt: { type: String },
330
+ publishedAt: { type: String },
331
+ apisUpdatedAt: { type: String }
332
+ }
333
+ }, { timestamps: true });
334
+
335
+ const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
336
+
337
+ export default FormConfigurationModel;