From 3a436554a3180212b4e5b2667c3e099aec58bad8 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Sat, 7 Mar 2020 07:53:28 -0800 Subject: [PATCH] Add a Typescript declaration file --- dist/aws4fetch.d.ts | 44 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 45 insertions(+) create mode 100644 dist/aws4fetch.d.ts diff --git a/dist/aws4fetch.d.ts b/dist/aws4fetch.d.ts new file mode 100644 index 0000000..53427f9 --- /dev/null +++ b/dist/aws4fetch.d.ts @@ -0,0 +1,44 @@ +export interface AwsClientInit { + accessKeyId?: string; + secretAccessKey?: string; + sessionToken?: string | null; + service?: string | null; + region?: string | null; + cache?: Map | null; + retries?: number | null; + initRetryMs?: number | null; +} + +export interface AwsSignerInit extends AwsClientInit { + url?: string | URL; + method?: string ; + headers?: HeadersInit | null; + body?: BodyInit | null; + datetime?: string | null; + signQuery?: boolean | null; + appendSessionToken?: boolean | null; + allHeaders?: boolean | null; + singleEncode?: boolean | null; +} + +export interface AwsRequestInfo { + method: string; + url: URL; + headers: Headers; + body: BodyInit; +} + +export interface AwsRequestInit extends RequestInit { + aws?: AwsSignerInit | null; +} + +export class AwsSigner { + constructor(init: AwsSignerInit); + public sign(): Promise; +} + +export class AwsClient { + constructor(init: AwsClientInit); + public sign(input: RequestInfo, init?: AwsRequestInit): Promise; + public fetch(input: RequestInfo, init?: AwsRequestInit): Promise; +} diff --git a/package.json b/package.json index 02c6a16..1e1e432 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "dist/aws4fetch.cjs.js", "module": "dist/aws4fetch.esm.js", "browser": "dist/aws4fetch.umd.js", + "types": "dist/aws4fetch.d.ts", "author": "Michael Hart ", "license": "MIT", "devDependencies": {