@nocobase/plugin-action-import 2.1.0-alpha.1 → 2.1.0-beta.1

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.
@@ -10,26 +10,26 @@
10
10
  module.exports = {
11
11
  "@emotion/css": "11.13.0",
12
12
  "@formily/react": "2.3.7",
13
- "@nocobase/client": "2.1.0-alpha.1",
13
+ "@nocobase/client": "2.1.0-beta.1",
14
14
  "react": "18.2.0",
15
15
  "react-i18next": "11.18.6",
16
16
  "@ant-design/icons": "5.6.1",
17
17
  "@formily/shared": "2.3.7",
18
18
  "antd": "5.24.2",
19
- "@nocobase/utils": "2.1.0-alpha.1",
19
+ "@nocobase/utils": "2.1.0-beta.1",
20
20
  "@formily/antd-v5": "1.2.3",
21
21
  "file-saver": "2.0.5",
22
22
  "react-dom": "18.2.0",
23
23
  "lodash": "4.17.21",
24
24
  "@formily/core": "2.3.7",
25
- "@nocobase/server": "2.1.0-alpha.1",
25
+ "@nocobase/server": "2.1.0-beta.1",
26
26
  "@formily/reactive": "2.3.7",
27
- "@nocobase/flow-engine": "2.1.0-alpha.1",
28
- "@nocobase/actions": "2.1.0-alpha.1",
29
- "@nocobase/database": "2.1.0-alpha.1",
27
+ "@nocobase/flow-engine": "2.1.0-beta.1",
28
+ "@nocobase/actions": "2.1.0-beta.1",
29
+ "@nocobase/database": "2.1.0-beta.1",
30
30
  "async-mutex": "0.5.0",
31
- "@nocobase/data-source-manager": "2.1.0-alpha.1",
31
+ "@nocobase/data-source-manager": "2.1.0-beta.1",
32
32
  "sequelize": "6.35.2",
33
- "@nocobase/logger": "2.1.0-alpha.1",
34
- "mathjs": "10.6.4"
33
+ "@nocobase/logger": "2.1.0-beta.1",
34
+ "mathjs": "15.1.0"
35
35
  };
@@ -1 +1 @@
1
- {"name":"exceljs","version":"4.4.0","description":"Excel Workbook Manager - Read and Write xlsx and csv Files.","private":false,"license":"MIT","author":{"name":"Guyon Roche","email":"guyon@live.com"},"repository":{"type":"git","url":"https://github.com/exceljs/exceljs.git"},"engines":{"node":">=8.3.0"},"main":"./excel.js","browser":"./dist/exceljs.min.js","types":"./index.d.ts","files":["dist","lib","excel.js","LICENSE","README.md","README_zh.md","index.ts","index.d.ts"],"scripts":{"test":"npm run test:full","test:es5":"export EXCEL_BUILD=es5 && npm run test:full","test:full":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:jasmine","test:version":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:browser && npm run test:dist","test:all":"npm run test:native && npm run test:es5","test:native":"npm run test:full","test:unit":"mocha --require spec/config/setup --require spec/config/setup-unit spec/unit --recursive","test:integration":"mocha --require spec/config/setup spec/integration --recursive","test:end-to-end":"mocha --require spec/config/setup spec/end-to-end --recursive","test:browser":"if [ ! -f .disable-test-browser ]; then npm run build && npm run test:jasmine; fi","test:jasmine":"grunt jasmine","test:unit:es5":"export EXCEL_BUILD=es5 && npm run test:unit","test:integration:es5":"export EXCEL_BUILD=es5 && npm run test:integration","test:end-to-end:es5":"export EXCEL_BUILD=es5 && npm run test:end-to-end","test:dist":"mocha --require spec/config/setup spec/dist --recursive","test:manual":"node spec/manual/app.js","test:typescript":"mocha -r ts-node/register spec/typescript/**/*.spec.ts","clean-build":"npm run clean && npm run build","lint":"eslint --format node_modules/eslint-friendly-formatter .","lint:fix":"prettier-eslint --write $(pwd)'/**/*.js'","lint:staged":"lint-staged","clean":"rm -rf build/ && rm -rf dist","benchmark":"node --expose-gc benchmark","benchmark:debug":"node --expose-gc --inspect-brk --trace-deopt benchmark","build":"grunt build","install-build":"npm install && grunt build","preversion":"npm run clean && npm run build && npm run test:version","postversion":"git push --no-verify && git push --tags --no-verify"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":["prettier-eslint --write","eslint --format node_modules/eslint-friendly-formatter","git add"]},"keywords":["xlsx","json","csv","excel","font","border","fill","number","format","number format","alignment","office","spreadsheet","workbook","defined names","data validations","rich text","in-cell format","outlineLevel","views","frozen","split","pageSetup"],"dependencies":{"archiver":"^5.0.0","dayjs":"^1.8.34","fast-csv":"^4.3.1","jszip":"^3.10.1","readable-stream":"^3.6.0","saxes":"^5.0.1","tmp":"^0.2.0","unzipper":"^0.10.11","uuid":"^8.3.0"},"devDependencies":{"@babel/cli":"^7.10.5","@babel/core":"^7.11.4","@babel/preset-env":"^7.11.0","@types/chai":"^4.2.12","@types/mocha":"^8.0.3","@types/node":"^14.11.2","babelify":"^10.0.0","browserify":"^16.5.2","chai":"^4.2.0","chai-datetime":"^1.7.0","chai-xml":"^0.3.2","core-js":"^3.6.5","dirty-chai":"^2.0.1","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.12.0","eslint-friendly-formatter":"^4.0.1","eslint-plugin-import":"^2.22.0","eslint-plugin-node":"^11.1.0","express":"^4.16.4","got":"^9.0.0","grunt":"^1.3.0","grunt-babel":"^8.0.0","grunt-browserify":"^5.3.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-jasmine":"^2.2.0","grunt-contrib-watch":"^1.1.0","grunt-exorcise":"^2.1.1","grunt-terser":"^1.0.0","husky":"^4.3.0","lint-staged":"^10.2.13","mocha":"^7.2.0","prettier-eslint":"^11.0.0","prettier-eslint-cli":"^5.0.0","regenerator-runtime":"^0.13.7","sax":"^1.2.4","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2025-12-31T16:43:37.826Z"}
1
+ {"name":"exceljs","version":"4.4.0","description":"Excel Workbook Manager - Read and Write xlsx and csv Files.","private":false,"license":"MIT","author":{"name":"Guyon Roche","email":"guyon@live.com"},"repository":{"type":"git","url":"https://github.com/exceljs/exceljs.git"},"engines":{"node":">=8.3.0"},"main":"./excel.js","browser":"./dist/exceljs.min.js","types":"./index.d.ts","files":["dist","lib","excel.js","LICENSE","README.md","README_zh.md","index.ts","index.d.ts"],"scripts":{"test":"npm run test:full","test:es5":"export EXCEL_BUILD=es5 && npm run test:full","test:full":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:jasmine","test:version":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:browser && npm run test:dist","test:all":"npm run test:native && npm run test:es5","test:native":"npm run test:full","test:unit":"mocha --require spec/config/setup --require spec/config/setup-unit spec/unit --recursive","test:integration":"mocha --require spec/config/setup spec/integration --recursive","test:end-to-end":"mocha --require spec/config/setup spec/end-to-end --recursive","test:browser":"if [ ! -f .disable-test-browser ]; then npm run build && npm run test:jasmine; fi","test:jasmine":"grunt jasmine","test:unit:es5":"export EXCEL_BUILD=es5 && npm run test:unit","test:integration:es5":"export EXCEL_BUILD=es5 && npm run test:integration","test:end-to-end:es5":"export EXCEL_BUILD=es5 && npm run test:end-to-end","test:dist":"mocha --require spec/config/setup spec/dist --recursive","test:manual":"node spec/manual/app.js","test:typescript":"mocha -r ts-node/register spec/typescript/**/*.spec.ts","clean-build":"npm run clean && npm run build","lint":"eslint --format node_modules/eslint-friendly-formatter .","lint:fix":"prettier-eslint --write $(pwd)'/**/*.js'","lint:staged":"lint-staged","clean":"rm -rf build/ && rm -rf dist","benchmark":"node --expose-gc benchmark","benchmark:debug":"node --expose-gc --inspect-brk --trace-deopt benchmark","build":"grunt build","install-build":"npm install && grunt build","preversion":"npm run clean && npm run build && npm run test:version","postversion":"git push --no-verify && git push --tags --no-verify"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":["prettier-eslint --write","eslint --format node_modules/eslint-friendly-formatter","git add"]},"keywords":["xlsx","json","csv","excel","font","border","fill","number","format","number format","alignment","office","spreadsheet","workbook","defined names","data validations","rich text","in-cell format","outlineLevel","views","frozen","split","pageSetup"],"dependencies":{"archiver":"^5.0.0","dayjs":"^1.8.34","fast-csv":"^4.3.1","jszip":"^3.10.1","readable-stream":"^3.6.0","saxes":"^5.0.1","tmp":"^0.2.0","unzipper":"^0.10.11","uuid":"^8.3.0"},"devDependencies":{"@babel/cli":"^7.10.5","@babel/core":"^7.11.4","@babel/preset-env":"^7.11.0","@types/chai":"^4.2.12","@types/mocha":"^8.0.3","@types/node":"^14.11.2","babelify":"^10.0.0","browserify":"^16.5.2","chai":"^4.2.0","chai-datetime":"^1.7.0","chai-xml":"^0.3.2","core-js":"^3.6.5","dirty-chai":"^2.0.1","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.12.0","eslint-friendly-formatter":"^4.0.1","eslint-plugin-import":"^2.22.0","eslint-plugin-node":"^11.1.0","express":"^4.16.4","got":"^9.0.0","grunt":"^1.3.0","grunt-babel":"^8.0.0","grunt-browserify":"^5.3.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-jasmine":"^2.2.0","grunt-contrib-watch":"^1.1.0","grunt-exorcise":"^2.1.1","grunt-terser":"^1.0.0","husky":"^4.3.0","lint-staged":"^10.2.13","mocha":"^7.2.0","prettier-eslint":"^11.0.0","prettier-eslint-cli":"^5.0.0","regenerator-runtime":"^0.13.7","sax":"^1.2.4","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2026-02-14T14:40:40.320Z"}
@@ -1 +1 @@
1
- {"name":"xlsx","version":"0.20.2","author":"sheetjs","description":"SheetJS Spreadsheet data parser and writer","keywords":["excel","xls","xlsx","xlsb","xlsm","ods","csv","dbf","dif","sylk","office","spreadsheet"],"bin":{"xlsx":"./bin/xlsx.njs"},"main":"xlsx.js","module":"xlsx.mjs","unpkg":"dist/xlsx.full.min.js","jsdelivr":"dist/xlsx.full.min.js","types":"types/index.d.ts","exports":{".":{"import":"./xlsx.mjs","require":"./xlsx.js","types":"./types/index.d.ts"},"./xlsx.mjs":{"import":"./xlsx.mjs","types":"./types/index.d.ts"},"./xlsx.js":{"require":"./xlsx.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min.js":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min.js":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min.js":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.zahl":{"import":"./dist/xlsx.zahl.mjs","require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.mjs":{"import":"./dist/xlsx.zahl.mjs","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.js":{"require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/cpexcel":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.js":{"require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full.mjs":{"import":"./dist/cpexcel.full.mjs","types":"./dist/cpexcel.d.ts"}},"browser":{"buffer":false,"crypto":false,"stream":false,"process":false,"fs":false},"sideEffects":false,"dependencies":{},"devDependencies":{"@sheetjs/uglify-js":"~2.7.3","@types/node":"^8.5.9","acorn":"7.4.1","adler-32":"~1.3.1","alex":"8.1.1","blanket":"~1.2.3","cfb":"~1.2.2","codepage":"~1.15.0","commander":"~2.17.1","crc-32":"~1.2.2","dtslint":"^0.1.2","eslint":"7.23.0","eslint-plugin-html":"^6.1.2","eslint-plugin-json":"^2.1.2","exit-on-epipe":"~1.0.1","fflate":"^0.7.1","jsdom":"~11.1.0","markdown-spellcheck":"^1.3.1","mocha":"~2.5.3","sinon":"^1.17.7","ssf":"~0.11.2","typescript":"2.2.0","wmf":"~1.0.1","word":"~0.3.0"},"repository":{"type":"git","url":"https://git.sheetjs.com/SheetJS/sheetjs"},"scripts":{"pretest":"npm run lint","test":"npm run tests-only","pretest-only":"git submodule init && git submodule update","tests-only":"make travis","build":"make","lint":"make fullint","dtslint":"dtslint types"},"config":{"blanket":{"pattern":"xlsx.js"}},"alex":{"allow":["chinese","special","simple","just","crash","wtf","holes"]},"homepage":"https://sheetjs.com/","files":["CHANGELOG.md","LICENSE","README.md","bower.json","package.json","xlsx.js","xlsx.mjs","xlsxworker.js","bin/xlsx.njs","dist/LICENSE","dist/*.mjs","dist/*.js","dist/*.map","dist/*.d.ts","types/index.d.ts","types/tsconfig.json"],"bugs":{"url":"https://git.sheetjs.com/SheetJS/sheetjs/issues"},"license":"Apache-2.0","engines":{"node":">=0.8"},"_lastModified":"2025-12-31T16:43:40.748Z"}
1
+ {"name":"xlsx","version":"0.20.2","author":"sheetjs","description":"SheetJS Spreadsheet data parser and writer","keywords":["excel","xls","xlsx","xlsb","xlsm","ods","csv","dbf","dif","sylk","office","spreadsheet"],"bin":{"xlsx":"./bin/xlsx.njs"},"main":"xlsx.js","module":"xlsx.mjs","unpkg":"dist/xlsx.full.min.js","jsdelivr":"dist/xlsx.full.min.js","types":"types/index.d.ts","exports":{".":{"import":"./xlsx.mjs","require":"./xlsx.js","types":"./types/index.d.ts"},"./xlsx.mjs":{"import":"./xlsx.mjs","types":"./types/index.d.ts"},"./xlsx.js":{"require":"./xlsx.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min.js":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min.js":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min.js":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.zahl":{"import":"./dist/xlsx.zahl.mjs","require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.mjs":{"import":"./dist/xlsx.zahl.mjs","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.js":{"require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/cpexcel":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.js":{"require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full.mjs":{"import":"./dist/cpexcel.full.mjs","types":"./dist/cpexcel.d.ts"}},"browser":{"buffer":false,"crypto":false,"stream":false,"process":false,"fs":false},"sideEffects":false,"dependencies":{},"devDependencies":{"@sheetjs/uglify-js":"~2.7.3","@types/node":"^8.5.9","acorn":"7.4.1","adler-32":"~1.3.1","alex":"8.1.1","blanket":"~1.2.3","cfb":"~1.2.2","codepage":"~1.15.0","commander":"~2.17.1","crc-32":"~1.2.2","dtslint":"^0.1.2","eslint":"7.23.0","eslint-plugin-html":"^6.1.2","eslint-plugin-json":"^2.1.2","exit-on-epipe":"~1.0.1","fflate":"^0.7.1","jsdom":"~11.1.0","markdown-spellcheck":"^1.3.1","mocha":"~2.5.3","sinon":"^1.17.7","ssf":"~0.11.2","typescript":"2.2.0","wmf":"~1.0.1","word":"~0.3.0"},"repository":{"type":"git","url":"https://git.sheetjs.com/SheetJS/sheetjs"},"scripts":{"pretest":"npm run lint","test":"npm run tests-only","pretest-only":"git submodule init && git submodule update","tests-only":"make travis","build":"make","lint":"make fullint","dtslint":"dtslint types"},"config":{"blanket":{"pattern":"xlsx.js"}},"alex":{"allow":["chinese","special","simple","just","crash","wtf","holes"]},"homepage":"https://sheetjs.com/","files":["CHANGELOG.md","LICENSE","README.md","bower.json","package.json","xlsx.js","xlsx.mjs","xlsxworker.js","bin/xlsx.njs","dist/LICENSE","dist/*.mjs","dist/*.js","dist/*.map","dist/*.d.ts","types/index.d.ts","types/tsconfig.json"],"bugs":{"url":"https://git.sheetjs.com/SheetJS/sheetjs/issues"},"license":"Apache-2.0","engines":{"node":">=0.8"},"_lastModified":"2026-02-14T14:40:43.156Z"}
@@ -47,6 +47,7 @@ export declare class XlsxImporter extends EventEmitter {
47
47
  run(options?: RunOptions): Promise<any>;
48
48
  resetSeq(options?: RunOptions): Promise<void>;
49
49
  private getColumnsByPermission;
50
+ private validateColumns;
50
51
  performImport(data: string[][], options?: RunOptions): Promise<any>;
51
52
  protected getModel(): typeof Model;
52
53
  handleRowValuesWithColumns(row: any, rowValues: any, options: RunOptions, columns: ImportColumn[]): Promise<void>;
@@ -78,16 +78,7 @@ class XlsxImporter extends import_events.default {
78
78
  }
79
79
  }
80
80
  async validate(ctx) {
81
- const columns = this.getColumnsByPermission(ctx);
82
- if (columns.length == 0) {
83
- throw new import_errors.ImportValidationError("Columns configuration is empty");
84
- }
85
- for (const column of this.options.columns) {
86
- const field = this.options.collection.getField(column.dataIndex[0]);
87
- if (!field) {
88
- throw new import_errors.ImportValidationError("Field not found: {{field}}", { field: column.dataIndex[0] });
89
- }
90
- }
81
+ this.validateColumns(ctx);
91
82
  const data = await this.getData(ctx);
92
83
  await this.validateBySpaces(data, ctx);
93
84
  return data;
@@ -158,6 +149,12 @@ class XlsxImporter extends import_events.default {
158
149
  transaction
159
150
  });
160
151
  const maxVal = await collection.model.max(autoIncrementAttribute, { transaction });
152
+ if (maxVal == null) {
153
+ return;
154
+ }
155
+ if (typeof autoIncrInfo.currentVal === "number" && maxVal <= autoIncrInfo.currentVal) {
156
+ return;
157
+ }
161
158
  const queryInterface = db.queryInterface;
162
159
  await queryInterface.setAutoIncrementVal({
163
160
  tableInfo,
@@ -177,6 +174,56 @@ class XlsxImporter extends import_events.default {
177
174
  }
178
175
  );
179
176
  }
177
+ validateColumns(ctx) {
178
+ var _a, _b, _c;
179
+ const columns = this.getColumnsByPermission(ctx);
180
+ if (columns.length === 0) {
181
+ throw new import_errors.ImportValidationError("Columns configuration is empty");
182
+ }
183
+ for (const column of columns) {
184
+ if (!Array.isArray(column == null ? void 0 : column.dataIndex) || column.dataIndex.length === 0) {
185
+ throw new import_errors.ImportValidationError("Columns configuration is empty");
186
+ }
187
+ if (column.dataIndex.length > 2) {
188
+ throw new import_errors.ImportValidationError("Invalid field: {{field}}", {
189
+ field: column.dataIndex.join(".")
190
+ });
191
+ }
192
+ const [fieldName, filterKey] = column.dataIndex;
193
+ if (typeof fieldName !== "string" || fieldName.trim() === "") {
194
+ throw new import_errors.ImportValidationError("Invalid field: {{field}}", { field: String(fieldName) });
195
+ }
196
+ const field = this.options.collection.getField(fieldName);
197
+ if (!field) {
198
+ throw new import_errors.ImportValidationError("Field not found: {{field}}", { field: fieldName });
199
+ }
200
+ if (column.dataIndex.length > 1) {
201
+ if (typeof field.isRelationField !== "function" || !field.isRelationField()) {
202
+ throw new import_errors.ImportValidationError("Invalid field: {{field}}", {
203
+ field: column.dataIndex.join(".")
204
+ });
205
+ }
206
+ if (typeof filterKey !== "string" || filterKey.trim() === "") {
207
+ throw new import_errors.ImportValidationError("Invalid field: {{field}}", {
208
+ field: column.dataIndex.join(".")
209
+ });
210
+ }
211
+ const targetCollection = (_a = field.targetCollection) == null ? void 0 : _a.call(field);
212
+ if (!targetCollection) {
213
+ throw new import_errors.ImportValidationError("Field not found: {{field}}", {
214
+ field: column.dataIndex.join(".")
215
+ });
216
+ }
217
+ const targetField = targetCollection.getField(filterKey);
218
+ const isValidAttribute = (_c = (_b = targetCollection.model) == null ? void 0 : _b.getAttributes()) == null ? void 0 : _c[filterKey];
219
+ if (!targetField && !isValidAttribute) {
220
+ throw new import_errors.ImportValidationError("Field not found: {{field}}", {
221
+ field: `${fieldName}.${filterKey}`
222
+ });
223
+ }
224
+ }
225
+ }
226
+ }
180
227
  async performImport(data, options) {
181
228
  const chunkSize = this.options.chunkSize || 1e3;
182
229
  const chunks = import_lodash.default.chunk(data.slice(1), chunkSize);
@@ -247,7 +294,7 @@ class XlsxImporter extends import_events.default {
247
294
  rowValues = this.repository instanceof import_database.RelationRepository ? model.callSetters(guard.sanitize(rowValues || {}), options) : guard.sanitize(rowValues);
248
295
  }
249
296
  async handleChuckRows(chunkRows, runOptions, options) {
250
- var _a, _b, _c;
297
+ var _a, _b;
251
298
  let { handingRowIndex = 1 } = options;
252
299
  const { transaction } = runOptions;
253
300
  const columns = this.getColumnsByPermission(options == null ? void 0 : options.context);
@@ -260,6 +307,14 @@ class XlsxImporter extends import_events.default {
260
307
  ...rowValues
261
308
  });
262
309
  }
310
+ const translate = (message) => {
311
+ var _a2;
312
+ if ((_a2 = options.context) == null ? void 0 : _a2.t) {
313
+ return options.context.t(message, { ns: "action-import" });
314
+ } else {
315
+ return message;
316
+ }
317
+ };
263
318
  try {
264
319
  await this.loggerService.measureExecutedTime(
265
320
  async () => this.performInsert({
@@ -273,17 +328,13 @@ class XlsxImporter extends import_events.default {
273
328
  handingRowIndex += chunkRows.length;
274
329
  } catch (error) {
275
330
  if (error.name === "SequelizeUniqueConstraintError") {
276
- throw new Error(
277
- `${(_a = options.context) == null ? void 0 : _a.t("Unique constraint error, fields:", { ns: "action-import" })} ${JSON.stringify(
278
- error.fields
279
- )}`
280
- );
331
+ throw new Error(`${translate("Unique constraint error, fields:")} ${JSON.stringify(error.fields)}`);
281
332
  }
282
- if ((_b = error.params) == null ? void 0 : _b.rowIndex) {
333
+ if ((_a = error.params) == null ? void 0 : _a.rowIndex) {
283
334
  handingRowIndex += error.params.rowIndex;
284
335
  error.params.rowIndex = handingRowIndex;
285
336
  }
286
- (_c = this.logger) == null ? void 0 : _c.error(`Import error at row ${handingRowIndex}: ${error.message}`, {
337
+ (_b = this.logger) == null ? void 0 : _b.error(`Import error at row ${handingRowIndex}: ${error.message}`, {
287
338
  rowIndex: handingRowIndex,
288
339
  rowData: rows[handingRowIndex],
289
340
  originalError: error.stack || error.toString()
package/package.json CHANGED
@@ -6,12 +6,19 @@
6
6
  "description": "Import records using excel templates. You can configure which fields to import and templates will be generated automatically.",
7
7
  "description.ru-RU": "Импорт записей с помощью шаблонов Excel: можно настроить, какие поля импортировать, шаблоны будут генерироваться автоматически.",
8
8
  "description.zh-CN": "使用 Excel 模板导入数据,可以配置导入哪些字段,自动生成模板。",
9
- "version": "2.1.0-alpha.1",
9
+ "version": "2.1.0-beta.1",
10
10
  "license": "AGPL-3.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/action-import",
13
13
  "homepage.ru-RU": "https://docs.nocobase.ru/handbook/action-import",
14
14
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-import",
15
+ "nocobase": {
16
+ "supportedVersions": [
17
+ "1.x",
18
+ "2.x"
19
+ ],
20
+ "editionLevel": 0
21
+ },
15
22
  "devDependencies": {
16
23
  "@ant-design/icons": "5.x",
17
24
  "@formily/antd-v5": "1.x",
@@ -24,7 +31,7 @@
24
31
  "async-mutex": "^0.5.0",
25
32
  "exceljs": "^4.4.0",
26
33
  "file-saver": "^2.0.5",
27
- "mathjs": "^10.6.0",
34
+ "mathjs": "^15.1.0",
28
35
  "node-xlsx": "^0.16.1",
29
36
  "react": "^18.2.0",
30
37
  "react-dom": "^18.2.0",
@@ -39,7 +46,7 @@
39
46
  "@nocobase/test": "2.x",
40
47
  "@nocobase/utils": "2.x"
41
48
  },
42
- "gitHead": "d27baf21569643d6fa83f882233f4e90eb5b89f1",
49
+ "gitHead": "de3efeb357b6a98b813f1c14831afa832aed1780",
43
50
  "keywords": [
44
51
  "Actions"
45
52
  ]