@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.
Files changed (262) hide show
  1. package/.turbo/turbo-build.log +11 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/components/PDFViewer.d.ts +11 -0
  6. package/dist/client/components/SignatureInput.d.ts +2 -0
  7. package/dist/client/components/SignaturePad.d.ts +240 -0
  8. package/dist/client/components/custom-components/CustomAssociatedField.d.ts +2 -0
  9. package/dist/client/components/custom-components/CustomComponentDispatcher.d.ts +5 -0
  10. package/dist/client/components/custom-components/CustomField.d.ts +2 -0
  11. package/dist/client/components/custom-components/ErrorBoundary.d.ts +2 -0
  12. package/dist/client/components/custom-components/custom-components.d.ts +21 -0
  13. package/dist/client/components/excel-table/ExcelFile.d.ts +2 -0
  14. package/dist/client/components/excel-table/Sheet.d.ts +10 -0
  15. package/dist/client/components/fields/AssociatedField.d.ts +7 -0
  16. package/dist/client/components/fields/CalcResult.d.ts +1 -0
  17. package/dist/client/components/fields/Expression.d.ts +3 -0
  18. package/dist/client/components/index.d.ts +11 -0
  19. package/dist/client/components/modal-full-screen/ModalFullScreen.d.ts +15 -0
  20. package/dist/client/components/modal-full-screen/ModalFullScreenChild.d.ts +2 -0
  21. package/dist/client/features/block-group/GroupBlock.d.ts +4 -0
  22. package/dist/client/features/block-group/GroupBlockConfigure.d.ts +19 -0
  23. package/dist/client/features/block-group/GroupBlockInitializer.d.ts +9 -0
  24. package/dist/client/features/block-group/index.d.ts +4 -0
  25. package/dist/client/features/custom-components/index.d.ts +5 -0
  26. package/dist/client/features/departments/common/DepartmentTable.schema.d.ts +50 -0
  27. package/dist/client/features/departments/common/DepartmentTable.view.d.ts +5 -0
  28. package/dist/client/features/departments/common/FilterKeys.context.d.ts +10 -0
  29. package/dist/client/features/departments/common/InternalDepartmentTable.d.ts +6 -0
  30. package/dist/client/features/departments/common/Request.povider.d.ts +2 -0
  31. package/dist/client/features/departments/common/UserDepartmentsFieldNotSupport.d.ts +2 -0
  32. package/dist/client/features/departments/common/scopes/useDepartmentFilterActionProps.d.ts +5 -0
  33. package/dist/client/features/departments/common/scopes/useFilterActionProps.d.ts +5 -0
  34. package/dist/client/features/departments/index.d.ts +5 -0
  35. package/dist/client/features/departments/main-tab/DepartmentIndex.d.ts +6 -0
  36. package/dist/client/features/departments/main-tab/DepartmentIndex.provider.d.ts +4 -0
  37. package/dist/client/features/departments/main-tab/DepartmentManagement.component.d.ts +2 -0
  38. package/dist/client/features/departments/main-tab/DepartmentManagement.schema.d.ts +10 -0
  39. package/dist/client/features/departments/main-tab/DepartmentManagement.view.d.ts +2 -0
  40. package/dist/client/features/departments/main-tab/collections/departments.collection.d.ts +128 -0
  41. package/dist/client/features/departments/main-tab/collections/users.collection.d.ts +189 -0
  42. package/dist/client/features/departments/main-tab/components/DepartmentSelect.d.ts +2 -0
  43. package/dist/client/features/departments/main-tab/components/InternalSuperiorDepartmentSelect.d.ts +2 -0
  44. package/dist/client/features/departments/main-tab/components/SuperiorDepartmentSelect.d.ts +2 -0
  45. package/dist/client/features/departments/main-tab/context/Department.context.d.ts +23 -0
  46. package/dist/client/features/departments/main-tab/context/DepartmentsExpanded.context.d.ts +17 -0
  47. package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.schema.d.ts +67 -0
  48. package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.view.d.ts +2 -0
  49. package/dist/client/features/departments/main-tab/departments-block/DepartmentOwnersField.component.d.ts +6 -0
  50. package/dist/client/features/departments/main-tab/departments-block/DepartmentsBlock.d.ts +2 -0
  51. package/dist/client/features/departments/main-tab/departments-block/DepartmentsSearch.component.d.ts +2 -0
  52. package/dist/client/features/departments/main-tab/departments-block/DepartmentsTree.component.d.ts +9 -0
  53. package/dist/client/features/departments/main-tab/departments-block/Request.provider.d.ts +2 -0
  54. package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.schema.d.ts +136 -0
  55. package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.view.d.ts +2 -0
  56. package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentEdit.d.ts +62 -0
  57. package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentNewSub.d.ts +57 -0
  58. package/dist/client/features/departments/main-tab/departments-block/scopes/useCreateDepartment.d.ts +3 -0
  59. package/dist/client/features/departments/main-tab/departments-block/scopes/useUpdateDepartment.d.ts +3 -0
  60. package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.schema.d.ts +148 -0
  61. package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.view.d.ts +2 -0
  62. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentField.component.d.ts +2 -0
  63. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.d.ts +2 -0
  64. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.schema.d.ts +676 -0
  65. package/dist/client/features/departments/main-tab/departments-users-block/IsOwnerField.component.d.ts +2 -0
  66. package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.schema.d.ts +49 -0
  67. package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.view.d.ts +2 -0
  68. package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.schema.d.ts +16 -0
  69. package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.view.d.ts +2 -0
  70. package/dist/client/features/departments/main-tab/departments-users-block/UserDepartmentsField.component.d.ts +2 -0
  71. package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.schema.d.ts +42 -0
  72. package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.view.d.ts +2 -0
  73. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useBulkRemoveMembersAction.d.ts +3 -0
  74. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useDataSource.d.ts +40 -0
  75. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useMembersDataSource.d.ts +6 -0
  76. package/dist/client/features/departments/main-tab/departments-users-block/scopes/usePropsAddMember.d.ts +1 -0
  77. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRefreshActionProps.d.ts +3 -0
  78. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRemoveMemberAction.d.ts +3 -0
  79. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useShowTotal.d.ts +1 -0
  80. package/dist/client/features/departments/main-tab/hooks/useDeepTree.d.ts +14 -0
  81. package/dist/client/features/departments/main-tab/hooks/useGetDepTree.d.ts +18 -0
  82. package/dist/client/features/departments/main-tab/kit.d.ts +4 -0
  83. package/dist/client/features/departments/main-tab/providers/DepartmentsResource.provider.d.ts +4 -0
  84. package/dist/client/features/departments/main-tab/providers/UserResource.provider.d.ts +4 -0
  85. package/dist/client/features/departments/role-auth/DepartmentTitle.component.d.ts +2 -0
  86. package/dist/client/features/departments/role-auth/Departments.d.ts +2 -0
  87. package/dist/client/features/departments/role-auth/Departments.schema.d.ts +227 -0
  88. package/dist/client/features/departments/role-auth/kit.d.ts +4 -0
  89. package/dist/client/features/departments/role-auth/scopes/useAddDepartments.d.ts +3 -0
  90. package/dist/client/features/departments/role-auth/scopes/useBulkRemoveDepartments.d.ts +3 -0
  91. package/dist/client/features/departments/role-auth/scopes/useDataSource.d.ts +40 -0
  92. package/dist/client/features/departments/role-auth/scopes/useDisabled.d.ts +3 -0
  93. package/dist/client/features/departments/role-auth/scopes/useRemoveDepartment.d.ts +3 -0
  94. package/dist/client/features/departments/settings/DepartmentOwnersFieldSetting.d.ts +2 -0
  95. package/dist/client/features/departments/settings/UserDepartmentsFieldSetting.d.ts +2 -0
  96. package/dist/client/features/departments/settings/UserMainDepartmentFieldSetting.d.ts +2 -0
  97. package/dist/client/features/departments/settings/items/enableLinkItem.d.ts +2 -0
  98. package/dist/client/features/departments/settings/items/modeSelectItem.d.ts +2 -0
  99. package/dist/client/features/departments/settings/items/titleFieldItem.d.ts +2 -0
  100. package/dist/client/features/departments/utils/getDepartmentStr.d.ts +1 -0
  101. package/dist/client/features/departments/utils/getUserListByDepartment.d.ts +1 -0
  102. package/dist/client/features/embed/EmbedLayout.d.ts +2 -0
  103. package/dist/client/features/embed/EmbedPage.d.ts +2 -0
  104. package/dist/client/features/embed/EmbedSchemaComponent.d.ts +2 -0
  105. package/dist/client/features/embed/NotAuthorityResult.d.ts +2 -0
  106. package/dist/client/features/embed/index.d.ts +4 -0
  107. package/dist/client/features/embed/useEmbedToken.d.ts +1 -0
  108. package/dist/client/features/embed/usePageSettingsProps.d.ts +4 -0
  109. package/dist/client/features/field-appends/index.d.ts +4 -0
  110. package/dist/client/features/field-appends/show-code/Code.interface.d.ts +74 -0
  111. package/dist/client/features/field-appends/show-code/Code.view.d.ts +3 -0
  112. package/dist/client/features/field-appends/show-formula/Formula.interface.d.ts +75 -0
  113. package/dist/client/features/field-appends/show-formula/Formula.view.d.ts +3 -0
  114. package/dist/client/features/hera-version/HeraVersion.provider.d.ts +4 -0
  115. package/dist/client/features/hera-version/index.d.ts +4 -0
  116. package/dist/client/features/mode-highlight/ModeHighlight.provider.d.ts +4 -0
  117. package/dist/client/features/mode-highlight/index.d.ts +4 -0
  118. package/dist/client/features/outbound/OutboundLinkActionInitializer.d.ts +6 -0
  119. package/dist/client/features/outbound/OutboundPage.d.ts +2 -0
  120. package/dist/client/features/outbound/index.d.ts +4 -0
  121. package/dist/client/features/outbound/useOutboundActionProps.d.ts +3 -0
  122. package/dist/client/features/pdf/PDFVIewerBlockInitializer.d.ts +10 -0
  123. package/dist/client/features/pdf/PDFViewer.d.ts +2 -0
  124. package/dist/client/features/pdf/index.d.ts +4 -0
  125. package/dist/client/features/sheet/SheetBlockInitializer.d.ts +8 -0
  126. package/dist/client/features/sheet/index.d.ts +4 -0
  127. package/dist/client/hooks/useCustomComponent.d.ts +5 -0
  128. package/dist/client/hooks/useGetCustomAssociatedComponents.d.ts +4 -0
  129. package/dist/client/hooks/useGetCustomComponents.d.ts +4 -0
  130. package/dist/client/hooks/useNotifications.d.ts +2 -0
  131. package/dist/client/hooks/usePluginVersion.d.ts +1 -0
  132. package/dist/client/hooks/useTokenConfiguration.d.ts +3 -0
  133. package/dist/client/index.d.ts +16 -0
  134. package/dist/client/index.js +93 -0
  135. package/dist/client/interfaces/AssociatedFieldInterface.d.ts +118 -0
  136. package/dist/client/interfaces/CalcFieldInterface.d.ts +120 -0
  137. package/dist/client/interfaces/CustomAssociatedFieldInterface.d.ts +69 -0
  138. package/dist/client/interfaces/CustomFieldInterface.d.ts +45 -0
  139. package/dist/client/interfaces/ExcelFieldInterface.d.ts +38 -0
  140. package/dist/client/interfaces/SignaturePadFieldInterface.d.ts +38 -0
  141. package/dist/client/interfaces/TstzrangeFieldInterface.d.ts +41 -0
  142. package/dist/client/interfaces/index.d.ts +6 -0
  143. package/dist/client/locale.d.ts +9 -0
  144. package/dist/client/schema-initializer/blocks/SettingBlockInitializer.d.ts +2 -0
  145. package/dist/client/schema-initializer/index.d.ts +1 -0
  146. package/dist/client/schema-settings/SchemaSettingsDatePickerType.d.ts +2 -0
  147. package/dist/client/schema-settings/SchemaSettingsDatePresets.d.ts +11 -0
  148. package/dist/client/schema-settings/SchemaSettingsSubmitDataType.d.ts +5 -0
  149. package/dist/client/schema-settings/index.d.ts +4 -0
  150. package/dist/client/settings-manager-components/LinkManager.d.ts +2 -0
  151. package/dist/client/settings-manager-components/TokenConfiguration.d.ts +6 -0
  152. package/dist/client/settings-manager-components/index.d.ts +8 -0
  153. package/dist/client/utils.d.ts +2 -0
  154. package/dist/externalVersion.js +21 -0
  155. package/dist/index.d.ts +2 -0
  156. package/dist/index.js +39 -0
  157. package/dist/locale/en-US.json +94 -0
  158. package/dist/locale/zh-CN.json +94 -0
  159. package/dist/node_modules/fs-extra/LICENSE +15 -0
  160. package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
  161. package/dist/node_modules/fs-extra/lib/copy/copy.js +177 -0
  162. package/dist/node_modules/fs-extra/lib/copy/index.js +7 -0
  163. package/dist/node_modules/fs-extra/lib/empty/index.js +39 -0
  164. package/dist/node_modules/fs-extra/lib/ensure/file.js +66 -0
  165. package/dist/node_modules/fs-extra/lib/ensure/index.js +23 -0
  166. package/dist/node_modules/fs-extra/lib/ensure/link.js +64 -0
  167. package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +101 -0
  168. package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +34 -0
  169. package/dist/node_modules/fs-extra/lib/ensure/symlink.js +67 -0
  170. package/dist/node_modules/fs-extra/lib/fs/index.js +140 -0
  171. package/dist/node_modules/fs-extra/lib/index.js +1 -0
  172. package/dist/node_modules/fs-extra/lib/json/index.js +16 -0
  173. package/dist/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  174. package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  175. package/dist/node_modules/fs-extra/lib/json/output-json.js +12 -0
  176. package/dist/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  177. package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  178. package/dist/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  179. package/dist/node_modules/fs-extra/lib/move/index.js +7 -0
  180. package/dist/node_modules/fs-extra/lib/move/move-sync.js +55 -0
  181. package/dist/node_modules/fs-extra/lib/move/move.js +59 -0
  182. package/dist/node_modules/fs-extra/lib/output-file/index.js +31 -0
  183. package/dist/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  184. package/dist/node_modules/fs-extra/lib/remove/index.js +17 -0
  185. package/dist/node_modules/fs-extra/lib/util/stat.js +158 -0
  186. package/dist/node_modules/fs-extra/lib/util/utimes.js +36 -0
  187. package/dist/node_modules/fs-extra/package.json +1 -0
  188. package/dist/server/actions/departments.d.ts +5 -0
  189. package/dist/server/actions/departments.js +105 -0
  190. package/dist/server/actions/index.d.ts +7 -0
  191. package/dist/server/actions/index.js +33 -0
  192. package/dist/server/actions/link-manager-controller.d.ts +6 -0
  193. package/dist/server/actions/link-manager-controller.js +133 -0
  194. package/dist/server/actions/plugin-version.d.ts +6 -0
  195. package/dist/server/actions/plugin-version.js +91 -0
  196. package/dist/server/actions/robot-controller.d.ts +5 -0
  197. package/dist/server/actions/robot-controller.js +134 -0
  198. package/dist/server/actions/system-message-controller.d.ts +5 -0
  199. package/dist/server/actions/system-message-controller.js +106 -0
  200. package/dist/server/actions/token-configuration-controller.d.ts +5 -0
  201. package/dist/server/actions/token-configuration-controller.js +120 -0
  202. package/dist/server/actions/users.d.ts +4 -0
  203. package/dist/server/actions/users.js +142 -0
  204. package/dist/server/collections/departmentRoles.d.ts +2 -0
  205. package/dist/server/collections/departmentRoles.js +27 -0
  206. package/dist/server/collections/departments.d.ts +29 -0
  207. package/dist/server/collections/departments.js +162 -0
  208. package/dist/server/collections/departmentsUsers.d.ts +2 -0
  209. package/dist/server/collections/departmentsUsers.js +43 -0
  210. package/dist/server/collections/link-manage.d.ts +2 -0
  211. package/dist/server/collections/link-manage.js +42 -0
  212. package/dist/server/collections/roles.d.ts +2 -0
  213. package/dist/server/collections/roles.js +39 -0
  214. package/dist/server/collections/systemSettings.d.ts +2 -0
  215. package/dist/server/collections/systemSettings.js +33 -0
  216. package/dist/server/collections/system_message.d.ts +2 -0
  217. package/dist/server/collections/system_message.js +67 -0
  218. package/dist/server/collections/token-configuration.d.ts +2 -0
  219. package/dist/server/collections/token-configuration.js +54 -0
  220. package/dist/server/collections/users.d.ts +55 -0
  221. package/dist/server/collections/users.js +87 -0
  222. package/dist/server/features/departments.d.ts +7 -0
  223. package/dist/server/features/departments.js +132 -0
  224. package/dist/server/fields/calc.d.ts +11 -0
  225. package/dist/server/fields/calc.js +43 -0
  226. package/dist/server/fields/tstzrange.d.ts +7 -0
  227. package/dist/server/fields/tstzrange.js +28 -0
  228. package/dist/server/index.d.ts +3 -0
  229. package/dist/server/index.js +41 -0
  230. package/dist/server/middlewares/destroy-department-check.d.ts +2 -0
  231. package/dist/server/middlewares/destroy-department-check.js +53 -0
  232. package/dist/server/middlewares/index.d.ts +6 -0
  233. package/dist/server/middlewares/index.js +31 -0
  234. package/dist/server/middlewares/list-users-include-child-department.d.ts +2 -0
  235. package/dist/server/middlewares/list-users-include-child-department.js +77 -0
  236. package/dist/server/middlewares/reset-user-departments-cache.d.ts +2 -0
  237. package/dist/server/middlewares/reset-user-departments-cache.js +39 -0
  238. package/dist/server/middlewares/set-department-owners.d.ts +2 -0
  239. package/dist/server/middlewares/set-department-owners.js +74 -0
  240. package/dist/server/middlewares/set-departments-roles.d.ts +2 -0
  241. package/dist/server/middlewares/set-departments-roles.js +64 -0
  242. package/dist/server/middlewares/set-main-department.d.ts +2 -0
  243. package/dist/server/middlewares/set-main-department.js +105 -0
  244. package/dist/server/middlewares/update-department-isleaf.d.ts +2 -0
  245. package/dist/server/middlewares/update-department-isleaf.js +84 -0
  246. package/dist/server/models/department.d.ts +4 -0
  247. package/dist/server/models/department.js +38 -0
  248. package/dist/server/plugin.d.ts +6 -0
  249. package/dist/server/plugin.js +111 -0
  250. package/dist/server/services/plugin-version.d.ts +5 -0
  251. package/dist/server/services/plugin-version.js +89 -0
  252. package/dist/server/services/sql-loader.d.ts +10 -0
  253. package/dist/server/services/sql-loader.js +129 -0
  254. package/dist/server/services/system-setting-service.d.ts +7 -0
  255. package/dist/server/services/system-setting-service.js +87 -0
  256. package/dist/server/utils/curren-formula.d.ts +1 -0
  257. package/dist/server/utils/curren-formula.js +30 -0
  258. package/dist/server/utils/multiprocess.d.ts +2 -0
  259. package/dist/server/utils/multiprocess.js +38 -0
  260. package/package.json +64 -0
  261. package/server.d.ts +2 -0
  262. package/server.js +1 -0
@@ -0,0 +1,94 @@
1
+ {
2
+ "Add custom component": "Add custom component",
3
+ "Add department": "Add department",
4
+ "Add departments": "Add departments",
5
+ "Add members": "Add members",
6
+ "All members": "All members",
7
+ "All users": "All users",
8
+ "Are you sure you want to delete it?": "Are you sure you want to delete it?",
9
+ "Are you sure you want to remove it?": "Are you sure you want to remove it?",
10
+ "Are you sure you want to remove these departments?": "Are you sure you want to remove these departments?",
11
+ "Are you sure you want to remove these members?": "Are you sure you want to remove these members?",
12
+ "Association field": "Association field",
13
+ "Chuangxing presets": "Chuangxing presets",
14
+ "Configure": "Configure",
15
+ "Copy Failed": "Copy Failed",
16
+ "Copy embedded link": "Copy embedded link",
17
+ "Copy link": "Copy link",
18
+ "Copy successful": "Copy successful",
19
+ "Create a record": "Create a record",
20
+ "Custom filter": "Custom filter",
21
+ "Custom option label": "Custom option label",
22
+ "Delete": "Delete",
23
+ "Delete department": "Delete department",
24
+ "Department": "Department",
25
+ "Department name": "Department name",
26
+ "Departments": "Departments",
27
+ "Departments management": "Departments management",
28
+ "Edit department": "Edit department",
29
+ "Exclude members of sub-departments": "Exclude members of sub-departments",
30
+ "Group": "Group",
31
+ "Group block": "Group block",
32
+ "Hera integration": "Hera integration",
33
+ "HomePage Config": "HomePage Config",
34
+ "Last month": "Last month",
35
+ "Link manager": "Link manager",
36
+ "Main": "Main",
37
+ "Main department": "Main department",
38
+ "Mobile UI": "Mobile UI",
39
+ "Navigate to new page": "Navigate to new page",
40
+ "New department": "New department",
41
+ "New sub department": "New sub department",
42
+ "Only display direct members of the department": "Only display direct members of the department",
43
+ "Owner": "Owner",
44
+ "Owners": "Owners",
45
+ "Page style": "Page Style",
46
+ "Pagination": "Pagination",
47
+ "Parameters": "Parameters",
48
+ "Pick a data entry for viewing and editing": "Pick a data entry for viewing and editing",
49
+ "Please select": "Please select",
50
+ "Please select departments": "Please select departments",
51
+ "Please select members": "Please select members",
52
+ "Remove department": "Remove department",
53
+ "Remove departments": "Remove departments",
54
+ "Remove member": "Remove member",
55
+ "Remove members": "Remove members",
56
+ "Request inteception": "Request inteception",
57
+ "Request to intercept": "Request to intercept",
58
+ "Role of user acted": "Role of user acted",
59
+ "Roles management": "Roles management",
60
+ "Search for departments, users": "Search for departments, users",
61
+ "Search results": "Search results",
62
+ "Select Departments": "Select Departments",
63
+ "Select submit data type": "Select submit data type",
64
+ "Set as main department": "Set as main department",
65
+ "Show all members": "Show All members",
66
+ "Signature input": "Signature input",
67
+ "Something went wrong. Please contact the developer to resolve the issue.": "Something went wrong. Please contact the developer to resolve the issue.",
68
+ "Superior department": "Superior department",
69
+ "System setting": "System setting",
70
+ "The department has members, please remove them first": "The department has members, please remove them first",
71
+ "The department has sub-departments, please delete them first": "The department has sub-departments, please delete them first",
72
+ "The following selected requests all trigger interception on submission": "The following selected requests all trigger interception on submission",
73
+ "Theme": "Theme",
74
+ "Third-party integration configuration": "Third-party integration configuration",
75
+ "This field is currently not supported for use in form blocks.": "This field is currently not supported for use in form blocks.",
76
+ "This month": "This month",
77
+ "This year": "This year",
78
+ "Trigger mode": "Trigger mode",
79
+ "Triggered before submitting a create, update, or delete request to a collection, so that data validation, logical judgment, etc., can be performed before executing the request, and then either approving the request or rejecting the request by using the \"End process\" node.": "Triggered before submitting a create, update, or delete request to a collection, so that data validation, logical judgment, etc., can be performed before executing the request, and then either approving the request or rejecting the request by using the \"End process\" node.",
80
+ "Triggered only when a form bound to this workflow is submitted": "Triggered only when a form bound to this workflow is submitted",
81
+ "Update a record": "Update a record",
82
+ "User acted": "User acted",
83
+ "Values submitted": "Values submitted",
84
+ "Webhook manager": "Webhook manager",
85
+ "classical": "classical",
86
+ "component": "component",
87
+ "default": "default",
88
+ "error": "error",
89
+ "loading...": "loading...",
90
+ "outbound": "outbound",
91
+ "preview block": "preview block",
92
+ "tabs": "tabs",
93
+ "year": "year"
94
+ }
@@ -0,0 +1,94 @@
1
+ {
2
+ "Add custom component": "添加自定义组件",
3
+ "Add department": "添加部门",
4
+ "Add departments": "添加部门",
5
+ "Add members": "添加成员",
6
+ "All members": "展示全部成员",
7
+ "All users": "所有用户",
8
+ "Are you sure you want to delete it?": "你确定要删除吗?",
9
+ "Are you sure you want to remove it?": "你确定要移除吗?",
10
+ "Are you sure you want to remove these departments?": "你确定要移除这些部门吗?",
11
+ "Are you sure you want to remove these members?": "你确定要移除这些成员吗?",
12
+ "Association field": "关联字段",
13
+ "Chuangxing presets": "创兴预置",
14
+ "Configure": "配置",
15
+ "Copy Failed": "复制失败",
16
+ "Copy embedded link": "复制嵌入链接",
17
+ "Copy link": "复制链接",
18
+ "Copy successful": "复制成功",
19
+ "Create record action": "创建记录操作",
20
+ "Custom filter": "自定义筛选",
21
+ "Custom option label": "自定义选项标签",
22
+ "Delete department": "删除部门",
23
+ "Delete record action": "删除记录操作",
24
+ "Department": "部门",
25
+ "Department name": "部门名称",
26
+ "Departments": "部门",
27
+ "Departments management": "部门管理",
28
+ "Edit department": "编辑部门",
29
+ "Exclude members of sub-departments": "仅展示部门的直属成员",
30
+ "Global mode, triggered before executing the following actions": "全局模式,以下操作执行前都触发",
31
+ "Group": "汇总",
32
+ "Group block": "汇总卡片",
33
+ "Hera integration": "赫拉集成",
34
+ "HomePage Config": "主页配置",
35
+ "Last month": "上月",
36
+ "Link manager": "链接管理器",
37
+ "Local mode, triggered before executing the actions bound to this workflow": "局部模式,绑定该工作流的操作执行前触发",
38
+ "Main": "主属部门",
39
+ "Main department": "主属部门",
40
+ "Mobile UI": "移动端页面",
41
+ "Navigate to new page": "导航到新页面",
42
+ "New department": "新建部门",
43
+ "New sub department": "新建子部门",
44
+ "Only display direct members of the department": "仅展示部门的直属成员",
45
+ "Owner": "负责人",
46
+ "Owners": "负责人",
47
+ "Page style": "页面版本",
48
+ "Pagination": "分页",
49
+ "Parameters": "参数",
50
+ "Pick a data entry for viewing and editing": "选择一条数据用于查看与编辑",
51
+ "Please select": "请选择",
52
+ "Please select departments": "请选择部门",
53
+ "Please select members": "请选择成员",
54
+ "Pre-action event": "操作前事件",
55
+ "Remove department": "移除部门",
56
+ "Remove departments": "移除部门",
57
+ "Remove member": "移除成员",
58
+ "Remove members": "移除成员",
59
+ "Role of user acted": "操作者角色",
60
+ "Roles management": "角色管理",
61
+ "Search for departments, users": "搜索部门、用户",
62
+ "Search results": "搜索结果",
63
+ "Select Departments": "选择部门",
64
+ "Select actions": "选择操作",
65
+ "Select submit data type": "增量提交",
66
+ "Set as main department": "设置为主属部门",
67
+ "Show all members": "展示全部成员",
68
+ "Signature input": "手写签名",
69
+ "Something went wrong. Please contact the developer to resolve the issue.": "系统内部错误,请联系开发者解决",
70
+ "Superior department": "上级部门",
71
+ "System setting": "应用配置",
72
+ "The department has members, please remove them first": "部门下有成员,请先移除",
73
+ "The department has sub-departments, please delete them first": "部门下有子部门,请先删除子部门",
74
+ "Theme": "主题",
75
+ "Third-party integration configuration": "第三方集成配置",
76
+ "This field is currently not supported for use in form blocks.": "该字段目前不支持在表单卡片中使用。",
77
+ "This month": "本月",
78
+ "This year": "今年",
79
+ "Trigger mode": "触发模式",
80
+ "Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the \"End process\" node.": "通过操作按钮或 API 发起请求并在执行前触发,比如新增、更新、删除数据之前。适用于在操作前进行数据验证、逻辑判断,并可通过“结束节点”来拦截请求。",
81
+ "Update record action": "更新记录操作",
82
+ "User acted": "操作者",
83
+ "Values submitted": "提交的值对象",
84
+ "Webhook manager": "Webhook 管理",
85
+ "classical": "经典版",
86
+ "component": "组件",
87
+ "default": "默认",
88
+ "error": "出错了",
89
+ "loading...": "加载中...",
90
+ "outbound": "外链",
91
+ "preview block": "预览卡片",
92
+ "tabs": "多标签",
93
+ "year": "年"
94
+ }
@@ -0,0 +1,15 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2011-2017 JP Richardson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
6
+ (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
7
+ merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
14
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,161 @@
1
+ 'use strict'
2
+
3
+ const fs = require('graceful-fs')
4
+ const path = require('path')
5
+ const mkdirsSync = require('../mkdirs').mkdirsSync
6
+ const utimesMillisSync = require('../util/utimes').utimesMillisSync
7
+ const stat = require('../util/stat')
8
+
9
+ function copySync (src, dest, opts) {
10
+ if (typeof opts === 'function') {
11
+ opts = { filter: opts }
12
+ }
13
+
14
+ opts = opts || {}
15
+ opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
16
+ opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
17
+
18
+ // Warn about using preserveTimestamps on 32-bit node
19
+ if (opts.preserveTimestamps && process.arch === 'ia32') {
20
+ process.emitWarning(
21
+ 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
22
+ '\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
23
+ 'Warning', 'fs-extra-WARN0002'
24
+ )
25
+ }
26
+
27
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
28
+ stat.checkParentPathsSync(src, srcStat, dest, 'copy')
29
+ if (opts.filter && !opts.filter(src, dest)) return
30
+ const destParent = path.dirname(dest)
31
+ if (!fs.existsSync(destParent)) mkdirsSync(destParent)
32
+ return getStats(destStat, src, dest, opts)
33
+ }
34
+
35
+ function getStats (destStat, src, dest, opts) {
36
+ const statSync = opts.dereference ? fs.statSync : fs.lstatSync
37
+ const srcStat = statSync(src)
38
+
39
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
40
+ else if (srcStat.isFile() ||
41
+ srcStat.isCharacterDevice() ||
42
+ srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
43
+ else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
44
+ else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
45
+ else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
46
+ throw new Error(`Unknown file: ${src}`)
47
+ }
48
+
49
+ function onFile (srcStat, destStat, src, dest, opts) {
50
+ if (!destStat) return copyFile(srcStat, src, dest, opts)
51
+ return mayCopyFile(srcStat, src, dest, opts)
52
+ }
53
+
54
+ function mayCopyFile (srcStat, src, dest, opts) {
55
+ if (opts.overwrite) {
56
+ fs.unlinkSync(dest)
57
+ return copyFile(srcStat, src, dest, opts)
58
+ } else if (opts.errorOnExist) {
59
+ throw new Error(`'${dest}' already exists`)
60
+ }
61
+ }
62
+
63
+ function copyFile (srcStat, src, dest, opts) {
64
+ fs.copyFileSync(src, dest)
65
+ if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
66
+ return setDestMode(dest, srcStat.mode)
67
+ }
68
+
69
+ function handleTimestamps (srcMode, src, dest) {
70
+ // Make sure the file is writable before setting the timestamp
71
+ // otherwise open fails with EPERM when invoked with 'r+'
72
+ // (through utimes call)
73
+ if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
74
+ return setDestTimestamps(src, dest)
75
+ }
76
+
77
+ function fileIsNotWritable (srcMode) {
78
+ return (srcMode & 0o200) === 0
79
+ }
80
+
81
+ function makeFileWritable (dest, srcMode) {
82
+ return setDestMode(dest, srcMode | 0o200)
83
+ }
84
+
85
+ function setDestMode (dest, srcMode) {
86
+ return fs.chmodSync(dest, srcMode)
87
+ }
88
+
89
+ function setDestTimestamps (src, dest) {
90
+ // The initial srcStat.atime cannot be trusted
91
+ // because it is modified by the read(2) system call
92
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
93
+ const updatedSrcStat = fs.statSync(src)
94
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
95
+ }
96
+
97
+ function onDir (srcStat, destStat, src, dest, opts) {
98
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
99
+ return copyDir(src, dest, opts)
100
+ }
101
+
102
+ function mkDirAndCopy (srcMode, src, dest, opts) {
103
+ fs.mkdirSync(dest)
104
+ copyDir(src, dest, opts)
105
+ return setDestMode(dest, srcMode)
106
+ }
107
+
108
+ function copyDir (src, dest, opts) {
109
+ fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))
110
+ }
111
+
112
+ function copyDirItem (item, src, dest, opts) {
113
+ const srcItem = path.join(src, item)
114
+ const destItem = path.join(dest, item)
115
+ if (opts.filter && !opts.filter(srcItem, destItem)) return
116
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
117
+ return getStats(destStat, srcItem, destItem, opts)
118
+ }
119
+
120
+ function onLink (destStat, src, dest, opts) {
121
+ let resolvedSrc = fs.readlinkSync(src)
122
+ if (opts.dereference) {
123
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
124
+ }
125
+
126
+ if (!destStat) {
127
+ return fs.symlinkSync(resolvedSrc, dest)
128
+ } else {
129
+ let resolvedDest
130
+ try {
131
+ resolvedDest = fs.readlinkSync(dest)
132
+ } catch (err) {
133
+ // dest exists and is a regular file or directory,
134
+ // Windows may throw UNKNOWN error. If dest already exists,
135
+ // fs throws error anyway, so no need to guard against it here.
136
+ if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)
137
+ throw err
138
+ }
139
+ if (opts.dereference) {
140
+ resolvedDest = path.resolve(process.cwd(), resolvedDest)
141
+ }
142
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
143
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
144
+ }
145
+
146
+ // prevent copy if src is a subdir of dest since unlinking
147
+ // dest in this case would result in removing src contents
148
+ // and therefore a broken symlink would be created.
149
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
150
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
151
+ }
152
+ return copyLink(resolvedSrc, dest)
153
+ }
154
+ }
155
+
156
+ function copyLink (resolvedSrc, dest) {
157
+ fs.unlinkSync(dest)
158
+ return fs.symlinkSync(resolvedSrc, dest)
159
+ }
160
+
161
+ module.exports = copySync
@@ -0,0 +1,177 @@
1
+ 'use strict'
2
+
3
+ const fs = require('../fs')
4
+ const path = require('path')
5
+ const { mkdirs } = require('../mkdirs')
6
+ const { pathExists } = require('../path-exists')
7
+ const { utimesMillis } = require('../util/utimes')
8
+ const stat = require('../util/stat')
9
+
10
+ async function copy (src, dest, opts = {}) {
11
+ if (typeof opts === 'function') {
12
+ opts = { filter: opts }
13
+ }
14
+
15
+ opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
16
+ opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
17
+
18
+ // Warn about using preserveTimestamps on 32-bit node
19
+ if (opts.preserveTimestamps && process.arch === 'ia32') {
20
+ process.emitWarning(
21
+ 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
22
+ '\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
23
+ 'Warning', 'fs-extra-WARN0001'
24
+ )
25
+ }
26
+
27
+ const { srcStat, destStat } = await stat.checkPaths(src, dest, 'copy', opts)
28
+
29
+ await stat.checkParentPaths(src, srcStat, dest, 'copy')
30
+
31
+ const include = await runFilter(src, dest, opts)
32
+
33
+ if (!include) return
34
+
35
+ // check if the parent of dest exists, and create it if it doesn't exist
36
+ const destParent = path.dirname(dest)
37
+ const dirExists = await pathExists(destParent)
38
+ if (!dirExists) {
39
+ await mkdirs(destParent)
40
+ }
41
+
42
+ await getStatsAndPerformCopy(destStat, src, dest, opts)
43
+ }
44
+
45
+ async function runFilter (src, dest, opts) {
46
+ if (!opts.filter) return true
47
+ return opts.filter(src, dest)
48
+ }
49
+
50
+ async function getStatsAndPerformCopy (destStat, src, dest, opts) {
51
+ const statFn = opts.dereference ? fs.stat : fs.lstat
52
+ const srcStat = await statFn(src)
53
+
54
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
55
+
56
+ if (
57
+ srcStat.isFile() ||
58
+ srcStat.isCharacterDevice() ||
59
+ srcStat.isBlockDevice()
60
+ ) return onFile(srcStat, destStat, src, dest, opts)
61
+
62
+ if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
63
+ if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
64
+ if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
65
+ throw new Error(`Unknown file: ${src}`)
66
+ }
67
+
68
+ async function onFile (srcStat, destStat, src, dest, opts) {
69
+ if (!destStat) return copyFile(srcStat, src, dest, opts)
70
+
71
+ if (opts.overwrite) {
72
+ await fs.unlink(dest)
73
+ return copyFile(srcStat, src, dest, opts)
74
+ }
75
+ if (opts.errorOnExist) {
76
+ throw new Error(`'${dest}' already exists`)
77
+ }
78
+ }
79
+
80
+ async function copyFile (srcStat, src, dest, opts) {
81
+ await fs.copyFile(src, dest)
82
+ if (opts.preserveTimestamps) {
83
+ // Make sure the file is writable before setting the timestamp
84
+ // otherwise open fails with EPERM when invoked with 'r+'
85
+ // (through utimes call)
86
+ if (fileIsNotWritable(srcStat.mode)) {
87
+ await makeFileWritable(dest, srcStat.mode)
88
+ }
89
+
90
+ // Set timestamps and mode correspondingly
91
+
92
+ // Note that The initial srcStat.atime cannot be trusted
93
+ // because it is modified by the read(2) system call
94
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
95
+ const updatedSrcStat = await fs.stat(src)
96
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
97
+ }
98
+
99
+ return fs.chmod(dest, srcStat.mode)
100
+ }
101
+
102
+ function fileIsNotWritable (srcMode) {
103
+ return (srcMode & 0o200) === 0
104
+ }
105
+
106
+ function makeFileWritable (dest, srcMode) {
107
+ return fs.chmod(dest, srcMode | 0o200)
108
+ }
109
+
110
+ async function onDir (srcStat, destStat, src, dest, opts) {
111
+ // the dest directory might not exist, create it
112
+ if (!destStat) {
113
+ await fs.mkdir(dest)
114
+ }
115
+
116
+ const items = await fs.readdir(src)
117
+
118
+ // loop through the files in the current directory to copy everything
119
+ await Promise.all(items.map(async item => {
120
+ const srcItem = path.join(src, item)
121
+ const destItem = path.join(dest, item)
122
+
123
+ // skip the item if it is matches by the filter function
124
+ const include = await runFilter(srcItem, destItem, opts)
125
+ if (!include) return
126
+
127
+ const { destStat } = await stat.checkPaths(srcItem, destItem, 'copy', opts)
128
+
129
+ // If the item is a copyable file, `getStatsAndPerformCopy` will copy it
130
+ // If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively
131
+ return getStatsAndPerformCopy(destStat, srcItem, destItem, opts)
132
+ }))
133
+
134
+ if (!destStat) {
135
+ await fs.chmod(dest, srcStat.mode)
136
+ }
137
+ }
138
+
139
+ async function onLink (destStat, src, dest, opts) {
140
+ let resolvedSrc = await fs.readlink(src)
141
+ if (opts.dereference) {
142
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
143
+ }
144
+ if (!destStat) {
145
+ return fs.symlink(resolvedSrc, dest)
146
+ }
147
+
148
+ let resolvedDest = null
149
+ try {
150
+ resolvedDest = await fs.readlink(dest)
151
+ } catch (e) {
152
+ // dest exists and is a regular file or directory,
153
+ // Windows may throw UNKNOWN error. If dest already exists,
154
+ // fs throws error anyway, so no need to guard against it here.
155
+ if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest)
156
+ throw e
157
+ }
158
+ if (opts.dereference) {
159
+ resolvedDest = path.resolve(process.cwd(), resolvedDest)
160
+ }
161
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
162
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
163
+ }
164
+
165
+ // do not copy if src is a subdir of dest since unlinking
166
+ // dest in this case would result in removing src contents
167
+ // and therefore a broken symlink would be created.
168
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
169
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
170
+ }
171
+
172
+ // copy the link
173
+ await fs.unlink(dest)
174
+ return fs.symlink(resolvedSrc, dest)
175
+ }
176
+
177
+ module.exports = copy
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromPromise
4
+ module.exports = {
5
+ copy: u(require('./copy')),
6
+ copySync: require('./copy-sync')
7
+ }
@@ -0,0 +1,39 @@
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 remove = require('../remove')
8
+
9
+ const emptyDir = u(async function emptyDir (dir) {
10
+ let items
11
+ try {
12
+ items = await fs.readdir(dir)
13
+ } catch {
14
+ return mkdir.mkdirs(dir)
15
+ }
16
+
17
+ return Promise.all(items.map(item => remove.remove(path.join(dir, item))))
18
+ })
19
+
20
+ function emptyDirSync (dir) {
21
+ let items
22
+ try {
23
+ items = fs.readdirSync(dir)
24
+ } catch {
25
+ return mkdir.mkdirsSync(dir)
26
+ }
27
+
28
+ items.forEach(item => {
29
+ item = path.join(dir, item)
30
+ remove.removeSync(item)
31
+ })
32
+ }
33
+
34
+ module.exports = {
35
+ emptyDirSync,
36
+ emptydirSync: emptyDirSync,
37
+ emptyDir,
38
+ emptydir: emptyDir
39
+ }
@@ -0,0 +1,66 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromPromise
4
+ const path = require('path')
5
+ const fs = require('../fs')
6
+ const mkdir = require('../mkdirs')
7
+
8
+ async function createFile (file) {
9
+ let stats
10
+ try {
11
+ stats = await fs.stat(file)
12
+ } catch { }
13
+ if (stats && stats.isFile()) return
14
+
15
+ const dir = path.dirname(file)
16
+
17
+ let dirStats = null
18
+ try {
19
+ dirStats = await fs.stat(dir)
20
+ } catch (err) {
21
+ // if the directory doesn't exist, make it
22
+ if (err.code === 'ENOENT') {
23
+ await mkdir.mkdirs(dir)
24
+ await fs.writeFile(file, '')
25
+ return
26
+ } else {
27
+ throw err
28
+ }
29
+ }
30
+
31
+ if (dirStats.isDirectory()) {
32
+ await fs.writeFile(file, '')
33
+ } else {
34
+ // parent is not a directory
35
+ // This is just to cause an internal ENOTDIR error to be thrown
36
+ await fs.readdir(dir)
37
+ }
38
+ }
39
+
40
+ function createFileSync (file) {
41
+ let stats
42
+ try {
43
+ stats = fs.statSync(file)
44
+ } catch { }
45
+ if (stats && stats.isFile()) return
46
+
47
+ const dir = path.dirname(file)
48
+ try {
49
+ if (!fs.statSync(dir).isDirectory()) {
50
+ // parent is not a directory
51
+ // This is just to cause an internal ENOTDIR error to be thrown
52
+ fs.readdirSync(dir)
53
+ }
54
+ } catch (err) {
55
+ // If the stat call above failed because the directory doesn't exist, create it
56
+ if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)
57
+ else throw err
58
+ }
59
+
60
+ fs.writeFileSync(file, '')
61
+ }
62
+
63
+ module.exports = {
64
+ createFile: u(createFile),
65
+ createFileSync
66
+ }
@@ -0,0 +1,23 @@
1
+ 'use strict'
2
+
3
+ const { createFile, createFileSync } = require('./file')
4
+ const { createLink, createLinkSync } = require('./link')
5
+ const { createSymlink, createSymlinkSync } = require('./symlink')
6
+
7
+ module.exports = {
8
+ // file
9
+ createFile,
10
+ createFileSync,
11
+ ensureFile: createFile,
12
+ ensureFileSync: createFileSync,
13
+ // link
14
+ createLink,
15
+ createLinkSync,
16
+ ensureLink: createLink,
17
+ ensureLinkSync: createLinkSync,
18
+ // symlink
19
+ createSymlink,
20
+ createSymlinkSync,
21
+ ensureSymlink: createSymlink,
22
+ ensureSymlinkSync: createSymlinkSync
23
+ }