@graphitation/supermassive
Advanced tools
Comparing version 1.1.4 to 1.1.5
# Change Log - @graphitation/supermassive | ||
This log was last generated on Mon, 17 Oct 2022 11:49:21 GMT and should not be manually modified. | ||
This log was last generated on Mon, 24 Oct 2022 14:54:26 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 1.1.5 | ||
Mon, 24 Oct 2022 14:54:26 GMT | ||
### Patches | ||
- Codegen - subscription type fix, type fields are readonly and contextPath is relative to inputFile (jakubvejr@microsoft.com) | ||
## 1.1.4 | ||
Mon, 17 Oct 2022 11:49:21 GMT | ||
Mon, 17 Oct 2022 11:49:33 GMT | ||
@@ -11,0 +19,0 @@ ### Patches |
@@ -79,2 +79,9 @@ var __create = Object.create; | ||
} | ||
function getContextPath(outputDir, inputPath, contextImport) { | ||
if (!contextImport) { | ||
return; | ||
} | ||
const contextDir = import_path.default.join(import_path.default.dirname(inputPath), contextImport); | ||
return import_path.default.relative(outputDir, contextDir); | ||
} | ||
function generateInterfaces(files, options) { | ||
@@ -95,8 +102,8 @@ return __async(this, null, function* () { | ||
const document = (0, import_graphql.parse)(content); | ||
let result = (0, import__.generateTS)(document, options.contextImport, options.contextName); | ||
const tsDir = import_path.default.join(import_path.default.dirname(fullPath), options.outputDir ? options.outputDir : "__generated__"); | ||
yield import_promises.default.mkdir(tsDir, { recursive: true }); | ||
const outputDir = import_path.default.join(import_path.default.dirname(fullPath), options.outputDir ? options.outputDir : "__generated__"); | ||
let result = (0, import__.generateTS)(document, getContextPath(outputDir, fullPath, options.contextImport), options.contextName); | ||
yield import_promises.default.mkdir(outputDir, { recursive: true }); | ||
const printer = import_typescript.default.createPrinter(); | ||
yield import_promises.default.writeFile(import_path.default.join(tsDir, "models.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(import_typescript.default.EmitHint.SourceFile, result.models, result.models), { encoding: "utf-8" }); | ||
yield import_promises.default.writeFile(import_path.default.join(tsDir, "resolvers.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(import_typescript.default.EmitHint.SourceFile, result.resolvers, result.resolvers), { encoding: "utf-8" }); | ||
yield import_promises.default.writeFile(import_path.default.join(outputDir, "models.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(import_typescript.default.EmitHint.SourceFile, result.models, result.models), { encoding: "utf-8" }); | ||
yield import_promises.default.writeFile(import_path.default.join(outputDir, "resolvers.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(import_typescript.default.EmitHint.SourceFile, result.resolvers, result.resolvers), { encoding: "utf-8" }); | ||
} | ||
@@ -103,0 +110,0 @@ }); |
@@ -53,3 +53,3 @@ var __create = Object.create; | ||
leave(node) { | ||
return import_typescript.factory.createPropertySignature(void 0, import_typescript.factory.createIdentifier(node.name), void 0, node.type); | ||
return import_typescript.factory.createPropertySignature([import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.ReadonlyKeyword)], import_typescript.factory.createIdentifier(node.name), void 0, node.type); | ||
} | ||
@@ -74,3 +74,3 @@ }, | ||
], [ | ||
import_typescript.factory.createPropertySignature(void 0, "__typename", void 0, import_typescript.factory.createLiteralTypeNode(import_typescript.factory.createStringLiteral(node.name))), | ||
import_typescript.factory.createPropertySignature([import_typescript.factory.createModifier(import_typescript.default.SyntaxKind.ReadonlyKeyword)], "__typename", void 0, import_typescript.factory.createLiteralTypeNode(import_typescript.factory.createStringLiteral(node.name))), | ||
...!model && node.fields || [] | ||
@@ -137,3 +137,3 @@ ]); | ||
leave({ type }) { | ||
return (0, import_utilities.createNullableType)(import_typescript.factory.createArrayTypeNode(type)); | ||
return (0, import_utilities.createNullableType)(import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("ReadonlyArray"), [type])); | ||
} | ||
@@ -140,0 +140,0 @@ }, |
@@ -75,3 +75,2 @@ var __create = Object.create; | ||
return import_typescript.factory.createUnionTypeNode([ | ||
import_typescript.factory.createParenthesizedType(import_typescript.factory.createFunctionTypeNode(void 0, getResolverParameters(resolverParametersDefinitions), import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("AsyncIterator"), [typeNode]))), | ||
import_typescript.factory.createTypeLiteralNode([ | ||
@@ -88,3 +87,3 @@ import_typescript.factory.createPropertySignature(void 0, import_typescript.factory.createIdentifier("subscribe"), void 0, import_typescript.factory.createFunctionTypeNode(void 0, getResolverParameters(resolverParametersDefinitions), import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("PromiseOrValue"), [ | ||
} | ||
})), typeNode)) | ||
})), import_typescript.factory.createTypeReferenceNode(import_typescript.factory.createIdentifier("PromiseOrValue"), [typeNode]))) | ||
]) | ||
@@ -91,0 +90,0 @@ ]); |
{ | ||
"name": "@graphitation/supermassive", | ||
"license": "MIT", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "supermassive": "./bin/supermassive.js" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
475874
9539