@omujs/omu 0.9.43 → 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.
Files changed (154) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +1 -1
  3. package/src/api/dashboard/extension.ts +17 -8
  4. package/src/api/dashboard/handler.ts +1 -1
  5. package/src/api/registry/extension.ts +109 -23
  6. package/src/network/network.ts +5 -0
  7. package/src/omu.ts +1 -0
  8. package/src/serialize/bytebuffer.ts +8 -0
  9. package/src/version.ts +1 -1
  10. package/dist/dts/address.d.ts +0 -6
  11. package/dist/dts/api/asset/extension.d.ts +0 -25
  12. package/dist/dts/api/asset/index.d.ts +0 -2
  13. package/dist/dts/api/dashboard/extension.d.ts +0 -181
  14. package/dist/dts/api/dashboard/handler.d.ts +0 -22
  15. package/dist/dts/api/dashboard/index.d.ts +0 -3
  16. package/dist/dts/api/dashboard/packets.d.ts +0 -73
  17. package/dist/dts/api/endpoint/endpoint.d.ts +0 -32
  18. package/dist/dts/api/endpoint/extension.d.ts +0 -23
  19. package/dist/dts/api/endpoint/index.d.ts +0 -2
  20. package/dist/dts/api/endpoint/packets.d.ts +0 -51
  21. package/dist/dts/api/extension-registry.d.ts +0 -8
  22. package/dist/dts/api/extension.d.ts +0 -11
  23. package/dist/dts/api/http/extension.d.ts +0 -41
  24. package/dist/dts/api/http/http.d.ts +0 -36
  25. package/dist/dts/api/http/index.d.ts +0 -2
  26. package/dist/dts/api/http/websocket.d.ts +0 -123
  27. package/dist/dts/api/i18n/extension.d.ts +0 -19
  28. package/dist/dts/api/i18n/index.d.ts +0 -1
  29. package/dist/dts/api/index.d.ts +0 -2
  30. package/dist/dts/api/logger/extension.d.ts +0 -25
  31. package/dist/dts/api/logger/index.d.ts +0 -1
  32. package/dist/dts/api/logger/packets.d.ts +0 -18
  33. package/dist/dts/api/permission/extension.d.ts +0 -19
  34. package/dist/dts/api/permission/index.d.ts +0 -1
  35. package/dist/dts/api/permission/permission.d.ts +0 -25
  36. package/dist/dts/api/plugin/extension.d.ts +0 -43
  37. package/dist/dts/api/plugin/index.d.ts +0 -2
  38. package/dist/dts/api/plugin/package-info.d.ts +0 -84
  39. package/dist/dts/api/registry/extension.d.ts +0 -26
  40. package/dist/dts/api/registry/index.d.ts +0 -2
  41. package/dist/dts/api/registry/packets.d.ts +0 -20
  42. package/dist/dts/api/registry/registry.d.ts +0 -57
  43. package/dist/dts/api/server/extension.d.ts +0 -61
  44. package/dist/dts/api/server/index.d.ts +0 -1
  45. package/dist/dts/api/session/extension.d.ts +0 -52
  46. package/dist/dts/api/session/index.d.ts +0 -1
  47. package/dist/dts/api/signal/extension.d.ts +0 -22
  48. package/dist/dts/api/signal/index.d.ts +0 -1
  49. package/dist/dts/api/signal/packets.d.ts +0 -21
  50. package/dist/dts/api/signal/signal.d.ts +0 -33
  51. package/dist/dts/api/table/extension.d.ts +0 -29
  52. package/dist/dts/api/table/index.d.ts +0 -2
  53. package/dist/dts/api/table/packets.d.ts +0 -65
  54. package/dist/dts/api/table/table.d.ts +0 -76
  55. package/dist/dts/app.d.ts +0 -49
  56. package/dist/dts/const.d.ts +0 -2
  57. package/dist/dts/errors.d.ts +0 -36
  58. package/dist/dts/event/index.d.ts +0 -6
  59. package/dist/dts/helper.d.ts +0 -13
  60. package/dist/dts/identifier.d.ts +0 -51
  61. package/dist/dts/index.d.ts +0 -36
  62. package/dist/dts/localization/index.d.ts +0 -2
  63. package/dist/dts/localization/locale.d.ts +0 -735
  64. package/dist/dts/localization/localization.d.ts +0 -5
  65. package/dist/dts/lock.d.ts +0 -6
  66. package/dist/dts/network/connection.d.ts +0 -17
  67. package/dist/dts/network/encryption.d.ts +0 -38
  68. package/dist/dts/network/frame-transport.d.ts +0 -22
  69. package/dist/dts/network/index.d.ts +0 -5
  70. package/dist/dts/network/network.d.ts +0 -58
  71. package/dist/dts/network/packet/index.d.ts +0 -2
  72. package/dist/dts/network/packet/packet-types.d.ts +0 -84
  73. package/dist/dts/network/packet/packet.d.ts +0 -28
  74. package/dist/dts/network/websocket-transport.d.ts +0 -24
  75. package/dist/dts/omu.d.ts +0 -61
  76. package/dist/dts/result.d.ts +0 -41
  77. package/dist/dts/serialize/bytebuffer.d.ts +0 -71
  78. package/dist/dts/serialize/index.d.ts +0 -2
  79. package/dist/dts/serialize/serializer.d.ts +0 -38
  80. package/dist/dts/token.d.ts +0 -14
  81. package/dist/dts/version.d.ts +0 -2
  82. package/dist/esm/address.js +0 -4
  83. package/dist/esm/api/asset/extension.js +0 -905
  84. package/dist/esm/api/asset/index.js +0 -903
  85. package/dist/esm/api/dashboard/extension.js +0 -1343
  86. package/dist/esm/api/dashboard/handler.js +0 -4
  87. package/dist/esm/api/dashboard/index.js +0 -1342
  88. package/dist/esm/api/dashboard/packets.js +0 -413
  89. package/dist/esm/api/endpoint/endpoint.js +0 -383
  90. package/dist/esm/api/endpoint/extension.js +0 -1090
  91. package/dist/esm/api/endpoint/index.js +0 -383
  92. package/dist/esm/api/endpoint/packets.js +0 -793
  93. package/dist/esm/api/extension-registry.js +0 -23
  94. package/dist/esm/api/extension.js +0 -278
  95. package/dist/esm/api/http/extension.js +0 -1414
  96. package/dist/esm/api/http/http.js +0 -442
  97. package/dist/esm/api/http/index.js +0 -1413
  98. package/dist/esm/api/http/websocket.js +0 -220
  99. package/dist/esm/api/i18n/extension.js +0 -1270
  100. package/dist/esm/api/i18n/index.js +0 -1268
  101. package/dist/esm/api/index.js +0 -295
  102. package/dist/esm/api/logger/extension.js +0 -850
  103. package/dist/esm/api/logger/index.js +0 -846
  104. package/dist/esm/api/logger/packets.js +0 -667
  105. package/dist/esm/api/permission/extension.js +0 -535
  106. package/dist/esm/api/permission/index.js +0 -294
  107. package/dist/esm/api/permission/permission.js +0 -294
  108. package/dist/esm/api/plugin/extension.js +0 -531
  109. package/dist/esm/api/plugin/index.js +0 -529
  110. package/dist/esm/api/plugin/package-info.js +0 -4
  111. package/dist/esm/api/registry/extension.js +0 -1217
  112. package/dist/esm/api/registry/index.js +0 -1216
  113. package/dist/esm/api/registry/packets.js +0 -688
  114. package/dist/esm/api/registry/registry.js +0 -383
  115. package/dist/esm/api/server/extension.js +0 -2071
  116. package/dist/esm/api/server/index.js +0 -2049
  117. package/dist/esm/api/session/extension.js +0 -2166
  118. package/dist/esm/api/session/index.js +0 -2166
  119. package/dist/esm/api/signal/extension.js +0 -1025
  120. package/dist/esm/api/signal/index.js +0 -379
  121. package/dist/esm/api/signal/packets.js +0 -684
  122. package/dist/esm/api/signal/signal.js +0 -379
  123. package/dist/esm/api/table/extension.js +0 -1547
  124. package/dist/esm/api/table/index.js +0 -1546
  125. package/dist/esm/api/table/packets.js +0 -898
  126. package/dist/esm/api/table/table.js +0 -383
  127. package/dist/esm/app.js +0 -264
  128. package/dist/esm/const.js +0 -11
  129. package/dist/esm/errors.js +0 -548
  130. package/dist/esm/event/index.js +0 -22
  131. package/dist/esm/helper.js +0 -15
  132. package/dist/esm/identifier.js +0 -266
  133. package/dist/esm/index.js +0 -5099
  134. package/dist/esm/localization/index.js +0 -742
  135. package/dist/esm/localization/locale.js +0 -742
  136. package/dist/esm/localization/localization.js +0 -4
  137. package/dist/esm/lock.js +0 -46
  138. package/dist/esm/network/connection.js +0 -293
  139. package/dist/esm/network/encryption.js +0 -980
  140. package/dist/esm/network/frame-transport.js +0 -525
  141. package/dist/esm/network/index.js +0 -1617
  142. package/dist/esm/network/network.js +0 -1358
  143. package/dist/esm/network/packet/index.js +0 -485
  144. package/dist/esm/network/packet/packet-types.js +0 -486
  145. package/dist/esm/network/packet/packet.js +0 -126
  146. package/dist/esm/network/websocket-transport.js +0 -487
  147. package/dist/esm/omu.js +0 -4858
  148. package/dist/esm/result.js +0 -68
  149. package/dist/esm/serialize/bytebuffer.js +0 -378
  150. package/dist/esm/serialize/index.js +0 -465
  151. package/dist/esm/serialize/serializer.js +0 -97
  152. package/dist/esm/token.js +0 -42
  153. package/dist/esm/version.js +0 -11
  154. package/tsconfig.tsbuildinfo +0 -1
@@ -1,23 +0,0 @@
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<
16
- Req,
17
- Res
18
- >(type: EndpointType<Req, Res>, handler: (data: Req, params: InvokedParams) => Promise<Res>): void;
19
- call<
20
- Req,
21
- Res
22
- >(endpoint: EndpointType<Req, Res>, data: Req): Promise<Res>;
23
- }
@@ -1,2 +0,0 @@
1
- export { EndpointType } from "./endpoint.js";
2
- export type { InvokedParams, InvokeParams } from "./packets.js";
@@ -1,51 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,41 +0,0 @@
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 {};
@@ -1,36 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export { HTTP_REQUEST_PERMISSION_ID } from "./extension";
2
- export { OmuWS, type WSMsg } from "./websocket";
@@ -1,123 +0,0 @@
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 {};
@@ -1,19 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export { I18N_GET_LOCALES_PERMISSION_ID, I18N_SET_LOCALES_PERMISSION_ID } from "./extension.js";
@@ -1,2 +0,0 @@
1
- export { ExtensionRegistry } from "./extension-registry.js";
2
- export { Extension, ExtensionType } from "./extension.js";
@@ -1,25 +0,0 @@
1
- import type { Unlisten } from "../../event";
2
- import { Identifier } from "../../identifier";
3
- import { PacketType } from "../../network/packet/packet.js";
4
- import { Omu } from "../../omu";
5
- import { ExtensionType } from "../extension.js";
6
- import type { LogMessage } from "./packets.js";
7
- import { LogPacket } from "./packets.js";
8
- export declare const LOGGER_EXTENSION_TYPE: ExtensionType<LoggerExtension>;
9
- export declare const LOGGER_LOG_PERMISSION_ID: Identifier;
10
- export declare const LOGGER_LOG_PACKET: PacketType<LogPacket>;
11
- export declare const LOGGER_LISTEN_PACKET: PacketType<Identifier>;
12
- type LogListener = (message: LogMessage) => void;
13
- export declare class LoggerExtension {
14
- private readonly omu;
15
- readonly type: ExtensionType<LoggerExtension>;
16
- private readonly listeners;
17
- constructor(omu: Omu);
18
- log(message: LogMessage): void;
19
- error(text: string): void;
20
- warning(text: string): void;
21
- info(text: string): void;
22
- debug(text: string): void;
23
- listen(id: Identifier, listener: LogListener): Unlisten;
24
- }
25
- export {};
@@ -1 +0,0 @@
1
- export { LOGGER_LOG_PERMISSION_ID } from "./extension.js";
@@ -1,18 +0,0 @@
1
- import { Identifier } from "../../identifier";
2
- export declare enum LogType {
3
- ERROR = "error",
4
- WARNING = "warning",
5
- INFO = "info",
6
- DEBUG = "debug"
7
- }
8
- export type LogMessage = {
9
- type: LogType;
10
- text: string;
11
- };
12
- export declare class LogPacket {
13
- readonly id: Identifier;
14
- readonly message: LogMessage;
15
- constructor(id: Identifier, message: LogMessage);
16
- static serialize(item: LogPacket): Uint8Array;
17
- static deserialize(item: Uint8Array): LogPacket;
18
- }
@@ -1,19 +0,0 @@
1
- import { Identifier, IntoId } from "../../identifier";
2
- import { Omu } from "../../omu";
3
- import { ExtensionType } from "../extension.js";
4
- import { PermissionType } from "./permission.js";
5
- export declare const PERMISSION_EXTENSION_TYPE: ExtensionType<PermissionExtension>;
6
- export declare class PermissionExtension {
7
- private readonly omu;
8
- readonly type: ExtensionType<PermissionExtension>;
9
- private permissions;
10
- private readonly registeredPermissions;
11
- private readonly requiredPermissions;
12
- constructor(omu: Omu);
13
- private onTask;
14
- register(permission: PermissionType): void;
15
- require(...permissionIds: IntoId[]): void;
16
- request(...permissionIds: Identifier[]): Promise<void>;
17
- has(permissionIdentifier: Identifier): boolean;
18
- required(permissionIdentifier: Identifier): boolean;
19
- }
@@ -1 +0,0 @@
1
- export { PermissionType, type PermissionLevel, type PermissionMetadata } from "./permission.js";
@@ -1,25 +0,0 @@
1
- import { Identifier, IntoId } from "../../identifier";
2
- import type { LocalizedText } from "../../localization/localization.js";
3
- export type PermissionLevel = "low" | "medium" | "high";
4
- export type PermissionMetadata = {
5
- name: LocalizedText;
6
- note?: LocalizedText;
7
- level: PermissionLevel;
8
- };
9
- export type PermissionTypeJson = {
10
- id: string;
11
- metadata: PermissionMetadata;
12
- };
13
- export declare class PermissionType {
14
- readonly id: Identifier;
15
- readonly metadata: PermissionMetadata;
16
- constructor(options: {
17
- id: Identifier;
18
- metadata: PermissionMetadata;
19
- });
20
- static create(identifier: IntoId, { metadata }: {
21
- metadata: PermissionMetadata;
22
- }): PermissionType;
23
- static serialize(data: PermissionType): PermissionTypeJson;
24
- static deserialize(json: PermissionTypeJson): PermissionType;
25
- }
@@ -1,43 +0,0 @@
1
- import { Identifier } from "../../identifier";
2
- import { Omu } from "../../omu";
3
- import { ExtensionType } from "../extension.js";
4
- import { Table } from "../table/table.js";
5
- export declare const PLUGIN_EXTENSION_TYPE: ExtensionType<PluginExtension>;
6
- export declare class PluginExtension {
7
- private readonly omu;
8
- readonly type: ExtensionType<PluginExtension>;
9
- private readonly requiredPlugins;
10
- constructor(omu: Omu);
11
- getAllowedPackages(): Table<PluginPackageInfo>;
12
- reload(options: ReloadOptions): void;
13
- private onTask;
14
- require(plugins: Record<string, string | null>): void;
15
- }
16
- export declare class PluginPackageInfo {
17
- package: string;
18
- version: string;
19
- constructor(_package: string, version: string);
20
- static serialize(data: PluginPackageInfo): {
21
- package: string;
22
- version: string;
23
- };
24
- static deserialize(data: {
25
- package: string;
26
- version: string;
27
- }): PluginPackageInfo;
28
- static fromJson(json: {
29
- package: string;
30
- version: string;
31
- }): PluginPackageInfo;
32
- toJson(): {
33
- package: string;
34
- version: string;
35
- };
36
- key(): string;
37
- }
38
- export declare const PLUGIN_READ_PACKAGE_PERMISSION_ID: Identifier;
39
- export declare const PLUGIN_MANAGE_PACKAGE_PERMISSION_ID: Identifier;
40
- type ReloadOptions = {
41
- packages: string[] | null;
42
- };
43
- export {};
@@ -1,2 +0,0 @@
1
- export { PLUGIN_MANAGE_PACKAGE_PERMISSION_ID, PLUGIN_READ_PACKAGE_PERMISSION_ID, PluginPackageInfo } from "./extension.js";
2
- export type { PackageInfo } from "./package-info.js";
@@ -1,84 +0,0 @@
1
- export type Downloads = {
2
- last_day: number;
3
- last_month: number;
4
- last_week: number;
5
- };
6
- export type ProjectUrls = {
7
- "Bug Reports": string;
8
- "Funding": string;
9
- "Homepage": string;
10
- "Say Thanks!": string;
11
- "Source": string;
12
- };
13
- export type Info = {
14
- author: string;
15
- author_email: string;
16
- bugtrack_url: string | null;
17
- classifiers: string[];
18
- description: string;
19
- description_content_type: "text/markdown";
20
- docs_url: string | null;
21
- download_url: string;
22
- downloads: Downloads;
23
- home_page: string;
24
- keywords: string;
25
- license: string;
26
- maintainer: string;
27
- maintainer_email: string;
28
- name: string;
29
- package_url: string;
30
- platform: unknown;
31
- project_url: string;
32
- project_urls: ProjectUrls;
33
- release_url: string;
34
- requires_dist: string[];
35
- requires_python: string;
36
- summary: string;
37
- version: string;
38
- yanked: boolean;
39
- yanked_reason: string | null;
40
- };
41
- export type Digests = {
42
- blake2b_256: string;
43
- md5: string;
44
- sha256: string;
45
- };
46
- export type ReleasesItem = {
47
- comment_text: string;
48
- digests: Digests;
49
- downloads: string;
50
- filename: string;
51
- has_sig: boolean;
52
- md5_digest: string;
53
- packagetype: string;
54
- python_version: string;
55
- requires_python: string | null;
56
- size: number;
57
- upload_time: string;
58
- upload_time_iso_8601: string;
59
- url: string;
60
- yanked: boolean;
61
- yanked_reason: string | null;
62
- };
63
- export type Releases = {
64
- [key: string]: ReleasesItem[];
65
- };
66
- export type Urls = ReleasesItem[];
67
- export type VulnerabilitiesItem = {
68
- aliases: string[];
69
- details: string;
70
- summary: string;
71
- fixed_in: string[];
72
- id: string;
73
- link: string;
74
- source: string;
75
- withdrawn: string | null;
76
- };
77
- export type Vulnerabilities = VulnerabilitiesItem[];
78
- export type PackageInfo = {
79
- info: Info;
80
- last_serial: number;
81
- releases: Releases;
82
- urls: Urls;
83
- vulnerabilities: Vulnerabilities;
84
- };
@@ -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,2 +0,0 @@
1
- export { REGISTRY_PERMISSION_ID } from "./extension.js";
2
- export { RegistryType, type Registry, type RegistryPermissions } from "./registry.js";
@@ -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
- }