@saltify/milky-node-sdk 0.1.0-beta.1 → 0.1.0-beta.3

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  这是 Milky 协议的 Node.js SDK,提供 TypeScript 支持。
4
4
 
5
+ 源码中使用了 Node.js 的 WebSocket API,因此需要 Node 版本高于 22。如果必须在低于 22 的版本中使用,请在启动时加入 `--experimental-websocket` 这一 Flag。
6
+
5
7
  ## 初始化
6
8
 
7
9
  ```typescript
package/dist/index.d.ts CHANGED
@@ -16,12 +16,12 @@ type ApiCollection = {
16
16
  get_csrf_token: () => types.GetCSRFTokenOutput;
17
17
  send_private_message: (input: z.input<typeof types.SendPrivateMessageInput>) => types.SendPrivateMessageOutput;
18
18
  send_group_message: (input: z.input<typeof types.SendGroupMessageInput>) => types.SendGroupMessageOutput;
19
+ recall_private_message: (input: z.input<typeof types.RecallPrivateMessageInput>) => void;
20
+ recall_group_message: (input: z.input<typeof types.RecallGroupMessageInput>) => void;
19
21
  get_message: (input: z.input<typeof types.GetMessageInput>) => types.GetMessageOutput;
20
22
  get_history_messages: (input: z.input<typeof types.GetHistoryMessagesInput>) => types.GetHistoryMessagesOutput;
21
23
  get_resource_temp_url: (input: z.input<typeof types.GetResourceTempUrlInput>) => types.GetResourceTempUrlOutput;
22
24
  get_forwarded_messages: (input: z.input<typeof types.GetForwardedMessagesInput>) => types.GetForwardedMessagesOutput;
23
- recall_private_message: (input: z.input<typeof types.RecallPrivateMessageInput>) => void;
24
- recall_group_message: (input: z.input<typeof types.RecallGroupMessageInput>) => void;
25
25
  mark_message_as_read: (input: z.input<typeof types.MarkMessageAsReadInput>) => void;
26
26
  send_friend_nudge: (input: z.input<typeof types.SendFriendNudgeInput>) => void;
27
27
  send_profile_like: (input: z.input<typeof types.SendProfileLikeInput>) => void;
package/dist/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  // src/index.ts
2
2
  import EventEmitter from "events";
3
+ if (typeof globalThis.WebSocket === "undefined") {
4
+ console.error("WebSocket is not supported in this environment.");
5
+ process.exit(1);
6
+ }
3
7
  var MilkyClient = class {
4
8
  /**
5
9
  * @param address The address of the Milky API server
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saltify/milky-node-sdk",
3
3
  "type": "module",
4
- "version": "0.1.0-beta.1",
4
+ "version": "0.1.0-beta.3",
5
5
  "description": "Node.js SDK for Milky protocol",
6
6
  "main": "dist/index.js",
7
7
  "typings": "dist/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "@types/node": "^22.17.2"
20
20
  },
21
21
  "dependencies": {
22
- "@saltify/milky-types": "^1.0.0-draft.6",
22
+ "@saltify/milky-types": "^1.0.0-draft.9",
23
23
  "zod": "^4.0.17"
24
24
  },
25
25
  "scripts": {