@jskit-ai/http-web 0.2.8 → 0.2.9

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.
Files changed (68) hide show
  1. package/package.json +7 -6
  2. package/src/client/bulkActions.js +2 -0
  3. package/src/client/components/CrudAddEditScreen.vue +13 -18
  4. package/src/client/components/CrudDeleteAction.vue +1 -1
  5. package/src/client/components/CrudListBulkActionSurface.vue +13 -13
  6. package/src/client/components/CrudListDateFilterControl.vue +2 -2
  7. package/src/client/components/CrudListFilterControls.vue +4 -4
  8. package/src/client/components/CrudListFilterSurface.vue +8 -8
  9. package/src/client/components/CrudListRecordActionMenu.vue +9 -19
  10. package/src/client/components/CrudListScreen.vue +21 -39
  11. package/src/client/components/CrudViewScreen.vue +4 -4
  12. package/src/client/components/SelectField.vue +1 -0
  13. package/src/client/composables/crud/crudHttpClientSupport.js +10 -10
  14. package/src/client/composables/crud/crudJsonApiTransportSupport.js +1 -0
  15. package/src/client/composables/crud/crudLookupFieldRuntime.js +3 -3
  16. package/src/client/composables/crud/crudSchemaFormHelpers.js +3 -3
  17. package/src/client/composables/internal/crudListFilterLookupSupport.js +10 -8
  18. package/src/client/composables/internal/crudListParentTitleSupport.js +2 -2
  19. package/src/client/composables/internal/useOperationScope.js +7 -5
  20. package/src/client/composables/records/useAddEdit.js +12 -11
  21. package/src/client/composables/records/useCrudAddEdit.js +27 -40
  22. package/src/client/composables/records/useCrudList.js +4 -11
  23. package/src/client/composables/records/useCrudView.js +4 -10
  24. package/src/client/composables/records/useList.js +18 -11
  25. package/src/client/composables/records/useView.js +18 -11
  26. package/src/client/composables/runtime/addEditUiRuntime.js +10 -17
  27. package/src/client/composables/runtime/listUiRuntime.js +17 -20
  28. package/src/client/composables/runtime/modelStateHelpers.js +18 -8
  29. package/src/client/composables/runtime/operationUiHelpers.js +20 -20
  30. package/src/client/composables/runtime/operationValidationHelpers.js +10 -5
  31. package/src/client/composables/runtime/useAddEditCore.js +39 -36
  32. package/src/client/composables/runtime/useCommandCore.js +33 -32
  33. package/src/client/composables/runtime/useEndpointResource.js +10 -14
  34. package/src/client/composables/runtime/useFieldErrorBag.js +3 -2
  35. package/src/client/composables/runtime/useListCore.js +7 -11
  36. package/src/client/composables/runtime/useUiFeedback.js +3 -2
  37. package/src/client/composables/runtime/useViewCore.js +10 -20
  38. package/src/client/composables/runtime/viewUiRuntime.js +7 -6
  39. package/src/client/composables/support/listQueryParamSupport.js +6 -10
  40. package/src/client/composables/support/refValueHelpers.js +2 -6
  41. package/src/client/composables/support/requestQueryRuntimeSupport.js +2 -2
  42. package/src/client/composables/support/routeTemplateHelpers.js +13 -12
  43. package/src/client/composables/support/scopeHelpers.js +5 -4
  44. package/src/client/composables/useAccess.js +8 -5
  45. package/src/client/composables/useCommand.js +7 -6
  46. package/src/client/composables/useCrudAddEditScreen.js +13 -12
  47. package/src/client/composables/useCrudDeleteAction.js +13 -25
  48. package/src/client/composables/useCrudListBulkActions.js +18 -14
  49. package/src/client/composables/useCrudListFilterLookups.js +8 -4
  50. package/src/client/composables/useCrudListFilters.js +13 -6
  51. package/src/client/composables/useCrudListParentTitle.js +10 -9
  52. package/src/client/composables/useCrudListRowActions.js +15 -11
  53. package/src/client/composables/useCrudListScreen.js +17 -16
  54. package/src/client/composables/useCrudViewScreen.js +8 -7
  55. package/src/client/composables/usePagedCollection.js +9 -18
  56. package/src/client/composables/useRealtimeQueryInvalidation.js +15 -13
  57. package/src/client/composables/useScopeRuntime.js +3 -2
  58. package/src/client/lib/httpClient.js +12 -10
  59. package/src/client/rowActions.js +2 -0
  60. package/src/client/support/crudListActionSupport.js +16 -8
  61. package/src/client/types.js +596 -0
  62. package/test/crudScreenComponents.test.js +4 -2
  63. package/test/exportsContract.test.js +1 -0
  64. package/test/requestTransportOptions.test.js +7 -7
  65. package/test/translation.test.js +3 -0
  66. package/test/useAddEditCore.test.js +4 -0
  67. package/test/useCrudDeleteAction.test.js +4 -4
  68. package/test/viewCoreLoading.test.js +0 -19
@@ -3,6 +3,7 @@ import test from "node:test";
3
3
  import { QueryClient, QueryObserver, VueQueryPlugin } from "@tanstack/vue-query";
4
4
  import { createSSRApp, h } from "vue";
5
5
  import { renderToString } from "vue/server-renderer";
6
+ import { routeLocationKey } from "vue-router";
6
7
 
7
8
  import {
8
9
  buildEndpointReadRequestOptions,
@@ -10,10 +11,7 @@ import {
10
11
  useEndpointResource
11
12
  } from "../src/client/composables/runtime/useEndpointResource.js";
12
13
  import { useCommand } from "../src/client/composables/useCommand.js";
13
- import {
14
- configureHttpWebClient,
15
- resetHttpWebClientForTests
16
- } from "../src/client/lib/httpClient.js";
14
+ import { configureHttpWebClient } from "../src/client/lib/httpClient.js";
17
15
  import { buildListRequestOptions, useListCore } from "../src/client/composables/runtime/useListCore.js";
18
16
  import {
19
17
  resolveOperationRealtimeOptions,
@@ -490,7 +488,7 @@ test("endpoint resources use the configured http-web HTTP client by default", as
490
488
 
491
489
  assert.equal(calls.at(-1)?.[0], "/api/app/acme/chat/sessions");
492
490
  } finally {
493
- resetHttpWebClientForTests();
491
+ configureHttpWebClient();
494
492
  }
495
493
  });
496
494
 
@@ -536,6 +534,7 @@ test("commands use the configured http-web HTTP client by default", async () =>
536
534
  return () => h("div");
537
535
  }
538
536
  });
537
+ app.provide(routeLocationKey, { path: "/" });
539
538
  app.use(VueQueryPlugin, {
540
539
  queryClient
541
540
  });
@@ -546,7 +545,7 @@ test("commands use the configured http-web HTTP client by default", async () =>
546
545
  assert.equal(calls.at(-1)?.[0], "/api/app/acme/chat/sessions");
547
546
  assert.equal(calls.at(-1)?.[1]?.method, "POST");
548
547
  } finally {
549
- resetHttpWebClientForTests();
548
+ configureHttpWebClient();
550
549
  }
551
550
  });
552
551
 
@@ -586,6 +585,7 @@ test("commands use public CRUD resource access without a CSRF session preflight"
586
585
  return () => h("div");
587
586
  }
588
587
  });
588
+ app.provide(routeLocationKey, { path: "/" });
589
589
  app.use(VueQueryPlugin, {
590
590
  queryClient
591
591
  });
@@ -598,6 +598,6 @@ test("commands use public CRUD resource access without a CSRF session preflight"
598
598
  assert.equal(calls[0][1].method, "DELETE");
599
599
  assert.equal(Object.hasOwn(calls[0][1], "csrf"), false);
600
600
  } finally {
601
- resetHttpWebClientForTests();
601
+ configureHttpWebClient();
602
602
  }
603
603
  });
@@ -133,7 +133,10 @@ test("CRUD list chrome is English by default and follows the active language", a
133
133
  const screen = {
134
134
  records: { hasMore: true, loadError: "" },
135
135
  listPrimaryAction: "/books/new",
136
+ bulkActions: { hasActions: false },
137
+ rowActions: { hasActions: false, hasVisibleActionsFor: () => false },
136
138
  displayRows: [{ key: "1", recordKey: "1", record: { title: "Kindred" } }],
139
+ selectableRows: [],
137
140
  resolveRecordTitle: (record) => record.title
138
141
  };
139
142
 
@@ -15,6 +15,8 @@ test("useAddEditCore writes saved payloads to the submit-time query key", async
15
15
  };
16
16
  const resource = {
17
17
  isSaving: ref(false),
18
+ query: { isPending: ref(false) },
19
+ data: ref(null),
18
20
  async save() {
19
21
  return payload;
20
22
  }
@@ -72,6 +74,8 @@ test("useAddEditCore snapshots the cache key after payload normalization", async
72
74
  };
73
75
  const resource = {
74
76
  isSaving: ref(false),
77
+ query: { isPending: ref(false) },
78
+ data: ref(null),
75
79
  async save() {
76
80
  return payload;
77
81
  }
@@ -4,7 +4,7 @@ import { QueryClient, QueryObserver, VueQueryPlugin } from "@tanstack/vue-query"
4
4
  import { createSSRApp, effectScope, h, nextTick, ref, watch } from "vue";
5
5
  import { renderToString } from "vue/server-renderer";
6
6
  import { createMemoryHistory, createRouter } from "vue-router";
7
- import { configureHttpWebClient, resetHttpWebClientForTests } from "../src/client/lib/httpClient.js";
7
+ import { configureHttpWebClient } from "../src/client/lib/httpClient.js";
8
8
  import {
9
9
  requireCrudDeleteOperation,
10
10
  useCrudDeleteAction
@@ -184,7 +184,7 @@ test("useCrudDeleteAction keeps the record dialog open with useful error feedbac
184
184
  });
185
185
 
186
186
  test("public deletion resolves the configured client without session CSRF", async (t) => {
187
- t.after(resetHttpWebClientForTests);
187
+ t.after(() => configureHttpWebClient());
188
188
  const requests = [];
189
189
  configureHttpWebClient({
190
190
  async request(path, options) {
@@ -207,7 +207,7 @@ test("public deletion resolves the configured client without session CSRF", asyn
207
207
  });
208
208
 
209
209
  test("authenticated deletion retains configured-client CSRF behavior", async (t) => {
210
- t.after(resetHttpWebClientForTests);
210
+ t.after(() => configureHttpWebClient());
211
211
  const requests = [];
212
212
  configureHttpWebClient({
213
213
  async request(path, options) {
@@ -226,7 +226,7 @@ test("authenticated deletion retains configured-client CSRF behavior", async (t)
226
226
  });
227
227
 
228
228
  test("public deletion honors an explicit client override", async (t) => {
229
- t.after(resetHttpWebClientForTests);
229
+ t.after(() => configureHttpWebClient());
230
230
  configureHttpWebClient({
231
231
  request() {
232
232
  assert.fail("The configured client must not replace the explicit override.");
@@ -23,22 +23,3 @@ test("useViewCore prefers resource isInitialLoading/isFetching signals when prov
23
23
  assert.equal(view.isLoading.value, false);
24
24
  assert.equal(view.isFetching.value, true);
25
25
  });
26
-
27
- test("useViewCore falls back to query pending/fetching when resource-level loading refs are absent", () => {
28
- const resource = {
29
- data: ref(null),
30
- query: {
31
- isPending: ref(true),
32
- isFetching: ref(false),
33
- error: ref(null)
34
- },
35
- loadError: ref("")
36
- };
37
-
38
- const view = useViewCore({
39
- resource
40
- });
41
-
42
- assert.equal(view.isLoading.value, true);
43
- assert.equal(view.isFetching.value, false);
44
- });