@nocobase/plugin-system-settings 0.7.0-alpha.9 → 0.7.1-alpha.4
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/lib/collections/systemSettings.js +41 -29
- package/lib/index.d.ts +1 -1
- package/lib/index.js +14 -8
- package/{esm/plugin.d.ts → lib/server.d.ts} +1 -0
- package/lib/server.js +100 -0
- package/package.json +3 -8
- package/esm/collections/systemSettings.d.ts +0 -2
- package/esm/collections/systemSettings.js +0 -29
- package/esm/collections/systemSettings.js.map +0 -1
- package/esm/index.d.ts +0 -1
- package/esm/index.js +0 -2
- package/esm/index.js.map +0 -1
- package/esm/plugin.js +0 -54
- package/esm/plugin.js.map +0 -1
- package/lib/collections/systemSettings.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/plugin.d.ts +0 -8
- package/lib/plugin.js +0 -58
- package/lib/plugin.js.map +0 -1
- package/tsconfig.build.json +0 -9
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: 'systemSettings',
|
|
6
|
-
fields: [
|
|
7
|
-
{
|
|
8
|
-
type: 'string',
|
|
9
|
-
name: 'title',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
type: 'boolean',
|
|
13
|
-
name: 'showLogoOnly',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
name: 'allowSignUp',
|
|
18
|
-
defaultValue: true,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: 'belongsTo',
|
|
22
|
-
name: 'logo',
|
|
23
|
-
target: 'attachments',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'string',
|
|
27
|
-
name: 'appLang',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
30
5
|
});
|
|
31
|
-
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _database() {
|
|
9
|
+
const data = require("@nocobase/database");
|
|
10
|
+
|
|
11
|
+
_database = function _database() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var _default = (0, _database().defineCollection)({
|
|
19
|
+
name: 'systemSettings',
|
|
20
|
+
fields: [{
|
|
21
|
+
type: 'string',
|
|
22
|
+
name: 'title'
|
|
23
|
+
}, {
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
name: 'showLogoOnly'
|
|
26
|
+
}, {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
name: 'allowSignUp',
|
|
29
|
+
defaultValue: true
|
|
30
|
+
}, {
|
|
31
|
+
type: 'belongsTo',
|
|
32
|
+
name: 'logo',
|
|
33
|
+
target: 'attachments'
|
|
34
|
+
}, {
|
|
35
|
+
type: 'array',
|
|
36
|
+
name: 'enabledLanguages'
|
|
37
|
+
}, {
|
|
38
|
+
type: 'string',
|
|
39
|
+
name: 'appLang'
|
|
40
|
+
}]
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
exports.default = _default;
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './
|
|
1
|
+
export { default } from './server';
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _server.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _server = _interopRequireDefault(require("./server"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/server.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.SystemSettingsPlugin = void 0;
|
|
7
|
+
|
|
8
|
+
function _acl() {
|
|
9
|
+
const data = require("@nocobase/acl");
|
|
10
|
+
|
|
11
|
+
_acl = function _acl() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _server() {
|
|
19
|
+
const data = require("@nocobase/server");
|
|
20
|
+
|
|
21
|
+
_server = function _server() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _path() {
|
|
29
|
+
const data = require("path");
|
|
30
|
+
|
|
31
|
+
_path = function _path() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
39
|
+
|
|
40
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
41
|
+
|
|
42
|
+
class SystemSettingsPlugin extends _server().Plugin {
|
|
43
|
+
getInitAppLang(options) {
|
|
44
|
+
var _options$cliArgs, _options$cliArgs$, _options$cliArgs$$opt;
|
|
45
|
+
|
|
46
|
+
return (options === null || options === void 0 ? void 0 : (_options$cliArgs = options.cliArgs) === null || _options$cliArgs === void 0 ? void 0 : (_options$cliArgs$ = _options$cliArgs[0]) === null || _options$cliArgs$ === void 0 ? void 0 : (_options$cliArgs$$opt = _options$cliArgs$.opts) === null || _options$cliArgs$$opt === void 0 ? void 0 : _options$cliArgs$$opt.lang) || process.env.INIT_APP_LANG || 'en-US';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
install(options) {
|
|
50
|
+
var _this = this;
|
|
51
|
+
|
|
52
|
+
return _asyncToGenerator(function* () {
|
|
53
|
+
yield _this.db.getRepository('systemSettings').create({
|
|
54
|
+
values: {
|
|
55
|
+
title: 'NocoBase',
|
|
56
|
+
appLang: _this.getInitAppLang(options),
|
|
57
|
+
logo: {
|
|
58
|
+
title: 'nocobase-logo',
|
|
59
|
+
filename: '682e5ad037dd02a0fe4800a3e91c283b.png',
|
|
60
|
+
extname: '.png',
|
|
61
|
+
mimetype: 'image/png',
|
|
62
|
+
url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png'
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
})();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
beforeLoad() {
|
|
70
|
+
const cmd = this.app.findCommand('install');
|
|
71
|
+
|
|
72
|
+
if (cmd) {
|
|
73
|
+
cmd.option('-l, --lang [lang]');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
load() {
|
|
78
|
+
var _this2 = this;
|
|
79
|
+
|
|
80
|
+
return _asyncToGenerator(function* () {
|
|
81
|
+
yield _this2.app.db.import({
|
|
82
|
+
directory: (0, _path().resolve)(__dirname, 'collections')
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
_this2.app.acl.use((0, _acl().skip)({
|
|
86
|
+
resourceName: 'systemSettings',
|
|
87
|
+
actionName: 'get'
|
|
88
|
+
}));
|
|
89
|
+
})();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getName() {
|
|
93
|
+
return this.getPackageName(__dirname);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
exports.SystemSettingsPlugin = SystemSettingsPlugin;
|
|
99
|
+
var _default = SystemSettingsPlugin;
|
|
100
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-system-settings",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1-alpha.4",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"licenses": [
|
|
@@ -9,13 +9,8 @@
|
|
|
9
9
|
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm",
|
|
14
|
-
"build:cjs": "tsc --project tsconfig.build.json",
|
|
15
|
-
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm"
|
|
16
|
-
},
|
|
17
12
|
"devDependencies": {
|
|
18
|
-
"@nocobase/test": "0.7.
|
|
13
|
+
"@nocobase/test": "0.7.1-alpha.4"
|
|
19
14
|
},
|
|
20
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "570d039f1904a041729c1967c0637b1109c278a8"
|
|
21
16
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineCollection } from '@nocobase/database';
|
|
2
|
-
export default defineCollection({
|
|
3
|
-
name: 'systemSettings',
|
|
4
|
-
fields: [
|
|
5
|
-
{
|
|
6
|
-
type: 'string',
|
|
7
|
-
name: 'title',
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
type: 'boolean',
|
|
11
|
-
name: 'showLogoOnly',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
type: 'boolean',
|
|
15
|
-
name: 'allowSignUp',
|
|
16
|
-
defaultValue: true,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: 'belongsTo',
|
|
20
|
-
name: 'logo',
|
|
21
|
-
target: 'attachments',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: 'string',
|
|
25
|
-
name: 'appLang',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=systemSettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"systemSettings.js","sourceRoot":"","sources":["../../src/collections/systemSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAe,gBAAgB,CAAC;IAC9B,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE;QACN;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;SACd;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,cAAc;SACrB;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,aAAa;YACnB,YAAY,EAAE,IAAI;SACnB;QACD;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,aAAa;SACtB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC,CAAC","sourcesContent":["import { defineCollection } from '@nocobase/database';\n\nexport default defineCollection({\n name: 'systemSettings',\n fields: [\n {\n type: 'string',\n name: 'title',\n },\n {\n type: 'boolean',\n name: 'showLogoOnly',\n },\n {\n type: 'boolean',\n name: 'allowSignUp',\n defaultValue: true,\n },\n {\n type: 'belongsTo',\n name: 'logo',\n target: 'attachments',\n },\n {\n type: 'string',\n name: 'appLang',\n },\n ],\n});\n\n"]}
|
package/esm/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './plugin';
|
package/esm/index.js
DELETED
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { default } from './plugin';\n"]}
|
package/esm/plugin.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { skip } from '@nocobase/acl';
|
|
11
|
-
import { Plugin } from '@nocobase/server';
|
|
12
|
-
import { resolve } from 'path';
|
|
13
|
-
export class SystemSettingsPlugin extends Plugin {
|
|
14
|
-
install(options) {
|
|
15
|
-
var _a, _b, _c;
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
yield this.db.getRepository('systemSettings').create({
|
|
18
|
-
values: {
|
|
19
|
-
title: 'NocoBase',
|
|
20
|
-
appLang: ((_c = (_b = (_a = options === null || options === void 0 ? void 0 : options.cliArgs) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.opts) === null || _c === void 0 ? void 0 : _c.lang) || process.env.APP_LANG || 'en-US',
|
|
21
|
-
logo: {
|
|
22
|
-
title: 'nocobase-logo',
|
|
23
|
-
filename: '682e5ad037dd02a0fe4800a3e91c283b.png',
|
|
24
|
-
extname: '.png',
|
|
25
|
-
mimetype: 'image/png',
|
|
26
|
-
url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
beforeLoad() {
|
|
33
|
-
const cmd = this.app.findCommand('install');
|
|
34
|
-
if (cmd) {
|
|
35
|
-
cmd.option('--lang [lang]');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
load() {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
yield this.app.db.import({
|
|
41
|
-
directory: resolve(__dirname, 'collections'),
|
|
42
|
-
});
|
|
43
|
-
this.app.acl.use(skip({
|
|
44
|
-
resourceName: 'systemSettings',
|
|
45
|
-
actionName: 'get',
|
|
46
|
-
}));
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
getName() {
|
|
50
|
-
return this.getPackageName(__dirname);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export default SystemSettingsPlugin;
|
|
54
|
-
//# sourceMappingURL=plugin.js.map
|
package/esm/plugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAkB,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,OAAO,oBAAqB,SAAQ,MAAM;IACxC,OAAO,CAAC,OAAwB;;;YACpC,MAAM,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;gBACnD,MAAM,EAAE;oBACN,KAAK,EAAE,UAAU;oBACjB,OAAO,EAAE,CAAA,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,IAAI,KAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO;oBAC7E,IAAI,EAAE;wBACJ,KAAK,EAAE,eAAe;wBACtB,QAAQ,EAAE,sCAAsC;wBAChD,OAAO,EAAE,MAAM;wBACf,QAAQ,EAAE,WAAW;wBACrB,GAAG,EAAE,mFAAmF;qBACzF;iBACF;aACF,CAAC,CAAC;;KACJ;IAED,UAAU;QACR,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;SAC7B;IACH,CAAC;IAEK,IAAI;;YACR,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC;gBACvB,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC;aAC7C,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CACd,IAAI,CAAC;gBACH,YAAY,EAAE,gBAAgB;gBAC9B,UAAU,EAAE,KAAK;aAClB,CAAC,CACH,CAAC;QACJ,CAAC;KAAA;IAED,OAAO;QACL,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;CACF;AAED,eAAe,oBAAoB,CAAC","sourcesContent":["import { skip } from '@nocobase/acl';\nimport { InstallOptions, Plugin } from '@nocobase/server';\nimport { resolve } from 'path';\n\nexport class SystemSettingsPlugin extends Plugin {\n async install(options?: InstallOptions) {\n await this.db.getRepository('systemSettings').create({\n values: {\n title: 'NocoBase',\n appLang: options?.cliArgs?.[0]?.opts?.lang || process.env.APP_LANG || 'en-US',\n logo: {\n title: 'nocobase-logo',\n filename: '682e5ad037dd02a0fe4800a3e91c283b.png',\n extname: '.png',\n mimetype: 'image/png',\n url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png',\n },\n },\n });\n }\n\n beforeLoad() {\n const cmd = this.app.findCommand('install');\n if (cmd) {\n cmd.option('--lang [lang]');\n }\n }\n\n async load() {\n await this.app.db.import({\n directory: resolve(__dirname, 'collections'),\n });\n this.app.acl.use(\n skip({\n resourceName: 'systemSettings',\n actionName: 'get',\n }),\n );\n }\n\n getName(): string {\n return this.getPackageName(__dirname);\n }\n}\n\nexport default SystemSettingsPlugin;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"systemSettings.js","sourceRoot":"","sources":["../../src/collections/systemSettings.ts"],"names":[],"mappings":";;AAAA,iDAAsD;AAEtD,kBAAe,IAAA,2BAAgB,EAAC;IAC9B,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE;QACN;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;SACd;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,cAAc;SACrB;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,aAAa;YACnB,YAAY,EAAE,IAAI;SACnB;QACD;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,aAAa;SACtB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC,CAAC","sourcesContent":["import { defineCollection } from '@nocobase/database';\n\nexport default defineCollection({\n name: 'systemSettings',\n fields: [\n {\n type: 'string',\n name: 'title',\n },\n {\n type: 'boolean',\n name: 'showLogoOnly',\n },\n {\n type: 'boolean',\n name: 'allowSignUp',\n defaultValue: true,\n },\n {\n type: 'belongsTo',\n name: 'logo',\n target: 'attachments',\n },\n {\n type: 'string',\n name: 'appLang',\n },\n ],\n});\n\n"]}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAmC;AAA1B,kHAAA,OAAO,OAAA","sourcesContent":["export { default } from './plugin';\n"]}
|
package/lib/plugin.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { InstallOptions, Plugin } from '@nocobase/server';
|
|
2
|
-
export declare class SystemSettingsPlugin extends Plugin {
|
|
3
|
-
install(options?: InstallOptions): Promise<void>;
|
|
4
|
-
beforeLoad(): void;
|
|
5
|
-
load(): Promise<void>;
|
|
6
|
-
getName(): string;
|
|
7
|
-
}
|
|
8
|
-
export default SystemSettingsPlugin;
|
package/lib/plugin.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SystemSettingsPlugin = void 0;
|
|
13
|
-
const acl_1 = require("@nocobase/acl");
|
|
14
|
-
const server_1 = require("@nocobase/server");
|
|
15
|
-
const path_1 = require("path");
|
|
16
|
-
class SystemSettingsPlugin extends server_1.Plugin {
|
|
17
|
-
install(options) {
|
|
18
|
-
var _a, _b, _c;
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
yield this.db.getRepository('systemSettings').create({
|
|
21
|
-
values: {
|
|
22
|
-
title: 'NocoBase',
|
|
23
|
-
appLang: ((_c = (_b = (_a = options === null || options === void 0 ? void 0 : options.cliArgs) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.opts) === null || _c === void 0 ? void 0 : _c.lang) || process.env.APP_LANG || 'en-US',
|
|
24
|
-
logo: {
|
|
25
|
-
title: 'nocobase-logo',
|
|
26
|
-
filename: '682e5ad037dd02a0fe4800a3e91c283b.png',
|
|
27
|
-
extname: '.png',
|
|
28
|
-
mimetype: 'image/png',
|
|
29
|
-
url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
beforeLoad() {
|
|
36
|
-
const cmd = this.app.findCommand('install');
|
|
37
|
-
if (cmd) {
|
|
38
|
-
cmd.option('--lang [lang]');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
load() {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
yield this.app.db.import({
|
|
44
|
-
directory: (0, path_1.resolve)(__dirname, 'collections'),
|
|
45
|
-
});
|
|
46
|
-
this.app.acl.use((0, acl_1.skip)({
|
|
47
|
-
resourceName: 'systemSettings',
|
|
48
|
-
actionName: 'get',
|
|
49
|
-
}));
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
getName() {
|
|
53
|
-
return this.getPackageName(__dirname);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.SystemSettingsPlugin = SystemSettingsPlugin;
|
|
57
|
-
exports.default = SystemSettingsPlugin;
|
|
58
|
-
//# sourceMappingURL=plugin.js.map
|
package/lib/plugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAqC;AACrC,6CAA0D;AAC1D,+BAA+B;AAE/B,MAAa,oBAAqB,SAAQ,eAAM;IACxC,OAAO,CAAC,OAAwB;;;YACpC,MAAM,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;gBACnD,MAAM,EAAE;oBACN,KAAK,EAAE,UAAU;oBACjB,OAAO,EAAE,CAAA,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,IAAI,KAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO;oBAC7E,IAAI,EAAE;wBACJ,KAAK,EAAE,eAAe;wBACtB,QAAQ,EAAE,sCAAsC;wBAChD,OAAO,EAAE,MAAM;wBACf,QAAQ,EAAE,WAAW;wBACrB,GAAG,EAAE,mFAAmF;qBACzF;iBACF;aACF,CAAC,CAAC;;KACJ;IAED,UAAU;QACR,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;SAC7B;IACH,CAAC;IAEK,IAAI;;YACR,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC;gBACvB,SAAS,EAAE,IAAA,cAAO,EAAC,SAAS,EAAE,aAAa,CAAC;aAC7C,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CACd,IAAA,UAAI,EAAC;gBACH,YAAY,EAAE,gBAAgB;gBAC9B,UAAU,EAAE,KAAK;aAClB,CAAC,CACH,CAAC;QACJ,CAAC;KAAA;IAED,OAAO;QACL,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;CACF;AAvCD,oDAuCC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import { skip } from '@nocobase/acl';\nimport { InstallOptions, Plugin } from '@nocobase/server';\nimport { resolve } from 'path';\n\nexport class SystemSettingsPlugin extends Plugin {\n async install(options?: InstallOptions) {\n await this.db.getRepository('systemSettings').create({\n values: {\n title: 'NocoBase',\n appLang: options?.cliArgs?.[0]?.opts?.lang || process.env.APP_LANG || 'en-US',\n logo: {\n title: 'nocobase-logo',\n filename: '682e5ad037dd02a0fe4800a3e91c283b.png',\n extname: '.png',\n mimetype: 'image/png',\n url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png',\n },\n },\n });\n }\n\n beforeLoad() {\n const cmd = this.app.findCommand('install');\n if (cmd) {\n cmd.option('--lang [lang]');\n }\n }\n\n async load() {\n await this.app.db.import({\n directory: resolve(__dirname, 'collections'),\n });\n this.app.acl.use(\n skip({\n resourceName: 'systemSettings',\n actionName: 'get',\n }),\n );\n }\n\n getName(): string {\n return this.getPackageName(__dirname);\n }\n}\n\nexport default SystemSettingsPlugin;\n"]}
|
package/tsconfig.build.json
DELETED