@openclaw/line 2026.5.2-beta.2 → 2026.5.3-beta.1

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 (109) hide show
  1. package/dist/accounts-UXAvdBo_.js +105 -0
  2. package/dist/api.js +11 -0
  3. package/dist/basic-cards-7DTG6E-A.js +307 -0
  4. package/dist/card-command-UlPc6Vuc.js +240 -0
  5. package/dist/channel-Rls9s60K.js +601 -0
  6. package/dist/channel-plugin-api.js +2 -0
  7. package/dist/channel.runtime-bXoj8_Sl.js +4 -0
  8. package/dist/contract-api.js +2 -0
  9. package/dist/index.js +45 -0
  10. package/dist/markdown-to-line-CCWK6PJh.js +789 -0
  11. package/dist/monitor-B4_RxHc0.js +1523 -0
  12. package/dist/monitor.runtime-DyxYlrM9.js +2 -0
  13. package/dist/outbound-media-BfhBmWq5.js +55 -0
  14. package/dist/outbound.runtime-B-luYwEB.js +2 -0
  15. package/dist/probe-D9BPzb2n.js +30 -0
  16. package/dist/probe.runtime-N91OWW1J.js +2 -0
  17. package/dist/quick-reply-fallback-HskUUWsn.js +55 -0
  18. package/dist/reply-payload-transform-CFGTs9ln.js +713 -0
  19. package/dist/runtime-api.js +277 -0
  20. package/dist/schedule-cards-BwQChTdM.js +359 -0
  21. package/dist/secret-contract-api.js +5 -0
  22. package/dist/setup-api.js +2 -0
  23. package/dist/setup-entry.js +11 -0
  24. package/dist/setup-surface-DCH7CE-y.js +281 -0
  25. package/package.json +14 -6
  26. package/api.ts +0 -11
  27. package/channel-plugin-api.ts +0 -1
  28. package/contract-api.ts +0 -5
  29. package/index.ts +0 -54
  30. package/runtime-api.ts +0 -187
  31. package/secret-contract-api.ts +0 -4
  32. package/setup-api.ts +0 -2
  33. package/setup-entry.ts +0 -9
  34. package/src/account-helpers.ts +0 -16
  35. package/src/accounts.test.ts +0 -290
  36. package/src/accounts.ts +0 -187
  37. package/src/actions.ts +0 -61
  38. package/src/auto-reply-delivery.test.ts +0 -248
  39. package/src/auto-reply-delivery.ts +0 -200
  40. package/src/bindings.ts +0 -65
  41. package/src/bot-access.ts +0 -48
  42. package/src/bot-handlers.test.ts +0 -1089
  43. package/src/bot-handlers.ts +0 -642
  44. package/src/bot-message-context.test.ts +0 -405
  45. package/src/bot-message-context.ts +0 -581
  46. package/src/bot.ts +0 -70
  47. package/src/card-command.ts +0 -347
  48. package/src/channel-access-token.ts +0 -14
  49. package/src/channel-api.ts +0 -17
  50. package/src/channel-setup-status.contract.test.ts +0 -70
  51. package/src/channel-shared.ts +0 -48
  52. package/src/channel.logout.test.ts +0 -145
  53. package/src/channel.runtime.ts +0 -3
  54. package/src/channel.sendPayload.test.ts +0 -514
  55. package/src/channel.setup.ts +0 -11
  56. package/src/channel.status.test.ts +0 -63
  57. package/src/channel.ts +0 -154
  58. package/src/config-adapter.ts +0 -29
  59. package/src/config-schema.ts +0 -57
  60. package/src/download.test.ts +0 -133
  61. package/src/download.ts +0 -87
  62. package/src/flex-templates/basic-cards.ts +0 -395
  63. package/src/flex-templates/common.ts +0 -20
  64. package/src/flex-templates/media-control-cards.ts +0 -555
  65. package/src/flex-templates/message.ts +0 -13
  66. package/src/flex-templates/schedule-cards.ts +0 -467
  67. package/src/flex-templates/types.ts +0 -22
  68. package/src/flex-templates.ts +0 -32
  69. package/src/gateway.ts +0 -129
  70. package/src/group-keys.test.ts +0 -123
  71. package/src/group-keys.ts +0 -65
  72. package/src/group-policy.ts +0 -22
  73. package/src/markdown-to-line.test.ts +0 -348
  74. package/src/markdown-to-line.ts +0 -416
  75. package/src/message-cards.test.ts +0 -204
  76. package/src/monitor.lifecycle.test.ts +0 -421
  77. package/src/monitor.runtime.ts +0 -1
  78. package/src/monitor.ts +0 -506
  79. package/src/outbound-media.test.ts +0 -189
  80. package/src/outbound-media.ts +0 -120
  81. package/src/outbound.runtime.ts +0 -12
  82. package/src/outbound.ts +0 -356
  83. package/src/probe.contract.test.ts +0 -9
  84. package/src/probe.runtime.ts +0 -1
  85. package/src/probe.ts +0 -34
  86. package/src/quick-reply-fallback.ts +0 -10
  87. package/src/reply-chunks.test.ts +0 -179
  88. package/src/reply-chunks.ts +0 -110
  89. package/src/reply-payload-transform.test.ts +0 -387
  90. package/src/reply-payload-transform.ts +0 -317
  91. package/src/rich-menu.test.ts +0 -310
  92. package/src/rich-menu.ts +0 -326
  93. package/src/runtime.ts +0 -32
  94. package/src/send.test.ts +0 -346
  95. package/src/send.ts +0 -489
  96. package/src/setup-core.ts +0 -149
  97. package/src/setup-runtime-api.ts +0 -9
  98. package/src/setup-surface.test.ts +0 -474
  99. package/src/setup-surface.ts +0 -227
  100. package/src/signature.test.ts +0 -34
  101. package/src/signature.ts +0 -24
  102. package/src/status.ts +0 -37
  103. package/src/template-messages.ts +0 -333
  104. package/src/types.ts +0 -128
  105. package/src/webhook-node.test.ts +0 -513
  106. package/src/webhook-node.ts +0 -131
  107. package/src/webhook-utils.ts +0 -10
  108. package/src/webhook.ts +0 -111
  109. package/tsconfig.json +0 -16
@@ -1,514 +0,0 @@
1
- import { describe, expect, it, vi } from "vitest";
2
- import type { OpenClawConfig, PluginRuntime } from "../api.js";
3
- import { lineConfigAdapter } from "./config-adapter.js";
4
- import { resolveLineGroupRequireMention } from "./group-policy.js";
5
- import { lineOutboundAdapter } from "./outbound.js";
6
- import { setLineRuntime } from "./runtime.js";
7
-
8
- type LineRuntimeMocks = {
9
- pushMessageLine: ReturnType<typeof vi.fn>;
10
- pushMessagesLine: ReturnType<typeof vi.fn>;
11
- pushFlexMessage: ReturnType<typeof vi.fn>;
12
- pushTemplateMessage: ReturnType<typeof vi.fn>;
13
- pushLocationMessage: ReturnType<typeof vi.fn>;
14
- pushTextMessageWithQuickReplies: ReturnType<typeof vi.fn>;
15
- createQuickReplyItems: ReturnType<typeof vi.fn>;
16
- buildTemplateMessageFromPayload: ReturnType<typeof vi.fn>;
17
- sendMessageLine: ReturnType<typeof vi.fn>;
18
- chunkMarkdownText: ReturnType<typeof vi.fn>;
19
- resolveLineAccount: ReturnType<typeof vi.fn>;
20
- resolveTextChunkLimit: ReturnType<typeof vi.fn>;
21
- };
22
-
23
- function createRuntime(): { runtime: PluginRuntime; mocks: LineRuntimeMocks } {
24
- const pushMessageLine = vi.fn(async () => ({ messageId: "m-text", chatId: "c1" }));
25
- const pushMessagesLine = vi.fn(async () => ({ messageId: "m-batch", chatId: "c1" }));
26
- const pushFlexMessage = vi.fn(async () => ({ messageId: "m-flex", chatId: "c1" }));
27
- const pushTemplateMessage = vi.fn(async () => ({ messageId: "m-template", chatId: "c1" }));
28
- const pushLocationMessage = vi.fn(async () => ({ messageId: "m-loc", chatId: "c1" }));
29
- const pushTextMessageWithQuickReplies = vi.fn(async () => ({
30
- messageId: "m-quick",
31
- chatId: "c1",
32
- }));
33
- const createQuickReplyItems = vi.fn((labels: string[]) => ({ items: labels }));
34
- const buildTemplateMessageFromPayload = vi.fn(() => ({ type: "buttons" }));
35
- const sendMessageLine = vi.fn(async () => ({ messageId: "m-media", chatId: "c1" }));
36
- const chunkMarkdownText = vi.fn((text: string) => [text]);
37
- const resolveTextChunkLimit = vi.fn(() => 123);
38
- const resolveLineAccount = vi.fn(
39
- ({ cfg, accountId }: { cfg: OpenClawConfig; accountId?: string }) => {
40
- const resolved = accountId ?? "default";
41
- const lineConfig = (cfg.channels?.line ?? {}) as {
42
- accounts?: Record<string, Record<string, unknown>>;
43
- };
44
- const accountConfig = resolved !== "default" ? (lineConfig.accounts?.[resolved] ?? {}) : {};
45
- return {
46
- accountId: resolved,
47
- config: { ...lineConfig, ...accountConfig },
48
- };
49
- },
50
- );
51
-
52
- const runtime = {
53
- channel: {
54
- line: {
55
- pushMessageLine,
56
- pushMessagesLine,
57
- pushFlexMessage,
58
- pushTemplateMessage,
59
- pushLocationMessage,
60
- pushTextMessageWithQuickReplies,
61
- createQuickReplyItems,
62
- buildTemplateMessageFromPayload,
63
- sendMessageLine,
64
- resolveLineAccount,
65
- },
66
- text: {
67
- chunkMarkdownText,
68
- resolveTextChunkLimit,
69
- },
70
- },
71
- } as unknown as PluginRuntime;
72
-
73
- return {
74
- runtime,
75
- mocks: {
76
- pushMessageLine,
77
- pushMessagesLine,
78
- pushFlexMessage,
79
- pushTemplateMessage,
80
- pushLocationMessage,
81
- pushTextMessageWithQuickReplies,
82
- createQuickReplyItems,
83
- buildTemplateMessageFromPayload,
84
- sendMessageLine,
85
- chunkMarkdownText,
86
- resolveLineAccount,
87
- resolveTextChunkLimit,
88
- },
89
- };
90
- }
91
-
92
- describe("line outbound sendPayload", () => {
93
- it("sends flex message without dropping text", async () => {
94
- const { runtime, mocks } = createRuntime();
95
- setLineRuntime(runtime);
96
- const cfg = { channels: { line: {} } } as OpenClawConfig;
97
-
98
- const payload = {
99
- text: "Now playing:",
100
- channelData: {
101
- line: {
102
- flexMessage: {
103
- altText: "Now playing",
104
- contents: { type: "bubble" },
105
- },
106
- },
107
- },
108
- };
109
-
110
- await lineOutboundAdapter.sendPayload!({
111
- to: "line:group:1",
112
- text: payload.text,
113
- payload,
114
- accountId: "default",
115
- cfg,
116
- });
117
-
118
- expect(mocks.pushFlexMessage).toHaveBeenCalledTimes(1);
119
- expect(mocks.pushMessageLine).toHaveBeenCalledWith("line:group:1", "Now playing:", {
120
- verbose: false,
121
- accountId: "default",
122
- cfg,
123
- });
124
- });
125
-
126
- it("sends template message without dropping text", async () => {
127
- const { runtime, mocks } = createRuntime();
128
- setLineRuntime(runtime);
129
- const cfg = { channels: { line: {} } } as OpenClawConfig;
130
-
131
- const payload = {
132
- text: "Choose one:",
133
- channelData: {
134
- line: {
135
- templateMessage: {
136
- type: "confirm",
137
- text: "Continue?",
138
- confirmLabel: "Yes",
139
- confirmData: "yes",
140
- cancelLabel: "No",
141
- cancelData: "no",
142
- },
143
- },
144
- },
145
- };
146
-
147
- await lineOutboundAdapter.sendPayload!({
148
- to: "line:user:1",
149
- text: payload.text,
150
- payload,
151
- accountId: "default",
152
- cfg,
153
- });
154
-
155
- expect(mocks.buildTemplateMessageFromPayload).toHaveBeenCalledTimes(1);
156
- expect(mocks.pushTemplateMessage).toHaveBeenCalledTimes(1);
157
- expect(mocks.pushMessageLine).toHaveBeenCalledWith("line:user:1", "Choose one:", {
158
- verbose: false,
159
- accountId: "default",
160
- cfg,
161
- });
162
- });
163
-
164
- it("attaches quick replies when no text chunks are present", async () => {
165
- const { runtime, mocks } = createRuntime();
166
- setLineRuntime(runtime);
167
- const cfg = { channels: { line: {} } } as OpenClawConfig;
168
-
169
- const payload = {
170
- channelData: {
171
- line: {
172
- quickReplies: ["One", "Two"],
173
- flexMessage: {
174
- altText: "Card",
175
- contents: { type: "bubble" },
176
- },
177
- },
178
- },
179
- };
180
-
181
- await lineOutboundAdapter.sendPayload!({
182
- to: "line:user:2",
183
- text: "",
184
- payload,
185
- accountId: "default",
186
- cfg,
187
- });
188
-
189
- expect(mocks.pushFlexMessage).not.toHaveBeenCalled();
190
- expect(mocks.pushMessagesLine).toHaveBeenCalledWith(
191
- "line:user:2",
192
- [
193
- {
194
- type: "flex",
195
- altText: "Card",
196
- contents: { type: "bubble" },
197
- quickReply: { items: ["One", "Two"] },
198
- },
199
- ],
200
- { verbose: false, accountId: "default", cfg },
201
- );
202
- expect(mocks.createQuickReplyItems).toHaveBeenCalledWith(["One", "Two"]);
203
- });
204
-
205
- it("sends quick-reply-only payloads with fallback text", async () => {
206
- const { runtime, mocks } = createRuntime();
207
- setLineRuntime(runtime);
208
- const cfg = { channels: { line: {} } } as OpenClawConfig;
209
-
210
- const result = await lineOutboundAdapter.sendPayload!({
211
- to: "line:user:quick",
212
- text: "",
213
- payload: {
214
- channelData: {
215
- line: {
216
- quickReplies: ["One", "Two"],
217
- },
218
- },
219
- },
220
- accountId: "default",
221
- cfg,
222
- });
223
-
224
- expect(mocks.pushTextMessageWithQuickReplies).toHaveBeenCalledWith(
225
- "line:user:quick",
226
- "Options:\n- One\n- Two",
227
- ["One", "Two"],
228
- { verbose: false, accountId: "default", cfg },
229
- );
230
- expect(result).toEqual({ channel: "line", messageId: "m-quick", chatId: "c1" });
231
- });
232
-
233
- it("sends media before quick-reply text so buttons stay visible", async () => {
234
- const { runtime, mocks } = createRuntime();
235
- setLineRuntime(runtime);
236
- const cfg = { channels: { line: {} } } as OpenClawConfig;
237
-
238
- const payload = {
239
- text: "Hello",
240
- mediaUrl: "https://example.com/img.jpg",
241
- channelData: {
242
- line: {
243
- quickReplies: ["One", "Two"],
244
- },
245
- },
246
- };
247
-
248
- await lineOutboundAdapter.sendPayload!({
249
- to: "line:user:3",
250
- text: payload.text,
251
- payload,
252
- accountId: "default",
253
- cfg,
254
- });
255
-
256
- expect(mocks.sendMessageLine).toHaveBeenCalledWith(
257
- "line:user:3",
258
- "",
259
- expect.objectContaining({
260
- verbose: false,
261
- mediaUrl: "https://example.com/img.jpg",
262
- accountId: "default",
263
- cfg,
264
- }),
265
- );
266
- expect(mocks.pushTextMessageWithQuickReplies).toHaveBeenCalledWith(
267
- "line:user:3",
268
- "Hello",
269
- ["One", "Two"],
270
- { verbose: false, accountId: "default", cfg },
271
- );
272
- const mediaOrder = mocks.sendMessageLine.mock.invocationCallOrder[0];
273
- const quickReplyOrder = mocks.pushTextMessageWithQuickReplies.mock.invocationCallOrder[0];
274
- expect(mediaOrder).toBeLessThan(quickReplyOrder);
275
- });
276
-
277
- it("keeps generic media payloads on the image-only send path", async () => {
278
- const { runtime, mocks } = createRuntime();
279
- setLineRuntime(runtime);
280
- const cfg = { channels: { line: {} } } as OpenClawConfig;
281
-
282
- await lineOutboundAdapter.sendPayload!({
283
- to: "line:user:4",
284
- text: "",
285
- payload: {
286
- mediaUrl: "https://example.com/video.mp4",
287
- },
288
- accountId: "default",
289
- cfg,
290
- });
291
-
292
- expect(mocks.sendMessageLine).toHaveBeenCalledWith("line:user:4", "", {
293
- verbose: false,
294
- mediaUrl: "https://example.com/video.mp4",
295
- accountId: "default",
296
- cfg,
297
- });
298
- });
299
-
300
- it("uses LINE-specific media options for rich media payloads", async () => {
301
- const { runtime, mocks } = createRuntime();
302
- setLineRuntime(runtime);
303
- const cfg = { channels: { line: {} } } as OpenClawConfig;
304
-
305
- await lineOutboundAdapter.sendPayload!({
306
- to: "line:user:5",
307
- text: "",
308
- payload: {
309
- mediaUrl: "https://example.com/video.mp4",
310
- channelData: {
311
- line: {
312
- mediaKind: "video",
313
- previewImageUrl: "https://example.com/preview.jpg",
314
- trackingId: "track-123",
315
- },
316
- },
317
- },
318
- accountId: "default",
319
- cfg,
320
- });
321
-
322
- expect(mocks.sendMessageLine).toHaveBeenCalledWith("line:user:5", "", {
323
- verbose: false,
324
- mediaUrl: "https://example.com/video.mp4",
325
- mediaKind: "video",
326
- previewImageUrl: "https://example.com/preview.jpg",
327
- durationMs: undefined,
328
- trackingId: "track-123",
329
- accountId: "default",
330
- cfg,
331
- });
332
- });
333
-
334
- it("uses configured text chunk limit for payloads", async () => {
335
- const { runtime, mocks } = createRuntime();
336
- setLineRuntime(runtime);
337
- const cfg = { channels: { line: { textChunkLimit: 123 } } } as OpenClawConfig;
338
-
339
- const payload = {
340
- text: "Hello world",
341
- channelData: {
342
- line: {
343
- flexMessage: {
344
- altText: "Card",
345
- contents: { type: "bubble" },
346
- },
347
- },
348
- },
349
- };
350
-
351
- await lineOutboundAdapter.sendPayload!({
352
- to: "line:user:3",
353
- text: payload.text,
354
- payload,
355
- accountId: "primary",
356
- cfg,
357
- });
358
-
359
- expect(mocks.resolveTextChunkLimit).toHaveBeenCalledWith(cfg, "line", "primary", {
360
- fallbackLimit: 5000,
361
- });
362
- expect(mocks.chunkMarkdownText).toHaveBeenCalledWith("Hello world", 123);
363
- });
364
-
365
- it("omits trackingId for non-user quick-reply inline video media", async () => {
366
- const { runtime, mocks } = createRuntime();
367
- setLineRuntime(runtime);
368
- const cfg = { channels: { line: {} } } as OpenClawConfig;
369
-
370
- const payload = {
371
- text: "",
372
- mediaUrl: "https://example.com/video.mp4",
373
- channelData: {
374
- line: {
375
- quickReplies: ["One"],
376
- mediaKind: "video" as const,
377
- previewImageUrl: "https://example.com/preview.jpg",
378
- trackingId: "track-group",
379
- },
380
- },
381
- };
382
-
383
- await lineOutboundAdapter.sendPayload!({
384
- to: "line:group:C123",
385
- text: payload.text,
386
- payload,
387
- accountId: "default",
388
- cfg,
389
- });
390
-
391
- expect(mocks.pushMessagesLine).toHaveBeenCalledWith(
392
- "line:group:C123",
393
- [
394
- {
395
- type: "video",
396
- originalContentUrl: "https://example.com/video.mp4",
397
- previewImageUrl: "https://example.com/preview.jpg",
398
- quickReply: { items: ["One"] },
399
- },
400
- ],
401
- { verbose: false, accountId: "default", cfg },
402
- );
403
- });
404
-
405
- it("keeps trackingId for user quick-reply inline video media", async () => {
406
- const { runtime, mocks } = createRuntime();
407
- setLineRuntime(runtime);
408
- const cfg = { channels: { line: {} } } as OpenClawConfig;
409
-
410
- const payload = {
411
- text: "",
412
- mediaUrl: "https://example.com/video.mp4",
413
- channelData: {
414
- line: {
415
- quickReplies: ["One"],
416
- mediaKind: "video" as const,
417
- previewImageUrl: "https://example.com/preview.jpg",
418
- trackingId: "track-user",
419
- },
420
- },
421
- };
422
-
423
- await lineOutboundAdapter.sendPayload!({
424
- to: "line:user:U123",
425
- text: payload.text,
426
- payload,
427
- accountId: "default",
428
- cfg,
429
- });
430
-
431
- expect(mocks.pushMessagesLine).toHaveBeenCalledWith(
432
- "line:user:U123",
433
- [
434
- {
435
- type: "video",
436
- originalContentUrl: "https://example.com/video.mp4",
437
- previewImageUrl: "https://example.com/preview.jpg",
438
- trackingId: "track-user",
439
- quickReply: { items: ["One"] },
440
- },
441
- ],
442
- { verbose: false, accountId: "default", cfg },
443
- );
444
- });
445
-
446
- it("rejects quick-reply inline video media without previewImageUrl", async () => {
447
- const { runtime } = createRuntime();
448
- setLineRuntime(runtime);
449
- const cfg = { channels: { line: {} } } as OpenClawConfig;
450
-
451
- const payload = {
452
- text: "",
453
- mediaUrl: "https://example.com/video.mp4",
454
- channelData: {
455
- line: {
456
- quickReplies: ["One"],
457
- mediaKind: "video" as const,
458
- },
459
- },
460
- };
461
-
462
- await expect(
463
- lineOutboundAdapter.sendPayload!({
464
- to: "line:user:U123",
465
- text: payload.text,
466
- payload,
467
- accountId: "default",
468
- cfg,
469
- }),
470
- ).rejects.toThrow(/require previewimageurl/i);
471
- });
472
- });
473
-
474
- describe("linePlugin config.formatAllowFrom", () => {
475
- it("strips line:user: prefixes without lowercasing", () => {
476
- const formatted = lineConfigAdapter.formatAllowFrom!({
477
- cfg: {} as OpenClawConfig,
478
- allowFrom: ["line:user:UABC", "line:UDEF"],
479
- });
480
- expect(formatted).toEqual(["UABC", "UDEF"]);
481
- });
482
- });
483
-
484
- describe("linePlugin groups.resolveRequireMention", () => {
485
- it("uses account-level group settings when provided", () => {
486
- const { runtime } = createRuntime();
487
- setLineRuntime(runtime);
488
-
489
- const cfg = {
490
- channels: {
491
- line: {
492
- groups: {
493
- "*": { requireMention: false },
494
- },
495
- accounts: {
496
- primary: {
497
- groups: {
498
- "group-1": { requireMention: true },
499
- },
500
- },
501
- },
502
- },
503
- },
504
- } as OpenClawConfig;
505
-
506
- const requireMention = resolveLineGroupRequireMention({
507
- cfg,
508
- accountId: "primary",
509
- groupId: "group-1",
510
- });
511
-
512
- expect(requireMention).toBe(true);
513
- });
514
- });
@@ -1,11 +0,0 @@
1
- import { type ChannelPlugin, type ResolvedLineAccount } from "./channel-api.js";
2
- import { lineChannelPluginCommon } from "./channel-shared.js";
3
- import { lineSetupAdapter } from "./setup-core.js";
4
- import { lineSetupWizard } from "./setup-surface.js";
5
-
6
- export const lineSetupPlugin: ChannelPlugin<ResolvedLineAccount> = {
7
- id: "line",
8
- ...lineChannelPluginCommon,
9
- setupWizard: lineSetupWizard,
10
- setup: lineSetupAdapter,
11
- };
@@ -1,63 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import type { ChannelAccountSnapshot } from "../api.js";
3
- import { lineStatusAdapter } from "./status.js";
4
-
5
- function collectIssues(accounts: ChannelAccountSnapshot[]) {
6
- const collect = lineStatusAdapter.collectStatusIssues;
7
- if (!collect) {
8
- throw new Error("LINE plugin status collector is unavailable");
9
- }
10
- return collect(accounts);
11
- }
12
-
13
- describe("linePlugin status.collectStatusIssues", () => {
14
- it("does not warn when a sanitized snapshot is configured", () => {
15
- expect(
16
- collectIssues([
17
- {
18
- accountId: "default",
19
- configured: true,
20
- tokenSource: "env",
21
- },
22
- ]),
23
- ).toEqual([]);
24
- });
25
-
26
- it("reports missing access token when the snapshot is unconfigured and tokenSource is none", () => {
27
- expect(
28
- collectIssues([
29
- {
30
- accountId: "default",
31
- configured: false,
32
- tokenSource: "none",
33
- },
34
- ]),
35
- ).toEqual([
36
- {
37
- channel: "line",
38
- accountId: "default",
39
- kind: "config",
40
- message: "LINE channel access token not configured",
41
- },
42
- ]);
43
- });
44
-
45
- it("reports missing secret when the snapshot is unconfigured but a token source exists", () => {
46
- expect(
47
- collectIssues([
48
- {
49
- accountId: "default",
50
- configured: false,
51
- tokenSource: "env",
52
- },
53
- ]),
54
- ).toEqual([
55
- {
56
- channel: "line",
57
- accountId: "default",
58
- kind: "config",
59
- message: "LINE channel secret not configured",
60
- },
61
- ]);
62
- });
63
- });