@justair/justair-library 5.0.0-alpha.cc5acc0 → 5.0.0-alpha.fb078ea
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 +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/models/monitors.d.ts +0 -1
- package/dist/models/monitors.d.ts.map +1 -1
- package/dist/models/sampleSites.d.ts.map +1 -1
- package/dist/models/sites.d.ts +3 -0
- package/dist/models/sites.d.ts.map +1 -0
- package/dist/models/tests/sampleSites.test.d.ts +2 -0
- package/dist/models/tests/sampleSites.test.d.ts.map +1 -0
- package/dist/models/tests/sites.test.d.ts +2 -0
- package/dist/models/tests/sites.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/index.js +6 -2
- package/src/models/monitors.js +6 -5
- package/src/models/sampleSites.js +4 -0
- package/src/models/sites.js +55 -0
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ import { eventsAuditSchema } from "./models/events.js";
|
|
|
43
43
|
import { MonitorAudit } from "./models/monitors.js";
|
|
44
44
|
import { monitorAuditSchema } from "./models/monitors.js";
|
|
45
45
|
import { parametersEnum } from "./models/monitors.js";
|
|
46
|
-
import { legacyParametersEnum } from "./models/monitors.js";
|
|
47
46
|
import { deploymentTypesEnum } from "./models/monitors.js";
|
|
48
47
|
import { AlertsAudit } from "./models/alerts.js";
|
|
49
48
|
import { Alerts } from "./models/alerts.js";
|
|
@@ -57,6 +56,8 @@ import { networkMetricsSchema } from "./models/networkMetrics.js";
|
|
|
57
56
|
import { NetworkMetrics } from "./models/networkMetrics.js";
|
|
58
57
|
import { rateOfChangeSchema } from "./models/rateOfChange.js";
|
|
59
58
|
import { RateOfChange } from "./models/rateOfChange.js";
|
|
59
|
+
import { sitesSchema } from "./models/sites.js";
|
|
60
|
+
import { Sites } from "./models/sites.js";
|
|
60
61
|
import { sampleSitesSchema } from "./models/sampleSites.js";
|
|
61
62
|
import { SampleSites } from "./models/sampleSites.js";
|
|
62
63
|
import { sampleSiteAuditSchema } from "./models/sampleSites.js";
|
|
@@ -69,5 +70,5 @@ import { SamplesAudit } from "./models/samples.js";
|
|
|
69
70
|
import { sampleParameterReferenceConcentrations } from "./models/samples.js";
|
|
70
71
|
import { PARAMETERS } from "./constants/pollutants.js";
|
|
71
72
|
import { HEAVY_METALS } from "./constants/pollutants.js";
|
|
72
|
-
export { Database, adminSchema, Admin, configurationsSchema, Configurations, measurementsSchema, Measurements, monitorRequestsSchema, MonitorRequests, monitorsSchema, Monitors, organizationsSchema, Organizations, usersSchema, Users, 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,
|
|
73
|
+
export { Database, adminSchema, Admin, configurationsSchema, Configurations, measurementsSchema, Measurements, monitorRequestsSchema, MonitorRequests, monitorsSchema, Monitors, organizationsSchema, Organizations, usersSchema, Users, 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, sitesSchema, Sites, sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum, samplesSchema, Samples, samplesAuditSchema, SamplesAudit, sampleParameterReferenceConcentrations, PARAMETERS, HEAVY_METALS };
|
|
73
74
|
//# 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":"AAgFA;;;iBAEC;yBA1BwB,oBAAoB;qBADxB,gBAAgB;4BAvDF,mBAAmB;sBAAnB,mBAAmB;qCAI/C,4BAA4B;+BAA5B,4BAA4B;mCAM5B,0BAA0B;6BAA1B,0BAA0B;sCAI1B,6BAA6B;gCAA7B,6BAA6B;+BAQ7B,sBAAsB;yBAAtB,sBAAsB;oCACsB,2BAA2B;8BAA3B,2BAA2B;4BAQ3C,mBAAmB;sBAAnB,mBAAmB;6BAM/C,oBAAoB;uBAApB,oBAAoB;mCAbuB,2BAA2B;8BAA3B,2BAA2B;uCAItE,8BAA8B;iCAA9B,8BAA8B;+BACI,sBAAsB;yBAAtB,sBAAsB;iCAClB,wBAAwB;2BAAxB,wBAAwB;mCAQnB,2BAA2B;8BAA3B,2BAA2B;2BAC5C,kBAAkB;qBAAlB,kBAAkB;6BACd,oBAAoB;uBAApB,oBAAoB;6BACR,0BAA0B;mCAA1B,0BAA0B;sBA/BpE,0BAA0B;4BAA1B,0BAA0B;4BA2B1B,oBAAoB;kCAApB,oBAAoB;6BAfpB,sBAAsB;mCAAtB,sBAAsB;+BAAtB,sBAAsB;oCAAtB,sBAAsB;4BAyBtB,oBAAoB;uBAApB,oBAAoB;6BAApB,oBAAoB;kCAApB,oBAAoB;yBACc,sBAAsB;+BAAtB,sBAAsB;uCAIxD,8BAA8B;iCAA9B,8BAA8B;qCACgB,4BAA4B;+BAA5B,4BAA4B;mCAChC,0BAA0B;6BAA1B,0BAA0B;4BAMxC,mBAAmB;sBAAnB,mBAAmB;kCAS/C,yBAAyB;4BAAzB,yBAAyB;sCAAzB,yBAAyB;gCAAzB,yBAAyB;qCAAzB,yBAAyB;8BASzB,qBAAqB;wBAArB,qBAAqB;mCAArB,qBAAqB;6BAArB,qBAAqB;uDAArB,qBAAqB;2BArBa,2BAA2B;6BAA3B,2BAA2B"}
|
|
@@ -3,7 +3,6 @@ export const Monitors: any;
|
|
|
3
3
|
export const monitorAuditSchema: any;
|
|
4
4
|
export const MonitorAudit: any;
|
|
5
5
|
export const parametersEnum: string[];
|
|
6
|
-
export const legacyParametersEnum: string[];
|
|
7
6
|
export namespace deploymentTypesEnum {
|
|
8
7
|
let STATIONARY: string;
|
|
9
8
|
let MOBILE: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"AA6JA,iCA8HE;AAuIF,2BAA4D;AAvS5D,qCA4BE;AAGF,+BAAwE;AAvJxE,sCAAoD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sampleSites.d.ts","sourceRoot":"","sources":["../../src/models/sampleSites.js"],"names":[],"mappings":"AAsDA,
|
|
1
|
+
{"version":3,"file":"sampleSites.d.ts","sourceRoot":"","sources":["../../src/models/sampleSites.js"],"names":[],"mappings":"AAsDA,oCAuDE;AAqJF,8BAAqE;AAlOrE,wCAgBE;AAGF,kCAAiF;AA7CjF,4CAAuD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sites.d.ts","sourceRoot":"","sources":["../../src/models/sites.js"],"names":[],"mappings":"AAGA,8BAoCE;AAaF,wBAAmD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleSites.test.d.ts","sourceRoot":"","sources":["../../../src/models/tests/sampleSites.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sites.test.d.ts","sourceRoot":"","sources":["../../../src/models/tests/sites.test.js"],"names":[],"mappings":""}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
monitorAuditSchema,
|
|
20
20
|
MonitorAudit,
|
|
21
21
|
parametersEnum,
|
|
22
|
-
legacyParametersEnum,
|
|
23
22
|
deploymentTypesEnum,
|
|
24
23
|
} from "./models/monitors.js";
|
|
25
24
|
import { organizationsSchema, Organizations } from "./models/organizations.js";
|
|
@@ -58,6 +57,9 @@ import Database from "./config/db.js"; // Import the new Database class
|
|
|
58
57
|
import CustomLogger from "./config/logger.js";
|
|
59
58
|
import { PARAMETERS, HEAVY_METALS } from "./constants/pollutants.js";
|
|
60
59
|
|
|
60
|
+
// Sites related imports
|
|
61
|
+
import { sitesSchema, Sites } from "./models/sites.js";
|
|
62
|
+
|
|
61
63
|
// SampleSites related imports
|
|
62
64
|
import {
|
|
63
65
|
sampleSitesSchema,
|
|
@@ -121,7 +123,6 @@ export {
|
|
|
121
123
|
MonitorAudit,
|
|
122
124
|
monitorAuditSchema,
|
|
123
125
|
parametersEnum,
|
|
124
|
-
legacyParametersEnum,
|
|
125
126
|
deploymentTypesEnum,
|
|
126
127
|
AlertsAudit,
|
|
127
128
|
Alerts,
|
|
@@ -135,6 +136,9 @@ export {
|
|
|
135
136
|
NetworkMetrics,
|
|
136
137
|
rateOfChangeSchema,
|
|
137
138
|
RateOfChange,
|
|
139
|
+
// Sites related exports
|
|
140
|
+
sitesSchema,
|
|
141
|
+
Sites,
|
|
138
142
|
// SampleSites related exports
|
|
139
143
|
sampleSitesSchema,
|
|
140
144
|
SampleSites,
|
package/src/models/monitors.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
2
|
import { PARAMETERS } from "../constants/pollutants.js";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const legacyParametersEnum = ["PM2.5", "Temperature", "Humidity", "OZONE", "WS And Direction"];
|
|
6
|
-
|
|
7
|
-
const parametersEnum = [...Object.keys(PARAMETERS), ...legacyParametersEnum];
|
|
4
|
+
const parametersEnum = [...Object.keys(PARAMETERS)];
|
|
8
5
|
|
|
9
6
|
const deploymentTypesEnum = {
|
|
10
7
|
STATIONARY: "stationary",
|
|
@@ -272,6 +269,10 @@ const monitorsSchema = mongoose.Schema(
|
|
|
272
269
|
enum: Object.values(deploymentTypesEnum),
|
|
273
270
|
default: deploymentTypesEnum.STATIONARY,
|
|
274
271
|
},
|
|
272
|
+
siteId: {
|
|
273
|
+
type: mongoose.Types.ObjectId,
|
|
274
|
+
ref: "Sites",
|
|
275
|
+
},
|
|
275
276
|
// Optional Clarity node ID (1:1 relationship with Node-S sensor)
|
|
276
277
|
nodeId: { type: String },
|
|
277
278
|
// Active alarms from Clarity node (keyed by alarmType)
|
|
@@ -417,4 +418,4 @@ monitorsSchema.pre("updateMany", async function () {
|
|
|
417
418
|
// Create the Monitors model
|
|
418
419
|
const Monitors = mongoose.model("Monitors", monitorsSchema);
|
|
419
420
|
|
|
420
|
-
export { monitorsSchema, Monitors, monitorAuditSchema, MonitorAudit, parametersEnum,
|
|
421
|
+
export { monitorsSchema, Monitors, monitorAuditSchema, MonitorAudit, parametersEnum, deploymentTypesEnum };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
|
|
3
|
+
// Sites Schema
|
|
4
|
+
const sitesSchema = mongoose.Schema(
|
|
5
|
+
{
|
|
6
|
+
name: { type: String },
|
|
7
|
+
sampleSiteId: {
|
|
8
|
+
type: mongoose.Types.ObjectId,
|
|
9
|
+
ref: "SampleSites",
|
|
10
|
+
},
|
|
11
|
+
monitorIds: {
|
|
12
|
+
type: [{ type: mongoose.Types.ObjectId, ref: "Monitors" }],
|
|
13
|
+
default: undefined,
|
|
14
|
+
},
|
|
15
|
+
sponsor: { type: mongoose.Types.ObjectId, ref: "Organizations" },
|
|
16
|
+
location: {
|
|
17
|
+
city: { type: String },
|
|
18
|
+
state: { type: String },
|
|
19
|
+
county: { type: String },
|
|
20
|
+
street: { type: String },
|
|
21
|
+
zip_code: { type: String },
|
|
22
|
+
neighborhood: { type: String },
|
|
23
|
+
gps: {
|
|
24
|
+
type: {
|
|
25
|
+
type: String,
|
|
26
|
+
enum: ["Point"],
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
coordinates: {
|
|
30
|
+
type: [Number],
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
isActive: { type: Boolean, default: true },
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
timestamps: true,
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Geographic queries
|
|
43
|
+
sitesSchema.index({ "location.gps": "2dsphere" });
|
|
44
|
+
|
|
45
|
+
// Sponsor-based queries
|
|
46
|
+
sitesSchema.index({ sponsor: 1, isActive: 1 });
|
|
47
|
+
|
|
48
|
+
// Back-reference lookups
|
|
49
|
+
sitesSchema.index({ sampleSiteId: 1 });
|
|
50
|
+
sitesSchema.index({ monitorIds: 1 });
|
|
51
|
+
|
|
52
|
+
// Create the Sites model
|
|
53
|
+
const Sites = mongoose.model("Sites", sitesSchema);
|
|
54
|
+
|
|
55
|
+
export { sitesSchema, Sites };
|