awslabs / kinesis-aggregation

AWS libraries/modules for working with Kinesis aggregated record data
Apache License 2.0
376 stars 154 forks source link

Question about the type in deaggregate function #118

Closed yunghoy closed 3 years ago

yunghoy commented 3 years ago

Hi,

Our team is currently using this library with Typescript. I'm casting a type of kinesis records since de-agg in this code uses KinesisStreamRecordPayload but it requires Kinesis.Record in the signature. Code

Would you be able to check this signature? Since I cannot find the use cases from entire github and I only found several codes in my company's code repository, I'm not sure about this.

Thanks, Peter

IanMeyers commented 3 years ago

Hi - I can't find any reference to KinesisStreamRecordPayload that you cite. Can you explain a bit further what issue you are seeing?

yunghoy commented 3 years ago

Hi, KinesisStreamRecordPayload is in aws-lambda but KinesisStreamRecordPayload is not that important for this issue.

This is the interface used in index.d.ts

deaggregate(kinesisRecord: Kinesis.Types.Record, ...)

// from 'aws-sdk'
export interface Kinesis.Types.Record {
    SequenceNumber: SequenceNumber;
    ApproximateArrivalTimestamp?: Timestamp;
    Data: Data;
    PartitionKey: PartitionKey;
    EncryptionType?: EncryptionType;
}

And this is the code in kpl-deagg.js

function(kinesisRecord: Record, ...)

export interface Record {
    sequenceNumber: any;
    approximateArrivalTimestamp?: any;
    data: any;
    explicitPartitionKey: any;
}

https://github.com/awslabs/kinesis-aggregation/blob/5f84b8b638394ff8b7ee25e1afee957ccf186eae/node/lib/kpl-deagg.js#L39 https://github.com/awslabs/kinesis-aggregation/blob/5f84b8b638394ff8b7ee25e1afee957ccf186eae/node/lib/kpl-deagg.js#L95 https://github.com/awslabs/kinesis-aggregation/blob/5f84b8b638394ff8b7ee25e1afee957ccf186eae/node/lib/kpl-deagg.js#L106

yunghoy commented 3 years ago

I found that Relevant Ticket is presented.