@mercuryworkshop/epoxy-transport 2.1.28 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,96 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ version-check:
14
+ name: Check Version
15
+ runs-on: ubuntu-latest
16
+ outputs:
17
+ version_changed: ${{ steps.check.outputs.version_changed }}
18
+ new_version: ${{ steps.check.outputs.new_version }}
19
+
20
+ steps:
21
+ - name: Checkout Code
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Check the version
25
+ id: check
26
+ run: |
27
+ CURRENT_VERSION=$(jq -r .version package.json)
28
+ echo "Current version: $CURRENT_VERSION"
29
+ LATEST_VERSION=$(npm view @mercuryworkshop/epoxy-transport versions --json | jq -r '.[-1]' || echo "0.0.0")
30
+ echo "Latest NPM version: $LATEST_VERSION"
31
+
32
+ if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ];
33
+ then
34
+ echo "Version changed"
35
+ echo "version_changed=true" >> "$GITHUB_OUTPUT"
36
+ echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
37
+ else
38
+ echo "Version not changed"
39
+ echo "version_changed=false" >> "$GITHUB_OUTPUT"
40
+ fi
41
+ build:
42
+ name: Build epoxy-transport
43
+ runs-on: ubuntu-latest
44
+
45
+ steps:
46
+ - name: Checkout code
47
+ uses: actions/checkout@v4
48
+
49
+ - name: Setup pnpm
50
+ uses: pnpm/action-setup@v4
51
+ with:
52
+ version: latest
53
+
54
+ - name: Setup Node.js
55
+ uses: actions/setup-node@v4
56
+ with:
57
+ node-version: "22"
58
+ cache: "pnpm"
59
+
60
+ - name: Install pnpm dependencies
61
+ run: pnpm install
62
+
63
+ - name: Pack
64
+ run: pnpm pack
65
+
66
+ - name: Upload Artifact (pnpm pack)
67
+ uses: actions/upload-artifact@v4
68
+ with:
69
+ name: packaged-epoxy-transport
70
+ path: mercuryworkshop-epoxy-transport-*.tgz
71
+
72
+ publish:
73
+ name: Publish to NPM
74
+ runs-on: ubuntu-latest
75
+ needs: [version-check, build]
76
+ permissions: write-all
77
+ if: github.ref == 'refs/heads/master' && needs.version-check.outputs.version_changed == 'true'
78
+
79
+ steps:
80
+ - name: Setup Node.js
81
+ uses: actions/setup-node@v4
82
+ with:
83
+ node-version: "22"
84
+ registry-url: "https://registry.npmjs.org"
85
+
86
+ - name: Get artifacts
87
+ uses: actions/download-artifact@v4
88
+ with:
89
+ name: packaged-epoxy-transport
90
+ path: .
91
+
92
+ - name: Update npm
93
+ run: npm install -g npm@latest
94
+
95
+ - name: Publish
96
+ run: npm publish mercuryworkshop-epoxy-transport-${{ needs.version-check.outputs.new_version }}.tgz --access public --no-git-checks
@@ -0,0 +1,31 @@
1
+ import type { RawHeaders, TransferrableResponse, ProxyTransport } from "@mercuryworkshop/proxy-transports";
2
+ import { EpoxyClient, EpoxyClientOptions, info as epoxyInfo } from "@mercuryworkshop/epoxy-tls";
3
+ export { epoxyInfo };
4
+ export type EpoxyOptions = {
5
+ wisp_v2?: boolean;
6
+ udp_extension_required?: boolean;
7
+ title_case_headers?: boolean;
8
+ ws_title_case_headers?: boolean;
9
+ wisp_ws_protocols?: string[];
10
+ redirect_limit?: number;
11
+ header_limit?: number;
12
+ buffer_size?: number;
13
+ };
14
+ export default class EpoxyTransport implements ProxyTransport {
15
+ ready: boolean;
16
+ client_version: typeof epoxyInfo;
17
+ client: EpoxyClient;
18
+ wisp: string;
19
+ opts: EpoxyOptions;
20
+ constructor(opts: EpoxyOptions & {
21
+ wisp: string;
22
+ });
23
+ setopt(opts: EpoxyClientOptions, opt: string): void;
24
+ init(): Promise<void>;
25
+ meta(): Promise<void>;
26
+ request(remote: URL, method: string, body: BodyInit | null, headers: RawHeaders, signal: AbortSignal | undefined): Promise<TransferrableResponse>;
27
+ connect(url: URL, protocols: string[], requestHeaders: RawHeaders, onopen: (protocol: string, extensions: string) => void, onmessage: (data: Blob | ArrayBuffer | string) => void, onclose: (code: number, reason: string) => void, onerror: (error: string) => void): [
28
+ (data: Blob | ArrayBuffer | string) => void,
29
+ (code: number, reason: string) => void
30
+ ];
31
+ }