@omujs/omu 0.9.40 → 0.9.42
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 +16 -0
- package/dist/dts/api/asset/extension.d.ts +1 -1
- package/dist/dts/api/dashboard/extension.d.ts +13 -31
- package/dist/dts/api/http/index.d.ts +2 -1
- package/dist/dts/api/registry/registry.d.ts +1 -1
- package/dist/dts/api/server/extension.d.ts +7 -1
- package/dist/dts/api/session/extension.d.ts +6 -5
- package/dist/dts/identifier.d.ts +1 -0
- package/dist/dts/index.d.ts +2 -1
- package/dist/dts/network/network.d.ts +2 -2
- package/dist/dts/omu.d.ts +3 -3
- package/dist/dts/result.d.ts +41 -0
- package/dist/dts/token.d.ts +4 -5
- package/dist/dts/version.d.ts +1 -1
- package/dist/esm/api/asset/extension.js +10 -7
- package/dist/esm/api/asset/index.js +10 -7
- package/dist/esm/api/dashboard/extension.js +140 -76
- package/dist/esm/api/dashboard/index.js +140 -75
- package/dist/esm/api/endpoint/endpoint.js +5 -2
- package/dist/esm/api/endpoint/extension.js +5 -2
- package/dist/esm/api/endpoint/index.js +5 -2
- package/dist/esm/api/endpoint/packets.js +5 -2
- package/dist/esm/api/extension.js +5 -2
- package/dist/esm/api/http/extension.js +5 -2
- package/dist/esm/api/http/index.js +6 -2
- package/dist/esm/api/i18n/extension.js +10 -7
- package/dist/esm/api/i18n/index.js +10 -7
- package/dist/esm/api/index.js +5 -2
- package/dist/esm/api/logger/extension.js +5 -2
- package/dist/esm/api/logger/index.js +5 -2
- package/dist/esm/api/logger/packets.js +5 -2
- package/dist/esm/api/permission/extension.js +5 -2
- package/dist/esm/api/permission/index.js +5 -2
- package/dist/esm/api/permission/permission.js +5 -2
- package/dist/esm/api/plugin/extension.js +5 -2
- package/dist/esm/api/plugin/index.js +5 -2
- package/dist/esm/api/registry/extension.js +10 -7
- package/dist/esm/api/registry/index.js +10 -7
- package/dist/esm/api/registry/packets.js +5 -2
- package/dist/esm/api/registry/registry.js +5 -2
- package/dist/esm/api/server/extension.js +25 -9
- package/dist/esm/api/server/index.js +25 -9
- package/dist/esm/api/session/extension.js +28 -17
- package/dist/esm/api/session/index.js +28 -17
- package/dist/esm/api/signal/extension.js +7 -4
- package/dist/esm/api/signal/index.js +5 -2
- package/dist/esm/api/signal/packets.js +5 -2
- package/dist/esm/api/signal/signal.js +5 -2
- package/dist/esm/api/table/extension.js +7 -4
- package/dist/esm/api/table/index.js +7 -4
- package/dist/esm/api/table/packets.js +5 -2
- package/dist/esm/api/table/table.js +5 -2
- package/dist/esm/app.js +5 -2
- package/dist/esm/errors.js +5 -2
- package/dist/esm/identifier.js +5 -2
- package/dist/esm/index.js +3441 -3333
- package/dist/esm/network/connection.js +5 -2
- package/dist/esm/network/encryption.js +5 -2
- package/dist/esm/network/index.js +6 -3
- package/dist/esm/network/network.js +6 -3
- package/dist/esm/network/packet/index.js +5 -2
- package/dist/esm/network/packet/packet-types.js +5 -2
- package/dist/esm/omu.js +176 -106
- package/dist/esm/result.js +68 -0
- package/dist/esm/token.js +7 -10
- package/dist/esm/version.js +3 -3
- package/package.json +1 -1
- package/src/api/asset/extension.ts +6 -6
- package/src/api/dashboard/extension.ts +105 -94
- package/src/api/http/index.ts +2 -1
- package/src/api/registry/extension.ts +6 -6
- package/src/api/registry/registry.ts +1 -1
- package/src/api/server/extension.ts +20 -1
- package/src/api/session/extension.ts +21 -12
- package/src/api/signal/extension.ts +2 -2
- package/src/api/table/extension.ts +2 -2
- package/src/identifier.ts +4 -0
- package/src/index.ts +2 -1
- package/src/network/network.ts +2 -2
- package/src/omu.ts +4 -4
- package/src/result.ts +78 -0
- package/src/token.ts +5 -9
- package/src/version.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.42 (2025-11-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @omujs/omu
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 0.9.41 (2025-11-19)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @omujs/omu
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## 0.9.40 (2025-11-19)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @omujs/omu
|
|
@@ -3,7 +3,7 @@ import { Omu } from "../../omu";
|
|
|
3
3
|
import { ExtensionType } from "../extension.js";
|
|
4
4
|
export declare const ASSET_EXTENSION_TYPE: ExtensionType<AssetExtension>;
|
|
5
5
|
export type Asset = {
|
|
6
|
-
|
|
6
|
+
id: Identifier;
|
|
7
7
|
buffer: Uint8Array;
|
|
8
8
|
};
|
|
9
9
|
export declare const ASSET_PERMISSION_ID: Identifier;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { App, AppJson } from "../../app.js";
|
|
2
2
|
import { Identifier } from "../../identifier";
|
|
3
3
|
import { Omu } from "../../omu.js";
|
|
4
|
+
import { PromiseResult } from "../../result.js";
|
|
4
5
|
import { ExtensionType } from "../extension.js";
|
|
5
6
|
import { PermissionTypeJson } from "../permission/permission.js";
|
|
6
7
|
import { PackageInfo } from "../plugin/package-info.js";
|
|
@@ -29,10 +30,10 @@ export type Cookie = {
|
|
|
29
30
|
};
|
|
30
31
|
export type WebviewRequest = {
|
|
31
32
|
url: string;
|
|
32
|
-
script
|
|
33
|
+
script?: string;
|
|
33
34
|
};
|
|
34
35
|
export type WebviewPacket = {
|
|
35
|
-
id:
|
|
36
|
+
id: string;
|
|
36
37
|
};
|
|
37
38
|
export type UserResponse<T = undefined> = {
|
|
38
39
|
type: "ok";
|
|
@@ -42,26 +43,10 @@ export type UserResponse<T = undefined> = {
|
|
|
42
43
|
} | {
|
|
43
44
|
type: "cancelled";
|
|
44
45
|
};
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} | {
|
|
50
|
-
type: "blocked";
|
|
51
|
-
} | {
|
|
52
|
-
type: "cancelled";
|
|
53
|
-
};
|
|
54
|
-
constructor(result: {
|
|
55
|
-
type: "ok";
|
|
56
|
-
value: T;
|
|
57
|
-
} | {
|
|
58
|
-
type: "blocked";
|
|
59
|
-
} | {
|
|
60
|
-
type: "cancelled";
|
|
61
|
-
});
|
|
62
|
-
unwrap(): T;
|
|
63
|
-
}
|
|
64
|
-
export type WebviewResponse = UserResponse & WebviewPacket;
|
|
46
|
+
export type UserError = Exclude<UserResponse, {
|
|
47
|
+
type: "ok";
|
|
48
|
+
}>;
|
|
49
|
+
export type WebviewResponse = UserResponse<WebviewPacket>;
|
|
65
50
|
export declare const DASHBOARD_WEBVIEW_PERMISSION_ID: Identifier;
|
|
66
51
|
export type HostRequest = {
|
|
67
52
|
host: string;
|
|
@@ -92,11 +77,11 @@ export type WebviewEventPacket = {
|
|
|
92
77
|
export type WebviewHandle = {
|
|
93
78
|
readonly id: Identifier;
|
|
94
79
|
readonly url: string;
|
|
95
|
-
getCookies():
|
|
96
|
-
close(): void;
|
|
80
|
+
getCookies(): PromiseResult<Cookie[], UserError>;
|
|
97
81
|
on<T extends WebviewEvent["type"]>(key: T, callback: (event: Extract<WebviewEvent, {
|
|
98
82
|
type: T;
|
|
99
83
|
}>) => void): void;
|
|
84
|
+
close(): Promise<void>;
|
|
100
85
|
join(): Promise<void>;
|
|
101
86
|
};
|
|
102
87
|
export type WebviewEventEmit = <T extends WebviewEvent["type"]>(event: Extract<WebviewEvent, {
|
|
@@ -184,16 +169,13 @@ export declare class DashboardExtension {
|
|
|
184
169
|
private handleDragDropReadRequest;
|
|
185
170
|
private getDashboard;
|
|
186
171
|
set(dashboard: DashboardHandler): void;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}): Promise<UserResponse>;
|
|
190
|
-
requestWebview(options: WebviewRequest): Promise<UserResult<WebviewHandle>>;
|
|
191
|
-
getCookies(options: GetCookiesRequest): Promise<UserResult<Cookie[]>>;
|
|
172
|
+
requestWebview(options: WebviewRequest): PromiseResult<WebviewHandle, UserError>;
|
|
173
|
+
getCookies(options: GetCookiesRequest): PromiseResult<Cookie[], UserError>;
|
|
192
174
|
openApp(app: App): Promise<void>;
|
|
193
175
|
installApp(app: App): Promise<AppInstallResponse>;
|
|
194
176
|
clearBlockedPrompts(): Promise<null>;
|
|
195
|
-
|
|
177
|
+
requestDragDrop(): Promise<DragDropHandler>;
|
|
196
178
|
notifyDropDragState(packet: FileDragPacket): Promise<void>;
|
|
197
|
-
|
|
179
|
+
requestSpeechRecognition(): PromiseResult<Registry<TranscriptStatus>, UserError>;
|
|
198
180
|
}
|
|
199
181
|
export {};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { HTTP_REQUEST_PERMISSION_ID
|
|
1
|
+
export { HTTP_REQUEST_PERMISSION_ID } from "./extension";
|
|
2
|
+
export { OmuWS, type WSMsg } from "./websocket";
|
|
@@ -39,7 +39,7 @@ export interface Registry<T> {
|
|
|
39
39
|
get(): Promise<T>;
|
|
40
40
|
set(value: T): Promise<void>;
|
|
41
41
|
update(fn: (value: T) => PromiseLike<T> | T): Promise<T>;
|
|
42
|
-
modify(fn: (value: T) => PromiseLike<
|
|
42
|
+
modify(fn: (value: T) => PromiseLike<void> | void): Promise<T>;
|
|
43
43
|
listen(fn: (value: T) => void): Unlisten;
|
|
44
44
|
compatSvelte(): Writable<T>;
|
|
45
45
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App, AppJson } from "../../app.js";
|
|
2
|
-
import { Identifier, IdentifierMap } from "../../identifier";
|
|
2
|
+
import { Identifier, IdentifierMap, IntoId } from "../../identifier";
|
|
3
3
|
import { LocalizedText } from "../../localization/localization.js";
|
|
4
4
|
import { Omu } from "../../omu.js";
|
|
5
5
|
import { ExtensionType, type Extension } from "../extension.js";
|
|
@@ -51,5 +51,11 @@ export declare class AppIndexRegistry {
|
|
|
51
51
|
apps: IdentifierMap<App>;
|
|
52
52
|
meta: AppIndexRegistryMeta | undefined;
|
|
53
53
|
constructor(id: Identifier, apps: IdentifierMap<App>, meta: AppIndexRegistryMeta | undefined);
|
|
54
|
+
static build(options: {
|
|
55
|
+
id: IntoId;
|
|
56
|
+
meta: AppIndexRegistryMeta;
|
|
57
|
+
apps: App[];
|
|
58
|
+
}): AppIndexRegistry;
|
|
54
59
|
static fromJSON(json: AppIndexRegistryJSON): AppIndexRegistry;
|
|
60
|
+
toJSON(): AppIndexRegistryJSON;
|
|
55
61
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { App } from "../../app";
|
|
2
2
|
import { Identifier, IntoId } from "../../identifier";
|
|
3
3
|
import { Omu } from "../../omu";
|
|
4
|
+
import { SessionParam } from "../../token";
|
|
4
5
|
import { Extension, ExtensionType } from "../extension";
|
|
5
6
|
import { SessionObserver } from "../server/extension";
|
|
6
7
|
import { Table } from "../table";
|
|
@@ -31,9 +32,9 @@ export declare class SessionExtension implements Extension {
|
|
|
31
32
|
private readonly requiredApps;
|
|
32
33
|
constructor(omu: Omu);
|
|
33
34
|
has(id: IntoId): Promise<boolean>;
|
|
34
|
-
observe(appId: IntoId,
|
|
35
|
-
onConnect(app: App): void;
|
|
36
|
-
onDisconnect(app: App): void;
|
|
35
|
+
observe(appId: IntoId, options?: {
|
|
36
|
+
onConnect?(app: App): void;
|
|
37
|
+
onDisconnect?(app: App): void;
|
|
37
38
|
}): SessionObserver;
|
|
38
39
|
private handleSessionConnect;
|
|
39
40
|
private handleSessionDisconnect;
|
|
@@ -46,6 +47,6 @@ export declare class SessionExtension implements Extension {
|
|
|
46
47
|
}): Promise<RequestRemoteAppResponse>;
|
|
47
48
|
generateToken(options: {
|
|
48
49
|
app: App;
|
|
49
|
-
permissions
|
|
50
|
-
}): Promise<
|
|
50
|
+
permissions?: IntoId[];
|
|
51
|
+
}): Promise<SessionParam>;
|
|
51
52
|
}
|
package/dist/dts/identifier.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class Identifier {
|
|
|
14
14
|
static fromKey(key: string): Identifier;
|
|
15
15
|
static fromUrl(url: string | URL): Identifier;
|
|
16
16
|
static namespaceFromUrl(url: string | URL): string;
|
|
17
|
+
get base(): Identifier;
|
|
17
18
|
toJson(): string;
|
|
18
19
|
static fromJson(json: string): Identifier;
|
|
19
20
|
key(): string;
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AppIndexRegistry, type AppIndexRegistryJSON } from "./api/server";
|
|
1
2
|
export { App, AppMetadata } from "./app.js";
|
|
2
3
|
export { DisconnectReason } from "./errors.js";
|
|
3
4
|
export { Identifier, IdentifierMap, IdentifierSet, IntoId } from "./identifier";
|
|
@@ -5,7 +6,7 @@ export * as network from "./network";
|
|
|
5
6
|
export { Omu } from "./omu.js";
|
|
6
7
|
export { Serializer } from "./serialize";
|
|
7
8
|
export type { Serializable } from "./serialize";
|
|
8
|
-
export {
|
|
9
|
+
export { BrowserSession, type SessionParam, type SessioTokenProvider as TokenProvider } from "./token";
|
|
9
10
|
import { Identifier } from "./identifier";
|
|
10
11
|
export declare const OmuPermissions: {
|
|
11
12
|
readonly ASSET_PERMISSION_ID: Identifier;
|
|
@@ -2,7 +2,7 @@ import type { Address } from "../address.js";
|
|
|
2
2
|
import { DisconnectReason } from "../errors.js";
|
|
3
3
|
import { EventEmitter } from "../event";
|
|
4
4
|
import { Omu } from "../omu.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { SessioTokenProvider } from "../token.js";
|
|
6
6
|
import type { Connection, Transport } from "./connection.js";
|
|
7
7
|
import { AES } from "./encryption.js";
|
|
8
8
|
import type { Packet, PacketType } from "./packet/packet.js";
|
|
@@ -40,7 +40,7 @@ export declare class Network {
|
|
|
40
40
|
private listenTask;
|
|
41
41
|
reason: DisconnectReason | undefined;
|
|
42
42
|
private attempt;
|
|
43
|
-
constructor(omu: Omu, address: Address, tokenProvider:
|
|
43
|
+
constructor(omu: Omu, address: Address, tokenProvider: SessioTokenProvider, transport: Transport, connection?: Connection | undefined, aes?: AES | undefined);
|
|
44
44
|
setConnection(connection: Connection): void;
|
|
45
45
|
registerPacket(...packetTypes: PacketType<unknown>[]): void;
|
|
46
46
|
addPacketHandler<T>(type: PacketType<T>, handler: (packet: T) => void): void;
|
package/dist/dts/omu.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { Address, Connection } from "./network";
|
|
|
19
19
|
import { Network } from "./network";
|
|
20
20
|
import { Transport } from "./network/connection.js";
|
|
21
21
|
import type { PacketType } from "./network/packet/packet.js";
|
|
22
|
-
import { type
|
|
22
|
+
import { type SessioTokenProvider } from "./token.js";
|
|
23
23
|
export type ClientEvents = {
|
|
24
24
|
started: EventEmitter<[]>;
|
|
25
25
|
stopped: EventEmitter<[]>;
|
|
@@ -30,7 +30,7 @@ export declare class Omu {
|
|
|
30
30
|
ready: boolean;
|
|
31
31
|
running: boolean;
|
|
32
32
|
readonly event: ClientEvents;
|
|
33
|
-
readonly token:
|
|
33
|
+
readonly token: SessioTokenProvider;
|
|
34
34
|
readonly address: Address;
|
|
35
35
|
readonly sessions: SessionExtension;
|
|
36
36
|
readonly network: Network;
|
|
@@ -49,7 +49,7 @@ export declare class Omu {
|
|
|
49
49
|
readonly http: HttpExtension;
|
|
50
50
|
constructor(app: App, options?: {
|
|
51
51
|
address?: Address;
|
|
52
|
-
token?:
|
|
52
|
+
token?: SessioTokenProvider | string;
|
|
53
53
|
transport?: Transport;
|
|
54
54
|
connection?: Connection;
|
|
55
55
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type Success<T> = {
|
|
2
|
+
data: T;
|
|
3
|
+
error: null;
|
|
4
|
+
};
|
|
5
|
+
export type Failure<E> = {
|
|
6
|
+
data: null;
|
|
7
|
+
error: E;
|
|
8
|
+
};
|
|
9
|
+
export type Result<
|
|
10
|
+
T,
|
|
11
|
+
E = Error
|
|
12
|
+
> = Success<T> | Failure<E>;
|
|
13
|
+
export declare function tryCatch<
|
|
14
|
+
T,
|
|
15
|
+
E = Error
|
|
16
|
+
>(promise: Promise<T>): Promise<Result<T, E>>;
|
|
17
|
+
export declare function success<T>(data: T): Result<T>;
|
|
18
|
+
export declare function failure<E>(error: E): Result<null, E>;
|
|
19
|
+
export declare class PromiseResult<
|
|
20
|
+
T,
|
|
21
|
+
E = Error
|
|
22
|
+
> implements Promise<T> {
|
|
23
|
+
private readonly promise;
|
|
24
|
+
private constructor();
|
|
25
|
+
static create<
|
|
26
|
+
T,
|
|
27
|
+
E = Error
|
|
28
|
+
>(): {
|
|
29
|
+
promise: PromiseResult<T, E>;
|
|
30
|
+
resolve: (value: T) => void;
|
|
31
|
+
reject: (error: E) => void;
|
|
32
|
+
};
|
|
33
|
+
then<
|
|
34
|
+
TResult1 = T,
|
|
35
|
+
TResult2 = never
|
|
36
|
+
>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: E) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
37
|
+
catch<TResult = never>(onrejected?: ((reason: E) => TResult | PromiseLike<TResult>) | null | undefined): Promise<T | TResult>;
|
|
38
|
+
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
|
|
39
|
+
[Symbol.toStringTag]: string;
|
|
40
|
+
toResult(): Promise<Result<T, E>>;
|
|
41
|
+
}
|
package/dist/dts/token.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { Address } from "./address.js";
|
|
2
2
|
import type { App } from "./app.js";
|
|
3
|
-
export interface
|
|
3
|
+
export interface SessioTokenProvider {
|
|
4
4
|
get(serverAddress: Address, app: App): Promise<string | undefined>;
|
|
5
5
|
}
|
|
6
6
|
export type SessionParam = {
|
|
7
7
|
address: Address;
|
|
8
8
|
token: string;
|
|
9
9
|
};
|
|
10
|
-
export declare class
|
|
11
|
-
static readonly
|
|
12
|
-
|
|
13
|
-
get(address: Address, app: App): Promise<string | undefined>;
|
|
10
|
+
export declare class BrowserSession implements SessioTokenProvider {
|
|
11
|
+
static readonly PARAM_NAME = "_omu_session";
|
|
12
|
+
get(address: Address): Promise<string | undefined>;
|
|
14
13
|
private parseParamSession;
|
|
15
14
|
}
|
package/dist/dts/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.9.
|
|
1
|
+
export declare const VERSION = "0.9.42";
|
|
2
2
|
export declare const VERSION_MINOR = "0.9.0";
|