@arrai-innovations/reactive-helpers 13.0.2 → 13.0.3

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.
@@ -36,42 +36,90 @@ The crud functions.
36
36
 
37
37
  The arguments to be passed to the crud functions.
38
38
 
39
- ###### crud.create
39
+ ###### crud.create()
40
40
 
41
- > **create**: `Function`
41
+ > **create**: (`CreateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
42
42
 
43
43
  A function to be used instead of the default crud create function.
44
44
 
45
- ###### crud.delete
45
+ ###### Parameters
46
46
 
47
- > **delete**: `Function`
47
+ **CreateDetailArgs**: `any`
48
+
49
+ ###### Returns
50
+
51
+ [`ResponseData`](../config/objectCrud.md#responsedata)
52
+
53
+ ###### crud.delete()
54
+
55
+ > **delete**: (`DeleteDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
48
56
 
49
57
  A function to be used instead of the default crud delete function.
50
58
 
51
- ###### crud.patch
59
+ ###### Parameters
60
+
61
+ • **DeleteDetailArgs**: `any`
62
+
63
+ ###### Returns
52
64
 
53
- > **patch**: `Function`
65
+ [`ResponseData`](../config/objectCrud.md#responsedata)
66
+
67
+ ###### crud.patch()
68
+
69
+ > **patch**: (`PartialDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
54
70
 
55
71
  A function to be used instead of the default crud patch function.
56
72
 
57
- ###### crud.retrieve
73
+ ###### Parameters
74
+
75
+ • **PartialDetailArgs**: `any`
76
+
77
+ ###### Returns
78
+
79
+ [`ResponseData`](../config/objectCrud.md#responsedata)
80
+
81
+ ###### crud.retrieve()
58
82
 
59
- > **retrieve**: `Function`
83
+ > **retrieve**: (`RetrieveDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
60
84
 
61
85
  A function to be used instead of the default crud retrieve function.
62
86
 
63
- ###### crud.subscribe
87
+ ###### Parameters
64
88
 
65
- > **subscribe**: `Function`
89
+ **RetrieveDetailArgs**: `any`
90
+
91
+ ###### Returns
92
+
93
+ [`ResponseData`](../config/objectCrud.md#responsedata)
94
+
95
+ ###### crud.subscribe()
96
+
97
+ > **subscribe**: (`SubscribeArgs`) => `void`
66
98
 
67
99
  A function to be used instead of the default crud subscribe function.
68
100
 
69
- ###### crud.update
101
+ ###### Parameters
102
+
103
+ • **SubscribeArgs**: `any`
104
+
105
+ ###### Returns
70
106
 
71
- > **update**: `Function`
107
+ `void`
108
+
109
+ ###### crud.update()
110
+
111
+ > **update**: (`UpdateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
72
112
 
73
113
  A function to be used instead of the default crud update function.
74
114
 
115
+ ###### Parameters
116
+
117
+ • **UpdateDetailArgs**: `any`
118
+
119
+ ###### Returns
120
+
121
+ [`ResponseData`](../config/objectCrud.md#responsedata)
122
+
75
123
  ###### deleted
76
124
 
77
125
  > **deleted**: `boolean`
@@ -168,42 +216,90 @@ The crud functions.
168
216
 
169
217
  The arguments to be passed to the crud functions.
170
218
 
171
- ###### crud.create
219
+ ###### crud.create()
172
220
 
173
- > **create**: `Function`
221
+ > **create**: (`CreateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
174
222
 
175
223
  A function to be used instead of the default crud create function.
176
224
 
177
- ###### crud.delete
225
+ ###### Parameters
178
226
 
179
- > **delete**: `Function`
227
+ **CreateDetailArgs**: `any`
228
+
229
+ ###### Returns
230
+
231
+ [`ResponseData`](../config/objectCrud.md#responsedata)
232
+
233
+ ###### crud.delete()
234
+
235
+ > **delete**: (`DeleteDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
180
236
 
181
237
  A function to be used instead of the default crud delete function.
182
238
 
183
- ###### crud.patch
239
+ ###### Parameters
240
+
241
+ • **DeleteDetailArgs**: `any`
242
+
243
+ ###### Returns
184
244
 
185
- > **patch**: `Function`
245
+ [`ResponseData`](../config/objectCrud.md#responsedata)
246
+
247
+ ###### crud.patch()
248
+
249
+ > **patch**: (`PartialDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
186
250
 
187
251
  A function to be used instead of the default crud patch function.
188
252
 
189
- ###### crud.retrieve
253
+ ###### Parameters
254
+
255
+ • **PartialDetailArgs**: `any`
256
+
257
+ ###### Returns
258
+
259
+ [`ResponseData`](../config/objectCrud.md#responsedata)
260
+
261
+ ###### crud.retrieve()
190
262
 
191
- > **retrieve**: `Function`
263
+ > **retrieve**: (`RetrieveDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
192
264
 
193
265
  A function to be used instead of the default crud retrieve function.
194
266
 
195
- ###### crud.subscribe
267
+ ###### Parameters
196
268
 
197
- > **subscribe**: `Function`
269
+ **RetrieveDetailArgs**: `any`
270
+
271
+ ###### Returns
272
+
273
+ [`ResponseData`](../config/objectCrud.md#responsedata)
274
+
275
+ ###### crud.subscribe()
276
+
277
+ > **subscribe**: (`SubscribeArgs`) => `void`
198
278
 
199
279
  A function to be used instead of the default crud subscribe function.
200
280
 
201
- ###### crud.update
281
+ ###### Parameters
282
+
283
+ • **SubscribeArgs**: `any`
284
+
285
+ ###### Returns
202
286
 
203
- > **update**: `Function`
287
+ `void`
288
+
289
+ ###### crud.update()
290
+
291
+ > **update**: (`UpdateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
204
292
 
205
293
  A function to be used instead of the default crud update function.
206
294
 
295
+ ###### Parameters
296
+
297
+ • **UpdateDetailArgs**: `any`
298
+
299
+ ###### Returns
300
+
301
+ [`ResponseData`](../config/objectCrud.md#responsedata)
302
+
207
303
  ###### deleted
208
304
 
209
305
  > **deleted**: `boolean`
@@ -167,42 +167,90 @@ The crud functions.
167
167
 
168
168
  The arguments to be passed to the crud functions.
169
169
 
170
- ###### crud.create
170
+ ###### crud.create()
171
171
 
172
- > **create**: `Function`
172
+ > **create**: (`CreateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
173
173
 
174
174
  A function to be used instead of the default crud create function.
175
175
 
176
- ###### crud.delete
176
+ ###### Parameters
177
+
178
+ • **CreateDetailArgs**: `any`
179
+
180
+ ###### Returns
181
+
182
+ [`ResponseData`](../config/objectCrud.md#responsedata)
177
183
 
178
- > **delete**: `Function`
184
+ ###### crud.delete()
185
+
186
+ > **delete**: (`DeleteDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
179
187
 
180
188
  A function to be used instead of the default crud delete function.
181
189
 
182
- ###### crud.patch
190
+ ###### Parameters
191
+
192
+ • **DeleteDetailArgs**: `any`
193
+
194
+ ###### Returns
183
195
 
184
- > **patch**: `Function`
196
+ [`ResponseData`](../config/objectCrud.md#responsedata)
197
+
198
+ ###### crud.patch()
199
+
200
+ > **patch**: (`PartialDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
185
201
 
186
202
  A function to be used instead of the default crud patch function.
187
203
 
188
- ###### crud.retrieve
204
+ ###### Parameters
189
205
 
190
- > **retrieve**: `Function`
206
+ **PartialDetailArgs**: `any`
207
+
208
+ ###### Returns
209
+
210
+ [`ResponseData`](../config/objectCrud.md#responsedata)
211
+
212
+ ###### crud.retrieve()
213
+
214
+ > **retrieve**: (`RetrieveDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
191
215
 
192
216
  A function to be used instead of the default crud retrieve function.
193
217
 
194
- ###### crud.subscribe
218
+ ###### Parameters
195
219
 
196
- > **subscribe**: `Function`
220
+ **RetrieveDetailArgs**: `any`
221
+
222
+ ###### Returns
223
+
224
+ [`ResponseData`](../config/objectCrud.md#responsedata)
225
+
226
+ ###### crud.subscribe()
227
+
228
+ > **subscribe**: (`SubscribeArgs`) => `void`
197
229
 
198
230
  A function to be used instead of the default crud subscribe function.
199
231
 
200
- ###### crud.update
232
+ ###### Parameters
233
+
234
+ • **SubscribeArgs**: `any`
235
+
236
+ ###### Returns
237
+
238
+ `void`
239
+
240
+ ###### crud.update()
201
241
 
202
- > **update**: `Function`
242
+ > **update**: (`UpdateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
203
243
 
204
244
  A function to be used instead of the default crud update function.
205
245
 
246
+ ###### Parameters
247
+
248
+ • **UpdateDetailArgs**: `any`
249
+
250
+ ###### Returns
251
+
252
+ [`ResponseData`](../config/objectCrud.md#responsedata)
253
+
206
254
  ###### deleted
207
255
 
208
256
  > **deleted**: `boolean`
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ // don't use default exports. it is easier if each file defines the canonical name for the function it exports.
1
2
  export * from "./config/listCrud.js";
2
3
  export * from "./config/objectCrud.js";
3
4
  export * from "./use/cancellableIntent.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrai-innovations/reactive-helpers",
3
- "version": "13.0.2",
3
+ "version": "13.0.3",
4
4
  "description": "VueJS 3 utility composition functions to help manipulate objects and lists.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -15,6 +15,15 @@ import { isRef, ref, watch, isReactive } from "vue";
15
15
  */
16
16
  const isRefOrReactive = (v) => isRef(v) || isReactive(v);
17
17
 
18
+ /**
19
+ * @typedef {(
20
+ * string |
21
+ * string[] |
22
+ * { [key: string]: boolean | import("vue").Ref<boolean> } |
23
+ * import("vue").Ref<string | string[]>
24
+ * )} CSSClasses
25
+ */
26
+
18
27
  /**
19
28
  * Normalize various ways of specifying CSS classes into an object for use in Vue.js with reactivity. If refs are
20
29
  * present, the resulting object will be a ref containing an array of objects to preserve order of operations in
@@ -40,12 +49,7 @@ const isRefOrReactive = (v) => isRef(v) || isReactive(v);
40
49
  * </script>
41
50
  * ```
42
51
  *
43
- * @param {...(
44
- * string |
45
- * string[] |
46
- * { [key: string]: boolean | import("vue").Ref<boolean> } |
47
- * import("vue").Ref<string | string[]>
48
- * )} classes - A mixed array containing multiple ways of specifying CSS classes.
52
+ * @param {...(CSSClasses)} classes - A mixed array containing multiple ways of specifying CSS classes.
49
53
  * @returns {import("vue").Ref<import('../utils/classes.js').CombinedClasses>} - A ref
50
54
  * containing an object or array of objects containing CSS classes. Arrays are used if refs are present, to
51
55
  * preserve order of operations in reactive contexts.
@@ -51,7 +51,10 @@ export class ListInstanceError extends Error {
51
51
  * @typedef {object} ListInstanceOptions
52
52
  * @property {import('vue').UnwrapNestedRefs<ListInstanceProps>} props - The props for the list instance.
53
53
  * @property {object} [functions] - Default implementation are used as set by `setListCrud`.
54
- * @property {Function} [functions.list] - Provide the implementation for the list function.
54
+ * @property {import('../config/listCrud.js').ListFn} [functions.list] - Provide the implementation for the list
55
+ * function.
56
+ * @property {import('../config/listCrud.js').SubscribeFn} [functions.subscribe] - Provide the implementation for the
57
+ * subscribe function.
55
58
  * @property {boolean} [keepOldPages=false] - If true, pages will not be cleared when defaultPageCallback is called.
56
59
  */
57
60
 
@@ -5,20 +5,27 @@ import { readonly, ref } from "vue";
5
5
  */
6
6
 
7
7
  /**
8
- * A composable function for managing loading and error states.
9
- *
10
- * @returns {object} - An object containing reactive fields and actions for loading and error states.
11
- * @property {import("vue").Ref<boolean|undefined>} loading - Whether the component is loading.
12
- * @property {import("vue").Ref<Error|null>} error - The error that occurred.
13
- * @property {import("vue").Ref<boolean>} errored - Whether an error has occurred.
8
+ * @typedef {object} LoadingError
9
+ * @property {Readonly<import("vue").Ref<boolean|undefined>>} loading - Whether the component is loading.
10
+ * @property {Readonly<import("vue").Ref<Error|null>>} error - The error that occurred.
11
+ * @property {Readonly<import("vue").Ref<boolean>>} errored - Whether an error has occurred.
14
12
  * @property {() => void} setLoading - Set the loading state.
15
13
  * @property {() => void} clearLoading - Clear the loading state.
16
14
  * @property {(error) => void} setError - Set the error state.
17
15
  * @property {() => void} clearError - Clear the error state.
18
16
  */
17
+
18
+ /**
19
+ * A composable function for managing loading and error states.
20
+ *
21
+ * @returns {LoadingError} - An object containing reactive fields and actions for loading and error states.
22
+ */
19
23
  export function useLoadingError() {
24
+ /** @type {import("vue").Ref<boolean|undefined>} */
20
25
  const loading = ref(undefined);
26
+ /** @type {import("vue").Ref<Error|null>} */
21
27
  const error = ref(null);
28
+ /** @type {import("vue").Ref<boolean>} */
22
29
  const errored = ref(false);
23
30
 
24
31
  return {