Compare commits
17 Commits
v0.2.0-dev
...
v0.2.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 7319f5a048 | |
Derrick Hammer | 97489a577f | |
Derrick Hammer | 589821c570 | |
Derrick Hammer | a0c131ffb7 | |
Derrick Hammer | 5b82a9c561 | |
Derrick Hammer | 45fbc1b63d | |
Derrick Hammer | 06a8093786 | |
Derrick Hammer | b8ab5faced | |
Derrick Hammer | dd43e29b29 | |
Derrick Hammer | 051f4b2da7 | |
Derrick Hammer | 50a7c80358 | |
Derrick Hammer | 68283d14e5 | |
Derrick Hammer | 23a55f772b | |
Derrick Hammer | 53dd352c95 | |
Derrick Hammer | 2aa53faf00 | |
Derrick Hammer | 68fec66069 | |
Derrick Hammer | 0c320f992b |
|
@ -1,70 +0,0 @@
|
|||
version: 2.1
|
||||
|
||||
orbs:
|
||||
node: circleci/node@5.1.0
|
||||
ssh: credijusto/ssh@0.5.2
|
||||
workflows:
|
||||
release:
|
||||
jobs:
|
||||
- node/run:
|
||||
name: build
|
||||
npm-run: build
|
||||
pre-steps:
|
||||
- run:
|
||||
name: Setup Golang
|
||||
command: >
|
||||
sudo apt-get update;
|
||||
sudo apt-get install bison;
|
||||
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer);
|
||||
source ~/.gvm/scripts/gvm;
|
||||
gvm install go1.4 -B;
|
||||
gvm use go1.4 --default;
|
||||
gvm install go1.19 -B;
|
||||
VERSION=0.28.1;
|
||||
TINYGO="tinygo_${VERSION}_amd64.deb";
|
||||
wget https://github.com/tinygo-org/tinygo/releases/download/v$VERSION/$TINYGO;
|
||||
sudo dpkg -i $TINYGO && rm $TINYGO;
|
||||
setup:
|
||||
- run:
|
||||
name: Fetch Wasm Deps
|
||||
command: >
|
||||
source ~/.gvm/scripts/gvm;
|
||||
gvm use go1.19 --default;
|
||||
cd src/golang;
|
||||
go get;
|
||||
|
||||
|
||||
post-steps:
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- lib/
|
||||
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
- /^develop-.*$/
|
||||
- node/run:
|
||||
name: release
|
||||
npm-run: semantic-release
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
- /^develop-.*$/
|
||||
|
||||
context:
|
||||
- publish
|
||||
setup:
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- add_ssh_keys:
|
||||
fingerprints:
|
||||
- "47:cf:a1:17:d9:81:8e:c5:51:e5:53:c8:33:e4:33:b9"
|
||||
- ssh/ssh-add-host:
|
||||
host_url: GITEA_HOST
|
|
@ -0,0 +1,54 @@
|
|||
name: Build/Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- develop-*
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: 'npm'
|
||||
- name: Setup Golang
|
||||
run: |
|
||||
sudo apt-get update;
|
||||
sudo apt-get install bison;
|
||||
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer);
|
||||
source ~/.gvm/scripts/gvm;
|
||||
gvm install go1.4 -B;
|
||||
gvm use go1.4 --default;
|
||||
gvm install go1.19 -B;
|
||||
VERSION=0.28.1;
|
||||
TINYGO="tinygo_${VERSION}_amd64.deb";
|
||||
wget https://github.com/tinygo-org/tinygo/releases/download/v$VERSION/$TINYGO;
|
||||
sudo dpkg -i $TINYGO && rm $TINYGO;
|
||||
- name: Fetch Wasm Deps
|
||||
run: |
|
||||
source ~/.gvm/scripts/gvm;
|
||||
gvm use go1.19 --default;
|
||||
cd src/golang;
|
||||
go get;
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- name: Install SSH key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.GITEA_SSH_KEY }}
|
||||
known_hosts: ${{ secrets.GITEA_KNOWN_HOST }}
|
||||
|
||||
- name: Publish
|
||||
run: npm run semantic-release
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- name: Setup tmate session
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled && failure() }}
|
||||
with:
|
||||
limit-access-to-actor: true
|
|
@ -1,22 +1,6 @@
|
|||
{
|
||||
"preset": [
|
||||
"presetter-preset-essentials",
|
||||
"presetter-preset-hybrid"
|
||||
],
|
||||
"config": {
|
||||
"tsconfig": {
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"ES2020",
|
||||
"dom"
|
||||
"presetter-preset-hybrid",
|
||||
"@lumeweb/node-library-preset"
|
||||
]
|
||||
}
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": false
|
||||
}
|
||||
},
|
||||
"variable": {
|
||||
"source": "src"
|
||||
}
|
||||
}
|
||||
|
|
32
.releaserc
32
.releaserc
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
[
|
||||
"@semantic-release/changelog",
|
||||
{
|
||||
"changelogFile": "docs/CHANGELOG.md"
|
||||
}
|
||||
],
|
||||
"@semantic-release/npm",
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"package.json",
|
||||
"docs/CHANGELOG.md",
|
||||
"npm-shrinkwrap.json"
|
||||
]
|
||||
}
|
||||
],
|
||||
"branches": [
|
||||
"master",
|
||||
{
|
||||
name: "develop",
|
||||
prerelease: true
|
||||
},
|
||||
{
|
||||
name: "develop-*",
|
||||
prerelease: true
|
||||
},
|
||||
]
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
# [0.2.0-develop.10](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.9...v0.2.0-develop.10) (2023-06-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing controller.enqueue ([2aa53fa](https://git.lumeweb.com/LumeWeb/libportal/commit/2aa53faf00cc7024a24dc97fffaeb855faa4e650))
|
||||
* add properties and methods to go wasm middleware, accessed via reflection ([53dd352](https://git.lumeweb.com/LumeWeb/libportal/commit/53dd352c95fec8ec266a53c03f19cecbecf8821b))
|
||||
* ensure root and proof are Uint8Array's ([0c320f9](https://git.lumeweb.com/LumeWeb/libportal/commit/0c320f992bdf269614716b51818ed7063086c01c))
|
||||
* exit not properly exported in wasm ([23a55f7](https://git.lumeweb.com/LumeWeb/libportal/commit/23a55f772b7dde7712742ee5f47a5fda5bb8afd2))
|
||||
* fix wasmDone logic error ([68fec66](https://git.lumeweb.com/LumeWeb/libportal/commit/68fec66069721a6dc94027419ddd2cafbc877cbc))
|
||||
* need to refactor verification stream logic further and check if the stream is done but wasm isn't ([051f4b2](https://git.lumeweb.com/LumeWeb/libportal/commit/051f4b2da75ab2287c99a3514af5d0d4f28017bf))
|
||||
* rename exit to kill to fix symbol conflict ([50a7c80](https://git.lumeweb.com/LumeWeb/libportal/commit/50a7c803584b57e4e294aca117fc1e8b9a2a09c7))
|
||||
* update uploadFile overload types ([45fbc1b](https://git.lumeweb.com/LumeWeb/libportal/commit/45fbc1b63d2c19e186d6f21b022fee62be61866a))
|
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/libportal",
|
||||
"version": "0.2.0-develop.9",
|
||||
"version": "0.2.0-develop.10",
|
||||
"main": "lib/index.js",
|
||||
"module": "lib/index.mjs",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -21,19 +21,20 @@
|
|||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/npm": "^10.0.4",
|
||||
"@semantic-release/release-notes-generator": "^11.0.3",
|
||||
"presetter": "^3.5.5",
|
||||
"presetter-preset-essentials": "^3.5.5",
|
||||
"presetter-preset-hybrid": "^3.5.5",
|
||||
"presetter": "^4.0.1",
|
||||
"presetter-preset-hybrid": "4.0.1",
|
||||
"presetter-preset-strict": "^4.0.1",
|
||||
"semantic-release": "^21.0.5"
|
||||
},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"scripts": {
|
||||
"prepare": "presetter bootstrap",
|
||||
"build": "presetter run build",
|
||||
"build": "run build",
|
||||
"build:wasm": "bash -c \"source ~/.gvm/scripts/gvm; mkdir ./lib/wasm && cd src/golang; tinygo build -o ../../lib/wasm/bao.wasm -target wasm ./main.go\"",
|
||||
"semantic-release": "semantic-release"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lumeweb/node-library-preset": "git+https://git.lumeweb.com/LumeWeb/node-library-preset.git",
|
||||
"@noble/curves": "^1.1.0",
|
||||
"@noble/hashes": "^1.3.1",
|
||||
"detect-node": "^2.1.0",
|
||||
|
|
|
@ -282,18 +282,18 @@ export class Client {
|
|||
);
|
||||
}
|
||||
|
||||
async uploadFile(stream: Blob, size?: bigint);
|
||||
async uploadFile(stream: Blob, size?: bigint): Promise<string>;
|
||||
async uploadFile(
|
||||
stream: ReadableStream,
|
||||
hashStream: ReadableStream,
|
||||
size: bigint,
|
||||
);
|
||||
): Promise<string>;
|
||||
async uploadFile(stream: Uint8Array, size?: bigint);
|
||||
async uploadFile(
|
||||
stream: NodeJS.ReadableStream,
|
||||
hashStream: NodeJS.ReadableStream,
|
||||
size?: bigint,
|
||||
);
|
||||
): Promise<string>;
|
||||
async uploadFile(
|
||||
stream: any,
|
||||
hashStream?: any,
|
||||
|
|
|
@ -82,6 +82,7 @@ export default class Go {
|
|||
private exited = false;
|
||||
private _resolveCallbackPromise?: () => void;
|
||||
importObject: ImportObject;
|
||||
private _pendingEvent?: any;
|
||||
|
||||
constructor() {
|
||||
this._callbackTimeouts = new Map();
|
||||
|
@ -437,6 +438,16 @@ export default class Go {
|
|||
}
|
||||
this._inst.exports.resume();
|
||||
}
|
||||
_makeFuncWrapper(id) {
|
||||
const go = this;
|
||||
return function () {
|
||||
const event = { id: id, this: this, args: arguments };
|
||||
go._pendingEvent = event;
|
||||
go._resume();
|
||||
// @ts-ignore
|
||||
return event.result;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
|
@ -13,14 +13,14 @@ var activeReader *reader
|
|||
var pipe chan []byte
|
||||
var callbackId int
|
||||
var nextBytes chan int
|
||||
var exitChan chan bool
|
||||
var killChan chan bool
|
||||
|
||||
func main() {
|
||||
pipe = make(chan []byte)
|
||||
nextBytes = make(chan int)
|
||||
exitChan = make(chan bool)
|
||||
killChan = make(chan bool)
|
||||
callbackId = rand.Int()
|
||||
<-exitChan
|
||||
<-killChan
|
||||
}
|
||||
|
||||
type reader struct {
|
||||
|
@ -89,9 +89,9 @@ func start() int {
|
|||
return callbackId
|
||||
}
|
||||
|
||||
// exit write
|
||||
func exit() {
|
||||
exitChan <- true
|
||||
//export kill
|
||||
func kill() {
|
||||
killChan <- true
|
||||
}
|
||||
|
||||
func createWritePromiseHandler() js.Value {
|
||||
|
|
|
@ -12,6 +12,13 @@ export async function getVerifiableStream(
|
|||
const reader = new VariableChunkStream(data);
|
||||
let bytesToRead;
|
||||
|
||||
if (root instanceof ArrayBuffer) {
|
||||
root = new Uint8Array(root);
|
||||
}
|
||||
if (proof instanceof ArrayBuffer) {
|
||||
proof = new Uint8Array(proof);
|
||||
}
|
||||
|
||||
const getNextBytes = async () => {
|
||||
bytesToRead = getWasmProperty(wasmId, "write_promise");
|
||||
bytesToRead = await bytesToRead;
|
||||
|
@ -24,7 +31,7 @@ export async function getVerifiableStream(
|
|||
|
||||
// @ts-ignore
|
||||
const exit = () => {
|
||||
callExports("exit");
|
||||
callExports("kill");
|
||||
cleanup();
|
||||
};
|
||||
|
||||
|
@ -67,22 +74,32 @@ export async function getVerifiableStream(
|
|||
|
||||
const result = getWasmProperty(wasmId, "result");
|
||||
|
||||
const wasmDone = result === undefined;
|
||||
const wasmDone = result !== undefined;
|
||||
|
||||
if (result === undefined) {
|
||||
if (!wasmDone) {
|
||||
await getNextBytes();
|
||||
}
|
||||
|
||||
if (chunk.done || wasmDone) {
|
||||
if (wasmDone) {
|
||||
if (result) {
|
||||
controller.enqueue(chunk.value);
|
||||
done(controller);
|
||||
} else {
|
||||
controller.error(getWasmProperty(wasmId, "error"));
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (!wasmDone) {
|
||||
controller.error("stream is ended but verification not complete");
|
||||
exit();
|
||||
return;
|
||||
}
|
||||
controller.enqueue(chunk.value);
|
||||
done(controller);
|
||||
}
|
||||
} else {
|
||||
controller.enqueue(chunk.value);
|
||||
}
|
||||
},
|
||||
async cancel(reason: any) {
|
||||
|
|
Loading…
Reference in New Issue