@nocobase/server 0.7.0-alpha.22 → 0.7.0-alpha.25

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.
@@ -0,0 +1,5 @@
1
+ declare const _default: ({ app, cliArgs }: {
2
+ app: any;
3
+ cliArgs: any;
4
+ }) => Promise<void>;
5
+ export default _default;
@@ -0,0 +1,14 @@
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
+ export default ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, function* () {
11
+ const [opts] = cliArgs;
12
+ yield app.db.auth({ repeat: opts.repeat || 10 });
13
+ });
14
+ //# sourceMappingURL=db-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-auth.js","sourceRoot":"","sources":["../../src/commands/db-auth.ts"],"names":[],"mappings":";;;;;;;;;AAAA,eAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC,CAAA,CAAC","sourcesContent":["export default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n await app.db.auth({ repeat: opts.repeat || 10 });\n};\n"]}
@@ -1,3 +1,3 @@
1
- import Application from '../application';
2
1
  import { Command } from 'commander';
2
+ import Application from '../application';
3
3
  export declare function createCli(app: Application): Command;
@@ -12,9 +12,10 @@ export function createCli(app) {
12
12
  process.exit(1);
13
13
  });
14
14
  };
15
- program.command('start').description('start NocoBase application').action(runSubCommand('start'));
16
- program.command('install').option('-f, --force').option('-c, --clean').action(runSubCommand('install'));
15
+ program.command('start').description('start NocoBase application').option('-s, --silent').action(runSubCommand('start'));
16
+ program.command('install').option('-f, --force').option('-c, --clean').option('-s, --silent').action(runSubCommand('install'));
17
17
  program.command('db:sync').option('-f, --force').action(runSubCommand('db-sync'));
18
+ program.command('db:auth').option('-r, --repeat [repeat]').action(runSubCommand('db-auth'));
18
19
  program.command('console').action(runSubCommand('console'));
19
20
  program
20
21
  .command('create-plugin')
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,SAAS,CAAC,GAAgB;IACxC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,MAAM,aAAa,GACjB,CAAC,IAAI,EAAE,EAAE,CACT,CAAC,GAAG,OAAO,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;QAE7C,OAAO,CAAC,OAAO,EAAE;aACd,IAAI,CAAC,GAAG,EAAE;YACT,OAAO,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEJ,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IACxG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAE5D,OAAO;SACJ,OAAO,CAAC,eAAe,CAAC;SACxB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SACpC,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import Application from '../application';\nimport { Command } from 'commander';\n\nexport function createCli(app: Application) {\n const program = new Command();\n\n const runSubCommand =\n (name) =>\n (...cliArgs) => {\n const command = require(`./${name}`).default;\n\n Promise.resolve()\n .then(() => {\n return command({ app, cliArgs });\n })\n .catch((error) => {\n console.error(error);\n process.exit(1);\n });\n };\n\n program.command('start').description('start NocoBase application').action(runSubCommand('start'));\n program.command('install').option('-f, --force').option('-c, --clean').action(runSubCommand('install'));\n program.command('db:sync').option('-f, --force').action(runSubCommand('db-sync'));\n program.command('console').action(runSubCommand('console'));\n\n program\n .command('create-plugin')\n .argument('<name>', 'name of plugin')\n .description('create NocoBase plugin')\n .action(runSubCommand('create-plugin'));\n\n return program;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,UAAU,SAAS,CAAC,GAAgB;IACxC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,MAAM,aAAa,GACjB,CAAC,IAAI,EAAE,EAAE,CACT,CAAC,GAAG,OAAO,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;QAE7C,OAAO,CAAC,OAAO,EAAE;aACd,IAAI,CAAC,GAAG,EAAE;YACT,OAAO,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEJ,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IACzH,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/H,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5F,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAE5D,OAAO;SACJ,OAAO,CAAC,eAAe,CAAC;SACxB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SACpC,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { Command } from 'commander';\nimport Application from '../application';\n\nexport function createCli(app: Application) {\n const program = new Command();\n\n const runSubCommand =\n (name) =>\n (...cliArgs) => {\n const command = require(`./${name}`).default;\n\n Promise.resolve()\n .then(() => {\n return command({ app, cliArgs });\n })\n .catch((error) => {\n console.error(error);\n process.exit(1);\n });\n };\n\n program.command('start').description('start NocoBase application').option('-s, --silent').action(runSubCommand('start'));\n program.command('install').option('-f, --force').option('-c, --clean').option('-s, --silent').action(runSubCommand('install'));\n program.command('db:sync').option('-f, --force').action(runSubCommand('db-sync'));\n program.command('db:auth').option('-r, --repeat [repeat]').action(runSubCommand('db-auth'));\n program.command('console').action(runSubCommand('console'));\n\n program\n .command('create-plugin')\n .argument('<name>', 'name of plugin')\n .description('create NocoBase plugin')\n .action(runSubCommand('create-plugin'));\n\n return program;\n}\n"]}
@@ -13,17 +13,22 @@ export default ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, function*
13
13
  if (!(opts === null || opts === void 0 ? void 0 : opts.clean) && !(opts === null || opts === void 0 ? void 0 : opts.force)) {
14
14
  const tables = yield app.db.sequelize.getQueryInterface().showAllTables();
15
15
  if (tables.includes('collections')) {
16
- console.log();
17
- console.log();
18
- console.log(chalk.yellow('NocoBase is already installed. To reinstall, please execute:'));
19
- console.log();
20
- let command = 'yarn nocobase install -f';
21
- console.log(chalk.yellow(command));
22
- console.log();
23
- console.log();
16
+ if (!opts.silent) {
17
+ console.log();
18
+ console.log();
19
+ console.log(chalk.yellow('NocoBase is already installed. To reinstall, please execute:'));
20
+ console.log();
21
+ let command = 'yarn nocobase install -f';
22
+ console.log(chalk.yellow(command));
23
+ console.log();
24
+ console.log();
25
+ }
24
26
  return;
25
27
  }
26
28
  }
29
+ if (!opts.silent) {
30
+ console.log(`NocoBase installing`);
31
+ }
27
32
  yield app.install({
28
33
  cliArgs,
29
34
  clean: opts.clean,
@@ -34,5 +39,8 @@ export default ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, function*
34
39
  yield app.stop({
35
40
  cliArgs,
36
41
  });
42
+ if (!opts.silent) {
43
+ console.log(`NocoBase installed`);
44
+ }
37
45
  });
38
46
  //# sourceMappingURL=install.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,EAAE;QAChC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1E,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YAClC,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,8DAA8D,CAAC,CAAC,CAAC;YAC1F,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,OAAO,GAAG,0BAA0B,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YACnC,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO;SACR;KACF;IAED,MAAM,GAAG,CAAC,OAAO,CAAC;QAChB,OAAO;QACP,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB;KACF,CAAC,CAAC;IACH,MAAM,GAAG,CAAC,IAAI,CAAC;QACb,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAA,CAAC","sourcesContent":["import chalk from 'chalk';\n\nexport default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n if (!opts?.clean && !opts?.force) {\n const tables = await app.db.sequelize.getQueryInterface().showAllTables();\n if (tables.includes('collections')) {\n console.log();\n console.log();\n console.log(chalk.yellow('NocoBase is already installed. To reinstall, please execute:'));\n console.log();\n let command = 'yarn nocobase install -f';\n console.log(chalk.yellow(command));\n console.log();\n console.log();\n return;\n }\n }\n\n await app.install({\n cliArgs,\n clean: opts.clean,\n sync: {\n force: opts.force,\n },\n });\n await app.stop({\n cliArgs,\n });\n};\n"]}
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAEvB,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,EAAE;QAChC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1E,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,8DAA8D,CAAC,CAAC,CAAC;gBAC1F,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,IAAI,OAAO,GAAG,0BAA0B,CAAC;gBACzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBACnC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,EAAE,CAAC;aACf;YACD,OAAO;SACR;KACF;IAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;KACpC;IAED,MAAM,GAAG,CAAC,OAAO,CAAC;QAChB,OAAO;QACP,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB;KACF,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,IAAI,CAAC;QACb,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;KACnC;AACH,CAAC,CAAA,CAAC","sourcesContent":["import chalk from 'chalk';\n\nexport default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n\n if (!opts?.clean && !opts?.force) {\n const tables = await app.db.sequelize.getQueryInterface().showAllTables();\n if (tables.includes('collections')) {\n if (!opts.silent) {\n console.log();\n console.log();\n console.log(chalk.yellow('NocoBase is already installed. To reinstall, please execute:'));\n console.log();\n let command = 'yarn nocobase install -f';\n console.log(chalk.yellow(command));\n console.log();\n console.log();\n }\n return;\n }\n }\n\n if (!opts.silent) {\n console.log(`NocoBase installing`);\n }\n\n await app.install({\n cliArgs,\n clean: opts.clean,\n sync: {\n force: opts.force,\n },\n });\n\n await app.stop({\n cliArgs,\n });\n\n if (!opts.silent) {\n console.log(`NocoBase installed`);\n }\n};\n"]}
@@ -18,6 +18,8 @@ export default ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, function*
18
18
  host,
19
19
  },
20
20
  });
21
- console.log(`🚀 nocobase server had started at http://${host}:${port}`);
21
+ if (!opts.silent) {
22
+ console.log(`🚀 NocoBase server running at: http://${host === '0.0.0.0' ? 'localhost' : host}:${port}/`);
23
+ }
22
24
  });
23
25
  //# sourceMappingURL=start.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;;;;;;;;AAAA,eAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,SAAS,CAAC;IAE/D,MAAM,GAAG,CAAC,KAAK,CAAC;QACd,OAAO;QACP,MAAM,EAAE;YACN,IAAI;YACJ,IAAI;SACL;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,4CAA4C,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAA,CAAC","sourcesContent":["export default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n const port = opts.port || process.env.SERVER_PORT || 3000;\n const host = opts.host || process.env.SERVER_HOST || '0.0.0.0';\n\n await app.start({\n cliArgs,\n listen: {\n port,\n host,\n },\n });\n\n console.log(`🚀 nocobase server had started at http://${host}:${port}`);\n};\n"]}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;;;;;;;;AAAA,eAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,SAAS,CAAC;IAE/D,MAAM,GAAG,CAAC,KAAK,CAAC;QACd,OAAO;QACP,MAAM,EAAE;YACN,IAAI;YACJ,IAAI;SACL;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,yCAAyC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC;KAC1G;AACH,CAAC,CAAA,CAAC","sourcesContent":["export default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n const port = opts.port || process.env.SERVER_PORT || 3000;\n const host = opts.host || process.env.SERVER_HOST || '0.0.0.0';\n\n await app.start({\n cliArgs,\n listen: {\n port,\n host,\n },\n });\n\n if (!opts.silent) {\n console.log(`🚀 NocoBase server running at: http://${host === '0.0.0.0' ? 'localhost' : host}:${port}/`);\n }\n};\n"]}
@@ -0,0 +1,5 @@
1
+ declare const _default: ({ app, cliArgs }: {
2
+ app: any;
3
+ cliArgs: any;
4
+ }) => Promise<void>;
5
+ export default _default;
@@ -0,0 +1,16 @@
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.default = ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, function* () {
13
+ const [opts] = cliArgs;
14
+ yield app.db.auth({ repeat: opts.repeat || 10 });
15
+ });
16
+ //# sourceMappingURL=db-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-auth.js","sourceRoot":"","sources":["../../src/commands/db-auth.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kBAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC,CAAA,CAAC","sourcesContent":["export default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n await app.db.auth({ repeat: opts.repeat || 10 });\n};\n"]}
@@ -1,3 +1,3 @@
1
- import Application from '../application';
2
1
  import { Command } from 'commander';
2
+ import Application from '../application';
3
3
  export declare function createCli(app: Application): Command;
@@ -15,9 +15,10 @@ function createCli(app) {
15
15
  process.exit(1);
16
16
  });
17
17
  };
18
- program.command('start').description('start NocoBase application').action(runSubCommand('start'));
19
- program.command('install').option('-f, --force').option('-c, --clean').action(runSubCommand('install'));
18
+ program.command('start').description('start NocoBase application').option('-s, --silent').action(runSubCommand('start'));
19
+ program.command('install').option('-f, --force').option('-c, --clean').option('-s, --silent').action(runSubCommand('install'));
20
20
  program.command('db:sync').option('-f, --force').action(runSubCommand('db-sync'));
21
+ program.command('db:auth').option('-r, --repeat [repeat]').action(runSubCommand('db-auth'));
21
22
  program.command('console').action(runSubCommand('console'));
22
23
  program
23
24
  .command('create-plugin')
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AAEpC,SAAgB,SAAS,CAAC,GAAgB;IACxC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;IAE9B,MAAM,aAAa,GACjB,CAAC,IAAI,EAAE,EAAE,CACT,CAAC,GAAG,OAAO,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;QAE7C,OAAO,CAAC,OAAO,EAAE;aACd,IAAI,CAAC,GAAG,EAAE;YACT,OAAO,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEJ,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IACxG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAE5D,OAAO;SACJ,OAAO,CAAC,eAAe,CAAC;SACxB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SACpC,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACjB,CAAC;AA9BD,8BA8BC","sourcesContent":["import Application from '../application';\nimport { Command } from 'commander';\n\nexport function createCli(app: Application) {\n const program = new Command();\n\n const runSubCommand =\n (name) =>\n (...cliArgs) => {\n const command = require(`./${name}`).default;\n\n Promise.resolve()\n .then(() => {\n return command({ app, cliArgs });\n })\n .catch((error) => {\n console.error(error);\n process.exit(1);\n });\n };\n\n program.command('start').description('start NocoBase application').action(runSubCommand('start'));\n program.command('install').option('-f, --force').option('-c, --clean').action(runSubCommand('install'));\n program.command('db:sync').option('-f, --force').action(runSubCommand('db-sync'));\n program.command('console').action(runSubCommand('console'));\n\n program\n .command('create-plugin')\n .argument('<name>', 'name of plugin')\n .description('create NocoBase plugin')\n .action(runSubCommand('create-plugin'));\n\n return program;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAGpC,SAAgB,SAAS,CAAC,GAAgB;IACxC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;IAE9B,MAAM,aAAa,GACjB,CAAC,IAAI,EAAE,EAAE,CACT,CAAC,GAAG,OAAO,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;QAE7C,OAAO,CAAC,OAAO,EAAE;aACd,IAAI,CAAC,GAAG,EAAE;YACT,OAAO,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEJ,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IACzH,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/H,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5F,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAE5D,OAAO;SACJ,OAAO,CAAC,eAAe,CAAC;SACxB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SACpC,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACjB,CAAC;AA/BD,8BA+BC","sourcesContent":["import { Command } from 'commander';\nimport Application from '../application';\n\nexport function createCli(app: Application) {\n const program = new Command();\n\n const runSubCommand =\n (name) =>\n (...cliArgs) => {\n const command = require(`./${name}`).default;\n\n Promise.resolve()\n .then(() => {\n return command({ app, cliArgs });\n })\n .catch((error) => {\n console.error(error);\n process.exit(1);\n });\n };\n\n program.command('start').description('start NocoBase application').option('-s, --silent').action(runSubCommand('start'));\n program.command('install').option('-f, --force').option('-c, --clean').option('-s, --silent').action(runSubCommand('install'));\n program.command('db:sync').option('-f, --force').action(runSubCommand('db-sync'));\n program.command('db:auth').option('-r, --repeat [repeat]').action(runSubCommand('db-auth'));\n program.command('console').action(runSubCommand('console'));\n\n program\n .command('create-plugin')\n .argument('<name>', 'name of plugin')\n .description('create NocoBase plugin')\n .action(runSubCommand('create-plugin'));\n\n return program;\n}\n"]}
@@ -18,17 +18,22 @@ exports.default = ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, functi
18
18
  if (!(opts === null || opts === void 0 ? void 0 : opts.clean) && !(opts === null || opts === void 0 ? void 0 : opts.force)) {
19
19
  const tables = yield app.db.sequelize.getQueryInterface().showAllTables();
20
20
  if (tables.includes('collections')) {
21
- console.log();
22
- console.log();
23
- console.log(chalk_1.default.yellow('NocoBase is already installed. To reinstall, please execute:'));
24
- console.log();
25
- let command = 'yarn nocobase install -f';
26
- console.log(chalk_1.default.yellow(command));
27
- console.log();
28
- console.log();
21
+ if (!opts.silent) {
22
+ console.log();
23
+ console.log();
24
+ console.log(chalk_1.default.yellow('NocoBase is already installed. To reinstall, please execute:'));
25
+ console.log();
26
+ let command = 'yarn nocobase install -f';
27
+ console.log(chalk_1.default.yellow(command));
28
+ console.log();
29
+ console.log();
30
+ }
29
31
  return;
30
32
  }
31
33
  }
34
+ if (!opts.silent) {
35
+ console.log(`NocoBase installing`);
36
+ }
32
37
  yield app.install({
33
38
  cliArgs,
34
39
  clean: opts.clean,
@@ -39,5 +44,8 @@ exports.default = ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, functi
39
44
  yield app.stop({
40
45
  cliArgs,
41
46
  });
47
+ if (!opts.silent) {
48
+ console.log(`NocoBase installed`);
49
+ }
42
50
  });
43
51
  //# sourceMappingURL=install.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,kBAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,EAAE;QAChC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1E,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YAClC,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,8DAA8D,CAAC,CAAC,CAAC;YAC1F,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,OAAO,GAAG,0BAA0B,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YACnC,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO;SACR;KACF;IAED,MAAM,GAAG,CAAC,OAAO,CAAC;QAChB,OAAO;QACP,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB;KACF,CAAC,CAAC;IACH,MAAM,GAAG,CAAC,IAAI,CAAC;QACb,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAA,CAAC","sourcesContent":["import chalk from 'chalk';\n\nexport default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n if (!opts?.clean && !opts?.force) {\n const tables = await app.db.sequelize.getQueryInterface().showAllTables();\n if (tables.includes('collections')) {\n console.log();\n console.log();\n console.log(chalk.yellow('NocoBase is already installed. To reinstall, please execute:'));\n console.log();\n let command = 'yarn nocobase install -f';\n console.log(chalk.yellow(command));\n console.log();\n console.log();\n return;\n }\n }\n\n await app.install({\n cliArgs,\n clean: opts.clean,\n sync: {\n force: opts.force,\n },\n });\n await app.stop({\n cliArgs,\n });\n};\n"]}
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,kBAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAEvB,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,EAAE;QAChC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1E,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChB,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,8DAA8D,CAAC,CAAC,CAAC;gBAC1F,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,IAAI,OAAO,GAAG,0BAA0B,CAAC;gBACzC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBACnC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,EAAE,CAAC;aACf;YACD,OAAO;SACR;KACF;IAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;KACpC;IAED,MAAM,GAAG,CAAC,OAAO,CAAC;QAChB,OAAO;QACP,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB;KACF,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,IAAI,CAAC;QACb,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;KACnC;AACH,CAAC,CAAA,CAAC","sourcesContent":["import chalk from 'chalk';\n\nexport default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n\n if (!opts?.clean && !opts?.force) {\n const tables = await app.db.sequelize.getQueryInterface().showAllTables();\n if (tables.includes('collections')) {\n if (!opts.silent) {\n console.log();\n console.log();\n console.log(chalk.yellow('NocoBase is already installed. To reinstall, please execute:'));\n console.log();\n let command = 'yarn nocobase install -f';\n console.log(chalk.yellow(command));\n console.log();\n console.log();\n }\n return;\n }\n }\n\n if (!opts.silent) {\n console.log(`NocoBase installing`);\n }\n\n await app.install({\n cliArgs,\n clean: opts.clean,\n sync: {\n force: opts.force,\n },\n });\n\n await app.stop({\n cliArgs,\n });\n\n if (!opts.silent) {\n console.log(`NocoBase installed`);\n }\n};\n"]}
@@ -20,6 +20,8 @@ exports.default = ({ app, cliArgs }) => __awaiter(void 0, void 0, void 0, functi
20
20
  host,
21
21
  },
22
22
  });
23
- console.log(`🚀 nocobase server had started at http://${host}:${port}`);
23
+ if (!opts.silent) {
24
+ console.log(`🚀 NocoBase server running at: http://${host === '0.0.0.0' ? 'localhost' : host}:${port}/`);
25
+ }
24
26
  });
25
27
  //# sourceMappingURL=start.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kBAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,SAAS,CAAC;IAE/D,MAAM,GAAG,CAAC,KAAK,CAAC;QACd,OAAO;QACP,MAAM,EAAE;YACN,IAAI;YACJ,IAAI;SACL;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,4CAA4C,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAA,CAAC","sourcesContent":["export default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n const port = opts.port || process.env.SERVER_PORT || 3000;\n const host = opts.host || process.env.SERVER_HOST || '0.0.0.0';\n\n await app.start({\n cliArgs,\n listen: {\n port,\n host,\n },\n });\n\n console.log(`🚀 nocobase server had started at http://${host}:${port}`);\n};\n"]}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,kBAAe,CAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IACxC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,SAAS,CAAC;IAE/D,MAAM,GAAG,CAAC,KAAK,CAAC;QACd,OAAO;QACP,MAAM,EAAE;YACN,IAAI;YACJ,IAAI;SACL;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,yCAAyC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC;KAC1G;AACH,CAAC,CAAA,CAAC","sourcesContent":["export default async ({ app, cliArgs }) => {\n const [opts] = cliArgs;\n const port = opts.port || process.env.SERVER_PORT || 3000;\n const host = opts.host || process.env.SERVER_HOST || '0.0.0.0';\n\n await app.start({\n cliArgs,\n listen: {\n port,\n host,\n },\n });\n\n if (!opts.silent) {\n console.log(`🚀 NocoBase server running at: http://${host === '0.0.0.0' ? 'localhost' : host}:${port}/`);\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "0.7.0-alpha.22",
3
+ "version": "0.7.0-alpha.25",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -18,10 +18,10 @@
18
18
  "dependencies": {
19
19
  "@koa/cors": "^3.1.0",
20
20
  "@koa/router": "^9.4.0",
21
- "@nocobase/acl": "0.7.0-alpha.22",
22
- "@nocobase/actions": "0.7.0-alpha.22",
23
- "@nocobase/database": "0.7.0-alpha.22",
24
- "@nocobase/resourcer": "0.7.0-alpha.22",
21
+ "@nocobase/acl": "0.7.0-alpha.25",
22
+ "@nocobase/actions": "0.7.0-alpha.25",
23
+ "@nocobase/database": "0.7.0-alpha.25",
24
+ "@nocobase/resourcer": "0.7.0-alpha.25",
25
25
  "chalk": "^4.1.1",
26
26
  "commander": "^8.1.0",
27
27
  "dotenv": "^8.2.0",
@@ -32,5 +32,5 @@
32
32
  "koa-static": "^5.0.0",
33
33
  "lodash": "^4.17.21"
34
34
  },
35
- "gitHead": "dc5e9c80ed57ffd9b2f652f68a9444bfb79647db"
35
+ "gitHead": "b292a36c83a4c4c8cc8c9ebcca15d60b656f2e31"
36
36
  }