From 14e282964db6daa39fe5549108bbefbd10dd132a Mon Sep 17 00:00:00 2001 From: sealday Date: Mon, 15 Apr 2024 05:35:49 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20(#708)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: sealday Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachycode/pulls/708 --- .../@hera/plugin-gas-station/.npmignore | 2 - .../@hera/plugin-gas-station/README.md | 1 - .../@hera/plugin-gas-station/client.d.ts | 2 - .../@hera/plugin-gas-station/client.js | 1 - .../@hera/plugin-gas-station/package.json | 12 - .../@hera/plugin-gas-station/server.d.ts | 2 - .../@hera/plugin-gas-station/server.js | 1 - .../plugin-gas-station/src/client/index.tsx | 21 -- .../@hera/plugin-gas-station/src/index.ts | 2 - .../src/server/collections/.gitkeep | 0 .../src/server/collections/books.ts | 96 -------- .../plugin-gas-station/src/server/index.ts | 1 - .../src/server/nocobase.code-workspace | 12 - .../plugin-gas-station/src/server/plugin.ts | 29 --- packages/plugins/@hera/plugin-oidc/.npmignore | 2 - packages/plugins/@hera/plugin-oidc/README.md | 1 - .../plugins/@hera/plugin-oidc/client.d.ts | 2 - packages/plugins/@hera/plugin-oidc/client.js | 1 - .../plugins/@hera/plugin-oidc/package.json | 13 -- .../plugins/@hera/plugin-oidc/server.d.ts | 2 - packages/plugins/@hera/plugin-oidc/server.js | 1 - .../@hera/plugin-oidc/src/client/index.tsx | 21 -- .../plugins/@hera/plugin-oidc/src/index.ts | 2 - .../src/server/collections/.gitkeep | 0 .../@hera/plugin-oidc/src/server/index.ts | 1 - .../@hera/plugin-oidc/src/server/plugin.ts | 218 ------------------ .../plugins/@hera/plugin-websocket/.npmignore | 2 - .../plugins/@hera/plugin-websocket/README.md | 1 - .../@hera/plugin-websocket/client.d.ts | 2 - .../plugins/@hera/plugin-websocket/client.js | 1 - .../@hera/plugin-websocket/package.json | 16 -- .../@hera/plugin-websocket/server.d.ts | 2 - .../plugins/@hera/plugin-websocket/server.js | 1 - .../plugin-websocket/src/client/index.tsx | 14 -- .../WebsocketBlockInitializer.tsx | 143 ------------ .../@hera/plugin-websocket/src/index.ts | 2 - .../src/server/collections/.gitkeep | 0 .../plugin-websocket/src/server/index.ts | 1 - .../plugin-websocket/src/server/plugin.ts | 19 -- packages/presets/.gitkeep | 0 .../presets/tachybase/src/server/index.ts | 3 + .../20240414160015-remove-audit-local.ts | 13 ++ 42 files changed, 16 insertions(+), 650 deletions(-) delete mode 100644 packages/plugins/@hera/plugin-gas-station/.npmignore delete mode 100644 packages/plugins/@hera/plugin-gas-station/README.md delete mode 100644 packages/plugins/@hera/plugin-gas-station/client.d.ts delete mode 100644 packages/plugins/@hera/plugin-gas-station/client.js delete mode 100644 packages/plugins/@hera/plugin-gas-station/package.json delete mode 100644 packages/plugins/@hera/plugin-gas-station/server.d.ts delete mode 100644 packages/plugins/@hera/plugin-gas-station/server.js delete mode 100644 packages/plugins/@hera/plugin-gas-station/src/client/index.tsx delete mode 100644 packages/plugins/@hera/plugin-gas-station/src/index.ts delete mode 100644 packages/plugins/@hera/plugin-gas-station/src/server/collections/.gitkeep delete mode 100644 packages/plugins/@hera/plugin-gas-station/src/server/collections/books.ts delete mode 100644 packages/plugins/@hera/plugin-gas-station/src/server/index.ts delete mode 100644 packages/plugins/@hera/plugin-gas-station/src/server/nocobase.code-workspace delete mode 100644 packages/plugins/@hera/plugin-gas-station/src/server/plugin.ts delete mode 100644 packages/plugins/@hera/plugin-oidc/.npmignore delete mode 100644 packages/plugins/@hera/plugin-oidc/README.md delete mode 100644 packages/plugins/@hera/plugin-oidc/client.d.ts delete mode 100644 packages/plugins/@hera/plugin-oidc/client.js delete mode 100644 packages/plugins/@hera/plugin-oidc/package.json delete mode 100644 packages/plugins/@hera/plugin-oidc/server.d.ts delete mode 100644 packages/plugins/@hera/plugin-oidc/server.js delete mode 100644 packages/plugins/@hera/plugin-oidc/src/client/index.tsx delete mode 100644 packages/plugins/@hera/plugin-oidc/src/index.ts delete mode 100644 packages/plugins/@hera/plugin-oidc/src/server/collections/.gitkeep delete mode 100644 packages/plugins/@hera/plugin-oidc/src/server/index.ts delete mode 100644 packages/plugins/@hera/plugin-oidc/src/server/plugin.ts delete mode 100644 packages/plugins/@hera/plugin-websocket/.npmignore delete mode 100644 packages/plugins/@hera/plugin-websocket/README.md delete mode 100644 packages/plugins/@hera/plugin-websocket/client.d.ts delete mode 100644 packages/plugins/@hera/plugin-websocket/client.js delete mode 100644 packages/plugins/@hera/plugin-websocket/package.json delete mode 100644 packages/plugins/@hera/plugin-websocket/server.d.ts delete mode 100644 packages/plugins/@hera/plugin-websocket/server.js delete mode 100644 packages/plugins/@hera/plugin-websocket/src/client/index.tsx delete mode 100644 packages/plugins/@hera/plugin-websocket/src/client/schema-initializer/WebsocketBlockInitializer.tsx delete mode 100644 packages/plugins/@hera/plugin-websocket/src/index.ts delete mode 100644 packages/plugins/@hera/plugin-websocket/src/server/collections/.gitkeep delete mode 100644 packages/plugins/@hera/plugin-websocket/src/server/index.ts delete mode 100644 packages/plugins/@hera/plugin-websocket/src/server/plugin.ts delete mode 100644 packages/presets/.gitkeep create mode 100644 packages/presets/tachybase/src/server/migrations/20240414160015-remove-audit-local.ts diff --git a/packages/plugins/@hera/plugin-gas-station/.npmignore b/packages/plugins/@hera/plugin-gas-station/.npmignore deleted file mode 100644 index 65f5e8779..000000000 --- a/packages/plugins/@hera/plugin-gas-station/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -/node_modules -/src diff --git a/packages/plugins/@hera/plugin-gas-station/README.md b/packages/plugins/@hera/plugin-gas-station/README.md deleted file mode 100644 index 7f9a8c789..000000000 --- a/packages/plugins/@hera/plugin-gas-station/README.md +++ /dev/null @@ -1 +0,0 @@ -# @hera/plugin-gas-station diff --git a/packages/plugins/@hera/plugin-gas-station/client.d.ts b/packages/plugins/@hera/plugin-gas-station/client.d.ts deleted file mode 100644 index 6c459cbac..000000000 --- a/packages/plugins/@hera/plugin-gas-station/client.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/client'; -export { default } from './dist/client'; diff --git a/packages/plugins/@hera/plugin-gas-station/client.js b/packages/plugins/@hera/plugin-gas-station/client.js deleted file mode 100644 index b6e3be70e..000000000 --- a/packages/plugins/@hera/plugin-gas-station/client.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/client/index.js'); diff --git a/packages/plugins/@hera/plugin-gas-station/package.json b/packages/plugins/@hera/plugin-gas-station/package.json deleted file mode 100644 index 12e6fca79..000000000 --- a/packages/plugins/@hera/plugin-gas-station/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@hera/plugin-gas-station", - "version": "0.14.7", - "main": "dist/server/index.js", - "dependencies": {}, - "peerDependencies": { - "@nocobase/client": "workspace:*", - "@nocobase/database": "workspace:*", - "@nocobase/server": "workspace:*", - "@nocobase/test": "workspace:*" - } -} diff --git a/packages/plugins/@hera/plugin-gas-station/server.d.ts b/packages/plugins/@hera/plugin-gas-station/server.d.ts deleted file mode 100644 index c41081ddc..000000000 --- a/packages/plugins/@hera/plugin-gas-station/server.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/server'; -export { default } from './dist/server'; diff --git a/packages/plugins/@hera/plugin-gas-station/server.js b/packages/plugins/@hera/plugin-gas-station/server.js deleted file mode 100644 index 972842039..000000000 --- a/packages/plugins/@hera/plugin-gas-station/server.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/server/index.js'); diff --git a/packages/plugins/@hera/plugin-gas-station/src/client/index.tsx b/packages/plugins/@hera/plugin-gas-station/src/client/index.tsx deleted file mode 100644 index c94bb91fd..000000000 --- a/packages/plugins/@hera/plugin-gas-station/src/client/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Plugin } from '@nocobase/client'; - -export class PluginGasStationClient extends Plugin { - async afterAdd() { - // await this.app.pm.add() - } - - async beforeLoad() {} - - // You can get and modify the app instance here - async load() { - console.log(this.app); - // this.app.addComponenkkkkkts({}) - // this.app.addScopes({}) - // this.app.addProvider() - // this.app.addProviders() - // this.app.router.add() - } -} - -export default PluginGasStationClient; diff --git a/packages/plugins/@hera/plugin-gas-station/src/index.ts b/packages/plugins/@hera/plugin-gas-station/src/index.ts deleted file mode 100644 index 7e74612df..000000000 --- a/packages/plugins/@hera/plugin-gas-station/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './server'; -export { default } from './server'; diff --git a/packages/plugins/@hera/plugin-gas-station/src/server/collections/.gitkeep b/packages/plugins/@hera/plugin-gas-station/src/server/collections/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/plugins/@hera/plugin-gas-station/src/server/collections/books.ts b/packages/plugins/@hera/plugin-gas-station/src/server/collections/books.ts deleted file mode 100644 index 28a4288d8..000000000 --- a/packages/plugins/@hera/plugin-gas-station/src/server/collections/books.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { defineCollection } from '@nocobase/database'; - -export default defineCollection({ - name: 'books', - title: '书籍', - sortable: 'sort', - createdBy: true, - updatedBy: true, - logging: true, - fields: [ - { - name: 'id', - type: 'bigInt', - autoIncrement: true, - primaryKey: true, - allowNull: false, - uiSchema: { type: 'number', title: '{{t("ID")}}', 'x-component': 'InputNumber', 'x-read-pretty': true }, - interface: 'id', - }, - { - interface: 'input', - type: 'string', - name: 'nickname', - uiSchema: { - type: 'string', - title: '{{t("Nickname")}}', - 'x-component': 'Input', - }, - }, - { - interface: 'input', - type: 'string', - name: 'username', - unique: true, - uiSchema: { - type: 'string', - title: '{{t("Username")}}', - 'x-component': 'Input', - 'x-validator': { username: true }, - required: true, - }, - }, - { - interface: 'email', - type: 'string', - name: 'email', - unique: true, - uiSchema: { - type: 'string', - title: '{{t("Email")}}', - 'x-component': 'Input', - 'x-validator': 'email', - required: true, - }, - }, - { - interface: 'phone', - type: 'string', - name: 'phone', - unique: true, - uiSchema: { - type: 'string', - title: '{{t("Phone")}}', - 'x-component': 'Input', - 'x-validator': 'phone', - required: true, - }, - }, - { - interface: 'password', - type: 'password', - name: 'password', - hidden: true, - uiSchema: { - type: 'string', - title: '{{t("Password")}}', - 'x-component': 'Password', - }, - }, - { - type: 'string', - name: 'appLang', - }, - { - type: 'string', - name: 'resetToken', - unique: true, - hidden: true, - }, - { - type: 'json', - name: 'systemSettings', - defaultValue: {}, - }, - ], -}); diff --git a/packages/plugins/@hera/plugin-gas-station/src/server/index.ts b/packages/plugins/@hera/plugin-gas-station/src/server/index.ts deleted file mode 100644 index b68aea57f..000000000 --- a/packages/plugins/@hera/plugin-gas-station/src/server/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './plugin'; diff --git a/packages/plugins/@hera/plugin-gas-station/src/server/nocobase.code-workspace b/packages/plugins/@hera/plugin-gas-station/src/server/nocobase.code-workspace deleted file mode 100644 index 5361f0ae9..000000000 --- a/packages/plugins/@hera/plugin-gas-station/src/server/nocobase.code-workspace +++ /dev/null @@ -1,12 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../../.." - }, - { - "path": "../../../../../../../hera" - } - ], - "settings": { - } -} \ No newline at end of file diff --git a/packages/plugins/@hera/plugin-gas-station/src/server/plugin.ts b/packages/plugins/@hera/plugin-gas-station/src/server/plugin.ts deleted file mode 100644 index d0cc06a7a..000000000 --- a/packages/plugins/@hera/plugin-gas-station/src/server/plugin.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { InstallOptions, Plugin } from '@nocobase/server'; -import path from 'path'; - -export class PluginGasStationServer extends Plugin { - afterAdd() {} - - beforeLoad() {} - - async load() { - await this.app.db.import({ - directory: path.resolve(__dirname, './collections'), - }); - } - - async install(options?: InstallOptions) { - const repo = this.db.getRepository('collections'); - if (repo) { - await repo.db2cm('books'); - } - } - - async afterEnable() {} - - async afterDisable() {} - - async remove() {} -} - -export default PluginGasStationServer; diff --git a/packages/plugins/@hera/plugin-oidc/.npmignore b/packages/plugins/@hera/plugin-oidc/.npmignore deleted file mode 100644 index 65f5e8779..000000000 --- a/packages/plugins/@hera/plugin-oidc/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -/node_modules -/src diff --git a/packages/plugins/@hera/plugin-oidc/README.md b/packages/plugins/@hera/plugin-oidc/README.md deleted file mode 100644 index 7e7c909eb..000000000 --- a/packages/plugins/@hera/plugin-oidc/README.md +++ /dev/null @@ -1 +0,0 @@ -# @hera/plugin-oidc diff --git a/packages/plugins/@hera/plugin-oidc/client.d.ts b/packages/plugins/@hera/plugin-oidc/client.d.ts deleted file mode 100644 index 6c459cbac..000000000 --- a/packages/plugins/@hera/plugin-oidc/client.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/client'; -export { default } from './dist/client'; diff --git a/packages/plugins/@hera/plugin-oidc/client.js b/packages/plugins/@hera/plugin-oidc/client.js deleted file mode 100644 index b6e3be70e..000000000 --- a/packages/plugins/@hera/plugin-oidc/client.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/client/index.js'); diff --git a/packages/plugins/@hera/plugin-oidc/package.json b/packages/plugins/@hera/plugin-oidc/package.json deleted file mode 100644 index 7ce12f1b0..000000000 --- a/packages/plugins/@hera/plugin-oidc/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "@hera/plugin-oidc", - "version": "0.20.7", - "main": "dist/server/index.js", - "devDependencies": { - "@koa/router": "^9.4.0" - }, - "peerDependencies": { - "@nocobase/client": "workspace:*", - "@nocobase/server": "workspace:*", - "@nocobase/test": "workspace:*" - } -} diff --git a/packages/plugins/@hera/plugin-oidc/server.d.ts b/packages/plugins/@hera/plugin-oidc/server.d.ts deleted file mode 100644 index c41081ddc..000000000 --- a/packages/plugins/@hera/plugin-oidc/server.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/server'; -export { default } from './dist/server'; diff --git a/packages/plugins/@hera/plugin-oidc/server.js b/packages/plugins/@hera/plugin-oidc/server.js deleted file mode 100644 index 972842039..000000000 --- a/packages/plugins/@hera/plugin-oidc/server.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/server/index.js'); diff --git a/packages/plugins/@hera/plugin-oidc/src/client/index.tsx b/packages/plugins/@hera/plugin-oidc/src/client/index.tsx deleted file mode 100644 index 21ff0eddd..000000000 --- a/packages/plugins/@hera/plugin-oidc/src/client/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Plugin } from '@nocobase/client'; - -export class PluginOidcClient extends Plugin { - async afterAdd() { - // await this.app.pm.add() - } - - async beforeLoad() {} - - // You can get and modify the app instance here - async load() { - console.log(this.app); - // this.app.addComponents({}) - // this.app.addScopes({}) - // this.app.addProvider() - // this.app.addProviders() - // this.app.router.add() - } -} - -export default PluginOidcClient; diff --git a/packages/plugins/@hera/plugin-oidc/src/index.ts b/packages/plugins/@hera/plugin-oidc/src/index.ts deleted file mode 100644 index 7e74612df..000000000 --- a/packages/plugins/@hera/plugin-oidc/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './server'; -export { default } from './server'; diff --git a/packages/plugins/@hera/plugin-oidc/src/server/collections/.gitkeep b/packages/plugins/@hera/plugin-oidc/src/server/collections/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/plugins/@hera/plugin-oidc/src/server/index.ts b/packages/plugins/@hera/plugin-oidc/src/server/index.ts deleted file mode 100644 index b68aea57f..000000000 --- a/packages/plugins/@hera/plugin-oidc/src/server/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './plugin'; diff --git a/packages/plugins/@hera/plugin-oidc/src/server/plugin.ts b/packages/plugins/@hera/plugin-oidc/src/server/plugin.ts deleted file mode 100644 index 222a40820..000000000 --- a/packages/plugins/@hera/plugin-oidc/src/server/plugin.ts +++ /dev/null @@ -1,218 +0,0 @@ -import { Plugin } from '@nocobase/server'; -import Router from '@koa/router'; - -export class PluginOidcServer extends Plugin { - async afterAdd() {} - - async beforeLoad() {} - - async load() { - const router = new Router(); - - router.get('/oidc/hello', async (ctx, next) => { - ctx.body = { - message: 'hello from koa router', - }; - }); - // this.app.use(router.routes()); - this.app.use(async (ctx, next) => { - console.log('------------------- - - - -'); - }); - - // router.use(async (ctx, next) => { - // ctx.set('cache-control', 'no-store'); - // try { - // await next(); - // } catch (err) { - // console.log('------------------') - // console.error(err) - // if (err instanceof SessionNotFound) { - // ctx.status = err.status; - // const { message: error, error_description } = err; - // await defaults.renderError(ctx, { error, error_description }, err); - // } else { - // throw err; - // } - // } - // }); - - // router.get('/interaction/:uid', async (ctx, next) => { - // const { - // uid, prompt, params, session, - // } = await provider.interactionDetails(ctx.req, ctx.res); - // const client = await provider.Client.find(params.client_id); - - // switch (prompt.name) { - // case 'login': { - // return ctx.render('login', { - // client, - // uid, - // details: prompt.details, - // params, - // title: 'Sign-in', - // google: ctx.google, - // session: session ? debug(session) : undefined, - // dbg: { - // params: debug(params), - // prompt: debug(prompt), - // }, - // }); - // } - // case 'consent': { - // return ctx.render('interaction', { - // client, - // uid, - // details: prompt.details, - // params, - // title: 'Authorize', - // session: session ? debug(session) : undefined, - // dbg: { - // params: debug(params), - // prompt: debug(prompt), - // }, - // }); - // } - // default: - // return next(); - // } - // }); - - // const body = bodyParser({ - // text: false, json: false, patchNode: true, patchKoa: true, - // }); - - // router.get('/interaction/callback/google', (ctx) => { - // const nonce = ctx.res.locals.cspNonce; - // return ctx.render('repost', { layout: false, upstream: 'google', nonce }); - // }); - - // router.post('/interaction/:uid/login', body, async (ctx) => { - // const { prompt: { name } } = await provider.interactionDetails(ctx.req, ctx.res); - // assert.equal(name, 'login'); - - // const account = await Account.findByLogin(ctx.request.body.login); - - // const result = { - // login: { - // accountId: account.accountId, - // }, - // }; - - // return provider.interactionFinished(ctx.req, ctx.res, result, { - // mergeWithLastSubmission: false, - // }); - // }); - - // router.post('/interaction/:uid/federated', body, async (ctx) => { - // const { prompt: { name } } = await provider.interactionDetails(ctx.req, ctx.res); - // assert.equal(name, 'login'); - - // const path = `/interaction/${ctx.params.uid}/federated`; - - // switch (ctx.request.body.upstream) { - // case 'google': { - // const callbackParams = ctx.google.callbackParams(ctx.req); - - // // init - // if (!Object.keys(callbackParams).length) { - // const state = ctx.params.uid; - // const nonce = crypto.randomBytes(32).toString('hex'); - - // ctx.cookies.set('google.nonce', nonce, { path, sameSite: 'strict' }); - - // ctx.status = 303; - // return ctx.redirect(ctx.google.authorizationUrl({ - // state, nonce, scope: 'openid email profile', - // })); - // } - - // // callback - // const nonce = ctx.cookies.get('google.nonce'); - // ctx.cookies.set('google.nonce', null, { path }); - - // const tokenset = await ctx.google.callback(undefined, callbackParams, { state: ctx.params.uid, nonce, response_type: 'id_token' }); - // const account = await Account.findByFederated('google', tokenset.claims()); - - // const result = { - // login: { - // accountId: account.accountId, - // }, - // }; - // return provider.interactionFinished(ctx.req, ctx.res, result, { - // mergeWithLastSubmission: false, - // }); - // } - // default: - // return undefined; - // } - // }); - - // router.post('/interaction/:uid/confirm', body, async (ctx) => { - // const interactionDetails = await provider.interactionDetails(ctx.req, ctx.res); - // const { prompt: { name, details }, params, session: { accountId } } = interactionDetails; - // assert.equal(name, 'consent'); - - // let { grantId } = interactionDetails; - // let grant; - - // if (grantId) { - // // we'll be modifying existing grant in existing session - // grant = await provider.Grant.find(grantId); - // } else { - // // we're establishing a new grant - // grant = new provider.Grant({ - // accountId, - // clientId: params.client_id, - // }); - // } - - // if (details.missingOIDCScope) { - // grant.addOIDCScope(details.missingOIDCScope.join(' ')); - // } - // if (details.missingOIDCClaims) { - // grant.addOIDCClaims(details.missingOIDCClaims); - // } - // if (details.missingResourceScopes) { - // for (const [indicator, scope] of Object.entries(details.missingResourceScopes)) { - // grant.addResourceScope(indicator, scope.join(' ')); - // } - // } - - // grantId = await grant.save(); - - // const consent = {}; - // if (!interactionDetails.grantId) { - // // we don't have to pass grantId to consent, we're just modifying existing one - // consent.grantId = grantId; - // } - - // const result = { consent }; - // return provider.interactionFinished(ctx.req, ctx.res, result, { - // mergeWithLastSubmission: true, - // }); - // }); - - // router.get('/interaction/:uid/abort', async (ctx) => { - // const result = { - // error: 'access_denied', - // error_description: 'End-User aborted interaction', - // }; - - // return provider.interactionFinished(ctx.req, ctx.res, result, { - // mergeWithLastSubmission: false, - // }); - // }); - - // return router; - } - - async install() {} - - async afterEnable() {} - - async afterDisable() {} - - async remove() {} -} - -export default PluginOidcServer; diff --git a/packages/plugins/@hera/plugin-websocket/.npmignore b/packages/plugins/@hera/plugin-websocket/.npmignore deleted file mode 100644 index 65f5e8779..000000000 --- a/packages/plugins/@hera/plugin-websocket/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -/node_modules -/src diff --git a/packages/plugins/@hera/plugin-websocket/README.md b/packages/plugins/@hera/plugin-websocket/README.md deleted file mode 100644 index 2c1048977..000000000 --- a/packages/plugins/@hera/plugin-websocket/README.md +++ /dev/null @@ -1 +0,0 @@ -# @hera/plugin-websocket diff --git a/packages/plugins/@hera/plugin-websocket/client.d.ts b/packages/plugins/@hera/plugin-websocket/client.d.ts deleted file mode 100644 index 6c459cbac..000000000 --- a/packages/plugins/@hera/plugin-websocket/client.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/client'; -export { default } from './dist/client'; diff --git a/packages/plugins/@hera/plugin-websocket/client.js b/packages/plugins/@hera/plugin-websocket/client.js deleted file mode 100644 index b6e3be70e..000000000 --- a/packages/plugins/@hera/plugin-websocket/client.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/client/index.js'); diff --git a/packages/plugins/@hera/plugin-websocket/package.json b/packages/plugins/@hera/plugin-websocket/package.json deleted file mode 100644 index 5048d4701..000000000 --- a/packages/plugins/@hera/plugin-websocket/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@hera/plugin-websocket", - "version": "0.0.9", - "main": "dist/server/index.js", - "devDependencies": { - "@ant-design/icons": "^5.3.6", - "@formily/antd-v5": "1.x", - "@nocobase/schema": "workspace:*", - "react-use-websocket": "^4.8.1" - }, - "peerDependencies": { - "@nocobase/client": "workspace:*", - "@nocobase/server": "workspace:*", - "@nocobase/test": "workspace:*" - } -} diff --git a/packages/plugins/@hera/plugin-websocket/server.d.ts b/packages/plugins/@hera/plugin-websocket/server.d.ts deleted file mode 100644 index c41081ddc..000000000 --- a/packages/plugins/@hera/plugin-websocket/server.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/server'; -export { default } from './dist/server'; diff --git a/packages/plugins/@hera/plugin-websocket/server.js b/packages/plugins/@hera/plugin-websocket/server.js deleted file mode 100644 index 972842039..000000000 --- a/packages/plugins/@hera/plugin-websocket/server.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/server/index.js'); diff --git a/packages/plugins/@hera/plugin-websocket/src/client/index.tsx b/packages/plugins/@hera/plugin-websocket/src/client/index.tsx deleted file mode 100644 index d64f1362c..000000000 --- a/packages/plugins/@hera/plugin-websocket/src/client/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { Plugin } from '@nocobase/client'; -import { WebsocketBlockHelper } from './schema-initializer/WebsocketBlockInitializer'; - -export class PluginWebsocketClient extends Plugin { - async afterAdd() {} - - async beforeLoad() {} - - async load() { - await new WebsocketBlockHelper(this.app).load(); - } -} - -export default PluginWebsocketClient; diff --git a/packages/plugins/@hera/plugin-websocket/src/client/schema-initializer/WebsocketBlockInitializer.tsx b/packages/plugins/@hera/plugin-websocket/src/client/schema-initializer/WebsocketBlockInitializer.tsx deleted file mode 100644 index 906088c84..000000000 --- a/packages/plugins/@hera/plugin-websocket/src/client/schema-initializer/WebsocketBlockInitializer.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import React, { useCallback, useEffect, useState } from 'react'; -import { PrinterOutlined } from '@ant-design/icons'; -import { - Application, - SchemaInitializer, - SchemaInitializerItem, - SchemaSettings, - SchemaToolbar, - useSchemaInitializer, - useSchemaInitializerItem, -} from '@nocobase/client'; -import useWebSocket, { ReadyState } from 'react-use-websocket'; -import { useFieldSchema } from '@nocobase/schema'; - -export class WebsocketBlockHelper { - constructor(private app: Application) {} - async load() { - this.app.schemaInitializerManager.addItem('page:addBlock', 'dataBlocks.groupBlock', { - title: 'Websocket', - Component: 'WebsocketBlockInitializer', - }); - this.app.schemaSettingsManager.add(websocketBlockSettings); - this.app.schemaInitializerManager.add(WebsocketActionInitializer); - this.app.addComponents({ - WebsocketBlockInitializer, - WebsocketBlockToolbar, - WebsocketBlock, - }); - const WebsocketBlockItem = { - title: 'Websocket', - name: 'websocketBlock', - Component: 'WebsocketBlockInitializer', - type: 'item', - }; - this.app.schemaInitializerManager.get('popup:common:addBlock').add(WebsocketBlockItem.name, WebsocketBlockItem); - } -} - -const WebsocketBlock: React.FC = () => { - //Public API that will echo messages sent to it back to the client - const [socketUrl, setSocketUrl] = useState('wss://echo.websocket.org'); - const [messageHistory, setMessageHistory] = useState[]>([]); - - const { sendMessage, lastMessage, readyState } = useWebSocket(socketUrl); - - useEffect(() => { - if (lastMessage !== null) { - setMessageHistory((prev) => prev.concat(lastMessage)); - } - }, [lastMessage]); - - const handleClickChangeSocketUrl = useCallback(() => setSocketUrl('wss://demos.kaazing.com/echo'), []); - - const handleClickSendMessage = useCallback(() => sendMessage('Hello'), []); - - const connectionStatus = { - [ReadyState.CONNECTING]: 'Connecting', - [ReadyState.OPEN]: 'Open', - [ReadyState.CLOSING]: 'Closing', - [ReadyState.CLOSED]: 'Closed', - [ReadyState.UNINSTANTIATED]: 'Uninstantiated', - }[readyState]; - - return ( -
- - - The WebSocket is currently {connectionStatus} - {lastMessage ? Last message: {lastMessage.data} : null} -
    - {messageHistory.map((message, idx) => ( - {message ? message.data : null} - ))} -
-
- ); -}; - -const WebsocketActionInitializer = new SchemaInitializer({ - name: 'WebsocketActionInitializer', - title: 'Configure actions', - icon: 'SettingOutlined', - style: { - marginLeft: 8, - }, - items: [ - { - name: 'enbaleActions', - type: 'itemGroup', - title: 'Enable actions', - children: [], - }, - ], -}); - -const WebsocketBlockInitializer = () => { - const { insert } = useSchemaInitializer(); - const itemConfig = useSchemaInitializerItem(); - return ( - } - onClick={() => { - insert({ - type: 'void', - 'x-toolbar': 'WebsocketBlockToolbar', - 'x-settings': 'websocketBlockSettings', - 'x-component': 'CardItem', - properties: { - actions: { - type: 'void', - 'x-initializer': 'WebsocketActionInitializer', - 'x-component': 'ActionBar', - 'x-component-props': {}, - properties: {}, - }, - viewer: { - type: 'void', - 'x-component': 'WebsocketBlock', - }, - }, - }); - }} - /> - ); -}; - -export const websocketBlockSettings = new SchemaSettings({ - name: 'websocketBlockSettings', - items: [ - { - name: 'remove', - type: 'remove', - }, - ], -}); - -export const WebsocketBlockToolbar = (props) => { - const fieldSchema = useFieldSchema(); - return ; -}; diff --git a/packages/plugins/@hera/plugin-websocket/src/index.ts b/packages/plugins/@hera/plugin-websocket/src/index.ts deleted file mode 100644 index 7e74612df..000000000 --- a/packages/plugins/@hera/plugin-websocket/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './server'; -export { default } from './server'; diff --git a/packages/plugins/@hera/plugin-websocket/src/server/collections/.gitkeep b/packages/plugins/@hera/plugin-websocket/src/server/collections/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/plugins/@hera/plugin-websocket/src/server/index.ts b/packages/plugins/@hera/plugin-websocket/src/server/index.ts deleted file mode 100644 index b68aea57f..000000000 --- a/packages/plugins/@hera/plugin-websocket/src/server/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './plugin'; diff --git a/packages/plugins/@hera/plugin-websocket/src/server/plugin.ts b/packages/plugins/@hera/plugin-websocket/src/server/plugin.ts deleted file mode 100644 index 521f3ded5..000000000 --- a/packages/plugins/@hera/plugin-websocket/src/server/plugin.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Plugin } from '@nocobase/server'; - -export class PluginWebsocketServer extends Plugin { - async afterAdd() {} - - async beforeLoad() {} - - async load() {} - - async install() {} - - async afterEnable() {} - - async afterDisable() {} - - async remove() {} -} - -export default PluginWebsocketServer; diff --git a/packages/presets/.gitkeep b/packages/presets/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/presets/tachybase/src/server/index.ts b/packages/presets/tachybase/src/server/index.ts index 56fb9ca1e..bc0d3250b 100644 --- a/packages/presets/tachybase/src/server/index.ts +++ b/packages/presets/tachybase/src/server/index.ts @@ -43,6 +43,9 @@ export class PresetTachyBase extends Plugin { 'workflow-parallel', 'workflow-request', 'workflow-sql', + // hera + 'audit-logs', + 'approval', ]; localPlugins = [ diff --git a/packages/presets/tachybase/src/server/migrations/20240414160015-remove-audit-local.ts b/packages/presets/tachybase/src/server/migrations/20240414160015-remove-audit-local.ts new file mode 100644 index 000000000..53e728975 --- /dev/null +++ b/packages/presets/tachybase/src/server/migrations/20240414160015-remove-audit-local.ts @@ -0,0 +1,13 @@ +import { Migration } from '@nocobase/server'; + +export default class RemoveBuitInAuditLogsMigration extends Migration { + on = 'beforeLoad'; + appVersion = '<0.21.7'; + async up() { + await this.pm.repository.destroy({ + filter: { + packageName: '@nocobase/plugin-audit-logs', + }, + }); + } +}