@dynamatix/cat-shared 0.0.138 → 0.0.139

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