@steedos-labs/plugin-workflow 3.0.24 → 3.0.25

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.
@@ -4265,7 +4265,6 @@ UUFlowManager.draft_save_instance = async function (ins, userId) {
4265
4265
  submitter: 1,
4266
4266
  traces: 1,
4267
4267
  form: 1,
4268
- form_version: 1,
4269
4268
  flow_version: 1,
4270
4269
  space: 1,
4271
4270
  flow: 1
@@ -4344,65 +4343,6 @@ UUFlowManager.draft_save_instance = async function (ins, userId) {
4344
4343
  }
4345
4344
  }
4346
4345
 
4347
- // Convert date/datetime field values from ISO strings to Date objects
4348
- // Fetch form to check field types and get name formula
4349
- // For draft save, always use current form version (not historys which could be very large)
4350
- const form = await db.forms.findOne(
4351
- { _id: form_id },
4352
- { projection: { 'current._id': 1, 'current.fields': 1, 'current.name_forumla': 1 } }
4353
- );
4354
-
4355
- // Draft save always uses current form version
4356
- const formVersion = form?.current;
4357
-
4358
- // Convert date strings to Date objects for proper MongoDB storage
4359
- if (formVersion && formVersion.fields && values) {
4360
- const convertFieldValue = (field, value) => {
4361
- if (!value) return value;
4362
-
4363
- // Handle date and datetime fields - convert ISO strings to Date objects
4364
- if (field.type === 'date' || field.type === 'datetime') {
4365
- // Check if value is a string (ISO date format from frontend)
4366
- if (typeof value === 'string') {
4367
- const dateObj = new Date(value);
4368
- // Validate it's a valid date
4369
- if (!isNaN(dateObj.getTime())) {
4370
- return dateObj;
4371
- }
4372
- }
4373
- }
4374
- // Handle table fields (subforms)
4375
- else if (field.type === 'table' && Array.isArray(value) && field.fields) {
4376
- return value.map(row => {
4377
- const convertedRow = {...row};
4378
- field.fields.forEach(subField => {
4379
- if (row[subField.code] !== undefined) {
4380
- convertedRow[subField.code] = convertFieldValue(subField, row[subField.code]);
4381
- }
4382
- });
4383
- return convertedRow;
4384
- });
4385
- }
4386
-
4387
- return value;
4388
- };
4389
-
4390
- // Process all form fields
4391
- formVersion.fields.forEach(field => {
4392
- if (field.type === 'section' && field.fields) {
4393
- // Process section's child fields
4394
- field.fields.forEach(sectionField => {
4395
- if (values[sectionField.code] !== undefined) {
4396
- values[sectionField.code] = convertFieldValue(sectionField, values[sectionField.code]);
4397
- }
4398
- });
4399
- } else if (values[field.code] !== undefined) {
4400
- // Process regular fields
4401
- values[field.code] = convertFieldValue(field, values[field.code]);
4402
- }
4403
- });
4404
- }
4405
-
4406
4346
  setObj[key_str + 'values'] = values;
4407
4347
  setObj[key_str + 'description'] = description;
4408
4348
  setObj[key_str + 'judge'] = 'submitted';
@@ -4413,6 +4353,11 @@ UUFlowManager.draft_save_instance = async function (ins, userId) {
4413
4353
  }
4414
4354
 
4415
4355
  // Calculate instance name
4356
+ const form = await db.forms.findOne(
4357
+ { _id: form_id },
4358
+ { projection: { 'current.name_forumla': 1 } }
4359
+ );
4360
+
4416
4361
  if (form?.current?.name_forumla) {
4417
4362
  setObj.name = await UUFlowManager.getInstanceName(ins, values);
4418
4363
  if(result !== 'upgraded'){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.24",
3
+ "version": "3.0.25",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "scripts": {