@uwrl/qc-utils 0.0.14 → 0.0.17
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/dist/index.d.ts +4 -2
- package/dist/index.js +1647 -285
- package/dist/index.umd.cjs +5 -3
- package/dist/models/dataSource.d.ts +173 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/payload.d.ts +24 -0
- package/dist/models/settings.d.ts +65 -0
- package/dist/models/timestamp.d.ts +150 -0
- package/dist/services/api.d.ts +147 -0
- package/dist/services/apiMethods.d.ts +8 -0
- package/dist/services/createPatchObject.d.ts +17 -0
- package/dist/services/getCSRFToken.d.ts +1 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/requestInterceptor.d.ts +12 -0
- package/dist/services/responseInterceptor.d.ts +2 -0
- package/dist/types/index.d.ts +350 -0
- package/dist/utils/__tests__/ellapsed-time.spec.d.ts +1 -0
- package/dist/utils/__tests__/observations.spec.d.ts +1 -0
- package/dist/utils/ellapsed-time.d.ts +4 -0
- package/dist/utils/format.d.ts +5 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/observations.d.ts +5 -0
- package/dist/utils/plotting/__tests__/observation-record.spec.d.ts +1 -0
- package/dist/utils/plotting/{observationRecord.d.ts → observation-record.d.ts} +8 -23
- package/package.json +1 -1
- package/dist/types.d.ts +0 -51
- package/dist/utils/ellapsedTime.d.ts +0 -0
- package/dist/utils/observationsUtils.d.ts +0 -0
- /package/dist/{utils/__tests__/ellapsedTime.spec.d.ts → services/__tests__/createPatchObject.spec.d.ts} +0 -0
- /package/dist/{utils/__tests__/observationsUtils.spec.d.ts → services/__tests__/requestInterceptor.spec.d.ts} +0 -0
- /package/dist/{utils/plotting/__tests__/observationRecord.spec.d.ts → services/__tests__/responseInterceptor.spec.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,122 +1,1407 @@
|
|
|
1
|
-
var
|
|
2
|
-
const
|
|
3
|
-
"Less than": (
|
|
4
|
-
"Less than or equal to": (
|
|
5
|
-
"Greater than": (
|
|
6
|
-
"Greater than or equal to": (
|
|
7
|
-
Equal: (
|
|
8
|
-
"Start datetime": (
|
|
9
|
-
"End datetime": (
|
|
1
|
+
var $ = /* @__PURE__ */ ((e) => (e.SECOND = "s", e.MINUTE = "m", e.HOUR = "h", e.DAY = "D", e.WEEK = "W", e.MONTH = "M", e.YEAR = "Y", e))($ || {}), v = /* @__PURE__ */ ((e) => (e.ADD_POINTS = "ADD_POINTS", e.CHANGE_VALUES = "CHANGE_VALUES", e.DELETE_POINTS = "DELETE_POINTS", e.DRIFT_CORRECTION = "DRIFT_CORRECTION", e.INTERPOLATE = "INTERPOLATE", e.SHIFT_DATETIMES = "SHIFT_DATETIMES", e.FILL_GAPS = "FILL_GAPS", e))(v || {}), P = /* @__PURE__ */ ((e) => (e.FIND_GAPS = "FIND_GAPS", e.PERSISTENCE = "PERSISTENCE", e.CHANGE = "CHANGE", e.RATE_OF_CHANGE = "RATE_OF_CHANGE", e.VALUE_THRESHOLD = "VALUE_THRESHOLD", e))(P || {}), Me = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e.START = "Start datetime", e.END = "End datetime", e))(Me || {});
|
|
2
|
+
const Ye = {
|
|
3
|
+
"Less than": (e, t) => e < t,
|
|
4
|
+
"Less than or equal to": (e, t) => e <= t,
|
|
5
|
+
"Greater than": (e, t) => e > t,
|
|
6
|
+
"Greater than or equal to": (e, t) => e >= t,
|
|
7
|
+
Equal: (e, t) => e == t,
|
|
8
|
+
"Start datetime": (e, t) => e == t,
|
|
9
|
+
"End datetime": (e, t) => e == t
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
const
|
|
13
|
-
"Less than": (
|
|
14
|
-
"Less than or equal to": (
|
|
15
|
-
"Greater than": (
|
|
16
|
-
"Greater than or equal to": (
|
|
17
|
-
Equal: (
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
var R = /* @__PURE__ */ ((e) => (e.ADD = "ADD", e.SUB = "SUB", e.MULT = "MULT", e.DIV = "DIV", e.ASSIGN = "ASSIGN", e))(R || {}), je = /* @__PURE__ */ ((e) => (e.LT = "Less than", e.LTE = "Less than or equal to", e.GT = "Greater than", e.GTE = "Greater than or equal to", e.E = "Equal", e))(je || {});
|
|
12
|
+
const ie = {
|
|
13
|
+
"Less than": (e, t) => e < t,
|
|
14
|
+
"Less than or equal to": (e, t) => e <= t,
|
|
15
|
+
"Greater than": (e, t) => e > t,
|
|
16
|
+
"Greater than or equal to": (e, t) => e >= t,
|
|
17
|
+
Equal: (e, t) => e == t
|
|
18
|
+
};
|
|
19
|
+
class He {
|
|
20
|
+
id;
|
|
21
|
+
thingId;
|
|
22
|
+
link;
|
|
23
|
+
frequency;
|
|
24
|
+
path;
|
|
25
|
+
datastreamIds;
|
|
26
|
+
publicResource;
|
|
27
|
+
constructor() {
|
|
28
|
+
this.id = "", this.thingId = "", this.link = "", this.frequency = null, this.path = "HydroShare", this.datastreamIds = [], this.publicResource = !1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class wt extends He {
|
|
32
|
+
resourceTitle;
|
|
33
|
+
resourceAbstract;
|
|
34
|
+
resourceKeywords;
|
|
35
|
+
constructor() {
|
|
36
|
+
super(), this.resourceTitle = void 0, this.resourceAbstract = void 0, this.resourceKeywords = void 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
class Ge {
|
|
40
|
+
latitude;
|
|
41
|
+
longitude;
|
|
42
|
+
elevation_m;
|
|
43
|
+
elevationDatum;
|
|
44
|
+
state;
|
|
45
|
+
county;
|
|
46
|
+
country;
|
|
47
|
+
constructor() {
|
|
48
|
+
this.elevationDatum = "WGS84", this.state = "", this.county = "", this.country = "";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class Tt {
|
|
52
|
+
id;
|
|
53
|
+
workspaceId;
|
|
54
|
+
name;
|
|
55
|
+
location = new Ge();
|
|
56
|
+
tags;
|
|
57
|
+
hydroShareArchive;
|
|
58
|
+
siteType;
|
|
59
|
+
samplingFeatureCode;
|
|
60
|
+
isPrivate;
|
|
61
|
+
description;
|
|
62
|
+
samplingFeatureType;
|
|
63
|
+
dataDisclaimer;
|
|
64
|
+
constructor() {
|
|
65
|
+
this.id = "", this.workspaceId = "", this.name = "", this.tags = [], this.siteType = "", this.samplingFeatureCode = "", this.isPrivate = !1, this.description = "", this.samplingFeatureType = "Site", this.dataDisclaimer = "";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class At {
|
|
69
|
+
id;
|
|
70
|
+
workspaceId;
|
|
71
|
+
name;
|
|
72
|
+
description;
|
|
73
|
+
thingId;
|
|
74
|
+
observationType;
|
|
75
|
+
resultType;
|
|
76
|
+
status;
|
|
77
|
+
sampledMedium;
|
|
78
|
+
noDataValue;
|
|
79
|
+
aggregationStatistic;
|
|
80
|
+
unitId;
|
|
81
|
+
observedPropertyId;
|
|
82
|
+
sensorId;
|
|
83
|
+
processingLevelId;
|
|
84
|
+
isPrivate;
|
|
85
|
+
isVisible;
|
|
86
|
+
phenomenonBeginTime;
|
|
87
|
+
phenomenonEndTime;
|
|
88
|
+
intendedTimeSpacing;
|
|
89
|
+
intendedTimeSpacingUnit;
|
|
90
|
+
timeAggregationInterval;
|
|
91
|
+
timeAggregationIntervalUnit;
|
|
92
|
+
dataSourceId;
|
|
93
|
+
valueCount;
|
|
94
|
+
constructor(t) {
|
|
95
|
+
this.id = "", this.workspaceId = "", this.name = "", this.description = "", this.thingId = t || "", this.observationType = "OM_Measurement", this.resultType = "Time Series Coverage", this.sampledMedium = "", this.noDataValue = -9999, this.aggregationStatistic = "", this.unitId = "", this.observedPropertyId = "", this.sensorId = "", this.processingLevelId = "", this.timeAggregationInterval = null, this.timeAggregationIntervalUnit = "seconds", this.isPrivate = !0, this.isVisible = !0, this.valueCount = 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
class Lt {
|
|
99
|
+
id;
|
|
100
|
+
workspaceId;
|
|
101
|
+
name;
|
|
102
|
+
symbol;
|
|
103
|
+
definition;
|
|
104
|
+
type;
|
|
105
|
+
constructor() {
|
|
106
|
+
this.id = "", this.workspaceId = "", this.name = "", this.symbol = "", this.definition = "", this.type = "";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
class It {
|
|
110
|
+
id;
|
|
111
|
+
workspaceId;
|
|
112
|
+
name;
|
|
113
|
+
description;
|
|
114
|
+
manufacturer;
|
|
115
|
+
model;
|
|
116
|
+
methodType;
|
|
117
|
+
methodCode;
|
|
118
|
+
methodLink;
|
|
119
|
+
encodingType;
|
|
120
|
+
modelLink;
|
|
121
|
+
constructor() {
|
|
122
|
+
this.id = "", this.workspaceId = "", this.name = "", this.description = "", this.manufacturer = "", this.model = "", this.methodType = "Instrument Deployment", this.methodCode = "", this.methodLink = "", this.encodingType = "application/json", this.modelLink = "";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
class Dt {
|
|
126
|
+
id;
|
|
127
|
+
workspaceId;
|
|
128
|
+
name;
|
|
129
|
+
definition;
|
|
130
|
+
description;
|
|
131
|
+
type;
|
|
132
|
+
code;
|
|
133
|
+
constructor() {
|
|
134
|
+
this.id = "", this.workspaceId = "", this.name = "", this.definition = "", this.description = "", this.type = "Hydrology", this.code = "";
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
class Ot {
|
|
138
|
+
id;
|
|
139
|
+
workspaceId;
|
|
140
|
+
code;
|
|
141
|
+
definition;
|
|
142
|
+
explanation;
|
|
143
|
+
constructor() {
|
|
144
|
+
this.id = "", this.workspaceId = "", this.code = "", this.definition = "", this.explanation = "";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
class kt {
|
|
148
|
+
id;
|
|
149
|
+
workspaceId;
|
|
150
|
+
code;
|
|
151
|
+
description;
|
|
152
|
+
constructor() {
|
|
153
|
+
this.id = "", this.workspaceId = "", this.code = "", this.description = "";
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
class Ft {
|
|
157
|
+
name;
|
|
158
|
+
code;
|
|
159
|
+
type;
|
|
160
|
+
description;
|
|
161
|
+
link;
|
|
162
|
+
constructor() {
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
class Pt {
|
|
166
|
+
id;
|
|
167
|
+
email;
|
|
168
|
+
password;
|
|
169
|
+
firstName;
|
|
170
|
+
middleName;
|
|
171
|
+
lastName;
|
|
172
|
+
phone;
|
|
173
|
+
address;
|
|
174
|
+
organization;
|
|
175
|
+
type;
|
|
176
|
+
link;
|
|
177
|
+
accountType;
|
|
178
|
+
hydroShareConnected;
|
|
179
|
+
constructor() {
|
|
180
|
+
this.id = "", this.email = "", this.password = "", this.firstName = "", this.middleName = "", this.lastName = "", this.phone = "", this.address = "", this.type = "", this.link = "", this.accountType = "standard", this.hydroShareConnected = !1;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
class Rt {
|
|
184
|
+
id;
|
|
185
|
+
name;
|
|
186
|
+
iconLink;
|
|
187
|
+
signupEnabled;
|
|
188
|
+
connectEnabled;
|
|
189
|
+
constructor() {
|
|
190
|
+
this.id = "", this.name = "", this.iconLink = "", this.signupEnabled = !0, this.connectEnabled = !0;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
var We = /* @__PURE__ */ ((e) => (e.Global = "*", e.View = "view", e.Create = "create", e.Edit = "edit", e.Delete = "delete", e))(We || {}), Xe = /* @__PURE__ */ ((e) => (e.Global = "*", e.Workspace = "Workspace", e.Collaborator = "Collaborator", e.Thing = "Thing", e.Datastream = "Datastream", e.Sensor = "Sensor", e.Unit = "Unit", e.ObservedProperty = "ObservedProperty", e.ProcessingLevel = "ProcessingLevel", e.Observation = "Observation", e))(Xe || {});
|
|
194
|
+
class xt {
|
|
195
|
+
id = "";
|
|
196
|
+
key = "";
|
|
197
|
+
name = "";
|
|
198
|
+
description = "";
|
|
199
|
+
isActive = !0;
|
|
200
|
+
expiresAt = "";
|
|
201
|
+
createdAt = "";
|
|
202
|
+
lastUsed = "";
|
|
203
|
+
workspaceId = "";
|
|
204
|
+
role = null;
|
|
205
|
+
constructor(t) {
|
|
206
|
+
Object.assign(this, t);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
class Nt {
|
|
210
|
+
id;
|
|
211
|
+
name;
|
|
212
|
+
isPrivate;
|
|
213
|
+
owner;
|
|
214
|
+
collaboratorRole;
|
|
215
|
+
pendingTransferTo;
|
|
216
|
+
constructor() {
|
|
217
|
+
this.id = "", this.name = "", this.isPrivate = !1, this.owner = null, this.collaboratorRole = null, this.pendingTransferTo = null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
class Ct {
|
|
221
|
+
user;
|
|
222
|
+
role;
|
|
223
|
+
constructor() {
|
|
224
|
+
this.user = {
|
|
225
|
+
phone: "",
|
|
226
|
+
address: "",
|
|
227
|
+
link: "",
|
|
228
|
+
type: "",
|
|
229
|
+
name: "",
|
|
230
|
+
email: "",
|
|
231
|
+
organizationName: ""
|
|
232
|
+
}, this.role = {
|
|
233
|
+
name: "",
|
|
234
|
+
description: "",
|
|
235
|
+
id: "",
|
|
236
|
+
isApikeyRole: !1,
|
|
237
|
+
isUserRole: !1,
|
|
238
|
+
workspaceId: "",
|
|
239
|
+
permissions: []
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function _e() {
|
|
244
|
+
const e = "csrftoken=", r = decodeURIComponent(document.cookie).split(";");
|
|
245
|
+
for (const s of r) {
|
|
246
|
+
const a = s.trim();
|
|
247
|
+
if (a.startsWith(e))
|
|
248
|
+
return a.substring(e.length);
|
|
249
|
+
}
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
function we(e) {
|
|
253
|
+
let t = e.headers ? { ...e.headers } : {}, r;
|
|
254
|
+
return e.body !== void 0 && (r = typeof e.body == "string" || e.body instanceof FormData ? e.body : JSON.stringify(e.body)), t["X-CSRFToken"] = _e() || "", {
|
|
255
|
+
...e,
|
|
256
|
+
headers: t,
|
|
257
|
+
body: r,
|
|
258
|
+
credentials: "omit"
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function qe(e) {
|
|
262
|
+
if (Array.isArray(e?.errors) && e.errors.length && (e = e.errors[0]), typeof e != "object" || e === null)
|
|
263
|
+
return "An unknown error occurred.";
|
|
264
|
+
const t = ["message", "detail", "error"];
|
|
265
|
+
for (const r of t)
|
|
266
|
+
if (e[r]) return e[r];
|
|
267
|
+
return "An unknown error occurred.";
|
|
268
|
+
}
|
|
269
|
+
async function Te(e) {
|
|
270
|
+
if (e.headers.get("Content-Length") === "0" || e.statusText === "No Content")
|
|
271
|
+
return null;
|
|
272
|
+
const t = e.headers.get("content-type") || "";
|
|
273
|
+
let r = null;
|
|
274
|
+
if (t.includes("application/json"))
|
|
275
|
+
try {
|
|
276
|
+
r = await e.json();
|
|
277
|
+
} catch (a) {
|
|
278
|
+
console.error("Failed to parse error JSON:", a);
|
|
279
|
+
}
|
|
280
|
+
else if (t.includes("text/csv"))
|
|
281
|
+
try {
|
|
282
|
+
r = await e.blob();
|
|
283
|
+
} catch (a) {
|
|
284
|
+
console.error("Failed to parse error JSON:", a);
|
|
285
|
+
}
|
|
286
|
+
if (e.ok || e.status === 401) return r;
|
|
287
|
+
const s = {
|
|
288
|
+
status: e.status,
|
|
289
|
+
message: qe(r)
|
|
290
|
+
};
|
|
291
|
+
throw console.error("API response not OK:", s.message), s;
|
|
292
|
+
}
|
|
293
|
+
var Q = function(e, t) {
|
|
294
|
+
return Q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
|
|
295
|
+
r.__proto__ = s;
|
|
296
|
+
} || function(r, s) {
|
|
297
|
+
for (var a in s) Object.prototype.hasOwnProperty.call(s, a) && (r[a] = s[a]);
|
|
298
|
+
}, Q(e, t);
|
|
299
|
+
};
|
|
300
|
+
function Y(e, t) {
|
|
301
|
+
if (typeof t != "function" && t !== null)
|
|
302
|
+
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
303
|
+
Q(e, t);
|
|
304
|
+
function r() {
|
|
305
|
+
this.constructor = e;
|
|
306
|
+
}
|
|
307
|
+
e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
308
|
+
}
|
|
309
|
+
function K(e) {
|
|
310
|
+
var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], s = 0;
|
|
311
|
+
if (r) return r.call(e);
|
|
312
|
+
if (e && typeof e.length == "number") return {
|
|
313
|
+
next: function() {
|
|
314
|
+
return e && s >= e.length && (e = void 0), { value: e && e[s++], done: !e };
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
318
|
+
}
|
|
319
|
+
function Z(e, t) {
|
|
320
|
+
var r = typeof Symbol == "function" && e[Symbol.iterator];
|
|
321
|
+
if (!r) return e;
|
|
322
|
+
var s = r.call(e), a, n = [], i;
|
|
323
|
+
try {
|
|
324
|
+
for (; (t === void 0 || t-- > 0) && !(a = s.next()).done; ) n.push(a.value);
|
|
325
|
+
} catch (c) {
|
|
326
|
+
i = { error: c };
|
|
327
|
+
} finally {
|
|
328
|
+
try {
|
|
329
|
+
a && !a.done && (r = s.return) && r.call(s);
|
|
330
|
+
} finally {
|
|
331
|
+
if (i) throw i.error;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return n;
|
|
335
|
+
}
|
|
336
|
+
function ee(e, t, r) {
|
|
337
|
+
if (r || arguments.length === 2) for (var s = 0, a = t.length, n; s < a; s++)
|
|
338
|
+
(n || !(s in t)) && (n || (n = Array.prototype.slice.call(t, 0, s)), n[s] = t[s]);
|
|
339
|
+
return e.concat(n || Array.prototype.slice.call(t));
|
|
340
|
+
}
|
|
341
|
+
function w(e) {
|
|
342
|
+
return typeof e == "function";
|
|
343
|
+
}
|
|
344
|
+
function Ae(e) {
|
|
345
|
+
var t = function(s) {
|
|
346
|
+
Error.call(s), s.stack = new Error().stack;
|
|
347
|
+
}, r = e(t);
|
|
348
|
+
return r.prototype = Object.create(Error.prototype), r.prototype.constructor = r, r;
|
|
349
|
+
}
|
|
350
|
+
var W = Ae(function(e) {
|
|
351
|
+
return function(r) {
|
|
352
|
+
e(this), this.message = r ? r.length + ` errors occurred during unsubscription:
|
|
353
|
+
` + r.map(function(s, a) {
|
|
354
|
+
return a + 1 + ") " + s.toString();
|
|
355
|
+
}).join(`
|
|
356
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = r;
|
|
357
|
+
};
|
|
358
|
+
});
|
|
359
|
+
function te(e, t) {
|
|
360
|
+
if (e) {
|
|
361
|
+
var r = e.indexOf(t);
|
|
362
|
+
0 <= r && e.splice(r, 1);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
var j = function() {
|
|
366
|
+
function e(t) {
|
|
367
|
+
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
368
|
+
}
|
|
369
|
+
return e.prototype.unsubscribe = function() {
|
|
370
|
+
var t, r, s, a, n;
|
|
371
|
+
if (!this.closed) {
|
|
372
|
+
this.closed = !0;
|
|
373
|
+
var i = this._parentage;
|
|
374
|
+
if (i)
|
|
375
|
+
if (this._parentage = null, Array.isArray(i))
|
|
376
|
+
try {
|
|
377
|
+
for (var c = K(i), h = c.next(); !h.done; h = c.next()) {
|
|
378
|
+
var u = h.value;
|
|
379
|
+
u.remove(this);
|
|
380
|
+
}
|
|
381
|
+
} catch (b) {
|
|
382
|
+
t = { error: b };
|
|
383
|
+
} finally {
|
|
384
|
+
try {
|
|
385
|
+
h && !h.done && (r = c.return) && r.call(c);
|
|
386
|
+
} finally {
|
|
387
|
+
if (t) throw t.error;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
else
|
|
391
|
+
i.remove(this);
|
|
392
|
+
var d = this.initialTeardown;
|
|
393
|
+
if (w(d))
|
|
394
|
+
try {
|
|
395
|
+
d();
|
|
396
|
+
} catch (b) {
|
|
397
|
+
n = b instanceof W ? b.errors : [b];
|
|
398
|
+
}
|
|
399
|
+
var l = this._finalizers;
|
|
400
|
+
if (l) {
|
|
401
|
+
this._finalizers = null;
|
|
402
|
+
try {
|
|
403
|
+
for (var p = K(l), m = p.next(); !m.done; m = p.next()) {
|
|
404
|
+
var A = m.value;
|
|
405
|
+
try {
|
|
406
|
+
ce(A);
|
|
407
|
+
} catch (b) {
|
|
408
|
+
n = n ?? [], b instanceof W ? n = ee(ee([], Z(n)), Z(b.errors)) : n.push(b);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
} catch (b) {
|
|
412
|
+
s = { error: b };
|
|
413
|
+
} finally {
|
|
414
|
+
try {
|
|
415
|
+
m && !m.done && (a = p.return) && a.call(p);
|
|
416
|
+
} finally {
|
|
417
|
+
if (s) throw s.error;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (n)
|
|
422
|
+
throw new W(n);
|
|
423
|
+
}
|
|
424
|
+
}, e.prototype.add = function(t) {
|
|
425
|
+
var r;
|
|
426
|
+
if (t && t !== this)
|
|
427
|
+
if (this.closed)
|
|
428
|
+
ce(t);
|
|
429
|
+
else {
|
|
430
|
+
if (t instanceof e) {
|
|
431
|
+
if (t.closed || t._hasParent(this))
|
|
432
|
+
return;
|
|
433
|
+
t._addParent(this);
|
|
434
|
+
}
|
|
435
|
+
(this._finalizers = (r = this._finalizers) !== null && r !== void 0 ? r : []).push(t);
|
|
436
|
+
}
|
|
437
|
+
}, e.prototype._hasParent = function(t) {
|
|
438
|
+
var r = this._parentage;
|
|
439
|
+
return r === t || Array.isArray(r) && r.includes(t);
|
|
440
|
+
}, e.prototype._addParent = function(t) {
|
|
441
|
+
var r = this._parentage;
|
|
442
|
+
this._parentage = Array.isArray(r) ? (r.push(t), r) : r ? [r, t] : t;
|
|
443
|
+
}, e.prototype._removeParent = function(t) {
|
|
444
|
+
var r = this._parentage;
|
|
445
|
+
r === t ? this._parentage = null : Array.isArray(r) && te(r, t);
|
|
446
|
+
}, e.prototype.remove = function(t) {
|
|
447
|
+
var r = this._finalizers;
|
|
448
|
+
r && te(r, t), t instanceof e && t._removeParent(this);
|
|
449
|
+
}, e.EMPTY = function() {
|
|
450
|
+
var t = new e();
|
|
451
|
+
return t.closed = !0, t;
|
|
452
|
+
}(), e;
|
|
453
|
+
}(), Le = j.EMPTY;
|
|
454
|
+
function Ie(e) {
|
|
455
|
+
return e instanceof j || e && "closed" in e && w(e.remove) && w(e.add) && w(e.unsubscribe);
|
|
456
|
+
}
|
|
457
|
+
function ce(e) {
|
|
458
|
+
w(e) ? e() : e.unsubscribe();
|
|
459
|
+
}
|
|
460
|
+
var Ve = {
|
|
461
|
+
Promise: void 0
|
|
462
|
+
}, ze = {
|
|
463
|
+
setTimeout: function(e, t) {
|
|
464
|
+
for (var r = [], s = 2; s < arguments.length; s++)
|
|
465
|
+
r[s - 2] = arguments[s];
|
|
466
|
+
return setTimeout.apply(void 0, ee([e, t], Z(r)));
|
|
467
|
+
},
|
|
468
|
+
clearTimeout: function(e) {
|
|
469
|
+
return clearTimeout(e);
|
|
470
|
+
},
|
|
471
|
+
delegate: void 0
|
|
472
|
+
};
|
|
473
|
+
function Je(e) {
|
|
474
|
+
ze.setTimeout(function() {
|
|
475
|
+
throw e;
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
function he() {
|
|
479
|
+
}
|
|
480
|
+
function U(e) {
|
|
481
|
+
e();
|
|
482
|
+
}
|
|
483
|
+
var De = function(e) {
|
|
484
|
+
Y(t, e);
|
|
485
|
+
function t(r) {
|
|
486
|
+
var s = e.call(this) || this;
|
|
487
|
+
return s.isStopped = !1, r ? (s.destination = r, Ie(r) && r.add(s)) : s.destination = Ze, s;
|
|
488
|
+
}
|
|
489
|
+
return t.create = function(r, s, a) {
|
|
490
|
+
return new re(r, s, a);
|
|
491
|
+
}, t.prototype.next = function(r) {
|
|
492
|
+
this.isStopped || this._next(r);
|
|
493
|
+
}, t.prototype.error = function(r) {
|
|
494
|
+
this.isStopped || (this.isStopped = !0, this._error(r));
|
|
495
|
+
}, t.prototype.complete = function() {
|
|
496
|
+
this.isStopped || (this.isStopped = !0, this._complete());
|
|
497
|
+
}, t.prototype.unsubscribe = function() {
|
|
498
|
+
this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
|
|
499
|
+
}, t.prototype._next = function(r) {
|
|
500
|
+
this.destination.next(r);
|
|
501
|
+
}, t.prototype._error = function(r) {
|
|
502
|
+
try {
|
|
503
|
+
this.destination.error(r);
|
|
504
|
+
} finally {
|
|
505
|
+
this.unsubscribe();
|
|
506
|
+
}
|
|
507
|
+
}, t.prototype._complete = function() {
|
|
508
|
+
try {
|
|
509
|
+
this.destination.complete();
|
|
510
|
+
} finally {
|
|
511
|
+
this.unsubscribe();
|
|
512
|
+
}
|
|
513
|
+
}, t;
|
|
514
|
+
}(j), Qe = function() {
|
|
515
|
+
function e(t) {
|
|
516
|
+
this.partialObserver = t;
|
|
517
|
+
}
|
|
518
|
+
return e.prototype.next = function(t) {
|
|
519
|
+
var r = this.partialObserver;
|
|
520
|
+
if (r.next)
|
|
521
|
+
try {
|
|
522
|
+
r.next(t);
|
|
523
|
+
} catch (s) {
|
|
524
|
+
C(s);
|
|
525
|
+
}
|
|
526
|
+
}, e.prototype.error = function(t) {
|
|
527
|
+
var r = this.partialObserver;
|
|
528
|
+
if (r.error)
|
|
529
|
+
try {
|
|
530
|
+
r.error(t);
|
|
531
|
+
} catch (s) {
|
|
532
|
+
C(s);
|
|
533
|
+
}
|
|
534
|
+
else
|
|
535
|
+
C(t);
|
|
536
|
+
}, e.prototype.complete = function() {
|
|
537
|
+
var t = this.partialObserver;
|
|
538
|
+
if (t.complete)
|
|
539
|
+
try {
|
|
540
|
+
t.complete();
|
|
541
|
+
} catch (r) {
|
|
542
|
+
C(r);
|
|
543
|
+
}
|
|
544
|
+
}, e;
|
|
545
|
+
}(), re = function(e) {
|
|
546
|
+
Y(t, e);
|
|
547
|
+
function t(r, s, a) {
|
|
548
|
+
var n = e.call(this) || this, i;
|
|
549
|
+
return w(r) || !r ? i = {
|
|
550
|
+
next: r ?? void 0,
|
|
551
|
+
error: s ?? void 0,
|
|
552
|
+
complete: a ?? void 0
|
|
553
|
+
} : i = r, n.destination = new Qe(i), n;
|
|
554
|
+
}
|
|
555
|
+
return t;
|
|
556
|
+
}(De);
|
|
557
|
+
function C(e) {
|
|
558
|
+
Je(e);
|
|
559
|
+
}
|
|
560
|
+
function Ke(e) {
|
|
561
|
+
throw e;
|
|
562
|
+
}
|
|
563
|
+
var Ze = {
|
|
564
|
+
closed: !0,
|
|
565
|
+
next: he,
|
|
566
|
+
error: Ke,
|
|
567
|
+
complete: he
|
|
568
|
+
}, et = function() {
|
|
569
|
+
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
570
|
+
}();
|
|
571
|
+
function tt(e) {
|
|
572
|
+
return e;
|
|
573
|
+
}
|
|
574
|
+
function rt(e) {
|
|
575
|
+
return e.length === 0 ? tt : e.length === 1 ? e[0] : function(r) {
|
|
576
|
+
return e.reduce(function(s, a) {
|
|
577
|
+
return a(s);
|
|
578
|
+
}, r);
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
var ue = function() {
|
|
582
|
+
function e(t) {
|
|
583
|
+
t && (this._subscribe = t);
|
|
584
|
+
}
|
|
585
|
+
return e.prototype.lift = function(t) {
|
|
586
|
+
var r = new e();
|
|
587
|
+
return r.source = this, r.operator = t, r;
|
|
588
|
+
}, e.prototype.subscribe = function(t, r, s) {
|
|
589
|
+
var a = this, n = at(t) ? t : new re(t, r, s);
|
|
590
|
+
return U(function() {
|
|
591
|
+
var i = a, c = i.operator, h = i.source;
|
|
592
|
+
n.add(c ? c.call(n, h) : h ? a._subscribe(n) : a._trySubscribe(n));
|
|
593
|
+
}), n;
|
|
594
|
+
}, e.prototype._trySubscribe = function(t) {
|
|
595
|
+
try {
|
|
596
|
+
return this._subscribe(t);
|
|
597
|
+
} catch (r) {
|
|
598
|
+
t.error(r);
|
|
599
|
+
}
|
|
600
|
+
}, e.prototype.forEach = function(t, r) {
|
|
601
|
+
var s = this;
|
|
602
|
+
return r = le(r), new r(function(a, n) {
|
|
603
|
+
var i = new re({
|
|
604
|
+
next: function(c) {
|
|
605
|
+
try {
|
|
606
|
+
t(c);
|
|
607
|
+
} catch (h) {
|
|
608
|
+
n(h), i.unsubscribe();
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
error: n,
|
|
612
|
+
complete: a
|
|
613
|
+
});
|
|
614
|
+
s.subscribe(i);
|
|
615
|
+
});
|
|
616
|
+
}, e.prototype._subscribe = function(t) {
|
|
617
|
+
var r;
|
|
618
|
+
return (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(t);
|
|
619
|
+
}, e.prototype[et] = function() {
|
|
620
|
+
return this;
|
|
621
|
+
}, e.prototype.pipe = function() {
|
|
622
|
+
for (var t = [], r = 0; r < arguments.length; r++)
|
|
623
|
+
t[r] = arguments[r];
|
|
624
|
+
return rt(t)(this);
|
|
625
|
+
}, e.prototype.toPromise = function(t) {
|
|
626
|
+
var r = this;
|
|
627
|
+
return t = le(t), new t(function(s, a) {
|
|
628
|
+
var n;
|
|
629
|
+
r.subscribe(function(i) {
|
|
630
|
+
return n = i;
|
|
631
|
+
}, function(i) {
|
|
632
|
+
return a(i);
|
|
633
|
+
}, function() {
|
|
634
|
+
return s(n);
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
}, e.create = function(t) {
|
|
638
|
+
return new e(t);
|
|
639
|
+
}, e;
|
|
640
|
+
}();
|
|
641
|
+
function le(e) {
|
|
642
|
+
var t;
|
|
643
|
+
return (t = e ?? Ve.Promise) !== null && t !== void 0 ? t : Promise;
|
|
644
|
+
}
|
|
645
|
+
function st(e) {
|
|
646
|
+
return e && w(e.next) && w(e.error) && w(e.complete);
|
|
647
|
+
}
|
|
648
|
+
function at(e) {
|
|
649
|
+
return e && e instanceof De || st(e) && Ie(e);
|
|
650
|
+
}
|
|
651
|
+
var nt = Ae(function(e) {
|
|
652
|
+
return function() {
|
|
653
|
+
e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
654
|
+
};
|
|
655
|
+
}), Oe = function(e) {
|
|
656
|
+
Y(t, e);
|
|
657
|
+
function t() {
|
|
658
|
+
var r = e.call(this) || this;
|
|
659
|
+
return r.closed = !1, r.currentObservers = null, r.observers = [], r.isStopped = !1, r.hasError = !1, r.thrownError = null, r;
|
|
660
|
+
}
|
|
661
|
+
return t.prototype.lift = function(r) {
|
|
662
|
+
var s = new de(this, this);
|
|
663
|
+
return s.operator = r, s;
|
|
664
|
+
}, t.prototype._throwIfClosed = function() {
|
|
665
|
+
if (this.closed)
|
|
666
|
+
throw new nt();
|
|
667
|
+
}, t.prototype.next = function(r) {
|
|
668
|
+
var s = this;
|
|
669
|
+
U(function() {
|
|
670
|
+
var a, n;
|
|
671
|
+
if (s._throwIfClosed(), !s.isStopped) {
|
|
672
|
+
s.currentObservers || (s.currentObservers = Array.from(s.observers));
|
|
673
|
+
try {
|
|
674
|
+
for (var i = K(s.currentObservers), c = i.next(); !c.done; c = i.next()) {
|
|
675
|
+
var h = c.value;
|
|
676
|
+
h.next(r);
|
|
677
|
+
}
|
|
678
|
+
} catch (u) {
|
|
679
|
+
a = { error: u };
|
|
680
|
+
} finally {
|
|
681
|
+
try {
|
|
682
|
+
c && !c.done && (n = i.return) && n.call(i);
|
|
683
|
+
} finally {
|
|
684
|
+
if (a) throw a.error;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
}, t.prototype.error = function(r) {
|
|
690
|
+
var s = this;
|
|
691
|
+
U(function() {
|
|
692
|
+
if (s._throwIfClosed(), !s.isStopped) {
|
|
693
|
+
s.hasError = s.isStopped = !0, s.thrownError = r;
|
|
694
|
+
for (var a = s.observers; a.length; )
|
|
695
|
+
a.shift().error(r);
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
}, t.prototype.complete = function() {
|
|
699
|
+
var r = this;
|
|
700
|
+
U(function() {
|
|
701
|
+
if (r._throwIfClosed(), !r.isStopped) {
|
|
702
|
+
r.isStopped = !0;
|
|
703
|
+
for (var s = r.observers; s.length; )
|
|
704
|
+
s.shift().complete();
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
}, t.prototype.unsubscribe = function() {
|
|
708
|
+
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
|
709
|
+
}, Object.defineProperty(t.prototype, "observed", {
|
|
710
|
+
get: function() {
|
|
711
|
+
var r;
|
|
712
|
+
return ((r = this.observers) === null || r === void 0 ? void 0 : r.length) > 0;
|
|
713
|
+
},
|
|
714
|
+
enumerable: !1,
|
|
715
|
+
configurable: !0
|
|
716
|
+
}), t.prototype._trySubscribe = function(r) {
|
|
717
|
+
return this._throwIfClosed(), e.prototype._trySubscribe.call(this, r);
|
|
718
|
+
}, t.prototype._subscribe = function(r) {
|
|
719
|
+
return this._throwIfClosed(), this._checkFinalizedStatuses(r), this._innerSubscribe(r);
|
|
720
|
+
}, t.prototype._innerSubscribe = function(r) {
|
|
721
|
+
var s = this, a = this, n = a.hasError, i = a.isStopped, c = a.observers;
|
|
722
|
+
return n || i ? Le : (this.currentObservers = null, c.push(r), new j(function() {
|
|
723
|
+
s.currentObservers = null, te(c, r);
|
|
724
|
+
}));
|
|
725
|
+
}, t.prototype._checkFinalizedStatuses = function(r) {
|
|
726
|
+
var s = this, a = s.hasError, n = s.thrownError, i = s.isStopped;
|
|
727
|
+
a ? r.error(n) : i && r.complete();
|
|
728
|
+
}, t.prototype.asObservable = function() {
|
|
729
|
+
var r = new ue();
|
|
730
|
+
return r.source = this, r;
|
|
731
|
+
}, t.create = function(r, s) {
|
|
732
|
+
return new de(r, s);
|
|
733
|
+
}, t;
|
|
734
|
+
}(ue), de = function(e) {
|
|
735
|
+
Y(t, e);
|
|
736
|
+
function t(r, s) {
|
|
737
|
+
var a = e.call(this) || this;
|
|
738
|
+
return a.destination = r, a.source = s, a;
|
|
739
|
+
}
|
|
740
|
+
return t.prototype.next = function(r) {
|
|
741
|
+
var s, a;
|
|
742
|
+
(a = (s = this.destination) === null || s === void 0 ? void 0 : s.next) === null || a === void 0 || a.call(s, r);
|
|
743
|
+
}, t.prototype.error = function(r) {
|
|
744
|
+
var s, a;
|
|
745
|
+
(a = (s = this.destination) === null || s === void 0 ? void 0 : s.error) === null || a === void 0 || a.call(s, r);
|
|
746
|
+
}, t.prototype.complete = function() {
|
|
747
|
+
var r, s;
|
|
748
|
+
(s = (r = this.destination) === null || r === void 0 ? void 0 : r.complete) === null || s === void 0 || s.call(r);
|
|
749
|
+
}, t.prototype._subscribe = function(r) {
|
|
750
|
+
var s, a;
|
|
751
|
+
return (a = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(r)) !== null && a !== void 0 ? a : Le;
|
|
752
|
+
}, t;
|
|
753
|
+
}(Oe);
|
|
754
|
+
const ke = 3e3;
|
|
755
|
+
var Fe = /* @__PURE__ */ ((e) => (e.Warning = "warning", e.Success = "success", e.Error = "error", e.Info = "info", e))(Fe || {}), Pe = /* @__PURE__ */ ((e) => (e.Success = "mdi-checkbox-marked-circle", e.Warning = "mdi-alert", e.Error = "mdi-alert-circle", e.Info = "mdi-information", e.None = "none", e))(Pe || {}), Re = /* @__PURE__ */ ((e) => (e.Warning = "Warning", e.Success = "Success", e.Error = "Error", e.Info = "Info", e))(Re || {}), ot = /* @__PURE__ */ ((e) => (e.Center = "center", e.Left = "left", e.Right = "right", e.Bottom = "bottom", e.Top = "top", e))(ot || {});
|
|
756
|
+
class it {
|
|
757
|
+
constructor(t = "", r = "info", s = "none", a = "Info", n = ke, i = "center", c = !1) {
|
|
758
|
+
this.message = t, this.color = r, this.icon = s, this.title = a, this.timeout = n, this.position = i, this.visible = c;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
class ct {
|
|
762
|
+
static subject = new Oe();
|
|
763
|
+
static get snack$() {
|
|
764
|
+
return this.subject.asObservable();
|
|
765
|
+
}
|
|
766
|
+
static createSnackbar(t, r) {
|
|
767
|
+
this.subject.next(
|
|
768
|
+
new it(
|
|
769
|
+
t,
|
|
770
|
+
Fe[r],
|
|
771
|
+
Pe[r],
|
|
772
|
+
Re[r],
|
|
773
|
+
ke,
|
|
774
|
+
"bottom",
|
|
775
|
+
!0
|
|
776
|
+
)
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
static success(t) {
|
|
780
|
+
this.createSnackbar(
|
|
781
|
+
t,
|
|
782
|
+
"Success"
|
|
783
|
+
/* Success */
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
static warn(t) {
|
|
787
|
+
this.createSnackbar(
|
|
788
|
+
t,
|
|
789
|
+
"Warning"
|
|
790
|
+
/* Warning */
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
static error(t) {
|
|
794
|
+
this.createSnackbar(
|
|
795
|
+
t,
|
|
796
|
+
"Error"
|
|
797
|
+
/* Error */
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
static info(t) {
|
|
801
|
+
this.createSnackbar(
|
|
802
|
+
t,
|
|
803
|
+
"Info"
|
|
804
|
+
/* Info */
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
function xe(e, t) {
|
|
809
|
+
const r = {};
|
|
810
|
+
for (let s in t)
|
|
811
|
+
if (Array.isArray(t[s]))
|
|
812
|
+
JSON.stringify(e[s]) !== JSON.stringify(t[s]) && (r[s] = t[s]);
|
|
813
|
+
else if (e[s] && typeof e[s] == "object" && t[s] && typeof t[s] == "object") {
|
|
814
|
+
const a = xe(e[s], t[s]);
|
|
815
|
+
Object.keys(a).length > 0 && (r[s] = a);
|
|
816
|
+
} else JSON.stringify(e[s]) !== JSON.stringify(t[s]) && (r[s] = t[s]);
|
|
817
|
+
return r;
|
|
818
|
+
}
|
|
819
|
+
function ht(e) {
|
|
820
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
821
|
+
}
|
|
822
|
+
var X, fe;
|
|
823
|
+
function ut() {
|
|
824
|
+
if (fe) return X;
|
|
825
|
+
fe = 1;
|
|
826
|
+
class e {
|
|
827
|
+
/// value;
|
|
828
|
+
/// next;
|
|
829
|
+
constructor(s) {
|
|
830
|
+
this.value = s, this.next = void 0;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
class t {
|
|
834
|
+
// TODO: Use private class fields when targeting Node.js 12.
|
|
835
|
+
// #_head;
|
|
836
|
+
// #_tail;
|
|
837
|
+
// #_size;
|
|
838
|
+
constructor() {
|
|
839
|
+
this.clear();
|
|
840
|
+
}
|
|
841
|
+
enqueue(s) {
|
|
842
|
+
const a = new e(s);
|
|
843
|
+
this._head ? (this._tail.next = a, this._tail = a) : (this._head = a, this._tail = a), this._size++;
|
|
844
|
+
}
|
|
845
|
+
dequeue() {
|
|
846
|
+
const s = this._head;
|
|
847
|
+
if (s)
|
|
848
|
+
return this._head = this._head.next, this._size--, s.value;
|
|
849
|
+
}
|
|
850
|
+
clear() {
|
|
851
|
+
this._head = void 0, this._tail = void 0, this._size = 0;
|
|
852
|
+
}
|
|
853
|
+
get size() {
|
|
854
|
+
return this._size;
|
|
855
|
+
}
|
|
856
|
+
*[Symbol.iterator]() {
|
|
857
|
+
let s = this._head;
|
|
858
|
+
for (; s; )
|
|
859
|
+
yield s.value, s = s.next;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
return X = t, X;
|
|
863
|
+
}
|
|
864
|
+
var q, pe;
|
|
865
|
+
function lt() {
|
|
866
|
+
if (pe) return q;
|
|
867
|
+
pe = 1;
|
|
868
|
+
const e = ut();
|
|
869
|
+
return q = (r) => {
|
|
870
|
+
if (!((Number.isInteger(r) || r === 1 / 0) && r > 0))
|
|
871
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
872
|
+
const s = new e();
|
|
873
|
+
let a = 0;
|
|
874
|
+
const n = () => {
|
|
875
|
+
a--, s.size > 0 && s.dequeue()();
|
|
876
|
+
}, i = async (u, d, ...l) => {
|
|
877
|
+
a++;
|
|
878
|
+
const p = (async () => u(...l))();
|
|
879
|
+
d(p);
|
|
880
|
+
try {
|
|
881
|
+
await p;
|
|
882
|
+
} catch {
|
|
883
|
+
}
|
|
884
|
+
n();
|
|
885
|
+
}, c = (u, d, ...l) => {
|
|
886
|
+
s.enqueue(i.bind(null, u, d, ...l)), (async () => (await Promise.resolve(), a < r && s.size > 0 && s.dequeue()()))();
|
|
887
|
+
}, h = (u, ...d) => new Promise((l) => {
|
|
888
|
+
c(u, l, ...d);
|
|
889
|
+
});
|
|
890
|
+
return Object.defineProperties(h, {
|
|
891
|
+
activeCount: {
|
|
892
|
+
get: () => a
|
|
893
|
+
},
|
|
894
|
+
pendingCount: {
|
|
895
|
+
get: () => s.size
|
|
896
|
+
},
|
|
897
|
+
clearQueue: {
|
|
898
|
+
value: () => {
|
|
899
|
+
s.clear();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}), h;
|
|
903
|
+
}, q;
|
|
904
|
+
}
|
|
905
|
+
var dt = lt();
|
|
906
|
+
const ft = /* @__PURE__ */ ht(dt), L = ft(10), pt = 1e3;
|
|
907
|
+
async function O(e, t) {
|
|
908
|
+
const r = we(t);
|
|
909
|
+
try {
|
|
910
|
+
const s = await fetch(e, r);
|
|
911
|
+
return await Te(s);
|
|
912
|
+
} catch (s) {
|
|
913
|
+
throw s instanceof TypeError && ct.error("Network error. Please check your connection."), s;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
const o = {
|
|
917
|
+
async fetch(e, t = {}) {
|
|
918
|
+
return t.method = "GET", await L(() => O(e, t));
|
|
919
|
+
},
|
|
920
|
+
async patch(e, t, r = null, s = {}) {
|
|
921
|
+
if (s.method = "PATCH", s.body = r ? xe(r, t) : t, Object.keys(s.body).length !== 0)
|
|
922
|
+
return await L(() => O(e, s));
|
|
923
|
+
},
|
|
924
|
+
async post(e, t = void 0, r = {}) {
|
|
925
|
+
return r.method = "POST", r.body = t, await L(() => O(e, r));
|
|
926
|
+
},
|
|
927
|
+
async put(e, t = void 0, r = {}) {
|
|
928
|
+
return r.method = "PUT", r.body = t, await L(() => O(e, r));
|
|
929
|
+
},
|
|
930
|
+
async delete(e, t = void 0, r = {}) {
|
|
931
|
+
return r.method = "DELETE", r.body = t, await L(() => O(e, r));
|
|
932
|
+
},
|
|
933
|
+
async paginatedFetch(e, t) {
|
|
934
|
+
const r = t ?? pt, s = e.includes("?") ? "&" : "?", a = `${e}${s}page_size=${r}&page=1`, n = we({ method: "GET" }), i = await L(() => fetch(a, n)), c = Number(i.headers.get("x-total-pages")) || 1, u = [...await Te(i)];
|
|
935
|
+
for (let d = 2; d <= c; d++) {
|
|
936
|
+
const l = `${e}${s}page_size=${r}&page=${d}`, p = await L(() => O(l, { method: "GET" }));
|
|
937
|
+
u.push(...p);
|
|
938
|
+
}
|
|
939
|
+
return u;
|
|
940
|
+
}
|
|
941
|
+
}, ye = {
|
|
942
|
+
HTTP: {
|
|
943
|
+
type: "HTTP",
|
|
944
|
+
sourceUri: "",
|
|
945
|
+
placeholderVariables: []
|
|
946
|
+
},
|
|
947
|
+
local: {
|
|
948
|
+
type: "local",
|
|
949
|
+
sourceUri: "",
|
|
950
|
+
placeholderVariables: []
|
|
951
|
+
}
|
|
952
|
+
}, me = {
|
|
953
|
+
JSON: {
|
|
954
|
+
type: "JSON",
|
|
955
|
+
timestamp: {
|
|
956
|
+
key: "",
|
|
957
|
+
format: "ISO8601",
|
|
958
|
+
timezoneMode: "embeddedOffset"
|
|
959
|
+
},
|
|
960
|
+
JMESPath: ""
|
|
961
|
+
},
|
|
962
|
+
CSV: {
|
|
963
|
+
type: "CSV",
|
|
964
|
+
timestamp: {
|
|
965
|
+
key: "",
|
|
966
|
+
format: "ISO8601",
|
|
967
|
+
timezoneMode: "embeddedOffset"
|
|
968
|
+
},
|
|
969
|
+
headerRow: 1,
|
|
970
|
+
dataStartRow: 2,
|
|
971
|
+
delimiter: ",",
|
|
972
|
+
identifierType: "name"
|
|
973
|
+
/* Name */
|
|
974
|
+
}
|
|
975
|
+
}, ge = {
|
|
976
|
+
HydroServer: {
|
|
977
|
+
type: "HydroServer"
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
class Ut {
|
|
981
|
+
name = "";
|
|
982
|
+
settings = {
|
|
983
|
+
type: "SDL",
|
|
984
|
+
extractor: JSON.parse(JSON.stringify(ye.local)),
|
|
985
|
+
transformer: JSON.parse(JSON.stringify(me.CSV)),
|
|
986
|
+
loader: JSON.parse(JSON.stringify(ge.HydroServer)),
|
|
987
|
+
payloads: []
|
|
988
|
+
};
|
|
989
|
+
id = "";
|
|
990
|
+
workspaceId = "";
|
|
991
|
+
orchestrationSystem = {
|
|
992
|
+
id: "",
|
|
993
|
+
name: "",
|
|
994
|
+
workspaceId: "",
|
|
995
|
+
type: ""
|
|
996
|
+
};
|
|
997
|
+
schedule = {
|
|
998
|
+
interval: 15,
|
|
999
|
+
intervalUnits: "minutes"
|
|
1000
|
+
};
|
|
1001
|
+
status = { paused: !0 };
|
|
1002
|
+
datastreams = [];
|
|
1003
|
+
constructor(t) {
|
|
1004
|
+
Object.assign(this, t);
|
|
1005
|
+
}
|
|
1006
|
+
switchExtractor(t) {
|
|
1007
|
+
this.settings.extractor = JSON.parse(
|
|
1008
|
+
JSON.stringify(ye[t])
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
switchTransformer(t) {
|
|
1012
|
+
this.settings.transformer = JSON.parse(
|
|
1013
|
+
JSON.stringify(me[t])
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
switchLoader(t) {
|
|
1017
|
+
this.settings.loader = JSON.parse(JSON.stringify(ge[t]));
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
function be(e) {
|
|
1021
|
+
return {
|
|
1022
|
+
name: e.name,
|
|
1023
|
+
settings: e.settings,
|
|
1024
|
+
workspaceId: e.workspaceId,
|
|
1025
|
+
orchestrationSystemId: e.orchestrationSystem.id,
|
|
1026
|
+
schedule: e.schedule,
|
|
1027
|
+
status: e.status
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
const S = "https://lro.hydroserver.org/api", ae = `${S}/auth`, E = `${ae}/browser/account`, V = `${ae}/browser/session`, B = `${ae}/browser/provider`, y = `${S}/data/workspaces`, z = `${S}/data/roles`, g = `${S}/data/datastreams`, T = `${S}/data/sensors`, f = `${S}/data/things`, ve = `${f}/tags`, k = `${S}/data/orchestration-systems`, _ = `${S}/data/data-sources`, I = `${S}/data/observed-properties`, F = `${S}/data/processing-levels`, x = `${S}/data/result-qualifiers`, D = `${S}/data/units`, Bt = (e, t, r, s, a) => {
|
|
1031
|
+
let n = `${g}/${e}/observations?format=column`;
|
|
1032
|
+
return n += `&order_by=phenomenonTime&page_size=${t}`, n += `&phenomenon_time_min=${encodeURIComponent(r)}`, s && (n += `&phenomenon_time_max=${encodeURIComponent(s)}`), a && (n += `&page=${a}`), n;
|
|
1033
|
+
}, yt = (e, t, r) => {
|
|
1034
|
+
const s = {
|
|
1035
|
+
provider: e,
|
|
1036
|
+
callback_url: t,
|
|
1037
|
+
process: r
|
|
1038
|
+
}, a = _e(), n = document.createElement("form");
|
|
1039
|
+
if (n.method = "POST", n.action = `${B}/redirect`, a) {
|
|
1040
|
+
const i = document.createElement("input");
|
|
1041
|
+
i.type = "hidden", i.name = "csrfmiddlewaretoken", i.value = a, n.appendChild(i);
|
|
1042
|
+
}
|
|
1043
|
+
for (const i in s) {
|
|
1044
|
+
const c = document.createElement("input");
|
|
1045
|
+
c.type = "hidden", c.name = i, c.value = s[i] || "", n.appendChild(c);
|
|
1046
|
+
}
|
|
1047
|
+
document.body.appendChild(n), n.submit();
|
|
1048
|
+
}, Mt = {
|
|
1049
|
+
fetchSession: async () => o.fetch(`${V}`),
|
|
1050
|
+
login: async (e, t) => o.post(`${V}`, { email: e, password: t }),
|
|
1051
|
+
logout: async () => o.delete(`${V}`),
|
|
1052
|
+
fetchUser: async () => o.fetch(`${E}`),
|
|
1053
|
+
signup: async (e) => o.post(`${E}`, e),
|
|
1054
|
+
updateUser: async (e, t) => o.patch(`${E}`, e, t),
|
|
1055
|
+
deleteUser: async () => o.delete(`${E}`),
|
|
1056
|
+
sendVerificationEmail: async (e) => o.put(`${E}/email/verify`, {
|
|
1057
|
+
email: e
|
|
1058
|
+
}),
|
|
1059
|
+
verifyEmailWithCode: async (e) => o.post(`${E}/email/verify`, { key: e }),
|
|
1060
|
+
requestPasswordReset: async (e) => o.post(`${E}/password/request`, {
|
|
1061
|
+
email: e
|
|
1062
|
+
}),
|
|
1063
|
+
resetPassword: async (e, t) => o.post(`${E}/password/reset`, {
|
|
1064
|
+
key: e,
|
|
1065
|
+
password: t
|
|
1066
|
+
}),
|
|
1067
|
+
fetchWorkspaces: async () => o.paginatedFetch(`${y}`),
|
|
1068
|
+
fetchAssociatedWorkspaces: async () => o.paginatedFetch(`${y}?is_associated=true`),
|
|
1069
|
+
fetchWorkspace: async (e) => o.fetch(`${y}/${e}`),
|
|
1070
|
+
createWorkspace: async (e) => o.post(y, e),
|
|
1071
|
+
updateWorkspace: async (e, t = null) => o.patch(
|
|
1072
|
+
`${y}/${e.id}`,
|
|
1073
|
+
e,
|
|
1074
|
+
t
|
|
1075
|
+
),
|
|
1076
|
+
deleteWorkspace: async (e) => o.delete(`${y}/${e}`),
|
|
1077
|
+
transferWorkspace: async (e, t) => o.post(`${y}/${e}/transfer`, { newOwner: t }),
|
|
1078
|
+
acceptWorkspaceTransfer: async (e) => o.put(`${y}/${e}/transfer`),
|
|
1079
|
+
rejectWorkspaceTransfer: async (e) => o.delete(`${y}/${e}/transfer`),
|
|
1080
|
+
getCollaboratorRoles: async (e) => o.paginatedFetch(`${z}?is_user_role=true`),
|
|
1081
|
+
getAPIKeyRoles: async (e) => o.paginatedFetch(`${z}?is_apikey_role=true`),
|
|
1082
|
+
getRole: async (e) => o.fetch(`${z}/${e}`),
|
|
1083
|
+
getCollaborators: async (e) => o.paginatedFetch(`${y}/${e}/collaborators`),
|
|
1084
|
+
addCollaborator: async (e, t, r) => o.post(`${y}/${e}/collaborators`, {
|
|
1085
|
+
email: t,
|
|
1086
|
+
roleId: r
|
|
1087
|
+
}),
|
|
1088
|
+
updateCollaboratorRole: async (e, t, r) => o.put(`${y}/${e}/collaborators`, {
|
|
1089
|
+
email: t,
|
|
1090
|
+
roleId: r
|
|
1091
|
+
}),
|
|
1092
|
+
removeCollaborator: async (e, t) => o.delete(`${y}/${e}/collaborators`, { email: t }),
|
|
1093
|
+
fetchApiKeys: async (e) => o.paginatedFetch(
|
|
1094
|
+
`${y}/${e}/api-keys?expand_related=true`
|
|
1095
|
+
),
|
|
1096
|
+
fetchApiKey: async (e, t) => o.fetch(
|
|
1097
|
+
`${y}/${e}/api-keys/${t}?expand_related=true`
|
|
1098
|
+
),
|
|
1099
|
+
createApiKey: async (e) => o.post(
|
|
1100
|
+
`${y}/${e.workspaceId}/api-keys?expand_related=true`,
|
|
1101
|
+
{
|
|
1102
|
+
name: e.name,
|
|
1103
|
+
description: e.description,
|
|
1104
|
+
isActive: !0,
|
|
1105
|
+
roleId: e.role.id
|
|
1106
|
+
}
|
|
1107
|
+
),
|
|
1108
|
+
updateApiKey: async (e, t) => o.patch(
|
|
1109
|
+
`${y}/${e.workspaceId}/api-keys/${e.id}?expand_related=true`,
|
|
1110
|
+
{
|
|
1111
|
+
name: e.name,
|
|
1112
|
+
description: e.description,
|
|
1113
|
+
isActive: !0,
|
|
1114
|
+
roleId: e.role.id
|
|
1115
|
+
},
|
|
1116
|
+
t && {
|
|
1117
|
+
name: t.name,
|
|
1118
|
+
description: t.description,
|
|
1119
|
+
isActive: !0,
|
|
1120
|
+
roleId: t.role.id
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
regenerateApiKey: async (e, t) => o.put(
|
|
1124
|
+
`${y}/${e}/api-keys/${t}/regenerate?expand_related=true`
|
|
1125
|
+
),
|
|
1126
|
+
deleteApiKey: async (e, t) => o.delete(`${y}/${e}/api-keys/${t}`),
|
|
1127
|
+
fetchConnectedProviders: async () => o.fetch(`${B}/connections`),
|
|
1128
|
+
providerRedirect: yt,
|
|
1129
|
+
providerSignup: async (e) => o.post(`${B}/signup`, e),
|
|
1130
|
+
deleteProvider: async (e, t) => o.delete(`${B}/connections`, {
|
|
1131
|
+
provider: e,
|
|
1132
|
+
account: t
|
|
1133
|
+
}),
|
|
1134
|
+
createUnit: async (e) => o.post(D, e),
|
|
1135
|
+
fetchUnits: async () => o.paginatedFetch(`${D}`),
|
|
1136
|
+
fetchWorkspaceUnits: async (e) => o.paginatedFetch(`${D}?workspace_id=${e}`),
|
|
1137
|
+
updateUnit: async (e, t = null) => o.patch(`${D}/${e.id}`, e, t),
|
|
1138
|
+
deleteUnit: async (e) => o.delete(`${D}/${e}`),
|
|
1139
|
+
getUnit: async (e) => o.fetch(`${D}/${e}`),
|
|
1140
|
+
removeThingOwner: async (e, t) => o.patch(`${f}/${e}/ownership`, {
|
|
1141
|
+
email: t,
|
|
1142
|
+
removeOwner: !0
|
|
1143
|
+
}),
|
|
1144
|
+
addSecondaryOwner: async (e, t) => o.patch(`${f}/${e}/ownership`, {
|
|
1145
|
+
email: t,
|
|
1146
|
+
makeOwner: !0
|
|
1147
|
+
}),
|
|
1148
|
+
transferPrimaryOwnership: async (e, t) => o.patch(`${f}/${e}/ownership`, {
|
|
1149
|
+
email: t,
|
|
1150
|
+
transferPrimary: !0
|
|
1151
|
+
}),
|
|
1152
|
+
createThing: async (e) => o.post(f, e),
|
|
1153
|
+
fetchThings: async () => o.paginatedFetch(`${f}`),
|
|
1154
|
+
fetchThingsForWorkspace: async (e) => o.paginatedFetch(`${f}?workspace_id=${e}`),
|
|
1155
|
+
fetchOwnedThings: async () => o.paginatedFetch(`${f}?owned_only=true`),
|
|
1156
|
+
fetchThing: async (e) => o.fetch(`${f}/${e}`),
|
|
1157
|
+
updateThing: async (e) => o.patch(`${f}/${e.id}`, e),
|
|
1158
|
+
updateThingPrivacy: async (e, t) => o.patch(`${f}/${e}`, { isPrivate: t }),
|
|
1159
|
+
deleteThing: async (e) => o.delete(`${f}/${e}`),
|
|
1160
|
+
fetchMetadataForThingOwner: async (e) => o.paginatedFetch(
|
|
1161
|
+
`${f}/${e}/metadata?include_assignable_metadata=true`
|
|
1162
|
+
),
|
|
1163
|
+
fetchMetadataForThing: async (e) => o.fetch(`${f}/${e}/metadata`),
|
|
1164
|
+
uploadSitePhotos: async (e, t) => o.post(`${f}/${e}/photos`, t),
|
|
1165
|
+
fetchSitePhotos: async (e) => o.paginatedFetch(`${f}/${e}/photos`),
|
|
1166
|
+
deleteSitePhoto: async (e, t) => o.delete(`${f}/${e}/photos`, { name: t }),
|
|
1167
|
+
createSiteTag: async (e, t) => o.post(`${f}/${e}/tags`, t),
|
|
1168
|
+
editSiteTag: async (e, t) => o.put(`${f}/${e}/tags`, t),
|
|
1169
|
+
fetchSiteTags: async (e) => o.fetch(`${f}/${e}/tags`),
|
|
1170
|
+
fetchUsersSiteTags: async () => o.fetch(`${ve}`),
|
|
1171
|
+
deleteSiteTag: async (e, t) => o.delete(`${f}/${e}/tags`, t),
|
|
1172
|
+
fetchWorkspaceTags: async (e) => o.fetch(`${ve}/keys?workspace_id=${e}`),
|
|
1173
|
+
createHydroShareArchive: async (e) => o.post(`${f}/${e.thingId}/archive`, e),
|
|
1174
|
+
updateHydroShareArchive: async (e, t) => o.patch(
|
|
1175
|
+
`${f}/${e.thingId}/archive`,
|
|
1176
|
+
e,
|
|
1177
|
+
t
|
|
1178
|
+
),
|
|
1179
|
+
fetchHydroShareArchive: async (e) => o.fetch(`${f}/${e}/archive`),
|
|
1180
|
+
deleteHydroShareArchive: async (e) => o.delete(`${f}/${e}/archive`),
|
|
1181
|
+
archiveToHydroShare: async (e) => o.post(`${f}/${e}/archive/trigger`),
|
|
1182
|
+
createDatastream: async (e) => o.post(g, e),
|
|
1183
|
+
fetchDatastreams: async (e) => {
|
|
1184
|
+
const t = [];
|
|
1185
|
+
if (e)
|
|
1186
|
+
for (const [s, a] of Object.entries(e))
|
|
1187
|
+
t.push(`${encodeURIComponent(s)}=${encodeURIComponent(a)}`);
|
|
1188
|
+
const r = t.length ? `?${t.join("&")}` : "";
|
|
1189
|
+
return o.paginatedFetch(`${g}${r}`);
|
|
1190
|
+
},
|
|
1191
|
+
fetchDatastreamsForThing: async (e) => o.paginatedFetch(`${g}?thing_id=${e}`),
|
|
1192
|
+
fetchExpandedDatastreamsForThing: async (e) => o.paginatedFetch(
|
|
1193
|
+
`${g}?thing_id=${e}&expand_related=true`
|
|
1194
|
+
),
|
|
1195
|
+
fetchDatastreamsForDataSource: async (e) => o.paginatedFetch(`${g}?data_source_id=${e}`),
|
|
1196
|
+
fetchDatastream: async (e) => o.fetch(`${g}/${e}`),
|
|
1197
|
+
fetchDatastreamExpanded: async (e) => o.fetch(`${g}/${e}?expand_related=true`),
|
|
1198
|
+
fetchUsersDatastreams: async () => o.paginatedFetch(`${g}?exclude_unowned=true`),
|
|
1199
|
+
updateDatastream: async (e, t = null) => o.patch(`${g}/${e.id}`, e, t),
|
|
1200
|
+
deleteDatastream: async (e) => o.delete(`${g}/${e}`),
|
|
1201
|
+
downloadDatastreamCSV: async (e) => o.fetch(`${g}/${e}/csv`),
|
|
1202
|
+
createObservedProperty: async (e) => o.post(I, e),
|
|
1203
|
+
fetchObservedProperty: async (e) => o.fetch(`${I}/${e}`),
|
|
1204
|
+
fetchObservedProperties: async () => o.paginatedFetch(`${I}`),
|
|
1205
|
+
fetchWorkspaceObservedProperties: async (e) => o.paginatedFetch(`${I}?workspace_id=${e}`),
|
|
1206
|
+
updateObservedProperty: async (e, t = null) => o.patch(`${I}/${e.id}`, e, t),
|
|
1207
|
+
deleteObservedProperty: async (e) => o.delete(`${I}/${e}`),
|
|
1208
|
+
createProcessingLevel: async (e) => o.post(F, e),
|
|
1209
|
+
fetchProcessingLevels: async () => o.paginatedFetch(`${F}`),
|
|
1210
|
+
fetchProcessingLevel: async (e) => o.fetch(`${F}/${e}`),
|
|
1211
|
+
fetchWorkspaceProcessingLevels: async (e) => o.paginatedFetch(`${F}?workspace_id=${e}`),
|
|
1212
|
+
updateProcessingLevel: async (e, t = null) => o.patch(`${F}/${e.id}`, e, t),
|
|
1213
|
+
deleteProcessingLevel: async (e) => o.delete(`${F}/${e}`),
|
|
1214
|
+
createSensor: async (e) => o.post(T, e),
|
|
1215
|
+
fetchSensors: async () => o.paginatedFetch(`${T}`),
|
|
1216
|
+
fetchSensor: async (e) => o.fetch(`${T}/${e}`),
|
|
1217
|
+
fetchWorkspaceSensors: async (e) => o.paginatedFetch(`${T}?workspace_id=${e}`),
|
|
1218
|
+
updateSensor: async (e, t = null) => o.patch(`${T}/${e.id}`, e, t),
|
|
1219
|
+
deleteSensor: async (e) => o.delete(`${T}/${e}`),
|
|
1220
|
+
createResultQualifier: async (e) => o.post(x, e),
|
|
1221
|
+
fetchResultQualifiers: async () => o.paginatedFetch(`${x}`),
|
|
1222
|
+
fetchWorkspaceResultQualifiers: async (e) => o.paginatedFetch(`${x}?workspace_id=${e}`),
|
|
1223
|
+
updateResultQualifier: async (e, t = null) => o.patch(
|
|
1224
|
+
`${x}/${e.id}`,
|
|
1225
|
+
e,
|
|
1226
|
+
t
|
|
1227
|
+
),
|
|
1228
|
+
deleteResultQualifier: async (e) => o.delete(`${x}/${e}`),
|
|
1229
|
+
createOrchestrationSystem: async (e) => o.post(k, e),
|
|
1230
|
+
fetchOrchestrationSystems: async () => o.paginatedFetch(k),
|
|
1231
|
+
fetchWorkspaceOrchestrationSystems: async (e) => o.paginatedFetch(`${k}?workspace_id=${e}`),
|
|
1232
|
+
fetchOrchestrationSystem: async (e) => o.fetch(`${k}/${e}`),
|
|
1233
|
+
updateOrchestrationSystem: async (e, t) => o.patch(`${k}/${e}`, t),
|
|
1234
|
+
deleteOrchestrationSystem: async (e) => o.delete(`${k}/${e}`),
|
|
1235
|
+
createDataSource: async (e) => o.post(
|
|
1236
|
+
`${_}?expand_related=true`,
|
|
1237
|
+
be(e)
|
|
1238
|
+
),
|
|
1239
|
+
fetchDataSources: async () => o.paginatedFetch(`${_}?expand_related=true`),
|
|
1240
|
+
fetchWorkspaceDataSources: async (e) => o.paginatedFetch(
|
|
1241
|
+
`${_}?workspace_id=${e}&expand_related=true`
|
|
1242
|
+
),
|
|
1243
|
+
fetchDataSource: async (e) => o.fetch(`${_}/${e}?expand_related=true`),
|
|
1244
|
+
updateDataSource: async (e) => o.patch(
|
|
1245
|
+
`${_}/${e.id}?expand_related=true`,
|
|
1246
|
+
be(e)
|
|
1247
|
+
),
|
|
1248
|
+
updateDataSourcePartial: async (e) => o.patch(
|
|
1249
|
+
`${_}/${e.id}?expand_related=true`,
|
|
1250
|
+
e
|
|
1251
|
+
),
|
|
1252
|
+
deleteDataSource: async (e) => o.delete(`${_}/${e}`),
|
|
1253
|
+
linkDatastreamToDataSource: async (e, t) => o.post(
|
|
1254
|
+
`${_}/${e}/datastreams/${t}`
|
|
1255
|
+
),
|
|
1256
|
+
unlinkDatastreamFromDataSource: async (e, t) => o.delete(
|
|
1257
|
+
`${_}/${e}/datastreams/${t}`
|
|
1258
|
+
),
|
|
1259
|
+
fetchObservations: async (e) => o.fetch(e),
|
|
1260
|
+
deleteObservationsForDatastream: async (e) => o.post(`${g}/${e}/observations/bulk-delete`, {
|
|
1261
|
+
phenomenonTimeStart: null,
|
|
1262
|
+
phenomenonTimeEnd: null
|
|
1263
|
+
}),
|
|
1264
|
+
fetchUserTypes: async () => o.fetch(`${E}/user-types`),
|
|
1265
|
+
fetchOrganizationTypes: async () => o.fetch(`${E}/organization-types`),
|
|
1266
|
+
fetchSiteTypes: async () => o.fetch(`${f}/site-types`),
|
|
1267
|
+
fetchSamplingFeatureTypes: async () => o.paginatedFetch(`${f}/sampling-feature-types`),
|
|
1268
|
+
fetchSensorEncodingTypes: async () => o.paginatedFetch(`${T}/encoding-types`),
|
|
1269
|
+
fetchMethodTypes: async () => o.paginatedFetch(`${T}/method-types`),
|
|
1270
|
+
fetchVariableTypes: async () => o.paginatedFetch(`${I}/variable-types`),
|
|
1271
|
+
fetchUnitTypes: async () => o.paginatedFetch(`${D}/types`),
|
|
1272
|
+
fetchDatastreamStatuses: async () => o.paginatedFetch(`${g}/statuses`),
|
|
1273
|
+
fetchDatastreamAggregations: async () => o.paginatedFetch(`${g}/aggregation-statistics`),
|
|
1274
|
+
fetchSampledMediums: async () => o.paginatedFetch(`${g}/sampled-mediums`)
|
|
1275
|
+
};
|
|
1276
|
+
class Yt {
|
|
1277
|
+
name = "";
|
|
1278
|
+
mappings = [];
|
|
1279
|
+
extractorVariables = {};
|
|
1280
|
+
constructor(t) {
|
|
1281
|
+
Object.assign(this, t);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
const Ne = 1, M = Ne * 60, ne = M * 60, oe = ne * 24, mt = oe * 7, gt = ne * 30, bt = oe * 365, se = {
|
|
1285
|
+
[$.SECOND]: Ne,
|
|
1286
|
+
[$.MINUTE]: M,
|
|
1287
|
+
[$.HOUR]: ne,
|
|
1288
|
+
[$.DAY]: oe,
|
|
1289
|
+
[$.WEEK]: mt,
|
|
1290
|
+
[$.MONTH]: gt,
|
|
1291
|
+
[$.YEAR]: bt
|
|
1292
|
+
}, jt = (e) => e.toLocaleString(void 0, {
|
|
1293
|
+
year: "numeric",
|
|
1294
|
+
month: "short",
|
|
1295
|
+
day: "2-digit",
|
|
1296
|
+
hour: "2-digit",
|
|
1297
|
+
hour12: !1,
|
|
1298
|
+
minute: "2-digit",
|
|
1299
|
+
second: "2-digit"
|
|
1300
|
+
}), Ht = (e) => {
|
|
1301
|
+
let t, r;
|
|
1302
|
+
e >= M * 1e3 ? (t = e / (M * 1e3), r = "m") : e >= 1e3 ? (t = e / 1e3, r = "s") : (t = e, r = "ms");
|
|
1303
|
+
let s;
|
|
1304
|
+
return r === "ms" ? s = Math.round(t).toString() : s = t.toFixed(2), `${s} ${r}`;
|
|
1305
|
+
}, vt = (e, t, r) => {
|
|
1306
|
+
if (r === $.MONTH) {
|
|
1307
|
+
const s = new Date(e);
|
|
1308
|
+
return s.setMonth(s.getMonth() + t), s.getTime();
|
|
1309
|
+
} else if (r === $.YEAR) {
|
|
1310
|
+
const s = new Date(e);
|
|
1311
|
+
return s.setFullYear(s.getFullYear() + t), s.getTime();
|
|
1312
|
+
} else
|
|
1313
|
+
return e + t * se[r] * 1e3;
|
|
1314
|
+
}, J = async (e, t) => {
|
|
1315
|
+
t && console.info(t);
|
|
1316
|
+
const r = performance.now(), s = await e(), a = performance.now();
|
|
1317
|
+
console.info(` Done in ${(a - r).toFixed(2)} ms`);
|
|
1318
|
+
const n = +(a - r);
|
|
1319
|
+
return { response: s, duration: n };
|
|
1320
|
+
};
|
|
1321
|
+
function Gt(e, t) {
|
|
1322
|
+
const r = new Date(e);
|
|
1323
|
+
return r.setHours(r.getHours() - t), r.toISOString();
|
|
1324
|
+
}
|
|
1325
|
+
const St = (e, t) => {
|
|
1326
|
+
let r = 0, s = e.length;
|
|
1327
|
+
for (; r < s; ) {
|
|
1328
|
+
const a = r + s >> 1;
|
|
1329
|
+
e[a] < t ? r = a + 1 : s = a;
|
|
1330
|
+
}
|
|
1331
|
+
return r;
|
|
1332
|
+
}, Se = (e, t) => {
|
|
1333
|
+
let r = 0, s = e.length;
|
|
1334
|
+
for (; r < s; ) {
|
|
1335
|
+
const a = r + s >> 1;
|
|
1336
|
+
e[a] > t ? s = a : r = a + 1;
|
|
1337
|
+
}
|
|
1338
|
+
return r - 1;
|
|
1339
|
+
}, Ce = `(function(){"use strict";self.onmessage=o=>{const{bufferX:s,bufferY:n,outputBufferX:u,outputBufferY:f,start:l,end:y,deleteSegment:a,startTarget:c}=o.data,A=new Float64Array(s),d=new Float32Array(n),g=new Float64Array(u),p=new Float32Array(f);let e=0,r=c;for(let t=l;t<=y;t++)e<a.length&&t===a[e]?e++:(g[r]=A[t],p[r]=d[t],r++);self.postMessage("Done")}})();
|
|
1340
|
+
`, Ee = typeof self < "u" && self.Blob && new Blob([Ce], { type: "text/javascript;charset=utf-8" });
|
|
1341
|
+
function Et(e) {
|
|
21
1342
|
let t;
|
|
22
1343
|
try {
|
|
23
|
-
if (t =
|
|
24
|
-
const
|
|
25
|
-
name:
|
|
1344
|
+
if (t = Ee && (self.URL || self.webkitURL).createObjectURL(Ee), !t) throw "";
|
|
1345
|
+
const r = new Worker(t, {
|
|
1346
|
+
name: e?.name
|
|
26
1347
|
});
|
|
27
|
-
return
|
|
1348
|
+
return r.addEventListener("error", () => {
|
|
28
1349
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
29
|
-
}),
|
|
1350
|
+
}), r;
|
|
30
1351
|
} catch {
|
|
31
1352
|
return new Worker(
|
|
32
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1353
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Ce),
|
|
33
1354
|
{
|
|
34
|
-
name:
|
|
1355
|
+
name: e?.name
|
|
35
1356
|
}
|
|
36
1357
|
);
|
|
37
1358
|
} finally {
|
|
38
1359
|
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
39
1360
|
}
|
|
40
1361
|
}
|
|
41
|
-
const
|
|
42
|
-
`,
|
|
43
|
-
function
|
|
1362
|
+
const Ue = `(function(){"use strict";self.onmessage=function(e){const{bufferX:f,bufferY:t,outputBufferX:u,outputBufferY:s}=e.data;self.postMessage("Done")}})();
|
|
1363
|
+
`, $e = typeof self < "u" && self.Blob && new Blob([Ue], { type: "text/javascript;charset=utf-8" });
|
|
1364
|
+
function $t(e) {
|
|
44
1365
|
let t;
|
|
45
1366
|
try {
|
|
46
|
-
if (t =
|
|
47
|
-
const
|
|
48
|
-
name:
|
|
1367
|
+
if (t = $e && (self.URL || self.webkitURL).createObjectURL($e), !t) throw "";
|
|
1368
|
+
const r = new Worker(t, {
|
|
1369
|
+
name: e?.name
|
|
49
1370
|
});
|
|
50
|
-
return
|
|
1371
|
+
return r.addEventListener("error", () => {
|
|
51
1372
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
52
|
-
}),
|
|
1373
|
+
}), r;
|
|
53
1374
|
} catch {
|
|
54
1375
|
return new Worker(
|
|
55
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
1376
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Ue),
|
|
56
1377
|
{
|
|
57
|
-
name:
|
|
1378
|
+
name: e?.name
|
|
58
1379
|
}
|
|
59
1380
|
);
|
|
60
1381
|
} finally {
|
|
61
1382
|
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
62
1383
|
}
|
|
63
1384
|
}
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
for (; s < e; ) {
|
|
67
|
-
const n = s + e >> 1;
|
|
68
|
-
r[n] < t ? s = n + 1 : e = n;
|
|
69
|
-
}
|
|
70
|
-
return s;
|
|
71
|
-
}, B = (r, t) => {
|
|
72
|
-
let s = 0, e = r.length;
|
|
73
|
-
for (; s < e; ) {
|
|
74
|
-
const n = s + e >> 1;
|
|
75
|
-
r[n] > t ? e = n : s = n + 1;
|
|
76
|
-
}
|
|
77
|
-
return s - 1;
|
|
78
|
-
}, w = async (r, t) => {
|
|
79
|
-
const s = performance.now(), e = await r(), n = performance.now();
|
|
80
|
-
console.log(` Done in ${(n - s).toFixed(2)} ms`);
|
|
81
|
-
const a = +(n - s);
|
|
82
|
-
return { response: e, duration: a };
|
|
83
|
-
}, N = 1, Y = N * 60, S = Y * 60, D = S * 24, G = D * 7, O = S * 30, k = D * 365, A = {
|
|
84
|
-
s: N,
|
|
85
|
-
m: Y,
|
|
86
|
-
h: S,
|
|
87
|
-
D,
|
|
88
|
-
W: G,
|
|
89
|
-
M: O,
|
|
90
|
-
Y: k
|
|
91
|
-
}, H = (r, t, s) => {
|
|
92
|
-
if (s === "M") {
|
|
93
|
-
const e = new Date(r);
|
|
94
|
-
return e.setMonth(e.getMonth() + t), e.getTime();
|
|
95
|
-
} else if (s === "Y") {
|
|
96
|
-
const e = new Date(r);
|
|
97
|
-
return e.setFullYear(e.getFullYear() + t), e.getTime();
|
|
98
|
-
} else
|
|
99
|
-
return r + t * A[s] * 1e3;
|
|
100
|
-
}, L = 20 * 1e3, v = ["date", "value", "qualifier"];
|
|
101
|
-
class V {
|
|
1385
|
+
const N = 20 * 1e3, _t = ["date", "value", "qualifier"];
|
|
1386
|
+
class Wt {
|
|
102
1387
|
/** The generated dataset to be used for plotting */
|
|
103
1388
|
dataset = {
|
|
104
|
-
dimensions:
|
|
1389
|
+
dimensions: _t,
|
|
105
1390
|
source: {
|
|
106
1391
|
x: new Float64Array(
|
|
107
1392
|
new SharedArrayBuffer(
|
|
108
|
-
|
|
1393
|
+
N * Float64Array.BYTES_PER_ELEMENT,
|
|
109
1394
|
{
|
|
110
|
-
maxByteLength:
|
|
1395
|
+
maxByteLength: N * Float64Array.BYTES_PER_ELEMENT
|
|
111
1396
|
// Max size the array can reach
|
|
112
1397
|
}
|
|
113
1398
|
)
|
|
114
1399
|
),
|
|
115
1400
|
y: new Float32Array(
|
|
116
1401
|
new SharedArrayBuffer(
|
|
117
|
-
|
|
1402
|
+
N * Float32Array.BYTES_PER_ELEMENT,
|
|
118
1403
|
{
|
|
119
|
-
maxByteLength:
|
|
1404
|
+
maxByteLength: N * Float32Array.BYTES_PER_ELEMENT
|
|
120
1405
|
// Max size the array can reach
|
|
121
1406
|
}
|
|
122
1407
|
)
|
|
@@ -134,10 +1419,10 @@ class V {
|
|
|
134
1419
|
if (!t)
|
|
135
1420
|
return;
|
|
136
1421
|
this.isLoading = !0;
|
|
137
|
-
const
|
|
1422
|
+
const r = await J(() => {
|
|
138
1423
|
this._growBuffer(t.datetimes.length), this._resizeTo(t.datetimes.length), this.dataX.set(t.datetimes), this.dataY.set(t.dataValues);
|
|
139
1424
|
});
|
|
140
|
-
this.loadingTime =
|
|
1425
|
+
this.loadingTime = r.duration, this.history.length = 0, this.isLoading = !1;
|
|
141
1426
|
}
|
|
142
1427
|
get dataX() {
|
|
143
1428
|
return this.dataset.source.x;
|
|
@@ -162,23 +1447,23 @@ class V {
|
|
|
162
1447
|
* @param newLength The total number of elements that the view will contain
|
|
163
1448
|
*/
|
|
164
1449
|
_growBuffer(t) {
|
|
165
|
-
const
|
|
166
|
-
let
|
|
167
|
-
for (;
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
1450
|
+
const r = t * Float64Array.BYTES_PER_ELEMENT;
|
|
1451
|
+
let s = this.dataX.buffer.byteLength;
|
|
1452
|
+
for (; r > s; )
|
|
1453
|
+
s += N * Float64Array.BYTES_PER_ELEMENT;
|
|
1454
|
+
if (s * Float64Array.BYTES_PER_ELEMENT > this.dataX.buffer.maxByteLength) {
|
|
1455
|
+
const a = new SharedArrayBuffer(
|
|
171
1456
|
this.dataX.buffer.byteLength,
|
|
172
1457
|
{
|
|
173
|
-
maxByteLength:
|
|
1458
|
+
maxByteLength: s * Float64Array.BYTES_PER_ELEMENT
|
|
174
1459
|
}
|
|
175
|
-
),
|
|
1460
|
+
), n = new SharedArrayBuffer(
|
|
176
1461
|
this.dataY.buffer.byteLength,
|
|
177
1462
|
{
|
|
178
|
-
maxByteLength:
|
|
1463
|
+
maxByteLength: s * Float32Array.BYTES_PER_ELEMENT
|
|
179
1464
|
}
|
|
180
|
-
),
|
|
181
|
-
|
|
1465
|
+
), i = new Float64Array(a), c = new Float32Array(n);
|
|
1466
|
+
i.set(this.dataX), c.set(this.dataY), this.dataset.source.x = i, this.dataset.source.y = c;
|
|
182
1467
|
}
|
|
183
1468
|
this.dataX.buffer.byteLength < t * Float64Array.BYTES_PER_ELEMENT && (this.dataX.buffer.grow(t * Float64Array.BYTES_PER_ELEMENT), this.dataY.buffer.grow(t * Float32Array.BYTES_PER_ELEMENT));
|
|
184
1469
|
}
|
|
@@ -193,16 +1478,16 @@ class V {
|
|
|
193
1478
|
* @returns
|
|
194
1479
|
*/
|
|
195
1480
|
async reloadHistory(t) {
|
|
196
|
-
const
|
|
197
|
-
await this.reload(), await this.dispatch(
|
|
1481
|
+
const r = this.history.slice(0, t + 1);
|
|
1482
|
+
await this.reload(), await this.dispatch(r.map((s) => [s.method, ...s.args || []]));
|
|
198
1483
|
}
|
|
199
1484
|
/**
|
|
200
1485
|
* Remove a history item
|
|
201
1486
|
* @param index
|
|
202
1487
|
*/
|
|
203
1488
|
async removeHistoryItem(t) {
|
|
204
|
-
const
|
|
205
|
-
|
|
1489
|
+
const r = [...this.history];
|
|
1490
|
+
r.splice(t, 1), await this.reload(), await this.dispatch(r.map((s) => [s.method, ...s.args || []]));
|
|
206
1491
|
}
|
|
207
1492
|
get beginTime() {
|
|
208
1493
|
return this.dataset.source.x.length ? new Date(this.dataset.source.x[0]) : null;
|
|
@@ -211,88 +1496,89 @@ class V {
|
|
|
211
1496
|
return this.dataset.source.x.length ? new Date(this.dataset.source.x[this.dataset.source.x.length - 1]) : null;
|
|
212
1497
|
}
|
|
213
1498
|
/** Dispatch an operation and log its signature in hisotry */
|
|
214
|
-
async dispatch(t, ...
|
|
215
|
-
const
|
|
216
|
-
[
|
|
217
|
-
[
|
|
218
|
-
[
|
|
219
|
-
[
|
|
220
|
-
[
|
|
221
|
-
[
|
|
222
|
-
[
|
|
223
|
-
},
|
|
224
|
-
[
|
|
225
|
-
[
|
|
226
|
-
[
|
|
227
|
-
[
|
|
228
|
-
[
|
|
229
|
-
[
|
|
230
|
-
[
|
|
1499
|
+
async dispatch(t, ...r) {
|
|
1500
|
+
const s = {
|
|
1501
|
+
[v.ADD_POINTS]: this._addDataPoints,
|
|
1502
|
+
[v.CHANGE_VALUES]: this._changeValues,
|
|
1503
|
+
[v.DELETE_POINTS]: this._deleteDataPoints,
|
|
1504
|
+
[v.DRIFT_CORRECTION]: this._driftCorrection,
|
|
1505
|
+
[v.INTERPOLATE]: this._interpolate,
|
|
1506
|
+
[v.SHIFT_DATETIMES]: this._shift,
|
|
1507
|
+
[v.FILL_GAPS]: this._fillGaps
|
|
1508
|
+
}, a = {
|
|
1509
|
+
[v.ADD_POINTS]: "mdi-plus",
|
|
1510
|
+
[v.CHANGE_VALUES]: "mdi-pencil",
|
|
1511
|
+
[v.DELETE_POINTS]: "mdi-trash-can",
|
|
1512
|
+
[v.DRIFT_CORRECTION]: "mdi-chart-sankey",
|
|
1513
|
+
[v.INTERPOLATE]: "mdi-transit-connection-horizontal",
|
|
1514
|
+
[v.SHIFT_DATETIMES]: "mdi-calendar",
|
|
1515
|
+
[v.FILL_GAPS]: "mdi-keyboard-space"
|
|
231
1516
|
};
|
|
232
|
-
let
|
|
1517
|
+
let n = [];
|
|
233
1518
|
try {
|
|
234
1519
|
if (Array.isArray(t)) {
|
|
235
|
-
for (let
|
|
236
|
-
const
|
|
237
|
-
method:
|
|
1520
|
+
for (let i = 0; i < t.length; i++) {
|
|
1521
|
+
const c = t[i][0], h = t[i].slice(1, t[i].length), u = {
|
|
1522
|
+
method: c,
|
|
238
1523
|
args: h,
|
|
239
|
-
icon:
|
|
1524
|
+
icon: a[c],
|
|
240
1525
|
isLoading: !1
|
|
241
1526
|
};
|
|
242
|
-
this.history.push(
|
|
1527
|
+
this.history.push(u);
|
|
243
1528
|
}
|
|
244
|
-
for (let
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
const h = await
|
|
1529
|
+
for (let i = this.history.length - t.length; i < this.history.length; i++) {
|
|
1530
|
+
const c = this.history[i];
|
|
1531
|
+
c.isLoading = !0;
|
|
1532
|
+
const h = await J(async () => await s[c.method].apply(
|
|
248
1533
|
this,
|
|
249
|
-
|
|
1534
|
+
c.args
|
|
250
1535
|
));
|
|
251
|
-
|
|
1536
|
+
c.duration = h.duration, c.isLoading = !1, n.push(h.response);
|
|
252
1537
|
}
|
|
253
1538
|
} else {
|
|
254
|
-
const
|
|
1539
|
+
const i = {
|
|
255
1540
|
method: t,
|
|
256
|
-
args:
|
|
257
|
-
icon:
|
|
1541
|
+
args: r,
|
|
1542
|
+
icon: a[t],
|
|
258
1543
|
isLoading: !0
|
|
259
1544
|
};
|
|
260
|
-
this.history.push(
|
|
261
|
-
const
|
|
262
|
-
|
|
1545
|
+
this.history.push(i);
|
|
1546
|
+
const c = await J(async () => await s[t].apply(this, r));
|
|
1547
|
+
n = c.response, i.duration = c.duration, i.isLoading = !1;
|
|
263
1548
|
}
|
|
264
|
-
} catch (
|
|
1549
|
+
} catch (i) {
|
|
265
1550
|
console.log(
|
|
266
1551
|
`Failed to execute operation: ${t} with arguments: `,
|
|
267
|
-
|
|
268
|
-
), console.log(
|
|
1552
|
+
r
|
|
1553
|
+
), console.log(i);
|
|
269
1554
|
}
|
|
270
|
-
return
|
|
1555
|
+
return n;
|
|
271
1556
|
}
|
|
272
1557
|
/** Filter operations do not transform the data and are not logged in history */
|
|
273
|
-
async dispatchFilter(t, ...
|
|
274
|
-
const
|
|
275
|
-
[
|
|
276
|
-
[
|
|
277
|
-
[
|
|
278
|
-
[
|
|
1558
|
+
async dispatchFilter(t, ...r) {
|
|
1559
|
+
const s = {
|
|
1560
|
+
[P.FIND_GAPS]: this._findGaps,
|
|
1561
|
+
[P.VALUE_THRESHOLD]: this._valueThreshold,
|
|
1562
|
+
[P.PERSISTENCE]: this._persistence,
|
|
1563
|
+
[P.CHANGE]: this._change,
|
|
1564
|
+
[P.RATE_OF_CHANGE]: this._rateOfChange
|
|
279
1565
|
};
|
|
280
|
-
let
|
|
1566
|
+
let a = [];
|
|
281
1567
|
try {
|
|
282
1568
|
if (Array.isArray(t))
|
|
283
|
-
for (let
|
|
284
|
-
const
|
|
285
|
-
|
|
1569
|
+
for (let n = 0; n < t.length; n++) {
|
|
1570
|
+
const i = t[n][0], c = t[n].slice(1, t[n].length), h = await s[i].apply(this, c);
|
|
1571
|
+
a.push(h);
|
|
286
1572
|
}
|
|
287
1573
|
else
|
|
288
|
-
|
|
289
|
-
} catch (
|
|
1574
|
+
a = await s[t].apply(this, r);
|
|
1575
|
+
} catch (n) {
|
|
290
1576
|
console.log(
|
|
291
1577
|
`Failed to execute filter operation: ${t} with arguments: `,
|
|
292
|
-
|
|
293
|
-
), console.log(
|
|
1578
|
+
r
|
|
1579
|
+
), console.log(n);
|
|
294
1580
|
}
|
|
295
|
-
return
|
|
1581
|
+
return a;
|
|
296
1582
|
}
|
|
297
1583
|
/**
|
|
298
1584
|
* @param index An array containing the list of index of values to perform the operations on.
|
|
@@ -300,45 +1586,45 @@ class V {
|
|
|
300
1586
|
* @param value The value to use in the operation
|
|
301
1587
|
* @returns The modified DataFrame
|
|
302
1588
|
*/
|
|
303
|
-
_changeValues(t,
|
|
304
|
-
const
|
|
305
|
-
switch (
|
|
306
|
-
case
|
|
307
|
-
return
|
|
308
|
-
case
|
|
309
|
-
return
|
|
310
|
-
case
|
|
311
|
-
return
|
|
312
|
-
case
|
|
313
|
-
return
|
|
314
|
-
case
|
|
315
|
-
return
|
|
1589
|
+
_changeValues(t, r, s) {
|
|
1590
|
+
const a = (n) => {
|
|
1591
|
+
switch (r) {
|
|
1592
|
+
case R.ADD:
|
|
1593
|
+
return n + s;
|
|
1594
|
+
case R.ASSIGN:
|
|
1595
|
+
return s;
|
|
1596
|
+
case R.DIV:
|
|
1597
|
+
return n / s;
|
|
1598
|
+
case R.MULT:
|
|
1599
|
+
return n * s;
|
|
1600
|
+
case R.SUB:
|
|
1601
|
+
return n - s;
|
|
316
1602
|
default:
|
|
317
|
-
return
|
|
1603
|
+
return n;
|
|
318
1604
|
}
|
|
319
1605
|
};
|
|
320
|
-
t.forEach((
|
|
321
|
-
this.dataset.source.y[
|
|
1606
|
+
t.forEach((n) => {
|
|
1607
|
+
this.dataset.source.y[n] = a(this.dataset.source.y[n]);
|
|
322
1608
|
});
|
|
323
1609
|
}
|
|
324
1610
|
_interpolate(t) {
|
|
325
|
-
this._getConsecutiveGroups(t).forEach((
|
|
326
|
-
const
|
|
327
|
-
let
|
|
328
|
-
const h = this.dataset.source.x,
|
|
329
|
-
for (let
|
|
330
|
-
this.dataset.source.y[
|
|
331
|
-
h[
|
|
332
|
-
h[o],
|
|
333
|
-
l[o],
|
|
1611
|
+
this._getConsecutiveGroups(t).forEach((s) => {
|
|
1612
|
+
const a = s[0], n = s[s.length - 1];
|
|
1613
|
+
let i = Math.max(0, a - 1), c = Math.min(this.dataset.source.y.length - 1, n + 1);
|
|
1614
|
+
const h = this.dataset.source.x, u = this.dataset.source.y;
|
|
1615
|
+
for (let d = 0; d < s.length; d++)
|
|
1616
|
+
this.dataset.source.y[s[d]] = this._interpolateLinear(
|
|
1617
|
+
h[s[d]],
|
|
334
1618
|
h[i],
|
|
335
|
-
|
|
1619
|
+
u[i],
|
|
1620
|
+
h[c],
|
|
1621
|
+
u[c]
|
|
336
1622
|
);
|
|
337
1623
|
});
|
|
338
1624
|
}
|
|
339
1625
|
/** Interpolate existing values in the data source */
|
|
340
|
-
_interpolateLinear(t, s,
|
|
341
|
-
return
|
|
1626
|
+
_interpolateLinear(t, r, s, a, n) {
|
|
1627
|
+
return s + (t - r) * (n - s) / (a - r);
|
|
342
1628
|
}
|
|
343
1629
|
/**
|
|
344
1630
|
* Shifts the selected indexes by specified amount of units. Elements are reinserted according to their datetime.
|
|
@@ -347,34 +1633,34 @@ class V {
|
|
|
347
1633
|
* @param unit {@link TimeUnit}
|
|
348
1634
|
* @returns
|
|
349
1635
|
*/
|
|
350
|
-
async _shift(t,
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
this.dataY[
|
|
1636
|
+
async _shift(t, r, s) {
|
|
1637
|
+
const a = t.map((n) => [
|
|
1638
|
+
vt(this.dataX[n], r, s),
|
|
1639
|
+
this.dataY[n]
|
|
354
1640
|
]);
|
|
355
|
-
await this._deleteDataPoints(t), await this._addDataPoints(
|
|
1641
|
+
await this._deleteDataPoints(t), await this._addDataPoints(a);
|
|
356
1642
|
}
|
|
357
|
-
async _fillGapsV2(t,
|
|
358
|
-
const
|
|
1643
|
+
async _fillGapsV2(t, r, s, a) {
|
|
1644
|
+
const n = navigator.hardwareConcurrency || 1, i = [], c = [], h = this.dataX.length, u = new SharedArrayBuffer(this.dataX.buffer.byteLength, {
|
|
359
1645
|
maxByteLength: this.dataX.buffer.maxByteLength
|
|
360
|
-
}),
|
|
1646
|
+
}), d = new SharedArrayBuffer(this.dataY.buffer.byteLength, {
|
|
361
1647
|
maxByteLength: this.dataY.buffer.maxByteLength
|
|
362
1648
|
});
|
|
363
|
-
for (let
|
|
364
|
-
|
|
365
|
-
new Promise((
|
|
366
|
-
const
|
|
367
|
-
|
|
1649
|
+
for (let l = 0; l < n; l++)
|
|
1650
|
+
c.push(
|
|
1651
|
+
new Promise((p) => {
|
|
1652
|
+
const m = new $t();
|
|
1653
|
+
i.push(m), m.postMessage({
|
|
368
1654
|
bufferX: this.dataX.buffer,
|
|
369
1655
|
bufferY: this.dataY.buffer,
|
|
370
|
-
outputBufferX:
|
|
371
|
-
outputBufferY:
|
|
372
|
-
}),
|
|
373
|
-
|
|
1656
|
+
outputBufferX: u,
|
|
1657
|
+
outputBufferY: d
|
|
1658
|
+
}), m.onmessage = (A) => {
|
|
1659
|
+
p(A.data);
|
|
374
1660
|
};
|
|
375
1661
|
})
|
|
376
1662
|
);
|
|
377
|
-
await Promise.all(
|
|
1663
|
+
await Promise.all(c), i.forEach((l) => l.terminate()), this.dataset.source.x = new Float64Array(u), this.dataset.source.y = new Float32Array(d), this._resizeTo(h);
|
|
378
1664
|
}
|
|
379
1665
|
/**
|
|
380
1666
|
* Find gaps and fill them with placeholder value
|
|
@@ -384,22 +1670,22 @@ class V {
|
|
|
384
1670
|
* @returns
|
|
385
1671
|
*/
|
|
386
1672
|
// TODO: this needs to be improved using web workers
|
|
387
|
-
_fillGaps(t,
|
|
388
|
-
const
|
|
389
|
-
for (let
|
|
390
|
-
const
|
|
391
|
-
let
|
|
392
|
-
for (;
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
this.dataX[
|
|
396
|
-
this.dataY[
|
|
397
|
-
this.dataX[
|
|
398
|
-
this.dataY[
|
|
1673
|
+
_fillGaps(t, r, s, a) {
|
|
1674
|
+
const n = this._findGaps(t[0], t[1], a);
|
|
1675
|
+
for (let i = n.length - 1; i >= 0; i--) {
|
|
1676
|
+
const c = n[i], h = this.dataX[c[0]], u = this.dataX[c[1]], d = [], l = r[0] * se[r[1]] * 1e3;
|
|
1677
|
+
let p = h + l;
|
|
1678
|
+
for (; p < u; ) {
|
|
1679
|
+
const m = s ? this._interpolateLinear(
|
|
1680
|
+
p,
|
|
1681
|
+
this.dataX[c[0]],
|
|
1682
|
+
this.dataY[c[0]],
|
|
1683
|
+
this.dataX[c[1]],
|
|
1684
|
+
this.dataY[c[1]]
|
|
399
1685
|
) : -9999;
|
|
400
|
-
|
|
1686
|
+
d.push([p, m]), p += l;
|
|
401
1687
|
}
|
|
402
|
-
this._addDataPoints(
|
|
1688
|
+
this._addDataPoints(d);
|
|
403
1689
|
}
|
|
404
1690
|
}
|
|
405
1691
|
/**
|
|
@@ -412,40 +1698,40 @@ class V {
|
|
|
412
1698
|
*/
|
|
413
1699
|
// TODO: implement similar multithread solutions for other operations
|
|
414
1700
|
async _deleteDataPoints(t) {
|
|
415
|
-
const
|
|
416
|
-
for (let
|
|
417
|
-
const
|
|
418
|
-
|
|
1701
|
+
const r = navigator.hardwareConcurrency || 1, s = Math.ceil(this.dataX.length / r), a = [], n = [];
|
|
1702
|
+
for (let l = 0; l < r; l++) {
|
|
1703
|
+
const p = l * s, m = Math.min((l + 1) * s - 1, this.dataX.length - 1), A = St(t, p), b = Se(t, m), H = t.slice(A, b + 1);
|
|
1704
|
+
n.push({ start: p, end: m, deleteSegment: H });
|
|
419
1705
|
}
|
|
420
|
-
const
|
|
421
|
-
for (let
|
|
422
|
-
|
|
423
|
-
const
|
|
1706
|
+
const i = new Array(r).fill(0);
|
|
1707
|
+
for (let l = 1; l < r; l++)
|
|
1708
|
+
i[l] = i[l - 1] + n[l - 1].deleteSegment.length;
|
|
1709
|
+
const c = [], h = this.dataX.length - t.length, u = new SharedArrayBuffer(this.dataX.buffer.byteLength, {
|
|
424
1710
|
maxByteLength: this.dataX.buffer.maxByteLength
|
|
425
|
-
}),
|
|
1711
|
+
}), d = new SharedArrayBuffer(this.dataY.buffer.byteLength, {
|
|
426
1712
|
maxByteLength: this.dataY.buffer.maxByteLength
|
|
427
1713
|
});
|
|
428
|
-
for (let
|
|
429
|
-
const { start:
|
|
430
|
-
|
|
431
|
-
new Promise((
|
|
432
|
-
const
|
|
433
|
-
|
|
1714
|
+
for (let l = 0; l < r; l++) {
|
|
1715
|
+
const { start: p, end: m, deleteSegment: A } = n[l], b = p - i[l];
|
|
1716
|
+
c.push(
|
|
1717
|
+
new Promise((H) => {
|
|
1718
|
+
const G = new Et();
|
|
1719
|
+
a.push(G), G.postMessage({
|
|
434
1720
|
bufferX: this.dataX.buffer,
|
|
435
1721
|
bufferY: this.dataY.buffer,
|
|
436
|
-
outputBufferX:
|
|
437
|
-
outputBufferY:
|
|
438
|
-
start:
|
|
439
|
-
end:
|
|
440
|
-
deleteSegment:
|
|
441
|
-
startTarget:
|
|
442
|
-
}),
|
|
443
|
-
|
|
1722
|
+
outputBufferX: u,
|
|
1723
|
+
outputBufferY: d,
|
|
1724
|
+
start: p,
|
|
1725
|
+
end: m,
|
|
1726
|
+
deleteSegment: A,
|
|
1727
|
+
startTarget: b
|
|
1728
|
+
}), G.onmessage = (Be) => {
|
|
1729
|
+
H(Be.data);
|
|
444
1730
|
};
|
|
445
1731
|
})
|
|
446
1732
|
);
|
|
447
1733
|
}
|
|
448
|
-
await Promise.all(
|
|
1734
|
+
await Promise.all(c), a.forEach((l) => l.terminate()), this.dataset.source.x = new Float64Array(u), this.dataset.source.y = new Float32Array(d), this._resizeTo(h);
|
|
449
1735
|
}
|
|
450
1736
|
/**
|
|
451
1737
|
*
|
|
@@ -453,10 +1739,10 @@ class V {
|
|
|
453
1739
|
* @param end The end index
|
|
454
1740
|
* @param value The drift amount
|
|
455
1741
|
*/
|
|
456
|
-
_driftCorrection(t,
|
|
457
|
-
const
|
|
458
|
-
for (let
|
|
459
|
-
this.dataset.source.y[
|
|
1742
|
+
_driftCorrection(t, r, s) {
|
|
1743
|
+
const a = this.dataset.source.x, n = this.dataset.source.y, i = a[t], h = a[r] - i;
|
|
1744
|
+
for (let u = t; u < r; u++)
|
|
1745
|
+
this.dataset.source.y[u] = n[u] + s * ((a[u] - i) / h);
|
|
460
1746
|
}
|
|
461
1747
|
/** Traverses the index array and returns groups of consecutive values.
|
|
462
1748
|
* i.e.: `[0, 1, 3, 4, 6] => [[0, 1], [3, 4], [6]]`
|
|
@@ -464,27 +1750,27 @@ class V {
|
|
|
464
1750
|
* @param index: the index array (sorted)
|
|
465
1751
|
*/
|
|
466
1752
|
_getConsecutiveGroups(t) {
|
|
467
|
-
const
|
|
468
|
-
return t.reduce((
|
|
469
|
-
const
|
|
470
|
-
return !
|
|
471
|
-
},
|
|
1753
|
+
const r = [[]];
|
|
1754
|
+
return t.reduce((s, a) => {
|
|
1755
|
+
const n = s[s.length - 1];
|
|
1756
|
+
return !n.length || a == n[n.length - 1] + 1 ? n.push(a) : s.push([a]), s;
|
|
1757
|
+
}, r), r;
|
|
472
1758
|
}
|
|
473
1759
|
/**
|
|
474
1760
|
* Adds data points. Their insert index is determined using `findFirstGreaterOrEqual` in the x-axis.
|
|
475
1761
|
* @param dataPoints
|
|
476
1762
|
*/
|
|
477
1763
|
async _addDataPoints(t) {
|
|
478
|
-
const
|
|
479
|
-
this._growBuffer(
|
|
480
|
-
const
|
|
481
|
-
this._resizeTo(
|
|
482
|
-
let
|
|
483
|
-
for (let
|
|
484
|
-
const
|
|
485
|
-
for (let h =
|
|
486
|
-
this.dataX[h +
|
|
487
|
-
|
|
1764
|
+
const r = this.dataX.length + t.length;
|
|
1765
|
+
this._growBuffer(r), t.sort((n, i) => n[0] - i[0]);
|
|
1766
|
+
const s = t.map((n) => Se(this.dataX, n[0]) + 1);
|
|
1767
|
+
this._resizeTo(r), s.push(this.dataX.length);
|
|
1768
|
+
let a = t.length;
|
|
1769
|
+
for (let n = s.length - 1; n > 0; n--) {
|
|
1770
|
+
const i = s[n - 1], c = s[n] - 1;
|
|
1771
|
+
for (let h = c; h >= i; h--)
|
|
1772
|
+
this.dataX[h + a] = this.dataX[h], this.dataY[h + a] = this.dataY[h];
|
|
1773
|
+
a--, this.dataX[i + a] = t[n - 1][0], this.dataY[i + a] = t[n - 1][1];
|
|
488
1774
|
}
|
|
489
1775
|
}
|
|
490
1776
|
// =======================
|
|
@@ -496,13 +1782,13 @@ class V {
|
|
|
496
1782
|
* @returns
|
|
497
1783
|
*/
|
|
498
1784
|
_valueThreshold(t) {
|
|
499
|
-
const
|
|
500
|
-
return this.dataset.source.y.forEach((
|
|
501
|
-
Object.keys(t).some((
|
|
502
|
-
|
|
503
|
-
t[
|
|
504
|
-
)) &&
|
|
505
|
-
}),
|
|
1785
|
+
const r = [];
|
|
1786
|
+
return this.dataset.source.y.forEach((s, a) => {
|
|
1787
|
+
Object.keys(t).some((n) => Ye[n]?.(
|
|
1788
|
+
s,
|
|
1789
|
+
t[n]
|
|
1790
|
+
)) && r.push(a);
|
|
1791
|
+
}), r;
|
|
506
1792
|
}
|
|
507
1793
|
/**
|
|
508
1794
|
*
|
|
@@ -510,16 +1796,33 @@ class V {
|
|
|
510
1796
|
* @param value
|
|
511
1797
|
* @returns
|
|
512
1798
|
*/
|
|
513
|
-
_rateOfChange(t,
|
|
514
|
-
const
|
|
515
|
-
for (let
|
|
516
|
-
const
|
|
517
|
-
|
|
1799
|
+
_rateOfChange(t, r) {
|
|
1800
|
+
const s = [], a = this.dataset.source.y;
|
|
1801
|
+
for (let n = 1; n < a.length; n++) {
|
|
1802
|
+
const i = a[n - 1], h = (a[n] - i) / Math.abs(i);
|
|
1803
|
+
ie[t]?.(
|
|
518
1804
|
h,
|
|
519
|
-
|
|
520
|
-
) &&
|
|
1805
|
+
r
|
|
1806
|
+
) && s.push(n);
|
|
521
1807
|
}
|
|
522
|
-
return
|
|
1808
|
+
return s;
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
*
|
|
1812
|
+
* @param comparator
|
|
1813
|
+
* @param value
|
|
1814
|
+
* @returns
|
|
1815
|
+
*/
|
|
1816
|
+
_change(t, r) {
|
|
1817
|
+
const s = [], a = this.dataset.source.y;
|
|
1818
|
+
for (let n = 1; n < a.length; n++) {
|
|
1819
|
+
const i = a[n - 1], h = a[n] - i;
|
|
1820
|
+
ie[t]?.(
|
|
1821
|
+
h,
|
|
1822
|
+
r
|
|
1823
|
+
) && s.push(n);
|
|
1824
|
+
}
|
|
1825
|
+
return s;
|
|
523
1826
|
}
|
|
524
1827
|
/**
|
|
525
1828
|
* Find gaps in the data
|
|
@@ -528,16 +1831,16 @@ class V {
|
|
|
528
1831
|
* @param range If specified, the gaps will be found only within the range
|
|
529
1832
|
* @returns
|
|
530
1833
|
*/
|
|
531
|
-
_findGaps(t,
|
|
532
|
-
const
|
|
533
|
-
let
|
|
534
|
-
|
|
535
|
-
let h =
|
|
536
|
-
for (let
|
|
537
|
-
const
|
|
538
|
-
|
|
1834
|
+
_findGaps(t, r, s) {
|
|
1835
|
+
const a = [], n = this.dataset.source.x;
|
|
1836
|
+
let i = 0, c = n.length;
|
|
1837
|
+
s?.[0] && s?.[1] && (i = s[0], c = s[1]);
|
|
1838
|
+
let h = n[i];
|
|
1839
|
+
for (let u = i + 1; u <= c; u++) {
|
|
1840
|
+
const d = n[u];
|
|
1841
|
+
d - h > t * se[r] * 1e3 && a.push([u - 1, u]), h = d;
|
|
539
1842
|
}
|
|
540
|
-
return
|
|
1843
|
+
return a;
|
|
541
1844
|
}
|
|
542
1845
|
/**
|
|
543
1846
|
* Find points where the values are the same at least x times in a row
|
|
@@ -545,15 +1848,74 @@ class V {
|
|
|
545
1848
|
* @param range If specified, the points will be found only within the range
|
|
546
1849
|
* @returns
|
|
547
1850
|
*/
|
|
548
|
-
_persistence(t,
|
|
549
|
-
let
|
|
550
|
-
|
|
551
|
-
let
|
|
552
|
-
for (let
|
|
553
|
-
|
|
554
|
-
return
|
|
1851
|
+
_persistence(t, r) {
|
|
1852
|
+
let s = [], a = this.dataset.source.y, n = 0, i = a.length;
|
|
1853
|
+
r?.[0] && r?.[1] && (n = r[0], i = r[1]);
|
|
1854
|
+
let c = a[n], h = [];
|
|
1855
|
+
for (let u = n + 1; u < i; u++)
|
|
1856
|
+
a[u] != c || u === i ? (h.length >= t && (s = [...s, ...h]), h = []) : h.push(u);
|
|
1857
|
+
return s;
|
|
555
1858
|
}
|
|
556
1859
|
}
|
|
557
1860
|
export {
|
|
558
|
-
|
|
1861
|
+
E as ACCOUNT_BASE,
|
|
1862
|
+
ae as AUTH_BASE,
|
|
1863
|
+
xt as ApiKey,
|
|
1864
|
+
S as BASE_URL,
|
|
1865
|
+
Ct as Collaborator,
|
|
1866
|
+
ke as DEFAULT_SNACK_DURATION,
|
|
1867
|
+
Ut as DataSource,
|
|
1868
|
+
At as Datastream,
|
|
1869
|
+
v as EnumEditOperations,
|
|
1870
|
+
P as EnumFilterOperations,
|
|
1871
|
+
Me as FilterOperation,
|
|
1872
|
+
Ye as FilterOperationFn,
|
|
1873
|
+
He as HydroShareArchive,
|
|
1874
|
+
N as INCREASE_AMOUNT,
|
|
1875
|
+
Ge as Location,
|
|
1876
|
+
ie as LogicalComparator,
|
|
1877
|
+
je as LogicalOperation,
|
|
1878
|
+
Rt as OAuthProvider,
|
|
1879
|
+
Wt as ObservationRecord,
|
|
1880
|
+
Dt as ObservedProperty,
|
|
1881
|
+
R as Operator,
|
|
1882
|
+
Ft as Organization,
|
|
1883
|
+
B as PROVIDER_BASE,
|
|
1884
|
+
Yt as Payload,
|
|
1885
|
+
We as PermissionAction,
|
|
1886
|
+
Xe as PermissionResource,
|
|
1887
|
+
ot as Position,
|
|
1888
|
+
wt as PostHydroShareArchive,
|
|
1889
|
+
Ot as ProcessingLevel,
|
|
1890
|
+
kt as ResultQualifier,
|
|
1891
|
+
V as SESSION_BASE,
|
|
1892
|
+
It as Sensor,
|
|
1893
|
+
it as Snack,
|
|
1894
|
+
Fe as SnackColor,
|
|
1895
|
+
Pe as SnackIcon,
|
|
1896
|
+
Re as SnackTitle,
|
|
1897
|
+
ct as Snackbar,
|
|
1898
|
+
ve as TAG_BASE,
|
|
1899
|
+
f as THINGS_BASE,
|
|
1900
|
+
Tt as Thing,
|
|
1901
|
+
$ as TimeUnit,
|
|
1902
|
+
Lt as Unit,
|
|
1903
|
+
Pt as User,
|
|
1904
|
+
Nt as Workspace,
|
|
1905
|
+
Mt as api,
|
|
1906
|
+
o as apiMethods,
|
|
1907
|
+
xe as createPatchObject,
|
|
1908
|
+
qe as extractErrorMessage,
|
|
1909
|
+
St as findFirstGreaterOrEqual,
|
|
1910
|
+
Se as findLastLessOrEqual,
|
|
1911
|
+
jt as formatDate,
|
|
1912
|
+
Ht as formatDuration,
|
|
1913
|
+
_e as getCSRFToken,
|
|
1914
|
+
Bt as getObservationsEndpoint,
|
|
1915
|
+
J as measureEllapsedTime,
|
|
1916
|
+
we as requestInterceptor,
|
|
1917
|
+
Te as responseInterceptor,
|
|
1918
|
+
vt as shiftDatetime,
|
|
1919
|
+
Gt as subtractHours,
|
|
1920
|
+
se as timeUnitMultipliers
|
|
559
1921
|
};
|