@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
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @typedef {import('./loading.js').LoadingProperties & import('./error.js').ErrorProperties} LoadingErrorProperties
3
- * @typedef {import('./loading.js').LoadingFunctions & import('./error.js').ErrorFunctions} LoadingErrorFunctions
4
- * @typedef {LoadingErrorProperties & LoadingErrorFunctions} LoadingErrorStatus
2
+ * @typedef {import('./loading.js').LoadingProperties & import('./error.js').ErrorProperties} LoadingErrorProperties - The combined reactive loading and error state members contributed by the useLoadingError composable.
3
+ * @typedef {import('./loading.js').LoadingFunctions & import('./error.js').ErrorFunctions} LoadingErrorFunctions - The combined loading and error state actions contributed by the useLoadingError composable.
4
+ * @typedef {LoadingErrorProperties & LoadingErrorFunctions} LoadingErrorStatus - The combined loading and error state API (properties plus actions) returned by useLoadingError.
5
5
  */
6
6
  /**
7
7
  * A composable function combining loading and error state management.
@@ -9,6 +9,15 @@
9
9
  * @returns {LoadingErrorStatus} - An object containing reactive fields and actions for both loading and error state.
10
10
  */
11
11
  export function useLoadingError(): LoadingErrorStatus;
12
+ /**
13
+ * The combined reactive loading and error state members contributed by the useLoadingError composable.
14
+ */
12
15
  export type LoadingErrorProperties = import("./loading.js").LoadingProperties & import("./error.js").ErrorProperties;
16
+ /**
17
+ * The combined loading and error state actions contributed by the useLoadingError composable.
18
+ */
13
19
  export type LoadingErrorFunctions = import("./loading.js").LoadingFunctions & import("./error.js").ErrorFunctions;
20
+ /**
21
+ * The combined loading and error state API (properties plus actions) returned by useLoadingError.
22
+ */
14
23
  export type LoadingErrorStatus = LoadingErrorProperties & LoadingErrorFunctions;
@@ -17,11 +17,11 @@ export type ObjectManagerProps = import("vue").UnwrapNestedRefs<ObjectManagerRaw
17
17
  */
18
18
  export type ObjectManagerOptions = {
19
19
  /**
20
- * - The reactive properties to be passed to the object instance.
20
+ * The reactive properties to be passed to the object instance.
21
21
  */
22
22
  props: ObjectManagerProps;
23
23
  /**
24
- * - The non-reactive handlers to be passed to the object instance.
24
+ * The non-reactive handlers to be passed to the object instance.
25
25
  */
26
26
  handlers: import("../config/objectCrud.js").ObjectCrudHandlers;
27
27
  };
@@ -43,16 +43,19 @@ export type ObjectManagerFunctions = (import("./objectInstance.js").ObjectInstan
43
43
  */
44
44
  export type ObjectManagerProperties = {
45
45
  /**
46
- * - The managed object.
46
+ * The managed object.
47
47
  */
48
48
  managed: ObjectManaged;
49
49
  /**
50
- * - The state of the managed object.
50
+ * The state of the managed object.
51
51
  */
52
52
  state: import("./objectCalculated.js").ObjectCalculatedState;
53
53
  /**
54
- * - Stop the effect scope of the managed object.
54
+ * Stop the effect scope of the managed object.
55
55
  */
56
56
  stop: () => void;
57
57
  };
58
+ /**
59
+ * The fully managed object returned by useObject, combining its properties and functions.
60
+ */
58
61
  export type ObjectManager = ObjectManagerProperties & ObjectManagerFunctions;
@@ -20,7 +20,7 @@ export function useObjectCalculateds(objectCalculatedArgs: {
20
20
  * ```vue
21
21
  * <script setup>
22
22
  * import { useObjectCalculated, useObjectSubscription } from "@arrai-innovations/reactive-helpers";
23
- * import { ref, reactive } from "vue";
23
+ * import { reactive } from "vue";
24
24
  *
25
25
  * const objectSubscriptionProps = reactive({
26
26
  * // whatever object subscription props you need to work with your crud implementation
@@ -29,21 +29,21 @@ export function useObjectCalculateds(objectCalculatedArgs: {
29
29
  * pk: '1',
30
30
  * pkKey: 'id',
31
31
  * intendToRetrieve: true,
32
- * };
33
- * const objectSubscription = useObjectSubscription(objectSubscriptionProps);
32
+ * });
33
+ * const objectSubscription = useObjectSubscription({ props: objectSubscriptionProps });
34
34
  * const objectCalculatedProps = reactive({
35
35
  * parentState: objectSubscription.state,
36
36
  * calculatedObjectRules: {
37
- * someRule: (object, relatedObject, calculatedObjects) => {
38
- * // some complex calculation, relatedObjects would be assuming there was a listRelated between the two
39
- * // calculatedObjects would be the other calculated objects in the list
40
- * // including yourself, so try not to create circular dependencies
37
+ * someRule: (object, relatedObject) => {
38
+ * // some complex calculation. relatedObject holds the managed object's related objects, and is
39
+ * // only populated when a useObjectRelated sits between the object and this composable.
41
40
  * // this is used as a computed body.
42
41
  * return object.someProperty + object.someOtherProperty;
43
42
  * },
44
- * ...
43
+ * // ...further rules
45
44
  * },
46
45
  * });
46
+ * const objectCalculated = useObjectCalculated(objectCalculatedProps);
47
47
  * </script>
48
48
  * <template>
49
49
  * <div>
@@ -63,18 +63,18 @@ export function useObjectCalculated({ parentState, calculatedObjectRules }: Obje
63
63
  * @module use/objectCalculated.js
64
64
  */
65
65
  /**
66
- * The object calculated state keys.
67
- *
68
66
  * @typedef {{
69
67
  * [ruleKey: string]: (object: any, relatedObject: any) => any
70
- * }} ObjectCalculatedRules
68
+ * }} ObjectCalculatedRules - Rules for calculating values from the managed object, keyed by rule name. Each rule is used
69
+ * as a computed body and receives exactly two arguments: the managed object and its related objects (the latter only
70
+ * populated when a useObjectRelated sits upstream).
71
71
  */
72
72
  /**
73
73
  * @typedef {object} ObjectCalculatedRawState - The raw state for object calculated.
74
74
  * @property {ObjectCalculatedRules} calculatedObjectRules - The calculated object rules.
75
75
  * @property {{
76
- * [ruleKey: string]: import('vue').ComputedRef<any>
77
- * }} calculatedObject - The calculated object.
76
+ * [ruleKey: string]: any
77
+ * }} calculatedObject - The calculated values, by rule name. Each entry is backed by a computed, but it is read through a reactive proxy that unwraps it, so reads yield the calculated value and never carry a `.value`.
78
78
  * @property {boolean} calculatedObjectWatchRunning - Whether the calculated object watch is running.
79
79
  * @property {boolean} parentStateObjectWatchRunning - Whether the parent state object watch is running.
80
80
  * @property {boolean} calculatedRunning - Whether the calculated is running.
@@ -87,7 +87,7 @@ export function useObjectCalculated({ parentState, calculatedObjectRules }: Obje
87
87
  * import('./objectInstance.js').ObjectInstanceRawState &
88
88
  * Partial<import('./objectSubscription.js').ObjectSubscriptionRawState> &
89
89
  * Partial<import('./objectRelated.js').ObjectRelatedRawState>
90
- * )} ObjectCalculatedParentRawState
90
+ * )} ObjectCalculatedParentRawState - The raw, pre-unwrapped parent state consumed by the object calculated mixin, aggregating the upstream object composable states.
91
91
  */
92
92
  /**
93
93
  *
@@ -97,80 +97,81 @@ export function useObjectCalculated({ parentState, calculatedObjectRules }: Obje
97
97
  * )>} ObjectCalculatedParentState - The object calculated options.
98
98
  */
99
99
  /**
100
- * The state for object calculated.
101
- *
102
100
  * @typedef {import('vue').UnwrapNestedRefs<
103
101
  * ObjectCalculatedParentRawState &
104
102
  * ObjectCalculatedRawState
105
- * >} ObjectCalculatedState
103
+ * >} ObjectCalculatedState - The state for object calculated.
106
104
  */
107
105
  /**
108
- * The properties for object calculated.
109
- *
110
- * @typedef {object} ObjectCalculatedProperties
106
+ * @typedef {object} ObjectCalculatedProperties - The properties for object calculated.
111
107
  * @property {ObjectCalculatedParentState} parentState - The parent state.
112
108
  * @property {ObjectCalculatedState} state - The object calculated state.
113
109
  * @property {() => void} stop - Stops composition's effects and cleans up resources.
114
110
  */
115
111
  /**
116
- * The object calculated instance.
117
- *
118
- * @typedef {ObjectCalculatedProperties} ObjectCalculated
112
+ * @typedef {ObjectCalculatedProperties} ObjectCalculated - The object calculated instance.
119
113
  */
120
114
  /**
121
115
  *
122
116
  *
123
- * @typedef {object} ObjectCalculatedRawProps
117
+ * @typedef {object} ObjectCalculatedRawProps - The consumer-supplied props for the object calculated composable, namely the calculated-object rules ref.
124
118
  * @property {import('vue').Ref<ObjectCalculatedRules>} calculatedObjectRules - The calculated object rules.
125
119
  */
126
120
  /**
127
121
  *
128
122
  * @typedef {({
129
123
  * parentState: ObjectCalculatedParentState,
130
- * } & ObjectCalculatedRawProps)} ObjectCalculatedOptions
124
+ * } & ObjectCalculatedRawProps)} ObjectCalculatedOptions - The options used to create an object calculated instance (the parent state plus the calculated-object rules).
131
125
  */
126
+ /** @internal */
132
127
  export const objectCalculatedStateKeys: string[];
128
+ /** @internal */
133
129
  export const objectCalculatedFunctions: any[];
134
130
  /**
135
- * The object calculated state keys.
131
+ * Rules for calculating values from the managed object, keyed by rule name. Each rule is used
132
+ * as a computed body and receives exactly two arguments: the managed object and its related objects (the latter only
133
+ * populated when a useObjectRelated sits upstream).
136
134
  */
137
135
  export type ObjectCalculatedRules = {
138
136
  [ruleKey: string]: (object: any, relatedObject: any) => any;
139
137
  };
140
138
  /**
141
- * - The raw state for object calculated.
139
+ * The raw state for object calculated.
142
140
  */
143
141
  export type ObjectCalculatedRawState = {
144
142
  /**
145
- * - The calculated object rules.
143
+ * The calculated object rules.
146
144
  */
147
145
  calculatedObjectRules: ObjectCalculatedRules;
148
146
  /**
149
- * - The calculated object.
147
+ * The calculated values, by rule name. Each entry is backed by a computed, but it is read through a reactive proxy that unwraps it, so reads yield the calculated value and never carry a `.value`.
150
148
  */
151
149
  calculatedObject: {
152
- [ruleKey: string]: import("vue").ComputedRef<any>;
150
+ [ruleKey: string]: any;
153
151
  };
154
152
  /**
155
- * - Whether the calculated object watch is running.
153
+ * Whether the calculated object watch is running.
156
154
  */
157
155
  calculatedObjectWatchRunning: boolean;
158
156
  /**
159
- * - Whether the parent state object watch is running.
157
+ * Whether the parent state object watch is running.
160
158
  */
161
159
  parentStateObjectWatchRunning: boolean;
162
160
  /**
163
- * - Whether the calculated is running.
161
+ * Whether the calculated is running.
164
162
  */
165
163
  calculatedRunning: boolean;
166
164
  /**
167
- * - Whether the object calculated is running.
165
+ * Whether the object calculated is running.
168
166
  */
169
167
  running: import("vue").Ref<boolean>;
170
168
  };
169
+ /**
170
+ * The raw, pre-unwrapped parent state consumed by the object calculated mixin, aggregating the upstream object composable states.
171
+ */
171
172
  export type ObjectCalculatedParentRawState = (import("./objectInstance.js").ObjectInstanceRawState & Partial<import("./objectSubscription.js").ObjectSubscriptionRawState> & Partial<import("./objectRelated.js").ObjectRelatedRawState>);
172
173
  /**
173
- * - The object calculated options.
174
+ * The object calculated options.
174
175
  */
175
176
  export type ObjectCalculatedParentState = import("vue").UnwrapNestedRefs<(ObjectCalculatedParentRawState)>;
176
177
  /**
@@ -182,15 +183,15 @@ export type ObjectCalculatedState = import("vue").UnwrapNestedRefs<ObjectCalcula
182
183
  */
183
184
  export type ObjectCalculatedProperties = {
184
185
  /**
185
- * - The parent state.
186
+ * The parent state.
186
187
  */
187
188
  parentState: ObjectCalculatedParentState;
188
189
  /**
189
- * - The object calculated state.
190
+ * The object calculated state.
190
191
  */
191
192
  state: ObjectCalculatedState;
192
193
  /**
193
- * - Stops composition's effects and cleans up resources.
194
+ * Stops composition's effects and cleans up resources.
194
195
  */
195
196
  stop: () => void;
196
197
  };
@@ -198,12 +199,18 @@ export type ObjectCalculatedProperties = {
198
199
  * The object calculated instance.
199
200
  */
200
201
  export type ObjectCalculated = ObjectCalculatedProperties;
202
+ /**
203
+ * The consumer-supplied props for the object calculated composable, namely the calculated-object rules ref.
204
+ */
201
205
  export type ObjectCalculatedRawProps = {
202
206
  /**
203
- * - The calculated object rules.
207
+ * The calculated object rules.
204
208
  */
205
209
  calculatedObjectRules: import("vue").Ref<ObjectCalculatedRules>;
206
210
  };
211
+ /**
212
+ * The options used to create an object calculated instance (the parent state plus the calculated-object rules).
213
+ */
207
214
  export type ObjectCalculatedOptions = ({
208
215
  parentState: ObjectCalculatedParentState;
209
216
  } & ObjectCalculatedRawProps);
@@ -68,37 +68,28 @@ export function useObjectInstance({ props, handlers }: ObjectInstanceOptions): O
68
68
  * @module use/objectInstance.js
69
69
  */
70
70
  /**
71
- * The object being managed by the instance. It must include a primary key field as identifying property, matching
72
- * the name provided to the object/list's `pkKey` value, which is not known statically.
73
- *
74
- * @typedef {{[key: string]: any}} ExistingCrudObject
71
+ * @typedef {{[key: string]: any}} ExistingCrudObject - The object being managed by the instance. It must include a primary key field as identifying property, matching the name provided to the object/list's `pkKey` value, which is not known statically.
75
72
  */
76
73
  /**
77
- * The object you would like an object instance to create for you.
78
- *
79
- * @typedef {{[key: string]: any}} NewCrudObject
74
+ * @typedef {{[key: string]: any}} NewCrudObject - The object you would like an object instance to create for you.
80
75
  */
81
76
  /**
82
- * @typedef {ExistingCrudObject|NewCrudObject} CrudObject
77
+ * @typedef {ExistingCrudObject|NewCrudObject} CrudObject - An object managed by an object instance, either an existing object or a new object to be created.
83
78
  */
84
79
  /**
85
- * Arguments to be passed to the object instance.
86
- *
87
- * @typedef {object} ObjectInstanceOptions
80
+ * @typedef {object} ObjectInstanceOptions - Arguments to be passed to the object instance.
88
81
  * @property {import('vue').UnwrapNestedRefs<ObjectInstanceRawProps>} props - The reactive configuration object.
89
82
  * @property {import('../config/objectCrud.js').ObjectCrudHandlers} [handlers] - An object of custom crud handlers to use instead of the defaults.
90
83
  */
91
84
  /**
92
- * Reactive arguments to be passed to the object instance.
93
- *
94
- * @typedef {object} ObjectInstanceRawProps
85
+ * @typedef {object} ObjectInstanceRawProps - Reactive arguments to be passed to the object instance.
95
86
  * @property {import('../config/commonCrud.js').PkInput} [pk] - The pk of the object, optional to support creating new objects.
96
87
  * @property {string} pkKey - The pk key of the object.
97
88
  * @property {object} params - The arguments to be passed to the retrieve function.
98
89
  * @property {import('../config/objectCrud.js').ObjectTarget} target - The arguments to be passed to the crud handlers.
99
90
  */
100
91
  /**
101
- * @typedef {object} ObjectInstanceRawStateCrud
92
+ * @typedef {object} ObjectInstanceRawStateCrud - The raw CRUD handlers and target args stored in an object instance's reactive state.
102
93
  * @property {import('vue').Reactive<import('../config/objectCrud.js').TargetArgs|{}>} args - The arguments to be passed to the crud handlers.
103
94
  * @property {import('../config/objectCrud.js').CrudCreateFn} create - The create function.
104
95
  * @property {import('../config/objectCrud.js').CrudRetrieveFn} retrieve - The retrieve function.
@@ -109,37 +100,29 @@ export function useObjectInstance({ props, handlers }: ObjectInstanceOptions): O
109
100
  * @property {import('../config/objectCrud.js').CrudObjectExecuteActionFn} executeAction - The executeAction function.
110
101
  */
111
102
  /**
112
- * The raw state of the object instance.
113
- *
114
- * @typedef {object} ObjectInstanceRawMyState
103
+ * @typedef {object} ObjectInstanceRawMyState - The raw state of the object instance.
115
104
  * @property {import('vue').Reactive<ObjectInstanceRawStateCrud>} crud - The crud handlers.
116
105
  * @property {import('vue').Ref<import('../config/commonCrud.js').Pk|undefined>} pk - The pk of the object.
117
106
  * @property {import('vue').Ref<string|undefined>} pkKey - The pk key of the object.
118
107
  * @property {import('vue').Ref<{[key:string]: any}>} params - The arguments to be passed to the retrieve function.
119
108
  * @property {import('vue').Reactive<CrudObject>} object - The object.
120
- * @property {boolean} deleted - Whether the object is deleted.
109
+ * @property {boolean} deleted - Whether the object was deleted by the delete action or a subscription delete
110
+ * event. Cleared when a later create, retrieve, update, or patch repopulates the object, and by `clear()`.
121
111
  */
122
112
  /**
123
- * The raw state of the object instance.
124
- *
125
- * @typedef {ObjectInstanceRawMyState & import('./loadingError.js').LoadingErrorProperties} ObjectInstanceRawState
113
+ * @typedef {ObjectInstanceRawMyState & import('./loadingError.js').LoadingErrorProperties} ObjectInstanceRawState - The raw state of the object instance.
126
114
  */
127
115
  /**
128
- * Manages a reactive state of an object including its CRUD status, loading states, and any operational errors.
129
- * Reactivity ensures that any changes in state immediately reflect in the UI components that depend on this state.
130
- *
131
- * @typedef {import('vue').Reactive<ObjectInstanceRawState>} ObjectInstanceState
116
+ * @typedef {import('vue').Reactive<ObjectInstanceRawState>} ObjectInstanceState - Manages a reactive state of an object including its CRUD status, loading states, and any operational errors. Reactivity ensures that any changes in state immediately reflect in the UI components that depend on this state.
132
117
  */
133
- /** @typedef {{ object: NewCrudObject }} ObjectInstanceCreateArgs */
134
- /** @typedef {{ object: ExistingCrudObject }} ObjectInstanceUpdateArgs */
135
- /** @typedef {{ partialObject: ExistingCrudObject }} ObjectInstancePatchArgs */
118
+ /** @typedef {{ object: NewCrudObject }} ObjectInstanceCreateArgs - The argument shape for an object instance's create operation, carrying the new object to create. */
119
+ /** @typedef {{ object: ExistingCrudObject }} ObjectInstanceUpdateArgs - The argument shape for an object instance's update operation, carrying the existing object to update. */
120
+ /** @typedef {{ partialObject: ExistingCrudObject }} ObjectInstancePatchArgs - The argument shape for an object instance's patch operation, carrying the partial object to apply. */
136
121
  /**
137
- * @typedef {{[key:string]: any}} AdditionalArgs
122
+ * @typedef {{[key:string]: any}} AdditionalArgs - Arbitrary extra arguments forwarded through to an object instance's CRUD operations.
138
123
  */
139
124
  /**
140
- * The functions available on the object instance.
141
- *
142
- * @typedef {object} ObjectInstanceMyFunctions
125
+ * @typedef {object} ObjectInstanceMyFunctions - The functions available on the object instance.
143
126
  * @property {(args: ObjectInstanceCreateArgs & AdditionalArgs) => import('../utils/cancellablePromise.js').MaybeCancellablePromise<boolean|never>} create - Called to turn the current object into a new object on the server.
144
127
  * @property {(args?: Partial<import('./cancellableIntent.js').CommonRunTracking> & AdditionalArgs) => import('../utils/cancellablePromise.js').MaybeCancellablePromise<boolean|never>} retrieve - Called to retrieve the current object by pk from the server.
145
128
  * @property {(args: ObjectInstanceUpdateArgs & AdditionalArgs) => import('../utils/cancellablePromise.js').MaybeCancellablePromise<boolean|never>} update - Called to update the current object on the server.
@@ -149,23 +132,17 @@ export function useObjectInstance({ props, handlers }: ObjectInstanceOptions): O
149
132
  * @property {() => void} clear - Called to clear the object state.
150
133
  */
151
134
  /**
152
- * The functions available on the object instance, including the ability to clear LoadingError errors.
153
- *
154
135
  * @typedef {(
155
136
  * import('./error.js').ErrorReadOnlyFunctions &
156
137
  * ObjectInstanceMyFunctions
157
- * )} ObjectInstanceFunctions
138
+ * )} ObjectInstanceFunctions - The functions available on the object instance, including the ability to clear LoadingError errors.
158
139
  */
159
140
  /**
160
- * The properties of the object instance.
161
- *
162
- * @typedef {object} ObjectInstanceProperties
141
+ * @typedef {object} ObjectInstanceProperties - The properties of the object instance.
163
142
  * @property {ObjectInstanceState} state - The state of the object instance.
164
143
  */
165
144
  /**
166
- * The instance of the object instance.
167
- *
168
- * @typedef {ObjectInstanceFunctions & ObjectInstanceProperties} ObjectInstance
145
+ * @typedef {ObjectInstanceFunctions & ObjectInstanceProperties} ObjectInstance - The instance of the object instance.
169
146
  */
170
147
  /**
171
148
  * Represents an error related to CRUD operations on an object instance. This error might be thrown
@@ -181,11 +158,12 @@ export class ObjectError extends Error {
181
158
  constructor(message: string, code: string);
182
159
  code: string;
183
160
  }
161
+ /** @internal */
184
162
  export const objectInstanceStateKeys: string[];
163
+ /** @internal */
185
164
  export const objectInstanceFunctions: string[];
186
165
  /**
187
- * The object being managed by the instance. It must include a primary key field as identifying property, matching
188
- * the name provided to the object/list's `pkKey` value, which is not known statically.
166
+ * The object being managed by the instance. It must include a primary key field as identifying property, matching the name provided to the object/list's `pkKey` value, which is not known statically.
189
167
  */
190
168
  export type ExistingCrudObject = {
191
169
  [key: string]: any;
@@ -196,17 +174,20 @@ export type ExistingCrudObject = {
196
174
  export type NewCrudObject = {
197
175
  [key: string]: any;
198
176
  };
177
+ /**
178
+ * An object managed by an object instance, either an existing object or a new object to be created.
179
+ */
199
180
  export type CrudObject = ExistingCrudObject | NewCrudObject;
200
181
  /**
201
182
  * Arguments to be passed to the object instance.
202
183
  */
203
184
  export type ObjectInstanceOptions = {
204
185
  /**
205
- * - The reactive configuration object.
186
+ * The reactive configuration object.
206
187
  */
207
188
  props: import("vue").UnwrapNestedRefs<ObjectInstanceRawProps>;
208
189
  /**
209
- * - An object of custom crud handlers to use instead of the defaults.
190
+ * An object of custom crud handlers to use instead of the defaults.
210
191
  */
211
192
  handlers?: import("../config/objectCrud.js").ObjectCrudHandlers;
212
193
  };
@@ -215,53 +196,56 @@ export type ObjectInstanceOptions = {
215
196
  */
216
197
  export type ObjectInstanceRawProps = {
217
198
  /**
218
- * - The pk of the object, optional to support creating new objects.
199
+ * The pk of the object, optional to support creating new objects.
219
200
  */
220
201
  pk?: import("../config/commonCrud.js").PkInput;
221
202
  /**
222
- * - The pk key of the object.
203
+ * The pk key of the object.
223
204
  */
224
205
  pkKey: string;
225
206
  /**
226
- * - The arguments to be passed to the retrieve function.
207
+ * The arguments to be passed to the retrieve function.
227
208
  */
228
209
  params: object;
229
210
  /**
230
- * - The arguments to be passed to the crud handlers.
211
+ * The arguments to be passed to the crud handlers.
231
212
  */
232
213
  target: import("../config/objectCrud.js").ObjectTarget;
233
214
  };
215
+ /**
216
+ * The raw CRUD handlers and target args stored in an object instance's reactive state.
217
+ */
234
218
  export type ObjectInstanceRawStateCrud = {
235
219
  /**
236
- * - The arguments to be passed to the crud handlers.
220
+ * The arguments to be passed to the crud handlers.
237
221
  */
238
222
  args: import("vue").Reactive<import("../config/objectCrud.js").TargetArgs | {}>;
239
223
  /**
240
- * - The create function.
224
+ * The create function.
241
225
  */
242
226
  create: import("../config/objectCrud.js").CrudCreateFn;
243
227
  /**
244
- * - The retrieve function.
228
+ * The retrieve function.
245
229
  */
246
230
  retrieve: import("../config/objectCrud.js").CrudRetrieveFn;
247
231
  /**
248
- * - The update function.
232
+ * The update function.
249
233
  */
250
234
  update: import("../config/objectCrud.js").CrudUpdateFn;
251
235
  /**
252
- * - The patch function.
236
+ * The patch function.
253
237
  */
254
238
  patch: import("../config/objectCrud.js").CrudPatchFn;
255
239
  /**
256
- * - The delete function.
240
+ * The delete function.
257
241
  */
258
242
  delete: import("../config/objectCrud.js").CrudDeleteFn;
259
243
  /**
260
- * - The subscribe function.
244
+ * The subscribe function.
261
245
  */
262
246
  subscribe: import("../config/objectCrud.js").CrudObjectSubscribeFn;
263
247
  /**
264
- * - The executeAction function.
248
+ * The executeAction function.
265
249
  */
266
250
  executeAction: import("../config/objectCrud.js").CrudObjectExecuteActionFn;
267
251
  };
@@ -270,29 +254,30 @@ export type ObjectInstanceRawStateCrud = {
270
254
  */
271
255
  export type ObjectInstanceRawMyState = {
272
256
  /**
273
- * - The crud handlers.
257
+ * The crud handlers.
274
258
  */
275
259
  crud: import("vue").Reactive<ObjectInstanceRawStateCrud>;
276
260
  /**
277
- * - The pk of the object.
261
+ * The pk of the object.
278
262
  */
279
263
  pk: import("vue").Ref<import("../config/commonCrud.js").Pk | undefined>;
280
264
  /**
281
- * - The pk key of the object.
265
+ * The pk key of the object.
282
266
  */
283
267
  pkKey: import("vue").Ref<string | undefined>;
284
268
  /**
285
- * - The arguments to be passed to the retrieve function.
269
+ * The arguments to be passed to the retrieve function.
286
270
  */
287
271
  params: import("vue").Ref<{
288
272
  [key: string]: any;
289
273
  }>;
290
274
  /**
291
- * - The object.
275
+ * The object.
292
276
  */
293
277
  object: import("vue").Reactive<CrudObject>;
294
278
  /**
295
- * - Whether the object is deleted.
279
+ * Whether the object was deleted by the delete action or a subscription delete
280
+ * event. Cleared when a later create, retrieve, update, or patch repopulates the object, and by `clear()`.
296
281
  */
297
282
  deleted: boolean;
298
283
  };
@@ -301,19 +286,30 @@ export type ObjectInstanceRawMyState = {
301
286
  */
302
287
  export type ObjectInstanceRawState = ObjectInstanceRawMyState & import("./loadingError.js").LoadingErrorProperties;
303
288
  /**
304
- * Manages a reactive state of an object including its CRUD status, loading states, and any operational errors.
305
- * Reactivity ensures that any changes in state immediately reflect in the UI components that depend on this state.
289
+ * Manages a reactive state of an object including its CRUD status, loading states, and any operational errors. Reactivity ensures that any changes in state immediately reflect in the UI components that depend on this state.
306
290
  */
307
291
  export type ObjectInstanceState = import("vue").Reactive<ObjectInstanceRawState>;
292
+ /**
293
+ * The argument shape for an object instance's create operation, carrying the new object to create.
294
+ */
308
295
  export type ObjectInstanceCreateArgs = {
309
296
  object: NewCrudObject;
310
297
  };
298
+ /**
299
+ * The argument shape for an object instance's update operation, carrying the existing object to update.
300
+ */
311
301
  export type ObjectInstanceUpdateArgs = {
312
302
  object: ExistingCrudObject;
313
303
  };
304
+ /**
305
+ * The argument shape for an object instance's patch operation, carrying the partial object to apply.
306
+ */
314
307
  export type ObjectInstancePatchArgs = {
315
308
  partialObject: ExistingCrudObject;
316
309
  };
310
+ /**
311
+ * Arbitrary extra arguments forwarded through to an object instance's CRUD operations.
312
+ */
317
313
  export type AdditionalArgs = {
318
314
  [key: string]: any;
319
315
  };
@@ -322,33 +318,33 @@ export type AdditionalArgs = {
322
318
  */
323
319
  export type ObjectInstanceMyFunctions = {
324
320
  /**
325
- * - Called to turn the current object into a new object on the server.
321
+ * Called to turn the current object into a new object on the server.
326
322
  */
327
323
  create: (args: ObjectInstanceCreateArgs & AdditionalArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
328
324
  /**
329
- * - Called to retrieve the current object by pk from the server.
325
+ * Called to retrieve the current object by pk from the server.
330
326
  */
331
327
  retrieve: (args?: Partial<import("./cancellableIntent.js").CommonRunTracking> & AdditionalArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
332
328
  /**
333
- * - Called to update the current object on the server.
329
+ * Called to update the current object on the server.
334
330
  */
335
331
  update: (args: ObjectInstanceUpdateArgs & AdditionalArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
336
332
  /**
337
- * - Called to delete the current object on the server.
333
+ * Called to delete the current object on the server.
338
334
  */
339
335
  delete: (args?: AdditionalArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
340
336
  /**
341
- * - Called to patch the current object on the server.
337
+ * Called to patch the current object on the server.
342
338
  */
343
339
  patch: (args: ObjectInstancePatchArgs & AdditionalArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
344
340
  /**
345
- * - Called to execute certain action on the current object.
341
+ * Called to execute certain action on the current object.
346
342
  */
347
343
  executeAction: (args: {
348
344
  action: string;
349
345
  } & AdditionalArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
350
346
  /**
351
- * - Called to clear the object state.
347
+ * Called to clear the object state.
352
348
  */
353
349
  clear: () => void;
354
350
  };
@@ -361,7 +357,7 @@ export type ObjectInstanceFunctions = (import("./error.js").ErrorReadOnlyFunctio
361
357
  */
362
358
  export type ObjectInstanceProperties = {
363
359
  /**
364
- * - The state of the object instance.
360
+ * The state of the object instance.
365
361
  */
366
362
  state: ObjectInstanceState;
367
363
  };