@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.
- package/action/orchestrator.js +7 -1
- package/package.json +1 -1
- package/schema/base_schema.js +1 -0
- package/schema/schema.d.ts +1 -0
package/action/orchestrator.js
CHANGED
|
@@ -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
|
-
|
|
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
package/schema/base_schema.js
CHANGED
package/schema/schema.d.ts
CHANGED
|
@@ -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;
|