Compare commits

...

12 Commits

Author SHA1 Message Date
Pilou
76ce7d7b6e Merge pull request #1653 from nhost/changeset-release/main
chore: update versions
2023-02-22 15:43:41 +01:00
github-actions[bot]
538bfbcb3e chore: update versions 2023-02-22 14:23:55 +00:00
Pilou
07b35d1e5f Merge pull request #1650 from nhost/docs/graphql-client-readme
GraphQL client: fix snake_case bug and improve readme
2023-02-22 15:22:34 +01:00
Pierre-Louis Mercereau
2200a0ed07 fix: correct types on snake case operations 2023-02-22 15:13:43 +01:00
Szilárd Dóró
df23d97126 Merge pull request #1652 from nhost/changeset-release/main
chore: update versions
2023-02-22 14:44:46 +01:00
github-actions[bot]
104f149369 chore: update versions 2023-02-22 13:26:08 +00:00
Szilárd Dóró
01228583a0 Merge pull request #1651 from nhost/fix/permission-editor-dropdown
fix(dashboard): prevent permission editor dropdown from being always open
2023-02-22 14:24:51 +01:00
Pierre-Louis Mercereau
93309dd851 docs: strictNullChecks 2023-02-22 14:06:10 +01:00
Szilárd Dóró
2cc18dcb51 fix(dashboard): prevent permission editor dropdown from being always open 2023-02-22 13:54:31 +01:00
Pierre-Louis Mercereau
3b48a62790 docs: ✏️ improve readme instructions 2023-02-22 13:44:15 +01:00
Pierre-Louis Mercereau
8897dec056 docs: add package.json script instructions 2023-02-22 12:23:54 +01:00
Pierre-Louis Mercereau
324dda8309 docs: streamline readme instructions 2023-02-22 11:58:51 +01:00
29 changed files with 2135 additions and 54 deletions

View File

@@ -1,5 +1,18 @@
# @nhost/dashboard
## 0.11.15
### Patch Changes
- @nhost/react-apollo@5.0.2
- @nhost/nextjs@1.13.7
## 0.11.14
### Patch Changes
- 2cc18dcb: fix(dashboard): prevent permission editor dropdown from being always open
## 0.11.13
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "0.11.13",
"version": "0.11.15",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",

View File

@@ -213,7 +213,6 @@ export default function RuleValueInput({
freeSolo={!isHasuraInput}
autoSelect={!isHasuraInput}
autoHighlight={isHasuraInput}
open
isOptionEqualToValue={(option, value) => {
if (typeof value === 'string') {
return option.value.toLowerCase() === (value as string).toLowerCase();

View File

@@ -1,5 +1,11 @@
# @nhost/apollo
## 5.0.1
### Patch Changes
- @nhost/nhost-js@2.0.1
## 5.0.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/apollo",
"version": "5.0.0",
"version": "5.0.1",
"description": "Nhost Apollo Client library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,12 @@
# @nhost/react-apollo
## 5.0.2
### Patch Changes
- @nhost/apollo@5.0.1
- @nhost/react@2.0.1
## 5.0.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-apollo",
"version": "5.0.1",
"version": "5.0.2",
"description": "Nhost React Apollo client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/react-urql
## 2.0.1
### Patch Changes
- @nhost/react@2.0.1
## 2.0.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-urql",
"version": "2.0.0",
"version": "2.0.1",
"description": "Nhost React URQL client",
"license": "MIT",
"keywords": [

View File

@@ -0,0 +1,8 @@
# @nhost/graphql-js
## 0.0.2
### Patch Changes
- 2200a0ed: Correct type inference on snake case operations
- 3b48a627: Improve readme instructions

View File

@@ -16,15 +16,25 @@ Nhost GraphQL client.
First, install `graphql-codegen` and the Nhost Typescript plugin:
```sh
npm install @nhost/graphql-js
npm install -D @graphql-codegen/cli @graphql-codegen/typescript-nhost
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 `graphql.config.yaml` file:
Configure the code generator by adding a `codegen.yaml` file:
```yaml filename="graphql.config.yaml"
```yaml filename="codegen.yaml"
schema:
- http://localhost:1337/v1/graphql:
headers:
@@ -35,17 +45,27 @@ generates:
- typescript-nhost
```
Add the codegen script to `package.json`:
```json filename="package.json"
{
"scripts": {
"codegen": "graphql-codegen"
}
}
```
Generate the schema:
```sh
yarn graphql-codegen
yarn run codegen
```
## Usage
```ts filename="./src/main.ts"
import { NhostGraphqlClient } from '@nhost/graphql-js'
import schema from './schema.ts'
import schema from './schema'
const client = new NhostGraphqlClient({ url: 'http://localhost:1337/v1/graphql', schema })
```
@@ -137,4 +157,4 @@ giraffes.forEach((giraffe) => {
## Documentation
[https://docs.nhost.io/reference/javascript/auth](https://docs.nhost.io/reference/javascript/graphql)
[https://docs.nhost.io/reference/javascript/graphql](https://docs.nhost.io/reference/javascript/graphql)

View File

@@ -0,0 +1,30 @@
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: {}

View File

@@ -7,6 +7,7 @@
- "!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"

View File

@@ -0,0 +1 @@
DROP TABLE "public"."tasks";

View File

@@ -0,0 +1,2 @@
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;

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/graphql-js",
"version": "0.0.1",
"version": "0.0.2",
"description": "Nhost GraphQL client",
"license": "MIT",
"keywords": [
@@ -69,6 +69,9 @@
},
"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/hasura-auth-js": "workspace:*",
"graphql": "16.6.0",

View File

@@ -44,7 +44,7 @@ export type FieldArgs<
Schema extends GenericSchema,
OperationType extends OperationTypes,
FieldName extends string,
Suffix extends string = `_${Capitalize<FieldName>}Args`
Suffix extends string = `_${CapitalizeSnakeCase<FieldName>}Args`
> = Schema['types'][`${RootOperationName<Schema, OperationType>}${Suffix}`]
export type OperationRootTypeOf<

View File

@@ -1,5 +1,5 @@
generates:
./schemas/hasura.ts:
./tests/schemas/hasura.ts:
schema: http://localhost:1337/v1/graphql
config:
scalars:
@@ -14,11 +14,11 @@ generates:
- typescript-nhost
- add:
content: 'export type JSONValue = string | number | boolean | { [x: string]: JSONValue } | Array<JSONValue>;'
./schemas/countries.ts:
./tests/schemas/countries.ts:
schema: https://countries.trevorblades.com/graphql
plugins:
- typescript-nhost
./schemas/swapi.ts:
./tests/schemas/swapi.ts:
schema: https://swapi-graphql.netlify.app/.netlify/functions/index
plugins:
- typescript-nhost

File diff suppressed because it is too large Load Diff

View File

@@ -42,3 +42,9 @@ 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 }
})

View File

@@ -1,5 +1,11 @@
# @nhost/nextjs
## 1.13.7
### Patch Changes
- @nhost/react@2.0.1
## 1.13.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nextjs",
"version": "1.13.6",
"version": "1.13.7",
"description": "Nhost NextJS library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/nhost-js
## 2.0.1
### Patch Changes
- Updated dependencies [2200a0ed]
- Updated dependencies [3b48a627]
- @nhost/graphql-js@0.0.2
## 2.0.0
### Major Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nhost-js",
"version": "2.0.0",
"version": "2.0.1",
"description": "Nhost JavaScript SDK",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/react
## 2.0.1
### Patch Changes
- @nhost/nhost-js@2.0.1
## 2.0.0
### Major Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react",
"version": "2.0.0",
"version": "2.0.1",
"description": "Nhost React library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/vue
## 1.13.7
### Patch Changes
- @nhost/nhost-js@2.0.1
## 1.13.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/vue",
"version": "1.13.6",
"version": "1.13.7",
"description": "Nhost Vue library",
"license": "MIT",
"keywords": [

671
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff