@arrai-innovations/reactive-helpers 18.0.0 → 18.0.2

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 (216) hide show
  1. package/package.json +20 -6
  2. package/types/config/listCrud.d.ts +153 -0
  3. package/types/config/listCrud.d.ts.map +1 -0
  4. package/types/config/objectCrud.d.ts +171 -0
  5. package/types/config/objectCrud.d.ts.map +1 -0
  6. package/types/index.d.ts +37 -0
  7. package/types/index.d.ts.map +1 -0
  8. package/types/tests/unit/config/listCrud.spec.d.ts +2 -0
  9. package/types/tests/unit/config/listCrud.spec.d.ts.map +1 -0
  10. package/types/tests/unit/config/objectCrud.spec.d.ts +2 -0
  11. package/types/tests/unit/config/objectCrud.spec.d.ts.map +1 -0
  12. package/types/tests/unit/crudPromise.d.ts +25 -0
  13. package/types/tests/unit/crudPromise.d.ts.map +1 -0
  14. package/types/tests/unit/expectHelpers.d.ts +2 -0
  15. package/types/tests/unit/expectHelpers.d.ts.map +1 -0
  16. package/types/tests/unit/mockOnUnmounted.d.ts +2 -0
  17. package/types/tests/unit/mockOnUnmounted.d.ts.map +1 -0
  18. package/types/tests/unit/poll.d.ts +2 -0
  19. package/types/tests/unit/poll.d.ts.map +1 -0
  20. package/types/tests/unit/use/cancellableIntent.spec.d.ts +2 -0
  21. package/types/tests/unit/use/cancellableIntent.spec.d.ts.map +1 -0
  22. package/types/tests/unit/use/listCalculated.spec.d.ts +2 -0
  23. package/types/tests/unit/use/listCalculated.spec.d.ts.map +1 -0
  24. package/types/tests/unit/use/listFilter.spec.d.ts +2 -0
  25. package/types/tests/unit/use/listFilter.spec.d.ts.map +1 -0
  26. package/types/tests/unit/use/listInstance.spec.d.ts +2 -0
  27. package/types/tests/unit/use/listInstance.spec.d.ts.map +1 -0
  28. package/types/tests/unit/use/listRelated.spec.d.ts +2 -0
  29. package/types/tests/unit/use/listRelated.spec.d.ts.map +1 -0
  30. package/types/tests/unit/use/listSearch.spec.d.ts +2 -0
  31. package/types/tests/unit/use/listSearch.spec.d.ts.map +1 -0
  32. package/types/tests/unit/use/listSort.spec.d.ts +2 -0
  33. package/types/tests/unit/use/listSort.spec.d.ts.map +1 -0
  34. package/types/tests/unit/use/listSubscription.spec.d.ts +2 -0
  35. package/types/tests/unit/use/listSubscription.spec.d.ts.map +1 -0
  36. package/types/tests/unit/use/loadingError.spec.d.ts +2 -0
  37. package/types/tests/unit/use/loadingError.spec.d.ts.map +1 -0
  38. package/types/tests/unit/use/objectInstance.spec.d.ts +2 -0
  39. package/types/tests/unit/use/objectInstance.spec.d.ts.map +1 -0
  40. package/types/tests/unit/use/objectSubscription.spec.d.ts +2 -0
  41. package/types/tests/unit/use/objectSubscription.spec.d.ts.map +1 -0
  42. package/types/tests/unit/use/proxyLoadingError.spec.d.ts +2 -0
  43. package/types/tests/unit/use/proxyLoadingError.spec.d.ts.map +1 -0
  44. package/types/tests/unit/use/search.spec.d.ts +2 -0
  45. package/types/tests/unit/use/search.spec.d.ts.map +1 -0
  46. package/types/tests/unit/utils/assignReactiveObject.spec.d.ts +2 -0
  47. package/types/tests/unit/utils/assignReactiveObject.spec.d.ts.map +1 -0
  48. package/types/tests/unit/utils/classes.spec.d.ts +2 -0
  49. package/types/tests/unit/utils/classes.spec.d.ts.map +1 -0
  50. package/types/tests/unit/utils/deleteKey.spec.d.ts +2 -0
  51. package/types/tests/unit/utils/deleteKey.spec.d.ts.map +1 -0
  52. package/types/tests/unit/utils/flattenPaths.spec.d.ts +2 -0
  53. package/types/tests/unit/utils/flattenPaths.spec.d.ts.map +1 -0
  54. package/types/tests/unit/utils/keyDiff.spec.d.ts +2 -0
  55. package/types/tests/unit/utils/keyDiff.spec.d.ts.map +1 -0
  56. package/types/tests/unit/utils/set.spec.d.ts +2 -0
  57. package/types/tests/unit/utils/set.spec.d.ts.map +1 -0
  58. package/types/tests/unit/utils/watches.spec.d.ts +2 -0
  59. package/types/tests/unit/utils/watches.spec.d.ts.map +1 -0
  60. package/types/use/cancellableIntent.d.ts +129 -0
  61. package/types/use/cancellableIntent.d.ts.map +1 -0
  62. package/types/use/combineClasses.d.ts +43 -0
  63. package/types/use/combineClasses.d.ts.map +1 -0
  64. package/types/use/list.d.ts +176 -0
  65. package/types/use/list.d.ts.map +1 -0
  66. package/types/use/listCalculated.d.ts +192 -0
  67. package/types/use/listCalculated.d.ts.map +1 -0
  68. package/types/use/listFilter.d.ts +203 -0
  69. package/types/use/listFilter.d.ts.map +1 -0
  70. package/types/use/listInstance.d.ts +357 -0
  71. package/types/use/listInstance.d.ts.map +1 -0
  72. package/types/use/listKeys.d.ts +15 -0
  73. package/types/use/listKeys.d.ts.map +1 -0
  74. package/types/use/listRelated.d.ts +239 -0
  75. package/types/use/listRelated.d.ts.map +1 -0
  76. package/types/use/listSearch.d.ts +298 -0
  77. package/types/use/listSearch.d.ts.map +1 -0
  78. package/types/use/listSort.d.ts +235 -0
  79. package/types/use/listSort.d.ts.map +1 -0
  80. package/types/use/listSubscription.d.ts +218 -0
  81. package/types/use/listSubscription.d.ts.map +1 -0
  82. package/types/use/loadingError.d.ts +81 -0
  83. package/types/use/loadingError.d.ts.map +1 -0
  84. package/types/use/object.d.ts +67 -0
  85. package/types/use/object.d.ts.map +1 -0
  86. package/types/use/objectCalculated.d.ts +215 -0
  87. package/types/use/objectCalculated.d.ts.map +1 -0
  88. package/types/use/objectInstance.d.ts +289 -0
  89. package/types/use/objectInstance.d.ts.map +1 -0
  90. package/types/use/objectRelated.d.ts +264 -0
  91. package/types/use/objectRelated.d.ts.map +1 -0
  92. package/types/use/objectSubscription.d.ts +249 -0
  93. package/types/use/objectSubscription.d.ts.map +1 -0
  94. package/types/use/paginatedListInstance.d.ts +51 -0
  95. package/types/use/paginatedListInstance.d.ts.map +1 -0
  96. package/types/use/proxyLoadingError.d.ts +36 -0
  97. package/types/use/proxyLoadingError.d.ts.map +1 -0
  98. package/types/use/search.d.ts +144 -0
  99. package/types/use/search.d.ts.map +1 -0
  100. package/types/use/watchesRunning.d.ts +63 -0
  101. package/types/use/watchesRunning.d.ts.map +1 -0
  102. package/types/utils/assignReactiveObject.d.ts +115 -0
  103. package/types/utils/assignReactiveObject.d.ts.map +1 -0
  104. package/types/utils/classes.d.ts +22 -0
  105. package/types/utils/classes.d.ts.map +1 -0
  106. package/types/utils/compact.d.ts +4 -0
  107. package/types/utils/compact.d.ts.map +1 -0
  108. package/types/utils/deleteKey.d.ts +16 -0
  109. package/types/utils/deleteKey.d.ts.map +1 -0
  110. package/types/utils/flattenPaths.d.ts +23 -0
  111. package/types/utils/flattenPaths.d.ts.map +1 -0
  112. package/types/utils/getFakePk.d.ts +13 -0
  113. package/types/utils/getFakePk.d.ts.map +1 -0
  114. package/types/utils/keepAliveTry.d.ts +15 -0
  115. package/types/utils/keepAliveTry.d.ts.map +1 -0
  116. package/types/utils/keyDiff.d.ts +63 -0
  117. package/types/utils/keyDiff.d.ts.map +1 -0
  118. package/types/utils/loadingCombine.d.ts +9 -0
  119. package/types/utils/loadingCombine.d.ts.map +1 -0
  120. package/types/utils/proxyRunning.d.ts +9 -0
  121. package/types/utils/proxyRunning.d.ts.map +1 -0
  122. package/types/utils/relatedCalculatedHelpers.d.ts +5 -0
  123. package/types/utils/relatedCalculatedHelpers.d.ts.map +1 -0
  124. package/types/utils/set.d.ts +7 -0
  125. package/types/utils/set.d.ts.map +1 -0
  126. package/types/utils/transformWalk.d.ts +2 -0
  127. package/types/utils/transformWalk.d.ts.map +1 -0
  128. package/types/utils/watches.d.ts +155 -0
  129. package/types/utils/watches.d.ts.map +1 -0
  130. package/use/loadingError.js +1 -1
  131. package/.circleci/config.yml +0 -88
  132. package/.commitlintrc.json +0 -25
  133. package/.editorconfig +0 -5
  134. package/.husky/commit-msg +0 -3
  135. package/.husky/pre-commit +0 -3
  136. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  137. package/.idea/encodings.xml +0 -6
  138. package/.idea/inspectionProfiles/Project_Default.xml +0 -7
  139. package/.idea/modules.xml +0 -8
  140. package/.idea/prettier.xml +0 -8
  141. package/.idea/reactive-helpers.iml +0 -15
  142. package/.prettierignore +0 -5
  143. package/.prettierrc.cjs +0 -5
  144. package/.vscode/extensions.json +0 -3
  145. package/docs/README.md +0 -45
  146. package/docs/config/listCrud.md +0 -422
  147. package/docs/config/objectCrud.md +0 -427
  148. package/docs/use/cancellableIntent.md +0 -165
  149. package/docs/use/combineClasses.md +0 -62
  150. package/docs/use/list.md +0 -361
  151. package/docs/use/listCalculated.md +0 -794
  152. package/docs/use/listFilter.md +0 -897
  153. package/docs/use/listInstance.md +0 -559
  154. package/docs/use/listKeys.md +0 -91
  155. package/docs/use/listRelated.md +0 -706
  156. package/docs/use/listSearch.md +0 -903
  157. package/docs/use/listSort.md +0 -1171
  158. package/docs/use/listSubscription.md +0 -393
  159. package/docs/use/loadingError.md +0 -115
  160. package/docs/use/object.md +0 -668
  161. package/docs/use/objectCalculated.md +0 -741
  162. package/docs/use/objectInstance.md +0 -685
  163. package/docs/use/objectRelated.md +0 -723
  164. package/docs/use/objectSubscription.md +0 -538
  165. package/docs/use/paginatedListInstance.md +0 -155
  166. package/docs/use/proxyLoadingError.md +0 -51
  167. package/docs/use/search.md +0 -321
  168. package/docs/use/watchesRunning.md +0 -84
  169. package/docs/utils/assignReactiveObject.md +0 -413
  170. package/docs/utils/classes.md +0 -139
  171. package/docs/utils/compact.md +0 -67
  172. package/docs/utils/deleteKey.md +0 -61
  173. package/docs/utils/flattenPaths.md +0 -53
  174. package/docs/utils/getFakePk.md +0 -39
  175. package/docs/utils/keepAliveTry.md +0 -59
  176. package/docs/utils/keyDiff.md +0 -117
  177. package/docs/utils/loadingCombine.md +0 -30
  178. package/docs/utils/proxyRunning.md +0 -39
  179. package/docs/utils/relatedCalculatedHelpers.md +0 -93
  180. package/docs/utils/set.md +0 -223
  181. package/docs/utils/transformWalk.md +0 -68
  182. package/docs/utils/watches.md +0 -489
  183. package/eslint.config.js +0 -125
  184. package/lint-staged.config.js +0 -10
  185. package/makeTypeDoc.sh +0 -25
  186. package/make_type_doc.js +0 -59
  187. package/tests/unit/config/listCrud.spec.js +0 -114
  188. package/tests/unit/config/objectCrud.spec.js +0 -160
  189. package/tests/unit/crudPromise.js +0 -40
  190. package/tests/unit/expectHelpers.js +0 -6
  191. package/tests/unit/mockOnUnmounted.js +0 -9
  192. package/tests/unit/poll.js +0 -50
  193. package/tests/unit/use/cancellableIntent.spec.js +0 -152
  194. package/tests/unit/use/listCalculated.spec.js +0 -135
  195. package/tests/unit/use/listFilter.spec.js +0 -484
  196. package/tests/unit/use/listInstance.spec.js +0 -1166
  197. package/tests/unit/use/listRelated.spec.js +0 -260
  198. package/tests/unit/use/listSearch.spec.js +0 -586
  199. package/tests/unit/use/listSort.spec.js +0 -418
  200. package/tests/unit/use/listSubscription.spec.js +0 -845
  201. package/tests/unit/use/loadingError.spec.js +0 -43
  202. package/tests/unit/use/objectInstance.spec.js +0 -1525
  203. package/tests/unit/use/objectSubscription.spec.js +0 -849
  204. package/tests/unit/use/proxyLoadingError.spec.js +0 -64
  205. package/tests/unit/use/search.spec.js +0 -248
  206. package/tests/unit/utils/assignReactiveObject.spec.js +0 -593
  207. package/tests/unit/utils/classes.spec.js +0 -427
  208. package/tests/unit/utils/deleteKey.spec.js +0 -265
  209. package/tests/unit/utils/flattenPaths.spec.js +0 -126
  210. package/tests/unit/utils/keyDiff.spec.js +0 -110
  211. package/tests/unit/utils/set.spec.js +0 -81
  212. package/tests/unit/utils/watches.spec.js +0 -276
  213. package/tsconfig.json +0 -19
  214. package/typedoc-local-plugins/customize-output.js +0 -13
  215. package/typedoc.json +0 -11
  216. package/vitest.config.js +0 -11
@@ -1,685 +0,0 @@
1
- [**@arrai-innovations/reactive-helpers**](../README.md)
2
-
3
- ***
4
-
5
- [@arrai-innovations/reactive-helpers](../README.md) / use/objectInstance
6
-
7
- # use/objectInstance
8
-
9
- ## Classes
10
-
11
- ### ObjectError
12
-
13
- Represents an error related to CRUD operations on an object instance. This error might be thrown
14
- when there are issues such as invalid input, network failures, or permissions issues during CRUD operations.
15
-
16
- #### Extends
17
-
18
- - `Error`
19
-
20
- #### Constructors
21
-
22
- ##### new ObjectError()
23
-
24
- > **new ObjectError**(`message`, `code`): [`ObjectError`](objectInstance.md#objecterror)
25
-
26
- Creates an instance of ObjectError.
27
-
28
- ###### Parameters
29
-
30
- ###### message
31
-
32
- `string`
33
-
34
- The error message.
35
-
36
- ###### code
37
-
38
- `string`
39
-
40
- The error code.
41
-
42
- ###### Returns
43
-
44
- [`ObjectError`](objectInstance.md#objecterror)
45
-
46
- ###### Overrides
47
-
48
- `Error.constructor`
49
-
50
- #### Properties
51
-
52
- ##### code
53
-
54
- > **code**: `string`
55
-
56
- ##### name
57
-
58
- > **name**: `string`
59
-
60
- ###### Inherited from
61
-
62
- `Error.name`
63
-
64
- ## Interfaces
65
-
66
- ### ObjectInstanceFunctions
67
-
68
- #### Properties
69
-
70
- ##### clear()
71
-
72
- > **clear**: () => `void`
73
-
74
- Called to clear the object state.
75
-
76
- ###### Returns
77
-
78
- `void`
79
-
80
- ##### clearError
81
-
82
- > **clearError**: [`ClearErrorFn`](loadingError.md#clearerrorfn)
83
-
84
- Called to clear the error state.
85
-
86
- ##### create()
87
-
88
- > **create**: (`args`) => `Promise`\<`boolean`\>
89
-
90
- Called to turn the current object into a new object on the server.
91
-
92
- ###### Parameters
93
-
94
- ###### args
95
-
96
- ###### object
97
-
98
- `any`
99
-
100
- ###### Returns
101
-
102
- `Promise`\<`boolean`\>
103
-
104
- ##### delete()
105
-
106
- > **delete**: () => `Promise`\<`boolean`\>
107
-
108
- Called to delete the current object on the server.
109
-
110
- ###### Returns
111
-
112
- `Promise`\<`boolean`\>
113
-
114
- ##### patch()
115
-
116
- > **patch**: (`args`) => `Promise`\<`boolean`\>
117
-
118
- Called to patch the current object on the server.
119
-
120
- ###### Parameters
121
-
122
- ###### args
123
-
124
- ###### partialObject
125
-
126
- [`CrudObject`](objectInstance.md#crudobject)
127
-
128
- ###### Returns
129
-
130
- `Promise`\<`boolean`\>
131
-
132
- ##### retrieve()
133
-
134
- > **retrieve**: () => `Promise`\<`boolean`\>
135
-
136
- Called to retrieve the current object by pk from the server.
137
-
138
- ###### Returns
139
-
140
- `Promise`\<`boolean`\>
141
-
142
- ##### update()
143
-
144
- > **update**: (`args`) => `Promise`\<`boolean`\>
145
-
146
- Called to update the current object on the server.
147
-
148
- ###### Parameters
149
-
150
- ###### args
151
-
152
- ###### object
153
-
154
- [`CrudObject`](objectInstance.md#crudobject)
155
-
156
- ###### Returns
157
-
158
- `Promise`\<`boolean`\>
159
-
160
- ***
161
-
162
- ### ObjectInstanceOptions
163
-
164
- #### Properties
165
-
166
- ##### functions
167
-
168
- > **functions**: [`ObjectCrudFunctions`](../config/objectCrud.md#objectcrudfunctions)
169
-
170
- An object of custom crud functions to use instead of the defaults.
171
-
172
- ##### props
173
-
174
- > **props**: `object`
175
-
176
- The reactive configuration object.
177
-
178
- ###### crudArgs
179
-
180
- > **crudArgs**: `object`
181
-
182
- The arguments to be passed to the crud functions.
183
-
184
- ###### crudArgs.args?
185
-
186
- > `optional` **args**: `any`
187
-
188
- The arguments to be passed to the crud functions.
189
-
190
- ###### crudArgs.create()?
191
-
192
- > `optional` **create**: (`CreateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
193
-
194
- A function to be used instead of the default crud create function.
195
-
196
- ###### Parameters
197
-
198
- ###### CreateDetailArgs
199
-
200
- `any`
201
-
202
- ###### Returns
203
-
204
- [`ResponseData`](../config/objectCrud.md#responsedata)
205
-
206
- ###### crudArgs.delete()?
207
-
208
- > `optional` **delete**: (`DeleteDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
209
-
210
- A function to be used instead of the default crud delete function.
211
-
212
- ###### Parameters
213
-
214
- ###### DeleteDetailArgs
215
-
216
- `any`
217
-
218
- ###### Returns
219
-
220
- [`ResponseData`](../config/objectCrud.md#responsedata)
221
-
222
- ###### crudArgs.patch()?
223
-
224
- > `optional` **patch**: (`PartialDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
225
-
226
- A function to be used instead of the default crud patch function.
227
-
228
- ###### Parameters
229
-
230
- ###### PartialDetailArgs
231
-
232
- `any`
233
-
234
- ###### Returns
235
-
236
- [`ResponseData`](../config/objectCrud.md#responsedata)
237
-
238
- ###### crudArgs.retrieve()?
239
-
240
- > `optional` **retrieve**: (`RetrieveDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
241
-
242
- A function to be used instead of the default crud retrieve function.
243
-
244
- ###### Parameters
245
-
246
- ###### RetrieveDetailArgs
247
-
248
- `any`
249
-
250
- ###### Returns
251
-
252
- [`ResponseData`](../config/objectCrud.md#responsedata)
253
-
254
- ###### crudArgs.subscribe()?
255
-
256
- > `optional` **subscribe**: (`SubscribeArgs`) => `void` & `object`
257
-
258
- A function to be used instead of the default crud subscribe function.
259
-
260
- ###### Parameters
261
-
262
- ###### SubscribeArgs
263
-
264
- `any`
265
-
266
- ###### Returns
267
-
268
- `void` & `object`
269
-
270
- ###### crudArgs.update()?
271
-
272
- > `optional` **update**: (`UpdateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
273
-
274
- A function to be used instead of the default crud update function.
275
-
276
- ###### Parameters
277
-
278
- ###### UpdateDetailArgs
279
-
280
- `any`
281
-
282
- ###### Returns
283
-
284
- [`ResponseData`](../config/objectCrud.md#responsedata)
285
-
286
- ###### pk?
287
-
288
- > `optional` **pk**: `string`
289
-
290
- The pk of the object, optional to support creating new objects.
291
-
292
- ###### pkKey
293
-
294
- > **pkKey**: `string`
295
-
296
- The pk key of the object.
297
-
298
- ###### retrieveArgs
299
-
300
- > **retrieveArgs**: `any`
301
-
302
- The arguments to be passed to the retrieve function.
303
-
304
- ***
305
-
306
- ### ObjectInstanceProperties
307
-
308
- #### Properties
309
-
310
- ##### state
311
-
312
- > **state**: `object`
313
-
314
- The state of the object instance.
315
-
316
- ###### crud
317
-
318
- > **crud**: `object`
319
-
320
- The crud functions.
321
-
322
- ###### crud.args?
323
-
324
- > `optional` **args**: `any`
325
-
326
- The arguments to be passed to the crud functions.
327
-
328
- ###### crud.create()?
329
-
330
- > `optional` **create**: (`CreateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
331
-
332
- A function to be used instead of the default crud create function.
333
-
334
- ###### Parameters
335
-
336
- ###### CreateDetailArgs
337
-
338
- `any`
339
-
340
- ###### Returns
341
-
342
- [`ResponseData`](../config/objectCrud.md#responsedata)
343
-
344
- ###### crud.delete()?
345
-
346
- > `optional` **delete**: (`DeleteDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
347
-
348
- A function to be used instead of the default crud delete function.
349
-
350
- ###### Parameters
351
-
352
- ###### DeleteDetailArgs
353
-
354
- `any`
355
-
356
- ###### Returns
357
-
358
- [`ResponseData`](../config/objectCrud.md#responsedata)
359
-
360
- ###### crud.patch()?
361
-
362
- > `optional` **patch**: (`PartialDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
363
-
364
- A function to be used instead of the default crud patch function.
365
-
366
- ###### Parameters
367
-
368
- ###### PartialDetailArgs
369
-
370
- `any`
371
-
372
- ###### Returns
373
-
374
- [`ResponseData`](../config/objectCrud.md#responsedata)
375
-
376
- ###### crud.retrieve()?
377
-
378
- > `optional` **retrieve**: (`RetrieveDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
379
-
380
- A function to be used instead of the default crud retrieve function.
381
-
382
- ###### Parameters
383
-
384
- ###### RetrieveDetailArgs
385
-
386
- `any`
387
-
388
- ###### Returns
389
-
390
- [`ResponseData`](../config/objectCrud.md#responsedata)
391
-
392
- ###### crud.subscribe()?
393
-
394
- > `optional` **subscribe**: (`SubscribeArgs`) => `void` & `object`
395
-
396
- A function to be used instead of the default crud subscribe function.
397
-
398
- ###### Parameters
399
-
400
- ###### SubscribeArgs
401
-
402
- `any`
403
-
404
- ###### Returns
405
-
406
- `void` & `object`
407
-
408
- ###### crud.update()?
409
-
410
- > `optional` **update**: (`UpdateDetailArgs`) => [`ResponseData`](../config/objectCrud.md#responsedata)
411
-
412
- A function to be used instead of the default crud update function.
413
-
414
- ###### Parameters
415
-
416
- ###### UpdateDetailArgs
417
-
418
- `any`
419
-
420
- ###### Returns
421
-
422
- [`ResponseData`](../config/objectCrud.md#responsedata)
423
-
424
- ###### deleted
425
-
426
- > **deleted**: `boolean`
427
-
428
- Whether the object is deleted.
429
-
430
- ###### error
431
-
432
- > **error**: `Error`
433
-
434
- The error.
435
-
436
- ###### errored
437
-
438
- > **errored**: `boolean`
439
-
440
- Whether the object errored.
441
-
442
- ###### loading
443
-
444
- > **loading**: `boolean`
445
-
446
- Whether the object is loading.
447
-
448
- ###### object
449
-
450
- > **object**: \{\} \| \{ `[key: string]`: `any`; `pkKey`: `string`; \}
451
-
452
- The object.
453
-
454
- ###### pk
455
-
456
- > **pk**: `string`
457
-
458
- The pk of the object.
459
-
460
- ###### pkKey
461
-
462
- > **pkKey**: `string`
463
-
464
- The pk key of the object.
465
-
466
- ###### retrieveArgs
467
-
468
- > **retrieveArgs**: `any`
469
-
470
- The arguments to be passed to the retrieve function.
471
-
472
- ***
473
-
474
- ### ObjectInstanceRawProps
475
-
476
- #### Properties
477
-
478
- ##### crudArgs
479
-
480
- > **crudArgs**: [`ObjectCrudArgs`](../config/objectCrud.md#objectcrudargs)
481
-
482
- The arguments to be passed to the crud functions.
483
-
484
- ##### pk?
485
-
486
- > `optional` **pk**: `string`
487
-
488
- The pk of the object, optional to support creating new objects.
489
-
490
- ##### pkKey
491
-
492
- > **pkKey**: `string`
493
-
494
- The pk key of the object.
495
-
496
- ##### retrieveArgs
497
-
498
- > **retrieveArgs**: `any`
499
-
500
- The arguments to be passed to the retrieve function.
501
-
502
- ***
503
-
504
- ### ObjectInstanceRawState
505
-
506
- #### Properties
507
-
508
- ##### crud
509
-
510
- > **crud**: [`ObjectCrudArgs`](../config/objectCrud.md#objectcrudargs)
511
-
512
- The crud functions.
513
-
514
- ##### deleted
515
-
516
- > **deleted**: `Readonly`\<`Ref`\<`boolean`, `boolean`\>\>
517
-
518
- Whether the object is deleted.
519
-
520
- ##### error
521
-
522
- > **error**: `Readonly`\<`Ref`\<`Error`, `Error`\>\>
523
-
524
- The error.
525
-
526
- ##### errored
527
-
528
- > **errored**: `Readonly`\<`Ref`\<`boolean`, `boolean`\>\>
529
-
530
- Whether the object errored.
531
-
532
- ##### loading
533
-
534
- > **loading**: `Readonly`\<`Ref`\<`boolean`, `boolean`\>\>
535
-
536
- Whether the object is loading.
537
-
538
- ##### object
539
-
540
- > **object**: [`CrudObject`](objectInstance.md#crudobject)
541
-
542
- The object.
543
-
544
- ##### pk
545
-
546
- > **pk**: `string`
547
-
548
- The pk of the object.
549
-
550
- ##### pkKey
551
-
552
- > **pkKey**: `string`
553
-
554
- The pk key of the object.
555
-
556
- ##### retrieveArgs
557
-
558
- > **retrieveArgs**: `any`
559
-
560
- The arguments to be passed to the retrieve function.
561
-
562
- ## Type Aliases
563
-
564
- ### CrudObject
565
-
566
- > **CrudObject**\<\>: \{ `[key: string]`: `any`; `pkKey`: `string`; \} \| \{\}
567
-
568
- #### Type Parameters
569
-
570
- ***
571
-
572
- ### ObjectInstance
573
-
574
- > **ObjectInstance**\<\>: [`ObjectInstanceFunctions`](objectInstance.md#objectinstancefunctions) & [`ObjectInstanceProperties`](objectInstance.md#objectinstanceproperties)
575
-
576
- #### Type Parameters
577
-
578
- ***
579
-
580
- ### ObjectInstanceState
581
-
582
- > **ObjectInstanceState**\<\>: `UnwrapNestedRefs`
583
-
584
- #### Type Parameters
585
-
586
- ## Variables
587
-
588
- ### objectInstanceFunctions
589
-
590
- > `const` **objectInstanceFunctions**: `string`[]
591
-
592
- ***
593
-
594
- ### objectInstanceStateKeys
595
-
596
- > `const` **objectInstanceStateKeys**: `string`[]
597
-
598
- ## Functions
599
-
600
- ### useObjectInstance()
601
-
602
- > **useObjectInstance**(`options`): [`ObjectInstance`](objectInstance.md#objectinstance)
603
-
604
- Initializes an object instance to manage CRUD operations. This setup includes reactive state management
605
- and functions to perform create, retrieve, update, delete, and patch operations based on provided CRUD
606
- configurations and arguments.
607
-
608
- #### Parameters
609
-
610
- ##### options
611
-
612
- [`ObjectInstanceOptions`](objectInstance.md#objectinstanceoptions)
613
-
614
- The options to be passed to useObjectInstance.
615
-
616
- #### Returns
617
-
618
- [`ObjectInstance`](objectInstance.md#objectinstance)
619
-
620
- - An object used to manage create, retrieve, update, delete, and patch operations.
621
-
622
- #### Example
623
-
624
- ```vue
625
- <script setup>
626
- import { useObjectInstance } from "@arrai-innovations/reactive-helpers";
627
- import { reactive, toRef } from "vue";
628
-
629
- const props = defineProps({
630
- app: {
631
- type: String,
632
- required: true,
633
- },
634
- model: {
635
- type: String,
636
- required: true,
637
- },
638
- pk: {
639
- type: String,
640
- default: '',
641
- },
642
- });
643
-
644
- const pkRef = toRef(props, 'pk');
645
- const objectInstanceProps = reactive({
646
- pk: pkRef,
647
- pkKey: 'id',
648
- crudArgs: {
649
- app: toRef(props, "app"),
650
- model: toRef(props, "model"),
651
- },
652
- retrieveArgs: {},
653
- });
654
- const objectInstance = useObjectInstance(objectInstanceProps);
655
- watch(pkRef, (newValue, oldValue) => {
656
- if (newValue !== oldValue && newValue) {
657
- objectInstance.retrieve();
658
- }
659
- });
660
- </script>
661
- <template>
662
- <!-- Display the retrieved object reactively, as a valid pk is provided in props. -->
663
- <div>{{ objectInstance.state.object }}</div>
664
- </template>
665
- ```
666
-
667
- ***
668
-
669
- ### useObjectInstances()
670
-
671
- > **useObjectInstances**(`instanceArgs`): `object`
672
-
673
- Initializes multiple useObjectInstance instances, returning an object of them based on the keys of the instanceArgs.
674
-
675
- #### Parameters
676
-
677
- ##### instanceArgs
678
-
679
- An object of objects to be passed to useObjectInstance.
680
-
681
- #### Returns
682
-
683
- `object`
684
-
685
- - An object of useObjectInstance instances.