Skip to content

Commit c29c877

Browse files
committed
refactor: consolidate schema type
1 parent 653210d commit c29c877

File tree

57 files changed

+1469
-1556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1469
-1556
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
"default": "./build/entrypoints/schema.js"
3434
}
3535
},
36+
"./generator-helpers/standard-scalar-types": {
37+
"import": {
38+
"default": "./build/entrypoints/generator-helpers/standardScalarTypes.js"
39+
}
40+
},
3641
"./utilities-for-generated": {
3742
"import": {
3843
"default": "./build/entrypoints/utilities-for-generated.js"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../types/Schema/types/Scalar/standardScalarTypes.js'

src/entrypoints/utilities-for-generated.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export { type Simplify } from 'type-fest'
2-
export { type Schema as SchemaIndexBase } from '../generator/generators/Schema.js'
32
export * from '../layers/2_Select/__.js'
43
export { type ClientContext } from '../layers/6_client/fluent.js'
54
export type {
@@ -12,5 +11,6 @@ export type { Config } from '../layers/6_client/Settings/Config.js'
1211
export { type Exact, type ExactNonEmpty, type UnionExpanded } from '../lib/prelude.js'
1312
export { TypeFunction } from '../lib/type-function/__.js'
1413
export { type GlobalRegistry } from '../types/GlobalRegistry/GlobalRegistry.js'
15-
export { SchemaKit } from '../types/Schema/__.js'
14+
export { Schema } from '../types/Schema/__.js'
15+
export * from '../types/Schema/types/Scalar/standardScalarTypes.js'
1616
export { type SchemaDrivenDataMap } from '../types/SchemaDrivenDataMap/__.js'

src/extensions/CustomScalars/decode.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Kind } from 'graphql'
2-
import { SchemaKit } from '../../entrypoints/schema.js'
2+
import { Schema } from '../../entrypoints/schema.js'
33
import type { RegisteredScalars } from '../../layers/6_client/fluent.js'
44
import type { Grafaid } from '../../lib/grafaid/__.js'
55
import { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js'
@@ -59,10 +59,10 @@ const decodeResultData_ = (input: {
5959
const sddmNode = sddmOutputField.nt
6060

6161
if (SchemaDrivenDataMap.isScalar(sddmNode)) {
62-
data[k] = SchemaKit.Scalar.applyCodec(sddmNode.codec.decode, v)
62+
data[k] = Schema.Scalar.applyCodec(sddmNode.codec.decode, v)
6363
} else if (SchemaDrivenDataMap.isCustomScalarName(sddmNode)) {
64-
const scalar = SchemaKit.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode)
65-
data[k] = SchemaKit.Scalar.applyCodec(scalar.codec.decode, v)
64+
const scalar = Schema.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode)
65+
data[k] = Schema.Scalar.applyCodec(scalar.codec.decode, v)
6666
} else if (SchemaDrivenDataMap.isOutputObject(sddmNode)) {
6767
decodeResultData_({
6868
data: v,

src/extensions/CustomScalars/encode.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SchemaKit } from '../../entrypoints/schema.js'
1+
import { Schema } from '../../entrypoints/schema.js'
22
import type { RegisteredScalars } from '../../layers/6_client/fluent.js'
33
import { Grafaid } from '../../lib/grafaid/__.js'
44
import { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js'
@@ -55,13 +55,13 @@ const encodeInputFieldLike = (
5555
*/
5656

5757
if (SchemaDrivenDataMap.isCustomScalarName(sddmNode)) {
58-
const scalar = SchemaKit.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode)
59-
args[argName] = SchemaKit.Scalar.applyCodec(scalar.codec.encode, argValue)
58+
const scalar = Schema.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode)
59+
args[argName] = Schema.Scalar.applyCodec(scalar.codec.encode, argValue)
6060
return
6161
}
6262

6363
if (SchemaDrivenDataMap.isScalar(sddmNode)) {
64-
args[argName] = SchemaKit.Scalar.applyCodec(sddmNode.codec.encode, argValue)
64+
args[argName] = Schema.Scalar.applyCodec(sddmNode.codec.encode, argValue)
6565
return
6666
}
6767

src/extensions/SchemaErrors/tests/fixture/graffle.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default Generator
1212
libraryPaths: {
1313
client: `../../../../entrypoints/client.ts`,
1414
schema: `../../../../entrypoints/schema.ts`,
15-
scalars: `../../../../types/Schema/types/Scalar/scalars.ts`,
15+
scalars: `../../../../types/Schema/types/Scalar/standardScalarTypes.ts`,
1616
utilitiesForGenerated: `../../../../entrypoints/utilities-for-generated.ts`,
1717
},
1818
})

src/extensions/SchemaErrors/tests/fixture/graffle/modules/Scalar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js'
22

3-
export * from '../../../../../../types/Schema/types/Scalar/scalars.js'
3+
export * from '../../../../../../types/Schema/types/Scalar/standardScalarTypes.js'
44

55
//
66
//
@@ -14,4 +14,4 @@ export * from '../../../../../../types/Schema/types/Scalar/scalars.js'
1414
//
1515
//
1616

17-
export type Date = $$Utilities.SchemaKit.Scalar.ScalarCodecless<'Date'>
17+
export type Date = $$Utilities.Schema.Scalar.ScalarCodecless<'Date'>

src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { SchemaKit as $ } from '../../../../../../entrypoints/utilities-for-generated.js'
1+
import type { Schema as $ } from '../../../../../../entrypoints/utilities-for-generated.js'
22
import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js'
33
import type * as Data from './Data.js'
44
import type * as MethodsRoot from './MethodsRoot.js'
@@ -445,9 +445,7 @@ export namespace Schema {
445445
//
446446
//
447447
//
448-
export interface Schema<$Scalars extends $$Utilities.SchemaKit.Scalar.ScalarMap = {}>
449-
extends $$Utilities.SchemaIndexBase
450-
{
448+
export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $$Utilities.Schema {
451449
name: Data.Name
452450
RootTypesPresent: ['Mutation', 'Query']
453451
RootUnion: Schema.Mutation | Schema.Query

0 commit comments

Comments
 (0)