Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce sessionv2, written in typescript, for compatibility with latest spin #95

Merged
merged 5 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install Spin
uses: fermyon/actions/spin/setup@v1
with:
version: v2.0.1
version: v2.7.0

- name: Install node
uses: actions/setup-node@v3
Expand All @@ -41,10 +41,14 @@ jobs:
cache: "npm"
cache-dependency-path: site/package-lock.json

- name: Install npm dependencies
- name: Install npm dependencies for site
working-directory: site
run: npm ci

- name: Install npm dependencies for sessionv2
working-directory: sessionv2
run: npm ci

- name: Build
env:
ENABLE_WASM_OPT: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:

jobs:
build:
uses: fermyon/finicky-whiskers/.github/workflows/build.yml@main
uses: ./.github/workflows/build.yml

deploy:
runs-on: ubuntu-latest
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Setup Spin
uses: fermyon/actions/spin/setup@v1
with:
version: v2.0.1
version: v2.7.0

- name: Login to Fermyon Cloud
run: spin cloud login --token "${{ secrets.FERMYON_CLOUD_TOKEN }}"
Expand Down
Binary file added components/sessionv2.wasm
Binary file not shown.
5 changes: 5 additions & 0 deletions sessionv2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
target
.spin/
dist.js
4 changes: 4 additions & 0 deletions sessionv2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: build
build:
spin build
cp target/sessionv2.wasm ../components/sessionv2.wasm
21 changes: 21 additions & 0 deletions sessionv2/combined-wit/combined-wit.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package local:combined-wit;

world combined {
import wasi:io/poll@0.2.0;
import wasi:clocks/monotonic-clock@0.2.0;
import wasi:io/error@0.2.0;
import wasi:io/streams@0.2.0;
import wasi:http/types@0.2.0;
import wasi:http/outgoing-handler@0.2.0;
import fermyon:spin/llm@2.0.0;
import fermyon:spin/redis@2.0.0;
import fermyon:spin/rdbms-types@2.0.0;
import fermyon:spin/postgres@2.0.0;
import fermyon:spin/mysql@2.0.0;
import fermyon:spin/mqtt@2.0.0;
import fermyon:spin/sqlite@2.0.0;
import fermyon:spin/key-value@2.0.0;
import fermyon:spin/variables@2.0.0;

export wasi:http/incoming-handler@0.2.0;
}
122 changes: 122 additions & 0 deletions sessionv2/combined-wit/deps/cli.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package wasi:cli@0.2.0;

interface environment {
get-environment: func() -> list<tuple<string, string>>;

get-arguments: func() -> list<string>;

initial-cwd: func() -> option<string>;
}

interface exit {
exit: func(status: result);
}

interface run {
run: func() -> result;
}

interface stdin {
use wasi:io/streams@0.2.0.{input-stream};

get-stdin: func() -> input-stream;
}

interface stdout {
use wasi:io/streams@0.2.0.{output-stream};

get-stdout: func() -> output-stream;
}

interface stderr {
use wasi:io/streams@0.2.0.{output-stream};

get-stderr: func() -> output-stream;
}

interface terminal-input {
resource terminal-input;
}

interface terminal-output {
resource terminal-output;
}

interface terminal-stdin {
use terminal-input.{terminal-input};

get-terminal-stdin: func() -> option<terminal-input>;
}

interface terminal-stdout {
use terminal-output.{terminal-output};

get-terminal-stdout: func() -> option<terminal-output>;
}

interface terminal-stderr {
use terminal-output.{terminal-output};

get-terminal-stderr: func() -> option<terminal-output>;
}

world imports {
import environment;
import exit;
import wasi:io/error@0.2.0;
import wasi:io/poll@0.2.0;
import wasi:io/streams@0.2.0;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
import wasi:clocks/monotonic-clock@0.2.0;
import wasi:clocks/wall-clock@0.2.0;
import wasi:filesystem/types@0.2.0;
import wasi:filesystem/preopens@0.2.0;
import wasi:sockets/network@0.2.0;
import wasi:sockets/instance-network@0.2.0;
import wasi:sockets/udp@0.2.0;
import wasi:sockets/udp-create-socket@0.2.0;
import wasi:sockets/tcp@0.2.0;
import wasi:sockets/tcp-create-socket@0.2.0;
import wasi:sockets/ip-name-lookup@0.2.0;
import wasi:random/random@0.2.0;
import wasi:random/insecure@0.2.0;
import wasi:random/insecure-seed@0.2.0;
}
world command {
import environment;
import exit;
import wasi:io/error@0.2.0;
import wasi:io/poll@0.2.0;
import wasi:io/streams@0.2.0;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
import wasi:clocks/monotonic-clock@0.2.0;
import wasi:clocks/wall-clock@0.2.0;
import wasi:filesystem/types@0.2.0;
import wasi:filesystem/preopens@0.2.0;
import wasi:sockets/network@0.2.0;
import wasi:sockets/instance-network@0.2.0;
import wasi:sockets/udp@0.2.0;
import wasi:sockets/udp-create-socket@0.2.0;
import wasi:sockets/tcp@0.2.0;
import wasi:sockets/tcp-create-socket@0.2.0;
import wasi:sockets/ip-name-lookup@0.2.0;
import wasi:random/random@0.2.0;
import wasi:random/insecure@0.2.0;
import wasi:random/insecure-seed@0.2.0;

export run;
}
34 changes: 34 additions & 0 deletions sessionv2/combined-wit/deps/clocks.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package wasi:clocks@0.2.0;

interface monotonic-clock {
use wasi:io/poll@0.2.0.{pollable};

type instant = u64;

type duration = u64;

now: func() -> instant;

resolution: func() -> duration;

subscribe-instant: func(when: instant) -> pollable;

subscribe-duration: func(when: duration) -> pollable;
}

interface wall-clock {
record datetime {
seconds: u64,
nanoseconds: u32,
}

now: func() -> datetime;

resolution: func() -> datetime;
}

world imports {
import wasi:io/poll@0.2.0;
import monotonic-clock;
import wall-clock;
}
Loading
Loading