@luzmo/analytics-components-kit 1.0.1-alpha.87 → 1.0.1-alpha.89
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/angular/components/display-settings-binning.component.ts +2 -2
- package/angular/components/display-settings-datetime.component.ts +2 -2
- package/angular/components/display-settings-grand-totals.component.ts +2 -2
- package/angular/components/display-settings-numeric.component.ts +2 -2
- package/angular/components/display-settings.component.ts +3 -3
- package/angular/components/draggable-data-item/index.ts +1 -0
- package/angular/components/draggable-data-item/types.ts +40 -0
- package/angular/components/draggable-data-item-level/index.ts +1 -0
- package/angular/components/draggable-data-item-level/types.ts +15 -0
- package/angular/components/draggable-data-item-level.component.ts +4 -10
- package/angular/components/draggable-data-item.component.ts +4 -10
- package/angular/components/droppable-slot/index.ts +1 -0
- package/angular/components/droppable-slot/types.ts +16 -0
- package/angular/components/droppable-slot.component.ts +5 -3
- package/angular/components/slot-menu/index.ts +1 -0
- package/angular/components/slot-menu/types.ts +31 -0
- package/angular/components/slot-menu-list.component.ts +2 -2
- package/angular/components/slot-menu.component.ts +3 -3
- package/angular/esm/components/display-settings-binning.component.d.ts +2 -1
- package/angular/esm/components/display-settings-datetime.component.d.ts +2 -2
- package/angular/esm/components/display-settings-grand-totals.component.d.ts +2 -1
- package/angular/esm/components/display-settings-numeric.component.d.ts +2 -1
- package/angular/esm/components/display-settings.component.d.ts +3 -3
- package/angular/esm/components/draggable-data-item/index.d.ts +1 -0
- package/angular/esm/components/draggable-data-item/index.js +1 -0
- package/angular/esm/components/draggable-data-item/types.d.ts +22 -0
- package/angular/esm/components/draggable-data-item/types.js +1 -0
- package/angular/esm/components/draggable-data-item-level/index.d.ts +1 -0
- package/angular/esm/components/draggable-data-item-level/index.js +1 -0
- package/angular/esm/components/draggable-data-item-level/types.d.ts +12 -0
- package/angular/esm/components/draggable-data-item-level/types.js +1 -0
- package/angular/esm/components/draggable-data-item-level.component.d.ts +9 -7
- package/angular/esm/components/draggable-data-item-level.component.js +2 -17
- package/angular/esm/components/draggable-data-item.component.d.ts +9 -7
- package/angular/esm/components/draggable-data-item.component.js +2 -17
- package/angular/esm/components/droppable-slot/index.d.ts +1 -0
- package/angular/esm/components/droppable-slot/index.js +1 -0
- package/angular/esm/components/droppable-slot/types.d.ts +9 -0
- package/angular/esm/components/droppable-slot/types.js +1 -0
- package/angular/esm/components/droppable-slot.component.d.ts +5 -4
- package/angular/esm/components/droppable-slot.component.js +7 -2
- package/angular/esm/components/slot-menu/index.d.ts +1 -0
- package/angular/esm/components/slot-menu/index.js +1 -0
- package/angular/esm/components/slot-menu/types.d.ts +25 -0
- package/angular/esm/components/slot-menu/types.js +1 -0
- package/angular/esm/components/slot-menu-list.component.d.ts +2 -1
- package/angular/esm/components/slot-menu.component.d.ts +3 -3
- package/angular/esm/types.d.ts +9 -3
- package/angular/tsconfig.json +3 -0
- package/angular/types.ts +24 -3
- package/angular/utils/base/base.d.ts +16 -0
- package/angular/utils/base/focus-visible.d.ts +29 -0
- package/angular/utils/base/focusable.d.ts +58 -0
- package/angular/utils/base/index.d.ts +4 -0
- package/angular/utils/base/sized-mixin.d.ts +17 -0
- package/angular/utils/color/color-palettes.d.ts +17 -0
- package/angular/utils/color/extrapolate-color.d.ts +1 -0
- package/angular/utils/data/load-draggable-items-for-datasets.d.ts +24 -0
- package/angular/utils/data-broker/index.d.ts +191 -0
- package/angular/utils/data-item-types/calculate-data-item-icon.d.ts +10 -0
- package/angular/utils/data-item-types/tests/calculate-data-item-icon.test.d.ts +1 -0
- package/angular/utils/drag/draggable.d.ts +13 -0
- package/angular/utils/filters/expressions.d.ts +15 -0
- package/angular/utils/filters/index.d.ts +1 -0
- package/angular/utils/formatter/calculate-duration.d.ts +2 -0
- package/angular/utils/formatter/decompose-numeric-format.d.ts +11 -0
- package/angular/utils/formatter/default-local-formats.d.ts +20 -0
- package/angular/utils/formatter/formats/cs.d.ts +20 -0
- package/angular/utils/formatter/formats/da.d.ts +20 -0
- package/angular/utils/formatter/formats/de.d.ts +21 -0
- package/angular/utils/formatter/formats/en-GB.d.ts +21 -0
- package/angular/utils/formatter/formats/en-US.d.ts +1 -0
- package/angular/utils/formatter/formats/en.d.ts +1 -0
- package/angular/utils/formatter/formats/es.d.ts +54 -0
- package/angular/utils/formatter/formats/fi.d.ts +20 -0
- package/angular/utils/formatter/formats/fr.d.ts +54 -0
- package/angular/utils/formatter/formats/he.d.ts +20 -0
- package/angular/utils/formatter/formats/hu.d.ts +20 -0
- package/angular/utils/formatter/formats/it.d.ts +54 -0
- package/angular/utils/formatter/formats/ja.d.ts +20 -0
- package/angular/utils/formatter/formats/ko.d.ts +20 -0
- package/angular/utils/formatter/formats/mk.d.ts +20 -0
- package/angular/utils/formatter/formats/nl.d.ts +21 -0
- package/angular/utils/formatter/formats/no.d.ts +21 -0
- package/angular/utils/formatter/formats/pl.d.ts +20 -0
- package/angular/utils/formatter/formats/pt.d.ts +20 -0
- package/angular/utils/formatter/formats/ru.d.ts +20 -0
- package/angular/utils/formatter/formats/sv.d.ts +20 -0
- package/angular/utils/formatter/formats/tr.d.ts +21 -0
- package/angular/utils/formatter/formats/zh-CN.d.ts +20 -0
- package/angular/utils/formatter/formats/zh-TW.d.ts +20 -0
- package/angular/utils/formatter/formatter.d.ts +9 -0
- package/angular/utils/formatter/localize.d.ts +3 -0
- package/angular/utils/formatter/smart-datetime-formats.const.d.ts +36 -0
- package/angular/utils/get-css-variable.d.ts +1 -0
- package/angular/utils/index.d.ts +7 -0
- package/angular/utils/localize/set-locale.d.ts +7 -0
- package/angular/utils/map-tile-providers/index.d.ts +93 -0
- package/angular/utils/store/slot-context.d.ts +4 -0
- package/angular/utils/store/slot-store.d.ts +39 -0
- package/angular/utils/switch-item/index.d.ts +14 -0
- package/angular/utils/themes/bliss.d.ts +43 -0
- package/angular/utils/themes/classic-dark.d.ts +34 -0
- package/angular/utils/themes/classic.d.ts +43 -0
- package/angular/utils/themes/default-dark.d.ts +46 -0
- package/angular/utils/themes/default.d.ts +46 -0
- package/angular/utils/themes/index.d.ts +3 -0
- package/angular/utils/themes/orion.d.ts +44 -0
- package/angular/utils/themes/pinky.d.ts +42 -0
- package/angular/utils/themes/radiant.d.ts +42 -0
- package/angular/utils/themes/royale.d.ts +36 -0
- package/angular/utils/themes/seasonal.d.ts +43 -0
- package/angular/utils/themes/urban.d.ts +44 -0
- package/angular/utils/themes/vivid.d.ts +42 -0
- package/angular/utils/time/formats.const.d.ts +4 -0
- package/angular/utils/time/periods.const.d.ts +15 -0
- package/angular/utils/transformations/convert-data-item-to-slot-content.d.ts +9 -0
- package/angular/utils/transformations/convert-datasets-to-draggable-items.d.ts +17 -0
- package/angular/utils/transformations/tests/convert-data-item-to-slot-content.test.d.ts +1 -0
- package/angular/utils/transformations/tests/convert-datasets-to-draggable-items.test.d.ts +1 -0
- package/angular/utils/types/type-check.d.ts +7 -0
- package/components/ai-chat-message-assistant/index.cjs +1 -1
- package/components/ai-chat-message-assistant/index.js +0 -1
- package/components/calculate-data-item-icon-DMDhKq_m.js +147 -0
- package/components/{calculate-data-item-icon-CX4VW9Km.cjs → calculate-data-item-icon-DtVGbet3.cjs} +1 -1
- package/components/dataset-selector-list/index.cjs +1 -1
- package/components/dataset-selector-list/index.js +1 -1
- package/components/display-settings/display-settings.d.ts +4 -2
- package/components/display-settings/index.cjs +1 -1
- package/components/display-settings/index.js +1 -1
- package/components/display-settings-binning/display-settings-binning.d.ts +2 -1
- package/components/display-settings-datetime/display-settings-datetime.d.ts +2 -1
- package/components/display-settings-datetime/index.cjs +1 -1
- package/components/display-settings-datetime/index.js +4 -4
- package/components/display-settings-grand-totals/display-settings-grand-totals.d.ts +2 -1
- package/components/display-settings-numeric/display-settings-numeric.d.ts +2 -1
- package/components/display-settings-numeric/index.cjs +10 -10
- package/components/display-settings-numeric/index.js +5 -5
- package/components/draggable-data-item/draggable-data-item.d.ts +5 -7
- package/components/draggable-data-item/index.cjs +16 -22
- package/components/draggable-data-item/index.d.ts +1 -0
- package/components/draggable-data-item/index.js +78 -85
- package/components/draggable-data-item/types.d.ts +22 -0
- package/components/draggable-data-item-level/draggable-data-item-level.d.ts +4 -6
- package/components/draggable-data-item-level/helpers/generate-preview.d.ts +9 -1
- package/components/draggable-data-item-level/index.cjs +13 -13
- package/components/draggable-data-item-level/index.js +84 -102
- package/components/draggable-data-item-level/types.d.ts +12 -0
- package/components/droppable-slot/droppable-slot.d.ts +4 -2
- package/components/droppable-slot/index.cjs +13 -13
- package/components/droppable-slot/index.d.ts +1 -0
- package/components/droppable-slot/index.js +198 -199
- package/components/droppable-slot/types.d.ts +9 -0
- package/components/{en-CtCctD2c.js → en-D3ihEGXg.js} +67 -67
- package/components/{en--a5SfjnM.cjs → en-DZcn_iz_.cjs} +1 -1
- package/components/{en-GB-CXVKFWyH.cjs → en-GB-TqvgIw9B.cjs} +1 -1
- package/components/{en-GB-CbNfyZMo.js → en-GB-ialeqj_z.js} +1 -1
- package/components/filter-data-item-picker/index.cjs +1 -1
- package/components/filter-data-item-picker/index.js +1 -1
- package/components/filter-item/index.cjs +1 -1
- package/components/filter-item/index.js +8 -8
- package/components/filter-value-picker-hierarchy/index.cjs +1 -1
- package/components/filter-value-picker-hierarchy/index.js +1 -1
- package/components/filter-value-picker-numeric/index.cjs +1 -1
- package/components/filter-value-picker-numeric/index.js +1 -1
- package/components/{get-css-variable-CuDaWSjr.cjs → get-css-variable-COd1d84B.cjs} +3 -3
- package/components/{get-css-variable-DEf4GhTH.js → get-css-variable-CdwF98oh.js} +31 -31
- package/components/grid/index.cjs +1 -7
- package/components/grid/index.js +0 -7
- package/components/{index-BUal0r_D.cjs → index-BekTY3Em.cjs} +1 -1
- package/components/index-CFL6gmIu.cjs +20 -0
- package/components/{index-3WsfvkZF.js → index-CqKpf0B8.js} +1 -1
- package/components/{index-BGb_wRRW.js → index-DNPULp4A.js} +177 -188
- package/components/index.cjs +1 -1
- package/components/index.js +26 -24
- package/components/slot-contents-picker/index.cjs +1 -1
- package/components/slot-contents-picker/index.js +2 -2
- package/components/slot-menu/index.cjs +1 -1
- package/components/slot-menu/index.d.ts +1 -0
- package/components/slot-menu/index.js +64 -69
- package/components/slot-menu/slot-menu.d.ts +7 -6
- package/components/slot-menu/types.d.ts +25 -0
- package/components/slot-menu-list/index.cjs +1 -1
- package/components/slot-menu-list/index.js +2 -2
- package/components/slot-menu-list/slot-menu-list.d.ts +2 -1
- package/components/utils.cjs +1 -1
- package/components/utils.js +129 -62
- package/custom-elements.json +123 -126
- package/item-definitions/slicer-filter/slicer-filter-options.config.d.ts +1 -1
- package/package.json +1 -1
- package/types.d.ts +9 -3
- package/utils/data/load-draggable-items-for-datasets.d.ts +24 -0
- package/utils/data-broker/index.d.ts +69 -66
- package/utils/data-item-types/calculate-data-item-icon.d.ts +8 -2
- package/utils/data-item-types/tests/calculate-data-item-icon.test.d.ts +1 -0
- package/utils/index.d.ts +2 -0
- package/utils/transformations/convert-data-item-to-slot-content.d.ts +9 -0
- package/utils/transformations/convert-datasets-to-draggable-items.d.ts +17 -0
- package/utils/transformations/tests/convert-data-item-to-slot-content.test.d.ts +1 -0
- package/utils/transformations/tests/convert-datasets-to-draggable-items.test.d.ts +1 -0
- package/components/calculate-data-item-icon-C8CbsMQf.js +0 -139
- package/components/index-D1Y5TRsH.cjs +0 -20
- package/utils/types/column.types.d.ts +0 -57
|
@@ -33,7 +33,7 @@ var T = class {
|
|
|
33
33
|
}
|
|
34
34
|
onUnsubscribe() {
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, X = {
|
|
37
37
|
// We need the wrapper function syntax below instead of direct references to
|
|
38
38
|
// global setTimeout etc.
|
|
39
39
|
//
|
|
@@ -48,14 +48,14 @@ var T = class {
|
|
|
48
48
|
clearTimeout: (t) => clearTimeout(t),
|
|
49
49
|
setInterval: (t, e) => setInterval(t, e),
|
|
50
50
|
clearInterval: (t) => clearInterval(t)
|
|
51
|
-
},
|
|
51
|
+
}, Y = class {
|
|
52
52
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
53
53
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
54
54
|
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
55
55
|
//
|
|
56
56
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
57
57
|
// this class is unsafe internally to allow for extension.
|
|
58
|
-
#t =
|
|
58
|
+
#t = X;
|
|
59
59
|
#e = !1;
|
|
60
60
|
setTimeoutProvider(t) {
|
|
61
61
|
this.#t = t;
|
|
@@ -72,26 +72,26 @@ var T = class {
|
|
|
72
72
|
clearInterval(t) {
|
|
73
73
|
this.#t.clearInterval(t);
|
|
74
74
|
}
|
|
75
|
-
}, Q = new
|
|
76
|
-
function
|
|
75
|
+
}, Q = new Y();
|
|
76
|
+
function tt(t) {
|
|
77
77
|
setTimeout(t, 0);
|
|
78
78
|
}
|
|
79
79
|
var M = typeof window > "u" || "Deno" in globalThis;
|
|
80
80
|
function v() {
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function et(t, e) {
|
|
83
83
|
return typeof t == "function" ? t(e) : t;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function st(t) {
|
|
86
86
|
return typeof t == "number" && t >= 0 && t !== 1 / 0;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function it(t, e) {
|
|
89
89
|
return Math.max(t + (e || 0) - Date.now(), 0);
|
|
90
90
|
}
|
|
91
91
|
function E(t, e) {
|
|
92
92
|
return typeof t == "function" ? t(e) : t;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function rt(t, e) {
|
|
95
95
|
return typeof t == "function" ? t(e) : t;
|
|
96
96
|
}
|
|
97
97
|
function U(t, e) {
|
|
@@ -123,7 +123,7 @@ function x(t, e) {
|
|
|
123
123
|
if (!e.options.mutationKey)
|
|
124
124
|
return !1;
|
|
125
125
|
if (s) {
|
|
126
|
-
if (
|
|
126
|
+
if (P(e.options.mutationKey) !== P(a))
|
|
127
127
|
return !1;
|
|
128
128
|
} else if (!F(e.options.mutationKey, a))
|
|
129
129
|
return !1;
|
|
@@ -131,9 +131,9 @@ function x(t, e) {
|
|
|
131
131
|
return !(i && e.state.status !== i || n && !n(e));
|
|
132
132
|
}
|
|
133
133
|
function j(t, e) {
|
|
134
|
-
return (e?.queryKeyHashFn ||
|
|
134
|
+
return (e?.queryKeyHashFn || P)(t);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function P(t) {
|
|
137
137
|
return JSON.stringify(
|
|
138
138
|
t,
|
|
139
139
|
(e, s) => R(s) ? Object.keys(s).sort().reduce((i, n) => (i[n] = s[n], i), {}) : s
|
|
@@ -142,7 +142,7 @@ function q(t) {
|
|
|
142
142
|
function F(t, e) {
|
|
143
143
|
return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? Object.keys(e).every((s) => F(t[s], e[s])) : !1;
|
|
144
144
|
}
|
|
145
|
-
var
|
|
145
|
+
var nt = Object.prototype.hasOwnProperty;
|
|
146
146
|
function $(t, e) {
|
|
147
147
|
if (t === e)
|
|
148
148
|
return t;
|
|
@@ -151,17 +151,17 @@ function $(t, e) {
|
|
|
151
151
|
const n = (s ? t : Object.keys(t)).length, a = s ? e : Object.keys(e), o = a.length, r = s ? new Array(o) : {};
|
|
152
152
|
let u = 0;
|
|
153
153
|
for (let h = 0; h < o; h++) {
|
|
154
|
-
const
|
|
154
|
+
const d = s ? h : a[h], l = t[d], m = e[d];
|
|
155
155
|
if (l === m) {
|
|
156
|
-
r[
|
|
156
|
+
r[d] = l, (s ? h < n : nt.call(t, d)) && u++;
|
|
157
157
|
continue;
|
|
158
158
|
}
|
|
159
159
|
if (l === null || m === null || typeof l != "object" || typeof m != "object") {
|
|
160
|
-
r[
|
|
160
|
+
r[d] = m;
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
const
|
|
164
|
-
r[
|
|
163
|
+
const b = $(l, m);
|
|
164
|
+
r[d] = b, b === l && u++;
|
|
165
165
|
}
|
|
166
166
|
return n === o && u === n ? t : r;
|
|
167
167
|
}
|
|
@@ -180,19 +180,19 @@ function R(t) {
|
|
|
180
180
|
function H(t) {
|
|
181
181
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function at(t) {
|
|
184
184
|
return new Promise((e) => {
|
|
185
185
|
Q.setTimeout(e, t);
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function ot(t, e, s) {
|
|
189
189
|
return typeof s.structuralSharing == "function" ? s.structuralSharing(t, e) : s.structuralSharing !== !1 ? $(t, e) : e;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function ut(t, e, s = 0) {
|
|
192
192
|
const i = [...t, e];
|
|
193
193
|
return s && i.length > s ? i.slice(1) : i;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function ht(t, e, s = 0) {
|
|
196
196
|
const i = [e, ...t];
|
|
197
197
|
return s && i.length > s ? i.slice(0, -1) : i;
|
|
198
198
|
}
|
|
@@ -200,7 +200,7 @@ var I = Symbol();
|
|
|
200
200
|
function J(t, e) {
|
|
201
201
|
return !t.queryFn && e?.initialPromise ? () => e.initialPromise : !t.queryFn || t.queryFn === I ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
|
|
202
202
|
}
|
|
203
|
-
var
|
|
203
|
+
var ct = class extends T {
|
|
204
204
|
#t;
|
|
205
205
|
#e;
|
|
206
206
|
#s;
|
|
@@ -237,8 +237,8 @@ var ht = class extends T {
|
|
|
237
237
|
isFocused() {
|
|
238
238
|
return typeof this.#t == "boolean" ? this.#t : globalThis.document?.visibilityState !== "hidden";
|
|
239
239
|
}
|
|
240
|
-
},
|
|
241
|
-
function
|
|
240
|
+
}, z = new ct();
|
|
241
|
+
function lt() {
|
|
242
242
|
let t, e;
|
|
243
243
|
const s = new Promise((n, a) => {
|
|
244
244
|
t = n, e = a;
|
|
@@ -260,13 +260,13 @@ function ct() {
|
|
|
260
260
|
}), e(n);
|
|
261
261
|
}, s;
|
|
262
262
|
}
|
|
263
|
-
var
|
|
263
|
+
var dt = tt;
|
|
264
264
|
function ft() {
|
|
265
265
|
let t = [], e = 0, s = (r) => {
|
|
266
266
|
r();
|
|
267
267
|
}, i = (r) => {
|
|
268
268
|
r();
|
|
269
|
-
}, n =
|
|
269
|
+
}, n = dt;
|
|
270
270
|
const a = (r) => {
|
|
271
271
|
e ? t.push(r) : n(() => {
|
|
272
272
|
s(r);
|
|
@@ -320,7 +320,7 @@ function ft() {
|
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
var y = ft(),
|
|
323
|
+
var y = ft(), yt = class extends T {
|
|
324
324
|
#t = !0;
|
|
325
325
|
#e;
|
|
326
326
|
#s;
|
|
@@ -351,21 +351,21 @@ var y = ft(), dt = class extends T {
|
|
|
351
351
|
isOnline() {
|
|
352
352
|
return this.#t;
|
|
353
353
|
}
|
|
354
|
-
},
|
|
355
|
-
function
|
|
354
|
+
}, D = new yt();
|
|
355
|
+
function pt(t) {
|
|
356
356
|
return Math.min(1e3 * 2 ** t, 3e4);
|
|
357
357
|
}
|
|
358
|
-
function
|
|
359
|
-
return (t ?? "online") === "online" ?
|
|
358
|
+
function B(t) {
|
|
359
|
+
return (t ?? "online") === "online" ? D.isOnline() : !0;
|
|
360
360
|
}
|
|
361
361
|
var K = class extends Error {
|
|
362
362
|
constructor(t) {
|
|
363
363
|
super("CancelledError"), this.revert = t?.revert, this.silent = t?.silent;
|
|
364
364
|
}
|
|
365
365
|
};
|
|
366
|
-
function
|
|
366
|
+
function W(t) {
|
|
367
367
|
let e = !1, s = 0, i;
|
|
368
|
-
const n =
|
|
368
|
+
const n = lt(), a = () => n.status !== "pending", o = (c) => {
|
|
369
369
|
if (!a()) {
|
|
370
370
|
const p = new K(c);
|
|
371
371
|
m(p), t.onCancel?.(p);
|
|
@@ -374,17 +374,17 @@ function B(t) {
|
|
|
374
374
|
e = !0;
|
|
375
375
|
}, u = () => {
|
|
376
376
|
e = !1;
|
|
377
|
-
}, h = () =>
|
|
377
|
+
}, h = () => z.isFocused() && (t.networkMode === "always" || D.isOnline()) && t.canRun(), d = () => B(t.networkMode) && t.canRun(), l = (c) => {
|
|
378
378
|
a() || (i?.(), n.resolve(c));
|
|
379
379
|
}, m = (c) => {
|
|
380
380
|
a() || (i?.(), n.reject(c));
|
|
381
|
-
},
|
|
381
|
+
}, b = () => new Promise((c) => {
|
|
382
382
|
i = (p) => {
|
|
383
383
|
(a() || h()) && c(p);
|
|
384
384
|
}, t.onPause?.();
|
|
385
385
|
}).then(() => {
|
|
386
386
|
i = void 0, a() || t.onContinue?.();
|
|
387
|
-
}),
|
|
387
|
+
}), f = () => {
|
|
388
388
|
if (a())
|
|
389
389
|
return;
|
|
390
390
|
let c;
|
|
@@ -397,13 +397,13 @@ function B(t) {
|
|
|
397
397
|
Promise.resolve(c).then(l).catch((g) => {
|
|
398
398
|
if (a())
|
|
399
399
|
return;
|
|
400
|
-
const
|
|
400
|
+
const w = t.retry ?? (M ? 0 : 3), O = t.retryDelay ?? pt, q = typeof O == "function" ? O(s, g) : O, S = w === !0 || typeof w == "number" && s < w || typeof w == "function" && w(s, g);
|
|
401
401
|
if (e || !S) {
|
|
402
402
|
m(g);
|
|
403
403
|
return;
|
|
404
404
|
}
|
|
405
|
-
s++, t.onFail?.(s, g),
|
|
406
|
-
e ? m(g) :
|
|
405
|
+
s++, t.onFail?.(s, g), at(q).then(() => h() ? void 0 : b()).then(() => {
|
|
406
|
+
e ? m(g) : f();
|
|
407
407
|
});
|
|
408
408
|
});
|
|
409
409
|
};
|
|
@@ -414,30 +414,30 @@ function B(t) {
|
|
|
414
414
|
continue: () => (i?.(), n),
|
|
415
415
|
cancelRetry: r,
|
|
416
416
|
continueRetry: u,
|
|
417
|
-
canStart:
|
|
418
|
-
start: () => (
|
|
417
|
+
canStart: d,
|
|
418
|
+
start: () => (d() ? f() : b().then(f), n)
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
|
-
var
|
|
421
|
+
var Z = class {
|
|
422
422
|
#t;
|
|
423
423
|
destroy() {
|
|
424
424
|
this.clearGcTimeout();
|
|
425
425
|
}
|
|
426
426
|
scheduleGc() {
|
|
427
|
-
this.clearGcTimeout(),
|
|
427
|
+
this.clearGcTimeout(), st(this.gcTime) && (this.#t = Q.setTimeout(() => {
|
|
428
428
|
this.optionalRemove();
|
|
429
429
|
}, this.gcTime));
|
|
430
430
|
}
|
|
431
431
|
updateGcTime(t) {
|
|
432
432
|
this.gcTime = Math.max(
|
|
433
433
|
this.gcTime || 0,
|
|
434
|
-
t ?? (M ? 1 / 0 :
|
|
434
|
+
t ?? (M ? 1 / 0 : 300 * 1e3)
|
|
435
435
|
);
|
|
436
436
|
}
|
|
437
437
|
clearGcTimeout() {
|
|
438
438
|
this.#t && (Q.clearTimeout(this.#t), this.#t = void 0);
|
|
439
439
|
}
|
|
440
|
-
},
|
|
440
|
+
}, mt = class extends Z {
|
|
441
441
|
#t;
|
|
442
442
|
#e;
|
|
443
443
|
#s;
|
|
@@ -446,7 +446,7 @@ var W = class {
|
|
|
446
446
|
#a;
|
|
447
447
|
#o;
|
|
448
448
|
constructor(t) {
|
|
449
|
-
super(), this.#o = !1, this.#a = t.defaultOptions, this.setOptions(t.options), this.observers = [], this.#r = t.client, this.#s = this.#r.getQueryCache(), this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.#t =
|
|
449
|
+
super(), this.#o = !1, this.#a = t.defaultOptions, this.setOptions(t.options), this.observers = [], this.#r = t.client, this.#s = this.#r.getQueryCache(), this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.#t = N(this.options), this.state = t.state ?? this.#t, this.scheduleGc();
|
|
450
450
|
}
|
|
451
451
|
get meta() {
|
|
452
452
|
return this.options.meta;
|
|
@@ -456,18 +456,17 @@ var W = class {
|
|
|
456
456
|
}
|
|
457
457
|
setOptions(t) {
|
|
458
458
|
if (this.options = { ...this.#a, ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
459
|
-
const e =
|
|
460
|
-
e.data !== void 0 && (this.
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}), this.#t = e);
|
|
459
|
+
const e = N(this.options);
|
|
460
|
+
e.data !== void 0 && (this.setState(
|
|
461
|
+
G(e.data, e.dataUpdatedAt)
|
|
462
|
+
), this.#t = e);
|
|
464
463
|
}
|
|
465
464
|
}
|
|
466
465
|
optionalRemove() {
|
|
467
466
|
!this.observers.length && this.state.fetchStatus === "idle" && this.#s.remove(this);
|
|
468
467
|
}
|
|
469
468
|
setData(t, e) {
|
|
470
|
-
const s =
|
|
469
|
+
const s = ot(this.state.data, t, this.options);
|
|
471
470
|
return this.#n({
|
|
472
471
|
data: s,
|
|
473
472
|
type: "success",
|
|
@@ -490,7 +489,7 @@ var W = class {
|
|
|
490
489
|
}
|
|
491
490
|
isActive() {
|
|
492
491
|
return this.observers.some(
|
|
493
|
-
(t) =>
|
|
492
|
+
(t) => rt(t.options.enabled, this) !== !1
|
|
494
493
|
);
|
|
495
494
|
}
|
|
496
495
|
isDisabled() {
|
|
@@ -507,7 +506,7 @@ var W = class {
|
|
|
507
506
|
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
508
507
|
}
|
|
509
508
|
isStaleByTime(t = 0) {
|
|
510
|
-
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !
|
|
509
|
+
return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !it(this.state.dataUpdatedAt, t);
|
|
511
510
|
}
|
|
512
511
|
onFocus() {
|
|
513
512
|
this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#i?.continue();
|
|
@@ -548,12 +547,12 @@ var W = class {
|
|
|
548
547
|
});
|
|
549
548
|
}, n = () => {
|
|
550
549
|
const r = J(this.options, e), h = (() => {
|
|
551
|
-
const
|
|
550
|
+
const d = {
|
|
552
551
|
client: this.#r,
|
|
553
552
|
queryKey: this.queryKey,
|
|
554
553
|
meta: this.meta
|
|
555
554
|
};
|
|
556
|
-
return i(
|
|
555
|
+
return i(d), d;
|
|
557
556
|
})();
|
|
558
557
|
return this.#o = !1, this.options.persister ? this.options.persister(
|
|
559
558
|
r,
|
|
@@ -571,7 +570,7 @@ var W = class {
|
|
|
571
570
|
};
|
|
572
571
|
return i(r), r;
|
|
573
572
|
})();
|
|
574
|
-
this.options.behavior?.onFetch(o, this), this.#e = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== o.fetchOptions?.meta) && this.#n({ type: "fetch", meta: o.fetchOptions?.meta }), this.#i =
|
|
573
|
+
this.options.behavior?.onFetch(o, this), this.#e = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== o.fetchOptions?.meta) && this.#n({ type: "fetch", meta: o.fetchOptions?.meta }), this.#i = W({
|
|
575
574
|
initialPromise: e?.initialPromise,
|
|
576
575
|
fn: o.fetchFn,
|
|
577
576
|
onCancel: (r) => {
|
|
@@ -650,18 +649,14 @@ var W = class {
|
|
|
650
649
|
case "fetch":
|
|
651
650
|
return {
|
|
652
651
|
...s,
|
|
653
|
-
...
|
|
652
|
+
...vt(s.data, this.options),
|
|
654
653
|
fetchMeta: t.meta ?? null
|
|
655
654
|
};
|
|
656
655
|
case "success":
|
|
657
656
|
const i = {
|
|
658
657
|
...s,
|
|
659
|
-
data
|
|
658
|
+
...G(t.data, t.dataUpdatedAt),
|
|
660
659
|
dataUpdateCount: s.dataUpdateCount + 1,
|
|
661
|
-
dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
|
|
662
|
-
error: null,
|
|
663
|
-
isInvalidated: !1,
|
|
664
|
-
status: "success",
|
|
665
660
|
...!t.manual && {
|
|
666
661
|
fetchStatus: "idle",
|
|
667
662
|
fetchFailureCount: 0,
|
|
@@ -700,18 +695,27 @@ var W = class {
|
|
|
700
695
|
});
|
|
701
696
|
}
|
|
702
697
|
};
|
|
703
|
-
function
|
|
698
|
+
function vt(t, e) {
|
|
704
699
|
return {
|
|
705
700
|
fetchFailureCount: 0,
|
|
706
701
|
fetchFailureReason: null,
|
|
707
|
-
fetchStatus:
|
|
702
|
+
fetchStatus: B(e.networkMode) ? "fetching" : "paused",
|
|
708
703
|
...t === void 0 && {
|
|
709
704
|
error: null,
|
|
710
705
|
status: "pending"
|
|
711
706
|
}
|
|
712
707
|
};
|
|
713
708
|
}
|
|
714
|
-
function G(t) {
|
|
709
|
+
function G(t, e) {
|
|
710
|
+
return {
|
|
711
|
+
data: t,
|
|
712
|
+
dataUpdatedAt: e ?? Date.now(),
|
|
713
|
+
error: null,
|
|
714
|
+
isInvalidated: !1,
|
|
715
|
+
status: "success"
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
function N(t) {
|
|
715
719
|
const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = e !== void 0, i = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
|
|
716
720
|
return {
|
|
717
721
|
data: e,
|
|
@@ -728,26 +732,26 @@ function G(t) {
|
|
|
728
732
|
fetchStatus: "idle"
|
|
729
733
|
};
|
|
730
734
|
}
|
|
731
|
-
function
|
|
735
|
+
function V(t) {
|
|
732
736
|
return {
|
|
733
737
|
onFetch: (e, s) => {
|
|
734
738
|
const i = e.options, n = e.fetchOptions?.meta?.fetchMore?.direction, a = e.state.data?.pages || [], o = e.state.data?.pageParams || [];
|
|
735
739
|
let r = { pages: [], pageParams: [] }, u = 0;
|
|
736
740
|
const h = async () => {
|
|
737
|
-
let
|
|
738
|
-
const l = (
|
|
739
|
-
Object.defineProperty(
|
|
741
|
+
let d = !1;
|
|
742
|
+
const l = (f) => {
|
|
743
|
+
Object.defineProperty(f, "signal", {
|
|
740
744
|
enumerable: !0,
|
|
741
|
-
get: () => (e.signal.aborted ?
|
|
742
|
-
|
|
745
|
+
get: () => (e.signal.aborted ? d = !0 : e.signal.addEventListener("abort", () => {
|
|
746
|
+
d = !0;
|
|
743
747
|
}), e.signal)
|
|
744
748
|
});
|
|
745
|
-
}, m = J(e.options, e.fetchOptions),
|
|
746
|
-
if (
|
|
749
|
+
}, m = J(e.options, e.fetchOptions), b = async (f, c, p) => {
|
|
750
|
+
if (d)
|
|
747
751
|
return Promise.reject();
|
|
748
|
-
if (c == null &&
|
|
749
|
-
return Promise.resolve(
|
|
750
|
-
const
|
|
752
|
+
if (c == null && f.pages.length)
|
|
753
|
+
return Promise.resolve(f);
|
|
754
|
+
const w = (() => {
|
|
751
755
|
const k = {
|
|
752
756
|
client: e.client,
|
|
753
757
|
queryKey: e.queryKey,
|
|
@@ -756,26 +760,26 @@ function N(t) {
|
|
|
756
760
|
meta: e.options.meta
|
|
757
761
|
};
|
|
758
762
|
return l(k), k;
|
|
759
|
-
})(),
|
|
763
|
+
})(), O = await m(w), { maxPages: q } = e.options, S = p ? ht : ut;
|
|
760
764
|
return {
|
|
761
|
-
pages: S(
|
|
762
|
-
pageParams: S(
|
|
765
|
+
pages: S(f.pages, O, q),
|
|
766
|
+
pageParams: S(f.pageParams, c, q)
|
|
763
767
|
};
|
|
764
768
|
};
|
|
765
769
|
if (n && a.length) {
|
|
766
|
-
const
|
|
770
|
+
const f = n === "backward", c = f ? gt : _, p = {
|
|
767
771
|
pages: a,
|
|
768
772
|
pageParams: o
|
|
769
773
|
}, g = c(i, p);
|
|
770
|
-
r = await
|
|
774
|
+
r = await b(p, g, f);
|
|
771
775
|
} else {
|
|
772
|
-
const
|
|
776
|
+
const f = t ?? a.length;
|
|
773
777
|
do {
|
|
774
|
-
const c = u === 0 ? o[0] ?? i.initialPageParam :
|
|
778
|
+
const c = u === 0 ? o[0] ?? i.initialPageParam : _(i, r);
|
|
775
779
|
if (u > 0 && c == null)
|
|
776
780
|
break;
|
|
777
|
-
r = await
|
|
778
|
-
} while (u <
|
|
781
|
+
r = await b(r, c), u++;
|
|
782
|
+
} while (u < f);
|
|
779
783
|
}
|
|
780
784
|
return r;
|
|
781
785
|
};
|
|
@@ -792,7 +796,7 @@ function N(t) {
|
|
|
792
796
|
}
|
|
793
797
|
};
|
|
794
798
|
}
|
|
795
|
-
function
|
|
799
|
+
function _(t, { pages: e, pageParams: s }) {
|
|
796
800
|
const i = e.length - 1;
|
|
797
801
|
return e.length > 0 ? t.getNextPageParam(
|
|
798
802
|
e[i],
|
|
@@ -801,10 +805,10 @@ function V(t, { pages: e, pageParams: s }) {
|
|
|
801
805
|
s
|
|
802
806
|
) : void 0;
|
|
803
807
|
}
|
|
804
|
-
function
|
|
808
|
+
function gt(t, { pages: e, pageParams: s }) {
|
|
805
809
|
return e.length > 0 ? t.getPreviousPageParam?.(e[0], e, s[0], s) : void 0;
|
|
806
810
|
}
|
|
807
|
-
var
|
|
811
|
+
var bt = class extends Z {
|
|
808
812
|
#t;
|
|
809
813
|
#e;
|
|
810
814
|
#s;
|
|
@@ -847,7 +851,7 @@ var gt = class extends W {
|
|
|
847
851
|
meta: this.options.meta,
|
|
848
852
|
mutationKey: this.options.mutationKey
|
|
849
853
|
};
|
|
850
|
-
this.#r =
|
|
854
|
+
this.#r = W({
|
|
851
855
|
fn: () => this.options.mutationFn ? this.options.mutationFn(t, s) : Promise.reject(new Error("No mutationFn found")),
|
|
852
856
|
onFail: (a, o) => {
|
|
853
857
|
this.#i({ type: "failed", failureCount: a, error: o });
|
|
@@ -1020,7 +1024,7 @@ function wt() {
|
|
|
1020
1024
|
submittedAt: 0
|
|
1021
1025
|
};
|
|
1022
1026
|
}
|
|
1023
|
-
var
|
|
1027
|
+
var Ct = class extends T {
|
|
1024
1028
|
constructor(t = {}) {
|
|
1025
1029
|
super(), this.config = t, this.#t = /* @__PURE__ */ new Set(), this.#e = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
1026
1030
|
}
|
|
@@ -1028,7 +1032,7 @@ var bt = class extends T {
|
|
|
1028
1032
|
#e;
|
|
1029
1033
|
#s;
|
|
1030
1034
|
build(t, e, s) {
|
|
1031
|
-
const i = new
|
|
1035
|
+
const i = new bt({
|
|
1032
1036
|
client: t,
|
|
1033
1037
|
mutationCache: this,
|
|
1034
1038
|
mutationId: ++this.#s,
|
|
@@ -1039,7 +1043,7 @@ var bt = class extends T {
|
|
|
1039
1043
|
}
|
|
1040
1044
|
add(t) {
|
|
1041
1045
|
this.#t.add(t);
|
|
1042
|
-
const e =
|
|
1046
|
+
const e = A(t);
|
|
1043
1047
|
if (typeof e == "string") {
|
|
1044
1048
|
const s = this.#e.get(e);
|
|
1045
1049
|
s ? s.push(t) : this.#e.set(e, [t]);
|
|
@@ -1048,7 +1052,7 @@ var bt = class extends T {
|
|
|
1048
1052
|
}
|
|
1049
1053
|
remove(t) {
|
|
1050
1054
|
if (this.#t.delete(t)) {
|
|
1051
|
-
const e =
|
|
1055
|
+
const e = A(t);
|
|
1052
1056
|
if (typeof e == "string") {
|
|
1053
1057
|
const s = this.#e.get(e);
|
|
1054
1058
|
if (s)
|
|
@@ -1061,7 +1065,7 @@ var bt = class extends T {
|
|
|
1061
1065
|
this.notify({ type: "removed", mutation: t });
|
|
1062
1066
|
}
|
|
1063
1067
|
canRun(t) {
|
|
1064
|
-
const e =
|
|
1068
|
+
const e = A(t);
|
|
1065
1069
|
if (typeof e == "string") {
|
|
1066
1070
|
const i = this.#e.get(e)?.find(
|
|
1067
1071
|
(n) => n.state.status === "pending"
|
|
@@ -1071,7 +1075,7 @@ var bt = class extends T {
|
|
|
1071
1075
|
return !0;
|
|
1072
1076
|
}
|
|
1073
1077
|
runNext(t) {
|
|
1074
|
-
const e =
|
|
1078
|
+
const e = A(t);
|
|
1075
1079
|
return typeof e == "string" ? this.#e.get(e)?.find((i) => i !== t && i.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
1076
1080
|
}
|
|
1077
1081
|
clear() {
|
|
@@ -1109,7 +1113,7 @@ var bt = class extends T {
|
|
|
1109
1113
|
);
|
|
1110
1114
|
}
|
|
1111
1115
|
};
|
|
1112
|
-
function
|
|
1116
|
+
function A(t) {
|
|
1113
1117
|
return t.options.scope?.id;
|
|
1114
1118
|
}
|
|
1115
1119
|
var Ot = class extends T {
|
|
@@ -1120,7 +1124,7 @@ var Ot = class extends T {
|
|
|
1120
1124
|
build(t, e, s) {
|
|
1121
1125
|
const i = e.queryKey, n = e.queryHash ?? j(i, e);
|
|
1122
1126
|
let a = this.get(n);
|
|
1123
|
-
return a || (a = new
|
|
1127
|
+
return a || (a = new mt({
|
|
1124
1128
|
client: t,
|
|
1125
1129
|
queryKey: i,
|
|
1126
1130
|
queryHash: n,
|
|
@@ -1183,7 +1187,7 @@ var Ot = class extends T {
|
|
|
1183
1187
|
});
|
|
1184
1188
|
});
|
|
1185
1189
|
}
|
|
1186
|
-
},
|
|
1190
|
+
}, Pt = class {
|
|
1187
1191
|
#t;
|
|
1188
1192
|
#e;
|
|
1189
1193
|
#s;
|
|
@@ -1193,12 +1197,12 @@ var Ot = class extends T {
|
|
|
1193
1197
|
#o;
|
|
1194
1198
|
#n;
|
|
1195
1199
|
constructor(t = {}) {
|
|
1196
|
-
this.#t = t.queryCache || new Ot(), this.#e = t.mutationCache || new
|
|
1200
|
+
this.#t = t.queryCache || new Ot(), this.#e = t.mutationCache || new Ct(), this.#s = t.defaultOptions || {}, this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
1197
1201
|
}
|
|
1198
1202
|
mount() {
|
|
1199
|
-
this.#a++, this.#a === 1 && (this.#o =
|
|
1203
|
+
this.#a++, this.#a === 1 && (this.#o = z.subscribe(async (t) => {
|
|
1200
1204
|
t && (await this.resumePausedMutations(), this.#t.onFocus());
|
|
1201
|
-
}), this.#n =
|
|
1205
|
+
}), this.#n = D.subscribe(async (t) => {
|
|
1202
1206
|
t && (await this.resumePausedMutations(), this.#t.onOnline());
|
|
1203
1207
|
}));
|
|
1204
1208
|
}
|
|
@@ -1235,7 +1239,7 @@ var Ot = class extends T {
|
|
|
1235
1239
|
setQueryData(t, e, s) {
|
|
1236
1240
|
const i = this.defaultQueryOptions({ queryKey: t }), a = this.#t.get(
|
|
1237
1241
|
i.queryHash
|
|
1238
|
-
)?.state.data, o =
|
|
1242
|
+
)?.state.data, o = et(e, a);
|
|
1239
1243
|
if (o !== void 0)
|
|
1240
1244
|
return this.#t.build(this, i).setData(o, { ...s, manual: !0 });
|
|
1241
1245
|
}
|
|
@@ -1314,16 +1318,16 @@ var Ot = class extends T {
|
|
|
1314
1318
|
return this.fetchQuery(t).then(v).catch(v);
|
|
1315
1319
|
}
|
|
1316
1320
|
fetchInfiniteQuery(t) {
|
|
1317
|
-
return t.behavior =
|
|
1321
|
+
return t.behavior = V(t.pages), this.fetchQuery(t);
|
|
1318
1322
|
}
|
|
1319
1323
|
prefetchInfiniteQuery(t) {
|
|
1320
1324
|
return this.fetchInfiniteQuery(t).then(v).catch(v);
|
|
1321
1325
|
}
|
|
1322
1326
|
ensureInfiniteQueryData(t) {
|
|
1323
|
-
return t.behavior =
|
|
1327
|
+
return t.behavior = V(t.pages), this.ensureQueryData(t);
|
|
1324
1328
|
}
|
|
1325
1329
|
resumePausedMutations() {
|
|
1326
|
-
return
|
|
1330
|
+
return D.isOnline() ? this.#e.resumePausedMutations() : Promise.resolve();
|
|
1327
1331
|
}
|
|
1328
1332
|
getQueryCache() {
|
|
1329
1333
|
return this.#t;
|
|
@@ -1338,7 +1342,7 @@ var Ot = class extends T {
|
|
|
1338
1342
|
this.#s = t;
|
|
1339
1343
|
}
|
|
1340
1344
|
setQueryDefaults(t, e) {
|
|
1341
|
-
this.#r.set(
|
|
1345
|
+
this.#r.set(P(t), {
|
|
1342
1346
|
queryKey: t,
|
|
1343
1347
|
defaultOptions: e
|
|
1344
1348
|
});
|
|
@@ -1350,7 +1354,7 @@ var Ot = class extends T {
|
|
|
1350
1354
|
}), s;
|
|
1351
1355
|
}
|
|
1352
1356
|
setMutationDefaults(t, e) {
|
|
1353
|
-
this.#i.set(
|
|
1357
|
+
this.#i.set(P(t), {
|
|
1354
1358
|
mutationKey: t,
|
|
1355
1359
|
defaultOptions: e
|
|
1356
1360
|
});
|
|
@@ -1387,14 +1391,14 @@ var Ot = class extends T {
|
|
|
1387
1391
|
this.#t.clear(), this.#e.clear();
|
|
1388
1392
|
}
|
|
1389
1393
|
};
|
|
1390
|
-
class
|
|
1394
|
+
class C {
|
|
1391
1395
|
constructor(e = {}) {
|
|
1392
|
-
this.availableDatasets = [], this.apiUrl = e.apiUrl || "https://api.luzmo.com", this.apiVersion = e.apiVersion || "0.1.0", this.authKey = e.authKey || "", this.authToken = e.authToken || "", this.queryClient = new
|
|
1396
|
+
this.availableDatasets = [], this.apiUrl = e.apiUrl || "https://api.luzmo.com", this.apiVersion = e.apiVersion || "0.1.0", this.authKey = e.authKey || "", this.authToken = e.authToken || "", this.queryClient = new Pt({
|
|
1393
1397
|
defaultOptions: {
|
|
1394
1398
|
queries: {
|
|
1395
|
-
staleTime: e.staleTime ||
|
|
1399
|
+
staleTime: e.staleTime || 300 * 1e3,
|
|
1396
1400
|
// 5 minutes
|
|
1397
|
-
gcTime: e.gcTime ||
|
|
1401
|
+
gcTime: e.gcTime || 600 * 1e3,
|
|
1398
1402
|
// 10 minutes
|
|
1399
1403
|
retry: e.retry || 3,
|
|
1400
1404
|
retryDelay: e.retryDelay || ((s) => Math.min(1e3 * 2 ** s, 3e4))
|
|
@@ -1488,12 +1492,9 @@ class O {
|
|
|
1488
1492
|
limit: i,
|
|
1489
1493
|
offset: s
|
|
1490
1494
|
}
|
|
1491
|
-
}, o = await this.fetchApi(
|
|
1492
|
-
"/securable",
|
|
1493
|
-
a
|
|
1494
|
-
);
|
|
1495
|
+
}, o = await this.fetchApi("/securable", a);
|
|
1495
1496
|
return {
|
|
1496
|
-
data: o?.rows
|
|
1497
|
+
data: o?.rows ?? [],
|
|
1497
1498
|
pagination: {
|
|
1498
1499
|
offset: s,
|
|
1499
1500
|
limit: i,
|
|
@@ -1510,7 +1511,8 @@ class O {
|
|
|
1510
1511
|
* @returns List of matching datasets
|
|
1511
1512
|
*/
|
|
1512
1513
|
async searchDatasets(e, s) {
|
|
1513
|
-
if (!e)
|
|
1514
|
+
if (!e)
|
|
1515
|
+
return { data: [] };
|
|
1514
1516
|
const i = ["datasets", "search", e, s];
|
|
1515
1517
|
return await this.queryClient.fetchQuery({
|
|
1516
1518
|
queryKey: i,
|
|
@@ -1528,11 +1530,8 @@ class O {
|
|
|
1528
1530
|
match_types: ["name"],
|
|
1529
1531
|
keyphrase: e
|
|
1530
1532
|
}), s?.offset && (n.find.offset = s?.offset), s?.limit && (n.find.limit = s?.limit);
|
|
1531
|
-
const a = await this.fetchApi(
|
|
1532
|
-
|
|
1533
|
-
n
|
|
1534
|
-
), o = {
|
|
1535
|
-
data: a?.rows || []
|
|
1533
|
+
const a = await this.fetchApi("/securable", n), o = {
|
|
1534
|
+
data: a?.rows ?? []
|
|
1536
1535
|
};
|
|
1537
1536
|
return s?.limit && (o.pagination = {
|
|
1538
1537
|
offset: s?.offset ?? 0,
|
|
@@ -1544,19 +1543,18 @@ class O {
|
|
|
1544
1543
|
});
|
|
1545
1544
|
}
|
|
1546
1545
|
/**
|
|
1547
|
-
*
|
|
1548
|
-
* @param
|
|
1549
|
-
* @returns
|
|
1546
|
+
* Fetches multiple datasets with their associated columns and formulas metadata
|
|
1547
|
+
* @param datasetIds - Array of dataset IDs to fetch
|
|
1548
|
+
* @returns Promise that resolves to an array of DatasetMetadata objects containing:
|
|
1549
|
+
* - Basic dataset info (id, name, description)
|
|
1550
|
+
* - Columns with metadata including joins, hierarchy levels, and currency info
|
|
1551
|
+
* - Formulas with their expressions and currency associations
|
|
1552
|
+
* @throws Error if datasetIds is empty or null
|
|
1550
1553
|
*/
|
|
1551
1554
|
async fetchDatasetsWithColumnsAndFormulas(e) {
|
|
1552
1555
|
if (!e || e.length === 0)
|
|
1553
1556
|
throw new Error("At least one dataset ID is required");
|
|
1554
|
-
const s = [
|
|
1555
|
-
"datasets",
|
|
1556
|
-
e,
|
|
1557
|
-
this.authKey,
|
|
1558
|
-
this.authToken
|
|
1559
|
-
];
|
|
1557
|
+
const s = ["datasets", e, this.authKey, this.authToken];
|
|
1560
1558
|
return await this.queryClient.fetchQuery({
|
|
1561
1559
|
queryKey: s,
|
|
1562
1560
|
queryFn: async () => {
|
|
@@ -1570,7 +1568,7 @@ class O {
|
|
|
1570
1568
|
in: e
|
|
1571
1569
|
}
|
|
1572
1570
|
},
|
|
1573
|
-
attributes: ["name", "id"],
|
|
1571
|
+
attributes: ["name", "id", "description"],
|
|
1574
1572
|
include: [
|
|
1575
1573
|
{
|
|
1576
1574
|
model: "Column",
|
|
@@ -1583,7 +1581,9 @@ class O {
|
|
|
1583
1581
|
"format",
|
|
1584
1582
|
"hidden",
|
|
1585
1583
|
"lowestLevel",
|
|
1586
|
-
"expression"
|
|
1584
|
+
"expression",
|
|
1585
|
+
"duration_levels",
|
|
1586
|
+
"duration_format"
|
|
1587
1587
|
],
|
|
1588
1588
|
separate: !0,
|
|
1589
1589
|
order: [["order", "asc"]],
|
|
@@ -1597,6 +1597,16 @@ class O {
|
|
|
1597
1597
|
"currency_id"
|
|
1598
1598
|
],
|
|
1599
1599
|
as: "Joins"
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
model: "HierarchyLevel",
|
|
1603
|
+
attributes: ["id", "level", "name"],
|
|
1604
|
+
as: "HierarchyLevels"
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
model: "Currency",
|
|
1608
|
+
attributes: ["id", "name", "symbol"],
|
|
1609
|
+
as: "Currency"
|
|
1600
1610
|
}
|
|
1601
1611
|
]
|
|
1602
1612
|
},
|
|
@@ -1611,53 +1621,22 @@ class O {
|
|
|
1611
1621
|
"format",
|
|
1612
1622
|
"hidden",
|
|
1613
1623
|
"lowestLevel",
|
|
1614
|
-
"expression"
|
|
1624
|
+
"expression",
|
|
1625
|
+
"duration_levels",
|
|
1626
|
+
"duration_format"
|
|
1627
|
+
],
|
|
1628
|
+
include: [
|
|
1629
|
+
{
|
|
1630
|
+
model: "Currency",
|
|
1631
|
+
attributes: ["id", "name", "symbol"],
|
|
1632
|
+
as: "Currency"
|
|
1633
|
+
}
|
|
1615
1634
|
]
|
|
1616
1635
|
}
|
|
1617
1636
|
]
|
|
1618
1637
|
}
|
|
1619
1638
|
};
|
|
1620
|
-
return (await this.fetchApi(
|
|
1621
|
-
"/securable",
|
|
1622
|
-
i
|
|
1623
|
-
))?.rows || [];
|
|
1624
|
-
}
|
|
1625
|
-
});
|
|
1626
|
-
}
|
|
1627
|
-
/**
|
|
1628
|
-
* Fetch a specific dataset by ID
|
|
1629
|
-
* @param datasetId - Dataset ID
|
|
1630
|
-
* @returns Dataset details
|
|
1631
|
-
*/
|
|
1632
|
-
async fetchDataset(e) {
|
|
1633
|
-
if (!e) throw new Error("Dataset ID is required");
|
|
1634
|
-
const s = ["dataset", e];
|
|
1635
|
-
return await this.queryClient.fetchQuery({
|
|
1636
|
-
queryKey: s,
|
|
1637
|
-
queryFn: async () => {
|
|
1638
|
-
const i = {
|
|
1639
|
-
action: "get",
|
|
1640
|
-
version: this.apiVersion,
|
|
1641
|
-
find: {
|
|
1642
|
-
where: {
|
|
1643
|
-
type: "dataset",
|
|
1644
|
-
id: e
|
|
1645
|
-
},
|
|
1646
|
-
attributes: ["name", "id"],
|
|
1647
|
-
include: [
|
|
1648
|
-
{
|
|
1649
|
-
model: "Column"
|
|
1650
|
-
},
|
|
1651
|
-
{
|
|
1652
|
-
model: "Formula"
|
|
1653
|
-
}
|
|
1654
|
-
]
|
|
1655
|
-
}
|
|
1656
|
-
};
|
|
1657
|
-
return (await this.fetchApi(
|
|
1658
|
-
"/securable",
|
|
1659
|
-
i
|
|
1660
|
-
))?.rows?.[0] || null;
|
|
1639
|
+
return (await this.fetchApi("/securable", i))?.rows ?? [];
|
|
1661
1640
|
}
|
|
1662
1641
|
});
|
|
1663
1642
|
}
|
|
@@ -1712,7 +1691,7 @@ class O {
|
|
|
1712
1691
|
* @returns Singleton instance
|
|
1713
1692
|
*/
|
|
1714
1693
|
static getInstance(e = {}) {
|
|
1715
|
-
return
|
|
1694
|
+
return C.instance ? Object.keys(e).length > 0 && C.instance.configure(e) : C.instance = new C(e), C.instance;
|
|
1716
1695
|
}
|
|
1717
1696
|
async fetchDatasetsRecursive(e) {
|
|
1718
1697
|
if (!e || e.length === 0)
|
|
@@ -1730,7 +1709,7 @@ class O {
|
|
|
1730
1709
|
try {
|
|
1731
1710
|
(await this.fetchDatasetsWithColumnsAndFormulas(o)).forEach((u) => {
|
|
1732
1711
|
const h = this.postProcessDatasetMetadata(u);
|
|
1733
|
-
i.add(h.id), this.queryClient.setQueryData(["dataset", h.id], h), (h.outgoingJoins ?? []).map((l) => l.securable_id).filter((l) => l && l !== h.id).forEach((l) => {
|
|
1712
|
+
i.add(h.id), this.queryClient.setQueryData(["dataset", h.id], h), (h.outgoingJoins ?? []).map((l) => l.securable_id).filter((l) => !!l && l !== h.id).forEach((l) => {
|
|
1734
1713
|
a(l);
|
|
1735
1714
|
}), n.set(h.id, h), this.availableDatasets.some((l) => l.id === h.id) || this.availableDatasets.push({
|
|
1736
1715
|
id: h.id,
|
|
@@ -1745,22 +1724,32 @@ class O {
|
|
|
1745
1724
|
return [...n.values()];
|
|
1746
1725
|
}
|
|
1747
1726
|
postProcessDatasetMetadata(e) {
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1727
|
+
const s = [], i = (e.columns ?? []).map((n) => {
|
|
1728
|
+
const a = n.joins ?? (Array.isArray(n.joins) ? n.joins : []);
|
|
1729
|
+
Array.isArray(a) && a.length > 0 && s.push(...a);
|
|
1730
|
+
const { joins: o, ...r } = n;
|
|
1731
|
+
return {
|
|
1732
|
+
...r,
|
|
1733
|
+
joins: a
|
|
1734
|
+
};
|
|
1735
|
+
});
|
|
1736
|
+
return {
|
|
1737
|
+
...e,
|
|
1738
|
+
columns: i,
|
|
1739
|
+
formulas: e.formulas ?? [],
|
|
1740
|
+
outgoingJoins: s,
|
|
1741
|
+
dateLoaded: /* @__PURE__ */ new Date()
|
|
1742
|
+
};
|
|
1754
1743
|
}
|
|
1755
1744
|
getAvailableDatasets() {
|
|
1756
1745
|
return this.availableDatasets;
|
|
1757
1746
|
}
|
|
1758
1747
|
getLinkedDatasetsIds(e) {
|
|
1759
1748
|
const s = this.queryClient.getQueryData(["dataset", e]);
|
|
1760
|
-
return s ? (s.outgoingJoins ?? []).map((i) => i.securable_id).filter((i) => i && i !== e) : [];
|
|
1749
|
+
return s ? (s.outgoingJoins ?? []).map((i) => i.securable_id).filter((i) => !!i && i !== e) : [];
|
|
1761
1750
|
}
|
|
1762
1751
|
}
|
|
1763
|
-
const
|
|
1752
|
+
const Ft = C.getInstance();
|
|
1764
1753
|
export {
|
|
1765
|
-
|
|
1754
|
+
Ft as d
|
|
1766
1755
|
};
|