@dynamatix/cat-shared 0.0.138 → 0.0.140

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,294 +1,302 @@
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
- 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
- isShowHiddenFields: {
165
- type: Boolean,
166
- default: false
167
- },
168
- isApiRecordPatched: {
169
- type: Boolean,
170
- default: false
171
- },
172
- readOnlyCondition: { // (LendingType=='BTL' || ApplicationType=='Company')
173
- type: mongoose.Schema.Types.Mixed,
174
- default: null
175
- },
176
- collectionName: { // name of collection for field if field doesnt belong to main collection
177
- type: String,
178
- default: null
179
- },
180
- foreignReferenceField: { // Ex: when field is from forieng collection then foreignReferenceField could be applicationId(which refers to the application)
181
- type: String,
182
- default: null
183
- },
184
- shouldfilterOptionsAfterAdd: {
185
- type: Boolean,
186
- default: false
187
- },
188
- shouldfilterOptionsAfterDelete: {
189
- type: Boolean,
190
- default: false
191
- },
192
- computedExpression: String,
193
- }, { timestamps: true, _id: false });
194
-
195
- const formConfigurationSchema = new mongoose.Schema({
196
- formName: {
197
- type: String,
198
- required: true,
199
- trim: true,
200
- unique: true // Consider making form names unique
201
- },
202
- collectionName: {
203
- type: String,
204
- required: true
205
- },
206
- sectionLayout: {
207
- type: String,
208
- trim: true
209
- },
210
- parentKey: String,
211
- populations: [Object],
212
- visibilityCondition: {
213
- type: mongoose.Schema.Types.Mixed,
214
- default: null
215
- },
216
- sections: [{
217
- sectionName: {
218
- type: String,
219
- trim: true
220
- },
221
- sectionLabel: {
222
- type: String,
223
- trim: true
224
- },
225
- isArray: {
226
- type: Boolean,
227
- default: false
228
- },
229
- isTable: {
230
- type: Boolean,
231
- default: false
232
- },
233
- dataFromSectionName: {
234
- type: Boolean,
235
- default: false
236
- },
237
- fields: [formfieldSchema],
238
- order: {
239
- type: Number,
240
- default: 0
241
- },
242
- visibilityCondition: { // Added section-level visibility
243
- type: mongoose.Schema.Types.Mixed,
244
- default: null
245
- },
246
- sections: [{
247
- sectionName: {
248
- type: String,
249
- trim: true
250
- },
251
- sectionLabel: {
252
- type: String,
253
- trim: true
254
- },
255
- fields: [formfieldSchema],
256
- order: {
257
- type: Number,
258
- default: 0
259
- },
260
- isTable: {
261
- type: Boolean,
262
- default: false
263
- },
264
- visibilityCondition: { // Added section-level visibility
265
- type: mongoose.Schema.Types.Mixed,
266
- default: null
267
- }
268
- }]
269
- }],
270
- isActive: { // Consider adding status flag
271
- type: Boolean,
272
- default: true
273
- },
274
- isActiveRecordOnly: {
275
- type: Boolean,
276
- default: false
277
- },
278
- isDeleteApprivoSync: {
279
- type: Boolean,
280
- default: true
281
- },
282
- isCreateApprivoSync: {
283
- type: Boolean,
284
- default: true
285
- },
286
- version: { // Consider adding versioning
287
- type: Number,
288
- default: 1
289
- }
290
- }, { timestamps: true });
291
-
292
- const FormConfigurationModel = mongoose.models.FormConfiguration || mongoose.model('FormConfiguration', formConfigurationSchema);
293
-
294
- 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', '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;
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;