nicot 1.3.6 → 1.3.8

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-CN.md CHANGED
@@ -16,6 +16,25 @@ NICOT 是一个 *Entity-Driven* 的全自动 REST 后端框架。
16
16
 
17
17
  ---
18
18
 
19
+ ## 测试
20
+
21
+ 当前测试默认连接本机 PostgreSQL:
22
+
23
+ - 地址:`localhost:5432`
24
+ - 用户名:`postgres`
25
+ - 密码:`postgres`
26
+ - 数据库:`postgres`
27
+
28
+ 可以直接用项目内的测试 compose 启动:
29
+
30
+ ```bash
31
+ docker compose -f tests/docker-compose.yml up -d
32
+ ```
33
+
34
+ 由于 `tests/fulltext.spec.ts` 会使用 `@QueryFullText({ parser: 'zhparser' })`,这里不是普通 `postgres` 镜像,而是带 `zhparser` 扩展的 `zhparser/zhparser:bookworm-16`。
35
+
36
+ ---
37
+
19
38
  ## 快速示例
20
39
 
21
40
  ```ts
package/README.md CHANGED
@@ -52,6 +52,22 @@ NICOT targets:
52
52
  - NestJS ^9 / ^10 / ^11
53
53
  - TypeORM ^0.3.x
54
54
 
55
+ ## Testing
56
+
57
+ The test suite expects PostgreSQL on `localhost:5432` with:
58
+
59
+ - username: `postgres`
60
+ - password: `postgres`
61
+ - database: `postgres`
62
+
63
+ Bring up the test database with:
64
+
65
+ ```bash
66
+ docker compose -f tests/docker-compose.yml up -d
67
+ ```
68
+
69
+ This project's full-text tests use `@QueryFullText({ parser: 'zhparser' })`, so the test compose uses `zhparser/zhparser:bookworm-16` instead of the plain `postgres` image.
70
+
55
71
  ---
56
72
 
57
73
  ## Quick Start
package/dist/index.cjs CHANGED
@@ -674,6 +674,7 @@ __export(index_exports, {
674
674
  getTransactionalRepositoryToken: () => getTransactionalRepositoryToken
675
675
  });
676
676
  module.exports = __toCommonJS(index_exports);
677
+ var import_reflect_metadata = require("reflect-metadata");
677
678
  __reExport(index_exports, require("nesties"), module.exports);
678
679
 
679
680
  // src/dto/import-entry.ts
@@ -2361,7 +2362,7 @@ var CrudBase = class {
2361
2362
  ent,
2362
2363
  (0, import_lodash4.omit)(_ent, ...this._typeormRelations.map((r) => r.propertyName))
2363
2364
  );
2364
- const invalidReason = ent.isValidInCreate();
2365
+ const invalidReason = ent.isValidInCreate?.();
2365
2366
  if (invalidReason) {
2366
2367
  throw new import_nesties11.BlankReturnMessageDto(400, invalidReason).toException();
2367
2368
  }
@@ -2586,7 +2587,7 @@ var CrudBase = class {
2586
2587
  let result;
2587
2588
  const ent = new this.entityClass();
2588
2589
  Object.assign(ent, entPart);
2589
- const invalidReason = ent.isValidInUpdate();
2590
+ const invalidReason = ent.isValidInUpdate?.();
2590
2591
  if (invalidReason) {
2591
2592
  throw new import_nesties11.BlankReturnMessageDto(400, invalidReason).toException();
2592
2593
  }
@@ -2626,7 +2627,7 @@ var CrudBase = class {
2626
2627
  ent,
2627
2628
  (0, import_lodash4.omit)(_ent, ...this._typeormRelations.map((r) => r.propertyName))
2628
2629
  );
2629
- const invalidReason = ent.isValidInUpsert();
2630
+ const invalidReason = ent.isValidInUpsert?.();
2630
2631
  if (invalidReason) {
2631
2632
  throw new import_nesties11.BlankReturnMessageDto(400, invalidReason).toException();
2632
2633
  }
@@ -2761,7 +2762,7 @@ var CrudBase = class {
2761
2762
  const invalidResults = import_lodash4.default.compact(
2762
2763
  await Promise.all(
2763
2764
  ents.map(async (ent) => {
2764
- const reason = ent.isValidInCreate();
2765
+ const reason = ent.isValidInCreate?.();
2765
2766
  if (reason) {
2766
2767
  return { entry: ent, result: reason };
2767
2768
  }