Skip to content

Commit 8bf07bf

Browse files
committed
refactor: track input on context
1 parent 82e0090 commit 8bf07bf

File tree

8 files changed

+15
-17
lines changed

8 files changed

+15
-17
lines changed

src/layers/6_client/Settings/Config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { TransportHttp, TransportMemory } from '../../../requestPipeline/Tr
44
import type { GlobalRegistry } from '../../../types/GlobalRegistry/GlobalRegistry.js'
55
import type { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js'
66
import type { TransportHttpInput } from '../transportHttp/request.js'
7-
import type { InputStatic } from './Input.js'
87

98
export type OutputChannel = 'throw' | 'return'
109

@@ -107,10 +106,6 @@ export interface TransportConfigMemory {
107106
}
108107

109108
export type Config = {
110-
/**
111-
* The initial input that was given to derive this config.
112-
*/
113-
initialInput: InputStatic
114109
name: GlobalRegistry.ClientNames // todo remove? it is in context
115110
output: OutputConfig
116111
schemaMap: SchemaDrivenDataMap | null

src/layers/6_client/Settings/InputToConfig.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type { InputOutputEnvelopeLonghand, InputStatic, URLInput } from './Input
88

99
// dprint-ignore
1010
export type NormalizeInput<$Input extends InputStatic> = {
11-
initialInput: $Input
1211
name: HandleName<$Input>
1312
schemaMap: ConfigManager.OrDefault<$Input['schemaMap'], null>
1413
transport: HandleTransport<$Input>
@@ -50,7 +49,6 @@ export const inputToConfig = <$Input extends InputStatic>(
5049
const transport = handleTransport(input)
5150

5251
return {
53-
initialInput: input,
5452
// todo fixme: passes before generation
5553
// eslint-disable-next-line
5654
// @ts-ignore

src/layers/6_client/chainExtensions/with.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ export interface With<$Args extends Chain.Extension.Parameters<With_>> {
2222
// @ts-ignore Passes after generation
2323
) => Chain.Definition.MaterializeWithNewContext<
2424
$Args['chain'],
25-
ConfigManager.SetAtPath<
25+
ConfigManager.SetProperties<
2626
$Args['context'],
27-
['config'],
28-
NormalizeInput<$Args['context']['config']['initialInput'] & $Input>
27+
{
28+
input: $Args['context']['input'] & $Input
29+
config: NormalizeInput<$Args['context']['input'] & $Input>
30+
}
2931
>
3032
>
3133
}

src/layers/6_client/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const create: Create = (input) => {
4848
name: input.name ?? `default`, // todo import from shared constants
4949
extensions: [],
5050
scalars: Schema.Scalar.Registry.empty,
51-
retry: null,
51+
// retry: null,
5252
input,
5353
})
5454
return createWithContext(initialContext)

src/layers/6_client/clientPrefilled.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const createPrefilled: CreatePrefilled = (name, schemaMap, scalars, schem
1717
name,
1818
extensions: [],
1919
scalars,
20-
retry: null,
20+
// retry: null,
2121
input: {
2222
schema: schemaUrl,
2323
// eslint-disable-next-line

src/layers/6_client/context.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Anyware } from '../../lib/anyware/__.js'
2-
import type { RequestPipeline } from '../../requestPipeline/__.js'
1+
// import type { Anyware } from '../../lib/anyware/__.js'
2+
// import type { RequestPipeline } from '../../requestPipeline/__.js'
33
import type { Schema } from '../../types/Schema/__.js'
44
import type { Extension } from './extension/extension.js'
55
import type { Config } from './Settings/Config.js'
@@ -8,9 +8,12 @@ import { inputToConfig } from './Settings/InputToConfig.js'
88

99
export interface Context {
1010
name: string
11+
/**
12+
* The initial input that was given to derive the config.
13+
*/
1114
input: InputStatic
1215
config: Config
13-
retry: Anyware.Extension2<RequestPipeline.Core, { retrying: true }> | null
16+
// retry: Anyware.Extension2<RequestPipeline.Core, { retrying: true }> | null
1417
extensions: Extension[]
1518
scalars: Schema.Scalar.Registry
1619
typeHooks: {

src/layers/6_client/gql/gql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const gqlProperties = Chain.Extension.create<Gql_>((_, context) => {
7575

7676
const result = await RequestPipeline.anyware.run({
7777
initialInput,
78-
retryingExtension: context.retry as any,
78+
// retryingExtension: context.retry as any,
7979
extensions: context.extensions.filter(_ => _.onRequest !== undefined).map(_ => _.onRequest!) as any,
8080
})
8181

src/layers/6_client/requestMethods/requestMethods.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const executeDocument = async (
139139

140140
const result = await RequestPipeline.anyware.run({
141141
initialInput,
142-
retryingExtension: state.retry as any,
142+
// retryingExtension: state.retry as any,
143143
extensions: state.extensions.filter(_ => _.onRequest !== undefined).map(_ => _.onRequest!) as any,
144144
})
145145

0 commit comments

Comments
 (0)