diff --git a/examples/typescript-node/package.json b/examples/typescript-node/package.json index cb78796..3331a48 100644 --- a/examples/typescript-node/package.json +++ b/examples/typescript-node/package.json @@ -1,6 +1,6 @@ { "name": "typescript-node", - "version": "1.1.2", + "version": "1.1.3", "description": "", "private": true, "main": "index.js", diff --git a/examples/typescript-node/src/zeus/const.ts b/examples/typescript-node/src/zeus/const.ts index fe863f4..cb05632 100644 --- a/examples/typescript-node/src/zeus/const.ts +++ b/examples/typescript-node/src/zeus/const.ts @@ -1,15 +1,13 @@ /* eslint-disable */ export const AllTypesProps: Record = { - JSON: `scalar.JSON` as const, - createCard:{ - skills:"SpecialSkills" - }, - Query:{ - cardById:{ + SpecialSkills: "enum" as const, + Card:{ + attack:{ } }, + JSON: `scalar.JSON` as const, Mutation:{ addCard:{ card:"createCard" @@ -20,37 +18,59 @@ export const AllTypesProps: Record = { } }, - Card:{ - attack:{ + Query:{ + cardById:{ } }, - SpecialSkills: "enum" as const + createCard:{ + skills:"SpecialSkills" + } } export const ReturnTypes: Record = { - Powerup:{ - name:"String" + S3Object:{ + bucket:"String", + key:"String", + region:"String" + }, + ChangeCard:{ + "...on SpecialCard":"SpecialCard", + "...on EffectCard":"EffectCard" + }, + Card:{ + Attack:"Int", + Children:"Int", + Defense:"Int", + attack:"Card", + cardImage:"S3Object", + description:"String", + id:"ID", + image:"String", + info:"JSON", + name:"String", + skills:"SpecialSkills" }, Nameable:{ - "...on SpecialCard": "SpecialCard", - "...on EffectCard": "EffectCard", "...on Card": "Card", "...on CardStack": "CardStack", + "...on SpecialCard": "SpecialCard", + "...on EffectCard": "EffectCard", name:"String" }, - SpecialCard:{ - effect:"String", + JSON: `scalar.JSON` as const, + Powerup:{ name:"String" }, - EffectCard:{ - effectSize:"Float", + Mutation:{ + addCard:"Card" + }, + CardStack:{ + cards:"Card", name:"String" }, - JSON: `scalar.JSON` as const, - ChangeCard:{ - "...on SpecialCard":"SpecialCard", - "...on EffectCard":"EffectCard" + Public:{ + powerups:"Powerup" }, Query:{ cardById:"Card", @@ -61,35 +81,15 @@ export const ReturnTypes: Record = { nameables:"Nameable", public:"Public" }, - S3Object:{ - bucket:"String", - key:"String", - region:"String" - }, - Mutation:{ - addCard:"Card" - }, - Public:{ - powerups:"Powerup" - }, - Card:{ - Attack:"Int", - Children:"Int", - Defense:"Int", - attack:"Card", - cardImage:"S3Object", - description:"String", - id:"ID", - image:"String", - info:"JSON", - name:"String", - skills:"SpecialSkills" - }, Subscription:{ deck:"Card" }, - CardStack:{ - cards:"Card", + SpecialCard:{ + effect:"String", + name:"String" + }, + EffectCard:{ + effectSize:"Float", name:"String" } } diff --git a/examples/typescript-node/src/zeus/index.ts b/examples/typescript-node/src/zeus/index.ts index 65d1c77..289a602 100644 --- a/examples/typescript-node/src/zeus/index.ts +++ b/examples/typescript-node/src/zeus/index.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { AllTypesProps, ReturnTypes, Ops } from './const'; +import { AllTypesProps, ReturnTypes, Ops } from './const.js'; import fetch, { Response } from 'node-fetch'; import WebSocket from 'ws'; export const HOST = "https://faker.graphqleditor.com/a-team/olympus/graphql" @@ -839,75 +839,18 @@ export type ScalarCoders = { type ZEUS_UNIONS = GraphQLTypes["ChangeCard"] export type ValueTypes = { - ["Powerup"]: AliasType<{ - name?:boolean | `@${string}`, - __typename?: boolean | `@${string}` -}>; - ["Nameable"]:AliasType<{ - name?:boolean | `@${string}`; - ['...on SpecialCard']?: Omit; - ['...on EffectCard']?: Omit; - ['...on Card']?: Omit; - ['...on CardStack']?: Omit; - __typename?: boolean | `@${string}` -}>; - ["SpecialCard"]: AliasType<{ - effect?:boolean | `@${string}`, - name?:boolean | `@${string}`, - __typename?: boolean | `@${string}` -}>; - ["EffectCard"]: AliasType<{ - effectSize?:boolean | `@${string}`, - name?:boolean | `@${string}`, - __typename?: boolean | `@${string}` -}>; - ["JSON"]:unknown; - ["ChangeCard"]: AliasType<{ ["...on SpecialCard"] : ValueTypes["SpecialCard"], - ["...on EffectCard"] : ValueTypes["EffectCard"] - __typename?: boolean | `@${string}` -}>; - /** create card inputs
*/ -["createCard"]: { - /** The name of a card
*/ - name: string | Variable, - /** Description of a card
*/ - description: string | Variable, - /**
How many children the greek god had
*/ - Children?: number | undefined | null | Variable, - /** The attack power
*/ - Attack: number | Variable, - /** The defense power
*/ - Defense: number | Variable, - /** input skills */ - skills?: Array | undefined | null | Variable -}; - ["Query"]: AliasType<{ -cardById?: [{ cardId?: string | undefined | null | Variable},ValueTypes["Card"]], - /** Draw a card
*/ - drawCard?:ValueTypes["Card"], - drawChangeCard?:ValueTypes["ChangeCard"], - /** list All Cards availble
*/ - listCards?:ValueTypes["Card"], - myStacks?:ValueTypes["CardStack"], - nameables?:ValueTypes["Nameable"], - public?:ValueTypes["Public"], - __typename?: boolean | `@${string}` -}>; - /** Aws S3 File */ + /** Aws S3 File */ ["S3Object"]: AliasType<{ bucket?:boolean | `@${string}`, key?:boolean | `@${string}`, region?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; - ["Mutation"]: AliasType<{ -addCard?: [{ card: ValueTypes["createCard"] | Variable},ValueTypes["Card"]], - __typename?: boolean | `@${string}` -}>; - ["Public"]: AliasType<{ -powerups?: [{ filter: string | Variable},ValueTypes["Powerup"]], + ["ChangeCard"]: AliasType<{ ["...on SpecialCard"] : ValueTypes["SpecialCard"], + ["...on EffectCard"] : ValueTypes["EffectCard"] __typename?: boolean | `@${string}` }>; + ["SpecialSkills"]:SpecialSkills; /** Card used in card game
*/ ["Card"]: AliasType<{ /** The attack power
*/ @@ -930,8 +873,21 @@ attack?: [{ /** Attacked card/card ids
*/ skills?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; - ["Subscription"]: AliasType<{ - deck?:ValueTypes["Card"], + ["Nameable"]:AliasType<{ + name?:boolean | `@${string}`; + ['...on Card']?: Omit; + ['...on CardStack']?: Omit; + ['...on SpecialCard']?: Omit; + ['...on EffectCard']?: Omit; + __typename?: boolean | `@${string}` +}>; + ["JSON"]:unknown; + ["Powerup"]: AliasType<{ + name?:boolean | `@${string}`, + __typename?: boolean | `@${string}` +}>; + ["Mutation"]: AliasType<{ +addCard?: [{ card: ValueTypes["createCard"] | Variable},ValueTypes["Card"]], __typename?: boolean | `@${string}` }>; /** Stack of cards */ @@ -940,20 +896,24 @@ attack?: [{ /** Attacked card/card ids
*/ name?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; - ["SpecialSkills"]:SpecialSkills - } - -export type ResolverInputTypes = { - ["Powerup"]: AliasType<{ - name?:boolean | `@${string}`, + ["Public"]: AliasType<{ +powerups?: [{ filter: string | Variable},ValueTypes["Powerup"]], __typename?: boolean | `@${string}` }>; - ["Nameable"]:AliasType<{ - name?:boolean | `@${string}`; - ['...on SpecialCard']?: Omit; - ['...on EffectCard']?: Omit; - ['...on Card']?: Omit; - ['...on CardStack']?: Omit; + ["Query"]: AliasType<{ +cardById?: [{ cardId?: string | undefined | null | Variable},ValueTypes["Card"]], + /** Draw a card
*/ + drawCard?:ValueTypes["Card"], + drawChangeCard?:ValueTypes["ChangeCard"], + /** list All Cards availble
*/ + listCards?:ValueTypes["Card"], + myStacks?:ValueTypes["CardStack"], + nameables?:ValueTypes["Nameable"], + public?:ValueTypes["Public"], + __typename?: boolean | `@${string}` +}>; + ["Subscription"]: AliasType<{ + deck?:ValueTypes["Card"], __typename?: boolean | `@${string}` }>; ["SpecialCard"]: AliasType<{ @@ -965,55 +925,38 @@ export type ResolverInputTypes = { effectSize?:boolean | `@${string}`, name?:boolean | `@${string}`, __typename?: boolean | `@${string}` -}>; - ["JSON"]:unknown; - ["ChangeCard"]: AliasType<{ - SpecialCard?:ResolverInputTypes["SpecialCard"], - EffectCard?:ResolverInputTypes["EffectCard"], - __typename?: boolean | `@${string}` }>; /** create card inputs
*/ ["createCard"]: { /** The name of a card
*/ - name: string, + name: string | Variable, /** Description of a card
*/ - description: string, + description: string | Variable, /**
How many children the greek god had
*/ - Children?: number | undefined | null, + Children?: number | undefined | null | Variable, /** The attack power
*/ - Attack: number, + Attack: number | Variable, /** The defense power
*/ - Defense: number, + Defense: number | Variable, /** input skills */ - skills?: Array | undefined | null -}; - ["Query"]: AliasType<{ -cardById?: [{ cardId?: string | undefined | null},ResolverInputTypes["Card"]], - /** Draw a card
*/ - drawCard?:ResolverInputTypes["Card"], - drawChangeCard?:ResolverInputTypes["ChangeCard"], - /** list All Cards availble
*/ - listCards?:ResolverInputTypes["Card"], - myStacks?:ResolverInputTypes["CardStack"], - nameables?:ResolverInputTypes["Nameable"], - public?:ResolverInputTypes["Public"], - __typename?: boolean | `@${string}` -}>; - /** Aws S3 File */ + skills?: Array | undefined | null | Variable +} + } + +export type ResolverInputTypes = { + /** Aws S3 File */ ["S3Object"]: AliasType<{ bucket?:boolean | `@${string}`, key?:boolean | `@${string}`, region?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; - ["Mutation"]: AliasType<{ -addCard?: [{ card: ResolverInputTypes["createCard"]},ResolverInputTypes["Card"]], - __typename?: boolean | `@${string}` -}>; - ["Public"]: AliasType<{ -powerups?: [{ filter: string},ResolverInputTypes["Powerup"]], + ["ChangeCard"]: AliasType<{ + SpecialCard?:ResolverInputTypes["SpecialCard"], + EffectCard?:ResolverInputTypes["EffectCard"], __typename?: boolean | `@${string}` }>; + ["SpecialSkills"]:SpecialSkills; /** Card used in card game
*/ ["Card"]: AliasType<{ /** The attack power
*/ @@ -1036,8 +979,21 @@ attack?: [{ /** Attacked card/card ids
*/ skills?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; - ["Subscription"]: AliasType<{ - deck?:ResolverInputTypes["Card"], + ["Nameable"]:AliasType<{ + name?:boolean | `@${string}`; + ['...on Card']?: Omit; + ['...on CardStack']?: Omit; + ['...on SpecialCard']?: Omit; + ['...on EffectCard']?: Omit; + __typename?: boolean | `@${string}` +}>; + ["JSON"]:unknown; + ["Powerup"]: AliasType<{ + name?:boolean | `@${string}`, + __typename?: boolean | `@${string}` +}>; + ["Mutation"]: AliasType<{ +addCard?: [{ card: ResolverInputTypes["createCard"]},ResolverInputTypes["Card"]], __typename?: boolean | `@${string}` }>; /** Stack of cards */ @@ -1046,30 +1002,36 @@ attack?: [{ /** Attacked card/card ids
*/ name?:boolean | `@${string}`, __typename?: boolean | `@${string}` }>; - ["SpecialSkills"]:SpecialSkills; - ["schema"]: AliasType<{ - query?:ResolverInputTypes["Query"], - mutation?:ResolverInputTypes["Mutation"], - subscription?:ResolverInputTypes["Subscription"], + ["Public"]: AliasType<{ +powerups?: [{ filter: string},ResolverInputTypes["Powerup"]], __typename?: boolean | `@${string}` -}> - } - -export type ModelTypes = { - ["Powerup"]: { - name?: string | undefined -}; - ["Nameable"]: ModelTypes["SpecialCard"] | ModelTypes["EffectCard"] | ModelTypes["Card"] | ModelTypes["CardStack"]; - ["SpecialCard"]: { - effect: string, - name: string -}; - ["EffectCard"]: { - effectSize: number, - name: string -}; - ["JSON"]:any; - ["ChangeCard"]:ModelTypes["SpecialCard"] | ModelTypes["EffectCard"]; +}>; + ["Query"]: AliasType<{ +cardById?: [{ cardId?: string | undefined | null},ResolverInputTypes["Card"]], + /** Draw a card
*/ + drawCard?:ResolverInputTypes["Card"], + drawChangeCard?:ResolverInputTypes["ChangeCard"], + /** list All Cards availble
*/ + listCards?:ResolverInputTypes["Card"], + myStacks?:ResolverInputTypes["CardStack"], + nameables?:ResolverInputTypes["Nameable"], + public?:ResolverInputTypes["Public"], + __typename?: boolean | `@${string}` +}>; + ["Subscription"]: AliasType<{ + deck?:ResolverInputTypes["Card"], + __typename?: boolean | `@${string}` +}>; + ["SpecialCard"]: AliasType<{ + effect?:boolean | `@${string}`, + name?:boolean | `@${string}`, + __typename?: boolean | `@${string}` +}>; + ["EffectCard"]: AliasType<{ + effectSize?:boolean | `@${string}`, + name?:boolean | `@${string}`, + __typename?: boolean | `@${string}` +}>; /** create card inputs
*/ ["createCard"]: { /** The name of a card
*/ @@ -1077,38 +1039,31 @@ export type ModelTypes = { /** Description of a card
*/ description: string, /**
How many children the greek god had
*/ - Children?: number | undefined, + Children?: number | undefined | null, /** The attack power
*/ Attack: number, /** The defense power
*/ Defense: number, /** input skills */ - skills?: Array | undefined -}; - ["Query"]: { - cardById?: ModelTypes["Card"] | undefined, - /** Draw a card
*/ - drawCard: ModelTypes["Card"], - drawChangeCard: ModelTypes["ChangeCard"], - /** list All Cards availble
*/ - listCards: Array, - myStacks?: Array | undefined, - nameables: Array, - public?: ModelTypes["Public"] | undefined + skills?: Array | undefined | null }; - /** Aws S3 File */ + ["schema"]: AliasType<{ + query?:ResolverInputTypes["Query"], + mutation?:ResolverInputTypes["Mutation"], + subscription?:ResolverInputTypes["Subscription"], + __typename?: boolean | `@${string}` +}> + } + +export type ModelTypes = { + /** Aws S3 File */ ["S3Object"]: { bucket: string, key: string, region: string }; - ["Mutation"]: { - /** add Card to Cards database
*/ - addCard: ModelTypes["Card"] -}; - ["Public"]: { - powerups?: Array | undefined -}; + ["ChangeCard"]:ModelTypes["SpecialCard"] | ModelTypes["EffectCard"]; + ["SpecialSkills"]:SpecialSkills; /** Card used in card game
*/ ["Card"]: { /** The attack power
*/ @@ -1130,54 +1085,48 @@ export type ModelTypes = { name: string, skills?: Array | undefined }; - ["Subscription"]: { - deck?: Array | undefined + ["Nameable"]: ModelTypes["Card"] | ModelTypes["CardStack"] | ModelTypes["SpecialCard"] | ModelTypes["EffectCard"]; + ["JSON"]:any; + ["Powerup"]: { + name?: string | undefined +}; + ["Mutation"]: { + /** add Card to Cards database
*/ + addCard: ModelTypes["Card"] }; /** Stack of cards */ ["CardStack"]: { cards?: Array | undefined, name: string }; - ["SpecialSkills"]:SpecialSkills; - ["schema"]: { - query?: ModelTypes["Query"] | undefined, - mutation?: ModelTypes["Mutation"] | undefined, - subscription?: ModelTypes["Subscription"] | undefined -} - } - -export type GraphQLTypes = { - ["Powerup"]: { - __typename: "Powerup", - name?: string | undefined + ["Public"]: { + powerups?: Array | undefined }; - ["Nameable"]: { - __typename:"SpecialCard" | "EffectCard" | "Card" | "CardStack", - name: string - ['...on SpecialCard']: '__union' & GraphQLTypes["SpecialCard"]; - ['...on EffectCard']: '__union' & GraphQLTypes["EffectCard"]; - ['...on Card']: '__union' & GraphQLTypes["Card"]; - ['...on CardStack']: '__union' & GraphQLTypes["CardStack"]; + ["Query"]: { + cardById?: ModelTypes["Card"] | undefined, + /** Draw a card
*/ + drawCard: ModelTypes["Card"], + drawChangeCard: ModelTypes["ChangeCard"], + /** list All Cards availble
*/ + listCards: Array, + myStacks?: Array | undefined, + nameables: Array, + public?: ModelTypes["Public"] | undefined +}; + ["Subscription"]: { + deck?: Array | undefined }; ["SpecialCard"]: { - __typename: "SpecialCard", - effect: string, + effect: string, name: string }; ["EffectCard"]: { - __typename: "EffectCard", - effectSize: number, + effectSize: number, name: string -}; - ["JSON"]: "scalar" & { name: "JSON" }; - ["ChangeCard"]:{ - __typename:"SpecialCard" | "EffectCard" - ['...on SpecialCard']: '__union' & GraphQLTypes["SpecialCard"]; - ['...on EffectCard']: '__union' & GraphQLTypes["EffectCard"]; }; /** create card inputs
*/ ["createCard"]: { - /** The name of a card
*/ + /** The name of a card
*/ name: string, /** Description of a card
*/ description: string, @@ -1188,36 +1137,29 @@ export type GraphQLTypes = { /** The defense power
*/ Defense: number, /** input skills */ - skills?: Array | undefined -}; - ["Query"]: { - __typename: "Query", - cardById?: GraphQLTypes["Card"] | undefined, - /** Draw a card
*/ - drawCard: GraphQLTypes["Card"], - drawChangeCard: GraphQLTypes["ChangeCard"], - /** list All Cards availble
*/ - listCards: Array, - myStacks?: Array | undefined, - nameables: Array, - public?: GraphQLTypes["Public"] | undefined + skills?: Array | undefined }; - /** Aws S3 File */ + ["schema"]: { + query?: ModelTypes["Query"] | undefined, + mutation?: ModelTypes["Mutation"] | undefined, + subscription?: ModelTypes["Subscription"] | undefined +} + } + +export type GraphQLTypes = { + /** Aws S3 File */ ["S3Object"]: { __typename: "S3Object", bucket: string, key: string, region: string }; - ["Mutation"]: { - __typename: "Mutation", - /** add Card to Cards database
*/ - addCard: GraphQLTypes["Card"] -}; - ["Public"]: { - __typename: "Public", - powerups?: Array | undefined + ["ChangeCard"]:{ + __typename:"SpecialCard" | "EffectCard" + ['...on SpecialCard']: '__union' & GraphQLTypes["SpecialCard"]; + ['...on EffectCard']: '__union' & GraphQLTypes["EffectCard"]; }; + ["SpecialSkills"]: SpecialSkills; /** Card used in card game
*/ ["Card"]: { __typename: "Card", @@ -1240,9 +1182,23 @@ export type GraphQLTypes = { name: string, skills?: Array | undefined }; - ["Subscription"]: { - __typename: "Subscription", - deck?: Array | undefined + ["Nameable"]: { + __typename:"Card" | "CardStack" | "SpecialCard" | "EffectCard", + name: string + ['...on Card']: '__union' & GraphQLTypes["Card"]; + ['...on CardStack']: '__union' & GraphQLTypes["CardStack"]; + ['...on SpecialCard']: '__union' & GraphQLTypes["SpecialCard"]; + ['...on EffectCard']: '__union' & GraphQLTypes["EffectCard"]; +}; + ["JSON"]: "scalar" & { name: "JSON" }; + ["Powerup"]: { + __typename: "Powerup", + name?: string | undefined +}; + ["Mutation"]: { + __typename: "Mutation", + /** add Card to Cards database
*/ + addCard: GraphQLTypes["Card"] }; /** Stack of cards */ ["CardStack"]: { @@ -1250,7 +1206,51 @@ export type GraphQLTypes = { cards?: Array | undefined, name: string }; - ["SpecialSkills"]: SpecialSkills + ["Public"]: { + __typename: "Public", + powerups?: Array | undefined +}; + ["Query"]: { + __typename: "Query", + cardById?: GraphQLTypes["Card"] | undefined, + /** Draw a card
*/ + drawCard: GraphQLTypes["Card"], + drawChangeCard: GraphQLTypes["ChangeCard"], + /** list All Cards availble
*/ + listCards: Array, + myStacks?: Array | undefined, + nameables: Array, + public?: GraphQLTypes["Public"] | undefined +}; + ["Subscription"]: { + __typename: "Subscription", + deck?: Array | undefined +}; + ["SpecialCard"]: { + __typename: "SpecialCard", + effect: string, + name: string +}; + ["EffectCard"]: { + __typename: "EffectCard", + effectSize: number, + name: string +}; + /** create card inputs
*/ +["createCard"]: { + /** The name of a card
*/ + name: string, + /** Description of a card
*/ + description: string, + /**
How many children the greek god had
*/ + Children?: number | undefined, + /** The attack power
*/ + Attack: number, + /** The defense power
*/ + Defense: number, + /** input skills */ + skills?: Array | undefined +} } export const enum SpecialSkills { THUNDER = "THUNDER", @@ -1259,7 +1259,7 @@ export const enum SpecialSkills { } type ZEUS_VARIABLES = { + ["SpecialSkills"]: ValueTypes["SpecialSkills"]; ["JSON"]: ValueTypes["JSON"]; ["createCard"]: ValueTypes["createCard"]; - ["SpecialSkills"]: ValueTypes["SpecialSkills"]; } \ No newline at end of file diff --git a/examples/typescript-node/zeus.graphql b/examples/typescript-node/zeus.graphql index 35ec67b..56a8d08 100644 --- a/examples/typescript-node/zeus.graphql +++ b/examples/typescript-node/zeus.graphql @@ -1,94 +1,82 @@ -"""""" -type Powerup { - """""" - name: String -} - -"""""" -interface Nameable { +"""Aws S3 File""" +type S3Object { """""" - name: String! -} + bucket: String! -"""""" -type SpecialCard implements Nameable { """""" - effect: String! + key: String! """""" - name: String! + region: String! } """""" -type EffectCard implements Nameable { - """""" - effectSize: Float! - - """""" - name: String! -} +union ChangeCard = SpecialCard | EffectCard """""" -scalar JSON +enum SpecialSkills { + """Lower enemy defense -5
""" + THUNDER -"""""" -union ChangeCard = SpecialCard | EffectCard + """Attack multiple Cards at once
""" + RAIN -"""create card inputs
""" -input createCard { - """The name of a card
""" - name: String! + """50% chance to avoid any attack
""" + FIRE +} - """Description of a card
""" - description: String! +"""Card used in card game
""" +type Card implements Nameable { + """The attack power
""" + Attack: Int! """
How many children the greek god had
""" Children: Int - """The attack power
""" - Attack: Int! - """The defense power
""" Defense: Int! - """input skills""" - skills: [SpecialSkills!] -} + """Attack other cards on the table , returns Cards after attack
""" + attack( + """Attacked card/card ids
""" + cardID: [String!]! + ): [Card!] -"""""" -type Query { - """""" - cardById(cardId: String): Card + """Put your description here""" + cardImage: S3Object - """Draw a card
""" - drawCard: Card! + """Description of a card
""" + description: String! """""" - drawChangeCard: ChangeCard! - - """list All Cards availble
""" - listCards: [Card!]! + id: ID! """""" - myStacks: [CardStack!] + image: String! """""" - nameables: [Nameable!]! + info: JSON! + + """The name of a card
""" + name: String! """""" - public: Public + skills: [SpecialSkills!] } -"""Aws S3 File""" -type S3Object { +"""""" +interface Nameable { """""" - bucket: String! + name: String! +} - """""" - key: String! +"""""" +scalar JSON +"""""" +type Powerup { """""" - region: String! + name: String } """""" @@ -97,49 +85,43 @@ type Mutation { addCard(card: createCard!): Card! } +"""Stack of cards""" +type CardStack implements Nameable { + """""" + cards: [Card!] + + """""" + name: String! +} + """""" type Public { """""" powerups(filter: String!): [Powerup!] } -"""Card used in card game
""" -type Card implements Nameable { - """The attack power
""" - Attack: Int! - - """
How many children the greek god had
""" - Children: Int - - """The defense power
""" - Defense: Int! - - """Attack other cards on the table , returns Cards after attack
""" - attack( - """Attacked card/card ids
""" - cardID: [String!]! - ): [Card!] - - """Put your description here""" - cardImage: S3Object +"""""" +type Query { + """""" + cardById(cardId: String): Card - """Description of a card
""" - description: String! + """Draw a card
""" + drawCard: Card! """""" - id: ID! + drawChangeCard: ChangeCard! - """""" - image: String! + """list All Cards availble
""" + listCards: [Card!]! """""" - info: JSON! + myStacks: [CardStack!] - """The name of a card
""" - name: String! + """""" + nameables: [Nameable!]! """""" - skills: [SpecialSkills!] + public: Public } """""" @@ -148,25 +130,43 @@ type Subscription { deck: [Card!] } -"""Stack of cards""" -type CardStack implements Nameable { +"""""" +type SpecialCard implements Nameable { """""" - cards: [Card!] + effect: String! """""" name: String! } """""" -enum SpecialSkills { - """Lower enemy defense -5
""" - THUNDER +type EffectCard implements Nameable { + """""" + effectSize: Float! - """Attack multiple Cards at once
""" - RAIN + """""" + name: String! +} - """50% chance to avoid any attack
""" - FIRE +"""create card inputs
""" +input createCard { + """The name of a card
""" + name: String! + + """Description of a card
""" + description: String! + + """
How many children the greek god had
""" + Children: Int + + """The attack power
""" + Attack: Int! + + """The defense power
""" + Defense: Int! + + """input skills""" + skills: [SpecialSkills!] } schema{ query: Query, diff --git a/packages/graphql-zeus-core/TreeToTS/functions/generated.ts b/packages/graphql-zeus-core/TreeToTS/functions/generated.ts index a7b4a76..c46f258 100644 --- a/packages/graphql-zeus-core/TreeToTS/functions/generated.ts +++ b/packages/graphql-zeus-core/TreeToTS/functions/generated.ts @@ -774,11 +774,18 @@ export type Variable = { ' __zeus_type': T; }; +export type ExtractVariablesDeep = Query extends Variable + ? { [key in VName]: GetVariableType } + : Query extends string | number | boolean | Array + ? // eslint-disable-next-line @typescript-eslint/ban-types + {} + : UnionToIntersection<{ [K in keyof Query]: WithOptionalNullables> }[keyof Query]>; + export type ExtractVariables = Query extends Variable ? { [key in VName]: GetVariableType } : Query extends [infer Inputs, infer Outputs] - ? ExtractVariables & ExtractVariables - : Query extends string | number | boolean + ? ExtractVariablesDeep & ExtractVariables + : Query extends string | number | boolean | Array ? // eslint-disable-next-line @typescript-eslint/ban-types {} : UnionToIntersection<{ [K in keyof Query]: WithOptionalNullables> }[keyof Query]>; diff --git a/packages/graphql-zeus-core/TreeToTS/functions/new/variableExtract.ts b/packages/graphql-zeus-core/TreeToTS/functions/new/variableExtract.ts index 286519f..4115d93 100644 --- a/packages/graphql-zeus-core/TreeToTS/functions/new/variableExtract.ts +++ b/packages/graphql-zeus-core/TreeToTS/functions/new/variableExtract.ts @@ -5,11 +5,18 @@ export type Variable = { ' __zeus_type': T; }; +export type ExtractVariablesDeep = Query extends Variable + ? { [key in VName]: GetVariableType } + : Query extends string | number | boolean | Array + ? // eslint-disable-next-line @typescript-eslint/ban-types + {} + : UnionToIntersection<{ [K in keyof Query]: WithOptionalNullables> }[keyof Query]>; + export type ExtractVariables = Query extends Variable ? { [key in VName]: GetVariableType } : Query extends [infer Inputs, infer Outputs] - ? ExtractVariables & ExtractVariables - : Query extends string | number | boolean + ? ExtractVariablesDeep & ExtractVariables + : Query extends string | number | boolean | Array ? // eslint-disable-next-line @typescript-eslint/ban-types {} : UnionToIntersection<{ [K in keyof Query]: WithOptionalNullables> }[keyof Query]>; diff --git a/packages/graphql-zeus-core/package.json b/packages/graphql-zeus-core/package.json index 69e205b..a647632 100644 --- a/packages/graphql-zeus-core/package.json +++ b/packages/graphql-zeus-core/package.json @@ -1,6 +1,6 @@ { "name": "graphql-zeus-core", - "version": "5.3.2", + "version": "5.3.3", "private": false, "main": "./lib/index.js", "author": "GraphQL Editor, Artur Czemiel", diff --git a/packages/graphql-zeus-jsonschema/package.json b/packages/graphql-zeus-jsonschema/package.json index b9887cb..6d2b205 100644 --- a/packages/graphql-zeus-jsonschema/package.json +++ b/packages/graphql-zeus-jsonschema/package.json @@ -1,6 +1,6 @@ { "name": "graphql-zeus-jsonschema", - "version": "5.3.2", + "version": "5.3.3", "private": false, "main": "./lib/index.js", "author": "GraphQL Editor, Artur Czemiel", diff --git a/packages/graphql-zeus/package.json b/packages/graphql-zeus/package.json index 81bc6a4..2297272 100644 --- a/packages/graphql-zeus/package.json +++ b/packages/graphql-zeus/package.json @@ -1,6 +1,6 @@ { "name": "graphql-zeus", - "version": "5.3.2", + "version": "5.3.3", "private": false, "scripts": { "start": "ttsc --build tsconfig.build.json --watch", @@ -24,8 +24,8 @@ }, "dependencies": { "cross-fetch": "^3.0.4", - "graphql-zeus-core": "^5.3.2", - "graphql-zeus-jsonschema": "^5.3.2", + "graphql-zeus-core": "^5.3.3", + "graphql-zeus-jsonschema": "^5.3.3", "yargs": "^16.1.1" } }