@shwfed/config 2.10.2 → 2.10.3
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/dist/mcp.mjs +117 -87
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-DX5M_WNF.js → FieldGroup.vue_vue_type_script_setup_true_lang-sT5i_dnE.js} +1 -1
- package/dist/preview/assets/badge-ZFj45FMd.js +1 -0
- package/dist/preview/assets/config-2iinn_1E.js +1 -0
- package/dist/preview/assets/config-3rP_f_3o.js +1 -0
- package/dist/preview/assets/config-BBvebIQw.js +1 -0
- package/dist/preview/assets/{config-DeDCNzY_.js → config-BLesYihN.js} +1 -1
- package/dist/preview/assets/config-BwDPPmtn.js +1 -0
- package/dist/preview/assets/{config-BiOW8fS2.js → config-CEBzJOHo.js} +1 -1
- package/dist/preview/assets/config-CSR1JNVB.js +1 -0
- package/dist/preview/assets/config-CgM75jSO.js +1 -0
- package/dist/preview/assets/{config-CSmHhOh2.js → config-D1uMzMiN.js} +1 -1
- package/dist/preview/assets/config-DZPLqFqt.js +1 -0
- package/dist/preview/assets/config-DfVc2Iy9.js +1 -0
- package/dist/preview/assets/{config-CTF5-TTQ.js → config-Rz0II9u6.js} +1 -1
- package/dist/preview/assets/{config-DBtEKoan.js → config-cD091sze.js} +1 -1
- package/dist/preview/assets/config-lskK7grq.js +1 -0
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-Cu0CEKYT.js → definition.vue_vue_type_script_setup_true_lang-Ce_NeQUa.js} +1 -1
- package/dist/preview/assets/{index-DX9_iE4h.js → index-Zc4Mcm3J.js} +204 -186
- package/dist/preview/assets/index-_KA5_QIV.js +1 -0
- package/dist/preview/assets/index-snO3CfdE.js +1 -0
- package/dist/preview/assets/item-CBFJ6f6b.js +1 -0
- package/dist/preview/assets/runtime-BIGEoc5L.js +1 -0
- package/dist/preview/assets/runtime-BKqyqEeD.js +1 -0
- package/dist/preview/assets/runtime-CIc3k_jd.js +1 -0
- package/dist/preview/assets/{runtime-BN-jMAt7.js → runtime-Cu0RJn8g.js} +1 -1
- package/dist/preview/assets/{runtime-yfWYeUh4.js → runtime-CvMryNNx.js} +1 -1
- package/dist/preview/assets/runtime-DO9HS0Rb.js +1 -0
- package/dist/preview/assets/{runtime-CFb1tHwr.js → runtime-DQXLscBz.js} +1 -1
- package/dist/preview/assets/runtime-Q_isegB9.js +1 -0
- package/dist/preview/assets/runtime-enspc5HG.js +1 -0
- package/dist/preview/assets/runtime-jWibKv1T.js +1 -0
- package/dist/preview/assets/{schema-meta-6ZPO8dHv.js → schema-meta-B5tln_XH.js} +1 -1
- package/dist/preview/index.html +1 -1
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.d.ts +16 -10
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.js +68 -43
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.d.ts +1 -0
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.js +5 -1
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/config.d.vue.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/config.vue.d.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/runtime.d.vue.ts +4 -4
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/runtime.vue.d.ts +4 -4
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/schema.d.ts +1 -1
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +2 -2
- package/dist/runtime/components/config/index.vue +5 -1
- package/dist/runtime/components/config/schema.d.ts +10 -0
- package/dist/runtime/components/config/schema.js +23 -0
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.d.vue.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue.d.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/schema.d.ts +2 -2
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.d.vue.ts +31 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue +103 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue.d.ts +31 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/runtime.d.ts +2 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/runtime.js +63 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.d.ts +21 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js +63 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/config.d.vue.ts +17 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/config.vue +85 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/config.vue.d.ts +17 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/runtime.d.ts +2 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/runtime.js +36 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.d.ts +14 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.js +38 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +4 -4
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/schema.d.ts +3 -3
- package/package.json +1 -1
- package/dist/preview/assets/badge-DFZBH8N6.js +0 -1
- package/dist/preview/assets/config-BH2BmDoD.js +0 -1
- package/dist/preview/assets/config-Bg7a8Rid.js +0 -1
- package/dist/preview/assets/config-Bnp547Nm.js +0 -1
- package/dist/preview/assets/config-CqeWJt_H.js +0 -1
- package/dist/preview/assets/config-Dj3w2JkF.js +0 -1
- package/dist/preview/assets/config-XGJ9V32V.js +0 -1
- package/dist/preview/assets/config-uIHUHvNR.js +0 -1
- package/dist/preview/assets/index-CGChrBji.js +0 -1
- package/dist/preview/assets/index-CQA6q2ay.js +0 -1
- package/dist/preview/assets/item-C4VJfiq8.js +0 -1
- package/dist/preview/assets/runtime-6Zrje7Y1.js +0 -1
- package/dist/preview/assets/runtime-BQMnWueG.js +0 -1
- package/dist/preview/assets/runtime-CBz5XstF.js +0 -1
- package/dist/preview/assets/runtime-DQL6lCFp.js +0 -1
- package/dist/preview/assets/runtime-DcdmMgqL.js +0 -1
- package/dist/preview/assets/runtime-okYOTQd6.js +0 -1
- package/dist/preview/assets/runtime-qPyuMgsh.js +0 -1
|
@@ -37,15 +37,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
37
37
|
readonly displayName?: string | undefined;
|
|
38
38
|
readonly compatibilityDate: "2026-05-28";
|
|
39
39
|
readonly readonly?: string | undefined;
|
|
40
|
-
readonly dataSource: {
|
|
41
|
-
readonly data: string;
|
|
42
|
-
readonly request?: string | undefined;
|
|
43
|
-
};
|
|
44
40
|
readonly binding?: string | undefined;
|
|
45
41
|
readonly derived?: {
|
|
46
42
|
readonly mode: "formula" | "prefill";
|
|
47
43
|
readonly expression: string;
|
|
48
44
|
} | undefined;
|
|
45
|
+
readonly dataSource: {
|
|
46
|
+
readonly data: string;
|
|
47
|
+
readonly request?: string | undefined;
|
|
48
|
+
};
|
|
49
49
|
readonly validations?: readonly {
|
|
50
50
|
readonly message: readonly [{
|
|
51
51
|
readonly locale: "zh";
|
|
@@ -111,15 +111,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
111
111
|
readonly displayName?: string | undefined;
|
|
112
112
|
readonly compatibilityDate: "2026-05-28";
|
|
113
113
|
readonly readonly?: string | undefined;
|
|
114
|
-
readonly dataSource: {
|
|
115
|
-
readonly data: string;
|
|
116
|
-
readonly request?: string | undefined;
|
|
117
|
-
};
|
|
118
114
|
readonly binding?: string | undefined;
|
|
119
115
|
readonly derived?: {
|
|
120
116
|
readonly mode: "formula" | "prefill";
|
|
121
117
|
readonly expression: string;
|
|
122
118
|
} | undefined;
|
|
119
|
+
readonly dataSource: {
|
|
120
|
+
readonly data: string;
|
|
121
|
+
readonly request?: string | undefined;
|
|
122
|
+
};
|
|
123
123
|
readonly validations?: readonly {
|
|
124
124
|
readonly message: readonly [{
|
|
125
125
|
readonly locale: "zh";
|
|
@@ -37,15 +37,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
37
37
|
readonly displayName?: string | undefined;
|
|
38
38
|
readonly compatibilityDate: "2026-05-28";
|
|
39
39
|
readonly readonly?: string | undefined;
|
|
40
|
-
readonly dataSource: {
|
|
41
|
-
readonly data: string;
|
|
42
|
-
readonly request?: string | undefined;
|
|
43
|
-
};
|
|
44
40
|
readonly binding?: string | undefined;
|
|
45
41
|
readonly derived?: {
|
|
46
42
|
readonly mode: "formula" | "prefill";
|
|
47
43
|
readonly expression: string;
|
|
48
44
|
} | undefined;
|
|
45
|
+
readonly dataSource: {
|
|
46
|
+
readonly data: string;
|
|
47
|
+
readonly request?: string | undefined;
|
|
48
|
+
};
|
|
49
49
|
readonly validations?: readonly {
|
|
50
50
|
readonly message: readonly [{
|
|
51
51
|
readonly locale: "zh";
|
|
@@ -111,15 +111,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
111
111
|
readonly displayName?: string | undefined;
|
|
112
112
|
readonly compatibilityDate: "2026-05-28";
|
|
113
113
|
readonly readonly?: string | undefined;
|
|
114
|
-
readonly dataSource: {
|
|
115
|
-
readonly data: string;
|
|
116
|
-
readonly request?: string | undefined;
|
|
117
|
-
};
|
|
118
114
|
readonly binding?: string | undefined;
|
|
119
115
|
readonly derived?: {
|
|
120
116
|
readonly mode: "formula" | "prefill";
|
|
121
117
|
readonly expression: string;
|
|
122
118
|
} | undefined;
|
|
119
|
+
readonly dataSource: {
|
|
120
|
+
readonly data: string;
|
|
121
|
+
readonly request?: string | undefined;
|
|
122
|
+
};
|
|
123
123
|
readonly validations?: readonly {
|
|
124
124
|
readonly message: readonly [{
|
|
125
125
|
readonly locale: "zh";
|
|
@@ -102,7 +102,6 @@ export declare function FormConfig(configure: (env: Environment) => void): Schem
|
|
|
102
102
|
readonly displayName?: string | undefined;
|
|
103
103
|
readonly kind: "shwfed.component.form";
|
|
104
104
|
readonly fields: readonly any[];
|
|
105
|
-
readonly readonly?: string | undefined;
|
|
106
105
|
readonly layouts: readonly {
|
|
107
106
|
readonly name: string;
|
|
108
107
|
readonly layout: {
|
|
@@ -120,6 +119,7 @@ export declare function FormConfig(configure: (env: Environment) => void): Schem
|
|
|
120
119
|
};
|
|
121
120
|
readonly media?: string | undefined;
|
|
122
121
|
}[];
|
|
122
|
+
readonly readonly?: string | undefined;
|
|
123
123
|
}, Schema.Struct<{
|
|
124
124
|
fields: Schema.Array$<AnySchema>;
|
|
125
125
|
layouts: Schema.refine<readonly {
|
|
@@ -175,7 +175,6 @@ export declare function createFormConfig(body: Omit<Schema.Schema.Type<ReturnTyp
|
|
|
175
175
|
} | undefined;
|
|
176
176
|
displayName?: string | undefined;
|
|
177
177
|
fields: readonly any[];
|
|
178
|
-
readonly?: string | undefined;
|
|
179
178
|
layouts: readonly {
|
|
180
179
|
readonly name: string;
|
|
181
180
|
readonly layout: {
|
|
@@ -193,6 +192,7 @@ export declare function createFormConfig(body: Omit<Schema.Schema.Type<ReturnTyp
|
|
|
193
192
|
};
|
|
194
193
|
readonly media?: string | undefined;
|
|
195
194
|
}[];
|
|
195
|
+
readonly?: string | undefined;
|
|
196
196
|
kind: typeof KIND;
|
|
197
197
|
};
|
|
198
198
|
export declare function defaultFormConfig(): FormConfigValue;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly description?: readonly [{
|
|
8
|
+
readonly locale: "zh";
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}, ...{
|
|
11
|
+
readonly locale: "en" | "ja" | "ko";
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}[]] | undefined;
|
|
14
|
+
readonly expression: string;
|
|
15
|
+
readonly titleExpression?: string | undefined;
|
|
16
|
+
}) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
18
|
+
"onUpdate:modelValue"?: ((value: {
|
|
19
|
+
readonly description?: readonly [{
|
|
20
|
+
readonly locale: "zh";
|
|
21
|
+
readonly message: string;
|
|
22
|
+
}, ...{
|
|
23
|
+
readonly locale: "en" | "ja" | "ko";
|
|
24
|
+
readonly message: string;
|
|
25
|
+
}[]] | undefined;
|
|
26
|
+
readonly expression: string;
|
|
27
|
+
readonly titleExpression?: string | undefined;
|
|
28
|
+
}) => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ExpressionEditor } from "../../../ui/expression-editor";
|
|
3
|
+
import { Field, FieldGroup, FieldLabel } from "../../../ui/field";
|
|
4
|
+
import { Locale as LocaleField } from "../../../ui/locale";
|
|
5
|
+
import { Markdown } from "../../../ui/markdown";
|
|
6
|
+
import { getStructFieldDescription, getStructFieldTitle } from "../../../../share/schema-meta";
|
|
7
|
+
import { schema } from "./schema";
|
|
8
|
+
defineOptions({ name: "ShwfedHttpDownloadOperationConfig" });
|
|
9
|
+
const value = defineModel({ type: null, ...{ required: true } });
|
|
10
|
+
const opSchema = schema(() => {
|
|
11
|
+
});
|
|
12
|
+
const fieldTitle = (f) => getStructFieldTitle(opSchema, f) ?? f;
|
|
13
|
+
const fieldDescription = (f) => getStructFieldDescription(opSchema, f);
|
|
14
|
+
const OUTCOME_VARS = {
|
|
15
|
+
result: { type: "string", label: "\u6267\u884C\u7ED3\u679C" }
|
|
16
|
+
};
|
|
17
|
+
function patch(patchValue) {
|
|
18
|
+
const next = { ...value.value, ...patchValue };
|
|
19
|
+
for (const [k, v] of Object.entries(patchValue)) {
|
|
20
|
+
if (v === void 0) Reflect.deleteProperty(next, k);
|
|
21
|
+
}
|
|
22
|
+
value.value = next;
|
|
23
|
+
}
|
|
24
|
+
function patchOptionalExpression(key, v) {
|
|
25
|
+
patch({ [key]: v.length === 0 ? void 0 : v });
|
|
26
|
+
}
|
|
27
|
+
function patchDescription(v) {
|
|
28
|
+
const blank = v.every((entry) => entry.message.trim().length === 0);
|
|
29
|
+
patch({ description: blank ? void 0 : v });
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<FieldGroup>
|
|
35
|
+
<Field orientation="vertical">
|
|
36
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
37
|
+
<template
|
|
38
|
+
v-if="fieldDescription('expression')"
|
|
39
|
+
#tooltip
|
|
40
|
+
>
|
|
41
|
+
<Markdown
|
|
42
|
+
:source="fieldDescription('expression')"
|
|
43
|
+
block
|
|
44
|
+
class="prose prose-sm prose-zinc"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
47
|
+
{{ fieldTitle("expression") }}
|
|
48
|
+
</FieldLabel>
|
|
49
|
+
<ExpressionEditor
|
|
50
|
+
:model-value="value.expression"
|
|
51
|
+
multiline
|
|
52
|
+
placeholder="例:http.get('/api/export').body({ id: row.id })"
|
|
53
|
+
result-type="HttpRequest"
|
|
54
|
+
class="min-h-16"
|
|
55
|
+
@update:model-value="(v) => patch({ expression: v })"
|
|
56
|
+
/>
|
|
57
|
+
</Field>
|
|
58
|
+
|
|
59
|
+
<Field orientation="vertical">
|
|
60
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
61
|
+
<template
|
|
62
|
+
v-if="fieldDescription('titleExpression')"
|
|
63
|
+
#tooltip
|
|
64
|
+
>
|
|
65
|
+
<Markdown
|
|
66
|
+
:source="fieldDescription('titleExpression')"
|
|
67
|
+
block
|
|
68
|
+
class="prose prose-sm prose-zinc"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
{{ fieldTitle("titleExpression") }}
|
|
72
|
+
</FieldLabel>
|
|
73
|
+
<ExpressionEditor
|
|
74
|
+
:model-value="value.titleExpression ?? ''"
|
|
75
|
+
placeholder="例:result == 'error' ? '下载失败' : '下载成功'"
|
|
76
|
+
result-type="string"
|
|
77
|
+
:extra-vars="OUTCOME_VARS"
|
|
78
|
+
@update:model-value="(v) => patchOptionalExpression('titleExpression', v)"
|
|
79
|
+
/>
|
|
80
|
+
</Field>
|
|
81
|
+
|
|
82
|
+
<Field orientation="vertical">
|
|
83
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
84
|
+
<template
|
|
85
|
+
v-if="fieldDescription('description')"
|
|
86
|
+
#tooltip
|
|
87
|
+
>
|
|
88
|
+
<Markdown
|
|
89
|
+
:source="fieldDescription('description')"
|
|
90
|
+
block
|
|
91
|
+
class="prose prose-sm prose-zinc"
|
|
92
|
+
/>
|
|
93
|
+
</template>
|
|
94
|
+
{{ fieldTitle("description") }}
|
|
95
|
+
</FieldLabel>
|
|
96
|
+
<LocaleField
|
|
97
|
+
markdown
|
|
98
|
+
:model-value="value.description"
|
|
99
|
+
@update:model-value="(v) => patchDescription(v)"
|
|
100
|
+
/>
|
|
101
|
+
</Field>
|
|
102
|
+
</FieldGroup>
|
|
103
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly description?: readonly [{
|
|
8
|
+
readonly locale: "zh";
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}, ...{
|
|
11
|
+
readonly locale: "en" | "ja" | "ko";
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}[]] | undefined;
|
|
14
|
+
readonly expression: string;
|
|
15
|
+
readonly titleExpression?: string | undefined;
|
|
16
|
+
}) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
18
|
+
"onUpdate:modelValue"?: ((value: {
|
|
19
|
+
readonly description?: readonly [{
|
|
20
|
+
readonly locale: "zh";
|
|
21
|
+
readonly message: string;
|
|
22
|
+
}, ...{
|
|
23
|
+
readonly locale: "en" | "ja" | "ko";
|
|
24
|
+
readonly message: string;
|
|
25
|
+
}[]] | undefined;
|
|
26
|
+
readonly expression: string;
|
|
27
|
+
readonly titleExpression?: string | undefined;
|
|
28
|
+
}) => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/runtime.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Effect, Either, Option } from "effect";
|
|
2
|
+
import { Fetch } from "fx-fetch";
|
|
3
|
+
import { toast } from "vue-sonner";
|
|
4
|
+
import { asRequest } from "../../../../share/request.js";
|
|
5
|
+
import { getLocalizedText } from "../../../../share/locale.js";
|
|
6
|
+
import { interpolateMarkdown } from "../../../../share/interpolate.js";
|
|
7
|
+
class HttpRequestHalted {
|
|
8
|
+
constructor(reason) {
|
|
9
|
+
this.reason = reason;
|
|
10
|
+
}
|
|
11
|
+
_tag = "HttpRequestHalted";
|
|
12
|
+
}
|
|
13
|
+
function saveFile(file) {
|
|
14
|
+
const url = URL.createObjectURL(file);
|
|
15
|
+
const a = document.createElement("a");
|
|
16
|
+
a.href = url;
|
|
17
|
+
a.download = file.name;
|
|
18
|
+
document.body.appendChild(a);
|
|
19
|
+
a.click();
|
|
20
|
+
a.remove();
|
|
21
|
+
URL.revokeObjectURL(url);
|
|
22
|
+
}
|
|
23
|
+
export const handler = (params, ctx) => {
|
|
24
|
+
const { expression, titleExpression, description } = params ?? {};
|
|
25
|
+
if (!expression || expression.trim().length === 0) return Effect.void;
|
|
26
|
+
const program = Effect.gen(function* () {
|
|
27
|
+
const steps = ctx.step?.outputs() ?? {};
|
|
28
|
+
const evaluated = yield* ctx.cel(expression, { steps });
|
|
29
|
+
const request = asRequest(evaluated);
|
|
30
|
+
if (Option.isNone(request)) return;
|
|
31
|
+
const outcome = yield* Effect.either(request.value.file());
|
|
32
|
+
const result = Either.isLeft(outcome) ? "error" : "success";
|
|
33
|
+
if (titleExpression !== void 0) {
|
|
34
|
+
const title = yield* ctx.cel(titleExpression, { result, steps });
|
|
35
|
+
if (title.length > 0) {
|
|
36
|
+
const raw = getLocalizedText(description, ctx.locale()) ?? "";
|
|
37
|
+
const body = raw.length === 0 ? void 0 : interpolateMarkdown(raw, ctx.cel, { result, steps });
|
|
38
|
+
toast[result === "error" ? "error" : "success"](title, body === void 0 ? void 0 : { description: body });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (Either.isLeft(outcome)) {
|
|
42
|
+
if (import.meta.dev) console.warn("[shwfed-operations] http download failed", outcome.left);
|
|
43
|
+
return yield* Effect.die(new HttpRequestHalted(outcome.left));
|
|
44
|
+
}
|
|
45
|
+
yield* Effect.sync(() => saveFile(outcome.right));
|
|
46
|
+
});
|
|
47
|
+
return program.pipe(
|
|
48
|
+
// The bus's handler contract has no requirements channel, so the host can't
|
|
49
|
+
// thread a Fetch layer through — the op provides its own, same layer the
|
|
50
|
+
// button runner uses.
|
|
51
|
+
Effect.provide(Fetch.layer),
|
|
52
|
+
// What remains on the error channel is CEL evaluation failure (request /
|
|
53
|
+
// title expression) — a config bug, not a runtime outcome. Mirror the
|
|
54
|
+
// request op: silent in prod, console in dev; the chain still halts so later
|
|
55
|
+
// operations don't fire off a broken step.
|
|
56
|
+
Effect.catchAll((error) => Effect.zipRight(
|
|
57
|
+
Effect.sync(() => {
|
|
58
|
+
if (import.meta.dev) console.warn("[shwfed-operations] http download op failed", error);
|
|
59
|
+
}),
|
|
60
|
+
Effect.die(new HttpRequestHalted(error))
|
|
61
|
+
))
|
|
62
|
+
);
|
|
63
|
+
};
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { Environment } from '../../../../vendor/cel-js/lib/index.js';
|
|
3
|
+
export declare const type: "com.shwfed.operation.http.download";
|
|
4
|
+
export declare const compatibilityDate: "2026-06-15";
|
|
5
|
+
export declare const metadata: {
|
|
6
|
+
readonly name: "下载文件";
|
|
7
|
+
readonly icon: "fluent:arrow-download-20-regular";
|
|
8
|
+
};
|
|
9
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
10
|
+
expression: Schema.Schema<string, string, never>;
|
|
11
|
+
titleExpression: Schema.optional<Schema.Schema<string, string, never>>;
|
|
12
|
+
description: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
13
|
+
locale: Schema.Literal<["zh"]>;
|
|
14
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
15
|
+
}>], [Schema.Struct<{
|
|
16
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
17
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
18
|
+
}>]>>;
|
|
19
|
+
}>;
|
|
20
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
21
|
+
export declare function defaults(): Partial<Value>;
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Expression } from "../../../../share/expression.js";
|
|
3
|
+
import { Locale } from "../../../../share/locale.js";
|
|
4
|
+
import { md } from "../../../../share/markdown.js";
|
|
5
|
+
import { registerStepsVariableIfAbsent } from "../../utils/step-vars.js";
|
|
6
|
+
export const type = "com.shwfed.operation.http.download";
|
|
7
|
+
export const compatibilityDate = "2026-06-15";
|
|
8
|
+
export const metadata = {
|
|
9
|
+
name: "\u4E0B\u8F7D\u6587\u4EF6",
|
|
10
|
+
icon: "fluent:arrow-download-20-regular"
|
|
11
|
+
// NOTE: no `output` — a download saves a file; it publishes nothing for later
|
|
12
|
+
// trigger rows to read back (unlike the request op, whose parsed JSON becomes
|
|
13
|
+
// a chain-step output).
|
|
14
|
+
};
|
|
15
|
+
export function schema(configure) {
|
|
16
|
+
const withSteps = (env) => {
|
|
17
|
+
configure(env);
|
|
18
|
+
registerStepsVariableIfAbsent(env);
|
|
19
|
+
};
|
|
20
|
+
const CelHttpRequest = Expression({ configure: withSteps, resultType: "HttpRequest" });
|
|
21
|
+
const withOutcome = (env) => {
|
|
22
|
+
withSteps(env);
|
|
23
|
+
env.registerVariable("result", "string", {
|
|
24
|
+
description: "\u6267\u884C\u7ED3\u679C\uFF08success | error\uFF09"
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const CelToastString = Expression({ configure: withOutcome, resultType: "string" });
|
|
28
|
+
return Schema.Struct({
|
|
29
|
+
expression: CelHttpRequest.annotations({
|
|
30
|
+
title: "\u8BF7\u6C42",
|
|
31
|
+
description: md`
|
|
32
|
+
构造一个请求,其响应将被取回并保存为文件。
|
|
33
|
+
可经 \`steps["<步骤标识>"]\` 引用前序步骤的输出——把先前
|
|
34
|
+
\`发送请求\` 行取得的凭据用于构造真正的下载请求。
|
|
35
|
+
`
|
|
36
|
+
}),
|
|
37
|
+
titleExpression: Schema.optional(CelToastString.annotations({
|
|
38
|
+
title: "\u63D0\u793A\u6807\u9898",
|
|
39
|
+
description: md`
|
|
40
|
+
配置后,作为提示的标题向用户展示。求值为空字符串时不提示——
|
|
41
|
+
可按 \`result\` 分支实现仅部分结果下提示,如 \`result == 'error' ? '下载失败' : ''\`。
|
|
42
|
+
`
|
|
43
|
+
})),
|
|
44
|
+
description: Schema.optional(Locale.annotations({
|
|
45
|
+
title: "\u63D0\u793A\u5185\u5BB9",
|
|
46
|
+
description: md`
|
|
47
|
+
配置后,作为提示的内容向用户展示。
|
|
48
|
+
`
|
|
49
|
+
}))
|
|
50
|
+
}).annotations({
|
|
51
|
+
title: "HttpDownloadOperation",
|
|
52
|
+
description: md`
|
|
53
|
+
发起一次 HTTP 请求并把响应保存为本地文件。下载失败(网络错误 / 非 2xx)
|
|
54
|
+
会中止本次触发链——其后排队的操作不再执行。把本操作接在一个
|
|
55
|
+
\`发送请求\` 行之后、并经 \`steps["<步骤标识>"]\` 引用其响应,即可实现
|
|
56
|
+
“先取凭据再下载”的两步式。toast 完全由「提示标题」「提示内容」决定(含失败场景);
|
|
57
|
+
不配置标题、或标题求值为空字符串则静默。
|
|
58
|
+
`
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function defaults() {
|
|
62
|
+
return { expression: "" };
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly mode: "_blank" | "_self";
|
|
8
|
+
readonly url: string;
|
|
9
|
+
}) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: {
|
|
12
|
+
readonly mode: "_blank" | "_self";
|
|
13
|
+
readonly url: string;
|
|
14
|
+
}) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/config.vue
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ExpressionEditor } from "../../../ui/expression-editor";
|
|
3
|
+
import { Field, FieldGroup, FieldLabel } from "../../../ui/field";
|
|
4
|
+
import {
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue
|
|
10
|
+
} from "../../../ui/select";
|
|
11
|
+
import { Markdown } from "../../../ui/markdown";
|
|
12
|
+
import { getStructFieldDescription, getStructFieldTitle } from "../../../../share/schema-meta";
|
|
13
|
+
import { schema } from "./schema";
|
|
14
|
+
defineOptions({ name: "ShwfedNavigationOperationConfig" });
|
|
15
|
+
const value = defineModel({ type: null, ...{ required: true } });
|
|
16
|
+
const opSchema = schema(() => {
|
|
17
|
+
});
|
|
18
|
+
const fieldTitle = (f) => getStructFieldTitle(opSchema, f) ?? f;
|
|
19
|
+
const fieldDescription = (f) => getStructFieldDescription(opSchema, f);
|
|
20
|
+
const MODE_OPTIONS = [
|
|
21
|
+
{ value: "_self", label: "\u5F53\u524D\u9875\u9762\u6253\u5F00" },
|
|
22
|
+
{ value: "_blank", label: "\u65B0\u9875\u9762\u6253\u5F00" }
|
|
23
|
+
];
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<FieldGroup>
|
|
28
|
+
<Field orientation="vertical">
|
|
29
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
30
|
+
<template
|
|
31
|
+
v-if="fieldDescription('url')"
|
|
32
|
+
#tooltip
|
|
33
|
+
>
|
|
34
|
+
<Markdown
|
|
35
|
+
:source="fieldDescription('url')"
|
|
36
|
+
block
|
|
37
|
+
class="prose prose-sm prose-zinc"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
40
|
+
{{ fieldTitle("url") }}
|
|
41
|
+
</FieldLabel>
|
|
42
|
+
<ExpressionEditor
|
|
43
|
+
:model-value="value.url ?? ''"
|
|
44
|
+
placeholder="例:'/detail/' + string(row.id)"
|
|
45
|
+
result-type="string"
|
|
46
|
+
multiline
|
|
47
|
+
class="min-h-10"
|
|
48
|
+
@update:model-value="(v) => value = { ...value, url: v }"
|
|
49
|
+
/>
|
|
50
|
+
</Field>
|
|
51
|
+
|
|
52
|
+
<Field orientation="vertical">
|
|
53
|
+
<FieldLabel class="text-xs text-zinc-500">
|
|
54
|
+
<template
|
|
55
|
+
v-if="fieldDescription('mode')"
|
|
56
|
+
#tooltip
|
|
57
|
+
>
|
|
58
|
+
<Markdown
|
|
59
|
+
:source="fieldDescription('mode')"
|
|
60
|
+
block
|
|
61
|
+
class="prose prose-sm prose-zinc"
|
|
62
|
+
/>
|
|
63
|
+
</template>
|
|
64
|
+
{{ fieldTitle("mode") }}
|
|
65
|
+
</FieldLabel>
|
|
66
|
+
<Select
|
|
67
|
+
:model-value="value.mode ?? '_self'"
|
|
68
|
+
@update:model-value="(v) => value = { ...value, mode: v }"
|
|
69
|
+
>
|
|
70
|
+
<SelectTrigger class="w-full">
|
|
71
|
+
<SelectValue />
|
|
72
|
+
</SelectTrigger>
|
|
73
|
+
<SelectContent>
|
|
74
|
+
<SelectItem
|
|
75
|
+
v-for="opt in MODE_OPTIONS"
|
|
76
|
+
:key="opt.value"
|
|
77
|
+
:value="opt.value"
|
|
78
|
+
>
|
|
79
|
+
{{ opt.label }}
|
|
80
|
+
</SelectItem>
|
|
81
|
+
</SelectContent>
|
|
82
|
+
</Select>
|
|
83
|
+
</Field>
|
|
84
|
+
</FieldGroup>
|
|
85
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly mode: "_blank" | "_self";
|
|
8
|
+
readonly url: string;
|
|
9
|
+
}) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: {
|
|
12
|
+
readonly mode: "_blank" | "_self";
|
|
13
|
+
readonly url: string;
|
|
14
|
+
}) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/runtime.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { navigateTo, useRouter } from "#app";
|
|
3
|
+
function isExternal(url) {
|
|
4
|
+
try {
|
|
5
|
+
return new URL(url, window.location.href).origin !== window.location.origin;
|
|
6
|
+
} catch {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export const handler = (params, ctx) => {
|
|
11
|
+
const { url, mode } = params ?? {};
|
|
12
|
+
if (!url || url.trim().length === 0) return Effect.void;
|
|
13
|
+
const program = Effect.gen(function* () {
|
|
14
|
+
const steps = ctx.step?.outputs() ?? {};
|
|
15
|
+
const resolved = yield* ctx.cel(url, { steps });
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
const external = isExternal(resolved);
|
|
18
|
+
yield* Effect.promise(async () => {
|
|
19
|
+
if (mode === "_blank") {
|
|
20
|
+
window.open(external ? resolved : router.resolve(resolved).href, "_blank");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
await navigateTo(resolved, { external });
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
return program.pipe(
|
|
27
|
+
// Navigation does NOT halt the chain. What can fail here is CEL evaluation
|
|
28
|
+
// of the URL (a config bug) or the navigation itself — best-effort either
|
|
29
|
+
// way: dev-warn, then continue. Returning `Effect.void` (not `Effect.die`)
|
|
30
|
+
// keeps both the `void` error channel intact and the rest of the chain
|
|
31
|
+
// running, unlike the request/alert ops whose failures are deliberate halts.
|
|
32
|
+
Effect.catchAll((error) => Effect.sync(() => {
|
|
33
|
+
if (import.meta.dev) console.warn("[shwfed-operations] navigation op failed", error);
|
|
34
|
+
}))
|
|
35
|
+
);
|
|
36
|
+
};
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { Environment } from '../../../../vendor/cel-js/lib/index.js';
|
|
3
|
+
export declare const type: "com.shwfed.operation.navigation";
|
|
4
|
+
export declare const compatibilityDate: "2026-06-15";
|
|
5
|
+
export declare const metadata: {
|
|
6
|
+
readonly name: "导航";
|
|
7
|
+
readonly icon: "fluent:link-20-regular";
|
|
8
|
+
};
|
|
9
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
10
|
+
url: Schema.Schema<string, string, never>;
|
|
11
|
+
mode: Schema.Literal<["_self", "_blank"]>;
|
|
12
|
+
}>;
|
|
13
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
14
|
+
export declare function defaults(): Partial<Value>;
|
package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Expression } from "../../../../share/expression.js";
|
|
3
|
+
import { md } from "../../../../share/markdown.js";
|
|
4
|
+
import { registerStepsVariableIfAbsent } from "../../utils/step-vars.js";
|
|
5
|
+
export const type = "com.shwfed.operation.navigation";
|
|
6
|
+
export const compatibilityDate = "2026-06-15";
|
|
7
|
+
export const metadata = {
|
|
8
|
+
name: "\u5BFC\u822A",
|
|
9
|
+
icon: "fluent:link-20-regular"
|
|
10
|
+
// NOTE: no `output` — navigation publishes nothing for later trigger rows
|
|
11
|
+
// (it ends in a page navigation, not a value the chain can read back).
|
|
12
|
+
};
|
|
13
|
+
export function schema(configure) {
|
|
14
|
+
const withSteps = (env) => {
|
|
15
|
+
configure(env);
|
|
16
|
+
registerStepsVariableIfAbsent(env);
|
|
17
|
+
};
|
|
18
|
+
const CelUrl = Expression({ configure: withSteps, resultType: "string" });
|
|
19
|
+
return Schema.Struct({
|
|
20
|
+
url: CelUrl.annotations({
|
|
21
|
+
title: "\u94FE\u63A5",
|
|
22
|
+
description: "\u70B9\u51FB\u540E\u5C06\u6253\u5F00\u7684\u94FE\u63A5\uFF0C\u8FD4\u56DE `string`"
|
|
23
|
+
}),
|
|
24
|
+
mode: Schema.Literal("_self", "_blank").annotations({
|
|
25
|
+
title: "\u6253\u5F00\u65B9\u5F0F",
|
|
26
|
+
description: "\u9009\u62E9\u5728\u5F53\u524D\u9875\u9762\u6216\u65B0\u9875\u9762\u6253\u5F00\u94FE\u63A5"
|
|
27
|
+
})
|
|
28
|
+
}).annotations({
|
|
29
|
+
title: "NavigationOperation",
|
|
30
|
+
description: md`
|
|
31
|
+
按所选方式打开一个链接。链接表达式可经 \`steps["<步骤标识>"]\` 引用前序步骤的输出,
|
|
32
|
+
因此可由先前请求的响应拼接目标地址。导航失败不中止本次触发链。
|
|
33
|
+
`
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function defaults() {
|
|
37
|
+
return { url: "", mode: "_self" };
|
|
38
|
+
}
|