@justair/justair-library 7.3.0-alpha.f340581 → 7.4.0-alpha.5a16ace
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/constants/pollutants.d.ts +2 -1
- package/dist/constants/pollutants.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants/pollutants.js +14 -5
- package/src/constants/tests/constantsBarrel.test.js +2 -2
- package/src/constants/tests/pollutants.test.js +4 -4
- package/src/index.js +8 -2
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ The following parameters were added to `HEAVY_METALS` and are now included in `s
|
|
|
97
97
|
| `MN` | Manganese |
|
|
98
98
|
| `SE` | Selenium |
|
|
99
99
|
|
|
100
|
-
### New met parameters in 7.
|
|
100
|
+
### New met parameters in 7.4.0
|
|
101
101
|
|
|
102
102
|
The following parameters were added to `PARAMETERS` and are now included in `parametersEnum`. Consuming services that display or filter parameters without a `type` filter (admin pickers, notification threshold UIs, reporting) will start showing them on install, even though no service writes them yet.
|
|
103
103
|
|
|
@@ -107,7 +107,7 @@ The following parameters were added to `PARAMETERS` and are now included in `par
|
|
|
107
107
|
| `RH_AMB` | Ambient Relative Humidity | `%` |
|
|
108
108
|
| `DP_AMB` | Ambient Dew Point | `°F` |
|
|
109
109
|
|
|
110
|
-
These are **not** interchangeable with the bare `T` / `RH` / `DP` ids, which are enclosure-internal readings used only by correction equations and fog detection. Never fall back from one kind to the other. See "Ambient vs internal met parameters" in `CLAUDE.md` before wiring these up. `
|
|
110
|
+
These are **not** interchangeable with the bare `T` / `RH` / `DP` ids, which are enclosure-internal readings used only by correction equations and fog detection. Never fall back from one kind to the other. See "Ambient vs internal met parameters" in `CLAUDE.md` before wiring these up. `MET_INTERNAL_TO_AMBIENT_PARAMETERS` exports the pairing as data, and `MET_INTERNAL_PARAMETERS_TO_HIDE` exports the ids that are safe to hide from public surfaces today (`T` and `RH` only; `DP` joins in JA-3061), so consumers filter on data instead of hardcoding the six ids.
|
|
111
111
|
|
|
112
112
|
### Object shape
|
|
113
113
|
|
|
@@ -568,11 +568,12 @@ export namespace PARAMETERS {
|
|
|
568
568
|
export { impacts_31 as impacts };
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
export const
|
|
571
|
+
export const MET_INTERNAL_TO_AMBIENT_PARAMETERS: Readonly<{
|
|
572
572
|
T: "T_AMB";
|
|
573
573
|
RH: "RH_AMB";
|
|
574
574
|
DP: "DP_AMB";
|
|
575
575
|
}>;
|
|
576
|
+
export const MET_INTERNAL_PARAMETERS_TO_HIDE: readonly string[];
|
|
576
577
|
export namespace HEAVY_METALS {
|
|
577
578
|
export namespace AS {
|
|
578
579
|
let id_32: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollutants.d.ts","sourceRoot":"","sources":["../../src/constants/pollutants.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"pollutants.d.ts","sourceRoot":"","sources":["../../src/constants/pollutants.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiVA;;;;GAIG;AAOH,gEAA0E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -101,7 +101,8 @@ import { validateDownloadTimezone as validateDataDownloadTimezone } from "./util
|
|
|
101
101
|
import { normalizeDownloadTimezone as normalizeDataDownloadTimezone } from "./utils/dataDownloadValidation.js";
|
|
102
102
|
import { PARAMETERS } from "./constants/pollutants.js";
|
|
103
103
|
import { HEAVY_METALS } from "./constants/pollutants.js";
|
|
104
|
-
import {
|
|
104
|
+
import { MET_INTERNAL_TO_AMBIENT_PARAMETERS } from "./constants/pollutants.js";
|
|
105
|
+
import { MET_INTERNAL_PARAMETERS_TO_HIDE } from "./constants/pollutants.js";
|
|
105
106
|
import { ALERT_LEVEL_WEIGHTS } from "./constants/alertLevels.js";
|
|
106
107
|
import { getAlertWeight } from "./constants/alertLevels.js";
|
|
107
108
|
import { splitName } from "./utils/splitName.js";
|
|
@@ -114,5 +115,5 @@ import { validateQuietHours } from "./utils/quietHours.js";
|
|
|
114
115
|
import { getZoneMinutes } from "./utils/quietHours.js";
|
|
115
116
|
import { isInQuietWindow } from "./utils/quietHours.js";
|
|
116
117
|
import { resolveQuietHours } from "./utils/quietHours.js";
|
|
117
|
-
export { Database, adminSchema, Admin, configurationsSchema, Configurations, measurementsSchema, Measurements, monitorRequestsSchema, MonitorRequests, monitorsSchema, Monitors, organizationsSchema, Organizations, usersSchema, Users, COOKIE_CONSENT_CATEGORIES, COOKIE_CONSENT_VALUES, validateCookieConsent, eventsSchema, Events, lightMonitorSchema, LightMonitors, monitorSuppliersSchema, MonitorSuppliers, contextsSchema, Contexts, parametersSchema, Parameters, announcementSchema, Announcements, jobsSchema, Jobs, apiKeySchema, ApiKey, UsageMetrics, usageMetricsSchema, Audit, auditSchema, EventsAudit, eventsAuditSchema, MonitorAudit, monitorAuditSchema, parametersEnum, deploymentTypesEnum, AlertsAudit, Alerts, alertsSchema, alertsAuditSchema, Features, featuresSchema, dataCompletenessSchema, DataCompleteness, networkMetricsSchema, NetworkMetrics, rateOfChangeSchema, RateOfChange, changeStreamCheckpointsSchema, ChangeStreamCheckpoints, sitesSchema, Sites, sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum, samplesSchema, Samples, samplesAuditSchema, SamplesAudit, sampleParameterReferenceConcentrations, passwordResetTokenSchema, PasswordResetToken, monitorEpisodesSchema, MonitorEpisode, userNotificationsSchema, UserNotification, AqiAlertNotification, DeviceOfflineNotification, WeeklyDigestNotification, AccountNotification, NOTIFICATION_KINDS, NOTIFICATION_CHANNELS, DELIVERY_STATUSES, DATA_DOWNLOAD_TYPES, dataDownloadSchema, DataDownloads, AqiDataDownload, SampleDataDownload, DATA_DOWNLOAD_MAX_RANGE_DAYS, DATA_DOWNLOAD_ERRORS, validateDataDownloadDateOrder, validateDataDownloadMaxDateRange, validateDataDownloadEmail, normalizeDataDownloadEmail, validateDataDownloadTimezone, normalizeDataDownloadTimezone, PARAMETERS, HEAVY_METALS,
|
|
118
|
+
export { Database, adminSchema, Admin, configurationsSchema, Configurations, measurementsSchema, Measurements, monitorRequestsSchema, MonitorRequests, monitorsSchema, Monitors, organizationsSchema, Organizations, usersSchema, Users, COOKIE_CONSENT_CATEGORIES, COOKIE_CONSENT_VALUES, validateCookieConsent, eventsSchema, Events, lightMonitorSchema, LightMonitors, monitorSuppliersSchema, MonitorSuppliers, contextsSchema, Contexts, parametersSchema, Parameters, announcementSchema, Announcements, jobsSchema, Jobs, apiKeySchema, ApiKey, UsageMetrics, usageMetricsSchema, Audit, auditSchema, EventsAudit, eventsAuditSchema, MonitorAudit, monitorAuditSchema, parametersEnum, deploymentTypesEnum, AlertsAudit, Alerts, alertsSchema, alertsAuditSchema, Features, featuresSchema, dataCompletenessSchema, DataCompleteness, networkMetricsSchema, NetworkMetrics, rateOfChangeSchema, RateOfChange, changeStreamCheckpointsSchema, ChangeStreamCheckpoints, sitesSchema, Sites, sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum, samplesSchema, Samples, samplesAuditSchema, SamplesAudit, sampleParameterReferenceConcentrations, passwordResetTokenSchema, PasswordResetToken, monitorEpisodesSchema, MonitorEpisode, userNotificationsSchema, UserNotification, AqiAlertNotification, DeviceOfflineNotification, WeeklyDigestNotification, AccountNotification, NOTIFICATION_KINDS, NOTIFICATION_CHANNELS, DELIVERY_STATUSES, DATA_DOWNLOAD_TYPES, dataDownloadSchema, DataDownloads, AqiDataDownload, SampleDataDownload, DATA_DOWNLOAD_MAX_RANGE_DAYS, DATA_DOWNLOAD_ERRORS, validateDataDownloadDateOrder, validateDataDownloadMaxDateRange, validateDataDownloadEmail, normalizeDataDownloadEmail, validateDataDownloadTimezone, normalizeDataDownloadTimezone, PARAMETERS, HEAVY_METALS, MET_INTERNAL_TO_AMBIENT_PARAMETERS, MET_INTERNAL_PARAMETERS_TO_HIDE, ALERT_LEVEL_WEIGHTS, getAlertWeight, splitName, DEFAULT_QUIET_HOURS, DEFAULT_TIMEZONE, QUIET_HOURS_ERRORS, isValidTimeString, isValidIANATimezone, validateQuietHours, getZoneMinutes, isInQuietWindow, resolveQuietHours };
|
|
118
119
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAyJA;;;iBAEC;yBAzFwB,oBAAoB;qBADxB,gBAAgB;4BAjEF,mBAAmB;sBAAnB,mBAAmB;qCAI/C,4BAA4B;+BAA5B,4BAA4B;mCAM5B,0BAA0B;6BAA1B,0BAA0B;sCAI1B,6BAA6B;gCAA7B,6BAA6B;+BAQ7B,sBAAsB;yBAAtB,sBAAsB;oCACsB,2BAA2B;8BAA3B,2BAA2B;4BAcvE,mBAAmB;sBAAnB,mBAAmB;0CAAnB,mBAAmB;sCAAnB,mBAAmB;sCAAnB,mBAAmB;6BAMnB,oBAAoB;uBAApB,oBAAoB;mCAnBuB,2BAA2B;8BAA3B,2BAA2B;uCAItE,8BAA8B;iCAA9B,8BAA8B;+BACI,sBAAsB;yBAAtB,sBAAsB;iCAClB,wBAAwB;2BAAxB,wBAAwB;mCAcnB,2BAA2B;8BAA3B,2BAA2B;2BAC5C,kBAAkB;qBAAlB,kBAAkB;6BACd,oBAAoB;uBAApB,oBAAoB;6BACR,0BAA0B;mCAA1B,0BAA0B;sBArCpE,0BAA0B;4BAA1B,0BAA0B;4BAiC1B,oBAAoB;kCAApB,oBAAoB;6BArBpB,sBAAsB;mCAAtB,s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
329
329
|
},
|
|
330
330
|
};
|
|
331
331
|
|
|
332
|
-
//
|
|
333
|
-
// instead of hardcoding the six met ids
|
|
334
|
-
//
|
|
335
|
-
//
|
|
336
|
-
|
|
332
|
+
// Enclosure-internal parameter id -> its ambient counterpart (JA-3058). Lets consumers map
|
|
333
|
+
// between the two kinds on data instead of hardcoding the six met ids. Kept in sync with
|
|
334
|
+
// PARAMETERS by a test in tests/pollutants.test.js.
|
|
335
|
+
//
|
|
336
|
+
// This is a pairing map, not a hide-list. For the hide-list use
|
|
337
|
+
// MET_INTERNAL_PARAMETERS_TO_HIDE below, which leaves DP out on purpose.
|
|
338
|
+
export const MET_INTERNAL_TO_AMBIENT_PARAMETERS = Object.freeze({
|
|
337
339
|
T: "T_AMB",
|
|
338
340
|
RH: "RH_AMB",
|
|
339
341
|
DP: "DP_AMB",
|
|
340
342
|
});
|
|
341
343
|
|
|
344
|
+
// The internal met ids that are safe to hide from public surfaces today. DP is deliberately
|
|
345
|
+
// absent: five suppliers (Kunak, QuantAQ, Davis, HOBOlink, Aeroqual) still write outdoor dew
|
|
346
|
+
// point into DP and nothing writes DP_AMB yet, so hiding DP now would drop dew point from those
|
|
347
|
+
// dashboards entirely. DP joins this list in JA-3061. See "Ambient vs internal met parameters"
|
|
348
|
+
// in CLAUDE.md.
|
|
349
|
+
export const MET_INTERNAL_PARAMETERS_TO_HIDE = Object.freeze(["T", "RH"]);
|
|
350
|
+
|
|
342
351
|
// Parameters analyzed from physical air samples in a laboratory.
|
|
343
352
|
// These correspond to SampleSites.parameters and are not measured by real-time sensors.
|
|
344
353
|
export const HEAVY_METALS = {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// importing PARAMETERS / HEAVY_METALS through the barrel must see the exact
|
|
5
5
|
// same objects as before.
|
|
6
6
|
import * as barrel from '../index.js';
|
|
7
|
-
import { PARAMETERS, HEAVY_METALS,
|
|
7
|
+
import { PARAMETERS, HEAVY_METALS, MET_INTERNAL_TO_AMBIENT_PARAMETERS } from '../pollutants.js';
|
|
8
8
|
import { ALERT_LEVEL_WEIGHTS, getAlertWeight } from '../alertLevels.js';
|
|
9
9
|
import { DEFAULT_TIMEZONE } from '../timezones.js';
|
|
10
10
|
import { DATA_DOWNLOAD_TYPES } from '../dataDownloads.js';
|
|
@@ -12,7 +12,7 @@ import { DATA_DOWNLOAD_TYPES } from '../dataDownloads.js';
|
|
|
12
12
|
test('barrel re-exports the pollutants constants unchanged (identity, not copies)', () => {
|
|
13
13
|
expect(barrel.PARAMETERS).toBe(PARAMETERS);
|
|
14
14
|
expect(barrel.HEAVY_METALS).toBe(HEAVY_METALS);
|
|
15
|
-
expect(barrel.
|
|
15
|
+
expect(barrel.MET_INTERNAL_TO_AMBIENT_PARAMETERS).toBe(MET_INTERNAL_TO_AMBIENT_PARAMETERS);
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
test('barrel exports the alert-level constants', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PARAMETERS, HEAVY_METALS,
|
|
1
|
+
import { PARAMETERS, HEAVY_METALS, MET_INTERNAL_TO_AMBIENT_PARAMETERS } from "../pollutants.js";
|
|
2
2
|
|
|
3
3
|
const REQUIRED_FIELDS = ["id", "label", "name", "unit", "type"];
|
|
4
4
|
const VALID_TYPES = [
|
|
@@ -77,9 +77,9 @@ describe("PARAMETERS", () => {
|
|
|
77
77
|
expect(ambientKeys.sort()).toEqual(["DP_AMB", "RH_AMB", "T_AMB"]);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
test("
|
|
81
|
-
expect(Object.values(
|
|
82
|
-
Object.entries(
|
|
80
|
+
test("MET_INTERNAL_TO_AMBIENT_PARAMETERS matches the _AMB ids actually defined", () => {
|
|
81
|
+
expect(Object.values(MET_INTERNAL_TO_AMBIENT_PARAMETERS).sort()).toEqual(ambientKeys.sort());
|
|
82
|
+
Object.entries(MET_INTERNAL_TO_AMBIENT_PARAMETERS).forEach(([bare, ambient]) => {
|
|
83
83
|
expect(PARAMETERS[bare]).toBeDefined();
|
|
84
84
|
expect(ambient).toBe(`${bare}_AMB`);
|
|
85
85
|
});
|
package/src/index.js
CHANGED
|
@@ -65,7 +65,12 @@ import {
|
|
|
65
65
|
} from "./models/changeStreamCheckpoints.js";
|
|
66
66
|
import Database from "./config/db.js"; // Import the new Database class
|
|
67
67
|
import CustomLogger from "./config/logger.js";
|
|
68
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
PARAMETERS,
|
|
70
|
+
HEAVY_METALS,
|
|
71
|
+
MET_INTERNAL_TO_AMBIENT_PARAMETERS,
|
|
72
|
+
MET_INTERNAL_PARAMETERS_TO_HIDE,
|
|
73
|
+
} from "./constants/pollutants.js";
|
|
69
74
|
import { ALERT_LEVEL_WEIGHTS, getAlertWeight } from "./constants/alertLevels.js";
|
|
70
75
|
import { DEFAULT_TIMEZONE } from "./constants/timezones.js";
|
|
71
76
|
import { DATA_DOWNLOAD_TYPES } from "./constants/dataDownloads.js";
|
|
@@ -256,7 +261,8 @@ export {
|
|
|
256
261
|
// Pollutant constants
|
|
257
262
|
PARAMETERS,
|
|
258
263
|
HEAVY_METALS,
|
|
259
|
-
|
|
264
|
+
MET_INTERNAL_TO_AMBIENT_PARAMETERS,
|
|
265
|
+
MET_INTERNAL_PARAMETERS_TO_HIDE,
|
|
260
266
|
// AQI alert-level hierarchy (single source of truth)
|
|
261
267
|
ALERT_LEVEL_WEIGHTS,
|
|
262
268
|
getAlertWeight,
|