@musubi/core

0.14.0Β β€’Β PublicΒ β€’Β Published

Musubi πŸͺ’

End-to-end typesafe communication. πŸŽ‰

@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
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.14.00latest

Version History

VersionDownloads (Last 7 Days)Published
0.14.00
0.13.00
0.12.50
0.12.40
0.12.30
0.12.20
0.12.11
0.12.00
0.11.30
0.11.20
0.11.10
0.11.00
0.10.00
0.9.10
0.9.00
0.8.00
0.7.10
0.7.00
0.6.00
0.5.00
0.4.10
0.4.00
0.3.10
0.3.00
0.2.00
0.1.00

Package Sidebar

Install

npm i @musubi/core

Weekly Downloads

1

Version

0.14.0

License

MIT

Unpacked Size

106 kB

Total Files

6

Last publish

Collaborators

  • theunderscorer