@uwrl/qc-utils 0.0.15 → 0.0.18

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.
Files changed (52) hide show
  1. package/README.md +56 -0
  2. package/dist/index.d.ts +3 -2
  3. package/dist/index.js +2951 -340
  4. package/dist/index.umd.cjs +15 -3
  5. package/dist/models/dataSource.d.ts +173 -0
  6. package/dist/models/index.d.ts +2 -0
  7. package/dist/models/payload.d.ts +24 -0
  8. package/dist/models/settings.d.ts +65 -0
  9. package/dist/models/timestamp.d.ts +150 -0
  10. package/dist/services/api.d.ts +147 -0
  11. package/dist/services/apiMethods.d.ts +8 -0
  12. package/dist/services/createPatchObject.d.ts +17 -0
  13. package/dist/services/getCSRFToken.d.ts +1 -0
  14. package/dist/services/index.d.ts +6 -0
  15. package/dist/services/requestInterceptor.d.ts +12 -0
  16. package/dist/services/responseInterceptor.d.ts +2 -0
  17. package/dist/types/index.d.ts +372 -0
  18. package/dist/utils/__tests__/observations.spec.d.ts +1 -0
  19. package/dist/utils/ellapsed-time.d.ts +4 -0
  20. package/dist/utils/format.d.ts +4 -0
  21. package/dist/utils/index.d.ts +6 -0
  22. package/dist/utils/observations.d.ts +5 -0
  23. package/dist/utils/plotting/__tests__/calibration.spec.d.ts +16 -0
  24. package/dist/utils/plotting/__tests__/observation-record-paths.spec.d.ts +21 -0
  25. package/dist/utils/plotting/__tests__/observation-record.spec.d.ts +1 -0
  26. package/dist/utils/plotting/__tests__/operation-cores.spec.d.ts +12 -0
  27. package/dist/utils/plotting/__tests__/workerMocks.d.ts +119 -0
  28. package/dist/utils/plotting/__tests__/workers.spec.d.ts +18 -0
  29. package/dist/utils/plotting/add-data.worker.d.ts +1 -0
  30. package/dist/utils/plotting/calibration.d.ts +99 -0
  31. package/dist/utils/plotting/change-values.worker.d.ts +1 -0
  32. package/dist/utils/plotting/change.worker.d.ts +1 -0
  33. package/dist/utils/plotting/delete-data.worker.d.ts +1 -0
  34. package/dist/utils/plotting/drift-correction.worker.d.ts +1 -0
  35. package/dist/utils/plotting/fill-gaps.worker.d.ts +1 -0
  36. package/dist/utils/plotting/find-gaps.worker.d.ts +1 -0
  37. package/dist/utils/plotting/interpolate.worker.d.ts +1 -0
  38. package/dist/utils/plotting/observation-record.d.ts +281 -0
  39. package/dist/utils/plotting/operation-cores.d.ts +139 -0
  40. package/dist/utils/plotting/persistence.worker.d.ts +1 -0
  41. package/dist/utils/plotting/rate-of-change.worker.d.ts +1 -0
  42. package/dist/utils/plotting/shift-datetimes.worker.d.ts +1 -0
  43. package/dist/utils/plotting/value-threshold.worker.d.ts +1 -0
  44. package/package.json +61 -56
  45. package/dist/types.d.ts +0 -51
  46. package/dist/utils/ellapsedTime.d.ts +0 -0
  47. package/dist/utils/observationsUtils.d.ts +0 -0
  48. package/dist/utils/plotting/observationRecord.d.ts +0 -170
  49. /package/dist/{utils/__tests__/ellapsedTime.spec.d.ts → services/__tests__/createPatchObject.spec.d.ts} +0 -0
  50. /package/dist/{utils/__tests__/observationsUtils.spec.d.ts → services/__tests__/requestInterceptor.spec.d.ts} +0 -0
  51. /package/dist/{utils/plotting/__tests__/delete-data.worker.spec.d.ts → services/__tests__/responseInterceptor.spec.d.ts} +0 -0
  52. /package/dist/utils/{plotting/__tests__/observationRecord.spec.d.ts → __tests__/ellapsed-time.spec.d.ts} +0 -0
@@ -0,0 +1,147 @@
1
+ import { Unit, Thing, Sensor, ResultQualifier, ProcessingLevel, ObservedProperty, Datastream, Tag, PostHydroShareArchive, HydroShareArchive, User, Workspace, ApiKey } from '@/types';
2
+ import { DataSource } from '@/models';
3
+ import { OrchestrationSystem } from '@/models/dataSource';
4
+ export declare const BASE_URL: string;
5
+ export declare const AUTH_BASE: string;
6
+ export declare const ACCOUNT_BASE: string;
7
+ export declare const SESSION_BASE: string;
8
+ export declare const PROVIDER_BASE: string;
9
+ export declare const THINGS_BASE: string;
10
+ export declare const TAG_BASE: string;
11
+ type DatastreamFilterKey = 'unit_id' | 'sensor_id' | 'observed_property_id' | 'processing_level_id' | 'result_qualifier_id';
12
+ export declare const getObservationsEndpoint: (id: string, pageSize: number, startTime: string, endTime?: string, page?: number) => string;
13
+ export declare const api: {
14
+ fetchSession: () => Promise<any>;
15
+ login: (email: string, password: string) => Promise<any>;
16
+ logout: () => Promise<any>;
17
+ fetchUser: () => Promise<any>;
18
+ signup: (user: User) => Promise<any>;
19
+ updateUser: (user: User, oldUser: User) => Promise<any>;
20
+ deleteUser: () => Promise<any>;
21
+ sendVerificationEmail: (email: string) => Promise<any>;
22
+ verifyEmailWithCode: (key: string) => Promise<any>;
23
+ requestPasswordReset: (email: string) => Promise<any>;
24
+ resetPassword: (key: string, password: string) => Promise<any>;
25
+ fetchWorkspaces: () => Promise<any>;
26
+ fetchAssociatedWorkspaces: () => Promise<any>;
27
+ fetchWorkspace: (id: string) => Promise<any>;
28
+ createWorkspace: (postWorkspace: Workspace) => Promise<any>;
29
+ updateWorkspace: (newWorkspace: Workspace, oldWorkspace?: Workspace | null) => Promise<any>;
30
+ deleteWorkspace: (id: string) => Promise<any>;
31
+ transferWorkspace: (id: string, newOwner: string) => Promise<any>;
32
+ acceptWorkspaceTransfer: (id: string) => Promise<any>;
33
+ rejectWorkspaceTransfer: (id: string) => Promise<any>;
34
+ getCollaboratorRoles: (id: string) => Promise<any>;
35
+ getAPIKeyRoles: (id: string) => Promise<any>;
36
+ getRole: (roleId: string) => Promise<any>;
37
+ getCollaborators: (id: string) => Promise<any>;
38
+ addCollaborator: (id: string, email: string, roleId: string) => Promise<any>;
39
+ updateCollaboratorRole: (id: string, email: string, roleId: string) => Promise<any>;
40
+ removeCollaborator: (id: string, email: string) => Promise<any>;
41
+ fetchApiKeys: (workspaceId: string) => Promise<any>;
42
+ fetchApiKey: (workspaceId: string, apiKeyId: string) => Promise<any>;
43
+ createApiKey: (apiKey: ApiKey) => Promise<any>;
44
+ updateApiKey: (newKey: ApiKey, oldKey?: ApiKey) => Promise<any>;
45
+ regenerateApiKey: (id: string, apiKeyId: string) => Promise<any>;
46
+ deleteApiKey: (id: string, apiKeyId: string) => Promise<any>;
47
+ fetchConnectedProviders: () => Promise<any>;
48
+ providerRedirect: (provider: string, callbackUrl: string, process: string) => void;
49
+ providerSignup: (user: User) => Promise<any>;
50
+ deleteProvider: (provider: string, account: string) => Promise<any>;
51
+ createUnit: (unit: Unit) => Promise<any>;
52
+ fetchUnits: () => Promise<any>;
53
+ fetchWorkspaceUnits: (id: string) => Promise<any>;
54
+ updateUnit: (newUnit: Unit, oldUnit?: Unit | null) => Promise<any>;
55
+ deleteUnit: (id: string) => Promise<any>;
56
+ getUnit: (id: string) => Promise<any>;
57
+ removeThingOwner: (id: string, email: string) => Promise<any>;
58
+ addSecondaryOwner: (id: string, email: string) => Promise<any>;
59
+ transferPrimaryOwnership: (id: string, email: string) => Promise<any>;
60
+ createThing: (thing: Thing) => Promise<any>;
61
+ fetchThings: () => Promise<any>;
62
+ fetchThingsForWorkspace: (id: string) => Promise<any>;
63
+ fetchOwnedThings: () => Promise<any>;
64
+ fetchThing: (id: string) => Promise<any>;
65
+ updateThing: (thing: Thing) => Promise<any>;
66
+ updateThingPrivacy: (id: string, isPrivate: boolean) => Promise<any>;
67
+ deleteThing: (id: string) => Promise<any>;
68
+ fetchMetadataForThingOwner: (thingId: string) => Promise<any>;
69
+ fetchMetadataForThing: (thingId: string) => Promise<any>;
70
+ uploadSitePhotos: (thingId: string, data: FormData) => Promise<any>;
71
+ fetchSitePhotos: (thingId: string) => Promise<any>;
72
+ deleteSitePhoto: (thingId: string, name: string) => Promise<any>;
73
+ createSiteTag: (thingId: string, tag: Tag) => Promise<any>;
74
+ editSiteTag: (thingId: string, tag: Tag) => Promise<any>;
75
+ fetchSiteTags: (thingId: string) => Promise<any>;
76
+ fetchUsersSiteTags: () => Promise<any>;
77
+ deleteSiteTag: (thingId: string, tag: Tag) => Promise<any>;
78
+ fetchWorkspaceTags: (workspaceId: string) => Promise<any>;
79
+ createHydroShareArchive: (archive: PostHydroShareArchive) => Promise<any>;
80
+ updateHydroShareArchive: (newArchive: HydroShareArchive, oldArchive?: HydroShareArchive) => Promise<any>;
81
+ fetchHydroShareArchive: (thingId: string) => Promise<any>;
82
+ deleteHydroShareArchive: (thingId: string) => Promise<any>;
83
+ archiveToHydroShare: (thingId: string) => Promise<any>;
84
+ createDatastream: (datastream: Datastream) => Promise<any>;
85
+ fetchDatastreams: (filters?: Partial<Record<DatastreamFilterKey, string>>) => Promise<any>;
86
+ fetchDatastreamsForThing: (thingId: string) => Promise<any>;
87
+ fetchExpandedDatastreamsForThing: (thingId: string) => Promise<any>;
88
+ fetchDatastreamsForDataSource: (id: string) => Promise<any>;
89
+ fetchDatastream: (id: string) => Promise<any>;
90
+ fetchDatastreamExpanded: (id: string) => Promise<any>;
91
+ fetchUsersDatastreams: () => Promise<any>;
92
+ updateDatastream: (newDS: Datastream, oldDS?: Datastream | null) => Promise<any>;
93
+ deleteDatastream: (id: string) => Promise<any>;
94
+ downloadDatastreamCSV: (id: string) => Promise<any>;
95
+ createObservedProperty: (op: ObservedProperty) => Promise<any>;
96
+ fetchObservedProperty: (id: string) => Promise<any>;
97
+ fetchObservedProperties: () => Promise<any>;
98
+ fetchWorkspaceObservedProperties: (id: string) => Promise<any>;
99
+ updateObservedProperty: (newOP: ObservedProperty, oldOP?: ObservedProperty | null) => Promise<any>;
100
+ deleteObservedProperty: (id: string) => Promise<any>;
101
+ createProcessingLevel: (pl: ProcessingLevel) => Promise<any>;
102
+ fetchProcessingLevels: () => Promise<any>;
103
+ fetchProcessingLevel: (id: string) => Promise<any>;
104
+ fetchWorkspaceProcessingLevels: (id: string) => Promise<any>;
105
+ updateProcessingLevel: (newPL: ProcessingLevel, oldPL?: ProcessingLevel | null) => Promise<any>;
106
+ deleteProcessingLevel: (id: string) => Promise<any>;
107
+ createSensor: (sensor: Sensor) => Promise<any>;
108
+ fetchSensors: () => Promise<any>;
109
+ fetchSensor: (id: string) => Promise<any>;
110
+ fetchWorkspaceSensors: (id: string) => Promise<any>;
111
+ updateSensor: (newSensor: Sensor, oldSensor?: Sensor | null) => Promise<any>;
112
+ deleteSensor: (id: string) => Promise<any>;
113
+ createResultQualifier: (resultQualifier: ResultQualifier) => Promise<any>;
114
+ fetchResultQualifiers: () => Promise<any>;
115
+ fetchWorkspaceResultQualifiers: (id: string) => Promise<any>;
116
+ updateResultQualifier: (newResultQualifier: ResultQualifier, oldResultQualifier?: ResultQualifier | null) => Promise<any>;
117
+ deleteResultQualifier: (id: string) => Promise<any>;
118
+ createOrchestrationSystem: (system: OrchestrationSystem) => Promise<any>;
119
+ fetchOrchestrationSystems: () => Promise<any>;
120
+ fetchWorkspaceOrchestrationSystems: (id: string) => Promise<any>;
121
+ fetchOrchestrationSystem: (id: string) => Promise<any>;
122
+ updateOrchestrationSystem: (id: string, system: OrchestrationSystem) => Promise<any>;
123
+ deleteOrchestrationSystem: (id: string) => Promise<any>;
124
+ createDataSource: (dataSource: DataSource) => Promise<any>;
125
+ fetchDataSources: () => Promise<any>;
126
+ fetchWorkspaceDataSources: (id: string) => Promise<any>;
127
+ fetchDataSource: (id: string) => Promise<any>;
128
+ updateDataSource: (newS: DataSource) => Promise<any>;
129
+ updateDataSourcePartial: (newS: DataSource) => Promise<any>;
130
+ deleteDataSource: (id: string) => Promise<any>;
131
+ linkDatastreamToDataSource: (dataSourceId: string, datastreamId: string) => Promise<any>;
132
+ unlinkDatastreamFromDataSource: (dataSourceId: string, datastreamId: string) => Promise<any>;
133
+ fetchObservations: (endpoint: string) => Promise<any>;
134
+ deleteObservationsForDatastream: (datastreamId: string) => Promise<any>;
135
+ fetchUserTypes: () => Promise<any>;
136
+ fetchOrganizationTypes: () => Promise<any>;
137
+ fetchSiteTypes: () => Promise<any>;
138
+ fetchSamplingFeatureTypes: () => Promise<any>;
139
+ fetchSensorEncodingTypes: () => Promise<any>;
140
+ fetchMethodTypes: () => Promise<any>;
141
+ fetchVariableTypes: () => Promise<any>;
142
+ fetchUnitTypes: () => Promise<any>;
143
+ fetchDatastreamStatuses: () => Promise<any>;
144
+ fetchDatastreamAggregations: () => Promise<any>;
145
+ fetchSampledMediums: () => Promise<any>;
146
+ };
147
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare const apiMethods: {
2
+ fetch(endpoint: string, options?: any): Promise<any>;
3
+ patch(endpoint: string, body: any, originalBody?: any, options?: any): Promise<any>;
4
+ post(endpoint: string, body?: any, options?: any): Promise<any>;
5
+ put(endpoint: string, body?: any, options?: any): Promise<any>;
6
+ delete(endpoint: string, body?: any, options?: any): Promise<any>;
7
+ paginatedFetch<T>(base: string, pageSize?: number): Promise<any>;
8
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Creates an object that represents the differences (patches) between the
3
+ * original and the updated objects.
4
+ *
5
+ * This function iterates through the properties of the updated object and compares each property
6
+ * with the corresponding property in the original object. If a difference is found:
7
+ * 1. For properties that are objects, it recursively computes the nested differences.
8
+ * 2. For other properties, it directly assigns the updated value.
9
+ *
10
+ * Note: The function only checks properties that exist in the updated object.
11
+ *
12
+ * @param {any} original - The original object to compare from.
13
+ * @param {any} updated - The updated object to compare against.
14
+ * @returns {any} An object representing the differences between the two input objects.
15
+ * If two properties are identical, they won't appear in the result.
16
+ */
17
+ export declare function createPatchObject(original: any, updated: any): any;
@@ -0,0 +1 @@
1
+ export declare function getCSRFToken(): string | null;
@@ -0,0 +1,6 @@
1
+ export * from './api';
2
+ export * from './apiMethods';
3
+ export * from './createPatchObject';
4
+ export * from './getCSRFToken';
5
+ export * from './requestInterceptor';
6
+ export * from './responseInterceptor';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Intercepts and enhances a request options object.
3
+ *
4
+ * - Adds Django AllAuth 'sessionid' to all requests
5
+ * - Adds CSRF Token to non-GET requests
6
+ * - If a body is present and it's an object, the body is stringified.
7
+ *
8
+ * @param {any} options - The original request options object.
9
+ *
10
+ * @returns {any} The enhanced request options with possible modified headers and body.
11
+ */
12
+ export declare function requestInterceptor(options: any): any;
@@ -0,0 +1,2 @@
1
+ export declare function extractErrorMessage(body: any): any;
2
+ export declare function responseInterceptor(response: Response): Promise<any>;
@@ -0,0 +1,372 @@
1
+ import { DataSource } from "@/models";
2
+ import { ObservationRecord } from "@/utils/plotting/observation-record";
3
+ export type EnumDictionary<T extends string | symbol | number, U> = {
4
+ [K in T]: U;
5
+ };
6
+ export declare enum TimeUnit {
7
+ SECOND = "s",
8
+ MINUTE = "m",
9
+ HOUR = "h",
10
+ DAY = "D",
11
+ WEEK = "W",
12
+ MONTH = "M",
13
+ YEAR = "Y"
14
+ }
15
+ export declare enum EnumEditOperations {
16
+ ADD_POINTS = "ADD_POINTS",
17
+ CHANGE_VALUES = "CHANGE_VALUES",
18
+ /**
19
+ * Single-operation assignment of distinct values at distinct indices.
20
+ * Args: `(indices: number[], values: number[])` — parallel arrays where
21
+ * `values[i]` is written to `dataY[indices[i]]`. No workers, no per-row
22
+ * ceremony. Intended for table-driven edits.
23
+ */
24
+ ASSIGN_VALUES_BULK = "ASSIGN_VALUES_BULK",
25
+ DELETE_POINTS = "DELETE_POINTS",
26
+ DRIFT_CORRECTION = "DRIFT_CORRECTION",
27
+ INTERPOLATE = "INTERPOLATE",
28
+ SHIFT_DATETIMES = "SHIFT_DATETIMES",
29
+ /**
30
+ * Single-operation assignment of distinct datetimes at distinct indices.
31
+ * Args: `(indices: number[], datetimes: number[])` — parallel arrays of
32
+ * epoch-milliseconds. Runs one combined delete + add under the hood.
33
+ */
34
+ ASSIGN_DATETIMES_BULK = "ASSIGN_DATETIMES_BULK",
35
+ FILL_GAPS = "FILL_GAPS"
36
+ }
37
+ export declare enum EnumFilterOperations {
38
+ FIND_GAPS = "FIND_GAPS",
39
+ PERSISTENCE = "PERSISTENCE",
40
+ CHANGE = "CHANGE",
41
+ RATE_OF_CHANGE = "RATE_OF_CHANGE",
42
+ VALUE_THRESHOLD = "VALUE_THRESHOLD",
43
+ DATETIME_RANGE = "DATETIME_RANGE",
44
+ SELECTION = "SELECTION"
45
+ }
46
+ export declare enum FilterOperation {
47
+ LT = "Less than",
48
+ LTE = "Less than or equal to",
49
+ GT = "Greater than",
50
+ GTE = "Greater than or equal to",
51
+ E = "Equal"
52
+ }
53
+ export declare enum Operator {
54
+ ADD = "ADD",
55
+ SUB = "SUB",
56
+ MULT = "MULT",
57
+ DIV = "DIV",
58
+ ASSIGN = "ASSIGN"
59
+ }
60
+ export declare enum LogicalOperation {
61
+ LT = "Less than",
62
+ LTE = "Less than or equal to",
63
+ GT = "Greater than",
64
+ GTE = "Greater than or equal to",
65
+ E = "Equal"
66
+ }
67
+ export type HistoryItem = {
68
+ method: EnumEditOperations | EnumFilterOperations;
69
+ icon: string;
70
+ isLoading: boolean;
71
+ args?: any[];
72
+ duration?: number;
73
+ selected?: number[];
74
+ status?: "success" | "failed";
75
+ /**
76
+ * Whether the operation actually ran on a web worker or inline on
77
+ * the main thread. Populated by the `ObservationRecord` dispatch
78
+ * site based on the calibration decision and any always-inline /
79
+ * always-worker handler behaviour. Mainly useful in dev for
80
+ * verifying that the calibration layer is routing as expected —
81
+ * the qc-app surfaces a small badge per history entry when
82
+ * `import.meta.env.DEV` is truthy.
83
+ */
84
+ executionMode?: "worker" | "inline";
85
+ };
86
+ export type DataPoint = {
87
+ date: Date;
88
+ value: number;
89
+ };
90
+ export type DataArray = [string, number][];
91
+ export interface GraphSeries {
92
+ id: string;
93
+ name: string;
94
+ data: ObservationRecord;
95
+ yAxisLabel: string;
96
+ seriesOption: any;
97
+ }
98
+ export type TimeSpacingUnit = "seconds" | "minutes" | "hours" | "days";
99
+ export interface Tag {
100
+ key: string;
101
+ value: string;
102
+ }
103
+ export type Frequency = "daily" | "weekly" | "monthly" | null;
104
+ export declare class HydroShareArchive {
105
+ id: string;
106
+ thingId: string;
107
+ link: string;
108
+ frequency: Frequency;
109
+ path: string;
110
+ datastreamIds: string[];
111
+ publicResource: boolean;
112
+ constructor();
113
+ }
114
+ export declare class PostHydroShareArchive extends HydroShareArchive {
115
+ resourceTitle?: string;
116
+ resourceAbstract?: string;
117
+ resourceKeywords?: string[];
118
+ constructor();
119
+ }
120
+ export declare class Location {
121
+ latitude?: number | "";
122
+ longitude?: number | "";
123
+ elevation_m?: number | "";
124
+ elevationDatum: string;
125
+ state: string;
126
+ county: string;
127
+ country: string;
128
+ constructor();
129
+ }
130
+ export declare class Thing {
131
+ id: string;
132
+ workspaceId: string;
133
+ name: string;
134
+ location: Location;
135
+ tags: Tag[];
136
+ hydroShareArchive?: HydroShareArchive | null;
137
+ siteType: string;
138
+ samplingFeatureCode: string;
139
+ isPrivate: boolean;
140
+ description: string;
141
+ samplingFeatureType: string;
142
+ dataDisclaimer: string;
143
+ constructor();
144
+ }
145
+ export interface ThingWithColor extends Thing {
146
+ color?: {
147
+ borderColor: string;
148
+ background: string;
149
+ glyphColor: string;
150
+ };
151
+ tagValue?: string;
152
+ }
153
+ export declare class Datastream {
154
+ id: string;
155
+ workspaceId: string;
156
+ name: string;
157
+ description: string;
158
+ thingId: string;
159
+ observationType: string;
160
+ resultType?: string;
161
+ status?: string;
162
+ sampledMedium: string;
163
+ noDataValue: number;
164
+ aggregationStatistic: string;
165
+ unitId: string;
166
+ observedPropertyId: string;
167
+ sensorId: string;
168
+ processingLevelId: string;
169
+ isPrivate: boolean;
170
+ isVisible: boolean;
171
+ phenomenonBeginTime?: string | null;
172
+ phenomenonEndTime?: string | null;
173
+ intendedTimeSpacing?: number;
174
+ intendedTimeSpacingUnit?: TimeSpacingUnit | null;
175
+ timeAggregationInterval: number | null;
176
+ timeAggregationIntervalUnit: TimeSpacingUnit;
177
+ dataSourceId?: string | null;
178
+ valueCount: number;
179
+ constructor(thingId?: string);
180
+ }
181
+ export interface DatastreamExtended {
182
+ id: string;
183
+ name: string;
184
+ description: string;
185
+ observationType: string;
186
+ resultType?: string;
187
+ status?: string;
188
+ sampledMedium: string;
189
+ noDataValue: number;
190
+ aggregationStatistic: string;
191
+ isPrivate: boolean;
192
+ isVisible: boolean;
193
+ phenomenonBeginTime?: string | null;
194
+ phenomenonEndTime?: string | null;
195
+ intendedTimeSpacing?: number;
196
+ intendedTimeSpacingUnit?: TimeSpacingUnit | null;
197
+ timeAggregationInterval: number | null;
198
+ timeAggregationIntervalUnit: TimeSpacingUnit;
199
+ dataSourceId?: string | null;
200
+ valueCount: number;
201
+ thing: Thing;
202
+ workspace: Workspace;
203
+ unit: Unit;
204
+ observedProperty: ObservedProperty;
205
+ sensor: Sensor;
206
+ processingLevel: ProcessingLevel;
207
+ dataSource: DataSource;
208
+ }
209
+ export declare class Unit {
210
+ id: string;
211
+ workspaceId: string;
212
+ name: string;
213
+ symbol: string;
214
+ definition: string;
215
+ type: string;
216
+ constructor();
217
+ }
218
+ export declare class Sensor {
219
+ id: string;
220
+ workspaceId: string;
221
+ name: string;
222
+ description: string;
223
+ manufacturer: string;
224
+ model: string;
225
+ methodType: string;
226
+ methodCode: string;
227
+ methodLink: string;
228
+ encodingType: string;
229
+ modelLink: string;
230
+ constructor();
231
+ }
232
+ export declare class ObservedProperty {
233
+ id: string;
234
+ workspaceId: string;
235
+ name: string;
236
+ definition: string;
237
+ description: string;
238
+ type: string;
239
+ code: string;
240
+ constructor();
241
+ }
242
+ export declare class ProcessingLevel {
243
+ id: string;
244
+ workspaceId: string;
245
+ code: string;
246
+ definition: string;
247
+ explanation: string;
248
+ constructor();
249
+ }
250
+ export declare class ResultQualifier {
251
+ id: string;
252
+ workspaceId: string;
253
+ code: string;
254
+ description: string;
255
+ constructor();
256
+ }
257
+ export declare class Organization {
258
+ name?: string;
259
+ code?: string;
260
+ type?: string;
261
+ description?: string;
262
+ link?: string;
263
+ constructor();
264
+ }
265
+ export declare class User {
266
+ id: string;
267
+ email: string;
268
+ password: string;
269
+ firstName: string;
270
+ middleName: string;
271
+ lastName: string;
272
+ phone: string;
273
+ address: string;
274
+ organization?: Organization | null;
275
+ type: string;
276
+ link: string;
277
+ accountType: "admin" | "standard" | "limited";
278
+ hydroShareConnected: boolean;
279
+ constructor();
280
+ }
281
+ export interface Photo {
282
+ name: string;
283
+ link: string;
284
+ }
285
+ export declare class OAuthProvider {
286
+ id: string;
287
+ name: string;
288
+ iconLink: string;
289
+ signupEnabled: boolean;
290
+ connectEnabled: boolean;
291
+ constructor();
292
+ }
293
+ export declare enum PermissionAction {
294
+ Global = "*",
295
+ View = "view",
296
+ Create = "create",
297
+ Edit = "edit",
298
+ Delete = "delete"
299
+ }
300
+ export declare enum PermissionResource {
301
+ Global = "*",
302
+ Workspace = "Workspace",
303
+ Collaborator = "Collaborator",
304
+ Thing = "Thing",
305
+ Datastream = "Datastream",
306
+ Sensor = "Sensor",
307
+ Unit = "Unit",
308
+ ObservedProperty = "ObservedProperty",
309
+ ProcessingLevel = "ProcessingLevel",
310
+ Observation = "Observation"
311
+ }
312
+ export interface Permission {
313
+ action: PermissionAction;
314
+ resource: PermissionResource;
315
+ }
316
+ export interface CollaboratorRole {
317
+ name: string;
318
+ description: string;
319
+ id: string;
320
+ workspaceId: string;
321
+ isApikeyRole: boolean;
322
+ isUserRole: boolean;
323
+ permissions: Permission[];
324
+ }
325
+ export declare class ApiKey {
326
+ id: string;
327
+ key: string;
328
+ name: string;
329
+ description: string;
330
+ isActive: boolean;
331
+ expiresAt: string;
332
+ createdAt: string;
333
+ lastUsed: string;
334
+ workspaceId: string;
335
+ role: CollaboratorRole | null;
336
+ constructor(init?: Partial<ApiKey>);
337
+ }
338
+ export interface WorkspaceData {
339
+ id: string;
340
+ name: string;
341
+ isPrivate: boolean;
342
+ owner: User;
343
+ collaboratorRole: CollaboratorRole;
344
+ pendingTransferTo?: User | null;
345
+ }
346
+ export declare class Workspace {
347
+ id: string;
348
+ name: string;
349
+ isPrivate: boolean;
350
+ owner: UserInfo | null;
351
+ collaboratorRole: CollaboratorRole | null;
352
+ pendingTransferTo?: UserInfo | null;
353
+ constructor();
354
+ }
355
+ export interface UserInfo {
356
+ name: string;
357
+ email: string;
358
+ phone: string;
359
+ address: string;
360
+ link: string;
361
+ type: string;
362
+ organizationName: string;
363
+ }
364
+ export declare class Collaborator {
365
+ user: UserInfo;
366
+ role: CollaboratorRole;
367
+ constructor();
368
+ }
369
+ export interface ApiError {
370
+ status: number;
371
+ message?: string;
372
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const measureEllapsedTime: (fn: () => any, message?: string) => Promise<{
2
+ response: any;
3
+ duration: number;
4
+ }>;
@@ -0,0 +1,4 @@
1
+ import { EnumDictionary, TimeUnit } from '@/types';
2
+ export declare const timeUnitMultipliers: EnumDictionary<TimeUnit, number>;
3
+ export declare const formatDate: (date: Date) => string;
4
+ export declare const formatDuration: (duration: number) => string;
@@ -0,0 +1,6 @@
1
+ export * from './format';
2
+ export * from './ellapsed-time';
3
+ export * from './notifications';
4
+ export * from './observations';
5
+ export * from './plotting/observation-record';
6
+ export * from './plotting/calibration';
@@ -0,0 +1,5 @@
1
+ export declare function subtractHours(timestamp: string, hours: number): string;
2
+ /** Returns the index of the first value that is greater or equal to the target value */
3
+ export declare const findFirstGreaterOrEqual: (array: number[] | Float64Array<SharedArrayBuffer>, target: number) => number;
4
+ /** Returns the index of the last value that is lesser or equal to the target value */
5
+ export declare const findLastLessOrEqual: (array: number[] | Float64Array<SharedArrayBuffer>, target: number) => number;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Unit tests for the public surface of `calibration.ts`.
3
+ *
4
+ * The module imports `value-threshold.worker?worker&inline` eagerly, which
5
+ * Vite transforms in the app build but not in Vitest + happy-dom — so we
6
+ * substitute the same `MockValueThresholdWorker` used by
7
+ * `observation-record.spec.ts` to give `runBenchmarks()` a working worker
8
+ * constructor. The mock round-trips via `queueMicrotask`, which is enough
9
+ * for `ensureCalibration()` to complete synchronously-ish in tests.
10
+ *
11
+ * Module state (`activeProfile`, `lastBenchmarkDetail`, `listeners`,
12
+ * `localStorage`) lives at import scope, so every test begins with a
13
+ * `clearCalibration()` and a `localStorage.clear()` to avoid cross-
14
+ * pollination.
15
+ */
16
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Coverage-focused tests for `observation-record.ts` that exercise
3
+ * paths the baseline spec skips:
4
+ *
5
+ * 1. **Worker fan-out paths** — every `_operation` routes through
6
+ * `shouldUseWorker()` and falls back to an inline core for small
7
+ * inputs. The existing `observation-record.spec.ts` uses tiny
8
+ * datasets, so only the inline branches run. Here we mock
9
+ * `../calibration` so callers can flip `forceWorker = true` and
10
+ * drive the worker branches without needing multi-MB fixtures.
11
+ * 2. **Bulk assignment ops** — `ASSIGN_VALUES_BULK` and
12
+ * `ASSIGN_DATETIMES_BULK` aren't touched by the baseline spec.
13
+ * 3. **Undo / redo** — `undo()` / `redo()` have their own state
14
+ * machines that aren't driven by the `dispatch()` tests.
15
+ * 4. **DATETIME_RANGE, SELECTION pop** — the remaining filter ops.
16
+ *
17
+ * Mocks are hoisted via `vi.mock`; the real calibration module is
18
+ * wrapped so non-mocked helpers (getCalibration, etc.) still work if
19
+ * anything reaches for them.
20
+ */
21
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Direct unit tests for the pure kernels in `operation-cores.ts`. These
3
+ * functions are the shared source of truth for every `*.worker.ts` with an
4
+ * inline equivalent, so once they pass here the worker wrappers only need a
5
+ * thin "message in / message out" check (see `workers.spec.ts`).
6
+ *
7
+ * Cores are deliberately framework-free and accept plain typed arrays, so
8
+ * these tests build buffers from raw `Float32Array` / `Float64Array` rather
9
+ * than `SharedArrayBuffer`. Semantics are identical and happy-dom doesn't
10
+ * require the cross-origin-isolation headers SAB would.
11
+ */
12
+ export {};