@tachybase/module-hera 1.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +11 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/components/PDFViewer.d.ts +11 -0
- package/dist/client/components/SignatureInput.d.ts +2 -0
- package/dist/client/components/SignaturePad.d.ts +240 -0
- package/dist/client/components/custom-components/CustomAssociatedField.d.ts +2 -0
- package/dist/client/components/custom-components/CustomComponentDispatcher.d.ts +5 -0
- package/dist/client/components/custom-components/CustomField.d.ts +2 -0
- package/dist/client/components/custom-components/ErrorBoundary.d.ts +2 -0
- package/dist/client/components/custom-components/custom-components.d.ts +21 -0
- package/dist/client/components/excel-table/ExcelFile.d.ts +2 -0
- package/dist/client/components/excel-table/Sheet.d.ts +10 -0
- package/dist/client/components/fields/AssociatedField.d.ts +7 -0
- package/dist/client/components/fields/CalcResult.d.ts +1 -0
- package/dist/client/components/fields/Expression.d.ts +3 -0
- package/dist/client/components/index.d.ts +11 -0
- package/dist/client/components/modal-full-screen/ModalFullScreen.d.ts +15 -0
- package/dist/client/components/modal-full-screen/ModalFullScreenChild.d.ts +2 -0
- package/dist/client/features/block-group/GroupBlock.d.ts +4 -0
- package/dist/client/features/block-group/GroupBlockConfigure.d.ts +19 -0
- package/dist/client/features/block-group/GroupBlockInitializer.d.ts +9 -0
- package/dist/client/features/block-group/index.d.ts +4 -0
- package/dist/client/features/custom-components/index.d.ts +5 -0
- package/dist/client/features/departments/common/DepartmentTable.schema.d.ts +50 -0
- package/dist/client/features/departments/common/DepartmentTable.view.d.ts +5 -0
- package/dist/client/features/departments/common/FilterKeys.context.d.ts +10 -0
- package/dist/client/features/departments/common/InternalDepartmentTable.d.ts +6 -0
- package/dist/client/features/departments/common/Request.povider.d.ts +2 -0
- package/dist/client/features/departments/common/UserDepartmentsFieldNotSupport.d.ts +2 -0
- package/dist/client/features/departments/common/scopes/useDepartmentFilterActionProps.d.ts +5 -0
- package/dist/client/features/departments/common/scopes/useFilterActionProps.d.ts +5 -0
- package/dist/client/features/departments/index.d.ts +5 -0
- package/dist/client/features/departments/main-tab/DepartmentIndex.d.ts +6 -0
- package/dist/client/features/departments/main-tab/DepartmentIndex.provider.d.ts +4 -0
- package/dist/client/features/departments/main-tab/DepartmentManagement.component.d.ts +2 -0
- package/dist/client/features/departments/main-tab/DepartmentManagement.schema.d.ts +10 -0
- package/dist/client/features/departments/main-tab/DepartmentManagement.view.d.ts +2 -0
- package/dist/client/features/departments/main-tab/collections/departments.collection.d.ts +128 -0
- package/dist/client/features/departments/main-tab/collections/users.collection.d.ts +189 -0
- package/dist/client/features/departments/main-tab/components/DepartmentSelect.d.ts +2 -0
- package/dist/client/features/departments/main-tab/components/InternalSuperiorDepartmentSelect.d.ts +2 -0
- package/dist/client/features/departments/main-tab/components/SuperiorDepartmentSelect.d.ts +2 -0
- package/dist/client/features/departments/main-tab/context/Department.context.d.ts +23 -0
- package/dist/client/features/departments/main-tab/context/DepartmentsExpanded.context.d.ts +17 -0
- package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.schema.d.ts +67 -0
- package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.view.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-block/DepartmentOwnersField.component.d.ts +6 -0
- package/dist/client/features/departments/main-tab/departments-block/DepartmentsBlock.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-block/DepartmentsSearch.component.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-block/DepartmentsTree.component.d.ts +9 -0
- package/dist/client/features/departments/main-tab/departments-block/Request.provider.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.schema.d.ts +136 -0
- package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.view.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentEdit.d.ts +62 -0
- package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentNewSub.d.ts +57 -0
- package/dist/client/features/departments/main-tab/departments-block/scopes/useCreateDepartment.d.ts +3 -0
- package/dist/client/features/departments/main-tab/departments-block/scopes/useUpdateDepartment.d.ts +3 -0
- package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.schema.d.ts +148 -0
- package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.view.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/DepartmentField.component.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.schema.d.ts +676 -0
- package/dist/client/features/departments/main-tab/departments-users-block/IsOwnerField.component.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.schema.d.ts +49 -0
- package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.view.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.schema.d.ts +16 -0
- package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.view.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/UserDepartmentsField.component.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.schema.d.ts +42 -0
- package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.view.d.ts +2 -0
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useBulkRemoveMembersAction.d.ts +3 -0
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useDataSource.d.ts +40 -0
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useMembersDataSource.d.ts +6 -0
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/usePropsAddMember.d.ts +1 -0
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRefreshActionProps.d.ts +3 -0
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRemoveMemberAction.d.ts +3 -0
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useShowTotal.d.ts +1 -0
- package/dist/client/features/departments/main-tab/hooks/useDeepTree.d.ts +14 -0
- package/dist/client/features/departments/main-tab/hooks/useGetDepTree.d.ts +18 -0
- package/dist/client/features/departments/main-tab/kit.d.ts +4 -0
- package/dist/client/features/departments/main-tab/providers/DepartmentsResource.provider.d.ts +4 -0
- package/dist/client/features/departments/main-tab/providers/UserResource.provider.d.ts +4 -0
- package/dist/client/features/departments/role-auth/DepartmentTitle.component.d.ts +2 -0
- package/dist/client/features/departments/role-auth/Departments.d.ts +2 -0
- package/dist/client/features/departments/role-auth/Departments.schema.d.ts +227 -0
- package/dist/client/features/departments/role-auth/kit.d.ts +4 -0
- package/dist/client/features/departments/role-auth/scopes/useAddDepartments.d.ts +3 -0
- package/dist/client/features/departments/role-auth/scopes/useBulkRemoveDepartments.d.ts +3 -0
- package/dist/client/features/departments/role-auth/scopes/useDataSource.d.ts +40 -0
- package/dist/client/features/departments/role-auth/scopes/useDisabled.d.ts +3 -0
- package/dist/client/features/departments/role-auth/scopes/useRemoveDepartment.d.ts +3 -0
- package/dist/client/features/departments/settings/DepartmentOwnersFieldSetting.d.ts +2 -0
- package/dist/client/features/departments/settings/UserDepartmentsFieldSetting.d.ts +2 -0
- package/dist/client/features/departments/settings/UserMainDepartmentFieldSetting.d.ts +2 -0
- package/dist/client/features/departments/settings/items/enableLinkItem.d.ts +2 -0
- package/dist/client/features/departments/settings/items/modeSelectItem.d.ts +2 -0
- package/dist/client/features/departments/settings/items/titleFieldItem.d.ts +2 -0
- package/dist/client/features/departments/utils/getDepartmentStr.d.ts +1 -0
- package/dist/client/features/departments/utils/getUserListByDepartment.d.ts +1 -0
- package/dist/client/features/embed/EmbedLayout.d.ts +2 -0
- package/dist/client/features/embed/EmbedPage.d.ts +2 -0
- package/dist/client/features/embed/EmbedSchemaComponent.d.ts +2 -0
- package/dist/client/features/embed/NotAuthorityResult.d.ts +2 -0
- package/dist/client/features/embed/index.d.ts +4 -0
- package/dist/client/features/embed/useEmbedToken.d.ts +1 -0
- package/dist/client/features/embed/usePageSettingsProps.d.ts +4 -0
- package/dist/client/features/field-appends/index.d.ts +4 -0
- package/dist/client/features/field-appends/show-code/Code.interface.d.ts +74 -0
- package/dist/client/features/field-appends/show-code/Code.view.d.ts +3 -0
- package/dist/client/features/field-appends/show-formula/Formula.interface.d.ts +75 -0
- package/dist/client/features/field-appends/show-formula/Formula.view.d.ts +3 -0
- package/dist/client/features/hera-version/HeraVersion.provider.d.ts +4 -0
- package/dist/client/features/hera-version/index.d.ts +4 -0
- package/dist/client/features/mode-highlight/ModeHighlight.provider.d.ts +4 -0
- package/dist/client/features/mode-highlight/index.d.ts +4 -0
- package/dist/client/features/outbound/OutboundLinkActionInitializer.d.ts +6 -0
- package/dist/client/features/outbound/OutboundPage.d.ts +2 -0
- package/dist/client/features/outbound/index.d.ts +4 -0
- package/dist/client/features/outbound/useOutboundActionProps.d.ts +3 -0
- package/dist/client/features/pdf/PDFVIewerBlockInitializer.d.ts +10 -0
- package/dist/client/features/pdf/PDFViewer.d.ts +2 -0
- package/dist/client/features/pdf/index.d.ts +4 -0
- package/dist/client/features/sheet/SheetBlockInitializer.d.ts +8 -0
- package/dist/client/features/sheet/index.d.ts +4 -0
- package/dist/client/hooks/useCustomComponent.d.ts +5 -0
- package/dist/client/hooks/useGetCustomAssociatedComponents.d.ts +4 -0
- package/dist/client/hooks/useGetCustomComponents.d.ts +4 -0
- package/dist/client/hooks/useNotifications.d.ts +2 -0
- package/dist/client/hooks/usePluginVersion.d.ts +1 -0
- package/dist/client/hooks/useTokenConfiguration.d.ts +3 -0
- package/dist/client/index.d.ts +16 -0
- package/dist/client/index.js +93 -0
- package/dist/client/interfaces/AssociatedFieldInterface.d.ts +118 -0
- package/dist/client/interfaces/CalcFieldInterface.d.ts +120 -0
- package/dist/client/interfaces/CustomAssociatedFieldInterface.d.ts +69 -0
- package/dist/client/interfaces/CustomFieldInterface.d.ts +45 -0
- package/dist/client/interfaces/ExcelFieldInterface.d.ts +38 -0
- package/dist/client/interfaces/SignaturePadFieldInterface.d.ts +38 -0
- package/dist/client/interfaces/TstzrangeFieldInterface.d.ts +41 -0
- package/dist/client/interfaces/index.d.ts +6 -0
- package/dist/client/locale.d.ts +9 -0
- package/dist/client/schema-initializer/blocks/SettingBlockInitializer.d.ts +2 -0
- package/dist/client/schema-initializer/index.d.ts +1 -0
- package/dist/client/schema-settings/SchemaSettingsDatePickerType.d.ts +2 -0
- package/dist/client/schema-settings/SchemaSettingsDatePresets.d.ts +11 -0
- package/dist/client/schema-settings/SchemaSettingsSubmitDataType.d.ts +5 -0
- package/dist/client/schema-settings/index.d.ts +4 -0
- package/dist/client/settings-manager-components/LinkManager.d.ts +2 -0
- package/dist/client/settings-manager-components/TokenConfiguration.d.ts +6 -0
- package/dist/client/settings-manager-components/index.d.ts +8 -0
- package/dist/client/utils.d.ts +2 -0
- package/dist/externalVersion.js +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +94 -0
- package/dist/locale/zh-CN.json +94 -0
- package/dist/node_modules/fs-extra/LICENSE +15 -0
- package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
- package/dist/node_modules/fs-extra/lib/copy/copy.js +177 -0
- package/dist/node_modules/fs-extra/lib/copy/index.js +7 -0
- package/dist/node_modules/fs-extra/lib/empty/index.js +39 -0
- package/dist/node_modules/fs-extra/lib/ensure/file.js +66 -0
- package/dist/node_modules/fs-extra/lib/ensure/index.js +23 -0
- package/dist/node_modules/fs-extra/lib/ensure/link.js +64 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +101 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +34 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink.js +67 -0
- package/dist/node_modules/fs-extra/lib/fs/index.js +140 -0
- package/dist/node_modules/fs-extra/lib/index.js +1 -0
- package/dist/node_modules/fs-extra/lib/json/index.js +16 -0
- package/dist/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
- package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
- package/dist/node_modules/fs-extra/lib/json/output-json.js +12 -0
- package/dist/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
- package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
- package/dist/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
- package/dist/node_modules/fs-extra/lib/move/index.js +7 -0
- package/dist/node_modules/fs-extra/lib/move/move-sync.js +55 -0
- package/dist/node_modules/fs-extra/lib/move/move.js +59 -0
- package/dist/node_modules/fs-extra/lib/output-file/index.js +31 -0
- package/dist/node_modules/fs-extra/lib/path-exists/index.js +12 -0
- package/dist/node_modules/fs-extra/lib/remove/index.js +17 -0
- package/dist/node_modules/fs-extra/lib/util/stat.js +158 -0
- package/dist/node_modules/fs-extra/lib/util/utimes.js +36 -0
- package/dist/node_modules/fs-extra/package.json +1 -0
- package/dist/server/actions/departments.d.ts +5 -0
- package/dist/server/actions/departments.js +105 -0
- package/dist/server/actions/index.d.ts +7 -0
- package/dist/server/actions/index.js +33 -0
- package/dist/server/actions/link-manager-controller.d.ts +6 -0
- package/dist/server/actions/link-manager-controller.js +133 -0
- package/dist/server/actions/plugin-version.d.ts +6 -0
- package/dist/server/actions/plugin-version.js +91 -0
- package/dist/server/actions/robot-controller.d.ts +5 -0
- package/dist/server/actions/robot-controller.js +134 -0
- package/dist/server/actions/system-message-controller.d.ts +5 -0
- package/dist/server/actions/system-message-controller.js +106 -0
- package/dist/server/actions/token-configuration-controller.d.ts +5 -0
- package/dist/server/actions/token-configuration-controller.js +120 -0
- package/dist/server/actions/users.d.ts +4 -0
- package/dist/server/actions/users.js +142 -0
- package/dist/server/collections/departmentRoles.d.ts +2 -0
- package/dist/server/collections/departmentRoles.js +27 -0
- package/dist/server/collections/departments.d.ts +29 -0
- package/dist/server/collections/departments.js +162 -0
- package/dist/server/collections/departmentsUsers.d.ts +2 -0
- package/dist/server/collections/departmentsUsers.js +43 -0
- package/dist/server/collections/link-manage.d.ts +2 -0
- package/dist/server/collections/link-manage.js +42 -0
- package/dist/server/collections/roles.d.ts +2 -0
- package/dist/server/collections/roles.js +39 -0
- package/dist/server/collections/systemSettings.d.ts +2 -0
- package/dist/server/collections/systemSettings.js +33 -0
- package/dist/server/collections/system_message.d.ts +2 -0
- package/dist/server/collections/system_message.js +67 -0
- package/dist/server/collections/token-configuration.d.ts +2 -0
- package/dist/server/collections/token-configuration.js +54 -0
- package/dist/server/collections/users.d.ts +55 -0
- package/dist/server/collections/users.js +87 -0
- package/dist/server/features/departments.d.ts +7 -0
- package/dist/server/features/departments.js +132 -0
- package/dist/server/fields/calc.d.ts +11 -0
- package/dist/server/fields/calc.js +43 -0
- package/dist/server/fields/tstzrange.d.ts +7 -0
- package/dist/server/fields/tstzrange.js +28 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +41 -0
- package/dist/server/middlewares/destroy-department-check.d.ts +2 -0
- package/dist/server/middlewares/destroy-department-check.js +53 -0
- package/dist/server/middlewares/index.d.ts +6 -0
- package/dist/server/middlewares/index.js +31 -0
- package/dist/server/middlewares/list-users-include-child-department.d.ts +2 -0
- package/dist/server/middlewares/list-users-include-child-department.js +77 -0
- package/dist/server/middlewares/reset-user-departments-cache.d.ts +2 -0
- package/dist/server/middlewares/reset-user-departments-cache.js +39 -0
- package/dist/server/middlewares/set-department-owners.d.ts +2 -0
- package/dist/server/middlewares/set-department-owners.js +74 -0
- package/dist/server/middlewares/set-departments-roles.d.ts +2 -0
- package/dist/server/middlewares/set-departments-roles.js +64 -0
- package/dist/server/middlewares/set-main-department.d.ts +2 -0
- package/dist/server/middlewares/set-main-department.js +105 -0
- package/dist/server/middlewares/update-department-isleaf.d.ts +2 -0
- package/dist/server/middlewares/update-department-isleaf.js +84 -0
- package/dist/server/models/department.d.ts +4 -0
- package/dist/server/models/department.js +38 -0
- package/dist/server/plugin.d.ts +6 -0
- package/dist/server/plugin.js +111 -0
- package/dist/server/services/plugin-version.d.ts +5 -0
- package/dist/server/services/plugin-version.js +89 -0
- package/dist/server/services/sql-loader.d.ts +10 -0
- package/dist/server/services/sql-loader.js +129 -0
- package/dist/server/services/system-setting-service.d.ts +7 -0
- package/dist/server/services/system-setting-service.js +87 -0
- package/dist/server/utils/curren-formula.d.ts +1 -0
- package/dist/server/utils/curren-formula.js +30 -0
- package/dist/server/utils/multiprocess.d.ts +2 -0
- package/dist/server/utils/multiprocess.js +38 -0
- package/package.json +64 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('graceful-fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const copySync = require('../copy').copySync
|
|
6
|
+
const removeSync = require('../remove').removeSync
|
|
7
|
+
const mkdirpSync = require('../mkdirs').mkdirpSync
|
|
8
|
+
const stat = require('../util/stat')
|
|
9
|
+
|
|
10
|
+
function moveSync (src, dest, opts) {
|
|
11
|
+
opts = opts || {}
|
|
12
|
+
const overwrite = opts.overwrite || opts.clobber || false
|
|
13
|
+
|
|
14
|
+
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
|
|
15
|
+
stat.checkParentPathsSync(src, srcStat, dest, 'move')
|
|
16
|
+
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
|
|
17
|
+
return doRename(src, dest, overwrite, isChangingCase)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isParentRoot (dest) {
|
|
21
|
+
const parent = path.dirname(dest)
|
|
22
|
+
const parsedPath = path.parse(parent)
|
|
23
|
+
return parsedPath.root === parent
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function doRename (src, dest, overwrite, isChangingCase) {
|
|
27
|
+
if (isChangingCase) return rename(src, dest, overwrite)
|
|
28
|
+
if (overwrite) {
|
|
29
|
+
removeSync(dest)
|
|
30
|
+
return rename(src, dest, overwrite)
|
|
31
|
+
}
|
|
32
|
+
if (fs.existsSync(dest)) throw new Error('dest already exists.')
|
|
33
|
+
return rename(src, dest, overwrite)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function rename (src, dest, overwrite) {
|
|
37
|
+
try {
|
|
38
|
+
fs.renameSync(src, dest)
|
|
39
|
+
} catch (err) {
|
|
40
|
+
if (err.code !== 'EXDEV') throw err
|
|
41
|
+
return moveAcrossDevice(src, dest, overwrite)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function moveAcrossDevice (src, dest, overwrite) {
|
|
46
|
+
const opts = {
|
|
47
|
+
overwrite,
|
|
48
|
+
errorOnExist: true,
|
|
49
|
+
preserveTimestamps: true
|
|
50
|
+
}
|
|
51
|
+
copySync(src, dest, opts)
|
|
52
|
+
return removeSync(src)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = moveSync
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('../fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const { copy } = require('../copy')
|
|
6
|
+
const { remove } = require('../remove')
|
|
7
|
+
const { mkdirp } = require('../mkdirs')
|
|
8
|
+
const { pathExists } = require('../path-exists')
|
|
9
|
+
const stat = require('../util/stat')
|
|
10
|
+
|
|
11
|
+
async function move (src, dest, opts = {}) {
|
|
12
|
+
const overwrite = opts.overwrite || opts.clobber || false
|
|
13
|
+
|
|
14
|
+
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, 'move', opts)
|
|
15
|
+
|
|
16
|
+
await stat.checkParentPaths(src, srcStat, dest, 'move')
|
|
17
|
+
|
|
18
|
+
// If the parent of dest is not root, make sure it exists before proceeding
|
|
19
|
+
const destParent = path.dirname(dest)
|
|
20
|
+
const parsedParentPath = path.parse(destParent)
|
|
21
|
+
if (parsedParentPath.root !== destParent) {
|
|
22
|
+
await mkdirp(destParent)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return doRename(src, dest, overwrite, isChangingCase)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function doRename (src, dest, overwrite, isChangingCase) {
|
|
29
|
+
if (!isChangingCase) {
|
|
30
|
+
if (overwrite) {
|
|
31
|
+
await remove(dest)
|
|
32
|
+
} else if (await pathExists(dest)) {
|
|
33
|
+
throw new Error('dest already exists.')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
// Try w/ rename first, and try copy + remove if EXDEV
|
|
39
|
+
await fs.rename(src, dest)
|
|
40
|
+
} catch (err) {
|
|
41
|
+
if (err.code !== 'EXDEV') {
|
|
42
|
+
throw err
|
|
43
|
+
}
|
|
44
|
+
await moveAcrossDevice(src, dest, overwrite)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function moveAcrossDevice (src, dest, overwrite) {
|
|
49
|
+
const opts = {
|
|
50
|
+
overwrite,
|
|
51
|
+
errorOnExist: true,
|
|
52
|
+
preserveTimestamps: true
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
await copy(src, dest, opts)
|
|
56
|
+
return remove(src)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = move
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const u = require('universalify').fromPromise
|
|
4
|
+
const fs = require('../fs')
|
|
5
|
+
const path = require('path')
|
|
6
|
+
const mkdir = require('../mkdirs')
|
|
7
|
+
const pathExists = require('../path-exists').pathExists
|
|
8
|
+
|
|
9
|
+
async function outputFile (file, data, encoding = 'utf-8') {
|
|
10
|
+
const dir = path.dirname(file)
|
|
11
|
+
|
|
12
|
+
if (!(await pathExists(dir))) {
|
|
13
|
+
await mkdir.mkdirs(dir)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return fs.writeFile(file, data, encoding)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function outputFileSync (file, ...args) {
|
|
20
|
+
const dir = path.dirname(file)
|
|
21
|
+
if (!fs.existsSync(dir)) {
|
|
22
|
+
mkdir.mkdirsSync(dir)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fs.writeFileSync(file, ...args)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
outputFile: u(outputFile),
|
|
30
|
+
outputFileSync
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
const u = require('universalify').fromPromise
|
|
3
|
+
const fs = require('../fs')
|
|
4
|
+
|
|
5
|
+
function pathExists (path) {
|
|
6
|
+
return fs.access(path).then(() => true).catch(() => false)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
pathExists: u(pathExists),
|
|
11
|
+
pathExistsSync: fs.existsSync
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('graceful-fs')
|
|
4
|
+
const u = require('universalify').fromCallback
|
|
5
|
+
|
|
6
|
+
function remove (path, callback) {
|
|
7
|
+
fs.rm(path, { recursive: true, force: true }, callback)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function removeSync (path) {
|
|
11
|
+
fs.rmSync(path, { recursive: true, force: true })
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
remove: u(remove),
|
|
16
|
+
removeSync
|
|
17
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('../fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const u = require('universalify').fromPromise
|
|
6
|
+
|
|
7
|
+
function getStats (src, dest, opts) {
|
|
8
|
+
const statFunc = opts.dereference
|
|
9
|
+
? (file) => fs.stat(file, { bigint: true })
|
|
10
|
+
: (file) => fs.lstat(file, { bigint: true })
|
|
11
|
+
return Promise.all([
|
|
12
|
+
statFunc(src),
|
|
13
|
+
statFunc(dest).catch(err => {
|
|
14
|
+
if (err.code === 'ENOENT') return null
|
|
15
|
+
throw err
|
|
16
|
+
})
|
|
17
|
+
]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getStatsSync (src, dest, opts) {
|
|
21
|
+
let destStat
|
|
22
|
+
const statFunc = opts.dereference
|
|
23
|
+
? (file) => fs.statSync(file, { bigint: true })
|
|
24
|
+
: (file) => fs.lstatSync(file, { bigint: true })
|
|
25
|
+
const srcStat = statFunc(src)
|
|
26
|
+
try {
|
|
27
|
+
destStat = statFunc(dest)
|
|
28
|
+
} catch (err) {
|
|
29
|
+
if (err.code === 'ENOENT') return { srcStat, destStat: null }
|
|
30
|
+
throw err
|
|
31
|
+
}
|
|
32
|
+
return { srcStat, destStat }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function checkPaths (src, dest, funcName, opts) {
|
|
36
|
+
const { srcStat, destStat } = await getStats(src, dest, opts)
|
|
37
|
+
if (destStat) {
|
|
38
|
+
if (areIdentical(srcStat, destStat)) {
|
|
39
|
+
const srcBaseName = path.basename(src)
|
|
40
|
+
const destBaseName = path.basename(dest)
|
|
41
|
+
if (funcName === 'move' &&
|
|
42
|
+
srcBaseName !== destBaseName &&
|
|
43
|
+
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
44
|
+
return { srcStat, destStat, isChangingCase: true }
|
|
45
|
+
}
|
|
46
|
+
throw new Error('Source and destination must not be the same.')
|
|
47
|
+
}
|
|
48
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
49
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
50
|
+
}
|
|
51
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
52
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
57
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return { srcStat, destStat }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function checkPathsSync (src, dest, funcName, opts) {
|
|
64
|
+
const { srcStat, destStat } = getStatsSync(src, dest, opts)
|
|
65
|
+
|
|
66
|
+
if (destStat) {
|
|
67
|
+
if (areIdentical(srcStat, destStat)) {
|
|
68
|
+
const srcBaseName = path.basename(src)
|
|
69
|
+
const destBaseName = path.basename(dest)
|
|
70
|
+
if (funcName === 'move' &&
|
|
71
|
+
srcBaseName !== destBaseName &&
|
|
72
|
+
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
73
|
+
return { srcStat, destStat, isChangingCase: true }
|
|
74
|
+
}
|
|
75
|
+
throw new Error('Source and destination must not be the same.')
|
|
76
|
+
}
|
|
77
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
78
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
79
|
+
}
|
|
80
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
81
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
86
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
87
|
+
}
|
|
88
|
+
return { srcStat, destStat }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// recursively check if dest parent is a subdirectory of src.
|
|
92
|
+
// It works for all file types including symlinks since it
|
|
93
|
+
// checks the src and dest inodes. It starts from the deepest
|
|
94
|
+
// parent and stops once it reaches the src parent or the root path.
|
|
95
|
+
async function checkParentPaths (src, srcStat, dest, funcName) {
|
|
96
|
+
const srcParent = path.resolve(path.dirname(src))
|
|
97
|
+
const destParent = path.resolve(path.dirname(dest))
|
|
98
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root) return
|
|
99
|
+
|
|
100
|
+
let destStat
|
|
101
|
+
try {
|
|
102
|
+
destStat = await fs.stat(destParent, { bigint: true })
|
|
103
|
+
} catch (err) {
|
|
104
|
+
if (err.code === 'ENOENT') return
|
|
105
|
+
throw err
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (areIdentical(srcStat, destStat)) {
|
|
109
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return checkParentPaths(src, srcStat, destParent, funcName)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function checkParentPathsSync (src, srcStat, dest, funcName) {
|
|
116
|
+
const srcParent = path.resolve(path.dirname(src))
|
|
117
|
+
const destParent = path.resolve(path.dirname(dest))
|
|
118
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root) return
|
|
119
|
+
let destStat
|
|
120
|
+
try {
|
|
121
|
+
destStat = fs.statSync(destParent, { bigint: true })
|
|
122
|
+
} catch (err) {
|
|
123
|
+
if (err.code === 'ENOENT') return
|
|
124
|
+
throw err
|
|
125
|
+
}
|
|
126
|
+
if (areIdentical(srcStat, destStat)) {
|
|
127
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
128
|
+
}
|
|
129
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function areIdentical (srcStat, destStat) {
|
|
133
|
+
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// return true if dest is a subdir of src, otherwise false.
|
|
137
|
+
// It only checks the path strings.
|
|
138
|
+
function isSrcSubdir (src, dest) {
|
|
139
|
+
const srcArr = path.resolve(src).split(path.sep).filter(i => i)
|
|
140
|
+
const destArr = path.resolve(dest).split(path.sep).filter(i => i)
|
|
141
|
+
return srcArr.every((cur, i) => destArr[i] === cur)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function errMsg (src, dest, funcName) {
|
|
145
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
module.exports = {
|
|
149
|
+
// checkPaths
|
|
150
|
+
checkPaths: u(checkPaths),
|
|
151
|
+
checkPathsSync,
|
|
152
|
+
// checkParent
|
|
153
|
+
checkParentPaths: u(checkParentPaths),
|
|
154
|
+
checkParentPathsSync,
|
|
155
|
+
// Misc
|
|
156
|
+
isSrcSubdir,
|
|
157
|
+
areIdentical
|
|
158
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('../fs')
|
|
4
|
+
const u = require('universalify').fromPromise
|
|
5
|
+
|
|
6
|
+
async function utimesMillis (path, atime, mtime) {
|
|
7
|
+
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
8
|
+
const fd = await fs.open(path, 'r+')
|
|
9
|
+
|
|
10
|
+
let closeErr = null
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
await fs.futimes(fd, atime, mtime)
|
|
14
|
+
} finally {
|
|
15
|
+
try {
|
|
16
|
+
await fs.close(fd)
|
|
17
|
+
} catch (e) {
|
|
18
|
+
closeErr = e
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (closeErr) {
|
|
23
|
+
throw closeErr
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function utimesMillisSync (path, atime, mtime) {
|
|
28
|
+
const fd = fs.openSync(path, 'r+')
|
|
29
|
+
fs.futimesSync(fd, atime, mtime)
|
|
30
|
+
return fs.closeSync(fd)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
utimesMillis: u(utimesMillis),
|
|
35
|
+
utimesMillisSync
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"fs-extra","version":"11.2.0","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","engines":{"node":">=14.14"},"homepage":"https://github.com/jprichardson/node-fs-extra","repository":{"type":"git","url":"https://github.com/jprichardson/node-fs-extra"},"keywords":["fs","file","file system","copy","directory","extra","mkdirp","mkdir","mkdirs","recursive","json","read","write","extra","delete","remove","touch","create","text","output","move","promise"],"author":"JP Richardson <jprichardson@gmail.com>","license":"MIT","dependencies":{"graceful-fs":"^4.2.0","jsonfile":"^6.0.1","universalify":"^2.0.0"},"devDependencies":{"klaw":"^2.1.1","klaw-sync":"^3.0.2","minimist":"^1.1.1","mocha":"^10.1.0","nyc":"^15.0.0","proxyquire":"^2.0.1","read-dir-files":"^0.1.1","standard":"^17.0.0"},"main":"./lib/index.js","exports":{".":"./lib/index.js","./esm":"./lib/esm.mjs"},"files":["lib/","!lib/**/__tests__/"],"scripts":{"lint":"standard","test-find":"find ./lib/**/__tests__ -name *.test.js | xargs mocha","test":"npm run lint && npm run unit && npm run unit-esm","unit":"nyc node test.js","unit-esm":"node test.mjs"},"sideEffects":false,"_lastModified":"2024-12-22T16:07:37.816Z"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Context, Next } from '@tachybase/actions';
|
|
2
|
+
export declare const getAppendsOwners: (ctx: Context, next: Next) => Promise<void>;
|
|
3
|
+
export declare const aggregateSearch: (ctx: Context, next: Next) => Promise<void>;
|
|
4
|
+
export declare const setOwner: (ctx: Context, next: Next) => Promise<void>;
|
|
5
|
+
export declare const removeOwner: (ctx: Context, next: Next) => Promise<void>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var departments_exports = {};
|
|
19
|
+
__export(departments_exports, {
|
|
20
|
+
aggregateSearch: () => aggregateSearch,
|
|
21
|
+
getAppendsOwners: () => getAppendsOwners,
|
|
22
|
+
removeOwner: () => removeOwner,
|
|
23
|
+
setOwner: () => setOwner
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(departments_exports);
|
|
26
|
+
const getAppendsOwners = async (ctx, next) => {
|
|
27
|
+
const { filterByTk, appends } = ctx.action.params;
|
|
28
|
+
const repo = ctx.db.getRepository("departments");
|
|
29
|
+
const department = await repo.findOne({
|
|
30
|
+
filterByTk,
|
|
31
|
+
appends
|
|
32
|
+
});
|
|
33
|
+
const owners = await department.getOwners();
|
|
34
|
+
department.setDataValue("owners", owners);
|
|
35
|
+
ctx.body = department;
|
|
36
|
+
await next();
|
|
37
|
+
};
|
|
38
|
+
const aggregateSearch = async (ctx, next) => {
|
|
39
|
+
const { keyword, type, last = 0, limit = 10 } = ctx.action.params.values || {};
|
|
40
|
+
let users = [];
|
|
41
|
+
let departments = [];
|
|
42
|
+
if (!type || type === "user") {
|
|
43
|
+
const repo = ctx.db.getRepository("users");
|
|
44
|
+
users = await repo.find({
|
|
45
|
+
filter: {
|
|
46
|
+
id: { $gt: last },
|
|
47
|
+
$or: [
|
|
48
|
+
{ username: { $includes: keyword } },
|
|
49
|
+
{ nickname: { $includes: keyword } },
|
|
50
|
+
{ phone: { $includes: keyword } },
|
|
51
|
+
{ email: { $includes: keyword } }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
limit
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (!type || type === "department") {
|
|
58
|
+
const repo = ctx.db.getRepository("departments");
|
|
59
|
+
departments = await repo.find({
|
|
60
|
+
filter: {
|
|
61
|
+
id: { $gt: last },
|
|
62
|
+
title: { $includes: keyword }
|
|
63
|
+
},
|
|
64
|
+
appends: ["parent(recursively=true)"],
|
|
65
|
+
limit
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
ctx.body = { users, departments };
|
|
69
|
+
await next();
|
|
70
|
+
};
|
|
71
|
+
const setOwner = async (ctx, next) => {
|
|
72
|
+
const { userId, departmentId } = ctx.action.params.values || {};
|
|
73
|
+
const throughRepo = ctx.db.getRepository("departmentsUsers");
|
|
74
|
+
await throughRepo.update({
|
|
75
|
+
filter: {
|
|
76
|
+
userId,
|
|
77
|
+
departmentId
|
|
78
|
+
},
|
|
79
|
+
values: {
|
|
80
|
+
isOwner: true
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
await next();
|
|
84
|
+
};
|
|
85
|
+
const removeOwner = async (ctx, next) => {
|
|
86
|
+
const { userId, departmentId } = ctx.action.params.values || {};
|
|
87
|
+
const throughRepo = ctx.db.getRepository("departmentsUsers");
|
|
88
|
+
await throughRepo.update({
|
|
89
|
+
filter: {
|
|
90
|
+
userId,
|
|
91
|
+
departmentId
|
|
92
|
+
},
|
|
93
|
+
values: {
|
|
94
|
+
isOwner: false
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
await next();
|
|
98
|
+
};
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
aggregateSearch,
|
|
102
|
+
getAppendsOwners,
|
|
103
|
+
removeOwner,
|
|
104
|
+
setOwner
|
|
105
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './robot-controller';
|
|
2
|
+
export * from './token-configuration-controller';
|
|
3
|
+
export * from './plugin-version';
|
|
4
|
+
export * from './link-manager-controller';
|
|
5
|
+
export * from './system-message-controller';
|
|
6
|
+
export * from './departments';
|
|
7
|
+
export * from './users';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var actions_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(actions_exports);
|
|
17
|
+
__reExport(actions_exports, require("./robot-controller"), module.exports);
|
|
18
|
+
__reExport(actions_exports, require("./token-configuration-controller"), module.exports);
|
|
19
|
+
__reExport(actions_exports, require("./plugin-version"), module.exports);
|
|
20
|
+
__reExport(actions_exports, require("./link-manager-controller"), module.exports);
|
|
21
|
+
__reExport(actions_exports, require("./system-message-controller"), module.exports);
|
|
22
|
+
__reExport(actions_exports, require("./departments"), module.exports);
|
|
23
|
+
__reExport(actions_exports, require("./users"), module.exports);
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
...require("./robot-controller"),
|
|
27
|
+
...require("./token-configuration-controller"),
|
|
28
|
+
...require("./plugin-version"),
|
|
29
|
+
...require("./link-manager-controller"),
|
|
30
|
+
...require("./system-message-controller"),
|
|
31
|
+
...require("./departments"),
|
|
32
|
+
...require("./users")
|
|
33
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from '@tachybase/actions';
|
|
2
|
+
export declare class LinkManagerController {
|
|
3
|
+
getLink(ctx: Context, next: () => Promise<any>): Promise<any>;
|
|
4
|
+
setLink(ctx: Context, next: () => Promise<any>): Promise<any>;
|
|
5
|
+
init(ctx: Context, next: () => Promise<any>): Promise<any>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __decoratorStart = (base) => [, , , __create((base == null ? void 0 : base[__knownSymbol("metadata")]) ?? null)];
|
|
26
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
27
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
28
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
29
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
30
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
31
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
34
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
35
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
36
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
37
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
38
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
|
39
|
+
return __privateGet(this, extra);
|
|
40
|
+
}, set [name](x) {
|
|
41
|
+
return __privateSet(this, extra, x);
|
|
42
|
+
} }, name));
|
|
43
|
+
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
44
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
45
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
46
|
+
if (k) {
|
|
47
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
48
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
49
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
50
|
+
}
|
|
51
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
52
|
+
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
53
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
54
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
55
|
+
}
|
|
56
|
+
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
57
|
+
};
|
|
58
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
59
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
|
60
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
61
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
62
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
63
|
+
var link_manager_controller_exports = {};
|
|
64
|
+
__export(link_manager_controller_exports, {
|
|
65
|
+
LinkManagerController: () => LinkManagerController
|
|
66
|
+
});
|
|
67
|
+
module.exports = __toCommonJS(link_manager_controller_exports);
|
|
68
|
+
var import_utils = require("@tachybase/utils");
|
|
69
|
+
var _init_dec, _setLink_dec, _getLink_dec, _LinkManagerController_decorators, _init;
|
|
70
|
+
_LinkManagerController_decorators = [(0, import_utils.Controller)("link-manage")], _getLink_dec = [(0, import_utils.Action)("get")], _setLink_dec = [(0, import_utils.Action)("set")], _init_dec = [(0, import_utils.Action)("init", { acl: "public" })];
|
|
71
|
+
class LinkManagerController {
|
|
72
|
+
constructor() {
|
|
73
|
+
__runInitializers(_init, 5, this);
|
|
74
|
+
}
|
|
75
|
+
async getLink(ctx, next) {
|
|
76
|
+
const {
|
|
77
|
+
params: { name }
|
|
78
|
+
} = ctx.action;
|
|
79
|
+
const where = {};
|
|
80
|
+
if (name) {
|
|
81
|
+
where["filter"] = {
|
|
82
|
+
name
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const repo = ctx.db.getRepository("linkManage");
|
|
86
|
+
const data = await repo.find(where);
|
|
87
|
+
ctx.body = data;
|
|
88
|
+
return next();
|
|
89
|
+
}
|
|
90
|
+
async setLink(ctx, next) {
|
|
91
|
+
const {
|
|
92
|
+
params: { id, link }
|
|
93
|
+
} = ctx.action;
|
|
94
|
+
if (!id) return;
|
|
95
|
+
const repo = ctx.db.getRepository("linkManage");
|
|
96
|
+
await repo.update({
|
|
97
|
+
values: { link },
|
|
98
|
+
filter: {
|
|
99
|
+
id
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return next();
|
|
103
|
+
}
|
|
104
|
+
async init(ctx, next) {
|
|
105
|
+
const {
|
|
106
|
+
params: { name }
|
|
107
|
+
} = ctx.action;
|
|
108
|
+
const repo = ctx.db.getRepository("linkManage");
|
|
109
|
+
const data = await repo.findOne({
|
|
110
|
+
filter: {
|
|
111
|
+
name
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (data) return;
|
|
115
|
+
const createData = await repo.create({
|
|
116
|
+
values: {
|
|
117
|
+
name
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
ctx.body = createData;
|
|
121
|
+
return next();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
_init = __decoratorStart(null);
|
|
125
|
+
__decorateElement(_init, 1, "getLink", _getLink_dec, LinkManagerController);
|
|
126
|
+
__decorateElement(_init, 1, "setLink", _setLink_dec, LinkManagerController);
|
|
127
|
+
__decorateElement(_init, 1, "init", _init_dec, LinkManagerController);
|
|
128
|
+
LinkManagerController = __decorateElement(_init, 0, "LinkManagerController", _LinkManagerController_decorators, LinkManagerController);
|
|
129
|
+
__runInitializers(_init, 1, LinkManagerController);
|
|
130
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
131
|
+
0 && (module.exports = {
|
|
132
|
+
LinkManagerController
|
|
133
|
+
});
|