Compare commits

..

67 Commits

Author SHA1 Message Date
semantic-release-bot 0cf1c9f0ca chore(release): 0.1.0-develop.21 [skip ci]
# [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-11-17)
2023-11-17 13:33:58 +00:00
Derrick Hammer 0106d4e2aa
Merge remote-tracking branch 'origin/develop' into develop 2023-11-17 08:33:18 -05:00
Derrick Hammer 906997b147
dep: update libs5 2023-11-17 08:33:15 -05:00
semantic-release-bot 5732b1edc8 chore(release): 0.1.0-develop.20 [skip ci]
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-11-17)
2023-11-17 13:22:26 +00:00
Derrick Hammer 5a2382f650
Merge remote-tracking branch 'origin/develop' into develop 2023-11-17 08:21:45 -05:00
Derrick Hammer ca05b9c5e3
dep: update libs5 2023-11-17 08:21:37 -05:00
semantic-release-bot a51079ecd6 chore(release): 0.1.0-develop.19 [skip ci]
# [0.1.0-develop.19](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.18...v0.1.0-develop.19) (2023-09-04)
2023-09-04 09:26:37 +00:00
Derrick Hammer 126ea1548c
Merge remote-tracking branch 'origin/develop' into develop 2023-09-04 05:25:47 -04:00
Derrick Hammer 5c2ac5af21
dep: update libs5 2023-09-04 05:24:52 -04:00
semantic-release-bot e968e3c853 chore(release): 0.1.0-develop.18 [skip ci]
# [0.1.0-develop.18](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.17...v0.1.0-develop.18) (2023-09-02)

### Bug Fixes

* implement end ([d4d6e38](d4d6e38eb1))
2023-09-02 16:59:58 +00:00
Derrick Hammer d4d6e38eb1
fix: implement end 2023-09-02 12:58:42 -04:00
Derrick Hammer cdbd5bae9b
dep: update libs5 2023-09-02 12:54:20 -04:00
Derrick Hammer 06ec76869a
Merge remote-tracking branch 'origin/develop' into develop 2023-09-02 12:51:37 -04:00
Derrick Hammer d51dddc95e
dep: update libs5 2023-09-02 12:51:29 -04:00
semantic-release-bot 657533ea1b chore(release): 0.1.0-develop.17 [skip ci]
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-09-01)
2023-09-01 14:13:43 +00:00
Derrick Hammer ff4c3c37ec
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 10:13:01 -04:00
Derrick Hammer c1bae33e19
dep: update libs5 2023-09-01 10:12:57 -04:00
semantic-release-bot 257987c109 chore(release): 0.1.0-develop.16 [skip ci]
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-09-01)
2023-09-01 12:27:15 +00:00
Derrick Hammer e1a0710a50
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 08:26:28 -04:00
Derrick Hammer 1c55e73099
dep: update libs5 2023-09-01 08:26:24 -04:00
semantic-release-bot 757a2f0945 chore(release): 0.1.0-develop.15 [skip ci]
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-09-01)
2023-09-01 12:21:38 +00:00
Derrick Hammer 8f83c0cafe
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 08:20:55 -04:00
Derrick Hammer 387de836a6
dep: update libs5 2023-09-01 08:20:52 -04:00
semantic-release-bot 4ca1965b24 chore(release): 0.1.0-develop.14 [skip ci]
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-09-01)
2023-09-01 12:05:50 +00:00
Derrick Hammer 170492c74a
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 08:04:52 -04:00
Derrick Hammer 7a28ff60a6
dep: update libs5 2023-09-01 08:04:49 -04:00
semantic-release-bot 39f27f0ef0 chore(release): 0.1.0-develop.13 [skip ci]
# [0.1.0-develop.13](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.12...v0.1.0-develop.13) (2023-09-01)
2023-09-01 11:55:29 +00:00
Derrick Hammer 61b84ad3db
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 07:54:49 -04:00
Derrick Hammer b6db91bef7
dep: update libs5 2023-09-01 07:54:41 -04:00
semantic-release-bot 7faea91f75 chore(release): 0.1.0-develop.12 [skip ci]
# [0.1.0-develop.12](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.11...v0.1.0-develop.12) (2023-09-01)
2023-09-01 11:39:01 +00:00
Derrick Hammer 3d7230be78
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 07:38:13 -04:00
Derrick Hammer 3383482550
dep: update libs5 2023-09-01 07:38:09 -04:00
semantic-release-bot 87ff12d1a0 chore(release): 0.1.0-develop.11 [skip ci]
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-09-01)
2023-09-01 11:32:07 +00:00
Derrick Hammer e40eb3da39
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 07:31:23 -04:00
Derrick Hammer cff2c257b4
dep: update libs5 2023-09-01 07:31:19 -04:00
semantic-release-bot 15a05df7e6 chore(release): 0.1.0-develop.10 [skip ci]
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-09-01)
2023-09-01 10:45:51 +00:00
Derrick Hammer 6ce6469f5b
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 06:45:00 -04:00
Derrick Hammer a1a5cffd0e
dep: update libs5 2023-09-01 06:44:56 -04:00
semantic-release-bot 1593b0fcf8 chore(release): 0.1.0-develop.9 [skip ci]
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-09-01)
2023-09-01 10:22:32 +00:00
Derrick Hammer 915804939e
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 06:21:52 -04:00
Derrick Hammer 5988c9e744
dep: update libs5 2023-09-01 06:21:49 -04:00
semantic-release-bot 6e7241f1fc chore(release): 0.1.0-develop.8 [skip ci]
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-09-01)
2023-09-01 07:21:02 +00:00
Derrick Hammer 19229cc68a
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 03:20:15 -04:00
Derrick Hammer 995f3c10fc
dep: update libs5 2023-09-01 03:20:12 -04:00
semantic-release-bot b611ab32bc chore(release): 0.1.0-develop.7 [skip ci]
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-01)

### Bug Fixes

* use send not write ([940d768](940d768d5b))
2023-09-01 06:30:53 +00:00
Derrick Hammer cda84fd024
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 02:30:16 -04:00
Derrick Hammer 940d768d5b
fix: use send not write 2023-09-01 02:30:10 -04:00
semantic-release-bot 25b020c1c4 chore(release): 0.1.0-develop.6 [skip ci]
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-08-31)
2023-08-31 22:52:12 +00:00
Derrick Hammer 84f51ff57a
Merge remote-tracking branch 'origin/develop' into develop 2023-08-31 18:51:30 -04:00
Derrick Hammer 3c76119e65
dep: update libs5 2023-08-31 18:51:25 -04:00
semantic-release-bot a53c3784e4 chore(release): 0.1.0-develop.5 [skip ci]
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-08-31)

### Bug Fixes

* change approach to make socket optional ([d22c757](d22c757c52))
2023-08-31 22:47:30 +00:00
Derrick Hammer 13b2ebe0b5
dep: update libs5 2023-08-31 18:46:45 -04:00
Derrick Hammer 0c10129cd0
Merge remote-tracking branch 'origin/develop' into develop 2023-08-31 18:45:47 -04:00
Derrick Hammer 2c8d3a2716
dep: update libs5 2023-08-31 18:45:39 -04:00
Derrick Hammer d22c757c52
fix: change approach to make socket optional 2023-08-31 18:44:58 -04:00
semantic-release-bot 70db4069b1 chore(release): 0.1.0-develop.4 [skip ci]
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-08-31)

### Bug Fixes

* make socket optional since we define it ourselves ([89e7d45](89e7d452cb))
2023-08-31 22:39:50 +00:00
Derrick Hammer 3f0b1e39a4
Merge remote-tracking branch 'origin/develop' into develop 2023-08-31 18:38:57 -04:00
Derrick Hammer 89e7d452cb
fix: make socket optional since we define it ourselves 2023-08-31 18:38:53 -04:00
semantic-release-bot 6e6951c96f chore(release): 0.1.0-develop.3 [skip ci]
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-08-31)
2023-08-31 22:33:29 +00:00
Derrick Hammer 6625530f3d
dep: update libs5 2023-08-31 18:32:35 -04:00
semantic-release-bot 660afabef7 chore(release): 0.1.0-develop.2 [skip ci]
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-08-31)

### Bug Fixes

* set constructor typing ([331e5ad](331e5adbf7))
2023-08-31 22:31:31 +00:00
Derrick Hammer a74d7b48ec
Merge remote-tracking branch 'origin/develop' into develop 2023-08-31 18:30:45 -04:00
Derrick Hammer 331e5adbf7
fix: set constructor typing 2023-08-31 18:30:41 -04:00
semantic-release-bot fcf45d0c03 chore(release): 0.1.0-develop.1 [skip ci]
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.0.1...v0.1.0-develop.1) (2023-08-31)

### Features

* initial version ([53ddfc0](53ddfc03c9))
2023-08-31 22:27:22 +00:00
Derrick Hammer 77bd77ad47
ci: override moduleResolution 2023-08-31 18:25:05 -04:00
Derrick Hammer 9fef8dba10
ci: setup 2023-08-31 18:20:02 -04:00
Derrick Hammer 53ddfc03c9
feat: initial version 2023-08-31 18:13:57 -04:00
7 changed files with 19887 additions and 1 deletions

13
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Build/Publish
on:
push:
branches:
- master
- develop
- develop-*
jobs:
main:
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
secrets: inherit

12
.presetterrc.json Normal file
View File

@ -0,0 +1,12 @@
{
"preset": [
"@lumeweb/node-library-preset"
],
"config": {
"tsconfig": {
"compilerOptions": {
"moduleResolution": "node"
}
}
}
}

71
CHANGELOG.md Normal file
View File

@ -0,0 +1,71 @@
# [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-11-17)
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-11-17)
# [0.1.0-develop.19](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.18...v0.1.0-develop.19) (2023-09-04)
# [0.1.0-develop.18](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.17...v0.1.0-develop.18) (2023-09-02)
### Bug Fixes
* implement end ([d4d6e38](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/commit/d4d6e38eb1e4fd1fa00a974f279ea49ecb4703b3))
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-09-01)
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-09-01)
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-09-01)
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-09-01)
# [0.1.0-develop.13](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.12...v0.1.0-develop.13) (2023-09-01)
# [0.1.0-develop.12](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.11...v0.1.0-develop.12) (2023-09-01)
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-09-01)
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-09-01)
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-09-01)
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-09-01)
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-01)
### Bug Fixes
* use send not write ([940d768](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/commit/940d768d5babb65b0ca268fac20c193debf2d65d))
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-08-31)
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-08-31)
### Bug Fixes
* change approach to make socket optional ([d22c757](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/commit/d22c757c520e38f71ef0a303a3e116013555d01b))
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-08-31)
### Bug Fixes
* make socket optional since we define it ourselves ([89e7d45](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/commit/89e7d452cbbf55271a4bb928d0cd02b1e03fe6ab))
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-08-31)
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-08-31)
### Bug Fixes
* set constructor typing ([331e5ad](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/commit/331e5adbf7b91ca01d44b3647442ad056a50957e))
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/compare/v0.0.1...v0.1.0-develop.1) (2023-08-31)
### Features
* initial version ([53ddfc0](https://git.lumeweb.com/LumeWeb/libs5-transport-hyper/commit/53ddfc03c918aedbb57734bed84f7fcc93ef2520))

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023 LumeWeb
Copyright (c) 2023 Hammer Technologies LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

19667
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

30
package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "@lumeweb/libs5-transport-hyper",
"version": "0.1.0-develop.21",
"type": "module",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/libs5-transport-hyper.git"
},
"devDependencies": {
"@lumeweb/node-library-preset": "^0.2.7",
"presetter": "*"
},
"readme": "ERROR: No README data found!",
"scripts": {
"prepare": "presetter bootstrap",
"build": "run build",
"semantic-release": "semantic-release"
},
"publishConfig": {
"access": "public"
},
"files": [
"lib"
],
"dependencies": {
"@lumeweb/libs5": "^0.1.0-develop.61",
"streamx": "^2.15.1"
}
}

93
src/index.ts Normal file
View File

@ -0,0 +1,93 @@
import { BasePeer, Logger, PeerConstructorOptions } from "@lumeweb/libs5";
import { URL } from "url";
import { Buffer } from "buffer";
import { Readable } from "streamx";
type OmitSocket<T> = Omit<T, "socket">;
export default class HyperTransportPeer extends BasePeer {
private _peer: any;
private _muxer: any;
private _protocol: string;
protected _socket = new Readable();
private _pipe?: any;
constructor(
options: OmitSocket<PeerConstructorOptions> & {
peer: any;
muxer: any;
protocol: string;
},
) {
super({
...options,
socket: undefined,
});
const { peer, muxer, protocol } = options;
this._peer = peer;
this._muxer = muxer;
this._protocol = protocol;
}
public async init() {
const channel = await this._muxer.createChannel({
protocol: this._protocol,
});
const self = this;
this._pipe = await channel.addMessage({
async onmessage(m) {
if (m instanceof Uint8Array) {
m = Buffer.from(m);
}
self._socket.push(m);
},
});
await channel.open();
}
public static async connect(uri: URL): Promise<any> {
return Promise.reject("not supported");
}
listenForMessages(
callback: (event: any) => Promise<void>,
{
onDone,
onError,
logger,
}: {
onDone?: any;
onError?: (...args: any[]) => void;
logger: Logger;
},
): void {
this._socket.on("data", async (data: Buffer) => {
await callback(data);
});
if (onDone) {
this._socket.on("end", onDone);
}
if (onError) {
this._socket.on("error", onError);
}
}
renderLocationUri(): string {
return "Hypercore client";
}
sendMessage(message: Uint8Array): void {
this._pipe.send(message);
}
end(): void {
this._pipe.end();
this._socket.end();
}
}