diff --git a/.github/workflows/build-pro-image.yml b/.github/workflows/build-pro-image.yml index 714104d8c..a9b4670d8 100644 --- a/.github/workflows/build-pro-image.yml +++ b/.github/workflows/build-pro-image.yml @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v3 with: repository: nocobase/pro-plugins - ref: feat/dataSource-manager + ref: main path: packages/pro-plugins ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} - name: rm .git diff --git a/CHANGELOG.md b/CHANGELOG.md index bdebc6740..51b98405e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +## [v0.20.0-alpha.7](https://github.com/nocobase/nocobase/compare/v0.20.0-alpha.6...v0.20.0-alpha.7) - 2024-03-08 + +### Merged + +- fix: view collection interface missing [`#3658`](https://github.com/nocobase/nocobase/pull/3658) +- fix: getCollection bug [`#3656`](https://github.com/nocobase/nocobase/pull/3656) + +### Commits + +- chore(versions): 😊 publish v0.20.0-alpha.7 [`63d1a8d`](https://github.com/nocobase/nocobase/commit/63d1a8d90ca30056f7dd48bc012c30590b727cb8) +- chore: update changelog [`12ba7cd`](https://github.com/nocobase/nocobase/commit/12ba7cd9d0c48dc7b7048ebb73bb93be79e41ac8) +- chore(ci): change branch of pro image [`8dbae24`](https://github.com/nocobase/nocobase/commit/8dbae24489a8f2dcb3fd055a89225454394501e7) + +## [v0.20.0-alpha.6](https://github.com/nocobase/nocobase/compare/v0.20.0-alpha.5...v0.20.0-alpha.6) - 2024-03-08 + +### Merged + +- fix: parse association field in acl [`#3655`](https://github.com/nocobase/nocobase/pull/3655) +- chore: update menu name of plugin-localization [`#3653`](https://github.com/nocobase/nocobase/pull/3653) +- chore(pm): set plugin-sms-auth as local plugin, close T-3323 [`#3652`](https://github.com/nocobase/nocobase/pull/3652) +- fix(cascadeSelect): cassadeSelect does not dislay data in edit form [`#3649`](https://github.com/nocobase/nocobase/pull/3649) +- fix(db): through scope in eager loading & fix(acl): filter reset issue [`#3636`](https://github.com/nocobase/nocobase/pull/3636) +- fix: dateTime format configured in table is invalid [`#3630`](https://github.com/nocobase/nocobase/pull/3630) +- fix: data source permission role update [`#3643`](https://github.com/nocobase/nocobase/pull/3643) +- style: flexWrap in actionBar [`#3635`](https://github.com/nocobase/nocobase/pull/3635) +- fix: add displayName [`#3628`](https://github.com/nocobase/nocobase/pull/3628) +- fix(customRequestAction): should not support setting icons and colours [`#3632`](https://github.com/nocobase/nocobase/pull/3632) +- fix(workflow-action-trigger): change plugin name [`#3631`](https://github.com/nocobase/nocobase/pull/3631) +- fix: graph collection postions data missing [`#3627`](https://github.com/nocobase/nocobase/pull/3627) +- fix(ActionLink): fix hover style [`#3629`](https://github.com/nocobase/nocobase/pull/3629) +- feat(plugin-workflow-form-trigger): add trigger button to all single record action bar [`#3563`](https://github.com/nocobase/nocobase/pull/3563) +- fix: sidebar menu text overflow [`#3626`](https://github.com/nocobase/nocobase/pull/3626) +- fix(acl-plugin-setting): pluginPermissions for snippets check [`#3622`](https://github.com/nocobase/nocobase/pull/3622) +- fix(subTable): fix changing title field invalid [`#3625`](https://github.com/nocobase/nocobase/pull/3625) +- fix: fix hover style for sub table [`#3623`](https://github.com/nocobase/nocobase/pull/3623) + +### Commits + +- chore(versions): 😊 publish v0.20.0-alpha.6 [`8b4821e`](https://github.com/nocobase/nocobase/commit/8b4821e2df39958f7befa9aa0abd203cd162bace) +- chore: update yarn.lock [`1088756`](https://github.com/nocobase/nocobase/commit/108875600c4baf9824246c43bcbdd858876e5fd1) +- chore: update changelog [`f9a10de`](https://github.com/nocobase/nocobase/commit/f9a10de9811b7a35b13f67d9007051487321e993) + ## [v0.20.0-alpha.5](https://github.com/nocobase/nocobase/compare/v0.20.0-alpha.4...v0.20.0-alpha.5) - 2024-03-06 ### Merged diff --git a/docker/app-mysql/docker-compose.yml b/docker/app-mysql/docker-compose.yml index 8b6c24a36..43351dfcd 100644 --- a/docker/app-mysql/docker-compose.yml +++ b/docker/app-mysql/docker-compose.yml @@ -14,7 +14,7 @@ services: - DB_DIALECT=mysql - DB_HOST=mysql - DB_DATABASE=nocobase - - DB_USER=nocobase + - DB_USER=root - DB_PASSWORD=nocobase - DB_TIMEZONE=+08:00 volumes: @@ -30,4 +30,4 @@ services: MYSQL_ROOT_PASSWORD: nocobase restart: always networks: - - nocobase \ No newline at end of file + - nocobase diff --git a/lerna.json b/lerna.json index b6e175a68..e52e5b8c5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "npmClient": "yarn", "useWorkspaces": true, "npmClientArgs": ["--ignore-engines"], diff --git a/packages/core/acl/package.json b/packages/core/acl/package.json index 463bd2584..b1d1dc2b2 100644 --- a/packages/core/acl/package.json +++ b/packages/core/acl/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/acl", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/resourcer": "0.20.0-alpha.5", - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/resourcer": "0.20.0-alpha.7", + "@nocobase/utils": "0.20.0-alpha.7", "minimatch": "^5.1.1" }, "repository": { diff --git a/packages/core/acl/src/acl.ts b/packages/core/acl/src/acl.ts index 6f08a98ef..d7ed1ab73 100644 --- a/packages/core/acl/src/acl.ts +++ b/packages/core/acl/src/acl.ts @@ -264,7 +264,7 @@ export class ACL extends EventEmitter { ctx: { state, }, - $user: async () => state.currentUser, + $user: getUser(ctx), $nRole: () => state.currentRole, }, }); @@ -388,3 +388,24 @@ export class ACL extends EventEmitter { return this.availableActions.has(this.resolveActionAlias(actionName)); } } + +function getUser(ctx) { + return async ({ fields }) => { + const userFields = fields.filter((f) => f && ctx.db.getFieldByPath('users.' + f)); + ctx.logger?.info('filter-parse: ', { userFields }); + if (!ctx.state.currentUser) { + return; + } + if (!userFields.length) { + return; + } + const user = await ctx.db.getRepository('users').findOne({ + filterByTk: ctx.state.currentUser.id, + fields: userFields, + }); + ctx.logger?.info('filter-parse: ', { + $user: user?.toJSON(), + }); + return user; + }; +} diff --git a/packages/core/actions/package.json b/packages/core/actions/package.json index b06b64b64..ebc814b7f 100644 --- a/packages/core/actions/package.json +++ b/packages/core/actions/package.json @@ -1,14 +1,14 @@ { "name": "@nocobase/actions", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/cache": "0.20.0-alpha.5", - "@nocobase/database": "0.20.0-alpha.5", - "@nocobase/resourcer": "0.20.0-alpha.5" + "@nocobase/cache": "0.20.0-alpha.7", + "@nocobase/database": "0.20.0-alpha.7", + "@nocobase/resourcer": "0.20.0-alpha.7" }, "repository": { "type": "git", diff --git a/packages/core/app/package.json b/packages/core/app/package.json index a86acaa98..d83dc75cf 100644 --- a/packages/core/app/package.json +++ b/packages/core/app/package.json @@ -1,17 +1,17 @@ { "name": "@nocobase/app", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/database": "0.20.0-alpha.5", - "@nocobase/preset-nocobase": "0.20.0-alpha.5", - "@nocobase/server": "0.20.0-alpha.5" + "@nocobase/database": "0.20.0-alpha.7", + "@nocobase/preset-nocobase": "0.20.0-alpha.7", + "@nocobase/server": "0.20.0-alpha.7" }, "devDependencies": { - "@nocobase/client": "0.20.0-alpha.5" + "@nocobase/client": "0.20.0-alpha.7" }, "repository": { "type": "git", diff --git a/packages/core/auth/package.json b/packages/core/auth/package.json index 696c7b24a..4018db073 100644 --- a/packages/core/auth/package.json +++ b/packages/core/auth/package.json @@ -1,16 +1,16 @@ { "name": "@nocobase/auth", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/actions": "0.20.0-alpha.5", - "@nocobase/cache": "0.20.0-alpha.5", - "@nocobase/database": "0.20.0-alpha.5", - "@nocobase/resourcer": "0.20.0-alpha.5", - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/actions": "0.20.0-alpha.7", + "@nocobase/cache": "0.20.0-alpha.7", + "@nocobase/database": "0.20.0-alpha.7", + "@nocobase/resourcer": "0.20.0-alpha.7", + "@nocobase/utils": "0.20.0-alpha.7", "@types/jsonwebtoken": "^8.5.8", "jsonwebtoken": "^8.5.1" }, diff --git a/packages/core/build/package.json b/packages/core/build/package.json index 6449bbe59..510a3df12 100755 --- a/packages/core/build/package.json +++ b/packages/core/build/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/build", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "Library build tool based on rollup.", "main": "lib/index.js", "types": "./lib/index.d.ts", diff --git a/packages/core/cache/package.json b/packages/core/cache/package.json index 87987c796..46b64d772 100644 --- a/packages/core/cache/package.json +++ b/packages/core/cache/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/cache", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", diff --git a/packages/core/cli/package.json b/packages/core/cli/package.json index 0784d5ddb..17f9727e2 100644 --- a/packages/core/cli/package.json +++ b/packages/core/cli/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/cli", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "Apache-2.0", "main": "./src/index.js", @@ -8,7 +8,7 @@ "nocobase": "./bin/index.js" }, "dependencies": { - "@nocobase/app": "0.20.0-alpha.5", + "@nocobase/app": "0.20.0-alpha.7", "@types/fs-extra": "^11.0.1", "@umijs/utils": "3.5.20", "chalk": "^4.1.1", @@ -25,7 +25,7 @@ "tsx": "^4.6.2" }, "devDependencies": { - "@nocobase/devtools": "0.20.0-alpha.5" + "@nocobase/devtools": "0.20.0-alpha.7" }, "repository": { "type": "git", diff --git a/packages/core/client/package.json b/packages/core/client/package.json index af65566d5..ca958ac6a 100644 --- a/packages/core/client/package.json +++ b/packages/core/client/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/client", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.mjs", @@ -26,9 +26,9 @@ "@formily/reactive-react": "^2.2.27", "@formily/shared": "^2.2.27", "@formily/validator": "^2.2.27", - "@nocobase/evaluators": "0.20.0-alpha.5", - "@nocobase/sdk": "0.20.0-alpha.5", - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/evaluators": "0.20.0-alpha.7", + "@nocobase/sdk": "0.20.0-alpha.7", + "@nocobase/utils": "0.20.0-alpha.7", "ahooks": "^3.7.2", "antd": "^5.12.8", "antd-style": "3.4.5", diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index 4ed991116..d5b00e988 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -29,6 +29,9 @@ import { transformVariableValue } from '../../variables/utils/transformVariableV import { useBlockRequestContext, useFilterByTk, useParamsFromRecord } from '../BlockProvider'; import { useDetailsBlockContext } from '../DetailsBlockProvider'; import { TableFieldResource } from '../TableFieldProvider'; +import { Field, Form } from '@formily/core'; +import { untracked } from '@formily/reactive'; +import { isSubMode } from '../../schema-component/antd/association-field/util'; export * from './useFormActiveFields'; export * from './useParsedFilter'; @@ -222,14 +225,14 @@ export const useCreateActionProps = () => { __parent?.service?.refresh?.(); if (!onSuccess?.successMessage) { message.success(t('Saved successfully')); - await form.reset(undefined, { forceClear: true }); + await resetFormCorrectly(form); return; } if (onSuccess?.manualClose) { modal.success({ title: compile(onSuccess?.successMessage), onOk: async () => { - await form.reset(undefined, { forceClear: true }); + await resetFormCorrectly(form); if (onSuccess?.redirecting && onSuccess?.redirectTo) { if (isURL(onSuccess.redirectTo)) { window.location.href = onSuccess.redirectTo; @@ -241,7 +244,7 @@ export const useCreateActionProps = () => { }); } else { message.success(compile(onSuccess?.successMessage)); - await form.reset(undefined, { forceClear: true }); + await resetFormCorrectly(form); if (onSuccess?.redirecting && onSuccess?.redirectTo) { if (isURL(onSuccess.redirectTo)) { window.location.href = onSuccess.redirectTo; @@ -1280,8 +1283,8 @@ export const useAssociationNames = (dataSource?: string) => { const path = pre + '.' + title.label; appends.add(path); } - - const isTreeCollection = isAssociationField && getCollection(collectionField.target)?.template === 'tree'; + const isTreeCollection = + isAssociationField && getCollection(collectionField.target, dataSource)?.template === 'tree'; if (collectionField && (isAssociationField || isAssociationSubfield) && s['x-component'] !== 'TableField') { const fieldPath = !isAssociationField && isAssociationSubfield ? getAssociationPath(s.name) : s.name; const path = prefix === '' || !prefix ? fieldPath : prefix + '.' + fieldPath; @@ -1350,3 +1353,20 @@ function getTargetField(obj) { const result = keys.slice(0, index); return result; } + +/** + * 之所以不直接使用 form.reset() 是因为其无法将子表格重置为空 + * 主要用于修复这个问题:https://nocobase.height.app/T-3106 + * @param form + */ +async function resetFormCorrectly(form: Form) { + untracked(() => { + Object.keys(form.fields).forEach((key) => { + if (isSubMode(form.fields[key])) { + // 清空子表格或者子表单的初始值,可以确保后面的 reset 会清空子表格或者子表单的值 + (form.fields[key] as Field).initialValue = null; + } + }); + }); + await form.reset(); +} diff --git a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx index b7ca62c28..b3b71c560 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx @@ -60,12 +60,12 @@ const PreviewCom = (props) => { const children = collection.fields .filter((v) => !['hasOne', 'hasMany', 'belongsToMany'].includes(v?.type)) ?.map((v) => { - return { value: v.name, key: v.name, label: t(v.uiSchema?.title) }; + return { value: v.name, key: v.name, label: t(v.uiSchema?.title || v.name) }; }) .concat(result); data.push({ value: item, - label: t(collection.title), + label: t(collection.title || collection.name), children, }); }); @@ -187,7 +187,7 @@ const PreviewCom = (props) => { {data.map((group) => ( {group.children.map((item) => ( - + {compile(item.label)} ))} diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts index 4dfeb1b04..fb9b93f30 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts @@ -1,5 +1,6 @@ import { createBlockInPage, expect, oneEmptyForm, test } from '@nocobase/test/e2e'; -import { T3106 } from './templatesOfBug'; +import { T3106, T3469 } from './templatesOfBug'; +import { uid } from '@formily/shared'; test.describe('where creation form block can be added', () => { test('page', async ({ page, mockPage }) => { @@ -101,6 +102,38 @@ test.describe('configure actions', () => { ).toHaveValue('test name'); }); + // https://nocobase.height.app/T-3469 + test('default values for fields should not be cleared after submission', async ({ page, mockPage }) => { + await mockPage(T3469).goto(); + + // username 的值不能重复,所以为了避免报错这里随机生成一个值 + const username = uid(); + + // Username 字段没有设置默认值,手动输入一个值 + await page + .getByLabel('block-item-CollectionField-users-form-users.username-Username') + .getByRole('textbox') + .fill(username); + + // Nickname 字段设置了默认值,应该显示出默认值 + await expect( + page.getByLabel('block-item-CollectionField-users-form-users.nickname-Nickname').getByRole('textbox'), + ).toHaveValue('Should be cleared after submission'); + await expect( + page.getByLabel('block-item-CollectionField-users-form-users.username-Username').getByRole('textbox'), + ).toHaveValue(username); + + // 点击提交按钮之后,Nickname 字段的默认值应该依然显示,Username 字段的值应该被清空 + await page.getByLabel('action-Action-Submit-submit-').click(); + + await expect( + page.getByLabel('block-item-CollectionField-users-form-users.nickname-Nickname').getByRole('textbox'), + ).toHaveValue('Should be cleared after submission'); + await expect( + page.getByLabel('block-item-CollectionField-users-form-users.username-Username').getByRole('textbox'), + ).toHaveValue(''); + }); + test('customize: save record', async ({ page, mockPage }) => { await mockPage(oneEmptyForm).goto(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts index 746d5cd65..7f8a5acd7 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts @@ -1165,7 +1165,7 @@ test.describe('creation form block schema settings', () => { await page.getByRole('menuitem', { name: 'form Form' }).first().hover(); await page.getByRole('menuitem', { name: 'Users' }).hover(); await page.getByRole('menuitem', { name: 'Duplicate template' }).hover(); - await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).click(); + await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click(); await page.mouse.move(300, 0); await expect(page.getByLabel('block-item-CardItem-users-form')).toBeVisible(); @@ -1174,7 +1174,7 @@ test.describe('creation form block schema settings', () => { await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-users').hover(); await page.getByRole('menuitem', { name: 'form Form' }).first().hover(); await page.getByRole('menuitem', { name: 'Reference template' }).hover(); - await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).click(); + await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click(); await page.mouse.move(300, 0); await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-users').hover(); await expect(page.locator('.ant-drawer').getByLabel('block-item-CardItem-users-form')).toBeVisible(); @@ -1185,7 +1185,7 @@ test.describe('creation form block schema settings', () => { await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-users').click(); await page.getByRole('menuitem', { name: 'form Form' }).first().hover(); await page.getByRole('menuitem', { name: 'Reference template' }).hover(); - await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).click(); + await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click(); await page.mouse.move(300, 0); //修改引用模板 diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts index 9f77d8448..c19e35cf7 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts @@ -5491,3 +5491,213 @@ export const T3251: PageConfig = { 'x-index': 1, }, }; + +export const T3469: PageConfig = { + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + 'x-index': 1, + properties: { + '9u463vapg0k': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'BlockInitializers', + 'x-index': 1, + properties: { + isaxpp1w32b: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-index': 1, + properties: { + '5dld0j6dehi': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-index': 1, + properties: { + '96xwhprgfdg': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + 'x-acl-action': 'users:create', + 'x-decorator': 'FormBlockProvider', + 'x-decorator-props': { + dataSource: 'main', + resource: 'users', + collection: 'users', + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:createForm', + 'x-component': 'CardItem', + 'x-component-props': {}, + 'x-index': 1, + properties: { + '0sj1sfgjoxa': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'FormV2', + 'x-component-props': { + useProps: '{{ useFormBlockProps }}', + }, + 'x-index': 1, + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'FormItemInitializers', + 'x-index': 1, + properties: { + e4ke3wqxm2o: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-index': 1, + properties: { + l8uf6qeppmb: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-index': 1, + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': 'FormItemSchemaToolbar', + 'x-settings': 'fieldSettings:FormItem', + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': 'users.nickname', + 'x-component-props': {}, + default: 'Should be cleared after submission', + 'x-index': 1, + 'x-uid': 'lpgebrm0gig', + 'x-async': false, + }, + }, + 'x-uid': 'novdv1tcz37', + 'x-async': false, + }, + }, + 'x-uid': 'kzf3dxvr0mb', + 'x-async': false, + }, + s17cswscq2o: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + properties: { + oh79jnxzotw: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + properties: { + username: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': 'FormItemSchemaToolbar', + 'x-settings': 'fieldSettings:FormItem', + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': 'users.username', + 'x-component-props': {}, + 'x-uid': 'z9dn5rnc3oi', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '62vb90prmzk', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'ti5u46epv08', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'e365kp0cwm9', + 'x-async': false, + }, + '7660qws6e4c': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'FormActionInitializers', + 'x-component': 'ActionBar', + 'x-component-props': { + layout: 'one-column', + style: { + marginTop: 24, + }, + }, + 'x-index': 2, + properties: { + '79tmpu1usft': { + _isJSONSchemaObject: true, + version: '2.0', + title: '{{ t("Submit") }}', + 'x-action': 'submit', + 'x-component': 'Action', + 'x-toolbar': 'ActionSchemaToolbar', + 'x-settings': 'actionSettings:createSubmit', + 'x-component-props': { + type: 'primary', + htmlType: 'submit', + useProps: '{{ useCreateActionProps }}', + }, + 'x-action-settings': { + triggerWorkflows: [], + }, + type: 'void', + 'x-index': 1, + 'x-uid': '96sageysorb', + 'x-async': false, + }, + }, + 'x-uid': 'nnn377hn4o4', + 'x-async': false, + }, + }, + 'x-uid': 'j5qpwo8d6su', + 'x-async': false, + }, + }, + 'x-uid': 'rlcmlnna7k8', + 'x-async': false, + }, + }, + 'x-uid': 'b6n82zkmrsh', + 'x-async': false, + }, + }, + 'x-uid': 'agdpemeoz1v', + 'x-async': false, + }, + }, + 'x-uid': 'dn5nok8na2g', + 'x-async': false, + }, + }, + 'x-uid': 'lb8hlm9oyv8', + 'x-async': true, + }, +}; diff --git a/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx b/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx index d02e74456..14a860916 100644 --- a/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx @@ -175,7 +175,6 @@ export const SubTable: any = observer( onClick={() => { field.value = field.value || []; field.value.push(markRecordAsNew({})); - field.onInput(field.value); }} > {t('Add new')} diff --git a/packages/core/client/src/schema-component/antd/association-field/util.ts b/packages/core/client/src/schema-component/antd/association-field/util.ts index 9ed66183f..a5dc2ec1a 100644 --- a/packages/core/client/src/schema-component/antd/association-field/util.ts +++ b/packages/core/client/src/schema-component/antd/association-field/util.ts @@ -5,6 +5,7 @@ import { Tag } from 'antd'; import dayjs from 'dayjs'; import React from 'react'; import { CollectionFieldOptions_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; +import { Field } from '@formily/core'; export const useLabelUiSchemaV2 = () => { const { getCollectionJoinField } = useCollectionManager_deprecated(); @@ -102,6 +103,7 @@ export function isShowFilePicker(labelUiSchema) { /** * 当前字段的模式是否是 `子表格` 或者 `子表单` */ -export function isSubMode(fieldSchema: Schema) { - return ['Nester', 'SubTable', 'PopoverNester'].includes(fieldSchema['x-component-props']?.mode); +export function isSubMode(field: any) { + const mode = field['x-component-props']?.mode || (field as Field).componentProps?.mode; + return ['Nester', 'SubTable', 'PopoverNester'].includes(mode); } diff --git a/packages/core/create-nocobase-app/package.json b/packages/core/create-nocobase-app/package.json index 758d1e164..e08788192 100755 --- a/packages/core/create-nocobase-app/package.json +++ b/packages/core/create-nocobase-app/package.json @@ -1,6 +1,6 @@ { "name": "create-nocobase-app", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "src/index.js", "license": "Apache-2.0", "dependencies": { diff --git a/packages/core/data-source-manager/package.json b/packages/core/data-source-manager/package.json index b960a42d4..2dcb7346a 100644 --- a/packages/core/data-source-manager/package.json +++ b/packages/core/data-source-manager/package.json @@ -1,16 +1,16 @@ { "name": "@nocobase/data-source-manager", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/actions": "0.20.0-alpha.5", - "@nocobase/cache": "0.20.0-alpha.5", - "@nocobase/database": "0.20.0-alpha.5", - "@nocobase/resourcer": "0.20.0-alpha.5", - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/actions": "0.20.0-alpha.7", + "@nocobase/cache": "0.20.0-alpha.7", + "@nocobase/database": "0.20.0-alpha.7", + "@nocobase/resourcer": "0.20.0-alpha.7", + "@nocobase/utils": "0.20.0-alpha.7", "@types/jsonwebtoken": "^8.5.8", "jsonwebtoken": "^8.5.1" }, diff --git a/packages/core/database/package.json b/packages/core/database/package.json index eeb09d476..4b5ae3c74 100644 --- a/packages/core/database/package.json +++ b/packages/core/database/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/database", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", "dependencies": { - "@nocobase/logger": "0.20.0-alpha.5", - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/logger": "0.20.0-alpha.7", + "@nocobase/utils": "0.20.0-alpha.7", "async-mutex": "^0.3.2", "chalk": "^4.1.1", "cron-parser": "4.4.0", diff --git a/packages/core/database/src/__tests__/view/view-inference.test.ts b/packages/core/database/src/__tests__/view/view-inference.test.ts index 8294bfba4..33b56de94 100644 --- a/packages/core/database/src/__tests__/view/view-inference.test.ts +++ b/packages/core/database/src/__tests__/view/view-inference.test.ts @@ -34,7 +34,7 @@ describe('view inference', function () { await db.sync(); - const viewName = 'user_posts'; + const viewName = 'test_view'; const dropViewSQL = `DROP VIEW IF EXISTS ${viewName}`; await db.sequelize.query(dropViewSQL); diff --git a/packages/core/database/src/query-interface/postgres-query-interface.ts b/packages/core/database/src/query-interface/postgres-query-interface.ts index 5e973dc38..183c4465c 100644 --- a/packages/core/database/src/query-interface/postgres-query-interface.ts +++ b/packages/core/database/src/query-interface/postgres-query-interface.ts @@ -153,10 +153,14 @@ export default class PostgresQueryInterface extends QueryInterface { // handle column alias const from = ast[0].from; - const findAs = from.find((from) => from.as === columnExprTable); + if (columnExprTable === null && column.expr.type === 'column_ref') { + columnExprTable = from[0].table; + } else { + const findAs = from.find((from) => from.as === columnExprTable); - if (findAs) { - columnExprTable = findAs.table; + if (findAs) { + columnExprTable = findAs.table; + } } return columnUsage.column_name === column.expr.column && columnUsage.table_name === columnExprTable; diff --git a/packages/core/devtools/package.json b/packages/core/devtools/package.json index c0f5e1271..87e57e0dd 100644 --- a/packages/core/devtools/package.json +++ b/packages/core/devtools/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/devtools", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "Apache-2.0", "main": "./src/index.js", "dependencies": { - "@nocobase/build": "0.20.0-alpha.5", - "@nocobase/client": "0.20.0-alpha.5", - "@nocobase/test": "0.20.0-alpha.5", + "@nocobase/build": "0.20.0-alpha.7", + "@nocobase/client": "0.20.0-alpha.7", + "@nocobase/test": "0.20.0-alpha.7", "@types/koa": "^2.13.4", "@types/koa-bodyparser": "^4.3.4", "@types/lodash": "^4.14.177", diff --git a/packages/core/evaluators/package.json b/packages/core/evaluators/package.json index 63acbdc6c..a0e5a5c2d 100644 --- a/packages/core/evaluators/package.json +++ b/packages/core/evaluators/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/evaluators", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", "dependencies": { "@formulajs/formulajs": "4.2.0", - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/utils": "0.20.0-alpha.7", "mathjs": "^10.6.0" }, "repository": { diff --git a/packages/core/logger/package.json b/packages/core/logger/package.json index ae9a389a8..3b0b9e897 100644 --- a/packages/core/logger/package.json +++ b/packages/core/logger/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/logger", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "nocobase logging library", "license": "Apache-2.0", "main": "./lib/index.js", diff --git a/packages/core/resourcer/package.json b/packages/core/resourcer/package.json index fb4bcf6ec..14b8d5430 100644 --- a/packages/core/resourcer/package.json +++ b/packages/core/resourcer/package.json @@ -1,12 +1,12 @@ { "name": "@nocobase/resourcer", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", "dependencies": { - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/utils": "0.20.0-alpha.7", "deepmerge": "^4.2.2", "koa-compose": "^4.1.0", "lodash": "^4.17.21", diff --git a/packages/core/sdk/package.json b/packages/core/sdk/package.json index 408123212..79d2b0810 100644 --- a/packages/core/sdk/package.json +++ b/packages/core/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/sdk", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "Apache-2.0", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/core/server/package.json b/packages/core/server/package.json index 45c115a67..523b55fa8 100644 --- a/packages/core/server/package.json +++ b/packages/core/server/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/server", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", @@ -10,18 +10,18 @@ "@koa/cors": "^3.1.0", "@koa/multer": "^3.0.2", "@koa/router": "^9.4.0", - "@nocobase/acl": "0.20.0-alpha.5", - "@nocobase/actions": "0.20.0-alpha.5", - "@nocobase/auth": "0.20.0-alpha.5", - "@nocobase/cache": "0.20.0-alpha.5", - "@nocobase/data-source-manager": "0.20.0-alpha.5", - "@nocobase/database": "0.20.0-alpha.5", - "@nocobase/evaluators": "0.20.0-alpha.5", - "@nocobase/logger": "0.20.0-alpha.5", - "@nocobase/resourcer": "0.20.0-alpha.5", - "@nocobase/sdk": "0.20.0-alpha.5", - "@nocobase/telemetry": "0.20.0-alpha.5", - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/acl": "0.20.0-alpha.7", + "@nocobase/actions": "0.20.0-alpha.7", + "@nocobase/auth": "0.20.0-alpha.7", + "@nocobase/cache": "0.20.0-alpha.7", + "@nocobase/data-source-manager": "0.20.0-alpha.7", + "@nocobase/database": "0.20.0-alpha.7", + "@nocobase/evaluators": "0.20.0-alpha.7", + "@nocobase/logger": "0.20.0-alpha.7", + "@nocobase/resourcer": "0.20.0-alpha.7", + "@nocobase/sdk": "0.20.0-alpha.7", + "@nocobase/telemetry": "0.20.0-alpha.7", + "@nocobase/utils": "0.20.0-alpha.7", "@types/decompress": "4.2.4", "@types/ini": "^1.3.31", "@types/koa-send": "^4.1.3", diff --git a/packages/core/telemetry/package.json b/packages/core/telemetry/package.json index bd6a02df5..ad5e458e8 100644 --- a/packages/core/telemetry/package.json +++ b/packages/core/telemetry/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/telemetry", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "nocobase telemetry library", "license": "Apache-2.0", "main": "./lib/index.js", @@ -11,7 +11,7 @@ "directory": "packages/telemetry" }, "dependencies": { - "@nocobase/utils": "0.20.0-alpha.5", + "@nocobase/utils": "0.20.0-alpha.7", "@opentelemetry/api": "^1.7.0", "@opentelemetry/instrumentation": "^0.46.0", "@opentelemetry/resources": "^1.19.0", diff --git a/packages/core/test/package.json b/packages/core/test/package.json index 550b525e4..b2feafc00 100644 --- a/packages/core/test/package.json +++ b/packages/core/test/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/test", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "lib/index.js", "module": "./src/index.ts", "types": "./lib/index.d.ts", @@ -40,7 +40,7 @@ }, "dependencies": { "@faker-js/faker": "8.1.0", - "@nocobase/server": "0.20.0-alpha.5", + "@nocobase/server": "0.20.0-alpha.7", "@playwright/test": "^1.42.1", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", diff --git a/packages/core/utils/package.json b/packages/core/utils/package.json index 73e9e1b57..1ac45fdfc 100644 --- a/packages/core/utils/package.json +++ b/packages/core/utils/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/utils", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", diff --git a/packages/plugins/@nocobase/plugin-acl/package.json b/packages/plugins/@nocobase/plugin-acl/package.json index 7c5b24e5f..d73f7de25 100644 --- a/packages/plugins/@nocobase/plugin-acl/package.json +++ b/packages/plugins/@nocobase/plugin-acl/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "权限控制", "description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.", "description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/acl", diff --git a/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/users.test.ts b/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/users.test.ts index 527fbfc1c..e8ab3dbbf 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/users.test.ts +++ b/packages/plugins/@nocobase/plugin-acl/src/server/__tests__/users.test.ts @@ -34,6 +34,137 @@ describe('actions', () => { await app.destroy(); }); + it('should set scope with user associations', async () => { + await app.db.getCollection('collections').repository.create({ + values: { + name: 'sites', + autoGenId: false, + fields: [ + { + name: 'id', + type: 'bigInt', + primaryKey: true, + autoIncrement: true, + }, + { + type: 'string', + name: 'name', + }, + ], + }, + context: {}, + }); + + // create site + const site = await db.getRepository('sites').create({ + values: { + name: 'testSite', + }, + }); + + const site2 = await db.getRepository('sites').create({ + values: { + name: 'site2', + }, + }); + + await app.db.getCollection('fields').repository.create({ + values: { + collectionName: 'users', + name: 'site', + type: 'belongsTo', + foreignKey: 'siteId', + targetKey: 'id', + }, + context: {}, + }); + + const testUser = await db.getRepository('users').create({ + values: { + username: 'testUser', + site: site.get('id'), + }, + }); + + await db.getRepository('roles').create({ + values: { + name: 'testRole', + users: [ + { + id: testUser.get('id'), + }, + ], + }, + }); + + await app.db.getCollection('collections').repository.create({ + values: { + name: 'items', + fields: [ + { + type: 'string', + name: 'name', + }, + { + name: 'site', + type: 'belongsTo', + foreignKey: 'siteId', + targetKey: 'id', + }, + ], + }, + context: {}, + }); + + const scope = await app.db.getCollection('dataSourcesRolesResourcesScopes').repository.create({ + values: { + name: 'items-own-site', + actions: ['view'], + fields: ['name'], + scope: { $and: [{ site: { id: { $eq: '{{$user.site.id}}' } } }] }, + resourceName: 'items', + }, + }); + + // create acl resource + const createResourcesResp = await adminAgent.resource('roles.resources', 'testRole').create({ + values: { + name: 'items', + usingActionsConfig: true, + actions: [ + { + name: 'view', + scope: scope.get('id'), + }, + ], + }, + }); + + expect(createResourcesResp.status).toBe(200); + + const item = await db.getRepository('items').create({ + values: { + name: 'testItem', + site: site.get('id'), + }, + }); + + await db.getRepository('items').create({ + values: { + name: 'item2', + site: site2.get('id'), + }, + }); + + // list with user + const userAgent: any = app.agent().login(testUser).set('x-role', 'testRole'); + + const listResp = await userAgent.resource('items').list({}); + expect(listResp.status).toBe(200); + const data = listResp.body.data; + expect(data.length).toBe(1); + }); + it('update profile with roles', async () => { const res2 = await adminAgent.resource('users').updateProfile({ filterByTk: adminUser.id, diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json b/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json index bc7ca0907..310dbcb7a 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-bulk-edit", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-bulk-edit", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-bulk-edit", diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/package.json b/packages/plugins/@nocobase/plugin-action-bulk-update/package.json index 53dc0d3f9..7d080c630 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/package.json +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-bulk-update", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-bulk-update", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-bulk-update", diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/package.json b/packages/plugins/@nocobase/plugin-action-duplicate/package.json index d02ab0e4b..979d4bede 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/package.json +++ b/packages/plugins/@nocobase/plugin-action-duplicate/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-duplicate", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-duplicate", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-duplicate", diff --git a/packages/plugins/@nocobase/plugin-action-print/package.json b/packages/plugins/@nocobase/plugin-action-print/package.json index b0ba962b2..4d2af6959 100644 --- a/packages/plugins/@nocobase/plugin-action-print/package.json +++ b/packages/plugins/@nocobase/plugin-action-print/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-print", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-print", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-print", diff --git a/packages/plugins/@nocobase/plugin-api-doc/package.json b/packages/plugins/@nocobase/plugin-api-doc/package.json index 60153507c..e68c0f2e7 100644 --- a/packages/plugins/@nocobase/plugin-api-doc/package.json +++ b/packages/plugins/@nocobase/plugin-api-doc/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-api-doc", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "displayName": "API documentation", "displayName.zh-CN": "API 文档", "description": "An OpenAPI documentation generator for NocoBase HTTP API.", diff --git a/packages/plugins/@nocobase/plugin-api-keys/package.json b/packages/plugins/@nocobase/plugin-api-keys/package.json index fbb420f87..97228d654 100644 --- a/packages/plugins/@nocobase/plugin-api-keys/package.json +++ b/packages/plugins/@nocobase/plugin-api-keys/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:API 密钥", "description": "Allows users to use API key to access application's HTTP API", "description.zh-CN": "允许用户使用 API 密钥访问应用的 HTTP API", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/api-keys", diff --git a/packages/plugins/@nocobase/plugin-audit-logs/package.json b/packages/plugins/@nocobase/plugin-audit-logs/package.json index 6aad15ebd..fc71c2065 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/package.json +++ b/packages/plugins/@nocobase/plugin-audit-logs/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-audit-logs", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "displayName": "Audit logs (deprecated)", "displayName.zh-CN": "审计日志(废弃)", "description": "This plugin is deprecated. There will be a new audit log plugin in the future.", diff --git a/packages/plugins/@nocobase/plugin-auth/package.json b/packages/plugins/@nocobase/plugin-auth/package.json index 4f1a10b9f..597001706 100644 --- a/packages/plugins/@nocobase/plugin-auth/package.json +++ b/packages/plugins/@nocobase/plugin-auth/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-auth", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth", diff --git a/packages/plugins/@nocobase/plugin-backup-restore/package.json b/packages/plugins/@nocobase/plugin-backup-restore/package.json index bf467ac43..cf9d055b5 100644 --- a/packages/plugins/@nocobase/plugin-backup-restore/package.json +++ b/packages/plugins/@nocobase/plugin-backup-restore/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "应用的备份与还原", "description": "Backup and restore applications for scenarios such as application replication, migration, and upgrades.", "description.zh-CN": "备份和还原应用,可用于应用的复制、迁移、升级等场景。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/backup-restore", diff --git a/packages/plugins/@nocobase/plugin-backup-restore/src/server/dumper.ts b/packages/plugins/@nocobase/plugin-backup-restore/src/server/dumper.ts index e129ea9ea..32fa2a3ab 100644 --- a/packages/plugins/@nocobase/plugin-backup-restore/src/server/dumper.ts +++ b/packages/plugins/@nocobase/plugin-backup-restore/src/server/dumper.ts @@ -73,7 +73,7 @@ export class Dumper extends AppMigrator { if (backupFileStat.isFile()) { return { name: fileName, - createdAt: backupFileStat.birthtime, + createdAt: backupFileStat.ctime, fileSize: humanFileSize(backupFileStat.size), status: 'ok', } as BackUpStatusOk; diff --git a/packages/plugins/@nocobase/plugin-calendar/package.json b/packages/plugins/@nocobase/plugin-calendar/package.json index 097584947..779066b7a 100644 --- a/packages/plugins/@nocobase/plugin-calendar/package.json +++ b/packages/plugins/@nocobase/plugin-calendar/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-calendar", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "displayName": "Calendar", "displayName.zh-CN": "日历", "description": "Provides callendar collection template and block for managing date data, typically for date/time related information such as events, appointments, tasks, and so on.", diff --git a/packages/plugins/@nocobase/plugin-cas/package.json b/packages/plugins/@nocobase/plugin-cas/package.json index 5155fc607..085cc6606 100644 --- a/packages/plugins/@nocobase/plugin-cas/package.json +++ b/packages/plugins/@nocobase/plugin-cas/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:CAS", "description": "CAS authentication.", "description.zh-CN": "通过 CAS 协议认证身份。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-cas", diff --git a/packages/plugins/@nocobase/plugin-cas/src/server/actions/login.ts b/packages/plugins/@nocobase/plugin-cas/src/server/actions/login.ts index 51ab5e99c..d35df9ca2 100644 --- a/packages/plugins/@nocobase/plugin-cas/src/server/actions/login.ts +++ b/packages/plugins/@nocobase/plugin-cas/src/server/actions/login.ts @@ -2,12 +2,10 @@ import { Context, Next } from '@nocobase/actions'; import { CASAuth } from '../auth'; export const login = async (ctx: Context, next: Next) => { - const { authenticator, redirect = '' } = ctx.action.params; + const { authenticator, redirect = '/admin' } = ctx.action.params; const auth = (await ctx.app.authManager.get(authenticator, ctx)) as CASAuth; - const { casUrl, serviceUrl } = auth.getOptions(); - const service = encodeURIComponent( - `${serviceUrl}?authenticator=${authenticator}&__appName=${ctx.app.name}&redirect=${redirect}`, - ); + const { casUrl } = auth.getOptions(); + const service = auth.getService(authenticator, ctx.app.name, redirect); ctx.redirect(`${casUrl}/login?service=${service}`); next(); }; diff --git a/packages/plugins/@nocobase/plugin-cas/src/server/auth.ts b/packages/plugins/@nocobase/plugin-cas/src/server/auth.ts index 488ce14e4..3a07dc947 100644 --- a/packages/plugins/@nocobase/plugin-cas/src/server/auth.ts +++ b/packages/plugins/@nocobase/plugin-cas/src/server/auth.ts @@ -11,21 +11,33 @@ export class CASAuth extends BaseAuth { }); } - getOptions() { + getOptions(): { + casUrl?: string; + serviceUrl?: string; + autoSignup?: boolean; + } { const opts = this.options || {}; return { ...opts, serviceUrl: `${opts.serviceDomain}/api/cas:service`, - } as { - casUrl?: string; - serviceUrl?: string; - autoSignup?: boolean; }; } + getService(authenticator: string, appName: string, redirect: string) { + const { serviceUrl } = this.getOptions(); + return encodeURIComponent(`${serviceUrl}?authenticator=${authenticator}&__appName=${appName}&redirect=${redirect}`); + } + async serviceValidate(ticket: string) { - const { casUrl, serviceUrl } = this.getOptions(); - const url = `${casUrl}/serviceValidate?ticket=${ticket}&service=${serviceUrl}`; + const { casUrl } = this.getOptions(); + const { authenticator, __appName: appName, redirect = '/admin' } = this.ctx.action.params; + const service = this.getService(authenticator, appName, redirect); + const url = `${casUrl}/serviceValidate?ticket=${ticket}&service=${service}`; + this.ctx.logger.debug(`serviceValidate url: ${url}`, { + module: 'auth', + submodule: 'cas', + method: 'serviceValidate', + }); try { const res = await axios.get(url); return res; @@ -42,6 +54,7 @@ export class CASAuth extends BaseAuth { throw new Error('Missing ticket'); } const res = await this.serviceValidate(ticket); + ctx.logger.debug(res?.data, { module: 'auth', submodule: 'cas', method: 'validate' }); const pattern = /<(?:cas|sso):user>(.*?)<\/(?:cas|sso):user>/; const username = res?.data.match(pattern)?.[1]; if (!username) { diff --git a/packages/plugins/@nocobase/plugin-charts/package.json b/packages/plugins/@nocobase/plugin-charts/package.json index b84acb187..260f66534 100644 --- a/packages/plugins/@nocobase/plugin-charts/package.json +++ b/packages/plugins/@nocobase/plugin-charts/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "图表(废弃)", "description": "The plugin has been deprecated, please use the data visualization plugin instead.", "description.zh-CN": "已废弃插件,请使用数据可视化插件代替。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "license": "AGPL-3.0", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-china-region/package.json b/packages/plugins/@nocobase/plugin-china-region/package.json index 9574d4c1b..419b8b791 100644 --- a/packages/plugins/@nocobase/plugin-china-region/package.json +++ b/packages/plugins/@nocobase/plugin-china-region/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-china-region", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "displayName": "Administrative divisions of China", "displayName.zh-CN": "中国行政区划", "description": "Provides data and field type for administrative divisions of China.", diff --git a/packages/plugins/@nocobase/plugin-client/package.json b/packages/plugins/@nocobase/plugin-client/package.json index d80ef2aad..1b3769b30 100644 --- a/packages/plugins/@nocobase/plugin-client/package.json +++ b/packages/plugins/@nocobase/plugin-client/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "WEB 客户端", "description": "Provides a client interface for the NocoBase server", "description.zh-CN": "为 NocoBase 服务端提供客户端界面", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "license": "AGPL-3.0", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-collection-manager/package.json b/packages/plugins/@nocobase/plugin-collection-manager/package.json index bcbf1232a..97b457a7b 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/package.json +++ b/packages/plugins/@nocobase/plugin-collection-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据源:主数据库", "description": "NocoBase main database, supports relational databases such as MySQL, PostgreSQL, SQLite and so on.", "description.zh-CN": "NocoBase 主数据库,支持 MySQL、PostgreSQL、SQLite 等关系型数据库。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/data-source-main", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-source-main", diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/server/__tests__/fields/destroy.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/server/__tests__/fields/destroy.test.ts new file mode 100644 index 000000000..c9aa7b4dd --- /dev/null +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/server/__tests__/fields/destroy.test.ts @@ -0,0 +1,142 @@ +import Database, { Collection as DBCollection } from '@nocobase/database'; +import Application from '@nocobase/server'; +import { createApp } from '..'; + +describe('destroy', () => { + let db: Database; + let app: Application; + let Collection: DBCollection; + let Field: DBCollection; + + beforeEach(async () => { + app = await createApp({ + database: { + tablePrefix: '', + }, + }); + db = app.db; + Collection = db.getCollection('collections'); + Field = db.getCollection('fields'); + + await Collection.repository.create({ + values: { + name: 'a', + fields: [ + { + name: 'name', + type: 'string', + }, + ], + }, + context: {}, + }); + + await Collection.repository.create({ + values: { + name: 'b', + fields: [ + { + name: 'name', + type: 'string', + }, + ], + }, + context: {}, + }); + }); + + afterEach(async () => { + await app.destroy(); + }); + + describe('destroy field', () => { + it('should remove field in model when field destroyed', async () => { + const collection = await Collection.repository.create({ + values: { + name: 'test', + fields: [ + { name: 'f1', type: 'string' }, + { + name: 'name', + type: 'string', + }, + ], + }, + context: {}, + }); + + expect(db.getCollection('test').model.rawAttributes.name).toBeDefined(); + + await Field.repository.destroy({ + filter: { + name: 'name', + collectionName: 'test', + }, + context: {}, + }); + + expect(db.getCollection('test').model.rawAttributes.name).toBeUndefined(); + expect(db.getCollection('test').model.rawAttributes.f1).toBeDefined(); + }); + }); + + describe('destroy foreign key', () => { + it('should destroy association field when foreign key field destroyed', async () => { + await Field.repository.create({ + values: { + name: 'b', + type: 'hasOne', + target: 'b', + collectionName: 'a', + foreignKey: 'a_id', + interface: 'oho', + }, + context: {}, + }); + + // should create association field + expect( + await Field.repository.findOne({ + filter: { + collectionName: 'a', + name: 'b', + }, + }), + ).toBeTruthy(); + + const foreignKeyField = await Field.repository.findOne({ + filter: { + name: 'a_id', + collectionName: 'b', + }, + }); + + // should create foreign key + expect(foreignKeyField).toBeTruthy(); + + expect(db.getCollection('b').model.rawAttributes.a_id).toBeTruthy(); + + // destroy foreign key field + await Field.repository.destroy({ + filter: { + name: 'a_id', + collectionName: 'b', + }, + context: {}, + }); + + // should remove association field + expect( + await Field.repository.findOne({ + filter: { + collectionName: 'a', + name: 'b', + }, + }), + ).toBeFalsy(); + + // should remove foreign key + expect(db.getCollection('b').model.rawAttributes.a_id).toBeFalsy(); + }); + }); +}); diff --git a/packages/plugins/@nocobase/plugin-custom-request/package.json b/packages/plugins/@nocobase/plugin-custom-request/package.json index 1508ee613..9ec72541a 100644 --- a/packages/plugins/@nocobase/plugin-custom-request/package.json +++ b/packages/plugins/@nocobase/plugin-custom-request/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-custom-request", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-custom-request", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-custom-request", diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/package.json b/packages/plugins/@nocobase/plugin-data-source-manager/package.json index d91d99974..5e963303d 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/package.json +++ b/packages/plugins/@nocobase/plugin-data-source-manager/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-data-source-manager", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "displayName": "Data source manager", "displayName.zh-CN": "数据源管理", diff --git a/packages/plugins/@nocobase/plugin-data-visualization/package.json b/packages/plugins/@nocobase/plugin-data-visualization/package.json index cf2e1ec57..59688fe46 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/package.json +++ b/packages/plugins/@nocobase/plugin-data-visualization/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-data-visualization", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "displayName": "Data visualization", "displayName.zh-CN": "数据可视化", "description": "Provides data visualization feature, including chart block and chart filter block, support line charts, area charts, bar charts and more than a dozen kinds of charts, you can also extend more chart types.", diff --git a/packages/plugins/@nocobase/plugin-disable-pm-add/package.json b/packages/plugins/@nocobase/plugin-disable-pm-add/package.json index f30cb62f8..0d49dfba0 100644 --- a/packages/plugins/@nocobase/plugin-disable-pm-add/package.json +++ b/packages/plugins/@nocobase/plugin-disable-pm-add/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-disable-pm-add", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "peerDependencies": { "@nocobase/client": "0.x", diff --git a/packages/plugins/@nocobase/plugin-error-handler/package.json b/packages/plugins/@nocobase/plugin-error-handler/package.json index bfb627db0..a32add70b 100644 --- a/packages/plugins/@nocobase/plugin-error-handler/package.json +++ b/packages/plugins/@nocobase/plugin-error-handler/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "错误处理器", "description": "Handling application errors and exceptions.", "description.zh-CN": "处理应用程序中的错误和异常。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-excel-formula-field/package.json b/packages/plugins/@nocobase/plugin-excel-formula-field/package.json index 48b22f899..0de7f40ae 100644 --- a/packages/plugins/@nocobase/plugin-excel-formula-field/package.json +++ b/packages/plugins/@nocobase/plugin-excel-formula-field/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-excel-formula-field", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "AGPL-3.0", "main": "./dist/server/index.js", diff --git a/packages/plugins/@nocobase/plugin-export/package.json b/packages/plugins/@nocobase/plugin-export/package.json index 646cfe03b..8e9e4b2d7 100644 --- a/packages/plugins/@nocobase/plugin-export/package.json +++ b/packages/plugins/@nocobase/plugin-export/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "操作:导出记录", "description": "Export filtered records to excel, you can configure which fields to export.", "description.zh-CN": "导出筛选后的记录到 Excel 中,可以配置导出哪些字段。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-export", diff --git a/packages/plugins/@nocobase/plugin-file-manager/package.json b/packages/plugins/@nocobase/plugin-file-manager/package.json index 38bb78ba4..f9f866beb 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/package.json +++ b/packages/plugins/@nocobase/plugin-file-manager/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-file-manager", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "displayName": "File manager", "displayName.zh-CN": "文件管理器", "description": "Provides files storage services with files collection template and attachment field.", diff --git a/packages/plugins/@nocobase/plugin-formula-field/package.json b/packages/plugins/@nocobase/plugin-formula-field/package.json index 2245f622e..8be84b9cb 100644 --- a/packages/plugins/@nocobase/plugin-formula-field/package.json +++ b/packages/plugins/@nocobase/plugin-formula-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:公式", "description": "Configure and store the results of calculations between multiple field values in the same record, supporting both Math.js and Excel formula functions.", "description.zh-CN": "可以配置并存储同一条记录的多字段值之间的计算结果,支持 Math.js 和 Excel formula functions 两种引擎", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-formula", diff --git a/packages/plugins/@nocobase/plugin-gantt/package.json b/packages/plugins/@nocobase/plugin-gantt/package.json index 58ca2e22b..bf0f36f49 100644 --- a/packages/plugins/@nocobase/plugin-gantt/package.json +++ b/packages/plugins/@nocobase/plugin-gantt/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-gantt", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "displayName": "Block: Gantt", "displayName.zh-CN": "区块:甘特图", "description": "Provides Gantt block.", diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json b/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json index d814e458e..83fece90f 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "可视化数据表管理", "description": "An ER diagram-like tool. Currently only the Master database is supported.", "description.zh-CN": "类似 ER 图的工具,目前只支持主数据库。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/graph-collection-manager", diff --git a/packages/plugins/@nocobase/plugin-iframe-block/package.json b/packages/plugins/@nocobase/plugin-iframe-block/package.json index e4b22bfa3..f4b7c1f59 100644 --- a/packages/plugins/@nocobase/plugin-iframe-block/package.json +++ b/packages/plugins/@nocobase/plugin-iframe-block/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "区块:iframe", "description": "Create an iframe block on the page to embed and display external web pages or content.", "description.zh-CN": "在页面上创建和管理iframe,用于嵌入和展示外部网页或内容。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/block-iframe", diff --git a/packages/plugins/@nocobase/plugin-import/package.json b/packages/plugins/@nocobase/plugin-import/package.json index 6830c18f7..86f7afdc4 100644 --- a/packages/plugins/@nocobase/plugin-import/package.json +++ b/packages/plugins/@nocobase/plugin-import/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "操作:导入记录", "description": "Import records using excel templates. You can configure which fields to import and templates will be generated automatically.", "description.zh-CN": "使用 Excel 模板导入数据,可以配置导入哪些字段,自动生成模板。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-import", diff --git a/packages/plugins/@nocobase/plugin-kanban/package.json b/packages/plugins/@nocobase/plugin-kanban/package.json index 54c10d4dc..e3104f627 100644 --- a/packages/plugins/@nocobase/plugin-kanban/package.json +++ b/packages/plugins/@nocobase/plugin-kanban/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-kanban", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/block-kanban", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/block-kanban", diff --git a/packages/plugins/@nocobase/plugin-localization-management/package.json b/packages/plugins/@nocobase/plugin-localization-management/package.json index 02fd9dedf..ff87ccf89 100644 --- a/packages/plugins/@nocobase/plugin-localization-management/package.json +++ b/packages/plugins/@nocobase/plugin-localization-management/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-localization-management", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/localization-management", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/localization-management", diff --git a/packages/plugins/@nocobase/plugin-logger/package.json b/packages/plugins/@nocobase/plugin-logger/package.json index afe85f567..a3617c75f 100644 --- a/packages/plugins/@nocobase/plugin-logger/package.json +++ b/packages/plugins/@nocobase/plugin-logger/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "日志", "description": "Server-side logs, mainly including API request logs and system runtime logs, and allows to package and download log files.", "description.zh-CN": "服务端日志,主要包括接口请求日志和系统运行日志,并支持打包和下载日志文件。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/logger", diff --git a/packages/plugins/@nocobase/plugin-map/package.json b/packages/plugins/@nocobase/plugin-map/package.json index b271a1d39..8e29b18d8 100644 --- a/packages/plugins/@nocobase/plugin-map/package.json +++ b/packages/plugins/@nocobase/plugin-map/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-map", "displayName": "Block: Map", "displayName.zh-CN": "区块:地图", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "Map block, support Gaode map and Google map, you can also extend more map types.", "description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。", "license": "AGPL-3.0", diff --git a/packages/plugins/@nocobase/plugin-math-formula-field/package.json b/packages/plugins/@nocobase/plugin-math-formula-field/package.json index 84d200a82..1f67b4572 100644 --- a/packages/plugins/@nocobase/plugin-math-formula-field/package.json +++ b/packages/plugins/@nocobase/plugin-math-formula-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数学公式字段", "description": "A powerful mathematical formula field plugin designed to provide flexible mathematical and formula calculation capabilities for databases or data management systems. It seamlessly integrates with various database systems such as MySQL, PostgreSQL, and offers an intuitive user interface for defining and executing mathematical formula fields.", "description.zh-CN": "一个功能强大的数学公式字段插件,旨在为数据库或数据管理系统提供灵活的数学计算和公式计算功能。它可以与各种数据库系统(如MySQL、PostgreSQL)无缝集成,并提供直观的用户界面来定义和执行数学公式字段。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-mobile-client/package.json b/packages/plugins/@nocobase/plugin-mobile-client/package.json index 34141d4a1..551cab72b 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/package.json +++ b/packages/plugins/@nocobase/plugin-mobile-client/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-mobile-client", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/mobile-client", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile-client", diff --git a/packages/plugins/@nocobase/plugin-mock-collections/package.json b/packages/plugins/@nocobase/plugin-mock-collections/package.json index 5d7960b71..ec697ff89 100644 --- a/packages/plugins/@nocobase/plugin-mock-collections/package.json +++ b/packages/plugins/@nocobase/plugin-mock-collections/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-mock-collections", "displayName": "mock-collections", "description": "mock-collections", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "license": "AGPL-3.0", "peerDependencies": { diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json index 5a537fbd0..f1d477c1f 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "多应用管理器", "description": "Dynamically create multiple apps without separate deployments.", "description.zh-CN": "无需单独部署即可动态创建多个应用。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/multi-app-manager", diff --git a/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json b/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json index e85351908..d851c768e 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json +++ b/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "多应用数据表共享", "description": "", "description.zh-CN": "", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "devDependencies": { "@formily/react": "2.x", diff --git a/packages/plugins/@nocobase/plugin-notifications/package.json b/packages/plugins/@nocobase/plugin-notifications/package.json index a11047e4e..50611a408 100644 --- a/packages/plugins/@nocobase/plugin-notifications/package.json +++ b/packages/plugins/@nocobase/plugin-notifications/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-notifications", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "description": "", "license": "AGPL-3.0", "main": "./dist/server/index.js", diff --git a/packages/plugins/@nocobase/plugin-oidc/package.json b/packages/plugins/@nocobase/plugin-oidc/package.json index 677d8d1c5..887060f3a 100644 --- a/packages/plugins/@nocobase/plugin-oidc/package.json +++ b/packages/plugins/@nocobase/plugin-oidc/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:OIDC", "description": "OIDC (OpenID Connect) authentication.", "description.zh-CN": "通过 OIDC (OpenID Connect) 协议认证身份。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-oidc", diff --git a/packages/plugins/@nocobase/plugin-saml/package.json b/packages/plugins/@nocobase/plugin-saml/package.json index 7b5516e78..a38fff2ad 100644 --- a/packages/plugins/@nocobase/plugin-saml/package.json +++ b/packages/plugins/@nocobase/plugin-saml/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:SAML 2.0", "description": "SAML 2.0 authentication.", "description.zh-CN": "通过 SAML 2.0 协议认证身份。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-saml", diff --git a/packages/plugins/@nocobase/plugin-sample-hello/package.json b/packages/plugins/@nocobase/plugin-sample-hello/package.json index 3374a9012..466ef0830 100644 --- a/packages/plugins/@nocobase/plugin-sample-hello/package.json +++ b/packages/plugins/@nocobase/plugin-sample-hello/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-sample-hello", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "displayName": "Hello", "displayName.zh-CN": "Hello", diff --git a/packages/plugins/@nocobase/plugin-sequence-field/package.json b/packages/plugins/@nocobase/plugin-sequence-field/package.json index a428a2d48..bf8122cc9 100644 --- a/packages/plugins/@nocobase/plugin-sequence-field/package.json +++ b/packages/plugins/@nocobase/plugin-sequence-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:自动编码", "description": "Automatically generate codes based on configured rules, supporting combinations of dates, numbers, and text.", "description.zh-CN": "根据配置的规则自动生成编码,支持日期、数字、文本的组合。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-sequence", diff --git a/packages/plugins/@nocobase/plugin-sms-auth/package.json b/packages/plugins/@nocobase/plugin-sms-auth/package.json index 8c5d87bc4..6cc89e878 100644 --- a/packages/plugins/@nocobase/plugin-sms-auth/package.json +++ b/packages/plugins/@nocobase/plugin-sms-auth/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:短信", "description": "SMS authentication.", "description.zh-CN": "通过短信验证码认证身份。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-sms", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth-sms", diff --git a/packages/plugins/@nocobase/plugin-snapshot-field/package.json b/packages/plugins/@nocobase/plugin-snapshot-field/package.json index e7e0c591a..6318777a7 100644 --- a/packages/plugins/@nocobase/plugin-snapshot-field/package.json +++ b/packages/plugins/@nocobase/plugin-snapshot-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:关系快照", "description": "When adding a new record, create a snapshot for its relational record and save in the new record. The snapshot will not be updated when the relational record is updated.", "description.zh-CN": "在添加数据时,为它的关系数据创建快照,并保存在当前的数据中。关系数据更新时,快照不会更新。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-snapshot", diff --git a/packages/plugins/@nocobase/plugin-system-settings/package.json b/packages/plugins/@nocobase/plugin-system-settings/package.json index efc4f12c2..39f903ec6 100644 --- a/packages/plugins/@nocobase/plugin-system-settings/package.json +++ b/packages/plugins/@nocobase/plugin-system-settings/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "系统设置", "description": "Used to adjust the system title, logo, language, etc.", "description.zh-CN": "用于调整系统的标题、LOGO、语言等。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/system-settings", diff --git a/packages/plugins/@nocobase/plugin-theme-editor/package.json b/packages/plugins/@nocobase/plugin-theme-editor/package.json index e3b1bb052..998bb8140 100644 --- a/packages/plugins/@nocobase/plugin-theme-editor/package.json +++ b/packages/plugins/@nocobase/plugin-theme-editor/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-theme-editor", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/theme-editor", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/theme-editor", diff --git a/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json b/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json index 885a991ee..eca94a334 100644 --- a/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json +++ b/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "路由管理", "description": "manage the routes of nocobase", "description.zh-CN": "管理页面路由。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json b/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json index fa2148684..9bc20a71e 100644 --- a/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json +++ b/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "UI schema 存储服务", "description": "Provides centralized UI schema storage service.", "description.zh-CN": "提供中心化的 UI schema 存储服务。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/ui-schema-storage", diff --git a/packages/plugins/@nocobase/plugin-users/package.json b/packages/plugins/@nocobase/plugin-users/package.json index 7c59cdea6..78ed95530 100644 --- a/packages/plugins/@nocobase/plugin-users/package.json +++ b/packages/plugins/@nocobase/plugin-users/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "用户", "description": "Provides basic user model, as well as created by and updated by fields.", "description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/users", diff --git a/packages/plugins/@nocobase/plugin-verification/package.json b/packages/plugins/@nocobase/plugin-verification/package.json index a1abc3b86..a2be45da8 100644 --- a/packages/plugins/@nocobase/plugin-verification/package.json +++ b/packages/plugins/@nocobase/plugin-verification/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "验证码", "description": "verification setting.", "description.zh-CN": "验证码配置。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/verification", diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json b/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json index 608d9c969..66ef9d5bf 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:数据操作触发器", "description": "Bind action buttons to trigger workflow events when clicked.", "description.zh-CN": "可对数据操作按钮绑定,在点击后触发对应的工作流事件。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/plugins/workflow-action-trigger", diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/ActionTrigger.ts b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/ActionTrigger.ts index 49df2c69a..d05b49876 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/ActionTrigger.ts +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/ActionTrigger.ts @@ -1,9 +1,14 @@ import { get } from 'lodash'; import { BelongsTo, HasOne } from 'sequelize'; import { Model, modelAssociationByKey } from '@nocobase/database'; +import { DefaultContext } from '@nocobase/server'; +import { ActionContext } from '@nocobase/resourcer'; +import { Next } from '@nocobase/actions'; import WorkflowPlugin, { Trigger, WorkflowModel, toJSON } from '@nocobase/plugin-workflow'; +interface Context extends ActionContext, DefaultContext {} + export default class extends Trigger { constructor(workflow: WorkflowPlugin) { super(workflow); @@ -11,7 +16,7 @@ export default class extends Trigger { workflow.app.resourcer.use(this.middleware); } - async triggerAction(context, next) { + async triggerAction(context: Context, next: Next) { const { triggerWorkflows } = context.action.params; if (!triggerWorkflows) { @@ -24,7 +29,7 @@ export default class extends Trigger { this.trigger(context); } - middleware = async (context, next) => { + middleware = async (context: Context, next: Next) => { const { resourceName, actionName, @@ -48,7 +53,7 @@ export default class extends Trigger { return this.trigger(context); }; - private async trigger(context) { + private async trigger(context: Context) { const { triggerWorkflows = '', values } = context.action.params; const { currentUser, currentRole } = context.state; @@ -59,17 +64,20 @@ export default class extends Trigger { const triggers = triggerWorkflows.split(',').map((trigger) => trigger.split('!')); const workflowRepo = this.workflow.db.getRepository('workflows'); - const workflows = await workflowRepo.find({ - filter: { - key: triggers.map((trigger) => trigger[0]), - current: true, - type: 'action', - enabled: true, - }, - }); + const workflows = ( + await workflowRepo.find({ + filter: { + key: triggers.map((trigger) => trigger[0]), + current: true, + type: 'action', + enabled: true, + }, + }) + ).filter((workflow) => Boolean(workflow.config.collection)); const syncGroup = []; const asyncGroup = []; for (const workflow of workflows) { + const { collection, appends = [] } = workflow.config; const trigger = triggers.find((trigger) => trigger[0] == workflow.key); const event = [workflow]; if (context.action.resourceName !== 'workflows') { @@ -90,7 +98,6 @@ export default class extends Trigger { } } } - const { collection, appends = [] } = workflow.config; const model = payload.constructor; if (payload instanceof Model) { if (collection !== model.collection.name) { @@ -107,7 +114,15 @@ export default class extends Trigger { event.push({ data: toJSON(payload), ...userInfo }); } } else { - const data = trigger[1] ? get(values, trigger[1]) : values; + const { model, repository } = context.db.getCollection(collection); + let data = trigger[1] ? get(values, trigger[1]) : values; + const pk = get(data, model.primaryKeyAttribute); + if (appends.length && pk != null) { + data = await repository.findOne({ + filterByTk: pk, + appends, + }); + } // this.workflow.trigger(workflow, { // data, // ...userInfo, diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/__tests__/trigger.test.ts b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/__tests__/trigger.test.ts index 90f8db997..d30cc936a 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/__tests__/trigger.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/__tests__/trigger.test.ts @@ -214,6 +214,7 @@ describe('workflow > action-trigger', () => { type: 'action', config: { collection: 'posts', + appends: ['createdBy'], }, }); @@ -238,6 +239,7 @@ describe('workflow > action-trigger', () => { const [e2] = await workflow.getExecutions(); expect(e2.status).toBe(EXECUTION_STATUS.RESOLVED); expect(e2.context.data).toHaveProperty('title', 't2'); + expect(e2.context.data).toHaveProperty('createdBy'); }); }); @@ -281,7 +283,7 @@ describe('workflow > action-trigger', () => { }); describe('directly trigger', () => { - it('trigger data', async () => { + it('no collection configured should not be triggered', async () => { const workflow = await WorkflowModel.create({ enabled: true, type: 'action', @@ -295,20 +297,78 @@ describe('workflow > action-trigger', () => { await sleep(500); + const e1s = await workflow.getExecutions(); + expect(e1s.length).toBe(0); + }); + + it('trigger on form data', async () => { + const workflow = await WorkflowModel.create({ + enabled: true, + type: 'action', + config: { + collection: 'posts', + appends: ['createdBy'], + }, + }); + + const res1 = await userAgents[0].resource('workflows').trigger({ + values: { title: 't1' }, + triggerWorkflows: `${workflow.key}`, + }); + expect(res1.status).toBe(202); + + await sleep(500); + const [e1] = await workflow.getExecutions(); expect(e1.status).toBe(EXECUTION_STATUS.RESOLVED); expect(e1.context.data).toMatchObject({ title: 't1' }); + expect(e1.context.data.createdBy).toBeUndefined(); + }); + + it('trigger on record data', async () => { + const workflow = await WorkflowModel.create({ + enabled: true, + type: 'action', + config: { + collection: 'posts', + appends: ['createdBy'], + }, + }); + + const post = await PostRepo.create({ + values: { title: 't1', createdBy: users[0].id }, + }); + + const res1 = await userAgents[0].resource('workflows').trigger({ + values: post.toJSON(), + triggerWorkflows: `${workflow.key}`, + }); + expect(res1.status).toBe(202); + + await sleep(500); + + const [e1] = await workflow.getExecutions(); + expect(e1.status).toBe(EXECUTION_STATUS.RESOLVED); + expect(e1.context.data).toMatchObject({ title: 't1' }); + expect(e1.context.data).toHaveProperty('createdBy'); + expect(e1.context.data.createdBy.id).toBe(users[0].id); }); it('multi trigger', async () => { const w1 = await WorkflowModel.create({ enabled: true, type: 'action', + config: { + collection: 'posts', + }, }); const w2 = await WorkflowModel.create({ enabled: true, type: 'action', + config: { + collection: 'posts', + }, }); const res1 = await userAgents[0].resource('workflows').trigger({ @@ -358,6 +418,9 @@ describe('workflow > action-trigger', () => { const workflow = await WorkflowModel.create({ enabled: true, type: 'action', + config: { + collection: 'posts', + }, }); const res1 = await userAgents[0].resource('workflows').trigger({ @@ -377,6 +440,9 @@ describe('workflow > action-trigger', () => { const workflow = await WorkflowModel.create({ enabled: true, type: 'action', + config: { + collection: 'posts', + }, }); const res1 = await userAgents[0].resource('workflows').trigger({ @@ -398,6 +464,9 @@ describe('workflow > action-trigger', () => { const w1 = await WorkflowModel.create({ enabled: true, type: 'action', + config: { + collection: 'posts', + }, }); const res1 = await userAgents[0].resource('workflows').trigger({ diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/migrations/20240227172623-change-name.ts b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/migrations/20240307215012-change-name.ts similarity index 93% rename from packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/migrations/20240227172623-change-name.ts rename to packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/migrations/20240307215012-change-name.ts index b22e508ca..51251ce36 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/migrations/20240227172623-change-name.ts +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/server/migrations/20240307215012-change-name.ts @@ -1,7 +1,7 @@ import { Migration } from '@nocobase/server'; export default class extends Migration { - appVersion = '<0.20.0-alpha.6'; + appVersion = '<0.20.0-alpha.7'; on = 'afterSync'; async up() { const { db } = this.context; diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json index bff0f4e77..0a1f61bb5 100644 --- a/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:聚合查询节点", "description": "Used to aggregate data against the database in workflow, such as: statistics, sum, average, etc.", "description.zh-CN": "可用于在工作流中对数据库进行聚合查询,如:统计数量、求和、平均值等。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-aggregate", diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/package.json b/packages/plugins/@nocobase/plugin-workflow-delay/package.json index 26056b5d0..37a245943 100644 --- a/packages/plugins/@nocobase/plugin-workflow-delay/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-delay/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:延时节点", "description": "Could be used in workflow parallel branch for waiting other branches.", "description.zh-CN": "可用于工作流并行分支中等待其他分支执行完成。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-delay", diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json index 0d7e0065e..fc76530ae 100644 --- a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:动态表达式计算节点", "description": "Useful plugin for doing dynamic calculation based on expression collection records in workflow.", "description.zh-CN": "用于在工作流中进行基于数据行的动态表达式计算。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-dynamic-calculation", diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/package.json b/packages/plugins/@nocobase/plugin-workflow-loop/package.json index 8068ae74d..24b11a923 100644 --- a/packages/plugins/@nocobase/plugin-workflow-loop/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-loop/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:循环节点", "description": "Used to repeat the sub-process processing of each value in an array, and can also be used for fixed times of sub-process processing.", "description.zh-CN": "用于对一个数组中的每个值进行重复的子流程处理,也可用于固定次数的重复子流程处理。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-loop", diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/package.json b/packages/plugins/@nocobase/plugin-workflow-manual/package.json index 05dac14ae..f2d43b67e 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-manual/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:人工处理节点", "description": "Could be used for workflows which some of decisions are made by users.", "description.zh-CN": "用于人工控制部分决策的流程。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-manual", diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/package.json b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json index 11e95b7b5..8bf29b209 100644 --- a/packages/plugins/@nocobase/plugin-workflow-parallel/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:并行分支节点", "description": "Could be used for parallel execution of branch processes in the workflow.", "description.zh-CN": "用于在工作流中需要并行执行的分支流程。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-parallel", diff --git a/packages/plugins/@nocobase/plugin-workflow-request/package.json b/packages/plugins/@nocobase/plugin-workflow-request/package.json index 439157b43..4b81b3aed 100644 --- a/packages/plugins/@nocobase/plugin-workflow-request/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-request/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:HTTP 请求节点", "description": "Send HTTP requests to any HTTP service for data interaction in workflow.", "description.zh-CN": "可用于在工作流中向任意 HTTP 服务发送请求,进行数据交互。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-request", diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/package.json b/packages/plugins/@nocobase/plugin-workflow-sql/package.json index 37ff10d24..1212286ae 100644 --- a/packages/plugins/@nocobase/plugin-workflow-sql/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-sql/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:SQL 节点", "description": "Execute SQL statements in workflow.", "description.zh-CN": "可用于在工作流中对数据库执行任意 SQL 语句。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-sql", diff --git a/packages/plugins/@nocobase/plugin-workflow-test/package.json b/packages/plugins/@nocobase/plugin-workflow-test/package.json index c470e5f6e..c6418b747 100644 --- a/packages/plugins/@nocobase/plugin-workflow-test/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-test/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-workflow-test", "displayName": "Workflow: test kit", "displayName.zh-CN": "工作流:测试工具包", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "dist/server/index.js", "types": "./dist/server/index.d.ts", diff --git a/packages/plugins/@nocobase/plugin-workflow/package.json b/packages/plugins/@nocobase/plugin-workflow/package.json index 74ace582e..9e00580f4 100644 --- a/packages/plugins/@nocobase/plugin-workflow/package.json +++ b/packages/plugins/@nocobase/plugin-workflow/package.json @@ -4,13 +4,13 @@ "displayName.zh-CN": "工作流", "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.", "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow", "dependencies": { - "@nocobase/plugin-workflow-test": "0.20.0-alpha.5" + "@nocobase/plugin-workflow-test": "0.20.0-alpha.7" }, "devDependencies": { "@ant-design/icons": "5.x", diff --git a/packages/presets/nocobase/package.json b/packages/presets/nocobase/package.json index 657f00a47..e5e5e7ec2 100644 --- a/packages/presets/nocobase/package.json +++ b/packages/presets/nocobase/package.json @@ -1,66 +1,66 @@ { "name": "@nocobase/preset-nocobase", - "version": "0.20.0-alpha.5", + "version": "0.20.0-alpha.7", "license": "AGPL-3.0", "main": "./lib/server/index.js", "dependencies": { "@formily/json-schema": "2.x", - "@nocobase/plugin-acl": "0.20.0-alpha.5", - "@nocobase/plugin-action-bulk-edit": "0.20.0-alpha.5", - "@nocobase/plugin-action-bulk-update": "0.20.0-alpha.5", - "@nocobase/plugin-action-duplicate": "0.20.0-alpha.5", - "@nocobase/plugin-action-print": "0.20.0-alpha.5", - "@nocobase/plugin-api-doc": "0.20.0-alpha.5", - "@nocobase/plugin-api-keys": "0.20.0-alpha.5", - "@nocobase/plugin-audit-logs": "0.20.0-alpha.5", - "@nocobase/plugin-auth": "0.20.0-alpha.5", - "@nocobase/plugin-backup-restore": "0.20.0-alpha.5", - "@nocobase/plugin-calendar": "0.20.0-alpha.5", - "@nocobase/plugin-cas": "0.20.0-alpha.5", - "@nocobase/plugin-charts": "0.20.0-alpha.5", - "@nocobase/plugin-china-region": "0.20.0-alpha.5", - "@nocobase/plugin-client": "0.20.0-alpha.5", - "@nocobase/plugin-collection-manager": "0.20.0-alpha.5", - "@nocobase/plugin-custom-request": "0.20.0-alpha.5", - "@nocobase/plugin-data-source-manager": "0.20.0-alpha.5", - "@nocobase/plugin-data-visualization": "0.20.0-alpha.5", - "@nocobase/plugin-error-handler": "0.20.0-alpha.5", - "@nocobase/plugin-export": "0.20.0-alpha.5", - "@nocobase/plugin-file-manager": "0.20.0-alpha.5", - "@nocobase/plugin-formula-field": "0.20.0-alpha.5", - "@nocobase/plugin-gantt": "0.20.0-alpha.5", - "@nocobase/plugin-graph-collection-manager": "0.20.0-alpha.5", - "@nocobase/plugin-iframe-block": "0.20.0-alpha.5", - "@nocobase/plugin-import": "0.20.0-alpha.5", - "@nocobase/plugin-kanban": "0.20.0-alpha.5", - "@nocobase/plugin-localization-management": "0.20.0-alpha.5", - "@nocobase/plugin-logger": "0.20.0-alpha.5", - "@nocobase/plugin-map": "0.20.0-alpha.5", - "@nocobase/plugin-mobile-client": "0.20.0-alpha.5", - "@nocobase/plugin-mock-collections": "0.20.0-alpha.5", - "@nocobase/plugin-multi-app-manager": "0.20.0-alpha.5", - "@nocobase/plugin-multi-app-share-collection": "0.20.0-alpha.5", - "@nocobase/plugin-oidc": "0.20.0-alpha.5", - "@nocobase/plugin-saml": "0.20.0-alpha.5", - "@nocobase/plugin-sequence-field": "0.20.0-alpha.5", - "@nocobase/plugin-sms-auth": "0.20.0-alpha.5", - "@nocobase/plugin-snapshot-field": "0.20.0-alpha.5", - "@nocobase/plugin-system-settings": "0.20.0-alpha.5", - "@nocobase/plugin-theme-editor": "0.20.0-alpha.5", - "@nocobase/plugin-ui-schema-storage": "0.20.0-alpha.5", - "@nocobase/plugin-users": "0.20.0-alpha.5", - "@nocobase/plugin-verification": "0.20.0-alpha.5", - "@nocobase/plugin-workflow": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-action-trigger": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-aggregate": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-delay": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-dynamic-calculation": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-loop": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-manual": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-parallel": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-request": "0.20.0-alpha.5", - "@nocobase/plugin-workflow-sql": "0.20.0-alpha.5", - "@nocobase/server": "0.20.0-alpha.5", + "@nocobase/plugin-acl": "0.20.0-alpha.7", + "@nocobase/plugin-action-bulk-edit": "0.20.0-alpha.7", + "@nocobase/plugin-action-bulk-update": "0.20.0-alpha.7", + "@nocobase/plugin-action-duplicate": "0.20.0-alpha.7", + "@nocobase/plugin-action-print": "0.20.0-alpha.7", + "@nocobase/plugin-api-doc": "0.20.0-alpha.7", + "@nocobase/plugin-api-keys": "0.20.0-alpha.7", + "@nocobase/plugin-audit-logs": "0.20.0-alpha.7", + "@nocobase/plugin-auth": "0.20.0-alpha.7", + "@nocobase/plugin-backup-restore": "0.20.0-alpha.7", + "@nocobase/plugin-calendar": "0.20.0-alpha.7", + "@nocobase/plugin-cas": "0.20.0-alpha.7", + "@nocobase/plugin-charts": "0.20.0-alpha.7", + "@nocobase/plugin-china-region": "0.20.0-alpha.7", + "@nocobase/plugin-client": "0.20.0-alpha.7", + "@nocobase/plugin-collection-manager": "0.20.0-alpha.7", + "@nocobase/plugin-custom-request": "0.20.0-alpha.7", + "@nocobase/plugin-data-source-manager": "0.20.0-alpha.7", + "@nocobase/plugin-data-visualization": "0.20.0-alpha.7", + "@nocobase/plugin-error-handler": "0.20.0-alpha.7", + "@nocobase/plugin-export": "0.20.0-alpha.7", + "@nocobase/plugin-file-manager": "0.20.0-alpha.7", + "@nocobase/plugin-formula-field": "0.20.0-alpha.7", + "@nocobase/plugin-gantt": "0.20.0-alpha.7", + "@nocobase/plugin-graph-collection-manager": "0.20.0-alpha.7", + "@nocobase/plugin-iframe-block": "0.20.0-alpha.7", + "@nocobase/plugin-import": "0.20.0-alpha.7", + "@nocobase/plugin-kanban": "0.20.0-alpha.7", + "@nocobase/plugin-localization-management": "0.20.0-alpha.7", + "@nocobase/plugin-logger": "0.20.0-alpha.7", + "@nocobase/plugin-map": "0.20.0-alpha.7", + "@nocobase/plugin-mobile-client": "0.20.0-alpha.7", + "@nocobase/plugin-mock-collections": "0.20.0-alpha.7", + "@nocobase/plugin-multi-app-manager": "0.20.0-alpha.7", + "@nocobase/plugin-multi-app-share-collection": "0.20.0-alpha.7", + "@nocobase/plugin-oidc": "0.20.0-alpha.7", + "@nocobase/plugin-saml": "0.20.0-alpha.7", + "@nocobase/plugin-sequence-field": "0.20.0-alpha.7", + "@nocobase/plugin-sms-auth": "0.20.0-alpha.7", + "@nocobase/plugin-snapshot-field": "0.20.0-alpha.7", + "@nocobase/plugin-system-settings": "0.20.0-alpha.7", + "@nocobase/plugin-theme-editor": "0.20.0-alpha.7", + "@nocobase/plugin-ui-schema-storage": "0.20.0-alpha.7", + "@nocobase/plugin-users": "0.20.0-alpha.7", + "@nocobase/plugin-verification": "0.20.0-alpha.7", + "@nocobase/plugin-workflow": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-action-trigger": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-aggregate": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-delay": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-dynamic-calculation": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-loop": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-manual": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-parallel": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-request": "0.20.0-alpha.7", + "@nocobase/plugin-workflow-sql": "0.20.0-alpha.7", + "@nocobase/server": "0.20.0-alpha.7", "cronstrue": "^2.11.0" }, "repository": { diff --git a/packages/presets/nocobase/src/server/migrations/20240227172623-change-name.ts b/packages/presets/nocobase/src/server/migrations/20240307214623-change-name.ts similarity index 89% rename from packages/presets/nocobase/src/server/migrations/20240227172623-change-name.ts rename to packages/presets/nocobase/src/server/migrations/20240307214623-change-name.ts index 7ed0bc992..83ddb9bb3 100644 --- a/packages/presets/nocobase/src/server/migrations/20240227172623-change-name.ts +++ b/packages/presets/nocobase/src/server/migrations/20240307214623-change-name.ts @@ -2,7 +2,7 @@ import { Migration } from '@nocobase/server'; export default class extends Migration { on = 'beforeLoad'; // 'beforeLoad' or 'afterLoad' - appVersion = '<0.20.0-alpha.6'; + appVersion = '<0.20.0-alpha.7'; async up() { await this.pm.repository.destroy({ diff --git a/yarn.lock b/yarn.lock index 858a205fd..838589fc8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19166,7 +19166,7 @@ node-releases@^2.0.14: node-sql-parser@^4.11.0: version "4.18.0" - resolved "https://registry.npmjs.org/node-sql-parser/-/node-sql-parser-4.18.0.tgz#516b6e633c55c5abbba1ca588ab372db81ae9318" + resolved "https://registry.npmmirror.com/node-sql-parser/-/node-sql-parser-4.18.0.tgz#516b6e633c55c5abbba1ca588ab372db81ae9318" integrity sha512-2YEOR5qlI1zUFbGMLKNfsrR5JUvFg9LxIRVE+xJe962pfVLH0rnItqLzv96XVs1Y1UIR8FxsXAuvX/lYAWZ2BQ== dependencies: big-integer "^1.6.48"