https://project.mdnd-it.cc/work_packages/94
This commit is contained in:
2025-08-23 04:25:28 +02:00
parent 725516ad6c
commit 19cfa031d0
25823 changed files with 1095587 additions and 2801760 deletions
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+66
View File
@@ -0,0 +1,66 @@
# For maintainers only
Development of MinIO JS SDK require nodejs14+ and [npm7+](https://www.npmjs.org/).
## Responsibilities
Go through [Maintainer Responsibility Guide](https://gist.github.com/abperiasamy/f4d9b31d3186bbd26522).
## Setup your minio-js Github Repository
Clone [minio-js](https://github.com/minio/minio-js/) source repository locally.
```sh
$ git clone git@github.com:minio/minio-js
$ cd minio-js
```
### Install deps
```shell
$ npm install
```
### Testing
```shell
$ npm test
```
## Publishing new release
Edit `package.json` version and all other files to the latest version as shown below.
```sh
$ git grep 3.2.0 | cut -f1 -d: | xargs sed s/3.2.0/3.2.1/g -i
$ grep version package.json
"version": "3.2.1",
$ git commit -a -m "Bump to 3.2.1 release"
```
### Publish to NPM
Login to your npm account.
```sh
$ npm login
...
Logged in as minio on https://registry.npmjs.org/.
```
Build for release
```sh
$ npm run build
```
Publish the new release to npm repository.
```
$ npm publish
```
### Tag
Tag and sign your release commit, additionally this step requires you to have access to MinIO's trusted private key.
```
$ export GNUPGHOME=/media/${USER}/minio/trusted
$ git tag -s 3.2.1
$ git push
$ git push --tags
```
### Announce
Announce new release by adding release notes at https://github.com/minio/minio-js/releases from `trusted@minio.io` account. Release notes requires two sections `highlights` and `changelog`. Highlights is a bulleted list of salient features in this release and Changelog contains list of all commits since the last release.
To generate `changelog`
```sh
git log --no-color --pretty=format:'-%d %s (%cr) <%an>' <last_release_tag>..<latest_release_tag>
```
+275
View File
@@ -0,0 +1,275 @@
# MinIO JavaScript Library for Amazon S3 Compatible Cloud Storage [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io)
[![NPM](https://nodei.co/npm/minio.png)](https://nodei.co/npm/minio/)
The MinIO JavaScript Client SDK provides high level APIs to access any Amazon S3 compatible object storage server.
This guide will show you how to install the client SDK and execute an example JavaScript program.
For a complete list of APIs and examples, please take a look at the [JavaScript Client API Reference](https://min.io/docs/minio/linux/developers/javascript/API.html) documentation.
This document presumes you have a working [Node.js](http://nodejs.org/) development environment, LTS versions v16, v18 or v20.
## Download from NPM
```sh
npm install --save minio
```
## Download from Source
```sh
git clone https://github.com/minio/minio-js
cd minio-js
npm install
npm run build
npm install -g
```
## Using with TypeScript
`minio>7.1.0` is shipped with builtin type definition, `@types/minio` is no longer needed.
## Initialize MinIO Client
The following parameters are needed to connect to a MinIO object storage server:
| Parameter | Description |
| :---------- | :--------------------------------------------------------------------------- |
| `endPoint` | Hostname of the object storage service. |
| `port` | TCP/IP port number. Optional, defaults to `80` for HTTP and `443` for HTTPs. |
| `accessKey` | Access key (user ID) of an account in the S3 service. |
| `secretKey` | Secret key (password) of an account in the S3 service. |
| `useSSL` | Optional, set to 'true' to enable secure (HTTPS) access. |
```js
import * as Minio from 'minio'
const minioClient = new Minio.Client({
endPoint: 'play.min.io',
port: 9000,
useSSL: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
})
```
## Quick Start Example - File Uploader
This example connects to an object storage server, creates a bucket, and uploads a file to the bucket.
It uses the MinIO `play` server, a public MinIO cluster located at [https://play.min.io](https://play.min.io).
The `play` server runs the latest stable version of MinIO and may be used for testing and development.
The access credentials shown in this example are open to the public.
All data uploaded to `play` should be considered public and non-protected.
#### file-uploader.mjs
```js
import * as Minio from 'minio'
// Instantiate the MinIO client with the object store service
// endpoint and an authorized user's credentials
// play.min.io is the MinIO public test cluster
const minioClient = new Minio.Client({
endPoint: 'play.min.io',
port: 9000,
useSSL: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
})
// File to upload
const sourceFile = '/tmp/test-file.txt'
// Destination bucket
const bucket = 'js-test-bucket'
// Destination object name
const destinationObject = 'my-test-file.txt'
// Check if the bucket exists
// If it doesn't, create it
const exists = await minioClient.bucketExists(bucket)
if (exists) {
console.log('Bucket ' + bucket + ' exists.')
} else {
await minioClient.makeBucket(bucket, 'us-east-1')
console.log('Bucket ' + bucket + ' created in "us-east-1".')
}
// Set the object metadata
var metaData = {
'Content-Type': 'text/plain',
'X-Amz-Meta-Testing': 1234,
example: 5678,
}
// Upload the file with fPutObject
// If an object with the same name exists,
// it is updated with new data
await minioClient.fPutObject(bucket, destinationObject, sourceFile, metaData)
console.log('File ' + sourceFile + ' uploaded as object ' + destinationObject + ' in bucket ' + bucket)
```
#### Run the File Uploader
```sh
node file-uploader.mjs
Bucket js-test-bucket created successfully in "us-east-1".
File /tmp/test-file.txt uploaded successfully as my-test-file.txt to bucket js-test-bucket
```
Verify the object was created with [`mc`](https://min.io/docs/minio/linux/reference/minio-mc.html):
```
mc ls play/js-test-bucket
[2023-11-10 17:52:20 UTC] 20KiB STANDARD my-test-file.txt
```
## API Reference
The complete API Reference is available here:
- [MinIO JavaScript API Reference](https://min.io/docs/minio/linux/developers/javascript/API.html)
### Bucket Operations
- [`makeBucket`](https://min.io/docs/minio/linux/developers/javascript/API.html#makeBucket)
- [`listBuckets`](https://min.io/docs/minio/linux/developers/javascript/API.html#listBuckets)
- [`bucketExists`](https://min.io/docs/minio/linux/developers/javascript/API.html#bucketExists)
- [`removeBucket`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeBucket)
- [`listObjects`](https://min.io/docs/minio/linux/developers/javascript/API.html#listObjects)
- [`listObjectsV2`](https://min.io/docs/minio/linux/developers/javascript/API.html#listObjectsV2)
- [`listObjectsV2WithMetadata`](https://min.io/docs/minio/linux/developers/javascript/API.html#listObjectsV2WithMetadata) (Extension)
- [`listIncompleteUploads`](https://min.io/docs/minio/linux/developers/javascript/API.html#listIncompleteUploads)
- [`getBucketVersioning`](https://min.io/docs/minio/linux/developers/javascript/API.html#getBucketVersioning)
- [`setBucketVersioning`](https://min.io/docs/minio/linux/developers/javascript/API.html#setBucketVersioning)
- [`setBucketLifecycle`](https://min.io/docs/minio/linux/developers/javascript/API.html#setBucketLifecycle)
- [`getBucketLifecycle`](https://min.io/docs/minio/linux/developers/javascript/API.html#getBucketLifecycle)
- [`removeBucketLifecycle`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeBucketLifecycle)
- [`getObjectLockConfig`](https://min.io/docs/minio/linux/developers/javascript/API.html#getObjectLockConfig)
- [`setObjectLockConfig`](https://min.io/docs/minio/linux/developers/javascript/API.html#setObjectLockConfig)
### File Object Operations
- [`fPutObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#fPutObject)
- [`fGetObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#fGetObject)
### Object Operations
- [`getObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#getObject)
- [`putObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#putObject)
- [`copyObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#copyObject)
- [`statObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#statObject)
- [`removeObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeObject)
- [`removeObjects`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeObjects)
- [`removeIncompleteUpload`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeIncompleteUpload)
- [`selectObjectContent`](https://min.io/docs/minio/linux/developers/javascript/API.html#selectObjectContent)
### Presigned Operations
- [`presignedUrl`](https://min.io/docs/minio/linux/developers/javascript/API.html#presignedUrl)
- [`presignedGetObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#presignedGetObject)
- [`presignedPutObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#presignedPutObject)
- [`presignedPostPolicy`](https://min.io/docs/minio/linux/developers/javascript/API.html#presignedPostPolicy)
### Bucket Notification Operations
- [`getBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#getBucketNotification)
- [`setBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#setBucketNotification)
- [`removeAllBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeAllBucketNotification)
- [`listenBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#listenBucketNotification) (MinIO Extension)
### Bucket Policy Operations
- [`getBucketPolicy`](https://min.io/docs/minio/linux/developers/javascript/API.html#getBucketPolicy)
- [`setBucketPolicy`](https://min.io/docs/minio/linux/developers/javascript/API.html#setBucketPolicy)
## Examples
#### Bucket Operations
- [list-buckets.mjs](https://github.com/minio/minio-js/blob/master/examples/list-buckets.mjs)
- [list-objects.js](https://github.com/minio/minio-js/blob/master/examples/list-objects.js)
- [list-objects-v2.js](https://github.com/minio/minio-js/blob/master/examples/list-objects-v2.js)
- [list-objects-v2-with-metadata.js](https://github.com/minio/minio-js/blob/master/examples/list-objects-v2-with-metadata.js) (Extension)
- [bucket-exists.mjs](https://github.com/minio/minio-js/blob/master/examples/bucket-exists.mjs)
- [make-bucket.mjs](https://github.com/minio/minio-js/blob/master/examples/make-bucket.js)
- [remove-bucket.mjs](https://github.com/minio/minio-js/blob/master/examples/remove-bucket.mjs)
- [list-incomplete-uploads.js](https://github.com/minio/minio-js/blob/master/examples/list-incomplete-uploads.js)
- [get-bucket-versioning.mjs](https://github.com/minio/minio-js/blob/master/examples/get-bucket-versioning.js)
- [set-bucket-versioning.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-versioning.js)
- [set-bucket-tagging.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-tagging.js)
- [get-bucket-versioning.mjs](https://github.com/minio/minio-js/blob/master/examples/get-bucket-versioning.js)
- [set-bucket-versioning.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-versioning.js)
- [set-bucket-tagging.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-tagging.js)
- [get-bucket-tagging.mjs](https://github.com/minio/minio-js/blob/master/examples/get-bucket-tagging.mjs)
- [remove-bucket-tagging.mjs](https://github.com/minio/minio-js/blob/master/examples/remove-bucket-tagging.js)
- [set-bucket-lifecycle.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-lifecycle.mjs)
- [get-bucket-lifecycle.mjs](https://github.com/minio/minio-js/blob/master/examples/get-bucket-lifecycle.mjs)
- [remove-bucket-lifecycle.mjs](https://github.com/minio/minio-js/blob/master/examples/remove-bucket-lifecycle.mjs)
- [get-object-lock-config.mjs](https://github.com/minio/minio-js/blob/master/examples/get-object-lock-config.mjs)
- [set-object-lock-config.mjs](https://github.com/minio/minio-js/blob/master/examples/set-object-lock-config.mjs)
- [set-bucket-replication.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-replication.mjs)
- [get-bucket-replication.mjs](https://github.com/minio/minio-js/blob/master/examples/get-bucket-replication.mjs)
- [remove-bucket-replication.mjs](https://github.com/minio/minio-js/blob/master/examples/remove-bucket-replication.mjs)
- [set-bucket-encryption.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-encryption.mjs)
- [get-bucket-encryption.mjs](https://github.com/minio/minio-js/blob/master/examples/get-bucket-encryption.mjs)
- [remove-bucket-encryption.mjs](https://github.com/minio/minio-js/blob/master/examples/remove-bucket-encryption.mjs)
#### File Object Operations
- [fput-object.mjs](https://github.com/minio/minio-js/blob/master/examples/fput-object.js)
- [fget-object.mjs](https://github.com/minio/minio-js/blob/master/examples/fget-object.mjs)
#### Object Operations
- [put-object.js](https://github.com/minio/minio-js/blob/master/examples/put-object.js)
- [get-object.mjs](https://github.com/minio/minio-js/blob/master/examples/get-object.mjs)
- [copy-object.js](https://github.com/minio/minio-js/blob/master/examples/copy-object.js)
- [get-partialobject.mjs](https://github.com/minio/minio-js/blob/master/examples/get-partialobject.mjs)
- [remove-object.js](https://github.com/minio/minio-js/blob/master/examples/remove-object.js)
- [remove-incomplete-upload.js](https://github.com/minio/minio-js/blob/master/examples/remove-incomplete-upload.js)
- [stat-object.mjs](https://github.com/minio/minio-js/blob/master/examples/stat-object.mjs)
- [get-object-retention.mjs](https://github.com/minio/minio-js/blob/master/examples/get-object-retention.mjs)
- [put-object-retention.mjs](https://github.com/minio/minio-js/blob/master/examples/put-object-retention.mjs)
- [put-object-tagging.mjs](https://github.com/minio/minio-js/blob/master/examples/put-object-tagging.js)
- [get-object-tagging.mjs](https://github.com/minio/minio-js/blob/master/examples/get-object-tagging.mjs)
- [remove-object-tagging.mjs](https://github.com/minio/minio-js/blob/master/examples/remove-object-tagging.js)
- [set-object-legal-hold.mjs](https://github.com/minio/minio-js/blob/master/examples/set-object-legalhold.mjs)
- [get-object-legal-hold.mjs](https://github.com/minio/minio-js/blob/master/examples/get-object-legal-hold.mjs)
- [compose-object.mjs](https://github.com/minio/minio-js/blob/master/examples/compose-object.js)
- [select-object-content.mjs](https://github.com/minio/minio-js/blob/master/examples/select-object-content.mjs)
#### Presigned Operations
- [presigned-getobject.mjs](https://github.com/minio/minio-js/blob/master/examples/presigned-getobject.js)
- [presigned-putobject.mjs](https://github.com/minio/minio-js/blob/master/examples/presigned-putobject.js)
- [presigned-postpolicy.mjs](https://github.com/minio/minio-js/blob/master/examples/presigned-postpolicy.js)
#### Bucket Notification Operations
- [get-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-notification.js)
- [set-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-notification.js)
- [remove-all-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/remove-all-bucket-notification.js)
- [listen-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/minio/listen-bucket-notification.js) (MinIO Extension)
#### Bucket Policy Operations
- [get-bucket-policy.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-policy.js)
- [set-bucket-policy.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-policy.mjs)
## Custom Settings
- [setAccelerateEndPoint](https://github.com/minio/minio-js/blob/master/examples/set-accelerate-end-point.js)
## Explore Further
- [Complete Documentation](https://min.io/docs/minio/kubernetes/upstream/index.html)
- [MinIO JavaScript Client SDK API Reference](https://min.io/docs/minio/linux/developers/javascript/API.html)
## Contribute
- [Contributors Guide](https://github.com/minio/minio-js/blob/master/CONTRIBUTING.md)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/minio/minio-js/nodejs.yml)
+200
View File
@@ -0,0 +1,200 @@
# 适用于Amazon S3兼容云存储的Minio JavaScript Library [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io)
[![NPM](https://nodei.co/npm/minio.png)](https://nodei.co/npm/minio/)
MinIO JavaScript Client SDK提供简单的API来访问任何Amazon S3兼容的对象存储服务。
本快速入门指南将向您展示如何安装客户端SDK并执行示例JavaScript程序。有关API和示例的完整列表,请参阅[JavaScript客户端API参考](https://min.io/docs/minio/linux/developers/javascript/API.html/javascript-client-api-reference)文档。
本文假设你已经安装了[nodejs](http://nodejs.org/) 。
## 使用NPM下载
`minio>7.1.0` 拥有自带的类型定义,不再需要安装 `@types/minio`
## 下载并安装源码
```sh
git clone https://github.com/minio/minio-js
cd minio-js
npm install
npm install -g
```
## 初使化Minio Client
你需要设置5个属性来链接Minio对象存储服务。
| 参数 | 描述 |
| :------- | :------------ |
| endPoint |对象存储服务的URL |
|port| TCP/IP端口号。可选值,如果是使用HTTP的话,默认值是`80`;如果使用HTTPS的话,默认值是`443`。|
| accessKey | Access key是唯一标识你的账户的用户ID。 |
| secretKey | Secret key是你账户的密码。 |
|useSSL |true代表使用HTTPS |
```js
import * as Minio from 'minio'
const minioClient = new Minio.Client({
endPoint: 'play.min.io',
port: 9000,
useSSL: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
});
```
## 示例-文件上传
本示例连接到一个对象存储服务,创建一个存储桶并上传一个文件到存储桶中。
我们在本示例中使用运行在 [https://play.min.io](https://play.min.io) 上的Minio服务,你可以用这个服务来开发和测试。示例中的访问凭据是公开的。
#### file-uploader.js
```js
import * as Minio from 'minio'
// Instantiate the minio client with the endpoint
// and access keys as shown below.
const minioClient = new Minio.Client({
endPoint: 'play.min.io',
port: 9000,
useSSL: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
});
// File that needs to be uploaded.
const file = '/tmp/photos-europe.tar'
// Make a bucket called europetrip.
minioClient.makeBucket('europetrip', 'us-east-1', function(err) {
if (err) return console.log(err)
console.log('Bucket created successfully in "us-east-1".')
const metaData = {
'Content-Type': 'application/octet-stream',
'X-Amz-Meta-Testing': 1234,
'example': 5678
}
// Using fPutObject API upload your file to the bucket europetrip.
minioClient.fPutObject('europetrip', 'photos-europe.tar', file, metaData, function(err, etag) {
if (err) return console.log(err)
console.log('File uploaded successfully.')
});
});
```
#### 运行file-uploader
```sh
node file-uploader.js
Bucket created successfully in "us-east-1".
mc ls play/europetrip/
[2016-05-25 23:49:50 PDT] 17MiB photos-europe.tar
```
## API文档
完整的API文档在这里。
* [完整API文档](https://min.io/docs/minio/linux/developers/javascript/API.html)
### API文档 : 操作存储桶
* [`makeBucket`](https://min.io/docs/minio/linux/developers/javascript/API.html#makeBucket)
* [`listBuckets`](https://min.io/docs/minio/linux/developers/javascript/API.html#listBuckets)
* [`bucketExists`](https://min.io/docs/minio/linux/developers/javascript/API.html#bucketExists)
* [`removeBucket`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeBucket)
* [`listObjects`](https://min.io/docs/minio/linux/developers/javascript/API.html#listObjects)
* [`listObjectsV2`](https://min.io/docs/minio/linux/developers/javascript/API.html#listObjectsV2)
* [`listIncompleteUploads`](https://min.io/docs/minio/linux/developers/javascript/API.html#listIncompleteUploads)
### API文档 : 操作文件对象
* [`fPutObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#fPutObject)
* [`fGetObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#fGetObject)
### API文档 : 操作对象
* [`getObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#getObject)
* [`putObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#putObject)
* [`copyObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#copyObject)
* [`statObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#statObject)
* [`removeObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeObject)
* [`removeIncompleteUpload`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeIncompleteUpload)
### API文档 : Presigned操作
* [`presignedGetObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#presignedGetObject)
* [`presignedPutObject`](https://min.io/docs/minio/linux/developers/javascript/API.html#presignedPutObject)
* [`presignedPostPolicy`](https://min.io/docs/minio/linux/developers/javascript/API.html#presignedPostPolicy)
### API文档 : 存储桶通知
* [`getBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#getBucketNotification)
* [`setBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#setBucketNotification)
* [`removeAllBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#removeAllBucketNotification)
* [`listenBucketNotification`](https://min.io/docs/minio/linux/developers/javascript/API.html#listenBucketNotification) (MinIO Extension)
### API文档 : 存储桶策略
* [`getBucketPolicy`](https://min.io/docs/minio/linux/developers/javascript/API.html#getBucketPolicy)
* [`setBucketPolicy`](https://min.io/docs/minio/linux/developers/javascript/API.html#setBucketPolicy)
## 完整示例
#### 完整示例 : 操作存储桶
* [list-buckets.js](https://github.com/minio/minio-js/blob/master/examples/list-buckets.js)
* [list-objects.js](https://github.com/minio/minio-js/blob/master/examples/list-objects.js)
* [list-objects-v2.js](https://github.com/minio/minio-js/blob/master/examples/list-objects-v2.js)
* [bucket-exists.mjs](https://github.com/minio/minio-js/blob/master/examples/bucket-exists.mjs)
* [make-bucket.mjs](https://github.com/minio/minio-js/blob/master/examples/make-bucket.js)
* [remove-bucket.mjs](https://github.com/minio/minio-js/blob/master/examples/remove-bucket.mjs)
* [list-incomplete-uploads.js](https://github.com/minio/minio-js/blob/master/examples/list-incomplete-uploads.js)
#### 完整示例 : 操作文件对象
* [fput-object.mjs](https://github.com/minio/minio-js/blob/master/examples/fput-object.js)
* [fget-object.mjs](https://github.com/minio/minio-js/blob/master/examples/fget-object.mjs)
#### 完整示例 : 操作对象
* [put-object.js](https://github.com/minio/minio-js/blob/master/examples/put-object.js)
* [get-object.mjs](https://github.com/minio/minio-js/blob/master/examples/get-object.mjs)
* [copy-object.js](https://github.com/minio/minio-js/blob/master/examples/copy-object.js)
* [get-partialobject.mjs](https://github.com/minio/minio-js/blob/master/examples/get-partialobject.mjs)
* [remove-object.js](https://github.com/minio/minio-js/blob/master/examples/remove-object.js)
* [remove-incomplete-upload.js](https://github.com/minio/minio-js/blob/master/examples/remove-incomplete-upload.js)
* [stat-object.mjs](https://github.com/minio/minio-js/blob/master/examples/stat-object.mjs)
#### 完整示例 : Presigned操作
* [presigned-getobject.mjs](https://github.com/minio/minio-js/blob/master/examples/presigned-getobject.js)
* [presigned-putobject.mjs](https://github.com/minio/minio-js/blob/master/examples/presigned-putobject.js)
* [presigned-postpolicy.mjs](https://github.com/minio/minio-js/blob/master/examples/presigned-postpolicy.js)
#### 完整示例 : 存储桶通知
* [get-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-notification.js)
* [set-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-notification.js)
* [remove-all-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/remove-all-bucket-notification.js)
* [listen-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/minio/listen-bucket-notification.js) (MinIO Extension)
#### 完整示例 : 存储桶策略
* [get-bucket-policy.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-policy.js)
* [set-bucket-policy.mjs](https://github.com/minio/minio-js/blob/master/examples/set-bucket-policy.mjs)
## 了解更多
* [完整文档]([https://docs.min.i](https://min.io/docs/minio/kubernetes/upstream/index.html)o)
* [MinIO JavaScript Client SDK API文档](https://min.io/docs/minio/linux/developers/javascript/API.html)
* [创建属于你的购物APP-完整示例](https://github.com/minio/minio-js-store-app)
## 贡献
[贡献者指南](https://github.com/minio/minio-js/blob/master/CONTRIBUTING.md)
[![Build Status](https://travis-ci.org/minio/minio-js.svg)](https://travis-ci.org/minio/minio-js)
[![Build status](https://ci.appveyor.com/api/projects/status/1d05e6nvxcelmrak?svg=true)](https://ci.appveyor.com/project/harshavardhana/minio-js)
@@ -0,0 +1,86 @@
/// <reference types="node" />
import * as http from 'node:http';
import { CredentialProvider } from "./CredentialProvider.mjs";
import { Credentials } from "./Credentials.mjs";
/**
* @see https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
*/
type CredentialResponse = {
ErrorResponse?: {
Error?: {
Code?: string;
Message?: string;
};
};
AssumeRoleResponse: {
AssumeRoleResult: {
Credentials: {
AccessKeyId: string;
SecretAccessKey: string;
SessionToken: string;
Expiration: string;
};
};
};
};
export interface AssumeRoleProviderOptions {
stsEndpoint: string;
accessKey: string;
secretKey: string;
durationSeconds?: number;
sessionToken?: string;
policy?: string;
region?: string;
roleArn?: string;
roleSessionName?: string;
externalId?: string;
token?: string;
webIdentityToken?: string;
action?: string;
transportAgent?: http.Agent;
}
export declare class AssumeRoleProvider extends CredentialProvider {
private readonly stsEndpoint;
private readonly accessKey;
private readonly secretKey;
private readonly durationSeconds;
private readonly policy?;
private readonly region;
private readonly roleArn?;
private readonly roleSessionName?;
private readonly externalId?;
private readonly token?;
private readonly webIdentityToken?;
private readonly action;
private _credentials;
private readonly expirySeconds;
private accessExpiresAt;
private readonly transportAgent?;
private readonly transport;
constructor({
stsEndpoint,
accessKey,
secretKey,
durationSeconds,
sessionToken,
policy,
region,
roleArn,
roleSessionName,
externalId,
token,
webIdentityToken,
action,
transportAgent
}: AssumeRoleProviderOptions);
getRequestConfig(): {
requestOptions: http.RequestOptions;
requestData: string;
};
performRequest(): Promise<CredentialResponse>;
parseCredentials(respObj: CredentialResponse): Credentials;
refreshCredentials(): Promise<Credentials>;
getCredentials(): Promise<Credentials>;
isAboutToExpire(): boolean;
}
export default AssumeRoleProvider;
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
import { Credentials } from "./Credentials.mjs";
export declare class CredentialProvider {
private credentials;
constructor({
accessKey,
secretKey,
sessionToken
}: {
accessKey: string;
secretKey: string;
sessionToken?: string;
});
getCredentials(): Promise<Credentials>;
setCredentials(credentials: Credentials): void;
setAccessKey(accessKey: string): void;
getAccessKey(): string;
setSecretKey(secretKey: string): void;
getSecretKey(): string;
setSessionToken(sessionToken: string): void;
getSessionToken(): string | undefined;
}
export default CredentialProvider;
+48
View File
@@ -0,0 +1,48 @@
import { Credentials } from "./Credentials.mjs";
export class CredentialProvider {
constructor({
accessKey,
secretKey,
sessionToken
}) {
this.credentials = new Credentials({
accessKey,
secretKey,
sessionToken
});
}
async getCredentials() {
return this.credentials.get();
}
setCredentials(credentials) {
if (credentials instanceof Credentials) {
this.credentials = credentials;
} else {
throw new Error('Unable to set Credentials. it should be an instance of Credentials class');
}
}
setAccessKey(accessKey) {
this.credentials.setAccessKey(accessKey);
}
getAccessKey() {
return this.credentials.getAccessKey();
}
setSecretKey(secretKey) {
this.credentials.setSecretKey(secretKey);
}
getSecretKey() {
return this.credentials.getSecretKey();
}
setSessionToken(sessionToken) {
this.credentials.setSessionToken(sessionToken);
}
getSessionToken() {
return this.credentials.getSessionToken();
}
}
// deprecated default export, please use named exports.
// keep for backward compatibility.
// eslint-disable-next-line import/no-default-export
export default CredentialProvider;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozL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0FBQ1QsU0FBUyxDQUFDO0VBQzFDO0VBRUFVLFlBQVlBLENBQUEsRUFBRztJQUNiLE9BQU8sSUFBSSxDQUFDUixXQUFXLENBQUNRLFlBQVksQ0FBQyxDQUFDO0VBQ3hDO0VBRUFDLGVBQWVBLENBQUNWLFlBQW9CLEVBQUU7SUFDcEMsSUFBSSxDQUFDQyxXQUFXLENBQUNTLGVBQWUsQ0FBQ1YsWUFBWSxDQUFDO0VBQ2hEO0VBRUFXLGVBQWVBLENBQUEsRUFBRztJQUNoQixPQUFPLElBQUksQ0FBQ1YsV0FBVyxDQUFDVSxlQUFlLENBQUMsQ0FBQztFQUMzQztBQUNGOztBQUVBO0FBQ0E7QUFDQTtBQUNBLGVBQWVmLGtCQUFrQiJ9
+22
View File
@@ -0,0 +1,22 @@
export declare class Credentials {
accessKey: string;
secretKey: string;
sessionToken?: string;
constructor({
accessKey,
secretKey,
sessionToken
}: {
accessKey: string;
secretKey: string;
sessionToken?: string;
});
setAccessKey(accessKey: string): void;
getAccessKey(): string;
setSecretKey(secretKey: string): void;
getSecretKey(): string;
setSessionToken(sessionToken: string): void;
getSessionToken(): string | undefined;
get(): Credentials;
}
export default Credentials;
+38
View File
@@ -0,0 +1,38 @@
export class Credentials {
constructor({
accessKey,
secretKey,
sessionToken
}) {
this.accessKey = accessKey;
this.secretKey = secretKey;
this.sessionToken = sessionToken;
}
setAccessKey(accessKey) {
this.accessKey = accessKey;
}
getAccessKey() {
return this.accessKey;
}
setSecretKey(secretKey) {
this.secretKey = secretKey;
}
getSecretKey() {
return this.secretKey;
}
setSessionToken(sessionToken) {
this.sessionToken = sessionToken;
}
getSessionToken() {
return this.sessionToken;
}
get() {
return this;
}
}
// deprecated default export, please use named exports.
// keep for backward compatibility.
// eslint-disable-next-line import/no-default-export
export default Credentials;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDcmVkZW50aWFscyIsImNvbnN0cnVjdG9yIiwi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DQUFBLEVBQUc7SUFDYixPQUFPLElBQUksQ0FBQ0wsU0FBUztFQUN2QjtFQUVBTSxlQUFlQSxDQUFDTCxZQUFvQixFQUFFO0lBQ3BDLElBQUksQ0FBQ0EsWUFBWSxHQUFHQSxZQUFZO0VBQ2xDO0VBRUFNLGVBQWVBLENBQUEsRUFBRztJQUNoQixPQUFPLElBQUksQ0FBQ04sWUFBWTtFQUMxQjtFQUVBTyxHQUFHQSxDQUFBLEVBQWdCO0lBQ2pCLE9BQU8sSUFBSTtFQUNiO0FBQ0Y7O0FBRUE7QUFDQTtBQUNBO0FBQ0EsZUFBZVgsV0FBVyJ9
+27
View File
@@ -0,0 +1,27 @@
/// <reference types="node" />
import * as http from 'node:http';
import { CredentialProvider } from "./CredentialProvider.mjs";
import { Credentials } from "./Credentials.mjs";
export interface IamAwsProviderOptions {
customEndpoint?: string;
transportAgent?: http.Agent;
}
export declare class IamAwsProvider extends CredentialProvider {
private readonly customEndpoint?;
private _credentials;
private readonly transportAgent?;
private accessExpiresAt;
constructor({
customEndpoint,
transportAgent
}: IamAwsProviderOptions);
getCredentials(): Promise<Credentials>;
private fetchCredentials;
private fetchCredentialsUsingTokenFile;
private fetchImdsToken;
private getIamRoleNamedUrl;
private getIamRoleName;
private requestCredentials;
private isAboutToExpire;
}
export default IamAwsProvider;
File diff suppressed because one or more lines are too long
+82
View File
@@ -0,0 +1,82 @@
/// <reference lib="es2022.error" />
declare class ExtendableError extends Error {
constructor(message?: string, opt?: ErrorOptions);
}
/**
* AnonymousRequestError is generated for anonymous keys on specific
* APIs. NOTE: PresignedURL generation always requires access keys.
*/
export declare class AnonymousRequestError extends ExtendableError {}
/**
* InvalidArgumentError is generated for all invalid arguments.
*/
export declare class InvalidArgumentError extends ExtendableError {}
/**
* InvalidPortError is generated when a non integer value is provided
* for ports.
*/
export declare class InvalidPortError extends ExtendableError {}
/**
* InvalidEndpointError is generated when an invalid end point value is
* provided which does not follow domain standards.
*/
export declare class InvalidEndpointError extends ExtendableError {}
/**
* InvalidBucketNameError is generated when an invalid bucket name is
* provided which does not follow AWS S3 specifications.
* http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
*/
export declare class InvalidBucketNameError extends ExtendableError {}
/**
* InvalidObjectNameError is generated when an invalid object name is
* provided which does not follow AWS S3 specifications.
* http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
*/
export declare class InvalidObjectNameError extends ExtendableError {}
/**
* AccessKeyRequiredError generated by signature methods when access
* key is not found.
*/
export declare class AccessKeyRequiredError extends ExtendableError {}
/**
* SecretKeyRequiredError generated by signature methods when secret
* key is not found.
*/
export declare class SecretKeyRequiredError extends ExtendableError {}
/**
* ExpiresParamError generated when expires parameter value is not
* well within stipulated limits.
*/
export declare class ExpiresParamError extends ExtendableError {}
/**
* InvalidDateError generated when invalid date is found.
*/
export declare class InvalidDateError extends ExtendableError {}
/**
* InvalidPrefixError generated when object prefix provided is invalid
* or does not conform to AWS S3 object key restrictions.
*/
export declare class InvalidPrefixError extends ExtendableError {}
/**
* InvalidBucketPolicyError generated when the given bucket policy is invalid.
*/
export declare class InvalidBucketPolicyError extends ExtendableError {}
/**
* IncorrectSizeError generated when total data read mismatches with
* the input size.
*/
export declare class IncorrectSizeError extends ExtendableError {}
/**
* InvalidXMLError generated when an unknown XML is found.
*/
export declare class InvalidXMLError extends ExtendableError {}
/**
* S3Error is generated for errors returned from S3 server.
* see getErrorTransformer for details
*/
export declare class S3Error extends ExtendableError {
code?: string;
region?: string;
}
export declare class IsValidBucketNameError extends ExtendableError {}
export {};
File diff suppressed because one or more lines are too long
+156
View File
@@ -0,0 +1,156 @@
import type { Encryption, ObjectMetaData, RequestHeaders } from "./internal/type.mjs";
import { RETENTION_MODES } from "./internal/type.mjs";
export { ENCRYPTION_TYPES, LEGAL_HOLD_STATUS, RETENTION_MODES, RETENTION_VALIDITY_UNITS } from "./internal/type.mjs";
export declare const DEFAULT_REGION = "us-east-1";
export declare const PRESIGN_EXPIRY_DAYS_MAX: number;
export interface ICopySourceOptions {
Bucket: string;
Object: string;
/**
* Valid versionId
*/
VersionID?: string;
/**
* Etag to match
*/
MatchETag?: string;
/**
* Etag to exclude
*/
NoMatchETag?: string;
/**
* Modified Date of the object/part. UTC Date in string format
*/
MatchModifiedSince?: string | null;
/**
* Modified Date of the object/part to exclude UTC Date in string format
*/
MatchUnmodifiedSince?: string | null;
/**
* true or false Object range to match
*/
MatchRange?: boolean;
Start?: number;
End?: number;
Encryption?: Encryption;
}
export declare class CopySourceOptions {
readonly Bucket: string;
readonly Object: string;
readonly VersionID: string;
MatchETag: string;
private readonly NoMatchETag;
private readonly MatchModifiedSince;
private readonly MatchUnmodifiedSince;
readonly MatchRange: boolean;
readonly Start: number;
readonly End: number;
private readonly Encryption?;
constructor({
Bucket,
Object,
VersionID,
MatchETag,
NoMatchETag,
MatchModifiedSince,
MatchUnmodifiedSince,
MatchRange,
Start,
End,
Encryption
}: ICopySourceOptions);
validate(): boolean;
getHeaders(): RequestHeaders;
}
/**
* @deprecated use nodejs fs module
*/
export declare function removeDirAndFiles(dirPath: string, removeSelf?: boolean): void;
export interface ICopyDestinationOptions {
/**
* Bucket name
*/
Bucket: string;
/**
* Object Name for the destination (composed/copied) object defaults
*/
Object: string;
/**
* Encryption configuration defaults to {}
* @default {}
*/
Encryption?: Encryption;
UserMetadata?: ObjectMetaData;
/**
* query-string encoded string or Record<string, string> Object
*/
UserTags?: Record<string, string> | string;
LegalHold?: 'on' | 'off';
/**
* UTC Date String
*/
RetainUntilDate?: string;
Mode?: RETENTION_MODES;
MetadataDirective?: 'COPY' | 'REPLACE';
/**
* Extra headers for the target object
*/
Headers?: Record<string, string>;
}
export declare class CopyDestinationOptions {
readonly Bucket: string;
readonly Object: string;
private readonly Encryption?;
private readonly UserMetadata?;
private readonly UserTags?;
private readonly LegalHold?;
private readonly RetainUntilDate?;
private readonly Mode?;
private readonly MetadataDirective?;
private readonly Headers?;
constructor({
Bucket,
Object,
Encryption,
UserMetadata,
UserTags,
LegalHold,
RetainUntilDate,
Mode,
MetadataDirective,
Headers
}: ICopyDestinationOptions);
getHeaders(): RequestHeaders;
validate(): boolean;
}
/**
* maybe this should be a generic type for Records, leave it for later refactor
*/
export declare class SelectResults {
private records?;
private response?;
private stats?;
private progress?;
constructor({
records,
// parsed data as stream
response,
// original response stream
stats,
// stats as xml
progress
}: {
records?: unknown;
response?: unknown;
stats?: string;
progress?: unknown;
});
setStats(stats: string): void;
getStats(): string | undefined;
setProgress(progress: unknown): void;
getProgress(): unknown;
setResponse(response: unknown): void;
getResponse(): unknown;
setRecords(records: unknown): void;
getRecords(): unknown;
}
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
/// <reference types="node" />
/// <reference types="node" />
import * as fs from 'node:fs';
import * as stream from 'node:stream';
export { promises as fsp } from 'node:fs';
export declare const streamPromise: {
pipeline: typeof stream.pipeline.__promisify__;
};
export declare const fstat: typeof fs.fstat.__promisify__;
+14
View File
@@ -0,0 +1,14 @@
// promise helper for stdlib
import * as fs from "fs";
import * as stream from "stream";
import { promisify } from "util";
// TODO: use "node:fs/promise" directly after we stop testing on nodejs 12
export { promises as fsp } from 'node:fs';
export const streamPromise = {
// node:stream/promises Added in: v15.0.0
pipeline: promisify(stream.pipeline)
};
export const fstat = promisify(fs.fstat);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJmcyIsInN0cmVhbSIsInByb21pc2lmeSIsInByb21pc2VzIiwiZnNwIiwic3RyZWFtUHJvbWlzZSIsInBpcGVsaW5lIiwiZnN0YXQiXSwic291cmNlcyI6WyJhc3luYy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBwcm9taXNlIGhlbHBlciBmb3Igc3RkbGliXG5cbmltcG9ydCAqIGFzIGZzIGZyb20gJ25vZGU6ZnMnXG5pbXBvcnQgKiBhcyBzdHJlYW0gZnJvbSAnbm9kZTpzdHJlYW0nXG5pbXBvcnQgeyBwcm9taXNpZnkgfSBmcm9tICdub2RlOnV0aWwnXG5cbi8vIFRPRE86IHVzZSBcIm5vZGU6ZnMvcHJvbWlzZVwiIGRpcmVjdGx5IGFmdGVyIHdlIHN0b3AgdGVzdGluZyBvbiBub2RlanMgMTJcbmV4cG9ydCB7IHByb21pc2VzIGFzIGZzcCB9IGZyb20gJ25vZGU6ZnMnXG5leHBvcnQgY29uc3Qgc3RyZWFtUHJvbWlzZSA9IHtcbiAgLy8gbm9kZTpzdHJlYW0vcHJvbWlzZXMgQWRkZWQgaW46IHYxNS4wLjBcbiAgcGlwZWxpbmU6IHByb21pc2lmeShzdHJlYW0ucGlwZWxpbmUpLFxufVxuXG5leHBvcnQgY29uc3QgZnN0YXQgPSBwcm9taXNpZnkoZnMuZnN0YXQpXG4iXSwibWFwcGluZ3MiOiJBQUFBOztBQUVBLE9BQU8sS0FBS0EsRUFBRTtBQUNkLE9BQU8sS0FBS0MsTUFBTTtBQUNsQixTQUFTQyxTQUFTOztBQUVsQjtBQUNBLFNBQVNDLFFBQVEsSUFBSUMsR0FBRyxRQUFRLFNBQVM7QUFDekMsT0FBTyxNQUFNQyxhQUFhLEdBQUc7RUFDM0I7RUFDQUMsUUFBUSxFQUFFSixTQUFTLENBQUNELE1BQU0sQ0FBQ0ssUUFBUTtBQUNyQyxDQUFDO0FBRUQsT0FBTyxNQUFNQyxLQUFLLEdBQUdMLFNBQVMsQ0FBQ0YsRUFBRSxDQUFDTyxLQUFLLENBQUMifQ==
@@ -0,0 +1,15 @@
// wrapper an async function that support callback style API.
// It will preserve 'this'.
export function callbackify(fn) {
return function () {
const args = [...arguments];
const callback = args.pop();
// If the last argument is a function, assume it's the callback.
if (typeof callback === 'function') {
return fn.apply(this, args).then(result => callback(null, result), err => callback(err));
}
return fn.apply(this, arguments);
};
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJjYWxsYmFja2lmeSIsImZuIiwiYXJncyI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E9BQU9ELFFBQVEsS0FBSyxVQUFVLEVBQUU7TUFDbEMsT0FBT0gsRUFBRSxDQUFDSyxLQUFLLENBQUMsSUFBSSxFQUFFSixJQUFJLENBQUMsQ0FBQ0ssSUFBSSxDQUM3QkMsTUFBTSxJQUFLSixRQUFRLENBQUMsSUFBSSxFQUFFSSxNQUFNLENBQUMsRUFDakNDLEdBQUcsSUFBS0wsUUFBUSxDQUFDSyxHQUFHLENBQ3ZCLENBQUM7SUFDSDtJQUVBLE9BQU9SLEVBQUUsQ0FBQ0ssS0FBSyxDQUFDLElBQUksRUFBRUgsU0FBUyxDQUFDO0VBQ2xDLENBQUM7QUFDSCJ9
+359
View File
@@ -0,0 +1,359 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import * as http from 'node:http';
import * as https from 'node:https';
import * as stream from 'node:stream';
import { CredentialProvider } from "../CredentialProvider.mjs";
import type { SelectResults } from "../helpers.mjs";
import { CopyDestinationOptions, CopySourceOptions, LEGAL_HOLD_STATUS } from "../helpers.mjs";
import type { PostPolicyResult } from "../minio.mjs";
import { CopyConditions } from "./copy-conditions.mjs";
import { Extensions } from "./extensions.mjs";
import { PostPolicy } from "./post-policy.mjs";
import type { Region } from "./s3-endpoints.mjs";
import type { Binary, BucketItemFromList, BucketItemStat, BucketStream, BucketVersioningConfiguration, CopyObjectResult, EncryptionConfig, GetObjectLegalHoldOptions, GetObjectOpts, GetObjectRetentionOpts, IncompleteUploadedBucketItem, IRequest, ItemBucketMetadata, LifecycleConfig, LifeCycleConfigParam, ListObjectQueryOpts, ObjectInfo, ObjectLockInfo, ObjectMetaData, ObjectRetentionInfo, PreSignRequestParams, PutObjectLegalHoldOptions, RemoveObjectsParam, RemoveObjectsResponse, ReplicationConfig, ReplicationConfigOpts, RequestHeaders, ResultCallback, Retention, SelectOptions, StatObjectOpts, Tag, TaggingOpts, Tags, Transport, UploadedObjectInfo } from "./type.mjs";
import type { ListMultipartResult, UploadedPart } from "./xml-parser.mjs";
declare const requestOptionProperties: readonly ["agent", "ca", "cert", "ciphers", "clientCertEngine", "crl", "dhparam", "ecdhCurve", "family", "honorCipherOrder", "key", "passphrase", "pfx", "rejectUnauthorized", "secureOptions", "secureProtocol", "servername", "sessionIdContext"];
export interface ClientOptions {
endPoint: string;
accessKey?: string;
secretKey?: string;
useSSL?: boolean;
port?: number;
region?: Region;
transport?: Transport;
sessionToken?: string;
partSize?: number;
pathStyle?: boolean;
credentialsProvider?: CredentialProvider;
s3AccelerateEndpoint?: string;
transportAgent?: http.Agent;
}
export type RequestOption = Partial<IRequest> & {
method: string;
bucketName?: string;
objectName?: string;
query?: string;
pathStyle?: boolean;
};
export type NoResultCallback = (error: unknown) => void;
export interface MakeBucketOpt {
ObjectLocking?: boolean;
}
export interface RemoveOptions {
versionId?: string;
governanceBypass?: boolean;
forceDelete?: boolean;
}
export declare class TypedClient {
protected transport: Transport;
protected host: string;
protected port: number;
protected protocol: string;
protected accessKey: string;
protected secretKey: string;
protected sessionToken?: string;
protected userAgent: string;
protected anonymous: boolean;
protected pathStyle: boolean;
protected regionMap: Record<string, string>;
region?: string;
protected credentialsProvider?: CredentialProvider;
partSize: number;
protected overRidePartSize?: boolean;
protected maximumPartSize: number;
protected maxObjectSize: number;
enableSHA256: boolean;
protected s3AccelerateEndpoint?: string;
protected reqOptions: Record<string, unknown>;
protected transportAgent: http.Agent;
private readonly clientExtensions;
constructor(params: ClientOptions);
/**
* Minio extensions that aren't necessary present for Amazon S3 compatible storage servers
*/
get extensions(): Extensions;
/**
* @param endPoint - valid S3 acceleration end point
*/
setS3TransferAccelerate(endPoint: string): void;
/**
* Sets the supported request options.
*/
setRequestOptions(options: Pick<https.RequestOptions, (typeof requestOptionProperties)[number]>): void;
/**
* This is s3 Specific and does not hold validity in any other Object storage.
*/
private getAccelerateEndPointIfSet;
/**
* Set application specific information.
* Generates User-Agent in the following style.
* MinIO (OS; ARCH) LIB/VER APP/VER
*/
setAppInfo(appName: string, appVersion: string): void;
/**
* returns options object that can be used with http.request()
* Takes care of constructing virtual-host-style or path-style hostname
*/
protected getRequestOptions(opts: RequestOption & {
region: string;
}): IRequest & {
host: string;
headers: Record<string, string>;
};
setCredentialsProvider(credentialsProvider: CredentialProvider): Promise<void>;
private checkAndRefreshCreds;
private logStream?;
/**
* log the request, response, error
*/
private logHTTP;
/**
* Enable tracing
*/
traceOn(stream?: stream.Writable): void;
/**
* Disable tracing
*/
traceOff(): void;
/**
* makeRequest is the primitive used by the apis for making S3 requests.
* payload can be empty string in case of no payload.
* statusCode is the expected statusCode. If response.statusCode does not match
* we parse the XML error and call the callback with the error message.
*
* A valid region is passed by the calls - listBuckets, makeBucket and getBucketRegion.
*
* @internal
*/
makeRequestAsync(options: RequestOption, payload?: Binary, expectedCodes?: number[], region?: string): Promise<http.IncomingMessage>;
/**
* new request with promise
*
* No need to drain response, response body is not valid
*/
makeRequestAsyncOmit(options: RequestOption, payload?: Binary, statusCodes?: number[], region?: string): Promise<Omit<http.IncomingMessage, 'on'>>;
/**
* makeRequestStream will be used directly instead of makeRequest in case the payload
* is available as a stream. for ex. putObject
*
* @internal
*/
makeRequestStreamAsync(options: RequestOption, body: stream.Readable | Binary, sha256sum: string, statusCodes: number[], region: string): Promise<http.IncomingMessage>;
/**
* gets the region of the bucket
*
* @param bucketName
*
* @internal
*/
protected getBucketRegionAsync(bucketName: string): Promise<string>;
/**
* makeRequest is the primitive used by the apis for making S3 requests.
* payload can be empty string in case of no payload.
* statusCode is the expected statusCode. If response.statusCode does not match
* we parse the XML error and call the callback with the error message.
* A valid region is passed by the calls - listBuckets, makeBucket and
* getBucketRegion.
*
* @deprecated use `makeRequestAsync` instead
*/
makeRequest(options: RequestOption, payload: Binary | undefined, expectedCodes: number[] | undefined, region: string | undefined, returnResponse: boolean, cb: (cb: unknown, result: http.IncomingMessage) => void): void;
/**
* makeRequestStream will be used directly instead of makeRequest in case the payload
* is available as a stream. for ex. putObject
*
* @deprecated use `makeRequestStreamAsync` instead
*/
makeRequestStream(options: RequestOption, stream: stream.Readable | Buffer, sha256sum: string, statusCodes: number[], region: string, returnResponse: boolean, cb: (cb: unknown, result: http.IncomingMessage) => void): void;
/**
* @deprecated use `getBucketRegionAsync` instead
*/
getBucketRegion(bucketName: string, cb: (err: unknown, region: string) => void): Promise<void>;
/**
* Creates the bucket `bucketName`.
*
*/
makeBucket(bucketName: string, region?: Region, makeOpts?: MakeBucketOpt): Promise<void>;
/**
* To check if a bucket already exists.
*/
bucketExists(bucketName: string): Promise<boolean>;
removeBucket(bucketName: string): Promise<void>;
/**
* @deprecated use promise style API
*/
removeBucket(bucketName: string, callback: NoResultCallback): void;
/**
* Callback is called with readable stream of the object content.
*/
getObject(bucketName: string, objectName: string, getOpts?: GetObjectOpts): Promise<stream.Readable>;
/**
* Callback is called with readable stream of the partial object content.
* @param bucketName
* @param objectName
* @param offset
* @param length - length of the object that will be read in the stream (optional, if not specified we read the rest of the file from the offset)
* @param getOpts
*/
getPartialObject(bucketName: string, objectName: string, offset: number, length?: number, getOpts?: GetObjectOpts): Promise<stream.Readable>;
/**
* download object content to a file.
* This method will create a temp file named `${filename}.${base64(etag)}.part.minio` when downloading.
*
* @param bucketName - name of the bucket
* @param objectName - name of the object
* @param filePath - path to which the object data will be written to
* @param getOpts - Optional object get option
*/
fGetObject(bucketName: string, objectName: string, filePath: string, getOpts?: GetObjectOpts): Promise<void>;
/**
* Stat information of the object.
*/
statObject(bucketName: string, objectName: string, statOpts?: StatObjectOpts): Promise<BucketItemStat>;
removeObject(bucketName: string, objectName: string, removeOpts?: RemoveOptions): Promise<void>;
listIncompleteUploads(bucket: string, prefix: string, recursive: boolean): BucketStream<IncompleteUploadedBucketItem>;
/**
* Called by listIncompleteUploads to fetch a batch of incomplete uploads.
*/
listIncompleteUploadsQuery(bucketName: string, prefix: string, keyMarker: string, uploadIdMarker: string, delimiter: string): Promise<ListMultipartResult>;
/**
* Initiate a new multipart upload.
* @internal
*/
initiateNewMultipartUpload(bucketName: string, objectName: string, headers: RequestHeaders): Promise<string>;
/**
* Internal Method to abort a multipart upload request in case of any errors.
*
* @param bucketName - Bucket Name
* @param objectName - Object Name
* @param uploadId - id of a multipart upload to cancel during compose object sequence.
*/
abortMultipartUpload(bucketName: string, objectName: string, uploadId: string): Promise<void>;
findUploadId(bucketName: string, objectName: string): Promise<string | undefined>;
/**
* this call will aggregate the parts on the server into a single object.
*/
completeMultipartUpload(bucketName: string, objectName: string, uploadId: string, etags: {
part: number;
etag?: string;
}[]): Promise<{
etag: string;
versionId: string | null;
}>;
/**
* Get part-info of all parts of an incomplete upload specified by uploadId.
*/
protected listParts(bucketName: string, objectName: string, uploadId: string): Promise<UploadedPart[]>;
/**
* Called by listParts to fetch a batch of part-info
*/
private listPartsQuery;
listBuckets(): Promise<BucketItemFromList[]>;
/**
* Calculate part size given the object size. Part size will be atleast this.partSize
*/
calculatePartSize(size: number): number;
/**
* Uploads the object using contents from a file
*/
fPutObject(bucketName: string, objectName: string, filePath: string, metaData?: ObjectMetaData): Promise<UploadedObjectInfo>;
/**
* Uploading a stream, "Buffer" or "string".
* It's recommended to pass `size` argument with stream.
*/
putObject(bucketName: string, objectName: string, stream: stream.Readable | Buffer | string, size?: number, metaData?: ItemBucketMetadata): Promise<UploadedObjectInfo>;
/**
* method to upload buffer in one call
* @private
*/
private uploadBuffer;
/**
* upload stream with MultipartUpload
* @private
*/
private uploadStream;
removeBucketReplication(bucketName: string): Promise<void>;
removeBucketReplication(bucketName: string, callback: NoResultCallback): void;
setBucketReplication(bucketName: string, replicationConfig: ReplicationConfigOpts): void;
setBucketReplication(bucketName: string, replicationConfig: ReplicationConfigOpts): Promise<void>;
getBucketReplication(bucketName: string): void;
getBucketReplication(bucketName: string): Promise<ReplicationConfig>;
getObjectLegalHold(bucketName: string, objectName: string, getOpts?: GetObjectLegalHoldOptions, callback?: ResultCallback<LEGAL_HOLD_STATUS>): Promise<LEGAL_HOLD_STATUS>;
setObjectLegalHold(bucketName: string, objectName: string, setOpts?: PutObjectLegalHoldOptions): void;
/**
* Get Tags associated with a Bucket
*/
getBucketTagging(bucketName: string): Promise<Tag[]>;
/**
* Get the tags associated with a bucket OR an object
*/
getObjectTagging(bucketName: string, objectName: string, getOpts?: GetObjectOpts): Promise<Tag[]>;
/**
* Set the policy on a bucket or an object prefix.
*/
setBucketPolicy(bucketName: string, policy: string): Promise<void>;
/**
* Get the policy on a bucket or an object prefix.
*/
getBucketPolicy(bucketName: string): Promise<string>;
putObjectRetention(bucketName: string, objectName: string, retentionOpts?: Retention): Promise<void>;
getObjectLockConfig(bucketName: string, callback: ResultCallback<ObjectLockInfo>): void;
getObjectLockConfig(bucketName: string): void;
getObjectLockConfig(bucketName: string): Promise<ObjectLockInfo>;
setObjectLockConfig(bucketName: string, lockConfigOpts: Omit<ObjectLockInfo, 'objectLockEnabled'>): void;
setObjectLockConfig(bucketName: string, lockConfigOpts: Omit<ObjectLockInfo, 'objectLockEnabled'>): Promise<void>;
getBucketVersioning(bucketName: string): Promise<BucketVersioningConfiguration>;
setBucketVersioning(bucketName: string, versionConfig: BucketVersioningConfiguration): Promise<void>;
private setTagging;
private removeTagging;
setBucketTagging(bucketName: string, tags: Tags): Promise<void>;
removeBucketTagging(bucketName: string): Promise<void>;
setObjectTagging(bucketName: string, objectName: string, tags: Tags, putOpts?: TaggingOpts): Promise<void>;
removeObjectTagging(bucketName: string, objectName: string, removeOpts: TaggingOpts): Promise<void>;
selectObjectContent(bucketName: string, objectName: string, selectOpts: SelectOptions): Promise<SelectResults | undefined>;
private applyBucketLifecycle;
removeBucketLifecycle(bucketName: string): Promise<void>;
setBucketLifecycle(bucketName: string, lifeCycleConfig: LifeCycleConfigParam): Promise<void>;
getBucketLifecycle(bucketName: string): Promise<LifecycleConfig | null>;
setBucketEncryption(bucketName: string, encryptionConfig?: EncryptionConfig): Promise<void>;
getBucketEncryption(bucketName: string): Promise<any>;
removeBucketEncryption(bucketName: string): Promise<void>;
getObjectRetention(bucketName: string, objectName: string, getOpts?: GetObjectRetentionOpts): Promise<ObjectRetentionInfo | null | undefined>;
removeObjects(bucketName: string, objectsList: RemoveObjectsParam): Promise<RemoveObjectsResponse[]>;
removeIncompleteUpload(bucketName: string, objectName: string): Promise<void>;
private copyObjectV1;
private copyObjectV2;
copyObject(source: CopySourceOptions, dest: CopyDestinationOptions): Promise<CopyObjectResult>;
copyObject(targetBucketName: string, targetObjectName: string, sourceBucketNameAndObjectName: string, conditions?: CopyConditions): Promise<CopyObjectResult>;
uploadPart(partConfig: {
bucketName: string;
objectName: string;
uploadID: string;
partNumber: number;
headers: RequestHeaders;
}, payload?: Binary): Promise<{
etag: string;
key: string;
part: number;
}>;
composeObject(destObjConfig: CopyDestinationOptions, sourceObjList: CopySourceOptions[]): Promise<boolean | {
etag: string;
versionId: string | null;
} | Promise<void> | CopyObjectResult>;
presignedUrl(method: string, bucketName: string, objectName: string, expires?: number | PreSignRequestParams | undefined, reqParams?: PreSignRequestParams | Date, requestDate?: Date): Promise<string>;
presignedGetObject(bucketName: string, objectName: string, expires?: number, respHeaders?: PreSignRequestParams | Date, requestDate?: Date): Promise<string>;
presignedPutObject(bucketName: string, objectName: string, expires?: number): Promise<string>;
newPostPolicy(): PostPolicy;
presignedPostPolicy(postPolicy: PostPolicy): Promise<PostPolicyResult>;
listObjectsQuery(bucketName: string, prefix?: string, marker?: string, listQueryOpts?: ListObjectQueryOpts): Promise<{
objects: ObjectInfo[];
isTruncated?: boolean | undefined;
nextMarker?: string | undefined;
versionIdMarker?: string | undefined;
}>;
listObjects(bucketName: string, prefix?: string, recursive?: boolean, listOpts?: ListObjectQueryOpts | undefined): BucketStream<ObjectInfo>;
}
export {};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
export declare class CopyConditions {
modified: string;
unmodified: string;
matchETag: string;
matchETagExcept: string;
setModified(date: Date): void;
setUnmodified(date: Date): void;
setMatchETag(etag: string): void;
setMatchETagExcept(etag: string): void;
}
@@ -0,0 +1,25 @@
export class CopyConditions {
modified = '';
unmodified = '';
matchETag = '';
matchETagExcept = '';
setModified(date) {
if (!(date instanceof Date)) {
throw new TypeError('date must be of type Date');
}
this.modified = date.toUTCString();
}
setUnmodified(date) {
if (!(date instanceof Date)) {
throw new TypeError('date must be of type Date');
}
this.unmodified = date.toUTCString();
}
setMatchETag(etag) {
this.matchETag = etag;
}
setMatchETagExcept(etag) {
this.matchETagExcept = etag;
}
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDb3B5Q29uZGl0aW9ucyIsIm1vZGlmaWVkIiwidW5tb2RpZmllZCIsIm1hdGNoRVRhZyIsIm1hdGNoRVRhZ0V4Y2VwdCIsInNldE1vZGlmaWVkIiwiZGF0ZSIsIkRhdGUiLCJUeXBlRXJyb3IiLCJ0b1VUQ1N0cmluZyIsInNldFVubW9kaWZpZWQiLCJzZXRNYXRjaEVUYWciLCJldGFnIiwic2V0TWF0Y2hFVGFnRXhjZXB0Il0sInNvdXJjZXMiOlsiY29weS1jb25kaXRpb25zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjbGFzcyBDb3B5Q29uZGl0aW9ucyB7XG4gIHB1YmxpYyBtb2RpZmllZCA9ICcnXG4gIHB1YmxpYyB1bm1vZGlmaWVkID0gJydcbiAgcHVibGljIG1hdGNoRVRhZyA9ICcnXG4gIHB1YmxpYyBtYXRjaEVUYWdFeGNlcHQgPSAnJ1xuXG4gIHNldE1vZGlmaWVkKGRhdGU6IERhdGUpOiB2b2lkIHtcbiAgICBpZiAoIShkYXRlIGluc3RhbmNlb2YgRGF0ZSkpIHtcbiAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ2RhdGUgbXVzdCBiZSBvZiB0eXBlIERhdGUnKVxuICAgIH1cblxuICAgIHRoaXMubW9kaWZpZWQgPSBkYXRlLnRvVVRDU3RyaW5nKClcbiAgfVxuXG4gIHNldFVubW9kaWZpZWQoZGF0ZTogRGF0ZSk6IHZvaWQge1x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LFlBQVlBLENBQUNDLElBQVksRUFBUTtJQUMvQixJQUFJLENBQUNULFNBQVMsR0FBR1MsSUFBSTtFQUN2QjtFQUVBQyxrQkFBa0JBLENBQUNELElBQVksRUFBUTtJQUNyQyxJQUFJLENBQUNSLGVBQWUsR0FBR1EsSUFBSTtFQUM3QjtBQUNGIn0=
@@ -0,0 +1,18 @@
import type { TypedClient } from "./client.mjs";
import type { BucketItemWithMetadata, BucketStream } from "./type.mjs";
export declare class Extensions {
private readonly client;
constructor(client: TypedClient);
/**
* List the objects in the bucket using S3 ListObjects V2 With Metadata
*
* @param bucketName - name of the bucket
* @param prefix - the prefix of the objects that should be listed (optional, default `''`)
* @param recursive - `true` indicates recursive style listing and `false` indicates directory style listing delimited by '/'. (optional, default `false`)
* @param startAfter - Specifies the key to start after when listing objects in a bucket. (optional, default `''`)
* @returns stream emitting the objects in the bucket, the object is of the format:
*/
listObjectsV2WithMetadata(bucketName: string, prefix?: string, recursive?: boolean, startAfter?: string): BucketStream<BucketItemWithMetadata>;
private listObjectsV2WithMetadataGen;
private listObjectsV2WithMetadataQuery;
}
File diff suppressed because one or more lines are too long
+173
View File
@@ -0,0 +1,173 @@
/// <reference types="node" />
/// <reference types="node" />
import * as stream from 'node:stream';
import _ from 'lodash';
import type { Binary, Encryption, ObjectMetaData, RequestHeaders, ResponseHeader } from "./type.mjs";
export declare function hashBinary(buf: Buffer, enableSHA256: boolean): {
md5sum: string;
sha256sum: string;
};
export declare function uriEscape(uriStr: string): string;
export declare function uriResourceEscape(string: string): string;
export declare function getScope(region: string, date: Date, serviceName?: string): string;
/**
* isAmazonEndpoint - true if endpoint is 's3.amazonaws.com' or 's3.cn-north-1.amazonaws.com.cn'
*/
export declare function isAmazonEndpoint(endpoint: string): boolean;
/**
* isVirtualHostStyle - verify if bucket name is support with virtual
* hosts. bucketNames with periods should be always treated as path
* style if the protocol is 'https:', this is due to SSL wildcard
* limitation. For all other buckets and Amazon S3 endpoint we will
* default to virtual host style.
*/
export declare function isVirtualHostStyle(endpoint: string, protocol: string, bucket: string, pathStyle: boolean): boolean;
export declare function isValidIP(ip: string): boolean;
/**
* @returns if endpoint is valid domain.
*/
export declare function isValidEndpoint(endpoint: string): boolean;
/**
* @returns if input host is a valid domain.
*/
export declare function isValidDomain(host: string): boolean;
/**
* Probes contentType using file extensions.
*
* @example
* ```
* // return 'image/png'
* probeContentType('file.png')
* ```
*/
export declare function probeContentType(path: string): string;
/**
* is input port valid.
*/
export declare function isValidPort(port: unknown): port is number;
export declare function isValidBucketName(bucket: unknown): boolean;
/**
* check if objectName is a valid object name
*/
export declare function isValidObjectName(objectName: unknown): boolean;
/**
* check if prefix is valid
*/
export declare function isValidPrefix(prefix: unknown): prefix is string;
/**
* check if typeof arg number
*/
export declare function isNumber(arg: unknown): arg is number;
export type AnyFunction = (...args: any[]) => any;
/**
* check if typeof arg function
*/
export declare function isFunction(arg: unknown): arg is AnyFunction;
/**
* check if typeof arg string
*/
export declare function isString(arg: unknown): arg is string;
/**
* check if typeof arg object
*/
export declare function isObject(arg: unknown): arg is object;
/**
* check if object is readable stream
*/
export declare function isReadableStream(arg: unknown): arg is stream.Readable;
/**
* check if arg is boolean
*/
export declare function isBoolean(arg: unknown): arg is boolean;
export declare function isEmpty(o: unknown): o is null | undefined;
export declare function isEmptyObject(o: Record<string, unknown>): boolean;
export declare function isDefined<T>(o: T): o is Exclude<T, null | undefined>;
/**
* check if arg is a valid date
*/
export declare function isValidDate(arg: unknown): arg is Date;
/**
* Create a Date string with format: 'YYYYMMDDTHHmmss' + Z
*/
export declare function makeDateLong(date?: Date): string;
/**
* Create a Date string with format: 'YYYYMMDD'
*/
export declare function makeDateShort(date?: Date): string;
/**
* pipesetup sets up pipe() from left to right os streams array
* pipesetup will also make sure that error emitted at any of the upstream Stream
* will be emitted at the last stream. This makes error handling simple
*/
export declare function pipesetup(...streams: [stream.Readable, ...stream.Duplex[], stream.Writable]): stream.Readable | stream.Duplex | stream.Writable;
/**
* return a Readable stream that emits data
*/
export declare function readableStream(data: unknown): stream.Readable;
/**
* Process metadata to insert appropriate value to `content-type` attribute
*/
export declare function insertContentType(metaData: ObjectMetaData, filePath: string): ObjectMetaData;
/**
* Function prepends metadata with the appropriate prefix if it is not already on
*/
export declare function prependXAMZMeta(metaData?: ObjectMetaData): RequestHeaders;
/**
* Checks if it is a valid header according to the AmazonS3 API
*/
export declare function isAmzHeader(key: string): boolean;
/**
* Checks if it is a supported Header
*/
export declare function isSupportedHeader(key: string): boolean;
/**
* Checks if it is a storage header
*/
export declare function isStorageClassHeader(key: string): boolean;
export declare function extractMetadata(headers: ResponseHeader): _.Dictionary<string>;
export declare function getVersionId(headers?: ResponseHeader): string | null;
export declare function getSourceVersionId(headers?: ResponseHeader): string | null;
export declare function sanitizeETag(etag?: string): string;
export declare function toMd5(payload: Binary): string;
export declare function toSha256(payload: Binary): string;
/**
* toArray returns a single element array with param being the element,
* if param is just a string, and returns 'param' back if it is an array
* So, it makes sure param is always an array
*/
export declare function toArray<T = unknown>(param: T | T[]): Array<T>;
export declare function sanitizeObjectKey(objectName: string): string;
export declare function sanitizeSize(size?: string): number | undefined;
export declare const PART_CONSTRAINTS: {
ABS_MIN_PART_SIZE: number;
MIN_PART_SIZE: number;
MAX_PARTS_COUNT: number;
MAX_PART_SIZE: number;
MAX_SINGLE_PUT_OBJECT_SIZE: number;
MAX_MULTIPART_PUT_OBJECT_SIZE: number;
};
/**
* Return Encryption headers
* @param encConfig
* @returns an object with key value pairs that can be used in headers.
*/
export declare function getEncryptionHeaders(encConfig: Encryption): RequestHeaders;
export declare function partsRequired(size: number): number;
/**
* calculateEvenSplits - computes splits for a source and returns
* start and end index slices. Splits happen evenly to be sure that no
* part is less than 5MiB, as that could fail the multipart request if
* it is not the last part.
*/
export declare function calculateEvenSplits<T extends {
Start?: number;
}>(size: number, objInfo: T): {
startIndex: number[];
objInfo: T;
endIndex: number[];
} | null;
export declare function parseXml(xml: string): any;
/**
* get content size of object content to upload
*/
export declare function getContentLength(s: stream.Readable | Buffer | string): Promise<number | null>;
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
/**
* joinHostPort combines host and port into a network address of the
* form "host:port". If host contains a colon, as found in literal
* IPv6 addresses, then JoinHostPort returns "[host]:port".
*
* @param host
* @param port
* @returns Cleaned up host
* @internal
*/
export declare function joinHostPort(host: string, port?: number): string;
@@ -0,0 +1,23 @@
/**
* joinHostPort combines host and port into a network address of the
* form "host:port". If host contains a colon, as found in literal
* IPv6 addresses, then JoinHostPort returns "[host]:port".
*
* @param host
* @param port
* @returns Cleaned up host
* @internal
*/
export function joinHostPort(host, port) {
if (port === undefined) {
return host;
}
// We assume that host is a literal IPv6 address if host has
// colons.
if (host.includes(':')) {
return `[${host}]:${port.toString()}`;
}
return `${host}:${port.toString()}`;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJqb2luSG9zdFBvcnQiLCJob3N0IiwicG9ydCIsInVuZGVmaW5lZCIsImluY2x1ZGVzIiwidG9TdHJpbmciXSwic291cmNlcyI6WyJqb2luLWhvc3QtcG9ydC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIGpvaW5Ib3N0UG9ydCBjb21iaW5lcyBob3N0IGFuZCBwb3J0IGludG8gYSBuZXR3b3JrIGFkZHJlc3Mgb2YgdGhlXG4gKiBmb3JtIFwiaG9zdDpwb3J0XCIuIElmIGhvc3QgY29udGFpbnMgYSBjb2xvbiwgYXMgZm91bmQgaW4gbGl0ZXJhbFxuICogSVB2NiBhZGRyZXNzZXMsIHRoZW4gSm9pbkhvc3RQb3J0IHJldHVybnMgXCJbaG9zdF06cG9ydFwiLlxuICpcbiAqIEBwYXJhbSBob3N0XG4gKiBAcGFyYW0gcG9ydFxuICogQHJldHVybnMgQ2xlYW5lZCB1cCBob3N0XG4gKiBAaW50ZXJuYWxcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGpvaW5Ib3N0UG9ydChob3N0OiBzdHJpbmcsIHBvcnQ/OiBudW1iZXIpOiBzdHJpbmcge1xuICBpZiAocG9ydCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgcmV0dXJuIGhvc3RcbiAgfVxuXG4gIC8vIFdlIGFzc3VtZSB0aGF0IGhvc3QgaXMgYSBsaXRlcmFsIElQdjYgYWRkcmVzcyBpZiBob3N0IGhhc1xuICAvLyBjb2xvbnMuXG4gIGlmIChob3N0LmluY2x1ZGVzKCc6JykpIHtcbiAgICByZXR1cm4gYFske2hvc3R9XToke3BvcnQudG9TdHJpbmcoKX1gXG4gIH1cblxuICByZXR1cm4gYCR7aG9zdH06JHtwb3J0LnRvU3RyaW5nKCl9YFxufVxuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE9BQU8sU0FBU0EsWUFBWUEsQ0FBQ0MsSUFBWSxFQUFFQyxJQUFhLEVBQVU7RUFDaEUsSUFBSUEsSUFBSSxLQUFLQyxTQUFTLEVBQUU7SUFDdEIsT0FBT0YsSUFBSTtFQUNiOztFQUVBO0VBQ0E7RUFDQSxJQUFJQSxJQUFJLENBQUNHLFFBQVEsQ0FBQyxHQUFHLENBQUMsRUFBRTtJQUN0QixPQUFRLElBQUdILElBQUssS0FBSUMsSUFBSSxDQUFDRyxRQUFRLENBQUMsQ0FBRSxFQUFDO0VBQ3ZDO0VBRUEsT0FBUSxHQUFFSixJQUFLLElBQUdDLElBQUksQ0FBQ0csUUFBUSxDQUFDLENBQUUsRUFBQztBQUNyQyJ9
@@ -0,0 +1,17 @@
import type { ObjectMetaData } from "./type.mjs";
export declare class PostPolicy {
policy: {
conditions: (string | number)[][];
expiration?: string;
};
formData: Record<string, string>;
setExpires(date: Date): void;
setKey(objectName: string): void;
setKeyStartsWith(prefix: string): void;
setBucket(bucketName: string): void;
setContentType(type: string): void;
setContentTypeStartsWith(prefix: string): void;
setContentDisposition(value: string): void;
setContentLengthRange(min: number, max: number): void;
setUserMetaData(metaData: ObjectMetaData): void;
}
File diff suppressed because one or more lines are too long
+11
View File
@@ -0,0 +1,11 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import type * as http from 'node:http';
import type * as https from 'node:https';
import type * as stream from 'node:stream';
import type { Transport } from "./type.mjs";
export declare function request(transport: Transport, opt: https.RequestOptions, body?: Buffer | string | stream.Readable | null): Promise<http.IncomingMessage>;
export declare const retryHttpCodes: Record<string, boolean>;
export declare function requestWithRetry(transport: Transport, opt: https.RequestOptions, body?: Buffer | string | stream.Readable | null, maxRetries?: number): Promise<http.IncomingMessage>;
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import type http from 'node:http';
import type stream from 'node:stream';
export declare function readAsBuffer(res: stream.Readable): Promise<Buffer>;
export declare function readAsString(res: http.IncomingMessage): Promise<string>;
export declare function drainResponse(res: stream.Readable): Promise<void>;
+16
View File
@@ -0,0 +1,16 @@
export async function readAsBuffer(res) {
return new Promise((resolve, reject) => {
const body = [];
res.on('data', chunk => body.push(chunk)).on('error', e => reject(e)).on('end', () => resolve(Buffer.concat(body)));
});
}
export async function readAsString(res) {
const body = await readAsBuffer(res);
return body.toString();
}
export async function drainResponse(res) {
return new Promise((resolve, reject) => {
res.on('data', () => {}).on('error', e => reject(e)).on('end', () => resolve());
});
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZWFkQXNCdWZmZXIiLCJyZXMiLCJQcm9taXNlIiwicmVzb2x2ZSIsInJlamVjdCIsImJvZHkiLCJvbiIsImNodW5rIiwicHVzaCIsImUiLCJCdWZmZXIiLCJjb25jYXQiLCJyZWFkQXNTdHJpbmciLCJ0b1N0cmluZyIsImRyYWluUmVzcG9uc2UiXSwic291cmNlcyI6WyJyZXNwb25zZS50cyJdLCJzb3VyY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0VBQy9CLENBQUMsQ0FBQztBQUNKIn0=
@@ -0,0 +1,38 @@
declare const awsS3Endpoint: {
'af-south-1': string;
'ap-east-1': string;
'ap-south-1': string;
'ap-south-2': string;
'ap-southeast-1': string;
'ap-southeast-2': string;
'ap-southeast-3': string;
'ap-southeast-4': string;
'ap-southeast-5': string;
'ap-northeast-1': string;
'ap-northeast-2': string;
'ap-northeast-3': string;
'ca-central-1': string;
'ca-west-1': string;
'cn-north-1': string;
'eu-central-1': string;
'eu-central-2': string;
'eu-north-1': string;
'eu-south-1': string;
'eu-south-2': string;
'eu-west-1': string;
'eu-west-2': string;
'eu-west-3': string;
'il-central-1': string;
'me-central-1': string;
'me-south-1': string;
'sa-east-1': string;
'us-east-1': string;
'us-east-2': string;
'us-west-1': string;
'us-west-2': string;
'us-gov-east-1': string;
'us-gov-west-1': string;
};
export type Region = keyof typeof awsS3Endpoint | string;
export declare function getS3Endpoint(region: Region): string;
export {};
File diff suppressed because one or more lines are too long
+447
View File
@@ -0,0 +1,447 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import type * as http from 'node:http';
import type { Readable as ReadableStream } from 'node:stream';
import type { CopyDestinationOptions, CopySourceOptions } from "../helpers.mjs";
import type { CopyConditions } from "./copy-conditions.mjs";
export type VersionIdentificator = {
versionId?: string;
};
export type GetObjectOpts = VersionIdentificator & {
SSECustomerAlgorithm?: string;
SSECustomerKey?: string;
SSECustomerKeyMD5?: string;
};
export type Binary = string | Buffer;
export type ResponseHeader = Record<string, string>;
export type ObjectMetaData = Record<string, string | number>;
export type RequestHeaders = Record<string, string | boolean | number | undefined>;
export type Encryption = {
type: ENCRYPTION_TYPES.SSEC;
} | {
type: ENCRYPTION_TYPES.KMS;
SSEAlgorithm?: string;
KMSMasterKeyID?: string;
};
export type EnabledOrDisabledStatus = 'Enabled' | 'Disabled';
export declare enum ENCRYPTION_TYPES {
/**
* SSEC represents server-side-encryption with customer provided keys
*/
SSEC = "SSE-C",
/**
* KMS represents server-side-encryption with managed keys
*/
KMS = "KMS",
}
export declare enum RETENTION_MODES {
GOVERNANCE = "GOVERNANCE",
COMPLIANCE = "COMPLIANCE",
}
export declare enum RETENTION_VALIDITY_UNITS {
DAYS = "Days",
YEARS = "Years",
}
export declare enum LEGAL_HOLD_STATUS {
ENABLED = "ON",
DISABLED = "OFF",
}
export type Transport = Pick<typeof http, 'request'>;
export interface IRequest {
protocol: string;
port?: number | string;
method: string;
path: string;
headers: RequestHeaders;
}
export type ICanonicalRequest = string;
export interface IncompleteUploadedBucketItem {
key: string;
uploadId: string;
size: number;
}
export interface MetadataItem {
Key: string;
Value: string;
}
export interface ItemBucketMetadataList {
Items: MetadataItem[];
}
export interface ItemBucketMetadata {
[key: string]: any;
}
export interface ItemBucketTags {
[key: string]: any;
}
export interface BucketItemFromList {
name: string;
creationDate: Date;
}
export interface BucketItemCopy {
etag: string;
lastModified: Date;
}
export type BucketItem = {
name: string;
size: number;
etag: string;
prefix?: never;
lastModified: Date;
} | {
name?: never;
etag?: never;
lastModified?: never;
prefix: string;
size: 0;
};
export type BucketItemWithMetadata = BucketItem & {
metadata?: ItemBucketMetadata | ItemBucketMetadataList;
tags?: ItemBucketTags;
};
export interface BucketStream<T> extends ReadableStream {
on(event: 'data', listener: (item: T) => void): this;
on(event: 'end' | 'pause' | 'readable' | 'resume' | 'close', listener: () => void): this;
on(event: 'error', listener: (err: Error) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
}
export interface BucketItemStat {
size: number;
etag: string;
lastModified: Date;
metaData: ItemBucketMetadata;
versionId?: string | null;
}
export type StatObjectOpts = {
versionId?: string;
};
export type ReplicationRuleStatus = {
Status: EnabledOrDisabledStatus;
};
export type Tag = {
Key: string;
Value: string;
};
export type Tags = Record<string, string>;
export type ReplicationRuleDestination = {
Bucket: string;
StorageClass: string;
};
export type ReplicationRuleAnd = {
Prefix: string;
Tags: Tag[];
};
export type ReplicationRuleFilter = {
Prefix: string;
And: ReplicationRuleAnd;
Tag: Tag;
};
export type ReplicaModifications = {
Status: ReplicationRuleStatus;
};
export type SourceSelectionCriteria = {
ReplicaModifications: ReplicaModifications;
};
export type ExistingObjectReplication = {
Status: ReplicationRuleStatus;
};
export type ReplicationRule = {
ID: string;
Status: ReplicationRuleStatus;
Priority: number;
DeleteMarkerReplication: ReplicationRuleStatus;
DeleteReplication: ReplicationRuleStatus;
Destination: ReplicationRuleDestination;
Filter: ReplicationRuleFilter;
SourceSelectionCriteria: SourceSelectionCriteria;
ExistingObjectReplication: ExistingObjectReplication;
};
export type ReplicationConfigOpts = {
role: string;
rules: ReplicationRule[];
};
export type ReplicationConfig = {
ReplicationConfiguration: ReplicationConfigOpts;
};
export type ResultCallback<T> = (error: Error | null, result: T) => void;
export type GetObjectLegalHoldOptions = {
versionId: string;
};
/**
* @deprecated keep for backward compatible, use `LEGAL_HOLD_STATUS` instead
*/
export type LegalHoldStatus = LEGAL_HOLD_STATUS;
export type PutObjectLegalHoldOptions = {
versionId?: string;
status: LEGAL_HOLD_STATUS;
};
export interface UploadedObjectInfo {
etag: string;
versionId: string | null;
}
export interface RetentionOptions {
versionId: string;
mode?: RETENTION_MODES;
retainUntilDate?: IsoDate;
governanceBypass?: boolean;
}
export type Retention = RetentionOptions | EmptyObject;
export type IsoDate = string;
export type EmptyObject = Record<string, never>;
export type ObjectLockInfo = {
objectLockEnabled: EnabledOrDisabledStatus;
mode: RETENTION_MODES;
unit: RETENTION_VALIDITY_UNITS;
validity: number;
} | EmptyObject;
export type ObjectLockConfigParam = {
ObjectLockEnabled?: 'Enabled' | undefined;
Rule?: {
DefaultRetention: {
Mode: RETENTION_MODES;
Days: number;
Years: number;
} | EmptyObject;
} | EmptyObject;
};
export type VersioningEnabled = 'Enabled';
export type VersioningSuspended = 'Suspended';
export type TaggingOpts = {
versionId: string;
};
export type PutTaggingParams = {
bucketName: string;
objectName?: string;
tags: Tags;
putOpts?: TaggingOpts;
};
export type RemoveTaggingParams = {
bucketName: string;
objectName?: string;
removeOpts?: TaggingOpts;
};
export type InputSerialization = {
CompressionType?: 'NONE' | 'GZIP' | 'BZIP2';
CSV?: {
AllowQuotedRecordDelimiter?: boolean;
Comments?: string;
FieldDelimiter?: string;
FileHeaderInfo?: 'NONE' | 'IGNORE' | 'USE';
QuoteCharacter?: string;
QuoteEscapeCharacter?: string;
RecordDelimiter?: string;
};
JSON?: {
Type: 'DOCUMENT' | 'LINES';
};
Parquet?: EmptyObject;
};
export type OutputSerialization = {
CSV?: {
FieldDelimiter?: string;
QuoteCharacter?: string;
QuoteEscapeCharacter?: string;
QuoteFields?: string;
RecordDelimiter?: string;
};
JSON?: {
RecordDelimiter?: string;
};
};
export type SelectProgress = {
Enabled: boolean;
};
export type ScanRange = {
Start: number;
End: number;
};
export type SelectOptions = {
expression: string;
expressionType?: string;
inputSerialization: InputSerialization;
outputSerialization: OutputSerialization;
requestProgress?: SelectProgress;
scanRange?: ScanRange;
};
export type Expiration = {
Date?: string;
Days: number;
DeleteMarker?: boolean;
DeleteAll?: boolean;
};
export type RuleFilterAnd = {
Prefix: string;
Tags: Tag[];
};
export type RuleFilter = {
And?: RuleFilterAnd;
Prefix: string;
Tag?: Tag[];
};
export type NoncurrentVersionExpiration = {
NoncurrentDays: number;
NewerNoncurrentVersions?: number;
};
export type NoncurrentVersionTransition = {
StorageClass: string;
NoncurrentDays?: number;
NewerNoncurrentVersions?: number;
};
export type Transition = {
Date?: string;
StorageClass: string;
Days: number;
};
export type AbortIncompleteMultipartUpload = {
DaysAfterInitiation: number;
};
export type LifecycleRule = {
AbortIncompleteMultipartUpload?: AbortIncompleteMultipartUpload;
ID: string;
Prefix?: string;
Status?: string;
Expiration?: Expiration;
Filter?: RuleFilter;
NoncurrentVersionExpiration?: NoncurrentVersionExpiration;
NoncurrentVersionTransition?: NoncurrentVersionTransition;
Transition?: Transition;
};
export type LifecycleConfig = {
Rule: LifecycleRule[];
};
export type LifeCycleConfigParam = LifecycleConfig | null | undefined | '';
export type ApplySSEByDefault = {
KmsMasterKeyID?: string;
SSEAlgorithm: string;
};
export type EncryptionRule = {
ApplyServerSideEncryptionByDefault?: ApplySSEByDefault;
};
export type EncryptionConfig = {
Rule: EncryptionRule[];
};
export type GetObjectRetentionOpts = {
versionId: string;
};
export type ObjectRetentionInfo = {
mode: RETENTION_MODES;
retainUntilDate: string;
};
export type RemoveObjectsEntry = {
name: string;
versionId?: string;
};
export type ObjectName = string;
export type RemoveObjectsParam = ObjectName[] | RemoveObjectsEntry[];
export type RemoveObjectsRequestEntry = {
Key: string;
VersionId?: string;
};
export type RemoveObjectsResponse = null | undefined | {
Error?: {
Code?: string;
Message?: string;
Key?: string;
VersionId?: string;
};
};
export type CopyObjectResultV1 = {
etag: string;
lastModified: string | Date;
};
export type CopyObjectResultV2 = {
Bucket?: string;
Key?: string;
LastModified: string | Date;
MetaData?: ResponseHeader;
VersionId?: string | null;
SourceVersionId?: string | null;
Etag?: string;
Size?: number;
};
export type CopyObjectResult = CopyObjectResultV1 | CopyObjectResultV2;
export type CopyObjectParams = [CopySourceOptions, CopyDestinationOptions] | [string, string, string, CopyConditions?];
export type ExcludedPrefix = {
Prefix: string;
};
export type BucketVersioningConfiguration = {
Status: VersioningEnabled | VersioningSuspended;
MFADelete?: string;
ExcludedPrefixes?: ExcludedPrefix[];
ExcludeFolders?: boolean;
};
export type UploadPartConfig = {
bucketName: string;
objectName: string;
uploadID: string;
partNumber: number;
headers: RequestHeaders;
sourceObj: string;
};
export type PreSignRequestParams = {
[key: string]: string;
};
/** List object api types **/
export type CommonPrefix = {
Prefix: string;
};
export type Owner = {
ID: string;
DisplayName: string;
};
export type Metadata = {
Items: MetadataItem[];
};
export type ObjectInfo = {
key?: string;
name?: string;
lastModified?: Date;
etag?: string;
owner?: Owner;
storageClass?: string;
userMetadata?: Metadata;
userTags?: string;
prefix?: string;
size?: number;
};
export type ListObjectQueryRes = {
isTruncated?: boolean;
nextMarker?: string;
versionIdMarker?: string;
objects?: ObjectInfo[];
};
export type ListObjectQueryOpts = {
Delimiter?: string;
MaxKeys?: number;
IncludeVersion?: boolean;
};
/** List object api types **/
export type ObjectVersionEntry = {
IsLatest?: string;
VersionId?: string;
};
export type ObjectRowEntry = ObjectVersionEntry & {
Key: string;
LastModified?: Date | undefined;
ETag?: string;
Size?: string;
Owner?: Owner;
StorageClass?: string;
};
export interface ListBucketResultV1 {
Name?: string;
Prefix?: string;
ContinuationToken?: string;
KeyCount?: string;
Marker?: string;
MaxKeys?: string;
Delimiter?: string;
IsTruncated?: boolean;
Contents?: ObjectRowEntry[];
NextKeyMarker?: string;
CommonPrefixes?: CommonPrefix[];
Version?: ObjectRowEntry[];
DeleteMarker?: ObjectRowEntry[];
VersionIdMarker?: string;
NextVersionIdMarker?: string;
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,90 @@
/// <reference types="node" />
/// <reference types="node" />
import type * as http from 'node:http';
import { SelectResults } from "../helpers.mjs";
import type { BucketItemFromList, BucketItemWithMetadata, CopyObjectResultV1, ObjectInfo, ObjectLockInfo, ReplicationConfig } from "./type.mjs";
export declare function parseBucketRegion(xml: string): string;
export declare function parseError(xml: string, headerInfo: Record<string, unknown>): Record<string, unknown>;
export declare function parseResponseError(response: http.IncomingMessage): Promise<Record<string, string>>;
/**
* parse XML response for list objects v2 with metadata in a bucket
*/
export declare function parseListObjectsV2WithMetadata(xml: string): {
objects: Array<BucketItemWithMetadata>;
isTruncated: boolean;
nextContinuationToken: string;
};
export type UploadedPart = {
part: number;
lastModified?: Date;
etag: string;
size: number;
};
export declare function parseListParts(xml: string): {
isTruncated: boolean;
marker: number;
parts: UploadedPart[];
};
export declare function parseListBucket(xml: string): BucketItemFromList[];
export declare function parseInitiateMultipart(xml: string): string;
export declare function parseReplicationConfig(xml: string): ReplicationConfig;
export declare function parseObjectLegalHoldConfig(xml: string): any;
export declare function parseTagging(xml: string): any;
export declare function parseCompleteMultipart(xml: string): {
location: any;
bucket: any;
key: any;
etag: any;
errCode?: undefined;
errMessage?: undefined;
} | {
errCode: any;
errMessage: any;
location?: undefined;
bucket?: undefined;
key?: undefined;
etag?: undefined;
} | undefined;
type UploadID = string;
export type ListMultipartResult = {
uploads: {
key: string;
uploadId: UploadID;
initiator?: {
id: string;
displayName: string;
};
owner?: {
id: string;
displayName: string;
};
storageClass: unknown;
initiated: Date;
}[];
prefixes: {
prefix: string;
}[];
isTruncated: boolean;
nextKeyMarker: string;
nextUploadIdMarker: string;
};
export declare function parseListMultipart(xml: string): ListMultipartResult;
export declare function parseObjectLockConfig(xml: string): ObjectLockInfo;
export declare function parseBucketVersioningConfig(xml: string): any;
export declare function parseSelectObjectContentResponse(res: Buffer): SelectResults | undefined;
export declare function parseLifecycleConfig(xml: string): any;
export declare function parseBucketEncryptionConfig(xml: string): any;
export declare function parseObjectRetentionConfig(xml: string): {
mode: any;
retainUntilDate: any;
};
export declare function removeObjectsParser(xml: string): any[];
export declare function parseCopyObject(xml: string): CopyObjectResultV1;
export declare function parseListObjects(xml: string): {
objects: ObjectInfo[];
isTruncated?: boolean | undefined;
nextMarker?: string | undefined;
versionIdMarker?: string | undefined;
};
export declare function uploadPartParser(xml: string): any;
export {};
File diff suppressed because one or more lines are too long
+66
View File
@@ -0,0 +1,66 @@
// imported from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/93cfb0ec069731dcdfc31464788613f7cddb8192/types/minio/index.d.ts
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { LEGAL_HOLD_STATUS, RETENTION_MODES, RETENTION_VALIDITY_UNITS } from "./helpers.mjs";
import type { ClientOptions, NoResultCallback, RemoveOptions } from "./internal/client.mjs";
import { TypedClient } from "./internal/client.mjs";
import { CopyConditions } from "./internal/copy-conditions.mjs";
import { PostPolicy } from "./internal/post-policy.mjs";
import type { BucketItem, BucketItemCopy, BucketItemFromList, BucketItemStat, BucketItemWithMetadata, BucketStream, EmptyObject, ExistingObjectReplication, GetObjectLegalHoldOptions, IncompleteUploadedBucketItem, InputSerialization, IsoDate, ItemBucketMetadata, ItemBucketMetadataList, LegalHoldStatus, LifecycleConfig, LifecycleRule, MetadataItem, ObjectLockInfo, OutputSerialization, PutObjectLegalHoldOptions, ReplicaModifications, ReplicationConfig, ReplicationConfigOpts, ReplicationRule, ReplicationRuleAnd, ReplicationRuleDestination, ReplicationRuleFilter, ReplicationRuleStatus, ResultCallback, Retention, RetentionOptions, ScanRange, SelectOptions, SelectProgress, SourceSelectionCriteria, Tag } from "./internal/type.mjs";
import type { NotificationConfig, NotificationEvent, NotificationPoller } from "./notification.mjs";
export * from "./errors.mjs";
export * from "./helpers.mjs";
export type { Region } from "./internal/s3-endpoints.mjs";
export type * from "./notification.mjs";
export * from "./notification.mjs";
export { CopyConditions, PostPolicy };
export type { MakeBucketOpt } from "./internal/client.mjs";
export type { BucketItem, BucketItemCopy, BucketItemFromList, BucketItemStat, BucketItemWithMetadata, BucketStream, ClientOptions, EmptyObject, ExistingObjectReplication, GetObjectLegalHoldOptions, IncompleteUploadedBucketItem, InputSerialization, IsoDate, ItemBucketMetadata, ItemBucketMetadataList, LegalHoldStatus, LifecycleConfig, LifecycleRule, MetadataItem, NoResultCallback, ObjectLockInfo, OutputSerialization, PutObjectLegalHoldOptions, RemoveOptions, ReplicaModifications, ReplicationConfig, ReplicationConfigOpts, ReplicationRule, ReplicationRuleAnd, ReplicationRuleDestination, ReplicationRuleFilter, ReplicationRuleStatus, Retention, RetentionOptions, ScanRange, SelectOptions, SelectProgress, SourceSelectionCriteria, Tag };
/**
* @deprecated keep for backward compatible, use `RETENTION_MODES` instead
*/
export type Mode = RETENTION_MODES;
/**
* @deprecated keep for backward compatible
*/
export type LockUnit = RETENTION_VALIDITY_UNITS;
export type VersioningConfig = Record<string | number | symbol, unknown>;
export type TagList = Record<string, string>;
export interface PostPolicyResult {
postURL: string;
formData: {
[key: string]: any;
};
}
export interface LockConfig {
mode: RETENTION_MODES;
unit: RETENTION_VALIDITY_UNITS;
validity: number;
}
export interface LegalHoldOptions {
versionId: string;
status: LEGAL_HOLD_STATUS;
}
export interface SourceObjectStats {
size: number;
metaData: string;
lastModicied: Date;
versionId: string;
etag: string;
}
// Exports from library
export class Client extends TypedClient {
listObjectsV2(bucketName: string, prefix?: string, recursive?: boolean, startAfter?: string): BucketStream<BucketItem>;
// Bucket Policy & Notification operations
getBucketNotification(bucketName: string, callback: ResultCallback<NotificationConfig>): void;
getBucketNotification(bucketName: string): Promise<NotificationConfig>;
setBucketNotification(bucketName: string, bucketNotificationConfig: NotificationConfig, callback: NoResultCallback): void;
setBucketNotification(bucketName: string, bucketNotificationConfig: NotificationConfig): Promise<void>;
removeAllBucketNotification(bucketName: string, callback: NoResultCallback): void;
removeAllBucketNotification(bucketName: string): Promise<void>;
listenBucketNotification(bucketName: string, prefix: string, suffix: string, events: NotificationEvent[]): NotificationPoller;
}
File diff suppressed because one or more lines are too long
+58
View File
@@ -0,0 +1,58 @@
import { EventEmitter } from 'eventemitter3';
import type { TypedClient } from "./internal/client.mjs";
type Event = unknown;
export declare class TargetConfig {
private Filter?;
private Event?;
private Id;
setId(id: unknown): void;
addEvent(newevent: Event): void;
addFilterSuffix(suffix: string): void;
addFilterPrefix(prefix: string): void;
}
export declare class TopicConfig extends TargetConfig {
private Topic;
constructor(arn: string);
}
export declare class QueueConfig extends TargetConfig {
private Queue;
constructor(arn: string);
}
export declare class CloudFunctionConfig extends TargetConfig {
private CloudFunction;
constructor(arn: string);
}
export declare class NotificationConfig {
private TopicConfiguration?;
private CloudFunctionConfiguration?;
private QueueConfiguration?;
add(target: TargetConfig): void;
}
export declare const buildARN: (partition: string, service: string, region: string, accountId: string, resource: string) => string;
export declare const ObjectCreatedAll = "s3:ObjectCreated:*";
export declare const ObjectCreatedPut = "s3:ObjectCreated:Put";
export declare const ObjectCreatedPost = "s3:ObjectCreated:Post";
export declare const ObjectCreatedCopy = "s3:ObjectCreated:Copy";
export declare const ObjectCreatedCompleteMultipartUpload = "s3:ObjectCreated:CompleteMultipartUpload";
export declare const ObjectRemovedAll = "s3:ObjectRemoved:*";
export declare const ObjectRemovedDelete = "s3:ObjectRemoved:Delete";
export declare const ObjectRemovedDeleteMarkerCreated = "s3:ObjectRemoved:DeleteMarkerCreated";
export declare const ObjectReducedRedundancyLostObject = "s3:ReducedRedundancyLostObject";
export type NotificationEvent = 's3:ObjectCreated:*' | 's3:ObjectCreated:Put' | 's3:ObjectCreated:Post' | 's3:ObjectCreated:Copy' | 's3:ObjectCreated:CompleteMultipartUpload' | 's3:ObjectRemoved:*' | 's3:ObjectRemoved:Delete' | 's3:ObjectRemoved:DeleteMarkerCreated' | 's3:ReducedRedundancyLostObject' | 's3:TestEvent' | 's3:ObjectRestore:Post' | 's3:ObjectRestore:Completed' | 's3:Replication:OperationFailedReplication' | 's3:Replication:OperationMissedThreshold' | 's3:Replication:OperationReplicatedAfterThreshold' | 's3:Replication:OperationNotTracked' | string;
export type NotificationRecord = unknown;
export declare class NotificationPoller extends EventEmitter<{
notification: (event: NotificationRecord) => void;
error: (error: unknown) => void;
}> {
private client;
private bucketName;
private prefix;
private suffix;
private events;
private ending;
constructor(client: TypedClient, bucketName: string, prefix: string, suffix: string, events: NotificationEvent[]);
start(): void;
stop(): void;
checkForChanges(): void;
}
export {};
File diff suppressed because one or more lines are too long
+30
View File
@@ -0,0 +1,30 @@
// Returns a wrapper function that will promisify a given callback function.
// It will preserve 'this'.
export function promisify(fn) {
return function () {
// If the last argument is a function, assume its the callback.
let callback = arguments[arguments.length - 1];
// If the callback is given, don't promisify, just pass straight in.
if (typeof callback === 'function') {
return fn.apply(this, arguments);
}
// Otherwise, create a new set of arguments, and wrap
// it in a promise.
let args = [...arguments];
return new Promise((resolve, reject) => {
// Add the callback function.
args.push((err, value) => {
if (err) {
return reject(err);
}
resolve(value);
});
// Call the function with our special adaptor callback added.
fn.apply(this, args);
});
};
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJwcm9taXNpZnkiLCJmbiIsImNhbGxiYWNrIiwiYXJndW1lbnRzIiwibGVuZ3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ENBQUMsQ0FBQztFQUNKLENBQUM7QUFDSCJ9
+5
View File
@@ -0,0 +1,5 @@
import type { IRequest } from "./internal/type.mjs";
export declare function postPresignSignatureV4(region: string, date: Date, secretKey: string, policyBase64: string): string;
export declare function signV4(request: IRequest, accessKey: string, secretKey: string, region: string, requestDate: Date, sha256sum: string, serviceName?: string): string;
export declare function signV4ByServiceName(request: IRequest, accessKey: string, secretKey: string, region: string, requestDate: Date, contentSha256: string, serviceName?: string): string;
export declare function presignSignatureV4(request: IRequest, accessKey: string, secretKey: string, sessionToken: string | undefined, region: string, requestDate: Date, expires: number | undefined): string;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,86 @@
/// <reference types="node" />
import * as http from 'node:http';
import { CredentialProvider } from "./CredentialProvider.js";
import { Credentials } from "./Credentials.js";
/**
* @see https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
*/
type CredentialResponse = {
ErrorResponse?: {
Error?: {
Code?: string;
Message?: string;
};
};
AssumeRoleResponse: {
AssumeRoleResult: {
Credentials: {
AccessKeyId: string;
SecretAccessKey: string;
SessionToken: string;
Expiration: string;
};
};
};
};
export interface AssumeRoleProviderOptions {
stsEndpoint: string;
accessKey: string;
secretKey: string;
durationSeconds?: number;
sessionToken?: string;
policy?: string;
region?: string;
roleArn?: string;
roleSessionName?: string;
externalId?: string;
token?: string;
webIdentityToken?: string;
action?: string;
transportAgent?: http.Agent;
}
export declare class AssumeRoleProvider extends CredentialProvider {
private readonly stsEndpoint;
private readonly accessKey;
private readonly secretKey;
private readonly durationSeconds;
private readonly policy?;
private readonly region;
private readonly roleArn?;
private readonly roleSessionName?;
private readonly externalId?;
private readonly token?;
private readonly webIdentityToken?;
private readonly action;
private _credentials;
private readonly expirySeconds;
private accessExpiresAt;
private readonly transportAgent?;
private readonly transport;
constructor({
stsEndpoint,
accessKey,
secretKey,
durationSeconds,
sessionToken,
policy,
region,
roleArn,
roleSessionName,
externalId,
token,
webIdentityToken,
action,
transportAgent
}: AssumeRoleProviderOptions);
getRequestConfig(): {
requestOptions: http.RequestOptions;
requestData: string;
};
performRequest(): Promise<CredentialResponse>;
parseCredentials(respObj: CredentialResponse): Credentials;
refreshCredentials(): Promise<Credentials>;
getCredentials(): Promise<Credentials>;
isAboutToExpire(): boolean;
}
export default AssumeRoleProvider;
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
import { Credentials } from "./Credentials.js";
export declare class CredentialProvider {
private credentials;
constructor({
accessKey,
secretKey,
sessionToken
}: {
accessKey: string;
secretKey: string;
sessionToken?: string;
});
getCredentials(): Promise<Credentials>;
setCredentials(credentials: Credentials): void;
setAccessKey(accessKey: string): void;
getAccessKey(): string;
setSecretKey(secretKey: string): void;
getSecretKey(): string;
setSessionToken(sessionToken: string): void;
getSessionToken(): string | undefined;
}
export default CredentialProvider;
+55
View File
@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Credentials = require("./Credentials.js");
class CredentialProvider {
constructor({
accessKey,
secretKey,
sessionToken
}) {
this.credentials = new _Credentials.Credentials({
accessKey,
secretKey,
sessionToken
});
}
async getCredentials() {
return this.credentials.get();
}
setCredentials(credentials) {
if (credentials instanceof _Credentials.Credentials) {
this.credentials = credentials;
} else {
throw new Error('Unable to set Credentials. it should be an instance of Credentials class');
}
}
setAccessKey(accessKey) {
this.credentials.setAccessKey(accessKey);
}
getAccessKey() {
return this.credentials.getAccessKey();
}
setSecretKey(secretKey) {
this.credentials.setSecretKey(secretKey);
}
getSecretKey() {
return this.credentials.getSecretKey();
}
setSessionToken(sessionToken) {
this.credentials.setSessionToken(sessionToken);
}
getSessionToken() {
return this.credentials.getSessionToken();
}
}
// deprecated default export, please use named exports.
// keep for backward compatibility.
// eslint-disable-next-line import/no-default-export
exports.CredentialProvider = CredentialProvider;
var _default = CredentialProvider;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZX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7RUFFQUMsWUFBWUEsQ0FBQ1YsU0FBaUIsRUFBRTtJQUM5QixJQUFJLENBQUNFLFdBQVcsQ0FBQ1EsWUFBWSxDQUFDVixTQUFTLENBQUM7RUFDMUM7RUFFQVcsWUFBWUEsQ0FBQSxFQUFHO0lBQ2IsT0FBTyxJQUFJLENBQUNULFdBQVcsQ0FBQ1MsWUFBWSxDQUFDLENBQUM7RUFDeEM7RUFFQUMsZUFBZUEsQ0FBQ1gsWUFBb0IsRUFBRTtJQUNwQyxJQUFJLENBQUNDLFdBQVcsQ0FBQ1UsZUFBZSxDQUFDWCxZQUFZLENBQUM7RUFDaEQ7RUFFQVksZUFBZUEsQ0FBQSxFQUFHO0lBQ2hCLE9BQU8sSUFBSSxDQUFDWCxXQUFXLENBQUNXLGVBQWUsQ0FBQyxDQUFDO0VBQzNDO0FBQ0Y7O0FBRUE7QUFDQTtBQUNBO0FBQUFDLE9BQUEsQ0FBQWpCLGtCQUFBLEdBQUFBLGtCQUFBO0FBQUEsSUFBQWtCLFFBQUEsR0FDZWxCLGtCQUFrQjtBQUFBaUIsT0FBQSxDQUFBRSxPQUFBLEdBQUFELFFBQUEifQ==
+22
View File
@@ -0,0 +1,22 @@
export declare class Credentials {
accessKey: string;
secretKey: string;
sessionToken?: string;
constructor({
accessKey,
secretKey,
sessionToken
}: {
accessKey: string;
secretKey: string;
sessionToken?: string;
});
setAccessKey(accessKey: string): void;
getAccessKey(): string;
setSecretKey(secretKey: string): void;
getSecretKey(): string;
setSessionToken(sessionToken: string): void;
getSessionToken(): string | undefined;
get(): Credentials;
}
export default Credentials;
+45
View File
@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
class Credentials {
constructor({
accessKey,
secretKey,
sessionToken
}) {
this.accessKey = accessKey;
this.secretKey = secretKey;
this.sessionToken = sessionToken;
}
setAccessKey(accessKey) {
this.accessKey = accessKey;
}
getAccessKey() {
return this.accessKey;
}
setSecretKey(secretKey) {
this.secretKey = secretKey;
}
getSecretKey() {
return this.secretKey;
}
setSessionToken(sessionToken) {
this.sessionToken = sessionToken;
}
getSessionToken() {
return this.sessionToken;
}
get() {
return this;
}
}
// deprecated default export, please use named exports.
// keep for backward compatibility.
// eslint-disable-next-line import/no-default-export
exports.Credentials = Credentials;
var _default = Credentials;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDcmVkZW50aWFscyIsImNvbnN0cnVjdG9yIiwiYWNjZXNzS2V5Iiwic2VjcmV0S2V5Iiwic2Vzc2lvblRva2VuIiwic2V0QWNjZXNzS2V5IiwiZ2V0QWNjZXNzS2V5Iiwic2V0U2VjcmV0S2V5IiwiZ2V0U2VjcmV0S2V5Iiwic2V0U2Vzc2lvblRva2VuIiwiZ2V0U2Vzc2lvblRva2VuIiwiZ2V0IiwiZXhwb3J0cyIsIl9kZWZhdWx0IiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIkNyZWRlbnRpYWxzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjbGFzcyBDcmVkZW50aWFscyB7XG4gIHB1YmxpYyBhY2Nlc3NLZXk6IHN0cmluZ1xuICBwdWJsaWMgc2VjcmV0S2V5OiBzdHJpbmdcbiAgcHVibGljIHNlc3Npb25Ub2tlbj86IHN0cmluZ1xuXG4gIGNvbnN0cnVjdG9yKHsgYWNjZXNzS2V5LCBzZWNyZXRLZXksIHNlc3Npb25Ub2tlbiB9OiB7IGFjY2Vzc0tleTogc3RyaW5nOyBzZWNyZXRLZXk6IHN0cmluZzsgc2Vzc2lvblRva2VuPzogc3RyaW5nIH0pIHtcbiAgICB0aGlzLmFjY2Vzc0tleSA9IGFjY2Vzc0tleVxuICAgIHRoaXMuc2VjcmV0S2V5ID0gc2VjcmV0S2V5XG4gICAgdGhpcy5zZXNzaW9uVG9rZW4gPSBzZXNzaW9uVG9rZW5cbiAgfVxuXG4gIHNldEFjY2Vzc0tleSh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LFlBQVksR0FBR0EsWUFBWTtFQUNsQztFQUVBQyxZQUFZQSxDQUFDSCxTQUFpQixFQUFFO0lBQzlCLElBQUksQ0FBQ0EsU0FBUyxHQUFHQSxTQUFTO0VBQzVCO0VBRUFJLFlBQVlBLENBQUEsRUFBRztJQUNiLE9BQU8sSUFBSSxDQUFDSixTQUFTO0VBQ3ZCO0VBRUFLLFlBQVlBLENBQUNKLFNBQWlCLEVBQUU7SUFDOUIsSUFBSSxDQUFDQSxTQUFTLEdBQUdBLFNBQVM7RUFDNUI7RUFFQUssWUFBWUEsQ0FBQSxFQUFHO0lBQ2IsT0FBTyxJQUFJLENBQUNMLFNBQVM7RUFDdkI7RUFFQU0sZUFBZUEsQ0FBQ0wsWUFBb0IsRUFBRTtJQUNwQyxJQUFJLENBQUNBLFlBQVksR0FBR0EsWUFBWTtFQUNsQztFQUVBTSxlQUFlQSxDQUFBLEVBQUc7SUFDaEIsT0FBTyxJQUFJLENBQUNOLFlBQVk7RUFDMUI7RUFFQU8sR0FBR0EsQ0FBQSxFQUFnQjtJQUNqQixPQUFPLElBQUk7RUFDYjtBQUNGOztBQUVBO0FBQ0E7QUFDQTtBQUFBQyxPQUFBLENBQUFaLFdBQUEsR0FBQUEsV0FBQTtBQUFBLElBQUFhLFFBQUEsR0FDZWIsV0FBVztBQUFBWSxPQUFBLENBQUFFLE9BQUEsR0FBQUQsUUFBQSJ9
+27
View File
@@ -0,0 +1,27 @@
/// <reference types="node" />
import * as http from 'node:http';
import { CredentialProvider } from "./CredentialProvider.js";
import { Credentials } from "./Credentials.js";
export interface IamAwsProviderOptions {
customEndpoint?: string;
transportAgent?: http.Agent;
}
export declare class IamAwsProvider extends CredentialProvider {
private readonly customEndpoint?;
private _credentials;
private readonly transportAgent?;
private accessExpiresAt;
constructor({
customEndpoint,
transportAgent
}: IamAwsProviderOptions);
getCredentials(): Promise<Credentials>;
private fetchCredentials;
private fetchCredentialsUsingTokenFile;
private fetchImdsToken;
private getIamRoleNamedUrl;
private getIamRoleName;
private requestCredentials;
private isAboutToExpire;
}
export default IamAwsProvider;
File diff suppressed because one or more lines are too long
+82
View File
@@ -0,0 +1,82 @@
/// <reference lib="es2022.error" />
declare class ExtendableError extends Error {
constructor(message?: string, opt?: ErrorOptions);
}
/**
* AnonymousRequestError is generated for anonymous keys on specific
* APIs. NOTE: PresignedURL generation always requires access keys.
*/
export declare class AnonymousRequestError extends ExtendableError {}
/**
* InvalidArgumentError is generated for all invalid arguments.
*/
export declare class InvalidArgumentError extends ExtendableError {}
/**
* InvalidPortError is generated when a non integer value is provided
* for ports.
*/
export declare class InvalidPortError extends ExtendableError {}
/**
* InvalidEndpointError is generated when an invalid end point value is
* provided which does not follow domain standards.
*/
export declare class InvalidEndpointError extends ExtendableError {}
/**
* InvalidBucketNameError is generated when an invalid bucket name is
* provided which does not follow AWS S3 specifications.
* http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
*/
export declare class InvalidBucketNameError extends ExtendableError {}
/**
* InvalidObjectNameError is generated when an invalid object name is
* provided which does not follow AWS S3 specifications.
* http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
*/
export declare class InvalidObjectNameError extends ExtendableError {}
/**
* AccessKeyRequiredError generated by signature methods when access
* key is not found.
*/
export declare class AccessKeyRequiredError extends ExtendableError {}
/**
* SecretKeyRequiredError generated by signature methods when secret
* key is not found.
*/
export declare class SecretKeyRequiredError extends ExtendableError {}
/**
* ExpiresParamError generated when expires parameter value is not
* well within stipulated limits.
*/
export declare class ExpiresParamError extends ExtendableError {}
/**
* InvalidDateError generated when invalid date is found.
*/
export declare class InvalidDateError extends ExtendableError {}
/**
* InvalidPrefixError generated when object prefix provided is invalid
* or does not conform to AWS S3 object key restrictions.
*/
export declare class InvalidPrefixError extends ExtendableError {}
/**
* InvalidBucketPolicyError generated when the given bucket policy is invalid.
*/
export declare class InvalidBucketPolicyError extends ExtendableError {}
/**
* IncorrectSizeError generated when total data read mismatches with
* the input size.
*/
export declare class IncorrectSizeError extends ExtendableError {}
/**
* InvalidXMLError generated when an unknown XML is found.
*/
export declare class InvalidXMLError extends ExtendableError {}
/**
* S3Error is generated for errors returned from S3 server.
* see getErrorTransformer for details
*/
export declare class S3Error extends ExtendableError {
code?: string;
region?: string;
}
export declare class IsValidBucketNameError extends ExtendableError {}
export {};
File diff suppressed because one or more lines are too long
+156
View File
@@ -0,0 +1,156 @@
import type { Encryption, ObjectMetaData, RequestHeaders } from "./internal/type.js";
import { RETENTION_MODES } from "./internal/type.js";
export { ENCRYPTION_TYPES, LEGAL_HOLD_STATUS, RETENTION_MODES, RETENTION_VALIDITY_UNITS } from "./internal/type.js";
export declare const DEFAULT_REGION = "us-east-1";
export declare const PRESIGN_EXPIRY_DAYS_MAX: number;
export interface ICopySourceOptions {
Bucket: string;
Object: string;
/**
* Valid versionId
*/
VersionID?: string;
/**
* Etag to match
*/
MatchETag?: string;
/**
* Etag to exclude
*/
NoMatchETag?: string;
/**
* Modified Date of the object/part. UTC Date in string format
*/
MatchModifiedSince?: string | null;
/**
* Modified Date of the object/part to exclude UTC Date in string format
*/
MatchUnmodifiedSince?: string | null;
/**
* true or false Object range to match
*/
MatchRange?: boolean;
Start?: number;
End?: number;
Encryption?: Encryption;
}
export declare class CopySourceOptions {
readonly Bucket: string;
readonly Object: string;
readonly VersionID: string;
MatchETag: string;
private readonly NoMatchETag;
private readonly MatchModifiedSince;
private readonly MatchUnmodifiedSince;
readonly MatchRange: boolean;
readonly Start: number;
readonly End: number;
private readonly Encryption?;
constructor({
Bucket,
Object,
VersionID,
MatchETag,
NoMatchETag,
MatchModifiedSince,
MatchUnmodifiedSince,
MatchRange,
Start,
End,
Encryption
}: ICopySourceOptions);
validate(): boolean;
getHeaders(): RequestHeaders;
}
/**
* @deprecated use nodejs fs module
*/
export declare function removeDirAndFiles(dirPath: string, removeSelf?: boolean): void;
export interface ICopyDestinationOptions {
/**
* Bucket name
*/
Bucket: string;
/**
* Object Name for the destination (composed/copied) object defaults
*/
Object: string;
/**
* Encryption configuration defaults to {}
* @default {}
*/
Encryption?: Encryption;
UserMetadata?: ObjectMetaData;
/**
* query-string encoded string or Record<string, string> Object
*/
UserTags?: Record<string, string> | string;
LegalHold?: 'on' | 'off';
/**
* UTC Date String
*/
RetainUntilDate?: string;
Mode?: RETENTION_MODES;
MetadataDirective?: 'COPY' | 'REPLACE';
/**
* Extra headers for the target object
*/
Headers?: Record<string, string>;
}
export declare class CopyDestinationOptions {
readonly Bucket: string;
readonly Object: string;
private readonly Encryption?;
private readonly UserMetadata?;
private readonly UserTags?;
private readonly LegalHold?;
private readonly RetainUntilDate?;
private readonly Mode?;
private readonly MetadataDirective?;
private readonly Headers?;
constructor({
Bucket,
Object,
Encryption,
UserMetadata,
UserTags,
LegalHold,
RetainUntilDate,
Mode,
MetadataDirective,
Headers
}: ICopyDestinationOptions);
getHeaders(): RequestHeaders;
validate(): boolean;
}
/**
* maybe this should be a generic type for Records, leave it for later refactor
*/
export declare class SelectResults {
private records?;
private response?;
private stats?;
private progress?;
constructor({
records,
// parsed data as stream
response,
// original response stream
stats,
// stats as xml
progress
}: {
records?: unknown;
response?: unknown;
stats?: string;
progress?: unknown;
});
setStats(stats: string): void;
getStats(): string | undefined;
setProgress(progress: unknown): void;
getProgress(): unknown;
setResponse(response: unknown): void;
getResponse(): unknown;
setRecords(records: unknown): void;
getRecords(): unknown;
}
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
/// <reference types="node" />
/// <reference types="node" />
import * as fs from 'node:fs';
import * as stream from 'node:stream';
export { promises as fsp } from 'node:fs';
export declare const streamPromise: {
pipeline: typeof stream.pipeline.__promisify__;
};
export declare const fstat: typeof fs.fstat.__promisify__;
+24
View File
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var fs = _interopRequireWildcard(require("fs"), true);
var stream = _interopRequireWildcard(require("stream"), true);
var _util = require("util");
var _nodeFs = require("fs");
exports.fsp = _nodeFs.promises;
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
// promise helper for stdlib
// TODO: use "node:fs/promise" directly after we stop testing on nodejs 12
const streamPromise = {
// node:stream/promises Added in: v15.0.0
pipeline: (0, _util.promisify)(stream.pipeline)
};
exports.streamPromise = streamPromise;
const fstat = (0, _util.promisify)(fs.fstat);
exports.fstat = fstat;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJmcyIsIl9pbnRlcm9wUmVxdWlyZVdpbGRjYXJkIiwicmVxdWlyZSIsInN0cmVhbSIsIl91dGlsIiwiX25vZGVGcyIsImV4cG9ydHMiLCJmc3AiLCJwcm9taXNlcyIsIl9nZXRSZXF1aXJlV2lsZGNhcmRDYWNoZSIsIm5vZGVJbnRlcm9wIiwiV2Vha01hcCIsImNhY2hlQmFiZWxJbnRlcm9wIiwiY2FjaGVOb2RlSW50ZXJvcCIsIm9iaiIsIl9fZXNNb2R1bGUiLCJkZWZhdWx0IiwiY2FjaGUiLCJoYXMiLCJnZXQiLCJuZXdPYmoiLCJo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R0FBQSxFQUFBSSxJQUFBLFlBQUFULE1BQUEsQ0FBQUssR0FBQSxJQUFBWCxHQUFBLENBQUFXLEdBQUEsU0FBQUwsTUFBQSxDQUFBSixPQUFBLEdBQUFGLEdBQUEsTUFBQUcsS0FBQSxJQUFBQSxLQUFBLENBQUFhLEdBQUEsQ0FBQWhCLEdBQUEsRUFBQU0sTUFBQSxZQUFBQSxNQUFBO0FBUHpDOztBQU1BOztBQUVPLE1BQU1XLGFBQWEsR0FBRztFQUMzQjtFQUNBQyxRQUFRLEVBQUUsSUFBQUMsZUFBUyxFQUFDOUIsTUFBTSxDQUFDNkIsUUFBUTtBQUNyQyxDQUFDO0FBQUExQixPQUFBLENBQUF5QixhQUFBLEdBQUFBLGFBQUE7QUFFTSxNQUFNRyxLQUFLLEdBQUcsSUFBQUQsZUFBUyxFQUFDakMsRUFBRSxDQUFDa0MsS0FBSyxDQUFDO0FBQUE1QixPQUFBLENBQUE0QixLQUFBLEdBQUFBLEtBQUEifQ==
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.callbackify = callbackify;
// wrapper an async function that support callback style API.
// It will preserve 'this'.
function callbackify(fn) {
return function () {
const args = [...arguments];
const callback = args.pop();
// If the last argument is a function, assume it's the callback.
if (typeof callback === 'function') {
return fn.apply(this, args).then(result => callback(null, result), err => callback(err));
}
return fn.apply(this, arguments);
};
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJjYWxsYmFja2lmeSIsImZuIiwiYXJncyIsImFyZ3VtZW50cyIsImNhbGxiYWNrIiwicG9wIiwiYXBwbHkiLCJ0aGVuIiwicmVzdWx0IiwiZXJyIl0sInNvdXJjZXMiOlsiY2FsbGJhY2tpZnkuanMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gd3JhcHBlciBhbiBhc3luYyBmdW5jdGlvbiB0aGF0IHN1cHBvcnQgY2FsbGJhY2sgc3R5bGUgQ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Q0FBQ0ssR0FBRyxDQUN2QixDQUFDO0lBQ0g7SUFFQSxPQUFPUixFQUFFLENBQUNLLEtBQUssQ0FBQyxJQUFJLEVBQUVILFNBQVMsQ0FBQztFQUNsQyxDQUFDO0FBQ0gifQ==
+359
View File
@@ -0,0 +1,359 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import * as http from 'node:http';
import * as https from 'node:https';
import * as stream from 'node:stream';
import { CredentialProvider } from "../CredentialProvider.js";
import type { SelectResults } from "../helpers.js";
import { CopyDestinationOptions, CopySourceOptions, LEGAL_HOLD_STATUS } from "../helpers.js";
import type { PostPolicyResult } from "../minio.js";
import { CopyConditions } from "./copy-conditions.js";
import { Extensions } from "./extensions.js";
import { PostPolicy } from "./post-policy.js";
import type { Region } from "./s3-endpoints.js";
import type { Binary, BucketItemFromList, BucketItemStat, BucketStream, BucketVersioningConfiguration, CopyObjectResult, EncryptionConfig, GetObjectLegalHoldOptions, GetObjectOpts, GetObjectRetentionOpts, IncompleteUploadedBucketItem, IRequest, ItemBucketMetadata, LifecycleConfig, LifeCycleConfigParam, ListObjectQueryOpts, ObjectInfo, ObjectLockInfo, ObjectMetaData, ObjectRetentionInfo, PreSignRequestParams, PutObjectLegalHoldOptions, RemoveObjectsParam, RemoveObjectsResponse, ReplicationConfig, ReplicationConfigOpts, RequestHeaders, ResultCallback, Retention, SelectOptions, StatObjectOpts, Tag, TaggingOpts, Tags, Transport, UploadedObjectInfo } from "./type.js";
import type { ListMultipartResult, UploadedPart } from "./xml-parser.js";
declare const requestOptionProperties: readonly ["agent", "ca", "cert", "ciphers", "clientCertEngine", "crl", "dhparam", "ecdhCurve", "family", "honorCipherOrder", "key", "passphrase", "pfx", "rejectUnauthorized", "secureOptions", "secureProtocol", "servername", "sessionIdContext"];
export interface ClientOptions {
endPoint: string;
accessKey?: string;
secretKey?: string;
useSSL?: boolean;
port?: number;
region?: Region;
transport?: Transport;
sessionToken?: string;
partSize?: number;
pathStyle?: boolean;
credentialsProvider?: CredentialProvider;
s3AccelerateEndpoint?: string;
transportAgent?: http.Agent;
}
export type RequestOption = Partial<IRequest> & {
method: string;
bucketName?: string;
objectName?: string;
query?: string;
pathStyle?: boolean;
};
export type NoResultCallback = (error: unknown) => void;
export interface MakeBucketOpt {
ObjectLocking?: boolean;
}
export interface RemoveOptions {
versionId?: string;
governanceBypass?: boolean;
forceDelete?: boolean;
}
export declare class TypedClient {
protected transport: Transport;
protected host: string;
protected port: number;
protected protocol: string;
protected accessKey: string;
protected secretKey: string;
protected sessionToken?: string;
protected userAgent: string;
protected anonymous: boolean;
protected pathStyle: boolean;
protected regionMap: Record<string, string>;
region?: string;
protected credentialsProvider?: CredentialProvider;
partSize: number;
protected overRidePartSize?: boolean;
protected maximumPartSize: number;
protected maxObjectSize: number;
enableSHA256: boolean;
protected s3AccelerateEndpoint?: string;
protected reqOptions: Record<string, unknown>;
protected transportAgent: http.Agent;
private readonly clientExtensions;
constructor(params: ClientOptions);
/**
* Minio extensions that aren't necessary present for Amazon S3 compatible storage servers
*/
get extensions(): Extensions;
/**
* @param endPoint - valid S3 acceleration end point
*/
setS3TransferAccelerate(endPoint: string): void;
/**
* Sets the supported request options.
*/
setRequestOptions(options: Pick<https.RequestOptions, (typeof requestOptionProperties)[number]>): void;
/**
* This is s3 Specific and does not hold validity in any other Object storage.
*/
private getAccelerateEndPointIfSet;
/**
* Set application specific information.
* Generates User-Agent in the following style.
* MinIO (OS; ARCH) LIB/VER APP/VER
*/
setAppInfo(appName: string, appVersion: string): void;
/**
* returns options object that can be used with http.request()
* Takes care of constructing virtual-host-style or path-style hostname
*/
protected getRequestOptions(opts: RequestOption & {
region: string;
}): IRequest & {
host: string;
headers: Record<string, string>;
};
setCredentialsProvider(credentialsProvider: CredentialProvider): Promise<void>;
private checkAndRefreshCreds;
private logStream?;
/**
* log the request, response, error
*/
private logHTTP;
/**
* Enable tracing
*/
traceOn(stream?: stream.Writable): void;
/**
* Disable tracing
*/
traceOff(): void;
/**
* makeRequest is the primitive used by the apis for making S3 requests.
* payload can be empty string in case of no payload.
* statusCode is the expected statusCode. If response.statusCode does not match
* we parse the XML error and call the callback with the error message.
*
* A valid region is passed by the calls - listBuckets, makeBucket and getBucketRegion.
*
* @internal
*/
makeRequestAsync(options: RequestOption, payload?: Binary, expectedCodes?: number[], region?: string): Promise<http.IncomingMessage>;
/**
* new request with promise
*
* No need to drain response, response body is not valid
*/
makeRequestAsyncOmit(options: RequestOption, payload?: Binary, statusCodes?: number[], region?: string): Promise<Omit<http.IncomingMessage, 'on'>>;
/**
* makeRequestStream will be used directly instead of makeRequest in case the payload
* is available as a stream. for ex. putObject
*
* @internal
*/
makeRequestStreamAsync(options: RequestOption, body: stream.Readable | Binary, sha256sum: string, statusCodes: number[], region: string): Promise<http.IncomingMessage>;
/**
* gets the region of the bucket
*
* @param bucketName
*
* @internal
*/
protected getBucketRegionAsync(bucketName: string): Promise<string>;
/**
* makeRequest is the primitive used by the apis for making S3 requests.
* payload can be empty string in case of no payload.
* statusCode is the expected statusCode. If response.statusCode does not match
* we parse the XML error and call the callback with the error message.
* A valid region is passed by the calls - listBuckets, makeBucket and
* getBucketRegion.
*
* @deprecated use `makeRequestAsync` instead
*/
makeRequest(options: RequestOption, payload: Binary | undefined, expectedCodes: number[] | undefined, region: string | undefined, returnResponse: boolean, cb: (cb: unknown, result: http.IncomingMessage) => void): void;
/**
* makeRequestStream will be used directly instead of makeRequest in case the payload
* is available as a stream. for ex. putObject
*
* @deprecated use `makeRequestStreamAsync` instead
*/
makeRequestStream(options: RequestOption, stream: stream.Readable | Buffer, sha256sum: string, statusCodes: number[], region: string, returnResponse: boolean, cb: (cb: unknown, result: http.IncomingMessage) => void): void;
/**
* @deprecated use `getBucketRegionAsync` instead
*/
getBucketRegion(bucketName: string, cb: (err: unknown, region: string) => void): Promise<void>;
/**
* Creates the bucket `bucketName`.
*
*/
makeBucket(bucketName: string, region?: Region, makeOpts?: MakeBucketOpt): Promise<void>;
/**
* To check if a bucket already exists.
*/
bucketExists(bucketName: string): Promise<boolean>;
removeBucket(bucketName: string): Promise<void>;
/**
* @deprecated use promise style API
*/
removeBucket(bucketName: string, callback: NoResultCallback): void;
/**
* Callback is called with readable stream of the object content.
*/
getObject(bucketName: string, objectName: string, getOpts?: GetObjectOpts): Promise<stream.Readable>;
/**
* Callback is called with readable stream of the partial object content.
* @param bucketName
* @param objectName
* @param offset
* @param length - length of the object that will be read in the stream (optional, if not specified we read the rest of the file from the offset)
* @param getOpts
*/
getPartialObject(bucketName: string, objectName: string, offset: number, length?: number, getOpts?: GetObjectOpts): Promise<stream.Readable>;
/**
* download object content to a file.
* This method will create a temp file named `${filename}.${base64(etag)}.part.minio` when downloading.
*
* @param bucketName - name of the bucket
* @param objectName - name of the object
* @param filePath - path to which the object data will be written to
* @param getOpts - Optional object get option
*/
fGetObject(bucketName: string, objectName: string, filePath: string, getOpts?: GetObjectOpts): Promise<void>;
/**
* Stat information of the object.
*/
statObject(bucketName: string, objectName: string, statOpts?: StatObjectOpts): Promise<BucketItemStat>;
removeObject(bucketName: string, objectName: string, removeOpts?: RemoveOptions): Promise<void>;
listIncompleteUploads(bucket: string, prefix: string, recursive: boolean): BucketStream<IncompleteUploadedBucketItem>;
/**
* Called by listIncompleteUploads to fetch a batch of incomplete uploads.
*/
listIncompleteUploadsQuery(bucketName: string, prefix: string, keyMarker: string, uploadIdMarker: string, delimiter: string): Promise<ListMultipartResult>;
/**
* Initiate a new multipart upload.
* @internal
*/
initiateNewMultipartUpload(bucketName: string, objectName: string, headers: RequestHeaders): Promise<string>;
/**
* Internal Method to abort a multipart upload request in case of any errors.
*
* @param bucketName - Bucket Name
* @param objectName - Object Name
* @param uploadId - id of a multipart upload to cancel during compose object sequence.
*/
abortMultipartUpload(bucketName: string, objectName: string, uploadId: string): Promise<void>;
findUploadId(bucketName: string, objectName: string): Promise<string | undefined>;
/**
* this call will aggregate the parts on the server into a single object.
*/
completeMultipartUpload(bucketName: string, objectName: string, uploadId: string, etags: {
part: number;
etag?: string;
}[]): Promise<{
etag: string;
versionId: string | null;
}>;
/**
* Get part-info of all parts of an incomplete upload specified by uploadId.
*/
protected listParts(bucketName: string, objectName: string, uploadId: string): Promise<UploadedPart[]>;
/**
* Called by listParts to fetch a batch of part-info
*/
private listPartsQuery;
listBuckets(): Promise<BucketItemFromList[]>;
/**
* Calculate part size given the object size. Part size will be atleast this.partSize
*/
calculatePartSize(size: number): number;
/**
* Uploads the object using contents from a file
*/
fPutObject(bucketName: string, objectName: string, filePath: string, metaData?: ObjectMetaData): Promise<UploadedObjectInfo>;
/**
* Uploading a stream, "Buffer" or "string".
* It's recommended to pass `size` argument with stream.
*/
putObject(bucketName: string, objectName: string, stream: stream.Readable | Buffer | string, size?: number, metaData?: ItemBucketMetadata): Promise<UploadedObjectInfo>;
/**
* method to upload buffer in one call
* @private
*/
private uploadBuffer;
/**
* upload stream with MultipartUpload
* @private
*/
private uploadStream;
removeBucketReplication(bucketName: string): Promise<void>;
removeBucketReplication(bucketName: string, callback: NoResultCallback): void;
setBucketReplication(bucketName: string, replicationConfig: ReplicationConfigOpts): void;
setBucketReplication(bucketName: string, replicationConfig: ReplicationConfigOpts): Promise<void>;
getBucketReplication(bucketName: string): void;
getBucketReplication(bucketName: string): Promise<ReplicationConfig>;
getObjectLegalHold(bucketName: string, objectName: string, getOpts?: GetObjectLegalHoldOptions, callback?: ResultCallback<LEGAL_HOLD_STATUS>): Promise<LEGAL_HOLD_STATUS>;
setObjectLegalHold(bucketName: string, objectName: string, setOpts?: PutObjectLegalHoldOptions): void;
/**
* Get Tags associated with a Bucket
*/
getBucketTagging(bucketName: string): Promise<Tag[]>;
/**
* Get the tags associated with a bucket OR an object
*/
getObjectTagging(bucketName: string, objectName: string, getOpts?: GetObjectOpts): Promise<Tag[]>;
/**
* Set the policy on a bucket or an object prefix.
*/
setBucketPolicy(bucketName: string, policy: string): Promise<void>;
/**
* Get the policy on a bucket or an object prefix.
*/
getBucketPolicy(bucketName: string): Promise<string>;
putObjectRetention(bucketName: string, objectName: string, retentionOpts?: Retention): Promise<void>;
getObjectLockConfig(bucketName: string, callback: ResultCallback<ObjectLockInfo>): void;
getObjectLockConfig(bucketName: string): void;
getObjectLockConfig(bucketName: string): Promise<ObjectLockInfo>;
setObjectLockConfig(bucketName: string, lockConfigOpts: Omit<ObjectLockInfo, 'objectLockEnabled'>): void;
setObjectLockConfig(bucketName: string, lockConfigOpts: Omit<ObjectLockInfo, 'objectLockEnabled'>): Promise<void>;
getBucketVersioning(bucketName: string): Promise<BucketVersioningConfiguration>;
setBucketVersioning(bucketName: string, versionConfig: BucketVersioningConfiguration): Promise<void>;
private setTagging;
private removeTagging;
setBucketTagging(bucketName: string, tags: Tags): Promise<void>;
removeBucketTagging(bucketName: string): Promise<void>;
setObjectTagging(bucketName: string, objectName: string, tags: Tags, putOpts?: TaggingOpts): Promise<void>;
removeObjectTagging(bucketName: string, objectName: string, removeOpts: TaggingOpts): Promise<void>;
selectObjectContent(bucketName: string, objectName: string, selectOpts: SelectOptions): Promise<SelectResults | undefined>;
private applyBucketLifecycle;
removeBucketLifecycle(bucketName: string): Promise<void>;
setBucketLifecycle(bucketName: string, lifeCycleConfig: LifeCycleConfigParam): Promise<void>;
getBucketLifecycle(bucketName: string): Promise<LifecycleConfig | null>;
setBucketEncryption(bucketName: string, encryptionConfig?: EncryptionConfig): Promise<void>;
getBucketEncryption(bucketName: string): Promise<any>;
removeBucketEncryption(bucketName: string): Promise<void>;
getObjectRetention(bucketName: string, objectName: string, getOpts?: GetObjectRetentionOpts): Promise<ObjectRetentionInfo | null | undefined>;
removeObjects(bucketName: string, objectsList: RemoveObjectsParam): Promise<RemoveObjectsResponse[]>;
removeIncompleteUpload(bucketName: string, objectName: string): Promise<void>;
private copyObjectV1;
private copyObjectV2;
copyObject(source: CopySourceOptions, dest: CopyDestinationOptions): Promise<CopyObjectResult>;
copyObject(targetBucketName: string, targetObjectName: string, sourceBucketNameAndObjectName: string, conditions?: CopyConditions): Promise<CopyObjectResult>;
uploadPart(partConfig: {
bucketName: string;
objectName: string;
uploadID: string;
partNumber: number;
headers: RequestHeaders;
}, payload?: Binary): Promise<{
etag: string;
key: string;
part: number;
}>;
composeObject(destObjConfig: CopyDestinationOptions, sourceObjList: CopySourceOptions[]): Promise<boolean | {
etag: string;
versionId: string | null;
} | Promise<void> | CopyObjectResult>;
presignedUrl(method: string, bucketName: string, objectName: string, expires?: number | PreSignRequestParams | undefined, reqParams?: PreSignRequestParams | Date, requestDate?: Date): Promise<string>;
presignedGetObject(bucketName: string, objectName: string, expires?: number, respHeaders?: PreSignRequestParams | Date, requestDate?: Date): Promise<string>;
presignedPutObject(bucketName: string, objectName: string, expires?: number): Promise<string>;
newPostPolicy(): PostPolicy;
presignedPostPolicy(postPolicy: PostPolicy): Promise<PostPolicyResult>;
listObjectsQuery(bucketName: string, prefix?: string, marker?: string, listQueryOpts?: ListObjectQueryOpts): Promise<{
objects: ObjectInfo[];
isTruncated?: boolean | undefined;
nextMarker?: string | undefined;
versionIdMarker?: string | undefined;
}>;
listObjects(bucketName: string, prefix?: string, recursive?: boolean, listOpts?: ListObjectQueryOpts | undefined): BucketStream<ObjectInfo>;
}
export {};
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
export declare class CopyConditions {
modified: string;
unmodified: string;
matchETag: string;
matchETagExcept: string;
setModified(date: Date): void;
setUnmodified(date: Date): void;
setMatchETag(etag: string): void;
setMatchETagExcept(etag: string): void;
}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
class CopyConditions {
modified = '';
unmodified = '';
matchETag = '';
matchETagExcept = '';
setModified(date) {
if (!(date instanceof Date)) {
throw new TypeError('date must be of type Date');
}
this.modified = date.toUTCString();
}
setUnmodified(date) {
if (!(date instanceof Date)) {
throw new TypeError('date must be of type Date');
}
this.unmodified = date.toUTCString();
}
setMatchETag(etag) {
this.matchETag = etag;
}
setMatchETagExcept(etag) {
this.matchETagExcept = etag;
}
}
exports.CopyConditions = CopyConditions;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDb3B5Q29uZGl0aW9ucyIsIm1vZGlmaWVkIiwidW5tb2RpZmllZCIsIm1hdGNoRVRhZyIsIm1hdGNoRVRhZ0V4Y2VwdCIsInNldE1vZGlmaWVkIiwiZGF0ZSIsIkRhdGUiLCJUeXBlRXJyb3IiLCJ0b1VUQ1N0cmluZyIsInNldFVubW9kaWZpZWQiLCJzZXRNYXRjaEVUYWciLCJldGFnIiwic2V0TWF0Y2hFVGFnRXhjZXB0IiwiZXhwb3J0cyJdLCJzb3VyY2VzIjpbImNvcHktY29uZGl0aW9ucy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY2xhc3MgQ29weUNvbmRpdGlvbnMge1xuICBwdWJsaWMgbW9kaWZpZWQgPSAnJ1xuICBwdWJsaWMgdW5tb2RpZmllZCA9ICcnXG4gIHB1YmxpYyBtYXRjaEVUYWcgPSAnJ1xuICBwdWJsaWMgbWF0Y2hFVGFnRXhjZXB0ID0gJydcblxuICBzZXRNb2RpZmllZChkYXRlOiBEYXRlKTogdm9pZCB7XG4gICAgaWYgKCEoZGF0ZSBpbnN0YW5jZW9mIERhdGUpKSB7XG4gICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdkYXRlIG11c3QgYmUgb2YgdHlwZSBEYXRlJylcbiAgICB9XG5cbiAgICB0aGlzLm1vZGlmaWVkID0gZGF0ZS50b1VUQ1N0cmluZygpXG4gIH1cblxuICBzZXRVbm1vZGlmaWVkKGRhdGU6IERhdGUpOiB2b2lkIHtcbiAgICBpZiAoIShkYXRlIGluc3RhbmNlb2YgRGF0ZSkpIHtcbiAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ2RhdGUgbXVzdCBiZSBvZiB0eXBlIERhdGUnKVxuICAgIH1cblxuICAgIHRoaXMudW5tb2RpZmllZCA9IGRhdGUudG9VVENTdHJp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FDRjtBQUFDRSxPQUFBLENBQUFkLGNBQUEsR0FBQUEsY0FBQSJ9
@@ -0,0 +1,18 @@
import type { TypedClient } from "./client.js";
import type { BucketItemWithMetadata, BucketStream } from "./type.js";
export declare class Extensions {
private readonly client;
constructor(client: TypedClient);
/**
* List the objects in the bucket using S3 ListObjects V2 With Metadata
*
* @param bucketName - name of the bucket
* @param prefix - the prefix of the objects that should be listed (optional, default `''`)
* @param recursive - `true` indicates recursive style listing and `false` indicates directory style listing delimited by '/'. (optional, default `false`)
* @param startAfter - Specifies the key to start after when listing objects in a bucket. (optional, default `''`)
* @returns stream emitting the objects in the bucket, the object is of the format:
*/
listObjectsV2WithMetadata(bucketName: string, prefix?: string, recursive?: boolean, startAfter?: string): BucketStream<BucketItemWithMetadata>;
private listObjectsV2WithMetadataGen;
private listObjectsV2WithMetadataQuery;
}
File diff suppressed because one or more lines are too long
+173
View File
@@ -0,0 +1,173 @@
/// <reference types="node" />
/// <reference types="node" />
import * as stream from 'node:stream';
import _ from 'lodash';
import type { Binary, Encryption, ObjectMetaData, RequestHeaders, ResponseHeader } from "./type.js";
export declare function hashBinary(buf: Buffer, enableSHA256: boolean): {
md5sum: string;
sha256sum: string;
};
export declare function uriEscape(uriStr: string): string;
export declare function uriResourceEscape(string: string): string;
export declare function getScope(region: string, date: Date, serviceName?: string): string;
/**
* isAmazonEndpoint - true if endpoint is 's3.amazonaws.com' or 's3.cn-north-1.amazonaws.com.cn'
*/
export declare function isAmazonEndpoint(endpoint: string): boolean;
/**
* isVirtualHostStyle - verify if bucket name is support with virtual
* hosts. bucketNames with periods should be always treated as path
* style if the protocol is 'https:', this is due to SSL wildcard
* limitation. For all other buckets and Amazon S3 endpoint we will
* default to virtual host style.
*/
export declare function isVirtualHostStyle(endpoint: string, protocol: string, bucket: string, pathStyle: boolean): boolean;
export declare function isValidIP(ip: string): boolean;
/**
* @returns if endpoint is valid domain.
*/
export declare function isValidEndpoint(endpoint: string): boolean;
/**
* @returns if input host is a valid domain.
*/
export declare function isValidDomain(host: string): boolean;
/**
* Probes contentType using file extensions.
*
* @example
* ```
* // return 'image/png'
* probeContentType('file.png')
* ```
*/
export declare function probeContentType(path: string): string;
/**
* is input port valid.
*/
export declare function isValidPort(port: unknown): port is number;
export declare function isValidBucketName(bucket: unknown): boolean;
/**
* check if objectName is a valid object name
*/
export declare function isValidObjectName(objectName: unknown): boolean;
/**
* check if prefix is valid
*/
export declare function isValidPrefix(prefix: unknown): prefix is string;
/**
* check if typeof arg number
*/
export declare function isNumber(arg: unknown): arg is number;
export type AnyFunction = (...args: any[]) => any;
/**
* check if typeof arg function
*/
export declare function isFunction(arg: unknown): arg is AnyFunction;
/**
* check if typeof arg string
*/
export declare function isString(arg: unknown): arg is string;
/**
* check if typeof arg object
*/
export declare function isObject(arg: unknown): arg is object;
/**
* check if object is readable stream
*/
export declare function isReadableStream(arg: unknown): arg is stream.Readable;
/**
* check if arg is boolean
*/
export declare function isBoolean(arg: unknown): arg is boolean;
export declare function isEmpty(o: unknown): o is null | undefined;
export declare function isEmptyObject(o: Record<string, unknown>): boolean;
export declare function isDefined<T>(o: T): o is Exclude<T, null | undefined>;
/**
* check if arg is a valid date
*/
export declare function isValidDate(arg: unknown): arg is Date;
/**
* Create a Date string with format: 'YYYYMMDDTHHmmss' + Z
*/
export declare function makeDateLong(date?: Date): string;
/**
* Create a Date string with format: 'YYYYMMDD'
*/
export declare function makeDateShort(date?: Date): string;
/**
* pipesetup sets up pipe() from left to right os streams array
* pipesetup will also make sure that error emitted at any of the upstream Stream
* will be emitted at the last stream. This makes error handling simple
*/
export declare function pipesetup(...streams: [stream.Readable, ...stream.Duplex[], stream.Writable]): stream.Readable | stream.Duplex | stream.Writable;
/**
* return a Readable stream that emits data
*/
export declare function readableStream(data: unknown): stream.Readable;
/**
* Process metadata to insert appropriate value to `content-type` attribute
*/
export declare function insertContentType(metaData: ObjectMetaData, filePath: string): ObjectMetaData;
/**
* Function prepends metadata with the appropriate prefix if it is not already on
*/
export declare function prependXAMZMeta(metaData?: ObjectMetaData): RequestHeaders;
/**
* Checks if it is a valid header according to the AmazonS3 API
*/
export declare function isAmzHeader(key: string): boolean;
/**
* Checks if it is a supported Header
*/
export declare function isSupportedHeader(key: string): boolean;
/**
* Checks if it is a storage header
*/
export declare function isStorageClassHeader(key: string): boolean;
export declare function extractMetadata(headers: ResponseHeader): _.Dictionary<string>;
export declare function getVersionId(headers?: ResponseHeader): string | null;
export declare function getSourceVersionId(headers?: ResponseHeader): string | null;
export declare function sanitizeETag(etag?: string): string;
export declare function toMd5(payload: Binary): string;
export declare function toSha256(payload: Binary): string;
/**
* toArray returns a single element array with param being the element,
* if param is just a string, and returns 'param' back if it is an array
* So, it makes sure param is always an array
*/
export declare function toArray<T = unknown>(param: T | T[]): Array<T>;
export declare function sanitizeObjectKey(objectName: string): string;
export declare function sanitizeSize(size?: string): number | undefined;
export declare const PART_CONSTRAINTS: {
ABS_MIN_PART_SIZE: number;
MIN_PART_SIZE: number;
MAX_PARTS_COUNT: number;
MAX_PART_SIZE: number;
MAX_SINGLE_PUT_OBJECT_SIZE: number;
MAX_MULTIPART_PUT_OBJECT_SIZE: number;
};
/**
* Return Encryption headers
* @param encConfig
* @returns an object with key value pairs that can be used in headers.
*/
export declare function getEncryptionHeaders(encConfig: Encryption): RequestHeaders;
export declare function partsRequired(size: number): number;
/**
* calculateEvenSplits - computes splits for a source and returns
* start and end index slices. Splits happen evenly to be sure that no
* part is less than 5MiB, as that could fail the multipart request if
* it is not the last part.
*/
export declare function calculateEvenSplits<T extends {
Start?: number;
}>(size: number, objInfo: T): {
startIndex: number[];
objInfo: T;
endIndex: number[];
} | null;
export declare function parseXml(xml: string): any;
/**
* get content size of object content to upload
*/
export declare function getContentLength(s: stream.Readable | Buffer | string): Promise<number | null>;
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
/**
* joinHostPort combines host and port into a network address of the
* form "host:port". If host contains a colon, as found in literal
* IPv6 addresses, then JoinHostPort returns "[host]:port".
*
* @param host
* @param port
* @returns Cleaned up host
* @internal
*/
export declare function joinHostPort(host: string, port?: number): string;
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.joinHostPort = joinHostPort;
/**
* joinHostPort combines host and port into a network address of the
* form "host:port". If host contains a colon, as found in literal
* IPv6 addresses, then JoinHostPort returns "[host]:port".
*
* @param host
* @param port
* @returns Cleaned up host
* @internal
*/
function joinHostPort(host, port) {
if (port === undefined) {
return host;
}
// We assume that host is a literal IPv6 address if host has
// colons.
if (host.includes(':')) {
return `[${host}]:${port.toString()}`;
}
return `${host}:${port.toString()}`;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJqb2luSG9zdFBvcnQiLCJob3N0IiwicG9ydCIsInVuZGVmaW5lZCIsImluY2x1ZGVzIiwidG9TdHJpbmciXSwic291cmNlcyI6WyJqb2luLWhvc3QtcG9ydC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIGpvaW5Ib3N0UG9ydCBjb21iaW5lcyBob3N0IGFuZCBwb3J0IGludG8gYSBuZXR3b3JrIGFkZHJlc3Mgb2YgdGhlXG4gKiBmb3JtIFwiaG9zdDpwb3J0XCIuIElmIGhvc3QgY29udGFpbnMgYSBjb2xvbiwgYXMgZm91bmQgaW4gbGl0ZXJhbFxuICogSVB2NiBhZGRyZXNzZXMsIHRoZW4gSm9pbkhvc3RQb3J0IHJldHVybnMgXCJbaG9zdF06cG9ydFwiLlxuICpcbiAqIEBwYXJhbSBob3N0XG4gKiBAcGFyYW0gcG9ydFxuICogQHJldHVybnMgQ2xlYW5lZCB1cCBob3N0XG4gKiBAaW50ZXJuYWxcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGpvaW5Ib3N0UG9ydChob3N0OiBzdHJpbmcsIHBvcnQ/OiBudW1iZXIpOiBzdHJpbmcge1xuICBpZiAocG9ydCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgcmV0dXJuIGhvc3RcbiAgfVxuXG4gIC8vIFdlIGFzc3VtZSB0aGF0IGhvc3QgaXMgYSBsaXRlcmFsIElQdjYgYWRkcmVzcyBpZiBob3N0IGhhc1xuICAvLyBjb2xvbnMuXG4gIGlmIChob3N0LmluY2x1ZGVzKCc6JykpIHtcbiAgICByZXR1cm4gYFske2hvc3R9XToke3BvcnQudG9TdHJpbmcoKX1gXG4gIH1cblxuICByZXR1cm4gYCR7aG9zdH06JHtwb3J0LnRvU3RyaW5nKCl9YFxufVxuIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNPLFNBQVNBLFlBQVlBLENBQUNDLElBQVksRUFBRUMsSUFBYSxFQUFVO0VBQ2hFLElBQUlBLElBQUksS0FBS0MsU0FBUyxFQUFFO0lBQ3RCLE9BQU9GLElBQUk7RUFDYjs7RUFFQTtFQUNBO0VBQ0EsSUFBSUEsSUFBSSxDQUFDRyxRQUFRLENBQUMsR0FBRyxDQUFDLEVBQUU7SUFDdEIsT0FBUSxJQUFHSCxJQUFLLEtBQUlDLElBQUksQ0FBQ0csUUFBUSxDQUFDLENBQUUsRUFBQztFQUN2QztFQUVBLE9BQVEsR0FBRUosSUFBSyxJQUFHQyxJQUFJLENBQUNHLFFBQVEsQ0FBQyxDQUFFLEVBQUM7QUFDckMifQ==
@@ -0,0 +1,17 @@
import type { ObjectMetaData } from "./type.js";
export declare class PostPolicy {
policy: {
conditions: (string | number)[][];
expiration?: string;
};
formData: Record<string, string>;
setExpires(date: Date): void;
setKey(objectName: string): void;
setKeyStartsWith(prefix: string): void;
setBucket(bucketName: string): void;
setContentType(type: string): void;
setContentTypeStartsWith(prefix: string): void;
setContentDisposition(value: string): void;
setContentLengthRange(min: number, max: number): void;
setUserMetaData(metaData: ObjectMetaData): void;
}
File diff suppressed because one or more lines are too long
+11
View File
@@ -0,0 +1,11 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import type * as http from 'node:http';
import type * as https from 'node:https';
import type * as stream from 'node:stream';
import type { Transport } from "./type.js";
export declare function request(transport: Transport, opt: https.RequestOptions, body?: Buffer | string | stream.Readable | null): Promise<http.IncomingMessage>;
export declare const retryHttpCodes: Record<string, boolean>;
export declare function requestWithRetry(transport: Transport, opt: https.RequestOptions, body?: Buffer | string | stream.Readable | null, maxRetries?: number): Promise<http.IncomingMessage>;
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import type http from 'node:http';
import type stream from 'node:stream';
export declare function readAsBuffer(res: stream.Readable): Promise<Buffer>;
export declare function readAsString(res: http.IncomingMessage): Promise<string>;
export declare function drainResponse(res: stream.Readable): Promise<void>;
+24
View File
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.drainResponse = drainResponse;
exports.readAsBuffer = readAsBuffer;
exports.readAsString = readAsString;
async function readAsBuffer(res) {
return new Promise((resolve, reject) => {
const body = [];
res.on('data', chunk => body.push(chunk)).on('error', e => reject(e)).on('end', () => resolve(Buffer.concat(body)));
});
}
async function readAsString(res) {
const body = await readAsBuffer(res);
return body.toString();
}
async function drainResponse(res) {
return new Promise((resolve, reject) => {
res.on('data', () => {}).on('error', e => reject(e)).on('end', () => resolve());
});
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZWFkQXNCdWZmZXIiLCJyZXMiLCJQcm9taXNlIiwicmVzb2x2ZSIsInJlamVjdCIsImJvZHkiLCJvbiIsImNodW5rIiwicHVzaCIsImUiLCJCdWZmZXIiLCJjb25jYXQiLCJyZWFkQXNTdHJpbmciLCJ0b1N0cmluZyIsImRyYWluUmVzcG9uc2UiXSwic291cmNlcyI6WyJyZXNwb25zZS50cyJdLCJzb3VyY2VzQ29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0FBQyxDQUFDO0FBQ0oifQ==
@@ -0,0 +1,38 @@
declare const awsS3Endpoint: {
'af-south-1': string;
'ap-east-1': string;
'ap-south-1': string;
'ap-south-2': string;
'ap-southeast-1': string;
'ap-southeast-2': string;
'ap-southeast-3': string;
'ap-southeast-4': string;
'ap-southeast-5': string;
'ap-northeast-1': string;
'ap-northeast-2': string;
'ap-northeast-3': string;
'ca-central-1': string;
'ca-west-1': string;
'cn-north-1': string;
'eu-central-1': string;
'eu-central-2': string;
'eu-north-1': string;
'eu-south-1': string;
'eu-south-2': string;
'eu-west-1': string;
'eu-west-2': string;
'eu-west-3': string;
'il-central-1': string;
'me-central-1': string;
'me-south-1': string;
'sa-east-1': string;
'us-east-1': string;
'us-east-2': string;
'us-west-1': string;
'us-west-2': string;
'us-gov-east-1': string;
'us-gov-west-1': string;
};
export type Region = keyof typeof awsS3Endpoint | string;
export declare function getS3Endpoint(region: Region): string;
export {};
File diff suppressed because one or more lines are too long
+447
View File
@@ -0,0 +1,447 @@
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import type * as http from 'node:http';
import type { Readable as ReadableStream } from 'node:stream';
import type { CopyDestinationOptions, CopySourceOptions } from "../helpers.js";
import type { CopyConditions } from "./copy-conditions.js";
export type VersionIdentificator = {
versionId?: string;
};
export type GetObjectOpts = VersionIdentificator & {
SSECustomerAlgorithm?: string;
SSECustomerKey?: string;
SSECustomerKeyMD5?: string;
};
export type Binary = string | Buffer;
export type ResponseHeader = Record<string, string>;
export type ObjectMetaData = Record<string, string | number>;
export type RequestHeaders = Record<string, string | boolean | number | undefined>;
export type Encryption = {
type: ENCRYPTION_TYPES.SSEC;
} | {
type: ENCRYPTION_TYPES.KMS;
SSEAlgorithm?: string;
KMSMasterKeyID?: string;
};
export type EnabledOrDisabledStatus = 'Enabled' | 'Disabled';
export declare enum ENCRYPTION_TYPES {
/**
* SSEC represents server-side-encryption with customer provided keys
*/
SSEC = "SSE-C",
/**
* KMS represents server-side-encryption with managed keys
*/
KMS = "KMS",
}
export declare enum RETENTION_MODES {
GOVERNANCE = "GOVERNANCE",
COMPLIANCE = "COMPLIANCE",
}
export declare enum RETENTION_VALIDITY_UNITS {
DAYS = "Days",
YEARS = "Years",
}
export declare enum LEGAL_HOLD_STATUS {
ENABLED = "ON",
DISABLED = "OFF",
}
export type Transport = Pick<typeof http, 'request'>;
export interface IRequest {
protocol: string;
port?: number | string;
method: string;
path: string;
headers: RequestHeaders;
}
export type ICanonicalRequest = string;
export interface IncompleteUploadedBucketItem {
key: string;
uploadId: string;
size: number;
}
export interface MetadataItem {
Key: string;
Value: string;
}
export interface ItemBucketMetadataList {
Items: MetadataItem[];
}
export interface ItemBucketMetadata {
[key: string]: any;
}
export interface ItemBucketTags {
[key: string]: any;
}
export interface BucketItemFromList {
name: string;
creationDate: Date;
}
export interface BucketItemCopy {
etag: string;
lastModified: Date;
}
export type BucketItem = {
name: string;
size: number;
etag: string;
prefix?: never;
lastModified: Date;
} | {
name?: never;
etag?: never;
lastModified?: never;
prefix: string;
size: 0;
};
export type BucketItemWithMetadata = BucketItem & {
metadata?: ItemBucketMetadata | ItemBucketMetadataList;
tags?: ItemBucketTags;
};
export interface BucketStream<T> extends ReadableStream {
on(event: 'data', listener: (item: T) => void): this;
on(event: 'end' | 'pause' | 'readable' | 'resume' | 'close', listener: () => void): this;
on(event: 'error', listener: (err: Error) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
}
export interface BucketItemStat {
size: number;
etag: string;
lastModified: Date;
metaData: ItemBucketMetadata;
versionId?: string | null;
}
export type StatObjectOpts = {
versionId?: string;
};
export type ReplicationRuleStatus = {
Status: EnabledOrDisabledStatus;
};
export type Tag = {
Key: string;
Value: string;
};
export type Tags = Record<string, string>;
export type ReplicationRuleDestination = {
Bucket: string;
StorageClass: string;
};
export type ReplicationRuleAnd = {
Prefix: string;
Tags: Tag[];
};
export type ReplicationRuleFilter = {
Prefix: string;
And: ReplicationRuleAnd;
Tag: Tag;
};
export type ReplicaModifications = {
Status: ReplicationRuleStatus;
};
export type SourceSelectionCriteria = {
ReplicaModifications: ReplicaModifications;
};
export type ExistingObjectReplication = {
Status: ReplicationRuleStatus;
};
export type ReplicationRule = {
ID: string;
Status: ReplicationRuleStatus;
Priority: number;
DeleteMarkerReplication: ReplicationRuleStatus;
DeleteReplication: ReplicationRuleStatus;
Destination: ReplicationRuleDestination;
Filter: ReplicationRuleFilter;
SourceSelectionCriteria: SourceSelectionCriteria;
ExistingObjectReplication: ExistingObjectReplication;
};
export type ReplicationConfigOpts = {
role: string;
rules: ReplicationRule[];
};
export type ReplicationConfig = {
ReplicationConfiguration: ReplicationConfigOpts;
};
export type ResultCallback<T> = (error: Error | null, result: T) => void;
export type GetObjectLegalHoldOptions = {
versionId: string;
};
/**
* @deprecated keep for backward compatible, use `LEGAL_HOLD_STATUS` instead
*/
export type LegalHoldStatus = LEGAL_HOLD_STATUS;
export type PutObjectLegalHoldOptions = {
versionId?: string;
status: LEGAL_HOLD_STATUS;
};
export interface UploadedObjectInfo {
etag: string;
versionId: string | null;
}
export interface RetentionOptions {
versionId: string;
mode?: RETENTION_MODES;
retainUntilDate?: IsoDate;
governanceBypass?: boolean;
}
export type Retention = RetentionOptions | EmptyObject;
export type IsoDate = string;
export type EmptyObject = Record<string, never>;
export type ObjectLockInfo = {
objectLockEnabled: EnabledOrDisabledStatus;
mode: RETENTION_MODES;
unit: RETENTION_VALIDITY_UNITS;
validity: number;
} | EmptyObject;
export type ObjectLockConfigParam = {
ObjectLockEnabled?: 'Enabled' | undefined;
Rule?: {
DefaultRetention: {
Mode: RETENTION_MODES;
Days: number;
Years: number;
} | EmptyObject;
} | EmptyObject;
};
export type VersioningEnabled = 'Enabled';
export type VersioningSuspended = 'Suspended';
export type TaggingOpts = {
versionId: string;
};
export type PutTaggingParams = {
bucketName: string;
objectName?: string;
tags: Tags;
putOpts?: TaggingOpts;
};
export type RemoveTaggingParams = {
bucketName: string;
objectName?: string;
removeOpts?: TaggingOpts;
};
export type InputSerialization = {
CompressionType?: 'NONE' | 'GZIP' | 'BZIP2';
CSV?: {
AllowQuotedRecordDelimiter?: boolean;
Comments?: string;
FieldDelimiter?: string;
FileHeaderInfo?: 'NONE' | 'IGNORE' | 'USE';
QuoteCharacter?: string;
QuoteEscapeCharacter?: string;
RecordDelimiter?: string;
};
JSON?: {
Type: 'DOCUMENT' | 'LINES';
};
Parquet?: EmptyObject;
};
export type OutputSerialization = {
CSV?: {
FieldDelimiter?: string;
QuoteCharacter?: string;
QuoteEscapeCharacter?: string;
QuoteFields?: string;
RecordDelimiter?: string;
};
JSON?: {
RecordDelimiter?: string;
};
};
export type SelectProgress = {
Enabled: boolean;
};
export type ScanRange = {
Start: number;
End: number;
};
export type SelectOptions = {
expression: string;
expressionType?: string;
inputSerialization: InputSerialization;
outputSerialization: OutputSerialization;
requestProgress?: SelectProgress;
scanRange?: ScanRange;
};
export type Expiration = {
Date?: string;
Days: number;
DeleteMarker?: boolean;
DeleteAll?: boolean;
};
export type RuleFilterAnd = {
Prefix: string;
Tags: Tag[];
};
export type RuleFilter = {
And?: RuleFilterAnd;
Prefix: string;
Tag?: Tag[];
};
export type NoncurrentVersionExpiration = {
NoncurrentDays: number;
NewerNoncurrentVersions?: number;
};
export type NoncurrentVersionTransition = {
StorageClass: string;
NoncurrentDays?: number;
NewerNoncurrentVersions?: number;
};
export type Transition = {
Date?: string;
StorageClass: string;
Days: number;
};
export type AbortIncompleteMultipartUpload = {
DaysAfterInitiation: number;
};
export type LifecycleRule = {
AbortIncompleteMultipartUpload?: AbortIncompleteMultipartUpload;
ID: string;
Prefix?: string;
Status?: string;
Expiration?: Expiration;
Filter?: RuleFilter;
NoncurrentVersionExpiration?: NoncurrentVersionExpiration;
NoncurrentVersionTransition?: NoncurrentVersionTransition;
Transition?: Transition;
};
export type LifecycleConfig = {
Rule: LifecycleRule[];
};
export type LifeCycleConfigParam = LifecycleConfig | null | undefined | '';
export type ApplySSEByDefault = {
KmsMasterKeyID?: string;
SSEAlgorithm: string;
};
export type EncryptionRule = {
ApplyServerSideEncryptionByDefault?: ApplySSEByDefault;
};
export type EncryptionConfig = {
Rule: EncryptionRule[];
};
export type GetObjectRetentionOpts = {
versionId: string;
};
export type ObjectRetentionInfo = {
mode: RETENTION_MODES;
retainUntilDate: string;
};
export type RemoveObjectsEntry = {
name: string;
versionId?: string;
};
export type ObjectName = string;
export type RemoveObjectsParam = ObjectName[] | RemoveObjectsEntry[];
export type RemoveObjectsRequestEntry = {
Key: string;
VersionId?: string;
};
export type RemoveObjectsResponse = null | undefined | {
Error?: {
Code?: string;
Message?: string;
Key?: string;
VersionId?: string;
};
};
export type CopyObjectResultV1 = {
etag: string;
lastModified: string | Date;
};
export type CopyObjectResultV2 = {
Bucket?: string;
Key?: string;
LastModified: string | Date;
MetaData?: ResponseHeader;
VersionId?: string | null;
SourceVersionId?: string | null;
Etag?: string;
Size?: number;
};
export type CopyObjectResult = CopyObjectResultV1 | CopyObjectResultV2;
export type CopyObjectParams = [CopySourceOptions, CopyDestinationOptions] | [string, string, string, CopyConditions?];
export type ExcludedPrefix = {
Prefix: string;
};
export type BucketVersioningConfiguration = {
Status: VersioningEnabled | VersioningSuspended;
MFADelete?: string;
ExcludedPrefixes?: ExcludedPrefix[];
ExcludeFolders?: boolean;
};
export type UploadPartConfig = {
bucketName: string;
objectName: string;
uploadID: string;
partNumber: number;
headers: RequestHeaders;
sourceObj: string;
};
export type PreSignRequestParams = {
[key: string]: string;
};
/** List object api types **/
export type CommonPrefix = {
Prefix: string;
};
export type Owner = {
ID: string;
DisplayName: string;
};
export type Metadata = {
Items: MetadataItem[];
};
export type ObjectInfo = {
key?: string;
name?: string;
lastModified?: Date;
etag?: string;
owner?: Owner;
storageClass?: string;
userMetadata?: Metadata;
userTags?: string;
prefix?: string;
size?: number;
};
export type ListObjectQueryRes = {
isTruncated?: boolean;
nextMarker?: string;
versionIdMarker?: string;
objects?: ObjectInfo[];
};
export type ListObjectQueryOpts = {
Delimiter?: string;
MaxKeys?: number;
IncludeVersion?: boolean;
};
/** List object api types **/
export type ObjectVersionEntry = {
IsLatest?: string;
VersionId?: string;
};
export type ObjectRowEntry = ObjectVersionEntry & {
Key: string;
LastModified?: Date | undefined;
ETag?: string;
Size?: string;
Owner?: Owner;
StorageClass?: string;
};
export interface ListBucketResultV1 {
Name?: string;
Prefix?: string;
ContinuationToken?: string;
KeyCount?: string;
Marker?: string;
MaxKeys?: string;
Delimiter?: string;
IsTruncated?: boolean;
Contents?: ObjectRowEntry[];
NextKeyMarker?: string;
CommonPrefixes?: CommonPrefix[];
Version?: ObjectRowEntry[];
DeleteMarker?: ObjectRowEntry[];
VersionIdMarker?: string;
NextVersionIdMarker?: string;
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,90 @@
/// <reference types="node" />
/// <reference types="node" />
import type * as http from 'node:http';
import { SelectResults } from "../helpers.js";
import type { BucketItemFromList, BucketItemWithMetadata, CopyObjectResultV1, ObjectInfo, ObjectLockInfo, ReplicationConfig } from "./type.js";
export declare function parseBucketRegion(xml: string): string;
export declare function parseError(xml: string, headerInfo: Record<string, unknown>): Record<string, unknown>;
export declare function parseResponseError(response: http.IncomingMessage): Promise<Record<string, string>>;
/**
* parse XML response for list objects v2 with metadata in a bucket
*/
export declare function parseListObjectsV2WithMetadata(xml: string): {
objects: Array<BucketItemWithMetadata>;
isTruncated: boolean;
nextContinuationToken: string;
};
export type UploadedPart = {
part: number;
lastModified?: Date;
etag: string;
size: number;
};
export declare function parseListParts(xml: string): {
isTruncated: boolean;
marker: number;
parts: UploadedPart[];
};
export declare function parseListBucket(xml: string): BucketItemFromList[];
export declare function parseInitiateMultipart(xml: string): string;
export declare function parseReplicationConfig(xml: string): ReplicationConfig;
export declare function parseObjectLegalHoldConfig(xml: string): any;
export declare function parseTagging(xml: string): any;
export declare function parseCompleteMultipart(xml: string): {
location: any;
bucket: any;
key: any;
etag: any;
errCode?: undefined;
errMessage?: undefined;
} | {
errCode: any;
errMessage: any;
location?: undefined;
bucket?: undefined;
key?: undefined;
etag?: undefined;
} | undefined;
type UploadID = string;
export type ListMultipartResult = {
uploads: {
key: string;
uploadId: UploadID;
initiator?: {
id: string;
displayName: string;
};
owner?: {
id: string;
displayName: string;
};
storageClass: unknown;
initiated: Date;
}[];
prefixes: {
prefix: string;
}[];
isTruncated: boolean;
nextKeyMarker: string;
nextUploadIdMarker: string;
};
export declare function parseListMultipart(xml: string): ListMultipartResult;
export declare function parseObjectLockConfig(xml: string): ObjectLockInfo;
export declare function parseBucketVersioningConfig(xml: string): any;
export declare function parseSelectObjectContentResponse(res: Buffer): SelectResults | undefined;
export declare function parseLifecycleConfig(xml: string): any;
export declare function parseBucketEncryptionConfig(xml: string): any;
export declare function parseObjectRetentionConfig(xml: string): {
mode: any;
retainUntilDate: any;
};
export declare function removeObjectsParser(xml: string): any[];
export declare function parseCopyObject(xml: string): CopyObjectResultV1;
export declare function parseListObjects(xml: string): {
objects: ObjectInfo[];
isTruncated?: boolean | undefined;
nextMarker?: string | undefined;
versionIdMarker?: string | undefined;
};
export declare function uploadPartParser(xml: string): any;
export {};
File diff suppressed because one or more lines are too long
+66
View File
@@ -0,0 +1,66 @@
// imported from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/93cfb0ec069731dcdfc31464788613f7cddb8192/types/minio/index.d.ts
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { LEGAL_HOLD_STATUS, RETENTION_MODES, RETENTION_VALIDITY_UNITS } from "./helpers.js";
import type { ClientOptions, NoResultCallback, RemoveOptions } from "./internal/client.js";
import { TypedClient } from "./internal/client.js";
import { CopyConditions } from "./internal/copy-conditions.js";
import { PostPolicy } from "./internal/post-policy.js";
import type { BucketItem, BucketItemCopy, BucketItemFromList, BucketItemStat, BucketItemWithMetadata, BucketStream, EmptyObject, ExistingObjectReplication, GetObjectLegalHoldOptions, IncompleteUploadedBucketItem, InputSerialization, IsoDate, ItemBucketMetadata, ItemBucketMetadataList, LegalHoldStatus, LifecycleConfig, LifecycleRule, MetadataItem, ObjectLockInfo, OutputSerialization, PutObjectLegalHoldOptions, ReplicaModifications, ReplicationConfig, ReplicationConfigOpts, ReplicationRule, ReplicationRuleAnd, ReplicationRuleDestination, ReplicationRuleFilter, ReplicationRuleStatus, ResultCallback, Retention, RetentionOptions, ScanRange, SelectOptions, SelectProgress, SourceSelectionCriteria, Tag } from "./internal/type.js";
import type { NotificationConfig, NotificationEvent, NotificationPoller } from "./notification.js";
export * from "./errors.js";
export * from "./helpers.js";
export type { Region } from "./internal/s3-endpoints.js";
export type * from "./notification.js";
export * from "./notification.js";
export { CopyConditions, PostPolicy };
export type { MakeBucketOpt } from "./internal/client.js";
export type { BucketItem, BucketItemCopy, BucketItemFromList, BucketItemStat, BucketItemWithMetadata, BucketStream, ClientOptions, EmptyObject, ExistingObjectReplication, GetObjectLegalHoldOptions, IncompleteUploadedBucketItem, InputSerialization, IsoDate, ItemBucketMetadata, ItemBucketMetadataList, LegalHoldStatus, LifecycleConfig, LifecycleRule, MetadataItem, NoResultCallback, ObjectLockInfo, OutputSerialization, PutObjectLegalHoldOptions, RemoveOptions, ReplicaModifications, ReplicationConfig, ReplicationConfigOpts, ReplicationRule, ReplicationRuleAnd, ReplicationRuleDestination, ReplicationRuleFilter, ReplicationRuleStatus, Retention, RetentionOptions, ScanRange, SelectOptions, SelectProgress, SourceSelectionCriteria, Tag };
/**
* @deprecated keep for backward compatible, use `RETENTION_MODES` instead
*/
export type Mode = RETENTION_MODES;
/**
* @deprecated keep for backward compatible
*/
export type LockUnit = RETENTION_VALIDITY_UNITS;
export type VersioningConfig = Record<string | number | symbol, unknown>;
export type TagList = Record<string, string>;
export interface PostPolicyResult {
postURL: string;
formData: {
[key: string]: any;
};
}
export interface LockConfig {
mode: RETENTION_MODES;
unit: RETENTION_VALIDITY_UNITS;
validity: number;
}
export interface LegalHoldOptions {
versionId: string;
status: LEGAL_HOLD_STATUS;
}
export interface SourceObjectStats {
size: number;
metaData: string;
lastModicied: Date;
versionId: string;
etag: string;
}
// Exports from library
export class Client extends TypedClient {
listObjectsV2(bucketName: string, prefix?: string, recursive?: boolean, startAfter?: string): BucketStream<BucketItem>;
// Bucket Policy & Notification operations
getBucketNotification(bucketName: string, callback: ResultCallback<NotificationConfig>): void;
getBucketNotification(bucketName: string): Promise<NotificationConfig>;
setBucketNotification(bucketName: string, bucketNotificationConfig: NotificationConfig, callback: NoResultCallback): void;
setBucketNotification(bucketName: string, bucketNotificationConfig: NotificationConfig): Promise<void>;
removeAllBucketNotification(bucketName: string, callback: NoResultCallback): void;
removeAllBucketNotification(bucketName: string): Promise<void>;
listenBucketNotification(bucketName: string, prefix: string, suffix: string, events: NotificationEvent[]): NotificationPoller;
}
File diff suppressed because one or more lines are too long
+58
View File
@@ -0,0 +1,58 @@
import { EventEmitter } from 'eventemitter3';
import type { TypedClient } from "./internal/client.js";
type Event = unknown;
export declare class TargetConfig {
private Filter?;
private Event?;
private Id;
setId(id: unknown): void;
addEvent(newevent: Event): void;
addFilterSuffix(suffix: string): void;
addFilterPrefix(prefix: string): void;
}
export declare class TopicConfig extends TargetConfig {
private Topic;
constructor(arn: string);
}
export declare class QueueConfig extends TargetConfig {
private Queue;
constructor(arn: string);
}
export declare class CloudFunctionConfig extends TargetConfig {
private CloudFunction;
constructor(arn: string);
}
export declare class NotificationConfig {
private TopicConfiguration?;
private CloudFunctionConfiguration?;
private QueueConfiguration?;
add(target: TargetConfig): void;
}
export declare const buildARN: (partition: string, service: string, region: string, accountId: string, resource: string) => string;
export declare const ObjectCreatedAll = "s3:ObjectCreated:*";
export declare const ObjectCreatedPut = "s3:ObjectCreated:Put";
export declare const ObjectCreatedPost = "s3:ObjectCreated:Post";
export declare const ObjectCreatedCopy = "s3:ObjectCreated:Copy";
export declare const ObjectCreatedCompleteMultipartUpload = "s3:ObjectCreated:CompleteMultipartUpload";
export declare const ObjectRemovedAll = "s3:ObjectRemoved:*";
export declare const ObjectRemovedDelete = "s3:ObjectRemoved:Delete";
export declare const ObjectRemovedDeleteMarkerCreated = "s3:ObjectRemoved:DeleteMarkerCreated";
export declare const ObjectReducedRedundancyLostObject = "s3:ReducedRedundancyLostObject";
export type NotificationEvent = 's3:ObjectCreated:*' | 's3:ObjectCreated:Put' | 's3:ObjectCreated:Post' | 's3:ObjectCreated:Copy' | 's3:ObjectCreated:CompleteMultipartUpload' | 's3:ObjectRemoved:*' | 's3:ObjectRemoved:Delete' | 's3:ObjectRemoved:DeleteMarkerCreated' | 's3:ReducedRedundancyLostObject' | 's3:TestEvent' | 's3:ObjectRestore:Post' | 's3:ObjectRestore:Completed' | 's3:Replication:OperationFailedReplication' | 's3:Replication:OperationMissedThreshold' | 's3:Replication:OperationReplicatedAfterThreshold' | 's3:Replication:OperationNotTracked' | string;
export type NotificationRecord = unknown;
export declare class NotificationPoller extends EventEmitter<{
notification: (event: NotificationRecord) => void;
error: (error: unknown) => void;
}> {
private client;
private bucketName;
private prefix;
private suffix;
private events;
private ending;
constructor(client: TypedClient, bucketName: string, prefix: string, suffix: string, events: NotificationEvent[]);
start(): void;
stop(): void;
checkForChanges(): void;
}
export {};
File diff suppressed because one or more lines are too long
+36
View File
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.promisify = promisify;
// Returns a wrapper function that will promisify a given callback function.
// It will preserve 'this'.
function promisify(fn) {
return function () {
// If the last argument is a function, assume its the callback.
let callback = arguments[arguments.length - 1];
// If the callback is given, don't promisify, just pass straight in.
if (typeof callback === 'function') {
return fn.apply(this, arguments);
}
// Otherwise, create a new set of arguments, and wrap
// it in a promise.
let args = [...arguments];
return new Promise((resolve, reject) => {
// Add the callback function.
args.push((err, value) => {
if (err) {
return reject(err);
}
resolve(value);
});
// Call the function with our special adaptor callback added.
fn.apply(this, args);
});
};
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJwcm9taXNpZnkiLCJmbiIsImNhbGxiYWNrIiwiYXJndW1lbnRzIiwibGVuZ3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ENBQUM7RUFDSixDQUFDO0FBQ0gifQ==
+5
View File
@@ -0,0 +1,5 @@
import type { IRequest } from "./internal/type.js";
export declare function postPresignSignatureV4(region: string, date: Date, secretKey: string, policyBase64: string): string;
export declare function signV4(request: IRequest, accessKey: string, secretKey: string, region: string, requestDate: Date, sha256sum: string, serviceName?: string): string;
export declare function signV4ByServiceName(request: IRequest, accessKey: string, secretKey: string, region: string, requestDate: Date, contentSha256: string, serviceName?: string): string;
export declare function presignSignatureV4(request: IRequest, accessKey: string, secretKey: string, sessionToken: string | undefined, region: string, requestDate: Date, expires: number | undefined): string;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../fast-xml-parser/src/cli/cli.js" "$@"
else
exec node "$basedir/../fast-xml-parser/src/cli/cli.js" "$@"
fi
+17
View File
@@ -0,0 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\fast-xml-parser\src\cli\cli.js" %*
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../fast-xml-parser/src/cli/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../fast-xml-parser/src/cli/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../fast-xml-parser/src/cli/cli.js" $args
} else {
& "node$exe" "$basedir/../fast-xml-parser/src/cli/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret
@@ -0,0 +1,606 @@
<small>Note: If you find missing information about particular minor version, that version must have been changed without any functional change in this library.</small>
**4.5.2 / 2025-02-18**
- Fix null CDATA to comply with undefined behavior (#701) (By [Matthieu BOHEAS](https://github.com/Kelgors))
- Fix(performance): Update check for leaf node in saveTextToParentTag function in OrderedObjParser.js (#707) (By [...](https://github.com/tomingtoming))
- Fix: emit full JSON string from CLI when no output filename specified (#710) (By [Matt Benson](https://github.com/mbenson))
**4.5.1 / 2024-12-15**
- Fix empty tag key name for v5 (#697). no impact on v4
- Fixes entity parsing when used in strict mode (#699)
**4.5.0 / 2024-09-03**
- feat #666: ignoreAttributes support function, and array of string or regex (By [ArtemM](https://github.com/mav-rik))
**4.4.1 / 2024-07-28**
- v5 fix: maximum length limit to currency value
- fix #634: build attributes with oneListGroup and attributesGroupName (#653)(By [Andreas Naziris](https://github.com/a-rasin))
- fix: get oneListGroup to work as expected for array of strings (#662)(By [Andreas Naziris](https://github.com/a-rasin))
**4.4.0 / 2024-05-18**
- fix #654: parse attribute list correctly for self closing stop node.
- fix: validator bug when closing tag is not opened. (#647) (By [Ryosuke Fukatani](https://github.com/RyosukeFukatani))
- fix #581: typings; return type of `tagValueProcessor` & `attributeValueProcessor` (#582) (By [monholm]())
**4.3.6 / 2024-03-16**
- Add support for parsing HTML numeric entities (#645) (By [Jonas Schade ](https://github.com/DerZade))
**4.3.5 / 2024-02-24**
- code for v5 is added for experimental use
**4.3.4 / 2024-01-10**
- fix: Don't escape entities in CDATA sections (#633) (By [wackbyte](https://github.com/wackbyte))
**4.3.3 / 2024-01-10**
- Remove unnecessary regex
**4.3.2 / 2023-10-02**
- fix `jObj.hasOwnProperty` when give input is null (By [Arda TANRIKULU](https://github.com/ardatan))
**4.3.1 / 2023-09-24**
- revert back "Fix typings for builder and parser to make return type generic" to avoid failure of existing projects. Need to decide a common approach.
**4.3.0 / 2023-09-20**
- Fix stopNodes to work with removeNSPrefix (#607) (#608) (By [Craig Andrews]https://github.com/candrews))
- Fix #610 ignore properties set to Object.prototype
- Fix typings for builder and parser to make return type generic (By [Sarah Dayan](https://github.com/sarahdayan))
**4.2.7 / 2023-07-30**
- Fix: builder should set text node correctly when only textnode is present (#589) (By [qianqing](https://github.com/joneqian))
- Fix: Fix for null and undefined attributes when building xml (#585) (#598). A null or undefined value should be ignored. (By [Eugenio Ceschia](https://github.com/cecia234))
**4.2.6 / 2023-07-17**
- Fix: Remove trailing slash from jPath for self-closing tags (#595) (By [Maciej Radzikowski](https://github.com/m-radzikowski))
**4.2.5 / 2023-06-22**
- change code implementation
**4.2.4 / 2023-06-06**
- fix security bug
**4.2.3 / 2023-06-05**
- fix security bug
**4.2.2 / 2023-04-18**
- fix #562: fix unpaired tag when it comes in last of a nested tag. Also throw error when unpaired tag is used as closing tag
**4.2.1 / 2023-04-18**
- fix: jpath after unpaired tags
**4.2.0 / 2023-04-09**
- support `updateTag` parser property
**4.1.4 / 2023-04-08**
- update typings to let user create XMLBuilder instance without options (#556) (By [Patrick](https://github.com/omggga))
- fix: IsArray option isn't parsing tags with 0 as value correctly #490 (#557) (By [Aleksandr Murashkin](https://github.com/p-kuen))
- feature: support `oneListGroup` to group repeated children tags udder single group
**4.1.3 / 2023-02-26**
- fix #546: Support complex entity value
**4.1.2 / 2023-02-12**
- Security Fix
**4.1.1 / 2023-02-03**
- Fix #540: ignoreAttributes breaks unpairedTags
- Refactor XML builder code
**4.1.0 / 2023-02-02**
- Fix '<' or '>' in DTD comment throwing an error. (#533) (By [Adam Baker](https://github.com/Cwazywierdo))
- Set "eNotation" to 'true' as default
**4.0.15 / 2023-01-25**
- make "eNotation" optional
**4.0.14 / 2023-01-22**
- fixed: add missed typing "eNotation" to parse values
**4.0.13 / 2023-01-07**
- preserveorder formatting (By [mdeknowis](https://github.com/mdeknowis))
- support `transformAttributeName` (By [Erik Rothoff Andersson](https://github.com/erkie))
**4.0.12 / 2022-11-19**
- fix typescript
**4.0.11 / 2022-10-05**
- fix #501: parse for entities only once
**4.0.10 / 2022-09-14**
- fix broken links in demo site (By [Yannick Lang](https://github.com/layaxx))
- fix #491: tagValueProcessor type definition (By [Andrea Francesco Speziale](https://github.com/andreafspeziale))
- Add jsdocs for tagValueProcessor
**4.0.9 / 2022-07-10**
- fix #470: stop-tag can have self-closing tag with same name
- fix #472: stopNode can have any special tag inside
- Allow !ATTLIST and !NOTATION with DOCTYPE
- Add transformTagName option to transform tag names when parsing (#469) (By [Erik Rothoff Andersson](https://github.com/erkie))
**4.0.8 / 2022-05-28**
- Fix CDATA parsing returning empty string when value = 0 (#451) (By [ndelanou](https://github.com/ndelanou))
- Fix stopNodes when same tag appears inside node (#456) (By [patrickshipe](https://github.com/patrickshipe))
- fix #468: prettify own properties only
**4.0.7 / 2022-03-18**
- support CDATA even if tag order is not preserved
- support Comments even if tag order is not preserved
- fix #446: XMLbuilder should not indent XML declaration
**4.0.6 / 2022-03-08**
- fix: call tagValueProcessor only once for array items
- fix: missing changed for #437
**4.0.5 / 2022-03-06**
- fix #437: call tagValueProcessor from XML builder
**4.0.4 / 2022-03-03**
- fix #435: should skip unpaired and self-closing nodes when set as stopnodes
**4.0.3 / 2022-02-15**
- fix: ReferenceError when Bundled with Strict (#431) (By [Andreas Heissenberger](https://github.com/aheissenberger))
**4.0.2 / 2022-02-04**
- builder supports `suppressUnpairedNode`
- parser supports `ignoreDeclaration` and `ignorePiTags`
- fix: when comment is parsed as text value if given as `<!--> ...` #423
- builder supports decoding `&`
**4.0.1 / 2022-01-08**
- fix builder for pi tag
- fix: support suppressBooleanAttrs by builder
**4.0.0 / 2022-01-06**
- Generating different combined, parser only, builder only, validator only browser bundles
- Keeping cjs modules as they can be imported in cjs and esm modules both. Otherwise refer `esm` branch.
**4.0.0-beta.8 / 2021-12-13**
- call tagValueProcessor for stop nodes
**4.0.0-beta.7 / 2021-12-09**
- fix Validator bug when an attribute has no value but '=' only
- XML Builder should suppress unpaired tags by default.
- documents update for missing features
- refactoring to use Object.assign
- refactoring to remove repeated code
**4.0.0-beta.6 / 2021-12-05**
- Support PI Tags processing
- Support `suppressBooleanAttributes` by XML Builder for attributes with value `true`.
**4.0.0-beta.5 / 2021-12-04**
- fix: when a tag with name "attributes"
**4.0.0-beta.4 / 2021-12-02**
- Support HTML document parsing
- skip stop nodes parsing when building the XML from JS object
- Support external entites without DOCTYPE
- update dev dependency: strnum v1.0.5 to fix long number issue
**4.0.0-beta.3 / 2021-11-30**
- support global stopNodes expression like "*.stop"
- support self-closing and paired unpaired tags
- fix: CDATA should not be parsed.
- Fix typings for XMLBuilder (#396)(By [Anders Emil Salvesen](https://github.com/andersem))
- supports XML entities, HTML entities, DOCTYPE entities
**⚠️ 4.0.0-beta.2 / 2021-11-19**
- rename `attrMap` to `attibutes` in parser output when `preserveOrder:true`
- supports unpairedTags
**⚠️ 4.0.0-beta.1 / 2021-11-18**
- Parser returns an array now
- to make the structure common
- and to return root level detail
- renamed `cdataTagName` to `cdataPropName`
- Added `commentPropName`
- fix typings
**⚠️ 4.0.0-beta.0 / 2021-11-16**
- Name change of many configuration properties.
- `attrNodeName` to `attributesGroupName`
- `attrValueProcessor` to `attributeValueProcessor`
- `parseNodeValue` to `parseTagValue`
- `ignoreNameSpace` to `removeNSPrefix`
- `numParseOptions` to `numberParseOptions`
- spelling correction for `suppressEmptyNode`
- Name change of cli and browser bundle to **fxparser**
- `isArray` option is added to parse a tag into array
- `preserveOrder` option is added to render XML in such a way that the result js Object maintains the order of properties same as in XML.
- Processing behaviour of `tagValueProcessor` and `attributeValueProcessor` are changes with extra input parameters
- j2xparser is renamed to XMLBuilder.
- You need to build XML parser instance for given options first before parsing XML.
- fix #327, #336: throw error when extra text after XML content
- fix #330: attribute value can have '\n',
- fix #350: attrbiutes can be separated by '\n' from tagname
3.21.1 / 2021-10-31
- Correctly format JSON elements with a text prop but no attribute props ( By [haddadnj](https://github.com/haddadnj) )
3.21.0 / 2021-10-25
- feat: added option `rootNodeName` to set tag name for array input when converting js object to XML.
- feat: added option `alwaysCreateTextNode` to force text node creation (by: *@massimo-ua*)
- ⚠️ feat: Better error location for unclosed tags. (by *@Gei0r*)
- Some error messages would be changed when validating XML. Eg
- `{ InvalidXml: "Invalid '[ \"rootNode\"]' found." }``{InvalidTag: "Unclosed tag 'rootNode'."}`
- `{ InvalidTag: "Closing tag 'rootNode' is expected inplace of 'rootnode'." }``{ InvalidTag: "Expected closing tag 'rootNode' (opened in line 1) instead of closing tag 'rootnode'."}`
- ⚠️ feat: Column in error response when validating XML
```js
{
"code": "InvalidAttr",
"msg": "Attribute 'abc' is repeated.",
"line": 1,
"col": 22
}
```
3.20.1 / 2021-09-25
- update strnum package
3.20.0 / 2021-09-10
- Use strnum npm package to parse string to number
- breaking change: long number will be parsed to scientific notation.
3.19.0 / 2021-03-14
- License changed to MIT original
- Fix #321 : namespace tag parsing
3.18.0 / 2021-02-05
- Support RegEx and function in arrayMode option
- Fix #317 : validate nested PI tags
3.17.4 / 2020-06-07
- Refactor some code to support IE11
- Fix: `<tag >` space as attribute string
3.17.3 / 2020-05-23
- Fix: tag name separated by \n \t
- Fix: throw error for unclosed tags
3.17.2 / 2020-05-23
- Fixed an issue in processing doctype tag
- Fixed tagName where it should not have whitespace chars
3.17.1 / 2020-05-19
- Fixed an issue in checking opening tag
3.17.0 / 2020-05-18
- parser: fix '<' issue when it comes in aatr value
- parser: refactoring to remove dependency from regex
- validator: fix IE 11 issue for error messages
- updated dev dependencies
- separated benchmark module to sub-module
- breaking change: comments will not be removed from CDATA data
3.16.0 / 2020-01-12
- validaor: fix for ampersand characters (#215)
- refactoring to support unicode chars in tag name
- update typing for validator error
3.15.1 / 2019-12-09
- validaor: fix multiple roots are not allowed
3.15.0 / 2019-11-23
- validaor: improve error messaging
- validator: add line number in case of error
- validator: add more error scenarios to make it more descriptive
3.14.0 / 2019-10-25
- arrayMode for XML to JS obj parsing
3.13.0 / 2019-10-02
- pass tag/attr name to tag/attr value processor
- inbuilt optional validation with XML parser
3.12.21 / 2019-10-02
- Fix validator for unclosed XMLs
- move nimnjs dependency to dev dependency
- update dependencies
3.12.20 / 2019-08-16
- Revert: Fix #167: '>' in attribute value as it is causing high performance degrade.
3.12.19 / 2019-07-28
- Fix js to xml parser should work for date values. (broken: `tagValueProcessor` will receive the original value instead of string always) (breaking change)
3.12.18 / 2019-07-27
- remove configstore dependency
3.12.17 / 2019-07-14
- Fix #167: '>' in attribute value
3.12.16 / 2019-03-23
- Support a new option "stopNodes". (#150)
Accept the list of tags which are not required to be parsed. Instead, all the nested tag and data will be assigned as string.
- Don't show post-install message
3.12.12 / 2019-01-11
- fix : IE parseInt, parseFloat error
3.12.11 / 2018-12-24
- fix #132: "/" should not be parsed as boolean attr in case of self closing tags
3.12.9 / 2018-11-23
- fix #129 : validator should not fail when an atrribute name is 'length'
3.12.8 / 2018-11-22
- fix #128 : use 'attrValueProcessor' to process attribute value in json2xml parser
3.12.6 / 2018-11-10
- Fix #126: check for type
3.12.4 / 2018-09-12
- Fix: include tasks in npm package
3.12.3 / 2018-09-12
- Fix CLI issue raised in last PR
3.12.2 / 2018-09-11
- Fix formatting for JSON to XML output
- Migrate to webpack (PR merged)
- fix cli (PR merged)
3.12.0 / 2018-08-06
- Support hexadecimal values
- Support true number parsing
3.11.2 / 2018-07-23
- Update Demo for more options
- Update license information
- Update readme for formatting, users, and spelling mistakes
- Add missing typescript definition for j2xParser
- refactoring: change filenames
3.11.1 / 2018-06-05
- fix #93: read the text after self closing tag
3.11.0 / 2018-05-20
- return defaultOptions if there are not options in buildOptions function
- added localeRange declaration in parser.d.ts
- Added support of cyrillic characters in validator XML
- fixed bug in validator work when XML data with byte order marker
3.10.0 / 2018-05-13
- Added support of cyrillic characters in parsing XML to JSON
3.9.11 / 2018-05-09
- fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/80 fix nimn chars
- update package information
- fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/86: json 2 xml parser : property with null value should be parsed to self closing tag.
- update online demo
- revert zombiejs to old version to support old version of node
- update dependencies
3.3.10 / 2018-04-23
- fix #77 : parse even if closing tag has space before '>'
- include all css & js lib in demo app
- remove babel dependencies until needed
3.3.9 / 2018-04-18
- fix #74 : TS2314 TypeScript compiler error
3.3.8 / 2018-04-17
- fix #73 : IE doesn't support Object.assign
3.3.7 / 2018-04-14
- fix: use let insted of const in for loop of validator
- Merge pull request
https://github.com/NaturalIntelligence/fast-xml-parser/issues/71 from bb/master
first draft of typings for typescript
https://github.com/NaturalIntelligence/fast-xml-parser/issues/69
- Merge pull request
https://github.com/NaturalIntelligence/fast-xml-parser/issues/70 from bb/patch-1
fix some typos in readme
3.3.6 / 2018-03-21
- change arrow functions to full notation for IE compatibility
3.3.5 / 2018-03-15
- fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/67 : attrNodeName invalid behavior
- fix: remove decodeHTML char condition
3.3.4 / 2018-03-14
- remove dependency on "he" package
- refactor code to separate methods in separate files.
- draft code for transforming XML to json string. It is not officially documented due to performance issue.
3.3.0 / 2018-03-05
- use common default options for XML parsing for consistency. And add `parseToNimn` method.
- update nexttodo
- update README about XML to Nimn transformation and remove special notes about 3.x release
- update CONTRIBUTING.ms mentioning nexttodo
- add negative case for XML PIs
- validate xml processing instruction tags https://github.com/NaturalIntelligence/fast-xml-parser/issues/62
- nimndata: handle array with object
- nimndata: node with nested node and text node
- nimndata: handle attributes and text node
- nimndata: add options, handle array
- add xml to nimn data converter
- x2j: direct access property with tagname
- update changelog
- fix validator when single quote presents in value enclosed with double quotes or vice versa
- Revert "remove unneded nimnjs dependency, move opencollective to devDependencies and replace it
with more light opencollective-postinstall"
This reverts commit d47aa7181075d82db4fee97fd8ea32b056fe3f46.
- Merge pull request: https://github.com/NaturalIntelligence/fast-xml-parser/issues/63 from HaroldPutman/suppress-undefined
Keep undefined nodes out of the XML output : This is useful when you are deleting nodes from the JSON and rewriting XML.
3.2.4 / 2018-03-01
- fix #59 fix in validator when open quote presents in attribute value
- Create nexttodo.md
- exclude static from bitHound tests
- add package lock
3.2.3 / 2018-02-28
- Merge pull request from Delagen/master: fix namespaces can contain the same characters as xml names
3.2.2 / 2018-02-22
- fix: attribute xmlns should not be removed if ignoreNameSpace is false
- create CONTRIBUTING.md
3.2.1 / 2018-02-17
- fix: empty attribute should be parsed
3.2.0 / 2018-02-16
- Merge pull request : Dev to Master
- Update README and version
- j2x:add performance test
- j2x: Remove extra empty line before closing tag
- j2x: suppress empty nodes to self closing node if configured
- j2x: provide option to give indentation depth
- j2x: make optional formatting
- j2x: encodeHTMLchat
- j2x: handle cdata tag
- j2x: handle grouped attributes
- convert json to xml
- nested object
- array
- attributes
- text value
- small refactoring
- Merge pull request: Update cli.js to let user validate XML file or data
- Add option for rendering CDATA as separate property
3.0.1 / 2018-02-09
- fix CRLF: replace it with single space in attributes value only.
3.0.0 / 2018-02-08
- change online tool with new changes
- update info about new options
- separate tag value processing to separate function
- make HTML decoding optional
- give an option to allow boolean attributes
- change cli options as per v3
- Correct comparison table format on README
- update v3 information
- some performance improvement changes
- Make regex object local to the method and move some common methods to util
- Change parser to
- handle multiple instances of CDATA
- make triming of value optionals
- HTML decode attribute and text value
- refactor code to separate files
- Ignore newline chars without RE (in validator)
- validate for XML prolog
- Validate DOCTYPE without RE
- Update validator to return error response
- Update README to add detail about V3
- Separate xmlNode model class
- include vscode debug config
- fix for repeated object
- fix attribute regex for boolean attributes
- Fix validator for invalid attributes
2.9.4 / 2018-02-02
- Merge pull request: Decode HTML characters
- refactor source folder name
- ignore bundle / browser js to be published to npm
2.9.3 / 2018-01-26
- Merge pull request: Correctly remove CRLF line breaks
- Enable to parse attribute in online editor
- Fix testing demo app test
- Describe parsing options
- Add options for online demo
2.9.2 / 2018-01-18
- Remove check if tag starting with "XML"
- Fix: when there are spaces before / after CDATA
2.9.1 / 2018-01-16
- Fix: newline should be replaced with single space
- Fix: for single and multiline comments
- validate xml with CDATA
- Fix: the issue when there is no space between 2 attributes
- Fix: https://github.com/NaturalIntelligence/fast-xml-parser/issues/33: when there is newline char in attr val, it doesn't parse
- Merge pull request: fix ignoreNamespace
- fix: don't wrap attributes if only namespace attrs
- fix: use portfinder for run tests, update deps
- fix: don't treat namespaces as attributes when ignoreNamespace enabled
2.9.0 / 2018-01-10
- Rewrite the validator to handle large files.
Ignore DOCTYPE validation.
- Fix: When attribute value has equal sign
2.8.3 / 2017-12-15
- Fix: when a tag has value along with subtags
2.8.2 / 2017-12-04
- Fix value parsing for IE
2.8.1 / 2017-12-01
- fix: validator should return false instead of err when invalid XML
2.8.0 / 2017-11-29
- Add CLI option to ignore value conversion
- Fix variable name when filename is given on CLI
- Update CLI help text
- Merge pull request: xml2js: Accept standard input
- Test Node 8
- Update dependencies
- Bundle readToEnd
- Add ability to read from standard input
2.7.4 / 2017-09-22
- Merge pull request: Allow wrap attributes with subobject to compatible with other parsers output
2.7.3 / 2017-08-02
- fix: handle CDATA with regx
2.7.2 / 2017-07-30
- Change travis config for yarn caching
- fix validator: when tag property is same as array property
- Merge pull request: Failing test case in validator for valid SVG
2.7.1 / 2017-07-26
- Fix: Handle val 0
2.7.0 / 2017-07-25
- Fix test for arrayMode
- Merge pull request: Add arrayMode option to parse any nodes as arrays
2.6.0 / 2017-07-14
- code improvement
- Add unit tests for value conversion for attr
- Merge pull request: option of an attribute value conversion to a number (textAttrConversion) the same way as the textNodeConversion option does. Default value is false.
2.5.1 / 2017-07-01
- Fix XML element name pattern
- Fix XML element name pattern while parsing
- Fix validation for xml tag element
2.5.0 / 2017-06-25
- Improve Validator performance
- update attr matching regex
- Add perf tests
- Improve atrr regex to handle all cases
2.4.4 / 2017-06-08
- Bug fix: when an attribute has single or double quote in value
2.4.3 / 2017-06-05
- Bug fix: when multiple CDATA tags are given
- Merge pull request: add option "textNodeConversion"
- add option "textNodeConversion"
2.4.1 / 2017-04-14
- fix tests
- Bug fix: preserve initial space of node value
- Handle CDATA
2.3.1 / 2017-03-15
- Bug fix: when single self closing tag
- Merge pull request: fix .codeclimate.yml
- Update .codeclimate.yml - Fixed config so it does not error anymore.
- Update .codeclimate.yml
2.3.0 / 2017-02-26
- Code improvement
- add bithound config
- Update usage
- Update travis to generate bundle js before running tests
- 1.Browserify, 2. add more tests for validator
- Add validator
- Fix CLI default parameter bug
2.2.1 / 2017-02-05
- Bug fix: CLI default option

Some files were not shown because too many files have changed in this diff Show More