@qrvey/object-storage 1.0.3 → 1.0.5-dev-dp-3026

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,6 @@ type GetObjectResponse = {
41
41
  contentDisposition?: string;
42
42
  contentLanguage?: string;
43
43
  body?: Readable;
44
- content?: Readable;
45
44
  };
46
45
 
47
46
  type GetUploadUrlResponse = {
@@ -58,16 +57,9 @@ type CreateUploadWriteStreamResponse = {
58
57
  type HeadBucketResponse = HeadBucketCommandOutput | ContainerGetPropertiesResponse;
59
58
 
60
59
  type ObjectStorageOptions = {
61
- region?: string;
62
- credentials?: AwsCredentialIdentity;
63
- provider?: string;
64
- connectionString?: string;
65
- host?: string;
66
- port?: string | number;
67
- user?: string;
68
- password?: string;
69
- privateKey?: string | Buffer;
70
- secure?: boolean;
60
+ region: string;
61
+ credentials: AwsCredentialIdentity;
62
+ provider: string;
71
63
  };
72
64
 
73
65
  type ListPartsMultipartUploadResponse = {
@@ -141,57 +133,49 @@ declare class ObjectStorageService {
141
133
  *
142
134
  * @param {ListRequestOptions} options - The options to apply to the list operation.
143
135
  * @param {string} [bucketName] - The name of the bucket to list objects from. If not provided, the default bucket name will be used.
144
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
145
136
  * @return {Promise<ListResponse>} A promise that resolves to the list of objects.
146
137
  */
147
- static list(options: ListRequestOptions, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<ListResponse>;
138
+ static list(options: ListRequestOptions, bucketName?: string): Promise<ListResponse>;
148
139
  /**
149
140
  * Retrieves a list of all objects from the object storage service.
150
141
  *
151
142
  * @param {ListRequestOptions} options - The options to apply to the list operation.
152
143
  * @param {string} [bucketName] - The name of the bucket to list objects from. If not provided, the default bucket name will be used.
153
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
154
144
  * @return {Promise<ListResponse>} A promise that resolves to the list of all objects.
155
145
  */
156
- static listAll(options: ListRequestOptions, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<ListResponse>;
146
+ static listAll(options: ListRequestOptions, bucketName?: string): Promise<ListResponse>;
157
147
  /**
158
148
  * Retrieves an object from the object storage service.
159
149
  *
160
150
  * @param {string} key - The key of the object to retrieve.
161
151
  * @param {string} [bucketName] - The name of the bucket where the object is stored. If not provided, the default bucket name will be used.
162
- * @param {IGetObjectOptions} [options] - The options to apply to the get operation.
163
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
164
152
  * @return {Promise<GetObjectResponse>} A promise that resolves to the retrieved object.
165
153
  */
166
- static getObject(key: string, bucketName?: string, options?: IGetObjectOptions, objectStorageOptions?: ObjectStorageOptions): Promise<GetObjectResponse>;
154
+ static getObject(key: string, bucketName?: string, options?: IGetObjectOptions): Promise<GetObjectResponse>;
167
155
  /**
168
156
  * Retrieves an object info (without file content) from the object storage service.
169
157
  * @param key - The key of the object to retrieve.
170
- * @param bucketName - The name of the bucket where the object is stored. If not provided, the default bucket name will be used.
171
- * @param objectStorageOptions - The options for the object storage service.
172
158
  * @returns A promise that resolves to the info of the file.
173
159
  */
174
- static getHeadObject(key: string, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<GetObjectResponse>;
160
+ static getHeadObject(key: string, bucketName?: string): Promise<GetObjectResponse>;
175
161
  /**
176
162
  * Retrieves a signed URL for the specified object in the object storage service.
177
163
  *
178
164
  * @param {string} key - The key of the object for which to generate the signed URL.
179
165
  * @param {number} expiresInMinutes - The number of minutes until the signed URL expires.
180
166
  * @param {string} [bucketName] - The name of the bucket where the object is stored. If not provided, the default bucket name will be used.
181
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
182
167
  * @return {Promise<string>} A promise that resolves to the generated signed URL.
183
168
  */
184
- static getDownloadUrl(key: string, expiresInMinutes: number, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<string>;
169
+ static getDownloadUrl(key: string, expiresInMinutes: number, bucketName?: string): Promise<string>;
185
170
  /**
186
171
  * Retrieves an upload URL for the specified object in the object storage service.
187
172
  *
188
173
  * @param {string} key - The key of the object for which to generate the upload URL.
189
174
  * @param {number} expiresInMinutes - The number of minutes until the upload URL expires.
190
175
  * @param {string} [bucketName] - The name of the bucket where the object will be stored. If not provided, the default bucket name will be used.
191
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
192
176
  * @return {Promise<string>} A promise that resolves to the generated upload URL.
193
177
  */
194
- static getUploadUrl(key: string, expiresInMinutes: number, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<GetUploadUrlResponse>;
178
+ static getUploadUrl(key: string, expiresInMinutes: number, bucketName?: string): Promise<GetUploadUrlResponse>;
195
179
  /**
196
180
  * Uploads a file to the object storage service.
197
181
  *
@@ -199,30 +183,27 @@ declare class ObjectStorageService {
199
183
  * @param {FileContent} body - The content of the file to upload.
200
184
  * @param {Object} [metadata] - Optional metadata to associate with the object.
201
185
  * @param {string} [bucketName] - The name of the bucket where the object will be stored. If not provided, the default bucket name will be used.
202
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
203
186
  * @return {Promise<UploadResponse>} A promise that resolves to the response of the upload operation.
204
187
  */
205
188
  static upload(key: string, body: FileContent, metadata?: {
206
189
  [key: string]: string;
207
- }, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<UploadResponse>;
190
+ }, bucketName?: string): Promise<UploadResponse>;
208
191
  /**
209
192
  * Creates an upload write stream for the specified key in the object storage service.
210
193
  *
211
194
  * @param {string} key - The key of the object to create the upload write stream for.
212
195
  * @param {string} [bucketName] - The name of the bucket where the object will be stored. If not provided, the default bucket name will be used.
213
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
214
196
  * @return {Promise<CreateUploadWriteStreamResponse>} A promise that resolves to the response of the upload operation.
215
197
  */
216
- static createUploadWriteStream(key: string, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<CreateUploadWriteStreamResponse>;
198
+ static createUploadWriteStream(key: string, bucketName?: string): Promise<CreateUploadWriteStreamResponse>;
217
199
  /**
218
200
  * Deletes an object or multiple objects from the object storage service.
219
201
  *
220
202
  * @param {string | string[]} key - The key or array of keys of the objects to delete.
221
203
  * @param {string} [bucketName] - The name of the bucket where the objects are stored. If not provided, the default bucket name will be used.
222
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
223
204
  * @return {Promise<{ key: string; deleted: boolean; error?: string }[] | boolean>} A promise that resolves to an array of objects containing the key, deleted status, and an optional error message for each object deleted, or a boolean value indicating the success of the deletion.
224
205
  */
225
- static delete(key: string | string[], bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<{
206
+ static delete(key: string | string[], bucketName?: string): Promise<{
226
207
  key: string;
227
208
  deleted: boolean;
228
209
  error?: string;
@@ -231,37 +212,33 @@ declare class ObjectStorageService {
231
212
  * Retrieves the head bucket from the object storage service.
232
213
  *
233
214
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
234
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
235
215
  * @return {Promise<HeadBucketResponse>} A promise that resolves to the head bucket response.
236
216
  */
237
- static getHeadBucket(bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<HeadBucketResponse>;
217
+ static getHeadBucket(bucketName?: string): Promise<HeadBucketResponse>;
238
218
  /**
239
219
  * Generates a unique upload ID for a multipart upload.
240
220
  *
241
221
  * @param {string} key - The key of the object to upload.
242
222
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
243
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
244
223
  * @return {Promise<string>} A promise that resolves to the generated upload ID.
245
224
  */
246
- static generateUploadIdMultipart(key: string, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<string>;
225
+ static generateUploadIdMultipart(key: string, bucketName?: string): Promise<string>;
247
226
  /**
248
227
  * Retrieves a list of multipart uploads for a specified key in the object storage service.
249
228
  *
250
229
  * @param {string} key - The key of the object to retrieve uploads for.
251
230
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
252
231
  * @param {string} [uploadId] - The upload ID to filter the results by.
253
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
254
232
  * @return {Promise<ListPartsMultipartUploadResponse>} A promise that resolves to the list of multipart uploads for the specified key.
255
233
  */
256
- static listMultipartUploadsForKey(key: string, bucketName?: string, uploadId?: string, objectStorageOptions?: ObjectStorageOptions): Promise<ListPartsMultipartUploadResponse>;
234
+ static listMultipartUploadsForKey(key: string, bucketName?: string, uploadId?: string): Promise<ListPartsMultipartUploadResponse>;
257
235
  /**
258
236
  * Retrieves a list of all multipart uploads for a specified bucket in the object storage service.
259
237
  *
260
238
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
261
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
262
239
  * @return {Promise<ListMultipartUploadsResponse>} A promise that resolves to the list of multipart uploads for the specified bucket.
263
240
  */
264
- static listMultipartUploadsForBucket(bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<ListMultipartUploadsResponse>;
241
+ static listMultipartUploadsForBucket(bucketName?: string): Promise<ListMultipartUploadsResponse>;
265
242
  /**
266
243
  * Uploads a multipart file to the specified bucket in the object storage service.
267
244
  *
@@ -270,30 +247,27 @@ declare class ObjectStorageService {
270
247
  * @param {number} partNumber - The number of the part being uploaded.
271
248
  * @param {string} [uploadId] - The ID of the multipart upload.
272
249
  * @param {string} [bucketName] - The name of the bucket to upload the file to. If not provided, the default bucket name will be used.
273
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
274
250
  * @return {Promise<string>} A Promise that resolves to the base64 encoded block ID of the uploaded part.
275
251
  */
276
- static uploadMultipart(key: string, file: FileContent, partNumber: number, uploadId?: string, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<string>;
252
+ static uploadMultipart(key: string, file: FileContent, partNumber: number, uploadId?: string, bucketName?: string): Promise<string>;
277
253
  /**
278
254
  * Completes a multipart upload for the specified object in the object storage service.
279
255
  *
280
256
  * @param {string} key - The key of the object to complete the multipart upload for.
281
257
  * @param {string} uploadId - The ID of the multipart upload to complete.
282
258
  * @param {string} [bucketName] - The name of the bucket to complete the multipart upload in. If not provided, the default bucket name will be used.
283
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
284
259
  * @return {Promise<void>} A Promise that resolves when the multipart upload is completed.
285
260
  */
286
- static completeMultipartUpload(key: string, uploadId: string, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<void>;
261
+ static completeMultipartUpload(key: string, uploadId: string, bucketName?: string): Promise<void>;
287
262
  /**
288
263
  * Aborts a multipart upload for the specified object in the object storage service.
289
264
  *
290
265
  * @param {string} key - The key of the object to abort the multipart upload for.
291
266
  * @param {string} uploadId - The ID of the multipart upload to abort.
292
267
  * @param {string} [bucketName] - The name of the bucket to abort the multipart upload in. If not provided, the default bucket name will be used.
293
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
294
268
  * @return {Promise<void>} A Promise that resolves when the multipart upload is aborted.
295
269
  */
296
- static abortMultipartUpload(key: string, uploadId: string, bucketName?: string, objectStorageOptions?: ObjectStorageOptions): Promise<void>;
270
+ static abortMultipartUpload(key: string, uploadId: string, bucketName?: string): Promise<void>;
297
271
  /**
298
272
  * Retrieves a presigned URL for a specific part of a multipart upload.
299
273
  *
package/package.json CHANGED
@@ -1,18 +1,15 @@
1
1
  {
2
2
  "dependencies": {
3
- "@aws-sdk/client-s3": "3.x",
3
+ "@aws-sdk/client-s3": "3.878.0",
4
4
  "@aws-sdk/credential-provider-node": "3.774.0",
5
- "@aws-sdk/lib-storage": "3.x",
6
- "@aws-sdk/s3-request-presigner": "3.x",
5
+ "@aws-sdk/lib-storage": "3.878.0",
6
+ "@aws-sdk/s3-request-presigner": "3.878.0",
7
7
  "@azure/storage-blob": "12.23.0",
8
- "basic-ftp": "5.0.3",
9
- "ssh2-sftp-client": "9.1.0"
8
+ "@smithy/node-http-handler": "^3.0.0"
10
9
  },
11
10
  "devDependencies": {
12
11
  "@types/jest": "29.5.5",
13
- "@types/ssh2-sftp-client": "9.0.5",
14
12
  "auto-version-js": "0.3.10",
15
- "dotenv": "17.2.0",
16
13
  "eslint-config-custom": "*",
17
14
  "jest": "29.7.0",
18
15
  "ts-jest": "29.1.1",
@@ -50,11 +47,11 @@
50
47
  "build:compile:esm": "tsup --config ./tsup.config.esm.ts",
51
48
  "build:compile:types": "tsup --config ./tsup.config.types.ts",
52
49
  "prepare-publish": "yarn install && yarn test:cov && yarn build",
53
- "publish-package": "yarn prepare-publish && npm publish --tag=beta",
50
+ "publish-package": "yarn prepare-publish && npm publish --tag=dev",
54
51
  "test": "jest",
55
52
  "test:cov": "jest --coverage && chmod +x ./coverageReader.sh && sh ./coverageReader.sh",
56
53
  "type-check": "tsc"
57
54
  },
58
55
  "types": "dist/types/index.d.ts",
59
- "version": "1.0.3"
56
+ "version": "1.0.5-dev-dp-3026"
60
57
  }