@zhin.js/adapter-lark 1.1.17 → 1.1.19

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 (46) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +13 -2
  3. package/adapters/lark/index.js +3 -17
  4. package/adapters/lark/index.ts +2 -17
  5. package/commands/lark/endpoint/definition.js +0 -2
  6. package/commands/lark/endpoint/definition.ts +0 -2
  7. package/lib/adapter.d.ts +19 -0
  8. package/lib/adapter.js +29 -0
  9. package/lib/client.d.ts +95 -11
  10. package/lib/client.js +657 -2
  11. package/lib/console-spec.d.ts +12 -0
  12. package/lib/console-spec.js +13 -0
  13. package/lib/console.d.ts +8 -0
  14. package/lib/console.js +13 -0
  15. package/lib/endpoint.d.ts +11 -102
  16. package/lib/endpoint.js +26 -671
  17. package/lib/index.d.ts +4 -2
  18. package/lib/index.js +3 -2
  19. package/lib/long-connection.d.ts +1 -1
  20. package/lib/long-connection.js +1 -1
  21. package/lib/media-upload.d.ts +5 -1
  22. package/lib/media-upload.js +6 -6
  23. package/lib/protocol.d.ts +1 -1
  24. package/lib/protocol.js +1 -1
  25. package/lib/sdk-http.d.ts +4 -0
  26. package/lib/sdk-http.js +88 -0
  27. package/lib/webhook.d.ts +1 -1
  28. package/lib/webhook.js +1 -1
  29. package/package.json +26 -18
  30. package/pages/index/index.js +15 -0
  31. package/pages/index/index.ts +16 -0
  32. package/plugin.js +3 -4
  33. package/src/adapter.ts +30 -0
  34. package/src/client.ts +726 -10
  35. package/src/console-spec.ts +18 -0
  36. package/src/console.ts +18 -0
  37. package/src/endpoint.ts +29 -749
  38. package/src/index.ts +4 -3
  39. package/src/long-connection.ts +2 -2
  40. package/src/media-upload.ts +10 -5
  41. package/src/protocol.ts +2 -2
  42. package/src/sdk-http.ts +65 -0
  43. package/src/webhook.ts +2 -2
  44. package/lib/lark-runtime-state.d.ts +0 -1
  45. package/lib/lark-runtime-state.js +0 -6
  46. package/src/lark-runtime-state.ts +0 -7
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Lark Console 页面元数据(浏览器与服务端共享;不要在这里 import 服务端代码)。
3
+ */
4
+ import type { AdapterConsoleField } from 'zhin.js/adapter';
5
+
6
+ export const larkConsoleSpec = {
7
+ adapterKey: 'lark',
8
+ adapterDisplayName: 'Lark',
9
+ fields: [
10
+ { key: 'appId', required: true, env: true, description: '飞书 App ID', descriptionI18n: { en: 'Lark app ID' } },
11
+ { key: 'appSecret', required: true, env: true, description: '飞书 App Secret', descriptionI18n: { en: 'Lark app secret' } },
12
+ { key: 'encryptKey', env: true, description: '事件加密 key', descriptionI18n: { en: 'Event encryption key' } },
13
+ { key: 'verificationToken', env: true, description: '事件验证 token', descriptionI18n: { en: 'Event verification token' } },
14
+ ] as readonly AdapterConsoleField[],
15
+ docsUrl: 'https://zhin.js.org/adapters/lark',
16
+ readPermission: 'lark:read',
17
+ writePermission: 'lark:write',
18
+ } as const;
package/src/console.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Lark Console RPC:运行状态 + endpoint 增删(原 `lark endpoint` 聊天命令)。
3
+ *
4
+ * 页面绑定 `pages/index`,读取 / 写入分别要求 `<adapter>:read` / `<adapter>:write`。
5
+ */
6
+ import { createAdapterConsoleRpc, type AdapterConsoleResources } from 'zhin.js/adapter';
7
+ import type { PluginConsoleRpc } from 'zhin.js';
8
+ import { larkConsoleSpec } from './console-spec.js';
9
+
10
+ export function createLarkConsoleRpc(
11
+ _resources: AdapterConsoleResources,
12
+ getConfig: () => unknown,
13
+ ): PluginConsoleRpc {
14
+ return createAdapterConsoleRpc({
15
+ ...larkConsoleSpec,
16
+ getConfig,
17
+ });
18
+ }