@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.53
0.12.40
0.12.30
0.12.20
0.12.10
0.12.00
0.11.30
0.11.21
0.11.11
0.11.01
0.10.00
0.9.11
0.9.01
0.8.01
0.7.11
0.7.01
0.6.00
0.5.01
0.4.11
0.4.01
0.3.10
0.3.02
0.2.01
0.1.01

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