@schema-platform/platform-shared 0.0.0-stage → 1.7.19
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/README.md +157 -2
- package/ai/agentWorkflow/builtinGraphs.generated.ts +57 -0
- package/ai/agentWorkflow/createByTemplate.ts +28 -0
- package/ai/agentWorkflow/defaults.ts +492 -0
- package/ai/agentWorkflow/index.ts +115 -0
- package/ai/agentWorkflow/legacyTemplateFactories.ts +107 -0
- package/ai/agentWorkflow/templates.ts +469 -0
- package/ai/agentWorkflow/types.ts +675 -0
- package/ai/agentWorkflow/validation.ts +235 -0
- package/ai/agentWorkflow.ts +15 -0
- package/ai/document.ts +90 -0
- package/ai/events.ts +500 -0
- package/ai/index.ts +193 -0
- package/ai/metadata.json +33 -0
- package/ai/promptBuilder.ts +1526 -0
- package/ai/providerModel.ts +66 -0
- package/ai/runtimeAgent.ts +236 -0
- package/ai/systemKnowledge.ts +151 -0
- package/ai/toolNames.ts +116 -0
- package/ai/types.ts +94 -0
- package/components/auth/AuthCallback.vue +80 -0
- package/components/auth/LoginView.module.scss +264 -0
- package/components/auth/LoginView.vue +686 -0
- package/components/auth/SliderCaptcha.module.scss +207 -0
- package/components/auth/SliderCaptcha.vue +213 -0
- package/components/auth/index.ts +4 -0
- package/components/auth/sliderCaptchaTypes.ts +16 -0
- package/components/common/AppDialog.module.scss +50 -0
- package/components/common/AppDialog.vue +100 -0
- package/components/common/AppIcon.vue +57 -0
- package/components/common/AppPagination.module.scss +6 -0
- package/components/common/AppPagination.vue +67 -0
- package/components/common/AppUserPanel.module.scss +179 -0
- package/components/common/AppUserPanel.vue +115 -0
- package/components/common/ConfirmDialog.vue +64 -0
- package/components/common/FilterTabs.vue +66 -0
- package/components/common/FormDialog.vue +74 -0
- package/components/common/index.ts +7 -0
- package/config/element.ts +17 -0
- package/dist/__tests__/agentWorkflowLayout.spec.d.ts +1 -0
- package/dist/__tests__/apiClientErrorMessage.spec.d.ts +1 -0
- package/dist/__tests__/authPaths.spec.d.ts +1 -0
- package/dist/__tests__/authSession.spec.d.ts +1 -0
- package/dist/__tests__/logger.spec.d.ts +5 -0
- package/dist/__tests__/pagination.spec.d.ts +1 -0
- package/dist/__tests__/permission.spec.d.ts +1 -0
- package/dist/__tests__/settleUnauthorized.spec.d.ts +1 -0
- package/dist/__tests__/syncSubAppRoute.spec.d.ts +1 -0
- package/dist/__tests__/useQiankunShell.spec.d.ts +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/ai/agentWorkflow/builtinGraphs.generated.d.ts +2 -0
- package/dist/ai/agentWorkflow/builtinGraphs.generated.js +1071 -0
- package/dist/ai/agentWorkflow/createByTemplate.d.ts +7 -0
- package/dist/ai/agentWorkflow/createByTemplate.js +11 -0
- package/dist/ai/agentWorkflow/defaults.d.ts +18 -0
- package/dist/ai/agentWorkflow/defaults.js +428 -0
- package/dist/ai/agentWorkflow/index.d.ts +12 -0
- package/dist/ai/agentWorkflow/legacyTemplateFactories.d.ts +96 -0
- package/dist/ai/agentWorkflow/legacyTemplateFactories.js +51 -0
- package/dist/ai/agentWorkflow/templates.d.ts +16 -0
- package/dist/ai/agentWorkflow/templates.js +405 -0
- package/dist/ai/agentWorkflow/types.d.ts +601 -0
- package/dist/ai/agentWorkflow/validation.d.ts +2 -0
- package/dist/ai/agentWorkflow/validation.js +109 -0
- package/dist/ai/agentWorkflow.d.ts +14 -0
- package/dist/ai/agentWorkflow.js +62 -0
- package/dist/ai/document.d.ts +56 -0
- package/dist/ai/document.js +30 -0
- package/dist/ai/events.d.ts +296 -0
- package/dist/ai/events.js +1 -0
- package/dist/ai/index.d.ts +19 -0
- package/dist/ai/index.js +78 -0
- package/dist/ai/promptBuilder.d.ts +18 -0
- package/dist/ai/promptBuilder.js +1406 -0
- package/dist/ai/providerModel.d.ts +49 -0
- package/dist/ai/providerModel.js +1 -0
- package/dist/ai/runtimeAgent.d.ts +101 -0
- package/dist/ai/runtimeAgent.js +119 -0
- package/dist/ai/systemKnowledge.d.ts +43 -0
- package/dist/ai/systemKnowledge.js +136 -0
- package/dist/ai/toolNames.d.ts +41 -0
- package/dist/ai/toolNames.js +94 -0
- package/dist/ai/types.d.ts +85 -0
- package/dist/ai/types.js +1 -0
- package/dist/components/auth/AuthCallback.vue.d.ts +9 -0
- package/dist/components/auth/AuthCallback.vue.js +9 -0
- package/dist/components/auth/AuthCallback2.vue.js +41 -0
- package/dist/components/auth/AuthCallback3.vue.js +13 -0
- package/dist/components/auth/LoginView.module.scss.js +25 -0
- package/dist/components/auth/LoginView.vue.d.ts +37 -0
- package/dist/components/auth/LoginView.vue.js +639 -0
- package/dist/components/auth/LoginView2.vue.js +4 -0
- package/dist/components/auth/SliderCaptcha.module.scss.js +40 -0
- package/dist/components/auth/SliderCaptcha.vue.d.ts +27 -0
- package/dist/components/auth/SliderCaptcha.vue.js +164 -0
- package/dist/components/auth/SliderCaptcha2.vue.js +4 -0
- package/dist/components/auth/index.d.ts +4 -0
- package/dist/components/auth/sliderCaptchaTypes.d.ts +14 -0
- package/dist/components/common/AppDialog.module.scss.js +12 -0
- package/dist/components/common/AppDialog.vue.d.ts +43 -0
- package/dist/components/common/AppDialog.vue.js +111 -0
- package/dist/components/common/AppDialog2.vue.js +4 -0
- package/dist/components/common/AppIcon.vue.d.ts +10 -0
- package/dist/components/common/AppIcon.vue.js +34 -0
- package/dist/components/common/AppIcon2.vue.js +4 -0
- package/dist/components/common/AppPagination.module.scss.js +7 -0
- package/dist/components/common/AppPagination.vue.d.ts +25 -0
- package/dist/components/common/AppPagination.vue.js +45 -0
- package/dist/components/common/AppPagination2.vue.js +4 -0
- package/dist/components/common/AppUserPanel.module.scss.js +38 -0
- package/dist/components/common/AppUserPanel.vue.d.ts +25 -0
- package/dist/components/common/AppUserPanel.vue.js +125 -0
- package/dist/components/common/AppUserPanel2.vue.js +4 -0
- package/dist/components/common/ConfirmDialog.vue.d.ts +21 -0
- package/dist/components/common/ConfirmDialog.vue.js +9 -0
- package/dist/components/common/ConfirmDialog2.vue.js +59 -0
- package/dist/components/common/ConfirmDialog3.vue.js +11 -0
- package/dist/components/common/FilterTabs.vue.d.ts +20 -0
- package/dist/components/common/FilterTabs.vue.js +9 -0
- package/dist/components/common/FilterTabs2.vue.js +24 -0
- package/dist/components/common/FilterTabs3.vue.js +11 -0
- package/dist/components/common/FormDialog.vue.d.ts +40 -0
- package/dist/components/common/FormDialog.vue.js +64 -0
- package/dist/components/common/FormDialog2.vue.js +4 -0
- package/dist/components/common/index.d.ts +7 -0
- package/dist/config/element.d.ts +6 -0
- package/dist/config/element.js +7 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +206 -0
- package/dist/platform-shared.css +1 -0
- package/dist/post-message/PostMessageBridge.d.ts +39 -0
- package/dist/post-message/PostMessageBridge.js +86 -0
- package/dist/post-message/index.d.ts +9 -0
- package/dist/post-message/types.d.ts +36 -0
- package/dist/post-message/usePostMessage.d.ts +22 -0
- package/dist/post-message/usePostMessage.js +38 -0
- package/dist/qiankun/config.d.ts +52 -0
- package/dist/qiankun/config.js +26 -0
- package/dist/qiankun/createQiankunApp.d.ts +27 -0
- package/dist/qiankun/createQiankunApp.js +51 -0
- package/dist/qiankun/index.d.ts +14 -0
- package/dist/qiankun/index.js +18 -0
- package/dist/qiankun/syncSubAppRoute.d.ts +6 -0
- package/dist/qiankun/syncSubAppRoute.js +24 -0
- package/dist/qiankun/themeGuard.d.ts +37 -0
- package/dist/qiankun/types.d.ts +20 -0
- package/dist/qiankun/useMicroApp.d.ts +35 -0
- package/dist/qiankun/useMicroApp.js +50 -0
- package/dist/qiankun/useQiankun.d.ts +19 -0
- package/dist/qiankun/useQiankun.js +31 -0
- package/dist/qiankun/useQiankunEvent.d.ts +18 -0
- package/dist/qiankun/useQiankunEvent.js +47 -0
- package/dist/qiankun/useQiankunShell.d.ts +10 -0
- package/dist/qiankun/useQiankunShell.js +46 -0
- package/dist/socket/index.d.ts +170 -0
- package/dist/socket/index.js +150 -0
- package/dist/utils/apiClient.d.ts +62 -0
- package/dist/utils/apiClient.js +143 -0
- package/dist/utils/authPaths.d.ts +25 -0
- package/dist/utils/authPaths.js +47 -0
- package/dist/utils/authSession.d.ts +68 -0
- package/dist/utils/authSession.js +167 -0
- package/dist/utils/authTypes.d.ts +81 -0
- package/dist/utils/authTypes.js +1 -0
- package/dist/utils/deviceId.d.ts +11 -0
- package/dist/utils/deviceId.js +12 -0
- package/dist/utils/form.d.ts +54 -0
- package/dist/utils/form.js +72 -0
- package/dist/utils/i18n.d.ts +9 -0
- package/dist/utils/i18n.js +16 -0
- package/dist/utils/iconRegistry.d.ts +7 -0
- package/dist/utils/iconRegistry.js +244 -0
- package/dist/utils/iconResolver.d.ts +20 -0
- package/dist/utils/iconResolver.js +71 -0
- package/dist/utils/logger.d.ts +116 -0
- package/dist/utils/logger.js +160 -0
- package/dist/utils/message.d.ts +44 -0
- package/dist/utils/message.js +50 -0
- package/dist/utils/pagination.d.ts +10 -0
- package/dist/utils/pagination.js +6 -0
- package/dist/utils/permission.d.ts +36 -0
- package/dist/utils/permission.js +17 -0
- package/dist/utils/sso.d.ts +62 -0
- package/dist/utils/sso.js +136 -0
- package/dist/utils/stores/authStore.d.ts +158 -0
- package/dist/utils/stores/authStore.js +39 -0
- package/dist/utils/stores/index.d.ts +1 -0
- package/dist/utils/telemetry.d.ts +15 -0
- package/dist/utils/telemetry.js +58 -0
- package/dist/utils/useAuth.d.ts +52 -0
- package/dist/utils/useAuth.js +65 -0
- package/dist/utils/useClientPagination.d.ts +15 -0
- package/dist/utils/useClientPagination.js +32 -0
- package/dist/utils/useDataLoading.d.ts +22 -0
- package/dist/utils/useDataLoading.js +37 -0
- package/dist/vite.config.d.ts +2 -0
- package/index.ts +56 -0
- package/package.json +173 -4
- package/post-message/PostMessageBridge.ts +134 -0
- package/post-message/index.ts +18 -0
- package/post-message/types.ts +61 -0
- package/post-message/usePostMessage.ts +90 -0
- package/qiankun/MicroAppContainer.vue +136 -0
- package/qiankun/config.ts +94 -0
- package/qiankun/createQiankunApp.ts +149 -0
- package/qiankun/index.ts +15 -0
- package/qiankun/syncSubAppRoute.ts +48 -0
- package/qiankun/themeGuard.ts +189 -0
- package/qiankun/types.ts +23 -0
- package/qiankun/useMicroApp.ts +123 -0
- package/qiankun/useQiankun.ts +70 -0
- package/qiankun/useQiankunEvent.ts +95 -0
- package/qiankun/useQiankunShell.ts +82 -0
- package/socket/index.ts +356 -0
- package/styles/_css-variables.scss +156 -0
- package/styles/_theme.scss +535 -0
- package/styles/_variables.scss +180 -0
- package/styles/component-styles.css +359 -0
- package/styles/design-tokens.css +50 -0
- package/styles/package.json +18 -0
- package/styles/theme-tech.css +334 -0
- package/styles/tokens.css +229 -0
- package/utils/apiClient.ts +255 -0
- package/utils/authPaths.ts +104 -0
- package/utils/authSession.ts +320 -0
- package/utils/authTypes.ts +89 -0
- package/utils/deviceId.ts +26 -0
- package/utils/form.ts +142 -0
- package/utils/i18n.ts +27 -0
- package/utils/iconRegistry.ts +259 -0
- package/utils/iconResolver.ts +105 -0
- package/utils/logger.ts +436 -0
- package/utils/message.ts +102 -0
- package/utils/pagination.ts +13 -0
- package/utils/permission.ts +75 -0
- package/utils/sso.ts +226 -0
- package/utils/stores/authStore.ts +102 -0
- package/utils/stores/index.ts +1 -0
- package/utils/telemetry.ts +93 -0
- package/utils/useAuth.ts +143 -0
- package/utils/useClientPagination.ts +58 -0
- package/utils/useDataLoading.ts +118 -0
package/README.md
CHANGED
|
@@ -1,3 +1,158 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 平台公共包
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 所有前端项目共享的组件、工具和配置
|
|
4
|
+
|
|
5
|
+
## 它是什么?
|
|
6
|
+
|
|
7
|
+
`@schema-platform/platform-shared` 是 Schema Platform 的公共基础包,提供所有前端项目(Editor、Flow、AI、UA)共用的:
|
|
8
|
+
|
|
9
|
+
- **组件** — 统一的 UI 组件
|
|
10
|
+
- **工具** — 通用的工具函数
|
|
11
|
+
- **配置** — 共享的构建配置
|
|
12
|
+
- **样式** — 统一的设计令牌
|
|
13
|
+
|
|
14
|
+
## 主要内容
|
|
15
|
+
|
|
16
|
+
### 组件
|
|
17
|
+
|
|
18
|
+
| 组件 | 说明 |
|
|
19
|
+
|------|------|
|
|
20
|
+
| AppIcon | 统一图标组件(基于 Iconify) |
|
|
21
|
+
| AppDialog | 对话框组件 |
|
|
22
|
+
| LoginView | 登录/注册页面 |
|
|
23
|
+
| AuthCallback | SSO 回调处理 |
|
|
24
|
+
|
|
25
|
+
### 工具
|
|
26
|
+
|
|
27
|
+
| 工具 | 说明 |
|
|
28
|
+
|------|------|
|
|
29
|
+
| apiClient | Axios HTTP 客户端 |
|
|
30
|
+
| useAuth | 认证组合函数 |
|
|
31
|
+
| sso | SSO 客户端 |
|
|
32
|
+
|
|
33
|
+
### Qiankun 微前端
|
|
34
|
+
|
|
35
|
+
| 模块 | 说明 |
|
|
36
|
+
|------|------|
|
|
37
|
+
| createQiankunApp | 创建 qiankun 子应用 |
|
|
38
|
+
| APP_CONFIGS | 子应用配置表 |
|
|
39
|
+
| buildMicroAppUrl | 生成子应用 URL |
|
|
40
|
+
|
|
41
|
+
### 样式
|
|
42
|
+
|
|
43
|
+
| 文件 | 说明 |
|
|
44
|
+
|------|------|
|
|
45
|
+
| tokens.css | 设计令牌 |
|
|
46
|
+
| design-tokens.css | 设计系统变量 |
|
|
47
|
+
|
|
48
|
+
### 配置
|
|
49
|
+
|
|
50
|
+
| 工具 | 说明 |
|
|
51
|
+
|------|------|
|
|
52
|
+
| createViteConfig | Vite 配置工厂 |
|
|
53
|
+
| setupElementPlus | Element Plus 配置 |
|
|
54
|
+
|
|
55
|
+
## 使用方法
|
|
56
|
+
|
|
57
|
+
### 安装
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install @schema-platform/platform-shared
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 发布(GitHub Packages)
|
|
64
|
+
|
|
65
|
+
`.npmrc` 使用 `${GITHUB_TOKEN}`。**不要**依赖 `~/.npmrc` 里过期的静态 token。固定流程:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
cd shared/platform-shared
|
|
69
|
+
pnpm publish:pkg
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
等价于:`pnpm build` + `GITHUB_TOKEN="$(gh auth token)" npm publish`(需已 `gh auth login`,且 token 含 `write:packages`)。
|
|
73
|
+
|
|
74
|
+
### 导入组件
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// 组件
|
|
78
|
+
import { AppIcon, AppDialog } from '@schema-platform/platform-shared/components/common'
|
|
79
|
+
|
|
80
|
+
// 工具
|
|
81
|
+
import { apiClient } from '@schema-platform/platform-shared/utils/apiClient'
|
|
82
|
+
import { useAuth } from '@schema-platform/platform-shared/utils/useAuth'
|
|
83
|
+
|
|
84
|
+
// Qiankun
|
|
85
|
+
import { createQiankunApp } from '@schema-platform/platform-shared/qiankun/createQiankunApp'
|
|
86
|
+
import { APP_CONFIGS } from '@schema-platform/platform-shared/qiankun/config'
|
|
87
|
+
|
|
88
|
+
// 样式
|
|
89
|
+
import '@schema-platform/platform-shared/styles/tokens.css'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 使用 AppIcon
|
|
93
|
+
|
|
94
|
+
```vue
|
|
95
|
+
<template>
|
|
96
|
+
<AppIcon name="add" />
|
|
97
|
+
<AppIcon name="delete" />
|
|
98
|
+
<AppIcon name="edit" />
|
|
99
|
+
</template>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
图标名称来自 `platform-shared/utils/iconRegistry.ts` 中注册的图标。
|
|
103
|
+
|
|
104
|
+
### 使用 apiClient
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { apiClient } from '@schema-platform/platform-shared/utils/apiClient'
|
|
108
|
+
|
|
109
|
+
// GET 请求
|
|
110
|
+
const data = await apiClient.get('/api/schemas')
|
|
111
|
+
|
|
112
|
+
// POST 请求
|
|
113
|
+
const result = await apiClient.post('/api/schemas', { name: '测试' })
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 使用 useAuth
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { useAuth } from '@schema-platform/platform-shared/utils/useAuth'
|
|
120
|
+
|
|
121
|
+
const { user, login, logout, isAuthenticated } = useAuth()
|
|
122
|
+
|
|
123
|
+
// 登录
|
|
124
|
+
await login({ username: 'admin', password: '123456' })
|
|
125
|
+
|
|
126
|
+
// 检查登录状态
|
|
127
|
+
if (isAuthenticated.value) {
|
|
128
|
+
console.log('已登录', user.value)
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 开发
|
|
133
|
+
|
|
134
|
+
### 安装依赖
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pnpm install
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 构建
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pnpm build
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 测试
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pnpm test
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## 版本历史
|
|
153
|
+
|
|
154
|
+
查看 [CHANGELOG.md](./CHANGELOG.md) 了解版本更新。
|
|
155
|
+
|
|
156
|
+
## 许可证
|
|
157
|
+
|
|
158
|
+
MIT
|