@dynamatix/cat-shared 0.0.127 → 0.0.128

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