@fecommunity/reactpress 3.0.0 → 3.0.1
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/bin/reactpress.js +2 -1
- package/dist/index.js +0 -0
- package/lib/build.js +59 -13
- package/lib/dev.js +2 -14
- package/lib/i18n/strings.js +30 -2
- package/lib/root.js +10 -2
- package/lib/spawn.js +1 -0
- package/package.json +7 -4
- package/server/dist/app.module.js +1 -26
- package/server/dist/app.module.js.map +1 -1
- package/server/dist/modules/article/article.controller.d.ts +1 -6
- package/server/dist/modules/article/article.controller.js +1 -45
- package/server/dist/modules/article/article.controller.js.map +1 -1
- package/server/dist/modules/article/article.entity.d.ts +0 -1
- package/server/dist/modules/article/article.entity.js +0 -5
- package/server/dist/modules/article/article.entity.js.map +1 -1
- package/server/dist/modules/article/article.module.js +2 -14
- package/server/dist/modules/article/article.module.js.map +1 -1
- package/server/dist/modules/article/article.service.d.ts +1 -9
- package/server/dist/modules/article/article.service.js +5 -59
- package/server/dist/modules/article/article.service.js.map +1 -1
- package/server/dist/modules/auth/auth.service.js +3 -4
- package/server/dist/modules/auth/auth.service.js.map +1 -1
- package/server/dist/modules/auth/jwt-auth.guard.js +1 -2
- package/server/dist/modules/auth/jwt-auth.guard.js.map +1 -1
- package/server/dist/modules/auth/jwt.strategy.js +1 -2
- package/server/dist/modules/auth/jwt.strategy.js.map +1 -1
- package/server/dist/modules/category/category.service.js +2 -3
- package/server/dist/modules/category/category.service.js.map +1 -1
- package/server/dist/modules/comment/comment.module.js +1 -10
- package/server/dist/modules/comment/comment.module.js.map +1 -1
- package/server/dist/modules/comment/comment.service.d.ts +1 -3
- package/server/dist/modules/comment/comment.service.js +5 -15
- package/server/dist/modules/comment/comment.service.js.map +1 -1
- package/server/dist/modules/knowledge/knowledge.service.js +2 -3
- package/server/dist/modules/knowledge/knowledge.service.js.map +1 -1
- package/server/dist/modules/page/page.service.js +1 -2
- package/server/dist/modules/page/page.service.js.map +1 -1
- package/server/dist/modules/smtp/smtp.service.js +1 -2
- package/server/dist/modules/smtp/smtp.service.js.map +1 -1
- package/server/dist/modules/tag/tag.service.js +2 -3
- package/server/dist/modules/tag/tag.service.js.map +1 -1
- package/server/dist/modules/user/user.controller.js +3 -4
- package/server/dist/modules/user/user.controller.js.map +1 -1
- package/server/dist/modules/user/user.service.js +9 -10
- package/server/dist/modules/user/user.service.js.map +1 -1
- package/server/dist/starter.js +1 -1
- package/server/dist/tsconfig.build.tsbuildinfo +11335 -11537
- package/server/dist/utils/oss.util.js +1 -2
- package/server/dist/utils/oss.util.js.map +1 -1
- package/ui/interactive.js +19 -3
package/bin/reactpress.js
CHANGED
|
@@ -127,7 +127,7 @@ clientCmd
|
|
|
127
127
|
program
|
|
128
128
|
.command('build')
|
|
129
129
|
.description(t('cli.build.description'))
|
|
130
|
-
.option('-t, --target <target>', '
|
|
130
|
+
.option('-t, --target <target>', t('cli.build.target'), 'all')
|
|
131
131
|
.action(async (options) => {
|
|
132
132
|
try {
|
|
133
133
|
await runBuild(options.target, ensureOriginalCwd());
|
|
@@ -254,6 +254,7 @@ program.on('--help', () => {
|
|
|
254
254
|
console.log(t('cli.help.status'));
|
|
255
255
|
console.log(t('cli.help.doctor'));
|
|
256
256
|
console.log(t('cli.help.docker'));
|
|
257
|
+
console.log(t('cli.help.build'));
|
|
257
258
|
console.log(t('cli.help.publish'));
|
|
258
259
|
console.log('');
|
|
259
260
|
});
|
package/dist/index.js
CHANGED
|
File without changes
|
package/lib/build.js
CHANGED
|
@@ -1,29 +1,75 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
1
2
|
const { runSync } = require('./spawn');
|
|
2
3
|
const { ensureOriginalCwd } = require('./root');
|
|
3
4
|
const { t } = require('./i18n');
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const FORBIDDEN_SCRIPTS = new Set(['build']);
|
|
7
|
+
|
|
8
|
+
/** @type {Record<string, { script: string, labelKey: string }[]>} */
|
|
9
|
+
const BUILD_STEPS = {
|
|
10
|
+
toolkit: [{ script: 'build:toolkit', labelKey: 'build.label.toolkit' }],
|
|
11
|
+
server: [{ script: 'build:server', labelKey: 'build.label.server' }],
|
|
12
|
+
client: [{ script: 'build:client', labelKey: 'build.label.client' }],
|
|
13
|
+
docs: [{ script: 'build:docs', labelKey: 'build.label.docs' }],
|
|
14
|
+
all: [
|
|
15
|
+
{ script: 'build:toolkit', labelKey: 'build.label.toolkit' },
|
|
16
|
+
{ script: 'build:server', labelKey: 'build.label.server' },
|
|
17
|
+
{ script: 'build:client', labelKey: 'build.label.client' },
|
|
18
|
+
],
|
|
11
19
|
};
|
|
12
20
|
|
|
21
|
+
const TARGETS = Object.keys(BUILD_STEPS);
|
|
22
|
+
|
|
23
|
+
const buildChildEnv = { REACTPRESS_BUILD_ACTIVE: '1' };
|
|
24
|
+
|
|
13
25
|
async function runBuild(target = 'all', projectRoot = ensureOriginalCwd()) {
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
if (process.env.REACTPRESS_BUILD_ACTIVE === '1') {
|
|
27
|
+
throw new Error(t('build.recursive'));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const steps = BUILD_STEPS[target];
|
|
31
|
+
if (!steps) {
|
|
16
32
|
throw new Error(
|
|
17
33
|
t('build.unknownTarget', {
|
|
18
34
|
target,
|
|
19
|
-
available:
|
|
35
|
+
available: TARGETS.join(', '),
|
|
20
36
|
})
|
|
21
37
|
);
|
|
22
38
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
|
|
40
|
+
const total = steps.length;
|
|
41
|
+
const buildStarted = Date.now();
|
|
42
|
+
|
|
43
|
+
if (total > 1) {
|
|
44
|
+
console.log(t('build.plan', { total }));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
for (let i = 0; i < steps.length; i++) {
|
|
48
|
+
const { script, labelKey } = steps[i];
|
|
49
|
+
if (FORBIDDEN_SCRIPTS.has(script)) {
|
|
50
|
+
throw new Error(t('build.forbiddenScript', { script }));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const current = i + 1;
|
|
54
|
+
const label = t(labelKey);
|
|
55
|
+
const stepStarted = Date.now();
|
|
56
|
+
|
|
57
|
+
console.log(t('build.step', { current, total, label }));
|
|
58
|
+
try {
|
|
59
|
+
runSync('pnpm', ['run', script], { cwd: projectRoot, env: buildChildEnv });
|
|
60
|
+
} catch (err) {
|
|
61
|
+
console.error(chalk.red(t('build.stepFailed', { current, total, label })));
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const seconds = ((Date.now() - stepStarted) / 1000).toFixed(1);
|
|
66
|
+
console.log(chalk.green(t('build.stepDone', { current, total, label, seconds })));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (total > 1) {
|
|
70
|
+
const totalSeconds = ((Date.now() - buildStarted) / 1000).toFixed(1);
|
|
71
|
+
console.log(chalk.green(t('build.done', { seconds: totalSeconds })));
|
|
26
72
|
}
|
|
27
73
|
}
|
|
28
74
|
|
|
29
|
-
module.exports = { runBuild, TARGETS };
|
|
75
|
+
module.exports = { runBuild, TARGETS, BUILD_STEPS };
|
package/lib/dev.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { spawn } = require('child_process');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const { runBuild } = require('./build');
|
|
3
4
|
const { ensureProjectEnvironment } = require('./bootstrap');
|
|
4
5
|
const { loadServerSiteUrl, loadClientSiteUrl, waitForHttp } = require('./http');
|
|
5
6
|
const { printDevReadyBanner } = require('./dev-banner');
|
|
@@ -30,20 +31,7 @@ function shutdown(signal = 'SIGINT') {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
async function buildToolkit(projectRoot) {
|
|
33
|
-
|
|
34
|
-
const build = spawn('pnpm', ['build:toolkit'], {
|
|
35
|
-
stdio: 'inherit',
|
|
36
|
-
shell: true,
|
|
37
|
-
cwd: projectRoot,
|
|
38
|
-
});
|
|
39
|
-
build.on('close', (code) => {
|
|
40
|
-
if (code !== 0) {
|
|
41
|
-
reject(new Error(t('dev.toolkitFailed', { code })));
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
resolve();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
34
|
+
await runBuild('toolkit', projectRoot);
|
|
47
35
|
}
|
|
48
36
|
|
|
49
37
|
async function startDevStack(projectRoot) {
|
package/lib/i18n/strings.js
CHANGED
|
@@ -43,7 +43,9 @@ const STRINGS = {
|
|
|
43
43
|
'cli.help.status': ' reactpress status Combined status',
|
|
44
44
|
'cli.help.doctor': ' reactpress doctor Environment diagnostics',
|
|
45
45
|
'cli.help.docker': ' reactpress docker start Docker + full stack',
|
|
46
|
+
'cli.help.build': ' reactpress build -t client Build one target (toolkit|server|client|docs|all)',
|
|
46
47
|
'cli.help.publish': ' reactpress publish Publish npm packages',
|
|
48
|
+
'cli.build.target': 'Build target: toolkit | server | client | docs | all',
|
|
47
49
|
'banner.subtitle': ' · Full-stack publishing CLI ',
|
|
48
50
|
'menu.dev': 'Zero-config dev (env + DB + API + frontend)',
|
|
49
51
|
'menu.init': 'Initialize project (.reactpress + .env + database)',
|
|
@@ -55,6 +57,8 @@ const STRINGS = {
|
|
|
55
57
|
'menu.serverStop': 'Stop API',
|
|
56
58
|
'menu.serverRestart': 'Restart API',
|
|
57
59
|
'menu.build': 'Build (toolkit → server → client)',
|
|
60
|
+
'menu.buildTarget': 'What do you want to build?',
|
|
61
|
+
'menu.buildAll': 'All (toolkit → server → client)',
|
|
58
62
|
'menu.dockerStart': 'Docker dev (DB + nginx + full stack)',
|
|
59
63
|
'menu.dockerUp': 'Docker: database only',
|
|
60
64
|
'menu.dockerStop': 'Stop Docker services',
|
|
@@ -193,7 +197,17 @@ const STRINGS = {
|
|
|
193
197
|
'apiDev.ctrlCHint': '[reactpress] Press Ctrl+C to stop API.',
|
|
194
198
|
'apiDev.stopHint': '[reactpress] Stop separately: reactpress server stop',
|
|
195
199
|
'build.unknownTarget': 'Unknown build target: {target}. Available: {available}',
|
|
196
|
-
'build.
|
|
200
|
+
'build.recursive': 'Build recursion detected (pnpm run build must not call itself). Use build:toolkit, build:server, or build:client.',
|
|
201
|
+
'build.forbiddenScript': 'Invalid build script "{script}"; use granular scripts like build:toolkit.',
|
|
202
|
+
'build.stepFailed': '[reactpress] [{current}/{total}] {label} failed',
|
|
203
|
+
'build.plan': '[reactpress] Production build — {total} step(s): toolkit → server → client',
|
|
204
|
+
'build.step': '[reactpress] [{current}/{total}] {label}…',
|
|
205
|
+
'build.stepDone': '[reactpress] [{current}/{total}] {label} ✓ ({seconds}s)',
|
|
206
|
+
'build.done': '[reactpress] Build finished in {seconds}s',
|
|
207
|
+
'build.label.toolkit': 'Toolkit',
|
|
208
|
+
'build.label.server': 'API (server)',
|
|
209
|
+
'build.label.client': 'Frontend (client)',
|
|
210
|
+
'build.label.docs': 'Documentation (docs)',
|
|
197
211
|
'pm2.startFailed': '[reactpress] PM2 failed to start API:',
|
|
198
212
|
'pm2.exitCode': 'PM2 exited with code {code}',
|
|
199
213
|
'spawn.commandFailed': 'Command failed ({command}): exit code {code}',
|
|
@@ -320,7 +334,9 @@ const STRINGS = {
|
|
|
320
334
|
'cli.help.status': ' reactpress status 综合状态',
|
|
321
335
|
'cli.help.doctor': ' reactpress doctor 环境诊断',
|
|
322
336
|
'cli.help.docker': ' reactpress docker start Docker + 全栈',
|
|
337
|
+
'cli.help.build': ' reactpress build -t client 构建指定目标 (toolkit|server|client|docs|all)',
|
|
323
338
|
'cli.help.publish': ' reactpress publish 发布 npm 包',
|
|
339
|
+
'cli.build.target': '构建目标: toolkit | server | client | docs | all',
|
|
324
340
|
'banner.subtitle': ' · 全栈发布平台 CLI ',
|
|
325
341
|
'menu.dev': '零配置开发 (env + DB + API + 前端)',
|
|
326
342
|
'menu.init': '初始化项目 (.reactpress + .env + 数据库)',
|
|
@@ -332,6 +348,8 @@ const STRINGS = {
|
|
|
332
348
|
'menu.serverStop': '停止 API',
|
|
333
349
|
'menu.serverRestart': '重启 API',
|
|
334
350
|
'menu.build': '构建 (toolkit → server → client)',
|
|
351
|
+
'menu.buildTarget': '选择要构建的目标',
|
|
352
|
+
'menu.buildAll': '全部 (toolkit → server → client)',
|
|
335
353
|
'menu.dockerStart': 'Docker 开发环境 (DB + nginx + 全栈)',
|
|
336
354
|
'menu.dockerUp': 'Docker 仅启动数据库',
|
|
337
355
|
'menu.dockerStop': '停止 Docker 服务',
|
|
@@ -470,7 +488,17 @@ const STRINGS = {
|
|
|
470
488
|
'apiDev.ctrlCHint': '[reactpress] 按 Ctrl+C 停止 API。',
|
|
471
489
|
'apiDev.stopHint': '[reactpress] 单独停止: reactpress server stop',
|
|
472
490
|
'build.unknownTarget': '未知构建目标: {target},可选: {available}',
|
|
473
|
-
'build.
|
|
491
|
+
'build.recursive': '检测到构建递归(pnpm run build 不能再次调用自身)。请使用 build:toolkit、build:server 或 build:client。',
|
|
492
|
+
'build.forbiddenScript': '无效的构建脚本 "{script}",请使用 build:toolkit 等细分脚本。',
|
|
493
|
+
'build.stepFailed': '[reactpress] [{current}/{total}] {label} 失败',
|
|
494
|
+
'build.plan': '[reactpress] 生产构建 — 共 {total} 步:toolkit → server → client',
|
|
495
|
+
'build.step': '[reactpress] [{current}/{total}] {label}…',
|
|
496
|
+
'build.stepDone': '[reactpress] [{current}/{total}] {label} ✓ ({seconds}s)',
|
|
497
|
+
'build.done': '[reactpress] 构建完成,耗时 {seconds}s',
|
|
498
|
+
'build.label.toolkit': 'Toolkit',
|
|
499
|
+
'build.label.server': 'API (server)',
|
|
500
|
+
'build.label.client': '前端 (client)',
|
|
501
|
+
'build.label.docs': '文档 (docs)',
|
|
474
502
|
'pm2.startFailed': '[reactpress] PM2 启动 API 失败:',
|
|
475
503
|
'pm2.exitCode': 'PM2 退出码 {code}',
|
|
476
504
|
'spawn.commandFailed': '命令失败 ({command}): 退出码 {code}',
|
package/lib/root.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Install root: monorepo checkout (repo root) or published @fecommunity/reactpress package root.
|
|
6
|
+
* cli/lib -> ../.. when pnpm-workspace.yaml exists; published lib/ -> .. only.
|
|
7
|
+
*/
|
|
5
8
|
function getMonorepoRoot() {
|
|
6
|
-
|
|
9
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
10
|
+
const parentOfPackage = path.resolve(__dirname, '../..');
|
|
11
|
+
if (fs.existsSync(path.join(parentOfPackage, 'pnpm-workspace.yaml'))) {
|
|
12
|
+
return parentOfPackage;
|
|
13
|
+
}
|
|
14
|
+
return packageRoot;
|
|
7
15
|
}
|
|
8
16
|
|
|
9
17
|
function getProjectRoot() {
|
package/lib/spawn.js
CHANGED
|
@@ -14,6 +14,7 @@ function runSync(command, args, options = {}) {
|
|
|
14
14
|
REACTPRESS_LANG: process.env.REACTPRESS_LANG || resolveLocale(),
|
|
15
15
|
REACTPRESS_ORIGINAL_CWD:
|
|
16
16
|
options.cwd || process.env.REACTPRESS_ORIGINAL_CWD || process.cwd(),
|
|
17
|
+
...options.env,
|
|
17
18
|
},
|
|
18
19
|
shell: options.shell ?? false,
|
|
19
20
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fecommunity/reactpress",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "ReactPress 3.0 — zero-config CMS: one package, one reactpress command",
|
|
5
5
|
"author": "fecommunity",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"README.md",
|
|
35
35
|
"LICENSE"
|
|
36
36
|
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"prepare": "node scripts/sync-bundled-core.mjs",
|
|
39
|
+
"prepack": "node scripts/sync-bundled-core.mjs"
|
|
40
|
+
},
|
|
37
41
|
"publishConfig": {
|
|
38
42
|
"access": "public",
|
|
39
43
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,6 +57,5 @@
|
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
59
|
"@fecommunity/reactpress-cli-core": "npm:@fecommunity/reactpress-cli@0.1.0"
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -36,12 +36,6 @@ const user_entity_1 = require("./modules/user/user.entity");
|
|
|
36
36
|
const user_module_1 = require("./modules/user/user.module");
|
|
37
37
|
const view_entity_1 = require("./modules/view/view.entity");
|
|
38
38
|
const view_module_1 = require("./modules/view/view.module");
|
|
39
|
-
const api_key_entity_1 = require("./modules/api-key/api-key.entity");
|
|
40
|
-
const api_key_module_1 = require("./modules/api-key/api-key.module");
|
|
41
|
-
const article_revision_entity_1 = require("./modules/article/article-revision.entity");
|
|
42
|
-
const health_module_1 = require("./modules/health/health.module");
|
|
43
|
-
const webhook_entity_1 = require("./modules/webhook/webhook.entity");
|
|
44
|
-
const webhook_module_1 = require("./modules/webhook/webhook.module");
|
|
45
39
|
let AppModule = class AppModule {
|
|
46
40
|
};
|
|
47
41
|
AppModule = __decorate([
|
|
@@ -53,23 +47,7 @@ AppModule = __decorate([
|
|
|
53
47
|
inject: [config_1.ConfigService],
|
|
54
48
|
useFactory: async (configService) => ({
|
|
55
49
|
type: 'mysql',
|
|
56
|
-
entities: [
|
|
57
|
-
user_entity_1.User,
|
|
58
|
-
file_entity_1.File,
|
|
59
|
-
knowledge_entity_1.Knowledge,
|
|
60
|
-
article_entity_1.Article,
|
|
61
|
-
article_revision_entity_1.ArticleRevision,
|
|
62
|
-
category_entity_1.Category,
|
|
63
|
-
tag_entity_1.Tag,
|
|
64
|
-
comment_entity_1.Comment,
|
|
65
|
-
setting_entity_1.Setting,
|
|
66
|
-
smtp_entity_1.SMTP,
|
|
67
|
-
page_entity_1.Page,
|
|
68
|
-
view_entity_1.View,
|
|
69
|
-
search_entity_1.Search,
|
|
70
|
-
api_key_entity_1.ApiKey,
|
|
71
|
-
webhook_entity_1.Webhook,
|
|
72
|
-
],
|
|
50
|
+
entities: [user_entity_1.User, file_entity_1.File, knowledge_entity_1.Knowledge, article_entity_1.Article, category_entity_1.Category, tag_entity_1.Tag, comment_entity_1.Comment, setting_entity_1.Setting, smtp_entity_1.SMTP, page_entity_1.Page, view_entity_1.View, search_entity_1.Search],
|
|
73
51
|
host: configService.get('DB_HOST', '0.0.0.0'),
|
|
74
52
|
port: configService.get('DB_PORT', 3306),
|
|
75
53
|
username: configService.get('DB_USER', 'root'),
|
|
@@ -93,9 +71,6 @@ AppModule = __decorate([
|
|
|
93
71
|
page_module_1.PageModule,
|
|
94
72
|
view_module_1.ViewModule,
|
|
95
73
|
search_module_1.SearchModule,
|
|
96
|
-
health_module_1.HealthModule,
|
|
97
|
-
api_key_module_1.ApiKeyModule,
|
|
98
|
-
webhook_module_1.WebhookModule,
|
|
99
74
|
],
|
|
100
75
|
controllers: [],
|
|
101
76
|
providers: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AACA,2DAAyD;AACzD,2CAAwC;AACxC,2CAA6D;AAC7D,6CAAgD;AAEhD,qEAA2D;AAE3D,qEAAiE;AAEjE,4DAAwD;AACxD,wEAA8D;AAE9D,wEAAoE;AACpE,qEAA2D;AAE3D,qEAAiE;AACjE,4DAAkD;AAElD,4DAAwD;AACxD,2EAAiE;AAEjE,2EAAuE;AACvE,4DAAkD;AAElD,4DAAwD;AAExD,kEAAwD;AACxD,kEAA8D;AAC9D,qEAA2D;AAE3D,qEAAiE;AACjE,4DAAkD;AAElD,4DAAwD;AACxD,yDAA+C;AAE/C,yDA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AAS,CAAC;oBAC7C,IAAI,EAAE,aAAa,CAAC,GAAG,CAAS,SAAS,EAAE,IAAI,CAAC;oBAChD,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC;oBAC9C,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;oBAChD,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,aAAa,EAAE,YAAY,CAAC;oBACxD,OAAO,EAAE,SAAS;oBAClB,QAAQ,EAAE,QAAQ;oBAClB,WAAW,EAAE,IAAI;iBAClB,CAAC;aACH,CAAC;YACF,wBAAU;YACV,wBAAU;YACV,sBAAS;YACT,8BAAa;YACb,kCAAe;YACf,gCAAc;YACd,8BAAa;YACb,8BAAa;YACb,wBAAU;YACV,wBAAU;YACV,wBAAU;YACV,wBAAU;YACV,4BAAY;SACb;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,EAAE;KACd,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { JwtService } from '@nestjs/jwt';
|
|
2
|
-
import { ApiKeyService } from '../api-key/api-key.service';
|
|
3
2
|
import { UserService } from '../user/user.service';
|
|
4
3
|
import { Article } from './article.entity';
|
|
5
4
|
import { ArticleService } from './article.service';
|
|
6
5
|
export declare class ArticleController {
|
|
7
6
|
private readonly articleService;
|
|
8
|
-
private readonly apiKeyService;
|
|
9
7
|
private readonly jwtService;
|
|
10
8
|
private readonly userService;
|
|
11
|
-
constructor(articleService: ArticleService,
|
|
9
|
+
constructor(articleService: ArticleService, jwtService: JwtService, userService: UserService);
|
|
12
10
|
create(article: any): Promise<Article>;
|
|
13
11
|
findAll(queryParams: any): Promise<[Article[], number]>;
|
|
14
|
-
findHeadless(req: any, queryParams: any): Promise<[Article[], number]>;
|
|
15
|
-
listRevisions(id: string): Promise<import("./article-revision.entity").ArticleRevision[]>;
|
|
16
|
-
restoreRevision(id: string, revisionId: string): Promise<Article>;
|
|
17
12
|
findArticlesByCategory(category: any, queryParams: any): Promise<(number | Article[])[]>;
|
|
18
13
|
findArticlesByTag(tag: any, queryParams: any): Promise<(number | Article[])[]>;
|
|
19
14
|
getRecommendArticles(): Promise<Article[]>;
|
|
@@ -13,21 +13,17 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ArticleController = void 0;
|
|
16
|
-
const api_messages_1 = require("../../common/api-messages");
|
|
17
16
|
const common_1 = require("@nestjs/common");
|
|
18
17
|
const jwt_1 = require("@nestjs/jwt");
|
|
19
18
|
const swagger_1 = require("@nestjs/swagger");
|
|
20
|
-
const api_key_guard_1 = require("../api-key/api-key.guard");
|
|
21
|
-
const api_key_service_1 = require("../api-key/api-key.service");
|
|
22
19
|
const jwt_auth_guard_1 = require("../auth/jwt-auth.guard");
|
|
23
20
|
const roles_guard_1 = require("../auth/roles.guard");
|
|
24
21
|
const user_service_1 = require("../user/user.service");
|
|
25
22
|
const article_entity_1 = require("./article.entity");
|
|
26
23
|
const article_service_1 = require("./article.service");
|
|
27
24
|
let ArticleController = class ArticleController {
|
|
28
|
-
constructor(articleService,
|
|
25
|
+
constructor(articleService, jwtService, userService) {
|
|
29
26
|
this.articleService = articleService;
|
|
30
|
-
this.apiKeyService = apiKeyService;
|
|
31
27
|
this.jwtService = jwtService;
|
|
32
28
|
this.userService = userService;
|
|
33
29
|
}
|
|
@@ -37,18 +33,6 @@ let ArticleController = class ArticleController {
|
|
|
37
33
|
findAll(queryParams) {
|
|
38
34
|
return this.articleService.findAll(queryParams);
|
|
39
35
|
}
|
|
40
|
-
findHeadless(req, queryParams) {
|
|
41
|
-
if (!this.apiKeyService.hasScope(req.apiKey, 'read')) {
|
|
42
|
-
throw new common_1.ForbiddenException(api_messages_1.ApiMsg.API_KEY_MISSING_READ);
|
|
43
|
-
}
|
|
44
|
-
return this.articleService.findAll(Object.assign(Object.assign({}, queryParams), { status: 'publish' }));
|
|
45
|
-
}
|
|
46
|
-
listRevisions(id) {
|
|
47
|
-
return this.articleService.listRevisions(id);
|
|
48
|
-
}
|
|
49
|
-
restoreRevision(id, revisionId) {
|
|
50
|
-
return this.articleService.restoreRevision(id, revisionId);
|
|
51
|
-
}
|
|
52
36
|
findArticlesByCategory(category, queryParams) {
|
|
53
37
|
return this.articleService.findArticlesByCategory(category, queryParams);
|
|
54
38
|
}
|
|
@@ -114,33 +98,6 @@ __decorate([
|
|
|
114
98
|
__metadata("design:paramtypes", [Object]),
|
|
115
99
|
__metadata("design:returntype", void 0)
|
|
116
100
|
], ArticleController.prototype, "findAll", null);
|
|
117
|
-
__decorate([
|
|
118
|
-
common_1.Get('headless/list'),
|
|
119
|
-
common_1.UseGuards(api_key_guard_1.ApiKeyGuard),
|
|
120
|
-
common_1.HttpCode(common_1.HttpStatus.OK),
|
|
121
|
-
__param(0, common_1.Request()), __param(1, common_1.Query()),
|
|
122
|
-
__metadata("design:type", Function),
|
|
123
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
124
|
-
__metadata("design:returntype", void 0)
|
|
125
|
-
], ArticleController.prototype, "findHeadless", null);
|
|
126
|
-
__decorate([
|
|
127
|
-
common_1.Get(':id/revisions'),
|
|
128
|
-
roles_guard_1.Roles('admin'),
|
|
129
|
-
common_1.UseGuards(jwt_auth_guard_1.JwtAuthGuard),
|
|
130
|
-
__param(0, common_1.Param('id')),
|
|
131
|
-
__metadata("design:type", Function),
|
|
132
|
-
__metadata("design:paramtypes", [String]),
|
|
133
|
-
__metadata("design:returntype", void 0)
|
|
134
|
-
], ArticleController.prototype, "listRevisions", null);
|
|
135
|
-
__decorate([
|
|
136
|
-
common_1.Post(':id/revisions/:revisionId/restore'),
|
|
137
|
-
roles_guard_1.Roles('admin'),
|
|
138
|
-
common_1.UseGuards(jwt_auth_guard_1.JwtAuthGuard),
|
|
139
|
-
__param(0, common_1.Param('id')), __param(1, common_1.Param('revisionId')),
|
|
140
|
-
__metadata("design:type", Function),
|
|
141
|
-
__metadata("design:paramtypes", [String, String]),
|
|
142
|
-
__metadata("design:returntype", void 0)
|
|
143
|
-
], ArticleController.prototype, "restoreRevision", null);
|
|
144
101
|
__decorate([
|
|
145
102
|
common_1.Get('/category/:id'),
|
|
146
103
|
common_1.HttpCode(common_1.HttpStatus.OK),
|
|
@@ -234,7 +191,6 @@ ArticleController = __decorate([
|
|
|
234
191
|
common_1.Controller('article'),
|
|
235
192
|
common_1.UseGuards(roles_guard_1.RolesGuard),
|
|
236
193
|
__metadata("design:paramtypes", [article_service_1.ArticleService,
|
|
237
|
-
api_key_service_1.ApiKeyService,
|
|
238
194
|
jwt_1.JwtService,
|
|
239
195
|
user_service_1.UserService])
|
|
240
196
|
], ArticleController);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article.controller.js","sourceRoot":"","sources":["../../../src/modules/article/article.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"article.controller.js","sourceRoot":"","sources":["../../../src/modules/article/article.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAawB;AACxB,qCAAyC;AACzC,6CAAuD;AAEvD,2DAAsD;AACtD,qDAAwD;AAExD,uDAAmD;AACnD,qDAA2C;AAC3C,uDAAmD;AAKnD,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAC5B,YACmB,cAA8B,EAE9B,UAAsB,EACtB,WAAwB;QAHxB,mBAAc,GAAd,cAAc,CAAgB;QAE9B,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAUJ,MAAM,CAAS,OAAO;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAOD,OAAO,CAAU,WAAW;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAA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AC,mBAAU,CAAC,EAAE,CAAC;IACZ,WAAA,cAAK,CAAC,IAAI,CAAC,CAAA,EAAM,WAAA,aAAI,EAAE,CAAA;;;;mDAElC;AASD;IAHC,eAAM,CAAC,KAAK,CAAC;IACb,mBAAK,CAAC,OAAO,CAAC;IACd,kBAAS,CAAC,6BAAY,CAAC;IACZ,WAAA,cAAK,CAAC,IAAI,CAAC,CAAA;;;;mDAEtB;AArJU,iBAAiB;IAH7B,iBAAO,CAAC,SAAS,CAAC;IAClB,mBAAU,CAAC,SAAS,CAAC;IACrB,kBAAS,CAAC,wBAAU,CAAC;qCAGe,gCAAc;QAElB,gBAAU;QACT,0BAAW;GALhC,iBAAiB,CAsJ7B;AAtJY,8CAAiB"}
|
|
@@ -103,11 +103,6 @@ __decorate([
|
|
|
103
103
|
typeorm_1.Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
|
|
104
104
|
__metadata("design:type", Date)
|
|
105
105
|
], Article.prototype, "publishAt", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
swagger_1.ApiProperty({ description: '定时发布时间(草稿状态下生效)' }),
|
|
108
|
-
typeorm_1.Column({ type: 'timestamp', nullable: true }),
|
|
109
|
-
__metadata("design:type", Date)
|
|
110
|
-
], Article.prototype, "scheduledPublishAt", void 0);
|
|
111
106
|
__decorate([
|
|
112
107
|
swagger_1.ApiProperty(),
|
|
113
108
|
typeorm_1.CreateDateColumn({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article.entity.js","sourceRoot":"","sources":["../../../src/modules/article/article.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qCASiB;AAEjB,iEAAuD;AACvD,kDAAwC;AAGxC,IAAa,OAAO,GAApB,MAAa,OAAO;
|
|
1
|
+
{"version":3,"file":"article.entity.js","sourceRoot":"","sources":["../../../src/modules/article/article.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qCASiB;A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FJ,OAAO;IADnB,gBAAM,EAAE;GACI,OAAO,CAsFnB;AAtFY,0BAAO"}
|
|
@@ -9,32 +9,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.ArticleModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
12
|
-
const api_key_module_1 = require("../api-key/api-key.module");
|
|
13
12
|
const auth_module_1 = require("../auth/auth.module");
|
|
14
13
|
const category_module_1 = require("../category/category.module");
|
|
15
14
|
const tag_module_1 = require("../tag/tag.module");
|
|
16
15
|
const user_module_1 = require("../user/user.module");
|
|
17
|
-
const webhook_module_1 = require("../webhook/webhook.module");
|
|
18
|
-
const article_revision_entity_1 = require("./article-revision.entity");
|
|
19
16
|
const article_controller_1 = require("./article.controller");
|
|
20
17
|
const article_entity_1 = require("./article.entity");
|
|
21
18
|
const article_service_1 = require("./article.service");
|
|
22
|
-
const scheduled_publish_service_1 = require("./scheduled-publish.service");
|
|
23
19
|
let ArticleModule = class ArticleModule {
|
|
24
20
|
};
|
|
25
21
|
ArticleModule = __decorate([
|
|
26
22
|
common_1.Module({
|
|
27
|
-
imports: [
|
|
28
|
-
typeorm_1.TypeOrmModule.forFeature([article_entity_1.Article, article_revision_entity_1.ArticleRevision]),
|
|
29
|
-
category_module_1.CategoryModule,
|
|
30
|
-
tag_module_1.TagModule,
|
|
31
|
-
user_module_1.UserModule,
|
|
32
|
-
auth_module_1.AuthModule,
|
|
33
|
-
api_key_module_1.ApiKeyModule,
|
|
34
|
-
webhook_module_1.WebhookModule,
|
|
35
|
-
],
|
|
23
|
+
imports: [typeorm_1.TypeOrmModule.forFeature([article_entity_1.Article]), category_module_1.CategoryModule, tag_module_1.TagModule, user_module_1.UserModule, auth_module_1.AuthModule],
|
|
36
24
|
exports: [article_service_1.ArticleService],
|
|
37
|
-
providers: [article_service_1.ArticleService
|
|
25
|
+
providers: [article_service_1.ArticleService],
|
|
38
26
|
controllers: [article_controller_1.ArticleController],
|
|
39
27
|
})
|
|
40
28
|
], ArticleModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article.module.js","sourceRoot":"","sources":["../../../src/modules/article/article.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAEhD,
|
|
1
|
+
{"version":3,"file":"article.module.js","sourceRoot":"","sources":["../../../src/modules/article/article.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAEhD,qDAAiD;AACjD,iEAA6D;AAC7D,kDAA8C;AAC9C,qDAAiD;AACjD,6DAAyD;AACzD,qDAA2C;AAC3C,uDAAmD;AAQnD,IAAa,aAAa,GAA1B,MAAa,aAAa;CAAG,CAAA;AAAhB,aAAa;IANzB,eAAM,CAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,wBAAO,CAAC,CAAC,EAAE,gCAAc,EAAE,sBAAS,EAAE,wBAAU,EAAE,wBAAU,CAAC;QACjG,OAAO,EAAE,CAAC,gCAAc,CAAC;QACzB,SAAS,EAAE,CAAC,gCAAc,CAAC;QAC3B,WAAW,EAAE,CAAC,sCAAiB,CAAC;KACjC,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import { CategoryService } from '../category/category.service';
|
|
3
3
|
import { TagService } from '../tag/tag.service';
|
|
4
|
-
import { WebhookService } from '../webhook/webhook.service';
|
|
5
|
-
import { ArticleRevision } from './article-revision.entity';
|
|
6
4
|
import { Article } from './article.entity';
|
|
7
5
|
export declare class ArticleService {
|
|
8
6
|
private readonly articleRepository;
|
|
9
|
-
private readonly revisionRepository;
|
|
10
7
|
private readonly tagService;
|
|
11
8
|
private readonly categoryService;
|
|
12
|
-
|
|
13
|
-
constructor(articleRepository: Repository<Article>, revisionRepository: Repository<ArticleRevision>, tagService: TagService, categoryService: CategoryService, webhookService: WebhookService);
|
|
14
|
-
private saveRevision;
|
|
15
|
-
private notifyPublished;
|
|
9
|
+
constructor(articleRepository: Repository<Article>, tagService: TagService, categoryService: CategoryService);
|
|
16
10
|
create(article: Partial<Article>): Promise<Article>;
|
|
17
11
|
findAll(queryParams: any): Promise<[Article[], number]>;
|
|
18
12
|
findArticlesByCategory(category: any, queryParams: any): Promise<(number | Article[])[]>;
|
|
@@ -28,8 +22,6 @@ export declare class ArticleService {
|
|
|
28
22
|
}>;
|
|
29
23
|
findById(id: any, status?: any, isAdmin?: boolean): Promise<Article>;
|
|
30
24
|
updateById(id: any, article: Partial<Article>): Promise<Article>;
|
|
31
|
-
listRevisions(articleId: string): Promise<ArticleRevision[]>;
|
|
32
|
-
restoreRevision(articleId: string, revisionId: string): Promise<Article>;
|
|
33
25
|
updateViewsById(id: any): Promise<Article>;
|
|
34
26
|
updateLikesById(id: any, type: any): Promise<Article>;
|
|
35
27
|
deleteById(id: any): Promise<Article>;
|