@polywrap/schema-compose
TypeScript icon, indicating that this package has built-in type declarations

0.12.2 • Public • Published

Polywrap Schema Compose (@polywrap/schema-compose)

Composes GraphQL schema source and typings for passing to schema-bind.

Usage

import path from "path";
import { readFileSync } from "fs";
import { ComposerOptions, ComposeFilter, composeSchema } from "@polywrap/schema-compose";
import { TypeInfo } from "@polywrap/schema-parse";

const schemaPath = "input/module.graphql"

const schema = readFileSync(schemaPath);

const resolveExternal = (uri: string): Promise<string> => {
  return Promise.resolve(readFileSync(`imports-ext/${uri}/schema.graphql`) || "");
};

const resolveLocal = (path: string): Promise<string> => {
  return Promise.resolve(readFileSync(path) || "");
};

const input: ComposerOptions = {
  schemas: [{
    schema,
    absolutePath,
  }],
  abiResolver: (
    importFrom: string,
    schemaFile: SchemaFile
  ) => Promise<Abi | SchemaFile> => {
    ...
  },
  output: ComposerFilter.All
};

const output: ComposerOutput = composeSchema(input);

const { schema: string, typeInfo: TypeInfo } = output;

Readme

Keywords

none

Package Sidebar

Install

npm i @polywrap/schema-compose

Weekly Downloads

11

Version

0.12.2

License

MIT

Unpacked Size

130 kB

Total Files

32

Last publish

Collaborators

  • polywrap-build-bot
  • dorgjelli