feishu-raw-card-to-dsl 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ztx4215_123136
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # feishu-raw-card-to-dsl
2
+
3
+ 把飞书 `im.message.get` 用 `card_msg_content_type: "raw_card_content"` 拉到的**编辑器内部 envelope**,转换成公开 [JSON Schema 2.0 卡片 DSL](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/feishu-cards/card-json-v2-structure)。
4
+
5
+ 零依赖,纯函数。
6
+
7
+ ## 为什么需要它
8
+
9
+ 飞书发送卡片用公开 DSL(JSON Schema 2.0),但同样的卡片用 `im.message.get` 拉回来时,飞书有两种内容形态可选:
10
+
11
+ | 模式 | 字段完整度 | 适合做什么 |
12
+ |---|---|---|
13
+ | `user_card_content`(默认/常用) | **有损**:等于服务端默认值的字段被剥掉 | 只读展示 |
14
+ | `raw_card_content` | 完整:保留每个原始字段 | 改完重发 |
15
+
16
+ 最痛的丢字段案例:`column.padding`。当 column 带非默认 `background_style`(比如 `red-50`、`grey-50`)时,飞书渲染会自动给 12px 内边距,但这个 12px 在 `user_card_content` 返回里**没了**。把这种 DSL 重新发出去,彩色块紧贴边缘,看起来全坏。
17
+
18
+ `raw_card_content` 解决了字段完整性问题,**但代价是返回的不是公开 DSL**:
19
+
20
+ - 每个 element 包成 `{id, tag, property: {...}}`
21
+ - 字段名是 camelCase(`textAlign` / `imageID` / `widthValue` / ...)
22
+ - padding/margin 是对象 `{top:{type:"pixels",value:12}, ...}` 而不是 `"12px ..."` 字符串
23
+ - img 用 `imageID` 指向旁路的 `json_attachment.images` 表
24
+ - markdown 内容拆成 plain_text / br / list / heading / link / text_tag / code_span / code_block / at_all / blockquote 等子元素,需要重新拼回 inline markdown 字符串
25
+ - header 包成 `tag:'card_header'`,带 `udIcon` 而不是 `icon`
26
+ - chart_spec 内部用 vega/vchart 的 camelCase(不能 snake_case)
27
+ - 大量编辑器内部字段(`disabled:false` / `actions:[]` / `showCount` / `pillShaped` / `min_lib_version` / ...)公开 schema 不接受,重发会被飞书拒
28
+
29
+ 这个库专门处理 raw envelope → 公开 DSL 的转换。基于 250+ 张真实归档卡片做回归对齐。
30
+
31
+ ## 安装
32
+
33
+ ```bash
34
+ npm install feishu-raw-card-to-dsl
35
+ # 或
36
+ pnpm add feishu-raw-card-to-dsl
37
+ ```
38
+
39
+ ## 用法
40
+
41
+ ```ts
42
+ import { rawCardToDsl, isRawCardEnvelope } from "feishu-raw-card-to-dsl";
43
+ import * as lark from "@larksuiteoapi/node-sdk";
44
+
45
+ const client = new lark.Client({ appId, appSecret });
46
+
47
+ const response = await client.im.message.get({
48
+ path: { message_id: "om_xxx" },
49
+ params: {
50
+ // @ts-expect-error SDK 类型滞后;raw_card_content 是文档化的合法值
51
+ card_msg_content_type: "raw_card_content",
52
+ },
53
+ });
54
+
55
+ const item = response.data?.items?.[0];
56
+ const rawContent = item?.body?.content;
57
+ if (typeof rawContent !== "string") throw new Error("not a card message");
58
+
59
+ const envelope = JSON.parse(rawContent);
60
+ if (!isRawCardEnvelope(envelope)) {
61
+ // 老消息 / 模板卡 / 非 raw 形态:直接用原解析结果或 fall back 到 user_card_content
62
+ console.log(envelope);
63
+ } else {
64
+ const dsl = rawCardToDsl(envelope);
65
+ // dsl 现在是 { schema:"2.0", config:{update_multi:true}, body:{...}, header:{...} },
66
+ // 可以直接用 im.message.create / patch_card / 写 .card 文件等所有标准发送路径。
67
+ console.log(JSON.stringify(dsl, null, 2));
68
+ }
69
+ ```
70
+
71
+ ## 已覆盖的元素 / 字段
72
+
73
+ 读端转换(raw → 公开 DSL)已对照真实归档对齐过的:
74
+
75
+ - **结构**:body / column_set / column / hr
76
+ - **文本**:markdown(含 plain_text / br / list / heading / blockquote / link / code_span / code_block / text_tag / at_all 子元素的 inline 还原)
77
+ - **媒体**:img(`imageID` 还原为 `img_key`、`width_height_pixels` size_value 还原为 `"Wpx Hpx"`、`aspect_ratio` 还原为 `"W:H"`)
78
+ - **header**:title / subtitle / template / padding / udIcon → standard_icon
79
+ - **互动**:button(`actionType:"link"` → `multi_url`,`actionType:"multi"` → `behaviors[]`,`action_request` callback 丢弃)、interactive_container
80
+ - **图表**:chart(`chart_spec` 子树原样保留 camelCase)
81
+ - **数据视图**:person(`userID` → `user_id`,`pillShaped` 丢弃)、input(白名单字段,editor-only 字段全丢)
82
+ - **可折叠面板**:collapsible_panel(header 的 raw 端 layout 残留 position/width/vertical_align 全丢)
83
+ - **配置**:config 强制输出 `{update_multi: true}`(cardkit 发送链路要求)
84
+ - **box 字段**:padding / margin / corner_radius / icon size 全部从对象形态转回字符串
85
+
86
+ ## 已知限制
87
+
88
+ - 转换器只管"读端":把 raw envelope 项目回公开 DSL。**不**反向:从公开 DSL 生成 raw envelope。
89
+ - 罕见 element(table、form 嵌套等)只走 generic 递归 + camelCase→snake_case,没专门处理。如果遇到飞书校验失败的字段,欢迎 issue / PR。
90
+ - `action_request` 类型的按钮 callback(cardkit entity 层的概念)在公开 DSL 里没有对应表达,会被丢弃。
91
+
92
+ ## 开发
93
+
94
+ ```bash
95
+ pnpm install
96
+ pnpm test # vitest 单测
97
+ pnpm build # 输出 dist/
98
+ ```
99
+
100
+ 测试基于真实 raw envelope fixture(`tests/fixtures/*.raw.json`),覆盖 padding / img / markdown / chart / person / input / button / header 各路径。
101
+
102
+ ## License
103
+
104
+ MIT
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Convert the editor-internal "raw_card_content" payload returned by
3
+ * `im.message.get?card_msg_content_type=raw_card_content` into the public
4
+ * JSON Schema 2.0 DSL we author and send.
5
+ *
6
+ * The raw payload differs from the public DSL in several ways:
7
+ * 1. Every node is wrapped as { id, tag, property: { ...real fields... } }.
8
+ * 2. Field names are camelCase (textAlign, backgroundStyle, imageID, ...).
9
+ * 3. Box fields (padding/margin) are objects { bottom:{type,value}, ... }
10
+ * instead of "Tpx Rpx Bpx Lpx" strings; scalar pixels (corner_radius,
11
+ * icon size) are similarly objectified.
12
+ * 4. Images carry imageID (numeric) which indexes into a separate
13
+ * json_attachment.images table to recover the real img_key.
14
+ * 5. Markdown is split into per-segment children (plain_text / link / br /
15
+ * at_all / text_tag / code_span / ...) under a wrapper element with
16
+ * originTag:'markdown'; we re-stitch them back into a single content
17
+ * string with inline markers.
18
+ * 6. Header is wrapped as `tag: 'card_header'` and its icon shows up as a
19
+ * sibling `udIcon` wrapper around an inner `ud_icon` element.
20
+ * 7. Editor mirrors the same value twice — a coarse enum (width:'auto')
21
+ * alongside a precise echo (widthValue:{type:'pixels',value:72}). We
22
+ * project the precise echo back onto the enum when it disagrees.
23
+ * 8. Most nodes carry editor defaults (disabled:false, vertical_align:
24
+ * 'top', flex_mode:'none', background_style:'default') that the public
25
+ * DSL omits. We strip them.
26
+ * 9. The whole thing is double-stringified into body.content as
27
+ * { json_card: "<stringified card>", json_attachment: { images, at_users? } }.
28
+ *
29
+ * Why we do this: the documented user_card_content path drops fields whose
30
+ * values match a server-side default (notably `column.padding` on a column
31
+ * with `background_style`), which silently breaks layouts on round-trip.
32
+ * The raw payload preserves them. We project raw -> public DSL on the read
33
+ * path so downstream code (patch_lark_card, archives, the model's mental
34
+ * model) keeps working against the only format that has a public spec.
35
+ *
36
+ * No public spec exists for the raw payload. The mapping below is sample-
37
+ * driven, derived from diffing rawCardToDsl(raw) against archived public DSL
38
+ * for ~250 cards we previously sent. When the converter encounters something
39
+ * it does not recognize, it keeps the original key/value (snake-cased) so
40
+ * downstream sees an unknown field rather than silently losing data.
41
+ */
42
+ export declare function isRawCardEnvelope(value: unknown): boolean;
43
+ export declare function rawCardToDsl(envelope: unknown): unknown;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAWH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIzD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAcvD"}
package/dist/index.js ADDED
@@ -0,0 +1,803 @@
1
+ /**
2
+ * Convert the editor-internal "raw_card_content" payload returned by
3
+ * `im.message.get?card_msg_content_type=raw_card_content` into the public
4
+ * JSON Schema 2.0 DSL we author and send.
5
+ *
6
+ * The raw payload differs from the public DSL in several ways:
7
+ * 1. Every node is wrapped as { id, tag, property: { ...real fields... } }.
8
+ * 2. Field names are camelCase (textAlign, backgroundStyle, imageID, ...).
9
+ * 3. Box fields (padding/margin) are objects { bottom:{type,value}, ... }
10
+ * instead of "Tpx Rpx Bpx Lpx" strings; scalar pixels (corner_radius,
11
+ * icon size) are similarly objectified.
12
+ * 4. Images carry imageID (numeric) which indexes into a separate
13
+ * json_attachment.images table to recover the real img_key.
14
+ * 5. Markdown is split into per-segment children (plain_text / link / br /
15
+ * at_all / text_tag / code_span / ...) under a wrapper element with
16
+ * originTag:'markdown'; we re-stitch them back into a single content
17
+ * string with inline markers.
18
+ * 6. Header is wrapped as `tag: 'card_header'` and its icon shows up as a
19
+ * sibling `udIcon` wrapper around an inner `ud_icon` element.
20
+ * 7. Editor mirrors the same value twice — a coarse enum (width:'auto')
21
+ * alongside a precise echo (widthValue:{type:'pixels',value:72}). We
22
+ * project the precise echo back onto the enum when it disagrees.
23
+ * 8. Most nodes carry editor defaults (disabled:false, vertical_align:
24
+ * 'top', flex_mode:'none', background_style:'default') that the public
25
+ * DSL omits. We strip them.
26
+ * 9. The whole thing is double-stringified into body.content as
27
+ * { json_card: "<stringified card>", json_attachment: { images, at_users? } }.
28
+ *
29
+ * Why we do this: the documented user_card_content path drops fields whose
30
+ * values match a server-side default (notably `column.padding` on a column
31
+ * with `background_style`), which silently breaks layouts on round-trip.
32
+ * The raw payload preserves them. We project raw -> public DSL on the read
33
+ * path so downstream code (patch_lark_card, archives, the model's mental
34
+ * model) keeps working against the only format that has a public spec.
35
+ *
36
+ * No public spec exists for the raw payload. The mapping below is sample-
37
+ * driven, derived from diffing rawCardToDsl(raw) against archived public DSL
38
+ * for ~250 cards we previously sent. When the converter encounters something
39
+ * it does not recognize, it keeps the original key/value (snake-cased) so
40
+ * downstream sees an unknown field rather than silently losing data.
41
+ */
42
+ export function isRawCardEnvelope(value) {
43
+ if (typeof value !== "object" || value === null)
44
+ return false;
45
+ const v = value;
46
+ return typeof v.json_card === "string" && typeof v.card_schema === "number";
47
+ }
48
+ export function rawCardToDsl(envelope) {
49
+ if (!isRawCardEnvelope(envelope))
50
+ return envelope;
51
+ const env = envelope;
52
+ let inner;
53
+ try {
54
+ inner = JSON.parse(env.json_card ?? "");
55
+ }
56
+ catch {
57
+ return envelope;
58
+ }
59
+ const ctx = {
60
+ images: env.json_attachment?.images ?? {},
61
+ atUsers: env.json_attachment?.at_users ?? {},
62
+ };
63
+ return convertRoot(inner, ctx);
64
+ }
65
+ /* ------------------------------------------------------------------ *
66
+ * Defaults / known editor-only fields
67
+ * ------------------------------------------------------------------ */
68
+ /**
69
+ * Confirmed editor residue by diffing the raw payload against ~250 archived
70
+ * public-DSL cards we authored. These have no slot in the public schema,
71
+ * either because they're editor metadata or because they duplicate a sibling
72
+ * enum (the precise *_value echo is reconciled separately).
73
+ */
74
+ const RAW_ONLY_FIELDS = new Set([
75
+ "new_body",
76
+ "source",
77
+ ]);
78
+ /**
79
+ * Tag-scoped raw-only fields. The remaining img fields (preview, transparent,
80
+ * size, corner_radius, scale_type) are kept; archive samples show authors
81
+ * write them explicitly.
82
+ */
83
+ const IMG_RAW_ONLY_FIELDS = new Set([
84
+ "compact_width",
85
+ "mode",
86
+ ]);
87
+ /**
88
+ * Per-tag default values that the public DSL routinely omits even though raw
89
+ * always emits them. Confirmed by diffing rawCardToDsl(raw) against archives
90
+ * we authored: cards either left these out entirely or wrote a different
91
+ * value, so dropping the noisy defaults closes the gap. Other ostensibly
92
+ * "default-looking" fields (direction, vertical_align, horizontal_align)
93
+ * are kept verbatim — many of our archived cards write them explicitly even
94
+ * when they match the editor default, and dropping them would produce
95
+ * spurious "missing field" diffs.
96
+ */
97
+ /**
98
+ * Per-tag editor-default drops. We only list fields the public DSL definitely
99
+ * never reads back. Layout fields (text_align / vertical_align / flex_mode /
100
+ * background_style) look defaultable but archive convention varies — some
101
+ * card vintages write the default explicitly. We pass them through verbatim
102
+ * because, from a patch-link perspective, an extra field on the projected
103
+ * working copy is harmless (Read sees more, find/replace doesn't fail),
104
+ * whereas a missing field that the archived snapshot expected would break
105
+ * downstream comparisons or surprise a model that authored against the
106
+ * complete shape.
107
+ *
108
+ * collapsible_panel.header carries raw editor-only layout fields (position,
109
+ * width, vertical_align) the archived public DSL never writes; those are
110
+ * dropped under their explicit owner tag below.
111
+ */
112
+ const TAG_DEFAULT_DROPS = {
113
+ column: {
114
+ disabled: false,
115
+ },
116
+ column_set: {
117
+ disabled: false,
118
+ horizontal_spacing: "default",
119
+ },
120
+ button: {
121
+ disabled: false,
122
+ },
123
+ interactive_container: {
124
+ disabled: false,
125
+ },
126
+ };
127
+ /**
128
+ * Maps a `*_value` echo field to the sibling enum it should reconcile with.
129
+ * Both are dropped after reconciliation; the public DSL keeps only the enum
130
+ * field with a string-pixel value when the echo disagreed with the enum.
131
+ */
132
+ const VALUE_ECHO_TARGETS = {
133
+ horizontal_spacing_value: "horizontal_spacing",
134
+ vertical_spacing_value: "vertical_spacing",
135
+ width_value: "width",
136
+ height_value: "height",
137
+ corner_radius_value: "corner_radius",
138
+ size_value: "size",
139
+ };
140
+ /* ------------------------------------------------------------------ *
141
+ * Entry points
142
+ * ------------------------------------------------------------------ */
143
+ function convertRoot(root, ctx) {
144
+ if (!isRecord(root))
145
+ return root;
146
+ const out = {};
147
+ if (typeof root.schema === "string")
148
+ out.schema = root.schema;
149
+ out.config = convertConfig(isRecord(root.config) ? root.config : {});
150
+ if (isRecord(root.body))
151
+ out.body = convertBody(root.body, ctx);
152
+ if (isRecord(root.header))
153
+ out.header = convertHeader(root.header, ctx);
154
+ return out;
155
+ }
156
+ /**
157
+ * Public DSL config the cardkit send path expects: { update_multi: true }.
158
+ * Raw carries editor-only flags (convertVersion / enableForwardInteraction /
159
+ * streamingMode) that the public schema doesn't read; we drop them and
160
+ * synthesize update_multi:true, which is the invariant the cardkit entity
161
+ * create/update path requires (see card-actions.ts:194-198 lint rule).
162
+ *
163
+ * Some archived cards happen to record the editor flags instead of
164
+ * update_multi — that's a quirk of how those cards were saved, not what the
165
+ * public DSL means. The projection above matches what we'd send today.
166
+ */
167
+ function convertConfig(_node) {
168
+ return { update_multi: true };
169
+ }
170
+ function convertHeader(node, ctx) {
171
+ const property = isRecord(node.property) ? node.property : {};
172
+ const out = convertProperty(property, "header", ctx);
173
+ // Raw stashes the header icon as `udIcon` (an editor-only wrapper around
174
+ // a standard_icon). Projection happens via convertField; here we just
175
+ // verify the rename landed correctly.
176
+ return out;
177
+ }
178
+ function convertBody(node, ctx) {
179
+ const property = isRecord(node.property) ? node.property : {};
180
+ return convertProperty(property, "body", ctx);
181
+ }
182
+ function unwrap(node, ctx) {
183
+ const tag = typeof node.tag === "string" ? node.tag : undefined;
184
+ const property = isRecord(node.property) ? node.property : {};
185
+ if (tag === "markdown")
186
+ return rebuildMarkdown(property, ctx);
187
+ // plain_text leaf used inside title/subtitle/alt/hover_tips/button.text/etc.
188
+ // The public DSL keeps only { tag:'plain_text', content }; everything else
189
+ // is editor metadata for layout.
190
+ if (tag === "plain_text") {
191
+ const content = typeof property.content === "string" ? property.content : "";
192
+ return { tag: "plain_text", content };
193
+ }
194
+ // standard_icon used inside button / header / column action.
195
+ // Public shape: { tag:'standard_icon', token, color?, size? }.
196
+ // Raw also ships imageID (fallback render asset, drop), horizontalPadding
197
+ // (editor-only), and a precise widthValue+heightValue pair the public DSL
198
+ // collapses into a single "Wpx Hpx" size string.
199
+ if (tag === "standard_icon") {
200
+ const out = { tag: "standard_icon" };
201
+ if (typeof property.token === "string")
202
+ out.token = property.token;
203
+ if (typeof property.color === "string")
204
+ out.color = property.color;
205
+ const widthPx = isPixelScalar(property.widthValue)
206
+ ? pixelOf(property.widthValue)
207
+ : undefined;
208
+ const heightPx = isPixelScalar(property.heightValue)
209
+ ? pixelOf(property.heightValue)
210
+ : undefined;
211
+ if (widthPx !== undefined && heightPx !== undefined) {
212
+ out.size = `${widthPx}px ${heightPx}px`;
213
+ }
214
+ else if (isRecord(property.size) && hasSide(property.size))
215
+ out.size = formatBox(property.size);
216
+ else if (isPixelScalar(property.size))
217
+ out.size = `${pixelOf(property.size)}px`;
218
+ else if (typeof property.size === "string")
219
+ out.size = property.size;
220
+ return out;
221
+ }
222
+ // ud_icon is the editor's wrapper for header icons. The public DSL
223
+ // reads it back as a standard_icon — only the token survives.
224
+ if (tag === "ud_icon") {
225
+ const token = typeof property.token === "string" ? property.token : undefined;
226
+ const out = { tag: "standard_icon" };
227
+ if (token)
228
+ out.token = token;
229
+ return out;
230
+ }
231
+ // chart tag. Public shape: { tag:'chart', color_theme?, preview?, chart_spec }.
232
+ // chart_spec is a vchart/vega specification whose field names (xField,
233
+ // yField, bandWidth, cornerRadius, ...) MUST stay camelCase — vega is the
234
+ // chart engine, not flexible cardspec. Raw also carries minLibVersion which
235
+ // the public schema rejects.
236
+ if (tag === "chart") {
237
+ const out = { tag: "chart" };
238
+ if (typeof property.colorTheme === "string")
239
+ out.color_theme = property.colorTheme;
240
+ if (typeof property.preview === "boolean")
241
+ out.preview = property.preview;
242
+ if (property.chartSpec !== undefined)
243
+ out.chart_spec = property.chartSpec;
244
+ // minLibVersion / preview defaults / etc. drop intentionally.
245
+ return out;
246
+ }
247
+ // input tag. The public schema is strict — many editor-only fields
248
+ // (actions, autoResize, disabled:false, showCount, showIcon) cause
249
+ // "unknown property" errors. We allowlist the fields we've seen on
250
+ // archived cards. `required:false` is the editor default and the public
251
+ // schema rejects it on input outside a form context, so we drop the
252
+ // default and keep only an explicit true.
253
+ if (tag === "input") {
254
+ const allow = new Set(["name", "placeholder", "default_value", "value",
255
+ "label", "label_position", "margin", "max_length", "input_type", "width"]);
256
+ const out = { tag: "input" };
257
+ const converted = convertProperty(property, "input", ctx);
258
+ for (const [k, v] of Object.entries(converted)) {
259
+ if (allow.has(k))
260
+ out[k] = v;
261
+ }
262
+ if (converted.required === true)
263
+ out.required = true;
264
+ return out;
265
+ }
266
+ // person tag (used inside columns to render a user avatar/name).
267
+ // Public shape: { tag:'person', user_id, size?, show_avatar?, show_name?, style? }.
268
+ // Raw also ships pillShaped which the public schema rejects ("unknown
269
+ // property pill_shaped"), so we drop it.
270
+ if (tag === "person") {
271
+ const out = { tag: "person" };
272
+ if (typeof property.userID === "string")
273
+ out.user_id = property.userID;
274
+ else if (typeof property.user_id === "string")
275
+ out.user_id = property.user_id;
276
+ if (typeof property.size === "string")
277
+ out.size = property.size;
278
+ if (typeof property.showAvatar === "boolean")
279
+ out.show_avatar = property.showAvatar;
280
+ if (typeof property.showName === "boolean")
281
+ out.show_name = property.showName;
282
+ if (typeof property.style === "string")
283
+ out.style = property.style;
284
+ return out;
285
+ }
286
+ const converted = convertProperty(property, tag, ctx);
287
+ return tag ? { tag, ...converted } : converted;
288
+ }
289
+ /* ------------------------------------------------------------------ *
290
+ * Per-property walker
291
+ * ------------------------------------------------------------------ */
292
+ const DROP = Symbol("drop");
293
+ function convertProperty(property, ownerTag, ctx) {
294
+ const out = {};
295
+ // Capture sibling-disambiguation fields up-front so per-field rules can use
296
+ // them (button.actions needs button.actionType to decide multi_url vs
297
+ // behaviors; the value is then dropped by the regular `action_type` rule).
298
+ const siblings = {
299
+ buttonActionType: ownerTag === "button" && typeof property.actionType === "string"
300
+ ? property.actionType
301
+ : undefined,
302
+ };
303
+ // First pass: convert each field individually.
304
+ for (const [rawKey, rawValue] of Object.entries(property)) {
305
+ const result = convertField(rawKey, rawValue, ownerTag, ctx, siblings);
306
+ if (result === DROP)
307
+ continue;
308
+ const [outKey, outValue] = result;
309
+ if (outValue === DROP)
310
+ continue;
311
+ out[outKey] = outValue;
312
+ }
313
+ // Reconcile *_value echoes onto the sibling enum, then drop the echo.
314
+ // The editor mirrors a precise value next to a coarse enum:
315
+ // - widthValue:{type:'pixels',value:72} alongside width:'auto'
316
+ // - widthValue:{type:'builtin_width',value:'default'} (no enum sibling)
317
+ // - horizontalSpacingValue:{type:'pixels',value:6} alongside horizontal_spacing:'default'
318
+ // Public DSL keeps just the enum slot, holding a string-pixel ("6px") or a
319
+ // keyword ("default"). When the echo carries genuinely new info (a pixel
320
+ // count, or a builtin keyword the enum doesn't yet hold), fold it in.
321
+ for (const [echoKey, enumKey] of Object.entries(VALUE_ECHO_TARGETS)) {
322
+ if (!(echoKey in out))
323
+ continue;
324
+ const echoVal = out[echoKey];
325
+ const enumVal = out[enumKey];
326
+ delete out[echoKey];
327
+ if (!isRecord(echoVal))
328
+ continue;
329
+ const echoType = typeof echoVal.type === "string" ? echoVal.type : "";
330
+ const echoValue = echoVal.value;
331
+ // Pixel echo: project as "Npx" when the enum slot is missing or coarse.
332
+ if (echoType.includes("pixels") && typeof echoValue === "number") {
333
+ if (enumVal === undefined ||
334
+ enumVal === "default" ||
335
+ enumVal === "auto" ||
336
+ enumVal === "weighted") {
337
+ out[enumKey] = `${echoValue}px`;
338
+ }
339
+ continue;
340
+ }
341
+ // Aspect-ratio echo (img.size_value): { type:'aspect_ratio', value:{height,width} }.
342
+ // Public DSL writes "W:H" verbatim on img.size.
343
+ if (echoType === "aspect_ratio" && isRecord(echoValue)) {
344
+ const w = echoValue.width;
345
+ const h = echoValue.height;
346
+ if (typeof w === "number" && typeof h === "number") {
347
+ out["size"] = `${w}:${h}`;
348
+ }
349
+ continue;
350
+ }
351
+ // Width/height pixel pair (img.size_value): { type:'width_height_pixels', value:{width,height} }.
352
+ // Public DSL writes "Wpx Hpx" on img.size — load-bearing for grid layouts;
353
+ // when these images are dropped to "no explicit size" the renderer auto-sizes
354
+ // each cell independently and the grid loses its row alignment.
355
+ if (echoType === "width_height_pixels" && isRecord(echoValue)) {
356
+ const w = echoValue.width;
357
+ const h = echoValue.height;
358
+ if (typeof w === "number" && typeof h === "number") {
359
+ out["size"] = `${w}px ${h}px`;
360
+ }
361
+ continue;
362
+ }
363
+ // Builtin keyword echo (e.g. builtin_width:"default"): use the value
364
+ // verbatim when the enum slot is missing. img.size_value of
365
+ // "builtin_image_size:stretch" is the editor default that archives
366
+ // never write — drop it instead of synthesizing size:"stretch".
367
+ if (echoType === "builtin_image_size")
368
+ continue;
369
+ if (echoType.startsWith("builtin_") && typeof echoValue === "string") {
370
+ if (enumVal === undefined)
371
+ out[enumKey] = echoValue;
372
+ continue;
373
+ }
374
+ // column_width_weighted echoes are redundant with width:'weighted' / weight, drop.
375
+ }
376
+ // Drop per-tag editor defaults.
377
+ if (ownerTag && TAG_DEFAULT_DROPS[ownerTag]) {
378
+ const defaults = TAG_DEFAULT_DROPS[ownerTag];
379
+ for (const [k, defVal] of Object.entries(defaults)) {
380
+ if (out[k] === defVal)
381
+ delete out[k];
382
+ }
383
+ }
384
+ return out;
385
+ }
386
+ function convertField(rawKey, rawValue, ownerTag, ctx, siblings = {}) {
387
+ if (rawKey === "originTag" || rawKey === "markdownElements")
388
+ return DROP;
389
+ const key = snake(rawKey);
390
+ if (RAW_ONLY_FIELDS.has(key))
391
+ return DROP;
392
+ // `actions: []` is the raw editor's "no click action wired up" placeholder.
393
+ // The public DSL omits it. Non-empty actions arrays are kept and remapped
394
+ // by per-tag rules below.
395
+ if (key === "actions" && Array.isArray(rawValue) && rawValue.length === 0) {
396
+ return DROP;
397
+ }
398
+ // Box fields (padding / margin): { top, right, bottom, left } → "Tpx Rpx Bpx Lpx".
399
+ if ((key === "padding" || key === "margin") && isRecord(rawValue) && hasSide(rawValue)) {
400
+ return [key, formatBox(rawValue)];
401
+ }
402
+ // *_value echo fields: keep the raw object until reconciliation can fold
403
+ // it back onto the sibling enum. Reconciliation runs in convertProperty
404
+ // after every field has been visited.
405
+ if (key in VALUE_ECHO_TARGETS) {
406
+ return [key, rawValue];
407
+ }
408
+ // Other scalar pixel objects (corner_radius, icon size, etc.) get folded
409
+ // into a "Npx" string immediately.
410
+ if (isPixelScalar(rawValue)) {
411
+ return [key, `${pixelOf(rawValue)}px`];
412
+ }
413
+ // img: imageID -> img_key (resolve via attachment table).
414
+ if (ownerTag === "img" && key === "image_id") {
415
+ const id = typeof rawValue === "string" || typeof rawValue === "number" ? String(rawValue) : undefined;
416
+ const origin = id !== undefined ? ctx.images[id]?.origin_key : undefined;
417
+ if (origin)
418
+ return ["img_key", origin];
419
+ return [key, rawValue];
420
+ }
421
+ if (ownerTag === "img" && IMG_RAW_ONLY_FIELDS.has(key))
422
+ return DROP;
423
+ // alt / hover_tips / button.text / column header text: nested plain_text.
424
+ if ((key === "alt" || key === "hover_tips") && isRecord(rawValue) && rawValue.tag === "plain_text") {
425
+ const p = isRecord(rawValue.property) ? rawValue.property : {};
426
+ return [key, { tag: "plain_text", content: typeof p.content === "string" ? p.content : "" }];
427
+ }
428
+ // button.text, interactive_container hover_tips: same plain_text leaf treatment.
429
+ if (key === "text" && isRecord(rawValue) && rawValue.tag === "plain_text") {
430
+ const p = isRecord(rawValue.property) ? rawValue.property : {};
431
+ return [key, { tag: "plain_text", content: typeof p.content === "string" ? p.content : "" }];
432
+ }
433
+ // header.udIcon → header.icon (rebuilt as standard_icon). The udIcon
434
+ // wrapper in raw is { id, tag:'ud_icon', property:{ imageID, token, style } };
435
+ // in public DSL this lives at header.icon as { tag:'standard_icon', token }.
436
+ if (ownerTag === "header" && key === "ud_icon" && isRecord(rawValue) && rawValue.tag === "ud_icon") {
437
+ const p = isRecord(rawValue.property) ? rawValue.property : {};
438
+ const token = typeof p.token === "string" ? p.token : undefined;
439
+ if (!token)
440
+ return DROP;
441
+ return ["icon", { tag: "standard_icon", token }];
442
+ }
443
+ // collapsible_panel.header is a plain bag (not tag/property wrapped). Its
444
+ // raw shape carries layout fields the public DSL never reads — drop them.
445
+ if (ownerTag === "collapsible_panel" && key === "header" && isRecord(rawValue)) {
446
+ const cleaned = {};
447
+ for (const [k, v] of Object.entries(rawValue)) {
448
+ const sk = snake(k);
449
+ // editor-only layout residue inside a collapsible_panel header.
450
+ if (sk === "position" || sk === "width" || sk === "vertical_align")
451
+ continue;
452
+ const sub = convertField(k, v, "collapsible_panel_header", ctx, siblings);
453
+ if (sub === DROP)
454
+ continue;
455
+ const [subKey, subVal] = sub;
456
+ if (subVal === DROP)
457
+ continue;
458
+ cleaned[subKey] = subVal;
459
+ }
460
+ return [key, cleaned];
461
+ }
462
+ // button.actions → behaviors / multi_url. Raw distinguishes:
463
+ // actionType:"multi" + actions:[{action:{url},type:"open_url"}]
464
+ // -> behaviors:[{type:"open_url", default_url:url, pc_url, ios_url, android_url}]
465
+ // actionType:"link" + actions:[{action:{url},type:"open_url"}]
466
+ // -> multi_url:{url, pc_url, ios_url, android_url}
467
+ // action_request callbacks live above the DSL (cardkit entity handles
468
+ // them via card_id-stamped buttons); we drop them.
469
+ // The `actionType` field is editor-internal, dropped after dispatch.
470
+ if (ownerTag === "button" && key === "action_type")
471
+ return DROP;
472
+ if (ownerTag === "button" && key === "actions" && Array.isArray(rawValue)) {
473
+ const openUrls = [];
474
+ for (const a of rawValue) {
475
+ if (!isRecord(a))
476
+ continue;
477
+ const inner = isRecord(a.action) ? a.action : {};
478
+ const t = typeof a.type === "string" ? a.type : undefined;
479
+ if (t === "open_url" && typeof inner.url === "string")
480
+ openUrls.push(inner.url);
481
+ // action_request callbacks belong to the cardkit entity layer; drop.
482
+ }
483
+ if (openUrls.length === 0)
484
+ return DROP;
485
+ if (siblings.buttonActionType === "link") {
486
+ return ["multi_url", { url: openUrls[0] }];
487
+ }
488
+ // Default to behaviors (matches actionType:"multi" and the more common shape).
489
+ return [
490
+ "behaviors",
491
+ openUrls.map((url) => ({ type: "open_url", default_url: url })),
492
+ ];
493
+ }
494
+ // interactive_container.actions: { action:{ url }, type:'open_url' }
495
+ // -> [{ type:'open_url', url }] (matches the public DSL on interactive_container).
496
+ if (ownerTag === "interactive_container" && key === "actions" && Array.isArray(rawValue)) {
497
+ const acts = rawValue.map((a) => {
498
+ if (!isRecord(a))
499
+ return a;
500
+ const inner = isRecord(a.action) ? a.action : {};
501
+ const t = typeof a.type === "string" ? a.type : undefined;
502
+ if (t === "open_url" && typeof inner.url === "string") {
503
+ return { type: "open_url", url: inner.url };
504
+ }
505
+ return convertGeneric(a, ctx);
506
+ });
507
+ return [key, acts];
508
+ }
509
+ // border: { borderColor, cornerRadius:{type,value} } -> { color, corner_radius:"Npx" }
510
+ if (key === "border" && isRecord(rawValue)) {
511
+ const b = rawValue;
512
+ const out = {};
513
+ if (typeof b.borderColor === "string")
514
+ out.color = b.borderColor;
515
+ else if (typeof b.color === "string")
516
+ out.color = b.color;
517
+ if (isPixelScalar(b.cornerRadius))
518
+ out.corner_radius = `${pixelOf(b.cornerRadius)}px`;
519
+ else if (typeof b.cornerRadius === "string")
520
+ out.corner_radius = b.cornerRadius;
521
+ else if (b.cornerRadius !== undefined)
522
+ out.corner_radius = b.cornerRadius;
523
+ // Pass through other border keys verbatim (snake_cased) for forward-compat.
524
+ for (const [bk, bv] of Object.entries(b)) {
525
+ if (bk === "borderColor" || bk === "cornerRadius" || bk === "color")
526
+ continue;
527
+ out[snake(bk)] = convertGeneric(bv, ctx);
528
+ }
529
+ return [key, out];
530
+ }
531
+ // url object on link / open_url: { url, androidURL, iosURL, pcURL, harmonyURL }.
532
+ if (key === "url" && isRecord(rawValue)) {
533
+ const v = rawValue;
534
+ const main = typeof v.url === "string" ? v.url : "";
535
+ const others = ["androidURL", "iosURL", "pcURL", "harmonyURL"]
536
+ .map((k) => v[k])
537
+ .filter((x) => typeof x === "string" && x.length > 0);
538
+ if (others.length === 0)
539
+ return [key, main];
540
+ return [
541
+ key,
542
+ {
543
+ url: main,
544
+ android_url: typeof v.androidURL === "string" ? v.androidURL : "",
545
+ ios_url: typeof v.iosURL === "string" ? v.iosURL : "",
546
+ pc_url: typeof v.pcURL === "string" ? v.pcURL : "",
547
+ },
548
+ ];
549
+ }
550
+ // markdown.icon (in form columns) lives under a column.markdown wrapper —
551
+ // generic recursion handles it via unwrap.
552
+ // Generic recursion for everything else.
553
+ return [key, convertGeneric(rawValue, ctx)];
554
+ }
555
+ /* ------------------------------------------------------------------ *
556
+ * Markdown re-stitch
557
+ * ------------------------------------------------------------------ */
558
+ /**
559
+ * Markdown elements in raw split the original source string across multiple
560
+ * children: plain_text segments (optionally with bold/color), at_all, br,
561
+ * link, code_span, text_tag, etc. We re-stitch them into a single content
562
+ * string with inline markdown markers — bold (asterisk asterisk), font tag,
563
+ * link, code span, br -> newline, at -> at-tag.
564
+ */
565
+ function rebuildMarkdown(property, ctx) {
566
+ const out = { tag: "markdown" };
567
+ const elements = Array.isArray(property.elements) ? property.elements : [];
568
+ let content = "";
569
+ for (const child of elements) {
570
+ if (!isRecord(child))
571
+ continue;
572
+ content += childToMarkdown(child, ctx);
573
+ }
574
+ if (content)
575
+ out.content = content;
576
+ for (const [rawKey, rawValue] of Object.entries(property)) {
577
+ if (rawKey === "elements" || rawKey === "markdownElements" || rawKey === "originTag")
578
+ continue;
579
+ // Raw markdown ships both `icon` (standard_icon) and `udIcon` (ud_icon)
580
+ // pointing at the same token. The public DSL keeps only `icon`. Drop the
581
+ // udIcon shadow.
582
+ if (rawKey === "udIcon")
583
+ continue;
584
+ if (rawKey === "textStyle") {
585
+ // Project textStyle.size onto a flat text_size field. raw mirrors it
586
+ // as platformSize too, but size is the canonical anchor.
587
+ const ts = isRecord(rawValue) ? rawValue : {};
588
+ const size = typeof ts.size === "string" ? ts.size : undefined;
589
+ if (size)
590
+ out.text_size = size;
591
+ continue;
592
+ }
593
+ const result = convertField(rawKey, rawValue, "markdown", ctx);
594
+ if (result === DROP)
595
+ continue;
596
+ const [outKey, outValue] = result;
597
+ if (outValue === DROP)
598
+ continue;
599
+ out[outKey] = outValue;
600
+ }
601
+ return out;
602
+ }
603
+ function childToMarkdown(child, ctx) {
604
+ const tag = child.tag;
605
+ const prop = isRecord(child.property) ? child.property : {};
606
+ switch (tag) {
607
+ case "plain_text": {
608
+ let out = typeof prop.content === "string" ? prop.content : "";
609
+ const ts = isRecord(prop.textStyle) ? prop.textStyle : undefined;
610
+ const color = ts && typeof ts.color === "string" ? ts.color : undefined;
611
+ const attrs = ts && Array.isArray(ts.attributes) ? ts.attributes : [];
612
+ if (attrs.includes("bold"))
613
+ out = `**${out}**`;
614
+ if (color)
615
+ out = `<font color='${color}'>${out}</font>`;
616
+ return out;
617
+ }
618
+ case "br":
619
+ return "\n";
620
+ case "at_all":
621
+ // @-all in raw uses an at_users entry keyed "all". The public mention
622
+ // syntax for everyone is <at id=all></at>.
623
+ return "<at id=all></at>";
624
+ case "at": {
625
+ // Single-user @: raw stores user_id under the property; if it
626
+ // references the at_users attachment table, pull it from there.
627
+ const userId = typeof prop.userId === "string" ? prop.userId
628
+ : typeof prop.user_id === "string" ? prop.user_id
629
+ : (() => {
630
+ const key = typeof prop.atUserKey === "string" ? prop.atUserKey : undefined;
631
+ if (key && ctx.atUsers[key])
632
+ return ctx.atUsers[key].user_id;
633
+ return undefined;
634
+ })();
635
+ return userId ? `<at id=${userId}></at>` : "<at></at>";
636
+ }
637
+ case "link": {
638
+ const text = typeof prop.content === "string" ? prop.content : "";
639
+ const urlObj = isRecord(prop.url) ? prop.url : undefined;
640
+ const url = urlObj && typeof urlObj.url === "string" ? urlObj.url : "";
641
+ return `[${text}](${url})`;
642
+ }
643
+ case "code_span": {
644
+ const text = typeof prop.content === "string" ? prop.content : "";
645
+ return `\`${text}\``;
646
+ }
647
+ case "text_tag": {
648
+ const color = typeof prop.color === "string" ? prop.color : undefined;
649
+ const inner = isRecord(prop.text) ? prop.text : undefined;
650
+ const innerProp = inner && isRecord(inner.property) ? inner.property : undefined;
651
+ const innerContent = innerProp && typeof innerProp.content === "string" ? innerProp.content : "";
652
+ if (color)
653
+ return `<text_tag color='${color}'>${innerContent}</text_tag>`;
654
+ return `<text_tag>${innerContent}</text_tag>`;
655
+ }
656
+ case "code_block": {
657
+ const lang = typeof prop.language === "string" ? prop.language : "";
658
+ const blocks = Array.isArray(prop.contents) ? prop.contents : [];
659
+ let body = "";
660
+ for (const blk of blocks) {
661
+ if (!isRecord(blk))
662
+ continue;
663
+ const inner = Array.isArray(blk.contents) ? blk.contents : [];
664
+ for (const seg of inner) {
665
+ if (isRecord(seg) && typeof seg.content === "string")
666
+ body += seg.content;
667
+ }
668
+ }
669
+ return `\n\`\`\`${lang}\n${body}\`\`\`\n`;
670
+ }
671
+ case "list": {
672
+ // raw list: { items: [{ elements:[plain_text...], level:0|1|..., type:'ul'|'ol' }] }
673
+ // Project to inline markdown bullets / numbers, level*2-space indent.
674
+ // We emit a leading "\n" only — the upstream br/plain_text in the
675
+ // sibling stream contributes its own newline, which stacks to the
676
+ // archived convention of "...prev_line\n\n- bullet".
677
+ const items = Array.isArray(prop.items) ? prop.items : [];
678
+ const lines = [];
679
+ let counter = 0;
680
+ let lastType;
681
+ for (const item of items) {
682
+ if (!isRecord(item))
683
+ continue;
684
+ const level = typeof item.level === "number" ? item.level : 0;
685
+ const type = typeof item.type === "string" ? item.type : "ul";
686
+ if (type !== lastType)
687
+ counter = 0;
688
+ lastType = type;
689
+ const indent = " ".repeat(level);
690
+ const inner = Array.isArray(item.elements) ? item.elements : [];
691
+ let text = "";
692
+ for (const seg of inner) {
693
+ if (!isRecord(seg))
694
+ continue;
695
+ text += childToMarkdown(seg, ctx);
696
+ }
697
+ if (type === "ol") {
698
+ counter += 1;
699
+ lines.push(`${indent}${counter}. ${text}`);
700
+ }
701
+ else {
702
+ lines.push(`${indent}- ${text}`);
703
+ }
704
+ }
705
+ return `\n${lines.join("\n")}`;
706
+ }
707
+ case "heading": {
708
+ // raw heading: { property: { elements:[plain_text...], level:1|2|3|... } }
709
+ // Public DSL writes "# " / "## " / "### " inline.
710
+ const level = typeof prop.level === "number" ? prop.level : 1;
711
+ const inner = Array.isArray(prop.elements) ? prop.elements : [];
712
+ let body = "";
713
+ for (const seg of inner) {
714
+ if (isRecord(seg))
715
+ body += childToMarkdown(seg, ctx);
716
+ }
717
+ return `${"#".repeat(level)} ${body}`;
718
+ }
719
+ case "blockquote": {
720
+ const inner = Array.isArray(prop.elements) ? prop.elements : [];
721
+ let body = "";
722
+ for (const seg of inner) {
723
+ if (isRecord(seg))
724
+ body += childToMarkdown(seg, ctx);
725
+ }
726
+ // archive convention: blockquote sits on its own paragraph, with a "> "
727
+ // prefix on every line and blank lines on both sides. Raw doesn't emit
728
+ // br around blockquote, so we supply both breaks ourselves.
729
+ return `\n\n> ${body.replace(/\n/g, "\n> ")}\n\n`;
730
+ }
731
+ default:
732
+ // Unknown leaf — render its `content` if any, else nothing. We don't
733
+ // throw, since raw may add new inline element types.
734
+ return typeof prop.content === "string" ? prop.content : "";
735
+ }
736
+ }
737
+ /* ------------------------------------------------------------------ *
738
+ * Generic recursion + helpers
739
+ * ------------------------------------------------------------------ */
740
+ function convertGeneric(value, ctx) {
741
+ if (Array.isArray(value)) {
742
+ return value.map((item) => {
743
+ if (isRecord(item) && typeof item.tag === "string" && isRecord(item.property)) {
744
+ return unwrap(item, ctx);
745
+ }
746
+ return convertGeneric(item, ctx);
747
+ });
748
+ }
749
+ if (isRecord(value)) {
750
+ if (typeof value.tag === "string" && isRecord(value.property)) {
751
+ return unwrap(value, ctx);
752
+ }
753
+ // Box-shaped object at a generic depth: format it.
754
+ if (hasSide(value)) {
755
+ return formatBox(value);
756
+ }
757
+ if (isPixelScalar(value)) {
758
+ return `${pixelOf(value)}px`;
759
+ }
760
+ const out = {};
761
+ for (const [k, v] of Object.entries(value)) {
762
+ out[snake(k)] = convertGeneric(v, ctx);
763
+ }
764
+ return out;
765
+ }
766
+ return value;
767
+ }
768
+ function isRecord(v) {
769
+ return typeof v === "object" && v !== null && !Array.isArray(v);
770
+ }
771
+ function hasSide(v) {
772
+ return ("top" in v || "bottom" in v || "left" in v || "right" in v) &&
773
+ Object.values(v).some((side) => isRecord(side) && "type" in side && "value" in side);
774
+ }
775
+ function formatBox(v) {
776
+ return `${pixelOf(v.top)}px ${pixelOf(v.right)}px ${pixelOf(v.bottom)}px ${pixelOf(v.left)}px`;
777
+ }
778
+ function isPixelScalar(v) {
779
+ if (!isRecord(v))
780
+ return false;
781
+ return typeof v.type === "string" && v.type.includes("pixels") && typeof v.value === "number";
782
+ }
783
+ function pixelOf(side) {
784
+ if (!isRecord(side))
785
+ return 0;
786
+ const v = side.value;
787
+ if (typeof v === "number")
788
+ return v;
789
+ if (typeof v === "string") {
790
+ const n = Number(v);
791
+ return Number.isFinite(n) ? n : 0;
792
+ }
793
+ return 0;
794
+ }
795
+ function snake(key) {
796
+ return key
797
+ .replace(/ID$/g, "_id")
798
+ .replace(/URL$/g, "_url")
799
+ .replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2")
800
+ .replace(/([a-z\d])([A-Z])/g, "$1_$2")
801
+ .toLowerCase();
802
+ }
803
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAWH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,OAAO,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAiB;IAC5C,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAClD,MAAM,GAAG,GAAG,QAAuB,CAAC;IACpC,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,GAAG,GAAQ;QACf,MAAM,EAAE,GAAG,CAAC,eAAe,EAAE,MAAM,IAAI,EAAE;QACzC,OAAO,EAAE,GAAG,CAAC,eAAe,EAAE,QAAQ,IAAI,EAAE;KAC7C,CAAC;IACF,OAAO,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAOD;;wEAEwE;AAExE;;;;;GAKG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS;IACtC,UAAU;IACV,QAAQ;CACT,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,mB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,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,KAAK,CAAC,GAAW;IACxB,OAAO,GAAG;SACP,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC;SACxB,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC;SACrC,WAAW,EAAE,CAAC;AACnB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "feishu-raw-card-to-dsl",
3
+ "version": "0.1.0",
4
+ "description": "把飞书 im.message.get 的 raw_card_content 编辑器内部 envelope 转换为公开 JSON Schema 2.0 DSL,规避 user_card_content 丢失 column.padding 等字段的问题",
5
+ "keywords": [
6
+ "feishu",
7
+ "lark",
8
+ "card",
9
+ "im",
10
+ "card-dsl"
11
+ ],
12
+ "type": "module",
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.json",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "prepublishOnly": "pnpm build && pnpm test"
31
+ },
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/<TODO>/feishu-raw-card-to-dsl.git"
39
+ },
40
+ "devDependencies": {
41
+ "typescript": "^5.8.3",
42
+ "vitest": "^2.1.8"
43
+ }
44
+ }