@jskit-ai/http-web 0.2.6 → 0.2.8
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/package.json +6 -6
- package/src/client/composables/runtime/operationValidationHelpers.js +2 -2
- package/test/addEditUiRuntime.test.js +8 -8
- package/test/listUiRuntime.test.js +5 -5
- package/test/requestTransportOptions.test.js +8 -8
- package/test/routeTemplateHelpers.test.js +5 -5
- package/test/useCrudListParentTitle.test.js +6 -6
- package/test/viewUiRuntime.test.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/http-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test --test-concurrency=1"
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"./locales/en.json": "./locales/en.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
49
|
+
"@jskit-ai/resource-crud-core": "0.1.195",
|
|
50
50
|
"@mdi/js": "^7.4.47"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@jskit-ai/http-runtime": "0.2.
|
|
54
|
-
"@jskit-ai/kernel": "0.2.
|
|
55
|
-
"@jskit-ai/realtime": "0.2.
|
|
56
|
-
"@jskit-ai/shell-web": "0.2.
|
|
53
|
+
"@jskit-ai/http-runtime": "0.2.4",
|
|
54
|
+
"@jskit-ai/kernel": "0.2.4",
|
|
55
|
+
"@jskit-ai/realtime": "0.2.7",
|
|
56
|
+
"@jskit-ai/shell-web": "0.2.4",
|
|
57
57
|
"@tanstack/vue-query": "^5.90.5",
|
|
58
58
|
"vue": "^3.5.13",
|
|
59
59
|
"vue-router": "^5.0.4",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buildValidationFailure } from "@jskit-ai/http-runtime/client";
|
|
2
2
|
import { validateSchemaPayload } from "@jskit-ai/kernel/shared/validators";
|
|
3
3
|
import { toUiFieldErrors } from "../support/errorMessageHelpers.js";
|
|
4
4
|
import { useJskitText } from "../../i18n.js";
|
|
@@ -36,7 +36,7 @@ function validateOperationInput({
|
|
|
36
36
|
|
|
37
37
|
const fieldErrorCodes = error.fieldErrorCodes || error.details?.fieldErrorCodes;
|
|
38
38
|
const failure = {
|
|
39
|
-
...
|
|
39
|
+
...buildValidationFailure({
|
|
40
40
|
error: text(validationMessage) || t("jskit.http.feedback.validationFailed"),
|
|
41
41
|
code: "validation_failed",
|
|
42
42
|
fieldErrors: error?.fieldErrors
|
|
@@ -39,17 +39,17 @@ test("createAddEditUiRuntime keeps nested child routes stable when the saved chi
|
|
|
39
39
|
const runtime = createAddEditUiRuntime({
|
|
40
40
|
recordIdParam: "addressId",
|
|
41
41
|
routeParams: ref({
|
|
42
|
-
workspaceSlug: "
|
|
42
|
+
workspaceSlug: "tony",
|
|
43
43
|
contactId: "1"
|
|
44
44
|
}),
|
|
45
45
|
routeParamNames: ref(["workspaceSlug", "contactId"]),
|
|
46
|
-
routePath: ref("/w/
|
|
46
|
+
routePath: ref("/w/tony/admin/contacts/1/addresses/new"),
|
|
47
47
|
viewUrlTemplate: "../:addressId",
|
|
48
48
|
listUrlTemplate: ".."
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
assert.equal(runtime.listUrl.value, "/w/
|
|
52
|
-
assert.equal(runtime.resolveSavedViewUrl({ id: 1 }), "/w/
|
|
51
|
+
assert.equal(runtime.listUrl.value, "/w/tony/admin/contacts/1/addresses");
|
|
52
|
+
assert.equal(runtime.resolveSavedViewUrl({ id: 1 }), "/w/tony/admin/contacts/1/addresses/1");
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
test("createAddEditUiRuntime resolves edit-page relative list and cancel links", () => {
|
|
@@ -72,18 +72,18 @@ test("createAddEditUiRuntime resolves nested edit links from the record scope",
|
|
|
72
72
|
const runtime = createAddEditUiRuntime({
|
|
73
73
|
recordIdParam: "petId",
|
|
74
74
|
routeParams: ref({
|
|
75
|
-
workspaceSlug: "
|
|
75
|
+
workspaceSlug: "harbor",
|
|
76
76
|
contactId: "541841",
|
|
77
77
|
petId: "715528"
|
|
78
78
|
}),
|
|
79
79
|
routeParamNames: ref(["workspaceSlug", "contactId", "petId"]),
|
|
80
|
-
routePath: ref("/w/
|
|
80
|
+
routePath: ref("/w/harbor/admin/contacts/541841/pets/715528/edit/advanced"),
|
|
81
81
|
viewUrlTemplate: "..",
|
|
82
82
|
listUrlTemplate: "../.."
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
assert.equal(runtime.cancelUrl.value, "/w/
|
|
86
|
-
assert.equal(runtime.listUrl.value, "/w/
|
|
85
|
+
assert.equal(runtime.cancelUrl.value, "/w/harbor/admin/contacts/541841/pets/715528");
|
|
86
|
+
assert.equal(runtime.listUrl.value, "/w/harbor/admin/contacts/541841/pets");
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
test("createAddEditUiRuntime supports custom saved-record selector", () => {
|
|
@@ -30,19 +30,19 @@ test("createListUiRuntime resolves nested route links from the parent list scope
|
|
|
30
30
|
isInitialLoading: ref(false),
|
|
31
31
|
recordIdParam: "petId",
|
|
32
32
|
routeParams: ref({
|
|
33
|
-
workspaceSlug: "
|
|
33
|
+
workspaceSlug: "harbor",
|
|
34
34
|
contactId: "541841",
|
|
35
35
|
petId: "715528"
|
|
36
36
|
}),
|
|
37
37
|
routeParamNames: ref(["workspaceSlug", "contactId", "petId"]),
|
|
38
|
-
routePath: ref("/w/
|
|
38
|
+
routePath: ref("/w/harbor/admin/contacts/541841/pets/715528"),
|
|
39
39
|
viewUrlTemplate: "./:petId",
|
|
40
40
|
editUrlTemplate: "./:petId/edit"
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
assert.equal(runtime.resolveParams("./new"), "/w/
|
|
44
|
-
assert.equal(runtime.resolveViewUrl({ id: "901" }), "/w/
|
|
45
|
-
assert.equal(runtime.resolveEditUrl({ id: "901" }), "/w/
|
|
43
|
+
assert.equal(runtime.resolveParams("./new"), "/w/harbor/admin/contacts/541841/pets/new");
|
|
44
|
+
assert.equal(runtime.resolveViewUrl({ id: "901" }), "/w/harbor/admin/contacts/541841/pets/901");
|
|
45
|
+
assert.equal(runtime.resolveEditUrl({ id: "901" }), "/w/harbor/admin/contacts/541841/pets/901/edit");
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
test("createListUiRuntime resolves templates that depend on existing route params", () => {
|
|
@@ -310,7 +310,7 @@ test("realtime bursts never cancel a read in flight and read once more after it"
|
|
|
310
310
|
|
|
311
311
|
test("endpoint resource reads attach request recovery metadata to query options", async () => {
|
|
312
312
|
const queryClient = new QueryClient();
|
|
313
|
-
const queryKey = ["project-access", "
|
|
313
|
+
const queryKey = ["project-access", "acme"];
|
|
314
314
|
const app = createSSRApp({
|
|
315
315
|
setup() {
|
|
316
316
|
useEndpointResource({
|
|
@@ -448,7 +448,7 @@ test("endpoint resources use the configured http-web HTTP client by default", as
|
|
|
448
448
|
enabled: false
|
|
449
449
|
},
|
|
450
450
|
resolveRequestUrl(url) {
|
|
451
|
-
return url.replace(/^\/api\//u, "/api/app/
|
|
451
|
+
return url.replace(/^\/api\//u, "/api/app/acme/");
|
|
452
452
|
},
|
|
453
453
|
fetchImpl: async (url, options) => {
|
|
454
454
|
calls.push([url, options]);
|
|
@@ -475,8 +475,8 @@ test("endpoint resources use the configured http-web HTTP client by default", as
|
|
|
475
475
|
const app = createSSRApp({
|
|
476
476
|
setup() {
|
|
477
477
|
resource = useEndpointResource({
|
|
478
|
-
queryKey: ["
|
|
479
|
-
path: "/api/
|
|
478
|
+
queryKey: ["chat-sessions"],
|
|
479
|
+
path: "/api/chat/sessions"
|
|
480
480
|
});
|
|
481
481
|
return () => h("div");
|
|
482
482
|
}
|
|
@@ -488,7 +488,7 @@ test("endpoint resources use the configured http-web HTTP client by default", as
|
|
|
488
488
|
|
|
489
489
|
await resource.reload();
|
|
490
490
|
|
|
491
|
-
assert.equal(calls.at(-1)?.[0], "/api/app/
|
|
491
|
+
assert.equal(calls.at(-1)?.[0], "/api/app/acme/chat/sessions");
|
|
492
492
|
} finally {
|
|
493
493
|
resetHttpWebClientForTests();
|
|
494
494
|
}
|
|
@@ -503,7 +503,7 @@ test("commands use the configured http-web HTTP client by default", async () =>
|
|
|
503
503
|
enabled: false
|
|
504
504
|
},
|
|
505
505
|
resolveRequestUrl(url) {
|
|
506
|
-
return url.replace(/^\/api\//u, "/api/app/
|
|
506
|
+
return url.replace(/^\/api\//u, "/api/app/acme/");
|
|
507
507
|
},
|
|
508
508
|
fetchImpl: async (url, options) => {
|
|
509
509
|
calls.push([url, options]);
|
|
@@ -531,7 +531,7 @@ test("commands use the configured http-web HTTP client by default", async () =>
|
|
|
531
531
|
setup() {
|
|
532
532
|
command = useCommand({
|
|
533
533
|
access: "always",
|
|
534
|
-
apiSuffix: "/
|
|
534
|
+
apiSuffix: "/chat/sessions"
|
|
535
535
|
});
|
|
536
536
|
return () => h("div");
|
|
537
537
|
}
|
|
@@ -543,7 +543,7 @@ test("commands use the configured http-web HTTP client by default", async () =>
|
|
|
543
543
|
|
|
544
544
|
await command.run();
|
|
545
545
|
|
|
546
|
-
assert.equal(calls.at(-1)?.[0], "/api/app/
|
|
546
|
+
assert.equal(calls.at(-1)?.[0], "/api/app/acme/chat/sessions");
|
|
547
547
|
assert.equal(calls.at(-1)?.[1]?.method, "POST");
|
|
548
548
|
} finally {
|
|
549
549
|
resetHttpWebClientForTests();
|
|
@@ -30,9 +30,9 @@ test("resolveRouteParamNamesInOrder prefers matched route templates", () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
test("resolveScopedRoutePathname supports at/before/after anchors", () => {
|
|
33
|
-
const currentPathname = "/w/
|
|
33
|
+
const currentPathname = "/w/harbor/admin/contacts/541841/pets/715528/edit/advanced";
|
|
34
34
|
const params = {
|
|
35
|
-
workspaceSlug: "
|
|
35
|
+
workspaceSlug: "harbor",
|
|
36
36
|
contactId: "541841",
|
|
37
37
|
petId: "715528"
|
|
38
38
|
};
|
|
@@ -46,7 +46,7 @@ test("resolveScopedRoutePathname supports at/before/after anchors", () => {
|
|
|
46
46
|
anchorParamName: "contactId",
|
|
47
47
|
anchorMode: "at"
|
|
48
48
|
}),
|
|
49
|
-
"/w/
|
|
49
|
+
"/w/harbor/admin/contacts/541841"
|
|
50
50
|
);
|
|
51
51
|
assert.equal(
|
|
52
52
|
resolveScopedRoutePathname({
|
|
@@ -56,7 +56,7 @@ test("resolveScopedRoutePathname supports at/before/after anchors", () => {
|
|
|
56
56
|
anchorParamName: "petId",
|
|
57
57
|
anchorMode: "before"
|
|
58
58
|
}),
|
|
59
|
-
"/w/
|
|
59
|
+
"/w/harbor/admin/contacts/541841/pets"
|
|
60
60
|
);
|
|
61
61
|
assert.equal(
|
|
62
62
|
resolveScopedRoutePathname({
|
|
@@ -66,7 +66,7 @@ test("resolveScopedRoutePathname supports at/before/after anchors", () => {
|
|
|
66
66
|
anchorParamName: "petId",
|
|
67
67
|
anchorMode: "after"
|
|
68
68
|
}),
|
|
69
|
-
"/w/
|
|
69
|
+
"/w/harbor/admin/contacts/541841/pets/715528/edit"
|
|
70
70
|
);
|
|
71
71
|
});
|
|
72
72
|
|
|
@@ -45,7 +45,7 @@ test("resolveCrudListParentDescriptor selects the nearest lookup route parent",
|
|
|
45
45
|
{ path: "/w/:workspaceSlug/admin/contacts/:contactId/availabilities" }
|
|
46
46
|
],
|
|
47
47
|
params: {
|
|
48
|
-
workspaceSlug: "
|
|
48
|
+
workspaceSlug: "harbor",
|
|
49
49
|
contactId: "538779"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
@@ -80,7 +80,7 @@ test("resolveCrudListParentTitleFromItems uses the hydrated lookup label", () =>
|
|
|
80
80
|
route: {
|
|
81
81
|
matched: [{ path: "/w/:workspaceSlug/admin/contacts/:contactId/availabilities" }],
|
|
82
82
|
params: {
|
|
83
|
-
workspaceSlug: "
|
|
83
|
+
workspaceSlug: "harbor",
|
|
84
84
|
contactId: "538779"
|
|
85
85
|
}
|
|
86
86
|
},
|
|
@@ -113,7 +113,7 @@ test("resolveCrudListParentTitleFromItems ignores raw lookup ids when no hydrate
|
|
|
113
113
|
route: {
|
|
114
114
|
matched: [{ path: "/w/:workspaceSlug/admin/contacts/:contactId/availabilities" }],
|
|
115
115
|
params: {
|
|
116
|
-
workspaceSlug: "
|
|
116
|
+
workspaceSlug: "harbor",
|
|
117
117
|
contactId: "538779"
|
|
118
118
|
}
|
|
119
119
|
},
|
|
@@ -171,7 +171,7 @@ test("resolveCrudListParentDescriptor supports parentRouteParamKey aliases", ()
|
|
|
171
171
|
route: {
|
|
172
172
|
matched: [{ path: "/w/:workspaceSlug/admin/contacts/:contactId/availabilities" }],
|
|
173
173
|
params: {
|
|
174
|
-
workspaceSlug: "
|
|
174
|
+
workspaceSlug: "harbor",
|
|
175
175
|
contactId: "538779"
|
|
176
176
|
}
|
|
177
177
|
},
|
|
@@ -199,7 +199,7 @@ test("useCrudListParentTitle loads the parent record when child rows only expose
|
|
|
199
199
|
route: {
|
|
200
200
|
matched: [{ path: "/w/:workspaceSlug/admin/contacts/:contactId/availabilities" }],
|
|
201
201
|
params: {
|
|
202
|
-
workspaceSlug: "
|
|
202
|
+
workspaceSlug: "harbor",
|
|
203
203
|
contactId: "538779"
|
|
204
204
|
}
|
|
205
205
|
},
|
|
@@ -237,7 +237,7 @@ test("useCrudListParentTitle requests the parent through JSON:API record transpo
|
|
|
237
237
|
route: {
|
|
238
238
|
matched: [{ path: "/w/:workspaceSlug/admin/contacts/:contactId/availabilities" }],
|
|
239
239
|
params: {
|
|
240
|
-
workspaceSlug: "
|
|
240
|
+
workspaceSlug: "harbor",
|
|
241
241
|
contactId: "538779"
|
|
242
242
|
}
|
|
243
243
|
},
|
|
@@ -27,19 +27,19 @@ test("createViewUiRuntime resolves view links from the record pathname when rout
|
|
|
27
27
|
const runtime = createViewUiRuntime({
|
|
28
28
|
recordIdParam: "contactId",
|
|
29
29
|
routeParams: ref({
|
|
30
|
-
workspaceSlug: "
|
|
30
|
+
workspaceSlug: "harbor",
|
|
31
31
|
contactId: "541841",
|
|
32
32
|
petId: "715528"
|
|
33
33
|
}),
|
|
34
34
|
routeParamNames: ref(["workspaceSlug", "contactId", "petId"]),
|
|
35
|
-
routePath: ref("/w/
|
|
35
|
+
routePath: ref("/w/harbor/admin/contacts/541841/pets/715528"),
|
|
36
36
|
listUrlTemplate: "..",
|
|
37
37
|
editUrlTemplate: "./edit"
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
assert.equal(runtime.listUrl.value, "/w/
|
|
41
|
-
assert.equal(runtime.editUrl.value, "/w/
|
|
42
|
-
assert.equal(runtime.resolveParams("./edit"), "/w/
|
|
40
|
+
assert.equal(runtime.listUrl.value, "/w/harbor/admin/contacts");
|
|
41
|
+
assert.equal(runtime.editUrl.value, "/w/harbor/admin/contacts/541841/edit");
|
|
42
|
+
assert.equal(runtime.resolveParams("./edit"), "/w/harbor/admin/contacts/541841/edit");
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
test("createViewUiRuntime uses route param order when repeated values are present", () => {
|