@nocobase/server 2.1.0-alpha.15 → 2.1.0-alpha.17

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.
@@ -16,6 +16,7 @@ export declare const appOptionsFactory: (appName: string, mainApp: Application,
16
16
  migrator?: any;
17
17
  usingBigIntForId?: boolean;
18
18
  underscored?: boolean;
19
+ rawTimezone?: string;
19
20
  logger?: import("@nocobase/logger/lib/logger").Logger | import("@nocobase/logger/lib/logger").LoggerOptions;
20
21
  customHooks?: any;
21
22
  instanceId?: string;
@@ -32,35 +32,12 @@ __export(pm_exports, {
32
32
  module.exports = __toCommonJS(pm_exports);
33
33
  var import_app_supervisor = require("../app-supervisor");
34
34
  var import_plugin_command_error = require("../errors/plugin-command-error");
35
- var import_plugin_manager = require("../plugin-manager");
36
- var import_findPackageNames = require("../plugin-manager/findPackageNames");
35
+ var import_utils = require("../plugin-manager/utils");
37
36
  /* istanbul ignore file -- @preserve */
38
37
  var pm_default = /* @__PURE__ */ __name((app) => {
39
38
  const pm = app.command("pm");
40
39
  pm.command("list").action(async () => {
41
- const plugins1 = await (0, import_findPackageNames.findBuiltInPlugins)();
42
- const plugins2 = await (0, import_findPackageNames.findLocalPlugins)();
43
- let enabledPlugins = [];
44
- try {
45
- enabledPlugins = (await app.pm.repository.find({
46
- filter: {
47
- enabled: true
48
- }
49
- })).map((item) => item.packageName);
50
- } catch (error) {
51
- }
52
- const items = await Promise.all(
53
- [...plugins1, ...plugins2].map(async (name) => {
54
- const item = await import_plugin_manager.PluginManager.parseName(name);
55
- const json = await import_plugin_manager.PluginManager.getPackageJson(item.packageName);
56
- return {
57
- displayName: json.displayName || name,
58
- packageName: item.packageName,
59
- enabled: enabledPlugins.includes(item.packageName),
60
- description: json.description
61
- };
62
- })
63
- );
40
+ const items = await (0, import_utils.pmListSummary)(app);
64
41
  console.log("--- BEGIN_PLUGIN_LIST_JSON ---");
65
42
  console.log(JSON.stringify(items));
66
43
  console.log("--- END_PLUGIN_LIST_JSON ---");
@@ -24,7 +24,7 @@ declare const _default: {
24
24
  enable(ctx: any, next: any): Promise<void>;
25
25
  disable(ctx: any, next: any): Promise<void>;
26
26
  remove(ctx: any, next: any): Promise<void>;
27
- list(ctx: any, next: any): Promise<void>;
27
+ list(ctx: any, next: any): Promise<any>;
28
28
  listEnabled(ctx: any, next: any): Promise<void>;
29
29
  listEnabledV2(ctx: any, next: any): Promise<void>;
30
30
  get(ctx: any, next: any): Promise<void>;
@@ -48,6 +48,7 @@ var import_fs = __toESM(require("fs"));
48
48
  var import_fs_extra = __toESM(require("fs-extra"));
49
49
  var import_path = __toESM(require("path"));
50
50
  var import_crypto = __toESM(require("crypto"));
51
+ var import_utils2 = require("../utils");
51
52
  var import_package = __toESM(require("../../../package.json"));
52
53
  const PLUGIN_CLIENT_ENTRY_FILES = {
53
54
  client: "dist/client/index.js",
@@ -240,6 +241,11 @@ var resource_default = {
240
241
  await next();
241
242
  },
242
243
  async list(ctx, next) {
244
+ const { mode } = ctx.action.params;
245
+ if (mode === "summary") {
246
+ ctx.body = await (0, import_utils2.pmListSummary)(ctx.app);
247
+ return next();
248
+ }
243
249
  const locale = ctx.getCurrentLocale();
244
250
  const pm = ctx.app.pm;
245
251
  const plugin = pm.get("nocobase");
@@ -9,6 +9,7 @@
9
9
  import { AxiosRequestConfig } from 'axios';
10
10
  import { PluginManagerRepository } from './plugin-manager-repository';
11
11
  import { PluginData } from './types';
12
+ import Application from '../application';
12
13
  /**
13
14
  * get temp dir
14
15
  *
@@ -112,4 +113,10 @@ export declare function checkAndGetCompatible(packageName: string): Promise<{
112
113
  depsCompatible: DepCompatible[];
113
114
  }>;
114
115
  export declare function getPluginBasePath(packageName: string): Promise<string>;
116
+ export declare function pmListSummary(app: Application): Promise<{
117
+ displayName: any;
118
+ packageName: any;
119
+ enabled: boolean;
120
+ description: any;
121
+ }[]>;
115
122
  export {};
@@ -65,6 +65,7 @@ __export(utils_exports, {
65
65
  getTempDir: () => getTempDir,
66
66
  isNotBuiltinModule: () => isNotBuiltinModule,
67
67
  isValidPackageName: () => isValidPackageName,
68
+ pmListSummary: () => pmListSummary,
68
69
  readJSONFileContent: () => readJSONFileContent,
69
70
  removePluginPackage: () => removePluginPackage,
70
71
  removeRequireCache: () => removeRequireCache,
@@ -88,6 +89,8 @@ var import_semver = __toESM(require("semver"));
88
89
  var import_clientStaticUtils = require("./clientStaticUtils");
89
90
  var import_constants = require("./constants");
90
91
  var import_deps = __toESM(require("./deps"));
92
+ var import_findPackageNames = require("./findPackageNames");
93
+ var import_plugin_manager = __toESM(require("./plugin-manager"));
91
94
  /* istanbul ignore next -- @preserve */
92
95
  async function getTempDir() {
93
96
  const temporaryDirectory = await import_fs_extra.default.realpath(import_os.default.tmpdir());
@@ -525,6 +528,33 @@ async function getPluginBasePath(packageName) {
525
528
  return import_path.default.dirname(import_path.default.dirname(file));
526
529
  }
527
530
  __name(getPluginBasePath, "getPluginBasePath");
531
+ async function pmListSummary(app) {
532
+ const plugins1 = await (0, import_findPackageNames.findBuiltInPlugins)();
533
+ const plugins2 = await (0, import_findPackageNames.findLocalPlugins)();
534
+ let enabledPlugins = [];
535
+ try {
536
+ enabledPlugins = (await app.pm.repository.find({
537
+ filter: {
538
+ enabled: true
539
+ }
540
+ })).map((item) => item.packageName);
541
+ } catch (error) {
542
+ }
543
+ const items = await Promise.all(
544
+ [...plugins1, ...plugins2].map(async (name) => {
545
+ const item = await import_plugin_manager.default.parseName(name);
546
+ const json = await import_plugin_manager.default.getPackageJson(item.packageName);
547
+ return {
548
+ displayName: json.displayName || name,
549
+ packageName: item.packageName,
550
+ enabled: enabledPlugins.includes(item.packageName),
551
+ description: json.description
552
+ };
553
+ })
554
+ );
555
+ return items;
556
+ }
557
+ __name(pmListSummary, "pmListSummary");
528
558
  // Annotate the CommonJS export names for ESM import in node:
529
559
  0 && (module.exports = {
530
560
  checkAndGetCompatible,
@@ -555,6 +585,7 @@ __name(getPluginBasePath, "getPluginBasePath");
555
585
  getTempDir,
556
586
  isNotBuiltinModule,
557
587
  isValidPackageName,
588
+ pmListSummary,
558
589
  readJSONFileContent,
559
590
  removePluginPackage,
560
591
  removeRequireCache,
@@ -0,0 +1,102 @@
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
+ readonly '/app:getLang': {
11
+ readonly get: {
12
+ readonly tags: readonly ["app"];
13
+ readonly summary: "Get the current application language";
14
+ readonly description: "Return the current locale used by the server.";
15
+ readonly parameters: readonly [];
16
+ readonly responses: {
17
+ readonly 200: {
18
+ readonly description: "OK";
19
+ readonly content: {
20
+ readonly 'application/json': {
21
+ readonly schema: {
22
+ readonly type: "string";
23
+ };
24
+ };
25
+ };
26
+ };
27
+ };
28
+ };
29
+ };
30
+ readonly '/app:getInfo': {
31
+ readonly get: {
32
+ readonly tags: readonly ["app"];
33
+ readonly summary: "Get application metadata";
34
+ readonly description: "Return basic application information, including version and environment-related metadata.";
35
+ readonly parameters: readonly [];
36
+ readonly responses: {
37
+ readonly 200: {
38
+ readonly description: "OK";
39
+ readonly content: {
40
+ readonly 'application/json': {
41
+ readonly schema: {
42
+ readonly type: "object";
43
+ readonly additionalProperties: true;
44
+ };
45
+ };
46
+ };
47
+ };
48
+ };
49
+ };
50
+ };
51
+ readonly '/app:getPlugins': {
52
+ readonly get: {
53
+ readonly tags: readonly ["app"];
54
+ readonly summary: "List loaded plugins";
55
+ readonly description: "Return plugin metadata for the current application runtime.";
56
+ readonly parameters: readonly [];
57
+ readonly responses: {
58
+ readonly 200: {
59
+ readonly description: "OK";
60
+ readonly content: {
61
+ readonly 'application/json': {
62
+ readonly schema: {
63
+ readonly type: "array";
64
+ readonly items: {
65
+ readonly type: "object";
66
+ readonly additionalProperties: true;
67
+ };
68
+ };
69
+ };
70
+ };
71
+ };
72
+ };
73
+ };
74
+ };
75
+ readonly '/app:restart': {
76
+ readonly post: {
77
+ readonly tags: readonly ["app"];
78
+ readonly summary: "Restart the application";
79
+ readonly description: "Trigger an application restart asynchronously.";
80
+ readonly parameters: readonly [];
81
+ readonly responses: {
82
+ readonly 200: {
83
+ readonly description: "OK";
84
+ };
85
+ };
86
+ };
87
+ };
88
+ readonly '/app:clearCache': {
89
+ readonly post: {
90
+ readonly tags: readonly ["app"];
91
+ readonly summary: "Clear application cache";
92
+ readonly description: "Clear server-side caches used by the current application instance.";
93
+ readonly parameters: readonly [];
94
+ readonly responses: {
95
+ readonly 200: {
96
+ readonly description: "OK";
97
+ };
98
+ };
99
+ };
100
+ };
101
+ };
102
+ export default _default;
@@ -0,0 +1,124 @@
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 app_exports = {};
28
+ __export(app_exports, {
29
+ default: () => app_default
30
+ });
31
+ module.exports = __toCommonJS(app_exports);
32
+ var app_default = {
33
+ "/app:getLang": {
34
+ get: {
35
+ tags: ["app"],
36
+ summary: "Get the current application language",
37
+ description: "Return the current locale used by the server.",
38
+ parameters: [],
39
+ responses: {
40
+ 200: {
41
+ description: "OK",
42
+ content: {
43
+ "application/json": {
44
+ schema: {
45
+ type: "string"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ },
53
+ "/app:getInfo": {
54
+ get: {
55
+ tags: ["app"],
56
+ summary: "Get application metadata",
57
+ description: "Return basic application information, including version and environment-related metadata.",
58
+ parameters: [],
59
+ responses: {
60
+ 200: {
61
+ description: "OK",
62
+ content: {
63
+ "application/json": {
64
+ schema: {
65
+ type: "object",
66
+ additionalProperties: true
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ },
74
+ "/app:getPlugins": {
75
+ get: {
76
+ tags: ["app"],
77
+ summary: "List loaded plugins",
78
+ description: "Return plugin metadata for the current application runtime.",
79
+ parameters: [],
80
+ responses: {
81
+ 200: {
82
+ description: "OK",
83
+ content: {
84
+ "application/json": {
85
+ schema: {
86
+ type: "array",
87
+ items: {
88
+ type: "object",
89
+ additionalProperties: true
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "/app:restart": {
99
+ post: {
100
+ tags: ["app"],
101
+ summary: "Restart the application",
102
+ description: "Trigger an application restart asynchronously.",
103
+ parameters: [],
104
+ responses: {
105
+ 200: {
106
+ description: "OK"
107
+ }
108
+ }
109
+ }
110
+ },
111
+ "/app:clearCache": {
112
+ post: {
113
+ tags: ["app"],
114
+ summary: "Clear application cache",
115
+ description: "Clear server-side caches used by the current application instance.",
116
+ parameters: [],
117
+ responses: {
118
+ 200: {
119
+ description: "OK"
120
+ }
121
+ }
122
+ }
123
+ }
124
+ };
@@ -0,0 +1,244 @@
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
+ readonly openapi: "3.0.2";
11
+ readonly info: {
12
+ readonly title: "NocoBase API - Core";
13
+ };
14
+ readonly tags: readonly [{
15
+ readonly name: "$collection";
16
+ readonly description: "Data table";
17
+ }, {
18
+ readonly name: "$collection.$oneToOneAssociation";
19
+ readonly description: "One to one relationship";
20
+ }, {
21
+ readonly name: "$collection.$manyToOneAssociation";
22
+ readonly description: "Many to one relationship";
23
+ }, {
24
+ readonly name: "$collection.$oneToManyAssociation";
25
+ readonly description: "One to many relationship";
26
+ }, {
27
+ readonly name: "$collection.$manyToManyAssociation";
28
+ readonly description: "Many to many relationship";
29
+ }, {
30
+ readonly name: "app";
31
+ readonly description: "app";
32
+ }, {
33
+ readonly name: "pm";
34
+ readonly description: "pm";
35
+ }];
36
+ readonly components: {
37
+ readonly parameters: {
38
+ readonly collectionName: {
39
+ readonly required: true;
40
+ readonly name: "collectionName";
41
+ readonly in: "path";
42
+ readonly description: "Collection name";
43
+ readonly schema: {
44
+ readonly type: "string";
45
+ };
46
+ };
47
+ readonly collectionIndex: {
48
+ readonly required: true;
49
+ readonly name: "collectionIndex";
50
+ readonly in: "path";
51
+ readonly description: "Collection index";
52
+ readonly schema: {
53
+ readonly type: "integer";
54
+ readonly format: "int64";
55
+ };
56
+ };
57
+ readonly oneToOneAssociation: {
58
+ readonly required: true;
59
+ readonly name: "oneToOneAssociation";
60
+ readonly in: "path";
61
+ readonly description: "Association name";
62
+ readonly schema: {
63
+ readonly type: "string";
64
+ };
65
+ };
66
+ readonly manyToOneAssociation: {
67
+ readonly required: true;
68
+ readonly name: "manyToOneAssociation";
69
+ readonly in: "path";
70
+ readonly description: "Association name";
71
+ readonly schema: {
72
+ readonly type: "string";
73
+ };
74
+ };
75
+ readonly oneToManyAssociation: {
76
+ readonly required: true;
77
+ readonly name: "oneToManyAssociation";
78
+ readonly in: "path";
79
+ readonly description: "Association name";
80
+ readonly schema: {
81
+ readonly type: "string";
82
+ };
83
+ };
84
+ readonly manyToManyAssociation: {
85
+ readonly required: true;
86
+ readonly name: "manyToManyAssociation";
87
+ readonly in: "path";
88
+ readonly description: "Association name";
89
+ readonly schema: {
90
+ readonly type: "string";
91
+ };
92
+ };
93
+ readonly page: {
94
+ readonly name: "page";
95
+ readonly in: "query";
96
+ readonly description: "page number";
97
+ readonly required: false;
98
+ readonly schema: {
99
+ readonly type: "integer";
100
+ };
101
+ };
102
+ readonly pageSize: {
103
+ readonly name: "pageSize";
104
+ readonly in: "query";
105
+ readonly description: "page size";
106
+ readonly required: false;
107
+ readonly schema: {
108
+ readonly type: "integer";
109
+ };
110
+ };
111
+ readonly filterByTk: {
112
+ readonly name: "filterByTk";
113
+ readonly in: "query";
114
+ readonly description: "filter by TK(default by ID)";
115
+ readonly schema: {
116
+ readonly type: "string";
117
+ };
118
+ };
119
+ readonly filterByTks: {
120
+ readonly name: "filterByTks";
121
+ readonly in: "query";
122
+ readonly description: "filter by TKs(default by ID), example: `1,2,3`";
123
+ readonly schema: {
124
+ readonly type: "string";
125
+ };
126
+ };
127
+ readonly filter: {
128
+ readonly name: "filter";
129
+ readonly in: "query";
130
+ readonly description: "filter items";
131
+ readonly content: {
132
+ readonly 'application/json': {
133
+ readonly schema: {
134
+ readonly type: "object";
135
+ };
136
+ };
137
+ };
138
+ };
139
+ readonly sort: {
140
+ readonly name: "sort";
141
+ readonly in: "query";
142
+ readonly description: "sort items by fields, example: `-field1,-field2,field3`";
143
+ readonly schema: {
144
+ readonly oneOf: readonly [{
145
+ readonly type: "array";
146
+ readonly items: {
147
+ readonly type: "string";
148
+ };
149
+ readonly example: readonly ["-id", "createdAt"];
150
+ }, {
151
+ readonly type: "string";
152
+ readonly example: "-id,createdAt";
153
+ }];
154
+ };
155
+ };
156
+ readonly fields: {
157
+ readonly name: "fields";
158
+ readonly in: "query";
159
+ readonly description: "select fields, example: `field1,field2`";
160
+ readonly schema: {
161
+ readonly oneOf: readonly [{
162
+ readonly type: "array";
163
+ readonly items: {
164
+ readonly type: "string";
165
+ };
166
+ readonly example: readonly ["id", "createdAt"];
167
+ }, {
168
+ readonly type: "string";
169
+ readonly example: "id,createdAt";
170
+ }];
171
+ };
172
+ };
173
+ readonly except: {
174
+ readonly name: "except";
175
+ readonly in: "query";
176
+ readonly description: "except fields in results, example: `field1,field2`";
177
+ readonly schema: {
178
+ readonly oneOf: readonly [{
179
+ readonly type: "array";
180
+ readonly items: {
181
+ readonly type: "string";
182
+ };
183
+ readonly example: readonly ["id", "createdAt"];
184
+ }, {
185
+ readonly type: "string";
186
+ readonly example: "id,createdAt";
187
+ }];
188
+ };
189
+ };
190
+ readonly appends: {
191
+ readonly name: "appends";
192
+ readonly in: "query";
193
+ readonly description: "append associations in results, example: `assoc1,assoc2`";
194
+ readonly schema: {
195
+ readonly oneOf: readonly [{
196
+ readonly type: "array";
197
+ readonly items: {
198
+ readonly type: "string";
199
+ };
200
+ readonly example: readonly ["id", "createdAt"];
201
+ }, {
202
+ readonly type: "string";
203
+ readonly example: "id,createdAt";
204
+ }];
205
+ };
206
+ };
207
+ readonly whitelist: {
208
+ readonly name: "whitelist";
209
+ readonly in: "query";
210
+ readonly description: "whitelist for fields changes, example: `field1,field2`";
211
+ readonly schema: {
212
+ readonly oneOf: readonly [{
213
+ readonly type: "array";
214
+ readonly items: {
215
+ readonly type: "string";
216
+ };
217
+ readonly example: readonly ["id", "createdAt"];
218
+ }, {
219
+ readonly type: "string";
220
+ readonly example: "id,createdAt";
221
+ }];
222
+ };
223
+ };
224
+ readonly blacklist: {
225
+ readonly name: "blacklist";
226
+ readonly in: "query";
227
+ readonly description: "blacklist for fields changes, example: `field1,field2`";
228
+ readonly schema: {
229
+ readonly oneOf: readonly [{
230
+ readonly type: "array";
231
+ readonly items: {
232
+ readonly type: "string";
233
+ };
234
+ readonly example: readonly ["id", "createdAt"];
235
+ }, {
236
+ readonly type: "string";
237
+ readonly example: "id,createdAt";
238
+ }];
239
+ };
240
+ };
241
+ };
242
+ };
243
+ };
244
+ export default _default;