@arrai-innovations/reactive-helpers 21.1.2 → 22.0.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 (67) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +109 -21
  3. package/config/commonCrud.js +4 -6
  4. package/config/listCrud.js +20 -22
  5. package/config/objectCrud.js +30 -37
  6. package/package.json +93 -89
  7. package/types/config/listCrud.d.ts +83 -26
  8. package/types/config/objectCrud.d.ts +123 -44
  9. package/types/use/cancellableIntent.d.ts +27 -31
  10. package/types/use/combineClasses.d.ts +4 -1
  11. package/types/use/error.d.ts +39 -19
  12. package/types/use/list.d.ts +27 -26
  13. package/types/use/listCalculated.d.ts +21 -39
  14. package/types/use/listFilter.d.ts +25 -33
  15. package/types/use/listInstance.d.ts +88 -80
  16. package/types/use/listRelated.d.ts +26 -46
  17. package/types/use/listSearch.d.ts +54 -52
  18. package/types/use/listSort.d.ts +25 -39
  19. package/types/use/listSubscription.d.ts +28 -35
  20. package/types/use/loading.d.ts +20 -10
  21. package/types/use/loadingError.d.ts +12 -3
  22. package/types/use/object.d.ts +8 -5
  23. package/types/use/objectCalculated.d.ts +30 -27
  24. package/types/use/objectInstance.d.ts +67 -73
  25. package/types/use/objectRelated.d.ts +41 -33
  26. package/types/use/objectSubscription.d.ts +32 -43
  27. package/types/use/proxyError.d.ts +15 -6
  28. package/types/use/proxyLoading.d.ts +11 -5
  29. package/types/use/proxyLoadingError.d.ts +19 -7
  30. package/types/use/search.d.ts +33 -29
  31. package/types/utils/assignReactiveObject.d.ts +3 -0
  32. package/types/utils/cancellablePromise.d.ts +5 -5
  33. package/types/utils/classes.d.ts +7 -1
  34. package/types/utils/deepUnref.d.ts +1 -1
  35. package/types/utils/isReactiveTyped.d.ts +2 -0
  36. package/types/utils/keyDiff.d.ts +4 -6
  37. package/types/utils/relatedCalculatedHelpers.d.ts +2 -0
  38. package/types/utils/watches.d.ts +1 -1
  39. package/use/cancellableIntent.js +27 -7
  40. package/use/combineClasses.js +1 -1
  41. package/use/error.js +10 -14
  42. package/use/list.js +6 -18
  43. package/use/listCalculated.js +7 -22
  44. package/use/listFilter.js +8 -21
  45. package/use/listInstance.js +25 -44
  46. package/use/listRelated.js +9 -28
  47. package/use/listSearch.js +8 -17
  48. package/use/listSort.js +27 -41
  49. package/use/listSubscription.js +10 -25
  50. package/use/loading.js +5 -7
  51. package/use/loadingError.js +3 -3
  52. package/use/object.js +7 -19
  53. package/use/objectCalculated.js +9 -15
  54. package/use/objectInstance.js +46 -47
  55. package/use/objectRelated.js +13 -20
  56. package/use/objectSubscription.js +11 -25
  57. package/use/proxyError.js +10 -10
  58. package/use/proxyLoading.js +5 -5
  59. package/use/proxyLoadingError.js +10 -8
  60. package/use/search.js +5 -11
  61. package/utils/assignReactiveObject.js +3 -3
  62. package/utils/cancellablePromise.js +4 -4
  63. package/utils/classes.js +2 -2
  64. package/utils/deepUnref.js +1 -5
  65. package/utils/isReactiveTyped.js +2 -0
  66. package/utils/keyDiff.js +1 -3
  67. package/utils/relatedCalculatedHelpers.js +2 -0
@@ -1,15 +1,11 @@
1
1
  /**
2
- * The reactive arguments for the list instance.
3
- *
4
- * @typedef {object} ListInstanceProps
2
+ * @typedef {object} ListInstanceProps - The reactive arguments for the list instance.
5
3
  * @property {string} pkKey - The primary key field for the list objects.
6
4
  * @property {object} params - The arguments passed to the server.
7
5
  * @property {object} target - Implementation specific arguments.
8
6
  */
9
7
  /**
10
- * The configuration options used to create a list instance.
11
- *
12
- * @typedef {object} ListInstanceOptions
8
+ * @typedef {object} ListInstanceOptions - The configuration options used to create a list instance.
13
9
  * @property {import('vue').UnwrapNestedRefs<ListInstanceProps>} props - The props for the list instance.
14
10
  * @property {object} [handlers] - Default implementation are used as set by `setListCrud`.
15
11
  * @property {import('../config/listCrud.js').CrudListFn} [handlers.list] - Provide the implementation for the list
@@ -22,22 +18,16 @@
22
18
  * subscribe function.
23
19
  */
24
20
  /**
25
- * The objects by pk.
26
- *
27
- * @typedef {{[pk: import('../config/commonCrud.js').Pk]: import('../use/objectInstance.js').ExistingCrudObject}} ObjectsByPk
21
+ * @typedef {{[pk: import('../config/commonCrud.js').Pk]: import('../use/objectInstance.js').ExistingCrudObject}} ObjectsByPk - The objects by pk.
28
22
  */
29
23
  /**
30
- * The objects in order, based on .order & .objects.
31
- *
32
- * @typedef {import('vue').ComputedRef<import('../use/objectInstance.js').ExistingCrudObject[]>} ObjectsInOrder
24
+ * @typedef {import('vue').ComputedRef<import('../use/objectInstance.js').ExistingCrudObject[]>} ObjectsInOrder - The objects in order, based on .order & .objects.
33
25
  */
34
26
  /**
35
- * The order of the objects in the list.
36
- *
37
- * @typedef {import('vue').ComputedRef<import('../config/commonCrud.js').Pk[]>} ListOrder
27
+ * @typedef {import('vue').ComputedRef<import('../config/commonCrud.js').Pk[]>} ListOrder - The order of the objects in the list.
38
28
  */
39
29
  /**
40
- * @typedef {object} ListInstanceRawStateCrud
30
+ * @typedef {object} ListInstanceRawStateCrud - The raw CRUD handlers and target args stored in a list instance's reactive state.
41
31
  * @property {import('vue').Reactive<import('../config/objectCrud.js').TargetArgs|{}>} args - The arguments to be passed to the crud handlers.
42
32
  * @property {import('../config/listCrud.js').CrudListFn} list - The list function.
43
33
  * @property {import('../config/listCrud.js').CrudListSubscribeFn} subscribe - The subscribe function.
@@ -45,22 +35,20 @@
45
35
  * @property {import('../config/listCrud.js').CrudExecuteActionFn} executeAction - The execute action function.
46
36
  */
47
37
  /**
48
- * @typedef {Map<import('../config/commonCrud.js').Pk, import('vue').Reactive<import('../use/objectInstance.js').ExistingCrudObject>>} ObjectsMap
38
+ * @typedef {Map<import('../config/commonCrud.js').Pk, import('vue').Reactive<import('../use/objectInstance.js').ExistingCrudObject>>} ObjectsMap - A Map of primary keys to the list's reactive existing objects.
49
39
  */
50
40
  /**
51
- * @typedef {object} PaginateInfo
41
+ * @typedef {object} PaginateInfo - Pagination details for a list, including total records, total pages, per-page count, and current page.
52
42
  * @property {number} [totalRecords] - The total records.
53
43
  * @property {number} [totalPages] - The total pages.
54
44
  * @property {number} [perPage] - The per page.
55
45
  * @property {number} [page] - The page you are giving us results for.
56
46
  */
57
47
  /**
58
- * @typedef {{ [key: string]: number | string }} ColumnTotals
48
+ * @typedef {{ [key: string]: number | string }} ColumnTotals - A map of column names to their aggregate total values for a list.
59
49
  */
60
50
  /**
61
- * The raw state object for the list instance, defining the reactive properties and their types.
62
- *
63
- * @typedef {object} ListInstanceRawMyState
51
+ * @typedef {object} ListInstanceRawMyState - The raw state object for the list instance, defining the reactive properties and their types.
64
52
  * @property {import('vue').Reactive<ListInstanceRawStateCrud>} crud - CRUD handlers and their configurations for the list.
65
53
  * @property {string} pkKey - The primary key field for the list objects.
66
54
  * @property {object} params - Arguments passed to the server for listing operations.
@@ -72,37 +60,31 @@
72
60
  * @property {import('vue').ShallowReactive<ColumnTotals>} columnTotals - Column totals for the list.
73
61
  */
74
62
  /**
75
- * @typedef {ListInstanceRawMyState & Pick<import('./loadingError.js').LoadingErrorStatus, "loading" | "error" | "errored">} ListInstanceRawState
63
+ * @typedef {ListInstanceRawMyState & Pick<import('./loadingError.js').LoadingErrorStatus, "loading" | "error" | "errored">} ListInstanceRawState - The raw, pre-unwrapped state of a list instance, combining its own state with loading and error status.
76
64
  */
77
65
  /**
78
- * Defines the reactive state used by the list instance.
79
- *
80
- * @typedef {import('vue').UnwrapNestedRefs<ListInstanceRawState>} ListInstanceState
66
+ * @typedef {import('vue').UnwrapNestedRefs<ListInstanceRawState>} ListInstanceState - Defines the reactive state used by the list instance.
81
67
  */
82
68
  /**
83
- * @typedef {(newObjects: import('../use/objectInstance.js').ExistingCrudObject[]) => void} PushObjectsFn
69
+ * @typedef {(newObjects: import('../use/objectInstance.js').ExistingCrudObject[]) => void} PushObjectsFn - Signature for the function that pushes a page of newly received objects into the list.
84
70
  */
85
71
  /**
86
- * Options to control which reactive state is reset when clearing the list.
87
- *
88
- * @typedef {object} ClearListOptions
72
+ * @typedef {object} ClearListOptions - Options to control which reactive state is reset when clearing the list.
89
73
  * @property {boolean} [keepPagination] - When true, keep the current pagination information.
90
74
  * @property {boolean} [keepColumnTotals] - When true, keep the current column totals.
91
75
  * @property {boolean} [keepError] - When true, keep the current error state.
92
76
  */
93
77
  /**
94
- * @typedef {(options?: ClearListOptions) => void} ClearListFn
78
+ * @typedef {(options?: ClearListOptions) => void} ClearListFn - Signature for the handler that clears the objects held by the list.
95
79
  */
96
80
  /**
97
- * @typedef {(info: PaginateInfo) => void} SetPaginateInfoFn
81
+ * @typedef {(info: PaginateInfo) => void} SetPaginateInfoFn - Signature for the handler that updates the list's pagination information.
98
82
  */
99
83
  /**
100
- * @typedef {(total: ColumnTotals) => void} SetColumnTotalsFn
84
+ * @typedef {(total: ColumnTotals) => void} SetColumnTotalsFn - Signature for the handler that updates the list's column totals.
101
85
  */
102
86
  /**
103
- * Defines the methods provided by the list instance for managing objects in the list.
104
- *
105
- * @typedef {object} ListInstanceMyFunctions
87
+ * @typedef {object} ListInstanceMyFunctions - Defines the methods provided by the list instance for managing objects in the list.
106
88
  * @property {PushObjectsFn} pushObjects - Customizable callback for handling new objects per page.
107
89
  * @property {(object: import('../use/objectInstance.js').ExistingCrudObject) => void} addListObject - Adds an object to the list.
108
90
  * @property {(object: import('../use/objectInstance.js').ExistingCrudObject) => void} updateListObject - Updates an object in the list.
@@ -117,17 +99,13 @@
117
99
  * @property {(total: ColumnTotals) => void} setColumnTotals - The method to update column totals.
118
100
  */
119
101
  /**
120
- * @typedef {ListInstanceMyFunctions & Pick<import('./loadingError.js').LoadingErrorStatus, "clearError">} ListInstanceFunctions
102
+ * @typedef {ListInstanceMyFunctions & Pick<import('./loadingError.js').LoadingErrorStatus, "clearError">} ListInstanceFunctions - The methods contributed by the list instance, including its CRUD operations plus clearError.
121
103
  */
122
104
  /**
123
- * Helper type to facilitate the combination of state and functions into a single type.
124
- *
125
- * @typedef {{state: ListInstanceState}} ListInstanceStateMixIn
105
+ * @typedef {{state: ListInstanceState}} ListInstanceStateMixIn - Helper type to facilitate the combination of state and functions into a single type.
126
106
  */
127
107
  /**
128
- * The list instance, combining state management and functional operations for managing a list of objects.
129
- *
130
- * @typedef {ListInstanceStateMixIn & ListInstanceFunctions} ListInstance
108
+ * @typedef {ListInstanceStateMixIn & ListInstanceFunctions} ListInstance - The list instance, combining state management and functional operations for managing a list of objects.
131
109
  */
132
110
  /**
133
111
  * Creates and manages multiple list instances.
@@ -217,15 +195,15 @@ export class ListInstanceError extends Error {
217
195
  */
218
196
  export type ListInstanceProps = {
219
197
  /**
220
- * - The primary key field for the list objects.
198
+ * The primary key field for the list objects.
221
199
  */
222
200
  pkKey: string;
223
201
  /**
224
- * - The arguments passed to the server.
202
+ * The arguments passed to the server.
225
203
  */
226
204
  params: object;
227
205
  /**
228
- * - Implementation specific arguments.
206
+ * Implementation specific arguments.
229
207
  */
230
208
  target: object;
231
209
  };
@@ -234,11 +212,11 @@ export type ListInstanceProps = {
234
212
  */
235
213
  export type ListInstanceOptions = {
236
214
  /**
237
- * - The props for the list instance.
215
+ * The props for the list instance.
238
216
  */
239
217
  props: import("vue").UnwrapNestedRefs<ListInstanceProps>;
240
218
  /**
241
- * - Default implementation are used as set by `setListCrud`.
219
+ * Default implementation are used as set by `setListCrud`.
242
220
  */
243
221
  handlers?: {
244
222
  list?: import("../config/listCrud.js").CrudListFn;
@@ -261,47 +239,59 @@ export type ObjectsInOrder = import("vue").ComputedRef<import("../use/objectInst
261
239
  * The order of the objects in the list.
262
240
  */
263
241
  export type ListOrder = import("vue").ComputedRef<import("../config/commonCrud.js").Pk[]>;
242
+ /**
243
+ * The raw CRUD handlers and target args stored in a list instance's reactive state.
244
+ */
264
245
  export type ListInstanceRawStateCrud = {
265
246
  /**
266
- * - The arguments to be passed to the crud handlers.
247
+ * The arguments to be passed to the crud handlers.
267
248
  */
268
249
  args: import("vue").Reactive<import("../config/objectCrud.js").TargetArgs | {}>;
269
250
  /**
270
- * - The list function.
251
+ * The list function.
271
252
  */
272
253
  list: import("../config/listCrud.js").CrudListFn;
273
254
  /**
274
- * - The subscribe function.
255
+ * The subscribe function.
275
256
  */
276
257
  subscribe: import("../config/listCrud.js").CrudListSubscribeFn;
277
258
  /**
278
- * - The bulk delete function.
259
+ * The bulk delete function.
279
260
  */
280
261
  bulkDelete: import("../config/listCrud.js").CrudBulkDeleteFn;
281
262
  /**
282
- * - The execute action function.
263
+ * The execute action function.
283
264
  */
284
265
  executeAction: import("../config/listCrud.js").CrudExecuteActionFn;
285
266
  };
267
+ /**
268
+ * A Map of primary keys to the list's reactive existing objects.
269
+ */
286
270
  export type ObjectsMap = Map<import("../config/commonCrud.js").Pk, import("vue").Reactive<import("../use/objectInstance.js").ExistingCrudObject>>;
271
+ /**
272
+ * Pagination details for a list, including total records, total pages, per-page count, and current page.
273
+ */
287
274
  export type PaginateInfo = {
288
275
  /**
289
- * - The total records.
276
+ * The total records.
290
277
  */
291
278
  totalRecords?: number;
292
279
  /**
293
- * - The total pages.
280
+ * The total pages.
294
281
  */
295
282
  totalPages?: number;
296
283
  /**
297
- * - The per page.
284
+ * The per page.
298
285
  */
299
286
  perPage?: number;
300
287
  /**
301
- * - The page you are giving us results for.
288
+ * The page you are giving us results for.
302
289
  */
303
290
  page?: number;
304
291
  };
292
+ /**
293
+ * A map of column names to their aggregate total values for a list.
294
+ */
305
295
  export type ColumnTotals = {
306
296
  [key: string]: number | string;
307
297
  };
@@ -310,123 +300,141 @@ export type ColumnTotals = {
310
300
  */
311
301
  export type ListInstanceRawMyState = {
312
302
  /**
313
- * - CRUD handlers and their configurations for the list.
303
+ * CRUD handlers and their configurations for the list.
314
304
  */
315
305
  crud: import("vue").Reactive<ListInstanceRawStateCrud>;
316
306
  /**
317
- * - The primary key field for the list objects.
307
+ * The primary key field for the list objects.
318
308
  */
319
309
  pkKey: string;
320
310
  /**
321
- * - Arguments passed to the server for listing operations.
311
+ * Arguments passed to the server for listing operations.
322
312
  */
323
313
  params: object;
324
314
  /**
325
- * - The map of objects stored by their pks.
315
+ * The map of objects stored by their pks.
326
316
  */
327
317
  objectsMap: ObjectsMap;
328
318
  /**
329
- * - The list objects stored by their pks.
319
+ * The list objects stored by their pks.
330
320
  */
331
321
  objects: ObjectsByPk;
332
322
  /**
333
- * - The order of objects in the list.
323
+ * The order of objects in the list.
334
324
  */
335
325
  order: ListOrder;
336
326
  /**
337
- * - The objects in the order specified by the list.
327
+ * The objects in the order specified by the list.
338
328
  */
339
329
  objectsInOrder: ObjectsInOrder;
340
330
  /**
341
- * - Pagination information for the list.
331
+ * Pagination information for the list.
342
332
  */
343
333
  paginateInfo: import("vue").ShallowReactive<PaginateInfo>;
344
334
  /**
345
- * - Column totals for the list.
335
+ * Column totals for the list.
346
336
  */
347
337
  columnTotals: import("vue").ShallowReactive<ColumnTotals>;
348
338
  };
339
+ /**
340
+ * The raw, pre-unwrapped state of a list instance, combining its own state with loading and error status.
341
+ */
349
342
  export type ListInstanceRawState = ListInstanceRawMyState & Pick<import("./loadingError.js").LoadingErrorStatus, "loading" | "error" | "errored">;
350
343
  /**
351
344
  * Defines the reactive state used by the list instance.
352
345
  */
353
346
  export type ListInstanceState = import("vue").UnwrapNestedRefs<ListInstanceRawState>;
347
+ /**
348
+ * Signature for the function that pushes a page of newly received objects into the list.
349
+ */
354
350
  export type PushObjectsFn = (newObjects: import("../use/objectInstance.js").ExistingCrudObject[]) => void;
355
351
  /**
356
352
  * Options to control which reactive state is reset when clearing the list.
357
353
  */
358
354
  export type ClearListOptions = {
359
355
  /**
360
- * - When true, keep the current pagination information.
356
+ * When true, keep the current pagination information.
361
357
  */
362
358
  keepPagination?: boolean;
363
359
  /**
364
- * - When true, keep the current column totals.
360
+ * When true, keep the current column totals.
365
361
  */
366
362
  keepColumnTotals?: boolean;
367
363
  /**
368
- * - When true, keep the current error state.
364
+ * When true, keep the current error state.
369
365
  */
370
366
  keepError?: boolean;
371
367
  };
368
+ /**
369
+ * Signature for the handler that clears the objects held by the list.
370
+ */
372
371
  export type ClearListFn = (options?: ClearListOptions) => void;
372
+ /**
373
+ * Signature for the handler that updates the list's pagination information.
374
+ */
373
375
  export type SetPaginateInfoFn = (info: PaginateInfo) => void;
376
+ /**
377
+ * Signature for the handler that updates the list's column totals.
378
+ */
374
379
  export type SetColumnTotalsFn = (total: ColumnTotals) => void;
375
380
  /**
376
381
  * Defines the methods provided by the list instance for managing objects in the list.
377
382
  */
378
383
  export type ListInstanceMyFunctions = {
379
384
  /**
380
- * - Customizable callback for handling new objects per page.
385
+ * Customizable callback for handling new objects per page.
381
386
  */
382
387
  pushObjects: PushObjectsFn;
383
388
  /**
384
- * - Adds an object to the list.
389
+ * Adds an object to the list.
385
390
  */
386
391
  addListObject: (object: import("../use/objectInstance.js").ExistingCrudObject) => void;
387
392
  /**
388
- * - Updates an object in the list.
393
+ * Updates an object in the list.
389
394
  */
390
395
  updateListObject: (object: import("../use/objectInstance.js").ExistingCrudObject) => void;
391
396
  /**
392
- * - Deletes an object from the list by pk.
397
+ * Deletes an object from the list by pk.
393
398
  */
394
399
  deleteListObject: (objectId: import("../config/commonCrud.js").PkInput) => void;
395
400
  /**
396
- * - Clears the list objects and optionally keeps pagination, totals,
401
+ * Clears the list objects and optionally keeps pagination, totals,
397
402
  * or error state.
398
403
  */
399
404
  clearList: (options?: ClearListOptions) => void;
400
405
  /**
401
- * - Generates a unique fake pk for use within the list.
406
+ * Generates a unique fake pk for use within the list.
402
407
  */
403
408
  getFakePk: () => import("../config/commonCrud.js").Pk;
404
409
  /**
405
- * - Initiates a fetch to retrieve objects according to the CRUD configuration, returning a promise to a boolean indicating success.
410
+ * Initiates a fetch to retrieve objects according to the CRUD configuration, returning a promise to a boolean indicating success.
406
411
  */
407
412
  list: (args?: import("../config/listCrud.js").AdditionalListArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
408
413
  /**
409
- * - Deletes objects from the list by pk, returning a promise to a boolean indicating success.
414
+ * Deletes objects from the list by pk, returning a promise to a boolean indicating success.
410
415
  */
411
416
  bulkDelete: (args?: {
412
417
  pks?: import("../config/commonCrud.js").Pk[];
413
418
  } & import("../config/listCrud.js").AdditionalListArgs) => Promise<boolean>;
414
419
  /**
415
- * - Initiates an action on all objects in the list, returning the response, or null if the action failed.
420
+ * Initiates an action on all objects in the list, returning the response, or null if the action failed.
416
421
  */
417
422
  executeAction: (args: {
418
423
  action: string;
419
424
  pks?: import("../config/commonCrud.js").Pk[];
420
425
  } & import("../config/listCrud.js").AdditionalListArgs) => Promise<object | string | boolean | null>;
421
426
  /**
422
- * - The method to update pagination information.
427
+ * The method to update pagination information.
423
428
  */
424
429
  setPaginateInfo: (info: PaginateInfo) => void;
425
430
  /**
426
- * - The method to update column totals.
431
+ * The method to update column totals.
427
432
  */
428
433
  setColumnTotals: (total: ColumnTotals) => void;
429
434
  };
435
+ /**
436
+ * The methods contributed by the list instance, including its CRUD operations plus clearError.
437
+ */
430
438
  export type ListInstanceFunctions = ListInstanceMyFunctions & Pick<import("./loadingError.js").LoadingErrorStatus, "clearError">;
431
439
  /**
432
440
  * Helper type to facilitate the combination of state and functions into a single type.
@@ -5,26 +5,19 @@
5
5
  * @module use/listRelated.js
6
6
  */
7
7
  /**
8
- * The rule for defining relationships for objects in a list.
9
- *
10
- * @typedef {object} ListRelatedRule
8
+ * @typedef {object} ListRelatedRule - The rule for defining relationships for objects in a list.
11
9
  * @property {string} pkKey - Specifies the foreign key used to link objects across lists. Planned to be renamed to
12
10
  * 'fkKey' to better reflect its usage.
13
11
  * @property {string[]} [order] - Specifies the order in which related objects should be sorted, if applicable.
14
12
  * @property {import('./listInstance.js').ObjectsByPk} objects - The objects that can be related based on the foreign key.
15
13
  */
16
14
  /**
17
- * The rules for defining relationships among objects in a list.
18
- *
19
15
  * @typedef {{
20
16
  * [rule: string]: ListRelatedRule,
21
- * }} ListRelatedRules
17
+ * }} ListRelatedRules - The rules for defining relationships among objects in a list.
22
18
  */
23
19
  /**
24
- * Represents the internal state used by the list related composition function. It manages and computes the relationships
25
- * between objects based on specified rules, providing real-time updates to related objects as the parent state changes.
26
- *
27
- * @typedef {object} ListRelatedRawState
20
+ * @typedef {object} ListRelatedRawState - Represents the internal state used by the list related composition function. It manages and computes the relationships between objects based on specified rules, providing real-time updates to related objects as the parent state changes.
28
21
  * @property {{
29
22
  * [pk: import('../config/commonCrud.js').Pk]: {
30
23
  * [rule: string]: import('vue').ComputedRef<any>,
@@ -47,45 +40,33 @@
47
40
  * @property {import('vue').Ref<boolean>} running - General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.
48
41
  */
49
42
  /**
50
- * The raw state properties for a parent of a list related property.
51
- *
52
43
  * @typedef {(
53
44
  * import('./listInstance.js').ListInstanceRawState &
54
45
  * Partial<import('./listSubscription.js').ListSubscriptionRawState>
55
- * )} ListRelatedParentRawState
46
+ * )} ListRelatedParentRawState - The raw state properties for a parent of a list related property.
56
47
  */
57
48
  /**
58
- * The type for a parentState object.
59
- *
60
- * @typedef {import('vue').UnwrapNestedRefs<ListRelatedParentRawState>} ListRelatedParentState
49
+ * @typedef {import('vue').UnwrapNestedRefs<ListRelatedParentRawState>} ListRelatedParentState - The type for a parentState object.
61
50
  */
62
51
  /**
63
- * The state for a list related property.
64
- *
65
52
  * @typedef {import('vue').UnwrapNestedRefs<
66
53
  * ListRelatedParentRawState &
67
54
  * ListRelatedRawState
68
- * >} ListRelatedState
55
+ * >} ListRelatedState - The state for a list related property.
69
56
  */
70
57
  /**
71
- * The options for the list related composition function.
72
- *
73
- * @typedef {object} ListRelatedOptions
58
+ * @typedef {object} ListRelatedOptions - The options for the list related composition function.
74
59
  * @property {ListRelatedParentState} parentState - The parent state object.
75
60
  * @property {import('vue').Ref<ListRelatedRules>} relatedObjectsRules - The rules for the related objects.
76
61
  */
77
62
  /**
78
- * The properties for the list related composition function.
79
- *
80
- * @typedef {object} ListRelatedProperties
63
+ * @typedef {object} ListRelatedProperties - The properties for the list related composition function.
81
64
  * @property {ListRelatedState} state - The state for the list related property.
82
65
  * @property {ListRelatedParentState} parentState - The parent state object.
83
66
  * @property {() => void} stop - Stops all effects of the list related property.
84
67
  */
85
68
  /**
86
- * An instance of `useListRelated`.
87
- *
88
- * @typedef {ListRelatedProperties} ListRelated
69
+ * @typedef {ListRelatedProperties} ListRelated - An instance of `useListRelated`.
89
70
  */
90
71
  /**
91
72
  * Creates and manages multiple instances of list-related properties, linking each to corresponding parent instances
@@ -182,16 +163,16 @@ export function useListRelated({ parentState, relatedObjectsRules }: ListRelated
182
163
  */
183
164
  export type ListRelatedRule = {
184
165
  /**
185
- * - Specifies the foreign key used to link objects across lists. Planned to be renamed to
166
+ * Specifies the foreign key used to link objects across lists. Planned to be renamed to
186
167
  * 'fkKey' to better reflect its usage.
187
168
  */
188
169
  pkKey: string;
189
170
  /**
190
- * - Specifies the order in which related objects should be sorted, if applicable.
171
+ * Specifies the order in which related objects should be sorted, if applicable.
191
172
  */
192
173
  order?: string[];
193
174
  /**
194
- * - The objects that can be related based on the foreign key.
175
+ * The objects that can be related based on the foreign key.
195
176
  */
196
177
  objects: import("./listInstance.js").ObjectsByPk;
197
178
  };
@@ -202,12 +183,11 @@ export type ListRelatedRules = {
202
183
  [rule: string]: ListRelatedRule;
203
184
  };
204
185
  /**
205
- * Represents the internal state used by the list related composition function. It manages and computes the relationships
206
- * between objects based on specified rules, providing real-time updates to related objects as the parent state changes.
186
+ * Represents the internal state used by the list related composition function. It manages and computes the relationships between objects based on specified rules, providing real-time updates to related objects as the parent state changes.
207
187
  */
208
188
  export type ListRelatedRawState = {
209
189
  /**
210
- * - Stores computed references to related objects, allowing for dynamic access based on object pk and specific rules.
190
+ * Stores computed references to related objects, allowing for dynamic access based on object pk and specific rules.
211
191
  */
212
192
  relatedObjects: {
213
193
  [pk: import("../config/commonCrud.js").Pk]: {
@@ -215,11 +195,11 @@ export type ListRelatedRawState = {
215
195
  };
216
196
  };
217
197
  /**
218
- * - Defines the rules for establishing relationships, such as foreign key links and sorting orders.
198
+ * Defines the rules for establishing relationships, such as foreign key links and sorting orders.
219
199
  */
220
200
  relatedObjectsRules: ListRelatedRules;
221
201
  /**
222
- * - Maps each object pk and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
202
+ * Maps each object pk and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
223
203
  */
224
204
  objAndKeyForPkAndRule: {
225
205
  [pk: import("../config/commonCrud.js").Pk]: {
@@ -227,7 +207,7 @@ export type ListRelatedRawState = {
227
207
  };
228
208
  };
229
209
  /**
230
- * - Maintains computed references to the foreign keys for each object pk and rule, crucial for navigating complex data relationships.
210
+ * Maintains computed references to the foreign keys for each object pk and rule, crucial for navigating complex data relationships.
231
211
  */
232
212
  fkForPkAndRule: {
233
213
  [pk: import("../config/commonCrud.js").Pk]: {
@@ -235,19 +215,19 @@ export type ListRelatedRawState = {
235
215
  };
236
216
  };
237
217
  /**
238
- * - Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
218
+ * Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
239
219
  */
240
220
  relatedObjectsParentStateObjectsWatchRunning: boolean;
241
221
  /**
242
- * - Indicates if watches on the related objects themselves are active, managing updates efficiently.
222
+ * Indicates if watches on the related objects themselves are active, managing updates efficiently.
243
223
  */
244
224
  relatedObjectsWatchRunning: boolean;
245
225
  /**
246
- * - Signals whether any computations related to object relationships are currently in progress.
226
+ * Signals whether any computations related to object relationships are currently in progress.
247
227
  */
248
228
  relatedRunning: boolean;
249
229
  /**
250
- * - General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.
230
+ * General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.
251
231
  */
252
232
  running: import("vue").Ref<boolean>;
253
233
  };
@@ -268,11 +248,11 @@ export type ListRelatedState = import("vue").UnwrapNestedRefs<ListRelatedParentR
268
248
  */
269
249
  export type ListRelatedOptions = {
270
250
  /**
271
- * - The parent state object.
251
+ * The parent state object.
272
252
  */
273
253
  parentState: ListRelatedParentState;
274
254
  /**
275
- * - The rules for the related objects.
255
+ * The rules for the related objects.
276
256
  */
277
257
  relatedObjectsRules: import("vue").Ref<ListRelatedRules>;
278
258
  };
@@ -281,15 +261,15 @@ export type ListRelatedOptions = {
281
261
  */
282
262
  export type ListRelatedProperties = {
283
263
  /**
284
- * - The state for the list related property.
264
+ * The state for the list related property.
285
265
  */
286
266
  state: ListRelatedState;
287
267
  /**
288
- * - The parent state object.
268
+ * The parent state object.
289
269
  */
290
270
  parentState: ListRelatedParentState;
291
271
  /**
292
- * - Stops all effects of the list related property.
272
+ * Stops all effects of the list related property.
293
273
  */
294
274
  stop: () => void;
295
275
  };