@homebound/graphql-typescript-scalar-type-policies
Advanced tools
Comparing version 2.7.0 to 2.8.0
@@ -11,3 +11,3 @@ "use strict"; | ||
let type = f.type; | ||
if (graphql_1.isNonNullType(type)) { | ||
if ((0, graphql_1.isNonNullType)(type)) { | ||
type = type.ofType; | ||
@@ -17,17 +17,17 @@ } | ||
} | ||
const content = await ts_poet_1.code ` | ||
const content = await (0, ts_poet_1.code) ` | ||
export const scalarTypePolicies = { | ||
${Object.values(schema.getTypeMap()) | ||
.filter(isObjectType) | ||
.filter(t => !t.name.startsWith("__")) | ||
.filter(t => Object.values(t.getFields()).some(isScalarWithTypePolicy)) | ||
.map(type => { | ||
return ts_poet_1.code `${type.name}: { fields: { ${Object.values(type.getFields()) | ||
.filter((t) => !t.name.startsWith("__")) | ||
.filter((t) => Object.values(t.getFields()).some(isScalarWithTypePolicy)) | ||
.map((type) => { | ||
return (0, ts_poet_1.code) `${type.name}: { fields: { ${Object.values(type.getFields()) | ||
.filter(isScalarWithTypePolicy) | ||
.map(field => { | ||
.map((field) => { | ||
let type = field.type; | ||
if (graphql_1.isNonNullType(type)) { | ||
if ((0, graphql_1.isNonNullType)(type)) { | ||
type = type.ofType; | ||
} | ||
return ts_poet_1.code `${field.name}: ${toImp(scalarTypePolicies[type.name])},`; | ||
return (0, ts_poet_1.code) `${field.name}: ${toImp(scalarTypePolicies[type.name])},`; | ||
})} } },`; | ||
@@ -54,4 +54,4 @@ })} | ||
const [path, symbol] = spec.split("#"); | ||
return ts_poet_1.imp(`${symbol}@${path}`); | ||
return (0, ts_poet_1.imp)(`${symbol}@${path}`); | ||
} | ||
exports.toImp = toImp; |
@@ -5,3 +5,5 @@ import { dateTypePolicy } from "src/dates"; | ||
Author: { fields: { birthday: dateTypePolicy, deathday: dateTypePolicy } }, | ||
CalendarInterval: { fields: { startDate: dateTypePolicy, endDate: dateTypePolicy } }, | ||
CalendarInterval: { | ||
fields: { endDate: dateTypePolicy, startDate: dateTypePolicy }, | ||
}, | ||
}; |
{ | ||
"name": "@homebound/graphql-typescript-scalar-type-policies", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"main": "./build/index.js", | ||
@@ -15,14 +15,14 @@ "types": "./build/", | ||
"dependencies": { | ||
"@graphql-codegen/plugin-helpers": "^2.0.0", | ||
"@graphql-codegen/plugin-helpers": "^2.6.2", | ||
"change-case": "^4.1.1", | ||
"ts-poet": "^4.5.0" | ||
"ts-poet": "^5.0.1" | ||
}, | ||
"devDependencies": { | ||
"@graphql-codegen/cli": "^2.0.1", | ||
"@graphql-codegen/cli": "^2.11.8", | ||
"graphql": "^15.5.1", | ||
"husky": "^3.0.9", | ||
"jest": "^27.0.6", | ||
"prettier": "^2.3.2", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^27.0.4", | ||
"typescript": "^4.3.5" | ||
"typescript": "^4.8.2" | ||
}, | ||
@@ -29,0 +29,0 @@ "husky": { |
Sorry, the diff of this file is not supported yet
7226
80
+ Added@dprint/formatter@0.2.1(transitive)
+ Added@dprint/typescript@0.71.2(transitive)
+ Addedts-poet@5.2.0(transitive)
- Removedprettier@2.8.8(transitive)
- Removedts-poet@4.15.0(transitive)
Updatedts-poet@^5.0.1