@omujs/omu 0.9.48 → 0.9.49
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/dist/dts/api/asset/extension.d.ts +25 -0
- package/dist/dts/api/asset/index.d.ts +2 -0
- package/dist/dts/api/dashboard/extension.d.ts +183 -0
- package/{src/api/dashboard/handler.ts → dist/dts/api/dashboard/handler.d.ts} +0 -2
- package/dist/dts/api/dashboard/index.d.ts +3 -0
- package/dist/dts/api/dashboard/packets.d.ts +73 -0
- package/dist/dts/api/endpoint/endpoint.d.ts +21 -0
- package/dist/dts/api/endpoint/extension.d.ts +17 -0
- package/{src/api/endpoint/index.ts → dist/dts/api/endpoint/index.d.ts} +0 -1
- package/dist/dts/api/endpoint/packets.d.ts +51 -0
- package/dist/dts/api/extension-registry.d.ts +8 -0
- package/dist/dts/api/extension.d.ts +11 -0
- package/dist/dts/api/http/extension.d.ts +41 -0
- package/dist/dts/api/http/http.d.ts +36 -0
- package/{src/api/http/index.ts → dist/dts/api/http/index.d.ts} +0 -1
- package/dist/dts/api/http/websocket.d.ts +125 -0
- package/dist/dts/api/i18n/extension.d.ts +19 -0
- package/{src/api/i18n/index.ts → dist/dts/api/i18n/index.d.ts} +0 -1
- package/{src/api/index.ts → dist/dts/api/index.d.ts} +0 -1
- package/dist/dts/api/logger/extension.d.ts +25 -0
- package/dist/dts/api/logger/index.d.ts +1 -0
- package/dist/dts/api/logger/packets.d.ts +18 -0
- package/dist/dts/api/permission/extension.d.ts +19 -0
- package/{src/api/permission/index.ts → dist/dts/api/permission/index.d.ts} +0 -1
- package/dist/dts/api/permission/permission.d.ts +25 -0
- package/dist/dts/api/plugin/extension.d.ts +43 -0
- package/{src/api/plugin/index.ts → dist/dts/api/plugin/index.d.ts} +0 -1
- package/{src/api/plugin/package-info.ts → dist/dts/api/plugin/package-info.d.ts} +0 -7
- package/dist/dts/api/registry/extension.d.ts +23 -0
- package/{src/api/registry/index.ts → dist/dts/api/registry/index.d.ts} +0 -1
- package/dist/dts/api/registry/packets.d.ts +20 -0
- package/{src/api/registry/registry.ts → dist/dts/api/registry/registry.d.ts} +11 -53
- package/dist/dts/api/server/extension.d.ts +61 -0
- package/dist/dts/api/server/index.d.ts +1 -0
- package/dist/dts/api/session/extension.d.ts +52 -0
- package/dist/dts/api/session/index.d.ts +1 -0
- package/dist/dts/api/signal/extension.d.ts +19 -0
- package/dist/dts/api/signal/packets.d.ts +21 -0
- package/dist/dts/api/signal/signal.d.ts +33 -0
- package/dist/dts/api/table/extension.d.ts +26 -0
- package/{src/api/table/index.ts → dist/dts/api/table/index.d.ts} +0 -1
- package/dist/dts/api/table/packets.d.ts +65 -0
- package/dist/dts/api/table/table.d.ts +75 -0
- package/dist/dts/app.d.ts +49 -0
- package/dist/dts/const.d.ts +2 -0
- package/dist/dts/errors.d.ts +36 -0
- package/dist/dts/event/index.d.ts +6 -0
- package/dist/dts/helper.d.ts +10 -0
- package/dist/dts/identifier.d.ts +51 -0
- package/dist/dts/index.d.ts +36 -0
- package/{src/localization/index.ts → dist/dts/localization/index.d.ts} +0 -1
- package/dist/dts/localization/locale.d.ts +735 -0
- package/{src/localization/localization.ts → dist/dts/localization/localization.d.ts} +0 -2
- package/dist/dts/lock.d.ts +6 -0
- package/dist/dts/network/connection.d.ts +17 -0
- package/dist/dts/network/encryption.d.ts +38 -0
- package/dist/dts/network/frame-transport.d.ts +22 -0
- package/{src/network/index.ts → dist/dts/network/index.d.ts} +0 -1
- package/dist/dts/network/network.d.ts +59 -0
- package/{src/network/packet/index.ts → dist/dts/network/packet/index.d.ts} +0 -1
- package/dist/dts/network/packet/packet-types.d.ts +84 -0
- package/dist/dts/network/packet/packet.d.ts +25 -0
- package/dist/dts/network/websocket-transport.d.ts +24 -0
- package/dist/dts/omu.d.ts +61 -0
- package/dist/dts/result.d.ts +26 -0
- package/dist/dts/serialize/bytebuffer.d.ts +73 -0
- package/dist/dts/serialize/serializer.d.ts +26 -0
- package/dist/dts/token.d.ts +14 -0
- package/dist/dts/version.d.ts +2 -0
- package/dist/esm/address.js +4 -0
- package/dist/esm/api/asset/extension.js +911 -0
- package/dist/esm/api/asset/index.js +909 -0
- package/dist/esm/api/dashboard/extension.js +1362 -0
- package/dist/esm/api/dashboard/handler.js +4 -0
- package/dist/esm/api/dashboard/index.js +1361 -0
- package/dist/esm/api/dashboard/packets.js +419 -0
- package/dist/esm/api/endpoint/endpoint.js +383 -0
- package/dist/esm/api/endpoint/extension.js +1096 -0
- package/dist/esm/api/endpoint/index.js +383 -0
- package/dist/esm/api/endpoint/packets.js +799 -0
- package/dist/esm/api/extension-registry.js +23 -0
- package/dist/esm/api/extension.js +278 -0
- package/dist/esm/api/http/extension.js +1420 -0
- package/dist/esm/api/http/http.js +448 -0
- package/dist/esm/api/http/index.js +1419 -0
- package/dist/esm/api/http/websocket.js +220 -0
- package/dist/esm/api/i18n/extension.js +1339 -0
- package/dist/esm/api/i18n/index.js +1337 -0
- package/dist/esm/api/index.js +295 -0
- package/dist/esm/api/logger/extension.js +856 -0
- package/dist/esm/api/logger/index.js +852 -0
- package/dist/esm/api/logger/packets.js +673 -0
- package/dist/esm/api/permission/extension.js +535 -0
- package/dist/esm/api/permission/index.js +294 -0
- package/dist/esm/api/permission/permission.js +294 -0
- package/dist/esm/api/plugin/extension.js +531 -0
- package/dist/esm/api/plugin/index.js +529 -0
- package/dist/esm/api/plugin/package-info.js +4 -0
- package/dist/esm/api/registry/extension.js +1286 -0
- package/dist/esm/api/registry/index.js +1285 -0
- package/dist/esm/api/registry/packets.js +694 -0
- package/dist/esm/api/registry/registry.js +383 -0
- package/dist/esm/api/server/extension.js +2140 -0
- package/dist/esm/api/server/index.js +2118 -0
- package/dist/esm/api/session/extension.js +2235 -0
- package/dist/esm/api/session/index.js +2235 -0
- package/dist/esm/api/signal/extension.js +1031 -0
- package/dist/esm/api/signal/index.js +379 -0
- package/dist/esm/api/signal/packets.js +690 -0
- package/dist/esm/api/signal/signal.js +379 -0
- package/dist/esm/api/table/extension.js +1553 -0
- package/dist/esm/api/table/index.js +1552 -0
- package/dist/esm/api/table/packets.js +904 -0
- package/dist/esm/api/table/table.js +383 -0
- package/dist/esm/app.js +264 -0
- package/dist/esm/const.js +11 -0
- package/dist/esm/errors.js +548 -0
- package/dist/esm/event/index.js +22 -0
- package/dist/esm/helper.js +15 -0
- package/dist/esm/identifier.js +266 -0
- package/dist/esm/index.js +5186 -0
- package/dist/esm/localization/index.js +742 -0
- package/dist/esm/localization/locale.js +742 -0
- package/dist/esm/localization/localization.js +4 -0
- package/dist/esm/lock.js +46 -0
- package/dist/esm/network/connection.js +293 -0
- package/dist/esm/network/encryption.js +986 -0
- package/dist/esm/network/frame-transport.js +531 -0
- package/dist/esm/network/index.js +1627 -0
- package/dist/esm/network/network.js +1368 -0
- package/dist/esm/network/packet/index.js +485 -0
- package/dist/esm/network/packet/packet-types.js +486 -0
- package/dist/esm/network/packet/packet.js +126 -0
- package/dist/esm/network/websocket-transport.js +493 -0
- package/dist/esm/omu.js +4945 -0
- package/dist/esm/result.js +68 -0
- package/dist/esm/serialize/bytebuffer.js +384 -0
- package/dist/esm/serialize/index.js +471 -0
- package/dist/esm/serialize/serializer.js +97 -0
- package/dist/esm/token.js +42 -0
- package/dist/esm/version.js +11 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +4 -1
- package/CHANGELOG.md +0 -1845
- package/src/api/asset/extension.ts +0 -193
- package/src/api/asset/index.ts +0 -5
- package/src/api/dashboard/extension.ts +0 -651
- package/src/api/dashboard/index.ts +0 -38
- package/src/api/dashboard/packets.ts +0 -126
- package/src/api/endpoint/endpoint.ts +0 -56
- package/src/api/endpoint/extension.ts +0 -133
- package/src/api/endpoint/packets.ts +0 -176
- package/src/api/extension-registry.ts +0 -17
- package/src/api/extension.ts +0 -19
- package/src/api/http/extension.ts +0 -401
- package/src/api/http/http.ts +0 -79
- package/src/api/http/websocket.ts +0 -283
- package/src/api/i18n/extension.ts +0 -65
- package/src/api/logger/extension.ts +0 -75
- package/src/api/logger/index.ts +0 -4
- package/src/api/logger/packets.ts +0 -38
- package/src/api/permission/extension.ts +0 -107
- package/src/api/permission/permission.ts +0 -53
- package/src/api/plugin/extension.ts +0 -100
- package/src/api/registry/extension.ts +0 -326
- package/src/api/registry/packets.ts +0 -64
- package/src/api/server/extension.ts +0 -155
- package/src/api/server/index.ts +0 -11
- package/src/api/session/extension.ts +0 -205
- package/src/api/session/index.ts +0 -7
- package/src/api/signal/extension.ts +0 -125
- package/src/api/signal/packets.ts +0 -61
- package/src/api/signal/signal.ts +0 -67
- package/src/api/table/extension.ts +0 -554
- package/src/api/table/packets.ts +0 -252
- package/src/api/table/table.ts +0 -113
- package/src/app.ts +0 -95
- package/src/const.ts +0 -2
- package/src/errors.ts +0 -70
- package/src/event/index.ts +0 -18
- package/src/helper.ts +0 -16
- package/src/identifier.ts +0 -256
- package/src/index.ts +0 -87
- package/src/localization/locale.ts +0 -737
- package/src/lock.ts +0 -43
- package/src/network/connection.ts +0 -45
- package/src/network/encryption.ts +0 -221
- package/src/network/frame-transport.ts +0 -186
- package/src/network/network.ts +0 -322
- package/src/network/packet/packet-types.ts +0 -164
- package/src/network/packet/packet.ts +0 -55
- package/src/network/websocket-transport.ts +0 -123
- package/src/omu.ts +0 -156
- package/src/result.ts +0 -78
- package/src/serialize/bytebuffer.ts +0 -432
- package/src/serialize/serializer.ts +0 -149
- package/src/token.ts +0 -39
- package/src/version.ts +0 -2
- package/tsconfig.json +0 -18
- /package/{src/address.ts → dist/dts/address.d.ts} +0 -0
- /package/{src/api/signal/index.ts → dist/dts/api/signal/index.d.ts} +0 -0
- /package/{src/serialize/index.ts → dist/dts/serialize/index.d.ts} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Identifier, IntoId } from '../../identifier';
|
|
2
|
+
import { Omu } from '../../omu';
|
|
3
|
+
import { ExtensionType } from '../extension.js';
|
|
4
|
+
export declare const ASSET_EXTENSION_TYPE: ExtensionType<AssetExtension>;
|
|
5
|
+
export type Asset = {
|
|
6
|
+
id: Identifier;
|
|
7
|
+
buffer: Uint8Array;
|
|
8
|
+
};
|
|
9
|
+
export declare const ASSET_PERMISSION_ID: Identifier;
|
|
10
|
+
export declare class AssetExtension {
|
|
11
|
+
private readonly omu;
|
|
12
|
+
readonly type: ExtensionType<AssetExtension>;
|
|
13
|
+
private assetToken;
|
|
14
|
+
constructor(omu: Omu);
|
|
15
|
+
upload(identifier: IntoId, buffer: Uint8Array): Promise<Identifier>;
|
|
16
|
+
uploadMany(...files: Asset[]): Promise<Identifier[]>;
|
|
17
|
+
download(identifier: IntoId): Promise<Asset>;
|
|
18
|
+
downloadMany(...identifiers: IntoId[]): Promise<Asset[]>;
|
|
19
|
+
delete(identifier: IntoId): Promise<void>;
|
|
20
|
+
private requestGenerateAssetToken;
|
|
21
|
+
url(id: IntoId, options?: {
|
|
22
|
+
cache?: 'no-cache';
|
|
23
|
+
}): string;
|
|
24
|
+
proxy(url: string): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { App, AppJson } from '../../app.js';
|
|
2
|
+
import { Identifier } from '../../identifier';
|
|
3
|
+
import { Omu } from '../../omu.js';
|
|
4
|
+
import { PromiseResult } from '../../result.js';
|
|
5
|
+
import { ExtensionType } from '../extension.js';
|
|
6
|
+
import { PermissionTypeJson } from '../permission/permission.js';
|
|
7
|
+
import { PackageInfo } from '../plugin/package-info.js';
|
|
8
|
+
import { Registry } from '../registry/registry.js';
|
|
9
|
+
import { AppIndexRegistryMeta } from '../server/extension.js';
|
|
10
|
+
import type { Table } from '../table/table.js';
|
|
11
|
+
import type { DashboardHandler } from './handler.js';
|
|
12
|
+
import { AppInstallResponse, DragDrop, DragDropReadResponse, DragEnter, DragLeave, DragOver, FileDragPacket } from './packets.js';
|
|
13
|
+
export declare const DASHBOARD_EXTENSION_TYPE: ExtensionType<DashboardExtension>;
|
|
14
|
+
export declare const DASHBOARD_SET_PERMISSION_ID: Identifier;
|
|
15
|
+
export declare const DASHBOARD_OPEN_APP_PERMISSION_ID: Identifier;
|
|
16
|
+
export declare const DASHOBARD_APP_READ_PERMISSION_ID: Identifier;
|
|
17
|
+
export declare const DASHOBARD_APP_EDIT_PERMISSION_ID: Identifier;
|
|
18
|
+
export declare const DASHBOARD_APP_INSTALL_PERMISSION_ID: Identifier;
|
|
19
|
+
export declare const DAShBOARD_DRAG_DROP_PERMISSION_ID: Identifier;
|
|
20
|
+
type DragDropHandler = {
|
|
21
|
+
onEnter(fn: (event: DragEnter) => unknown): void;
|
|
22
|
+
onOver(fn: (event: DragOver) => unknown): void;
|
|
23
|
+
onDrop(fn: (event: DragDrop) => unknown): void;
|
|
24
|
+
onLeave(fn: (event: DragLeave) => unknown): void;
|
|
25
|
+
read(id: string): Promise<DragDropReadResponse>;
|
|
26
|
+
};
|
|
27
|
+
export type Cookie = {
|
|
28
|
+
name: string;
|
|
29
|
+
value: string;
|
|
30
|
+
};
|
|
31
|
+
export type WebviewRequest = {
|
|
32
|
+
url: string;
|
|
33
|
+
script?: string;
|
|
34
|
+
};
|
|
35
|
+
export type WebviewPacket = {
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
export type UserResponse<T = undefined> = {
|
|
39
|
+
type: 'ok';
|
|
40
|
+
value: T;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'blocked';
|
|
43
|
+
} | {
|
|
44
|
+
type: 'cancelled';
|
|
45
|
+
};
|
|
46
|
+
export type UserError = Exclude<UserResponse, {
|
|
47
|
+
type: 'ok';
|
|
48
|
+
}>;
|
|
49
|
+
export type WebviewResponse = UserResponse<WebviewPacket>;
|
|
50
|
+
export declare const DASHBOARD_WEBVIEW_PERMISSION_ID: Identifier;
|
|
51
|
+
export type HostRequest = {
|
|
52
|
+
host: string;
|
|
53
|
+
};
|
|
54
|
+
export type GetCookiesRequest = {
|
|
55
|
+
url: string;
|
|
56
|
+
};
|
|
57
|
+
export type WebviewEvent = {
|
|
58
|
+
type: 'closed';
|
|
59
|
+
} | {
|
|
60
|
+
type: 'resize';
|
|
61
|
+
dimentions: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
type: 'cookie';
|
|
67
|
+
cookies: Cookie[];
|
|
68
|
+
};
|
|
69
|
+
export type WebviewEventListeners = {
|
|
70
|
+
[K in WebviewEvent['type']]?: Array<(event: Extract<WebviewEvent, {
|
|
71
|
+
type: K;
|
|
72
|
+
}>) => void>;
|
|
73
|
+
};
|
|
74
|
+
export type WebviewEventPacket = {
|
|
75
|
+
id: Identifier;
|
|
76
|
+
target: Identifier;
|
|
77
|
+
event: WebviewEvent;
|
|
78
|
+
};
|
|
79
|
+
export type WebviewHandle = {
|
|
80
|
+
readonly id: Identifier;
|
|
81
|
+
readonly url: string;
|
|
82
|
+
getCookies(): PromiseResult<Cookie[], UserError>;
|
|
83
|
+
on<T extends WebviewEvent['type']>(key: T, callback: (event: Extract<WebviewEvent, {
|
|
84
|
+
type: T;
|
|
85
|
+
}>) => void): void;
|
|
86
|
+
close(): Promise<void>;
|
|
87
|
+
join(): Promise<void>;
|
|
88
|
+
};
|
|
89
|
+
export type WebviewEventEmit = <T extends WebviewEvent['type']>(event: Extract<WebviewEvent, {
|
|
90
|
+
type: T;
|
|
91
|
+
}>) => void;
|
|
92
|
+
type AllowedHost = {
|
|
93
|
+
id: string;
|
|
94
|
+
hosts: string[];
|
|
95
|
+
};
|
|
96
|
+
export declare const DASHBOARD_SPEECH_RECOGNITION_PERMISSION_ID: Identifier;
|
|
97
|
+
export type TranscriptSegment = {
|
|
98
|
+
confidence: number;
|
|
99
|
+
transcript: string;
|
|
100
|
+
};
|
|
101
|
+
export type TranscriptStatus = {
|
|
102
|
+
type: 'idle';
|
|
103
|
+
} | {
|
|
104
|
+
type: 'result';
|
|
105
|
+
timestamp: number;
|
|
106
|
+
segments: TranscriptSegment[];
|
|
107
|
+
} | {
|
|
108
|
+
type: 'final';
|
|
109
|
+
timestamp: number;
|
|
110
|
+
segments: TranscriptSegment[];
|
|
111
|
+
} | {
|
|
112
|
+
type: 'audio_started';
|
|
113
|
+
timestamp: number;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'audio_ended';
|
|
116
|
+
timestamp: number;
|
|
117
|
+
};
|
|
118
|
+
export type SpeechRecognitionStart = {
|
|
119
|
+
type: 'start';
|
|
120
|
+
};
|
|
121
|
+
interface PromptRequestBase<T extends string> {
|
|
122
|
+
kind: T;
|
|
123
|
+
id: string;
|
|
124
|
+
}
|
|
125
|
+
export interface PromptRequestAppPermissions extends PromptRequestBase<'app/permissions'> {
|
|
126
|
+
app: AppJson;
|
|
127
|
+
permissions: PermissionTypeJson[];
|
|
128
|
+
}
|
|
129
|
+
export interface PromptRequestAppPlugins extends PromptRequestBase<'app/plugins'> {
|
|
130
|
+
app: AppJson;
|
|
131
|
+
packages: PackageInfo[];
|
|
132
|
+
}
|
|
133
|
+
export interface PromptRequestAppInstall extends PromptRequestBase<'app/install'> {
|
|
134
|
+
app: AppJson;
|
|
135
|
+
dependencies: Record<string, AppJson>;
|
|
136
|
+
}
|
|
137
|
+
export interface PromptRequestAppUpdate extends PromptRequestBase<'app/update'> {
|
|
138
|
+
old_app: AppJson;
|
|
139
|
+
new_app: AppJson;
|
|
140
|
+
dependencies: Record<string, AppJson>;
|
|
141
|
+
}
|
|
142
|
+
export interface PromptRequestIndexInstall extends PromptRequestBase<'index/install'> {
|
|
143
|
+
index_url: string;
|
|
144
|
+
meta?: AppIndexRegistryMeta;
|
|
145
|
+
}
|
|
146
|
+
export interface PortProcess {
|
|
147
|
+
port: number;
|
|
148
|
+
name: string;
|
|
149
|
+
exe: string;
|
|
150
|
+
}
|
|
151
|
+
export interface PromptRequestHttpPort extends PromptRequestBase<'http/port'> {
|
|
152
|
+
app: AppJson;
|
|
153
|
+
processes: PortProcess[];
|
|
154
|
+
}
|
|
155
|
+
export type PromptRequest = (PromptRequestAppPermissions | PromptRequestAppPlugins | PromptRequestAppInstall | PromptRequestAppUpdate | PromptRequestIndexInstall | PromptRequestHttpPort);
|
|
156
|
+
export type PromptResult = 'accept' | 'deny' | 'block';
|
|
157
|
+
export declare class DashboardExtension {
|
|
158
|
+
private readonly omu;
|
|
159
|
+
readonly type: ExtensionType<DashboardExtension>;
|
|
160
|
+
private dashboard;
|
|
161
|
+
private dragDropHandler;
|
|
162
|
+
private dragDropListeners;
|
|
163
|
+
readonly allowedHosts: Table<AllowedHost>;
|
|
164
|
+
readonly speechRecognition: Registry<TranscriptStatus>;
|
|
165
|
+
private readonly webviewHandles;
|
|
166
|
+
constructor(omu: Omu);
|
|
167
|
+
private executeRequestForDashboard;
|
|
168
|
+
private handlePromptRequest;
|
|
169
|
+
private handleOpenApp;
|
|
170
|
+
private handleDragDropRequest;
|
|
171
|
+
private handleDragDropReadRequest;
|
|
172
|
+
private getDashboard;
|
|
173
|
+
set(dashboard: DashboardHandler): void;
|
|
174
|
+
requestWebview(options: WebviewRequest): PromiseResult<WebviewHandle, UserError>;
|
|
175
|
+
getCookies(options: GetCookiesRequest): PromiseResult<Cookie[], UserError>;
|
|
176
|
+
openApp(app: App): Promise<void>;
|
|
177
|
+
installApp(app: App): Promise<AppInstallResponse>;
|
|
178
|
+
clearBlockedPrompts(): Promise<null>;
|
|
179
|
+
requestDragDrop(): Promise<DragDropHandler>;
|
|
180
|
+
notifyDropDragState(packet: FileDragPacket): Promise<void>;
|
|
181
|
+
requestSpeechRecognition(): PromiseResult<Registry<TranscriptStatus>, UserError>;
|
|
182
|
+
}
|
|
183
|
+
export {};
|
|
@@ -2,9 +2,7 @@ import type { App } from '../../app.js';
|
|
|
2
2
|
import { Identifier } from '../../identifier';
|
|
3
3
|
import { InvokedParams } from '../endpoint/packets.js';
|
|
4
4
|
import { Cookie, GetCookiesRequest, HostRequest, PromptRequestAppInstall, PromptRequestAppPermissions, PromptRequestAppPlugins, PromptRequestAppUpdate, PromptRequestHttpPort, PromptRequestIndexInstall, PromptResult, SpeechRecognitionStart, UserResponse, WebviewEvent, WebviewPacket, WebviewRequest } from './extension.js';
|
|
5
|
-
|
|
6
5
|
import type { DragDropReadRequestDashboard, DragDropReadResponse, DragDropRequestDashboard } from './packets.js';
|
|
7
|
-
|
|
8
6
|
export interface DashboardHandler {
|
|
9
7
|
handlePermissionRequest(request: PromptRequestAppPermissions): Promise<PromptResult>;
|
|
10
8
|
handlePluginRequest(request: PromptRequestAppPlugins): Promise<PromptResult>;
|
|
@@ -0,0 +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 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
|
+
export type { DashboardHandler } from './handler';
|
|
3
|
+
export { DragDropFile, DragDropReadRequestDashboard, DragDropReadResponse, DragDropRequestDashboard, FileData, } from './packets.js';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { App, AppJson } from '../../app.js';
|
|
2
|
+
export type AppInstallResponse = {
|
|
3
|
+
accepted: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type DragDropFile = {
|
|
6
|
+
type: 'file' | 'directory';
|
|
7
|
+
size: number;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
export type DragDropPosition = {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
export type DragEnter = {
|
|
15
|
+
type: 'enter';
|
|
16
|
+
drag_id: string;
|
|
17
|
+
files: DragDropFile[];
|
|
18
|
+
position: DragDropPosition;
|
|
19
|
+
};
|
|
20
|
+
export type DragOver = {
|
|
21
|
+
type: 'over';
|
|
22
|
+
drag_id: string;
|
|
23
|
+
position: DragDropPosition;
|
|
24
|
+
};
|
|
25
|
+
export type DragDrop = {
|
|
26
|
+
type: 'drop';
|
|
27
|
+
drag_id: string;
|
|
28
|
+
position: DragDropPosition;
|
|
29
|
+
files: DragDropFile[];
|
|
30
|
+
};
|
|
31
|
+
export type DragLeave = {
|
|
32
|
+
type: 'leave';
|
|
33
|
+
drag_id: string;
|
|
34
|
+
};
|
|
35
|
+
export type DragState = DragEnter | DragOver | DragDrop | DragLeave;
|
|
36
|
+
export type FileDragPacket = {
|
|
37
|
+
drag_id: string;
|
|
38
|
+
app: App;
|
|
39
|
+
state: DragState;
|
|
40
|
+
};
|
|
41
|
+
export type DragDropReadRequest = {
|
|
42
|
+
drag_id: string;
|
|
43
|
+
};
|
|
44
|
+
export type DragDropReadRequestDashboard = {
|
|
45
|
+
request_id: string;
|
|
46
|
+
drag_id: string;
|
|
47
|
+
};
|
|
48
|
+
export type DragDropReadMeta = {
|
|
49
|
+
request_id: string;
|
|
50
|
+
drag_id: string;
|
|
51
|
+
files: readonly DragDropFile[];
|
|
52
|
+
};
|
|
53
|
+
export type FileData = {
|
|
54
|
+
file: DragDropFile;
|
|
55
|
+
buffer: Uint8Array;
|
|
56
|
+
};
|
|
57
|
+
export declare class DragDropReadResponse {
|
|
58
|
+
readonly meta: DragDropReadMeta;
|
|
59
|
+
readonly files: Record<string, FileData>;
|
|
60
|
+
readonly version: number;
|
|
61
|
+
constructor(meta: DragDropReadMeta, files: Record<string, FileData>, version?: number);
|
|
62
|
+
static serialize(data: DragDropReadResponse): Uint8Array;
|
|
63
|
+
static deserialize(data: Uint8Array): DragDropReadResponse;
|
|
64
|
+
}
|
|
65
|
+
export type DragDropRequest = object;
|
|
66
|
+
export type DragDropRequestDashboard = {
|
|
67
|
+
request_id: string;
|
|
68
|
+
app: AppJson;
|
|
69
|
+
};
|
|
70
|
+
export type DragDropRequestResponse = {
|
|
71
|
+
request_id: string;
|
|
72
|
+
ok: boolean;
|
|
73
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Identifier, IntoId } from '../../identifier';
|
|
2
|
+
import { JsonType, type Serializable } from '../../serialize';
|
|
3
|
+
export declare class EndpointType<Req = unknown, Res = unknown> {
|
|
4
|
+
readonly id: Identifier;
|
|
5
|
+
readonly requestSerializer: Serializable<Req, Uint8Array>;
|
|
6
|
+
readonly responseSerializer: Serializable<Res, Uint8Array>;
|
|
7
|
+
readonly permissionId?: Identifier | undefined;
|
|
8
|
+
constructor(id: Identifier, requestSerializer: Serializable<Req, Uint8Array>, responseSerializer: Serializable<Res, Uint8Array>, permissionId?: Identifier | undefined);
|
|
9
|
+
static createJson<Req, Res, ReqData extends JsonType = JsonType, ResData extends JsonType = JsonType>(identifier: IntoId, { name, requestSerializer, responseSerializer, permissionId, }: {
|
|
10
|
+
name: string;
|
|
11
|
+
requestSerializer?: Serializable<Req, ReqData>;
|
|
12
|
+
responseSerializer?: Serializable<Res, ResData>;
|
|
13
|
+
permissionId?: IntoId;
|
|
14
|
+
}): EndpointType<Req, Res>;
|
|
15
|
+
static createSerialized<Req, Res>(identifier: IntoId, { name, requestSerializer, responseSerializer, permissionId, }: {
|
|
16
|
+
name: string;
|
|
17
|
+
requestSerializer: Serializable<Req, Uint8Array>;
|
|
18
|
+
responseSerializer: Serializable<Res, Uint8Array>;
|
|
19
|
+
permissionId?: IntoId;
|
|
20
|
+
}): EndpointType<Req, Res>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Omu } from '../../omu';
|
|
2
|
+
import { ExtensionType } from '../extension.js';
|
|
3
|
+
import { EndpointType } from './endpoint.js';
|
|
4
|
+
import { InvokedParams } from './packets.js';
|
|
5
|
+
export declare const ENDPOINT_EXTENSION_TYPE: ExtensionType<EndpointExtension>;
|
|
6
|
+
export declare class EndpointExtension {
|
|
7
|
+
private readonly omu;
|
|
8
|
+
readonly type: ExtensionType<EndpointExtension>;
|
|
9
|
+
private readonly boundEndpoints;
|
|
10
|
+
private readonly responsePromises;
|
|
11
|
+
private callId;
|
|
12
|
+
constructor(omu: Omu);
|
|
13
|
+
private handleInvoked;
|
|
14
|
+
private onTask;
|
|
15
|
+
bind<Req, Res>(type: EndpointType<Req, Res>, handler: (data: Req, params: InvokedParams) => Promise<Res>): void;
|
|
16
|
+
call<Req, Res>(endpoint: EndpointType<Req, Res>, data: Req): Promise<Res>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Identifier, IdentifierMap } from '../../identifier';
|
|
2
|
+
export declare class EndpointRegisterPacket {
|
|
3
|
+
endpoints: IdentifierMap<Identifier | undefined>;
|
|
4
|
+
constructor(endpoints: IdentifierMap<Identifier | undefined>);
|
|
5
|
+
static serialize(item: EndpointRegisterPacket): Uint8Array;
|
|
6
|
+
static deserialize(item: Uint8Array): EndpointRegisterPacket;
|
|
7
|
+
}
|
|
8
|
+
export declare class InvokedParams {
|
|
9
|
+
readonly id: Identifier;
|
|
10
|
+
readonly caller: Identifier;
|
|
11
|
+
readonly key: number;
|
|
12
|
+
constructor(id: Identifier, caller: Identifier, key: number);
|
|
13
|
+
static serialize(item: InvokedParams): string;
|
|
14
|
+
static deserialize(item: string): InvokedParams;
|
|
15
|
+
}
|
|
16
|
+
export declare class EndpointInvokedPacket {
|
|
17
|
+
params: InvokedParams;
|
|
18
|
+
buffer: Uint8Array;
|
|
19
|
+
constructor(params: InvokedParams, buffer: Uint8Array);
|
|
20
|
+
static serialize(item: EndpointInvokedPacket): Uint8Array;
|
|
21
|
+
static deserialize(item: Uint8Array): EndpointInvokedPacket;
|
|
22
|
+
}
|
|
23
|
+
export declare class InvokeParams {
|
|
24
|
+
readonly id: Identifier;
|
|
25
|
+
readonly key: number;
|
|
26
|
+
constructor(id: Identifier, key: number);
|
|
27
|
+
static serialize(item: InvokeParams): string;
|
|
28
|
+
static deserialize(item: string): InvokeParams;
|
|
29
|
+
}
|
|
30
|
+
export declare class EndpointInvokePacket {
|
|
31
|
+
params: InvokeParams;
|
|
32
|
+
buffer: Uint8Array;
|
|
33
|
+
constructor(params: InvokeParams, buffer: Uint8Array);
|
|
34
|
+
static serialize(item: EndpointInvokePacket): Uint8Array;
|
|
35
|
+
static deserialize(item: Uint8Array): EndpointInvokePacket;
|
|
36
|
+
}
|
|
37
|
+
export declare class ResponseParams {
|
|
38
|
+
readonly id: Identifier;
|
|
39
|
+
readonly key: number;
|
|
40
|
+
readonly error: string | null;
|
|
41
|
+
constructor(id: Identifier, key: number, error: string | null);
|
|
42
|
+
static serialize(item: ResponseParams): string;
|
|
43
|
+
static deserialize(item: string): ResponseParams;
|
|
44
|
+
}
|
|
45
|
+
export declare class EndpointResponsePacket {
|
|
46
|
+
params: ResponseParams;
|
|
47
|
+
buffer: Uint8Array;
|
|
48
|
+
constructor(params: ResponseParams, buffer: Uint8Array);
|
|
49
|
+
static serialize(item: EndpointResponsePacket): Uint8Array;
|
|
50
|
+
static deserialize(item: Uint8Array): EndpointResponsePacket;
|
|
51
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Omu } from '../omu.js';
|
|
2
|
+
import type { Extension, ExtensionType } from './extension.js';
|
|
3
|
+
export declare class ExtensionRegistry {
|
|
4
|
+
private readonly omu;
|
|
5
|
+
private readonly extensionMap;
|
|
6
|
+
constructor(omu: Omu);
|
|
7
|
+
register<T extends Extension>(type: ExtensionType<T>): T;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Identifier } from '../identifier';
|
|
2
|
+
import { Omu } from '../omu';
|
|
3
|
+
export interface Extension {
|
|
4
|
+
readonly type: ExtensionType;
|
|
5
|
+
}
|
|
6
|
+
export declare class ExtensionType<T extends Extension = Extension> extends Identifier {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly create: (omu: Omu) => T;
|
|
9
|
+
constructor(name: string, create: (omu: Omu) => T);
|
|
10
|
+
key(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Identifier } from '../../identifier';
|
|
2
|
+
import { Omu } from '../../omu';
|
|
3
|
+
import { Extension, ExtensionType } from '../extension';
|
|
4
|
+
import { OmuResponse, RequestHandle } from './http';
|
|
5
|
+
import { OmuWS } from './websocket';
|
|
6
|
+
export declare const HTTP_EXTENSION_TYPE: ExtensionType<HttpExtension>;
|
|
7
|
+
export declare const HTTP_REQUEST_PERMISSION_ID: Identifier;
|
|
8
|
+
type HttpResponse = RequestHandle & {
|
|
9
|
+
header: Record<string, string>;
|
|
10
|
+
status: number;
|
|
11
|
+
statusText: string;
|
|
12
|
+
url: string;
|
|
13
|
+
history: HttpResponse[];
|
|
14
|
+
redirected: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare class HttpExtension implements Extension {
|
|
17
|
+
private readonly omu;
|
|
18
|
+
readonly type: ExtensionType<Extension>;
|
|
19
|
+
private requestCount;
|
|
20
|
+
private readonly httpHandles;
|
|
21
|
+
private readonly wsHandles;
|
|
22
|
+
private readonly wsSendQueue;
|
|
23
|
+
private wsSendWaitResolve;
|
|
24
|
+
constructor(omu: Omu);
|
|
25
|
+
private wsSendLoop;
|
|
26
|
+
private generateHeaders;
|
|
27
|
+
private generateId;
|
|
28
|
+
request(input: string | URL | globalThis.Request, init?: RequestInit): Promise<{
|
|
29
|
+
response: HttpResponse;
|
|
30
|
+
stream: ReadableStream;
|
|
31
|
+
}>;
|
|
32
|
+
fetch(input: string | URL | globalThis.Request, init?: RequestInit): Promise<OmuResponse>;
|
|
33
|
+
ws(input: string | URL | globalThis.Request, options?: {
|
|
34
|
+
method?: string;
|
|
35
|
+
autoclose?: boolean;
|
|
36
|
+
autoping?: boolean;
|
|
37
|
+
params?: Record<string, string>;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
}): Promise<OmuWS>;
|
|
40
|
+
}
|
|
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,125 @@
|
|
|
1
|
+
import { DataChunk, RequestHandle } from './http';
|
|
2
|
+
export type WSData = string | ArrayBufferLike | Blob | ArrayBufferView;
|
|
3
|
+
export declare const WSMsgType: {
|
|
4
|
+
readonly CONTINUATION: 0;
|
|
5
|
+
readonly TEXT: 1;
|
|
6
|
+
readonly BINARY: 2;
|
|
7
|
+
readonly PING: 9;
|
|
8
|
+
readonly PONG: 10;
|
|
9
|
+
readonly CLOSE: 8;
|
|
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> = {
|
|
39
|
+
[K in keyof T]: ((event: T[K]) => unknown)[];
|
|
40
|
+
};
|
|
41
|
+
export type WSMsg = {
|
|
42
|
+
type: 'open';
|
|
43
|
+
data: WebSocketOpen;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'error';
|
|
46
|
+
data: WebSocketError;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'text';
|
|
49
|
+
data: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'binary';
|
|
52
|
+
data: Uint8Array;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'close';
|
|
55
|
+
data: WebSocketClose;
|
|
56
|
+
};
|
|
57
|
+
export 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
|
+
export type WSDataMeta = {
|
|
65
|
+
id: string;
|
|
66
|
+
type: typeof WSMsgType.TEXT | typeof WSMsgType.BINARY | typeof WSMsgType.PING | typeof WSMsgType.PONG;
|
|
67
|
+
};
|
|
68
|
+
export type WSHandleState = {
|
|
69
|
+
type: 'created' | 'receiving';
|
|
70
|
+
handle: WebSocketHandle;
|
|
71
|
+
};
|
|
72
|
+
type WSOptions = {
|
|
73
|
+
addQueue: (data: WSData) => void;
|
|
74
|
+
dispose(options: {
|
|
75
|
+
code?: number;
|
|
76
|
+
reason?: string;
|
|
77
|
+
}): void;
|
|
78
|
+
};
|
|
79
|
+
export declare class OmuWS {
|
|
80
|
+
protected readonly addQueue: (data: WSData) => void;
|
|
81
|
+
protected readonly dispose: (options: {
|
|
82
|
+
code?: number;
|
|
83
|
+
reason?: string;
|
|
84
|
+
}) => void;
|
|
85
|
+
protected readonly receiveQueue: WSMsg[];
|
|
86
|
+
private receiveResolve;
|
|
87
|
+
private status;
|
|
88
|
+
constructor(addQueue: (data: WSData) => void, dispose: (options: {
|
|
89
|
+
code?: number;
|
|
90
|
+
reason?: string;
|
|
91
|
+
}) => void, receiveQueue?: WSMsg[], receiveResolve?: (() => void) | undefined, status?: 'connecting' | 'open' | 'closed');
|
|
92
|
+
toWebSocket(): OmuWebSocket;
|
|
93
|
+
static create(options: WSOptions): WebSocketHandle;
|
|
94
|
+
send(data: WSData): void;
|
|
95
|
+
close(code?: number, reason?: string): void;
|
|
96
|
+
receive(): Promise<WSMsg>;
|
|
97
|
+
protocol: string;
|
|
98
|
+
url: string;
|
|
99
|
+
}
|
|
100
|
+
export declare class OmuWebSocket implements WebSocket {
|
|
101
|
+
protected readonly ws: OmuWS;
|
|
102
|
+
private readonly eventListeners;
|
|
103
|
+
CONNECTING: 0;
|
|
104
|
+
OPEN: 1;
|
|
105
|
+
CLOSING: 2;
|
|
106
|
+
CLOSED: 3;
|
|
107
|
+
binaryType: BinaryType;
|
|
108
|
+
bufferedAmount: number;
|
|
109
|
+
extensions: string;
|
|
110
|
+
onclose: ((this: WebSocket, ev: CloseEvent) => unknown) | null;
|
|
111
|
+
onerror: ((this: WebSocket, ev: Event) => unknown) | null;
|
|
112
|
+
onmessage: ((this: WebSocket, ev: MessageEvent) => unknown) | null;
|
|
113
|
+
onopen: ((this: WebSocket, ev: Event) => unknown) | null;
|
|
114
|
+
protocol: string;
|
|
115
|
+
readyState: 0 | 2 | 1 | 3;
|
|
116
|
+
url: string;
|
|
117
|
+
constructor(ws: OmuWS, eventListeners?: EventListenerMap<WebSocketEventMap>);
|
|
118
|
+
private receiveLoop;
|
|
119
|
+
dispatchEvent(event: Event): boolean;
|
|
120
|
+
send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
121
|
+
close(code?: number, reason?: string): void;
|
|
122
|
+
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => unknown): void;
|
|
123
|
+
removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => unknown): void;
|
|
124
|
+
}
|
|
125
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Identifier } from '../../identifier';
|
|
2
|
+
import type { Locale } from '../../localization/locale.js';
|
|
3
|
+
import type { LocalizedText } from '../../localization/localization.js';
|
|
4
|
+
import { Omu } from '../../omu';
|
|
5
|
+
import type { Extension } from '../extension.js';
|
|
6
|
+
import { ExtensionType } from '../extension.js';
|
|
7
|
+
import { type Registry } from '../registry';
|
|
8
|
+
export declare const I18N_EXTENSION_TYPE: ExtensionType<I18nExtension>;
|
|
9
|
+
export declare const I18N_SET_LOCALES_PERMISSION_ID: Identifier;
|
|
10
|
+
export declare const I18N_GET_LOCALES_PERMISSION_ID: Identifier;
|
|
11
|
+
export declare class I18nExtension implements Extension {
|
|
12
|
+
private readonly omu;
|
|
13
|
+
readonly type: ExtensionType<I18nExtension>;
|
|
14
|
+
readonly localesRegistry: Registry<Locale[]>;
|
|
15
|
+
constructor(omu: Omu);
|
|
16
|
+
translate(localizedText: LocalizedText): string;
|
|
17
|
+
selectBestTranslation(locales: readonly Locale[], localizedText: LocalizedText): string | undefined;
|
|
18
|
+
setLocale(locale: Locale[]): Promise<void>;
|
|
19
|
+
}
|