@arrai-innovations/reactive-helpers 21.1.2 → 22.1.0

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 (78) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +109 -21
  3. package/config/commonCrud.js +7 -10
  4. package/config/listCrud.js +33 -33
  5. package/config/objectCrud.js +64 -59
  6. package/package.json +103 -89
  7. package/types/config/listCrud.d.ts +83 -28
  8. package/types/config/objectCrud.d.ts +139 -49
  9. package/types/tests/benchmarks/fixtures.d.ts +60 -0
  10. package/types/tests/benchmarks/listLayers.bench.d.ts +1 -0
  11. package/types/tests/benchmarks/listPush.bench.d.ts +1 -0
  12. package/types/tests/benchmarks/listStream.bench.d.ts +1 -0
  13. package/types/tests/unit/use/lifecycleCleanup.spec.d.ts +1 -0
  14. package/types/tests/unit/use/listPerformance.spec.d.ts +1 -0
  15. package/types/tests/unit/utils/cancellablePromise.spec.d.ts +1 -0
  16. package/types/use/cancellableIntent.d.ts +36 -33
  17. package/types/use/combineClasses.d.ts +5 -2
  18. package/types/use/error.d.ts +39 -19
  19. package/types/use/list.d.ts +27 -26
  20. package/types/use/listCalculated.d.ts +38 -55
  21. package/types/use/listFilter.d.ts +25 -33
  22. package/types/use/listInstance.d.ts +94 -81
  23. package/types/use/listRelated.d.ts +37 -57
  24. package/types/use/listSearch.d.ts +54 -52
  25. package/types/use/listSort.d.ts +31 -40
  26. package/types/use/listSubscription.d.ts +33 -36
  27. package/types/use/loading.d.ts +20 -10
  28. package/types/use/loadingError.d.ts +12 -3
  29. package/types/use/object.d.ts +8 -5
  30. package/types/use/objectCalculated.d.ts +46 -39
  31. package/types/use/objectInstance.d.ts +70 -74
  32. package/types/use/objectRelated.d.ts +51 -41
  33. package/types/use/objectSubscription.d.ts +38 -48
  34. package/types/use/proxyError.d.ts +15 -6
  35. package/types/use/proxyLoading.d.ts +11 -5
  36. package/types/use/proxyLoadingError.d.ts +19 -7
  37. package/types/use/search.d.ts +33 -29
  38. package/types/utils/assignReactiveObject.d.ts +3 -0
  39. package/types/utils/cancellableFetch.d.ts +2 -3
  40. package/types/utils/cancellablePromise.d.ts +42 -8
  41. package/types/utils/classes.d.ts +7 -1
  42. package/types/utils/deepUnref.d.ts +1 -1
  43. package/types/utils/getFakePk.d.ts +2 -2
  44. package/types/utils/isReactiveTyped.d.ts +2 -0
  45. package/types/utils/keyDiff.d.ts +4 -6
  46. package/types/utils/relatedCalculatedHelpers.d.ts +2 -0
  47. package/types/utils/watches.d.ts +1 -1
  48. package/use/cancellableIntent.js +36 -9
  49. package/use/combineClasses.js +2 -2
  50. package/use/error.js +10 -14
  51. package/use/list.js +6 -18
  52. package/use/listCalculated.js +28 -38
  53. package/use/listFilter.js +12 -24
  54. package/use/listInstance.js +101 -60
  55. package/use/listRelated.js +18 -37
  56. package/use/listSearch.js +9 -18
  57. package/use/listSort.js +95 -64
  58. package/use/listSubscription.js +19 -25
  59. package/use/loading.js +5 -7
  60. package/use/loadingError.js +3 -3
  61. package/use/object.js +14 -27
  62. package/use/objectCalculated.js +21 -25
  63. package/use/objectInstance.js +55 -50
  64. package/use/objectRelated.js +19 -25
  65. package/use/objectSubscription.js +18 -30
  66. package/use/proxyError.js +10 -10
  67. package/use/proxyLoading.js +5 -5
  68. package/use/proxyLoadingError.js +13 -8
  69. package/use/search.js +5 -11
  70. package/utils/assignReactiveObject.js +3 -3
  71. package/utils/cancellableFetch.js +3 -3
  72. package/utils/cancellablePromise.js +25 -8
  73. package/utils/classes.js +2 -2
  74. package/utils/deepUnref.js +1 -5
  75. package/utils/getFakePk.js +2 -2
  76. package/utils/isReactiveTyped.js +2 -0
  77. package/utils/keyDiff.js +1 -3
  78. package/utils/relatedCalculatedHelpers.js +2 -0
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2021-2026, Arrai Innovations Inc.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,57 +1,141 @@
1
1
  # reactive-helpers
2
2
 
3
- ![Tests for 14.x](https://docs.arrai-dev.com/reactive-helpers/artifacts/main/tests.svg)
4
- [![Coverage for 14.x](https://docs.arrai-dev.com/reactive-helpers/artifacts/main/tests.coverage.svg)](https://docs.arrai-dev.com/reactive-helpers/artifacts/main/coverage_tests/)
5
- ![ESLint](https://docs.arrai-dev.com/reactive-helpers/artifacts/main/eslint.svg)
6
- ![Prettier](https://docs.arrai-dev.com/reactive-helpers/artifacts/main/prettier.svg)
7
- ![Audit](https://docs.arrai.dev/reactive-helpers/artifacts/main/npm-audit.svg)
3
+ ![Tests](https://docs.arrai.dev/reactive-helpers/artifacts/main/tests.svg)
4
+ [![Coverage](https://docs.arrai.dev/reactive-helpers/artifacts/main/tests.coverage.svg)](https://docs.arrai.dev/reactive-helpers/artifacts/main/coverage_tests/)
5
+ ![ESLint](https://docs.arrai.dev/reactive-helpers/artifacts/main/eslint.svg)
6
+ ![Prettier](https://docs.arrai.dev/reactive-helpers/artifacts/main/prettier.svg)
7
+ ![Audit](https://docs.arrai.dev/reactive-helpers/artifacts/main/pnpm-audit.svg)
8
+ [![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD--3--Clause-blue.svg?style=for-the-badge)](./LICENSE)
8
9
 
9
- Vue.js 3 composition utilities to manage reactive lists, objects and other helpers.
10
+ Vue.js 3 composition utilities to manage reactive lists, objects, loading and error state, and the small helpers that
11
+ support them. The composables give you reactive state plus actions; you supply the data layer (how a list or object
12
+ reaches your backend), so the package stays transport agnostic.
10
13
 
11
14
  <!-- prettier-ignore-start -->
12
15
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
13
16
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
14
17
 
18
+ - [Features](#features)
19
+ - [Requirements](#requirements)
15
20
  - [Install](#install)
16
21
  - [Usage](#usage)
22
+ - [Quick start](#quick-start)
23
+ - [Wiring a data layer](#wiring-a-data-layer)
17
24
  - [Changelog](#changelog)
25
+ - [Contributing](#contributing)
18
26
  - [Development](#development)
27
+ - [License](#license)
19
28
 
20
29
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
21
30
  <!-- prettier-ignore-end -->
22
31
 
32
+ ## Features
33
+
34
+ - **List composables** for managing collections of objects: `useListInstance`, `useList`, `useListFilter`,
35
+ `useListSort`, `useListSearch`, `useListCalculated`, `useListRelated`, and `useListSubscription`.
36
+ - **Object composables** for managing single objects: `useObjectInstance`, `useObject`, `useObjectCalculated`,
37
+ `useObjectRelated`, and `useObjectSubscription`.
38
+ - **Loading and error state** as small, composable primitives: `useLoading`, `useError`, `useLoadingError`, and their
39
+ read-only proxy variants `useProxyLoading`, `useProxyError`, `useProxyLoadingError`.
40
+ - **Standalone helpers** such as `useSearch` (FlexSearch-backed), `useCancellableIntent`, and `useCombineClasses`.
41
+ - **Pluggable CRUD configuration** via `setListCrud` / `setObjectCrud`, so the same composables can drive any backend.
42
+ - **Reactive and object utilities**: `deepUnref`, `assignReactiveObject`, `refIfReactive`, `toRefsIfReactive`,
43
+ `isReactiveTyped`, `set`, `deleteKey`, `keyDiff`, `flattenPaths`, `cancellablePromise`, `cancellableFetch`, and more.
44
+
45
+ Most list and object composables also ship a plural batch variant (for example `useListInstances`,
46
+ `useObjectInstances`) for creating several keyed instances at once. See the full API in
47
+ [docs/reference/api/index.md](./docs/reference/api/index.md).
48
+
49
+ ## Requirements
50
+
51
+ - **Vue** `^3.5.13` (peer dependency).
52
+ - **Node.js** with ES module support. This package is ESM only (`"type": "module"`); there is no CommonJS build.
53
+ - Peer dependencies you install alongside it: [`vue`](https://www.npmjs.com/package/vue),
54
+ [`@vueuse/core`](https://www.npmjs.com/package/@vueuse/core), and
55
+ [`lodash-es`](https://www.npmjs.com/package/lodash-es).
56
+
23
57
  ## Install
24
58
 
25
59
  ```bash
26
- $ npm install @arrai-innovations/reactive-helpers
60
+ $ npm install @arrai-innovations/reactive-helpers vue @vueuse/core lodash-es
27
61
  ```
28
62
 
29
63
  ## Usage
30
64
 
31
- The package exposes many composables and helper utilities. A minimal example of using a list instance is shown below.
65
+ ### Quick start
66
+
67
+ The loading and error composables are self contained and need no configuration. They return readonly reactive state
68
+ plus actions to drive it, which is handy for wiring UI to any asynchronous work:
69
+
70
+ ```javascript
71
+ import { useLoadingError } from "@arrai-innovations/reactive-helpers";
72
+
73
+ const { loading, error, errored, setLoading, clearLoading, setError, clearError } = useLoadingError();
74
+
75
+ async function save() {
76
+ setLoading();
77
+ try {
78
+ await doWork();
79
+ clearError();
80
+ } catch (e) {
81
+ setError(e);
82
+ } finally {
83
+ clearLoading();
84
+ }
85
+ }
86
+
87
+ // `loading`, `error`, and `errored` are readonly refs you can render or watch.
88
+ ```
89
+
90
+ ### Wiring a data layer
91
+
92
+ The list and object instance composables manage reactive collections but stay transport agnostic: you provide the CRUD
93
+ handlers that reach your backend. A list handler receives a `pushObjects` callback to feed results (one or more pages)
94
+ into the reactive state and resolves when it is done:
32
95
 
33
96
  ```javascript
34
97
  import { useListInstance } from "@arrai-innovations/reactive-helpers";
35
98
  import { reactive } from "vue";
36
99
 
37
- const props = reactive({
38
- target: { stream: "contacts" },
39
- pkKey: "id",
40
- params: { fields: ["id", "name"] },
100
+ const contacts = useListInstance({
101
+ props: {
102
+ pkKey: "id",
103
+ params: reactive({ fields: ["id", "name"] }),
104
+ target: { stream: "contacts" }, // implementation-specific args passed through to your handlers
105
+ },
106
+ handlers: {
107
+ list: async ({ pushObjects }) => {
108
+ const rows = await fetch("/api/contacts").then((r) => r.json());
109
+ pushObjects(rows);
110
+ return true;
111
+ },
112
+ },
41
113
  });
42
114
 
43
- const contacts = useListInstance({ props });
44
115
  await contacts.list();
45
116
  console.log(contacts.state.objects);
46
117
  ```
47
118
 
48
- See [docs/README.md](./docs/README.md) for a full list of modules, composables, utilities, as well as, their arguments
49
- and properties.
119
+ To share one data layer across every instance instead of passing `handlers` each time, register defaults once with
120
+ `setListCrud` (and `setObjectCrud` for object instances).
121
+
122
+ See [docs/reference/api/index.md](./docs/reference/api/index.md) for the full list of modules, composables, and
123
+ utilities, along with their arguments and properties.
50
124
 
51
125
  ## Changelog
52
126
 
53
127
  Since v21.0.0, the changelog is available in the [CHANGELOG.md](./CHANGELOG.md) file.
54
128
 
129
+ ## Contributing
130
+
131
+ Issues and pull requests are welcome. A few things to know before you start:
132
+
133
+ - Commits follow [Conventional Commits](https://www.conventionalcommits.org/) and are validated by commitlint through a
134
+ git hook (installed automatically by `pnpm install`).
135
+ - Run the tests, linters, and formatter before opening a pull request (see [Development](#development)).
136
+ - Generated output under `docs/` and `types/` is committed and checked in CI; regenerate it with `pnpm run docs` and
137
+ `pnpm run types` when you change public APIs or their JSDoc.
138
+
55
139
  ## Development
56
140
 
57
141
  1. Checkout this repo:
@@ -63,34 +147,38 @@ Since v21.0.0, the changelog is available in the [CHANGELOG.md](./CHANGELOG.md)
63
147
  2. Install dependencies:
64
148
 
65
149
  ```bash
66
- $ npm install --dev
150
+ $ pnpm install
67
151
  ```
68
152
 
69
153
  3. Run tests via vitest:
70
154
 
71
155
  ```bash
72
- $ npm test
156
+ $ pnpm test
73
157
  ```
74
158
 
75
159
  4. Run tests with coverage output:
76
160
 
77
161
  ```bash
78
- $ npm run coverage
162
+ $ pnpm coverage
79
163
  ```
80
164
 
81
165
  5. Generate types and typedocs:
82
166
 
83
167
  ```bash
84
- $ npm run docs
168
+ $ pnpm run docs
85
169
  ```
86
170
 
87
171
  6. Type-only workflows:
88
172
 
89
173
  - Generate types without docs:
90
174
  ```bash
91
- $ npm run types
175
+ $ pnpm run types
92
176
  ```
93
177
  - Smoke-check emitted types without regenerating:
94
178
  ```bash
95
- $ npm run types:check -- --skip-gen
179
+ $ pnpm run types:check -- --skip-gen
96
180
  ```
181
+
182
+ ## License
183
+
184
+ [BSD-3-Clause](./LICENSE) © Arrai Innovations Inc.
@@ -1,31 +1,28 @@
1
- import { CancellablePromise } from "../utils/cancellablePromise.js";
1
+ import { makeCancellable } from "../utils/cancellablePromise.js";
2
2
  import cloneDeep from "lodash-es/cloneDeep.js";
3
3
  import { addOrUpdateReactiveObject } from "../utils/assignReactiveObject.js";
4
4
  import isFunction from "lodash-es/isFunction.js";
5
5
  import { refIfReactive } from "../utils/refIfReactive.js";
6
6
 
7
7
  /**
8
- * Primary key type accepted as input (will be coerced to string).
9
- *
10
- * @typedef {string | number} PkInput
8
+ * @typedef {string | number} PkInput - Primary key type accepted as input (will be coerced to string).
11
9
  */
12
10
 
13
11
  /**
14
- * Primary key type used for storage and output (always a string).
15
- *
16
- * @typedef {string} Pk
12
+ * @typedef {string} Pk - Primary key type used for storage and output (always a string).
17
13
  */
18
14
 
19
15
  /**
16
+ * @internal
20
17
  * @param {string} name - The name of the method.
21
18
  * @returns {(...args: any[]) => import('../utils/cancellablePromise.js').MaybeCancellablePromise<any>} - A function that returns a rejected promise with an error message.
22
19
  */
23
- export const missingMethod = (name) => () =>
24
- CancellablePromise.reject(new Error(`Crud method "${name}" is not implemented.`));
20
+ export const missingMethod = (name) => () => Promise.reject(new Error(`Crud method "${name}" is not implemented.`));
25
21
 
26
22
  // HACK: eslint, tsc, webstorm all can't agree on how to do this right
27
23
  // noinspection JSValidateTypes,JSUnusedLocalSymbols
28
24
  /**
25
+ * @internal
29
26
  * @param {string} name - The name of the method.
30
27
  * @returns {(
31
28
  * (..._args: any[]) => import('../utils/cancellablePromise.js').CancellablePromise<void>
@@ -36,7 +33,7 @@ export const requiredCancelMissingMethod =
36
33
  /* eslint-disable no-unused-vars */
37
34
  // @ts-ignore - refuses to accept returned CancellablePromise<void> = imported CancellablePromise<void>
38
35
  (..._args) =>
39
- CancellablePromise(Promise.reject(new Error(`Crud method "${name}" is not implemented.`)), () => {});
36
+ makeCancellable(Promise.reject(new Error(`Crud method "${name}" is not implemented.`)), () => {});
40
37
  /* eslint-enable no-unused-vars */
41
38
 
42
39
  /**
@@ -9,110 +9,110 @@ import { readonly } from "vue";
9
9
  */
10
10
 
11
11
  /**
12
- * @typedef {import("../use/listInstance.js").ClearListFn} ClearObjectsFn
12
+ * @typedef {import("../use/listInstance.js").ClearListFn} ClearObjectsFn - Signature for the handler that clears the objects held by the list.
13
13
  */
14
14
 
15
15
  /**
16
- * @typedef {import("../use/listInstance.js").SetPaginateInfoFn} SetPaginateInfo
16
+ * @typedef {import("../use/listInstance.js").SetPaginateInfoFn} SetPaginateInfo - Signature for the handler that updates the list's pagination information.
17
17
  */
18
18
 
19
19
  /**
20
- * @typedef {import("../use/listInstance.js").SetColumnTotalsFn} SetColumnTotals
20
+ * @typedef {import("../use/listInstance.js").SetColumnTotalsFn} SetColumnTotals - Signature for the handler that updates the list's column totals.
21
21
  */
22
22
 
23
23
  /**
24
- * Additional arguments that can be passed to list crud handlers.
25
- *
26
- * @typedef {{[key:string]: any}} AdditionalListArgs
24
+ * @typedef {{[key:string]: any}} AdditionalListArgs - Additional arguments that can be passed to list crud handlers.
27
25
  */
28
26
 
29
27
  /**
30
- * @typedef {object} ListArgsRaw
28
+ * @typedef {object} ListArgsRaw - Raw arguments for a list operation before run-tracking and additional list CRUD arguments are merged in.
31
29
  * @property {import('../config/objectCrud.js').TargetArgs} target - The arguments to be passed to the crud handlers.
32
30
  * @property {string} pkKey - The key name of the primary key.
33
- * @property {object} params - The arguments to be passed for list crud handlers.
31
+ * @property {object} params - Your listing or retrieval arguments, passed through to the crud handlers.
34
32
  * @property {import("../use/listInstance.js").PushObjectsFn} pushObjects - The method to call with new page(s) of data received.
35
33
  * @property {ClearObjectsFn} clearObjects - The method to call to clear the objects.
36
- * @property {Readonly<import('vue').Ref<boolean>>} isCancelled - A ref to a boolean indicating whether the request has
37
- * been cancelled.
34
+ * @property {Readonly<import('vue').Ref<boolean>>} isCancelled - A readonly ref that becomes true once the request is cancelled.
38
35
  * @property {SetPaginateInfo} setPaginateInfo - The method to update pagination information.
39
36
  * @property {SetColumnTotals} setColumnTotals - The method to update column totals.
40
37
  */
41
38
 
42
39
  /**
43
- * @typedef {ListArgsRaw & Partial<import('../use/cancellableIntent.js').CommonRunTracking> & AdditionalListArgs} ListArgs
40
+ * @typedef {ListArgsRaw & Partial<import('../use/cancellableIntent.js').CommonRunTracking> & AdditionalListArgs} ListArgs - Arguments for a list operation, combining the raw arguments with run-tracking and any additional list CRUD arguments.
44
41
  */
45
42
 
46
43
  /**
47
- * @typedef {object} BulkDeleteArgsRaw
44
+ * @typedef {object} BulkDeleteArgsRaw - Raw arguments for a bulk-delete operation before additional list CRUD arguments are merged in.
48
45
  * @property {import('../config/objectCrud.js').TargetArgs} target - The arguments to be passed to the crud handlers.
49
- * @property {import('./commonCrud.js').Pk[]} pks - The ids of the objects to be deleted.
46
+ * @property {import('./commonCrud.js').Pk[]} pks - The pks of the objects to be deleted.
50
47
  * @property {string} pkKey - The key name of the primary key.
51
48
  */
52
49
 
53
50
  /**
54
- * @typedef {BulkDeleteArgsRaw & AdditionalListArgs} BulkDeleteArgs
51
+ * @typedef {BulkDeleteArgsRaw & AdditionalListArgs} BulkDeleteArgs - Arguments for a bulk-delete operation, combining the raw arguments with any additional list CRUD arguments.
55
52
  */
56
53
 
57
54
  /**
58
55
  * @typedef {(
59
56
  * newOrUpdatedOrDeleteObject:import('../use/objectInstance.js').ExistingCrudObject|string,
60
57
  * action: 'create'|'update'|'delete'
61
- * )=>void} applyObjectEvent
58
+ * )=>void} applyObjectEvent - Callback that applies a created, updated, or deleted object event received from a subscription to the list.
62
59
  */
63
60
 
64
61
  /**
65
- * @typedef {object} ListSubscribeArgsRaw
62
+ * @typedef {object} ListSubscribeArgsRaw - Raw arguments for a list subscribe operation before run-tracking and additional list CRUD arguments are merged in.
66
63
  * @property {import('../config/objectCrud.js').TargetArgs} target - The arguments to be passed to the crud handlers.
67
64
  * @property {string} pkKey - The key name of the primary key.
68
- * @property {object} params - The arguments to be passed for list crud handlers.
65
+ * @property {object} params - Your listing or retrieval arguments, passed through to the crud handlers.
69
66
  * @property {applyObjectEvent} applyObjectEvent - The method to call when new data is received.
70
- * @property {Readonly<import('vue').Ref<boolean>>} isCancelled - A ref to a boolean indicating whether the request has
71
- * been cancelled.
67
+ * @property {Readonly<import('vue').Ref<boolean>>} isCancelled - A readonly ref that becomes true once the request is cancelled.
72
68
  */
73
69
 
74
70
  /**
75
- * @typedef {ListSubscribeArgsRaw & Partial<import('../use/cancellableIntent.js').CommonRunTracking> & AdditionalListArgs } ListSubscribeArgs
71
+ * @typedef {ListSubscribeArgsRaw & Partial<import('../use/cancellableIntent.js').CommonRunTracking> & AdditionalListArgs } ListSubscribeArgs - Arguments for a list subscribe operation, combining the raw arguments with run-tracking and any additional list CRUD arguments.
76
72
  */
77
73
 
78
74
  /**
79
- * @typedef {object} ExecuteActionArgsRaw
75
+ * @typedef {object} ExecuteActionArgsRaw - Raw arguments for a list execute-action operation before additional list CRUD arguments are merged in.
80
76
  * @property {import('../config/objectCrud.js').TargetArgs} target - The arguments to be passed to the crud handlers.
81
- * @property {import('./commonCrud.js').Pk[]} pks - The ids of the objects to be acted upon.
77
+ * @property {import('./commonCrud.js').Pk[]} pks - The pks of the objects to be acted upon.
82
78
  * @property {string} pkKey - The key name of the primary key.
83
79
  * @property {string} action - The action to execute.
84
80
  */
85
81
 
86
82
  /**
87
- * @typedef {ExecuteActionArgsRaw & AdditionalListArgs } ExecuteActionArgs
83
+ * @typedef {ExecuteActionArgsRaw & AdditionalListArgs } ExecuteActionArgs - Arguments for a list execute-action operation, combining the raw arguments with any additional list CRUD arguments.
88
84
  */
89
85
 
90
86
  /**
91
- * @callback CrudListFn
87
+ * @callback CrudListFn - Signature for the handler that lists objects from the backing store.
92
88
  * @param {ListArgs} args - The arguments to be passed to the crud handlers.
93
- * @returns {import('../utils/cancellablePromise.js').MaybeCancellablePromise<void>} - A cancellable promise for the list request.
89
+ * @returns {import('../utils/cancellablePromise.js').MaybeCancellablePromise<void>} - A promise whose resolution means
90
+ * the fetch is complete. Rows reach the list only through `pushObjects`, so the resolved value is ignored. Carry a
91
+ * `cancel` method to let the library abandon a superseded run.
94
92
  */
95
93
 
96
94
  /**
97
- * @callback CrudBulkDeleteFn
95
+ * @callback CrudBulkDeleteFn - Signature for the handler that bulk-deletes objects from the backing store.
98
96
  * @param {BulkDeleteArgs} args - The arguments to be passed to the crud handlers.
99
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating success.
97
+ * @returns {Promise<boolean>} - A promise whose resolution means the bulk delete succeeded; the resolved value is not
98
+ * inspected, and the instance then empties the list.
100
99
  */
101
100
 
102
101
  /**
103
- * @callback CrudListSubscribeFn
102
+ * @callback CrudListSubscribeFn - Signature for the handler that subscribes to list changes in the backing store.
104
103
  * @param {ListSubscribeArgs} args - The arguments to be passed to the crud handlers.
105
104
  * @returns {import('../utils/cancellablePromise.js').CancellablePromise<void>} - A cancellable promise for the subscription.
106
105
  */
107
106
 
108
107
  /**
109
- * @callback CrudExecuteActionFn
108
+ * @callback CrudExecuteActionFn - Signature for the handler that executes an action on a list of objects in the backing store.
110
109
  * @param {ExecuteActionArgs} args - The arguments to be passed to the crud handlers.
111
- * @returns {Promise<object|string|null>} - A promise that resolves the result of the action, returned to the executor.
110
+ * @returns {Promise<object|string|null>} - A promise resolving the action's result, which `listInstance.executeAction`
111
+ * passes through to its caller.
112
112
  */
113
113
 
114
114
  /**
115
- * @typedef {object} ListCrudHandlers
115
+ * @typedef {object} ListCrudHandlers - The set of optional CRUD handler functions (list, bulkDelete, executeAction, subscribe) for a list.
116
116
  * @property {CrudListFn} [list] - The list function to get a list of items.
117
117
  * @property {CrudBulkDeleteFn} [bulkDelete] - The delete function to bulk delete a list of items.
118
118
  * @property {CrudExecuteActionFn} [executeAction] - The function to execute a certain action on a list of items.
@@ -120,12 +120,12 @@ import { readonly } from "vue";
120
120
  */
121
121
 
122
122
  /**
123
- * @typedef {object} ListTarget
123
+ * @typedef {object} ListTarget - The default target arguments passed through to the list CRUD handlers.
124
124
  * @property {object} args - The default arguments for the crud handlers.
125
125
  */
126
126
 
127
127
  /**
128
- * @typedef {object} ListTargetOption
128
+ * @typedef {object} ListTargetOption - Optional target arguments passed through to the list CRUD handlers.
129
129
  * @property {object} [target={}] - The default arguments for the crud handlers.
130
130
  */
131
131