@xube/kit-aws-data 0.2.7 → 0.2.8

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,5 +1,5 @@
1
1
  import { Buffer } from "buffer";
2
2
  import { ReadingV1, AggregateMetadataTypes, AggregateMetadataV1 } from "@xube/kit-aws-data-schema";
3
- export declare const decodeAggregateData: (aggregate: AggregateMetadataTypes, data: Buffer, device: string, component: string) => ReadingV1[];
4
- export declare const decodeAggregateDataV1: (aggregate: AggregateMetadataV1, data: Buffer, device: string, component: string) => ReadingV1[];
3
+ export declare const decodeAggregateData: (aggregate: AggregateMetadataTypes, data: Buffer, device: string, component?: string) => ReadingV1[];
4
+ export declare const decodeAggregateDataV1: (aggregate: AggregateMetadataV1, data: Buffer, device: string, component?: string) => ReadingV1[];
5
5
  //# sourceMappingURL=aggregated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregated.d.ts","sourceRoot":"","sources":["../../src/decode/aggregated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAGL,SAAS,EAET,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,mBAAmB,cACnB,sBAAsB,QAC3B,MAAM,UACJ,MAAM,aACH,MAAM,KAChB,SAAS,EAMX,CAAC;AAEF,eAAO,MAAM,qBAAqB,cACrB,mBAAmB,QACxB,MAAM,UACJ,MAAM,aACH,MAAM,KAChB,SAAS,EAoBX,CAAC"}
1
+ {"version":3,"file":"aggregated.d.ts","sourceRoot":"","sources":["../../src/decode/aggregated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAGL,SAAS,EAET,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,mBAAmB,cACnB,sBAAsB,QAC3B,MAAM,UACJ,MAAM,cACF,MAAM,KACjB,SAAS,EAMX,CAAC;AAEF,eAAO,MAAM,qBAAqB,cACrB,mBAAmB,QACxB,MAAM,UACJ,MAAM,cACF,MAAM,KACjB,SAAS,EAsBX,CAAC"}
@@ -20,7 +20,9 @@ const decodeAggregateDataV1 = (aggregate, data, device, component) => {
20
20
  data: readingData.toString("ascii"),
21
21
  id: device,
22
22
  type: kit_aws_data_schema_1.DATA_TYPE,
23
- component,
23
+ ...(component && {
24
+ component,
25
+ }),
24
26
  };
25
27
  });
26
28
  };
@@ -1,4 +1,4 @@
1
1
  import { Buffer } from "buffer";
2
2
  import { ReadingV1 } from "@xube/kit-aws-data-schema";
3
- export declare const parseDeviceData: (payload: Buffer, device: string, component: string) => ReadingV1[];
3
+ export declare const parseDeviceData: (payload: Buffer, device: string, component?: string) => ReadingV1[];
4
4
  //# sourceMappingURL=stage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/ingest/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAA4B,MAAM,2BAA2B,CAAC;AAGhF,eAAO,MAAM,eAAe,YACjB,MAAM,UACP,MAAM,aACH,MAAM,KAChB,SAAS,EAmBX,CAAC"}
1
+ {"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/ingest/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAA4B,MAAM,2BAA2B,CAAC;AAGhF,eAAO,MAAM,eAAe,YACjB,MAAM,UACP,MAAM,cACF,MAAM,KACjB,SAAS,EAmBX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xube/kit-aws-data",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -17,16 +17,16 @@
17
17
  },
18
18
  "homepage": "https://github.com/XubeLtd/dev-kit#readme",
19
19
  "dependencies": {
20
- "@xube/kit-aws": "^0.2.7",
21
- "@xube/kit-aws-data-schema": "^0.2.7",
22
- "@xube/kit-aws-schema": "^0.2.7",
23
- "@xube/kit-generator": "^0.2.7",
24
- "@xube/kit-log": "^0.2.7",
25
- "@xube/kit-schema": "^0.2.7",
20
+ "@xube/kit-aws": "^0.2.8",
21
+ "@xube/kit-aws-data-schema": "^0.2.8",
22
+ "@xube/kit-aws-schema": "^0.2.8",
23
+ "@xube/kit-generator": "^0.2.8",
24
+ "@xube/kit-log": "^0.2.8",
25
+ "@xube/kit-schema": "^0.2.8",
26
26
  "uuid": "^9.0.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/uuid": "^9.0.5",
30
- "@xube/kit-build": "^0.2.7"
30
+ "@xube/kit-build": "^0.2.8"
31
31
  }
32
32
  }
@@ -12,7 +12,7 @@ export const decodeAggregateData = (
12
12
  aggregate: AggregateMetadataTypes,
13
13
  data: Buffer,
14
14
  device: string,
15
- component: string
15
+ component?: string,
16
16
  ): ReadingV1[] => {
17
17
  if (aggregate.v === AggregateMetaDataV1Version) {
18
18
  return decodeAggregateDataV1(aggregate, data, device, component);
@@ -25,7 +25,7 @@ export const decodeAggregateDataV1 = (
25
25
  aggregate: AggregateMetadataV1,
26
26
  data: Buffer,
27
27
  device: string,
28
- component: string
28
+ component?: string,
29
29
  ): ReadingV1[] => {
30
30
  let currentPosition: number = 0;
31
31
  return aggregate.m.map<ReadingV1>(
@@ -34,7 +34,7 @@ export const decodeAggregateDataV1 = (
34
34
 
35
35
  const readingData: Buffer = data.subarray(
36
36
  currentPosition,
37
- currentPosition + length
37
+ currentPosition + length,
38
38
  );
39
39
  currentPosition += length;
40
40
  return {
@@ -42,8 +42,10 @@ export const decodeAggregateDataV1 = (
42
42
  data: readingData.toString("ascii"),
43
43
  id: device,
44
44
  type: DATA_TYPE,
45
- component,
45
+ ...(component && {
46
+ component,
47
+ }),
46
48
  };
47
- }
49
+ },
48
50
  );
49
51
  };
@@ -5,7 +5,7 @@ import { decodeAggregateData } from "../decode/aggregated";
5
5
  export const parseDeviceData = (
6
6
  payload: Buffer,
7
7
  device: string,
8
- component: string
8
+ component?: string,
9
9
  ): ReadingV1[] => {
10
10
  const splitIdx: number = payload.findIndex((value, idx, obj) => {
11
11
  return value === 0x00;