Skip to content

Commit 653210d

Browse files
committed
refactor: simplify schema type
1 parent 1ad6bfc commit 653210d

File tree

94 files changed

+1002
-1127
lines changed

Some content is hidden

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

94 files changed

+1002
-1127
lines changed

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
"default": "./build/entrypoints/schema.js"
3434
}
3535
},
36-
"./schema/scalars": {
37-
"import": {
38-
"default": "./build/entrypoints/scalars.js"
39-
}
40-
},
4136
"./utilities-for-generated": {
4237
"import": {
4338
"default": "./build/entrypoints/utilities-for-generated.js"

src/entrypoints/_Graffle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from '../layers/6_client/client.js'
2-
export * as Scalars from './scalars.js'
2+
export * as Scalars from './_Scalars.js'

src/entrypoints/_Scalars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { create } from '../types/Schema/types/Scalar/_.js'

src/entrypoints/scalars.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/entrypoints/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from '../layers/1_Schema/__.js'
21
export { Select } from '../layers/2_Select/__.js'
32
export { InferResult } from '../layers/3_InferResult/__.js'
3+
export * from '../types/Schema/__.js'

src/entrypoints/utilities-for-generated.ts

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

src/extensions/CustomScalars/decode.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Kind } from 'graphql'
22
import { SchemaKit } from '../../entrypoints/schema.js'
3-
import { applyCodec } from '../../layers/1_Schema/Hybrid/types/Scalar/Scalar.js'
43
import type { RegisteredScalars } from '../../layers/6_client/fluent.js'
54
import type { Grafaid } from '../../lib/grafaid/__.js'
65
import { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js'
@@ -60,10 +59,10 @@ const decodeResultData_ = (input: {
6059
const sddmNode = sddmOutputField.nt
6160

6261
if (SchemaDrivenDataMap.isScalar(sddmNode)) {
63-
data[k] = applyCodec(sddmNode.codec.decode, v)
62+
data[k] = SchemaKit.Scalar.applyCodec(sddmNode.codec.decode, v)
6463
} else if (SchemaDrivenDataMap.isCustomScalarName(sddmNode)) {
6564
const scalar = SchemaKit.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode)
66-
data[k] = applyCodec(scalar.codec.decode, v)
65+
data[k] = SchemaKit.Scalar.applyCodec(scalar.codec.decode, v)
6766
} else if (SchemaDrivenDataMap.isOutputObject(sddmNode)) {
6867
decodeResultData_({
6968
data: v,

src/extensions/CustomScalars/encode.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { SchemaKit } from '../../entrypoints/schema.js'
2-
import { applyCodec } from '../../layers/1_Schema/Hybrid/types/Scalar/Scalar.js'
32
import type { RegisteredScalars } from '../../layers/6_client/fluent.js'
43
import { Grafaid } from '../../lib/grafaid/__.js'
54
import { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js'
@@ -57,12 +56,12 @@ const encodeInputFieldLike = (
5756

5857
if (SchemaDrivenDataMap.isCustomScalarName(sddmNode)) {
5958
const scalar = SchemaKit.Scalar.lookupCustomScalarOrFallbackToString(scalars, sddmNode)
60-
args[argName] = applyCodec(scalar.codec.encode, argValue)
59+
args[argName] = SchemaKit.Scalar.applyCodec(scalar.codec.encode, argValue)
6160
return
6261
}
6362

6463
if (SchemaDrivenDataMap.isScalar(sddmNode)) {
65-
args[argName] = applyCodec(sddmNode.codec.encode, argValue)
64+
args[argName] = SchemaKit.Scalar.applyCodec(sddmNode.codec.encode, argValue)
6665
return
6766
}
6867

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: `../../../../layers/1_Schema/Hybrid/types/Scalar/Scalar.ts`,
15+
scalars: `../../../../types/Schema/types/Scalar/scalars.ts`,
1616
utilitiesForGenerated: `../../../../entrypoints/utilities-for-generated.ts`,
1717
},
1818
})

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

Lines changed: 1 addition & 1 deletion
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 '../../../../../../layers/1_Schema/Hybrid/types/Scalar/Scalar.js'
3+
export * from '../../../../../../types/Schema/types/Scalar/scalars.js'
44

55
//
66
//

0 commit comments

Comments
 (0)