@arrai-innovations/reactive-helpers 18.0.2 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +7 -1
  2. package/config/commonCrud.js +75 -0
  3. package/config/listCrud.js +57 -56
  4. package/config/objectCrud.js +110 -77
  5. package/index.js +6 -1
  6. package/package.json +3 -2
  7. package/types/config/commonCrud.d.ts +19 -0
  8. package/types/config/commonCrud.d.ts.map +1 -0
  9. package/types/config/listCrud.d.ts +44 -39
  10. package/types/config/listCrud.d.ts.map +1 -1
  11. package/types/config/objectCrud.d.ts +102 -40
  12. package/types/config/objectCrud.d.ts.map +1 -1
  13. package/types/index.d.ts +6 -1
  14. package/types/use/cancellableIntent.d.ts +2 -13
  15. package/types/use/cancellableIntent.d.ts.map +1 -1
  16. package/types/use/listInstance.d.ts +10 -10
  17. package/types/use/listInstance.d.ts.map +1 -1
  18. package/types/use/loadingError.d.ts +30 -6
  19. package/types/use/loadingError.d.ts.map +1 -1
  20. package/types/use/objectInstance.d.ts +83 -31
  21. package/types/use/objectInstance.d.ts.map +1 -1
  22. package/types/use/objectSubscription.d.ts +33 -29
  23. package/types/use/objectSubscription.d.ts.map +1 -1
  24. package/types/use/proxyLoadingError.d.ts +8 -23
  25. package/types/use/proxyLoadingError.d.ts.map +1 -1
  26. package/types/utils/cancellableFetch.d.ts +12 -0
  27. package/types/utils/cancellableFetch.d.ts.map +1 -0
  28. package/types/utils/cancellablePromise.d.ts +40 -0
  29. package/types/utils/cancellablePromise.d.ts.map +1 -0
  30. package/types/utils/deepUnref.d.ts +26 -0
  31. package/types/utils/deepUnref.d.ts.map +1 -0
  32. package/types/utils/refIfReactive.d.ts +2 -0
  33. package/types/utils/refIfReactive.d.ts.map +1 -0
  34. package/types/utils/unwrapNested.d.ts +2 -0
  35. package/types/utils/unwrapNested.d.ts.map +1 -0
  36. package/use/cancellableIntent.js +8 -13
  37. package/use/listInstance.js +67 -68
  38. package/use/listSearch.js +1 -1
  39. package/use/loadingError.js +30 -6
  40. package/use/objectInstance.js +228 -128
  41. package/use/objectSubscription.js +81 -82
  42. package/use/proxyLoadingError.js +14 -27
  43. package/use/search.js +1 -1
  44. package/utils/cancellableFetch.js +22 -0
  45. package/utils/cancellablePromise.js +70 -0
  46. package/utils/classes.js +5 -5
  47. package/utils/deepUnref.js +28 -0
  48. package/utils/refIfReactive.js +18 -0
  49. package/utils/unwrapNested.js +25 -0
@@ -1,9 +1,13 @@
1
- export function setListCrud({ list, bulkDelete, subscribe, executeAction, args, ...rest }: ListCrudFunctions & Partial<ListCrudArgs>): void;
2
- export function getListCrud(reactiveCrud: import("vue").UnwrapNestedRefs<ListCrudFunctions & ListCrudArgs>, { props, functions }?: {
3
- props?: import("vue").UnwrapNestedRefs<{
4
- crudArgs: object | undefined;
5
- }>;
6
- functions?: ListCrudFunctions & ListCrudArgs;
1
+ /**
2
+ * The default list crud functions.
3
+ *
4
+ * @type {Readonly<ListCrudFunctions>}
5
+ */
6
+ export const defaultListCrud: Readonly<ListCrudFunctions>;
7
+ export function setListCrud({ args, ...rest }: ListCrudFunctions & Partial<ListCrudArgs>): void;
8
+ export function getListCrud(target: import("vue").UnwrapNestedRefs<ListCrudFunctions & ListCrudArgs>, options: {
9
+ props?: import("vue").UnwrapNestedRefs<ListCrudArgsOption>;
10
+ functions?: ListCrudFunctions;
7
11
  }): void;
8
12
  export type PaginateInfo = {
9
13
  /**
@@ -20,7 +24,7 @@ export type PaginateInfo = {
20
24
  perPage: number;
21
25
  };
22
26
  export type PageCallback = (newObjects: import("../use/listInstance.js").ListObject, paginationInfo: PaginateInfo | undefined) => void;
23
- export type ListFnArgs = {
27
+ export type ListArgs = {
24
28
  /**
25
29
  * - The arguments to be passed to the crud functions.
26
30
  */
@@ -47,7 +51,7 @@ export type ListFnArgs = {
47
51
  */
48
52
  isCancelled: Readonly<import("vue").Ref<boolean>>;
49
53
  };
50
- export type DeleteFnArgs = {
54
+ export type BulkDeleteArgs = {
51
55
  /**
52
56
  * - The arguments to be passed to the crud functions.
53
57
  */
@@ -60,9 +64,14 @@ export type DeleteFnArgs = {
60
64
  * - The key name of the primary key.
61
65
  */
62
66
  pkKey: string;
67
+ /**
68
+ * - A ref to a boolean indicating whether the request has
69
+ * been cancelled.
70
+ */
71
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
63
72
  };
64
73
  export type SubscriptionEventCallback = (newOrUpdatedOrDeleteObject: import("../use/listInstance.js").ListObject | string, action: "create" | "update" | "delete") => void;
65
- export type SubscribeFnArgs = {
74
+ export type ListSubscribeArgs = {
66
75
  /**
67
76
  * - The arguments to be passed to the crud functions.
68
77
  */
@@ -83,8 +92,13 @@ export type SubscribeFnArgs = {
83
92
  * - The method to call when new data is received.
84
93
  */
85
94
  subscriptionEventCallback: SubscriptionEventCallback;
95
+ /**
96
+ * - A ref to a boolean indicating whether the request has
97
+ * been cancelled.
98
+ */
99
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
86
100
  };
87
- export type ExecuteActionFnArgs = {
101
+ export type ExecuteActionArgs = {
88
102
  /**
89
103
  * - The arguments to be passed to the crud functions.
90
104
  */
@@ -101,53 +115,44 @@ export type ExecuteActionFnArgs = {
101
115
  * - The action to execute.
102
116
  */
103
117
  action: string;
118
+ /**
119
+ * - A ref to a boolean indicating whether the request has
120
+ * been cancelled.
121
+ */
122
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
104
123
  };
105
- /**
106
- * - The list function to get a list of items, returning a boolean indicating success.
107
- */
108
- export type ListFn = (ListFnArgs: any) => Promise<boolean> & {
109
- cancel: () => Promise<void> | void;
110
- };
111
- /**
112
- * - The delete function to bulk delete a list of items.
113
- */
114
- export type BulkDeleteFn = (DeleteFnArgs: any) => Promise<boolean> & {
115
- cancel: () => Promise<void> | void;
116
- };
117
- /**
118
- * - The subscribe function to set up a subscription to a list of items.
119
- */
120
- export type SubscribeFn = (SubscribeFnArgs: any) => Promise<boolean> & {
121
- cancel: () => Promise<void> | void;
122
- };
123
- /**
124
- * - The function to execute a certain action on a list of items, returning the response data or false.
125
- */
126
- export type ExecuteActionFn = (ExecuteActionFnArgs: any) => Promise<import("./objectCrud.js").ResponseData | false> & {
127
- cancel: () => Promise<void> | void;
128
- };
124
+ export type CrudListFn = (args: ListArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<void>;
125
+ export type CrudBulkDeleteFn = (args: BulkDeleteArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<void>;
126
+ export type CrudListSubscribeFn = (args: ListSubscribeArgs) => import("../utils/cancellablePromise.js").CancellablePromise<void>;
127
+ export type CrudExecuteActionFn = (args: ExecuteActionArgs) => import("../utils/cancellablePromise.js").MaybeCancellablePromise<object | string | null>;
129
128
  export type ListCrudFunctions = {
130
129
  /**
131
130
  * - The list function to get a list of items.
132
131
  */
133
- list?: ListFn;
132
+ list?: CrudListFn;
134
133
  /**
135
134
  * - The delete function to bulk delete a list of items.
136
135
  */
137
- bulkDelete?: BulkDeleteFn;
136
+ bulkDelete?: CrudBulkDeleteFn;
138
137
  /**
139
138
  * - The function to execute a certain action on a list of items.
140
139
  */
141
- executeAction?: ExecuteActionFn;
140
+ executeAction?: CrudExecuteActionFn;
142
141
  /**
143
142
  * - The subscribe function to get a subscription to a list of items.
144
143
  */
145
- subscribe?: SubscribeFn;
144
+ subscribe?: CrudListSubscribeFn;
146
145
  };
147
146
  export type ListCrudArgs = {
148
147
  /**
149
148
  * - The default arguments for the crud functions.
150
149
  */
151
- args?: object;
150
+ args: object;
151
+ };
152
+ export type ListCrudArgsOption = {
153
+ /**
154
+ * - The default arguments for the crud functions.
155
+ */
156
+ crudArgs?: object;
152
157
  };
153
158
  //# sourceMappingURL=listCrud.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"listCrud.d.ts","sourceRoot":"","sources":["../../config/listCrud.js"],"names":[],"mappings":"AA+GO,2FAJI,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,GAEv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AAE,QAAQ,GAAC,QAAQ,GAAC,QAAQ,KACnC,IAAI;;;;;cAKI,MAAM;;;;WACN,MAAM;;;;kBACN,MAAM;;;;cACN,MAAM;;;;+BACN,yBAAyB;;;;;iBACzB,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;;;cAMpC,MAAM;;;;SACN,MAAM,EAAE;;;;WACR,MAAM;;;;YACN,MAAM;;;;;iBACN,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;gCAMvC,QAAQ,KACN,OAAO,gCAAgC,EAAE,uBAAuB,CAAC,IAAI,CAAC;sCAKxE,cAAc,KACZ,OAAO,gCAAgC,EAAE,uBAAuB,CAAC,IAAI,CAAC;yCAKxE,iBAAiB,KACf,OAAO,gCAAgC,EAAE,kBAAkB,CAAC,IAAI,CAAC;yCAKnE,iBAAiB,KACf,OAAO,gCAAgC,EAAE,uBAAuB,CAAC,MAAM,GAAC,MAAM,GAAC,IAAI,CAAC;;;;;WAKnF,UAAU;;;;iBACV,gBAAgB;;;;oBAChB,mBAAmB;;;;gBACnB,mBAAmB;;;;;;UAKnB,MAAM;;;;;;eAKN,MAAM"}
@@ -1,10 +1,17 @@
1
- export function setObjectCrud({ retrieve, create, update, patch, delete: deleteFn, subscribe, args, ...rest }: ObjectCrudArgs): void;
2
- export function getObjectCrud(reactiveCrud: import("vue").UnwrapNestedRefs<object>, { props, functions }?: {
3
- props?: import("vue").UnwrapNestedRefs<{
4
- crudArgs: ObjectCrudArgsProperties | undefined;
5
- }>;
1
+ /**
2
+ * The default object crud functions.
3
+ *
4
+ * @type {Readonly<ObjectCrudFunctions>}
5
+ */
6
+ export const defaultObjectCrud: Readonly<ObjectCrudFunctions>;
7
+ export function setObjectCrud({ args, ...rest }: ObjectCrudArgs): void;
8
+ export function getObjectCrud(target: import("vue").UnwrapNestedRefs<ObjectCrudArgsProperties>, options: {
9
+ props?: import("vue").UnwrapNestedRefs<ObjectCrudArgsOption>;
6
10
  functions?: ObjectCrudFunctions;
7
11
  }): void;
12
+ export type ObjectCrudArgsArgs = {
13
+ [key: string]: any;
14
+ };
8
15
  /**
9
16
  * Defines the CRUD-related functions and additional utilities provided by the object instance.
10
17
  */
@@ -12,31 +19,49 @@ export type ObjectCrudArgsProperties = {
12
19
  /**
13
20
  * - The arguments to be passed to the crud functions.
14
21
  */
15
- args?: object;
22
+ args: ObjectCrudArgsArgs;
16
23
  };
17
- export type CreateDetailArgs = {
24
+ export type ObjectCrudArgsOption = {
18
25
  /**
19
26
  * - The arguments to be passed to the crud functions.
20
27
  */
21
- crudArgs: object;
28
+ crudArgs?: ObjectCrudArgsArgs;
29
+ };
30
+ export type CreateArgs = {
31
+ /**
32
+ * - The arguments to be passed to the crud functions.
33
+ */
34
+ crudArgs: {
35
+ [key: string]: any;
36
+ };
22
37
  /**
23
38
  * - The data to be acted upon.
24
39
  */
25
- object: object;
40
+ object: {
41
+ [key: string]: any;
42
+ };
26
43
  /**
27
44
  * - The arguments to be passed to the retrieve function.
28
45
  */
29
- retrieveArgs: object;
46
+ retrieveArgs: {
47
+ [key: string]: any;
48
+ };
30
49
  /**
31
50
  * - The key name of the primary key.
32
51
  */
33
52
  pkKey: string;
53
+ /**
54
+ * - A ref to indicate if the request was cancelled.
55
+ */
56
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
34
57
  };
35
- export type RetrieveDetailArgs = {
58
+ export type RetrieveArgs = {
36
59
  /**
37
60
  * - The arguments to be passed to the crud functions.
38
61
  */
39
- crudArgs: object;
62
+ crudArgs: {
63
+ [key: string]: any;
64
+ };
40
65
  /**
41
66
  * - The pk of the object to be acted upon.
42
67
  */
@@ -48,31 +73,47 @@ export type RetrieveDetailArgs = {
48
73
  /**
49
74
  * - The arguments to be passed to the retrieve function.
50
75
  */
51
- retrieveArgs: object;
76
+ retrieveArgs: {
77
+ [key: string]: any;
78
+ };
79
+ /**
80
+ * - A ref to indicate if the request was cancelled.
81
+ */
82
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
52
83
  };
53
- export type UpdateDetailArgs = {
84
+ export type UpdateArgs = {
54
85
  /**
55
86
  * - The arguments to be passed to the crud functions.
56
87
  */
57
- crudArgs: object;
88
+ crudArgs: {
89
+ [key: string]: any;
90
+ };
58
91
  /**
59
92
  * - The data to be acted upon.
60
93
  */
61
- object: import("../use/objectInstance.js").CrudObject;
94
+ object: import("../use/objectInstance.js").ExistingCrudObject;
62
95
  /**
63
96
  * - The arguments to be passed to the retrieve function.
64
97
  */
65
- retrieveArgs: object;
98
+ retrieveArgs: {
99
+ [key: string]: any;
100
+ };
66
101
  /**
67
102
  * - The key name of the primary key.
68
103
  */
69
104
  pkKey: string;
105
+ /**
106
+ * - A ref to indicate if the request was cancelled.
107
+ */
108
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
70
109
  };
71
- export type DeleteDetailArgs = {
110
+ export type DeleteArgs = {
72
111
  /**
73
112
  * - The arguments to be passed to the crud functions.
74
113
  */
75
- crudArgs: object;
114
+ crudArgs: {
115
+ [key: string]: any;
116
+ };
76
117
  /**
77
118
  * - The pk of the object to be acted upon.
78
119
  */
@@ -82,15 +123,17 @@ export type DeleteDetailArgs = {
82
123
  */
83
124
  pkKey: string;
84
125
  /**
85
- * - The arguments to be passed to the retrieve function.
126
+ * - A ref to indicate if the request was cancelled.
86
127
  */
87
- retrieveArgs: object;
128
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
88
129
  };
89
- export type PartialDetailArgs = {
130
+ export type PartialArgs = {
90
131
  /**
91
132
  * - The arguments to be passed to the crud functions.
92
133
  */
93
- crudArgs: object;
134
+ crudArgs: {
135
+ [key: string]: any;
136
+ };
94
137
  /**
95
138
  * - The pk of the object to be acted upon.
96
139
  */
@@ -102,17 +145,28 @@ export type PartialDetailArgs = {
102
145
  /**
103
146
  * - The data to be acted upon.
104
147
  */
105
- partialObject: object;
148
+ partialObject: {
149
+ [key: string]: any;
150
+ };
106
151
  /**
107
152
  * - The arguments to be passed to the retrieve function.
108
153
  */
109
- retrieveArgs: object;
154
+ retrieveArgs: {
155
+ [key: string]: any;
156
+ };
157
+ /**
158
+ * - A ref to indicate if the request was cancelled.
159
+ */
160
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
110
161
  };
111
- export type SubscribeArgs = {
162
+ export type CrudSubscribeCallback = (data: import("../use/objectInstance.js").ExistingCrudObject, action: string) => any;
163
+ export type ObjectSubscribeArgs = {
112
164
  /**
113
165
  * - The arguments to be passed to the crud functions.
114
166
  */
115
- crudArgs: object;
167
+ crudArgs: {
168
+ [key: string]: any;
169
+ };
116
170
  /**
117
171
  * - The pk of the object to be acted upon.
118
172
  */
@@ -124,15 +178,25 @@ export type SubscribeArgs = {
124
178
  /**
125
179
  * - The arguments to be passed to the retrieve function.
126
180
  */
127
- retrieveArgs: object;
181
+ retrieveArgs: {
182
+ [key: string]: any;
183
+ };
128
184
  /**
129
185
  * - The callback to be called when the object is updated.
130
186
  */
131
- callback: (data: import("../use/objectInstance.js").CrudObject, action: string) => void;
132
- };
133
- export type ResponseData = Promise<object | string> & {
134
- cancel: () => Promise<void> | void;
187
+ callback: CrudSubscribeCallback;
188
+ /**
189
+ * - A ref to indicate if the request was cancelled.
190
+ */
191
+ isCancelled: Readonly<import("vue").Ref<boolean>>;
135
192
  };
193
+ export type CrudResponse = import("../utils/cancellablePromise.js").MaybeCancellablePromise<object | string>;
194
+ export type CrudCreateFn = (args: CreateArgs) => CrudResponse;
195
+ export type CrudRetrieveFn = (args: RetrieveArgs) => CrudResponse;
196
+ export type CrudUpdateFn = (args: UpdateArgs) => CrudResponse;
197
+ export type CrudPatchFn = (args: PartialArgs) => CrudResponse;
198
+ export type CrudDeleteFn = (args: DeleteArgs) => CrudResponse;
199
+ export type CrudObjectSubscribeFn = (args: ObjectSubscribeArgs) => import("../utils/cancellablePromise.js").CancellablePromise<void>;
136
200
  /**
137
201
  * Defines the CRUD-related functions and additional utilities provided by the object instance.
138
202
  */
@@ -140,29 +204,27 @@ export type ObjectCrudFunctions = {
140
204
  /**
141
205
  * - A function to be used instead of the default crud create function.
142
206
  */
143
- create?: (CreateDetailArgs: any) => ResponseData;
207
+ create?: CrudCreateFn;
144
208
  /**
145
209
  * - A function to be used instead of the default crud retrieve function.
146
210
  */
147
- retrieve?: (RetrieveDetailArgs: any) => ResponseData;
211
+ retrieve?: CrudRetrieveFn;
148
212
  /**
149
213
  * - A function to be used instead of the default crud update function.
150
214
  */
151
- update?: (UpdateDetailArgs: any) => ResponseData;
215
+ update?: CrudUpdateFn;
152
216
  /**
153
217
  * - A function to be used instead of the default crud delete function.
154
218
  */
155
- delete?: (DeleteDetailArgs: any) => ResponseData;
219
+ delete?: CrudDeleteFn;
156
220
  /**
157
221
  * - A function to be used instead of the default crud patch function.
158
222
  */
159
- patch?: (PartialDetailArgs: any) => ResponseData;
223
+ patch?: CrudPatchFn;
160
224
  /**
161
225
  * - A function to be used instead of the default crud subscribe function.
162
226
  */
163
- subscribe?: (SubscribeArgs: any) => void & {
164
- cancel: () => Promise<void> | void;
165
- };
227
+ subscribe?: CrudObjectSubscribeFn;
166
228
  };
167
229
  /**
168
230
  * The CRUD arguments.
@@ -1 +1 @@
1
- {"version":3,"file":"objectCrud.d.ts","sourceRoot":"","sources":["../../config/objectCrud.js"],"names":[],"mappings":"AA6GO,+GAHI,cAAc,QAexB;AAaM,4CARI,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,yBAE9C;IAEa,KAAK,GAFV,OAAO,KAAK,EAAE,gBAAgB,CAAC;QACnC,QAAQ,EAAE,wBAAwB,GAAC,SAAS,CAAC;KAChD,CAAC;IACoC,SAAS,GAAvC,mBAAmB;CAC3B,QAoBF;;;;;;;;WA/Ha,MAAM;;;;;;cAKN,MAAM;;;;YACN,MAAM;;;;kBACN,MAAM;;;;WACN,MAAM;;;;;;cAKN,MAAM;;;;QACN,MAAM;;;;WACN,MAAM;;;;kBACN,MAAM;;;;;;cAKN,MAAM;;;;Y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C;;;;iBACnB,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;2CAKvC,OAAO,0BAA0B,EAAE,kBAAkB,UACrD,MAAM;;;;;cAKH;QAAC,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAC;;;;QACnB,MAAM;;;;WACN,MAAM;;;;kBACN;QAAC,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAC;;;;cACnB,qBAAqB;;;;iBACrB,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;2BAIrC,OAAO,gCAAgC,EAAE,uBAAuB,CAAC,MAAM,GAAC,MAAM,CAAC;kCAKjF,UAAU,KACR,YAAY;oCAKd,YAAY,KACV,YAAY;kCAKd,UAAU,KACR,YAAY;iCAKd,WAAW,KACT,YAAY;kCAKd,UAAU,KACR,YAAY;2CAKd,mBAAmB,KACjB,OAAO,gCAAgC,EAAE,kBAAkB,CAAC,IAAI,CAAC;;;;;;;;aAOhE,YAAY;;;;eACZ,cAAc;;;;aACd,YAAY;;;;aACZ,YAAY;;;;YACZ,WAAW;;;;gBACX,qBAAqB;;;;;6BAMtB,wBAAwB,GAAG,mBAAmB"}
package/types/index.d.ts CHANGED
@@ -4,9 +4,9 @@ export * from "./use/cancellableIntent.js";
4
4
  export * from "./use/combineClasses.js";
5
5
  export * from "./use/list.js";
6
6
  export * from "./use/listCalculated.js";
7
- export * from "./use/listKeys.js";
8
7
  export * from "./use/listFilter.js";
9
8
  export * from "./use/listInstance.js";
9
+ export * from "./use/listKeys.js";
10
10
  export * from "./use/listRelated.js";
11
11
  export * from "./use/listSearch.js";
12
12
  export * from "./use/listSort.js";
@@ -22,16 +22,21 @@ export * from "./use/proxyLoadingError.js";
22
22
  export * from "./use/search.js";
23
23
  export * from "./use/watchesRunning.js";
24
24
  export * from "./utils/assignReactiveObject.js";
25
+ export * from "./utils/cancellableFetch.js";
26
+ export * from "./utils/cancellablePromise.js";
25
27
  export * from "./utils/classes.js";
26
28
  export * from "./utils/compact.js";
29
+ export * from "./utils/deepUnref.js";
27
30
  export * from "./utils/deleteKey.js";
28
31
  export * from "./utils/flattenPaths.js";
29
32
  export * from "./utils/getFakePk.js";
30
33
  export * from "./utils/keepAliveTry.js";
31
34
  export * from "./utils/keyDiff.js";
32
35
  export * from "./utils/loadingCombine.js";
36
+ export * from "./utils/refIfReactive.js";
33
37
  export * from "./utils/relatedCalculatedHelpers.js";
34
38
  export * from "./utils/set.js";
35
39
  export * from "./utils/transformWalk.js";
40
+ export * from "./utils/unwrapNested.js";
36
41
  export * from "./utils/watches.js";
37
42
  //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1,6 @@
1
1
  /**
2
2
  * @module use/cancellableIntent.js - A composable function for handling cancellable intents.
3
3
  */
4
- /**
5
- * A Promise that can be cancelled.
6
- *
7
- * @typedef {Promise<any> & { cancel: () => Promise<void>|void }} CancellablePromise
8
- */
9
4
  /**
10
5
  * @typedef {import("vue").UnwrapNestedRefs<object>} CancellableIntentState - The state of the cancellable intent.
11
6
  * @property {number} activeCount - The number of active intents.
@@ -18,7 +13,7 @@
18
13
  */
19
14
  /**
20
15
  * @typedef {object} CancellableIntentOptions - The options for the cancellable intent.
21
- * @property {() => CancellablePromise} awaitableWithCancel - The function that returns a promise that can be cancelled.
16
+ * @property {() => import('../utils/cancellablePromise.js').MaybeCancellablePromise<void>} awaitableWithCancel - The function that returns a promise that can be cancelled.
22
17
  * @property {import("vue").UnwrapNestedRefs<object>} [watchArguments={}] - The reactive object to watch for changes.
23
18
  * @property {import("vue").UnwrapNestedRefs<object>} [guardArguments={}] - The reactive object to watch for truthiness before running the intent.
24
19
  * @property {boolean} [clearActiveOnResolved=true] - Whether to clear the active state when the promise resolves.
@@ -70,12 +65,6 @@
70
65
  * @returns {CancellableIntent} - The instance of the cancellable intent.
71
66
  */
72
67
  export function useCancellableIntent({ awaitableWithCancel, watchArguments, guardArguments, clearActiveOnResolved, }: CancellableIntentOptions): CancellableIntent;
73
- /**
74
- * A Promise that can be cancelled.
75
- */
76
- export type CancellablePromise = Promise<any> & {
77
- cancel: () => Promise<void> | void;
78
- };
79
68
  /**
80
69
  * - The state of the cancellable intent.
81
70
  */
@@ -87,7 +76,7 @@ export type CancellableIntentOptions = {
87
76
  /**
88
77
  * - The function that returns a promise that can be cancelled.
89
78
  */
90
- awaitableWithCancel: () => CancellablePromise;
79
+ awaitableWithCancel: () => import("../utils/cancellablePromise.js").MaybeCancellablePromise<void>;
91
80
  /**
92
81
  * - The reactive object to watch for changes.
93
82
  */
@@ -1 +1 @@
1
- {"version":3,"file":"cancellableIntent.d.ts","sourceRoot":"","sources":["../../use/cancellableIntent.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,sHAHW,wBAAwB,GACtB,iBAAiB,CAwL7B;;;;iCA3PY,OAAO,CAAC,GAAG,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAC,IAAI,CAAA;CAAE;;;;qCAInD,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;;;;;yBAYrC,MAAM,kBAAkB;;;;qBACxB,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;qBACtC,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;4BACtC,OAAO;;;;;;;;;WAKP,sBAAsB;;;;oBACtB,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;oBACtC,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC"}
1
+ {"version":3,"file":"cancellableIntent.d.ts","sourceRoot":"","sources":["../../use/cancellableIntent.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;;;;;;;;GASG;AAEH;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,sHAHW,wBAAwB,GACtB,iBAAiB,CAyL7B;;;;qCAxPY,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;;;;;yBAYrC,MAAM,OAAO,gCAAgC,EAAE,uBAAuB,CAAC,IAAI,CAAC;;;;qBAC5E,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;qBACtC,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;4BACtC,OAAO;;;;;;;;;WAKP,sBAAsB;;;;oBACtB,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;oBACtC,OAAO,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC"}
@@ -13,13 +13,13 @@
13
13
  * @typedef {object} ListInstanceOptions
14
14
  * @property {import('vue').UnwrapNestedRefs<ListInstanceProps>} props - The props for the list instance.
15
15
  * @property {object} [functions] - Default implementation are used as set by `setListCrud`.
16
- * @property {import('../config/listCrud.js').ListFn} [functions.list] - Provide the implementation for the list
16
+ * @property {import('../config/listCrud.js').CrudListFn} [functions.list] - Provide the implementation for the list
17
17
  * function.
18
- * @property {import('../config/listCrud.js').BulkDeleteFn} [functions.bulkDelete] - Provide the implementation for the bulkDelete
18
+ * @property {import('../config/listCrud.js').CrudBulkDeleteFn} [functions.bulkDelete] - Provide the implementation for the bulkDelete
19
19
  * function.
20
- * @property {import('../config/listCrud.js').ExecuteActionFn} [functions.executeAction] - Provide the implementation for the executeAction
20
+ * @property {import('../config/listCrud.js').CrudExecuteActionFn} [functions.executeAction] - Provide the implementation for the executeAction
21
21
  * function.
22
- * @property {import('../config/listCrud.js').SubscribeFn} [functions.subscribe] - Provide the implementation for the
22
+ * @property {import('../config/listCrud.js').CrudListSubscribeFn} [functions.subscribe] - Provide the implementation for the
23
23
  * subscribe function.
24
24
  * @property {boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
25
25
  */
@@ -72,7 +72,7 @@
72
72
  * @property {(objectId: string) => void} deleteListObject - Deletes an object from the list by pk.
73
73
  * @property {() => void} clearList - Clears all objects and errors from the list.
74
74
  * @property {() => string} getFakePk - Generates a unique fake pk for use within the list.
75
- * @property {() => Promise<boolean>} list - Initiates a fetch to retrieve objects according to the CRUD configuration, returning a promise to a boolean indicating success.
75
+ * @property {() => import('../utils/cancellablePromise.js').MaybeCancellablePromise<boolean|never>} list - Initiates a fetch to retrieve objects according to the CRUD configuration, returning a promise to a boolean indicating success.
76
76
  * @property {() => Promise<boolean>} bulkDelete - Initiates a bulk delete operation on all objects in the list, returning a promise to a boolean indicating success.
77
77
  * @property {() => Promise<object|string|false>} executeAction - Initiates an action on all objects in the list, returning the response, or false if the action failed.
78
78
  */
@@ -211,10 +211,10 @@ export type ListInstanceOptions = {
211
211
  * - Default implementation are used as set by `setListCrud`.
212
212
  */
213
213
  functions?: {
214
- list?: import("../config/listCrud.js").ListFn;
215
- bulkDelete?: import("../config/listCrud.js").BulkDeleteFn;
216
- executeAction?: import("../config/listCrud.js").ExecuteActionFn;
217
- subscribe?: import("../config/listCrud.js").SubscribeFn;
214
+ list?: import("../config/listCrud.js").CrudListFn;
215
+ bulkDelete?: import("../config/listCrud.js").CrudBulkDeleteFn;
216
+ executeAction?: import("../config/listCrud.js").CrudExecuteActionFn;
217
+ subscribe?: import("../config/listCrud.js").CrudListSubscribeFn;
218
218
  };
219
219
  /**
220
220
  * - If true, pages will not be cleared when defaultPageCallback is called.
@@ -326,7 +326,7 @@ export type ListInstanceFunctions = {
326
326
  /**
327
327
  * - Initiates a fetch to retrieve objects according to the CRUD configuration, returning a promise to a boolean indicating success.
328
328
  */
329
- list: () => Promise<boolean>;
329
+ list: () => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
330
330
  /**
331
331
  * - Initiates a bulk delete operation on all objects in the list, returning a promise to a boolean indicating success.
332
332
  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AAC,OAAO,CAAC,CAAC;;;;aACpC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;WACpC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,KAAK,GAAC,IAAI,CAAC,CAAC;;;;WACvC,SAAS;;;;oBACT,cAAc;;;;;gCAMf,OAAO,KAAK,EAAE,gBAAgB,CAAC,oBAAoB,CAAC;;;;;;;;yBAOnD,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,IAAI;;;;kBAClC,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,IAAI;;;;mBAClC,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;;;;sBAC5B,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;;;;sBAC5B,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI;;;;eAC1B,MAAM,IAAI;;;;eACV,MAAM,MAAM;;;;UACZ,MAAM,OAAO,gCAAgC,EAAE,uBAAuB,CAAC,OAAO,GAAC,KAAK,CAAC;;;;gBACrF,MAAM,OAAO,CAAC,OAAO,CAAC;;;;mBACtB,MAAM,OAAO,CAAC,MAAM,GAAC,MAAM,GAAC,KAAK,CAAC;;;;;qCAMnC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAC;;;;2BAM1B,sBAAsB,GAAG,qBAAqB;;;;;yBApH9C;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC"}
@@ -4,13 +4,31 @@
4
4
  /**
5
5
  * @typedef {() => void} ClearErrorFn - Clear the error state.
6
6
  */
7
+ /**
8
+ * @typedef {import("vue").Ref<boolean|undefined>} LoadingRef
9
+ */
10
+ /**
11
+ * @typedef {import("vue").Ref<Error|null>} ErrorRef
12
+ */
13
+ /**
14
+ * @typedef {import("vue").Ref<boolean>} ErroredRef
15
+ */
16
+ /**
17
+ * @typedef {Readonly<LoadingRef>} LoadingReadonlyRef
18
+ */
19
+ /**
20
+ * @typedef {Readonly<ErrorRef>} ErrorReadonlyRef
21
+ */
22
+ /**
23
+ * @typedef {Readonly<ErroredRef>} ErroredReadonlyRef
24
+ */
7
25
  /**
8
26
  * The common API for loading and error states.
9
27
  *
10
28
  * @typedef {object} LoadingErrorStatus
11
- * @property {Readonly<import("vue").Ref<boolean|undefined>>} loading - Whether the component is loading.
12
- * @property {Readonly<import("vue").Ref<Error|null>>} error - The error that occurred.
13
- * @property {Readonly<import("vue").Ref<boolean>>} errored - Whether an error has occurred.
29
+ * @property {LoadingReadonlyRef} loading - Whether the component is loading.
30
+ * @property {ErrorReadonlyRef} error - The error that occurred.
31
+ * @property {ErroredReadonlyRef} errored - Whether an error has occurred.
14
32
  * @property {ClearErrorFn} clearError - Clear the error state.
15
33
  */
16
34
  /**
@@ -36,6 +54,12 @@ export function useLoadingError(): LoadingError;
36
54
  * - Clear the error state.
37
55
  */
38
56
  export type ClearErrorFn = () => void;
57
+ export type LoadingRef = import("vue").Ref<boolean | undefined>;
58
+ export type ErrorRef = import("vue").Ref<Error | null>;
59
+ export type ErroredRef = import("vue").Ref<boolean>;
60
+ export type LoadingReadonlyRef = Readonly<LoadingRef>;
61
+ export type ErrorReadonlyRef = Readonly<ErrorRef>;
62
+ export type ErroredReadonlyRef = Readonly<ErroredRef>;
39
63
  /**
40
64
  * The common API for loading and error states.
41
65
  */
@@ -43,15 +67,15 @@ export type LoadingErrorStatus = {
43
67
  /**
44
68
  * - Whether the component is loading.
45
69
  */
46
- loading: Readonly<import("vue").Ref<boolean | undefined>>;
70
+ loading: LoadingReadonlyRef;
47
71
  /**
48
72
  * - The error that occurred.
49
73
  */
50
- error: Readonly<import("vue").Ref<Error | null>>;
74
+ error: ErrorReadonlyRef;
51
75
  /**
52
76
  * - Whether an error has occurred.
53
77
  */
54
- errored: Readonly<import("vue").Ref<boolean>>;
78
+ errored: ErroredReadonlyRef;
55
79
  /**
56
80
  * - Clear the error state.
57
81
  */
@@ -1 +1 @@
1
- {"version":3,"file":"loadingError.d.ts","sourceRoot":"","sources":["../../use/loadingError.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,mCAFa,YAAY,CA6BxB;;;;2BA5DY,MAAM,IAAI;;;;;;;;aAOT,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,GAAC,SAAS,CAAC,CAAC;;;;WAC9C,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,KAAK,GAAC,IAAI,CAAC,CAAC;;;;aACvC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;gBACpC,YAAY;;;;;;;;;gBAOZ,MAAM,IAAI;;;;kBACV,MAAM,IAAI;;;;cACV,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;;;;;2BAMvB,kBAAkB,GAAG,qBAAqB"}
1
+ {"version":3,"file":"loadingError.d.ts","sourceRoot":"","sources":["../../use/loadingError.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,mCAFa,YAAY,CA6BxB;;;;2BApFY,MAAM,IAAI;yBAIV,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,GAAC,SAAS,CAAC;uBAIpC,OAAO,KAAK,EAAE,GAAG,CAAC,KAAK,GAAC,IAAI,CAAC;yBAI7B,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;iCAI1B,QAAQ,CAAC,UAAU,CAAC;+BAIpB,QAAQ,CAAC,QAAQ,CAAC;iCAIlB,QAAQ,CAAC,UAAU,CAAC;;;;;;;;aAOnB,kBAAkB;;;;WAClB,gBAAgB;;;;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