|
| 1 | +# @pgpmjs/migrate-client |
| 2 | + |
| 3 | +<p align="center" width="100%"> |
| 4 | + <img height="120" src="https://raw.githubusercontent.com/constructive-io/constructive/refs/heads/main/assets/outline-logo.svg" /> |
| 5 | +</p> |
| 6 | + |
| 7 | +<p align="center" width="100%"> |
| 8 | + <a href="https://github.com/constructive-io/constructive/actions/workflows/run-tests.yaml"> |
| 9 | + <img height="20" src="https://github.com/constructive-io/constructive/actions/workflows/run-tests.yaml/badge.svg" /> |
| 10 | + </a> |
| 11 | + <a href="https://github.com/constructive-io/constructive/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a> |
| 12 | + <a href="https://www.npmjs.com/package/@pgpmjs/migrate-client"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/constructive?filename=sdk%2Fmigrate-client%2Fpackage.json"/></a> |
| 13 | +</p> |
| 14 | + |
| 15 | +Typed GraphQL ORM client for the Constructive Migrate API (`db_migrate` schema). |
| 16 | + |
| 17 | +Generated from `migrate.graphql` via `@constructive-io/graphql-codegen`. |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +```typescript |
| 22 | +import { createClient } from '@pgpmjs/migrate-client'; |
| 23 | + |
| 24 | +const db = createClient({ |
| 25 | + endpoint: 'https://migrate.example.com/graphql', |
| 26 | + headers: { Authorization: 'Bearer <token>' }, |
| 27 | +}); |
| 28 | + |
| 29 | +// Fetch all sql_actions for a database |
| 30 | +const result = await db.sqlAction.findMany({ |
| 31 | + select: { id: true, name: true, deploy: true, revert: true, verify: true, content: true }, |
| 32 | + where: { databaseId: { equalTo: '<database-uuid>' } }, |
| 33 | +}).unwrap(); |
| 34 | + |
| 35 | +console.log(result.sqlActions.nodes); |
| 36 | +``` |
| 37 | + |
| 38 | +## Regeneration |
| 39 | + |
| 40 | +```bash |
| 41 | +pnpm generate |
| 42 | +``` |
| 43 | + |
| 44 | +This runs codegen against `schemas/migrate.graphql` and outputs to `src/`. |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +Built by the [Constructive](https://constructive.io) team. |
| 49 | + |
| 50 | +## Disclaimer |
| 51 | + |
| 52 | +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. |
| 53 | + |
| 54 | +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. |
0 commit comments