phirepass-widgets 0.0.111 → 0.0.113
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.
- package/README.md +33 -0
- package/dist/cjs/{index-B8w6l0VL.js → index-CurErEK7.js} +101 -30
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/phirepass-downloader_3.cjs.entry.js +3696 -0
- package/dist/cjs/phirepass-rdp.cjs.entry.js +18 -6
- package/dist/cjs/phirepass-terminal.cjs.entry.js +6 -5
- package/dist/cjs/phirepass-widgets.cjs.js +3 -3
- package/dist/cjs/{protocol-CCD7cbHu.js → protocol-DCBMfc2u.js} +557 -360
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/common/channel.js +21 -1
- package/dist/collection/common/fetch.js +40 -0
- package/dist/collection/components/phirepass-downloader/form.js +69 -0
- package/dist/collection/components/phirepass-downloader/format.js +105 -0
- package/dist/collection/components/phirepass-downloader/jobs.js +370 -0
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.css +1109 -0
- package/dist/collection/components/phirepass-downloader/phirepass-downloader.js +1455 -0
- package/dist/collection/components/phirepass-downloader/source.js +106 -0
- package/dist/collection/components/phirepass-downloader/views/dialogs.js +34 -0
- package/dist/collection/components/phirepass-downloader/views/fetch-form.js +65 -0
- package/dist/collection/components/phirepass-downloader/views/icons.js +33 -0
- package/dist/collection/components/phirepass-downloader/views/job-row.js +91 -0
- package/dist/collection/components/phirepass-downloader/views/notices.js +15 -0
- package/dist/collection/components/phirepass-downloader/views/states.js +19 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +216 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +473 -0
- package/dist/collection/components/phirepass-media-player/player.js +94 -0
- package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +36 -13
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +122 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.fetch.js +35 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +181 -31
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/collection/testing/fixtures.js +219 -0
- package/dist/collection/testing/mock-channel.js +410 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-C4cmk3bS.js +1 -0
- package/dist/components/p-CsYQJXY2.js +1 -0
- package/dist/components/p-D6Geq8Rn.js +1 -0
- package/dist/components/phirepass-downloader.d.ts +11 -0
- package/dist/components/phirepass-downloader.js +1 -0
- package/dist/components/phirepass-media-player.d.ts +11 -0
- package/dist/components/phirepass-media-player.js +1 -0
- package/dist/components/phirepass-rdp.js +1 -1
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +2 -2
- package/dist/esm/{index-DGq2b7rM.js → index-B9qUl6FW.js} +101 -30
- package/dist/esm/loader.js +3 -3
- package/dist/esm/phirepass-downloader_3.entry.js +3692 -0
- package/dist/esm/phirepass-rdp.entry.js +18 -6
- package/dist/esm/phirepass-terminal.entry.js +6 -5
- package/dist/esm/phirepass-widgets.js +4 -4
- package/dist/esm/{protocol-D4JeTIHt.js → protocol-CsYQJXY2.js} +556 -359
- package/dist/phirepass-widgets/p-1b84c526.entry.js +1 -0
- package/dist/phirepass-widgets/{p-9eebbf05.entry.js → p-41dd1ac9.entry.js} +2 -2
- package/dist/phirepass-widgets/p-614ab3de.entry.js +1 -0
- package/dist/phirepass-widgets/p-B9qUl6FW.js +3 -0
- package/dist/phirepass-widgets/p-CsYQJXY2.js +1 -0
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/common/channel.d.ts +30 -0
- package/dist/types/common/fetch.d.ts +161 -0
- package/dist/types/components/phirepass-downloader/form.d.ts +54 -0
- package/dist/types/components/phirepass-downloader/format.d.ts +17 -0
- package/dist/types/components/phirepass-downloader/jobs.d.ts +115 -0
- package/dist/types/components/phirepass-downloader/phirepass-downloader.d.ts +231 -0
- package/dist/types/components/phirepass-downloader/source.d.ts +61 -0
- package/dist/types/components/phirepass-downloader/views/dialogs.d.ts +52 -0
- package/dist/types/components/phirepass-downloader/views/fetch-form.d.ts +31 -0
- package/dist/types/components/phirepass-downloader/views/icons.d.ts +5 -0
- package/dist/types/components/phirepass-downloader/views/job-row.d.ts +21 -0
- package/dist/types/components/phirepass-downloader/views/notices.d.ts +18 -0
- package/dist/types/components/phirepass-downloader/views/states.d.ts +38 -0
- package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +67 -0
- package/dist/types/components/phirepass-media-player/player.d.ts +43 -0
- package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +10 -0
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +30 -0
- package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.fetch.d.ts +40 -0
- package/dist/types/components.d.ts +426 -34
- package/dist/types/stencil-public-runtime.d.ts +1 -1
- package/dist/types/testing/fixtures.d.ts +25 -0
- package/dist/types/testing/mock-channel.d.ts +132 -0
- package/package.json +26 -12
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +0 -1469
- package/dist/components/p-D4JeTIHt.js +0 -1
- package/dist/esm/phirepass-sftp-client.entry.js +0 -1467
- package/dist/phirepass-widgets/p-401631af.entry.js +0 -1
- package/dist/phirepass-widgets/p-5f27300b.entry.js +0 -1
- package/dist/phirepass-widgets/p-D4JeTIHt.js +0 -1
- package/dist/phirepass-widgets/p-DGq2b7rM.js +0 -3
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Browsing, FetchCaps, FetchJob, FetchOptions, FetchSource, SubscribeScope } from '../common/fetch';
|
|
2
|
+
import type { SFTPListItem } from '../common/protocol';
|
|
3
|
+
/**
|
|
4
|
+
* A scriptable stand-in for `phirepass-channel`'s `Channel`, for stories and
|
|
5
|
+
* tests. Pass it through a widget's `channelFactory` and the real widget runs
|
|
6
|
+
* against it: it authenticates, opens its tunnel and handles the same frames.
|
|
7
|
+
*
|
|
8
|
+
* Every call is recorded in `calls`. `emit()` pushes any frame at the widget.
|
|
9
|
+
*/
|
|
10
|
+
export type Call = {
|
|
11
|
+
method: string;
|
|
12
|
+
args: unknown[];
|
|
13
|
+
};
|
|
14
|
+
type Cb<T = unknown> = (value: T) => void;
|
|
15
|
+
export type DownloadScript = {
|
|
16
|
+
caps?: FetchCaps;
|
|
17
|
+
jobs?: FetchJob[];
|
|
18
|
+
/** Answer to `DownloadWhere`. Default: mapped into the folder asked about. */
|
|
19
|
+
where?: (browsing: Browsing) => {
|
|
20
|
+
saves_to: string;
|
|
21
|
+
mapped: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** Sub-folders for the picker, keyed by sub-dir ('' for the root). */
|
|
24
|
+
folders?: Record<string, string[]>;
|
|
25
|
+
/**
|
|
26
|
+
* What happens after `DownloadStart`. Default: accepted, then the node reports
|
|
27
|
+
* the job Downloading. `'silent'`: accepted, and the node never reports
|
|
28
|
+
* (offline). `'refuse'`: the node answers Cancelled with `refuseReason`.
|
|
29
|
+
* `'error'`: the server answers an `Error` frame. `'hang'`: nothing at all.
|
|
30
|
+
*/
|
|
31
|
+
onStart?: 'progress' | 'queued' | 'silent' | 'refuse' | 'error' | 'hang';
|
|
32
|
+
refuseReason?: string;
|
|
33
|
+
/** The name the node uses for a started link (to show N4). */
|
|
34
|
+
savedAs?: string;
|
|
35
|
+
/** Advance Downloading rows every second, for a live drawer. */
|
|
36
|
+
live?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type MockOptions = {
|
|
39
|
+
/** Delay before each answer, in ms. */
|
|
40
|
+
latency?: number;
|
|
41
|
+
/** `fail`: the server rejects the token. `never`: no answer at all. */
|
|
42
|
+
auth?: 'ok' | 'fail' | 'never';
|
|
43
|
+
/** `refuse`: the connection errors and closes. `never`: it never opens. */
|
|
44
|
+
connect?: 'ok' | 'refuse' | 'never';
|
|
45
|
+
version?: string;
|
|
46
|
+
/** SFTP folders by path. */
|
|
47
|
+
sftp?: {
|
|
48
|
+
cwd: string;
|
|
49
|
+
tree: Record<string, SFTPListItem[]>;
|
|
50
|
+
requires?: 'username' | 'password' | 'both';
|
|
51
|
+
streams?: boolean;
|
|
52
|
+
};
|
|
53
|
+
/** Bytes to print when an SSH tunnel opens, and whether keystrokes echo back. */
|
|
54
|
+
ssh?: {
|
|
55
|
+
banner?: string;
|
|
56
|
+
echo?: boolean;
|
|
57
|
+
requires?: 'username' | 'password';
|
|
58
|
+
};
|
|
59
|
+
rdp?: {
|
|
60
|
+
ticket?: boolean;
|
|
61
|
+
error?: string;
|
|
62
|
+
};
|
|
63
|
+
/** Omit to build a channel that predates Remote Fetch. */
|
|
64
|
+
downloads?: DownloadScript;
|
|
65
|
+
};
|
|
66
|
+
export declare class MockChannel {
|
|
67
|
+
readonly endpoint: string;
|
|
68
|
+
readonly nodeId: string;
|
|
69
|
+
readonly options: MockOptions;
|
|
70
|
+
readonly calls: Call[];
|
|
71
|
+
readonly jobs: Map<string, FetchJob>;
|
|
72
|
+
private cb;
|
|
73
|
+
private connected;
|
|
74
|
+
private timers;
|
|
75
|
+
private ticker?;
|
|
76
|
+
constructor(endpoint: string, nodeId: string, options?: MockOptions);
|
|
77
|
+
/** A `channelFactory` that builds one of these and keeps the last one built in `ref.current`. */
|
|
78
|
+
static factory(options?: MockOptions, ref?: {
|
|
79
|
+
current?: MockChannel;
|
|
80
|
+
}): (endpoint: string, nodeId: string) => MockChannel;
|
|
81
|
+
private record;
|
|
82
|
+
callsTo(method: string): unknown[][];
|
|
83
|
+
private later;
|
|
84
|
+
/** Pushes a frame at the widget, as the server would. */
|
|
85
|
+
emit(web: Record<string, unknown> & {
|
|
86
|
+
type: string;
|
|
87
|
+
}): void;
|
|
88
|
+
/** Sends the node's latest word on a download to the widget. */
|
|
89
|
+
progress(job: FetchJob): void;
|
|
90
|
+
update(downloadId: string, patch: Partial<FetchJob>): void;
|
|
91
|
+
/** Drops the connection, as a network failure would. */
|
|
92
|
+
drop(): void;
|
|
93
|
+
connect(): void;
|
|
94
|
+
disconnect(): void;
|
|
95
|
+
is_connected(): boolean;
|
|
96
|
+
authenticate(token: string, nodeId: string): void;
|
|
97
|
+
start_heartbeat(ms: number): void;
|
|
98
|
+
stop_heartbeat(): void;
|
|
99
|
+
on_connection_open(cb: Cb<void>): void;
|
|
100
|
+
on_connection_close(cb: Cb<void>): void;
|
|
101
|
+
on_connection_error(cb: Cb<Error>): void;
|
|
102
|
+
on_connection_message(cb: Cb): void;
|
|
103
|
+
on_protocol_message(cb: Cb): void;
|
|
104
|
+
open_ssh_tunnel(nodeId: string, serviceId: string, username?: string, password?: string): void;
|
|
105
|
+
send_ssh_tunnel_data(nodeId: string, sid: number, data: string): void;
|
|
106
|
+
send_ssh_terminal_resize(...args: unknown[]): void;
|
|
107
|
+
open_rdp_tunnel(...args: unknown[]): void;
|
|
108
|
+
open_sftp_tunnel(nodeId: string, serviceId: string, username?: string, password?: string): void;
|
|
109
|
+
send_sftp_list_data(nodeId: string, sid: number, path: string, msgId?: number): void;
|
|
110
|
+
private opDone;
|
|
111
|
+
send_sftp_mkdir(_n: string, sid: number, path: string, msgId?: number): void;
|
|
112
|
+
send_sftp_rename(_n: string, sid: number, from: string, to: string, msgId?: number): void;
|
|
113
|
+
send_sftp_chmod(_n: string, sid: number, path: string, mode: number, msgId?: number): void;
|
|
114
|
+
send_sftp_remove(_n: string, sid: number, path: string, recursive: boolean, msgId?: number): void;
|
|
115
|
+
send_sftp_read_file(_n: string, sid: number, path: string, msgId?: number): void;
|
|
116
|
+
send_sftp_write_file(_n: string, sid: number, path: string, _contents: unknown, msgId?: number): void;
|
|
117
|
+
send_sftp_open_stream(_n: string, sid: number, path: string, msgId?: number): void;
|
|
118
|
+
send_sftp_download_start(...args: unknown[]): void;
|
|
119
|
+
send_sftp_download_ack(...args: unknown[]): void;
|
|
120
|
+
send_sftp_upload_start(...args: unknown[]): void;
|
|
121
|
+
send_sftp_upload_chunk(...args: unknown[]): void;
|
|
122
|
+
send_download_subscribe(scope: SubscribeScope): void;
|
|
123
|
+
private tick;
|
|
124
|
+
send_download_where(nodeId: string, browsing: Browsing, msgId?: number): void;
|
|
125
|
+
send_download_folders(nodeId: string, subDir: string | null, msgId?: number): void;
|
|
126
|
+
send_download_start(nodeId: string, source: FetchSource, subDir: string | null, browsing: Browsing | null, inOrder: boolean, options: FetchOptions, msgId?: number): void;
|
|
127
|
+
send_download_stop(downloadId: string, discard: boolean, msgId?: number): void;
|
|
128
|
+
send_download_resume(downloadId: string, ignoreWindow: boolean, msgId?: number): void;
|
|
129
|
+
send_download_set_order(downloadId: string, inOrder: boolean, msgId?: number): void;
|
|
130
|
+
send_download_delete(downloadId: string, deleteFile: boolean, msgId?: number): void;
|
|
131
|
+
}
|
|
132
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phirepass-widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.113",
|
|
4
4
|
"description": "Phirepass widgets for the web application",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"require": "./dist/phirepass-widgets/phirepass-widgets.cjs.js"
|
|
16
16
|
},
|
|
17
17
|
"./my-component": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"types": "./dist/components/my-component.d.ts",
|
|
19
|
+
"import": "./dist/components/my-component.js"
|
|
20
20
|
},
|
|
21
21
|
"./loader": {
|
|
22
|
+
"types": "./loader/index.d.ts",
|
|
22
23
|
"import": "./loader/index.js",
|
|
23
|
-
"require": "./loader/index.cjs"
|
|
24
|
-
"types": "./loader/index.d.ts"
|
|
24
|
+
"require": "./loader/index.cjs"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
@@ -37,15 +37,29 @@
|
|
|
37
37
|
"build": "stencil build",
|
|
38
38
|
"build:prod": "stencil build --prod",
|
|
39
39
|
"start": "stencil build --dev --watch --serve",
|
|
40
|
-
"test": "vitest run --config vitest.config.mts",
|
|
41
|
-
"test.watch": "vitest --config vitest.config.mts",
|
|
40
|
+
"test": "vitest run --config vitest.config.mts --project spec",
|
|
41
|
+
"test.watch": "vitest --config vitest.config.mts --project spec",
|
|
42
|
+
"test:storybook": "stencil build && vitest run --config vitest.config.mts --project storybook",
|
|
43
|
+
"test:all": "npm run test && npm run test:storybook",
|
|
44
|
+
"storybook": "stencil build && storybook dev -p 6006",
|
|
45
|
+
"build-storybook": "stencil build && storybook build",
|
|
42
46
|
"generate": "stencil generate"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
|
-
"@stencil/core": "^4.45.
|
|
46
|
-
"@stencil/vitest": "^1.
|
|
47
|
-
"@
|
|
48
|
-
"
|
|
49
|
+
"@stencil/core": "^4.45.3",
|
|
50
|
+
"@stencil/vitest": "^1.16.2",
|
|
51
|
+
"@storybook/addon-a11y": "^10.6.7",
|
|
52
|
+
"@storybook/addon-docs": "^10.6.7",
|
|
53
|
+
"@storybook/addon-vitest": "^10.6.7",
|
|
54
|
+
"@storybook/web-components-vite": "^10.6.7",
|
|
55
|
+
"@types/node": "^26.6.6",
|
|
56
|
+
"@vitest/browser": "^5.1.0",
|
|
57
|
+
"@vitest/browser-playwright": "^5.1.0",
|
|
58
|
+
"lit": "^3.3.3",
|
|
59
|
+
"playwright": "^1.65.1",
|
|
60
|
+
"storybook": "^10.6.7",
|
|
61
|
+
"vite": "^8.3.8",
|
|
62
|
+
"vitest": "^5.1.0"
|
|
49
63
|
},
|
|
50
64
|
"license": "AGPL-3.0-or-later",
|
|
51
65
|
"dependencies": {
|
|
@@ -58,6 +72,6 @@
|
|
|
58
72
|
"@xterm/addon-web-links": "^0.12.0",
|
|
59
73
|
"@xterm/addon-webgl": "^0.19.0",
|
|
60
74
|
"@xterm/xterm": "^6.0.0",
|
|
61
|
-
"phirepass-channel": "^0.1.
|
|
75
|
+
"phirepass-channel": "^0.1.356"
|
|
62
76
|
}
|
|
63
77
|
}
|