Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

To maintain a high standard of quality in our releases, before merging every pull request we ask that you've completed the following:

- [ ] Forked the repo and created your branch from `master`
- [ ] Forked the repo and created your branch from `main`
- [ ] Made sure tests pass (run `npm it` from the repo root)
- [ ] Expanded test coverage related to your changes:
- [ ] Added and/or updated unit tests (if appropriate)
Expand Down
84 changes: 1 addition & 83 deletions plugins/s3/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -1619,89 +1619,6 @@ Properties:
- Sets request header: `x-amz-expected-bucket-owner`


### `Upload`


Properties:
- **`Bucket` (string) [required]**
- S3 bucket name
- **`Key` (string) [required]**
- S3 key / file name
- **`Body` (buffer, stream, string)**
- String or buffer to be uploaded; per S3, size should be 5MB or greater
- **`File` (string)**
- File path to be read and uploaded from the local filesystem; per S3, size should be 5MB or greater
- **`ChunkSize` (number)**
- Size of each chunk to upload in byes (also aliased to `partSize`); default is 10 MB
- **`Concurrency` (number)**
- Maximum concurrent uploads (also aliased to `queueSize`); default is 5, setting to 1 synchronously, sequentially uploads chunks; memory consumption is (`ChunkSize` + 1) * `Concurrency`
- **`ACL` (string)**
- Sets request header: `x-amz-acl`
- **`BucketKeyEnabled` (string)**
- Sets request header: `x-amz-server-side-encryption-bucket-key-enabled`
- **`CacheControl` (string)**
- Sets request header: `cache-control`
- **`ChecksumAlgorithm` (string)**
- Sets request header: `x-amz-sdk-checksum-algorithm`
- **`ChecksumCRC32` (string)**
- Sets request header: `x-amz-checksum-crc32`
- **`ChecksumCRC32C` (string)**
- Sets request header: `x-amz-checksum-crc32c`
- **`ChecksumSHA1` (string)**
- Sets request header: `x-amz-checksum-sha1`
- **`ChecksumSHA256` (string)**
- Sets request header: `x-amz-checksum-sha256`
- **`ContentDisposition` (string)**
- Sets request header: `content-disposition`
- **`ContentEncoding` (string)**
- Sets request header: `content-encoding`
- **`ContentLanguage` (string)**
- Sets request header: `content-language`
- **`ContentType` (string)**
- Sets request header: `content-type`
- **`ExpectedBucketOwner` (string)**
- Sets request header: `x-amz-expected-bucket-owner`
- **`Expires` (string)**
- Sets request header: `expires`
- **`GrantFullControl` (string)**
- Sets request header: `x-amz-grant-full-control`
- **`GrantRead` (string)**
- Sets request header: `x-amz-grant-read`
- **`GrantReadACP` (string)**
- Sets request header: `x-amz-grant-read-acp`
- **`GrantWriteACP` (string)**
- Sets request header: `x-amz-grant-write-acp`
- **`ObjectLockLegalHoldStatus` (string)**
- Sets request header: `x-amz-object-lock-legal-hold`
- **`ObjectLockMode` (string)**
- Sets request header: `x-amz-object-lock-mode`
- **`ObjectLockRetainUntilDate` (string)**
- Sets request header: `x-amz-object-lock-retain-until-date`
- **`RequestPayer` (string)**
- Sets request header: `x-amz-request-payer`
- **`ServerSideEncryption` (string)**
- Sets request header: `x-amz-server-side-encryption`
- **`SSECustomerAlgorithm` (string)**
- Sets request header: `x-amz-server-side-encryption-customer-algorithm`
- **`SSECustomerKey` (string)**
- Sets request header: `x-amz-server-side-encryption-customer-key`
- **`SSECustomerKeyMD5` (string)**
- Sets request header: `x-amz-server-side-encryption-customer-key-md5`
- **`SSEKMSEncryptionContext` (string)**
- Sets request header: `x-amz-server-side-encryption-context`
- **`SSEKMSKeyId` (string)**
- Sets request header: `x-amz-server-side-encryption-aws-kms-key-id`
- **`StorageClass` (string)**
- Sets request header: `x-amz-storage-class`
- **`Tagging` (string)**
- Sets request header: `x-amz-tagging`
- **`WebsiteRedirectLocation` (string)**
- Sets request header: `x-amz-website-redirect-location`
- **`Metadata` (object)**
- Key / value pairs of object metadata; must conform to S3 metadata guidelines
- [More details (AWS)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html)


### `UploadPart`

[Canonical AWS API doc](https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html)
Expand Down Expand Up @@ -1746,6 +1663,7 @@ Properties:

> Please help out by [opening a PR](https://github.com/aws-lite/aws-lite#authoring-aws-lite-plugins)!

- `Upload`
- [`CreateSession`](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateSession.html)
- [`GetBucketLifecycle`](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycle.html)
- [`GetBucketNotification`](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketNotification.html)
Expand Down
1 change: 1 addition & 0 deletions plugins/s3/src/upload.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const xml = { 'content-type': 'application/xml' }

const Upload = {
awsDoc: false,
disabled: true,
validate: {
Bucket: { type: 'string', required, comment: 'S3 bucket name' },
Key: { type: 'string', required, comment: 'S3 key / file name' },
Expand Down
13 changes: 4 additions & 9 deletions plugins/s3/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ import {
PutObjectTaggingCommandOutput as PutObjectTaggingResponse,
PutPublicAccessBlockCommandOutput as PutPublicAccessBlockResponse,
RestoreObjectCommandOutput as RestoreObjectResponse,
UploadCommandOutput as UploadResponse,
UploadPartCommandOutput as UploadPartResponse,
// $IMPORTS_END
} from "@aws-sdk/client-s3";

import { Readable } from 'node:stream';

declare interface AwsLiteS3 {
/* ! Do not remove METHODS_START / METHODS_END ! */
// $METHODS_START
Expand Down Expand Up @@ -563,7 +564,7 @@ declare interface AwsLiteS3 {
* - AWS docs: {@link https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html S3: PutObject}
* - aws-lite docs: {@link https://github.com/aws-lite/aws-lite/blob/main/plugins/s3/readme.md#PutObject S3: PutObject}
*/
PutObject: (input: { Bucket: string, Key: string, Body?: Buffer | stream | string, File?: string, ApplyChecksum?: boolean, MinChunkSize?: number, ACL?: string, BucketKeyEnabled?: string, CacheControl?: string, ChecksumAlgorithm?: string, ChecksumCRC32?: string, ChecksumCRC32C?: string, ChecksumSHA1?: string, ChecksumSHA256?: string, ContentDisposition?: string, ContentEncoding?: string, ContentLanguage?: string, ContentLength?: string, ContentMD5?: string, ContentType?: string, ExpectedBucketOwner?: string, Expires?: string, GrantFullControl?: string, GrantRead?: string, GrantReadACP?: string, GrantWriteACP?: string, ObjectLockLegalHoldStatus?: string, ObjectLockMode?: string, ObjectLockRetainUntilDate?: string, RequestPayer?: string, ServerSideEncryption?: string, SSECustomerAlgorithm?: string, SSECustomerKey?: string, SSECustomerKeyMD5?: string, SSEKMSEncryptionContext?: string, SSEKMSKeyId?: string, StorageClass?: string, Tagging?: string, WebsiteRedirectLocation?: string, Metadata?: Record<string, any> }) => Promise<PutObjectResponse>
PutObject: (input: { Bucket: string, Key: string, Body?: Buffer | Readable | string, File?: string, ApplyChecksum?: boolean, MinChunkSize?: number, ACL?: string, BucketKeyEnabled?: string, CacheControl?: string, ChecksumAlgorithm?: string, ChecksumCRC32?: string, ChecksumCRC32C?: string, ChecksumSHA1?: string, ChecksumSHA256?: string, ContentDisposition?: string, ContentEncoding?: string, ContentLanguage?: string, ContentLength?: string, ContentMD5?: string, ContentType?: string, ExpectedBucketOwner?: string, Expires?: string, GrantFullControl?: string, GrantRead?: string, GrantReadACP?: string, GrantWriteACP?: string, ObjectLockLegalHoldStatus?: string, ObjectLockMode?: string, ObjectLockRetainUntilDate?: string, RequestPayer?: string, ServerSideEncryption?: string, SSECustomerAlgorithm?: string, SSECustomerKey?: string, SSECustomerKeyMD5?: string, SSEKMSEncryptionContext?: string, SSEKMSKeyId?: string, StorageClass?: string, Tagging?: string, WebsiteRedirectLocation?: string, Metadata?: Record<string, any> }) => Promise<PutObjectResponse>
/**
* @description
* - AWS docs: {@link https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectLegalHold.html S3: PutObjectLegalHold}
Expand Down Expand Up @@ -600,17 +601,12 @@ declare interface AwsLiteS3 {
* - aws-lite docs: {@link https://github.com/aws-lite/aws-lite/blob/main/plugins/s3/readme.md#RestoreObject S3: RestoreObject}
*/
RestoreObject: (input: { Bucket: string, Key: string, RestoreRequest: Record<string, any>, VersionId?: string, RequestPayer?: string, ChecksumAlgorithm?: string, ExpectedBucketOwner?: string }) => Promise<RestoreObjectResponse>
/**
* @description
* - aws-lite docs: {@link https://github.com/aws-lite/aws-lite/blob/main/plugins/s3/readme.md#Upload S3: Upload}
*/
Upload: (input: { Bucket: string, Key: string, Body?: Buffer | stream | string, File?: string, ChunkSize?: number, Concurrency?: number, ACL?: string, BucketKeyEnabled?: string, CacheControl?: string, ChecksumAlgorithm?: string, ChecksumCRC32?: string, ChecksumCRC32C?: string, ChecksumSHA1?: string, ChecksumSHA256?: string, ContentDisposition?: string, ContentEncoding?: string, ContentLanguage?: string, ContentType?: string, ExpectedBucketOwner?: string, Expires?: string, GrantFullControl?: string, GrantRead?: string, GrantReadACP?: string, GrantWriteACP?: string, ObjectLockLegalHoldStatus?: string, ObjectLockMode?: string, ObjectLockRetainUntilDate?: string, RequestPayer?: string, ServerSideEncryption?: string, SSECustomerAlgorithm?: string, SSECustomerKey?: string, SSECustomerKeyMD5?: string, SSEKMSEncryptionContext?: string, SSEKMSKeyId?: string, StorageClass?: string, Tagging?: string, WebsiteRedirectLocation?: string, Metadata?: Record<string, any> }) => Promise<UploadResponse>
/**
* @description
* - AWS docs: {@link https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html S3: UploadPart}
* - aws-lite docs: {@link https://github.com/aws-lite/aws-lite/blob/main/plugins/s3/readme.md#UploadPart S3: UploadPart}
*/
UploadPart: (input: { Bucket: string, Key: string, PartNumber?: number, Body?: Buffer | stream | string, ContentLength?: string, ContentMD5?: string, ChecksumAlgorithm?: string, ChecksumCRC32?: string, ChecksumCRC32C?: string, ChecksumSHA1?: string, ChecksumSHA256?: string, SSECustomerAlgorithm?: string, SSECustomerKey?: string, SSECustomerKeyMD5?: string, RequestPayer?: string, ExpectedBucketOwner?: string }) => Promise<UploadPartResponse>
UploadPart: (input: { Bucket: string, Key: string, PartNumber?: number, Body?: Buffer | Readable | string, ContentLength?: string, ContentMD5?: string, ChecksumAlgorithm?: string, ChecksumCRC32?: string, ChecksumCRC32C?: string, ChecksumSHA1?: string, ChecksumSHA256?: string, SSECustomerAlgorithm?: string, SSECustomerKey?: string, SSECustomerKeyMD5?: string, RequestPayer?: string, ExpectedBucketOwner?: string }) => Promise<UploadPartResponse>
// $METHODS_END
}

Expand Down Expand Up @@ -709,7 +705,6 @@ export type {
PutObjectTaggingResponse,
PutPublicAccessBlockResponse,
RestoreObjectResponse,
UploadResponse,
UploadPartResponse,
// $EXPORT_END
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Credential and general configuration options for [`aws-lite`](https://aws-lite.o
Using [`aws-lite`](https://aws-lite.org/request-response) to make requests and receiving responses


### [Using TypeScript](https://aws-lite.org/using-typeScript)
### [Using TypeScript](https://aws-lite.org/using-typescript)

Guide and examples for using TypeScript with `aws-lite`

Expand Down
1 change: 1 addition & 0 deletions scripts/generate-plugins/_types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function typeFromValidateEntry (value) {
case 'object': return 'Record<string, any>'
case 'array': return 'any[]'
case 'buffer': return 'Buffer'
case 'stream': return 'Readable'
default: return value
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ interface AwsLiteResponse {
statusCode: number;
}

// export to allow <plugin>-types to extend AwsLiteClient
export interface AwsLiteClient {
(payload: AwsLiteRequest): Promise<AwsLiteResponse>;
// Declared as part of the namespace to allow <plugin>-types to extend AwsLiteClient
declare namespace CreateAwsLite { // Match the name of your main export
interface AwsLiteClient {
(payload: AwsLiteRequest): Promise<AwsLiteResponse>;
}
}

interface AwsLiteBaseMock {
Expand All @@ -76,10 +78,8 @@ interface AwsLiteTesting {
reset: () => void;
}

declare module "@aws-lite/client" {
const CreateAwsLite: {
(config?: AwsLiteConfig): Promise<AwsLiteClient>;
testing: AwsLiteTesting;
}
export = CreateAwsLite;
declare const CreateAwsLite: {
(config?: AwsLiteConfig): Promise<CreateAwsLite.AwsLiteClient>;
testing: AwsLiteTesting;
}
export = CreateAwsLite;