@dynamatix/cat-shared 0.0.134 → 0.0.136

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