befly 3.18.20 → 3.18.21

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.
@@ -497,8 +497,8 @@ export function buildInsertRow(options) {
497
497
  if (options.beflyMode !== 0) {
498
498
  result["created_at"] = options.now;
499
499
  result["updated_at"] = options.now;
500
+ result["state"] = 1;
500
501
  }
501
- result["state"] = 1;
502
502
  return result;
503
503
  }
504
504
 
@@ -194,7 +194,12 @@ export const dataOpsMethods = {
194
194
 
195
195
  let processed;
196
196
  if (this.idMode === "autoId") {
197
- processed = buildInsertRow({ idMode: "autoId", data: data, now: now, beflyMode: this.beflyMode });
197
+ processed = buildInsertRow({
198
+ idMode: "autoId",
199
+ data: data,
200
+ now: now,
201
+ beflyMode: this.beflyMode
202
+ });
198
203
  } else {
199
204
  let id;
200
205
  try {
@@ -208,7 +213,13 @@ export const dataOpsMethods = {
208
213
  table: table
209
214
  });
210
215
  }
211
- processed = buildInsertRow({ idMode: "timeId", data: data, id: id, now: now, beflyMode: this.beflyMode });
216
+ processed = buildInsertRow({
217
+ idMode: "timeId",
218
+ data: data,
219
+ id: id,
220
+ now: now,
221
+ beflyMode: this.beflyMode
222
+ });
212
223
  }
213
224
 
214
225
  assertNoUndefinedInRecord(processed, `insData 插入数据 (table: ${snakeTable})`);
@@ -421,9 +432,17 @@ export const dataOpsMethods = {
421
432
  validateTableWhereOptions(options, "delData", true);
422
433
  const { table, where } = options;
423
434
 
435
+ // beflyMode=0:关闭默认 state 软删语义,delData 直接走物理删除
436
+ if (this.beflyMode === 0) {
437
+ return await this.delForce({
438
+ table: table,
439
+ where: where
440
+ });
441
+ }
442
+
424
443
  return await this.updData({
425
444
  table: table,
426
- data: this.beflyMode === 1 ? { state: 0, deleted_at: Date.now() } : { state: 0 },
445
+ data: { state: 0, deleted_at: Date.now() },
427
446
  where: where
428
447
  });
429
448
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "befly",
3
- "version": "3.18.20",
4
- "gitHead": "d8dd84c77c854770d6e42fc5849d5c2fa95452df",
3
+ "version": "3.18.21",
4
+ "gitHead": "ccc26691d98b520da6d2b524ed654da15fee427f",
5
5
  "private": false,
6
6
  "description": "Befly - 为 Bun 专属打造的 JavaScript API 接口框架核心引擎",
7
7
  "keywords": [