@nocobase/plugin-action-import 1.2.13-alpha → 1.3.0-alpha.20240710084543
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/package.json +2 -2
- package/dist/client/ImportActionInitializer.d.ts +0 -12
- package/dist/client/ImportDesigner.d.ts +0 -10
- package/dist/client/ImportModal.d.ts +0 -14
- package/dist/client/ImportPluginProvider.d.ts +0 -11
- package/dist/client/constants.d.ts +0 -9
- package/dist/client/context.d.ts +0 -37
- package/dist/client/index.d.ts +0 -17
- package/dist/client/index.js +0 -33
- package/dist/client/locale/index.d.ts +0 -10
- package/dist/client/schemaSettings.d.ts +0 -10
- package/dist/client/useFields.d.ts +0 -9
- package/dist/client/useImportAction.d.ts +0 -15
- package/dist/client/useShared.d.ts +0 -84
- package/dist/externalVersion.js +0 -30
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -52
- package/dist/locale/en-US.json +0 -28
- package/dist/locale/es-ES.json +0 -27
- package/dist/locale/ko_KR.json +0 -28
- package/dist/locale/pt-BR.json +0 -27
- package/dist/locale/zh-CN.json +0 -30
- package/dist/node_modules/xlsx/LICENSE +0 -201
- package/dist/node_modules/xlsx/bin/xlsx.njs +0 -310
- package/dist/node_modules/xlsx/bower.json +0 -22
- package/dist/node_modules/xlsx/dist/cpexcel.d.ts +0 -39
- package/dist/node_modules/xlsx/dist/cpexcel.js +0 -1506
- package/dist/node_modules/xlsx/dist/shim.min.js +0 -2
- package/dist/node_modules/xlsx/dist/xlsx.core.min.js +0 -17
- package/dist/node_modules/xlsx/dist/xlsx.extendscript.js +0 -27961
- package/dist/node_modules/xlsx/dist/xlsx.full.min.js +0 -24
- package/dist/node_modules/xlsx/dist/xlsx.mini.min.js +0 -10
- package/dist/node_modules/xlsx/dist/xlsx.zahl.js +0 -4
- package/dist/node_modules/xlsx/dist/zahl.d.ts +0 -4
- package/dist/node_modules/xlsx/package.json +0 -1
- package/dist/node_modules/xlsx/types/index.d.ts +0 -1033
- package/dist/node_modules/xlsx/xlsx.js +0 -7
- package/dist/node_modules/xlsx/xlsxworker.js +0 -14
- package/dist/server/actions/download-xlsx-template.d.ts +0 -10
- package/dist/server/actions/download-xlsx-template.js +0 -67
- package/dist/server/actions/import-xlsx.d.ts +0 -10
- package/dist/server/actions/import-xlsx.js +0 -94
- package/dist/server/actions/index.d.ts +0 -10
- package/dist/server/actions/index.js +0 -32
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +0 -86
- package/dist/server/locale/en-US.d.ts +0 -19
- package/dist/server/locale/en-US.js +0 -41
- package/dist/server/locale/fr-FR.d.ts +0 -19
- package/dist/server/locale/fr-FR.js +0 -41
- package/dist/server/locale/index.d.ts +0 -10
- package/dist/server/locale/index.js +0 -49
- package/dist/server/locale/zh-CN.d.ts +0 -20
- package/dist/server/locale/zh-CN.js +0 -42
- package/dist/server/middleware/index.d.ts +0 -10
- package/dist/server/middleware/index.js +0 -43
- package/dist/server/migrations/20240425223956-change-locale-module.d.ts +0 -14
- package/dist/server/migrations/20240425223956-change-locale-module.js +0 -51
- package/dist/server/services/template-creator.d.ts +0 -24
- package/dist/server/services/template-creator.js +0 -70
- package/dist/server/services/xlsx-importer.d.ts +0 -39
- package/dist/server/services/xlsx-importer.js +0 -197
- package/dist/server/utils/index.d.ts +0 -14
- package/dist/server/utils/index.js +0 -63
- package/dist/server/utils/transform.d.ts +0 -92
- package/dist/server/utils/transform.js +0 -235
- package/dist/swagger/index.json +0 -33
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
2
|
-
importScripts('dist/shim.min.js');
|
|
3
|
-
/* uncomment the next line for encoding support */
|
|
4
|
-
importScripts('dist/cpexcel.js');
|
|
5
|
-
importScripts('xlsx.js');
|
|
6
|
-
postMessage({t:"ready"});
|
|
7
|
-
|
|
8
|
-
onmessage = function (evt) {
|
|
9
|
-
var v;
|
|
10
|
-
try {
|
|
11
|
-
v = XLSX.read(evt.data.d, {type: evt.data.b, codepage: evt.data.c});
|
|
12
|
-
postMessage({t:"xlsx", d:JSON.stringify(v)});
|
|
13
|
-
} catch(e) { postMessage({t:"e",d:e.stack||e}); }
|
|
14
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Context, Next } from '@nocobase/actions';
|
|
10
|
-
export declare function downloadXlsxTemplate(ctx: Context, next: Next): Promise<void>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
var download_xlsx_template_exports = {};
|
|
38
|
-
__export(download_xlsx_template_exports, {
|
|
39
|
-
downloadXlsxTemplate: () => downloadXlsxTemplate
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(download_xlsx_template_exports);
|
|
42
|
-
var import_template_creator = require("../services/template-creator");
|
|
43
|
-
var import_xlsx = __toESM(require("xlsx"));
|
|
44
|
-
async function downloadXlsxTemplate(ctx, next) {
|
|
45
|
-
let { columns } = ctx.request.body;
|
|
46
|
-
const { explain, title } = ctx.request.body;
|
|
47
|
-
if (typeof columns === "string") {
|
|
48
|
-
columns = JSON.parse(columns);
|
|
49
|
-
}
|
|
50
|
-
const templateCreator = new import_template_creator.TemplateCreator({
|
|
51
|
-
explain,
|
|
52
|
-
title,
|
|
53
|
-
columns
|
|
54
|
-
});
|
|
55
|
-
const workbook = await templateCreator.run();
|
|
56
|
-
const buffer = import_xlsx.default.write(workbook, { type: "buffer", bookType: "xlsx" });
|
|
57
|
-
ctx.body = buffer;
|
|
58
|
-
ctx.set({
|
|
59
|
-
"Content-Type": "application/octet-stream",
|
|
60
|
-
"Content-Disposition": `attachment; filename=${encodeURIComponent(title)}.xlsx`
|
|
61
|
-
});
|
|
62
|
-
await next();
|
|
63
|
-
}
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
downloadXlsxTemplate
|
|
67
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Context, Next } from '@nocobase/actions';
|
|
10
|
-
export declare function importXlsx(ctx: Context, next: Next): Promise<void>;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
var import_xlsx_exports = {};
|
|
38
|
-
__export(import_xlsx_exports, {
|
|
39
|
-
importXlsx: () => importXlsx
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(import_xlsx_exports);
|
|
42
|
-
var import_xlsx = __toESM(require("xlsx"));
|
|
43
|
-
var import_xlsx_importer = require("../services/xlsx-importer");
|
|
44
|
-
var import_async_mutex = require("async-mutex");
|
|
45
|
-
const mutex = new import_async_mutex.Mutex();
|
|
46
|
-
const IMPORT_LIMIT_COUNT = 2e3;
|
|
47
|
-
async function importXlsxAction(ctx, next) {
|
|
48
|
-
let columns = ctx.request.body.columns;
|
|
49
|
-
if (typeof columns === "string") {
|
|
50
|
-
columns = JSON.parse(columns);
|
|
51
|
-
}
|
|
52
|
-
let readLimit = IMPORT_LIMIT_COUNT;
|
|
53
|
-
readLimit += 1;
|
|
54
|
-
if (ctx.request.body.explain) {
|
|
55
|
-
readLimit += 1;
|
|
56
|
-
}
|
|
57
|
-
const workbook = import_xlsx.default.read(ctx.file.buffer, {
|
|
58
|
-
type: "buffer",
|
|
59
|
-
sheetRows: readLimit
|
|
60
|
-
});
|
|
61
|
-
const repository = ctx.getCurrentRepository();
|
|
62
|
-
const dataSource = ctx.dataSource;
|
|
63
|
-
const collection = repository.collection;
|
|
64
|
-
const importer = new import_xlsx_importer.XlsxImporter({
|
|
65
|
-
collectionManager: dataSource.collectionManager,
|
|
66
|
-
collection,
|
|
67
|
-
columns,
|
|
68
|
-
workbook,
|
|
69
|
-
explain: ctx.request.body.explain
|
|
70
|
-
});
|
|
71
|
-
const importedCount = await importer.run();
|
|
72
|
-
ctx.bodyMeta = { successCount: importedCount };
|
|
73
|
-
ctx.body = ctx.bodyMeta;
|
|
74
|
-
}
|
|
75
|
-
async function importXlsx(ctx, next) {
|
|
76
|
-
if (mutex.isLocked()) {
|
|
77
|
-
throw new Error(
|
|
78
|
-
ctx.t(`another import action is running, please try again later.`, {
|
|
79
|
-
ns: "action-import"
|
|
80
|
-
})
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
const release = await mutex.acquire();
|
|
84
|
-
try {
|
|
85
|
-
await importXlsxAction(ctx, next);
|
|
86
|
-
} finally {
|
|
87
|
-
release();
|
|
88
|
-
}
|
|
89
|
-
await next();
|
|
90
|
-
}
|
|
91
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
-
0 && (module.exports = {
|
|
93
|
-
importXlsx
|
|
94
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
export * from './download-xlsx-template';
|
|
10
|
-
export * from './import-xlsx';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var actions_exports = {};
|
|
25
|
-
module.exports = __toCommonJS(actions_exports);
|
|
26
|
-
__reExport(actions_exports, require("./download-xlsx-template"), module.exports);
|
|
27
|
-
__reExport(actions_exports, require("./import-xlsx"), module.exports);
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
...require("./download-xlsx-template"),
|
|
31
|
-
...require("./import-xlsx")
|
|
32
|
-
});
|
package/dist/server/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Plugin } from '@nocobase/server';
|
|
10
|
-
export declare class PluginActionImportServer extends Plugin {
|
|
11
|
-
beforeLoad(): void;
|
|
12
|
-
load(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
export default PluginActionImportServer;
|
package/dist/server/index.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var server_exports = {};
|
|
28
|
-
__export(server_exports, {
|
|
29
|
-
PluginActionImportServer: () => PluginActionImportServer,
|
|
30
|
-
default: () => server_default
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(server_exports);
|
|
33
|
-
var import_server = require("@nocobase/server");
|
|
34
|
-
var import__ = require("..");
|
|
35
|
-
var import_actions = require("./actions");
|
|
36
|
-
var import_locale = require("./locale");
|
|
37
|
-
var import_middleware = require("./middleware");
|
|
38
|
-
class PluginActionImportServer extends import_server.Plugin {
|
|
39
|
-
beforeLoad() {
|
|
40
|
-
this.app.i18n.addResources("zh-CN", import__.namespace, import_locale.zhCN);
|
|
41
|
-
this.app.i18n.addResources("en-US", import__.namespace, import_locale.enUS);
|
|
42
|
-
this.app.on("afterInstall", async () => {
|
|
43
|
-
if (!this.app.db.getRepository("roles")) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const roleNames = ["admin", "member"];
|
|
47
|
-
const roles = await this.app.db.getRepository("roles").find({
|
|
48
|
-
filter: {
|
|
49
|
-
name: roleNames
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
for (const role of roles) {
|
|
53
|
-
await this.app.db.getRepository("roles").update({
|
|
54
|
-
filter: {
|
|
55
|
-
name: role.name
|
|
56
|
-
},
|
|
57
|
-
values: {
|
|
58
|
-
strategy: {
|
|
59
|
-
...role.strategy,
|
|
60
|
-
actions: [...role.strategy.actions, "importXlsx"]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
async load() {
|
|
68
|
-
this.app.dataSourceManager.afterAddDataSource((dataSource) => {
|
|
69
|
-
dataSource.resourceManager.use(import_middleware.importMiddleware);
|
|
70
|
-
dataSource.resourceManager.registerActionHandler("downloadXlsxTemplate", import_actions.downloadXlsxTemplate);
|
|
71
|
-
dataSource.resourceManager.registerActionHandler("importXlsx", import_actions.importXlsx);
|
|
72
|
-
dataSource.acl.setAvailableAction("importXlsx", {
|
|
73
|
-
displayName: '{{t("Import")}}',
|
|
74
|
-
allowConfigureFields: true,
|
|
75
|
-
type: "new-data",
|
|
76
|
-
onNewRecord: true
|
|
77
|
-
});
|
|
78
|
-
dataSource.acl.allow("*", "downloadXlsxTemplate", "loggedIn");
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
var server_default = PluginActionImportServer;
|
|
83
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
-
0 && (module.exports = {
|
|
85
|
-
PluginActionImportServer
|
|
86
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
Yes: string;
|
|
11
|
-
No: string;
|
|
12
|
-
'can not find value': string;
|
|
13
|
-
'password is empty': string;
|
|
14
|
-
'Incorrect time format': string;
|
|
15
|
-
'Incorrect date format': string;
|
|
16
|
-
'Incorrect email format': string;
|
|
17
|
-
'Illegal percentage format': string;
|
|
18
|
-
};
|
|
19
|
-
export default _default;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var en_US_exports = {};
|
|
28
|
-
__export(en_US_exports, {
|
|
29
|
-
default: () => en_US_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(en_US_exports);
|
|
32
|
-
var en_US_default = {
|
|
33
|
-
Yes: "Yes",
|
|
34
|
-
No: "No",
|
|
35
|
-
"can not find value": "can not find value",
|
|
36
|
-
"password is empty": "password is empty",
|
|
37
|
-
"Incorrect time format": "Incorrect time format",
|
|
38
|
-
"Incorrect date format": "Incorrect date format",
|
|
39
|
-
"Incorrect email format": "Incorrect email format",
|
|
40
|
-
"Illegal percentage format": "Illegal percentage format"
|
|
41
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
Yes: string;
|
|
11
|
-
No: string;
|
|
12
|
-
'can not find value': string;
|
|
13
|
-
'password is empty': string;
|
|
14
|
-
'Incorrect time format': string;
|
|
15
|
-
'Incorrect date format': string;
|
|
16
|
-
'Incorrect email format': string;
|
|
17
|
-
'Illegal percentage format': string;
|
|
18
|
-
};
|
|
19
|
-
export default _default;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var fr_FR_exports = {};
|
|
28
|
-
__export(fr_FR_exports, {
|
|
29
|
-
default: () => fr_FR_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(fr_FR_exports);
|
|
32
|
-
var fr_FR_default = {
|
|
33
|
-
Yes: "Oui",
|
|
34
|
-
No: "Non",
|
|
35
|
-
"can not find value": "valeur introuvable",
|
|
36
|
-
"password is empty": "le mot de passe est vide",
|
|
37
|
-
"Incorrect time format": "Format de l'heure incorrect",
|
|
38
|
-
"Incorrect date format": "Format de la date incorrect",
|
|
39
|
-
"Incorrect email format": "Format d'email incorrect",
|
|
40
|
-
"Illegal percentage format": "Format de pourcentage ill\xE9gal"
|
|
41
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
export { default as enUS } from './en-US';
|
|
10
|
-
export { default as zhCN } from './zh-CN';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
var locale_exports = {};
|
|
38
|
-
__export(locale_exports, {
|
|
39
|
-
enUS: () => import_en_US.default,
|
|
40
|
-
zhCN: () => import_zh_CN.default
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(locale_exports);
|
|
43
|
-
var import_en_US = __toESM(require("./en-US"));
|
|
44
|
-
var import_zh_CN = __toESM(require("./zh-CN"));
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
enUS,
|
|
48
|
-
zhCN
|
|
49
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
Yes: string;
|
|
11
|
-
No: string;
|
|
12
|
-
'can not find value': string;
|
|
13
|
-
'password is empty': string;
|
|
14
|
-
'Incorrect time format': string;
|
|
15
|
-
'Incorrect date format': string;
|
|
16
|
-
'Incorrect email format': string;
|
|
17
|
-
'Illegal percentage format': string;
|
|
18
|
-
'Imported template does not match, please download again.': string;
|
|
19
|
-
};
|
|
20
|
-
export default _default;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var zh_CN_exports = {};
|
|
28
|
-
__export(zh_CN_exports, {
|
|
29
|
-
default: () => zh_CN_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(zh_CN_exports);
|
|
32
|
-
var zh_CN_default = {
|
|
33
|
-
Yes: "\u662F",
|
|
34
|
-
No: "\u5426",
|
|
35
|
-
"can not find value": "\u627E\u4E0D\u5230\u5BF9\u5E94\u503C",
|
|
36
|
-
"password is empty": "\u5BC6\u7801\u4E3A\u7A7A",
|
|
37
|
-
"Incorrect time format": "\u65F6\u95F4\u683C\u5F0F\u4E0D\u6B63\u786E",
|
|
38
|
-
"Incorrect date format": "\u65E5\u671F\u683C\u5F0F\u4E0D\u6B63\u786E",
|
|
39
|
-
"Incorrect email format": "\u90AE\u7BB1\u683C\u5F0F\u4E0D\u6B63\u786E",
|
|
40
|
-
"Illegal percentage format": "\u767E\u5206\u6BD4\u683C\u5F0F\u6709\u8BEF",
|
|
41
|
-
"Imported template does not match, please download again.": "\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF0C\u8BF7\u68C0\u67E5\u5BFC\u5165\u6587\u4EF6\u6807\u9898\u884C\u6216\u91CD\u65B0\u4E0B\u8F7D\u5BFC\u5165\u6A21\u677F"
|
|
42
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Context, Next } from '@nocobase/actions';
|
|
10
|
-
export declare function importMiddleware(ctx: Context, next: Next): Promise<any>;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var middleware_exports = {};
|
|
28
|
-
__export(middleware_exports, {
|
|
29
|
-
importMiddleware: () => importMiddleware
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(middleware_exports);
|
|
32
|
-
var import_utils = require("@nocobase/utils");
|
|
33
|
-
async function importMiddleware(ctx, next) {
|
|
34
|
-
if (ctx.action.actionName !== "importXlsx") {
|
|
35
|
-
return next();
|
|
36
|
-
}
|
|
37
|
-
const upload = (0, import_utils.koaMulter)().single("file");
|
|
38
|
-
return upload(ctx, next);
|
|
39
|
-
}
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
importMiddleware
|
|
43
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
import { Migration } from '@nocobase/server';
|
|
10
|
-
export default class extends Migration {
|
|
11
|
-
on: string;
|
|
12
|
-
appVersion: string;
|
|
13
|
-
up(): Promise<void>;
|
|
14
|
-
}
|