-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fluent extensions, throws extension, gen static interfaces (#1107)
- Loading branch information
1 parent
e4da3c0
commit a3b1d75
Showing
228 changed files
with
11,164 additions
and
3,089 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { createPrefilled } from '../../../../../src/entrypoints/client.js' | ||
|
||
import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js' | ||
|
||
export const create = createPrefilled(`Atlas`, $Index, $defaultSchemaUrl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export const Name = `Atlas` | ||
|
||
export type Name = 'Atlas' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
examples/$/generated-clients/atlas/modules/MethodsDocument.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type * as Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' | ||
import type { Index } from './SchemaIndex.js' | ||
import type * as SelectionSets from './SelectionSets.js' | ||
|
||
interface DocumentInput { | ||
queries?: Record<string, SelectionSets.Query> | ||
} | ||
|
||
export interface Document<$Config extends Utilities.Config> { | ||
<$Document>(document: Utilities.ExactNonEmpty<$Document, DocumentInput>): Utilities.DocumentRunner< | ||
$Config, | ||
Index, | ||
// @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as | ||
// Satisfying the constraint on the DocumentRunner type. | ||
$Document | ||
> | ||
} | ||
|
||
export interface BuilderMethodsDocumentFn extends Utilities.HKT.Fn { | ||
// @ts-expect-error parameter is Untyped. | ||
return: Document<this['params']['config']> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import type { ResultSet } from '../../../../../src/entrypoints/schema.js' | ||
import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' | ||
import type { Index } from './SchemaIndex.js' | ||
import type * as SelectionSet from './SelectionSets.js' | ||
|
||
export interface QueryMethods<$Config extends Utils.Config> { | ||
// todo Use a static type here? | ||
$batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query>) => Promise< | ||
Utils.ResolveOutputReturnRootType< | ||
$Config, | ||
Index, | ||
ResultSet.Query< | ||
Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, | ||
Index | ||
> | ||
> | ||
> | ||
// todo Use a static type here? | ||
__typename: () => Promise< | ||
Utils.ResolveOutputReturnRootField< | ||
$Config, | ||
Index, | ||
'__typename', | ||
'Query' | ||
> | ||
> | ||
continent: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.continent>) => Promise< | ||
Utils.ResolveOutputReturnRootField< | ||
$Config, | ||
Index, | ||
'continent', | ||
ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['continent'], Index> | ||
> | ||
> | ||
continents: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.continents>) => Promise< | ||
Utils.ResolveOutputReturnRootField< | ||
$Config, | ||
Index, | ||
'continents', | ||
ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['continents'], Index> | ||
> | ||
> | ||
countries: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.countries>) => Promise< | ||
Utils.ResolveOutputReturnRootField< | ||
$Config, | ||
Index, | ||
'countries', | ||
ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['countries'], Index> | ||
> | ||
> | ||
country: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.country>) => Promise< | ||
Utils.ResolveOutputReturnRootField< | ||
$Config, | ||
Index, | ||
'country', | ||
ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['country'], Index> | ||
> | ||
> | ||
language: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.language>) => Promise< | ||
Utils.ResolveOutputReturnRootField< | ||
$Config, | ||
Index, | ||
'language', | ||
ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['language'], Index> | ||
> | ||
> | ||
languages: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.languages>) => Promise< | ||
Utils.ResolveOutputReturnRootField< | ||
$Config, | ||
Index, | ||
'languages', | ||
ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['languages'], Index> | ||
> | ||
> | ||
} | ||
|
||
export interface BuilderMethodsRoot<$Config extends Utils.Config> { | ||
query: QueryMethods<$Config> | ||
} | ||
|
||
export interface BuilderMethodsRootFn extends Utils.HKT.Fn { | ||
// @ts-expect-error parameter is Untyped. | ||
return: BuilderMethodsRoot<this['params']['config']> | ||
} |
83 changes: 83 additions & 0 deletions
83
examples/$/generated-clients/atlas/modules/MethodsSelect.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' | ||
import type * as $SelectionSets from './SelectionSets.js' | ||
|
||
// | ||
// | ||
// | ||
// | ||
// | ||
// | ||
// ================================================================================================== | ||
// Select Methods Interface | ||
// ================================================================================================== | ||
// | ||
// | ||
// | ||
// | ||
// | ||
// | ||
|
||
export interface $MethodsSelect { | ||
Query: Query | ||
Continent: Continent | ||
Country: Country | ||
Language: Language | ||
State: State | ||
Subdivision: Subdivision | ||
} | ||
|
||
// | ||
// | ||
// | ||
// | ||
// | ||
// | ||
// ================================================================================================== | ||
// Root | ||
// ================================================================================================== | ||
// | ||
// | ||
// | ||
// | ||
// | ||
// | ||
|
||
export interface Query { | ||
<$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet | ||
} | ||
|
||
// | ||
// | ||
// | ||
// | ||
// | ||
// | ||
// ================================================================================================== | ||
// Object | ||
// ================================================================================================== | ||
// | ||
// | ||
// | ||
// | ||
// | ||
// | ||
|
||
export interface Continent { | ||
<$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Continent>): $SelectionSet | ||
} | ||
|
||
export interface Country { | ||
<$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Country>): $SelectionSet | ||
} | ||
|
||
export interface Language { | ||
<$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Language>): $SelectionSet | ||
} | ||
|
||
export interface State { | ||
<$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.State>): $SelectionSet | ||
} | ||
|
||
export interface Subdivision { | ||
<$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Subdivision>): $SelectionSet | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.