This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ba8f7b
commit d55703c
Showing
6 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { $array, $integer, $object, $optional, $ref, $string, $validator } from '@skyleague/therefore' | ||
|
||
export const firehoseRecordMetadata = $object({ | ||
shardId: $string, | ||
partitionKey: $string, | ||
approximateArrivalTimestamp: $integer, | ||
sequenceNumber: $string, | ||
subsequenceNumber: $string, | ||
}) | ||
|
||
export const firehoseTransformationEventRecord = $validator( | ||
$object({ | ||
recordId: $string, | ||
approximateArrivalTimestamp: $integer, | ||
// Base64 encoded | ||
data: $string, | ||
kinesisRecordMetadata: $optional($ref(firehoseRecordMetadata), 'explicit'), | ||
}) | ||
) | ||
|
||
export const firehoseTransformationEvent = $validator( | ||
$object({ | ||
invocationId: $string, | ||
deliveryStreamArn: $string, | ||
sourceKinesisStreamArn: $optional($string, 'explicit'), | ||
region: $string, | ||
records: $array($ref(firehoseTransformationEventRecord)), | ||
}) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { FirehoseTransformationEvent } from './firehose.type' | ||
|
||
import type { FirehoseTransformationEvent as LambdaFirehoseTransformationEvent } from 'aws-lambda' | ||
|
||
test('type is compatible', () => { | ||
const _test: FirehoseTransformationEvent = {} as unknown as LambdaFirehoseTransformationEvent | ||
const _test2: LambdaFirehoseTransformationEvent = {} as unknown as FirehoseTransformationEvent | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* Generated by @skyleague/therefore@v1.0.0-local | ||
* Do not manually touch this | ||
*/ | ||
/* eslint-disable */ | ||
import AjvValidator from 'ajv' | ||
import type { ValidateFunction } from 'ajv' | ||
|
||
export interface FirehoseRecordMetadata { | ||
shardId: string | ||
partitionKey: string | ||
approximateArrivalTimestamp: number | ||
sequenceNumber: string | ||
subsequenceNumber: string | ||
} | ||
|
||
export interface FirehoseTransformationEventRecord { | ||
recordId: string | ||
approximateArrivalTimestamp: number | ||
data: string | ||
kinesisRecordMetadata?: FirehoseRecordMetadata | undefined | ||
} | ||
|
||
export const FirehoseTransformationEventRecord = { | ||
validate: | ||
require('./schemas/firehose-transformation-event-record.schema.js') as ValidateFunction<FirehoseTransformationEventRecord>, | ||
get schema() { | ||
return FirehoseTransformationEventRecord.validate.schema | ||
}, | ||
get errors() { | ||
return FirehoseTransformationEventRecord.validate.errors ?? undefined | ||
}, | ||
is: (o: unknown): o is FirehoseTransformationEventRecord => FirehoseTransformationEventRecord.validate(o) === true, | ||
assert: (o: unknown) => { | ||
if (!FirehoseTransformationEventRecord.validate(o)) { | ||
throw new AjvValidator.ValidationError(FirehoseTransformationEventRecord.errors ?? []) | ||
} | ||
}, | ||
} as const | ||
|
||
export interface FirehoseTransformationEvent { | ||
invocationId: string | ||
deliveryStreamArn: string | ||
sourceKinesisStreamArn?: string | undefined | ||
region: string | ||
records: FirehoseTransformationEventRecord[] | ||
} | ||
|
||
export const FirehoseTransformationEvent = { | ||
validate: require('./schemas/firehose-transformation-event.schema.js') as ValidateFunction<FirehoseTransformationEvent>, | ||
get schema() { | ||
return FirehoseTransformationEvent.validate.schema | ||
}, | ||
get errors() { | ||
return FirehoseTransformationEvent.validate.errors ?? undefined | ||
}, | ||
is: (o: unknown): o is FirehoseTransformationEvent => FirehoseTransformationEvent.validate(o) === true, | ||
assert: (o: unknown) => { | ||
if (!FirehoseTransformationEvent.validate(o)) { | ||
throw new AjvValidator.ValidationError(FirehoseTransformationEvent.errors ?? []) | ||
} | ||
}, | ||
} as const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './firehose.type' |
5 changes: 5 additions & 0 deletions
5
src/lib/aws/firehose/schemas/firehose-transformation-event-record.schema.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.