@snowtop/ent 0.1.0-alpha94 → 0.1.0-alpha96-2a5ea200-82e5-11ed-8c55-4da1cd949242
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/package.json +2 -2
- package/schema/field.d.ts +1 -0
- package/schema/field.js +1 -0
- package/schema/schema.d.ts +2 -0
- package/schema/schema.js +6 -0
- package/testutils/ent-graphql-tests/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowtop/ent",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-alpha96-2a5ea200-82e5-11ed-8c55-4da1cd949242",
|
|
4
4
|
"description": "snowtop ent framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"camel-case": "^4.1.2",
|
|
13
13
|
"cosmiconfig": "^7.0.1",
|
|
14
14
|
"dataloader": "^2.0.0",
|
|
15
|
-
"glob": "^
|
|
15
|
+
"glob": "^8.0.3",
|
|
16
16
|
"graph-data-structure": "^1.12.0",
|
|
17
17
|
"js-yaml": "^4.1.0",
|
|
18
18
|
"json5": "^2.1.3",
|
package/schema/field.d.ts
CHANGED
package/schema/field.js
CHANGED
|
@@ -514,6 +514,7 @@ class EnumField extends BaseField {
|
|
|
514
514
|
enumMap: options.map,
|
|
515
515
|
type: options.tsType,
|
|
516
516
|
graphQLType: options.graphQLType,
|
|
517
|
+
disableUnknownType: options.disableUnknownType,
|
|
517
518
|
};
|
|
518
519
|
if (!options.foreignKey) {
|
|
519
520
|
if (!options.values && !options.map) {
|
package/schema/schema.d.ts
CHANGED
|
@@ -159,6 +159,7 @@ export interface Type {
|
|
|
159
159
|
enumMap?: EnumMap;
|
|
160
160
|
intEnumMap?: IntEnumMap;
|
|
161
161
|
deprecatedIntEnumMap?: IntEnumMap;
|
|
162
|
+
disableUnknownType?: boolean;
|
|
162
163
|
importType?: ImportType;
|
|
163
164
|
subFields?: FieldMap;
|
|
164
165
|
unionFields?: FieldMap;
|
|
@@ -213,6 +214,7 @@ export interface FieldOptions {
|
|
|
213
214
|
getDerivedFields?(name: string): FieldMap;
|
|
214
215
|
convert?: ConvertType;
|
|
215
216
|
fetchOnDemand?: boolean;
|
|
217
|
+
dbOnly?: boolean;
|
|
216
218
|
[x: string]: any;
|
|
217
219
|
}
|
|
218
220
|
export interface PolymorphicOptions {
|
package/schema/schema.js
CHANGED
|
@@ -58,6 +58,9 @@ function getFields(value) {
|
|
|
58
58
|
function addFields(fields) {
|
|
59
59
|
if (Array.isArray(fields)) {
|
|
60
60
|
for (const field of fields) {
|
|
61
|
+
if (field.dbOnly) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
61
64
|
const name = field.name;
|
|
62
65
|
if (!name) {
|
|
63
66
|
throw new Error(`name required`);
|
|
@@ -71,6 +74,9 @@ function getFields(value) {
|
|
|
71
74
|
}
|
|
72
75
|
for (const name in fields) {
|
|
73
76
|
const field = fields[name];
|
|
77
|
+
if (field.dbOnly) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
74
80
|
if (field.getDerivedFields !== undefined) {
|
|
75
81
|
addFields(field.getDerivedFields(name));
|
|
76
82
|
}
|
|
@@ -164,7 +164,7 @@ function buildTreeFromQueryPaths(schema, fieldType, ...options) {
|
|
|
164
164
|
let parts = [];
|
|
165
165
|
let match = fragmentRegex.exec(path);
|
|
166
166
|
if (match) {
|
|
167
|
-
// fragment, keep the part of the fragment e.g.
|
|
167
|
+
// fragment, keep the part of the fragment e.g. `...on User`, and then split the rest....
|
|
168
168
|
parts = [match[0], ...match[2].split(".")];
|
|
169
169
|
const typ = schema.getType(match[1]);
|
|
170
170
|
if (!typ) {
|
|
@@ -223,7 +223,7 @@ function buildTreeFromQueryPaths(schema, fieldType, ...options) {
|
|
|
223
223
|
}
|
|
224
224
|
// only spread out if an object
|
|
225
225
|
const [typ, _] = getInnerType(subField.type, true);
|
|
226
|
-
return (0, graphql_1.isScalarType)(typ);
|
|
226
|
+
return (0, graphql_1.isScalarType)(typ) || (0, graphql_1.isEnumType)(typ);
|
|
227
227
|
}
|
|
228
228
|
if (i === parts.length - 1 && typeof option[1] === "object") {
|
|
229
229
|
if (!isScalarField(part)) {
|