@metad/contracts 3.6.2 → 3.6.7

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 (287) hide show
  1. package/.babelrc +5 -0
  2. package/.eslintrc.json +18 -0
  3. package/babel.config.json +1 -0
  4. package/index.cjs.js +5 -4233
  5. package/jest.config.ts +16 -0
  6. package/package.json +2 -2
  7. package/project.json +53 -0
  8. package/src/agent/{ai-model.d.ts → ai-model.ts} +2 -2
  9. package/src/agent/graph.ts +275 -0
  10. package/src/agent/index.ts +5 -0
  11. package/src/agent/token.ts +23 -0
  12. package/src/agent/utils.spec.ts +283 -0
  13. package/src/agent/utils.ts +122 -0
  14. package/src/agent/variables.ts +66 -0
  15. package/src/ai/ai-model.model.ts +232 -0
  16. package/src/ai/ai-provider.model.ts +53 -0
  17. package/src/ai/ai.model.ts +87 -0
  18. package/src/ai/chat-message-feedback.model.ts +31 -0
  19. package/src/ai/chat-message.model.ts +277 -0
  20. package/src/ai/chat.model.ts +207 -0
  21. package/src/ai/copilot-checkpoint.model.ts +25 -0
  22. package/src/ai/copilot-example.model.ts +23 -0
  23. package/src/ai/copilot-model.model.ts +31 -0
  24. package/src/ai/copilot-organization.model.ts +21 -0
  25. package/src/ai/copilot-provider.model.ts +46 -0
  26. package/src/ai/copilot-role.model.ts +48 -0
  27. package/src/ai/copilot-store.model.ts +34 -0
  28. package/src/ai/copilot-user.model.ts +24 -0
  29. package/src/ai/copilot.model.ts +47 -0
  30. package/src/ai/{environment.model.d.ts → environment.model.ts} +12 -10
  31. package/src/ai/feature.model.ts +6 -0
  32. package/src/ai/index.ts +40 -0
  33. package/src/ai/knowledge-doc-chunk.model.ts +123 -0
  34. package/src/ai/knowledge-doc-chunk.spec.ts +47 -0
  35. package/src/ai/knowledge-doc-page.model.ts +20 -0
  36. package/src/ai/knowledge-doc.model.ts +364 -0
  37. package/src/ai/knowledge-pipeline.ts +138 -0
  38. package/src/ai/knowledge-retrieval-log.model.ts +19 -0
  39. package/src/ai/knowledgebase-task.model.ts +46 -0
  40. package/src/ai/knowledgebase.model.ts +205 -0
  41. package/src/ai/rag-web.ts +54 -0
  42. package/src/ai/rag.ts +24 -0
  43. package/src/ai/role-permissions.ts +13 -0
  44. package/src/ai/types.ts +83 -0
  45. package/src/ai/xpert-agent-execution.model.ts +115 -0
  46. package/src/ai/xpert-agent.model.ts +264 -0
  47. package/src/ai/xpert-project.model.ts +103 -0
  48. package/src/ai/xpert-table.model.ts +100 -0
  49. package/src/ai/xpert-task.model.ts +32 -0
  50. package/src/ai/xpert-template.model.ts +53 -0
  51. package/src/ai/xpert-tool-mcp.model.ts +77 -0
  52. package/src/ai/xpert-tool.model.ts +216 -0
  53. package/src/ai/xpert-toolset.model.ts +220 -0
  54. package/src/ai/xpert-workflow-task.prompt.ts +71 -0
  55. package/src/ai/xpert-workflow.model.ts +502 -0
  56. package/src/ai/xpert-workspace.model.ts +42 -0
  57. package/src/ai/xpert.model.ts +637 -0
  58. package/src/ai/xpert.utils.ts +214 -0
  59. package/src/analytics/ai.ts +79 -0
  60. package/src/analytics/approval-policy.model.ts +40 -0
  61. package/src/analytics/business-area-user.model.ts +43 -0
  62. package/src/analytics/business-area.ts +20 -0
  63. package/src/analytics/certification.model.ts +12 -0
  64. package/src/analytics/chatbi-conversation.model.ts +16 -0
  65. package/src/analytics/chatbi-model.model.ts +22 -0
  66. package/src/analytics/collection.model.ts +8 -0
  67. package/src/analytics/comment.model.ts +14 -0
  68. package/src/analytics/data-source-type.ts +19 -0
  69. package/src/analytics/data-source.ts +72 -0
  70. package/src/analytics/favorite.ts +18 -0
  71. package/src/analytics/features.ts +19 -0
  72. package/src/analytics/feed-model.ts +15 -0
  73. package/src/analytics/gateway.ts +31 -0
  74. package/src/analytics/index.ts +39 -0
  75. package/src/analytics/indicator-app.ts +49 -0
  76. package/src/analytics/{indicator-market.d.ts → indicator-market.ts} +6 -2
  77. package/src/analytics/indicator.ts +143 -0
  78. package/src/analytics/model-query-log.model.ts +45 -0
  79. package/src/analytics/model-query.ts +22 -0
  80. package/src/analytics/{notification-destination.d.ts → notification-destination.ts} +9 -5
  81. package/src/analytics/{permission-approval-user.model.d.ts → permission-approval-user.model.ts} +10 -8
  82. package/src/analytics/permission-approval.model.ts +58 -0
  83. package/src/analytics/project.model.ts +56 -0
  84. package/src/analytics/role-permissions.ts +36 -0
  85. package/src/analytics/schema.ts +300 -0
  86. package/src/analytics/screenshot.model.ts +28 -0
  87. package/src/analytics/semantic-model-entity.ts +50 -0
  88. package/src/analytics/semantic-model-member.ts +49 -0
  89. package/src/analytics/semantic-model.ts +237 -0
  90. package/src/analytics/{story-point.d.ts → story-point.ts} +11 -6
  91. package/src/analytics/story-template.model.ts +34 -0
  92. package/src/analytics/story-widget.ts +15 -0
  93. package/src/analytics/story.ts +109 -0
  94. package/src/analytics/subscription.ts +43 -0
  95. package/src/analytics/visit.model.ts +39 -0
  96. package/src/analytics/webSocket.ts +53 -0
  97. package/src/api-key.model.ts +11 -0
  98. package/src/base-entity.model.ts +34 -0
  99. package/src/contact.model.ts +45 -0
  100. package/src/core.model.ts +103 -0
  101. package/src/{country.model.d.ts → country.model.ts} +3 -2
  102. package/src/currency.model.ts +582 -0
  103. package/src/{custom-smtp.model.d.ts → custom-smtp.model.ts} +21 -17
  104. package/src/date-picker.model.ts +5 -0
  105. package/src/email-template.model.ts +50 -0
  106. package/src/email.model.ts +46 -0
  107. package/src/employee.model.ts +199 -0
  108. package/src/entity-with-members.model.ts +16 -0
  109. package/src/feature.model.ts +108 -0
  110. package/src/file-provider.ts +37 -0
  111. package/src/help-center-article.model.ts +35 -0
  112. package/src/help-center.model.ts +33 -0
  113. package/src/http-status.enum.ts +58 -0
  114. package/src/import-export.model.ts +42 -0
  115. package/src/index.ts +60 -0
  116. package/src/integration/dify.ts +31 -0
  117. package/src/integration/dingtalk.ts +16 -0
  118. package/src/integration/fastgpt.ts +32 -0
  119. package/src/integration/firecrawl.ts +46 -0
  120. package/src/integration/github.ts +149 -0
  121. package/src/integration/index.ts +15 -0
  122. package/src/integration/lark.ts +79 -0
  123. package/src/integration/wecom.ts +16 -0
  124. package/src/integration.model.ts +119 -0
  125. package/src/invite.model.ts +144 -0
  126. package/src/language.model.ts +22 -0
  127. package/src/organization-contact.model.ts +84 -0
  128. package/src/{organization-department.model.d.ts → organization-department.model.ts} +16 -10
  129. package/src/organization-language.model.ts +24 -0
  130. package/src/organization-projects.model.ts +99 -0
  131. package/src/organization-team-employee-model.ts +14 -0
  132. package/src/organization-team-model.ts +25 -0
  133. package/src/organization.model.ts +266 -0
  134. package/src/{password-reset.model.d.ts → password-reset.model.ts} +14 -10
  135. package/src/{plain-object.model.d.ts → plain-object.model.ts} +1 -1
  136. package/src/plugin.ts +15 -0
  137. package/src/role-permission.model.ts +123 -0
  138. package/src/role.model.ts +31 -0
  139. package/src/schedule.ts +71 -0
  140. package/src/secret-token.model.ts +15 -0
  141. package/src/seed.model.ts +50 -0
  142. package/src/storage-file.model.ts +46 -0
  143. package/src/tag-entity.model.ts +23 -0
  144. package/src/tenant.model.ts +52 -0
  145. package/src/tools/index.ts +1 -0
  146. package/src/tools/sandbox.ts +5 -0
  147. package/src/translation.model.ts +37 -0
  148. package/src/types.ts +277 -0
  149. package/src/user-organization.model.ts +31 -0
  150. package/src/user.model.ts +151 -0
  151. package/src/visibility.model.ts +6 -0
  152. package/tsconfig.json +22 -0
  153. package/tsconfig.lib.json +10 -0
  154. package/tsconfig.spec.json +9 -0
  155. package/index.cjs.d.ts +0 -1
  156. package/index.esm.d.ts +0 -1
  157. package/index.esm.js +0 -4129
  158. package/src/agent/graph.d.ts +0 -148
  159. package/src/agent/index.d.ts +0 -5
  160. package/src/agent/token.d.ts +0 -21
  161. package/src/agent/utils.d.ts +0 -19
  162. package/src/agent/variables.d.ts +0 -14
  163. package/src/ai/ai-model.model.d.ts +0 -198
  164. package/src/ai/ai-provider.model.d.ts +0 -43
  165. package/src/ai/ai.model.d.ts +0 -82
  166. package/src/ai/chat-message-feedback.model.d.ts +0 -24
  167. package/src/ai/chat-message.model.d.ts +0 -222
  168. package/src/ai/chat.model.d.ts +0 -189
  169. package/src/ai/copilot-checkpoint.model.d.ts +0 -23
  170. package/src/ai/copilot-example.model.d.ts +0 -19
  171. package/src/ai/copilot-model.model.d.ts +0 -26
  172. package/src/ai/copilot-organization.model.d.ts +0 -17
  173. package/src/ai/copilot-provider.model.d.ts +0 -31
  174. package/src/ai/copilot-role.model.d.ts +0 -43
  175. package/src/ai/copilot-store.model.d.ts +0 -29
  176. package/src/ai/copilot-user.model.d.ts +0 -20
  177. package/src/ai/copilot.model.d.ts +0 -36
  178. package/src/ai/feature.model.d.ts +0 -6
  179. package/src/ai/index.d.ts +0 -39
  180. package/src/ai/knowledge-doc-chunk.model.d.ts +0 -60
  181. package/src/ai/knowledge-doc-page.model.d.ts +0 -15
  182. package/src/ai/knowledge-doc.model.d.ts +0 -192
  183. package/src/ai/knowledge-pipeline.d.ts +0 -107
  184. package/src/ai/knowledge-retrieval-log.model.d.ts +0 -10
  185. package/src/ai/knowledgebase-task.model.d.ts +0 -39
  186. package/src/ai/knowledgebase.model.d.ts +0 -162
  187. package/src/ai/rag-web.d.ts +0 -26
  188. package/src/ai/rag.d.ts +0 -24
  189. package/src/ai/role-permissions.d.ts +0 -13
  190. package/src/ai/types.d.ts +0 -39
  191. package/src/ai/xpert-agent-execution.model.d.ts +0 -96
  192. package/src/ai/xpert-agent.model.d.ts +0 -192
  193. package/src/ai/xpert-project.model.d.ts +0 -86
  194. package/src/ai/xpert-task.model.d.ts +0 -26
  195. package/src/ai/xpert-template.model.d.ts +0 -47
  196. package/src/ai/xpert-tool-mcp.model.d.ts +0 -67
  197. package/src/ai/xpert-tool.model.d.ts +0 -147
  198. package/src/ai/xpert-toolset.model.d.ts +0 -200
  199. package/src/ai/xpert-workflow-task.prompt.d.ts +0 -2
  200. package/src/ai/xpert-workflow.model.d.ts +0 -366
  201. package/src/ai/xpert-workspace.model.d.ts +0 -32
  202. package/src/ai/xpert.model.d.ts +0 -529
  203. package/src/ai/xpert.utils.d.ts +0 -80
  204. package/src/analytics/ai.d.ts +0 -73
  205. package/src/analytics/approval-policy.model.d.ts +0 -30
  206. package/src/analytics/business-area-user.model.d.ts +0 -35
  207. package/src/analytics/business-area.d.ts +0 -17
  208. package/src/analytics/certification.model.d.ts +0 -11
  209. package/src/analytics/chatbi-conversation.model.d.ts +0 -15
  210. package/src/analytics/chatbi-model.model.d.ts +0 -18
  211. package/src/analytics/collection.model.d.ts +0 -6
  212. package/src/analytics/comment.model.d.ts +0 -10
  213. package/src/analytics/data-source-type.d.ts +0 -16
  214. package/src/analytics/data-source.d.ts +0 -62
  215. package/src/analytics/favorite.d.ts +0 -14
  216. package/src/analytics/features.d.ts +0 -19
  217. package/src/analytics/feed-model.d.ts +0 -13
  218. package/src/analytics/gateway.d.ts +0 -27
  219. package/src/analytics/index.d.ts +0 -38
  220. package/src/analytics/indicator-app.d.ts +0 -44
  221. package/src/analytics/indicator.d.ts +0 -106
  222. package/src/analytics/model-query-log.model.d.ts +0 -41
  223. package/src/analytics/model-query.d.ts +0 -21
  224. package/src/analytics/permission-approval.model.d.ts +0 -47
  225. package/src/analytics/project.model.d.ts +0 -50
  226. package/src/analytics/role-permissions.d.ts +0 -25
  227. package/src/analytics/schema.d.ts +0 -262
  228. package/src/analytics/screenshot.model.d.ts +0 -25
  229. package/src/analytics/semantic-model-entity.d.ts +0 -37
  230. package/src/analytics/semantic-model-member.d.ts +0 -24
  231. package/src/analytics/semantic-model.d.ts +0 -175
  232. package/src/analytics/story-template.model.d.ts +0 -28
  233. package/src/analytics/story-widget.d.ts +0 -12
  234. package/src/analytics/story.d.ts +0 -93
  235. package/src/analytics/subscription.d.ts +0 -38
  236. package/src/analytics/visit.model.d.ts +0 -34
  237. package/src/analytics/webSocket.d.ts +0 -48
  238. package/src/api-key.model.d.ts +0 -10
  239. package/src/base-entity.model.d.ts +0 -27
  240. package/src/contact.model.d.ts +0 -41
  241. package/src/core.model.d.ts +0 -97
  242. package/src/currency.model.d.ts +0 -579
  243. package/src/date-picker.model.d.ts +0 -5
  244. package/src/email-template.model.d.ts +0 -39
  245. package/src/email.model.d.ts +0 -36
  246. package/src/employee.model.d.ts +0 -128
  247. package/src/entity-with-members.model.d.ts +0 -13
  248. package/src/feature.model.d.ts +0 -93
  249. package/src/file-provider.d.ts +0 -33
  250. package/src/help-center-article.model.d.ts +0 -0
  251. package/src/help-center.model.d.ts +0 -0
  252. package/src/http-status.enum.d.ts +0 -57
  253. package/src/import-export.model.d.ts +0 -36
  254. package/src/index.d.ts +0 -48
  255. package/src/integration/dify.d.ts +0 -0
  256. package/src/integration/dingtalk.d.ts +0 -2
  257. package/src/integration/fastgpt.d.ts +0 -0
  258. package/src/integration/firecrawl.d.ts +0 -2
  259. package/src/integration/github.d.ts +0 -69
  260. package/src/integration/index.d.ts +0 -4
  261. package/src/integration/lark.d.ts +0 -11
  262. package/src/integration/wecom.d.ts +0 -2
  263. package/src/integration.model.d.ts +0 -90
  264. package/src/invite.model.d.ts +0 -123
  265. package/src/language.model.d.ts +0 -19
  266. package/src/organization-contact.model.d.ts +0 -73
  267. package/src/organization-language.model.d.ts +0 -18
  268. package/src/organization-projects.model.d.ts +0 -80
  269. package/src/organization-team-employee-model.d.ts +0 -12
  270. package/src/organization-team-model.d.ts +0 -19
  271. package/src/organization.model.d.ts +0 -239
  272. package/src/plugin.d.ts +0 -13
  273. package/src/role-permission.model.d.ts +0 -61
  274. package/src/role.model.d.ts +0 -26
  275. package/src/schedule.d.ts +0 -27
  276. package/src/secret-token.model.d.ts +0 -11
  277. package/src/seed.model.d.ts +0 -37
  278. package/src/storage-file.model.d.ts +0 -40
  279. package/src/tag-entity.model.d.ts +0 -20
  280. package/src/tenant.model.d.ts +0 -40
  281. package/src/tools/index.d.ts +0 -1
  282. package/src/tools/sandbox.d.ts +0 -5
  283. package/src/translation.model.d.ts +0 -26
  284. package/src/types.d.ts +0 -241
  285. package/src/user-organization.model.d.ts +0 -24
  286. package/src/user.model.d.ts +0 -131
  287. package/src/visibility.model.d.ts +0 -6
@@ -0,0 +1,123 @@
1
+ import { AnalyticsPermissionsEnum } from './analytics/index'
2
+ import { AIPermissionsEnum } from './ai/index'
3
+ import { IBasePerTenantEntityModel } from './base-entity.model'
4
+ import { IRole } from './role.model'
5
+
6
+ export interface IRolePermission extends IBasePerTenantEntityModel {
7
+ roleId: string
8
+ permission: string
9
+ role: IRole
10
+ enabled: boolean
11
+ }
12
+
13
+ export interface IRolePermissionMigrateInput extends IBasePerTenantEntityModel {
14
+ permission: string
15
+ role: string
16
+ isImporting: boolean
17
+ sourceId: string
18
+ }
19
+
20
+ export interface IRolePermissionCreateInput extends IBasePerTenantEntityModel {
21
+ roleId: string
22
+ permission: string
23
+ enabled: boolean
24
+ }
25
+
26
+ export interface IRolePermissionUpdateInput {
27
+ enabled: boolean
28
+ }
29
+
30
+ export enum PermissionsEnum {
31
+ PROFILE_EDIT = 'PROFILE_EDIT',
32
+ ADMIN_DASHBOARD_VIEW = 'ADMIN_DASHBOARD_VIEW',
33
+ ORG_EMPLOYEES_VIEW = 'ORG_EMPLOYEES_VIEW',
34
+ ORG_EMPLOYEES_EDIT = 'ORG_EMPLOYEES_EDIT',
35
+ ORG_TAGS_EDIT = 'ORG_TAGS_EDIT',
36
+ ORG_USERS_VIEW = 'ORG_USERS_VIEW',
37
+ ORG_USERS_EDIT = 'ORG_USERS_EDIT',
38
+ ORG_INVITE_VIEW = 'ORG_INVITE_VIEW',
39
+ ORG_INVITE_EDIT = 'ORG_INVITE_EDIT',
40
+ ALL_ORG_VIEW = 'ALL_ORG_VIEW',
41
+ ALL_ORG_EDIT = 'ALL_ORG_EDIT',
42
+ APPROVAL_POLICY_VIEW = 'APPROVALS_POLICY_VIEW',
43
+ APPROVAL_POLICY_EDIT = 'APPROVALS_POLICY_EDIT',
44
+ CHANGE_SELECTED_ORGANIZATION = 'CHANGE_SELECTED_ORGANIZATION',
45
+ CHANGE_ROLES_PERMISSIONS = 'CHANGE_ROLES_PERMISSIONS',
46
+ SUPER_ADMIN_EDIT = 'SUPER_ADMIN_EDIT',
47
+ PUBLIC_PAGE_EDIT = 'PUBLIC_PAGE_EDIT',
48
+ VIEW_ALL_EMAILS = 'VIEW_ALL_EMAILS',
49
+ VIEW_ALL_EMAIL_TEMPLATES = 'VIEW_ALL_EMAIL_TEMPLATES',
50
+ ORG_HELP_CENTER_EDIT = 'ORG_HELP_CENTER_EDIT',
51
+ ORG_CONTACT_EDIT = 'ORG_CONTACT_EDIT',
52
+ ORG_CONTACT_VIEW = 'ORG_CONTACT_VIEW',
53
+ ORG_DEMO_EDIT = 'ORG_DEMO_EDIT', // Orgnization demo edit permission
54
+ INTEGRATION_EDIT = 'INTEGRATION_EDIT',
55
+ INTEGRATION_VIEW = 'INTEGRATION_VIEW',
56
+ FILE_STORAGE_VIEW = 'FILE_STORAGE_VIEW',
57
+ SMS_GATEWAY_VIEW = 'SMS_GATEWAY_VIEW',
58
+ CUSTOM_SMTP_VIEW = 'CUSTOM_SMTP_VIEW',
59
+ VIEW_ALL_ACCOUNTING_TEMPLATES = 'VIEW_ALL_ACCOUNTING_TEMPLATES',
60
+ ACCESS_DELETE_ACCOUNT = 'ACCESS_DELETE_ACCOUNT',
61
+ ACCESS_DELETE_ALL_DATA = 'ACCESS_DELETE_ALL_DATA'
62
+ }
63
+
64
+ export const PermissionGroups = {
65
+ //Permissions which can be given to any role
66
+ GENERAL: [
67
+ PermissionsEnum.PROFILE_EDIT,
68
+ PermissionsEnum.ADMIN_DASHBOARD_VIEW,
69
+ PermissionsEnum.ORG_INVITE_VIEW,
70
+ PermissionsEnum.ORG_INVITE_EDIT,
71
+ // PermissionsEnum.ORG_TAGS_EDIT,
72
+ PermissionsEnum.VIEW_ALL_EMAILS,
73
+ PermissionsEnum.VIEW_ALL_EMAIL_TEMPLATES,
74
+ // PermissionsEnum.ORG_HELP_CENTER_EDIT,
75
+ PermissionsEnum.INTEGRATION_EDIT,
76
+ // PermissionsEnum.ORG_CONTACT_VIEW,
77
+ PermissionsEnum.ORG_DEMO_EDIT,
78
+ // PermissionsEnum.VIEW_ALL_ACCOUNTING_TEMPLATES,
79
+
80
+ // AI
81
+ AIPermissionsEnum.KNOWLEDGEBASE_EDIT,
82
+ AIPermissionsEnum.COPILOT_VIEW,
83
+ AIPermissionsEnum.COPILOT_EDIT,
84
+ AIPermissionsEnum.XPERT_EDIT,
85
+ AIPermissionsEnum.CHAT_VIEW,
86
+
87
+ // DataSource
88
+ AnalyticsPermissionsEnum.DATA_SOURCE_VIEW,
89
+ AnalyticsPermissionsEnum.DATA_SOURCE_EDIT,
90
+ // Semantic Model
91
+ AnalyticsPermissionsEnum.MODELS_VIEW,
92
+ AnalyticsPermissionsEnum.MODELS_EDIT,
93
+ // Story
94
+ AnalyticsPermissionsEnum.STORIES_VIEW,
95
+ AnalyticsPermissionsEnum.STORIES_EDIT,
96
+ // Business Area
97
+ AnalyticsPermissionsEnum.BUSINESS_AREA_VIEW,
98
+ AnalyticsPermissionsEnum.BUSINESS_AREA_EDIT,
99
+ // Certification
100
+ AnalyticsPermissionsEnum.CERTIFICATION_EDIT,
101
+ // Indicator
102
+ AnalyticsPermissionsEnum.INDICATOR_VIEW,
103
+ AnalyticsPermissionsEnum.INDICATOR_MARTKET_VIEW,
104
+ AnalyticsPermissionsEnum.INDICATOR_EDIT,
105
+ // Data Factory
106
+ AnalyticsPermissionsEnum.DATA_FACTORY_VIEW,
107
+ AnalyticsPermissionsEnum.DATA_FACTORY_EDIT,
108
+ ],
109
+
110
+ //Readonly permissions, are only enabled for admin role
111
+ ADMINISTRATION: [
112
+ PermissionsEnum.ORG_USERS_VIEW,
113
+ PermissionsEnum.ORG_USERS_EDIT,
114
+ PermissionsEnum.ALL_ORG_VIEW,
115
+ PermissionsEnum.ALL_ORG_EDIT,
116
+ PermissionsEnum.CHANGE_SELECTED_ORGANIZATION,
117
+ PermissionsEnum.CHANGE_ROLES_PERMISSIONS,
118
+ PermissionsEnum.SUPER_ADMIN_EDIT,
119
+ PermissionsEnum.INTEGRATION_VIEW,
120
+ PermissionsEnum.ACCESS_DELETE_ACCOUNT,
121
+ PermissionsEnum.ACCESS_DELETE_ALL_DATA
122
+ ]
123
+ }
@@ -0,0 +1,31 @@
1
+ import { IUser } from './user.model';
2
+ import { IBasePerTenantEntityModel } from './base-entity.model';
3
+ import { IRolePermission } from './role-permission.model';
4
+
5
+ export interface IRole extends IRoleCreateInput {
6
+ isSystem?: boolean;
7
+ rolePermissions?: IRolePermission[];
8
+ users?: IUser[];
9
+ }
10
+
11
+ export interface IRoleCreateInput extends IBasePerTenantEntityModel {
12
+ name: string
13
+ }
14
+
15
+ export enum RolesEnum {
16
+ SUPER_ADMIN = 'SUPER_ADMIN',
17
+ ADMIN = 'ADMIN',
18
+ DATA_ENTRY = 'DATA_ENTRY',
19
+ EMPLOYEE = 'EMPLOYEE',
20
+ CANDIDATE = 'CANDIDATE',
21
+ MANAGER = 'MANAGER',
22
+ VIEWER = 'VIEWER',
23
+ // 有所免费用户
24
+ TRIAL = 'TRIAL'
25
+ }
26
+
27
+ export interface IRoleMigrateInput extends IBasePerTenantEntityModel {
28
+ name: string;
29
+ isImporting: boolean;
30
+ sourceId: string;
31
+ }
@@ -0,0 +1,71 @@
1
+ export enum ScheduleTaskStatus {
2
+ PAUSED = 'paused',
3
+ ARCHIVED = 'archived',
4
+ SCHEDULED = 'scheduled',
5
+ }
6
+ export enum TaskFrequency {
7
+ Once = 'Once',
8
+ Daily = 'Daily',
9
+ Weekly = 'Weekly',
10
+ Monthly = 'Monthly',
11
+ Yearly = 'Yearly',
12
+ }
13
+
14
+ export type TScheduleOptions = {
15
+ frequency: TaskFrequency
16
+ time: string; // 'HH:mm'
17
+ dayOfWeek?: number; // 0-6 (0 = Sunday)
18
+ dayOfMonth?: number; // 1-31
19
+ month?: number; // 1-12
20
+ date?: string; // 'YYYY-MM-DD'
21
+ }
22
+
23
+ /**
24
+ * Generate cron expression: Minutes Hour Day Month Week
25
+ *
26
+ * @param schedule
27
+ * @returns
28
+ */
29
+ export function generateCronExpression(schedule: TScheduleOptions): string {
30
+ if (!schedule.time) throw new Error('Time is required for scheduling');
31
+
32
+ const [hourStr, minuteStr] = schedule.time.split(':');
33
+ const hour = parseInt(hourStr, 10);
34
+ const minute = parseInt(minuteStr, 10);
35
+
36
+ if (isNaN(hour) || isNaN(minute) || hour < 0 || hour > 23 || minute < 0 || minute > 59) {
37
+ throw new Error('Invalid time format. Expected HH:mm with valid hour and minute.');
38
+ }
39
+
40
+ switch (schedule.frequency) {
41
+ case TaskFrequency.Once: {
42
+ if (!schedule.date) throw new Error('Date is required for Once schedule');
43
+ const date = new Date(schedule.date);
44
+ // if (isNaN(date.getTime())) throw new Error('Invalid date format for Once schedule');
45
+ return `${minute} ${hour} ${date.getDate()} ${date.getMonth() + 1} *`;
46
+ }
47
+
48
+ case TaskFrequency.Daily:
49
+ return `${minute} ${hour} * * *`;
50
+
51
+ case TaskFrequency.Weekly:
52
+ if (schedule.dayOfWeek === undefined || schedule.dayOfWeek < 0 || schedule.dayOfWeek > 6)
53
+ throw new Error('Valid dayOfWeek (0-6) is required for Weekly schedule');
54
+ return `${minute} ${hour} * * ${schedule.dayOfWeek}`;
55
+
56
+ case TaskFrequency.Monthly:
57
+ if (!schedule.dayOfMonth || schedule.dayOfMonth < 1 || schedule.dayOfMonth > 31)
58
+ throw new Error('Valid dayOfMonth (1-31) is required for Monthly schedule');
59
+ return `${minute} ${hour} ${schedule.dayOfMonth} * *`;
60
+
61
+ case TaskFrequency.Yearly: {
62
+ if (!schedule.date) throw new Error('Date is required for Yearly schedule');
63
+ const date = new Date(schedule.date);
64
+ // if (isNaN(date.getTime())) throw new Error('Invalid date format for Yearly schedule');
65
+ return `${minute} ${hour} ${date.getDate()} ${date.getMonth() + 1} *`;
66
+ }
67
+
68
+ default:
69
+ throw new Error(`Unsupported frequency: ${schedule.frequency}`);
70
+ }
71
+ }
@@ -0,0 +1,15 @@
1
+ import { IBaseEntityModel } from './base-entity.model';
2
+
3
+ export interface ISecretToken
4
+ extends IBaseEntityModel {
5
+ entityId?: string
6
+ token: string;
7
+ validUntil?: Date;
8
+ expired?: boolean;
9
+ }
10
+
11
+ export interface ISecretTokenFindInput
12
+ extends IBaseEntityModel {
13
+ entityId?: string
14
+ token?: string;
15
+ }
@@ -0,0 +1,50 @@
1
+ import { CurrenciesEnum } from './currency.model';
2
+ import { DefaultValueDateTypeEnum } from './organization.model';
3
+ // import { ICandidateSource } from './candidate-source.model';
4
+ import { IUser, LanguagesEnum } from './user.model';
5
+
6
+ export interface IDefaultUser {
7
+ email: string;
8
+ password: string;
9
+ imageUrl: string;
10
+ firstName?: string;
11
+ lastName?: string;
12
+ preferredLanguage: LanguagesEnum;
13
+ // preferredComponentLayout: ComponentLayoutStyleEnum
14
+ }
15
+
16
+ export interface IDefaultEmployee extends IDefaultUser {
17
+ startedWorkOn?: string;
18
+ endWork?: string;
19
+ employeeLevel?: string;
20
+ }
21
+
22
+ // export interface IDefaultCandidate extends IDefaultUser {
23
+ // candidateLevel?: string;
24
+ // source?: ICandidateSource;
25
+ // }
26
+
27
+ export interface IDefaultOrganization {
28
+ name: string;
29
+ currency: CurrenciesEnum;
30
+ defaultValueDateType: DefaultValueDateTypeEnum;
31
+ imageUrl: string;
32
+ }
33
+
34
+ export interface ISeedUsers {
35
+ adminUsers: IUser[];
36
+ employeeUsers: IUser[];
37
+ candidateUsers: IUser[];
38
+ }
39
+
40
+ export interface IDefaultProductCategory {
41
+ name: string;
42
+ description: string;
43
+ imageUrl: string;
44
+ }
45
+
46
+ export interface IDefaultProductType {
47
+ name: string;
48
+ description: string;
49
+ icon: string;
50
+ }
@@ -0,0 +1,46 @@
1
+ import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model'
2
+ import { FileStorageProviderEnum } from './file-provider'
3
+ import { _TFile } from './types';
4
+
5
+ export type TFile = _TFile & {
6
+ fileType?: string;
7
+ contents?: string;
8
+ description?: string;
9
+ size?: number
10
+ createdAt?: Date
11
+
12
+ storageFileId?: string
13
+ }
14
+
15
+ export interface IStorageFile extends IBasePerTenantAndOrganizationEntityModel {
16
+ file: string
17
+ url?: string
18
+ thumb?: string
19
+ fileUrl?: string
20
+ thumbUrl?: string
21
+ originalName?: string
22
+ encoding?: string
23
+ size?: number
24
+ mimetype?: string
25
+ recordedAt?: Date
26
+ storageProvider?: FileStorageProviderEnum
27
+ }
28
+
29
+ export interface ICreateStorageFileInput extends IBasePerTenantAndOrganizationEntityModel {
30
+ activityTimestamp: string
31
+ employeeId?: string
32
+ file: string
33
+ thumb?: string
34
+ recordedAt: Date | string
35
+ }
36
+
37
+ export interface IUpdateStorageFileInput extends ICreateStorageFileInput {
38
+ id: string
39
+ }
40
+
41
+ export type TFileDirectory = TFile & {
42
+ fullPath?: string
43
+ directory?: string
44
+ hasChildren?: boolean
45
+ children?: TFileDirectory[]
46
+ }
@@ -0,0 +1,23 @@
1
+ import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
2
+ import { I18nObject } from './types';
3
+
4
+ export interface ITag extends IBasePerTenantAndOrganizationEntityModel {
5
+ name?: string;
6
+ label?: I18nObject
7
+ description?: string;
8
+ category?: TagCategoryEnum
9
+ color?: string
10
+ isSelected?: boolean;
11
+ icon?: string
12
+ }
13
+
14
+ export interface ITagName {
15
+ name?: string;
16
+ }
17
+
18
+ export enum TagCategoryEnum {
19
+ INDICATOR = 'indicator',
20
+ STORY = 'story',
21
+ TOOLSET = 'toolset',
22
+ XPERT = 'xpert'
23
+ }
@@ -0,0 +1,52 @@
1
+ import { IImportRecord } from './import-export.model';
2
+ import { IFeatureOrganization } from './feature.model';
3
+ import {
4
+ FileStorageProviderEnum,
5
+ S3FileStorageProviderConfig
6
+ } from './file-provider';
7
+ import { IOrganization, IOrganizationCreateInput } from './organization.model';
8
+ import { IRolePermission } from './role-permission.model';
9
+ import { IUserCreateInput } from './user.model';
10
+
11
+ export interface ITenant {
12
+ id?: string;
13
+ name?: string;
14
+
15
+ readonly createdAt?: Date;
16
+ readonly updatedAt?: Date;
17
+
18
+ organizations?: IOrganization[];
19
+ rolePermissions?: IRolePermission[];
20
+ featureOrganizations?: IFeatureOrganization[];
21
+ importRecords?: IImportRecord[];
22
+ settings?: ISetting[];
23
+ }
24
+
25
+ export interface ITenantCreateInput {
26
+ name: string;
27
+
28
+ isImporting?: boolean;
29
+ sourceId?: string;
30
+ userSourceId?: string;
31
+
32
+ superAdmin?: IUserCreateInput
33
+ defaultOrganization?: IOrganizationCreateInput
34
+ }
35
+
36
+ export interface ISetting {
37
+ name: string;
38
+ value: string;
39
+ }
40
+
41
+ export interface ITenantSetting extends S3FileStorageProviderConfig {
42
+ fileStorageProvider?: FileStorageProviderEnum;
43
+ tenant_title?: string
44
+ tenant_title_en?: string
45
+ tenant_enable_feishu?: boolean
46
+ tenant_enable_dingtalk?: boolean
47
+ tenant_enable_wechat?: boolean
48
+ tenant_enable_github?: boolean
49
+ tenant_enable_google?: boolean
50
+ }
51
+
52
+ export const DEFAULT_TENANT = 'Default Tenant';
@@ -0,0 +1 @@
1
+ export * from './sandbox'
@@ -0,0 +1,5 @@
1
+ export enum InterruptMessageType {
2
+ SlidesTemplate = 'slides_template',
3
+ SwitchGitHubRepository = 'switch_github_repository',
4
+ Select = 'select',
5
+ }
@@ -0,0 +1,37 @@
1
+ import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
2
+ import { LanguagesEnum } from './user.model';
3
+
4
+ export interface ITranslation<T>
5
+ extends IBasePerTenantAndOrganizationEntityModel {
6
+ reference?: ITranslatable<T>;
7
+ referenceId?: string;
8
+ languageCode: string;
9
+ }
10
+
11
+ export interface ITranslatable<T>
12
+ extends IBasePerTenantAndOrganizationEntityModel {
13
+ translations?: ITranslation<T>[];
14
+
15
+ translate?(languageCode : string): any;
16
+ translateNested?(languageCode : string, translatePropsInput: Array<any>) : any;
17
+ }
18
+
19
+ export interface TranslateInput {
20
+ key: string;
21
+ alias: string;
22
+ }
23
+
24
+ export interface TranslatePropertyInput {
25
+ prop: string;
26
+ propsTranslate: Array<TranslateInput>;
27
+ propAsArr?: Array<string>;
28
+ }
29
+
30
+ export const TranslationLanguageMap = {
31
+ 'zh-CN': 'zh',
32
+ 'zh-Hans': 'zh',
33
+ }
34
+
35
+ export function mapTranslationLanguage(languageCode: LanguagesEnum) {
36
+ return TranslationLanguageMap[languageCode] || languageCode
37
+ }