@justair/justair-library 7.3.0-alpha.6ef8bd3 → 7.3.0-alpha.e0c71b4
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 +12 -0
- package/dist/constants/pollutants.d.ts +1 -1
- package/dist/constants/pollutants.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants/pollutants.js +7 -6
- package/src/constants/tests/constantsBarrel.test.js +3 -2
- package/src/constants/tests/pollutants.test.js +5 -5
- package/src/index.js +2 -2
package/README.md
CHANGED
|
@@ -97,6 +97,18 @@ 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.3.0
|
|
101
|
+
|
|
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
|
+
|
|
104
|
+
| id | Name | Unit |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| `T_AMB` | Ambient Temperature | `°F` |
|
|
107
|
+
| `RH_AMB` | Ambient Relative Humidity | `%` |
|
|
108
|
+
| `DP_AMB` | Ambient Dew Point | `°F` |
|
|
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. `INTERNAL_TO_AMBIENT_PARAMETERS` exports the pairing as data so consumers can filter on it instead of hardcoding the six ids.
|
|
111
|
+
|
|
100
112
|
### Object shape
|
|
101
113
|
|
|
102
114
|
Each constant is an object with the following fields:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollutants.d.ts","sourceRoot":"","sources":["../../src/constants/poll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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+UA;;;;GAIG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ import { NOTIFICATION_CHANNELS } from "./models/userNotifications.js";
|
|
|
88
88
|
import { DELIVERY_STATUSES } from "./models/userNotifications.js";
|
|
89
89
|
import { PARAMETERS } from "./constants/pollutants.js";
|
|
90
90
|
import { HEAVY_METALS } from "./constants/pollutants.js";
|
|
91
|
-
import {
|
|
91
|
+
import { INTERNAL_TO_AMBIENT_PARAMETERS } from "./constants/pollutants.js";
|
|
92
92
|
import { ALERT_LEVEL_WEIGHTS } from "./constants/alertLevels.js";
|
|
93
93
|
import { getAlertWeight } from "./constants/alertLevels.js";
|
|
94
94
|
import { splitName } from "./utils/splitName.js";
|
|
@@ -101,5 +101,5 @@ import { validateQuietHours } from "./utils/quietHours.js";
|
|
|
101
101
|
import { getZoneMinutes } from "./utils/quietHours.js";
|
|
102
102
|
import { isInQuietWindow } from "./utils/quietHours.js";
|
|
103
103
|
import { resolveQuietHours } from "./utils/quietHours.js";
|
|
104
|
-
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, PARAMETERS, HEAVY_METALS,
|
|
104
|
+
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, PARAMETERS, HEAVY_METALS, INTERNAL_TO_AMBIENT_PARAMETERS, ALERT_LEVEL_WEIGHTS, getAlertWeight, splitName, DEFAULT_QUIET_HOURS, DEFAULT_TIMEZONE, QUIET_HOURS_ERRORS, isValidTimeString, isValidIANATimezone, validateQuietHours, getZoneMinutes, isInQuietWindow, resolveQuietHours };
|
|
105
105
|
//# 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":"AAuHA;;;iBAEC;yBAvDwB,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;mCAA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PARAMETERS = {
|
|
|
151
151
|
origin: null,
|
|
152
152
|
impacts: null,
|
|
153
153
|
},
|
|
154
|
-
// ----
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
// JA-3061 re-points them. See "Ambient vs internal
|
|
154
|
+
// ---- T/RH/DP and their _AMB pairs (JA-3058). Does not apply to WD/WS below. ----
|
|
155
|
+
// Bare ids (T/RH/DP) are enclosure-internal, for corrections and fog detection only. The _AMB
|
|
156
|
+
// ids are true ambient and the only ones safe for public display or Heat Index. Never substitute
|
|
157
|
+
// one for the other. Caveat: five suppliers still write outdoor dew point into DP, so DP is
|
|
158
|
+
// exempt from the public-display filter until JA-3061 re-points them. See "Ambient vs internal
|
|
159
|
+
// met parameters" in CLAUDE.md before wiring up.
|
|
159
160
|
DP: {
|
|
160
161
|
id: "DP",
|
|
161
162
|
label: "Dew Point",
|
|
@@ -332,7 +333,7 @@ export const PARAMETERS = {
|
|
|
332
333
|
// instead of hardcoding the six met ids: the keys are the enclosure-internal parameters that must
|
|
333
334
|
// stay off public surfaces, the values are the ambient ones that are safe to show. Kept in sync
|
|
334
335
|
// with PARAMETERS by a test in tests/pollutants.test.js.
|
|
335
|
-
export const
|
|
336
|
+
export const INTERNAL_TO_AMBIENT_PARAMETERS = Object.freeze({
|
|
336
337
|
T: "T_AMB",
|
|
337
338
|
RH: "RH_AMB",
|
|
338
339
|
DP: "DP_AMB",
|
|
@@ -4,12 +4,13 @@
|
|
|
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 } from '../pollutants.js';
|
|
7
|
+
import { PARAMETERS, HEAVY_METALS, INTERNAL_TO_AMBIENT_PARAMETERS } from '../pollutants.js';
|
|
8
8
|
import { ALERT_LEVEL_WEIGHTS, getAlertWeight } from '../alertLevels.js';
|
|
9
9
|
|
|
10
|
-
test('barrel re-exports
|
|
10
|
+
test('barrel re-exports the pollutants constants unchanged (identity, not copies)', () => {
|
|
11
11
|
expect(barrel.PARAMETERS).toBe(PARAMETERS);
|
|
12
12
|
expect(barrel.HEAVY_METALS).toBe(HEAVY_METALS);
|
|
13
|
+
expect(barrel.INTERNAL_TO_AMBIENT_PARAMETERS).toBe(INTERNAL_TO_AMBIENT_PARAMETERS);
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
test('barrel exports the alert-level constants', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PARAMETERS, HEAVY_METALS,
|
|
1
|
+
import { PARAMETERS, HEAVY_METALS, INTERNAL_TO_AMBIENT_PARAMETERS } from "../pollutants.js";
|
|
2
2
|
|
|
3
3
|
const REQUIRED_FIELDS = ["id", "label", "name", "unit", "type"];
|
|
4
4
|
const VALID_TYPES = [
|
|
@@ -73,13 +73,13 @@ describe("PARAMETERS", () => {
|
|
|
73
73
|
// JA-3060: Processing-Engine hardcodes these ids, so lock the ambient/internal pairing.
|
|
74
74
|
const ambientKeys = Object.keys(PARAMETERS).filter((key) => key.endsWith("_AMB"));
|
|
75
75
|
|
|
76
|
-
test("
|
|
76
|
+
test("the _AMB parameter set is exactly T, RH and DP", () => {
|
|
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("INTERNAL_TO_AMBIENT_PARAMETERS matches the _AMB ids actually defined", () => {
|
|
81
|
+
expect(Object.values(INTERNAL_TO_AMBIENT_PARAMETERS).sort()).toEqual(ambientKeys.sort());
|
|
82
|
+
Object.entries(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,7 @@ 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 { PARAMETERS, HEAVY_METALS,
|
|
68
|
+
import { PARAMETERS, HEAVY_METALS, INTERNAL_TO_AMBIENT_PARAMETERS } from "./constants/pollutants.js";
|
|
69
69
|
import { ALERT_LEVEL_WEIGHTS, getAlertWeight } from "./constants/alertLevels.js";
|
|
70
70
|
import {
|
|
71
71
|
monitorEpisodesSchema,
|
|
@@ -213,7 +213,7 @@ export {
|
|
|
213
213
|
// Pollutant constants
|
|
214
214
|
PARAMETERS,
|
|
215
215
|
HEAVY_METALS,
|
|
216
|
-
|
|
216
|
+
INTERNAL_TO_AMBIENT_PARAMETERS,
|
|
217
217
|
// AQI alert-level hierarchy (single source of truth)
|
|
218
218
|
ALERT_LEVEL_WEIGHTS,
|
|
219
219
|
getAlertWeight,
|