@idm-plugin/meteo2 0.5.4 → 0.5.5

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.js CHANGED
@@ -3,9 +3,9 @@ var n0 = (f, M, b) => M in f ? L0(f, M, { enumerable: !0, configurable: !0, writ
3
3
  var H = (f, M, b) => (n0(f, typeof M != "symbol" ? M + "" : M, b), b);
4
4
  import M0 from "@log4js-node/log4js-api";
5
5
  import L from "moment";
6
- import v from "got";
6
+ import k from "got";
7
7
  import { fetchWeatherApi as $ } from "openmeteo";
8
- import { Meteo2Assist as k } from "@idm-plugin/meteo";
8
+ import { Meteo2Assist as v } from "@idm-plugin/meteo";
9
9
  let U;
10
10
  try {
11
11
  U = M0.getLogger("meteo");
@@ -36,7 +36,7 @@ class m0 {
36
36
  timeout: 3e4
37
37
  }, X = L(), R = X.valueOf();
38
38
  A.isBefore(X.subtract(1, "month")) && (U == null || U.warn("[%s] get history meteo on %s: %j", d.requestId, A.format(), q));
39
- const n = "https://aod4idm.idmwx.com/api/ocean/point", o = await v.get(n, q).json(), S = L().valueOf();
39
+ const n = "https://aod4idm.idmwx.com/api/ocean/point", o = await k.get(n, q).json(), S = L().valueOf();
40
40
  if (U == null || U.info("[%s] get meteo(cost: %d ms) from %s with options: %j", d.requestId, S - R, n, q), (o == null ? void 0 : o.code) === 0)
41
41
  return {
42
42
  ...o.data,
@@ -71,7 +71,7 @@ class m0 {
71
71
  timeout: 3e4
72
72
  }, X = L(), R = X.valueOf();
73
73
  A.isBefore(X.subtract(1, "month")) && (U == null || U.warn("[%s] get history factors on %s: %j", d.requestId, A.format(), q));
74
- const n = "https://aod4idm.idmwx.com/api/ocean/factor", o = await v.get(n, q).json(), S = L().valueOf();
74
+ const n = "https://aod4idm.idmwx.com/api/ocean/factor", o = await k.get(n, q).json(), S = L().valueOf();
75
75
  if (U == null || U.info("[%s] get factors(cost: %d ms) from %s with options: %j", d.requestId, S - R, n, q), (o == null ? void 0 : o.code) === 0)
76
76
  return {
77
77
  ...o.data,
@@ -87,7 +87,7 @@ class m0 {
87
87
  const Y = "https://api.windy.com/api/point-forecast/v2", d = [];
88
88
  try {
89
89
  let A = L().valueOf();
90
- const q = await v.post(Y, {
90
+ const q = await k.post(Y, {
91
91
  headers: {
92
92
  "Content-Type": "application/json"
93
93
  },
@@ -118,7 +118,7 @@ class m0 {
118
118
  }).json();
119
119
  let X = L().valueOf();
120
120
  U == null || U.info("[%s] get gfs-factors(cost: %d ms) from %s", O.requestId, X - A, Y), A = X;
121
- const R = await v.post(Y, {
121
+ const R = await k.post(Y, {
122
122
  headers: {
123
123
  "Content-Type": "application/json"
124
124
  },
@@ -1423,9 +1423,11 @@ class C0 {
1423
1423
  H(this, "FORECAST", {
1424
1424
  OM_URL: "https://customer-api.open-meteo.com/v1/forecast",
1425
1425
  ORM_URL: "https://meteo3.idmwx.com/v1/forecast",
1426
+ ORM_HISTORY_URL: "https://meteo1.idmwx.com/v1/forecast",
1426
1427
  OM_HISTORY_URL: "https://customer-historical-forecast-api.open-meteo.com/v1/forecast",
1427
1428
  OM_MARINE_URL: "https://customer-marine-api.open-meteo.com/v1/marine",
1428
1429
  ORM_MARINE_URL: "https://meteo3.idmwx.com/v1/marine",
1430
+ ORM_HISTORY_MARINE_URL: "https://meteo1.idmwx.com/v1/marine",
1429
1431
  WEATHER_VARIABLES: {
1430
1432
  NORMAL: {
1431
1433
  DAILY: "weather_code,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,sunset,precipitation_sum,precipitation_hours,precipitation_probability_max,rain_sum,showers_sum,snowfall_sum,wind_speed_10m_max,wind_gusts_10m_max,wind_direction_10m_dominant",
@@ -1464,13 +1466,13 @@ class C0 {
1464
1466
  this.apikey = M || "smE3JnDLHy3TizVv", this.debug = b;
1465
1467
  }
1466
1468
  async standardWeatherModels() {
1467
- return k.standardWeatherModels();
1469
+ return v.standardWeatherModels();
1468
1470
  }
1469
1471
  async standardMarineModels() {
1470
- return k.standardMarineModels();
1472
+ return v.standardMarineModels();
1471
1473
  }
1472
1474
  async autoPickMeteoModel(M = "best_match") {
1473
- return k.autoPickMeteoModel(M);
1475
+ return v.autoPickMeteoModel(M);
1474
1476
  }
1475
1477
  range(M, b, p) {
1476
1478
  return Array.from({ length: (b - M) / p }, (O, Y) => M + Y * p);
@@ -1651,7 +1653,7 @@ class C0 {
1651
1653
  return b;
1652
1654
  }
1653
1655
  pickForecastUrl(M, b, p, O = {}) {
1654
- return M ? p && !O.noFake ? this.FORECAST.OM_MARINE_URL : b ? O.marineUrl || this.FORECAST.ORM_MARINE_URL : this.FORECAST.OM_MARINE_URL : p && !O.noFake ? this.FORECAST.OM_HISTORY_URL : b ? O.weatherUrl || this.FORECAST.ORM_URL : this.FORECAST.OM_URL;
1656
+ return M ? p && !O.noFake ? O.selfHistory ? this.FORECAST.ORM_HISTORY_MARINE_URL : this.FORECAST.OM_MARINE_URL : b ? O.marineUrl || this.FORECAST.ORM_MARINE_URL : this.FORECAST.OM_MARINE_URL : p && !O.noFake ? O.selfHistory ? this.FORECAST.ORM_HISTORY_URL : this.FORECAST.OM_HISTORY_URL : b ? O.weatherUrl || this.FORECAST.ORM_URL : this.FORECAST.OM_URL;
1655
1657
  }
1656
1658
  pickMarineModels(M) {
1657
1659
  var d;
@@ -1923,9 +1925,9 @@ class C0 {
1923
1925
  }
1924
1926
  })).json();
1925
1927
  if (A.code === 0) {
1926
- const q = A.data, X = k.standardWeatherModels();
1928
+ const q = A.data, X = v.standardWeatherModels();
1927
1929
  for (const R of X) {
1928
- const n = k.autoPickSubCategories(R.alias), S = q.filter((i) => n.includes(i.category)).map((i) => {
1930
+ const n = v.autoPickSubCategories(R.alias), S = q.filter((i) => n.includes(i.category)).map((i) => {
1929
1931
  var l, u, V, E, e, D;
1930
1932
  return {
1931
1933
  category: i.category,