@gadmin2n/schematics 0.0.154 → 0.0.156

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.
@@ -62,6 +62,7 @@ server/src/
62
62
  ## 开发原则(必须遵守)
63
63
 
64
64
  - 使用 TypeScript 严格模式
65
+ - 包管理工具使用pnpm
65
66
  - 严格遵循前、后端既有技术栈,如无必要不要引入新库
66
67
  - 不确定时询问,不要猜;存在歧义时不要默默选择;有更简单的方案要说出来
67
68
  - 修改 `config/ui/` 或 `config/prisma/` 后,必须在**项目根目录**执行生成命令:
@@ -61,4 +61,5 @@ agent-eval/runs/
61
61
  agent-eval/baseline/
62
62
  tmp/
63
63
  CODEBUDDY.local.md
64
- .scratch/
64
+ .scratch/
65
+ age-sops-guides.md
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "devDependencies": {
99
99
  "@faker-js/faker": "^10.4.0",
100
- "@gadmin2n/prisma-nest-generator": "^0.0.49",
100
+ "@gadmin2n/prisma-nest-generator": "^0.0.50",
101
101
  "@gadmin2n/prisma-react-generator": "^0.0.73",
102
102
  "@nestjs/cli": "^11.0.21",
103
103
  "@nestjs/testing": "^10.4.15",
@@ -21,3 +21,6 @@ allowBuilds:
21
21
  # 以下脚本仅打印捐赠/统计信息,与产物无关,保持禁止
22
22
  '@nestjs/core': false
23
23
  '@scarf/scarf': false
24
+
25
+ minimumReleaseAgeExclude:
26
+ - '@gadmin2n/prisma-nest-generator@0.0.50'
@@ -6,6 +6,16 @@ import { useTranslation } from 'react-i18next';
6
6
 
7
7
  export type TransferEntity = 'user' | 'role' | 'page' | 'resource';
8
8
 
9
+ // 后端按转发后的 Host 拼 URL(正式环境会是内网地址),统一改写为当前浏览器 origin
10
+ const toCurrentOrigin = (u: string) => {
11
+ try {
12
+ const parsed = new URL(u);
13
+ return `${window.location.origin}${parsed.pathname}${parsed.search}`;
14
+ } catch {
15
+ return u;
16
+ }
17
+ };
18
+
9
19
  interface TransferExportModalProps {
10
20
  open: boolean;
11
21
  onClose: () => void;
@@ -37,7 +47,7 @@ export function TransferExportModal({
37
47
  setUrl('');
38
48
  setLoading(true);
39
49
  customRequest<{ url: string }>(exportTokenEndpoint, 'POST')
40
- .then((res) => setUrl(res.url))
50
+ .then((res) => setUrl(toCurrentOrigin(res.url)))
41
51
  .catch((e: any) =>
42
52
  message.error(e?.message ?? t('transfer.export.failed')),
43
53
  )
@@ -9,6 +9,16 @@ interface ExportModalProps {
9
9
  onClose: () => void;
10
10
  }
11
11
 
12
+ // 后端按转发后的 Host 拼 URL(正式环境会是内网地址),统一改写为当前浏览器 origin
13
+ const toCurrentOrigin = (u: string) => {
14
+ try {
15
+ const parsed = new URL(u);
16
+ return `${window.location.origin}${parsed.pathname}${parsed.search}`;
17
+ } catch {
18
+ return u;
19
+ }
20
+ };
21
+
12
22
  export function ExportModal({ open, canvasId, onClose }: ExportModalProps) {
13
23
  const [url, setUrl] = useState<string>('');
14
24
  const [loading, setLoading] = useState(false);
@@ -18,7 +28,7 @@ export function ExportModal({ open, canvasId, onClose }: ExportModalProps) {
18
28
  setUrl('');
19
29
  setLoading(true);
20
30
  generateExportToken(canvasId)
21
- .then((res) => setUrl(res.url))
31
+ .then((res) => setUrl(toCurrentOrigin(res.url)))
22
32
  .catch((e: any) =>
23
33
  message.error(e?.message ?? 'Failed to generate export URL'),
24
34
  )
@@ -10,6 +10,16 @@ interface ExportModalProps {
10
10
  onClose: () => void;
11
11
  }
12
12
 
13
+ // 后端按转发后的 Host 拼 URL(正式环境会是内网地址),统一改写为当前浏览器 origin
14
+ const toCurrentOrigin = (u: string) => {
15
+ try {
16
+ const parsed = new URL(u);
17
+ return `${window.location.origin}${parsed.pathname}${parsed.search}`;
18
+ } catch {
19
+ return u;
20
+ }
21
+ };
22
+
13
23
  export function ExportModal({ open, workflowId, onClose }: ExportModalProps) {
14
24
  const { t } = useTranslation('workflow');
15
25
  const [url, setUrl] = useState<string>('');
@@ -23,7 +33,7 @@ export function ExportModal({ open, workflowId, onClose }: ExportModalProps) {
23
33
  `workflow/${workflowId}/export-token`,
24
34
  'POST',
25
35
  )
26
- .then((res) => setUrl(res.url))
36
+ .then((res) => setUrl(toCurrentOrigin(res.url)))
27
37
  .catch((e: any) => message.error(e?.message ?? t('export.failed')))
28
38
  .finally(() => setLoading(false));
29
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadmin2n/schematics",
3
- "version": "0.0.154",
3
+ "version": "0.0.156",
4
4
  "description": "Gadmin - modern, fast, powerful node.js web framework (@schematics)",
5
5
  "main": "dist/index.js",
6
6
  "files": [