Compare commits
19 Commits
v0.2.0-dev
...
v0.2.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 2fad185062 | |
Derrick Hammer | 0625b1acbb | |
Derrick Hammer | cfdd7748d7 | |
Derrick Hammer | 5760b20fe7 | |
Derrick Hammer | f6bfaf4509 | |
Derrick Hammer | 693d703a4c | |
Derrick Hammer | 0037179fd1 | |
Derrick Hammer | ea68d0ec0d | |
Derrick Hammer | 9378f87336 | |
Derrick Hammer | d24f5c89d5 | |
Derrick Hammer | cbdc097bda | |
Derrick Hammer | 0d4d6c4007 | |
Derrick Hammer | 587f8696b2 | |
Derrick Hammer | d59b39c8ed | |
Derrick Hammer | 49082c4014 | |
Derrick Hammer | 37b3389aa5 | |
Derrick Hammer | f79a722e77 | |
Derrick Hammer | d85b90cfa0 | |
Derrick Hammer | ae35797a25 |
|
@ -6,6 +6,11 @@ on:
|
||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
- develop-*
|
- develop-*
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
debug_enabled:
|
||||||
|
description: debug_enabled
|
||||||
|
type: boolean
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -16,24 +21,18 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 18.x
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
- name: Setup Golang
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: 1.19
|
||||||
- name: Setup Golang
|
- name: Setup Golang
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update;
|
|
||||||
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;
|
VERSION=0.28.1;
|
||||||
TINYGO="tinygo_${VERSION}_amd64.deb";
|
TINYGO="tinygo_${VERSION}_amd64.deb";
|
||||||
wget -q https://github.com/tinygo-org/tinygo/releases/download/v$VERSION/$TINYGO;
|
wget -q https://github.com/tinygo-org/tinygo/releases/download/v$VERSION/$TINYGO;
|
||||||
sudo dpkg -i $TINYGO && rm $TINYGO;
|
sudo dpkg -i $TINYGO && rm $TINYGO;
|
||||||
- name: Fetch Wasm Deps
|
- name: Fetch Wasm Deps
|
||||||
run: |
|
run: cd src/golang && go get
|
||||||
source ~/.gvm/scripts/gvm;
|
|
||||||
gvm use go1.19 --default;
|
|
||||||
cd src/golang;
|
|
||||||
go get;
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build --if-present
|
- run: npm run build --if-present
|
||||||
- name: Install SSH key
|
- name: Install SSH key
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
# [0.2.0-develop.17](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.16...v0.2.0-develop.17) (2023-08-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* refactor how we process a nodejs stream, as the current approach is extremely slow and wasteful. We need to do a bit of macgyvering and convert it via pipe to a passthrough so it passes a typeof check for Stream, then import it to form-data Response, and request a blob ([ae35797](https://git.lumeweb.com/LumeWeb/libportal/commit/ae35797a2525d23ac9a552d076a9904e68a7a142))
|
||||||
|
|
||||||
# [0.2.0-develop.16](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.15...v0.2.0-develop.16) (2023-07-18)
|
# [0.2.0-develop.16](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.15...v0.2.0-develop.16) (2023-07-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.16",
|
"version": "0.2.0-develop.17",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.16",
|
"version": "0.2.0-develop.17",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/node-library-preset": "git+https://git.lumeweb.com/LumeWeb/node-library-preset.git",
|
"@lumeweb/node-library-preset": "git+https://git.lumeweb.com/LumeWeb/node-library-preset.git",
|
||||||
"@noble/curves": "^1.1.0",
|
"@noble/curves": "^1.1.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.16",
|
"version": "0.2.0-develop.17",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "lib/index.mjs",
|
"module": "lib/index.mjs",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|
|
@ -29,6 +29,7 @@ import isNode from "detect-node";
|
||||||
import { utf8ToBytes } from "@noble/curves/abstract/utils";
|
import { utf8ToBytes } from "@noble/curves/abstract/utils";
|
||||||
|
|
||||||
type NodeReadableStreamType = typeof import("stream").Readable;
|
type NodeReadableStreamType = typeof import("stream").Readable;
|
||||||
|
type NodePassThroughStreamType = typeof import("stream").PassThrough;
|
||||||
|
|
||||||
export interface ClientOptions {
|
export interface ClientOptions {
|
||||||
portalUrl: string;
|
portalUrl: string;
|
||||||
|
@ -340,13 +341,14 @@ export class Client {
|
||||||
let NodeReadableStream =
|
let NodeReadableStream =
|
||||||
(await this.getNodeReadableObject()) as NodeReadableStreamType;
|
(await this.getNodeReadableObject()) as NodeReadableStreamType;
|
||||||
|
|
||||||
if (NodeReadableStream && stream instanceof NodeReadableStream) {
|
let NodePassThroughStream =
|
||||||
let data = new Uint8Array();
|
(await this.getNodePassThroughObject()) as NodePassThroughStreamType;
|
||||||
for await (const chunk of stream) {
|
|
||||||
data = Uint8Array.from([...data, ...chunk]);
|
|
||||||
}
|
|
||||||
|
|
||||||
stream = data;
|
if (NodeReadableStream && stream instanceof NodeReadableStream) {
|
||||||
|
const Response = await this.getFetchResponseObject();
|
||||||
|
stream = await new Response(
|
||||||
|
stream.pipe(new NodePassThroughStream()) as any,
|
||||||
|
).blob();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream instanceof Uint8Array) {
|
if (stream instanceof Uint8Array) {
|
||||||
|
@ -541,6 +543,7 @@ export class Client {
|
||||||
|
|
||||||
return FormData;
|
return FormData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getBlobObject() {
|
private async getBlobObject() {
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
return (await import("node-fetch")).Blob;
|
return (await import("node-fetch")).Blob;
|
||||||
|
@ -556,6 +559,15 @@ export class Client {
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getNodePassThroughObject() {
|
||||||
|
if (isNode) {
|
||||||
|
return (await import("stream")).PassThrough;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
private async getFetchObject() {
|
private async getFetchObject() {
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
return (await import("node-fetch")).default;
|
return (await import("node-fetch")).default;
|
||||||
|
@ -563,6 +575,7 @@ export class Client {
|
||||||
|
|
||||||
return fetch;
|
return fetch;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getFetchResponseObject() {
|
private async getFetchResponseObject() {
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
return (await import("node-fetch")).Response;
|
return (await import("node-fetch")).Response;
|
||||||
|
|
Loading…
Reference in New Issue