Skip to content

Commit

Permalink
WIT as npm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
andykswong committed Sep 16, 2024
1 parent 3617e0d commit 3a608f4
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 8 deletions.
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
"webpack-dev-server": "^5.1"
},
"workspaces": [
"./wit/keyvalue",
"./wit/messaging",
"./packages/commons",
"./packages/core",
"./packages/keyvalue",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/io/provider/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './io.ts';
export * from './provider.ts';
export * from './client.ts';
export * from './remote.ts';
export * from './reactor.ts';
2 changes: 1 addition & 1 deletion packages/core/src/io/provider/io.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AtomicPollables } from '@mithic/commons';
import { type IoProvider } from './provider.ts';
import { RemoteIoProvider } from './client.ts';
import { RemoteIoProvider } from './remote.ts';

let provider: IoProvider;

Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/io/provider/provider.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { type MaybeDisposable, type SharedChannelBuffers } from '@mithic/commons';
import { type MaybeDisposable } from '@mithic/commons';

/** Provider of I/O stream operations. */
export interface IoProvider extends MaybeDisposable {
/** The shared channel buffers of the provider. */
readonly channel: SharedChannelBuffers;

/** Returns the state of given stream. */
state(fd: number): number;

Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions wit/keyvalue/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# mithic:keyvalue

[![mithic](https://img.shields.io/badge/project-mithic-blueviolet.svg?style=flat-square&logo=github)](https://github.com/andykswong/mithic)
[![npm](https://img.shields.io/npm/v/@mithic/interface-keyvalue?style=flat-square&logo=npm)](https://www.npmjs.com/package/@mithic/interface-keyvalue)
[![docs](https://img.shields.io/badge/docs-typedoc-blue?style=flat-square&logo=typescript&logoColor=white)](http://andykswong.github.io/mithic)
[![license: MIT](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](./LICENSE)
[![build](https://img.shields.io/github/actions/workflow/status/andykswong/mithic/build.yaml?style=flat-square)](https://github.com/andykswong/mithic/actions/workflows/build.yaml)

Key-value store API for mithic.
Forked from [wasi-keyvalue](https://github.com/WebAssembly/wasi-keyvalue) draft API.
44 changes: 44 additions & 0 deletions wit/keyvalue/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@mithic/interface-keyvalue",
"version": "0.2.0",
"description": "mithic key-value store WIT spec",
"type": "module",
"sideEffects": false,
"main": "./dist/keyvalue.wasm",
"exports": {
".": "./dist/keyvalue.wasm"
},
"files": [
"/dist",
"/wit"
],
"scripts": {
"prepublishOnly": "npm run clean && npm run build",
"clean": "rimraf dist",
"prebuild": "mkdir -p dist",
"build": "../../bin/wasm-tools component wit -w -o dist/keyvalue.wasm wit",
"test": "echo \"ok\"",
"wit-deps": "../../bin/wit-deps"
},
"repository": {
"type": "git",
"url": "git+https://github.com/andykswong/mithic.git"
},
"keywords": [
"collection",
"keyvalue",
"mithic",
"typescript",
"wit"
],
"author": "Andy K.S. Wong <andykswong@outlook.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/andykswong/mithic/issues"
},
"homepage": "https://github.com/andykswong/mithic",
"dependencies": {
},
"devDependencies": {
}
}
Empty file added wit/keyvalue/wit/deps.lock
Empty file.
Empty file added wit/keyvalue/wit/deps.toml
Empty file.
6 changes: 6 additions & 0 deletions wit/messaging/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# mithic:messaging

[![mithic](https://img.shields.io/badge/project-mithic-blueviolet.svg?style=flat-square&logo=github)](https://github.com/andykswong/mithic)
[![npm](https://img.shields.io/npm/v/@mithic/interface-messaging?style=flat-square&logo=npm)](https://www.npmjs.com/package/@mithic/interface-messaging)
[![docs](https://img.shields.io/badge/docs-typedoc-blue?style=flat-square&logo=typescript&logoColor=white)](http://andykswong.github.io/mithic)
[![license: MIT](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](./LICENSE)
[![build](https://img.shields.io/github/actions/workflow/status/andykswong/mithic/build.yaml?style=flat-square)](https://github.com/andykswong/mithic/actions/workflows/build.yaml)

Messaging API for mithic.
Forked from [wasi-messaging](https://github.com/WebAssembly/wasi-messaging) draft API.
48 changes: 48 additions & 0 deletions wit/messaging/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@mithic/interface-messaging",
"version": "0.2.0",
"description": "mithic messaging WIT spec",
"type": "module",
"sideEffects": false,
"main": "./dist/messaging.wasm",
"exports": {
".": "./dist/messaging.wasm"
},
"files": [
"/dist",
"/wit"
],
"scripts": {
"prepublishOnly": "npm run clean && npm run build",
"clean": "rimraf dist",
"prebuild": "mkdir -p dist",
"build": "../../bin/wasm-tools component wit -w -o dist/messaging.wasm wit",
"test": "echo \"ok\"",
"wit-deps": "../../bin/wit-deps"
},
"repository": {
"type": "git",
"url": "git+https://github.com/andykswong/mithic.git"
},
"keywords": [
"message",
"messagequeue",
"messaging",
"mithic",
"p2p",
"pubsub",
"queue",
"typescript",
"wit"
],
"author": "Andy K.S. Wong <andykswong@outlook.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/andykswong/mithic/issues"
},
"homepage": "https://github.com/andykswong/mithic",
"dependencies": {
},
"devDependencies": {
}
}
2 changes: 1 addition & 1 deletion wit/messaging/wit/consumer.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// The consumer interface is used to subscribe to channels/topics.
interface consumer {
use types.{client, error};
use types.{error};

/// Subscribe to given topics.
subscribe: func(topics: list<string>) -> result<_, error>;
Expand Down
Empty file added wit/messaging/wit/deps.lock
Empty file.
Empty file added wit/messaging/wit/deps.toml
Empty file.
2 changes: 1 addition & 1 deletion wit/messaging/wit/peer.wit
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ interface peer {
/// Get the list of known `peer-id` that subscribed to given topic.
/// MAY be an empty list for messaging services without peer identification.
/// MAY be a partial list of discovered `peer-id` in peer-to-peer messaging.
list-subscribers(topic: string): result<list<peer-id>, error>;
list-subscribers: func(topic: string) -> result<list<peer-id>, error>;
}

0 comments on commit 3a608f4

Please sign in to comment.