@ram_28/kf-ai-sdk 1.0.11 → 1.0.13
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/README.md +55 -48
- package/dist/api/client.d.ts +14 -14
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/datetime.d.ts +5 -5
- package/dist/api/datetime.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/metadata.d.ts +2 -2
- package/dist/api/metadata.d.ts.map +1 -1
- package/dist/api.cjs +1 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.mjs +27 -0
- package/dist/api.types.cjs +1 -0
- package/dist/api.types.d.ts +4 -0
- package/dist/api.types.d.ts.map +1 -0
- package/dist/api.types.mjs +1 -0
- package/dist/auth/AuthProvider.d.ts +3 -3
- package/dist/auth/AuthProvider.d.ts.map +1 -1
- package/dist/auth/authClient.d.ts +4 -4
- package/dist/auth/authClient.d.ts.map +1 -1
- package/dist/auth/authConfig.d.ts +5 -5
- package/dist/auth/authConfig.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/types.d.ts +21 -21
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/useAuth.d.ts +2 -2
- package/dist/auth/useAuth.d.ts.map +1 -1
- package/dist/auth.cjs +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.mjs +280 -0
- package/dist/auth.types.cjs +1 -0
- package/dist/auth.types.d.ts +2 -0
- package/dist/auth.types.d.ts.map +1 -0
- package/dist/auth.types.mjs +1 -0
- package/dist/base-types.d.ts +2 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/client-C15j4O5B.cjs +1 -0
- package/dist/client-CfvLiGfP.js +233 -0
- package/dist/cn-Dr87sK3i.js +2775 -0
- package/dist/cn-mXUIg4vp.cjs +1 -0
- package/dist/components/hooks/index.d.ts +3 -3
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/index.d.ts +2 -2
- package/dist/components/hooks/useFilter/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/types.d.ts +19 -31
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts +2 -2
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts +6 -6
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/index.d.ts +5 -5
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts +10 -10
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts +7 -12
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +67 -76
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +2 -2
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/apiClient.d.ts +16 -16
- package/dist/components/hooks/useKanban/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/context.d.ts +3 -3
- package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/dragDropManager.d.ts +7 -7
- package/dist/components/hooks/useKanban/dragDropManager.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/index.d.ts +1 -1
- package/dist/components/hooks/useKanban/index.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/types.d.ts +65 -67
- package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/useKanban.d.ts +2 -2
- package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
- package/dist/components/hooks/useTable/index.d.ts +1 -1
- package/dist/components/hooks/useTable/index.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +10 -10
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts +2 -2
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/filter.cjs +1 -0
- package/dist/filter.d.ts +3 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.mjs +6 -0
- package/dist/filter.types.cjs +1 -0
- package/dist/filter.types.d.ts +2 -0
- package/dist/filter.types.d.ts.map +1 -0
- package/dist/filter.types.mjs +1 -0
- package/dist/form.cjs +1 -0
- package/dist/form.d.ts +3 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.mjs +2355 -0
- package/dist/form.types.cjs +1 -0
- package/dist/form.types.d.ts +2 -0
- package/dist/form.types.d.ts.map +1 -0
- package/dist/form.types.mjs +1 -0
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/jsx-runtime-DGlMoOmv.js +630 -0
- package/dist/kanban.cjs +13 -0
- package/dist/kanban.d.ts +5 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.mjs +1060 -0
- package/dist/kanban.types.cjs +1 -0
- package/dist/kanban.types.d.ts +2 -0
- package/dist/kanban.types.d.ts.map +1 -0
- package/dist/kanban.types.mjs +1 -0
- package/dist/kanban.ui.cjs +1 -0
- package/dist/kanban.ui.d.ts +2 -0
- package/dist/kanban.ui.d.ts.map +1 -0
- package/dist/kanban.ui.mjs +104 -0
- package/dist/metadata-2FLBsFcf.cjs +1 -0
- package/dist/metadata-DBcoDth-.js +43 -0
- package/dist/table.cjs +1 -0
- package/dist/table.d.ts +2 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.mjs +148 -0
- package/dist/table.types.cjs +1 -0
- package/dist/table.types.d.ts +2 -0
- package/dist/table.types.d.ts.map +1 -0
- package/dist/table.types.mjs +1 -0
- package/dist/types/base-fields.d.ts +45 -45
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/common.d.ts +45 -61
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.mjs +1 -0
- package/dist/useFilter-CXFqEHyI.js +129 -0
- package/dist/useFilter-D-bCDo6Z.cjs +1 -0
- package/dist/useQuery-BScHEo7x.cjs +1 -0
- package/dist/useQuery-KpZFg80c.js +748 -0
- package/dist/utils/formatting.d.ts +4 -4
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils.cjs +4 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.mjs +105 -0
- package/package.json +147 -9
- package/sdk/api/client.ts +51 -51
- package/sdk/api/datetime.ts +5 -5
- package/sdk/api/index.ts +28 -33
- package/sdk/api/metadata.ts +4 -4
- package/sdk/api.ts +24 -0
- package/sdk/api.types.ts +58 -0
- package/sdk/auth/AuthProvider.tsx +18 -18
- package/sdk/auth/authClient.ts +9 -9
- package/sdk/auth/authConfig.ts +9 -9
- package/sdk/auth/index.ts +5 -5
- package/sdk/auth/types.ts +21 -21
- package/sdk/auth/useAuth.ts +2 -2
- package/sdk/auth.ts +22 -0
- package/sdk/auth.types.ts +28 -0
- package/sdk/base-types.ts +45 -0
- package/sdk/components/hooks/index.ts +22 -22
- package/sdk/components/hooks/useFilter/index.ts +8 -14
- package/sdk/components/hooks/useFilter/types.ts +29 -58
- package/sdk/components/hooks/useFilter/useFilter.ts +41 -44
- package/sdk/components/hooks/useForm/apiClient.ts +8 -8
- package/sdk/components/hooks/useForm/expressionValidator.utils.ts +18 -18
- package/sdk/components/hooks/useForm/index.ts +24 -24
- package/sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts +22 -22
- package/sdk/components/hooks/useForm/ruleClassifier.utils.ts +26 -62
- package/sdk/components/hooks/useForm/schemaParser.utils.ts +24 -24
- package/sdk/components/hooks/useForm/types.ts +66 -82
- package/sdk/components/hooks/useForm/useForm.ts +15 -21
- package/sdk/components/hooks/useKanban/apiClient.ts +54 -54
- package/sdk/components/hooks/useKanban/context.ts +3 -3
- package/sdk/components/hooks/useKanban/dragDropManager.ts +19 -19
- package/sdk/components/hooks/useKanban/index.ts +26 -26
- package/sdk/components/hooks/useKanban/types.ts +69 -71
- package/sdk/components/hooks/useKanban/useKanban.ts +43 -51
- package/sdk/components/hooks/useKanban/useKanbanSimple.ts +4 -4
- package/sdk/components/hooks/useTable/index.ts +5 -1
- package/sdk/components/hooks/useTable/types.ts +10 -10
- package/sdk/components/hooks/useTable/useTable.ts +10 -10
- package/sdk/filter.ts +13 -0
- package/sdk/filter.types.ts +17 -0
- package/sdk/form.ts +15 -0
- package/sdk/form.types.ts +46 -0
- package/sdk/kanban.ts +23 -0
- package/sdk/kanban.types.ts +50 -0
- package/sdk/kanban.ui.ts +16 -0
- package/sdk/table.ts +7 -0
- package/sdk/table.types.ts +13 -0
- package/sdk/types/base-fields.ts +47 -47
- package/sdk/types/common.ts +47 -71
- package/sdk/types/index.ts +1 -1
- package/sdk/utils/formatting.ts +4 -4
- package/sdk/utils.ts +10 -0
- package/dist/index.cjs +0 -45
- package/dist/index.mjs +0 -6387
package/dist/types/common.d.ts
CHANGED
|
@@ -1,93 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sort direction for API queries (matching API spec)
|
|
3
3
|
*/
|
|
4
|
-
export type
|
|
4
|
+
export type SortDirectionType = "ASC" | "DESC";
|
|
5
5
|
/**
|
|
6
6
|
* Sort configuration: array of field-direction mappings
|
|
7
7
|
* Format: [{ "fieldName": "ASC" }, { "anotherField": "DESC" }]
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type SortOptionType = Record<string, SortDirectionType>;
|
|
10
10
|
/**
|
|
11
11
|
* Sort configuration: array of sort options
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type SortType = SortOptionType[];
|
|
14
14
|
/**
|
|
15
15
|
* Condition operators for individual conditions (leaf nodes)
|
|
16
16
|
* Used in Condition.Operator
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
18
|
+
export type ConditionOperatorType = "EQ" | "NE" | "GT" | "GTE" | "LT" | "LTE" | "Between" | "NotBetween" | "IN" | "NIN" | "Empty" | "NotEmpty" | "Contains" | "NotContains" | "MinLength" | "MaxLength";
|
|
19
19
|
/**
|
|
20
20
|
* Operators for combining conditions in a group (tree nodes)
|
|
21
21
|
* Used in ConditionGroup.Operator
|
|
22
22
|
*/
|
|
23
|
-
export type
|
|
23
|
+
export type ConditionGroupOperatorType = "And" | "Or" | "Not";
|
|
24
24
|
/**
|
|
25
25
|
* RHS value type for filter conditions
|
|
26
26
|
*/
|
|
27
|
-
export type
|
|
27
|
+
export type FilterRHSTypeType = "Constant" | "BOField" | "AppVariable";
|
|
28
28
|
/**
|
|
29
29
|
* Leaf condition (actual field comparison)
|
|
30
30
|
*/
|
|
31
|
-
export interface
|
|
31
|
+
export interface ConditionType {
|
|
32
32
|
/** Optional ID for hook state management (omitted in API payload) */
|
|
33
33
|
id?: string;
|
|
34
34
|
/** Condition operator */
|
|
35
|
-
Operator:
|
|
35
|
+
Operator: ConditionOperatorType;
|
|
36
36
|
/** Left-hand side field name */
|
|
37
37
|
LHSField: string;
|
|
38
38
|
/** Right-hand side value */
|
|
39
39
|
RHSValue: any;
|
|
40
40
|
/** Right-hand side type (optional, defaults to Constant) */
|
|
41
|
-
RHSType?:
|
|
41
|
+
RHSType?: FilterRHSTypeType;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Group combining conditions (recursive structure)
|
|
45
45
|
*/
|
|
46
|
-
export interface
|
|
46
|
+
export interface ConditionGroupType {
|
|
47
47
|
/** Optional ID for hook state management (omitted in API payload) */
|
|
48
48
|
id?: string;
|
|
49
49
|
/** Group operator (And, Or, Not) */
|
|
50
|
-
Operator:
|
|
50
|
+
Operator: ConditionGroupOperatorType;
|
|
51
51
|
/** Nested conditions (can be Condition or ConditionGroup) */
|
|
52
|
-
Condition: Array<
|
|
52
|
+
Condition: Array<ConditionType | ConditionGroupType>;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Root filter type (alias for ConditionGroup)
|
|
56
56
|
*/
|
|
57
|
-
export type
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated Use `Condition` instead
|
|
60
|
-
*/
|
|
61
|
-
export type FilterCondition = Condition;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated Use `ConditionGroup` instead
|
|
64
|
-
*/
|
|
65
|
-
export type FilterLogical = ConditionGroup;
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated Use `ConditionGroupOperator` instead
|
|
68
|
-
*/
|
|
69
|
-
export type FilterOperator = ConditionGroupOperator;
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated Use `Condition | ConditionGroup` instead
|
|
72
|
-
*/
|
|
73
|
-
export type FilterNode = Condition | ConditionGroup;
|
|
57
|
+
export type FilterType = ConditionGroupType;
|
|
74
58
|
/**
|
|
75
59
|
* DateTime encoding format used by the API
|
|
76
60
|
*/
|
|
77
|
-
export interface
|
|
61
|
+
export interface DateTimeEncodedType {
|
|
78
62
|
$__dt__: number;
|
|
79
63
|
}
|
|
80
64
|
/**
|
|
81
65
|
* Date encoding format used by the API
|
|
82
66
|
*/
|
|
83
|
-
export interface
|
|
67
|
+
export interface DateEncodedType {
|
|
84
68
|
$__d__: string;
|
|
85
69
|
}
|
|
86
70
|
/**
|
|
87
71
|
* Standard paginated list response
|
|
88
72
|
* @template T - Type of items in the list
|
|
89
73
|
*/
|
|
90
|
-
export interface
|
|
74
|
+
export interface ListResponseType<T> {
|
|
91
75
|
/** Array of items for current page */
|
|
92
76
|
Data: T[];
|
|
93
77
|
}
|
|
@@ -95,43 +79,43 @@ export interface ListResponse<T> {
|
|
|
95
79
|
* Read API response wrapper
|
|
96
80
|
* @template T - Type of the data object
|
|
97
81
|
*/
|
|
98
|
-
export interface
|
|
82
|
+
export interface ReadResponseType<T> {
|
|
99
83
|
/** The data object */
|
|
100
84
|
Data: T;
|
|
101
85
|
}
|
|
102
86
|
/**
|
|
103
87
|
* Create/Update API response
|
|
104
88
|
*/
|
|
105
|
-
export interface
|
|
89
|
+
export interface CreateUpdateResponseType {
|
|
106
90
|
/** ID of the created/updated record */
|
|
107
91
|
_id: string;
|
|
108
92
|
}
|
|
109
93
|
/**
|
|
110
94
|
* Delete API response
|
|
111
95
|
*/
|
|
112
|
-
export interface
|
|
96
|
+
export interface DeleteResponseType {
|
|
113
97
|
/** Status of the delete operation */
|
|
114
98
|
status: "success";
|
|
115
99
|
}
|
|
116
100
|
/**
|
|
117
101
|
* Count API response
|
|
118
102
|
*/
|
|
119
|
-
export interface
|
|
103
|
+
export interface CountResponseType {
|
|
120
104
|
/** Total count of matching records */
|
|
121
105
|
Count: number;
|
|
122
106
|
}
|
|
123
107
|
/**
|
|
124
108
|
* Options for list queries (API request format)
|
|
125
109
|
*/
|
|
126
|
-
export interface
|
|
110
|
+
export interface ListOptionsType {
|
|
127
111
|
/** Query type (defaults to "List") */
|
|
128
112
|
Type?: "List";
|
|
129
113
|
/** Specific fields to return */
|
|
130
114
|
Field?: string[];
|
|
131
115
|
/** Filter criteria */
|
|
132
|
-
Filter?:
|
|
116
|
+
Filter?: FilterType;
|
|
133
117
|
/** Sort configuration */
|
|
134
|
-
Sort?:
|
|
118
|
+
Sort?: SortType;
|
|
135
119
|
/** Search query (separate from filters) */
|
|
136
120
|
Search?: string;
|
|
137
121
|
/** Page number (1-indexed) */
|
|
@@ -142,60 +126,60 @@ export interface ListOptions {
|
|
|
142
126
|
/**
|
|
143
127
|
* Metric aggregation function types
|
|
144
128
|
*/
|
|
145
|
-
export type
|
|
129
|
+
export type MetricTypeType = "Sum" | "Avg" | "Count" | "Max" | "Min" | "DistinctCount" | "BlankCount" | "NotBlankCount" | "Concat" | "DistinctConcat";
|
|
146
130
|
/**
|
|
147
131
|
* Metric field configuration
|
|
148
132
|
*/
|
|
149
|
-
export interface
|
|
133
|
+
export interface MetricFieldType {
|
|
150
134
|
/** Field to aggregate */
|
|
151
135
|
Field: string;
|
|
152
136
|
/** Aggregation function type */
|
|
153
|
-
Type:
|
|
137
|
+
Type: MetricTypeType;
|
|
154
138
|
}
|
|
155
139
|
/**
|
|
156
140
|
* Options for metric/aggregate queries
|
|
157
141
|
*/
|
|
158
|
-
export interface
|
|
142
|
+
export interface MetricOptionsType {
|
|
159
143
|
/** Query type (always "Metric") */
|
|
160
144
|
Type: "Metric";
|
|
161
145
|
/** Fields to group by */
|
|
162
146
|
GroupBy: string[];
|
|
163
147
|
/** Metric definitions */
|
|
164
|
-
Metric:
|
|
148
|
+
Metric: MetricFieldType[];
|
|
165
149
|
/** Optional filter criteria */
|
|
166
|
-
Filter?:
|
|
150
|
+
Filter?: FilterType;
|
|
167
151
|
}
|
|
168
152
|
/**
|
|
169
153
|
* Response from metric endpoint
|
|
170
154
|
*/
|
|
171
|
-
export interface
|
|
155
|
+
export interface MetricResponseType {
|
|
172
156
|
/** Aggregated data rows */
|
|
173
157
|
Data: Record<string, any>[];
|
|
174
158
|
}
|
|
175
159
|
/**
|
|
176
160
|
* Pivot table header item (hierarchical)
|
|
177
161
|
*/
|
|
178
|
-
export interface
|
|
162
|
+
export interface PivotHeaderItemType {
|
|
179
163
|
/** Header key/label */
|
|
180
164
|
Key: string;
|
|
181
165
|
/** Child headers for nested grouping */
|
|
182
|
-
Children?:
|
|
166
|
+
Children?: PivotHeaderItemType[] | null;
|
|
183
167
|
}
|
|
184
168
|
/**
|
|
185
169
|
* Pivot response data structure
|
|
186
170
|
*/
|
|
187
|
-
export interface
|
|
171
|
+
export interface PivotResponseDataType {
|
|
188
172
|
/** Row headers */
|
|
189
|
-
RowHeader:
|
|
173
|
+
RowHeader: PivotHeaderItemType[];
|
|
190
174
|
/** Column headers */
|
|
191
|
-
ColumnHeader:
|
|
175
|
+
ColumnHeader: PivotHeaderItemType[];
|
|
192
176
|
/** Value matrix [row][column] */
|
|
193
177
|
Value: (number | string | null)[][];
|
|
194
178
|
}
|
|
195
179
|
/**
|
|
196
180
|
* Options for pivot queries
|
|
197
181
|
*/
|
|
198
|
-
export interface
|
|
182
|
+
export interface PivotOptionsType {
|
|
199
183
|
/** Query type (always "Pivot") */
|
|
200
184
|
Type: "Pivot";
|
|
201
185
|
/** Row dimension fields */
|
|
@@ -203,35 +187,35 @@ export interface PivotOptions {
|
|
|
203
187
|
/** Column dimension fields */
|
|
204
188
|
Column: string[];
|
|
205
189
|
/** Metric definitions */
|
|
206
|
-
Metric:
|
|
190
|
+
Metric: MetricFieldType[];
|
|
207
191
|
/** Optional filter criteria */
|
|
208
|
-
Filter?:
|
|
192
|
+
Filter?: FilterType;
|
|
209
193
|
}
|
|
210
194
|
/**
|
|
211
195
|
* Response from pivot endpoint
|
|
212
196
|
*/
|
|
213
|
-
export interface
|
|
197
|
+
export interface PivotResponseType {
|
|
214
198
|
/** Pivot data including headers and values */
|
|
215
|
-
Data:
|
|
199
|
+
Data: PivotResponseDataType;
|
|
216
200
|
}
|
|
217
201
|
/**
|
|
218
202
|
* Response from draft operations
|
|
219
203
|
*/
|
|
220
|
-
export interface
|
|
204
|
+
export interface DraftResponseType {
|
|
221
205
|
/** Computed field values */
|
|
222
206
|
[fieldName: string]: any;
|
|
223
207
|
}
|
|
224
208
|
/**
|
|
225
209
|
* Response from fields endpoint
|
|
226
210
|
*/
|
|
227
|
-
export interface
|
|
211
|
+
export interface FieldsResponseType {
|
|
228
212
|
/** Field metadata */
|
|
229
213
|
Data: Record<string, any>[];
|
|
230
214
|
}
|
|
231
215
|
/**
|
|
232
216
|
* Single option returned from fetch field endpoint
|
|
233
217
|
*/
|
|
234
|
-
export interface
|
|
218
|
+
export interface FetchFieldOptionType {
|
|
235
219
|
/** The value to be stored */
|
|
236
220
|
Value: string;
|
|
237
221
|
/** The display label */
|
|
@@ -240,8 +224,8 @@ export interface FetchFieldOption {
|
|
|
240
224
|
/**
|
|
241
225
|
* Response from fetch field endpoint
|
|
242
226
|
*/
|
|
243
|
-
export interface
|
|
227
|
+
export interface FetchFieldResponseType {
|
|
244
228
|
/** Array of field options */
|
|
245
|
-
Data:
|
|
229
|
+
Data: FetchFieldOptionType[];
|
|
246
230
|
}
|
|
247
231
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../sdk/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../sdk/types/common.ts"],"names":[],"mappings":"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"}
|
package/dist/types.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useState as I, useMemo as B, useCallback as u } from "react";
|
|
2
|
+
const c = (t) => "Condition" in t, M = (t) => "LHSField" in t;
|
|
3
|
+
let D = 0;
|
|
4
|
+
const a = () => `filter_${Date.now()}_${++D}`, H = (t) => t.id ? t : { ...t, id: a() }, h = (t) => t.map((o) => {
|
|
5
|
+
const n = H(o);
|
|
6
|
+
return c(n) ? {
|
|
7
|
+
...n,
|
|
8
|
+
Condition: h(n.Condition)
|
|
9
|
+
} : n;
|
|
10
|
+
}), w = (t) => t.map((o) => {
|
|
11
|
+
if (c(o)) {
|
|
12
|
+
const { id: O, ...C } = o;
|
|
13
|
+
return {
|
|
14
|
+
...C,
|
|
15
|
+
Condition: w(o.Condition)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const { id: n, ...r } = o;
|
|
19
|
+
return r;
|
|
20
|
+
}), G = (t, o) => {
|
|
21
|
+
for (const n of t) {
|
|
22
|
+
if (n.id === o)
|
|
23
|
+
return n;
|
|
24
|
+
if (c(n)) {
|
|
25
|
+
const r = G(n.Condition, o);
|
|
26
|
+
if (r) return r;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, f = (t, o, n) => t.map((r) => r.id === o ? n(r) : c(r) ? {
|
|
30
|
+
...r,
|
|
31
|
+
Condition: f(r.Condition, o, n)
|
|
32
|
+
} : r), T = (t, o) => t.filter((n) => n.id !== o).map((n) => c(n) ? {
|
|
33
|
+
...n,
|
|
34
|
+
Condition: T(n.Condition, o)
|
|
35
|
+
} : n), l = (t, o, n) => t.map((r) => r.id === o && c(r) ? {
|
|
36
|
+
...r,
|
|
37
|
+
Condition: [...r.Condition, n]
|
|
38
|
+
} : c(r) ? {
|
|
39
|
+
...r,
|
|
40
|
+
Condition: l(r.Condition, o, n)
|
|
41
|
+
} : r);
|
|
42
|
+
function P(t = {}) {
|
|
43
|
+
const [o, n] = I(
|
|
44
|
+
() => h(t.initialConditions || [])
|
|
45
|
+
), [r, O] = I(
|
|
46
|
+
t.initialOperator || "And"
|
|
47
|
+
), C = B(() => {
|
|
48
|
+
if (o.length !== 0)
|
|
49
|
+
return {
|
|
50
|
+
Operator: r,
|
|
51
|
+
Condition: w(o)
|
|
52
|
+
};
|
|
53
|
+
}, [o, r]), g = o.length > 0, v = u((i) => {
|
|
54
|
+
const e = a(), d = { ...i, id: e };
|
|
55
|
+
return n((s) => [...s, d]), e;
|
|
56
|
+
}, []), F = u((i) => {
|
|
57
|
+
const e = a(), d = {
|
|
58
|
+
id: e,
|
|
59
|
+
Operator: i,
|
|
60
|
+
Condition: []
|
|
61
|
+
};
|
|
62
|
+
return n((s) => [...s, d]), e;
|
|
63
|
+
}, []), S = u(
|
|
64
|
+
(i, e) => {
|
|
65
|
+
const d = a(), s = { ...e, id: d };
|
|
66
|
+
return n((p) => l(p, i, s)), d;
|
|
67
|
+
},
|
|
68
|
+
[]
|
|
69
|
+
), y = u(
|
|
70
|
+
(i, e) => {
|
|
71
|
+
const d = a(), s = {
|
|
72
|
+
id: d,
|
|
73
|
+
Operator: e,
|
|
74
|
+
Condition: []
|
|
75
|
+
};
|
|
76
|
+
return n((p) => l(p, i, s)), d;
|
|
77
|
+
},
|
|
78
|
+
[]
|
|
79
|
+
), _ = u(
|
|
80
|
+
(i, e) => {
|
|
81
|
+
n(
|
|
82
|
+
(d) => f(d, i, (s) => c(s) ? s : { ...s, ...e })
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
[]
|
|
86
|
+
), $ = u(
|
|
87
|
+
(i, e) => {
|
|
88
|
+
n(
|
|
89
|
+
(d) => f(d, i, (s) => c(s) ? { ...s, Operator: e } : s)
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
[]
|
|
93
|
+
), b = u((i) => {
|
|
94
|
+
n((e) => T(e, i));
|
|
95
|
+
}, []), k = u(
|
|
96
|
+
(i) => G(o, i),
|
|
97
|
+
[o]
|
|
98
|
+
), x = u(() => {
|
|
99
|
+
n([]);
|
|
100
|
+
}, []), A = u((i) => {
|
|
101
|
+
O(i);
|
|
102
|
+
}, []);
|
|
103
|
+
return {
|
|
104
|
+
// State
|
|
105
|
+
operator: r,
|
|
106
|
+
items: o,
|
|
107
|
+
payload: C,
|
|
108
|
+
hasConditions: g,
|
|
109
|
+
// Add operations
|
|
110
|
+
add: v,
|
|
111
|
+
addGroup: F,
|
|
112
|
+
addTo: S,
|
|
113
|
+
addGroupTo: y,
|
|
114
|
+
// Update operations
|
|
115
|
+
update: _,
|
|
116
|
+
updateOperator: $,
|
|
117
|
+
// Remove & access
|
|
118
|
+
remove: b,
|
|
119
|
+
get: k,
|
|
120
|
+
// Utility
|
|
121
|
+
clear: x,
|
|
122
|
+
setOperator: A
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
c as a,
|
|
127
|
+
M as i,
|
|
128
|
+
P as u
|
|
129
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const d=require("react"),a=r=>"Condition"in r,A=r=>"LHSField"in r;let B=0;const c=()=>`filter_${Date.now()}_${++B}`,D=r=>r.id?r:{...r,id:c()},k=r=>r.map(o=>{const n=D(o);return a(n)?{...n,Condition:k(n.Condition)}:n}),O=r=>r.map(o=>{if(a(o)){const{id:b,...C}=o;return{...C,Condition:O(o.Condition)}}const{id:n,...t}=o;return t}),G=(r,o)=>{for(const n of r){if(n.id===o)return n;if(a(n)){const t=G(n.Condition,o);if(t)return t}}},p=(r,o,n)=>r.map(t=>t.id===o?n(t):a(t)?{...t,Condition:p(t.Condition,o,n)}:t),I=(r,o)=>r.filter(n=>n.id!==o).map(n=>a(n)?{...n,Condition:I(n.Condition,o)}:n),f=(r,o,n)=>r.map(t=>t.id===o&&a(t)?{...t,Condition:[...t.Condition,n]}:a(t)?{...t,Condition:f(t.Condition,o,n)}:t);function H(r={}){const[o,n]=d.useState(()=>k(r.initialConditions||[])),[t,b]=d.useState(r.initialOperator||"And"),C=d.useMemo(()=>{if(o.length!==0)return{Operator:t,Condition:O(o)}},[o,t]),h=o.length>0,w=d.useCallback(e=>{const i=c(),u={...e,id:i};return n(s=>[...s,u]),i},[]),T=d.useCallback(e=>{const i=c(),u={id:i,Operator:e,Condition:[]};return n(s=>[...s,u]),i},[]),g=d.useCallback((e,i)=>{const u=c(),s={...i,id:u};return n(l=>f(l,e,s)),u},[]),v=d.useCallback((e,i)=>{const u=c(),s={id:u,Operator:i,Condition:[]};return n(l=>f(l,e,s)),u},[]),F=d.useCallback((e,i)=>{n(u=>p(u,e,s=>a(s)?s:{...s,...i}))},[]),S=d.useCallback((e,i)=>{n(u=>p(u,e,s=>a(s)?{...s,Operator:i}:s))},[]),y=d.useCallback(e=>{n(i=>I(i,e))},[]),_=d.useCallback(e=>G(o,e),[o]),$=d.useCallback(()=>{n([])},[]),q=d.useCallback(e=>{b(e)},[]);return{operator:t,items:o,payload:C,hasConditions:h,add:w,addGroup:T,addTo:g,addGroupTo:v,update:F,updateOperator:S,remove:y,get:_,clear:$,setOperator:q}}exports.isCondition=A;exports.isConditionGroup=a;exports.useFilter=H;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Te=e=>{throw TypeError(e)};var he=(e,t,s)=>t.has(e)||Te("Cannot "+s);var r=(e,t,s)=>(he(e,t,"read from private field"),s?s.call(e):t.get(e)),d=(e,t,s)=>t.has(e)?Te("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),o=(e,t,s,i)=>(he(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),y=(e,t,s)=>(he(e,t,"access private method"),s);const Ge=require("react");require("./jsx-runtime-BYECrxsp.cjs");function Xe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const C=Xe(Ge);var oe=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ye={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},T,Q,xe,et=(xe=class{constructor(){d(this,T,Ye);d(this,Q,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&r(this,Q)&&e!==r(this,T)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:r(this,T),provider:e}),o(this,T,e),process.env.NODE_ENV!=="production"&&o(this,Q,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&o(this,Q,!0),r(this,T).setTimeout(e,t)}clearTimeout(e){r(this,T).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&o(this,Q,!0),r(this,T).setInterval(e,t)}clearInterval(e){r(this,T).clearInterval(e)}},T=new WeakMap,Q=new WeakMap,xe),se=new et;function tt(e){setTimeout(e,0)}var Z=typeof window>"u"||"Deno"in globalThis;function re(){}function Fe(e){return typeof e=="number"&&e>=0&&e!==1/0}function st(e,t){return Math.max(e+(t||0)-Date.now(),0)}function $(e,t){return typeof e=="function"?e(t):e}function R(e,t){return typeof e=="function"?e(t):e}function rt(e){return JSON.stringify(e,(t,s)=>le(s)?Object.keys(s).sort().reduce((i,n)=>(i[n]=s[n],i),{}):s)}var it=Object.prototype.hasOwnProperty;function ie(e,t){if(e===t)return e;const s=Me(e)&&Me(t);if(!s&&!(le(e)&&le(t)))return t;const n=(s?e:Object.keys(e)).length,c=s?t:Object.keys(t),h=c.length,a=s?new Array(h):{};let v=0;for(let p=0;p<h;p++){const g=s?p:c[p],f=e[g],S=t[g];if(f===S){a[g]=f,(s?p<n:it.call(e,g))&&v++;continue}if(f===null||S===null||typeof f!="object"||typeof S!="object"){a[g]=S;continue}const b=ie(f,S);a[g]=b,b===f&&v++}return n===h&&v===n?e:a}function ne(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function Me(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function le(e){if(!_e(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!_e(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function _e(e){return Object.prototype.toString.call(e)==="[object Object]"}function Pe(e,t,s){if(typeof s.structuralSharing=="function")return s.structuralSharing(e,t);if(s.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return ie(e,t)}catch(i){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${i}`),i}return ie(e,t)}return t}function nt(e){return e}function Se(e,t){return typeof e=="function"?e(...t):!!e}var x,M,A,De,ot=(De=class extends oe{constructor(){super();d(this,x);d(this,M);d(this,A);o(this,A,t=>{if(!Z&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){r(this,M)||this.setEventListener(r(this,A))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,M))==null||t.call(this),o(this,M,void 0))}setEventListener(t){var s;o(this,A,t),(s=r(this,M))==null||s.call(this),o(this,M,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){r(this,x)!==t&&(o(this,x,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof r(this,x)=="boolean"?r(this,x):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},x=new WeakMap,M=new WeakMap,A=new WeakMap,De),at=new ot;function je(){let e,t;const s=new Promise((n,c)=>{e=n,t=c});s.status="pending",s.catch(()=>{});function i(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{i({status:"fulfilled",value:n}),e(n)},s.reject=n=>{i({status:"rejected",reason:n}),t(n)},s}var ut=tt;function ct(){let e=[],t=0,s=a=>{a()},i=a=>{a()},n=ut;const c=a=>{t?e.push(a):n(()=>{s(a)})},h=()=>{const a=e;e=[],a.length&&n(()=>{i(()=>{a.forEach(v=>{s(v)})})})};return{batch:a=>{let v;t++;try{v=a()}finally{t--,t||h()}return v},batchCalls:a=>(...v)=>{c(()=>{a(...v)})},schedule:c,setNotifyFunction:a=>{s=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{n=a}}}var Oe=ct(),B,_,q,Le,ht=(Le=class extends oe{constructor(){super();d(this,B,!0);d(this,_);d(this,q);o(this,q,t=>{if(!Z&&window.addEventListener){const s=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",i)}}})}onSubscribe(){r(this,_)||this.setEventListener(r(this,q))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,_))==null||t.call(this),o(this,_,void 0))}setEventListener(t){var s;o(this,q,t),(s=r(this,_))==null||s.call(this),o(this,_,t(this.setOnline.bind(this)))}setOnline(t){r(this,B)!==t&&(o(this,B,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return r(this,B)}},B=new WeakMap,_=new WeakMap,q=new WeakMap,Le),lt=new ht;function ft(e){return(e??"online")==="online"?lt.isOnline():!0}function dt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ft(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var E,u,G,m,D,z,F,P,X,V,H,L,U,j,J,l,W,fe,de,pe,be,ye,ve,ge,Ae,Ue,ke=(Ue=class extends oe{constructor(t,s){super();d(this,l);d(this,E);d(this,u);d(this,G);d(this,m);d(this,D);d(this,z);d(this,F);d(this,P);d(this,X);d(this,V);d(this,H);d(this,L);d(this,U);d(this,j);d(this,J,new Set);this.options=s,o(this,E,t),o(this,P,null),o(this,F,je()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(r(this,u).addObserver(this),Ne(r(this,u),this.options)?y(this,l,W).call(this):this.updateResult(),y(this,l,be).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return me(r(this,u),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return me(r(this,u),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,y(this,l,ye).call(this),y(this,l,ve).call(this),r(this,u).removeObserver(this)}setOptions(t){const s=this.options,i=r(this,u);if(this.options=r(this,E).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof R(this.options.enabled,r(this,u))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");y(this,l,ge).call(this),r(this,u).setOptions(this.options),s._defaulted&&!ne(this.options,s)&&r(this,E).getQueryCache().notify({type:"observerOptionsUpdated",query:r(this,u),observer:this});const n=this.hasListeners();n&&Qe(r(this,u),i,this.options,s)&&y(this,l,W).call(this),this.updateResult(),n&&(r(this,u)!==i||R(this.options.enabled,r(this,u))!==R(s.enabled,r(this,u))||$(this.options.staleTime,r(this,u))!==$(s.staleTime,r(this,u)))&&y(this,l,fe).call(this);const c=y(this,l,de).call(this);n&&(r(this,u)!==i||R(this.options.enabled,r(this,u))!==R(s.enabled,r(this,u))||c!==r(this,j))&&y(this,l,pe).call(this,c)}getOptimisticResult(t){const s=r(this,E).getQueryCache().build(r(this,E),t),i=this.createResult(s,t);return bt(this,i)&&(o(this,m,i),o(this,z,this.options),o(this,D,r(this,u).state)),i}getCurrentResult(){return r(this,m)}trackResult(t,s){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),s==null||s(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&r(this,F).status==="pending"&&r(this,F).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){r(this,J).add(t)}getCurrentQuery(){return r(this,u)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=r(this,E).defaultQueryOptions(t),i=r(this,E).getQueryCache().build(r(this,E),s);return i.fetch().then(()=>this.createResult(i,s))}fetch(t){return y(this,l,W).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),r(this,m)))}createResult(t,s){var Ie;const i=r(this,u),n=this.options,c=r(this,m),h=r(this,D),a=r(this,z),p=t!==i?t.state:r(this,G),{state:g}=t;let f={...g},S=!1,b;if(s._optimisticResults){const w=this.hasListeners(),ee=!w&&Ne(t,s),k=w&&Qe(t,i,s,n);(ee||k)&&(f={...f,...dt(g.data,t.options)}),s._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:N,errorUpdatedAt:K,status:O}=f;b=f.data;let Y=!1;if(s.placeholderData!==void 0&&b===void 0&&O==="pending"){let w;c!=null&&c.isPlaceholderData&&s.placeholderData===(a==null?void 0:a.placeholderData)?(w=c.data,Y=!0):w=typeof s.placeholderData=="function"?s.placeholderData((Ie=r(this,H))==null?void 0:Ie.state.data,r(this,H)):s.placeholderData,w!==void 0&&(O="success",b=Pe(c==null?void 0:c.data,w,s),S=!0)}if(s.select&&b!==void 0&&!Y)if(c&&b===(h==null?void 0:h.data)&&s.select===r(this,X))b=r(this,V);else try{o(this,X,s.select),b=s.select(b),b=Pe(c==null?void 0:c.data,b,s),o(this,V,b),o(this,P,null)}catch(w){o(this,P,w)}r(this,P)&&(N=r(this,P),b=r(this,V),K=Date.now(),O="error");const ae=f.fetchStatus==="fetching",ue=O==="pending",ce=O==="error",Re=ue&&ae,Ce=b!==void 0,I={status:O,fetchStatus:f.fetchStatus,isPending:ue,isSuccess:O==="success",isError:ce,isInitialLoading:Re,isLoading:Re,data:b,dataUpdatedAt:f.dataUpdatedAt,error:N,errorUpdatedAt:K,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>p.dataUpdateCount||f.errorUpdateCount>p.errorUpdateCount,isFetching:ae,isRefetching:ae&&!ue,isLoadingError:ce&&!Ce,isPaused:f.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:ce&&Ce,isStale:we(t,s),refetch:this.refetch,promise:r(this,F),isEnabled:R(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const w=te=>{I.status==="error"?te.reject(I.error):I.data!==void 0&&te.resolve(I.data)},ee=()=>{const te=o(this,F,I.promise=je());w(te)},k=r(this,F);switch(k.status){case"pending":t.queryHash===i.queryHash&&w(k);break;case"fulfilled":(I.status==="error"||I.data!==k.value)&&ee();break;case"rejected":(I.status!=="error"||I.error!==k.reason)&&ee();break}}return I}updateResult(){const t=r(this,m),s=this.createResult(r(this,u),this.options);if(o(this,D,r(this,u).state),o(this,z,this.options),r(this,D).data!==void 0&&o(this,H,r(this,u)),ne(s,t))return;o(this,m,s);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,c=typeof n=="function"?n():n;if(c==="all"||!c&&!r(this,J).size)return!0;const h=new Set(c??r(this,J));return this.options.throwOnError&&h.add("error"),Object.keys(r(this,m)).some(a=>{const v=a;return r(this,m)[v]!==t[v]&&h.has(v)})};y(this,l,Ae).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&y(this,l,be).call(this)}},E=new WeakMap,u=new WeakMap,G=new WeakMap,m=new WeakMap,D=new WeakMap,z=new WeakMap,F=new WeakMap,P=new WeakMap,X=new WeakMap,V=new WeakMap,H=new WeakMap,L=new WeakMap,U=new WeakMap,j=new WeakMap,J=new WeakMap,l=new WeakSet,W=function(t){y(this,l,ge).call(this);let s=r(this,u).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(re)),s},fe=function(){y(this,l,ye).call(this);const t=$(this.options.staleTime,r(this,u));if(Z||r(this,m).isStale||!Fe(t))return;const i=st(r(this,m).dataUpdatedAt,t)+1;o(this,L,se.setTimeout(()=>{r(this,m).isStale||this.updateResult()},i))},de=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(r(this,u)):this.options.refetchInterval)??!1},pe=function(t){y(this,l,ve).call(this),o(this,j,t),!(Z||R(this.options.enabled,r(this,u))===!1||!Fe(r(this,j))||r(this,j)===0)&&o(this,U,se.setInterval(()=>{(this.options.refetchIntervalInBackground||at.isFocused())&&y(this,l,W).call(this)},r(this,j)))},be=function(){y(this,l,fe).call(this),y(this,l,pe).call(this,y(this,l,de).call(this))},ye=function(){r(this,L)&&(se.clearTimeout(r(this,L)),o(this,L,void 0))},ve=function(){r(this,U)&&(se.clearInterval(r(this,U)),o(this,U,void 0))},ge=function(){const t=r(this,E).getQueryCache().build(r(this,E),this.options);if(t===r(this,u))return;const s=r(this,u);o(this,u,t),o(this,G,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},Ae=function(t){Oe.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(r(this,m))}),r(this,E).getQueryCache().notify({query:r(this,u),type:"observerResultsUpdated"})})},Ue);function pt(e,t){return R(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ne(e,t){return pt(e,t)||e.state.data!==void 0&&me(e,t,t.refetchOnMount)}function me(e,t,s){if(R(t.enabled,e)!==!1&&$(t.staleTime,e)!=="static"){const i=typeof s=="function"?s(e):s;return i==="always"||i!==!1&&we(e,t)}return!1}function Qe(e,t,s,i){return(e!==t||R(i.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&we(e,s)}function we(e,t){return R(t.enabled,e)!==!1&&e.isStaleByTime($(t.staleTime,e))}function bt(e,t){return!ne(e.getCurrentResult(),t)}var yt=C.createContext(void 0),Be=e=>{const t=C.useContext(yt);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qe=C.createContext(!1),ze=()=>C.useContext(qe);qe.Provider;function vt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var gt=C.createContext(vt()),Ve=()=>C.useContext(gt),He=(e,t,s)=>{const i=s!=null&&s.state.error&&typeof e.throwOnError=="function"?Se(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},Je=e=>{C.useEffect(()=>{e.clearReset()},[e])},Ke=({result:e,errorResetBoundary:t,throwOnError:s,query:i,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(n&&e.data===void 0||Se(s,[e.error,i])),We=e=>{if(e.suspense){const s=n=>n==="static"?n:Math.max(n??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...n)=>s(i(...n)):s(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},$e=(e,t)=>e.isLoading&&e.isFetching&&!t,Ze=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ee=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function mt(e,t,s){var S,b,N,K;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const i=ze(),n=Ve(),c=Be(),h=c.defaultQueryOptions(e);(b=(S=c.getDefaultOptions().queries)==null?void 0:S._experimental_beforeQuery)==null||b.call(S,h);const a=c.getQueryCache().get(h.queryHash);process.env.NODE_ENV!=="production"&&(h.queryFn||console.error(`[${h.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),h._optimisticResults=i?"isRestoring":"optimistic",We(h),He(h,n,a),Je(n);const v=!c.getQueryCache().get(h.queryHash),[p]=C.useState(()=>new t(c,h)),g=p.getOptimisticResult(h),f=!i&&e.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(O=>{const Y=f?p.subscribe(Oe.batchCalls(O)):re;return p.updateResult(),Y},[p,f]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),C.useEffect(()=>{p.setOptions(h)},[h,p]),Ze(h,g))throw Ee(h,p,n);if(Ke({result:g,errorResetBoundary:n,throwOnError:h.throwOnError,query:a,suspense:h.suspense}))throw g.error;if((K=(N=c.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||K.call(N,h,g),h.experimental_prefetchInRender&&!Z&&$e(g,i)){const O=v?Ee(h,p,n):a==null?void 0:a.promise;O==null||O.catch(re).finally(()=>{p.updateResult()})}return h.notifyOnChangeProps?g:p.trackResult(g)}function Et(e,t){return mt(e,ke)}exports.QueryObserver=ke;exports.Subscribable=oe;exports.ensurePreventErrorBoundaryRetry=He;exports.ensureSuspenseTimers=We;exports.fetchOptimistic=Ee;exports.getHasError=Ke;exports.hashKey=rt;exports.keepPreviousData=nt;exports.noop=re;exports.notifyManager=Oe;exports.replaceEqualDeep=ie;exports.shallowEqualObjects=ne;exports.shouldSuspend=Ze;exports.shouldThrowError=Se;exports.useClearResetErrorBoundary=Je;exports.useIsRestoring=ze;exports.useQuery=Et;exports.useQueryClient=Be;exports.useQueryErrorResetBoundary=Ve;exports.willFetch=$e;
|