@dynamatix/cat-shared 0.0.154 → 0.0.155

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