From e10f5bf4cf406b1c29231f12c0a456c431d3de01 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Thu, 19 Aug 2021 14:40:17 -0500 Subject: [PATCH 1/3] fix graph-node plugin schema --- packages/js/plugins/graph-node/schema.graphql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/js/plugins/graph-node/schema.graphql b/packages/js/plugins/graph-node/schema.graphql index fbe8b4d445..48fec5b424 100644 --- a/packages/js/plugins/graph-node/schema.graphql +++ b/packages/js/plugins/graph-node/schema.graphql @@ -2,7 +2,5 @@ type Query { querySubgraph( subgraphId: String! query: String! - ): String! """JSON!""" - """TODO: support JSON type as base type?""" - """I think this would be helpful for dynamic data""" + ): String! } From 3a4da42dd7e31708b94239b2a3d9c5b6d48d788e Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 20 Aug 2021 14:37:08 -0500 Subject: [PATCH 2/3] fix TS enum bindings --- .../src/bindings/plugin-ts/templates/types-ts.mustache | 9 ++++++++- .../cases/bind/sanity/output/plugin-ts/types.ts | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache b/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache index 3c96711ccd..324356a397 100644 --- a/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache +++ b/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache @@ -28,12 +28,19 @@ export interface {{type}} { {{/objectTypes}} {{#enumTypes}} -export enum {{type}} { +enum {{type}}Enum { {{#constants}} {{.}}, {{/constants}} } +type {{type}}String = + {{#constants}} + | "{{.}}" + {{/constants}} + +export type {{type}} = {{type}}Enum | {{type}}String; + {{/enumTypes}} /// Imported Objects START /// diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts index 1329c15493..aa6d977eea 100644 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts @@ -60,11 +60,17 @@ export interface AnotherType { circular?: Types.CustomType | null; } -export enum CustomEnum { +enum CustomEnumEnum { STRING, BYTES, } +type CustomEnumString = + | "STRING" + | "BYTES" + +export type CustomEnum = CustomEnumEnum | CustomEnumString; + /// Imported Objects START /// /* URI: "testimport.uri.eth" */ From 47025c94bf1a24c6ea697ab8b29ecffc08e6d915 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 20 Aug 2021 14:39:21 -0500 Subject: [PATCH 3/3] prep 0.0.1-prealpha.34 --- CHANGELOG.md | 5 +++++ VERSION | 2 +- packages/js/plugins/graph-node/schema.graphql | 3 ++- packages/js/plugins/graph-node/src/manifest.ts | 6 ++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08cff2eee0..eb898192bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Web3API 0.0.1-prealpha.34 +## Bugs +* `@web3api/schema-bind`: Fix TypeScript enum bindings. +* `@web3api/graph-node-plugin-js`: Fix mismatched schema. + # Web3API 0.0.1-prealpha.33 ## Bugs * `@web3api/schema-bind`: Fixed plugin code generation oversight. Should be using `null` instead of `undefined`. diff --git a/VERSION b/VERSION index cd26a18ba1..fd13539e0f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1-prealpha.33 \ No newline at end of file +0.0.1-prealpha.34 \ No newline at end of file diff --git a/packages/js/plugins/graph-node/schema.graphql b/packages/js/plugins/graph-node/schema.graphql index 48fec5b424..84cfcc4659 100644 --- a/packages/js/plugins/graph-node/schema.graphql +++ b/packages/js/plugins/graph-node/schema.graphql @@ -1,6 +1,7 @@ type Query { querySubgraph( - subgraphId: String! + subgraphAuthor: String! + subgraphName: String! query: String! ): String! } diff --git a/packages/js/plugins/graph-node/src/manifest.ts b/packages/js/plugins/graph-node/src/manifest.ts index ca2cbeaeb4..ccb570ab91 100644 --- a/packages/js/plugins/graph-node/src/manifest.ts +++ b/packages/js/plugins/graph-node/src/manifest.ts @@ -6,9 +6,11 @@ export const manifest: PluginPackageManifest = { schema: ` type Query { querySubgraph( - subgraphId: String! + subgraphAuthor: String! + subgraphName: String! query: String! ): String! -}`, +} +`, implements: [], };