Compare commits
11 Commits
@nhost/rea
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c6f1e3b33 | ||
|
|
d1365ea516 | ||
|
|
72dbba7881 | ||
|
|
a3f3991d5a | ||
|
|
c71fe2cf72 | ||
|
|
24c5ed3ea4 | ||
|
|
2d9145f918 | ||
|
|
9a0ab5b887 | ||
|
|
1ddf704c5b | ||
|
|
6f4ee845c6 | ||
|
|
b755e9086c |
@@ -1,5 +1,15 @@
|
|||||||
# @nhost/dashboard
|
# @nhost/dashboard
|
||||||
|
|
||||||
|
## 0.11.16
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- b755e908: fix(dashboard): use correct date for last seen
|
||||||
|
- 2d9145f9: chore(deps): revert GraphQL client
|
||||||
|
- 1ddf704c: fix(dashboard): don't show false positive message for failed user creation
|
||||||
|
- @nhost/react-apollo@5.0.3
|
||||||
|
- @nhost/nextjs@1.13.8
|
||||||
|
|
||||||
## 0.11.15
|
## 0.11.15
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/dashboard",
|
"name": "@nhost/dashboard",
|
||||||
"version": "0.11.15",
|
"version": "0.11.16",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
"preinstall": "npx only-allow pnpm",
|
||||||
|
|||||||
@@ -82,25 +82,33 @@ export default function CreateUserForm({
|
|||||||
fetch(signUpUrl, {
|
fetch(signUpUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ email, password }),
|
body: JSON.stringify({ email, password }),
|
||||||
}).then((res) => res.json()),
|
}).then(async (res) => {
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.status === 409) {
|
||||||
|
setError('email', { message: data?.message });
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(data?.message || 'Something went wrong.');
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
loading: 'Creating user...',
|
loading: 'Creating user...',
|
||||||
success: 'User created successfully.',
|
success: 'User created successfully.',
|
||||||
error: 'An error occurred while trying to create the user.',
|
error: (arg) =>
|
||||||
|
arg?.message
|
||||||
|
? `Error: ${arg.message}`
|
||||||
|
: 'An error occurred while trying to create the user.',
|
||||||
},
|
},
|
||||||
getToastStyleProps(),
|
getToastStyleProps(),
|
||||||
);
|
);
|
||||||
|
|
||||||
onSuccess?.();
|
onSuccess?.();
|
||||||
} catch (error) {
|
} catch {
|
||||||
if (error.response?.status === 409) {
|
// Note: Error is already handled by toast.promise
|
||||||
setError('email', {
|
|
||||||
message: error.response.data.message,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setCreateUserFormError(
|
|
||||||
new Error(error.response.data.message || 'Something went wrong.'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +145,7 @@ export default function CreateUserForm({
|
|||||||
{createUserFormError && (
|
{createUserFormError && (
|
||||||
<Alert
|
<Alert
|
||||||
severity="error"
|
severity="error"
|
||||||
className="grid items-center justify-between grid-flow-col px-4 py-3"
|
className="grid grid-flow-col items-center justify-between px-4 py-3"
|
||||||
>
|
>
|
||||||
<span className="text-left">
|
<span className="text-left">
|
||||||
<strong>Error:</strong> {createUserFormError.message}
|
<strong>Error:</strong> {createUserFormError.message}
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ export default function EditUserForm({
|
|||||||
Created At
|
Created At
|
||||||
</InputLabel>
|
</InputLabel>
|
||||||
<Text className="col-span-3 font-medium">
|
<Text className="col-span-3 font-medium">
|
||||||
{format(new Date(user.createdAt), 'yyyy-MM-dd hh:mm:ss')}
|
{format(new Date(user.createdAt), 'yyyy-MM-dd HH:mm:ss')}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<InputLabel as="h3" className="col-span-1 self-center ">
|
<InputLabel as="h3" className="col-span-1 self-center ">
|
||||||
@@ -276,7 +276,7 @@ export default function EditUserForm({
|
|||||||
</InputLabel>
|
</InputLabel>
|
||||||
<Text className="col-span-3 font-medium">
|
<Text className="col-span-3 font-medium">
|
||||||
{user.lastSeen
|
{user.lastSeen
|
||||||
? `${format(new Date(user.lastSeen), 'yyyy-mm-dd hh:mm:ss')}`
|
? `${format(new Date(user.lastSeen), 'yyyy-MM-dd HH:mm:ss')}`
|
||||||
: '-'}
|
: '-'}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/apollo
|
# @nhost/apollo
|
||||||
|
|
||||||
|
## 5.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [2d9145f9]
|
||||||
|
- @nhost/nhost-js@2.0.2
|
||||||
|
|
||||||
## 5.0.1
|
## 5.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/apollo",
|
"name": "@nhost/apollo",
|
||||||
"version": "5.0.1",
|
"version": "5.0.2",
|
||||||
"description": "Nhost Apollo Client library",
|
"description": "Nhost Apollo Client library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @nhost/react-apollo
|
# @nhost/react-apollo
|
||||||
|
|
||||||
|
## 5.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/apollo@5.0.2
|
||||||
|
- @nhost/react@2.0.2
|
||||||
|
|
||||||
## 5.0.2
|
## 5.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/react-apollo",
|
"name": "@nhost/react-apollo",
|
||||||
"version": "5.0.2",
|
"version": "5.0.3",
|
||||||
"description": "Nhost React Apollo client",
|
"description": "Nhost React Apollo client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/react-urql
|
# @nhost/react-urql
|
||||||
|
|
||||||
|
## 2.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- @nhost/react@2.0.2
|
||||||
|
|
||||||
## 2.0.1
|
## 2.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/react-urql",
|
"name": "@nhost/react-urql",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"description": "Nhost React URQL client",
|
"description": "Nhost React URQL client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/graphql-js
|
# @nhost/graphql-js
|
||||||
|
|
||||||
|
## 0.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 2d9145f9: chore(deps): revert GraphQL client
|
||||||
|
|
||||||
## 0.0.2
|
## 0.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -11,150 +11,6 @@
|
|||||||
|
|
||||||
Nhost GraphQL client.
|
Nhost GraphQL client.
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
First, install `graphql-codegen` and the Nhost Typescript plugin:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn add @nhost/graphql-js graphql
|
|
||||||
yarn add -D @graphql-codegen/cli @graphql-codegen/typescript-nhost
|
|
||||||
```
|
|
||||||
|
|
||||||
Make sure strict null checks are enabled in `tsconfig.json`:
|
|
||||||
|
|
||||||
```json filename="tsconfig.json"
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"strictNullChecks": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configure the code generator
|
|
||||||
|
|
||||||
Configure the code generator by adding a `codegen.yaml` file:
|
|
||||||
|
|
||||||
```yaml filename="codegen.yaml"
|
|
||||||
schema:
|
|
||||||
- http://localhost:1337/v1/graphql:
|
|
||||||
headers:
|
|
||||||
x-hasura-admin-secret: nhost-admin-secret
|
|
||||||
generates:
|
|
||||||
./src/schema.ts:
|
|
||||||
plugins:
|
|
||||||
- typescript-nhost
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the codegen script to `package.json`:
|
|
||||||
|
|
||||||
```json filename="package.json"
|
|
||||||
{
|
|
||||||
"scripts": {
|
|
||||||
"codegen": "graphql-codegen"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Generate the schema:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn run codegen
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```ts filename="./src/main.ts"
|
|
||||||
import { NhostGraphqlClient } from '@nhost/graphql-js'
|
|
||||||
import schema from './schema'
|
|
||||||
|
|
||||||
const client = new NhostGraphqlClient({ url: 'http://localhost:1337/v1/graphql', schema })
|
|
||||||
```
|
|
||||||
|
|
||||||
### Basic GraphQL requests
|
|
||||||
|
|
||||||
### Queries
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const todos = await client.query.todos({
|
|
||||||
select: { createdAt: true, contents: true, user: { select: { displayName: true } } }
|
|
||||||
})
|
|
||||||
|
|
||||||
todos.map(({ createdAt, contents, user: { displayName } }) => {
|
|
||||||
console.log(`${displayName} created the following todo at ${createdAt}: ${contents}`)
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
Select all scalar fields:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const todos = await client.query.todos()
|
|
||||||
|
|
||||||
todos.map(({ createdAt, contents }) => {
|
|
||||||
console.log(`Todo created at ${createdAt}: ${contents}`)
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
Pass on parameters:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const todos = await client.query.todos({
|
|
||||||
variables: { where: { contents: { _eq: 'document the sdk' } } },
|
|
||||||
select: { createdAt: true, contents: true, user: { select: { displayName: true } } }
|
|
||||||
})
|
|
||||||
|
|
||||||
todos.map(({ createdAt, contents }) => {
|
|
||||||
console.log(`${displayName} created the following todo at ${createdAt}: ${contents}`)
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mutations
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const { id } = await client.mutation.insertTodo({
|
|
||||||
select: { id: true },
|
|
||||||
variables: { contents: 'document the sdk', userId: 'xxx-yyy-zzz' }
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Enums
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const todos = await client.query.todos({
|
|
||||||
variables: {
|
|
||||||
where: {
|
|
||||||
category: { _eq: 'essay' } // the client detects 'essay' is a GraphQL enum value
|
|
||||||
}
|
|
||||||
},
|
|
||||||
contents: true,
|
|
||||||
category: true
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Unions
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const giraffes = await client.query
|
|
||||||
.giraffeFacts({
|
|
||||||
_on: {
|
|
||||||
GiraffeNumericFact: { value: true },
|
|
||||||
GiraffeStringFact: { fact: true }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.run()
|
|
||||||
|
|
||||||
giraffes.forEach((giraffe) => {
|
|
||||||
if (giraffe.__typename === 'GiraffeNumericFact') {
|
|
||||||
// * We are in the GiraffeNumericFact fragment: only `value` is available
|
|
||||||
console.log('Value:', giraffe.value)
|
|
||||||
} else {
|
|
||||||
// * We are in the GiraffeStringFact fragment: only `fact` is available
|
|
||||||
console.log('Fact:', giraffe.fact)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Interfaces
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
[https://docs.nhost.io/reference/javascript/graphql](https://docs.nhost.io/reference/javascript/graphql)
|
[https://docs.nhost.io/reference/javascript/graphql](https://docs.nhost.io/reference/javascript/graphql)
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
import SchemaBuilder from '@pothos/core'
|
|
||||||
import { createYoga } from 'graphql-yoga'
|
|
||||||
|
|
||||||
class Human {
|
|
||||||
public pets: Pet[] = []
|
|
||||||
constructor(public phoneNumber: string, public firstName: string) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Pet {
|
|
||||||
name: string
|
|
||||||
diet: Diet
|
|
||||||
owner: Human
|
|
||||||
constructor(name: string, diet: Diet, owner: Human) {
|
|
||||||
this.name = name
|
|
||||||
this.diet = diet
|
|
||||||
this.owner = owner
|
|
||||||
}
|
|
||||||
// constructor(public name: string, public diet: Diet, public owner: Human) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Diet {
|
|
||||||
HERBIVOROUS,
|
|
||||||
CARNIVOROUS,
|
|
||||||
OMNIVORIOUS
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Dog extends Pet {
|
|
||||||
constructor(name: string, owner: Human, public barks: boolean) {
|
|
||||||
super(name, Diet.CARNIVOROUS, owner)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Hamster extends Pet {
|
|
||||||
constructor(name: string, owner: Human, public squeaks: boolean) {
|
|
||||||
super(name, Diet.HERBIVOROUS, owner)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const human1 = new Human('123-456-7890', 'John')
|
|
||||||
const dog1 = new Dog('Fido', human1, false)
|
|
||||||
const dog2 = new Dog('Rover', human1, true)
|
|
||||||
const hamster1 = new Hamster('Hammy', human1, true)
|
|
||||||
human1.pets = [dog1, dog2, hamster1]
|
|
||||||
|
|
||||||
const builder = new SchemaBuilder<{
|
|
||||||
Objects: {
|
|
||||||
Pet: Pet
|
|
||||||
Human: Human
|
|
||||||
Dog: Dog
|
|
||||||
}
|
|
||||||
}>({})
|
|
||||||
|
|
||||||
const HumanObject = builder.objectType('Human', {
|
|
||||||
fields: (t) => ({
|
|
||||||
phoneNumber: t.exposeString('phoneNumber', {}),
|
|
||||||
firstName: t.exposeString('firstName', {}),
|
|
||||||
pets: t.field({
|
|
||||||
type: [Pet],
|
|
||||||
resolve: (h) => h.pets
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const PetObject = builder.interfaceType(Pet, {
|
|
||||||
name: 'Pet',
|
|
||||||
fields: (t) => ({
|
|
||||||
name: t.exposeString('name', {}),
|
|
||||||
owner: t.field({ type: HumanObject, resolve: (p) => p.owner }),
|
|
||||||
diet: t.expose('diet', {
|
|
||||||
type: Diet
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const DogObject = builder.objectType('Dog', {
|
|
||||||
interfaces: [Pet],
|
|
||||||
isTypeOf: (value) => value instanceof Dog,
|
|
||||||
fields: (t) => ({
|
|
||||||
barks: t.exposeBoolean('barks', {})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const HamsterObject = builder.objectType(Hamster, {
|
|
||||||
name: 'Hamster',
|
|
||||||
interfaces: [Pet],
|
|
||||||
isTypeOf: (value) => value instanceof Hamster,
|
|
||||||
fields: (t) => ({
|
|
||||||
squeaks: t.exposeBoolean('squeaks', {})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
builder.enumType(Diet, {
|
|
||||||
name: 'Diet'
|
|
||||||
})
|
|
||||||
|
|
||||||
const Anyone = builder.unionType('Anyone', {
|
|
||||||
types: [DogObject, HamsterObject, HumanObject],
|
|
||||||
resolveType: (fact) => {
|
|
||||||
if (fact instanceof Human) {
|
|
||||||
return HumanObject
|
|
||||||
}
|
|
||||||
if (fact instanceof Dog) {
|
|
||||||
return DogObject
|
|
||||||
}
|
|
||||||
if (fact instanceof Hamster) {
|
|
||||||
return HamsterObject
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
builder.queryField('everyone', (t) =>
|
|
||||||
t.field({
|
|
||||||
type: [Anyone],
|
|
||||||
resolve: () => {
|
|
||||||
return [human1, dog1, dog2, hamster1]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
builder.queryField('pets', (t) =>
|
|
||||||
t.field({ type: [PetObject], resolve: () => [dog1, dog2, hamster1] })
|
|
||||||
)
|
|
||||||
builder.queryField('dogs', (t) => t.field({ type: [DogObject], resolve: () => [dog1, dog2] }))
|
|
||||||
builder.queryField('hamsters', (t) => t.field({ type: [HamsterObject], resolve: () => [hamster1] }))
|
|
||||||
|
|
||||||
builder.queryType({})
|
|
||||||
|
|
||||||
export default createYoga({
|
|
||||||
schema: builder.toSchema(),
|
|
||||||
graphqlEndpoint: '/'
|
|
||||||
})
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "functions",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"@pothos/core": "^3.24.0",
|
|
||||||
"@types/node": "^18.11.18",
|
|
||||||
"graphql-yoga": "^3.3.0",
|
|
||||||
"graphql": "^16.6.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"declaration": true,
|
|
||||||
"declarationMap": true,
|
|
||||||
"strict": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"target": "ES6",
|
|
||||||
"module": "CommonJS",
|
|
||||||
"types": [
|
|
||||||
"node"
|
|
||||||
],
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"sourceMap": true
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,366 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@envelop/core@3.0.4":
|
|
||||||
version "3.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/@envelop/core/-/core-3.0.4.tgz#6801049bed24487599b4ffa0f836f70cb62714fc"
|
|
||||||
integrity sha512-AybIZxQsDlFQTWHy6YtX/MSQPVuw+eOFtTW90JsHn6EbmcQnD6N3edQfSiTGjggPRHLoC0+0cuYXp2Ly2r3vrQ==
|
|
||||||
dependencies:
|
|
||||||
"@envelop/types" "3.0.1"
|
|
||||||
tslib "2.4.0"
|
|
||||||
|
|
||||||
"@envelop/parser-cache@^5.0.4":
|
|
||||||
version "5.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/@envelop/parser-cache/-/parser-cache-5.0.4.tgz#4ff19c16c601c6137a6774fc5660f2e18768c05c"
|
|
||||||
integrity sha512-+kp6nzCVLYI2WQExQcE3FSy6n9ZGB5GYi+ntyjYdxaXU41U1f8RVwiLdyh0Ewn5D/s/zaLin09xkFKITVSAKDw==
|
|
||||||
dependencies:
|
|
||||||
lru-cache "^6.0.0"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
"@envelop/types@3.0.1":
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@envelop/types/-/types-3.0.1.tgz#0afec3b3f1ab282bc828e6c42c5e26d76ffe363c"
|
|
||||||
integrity sha512-Ok62K1K+rlS+wQw77k8Pis8+1/h7+/9Wk5Fgcc2U6M5haEWsLFAHcHsk8rYlnJdEUl2Y3yJcCSOYbt1dyTaU5w==
|
|
||||||
dependencies:
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
"@envelop/validation-cache@^5.0.5":
|
|
||||||
version "5.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/@envelop/validation-cache/-/validation-cache-5.0.5.tgz#9be1c1ba178460dcaf6d277136a381833cc4f931"
|
|
||||||
integrity sha512-69sq5H7hvxE+7VV60i0bgnOiV1PX9GEJHKrBrVvyEZAXqYojKO3DP9jnLGryiPgVaBjN5yw12ge0l0s2gXbolQ==
|
|
||||||
dependencies:
|
|
||||||
lru-cache "^6.0.0"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
"@graphql-tools/executor@0.0.12":
|
|
||||||
version "0.0.12"
|
|
||||||
resolved "https://registry.yarnpkg.com/@graphql-tools/executor/-/executor-0.0.12.tgz#d885c7fa98a8aaeaa771163b71fb98ce9f52f9bd"
|
|
||||||
integrity sha512-bWpZcYRo81jDoTVONTnxS9dDHhEkNVjxzvFCH4CRpuyzD3uL+5w3MhtxIh24QyWm4LvQ4f+Bz3eMV2xU2I5+FA==
|
|
||||||
dependencies:
|
|
||||||
"@graphql-tools/utils" "9.1.4"
|
|
||||||
"@graphql-typed-document-node/core" "3.1.1"
|
|
||||||
"@repeaterjs/repeater" "3.0.4"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
value-or-promise "1.0.12"
|
|
||||||
|
|
||||||
"@graphql-tools/merge@8.3.16":
|
|
||||||
version "8.3.16"
|
|
||||||
resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-8.3.16.tgz#fede610687b148e34ff861e8b038dcd71e20039b"
|
|
||||||
integrity sha512-In0kcOZcPIpYOKaqdrJ3thdLPE7TutFnL9tbrHUy2zCinR2O/blpRC48jPckcs0HHrUQ0pGT4HqvzMkZUeEBAw==
|
|
||||||
dependencies:
|
|
||||||
"@graphql-tools/utils" "9.1.4"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
"@graphql-tools/schema@^9.0.0":
|
|
||||||
version "9.0.14"
|
|
||||||
resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-9.0.14.tgz#9a658ab82d5a7d4db73f68a44900d4c88a98f0bc"
|
|
||||||
integrity sha512-U6k+HY3Git+dsOEhq+dtWQwYg2CAgue8qBvnBXoKu5eEeH284wymMUoNm0e4IycOgMCJANVhClGEBIkLRu3FQQ==
|
|
||||||
dependencies:
|
|
||||||
"@graphql-tools/merge" "8.3.16"
|
|
||||||
"@graphql-tools/utils" "9.1.4"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
value-or-promise "1.0.12"
|
|
||||||
|
|
||||||
"@graphql-tools/utils@9.1.4", "@graphql-tools/utils@^9.0.1":
|
|
||||||
version "9.1.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-9.1.4.tgz#2c9e0aefc9655dd73247667befe3c850ec014f3f"
|
|
||||||
integrity sha512-hgIeLt95h9nQgQuzbbdhuZmh+8WV7RZ/6GbTj6t3IU4Zd2zs9yYJ2jgW/krO587GMOY8zCwrjNOMzD40u3l7Vg==
|
|
||||||
dependencies:
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
"@graphql-typed-document-node/core@3.1.1":
|
|
||||||
version "3.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052"
|
|
||||||
integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg==
|
|
||||||
|
|
||||||
"@graphql-yoga/subscription@^3.1.0":
|
|
||||||
version "3.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@graphql-yoga/subscription/-/subscription-3.1.0.tgz#4a0bb0b9db2602d02c68f9828603e1e40329140b"
|
|
||||||
integrity sha512-Vc9lh8KzIHyS3n4jBlCbz7zCjcbtQnOBpsymcRvHhFr2cuH+knmRn0EmzimMQ58jQ8kxoRXXC3KJS3RIxSdPIg==
|
|
||||||
dependencies:
|
|
||||||
"@graphql-yoga/typed-event-target" "^1.0.0"
|
|
||||||
"@repeaterjs/repeater" "^3.0.4"
|
|
||||||
"@whatwg-node/events" "0.0.2"
|
|
||||||
tslib "^2.3.1"
|
|
||||||
|
|
||||||
"@graphql-yoga/typed-event-target@^1.0.0":
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@graphql-yoga/typed-event-target/-/typed-event-target-1.0.0.tgz#dae3c0146f08a4dc30b5b890f8bab706c2b62199"
|
|
||||||
integrity sha512-Mqni6AEvl3VbpMtKw+TIjc9qS9a8hKhiAjFtqX488yq5oJtj9TkNlFTIacAVS3vnPiswNsmDiQqvwUOcJgi1DA==
|
|
||||||
dependencies:
|
|
||||||
"@repeaterjs/repeater" "^3.0.4"
|
|
||||||
tslib "^2.3.1"
|
|
||||||
|
|
||||||
"@peculiar/asn1-schema@^2.1.6", "@peculiar/asn1-schema@^2.3.0":
|
|
||||||
version "2.3.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.3.tgz#21418e1f3819e0b353ceff0c2dad8ccb61acd777"
|
|
||||||
integrity sha512-6GptMYDMyWBHTUKndHaDsRZUO/XMSgIns2krxcm2L7SEExRHwawFvSwNBhqNPR9HJwv3MruAiF1bhN0we6j6GQ==
|
|
||||||
dependencies:
|
|
||||||
asn1js "^3.0.5"
|
|
||||||
pvtsutils "^1.3.2"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
"@peculiar/json-schema@^1.1.12":
|
|
||||||
version "1.1.12"
|
|
||||||
resolved "https://registry.yarnpkg.com/@peculiar/json-schema/-/json-schema-1.1.12.tgz#fe61e85259e3b5ba5ad566cb62ca75b3d3cd5339"
|
|
||||||
integrity sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w==
|
|
||||||
dependencies:
|
|
||||||
tslib "^2.0.0"
|
|
||||||
|
|
||||||
"@peculiar/webcrypto@^1.4.0":
|
|
||||||
version "1.4.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.1.tgz#821493bd5ad0f05939bd5f53b28536f68158360a"
|
|
||||||
integrity sha512-eK4C6WTNYxoI7JOabMoZICiyqRRtJB220bh0Mbj5RwRycleZf9BPyZoxsTvpP0FpmVS2aS13NKOuh5/tN3sIRw==
|
|
||||||
dependencies:
|
|
||||||
"@peculiar/asn1-schema" "^2.3.0"
|
|
||||||
"@peculiar/json-schema" "^1.1.12"
|
|
||||||
pvtsutils "^1.3.2"
|
|
||||||
tslib "^2.4.1"
|
|
||||||
webcrypto-core "^1.7.4"
|
|
||||||
|
|
||||||
"@pothos/core@^3.24.0":
|
|
||||||
version "3.24.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@pothos/core/-/core-3.24.0.tgz#1a555c501c9fc09c588196f83e6b0075571a59c5"
|
|
||||||
integrity sha512-LfWzUrmjhg9WQNUntQMJWOfMLb51AMunqBOC66zWEIi2GR4IcAQCPwzy77713Zd/awtIInIuHv4x5/1whAWeeA==
|
|
||||||
|
|
||||||
"@repeaterjs/repeater@3.0.4", "@repeaterjs/repeater@^3.0.4":
|
|
||||||
version "3.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/@repeaterjs/repeater/-/repeater-3.0.4.tgz#a04d63f4d1bf5540a41b01a921c9a7fddc3bd1ca"
|
|
||||||
integrity sha512-AW8PKd6iX3vAZ0vA43nOUOnbq/X5ihgU+mSXXqunMkeQADGiqw/PY0JNeYtD5sr0PAy51YPgAPbDoeapv9r8WA==
|
|
||||||
|
|
||||||
"@types/node@^18.11.18":
|
|
||||||
version "18.11.18"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f"
|
|
||||||
integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==
|
|
||||||
|
|
||||||
"@whatwg-node/events@0.0.2":
|
|
||||||
version "0.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@whatwg-node/events/-/events-0.0.2.tgz#7b7107268d2982fc7b7aff5ee6803c64018f84dd"
|
|
||||||
integrity sha512-WKj/lI4QjnLuPrim0cfO7i+HsDSXHxNv1y0CrJhdntuO3hxWZmnXCwNDnwOvry11OjRin6cgWNF+j/9Pn8TN4w==
|
|
||||||
|
|
||||||
"@whatwg-node/fetch@0.6.2":
|
|
||||||
version "0.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.6.2.tgz#fe4837505f6fc91bcfd6e12cdcec66f4aecfeecc"
|
|
||||||
integrity sha512-fCUycF1W+bI6XzwJFnbdDuxIldfKM3w8+AzVCLGlucm0D+AQ8ZMm2j84hdcIhfV6ZdE4Y1HFVrHosAxdDZ+nPw==
|
|
||||||
dependencies:
|
|
||||||
"@peculiar/webcrypto" "^1.4.0"
|
|
||||||
abort-controller "^3.0.0"
|
|
||||||
busboy "^1.6.0"
|
|
||||||
form-data-encoder "^1.7.1"
|
|
||||||
formdata-node "^4.3.1"
|
|
||||||
node-fetch "^2.6.7"
|
|
||||||
undici "^5.12.0"
|
|
||||||
urlpattern-polyfill "^6.0.2"
|
|
||||||
web-streams-polyfill "^3.2.0"
|
|
||||||
|
|
||||||
"@whatwg-node/server@0.5.8":
|
|
||||||
version "0.5.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/@whatwg-node/server/-/server-0.5.8.tgz#e47aa4535431b6703652809dc4f7e5ebac6bffdb"
|
|
||||||
integrity sha512-29f2Ijk663Hr6hF5GU5a8ELGQVbNMMDBWF1lTdpIKGyLrLJTKixarp6COEyEN5H9tGzIRUQar9Z76A+Jb9DyzQ==
|
|
||||||
dependencies:
|
|
||||||
"@whatwg-node/fetch" "0.6.2"
|
|
||||||
tslib "^2.3.1"
|
|
||||||
|
|
||||||
abort-controller@^3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
|
|
||||||
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
|
|
||||||
dependencies:
|
|
||||||
event-target-shim "^5.0.0"
|
|
||||||
|
|
||||||
asn1js@^3.0.1, asn1js@^3.0.5:
|
|
||||||
version "3.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38"
|
|
||||||
integrity sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ==
|
|
||||||
dependencies:
|
|
||||||
pvtsutils "^1.3.2"
|
|
||||||
pvutils "^1.1.3"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
braces@^3.0.2:
|
|
||||||
version "3.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
|
|
||||||
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
|
|
||||||
dependencies:
|
|
||||||
fill-range "^7.0.1"
|
|
||||||
|
|
||||||
busboy@^1.6.0:
|
|
||||||
version "1.6.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893"
|
|
||||||
integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==
|
|
||||||
dependencies:
|
|
||||||
streamsearch "^1.1.0"
|
|
||||||
|
|
||||||
dset@^3.1.1:
|
|
||||||
version "3.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.2.tgz#89c436ca6450398396dc6538ea00abc0c54cd45a"
|
|
||||||
integrity sha512-g/M9sqy3oHe477Ar4voQxWtaPIFw1jTdKZuomOjhCcBx9nHUNn0pu6NopuFFrTh/TRZIKEj+76vLWFu9BNKk+Q==
|
|
||||||
|
|
||||||
event-target-shim@^5.0.0:
|
|
||||||
version "5.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
|
|
||||||
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
|
|
||||||
|
|
||||||
fill-range@^7.0.1:
|
|
||||||
version "7.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
|
||||||
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
|
|
||||||
dependencies:
|
|
||||||
to-regex-range "^5.0.1"
|
|
||||||
|
|
||||||
form-data-encoder@^1.7.1:
|
|
||||||
version "1.7.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040"
|
|
||||||
integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==
|
|
||||||
|
|
||||||
formdata-node@^4.3.1:
|
|
||||||
version "4.4.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.4.1.tgz#23f6a5cb9cb55315912cbec4ff7b0f59bbd191e2"
|
|
||||||
integrity sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==
|
|
||||||
dependencies:
|
|
||||||
node-domexception "1.0.0"
|
|
||||||
web-streams-polyfill "4.0.0-beta.3"
|
|
||||||
|
|
||||||
graphql-yoga@^3.3.0:
|
|
||||||
version "3.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-3.4.0.tgz#9ab03552edb1f9ec0d877566ee7f0ecb23726dd7"
|
|
||||||
integrity sha512-Cjx60mmpoK1qL/sLdM285VdAOQyJBKLuC6oMZrfO8QleneNtu0nDOM6Efv5m0IrRYSONEMtIYA7eNr0u/cCBfg==
|
|
||||||
dependencies:
|
|
||||||
"@envelop/core" "3.0.4"
|
|
||||||
"@envelop/parser-cache" "^5.0.4"
|
|
||||||
"@envelop/validation-cache" "^5.0.5"
|
|
||||||
"@graphql-tools/executor" "0.0.12"
|
|
||||||
"@graphql-tools/schema" "^9.0.0"
|
|
||||||
"@graphql-tools/utils" "^9.0.1"
|
|
||||||
"@graphql-yoga/subscription" "^3.1.0"
|
|
||||||
"@whatwg-node/fetch" "0.6.2"
|
|
||||||
"@whatwg-node/server" "0.5.8"
|
|
||||||
dset "^3.1.1"
|
|
||||||
tslib "^2.3.1"
|
|
||||||
|
|
||||||
graphql@^16.6.0:
|
|
||||||
version "16.6.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.6.0.tgz#c2dcffa4649db149f6282af726c8c83f1c7c5fdb"
|
|
||||||
integrity sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==
|
|
||||||
|
|
||||||
is-number@^7.0.0:
|
|
||||||
version "7.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
|
||||||
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
|
|
||||||
|
|
||||||
lru-cache@^6.0.0:
|
|
||||||
version "6.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
|
||||||
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
|
|
||||||
dependencies:
|
|
||||||
yallist "^4.0.0"
|
|
||||||
|
|
||||||
node-domexception@1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
|
||||||
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
|
||||||
|
|
||||||
node-fetch@^2.6.7:
|
|
||||||
version "2.6.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.8.tgz#a68d30b162bc1d8fd71a367e81b997e1f4d4937e"
|
|
||||||
integrity sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==
|
|
||||||
dependencies:
|
|
||||||
whatwg-url "^5.0.0"
|
|
||||||
|
|
||||||
pvtsutils@^1.3.2:
|
|
||||||
version "1.3.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.2.tgz#9f8570d132cdd3c27ab7d51a2799239bf8d8d5de"
|
|
||||||
integrity sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ==
|
|
||||||
dependencies:
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
pvutils@^1.1.3:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3"
|
|
||||||
integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==
|
|
||||||
|
|
||||||
streamsearch@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764"
|
|
||||||
integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==
|
|
||||||
|
|
||||||
to-regex-range@^5.0.1:
|
|
||||||
version "5.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
|
||||||
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
|
|
||||||
dependencies:
|
|
||||||
is-number "^7.0.0"
|
|
||||||
|
|
||||||
tr46@~0.0.3:
|
|
||||||
version "0.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
|
|
||||||
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
|
|
||||||
|
|
||||||
tslib@2.4.0:
|
|
||||||
version "2.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
|
|
||||||
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==
|
|
||||||
|
|
||||||
tslib@^2.0.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1:
|
|
||||||
version "2.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
|
|
||||||
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
|
|
||||||
|
|
||||||
undici@^5.12.0:
|
|
||||||
version "5.16.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/undici/-/undici-5.16.0.tgz#6b64f9b890de85489ac6332bd45ca67e4f7d9943"
|
|
||||||
integrity sha512-KWBOXNv6VX+oJQhchXieUznEmnJMqgXMbs0xxH2t8q/FUAWSJvOSr/rMaZKnX5RIVq7JDn0JbP4BOnKG2SGXLQ==
|
|
||||||
dependencies:
|
|
||||||
busboy "^1.6.0"
|
|
||||||
|
|
||||||
urlpattern-polyfill@^6.0.2:
|
|
||||||
version "6.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-6.0.2.tgz#a193fe773459865a2a5c93b246bb794b13d07256"
|
|
||||||
integrity sha512-5vZjFlH9ofROmuWmXM9yj2wljYKgWstGwe8YTyiqM7hVum/g9LyCizPZtb3UqsuppVwety9QJmfc42VggLpTgg==
|
|
||||||
dependencies:
|
|
||||||
braces "^3.0.2"
|
|
||||||
|
|
||||||
value-or-promise@1.0.12:
|
|
||||||
version "1.0.12"
|
|
||||||
resolved "https://registry.yarnpkg.com/value-or-promise/-/value-or-promise-1.0.12.tgz#0e5abfeec70148c78460a849f6b003ea7986f15c"
|
|
||||||
integrity sha512-Z6Uz+TYwEqE7ZN50gwn+1LCVo9ZVrpxRPOhOLnncYkY1ZzOYtrX8Fwf/rFktZ8R5mJms6EZf5TqNOMeZmnPq9Q==
|
|
||||||
|
|
||||||
web-streams-polyfill@4.0.0-beta.3:
|
|
||||||
version "4.0.0-beta.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz#2898486b74f5156095e473efe989dcf185047a38"
|
|
||||||
integrity sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==
|
|
||||||
|
|
||||||
web-streams-polyfill@^3.2.0:
|
|
||||||
version "3.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6"
|
|
||||||
integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==
|
|
||||||
|
|
||||||
webcrypto-core@^1.7.4:
|
|
||||||
version "1.7.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.5.tgz#c02104c953ca7107557f9c165d194c6316587ca4"
|
|
||||||
integrity sha512-gaExY2/3EHQlRNNNVSrbG2Cg94Rutl7fAaKILS1w8ZDhGxdFOaw6EbCfHIxPy9vt/xwp5o0VQAx9aySPF6hU1A==
|
|
||||||
dependencies:
|
|
||||||
"@peculiar/asn1-schema" "^2.1.6"
|
|
||||||
"@peculiar/json-schema" "^1.1.12"
|
|
||||||
asn1js "^3.0.1"
|
|
||||||
pvtsutils "^1.3.2"
|
|
||||||
tslib "^2.4.0"
|
|
||||||
|
|
||||||
webidl-conversions@^3.0.0:
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
|
||||||
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
|
|
||||||
|
|
||||||
whatwg-url@^5.0.0:
|
|
||||||
version "5.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
|
|
||||||
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
|
|
||||||
dependencies:
|
|
||||||
tr46 "~0.0.3"
|
|
||||||
webidl-conversions "^3.0.0"
|
|
||||||
|
|
||||||
yallist@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
|
||||||
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
metadata_directory: metadata
|
|
||||||
services:
|
|
||||||
hasura:
|
|
||||||
image: hasura/graphql-engine:v2.15.2
|
|
||||||
environment:
|
|
||||||
hasura_graphql_enable_remote_schema_permissions: false
|
|
||||||
auth:
|
|
||||||
image: nhost/hasura-auth:0.16.2
|
|
||||||
storage:
|
|
||||||
image: nhost/hasura-storage:0.3.0
|
|
||||||
auth:
|
|
||||||
access_control:
|
|
||||||
email:
|
|
||||||
allowed_email_domains: ''
|
|
||||||
allowed_emails: ''
|
|
||||||
blocked_email_domains: ''
|
|
||||||
blocked_emails: ''
|
|
||||||
allowed_redirect_urls: ''
|
|
||||||
anonymous_users_enabled: true
|
|
||||||
client_url: http://localhost:3000
|
|
||||||
disable_new_users: false
|
|
||||||
email:
|
|
||||||
signin_email_verified_required: false
|
|
||||||
passwordless:
|
|
||||||
enabled: true
|
|
||||||
template_fetch_url: ''
|
|
||||||
gravatar:
|
|
||||||
default: ''
|
|
||||||
enabled: true
|
|
||||||
rating: ''
|
|
||||||
locale:
|
|
||||||
allowed: en
|
|
||||||
default: en
|
|
||||||
password:
|
|
||||||
hibp_enabled: false
|
|
||||||
min_length: 3
|
|
||||||
provider:
|
|
||||||
apple:
|
|
||||||
client_id: ''
|
|
||||||
enabled: false
|
|
||||||
key_id: ''
|
|
||||||
private_key: ''
|
|
||||||
scope: name,email
|
|
||||||
team_id: ''
|
|
||||||
bitbucket:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
facebook:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: email,photos,displayName
|
|
||||||
github:
|
|
||||||
enabled: false
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
scope: user:email
|
|
||||||
token_url: ''
|
|
||||||
user_profile_url: ''
|
|
||||||
gitlab:
|
|
||||||
base_url: ''
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: read_user
|
|
||||||
google:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: email,profile
|
|
||||||
linkedin:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: r_emailaddress,r_liteprofile
|
|
||||||
spotify:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: user-read-email,user-read-private
|
|
||||||
strava:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
twilio:
|
|
||||||
account_sid: ''
|
|
||||||
auth_token: ''
|
|
||||||
enabled: false
|
|
||||||
messaging_service_id: ''
|
|
||||||
twitter:
|
|
||||||
consumer_key: ''
|
|
||||||
consumer_secret: ''
|
|
||||||
enabled: false
|
|
||||||
windows_live:
|
|
||||||
client_id: ''
|
|
||||||
client_secret: ''
|
|
||||||
enabled: false
|
|
||||||
scope: wl.basic,wl.emails,wl.contacts_emails
|
|
||||||
sms:
|
|
||||||
enabled: false
|
|
||||||
passwordless:
|
|
||||||
enabled: false
|
|
||||||
provider:
|
|
||||||
twilio:
|
|
||||||
account_sid: ''
|
|
||||||
auth_token: ''
|
|
||||||
from: ''
|
|
||||||
messaging_service_id: ''
|
|
||||||
smtp:
|
|
||||||
host: mailhog
|
|
||||||
method: ''
|
|
||||||
pass: password
|
|
||||||
port: 1025
|
|
||||||
secure: false
|
|
||||||
sender: hasura-auth@example.com
|
|
||||||
user: user
|
|
||||||
token:
|
|
||||||
access:
|
|
||||||
expires_in: 900
|
|
||||||
refresh:
|
|
||||||
expires_in: 43200
|
|
||||||
user:
|
|
||||||
allowed_roles: user,me
|
|
||||||
default_allowed_roles: user,me
|
|
||||||
default_role: user
|
|
||||||
mfa:
|
|
||||||
enabled: true
|
|
||||||
issuer: nhost
|
|
||||||
storage:
|
|
||||||
force_download_for_content_types: text/html,application/javascript
|
|
||||||
version: 3
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Confirm Email Change</h2>
|
|
||||||
<p>Use this link to confirm changing email:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Change email </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Change your email address
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Verify Email</h2>
|
|
||||||
<p>Use this link to verify your email:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Verify Email </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Verify your email
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Reset Password</h2>
|
|
||||||
<p>Use this link to reset your password:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Reset password </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Reset your password
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Magic Link</h2>
|
|
||||||
<p>Use this link to securely sign in:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Sign In </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Secure sign-in link
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Confirmer changement de courriel</h2>
|
|
||||||
<p>Utilisez ce lien pour confirmer le changement de courriel:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Changer courriel </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Changez votre adresse courriel
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Vérifiez votre courriel</h2>
|
|
||||||
<p>Utilisez ce lien pour vérifier votre courriel:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Vérifier courriel </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Vérifier votre courriel
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Réinitializer votre mot de passe</h2>
|
|
||||||
<p>Utilisez ce lien pour réinitializer votre mot de passe:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Réinitializer mot de passe </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Réinitialiser votre mot de passe
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h2>Lien magique</h2>
|
|
||||||
<p>Utilisez ce lien pour vous connecter de façon sécuritaire:</p>
|
|
||||||
<p>
|
|
||||||
<a href="${link}"> Connexion </a>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Lien de connexion sécurisé
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
actions: []
|
|
||||||
custom_types:
|
|
||||||
enums: []
|
|
||||||
input_objects: []
|
|
||||||
objects: []
|
|
||||||
scalars: []
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
- name: default
|
|
||||||
kind: postgres
|
|
||||||
configuration:
|
|
||||||
connection_info:
|
|
||||||
database_url:
|
|
||||||
from_env: HASURA_GRAPHQL_DATABASE_URL
|
|
||||||
isolation_level: read-committed
|
|
||||||
pool_settings:
|
|
||||||
connection_lifetime: 600
|
|
||||||
idle_timeout: 180
|
|
||||||
max_connections: 50
|
|
||||||
retries: 20
|
|
||||||
use_prepared_statements: true
|
|
||||||
tables: "!include default/tables/tables.yaml"
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
table:
|
|
||||||
name: provider_requests
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
options:
|
|
||||||
custom_name: options
|
|
||||||
custom_column_names:
|
|
||||||
id: id
|
|
||||||
options: options
|
|
||||||
custom_name: authProviderRequests
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthProviderRequests
|
|
||||||
delete_by_pk: deleteAuthProviderRequest
|
|
||||||
insert: insertAuthProviderRequests
|
|
||||||
insert_one: insertAuthProviderRequest
|
|
||||||
select: authProviderRequests
|
|
||||||
select_aggregate: authProviderRequestsAggregate
|
|
||||||
select_by_pk: authProviderRequest
|
|
||||||
update: updateAuthProviderRequests
|
|
||||||
update_by_pk: updateAuthProviderRequest
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
table:
|
|
||||||
name: providers
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
custom_column_names:
|
|
||||||
id: id
|
|
||||||
custom_name: authProviders
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthProviders
|
|
||||||
delete_by_pk: deleteAuthProvider
|
|
||||||
insert: insertAuthProviders
|
|
||||||
insert_one: insertAuthProvider
|
|
||||||
select: authProviders
|
|
||||||
select_aggregate: authProvidersAggregate
|
|
||||||
select_by_pk: authProvider
|
|
||||||
update: updateAuthProviders
|
|
||||||
update_by_pk: updateAuthProvider
|
|
||||||
array_relationships:
|
|
||||||
- name: userProviders
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: provider_id
|
|
||||||
table:
|
|
||||||
name: user_providers
|
|
||||||
schema: auth
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
table:
|
|
||||||
name: refresh_tokens
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
expires_at:
|
|
||||||
custom_name: expiresAt
|
|
||||||
refresh_token:
|
|
||||||
custom_name: refreshToken
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
created_at: createdAt
|
|
||||||
expires_at: expiresAt
|
|
||||||
refresh_token: refreshToken
|
|
||||||
user_id: userId
|
|
||||||
custom_name: authRefreshTokens
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthRefreshTokens
|
|
||||||
delete_by_pk: deleteAuthRefreshToken
|
|
||||||
insert: insertAuthRefreshTokens
|
|
||||||
insert_one: insertAuthRefreshToken
|
|
||||||
select: authRefreshTokens
|
|
||||||
select_aggregate: authRefreshTokensAggregate
|
|
||||||
select_by_pk: authRefreshToken
|
|
||||||
update: updateAuthRefreshTokens
|
|
||||||
update_by_pk: updateAuthRefreshToken
|
|
||||||
object_relationships:
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
table:
|
|
||||||
name: roles
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
role:
|
|
||||||
custom_name: role
|
|
||||||
custom_column_names:
|
|
||||||
role: role
|
|
||||||
custom_name: authRoles
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthRoles
|
|
||||||
delete_by_pk: deleteAuthRole
|
|
||||||
insert: insertAuthRoles
|
|
||||||
insert_one: insertAuthRole
|
|
||||||
select: authRoles
|
|
||||||
select_aggregate: authRolesAggregate
|
|
||||||
select_by_pk: authRole
|
|
||||||
update: updateAuthRoles
|
|
||||||
update_by_pk: updateAuthRole
|
|
||||||
array_relationships:
|
|
||||||
- name: userRoles
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: role
|
|
||||||
table:
|
|
||||||
name: user_roles
|
|
||||||
schema: auth
|
|
||||||
- name: usersByDefaultRole
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: default_role
|
|
||||||
table:
|
|
||||||
name: users
|
|
||||||
schema: auth
|
|
||||||
select_permissions:
|
|
||||||
- role: anonymous
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- role
|
|
||||||
filter: {}
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- role
|
|
||||||
filter: {}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
table:
|
|
||||||
name: user_providers
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
access_token:
|
|
||||||
custom_name: accessToken
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
provider_id:
|
|
||||||
custom_name: providerId
|
|
||||||
provider_user_id:
|
|
||||||
custom_name: providerUserId
|
|
||||||
refresh_token:
|
|
||||||
custom_name: refreshToken
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
access_token: accessToken
|
|
||||||
created_at: createdAt
|
|
||||||
id: id
|
|
||||||
provider_id: providerId
|
|
||||||
provider_user_id: providerUserId
|
|
||||||
refresh_token: refreshToken
|
|
||||||
updated_at: updatedAt
|
|
||||||
user_id: userId
|
|
||||||
custom_name: authUserProviders
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthUserProviders
|
|
||||||
delete_by_pk: deleteAuthUserProvider
|
|
||||||
insert: insertAuthUserProviders
|
|
||||||
insert_one: insertAuthUserProvider
|
|
||||||
select: authUserProviders
|
|
||||||
select_aggregate: authUserProvidersAggregate
|
|
||||||
select_by_pk: authUserProvider
|
|
||||||
update: updateAuthUserProviders
|
|
||||||
update_by_pk: updateAuthUserProvider
|
|
||||||
object_relationships:
|
|
||||||
- name: provider
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: provider_id
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
table:
|
|
||||||
name: user_roles
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
role:
|
|
||||||
custom_name: role
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
created_at: createdAt
|
|
||||||
id: id
|
|
||||||
role: role
|
|
||||||
user_id: userId
|
|
||||||
custom_name: authUserRoles
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthUserRoles
|
|
||||||
delete_by_pk: deleteAuthUserRole
|
|
||||||
insert: insertAuthUserRoles
|
|
||||||
insert_one: insertAuthUserRole
|
|
||||||
select: authUserRoles
|
|
||||||
select_aggregate: authUserRolesAggregate
|
|
||||||
select_by_pk: authUserRole
|
|
||||||
update: updateAuthUserRoles
|
|
||||||
update_by_pk: updateAuthUserRole
|
|
||||||
object_relationships:
|
|
||||||
- name: roleByRole
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: role
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
select_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- role
|
|
||||||
- created_at
|
|
||||||
- id
|
|
||||||
- user_id
|
|
||||||
filter: {}
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- role
|
|
||||||
- user_id
|
|
||||||
filter: {}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
table:
|
|
||||||
name: user_security_keys
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
credential_id:
|
|
||||||
custom_name: credentialId
|
|
||||||
credential_public_key:
|
|
||||||
custom_name: credentialPublicKey
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
credential_id: credentialId
|
|
||||||
credential_public_key: credentialPublicKey
|
|
||||||
id: id
|
|
||||||
user_id: userId
|
|
||||||
custom_name: authUserSecurityKeys
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteAuthUserSecurityKeys
|
|
||||||
delete_by_pk: deleteAuthUserSecurityKey
|
|
||||||
insert: insertAuthUserSecurityKeys
|
|
||||||
insert_one: insertAuthUserSecurityKey
|
|
||||||
select: authUserSecurityKeys
|
|
||||||
select_aggregate: authUserSecurityKeysAggregate
|
|
||||||
select_by_pk: authUserSecurityKey
|
|
||||||
update: updateAuthUserSecurityKeys
|
|
||||||
update_by_pk: updateAuthUserSecurityKey
|
|
||||||
object_relationships:
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
table:
|
|
||||||
name: users
|
|
||||||
schema: auth
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
active_mfa_type:
|
|
||||||
custom_name: activeMfaType
|
|
||||||
avatar_url:
|
|
||||||
custom_name: avatarUrl
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
default_role:
|
|
||||||
custom_name: defaultRole
|
|
||||||
disabled:
|
|
||||||
custom_name: disabled
|
|
||||||
display_name:
|
|
||||||
custom_name: displayName
|
|
||||||
email:
|
|
||||||
custom_name: email
|
|
||||||
email_verified:
|
|
||||||
custom_name: emailVerified
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
is_anonymous:
|
|
||||||
custom_name: isAnonymous
|
|
||||||
last_seen:
|
|
||||||
custom_name: lastSeen
|
|
||||||
locale:
|
|
||||||
custom_name: locale
|
|
||||||
new_email:
|
|
||||||
custom_name: newEmail
|
|
||||||
otp_hash:
|
|
||||||
custom_name: otpHash
|
|
||||||
otp_hash_expires_at:
|
|
||||||
custom_name: otpHashExpiresAt
|
|
||||||
otp_method_last_used:
|
|
||||||
custom_name: otpMethodLastUsed
|
|
||||||
password_hash:
|
|
||||||
custom_name: passwordHash
|
|
||||||
phone_number:
|
|
||||||
custom_name: phoneNumber
|
|
||||||
phone_number_verified:
|
|
||||||
custom_name: phoneNumberVerified
|
|
||||||
ticket:
|
|
||||||
custom_name: ticket
|
|
||||||
ticket_expires_at:
|
|
||||||
custom_name: ticketExpiresAt
|
|
||||||
totp_secret:
|
|
||||||
custom_name: totpSecret
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
webauthn_current_challenge:
|
|
||||||
custom_name: currentChallenge
|
|
||||||
custom_column_names:
|
|
||||||
active_mfa_type: activeMfaType
|
|
||||||
avatar_url: avatarUrl
|
|
||||||
created_at: createdAt
|
|
||||||
default_role: defaultRole
|
|
||||||
disabled: disabled
|
|
||||||
display_name: displayName
|
|
||||||
email: email
|
|
||||||
email_verified: emailVerified
|
|
||||||
id: id
|
|
||||||
is_anonymous: isAnonymous
|
|
||||||
last_seen: lastSeen
|
|
||||||
locale: locale
|
|
||||||
new_email: newEmail
|
|
||||||
otp_hash: otpHash
|
|
||||||
otp_hash_expires_at: otpHashExpiresAt
|
|
||||||
otp_method_last_used: otpMethodLastUsed
|
|
||||||
password_hash: passwordHash
|
|
||||||
phone_number: phoneNumber
|
|
||||||
phone_number_verified: phoneNumberVerified
|
|
||||||
ticket: ticket
|
|
||||||
ticket_expires_at: ticketExpiresAt
|
|
||||||
totp_secret: totpSecret
|
|
||||||
updated_at: updatedAt
|
|
||||||
webauthn_current_challenge: currentChallenge
|
|
||||||
custom_name: users
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteUsers
|
|
||||||
delete_by_pk: deleteUser
|
|
||||||
insert: insertUsers
|
|
||||||
insert_one: insertUser
|
|
||||||
select: users
|
|
||||||
select_aggregate: usersAggregate
|
|
||||||
select_by_pk: user
|
|
||||||
update: updateUsers
|
|
||||||
update_by_pk: updateUser
|
|
||||||
object_relationships:
|
|
||||||
- name: defaultRoleByRole
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: default_role
|
|
||||||
array_relationships:
|
|
||||||
- name: refreshTokens
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: refresh_tokens
|
|
||||||
schema: auth
|
|
||||||
- name: roles
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: user_roles
|
|
||||||
schema: auth
|
|
||||||
- name: securityKeys
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: user_security_keys
|
|
||||||
schema: auth
|
|
||||||
- name: userProviders
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: user_id
|
|
||||||
table:
|
|
||||||
name: user_providers
|
|
||||||
schema: auth
|
|
||||||
insert_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
check: {}
|
|
||||||
columns:
|
|
||||||
- avatar_url
|
|
||||||
- default_role
|
|
||||||
- display_name
|
|
||||||
- email
|
|
||||||
- locale
|
|
||||||
- metadata
|
|
||||||
select_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- avatar_url
|
|
||||||
- created_at
|
|
||||||
- default_role
|
|
||||||
- display_name
|
|
||||||
- email
|
|
||||||
- id
|
|
||||||
- is_anonymous
|
|
||||||
- last_seen
|
|
||||||
- locale
|
|
||||||
- updated_at
|
|
||||||
filter: {}
|
|
||||||
allow_aggregations: true
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- display_name
|
|
||||||
- email
|
|
||||||
- id
|
|
||||||
filter: {}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
table:
|
|
||||||
name: books
|
|
||||||
schema: public
|
|
||||||
select_permissions:
|
|
||||||
- permission:
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- title
|
|
||||||
filter: {}
|
|
||||||
role: user
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
table:
|
|
||||||
name: categories
|
|
||||||
schema: public
|
|
||||||
is_enum: true
|
|
||||||
select_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- comment
|
|
||||||
- value
|
|
||||||
filter: {}
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- comment
|
|
||||||
- value
|
|
||||||
filter: {}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
table:
|
|
||||||
name: tasks
|
|
||||||
schema: public
|
|
||||||
insert_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
check: {}
|
|
||||||
columns:
|
|
||||||
- description
|
|
||||||
- id
|
|
||||||
select_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- description
|
|
||||||
- id
|
|
||||||
filter: {}
|
|
||||||
allow_aggregations: true
|
|
||||||
update_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- description
|
|
||||||
- id
|
|
||||||
filter: {}
|
|
||||||
check: {}
|
|
||||||
delete_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
filter: {}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
table:
|
|
||||||
name: todos
|
|
||||||
schema: public
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
user_id:
|
|
||||||
custom_name: userId
|
|
||||||
custom_column_names:
|
|
||||||
created_at: createdAt
|
|
||||||
updated_at: updatedAt
|
|
||||||
user_id: userId
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteTodos
|
|
||||||
delete_by_pk: deleteTodo
|
|
||||||
insert: insertTodos
|
|
||||||
insert_one: insertTodo
|
|
||||||
select_aggregate: todosAggregate
|
|
||||||
select_by_pk: todo
|
|
||||||
update: updateTodos
|
|
||||||
update_by_pk: updateTodo
|
|
||||||
object_relationships:
|
|
||||||
- name: user
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: user_id
|
|
||||||
insert_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
check: {}
|
|
||||||
columns:
|
|
||||||
- category
|
|
||||||
- contents
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- user_id
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
check: {}
|
|
||||||
set:
|
|
||||||
user_id: x-hasura-user-id
|
|
||||||
columns:
|
|
||||||
- category
|
|
||||||
- contents
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- user_id
|
|
||||||
select_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- category
|
|
||||||
- contents
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- user_id
|
|
||||||
filter: {}
|
|
||||||
allow_aggregations: true
|
|
||||||
- role: user
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- category
|
|
||||||
- contents
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- user_id
|
|
||||||
filter: {}
|
|
||||||
update_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- category
|
|
||||||
- contents
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- user_id
|
|
||||||
filter: {}
|
|
||||||
check: {}
|
|
||||||
delete_permissions:
|
|
||||||
- role: public
|
|
||||||
permission:
|
|
||||||
filter: {}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
table:
|
|
||||||
name: buckets
|
|
||||||
schema: storage
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
cache_control:
|
|
||||||
custom_name: cacheControl
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
download_expiration:
|
|
||||||
custom_name: downloadExpiration
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
max_upload_file_size:
|
|
||||||
custom_name: maxUploadFileSize
|
|
||||||
min_upload_file_size:
|
|
||||||
custom_name: minUploadFileSize
|
|
||||||
presigned_urls_enabled:
|
|
||||||
custom_name: presignedUrlsEnabled
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
custom_column_names:
|
|
||||||
cache_control: cacheControl
|
|
||||||
created_at: createdAt
|
|
||||||
download_expiration: downloadExpiration
|
|
||||||
id: id
|
|
||||||
max_upload_file_size: maxUploadFileSize
|
|
||||||
min_upload_file_size: minUploadFileSize
|
|
||||||
presigned_urls_enabled: presignedUrlsEnabled
|
|
||||||
updated_at: updatedAt
|
|
||||||
custom_name: buckets
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteBuckets
|
|
||||||
delete_by_pk: deleteBucket
|
|
||||||
insert: insertBuckets
|
|
||||||
insert_one: insertBucket
|
|
||||||
select: buckets
|
|
||||||
select_aggregate: bucketsAggregate
|
|
||||||
select_by_pk: bucket
|
|
||||||
update: updateBuckets
|
|
||||||
update_by_pk: updateBucket
|
|
||||||
array_relationships:
|
|
||||||
- name: files
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on:
|
|
||||||
column: bucket_id
|
|
||||||
table:
|
|
||||||
name: files
|
|
||||||
schema: storage
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
table:
|
|
||||||
name: files
|
|
||||||
schema: storage
|
|
||||||
configuration:
|
|
||||||
column_config:
|
|
||||||
bucket_id:
|
|
||||||
custom_name: bucketId
|
|
||||||
created_at:
|
|
||||||
custom_name: createdAt
|
|
||||||
etag:
|
|
||||||
custom_name: etag
|
|
||||||
id:
|
|
||||||
custom_name: id
|
|
||||||
is_uploaded:
|
|
||||||
custom_name: isUploaded
|
|
||||||
mime_type:
|
|
||||||
custom_name: mimeType
|
|
||||||
name:
|
|
||||||
custom_name: name
|
|
||||||
size:
|
|
||||||
custom_name: size
|
|
||||||
updated_at:
|
|
||||||
custom_name: updatedAt
|
|
||||||
uploaded_by_user_id:
|
|
||||||
custom_name: uploadedByUserId
|
|
||||||
custom_column_names:
|
|
||||||
bucket_id: bucketId
|
|
||||||
created_at: createdAt
|
|
||||||
etag: etag
|
|
||||||
id: id
|
|
||||||
is_uploaded: isUploaded
|
|
||||||
mime_type: mimeType
|
|
||||||
name: name
|
|
||||||
size: size
|
|
||||||
updated_at: updatedAt
|
|
||||||
uploaded_by_user_id: uploadedByUserId
|
|
||||||
custom_name: files
|
|
||||||
custom_root_fields:
|
|
||||||
delete: deleteFiles
|
|
||||||
delete_by_pk: deleteFile
|
|
||||||
insert: insertFiles
|
|
||||||
insert_one: insertFile
|
|
||||||
select: files
|
|
||||||
select_aggregate: filesAggregate
|
|
||||||
select_by_pk: file
|
|
||||||
update: updateFiles
|
|
||||||
update_by_pk: updateFile
|
|
||||||
object_relationships:
|
|
||||||
- name: bucket
|
|
||||||
using:
|
|
||||||
foreign_key_constraint_on: bucket_id
|
|
||||||
insert_permissions:
|
|
||||||
- role: anonymous
|
|
||||||
permission:
|
|
||||||
check:
|
|
||||||
size:
|
|
||||||
_lt: 1024000
|
|
||||||
columns:
|
|
||||||
- is_uploaded
|
|
||||||
- size
|
|
||||||
- bucket_id
|
|
||||||
- etag
|
|
||||||
- mime_type
|
|
||||||
- name
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- uploaded_by_user_id
|
|
||||||
select_permissions:
|
|
||||||
- role: anonymous
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- is_uploaded
|
|
||||||
- size
|
|
||||||
- bucket_id
|
|
||||||
- etag
|
|
||||||
- mime_type
|
|
||||||
- name
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- uploaded_by_user_id
|
|
||||||
filter: {}
|
|
||||||
update_permissions:
|
|
||||||
- role: anonymous
|
|
||||||
permission:
|
|
||||||
columns:
|
|
||||||
- is_uploaded
|
|
||||||
- size
|
|
||||||
- bucket_id
|
|
||||||
- etag
|
|
||||||
- mime_type
|
|
||||||
- name
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- id
|
|
||||||
- uploaded_by_user_id
|
|
||||||
filter: {}
|
|
||||||
check: {}
|
|
||||||
delete_permissions:
|
|
||||||
- role: anonymous
|
|
||||||
permission:
|
|
||||||
filter: {}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
- "!include auth_provider_requests.yaml"
|
|
||||||
- "!include auth_providers.yaml"
|
|
||||||
- "!include auth_refresh_tokens.yaml"
|
|
||||||
- "!include auth_roles.yaml"
|
|
||||||
- "!include auth_user_providers.yaml"
|
|
||||||
- "!include auth_user_roles.yaml"
|
|
||||||
- "!include auth_user_security_keys.yaml"
|
|
||||||
- "!include auth_users.yaml"
|
|
||||||
- "!include public_categories.yaml"
|
|
||||||
- "!include public_tasks.yaml"
|
|
||||||
- "!include public_todos.yaml"
|
|
||||||
- "!include storage_buckets.yaml"
|
|
||||||
- "!include storage_files.yaml"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
disabled_for_roles: []
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
- name: functions
|
|
||||||
definition:
|
|
||||||
url_from_env: NHOST_FUNCTIONS_URL
|
|
||||||
timeout_seconds: 60
|
|
||||||
customization: {}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
version: 3
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP TABLE "public"."books";
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
CREATE TABLE "public"."books" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "title" text NOT NULL, PRIMARY KEY ("id") );
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
DROP INDEX IF EXISTS "public"."user_id";
|
|
||||||
DROP TABLE "public"."todos_user_id";
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
CREATE TABLE "public"."todos" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "user_id" uuid NOT NULL, "contents" text NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("user_id") REFERENCES "auth"."users"("id") ON UPDATE cascade ON DELETE cascade);
|
|
||||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
|
||||||
RETURNS TRIGGER AS $$
|
|
||||||
DECLARE
|
|
||||||
_new record;
|
|
||||||
BEGIN
|
|
||||||
_new := NEW;
|
|
||||||
_new."updated_at" = NOW();
|
|
||||||
RETURN _new;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
CREATE TRIGGER "set_public_todos_updated_at"
|
|
||||||
BEFORE UPDATE ON "public"."todos"
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
|
||||||
COMMENT ON TRIGGER "set_public_todos_updated_at" ON "public"."todos"
|
|
||||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
CREATE INDEX "todos_user_id" on
|
|
||||||
"public"."todos" using btree ("user_id");
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
CREATE TABLE "public"."books" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "title" text NOT NULL, PRIMARY KEY ("id") );
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP table "public"."books";
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
-- Could not auto-generate a down migration.
|
|
||||||
-- Please write an appropriate down migration for the SQL below:
|
|
||||||
-- CREATE TABLE categories (
|
|
||||||
-- value text PRIMARY KEY,
|
|
||||||
-- comment text
|
|
||||||
-- );
|
|
||||||
--
|
|
||||||
-- INSERT INTO categories (value, comment) VALUES
|
|
||||||
-- ('novel', 'Novels'),
|
|
||||||
-- ('essay', 'whatev');
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
CREATE TABLE categories (
|
|
||||||
value text PRIMARY KEY,
|
|
||||||
comment text
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO categories (value, comment) VALUES
|
|
||||||
('novel', 'Novels'),
|
|
||||||
('essay', 'whatev');
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
-- Could not auto-generate a down migration.
|
|
||||||
-- Please write an appropriate down migration for the SQL below:
|
|
||||||
-- alter table "public"."todos" add column "category" text
|
|
||||||
-- null;
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
alter table "public"."todos" add column "category" text
|
|
||||||
null;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
alter table "public"."todos" drop constraint "todos_category_fkey";
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
alter table "public"."todos"
|
|
||||||
add constraint "todos_category_fkey"
|
|
||||||
foreign key ("category")
|
|
||||||
references "public"."categories"
|
|
||||||
("value") on update restrict on delete restrict;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP TABLE "public"."tasks";
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
CREATE TABLE "public"."tasks" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "description" text NOT NULL, PRIMARY KEY ("id") );
|
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/graphql-js",
|
"name": "@nhost/graphql-js",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"description": "Nhost GraphQL client",
|
"description": "Nhost GraphQL client",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -42,14 +42,6 @@
|
|||||||
"build": "run-p build:lib build:umd",
|
"build": "run-p build:lib build:umd",
|
||||||
"build:lib": "vite build",
|
"build:lib": "vite build",
|
||||||
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
|
"build:umd": "vite build --config ../../config/vite.lib.umd.config.js",
|
||||||
"test": "run-p test:types test:unit",
|
|
||||||
"test:codegen": "graphql-codegen --config tests/codegen.yaml",
|
|
||||||
"test:unit": "vitest run --config vite.config.unit.js",
|
|
||||||
"test:types": "tsc -p tsconfig.test.json --noEmit",
|
|
||||||
"test:watch": "vitest --config vite.config.unit.js",
|
|
||||||
"e2e": "start-test e2e:backend http-get://localhost:9695 e2e:test",
|
|
||||||
"e2e:test": "vitest run --config vite.config.e2e.js",
|
|
||||||
"e2e:backend": "nhost dev --no-browser",
|
|
||||||
"prettier": "prettier --check src/",
|
"prettier": "prettier --check src/",
|
||||||
"prettier:fix": "prettier --write src/",
|
"prettier:fix": "prettier --write src/",
|
||||||
"lint": "eslint . --ext .ts,.tsx",
|
"lint": "eslint . --ext .ts,.tsx",
|
||||||
@@ -61,22 +53,13 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@graphql-typed-document-node/core": "^3.1.1",
|
"@graphql-typed-document-node/core": "^3.1.1",
|
||||||
"cross-fetch": "^3.1.5",
|
"cross-fetch": "^3.1.5"
|
||||||
"json-to-graphql-query": "^2.2.4"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@faker-js/faker": "^7.6.0",
|
|
||||||
"@graphql-codegen/add": "^4.0.1",
|
|
||||||
"@graphql-codegen/cli": "^3.1.0",
|
|
||||||
"@graphql-codegen/typescript-nhost": "^0.0.1",
|
|
||||||
"@nhost/docgen": "workspace:*",
|
"@nhost/docgen": "workspace:*",
|
||||||
"@nhost/hasura-auth-js": "workspace:*",
|
"graphql": "16.6.0"
|
||||||
"graphql": "16.6.0",
|
|
||||||
"graphql-tag": "^2.12.6",
|
|
||||||
"npm-run-all": "^4.1.5",
|
|
||||||
"start-server-and-test": "^1.14.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
import { TypedDocumentNode } from '@graphql-typed-document-node/core'
|
import { TypedDocumentNode } from '@graphql-typed-document-node/core'
|
||||||
import fetch from 'cross-fetch'
|
import fetch from 'cross-fetch'
|
||||||
import { toRawGraphQL } from './graphql-object/query-builder'
|
|
||||||
import { GenericSchema, getRootOperationNames } from './graphql-object/schema'
|
|
||||||
import { OperationFactory } from './graphql-object/types'
|
|
||||||
import { parseRequestArgs } from './parse-args'
|
import { parseRequestArgs } from './parse-args'
|
||||||
import { resolveRequestDocument } from './resolve-request-document'
|
import { resolveRequestDocument } from './resolve-request-document'
|
||||||
import {
|
import {
|
||||||
@@ -18,77 +15,17 @@ import {
|
|||||||
/**
|
/**
|
||||||
* @alias GraphQL
|
* @alias GraphQL
|
||||||
*/
|
*/
|
||||||
export class NhostGraphqlClient<Schema extends GenericSchema | undefined> {
|
export class NhostGraphqlClient {
|
||||||
readonly _url: string
|
readonly _url: string
|
||||||
private accessToken: string | null
|
private accessToken: string | null
|
||||||
private adminSecret?: string
|
private adminSecret?: string
|
||||||
|
|
||||||
/**
|
constructor(params: NhostGraphqlConstructorParams) {
|
||||||
* Use `nhost.graphql.query` to run a GraphQL query from object parameters and the schema genetated with `@graphql-codegen/typescript-nhost`.
|
const { url, adminSecret } = params
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import schema from './generated-schema'
|
|
||||||
* const nhost = new NhostClient({ subdomain: 'xxx', region: 'yyy', schema })
|
|
||||||
*
|
|
||||||
* const { id, name } = await nhost.graphql.query.customer({ select: { id: true, name: true }, variables: {id: 'customer-id' } })
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @docs https://docs.nhost.io/reference/javascript/graphql/query
|
|
||||||
*/
|
|
||||||
public query: OperationFactory<Schema, 'Query'>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use `nhost.graphql.mutation` to run a GraphQL mutation from object parameters and the schema genetated with `@graphql-codegen/typescript-nhost`.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* import schema from './generated-schema'
|
|
||||||
* const nhost = new NhostClient({ subdomain: 'xxx', region: 'yyy', schema })
|
|
||||||
*
|
|
||||||
* const { id } = await nhost.graphql.mutation.insertCustomer({ select: { id: true }, variables: { name: 'Bob' } })
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @docs https://docs.nhost.io/reference/javascript/graphql/mutation
|
|
||||||
*/
|
|
||||||
public mutation: OperationFactory<Schema, 'Mutation'>
|
|
||||||
|
|
||||||
constructor(params: NhostGraphqlConstructorParams<Schema>) {
|
|
||||||
const { url, adminSecret, schema } = params
|
|
||||||
|
|
||||||
this._url = url
|
this._url = url
|
||||||
this.accessToken = null
|
this.accessToken = null
|
||||||
this.adminSecret = adminSecret
|
this.adminSecret = adminSecret
|
||||||
|
|
||||||
this.query = getRootOperationNames(schema, 'Query').reduce((acc, property) => {
|
|
||||||
acc[property] = async (input?: unknown) => {
|
|
||||||
const { query, variables } = toRawGraphQL(schema, 'Query', property, input)
|
|
||||||
const { data, error } = await this.request(query, variables)
|
|
||||||
if (error) {
|
|
||||||
if ('message' in error) {
|
|
||||||
throw new Error(error.message)
|
|
||||||
}
|
|
||||||
throw new Error(error[0].message)
|
|
||||||
}
|
|
||||||
return data[property]
|
|
||||||
}
|
|
||||||
return acc
|
|
||||||
}, {} as any)
|
|
||||||
|
|
||||||
this.mutation = getRootOperationNames(schema, 'Mutation').reduce((acc, property) => {
|
|
||||||
acc[property] = async (input?: unknown) => {
|
|
||||||
const { query, variables } = toRawGraphQL(schema, 'Mutation', property, input)
|
|
||||||
const { data, error } = await this.request(query, variables)
|
|
||||||
if (error) {
|
|
||||||
if ('message' in error) {
|
|
||||||
throw new Error(error.message)
|
|
||||||
}
|
|
||||||
throw new Error(error[0].message)
|
|
||||||
}
|
|
||||||
return data[property]
|
|
||||||
}
|
|
||||||
return acc
|
|
||||||
}, {} as any)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,132 +0,0 @@
|
|||||||
import { parse } from 'graphql'
|
|
||||||
import { jsonToGraphQLQuery, VariableType } from 'json-to-graphql-query'
|
|
||||||
import {
|
|
||||||
FieldDefinition,
|
|
||||||
GenericSchema,
|
|
||||||
getArgumentType,
|
|
||||||
getConcreteType,
|
|
||||||
getFieldType,
|
|
||||||
getGraphQLType,
|
|
||||||
getRootOperationNode,
|
|
||||||
getTypeFromRef,
|
|
||||||
OperationTypes,
|
|
||||||
TypeRef
|
|
||||||
} from '../graphql-object/schema'
|
|
||||||
|
|
||||||
const toJson = (
|
|
||||||
schema: GenericSchema,
|
|
||||||
parameters: Record<string, any> | true = true,
|
|
||||||
definition: TypeRef | FieldDefinition,
|
|
||||||
variables: Record<string, any> = {},
|
|
||||||
variablesValues: Record<string, any> = {},
|
|
||||||
variablesPrefix: string = ''
|
|
||||||
) => {
|
|
||||||
const select: Record<string, any> = {}
|
|
||||||
const values = (parameters !== true && parameters.select) || {}
|
|
||||||
const inputArguments = (parameters !== true && parameters.variables) || {}
|
|
||||||
const args: Record<string, any> = {}
|
|
||||||
|
|
||||||
const onValues = parameters !== true && parameters.on
|
|
||||||
if (onValues) {
|
|
||||||
select['__typename'] = true
|
|
||||||
select['__on'] = Object.keys(onValues).map((fragmentName) => {
|
|
||||||
const childVariablePrefix = variablesPrefix
|
|
||||||
? `${variablesPrefix}_on_${fragmentName}`
|
|
||||||
: `on_${fragmentName}`
|
|
||||||
const {
|
|
||||||
query,
|
|
||||||
variables: newVariables,
|
|
||||||
variablesValues: newVariablesValues
|
|
||||||
} = toJson(
|
|
||||||
schema,
|
|
||||||
onValues[fragmentName],
|
|
||||||
getTypeFromRef(schema, { kind: 'OBJECT', name: fragmentName }),
|
|
||||||
variables,
|
|
||||||
variablesValues,
|
|
||||||
childVariablePrefix
|
|
||||||
)
|
|
||||||
variables = { ...variables, ...newVariables }
|
|
||||||
variablesValues = { ...variablesValues, ...newVariablesValues }
|
|
||||||
return {
|
|
||||||
__typeName: fragmentName,
|
|
||||||
...query
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if ('type' in definition) {
|
|
||||||
Object.keys(inputArguments).forEach((key) => {
|
|
||||||
// ? camel case the variable names?
|
|
||||||
const uniqueVariableName = variablesPrefix ? `${variablesPrefix}_${key}` : key
|
|
||||||
variables[uniqueVariableName] = getGraphQLType(schema, getArgumentType(key, definition))
|
|
||||||
args[key] = new VariableType(uniqueVariableName)
|
|
||||||
variablesValues[key] = inputArguments[key]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object.keys(values).length === 0) {
|
|
||||||
const fieldType = getConcreteType(schema, definition)
|
|
||||||
if (fieldType.kind === 'OBJECT') {
|
|
||||||
fieldType.fields?.forEach((field) => {
|
|
||||||
const concreteType = getConcreteType(schema, field.type)
|
|
||||||
if (concreteType.kind === 'SCALAR' || concreteType.kind === 'ENUM') {
|
|
||||||
select[field.name] = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.entries(values).forEach(([key, value]: [string, any]) => {
|
|
||||||
const childVariablePrefix = variablesPrefix ? `${variablesPrefix}_${key}` : key
|
|
||||||
const fieldType = getFieldType(schema, key, definition)
|
|
||||||
if (!fieldType) {
|
|
||||||
throw new Error(`Field ${key} is not defined`)
|
|
||||||
}
|
|
||||||
const {
|
|
||||||
query,
|
|
||||||
variables: newVariables,
|
|
||||||
variablesValues: newVariablesValues
|
|
||||||
} = toJson(schema, value, fieldType, variables, variablesValues, childVariablePrefix)
|
|
||||||
select[key] = query
|
|
||||||
variables = { ...variables, ...newVariables }
|
|
||||||
variablesValues = { ...variablesValues, ...newVariablesValues }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
query: { ...select, __args: args },
|
|
||||||
variables,
|
|
||||||
variablesValues
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const toRawGraphQL = (
|
|
||||||
schema: GenericSchema | undefined,
|
|
||||||
opType: OperationTypes,
|
|
||||||
rootOperation: string,
|
|
||||||
params: any = {}
|
|
||||||
) => {
|
|
||||||
if (!schema) throw new Error('Schema is not defined')
|
|
||||||
const { query, variables, variablesValues } = toJson(
|
|
||||||
schema,
|
|
||||||
params,
|
|
||||||
getRootOperationNode(schema, opType, rootOperation)
|
|
||||||
)
|
|
||||||
return {
|
|
||||||
query: jsonToGraphQLQuery(
|
|
||||||
{
|
|
||||||
[opType.toLowerCase()]: {
|
|
||||||
__variables: variables,
|
|
||||||
[rootOperation]: query
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ pretty: true }
|
|
||||||
),
|
|
||||||
variables: variablesValues
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const toGraphQLDocument = (
|
|
||||||
schema: GenericSchema | undefined,
|
|
||||||
opType: OperationTypes,
|
|
||||||
rootOperation: string,
|
|
||||||
params: any
|
|
||||||
) => parse(toRawGraphQL(schema, opType, rootOperation, params).query)
|
|
||||||
@@ -1,303 +0,0 @@
|
|||||||
import { CapitalizeSnakeCase, PickFirstTupleItemThatExtends } from './type-helpers'
|
|
||||||
|
|
||||||
export type GenericSchema = Record<string, any> & {
|
|
||||||
introspection: Introspection
|
|
||||||
types: Record<string, any>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type OperationTypes = 'Query' | 'Mutation' | 'Subscription'
|
|
||||||
|
|
||||||
type RootOperationName<
|
|
||||||
Schema extends GenericSchema | undefined,
|
|
||||||
OperationType extends OperationTypes,
|
|
||||||
capitalize extends boolean = true,
|
|
||||||
IntrospectionSchema = Schema extends GenericSchema ? Schema['introspection']['__schema'] : never,
|
|
||||||
IntrospectionProperty = `${Uncapitalize<OperationType>}Type`
|
|
||||||
> = Schema extends GenericSchema
|
|
||||||
? IntrospectionProperty extends keyof IntrospectionSchema
|
|
||||||
? IntrospectionSchema[IntrospectionProperty] extends { name: string }
|
|
||||||
? capitalize extends true
|
|
||||||
? CapitalizeSnakeCase<IntrospectionSchema[IntrospectionProperty]['name']>
|
|
||||||
: IntrospectionSchema[IntrospectionProperty]['name']
|
|
||||||
: never
|
|
||||||
: never
|
|
||||||
: never
|
|
||||||
|
|
||||||
export type RootOperation<
|
|
||||||
Schema extends GenericSchema | undefined,
|
|
||||||
OperationType extends OperationTypes,
|
|
||||||
OperationName = RootOperationName<Schema, OperationType>
|
|
||||||
> = Schema extends GenericSchema
|
|
||||||
? OperationName extends string
|
|
||||||
? Schema['types'][OperationName] extends object
|
|
||||||
? Schema['types'][OperationName]
|
|
||||||
: never
|
|
||||||
: never
|
|
||||||
: never
|
|
||||||
|
|
||||||
export type OperationsOf<
|
|
||||||
Schema extends GenericSchema | undefined,
|
|
||||||
OperationType extends OperationTypes
|
|
||||||
> = Omit<RootOperation<Schema | undefined, OperationType>, '__typename' | number | symbol>
|
|
||||||
|
|
||||||
export type FieldArgs<
|
|
||||||
Schema extends GenericSchema,
|
|
||||||
OperationType extends OperationTypes,
|
|
||||||
FieldName extends string,
|
|
||||||
Suffix extends string = `_${CapitalizeSnakeCase<FieldName>}Args`
|
|
||||||
> = Schema['types'][`${RootOperationName<Schema, OperationType>}${Suffix}`]
|
|
||||||
|
|
||||||
export type OperationRootTypeOf<
|
|
||||||
Schema extends GenericSchema,
|
|
||||||
OperationType extends OperationTypes
|
|
||||||
> = SelectSingleType<
|
|
||||||
Schema,
|
|
||||||
{ kind: 'OBJECT'; name: RootOperationName<Schema, OperationType, false> }
|
|
||||||
>
|
|
||||||
|
|
||||||
export type SelectSingleType<
|
|
||||||
S extends GenericSchema,
|
|
||||||
Type extends TypeRef
|
|
||||||
> = PickFirstTupleItemThatExtends<
|
|
||||||
S['introspection']['__schema']['types'],
|
|
||||||
Type extends { name: string }
|
|
||||||
? { name: Type['name']; kind: Type['kind'] }
|
|
||||||
: { kind: Type['kind'] }
|
|
||||||
>
|
|
||||||
|
|
||||||
type MAX_RECURSION = 10 // maximum recursion depth
|
|
||||||
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
|
|
||||||
? Acc
|
|
||||||
: Enumerate<N, [...Acc, Acc['length']]>
|
|
||||||
|
|
||||||
type Pred = [never, ...Enumerate<MAX_RECURSION>]
|
|
||||||
|
|
||||||
// TODO remove the recursion as we know the possible type depth
|
|
||||||
export type ConcreteTypeOf<
|
|
||||||
S extends GenericSchema,
|
|
||||||
T extends TypeRef,
|
|
||||||
D extends number = MAX_RECURSION
|
|
||||||
> = [D] extends [0]
|
|
||||||
? any
|
|
||||||
: T extends TypeRef
|
|
||||||
? T extends NonNullType
|
|
||||||
? ConcreteTypeOf<S, T['ofType'], Pred[D]>
|
|
||||||
: T extends ListType
|
|
||||||
? ConcreteTypeOf<S, T['ofType'], Pred[D]>
|
|
||||||
: T extends ObjectType | InterfaceType | UnionType
|
|
||||||
? SelectSingleType<S, T>
|
|
||||||
: T
|
|
||||||
: never
|
|
||||||
|
|
||||||
export type Introspection = {
|
|
||||||
__schema: {
|
|
||||||
queryType: { name: string } | null
|
|
||||||
mutationType: { name: string } | null
|
|
||||||
subscriptionType: { name: string } | null
|
|
||||||
types: Readonly<Array<TypeRef>>
|
|
||||||
directives: Readonly<[]>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type InputObjectType = {
|
|
||||||
kind: 'INPUT_OBJECT'
|
|
||||||
name: string
|
|
||||||
ofType?: null
|
|
||||||
readonly inputFields?: Readonly<Array<FieldDefinition>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ListType = {
|
|
||||||
kind: 'LIST'
|
|
||||||
ofType: TypeRef
|
|
||||||
}
|
|
||||||
|
|
||||||
export type NonNullType = {
|
|
||||||
kind: 'NON_NULL'
|
|
||||||
ofType: TypeRef
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ObjectType<Name extends string = string> = {
|
|
||||||
kind: 'OBJECT'
|
|
||||||
name: Name
|
|
||||||
interfaces?: Readonly<Array<unknown>>
|
|
||||||
ofType?: null
|
|
||||||
fields?: Readonly<Array<FieldDefinition>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ScalarType = {
|
|
||||||
kind: 'SCALAR'
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type UnionType = {
|
|
||||||
kind: 'UNION'
|
|
||||||
name: string
|
|
||||||
ofType?: null
|
|
||||||
possibleTypes?: Readonly<Array<ObjectType | UnionType | InterfaceType>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type EnumType = {
|
|
||||||
kind: 'ENUM'
|
|
||||||
name: string
|
|
||||||
ofType?: null
|
|
||||||
enumValues?: Readonly<Array<{ name: string }>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type InterfaceType = {
|
|
||||||
kind: 'INTERFACE'
|
|
||||||
name: string
|
|
||||||
ofType?: null
|
|
||||||
fields?: Readonly<Array<FieldDefinition>>
|
|
||||||
possibleTypes?: Readonly<Array<ObjectType | UnionType | InterfaceType>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TypeRef =
|
|
||||||
| InputObjectType
|
|
||||||
| ListType
|
|
||||||
| NonNullType
|
|
||||||
| ObjectType
|
|
||||||
| ScalarType
|
|
||||||
| UnionType
|
|
||||||
| EnumType
|
|
||||||
| InterfaceType
|
|
||||||
|
|
||||||
export type FieldDefinition = {
|
|
||||||
readonly name: string
|
|
||||||
readonly args?: ReadonlyArray<{ name: string; type: TypeRef }>
|
|
||||||
readonly type: TypeRef
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getIntrospectionType = <S extends GenericSchema, Type extends Partial<TypeRef>>(
|
|
||||||
schema: S,
|
|
||||||
type: Type
|
|
||||||
) =>
|
|
||||||
schema.introspection.__schema.types.find((t) =>
|
|
||||||
Object.entries(type).every(([key, value]) => t[key as keyof TypeRef] === value)
|
|
||||||
)
|
|
||||||
|
|
||||||
const getRootOperationNodeType = <S extends GenericSchema, OperationType extends OperationTypes>(
|
|
||||||
schema: S,
|
|
||||||
operationType: OperationType
|
|
||||||
): ObjectType<OperationType> | null => {
|
|
||||||
const name =
|
|
||||||
schema.introspection.__schema[
|
|
||||||
`${operationType.toLowerCase()}Type` as 'queryType' | 'mutationType' | 'subscriptionType'
|
|
||||||
]?.name
|
|
||||||
if (!name) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
const type = getIntrospectionType(schema, { kind: 'OBJECT', name }) as ObjectType<OperationType>
|
|
||||||
if (!type) {
|
|
||||||
throw new Error(`Could not find the root operation type for ${operationType}`)
|
|
||||||
}
|
|
||||||
return type
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getRootOperationNames = <
|
|
||||||
S extends GenericSchema | undefined,
|
|
||||||
OperationType extends OperationTypes,
|
|
||||||
Operations = OperationsOf<S, OperationType>
|
|
||||||
>(
|
|
||||||
schema: S,
|
|
||||||
operationType: OperationType
|
|
||||||
): Array<keyof Operations> => {
|
|
||||||
if (!schema) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
const type = getRootOperationNodeType(schema, operationType)
|
|
||||||
return (type?.fields?.map((field) => field.name) as Array<keyof Operations>) ?? []
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getTypeFromRef = (schema: GenericSchema, typeRef?: TypeRef) => {
|
|
||||||
const type = schema.introspection.__schema.types.find(
|
|
||||||
(t) => 'name' in t && typeRef && 'name' in typeRef && t.name === typeRef.name
|
|
||||||
)
|
|
||||||
if (!type) {
|
|
||||||
throw new Error(`Could not find type`)
|
|
||||||
}
|
|
||||||
return type
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getArgumentType = (name: String, definition: FieldDefinition) => {
|
|
||||||
const type = definition?.args?.find((f) => f.name === name)?.type
|
|
||||||
if (!type) {
|
|
||||||
throw new Error(`Could not determine the type of the argument ${name}`)
|
|
||||||
}
|
|
||||||
return type
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getFieldType = (
|
|
||||||
schema: GenericSchema,
|
|
||||||
fieldName: String,
|
|
||||||
definition: TypeRef | FieldDefinition
|
|
||||||
) => {
|
|
||||||
const type = 'type' in definition ? definition.type : definition
|
|
||||||
const objectType = getTypeFromRef(schema, getConcreteType(schema, type))
|
|
||||||
if (objectType.kind === 'OBJECT' || objectType.kind === 'INTERFACE') {
|
|
||||||
const type = objectType.fields?.find((f) => f.name === fieldName)
|
|
||||||
if (!type) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
return type
|
|
||||||
}
|
|
||||||
if (objectType.kind === 'INPUT_OBJECT') {
|
|
||||||
const type = objectType?.inputFields?.find((f) => f.name === fieldName)
|
|
||||||
if (!type) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
return type
|
|
||||||
}
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getRootOperationNode = (
|
|
||||||
schema: GenericSchema,
|
|
||||||
opType: OperationTypes,
|
|
||||||
rootOperation: string
|
|
||||||
) => {
|
|
||||||
const rootNode = getRootOperationNodeType(schema, opType)
|
|
||||||
const node = rootNode?.fields?.find((field) => field.name === rootOperation)
|
|
||||||
if (!node) {
|
|
||||||
throw new Error(`Could not find root operation ${rootOperation}`)
|
|
||||||
}
|
|
||||||
return node
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getConcreteType = (
|
|
||||||
schema: GenericSchema,
|
|
||||||
definition: TypeRef | FieldDefinition
|
|
||||||
): TypeRef => {
|
|
||||||
if ('type' in definition) {
|
|
||||||
return getConcreteType(schema, definition.type)
|
|
||||||
}
|
|
||||||
if (definition.kind === 'NON_NULL' || definition.kind === 'LIST') {
|
|
||||||
return getConcreteType(schema, definition.ofType)
|
|
||||||
}
|
|
||||||
const type = schema.introspection.__schema.types?.find(
|
|
||||||
(f) => 'name' in f && f.name === definition.name
|
|
||||||
)
|
|
||||||
if (!type) {
|
|
||||||
throw new Error('not found')
|
|
||||||
}
|
|
||||||
return type
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getGraphQLType = (schema: GenericSchema, type: TypeRef): string => {
|
|
||||||
if (type.kind === 'NON_NULL') {
|
|
||||||
return `${getGraphQLType(schema, type.ofType)}!`
|
|
||||||
}
|
|
||||||
if (type.kind === 'LIST') {
|
|
||||||
return `[${getGraphQLType(schema, type.ofType)}]`
|
|
||||||
}
|
|
||||||
const typeDesc = schema.introspection.__schema.types?.find(
|
|
||||||
(f) => 'name' in f && f.name === type.name
|
|
||||||
)
|
|
||||||
if (!typeDesc) {
|
|
||||||
throw new Error(`Could not find type ${type.name}`)
|
|
||||||
}
|
|
||||||
if (!('name' in typeDesc)) {
|
|
||||||
throw new Error(`Could not determine GraphQL type name for ${type.name}`)
|
|
||||||
}
|
|
||||||
return typeDesc.name
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
import { EmptyObject, Join, Split } from './type-fest'
|
|
||||||
|
|
||||||
export type { RequireAtLeastOne, SetRequired } from './type-fest'
|
|
||||||
|
|
||||||
export type StripImpossibleProperties<T> = Pick<
|
|
||||||
T,
|
|
||||||
{ [Key in keyof T]-?: T[Key] extends never ? never : Key }[keyof T]
|
|
||||||
>
|
|
||||||
|
|
||||||
export type UnwrapNullableArray<T> = NonNullable<T extends (infer E)[] ? E : T>
|
|
||||||
export type UnwrapArray<T> = T extends (infer E)[] ? E : NonNullable<T>
|
|
||||||
|
|
||||||
export type WrapArray<T, U> = NonNullable<T> extends any[] ? U[] : U
|
|
||||||
|
|
||||||
/** Omit all the optional fields of the type */
|
|
||||||
type OmitOptionalFields<T> = {
|
|
||||||
[K in keyof T as T[K] extends Required<T>[K] ? K : never]: T[K]
|
|
||||||
}
|
|
||||||
|
|
||||||
export type MakeOptional<T> = {
|
|
||||||
[K in keyof T as undefined extends T[K] ? K : never]?: T[K]
|
|
||||||
} & {
|
|
||||||
[K in keyof T as undefined extends T[K] ? never : K]: T[K]
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Select only the properties of the object that matches the second generic argument */
|
|
||||||
export type Select<T, K extends keyof any> = Pick<T, Extract<keyof T, K>>
|
|
||||||
|
|
||||||
/** Gets the main GraphQL type from a GraphQL argument type e.g. `[string!]!` returns `string` */
|
|
||||||
export type GraphQLPredicate<GQLType extends string> = GQLType extends `${infer S}!`
|
|
||||||
? GraphQLPredicate<S>
|
|
||||||
: GQLType extends `[${infer S}]`
|
|
||||||
? GraphQLPredicate<S>
|
|
||||||
: GQLType
|
|
||||||
|
|
||||||
export type ToUnion<T> = T[keyof T]
|
|
||||||
|
|
||||||
type CapitalizeEach<T> = T extends [infer I, ...infer R]
|
|
||||||
? I extends string
|
|
||||||
? [Capitalize<I>, ...CapitalizeEach<R>]
|
|
||||||
: []
|
|
||||||
: []
|
|
||||||
|
|
||||||
/** Transform `a_string_type` to `A_String_Type` */
|
|
||||||
export type CapitalizeSnakeCase<T extends string> = Join<CapitalizeEach<Split<T, '_'>>, '_'>
|
|
||||||
|
|
||||||
type RequiredKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T]
|
|
||||||
type OptionalKeys<T> = { [K in keyof T]: {} extends Pick<T, K> ? never : K }[keyof T]
|
|
||||||
|
|
||||||
export type RequiredWhenChildrenAreRequired<key extends string, T> = RequiredKeys<T> extends never
|
|
||||||
? OptionalKeys<T> extends never
|
|
||||||
? EmptyObject
|
|
||||||
: { [k in key]?: T }
|
|
||||||
: { [k in key]: T }
|
|
||||||
|
|
||||||
export type PickFirstTupleItemThatExtends<T, U> = Readonly<T> extends Readonly<
|
|
||||||
[infer I, ...infer Rest]
|
|
||||||
>
|
|
||||||
? I extends U
|
|
||||||
? I
|
|
||||||
: PickFirstTupleItemThatExtends<Rest, U>
|
|
||||||
: never
|
|
||||||
|
|
||||||
export type IsTrueOrHasOnlyOptionals<T> = T extends true
|
|
||||||
? true
|
|
||||||
: keyof OmitOptionalFields<T> extends never
|
|
||||||
? true
|
|
||||||
: false
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
// Gracefully poached from https://github.com/sindresorhus/type-fest
|
|
||||||
export type Split<
|
|
||||||
S extends string,
|
|
||||||
Delimiter extends string
|
|
||||||
> = S extends `${infer Head}${Delimiter}${infer Tail}`
|
|
||||||
? [Head, ...Split<Tail, Delimiter>]
|
|
||||||
: S extends Delimiter
|
|
||||||
? []
|
|
||||||
: [S]
|
|
||||||
|
|
||||||
export type Join<
|
|
||||||
Strings extends Readonly<Array<string | number>>,
|
|
||||||
Delimiter extends string
|
|
||||||
> = Strings extends []
|
|
||||||
? ''
|
|
||||||
: Strings extends [string | number]
|
|
||||||
? `${Strings[0]}`
|
|
||||||
: Strings extends readonly [string | number, ...infer Rest extends Array<string | number>]
|
|
||||||
? `${Strings[0]}${Delimiter}${Join<Rest, Delimiter>}`
|
|
||||||
: string
|
|
||||||
|
|
||||||
declare const emptyObjectSymbol: unique symbol
|
|
||||||
|
|
||||||
export type EmptyObject = { [emptyObjectSymbol]?: never }
|
|
||||||
|
|
||||||
type IsEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2
|
|
||||||
? true
|
|
||||||
: false
|
|
||||||
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] }
|
|
||||||
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true
|
|
||||||
? never
|
|
||||||
: KeyType extends ExcludeType
|
|
||||||
? never
|
|
||||||
: KeyType
|
|
||||||
|
|
||||||
type Except<ObjectType, KeysType extends keyof ObjectType> = {
|
|
||||||
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = {
|
|
||||||
// For each `Key` in `KeysType` make a mapped type:
|
|
||||||
[Key in KeysType]-?: Required<Pick<ObjectType, Key>> & // 1. Make `Key`'s type required
|
|
||||||
// 2. Make all other keys in `KeysType` optional
|
|
||||||
Partial<Pick<ObjectType, Exclude<KeysType, Key>>>
|
|
||||||
}[KeysType] &
|
|
||||||
// 3. Add the remaining keys not in `KeysType`
|
|
||||||
Except<ObjectType, KeysType>
|
|
||||||
|
|
||||||
export type SetRequired<BaseType, Keys extends keyof BaseType> = Simplify<
|
|
||||||
// Pick just the keys that are optional from the base type.
|
|
||||||
Except<BaseType, Keys> &
|
|
||||||
// Pick the keys that should be required from the base type and make them required.
|
|
||||||
Required<Pick<BaseType, Keys>>
|
|
||||||
>
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
import {
|
|
||||||
ConcreteTypeOf,
|
|
||||||
FieldArgs,
|
|
||||||
FieldDefinition,
|
|
||||||
GenericSchema,
|
|
||||||
InterfaceType,
|
|
||||||
ObjectType,
|
|
||||||
OperationRootTypeOf,
|
|
||||||
OperationsOf,
|
|
||||||
OperationTypes,
|
|
||||||
UnionType
|
|
||||||
} from './schema'
|
|
||||||
import {
|
|
||||||
IsTrueOrHasOnlyOptionals,
|
|
||||||
PickFirstTupleItemThatExtends,
|
|
||||||
RequireAtLeastOne,
|
|
||||||
RequiredWhenChildrenAreRequired,
|
|
||||||
SetRequired,
|
|
||||||
StripImpossibleProperties,
|
|
||||||
ToUnion,
|
|
||||||
UnwrapArray,
|
|
||||||
UnwrapNullableArray,
|
|
||||||
WrapArray
|
|
||||||
} from './type-helpers'
|
|
||||||
|
|
||||||
type ParametersOf<
|
|
||||||
Schema extends GenericSchema,
|
|
||||||
OperationType extends OperationTypes,
|
|
||||||
Element extends Record<string, any>,
|
|
||||||
Definition,
|
|
||||||
FieldName extends string | undefined,
|
|
||||||
FieldTypeRef extends FieldDefinition = Definition extends { fields: readonly any[] }
|
|
||||||
? PickFirstTupleItemThatExtends<Definition['fields'], { name: FieldName }>
|
|
||||||
: Definition extends FieldDefinition
|
|
||||||
? Definition
|
|
||||||
: never,
|
|
||||||
FieldType extends ObjectType | InterfaceType | UnionType = ConcreteTypeOf<
|
|
||||||
Schema,
|
|
||||||
FieldTypeRef['type']
|
|
||||||
>,
|
|
||||||
HasArgs = FieldTypeRef extends { args: readonly any[] }
|
|
||||||
? FieldTypeRef['args']['length'] extends 0
|
|
||||||
? false
|
|
||||||
: true
|
|
||||||
: false,
|
|
||||||
Args = HasArgs extends true
|
|
||||||
? unknown extends FieldArgs<Schema, OperationType, FieldTypeRef['name']>
|
|
||||||
? FieldArgs<Schema, OperationType, FieldType['name']>
|
|
||||||
: FieldArgs<Schema, OperationType, FieldTypeRef['name']>
|
|
||||||
: never,
|
|
||||||
Fields = {
|
|
||||||
// TODO use rather "key in FieldType['fields'][number]" instead of "key in keyof Element"
|
|
||||||
[key in keyof Element]?: UnwrapNullableArray<Element[key]> extends object
|
|
||||||
? // * Accept either a list of fields or `true` to select all the fields
|
|
||||||
| ParametersOf<
|
|
||||||
Schema,
|
|
||||||
OperationType,
|
|
||||||
UnwrapNullableArray<Element[key]>,
|
|
||||||
FieldType,
|
|
||||||
string & key
|
|
||||||
>
|
|
||||||
| true
|
|
||||||
: // * If the element key is not an object/array of objects, it's a scalar field
|
|
||||||
true
|
|
||||||
},
|
|
||||||
Select = {
|
|
||||||
// * The `select` property is optional, as when absent, all the fields are selected
|
|
||||||
select?: Fields
|
|
||||||
},
|
|
||||||
// * The `variables` property is required when at least one of the children is required
|
|
||||||
// * If there is no possible variables, the `variables` property is not available
|
|
||||||
Variables = RequiredWhenChildrenAreRequired<'variables', Args>,
|
|
||||||
OnFields = FieldType extends SetRequired<UnionType | InterfaceType, 'possibleTypes'>
|
|
||||||
? {
|
|
||||||
[key in FieldType['possibleTypes'][number] as key['name']]?:
|
|
||||||
| ParametersOf<
|
|
||||||
Schema,
|
|
||||||
OperationType,
|
|
||||||
Schema['types'][key['name']],
|
|
||||||
{ name: key['name']; type: ConcreteTypeOf<Schema, key> },
|
|
||||||
undefined
|
|
||||||
>
|
|
||||||
| true
|
|
||||||
}
|
|
||||||
: never,
|
|
||||||
On = FieldType extends SetRequired<UnionType, 'possibleTypes'>
|
|
||||||
? // * In an union type, the `on` property is required, and at least one union type must be selected
|
|
||||||
{ on: RequireAtLeastOne<OnFields> }
|
|
||||||
: FieldType extends SetRequired<InterfaceType, 'possibleTypes'>
|
|
||||||
? // * In an interface type, the `on` property is optional.
|
|
||||||
{ on?: OnFields }
|
|
||||||
: {}
|
|
||||||
> = Select & Variables & On
|
|
||||||
|
|
||||||
type QueryFields<
|
|
||||||
Params extends { select?: any },
|
|
||||||
Element,
|
|
||||||
UnwrappedParams extends { select?: any } = UnwrapArray<Params>
|
|
||||||
> = UnwrappedParams extends undefined
|
|
||||||
? Element
|
|
||||||
: WrapArray<
|
|
||||||
NonNullable<Element>,
|
|
||||||
IsTrueOrHasOnlyOptionals<UnwrappedParams['select']> extends true
|
|
||||||
? // * Return all the non-object (scalar) fields
|
|
||||||
StripImpossibleProperties<{
|
|
||||||
[k in keyof NonNullable<Element>]: k extends keyof UnwrapArray<Element>
|
|
||||||
? UnwrapArray<NonNullable<Element>>[k] extends object
|
|
||||||
? never
|
|
||||||
: UnwrapArray<Element>[k]
|
|
||||||
: never
|
|
||||||
}>
|
|
||||||
: // * The parameter is a list of fields and the element in an object: pick the selected fields
|
|
||||||
StripImpossibleProperties<{
|
|
||||||
[k in keyof UnwrappedParams['select']]: k extends keyof UnwrapArray<Element>
|
|
||||||
? UnwrapArray<NonNullable<Element>>[k] extends object
|
|
||||||
? QueryFields<UnwrappedParams['select'][k], UnwrapArray<Element>[k]>
|
|
||||||
: UnwrapArray<Element>[k]
|
|
||||||
: never
|
|
||||||
}>
|
|
||||||
>
|
|
||||||
|
|
||||||
type UnionFields<
|
|
||||||
Schema extends GenericSchema,
|
|
||||||
Params extends { on: any[] },
|
|
||||||
Fragments = NonNullable<NonNullable<Params>['on']>
|
|
||||||
> = ToUnion<{
|
|
||||||
[fragmentName in keyof Fragments]: {
|
|
||||||
__typename: NonNullable<Schema['types'][string & fragmentName]['__typename']>
|
|
||||||
} & QueryFields<NonNullable<Fragments[fragmentName]>, Schema['types'][string & fragmentName]>
|
|
||||||
}>
|
|
||||||
|
|
||||||
// * See: https://stackoverflow.com/a/59230299
|
|
||||||
type Exactly<T, U> = T & Record<Exclude<keyof U, keyof T>, never>
|
|
||||||
|
|
||||||
export type OperationFactory<
|
|
||||||
Schema extends GenericSchema | undefined,
|
|
||||||
OperationType extends OperationTypes,
|
|
||||||
Operations = Schema extends GenericSchema ? OperationsOf<Schema, OperationType> : {}
|
|
||||||
> = Schema extends GenericSchema
|
|
||||||
? Required<{
|
|
||||||
[name in keyof Operations]: <
|
|
||||||
Operation extends Operations[name],
|
|
||||||
Element extends UnwrapArray<Operation>,
|
|
||||||
Params extends ParametersOf<
|
|
||||||
Schema,
|
|
||||||
OperationType,
|
|
||||||
NonNullable<Element>,
|
|
||||||
OperationRootTypeOf<Schema, OperationType>,
|
|
||||||
string & name
|
|
||||||
>,
|
|
||||||
// * See: https://stackoverflow.com/a/59230299
|
|
||||||
ExactParams extends Exactly<Params, ExactParams>,
|
|
||||||
Result extends WrapArray<
|
|
||||||
Operation,
|
|
||||||
ExactParams extends { on: any }
|
|
||||||
?
|
|
||||||
| (UnionFields<Schema, ExactParams> & QueryFields<ExactParams, Element>)
|
|
||||||
| ({
|
|
||||||
// * We add `__typename` as an union discrimimator.
|
|
||||||
// * Interfaces have no `__typename` property, so we set it to `null` if not present.
|
|
||||||
__typename: Element extends { __typename: any } ? Element['__typename'] : null
|
|
||||||
} & QueryFields<ExactParams, Element>)
|
|
||||||
: QueryFields<ExactParams, Element>
|
|
||||||
>
|
|
||||||
>(
|
|
||||||
// * Parameters are required when variables are required
|
|
||||||
...parameters: ExactParams extends { variables: any } | { on: any }
|
|
||||||
? [ExactParams]
|
|
||||||
: [ExactParams?]
|
|
||||||
) => Promise<Result>
|
|
||||||
}>
|
|
||||||
: {}
|
|
||||||
@@ -1,2 +1 @@
|
|||||||
export * from './client'
|
export * from './client'
|
||||||
export type { GenericSchema } from './graphql-object/schema'
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { TypedDocumentNode } from '@graphql-typed-document-node/core'
|
import { TypedDocumentNode } from '@graphql-typed-document-node/core'
|
||||||
import { DocumentNode, GraphQLError } from 'graphql'
|
import { DocumentNode, GraphQLError } from 'graphql'
|
||||||
import { GenericSchema } from './graphql-object/schema'
|
|
||||||
|
|
||||||
// TODO shared with other packages
|
// TODO shared with other packages
|
||||||
export type ErrorPayload = {
|
export type ErrorPayload = {
|
||||||
@@ -24,7 +23,7 @@ export type RemoveIndex<T> = {
|
|||||||
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]
|
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NhostGraphqlConstructorParams<Schema extends GenericSchema | undefined> {
|
export interface NhostGraphqlConstructorParams {
|
||||||
/**
|
/**
|
||||||
* GraphQL endpoint.
|
* GraphQL endpoint.
|
||||||
*/
|
*/
|
||||||
@@ -33,7 +32,6 @@ export interface NhostGraphqlConstructorParams<Schema extends GenericSchema | un
|
|||||||
* Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all requests.
|
* Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all requests.
|
||||||
*/
|
*/
|
||||||
adminSecret?: string
|
adminSecret?: string
|
||||||
schema?: Schema
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NhostGraphqlRequestResponse<T = unknown> =
|
export type NhostGraphqlRequestResponse<T = unknown> =
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
generates:
|
|
||||||
./tests/schemas/hasura.ts:
|
|
||||||
schema: http://localhost:1337/v1/graphql
|
|
||||||
config:
|
|
||||||
scalars:
|
|
||||||
uuid: 'string'
|
|
||||||
bigint: 'number'
|
|
||||||
citext: 'string'
|
|
||||||
timestamptz: 'string'
|
|
||||||
json: 'JSONValue'
|
|
||||||
jsonb: 'JSONValue'
|
|
||||||
bytea: 'string'
|
|
||||||
plugins:
|
|
||||||
- typescript-nhost
|
|
||||||
- add:
|
|
||||||
content: 'export type JSONValue = string | number | boolean | { [x: string]: JSONValue } | Array<JSONValue>;'
|
|
||||||
./tests/schemas/countries.ts:
|
|
||||||
schema: https://countries.trevorblades.com/graphql
|
|
||||||
plugins:
|
|
||||||
- typescript-nhost
|
|
||||||
./tests/schemas/swapi.ts:
|
|
||||||
schema: https://swapi-graphql.netlify.app/.netlify/functions/index
|
|
||||||
plugins:
|
|
||||||
- typescript-nhost
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/countries'
|
|
||||||
|
|
||||||
const client = new NhostGraphqlClient({
|
|
||||||
schema,
|
|
||||||
url: 'https://countries.trevorblades.com/graphql'
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Countries', () => {
|
|
||||||
it('should select Andorra and some details', async () => {
|
|
||||||
const result = await client.query.countries({
|
|
||||||
select: { name: true, capital: true, continent: { select: { code: true, name: true } } },
|
|
||||||
variables: { filter: { code: { eq: 'AD' } } }
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"capital": "Andorra la Vella",
|
|
||||||
"continent": {
|
|
||||||
"code": "EU",
|
|
||||||
"name": "Europe",
|
|
||||||
},
|
|
||||||
"name": "Andorra",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,275 +0,0 @@
|
|||||||
import { faker } from '@faker-js/faker'
|
|
||||||
import { TypedDocumentNode } from '@graphql-typed-document-node/core'
|
|
||||||
import { HasuraAuthClient } from '@nhost/hasura-auth-js'
|
|
||||||
import gql from 'graphql-tag'
|
|
||||||
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
|
||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
|
|
||||||
const client = new NhostGraphqlClient({
|
|
||||||
url: 'http://localhost:1337/v1/graphql'
|
|
||||||
})
|
|
||||||
|
|
||||||
const authClient = new HasuraAuthClient({ url: 'http://localhost:1337/v1/auth' })
|
|
||||||
|
|
||||||
type User = { id: string; displayName: string }
|
|
||||||
|
|
||||||
describe('main tests', () => {
|
|
||||||
it('getUrl()', () => {
|
|
||||||
const graphqlUrl = client.getUrl()
|
|
||||||
|
|
||||||
expect(graphqlUrl).toBe('http://localhost:1337/v1/graphql')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('httpUrl', async () => {
|
|
||||||
const graphqlUrl = client.httpUrl
|
|
||||||
|
|
||||||
expect(graphqlUrl).toBe('http://localhost:1337/v1/graphql')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('getWsUrl()', () => {
|
|
||||||
const graphqlUrl = client.wsUrl
|
|
||||||
|
|
||||||
expect(graphqlUrl).toBe('ws://localhost:1337/v1/graphql')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('GraphQL request as logged out user', async () => {
|
|
||||||
const document = `
|
|
||||||
query {
|
|
||||||
files {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ users: User[] }>(document)
|
|
||||||
|
|
||||||
expect(data).toBeNull()
|
|
||||||
expect(error).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"extensions": {
|
|
||||||
"code": "validation-failed",
|
|
||||||
"path": "$.selectionSet.files",
|
|
||||||
},
|
|
||||||
"message": "field 'files' not found in type: 'query_root'",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('authenticated user', () => {
|
|
||||||
beforeAll(async () => {
|
|
||||||
const email = faker.internet.email()
|
|
||||||
const password = faker.internet.password()
|
|
||||||
|
|
||||||
await authClient.signUp({ email, password })
|
|
||||||
client.setAccessToken(authClient.getAccessToken())
|
|
||||||
})
|
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
await authClient.signOut()
|
|
||||||
client.setAccessToken(undefined)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('GraphQL with variables', async () => {
|
|
||||||
const document = `
|
|
||||||
query ($id: uuid!) {
|
|
||||||
todos (where: {id: {_eq: $id }}) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ user: User }, { id: string }>(document, {
|
|
||||||
id: '5ccdb471-8ab2-4441-a3d1-f7f7146dda0c'
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(error).toBeNull()
|
|
||||||
expect(data).toBeTruthy()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should work with TypedDocumentNode', async () => {
|
|
||||||
const document = gql`
|
|
||||||
query ($id: uuid!) {
|
|
||||||
todos(where: { id: { _eq: $id } }) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
` as TypedDocumentNode<{ user: User }, { id: string }>
|
|
||||||
const { data, error } = await client.request<{ user: User }, { id: string }>(document, {
|
|
||||||
id: '5ccdb471-8ab2-4441-a3d1-f7f7146dda0c'
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(error).toBeNull()
|
|
||||||
expect(data).toBeTruthy()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('GraphQL with incorrect variables', async () => {
|
|
||||||
const document = `
|
|
||||||
query ($id: uuid!) {
|
|
||||||
user (id: $id) {
|
|
||||||
id
|
|
||||||
displayName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ user: User }, { id: string }>(document, {
|
|
||||||
id: 'not-a-uuid'
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(error).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"extensions": {
|
|
||||||
"code": "data-exception",
|
|
||||||
"path": "$",
|
|
||||||
},
|
|
||||||
"message": "invalid input syntax for type uuid: \\"not-a-uuid\\"",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
expect(data).toBeNull()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('GraphQL with missing variables', async () => {
|
|
||||||
const document = `
|
|
||||||
query ($id: uuid!) {
|
|
||||||
user (id: $id) {
|
|
||||||
id
|
|
||||||
displayName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ user: User }>(document, {})
|
|
||||||
|
|
||||||
expect(error).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"extensions": {
|
|
||||||
"code": "validation-failed",
|
|
||||||
"path": "$",
|
|
||||||
},
|
|
||||||
"message": "expecting a value for non-nullable variable: \\"id\\"",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
expect(data).toBeNull()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('as an admin', () => {
|
|
||||||
it('GraphQL request as admin', async () => {
|
|
||||||
const document = `
|
|
||||||
query {
|
|
||||||
users {
|
|
||||||
id
|
|
||||||
displayName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ users: User[] }>(
|
|
||||||
document,
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': 'nhost-admin-secret'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(error).toBeNull()
|
|
||||||
expect(data).toBeTruthy()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('GraphQL with variables', async () => {
|
|
||||||
const document = `
|
|
||||||
query ($id: uuid!) {
|
|
||||||
user (id: $id) {
|
|
||||||
id
|
|
||||||
displayName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ user: User }, { id: string }>(
|
|
||||||
document,
|
|
||||||
{
|
|
||||||
id: '5ccdb471-8ab2-4441-a3d1-f7f7146dda0c'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': 'nhost-admin-secret'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(error).toBeNull()
|
|
||||||
expect(data).toBeTruthy()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('GraphQL with incorrect variables', async () => {
|
|
||||||
const document = `
|
|
||||||
query ($id: uuid!) {
|
|
||||||
user (id: $id) {
|
|
||||||
id
|
|
||||||
displayName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ user: User }, { id: string }>(
|
|
||||||
document,
|
|
||||||
{
|
|
||||||
id: 'not-a-uuid'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': 'nhost-admin-secret'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(error).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"extensions": {
|
|
||||||
"code": "data-exception",
|
|
||||||
"path": "$",
|
|
||||||
},
|
|
||||||
"message": "invalid input syntax for type uuid: \\"not-a-uuid\\"",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
expect(data).toBeNull()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('GraphQL with missing variables', async () => {
|
|
||||||
const document = `
|
|
||||||
query ($id: uuid!) {
|
|
||||||
user (id: $id) {
|
|
||||||
id
|
|
||||||
displayName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
const { data, error } = await client.request<{ user: User }>(
|
|
||||||
document,
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'x-hasura-admin-secret': 'nhost-admin-secret'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(error).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"extensions": {
|
|
||||||
"code": "validation-failed",
|
|
||||||
"path": "$",
|
|
||||||
},
|
|
||||||
"message": "expecting a value for non-nullable variable: \\"id\\"",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
expect(data).toBeNull()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,258 +0,0 @@
|
|||||||
import fetch from 'cross-fetch'
|
|
||||||
import { beforeAll, describe, expect, it } from 'vitest'
|
|
||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/hasura'
|
|
||||||
|
|
||||||
const client = new NhostGraphqlClient({
|
|
||||||
schema,
|
|
||||||
url: 'http://localhost:1337/v1/graphql'
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Hasura', () => {
|
|
||||||
let userId: string
|
|
||||||
beforeAll(async () => {
|
|
||||||
// * Reload the metadata, as Hasura fails to load the remote schema in functions,
|
|
||||||
// * As functions are not available yet when Hasura starts and loads its metadata.
|
|
||||||
await fetch('http://localhost:1337/v1/metadata', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'x-hasura-admin-secret': 'nhost-admin-secret'
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
type: 'reload_metadata',
|
|
||||||
args: {
|
|
||||||
reload_remote_schemas: true,
|
|
||||||
reload_sources: false,
|
|
||||||
recreate_event_triggers: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const { data } = await client.request(`mutation { insertUser(object: {locale: "en"} ) { id } }`)
|
|
||||||
userId = data.insertUser.id
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should insert a todo', async () => {
|
|
||||||
const result = await client.mutation.insertTodo({
|
|
||||||
variables: { object: { contents: 'test', userId } },
|
|
||||||
select: {
|
|
||||||
contents: true,
|
|
||||||
user: { select: { email: true, id: true } }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.contents).toMatchInlineSnapshot('"test"')
|
|
||||||
expect(result.user.id).toEqual(userId)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should insert and remove a todo', async () => {
|
|
||||||
const insertResult = await client.mutation.insertTodo({
|
|
||||||
variables: { object: { contents: 'test', userId } },
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
contents: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(insertResult.contents).toMatchInlineSnapshot('"test"')
|
|
||||||
const deleteResult = await client.mutation.deleteTodo({
|
|
||||||
variables: { id: insertResult.id },
|
|
||||||
select: { contents: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(deleteResult).toMatchInlineSnapshot(`
|
|
||||||
{
|
|
||||||
"contents": "test",
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should work with an enum', async () => {
|
|
||||||
const todos = await client.query.todos({
|
|
||||||
variables: {
|
|
||||||
where: {
|
|
||||||
category: { _eq: 'essay' }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
select: { contents: true, category: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(todos).toMatchInlineSnapshot('[]')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should work with a wildcard', async () => {
|
|
||||||
const todos = await client.query.todos()
|
|
||||||
|
|
||||||
expect(Object.keys(todos[0])).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
"category",
|
|
||||||
"contents",
|
|
||||||
"createdAt",
|
|
||||||
"id",
|
|
||||||
"updatedAt",
|
|
||||||
"userId",
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should fail with an invalid field', async () => {
|
|
||||||
expect(() =>
|
|
||||||
client.query.todos({
|
|
||||||
select: { id: true, unexistingProperty: true }
|
|
||||||
})
|
|
||||||
).rejects.toThrowErrorMatchingInlineSnapshot('"Field unexistingProperty is not defined"')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should work with a nested wildcard', async () => {
|
|
||||||
const todos = await client.query.todos({
|
|
||||||
select: { id: true, user: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(Object.keys(todos[0])).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
"id",
|
|
||||||
"user",
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
expect(Object.keys(todos[0].user)).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
"avatarUrl",
|
|
||||||
"createdAt",
|
|
||||||
"defaultRole",
|
|
||||||
"displayName",
|
|
||||||
"email",
|
|
||||||
"id",
|
|
||||||
"isAnonymous",
|
|
||||||
"lastSeen",
|
|
||||||
"locale",
|
|
||||||
"updatedAt",
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should work with unions', async () => {
|
|
||||||
const result = await client.query.everyone({
|
|
||||||
on: {
|
|
||||||
Human: { select: { pets: { select: { diet: true } } } },
|
|
||||||
Dog: {
|
|
||||||
select: {
|
|
||||||
name: true,
|
|
||||||
barks: true,
|
|
||||||
owner: {
|
|
||||||
select: {
|
|
||||||
pets: { on: { Hamster: { select: { squeaks: true } } }, select: { name: true } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Hamster: { select: { name: true, diet: true } }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"__typename": "Human",
|
|
||||||
"pets": [
|
|
||||||
{
|
|
||||||
"diet": "CARNIVOROUS",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"diet": "CARNIVOROUS",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"diet": "HERBIVOROUS",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"barks": false,
|
|
||||||
"name": "Fido",
|
|
||||||
"owner": {
|
|
||||||
"pets": [
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"name": "Fido",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"name": "Rover",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Hamster",
|
|
||||||
"name": "Hammy",
|
|
||||||
"squeaks": true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"barks": true,
|
|
||||||
"name": "Rover",
|
|
||||||
"owner": {
|
|
||||||
"pets": [
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"name": "Fido",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"name": "Rover",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Hamster",
|
|
||||||
"name": "Hammy",
|
|
||||||
"squeaks": true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Hamster",
|
|
||||||
"diet": "HERBIVOROUS",
|
|
||||||
"name": "Hammy",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should work with interfaces', async () => {
|
|
||||||
const result = await client.query.pets({
|
|
||||||
select: { name: true, owner: { select: { firstName: true } } },
|
|
||||||
on: { Dog: { select: { barks: true } }, Hamster: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"barks": false,
|
|
||||||
"name": "Fido",
|
|
||||||
"owner": {
|
|
||||||
"firstName": "John",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Dog",
|
|
||||||
"barks": true,
|
|
||||||
"name": "Rover",
|
|
||||||
"owner": {
|
|
||||||
"firstName": "John",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__typename": "Hamster",
|
|
||||||
"diet": "HERBIVOROUS",
|
|
||||||
"name": "Hammy",
|
|
||||||
"owner": {
|
|
||||||
"firstName": "John",
|
|
||||||
},
|
|
||||||
"squeaks": true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/swapi'
|
|
||||||
|
|
||||||
const client = new NhostGraphqlClient({
|
|
||||||
schema,
|
|
||||||
url: 'https://swapi-graphql.netlify.app/.netlify/functions/index'
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Swapi', () => {
|
|
||||||
it('should get a single file', async () => {
|
|
||||||
const result = await client.query.film({
|
|
||||||
variables: { id: 'ZmlsbXM6MQ==' },
|
|
||||||
select: { title: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result).toMatchInlineSnapshot(`
|
|
||||||
{
|
|
||||||
"title": "A New Hope",
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should fetch several files', async () => {
|
|
||||||
const result = await client.query.allFilms({
|
|
||||||
variables: { before: 'ZmlsbXM6MQ==' },
|
|
||||||
select: {
|
|
||||||
edges: {
|
|
||||||
select: {
|
|
||||||
node: {
|
|
||||||
select: {
|
|
||||||
characterConnection: {
|
|
||||||
select: { totalCount: true }
|
|
||||||
},
|
|
||||||
director: true,
|
|
||||||
title: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result).toMatchInlineSnapshot(`
|
|
||||||
{
|
|
||||||
"edges": [
|
|
||||||
{
|
|
||||||
"node": {
|
|
||||||
"characterConnection": {
|
|
||||||
"totalCount": 18,
|
|
||||||
},
|
|
||||||
"director": "George Lucas",
|
|
||||||
"title": "A New Hope",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"node": {
|
|
||||||
"characterConnection": {
|
|
||||||
"totalCount": 16,
|
|
||||||
},
|
|
||||||
"director": "Irvin Kershner",
|
|
||||||
"title": "The Empire Strikes Back",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"node": {
|
|
||||||
"characterConnection": {
|
|
||||||
"totalCount": 20,
|
|
||||||
},
|
|
||||||
"director": "Richard Marquand",
|
|
||||||
"title": "Return of the Jedi",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"node": {
|
|
||||||
"characterConnection": {
|
|
||||||
"totalCount": 34,
|
|
||||||
},
|
|
||||||
"director": "George Lucas",
|
|
||||||
"title": "The Phantom Menace",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"node": {
|
|
||||||
"characterConnection": {
|
|
||||||
"totalCount": 40,
|
|
||||||
},
|
|
||||||
"director": "George Lucas",
|
|
||||||
"title": "Attack of the Clones",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"node": {
|
|
||||||
"characterConnection": {
|
|
||||||
"totalCount": 34,
|
|
||||||
},
|
|
||||||
"director": "George Lucas",
|
|
||||||
"title": "Revenge of the Sith",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,817 +0,0 @@
|
|||||||
export type Maybe<T> = T | null;
|
|
||||||
export type InputMaybe<T> = Maybe<T>;
|
|
||||||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
||||||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
||||||
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
||||||
/** All built-in and custom scalars, mapped to their actual values */
|
|
||||||
export type Scalars = {
|
|
||||||
ID: string;
|
|
||||||
String: string;
|
|
||||||
Boolean: boolean;
|
|
||||||
Int: number;
|
|
||||||
Float: number;
|
|
||||||
_Any: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Continent = {
|
|
||||||
__typename?: 'Continent';
|
|
||||||
code: Scalars['ID'];
|
|
||||||
countries: Array<Country>;
|
|
||||||
name: Scalars['String'];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ContinentFilterInput = {
|
|
||||||
code?: InputMaybe<StringQueryOperatorInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Country = {
|
|
||||||
__typename?: 'Country';
|
|
||||||
capital?: Maybe<Scalars['String']>;
|
|
||||||
code: Scalars['ID'];
|
|
||||||
continent: Continent;
|
|
||||||
currency?: Maybe<Scalars['String']>;
|
|
||||||
emoji: Scalars['String'];
|
|
||||||
emojiU: Scalars['String'];
|
|
||||||
languages: Array<Language>;
|
|
||||||
name: Scalars['String'];
|
|
||||||
native: Scalars['String'];
|
|
||||||
phone: Scalars['String'];
|
|
||||||
states: Array<State>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CountryFilterInput = {
|
|
||||||
code?: InputMaybe<StringQueryOperatorInput>;
|
|
||||||
continent?: InputMaybe<StringQueryOperatorInput>;
|
|
||||||
currency?: InputMaybe<StringQueryOperatorInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Language = {
|
|
||||||
__typename?: 'Language';
|
|
||||||
code: Scalars['ID'];
|
|
||||||
name?: Maybe<Scalars['String']>;
|
|
||||||
native?: Maybe<Scalars['String']>;
|
|
||||||
rtl: Scalars['Boolean'];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type LanguageFilterInput = {
|
|
||||||
code?: InputMaybe<StringQueryOperatorInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Query = {
|
|
||||||
__typename?: 'Query';
|
|
||||||
_entities: Array<Maybe<_Entity>>;
|
|
||||||
_service: _Service;
|
|
||||||
continent?: Maybe<Continent>;
|
|
||||||
continents: Array<Continent>;
|
|
||||||
countries: Array<Country>;
|
|
||||||
country?: Maybe<Country>;
|
|
||||||
language?: Maybe<Language>;
|
|
||||||
languages: Array<Language>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type Query__EntitiesArgs = {
|
|
||||||
representations: Array<Scalars['_Any']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type Query_ContinentArgs = {
|
|
||||||
code: Scalars['ID'];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type Query_ContinentsArgs = {
|
|
||||||
filter?: InputMaybe<ContinentFilterInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type Query_CountriesArgs = {
|
|
||||||
filter?: InputMaybe<CountryFilterInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type Query_CountryArgs = {
|
|
||||||
code: Scalars['ID'];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type Query_LanguageArgs = {
|
|
||||||
code: Scalars['ID'];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type Query_LanguagesArgs = {
|
|
||||||
filter?: InputMaybe<LanguageFilterInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type State = {
|
|
||||||
__typename?: 'State';
|
|
||||||
code?: Maybe<Scalars['String']>;
|
|
||||||
country: Country;
|
|
||||||
name: Scalars['String'];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type StringQueryOperatorInput = {
|
|
||||||
eq?: InputMaybe<Scalars['String']>;
|
|
||||||
glob?: InputMaybe<Scalars['String']>;
|
|
||||||
in?: InputMaybe<Array<InputMaybe<Scalars['String']>>>;
|
|
||||||
ne?: InputMaybe<Scalars['String']>;
|
|
||||||
nin?: InputMaybe<Array<InputMaybe<Scalars['String']>>>;
|
|
||||||
regex?: InputMaybe<Scalars['String']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type _Entity = Continent | Country | Language;
|
|
||||||
|
|
||||||
export type _Service = {
|
|
||||||
__typename?: '_Service';
|
|
||||||
/** The sdl representing the federated service capabilities. Includes federation directives, removes federation types, and includes rest of full schema after schema directives have been applied */
|
|
||||||
sdl?: Maybe<Scalars['String']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
|
||||||
introspection: {
|
|
||||||
"__schema": {
|
|
||||||
"queryType": {
|
|
||||||
"name": "Query"
|
|
||||||
},
|
|
||||||
"mutationType": null,
|
|
||||||
"subscriptionType": null,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Boolean"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Continent",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "countries",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Country",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "ContinentFilterInput",
|
|
||||||
"inputFields": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "StringQueryOperatorInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Country",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "capital",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "continent",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Continent",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "currency",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "emoji",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "emojiU",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "languages",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Language",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "native",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "phone",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "states",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "State",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "CountryFilterInput",
|
|
||||||
"inputFields": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "StringQueryOperatorInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "continent",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "StringQueryOperatorInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "currency",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "StringQueryOperatorInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Language",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "native",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rtl",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Boolean",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "LanguageFilterInput",
|
|
||||||
"inputFields": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "StringQueryOperatorInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Query",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "_entities",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "UNION",
|
|
||||||
"name": "_Entity",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "representations",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "_Any",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "_service",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "_Service",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "continent",
|
|
||||||
"type": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Continent",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "continents",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Continent",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "filter",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "ContinentFilterInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "countries",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Country",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "filter",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "CountryFilterInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "country",
|
|
||||||
"type": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Country",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "language",
|
|
||||||
"type": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Language",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "languages",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Language",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "filter",
|
|
||||||
"type": {
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "LanguageFilterInput",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "State",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "code",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "country",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Country",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "INPUT_OBJECT",
|
|
||||||
"name": "StringQueryOperatorInput",
|
|
||||||
"inputFields": [
|
|
||||||
{
|
|
||||||
"name": "eq",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "glob",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "in",
|
|
||||||
"type": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ne",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "nin",
|
|
||||||
"type": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "regex",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "_Any"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "UNION",
|
|
||||||
"name": "_Entity",
|
|
||||||
"possibleTypes": [
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Continent"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Country"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Language"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "_Service",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "sdl",
|
|
||||||
"type": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Any"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directives": []
|
|
||||||
}
|
|
||||||
} as const,
|
|
||||||
types: {} as {
|
|
||||||
Scalars: Scalars,
|
|
||||||
Continent: Continent,
|
|
||||||
ContinentFilterInput: ContinentFilterInput,
|
|
||||||
Country: Country,
|
|
||||||
CountryFilterInput: CountryFilterInput,
|
|
||||||
Language: Language,
|
|
||||||
LanguageFilterInput: LanguageFilterInput,
|
|
||||||
Query: Query,
|
|
||||||
Query__EntitiesArgs: Query__EntitiesArgs,
|
|
||||||
Query_ContinentArgs: Query_ContinentArgs,
|
|
||||||
Query_ContinentsArgs: Query_ContinentsArgs,
|
|
||||||
Query_CountriesArgs: Query_CountriesArgs,
|
|
||||||
Query_CountryArgs: Query_CountryArgs,
|
|
||||||
Query_LanguageArgs: Query_LanguageArgs,
|
|
||||||
Query_LanguagesArgs: Query_LanguagesArgs,
|
|
||||||
State: State,
|
|
||||||
StringQueryOperatorInput: StringQueryOperatorInput,
|
|
||||||
_Entity: _Entity,
|
|
||||||
_Service: _Service
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,440 +0,0 @@
|
|||||||
export type Maybe<T> = T | null;
|
|
||||||
export type InputMaybe<T> = Maybe<T>;
|
|
||||||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
||||||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
||||||
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
||||||
/** All built-in and custom scalars, mapped to their actual values */
|
|
||||||
export type Scalars = {
|
|
||||||
ID: string;
|
|
||||||
String: string;
|
|
||||||
Boolean: boolean;
|
|
||||||
Int: number;
|
|
||||||
Float: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Anyone = Dog | Hamster | Human;
|
|
||||||
|
|
||||||
export type Diet =
|
|
||||||
| 'CARNIVOROUS'
|
|
||||||
| 'HERBIVOROUS'
|
|
||||||
| 'OMNIVORIOUS';
|
|
||||||
|
|
||||||
export type Dog = Pet & {
|
|
||||||
__typename?: 'Dog';
|
|
||||||
barks: Scalars['Boolean'];
|
|
||||||
diet: Diet;
|
|
||||||
name: Scalars['String'];
|
|
||||||
owner: Human;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Hamster = Pet & {
|
|
||||||
__typename?: 'Hamster';
|
|
||||||
diet: Diet;
|
|
||||||
name: Scalars['String'];
|
|
||||||
owner: Human;
|
|
||||||
squeaks: Scalars['Boolean'];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Human = {
|
|
||||||
__typename?: 'Human';
|
|
||||||
firstName: Scalars['String'];
|
|
||||||
pets: Array<Pet>;
|
|
||||||
phoneNumber: Scalars['String'];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Pet = {
|
|
||||||
diet: Diet;
|
|
||||||
name: Scalars['String'];
|
|
||||||
owner: Human;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Query = {
|
|
||||||
__typename?: 'Query';
|
|
||||||
dogs: Array<Dog>;
|
|
||||||
everyone: Array<Anyone>;
|
|
||||||
hamsters: Array<Hamster>;
|
|
||||||
pets: Array<Pet>;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
|
||||||
introspection: {
|
|
||||||
"__schema": {
|
|
||||||
"queryType": {
|
|
||||||
"name": "Query"
|
|
||||||
},
|
|
||||||
"mutationType": null,
|
|
||||||
"subscriptionType": null,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"kind": "UNION",
|
|
||||||
"name": "Anyone",
|
|
||||||
"possibleTypes": [
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Dog"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Hamster"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Human"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Boolean"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "ENUM",
|
|
||||||
"name": "Diet",
|
|
||||||
"enumValues": [
|
|
||||||
{
|
|
||||||
"name": "CARNIVOROUS"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "HERBIVOROUS"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "OMNIVORIOUS"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Dog",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "barks",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Boolean",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "diet",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "ENUM",
|
|
||||||
"name": "Diet",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "owner",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Human",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": [
|
|
||||||
{
|
|
||||||
"kind": "INTERFACE",
|
|
||||||
"name": "Pet"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Float"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Hamster",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "diet",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "ENUM",
|
|
||||||
"name": "Diet",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "owner",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Human",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "squeaks",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Boolean",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": [
|
|
||||||
{
|
|
||||||
"kind": "INTERFACE",
|
|
||||||
"name": "Pet"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Human",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "firstName",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pets",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "INTERFACE",
|
|
||||||
"name": "Pet",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "ID"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Int"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "INTERFACE",
|
|
||||||
"name": "Pet",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "diet",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "ENUM",
|
|
||||||
"name": "Diet",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "owner",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Human",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": [],
|
|
||||||
"possibleTypes": [
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Dog"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Hamster"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Query",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "dogs",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Dog",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "everyone",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "UNION",
|
|
||||||
"name": "Anyone",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hamsters",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "OBJECT",
|
|
||||||
"name": "Hamster",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pets",
|
|
||||||
"type": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "LIST",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "NON_NULL",
|
|
||||||
"ofType": {
|
|
||||||
"kind": "INTERFACE",
|
|
||||||
"name": "Pet",
|
|
||||||
"ofType": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"args": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaces": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "String"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "SCALAR",
|
|
||||||
"name": "Any"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directives": []
|
|
||||||
}
|
|
||||||
} as const,
|
|
||||||
types: {} as {
|
|
||||||
Scalars: Scalars,
|
|
||||||
Anyone: Anyone,
|
|
||||||
Dog: Dog,
|
|
||||||
Hamster: Hamster,
|
|
||||||
Human: Human,
|
|
||||||
Pet: Pet,
|
|
||||||
Query: Query
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
|||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/hasura'
|
|
||||||
const client = new NhostGraphqlClient({ schema, url: '' })
|
|
||||||
|
|
||||||
// * Existing query
|
|
||||||
client.query.todos()
|
|
||||||
|
|
||||||
// * Unexisting query
|
|
||||||
// @ts-expect-error
|
|
||||||
client.query.unexistingQuery()
|
|
||||||
|
|
||||||
// * Existing mutation
|
|
||||||
client.mutation.insertTodo({ variables: { object: { id: 'abc' } } })
|
|
||||||
|
|
||||||
// * Unexisting mutation
|
|
||||||
// @ts-expect-error
|
|
||||||
client.mutation.unexistingMutation()
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/hasura'
|
|
||||||
const client = new NhostGraphqlClient({ schema, url: '' })
|
|
||||||
|
|
||||||
const enums = async () => {
|
|
||||||
// * Select all scalar fields
|
|
||||||
const fullTodos = await client.query.todos({
|
|
||||||
variables: { where: { category: { _eq: 'essay' } } }
|
|
||||||
})
|
|
||||||
const firstFullTodo = fullTodos[0]
|
|
||||||
firstFullTodo.category
|
|
||||||
firstFullTodo.category = 'essay'
|
|
||||||
firstFullTodo.category = 'novel'
|
|
||||||
// @ts-expect-error
|
|
||||||
firstFullTodo.category = 'value not in enum'
|
|
||||||
|
|
||||||
// * Pick only one field
|
|
||||||
const restrictedTodos = await client.query.todos({
|
|
||||||
variables: { where: { category: { _eq: 'essay' } } },
|
|
||||||
select: { category: true }
|
|
||||||
})
|
|
||||||
const firstRestrictedTodo = restrictedTodos[0]
|
|
||||||
firstRestrictedTodo.category
|
|
||||||
firstRestrictedTodo.category = 'essay'
|
|
||||||
firstRestrictedTodo.category = 'novel'
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedTodo.category = 'value not in enum'
|
|
||||||
|
|
||||||
// * Make a query with an enum value not in the enum
|
|
||||||
client.query.todos({
|
|
||||||
variables: {
|
|
||||||
where: {
|
|
||||||
category: {
|
|
||||||
// @ts-expect-error
|
|
||||||
_eq: 'value not in enum'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/hasura'
|
|
||||||
const client = new NhostGraphqlClient({ schema, url: '' })
|
|
||||||
|
|
||||||
client.query.todos()
|
|
||||||
|
|
||||||
const invalidProperty = async () => {
|
|
||||||
const [todo] = await client.query.todos({
|
|
||||||
select: {
|
|
||||||
userId: true,
|
|
||||||
category: true,
|
|
||||||
// TODO: this should not be allowed. In the meantime, it is not included in the generated query nor the result type
|
|
||||||
unexistingProperty: 43
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
todo.userId
|
|
||||||
// @ts-expect-error
|
|
||||||
todo.contents
|
|
||||||
// @ts-expect-error
|
|
||||||
todo.unexistingProperty
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
// TODO
|
|
||||||
export {}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/hasura'
|
|
||||||
const client = new NhostGraphqlClient({ schema, url: '' })
|
|
||||||
|
|
||||||
// * Parameters
|
|
||||||
client.query.todos({
|
|
||||||
variables: {
|
|
||||||
limit: 1,
|
|
||||||
distinct_on: ['category', 'contents'],
|
|
||||||
offset: 1,
|
|
||||||
order_by: [{ category: 'asc' }],
|
|
||||||
where: { _and: [{ id: { _eq: 'abc' } }, { category: { _eq: 'essay' } }] }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// * Unexisting parameter
|
|
||||||
client.query.todos({
|
|
||||||
variables: {
|
|
||||||
// @ts-expect-error
|
|
||||||
invalid: 1
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// * Invalid parameter type
|
|
||||||
// @ts-expect-error
|
|
||||||
client.query.todos('invalid')
|
|
||||||
client.query.todos({
|
|
||||||
variables: {
|
|
||||||
// @ts-expect-error
|
|
||||||
limit: 'string-instead-of-number'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// * Required parameters
|
|
||||||
// @ts-expect-error
|
|
||||||
client.query.todo()
|
|
||||||
// @ts-expect-error
|
|
||||||
client.query.todo({ variables: {} })
|
|
||||||
client.query.todo({ variables: { id: 'abc' } })
|
|
||||||
// @ts-expect-error
|
|
||||||
client.mutation.insertTodo()
|
|
||||||
|
|
||||||
// * Optional parameters
|
|
||||||
client.query.todos({ variables: {} })
|
|
||||||
|
|
||||||
// * Snake case mutation
|
|
||||||
client.mutation.insert_tasks({
|
|
||||||
variables: { objects: [{ description: 'a new task' }] },
|
|
||||||
select: { affected_rows: true }
|
|
||||||
})
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/hasura'
|
|
||||||
const client = new NhostGraphqlClient({ schema, url: '' })
|
|
||||||
|
|
||||||
// *****************************************************************
|
|
||||||
// ************************** Object *******************************
|
|
||||||
// *****************************************************************
|
|
||||||
const objects = async () => {
|
|
||||||
// * Select all scalar fields
|
|
||||||
const fullTodo = await client.query.todo({ variables: { id: 'abc' } })
|
|
||||||
fullTodo.__typename
|
|
||||||
fullTodo.category
|
|
||||||
fullTodo.contents
|
|
||||||
fullTodo.id
|
|
||||||
fullTodo.createdAt
|
|
||||||
fullTodo.updatedAt
|
|
||||||
fullTodo.userId
|
|
||||||
// * Do not allow unexisting fields
|
|
||||||
// @ts-expect-error
|
|
||||||
fullTodo.unexistingField
|
|
||||||
// * Do not allow non-scalar fields
|
|
||||||
// @ts-expect-error
|
|
||||||
fullTodo.user
|
|
||||||
|
|
||||||
// * Pick only some fields
|
|
||||||
const restrictedTodo = await client.query.todo({
|
|
||||||
variables: { id: 'abc' },
|
|
||||||
select: { id: true, contents: true }
|
|
||||||
})
|
|
||||||
restrictedTodo.id
|
|
||||||
restrictedTodo.contents
|
|
||||||
// @ts-expect-error
|
|
||||||
restrictedTodo.__typename
|
|
||||||
// @ts-expect-error
|
|
||||||
restrictedTodo.category
|
|
||||||
// @ts-expect-error
|
|
||||||
restrictedTodo.createdAt
|
|
||||||
// @ts-expect-error
|
|
||||||
restrictedTodo.updatedAt
|
|
||||||
// @ts-expect-error
|
|
||||||
restrictedTodo.userId
|
|
||||||
|
|
||||||
// * Pick all the scalars of a relationship
|
|
||||||
const fullUserTodo = await client.query.todo({
|
|
||||||
variables: { id: 'abc' },
|
|
||||||
select: { user: true }
|
|
||||||
})
|
|
||||||
fullUserTodo.user.__typename
|
|
||||||
fullUserTodo.user.id
|
|
||||||
fullUserTodo.user.email
|
|
||||||
// @ts-expect-error
|
|
||||||
fullUserTodo.user.unexistingField
|
|
||||||
// @ts-expect-error
|
|
||||||
fullUserTodo.id
|
|
||||||
|
|
||||||
// * Pick only some fields of a relationship
|
|
||||||
const restrictedUserTodo = await client.query.todo({
|
|
||||||
variables: { id: 'abc' },
|
|
||||||
select: { user: { select: { id: true } } }
|
|
||||||
})
|
|
||||||
restrictedUserTodo.user.id
|
|
||||||
// @ts-expect-error
|
|
||||||
restrictedUserTodo.user.email
|
|
||||||
// @ts-expect-error
|
|
||||||
fullUserTodo.user.unexistingField
|
|
||||||
// @ts-expect-error
|
|
||||||
fullUserTodo.id
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************************************************************
|
|
||||||
// ************************** Array ********************************
|
|
||||||
// *****************************************************************
|
|
||||||
const arrays = async () => {
|
|
||||||
// * Select all scalar fields
|
|
||||||
const fullTodos = await client.query.todos()
|
|
||||||
// * Should not be an object
|
|
||||||
// @ts-expect-error
|
|
||||||
fullTodos.id
|
|
||||||
const firstFullTodo = fullTodos[0]
|
|
||||||
firstFullTodo.__typename
|
|
||||||
firstFullTodo.category
|
|
||||||
firstFullTodo.contents
|
|
||||||
firstFullTodo.id
|
|
||||||
firstFullTodo.createdAt
|
|
||||||
firstFullTodo.updatedAt
|
|
||||||
firstFullTodo.userId
|
|
||||||
// * Do not allow unexisting fields
|
|
||||||
// @ts-expect-error
|
|
||||||
firstFullTodo.unexistingField
|
|
||||||
// * Do not allow non-scalar fields
|
|
||||||
// @ts-expect-error
|
|
||||||
firstFullTodo.user
|
|
||||||
|
|
||||||
// * Pick only some fields
|
|
||||||
const restrictedTodos = await client.query.todos({
|
|
||||||
select: { id: true, contents: true }
|
|
||||||
})
|
|
||||||
const firstRestrictedTodo = restrictedTodos[0]
|
|
||||||
firstRestrictedTodo.id
|
|
||||||
firstRestrictedTodo.contents
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedTodo.__typename
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedTodo.category
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedTodo.createdAt
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedTodo.updatedAt
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedTodo.userId
|
|
||||||
|
|
||||||
// * Pick all the scalars of a relationship
|
|
||||||
const fullUserTodos = await client.query.todos({
|
|
||||||
select: { user: true }
|
|
||||||
})
|
|
||||||
const firstUserTodo = fullUserTodos[0]
|
|
||||||
firstUserTodo.user.__typename
|
|
||||||
firstUserTodo.user.id
|
|
||||||
firstUserTodo.user.email
|
|
||||||
// @ts-expect-error
|
|
||||||
firstUserTodo.user.unexistingField
|
|
||||||
// @ts-expect-error
|
|
||||||
firstUserTodo.id
|
|
||||||
|
|
||||||
// * Pick only some fields of a relationship
|
|
||||||
const restrictedUserTodos = await client.query.todos({
|
|
||||||
select: { user: { select: { id: true } } }
|
|
||||||
})
|
|
||||||
const firstRestrictedUserTodo = restrictedUserTodos[0]
|
|
||||||
firstRestrictedUserTodo.user.id
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedUserTodo.user.email
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedUserTodo.user.unexistingField
|
|
||||||
// @ts-expect-error
|
|
||||||
firstRestrictedUserTodo.id
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { NhostGraphqlClient } from '../../src'
|
|
||||||
import schema from '../schemas/hasura'
|
|
||||||
const client = new NhostGraphqlClient({ schema, url: '' })
|
|
||||||
|
|
||||||
client.query.everyone({
|
|
||||||
on: {
|
|
||||||
Dog: { select: { name: true } },
|
|
||||||
Human: {
|
|
||||||
select: { firstName: true, pets: { select: { diet: true } } },
|
|
||||||
Hamster: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user