@omujs/omu 0.9.31 → 0.9.33
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/CHANGELOG.md +19 -0
- package/dist/dts/api/asset/extension.d.ts +3 -3
- package/dist/dts/api/asset/index.d.ts +1 -1
- package/dist/dts/api/dashboard/extension.d.ts +17 -4
- package/dist/dts/api/dashboard/handler.d.ts +2 -1
- package/dist/dts/api/dashboard/index.d.ts +1 -1
- package/dist/dts/api/http/extension.d.ts +2 -135
- package/dist/dts/api/http/http.d.ts +36 -0
- package/dist/dts/api/http/websocket.d.ts +123 -0
- package/dist/dts/api/permission/extension.d.ts +1 -0
- package/dist/dts/api/registry/registry.d.ts +13 -0
- package/dist/dts/api/server/extension.d.ts +9 -1
- package/dist/dts/index.d.ts +1 -3
- package/dist/dts/version.d.ts +1 -1
- package/dist/esm/api/asset/extension.js +43 -18
- package/dist/esm/api/asset/index.js +42 -17
- package/dist/esm/api/dashboard/extension.js +23 -13
- package/dist/esm/api/dashboard/index.js +23 -13
- package/dist/esm/api/endpoint/extension.js +3 -3
- package/dist/esm/api/extension.js +3 -3
- package/dist/esm/api/http/extension.js +262 -277
- package/dist/esm/api/http/http.js +442 -0
- package/dist/esm/api/http/index.js +262 -165
- package/dist/esm/api/http/websocket.js +220 -0
- package/dist/esm/api/i18n/extension.js +47 -3
- package/dist/esm/api/i18n/index.js +47 -3
- package/dist/esm/api/index.js +3 -3
- package/dist/esm/api/logger/extension.js +3 -3
- package/dist/esm/api/logger/index.js +3 -3
- package/dist/esm/api/permission/extension.js +6 -3
- package/dist/esm/api/plugin/extension.js +3 -3
- package/dist/esm/api/plugin/index.js +3 -3
- package/dist/esm/api/registry/extension.js +47 -3
- package/dist/esm/api/registry/index.js +47 -3
- package/dist/esm/api/registry/registry.js +1 -1
- package/dist/esm/api/server/extension.js +51 -5
- package/dist/esm/api/server/index.js +51 -5
- package/dist/esm/api/session/extension.js +47 -3
- package/dist/esm/api/session/index.js +47 -3
- package/dist/esm/api/signal/extension.js +3 -3
- package/dist/esm/api/table/extension.js +3 -3
- package/dist/esm/api/table/index.js +3 -3
- package/dist/esm/index.js +369 -189
- package/dist/esm/network/index.js +3 -3
- package/dist/esm/network/network.js +3 -3
- package/dist/esm/omu.js +368 -186
- package/dist/esm/version.js +3 -3
- package/package.json +1 -1
- package/src/api/asset/extension.ts +46 -12
- package/src/api/asset/index.ts +1 -2
- package/src/api/dashboard/extension.ts +40 -14
- package/src/api/dashboard/handler.ts +2 -1
- package/src/api/dashboard/index.ts +2 -0
- package/src/api/extension.ts +1 -1
- package/src/api/http/extension.ts +13 -364
- package/src/api/http/http.ts +79 -0
- package/src/api/http/websocket.ts +283 -0
- package/src/api/permission/extension.ts +4 -0
- package/src/api/registry/extension.ts +46 -1
- package/src/api/registry/registry.ts +23 -0
- package/src/api/server/extension.ts +10 -0
- package/src/index.ts +3 -5
- package/src/version.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.9.33 (2025-11-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* API呼び出しにUser-Agentを設定するようにする ([2c79480](https://github.com/OMUAPPS/omuapps/commit/2c794802097225deb61536f2175bc3025ee6efc1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 0.9.32 (2025-11-17)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @omujs/omu
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## 0.9.31 (2025-11-15)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @omujs/omu
|
|
@@ -6,18 +6,18 @@ export type Asset = {
|
|
|
6
6
|
identifier: Identifier;
|
|
7
7
|
buffer: Uint8Array;
|
|
8
8
|
};
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const ASSET_DOWNLOAD_PERMISSION_ID: Identifier;
|
|
11
|
-
export declare const ASSET_DELETE_PERMISSION_ID: Identifier;
|
|
9
|
+
export declare const ASSET_PERMISSION_ID: Identifier;
|
|
12
10
|
export declare class AssetExtension {
|
|
13
11
|
private readonly omu;
|
|
14
12
|
readonly type: ExtensionType<AssetExtension>;
|
|
13
|
+
private assetToken;
|
|
15
14
|
constructor(omu: Omu);
|
|
16
15
|
upload(identifier: IntoId, buffer: Uint8Array): Promise<Identifier>;
|
|
17
16
|
uploadMany(...files: Asset[]): Promise<Identifier[]>;
|
|
18
17
|
download(identifier: IntoId): Promise<Asset>;
|
|
19
18
|
downloadMany(...identifiers: IntoId[]): Promise<Asset[]>;
|
|
20
19
|
delete(identifier: IntoId): Promise<void>;
|
|
20
|
+
private requestGenerateAssetToken;
|
|
21
21
|
url(id: IntoId, options?: {
|
|
22
22
|
cache?: "no-cache";
|
|
23
23
|
}): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ASSET_PERMISSION_ID } from "./extension";
|
|
2
2
|
export type { Asset } from "./extension";
|
|
@@ -5,6 +5,7 @@ import { ExtensionType } from "../extension.js";
|
|
|
5
5
|
import { PermissionTypeJson } from "../permission/permission.js";
|
|
6
6
|
import { PackageInfo } from "../plugin/package-info.js";
|
|
7
7
|
import { Registry } from "../registry/registry.js";
|
|
8
|
+
import { AppIndexRegistryMeta } from "../server/extension.js";
|
|
8
9
|
import type { Table } from "../table/table.js";
|
|
9
10
|
import type { DashboardHandler } from "./handler.js";
|
|
10
11
|
import { AppInstallResponse, DragDrop, DragDropReadResponse, DragEnter, DragLeave, DragOver, FileDragPacket } from "./packets.js";
|
|
@@ -102,8 +103,8 @@ export type WebviewEventEmit = <T extends WebviewEvent["type"]>(event: Extract<W
|
|
|
102
103
|
type: T;
|
|
103
104
|
}>) => void;
|
|
104
105
|
type AllowedHost = {
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
id: string;
|
|
107
|
+
hosts: string[];
|
|
107
108
|
};
|
|
108
109
|
export declare const DASHBOARD_SPEECH_RECOGNITION_PERMISSION_ID: Identifier;
|
|
109
110
|
export type TranscriptSegment = {
|
|
@@ -149,12 +150,23 @@ export interface PromptRequestAppInstall extends PromptRequestBase<"app/install"
|
|
|
149
150
|
export interface PromptRequestAppUpdate extends PromptRequestBase<"app/update"> {
|
|
150
151
|
old_app: AppJson;
|
|
151
152
|
new_app: AppJson;
|
|
153
|
+
dependencies: Record<string, AppJson>;
|
|
152
154
|
}
|
|
153
155
|
export interface PromptRequestIndexInstall extends PromptRequestBase<"index/install"> {
|
|
154
156
|
index_url: string;
|
|
157
|
+
meta?: AppIndexRegistryMeta;
|
|
158
|
+
}
|
|
159
|
+
export interface PortProcess {
|
|
160
|
+
port: number;
|
|
161
|
+
name: string;
|
|
162
|
+
exe: string;
|
|
163
|
+
}
|
|
164
|
+
export interface PromptRequestHttpPort extends PromptRequestBase<"http/port"> {
|
|
165
|
+
app: AppJson;
|
|
166
|
+
processes: PortProcess[];
|
|
155
167
|
}
|
|
156
|
-
export type PromptRequest = (PromptRequestAppPermissions | PromptRequestAppPlugins | PromptRequestAppInstall | PromptRequestAppUpdate | PromptRequestIndexInstall);
|
|
157
|
-
export type PromptResult = "accept" | "deny";
|
|
168
|
+
export type PromptRequest = (PromptRequestAppPermissions | PromptRequestAppPlugins | PromptRequestAppInstall | PromptRequestAppUpdate | PromptRequestIndexInstall | PromptRequestHttpPort);
|
|
169
|
+
export type PromptResult = "accept" | "deny" | "block";
|
|
158
170
|
export declare class DashboardExtension {
|
|
159
171
|
private readonly omu;
|
|
160
172
|
readonly type: ExtensionType<DashboardExtension>;
|
|
@@ -179,6 +191,7 @@ export declare class DashboardExtension {
|
|
|
179
191
|
getCookies(options: GetCookiesRequest): Promise<UserResult<Cookie[]>>;
|
|
180
192
|
openApp(app: App): Promise<void>;
|
|
181
193
|
installApp(app: App): Promise<AppInstallResponse>;
|
|
194
|
+
clearBlockedPrompts(): Promise<null>;
|
|
182
195
|
requireDragDrop(): Promise<DragDropHandler>;
|
|
183
196
|
notifyDropDragState(packet: FileDragPacket): Promise<void>;
|
|
184
197
|
speechRecognitionStart(): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { App } from "../../app.js";
|
|
2
2
|
import { Identifier } from "../../identifier";
|
|
3
3
|
import { InvokedParams } from "../endpoint/packets.js";
|
|
4
|
-
import { Cookie, GetCookiesRequest, HostRequest, PromptRequestAppInstall, PromptRequestAppPermissions, PromptRequestAppPlugins, PromptRequestAppUpdate, PromptRequestIndexInstall, PromptResult, SpeechRecognitionStart, UserResponse, WebviewEvent, WebviewPacket, WebviewRequest } from "./extension.js";
|
|
4
|
+
import { Cookie, GetCookiesRequest, HostRequest, PromptRequestAppInstall, PromptRequestAppPermissions, PromptRequestAppPlugins, PromptRequestAppUpdate, PromptRequestHttpPort, PromptRequestIndexInstall, PromptResult, SpeechRecognitionStart, UserResponse, WebviewEvent, WebviewPacket, WebviewRequest } from "./extension.js";
|
|
5
5
|
import type { DragDropReadRequestDashboard, DragDropReadResponse, DragDropRequestDashboard } from "./packets.js";
|
|
6
6
|
export interface DashboardHandler {
|
|
7
7
|
handlePermissionRequest(request: PromptRequestAppPermissions): Promise<PromptResult>;
|
|
@@ -9,6 +9,7 @@ export interface DashboardHandler {
|
|
|
9
9
|
handleInstallApp(request: PromptRequestAppInstall): Promise<PromptResult>;
|
|
10
10
|
handleUpdateApp(request: PromptRequestAppUpdate): Promise<PromptResult>;
|
|
11
11
|
handleIndexInstall(request: PromptRequestIndexInstall): Promise<PromptResult>;
|
|
12
|
+
handleHttpPortRequest(request: PromptRequestHttpPort): Promise<PromptResult>;
|
|
12
13
|
handleOpenApp(app: App): Promise<void>;
|
|
13
14
|
handleDragDropRequest(request: DragDropRequestDashboard): Promise<boolean>;
|
|
14
15
|
handleDragDropReadRequest(request: DragDropReadRequestDashboard): Promise<DragDropReadResponse>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Cookie, DASHBOARD_APP_INSTALL_PERMISSION_ID, DAShBOARD_DRAG_DROP_PERMISSION_ID, DASHBOARD_OPEN_APP_PERMISSION_ID, DASHBOARD_SET_PERMISSION_ID, DASHBOARD_SPEECH_RECOGNITION_PERMISSION_ID, DASHBOARD_WEBVIEW_PERMISSION_ID, DASHOBARD_APP_EDIT_PERMISSION_ID, DASHOBARD_APP_READ_PERMISSION_ID, GetCookiesRequest, HostRequest, UserResponse, WebviewPacket, WebviewRequest, type PromptRequest, type PromptRequestAppInstall, type PromptRequestAppPermissions, type PromptRequestAppPlugins, type PromptRequestAppUpdate, type PromptRequestIndexInstall, type PromptResult, type SpeechRecognitionStart, type TranscriptSegment, type TranscriptStatus, type WebviewEvent } from "./extension.js";
|
|
1
|
+
export { Cookie, DASHBOARD_APP_INSTALL_PERMISSION_ID, DAShBOARD_DRAG_DROP_PERMISSION_ID, DASHBOARD_OPEN_APP_PERMISSION_ID, DASHBOARD_SET_PERMISSION_ID, DASHBOARD_SPEECH_RECOGNITION_PERMISSION_ID, DASHBOARD_WEBVIEW_PERMISSION_ID, DASHOBARD_APP_EDIT_PERMISSION_ID, DASHOBARD_APP_READ_PERMISSION_ID, GetCookiesRequest, HostRequest, UserResponse, WebviewPacket, WebviewRequest, type PortProcess, type PromptRequest, type PromptRequestAppInstall, type PromptRequestAppPermissions, type PromptRequestAppPlugins, type PromptRequestAppUpdate, type PromptRequestHttpPort, type PromptRequestIndexInstall, type PromptResult, type SpeechRecognitionStart, type TranscriptSegment, type TranscriptStatus, type WebviewEvent } from "./extension.js";
|
|
2
2
|
export type { DashboardHandler } from "./handler";
|
|
3
3
|
export { DragDropFile, DragDropReadRequestDashboard, DragDropReadResponse, DragDropRequestDashboard, FileData } from "./packets.js";
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { Identifier } from "../../identifier";
|
|
2
2
|
import { Omu } from "../../omu";
|
|
3
|
-
import { JsonType } from "../../serialize";
|
|
4
3
|
import { Extension, ExtensionType } from "../extension";
|
|
4
|
+
import { OmuResponse, RequestHandle } from "./http";
|
|
5
|
+
import { OmuWS } from "./websocket";
|
|
5
6
|
export declare const HTTP_EXTENSION_TYPE: ExtensionType<HttpExtension>;
|
|
6
7
|
export declare const HTTP_REQUEST_PERMISSION_ID: Identifier;
|
|
7
|
-
type RequestHandle = {
|
|
8
|
-
id: string;
|
|
9
|
-
};
|
|
10
|
-
declare class DataChunk<T extends JsonType> {
|
|
11
|
-
readonly meta: T;
|
|
12
|
-
readonly body: Uint8Array;
|
|
13
|
-
constructor(meta: T, body: Uint8Array);
|
|
14
|
-
static serialize<T extends JsonType>(data: DataChunk<T>): Uint8Array;
|
|
15
|
-
static deserialize<T extends JsonType>(data: Uint8Array): DataChunk<T>;
|
|
16
|
-
}
|
|
17
8
|
type HttpResponse = RequestHandle & {
|
|
18
9
|
header: Record<string, string>;
|
|
19
10
|
status: number;
|
|
@@ -22,53 +13,6 @@ type HttpResponse = RequestHandle & {
|
|
|
22
13
|
history: HttpResponse[];
|
|
23
14
|
redirected: boolean;
|
|
24
15
|
};
|
|
25
|
-
type WSData = string | ArrayBufferLike | Blob | ArrayBufferView;
|
|
26
|
-
export declare const WSMsgType: {
|
|
27
|
-
readonly CONTINUATION: 0x0;
|
|
28
|
-
readonly TEXT: 0x1;
|
|
29
|
-
readonly BINARY: 0x2;
|
|
30
|
-
readonly PING: 0x9;
|
|
31
|
-
readonly PONG: 0xA;
|
|
32
|
-
readonly CLOSE: 0x8;
|
|
33
|
-
};
|
|
34
|
-
export declare const WSCloseCode: {
|
|
35
|
-
readonly OK: 1000;
|
|
36
|
-
readonly GOING_AWAY: 1001;
|
|
37
|
-
readonly PROTOCOL_ERROR: 1002;
|
|
38
|
-
readonly UNSUPPORTED_DATA: 1003;
|
|
39
|
-
readonly ABNORMAL_CLOSURE: 1006;
|
|
40
|
-
readonly INVALID_TEXT: 1007;
|
|
41
|
-
readonly POLICY_VIOLATION: 1008;
|
|
42
|
-
readonly MESSAGE_TOO_BIG: 1009;
|
|
43
|
-
readonly MANDATORY_EXTENSION: 1010;
|
|
44
|
-
readonly INTERNAL_ERROR: 1011;
|
|
45
|
-
readonly SERVICE_RESTART: 1012;
|
|
46
|
-
readonly TRY_AGAIN_LATER: 1013;
|
|
47
|
-
readonly BAD_GATEWAY: 1014;
|
|
48
|
-
};
|
|
49
|
-
type WebSocketOpen = RequestHandle & {
|
|
50
|
-
url: string;
|
|
51
|
-
protocol?: string | null;
|
|
52
|
-
};
|
|
53
|
-
type WebSocketClose = RequestHandle & {
|
|
54
|
-
code?: number;
|
|
55
|
-
reason?: string | null;
|
|
56
|
-
};
|
|
57
|
-
type WebSocketHandle = {
|
|
58
|
-
ws: OmuWS;
|
|
59
|
-
open: (response: WebSocketOpen) => void;
|
|
60
|
-
dispatch: (data: DataChunk<WSDataMeta>) => void;
|
|
61
|
-
close: (response: WebSocketClose) => void;
|
|
62
|
-
error: (response: WebSocketError) => void;
|
|
63
|
-
};
|
|
64
|
-
type WSDataMeta = {
|
|
65
|
-
id: string;
|
|
66
|
-
type: typeof WSMsgType.TEXT | typeof WSMsgType.BINARY | typeof WSMsgType.PING | typeof WSMsgType.PONG;
|
|
67
|
-
};
|
|
68
|
-
type WebSocketError = RequestHandle & {
|
|
69
|
-
type: "ConnectionRefused";
|
|
70
|
-
reason?: string | null;
|
|
71
|
-
};
|
|
72
16
|
export declare class HttpExtension implements Extension {
|
|
73
17
|
private readonly omu;
|
|
74
18
|
readonly type: ExtensionType<Extension>;
|
|
@@ -94,81 +38,4 @@ export declare class HttpExtension implements Extension {
|
|
|
94
38
|
headers?: Record<string, string>;
|
|
95
39
|
}): Promise<OmuWS>;
|
|
96
40
|
}
|
|
97
|
-
declare class OmuResponse implements Response {
|
|
98
|
-
readonly headers: Headers;
|
|
99
|
-
readonly ok: boolean;
|
|
100
|
-
readonly redirected: boolean;
|
|
101
|
-
readonly status: number;
|
|
102
|
-
readonly statusText: string;
|
|
103
|
-
readonly type: ResponseType;
|
|
104
|
-
readonly url: string;
|
|
105
|
-
readonly body: ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
|
106
|
-
readonly bodyUsed: boolean;
|
|
107
|
-
constructor(headers: Headers, ok: boolean, redirected: boolean, status: number, statusText: string, type: ResponseType, url: string, body: ReadableStream<Uint8Array<ArrayBuffer>> | null, bodyUsed: boolean);
|
|
108
|
-
clone(): OmuResponse;
|
|
109
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
110
|
-
blob(): Promise<Blob>;
|
|
111
|
-
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
|
112
|
-
formData(): Promise<FormData>;
|
|
113
|
-
json(): Promise<any>;
|
|
114
|
-
text(): Promise<string>;
|
|
115
|
-
}
|
|
116
|
-
type EventListenerMap<T> = { [K in keyof T] : ((event: T[K]) => unknown)[] };
|
|
117
|
-
export type WSMsg = {
|
|
118
|
-
type: "open";
|
|
119
|
-
data: WebSocketOpen;
|
|
120
|
-
} | {
|
|
121
|
-
type: "error";
|
|
122
|
-
data: WebSocketError;
|
|
123
|
-
} | {
|
|
124
|
-
type: "text";
|
|
125
|
-
data: string;
|
|
126
|
-
} | {
|
|
127
|
-
type: "binary";
|
|
128
|
-
data: Uint8Array;
|
|
129
|
-
} | {
|
|
130
|
-
type: "close";
|
|
131
|
-
data: WebSocketClose;
|
|
132
|
-
};
|
|
133
|
-
export declare class OmuWS {
|
|
134
|
-
protected readonly omu: Omu;
|
|
135
|
-
protected readonly id: Identifier;
|
|
136
|
-
protected readonly addQueue: (data: WSData) => void;
|
|
137
|
-
protected readonly dispose: () => void;
|
|
138
|
-
protected readonly receiveQueue: WSMsg[];
|
|
139
|
-
private receiveResolve;
|
|
140
|
-
private status;
|
|
141
|
-
constructor(omu: Omu, id: Identifier, addQueue: (data: WSData) => void, dispose: () => void, receiveQueue?: WSMsg[], receiveResolve?: (() => void) | undefined, status?: "connecting" | "open" | "closed");
|
|
142
|
-
static create(omu: Omu, id: Identifier, addQueue: (data: WSData) => void, dispose: () => void): WebSocketHandle;
|
|
143
|
-
send(data: WSData): void;
|
|
144
|
-
close(code?: number, reason?: string): void;
|
|
145
|
-
receive(): Promise<WSMsg>;
|
|
146
|
-
protocol: string;
|
|
147
|
-
url: string;
|
|
148
|
-
}
|
|
149
|
-
export declare class OmuWebSocket implements WebSocket {
|
|
150
|
-
protected readonly ws: OmuWS;
|
|
151
|
-
private readonly eventListeners;
|
|
152
|
-
CONNECTING: 0;
|
|
153
|
-
OPEN: 1;
|
|
154
|
-
CLOSING: 2;
|
|
155
|
-
CLOSED: 3;
|
|
156
|
-
binaryType: BinaryType;
|
|
157
|
-
bufferedAmount: number;
|
|
158
|
-
extensions: string;
|
|
159
|
-
onclose: ((this: WebSocket, ev: CloseEvent) => any) | null;
|
|
160
|
-
onerror: ((this: WebSocket, ev: Event) => any) | null;
|
|
161
|
-
onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null;
|
|
162
|
-
onopen: ((this: WebSocket, ev: Event) => any) | null;
|
|
163
|
-
protocol: string;
|
|
164
|
-
readyState: 0 | 2 | 1 | 3;
|
|
165
|
-
url: string;
|
|
166
|
-
constructor(ws: OmuWS, eventListeners?: EventListenerMap<WebSocketEventMap>);
|
|
167
|
-
private receiveLoop;
|
|
168
|
-
dispatchEvent(event: Event): boolean;
|
|
169
|
-
send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
170
|
-
close(code?: number, reason?: string): void;
|
|
171
|
-
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any): void;
|
|
172
|
-
removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any): void;
|
|
173
|
-
}
|
|
174
41
|
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { JsonType } from "../../serialize";
|
|
2
|
+
export type RequestHandle = {
|
|
3
|
+
id: string;
|
|
4
|
+
};
|
|
5
|
+
export type HttpRequest = RequestHandle & {
|
|
6
|
+
header: Record<string, string>;
|
|
7
|
+
method: string;
|
|
8
|
+
redirect: RequestRedirect;
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
export declare class DataChunk<T extends JsonType> {
|
|
12
|
+
readonly meta: T;
|
|
13
|
+
readonly body: Uint8Array;
|
|
14
|
+
constructor(meta: T, body: Uint8Array);
|
|
15
|
+
static serialize<T extends JsonType>(data: DataChunk<T>): Uint8Array;
|
|
16
|
+
static deserialize<T extends JsonType>(data: Uint8Array): DataChunk<T>;
|
|
17
|
+
}
|
|
18
|
+
export declare class OmuResponse implements Response {
|
|
19
|
+
readonly headers: Headers;
|
|
20
|
+
readonly ok: boolean;
|
|
21
|
+
readonly redirected: boolean;
|
|
22
|
+
readonly status: number;
|
|
23
|
+
readonly statusText: string;
|
|
24
|
+
readonly type: ResponseType;
|
|
25
|
+
readonly url: string;
|
|
26
|
+
readonly body: ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
|
27
|
+
readonly bodyUsed: boolean;
|
|
28
|
+
constructor(headers: Headers, ok: boolean, redirected: boolean, status: number, statusText: string, type: ResponseType, url: string, body: ReadableStream<Uint8Array<ArrayBuffer>> | null, bodyUsed: boolean);
|
|
29
|
+
clone(): OmuResponse;
|
|
30
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
31
|
+
blob(): Promise<Blob>;
|
|
32
|
+
bytes(): Promise<Uint8Array<ArrayBuffer>>;
|
|
33
|
+
formData(): Promise<FormData>;
|
|
34
|
+
json(): Promise<any>;
|
|
35
|
+
text(): Promise<string>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { DataChunk, RequestHandle } from "./http";
|
|
2
|
+
export type WSData = string | ArrayBufferLike | Blob | ArrayBufferView;
|
|
3
|
+
export declare const WSMsgType: {
|
|
4
|
+
readonly CONTINUATION: 0x0;
|
|
5
|
+
readonly TEXT: 0x1;
|
|
6
|
+
readonly BINARY: 0x2;
|
|
7
|
+
readonly PING: 0x9;
|
|
8
|
+
readonly PONG: 0xA;
|
|
9
|
+
readonly CLOSE: 0x8;
|
|
10
|
+
};
|
|
11
|
+
export declare const WSCloseCode: {
|
|
12
|
+
readonly OK: 1000;
|
|
13
|
+
readonly GOING_AWAY: 1001;
|
|
14
|
+
readonly PROTOCOL_ERROR: 1002;
|
|
15
|
+
readonly UNSUPPORTED_DATA: 1003;
|
|
16
|
+
readonly ABNORMAL_CLOSURE: 1006;
|
|
17
|
+
readonly INVALID_TEXT: 1007;
|
|
18
|
+
readonly POLICY_VIOLATION: 1008;
|
|
19
|
+
readonly MESSAGE_TOO_BIG: 1009;
|
|
20
|
+
readonly MANDATORY_EXTENSION: 1010;
|
|
21
|
+
readonly INTERNAL_ERROR: 1011;
|
|
22
|
+
readonly SERVICE_RESTART: 1012;
|
|
23
|
+
readonly TRY_AGAIN_LATER: 1013;
|
|
24
|
+
readonly BAD_GATEWAY: 1014;
|
|
25
|
+
};
|
|
26
|
+
export type WebSocketOpen = RequestHandle & {
|
|
27
|
+
url: string;
|
|
28
|
+
protocol?: string | null;
|
|
29
|
+
};
|
|
30
|
+
export type WebSocketClose = RequestHandle & {
|
|
31
|
+
code?: number;
|
|
32
|
+
reason?: string | null;
|
|
33
|
+
};
|
|
34
|
+
export type WebSocketError = RequestHandle & {
|
|
35
|
+
type: "ConnectionRefused";
|
|
36
|
+
reason?: string | null;
|
|
37
|
+
};
|
|
38
|
+
export type EventListenerMap<T> = { [K in keyof T] : ((event: T[K]) => unknown)[] };
|
|
39
|
+
export type WSMsg = {
|
|
40
|
+
type: "open";
|
|
41
|
+
data: WebSocketOpen;
|
|
42
|
+
} | {
|
|
43
|
+
type: "error";
|
|
44
|
+
data: WebSocketError;
|
|
45
|
+
} | {
|
|
46
|
+
type: "text";
|
|
47
|
+
data: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "binary";
|
|
50
|
+
data: Uint8Array;
|
|
51
|
+
} | {
|
|
52
|
+
type: "close";
|
|
53
|
+
data: WebSocketClose;
|
|
54
|
+
};
|
|
55
|
+
export type WebSocketHandle = {
|
|
56
|
+
ws: OmuWS;
|
|
57
|
+
open: (response: WebSocketOpen) => void;
|
|
58
|
+
dispatch: (data: DataChunk<WSDataMeta>) => void;
|
|
59
|
+
close: (response: WebSocketClose) => void;
|
|
60
|
+
error: (response: WebSocketError) => void;
|
|
61
|
+
};
|
|
62
|
+
export type WSDataMeta = {
|
|
63
|
+
id: string;
|
|
64
|
+
type: typeof WSMsgType.TEXT | typeof WSMsgType.BINARY | typeof WSMsgType.PING | typeof WSMsgType.PONG;
|
|
65
|
+
};
|
|
66
|
+
export type WSHandleState = {
|
|
67
|
+
type: "created" | "receiving";
|
|
68
|
+
handle: WebSocketHandle;
|
|
69
|
+
};
|
|
70
|
+
type WSOptions = {
|
|
71
|
+
addQueue: (data: WSData) => void;
|
|
72
|
+
dispose(options: {
|
|
73
|
+
code?: number;
|
|
74
|
+
reason?: string;
|
|
75
|
+
}): void;
|
|
76
|
+
};
|
|
77
|
+
export declare class OmuWS {
|
|
78
|
+
protected readonly addQueue: (data: WSData) => void;
|
|
79
|
+
protected readonly dispose: (options: {
|
|
80
|
+
code?: number;
|
|
81
|
+
reason?: string;
|
|
82
|
+
}) => void;
|
|
83
|
+
protected readonly receiveQueue: WSMsg[];
|
|
84
|
+
private receiveResolve;
|
|
85
|
+
private status;
|
|
86
|
+
constructor(addQueue: (data: WSData) => void, dispose: (options: {
|
|
87
|
+
code?: number;
|
|
88
|
+
reason?: string;
|
|
89
|
+
}) => void, receiveQueue?: WSMsg[], receiveResolve?: (() => void) | undefined, status?: "connecting" | "open" | "closed");
|
|
90
|
+
toWebSocket(): OmuWebSocket;
|
|
91
|
+
static create(options: WSOptions): WebSocketHandle;
|
|
92
|
+
send(data: WSData): void;
|
|
93
|
+
close(code?: number, reason?: string): void;
|
|
94
|
+
receive(): Promise<WSMsg>;
|
|
95
|
+
protocol: string;
|
|
96
|
+
url: string;
|
|
97
|
+
}
|
|
98
|
+
export declare class OmuWebSocket implements WebSocket {
|
|
99
|
+
protected readonly ws: OmuWS;
|
|
100
|
+
private readonly eventListeners;
|
|
101
|
+
CONNECTING: 0;
|
|
102
|
+
OPEN: 1;
|
|
103
|
+
CLOSING: 2;
|
|
104
|
+
CLOSED: 3;
|
|
105
|
+
binaryType: BinaryType;
|
|
106
|
+
bufferedAmount: number;
|
|
107
|
+
extensions: string;
|
|
108
|
+
onclose: ((this: WebSocket, ev: CloseEvent) => unknown) | null;
|
|
109
|
+
onerror: ((this: WebSocket, ev: Event) => unknown) | null;
|
|
110
|
+
onmessage: ((this: WebSocket, ev: MessageEvent) => unknown) | null;
|
|
111
|
+
onopen: ((this: WebSocket, ev: Event) => unknown) | null;
|
|
112
|
+
protocol: string;
|
|
113
|
+
readyState: 0 | 2 | 1 | 3;
|
|
114
|
+
url: string;
|
|
115
|
+
constructor(ws: OmuWS, eventListeners?: EventListenerMap<WebSocketEventMap>);
|
|
116
|
+
private receiveLoop;
|
|
117
|
+
dispatchEvent(event: Event): boolean;
|
|
118
|
+
send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
119
|
+
close(code?: number, reason?: string): void;
|
|
120
|
+
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => unknown): void;
|
|
121
|
+
removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => unknown): void;
|
|
122
|
+
}
|
|
123
|
+
export {};
|
|
@@ -41,4 +41,17 @@ export interface Registry<T> {
|
|
|
41
41
|
update(fn: (value: T) => PromiseLike<T> | T): Promise<T>;
|
|
42
42
|
modify(fn: (value: T) => PromiseLike<T> | T): Promise<T>;
|
|
43
43
|
listen(fn: (value: T) => void): Unlisten;
|
|
44
|
+
compatSvelte(): Writable<T>;
|
|
45
|
+
}
|
|
46
|
+
export type Subscriber<T> = (value: T) => void;
|
|
47
|
+
export type Unsubscriber = () => void;
|
|
48
|
+
export type Updater<T> = (value: T) => T;
|
|
49
|
+
export type StartStopNotifier<T> = (set: (value: T) => void, update: (fn: Updater<T>) => void) => void | (() => void);
|
|
50
|
+
export interface Readable<T> {
|
|
51
|
+
subscribe(this: void, run: Subscriber<T>): Unsubscriber;
|
|
52
|
+
}
|
|
53
|
+
export interface Writable<T> extends Readable<T> {
|
|
54
|
+
set(this: void, value: T): void;
|
|
55
|
+
update(this: void, updater: Updater<T>): void;
|
|
56
|
+
wait(): Promise<T>;
|
|
44
57
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { App, AppJson } from "../../app.js";
|
|
2
2
|
import { Identifier, IdentifierMap } from "../../identifier";
|
|
3
|
+
import { LocalizedText } from "../../localization/localization.js";
|
|
3
4
|
import { Omu } from "../../omu.js";
|
|
4
5
|
import { ExtensionType, type Extension } from "../extension.js";
|
|
5
6
|
import { Registry, RegistryType } from "../registry";
|
|
@@ -7,6 +8,7 @@ import { type Table } from "../table";
|
|
|
7
8
|
export declare const SERVER_EXTENSION_TYPE: ExtensionType<ServerExtension>;
|
|
8
9
|
export interface AppIndexEntry {
|
|
9
10
|
url: string;
|
|
11
|
+
meta?: AppIndexRegistryMeta;
|
|
10
12
|
added_at: string;
|
|
11
13
|
}
|
|
12
14
|
export interface AppIndex {
|
|
@@ -35,13 +37,19 @@ export declare class SessionObserver {
|
|
|
35
37
|
onConnect(callback: (app: App) => Promise<void> | void): void;
|
|
36
38
|
onDisconnect(callback: (app: App) => Promise<void> | void): void;
|
|
37
39
|
}
|
|
40
|
+
export type AppIndexRegistryMeta = {
|
|
41
|
+
name: LocalizedText;
|
|
42
|
+
note: LocalizedText;
|
|
43
|
+
};
|
|
38
44
|
export interface AppIndexRegistryJSON {
|
|
39
45
|
id: string;
|
|
46
|
+
meta?: AppIndexRegistryMeta;
|
|
40
47
|
apps: Record<string, AppJson>;
|
|
41
48
|
}
|
|
42
49
|
export declare class AppIndexRegistry {
|
|
43
50
|
id: Identifier;
|
|
44
51
|
apps: IdentifierMap<App>;
|
|
45
|
-
|
|
52
|
+
meta: AppIndexRegistryMeta | undefined;
|
|
53
|
+
constructor(id: Identifier, apps: IdentifierMap<App>, meta: AppIndexRegistryMeta | undefined);
|
|
46
54
|
static fromJSON(json: AppIndexRegistryJSON): AppIndexRegistry;
|
|
47
55
|
}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -8,9 +8,7 @@ export type { Serializable } from "./serialize";
|
|
|
8
8
|
export { BrowserTokenProvider, type SessionParam, type TokenProvider } from "./token";
|
|
9
9
|
import { Identifier } from "./identifier";
|
|
10
10
|
export declare const OmuPermissions: {
|
|
11
|
-
readonly
|
|
12
|
-
readonly ASSET_DOWNLOAD_PERMISSION_ID: Identifier;
|
|
13
|
-
readonly ASSET_UPLOAD_PERMISSION_ID: Identifier;
|
|
11
|
+
readonly ASSET_PERMISSION_ID: Identifier;
|
|
14
12
|
readonly DASHBOARD_APP_INSTALL_PERMISSION_ID: Identifier;
|
|
15
13
|
readonly DAShBOARD_DRAG_DROP_PERMISSION_ID: Identifier;
|
|
16
14
|
readonly DASHBOARD_OPEN_APP_PERMISSION_ID: Identifier;
|
package/dist/dts/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.9.
|
|
1
|
+
export declare const VERSION = "0.9.32";
|