@tachybase/module-collection 1.6.31 → 1.6.33

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.
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
- "@tachybase/client": "1.6.31",
3
- "@tachybase/module-error-handler": "1.6.31",
2
+ "@tachybase/client": "1.6.33",
3
+ "@tachybase/module-error-handler": "1.6.33",
4
4
  "@tego/server": "1.6.17",
5
5
  "async-mutex": "0.5.0",
6
6
  "lodash": "4.17.21",
@@ -1 +1 @@
1
- {"name":"node-sql-parser","version":"5.3.10","description":"simple node sql parser","main":"index.js","types":"types.d.ts","scripts":{"start":"webpack --config webpack.config.js","build":"npm run lint && npm run compile && webpack --config webpack.config.js --mode production","test":"npm run lint && mochapack --reporter-option maxDiffSize=1000000 \"test/**/*.spec.js\"","lint":"eslint src","compile":"babel src -d lib","coverLocal":"cross-env NODE_ENV=coverage nyc --reporter=lcov --reporter=text npm run test","cover:run":"cross-env NODE_ENV=coverage nyc --reporter=text-lcov npm run test","cover":"npm run cover:run && nyc report --reporter=text-lcov | coveralls","release":"npm run build && npm publish output/prod"},"repository":{"type":"git","url":"git+https://github.com/taozhi8833998/node-sql-parser.git"},"pre-commit":"coverLocal","keywords":["sql","sql-parser","parser","node","nodejs","node-parser","node-sql-parser","ast","sql-ast"],"author":"taozhi8833998 <taozhi8833998@163.com>","files":["ast/","build","lib","umd/","index.d.ts","index.js","index.js.map","LICENSE","package.json","README.md","types.d.ts"],"license":"Apache-2.0","bugs":{"url":"https://github.com/taozhi8833998/node-sql-parser/issues"},"homepage":"https://github.com/taozhi8833998/node-sql-parser#readme","engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.5.5","@babel/core":"^7.10.5","@babel/plugin-proposal-object-rest-spread":"^7.5.5","@babel/preset-env":"^7.10.4","@babel/register":"^7.10.5","@types/chai":"^4.1.7","@types/mocha":"^10.0.1","babel-loader":"^8.1.0","browserify":"^17.0.0","chai":"^4.4.1","copy-webpack-plugin":"^6.0.3","coveralls":"^3.0.13","cross-env":"^7.0.2","eslint":"^8.3.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-strict":"^14.0.1","eslint-plugin-filenames":"^1.3.2","eslint-plugin-import":"^2.16.0","filemanager-webpack-plugin":"^3.1.1","istanbul-instrumenter-loader":"^3.0.1","mocha":"^10.0.0","mochapack":"^2.0.3","nyc":"15.1.0","pegjs":"^0.10.0","pegjs-loader":"^0.5.6","pre-commit":"^1.2.2","rimraf":"^5.0.1","source-map-support":"^0.5.19","tinyify":"^4.0.0","vscode-mocha-hmr":"^1.0.0","webpack":"^4.43.0","webpack-cli":"^4.7.0","webpack-node-externals":"^3.0.0"},"nyc":{"include":["src/**/*.js"],"instrument":false,"sourceMap":false},"dependencies":{"@types/pegjs":"^0.10.0","big-integer":"^1.6.48"},"_lastModified":"2026-08-12T10:58:16.321Z"}
1
+ {"name":"node-sql-parser","version":"5.3.10","description":"simple node sql parser","main":"index.js","types":"types.d.ts","scripts":{"start":"webpack --config webpack.config.js","build":"npm run lint && npm run compile && webpack --config webpack.config.js --mode production","test":"npm run lint && mochapack --reporter-option maxDiffSize=1000000 \"test/**/*.spec.js\"","lint":"eslint src","compile":"babel src -d lib","coverLocal":"cross-env NODE_ENV=coverage nyc --reporter=lcov --reporter=text npm run test","cover:run":"cross-env NODE_ENV=coverage nyc --reporter=text-lcov npm run test","cover":"npm run cover:run && nyc report --reporter=text-lcov | coveralls","release":"npm run build && npm publish output/prod"},"repository":{"type":"git","url":"git+https://github.com/taozhi8833998/node-sql-parser.git"},"pre-commit":"coverLocal","keywords":["sql","sql-parser","parser","node","nodejs","node-parser","node-sql-parser","ast","sql-ast"],"author":"taozhi8833998 <taozhi8833998@163.com>","files":["ast/","build","lib","umd/","index.d.ts","index.js","index.js.map","LICENSE","package.json","README.md","types.d.ts"],"license":"Apache-2.0","bugs":{"url":"https://github.com/taozhi8833998/node-sql-parser/issues"},"homepage":"https://github.com/taozhi8833998/node-sql-parser#readme","engines":{"node":">=8"},"devDependencies":{"@babel/cli":"^7.5.5","@babel/core":"^7.10.5","@babel/plugin-proposal-object-rest-spread":"^7.5.5","@babel/preset-env":"^7.10.4","@babel/register":"^7.10.5","@types/chai":"^4.1.7","@types/mocha":"^10.0.1","babel-loader":"^8.1.0","browserify":"^17.0.0","chai":"^4.4.1","copy-webpack-plugin":"^6.0.3","coveralls":"^3.0.13","cross-env":"^7.0.2","eslint":"^8.3.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-strict":"^14.0.1","eslint-plugin-filenames":"^1.3.2","eslint-plugin-import":"^2.16.0","filemanager-webpack-plugin":"^3.1.1","istanbul-instrumenter-loader":"^3.0.1","mocha":"^10.0.0","mochapack":"^2.0.3","nyc":"15.1.0","pegjs":"^0.10.0","pegjs-loader":"^0.5.6","pre-commit":"^1.2.2","rimraf":"^5.0.1","source-map-support":"^0.5.19","tinyify":"^4.0.0","vscode-mocha-hmr":"^1.0.0","webpack":"^4.43.0","webpack-cli":"^4.7.0","webpack-node-externals":"^3.0.0"},"nyc":{"include":["src/**/*.js"],"instrument":false,"sourceMap":false},"dependencies":{"@types/pegjs":"^0.10.0","big-integer":"^1.6.48"},"_lastModified":"2026-08-13T08:17:48.687Z"}
@@ -37,14 +37,14 @@ class CollectionRepository extends import_server.Repository {
37
37
  this.app = app;
38
38
  }
39
39
  async load(options = {}) {
40
- var _a, _b, _c;
40
+ var _a, _b, _c, _d;
41
41
  const { filter, skipExist } = options;
42
42
  const instances = await this.find({ filter, appends: ["fields"] });
43
43
  const graphlib = import_server.CollectionsGraph.graphlib();
44
44
  const graph = new graphlib.Graph();
45
45
  const nameMap = {};
46
46
  const viewCollections = [];
47
- const db2cmCollections = [];
47
+ const db2cmCollectionFields = /* @__PURE__ */ new Map();
48
48
  const customCollections = [];
49
49
  for (const instance of instances) {
50
50
  graph.setNode(instance.get("name"));
@@ -78,6 +78,11 @@ class CollectionRepository extends import_server.Repository {
78
78
  }
79
79
  const collectionSource = nameMap[instanceName].get("from") ?? ((_a2 = nameMap[instanceName].get("options")) == null ? void 0 : _a2.from);
80
80
  if (collectionSource === "db2cm" && this.database.hasCollection(instanceName)) {
81
+ const collection = this.database.getCollection(instanceName);
82
+ const missingFields = (nameMap[instanceName].get("fields") || []).filter((field) => !collection.hasField(field.get("name"))).map((field) => field.get("name"));
83
+ if (missingFields.length) {
84
+ db2cmCollectionFields.set(instanceName, missingFields);
85
+ }
81
86
  return true;
82
87
  }
83
88
  const fields = nameMap[instanceName].get("fields");
@@ -94,7 +99,7 @@ class CollectionRepository extends import_server.Repository {
94
99
  (_a = this.app) == null ? void 0 : _a.setMaintainingMessage(`load ${instanceName} collection`);
95
100
  await nameMap[instanceName].load({ skipField });
96
101
  }
97
- for (const viewCollectionName of /* @__PURE__ */ new Set([...viewCollections, ...db2cmCollections])) {
102
+ for (const viewCollectionName of viewCollections) {
98
103
  process.env.DEBUG_LOAD_COLLECTION_FIELDS && this.database.logger.debug(`load collection fields`, {
99
104
  submodule: "CollectionRepository",
100
105
  method: "load",
@@ -103,13 +108,23 @@ class CollectionRepository extends import_server.Repository {
103
108
  (_b = this.app) == null ? void 0 : _b.setMaintainingMessage(`load ${viewCollectionName} collection fields`);
104
109
  await nameMap[viewCollectionName].loadFields({});
105
110
  }
111
+ for (const [collectionName, includeFields] of db2cmCollectionFields) {
112
+ process.env.DEBUG_LOAD_COLLECTION_FIELDS && this.database.logger.debug(`load collection fields`, {
113
+ submodule: "CollectionRepository",
114
+ method: "load",
115
+ collectionName,
116
+ includeFields
117
+ });
118
+ (_c = this.app) == null ? void 0 : _c.setMaintainingMessage(`load ${collectionName} collection fields`);
119
+ await nameMap[collectionName].loadFields({ includeFields });
120
+ }
106
121
  for (const [collectionName, skipField] of lazyCollectionFields) {
107
122
  process.env.DEBUG_LOAD_COLLECTION_FIELDS && this.database.logger.debug(`load collection fields`, {
108
123
  submodule: "CollectionRepository",
109
124
  method: "load",
110
125
  collectionName
111
126
  });
112
- (_c = this.app) == null ? void 0 : _c.setMaintainingMessage(`load ${collectionName} collection fields`);
127
+ (_d = this.app) == null ? void 0 : _d.setMaintainingMessage(`load ${collectionName} collection fields`);
113
128
  await nameMap[collectionName].loadFields({ includeFields: skipField });
114
129
  }
115
130
  return customCollections;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/module-collection",
3
3
  "displayName": "Data source: Main",
4
- "version": "1.6.31",
4
+ "version": "1.6.33",
5
5
  "description": "TachyBase main database, supports relational databases such as MySQL, PostgreSQL, SQLite and so on.",
6
6
  "keywords": [
7
7
  "Data sources"
@@ -30,8 +30,8 @@
30
30
  "lodash": "4.17.21",
31
31
  "sequelize": "6.37.5",
32
32
  "toposort": "^2.0.2",
33
- "@tachybase/client": "1.6.31",
34
- "@tachybase/module-error-handler": "1.6.31"
33
+ "@tachybase/module-error-handler": "1.6.33",
34
+ "@tachybase/client": "1.6.33"
35
35
  },
36
36
  "description.zh-CN": "TachyBase 主数据库,支持 MySQL、PostgreSQL、SQLite 等关系型数据库。",
37
37
  "displayName.zh-CN": "数据源:主数据库",