@lark-apaas/db-schema-sync 0.1.24 → 0.1.25-beta.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/README.md CHANGED
@@ -89,4 +89,6 @@ export class Service {
89
89
 
90
90
  检查请求通过 `MIAODA_CANARY_HEADER` 设置泳道,默认 `prod`。显式传空字符串时省略泳道头,`ppe_` 泳道同时发送 `x-use-ppe: 1`。
91
91
 
92
+ 检查只跟踪基线中已有的 Base 和数据表。仅新增多维表格或数据表时返回 `unchanged`,`changes` 为空。同时修改已有表时,仍会报告该表的变化,包括新增字段。
93
+
92
94
  设置 `DB_SCHEMA_OUTPUT` 时使用其所在目录的 `base.ts`。原始 `base.ts` 缺失时返回 `no_baseline`。Base 与表按生成文件中的标识匹配,字段按列名匹配。字段仅调序时返回 `unchanged`。同一张表的字段名同时有增减时返回一条表级 `updated`,`before.field_names` 和 `after.field_names` 分别列出变更前后的完整字段名,各自保留 schema 中的顺序。仅新增或仅移除时按字段报告。同名字段的 Base 类型、公式或查找引用的结果类型、标量与数组之间的变化返回 `field / updated`,新旧类型分别在 `before.field_type` 和 `after.field_type`。已有文件缺少可识别的字段清单时检查失败。Base 检查失败时对应结果项包含 `status: "failed"`、空的 `changes` 和 `error`。
package/dist/check-bin.js CHANGED
@@ -258,7 +258,7 @@ function compareFields(old, next, scope) {
258
258
  function compareEntities(entity, before, after, parent, children) {
259
259
  const changes = [];
260
260
  const nameKey = entity + "_name";
261
- for (const id of [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].sort()) {
261
+ for (const id of [...before.keys()].sort()) {
262
262
  const old = before.get(id);
263
263
  const next = after.get(id);
264
264
  const scope = {
@@ -266,16 +266,16 @@ function compareEntities(entity, before, after, parent, children) {
266
266
  [entity + "_id"]: id,
267
267
  [nameKey]: (next ?? old).name
268
268
  };
269
- if (!old || !next || old.name !== next.name) {
269
+ if (!next || old.name !== next.name) {
270
270
  changes.push({
271
271
  ...scope,
272
272
  entity,
273
- action: !old ? "added" : !next ? "removed" : "renamed",
274
- before: old ? { [nameKey]: old.name } : null,
273
+ action: next ? "renamed" : "removed",
274
+ before: { [nameKey]: old.name },
275
275
  after: next ? { [nameKey]: next.name } : null
276
276
  });
277
277
  }
278
- if (old && next) changes.push(...children(old, next, scope));
278
+ if (next) changes.push(...children(old, next, scope));
279
279
  }
280
280
  return changes;
281
281
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/db-schema-sync",
3
- "version": "0.1.24",
3
+ "version": "0.1.25-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",