@skypath-io/web-sdk 0.4.23 → 0.4.24

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.
@@ -152,19 +152,19 @@ export function clampCoordinates({ coordinate }: {
152
152
  * @param {Object} params - The parameters.
153
153
  * @param {Object} params.data - The hexagons data.
154
154
  * @param {Object} params.filters - The filters to apply.
155
- * @param {number} [params.filters.hoursAgo] - The number of hours ago to filter data.
156
- * @param {number} [params.filters.altitudeFrom] - The minimum altitude to filter data.
157
- * @param {number} [params.filters.altitudeTo] - The maximum altitude to filter data.
158
- * @param {number} [params.filters.severity] - The minimum severity to filter data.
155
+ * @param {number} [params.filters.historyHours] - The number of hours ago to filter data.
156
+ * @param {number} [params.filters.minAltitude] - The minimum altitude to filter data.
157
+ * @param {number} [params.filters.maxAltitude] - The maximum altitude to filter data.
158
+ * @param {number} [params.filters.minSeverity] - The minimum severity to filter data.
159
159
  * @returns {Object} The filtered hexagons data.
160
160
  */
161
161
  export function getHexagonsDataSlice({ data, filters }: {
162
162
  data: any;
163
163
  filters: {
164
- hoursAgo?: number;
165
- altitudeFrom?: number;
166
- altitudeTo?: number;
167
- severity?: number;
164
+ historyHours?: number;
165
+ minAltitude?: number;
166
+ maxAltitude?: number;
167
+ minSeverity?: number;
168
168
  };
169
169
  }): any;
170
170
  /**
@@ -173,18 +173,18 @@ export function getHexagonsDataSlice({ data, filters }: {
173
173
  * @param {Object} params - The parameters.
174
174
  * @param {Object} params.data - The hexagons data.
175
175
  * @param {Object} params.filters - The filters to apply.
176
- * @param {number} [params.filters.altitudeFrom] - The minimum altitude to filter data.
177
- * @param {number} [params.filters.altitudeTo] - The maximum altitude to filter data.
178
- * @param {number} [params.filters.severity] - The minimum severity to filter data.
176
+ * @param {number} [params.filters.minAltitude] - The minimum altitude to filter data.
177
+ * @param {number} [params.filters.maxAltitude] - The maximum altitude to filter data.
178
+ * @param {number} [params.filters.minSeverity] - The minimum severity to filter data.
179
179
  * @param {string} [params.filters.polygonSize] - The size of the polygon.
180
180
  * @returns {Object} The filtered hexagon data.
181
181
  */
182
182
  export function getOneLayerHexagonsDataSlice({ data, filters }: {
183
183
  data: any;
184
184
  filters: {
185
- altitudeFrom?: number;
186
- altitudeTo?: number;
187
- severity?: number;
185
+ minAltitude?: number;
186
+ maxAltitude?: number;
187
+ minSeverity?: number;
188
188
  polygonSize?: string;
189
189
  };
190
190
  }): any;
@@ -125,3 +125,13 @@ export function mergeWithoutUndefined({ current, next }: {
125
125
  current: any;
126
126
  next: any;
127
127
  }): any;
128
+ /**
129
+ + * Returns a severity level based on the EDR value.
130
+ + *
131
+ + * @param {Object} params - The parameters.
132
+ + * @param {number} params.edrValue - The EDR value to evaluate.
133
+ + * @returns {number} - The severity level (0-4).
134
+ + */
135
+ export function getSeverityValueByEdrValue({ edrValue }: {
136
+ edrValue: number;
137
+ }): number;
@@ -2,10 +2,8 @@ export class CacheTokenService {
2
2
  constructor({ fetcher }: {
3
3
  fetcher: any;
4
4
  });
5
- getToken: () => Promise<any>;
6
- checkToken: (token: {
7
- expireAt: string;
8
- token: string;
9
- }) => boolean;
5
+ start: () => void;
6
+ stop: () => void;
7
+ getToken: () => any;
10
8
  #private;
11
9
  }
@@ -1,19 +1,20 @@
1
- export const DEFAULT_INTERVAL_TIME_MS: number;
2
- export const DEFAULT_MAP_DISPLAY_RESOLUTION: 5;
3
- export namespace PATHS {
1
+ export namespace NOWCASTING_PATHS {
4
2
  let INFO: string;
5
3
  let DATA: string;
6
4
  }
7
- export namespace INTERNAL_EVENTS {
5
+ export namespace GTG_PATHS {
6
+ let INFO_1: string;
7
+ export { INFO_1 as INFO };
8
8
  let DATA_1: string;
9
9
  export { DATA_1 as DATA };
10
- export let UPDATE_CONFIG: string;
11
- export let UPDATE_INTERVAL: string;
12
- export let LOAD_NOWCASTING_DATA: string;
13
- export let IS_PENDING_CHANGE: string;
14
10
  }
15
- export namespace DEFAULT_FILTER_VALUES {
16
- let FORECAST: number;
17
- let SEVERITY: number;
18
- let ALTITUDE: number;
11
+ export const DEBOUNCE_TIME_SEC: number;
12
+ export const REFRESH_TIME_SEC: number;
13
+ export namespace CONFIG_KEYS {
14
+ let POLYGON: string;
19
15
  }
16
+ export const MAX_ALT: 52;
17
+ export const MIN_ALT: 5;
18
+ export const MAP_RESOLUTION: 5;
19
+ export const FORECAST_RANGE: number[];
20
+ export const SEVERITY_RANGE: number[];
@@ -1,55 +1,21 @@
1
- /**
2
- * Nowcasting Flow is a class that manages the flow of fetching nowcasting data.
3
- *
4
- * @class
5
- * @param {Object} options
6
- * @param {Object} options.cacheTokenService - Cache token service instance
7
- * @param {Object} options.nowcastingService - Nowcasting service instance
8
- * @example
9
- * ```javascript
10
- * const nowcastingFlow = new NowcastingFlow({
11
- * cacheTokenService,
12
- * nowcastingService,
13
- * });
14
- *
15
- * nowcastingFlow.onData(console.log);
16
- *
17
- * nowcastingFlow.start();
18
- * nowcastingFlow.updateConfig({ hexIds });
19
- * nowcastingFlow.stop();
20
- * nowcastingFlow.terminate();
21
- * ```
22
- */
23
1
  export class NowcastingFlow {
24
- constructor({ cacheTokenService, nowcastingService }: {
2
+ constructor({ service, cacheTokenService }: {
3
+ service: any;
25
4
  cacheTokenService: any;
26
- nowcastingService: any;
27
5
  });
28
- /**
29
- * Subscribe to Nowcasting Flow new data
30
- *
31
- * @param {Function} listener - Listener function
32
- */
33
- onData: (listener: Function) => void;
34
- updateConfig: (config?: {}) => void;
35
- onChangeIsPending: (listener: any) => void;
36
- /**
37
- * Start the Nowcasting Flow. Initiates the flow of fetching nowcasting data. Setup listeners and execute the flow.
38
- *
39
- * @param {Object} options
40
- * @param {string[]} [options.hexIds] - Hex IDs for initial nowcasting data fetching
41
- */
42
- start(): void;
43
- /**
44
- * Stop the Nowcasting Flow. Stops the flow of fetching nowcasting data.
45
- * No resources are cleaned up. Just stops updating the data.
46
- */
47
- stop(): void;
48
- /**
49
- * Terminate the Nowcasting Flow. Terminates the flow of fetching nowcasting data.
50
- * Cleans up all the resources and listeners.
51
- */
52
- terminate(): void;
53
- getState: () => string;
6
+ onData: (callback: any) => void;
7
+ onError: (callback: any) => void;
8
+ onIsProcessingChange: (callback: any) => void;
9
+ start: () => void;
10
+ stop: () => void;
11
+ terminate: () => void;
12
+ get isRunning(): any;
13
+ updateConfig: ({ polygon, forecast, maxAltitude, minAltitude, minSeverity, }: {
14
+ polygon: any;
15
+ forecast: any;
16
+ maxAltitude: any;
17
+ minAltitude: any;
18
+ minSeverity: any;
19
+ }) => void;
54
20
  #private;
55
21
  }
@@ -1,13 +1,22 @@
1
1
  export class NowcastingService {
2
- constructor({ fetcher }: {
2
+ constructor({ fetcher, isGtg }: {
3
3
  fetcher: any;
4
+ isGtg?: boolean;
4
5
  });
5
- getInfo(): Promise<any>;
6
- getData({ resolution, hexId, lastUpdatedAt, token }: {
7
- resolution: any;
8
- hexId: any;
9
- lastUpdatedAt: any;
6
+ fetch: ({ config, signal, token }: {
7
+ config: any;
8
+ signal: any;
10
9
  token: any;
11
- }): Promise<any>;
10
+ }) => Promise<void>;
11
+ getData: ({ config, filters }: {
12
+ config: any;
13
+ filters: any;
14
+ }) => {
15
+ toRawObject: () => any;
16
+ toHexagonsArray: () => any[];
17
+ toFeatureCollection: () => any;
18
+ };
19
+ expire: () => void;
20
+ dispose: () => void;
12
21
  #private;
13
22
  }
@@ -1,82 +1,32 @@
1
- export type NowcastingItem = {
2
- /**
3
- * - Altitude level.
4
- */
5
- alt: number;
6
- /**
7
- * - Severity level.
8
- */
9
- sev: number;
10
- /**
11
- * - Forecast accuracy.
12
- */
13
- forecast: number;
14
- /**
15
- * - Array of hexagonal identifiers.
16
- */
17
- hexIds: Array<number>;
1
+ export function validateInput({ polygon, forecast, maxAltitude, minAltitude, minSeverity, }: {
2
+ polygon: any;
3
+ forecast: any;
4
+ maxAltitude: any;
5
+ minAltitude: any;
6
+ minSeverity: any;
7
+ }): void;
8
+ export function mapPolygonToHexIds({ polygon, polygonSize }: {
9
+ polygon: any;
10
+ polygonSize: any;
11
+ }): {
12
+ hexIds: string[];
18
13
  };
19
- export type NowcastingData = Record<string, Array<NowcastingItem>>;
20
- /**
21
- * Filters for slicing nowcasting data.
22
- */
23
- export type FilterCriteria = {
24
- /**
25
- * - Forecast filter.
26
- */
27
- forecast: number;
28
- /**
29
- * - Severity filter.
30
- */
31
- severity: number;
32
- /**
33
- * - Altitude filter.
34
- */
35
- altitude: number;
14
+ export function mapResponseToReportsArray(response: any): any;
15
+ export function buildData(data: any): {
16
+ toRawObject: () => any;
17
+ toHexagonsArray: () => any[];
18
+ toFeatureCollection: () => any;
36
19
  };
37
- /**
38
- * @typedef {Object} NowcastingItem
39
- * @property {number} alt - Altitude level.
40
- * @property {number} sev - Severity level.
41
- * @property {number} forecast - Forecast accuracy.
42
- * @property {Array<number>} hexIds - Array of hexagonal identifiers.
43
- */
44
- /**
45
- * @typedef {Record<string, Array<NowcastingItem>>} NowcastingData
46
- */
47
- /**
48
- * Filters for slicing nowcasting data.
49
- * @typedef {Object} FilterCriteria
50
- * @property {number} forecast - Forecast filter.
51
- * @property {number} severity - Severity filter.
52
- * @property {number} altitude - Altitude filter.
53
- */
54
- /**
55
- * Get a slice of the nowcasting data based on the filters.
56
- *
57
- * @param {Object} props - The props object containing data and filters.
58
- * @param {NowcastingData} props.data - The nowcasting data to slice.
59
- * @param {FilterCriteria} props.filters - The filters to apply.
60
- * @returns {NowcastingData} - The sliced/filtered nowcasting data.
61
- */
62
- export function getNowcastingDataSlice({ data, filters }: {
63
- data: NowcastingData;
64
- filters: FilterCriteria;
65
- }): NowcastingData;
66
- /**
67
- * Prepare the nowcasting data for the map hexagons.
68
- *
69
- * @param {Object} props - The props object containing data and resolution.
70
- * @param {NowcastingData} props.data - The nowcasting data to prepare.
71
- * @param {number} props.resolution - The resolution of the map display.
72
- * @returns {Array<{alt: number, sev: number, forecast: number, hexId: string}>} - Nowcasting data prepared for the map hexagons.
73
- */
20
+ export function filterData({ data, filters }: {
21
+ data: any;
22
+ filters: any;
23
+ }): any;
74
24
  export function prepareNowcastingDataForMapHexagons({ data, resolution, }: {
75
- data: NowcastingData;
76
- resolution: number;
77
- }): Array<{
78
- alt: number;
79
- sev: number;
80
- forecast: number;
81
- hexId: string;
82
- }>;
25
+ data: any;
26
+ resolution?: number;
27
+ }): any[];
28
+ export function getRelevantHexIds({ hexIds, data, currentLastUpdatedAt }: {
29
+ hexIds: any;
30
+ data: any;
31
+ currentLastUpdatedAt: any;
32
+ }): any;
@@ -1,6 +1,8 @@
1
1
  export class OneLayerFlow {
2
- constructor({ fetcher }: {
2
+ constructor({ fetcher, cacheTokenService, nowcastingService }: {
3
3
  fetcher: any;
4
+ cacheTokenService: any;
5
+ nowcastingService: any;
4
6
  });
5
7
  onData: (callback: any) => void;
6
8
  onError: (callback: any) => void;
@@ -6,9 +6,10 @@ export class OneLayerService {
6
6
  config: any;
7
7
  signal: any;
8
8
  }) => Promise<any>;
9
- getData: ({ config, filters }: {
9
+ getData: ({ config, filters, nowcastingData }: {
10
10
  config: any;
11
11
  filters: any;
12
+ nowcastingData: any;
12
13
  }) => {
13
14
  toRawObject: () => any;
14
15
  toHexagonsArray: () => any[];
@@ -30,7 +30,6 @@ export function margeDeltaReports({ oldReports, newReports }: {
30
30
  * @param {Object} params.options - Additional options.
31
31
  * @param {Array} [params.options.childCells] - The child cells.
32
32
  * @param {number} params.options.forecastTs - The forecast timestamp.
33
- * @param {number | null} [params.options.nowcastingAlt] - The nowcasting altitude.
34
33
  * @param {number | null} [params.options.hoursAgo] - The event expiration time in hours.
35
34
  * @returns {Object} The result object.
36
35
  */
@@ -41,7 +40,6 @@ export function storeToResult({ oneLayerStore, nowcastingData, selector, options
41
40
  options: {
42
41
  childCells?: any[];
43
42
  forecastTs: number;
44
- nowcastingAlt?: number | null;
45
43
  hoursAgo?: number | null;
46
44
  };
47
45
  }): any;
@@ -60,11 +58,6 @@ export function getMostRelevantTimeWindowReport({ reports, forecastTs, hoursAgo
60
58
  export function getForecastTs({ forecastTs }: {
61
59
  forecastTs: any;
62
60
  }): any;
63
- export function getNowcastViaForecastTsAndAlt({ nowcasting, forecastTs, nowcastingAlt, }: {
64
- nowcasting: any;
65
- forecastTs: any;
66
- nowcastingAlt: any;
67
- }): any;
68
61
  export function convertNowcastingDataToOnaLayerStructure({ hexId, nowcastItem }: {
69
62
  hexId: any;
70
63
  nowcastItem: any;
@@ -9,7 +9,7 @@ export type SkyPathSDK = {
9
9
  */
10
10
  createNowcastingFlow: () => NowcastingFlow;
11
11
  /**
12
- * - Factory function to create a GTGFlow instance.
12
+ * - Factory function to create a createGtgFlow instance.
13
13
  */
14
14
  createGtgFlow: () => NowcastingFlow;
15
15
  /**
@@ -67,7 +67,7 @@ export type SkyPathSDKOptions = {
67
67
  * The SkyPath SDK object containing factory functions to create different flows.
68
68
  * @typedef {Object} SkyPathSDK
69
69
  * @property {() => NowcastingFlow} createNowcastingFlow - Factory function to create a NowcastingFlow instance.
70
- * @property {() => NowcastingFlow} createGtgFlow - Factory function to create a GTGFlow instance.
70
+ * @property {() => NowcastingFlow} createGtgFlow - Factory function to create a createGtgFlow instance.
71
71
  * @property {() => ObservationsFlow} createObservationsFlow - Factory function to create an ObservationsFlow instance.
72
72
  * @property {() => OneLayerFlow} createOneLayerFlow - Factory function to create an OneLayerFlow instance.
73
73
  * @property {() => ADSBFlow} createAdsbFlow - Factory function to create an ADSBFlow instance.
@@ -111,9 +111,8 @@ export type SkyPathSDKOptions = {
111
111
  *
112
112
  * // Use the factory functions to create different flows.
113
113
  * const nowcastingFlow = skyPathSDK.createNowcastingFlow();
114
- * const gtgFlow = skyPathSDK.createGtgFlow();
115
114
  * const observationsFlow = skyPathSDK.createObservationsFlow();
116
- * const observationsFlow = skyPathSDK.createOneLayerFlow();
115
+ * const OneLayerFlow = skyPathSDK.createOneLayerFlow();
117
116
  * ```
118
117
  */
119
118
  declare function createSkyPathSDK({ apiKey, userId, companyName, authCallback, environment, proxyUrl, applicationId, isMonitoringEnabled, shouldCollectConsoleLogs, shouldCollectErrors, }: SkyPathSDKOptions): Promise<SkyPathSDK>;
@@ -1,9 +1,5 @@
1
1
  import * as CoreUtils from "./core/utils";
2
2
  import * as GeoUtils from "./core/geo";
3
- export namespace Nowcasting {
4
- export { getNowcastingDataSlice };
5
- export { prepareNowcastingDataForMapHexagons };
6
- }
7
3
  export namespace Observations {
8
4
  namespace availableConfigInputs {
9
5
  export { AIRCRAFT_CATEGORY as aircraftCategory };
@@ -14,8 +10,6 @@ export namespace Observations {
14
10
  export { LARGE_POLYGON_HANDLING_BEHAVIOR as largePolygonHandlingBehavior };
15
11
  }
16
12
  }
17
- import { getNowcastingDataSlice } from "./features/nowcasting/utils";
18
- import { prepareNowcastingDataForMapHexagons } from "./features/nowcasting/utils";
19
13
  import { AIRCRAFT_CATEGORY } from "./features/observations/consts.js";
20
14
  import { HISTORY_HOURS } from "./features/observations/consts.js";
21
15
  import { SEVERITY } from "./features/observations/consts.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skypath-io/web-sdk",
3
- "version": "0.4.23",
3
+ "version": "0.4.24",
4
4
  "type": "module",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.es.js",
@@ -1,4 +0,0 @@
1
- export namespace PATHS {
2
- let INFO: string;
3
- let DATA: string;
4
- }
@@ -1 +0,0 @@
1
- export * from "./service";
@@ -1,13 +0,0 @@
1
- export class GtgService {
2
- constructor({ fetcher }: {
3
- fetcher: any;
4
- });
5
- getInfo(): Promise<any>;
6
- getData({ resolution, hexId, lastUpdatedAt, token }: {
7
- resolution: any;
8
- hexId: any;
9
- lastUpdatedAt: any;
10
- token: any;
11
- }): Promise<any>;
12
- #private;
13
- }
@@ -1,3 +0,0 @@
1
- export function getSeverityValueByEdrValue({ edrValue }: {
2
- edrValue: any;
3
- }): 0 | 1 | 2 | 3 | 4;