@justair/justair-library 5.0.0-alpha.56f07df → 5.0.0-alpha.cc5acc0

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 CHANGED
@@ -71,7 +71,7 @@ The following parameters were added to `HEAVY_METALS` and are now included in `s
71
71
  | id | Name |
72
72
  |---|---|
73
73
  | `BE` | Beryllium |
74
- | `COBALT` | Cobalt |
74
+ | `CO` | Cobalt |
75
75
  | `MN` | Manganese |
76
76
  | `SE` | Selenium |
77
77
 
@@ -353,7 +353,7 @@ export namespace PARAMETERS {
353
353
  }
354
354
  }
355
355
  export namespace HEAVY_METALS {
356
- namespace C6H6 {
356
+ export namespace C6H6 {
357
357
  let id_20: string;
358
358
  export { id_20 as id };
359
359
  let label_20: string;
@@ -371,7 +371,7 @@ export namespace HEAVY_METALS {
371
371
  let impacts_20: string;
372
372
  export { impacts_20 as impacts };
373
373
  }
374
- namespace AS {
374
+ export namespace AS {
375
375
  let id_21: string;
376
376
  export { id_21 as id };
377
377
  let label_21: string;
@@ -389,7 +389,7 @@ export namespace HEAVY_METALS {
389
389
  let impacts_21: string;
390
390
  export { impacts_21 as impacts };
391
391
  }
392
- namespace BA {
392
+ export namespace BA {
393
393
  let id_22: string;
394
394
  export { id_22 as id };
395
395
  let label_22: string;
@@ -407,7 +407,7 @@ export namespace HEAVY_METALS {
407
407
  let impacts_22: string;
408
408
  export { impacts_22 as impacts };
409
409
  }
410
- namespace BE {
410
+ export namespace BE {
411
411
  let id_23: string;
412
412
  export { id_23 as id };
413
413
  let label_23: string;
@@ -425,7 +425,7 @@ export namespace HEAVY_METALS {
425
425
  let impacts_23: string;
426
426
  export { impacts_23 as impacts };
427
427
  }
428
- namespace COBALT {
428
+ export namespace CO_1 {
429
429
  let id_24: string;
430
430
  export { id_24 as id };
431
431
  let label_24: string;
@@ -443,7 +443,8 @@ export namespace HEAVY_METALS {
443
443
  let impacts_24: string;
444
444
  export { impacts_24 as impacts };
445
445
  }
446
- namespace NI {
446
+ export { CO_1 as CO };
447
+ export namespace NI {
447
448
  let id_25: string;
448
449
  export { id_25 as id };
449
450
  let label_25: string;
@@ -461,7 +462,7 @@ export namespace HEAVY_METALS {
461
462
  let impacts_25: string;
462
463
  export { impacts_25 as impacts };
463
464
  }
464
- namespace CD {
465
+ export namespace CD {
465
466
  let id_26: string;
466
467
  export { id_26 as id };
467
468
  let label_26: string;
@@ -479,7 +480,7 @@ export namespace HEAVY_METALS {
479
480
  let impacts_26: string;
480
481
  export { impacts_26 as impacts };
481
482
  }
482
- namespace CR {
483
+ export namespace CR {
483
484
  let id_27: string;
484
485
  export { id_27 as id };
485
486
  let label_27: string;
@@ -497,7 +498,7 @@ export namespace HEAVY_METALS {
497
498
  let impacts_27: string;
498
499
  export { impacts_27 as impacts };
499
500
  }
500
- namespace PB {
501
+ export namespace PB {
501
502
  let id_28: string;
502
503
  export { id_28 as id };
503
504
  let label_28: string;
@@ -515,7 +516,7 @@ export namespace HEAVY_METALS {
515
516
  let impacts_28: string;
516
517
  export { impacts_28 as impacts };
517
518
  }
518
- namespace FE {
519
+ export namespace FE {
519
520
  let id_29: string;
520
521
  export { id_29 as id };
521
522
  let label_29: string;
@@ -533,7 +534,7 @@ export namespace HEAVY_METALS {
533
534
  let impacts_29: string;
534
535
  export { impacts_29 as impacts };
535
536
  }
536
- namespace MN {
537
+ export namespace MN {
537
538
  let id_30: string;
538
539
  export { id_30 as id };
539
540
  let label_30: string;
@@ -551,7 +552,7 @@ export namespace HEAVY_METALS {
551
552
  let impacts_30: string;
552
553
  export { impacts_30 as impacts };
553
554
  }
554
- namespace SE {
555
+ export namespace SE {
555
556
  let id_31: string;
556
557
  export { id_31 as id };
557
558
  let label_31: string;
@@ -569,7 +570,7 @@ export namespace HEAVY_METALS {
569
570
  let impacts_31: string;
570
571
  export { impacts_31 as impacts };
571
572
  }
572
- namespace CU {
573
+ export namespace CU {
573
574
  let id_32: string;
574
575
  export { id_32 as id };
575
576
  let label_32: string;
@@ -587,7 +588,7 @@ export namespace HEAVY_METALS {
587
588
  let impacts_32: string;
588
589
  export { impacts_32 as impacts };
589
590
  }
590
- namespace ZN {
591
+ export namespace ZN {
591
592
  let id_33: string;
592
593
  export { id_33 as id };
593
594
  let label_33: string;
@@ -1 +1 @@
1
- {"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"AAgKA,iCA0HE;AA6IF,2BAA4D;AAzS5D,qCA4BE;AAGF,+BAAwE;AAvJxE,sCAA6E;AAF7E,4CAA+F"}
1
+ {"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"AAgKA,iCA0HE;AAuIF,2BAA4D;AAnS5D,qCA4BE;AAGF,+BAAwE;AAvJxE,sCAA6E;AAF7E,4CAA+F"}
@@ -3,7 +3,4 @@ export const SampleSites: any;
3
3
  export const sampleSiteAuditSchema: any;
4
4
  export const SampleSiteAudit: any;
5
5
  export const sampleParametersEnum: string[];
6
- export const sampleParameterReferenceConcentrations: {
7
- [k: string]: any;
8
- };
9
6
  //# sourceMappingURL=sampleSites.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sampleSites.d.ts","sourceRoot":"","sources":["../../src/models/sampleSites.js"],"names":[],"mappings":"AA4DA,oCAmDE;AA2JF,8BAAqE;AApOrE,wCAgBE;AAGF,kCAAiF;AAnDjF,4CAAuD;AAIvD;;EAEE"}
1
+ {"version":3,"file":"sampleSites.d.ts","sourceRoot":"","sources":["../../src/models/sampleSites.js"],"names":[],"mappings":"AAsDA,oCAmDE;AAqJF,8BAAqE;AA9NrE,wCAgBE;AAGF,kCAAiF;AA7CjF,4CAAuD"}
@@ -1 +1 @@
1
- {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/models/samples.js"],"names":[],"mappings":"AAoCA,gCAkBE;AAoIF,0BAAyD;AAzJzD,+BAAwE;AAvBxE,qCAoBE;AAzBF;;EAEE"}
1
+ {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/models/samples.js"],"names":[],"mappings":"AAoCA,gCAkBE;AA6HF,0BAAyD;AAlJzD,+BAAwE;AAvBxE,qCAoBE;AAzBF;;EAEE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justair/justair-library",
3
- "version": "5.0.0-alpha.56f07df",
3
+ "version": "5.0.0-alpha.cc5acc0",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -205,7 +205,6 @@ export const PARAMETERS = {
205
205
 
206
206
  // Parameters analyzed from physical air samples in a laboratory.
207
207
  // These correspond to SampleSites.parameters and are not measured by real-time sensors.
208
- // Note: Cobalt uses the key COBALT (not CO) to avoid collision with PARAMETERS.CO (Carbon Monoxide).
209
208
  export const HEAVY_METALS = {
210
209
  C6H6: {
211
210
  id: "C6H6",
@@ -247,8 +246,8 @@ export const HEAVY_METALS = {
247
246
  origin: "Beryllium occurs naturally in rocks, soil, coal, and oil. It gets into the air through mining and industrial processing, burning coal or fuel oil, and tobacco smoke.",
248
247
  impacts: "Short-term exposure to high levels can cause lung inflammation, coughing, and difficulty breathing. Long-term exposure can cause permanent lung scarring, reduced lung capacity, shortness of breath, and fatigue. It has also been linked to an increased risk of lung cancer.",
249
248
  },
250
- COBALT: {
251
- id: "COBALT",
249
+ CO: {
250
+ id: "CO",
252
251
  label: "Cobalt",
253
252
  name: "Cobalt (Co)",
254
253
  unit: "µg/m³",
@@ -308,7 +308,6 @@ monitorsSchema.index({ deploymentType: 1 });
308
308
  monitorsSchema.pre("findOneAndDelete", async function () {
309
309
  const docToDelete = await this.model.findOne(this.getFilter()).lean();
310
310
  if (docToDelete) {
311
- console.log("Logging findOneAndDelete to monitor audit", docToDelete);
312
311
  const auditLog = new MonitorAudit({
313
312
  monitorId: docToDelete._id,
314
313
  orgId: docToDelete.sponsor,
@@ -335,11 +334,9 @@ monitorsSchema.pre("findOneAndDelete", async function () {
335
334
 
336
335
  // Pre-hook to log multiple document deletions
337
336
  monitorsSchema.pre("deleteMany", async function () {
338
- console.log("deleteMany pre-hook triggered for monitors");
339
337
  const docsToDelete = await this.model.find(this.getFilter()).lean();
340
338
 
341
339
  if (docsToDelete.length) {
342
- console.log(`Logging ${docsToDelete.length} monitor documents to audit`);
343
340
  const auditLogs = docsToDelete.map((doc) => ({
344
341
  monitorId: doc._id,
345
342
  orgId: doc.sponsor,
@@ -364,11 +361,9 @@ monitorsSchema.pre("deleteMany", async function () {
364
361
 
365
362
  // Pre-hook to log a single document deletion (for deleteOne)
366
363
  monitorsSchema.pre("deleteOne", async function () {
367
- console.log("deleteOne pre-hook triggered for monitors");
368
364
  const docToDelete = await this.model.findOne(this.getFilter()).lean();
369
365
 
370
366
  if (docToDelete) {
371
- console.log("Logging deleteOne to monitor audit", docToDelete);
372
367
  const auditLog = new MonitorAudit({
373
368
  monitorId: docToDelete._id,
374
369
  orgId: docToDelete.sponsor,
@@ -397,7 +392,6 @@ monitorsSchema.pre("deleteOne", async function () {
397
392
  monitorsSchema.pre("updateMany", async function () {
398
393
  const docsToUpdate = await this.model.find(this.getFilter()).lean();
399
394
  if (docsToUpdate.length) {
400
- console.log(`Logging ${docsToUpdate.length} monitor documents to audit`);
401
395
  const auditLogs = docsToUpdate.map((doc) => ({
402
396
  monitorId: doc._id,
403
397
  orgId: doc.sponsor,
@@ -6,12 +6,6 @@ const generateSiteCode = customAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 8);
6
6
 
7
7
  const sampleParametersEnum = Object.keys(HEAVY_METALS);
8
8
 
9
- // EPA IRIS chronic inhalation reference concentrations (µg/m³)
10
- // null = no established inhalation RfC
11
- const sampleParameterReferenceConcentrations = Object.fromEntries(
12
- Object.entries(HEAVY_METALS).map(([key, p]) => [key, p.rfc])
13
- );
14
-
15
9
  const noteSchema = mongoose.Schema({
16
10
  note: {
17
11
  type: String,
@@ -139,7 +133,6 @@ sampleSitesSchema.index({ parameters: 1 });
139
133
  sampleSitesSchema.pre("findOneAndDelete", async function () {
140
134
  const docToDelete = await this.model.findOne(this.getFilter()).lean();
141
135
  if (docToDelete) {
142
- console.log("Logging findOneAndDelete to sample site audit", docToDelete);
143
136
  let coordinates = null;
144
137
  if (docToDelete.location && docToDelete.location.gps && Array.isArray(docToDelete.location.gps.coordinates)) {
145
138
  coordinates = docToDelete.location.gps.coordinates;
@@ -165,11 +158,9 @@ sampleSitesSchema.pre("findOneAndDelete", async function () {
165
158
 
166
159
  // Pre-hook to log multiple document deletions
167
160
  sampleSitesSchema.pre("deleteMany", async function () {
168
- console.log("deleteMany pre-hook triggered for sample sites");
169
161
  const docsToDelete = await this.model.find(this.getFilter()).lean();
170
162
 
171
163
  if (docsToDelete.length) {
172
- console.log(`Logging ${docsToDelete.length} sample site documents to audit`);
173
164
  const auditLogs = docsToDelete.map((doc) => {
174
165
  let coordinates = null;
175
166
  if (doc.location && doc.location.gps && Array.isArray(doc.location.gps.coordinates)) {
@@ -201,11 +192,9 @@ sampleSitesSchema.pre("deleteMany", async function () {
201
192
 
202
193
  // Pre-hook to log a single document deletion (for deleteOne)
203
194
  sampleSitesSchema.pre("deleteOne", async function () {
204
- console.log("deleteOne pre-hook triggered for sample sites");
205
195
  const docToDelete = await this.model.findOne(this.getFilter()).lean();
206
196
 
207
197
  if (docToDelete) {
208
- console.log("Logging deleteOne to sample site audit", docToDelete);
209
198
  let coordinates = null;
210
199
  if (docToDelete.location && docToDelete.location.gps && Array.isArray(docToDelete.location.gps.coordinates)) {
211
200
  coordinates = docToDelete.location.gps.coordinates;
@@ -233,7 +222,6 @@ sampleSitesSchema.pre("deleteOne", async function () {
233
222
  sampleSitesSchema.pre("updateMany", async function () {
234
223
  const docsToUpdate = await this.model.find(this.getFilter()).lean();
235
224
  if (docsToUpdate.length) {
236
- console.log(`Logging ${docsToUpdate.length} sample site documents to audit`);
237
225
  const auditLogs = docsToUpdate.map((doc) => {
238
226
  let coordinates = null;
239
227
  if (doc.location && doc.location.gps && Array.isArray(doc.location.gps.coordinates)) {
@@ -266,4 +254,4 @@ sampleSitesSchema.pre("updateMany", async function () {
266
254
  // Create the SampleSites model
267
255
  const SampleSites = mongoose.model("SampleSites", sampleSitesSchema);
268
256
 
269
- export { sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum, sampleParameterReferenceConcentrations };
257
+ export { sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum };
@@ -65,7 +65,6 @@ samplesSchema.index({ siteId: 1, uploadDate: -1 });
65
65
  samplesSchema.pre("findOneAndDelete", async function () {
66
66
  const docToDelete = await this.model.findOne(this.getFilter()).lean();
67
67
  if (docToDelete) {
68
- console.log("Logging findOneAndDelete to audit", docToDelete);
69
68
  const auditLog = new SamplesAudit({
70
69
  siteId: docToDelete.siteId,
71
70
  orgId: docToDelete.orgId,
@@ -87,10 +86,8 @@ samplesSchema.pre("findOneAndDelete", async function () {
87
86
 
88
87
  // Pre-hook to log multiple document deletions
89
88
  samplesSchema.pre("deleteMany", async function () {
90
- console.log("deleteMany pre-hook triggered");
91
89
  const docsToDelete = await this.model.find(this.getFilter()).lean();
92
90
  if (docsToDelete.length) {
93
- console.log(`Logging ${docsToDelete.length} documents to audit`);
94
91
  const auditLogs = docsToDelete.map((doc) => ({
95
92
  siteId: doc.siteId,
96
93
  orgId: doc.orgId,
@@ -112,10 +109,8 @@ samplesSchema.pre("deleteMany", async function () {
112
109
 
113
110
  // Pre-hook to log a single document deletion (for deleteOne)
114
111
  samplesSchema.pre("deleteOne", async function () {
115
- console.log("deleteOne pre-hook triggered");
116
112
  const docToDelete = await this.model.findOne(this.getFilter()).lean();
117
113
  if (docToDelete) {
118
- console.log("Logging deleteOne to audit", docToDelete);
119
114
  const auditLog = new SamplesAudit({
120
115
  siteId: docToDelete.siteId,
121
116
  orgId: docToDelete.orgId,
@@ -139,7 +134,6 @@ samplesSchema.pre("deleteOne", async function () {
139
134
  samplesSchema.pre("findOneAndUpdate", async function () {
140
135
  const docToUpdate = await this.model.findOne(this.getFilter()).lean();
141
136
  if (docToUpdate) {
142
- console.log("Logging findOneAndUpdate to audit", docToUpdate);
143
137
  const auditLog = new SamplesAudit({
144
138
  siteId: docToUpdate.siteId,
145
139
  orgId: docToUpdate.orgId,
@@ -163,7 +157,6 @@ samplesSchema.pre("findOneAndUpdate", async function () {
163
157
  samplesSchema.pre("updateMany", async function () {
164
158
  const docsToUpdate = await this.model.find(this.getFilter()).lean();
165
159
  if (docsToUpdate.length) {
166
- console.log(`Logging ${docsToUpdate.length} documents to audit`);
167
160
  const auditLogs = docsToUpdate.map((doc) => ({
168
161
  siteId: doc.siteId,
169
162
  orgId: doc.orgId,