diff --git a/package.json b/package.json index 7d863f95a..46f72f30c 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,6 @@ "default": "./build/entrypoints/schema.js" } }, - "./schema/scalars": { - "import": { - "default": "./build/entrypoints/scalars.js" - } - }, "./utilities-for-generated": { "import": { "default": "./build/entrypoints/utilities-for-generated.js" diff --git a/src/entrypoints/_Graffle.ts b/src/entrypoints/_Graffle.ts index 47cd696ad..7a0989f51 100644 --- a/src/entrypoints/_Graffle.ts +++ b/src/entrypoints/_Graffle.ts @@ -1,2 +1,2 @@ export * from '../layers/6_client/client.js' -export * as Scalars from './scalars.js' +export * as Scalars from './_Scalars.js' diff --git a/src/entrypoints/_Scalars.ts b/src/entrypoints/_Scalars.ts new file mode 100644 index 000000000..48c084e8f --- /dev/null +++ b/src/entrypoints/_Scalars.ts @@ -0,0 +1 @@ +export { create } from '../types/Schema/types/Scalar/_.js' diff --git a/src/entrypoints/scalars.ts b/src/entrypoints/scalars.ts deleted file mode 100644 index 738674b21..000000000 --- a/src/entrypoints/scalars.ts +++ /dev/null @@ -1,3 +0,0 @@ -// todo this module should be tailored to users defining their own customer scalars. -// todo ... so, consider a different entrypoint for these scalar types that are just for the generated clients. -export { Boolean, create, Float, ID, Int, String } from '../layers/1_Schema/Hybrid/types/Scalar/Scalar.js' diff --git a/src/entrypoints/schema.ts b/src/entrypoints/schema.ts index 20563769d..0ef3533d2 100644 --- a/src/entrypoints/schema.ts +++ b/src/entrypoints/schema.ts @@ -1,3 +1,3 @@ -export * from '../layers/1_Schema/__.js' export { Select } from '../layers/2_Select/__.js' export { InferResult } from '../layers/3_InferResult/__.js' +export * from '../types/Schema/__.js' diff --git a/src/entrypoints/utilities-for-generated.ts b/src/entrypoints/utilities-for-generated.ts index 6b46c40b9..7c6bb6503 100644 --- a/src/entrypoints/utilities-for-generated.ts +++ b/src/entrypoints/utilities-for-generated.ts @@ -1,6 +1,5 @@ export { type Simplify } from 'type-fest' export { type Schema as SchemaIndexBase } from '../generator/generators/Schema.js' -export { SchemaKit } from '../layers/1_Schema/__.js' export * from '../layers/2_Select/__.js' export { type ClientContext } from '../layers/6_client/fluent.js' export type { @@ -13,4 +12,5 @@ export type { Config } from '../layers/6_client/Settings/Config.js' export { type Exact, type ExactNonEmpty, type UnionExpanded } from '../lib/prelude.js' export { TypeFunction } from '../lib/type-function/__.js' export { type GlobalRegistry } from '../types/GlobalRegistry/GlobalRegistry.js' +export { SchemaKit } from '../types/Schema/__.js' export { type SchemaDrivenDataMap } from '../types/SchemaDrivenDataMap/__.js' diff --git a/src/extensions/CustomScalars/decode.ts b/src/extensions/CustomScalars/decode.ts index 8187add86..5b5d639e9 100644 --- a/src/extensions/CustomScalars/decode.ts +++ b/src/extensions/CustomScalars/decode.ts @@ -1,6 +1,5 @@ import { Kind } from 'graphql' import { SchemaKit } from '../../entrypoints/schema.js' -import { applyCodec } from '../../layers/1_Schema/Hybrid/types/Scalar/Scalar.js' import type { RegisteredScalars } from '../../layers/6_client/fluent.js' import type { Grafaid } from '../../lib/grafaid/__.js' import { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js' @@ -60,10 +59,10 @@ const decodeResultData_ = (input: { const sddmNode = sddmOutputField.nt if (SchemaDrivenDataMap.isScalar(sddmNode)) { - data[k] = applyCodec(sddmNode.codec.decode, v) + data[k] = SchemaKit.Scalar.applyCodec(sddmNode.codec.decode, v) } else if (SchemaDrivenDataMap.isCustomScalarName(sddmNode)) { const scalar = SchemaKit.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode) - data[k] = applyCodec(scalar.codec.decode, v) + data[k] = SchemaKit.Scalar.applyCodec(scalar.codec.decode, v) } else if (SchemaDrivenDataMap.isOutputObject(sddmNode)) { decodeResultData_({ data: v, diff --git a/src/extensions/CustomScalars/encode.ts b/src/extensions/CustomScalars/encode.ts index 1910baf90..a35cc3fa2 100644 --- a/src/extensions/CustomScalars/encode.ts +++ b/src/extensions/CustomScalars/encode.ts @@ -1,5 +1,4 @@ import { SchemaKit } from '../../entrypoints/schema.js' -import { applyCodec } from '../../layers/1_Schema/Hybrid/types/Scalar/Scalar.js' import type { RegisteredScalars } from '../../layers/6_client/fluent.js' import { Grafaid } from '../../lib/grafaid/__.js' import { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js' @@ -57,12 +56,12 @@ const encodeInputFieldLike = ( if (SchemaDrivenDataMap.isCustomScalarName(sddmNode)) { const scalar = SchemaKit.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode) - args[argName] = applyCodec(scalar.codec.encode, argValue) + args[argName] = SchemaKit.Scalar.applyCodec(scalar.codec.encode, argValue) return } if (SchemaDrivenDataMap.isScalar(sddmNode)) { - args[argName] = applyCodec(sddmNode.codec.encode, argValue) + args[argName] = SchemaKit.Scalar.applyCodec(sddmNode.codec.encode, argValue) return } diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle.config.ts b/src/extensions/SchemaErrors/tests/fixture/graffle.config.ts index f6bbe8b53..7667f0a05 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle.config.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle.config.ts @@ -12,7 +12,7 @@ export default Generator libraryPaths: { client: `../../../../entrypoints/client.ts`, schema: `../../../../entrypoints/schema.ts`, - scalars: `../../../../layers/1_Schema/Hybrid/types/Scalar/Scalar.ts`, + scalars: `../../../../types/Schema/types/Scalar/scalars.ts`, utilitiesForGenerated: `../../../../entrypoints/utilities-for-generated.ts`, }, }) diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Scalar.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Scalar.ts index bba613628..693d8619a 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Scalar.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Scalar.ts @@ -1,6 +1,6 @@ import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' -export * from '../../../../../../layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../../../types/Schema/types/Scalar/scalars.js' // // diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts index c29336fb7..bcb9dcec8 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts @@ -1,6 +1,8 @@ -import type * as $ from '../../../../../../entrypoints/schema.js' +import type { SchemaKit as $ } from '../../../../../../entrypoints/utilities-for-generated.js' +import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -18,164 +20,160 @@ export namespace Schema { // // - export type Mutation = $.Output.ObjectMutation<{ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Mutation = $.ObjectMutation<{ + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> }> - export type Query = $.Output.ObjectQuery<{ + export type Query = $.ObjectQuery<{ InputObjectNested: $.Field< 'InputObjectNested', - $.Output.Nullable<$Scalar.ID>, + $.Nullable<$Scalar.ID>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > InputObjectNestedNonNull: $.Field< 'InputObjectNestedNonNull', - $.Output.Nullable<$Scalar.ID>, + $.Nullable<$Scalar.ID>, $.Args<{ - input: $.Input.Field + input: $.InputField }, false> > /** * Query enum field documentation. */ - abcEnum: $.Field<'abcEnum', $.Output.Nullable, null> + abcEnum: $.Field<'abcEnum', $.Nullable, null> argInputObjectCircular: $.Field< 'argInputObjectCircular', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > - date: $.Field<'date', $.Output.Nullable<$Scalar.Date>, null> + date: $.Field<'date', $.Nullable<$Scalar.Date>, null> dateArg: $.Field< 'dateArg', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> + date: $.InputField<$.Nullable<$Scalar.Date>> }, true> > dateArgInputObject: $.Field< 'dateArgInputObject', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > dateArgList: $.Field< 'dateArgList', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.Nullable<$.Input.List<$Scalar.Date>>> + date: $.InputField<$.Nullable<$.List<$Scalar.Date>>> }, true> > dateArgNonNull: $.Field< 'dateArgNonNull', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$Scalar.Date> + date: $.InputField<$Scalar.Date> }, false> > dateArgNonNullList: $.Field< 'dateArgNonNullList', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.List<$.Input.Nullable<$Scalar.Date>>> + date: $.InputField<$.List<$.Nullable<$Scalar.Date>>> }, false> > dateArgNonNullListNonNull: $.Field< 'dateArgNonNullListNonNull', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.List<$Scalar.Date>> + date: $.InputField<$.List<$Scalar.Date>> }, false> > - dateInterface1: $.Field<'dateInterface1', $.Output.Nullable, null> - dateList: $.Field<'dateList', $.Output.Nullable<$.Output.List<$Scalar.Date>>, null> - dateListList: $.Field<'dateListList', $.Output.Nullable<$.Output.List<$.Output.List<$Scalar.Date>>>, null> - dateListNonNull: $.Field<'dateListNonNull', $.Output.List<$Scalar.Date>, null> + dateInterface1: $.Field<'dateInterface1', $.Nullable, null> + dateList: $.Field<'dateList', $.Nullable<$.List<$Scalar.Date>>, null> + dateListList: $.Field<'dateListList', $.Nullable<$.List<$.List<$Scalar.Date>>>, null> + dateListNonNull: $.Field<'dateListNonNull', $.List<$Scalar.Date>, null> dateNonNull: $.Field<'dateNonNull', $Scalar.Date, null> - dateObject1: $.Field<'dateObject1', $.Output.Nullable, null> - dateUnion: $.Field<'dateUnion', $.Output.Nullable, null> + dateObject1: $.Field<'dateObject1', $.Nullable, null> + dateUnion: $.Field<'dateUnion', $.Nullable, null> error: $.Field< 'error', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - case: $.Input.Field<$.Input.Nullable<$Scalar.String>> + case: $.InputField<$.Nullable<$Scalar.String>> }, true> > - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> - interface: $.Field<'interface', $.Output.Nullable, null> + interface: $.Field<'interface', $.Nullable, null> interfaceNonNull: $.Field<'interfaceNonNull', Interface, null> interfaceWithArgs: $.Field< 'interfaceWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - id: $.Input.Field<$Scalar.ID> + id: $.InputField<$Scalar.ID> }, false> > - listInt: $.Field<'listInt', $.Output.Nullable<$.Output.List<$.Output.Nullable<$Scalar.Int>>>, null> - listIntNonNull: $.Field<'listIntNonNull', $.Output.List<$Scalar.Int>, null> - listListInt: $.Field< - 'listListInt', - $.Output.Nullable<$.Output.List<$.Output.Nullable<$.Output.List<$.Output.Nullable<$Scalar.Int>>>>>, - null - > - listListIntNonNull: $.Field<'listListIntNonNull', $.Output.List<$.Output.List<$Scalar.Int>>, null> - lowerCaseUnion: $.Field<'lowerCaseUnion', $.Output.Nullable, null> - object: $.Field<'object', $.Output.Nullable, null> - objectList: $.Field<'objectList', $.Output.Nullable<$.Output.List>, null> - objectListNonNull: $.Field<'objectListNonNull', $.Output.List, null> - objectNested: $.Field<'objectNested', $.Output.Nullable, null> + listInt: $.Field<'listInt', $.Nullable<$.List<$.Nullable<$Scalar.Int>>>, null> + listIntNonNull: $.Field<'listIntNonNull', $.List<$Scalar.Int>, null> + listListInt: $.Field<'listListInt', $.Nullable<$.List<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>>>, null> + listListIntNonNull: $.Field<'listListIntNonNull', $.List<$.List<$Scalar.Int>>, null> + lowerCaseUnion: $.Field<'lowerCaseUnion', $.Nullable, null> + object: $.Field<'object', $.Nullable, null> + objectList: $.Field<'objectList', $.Nullable<$.List>, null> + objectListNonNull: $.Field<'objectListNonNull', $.List, null> + objectNested: $.Field<'objectNested', $.Nullable, null> objectNonNull: $.Field<'objectNonNull', Object1, null> objectWithArgs: $.Field< 'objectWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - boolean: $.Input.Field<$.Input.Nullable<$Scalar.Boolean>> - float: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - int: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - string: $.Input.Field<$.Input.Nullable<$Scalar.String>> + boolean: $.InputField<$.Nullable<$Scalar.Boolean>> + float: $.InputField<$.Nullable<$Scalar.Float>> + id: $.InputField<$.Nullable<$Scalar.ID>> + int: $.InputField<$.Nullable<$Scalar.Int>> + string: $.InputField<$.Nullable<$Scalar.String>> }, true> > result: $.Field< 'result', - $.Output.Nullable, + $.Nullable, $.Args<{ - case: $.Input.Field + case: $.InputField }, false> > resultNonNull: $.Field< 'resultNonNull', Result, $.Args<{ - case: $.Input.Field<$.Input.Nullable> + case: $.InputField<$.Nullable> }, true> > - string: $.Field<'string', $.Output.Nullable<$Scalar.String>, null> + string: $.Field<'string', $.Nullable<$Scalar.String>, null> stringWithArgEnum: $.Field< 'stringWithArgEnum', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ABCEnum: $.Input.Field<$.Input.Nullable> + ABCEnum: $.InputField<$.Nullable> }, true> > stringWithArgInputObject: $.Field< 'stringWithArgInputObject', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > stringWithArgInputObjectRequired: $.Field< 'stringWithArgInputObjectRequired', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field + input: $.InputField }, false> > /** @@ -183,46 +181,46 @@ export namespace Schema { */ stringWithArgs: $.Field< 'stringWithArgs', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - boolean: $.Input.Field<$.Input.Nullable<$Scalar.Boolean>> - float: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - int: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - string: $.Input.Field<$.Input.Nullable<$Scalar.String>> + boolean: $.InputField<$.Nullable<$Scalar.Boolean>> + float: $.InputField<$.Nullable<$Scalar.Float>> + id: $.InputField<$.Nullable<$Scalar.ID>> + int: $.InputField<$.Nullable<$Scalar.Int>> + string: $.InputField<$.Nullable<$Scalar.String>> }, true> > stringWithListArg: $.Field< 'stringWithListArg', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ints: $.Input.Field<$.Input.Nullable<$.Input.List<$.Input.Nullable<$Scalar.Int>>>> + ints: $.InputField<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>> }, true> > stringWithListArgRequired: $.Field< 'stringWithListArgRequired', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ints: $.Input.Field<$.Input.List<$Scalar.Int>> + ints: $.InputField<$.List<$Scalar.Int>> }, false> > stringWithRequiredArg: $.Field< 'stringWithRequiredArg', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - string: $.Input.Field<$Scalar.String> + string: $.InputField<$Scalar.String> }, false> > - unionFooBar: $.Field<'unionFooBar', $.Output.Nullable, null> + unionFooBar: $.Field<'unionFooBar', $.Nullable, null> unionFooBarNonNull: $.Field<'unionFooBarNonNull', FooBarUnion, null> unionFooBarWithArgs: $.Field< 'unionFooBarWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> + id: $.InputField<$.Nullable<$Scalar.ID>> }, true> > - unionObject: $.Field<'unionObject', $.Output.Nullable, null> + unionObject: $.Field<'unionObject', $.Nullable, null> unionObjectNonNull: $.Field<'unionObjectNonNull', ObjectUnion, null> }> @@ -271,23 +269,23 @@ export namespace Schema { // export type InputObject = $.InputObject<'InputObject', { - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> - dateRequired: $.Input.Field<$Scalar.Date> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - idRequired: $.Input.Field<$Scalar.ID> + date: $.InputField<$.Nullable<$Scalar.Date>> + dateRequired: $.InputField<$Scalar.Date> + id: $.InputField<$.Nullable<$Scalar.ID>> + idRequired: $.InputField<$Scalar.ID> }, true> export type InputObjectCircular = $.InputObject<'InputObjectCircular', { - circular: $.Input.Field<$.Input.Nullable> - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> + circular: $.InputField<$.Nullable> + date: $.InputField<$.Nullable<$Scalar.Date>> }, true> export type InputObjectNested = $.InputObject<'InputObjectNested', { - InputObject: $.Input.Field<$.Input.Nullable> + InputObject: $.InputField<$.Nullable> }, true> export type InputObjectNestedNonNull = $.InputObject<'InputObjectNestedNonNull', { - InputObject: $.Input.Field + InputObject: $.InputField }, false> // @@ -307,7 +305,7 @@ export namespace Schema { // export type DateInterface1 = $.Interface<'DateInterface1', { - date1: $.Field<'date1', $.Output.Nullable<$Scalar.Date>, null> + date1: $.Field<'date1', $.Nullable<$Scalar.Date>, null> }, [DateObject1]> export type Error = $.Interface<'Error', { @@ -315,7 +313,7 @@ export namespace Schema { }, [ErrorOne, ErrorTwo]> export type Interface = $.Interface<'Interface', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }, [Object1ImplementingInterface, Object2ImplementingInterface]> // @@ -334,74 +332,74 @@ export namespace Schema { // // - export type Bar = $.Object$2<'Bar', { - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type Bar = $.OutputObject<'Bar', { + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> - export type DateObject1 = $.Object$2<'DateObject1', { - date1: $.Field<'date1', $.Output.Nullable<$Scalar.Date>, null> + export type DateObject1 = $.OutputObject<'DateObject1', { + date1: $.Field<'date1', $.Nullable<$Scalar.Date>, null> }> - export type DateObject2 = $.Object$2<'DateObject2', { - date2: $.Field<'date2', $.Output.Nullable<$Scalar.Date>, null> + export type DateObject2 = $.OutputObject<'DateObject2', { + date2: $.Field<'date2', $.Nullable<$Scalar.Date>, null> }> - export type ErrorOne = $.Object$2<'ErrorOne', { - infoId: $.Field<'infoId', $.Output.Nullable<$Scalar.ID>, null> + export type ErrorOne = $.OutputObject<'ErrorOne', { + infoId: $.Field<'infoId', $.Nullable<$Scalar.ID>, null> message: $.Field<'message', $Scalar.String, null> }> - export type ErrorTwo = $.Object$2<'ErrorTwo', { - infoInt: $.Field<'infoInt', $.Output.Nullable<$Scalar.Int>, null> + export type ErrorTwo = $.OutputObject<'ErrorTwo', { + infoInt: $.Field<'infoInt', $.Nullable<$Scalar.Int>, null> message: $.Field<'message', $Scalar.String, null> }> /** * Object documentation. */ - export type Foo = $.Object$2<'Foo', { + export type Foo = $.OutputObject<'Foo', { /** * Field documentation. * * @deprecated Field a is deprecated. */ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type Object1 = $.Object$2<'Object1', { - ABCEnum: $.Field<'ABCEnum', $.Output.Nullable, null> - boolean: $.Field<'boolean', $.Output.Nullable<$Scalar.Boolean>, null> - float: $.Field<'float', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> - string: $.Field<'string', $.Output.Nullable<$Scalar.String>, null> + export type Object1 = $.OutputObject<'Object1', { + ABCEnum: $.Field<'ABCEnum', $.Nullable, null> + boolean: $.Field<'boolean', $.Nullable<$Scalar.Boolean>, null> + float: $.Field<'float', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> + string: $.Field<'string', $.Nullable<$Scalar.String>, null> }> - export type Object1ImplementingInterface = $.Object$2<'Object1ImplementingInterface', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type Object1ImplementingInterface = $.OutputObject<'Object1ImplementingInterface', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> - export type Object2ImplementingInterface = $.Object$2<'Object2ImplementingInterface', { - boolean: $.Field<'boolean', $.Output.Nullable<$Scalar.Boolean>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Object2ImplementingInterface = $.OutputObject<'Object2ImplementingInterface', { + boolean: $.Field<'boolean', $.Nullable<$Scalar.Boolean>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type ObjectNested = $.Object$2<'ObjectNested', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - object: $.Field<'object', $.Output.Nullable, null> + export type ObjectNested = $.OutputObject<'ObjectNested', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + object: $.Field<'object', $.Nullable, null> }> - export type ObjectUnion = $.Object$2<'ObjectUnion', { - fooBarUnion: $.Field<'fooBarUnion', $.Output.Nullable, null> + export type ObjectUnion = $.OutputObject<'ObjectUnion', { + fooBarUnion: $.Field<'fooBarUnion', $.Nullable, null> }> - export type lowerCaseObject = $.Object$2<'lowerCaseObject', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type lowerCaseObject = $.OutputObject<'lowerCaseObject', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type lowerCaseObject2 = $.Object$2<'lowerCaseObject2', { - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type lowerCaseObject2 = $.OutputObject<'lowerCaseObject2', { + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> // @@ -431,6 +429,7 @@ export namespace Schema { export type lowerCaseUnion = $.Union<'lowerCaseUnion', [lowerCaseObject, lowerCaseObject2]> } + // // // @@ -446,11 +445,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase { diff --git a/src/generator/generator/__snapshots__/generate.test.ts.snap b/src/generator/generator/__snapshots__/generate.test.ts.snap index c6a226f6a..616c5e34c 100644 --- a/src/generator/generator/__snapshots__/generate.test.ts.snap +++ b/src/generator/generator/__snapshots__/generate.test.ts.snap @@ -938,7 +938,7 @@ export interface Interface { exports[`kitchen-sink generated modules > modules/Scalar.ts 1`] = ` "import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../../../src/types/Schema/types/Scalar/scalars.js' // // @@ -957,9 +957,11 @@ export type Date = $$Utilities.SchemaKit.Scalar.ScalarCodecless<'Date'> `; exports[`kitchen-sink generated modules > modules/Schema.ts 1`] = ` -"import type * as $ from '../../../../../../src/entrypoints/schema.js' +"import type { SchemaKit as $ } from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -977,164 +979,160 @@ export namespace Schema { // // - export type Mutation = $.Output.ObjectMutation<{ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Mutation = $.ObjectMutation<{ + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> }> - export type Query = $.Output.ObjectQuery<{ + export type Query = $.ObjectQuery<{ InputObjectNested: $.Field< 'InputObjectNested', - $.Output.Nullable<$Scalar.ID>, + $.Nullable<$Scalar.ID>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > InputObjectNestedNonNull: $.Field< 'InputObjectNestedNonNull', - $.Output.Nullable<$Scalar.ID>, + $.Nullable<$Scalar.ID>, $.Args<{ - input: $.Input.Field + input: $.InputField }, false> > /** * Query enum field documentation. */ - abcEnum: $.Field<'abcEnum', $.Output.Nullable, null> + abcEnum: $.Field<'abcEnum', $.Nullable, null> argInputObjectCircular: $.Field< 'argInputObjectCircular', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > - date: $.Field<'date', $.Output.Nullable<$Scalar.Date>, null> + date: $.Field<'date', $.Nullable<$Scalar.Date>, null> dateArg: $.Field< 'dateArg', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> + date: $.InputField<$.Nullable<$Scalar.Date>> }, true> > dateArgInputObject: $.Field< 'dateArgInputObject', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > dateArgList: $.Field< 'dateArgList', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.Nullable<$.Input.List<$Scalar.Date>>> + date: $.InputField<$.Nullable<$.List<$Scalar.Date>>> }, true> > dateArgNonNull: $.Field< 'dateArgNonNull', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$Scalar.Date> + date: $.InputField<$Scalar.Date> }, false> > dateArgNonNullList: $.Field< 'dateArgNonNullList', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.List<$.Input.Nullable<$Scalar.Date>>> + date: $.InputField<$.List<$.Nullable<$Scalar.Date>>> }, false> > dateArgNonNullListNonNull: $.Field< 'dateArgNonNullListNonNull', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.List<$Scalar.Date>> + date: $.InputField<$.List<$Scalar.Date>> }, false> > - dateInterface1: $.Field<'dateInterface1', $.Output.Nullable, null> - dateList: $.Field<'dateList', $.Output.Nullable<$.Output.List<$Scalar.Date>>, null> - dateListList: $.Field<'dateListList', $.Output.Nullable<$.Output.List<$.Output.List<$Scalar.Date>>>, null> - dateListNonNull: $.Field<'dateListNonNull', $.Output.List<$Scalar.Date>, null> + dateInterface1: $.Field<'dateInterface1', $.Nullable, null> + dateList: $.Field<'dateList', $.Nullable<$.List<$Scalar.Date>>, null> + dateListList: $.Field<'dateListList', $.Nullable<$.List<$.List<$Scalar.Date>>>, null> + dateListNonNull: $.Field<'dateListNonNull', $.List<$Scalar.Date>, null> dateNonNull: $.Field<'dateNonNull', $Scalar.Date, null> - dateObject1: $.Field<'dateObject1', $.Output.Nullable, null> - dateUnion: $.Field<'dateUnion', $.Output.Nullable, null> + dateObject1: $.Field<'dateObject1', $.Nullable, null> + dateUnion: $.Field<'dateUnion', $.Nullable, null> error: $.Field< 'error', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - case: $.Input.Field<$.Input.Nullable<$Scalar.String>> + case: $.InputField<$.Nullable<$Scalar.String>> }, true> > - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> - interface: $.Field<'interface', $.Output.Nullable, null> + interface: $.Field<'interface', $.Nullable, null> interfaceNonNull: $.Field<'interfaceNonNull', Interface, null> interfaceWithArgs: $.Field< 'interfaceWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - id: $.Input.Field<$Scalar.ID> + id: $.InputField<$Scalar.ID> }, false> > - listInt: $.Field<'listInt', $.Output.Nullable<$.Output.List<$.Output.Nullable<$Scalar.Int>>>, null> - listIntNonNull: $.Field<'listIntNonNull', $.Output.List<$Scalar.Int>, null> - listListInt: $.Field< - 'listListInt', - $.Output.Nullable<$.Output.List<$.Output.Nullable<$.Output.List<$.Output.Nullable<$Scalar.Int>>>>>, - null - > - listListIntNonNull: $.Field<'listListIntNonNull', $.Output.List<$.Output.List<$Scalar.Int>>, null> - lowerCaseUnion: $.Field<'lowerCaseUnion', $.Output.Nullable, null> - object: $.Field<'object', $.Output.Nullable, null> - objectList: $.Field<'objectList', $.Output.Nullable<$.Output.List>, null> - objectListNonNull: $.Field<'objectListNonNull', $.Output.List, null> - objectNested: $.Field<'objectNested', $.Output.Nullable, null> + listInt: $.Field<'listInt', $.Nullable<$.List<$.Nullable<$Scalar.Int>>>, null> + listIntNonNull: $.Field<'listIntNonNull', $.List<$Scalar.Int>, null> + listListInt: $.Field<'listListInt', $.Nullable<$.List<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>>>, null> + listListIntNonNull: $.Field<'listListIntNonNull', $.List<$.List<$Scalar.Int>>, null> + lowerCaseUnion: $.Field<'lowerCaseUnion', $.Nullable, null> + object: $.Field<'object', $.Nullable, null> + objectList: $.Field<'objectList', $.Nullable<$.List>, null> + objectListNonNull: $.Field<'objectListNonNull', $.List, null> + objectNested: $.Field<'objectNested', $.Nullable, null> objectNonNull: $.Field<'objectNonNull', Object1, null> objectWithArgs: $.Field< 'objectWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - boolean: $.Input.Field<$.Input.Nullable<$Scalar.Boolean>> - float: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - int: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - string: $.Input.Field<$.Input.Nullable<$Scalar.String>> + boolean: $.InputField<$.Nullable<$Scalar.Boolean>> + float: $.InputField<$.Nullable<$Scalar.Float>> + id: $.InputField<$.Nullable<$Scalar.ID>> + int: $.InputField<$.Nullable<$Scalar.Int>> + string: $.InputField<$.Nullable<$Scalar.String>> }, true> > result: $.Field< 'result', - $.Output.Nullable, + $.Nullable, $.Args<{ - case: $.Input.Field + case: $.InputField }, false> > resultNonNull: $.Field< 'resultNonNull', Result, $.Args<{ - case: $.Input.Field<$.Input.Nullable> + case: $.InputField<$.Nullable> }, true> > - string: $.Field<'string', $.Output.Nullable<$Scalar.String>, null> + string: $.Field<'string', $.Nullable<$Scalar.String>, null> stringWithArgEnum: $.Field< 'stringWithArgEnum', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ABCEnum: $.Input.Field<$.Input.Nullable> + ABCEnum: $.InputField<$.Nullable> }, true> > stringWithArgInputObject: $.Field< 'stringWithArgInputObject', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > stringWithArgInputObjectRequired: $.Field< 'stringWithArgInputObjectRequired', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field + input: $.InputField }, false> > /** @@ -1142,46 +1140,46 @@ export namespace Schema { */ stringWithArgs: $.Field< 'stringWithArgs', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - boolean: $.Input.Field<$.Input.Nullable<$Scalar.Boolean>> - float: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - int: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - string: $.Input.Field<$.Input.Nullable<$Scalar.String>> + boolean: $.InputField<$.Nullable<$Scalar.Boolean>> + float: $.InputField<$.Nullable<$Scalar.Float>> + id: $.InputField<$.Nullable<$Scalar.ID>> + int: $.InputField<$.Nullable<$Scalar.Int>> + string: $.InputField<$.Nullable<$Scalar.String>> }, true> > stringWithListArg: $.Field< 'stringWithListArg', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ints: $.Input.Field<$.Input.Nullable<$.Input.List<$.Input.Nullable<$Scalar.Int>>>> + ints: $.InputField<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>> }, true> > stringWithListArgRequired: $.Field< 'stringWithListArgRequired', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ints: $.Input.Field<$.Input.List<$Scalar.Int>> + ints: $.InputField<$.List<$Scalar.Int>> }, false> > stringWithRequiredArg: $.Field< 'stringWithRequiredArg', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - string: $.Input.Field<$Scalar.String> + string: $.InputField<$Scalar.String> }, false> > - unionFooBar: $.Field<'unionFooBar', $.Output.Nullable, null> + unionFooBar: $.Field<'unionFooBar', $.Nullable, null> unionFooBarNonNull: $.Field<'unionFooBarNonNull', FooBarUnion, null> unionFooBarWithArgs: $.Field< 'unionFooBarWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> + id: $.InputField<$.Nullable<$Scalar.ID>> }, true> > - unionObject: $.Field<'unionObject', $.Output.Nullable, null> + unionObject: $.Field<'unionObject', $.Nullable, null> unionObjectNonNull: $.Field<'unionObjectNonNull', ObjectUnion, null> }> @@ -1230,23 +1228,23 @@ export namespace Schema { // export type InputObject = $.InputObject<'InputObject', { - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> - dateRequired: $.Input.Field<$Scalar.Date> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - idRequired: $.Input.Field<$Scalar.ID> + date: $.InputField<$.Nullable<$Scalar.Date>> + dateRequired: $.InputField<$Scalar.Date> + id: $.InputField<$.Nullable<$Scalar.ID>> + idRequired: $.InputField<$Scalar.ID> }, true> export type InputObjectCircular = $.InputObject<'InputObjectCircular', { - circular: $.Input.Field<$.Input.Nullable> - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> + circular: $.InputField<$.Nullable> + date: $.InputField<$.Nullable<$Scalar.Date>> }, true> export type InputObjectNested = $.InputObject<'InputObjectNested', { - InputObject: $.Input.Field<$.Input.Nullable> + InputObject: $.InputField<$.Nullable> }, true> export type InputObjectNestedNonNull = $.InputObject<'InputObjectNestedNonNull', { - InputObject: $.Input.Field + InputObject: $.InputField }, false> // @@ -1266,7 +1264,7 @@ export namespace Schema { // export type DateInterface1 = $.Interface<'DateInterface1', { - date1: $.Field<'date1', $.Output.Nullable<$Scalar.Date>, null> + date1: $.Field<'date1', $.Nullable<$Scalar.Date>, null> }, [DateObject1]> export type Error = $.Interface<'Error', { @@ -1274,7 +1272,7 @@ export namespace Schema { }, [ErrorOne, ErrorTwo]> export type Interface = $.Interface<'Interface', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }, [Object1ImplementingInterface, Object2ImplementingInterface]> // @@ -1293,74 +1291,74 @@ export namespace Schema { // // - export type Bar = $.Object$2<'Bar', { - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type Bar = $.OutputObject<'Bar', { + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> - export type DateObject1 = $.Object$2<'DateObject1', { - date1: $.Field<'date1', $.Output.Nullable<$Scalar.Date>, null> + export type DateObject1 = $.OutputObject<'DateObject1', { + date1: $.Field<'date1', $.Nullable<$Scalar.Date>, null> }> - export type DateObject2 = $.Object$2<'DateObject2', { - date2: $.Field<'date2', $.Output.Nullable<$Scalar.Date>, null> + export type DateObject2 = $.OutputObject<'DateObject2', { + date2: $.Field<'date2', $.Nullable<$Scalar.Date>, null> }> - export type ErrorOne = $.Object$2<'ErrorOne', { - infoId: $.Field<'infoId', $.Output.Nullable<$Scalar.ID>, null> + export type ErrorOne = $.OutputObject<'ErrorOne', { + infoId: $.Field<'infoId', $.Nullable<$Scalar.ID>, null> message: $.Field<'message', $Scalar.String, null> }> - export type ErrorTwo = $.Object$2<'ErrorTwo', { - infoInt: $.Field<'infoInt', $.Output.Nullable<$Scalar.Int>, null> + export type ErrorTwo = $.OutputObject<'ErrorTwo', { + infoInt: $.Field<'infoInt', $.Nullable<$Scalar.Int>, null> message: $.Field<'message', $Scalar.String, null> }> /** * Object documentation. */ - export type Foo = $.Object$2<'Foo', { + export type Foo = $.OutputObject<'Foo', { /** * Field documentation. * * @deprecated Field a is deprecated. */ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type Object1 = $.Object$2<'Object1', { - ABCEnum: $.Field<'ABCEnum', $.Output.Nullable, null> - boolean: $.Field<'boolean', $.Output.Nullable<$Scalar.Boolean>, null> - float: $.Field<'float', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> - string: $.Field<'string', $.Output.Nullable<$Scalar.String>, null> + export type Object1 = $.OutputObject<'Object1', { + ABCEnum: $.Field<'ABCEnum', $.Nullable, null> + boolean: $.Field<'boolean', $.Nullable<$Scalar.Boolean>, null> + float: $.Field<'float', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> + string: $.Field<'string', $.Nullable<$Scalar.String>, null> }> - export type Object1ImplementingInterface = $.Object$2<'Object1ImplementingInterface', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type Object1ImplementingInterface = $.OutputObject<'Object1ImplementingInterface', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> - export type Object2ImplementingInterface = $.Object$2<'Object2ImplementingInterface', { - boolean: $.Field<'boolean', $.Output.Nullable<$Scalar.Boolean>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Object2ImplementingInterface = $.OutputObject<'Object2ImplementingInterface', { + boolean: $.Field<'boolean', $.Nullable<$Scalar.Boolean>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type ObjectNested = $.Object$2<'ObjectNested', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - object: $.Field<'object', $.Output.Nullable, null> + export type ObjectNested = $.OutputObject<'ObjectNested', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + object: $.Field<'object', $.Nullable, null> }> - export type ObjectUnion = $.Object$2<'ObjectUnion', { - fooBarUnion: $.Field<'fooBarUnion', $.Output.Nullable, null> + export type ObjectUnion = $.OutputObject<'ObjectUnion', { + fooBarUnion: $.Field<'fooBarUnion', $.Nullable, null> }> - export type lowerCaseObject = $.Object$2<'lowerCaseObject', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type lowerCaseObject = $.OutputObject<'lowerCaseObject', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type lowerCaseObject2 = $.Object$2<'lowerCaseObject2', { - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type lowerCaseObject2 = $.OutputObject<'lowerCaseObject2', { + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> // @@ -1390,6 +1388,7 @@ export namespace Schema { export type lowerCaseUnion = $.Union<'lowerCaseUnion', [lowerCaseObject, lowerCaseObject2]> } + // // // @@ -1405,11 +1404,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase { diff --git a/src/generator/generators/Schema.ts b/src/generator/generators/Schema.ts index e96124153..99034bc4a 100644 --- a/src/generator/generators/Schema.ts +++ b/src/generator/generators/Schema.ts @@ -1,8 +1,8 @@ -import type { SchemaKit } from '../../layers/1_Schema/__.js' import { Code } from '../../lib/Code.js' import { Grafaid } from '../../lib/grafaid/__.js' import { entries, isObjectEmpty, values } from '../../lib/prelude.js' import type { GlobalRegistry } from '../../types/GlobalRegistry/GlobalRegistry.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { Config } from '../config/config.js' import { identifiers } from '../helpers/identifiers.js' import { createModuleGenerator } from '../helpers/moduleGenerator.js' @@ -22,24 +22,24 @@ export interface Schema< > { name: GlobalRegistry.ClientNames RootTypesPresent: ('Query' | 'Mutation' | 'Subscription')[] - RootUnion: SchemaKit.Output.RootType + RootUnion: SchemaKit.RootType Root: { - Query: null | SchemaKit.Output.ObjectQuery - Mutation: null | SchemaKit.Output.ObjectMutation - Subscription: null | SchemaKit.Output.ObjectSubscription + Query: null | SchemaKit.ObjectQuery + Mutation: null | SchemaKit.ObjectMutation + Subscription: null | SchemaKit.ObjectSubscription } allTypes: Record< string, - | SchemaKit.Hybrid.Enum - | SchemaKit.Output.ObjectQuery - | SchemaKit.Output.ObjectMutation - | SchemaKit.Output.Object$2 - | SchemaKit.Output.Union - | SchemaKit.Output.Interface + | SchemaKit.Enum + | SchemaKit.ObjectQuery + | SchemaKit.ObjectMutation + | SchemaKit.OutputObject + | SchemaKit.Union + | SchemaKit.Interface > - objects: Record - unions: Record - interfaces: Record + objects: Record + unions: Record + interfaces: Record /** * A map of scalar definitions. Useful for custom scalars. */ @@ -50,9 +50,14 @@ export interface Schema< export const ModuleGeneratorSchema = createModuleGenerator( `Schema`, ({ config, code }) => { - code(`import type * as $ from '${config.paths.imports.grafflePackage.schema}'`) - code(`import type * as $Scalar from './${ModuleGeneratorScalar.name}.js'`) - code(`\n\n`) + // todo methods root is unused + code(` + import type * as Data from './${ModuleGeneratorData.name}.js' + import type * as ${identifiers.MethodsRoot} from './${ModuleGeneratorMethodsRoot.name}.js' + import type { SchemaKit as $ } from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' + import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' + import type * as $Scalar from './${ModuleGeneratorScalar.name}.js' + `) code(`export namespace ${identifiers.Schema} {`) for (const [name, types] of entries(config.schema.kindMap)) { @@ -73,6 +78,7 @@ export const ModuleGeneratorSchema = createModuleGenerator( ) } code(`}`) + code() code(SchemaGenerator({ config })) }, @@ -80,17 +86,7 @@ export const ModuleGeneratorSchema = createModuleGenerator( export const SchemaGenerator = createCodeGenerator( ({ config, code }) => { - code() code(title1(`Schema`)) - code() - - // todo methods root is unused - code(` - import type * as Data from './${ModuleGeneratorData.name}.js' - import type * as ${identifiers.MethodsRoot} from './${ModuleGeneratorMethodsRoot.name}.js' - import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' - `) - code() const rootTypesPresence = { Query: Grafaid.Schema.KindMap.hasQuery(config.schema.kindMap), @@ -281,8 +277,8 @@ const concreteRenderers = defineConcreteRenderers({ GraphQLObjectType: (config, node) => { const maybeRootTypeName = (Grafaid.Schema.RootTypeName as Record)[node.name] const type = maybeRootTypeName - ? `$.Output.Object${maybeRootTypeName}<${renderOutputFields(config, node)}>` - : `$.Object$2<${Code.string(node.name)}, ${renderOutputFields(config, node)}>` + ? `$.Object${maybeRootTypeName}<${renderOutputFields(config, node)}>` + : `$.OutputObject<${Code.string(node.name)}, ${renderOutputFields(config, node)}>` const doc = getDocumentation(config, node) const source = Code.export$(Code.type(node.name, type)) return Code.TSDocWithBlock(doc, source) @@ -331,7 +327,7 @@ const renderInputFields = (config: Config, node: AnyGraphQLFieldsType): string = } const renderOutputField = (config: Config, field: Grafaid.Schema.InputOrOutputField): string => { - const type = buildType(`output`, config, field.type) + const type = buildType(config, field.type) const args = Grafaid.Schema.isGraphQLOutputField(field) && field.args.length > 0 ? renderArgs(config, field.args) @@ -341,11 +337,11 @@ const renderOutputField = (config: Config, field: Grafaid.Schema.InputOrOutputFi } const renderInputField = (config: Config, field: Grafaid.Schema.InputOrOutputField): string => { - return `$.Input.Field<${buildType(`input`, config, field.type)}>` + return `$.InputField<${buildType(config, field.type)}>` } -const buildType = (direction: 'input' | 'output', config: Config, node: Grafaid.Schema.Types) => { - const ns = direction === `input` ? `Input` : `Output` +const buildType = (config: Config, node: Grafaid.Schema.Types) => { + // const ns = direction === `input` ? `Input` : `Output` const nullable = Grafaid.Schema.isNullableType(node) const nodeInner = Grafaid.Schema.getNullableType(node) @@ -354,14 +350,14 @@ const buildType = (direction: 'input' | 'output', config: Config, node: Grafaid. // const namedTypeCode = `_.Named<${namedTypeReference}>` const namedTypeCode = namedTypeReference return nullable - ? `$.${ns}.Nullable<${namedTypeCode}>` + ? `$.Nullable<${namedTypeCode}>` : namedTypeCode } if (Grafaid.Schema.isListType(nodeInner)) { - const fieldType = `$.${ns}.List<${buildType(direction, config, nodeInner.ofType)}>` as any as string + const fieldType = `$.List<${buildType(config, nodeInner.ofType)}>` as any as string return nullable - ? `$.${ns}.Nullable<${fieldType}>` + ? `$.Nullable<${fieldType}>` : fieldType } @@ -382,6 +378,6 @@ const renderArgs = (config: Config, args: readonly Grafaid.Schema.Argument[]) => const renderArg = (config: Config, arg: Grafaid.Schema.Argument) => { // const { nullable } = unwrapToNonNull(arg.type) // hasRequiredArgs = hasRequiredArgs || !nullable - const type = buildType(`input`, config, arg.type) - return Code.field(arg.name, `$.Input.Field<${type}>`) + const type = buildType(config, arg.type) + return Code.field(arg.name, `$.InputField<${type}>`) } diff --git a/src/layers/1_Schema/Directives.ts b/src/layers/1_Schema/Directives.ts deleted file mode 100644 index 7c5cfdf3f..000000000 --- a/src/layers/1_Schema/Directives.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Hybrid } from './Hybrid/__.js' - -export interface Directive { - name: string - arguments: Record -} - -export const IncludeDirective: Directive = { - name: `include`, - arguments: { - if: { - name: `if`, - type: Hybrid.Scalar.Boolean, - }, - }, -} - -export const SkipDirective: Directive = { - name: `skip`, - arguments: { - if: { - name: `if`, - type: Hybrid.Scalar.Boolean, - }, - }, -} - -export const standardDirectivesByName = { - include: IncludeDirective, - skip: SkipDirective, -} diff --git a/src/layers/1_Schema/Hybrid/_.ts b/src/layers/1_Schema/Hybrid/_.ts deleted file mode 100644 index d12e3e06d..000000000 --- a/src/layers/1_Schema/Hybrid/_.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './typeGroups.js' -export * from './types/Enum.js' -export * from './types/Scalar/__.js' diff --git a/src/layers/1_Schema/Hybrid/__.ts b/src/layers/1_Schema/Hybrid/__.ts deleted file mode 100644 index 780cae1e4..000000000 --- a/src/layers/1_Schema/Hybrid/__.ts +++ /dev/null @@ -1 +0,0 @@ -export * as Hybrid from './_.js' diff --git a/src/layers/1_Schema/Hybrid/typeGroups.ts b/src/layers/1_Schema/Hybrid/typeGroups.ts deleted file mode 100644 index 8344af9f6..000000000 --- a/src/layers/1_Schema/Hybrid/typeGroups.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Enum, Scalar } from './_.js' - -export type $Any = Enum | Scalar.Scalar diff --git a/src/layers/1_Schema/Hybrid/types/Scalar/Scalar.ts b/src/layers/1_Schema/Hybrid/types/Scalar/Scalar.ts deleted file mode 100644 index 27ff8f902..000000000 --- a/src/layers/1_Schema/Hybrid/types/Scalar/Scalar.ts +++ /dev/null @@ -1,111 +0,0 @@ -import type { IsAny, IsNever } from 'type-fest' -import type { Grafaid } from '../../../../../lib/grafaid/__.js' -import type { GlobalRegistry } from '../../../../../types/GlobalRegistry/GlobalRegistry.js' -import type { Codec, Mapper } from './codec.js' -import { JavaScriptScalarCodecs } from './nativeScalarCodecs.js' - -export { JavaScriptScalarCodecs } from './nativeScalarCodecs.js' - -const ScalarKind = `Scalar` - -type ScalarKind = typeof ScalarKind - -export const create = <$Name extends string, $Decoded, $Encoded extends Grafaid.Schema.StandardScalarRuntimeTypes>( - name: $Name, - codec: { - encode: (value: $Decoded) => $Encoded - decode: (value: $Encoded) => $Decoded - }, -): Scalar<$Name, $Decoded, $Encoded> => ({ - kind: ScalarKind, - name: name, - codec: codec as any, -}) - -export const scalar = <$Name extends string, $Codec extends Codec>( - name: $Name, - codec: $Codec, -): Scalar<$Name, $Codec> => ({ - kind: ScalarKind, - name: name, - codec: codec, -}) - -export type GetEncoded<$Scalar> = $Scalar extends Scalar ? $Encoded : never - -export type GetDecoded<$Scalar> = $Scalar extends Scalar ? $Decoded - : never - -export interface ScalarCodecless< - $Name extends string = string, -> { - kind: ScalarKind - name: $Name -} - -export interface Scalar< - $Name extends string = string, - $Decoded = unknown, - $Encoded extends Grafaid.Schema.StandardScalarRuntimeTypes = Grafaid.Schema.StandardScalarRuntimeTypes, -> { - kind: ScalarKind - name: $Name - codec: Codec<$Decoded, $Encoded> -} - -export type ScalarMap = Record - -// dprint-ignore -export type LookupCustomScalarOrFallbackToString<$Name extends string, $Scalars extends ScalarMap> = - $Name extends keyof $Scalars ? $Scalars[$Name] : String - -export const lookupCustomScalarOrFallbackToString = (scalars: ScalarMap, name: string): Scalar => { - const scalar = scalars[name] - if (scalar) return scalar - return String -} - -/** - * Apply a codec's mapper function (decode or encode) to a GraphQL value. - * - * If value is an array then its members are traversed recursively. - * - * Null values are returned as is. - */ -export const applyCodec = <$Mapper extends Mapper>( - mapper: $Mapper, - value: any, -): null | ReturnType<$Mapper> | ReturnType<$Mapper>[] => { - if (value === null) { - return null - } - - if (Array.isArray(value)) { - return value.map(item => applyCodec(mapper, item)) as ReturnType<$Mapper> - } - - return mapper(value) as ReturnType<$Mapper> -} - -export const isScalar = (value: unknown): value is Scalar => - typeof value === `object` && value !== null && `codec` in value && typeof value.codec === `object` - -export const String = create(`String`, JavaScriptScalarCodecs.String) - -export const ID = create(`ID`, JavaScriptScalarCodecs.String) - -export const Int = create(`Int`, JavaScriptScalarCodecs.Number) - -export const Float = create(`Float`, JavaScriptScalarCodecs.Number) - -export const Boolean = create(`Boolean`, JavaScriptScalarCodecs.Boolean) - -export type ID = typeof ID - -export type String = typeof String - -export type Int = typeof Int - -export type Boolean = typeof Boolean - -export type Float = typeof Float diff --git a/src/layers/1_Schema/Hybrid/types/Scalar/__.ts b/src/layers/1_Schema/Hybrid/types/Scalar/__.ts deleted file mode 100644 index e21bb3cfa..000000000 --- a/src/layers/1_Schema/Hybrid/types/Scalar/__.ts +++ /dev/null @@ -1 +0,0 @@ -export * as Scalar from './Scalar.js' diff --git a/src/layers/1_Schema/Input/Input.ts b/src/layers/1_Schema/Input/Input.ts deleted file mode 100644 index 5a5bb91a2..000000000 --- a/src/layers/1_Schema/Input/Input.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { MaybeThunk } from '../core/helpers.js' -import type { Any } from './typeGroups.js' - -export * from './typeGroups.js' -export * from './types/InputObject.js' -export * from './types/List.js' -export * from './types/Nullable.js' - -export const Field = <$Type extends Any>(type: MaybeThunk<$Type>): Field<$Type> => { - return { - // Thunks do not exist at the type level - type: type as any, - } -} - -export type Field<$Type extends any = any> = { - type: $Type -} diff --git a/src/layers/1_Schema/Input/__.ts b/src/layers/1_Schema/Input/__.ts deleted file mode 100644 index 31e74e92c..000000000 --- a/src/layers/1_Schema/Input/__.ts +++ /dev/null @@ -1 +0,0 @@ -export * as Input from './Input.js' diff --git a/src/layers/1_Schema/Input/typeGroups.ts b/src/layers/1_Schema/Input/typeGroups.ts deleted file mode 100644 index 0ca9a37e8..000000000 --- a/src/layers/1_Schema/Input/typeGroups.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Hybrid } from '../Hybrid/__.js' -import type { InputObject } from './types/InputObject.js' -import type { List } from './types/List.js' -import type { Nullable } from './types/Nullable.js' - -export type Named = Hybrid.Enum | Hybrid.Scalar.Scalar | InputObject | Hybrid.Scalar.ScalarCodecless - -export type Any = AnyExceptNull | Nullable - -export type AnyExceptNull = List | Named diff --git a/src/layers/1_Schema/Input/types/List.ts b/src/layers/1_Schema/Input/types/List.ts deleted file mode 100644 index b8bd1546b..000000000 --- a/src/layers/1_Schema/Input/types/List.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { Base } from '../../core/helpers.js' -import type { Any } from '../typeGroups.js' - -export type List<$InnerType extends Any> = Base.List<$InnerType> diff --git a/src/layers/1_Schema/Input/types/Nullable.ts b/src/layers/1_Schema/Input/types/Nullable.ts deleted file mode 100644 index 01e558352..000000000 --- a/src/layers/1_Schema/Input/types/Nullable.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { Base } from '../../core/helpers.js' -import type { Any, Named } from '../typeGroups.js' -import type { List } from './List.js' - -type InnerType = Named | List - -export type Nullable<$InnerType extends InnerType> = Base.Nullable<$InnerType> - -// dprint-ignore -type UnwrapNullable<$Type> = - $Type extends Nullable ? UnwrapNullable<$innerType> - : $Type - -export const unwrapNullable = <$Type extends Any>(type: $Type): UnwrapNullable<$Type> => { - if (type.kind === `nullable`) return type.type - // @ts-expect-error fixme - return type -} diff --git a/src/layers/1_Schema/Output/Output.ts b/src/layers/1_Schema/Output/Output.ts deleted file mode 100644 index 3ad9b6b30..000000000 --- a/src/layers/1_Schema/Output/Output.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { TSErrorDescriptive } from '../../../lib/ts-error.js' -import type { Named } from './typeGroups.js' -import type { __typename } from './types/__typename.js' -import type { List } from './types/List.js' -import type { Nullable } from './types/Nullable.js' - -export * from './typeGroups.js' -export * from './types/__typename.js' -export * from './types/Interface.js' -export * from './types/List.js' -export * from './types/Nullable.js' -export * from './types/Object.js' -export * from './types/Union.js' - -// todo extends any because of infinite depth issue in generated schema types -// dprint-ignore -export type Unwrap<$Type extends any> = - $Type extends List ? Unwrap<$innerType> : - $Type extends Nullable ? Unwrap<$innerType> : - $Type extends __typename ? $Type['type'] : - $Type extends Named ? $Type : - TSErrorDescriptive<'Unwrap', 'Unknown $Type', { $Type: $Type }> - -// dprint-ignore -export type UnwrapNullable<$Type> = - $Type extends Nullable ? UnwrapNullable<$innerType> - : $Type diff --git a/src/layers/1_Schema/Output/__.ts b/src/layers/1_Schema/Output/__.ts deleted file mode 100644 index 6df548327..000000000 --- a/src/layers/1_Schema/Output/__.ts +++ /dev/null @@ -1 +0,0 @@ -export * as Output from './Output.js' diff --git a/src/layers/1_Schema/Output/typeGroups.ts b/src/layers/1_Schema/Output/typeGroups.ts deleted file mode 100644 index 63f756c0e..000000000 --- a/src/layers/1_Schema/Output/typeGroups.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Hybrid } from '../Hybrid/__.js' -import type { Enum } from '../Hybrid/types/Enum.js' -import type { __typename } from './types/__typename.js' -import type { Interface } from './types/Interface.js' -import type { List } from './types/List.js' -import type { Nullable } from './types/Nullable.js' -import type { Object$2 } from './types/Object.js' -import type { Union } from './types/Union.js' - -export type ObjectLike = Object$2 | Interface - -export type Named = - | Interface - | Enum - | Object$2 - | Union - | Hybrid.Scalar.Scalar - | Hybrid.Scalar.ScalarCodecless - -export type Unnamed = List | Nullable - -export type Any = Unnamed | Named | __typename - -// dprint-ignore -export type UnwrapToNamed<$Type extends Any> = - $Type extends List ? UnwrapToNamed<$Inner> : - $Type extends Nullable ? UnwrapToNamed<$Inner> : - $Type diff --git a/src/layers/1_Schema/Output/types/Field.ts b/src/layers/1_Schema/Output/types/Field.ts deleted file mode 100644 index 72a75fddb..000000000 --- a/src/layers/1_Schema/Output/types/Field.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { Hybrid } from '../../Hybrid/__.js' -import type { Args } from '../../Input/Args.js' -import type { Output } from '../__.js' - -export type Field<$Name extends string, $Type extends Output.Any, $Args extends Args | null> = { - // todo when generating schema keep track of the unwrapped type too to avoid IDE runtime cost to calculate it - // typeUnwrapped: $NamedType - type: $Type - name: $Name - args: $Args -} - -type FieldType = - | Hybrid.Enum - | Hybrid.Scalar.Scalar - | Hybrid.Scalar.ScalarCodecless - // | Output.__typename - | Output.List - | Output.Nullable - | Output.Object$2 - | Output.Union - | Output.Interface | null>>, [any, ...any[]]> - -// todo test non null interface fields -export type SomeField = Field | null> - -export type SomeFields<$Keys extends SomeKey = SomeKey> = Record<$Keys, SomeField> - -type SomeKey = string | number | symbol diff --git a/src/layers/1_Schema/Output/types/List.ts b/src/layers/1_Schema/Output/types/List.ts deleted file mode 100644 index f486effea..000000000 --- a/src/layers/1_Schema/Output/types/List.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Base, MaybeThunk } from '../../core/helpers.js' -import type { Named } from '../typeGroups.js' -import type { Nullable } from './Nullable.js' - -type InnerType = Named | Nullable | List - -export type List<$Type extends InnerType> = Base.List<$Type> - -export const List = <$Type extends InnerType>(type: MaybeThunk<$Type>): List<$Type> => ({ - kind: `list`, - // at type level "type" is not a thunk - type: type as any, -}) diff --git a/src/layers/1_Schema/Output/types/Nullable.ts b/src/layers/1_Schema/Output/types/Nullable.ts deleted file mode 100644 index 030743e91..000000000 --- a/src/layers/1_Schema/Output/types/Nullable.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Base, MaybeThunk } from '../../core/helpers.js' -import type { Named } from '../typeGroups.js' -import type { __typename } from './__typename.js' -import type { List } from './List.js' - -type InnerType = Named | List - -export type Nullable<$Type extends InnerType> = Base.Nullable<$Type> - -export const Nullable = <$Type extends InnerType>( - type: MaybeThunk<$Type>, -): Nullable<$Type> => ({ - kind: `nullable`, - // at type level "type" is not a thunk - type: type as any, -}) diff --git a/src/layers/1_Schema/Output/types/Object.ts b/src/layers/1_Schema/Output/types/Object.ts deleted file mode 100644 index b9d7aaaee..000000000 --- a/src/layers/1_Schema/Output/types/Object.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { Grafaid } from '../../../../lib/grafaid/__.js' -import type { __typename } from './__typename.js' -import type { Field, SomeFields } from './Field.js' - -export interface ObjectQuery< - $Fields extends SomeFields = SomeFields, -> extends Object$2 {} - -export interface ObjectMutation< - $Fields extends SomeFields = SomeFields, -> extends Object$2 {} - -export interface ObjectSubscription< - $Fields extends SomeFields = SomeFields, -> extends Object$2 {} - -export type RootType = ObjectQuery | ObjectMutation | ObjectSubscription - -export interface Object$2< - $Name extends string = string, - $Fields extends SomeFields = SomeFields, -> { - kind: 'Object' - fields: { - __typename: Field<'__typename', __typename<$Name>, null> - } & $Fields -} diff --git a/src/layers/1_Schema/Output/types/__typename.ts b/src/layers/1_Schema/Output/types/__typename.ts deleted file mode 100644 index 3a7dc3428..000000000 --- a/src/layers/1_Schema/Output/types/__typename.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface __typename<$Type extends string = string> { - kind: 'typename' - type: $Type -} - -export const __typename = <$Type extends string>(type: $Type): __typename<$Type> => ({ kind: `typename`, type }) diff --git a/src/layers/1_Schema/_.ts b/src/layers/1_Schema/_.ts deleted file mode 100644 index 94a17de29..000000000 --- a/src/layers/1_Schema/_.ts +++ /dev/null @@ -1,15 +0,0 @@ -export { type RootTypeName } from './core/helpers.js' -export * from './core/Named/__.js' -export * as Directives from './Directives.js' -export * from './Hybrid/__.js' -export * from './Hybrid/types/Enum.js' -export * from './Hybrid/types/Scalar/__.js' -export * from './Input/__.js' -export * from './Input/Args.js' -export * from './Input/types/InputObject.js' -export * from './Output/__.js' -export * from './Output/types/__typename.js' -export * from './Output/types/Field.js' -export * from './Output/types/Interface.js' -export { type Object$2 } from './Output/types/Object.js' -export * from './Output/types/Union.js' diff --git a/src/layers/1_Schema/core/helpers.ts b/src/layers/1_Schema/core/helpers.ts deleted file mode 100644 index e7f0d3d9c..000000000 --- a/src/layers/1_Schema/core/helpers.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type MaybeThunk<$Type> = $Type | Thunk<$Type> - -export type Thunk<$Type> = () => $Type - -export namespace Base { - export interface Nullable<$Type> { - kind: 'nullable' - type: $Type - } - export interface List<$Type> { - kind: 'list' - type: $Type - } -} - -// todo stop using this, just use the graphql one -export type RootTypeName = 'Query' | 'Mutation' | 'Subscription' diff --git a/src/layers/2_Select/Directive/$types.ts b/src/layers/2_Select/Directive/$types.ts index c3760254e..eae7338a2 100644 --- a/src/layers/2_Select/Directive/$types.ts +++ b/src/layers/2_Select/Directive/$types.ts @@ -1,4 +1,4 @@ -import type { SchemaKit } from '../../1_Schema/__.js' +import type { SchemaKit } from '../../../types/Schema/__.js' import type { Include, Skip } from './_.js' export interface Definition { diff --git a/src/layers/2_Select/Directive/include.ts b/src/layers/2_Select/Directive/include.ts index 697fa697f..076033da3 100644 --- a/src/layers/2_Select/Directive/include.ts +++ b/src/layers/2_Select/Directive/include.ts @@ -1,5 +1,5 @@ import { shallowMergeDefaults } from '../../../lib/prelude.js' -import { SchemaKit } from '../../1_Schema/__.js' +import { SchemaKit } from '../../../types/Schema/__.js' import type { Definition } from './$types.js' export const Include: Definition = { diff --git a/src/layers/2_Select/Directive/skip.ts b/src/layers/2_Select/Directive/skip.ts index 9169a3a2e..04289e323 100644 --- a/src/layers/2_Select/Directive/skip.ts +++ b/src/layers/2_Select/Directive/skip.ts @@ -1,4 +1,4 @@ -import { SchemaKit } from '../../1_Schema/__.js' +import { SchemaKit } from '../../../types/Schema/__.js' import type { Definition } from './$types.js' export const Skip: Definition = { diff --git a/src/layers/3_InferResult/Alias.ts b/src/layers/3_InferResult/Alias.ts index c637e0fa8..129f47b99 100644 --- a/src/layers/3_InferResult/Alias.ts +++ b/src/layers/3_InferResult/Alias.ts @@ -1,6 +1,6 @@ import type { Schema } from '../../generator/generators/Schema.js' import type { mergeObjectArray, ValuesOrEmptyObject } from '../../lib/prelude.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { Select } from '../2_Select/__.js' import type { Field } from './Field.js' @@ -8,7 +8,7 @@ import type { Field } from './Field.js' export type Alias< $SelectionSet, $Schema extends Schema, - $Node extends SchemaKit.Output.Object$2 + $Node extends SchemaKit.OutputObject > = ValuesOrEmptyObject< { @@ -32,7 +32,7 @@ type InferSelectAlias< $SelectAlias extends Select.SelectAlias.SelectAlias, $FieldName extends string, $Schema extends Schema, - $Node extends SchemaKit.Output.Object$2, + $Node extends SchemaKit.OutputObject, > = $SelectAlias extends Select.SelectAlias.SelectAliasOne ? InferSelectAliasOne<$SelectAlias, $FieldName, $Schema, $Node> : $SelectAlias extends Select.SelectAlias.SelectAliasMultiple ? InferSelectAliasMultiple<$SelectAlias, $FieldName, $Schema, $Node> : @@ -42,7 +42,7 @@ type InferSelectAliasMultiple< $SelectAliasMultiple extends Select.SelectAlias.SelectAliasMultiple, $FieldName extends string, $Schema extends Schema, - $Node extends SchemaKit.Output.Object$2, + $Node extends SchemaKit.OutputObject, > = mergeObjectArray< { [_ in keyof $SelectAliasMultiple]: InferSelectAliasOne<$SelectAliasMultiple[_], $FieldName, $Schema, $Node> @@ -53,7 +53,7 @@ type InferSelectAliasOne< $SelectAliasOne extends Select.SelectAlias.SelectAliasOne, $FieldName extends string, $Schema extends Schema, - $Node extends SchemaKit.Output.Object$2, + $Node extends SchemaKit.OutputObject, > = { [_ in $SelectAliasOne[0]]: Field<$SelectAliasOne[1], $Node['fields'][$FieldName], $Schema> } diff --git a/src/layers/3_InferResult/Field.ts b/src/layers/3_InferResult/Field.ts index 735ece6fa..636414872 100644 --- a/src/layers/3_InferResult/Field.ts +++ b/src/layers/3_InferResult/Field.ts @@ -1,7 +1,7 @@ import type { Simplify } from 'type-fest' import type { Schema } from '../../generator/generators/Schema.js' import type { TSErrorDescriptive } from '../../lib/ts-error.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { Select } from '../2_Select/__.js' import type { Interface } from './Interface.js' import type { Object } from './Object.js' @@ -22,19 +22,19 @@ export type Field<$SelectionSet, $Field extends SchemaKit.SomeField, $Schema ext // dprint-ignore type FieldType< $SelectionSet, - $Type extends SchemaKit.Output.Any, + $Type extends SchemaKit.OutputTypes, $Schema extends Schema > = - $Type extends SchemaKit.__typename ? $Value : - $Type extends SchemaKit.Output.Nullable ? null | FieldType<$SelectionSet, $InnerType, $Schema> : - $Type extends SchemaKit.Output.List ? Array> : - $Type extends SchemaKit.Enum ? $Members[number] : - $Type extends SchemaKit.Scalar.Scalar ? ReturnType<$Type['codec']['decode']> : - $Type extends SchemaKit.Scalar.ScalarCodecless ? ReturnType['codec']['decode']> : - $Type extends SchemaKit.Object$2 ? Object<$SelectionSet, $Schema, $Type> : - $Type extends SchemaKit.Interface ? Interface<$SelectionSet, $Schema, $Type> : - $Type extends SchemaKit.Union ? Union<$SelectionSet, $Schema, $Type> : - TSErrorDescriptive<'FieldType', `Unknown type`, { $Type: $Type; $SelectionSet: $SelectionSet; $Schema:$Schema }> + $Type extends SchemaKit.__typename ? $Value : + $Type extends SchemaKit.Nullable ? null | FieldType<$SelectionSet, $InnerType, $Schema> : + $Type extends SchemaKit.List ? Array> : + $Type extends SchemaKit.Enum ? $Members[number] : + $Type extends SchemaKit.Scalar ? ReturnType<$Type['codec']['decode']> : + $Type extends SchemaKit.Scalar.ScalarCodecless ? ReturnType['codec']['decode']> : + $Type extends SchemaKit.OutputObject ? Object<$SelectionSet, $Schema, $Type> : + $Type extends SchemaKit.Interface ? Interface<$SelectionSet, $Schema, $Type> : + $Type extends SchemaKit.Union ? Union<$SelectionSet, $Schema, $Type> : + TSErrorDescriptive<'FieldType', `Unknown type`, { $Type: $Type; $SelectionSet: $SelectionSet; $Schema:$Schema }> // dprint-ignore type GetCodecForCodecless< diff --git a/src/layers/3_InferResult/InlineFragment.ts b/src/layers/3_InferResult/InlineFragment.ts index 957b81955..4062431ba 100644 --- a/src/layers/3_InferResult/InlineFragment.ts +++ b/src/layers/3_InferResult/InlineFragment.ts @@ -1,11 +1,11 @@ import type { Schema } from '../../generator/generators/Schema.js' import { type GetKeyOr } from '../../lib/prelude.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { Select } from '../2_Select/__.js' import type { Object } from './Object.js' // dprint-ignore -export type InlineFragmentTypeConditional<$SelectionSet, $Node extends SchemaKit.Output.Object$2, $Index extends Schema> = +export type InlineFragmentTypeConditional<$SelectionSet, $Node extends SchemaKit.OutputObject, $Index extends Schema> = $Node extends any // force distribution ? Object< & GetKeyOr< diff --git a/src/layers/3_InferResult/Interface.ts b/src/layers/3_InferResult/Interface.ts index 85d6695ef..185b71a85 100644 --- a/src/layers/3_InferResult/Interface.ts +++ b/src/layers/3_InferResult/Interface.ts @@ -1,7 +1,7 @@ import type { Schema } from '../../generator/generators/Schema.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { InlineFragmentTypeConditional } from './InlineFragment.js' // dprint-ignore -export type Interface<$SelectionSet, $Index extends Schema, $Node extends SchemaKit.Output.Interface> = +export type Interface<$SelectionSet, $Index extends Schema, $Node extends SchemaKit.Interface> = InlineFragmentTypeConditional<$SelectionSet, $Node['implementors'][number], $Index> diff --git a/src/layers/3_InferResult/Object.ts b/src/layers/3_InferResult/Object.ts index 203f4aee0..6df0cee22 100644 --- a/src/layers/3_InferResult/Object.ts +++ b/src/layers/3_InferResult/Object.ts @@ -2,14 +2,14 @@ import type { Simplify } from 'type-fest' import type { Schema } from '../../generator/generators/Schema.js' import { type StringKeyof } from '../../lib/prelude.js' import type { TSErrorDescriptive } from '../../lib/ts-error.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { Select } from '../2_Select/__.js' import type { Alias } from './Alias.js' import type { Field } from './Field.js' import type { ScalarsWildcard } from './ScalarsWildcard.js' // dprint-ignore -export type Object<$SelectionSet, $Schema extends Schema, $Node extends SchemaKit.Output.Object$2> = +export type Object<$SelectionSet, $Schema extends Schema, $Node extends SchemaKit.OutputObject> = Select.SelectScalarsWildcard.IsSelectScalarsWildcard<$SelectionSet> extends true // todo what about when scalars wildcard is combined with other fields like relations? ? ScalarsWildcard<$SelectionSet, $Schema,$Node> @@ -20,7 +20,7 @@ export type Object<$SelectionSet, $Schema extends Schema, $Node extends SchemaKi > // dprint-ignore -type SelectionNonSelectAlias<$SelectionSet , $Schema extends Schema, $SchemaNode extends SchemaKit.Output.Object$2> = +type SelectionNonSelectAlias<$SelectionSet , $Schema extends Schema, $SchemaNode extends SchemaKit.OutputObject> = { [$Key in PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet>]: $Key extends keyof $SchemaNode['fields'] @@ -30,7 +30,7 @@ type SelectionNonSelectAlias<$SelectionSet , $Schema extends Schema, $SchemaNode // dprint-ignore export namespace Errors { - export type UnknownFieldName<$FieldName extends string, $Object extends SchemaKit.Object$2 | SchemaKit.Output.RootType> = + export type UnknownFieldName<$FieldName extends string, $Object extends SchemaKit.RootType | SchemaKit.OutputObject> = TSErrorDescriptive<'Object', `field "${$FieldName}" does not exist on object "${$Object['fields']['__typename']['type']['type']}"`> } diff --git a/src/layers/3_InferResult/ScalarsWildcard.ts b/src/layers/3_InferResult/ScalarsWildcard.ts index da530c107..6042e8b84 100644 --- a/src/layers/3_InferResult/ScalarsWildcard.ts +++ b/src/layers/3_InferResult/ScalarsWildcard.ts @@ -1,27 +1,21 @@ import type { Schema } from '../../generator/generators/Schema.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { Field } from './Field.js' export type ScalarsWildcard< $SelectionSet, $Index extends Schema, - $Node extends SchemaKit.Output.Object$2, + $Node extends SchemaKit.OutputObject, > = { [$Key in keyof PickScalarFields<$Node>]: Field<$SelectionSet, $Node['fields'][$Key], $Index> } // dprint-ignore -type PickScalarFields<$Object extends SchemaKit.Output.Object$2> = { +type PickScalarFields<$Object extends SchemaKit.OutputObject> = { [ $Key in keyof $Object['fields'] - as SchemaKit.Output.UnwrapToNamed<$Object['fields'][$Key]['type']> extends ScalarLikeNode + as SchemaKit.GetNamedType<$Object['fields'][$Key]['type']> extends SchemaKit.ScalarLikeTypes ? $Key : never ]: $Object['fields'][$Key] } - -type ScalarLikeNode = - | SchemaKit.Hybrid.Scalar.ScalarCodecless - | SchemaKit.Hybrid.Scalar.Scalar - | SchemaKit.Output.__typename - | SchemaKit.Hybrid.Enum diff --git a/src/layers/3_InferResult/Union.ts b/src/layers/3_InferResult/Union.ts index fd6ca2b98..6821084c0 100644 --- a/src/layers/3_InferResult/Union.ts +++ b/src/layers/3_InferResult/Union.ts @@ -1,7 +1,7 @@ import type { Schema } from '../../generator/generators/Schema.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { InlineFragmentTypeConditional } from './InlineFragment.js' // dprint-ignore -export type Union<$SelectionSet, $Index extends Schema, $Node extends SchemaKit.Output.Union> = - InlineFragmentTypeConditional<$SelectionSet, $Node['members'][number], $Index> +export type Union<$SelectionSet, $Index extends Schema, $Type extends SchemaKit.Union> = + InlineFragmentTypeConditional<$SelectionSet, $Type['members'][number], $Index> diff --git a/src/layers/3_InferResult/root.ts b/src/layers/3_InferResult/root.ts index 1cc7ffd28..cbd71f317 100644 --- a/src/layers/3_InferResult/root.ts +++ b/src/layers/3_InferResult/root.ts @@ -1,12 +1,13 @@ import type { Schema } from '../../generator/generators/Schema.js' +import type { Grafaid } from '../../lib/grafaid/__.js' import { type ExcludeNull } from '../../lib/prelude.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { Object } from './Object.js' export type RootViaObject< $SelectionSet, $Schema extends Schema, - $RootType extends SchemaKit.Output.RootType, + $RootType extends SchemaKit.RootType, > = Root< $SelectionSet, $Schema, @@ -28,5 +29,5 @@ export type Subscription<$SelectionSet, $Schema extends Schema> = export type Root< $SelectionSet, $Schema extends Schema, - $RootTypeName extends SchemaKit.RootTypeName, + $RootTypeName extends Grafaid.Schema.RootTypeName, > = Object<$SelectionSet, $Schema, ExcludeNull<$Schema['Root'][$RootTypeName]>> diff --git a/src/layers/3_SelectGraphQLMapper/context.ts b/src/layers/3_SelectGraphQLMapper/context.ts index aee9de724..ba3aad6ef 100644 --- a/src/layers/3_SelectGraphQLMapper/context.ts +++ b/src/layers/3_SelectGraphQLMapper/context.ts @@ -1,13 +1,13 @@ import type { Grafaid } from '../../lib/grafaid/__.js' import { Nodes } from '../../lib/grafaid/_Nodes.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js' -import type { SchemaKit } from '../1_Schema/__.js' import { inferVariableType } from './inferVariableType.js' import type { Options } from './nodes/1_Document.js' export interface OperationContext { sddm?: SchemaDrivenDataMap - scalars: SchemaKit.Hybrid.Scalar.ScalarMap + scalars: SchemaKit.Scalar.ScalarMap variables: { /** * Should variables be used for arguments? diff --git a/src/layers/3_SelectGraphQLMapper/nodes/1_Document.ts b/src/layers/3_SelectGraphQLMapper/nodes/1_Document.ts index ed26086e4..b57bebf38 100644 --- a/src/layers/3_SelectGraphQLMapper/nodes/1_Document.ts +++ b/src/layers/3_SelectGraphQLMapper/nodes/1_Document.ts @@ -34,7 +34,7 @@ export const toGraphQLDocument = ( export interface Options { sddm?: SchemaDrivenDataMap | null - scalars?: SchemaKit.Hybrid.Scalar.ScalarMap + scalars?: SchemaKit.Scalar.ScalarMap operationVariables?: boolean } diff --git a/src/layers/3_SelectGraphQLMapper/nodes/Value.ts b/src/layers/3_SelectGraphQLMapper/nodes/Value.ts index e72011d65..70d661f4b 100644 --- a/src/layers/3_SelectGraphQLMapper/nodes/Value.ts +++ b/src/layers/3_SelectGraphQLMapper/nodes/Value.ts @@ -1,8 +1,7 @@ import type { Grafaid } from '../../../lib/grafaid/__.js' import { Nodes } from '../../../lib/grafaid/_Nodes.js' +import { SchemaKit } from '../../../types/Schema/__.js' import { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js' -import type { Scalar } from '../../1_Schema/_.js' -import { SchemaKit } from '../../1_Schema/__.js' import type { OperationContext } from '../context.js' import { type GraphQLPostOperationMapper } from '../mapper.js' @@ -14,7 +13,7 @@ export const toGraphQLValue: ValueMapper = (context, sddm, value) => { if (SchemaDrivenDataMap.isScalarLike(sddm?.nt)) { const scalar = SchemaDrivenDataMap.isScalar(sddm.nt) ? sddm.nt - : SchemaKit.Hybrid.Scalar.lookupCustomScalarOrFallbackToString(context.scalars, sddm.nt) + : SchemaKit.Scalar.lookupCustomScalarOrFallbackToString(context.scalars, sddm.nt) return applyScalar(context, scalar, value) } @@ -83,7 +82,7 @@ interface AdditionalContext { const applyScalar = ( context: OperationContext & AdditionalContext, - scalar: Scalar.Scalar, + scalar: SchemaKit.Scalar, value: unknown, ): Grafaid.Document.ValueNode => { if (value === null) return Nodes.NullValue() diff --git a/src/layers/3_SelectGraphQLMapper/toGraphQL.test.ts b/src/layers/3_SelectGraphQLMapper/toGraphQL.test.ts index 610b498b0..0e40d1cc6 100644 --- a/src/layers/3_SelectGraphQLMapper/toGraphQL.test.ts +++ b/src/layers/3_SelectGraphQLMapper/toGraphQL.test.ts @@ -4,7 +4,7 @@ import { db } from '../../../tests/_/schemas/db.js' import { schemaDrivenDataMap } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaDrivenDataMap.js' import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' import { Grafaid } from '../../lib/grafaid/__.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import { Select } from '../2_Select/__.js' import { toGraphQLDocument } from './nodes/1_Document.js' @@ -22,7 +22,7 @@ type CasesDescriptiveQueryWithCustomScalars = [ ] const testEachQueryWithDescriptionWithCustomScalars = test.for.bind(test) -const tester = <$Scalars extends SchemaKit.Hybrid.Scalar.ScalarMap>( +const tester = <$Scalars extends SchemaKit.Scalar.ScalarMap>( input: { variables: boolean; scalars: $Scalars }, ) => { // dprint-ignore diff --git a/src/layers/6_client/fluent.ts b/src/layers/6_client/fluent.ts index 2e544c660..a0b02770e 100644 --- a/src/layers/6_client/fluent.ts +++ b/src/layers/6_client/fluent.ts @@ -1,6 +1,6 @@ import type { Anyware } from '../../lib/anyware/__.js' import type { Fluent } from '../../lib/fluent/__.js' -import type { SchemaKit } from '../1_Schema/__.js' +import type { SchemaKit } from '../../types/Schema/__.js' import type { RequestCore } from '../5_request/__.js' import type { Extension } from './extension/extension.js' import type { Config } from './Settings/Config.js' @@ -55,7 +55,7 @@ export interface ClientContext { scalars: RegisteredScalars } -export type RegisteredScalars = Record +export type RegisteredScalars = Record export const createState = (stateWithoutConfig: StateWithoutConfig): ClientContext => { let config: Config | null diff --git a/src/layers/6_client/properties/scalar.ts b/src/layers/6_client/properties/scalar.ts index 94970eb6d..8a302aa1d 100644 --- a/src/layers/6_client/properties/scalar.ts +++ b/src/layers/6_client/properties/scalar.ts @@ -1,6 +1,6 @@ import type { ConfigManager } from '../../../lib/config-manager/__.js' import type { Fluent } from '../../../lib/fluent/__.js' -import type { SchemaKit } from '../../1_Schema/__.js' +import type { SchemaKit } from '../../../types/Schema/__.js' import { type ClientContext, defineProperties, type FnParametersProperty } from '../fluent.js' export interface ScalarFn extends Fluent.FnProperty<`scalar`> { @@ -25,7 +25,7 @@ export interface Scalar<$Args extends FnParametersProperty> { export const scalarProperties = defineProperties((builder, state) => { return { - scalar: (scalar: SchemaKit.Scalar.Scalar) => { + scalar: (scalar: SchemaKit.Scalar) => { return builder({ ...state, scalars: { diff --git a/src/types/Schema/Directive.ts b/src/types/Schema/Directive.ts new file mode 100644 index 000000000..1984b9e59 --- /dev/null +++ b/src/types/Schema/Directive.ts @@ -0,0 +1,16 @@ +import type { Scalar } from './_.js' +import { IncludeDirective } from './directives/Include.js' +import { SkipDirective } from './directives/Skip.js' + +export interface Directive { + name: string + arguments: Record +} + +export const standardDirectivesByName = { + include: IncludeDirective, + skip: SkipDirective, +} diff --git a/src/layers/1_Schema/core/Named/NamedType.test-d.ts b/src/types/Schema/Named/NamedType.test-d.ts similarity index 100% rename from src/layers/1_Schema/core/Named/NamedType.test-d.ts rename to src/types/Schema/Named/NamedType.test-d.ts diff --git a/src/layers/1_Schema/core/Named/NamedType.ts b/src/types/Schema/Named/NamedType.ts similarity index 92% rename from src/layers/1_Schema/core/Named/NamedType.ts rename to src/types/Schema/Named/NamedType.ts index 7c862a21d..628edb952 100644 --- a/src/layers/1_Schema/core/Named/NamedType.ts +++ b/src/types/Schema/Named/NamedType.ts @@ -1,4 +1,4 @@ -import type { Digit, Letter } from '../../../../lib/prelude.js' +import type { Digit, Letter } from '../../../lib/prelude.js' /** * @see http://spec.graphql.org/draft/#sec-Names diff --git a/src/layers/1_Schema/core/Named/_.ts b/src/types/Schema/Named/_.ts similarity index 100% rename from src/layers/1_Schema/core/Named/_.ts rename to src/types/Schema/Named/_.ts diff --git a/src/layers/1_Schema/core/Named/__.ts b/src/types/Schema/Named/__.ts similarity index 100% rename from src/layers/1_Schema/core/Named/__.ts rename to src/types/Schema/Named/__.ts diff --git a/src/types/Schema/_.ts b/src/types/Schema/_.ts new file mode 100644 index 000000000..1640bef4a --- /dev/null +++ b/src/types/Schema/_.ts @@ -0,0 +1,17 @@ +export * as Directives from './Directive.js' +export * from './helpers.js' +export * from './Named/__.js' +export * from './typeGroups.js' +export * from './types/__typename.js' +export * from './types/Args.js' +export * from './types/Enum.js' +export * from './types/InputField.js' +export * from './types/InputObject.js' +export * from './types/Interface.js' +export * from './types/List.js' +export * from './types/Nullable.js' +export * from './types/OutputField.js' +export { type OutputObject } from './types/OutputObject.js' +export * from './types/Scalar/Scalar.js' +export * from './types/Union.js' +export * from './typeTypes.js' diff --git a/src/layers/1_Schema/__.ts b/src/types/Schema/__.ts similarity index 61% rename from src/layers/1_Schema/__.ts rename to src/types/Schema/__.ts index 14197dace..4d0ae6897 100644 --- a/src/layers/1_Schema/__.ts +++ b/src/types/Schema/__.ts @@ -1,2 +1 @@ export * as SchemaKit from './_.js' -export * from './_.js' diff --git a/src/types/Schema/directives/Include.ts b/src/types/Schema/directives/Include.ts new file mode 100644 index 000000000..2b4205bd3 --- /dev/null +++ b/src/types/Schema/directives/Include.ts @@ -0,0 +1,12 @@ +import type { Directive } from '../Directive.js' +import { Scalar } from '../types/Scalar/Scalar.js' + +export const IncludeDirective: Directive = { + name: `include`, + arguments: { + if: { + name: `if`, + type: Scalar.Boolean, + }, + }, +} diff --git a/src/types/Schema/directives/Skip.ts b/src/types/Schema/directives/Skip.ts new file mode 100644 index 000000000..c3c4926bc --- /dev/null +++ b/src/types/Schema/directives/Skip.ts @@ -0,0 +1,12 @@ +import type { Directive } from '../Directive.js' +import { Scalar } from '../types/Scalar/Scalar.js' + +export const SkipDirective: Directive = { + name: `skip`, + arguments: { + if: { + name: `if`, + type: Scalar.Boolean, + }, + }, +} diff --git a/src/types/Schema/helpers.ts b/src/types/Schema/helpers.ts new file mode 100644 index 000000000..4a9a0e345 --- /dev/null +++ b/src/types/Schema/helpers.ts @@ -0,0 +1,14 @@ +import type { TSErrorDescriptive } from '../../lib/ts-error.js' +import type { NamedTypes } from './typeGroups.js' +import type { __typename } from './types/__typename.js' +import type { List } from './types/List.js' +import type { Nullable } from './types/Nullable.js' + +// todo extends any because of infinite depth issue in generated schema types +// dprint-ignore +export type GetNamedType<$Type> = + $Type extends List ? GetNamedType<$innerType> : + $Type extends Nullable ? GetNamedType<$innerType> : + $Type extends __typename ? $Type : + $Type extends NamedTypes ? $Type : + TSErrorDescriptive<'Unwrap', 'Unknown $Type', { $Type: $Type }> diff --git a/src/types/Schema/typeGroups.ts b/src/types/Schema/typeGroups.ts new file mode 100644 index 000000000..8c38cce02 --- /dev/null +++ b/src/types/Schema/typeGroups.ts @@ -0,0 +1,40 @@ +import type { InputObject } from './_.js' +import type { __typename } from './types/__typename.js' +import type { Enum } from './types/Enum.js' +import type { Interface } from './types/Interface.js' +import type { List } from './types/List.js' +import type { Nullable } from './types/Nullable.js' +import type { OutputObject } from './types/OutputObject.js' +import type { Scalar } from './types/Scalar/Scalar.js' +import type { Union } from './types/Union.js' + +export type NamedTypes = NamedInputTypes | NamedOutputTypes + +export type OutputTypes = + | InlineTypes + | NamedOutputTypes + | __typename + +export type NamedOutputTypes = + | Interface + | Enum + | OutputObject + | Union + | Scalar + | Scalar.ScalarCodecless + +export type InputTypes = + | InlineTypes + | NamedInputTypes + +export type NamedInputTypes = Enum | Scalar | InputObject | Scalar.ScalarCodecless + +export type InlineTypes = + | List + | Nullable + +export type ScalarLikeTypes = + | Scalar + | Enum + | Scalar.ScalarCodecless + | __typename diff --git a/src/types/Schema/typeTypes.ts b/src/types/Schema/typeTypes.ts new file mode 100644 index 000000000..47dde29b6 --- /dev/null +++ b/src/types/Schema/typeTypes.ts @@ -0,0 +1,16 @@ +import type { Grafaid } from '../../lib/grafaid/__.js' +import type { OutputObject, SomeFields } from './_.js' + +export interface ObjectQuery< + $Fields extends SomeFields = SomeFields, +> extends OutputObject {} + +export interface ObjectMutation< + $Fields extends SomeFields = SomeFields, +> extends OutputObject {} + +export interface ObjectSubscription< + $Fields extends SomeFields = SomeFields, +> extends OutputObject {} + +export type RootType = ObjectQuery | ObjectMutation | ObjectSubscription diff --git a/src/layers/1_Schema/Input/Args.ts b/src/types/Schema/types/Args.ts similarity index 100% rename from src/layers/1_Schema/Input/Args.ts rename to src/types/Schema/types/Args.ts diff --git a/src/layers/1_Schema/Hybrid/types/Enum.ts b/src/types/Schema/types/Enum.ts similarity index 100% rename from src/layers/1_Schema/Hybrid/types/Enum.ts rename to src/types/Schema/types/Enum.ts diff --git a/src/types/Schema/types/InputField.ts b/src/types/Schema/types/InputField.ts new file mode 100644 index 000000000..51248270b --- /dev/null +++ b/src/types/Schema/types/InputField.ts @@ -0,0 +1,9 @@ +import type { InputTypes } from '../typeGroups.js' + +export interface InputField< + $Type extends InputTypes, +> // $NamedType extends NamedOutputTypes, +{ + type: $Type + // namedType: $NamedType +} diff --git a/src/layers/1_Schema/Input/types/InputObject.ts b/src/types/Schema/types/InputObject.ts similarity index 100% rename from src/layers/1_Schema/Input/types/InputObject.ts rename to src/types/Schema/types/InputObject.ts diff --git a/src/layers/1_Schema/Output/types/Interface.ts b/src/types/Schema/types/Interface.ts similarity index 59% rename from src/layers/1_Schema/Output/types/Interface.ts rename to src/types/Schema/types/Interface.ts index 130990e4a..d86266d5d 100644 --- a/src/layers/1_Schema/Output/types/Interface.ts +++ b/src/types/Schema/types/Interface.ts @@ -1,10 +1,10 @@ -import type { Object$2 } from './Object.js' +import type { OutputObject } from './OutputObject.js' export type Interface< $Name extends string = string, // $Fields extends SomeFields = SomeFields, $Fields extends any = any, - $Implementors extends [Object$2, ...Object$2[]] = [Object$2, ...Object$2[]], + $Implementors extends [OutputObject, ...OutputObject[]] = [OutputObject, ...OutputObject[]], > = { kind: 'Interface' name: $Name diff --git a/src/types/Schema/types/List.ts b/src/types/Schema/types/List.ts new file mode 100644 index 000000000..2bb097a0f --- /dev/null +++ b/src/types/Schema/types/List.ts @@ -0,0 +1,4 @@ +export interface List<$Type = any> { + kind: 'list' + type: $Type +} diff --git a/src/types/Schema/types/Nullable.ts b/src/types/Schema/types/Nullable.ts new file mode 100644 index 000000000..37b3ac908 --- /dev/null +++ b/src/types/Schema/types/Nullable.ts @@ -0,0 +1,4 @@ +export interface Nullable<$Type = any> { + kind: 'nullable' + type: $Type +} diff --git a/src/types/Schema/types/OutputField.ts b/src/types/Schema/types/OutputField.ts new file mode 100644 index 000000000..899921b93 --- /dev/null +++ b/src/types/Schema/types/OutputField.ts @@ -0,0 +1,39 @@ +import type { Scalar } from '../_.js' +import type { OutputTypes } from '../typeGroups.js' +import type { Args } from './Args.js' +import type { Enum } from './Enum.js' +import type { Interface } from './Interface.js' +import type { List } from './List.js' +import type { Nullable } from './Nullable.js' +import type { OutputObject } from './OutputObject.js' +import type { ScalarCodecless } from './Scalar/_.js' +import type { Union } from './Union.js' + +export type Field< + $Name extends string, + $Type extends OutputTypes, + $Args extends Args | null, +> // $NamedType extends NamedOutputTypes, + = { + name: $Name + args: $Args + type: $Type + // namedType: $NamedType +} + +type FieldType = + | Enum + | Scalar + | ScalarCodecless + | List + | Nullable + | OutputObject + | Union + | Interface | null>>, [any, ...any[]]> + +// todo test non null interface fields +export type SomeField = Field | null> + +export type SomeFields<$Keys extends SomeKey = SomeKey> = Record<$Keys, SomeField> + +type SomeKey = string | number | symbol diff --git a/src/types/Schema/types/OutputObject.ts b/src/types/Schema/types/OutputObject.ts new file mode 100644 index 000000000..8d9789965 --- /dev/null +++ b/src/types/Schema/types/OutputObject.ts @@ -0,0 +1,12 @@ +import type { __typename } from './__typename.js' +import type { Field, SomeFields } from './OutputField.js' + +export interface OutputObject< + $Name extends string = string, + $Fields extends SomeFields = SomeFields, +> { + kind: 'Object' + fields: { + __typename: Field<'__typename', __typename<$Name>, null> + } & $Fields +} diff --git a/src/layers/1_Schema/Hybrid/types/Scalar/nativeScalarCodecs.ts b/src/types/Schema/types/Scalar/JavaScriptScalarCodecs.ts similarity index 100% rename from src/layers/1_Schema/Hybrid/types/Scalar/nativeScalarCodecs.ts rename to src/types/Schema/types/Scalar/JavaScriptScalarCodecs.ts diff --git a/src/types/Schema/types/Scalar/Scalar.ts b/src/types/Schema/types/Scalar/Scalar.ts new file mode 100644 index 000000000..ed233d832 --- /dev/null +++ b/src/types/Schema/types/Scalar/Scalar.ts @@ -0,0 +1,14 @@ +import type { Grafaid } from '../../../../lib/grafaid/__.js' +import type { Codec } from './codec.js' + +export * as Scalar from './_.js' + +export interface Scalar< + $Name extends string = string, + $Decoded = unknown, + $Encoded extends Grafaid.Schema.StandardScalarRuntimeTypes = Grafaid.Schema.StandardScalarRuntimeTypes, +> { + kind: 'Scalar' + name: $Name + codec: Codec<$Decoded, $Encoded> +} diff --git a/src/types/Schema/types/Scalar/ScalarCodecless.ts b/src/types/Schema/types/Scalar/ScalarCodecless.ts new file mode 100644 index 000000000..3aed3c710 --- /dev/null +++ b/src/types/Schema/types/Scalar/ScalarCodecless.ts @@ -0,0 +1,6 @@ +export interface ScalarCodecless< + $Name extends string = string, +> { + kind: 'ScalarCodecless' + name: $Name +} diff --git a/src/types/Schema/types/Scalar/_.ts b/src/types/Schema/types/Scalar/_.ts new file mode 100644 index 000000000..ec5d2aea0 --- /dev/null +++ b/src/types/Schema/types/Scalar/_.ts @@ -0,0 +1,5 @@ +export * from './create.js' +export * from './helpers.js' +export * from './JavaScriptScalarCodecs.js' +export * from './ScalarCodecless.js' +export * from './scalars.js' diff --git a/src/layers/1_Schema/Hybrid/types/Scalar/codec.ts b/src/types/Schema/types/Scalar/codec.ts similarity index 89% rename from src/layers/1_Schema/Hybrid/types/Scalar/codec.ts rename to src/types/Schema/types/Scalar/codec.ts index 803b2a3b9..47c37d38a 100644 --- a/src/layers/1_Schema/Hybrid/types/Scalar/codec.ts +++ b/src/types/Schema/types/Scalar/codec.ts @@ -1,4 +1,4 @@ -import type { Grafaid } from '../../../../../lib/grafaid/__.js' +import type { Grafaid } from '../../../../lib/grafaid/__.js' export type Codec< $Decoded = any, diff --git a/src/types/Schema/types/Scalar/create.ts b/src/types/Schema/types/Scalar/create.ts new file mode 100644 index 000000000..b53870d5b --- /dev/null +++ b/src/types/Schema/types/Scalar/create.ts @@ -0,0 +1,14 @@ +import type { Grafaid } from '../../../../lib/grafaid/__.js' +import type { Scalar } from './Scalar.js' + +export const create = <$Name extends string, $Decoded, $Encoded extends Grafaid.Schema.StandardScalarRuntimeTypes>( + name: $Name, + codec: { + encode: (value: $Decoded) => $Encoded + decode: (value: $Encoded) => $Decoded + }, +): Scalar<$Name, $Decoded, $Encoded> => ({ + kind: `Scalar`, + name: name, + codec: codec as any, +}) diff --git a/src/types/Schema/types/Scalar/helpers.ts b/src/types/Schema/types/Scalar/helpers.ts new file mode 100644 index 000000000..cf4db218d --- /dev/null +++ b/src/types/Schema/types/Scalar/helpers.ts @@ -0,0 +1,45 @@ +import type { Mapper } from './codec.js' +import type { Scalar } from './Scalar.js' +import { String } from './scalars.js' + +export type GetEncoded<$Scalar> = $Scalar extends Scalar ? $Encoded : never + +export type GetDecoded<$Scalar> = $Scalar extends Scalar ? $Decoded + : never + +export type ScalarMap = Record + +// dprint-ignore +export type LookupCustomScalarOrFallbackToString<$Name extends string, $Scalars extends ScalarMap> = + $Name extends keyof $Scalars ? $Scalars[$Name] : String + +export const lookupCustomScalarOrFallbackToString = (scalars: ScalarMap, name: string): Scalar => { + const scalar = scalars[name] + if (scalar) return scalar + return String +} + +/** + * Apply a codec's mapper function (decode or encode) to a GraphQL value. + * + * If value is an array then its members are traversed recursively. + * + * Null values are returned as is. + */ +export const applyCodec = <$Mapper extends Mapper>( + mapper: $Mapper, + value: any, +): null | ReturnType<$Mapper> | ReturnType<$Mapper>[] => { + if (value === null) { + return null + } + + if (Array.isArray(value)) { + return value.map(item => applyCodec(mapper, item)) as ReturnType<$Mapper> + } + + return mapper(value) as ReturnType<$Mapper> +} + +export const isScalar = (value: unknown): value is Scalar => + typeof value === `object` && value !== null && `codec` in value && typeof value.codec === `object` diff --git a/src/types/Schema/types/Scalar/scalars.ts b/src/types/Schema/types/Scalar/scalars.ts new file mode 100644 index 000000000..7558cbe76 --- /dev/null +++ b/src/types/Schema/types/Scalar/scalars.ts @@ -0,0 +1,22 @@ +import { create } from './create.js' +import { JavaScriptScalarCodecs } from './JavaScriptScalarCodecs.js' + +export const String = create(`String`, JavaScriptScalarCodecs.String) + +export const ID = create(`ID`, JavaScriptScalarCodecs.String) + +export const Int = create(`Int`, JavaScriptScalarCodecs.Number) + +export const Float = create(`Float`, JavaScriptScalarCodecs.Number) + +export const Boolean = create(`Boolean`, JavaScriptScalarCodecs.Boolean) + +export type ID = typeof ID + +export type String = typeof String + +export type Int = typeof Int + +export type Boolean = typeof Boolean + +export type Float = typeof Float diff --git a/src/layers/1_Schema/Output/types/Union.ts b/src/types/Schema/types/Union.ts similarity index 57% rename from src/layers/1_Schema/Output/types/Union.ts rename to src/types/Schema/types/Union.ts index 4e9e315ef..a572b4ad8 100644 --- a/src/layers/1_Schema/Output/types/Union.ts +++ b/src/types/Schema/types/Union.ts @@ -1,8 +1,8 @@ -import type { Object$2 } from './Object.js' +import type { OutputObject } from './OutputObject.js' export type Union< $Name extends string = string, - $Members extends [Object$2, ...Object$2[]] = [Object$2, ...Object$2[]], + $Members extends [OutputObject, ...OutputObject[]] = [OutputObject, ...OutputObject[]], > = { kind: `Union` name: $Name @@ -11,7 +11,7 @@ export type Union< export const Union = < $Name extends string, - $Members extends [Object$2, ...Object$2[]], + $Members extends [OutputObject, ...OutputObject[]], >( name: $Name, members: $Members, diff --git a/src/types/Schema/types/__typename.ts b/src/types/Schema/types/__typename.ts new file mode 100644 index 000000000..6a00bd8d8 --- /dev/null +++ b/src/types/Schema/types/__typename.ts @@ -0,0 +1,4 @@ +export interface __typename<$TypeName extends string = string> { + kind: 'typename' + type: $TypeName +} diff --git a/src/types/SchemaDrivenDataMap/SchemaDrivenDataMap.ts b/src/types/SchemaDrivenDataMap/SchemaDrivenDataMap.ts index 6aa16b608..abcacff99 100644 --- a/src/types/SchemaDrivenDataMap/SchemaDrivenDataMap.ts +++ b/src/types/SchemaDrivenDataMap/SchemaDrivenDataMap.ts @@ -1,6 +1,6 @@ -import { Scalar, type Scalar as SchemaScalar } from '../../layers/1_Schema/_.js' import type { Grafaid } from '../../lib/grafaid/__.js' import { isString } from '../../lib/prelude.js' +import { SchemaKit } from '../Schema/__.js' declare global { namespace GraffleGlobal { @@ -98,7 +98,7 @@ export type Enum = GraffleGlobal.SchemaDrivenDataMap.Enum export type ArgumentsOrInputObjectFields = GraffleGlobal.SchemaDrivenDataMap.ArgumentsOrInputObjectFields -export type Scalar = SchemaScalar.Scalar +export type Scalar = SchemaKit.Scalar export type CustomScalarName = string @@ -136,9 +136,10 @@ export const isEnum = ( export const isCustomScalarName = (value: unknown): value is CustomScalarName => isString(value) -export const isScalar = Scalar.isScalar +export const isScalar = SchemaKit.Scalar.isScalar -export const isScalarLike = (value: unknown): value is ScalarLike => Scalar.isScalar(value) || isCustomScalarName(value) +export const isScalarLike = (value: unknown): value is ScalarLike => + SchemaKit.Scalar.isScalar(value) || isCustomScalarName(value) export const isOutputObject = ( node?: Node, @@ -169,9 +170,9 @@ export const isOutputField = ( export type NamedLike = ScalarLike | OutputObject | Enum | InputObject -export type OutputLike = SchemaScalar.Scalar | OutputObject | Enum | CustomScalarName +export type OutputLike = Scalar | OutputObject | Enum | CustomScalarName -export type ScalarLike = SchemaScalar.Scalar | CustomScalarName +export type ScalarLike = Scalar | CustomScalarName export type InputLike = ScalarLike | InputObject | Enum diff --git a/tests/_/schemas/generate.ts b/tests/_/schemas/generate.ts index 31bec7b44..0980d18db 100644 --- a/tests/_/schemas/generate.ts +++ b/tests/_/schemas/generate.ts @@ -25,7 +25,7 @@ const generate = async ( libraryPaths: { client: `../../../src/entrypoints/client.ts`, schema: `../../../src/entrypoints/schema.ts`, - scalars: `../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.ts`, + scalars: `../../../src/types/Schema/types/Scalar/scalars.ts`, utilitiesForGenerated: `../../../src/entrypoints/utilities-for-generated.ts`, }, ...input.input, diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts index cfba77a10..cfdb373d2 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts @@ -1,6 +1,6 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../../../src/types/Schema/types/Scalar/scalars.js' // // diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts index ab3428e8a..560635b8b 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts @@ -1,6 +1,8 @@ -import type * as $ from '../../../../../../src/entrypoints/schema.js' +import type { SchemaKit as $ } from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -18,164 +20,160 @@ export namespace Schema { // // - export type Mutation = $.Output.ObjectMutation<{ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Mutation = $.ObjectMutation<{ + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> }> - export type Query = $.Output.ObjectQuery<{ + export type Query = $.ObjectQuery<{ InputObjectNested: $.Field< 'InputObjectNested', - $.Output.Nullable<$Scalar.ID>, + $.Nullable<$Scalar.ID>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > InputObjectNestedNonNull: $.Field< 'InputObjectNestedNonNull', - $.Output.Nullable<$Scalar.ID>, + $.Nullable<$Scalar.ID>, $.Args<{ - input: $.Input.Field + input: $.InputField }, false> > /** * Query enum field documentation. */ - abcEnum: $.Field<'abcEnum', $.Output.Nullable, null> + abcEnum: $.Field<'abcEnum', $.Nullable, null> argInputObjectCircular: $.Field< 'argInputObjectCircular', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > - date: $.Field<'date', $.Output.Nullable<$Scalar.Date>, null> + date: $.Field<'date', $.Nullable<$Scalar.Date>, null> dateArg: $.Field< 'dateArg', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> + date: $.InputField<$.Nullable<$Scalar.Date>> }, true> > dateArgInputObject: $.Field< 'dateArgInputObject', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > dateArgList: $.Field< 'dateArgList', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.Nullable<$.Input.List<$Scalar.Date>>> + date: $.InputField<$.Nullable<$.List<$Scalar.Date>>> }, true> > dateArgNonNull: $.Field< 'dateArgNonNull', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$Scalar.Date> + date: $.InputField<$Scalar.Date> }, false> > dateArgNonNullList: $.Field< 'dateArgNonNullList', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.List<$.Input.Nullable<$Scalar.Date>>> + date: $.InputField<$.List<$.Nullable<$Scalar.Date>>> }, false> > dateArgNonNullListNonNull: $.Field< 'dateArgNonNullListNonNull', - $.Output.Nullable<$Scalar.Date>, + $.Nullable<$Scalar.Date>, $.Args<{ - date: $.Input.Field<$.Input.List<$Scalar.Date>> + date: $.InputField<$.List<$Scalar.Date>> }, false> > - dateInterface1: $.Field<'dateInterface1', $.Output.Nullable, null> - dateList: $.Field<'dateList', $.Output.Nullable<$.Output.List<$Scalar.Date>>, null> - dateListList: $.Field<'dateListList', $.Output.Nullable<$.Output.List<$.Output.List<$Scalar.Date>>>, null> - dateListNonNull: $.Field<'dateListNonNull', $.Output.List<$Scalar.Date>, null> + dateInterface1: $.Field<'dateInterface1', $.Nullable, null> + dateList: $.Field<'dateList', $.Nullable<$.List<$Scalar.Date>>, null> + dateListList: $.Field<'dateListList', $.Nullable<$.List<$.List<$Scalar.Date>>>, null> + dateListNonNull: $.Field<'dateListNonNull', $.List<$Scalar.Date>, null> dateNonNull: $.Field<'dateNonNull', $Scalar.Date, null> - dateObject1: $.Field<'dateObject1', $.Output.Nullable, null> - dateUnion: $.Field<'dateUnion', $.Output.Nullable, null> + dateObject1: $.Field<'dateObject1', $.Nullable, null> + dateUnion: $.Field<'dateUnion', $.Nullable, null> error: $.Field< 'error', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - case: $.Input.Field<$.Input.Nullable<$Scalar.String>> + case: $.InputField<$.Nullable<$Scalar.String>> }, true> > - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> - interface: $.Field<'interface', $.Output.Nullable, null> + interface: $.Field<'interface', $.Nullable, null> interfaceNonNull: $.Field<'interfaceNonNull', Interface, null> interfaceWithArgs: $.Field< 'interfaceWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - id: $.Input.Field<$Scalar.ID> + id: $.InputField<$Scalar.ID> }, false> > - listInt: $.Field<'listInt', $.Output.Nullable<$.Output.List<$.Output.Nullable<$Scalar.Int>>>, null> - listIntNonNull: $.Field<'listIntNonNull', $.Output.List<$Scalar.Int>, null> - listListInt: $.Field< - 'listListInt', - $.Output.Nullable<$.Output.List<$.Output.Nullable<$.Output.List<$.Output.Nullable<$Scalar.Int>>>>>, - null - > - listListIntNonNull: $.Field<'listListIntNonNull', $.Output.List<$.Output.List<$Scalar.Int>>, null> - lowerCaseUnion: $.Field<'lowerCaseUnion', $.Output.Nullable, null> - object: $.Field<'object', $.Output.Nullable, null> - objectList: $.Field<'objectList', $.Output.Nullable<$.Output.List>, null> - objectListNonNull: $.Field<'objectListNonNull', $.Output.List, null> - objectNested: $.Field<'objectNested', $.Output.Nullable, null> + listInt: $.Field<'listInt', $.Nullable<$.List<$.Nullable<$Scalar.Int>>>, null> + listIntNonNull: $.Field<'listIntNonNull', $.List<$Scalar.Int>, null> + listListInt: $.Field<'listListInt', $.Nullable<$.List<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>>>, null> + listListIntNonNull: $.Field<'listListIntNonNull', $.List<$.List<$Scalar.Int>>, null> + lowerCaseUnion: $.Field<'lowerCaseUnion', $.Nullable, null> + object: $.Field<'object', $.Nullable, null> + objectList: $.Field<'objectList', $.Nullable<$.List>, null> + objectListNonNull: $.Field<'objectListNonNull', $.List, null> + objectNested: $.Field<'objectNested', $.Nullable, null> objectNonNull: $.Field<'objectNonNull', Object1, null> objectWithArgs: $.Field< 'objectWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - boolean: $.Input.Field<$.Input.Nullable<$Scalar.Boolean>> - float: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - int: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - string: $.Input.Field<$.Input.Nullable<$Scalar.String>> + boolean: $.InputField<$.Nullable<$Scalar.Boolean>> + float: $.InputField<$.Nullable<$Scalar.Float>> + id: $.InputField<$.Nullable<$Scalar.ID>> + int: $.InputField<$.Nullable<$Scalar.Int>> + string: $.InputField<$.Nullable<$Scalar.String>> }, true> > result: $.Field< 'result', - $.Output.Nullable, + $.Nullable, $.Args<{ - case: $.Input.Field + case: $.InputField }, false> > resultNonNull: $.Field< 'resultNonNull', Result, $.Args<{ - case: $.Input.Field<$.Input.Nullable> + case: $.InputField<$.Nullable> }, true> > - string: $.Field<'string', $.Output.Nullable<$Scalar.String>, null> + string: $.Field<'string', $.Nullable<$Scalar.String>, null> stringWithArgEnum: $.Field< 'stringWithArgEnum', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ABCEnum: $.Input.Field<$.Input.Nullable> + ABCEnum: $.InputField<$.Nullable> }, true> > stringWithArgInputObject: $.Field< 'stringWithArgInputObject', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field<$.Input.Nullable> + input: $.InputField<$.Nullable> }, true> > stringWithArgInputObjectRequired: $.Field< 'stringWithArgInputObjectRequired', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - input: $.Input.Field + input: $.InputField }, false> > /** @@ -183,46 +181,46 @@ export namespace Schema { */ stringWithArgs: $.Field< 'stringWithArgs', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - boolean: $.Input.Field<$.Input.Nullable<$Scalar.Boolean>> - float: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - int: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - string: $.Input.Field<$.Input.Nullable<$Scalar.String>> + boolean: $.InputField<$.Nullable<$Scalar.Boolean>> + float: $.InputField<$.Nullable<$Scalar.Float>> + id: $.InputField<$.Nullable<$Scalar.ID>> + int: $.InputField<$.Nullable<$Scalar.Int>> + string: $.InputField<$.Nullable<$Scalar.String>> }, true> > stringWithListArg: $.Field< 'stringWithListArg', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ints: $.Input.Field<$.Input.Nullable<$.Input.List<$.Input.Nullable<$Scalar.Int>>>> + ints: $.InputField<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>> }, true> > stringWithListArgRequired: $.Field< 'stringWithListArgRequired', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - ints: $.Input.Field<$.Input.List<$Scalar.Int>> + ints: $.InputField<$.List<$Scalar.Int>> }, false> > stringWithRequiredArg: $.Field< 'stringWithRequiredArg', - $.Output.Nullable<$Scalar.String>, + $.Nullable<$Scalar.String>, $.Args<{ - string: $.Input.Field<$Scalar.String> + string: $.InputField<$Scalar.String> }, false> > - unionFooBar: $.Field<'unionFooBar', $.Output.Nullable, null> + unionFooBar: $.Field<'unionFooBar', $.Nullable, null> unionFooBarNonNull: $.Field<'unionFooBarNonNull', FooBarUnion, null> unionFooBarWithArgs: $.Field< 'unionFooBarWithArgs', - $.Output.Nullable, + $.Nullable, $.Args<{ - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> + id: $.InputField<$.Nullable<$Scalar.ID>> }, true> > - unionObject: $.Field<'unionObject', $.Output.Nullable, null> + unionObject: $.Field<'unionObject', $.Nullable, null> unionObjectNonNull: $.Field<'unionObjectNonNull', ObjectUnion, null> }> @@ -271,23 +269,23 @@ export namespace Schema { // export type InputObject = $.InputObject<'InputObject', { - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> - dateRequired: $.Input.Field<$Scalar.Date> - id: $.Input.Field<$.Input.Nullable<$Scalar.ID>> - idRequired: $.Input.Field<$Scalar.ID> + date: $.InputField<$.Nullable<$Scalar.Date>> + dateRequired: $.InputField<$Scalar.Date> + id: $.InputField<$.Nullable<$Scalar.ID>> + idRequired: $.InputField<$Scalar.ID> }, true> export type InputObjectCircular = $.InputObject<'InputObjectCircular', { - circular: $.Input.Field<$.Input.Nullable> - date: $.Input.Field<$.Input.Nullable<$Scalar.Date>> + circular: $.InputField<$.Nullable> + date: $.InputField<$.Nullable<$Scalar.Date>> }, true> export type InputObjectNested = $.InputObject<'InputObjectNested', { - InputObject: $.Input.Field<$.Input.Nullable> + InputObject: $.InputField<$.Nullable> }, true> export type InputObjectNestedNonNull = $.InputObject<'InputObjectNestedNonNull', { - InputObject: $.Input.Field + InputObject: $.InputField }, false> // @@ -307,7 +305,7 @@ export namespace Schema { // export type DateInterface1 = $.Interface<'DateInterface1', { - date1: $.Field<'date1', $.Output.Nullable<$Scalar.Date>, null> + date1: $.Field<'date1', $.Nullable<$Scalar.Date>, null> }, [DateObject1]> export type Error = $.Interface<'Error', { @@ -315,7 +313,7 @@ export namespace Schema { }, [ErrorOne, ErrorTwo]> export type Interface = $.Interface<'Interface', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }, [Object1ImplementingInterface, Object2ImplementingInterface]> // @@ -334,74 +332,74 @@ export namespace Schema { // // - export type Bar = $.Object$2<'Bar', { - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type Bar = $.OutputObject<'Bar', { + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> - export type DateObject1 = $.Object$2<'DateObject1', { - date1: $.Field<'date1', $.Output.Nullable<$Scalar.Date>, null> + export type DateObject1 = $.OutputObject<'DateObject1', { + date1: $.Field<'date1', $.Nullable<$Scalar.Date>, null> }> - export type DateObject2 = $.Object$2<'DateObject2', { - date2: $.Field<'date2', $.Output.Nullable<$Scalar.Date>, null> + export type DateObject2 = $.OutputObject<'DateObject2', { + date2: $.Field<'date2', $.Nullable<$Scalar.Date>, null> }> - export type ErrorOne = $.Object$2<'ErrorOne', { - infoId: $.Field<'infoId', $.Output.Nullable<$Scalar.ID>, null> + export type ErrorOne = $.OutputObject<'ErrorOne', { + infoId: $.Field<'infoId', $.Nullable<$Scalar.ID>, null> message: $.Field<'message', $Scalar.String, null> }> - export type ErrorTwo = $.Object$2<'ErrorTwo', { - infoInt: $.Field<'infoInt', $.Output.Nullable<$Scalar.Int>, null> + export type ErrorTwo = $.OutputObject<'ErrorTwo', { + infoInt: $.Field<'infoInt', $.Nullable<$Scalar.Int>, null> message: $.Field<'message', $Scalar.String, null> }> /** * Object documentation. */ - export type Foo = $.Object$2<'Foo', { + export type Foo = $.OutputObject<'Foo', { /** * Field documentation. * * @deprecated Field a is deprecated. */ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type Object1 = $.Object$2<'Object1', { - ABCEnum: $.Field<'ABCEnum', $.Output.Nullable, null> - boolean: $.Field<'boolean', $.Output.Nullable<$Scalar.Boolean>, null> - float: $.Field<'float', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> - string: $.Field<'string', $.Output.Nullable<$Scalar.String>, null> + export type Object1 = $.OutputObject<'Object1', { + ABCEnum: $.Field<'ABCEnum', $.Nullable, null> + boolean: $.Field<'boolean', $.Nullable<$Scalar.Boolean>, null> + float: $.Field<'float', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> + string: $.Field<'string', $.Nullable<$Scalar.String>, null> }> - export type Object1ImplementingInterface = $.Object$2<'Object1ImplementingInterface', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type Object1ImplementingInterface = $.OutputObject<'Object1ImplementingInterface', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> - export type Object2ImplementingInterface = $.Object$2<'Object2ImplementingInterface', { - boolean: $.Field<'boolean', $.Output.Nullable<$Scalar.Boolean>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Object2ImplementingInterface = $.OutputObject<'Object2ImplementingInterface', { + boolean: $.Field<'boolean', $.Nullable<$Scalar.Boolean>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type ObjectNested = $.Object$2<'ObjectNested', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - object: $.Field<'object', $.Output.Nullable, null> + export type ObjectNested = $.OutputObject<'ObjectNested', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + object: $.Field<'object', $.Nullable, null> }> - export type ObjectUnion = $.Object$2<'ObjectUnion', { - fooBarUnion: $.Field<'fooBarUnion', $.Output.Nullable, null> + export type ObjectUnion = $.OutputObject<'ObjectUnion', { + fooBarUnion: $.Field<'fooBarUnion', $.Nullable, null> }> - export type lowerCaseObject = $.Object$2<'lowerCaseObject', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type lowerCaseObject = $.OutputObject<'lowerCaseObject', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> }> - export type lowerCaseObject2 = $.Object$2<'lowerCaseObject2', { - int: $.Field<'int', $.Output.Nullable<$Scalar.Int>, null> + export type lowerCaseObject2 = $.OutputObject<'lowerCaseObject2', { + int: $.Field<'int', $.Nullable<$Scalar.Int>, null> }> // @@ -431,6 +429,7 @@ export namespace Schema { export type lowerCaseUnion = $.Union<'lowerCaseUnion', [lowerCaseObject, lowerCaseObject2]> } + // // // @@ -446,11 +445,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase { diff --git a/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts b/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts index 249af6965..0c8658809 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts @@ -1,3 +1,3 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../../../src/types/Schema/types/Scalar/scalars.js' diff --git a/tests/_/schemas/mutation-only/graffle/modules/Schema.ts b/tests/_/schemas/mutation-only/graffle/modules/Schema.ts index 08c2fe897..d7ae86f93 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/Schema.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/Schema.ts @@ -1,6 +1,8 @@ -import type * as $ from '../../../../../../src/entrypoints/schema.js' +import type { SchemaKit as $ } from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -18,8 +20,8 @@ export namespace Schema { // // - export type Mutation = $.Output.ObjectMutation<{ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Mutation = $.ObjectMutation<{ + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> }> @@ -113,6 +115,7 @@ export namespace Schema { // -- no types -- } + // // // @@ -128,11 +131,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase { diff --git a/tests/_/schemas/pokemon/graffle/modules/Scalar.ts b/tests/_/schemas/pokemon/graffle/modules/Scalar.ts index 249af6965..0c8658809 100644 --- a/tests/_/schemas/pokemon/graffle/modules/Scalar.ts +++ b/tests/_/schemas/pokemon/graffle/modules/Scalar.ts @@ -1,3 +1,3 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../../../src/types/Schema/types/Scalar/scalars.js' diff --git a/tests/_/schemas/pokemon/graffle/modules/Schema.ts b/tests/_/schemas/pokemon/graffle/modules/Schema.ts index 82b8a9c07..bc53d7c5c 100644 --- a/tests/_/schemas/pokemon/graffle/modules/Schema.ts +++ b/tests/_/schemas/pokemon/graffle/modules/Schema.ts @@ -1,6 +1,8 @@ -import type * as $ from '../../../../../../src/entrypoints/schema.js' +import type { SchemaKit as $ } from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -18,46 +20,46 @@ export namespace Schema { // // - export type Mutation = $.Output.ObjectMutation<{ + export type Mutation = $.ObjectMutation<{ addPokemon: $.Field< 'addPokemon', - $.Output.Nullable, + $.Nullable, $.Args<{ - attack: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - defense: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - hp: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - name: $.Input.Field<$Scalar.String> - type: $.Input.Field + attack: $.InputField<$.Nullable<$Scalar.Int>> + defense: $.InputField<$.Nullable<$Scalar.Int>> + hp: $.InputField<$.Nullable<$Scalar.Int>> + name: $.InputField<$Scalar.String> + type: $.InputField }, false> > }> - export type Query = $.Output.ObjectQuery<{ - battles: $.Field<'battles', $.Output.List, null> - beings: $.Field<'beings', $.Output.List, null> - pokemon: $.Field<'pokemon', $.Output.Nullable<$.Output.List>, null> + export type Query = $.ObjectQuery<{ + battles: $.Field<'battles', $.List, null> + beings: $.Field<'beings', $.List, null> + pokemon: $.Field<'pokemon', $.Nullable<$.List>, null> pokemonByName: $.Field< 'pokemonByName', - $.Output.Nullable<$.Output.List>, + $.Nullable<$.List>, $.Args<{ - name: $.Input.Field<$Scalar.String> + name: $.InputField<$Scalar.String> }, false> > pokemons: $.Field< 'pokemons', - $.Output.Nullable<$.Output.List>, + $.Nullable<$.List>, $.Args<{ - filter: $.Input.Field<$.Input.Nullable> + filter: $.InputField<$.Nullable> }, true> > trainerByName: $.Field< 'trainerByName', - $.Output.Nullable, + $.Nullable, $.Args<{ - name: $.Input.Field<$Scalar.String> + name: $.InputField<$Scalar.String> }, false> > - trainers: $.Field<'trainers', $.Output.Nullable<$.Output.List>, null> + trainers: $.Field<'trainers', $.Nullable<$.List>, null> }> // @@ -116,18 +118,18 @@ export namespace Schema { // export type DateFilter = $.InputObject<'DateFilter', { - gte: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - lte: $.Input.Field<$.Input.Nullable<$Scalar.Float>> + gte: $.InputField<$.Nullable<$Scalar.Float>> + lte: $.InputField<$.Nullable<$Scalar.Float>> }, true> export type PokemonFilter = $.InputObject<'PokemonFilter', { - birthday: $.Input.Field<$.Input.Nullable> - name: $.Input.Field<$.Input.Nullable> + birthday: $.InputField<$.Nullable> + name: $.InputField<$.Nullable> }, true> export type StringFilter = $.InputObject<'StringFilter', { - contains: $.Input.Field<$.Input.Nullable<$Scalar.String>> - in: $.Input.Field<$.Input.Nullable<$.Input.List<$Scalar.String>>> + contains: $.InputField<$.Nullable<$Scalar.String>> + in: $.InputField<$.Nullable<$.List<$Scalar.String>>> }, true> // @@ -147,8 +149,8 @@ export namespace Schema { // export type Being = $.Interface<'Being', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> }, [Patron, Pokemon, Trainer]> // @@ -167,63 +169,63 @@ export namespace Schema { // // - export type BattleRoyale = $.Object$2<'BattleRoyale', { - combatants: $.Field<'combatants', $.Output.Nullable<$.Output.List>, null> - date: $.Field<'date', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - winner: $.Field<'winner', $.Output.Nullable, null> + export type BattleRoyale = $.OutputObject<'BattleRoyale', { + combatants: $.Field<'combatants', $.Nullable<$.List>, null> + date: $.Field<'date', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + winner: $.Field<'winner', $.Nullable, null> }> - export type BattleTrainer = $.Object$2<'BattleTrainer', { - combatant1: $.Field<'combatant1', $.Output.Nullable, null> - combatant2: $.Field<'combatant2', $.Output.Nullable, null> - date: $.Field<'date', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - winner: $.Field<'winner', $.Output.Nullable, null> + export type BattleTrainer = $.OutputObject<'BattleTrainer', { + combatant1: $.Field<'combatant1', $.Nullable, null> + combatant2: $.Field<'combatant2', $.Nullable, null> + date: $.Field<'date', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + winner: $.Field<'winner', $.Nullable, null> }> - export type BattleWild = $.Object$2<'BattleWild', { - date: $.Field<'date', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - pokemon: $.Field<'pokemon', $.Output.Nullable, null> - result: $.Field<'result', $.Output.Nullable, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> - wildPokemons: $.Field<'wildPokemons', $.Output.Nullable<$.Output.List>, null> + export type BattleWild = $.OutputObject<'BattleWild', { + date: $.Field<'date', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + pokemon: $.Field<'pokemon', $.Nullable, null> + result: $.Field<'result', $.Nullable, null> + trainer: $.Field<'trainer', $.Nullable, null> + wildPokemons: $.Field<'wildPokemons', $.Nullable<$.List>, null> }> - export type CombatantMultiPokemon = $.Object$2<'CombatantMultiPokemon', { - pokemons: $.Field<'pokemons', $.Output.Nullable<$.Output.List>, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> + export type CombatantMultiPokemon = $.OutputObject<'CombatantMultiPokemon', { + pokemons: $.Field<'pokemons', $.Nullable<$.List>, null> + trainer: $.Field<'trainer', $.Nullable, null> }> - export type CombatantSinglePokemon = $.Object$2<'CombatantSinglePokemon', { - pokemon: $.Field<'pokemon', $.Output.Nullable, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> + export type CombatantSinglePokemon = $.OutputObject<'CombatantSinglePokemon', { + pokemon: $.Field<'pokemon', $.Nullable, null> + trainer: $.Field<'trainer', $.Nullable, null> }> - export type Patron = $.Object$2<'Patron', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - money: $.Field<'money', $.Output.Nullable<$Scalar.Int>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> + export type Patron = $.OutputObject<'Patron', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + money: $.Field<'money', $.Nullable<$Scalar.Int>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> }> - export type Pokemon = $.Object$2<'Pokemon', { - attack: $.Field<'attack', $.Output.Nullable<$Scalar.Int>, null> - birthday: $.Field<'birthday', $.Output.Nullable<$Scalar.Int>, null> - defense: $.Field<'defense', $.Output.Nullable<$Scalar.Int>, null> - hp: $.Field<'hp', $.Output.Nullable<$Scalar.Int>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> - type: $.Field<'type', $.Output.Nullable, null> + export type Pokemon = $.OutputObject<'Pokemon', { + attack: $.Field<'attack', $.Nullable<$Scalar.Int>, null> + birthday: $.Field<'birthday', $.Nullable<$Scalar.Int>, null> + defense: $.Field<'defense', $.Nullable<$Scalar.Int>, null> + hp: $.Field<'hp', $.Nullable<$Scalar.Int>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> + trainer: $.Field<'trainer', $.Nullable, null> + type: $.Field<'type', $.Nullable, null> }> - export type Trainer = $.Object$2<'Trainer', { - class: $.Field<'class', $.Output.Nullable, null> - fans: $.Field<'fans', $.Output.Nullable<$.Output.List>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> - pokemon: $.Field<'pokemon', $.Output.Nullable<$.Output.List>, null> + export type Trainer = $.OutputObject<'Trainer', { + class: $.Field<'class', $.Nullable, null> + fans: $.Field<'fans', $.Nullable<$.List>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> + pokemon: $.Field<'pokemon', $.Nullable<$.List>, null> }> // @@ -244,6 +246,7 @@ export namespace Schema { export type Battle = $.Union<'Battle', [BattleRoyale, BattleTrainer, BattleWild]> } + // // // @@ -259,11 +262,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase { diff --git a/tests/_/schemas/query-only/graffle/modules/Scalar.ts b/tests/_/schemas/query-only/graffle/modules/Scalar.ts index 249af6965..0c8658809 100644 --- a/tests/_/schemas/query-only/graffle/modules/Scalar.ts +++ b/tests/_/schemas/query-only/graffle/modules/Scalar.ts @@ -1,3 +1,3 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../../../src/types/Schema/types/Scalar/scalars.js' diff --git a/tests/_/schemas/query-only/graffle/modules/Schema.ts b/tests/_/schemas/query-only/graffle/modules/Schema.ts index cac1e1c47..c3f7ab94f 100644 --- a/tests/_/schemas/query-only/graffle/modules/Schema.ts +++ b/tests/_/schemas/query-only/graffle/modules/Schema.ts @@ -1,6 +1,8 @@ -import type * as $ from '../../../../../../src/entrypoints/schema.js' +import type { SchemaKit as $ } from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -18,8 +20,8 @@ export namespace Schema { // // - export type Query = $.Output.ObjectQuery<{ - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> + export type Query = $.ObjectQuery<{ + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> idNonNull: $.Field<'idNonNull', $Scalar.ID, null> }> @@ -113,6 +115,7 @@ export namespace Schema { // -- no types -- } + // // // @@ -128,11 +131,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase { diff --git a/website/graffle/modules/Schema.ts b/website/graffle/modules/Schema.ts index 113faf12d..59a1eac6e 100644 --- a/website/graffle/modules/Schema.ts +++ b/website/graffle/modules/Schema.ts @@ -1,6 +1,8 @@ -import type * as $ from 'graffle/schema' +import type { SchemaKit as $ } from 'graffle/utilities-for-generated' +import type * as $$Utilities from 'graffle/utilities-for-generated' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -18,47 +20,47 @@ export namespace Schema { // // - export type Query = $.Output.ObjectQuery<{ + export type Query = $.ObjectQuery<{ continent: $.Field< 'continent', - $.Output.Nullable, + $.Nullable, $.Args<{ - code: $.Input.Field<$Scalar.ID> + code: $.InputField<$Scalar.ID> }, false> > continents: $.Field< 'continents', - $.Output.List, + $.List, $.Args<{ - filter: $.Input.Field<$.Input.Nullable> + filter: $.InputField<$.Nullable> }, true> > countries: $.Field< 'countries', - $.Output.List, + $.List, $.Args<{ - filter: $.Input.Field<$.Input.Nullable> + filter: $.InputField<$.Nullable> }, true> > country: $.Field< 'country', - $.Output.Nullable, + $.Nullable, $.Args<{ - code: $.Input.Field<$Scalar.ID> + code: $.InputField<$Scalar.ID> }, false> > language: $.Field< 'language', - $.Output.Nullable, + $.Nullable, $.Args<{ - code: $.Input.Field<$Scalar.ID> + code: $.InputField<$Scalar.ID> }, false> > languages: $.Field< 'languages', - $.Output.List, + $.List, $.Args<{ - filter: $.Input.Field<$.Input.Nullable> + filter: $.InputField<$.Nullable> }, true> > }> @@ -98,26 +100,26 @@ export namespace Schema { // export type ContinentFilterInput = $.InputObject<'ContinentFilterInput', { - code: $.Input.Field<$.Input.Nullable> + code: $.InputField<$.Nullable> }, true> export type CountryFilterInput = $.InputObject<'CountryFilterInput', { - code: $.Input.Field<$.Input.Nullable> - continent: $.Input.Field<$.Input.Nullable> - currency: $.Input.Field<$.Input.Nullable> - name: $.Input.Field<$.Input.Nullable> + code: $.InputField<$.Nullable> + continent: $.InputField<$.Nullable> + currency: $.InputField<$.Nullable> + name: $.InputField<$.Nullable> }, true> export type LanguageFilterInput = $.InputObject<'LanguageFilterInput', { - code: $.Input.Field<$.Input.Nullable> + code: $.InputField<$.Nullable> }, true> export type StringQueryOperatorInput = $.InputObject<'StringQueryOperatorInput', { - eq: $.Input.Field<$.Input.Nullable<$Scalar.String>> - in: $.Input.Field<$.Input.Nullable<$.Input.List<$Scalar.String>>> - ne: $.Input.Field<$.Input.Nullable<$Scalar.String>> - nin: $.Input.Field<$.Input.Nullable<$.Input.List<$Scalar.String>>> - regex: $.Input.Field<$.Input.Nullable<$Scalar.String>> + eq: $.InputField<$.Nullable<$Scalar.String>> + in: $.InputField<$.Nullable<$.List<$Scalar.String>>> + ne: $.InputField<$.Nullable<$Scalar.String>> + nin: $.InputField<$.Nullable<$.List<$Scalar.String>>> + regex: $.InputField<$.Nullable<$Scalar.String>> }, true> // @@ -154,52 +156,52 @@ export namespace Schema { // // - export type Continent = $.Object$2<'Continent', { + export type Continent = $.OutputObject<'Continent', { code: $.Field<'code', $Scalar.ID, null> - countries: $.Field<'countries', $.Output.List, null> + countries: $.Field<'countries', $.List, null> name: $.Field<'name', $Scalar.String, null> }> - export type Country = $.Object$2<'Country', { + export type Country = $.OutputObject<'Country', { awsRegion: $.Field<'awsRegion', $Scalar.String, null> - capital: $.Field<'capital', $.Output.Nullable<$Scalar.String>, null> + capital: $.Field<'capital', $.Nullable<$Scalar.String>, null> code: $.Field<'code', $Scalar.ID, null> continent: $.Field<'continent', Continent, null> - currencies: $.Field<'currencies', $.Output.List<$Scalar.String>, null> - currency: $.Field<'currency', $.Output.Nullable<$Scalar.String>, null> + currencies: $.Field<'currencies', $.List<$Scalar.String>, null> + currency: $.Field<'currency', $.Nullable<$Scalar.String>, null> emoji: $.Field<'emoji', $Scalar.String, null> emojiU: $.Field<'emojiU', $Scalar.String, null> - languages: $.Field<'languages', $.Output.List, null> + languages: $.Field<'languages', $.List, null> name: $.Field< 'name', $Scalar.String, $.Args<{ - lang: $.Input.Field<$.Input.Nullable<$Scalar.String>> + lang: $.InputField<$.Nullable<$Scalar.String>> }, true> > native: $.Field<'native', $Scalar.String, null> phone: $.Field<'phone', $Scalar.String, null> - phones: $.Field<'phones', $.Output.List<$Scalar.String>, null> - states: $.Field<'states', $.Output.List, null> - subdivisions: $.Field<'subdivisions', $.Output.List, null> + phones: $.Field<'phones', $.List<$Scalar.String>, null> + states: $.Field<'states', $.List, null> + subdivisions: $.Field<'subdivisions', $.List, null> }> - export type Language = $.Object$2<'Language', { + export type Language = $.OutputObject<'Language', { code: $.Field<'code', $Scalar.ID, null> name: $.Field<'name', $Scalar.String, null> native: $.Field<'native', $Scalar.String, null> rtl: $.Field<'rtl', $Scalar.Boolean, null> }> - export type State = $.Object$2<'State', { - code: $.Field<'code', $.Output.Nullable<$Scalar.String>, null> + export type State = $.OutputObject<'State', { + code: $.Field<'code', $.Nullable<$Scalar.String>, null> country: $.Field<'country', Country, null> name: $.Field<'name', $Scalar.String, null> }> - export type Subdivision = $.Object$2<'Subdivision', { + export type Subdivision = $.OutputObject<'Subdivision', { code: $.Field<'code', $Scalar.ID, null> - emoji: $.Field<'emoji', $.Output.Nullable<$Scalar.String>, null> + emoji: $.Field<'emoji', $.Nullable<$Scalar.String>, null> name: $.Field<'name', $Scalar.String, null> }> @@ -221,6 +223,7 @@ export namespace Schema { // -- no types -- } + // // // @@ -236,11 +239,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from 'graffle/utilities-for-generated' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase { diff --git a/website/pokemon/modules/Schema.ts b/website/pokemon/modules/Schema.ts index 85aa7a95c..9a2a19956 100644 --- a/website/pokemon/modules/Schema.ts +++ b/website/pokemon/modules/Schema.ts @@ -1,6 +1,8 @@ -import type * as $ from 'graffle/schema' +import type { SchemaKit as $ } from 'graffle/utilities-for-generated' +import type * as $$Utilities from 'graffle/utilities-for-generated' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' - export namespace Schema { // // @@ -18,46 +20,46 @@ export namespace Schema { // // - export type Mutation = $.Output.ObjectMutation<{ + export type Mutation = $.ObjectMutation<{ addPokemon: $.Field< 'addPokemon', - $.Output.Nullable, + $.Nullable, $.Args<{ - attack: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - defense: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - hp: $.Input.Field<$.Input.Nullable<$Scalar.Int>> - name: $.Input.Field<$Scalar.String> - type: $.Input.Field + attack: $.InputField<$.Nullable<$Scalar.Int>> + defense: $.InputField<$.Nullable<$Scalar.Int>> + hp: $.InputField<$.Nullable<$Scalar.Int>> + name: $.InputField<$Scalar.String> + type: $.InputField }, false> > }> - export type Query = $.Output.ObjectQuery<{ - battles: $.Field<'battles', $.Output.List, null> - beings: $.Field<'beings', $.Output.List, null> - pokemon: $.Field<'pokemon', $.Output.Nullable<$.Output.List>, null> + export type Query = $.ObjectQuery<{ + battles: $.Field<'battles', $.List, null> + beings: $.Field<'beings', $.List, null> + pokemon: $.Field<'pokemon', $.Nullable<$.List>, null> pokemonByName: $.Field< 'pokemonByName', - $.Output.Nullable<$.Output.List>, + $.Nullable<$.List>, $.Args<{ - name: $.Input.Field<$Scalar.String> + name: $.InputField<$Scalar.String> }, false> > pokemons: $.Field< 'pokemons', - $.Output.Nullable<$.Output.List>, + $.Nullable<$.List>, $.Args<{ - filter: $.Input.Field<$.Input.Nullable> + filter: $.InputField<$.Nullable> }, true> > trainerByName: $.Field< 'trainerByName', - $.Output.Nullable, + $.Nullable, $.Args<{ - name: $.Input.Field<$Scalar.String> + name: $.InputField<$Scalar.String> }, false> > - trainers: $.Field<'trainers', $.Output.Nullable<$.Output.List>, null> + trainers: $.Field<'trainers', $.Nullable<$.List>, null> }> // @@ -116,18 +118,18 @@ export namespace Schema { // export type DateFilter = $.InputObject<'DateFilter', { - gte: $.Input.Field<$.Input.Nullable<$Scalar.Float>> - lte: $.Input.Field<$.Input.Nullable<$Scalar.Float>> + gte: $.InputField<$.Nullable<$Scalar.Float>> + lte: $.InputField<$.Nullable<$Scalar.Float>> }, true> export type PokemonFilter = $.InputObject<'PokemonFilter', { - birthday: $.Input.Field<$.Input.Nullable> - name: $.Input.Field<$.Input.Nullable> + birthday: $.InputField<$.Nullable> + name: $.InputField<$.Nullable> }, true> export type StringFilter = $.InputObject<'StringFilter', { - contains: $.Input.Field<$.Input.Nullable<$Scalar.String>> - in: $.Input.Field<$.Input.Nullable<$.Input.List<$Scalar.String>>> + contains: $.InputField<$.Nullable<$Scalar.String>> + in: $.InputField<$.Nullable<$.List<$Scalar.String>>> }, true> // @@ -147,8 +149,8 @@ export namespace Schema { // export type Being = $.Interface<'Being', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> }, [Patron, Pokemon, Trainer]> // @@ -167,63 +169,63 @@ export namespace Schema { // // - export type BattleRoyale = $.Object$2<'BattleRoyale', { - combatants: $.Field<'combatants', $.Output.Nullable<$.Output.List>, null> - date: $.Field<'date', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - winner: $.Field<'winner', $.Output.Nullable, null> + export type BattleRoyale = $.OutputObject<'BattleRoyale', { + combatants: $.Field<'combatants', $.Nullable<$.List>, null> + date: $.Field<'date', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + winner: $.Field<'winner', $.Nullable, null> }> - export type BattleTrainer = $.Object$2<'BattleTrainer', { - combatant1: $.Field<'combatant1', $.Output.Nullable, null> - combatant2: $.Field<'combatant2', $.Output.Nullable, null> - date: $.Field<'date', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - winner: $.Field<'winner', $.Output.Nullable, null> + export type BattleTrainer = $.OutputObject<'BattleTrainer', { + combatant1: $.Field<'combatant1', $.Nullable, null> + combatant2: $.Field<'combatant2', $.Nullable, null> + date: $.Field<'date', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + winner: $.Field<'winner', $.Nullable, null> }> - export type BattleWild = $.Object$2<'BattleWild', { - date: $.Field<'date', $.Output.Nullable<$Scalar.Float>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - pokemon: $.Field<'pokemon', $.Output.Nullable, null> - result: $.Field<'result', $.Output.Nullable, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> - wildPokemons: $.Field<'wildPokemons', $.Output.Nullable<$.Output.List>, null> + export type BattleWild = $.OutputObject<'BattleWild', { + date: $.Field<'date', $.Nullable<$Scalar.Float>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + pokemon: $.Field<'pokemon', $.Nullable, null> + result: $.Field<'result', $.Nullable, null> + trainer: $.Field<'trainer', $.Nullable, null> + wildPokemons: $.Field<'wildPokemons', $.Nullable<$.List>, null> }> - export type CombatantMultiPokemon = $.Object$2<'CombatantMultiPokemon', { - pokemons: $.Field<'pokemons', $.Output.Nullable<$.Output.List>, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> + export type CombatantMultiPokemon = $.OutputObject<'CombatantMultiPokemon', { + pokemons: $.Field<'pokemons', $.Nullable<$.List>, null> + trainer: $.Field<'trainer', $.Nullable, null> }> - export type CombatantSinglePokemon = $.Object$2<'CombatantSinglePokemon', { - pokemon: $.Field<'pokemon', $.Output.Nullable, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> + export type CombatantSinglePokemon = $.OutputObject<'CombatantSinglePokemon', { + pokemon: $.Field<'pokemon', $.Nullable, null> + trainer: $.Field<'trainer', $.Nullable, null> }> - export type Patron = $.Object$2<'Patron', { - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - money: $.Field<'money', $.Output.Nullable<$Scalar.Int>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> + export type Patron = $.OutputObject<'Patron', { + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + money: $.Field<'money', $.Nullable<$Scalar.Int>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> }> - export type Pokemon = $.Object$2<'Pokemon', { - attack: $.Field<'attack', $.Output.Nullable<$Scalar.Int>, null> - birthday: $.Field<'birthday', $.Output.Nullable<$Scalar.Int>, null> - defense: $.Field<'defense', $.Output.Nullable<$Scalar.Int>, null> - hp: $.Field<'hp', $.Output.Nullable<$Scalar.Int>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> - trainer: $.Field<'trainer', $.Output.Nullable, null> - type: $.Field<'type', $.Output.Nullable, null> + export type Pokemon = $.OutputObject<'Pokemon', { + attack: $.Field<'attack', $.Nullable<$Scalar.Int>, null> + birthday: $.Field<'birthday', $.Nullable<$Scalar.Int>, null> + defense: $.Field<'defense', $.Nullable<$Scalar.Int>, null> + hp: $.Field<'hp', $.Nullable<$Scalar.Int>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> + trainer: $.Field<'trainer', $.Nullable, null> + type: $.Field<'type', $.Nullable, null> }> - export type Trainer = $.Object$2<'Trainer', { - class: $.Field<'class', $.Output.Nullable, null> - fans: $.Field<'fans', $.Output.Nullable<$.Output.List>, null> - id: $.Field<'id', $.Output.Nullable<$Scalar.ID>, null> - name: $.Field<'name', $.Output.Nullable<$Scalar.String>, null> - pokemon: $.Field<'pokemon', $.Output.Nullable<$.Output.List>, null> + export type Trainer = $.OutputObject<'Trainer', { + class: $.Field<'class', $.Nullable, null> + fans: $.Field<'fans', $.Nullable<$.List>, null> + id: $.Field<'id', $.Nullable<$Scalar.ID>, null> + name: $.Field<'name', $.Nullable<$Scalar.String>, null> + pokemon: $.Field<'pokemon', $.Nullable<$.List>, null> }> // @@ -244,6 +246,7 @@ export namespace Schema { export type Battle = $.Union<'Battle', [BattleRoyale, BattleTrainer, BattleWild]> } + // // // @@ -259,11 +262,6 @@ export namespace Schema { // // // - -import type * as $$Utilities from 'graffle/utilities-for-generated' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' - export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}> extends $$Utilities.SchemaIndexBase {