@omujs/omu 0.9.42 → 0.9.47
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 +43 -0
- package/package.json +1 -1
- package/src/api/dashboard/extension.ts +42 -42
- package/src/api/dashboard/handler.ts +1 -1
- package/src/api/registry/extension.ts +109 -23
- package/src/network/network.ts +5 -0
- package/src/omu.ts +1 -0
- package/src/serialize/bytebuffer.ts +8 -0
- package/src/version.ts +1 -1
- package/dist/dts/address.d.ts +0 -6
- package/dist/dts/api/asset/extension.d.ts +0 -25
- package/dist/dts/api/asset/index.d.ts +0 -2
- package/dist/dts/api/dashboard/extension.d.ts +0 -181
- package/dist/dts/api/dashboard/handler.d.ts +0 -22
- package/dist/dts/api/dashboard/index.d.ts +0 -3
- package/dist/dts/api/dashboard/packets.d.ts +0 -73
- package/dist/dts/api/endpoint/endpoint.d.ts +0 -32
- package/dist/dts/api/endpoint/extension.d.ts +0 -23
- package/dist/dts/api/endpoint/index.d.ts +0 -2
- package/dist/dts/api/endpoint/packets.d.ts +0 -51
- package/dist/dts/api/extension-registry.d.ts +0 -8
- package/dist/dts/api/extension.d.ts +0 -11
- package/dist/dts/api/http/extension.d.ts +0 -41
- package/dist/dts/api/http/http.d.ts +0 -36
- package/dist/dts/api/http/index.d.ts +0 -2
- package/dist/dts/api/http/websocket.d.ts +0 -123
- package/dist/dts/api/i18n/extension.d.ts +0 -19
- package/dist/dts/api/i18n/index.d.ts +0 -1
- package/dist/dts/api/index.d.ts +0 -2
- package/dist/dts/api/logger/extension.d.ts +0 -25
- package/dist/dts/api/logger/index.d.ts +0 -1
- package/dist/dts/api/logger/packets.d.ts +0 -18
- package/dist/dts/api/permission/extension.d.ts +0 -19
- package/dist/dts/api/permission/index.d.ts +0 -1
- package/dist/dts/api/permission/permission.d.ts +0 -25
- package/dist/dts/api/plugin/extension.d.ts +0 -43
- package/dist/dts/api/plugin/index.d.ts +0 -2
- package/dist/dts/api/plugin/package-info.d.ts +0 -84
- package/dist/dts/api/registry/extension.d.ts +0 -26
- package/dist/dts/api/registry/index.d.ts +0 -2
- package/dist/dts/api/registry/packets.d.ts +0 -20
- package/dist/dts/api/registry/registry.d.ts +0 -57
- package/dist/dts/api/server/extension.d.ts +0 -61
- package/dist/dts/api/server/index.d.ts +0 -1
- package/dist/dts/api/session/extension.d.ts +0 -52
- package/dist/dts/api/session/index.d.ts +0 -1
- package/dist/dts/api/signal/extension.d.ts +0 -22
- package/dist/dts/api/signal/index.d.ts +0 -1
- package/dist/dts/api/signal/packets.d.ts +0 -21
- package/dist/dts/api/signal/signal.d.ts +0 -33
- package/dist/dts/api/table/extension.d.ts +0 -29
- package/dist/dts/api/table/index.d.ts +0 -2
- package/dist/dts/api/table/packets.d.ts +0 -65
- package/dist/dts/api/table/table.d.ts +0 -76
- package/dist/dts/app.d.ts +0 -49
- package/dist/dts/const.d.ts +0 -2
- package/dist/dts/errors.d.ts +0 -36
- package/dist/dts/event/index.d.ts +0 -6
- package/dist/dts/helper.d.ts +0 -13
- package/dist/dts/identifier.d.ts +0 -51
- package/dist/dts/index.d.ts +0 -36
- package/dist/dts/localization/index.d.ts +0 -2
- package/dist/dts/localization/locale.d.ts +0 -735
- package/dist/dts/localization/localization.d.ts +0 -5
- package/dist/dts/lock.d.ts +0 -6
- package/dist/dts/network/connection.d.ts +0 -17
- package/dist/dts/network/encryption.d.ts +0 -38
- package/dist/dts/network/frame-transport.d.ts +0 -22
- package/dist/dts/network/index.d.ts +0 -5
- package/dist/dts/network/network.d.ts +0 -58
- package/dist/dts/network/packet/index.d.ts +0 -2
- package/dist/dts/network/packet/packet-types.d.ts +0 -84
- package/dist/dts/network/packet/packet.d.ts +0 -28
- package/dist/dts/network/websocket-transport.d.ts +0 -24
- package/dist/dts/omu.d.ts +0 -61
- package/dist/dts/result.d.ts +0 -41
- package/dist/dts/serialize/bytebuffer.d.ts +0 -71
- package/dist/dts/serialize/index.d.ts +0 -2
- package/dist/dts/serialize/serializer.d.ts +0 -38
- package/dist/dts/token.d.ts +0 -14
- package/dist/dts/version.d.ts +0 -2
- package/dist/esm/address.js +0 -4
- package/dist/esm/api/asset/extension.js +0 -905
- package/dist/esm/api/asset/index.js +0 -903
- package/dist/esm/api/dashboard/extension.js +0 -1355
- package/dist/esm/api/dashboard/handler.js +0 -4
- package/dist/esm/api/dashboard/index.js +0 -1354
- package/dist/esm/api/dashboard/packets.js +0 -413
- package/dist/esm/api/endpoint/endpoint.js +0 -383
- package/dist/esm/api/endpoint/extension.js +0 -1090
- package/dist/esm/api/endpoint/index.js +0 -383
- package/dist/esm/api/endpoint/packets.js +0 -793
- package/dist/esm/api/extension-registry.js +0 -23
- package/dist/esm/api/extension.js +0 -278
- package/dist/esm/api/http/extension.js +0 -1414
- package/dist/esm/api/http/http.js +0 -442
- package/dist/esm/api/http/index.js +0 -1413
- package/dist/esm/api/http/websocket.js +0 -220
- package/dist/esm/api/i18n/extension.js +0 -1270
- package/dist/esm/api/i18n/index.js +0 -1268
- package/dist/esm/api/index.js +0 -295
- package/dist/esm/api/logger/extension.js +0 -850
- package/dist/esm/api/logger/index.js +0 -846
- package/dist/esm/api/logger/packets.js +0 -667
- package/dist/esm/api/permission/extension.js +0 -535
- package/dist/esm/api/permission/index.js +0 -294
- package/dist/esm/api/permission/permission.js +0 -294
- package/dist/esm/api/plugin/extension.js +0 -531
- package/dist/esm/api/plugin/index.js +0 -529
- package/dist/esm/api/plugin/package-info.js +0 -4
- package/dist/esm/api/registry/extension.js +0 -1217
- package/dist/esm/api/registry/index.js +0 -1216
- package/dist/esm/api/registry/packets.js +0 -688
- package/dist/esm/api/registry/registry.js +0 -383
- package/dist/esm/api/server/extension.js +0 -2071
- package/dist/esm/api/server/index.js +0 -2049
- package/dist/esm/api/session/extension.js +0 -2166
- package/dist/esm/api/session/index.js +0 -2166
- package/dist/esm/api/signal/extension.js +0 -1025
- package/dist/esm/api/signal/index.js +0 -379
- package/dist/esm/api/signal/packets.js +0 -684
- package/dist/esm/api/signal/signal.js +0 -379
- package/dist/esm/api/table/extension.js +0 -1547
- package/dist/esm/api/table/index.js +0 -1546
- package/dist/esm/api/table/packets.js +0 -898
- package/dist/esm/api/table/table.js +0 -383
- package/dist/esm/app.js +0 -264
- package/dist/esm/const.js +0 -11
- package/dist/esm/errors.js +0 -548
- package/dist/esm/event/index.js +0 -22
- package/dist/esm/helper.js +0 -15
- package/dist/esm/identifier.js +0 -266
- package/dist/esm/index.js +0 -5111
- package/dist/esm/localization/index.js +0 -742
- package/dist/esm/localization/locale.js +0 -742
- package/dist/esm/localization/localization.js +0 -4
- package/dist/esm/lock.js +0 -46
- package/dist/esm/network/connection.js +0 -293
- package/dist/esm/network/encryption.js +0 -980
- package/dist/esm/network/frame-transport.js +0 -525
- package/dist/esm/network/index.js +0 -1617
- package/dist/esm/network/network.js +0 -1358
- package/dist/esm/network/packet/index.js +0 -485
- package/dist/esm/network/packet/packet-types.js +0 -486
- package/dist/esm/network/packet/packet.js +0 -126
- package/dist/esm/network/websocket-transport.js +0 -487
- package/dist/esm/omu.js +0 -4870
- package/dist/esm/result.js +0 -68
- package/dist/esm/serialize/bytebuffer.js +0 -378
- package/dist/esm/serialize/index.js +0 -465
- package/dist/esm/serialize/serializer.js +0 -97
- package/dist/esm/token.js +0 -42
- package/dist/esm/version.js +0 -11
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Identifier } from "../../identifier";
|
|
2
|
-
import { Omu } from "../../omu";
|
|
3
|
-
import { JsonType, Serializer } from "../../serialize";
|
|
4
|
-
import { type Extension, ExtensionType } from "../extension.js";
|
|
5
|
-
import { type Registry, RegistryType } from "./registry.js";
|
|
6
|
-
export declare class RegistryExtension implements Extension {
|
|
7
|
-
private readonly omu;
|
|
8
|
-
readonly type: ExtensionType<RegistryExtension>;
|
|
9
|
-
private readonly registries;
|
|
10
|
-
constructor(omu: Omu);
|
|
11
|
-
private createRegistry;
|
|
12
|
-
get<T>(registryType: RegistryType<T>): Registry<T>;
|
|
13
|
-
json<
|
|
14
|
-
T,
|
|
15
|
-
D extends JsonType = JsonType
|
|
16
|
-
>(name: string, options: {
|
|
17
|
-
default: T;
|
|
18
|
-
serializer?: Serializer<T, D>;
|
|
19
|
-
}): Registry<T>;
|
|
20
|
-
serialized<T>(name: string, options: {
|
|
21
|
-
default: T;
|
|
22
|
-
serializer: Serializer<T, Uint8Array>;
|
|
23
|
-
}): Registry<T>;
|
|
24
|
-
}
|
|
25
|
-
export declare const REGISTRY_EXTENSION_TYPE: ExtensionType<RegistryExtension>;
|
|
26
|
-
export declare const REGISTRY_PERMISSION_ID: Identifier;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Identifier } from "../../identifier";
|
|
2
|
-
import { RegistryPermissions, RegistryPermissionsJSON } from "./registry";
|
|
3
|
-
export declare class RegistryPacket {
|
|
4
|
-
readonly id: Identifier;
|
|
5
|
-
readonly value: Uint8Array | null;
|
|
6
|
-
constructor(id: Identifier, value: Uint8Array | null);
|
|
7
|
-
static serialize(packet: RegistryPacket): Uint8Array;
|
|
8
|
-
static deserialize(data: Uint8Array): RegistryPacket;
|
|
9
|
-
}
|
|
10
|
-
export interface RegisterPacketJSON {
|
|
11
|
-
id: string;
|
|
12
|
-
permissions: RegistryPermissionsJSON;
|
|
13
|
-
}
|
|
14
|
-
export declare class RegisterPacket {
|
|
15
|
-
readonly id: Identifier;
|
|
16
|
-
readonly permissions: RegistryPermissions;
|
|
17
|
-
constructor(id: Identifier, permissions: RegistryPermissions);
|
|
18
|
-
static serialize(packet: RegisterPacket): RegisterPacketJSON;
|
|
19
|
-
static deserialize(data: RegisterPacketJSON): RegisterPacket;
|
|
20
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Unlisten } from "../../event";
|
|
2
|
-
import { Identifier, IntoId } from "../../identifier";
|
|
3
|
-
import type { JsonType, Serializable } from "../../serialize";
|
|
4
|
-
export interface RegistryPermissionsJSON {
|
|
5
|
-
all?: string;
|
|
6
|
-
read?: string;
|
|
7
|
-
write?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface RegistryPermissions {
|
|
10
|
-
all?: IntoId;
|
|
11
|
-
read?: IntoId;
|
|
12
|
-
write?: IntoId;
|
|
13
|
-
}
|
|
14
|
-
export declare class RegistryType<T> {
|
|
15
|
-
readonly id: Identifier;
|
|
16
|
-
readonly defaultValue: T;
|
|
17
|
-
readonly serializer: Serializable<T, Uint8Array>;
|
|
18
|
-
readonly permissions: RegistryPermissions;
|
|
19
|
-
constructor(id: Identifier, defaultValue: T, serializer: Serializable<T, Uint8Array>, permissions: RegistryPermissions);
|
|
20
|
-
static createJson<
|
|
21
|
-
T,
|
|
22
|
-
D extends JsonType = JsonType
|
|
23
|
-
>(identifier: IntoId, { name, defaultValue, permissions, serializer }: {
|
|
24
|
-
name: string;
|
|
25
|
-
defaultValue: T;
|
|
26
|
-
permissions?: RegistryPermissions;
|
|
27
|
-
serializer?: Serializable<T, D>;
|
|
28
|
-
}): RegistryType<T>;
|
|
29
|
-
static createSerialized<T>(identifier: IntoId, { name, defaultValue, serializer, permissions }: {
|
|
30
|
-
name: string;
|
|
31
|
-
defaultValue: T;
|
|
32
|
-
serializer: Serializable<T, Uint8Array>;
|
|
33
|
-
permissions?: RegistryPermissions;
|
|
34
|
-
}): RegistryType<T>;
|
|
35
|
-
}
|
|
36
|
-
export interface Registry<T> {
|
|
37
|
-
readonly type: RegistryType<T>;
|
|
38
|
-
readonly value: T;
|
|
39
|
-
get(): Promise<T>;
|
|
40
|
-
set(value: T): Promise<void>;
|
|
41
|
-
update(fn: (value: T) => PromiseLike<T> | T): Promise<T>;
|
|
42
|
-
modify(fn: (value: T) => PromiseLike<void> | void): Promise<T>;
|
|
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>;
|
|
57
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { App, AppJson } from "../../app.js";
|
|
2
|
-
import { Identifier, IdentifierMap, IntoId } from "../../identifier";
|
|
3
|
-
import { LocalizedText } from "../../localization/localization.js";
|
|
4
|
-
import { Omu } from "../../omu.js";
|
|
5
|
-
import { ExtensionType, type Extension } from "../extension.js";
|
|
6
|
-
import { Registry, RegistryType } from "../registry";
|
|
7
|
-
import { type Table } from "../table";
|
|
8
|
-
export declare const SERVER_EXTENSION_TYPE: ExtensionType<ServerExtension>;
|
|
9
|
-
export interface AppIndexEntry {
|
|
10
|
-
url: string;
|
|
11
|
-
meta?: AppIndexRegistryMeta;
|
|
12
|
-
added_at: string;
|
|
13
|
-
}
|
|
14
|
-
export interface AppIndex {
|
|
15
|
-
indexes: Record<string, AppIndexEntry>;
|
|
16
|
-
}
|
|
17
|
-
export declare const SERVER_APPS_READ_PERMISSION_ID: Identifier;
|
|
18
|
-
export declare const SERVER_APPS_WRITE_PERMISSION_ID: Identifier;
|
|
19
|
-
export declare const SERVER_INDEX_READ_PERMISSION_ID: Identifier;
|
|
20
|
-
export declare const SERVER_INDEX_REGISTRY_TYPE: RegistryType<AppIndex>;
|
|
21
|
-
export declare const SERVER_SHUTDOWN_PERMISSION_ID: Identifier;
|
|
22
|
-
export declare const TRUSTED_ORIGINS_GET_PERMISSION_ID: Identifier;
|
|
23
|
-
export declare const TRUSTED_ORIGINS_SET_PERMISSION_ID: Identifier;
|
|
24
|
-
export declare class ServerExtension implements Extension {
|
|
25
|
-
private readonly omu;
|
|
26
|
-
readonly type: ExtensionType<ServerExtension>;
|
|
27
|
-
readonly apps: Table<App>;
|
|
28
|
-
readonly index: Registry<AppIndex>;
|
|
29
|
-
readonly trustedHosts: Registry<Record<string, string>>;
|
|
30
|
-
constructor(omu: Omu);
|
|
31
|
-
shutdown(restart?: boolean): Promise<boolean>;
|
|
32
|
-
}
|
|
33
|
-
export declare class SessionObserver {
|
|
34
|
-
readonly onConnectCallbacks: Array<(app: App) => Promise<void> | void>;
|
|
35
|
-
readonly onDisconnectCallbacks: Array<(app: App) => Promise<void> | void>;
|
|
36
|
-
constructor(onConnectCallbacks: Array<(app: App) => Promise<void> | void>, onDisconnectCallbacks: Array<(app: App) => Promise<void> | void>);
|
|
37
|
-
onConnect(callback: (app: App) => Promise<void> | void): void;
|
|
38
|
-
onDisconnect(callback: (app: App) => Promise<void> | void): void;
|
|
39
|
-
}
|
|
40
|
-
export type AppIndexRegistryMeta = {
|
|
41
|
-
name: LocalizedText;
|
|
42
|
-
note: LocalizedText;
|
|
43
|
-
};
|
|
44
|
-
export interface AppIndexRegistryJSON {
|
|
45
|
-
id: string;
|
|
46
|
-
meta?: AppIndexRegistryMeta;
|
|
47
|
-
apps: Record<string, AppJson>;
|
|
48
|
-
}
|
|
49
|
-
export declare class AppIndexRegistry {
|
|
50
|
-
id: Identifier;
|
|
51
|
-
apps: IdentifierMap<App>;
|
|
52
|
-
meta: AppIndexRegistryMeta | undefined;
|
|
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;
|
|
59
|
-
static fromJSON(json: AppIndexRegistryJSON): AppIndexRegistry;
|
|
60
|
-
toJSON(): AppIndexRegistryJSON;
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AppIndexRegistry, SERVER_APPS_READ_PERMISSION_ID, SERVER_SHUTDOWN_PERMISSION_ID, TRUSTED_ORIGINS_GET_PERMISSION_ID, TRUSTED_ORIGINS_SET_PERMISSION_ID, type AppIndex, type AppIndexEntry, type AppIndexRegistryJSON } from "./extension.js";
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { App } from "../../app";
|
|
2
|
-
import { Identifier, IntoId } from "../../identifier";
|
|
3
|
-
import { Omu } from "../../omu";
|
|
4
|
-
import { SessionParam } from "../../token";
|
|
5
|
-
import { Extension, ExtensionType } from "../extension";
|
|
6
|
-
import { SessionObserver } from "../server/extension";
|
|
7
|
-
import { Table } from "../table";
|
|
8
|
-
export declare const SESSION_EXTENSION_TYPE: ExtensionType<SessionExtension>;
|
|
9
|
-
export declare const SESSIONS_READ_PERMISSION_ID: Identifier;
|
|
10
|
-
export type RequestRemoteAppResponse = {
|
|
11
|
-
type: "success";
|
|
12
|
-
token: string;
|
|
13
|
-
lan_ip: string;
|
|
14
|
-
} | {
|
|
15
|
-
type: "error";
|
|
16
|
-
message: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const REMOTE_APP_REQUEST_PERMISSION_ID: Identifier;
|
|
19
|
-
export type GenerateTokenResponse = {
|
|
20
|
-
type: "success";
|
|
21
|
-
token: string;
|
|
22
|
-
} | {
|
|
23
|
-
type: "error";
|
|
24
|
-
message: string;
|
|
25
|
-
};
|
|
26
|
-
export declare const GENERATE_TOKEN_PERMISSION_ID: Identifier;
|
|
27
|
-
export declare class SessionExtension implements Extension {
|
|
28
|
-
private readonly omu;
|
|
29
|
-
readonly type: ExtensionType<SessionExtension>;
|
|
30
|
-
readonly sessions: Table<App>;
|
|
31
|
-
private readonly sessionObservers;
|
|
32
|
-
private readonly requiredApps;
|
|
33
|
-
constructor(omu: Omu);
|
|
34
|
-
has(id: IntoId): Promise<boolean>;
|
|
35
|
-
observe(appId: IntoId, options?: {
|
|
36
|
-
onConnect?(app: App): void;
|
|
37
|
-
onDisconnect?(app: App): void;
|
|
38
|
-
}): SessionObserver;
|
|
39
|
-
private handleSessionConnect;
|
|
40
|
-
private handleSessionDisconnect;
|
|
41
|
-
require(...appIds: IntoId[]): void;
|
|
42
|
-
private onTask;
|
|
43
|
-
private onReady;
|
|
44
|
-
requestRemoteApp(options: {
|
|
45
|
-
app: App;
|
|
46
|
-
permissions: IntoId[];
|
|
47
|
-
}): Promise<RequestRemoteAppResponse>;
|
|
48
|
-
generateToken(options: {
|
|
49
|
-
app: App;
|
|
50
|
-
permissions?: IntoId[];
|
|
51
|
-
}): Promise<SessionParam>;
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { GENERATE_TOKEN_PERMISSION_ID, REMOTE_APP_REQUEST_PERMISSION_ID, SESSION_EXTENSION_TYPE, SessionExtension, SESSIONS_READ_PERMISSION_ID, type RequestRemoteAppResponse } from "./extension";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Omu } from "../../omu";
|
|
2
|
-
import { JsonType, Serializable } from "../../serialize";
|
|
3
|
-
import { ExtensionType, type Extension } from "../extension.js";
|
|
4
|
-
import { SignalType, type Signal } from "./signal.js";
|
|
5
|
-
export declare const SIGNAL_EXTENSION_TYPE: ExtensionType<SignalExtension>;
|
|
6
|
-
export declare class SignalExtension implements Extension {
|
|
7
|
-
private readonly omu;
|
|
8
|
-
readonly type: ExtensionType<SignalExtension>;
|
|
9
|
-
private readonly signals;
|
|
10
|
-
constructor(omu: Omu);
|
|
11
|
-
private createSignal;
|
|
12
|
-
json<
|
|
13
|
-
T,
|
|
14
|
-
D extends JsonType = JsonType
|
|
15
|
-
>(name: string, options?: {
|
|
16
|
-
serializer?: Serializable<T, D>;
|
|
17
|
-
}): Signal<T>;
|
|
18
|
-
serialized<T>(name: string, options: {
|
|
19
|
-
serializer: Serializable<T, Uint8Array>;
|
|
20
|
-
}): Signal<T>;
|
|
21
|
-
get<T>(signalType: SignalType<T>): Signal<T>;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SignalPermissions, SignalType, type Signal } from "./signal.js";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Identifier } from "../../identifier";
|
|
2
|
-
import { SignalPermissions, SignalPermissionsJSON } from "./signal.js";
|
|
3
|
-
export declare class SignalPacket {
|
|
4
|
-
readonly id: Identifier;
|
|
5
|
-
readonly body: Uint8Array;
|
|
6
|
-
constructor(id: Identifier, body: Uint8Array);
|
|
7
|
-
static serialize(packet: SignalPacket): Uint8Array;
|
|
8
|
-
static deserialize(data: Uint8Array): SignalPacket;
|
|
9
|
-
}
|
|
10
|
-
interface SignalRegisterPacketJSON {
|
|
11
|
-
id: string;
|
|
12
|
-
permissions: SignalPermissionsJSON;
|
|
13
|
-
}
|
|
14
|
-
export declare class SignalRegisterPacket {
|
|
15
|
-
readonly id: Identifier;
|
|
16
|
-
readonly permissions: SignalPermissions;
|
|
17
|
-
constructor(id: Identifier, permissions: SignalPermissions);
|
|
18
|
-
static serialize(packet: SignalRegisterPacket): SignalRegisterPacketJSON;
|
|
19
|
-
static deserialize(data: SignalRegisterPacketJSON): SignalRegisterPacket;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Unlisten } from "../../event";
|
|
2
|
-
import { Identifier, IntoId } from "../../identifier";
|
|
3
|
-
import type { Serializable } from "../../serialize";
|
|
4
|
-
export interface SignalPermissionsJSON {
|
|
5
|
-
all?: string;
|
|
6
|
-
listen?: string;
|
|
7
|
-
send?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface SignalPermissions {
|
|
10
|
-
all?: IntoId | undefined;
|
|
11
|
-
listen?: IntoId | undefined;
|
|
12
|
-
send?: IntoId | undefined;
|
|
13
|
-
}
|
|
14
|
-
export declare class SignalType<T> {
|
|
15
|
-
readonly id: Identifier;
|
|
16
|
-
readonly serializer: Serializable<T, Uint8Array>;
|
|
17
|
-
readonly permissions: SignalPermissions;
|
|
18
|
-
constructor(id: Identifier, serializer: Serializable<T, Uint8Array>, permissions: SignalPermissions);
|
|
19
|
-
static createJson<T>(identifier: IntoId, { name, serializer, permissions }: {
|
|
20
|
-
name: string;
|
|
21
|
-
serializer?: Serializable<T, any>;
|
|
22
|
-
permissions?: SignalPermissions;
|
|
23
|
-
}): SignalType<T>;
|
|
24
|
-
static createSerialized<T>(identifier: IntoId, { name, serializer, permissions }: {
|
|
25
|
-
name: string;
|
|
26
|
-
serializer: Serializable<T, Uint8Array>;
|
|
27
|
-
permissions?: SignalPermissions;
|
|
28
|
-
}): SignalType<T>;
|
|
29
|
-
}
|
|
30
|
-
export interface Signal<T> {
|
|
31
|
-
listen(handler: (value: T) => void): Unlisten;
|
|
32
|
-
notify(body: T): void;
|
|
33
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Identifier } from "../../identifier";
|
|
2
|
-
import { Omu } from "../../omu";
|
|
3
|
-
import type { JsonType, Serializable } from "../../serialize";
|
|
4
|
-
import type { Extension } from "../extension.js";
|
|
5
|
-
import { ExtensionType } from "../extension.js";
|
|
6
|
-
import type { Table } from "./table.js";
|
|
7
|
-
import { TableType } from "./table.js";
|
|
8
|
-
export declare const TABLE_EXTENSION_TYPE: ExtensionType<TableExtension>;
|
|
9
|
-
export declare const TABLE_PERMISSION_ID: Identifier;
|
|
10
|
-
export declare class TableExtension implements Extension {
|
|
11
|
-
private readonly omu;
|
|
12
|
-
readonly type: ExtensionType<TableExtension>;
|
|
13
|
-
private readonly tableMap;
|
|
14
|
-
constructor(omu: Omu);
|
|
15
|
-
private createTable;
|
|
16
|
-
json<
|
|
17
|
-
T,
|
|
18
|
-
D extends JsonType = JsonType
|
|
19
|
-
>(name: string, options: {
|
|
20
|
-
key: (item: T) => string;
|
|
21
|
-
serializer?: Serializable<T, D>;
|
|
22
|
-
}): Table<T>;
|
|
23
|
-
serialized<T>(name: string, options: {
|
|
24
|
-
key: (item: T) => string;
|
|
25
|
-
serializer: Serializable<T, Uint8Array>;
|
|
26
|
-
}): Table<T>;
|
|
27
|
-
get<T>(type: TableType<T>): Table<T>;
|
|
28
|
-
has(identifier: Identifier): boolean;
|
|
29
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Identifier } from "../../identifier";
|
|
2
|
-
import type { TableConfig } from "./table.js";
|
|
3
|
-
export declare class TablePacket {
|
|
4
|
-
readonly id: Identifier;
|
|
5
|
-
constructor(id: Identifier);
|
|
6
|
-
static serialize(packet: TablePacket): Uint8Array;
|
|
7
|
-
static deserialize(data: Uint8Array): TablePacket;
|
|
8
|
-
}
|
|
9
|
-
export declare class TableItemsPacket {
|
|
10
|
-
readonly id: Identifier;
|
|
11
|
-
readonly items: Record<string, Uint8Array>;
|
|
12
|
-
constructor(id: Identifier, items: Record<string, Uint8Array>);
|
|
13
|
-
static serialize(packet: TableItemsPacket): Uint8Array;
|
|
14
|
-
static deserialize(data: Uint8Array): TableItemsPacket;
|
|
15
|
-
}
|
|
16
|
-
export declare class TableKeysPacket {
|
|
17
|
-
readonly id: Identifier;
|
|
18
|
-
readonly keys: string[];
|
|
19
|
-
constructor(id: Identifier, keys: string[]);
|
|
20
|
-
static serialize(packet: TableKeysPacket): Uint8Array;
|
|
21
|
-
static deserialize(data: Uint8Array): TableKeysPacket;
|
|
22
|
-
}
|
|
23
|
-
export declare class TableProxyPacket {
|
|
24
|
-
readonly id: Identifier;
|
|
25
|
-
readonly items: Record<string, Uint8Array>;
|
|
26
|
-
readonly key: number;
|
|
27
|
-
constructor(id: Identifier, items: Record<string, Uint8Array>, key: number);
|
|
28
|
-
static serialize(packet: TableProxyPacket): Uint8Array;
|
|
29
|
-
static deserialize(data: Uint8Array): TableProxyPacket;
|
|
30
|
-
}
|
|
31
|
-
export declare class TableFetchPacket {
|
|
32
|
-
readonly id: Identifier;
|
|
33
|
-
readonly limit: number;
|
|
34
|
-
readonly backward: boolean;
|
|
35
|
-
readonly cursor: string | null;
|
|
36
|
-
constructor(id: Identifier, limit: number, backward?: boolean, cursor?: string | null);
|
|
37
|
-
static serialize(packet: TableFetchPacket): Uint8Array;
|
|
38
|
-
static deserialize(data: Uint8Array): TableFetchPacket;
|
|
39
|
-
}
|
|
40
|
-
export declare class TableFetchRangePacket {
|
|
41
|
-
readonly id: Identifier;
|
|
42
|
-
readonly start: string;
|
|
43
|
-
readonly end: string;
|
|
44
|
-
constructor(id: Identifier, start: string, end: string);
|
|
45
|
-
static serialize(packet: TableFetchRangePacket): Uint8Array;
|
|
46
|
-
static deserialize(data: Uint8Array): TableFetchRangePacket;
|
|
47
|
-
}
|
|
48
|
-
export declare class SetConfigPacket {
|
|
49
|
-
readonly id: Identifier;
|
|
50
|
-
readonly config: TableConfig;
|
|
51
|
-
constructor(id: Identifier, config: TableConfig);
|
|
52
|
-
static serialize(packet: SetConfigPacket): Uint8Array;
|
|
53
|
-
static deserialize(data: Uint8Array): SetConfigPacket;
|
|
54
|
-
}
|
|
55
|
-
export declare class SetPermissionPacket {
|
|
56
|
-
readonly id: Identifier;
|
|
57
|
-
readonly all: Identifier | null;
|
|
58
|
-
readonly read: Identifier | null;
|
|
59
|
-
readonly write: Identifier | null;
|
|
60
|
-
readonly remove: Identifier | null;
|
|
61
|
-
readonly proxy: Identifier | null;
|
|
62
|
-
constructor(id: Identifier, all: Identifier | null, read: Identifier | null, write: Identifier | null, remove: Identifier | null, proxy: Identifier | null);
|
|
63
|
-
static serialize(packet: SetPermissionPacket): Uint8Array;
|
|
64
|
-
static deserialize(data: Uint8Array): SetPermissionPacket;
|
|
65
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { EventEmitter, Unlisten } from "../../event";
|
|
2
|
-
import { Identifier, IntoId } from "../../identifier";
|
|
3
|
-
import type { JsonType, Serializable } from "../../serialize";
|
|
4
|
-
export type TableConfig = {
|
|
5
|
-
cache_size: number;
|
|
6
|
-
};
|
|
7
|
-
export interface Table<T> {
|
|
8
|
-
readonly cache: ReadonlyMap<string, T>;
|
|
9
|
-
readonly event: TableEvents<T>;
|
|
10
|
-
get(key: string): Promise<T | undefined>;
|
|
11
|
-
getMany(...keys: string[]): Promise<Map<string, T>>;
|
|
12
|
-
add(...item: T[]): Promise<void>;
|
|
13
|
-
update(...item: T[]): Promise<void>;
|
|
14
|
-
remove(...items: T[]): Promise<void>;
|
|
15
|
-
clear(): Promise<void>;
|
|
16
|
-
has(key: string): Promise<boolean>;
|
|
17
|
-
hasMany<T extends Record<string, unknown>>(...keys: (keyof T)[]): Promise<{ [key in keyof T] : boolean }>;
|
|
18
|
-
hasAll(...keys: string[]): Promise<boolean>;
|
|
19
|
-
hasAny(...keys: string[]): Promise<boolean>;
|
|
20
|
-
fetchItems({ limit, backward, cursor }: {
|
|
21
|
-
limit: number;
|
|
22
|
-
backward?: boolean;
|
|
23
|
-
cursor?: string;
|
|
24
|
-
}): Promise<Map<string, T>>;
|
|
25
|
-
fetchRange({ start, end }: {
|
|
26
|
-
start: string;
|
|
27
|
-
end: string;
|
|
28
|
-
}): Promise<Map<string, T>>;
|
|
29
|
-
fetchAll(): Promise<Map<string, T>>;
|
|
30
|
-
iterate({ backward, cursor }: {
|
|
31
|
-
backward?: boolean;
|
|
32
|
-
cursor?: string;
|
|
33
|
-
}): AsyncIterable<T>;
|
|
34
|
-
size(): Promise<number>;
|
|
35
|
-
proxy(proxy: (item: T) => T | undefined): Unlisten;
|
|
36
|
-
setCacheSize(size: number): void;
|
|
37
|
-
setConfig(config: TableConfig): void;
|
|
38
|
-
setPermissions(permissions: TablePermissions): void;
|
|
39
|
-
listen(listener?: (items: Map<string, T>) => void): Unlisten;
|
|
40
|
-
}
|
|
41
|
-
export type TableEvents<T> = {
|
|
42
|
-
add: EventEmitter<[Map<string, T>]>;
|
|
43
|
-
update: EventEmitter<[Map<string, T>]>;
|
|
44
|
-
remove: EventEmitter<[Map<string, T>]>;
|
|
45
|
-
clear: EventEmitter<[]>;
|
|
46
|
-
cacheUpdate: EventEmitter<[Map<string, T>]>;
|
|
47
|
-
};
|
|
48
|
-
export type TablePermissions = {
|
|
49
|
-
all?: Identifier;
|
|
50
|
-
read?: Identifier;
|
|
51
|
-
write?: Identifier;
|
|
52
|
-
remove?: Identifier;
|
|
53
|
-
proxy?: Identifier;
|
|
54
|
-
};
|
|
55
|
-
export declare class TableType<T> {
|
|
56
|
-
id: Identifier;
|
|
57
|
-
serializer: Serializable<T, Uint8Array>;
|
|
58
|
-
keyFunction: (item: T) => string;
|
|
59
|
-
permissions?: TablePermissions | undefined;
|
|
60
|
-
constructor(id: Identifier, serializer: Serializable<T, Uint8Array>, keyFunction: (item: T) => string, permissions?: TablePermissions | undefined);
|
|
61
|
-
static createJson<
|
|
62
|
-
T,
|
|
63
|
-
D extends JsonType = JsonType
|
|
64
|
-
>(identifier: IntoId, { name, key, permissions, serializer }: {
|
|
65
|
-
name: string;
|
|
66
|
-
key: (item: T) => string;
|
|
67
|
-
permissions?: TablePermissions;
|
|
68
|
-
serializer?: Serializable<T, D>;
|
|
69
|
-
}): TableType<T>;
|
|
70
|
-
static createSerialized<T>(identifier: IntoId, { name, key, permissions, serializer }: {
|
|
71
|
-
name: string;
|
|
72
|
-
key: (item: T) => string;
|
|
73
|
-
permissions?: TablePermissions;
|
|
74
|
-
serializer: Serializable<T, Uint8Array>;
|
|
75
|
-
}): TableType<T>;
|
|
76
|
-
}
|
package/dist/dts/app.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Identifier, IntoId } from "./identifier";
|
|
2
|
-
import type { Locale } from "./localization/locale.js";
|
|
3
|
-
import type { LocalizedText } from "./localization/localization.js";
|
|
4
|
-
export type AppMetadata = {
|
|
5
|
-
locale: Locale;
|
|
6
|
-
name?: LocalizedText;
|
|
7
|
-
icon?: LocalizedText;
|
|
8
|
-
description?: LocalizedText;
|
|
9
|
-
image?: LocalizedText;
|
|
10
|
-
site?: LocalizedText;
|
|
11
|
-
repository?: LocalizedText;
|
|
12
|
-
authors?: LocalizedText;
|
|
13
|
-
license?: LocalizedText;
|
|
14
|
-
tags?: string[];
|
|
15
|
-
};
|
|
16
|
-
export type AppType = "app" | "service" | "remote" | "plugin" | "dashboard";
|
|
17
|
-
export type DependencySpecifier = {
|
|
18
|
-
version: string;
|
|
19
|
-
index?: string;
|
|
20
|
-
};
|
|
21
|
-
export type AppJson = {
|
|
22
|
-
id: string;
|
|
23
|
-
type: AppType;
|
|
24
|
-
parent_id?: string;
|
|
25
|
-
version?: string;
|
|
26
|
-
url?: string;
|
|
27
|
-
metadata?: AppMetadata;
|
|
28
|
-
dependencies?: Record<string, DependencySpecifier | string>;
|
|
29
|
-
};
|
|
30
|
-
export declare class App {
|
|
31
|
-
readonly id: Identifier;
|
|
32
|
-
readonly type: AppType;
|
|
33
|
-
readonly parentId?: Identifier;
|
|
34
|
-
readonly version?: string;
|
|
35
|
-
readonly url?: string;
|
|
36
|
-
readonly metadata?: AppMetadata;
|
|
37
|
-
readonly dependencies: Record<string, DependencySpecifier | string>;
|
|
38
|
-
constructor(id: IntoId, options: {
|
|
39
|
-
type?: AppType;
|
|
40
|
-
parentId?: IntoId;
|
|
41
|
-
version?: string;
|
|
42
|
-
url?: string;
|
|
43
|
-
metadata?: AppMetadata;
|
|
44
|
-
dependencies?: Record<string, DependencySpecifier | string>;
|
|
45
|
-
});
|
|
46
|
-
static deserialize(info: AppJson): App;
|
|
47
|
-
static serialize(data: App): AppJson;
|
|
48
|
-
join(...paths: string[]): App;
|
|
49
|
-
}
|
package/dist/dts/const.d.ts
DELETED
package/dist/dts/errors.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { DisconnectType } from "./network/packet/packet-types.js";
|
|
2
|
-
export declare class OmuError extends Error {
|
|
3
|
-
constructor(message: string | null);
|
|
4
|
-
}
|
|
5
|
-
export declare class DisconnectReason extends OmuError {
|
|
6
|
-
type: DisconnectType;
|
|
7
|
-
message: string;
|
|
8
|
-
constructor(type: DisconnectType, message?: string);
|
|
9
|
-
}
|
|
10
|
-
export declare class ServerRestart extends DisconnectReason {
|
|
11
|
-
constructor(message: string);
|
|
12
|
-
}
|
|
13
|
-
export declare class AnotherConnection extends DisconnectReason {
|
|
14
|
-
constructor(message: string);
|
|
15
|
-
}
|
|
16
|
-
export declare class PermissionDenied extends DisconnectReason {
|
|
17
|
-
constructor(message: string);
|
|
18
|
-
}
|
|
19
|
-
export declare class AppRemoved extends DisconnectReason {
|
|
20
|
-
constructor(message: string);
|
|
21
|
-
}
|
|
22
|
-
export declare class InvalidToken extends DisconnectReason {
|
|
23
|
-
constructor(message: string);
|
|
24
|
-
}
|
|
25
|
-
export declare class InvalidOrigin extends DisconnectReason {
|
|
26
|
-
constructor(message: string);
|
|
27
|
-
}
|
|
28
|
-
export declare class InvalidVersion extends DisconnectReason {
|
|
29
|
-
constructor(message: string);
|
|
30
|
-
}
|
|
31
|
-
export declare class InvalidPacket extends DisconnectReason {
|
|
32
|
-
constructor(message: string);
|
|
33
|
-
}
|
|
34
|
-
export declare class InternalError extends DisconnectReason {
|
|
35
|
-
constructor(message: string);
|
|
36
|
-
}
|
package/dist/dts/helper.d.ts
DELETED
package/dist/dts/identifier.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { ExtensionType } from "./api";
|
|
2
|
-
import { App } from "./app";
|
|
3
|
-
export type IntoId = Identifier | string | ExtensionType | App;
|
|
4
|
-
export declare class Identifier {
|
|
5
|
-
readonly namespace: string;
|
|
6
|
-
readonly path: string[];
|
|
7
|
-
constructor(namespace: string, ...path: string[]);
|
|
8
|
-
static serialize(identifier: Identifier): string;
|
|
9
|
-
static deserialize(json: string): Identifier;
|
|
10
|
-
static from(id: IntoId): Identifier;
|
|
11
|
-
static fromOptional(id: IntoId | undefined | null): Identifier | undefined;
|
|
12
|
-
static validate(namespace: string, path: string[]): void;
|
|
13
|
-
static format(namespace: string, ...path: string[]): string;
|
|
14
|
-
static fromKey(key: string): Identifier;
|
|
15
|
-
static fromUrl(url: string | URL): Identifier;
|
|
16
|
-
static namespaceFromUrl(url: string | URL): string;
|
|
17
|
-
get base(): Identifier;
|
|
18
|
-
toJson(): string;
|
|
19
|
-
static fromJson(json: string): Identifier;
|
|
20
|
-
key(): string;
|
|
21
|
-
isEqual(other: Identifier): boolean;
|
|
22
|
-
isNamespaceEqual(other: Identifier): boolean;
|
|
23
|
-
isSubpathOf(other: Identifier): boolean;
|
|
24
|
-
join(...path: string[]): Identifier;
|
|
25
|
-
}
|
|
26
|
-
export declare class IdentifierMap<T> {
|
|
27
|
-
private readonly map;
|
|
28
|
-
constructor(entries?: Iterable<[Identifier, T]>);
|
|
29
|
-
get size(): number;
|
|
30
|
-
set(identifier: Identifier, value: T): void;
|
|
31
|
-
get(identifier: Identifier): T | undefined;
|
|
32
|
-
has(identifier: Identifier): boolean;
|
|
33
|
-
delete(identifier: Identifier): void;
|
|
34
|
-
clear(): void;
|
|
35
|
-
keys(): IterableIterator<Identifier>;
|
|
36
|
-
values(): IterableIterator<T>;
|
|
37
|
-
entries(): IterableIterator<[Identifier, T]>;
|
|
38
|
-
[Symbol.iterator](): IterableIterator<[Identifier, T]>;
|
|
39
|
-
}
|
|
40
|
-
export declare class IdentifierSet {
|
|
41
|
-
private readonly set;
|
|
42
|
-
get size(): number;
|
|
43
|
-
add(identifier: Identifier): void;
|
|
44
|
-
has(identifier: Identifier): boolean;
|
|
45
|
-
delete(identifier: Identifier): void;
|
|
46
|
-
clear(): void;
|
|
47
|
-
keys(): IterableIterator<Identifier>;
|
|
48
|
-
values(): IterableIterator<Identifier>;
|
|
49
|
-
entries(): IterableIterator<[Identifier, Identifier]>;
|
|
50
|
-
[Symbol.iterator](): IterableIterator<[Identifier, Identifier]>;
|
|
51
|
-
}
|