@snowtop/ent 0.2.0-alpha.3 → 0.2.0-alpha.5
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 +13 -7
- package/graphql/graphql.js +3 -0
- package/package.json +1 -1
- package/testutils/db/value.d.ts +1 -0
- package/testutils/db/value.js +2 -1
package/action/orchestrator.js
CHANGED
|
@@ -621,17 +621,23 @@ class Orchestrator {
|
|
|
621
621
|
}
|
|
622
622
|
if (transformed.data) {
|
|
623
623
|
updateInput = true;
|
|
624
|
-
for (const k
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
624
|
+
for (const [k, field] of schemaFields) {
|
|
625
|
+
const inputKey = this.getInputKey(k);
|
|
626
|
+
const storageKey = this.getStorageKey(k);
|
|
627
|
+
let val = transformed.data[inputKey];
|
|
628
|
+
if (val === undefined) {
|
|
629
|
+
val = transformed.data[storageKey];
|
|
630
|
+
}
|
|
631
|
+
if (val === undefined) {
|
|
632
|
+
continue;
|
|
628
633
|
}
|
|
629
|
-
let val = transformed.data[k];
|
|
630
634
|
if (field.format) {
|
|
631
|
-
val = field.format(transformed.data[k]);
|
|
635
|
+
val = field.format(transformed.data[k], true);
|
|
632
636
|
}
|
|
633
637
|
data[this.getStorageKey(k)] = val;
|
|
634
|
-
|
|
638
|
+
if (!field.immutable) {
|
|
639
|
+
this.defaultFieldsByTSName[this.getInputKey(k)] = val;
|
|
640
|
+
}
|
|
635
641
|
// hmm do we need this?
|
|
636
642
|
// TODO how to do this for local tests?
|
|
637
643
|
// this.defaultFieldsByFieldName[k] = val;
|
package/graphql/graphql.js
CHANGED
|
@@ -517,6 +517,9 @@ class GQLCapture {
|
|
|
517
517
|
field.results.forEach((result) => {
|
|
518
518
|
if (result.needsResolving) {
|
|
519
519
|
if (baseObjects.has(result.type) ||
|
|
520
|
+
// allow custom input objects to be returned
|
|
521
|
+
// depend on GraphQL type complaining if we try and reference an input from a non-input object
|
|
522
|
+
this.customInputObjects.has(result.type) ||
|
|
520
523
|
this.customUnions.has(result.type) ||
|
|
521
524
|
this.customInterfaces.has(result.type) ||
|
|
522
525
|
this.customTypes.has(result.type)) {
|
package/package.json
CHANGED
package/testutils/db/value.d.ts
CHANGED
package/testutils/db/value.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultValue = exports.randomEmail = void 0;
|
|
3
|
+
exports.getDefaultValue = exports.randomPhoneNumber = exports.randomEmail = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
const schema_1 = require("../../schema");
|
|
6
6
|
const schema_2 = require("../../schema");
|
|
@@ -15,6 +15,7 @@ exports.randomEmail = randomEmail;
|
|
|
15
15
|
function randomPhoneNumber() {
|
|
16
16
|
return `+1${Math.random().toString(10).substring(2, 11)}`;
|
|
17
17
|
}
|
|
18
|
+
exports.randomPhoneNumber = randomPhoneNumber;
|
|
18
19
|
function coinFlip() {
|
|
19
20
|
return Math.floor(Math.random() * 10) >= 5;
|
|
20
21
|
}
|