0.14.0 • Published 7 months ago

@musubi/core v0.14.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

@musubi/core

Documentation

Full documentation for @musubi/core can be found here.

Installation

# npm
npm install @musubi/core

# Yarn
yarn add @musubi/core

Usage

import { defineSchema, CommunicatorClient } from "@musubi/core";
import { createHttpClientLink } from "@musubi/http-link";
import { z } from "zod";

const schema = defineSchema({
  queries: {
    greet: query()
      .withPayload(
        z.object({
          name: z.string()
        })
      )
      .withResult(z.string())
  }
});

async function main() {
  const httpLink = createHttpClientLink({
    url: "http://localhost:3000/api"
  });
  const client = new CommunicatorClient(schema, [httpLink]);

  // Querying the greeting
  const response = await client.query("greet", {
    name: "John"
  });

  console.log("response", response); // Hello John
}
0.13.0

8 months ago

0.14.0

7 months ago

0.12.1

1 year ago

0.12.2

1 year ago

0.12.3

1 year ago

0.12.4

1 year ago

0.12.5

1 year ago

0.11.0

2 years ago

0.12.0

2 years ago

0.11.1

2 years ago

0.11.2

2 years ago

0.11.3

2 years ago

0.10.0

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago