@dynamatix/cat-shared 0.0.157 → 0.0.160

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,319 +1,327 @@
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
- lookupDefaultValue: {
91
- lookupGroupName: { type: String },
92
- lookupName: { type: String }
93
- },
94
- validationRules: [{
95
- type: mongoose.Schema.Types.Mixed,
96
- default: {}
97
- }],
98
- placeholder: {
99
- type: String,
100
- default: null
101
- },
102
- visibilityCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
103
- type: mongoose.Schema.Types.Mixed,
104
- default: null
105
- },
106
- options: [optionSchema],
107
- section: {
108
- type: String,
109
- default: null
110
- },
111
- keyIconClass: {
112
- type: String,
113
- default: null
114
- },
115
- keyIconStyle: {
116
- type: Object,
117
- default: null
118
- },
119
- // Ex: sort-code, post-code, pound, drop-down, lookup
120
- uiHint: {
121
- type: String
122
- },
123
- list: {
124
- name: { // Lookup.BusinessType, DocumentType(collection)
125
- type: String
126
- },
127
- label: { // name
128
- type: String
129
- },
130
- value: { // _id
131
- type: String
132
- },
133
- listFilterQuery: { // MongoDB query ex: applicationId:applicationId
134
- type: mongoose.Schema.Types.Mixed,
135
- default: null
136
- },
137
- dynamicSource: {
138
- sourceMapping: [{
139
- sourceField: {
140
- type: String,
141
- default: null
142
- },
143
- sourceValue: { type: mongoose.Schema.Types.Mixed },
144
- listName: { type: String }, // The collection name to use when source field has this value
145
- fixedValue: { type: mongoose.Schema.Types.Mixed } // It's not req , and it can be a number like 0 , or a string etc.
146
- }]
147
- }
148
- },
149
- isSyncEnabled: { // Fixed typo (was isSyncEnabed)
150
- type: Boolean,
151
- default: true
152
- },
153
- dataElement: { //<collectionName>.<fieldName>
154
- type: String,
155
- default: null
156
- },
157
- syncTargetDataElement: { //<collectionName>.<fieldName> of Apprivo
158
- type: String,
159
- default: null
160
- },
161
- isHtmlContent: {
162
- type: Boolean,
163
- default: false
164
- },
165
- syncMapping: mongoose.Schema.Types.Mixed, // Ex: {true:'Checked', false: ''}
166
- order: {
167
- type: Number,
168
- default: 0
169
- },
170
- maxLength: {
171
- type: Number,
172
- default: null,
173
- min: 0
174
- },
175
- maxValue: { // this is not required used only when given else ignore ex- 100% max
176
- type: mongoose.Schema.Types.Mixed
177
- },
178
- minValue: { // this is not required used only when given else ignore ex- 0% min
179
- type: Number
180
- },
181
- isReadOnly: {
182
- type: Boolean,
183
- default: false
184
- },
185
- isShowHiddenFields: {
186
- type: Boolean,
187
- default: false
188
- },
189
- readOnlyCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
190
- type: mongoose.Schema.Types.Mixed,
191
- default: null
192
- },
193
- collectionName: { // name of collection for field if field doesnt belong to main collection
194
- type: String,
195
- default: null
196
- },
197
- foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
198
- type: String,
199
- default: null
200
- },
201
- shouldfilterOptionsAfterAdd: {
202
- type: Boolean,
203
- default: false
204
- },
205
- shouldfilterOptionsAfterDelete: {
206
- type: Boolean,
207
- default: false
208
- },
209
- computedExpression: String,
210
- }, { timestamps: true, _id: false });
211
-
212
- const formConfigurationSchema = new mongoose.Schema({
213
- formName: {
214
- type: String,
215
- required: true,
216
- trim: true,
217
- unique: true // Consider making form names unique
218
- },
219
- collectionName: {
220
- type: String,
221
- required: true
222
- },
223
- sectionLayout: {
224
- type: String,
225
- trim: true
226
- },
227
- parentKey: String,
228
- populations: [Object],
229
- visibilityCondition: {
230
- type: mongoose.Schema.Types.Mixed,
231
- default: null
232
- },
233
- sections: [{
234
- sectionName: {
235
- type: String,
236
- trim: true
237
- },
238
- sectionLabel: {
239
- type: String,
240
- trim: true
241
- },
242
- parentSectionName: { type: String },
243
- isArray: {
244
- type: Boolean,
245
- default: false
246
- },
247
- isTable: {
248
- type: Boolean,
249
- default: false
250
- },
251
- dataFromSectionName: {
252
- type: Boolean,
253
- default: false
254
- },
255
- fields: [formfieldSchema],
256
- order: {
257
- type: Number,
258
- default: 0
259
- },
260
- visibilityCondition: { // Added section-level visibility
261
- type: mongoose.Schema.Types.Mixed,
262
- default: null
263
- },
264
- sections: [{
265
- sectionName: {
266
- type: String,
267
- trim: true
268
- },
269
- sectionLabel: {
270
- type: String,
271
- trim: true
272
- },
273
- fields: [formfieldSchema],
274
- order: {
275
- type: Number,
276
- default: 0
277
- },
278
- isTable: {
279
- type: Boolean,
280
- default: false
281
- },
282
- visibilityCondition: { // Added section-level visibility
283
- type: mongoose.Schema.Types.Mixed,
284
- default: null
285
- }
286
- }]
287
- }],
288
- isActive: { // Consider adding status flag
289
- type: Boolean,
290
- default: true
291
- },
292
- isActiveRecordOnly: {
293
- type: Boolean,
294
- default: false
295
- },
296
- isDeleteApprivoSync: {
297
- type: Boolean,
298
- default: true
299
- },
300
- isCreateApprivoSync: {
301
- type: Boolean,
302
- default: true
303
- },
304
- version: { // Consider adding versioning
305
- type: Number,
306
- default: 1
307
- },
308
- schemaDeployment: {
309
- configSavedAt: { type: String },
310
- prRaisedAt: { type: String },
311
- mergedAt: { type: String },
312
- publishedAt: { type: String },
313
- apisUpdatedAt: { type: String }
314
- }
315
- }, { timestamps: true });
316
-
317
- const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
318
-
319
- 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
+ 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;
package/models/index.js CHANGED
@@ -1,12 +1,12 @@
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
- export { default as PropertyMetaDataModel } from './property-metadata.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
+ export { default as PropertyMetaDataModel } from './property-metadata.model.js';
12
12
  export { default as ErrorLogModel } from './error-log.model.js';