@openclaw/line 2026.7.2-beta.2 → 2026.7.2-beta.4
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/dist/{accounts-DJVOv1JI.js → accounts-BUBOoW5Q.js} +95 -33
- package/dist/api.js +4 -3
- package/dist/basic-cards-Rb-Ow7LN.js +307 -0
- package/dist/{card-command-DQ-epsgt.js → card-command-Ch0TwcDW.js} +2 -1
- package/dist/{channel-BHR-GoJ0.js → channel-CNcv74n2.js} +22 -10
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BBCZvRa_.js +4 -0
- package/dist/contract-api.js +1 -1
- package/dist/{flex-templates-K1lS9i8L.js → flex-templates-KiKaVYgi.js} +1 -318
- package/dist/index.js +1 -1
- package/dist/{markdown-to-line-XceqeKRP.js → markdown-to-line-DWIdzBfy.js} +224 -220
- package/dist/{monitor-Db2rZsSX.js → monitor-BinAXvIY.js} +454 -288
- package/dist/monitor.runtime-DKj4FHkA.js +2 -0
- package/dist/outbound.runtime-DRyoVa81.js +2 -0
- package/dist/quick-reply-fallback-D86FwAfr.js +56 -0
- package/dist/{reply-payload-transform-r9sa-TYT.js → reply-payload-transform-d57WYHFm.js} +3 -164
- package/dist/runtime-api.js +10 -24
- package/dist/send-receipt-CY2ey8XH.js +107 -0
- package/dist/setup-api.js +1 -1
- package/dist/{setup-surface-B7W6pwn3.js → setup-surface-Bili5gWy.js} +64 -5
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupCreateRoute.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupJobFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupJobStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBoxBorderWidth.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBoxCornerRadius.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBubble.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexIconSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexSpanSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexTextFontSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/numberOfMessagesResponse.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/postbackAction.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/subscriptionPeriodDemographic.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.js +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/event.d.ts +2 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/event.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.d.ts +24 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.d.ts +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.js +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupCreateRoute.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupJobFailedType.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupJobStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupStatus.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBoxBorderWidth.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBoxCornerRadius.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBubble.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexIconSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexSpanSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexTextFontSize.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/numberOfMessagesResponse.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/postbackAction.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/subscriptionPeriodDemographic.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/version.js +1 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/event.d.ts +2 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/event.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.d.ts +24 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.js +13 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.d.ts +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.js +1 -0
- package/node_modules/@line/bot-sdk/dist/webhook/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/lib/insight/model/getNumberOfFollowersResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/liff/model/liffScope.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupCreateRoute.ts +1 -4
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupFailedType.ts +1 -2
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupJobFailedType.ts +1 -2
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupJobStatus.ts +1 -4
- package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupStatus.ts +1 -6
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/botInfoResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBoxBorderWidth.ts +1 -6
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBoxCornerRadius.ts +1 -7
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBubble.ts +1 -7
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexIconSize.ts +1 -10
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexSpanSize.ts +1 -10
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexTextFontSize.ts +1 -10
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/getAggregationUnitNameListResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/getFollowersResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/getJoinedMembershipUsersResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/issueLinkTokenResponse.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/numberOfMessagesResponse.ts +2 -5
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/postbackAction.ts +1 -4
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/subscriptionPeriodDemographic.ts +1 -5
- package/node_modules/@line/bot-sdk/lib/version.ts +1 -1
- package/node_modules/@line/bot-sdk/lib/webhook/.openapi-generator/FILES +1 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/event.ts +2 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/messageEditedEvent.ts +32 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/models.ts +1 -0
- package/node_modules/@line/bot-sdk/lib/webhook/model/stickerMessageContent.ts +1 -1
- package/node_modules/@line/bot-sdk/package.json +3 -3
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -5
- package/node_modules/@types/node/package.json +3 -3
- package/npm-shrinkwrap.json +10 -10
- package/openclaw.plugin.json +0 -18
- package/package.json +71 -6
- package/dist/channel.runtime-DFgZ_Xwn.js +0 -4
- package/dist/monitor.runtime-CZuQgsEE.js +0 -2
- package/dist/outbound.runtime-DnpU0Cms.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as sendMessageLine, E as buildTemplateMessageFromPayload, _ as pushLocationMessage, b as pushTemplateMessage, h as pushFlexMessage, i as processLineMessage, u as createQuickReplyItems, v as pushMessageLine, x as pushTextMessageWithQuickReplies, y as pushMessagesLine } from "./markdown-to-line-DWIdzBfy.js";
|
|
2
|
+
export { buildTemplateMessageFromPayload, createQuickReplyItems, processLineMessage, pushFlexMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies, sendMessageLine };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
2
|
+
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
|
|
3
|
+
import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
5
|
+
//#region extensions/line/src/group-keys.ts
|
|
6
|
+
function resolveLineGroupLookupIds(groupId) {
|
|
7
|
+
const normalized = groupId?.trim();
|
|
8
|
+
if (!normalized) return [];
|
|
9
|
+
if (normalized.startsWith("group:") || normalized.startsWith("room:")) {
|
|
10
|
+
const rawId = normalized.split(":").slice(1).join(":");
|
|
11
|
+
return rawId ? [rawId, normalized] : [normalized];
|
|
12
|
+
}
|
|
13
|
+
return [
|
|
14
|
+
normalized,
|
|
15
|
+
`group:${normalized}`,
|
|
16
|
+
`room:${normalized}`
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
function resolveLineGroupConfigEntry(groups, params) {
|
|
20
|
+
if (!groups) return;
|
|
21
|
+
for (const candidate of resolveLineGroupLookupIds(params.groupId)) {
|
|
22
|
+
const hit = groups[candidate];
|
|
23
|
+
if (hit) return hit;
|
|
24
|
+
}
|
|
25
|
+
for (const candidate of resolveLineGroupLookupIds(params.roomId)) {
|
|
26
|
+
const hit = groups[candidate];
|
|
27
|
+
if (hit) return hit;
|
|
28
|
+
}
|
|
29
|
+
return groups["*"];
|
|
30
|
+
}
|
|
31
|
+
function resolveLineGroupsConfig(cfg, accountId) {
|
|
32
|
+
const lineConfig = cfg.channels?.line;
|
|
33
|
+
if (!lineConfig) return;
|
|
34
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
35
|
+
return resolveAccountEntry(lineConfig.accounts, normalizedAccountId)?.groups ?? lineConfig.groups;
|
|
36
|
+
}
|
|
37
|
+
function resolveExactLineGroupConfigKey(params) {
|
|
38
|
+
const { groups } = params;
|
|
39
|
+
if (!groups) return;
|
|
40
|
+
return resolveLineGroupLookupIds(params.groupId).find((candidate) => Object.hasOwn(groups, candidate));
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region extensions/line/src/runtime.ts
|
|
44
|
+
const { setRuntime: setLineRuntime, getRuntime: getLineRuntime } = createPluginRuntimeStore({
|
|
45
|
+
pluginId: "line",
|
|
46
|
+
errorMessage: "LINE runtime not initialized - plugin not registered"
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region extensions/line/src/quick-reply-fallback.ts
|
|
50
|
+
function buildLineQuickReplyFallbackText(labels) {
|
|
51
|
+
const normalized = normalizeStringEntries(labels ?? []).slice(0, 13);
|
|
52
|
+
if (normalized.length === 0) return "Choose an option.";
|
|
53
|
+
return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { resolveLineGroupConfigEntry as a, resolveExactLineGroupConfigKey as i, getLineRuntime as n, resolveLineGroupLookupIds as o, setLineRuntime as r, resolveLineGroupsConfig as s, buildLineQuickReplyFallbackText as t };
|
|
@@ -1,62 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
|
-
import { resolveAccountEntry } from "openclaw/plugin-sdk/account-resolution";
|
|
1
|
+
import { c as createAgendaCard, l as createEventCard, n as createDeviceControlCard, r as createMediaPlayerCard, t as createAppleTvRemoteCard } from "./flex-templates-KiKaVYgi.js";
|
|
4
2
|
import { normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
3
|
import { DmPolicySchema, GroupPolicySchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
|
|
6
4
|
import { requireChannelOpenAllowFrom } from "openclaw/plugin-sdk/extension-shared";
|
|
7
5
|
import { z } from "zod";
|
|
8
|
-
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
9
|
-
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
|
-
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
11
6
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
12
7
|
import { parseStrictFiniteNumber } from "openclaw/plugin-sdk/number-runtime";
|
|
13
|
-
//#region extensions/line/src/group-keys.ts
|
|
14
|
-
function resolveLineGroupLookupIds(groupId) {
|
|
15
|
-
const normalized = groupId?.trim();
|
|
16
|
-
if (!normalized) return [];
|
|
17
|
-
if (normalized.startsWith("group:") || normalized.startsWith("room:")) {
|
|
18
|
-
const rawId = normalized.split(":").slice(1).join(":");
|
|
19
|
-
return rawId ? [rawId, normalized] : [normalized];
|
|
20
|
-
}
|
|
21
|
-
return [
|
|
22
|
-
normalized,
|
|
23
|
-
`group:${normalized}`,
|
|
24
|
-
`room:${normalized}`
|
|
25
|
-
];
|
|
26
|
-
}
|
|
27
|
-
function resolveLineGroupConfigEntry(groups, params) {
|
|
28
|
-
if (!groups) return;
|
|
29
|
-
for (const candidate of resolveLineGroupLookupIds(params.groupId)) {
|
|
30
|
-
const hit = groups[candidate];
|
|
31
|
-
if (hit) return hit;
|
|
32
|
-
}
|
|
33
|
-
for (const candidate of resolveLineGroupLookupIds(params.roomId)) {
|
|
34
|
-
const hit = groups[candidate];
|
|
35
|
-
if (hit) return hit;
|
|
36
|
-
}
|
|
37
|
-
return groups["*"];
|
|
38
|
-
}
|
|
39
|
-
function resolveLineGroupsConfig(cfg, accountId) {
|
|
40
|
-
const lineConfig = cfg.channels?.line;
|
|
41
|
-
if (!lineConfig) return;
|
|
42
|
-
const normalizedAccountId = normalizeAccountId(accountId);
|
|
43
|
-
return resolveAccountEntry(lineConfig.accounts, normalizedAccountId)?.groups ?? lineConfig.groups;
|
|
44
|
-
}
|
|
45
|
-
function resolveExactLineGroupConfigKey(params) {
|
|
46
|
-
const { groups } = params;
|
|
47
|
-
if (!groups) return;
|
|
48
|
-
return resolveLineGroupLookupIds(params.groupId).find((candidate) => Object.hasOwn(groups, candidate));
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
8
|
//#region extensions/line/src/config-schema.ts
|
|
52
9
|
const ThreadBindingsSchema = z.object({
|
|
53
10
|
enabled: z.boolean().optional(),
|
|
54
11
|
idleHours: z.number().optional(),
|
|
55
12
|
maxAgeHours: z.number().optional(),
|
|
56
13
|
spawnSessions: z.boolean().optional(),
|
|
57
|
-
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
58
|
-
spawnSubagentSessions: z.boolean().optional(),
|
|
59
|
-
spawnAcpSessions: z.boolean().optional()
|
|
14
|
+
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
60
15
|
}).strict();
|
|
61
16
|
const LineCommonConfigSchemaBase = z.object({
|
|
62
17
|
enabled: z.boolean().optional(),
|
|
@@ -92,122 +47,6 @@ const LineConfigSchema = buildMultiAccountChannelSchema(LineCommonConfigSchemaBa
|
|
|
92
47
|
});
|
|
93
48
|
const LineChannelConfigSchema = buildChannelConfigSchema(LineConfigSchema);
|
|
94
49
|
//#endregion
|
|
95
|
-
//#region extensions/line/src/runtime.ts
|
|
96
|
-
const { setRuntime: setLineRuntime, getRuntime: getLineRuntime } = createPluginRuntimeStore({
|
|
97
|
-
pluginId: "line",
|
|
98
|
-
errorMessage: "LINE runtime not initialized - plugin not registered"
|
|
99
|
-
});
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region extensions/line/src/outbound-media.ts
|
|
102
|
-
const LINE_OUTBOUND_MEDIA_SSRF_POLICY = { allowPrivateNetwork: false };
|
|
103
|
-
async function validateLineMediaUrl(url) {
|
|
104
|
-
let parsed;
|
|
105
|
-
try {
|
|
106
|
-
parsed = new URL(url);
|
|
107
|
-
} catch {
|
|
108
|
-
throw new Error("LINE outbound media URL must be a valid URL");
|
|
109
|
-
}
|
|
110
|
-
if (parsed.protocol !== "https:") throw new Error("LINE outbound media URL must use HTTPS");
|
|
111
|
-
if (url.length > 2e3) throw new Error(`LINE outbound media URL must be 2000 chars or less (got ${url.length})`);
|
|
112
|
-
await resolvePinnedHostnameWithPolicy(parsed.hostname, { policy: LINE_OUTBOUND_MEDIA_SSRF_POLICY });
|
|
113
|
-
}
|
|
114
|
-
function isHttpsUrl(url) {
|
|
115
|
-
try {
|
|
116
|
-
return new URL(url).protocol === "https:";
|
|
117
|
-
} catch {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function detectLineMediaKindFromUrl(url) {
|
|
122
|
-
try {
|
|
123
|
-
const pathname = normalizeLowercaseStringOrEmpty(new URL(url).pathname);
|
|
124
|
-
if (/\.(png|jpe?g|gif|webp|bmp|heic|heif|avif)$/i.test(pathname)) return "image";
|
|
125
|
-
if (/\.(mp4|mov|m4v|webm)$/i.test(pathname)) return "video";
|
|
126
|
-
if (/\.(mp3|m4a|aac|wav|ogg|oga)$/i.test(pathname)) return "audio";
|
|
127
|
-
} catch {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
async function resolveLineOutboundMedia(mediaUrl, opts = {}) {
|
|
132
|
-
const trimmedUrl = mediaUrl.trim();
|
|
133
|
-
if (isHttpsUrl(trimmedUrl)) {
|
|
134
|
-
await validateLineMediaUrl(trimmedUrl);
|
|
135
|
-
const previewImageUrl = opts.previewImageUrl?.trim();
|
|
136
|
-
if (previewImageUrl) await validateLineMediaUrl(previewImageUrl);
|
|
137
|
-
return {
|
|
138
|
-
mediaUrl: trimmedUrl,
|
|
139
|
-
mediaKind: opts.mediaKind ?? (typeof opts.durationMs === "number" ? "audio" : void 0) ?? (opts.trackingId?.trim() ? "video" : void 0) ?? detectLineMediaKindFromUrl(trimmedUrl) ?? "image",
|
|
140
|
-
...previewImageUrl ? { previewImageUrl } : {},
|
|
141
|
-
...typeof opts.durationMs === "number" ? { durationMs: opts.durationMs } : {},
|
|
142
|
-
...opts.trackingId ? { trackingId: opts.trackingId } : {}
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
let parsed;
|
|
146
|
-
try {
|
|
147
|
-
parsed = new URL(trimmedUrl);
|
|
148
|
-
} catch {}
|
|
149
|
-
if (parsed) throw new Error("LINE outbound media URL must use HTTPS");
|
|
150
|
-
throw new Error("LINE outbound media currently requires a public HTTPS URL");
|
|
151
|
-
}
|
|
152
|
-
function isLineUserTarget(target) {
|
|
153
|
-
const normalized = target.trim().replace(/^line:(group|room|user):/i, "").replace(/^line:/i, "");
|
|
154
|
-
return /^U/i.test(normalized);
|
|
155
|
-
}
|
|
156
|
-
function hasLineSpecificMediaOptions(lineData) {
|
|
157
|
-
return lineData.mediaKind !== void 0 || Boolean(lineData.previewImageUrl?.trim()) || typeof lineData.durationMs === "number" || Boolean(lineData.trackingId?.trim());
|
|
158
|
-
}
|
|
159
|
-
function buildLineMediaMessageObject(resolved, opts) {
|
|
160
|
-
switch (resolved.mediaKind) {
|
|
161
|
-
case "video": {
|
|
162
|
-
const previewImageUrl = resolved.previewImageUrl?.trim();
|
|
163
|
-
if (!previewImageUrl) throw new Error("LINE video messages require previewImageUrl to reference an image URL");
|
|
164
|
-
return {
|
|
165
|
-
type: "video",
|
|
166
|
-
originalContentUrl: resolved.mediaUrl,
|
|
167
|
-
previewImageUrl,
|
|
168
|
-
...opts?.allowTrackingId && resolved.trackingId ? { trackingId: resolved.trackingId } : {}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
case "audio": return {
|
|
172
|
-
type: "audio",
|
|
173
|
-
originalContentUrl: resolved.mediaUrl,
|
|
174
|
-
duration: resolved.durationMs ?? 6e4
|
|
175
|
-
};
|
|
176
|
-
default: return {
|
|
177
|
-
type: "image",
|
|
178
|
-
originalContentUrl: resolved.mediaUrl,
|
|
179
|
-
previewImageUrl: resolved.previewImageUrl ?? resolved.mediaUrl
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
async function buildLineMediaMessage(mediaUrl, opts, target) {
|
|
184
|
-
return buildLineMediaMessageObject(await resolveLineOutboundMedia(mediaUrl, opts), { allowTrackingId: isLineUserTarget(target) });
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region extensions/line/src/quick-reply-fallback.ts
|
|
188
|
-
function buildLineQuickReplyFallbackText(labels) {
|
|
189
|
-
const normalized = normalizeStringEntries(labels ?? []).slice(0, 13);
|
|
190
|
-
if (normalized.length === 0) return "Choose an option.";
|
|
191
|
-
return `Options:\n${normalized.map((label) => `- ${label}`).join("\n")}`;
|
|
192
|
-
}
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region extensions/line/src/send-receipt.ts
|
|
195
|
-
function createLineSendReceipt(params) {
|
|
196
|
-
const messageId = params.messageId.trim();
|
|
197
|
-
const chatId = params.chatId.trim();
|
|
198
|
-
return createMessageReceiptFromOutboundResults({
|
|
199
|
-
results: messageId ? [{
|
|
200
|
-
channel: "line",
|
|
201
|
-
messageId,
|
|
202
|
-
chatId,
|
|
203
|
-
conversationId: chatId,
|
|
204
|
-
meta: { messageCount: params.messageCount ?? 1 }
|
|
205
|
-
}] : [],
|
|
206
|
-
...chatId ? { threadId: chatId } : {},
|
|
207
|
-
kind: params.kind ?? "unknown"
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
//#endregion
|
|
211
50
|
//#region extensions/line/src/reply-payload-transform.ts
|
|
212
51
|
/**
|
|
213
52
|
* Parse LINE-specific directives from text and extract them into ReplyPayload fields.
|
|
@@ -492,4 +331,4 @@ function hasLineDirectives(text) {
|
|
|
492
331
|
return /\[\[(quick_replies|location|confirm|buttons|media_player|event|agenda|device|appletv_remote):/i.test(text);
|
|
493
332
|
}
|
|
494
333
|
//#endregion
|
|
495
|
-
export {
|
|
334
|
+
export { LineConfigSchema as i, parseLineDirectives as n, LineChannelConfigSchema as r, hasLineDirectives as t };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
1
|
+
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-BUBOoW5Q.js";
|
|
2
|
+
import { a as resolveLineGroupConfigEntry, i as resolveExactLineGroupConfigKey, o as resolveLineGroupLookupIds, r as setLineRuntime, s as resolveLineGroupsConfig } from "./quick-reply-fallback-D86FwAfr.js";
|
|
3
|
+
import { i as LineConfigSchema, n as parseLineDirectives, r as LineChannelConfigSchema, t as hasLineDirectives } from "./reply-payload-transform-d57WYHFm.js";
|
|
4
|
+
import { a as messageAction, c as createAgendaCard, i as datetimePickerAction, l as createEventCard, n as createDeviceControlCard, o as postbackAction, r as createMediaPlayerCard, s as uriAction, t as createAppleTvRemoteCard, u as createReceiptCard } from "./flex-templates-KiKaVYgi.js";
|
|
5
|
+
import { a as createListCard, i as createInfoCard, n as createCarousel, o as createNotificationBubble, r as createImageCard, t as createActionCard } from "./basic-cards-Rb-Ow7LN.js";
|
|
6
|
+
import { A as createConfirmTemplate, C as sendMessageLine, D as createButtonMenu, E as buildTemplateMessageFromPayload, F as createTemplateCarousel, I as createYesNoConfirm, L as toFlexMessage, M as createImageCarouselColumn, N as createLinkMenu, O as createButtonTemplate, P as createProductCarousel, S as replyMessageLine, T as resolveLineChannelAccessToken, _ as pushLocationMessage, a as stripMarkdown, b as pushTemplateMessage, c as createImageMessage, d as createTextMessageWithQuickReplies, f as createVideoMessage, g as pushImageMessage, h as pushFlexMessage, i as processLineMessage, j as createImageCarousel, k as createCarouselColumn, l as createLocationMessage, m as getUserProfile, n as convertTableToFlexBubble, o as createAudioMessage, p as getUserDisplayName, r as hasMarkdownToConvert, s as createFlexMessage, t as convertCodeBlockToFlexBubble, u as createQuickReplyItems, v as pushMessageLine, w as showLoadingAnimation, x as pushTextMessageWithQuickReplies, y as pushMessagesLine } from "./markdown-to-line-DWIdzBfy.js";
|
|
7
|
+
import { a as validateLineSignature, c as normalizeAllowFrom, i as parseLineWebhookBody, n as createLineNodeWebhookHandler, o as downloadLineMedia, r as readLineWebhookRequestBody, s as firstDefined, t as monitorLineProvider } from "./monitor-BinAXvIY.js";
|
|
5
8
|
import { t as probeLineBot } from "./probe-BslD77tJ.js";
|
|
6
|
-
import { A as buildTemplateMessageFromPayload, B as createYesNoConfirm, C as pushMessagesLine, D as sendMessageLine, E as replyMessageLine, F as createImageCarousel, I as createImageCarouselColumn, L as createLinkMenu, M as createButtonTemplate, N as createCarouselColumn, O as showLoadingAnimation, P as createConfirmTemplate, R as createProductCarousel, S as pushMessageLine, T as pushTextMessageWithQuickReplies, _ as getUserDisplayName, a as extractLinks, b as pushImageMessage, c as processLineMessage, d as createFlexMessage, f as createImageMessage, g as createVideoMessage, h as createTextMessageWithQuickReplies, i as extractCodeBlocks, j as createButtonMenu, k as resolveLineChannelAccessToken, l as stripMarkdown, m as createQuickReplyItems, n as convertLinksToFlexBubble, o as extractMarkdownTables, p as createLocationMessage, r as convertTableToFlexBubble, s as hasMarkdownToConvert, t as convertCodeBlockToFlexBubble, u as createAudioMessage, v as getUserProfile, w as pushTemplateMessage, x as pushLocationMessage, y as pushFlexMessage, z as createTemplateCarousel } from "./markdown-to-line-XceqeKRP.js";
|
|
7
9
|
import { clearAccountEntryFields } from "openclaw/plugin-sdk/core";
|
|
8
10
|
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
9
|
-
import { createMessageReceiveContext } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
11
|
import { DEFAULT_ACCOUNT_ID, formatDocsLink, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
11
12
|
import { buildComputedAccountStatusSnapshot, buildTokenChannelStatusSummary } from "openclaw/plugin-sdk/status-helpers";
|
|
12
13
|
import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
13
14
|
import { messagingApi } from "@line/bot-sdk";
|
|
14
|
-
import { runDetachedWebhookWork } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
15
15
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/agent-media-payload";
|
|
16
16
|
import { mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
|
|
17
17
|
import { loadWebMediaRaw } from "openclaw/plugin-sdk/web-media";
|
|
@@ -26,13 +26,9 @@ function parseWebhookBody(rawBody) {
|
|
|
26
26
|
if (!rawBody) return null;
|
|
27
27
|
return parseLineWebhookBody(rawBody);
|
|
28
28
|
}
|
|
29
|
-
function logLineWebhookDispatchError(runtime, err) {
|
|
30
|
-
runtime?.error?.(danger(`line webhook dispatch failed: ${String(err)}`));
|
|
31
|
-
}
|
|
32
29
|
function createLineWebhookMiddleware(options) {
|
|
33
30
|
const { channelSecret, onEvents, runtime } = options;
|
|
34
31
|
return async (req, res, _next) => {
|
|
35
|
-
let receiveContext;
|
|
36
32
|
try {
|
|
37
33
|
const signature = req.headers["x-line-signature"];
|
|
38
34
|
if (!signature || typeof signature !== "string") {
|
|
@@ -58,22 +54,12 @@ function createLineWebhookMiddleware(options) {
|
|
|
58
54
|
res.status(400).json({ error: "Invalid webhook payload" });
|
|
59
55
|
return;
|
|
60
56
|
}
|
|
61
|
-
receiveContext = createMessageReceiveContext({
|
|
62
|
-
id: `${Date.now()}:line:webhook`,
|
|
63
|
-
channel: "line",
|
|
64
|
-
message: body,
|
|
65
|
-
ackPolicy: "after_receive_record",
|
|
66
|
-
onAck: () => {
|
|
67
|
-
res.status(200).json({ status: "ok" });
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
if (receiveContext.shouldAckAfter("receive_record")) await receiveContext.ack();
|
|
71
57
|
if (body.events && body.events.length > 0) {
|
|
72
58
|
logVerbose(`line: received ${body.events.length} webhook events`);
|
|
73
|
-
|
|
59
|
+
await onEvents(body);
|
|
74
60
|
}
|
|
61
|
+
res.status(200).json({ status: "ok" });
|
|
75
62
|
} catch (err) {
|
|
76
|
-
await receiveContext?.nack(err);
|
|
77
63
|
runtime?.error?.(danger(`line webhook error: ${String(err)}`));
|
|
78
64
|
if (!res.headersSent) res.status(500).json({ error: "Internal server error" });
|
|
79
65
|
}
|
|
@@ -272,4 +258,4 @@ function createDefaultMenuConfig() {
|
|
|
272
258
|
};
|
|
273
259
|
}
|
|
274
260
|
//#endregion
|
|
275
|
-
export { DEFAULT_ACCOUNT_ID, LineChannelConfigSchema, LineConfigSchema, buildChannelConfigSchema, buildComputedAccountStatusSnapshot, buildTemplateMessageFromPayload, buildTokenChannelStatusSummary, cancelDefaultRichMenu, clearAccountEntryFields, convertCodeBlockToFlexBubble,
|
|
261
|
+
export { DEFAULT_ACCOUNT_ID, LineChannelConfigSchema, LineConfigSchema, buildChannelConfigSchema, buildComputedAccountStatusSnapshot, buildTemplateMessageFromPayload, buildTokenChannelStatusSummary, cancelDefaultRichMenu, clearAccountEntryFields, convertCodeBlockToFlexBubble, convertTableToFlexBubble, createActionCard, createAgendaCard, createAppleTvRemoteCard, createAudioMessage, createButtonMenu, createButtonTemplate, createCarousel, createCarouselColumn, createConfirmTemplate, createDefaultMenuConfig, createDeviceControlCard, createEventCard, createFlexMessage, createGridLayout, createImageCard, createImageCarousel, createImageCarouselColumn, createImageMessage, createInfoCard, createLineNodeWebhookHandler, createLineWebhookMiddleware, createLinkMenu, createListCard, createLocationMessage, createMediaPlayerCard, createNotificationBubble, createProductCarousel, createQuickReplyItems, createReceiptCard, createRichMenu, createRichMenuAlias, createTemplateCarousel, createTextMessageWithQuickReplies, createVideoMessage, createYesNoConfirm, datetimePickerAction, deleteRichMenu, deleteRichMenuAlias, downloadLineMedia, firstDefined, formatDocsLink, getDefaultRichMenuId, getRichMenu, getRichMenuIdOfUser, getRichMenuList, getUserDisplayName, getUserProfile, hasLineDirectives, hasMarkdownToConvert, listLineAccountIds, messageAction, monitorLineProvider, normalizeAccountId, normalizeAllowFrom, parseLineDirectives, parseLineWebhookBody, postbackAction, probeLineBot, processLineMessage, pushFlexMessage, pushImageMessage, pushLocationMessage, pushMessageLine, pushMessagesLine, pushTemplateMessage, pushTextMessageWithQuickReplies, readLineWebhookRequestBody, replyMessageLine, resolveDefaultLineAccountId, resolveExactLineGroupConfigKey, resolveLineAccount, resolveLineChannelAccessToken, resolveLineGroupConfigEntry, resolveLineGroupLookupIds, resolveLineGroupsConfig, sendMessageLine, setDefaultRichMenu, setLineRuntime, setSetupChannelEnabled, showLoadingAnimation, splitSetupEntries, startLineWebhook, stripMarkdown, toFlexMessage, uploadRichMenuImage, uriAction, validateLineSignature };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
|
+
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
4
|
+
//#region extensions/line/src/outbound-media.ts
|
|
5
|
+
const LINE_OUTBOUND_MEDIA_SSRF_POLICY = { allowPrivateNetwork: false };
|
|
6
|
+
async function validateLineMediaUrl(url) {
|
|
7
|
+
let parsed;
|
|
8
|
+
try {
|
|
9
|
+
parsed = new URL(url);
|
|
10
|
+
} catch {
|
|
11
|
+
throw new Error("LINE outbound media URL must be a valid URL");
|
|
12
|
+
}
|
|
13
|
+
if (parsed.protocol !== "https:") throw new Error("LINE outbound media URL must use HTTPS");
|
|
14
|
+
if (url.length > 2e3) throw new Error(`LINE outbound media URL must be 2000 chars or less (got ${url.length})`);
|
|
15
|
+
await resolvePinnedHostnameWithPolicy(parsed.hostname, { policy: LINE_OUTBOUND_MEDIA_SSRF_POLICY });
|
|
16
|
+
}
|
|
17
|
+
function isHttpsUrl(url) {
|
|
18
|
+
try {
|
|
19
|
+
return new URL(url).protocol === "https:";
|
|
20
|
+
} catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function detectLineMediaKindFromUrl(url) {
|
|
25
|
+
try {
|
|
26
|
+
const pathname = normalizeLowercaseStringOrEmpty(new URL(url).pathname);
|
|
27
|
+
if (/\.(png|jpe?g|gif|webp|bmp|heic|heif|avif)$/i.test(pathname)) return "image";
|
|
28
|
+
if (/\.(mp4|mov|m4v|webm)$/i.test(pathname)) return "video";
|
|
29
|
+
if (/\.(mp3|m4a|aac|wav|ogg|oga)$/i.test(pathname)) return "audio";
|
|
30
|
+
} catch {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function resolveLineOutboundMedia(mediaUrl, opts = {}) {
|
|
35
|
+
const trimmedUrl = mediaUrl.trim();
|
|
36
|
+
if (isHttpsUrl(trimmedUrl)) {
|
|
37
|
+
await validateLineMediaUrl(trimmedUrl);
|
|
38
|
+
const previewImageUrl = opts.previewImageUrl?.trim();
|
|
39
|
+
if (previewImageUrl) await validateLineMediaUrl(previewImageUrl);
|
|
40
|
+
return {
|
|
41
|
+
mediaUrl: trimmedUrl,
|
|
42
|
+
mediaKind: opts.mediaKind ?? (typeof opts.durationMs === "number" ? "audio" : void 0) ?? (opts.trackingId?.trim() ? "video" : void 0) ?? detectLineMediaKindFromUrl(trimmedUrl) ?? "image",
|
|
43
|
+
...previewImageUrl ? { previewImageUrl } : {},
|
|
44
|
+
...typeof opts.durationMs === "number" ? { durationMs: opts.durationMs } : {},
|
|
45
|
+
...opts.trackingId ? { trackingId: opts.trackingId } : {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
let parsed;
|
|
49
|
+
try {
|
|
50
|
+
parsed = new URL(trimmedUrl);
|
|
51
|
+
} catch {}
|
|
52
|
+
if (parsed) throw new Error("LINE outbound media URL must use HTTPS");
|
|
53
|
+
throw new Error("LINE outbound media currently requires a public HTTPS URL");
|
|
54
|
+
}
|
|
55
|
+
function isLineUserTarget(target) {
|
|
56
|
+
const normalized = target.trim().replace(/^line:(group|room|user):/i, "").replace(/^line:/i, "");
|
|
57
|
+
return /^U/i.test(normalized);
|
|
58
|
+
}
|
|
59
|
+
function hasLineSpecificMediaOptions(lineData) {
|
|
60
|
+
return lineData.mediaKind !== void 0 || Boolean(lineData.previewImageUrl?.trim()) || typeof lineData.durationMs === "number" || Boolean(lineData.trackingId?.trim());
|
|
61
|
+
}
|
|
62
|
+
function buildLineMediaMessageObject(resolved, opts) {
|
|
63
|
+
switch (resolved.mediaKind) {
|
|
64
|
+
case "video": {
|
|
65
|
+
const previewImageUrl = resolved.previewImageUrl?.trim();
|
|
66
|
+
if (!previewImageUrl) throw new Error("LINE video messages require previewImageUrl to reference an image URL");
|
|
67
|
+
return {
|
|
68
|
+
type: "video",
|
|
69
|
+
originalContentUrl: resolved.mediaUrl,
|
|
70
|
+
previewImageUrl,
|
|
71
|
+
...opts?.allowTrackingId && resolved.trackingId ? { trackingId: resolved.trackingId } : {}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
case "audio": return {
|
|
75
|
+
type: "audio",
|
|
76
|
+
originalContentUrl: resolved.mediaUrl,
|
|
77
|
+
duration: resolved.durationMs ?? 6e4
|
|
78
|
+
};
|
|
79
|
+
default: return {
|
|
80
|
+
type: "image",
|
|
81
|
+
originalContentUrl: resolved.mediaUrl,
|
|
82
|
+
previewImageUrl: resolved.previewImageUrl ?? resolved.mediaUrl
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function buildLineMediaMessage(mediaUrl, opts, target) {
|
|
87
|
+
return buildLineMediaMessageObject(await resolveLineOutboundMedia(mediaUrl, opts), { allowTrackingId: isLineUserTarget(target) });
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region extensions/line/src/send-receipt.ts
|
|
91
|
+
function createLineSendReceipt(params) {
|
|
92
|
+
const messageId = params.messageId.trim();
|
|
93
|
+
const chatId = params.chatId.trim();
|
|
94
|
+
return createMessageReceiptFromOutboundResults({
|
|
95
|
+
results: messageId ? [{
|
|
96
|
+
channel: "line",
|
|
97
|
+
messageId,
|
|
98
|
+
chatId,
|
|
99
|
+
conversationId: chatId,
|
|
100
|
+
meta: { messageCount: params.messageCount ?? 1 }
|
|
101
|
+
}] : [],
|
|
102
|
+
...chatId ? { threadId: chatId } : {},
|
|
103
|
+
kind: params.kind ?? "unknown"
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
export { validateLineMediaUrl as a, resolveLineOutboundMedia as i, buildLineMediaMessage as n, hasLineSpecificMediaOptions as r, createLineSendReceipt as t };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-
|
|
1
|
+
import { n as lineSetupAdapter, t as lineSetupWizard } from "./setup-surface-Bili5gWy.js";
|
|
2
2
|
export { lineSetupAdapter, lineSetupWizard };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-
|
|
1
|
+
import { i as resolveLineAccount, n as normalizeAccountId, r as resolveDefaultLineAccountId, t as listLineAccountIds } from "./accounts-BUBOoW5Q.js";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
3
4
|
import { DEFAULT_ACCOUNT_ID, createAllowFromSection, createSetupInputPresenceValidator, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink, mergeAllowFromEntries, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
4
5
|
//#region extensions/line/src/account-helpers.ts
|
|
5
6
|
function hasLineCredentials(account) {
|
|
7
|
+
if (account.tokenStatus && account.signingSecretStatus) return account.tokenStatus !== "missing" && account.signingSecretStatus !== "missing";
|
|
6
8
|
return Boolean(account.channelAccessToken?.trim() && account.channelSecret?.trim());
|
|
7
9
|
}
|
|
8
10
|
function parseLineAllowFromId(raw) {
|
|
@@ -68,7 +70,11 @@ const lineSetupAdapter = {
|
|
|
68
70
|
validateInput: createSetupInputPresenceValidator({
|
|
69
71
|
defaultAccountOnlyEnvError: "LINE_CHANNEL_ACCESS_TOKEN can only be used for the default account.",
|
|
70
72
|
whenNotUseEnv: [{
|
|
71
|
-
someOf: [
|
|
73
|
+
someOf: [
|
|
74
|
+
"channelAccessToken",
|
|
75
|
+
"token",
|
|
76
|
+
"tokenFile"
|
|
77
|
+
],
|
|
72
78
|
message: "LINE requires channelAccessToken or --token-file (or --use-env)."
|
|
73
79
|
}, {
|
|
74
80
|
someOf: ["channelSecret", "secretFile"],
|
|
@@ -77,6 +83,7 @@ const lineSetupAdapter = {
|
|
|
77
83
|
}),
|
|
78
84
|
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
79
85
|
const typedInput = input;
|
|
86
|
+
const accessToken = typedInput.channelAccessToken ?? typedInput.token;
|
|
80
87
|
const normalizedAccountId = normalizeAccountId(accountId);
|
|
81
88
|
if (normalizedAccountId === DEFAULT_ACCOUNT_ID) return patchLineAccountConfig({
|
|
82
89
|
cfg,
|
|
@@ -89,7 +96,7 @@ const lineSetupAdapter = {
|
|
|
89
96
|
"secretFile"
|
|
90
97
|
] : void 0,
|
|
91
98
|
patch: typedInput.useEnv ? {} : {
|
|
92
|
-
...typedInput.tokenFile ? { tokenFile: typedInput.tokenFile } :
|
|
99
|
+
...typedInput.tokenFile ? { tokenFile: typedInput.tokenFile } : accessToken ? { channelAccessToken: accessToken } : {},
|
|
93
100
|
...typedInput.secretFile ? { secretFile: typedInput.secretFile } : typedInput.channelSecret ? { channelSecret: typedInput.channelSecret } : {}
|
|
94
101
|
}
|
|
95
102
|
});
|
|
@@ -98,12 +105,64 @@ const lineSetupAdapter = {
|
|
|
98
105
|
accountId: normalizedAccountId,
|
|
99
106
|
enabled: true,
|
|
100
107
|
patch: {
|
|
101
|
-
...typedInput.tokenFile ? { tokenFile: typedInput.tokenFile } :
|
|
108
|
+
...typedInput.tokenFile ? { tokenFile: typedInput.tokenFile } : accessToken ? { channelAccessToken: accessToken } : {},
|
|
102
109
|
...typedInput.secretFile ? { secretFile: typedInput.secretFile } : typedInput.channelSecret ? { channelSecret: typedInput.channelSecret } : {}
|
|
103
110
|
}
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
113
|
};
|
|
114
|
+
const lineSetupContract = defineChannelSetupContract({
|
|
115
|
+
fields: {
|
|
116
|
+
channelAccessToken: {
|
|
117
|
+
kind: "string",
|
|
118
|
+
sensitive: true,
|
|
119
|
+
cli: {
|
|
120
|
+
flags: "--channel-access-token <token>",
|
|
121
|
+
description: "LINE channel access token"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
token: {
|
|
125
|
+
kind: "string",
|
|
126
|
+
sensitive: true,
|
|
127
|
+
cli: {
|
|
128
|
+
flags: "--token <token>",
|
|
129
|
+
description: "LINE channel access token (alias)"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
channelSecret: {
|
|
133
|
+
kind: "string",
|
|
134
|
+
sensitive: true,
|
|
135
|
+
cli: {
|
|
136
|
+
flags: "--channel-secret <secret>",
|
|
137
|
+
description: "LINE channel secret"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
tokenFile: {
|
|
141
|
+
kind: "string",
|
|
142
|
+
sensitive: true,
|
|
143
|
+
cli: {
|
|
144
|
+
flags: "--token-file <path>",
|
|
145
|
+
description: "LINE access token file"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
secretFile: {
|
|
149
|
+
kind: "string",
|
|
150
|
+
sensitive: true,
|
|
151
|
+
cli: {
|
|
152
|
+
flags: "--secret-file <path>",
|
|
153
|
+
description: "LINE channel secret file"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
useEnv: {
|
|
157
|
+
kind: "boolean",
|
|
158
|
+
cli: {
|
|
159
|
+
flags: "--use-env",
|
|
160
|
+
description: "Use LINE environment credentials"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
legacyAdapter: lineSetupAdapter
|
|
165
|
+
});
|
|
107
166
|
//#endregion
|
|
108
167
|
//#region extensions/line/src/setup-surface.ts
|
|
109
168
|
const t = createSetupTranslator();
|
|
@@ -271,4 +330,4 @@ const lineSetupWizard = {
|
|
|
271
330
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false)
|
|
272
331
|
};
|
|
273
332
|
//#endregion
|
|
274
|
-
export { lineSetupAdapter as n,
|
|
333
|
+
export { hasLineCredentials as i, lineSetupAdapter as n, lineSetupContract as r, lineSetupWizard as t };
|
package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupCreateRoute.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audienceGroupCreateRoute.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupCreateRoute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"audienceGroupCreateRoute.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupCreateRoute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAClC,YAAY,GAAG,eAAe,GAAG,UAAU,GAAG,YAAY,CAAC"}
|
package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupFailedType.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audienceGroupFailedType.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupFailedType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"audienceGroupFailedType.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupFailedType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GACjC,sCAAsC,GAAG,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audienceGroupJobFailedType.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupJobFailedType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"audienceGroupJobFailedType.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupJobFailedType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,0BAA0B,GACpC,gBAAgB,GAAG,sCAAsC,CAAC"}
|
package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupJobStatus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audienceGroupJobStatus.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupJobStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"audienceGroupJobStatus.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupJobStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAChC,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC"}
|
package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupStatus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audienceGroupStatus.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"audienceGroupStatus.d.ts","sourceRoot":"","sources":["../../../../lib/manage-audience/model/audienceGroupStatus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC7B,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexBoxBorderWidth.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexBoxBorderWidth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"flexBoxBorderWidth.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexBoxBorderWidth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC5B,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC"}
|
package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBoxCornerRadius.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexBoxCornerRadius.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexBoxCornerRadius.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"flexBoxCornerRadius.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexBoxCornerRadius.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC7B,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexBubble.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexBubble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG;IAC3C,IAAI,EAAE,QAAQ,CAAC;IAEf,SAAS,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC;IACrC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,yBAAiB,UAAU,CAAC;IAC1B,KAAY,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;IAE1C,KAAY,QAAQ,
|
|
1
|
+
{"version":3,"file":"flexBubble.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexBubble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG;IAC3C,IAAI,EAAE,QAAQ,CAAC;IAEf,SAAS,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC;IACrC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,yBAAiB,UAAU,CAAC;IAC1B,KAAY,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;IAE1C,KAAY,QAAQ,GAClB,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAClE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexIconSize.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexIconSize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"flexIconSize.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexIconSize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GACtB,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexSpanSize.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexSpanSize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"flexSpanSize.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexSpanSize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GACtB,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexTextFontSize.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexTextFontSize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"flexTextFontSize.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/flexTextFontSize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAC1B,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC"}
|
package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/numberOfMessagesResponse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberOfMessagesResponse.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/numberOfMessagesResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,EAAE,wBAAwB,CAAC,UAAU,CAAC;IAC5C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,UAAU,
|
|
1
|
+
{"version":3,"file":"numberOfMessagesResponse.d.ts","sourceRoot":"","sources":["../../../../lib/messaging-api/model/numberOfMessagesResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,EAAE,wBAAwB,CAAC,UAAU,CAAC;IAC5C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,UAAU,GACpB,OAAO,GAAG,SAAS,GAAG,yBAAyB,GAAG,gBAAgB,CAAC;CACtE"}
|