@snowtop/ent 0.1.0-alpha118 → 0.1.0-alpha119

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.
@@ -556,6 +556,7 @@ class Orchestrator {
556
556
  let value = editedFields.get(fieldName);
557
557
  let defaultValue = undefined;
558
558
  let dbKey = this.getStorageKey(fieldName);
559
+ let updateOnlyIfOther = field.onlyUpdateIfOtherFieldsBeingSet_BETA;
559
560
  if (value === undefined) {
560
561
  if (this.actualOperation === action_1.WriteOperation.Insert) {
561
562
  if (field.defaultToViewerOnCreate && field.defaultValueOnCreate) {
@@ -587,7 +588,12 @@ class Orchestrator {
587
588
  }
588
589
  if (defaultValue !== undefined) {
589
590
  updateInput = true;
590
- defaultData[dbKey] = defaultValue;
591
+ if (updateOnlyIfOther) {
592
+ defaultData[dbKey] = defaultValue;
593
+ }
594
+ else {
595
+ data[dbKey] = defaultValue;
596
+ }
591
597
  this.defaultFieldsByFieldName[fieldName] = defaultValue;
592
598
  this.defaultFieldsByTSName[this.getInputKey(fieldName)] = defaultValue;
593
599
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.0-alpha118",
3
+ "version": "0.1.0-alpha119",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,6 +17,7 @@ let tsFields = {
17
17
  defaultValueOnCreate: () => {
18
18
  return new Date();
19
19
  },
20
+ onlyUpdateIfOtherFieldsBeingSet_BETA: true,
20
21
  defaultValueOnEdit: () => {
21
22
  return new Date();
22
23
  },
@@ -219,6 +219,7 @@ export interface FieldOptions {
219
219
  disableUserGraphQLEditable?: boolean;
220
220
  defaultValueOnCreate?(builder: Builder<Ent>, input: Data): any;
221
221
  defaultToViewerOnCreate?: boolean;
222
+ onlyUpdateIfOtherFieldsBeingSet_BETA?: boolean;
222
223
  defaultValueOnEdit?(builder: Builder<Ent>, input: Data): any;
223
224
  derivedWhenEmbedded?: boolean;
224
225
  polymorphic?: boolean | PolymorphicOptions;