@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.
- package/package.json +20 -6
- package/types/config/listCrud.d.ts +153 -0
- package/types/config/listCrud.d.ts.map +1 -0
- package/types/config/objectCrud.d.ts +171 -0
- package/types/config/objectCrud.d.ts.map +1 -0
- package/types/index.d.ts +37 -0
- package/types/index.d.ts.map +1 -0
- package/types/tests/unit/config/listCrud.spec.d.ts +2 -0
- package/types/tests/unit/config/listCrud.spec.d.ts.map +1 -0
- package/types/tests/unit/config/objectCrud.spec.d.ts +2 -0
- package/types/tests/unit/config/objectCrud.spec.d.ts.map +1 -0
- package/types/tests/unit/crudPromise.d.ts +25 -0
- package/types/tests/unit/crudPromise.d.ts.map +1 -0
- package/types/tests/unit/expectHelpers.d.ts +2 -0
- package/types/tests/unit/expectHelpers.d.ts.map +1 -0
- package/types/tests/unit/mockOnUnmounted.d.ts +2 -0
- package/types/tests/unit/mockOnUnmounted.d.ts.map +1 -0
- package/types/tests/unit/poll.d.ts +2 -0
- package/types/tests/unit/poll.d.ts.map +1 -0
- package/types/tests/unit/use/cancellableIntent.spec.d.ts +2 -0
- package/types/tests/unit/use/cancellableIntent.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listCalculated.spec.d.ts +2 -0
- package/types/tests/unit/use/listCalculated.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listFilter.spec.d.ts +2 -0
- package/types/tests/unit/use/listFilter.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listInstance.spec.d.ts +2 -0
- package/types/tests/unit/use/listInstance.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listRelated.spec.d.ts +2 -0
- package/types/tests/unit/use/listRelated.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listSearch.spec.d.ts +2 -0
- package/types/tests/unit/use/listSearch.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listSort.spec.d.ts +2 -0
- package/types/tests/unit/use/listSort.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listSubscription.spec.d.ts +2 -0
- package/types/tests/unit/use/listSubscription.spec.d.ts.map +1 -0
- package/types/tests/unit/use/loadingError.spec.d.ts +2 -0
- package/types/tests/unit/use/loadingError.spec.d.ts.map +1 -0
- package/types/tests/unit/use/objectInstance.spec.d.ts +2 -0
- package/types/tests/unit/use/objectInstance.spec.d.ts.map +1 -0
- package/types/tests/unit/use/objectSubscription.spec.d.ts +2 -0
- package/types/tests/unit/use/objectSubscription.spec.d.ts.map +1 -0
- package/types/tests/unit/use/proxyLoadingError.spec.d.ts +2 -0
- package/types/tests/unit/use/proxyLoadingError.spec.d.ts.map +1 -0
- package/types/tests/unit/use/search.spec.d.ts +2 -0
- package/types/tests/unit/use/search.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/assignReactiveObject.spec.d.ts +2 -0
- package/types/tests/unit/utils/assignReactiveObject.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/classes.spec.d.ts +2 -0
- package/types/tests/unit/utils/classes.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/deleteKey.spec.d.ts +2 -0
- package/types/tests/unit/utils/deleteKey.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/flattenPaths.spec.d.ts +2 -0
- package/types/tests/unit/utils/flattenPaths.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/keyDiff.spec.d.ts +2 -0
- package/types/tests/unit/utils/keyDiff.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/set.spec.d.ts +2 -0
- package/types/tests/unit/utils/set.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/watches.spec.d.ts +2 -0
- package/types/tests/unit/utils/watches.spec.d.ts.map +1 -0
- package/types/use/cancellableIntent.d.ts +129 -0
- package/types/use/cancellableIntent.d.ts.map +1 -0
- package/types/use/combineClasses.d.ts +43 -0
- package/types/use/combineClasses.d.ts.map +1 -0
- package/types/use/list.d.ts +176 -0
- package/types/use/list.d.ts.map +1 -0
- package/types/use/listCalculated.d.ts +192 -0
- package/types/use/listCalculated.d.ts.map +1 -0
- package/types/use/listFilter.d.ts +203 -0
- package/types/use/listFilter.d.ts.map +1 -0
- package/types/use/listInstance.d.ts +357 -0
- package/types/use/listInstance.d.ts.map +1 -0
- package/types/use/listKeys.d.ts +15 -0
- package/types/use/listKeys.d.ts.map +1 -0
- package/types/use/listRelated.d.ts +239 -0
- package/types/use/listRelated.d.ts.map +1 -0
- package/types/use/listSearch.d.ts +298 -0
- package/types/use/listSearch.d.ts.map +1 -0
- package/types/use/listSort.d.ts +235 -0
- package/types/use/listSort.d.ts.map +1 -0
- package/types/use/listSubscription.d.ts +218 -0
- package/types/use/listSubscription.d.ts.map +1 -0
- package/types/use/loadingError.d.ts +81 -0
- package/types/use/loadingError.d.ts.map +1 -0
- package/types/use/object.d.ts +67 -0
- package/types/use/object.d.ts.map +1 -0
- package/types/use/objectCalculated.d.ts +215 -0
- package/types/use/objectCalculated.d.ts.map +1 -0
- package/types/use/objectInstance.d.ts +289 -0
- package/types/use/objectInstance.d.ts.map +1 -0
- package/types/use/objectRelated.d.ts +264 -0
- package/types/use/objectRelated.d.ts.map +1 -0
- package/types/use/objectSubscription.d.ts +249 -0
- package/types/use/objectSubscription.d.ts.map +1 -0
- package/types/use/paginatedListInstance.d.ts +51 -0
- package/types/use/paginatedListInstance.d.ts.map +1 -0
- package/types/use/proxyLoadingError.d.ts +36 -0
- package/types/use/proxyLoadingError.d.ts.map +1 -0
- package/types/use/search.d.ts +144 -0
- package/types/use/search.d.ts.map +1 -0
- package/types/use/watchesRunning.d.ts +63 -0
- package/types/use/watchesRunning.d.ts.map +1 -0
- package/types/utils/assignReactiveObject.d.ts +115 -0
- package/types/utils/assignReactiveObject.d.ts.map +1 -0
- package/types/utils/classes.d.ts +22 -0
- package/types/utils/classes.d.ts.map +1 -0
- package/types/utils/compact.d.ts +4 -0
- package/types/utils/compact.d.ts.map +1 -0
- package/types/utils/deleteKey.d.ts +16 -0
- package/types/utils/deleteKey.d.ts.map +1 -0
- package/types/utils/flattenPaths.d.ts +23 -0
- package/types/utils/flattenPaths.d.ts.map +1 -0
- package/types/utils/getFakePk.d.ts +13 -0
- package/types/utils/getFakePk.d.ts.map +1 -0
- package/types/utils/keepAliveTry.d.ts +15 -0
- package/types/utils/keepAliveTry.d.ts.map +1 -0
- package/types/utils/keyDiff.d.ts +63 -0
- package/types/utils/keyDiff.d.ts.map +1 -0
- package/types/utils/loadingCombine.d.ts +9 -0
- package/types/utils/loadingCombine.d.ts.map +1 -0
- package/types/utils/proxyRunning.d.ts +9 -0
- package/types/utils/proxyRunning.d.ts.map +1 -0
- package/types/utils/relatedCalculatedHelpers.d.ts +5 -0
- package/types/utils/relatedCalculatedHelpers.d.ts.map +1 -0
- package/types/utils/set.d.ts +7 -0
- package/types/utils/set.d.ts.map +1 -0
- package/types/utils/transformWalk.d.ts +2 -0
- package/types/utils/transformWalk.d.ts.map +1 -0
- package/types/utils/watches.d.ts +155 -0
- package/types/utils/watches.d.ts.map +1 -0
- package/use/loadingError.js +1 -1
- package/.circleci/config.yml +0 -88
- package/.commitlintrc.json +0 -25
- package/.editorconfig +0 -5
- package/.husky/commit-msg +0 -3
- package/.husky/pre-commit +0 -3
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/encodings.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -8
- package/.idea/reactive-helpers.iml +0 -15
- package/.prettierignore +0 -5
- package/.prettierrc.cjs +0 -5
- package/.vscode/extensions.json +0 -3
- package/docs/README.md +0 -45
- package/docs/config/listCrud.md +0 -422
- package/docs/config/objectCrud.md +0 -427
- package/docs/use/cancellableIntent.md +0 -165
- package/docs/use/combineClasses.md +0 -62
- package/docs/use/list.md +0 -361
- package/docs/use/listCalculated.md +0 -794
- package/docs/use/listFilter.md +0 -897
- package/docs/use/listInstance.md +0 -559
- package/docs/use/listKeys.md +0 -91
- package/docs/use/listRelated.md +0 -706
- package/docs/use/listSearch.md +0 -903
- package/docs/use/listSort.md +0 -1171
- package/docs/use/listSubscription.md +0 -393
- package/docs/use/loadingError.md +0 -115
- package/docs/use/object.md +0 -668
- package/docs/use/objectCalculated.md +0 -741
- package/docs/use/objectInstance.md +0 -685
- package/docs/use/objectRelated.md +0 -723
- package/docs/use/objectSubscription.md +0 -538
- package/docs/use/paginatedListInstance.md +0 -155
- package/docs/use/proxyLoadingError.md +0 -51
- package/docs/use/search.md +0 -321
- package/docs/use/watchesRunning.md +0 -84
- package/docs/utils/assignReactiveObject.md +0 -413
- package/docs/utils/classes.md +0 -139
- package/docs/utils/compact.md +0 -67
- package/docs/utils/deleteKey.md +0 -61
- package/docs/utils/flattenPaths.md +0 -53
- package/docs/utils/getFakePk.md +0 -39
- package/docs/utils/keepAliveTry.md +0 -59
- package/docs/utils/keyDiff.md +0 -117
- package/docs/utils/loadingCombine.md +0 -30
- package/docs/utils/proxyRunning.md +0 -39
- package/docs/utils/relatedCalculatedHelpers.md +0 -93
- package/docs/utils/set.md +0 -223
- package/docs/utils/transformWalk.md +0 -68
- package/docs/utils/watches.md +0 -489
- package/eslint.config.js +0 -125
- package/lint-staged.config.js +0 -10
- package/makeTypeDoc.sh +0 -25
- package/make_type_doc.js +0 -59
- package/tests/unit/config/listCrud.spec.js +0 -114
- package/tests/unit/config/objectCrud.spec.js +0 -160
- package/tests/unit/crudPromise.js +0 -40
- package/tests/unit/expectHelpers.js +0 -6
- package/tests/unit/mockOnUnmounted.js +0 -9
- package/tests/unit/poll.js +0 -50
- package/tests/unit/use/cancellableIntent.spec.js +0 -152
- package/tests/unit/use/listCalculated.spec.js +0 -135
- package/tests/unit/use/listFilter.spec.js +0 -484
- package/tests/unit/use/listInstance.spec.js +0 -1166
- package/tests/unit/use/listRelated.spec.js +0 -260
- package/tests/unit/use/listSearch.spec.js +0 -586
- package/tests/unit/use/listSort.spec.js +0 -418
- package/tests/unit/use/listSubscription.spec.js +0 -845
- package/tests/unit/use/loadingError.spec.js +0 -43
- package/tests/unit/use/objectInstance.spec.js +0 -1525
- package/tests/unit/use/objectSubscription.spec.js +0 -849
- package/tests/unit/use/proxyLoadingError.spec.js +0 -64
- package/tests/unit/use/search.spec.js +0 -248
- package/tests/unit/utils/assignReactiveObject.spec.js +0 -593
- package/tests/unit/utils/classes.spec.js +0 -427
- package/tests/unit/utils/deleteKey.spec.js +0 -265
- package/tests/unit/utils/flattenPaths.spec.js +0 -126
- package/tests/unit/utils/keyDiff.spec.js +0 -110
- package/tests/unit/utils/set.spec.js +0 -81
- package/tests/unit/utils/watches.spec.js +0 -276
- package/tsconfig.json +0 -19
- package/typedoc-local-plugins/customize-output.js +0 -13
- package/typedoc.json +0 -11
- 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.
|