@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
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} ObjectRelatedProperties
|
|
3
|
+
* @property {ObjectRelatedState} state - The state of the object related instance.
|
|
4
|
+
* @property {ObjectRelatedParentState} parentState - The parent state.
|
|
5
|
+
* @property {import('./watchesRunning.js').WatchesRunning} watchesRunning - The watches running instance.
|
|
6
|
+
* @property {import('vue').EffectScope} effectScope - The effect scope.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* An instance of an object related reactive object.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {ObjectRelatedProperties} ObjectRelated
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Non-parent state options for useObjectRelated.
|
|
16
|
+
*
|
|
17
|
+
* @typedef {object} ObjectRelatedRawProps
|
|
18
|
+
* @property {import('vue').Ref<ObjectRelatedRawRules>} relatedObjectRules - The rules for defining relationships for the managed object to other collections of objects.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Options for useObjectRelated.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {{
|
|
24
|
+
* parentState: ObjectRelatedParentState,
|
|
25
|
+
* } & ObjectRelatedRawProps} ObjectRelatedOptions
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {{
|
|
30
|
+
* [key: string]: ObjectRelatedOptions
|
|
31
|
+
* }} objectRelatedArgs - The options for the desired object related reactive objects.
|
|
32
|
+
* @returns {{
|
|
33
|
+
* [key: string]: ObjectRelated
|
|
34
|
+
* }} - The object related instances, indexed by key.
|
|
35
|
+
*/
|
|
36
|
+
export function useObjectRelateds(objectRelatedArgs: {
|
|
37
|
+
[key: string]: ObjectRelatedOptions;
|
|
38
|
+
}): {
|
|
39
|
+
[key: string]: ObjectRelated;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Creates an object related reactive object.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```vue
|
|
46
|
+
* <script setup>
|
|
47
|
+
* import { useObjectRelated, useObjectSubscription } from "@arrai-innovations/reactive-helpers";
|
|
48
|
+
* import { ref, reactive } from "vue";
|
|
49
|
+
*
|
|
50
|
+
* const someObjectsSource = reactive({
|
|
51
|
+
* objects: {
|
|
52
|
+
* '1': { id: 1, name: 'one', secondOrderId: 15 },
|
|
53
|
+
* '2': { id: 2, name: 'two', secondOrderId: 10 },
|
|
54
|
+
* '3': { id: 3, name: 'three', secondOrderId: 5 },
|
|
55
|
+
* },
|
|
56
|
+
* });
|
|
57
|
+
* const someOtherObjectsSource = reactive({
|
|
58
|
+
* objects: {
|
|
59
|
+
* '5': { id: 5, name: 'five' },
|
|
60
|
+
* '10': { id: 10, name: 'ten' },
|
|
61
|
+
* '15': { id: 15, name: 'fifteen' },
|
|
62
|
+
* },
|
|
63
|
+
* });
|
|
64
|
+
* const objectSubscriptionProps = reactive({
|
|
65
|
+
* crudArgs: { app: 'foo', model: 'bar'},
|
|
66
|
+
* retrieveArgs: {},
|
|
67
|
+
* pk: '99',
|
|
68
|
+
* pkKey: 'id',
|
|
69
|
+
* intendToSubscribe: true,
|
|
70
|
+
* intendToRetreive: true,
|
|
71
|
+
* });
|
|
72
|
+
* const objectSubscription = useObjectSubscription(objectSubscriptionProps);
|
|
73
|
+
* // objectSubscription.state.object like:
|
|
74
|
+
* // {
|
|
75
|
+
* // id: '99',
|
|
76
|
+
* // some_objects_id: '2',
|
|
77
|
+
* // some_objects_list_ids: ['1','2','3'],
|
|
78
|
+
* // }
|
|
79
|
+
* const objectRelatedProps = reactive({
|
|
80
|
+
* parentState: objectSubscription.state,
|
|
81
|
+
* relatedObjectRules: {
|
|
82
|
+
* firstOrder: {
|
|
83
|
+
* pkKey: 'some_objects_id',
|
|
84
|
+
* objects: someObjectsSource.objects,
|
|
85
|
+
* },
|
|
86
|
+
* some_objects_list_ids: {
|
|
87
|
+
* // pkKey defaults to match rule name
|
|
88
|
+
* objects: someObjectsSource.objects,
|
|
89
|
+
* order: ['3','1','2'],
|
|
90
|
+
* },
|
|
91
|
+
* secondOrder: {
|
|
92
|
+
* pkKey: 'relatedObject.secondOrderId',
|
|
93
|
+
* objects: someOtherObjectsSource.objects,
|
|
94
|
+
* },
|
|
95
|
+
* },
|
|
96
|
+
* });
|
|
97
|
+
* const objectRelated = useObjectRelated(objectRelatedProps);
|
|
98
|
+
* </script>
|
|
99
|
+
* <template>
|
|
100
|
+
* <div>
|
|
101
|
+
* <p>{{ objectRelated.state.relatedObject.firstOrder }}</p>
|
|
102
|
+
* <!-- { id: 2, name: 'two', secondOrderId: 10 } -->
|
|
103
|
+
*
|
|
104
|
+
* <p>{{ objectRelated.state.relatedObject.some_objects_list_ids }}</p>
|
|
105
|
+
* <!-- [{ id: 3, name: 'three', secondOrderId: 5 }, { id: 1, name: 'one', secondOrderId: 15 }, { id: 2, name: 'two', secondOrderId: 10 }] -->
|
|
106
|
+
*
|
|
107
|
+
* <p>{{ objectRelated.state.relatedObject.secondOrder }}</p>
|
|
108
|
+
* <!-- { id: 10, name: 'ten' } -->
|
|
109
|
+
* </div>
|
|
110
|
+
* </template>
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @param {ObjectRelatedOptions} options - The options for the object related reactive object.
|
|
114
|
+
* @returns {ObjectRelated} - The object related reactive object.
|
|
115
|
+
*/
|
|
116
|
+
export function useObjectRelated({ parentState, relatedObjectRules }: ObjectRelatedOptions): ObjectRelated;
|
|
117
|
+
/**
|
|
118
|
+
* Vue Composition API composable function for handling reactive relations to other objects.
|
|
119
|
+
*
|
|
120
|
+
* @module use/objectRelated.js
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* The rule for defining relationships for the managed object to other collections of objects.
|
|
124
|
+
*
|
|
125
|
+
* @typedef {object} ObjectRelatedRule
|
|
126
|
+
* @property {string} pkKey - The key in the managed object that corresponds to the key in the related object.
|
|
127
|
+
* @property {import('./listInstance.js').ObjectsByPk} objects - The related objects, indexed by the key in the related object.
|
|
128
|
+
* @property {string[]} order - The order of the related objects, if the related objects are an array.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* The rules for defining relationships for the managed object to other collections of objects.
|
|
132
|
+
*
|
|
133
|
+
* @typedef {{
|
|
134
|
+
* [rule: string]: ObjectRelatedRule,
|
|
135
|
+
* }} ObjectRelatedRawRules
|
|
136
|
+
*/
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
*
|
|
140
|
+
* @typedef {object} ObjectRelatedRawState
|
|
141
|
+
* @property {ObjectRelatedRawRules} relatedObjectRules - The rules for defining relationships for the managed object to other collections of objects.
|
|
142
|
+
* @property {{
|
|
143
|
+
* [rule: string]: import('vue').ComputedRef<any>,
|
|
144
|
+
* }} relatedObject - The related objects, indexed by the key in the related object.
|
|
145
|
+
* @property {boolean} relatedObjectWatchRunning - Whether the related object watch is running.
|
|
146
|
+
* @property {boolean} parentStateObjectWatchRunning - Whether the parent state object watch is running.
|
|
147
|
+
* @property {boolean} relatedRunning - Whether the related objects are loading.
|
|
148
|
+
* @property {boolean} running - Whether the related objects are loading or the parent state is loading.
|
|
149
|
+
*/
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
*
|
|
153
|
+
* @typedef {(
|
|
154
|
+
* import('./objectInstance.js').ObjectInstanceRawState &
|
|
155
|
+
* Partial<import('./objectSubscription.js').ObjectSubscriptionRawState>
|
|
156
|
+
* )} ObjectRelatedParentRawState
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
*
|
|
160
|
+
*
|
|
161
|
+
* @typedef {import('vue').UnwrapNestedRefs<ObjectRelatedParentRawState>} ObjectRelatedParentState
|
|
162
|
+
*/
|
|
163
|
+
/**
|
|
164
|
+
*
|
|
165
|
+
*
|
|
166
|
+
* @typedef {import('vue').UnwrapNestedRefs<(
|
|
167
|
+
* ObjectRelatedParentRawState &
|
|
168
|
+
* ObjectRelatedRawState
|
|
169
|
+
* )>} ObjectRelatedState
|
|
170
|
+
*/
|
|
171
|
+
export const objectRelatedStateKeys: string[];
|
|
172
|
+
export const objectRelatedFunctions: any[];
|
|
173
|
+
export type ObjectRelatedProperties = {
|
|
174
|
+
/**
|
|
175
|
+
* - The state of the object related instance.
|
|
176
|
+
*/
|
|
177
|
+
state: ObjectRelatedState;
|
|
178
|
+
/**
|
|
179
|
+
* - The parent state.
|
|
180
|
+
*/
|
|
181
|
+
parentState: ObjectRelatedParentState;
|
|
182
|
+
/**
|
|
183
|
+
* - The watches running instance.
|
|
184
|
+
*/
|
|
185
|
+
watchesRunning: import("./watchesRunning.js").WatchesRunning;
|
|
186
|
+
/**
|
|
187
|
+
* - The effect scope.
|
|
188
|
+
*/
|
|
189
|
+
effectScope: import("vue").EffectScope;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* An instance of an object related reactive object.
|
|
193
|
+
*/
|
|
194
|
+
export type ObjectRelated = ObjectRelatedProperties;
|
|
195
|
+
/**
|
|
196
|
+
* Non-parent state options for useObjectRelated.
|
|
197
|
+
*/
|
|
198
|
+
export type ObjectRelatedRawProps = {
|
|
199
|
+
/**
|
|
200
|
+
* - The rules for defining relationships for the managed object to other collections of objects.
|
|
201
|
+
*/
|
|
202
|
+
relatedObjectRules: import("vue").Ref<ObjectRelatedRawRules>;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Options for useObjectRelated.
|
|
206
|
+
*/
|
|
207
|
+
export type ObjectRelatedOptions = {
|
|
208
|
+
parentState: ObjectRelatedParentState;
|
|
209
|
+
} & ObjectRelatedRawProps;
|
|
210
|
+
/**
|
|
211
|
+
* The rule for defining relationships for the managed object to other collections of objects.
|
|
212
|
+
*/
|
|
213
|
+
export type ObjectRelatedRule = {
|
|
214
|
+
/**
|
|
215
|
+
* - The key in the managed object that corresponds to the key in the related object.
|
|
216
|
+
*/
|
|
217
|
+
pkKey: string;
|
|
218
|
+
/**
|
|
219
|
+
* - The related objects, indexed by the key in the related object.
|
|
220
|
+
*/
|
|
221
|
+
objects: import("./listInstance.js").ObjectsByPk;
|
|
222
|
+
/**
|
|
223
|
+
* - The order of the related objects, if the related objects are an array.
|
|
224
|
+
*/
|
|
225
|
+
order: string[];
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* The rules for defining relationships for the managed object to other collections of objects.
|
|
229
|
+
*/
|
|
230
|
+
export type ObjectRelatedRawRules = {
|
|
231
|
+
[rule: string]: ObjectRelatedRule;
|
|
232
|
+
};
|
|
233
|
+
export type ObjectRelatedRawState = {
|
|
234
|
+
/**
|
|
235
|
+
* - The rules for defining relationships for the managed object to other collections of objects.
|
|
236
|
+
*/
|
|
237
|
+
relatedObjectRules: ObjectRelatedRawRules;
|
|
238
|
+
/**
|
|
239
|
+
* - The related objects, indexed by the key in the related object.
|
|
240
|
+
*/
|
|
241
|
+
relatedObject: {
|
|
242
|
+
[rule: string]: import("vue").ComputedRef<any>;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* - Whether the related object watch is running.
|
|
246
|
+
*/
|
|
247
|
+
relatedObjectWatchRunning: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* - Whether the parent state object watch is running.
|
|
250
|
+
*/
|
|
251
|
+
parentStateObjectWatchRunning: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* - Whether the related objects are loading.
|
|
254
|
+
*/
|
|
255
|
+
relatedRunning: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* - Whether the related objects are loading or the parent state is loading.
|
|
258
|
+
*/
|
|
259
|
+
running: boolean;
|
|
260
|
+
};
|
|
261
|
+
export type ObjectRelatedParentRawState = (import("./objectInstance.js").ObjectInstanceRawState & Partial<import("./objectSubscription.js").ObjectSubscriptionRawState>);
|
|
262
|
+
export type ObjectRelatedParentState = import("vue").UnwrapNestedRefs<ObjectRelatedParentRawState>;
|
|
263
|
+
export type ObjectRelatedState = import("vue").UnwrapNestedRefs<(ObjectRelatedParentRawState & ObjectRelatedRawState)>;
|
|
264
|
+
//# sourceMappingURL=objectRelated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectRelated.d.ts","sourceRoot":"","sources":["../../use/objectRelated.js"],"names":[],"mappings":"AAwFA;;;;;;;GAOG;AAIH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,qDAPW;IACV,CAAO,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAA;CACtC,GACS;IACZ,CAAO,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAC/B,CASH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,sEAHW,oBAAoB,GAClB,aAAa,CAqIzB;AAzUD;;;;GAIG;AAGH;;;;;;;GAOG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;;;;GAOG;AAEH,8CAOE;AAEF,2CAAyC;;;;;WAI3B,kBAAkB;;;;iBAClB,wBAAwB;;;;oBACxB,OAAO,qBAAqB,EAAE,cAAc;;;;iBAC5C,OAAO,KAAK,EAAE,WAAW;;;;;4BAS1B,uBAAuB;;;;;;;;wBAOtB,OAAO,KAAK,EAAE,GAAG,CAAC,qBAAqB,CAAC;;;;;mCAMzC;IACN,WAAW,EAAE,wBAAwB,CAAC;CACzC,GAAG,qBAAqB;;;;;;;;WA3Fd,MAAM;;;;aACN,OAAO,mBAAmB,EAAE,WAAW;;;;WACvC,MAAM,EAAE;;;;;oCAMT;IACZ,CAAO,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACrC;;;;;wBAOU,qBAAqB;;;;mBACrB;QACb,CAAO,IAAI,EAAE,MAAM,GAAG,OAAO,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;KAClD;;;;+BACU,OAAO;;;;mCACP,OAAO;;;;oBACP,OAAO;;;;aACP,OAAO;;0CAMR,CACZ,OAAY,qBAAqB,EAAE,sBAAsB,GACpD,OAAO,CAAC,OAAO,yBAAyB,EAAE,0BAA0B,CAAC,CACvE;uCAMS,OAAO,KAAK,EAAE,gBAAgB,CAAC,2BAA2B,CAAC;iCAM3D,OAAO,KAAK,EAAE,gBAAgB,CAAC,CACrC,2BAA2B,GAC3B,qBAAqB,CACxB,CAAC"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The raw state of the object subscription.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {object} ObjectSubscriptionRawState
|
|
5
|
+
* @property {Readonly<import('vue').Ref<boolean>>} subscriptionLoading - Whether the subscription is loading.
|
|
6
|
+
* @property {Readonly<import('vue').Ref<boolean>>} subscriptionErrored - Whether the subscription has errored.
|
|
7
|
+
* @property {Readonly<import('vue').Ref<Error>>} subscriptionError - The error that occurred.
|
|
8
|
+
* @property {boolean} intendToRetrieve - Whether the object intends to retrieve.
|
|
9
|
+
* @property {boolean} intendToSubscribe - Whether the object intends to subscribe.
|
|
10
|
+
* @property {boolean} subscribed - Whether the object is subscribed.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The state of the object subscription, including both subscription and object instance states.
|
|
14
|
+
*
|
|
15
|
+
* @typedef {import('vue').UnwrapNestedRefs<
|
|
16
|
+
* ObjectSubscriptionRawState &
|
|
17
|
+
* import('./objectInstance.js').ObjectInstanceRawState
|
|
18
|
+
* >} ObjectSubscriptionState
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Functions available for object subscription management.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {object} ObjectSubscriptionFunctions
|
|
24
|
+
* @property {({ retrieve }?: { retrieve?: boolean }) => boolean} subscribe - Subscribes to updates from an object, managing subscription state and
|
|
25
|
+
* handling errors internally. Ensures that only one active subscription can exist at a time to prevent duplicate
|
|
26
|
+
* calls. Returns a promise that resolves to true if the subscription was successful, and false if it failed.
|
|
27
|
+
* @property {() => boolean} unsubscribe - Unsubscribes from the object, resetting related state flags. Returns
|
|
28
|
+
* true if the object was unsubscribed, and false if it was not subscribed.
|
|
29
|
+
* @property {(data: import('./objectInstance.js').CrudObject) => void} updateFromSubscription - Update the object from a subscription.
|
|
30
|
+
* @property {() => void} deleteFromSubscription - Delete the object from a subscription.
|
|
31
|
+
* @property {() => void} clearError - Clears any errors related to the subscription, and resets the loading state.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Properties of the object subscription.
|
|
35
|
+
*
|
|
36
|
+
* @typedef {object} ObjectSubscriptionProperties
|
|
37
|
+
* @property {ObjectSubscriptionState} state - The object instance properties.
|
|
38
|
+
* @property {import('./objectInstance.js').ObjectInstance} objectInstance - The object instance.
|
|
39
|
+
* @property {import('./cancellableIntent.js').CancellableIntent} subscribeIntent - The subscribe intent.
|
|
40
|
+
* @property {import('./cancellableIntent.js').CancellableIntent} retrieveIntent - The retrieve intent.
|
|
41
|
+
* @property {import('vue').EffectScope} effectScope - The effect scope.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* The object subscription instance, combining state, properties, and functions.
|
|
45
|
+
*
|
|
46
|
+
* @typedef {ObjectSubscriptionProperties & ObjectSubscriptionFunctions} ObjectSubscription
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Raw props for the object subscription.
|
|
50
|
+
*
|
|
51
|
+
* @typedef {object} ObjectSubscriptionRawProps
|
|
52
|
+
* @property {boolean} [intendToRetrieve] - Whether the object intends to retrieve.
|
|
53
|
+
* @property {boolean} [intendToSubscribe] - Whether the object intends to subscribe.
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Options for initializing an object subscription, including reactive props and non-reactive functions.
|
|
57
|
+
*
|
|
58
|
+
* @typedef {object & import('./objectInstance.js').ObjectInstanceOptions} ObjectSubscriptionOptions
|
|
59
|
+
* @property {import('./objectInstance.js').ObjectInstance} [objectInstance] - An object instance to use instead of creating a new one.
|
|
60
|
+
* @property {import('vue').UnwrapNestedRefs<(
|
|
61
|
+
* ObjectSubscriptionRawProps & import('./objectInstance.js').ObjectInstanceRawProps
|
|
62
|
+
* )>} props - The reactive args to be passed to useObjectInstance.
|
|
63
|
+
* @property {import('./objectInstance.js').ObjectInstanceFunctions} [functions] - The functions to be passed to useObjectInstance.
|
|
64
|
+
*/
|
|
65
|
+
/**
|
|
66
|
+
* Initializes multiple object subscriptions based on provided arguments.
|
|
67
|
+
*
|
|
68
|
+
* @param {{[key: string]: ObjectSubscriptionOptions}} subscriptionArgs - Arguments for initializing object subscriptions.
|
|
69
|
+
* @returns {{[key: string]: ObjectSubscription}} - An object containing the initialized object subscriptions.
|
|
70
|
+
*/
|
|
71
|
+
export function useObjectSubscriptions(subscriptionArgs: {
|
|
72
|
+
[key: string]: ObjectSubscriptionOptions;
|
|
73
|
+
}): {
|
|
74
|
+
[key: string]: ObjectSubscription;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Initializes an object subscription to manage object state and reactivity, including subscription status and errors.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```
|
|
81
|
+
* <script setup>
|
|
82
|
+
* import { useObjectSubscription } from "@arrai-innovations/reactive-helpers";
|
|
83
|
+
* import { reactive, ref, toRef } from "vue";
|
|
84
|
+
*
|
|
85
|
+
* const pkKey = "id";
|
|
86
|
+
* const props = defineProps({
|
|
87
|
+
* app: { type: String, required: true },
|
|
88
|
+
* model: { type: String, required: true },
|
|
89
|
+
* pk: { type: String, default: "" },
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* const objectSubscriptionProps = reactive({
|
|
93
|
+
* crudArgs: {
|
|
94
|
+
* app: toRef(props, "app"),
|
|
95
|
+
* model: toRef(props, "model"),
|
|
96
|
+
* },
|
|
97
|
+
* pk: toRef(props, "pk"),
|
|
98
|
+
* pkKey: pkKey,
|
|
99
|
+
* retrieveArgs: {
|
|
100
|
+
* fields: ['foo', 'bar'],
|
|
101
|
+
* },
|
|
102
|
+
* intendToRetrieve: false,
|
|
103
|
+
* intendToSubscribe: false,
|
|
104
|
+
* });
|
|
105
|
+
* objectSubscriptionProps.intendToRetrieve = objectSubscriptionProps.intendToSubscribe = computed(()=> !!props.pk);
|
|
106
|
+
* const objectSubscription = useObjectSubscription(objectSubscriptionProps);
|
|
107
|
+
* </script>
|
|
108
|
+
* <template>
|
|
109
|
+
* <div v-if="objectSubscription.state.loading">Loading...</div>
|
|
110
|
+
* <div v-else-if="objectSubscription.state.errored">Error: {{ objectSubscription.state.error.message }}</div>
|
|
111
|
+
* <div v-else-if="objectSubscription.state.object[pkKey]">Foo: {{ objectSubscription.state.object.foo }}</div>
|
|
112
|
+
* <div v-else>Object not found.</div>
|
|
113
|
+
* </template>
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @param {ObjectSubscriptionOptions} options - Options for initializing the object subscription.
|
|
117
|
+
* @returns {ObjectSubscription} - An object containing the subscription state, properties, and functions.
|
|
118
|
+
*/
|
|
119
|
+
export function useObjectSubscription({ objectInstance, props, functions }: ObjectSubscriptionOptions): ObjectSubscription;
|
|
120
|
+
/**
|
|
121
|
+
* A composition function for managing object subscriptions, including subscription status, errors, and reactivity.
|
|
122
|
+
*
|
|
123
|
+
* @module use/objectSubscription.js
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* Custom error for handling issues related to object subscriptions.
|
|
127
|
+
*/
|
|
128
|
+
export class ObjectSubscriptionError extends Error {
|
|
129
|
+
/**
|
|
130
|
+
* Create a new ObjectSubscriptionError.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} message - The error message.
|
|
133
|
+
* @param {string} code - The error code.
|
|
134
|
+
*/
|
|
135
|
+
constructor(message: string, code: string);
|
|
136
|
+
code: string;
|
|
137
|
+
}
|
|
138
|
+
export const objectSubscriptionStateKeys: string[];
|
|
139
|
+
export const objectSubscriptionFunctions: string[];
|
|
140
|
+
/**
|
|
141
|
+
* The raw state of the object subscription.
|
|
142
|
+
*/
|
|
143
|
+
export type ObjectSubscriptionRawState = {
|
|
144
|
+
/**
|
|
145
|
+
* - Whether the subscription is loading.
|
|
146
|
+
*/
|
|
147
|
+
subscriptionLoading: Readonly<import("vue").Ref<boolean>>;
|
|
148
|
+
/**
|
|
149
|
+
* - Whether the subscription has errored.
|
|
150
|
+
*/
|
|
151
|
+
subscriptionErrored: Readonly<import("vue").Ref<boolean>>;
|
|
152
|
+
/**
|
|
153
|
+
* - The error that occurred.
|
|
154
|
+
*/
|
|
155
|
+
subscriptionError: Readonly<import("vue").Ref<Error>>;
|
|
156
|
+
/**
|
|
157
|
+
* - Whether the object intends to retrieve.
|
|
158
|
+
*/
|
|
159
|
+
intendToRetrieve: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* - Whether the object intends to subscribe.
|
|
162
|
+
*/
|
|
163
|
+
intendToSubscribe: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* - Whether the object is subscribed.
|
|
166
|
+
*/
|
|
167
|
+
subscribed: boolean;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* The state of the object subscription, including both subscription and object instance states.
|
|
171
|
+
*/
|
|
172
|
+
export type ObjectSubscriptionState = import("vue").UnwrapNestedRefs<ObjectSubscriptionRawState & import("./objectInstance.js").ObjectInstanceRawState>;
|
|
173
|
+
/**
|
|
174
|
+
* Functions available for object subscription management.
|
|
175
|
+
*/
|
|
176
|
+
export type ObjectSubscriptionFunctions = {
|
|
177
|
+
/**
|
|
178
|
+
* - Subscribes to updates from an object, managing subscription state and
|
|
179
|
+
* handling errors internally. Ensures that only one active subscription can exist at a time to prevent duplicate
|
|
180
|
+
* calls. Returns a promise that resolves to true if the subscription was successful, and false if it failed.
|
|
181
|
+
*/
|
|
182
|
+
subscribe: ({ retrieve }?: {
|
|
183
|
+
retrieve?: boolean;
|
|
184
|
+
}) => boolean;
|
|
185
|
+
/**
|
|
186
|
+
* - Unsubscribes from the object, resetting related state flags. Returns
|
|
187
|
+
* true if the object was unsubscribed, and false if it was not subscribed.
|
|
188
|
+
*/
|
|
189
|
+
unsubscribe: () => boolean;
|
|
190
|
+
/**
|
|
191
|
+
* - Update the object from a subscription.
|
|
192
|
+
*/
|
|
193
|
+
updateFromSubscription: (data: import("./objectInstance.js").CrudObject) => void;
|
|
194
|
+
/**
|
|
195
|
+
* - Delete the object from a subscription.
|
|
196
|
+
*/
|
|
197
|
+
deleteFromSubscription: () => void;
|
|
198
|
+
/**
|
|
199
|
+
* - Clears any errors related to the subscription, and resets the loading state.
|
|
200
|
+
*/
|
|
201
|
+
clearError: () => void;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Properties of the object subscription.
|
|
205
|
+
*/
|
|
206
|
+
export type ObjectSubscriptionProperties = {
|
|
207
|
+
/**
|
|
208
|
+
* - The object instance properties.
|
|
209
|
+
*/
|
|
210
|
+
state: ObjectSubscriptionState;
|
|
211
|
+
/**
|
|
212
|
+
* - The object instance.
|
|
213
|
+
*/
|
|
214
|
+
objectInstance: import("./objectInstance.js").ObjectInstance;
|
|
215
|
+
/**
|
|
216
|
+
* - The subscribe intent.
|
|
217
|
+
*/
|
|
218
|
+
subscribeIntent: import("./cancellableIntent.js").CancellableIntent;
|
|
219
|
+
/**
|
|
220
|
+
* - The retrieve intent.
|
|
221
|
+
*/
|
|
222
|
+
retrieveIntent: import("./cancellableIntent.js").CancellableIntent;
|
|
223
|
+
/**
|
|
224
|
+
* - The effect scope.
|
|
225
|
+
*/
|
|
226
|
+
effectScope: import("vue").EffectScope;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* The object subscription instance, combining state, properties, and functions.
|
|
230
|
+
*/
|
|
231
|
+
export type ObjectSubscription = ObjectSubscriptionProperties & ObjectSubscriptionFunctions;
|
|
232
|
+
/**
|
|
233
|
+
* Raw props for the object subscription.
|
|
234
|
+
*/
|
|
235
|
+
export type ObjectSubscriptionRawProps = {
|
|
236
|
+
/**
|
|
237
|
+
* - Whether the object intends to retrieve.
|
|
238
|
+
*/
|
|
239
|
+
intendToRetrieve?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* - Whether the object intends to subscribe.
|
|
242
|
+
*/
|
|
243
|
+
intendToSubscribe?: boolean;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Options for initializing an object subscription, including reactive props and non-reactive functions.
|
|
247
|
+
*/
|
|
248
|
+
export type ObjectSubscriptionOptions = object & import("./objectInstance.js").ObjectInstanceOptions;
|
|
249
|
+
//# sourceMappingURL=objectSubscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectSubscription.d.ts","sourceRoot":"","sources":["../../use/objectSubscription.js"],"names":[],"mappings":"AA+CA;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AAGH;;;;;;;;;;;;GAYG;AAGH;;;;;;;;;GASG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,yDAHW;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAA;CAAC,GACxC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAA;CAAC,CAS/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,4EAHW,yBAAyB,GACvB,kBAAkB,CA6M9B;AAtXD;;;;GAIG;AAEH;;GAEG;AACH;IACI;;;;;OAKG;IACH,qBAHW,MAAM,QACN,MAAM,EAMhB;IADG,aAAgB;CAEvB;AAED,mDAOE;AAEF,mDAME;;;;;;;;yBAMY,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;yBACpC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;uBACpC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;;;;sBAClC,OAAO;;;;uBACP,OAAO;;;;gBACP,OAAO;;;;;sCAMR,OAAO,KAAK,EAAE,gBAAgB,CACpC,0BAA0B,GAChC,OAAa,qBAAqB,EAAE,sBAAsB,CACvD;;;;;;;;;;eAQU,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO;;;;;iBAGlD,MAAM,OAAO;;;;4BAEb,CAAC,IAAI,EAAE,OAAO,qBAAqB,EAAE,UAAU,KAAK,IAAI;;;;4BACxD,MAAM,IAAI;;;;gBACV,MAAM,IAAI;;;;;;;;;WAQV,uBAAuB;;;;oBACvB,OAAO,qBAAqB,EAAE,cAAc;;;;qBAC5C,OAAO,wBAAwB,EAAE,iBAAiB;;;;oBAClD,OAAO,wBAAwB,EAAE,iBAAiB;;;;iBAClD,OAAO,KAAK,EAAE,WAAW;;;;;iCAM1B,4BAA4B,GAAG,2BAA2B;;;;;;;;uBAOzD,OAAO;;;;wBACP,OAAO;;;;;wCAMR,MAAM,GAAG,OAAO,qBAAqB,EAAE,qBAAqB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module use/paginatedListInstance.js
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} PagedListListanceOptions
|
|
7
|
+
* @property {boolean} keepOldPages - Whether to keep old pages.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {object} PagedListInstanceState
|
|
11
|
+
* @property {number} totalRecords - The total records.
|
|
12
|
+
* @property {number} totalPages - The total pages.
|
|
13
|
+
* @property {number} perPage - The per page.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} PagedListInstance
|
|
17
|
+
* @property {import('./listInstance.js').ListInstanceState & PagedListInstanceState} state - The state.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {PagedListListanceOptions & import('./listInstance.js').ListInstanceOptions} options - The options.
|
|
22
|
+
* @returns {PagedListInstance} - The paged list instance.
|
|
23
|
+
*/
|
|
24
|
+
export function usePagedListInstance({ keepOldPages, ...useListInstanceArgs }: PagedListListanceOptions & import("./listInstance.js").ListInstanceOptions): PagedListInstance;
|
|
25
|
+
export type PagedListListanceOptions = {
|
|
26
|
+
/**
|
|
27
|
+
* - Whether to keep old pages.
|
|
28
|
+
*/
|
|
29
|
+
keepOldPages: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type PagedListInstanceState = {
|
|
32
|
+
/**
|
|
33
|
+
* - The total records.
|
|
34
|
+
*/
|
|
35
|
+
totalRecords: number;
|
|
36
|
+
/**
|
|
37
|
+
* - The total pages.
|
|
38
|
+
*/
|
|
39
|
+
totalPages: number;
|
|
40
|
+
/**
|
|
41
|
+
* - The per page.
|
|
42
|
+
*/
|
|
43
|
+
perPage: number;
|
|
44
|
+
};
|
|
45
|
+
export type PagedListInstance = {
|
|
46
|
+
/**
|
|
47
|
+
* - The state.
|
|
48
|
+
*/
|
|
49
|
+
state: import("./listInstance.js").ListInstanceState & PagedListInstanceState;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=paginatedListInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginatedListInstance.d.ts","sourceRoot":"","sources":["../../use/paginatedListInstance.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;GAGG;AAEH;;;;GAIG;AACH,+EAHW,wBAAwB,GAAG,OAAO,mBAAmB,EAAE,mBAAmB,GACxE,iBAAiB,CA+C7B;;;;;kBAjEa,OAAO;;;;;;kBAKP,MAAM;;;;gBACN,MAAM;;;;aACN,MAAM;;;;;;WAKN,OAAO,mBAAmB,EAAE,iBAAiB,GAAG,sBAAsB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {(
|
|
3
|
+
* import('./loadingError.js').LoadingErrorStatus[]
|
|
4
|
+
* )} WatchableLoadingErrorsRaw
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A watchable collection of loading errors.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {(
|
|
10
|
+
* import('vue').UnwrapNestedRefs<WatchableLoadingErrorsRaw> |
|
|
11
|
+
* import('vue').Ref<WatchableLoadingErrorsRaw> |
|
|
12
|
+
* WatchableLoadingErrorsRaw
|
|
13
|
+
* )} WatchableLoadingErrors
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The instance of useProxyLoadingError.
|
|
17
|
+
*
|
|
18
|
+
* @typedef {import('./loadingError.js').LoadingErrorStatus} ProxyLoadingError
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* A composable function for managing aggregated loading and error states across multiple sources.
|
|
22
|
+
*
|
|
23
|
+
* @param {WatchableLoadingErrors} loadingErrors - A collection of loading error statuses to monitor and aggregate.
|
|
24
|
+
* @returns {ProxyLoadingError} An object containing aggregated reactive fields and actions for loading and error states.
|
|
25
|
+
*/
|
|
26
|
+
export function useProxyLoadingError(loadingErrors: WatchableLoadingErrors): ProxyLoadingError;
|
|
27
|
+
export type WatchableLoadingErrorsRaw = (import("./loadingError.js").LoadingErrorStatus[]);
|
|
28
|
+
/**
|
|
29
|
+
* A watchable collection of loading errors.
|
|
30
|
+
*/
|
|
31
|
+
export type WatchableLoadingErrors = (import("vue").UnwrapNestedRefs<WatchableLoadingErrorsRaw> | import("vue").Ref<WatchableLoadingErrorsRaw> | WatchableLoadingErrorsRaw);
|
|
32
|
+
/**
|
|
33
|
+
* The instance of useProxyLoadingError.
|
|
34
|
+
*/
|
|
35
|
+
export type ProxyLoadingError = import("./loadingError.js").LoadingErrorStatus;
|
|
36
|
+
//# sourceMappingURL=proxyLoadingError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxyLoadingError.d.ts","sourceRoot":"","sources":["../../use/proxyLoadingError.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AACH,oDAHW,sBAAsB,GACpB,iBAAiB,CA6B7B;wCAtDY,CACZ,OAAa,mBAAmB,EAAE,kBAAkB,EAAE,CACnD;;;;qCAMS,CACZ,OAAa,KAAK,EAAE,gBAAgB,CAAC,yBAAyB,CAAC,GAC/D,OAAa,KAAK,EAAE,GAAG,CAAC,yBAAyB,CAAC,GAC5C,yBAAyB,CAC5B;;;;gCAMS,OAAO,mBAAmB,EAAE,kBAAkB"}
|