@nocobase/server 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.
Files changed (124) hide show
  1. package/package.json +14 -14
  2. package/lib/acl/available-action.d.ts +0 -13
  3. package/lib/acl/available-action.js +0 -71
  4. package/lib/acl/index.d.ts +0 -10
  5. package/lib/acl/index.js +0 -46
  6. package/lib/app-command.d.ts +0 -20
  7. package/lib/app-command.js +0 -82
  8. package/lib/app-supervisor.d.ts +0 -69
  9. package/lib/app-supervisor.js +0 -302
  10. package/lib/application.d.ts +0 -345
  11. package/lib/application.js +0 -876
  12. package/lib/cache/index.d.ts +0 -11
  13. package/lib/cache/index.js +0 -44
  14. package/lib/commands/console.d.ts +0 -11
  15. package/lib/commands/console.js +0 -48
  16. package/lib/commands/create-migration.d.ts +0 -11
  17. package/lib/commands/create-migration.js +0 -79
  18. package/lib/commands/db-auth.d.ts +0 -11
  19. package/lib/commands/db-auth.js +0 -38
  20. package/lib/commands/db-clean.d.ts +0 -11
  21. package/lib/commands/db-clean.js +0 -41
  22. package/lib/commands/db-sync.d.ts +0 -11
  23. package/lib/commands/db-sync.js +0 -50
  24. package/lib/commands/destroy.d.ts +0 -11
  25. package/lib/commands/destroy.js +0 -40
  26. package/lib/commands/index.d.ts +0 -10
  27. package/lib/commands/index.js +0 -82
  28. package/lib/commands/install.d.ts +0 -11
  29. package/lib/commands/install.js +0 -43
  30. package/lib/commands/migrator.d.ts +0 -11
  31. package/lib/commands/migrator.js +0 -41
  32. package/lib/commands/pm.d.ts +0 -11
  33. package/lib/commands/pm.js +0 -98
  34. package/lib/commands/refresh.d.ts +0 -11
  35. package/lib/commands/refresh.js +0 -41
  36. package/lib/commands/restart.d.ts +0 -11
  37. package/lib/commands/restart.js +0 -45
  38. package/lib/commands/start.d.ts +0 -11
  39. package/lib/commands/start.js +0 -85
  40. package/lib/commands/stop.d.ts +0 -11
  41. package/lib/commands/stop.js +0 -44
  42. package/lib/commands/upgrade.d.ts +0 -14
  43. package/lib/commands/upgrade.js +0 -39
  44. package/lib/cron/cron-job-manager.d.ts +0 -22
  45. package/lib/cron/cron-job-manager.js +0 -82
  46. package/lib/errors/application-not-install.d.ts +0 -12
  47. package/lib/errors/application-not-install.js +0 -45
  48. package/lib/errors/handler.d.ts +0 -11
  49. package/lib/errors/handler.js +0 -50
  50. package/lib/errors/plugin-command-error.d.ts +0 -10
  51. package/lib/errors/plugin-command-error.js +0 -40
  52. package/lib/errors/plugin-not-exist.d.ts +0 -10
  53. package/lib/errors/plugin-not-exist.js +0 -40
  54. package/lib/gateway/errors.d.ts +0 -30
  55. package/lib/gateway/errors.js +0 -154
  56. package/lib/gateway/index.d.ts +0 -79
  57. package/lib/gateway/index.js +0 -393
  58. package/lib/gateway/ipc-socket-client.d.ts +0 -27
  59. package/lib/gateway/ipc-socket-client.js +0 -110
  60. package/lib/gateway/ipc-socket-server.d.ts +0 -21
  61. package/lib/gateway/ipc-socket-server.js +0 -150
  62. package/lib/gateway/ws-server.d.ts +0 -36
  63. package/lib/gateway/ws-server.js +0 -196
  64. package/lib/helper.d.ts +0 -18
  65. package/lib/helper.js +0 -193
  66. package/lib/helpers/application-version.d.ts +0 -18
  67. package/lib/helpers/application-version.js +0 -88
  68. package/lib/index.d.ts +0 -17
  69. package/lib/index.js +0 -64
  70. package/lib/locale/index.d.ts +0 -9
  71. package/lib/locale/index.js +0 -30
  72. package/lib/locale/locale.d.ts +0 -38
  73. package/lib/locale/locale.js +0 -174
  74. package/lib/locale/resource.d.ts +0 -9
  75. package/lib/locale/resource.js +0 -87
  76. package/lib/main-data-source.d.ts +0 -12
  77. package/lib/main-data-source.js +0 -57
  78. package/lib/middlewares/data-template.d.ts +0 -10
  79. package/lib/middlewares/data-template.js +0 -146
  80. package/lib/middlewares/data-wrapping.d.ts +0 -11
  81. package/lib/middlewares/data-wrapping.js +0 -100
  82. package/lib/middlewares/i18n.d.ts +0 -9
  83. package/lib/middlewares/i18n.js +0 -53
  84. package/lib/middlewares/index.d.ts +0 -10
  85. package/lib/middlewares/index.js +0 -39
  86. package/lib/middlewares/parse-variables.d.ts +0 -9
  87. package/lib/middlewares/parse-variables.js +0 -95
  88. package/lib/middlewares/validate-filter-params.d.ts +0 -9
  89. package/lib/middlewares/validate-filter-params.js +0 -42
  90. package/lib/migration.d.ts +0 -20
  91. package/lib/migration.js +0 -54
  92. package/lib/migrations/20230912193824-package-name-unique.d.ts +0 -14
  93. package/lib/migrations/20230912193824-package-name-unique.js +0 -59
  94. package/lib/migrations/20230912294620-update-pkg.d.ts +0 -14
  95. package/lib/migrations/20230912294620-update-pkg.js +0 -65
  96. package/lib/migrations/20240106082756-update-plugins.d.ts +0 -14
  97. package/lib/migrations/20240106082756-update-plugins.js +0 -51
  98. package/lib/migrations/20240428235620-rename-plugins.d.ts +0 -14
  99. package/lib/migrations/20240428235620-rename-plugins.js +0 -49
  100. package/lib/plugin-manager/clientStaticUtils.d.ts +0 -31
  101. package/lib/plugin-manager/clientStaticUtils.js +0 -129
  102. package/lib/plugin-manager/constants.d.ts +0 -15
  103. package/lib/plugin-manager/constants.js +0 -135
  104. package/lib/plugin-manager/deps.d.ts +0 -10
  105. package/lib/plugin-manager/deps.js +0 -83
  106. package/lib/plugin-manager/index.d.ts +0 -10
  107. package/lib/plugin-manager/index.js +0 -32
  108. package/lib/plugin-manager/middleware.d.ts +0 -10
  109. package/lib/plugin-manager/middleware.js +0 -45
  110. package/lib/plugin-manager/options/collection.d.ts +0 -10
  111. package/lib/plugin-manager/options/collection.js +0 -47
  112. package/lib/plugin-manager/options/resource.d.ts +0 -23
  113. package/lib/plugin-manager/options/resource.js +0 -186
  114. package/lib/plugin-manager/plugin-manager-repository.d.ts +0 -36
  115. package/lib/plugin-manager/plugin-manager-repository.js +0 -158
  116. package/lib/plugin-manager/plugin-manager.d.ts +0 -206
  117. package/lib/plugin-manager/plugin-manager.js +0 -1100
  118. package/lib/plugin-manager/types.d.ts +0 -23
  119. package/lib/plugin-manager/types.js +0 -24
  120. package/lib/plugin-manager/utils.d.ts +0 -115
  121. package/lib/plugin-manager/utils.js +0 -568
  122. package/lib/plugin.d.ts +0 -99
  123. package/lib/plugin.js +0 -228
  124. package/lib/swagger/index.json +0 -1569
@@ -1,345 +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
- /// <reference types="node" />
10
- /// <reference types="koa-bodyparser" />
11
- import { AuthManager, AuthManagerOptions } from '@nocobase/auth';
12
- import { Cache, CacheManager, CacheManagerOptions } from '@nocobase/cache';
13
- import Database, { CollectionOptions, IDatabaseOptions } from '@nocobase/database';
14
- import { Logger, LoggerOptions, RequestLoggerOptions, SystemLogger, SystemLoggerOptions } from '@nocobase/logger';
15
- import { ResourceOptions, Resourcer } from '@nocobase/resourcer';
16
- import { Telemetry, TelemetryOptions } from '@nocobase/telemetry';
17
- import { AsyncEmitter, ToposortOptions } from '@nocobase/utils';
18
- import { Command, CommandOptions, ParseOptions } from 'commander';
19
- import { IncomingMessage, ServerResponse } from 'http';
20
- import { i18n, InitOptions } from 'i18next';
21
- import Koa, { DefaultContext as KoaDefaultContext, DefaultState as KoaDefaultState } from 'koa';
22
- import { RecordableHistogram } from 'node:perf_hooks';
23
- import { AppCommand } from './app-command';
24
- import { AppSupervisor } from './app-supervisor';
25
- import { CronJobManager } from './cron/cron-job-manager';
26
- import { ApplicationVersion } from './helpers/application-version';
27
- import { Locale } from './locale';
28
- import { Plugin } from './plugin';
29
- import { InstallOptions, PluginManager } from './plugin-manager';
30
- import { DataSourceManager, SequelizeDataSource } from '@nocobase/data-source-manager';
31
- export type PluginType = string | typeof Plugin;
32
- export type PluginConfiguration = PluginType | [PluginType, any];
33
- export interface ResourceManagerOptions {
34
- prefix?: string;
35
- }
36
- /**
37
- * this interface is deprecated and should not be used.
38
- * @deprecated
39
- * use {@link ResourceManagerOptions} instead
40
- */
41
- export interface ResourcerOptions extends ResourceManagerOptions {
42
- }
43
- export interface AppLoggerOptions {
44
- request: RequestLoggerOptions;
45
- system: SystemLoggerOptions;
46
- }
47
- export interface AppTelemetryOptions extends TelemetryOptions {
48
- enabled?: boolean;
49
- }
50
- export interface ApplicationOptions {
51
- database?: IDatabaseOptions | Database;
52
- cacheManager?: CacheManagerOptions;
53
- /**
54
- * this property is deprecated and should not be used.
55
- * @deprecated
56
- * use {@link ApplicationOptions.resourceManager} instead
57
- */
58
- resourcer?: ResourceManagerOptions;
59
- resourceManager?: ResourceManagerOptions;
60
- bodyParser?: any;
61
- cors?: any;
62
- dataWrapping?: boolean;
63
- registerActions?: boolean;
64
- i18n?: i18n | InitOptions;
65
- plugins?: PluginConfiguration[];
66
- acl?: boolean;
67
- logger?: AppLoggerOptions;
68
- /**
69
- * @internal
70
- */
71
- pmSock?: string;
72
- name?: string;
73
- authManager?: AuthManagerOptions;
74
- /**
75
- * @internal
76
- */
77
- perfHooks?: boolean;
78
- telemetry?: AppTelemetryOptions;
79
- }
80
- export interface DefaultState extends KoaDefaultState {
81
- currentUser?: any;
82
- [key: string]: any;
83
- }
84
- export interface DefaultContext extends KoaDefaultContext {
85
- db: Database;
86
- cache: Cache;
87
- resourcer: Resourcer;
88
- i18n: any;
89
- [key: string]: any;
90
- }
91
- interface ActionsOptions {
92
- resourceName?: string;
93
- resourceNames?: string[];
94
- }
95
- interface LoadOptions {
96
- reload?: boolean;
97
- hooks?: boolean;
98
- sync?: boolean;
99
- [key: string]: any;
100
- }
101
- interface StartOptions {
102
- cliArgs?: any[];
103
- dbSync?: boolean;
104
- checkInstall?: boolean;
105
- quickstart?: boolean;
106
- reload?: boolean;
107
- recover?: boolean;
108
- }
109
- type MaintainingStatus = 'command_begin' | 'command_end' | 'command_running' | 'command_error';
110
- export type MaintainingCommandStatus = {
111
- command: {
112
- name: string;
113
- };
114
- status: MaintainingStatus;
115
- error?: Error;
116
- };
117
- export declare class Application<StateT = DefaultState, ContextT = DefaultContext> extends Koa implements AsyncEmitter {
118
- options: ApplicationOptions;
119
- /**
120
- * @internal
121
- */
122
- middleware: any;
123
- /**
124
- * @internal
125
- */
126
- stopped: boolean;
127
- /**
128
- * @internal
129
- */
130
- ready: boolean;
131
- emitAsync: (event: string | symbol, ...args: any[]) => Promise<boolean>;
132
- /**
133
- * @internal
134
- */
135
- rawOptions: ApplicationOptions;
136
- /**
137
- * @internal
138
- */
139
- activatedCommand: {
140
- name: string;
141
- };
142
- /**
143
- * @internal
144
- */
145
- running: boolean;
146
- /**
147
- * @internal
148
- */
149
- perfHistograms: Map<string, RecordableHistogram>;
150
- protected plugins: Map<string, Plugin<any>>;
151
- protected _appSupervisor: AppSupervisor;
152
- protected _started: boolean;
153
- private _authenticated;
154
- private _maintaining;
155
- private _maintainingCommandStatus;
156
- private _maintainingStatusBeforeCommand;
157
- private _actionCommand;
158
- /**
159
- * @internal
160
- */
161
- requestLogger: Logger;
162
- private sqlLogger;
163
- protected _logger: SystemLogger;
164
- constructor(options: ApplicationOptions);
165
- get logger(): SystemLogger;
166
- get log(): SystemLogger;
167
- protected _loaded: boolean;
168
- /**
169
- * @internal
170
- */
171
- get loaded(): boolean;
172
- private _maintainingMessage;
173
- /**
174
- * @internal
175
- */
176
- get maintainingMessage(): string;
177
- protected _cronJobManager: CronJobManager;
178
- get cronJobManager(): CronJobManager;
179
- get mainDataSource(): SequelizeDataSource;
180
- get db(): Database;
181
- get resourceManager(): import("@nocobase/resourcer").ResourceManager;
182
- /**
183
- * This method is deprecated and should not be used.
184
- * Use {@link #resourceManager} instead.
185
- * @deprecated
186
- */
187
- get resourcer(): import("@nocobase/resourcer").ResourceManager;
188
- protected _cacheManager: CacheManager;
189
- get cacheManager(): CacheManager;
190
- protected _cache: Cache;
191
- get cache(): Cache;
192
- /**
193
- * @internal
194
- */
195
- set cache(cache: Cache);
196
- protected _cli: AppCommand;
197
- get cli(): AppCommand;
198
- protected _i18n: i18n;
199
- get i18n(): i18n;
200
- protected _pm: PluginManager;
201
- get pm(): PluginManager;
202
- get acl(): import("@nocobase/acl").ACL;
203
- protected _authManager: AuthManager;
204
- get authManager(): AuthManager;
205
- protected _locales: Locale;
206
- /**
207
- * This method is deprecated and should not be used.
208
- * Use {@link #localeManager} instead.
209
- * @deprecated
210
- */
211
- get locales(): Locale;
212
- get localeManager(): Locale;
213
- protected _telemetry: Telemetry;
214
- get telemetry(): Telemetry;
215
- protected _version: ApplicationVersion;
216
- get version(): ApplicationVersion;
217
- get name(): string;
218
- protected _dataSourceManager: DataSourceManager;
219
- get dataSourceManager(): DataSourceManager;
220
- /**
221
- * @internal
222
- */
223
- getMaintaining(): MaintainingCommandStatus;
224
- /**
225
- * @internal
226
- */
227
- setMaintaining(_maintainingCommandStatus: MaintainingCommandStatus): void;
228
- /**
229
- * @internal
230
- */
231
- setMaintainingMessage(message: string): void;
232
- /**
233
- * This method is deprecated and should not be used.
234
- * Use {@link #this.version.get()} instead.
235
- * @deprecated
236
- */
237
- getVersion(): string;
238
- /**
239
- * This method is deprecated and should not be used.
240
- * Use {@link #this.pm.addPreset()} instead.
241
- * @deprecated
242
- */
243
- plugin<O = any>(pluginClass: any, options?: O): void;
244
- use<NewStateT = {}, NewContextT = {}>(middleware: Koa.Middleware<StateT & NewStateT, ContextT & NewContextT>, options?: ToposortOptions): this;
245
- /**
246
- * @internal
247
- */
248
- callback(): (req: IncomingMessage, res: ServerResponse) => any;
249
- /**
250
- * This method is deprecated and should not be used.
251
- * Use {@link #this.db.collection()} instead.
252
- * @deprecated
253
- */
254
- collection(options: CollectionOptions): import("@nocobase/database").Collection<any, any>;
255
- /**
256
- * This method is deprecated and should not be used.
257
- * Use {@link #this.resourceManager.define()} instead.
258
- * @deprecated
259
- */
260
- resource(options: ResourceOptions): import("@nocobase/resourcer").Resource;
261
- /**
262
- * This method is deprecated and should not be used.
263
- * Use {@link #this.resourceManager.registerActionHandlers()} instead.
264
- * @deprecated
265
- */
266
- actions(handlers: any, options?: ActionsOptions): void;
267
- command(name: string, desc?: string, opts?: CommandOptions): AppCommand;
268
- findCommand(name: string): Command;
269
- /**
270
- * @internal
271
- */
272
- reInit(): Promise<void>;
273
- load(options?: LoadOptions): Promise<void>;
274
- reload(options?: LoadOptions): Promise<void>;
275
- /**
276
- * This method is deprecated and should not be used.
277
- * Use {@link this.pm.get()} instead.
278
- * @deprecated
279
- */
280
- getPlugin<P extends Plugin>(name: string | typeof Plugin): P;
281
- authenticate(): Promise<void>;
282
- runCommand(command: string, ...args: any[]): Promise<AppCommand>;
283
- runCommandThrowError(command: string, ...args: any[]): Promise<AppCommand>;
284
- /**
285
- * @internal
286
- */
287
- loadMigrations(options: any): Promise<{
288
- beforeLoad: any[];
289
- afterSync: any[];
290
- afterLoad: any[];
291
- }>;
292
- /**
293
- * @internal
294
- */
295
- loadCoreMigrations(): Promise<{
296
- beforeLoad: {
297
- up: () => Promise<void>;
298
- };
299
- afterSync: {
300
- up: () => Promise<void>;
301
- };
302
- afterLoad: {
303
- up: () => Promise<void>;
304
- };
305
- }>;
306
- /**
307
- * @internal
308
- */
309
- runAsCLI(argv?: string[], options?: ParseOptions & {
310
- throwError?: boolean;
311
- reqId?: string;
312
- }): Promise<AppCommand>;
313
- start(options?: StartOptions): Promise<void>;
314
- /**
315
- * @internal
316
- */
317
- emitStartedEvent(options?: StartOptions): Promise<void>;
318
- isStarted(): Promise<boolean>;
319
- /**
320
- * @internal
321
- */
322
- tryReloadOrRestart(options?: StartOptions): Promise<void>;
323
- restart(options?: StartOptions): Promise<void>;
324
- stop(options?: any): Promise<void>;
325
- destroy(options?: any): Promise<void>;
326
- isInstalled(): Promise<boolean>;
327
- install(options?: InstallOptions): Promise<void>;
328
- upgrade(options?: any): Promise<void>;
329
- toJSON(): {
330
- appName: string;
331
- name: string;
332
- };
333
- /**
334
- * @internal
335
- */
336
- reInitEvents(): void;
337
- createLogger(options: LoggerOptions): Logger;
338
- protected createCLI(): AppCommand;
339
- protected initLogger(options: AppLoggerOptions): void;
340
- protected closeLogger(): void;
341
- protected init(): void;
342
- protected createMainDataSource(options: ApplicationOptions): void;
343
- protected createDatabase(options: ApplicationOptions): Database;
344
- }
345
- export default Application;