@alloy-framework/client-wasm 0.1.0

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.
@@ -0,0 +1,174 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class AlloyClient {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ decrypt_custom(key: string, data: string): string;
8
+ /**
9
+ * Smart DELETE Request
10
+ */
11
+ delete(path: string, encrypt_enabled?: boolean | null): Promise<any>;
12
+ encrypt_custom(key: string, data: string): string;
13
+ /**
14
+ * Smart GET Request (encrypt_query: defaults to true)
15
+ */
16
+ get(path: string, encrypt_enabled?: boolean | null): Promise<any>;
17
+ constructor(master_secret: string);
18
+ /**
19
+ * Smart PATCH Request
20
+ */
21
+ patch(path: string, json_body: any, encrypt_enabled?: boolean | null): Promise<any>;
22
+ /**
23
+ * Smart POST Request
24
+ */
25
+ post(path: string, json_body: any, encrypt_enabled?: boolean | null): Promise<any>;
26
+ /**
27
+ * Smart PUT Request
28
+ */
29
+ put(path: string, json_body: any, encrypt_enabled?: boolean | null): Promise<any>;
30
+ uuid(): string;
31
+ }
32
+
33
+ /**
34
+ * πŸ“‘ AlloySocket β€” WASM 기반 WebSocket ν΄λΌμ΄μ–ΈνŠΈ
35
+ *
36
+ * 이벀트 기반 λ©”μ‹œμ§€ ({ type, data }) ꡬ쑰λ₯Ό μ‚¬μš©ν•˜λ©°,
37
+ * λ©”μ‹œμ§€ μ•”ν˜Έν™”, μžλ™ Ping, 슀마트 μž¬μ—°κ²°μ„ μ§€μ›ν•©λ‹ˆλ‹€.
38
+ */
39
+ export class AlloySocket {
40
+ free(): void;
41
+ [Symbol.dispose](): void;
42
+ /**
43
+ * πŸ”Œ μ„œλ²„ μ—°κ²°
44
+ */
45
+ connect(): void;
46
+ /**
47
+ * πŸ”Œ λͺ…μ‹œμ  μ—°κ²° μ’…λ£Œ
48
+ */
49
+ disconnect(): void;
50
+ /**
51
+ * πŸ” μ—°κ²° μƒνƒœ 확인
52
+ */
53
+ is_connected(): boolean;
54
+ /**
55
+ * πŸ“‘ AlloySocket μƒμ„±μž
56
+ *
57
+ * @param url - WebSocket μ„œλ²„ μ£Όμ†Œ (예: "ws://localhost:3000/ws")
58
+ * @param master_secret - λ©”μ‹œμ§€ μ•”ν˜Έν™” ν‚€
59
+ * @param encrypt_enabled - μ•”ν˜Έν™” ν™œμ„±ν™” μ—¬λΆ€ (κΈ°λ³Έ: false)
60
+ */
61
+ constructor(url: string, master_secret: string, encrypt_enabled?: boolean | null);
62
+ /**
63
+ * πŸ“© 이벀트 ν•Έλ“€λŸ¬ 등둝
64
+ *
65
+ * @param event_type - 이벀트 νƒ€μž… (예: "connect", "message", "disconnect", "chat")
66
+ * @param callback - JS 콜백 ν•¨μˆ˜
67
+ */
68
+ on(event_type: string, callback: Function): void;
69
+ /**
70
+ * πŸ“¨ 이벀트 기반 λ©”μ‹œμ§€ 전솑
71
+ *
72
+ * @param event_type - 이벀트 νƒ€μž… (예: "chat", "sync")
73
+ * @param data - 전솑할 데이터 (JS 객체)
74
+ */
75
+ send(event_type: string, data: any): void;
76
+ /**
77
+ * βš™οΈ μžλ™ μž¬μ—°κ²° ν™œμ„±ν™”/λΉ„ν™œμ„±ν™”
78
+ */
79
+ set_auto_reconnect(enabled: boolean): void;
80
+ /**
81
+ * βš™οΈ μ΅œλŒ€ μž¬μ—°κ²° μ‹œλ„ 횟수 μ„€μ •
82
+ */
83
+ set_max_reconnect_attempts(count: number): void;
84
+ /**
85
+ * βš™οΈ Ping μ£ΌκΈ° μ„€μ • (λ°€λ¦¬μ΄ˆ)
86
+ */
87
+ set_ping_interval(ms: number): void;
88
+ }
89
+
90
+ export class AlloyUtil {
91
+ private constructor();
92
+ free(): void;
93
+ [Symbol.dispose](): void;
94
+ /**
95
+ * Find items > threshold (Example of complex filter)
96
+ */
97
+ static filter_gt(list: Int32Array, threshold: number): Int32Array;
98
+ static md5(input: string): string;
99
+ static sha256(input: string): string;
100
+ /**
101
+ * Shuffle a large array of integers (Fisher-Yates)
102
+ * Much faster than JS sort(() => 0.5 - Math.random())
103
+ */
104
+ static shuffle_i32(list: Int32Array): Int32Array;
105
+ /**
106
+ * High performance sort
107
+ */
108
+ static sort_i32(list: Int32Array): Int32Array;
109
+ }
110
+
111
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
112
+
113
+ export interface InitOutput {
114
+ readonly memory: WebAssembly.Memory;
115
+ readonly __wbg_alloyclient_free: (a: number, b: number) => void;
116
+ readonly __wbg_alloysocket_free: (a: number, b: number) => void;
117
+ readonly __wbg_alloyutil_free: (a: number, b: number) => void;
118
+ readonly alloyclient_decrypt_custom: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
119
+ readonly alloyclient_delete: (a: number, b: number, c: number, d: number) => number;
120
+ readonly alloyclient_encrypt_custom: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
121
+ readonly alloyclient_get: (a: number, b: number, c: number, d: number) => number;
122
+ readonly alloyclient_new: (a: number, b: number, c: number) => void;
123
+ readonly alloyclient_patch: (a: number, b: number, c: number, d: number, e: number) => number;
124
+ readonly alloyclient_post: (a: number, b: number, c: number, d: number, e: number) => number;
125
+ readonly alloyclient_put: (a: number, b: number, c: number, d: number, e: number) => number;
126
+ readonly alloyclient_uuid: (a: number, b: number) => void;
127
+ readonly alloysocket_connect: (a: number, b: number) => void;
128
+ readonly alloysocket_disconnect: (a: number) => void;
129
+ readonly alloysocket_is_connected: (a: number) => number;
130
+ readonly alloysocket_new: (a: number, b: number, c: number, d: number, e: number) => number;
131
+ readonly alloysocket_on: (a: number, b: number, c: number, d: number) => void;
132
+ readonly alloysocket_send: (a: number, b: number, c: number, d: number, e: number) => void;
133
+ readonly alloysocket_set_auto_reconnect: (a: number, b: number) => void;
134
+ readonly alloysocket_set_max_reconnect_attempts: (a: number, b: number) => void;
135
+ readonly alloysocket_set_ping_interval: (a: number, b: number) => void;
136
+ readonly alloyutil_filter_gt: (a: number, b: number, c: number, d: number) => void;
137
+ readonly alloyutil_md5: (a: number, b: number, c: number) => void;
138
+ readonly alloyutil_sha256: (a: number, b: number, c: number) => void;
139
+ readonly alloyutil_shuffle_i32: (a: number, b: number, c: number) => void;
140
+ readonly alloyutil_sort_i32: (a: number, b: number, c: number) => void;
141
+ readonly __wasm_bindgen_func_elem_87: (a: number, b: number) => void;
142
+ readonly __wasm_bindgen_func_elem_665: (a: number, b: number) => void;
143
+ readonly __wasm_bindgen_func_elem_713: (a: number, b: number, c: number, d: number) => void;
144
+ readonly __wasm_bindgen_func_elem_88: (a: number, b: number, c: number) => void;
145
+ readonly __wasm_bindgen_func_elem_666: (a: number, b: number, c: number) => void;
146
+ readonly __wasm_bindgen_func_elem_92: (a: number, b: number) => void;
147
+ readonly __wbindgen_export: (a: number, b: number) => number;
148
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
149
+ readonly __wbindgen_export3: (a: number) => void;
150
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
151
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
152
+ }
153
+
154
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
155
+
156
+ /**
157
+ * Instantiates the given `module`, which can either be bytes or
158
+ * a precompiled `WebAssembly.Module`.
159
+ *
160
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
161
+ *
162
+ * @returns {InitOutput}
163
+ */
164
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
165
+
166
+ /**
167
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
168
+ * for everything else, calls `WebAssembly.instantiate` directly.
169
+ *
170
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
171
+ *
172
+ * @returns {Promise<InitOutput>}
173
+ */
174
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;