@atscript/vue-wf 0.1.73 → 0.1.75
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.
|
@@ -4,6 +4,29 @@ import { WF_ACTION_WITH_DATA, createFormData, createFormDef, getFieldMeta } from
|
|
|
4
4
|
import { deserializeAnnotatedType } from "@atscript/typescript/utils";
|
|
5
5
|
import { AsForm } from "@atscript/vue-form";
|
|
6
6
|
//#region src/use-wf-form.ts
|
|
7
|
+
const FRIENDLY_STATUS_MESSAGES = {
|
|
8
|
+
400: "The request was invalid. Please check your input and try again.",
|
|
9
|
+
401: "You need to sign in to continue.",
|
|
10
|
+
403: "You don't have permission to do that.",
|
|
11
|
+
404: "We couldn't find what you're looking for.",
|
|
12
|
+
408: "The request took too long. Please try again.",
|
|
13
|
+
409: "There's a conflict with the current state. Please refresh and try again.",
|
|
14
|
+
410: "This session has expired. Please start over.",
|
|
15
|
+
422: "Some of the information you provided couldn't be processed.",
|
|
16
|
+
423: "This account is temporarily locked. Please try again later.",
|
|
17
|
+
429: "Too many requests. Please wait a moment and try again.",
|
|
18
|
+
500: "Something went wrong on our end. Please try again in a moment.",
|
|
19
|
+
502: "We're having trouble reaching the server. Please try again shortly.",
|
|
20
|
+
503: "The service is temporarily unavailable. Please try again in a few minutes.",
|
|
21
|
+
504: "The server took too long to respond. Please try again."
|
|
22
|
+
};
|
|
23
|
+
function friendlyMessageForStatus(status) {
|
|
24
|
+
const mapped = FRIENDLY_STATUS_MESSAGES[status];
|
|
25
|
+
if (mapped) return mapped;
|
|
26
|
+
if (status >= 500) return FRIENDLY_STATUS_MESSAGES[500];
|
|
27
|
+
if (status >= 400) return "Something went wrong with that request. Please try again.";
|
|
28
|
+
return "Unexpected response from the server.";
|
|
29
|
+
}
|
|
7
30
|
function useWfForm(options) {
|
|
8
31
|
const tokenName = options.tokenName ?? "wfs";
|
|
9
32
|
const wfidName = options.wfidName ?? "wfid";
|
|
@@ -104,8 +127,9 @@ function useWfForm(options) {
|
|
|
104
127
|
const data = await res.json().catch(() => null);
|
|
105
128
|
if (data && typeof data === "object" && !Array.isArray(data)) extractToken(data);
|
|
106
129
|
if (!res.ok) {
|
|
130
|
+
const errData = data;
|
|
107
131
|
error.value = {
|
|
108
|
-
message:
|
|
132
|
+
message: errData?.error ?? errData?.message ?? friendlyMessageForStatus(res.status),
|
|
109
133
|
status: res.status
|
|
110
134
|
};
|
|
111
135
|
return;
|
package/dist/as-wf-form.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_wf_form_default } from "./as-wf-form-
|
|
1
|
+
import { t as as_wf_form_default } from "./as-wf-form-CyCi3tZP.mjs";
|
|
2
2
|
export { as_wf_form_default as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as useWfForm, t as as_wf_form_default } from "./as-wf-form-
|
|
1
|
+
import { n as useWfForm, t as as_wf_form_default } from "./as-wf-form-CyCi3tZP.mjs";
|
|
2
2
|
import { t as as_wf_finish_default } from "./as-wf-finish-CfbsKJhX.mjs";
|
|
3
3
|
export { as_wf_finish_default as AsWfFinish, as_wf_form_default as AsWfForm, useWfForm };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/vue-wf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"description": "Workflow form integration for Vue 3 — HTTP round-trip loop driven by atscript type metadata",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -50,25 +50,25 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@atscript/ui": "^0.1.
|
|
53
|
+
"@atscript/ui": "^0.1.75"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@atscript/core": "^0.1.
|
|
57
|
-
"@atscript/typescript": "^0.1.
|
|
56
|
+
"@atscript/core": "^0.1.62",
|
|
57
|
+
"@atscript/typescript": "^0.1.62",
|
|
58
58
|
"@vitejs/plugin-vue": "^6",
|
|
59
59
|
"@vue/test-utils": "^2",
|
|
60
60
|
"happy-dom": "^18",
|
|
61
|
-
"unplugin-atscript": "^0.1.
|
|
61
|
+
"unplugin-atscript": "^0.1.62",
|
|
62
62
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14",
|
|
63
63
|
"vue": "^3",
|
|
64
|
-
"vue-tsc": "
|
|
65
|
-
"@atscript/
|
|
66
|
-
"@atscript/
|
|
64
|
+
"vue-tsc": "~3.2.9",
|
|
65
|
+
"@atscript/vue-form": "^0.1.75",
|
|
66
|
+
"@atscript/moost-wf": "^0.1.75"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@atscript/typescript": "^0.1.
|
|
69
|
+
"@atscript/typescript": "^0.1.62",
|
|
70
70
|
"vue": "^3",
|
|
71
|
-
"@atscript/vue-form": "^0.1.
|
|
71
|
+
"@atscript/vue-form": "^0.1.75"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "node ../../scripts/gen-exports.mjs && vp pack",
|