@xube/kit-aws-hooks 0.0.58 → 0.0.59

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/transform.js CHANGED
@@ -13,12 +13,14 @@ const getTimeSeriesDataFromData = (items, log = kit_log_1.XubeLog.getInstance())
13
13
  const previousMicroSecondsSinceEpochById = {};
14
14
  log.info(`Staging data for send based on ${items.length} items.`);
15
15
  log.info(JSON.stringify(items, null, 2));
16
- for (const item of items) {
16
+ const itemsOrderedByMicrosecondsSinceEpoch = items.sort((a, b) => microsecondsSinceEpoch(a.s, a.us ?? 0) -
17
+ microsecondsSinceEpoch(b.s, b.us ?? 0));
18
+ for (const item of itemsOrderedByMicrosecondsSinceEpoch) {
17
19
  if (!(0, kit_data_schema_1.isReadingV1)(item)) {
18
20
  console.log(`${item.type} is not a currently supported type.`);
19
21
  continue;
20
22
  }
21
- const microsSinceEpoch = microsecondsSinceEpoch(item.s, item?.us ?? 0);
23
+ const microsSinceEpoch = microsecondsSinceEpoch(item.s, item.us ?? 0);
22
24
  if (!timeSeriesEntriesById[item.id]) {
23
25
  timeSeriesEntriesById[item.id] = {
24
26
  v: "1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xube/kit-aws-hooks",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -17,15 +17,15 @@
17
17
  },
18
18
  "homepage": "https://github.com/XubeLtd/dev-kit#readme",
19
19
  "devDependencies": {
20
- "@xube/kit-build": "^0.0.58"
20
+ "@xube/kit-build": "^0.0.59"
21
21
  },
22
22
  "dependencies": {
23
- "@xube/kit-aws": "^0.0.58",
24
- "@xube/kit-aws-schema": "^0.0.58",
25
- "@xube/kit-data-schema": "^0.0.58",
26
- "@xube/kit-log": "^0.0.58",
27
- "@xube/kit-request": "^0.0.58",
28
- "@xube/kit-schema": "^0.0.58",
23
+ "@xube/kit-aws": "^0.0.59",
24
+ "@xube/kit-aws-schema": "^0.0.59",
25
+ "@xube/kit-data-schema": "^0.0.59",
26
+ "@xube/kit-log": "^0.0.59",
27
+ "@xube/kit-request": "^0.0.59",
28
+ "@xube/kit-schema": "^0.0.59",
29
29
  "zod": "^3.22.4"
30
30
  }
31
31
  }
package/src/transform.ts CHANGED
@@ -18,13 +18,19 @@ export const getTimeSeriesDataFromData = (
18
18
  log.info(`Staging data for send based on ${items.length} items.`);
19
19
  log.info(JSON.stringify(items, null, 2));
20
20
 
21
- for (const item of items) {
21
+ const itemsOrderedByMicrosecondsSinceEpoch = items.sort(
22
+ (a, b) =>
23
+ microsecondsSinceEpoch(a.s, a.us ?? 0) -
24
+ microsecondsSinceEpoch(b.s, b.us ?? 0)
25
+ );
26
+
27
+ for (const item of itemsOrderedByMicrosecondsSinceEpoch) {
22
28
  if (!isReadingV1(item)) {
23
29
  console.log(`${item.type} is not a currently supported type.`);
24
30
  continue;
25
31
  }
26
32
 
27
- const microsSinceEpoch = microsecondsSinceEpoch(item.s, item?.us ?? 0);
33
+ const microsSinceEpoch = microsecondsSinceEpoch(item.s, item.us ?? 0);
28
34
 
29
35
  if (!timeSeriesEntriesById[item.id]) {
30
36
  timeSeriesEntriesById[item.id] = {