@tmlmobilidade/go-utils-exec 20260828.1727.14 → 20260829.23.20

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.
@@ -1,14 +1,14 @@
1
- import { type UnixTimestamp } from '@tmlmobilidade/go-types-shared';
1
+ import { type UnixMilliseconds } from '@tmlmobilidade/go-types-shared';
2
2
  export interface PerformInTimeChunksItem {
3
- end: UnixTimestamp;
3
+ end: UnixMilliseconds;
4
4
  index: number;
5
- start: UnixTimestamp;
5
+ start: UnixMilliseconds;
6
6
  total: number;
7
7
  }
8
8
  export interface PerformInTimeChunksOptions {
9
- endDate?: UnixTimestamp;
9
+ endDate?: UnixMilliseconds;
10
10
  intervalHrs: number;
11
11
  onChunk: (chunk: PerformInTimeChunksItem) => Promise<void>;
12
- startDate: UnixTimestamp;
12
+ startDate: UnixMilliseconds;
13
13
  }
14
14
  export declare function performInTimeChunks({ endDate, intervalHrs, onChunk, startDate }: PerformInTimeChunksOptions): Promise<void>;
@@ -9,9 +9,9 @@ export async function performInTimeChunks({ endDate, intervalHrs, onChunk, start
9
9
  // More recent data is more important than older data, so we start syncing the most recent data first.
10
10
  // It makes sense to divide chunks by day, but this should be adjusted according to the volume of data in each chunk.
11
11
  const endDateValue = endDate
12
- ? Dates.fromUnixTimestamp(endDate).unix_timestamp
13
- : Dates.now('utc').minus({ seconds: 30 }).unix_timestamp;
14
- const startDateValue = Dates.fromUnixTimestamp(startDate).unix_timestamp;
12
+ ? Dates.fromUnixMilliseconds(endDate).unix_milliseconds
13
+ : Dates.now('utc').minus({ seconds: 30 }).unix_milliseconds;
14
+ const startDateValue = Dates.fromUnixMilliseconds(startDate).unix_milliseconds;
15
15
  const allTimestampChunks = splitTimeIntervals(startDateValue, endDateValue, intervalHrs);
16
16
  //
17
17
  // Iterate over each timestamp chunk and sync the documents.
@@ -21,12 +21,12 @@ export async function performInTimeChunks({ endDate, intervalHrs, onChunk, start
21
21
  for (const [chunkIndex, chunkData] of allTimestampChunks.entries()) {
22
22
  //
23
23
  const chunkStartDate = Dates
24
- .fromUnixTimestamp(chunkData.start)
24
+ .fromUnixMilliseconds(chunkData.start)
25
25
  .setZone('Europe/Lisbon', 'offset_only');
26
26
  const chunkEndDate = Dates
27
- .fromUnixTimestamp(chunkData.end)
27
+ .fromUnixMilliseconds(chunkData.end)
28
28
  .setZone('Europe/Lisbon', 'offset_only');
29
- await onChunk({ end: chunkEndDate.unix_timestamp, index: chunkIndex, start: chunkStartDate.unix_timestamp, total: allTimestampChunks.length });
29
+ await onChunk({ end: chunkEndDate.unix_milliseconds, index: chunkIndex, start: chunkStartDate.unix_milliseconds, total: allTimestampChunks.length });
30
30
  }
31
31
  //
32
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/go-utils-exec",
3
- "version": "20260828.1727.14",
3
+ "version": "20260829.23.20",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"