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.
* chore: upgrade dependencies * feat: add apigateway schemas * feat: add eventbridge schemas * feat: add firehose schemas * feat: add lambda schemas * feat: add kinesis schemas
- Loading branch information
1 parent
1f767c9
commit d7f9039
Showing
6 changed files
with
109 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 @@ | ||
export * from './kinesis.type' |
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 { KinesisStreamEvent } from './kinesis.type' | ||
|
||
import type { KinesisStreamEvent as LambdaKinesisStreamEvent } from 'aws-lambda' | ||
|
||
test('type is compatible', () => { | ||
const _test: KinesisStreamEvent = {} as unknown as LambdaKinesisStreamEvent | ||
const _test2: LambdaKinesisStreamEvent = {} as unknown as KinesisStreamEvent | ||
}) |
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,28 @@ | ||
import { $array, $ref, $string, $validator, $number, $object } from '@skyleague/therefore' | ||
|
||
export const kinesisStreamRecordPayload = $object({ | ||
approximateArrivalTimestamp: $number, | ||
data: $string, | ||
kinesisSchemaVersion: $string, | ||
partitionKey: $string, | ||
sequenceNumber: $string, | ||
}) | ||
|
||
export const kinesisStreamRecord = $validator( | ||
$object({ | ||
awsRegion: $string, | ||
eventID: $string, | ||
eventName: $string, | ||
eventSource: $string, | ||
eventSourceARN: $string, | ||
eventVersion: $string, | ||
invokeIdentityArn: $string, | ||
kinesis: $ref(kinesisStreamRecordPayload), | ||
}) | ||
) | ||
|
||
export const kinesisStreamEvent = $validator( | ||
$object({ | ||
Records: $array($ref(kinesisStreamRecord)), | ||
}) | ||
) |
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,62 @@ | ||
/** | ||
* 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 KinesisStreamRecordPayload { | ||
approximateArrivalTimestamp: number | ||
data: string | ||
kinesisSchemaVersion: string | ||
partitionKey: string | ||
sequenceNumber: string | ||
} | ||
|
||
export interface KinesisStreamRecord { | ||
awsRegion: string | ||
eventID: string | ||
eventName: string | ||
eventSource: string | ||
eventSourceARN: string | ||
eventVersion: string | ||
invokeIdentityArn: string | ||
kinesis: KinesisStreamRecordPayload | ||
} | ||
|
||
export const KinesisStreamRecord = { | ||
validate: require('./schemas/kinesis-stream-record.schema.js') as ValidateFunction<KinesisStreamRecord>, | ||
get schema() { | ||
return KinesisStreamRecord.validate.schema | ||
}, | ||
get errors() { | ||
return KinesisStreamRecord.validate.errors ?? undefined | ||
}, | ||
is: (o: unknown): o is KinesisStreamRecord => KinesisStreamRecord.validate(o) === true, | ||
assert: (o: unknown) => { | ||
if (!KinesisStreamRecord.validate(o)) { | ||
throw new AjvValidator.ValidationError(KinesisStreamRecord.errors ?? []) | ||
} | ||
}, | ||
} as const | ||
|
||
export interface KinesisStreamEvent { | ||
Records: KinesisStreamRecord[] | ||
} | ||
|
||
export const KinesisStreamEvent = { | ||
validate: require('./schemas/kinesis-stream-event.schema.js') as ValidateFunction<KinesisStreamEvent>, | ||
get schema() { | ||
return KinesisStreamEvent.validate.schema | ||
}, | ||
get errors() { | ||
return KinesisStreamEvent.validate.errors ?? undefined | ||
}, | ||
is: (o: unknown): o is KinesisStreamEvent => KinesisStreamEvent.validate(o) === true, | ||
assert: (o: unknown) => { | ||
if (!KinesisStreamEvent.validate(o)) { | ||
throw new AjvValidator.ValidationError(KinesisStreamEvent.errors ?? []) | ||
} | ||
}, | ||
} as const |
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.