@qrvey/object-storage 1.0.2-beta → 1.0.3-535

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