@epam/statgpt-sdmx-toolkit 0.2.0-rc.40 → 0.2.0-rc.42
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/index.cjs +2 -2
- package/index.mjs +544 -584
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -1,85 +1,84 @@
|
|
|
1
|
-
const
|
|
1
|
+
const v = (e) => {
|
|
2
2
|
if (e != null) {
|
|
3
3
|
const t = e.split("=");
|
|
4
4
|
return t.length === 1 ? e : t[1];
|
|
5
5
|
}
|
|
6
|
-
},
|
|
7
|
-
var s;
|
|
6
|
+
}, D = (e) => {
|
|
8
7
|
if (e == null)
|
|
9
8
|
return {};
|
|
10
|
-
const t =
|
|
9
|
+
const t = v(e), n = {
|
|
11
10
|
agency: "",
|
|
12
11
|
id: "",
|
|
13
12
|
version: ""
|
|
14
13
|
};
|
|
15
|
-
return t && (t.includes(":") && (n.agency = t.split(":")[0], n.id = t.split(":")[1].split("(")[0]), t.includes("(") && t.includes(")") && (n.version =
|
|
16
|
-
},
|
|
17
|
-
const [t, n] = e.split(")."), { agency: s, id: r, version: o } =
|
|
14
|
+
return t && (t.includes(":") && (n.agency = t.split(":")[0], n.id = t.split(":")[1].split("(")[0]), t.includes("(") && t.includes(")") && (n.version = t.split("(")[1]?.split(")")[0])), n;
|
|
15
|
+
}, we = (e) => {
|
|
16
|
+
const [t, n] = e.split(")."), { agency: s, id: r, version: o } = D(t + ")");
|
|
18
17
|
return { childId: n, agency: s, id: r, version: o };
|
|
19
|
-
},
|
|
18
|
+
}, gn = (e, t, n) => {
|
|
20
19
|
const s = t === "" ? "" : `(${t})`;
|
|
21
20
|
return `${n}:${e}${s}`;
|
|
22
21
|
};
|
|
23
|
-
var
|
|
24
|
-
const
|
|
25
|
-
class
|
|
22
|
+
var L = /* @__PURE__ */ ((e) => (e.DESCENDANTS = "descendants", e.NONE = "none", e.ALL = "all", e))(L || {}), me = /* @__PURE__ */ ((e) => (e.EXACT = "exact", e.AVAILABLE = "available", e))(me || {});
|
|
23
|
+
const Ie = (e = "", t = "", n = "") => `sdmx/3.0/availability/dataflow/${e}/${t}/${n}`;
|
|
24
|
+
class hn {
|
|
26
25
|
constructor(t) {
|
|
27
26
|
this.client = t;
|
|
28
27
|
}
|
|
29
28
|
async getConstraints(t, n) {
|
|
30
|
-
const { agency: s, id: r, version: o } =
|
|
29
|
+
const { agency: s, id: r, version: o } = D(t), i = {
|
|
31
30
|
filters: n || [],
|
|
32
|
-
mode:
|
|
33
|
-
references:
|
|
34
|
-
}, c =
|
|
31
|
+
mode: me.AVAILABLE,
|
|
32
|
+
references: L.NONE
|
|
33
|
+
}, c = Ie(s, r, o);
|
|
35
34
|
return await this.client.postRequest(c, { body: i });
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
var
|
|
39
|
-
const
|
|
37
|
+
var S = /* @__PURE__ */ ((e) => (e.CSV = "csv", e.JSON = "json", e.XML = "xml", e))(S || {}), Ne = /* @__PURE__ */ ((e) => (e.ID = "id", e.NAME = "name", e.ID_NAME = "both", e))(Ne || {}), $e = /* @__PURE__ */ ((e) => (e.FULL_DATASET = "full", e.DATA_IN_TABLE = "query", e))($e || {});
|
|
38
|
+
const Pe = (e, t) => {
|
|
40
39
|
switch (e) {
|
|
41
|
-
case
|
|
42
|
-
return
|
|
40
|
+
case S.CSV:
|
|
41
|
+
return A(
|
|
43
42
|
"application/vnd.sdmx.data+csv;version=2.0.0",
|
|
44
43
|
t
|
|
45
44
|
);
|
|
46
|
-
case
|
|
47
|
-
return
|
|
45
|
+
case S.XML:
|
|
46
|
+
return A(
|
|
48
47
|
"application/vnd.sdmx.data+xml;version=3.0.0",
|
|
49
48
|
t
|
|
50
49
|
);
|
|
51
|
-
case
|
|
52
|
-
return
|
|
50
|
+
case S.JSON:
|
|
51
|
+
return A(`application/${e}`, t);
|
|
53
52
|
default:
|
|
54
|
-
return
|
|
53
|
+
return A(
|
|
55
54
|
"application/vnd.sdmx.data+csv;version=2.0.0",
|
|
56
55
|
t
|
|
57
56
|
);
|
|
58
57
|
}
|
|
59
|
-
},
|
|
60
|
-
var
|
|
61
|
-
const
|
|
62
|
-
const { filterKey: s, timeFilter: r } = n, { agency: o, id: i, version: c } =
|
|
63
|
-
return `${`${
|
|
64
|
-
},
|
|
58
|
+
}, A = (e, t) => `${e}; labels=${t}`;
|
|
59
|
+
var fe = /* @__PURE__ */ ((e) => (e.REFERENCE_PARTIAL = "referencepartial", e.FULL = "full", e))(fe || {});
|
|
60
|
+
const be = "all", _e = "sdmx/3.0/data/dataflow", ge = "&", J = ":", Oe = "=", Le = "+", En = ",", Me = "*", X = (e, t, n) => {
|
|
61
|
+
const { filterKey: s, timeFilter: r } = n, { agency: o, id: i, version: c } = D(e), a = [r || "", t].filter((d) => !!d).join(ge);
|
|
62
|
+
return `${`${_e}/${o}/${i}/${c}`}/${s || Me}?${a}`;
|
|
63
|
+
}, Ce = (e = "", t = "", n = "", s = L.DESCENDANTS) => `sdmx/3.0/structure/dataflow/${e}/${t}/${n}?references=${s}&detail=${fe.REFERENCE_PARTIAL}`;
|
|
65
64
|
class pn {
|
|
66
65
|
constructor(t) {
|
|
67
66
|
this.client = t;
|
|
68
67
|
}
|
|
69
68
|
async getDataSet(t, n) {
|
|
70
|
-
const { agency: s, id: r, version: o } =
|
|
69
|
+
const { agency: s, id: r, version: o } = D(t);
|
|
71
70
|
return await this.client.getRequest(
|
|
72
|
-
|
|
71
|
+
Ce(s, r, o, n)
|
|
73
72
|
);
|
|
74
73
|
}
|
|
75
74
|
async getDatasetData(t, n) {
|
|
76
75
|
const s = new URLSearchParams({
|
|
77
76
|
includeHistory: "false",
|
|
78
77
|
limit: "1000",
|
|
79
|
-
attributes:
|
|
78
|
+
attributes: be,
|
|
80
79
|
dimensionAtObservation: "TIME_PERIOD"
|
|
81
80
|
// TODO: use time dimensions
|
|
82
|
-
}).toString(), r =
|
|
81
|
+
}).toString(), r = X(t, s, n);
|
|
83
82
|
return await this.client.getRequest(r);
|
|
84
83
|
}
|
|
85
84
|
async downloadDataSet(t, n, s, r, o, i, c = !1) {
|
|
@@ -88,13 +87,13 @@ class pn {
|
|
|
88
87
|
compress: "false",
|
|
89
88
|
attributes: c ? "all" : "none",
|
|
90
89
|
limit: "1000"
|
|
91
|
-
}).toString(), u =
|
|
90
|
+
}).toString(), u = X(t, a, o);
|
|
92
91
|
return this.client.streamRequest(
|
|
93
92
|
u,
|
|
94
93
|
{
|
|
95
94
|
method: "GET",
|
|
96
95
|
headers: {
|
|
97
|
-
Accept:
|
|
96
|
+
Accept: Pe(n, r),
|
|
98
97
|
"Accept-language": s
|
|
99
98
|
}
|
|
100
99
|
},
|
|
@@ -102,31 +101,31 @@ class pn {
|
|
|
102
101
|
);
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
|
-
const
|
|
106
|
-
class
|
|
104
|
+
const Ue = (e, t) => e.error || e.message || `${t.status} ${t.statusText}`, xe = "application/json", Ye = "Content-Type", P = "Api-Key", We = "X-CONVERSATION-ID", T = "Ocp-Apim-Subscription-Key";
|
|
105
|
+
class Z extends Error {
|
|
107
106
|
constructor(t) {
|
|
108
107
|
super(t.message), this.isHttpError = !0, this.name = "HttpError", this.code = t.code, this.status = t.status, this.details = t.details;
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
|
-
const
|
|
110
|
+
const y = (e) => isNaN(Date.parse(e)) ? null : new Date(e), b = (e, t, n) => {
|
|
112
111
|
const s = {
|
|
113
|
-
[
|
|
112
|
+
[Ye]: t?.contentType || xe
|
|
114
113
|
};
|
|
115
|
-
return t
|
|
116
|
-
},
|
|
114
|
+
return t?.jwt && (s.Authorization = `Bearer ${t.jwt}`), t?.chatReference && (s[We] = t.chatReference), { ...s, ...n };
|
|
115
|
+
}, ke = (e) => {
|
|
117
116
|
const t = { ...e };
|
|
118
|
-
return t[
|
|
119
|
-
},
|
|
117
|
+
return t[P] && (t[P] = t[P].substring(0, 8) + "...[REDACTED]"), t.Authorization && (t.Authorization = "Bearer [REDACTED]"), t[T] && (t[T] = t[T].substring(0, 8) + "...[REDACTED]"), t;
|
|
118
|
+
}, ee = async (e, t, n) => await fetch(e, {
|
|
120
119
|
method: n.method || "GET",
|
|
121
120
|
headers: t,
|
|
122
121
|
body: n.body ? JSON.stringify(n.body) : void 0
|
|
123
|
-
}),
|
|
122
|
+
}), qe = async (e, t, n) => await fetch(e, {
|
|
124
123
|
method: n.method,
|
|
125
124
|
headers: t,
|
|
126
|
-
body: n
|
|
127
|
-
signal: n
|
|
125
|
+
body: n?.isFormData && typeof n?.body == "string" ? n.body : JSON.stringify(n.body),
|
|
126
|
+
signal: n?.signal
|
|
128
127
|
});
|
|
129
|
-
class
|
|
128
|
+
class Qe {
|
|
130
129
|
constructor() {
|
|
131
130
|
this.decoder = new TextDecoder();
|
|
132
131
|
}
|
|
@@ -139,15 +138,15 @@ class je {
|
|
|
139
138
|
a,
|
|
140
139
|
r
|
|
141
140
|
);
|
|
142
|
-
await this.processStreamData(u, o), c
|
|
141
|
+
await this.processStreamData(u, o), c?.();
|
|
143
142
|
} catch (u) {
|
|
144
143
|
this.handleStreamError(u, i);
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
async initializeStreamRequest(t, n, s, r) {
|
|
148
|
-
const o =
|
|
147
|
+
const o = b(void 0, {
|
|
149
148
|
jwt: r
|
|
150
|
-
}), i = await
|
|
149
|
+
}), i = await qe(
|
|
151
150
|
t,
|
|
152
151
|
{
|
|
153
152
|
Accept: "text/event-stream",
|
|
@@ -167,13 +166,13 @@ class je {
|
|
|
167
166
|
} catch {
|
|
168
167
|
a.error = "Failed to parse error body";
|
|
169
168
|
}
|
|
170
|
-
throw new
|
|
169
|
+
throw new Z({
|
|
171
170
|
status: i.status,
|
|
172
171
|
message: a.error ?? "No response body"
|
|
173
172
|
});
|
|
174
173
|
}
|
|
175
174
|
if (!i.body)
|
|
176
|
-
throw new
|
|
175
|
+
throw new Z({
|
|
177
176
|
message: "No response body",
|
|
178
177
|
status: i.status
|
|
179
178
|
});
|
|
@@ -202,7 +201,7 @@ class je {
|
|
|
202
201
|
}
|
|
203
202
|
handleStreamError(t, n) {
|
|
204
203
|
const s = t instanceof Error ? t : new Error(String(t));
|
|
205
|
-
throw n
|
|
204
|
+
throw n?.(s), s;
|
|
206
205
|
}
|
|
207
206
|
parseSSEDataLine(t, n) {
|
|
208
207
|
const s = t.trim();
|
|
@@ -218,12 +217,12 @@ class je {
|
|
|
218
217
|
} catch (i) {
|
|
219
218
|
console.error(`Failed to parse SSE data: ${r} ${i}`);
|
|
220
219
|
}
|
|
221
|
-
n
|
|
220
|
+
n?.(o);
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
223
|
}
|
|
225
|
-
new
|
|
226
|
-
class
|
|
224
|
+
new Qe();
|
|
225
|
+
class Dn {
|
|
227
226
|
constructor(t) {
|
|
228
227
|
this.config = t, console.info("SdmxApiClient initialized", {
|
|
229
228
|
apiUrl: t.apiUrl || "NOT SET"
|
|
@@ -237,34 +236,33 @@ class mn {
|
|
|
237
236
|
}
|
|
238
237
|
async streamRequest(t, n, s) {
|
|
239
238
|
const r = `${this.config.apiUrl}/${t}`, o = {
|
|
240
|
-
...
|
|
239
|
+
...b(void 0, {
|
|
241
240
|
jwt: this.config.jwt
|
|
242
241
|
}),
|
|
243
242
|
...n.headers
|
|
244
243
|
};
|
|
245
|
-
this.config.apiKey != null && (o[
|
|
244
|
+
this.config.apiKey != null && (o[T] = this.config.apiKey);
|
|
246
245
|
const i = new ReadableStream({
|
|
247
246
|
async start(a) {
|
|
248
|
-
var u;
|
|
249
247
|
try {
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
252
|
-
const
|
|
248
|
+
const u = await ee(r, o, n);
|
|
249
|
+
if (!u.ok) {
|
|
250
|
+
const f = await u.text();
|
|
253
251
|
throw console.error(
|
|
254
|
-
`Fetch failed! Status: ${
|
|
255
|
-
), new Error(`Fetch failed with status ${
|
|
252
|
+
`Fetch failed! Status: ${u.status}, Body: ${f}`
|
|
253
|
+
), new Error(`Fetch failed with status ${u.status}`);
|
|
256
254
|
}
|
|
257
|
-
const
|
|
258
|
-
if (!
|
|
259
|
-
const
|
|
260
|
-
a.enqueue(
|
|
261
|
-
const
|
|
262
|
-
const { done:
|
|
263
|
-
|
|
255
|
+
const d = u.body?.getReader();
|
|
256
|
+
if (!d) throw new Error("Failed to create stream reader");
|
|
257
|
+
const l = new Uint8Array([239, 187, 191]);
|
|
258
|
+
a.enqueue(l);
|
|
259
|
+
const m = async () => {
|
|
260
|
+
const { done: f, value: E } = await d.read();
|
|
261
|
+
f ? a.close() : (a.enqueue(E), await m());
|
|
264
262
|
};
|
|
265
|
-
|
|
266
|
-
} catch (
|
|
267
|
-
a.error(
|
|
263
|
+
m();
|
|
264
|
+
} catch (u) {
|
|
265
|
+
a.error(u);
|
|
268
266
|
}
|
|
269
267
|
}
|
|
270
268
|
}), c = new Headers({
|
|
@@ -274,14 +272,14 @@ class mn {
|
|
|
274
272
|
}
|
|
275
273
|
async request(t, n) {
|
|
276
274
|
const s = Date.now(), r = t.includes("availability") && this.config.constrainsApiUrl ? `${this.config.constrainsApiUrl}/${t}` : `${this.config.apiUrl}/${t}`, o = {
|
|
277
|
-
...
|
|
275
|
+
...b(void 0, {
|
|
278
276
|
jwt: this.config.jwt
|
|
279
277
|
}),
|
|
280
278
|
...n.headers
|
|
281
279
|
};
|
|
282
280
|
this.config.apiKey != null && (o["Ocp-Apim-Subscription-Key"] = this.config.apiKey), this.addInfoRequestLog("API Request", r, n, o);
|
|
283
281
|
try {
|
|
284
|
-
const i = await
|
|
282
|
+
const i = await ee(r, o, n), c = Date.now() - s;
|
|
285
283
|
let a;
|
|
286
284
|
const u = await i.text();
|
|
287
285
|
try {
|
|
@@ -301,8 +299,8 @@ class mn {
|
|
|
301
299
|
}
|
|
302
300
|
if (!i.ok) {
|
|
303
301
|
this.addErrorRequestLog(r, n, i, c, a);
|
|
304
|
-
const
|
|
305
|
-
throw new Error(`API request failed: ${
|
|
302
|
+
const d = Ue(a, i);
|
|
303
|
+
throw new Error(`API request failed: ${d}`);
|
|
306
304
|
}
|
|
307
305
|
return a;
|
|
308
306
|
} catch (i) {
|
|
@@ -319,7 +317,7 @@ class mn {
|
|
|
319
317
|
const o = {
|
|
320
318
|
method: s.method || "GET",
|
|
321
319
|
url: n,
|
|
322
|
-
headers:
|
|
320
|
+
headers: ke(r)
|
|
323
321
|
};
|
|
324
322
|
s.body && (o.body = s.body), console.info(t, o);
|
|
325
323
|
}
|
|
@@ -345,129 +343,121 @@ class mn {
|
|
|
345
343
|
});
|
|
346
344
|
}
|
|
347
345
|
}
|
|
348
|
-
const
|
|
349
|
-
var
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const d = h.relationship.dimensions, { codedSeriesKey: g, decodedSeriesKey: E } = Re(
|
|
346
|
+
const An = ["FREQ", "FREQUENCY"];
|
|
347
|
+
var Ve = /* @__PURE__ */ ((e) => (e.CONDITIONAL = "Conditional", e.MANDATORY = "Mandatory", e))(Ve || {}), M = /* @__PURE__ */ ((e) => (e.DIMENSION = "Dimension", e.MEASURE_DIMENSION = "MeasureDimension", e.TIME_DIMENSION = "TimeDimension", e))(M || {}), Be = /* @__PURE__ */ ((e) => (e.UNBOUNDED = "unbounded", e))(Be || {});
|
|
348
|
+
const Fe = (e, t) => {
|
|
349
|
+
const n = e?.data?.dataSets?.[0], r = e?.data?.structures?.[0]?.attributes?.dimensionGroup || [], o = n?.dimensionGroupAttributes, i = {};
|
|
350
|
+
for (const c of r) {
|
|
351
|
+
const a = c.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } = he(
|
|
355
352
|
e,
|
|
356
353
|
t,
|
|
357
|
-
|
|
354
|
+
a
|
|
358
355
|
);
|
|
359
|
-
i[
|
|
360
|
-
values:
|
|
361
|
-
decodedSeriesKey:
|
|
362
|
-
codedSeriesKey:
|
|
356
|
+
i[c.id] = {
|
|
357
|
+
values: o?.[u] || [],
|
|
358
|
+
decodedSeriesKey: d,
|
|
359
|
+
codedSeriesKey: u
|
|
363
360
|
};
|
|
364
361
|
}
|
|
365
362
|
return i;
|
|
366
|
-
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
...
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
(d) => d.id === f || d.value === f
|
|
363
|
+
}, he = (e, t, n) => {
|
|
364
|
+
const s = e?.data?.structures?.[0], r = [
|
|
365
|
+
...s?.dimensions.series || [],
|
|
366
|
+
...s?.dimensions.observation || []
|
|
367
|
+
], o = new Array(r?.length), i = new Array(r?.length);
|
|
368
|
+
return n?.forEach((c) => {
|
|
369
|
+
const a = r?.findIndex((l) => l.id === c) || 0, u = t[a], d = r[a].values.findIndex(
|
|
370
|
+
(l) => l.id === u || l.value === u
|
|
375
371
|
) || 0;
|
|
376
|
-
o[
|
|
372
|
+
o[a] = d >= 0 ? d : u, i[a] = u;
|
|
377
373
|
}), {
|
|
378
374
|
codedSeriesKey: o.join(":"),
|
|
379
375
|
decodedSeriesKey: i.join(":")
|
|
380
376
|
};
|
|
381
|
-
},
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
), i = s == null ? void 0 : s.dimensionGroupAttributes, c = [
|
|
389
|
-
...(r == null ? void 0 : r.dimensions.series) || [],
|
|
390
|
-
...(r == null ? void 0 : r.dimensions.observation) || []
|
|
391
|
-
], a = c == null ? void 0 : c.findIndex((D) => D.id === t), u = new Array(c == null ? void 0 : c.length);
|
|
377
|
+
}, yn = (e, t, n) => {
|
|
378
|
+
const s = e?.data?.dataSets?.[0], r = e?.data?.structures?.[0], o = (r?.attributes?.dimensionGroup || []).filter(
|
|
379
|
+
(l) => l.relationship.dimensions?.length === 1 && l.relationship.dimensions.includes(t || "")
|
|
380
|
+
), i = s?.dimensionGroupAttributes, c = [
|
|
381
|
+
...r?.dimensions.series || [],
|
|
382
|
+
...r?.dimensions.observation || []
|
|
383
|
+
], a = c?.findIndex((l) => l.id === t), u = new Array(c?.length);
|
|
392
384
|
u[a] = n || "";
|
|
393
|
-
const
|
|
394
|
-
for (const
|
|
395
|
-
const
|
|
385
|
+
const d = {};
|
|
386
|
+
for (const l of o) {
|
|
387
|
+
const m = l.relationship.dimensions, { codedSeriesKey: f, decodedSeriesKey: E } = he(
|
|
396
388
|
e,
|
|
397
389
|
u,
|
|
398
|
-
|
|
390
|
+
m
|
|
399
391
|
);
|
|
400
|
-
l
|
|
401
|
-
values:
|
|
402
|
-
decodedSeriesKey:
|
|
403
|
-
codedSeriesKey:
|
|
392
|
+
d[l.id] = {
|
|
393
|
+
values: i?.[f] || [],
|
|
394
|
+
decodedSeriesKey: E,
|
|
395
|
+
codedSeriesKey: f
|
|
404
396
|
};
|
|
405
397
|
}
|
|
406
|
-
return
|
|
407
|
-
},
|
|
408
|
-
var s;
|
|
398
|
+
return d;
|
|
399
|
+
}, Ge = (e, t) => {
|
|
409
400
|
if (t == null)
|
|
410
401
|
return;
|
|
411
|
-
const n =
|
|
402
|
+
const n = e.values?.[t];
|
|
412
403
|
return n ?? (t instanceof Array ? { values: t } : { value: t.toString() });
|
|
413
|
-
},
|
|
414
|
-
|
|
415
|
-
const t = (u = e == null ? void 0 : e.data) == null ? void 0 : u.dataSets, n = (f = (l = e == null ? void 0 : e.data) == null ? void 0 : l.structures) == null ? void 0 : f[0];
|
|
404
|
+
}, Ke = "Observation", Sn = (e) => {
|
|
405
|
+
const t = e?.data?.dataSets, n = e?.data?.structures?.[0];
|
|
416
406
|
if (!t || !n)
|
|
417
407
|
return [];
|
|
418
|
-
const s = n.attributes, r = n.dimensions, o =
|
|
419
|
-
for (const
|
|
420
|
-
const
|
|
421
|
-
|
|
408
|
+
const s = n.attributes, r = n.dimensions, o = s?.dimensionGroup || [], i = t[0].series || t[0].observations, c = r.series?.length ? r.series : r.observation, a = [];
|
|
409
|
+
for (const u in i) {
|
|
410
|
+
const d = [], { name: l, parsedTimeSeriesValue: m } = je(
|
|
411
|
+
u,
|
|
422
412
|
c
|
|
423
|
-
),
|
|
424
|
-
if (Object.keys(
|
|
413
|
+
), f = i[u], E = f.attributes || [];
|
|
414
|
+
if (Object.keys(f).length === 0) {
|
|
425
415
|
a.push({
|
|
426
|
-
name:
|
|
427
|
-
parsedTimeSeriesValue:
|
|
428
|
-
values:
|
|
416
|
+
name: l,
|
|
417
|
+
parsedTimeSeriesValue: m,
|
|
418
|
+
values: d,
|
|
429
419
|
attributes: [],
|
|
430
420
|
dataSetAttrs: []
|
|
431
421
|
});
|
|
432
422
|
continue;
|
|
433
423
|
}
|
|
434
|
-
|
|
435
|
-
...
|
|
424
|
+
d.push(
|
|
425
|
+
...Xe(f, n)
|
|
436
426
|
);
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
(
|
|
440
|
-
),
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
),
|
|
427
|
+
const w = _(
|
|
428
|
+
s?.series || [],
|
|
429
|
+
(p) => E[p]
|
|
430
|
+
), I = Ze(
|
|
431
|
+
n.attributes?.dataSet || [],
|
|
432
|
+
t[0].attributes?.filter((p) => p != null) || []
|
|
433
|
+
), N = Fe(
|
|
444
434
|
e,
|
|
445
|
-
|
|
446
|
-
),
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
|
|
435
|
+
m
|
|
436
|
+
), $ = o.map((p, ve) => {
|
|
437
|
+
const z = N[p.id], Re = Ge(
|
|
438
|
+
p,
|
|
439
|
+
z.values[ve]
|
|
450
440
|
);
|
|
451
441
|
return {
|
|
452
|
-
attribute:
|
|
453
|
-
dimensionGroupValue:
|
|
454
|
-
dimensionGroupData:
|
|
442
|
+
attribute: p,
|
|
443
|
+
dimensionGroupValue: Re,
|
|
444
|
+
dimensionGroupData: z
|
|
455
445
|
};
|
|
456
446
|
});
|
|
457
447
|
a.push({
|
|
458
|
-
name:
|
|
459
|
-
parsedTimeSeriesValue:
|
|
460
|
-
values:
|
|
461
|
-
attributes:
|
|
462
|
-
dataSetAttrs:
|
|
463
|
-
dimensionGroupAttributes:
|
|
448
|
+
name: l,
|
|
449
|
+
parsedTimeSeriesValue: m,
|
|
450
|
+
values: d,
|
|
451
|
+
attributes: w,
|
|
452
|
+
dataSetAttrs: I,
|
|
453
|
+
dimensionGroupAttributes: $
|
|
464
454
|
});
|
|
465
455
|
}
|
|
466
456
|
return a;
|
|
467
|
-
},
|
|
457
|
+
}, je = (e, t) => {
|
|
468
458
|
const n = e.split(new RegExp("(?<!\\|):(?!\\||$)")), s = [];
|
|
469
459
|
for (let r = 0; r < n.length; r++) {
|
|
470
|
-
const o = t
|
|
460
|
+
const o = t?.[r], i = Number(n[r]);
|
|
471
461
|
if (i < 0 || o == null)
|
|
472
462
|
continue;
|
|
473
463
|
const c = o.values[i];
|
|
@@ -475,73 +465,68 @@ const Je = (e, t) => {
|
|
|
475
465
|
s.push(n[r].replace("|:", ":"));
|
|
476
466
|
continue;
|
|
477
467
|
}
|
|
478
|
-
s.push(
|
|
468
|
+
s.push(c?.id || c?.value || "");
|
|
479
469
|
}
|
|
480
470
|
return {
|
|
481
|
-
name:
|
|
471
|
+
name: ze(s),
|
|
482
472
|
parsedTimeSeriesValue: s
|
|
483
473
|
};
|
|
484
|
-
},
|
|
474
|
+
}, _ = (e, t) => {
|
|
485
475
|
const n = [];
|
|
486
476
|
for (let s = 0; s < e.length; s++) {
|
|
487
|
-
const r = e[s], o = t(s), i = o != null && r.values != null ?
|
|
477
|
+
const r = e[s], o = t(s), i = o != null && r.values != null ? He(o, r) : void 0;
|
|
488
478
|
n.push({
|
|
489
479
|
name: r.id,
|
|
490
480
|
value: i
|
|
491
481
|
});
|
|
492
482
|
}
|
|
493
483
|
return n;
|
|
494
|
-
},
|
|
484
|
+
}, He = (e, t) => {
|
|
495
485
|
const n = t.values[e];
|
|
496
|
-
return n == null ? typeof e == "object" ? e : e.toString() :
|
|
497
|
-
},
|
|
498
|
-
|
|
499
|
-
const n = (c = (i = t.measures) == null ? void 0 : i.observation) == null ? void 0 : c.length;
|
|
486
|
+
return n == null ? typeof e == "object" ? e : e.toString() : n?.id || n?.value || n?.ids || n?.values;
|
|
487
|
+
}, ze = (e) => e.map((t) => t ? Je(t) : "").join("."), Je = (e) => e.replace(/\./g, "|.").replace(/:/g, "|:"), Xe = (e, t) => {
|
|
488
|
+
const n = t.measures?.observation?.length;
|
|
500
489
|
if (e.observations == null)
|
|
501
490
|
return [
|
|
502
491
|
{
|
|
503
|
-
values:
|
|
504
|
-
obsAttributes:
|
|
505
|
-
|
|
506
|
-
(
|
|
492
|
+
values: te(e, t.measures),
|
|
493
|
+
obsAttributes: _(
|
|
494
|
+
t.attributes?.observation || [],
|
|
495
|
+
(i) => e[i + n]
|
|
507
496
|
),
|
|
508
|
-
dimensionAtObservation:
|
|
497
|
+
dimensionAtObservation: Ke
|
|
509
498
|
}
|
|
510
499
|
];
|
|
511
|
-
const s = e.observations, r =
|
|
512
|
-
for (const
|
|
513
|
-
const
|
|
500
|
+
const s = e.observations, r = t.dimensions.observation?.[0], o = [];
|
|
501
|
+
for (const i in s) {
|
|
502
|
+
const c = r?.values[i];
|
|
514
503
|
o.push({
|
|
515
|
-
dimensionAtObservation:
|
|
516
|
-
values:
|
|
517
|
-
s[
|
|
504
|
+
dimensionAtObservation: c?.value || c?.id,
|
|
505
|
+
values: te(
|
|
506
|
+
s[i],
|
|
518
507
|
t.measures
|
|
519
508
|
),
|
|
520
|
-
obsAttributes:
|
|
521
|
-
|
|
522
|
-
(
|
|
509
|
+
obsAttributes: _(
|
|
510
|
+
t.attributes?.observation || [],
|
|
511
|
+
(a) => s[i][a + n]
|
|
523
512
|
)
|
|
524
513
|
});
|
|
525
514
|
}
|
|
526
515
|
return o;
|
|
527
|
-
},
|
|
528
|
-
var n;
|
|
529
|
-
return ((n = t == null ? void 0 : t.observation) == null ? void 0 : n.map((s, r) => ({ name: s.id, value: e[r] }))) || [];
|
|
530
|
-
}, ot = (e, t) => e.reduce(
|
|
516
|
+
}, te = (e, t) => t?.observation?.map((n, s) => ({ name: n.id, value: e[s] })) || [], Ze = (e, t) => e.reduce(
|
|
531
517
|
(n, s, r) => {
|
|
532
518
|
const o = t[r];
|
|
533
|
-
return
|
|
519
|
+
return et(n, s, o, ""), n;
|
|
534
520
|
},
|
|
535
521
|
[]
|
|
536
|
-
),
|
|
537
|
-
|
|
538
|
-
const r = n != null ? ((o = t == null ? void 0 : t.values) == null ? void 0 : o.length) > 0 ? ((i = t.values[n]) == null ? void 0 : i.id) || ((c = t.values[n]) == null ? void 0 : c.value) : String(n) : s;
|
|
522
|
+
), et = (e, t, n, s) => {
|
|
523
|
+
const r = n != null ? t?.values?.length > 0 ? t.values[n]?.id || t.values[n]?.value : String(n) : s;
|
|
539
524
|
e.push({
|
|
540
525
|
name: t.id,
|
|
541
526
|
value: r || ""
|
|
542
527
|
});
|
|
543
|
-
},
|
|
544
|
-
function
|
|
528
|
+
}, tt = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, nt = /^[0-9][0-9][0-9][0-9]-W[0-9][0-9]?$/, st = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, rt = /^[0-9][0-9][0-9][0-9]$/, ot = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, it = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, C = (e) => rt.exec(e), U = (e) => !!C(e), at = (e) => st.exec(e), x = (e) => !!at(e), Y = (e) => it.exec(e), W = (e) => !!Y(e), k = (e) => tt.exec(e), q = (e) => !!k(e), ct = (e) => ot.exec(e), ut = (e) => !!ct(e), dt = (e) => nt.exec(e), Q = (e) => !!dt(e), V = 1440 * 60 * 1e3, B = 7 * V;
|
|
529
|
+
function F(e) {
|
|
545
530
|
const t = `${e}-01-01`, n = new Date(t);
|
|
546
531
|
if (n.getDay() !== 4) {
|
|
547
532
|
const r = 1 + (4 - n.getDay() + 7) % 7;
|
|
@@ -549,55 +534,55 @@ function J(e) {
|
|
|
549
534
|
}
|
|
550
535
|
return n;
|
|
551
536
|
}
|
|
552
|
-
function
|
|
537
|
+
function lt(e) {
|
|
553
538
|
const t = new Date(e), s = -((t.getDay() + 6) % 7) + 3;
|
|
554
539
|
return t.setDate(t.getDate() + s), new Date(t.valueOf());
|
|
555
540
|
}
|
|
556
|
-
function
|
|
557
|
-
const n = `${e}-12-31`, s =
|
|
541
|
+
function ne(e, t = "W") {
|
|
542
|
+
const n = `${e}-12-31`, s = R(new Date(n), t);
|
|
558
543
|
if (s.weekYear === e)
|
|
559
544
|
return s.weekNumber;
|
|
560
545
|
const r = `${e}-12-24`;
|
|
561
|
-
return
|
|
546
|
+
return R(new Date(r), t).weekNumber;
|
|
562
547
|
}
|
|
563
|
-
function
|
|
548
|
+
function Ee(e, t, n = "W") {
|
|
564
549
|
return `${e}-${n}${t < 10 ? "0" + t : t}`;
|
|
565
550
|
}
|
|
566
|
-
function
|
|
567
|
-
const n =
|
|
568
|
-
(n.getTime() - r.getTime()) /
|
|
551
|
+
function R(e, t = "W") {
|
|
552
|
+
const n = lt(e), s = n.getFullYear(), r = F(s), o = 1 + Math.ceil(
|
|
553
|
+
(n.getTime() - r.getTime()) / B
|
|
569
554
|
);
|
|
570
555
|
return {
|
|
571
|
-
code:
|
|
556
|
+
code: Ee(s, o, t),
|
|
572
557
|
weekNumber: o,
|
|
573
558
|
weekYear: s
|
|
574
559
|
};
|
|
575
560
|
}
|
|
576
|
-
function
|
|
577
|
-
const [t, n] = e.split("-W"), r =
|
|
561
|
+
function mt(e) {
|
|
562
|
+
const [t, n] = e.split("-W"), r = F(+t).getTime() + (+n - 1) * B - 3 * V;
|
|
578
563
|
return new Date(r);
|
|
579
564
|
}
|
|
580
|
-
function
|
|
581
|
-
const [t, n] = e.split("-W"), r =
|
|
565
|
+
function ft(e) {
|
|
566
|
+
const [t, n] = e.split("-W"), r = F(+t).getTime() + (+n - 1) * B + 3 * V;
|
|
582
567
|
return new Date(r);
|
|
583
568
|
}
|
|
584
569
|
function pe(e) {
|
|
585
|
-
return
|
|
570
|
+
return U(e) ? gt(e) : x(e) ? Et(e) : q(e) ? Dt(e) : W(e) ? yt(e) : Q(e) ? mt(e) : Tt(e);
|
|
586
571
|
}
|
|
587
|
-
function
|
|
588
|
-
return
|
|
572
|
+
function De(e) {
|
|
573
|
+
return U(e) ? ht(e) : x(e) ? pt(e) : q(e) ? At(e) : W(e) ? St(e) : Q(e) ? ft(e) : vt(e);
|
|
589
574
|
}
|
|
590
|
-
function
|
|
591
|
-
const t =
|
|
575
|
+
function gt(e) {
|
|
576
|
+
const t = C(e);
|
|
592
577
|
if (t)
|
|
593
578
|
return new Date(Number(t[0]), 0, 1);
|
|
594
579
|
}
|
|
595
|
-
function
|
|
596
|
-
const t =
|
|
580
|
+
function ht(e) {
|
|
581
|
+
const t = C(e);
|
|
597
582
|
if (t)
|
|
598
583
|
return new Date(Number(t[0]) + 1, 0, 1);
|
|
599
584
|
}
|
|
600
|
-
function
|
|
585
|
+
function Et(e) {
|
|
601
586
|
const [t, n] = e.split("-S");
|
|
602
587
|
switch (+n) {
|
|
603
588
|
case 1:
|
|
@@ -615,8 +600,8 @@ function pt(e) {
|
|
|
615
600
|
return new Date(+t + 1, 0, 1);
|
|
616
601
|
}
|
|
617
602
|
}
|
|
618
|
-
function
|
|
619
|
-
const t =
|
|
603
|
+
function Dt(e) {
|
|
604
|
+
const t = k(e);
|
|
620
605
|
if (!t)
|
|
621
606
|
return;
|
|
622
607
|
const [n, s] = t[0].split("-Q");
|
|
@@ -631,8 +616,8 @@ function mt(e) {
|
|
|
631
616
|
return new Date(+n, 9, 1);
|
|
632
617
|
}
|
|
633
618
|
}
|
|
634
|
-
function
|
|
635
|
-
const t =
|
|
619
|
+
function At(e) {
|
|
620
|
+
const t = k(e);
|
|
636
621
|
if (!t)
|
|
637
622
|
return;
|
|
638
623
|
const [n, s] = t[0].split("-Q");
|
|
@@ -647,45 +632,45 @@ function vt(e) {
|
|
|
647
632
|
return new Date(+n + 1, 0, 1);
|
|
648
633
|
}
|
|
649
634
|
}
|
|
650
|
-
function
|
|
651
|
-
const t =
|
|
635
|
+
function yt(e) {
|
|
636
|
+
const t = Y(e);
|
|
652
637
|
if (!t)
|
|
653
638
|
return;
|
|
654
639
|
const [n, s] = t[0].split("-M");
|
|
655
640
|
return new Date(+n, +s - 1, 1);
|
|
656
641
|
}
|
|
657
|
-
function
|
|
658
|
-
const t =
|
|
642
|
+
function St(e) {
|
|
643
|
+
const t = Y(e);
|
|
659
644
|
if (!t)
|
|
660
645
|
return;
|
|
661
646
|
const [n, s] = t[0].split("-M");
|
|
662
647
|
return new Date(+n, +s, 1);
|
|
663
648
|
}
|
|
664
|
-
const
|
|
649
|
+
const Tt = (e) => /* @__PURE__ */ new Date(`${e}T00:00:00`), vt = (e) => {
|
|
665
650
|
const t = /* @__PURE__ */ new Date(`${e}T23:59:00`);
|
|
666
651
|
return t.setMinutes(t.getMinutes() + 1), t;
|
|
667
|
-
},
|
|
668
|
-
const o = [], i = t && t > 3 ?
|
|
652
|
+
}, Rt = 1, wt = (e, t, n, s = !0, r = "Q") => {
|
|
653
|
+
const o = [], i = t && t > 3 ? Ot(t, s) : 1, c = n ? Math.floor((n - 1) / 3) : 4;
|
|
669
654
|
for (let a = i; a <= c; a++)
|
|
670
655
|
o.push(`${e}-${r}${a}`);
|
|
671
656
|
return o;
|
|
672
|
-
},
|
|
657
|
+
}, It = (e, t, n, s = "S") => {
|
|
673
658
|
const r = [];
|
|
674
659
|
return (t || 1) < 7 && (n || 12) > 6 && r.push(`${e}-${s}1`), n == null && r.push(`${e}-${s}2`), r;
|
|
675
|
-
},
|
|
660
|
+
}, Tn = (e) => Math.ceil(e / 3), Ae = (e, t, n = "M") => `${e}-${n}${t.toString().padStart(2, "0")}`, Nt = (e, t, n = "M") => {
|
|
676
661
|
const s = [];
|
|
677
662
|
for (let r = t; r <= 12; r++)
|
|
678
|
-
s.push(
|
|
663
|
+
s.push(Ae(e, r, n));
|
|
679
664
|
return s;
|
|
680
|
-
},
|
|
665
|
+
}, $t = (e, t, n, s = "M") => {
|
|
681
666
|
const r = [];
|
|
682
667
|
for (let o = t; o < n; o++)
|
|
683
|
-
r.push(
|
|
668
|
+
r.push(Ae(e, o, s));
|
|
684
669
|
return r;
|
|
685
|
-
},
|
|
670
|
+
}, Pt = (e, t, n, s = "M") => {
|
|
686
671
|
const r = t || 1, o = n == null, i = n || 12;
|
|
687
|
-
return o ?
|
|
688
|
-
},
|
|
672
|
+
return o ? Nt(e, r, s) : $t(e, r, i, s);
|
|
673
|
+
}, vn = (e, t, n = "M") => {
|
|
689
674
|
switch (t) {
|
|
690
675
|
case 0:
|
|
691
676
|
return [
|
|
@@ -714,61 +699,57 @@ const It = (e) => /* @__PURE__ */ new Date(`${e}T00:00:00`), _t = (e) => {
|
|
|
714
699
|
default:
|
|
715
700
|
return [];
|
|
716
701
|
}
|
|
717
|
-
},
|
|
718
|
-
const n =
|
|
702
|
+
}, bt = (e, t) => {
|
|
703
|
+
const n = g(t, !0), s = g(e), r = n.getFullYear(), o = s.getFullYear(), i = n.getTime() <= s.getTime() ? o + Rt - r : 0;
|
|
719
704
|
return Array.from({ length: i }, (a, u) => r + u);
|
|
720
|
-
},
|
|
721
|
-
const n =
|
|
705
|
+
}, g = (e, t = !1) => {
|
|
706
|
+
const n = _t(e, t);
|
|
722
707
|
return n ? (n.getTimezoneOffset() > 0 && n.setMinutes(n.getMinutes() + n.getTimezoneOffset()), n) : /* @__PURE__ */ new Date();
|
|
723
|
-
},
|
|
708
|
+
}, _t = (e, t = !1) => {
|
|
724
709
|
const n = Number(e);
|
|
725
|
-
return e.toString().length !== 13 ? t ? pe(e) :
|
|
726
|
-
},
|
|
727
|
-
const n =
|
|
710
|
+
return e.toString().length !== 13 ? t ? pe(e) : De(e) : isNaN(n) ? /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`) : new Date(n);
|
|
711
|
+
}, Ot = (e, t) => t ? Math.floor((e + 1) / 3) : Math.ceil((e + 1) / 3), Rn = (e, t) => {
|
|
712
|
+
const n = re(e) - re(t);
|
|
728
713
|
if (n === 0 && e !== t) {
|
|
729
|
-
const s =
|
|
714
|
+
const s = se(e), r = se(t);
|
|
730
715
|
return s - r;
|
|
731
716
|
}
|
|
732
717
|
return n;
|
|
733
|
-
},
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
return (n = (t = e == null ? void 0 : e.annotations) == null ? void 0 : t.find((s) => {
|
|
741
|
-
if (s.id === X.LAST_UPDATE_AT)
|
|
742
|
-
return s;
|
|
743
|
-
})) == null ? void 0 : n.value;
|
|
718
|
+
}, se = (e) => U(e) ? 6 : x(e) ? 5 : q(e) ? 4 : W(e) ? 3 : Q(e) ? 2 : ut(e) ? 1 : 0, re = (e, t = !1) => (t ? pe(e) : De(e))?.getTime() || 0;
|
|
719
|
+
var G = /* @__PURE__ */ ((e) => (e.LAST_UPDATE_AT = "lastUpdatedAt", e.SERIES_COUNT = "series_count", e))(G || {}), Lt = /* @__PURE__ */ ((e) => (e.C = "c", e))(Lt || {}), h = /* @__PURE__ */ ((e) => (e.EQUALS = "eq", e.NOT_EQUALS = "ne", e.LESS = "lt", e.LESS_OR_EQUAL = "le", e.GREATER = "gt", e.GREATER_OR_EQUAL = "ge", e.CONTAINS = "co", e.NOT_CONTAINS = "nc", e.STARTS = "sw", e.ENDS = "ew", e))(h || {}), Mt = /* @__PURE__ */ ((e) => (e.BOOLEAN = "Boolean", e.DATE_TIME = "DateTime", e.DECIMAL = "Decimal", e.INTEGER = "Integer", e.OBSERVATION_TIME_PERIOD = "ObservationalTimePeriod", e.STRING = "String", e.TIME = "Time", e.TIME_RANGE = "TimeRange", e.URI = "URI", e))(Mt || {}), Ct = /* @__PURE__ */ ((e) => (e.ANNUAL = "A", e.QUARTERLY = "Q", e.MONTHLY = "M", e))(Ct || {});
|
|
720
|
+
function wn(e) {
|
|
721
|
+
return e?.annotations?.find((t) => {
|
|
722
|
+
if (t.id === G.LAST_UPDATE_AT)
|
|
723
|
+
return t;
|
|
724
|
+
})?.value;
|
|
744
725
|
}
|
|
745
|
-
const
|
|
746
|
-
if (!(!e || t
|
|
747
|
-
const s = n
|
|
748
|
-
|
|
726
|
+
const K = (e, t) => e?.names && e?.names[t] || e?.name, ye = (e, t, n) => {
|
|
727
|
+
if (!(!e || t?.has(e?.id)) && (t?.set(e?.id, e), e?.parent)) {
|
|
728
|
+
const s = n?.get(e?.parent);
|
|
729
|
+
ye(s, t, n);
|
|
749
730
|
}
|
|
750
|
-
},
|
|
751
|
-
const n = /* @__PURE__ */ new Map(), s = new Map(e
|
|
752
|
-
return t
|
|
753
|
-
|
|
754
|
-
}), Array.from(n
|
|
755
|
-
},
|
|
756
|
-
const t = e
|
|
757
|
-
(o) => o.id ===
|
|
758
|
-
), n = e
|
|
759
|
-
(o) => o.id ===
|
|
760
|
-
), s = n
|
|
731
|
+
}, Ut = (e, t) => {
|
|
732
|
+
const n = /* @__PURE__ */ new Map(), s = new Map(e?.map((r) => [r.id, r]));
|
|
733
|
+
return t?.forEach((r) => {
|
|
734
|
+
ye(r, n, s);
|
|
735
|
+
}), Array.from(n?.values());
|
|
736
|
+
}, xt = "time_period_end", Yt = "time_period_start", Wt = "TIME_PERIOD", In = (e) => {
|
|
737
|
+
const t = e?.find(
|
|
738
|
+
(o) => o.id === Yt
|
|
739
|
+
), n = e?.find(
|
|
740
|
+
(o) => o.id === xt
|
|
741
|
+
), s = n?.title ? new Date(n?.title) : null;
|
|
761
742
|
return {
|
|
762
|
-
startPeriod: t
|
|
743
|
+
startPeriod: t?.title ? new Date(t?.title) : null,
|
|
763
744
|
endPeriod: s
|
|
764
745
|
};
|
|
765
|
-
},
|
|
746
|
+
}, kt = (e, t) => e.id.localeCompare(t.id), qt = (e, t) => e.memberValue.localeCompare(t.memberValue), Qt = (e, t) => {
|
|
766
747
|
const n = new Array(e.length), s = e.map((i, c) => [i, c]);
|
|
767
748
|
s.sort(
|
|
768
|
-
(i, c) =>
|
|
749
|
+
(i, c) => kt(i[0], c[0])
|
|
769
750
|
);
|
|
770
751
|
const r = [...t];
|
|
771
|
-
r.sort(
|
|
752
|
+
r.sort(qt);
|
|
772
753
|
let o = 0;
|
|
773
754
|
for (const i of s) {
|
|
774
755
|
const c = i[0];
|
|
@@ -777,225 +758,208 @@ const Z = (e, t) => (e == null ? void 0 : e.names) && (e == null ? void 0 : e.na
|
|
|
777
758
|
o < r.length && r[o].memberValue === c.id && (n[i[1]] = i[0]);
|
|
778
759
|
}
|
|
779
760
|
return n.filter((i) => i != null);
|
|
780
|
-
},
|
|
781
|
-
var i, c;
|
|
761
|
+
}, Vt = (e) => !!e?.some((t) => t.parent), Nn = (e, t, n, s, r = []) => {
|
|
782
762
|
let o = e || [];
|
|
783
|
-
if (
|
|
784
|
-
const
|
|
785
|
-
({ isIncluded:
|
|
763
|
+
if (Bt(n || [], t || "")) {
|
|
764
|
+
const i = (n || [])[0].cubeRegions?.find(
|
|
765
|
+
({ isIncluded: c }) => c
|
|
786
766
|
);
|
|
787
|
-
if (
|
|
788
|
-
const
|
|
789
|
-
({ componentId:
|
|
767
|
+
if (i) {
|
|
768
|
+
const c = i.memberSelection?.find(
|
|
769
|
+
({ componentId: a }) => a === t
|
|
790
770
|
);
|
|
791
|
-
|
|
792
|
-
id:
|
|
793
|
-
name:
|
|
794
|
-
})) :
|
|
771
|
+
c ? o = o.length === 0 ? (c.selectionValues || []).map(({ memberValue: a }) => ({
|
|
772
|
+
id: a,
|
|
773
|
+
name: a
|
|
774
|
+
})) : Qt(o, c.selectionValues) : o = [];
|
|
795
775
|
}
|
|
796
|
-
} else r.length !== 0 && (o = o.filter(({ id:
|
|
797
|
-
return
|
|
798
|
-
...
|
|
799
|
-
name: s ?
|
|
776
|
+
} else r.length !== 0 && (o = o.filter(({ id: i }) => r.includes(i)));
|
|
777
|
+
return Vt(e) && (o = Ut(e, o)), o?.map((i) => ({
|
|
778
|
+
...i,
|
|
779
|
+
name: s ? K(i, s) : i?.name
|
|
800
780
|
}));
|
|
801
|
-
},
|
|
802
|
-
var n;
|
|
781
|
+
}, Bt = (e, t) => e != null && e.length > 0 && t != null, $n = (e) => {
|
|
803
782
|
const t = [];
|
|
804
|
-
return
|
|
805
|
-
|
|
806
|
-
componentCode:
|
|
807
|
-
operator:
|
|
808
|
-
value:
|
|
783
|
+
return e?.filters?.forEach((n) => {
|
|
784
|
+
n.componentCode !== Wt && t.push({
|
|
785
|
+
componentCode: n.componentCode,
|
|
786
|
+
operator: h.EQUALS,
|
|
787
|
+
value: n.values.join(",")
|
|
809
788
|
});
|
|
810
789
|
}), t;
|
|
811
|
-
},
|
|
790
|
+
}, Ft = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, oe = (e) => {
|
|
812
791
|
if (typeof e != "string")
|
|
813
792
|
throw new TypeError("Invalid argument expected string");
|
|
814
|
-
const t = e.match(
|
|
793
|
+
const t = e.match(Ft);
|
|
815
794
|
if (!t)
|
|
816
795
|
throw new Error(`Invalid argument not valid semver ('${e}' received)`);
|
|
817
796
|
return t.shift(), t;
|
|
818
|
-
},
|
|
797
|
+
}, ie = (e) => e === "*" || e === "x" || e === "X", ae = (e) => {
|
|
819
798
|
const t = parseInt(e, 10);
|
|
820
799
|
return isNaN(t) ? e : t;
|
|
821
|
-
},
|
|
822
|
-
if (
|
|
800
|
+
}, Gt = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], Kt = (e, t) => {
|
|
801
|
+
if (ie(e) || ie(t))
|
|
823
802
|
return 0;
|
|
824
|
-
const [n, s] =
|
|
803
|
+
const [n, s] = Gt(ae(e), ae(t));
|
|
825
804
|
return n > s ? 1 : n < s ? -1 : 0;
|
|
826
|
-
},
|
|
805
|
+
}, ce = (e, t) => {
|
|
827
806
|
for (let n = 0; n < Math.max(e.length, t.length); n++) {
|
|
828
|
-
const s =
|
|
807
|
+
const s = Kt(e[n] || "0", t[n] || "0");
|
|
829
808
|
if (s !== 0)
|
|
830
809
|
return s;
|
|
831
810
|
}
|
|
832
811
|
return 0;
|
|
833
|
-
},
|
|
834
|
-
const n =
|
|
835
|
-
return i !== 0 ? i : r && o ?
|
|
836
|
-
},
|
|
837
|
-
|
|
838
|
-
const s =
|
|
839
|
-
return
|
|
840
|
-
},
|
|
812
|
+
}, jt = (e, t) => {
|
|
813
|
+
const n = oe(e), s = oe(t), r = n.pop(), o = s.pop(), i = ce(n, s);
|
|
814
|
+
return i !== 0 ? i : r && o ? ce(r.split("."), o.split(".")) : r || o ? r ? -1 : 1 : 0;
|
|
815
|
+
}, Ht = (e, t, n) => {
|
|
816
|
+
zt(n);
|
|
817
|
+
const s = jt(e, t);
|
|
818
|
+
return Se[n].includes(s);
|
|
819
|
+
}, Se = {
|
|
841
820
|
">": [1],
|
|
842
821
|
">=": [0, 1],
|
|
843
822
|
"=": [0],
|
|
844
823
|
"<=": [-1, 0],
|
|
845
824
|
"<": [-1],
|
|
846
825
|
"!=": [-1, 1]
|
|
847
|
-
},
|
|
848
|
-
if (
|
|
849
|
-
throw new Error(`Invalid operator, expected one of ${
|
|
850
|
-
},
|
|
851
|
-
const { agency: n, id: s, version: r } =
|
|
852
|
-
(a) =>
|
|
853
|
-
var u;
|
|
854
|
-
return a.agencyID === n && a.id === s && !((u = a == null ? void 0 : a.version) != null && u.includes(W));
|
|
855
|
-
}
|
|
826
|
+
}, ue = Object.keys(Se), zt = (e) => {
|
|
827
|
+
if (ue.indexOf(e) === -1)
|
|
828
|
+
throw new Error(`Invalid operator, expected one of ${ue.join("|")}`);
|
|
829
|
+
}, O = "+", j = (e, t) => {
|
|
830
|
+
const { agency: n, id: s, version: r } = D(e), o = t.filter(
|
|
831
|
+
(a) => a.agencyID === n && a.id === s && !a?.version?.includes(O)
|
|
856
832
|
);
|
|
857
833
|
if (o.length === 1)
|
|
858
834
|
return o[0];
|
|
859
|
-
if (!
|
|
835
|
+
if (!r?.includes(O))
|
|
860
836
|
return o.find((a) => a.version === r);
|
|
861
837
|
const i = o.map(
|
|
862
838
|
(a) => a.version
|
|
863
|
-
), c =
|
|
839
|
+
), c = Jt(r, i);
|
|
864
840
|
return o.find(
|
|
865
841
|
(a) => a.version === c[0]
|
|
866
842
|
);
|
|
867
|
-
},
|
|
868
|
-
const n =
|
|
843
|
+
}, Jt = (e, t) => {
|
|
844
|
+
const n = Xt(e, t);
|
|
869
845
|
return n.length > 0 ? [n[0]] : [];
|
|
870
|
-
},
|
|
846
|
+
}, Xt = (e, t) => {
|
|
871
847
|
const n = [];
|
|
872
848
|
return t.forEach((s) => {
|
|
873
|
-
|
|
849
|
+
en(e, s) && n.push(s);
|
|
874
850
|
}), n;
|
|
875
|
-
},
|
|
851
|
+
}, Zt = (e) => {
|
|
876
852
|
const t = e.trim().replace(/\d+\+/, "*"), [n] = t.split("*");
|
|
877
853
|
return new RegExp(`^${n}`);
|
|
878
|
-
},
|
|
854
|
+
}, en = (e, t) => {
|
|
879
855
|
const n = e.trim().replace(/\+/, "");
|
|
880
|
-
return
|
|
881
|
-
},
|
|
882
|
-
const { concept: n } =
|
|
856
|
+
return Zt(e).test(t) && Ht(t, n, ">=");
|
|
857
|
+
}, H = (e, t) => {
|
|
858
|
+
const { concept: n } = tn(e, t);
|
|
883
859
|
return n;
|
|
884
|
-
},
|
|
860
|
+
}, tn = (e, t) => {
|
|
885
861
|
if (e == null)
|
|
886
862
|
return {
|
|
887
863
|
concept: void 0,
|
|
888
864
|
scheme: void 0
|
|
889
865
|
};
|
|
890
|
-
const { childId: n, agency: s, id: r, version: o } =
|
|
891
|
-
if (o
|
|
892
|
-
const i =
|
|
866
|
+
const { childId: n, agency: s, id: r, version: o } = we(e);
|
|
867
|
+
if (o?.includes(O)) {
|
|
868
|
+
const i = j(
|
|
893
869
|
e,
|
|
894
870
|
t
|
|
895
871
|
);
|
|
896
872
|
return {
|
|
897
|
-
concept:
|
|
873
|
+
concept: de(i?.concepts || [], n),
|
|
898
874
|
scheme: i
|
|
899
875
|
};
|
|
900
876
|
}
|
|
901
877
|
for (const i of t)
|
|
902
|
-
if (
|
|
878
|
+
if (nn(i, r, s, o))
|
|
903
879
|
return {
|
|
904
|
-
concept:
|
|
880
|
+
concept: de(i?.concepts || [], n),
|
|
905
881
|
scheme: i
|
|
906
882
|
};
|
|
907
883
|
return {
|
|
908
884
|
concept: void 0,
|
|
909
885
|
scheme: void 0
|
|
910
886
|
};
|
|
911
|
-
},
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
(u = r == null ? void 0 : r.coreRepresentation) == null ? void 0 : u.enumeration
|
|
887
|
+
}, de = (e, t) => e?.find((n) => n.id === t), nn = (e, t, n, s) => e.id === t && e.agencyID === n && e.version === s, Pn = (e = [], t = [], n) => {
|
|
888
|
+
const s = n?.conceptIdentity || "", r = H(s, t), o = v(
|
|
889
|
+
n?.localRepresentation?.enumeration
|
|
890
|
+
), i = v(
|
|
891
|
+
r?.coreRepresentation?.enumeration
|
|
917
892
|
), c = o || i;
|
|
918
893
|
if (c != null)
|
|
919
|
-
return
|
|
920
|
-
},
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
)
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
var u;
|
|
934
|
-
const a = (u = s == null ? void 0 : s.metadataAttributes) == null ? void 0 : u.find(
|
|
935
|
-
(l) => (l == null ? void 0 : l.id) === (c == null ? void 0 : c.metadataAttributeReference)
|
|
894
|
+
return j(c, e);
|
|
895
|
+
}, bn = (e, t, n, s) => {
|
|
896
|
+
const r = t?.find(
|
|
897
|
+
(o) => o?.id === e?.id
|
|
898
|
+
)?.values;
|
|
899
|
+
return n?.filter((o) => r?.some((i) => i.id === o.id))?.map((o) => ({
|
|
900
|
+
...o,
|
|
901
|
+
name: s ? K(o, s) : o?.name
|
|
902
|
+
})) || [];
|
|
903
|
+
}, sn = (e, t) => {
|
|
904
|
+
const n = t?.dataStructureComponents?.attributeList, s = e?.metadataStructureComponents?.metadataAttributeList;
|
|
905
|
+
return n?.metadataAttributeUsages?.map((r) => {
|
|
906
|
+
const o = s?.metadataAttributes?.find(
|
|
907
|
+
(i) => i?.id === r?.metadataAttributeReference
|
|
936
908
|
);
|
|
937
909
|
return {
|
|
938
|
-
...
|
|
939
|
-
attributeRelationship:
|
|
940
|
-
isMandatory: Number(
|
|
910
|
+
...o,
|
|
911
|
+
attributeRelationship: r.attributeRelationship,
|
|
912
|
+
isMandatory: Number(o?.minOccurs) > 0
|
|
941
913
|
};
|
|
942
914
|
});
|
|
943
|
-
},
|
|
944
|
-
const s =
|
|
945
|
-
return n ?
|
|
915
|
+
}, _n = (e = [], t, n) => {
|
|
916
|
+
const s = v(t?.conceptIdentity) || "", r = H(s, e);
|
|
917
|
+
return n ? K(r, n) : r?.name ?? r?.id ?? t?.id;
|
|
946
918
|
};
|
|
947
|
-
function
|
|
948
|
-
|
|
949
|
-
return (s = (n = (t = e == null ? void 0 : e.dataStructures) == null ? void 0 : t[0]) == null ? void 0 : n.dataStructureComponents) == null ? void 0 : s.dimensionList;
|
|
919
|
+
function le(e) {
|
|
920
|
+
return e?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
|
|
950
921
|
}
|
|
951
|
-
function
|
|
952
|
-
|
|
953
|
-
return ((r = (s = (n = (t = e == null ? void 0 : e.data) == null ? void 0 : t.structures) == null ? void 0 : n[0]) == null ? void 0 : s.dimensions) == null ? void 0 : r.series) || [];
|
|
922
|
+
function On(e) {
|
|
923
|
+
return e?.data?.structures?.[0]?.dimensions?.series || [];
|
|
954
924
|
}
|
|
955
|
-
function
|
|
956
|
-
|
|
957
|
-
return ((o = (r = (s = (n = (t = e == null ? void 0 : e.data) == null ? void 0 : t.structures) == null ? void 0 : n[0]) == null ? void 0 : s.dimensions) == null ? void 0 : r.observation) == null ? void 0 : o[0].values.map((i) => i.value).filter((i) => i != null)) || [];
|
|
925
|
+
function Ln(e) {
|
|
926
|
+
return e?.data?.structures?.[0]?.dimensions?.observation?.[0].values.map((t) => t.value).filter((t) => t != null) || [];
|
|
958
927
|
}
|
|
959
|
-
function
|
|
928
|
+
function Mn(e) {
|
|
960
929
|
return e.find(
|
|
961
|
-
(t) => t.type ===
|
|
930
|
+
(t) => t.type === M.TIME_DIMENSION
|
|
962
931
|
);
|
|
963
932
|
}
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
const t = /* @__PURE__ */ new Map(), n = (i = e == null ? void 0 : e.dataStructures) == null ? void 0 : i[0], s = (c = e == null ? void 0 : e.metadataStructures) == null ? void 0 : c[0], r = (e == null ? void 0 : e.conceptSchemes) || [], o = (e == null ? void 0 : e.codelists) || [];
|
|
933
|
+
const Cn = (e) => {
|
|
934
|
+
const t = /* @__PURE__ */ new Map(), n = e?.dataStructures?.[0], s = e?.metadataStructures?.[0], r = e?.conceptSchemes || [], o = e?.codelists || [];
|
|
967
935
|
return e && [
|
|
968
|
-
...(
|
|
969
|
-
...(
|
|
970
|
-
...
|
|
971
|
-
...
|
|
936
|
+
...le(e)?.dimensions || [],
|
|
937
|
+
...le(e)?.timeDimensions || [],
|
|
938
|
+
...sn(s, n),
|
|
939
|
+
...n?.dataStructureComponents?.attributeList?.attributes || []
|
|
972
940
|
].forEach(
|
|
973
|
-
(
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
d == null ? void 0 : d.conceptIdentity,
|
|
941
|
+
(c) => {
|
|
942
|
+
const a = H(
|
|
943
|
+
c?.conceptIdentity,
|
|
977
944
|
r
|
|
978
|
-
),
|
|
979
|
-
|
|
945
|
+
), u = c?.localRepresentation?.enumeration || a?.coreRepresentation?.enumeration, d = j(
|
|
946
|
+
u,
|
|
980
947
|
o
|
|
981
948
|
);
|
|
982
|
-
|
|
983
|
-
...
|
|
984
|
-
name:
|
|
985
|
-
names:
|
|
986
|
-
}) : t.set(
|
|
987
|
-
id:
|
|
988
|
-
name:
|
|
989
|
-
names:
|
|
949
|
+
c?.id && (u ? t.set(c?.id, {
|
|
950
|
+
...d,
|
|
951
|
+
name: a?.name,
|
|
952
|
+
names: a?.names
|
|
953
|
+
}) : t.set(c?.id, {
|
|
954
|
+
id: c?.id,
|
|
955
|
+
name: a?.name,
|
|
956
|
+
names: a?.names
|
|
990
957
|
}));
|
|
991
958
|
}
|
|
992
959
|
), t;
|
|
993
|
-
},
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
(n) => n.id === X.SERIES_COUNT
|
|
997
|
-
)) == null ? void 0 : t.title) || "";
|
|
998
|
-
}, dn = "/api/download", Bn = (e, t, n, s, r, o, i) => {
|
|
960
|
+
}, Un = (e) => e?.find(
|
|
961
|
+
(t) => t.id === G.SERIES_COUNT
|
|
962
|
+
)?.title || "", rn = "/api/download", xn = (e, t, n, s, r, o, i) => {
|
|
999
963
|
const c = new URLSearchParams({
|
|
1000
964
|
urn: e,
|
|
1001
965
|
format: t,
|
|
@@ -1005,72 +969,70 @@ const Mn = (e) => {
|
|
|
1005
969
|
attribute: s,
|
|
1006
970
|
language: n,
|
|
1007
971
|
isMetadata: i ? "true" : "none"
|
|
1008
|
-
}).toString(), a = `${
|
|
972
|
+
}).toString(), a = `${rn}?${c}`;
|
|
1009
973
|
window.open(a, "_blank");
|
|
1010
|
-
},
|
|
1011
|
-
var s, r;
|
|
974
|
+
}, Yn = (e, t) => {
|
|
1012
975
|
const n = [];
|
|
1013
|
-
for (const
|
|
1014
|
-
if (
|
|
976
|
+
for (const s of e) {
|
|
977
|
+
if (s.type !== M.DIMENSION)
|
|
1015
978
|
continue;
|
|
1016
|
-
const
|
|
1017
|
-
|
|
979
|
+
const r = t.find((o) => o.componentCode === s.id);
|
|
980
|
+
r != null && r.values?.length > 0 ? n.push(r.values?.join(Le)) : n.push("*");
|
|
1018
981
|
}
|
|
1019
982
|
return n.join(".");
|
|
1020
|
-
},
|
|
983
|
+
}, on = (e, t) => {
|
|
1021
984
|
if (!e || !e.startPeriod && !e.endPeriod)
|
|
1022
985
|
return null;
|
|
1023
986
|
const n = [], { startPeriod: s, endPeriod: r } = e;
|
|
1024
987
|
if (s && n.push(
|
|
1025
|
-
`${
|
|
988
|
+
`${h.GREATER_OR_EQUAL}${J}${s.toISOString().split("T")[0]}`
|
|
1026
989
|
), r && n.push(
|
|
1027
|
-
`${
|
|
990
|
+
`${h.LESS_OR_EQUAL}${J}${r.toISOString().split("T")[0]}`
|
|
1028
991
|
), n.length === 0)
|
|
1029
992
|
return null;
|
|
1030
993
|
const o = t;
|
|
1031
994
|
return n.map(
|
|
1032
|
-
(i) => `${encodeURIComponent(`c[${o}]`)}${
|
|
1033
|
-
).join(
|
|
1034
|
-
},
|
|
1035
|
-
const n =
|
|
1036
|
-
return n ?
|
|
1037
|
-
},
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
(l) => l.componentCode === n
|
|
995
|
+
(i) => `${encodeURIComponent(`c[${o}]`)}${Oe}${encodeURIComponent(i)}`
|
|
996
|
+
).join(ge);
|
|
997
|
+
}, Wn = (e, t) => {
|
|
998
|
+
const n = an(e, t) || null;
|
|
999
|
+
return n ? on(n, t?.id) : null;
|
|
1000
|
+
}, an = (e, t) => {
|
|
1001
|
+
const n = t.id, s = e?.filters?.find(
|
|
1002
|
+
(a) => a.componentCode === n
|
|
1041
1003
|
);
|
|
1042
1004
|
if (!s || !s.values)
|
|
1043
1005
|
return null;
|
|
1044
|
-
const r =
|
|
1006
|
+
const r = s.values?.filter((a) => !!a);
|
|
1045
1007
|
if (!r.length)
|
|
1046
1008
|
return null;
|
|
1047
1009
|
const o = s.operator;
|
|
1048
|
-
if (o ===
|
|
1049
|
-
return { startPeriod: null, endPeriod:
|
|
1050
|
-
if (o ===
|
|
1051
|
-
return { startPeriod:
|
|
1052
|
-
const i =
|
|
1010
|
+
if (o === h.LESS_OR_EQUAL || o === h.LESS)
|
|
1011
|
+
return { startPeriod: null, endPeriod: y(r[0]) };
|
|
1012
|
+
if (o === h.GREATER_OR_EQUAL || o === h.GREATER)
|
|
1013
|
+
return { startPeriod: y(r[0]), endPeriod: null };
|
|
1014
|
+
const i = y(r[0]), c = y(r[1]);
|
|
1053
1015
|
return { startPeriod: i, endPeriod: c };
|
|
1054
|
-
},
|
|
1055
|
-
const s =
|
|
1016
|
+
}, Te = (e, t, n) => {
|
|
1017
|
+
const s = g(t, !0), r = g(n), o = g(e, !0), i = g(e), c = s.getTime() > o.getTime() ? s : o, a = r.getTime() < i.getTime() ? r : i;
|
|
1056
1018
|
return {
|
|
1057
1019
|
start: c,
|
|
1058
1020
|
end: a
|
|
1059
1021
|
};
|
|
1060
|
-
},
|
|
1061
|
-
const r = +e, { start: o, end: i } =
|
|
1022
|
+
}, cn = (e, t, n, s = "W") => {
|
|
1023
|
+
const r = +e, { start: o, end: i } = Te(e, t, n);
|
|
1062
1024
|
if (o.getTime() > i.getTime())
|
|
1063
1025
|
return [];
|
|
1064
|
-
const c =
|
|
1065
|
-
if (a <
|
|
1066
|
-
for (let
|
|
1067
|
-
|
|
1068
|
-
return
|
|
1069
|
-
},
|
|
1026
|
+
const c = R(o, s), a = c.weekYear === r ? c.weekNumber : c.weekYear < r ? 1 : ne(r, s), u = R(i, s), d = u.weekYear === r ? u.weekNumber : u.weekYear > r ? ne(r, s) : 1, l = [];
|
|
1027
|
+
if (a < d)
|
|
1028
|
+
for (let m = a; m <= d; m++)
|
|
1029
|
+
l.push(Ee(r, m, s));
|
|
1030
|
+
return l;
|
|
1031
|
+
}, un = (e) => {
|
|
1070
1032
|
const t = new Date(e);
|
|
1071
1033
|
return t.setMinutes(t.getMinutes() - t.getTimezoneOffset()), t.toISOString().slice(0, 10);
|
|
1072
|
-
},
|
|
1073
|
-
const { start: s, end: r } =
|
|
1034
|
+
}, dn = (e, t, n) => {
|
|
1035
|
+
const { start: s, end: r } = Te(e, t, n);
|
|
1074
1036
|
if (s.getTime() > r.getTime())
|
|
1075
1037
|
return [];
|
|
1076
1038
|
const o = [], i = new Date(
|
|
@@ -1079,159 +1041,157 @@ const Mn = (e) => {
|
|
|
1079
1041
|
s.getDate()
|
|
1080
1042
|
), c = new Date(r.getFullYear(), r.getMonth(), r.getDate());
|
|
1081
1043
|
for (; i.getTime() < c.getTime(); ) {
|
|
1082
|
-
const a =
|
|
1044
|
+
const a = un(i);
|
|
1083
1045
|
o.push(a), i.setDate(i.getDate() + 1);
|
|
1084
1046
|
}
|
|
1085
1047
|
return o;
|
|
1086
|
-
},
|
|
1087
|
-
isDailyExist: !!
|
|
1088
|
-
isWeeklyExist: !!
|
|
1089
|
-
isMonthlyExist: !!
|
|
1090
|
-
isQuarterlyExist: !!
|
|
1091
|
-
isSemiAnnualExist: !!
|
|
1092
|
-
isYearlyExist: !!
|
|
1048
|
+
}, ln = (e) => ({
|
|
1049
|
+
isDailyExist: !!e?.some(({ memberValue: t }) => t === "D"),
|
|
1050
|
+
isWeeklyExist: !!e?.some(({ memberValue: t }) => t === "W"),
|
|
1051
|
+
isMonthlyExist: !!e?.some(({ memberValue: t }) => t === "M"),
|
|
1052
|
+
isQuarterlyExist: !!e?.some(({ memberValue: t }) => t === "Q"),
|
|
1053
|
+
isSemiAnnualExist: !!e?.some(({ memberValue: t }) => t === "S"),
|
|
1054
|
+
isYearlyExist: !!e?.some(
|
|
1093
1055
|
({ memberValue: t }) => t === "A" || t === "Y"
|
|
1094
|
-
)
|
|
1095
|
-
}),
|
|
1096
|
-
|
|
1097
|
-
const r = s === 0 ? ((i = R(t.toString(), !0)) == null ? void 0 : i.getMonth()) + 1 : void 0, o = s === e.length - 1 ? ((c = R(n.toString())) == null ? void 0 : c.getMonth()) + 1 || 1 : void 0;
|
|
1056
|
+
)
|
|
1057
|
+
}), mn = (e, t, n, s) => {
|
|
1058
|
+
const r = s === 0 ? g(t.toString(), !0)?.getMonth() + 1 : void 0, o = s === e.length - 1 ? g(n.toString())?.getMonth() + 1 || 1 : void 0;
|
|
1098
1059
|
return { startMonth: r, endMonth: o };
|
|
1099
|
-
},
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
const A = [], { startMonth: y, endMonth: S } = yn(
|
|
1060
|
+
}, fn = ["FREQUENCY", "FREQ"], kn = (e, t) => {
|
|
1061
|
+
const n = e?.[0]?.cubeRegions?.[0]?.memberSelection?.find(
|
|
1062
|
+
(a) => fn.includes(a.componentId)
|
|
1063
|
+
)?.selectionValues, s = ln(n || []), r = t?.startPeriod?.getTime() || 1, o = t?.endPeriod?.getTime() || 1, i = bt(o, r), c = [];
|
|
1064
|
+
return i.forEach((a, u) => {
|
|
1065
|
+
const d = [], { startMonth: l, endMonth: m } = mn(
|
|
1106
1066
|
i,
|
|
1107
1067
|
new Date(r),
|
|
1108
1068
|
new Date(o),
|
|
1109
|
-
|
|
1069
|
+
u
|
|
1110
1070
|
), {
|
|
1111
|
-
isDailyExist:
|
|
1112
|
-
isWeeklyExist:
|
|
1113
|
-
isMonthlyExist:
|
|
1114
|
-
isQuarterlyExist:
|
|
1115
|
-
isSemiAnnualExist:
|
|
1116
|
-
isYearlyExist:
|
|
1071
|
+
isDailyExist: f,
|
|
1072
|
+
isWeeklyExist: E,
|
|
1073
|
+
isMonthlyExist: w,
|
|
1074
|
+
isQuarterlyExist: I,
|
|
1075
|
+
isSemiAnnualExist: N,
|
|
1076
|
+
isYearlyExist: $
|
|
1117
1077
|
} = s;
|
|
1118
|
-
|
|
1119
|
-
...
|
|
1120
|
-
),
|
|
1121
|
-
...
|
|
1122
|
-
),
|
|
1123
|
-
...
|
|
1124
|
-
), c.push(...
|
|
1078
|
+
$ && d.push(a.toString()), N && d.push(...It(a, l, m)), I && d.push(
|
|
1079
|
+
...wt(a, l, m, !1)
|
|
1080
|
+
), w && d.push(...Pt(a, l, m)), E && d.push(
|
|
1081
|
+
...cn(a, r.toString(), o.toString())
|
|
1082
|
+
), f && d.push(
|
|
1083
|
+
...dn(a, r.toString(), o.toString())
|
|
1084
|
+
), c.push(...d);
|
|
1125
1085
|
}), c;
|
|
1126
1086
|
};
|
|
1127
1087
|
export {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1088
|
+
G as Annotations,
|
|
1089
|
+
Ve as AssignmentStatus,
|
|
1090
|
+
hn as AvailabilityApi,
|
|
1091
|
+
_e as DATASET_DATA_URL,
|
|
1132
1092
|
pn as DatasetApi,
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1093
|
+
M as DimensionType,
|
|
1094
|
+
$e as DownloadType,
|
|
1095
|
+
An as FREQUENCY_DIMENSION_ID,
|
|
1096
|
+
fn as FREQUENCY_DIM_ID,
|
|
1097
|
+
Ne as FileColumnsAttribute,
|
|
1098
|
+
Me as GET_v3_FILTER_ALL,
|
|
1099
|
+
En as GET_v3_FILTER_AND,
|
|
1100
|
+
Le as GET_v3_FILTER_OR,
|
|
1101
|
+
Ke as OBSERVATION_KEY,
|
|
1102
|
+
Be as OccurrenceType,
|
|
1103
|
+
Ct as Periods,
|
|
1104
|
+
Mt as RepresentationTextType,
|
|
1105
|
+
Lt as SDMX_DATA_QUERY_PARAMS,
|
|
1106
|
+
O as SINGLE_WILDCARD_SYMBOL,
|
|
1107
|
+
Dn as SdmxApiClient,
|
|
1108
|
+
me as SdmxAvailabilityMode,
|
|
1109
|
+
S as SdmxDataFormat,
|
|
1110
|
+
fe as SdmxDetails,
|
|
1111
|
+
L as SdmxReferences,
|
|
1112
|
+
h as SeriesFilterOperator,
|
|
1113
|
+
Wt as TIME_PERIOD,
|
|
1114
|
+
xt as TIME_PERIOD_END,
|
|
1115
|
+
Yt as TIME_PERIOD_START,
|
|
1116
|
+
ot as dailyPattern,
|
|
1117
|
+
Je as decodeDimensionId,
|
|
1118
|
+
Pn as findCodelistByDimension,
|
|
1119
|
+
X as generateDatasetDataRequest,
|
|
1120
|
+
gn as generateShortUrn,
|
|
1121
|
+
kn as getAdditionalColumns,
|
|
1122
|
+
In as getAnnotationPeriod,
|
|
1123
|
+
j as getArtifactByUrnWithWildCard,
|
|
1124
|
+
yn as getAttachedDimensionsSeriesByDimension,
|
|
1125
|
+
Fe as getAttachedDimensionsSeriesByTsId,
|
|
1126
|
+
he as getAttachedDimensionsSeriesKey,
|
|
1127
|
+
Ge as getAttributeValueFromDataQueryResponse,
|
|
1128
|
+
bn as getAvailableCodes,
|
|
1129
|
+
Nn as getAvailableCodesFromConstrains,
|
|
1130
|
+
we as getChildParsedUrn,
|
|
1131
|
+
H as getConcept,
|
|
1132
|
+
de as getConceptByUrn,
|
|
1133
|
+
tn as getConceptWithScheme,
|
|
1134
|
+
sn as getConvertedMetaAttributes,
|
|
1135
|
+
ct as getDailyRegExp,
|
|
1136
|
+
dn as getDaysColumns,
|
|
1137
|
+
_n as getDimensionTitle,
|
|
1138
|
+
le as getDimensions,
|
|
1139
|
+
Ut as getFilteredItemsWithParents,
|
|
1140
|
+
$n as getFiltersDtoFromDataQuery,
|
|
1141
|
+
R as getISOWeek,
|
|
1142
|
+
v as getKeyFromUrn,
|
|
1143
|
+
wn as getLastUpdatedTime,
|
|
1144
|
+
ne as getLastWeekNumberOfYear,
|
|
1145
|
+
K as getLocalizedName,
|
|
1146
|
+
Pt as getMonthlyData,
|
|
1147
|
+
vn as getMonthlyDataByQuarter,
|
|
1148
|
+
Y as getMonthlyRegExp,
|
|
1149
|
+
De as getParsedEndPeriodDate,
|
|
1150
|
+
Sn as getParsedResponse,
|
|
1191
1151
|
pe as getParsedStartPeriodDate,
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1152
|
+
g as getPeriodDate,
|
|
1153
|
+
ln as getPeriods,
|
|
1154
|
+
Tn as getQuarterByMonth,
|
|
1155
|
+
k as getQuarterlyRegExp,
|
|
1156
|
+
wt as getQuartersData,
|
|
1157
|
+
on as getQueryTimePeriodFilters,
|
|
1158
|
+
Pe as getRequestAcceptHeader,
|
|
1159
|
+
Jt as getResolvedVersionBySingleWildcard,
|
|
1160
|
+
It as getSemiAnnualData,
|
|
1161
|
+
at as getSemiAnnuallyRegExp,
|
|
1162
|
+
_ as getSeriesAttributes,
|
|
1163
|
+
je as getSeriesName,
|
|
1164
|
+
Cn as getStructureComponentsMap,
|
|
1165
|
+
On as getStructureDimensions,
|
|
1166
|
+
Mn as getTimeDimension,
|
|
1167
|
+
Ln as getTimePeriods,
|
|
1168
|
+
Wn as getTimeQueryFilter,
|
|
1169
|
+
an as getTimeRangeFromAttachment,
|
|
1170
|
+
Un as getTimeSeriesCount,
|
|
1171
|
+
Yn as getTimeSeriesFilterKey,
|
|
1172
|
+
ze as getTimeSeriesId,
|
|
1173
|
+
Ee as getWeekCode,
|
|
1174
|
+
ft as getWeeklyPeriodEndDate,
|
|
1175
|
+
mt as getWeeklyPeriodStartDate,
|
|
1176
|
+
dt as getWeeklyRegExp,
|
|
1177
|
+
cn as getWeeksColumns,
|
|
1178
|
+
Zt as getWildCardRegexp,
|
|
1179
|
+
Te as getYearPeriod,
|
|
1180
|
+
C as getYearlyRegExp,
|
|
1181
|
+
bt as getYears,
|
|
1182
|
+
ut as isDaily,
|
|
1183
|
+
W as isMonthly,
|
|
1184
|
+
q as isQuarterly,
|
|
1185
|
+
x as isSemiAnnually,
|
|
1186
|
+
Q as isWeekly,
|
|
1187
|
+
en as isWildCardVersionCorrect,
|
|
1188
|
+
U as isYearly,
|
|
1189
|
+
it as monthlyPattern,
|
|
1190
|
+
xn as openDownloadWindow,
|
|
1191
|
+
tt as quarterPattern,
|
|
1192
|
+
st as semiAnnuallyPattern,
|
|
1193
|
+
Rn as sortPeriods,
|
|
1194
|
+
D as splitUrn,
|
|
1195
|
+
nt as weeklyPattern,
|
|
1196
|
+
rt as yearlyPattern
|
|
1237
1197
|
};
|