@qrvey/object-storage 1.0.3 → 1.0.5-737

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.
package/dist/cjs/index.js CHANGED
@@ -6,9 +6,7 @@ var clientS3 = require('@aws-sdk/client-s3');
6
6
  var credentialProviderNode = require('@aws-sdk/credential-provider-node');
7
7
  var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
8
8
  var libStorage = require('@aws-sdk/lib-storage');
9
- var http = require('http');
10
- var https = require('https');
11
- var basicFtp = require('basic-ftp');
9
+ var nodeHttpHandler = require('@smithy/node-http-handler');
12
10
 
13
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
12
 
@@ -38,13 +36,6 @@ var __spreadValues = (a, b) => {
38
36
  return a;
39
37
  };
40
38
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
42
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
43
- }) : x)(function(x) {
44
- if (typeof require !== "undefined")
45
- return require.apply(this, arguments);
46
- throw Error('Dynamic require of "' + x + '" is not supported');
47
- });
48
39
  var __objRest = (source, exclude) => {
49
40
  var target = {};
50
41
  for (var prop in source)
@@ -146,13 +137,19 @@ var BlobStorageService = class {
146
137
  * Retrieves the properties of a blob from the container by its name.
147
138
  *
148
139
  * @param {string} blobName - The name of the blob.
149
- * @param {ObjectStorageOptions} options - The options for the object storage service.
150
140
  * @return {Promise<GetObjectResponse>} A promise that resolves to the blob properties.
151
141
  */
152
- constructor(containerName, options) {
142
+ constructor(containerName) {
153
143
  this.containerName = containerName;
144
+ let connectionString;
145
+ if (process.env.DATA_LAKE_BUCKET && process.env.DATA_LAKE_BUCKET === this.containerName) {
146
+ connectionString = process.env.AZURE_DATALAKE_CONNECTION_STRING;
147
+ }
148
+ if (!connectionString) {
149
+ connectionString = process.env.AZURE_STORAGE_CONNECTION_STRING;
150
+ }
154
151
  this.blobServiceClient = storageBlob.BlobServiceClient.fromConnectionString(
155
- (options == null ? void 0 : options.connectionString) || process.env.AZURE_STORAGE_CONNECTION_STRING
152
+ connectionString
156
153
  );
157
154
  }
158
155
  /**
@@ -572,10 +569,11 @@ var BlobStorageService = class {
572
569
  * Completes a multipart upload by committing the blocks to create the blob.
573
570
  *
574
571
  * @param {string} blobName - The name of the blob for which the multipart upload is being completed.
572
+ * @param {string} uploadId - The ID of the multipart upload to be completed.
575
573
  * @return {Promise<void>} A Promise that resolves when the multipart upload is successfully completed.
576
574
  * @throws {Error} If no block IDs are found in the metadata.
577
575
  */
578
- async completeMultipartUpload(blobName) {
576
+ async completeMultipartUpload(blobName, uploadId) {
579
577
  var _a;
580
578
  const containerClient = this.blobServiceClient.getContainerClient(
581
579
  this.containerName
@@ -642,457 +640,9 @@ function s3ObjectToObjectResponse(s3Object) {
642
640
  lastModified: s3Object.LastModified
643
641
  };
644
642
  }
645
-
646
- // node_modules/@smithy/types/dist-es/auth/auth.js
647
- var HttpAuthLocation;
648
- (function(HttpAuthLocation2) {
649
- HttpAuthLocation2["HEADER"] = "header";
650
- HttpAuthLocation2["QUERY"] = "query";
651
- })(HttpAuthLocation || (HttpAuthLocation = {}));
652
-
653
- // node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js
654
- var HttpApiKeyAuthLocation;
655
- (function(HttpApiKeyAuthLocation2) {
656
- HttpApiKeyAuthLocation2["HEADER"] = "header";
657
- HttpApiKeyAuthLocation2["QUERY"] = "query";
658
- })(HttpApiKeyAuthLocation || (HttpApiKeyAuthLocation = {}));
659
-
660
- // node_modules/@smithy/types/dist-es/endpoint.js
661
- var EndpointURLScheme;
662
- (function(EndpointURLScheme2) {
663
- EndpointURLScheme2["HTTP"] = "http";
664
- EndpointURLScheme2["HTTPS"] = "https";
665
- })(EndpointURLScheme || (EndpointURLScheme = {}));
666
-
667
- // node_modules/@smithy/types/dist-es/extensions/checksum.js
668
- var AlgorithmId;
669
- (function(AlgorithmId2) {
670
- AlgorithmId2["MD5"] = "md5";
671
- AlgorithmId2["CRC32"] = "crc32";
672
- AlgorithmId2["CRC32C"] = "crc32c";
673
- AlgorithmId2["SHA1"] = "sha1";
674
- AlgorithmId2["SHA256"] = "sha256";
675
- })(AlgorithmId || (AlgorithmId = {}));
676
-
677
- // node_modules/@smithy/types/dist-es/http.js
678
- var FieldPosition;
679
- (function(FieldPosition2) {
680
- FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER";
681
- FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER";
682
- })(FieldPosition || (FieldPosition = {}));
683
-
684
- // node_modules/@smithy/types/dist-es/profile.js
685
- var IniSectionType;
686
- (function(IniSectionType2) {
687
- IniSectionType2["PROFILE"] = "profile";
688
- IniSectionType2["SSO_SESSION"] = "sso-session";
689
- IniSectionType2["SERVICES"] = "services";
690
- })(IniSectionType || (IniSectionType = {}));
691
-
692
- // node_modules/@smithy/types/dist-es/transfer.js
693
- var RequestHandlerProtocol;
694
- (function(RequestHandlerProtocol2) {
695
- RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9";
696
- RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0";
697
- RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0";
698
- })(RequestHandlerProtocol || (RequestHandlerProtocol = {}));
699
-
700
- // node_modules/@smithy/protocol-http/dist-es/httpResponse.js
701
- var HttpResponse = class {
702
- constructor(options) {
703
- this.statusCode = options.statusCode;
704
- this.reason = options.reason;
705
- this.headers = options.headers || {};
706
- this.body = options.body;
707
- }
708
- static isInstance(response) {
709
- if (!response)
710
- return false;
711
- const resp = response;
712
- return typeof resp.statusCode === "number" && typeof resp.headers === "object";
713
- }
714
- };
715
-
716
- // node_modules/@smithy/util-uri-escape/dist-es/escape-uri.js
717
- var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
718
- var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
719
-
720
- // node_modules/@smithy/querystring-builder/dist-es/index.js
721
- function buildQueryString(query) {
722
- const parts = [];
723
- for (let key of Object.keys(query).sort()) {
724
- const value = query[key];
725
- key = escapeUri(key);
726
- if (Array.isArray(value)) {
727
- for (let i = 0, iLen = value.length; i < iLen; i++) {
728
- parts.push(`${key}=${escapeUri(value[i])}`);
729
- }
730
- } else {
731
- let qsEntry = key;
732
- if (value || typeof value === "string") {
733
- qsEntry += `=${escapeUri(value)}`;
734
- }
735
- parts.push(qsEntry);
736
- }
737
- }
738
- return parts.join("&");
739
- }
740
-
741
- // node_modules/@smithy/node-http-handler/dist-es/constants.js
742
- var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
743
-
744
- // node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js
745
- var getTransformedHeaders = (headers) => {
746
- const transformedHeaders = {};
747
- for (const name of Object.keys(headers)) {
748
- const headerValues = headers[name];
749
- transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
750
- }
751
- return transformedHeaders;
752
- };
753
-
754
- // node_modules/@smithy/node-http-handler/dist-es/timing.js
755
- var timing = {
756
- setTimeout: (cb, ms) => setTimeout(cb, ms),
757
- clearTimeout: (timeoutId) => clearTimeout(timeoutId)
758
- };
759
-
760
- // node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js
761
- var DEFER_EVENT_LISTENER_TIME = 1e3;
762
- var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
763
- if (!timeoutInMs) {
764
- return -1;
765
- }
766
- const registerTimeout = (offset) => {
767
- const timeoutId = timing.setTimeout(() => {
768
- request.destroy();
769
- reject(Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
770
- name: "TimeoutError"
771
- }));
772
- }, timeoutInMs - offset);
773
- const doWithSocket = (socket) => {
774
- if (socket == null ? void 0 : socket.connecting) {
775
- socket.on("connect", () => {
776
- timing.clearTimeout(timeoutId);
777
- });
778
- } else {
779
- timing.clearTimeout(timeoutId);
780
- }
781
- };
782
- if (request.socket) {
783
- doWithSocket(request.socket);
784
- } else {
785
- request.on("socket", doWithSocket);
786
- }
787
- };
788
- if (timeoutInMs < 2e3) {
789
- registerTimeout(0);
790
- return 0;
791
- }
792
- return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
793
- };
794
-
795
- // node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js
796
- var DEFER_EVENT_LISTENER_TIME2 = 3e3;
797
- var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
798
- if (keepAlive !== true) {
799
- return -1;
800
- }
801
- const registerListener = () => {
802
- if (request.socket) {
803
- request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
804
- } else {
805
- request.on("socket", (socket) => {
806
- socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
807
- });
808
- }
809
- };
810
- if (deferTimeMs === 0) {
811
- registerListener();
812
- return 0;
813
- }
814
- return timing.setTimeout(registerListener, deferTimeMs);
815
- };
816
-
817
- // node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js
818
- var DEFER_EVENT_LISTENER_TIME3 = 3e3;
819
- var setSocketTimeout = (request, reject, timeoutInMs = DEFAULT_REQUEST_TIMEOUT) => {
820
- const registerTimeout = (offset) => {
821
- const timeout = timeoutInMs - offset;
822
- const onTimeout = () => {
823
- request.destroy();
824
- reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
825
- };
826
- if (request.socket) {
827
- request.socket.setTimeout(timeout, onTimeout);
828
- request.on("close", () => {
829
- var _a;
830
- return (_a = request.socket) == null ? void 0 : _a.removeListener("timeout", onTimeout);
831
- });
832
- } else {
833
- request.setTimeout(timeout, onTimeout);
834
- }
835
- };
836
- if (0 < timeoutInMs && timeoutInMs < 6e3) {
837
- registerTimeout(0);
838
- return 0;
839
- }
840
- return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), DEFER_EVENT_LISTENER_TIME3);
841
- };
842
- var MIN_WAIT_TIME = 6e3;
843
- async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME) {
844
- var _a;
845
- const headers = (_a = request.headers) != null ? _a : {};
846
- const expect = headers["Expect"] || headers["expect"];
847
- let timeoutId = -1;
848
- let sendBody = true;
849
- if (expect === "100-continue") {
850
- sendBody = await Promise.race([
851
- new Promise((resolve) => {
852
- timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
853
- }),
854
- new Promise((resolve) => {
855
- httpRequest.on("continue", () => {
856
- timing.clearTimeout(timeoutId);
857
- resolve(true);
858
- });
859
- httpRequest.on("response", () => {
860
- timing.clearTimeout(timeoutId);
861
- resolve(false);
862
- });
863
- httpRequest.on("error", () => {
864
- timing.clearTimeout(timeoutId);
865
- resolve(false);
866
- });
867
- })
868
- ]);
869
- }
870
- if (sendBody) {
871
- writeBody(httpRequest, request.body);
872
- }
873
- }
874
- function writeBody(httpRequest, body) {
875
- if (body instanceof stream.Readable) {
876
- body.pipe(httpRequest);
877
- return;
878
- }
879
- if (body) {
880
- if (Buffer.isBuffer(body) || typeof body === "string") {
881
- httpRequest.end(body);
882
- return;
883
- }
884
- const uint8 = body;
885
- if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
886
- httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
887
- return;
888
- }
889
- httpRequest.end(Buffer.from(body));
890
- return;
891
- }
892
- httpRequest.end();
893
- }
894
-
895
- // node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
896
- var DEFAULT_REQUEST_TIMEOUT = 0;
897
- var NodeHttpHandler = class _NodeHttpHandler {
898
- static create(instanceOrOptions) {
899
- if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") {
900
- return instanceOrOptions;
901
- }
902
- return new _NodeHttpHandler(instanceOrOptions);
903
- }
904
- static checkSocketUsage(agent, socketWarningTimestamp, logger = console) {
905
- var _a, _b, _c, _d, _e;
906
- const { sockets, requests, maxSockets } = agent;
907
- if (typeof maxSockets !== "number" || maxSockets === Infinity) {
908
- return socketWarningTimestamp;
909
- }
910
- const interval = 15e3;
911
- if (Date.now() - interval < socketWarningTimestamp) {
912
- return socketWarningTimestamp;
913
- }
914
- if (sockets && requests) {
915
- for (const origin in sockets) {
916
- const socketsInUse = (_b = (_a = sockets[origin]) == null ? void 0 : _a.length) != null ? _b : 0;
917
- const requestsEnqueued = (_d = (_c = requests[origin]) == null ? void 0 : _c.length) != null ? _d : 0;
918
- if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
919
- (_e = logger == null ? void 0 : logger.warn) == null ? void 0 : _e.call(logger, `@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
920
- See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
921
- or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
922
- return Date.now();
923
- }
924
- }
925
- }
926
- return socketWarningTimestamp;
927
- }
928
- constructor(options) {
929
- this.socketWarningTimestamp = 0;
930
- this.metadata = { handlerProtocol: "http/1.1" };
931
- this.configProvider = new Promise((resolve, reject) => {
932
- if (typeof options === "function") {
933
- options().then((_options) => {
934
- resolve(this.resolveDefaultConfig(_options));
935
- }).catch(reject);
936
- } else {
937
- resolve(this.resolveDefaultConfig(options));
938
- }
939
- });
940
- }
941
- resolveDefaultConfig(options) {
942
- const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent } = options || {};
943
- const keepAlive = true;
944
- const maxSockets = 50;
945
- return {
946
- connectionTimeout,
947
- requestTimeout: requestTimeout != null ? requestTimeout : socketTimeout,
948
- socketAcquisitionWarningTimeout,
949
- httpAgent: (() => {
950
- if (httpAgent instanceof http.Agent || typeof (httpAgent == null ? void 0 : httpAgent.destroy) === "function") {
951
- return httpAgent;
952
- }
953
- return new http.Agent(__spreadValues({ keepAlive, maxSockets }, httpAgent));
954
- })(),
955
- httpsAgent: (() => {
956
- if (httpsAgent instanceof https.Agent || typeof (httpsAgent == null ? void 0 : httpsAgent.destroy) === "function") {
957
- return httpsAgent;
958
- }
959
- return new https.Agent(__spreadValues({ keepAlive, maxSockets }, httpsAgent));
960
- })(),
961
- logger: console
962
- };
963
- }
964
- destroy() {
965
- var _a, _b, _c, _d;
966
- (_b = (_a = this.config) == null ? void 0 : _a.httpAgent) == null ? void 0 : _b.destroy();
967
- (_d = (_c = this.config) == null ? void 0 : _c.httpsAgent) == null ? void 0 : _d.destroy();
968
- }
969
- async handle(request, { abortSignal, requestTimeout } = {}) {
970
- if (!this.config) {
971
- this.config = await this.configProvider;
972
- }
973
- return new Promise((_resolve, _reject) => {
974
- var _a, _b, _c, _d, _e, _f;
975
- let writeRequestBodyPromise = void 0;
976
- const timeouts = [];
977
- const resolve = async (arg) => {
978
- await writeRequestBodyPromise;
979
- timeouts.forEach(timing.clearTimeout);
980
- _resolve(arg);
981
- };
982
- const reject = async (arg) => {
983
- await writeRequestBodyPromise;
984
- timeouts.forEach(timing.clearTimeout);
985
- _reject(arg);
986
- };
987
- if (!this.config) {
988
- throw new Error("Node HTTP request handler config is not resolved");
989
- }
990
- if (abortSignal == null ? void 0 : abortSignal.aborted) {
991
- const abortError = new Error("Request aborted");
992
- abortError.name = "AbortError";
993
- reject(abortError);
994
- return;
995
- }
996
- const isSSL = request.protocol === "https:";
997
- const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
998
- timeouts.push(timing.setTimeout(() => {
999
- this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, this.config.logger);
1000
- }, (_c = this.config.socketAcquisitionWarningTimeout) != null ? _c : ((_a = this.config.requestTimeout) != null ? _a : 2e3) + ((_b = this.config.connectionTimeout) != null ? _b : 1e3)));
1001
- const queryString = buildQueryString(request.query || {});
1002
- let auth = void 0;
1003
- if (request.username != null || request.password != null) {
1004
- const username = (_d = request.username) != null ? _d : "";
1005
- const password = (_e = request.password) != null ? _e : "";
1006
- auth = `${username}:${password}`;
1007
- }
1008
- let path = request.path;
1009
- if (queryString) {
1010
- path += `?${queryString}`;
1011
- }
1012
- if (request.fragment) {
1013
- path += `#${request.fragment}`;
1014
- }
1015
- let hostname = (_f = request.hostname) != null ? _f : "";
1016
- if (hostname[0] === "[" && hostname.endsWith("]")) {
1017
- hostname = request.hostname.slice(1, -1);
1018
- } else {
1019
- hostname = request.hostname;
1020
- }
1021
- const nodeHttpsOptions = {
1022
- headers: request.headers,
1023
- host: hostname,
1024
- method: request.method,
1025
- path,
1026
- port: request.port,
1027
- agent,
1028
- auth
1029
- };
1030
- const requestFunc = isSSL ? https.request : http.request;
1031
- const req = requestFunc(nodeHttpsOptions, (res) => {
1032
- const httpResponse = new HttpResponse({
1033
- statusCode: res.statusCode || -1,
1034
- reason: res.statusMessage,
1035
- headers: getTransformedHeaders(res.headers),
1036
- body: res
1037
- });
1038
- resolve({ response: httpResponse });
1039
- });
1040
- req.on("error", (err) => {
1041
- if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
1042
- reject(Object.assign(err, { name: "TimeoutError" }));
1043
- } else {
1044
- reject(err);
1045
- }
1046
- });
1047
- if (abortSignal) {
1048
- const onAbort = () => {
1049
- req.destroy();
1050
- const abortError = new Error("Request aborted");
1051
- abortError.name = "AbortError";
1052
- reject(abortError);
1053
- };
1054
- if (typeof abortSignal.addEventListener === "function") {
1055
- const signal = abortSignal;
1056
- signal.addEventListener("abort", onAbort, { once: true });
1057
- req.once("close", () => signal.removeEventListener("abort", onAbort));
1058
- } else {
1059
- abortSignal.onabort = onAbort;
1060
- }
1061
- }
1062
- const effectiveRequestTimeout = requestTimeout != null ? requestTimeout : this.config.requestTimeout;
1063
- timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
1064
- timeouts.push(setSocketTimeout(req, reject, effectiveRequestTimeout));
1065
- const httpAgent = nodeHttpsOptions.agent;
1066
- if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
1067
- timeouts.push(setSocketKeepAlive(req, {
1068
- keepAlive: httpAgent.keepAlive,
1069
- keepAliveMsecs: httpAgent.keepAliveMsecs
1070
- }));
1071
- }
1072
- writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout).catch((e) => {
1073
- timeouts.forEach(timing.clearTimeout);
1074
- return _reject(e);
1075
- });
1076
- });
1077
- }
1078
- updateHttpClientConfig(key, value) {
1079
- this.config = void 0;
1080
- this.configProvider = this.configProvider.then((config) => {
1081
- return __spreadProps(__spreadValues({}, config), {
1082
- [key]: value
1083
- });
1084
- });
1085
- }
1086
- httpHandlerConfigs() {
1087
- var _a;
1088
- return (_a = this.config) != null ? _a : {};
1089
- }
1090
- };
1091
-
1092
- // src/services/storage/s3/s3Storage.service.ts
1093
643
  var S3StorageService = class {
1094
644
  constructor(bucketName, options) {
1095
- this.httpHandler = new NodeHttpHandler({
645
+ this.httpHandler = new nodeHttpHandler.NodeHttpHandler({
1096
646
  socketTimeout: 6e5
1097
647
  });
1098
648
  this.s3Client = new clientS3.S3Client({
@@ -1449,341 +999,11 @@ var S3StorageService = class {
1449
999
  return presignedUrl;
1450
1000
  }
1451
1001
  };
1452
- var SftpClient = __require("ssh2-sftp-client");
1453
- var SftpStorageService = class {
1454
- constructor(bucketName, options) {
1455
- this.bucketName = bucketName;
1456
- this.options = options || {};
1457
- this.client = new SftpClient();
1458
- }
1459
- async initializeClient() {
1460
- const host = this.options.host || process.env.SFTP_HOST;
1461
- const port = parseInt(
1462
- String(this.options.port || process.env.SFTP_PORT)
1463
- );
1464
- const user = this.options.user || process.env.SFTP_USER;
1465
- const password = this.options.password || process.env.SFTP_PASSWORD;
1466
- const privateKey = this.options.privateKey || process.env.SFTP_PRIVATE_KEY;
1467
- if (!password && !privateKey) {
1468
- throw new Error(
1469
- "Either password or private key must be provided for SFTP connection"
1470
- );
1471
- }
1472
- await this.client.connect({
1473
- host,
1474
- port,
1475
- username: user,
1476
- password,
1477
- privateKey,
1478
- readyTimeout: 4e3,
1479
- retries: 1,
1480
- retry_factor: 2,
1481
- retry_minTimeout: 2e3
1482
- });
1483
- }
1484
- async withClient(fn) {
1485
- try {
1486
- await this.initializeClient();
1487
- return await fn();
1488
- } finally {
1489
- await this.client.end().catch(() => {
1490
- });
1491
- }
1492
- }
1493
- async list(options) {
1494
- return this.withClient(async () => {
1495
- const prefix = options.prefix || "";
1496
- const path = this.bucketName + (prefix ? "/" + prefix : "");
1497
- const list = await this.client.list(path);
1498
- const items = list.map((item) => ({
1499
- key: item.name,
1500
- lastModified: item.modifyTime ? new Date(item.modifyTime) : /* @__PURE__ */ new Date(),
1501
- size: item.size,
1502
- eTag: ""
1503
- }));
1504
- return {
1505
- items,
1506
- pagination: null,
1507
- count: items.length
1508
- };
1509
- });
1510
- }
1511
- async ensureDirectoriesExist(remotePath) {
1512
- var _a, _b;
1513
- const parts = remotePath.split("/");
1514
- parts.pop();
1515
- let current = "";
1516
- for (const part of parts) {
1517
- if (!part)
1518
- continue;
1519
- current += `/${part}`;
1520
- try {
1521
- await this.client.stat(current);
1522
- } catch (err) {
1523
- const isNoEntry = err.code === "ENOENT" || ((_a = err.message) == null ? void 0 : _a.includes("No such file")) || ((_b = err.message) == null ? void 0 : _b.includes("does not exist"));
1524
- if (isNoEntry) {
1525
- try {
1526
- await this.client.mkdir(current);
1527
- } catch (mkdirErr) {
1528
- throw new Error(
1529
- `Failed to create directory ${current}: ${mkdirErr.message}`
1530
- );
1531
- }
1532
- } else {
1533
- throw new Error(
1534
- `Failed to check directory ${current}: ${err.message}`
1535
- );
1536
- }
1537
- }
1538
- }
1539
- }
1540
- async upload(key, body) {
1541
- return this.withClient(async () => {
1542
- let remotePath = `${this.bucketName}/${key}`;
1543
- remotePath = remotePath + "";
1544
- await this.ensureDirectoriesExist(remotePath);
1545
- if (body instanceof stream.Readable) {
1546
- await this.client.put(body, remotePath);
1547
- } else if (body instanceof Buffer) {
1548
- await this.client.put(Buffer.from(body), remotePath);
1549
- } else {
1550
- await this.client.put(Buffer.from(String(body)), remotePath);
1551
- }
1552
- return { key };
1553
- });
1554
- }
1555
- async delete(key) {
1556
- return this.withClient(async () => {
1557
- await this.client.delete(`${this.bucketName}/${key}`);
1558
- return true;
1559
- });
1560
- }
1561
- async getObject(key) {
1562
- await this.initializeClient();
1563
- const remotePath = `${this.bucketName}/${key}`;
1564
- const stats = await this.client.stat(remotePath);
1565
- const data = await this.client.get(remotePath);
1566
- let stream3;
1567
- if (Buffer.isBuffer(data) || typeof data === "string") {
1568
- stream3 = stream.Readable.from(data);
1569
- } else if (data instanceof stream.Readable) {
1570
- stream3 = data;
1571
- } else {
1572
- throw new Error("Unsupported stream type returned by SFTP client");
1573
- }
1574
- const cleanup = async () => {
1575
- try {
1576
- await this.client.end();
1577
- } catch (e) {
1578
- }
1579
- };
1580
- stream3.on("end", cleanup);
1581
- stream3.on("error", cleanup);
1582
- return {
1583
- body: stream3,
1584
- contentLength: stats.size,
1585
- lastModified: stats.modifyTime ? new Date(stats.modifyTime) : /* @__PURE__ */ new Date(),
1586
- metadata: {}
1587
- };
1588
- }
1589
- listAll(options) {
1590
- throw new Error("Method not implemented.");
1591
- }
1592
- getHeadObject(key) {
1593
- throw new Error("Method not implemented.");
1594
- }
1595
- getDownloadUrl(key, expiresInMinutes) {
1596
- throw new Error("Method not implemented.");
1597
- }
1598
- getUploadUrl(key, expiresInMinutes) {
1599
- throw new Error("Method not implemented.");
1600
- }
1601
- createUploadWriteStream(key) {
1602
- throw new Error("Method not implemented.");
1603
- }
1604
- getHeadBucket() {
1605
- throw new Error("Method not implemented.");
1606
- }
1607
- generateUploadIdMultipart(key) {
1608
- throw new Error("Method not implemented.");
1609
- }
1610
- listMultipartUploadsForBucket() {
1611
- throw new Error("Method not implemented.");
1612
- }
1613
- listMultipartUploadsForKey(key, uploadId) {
1614
- throw new Error("Method not implemented.");
1615
- }
1616
- uploadMultipart(key, file, partNumber, uploadId) {
1617
- throw new Error("Method not implemented.");
1618
- }
1619
- completeMultipartUpload(key, uploadId) {
1620
- throw new Error("Method not implemented.");
1621
- }
1622
- abortMultipartUpload(key, uploadId) {
1623
- throw new Error("Method not implemented.");
1624
- }
1625
- getMultipartUploadPresignedUrl(key, uploadId, partNumber, expiresInMinutes) {
1626
- throw new Error("Method not implemented.");
1627
- }
1628
- };
1629
- var FtpStorageService = class {
1630
- constructor(bucketName, options) {
1631
- this.bucketName = bucketName;
1632
- this.options = options || {};
1633
- this.client = new basicFtp.Client();
1634
- }
1635
- listAll(options) {
1636
- throw new Error("Method not implemented.");
1637
- }
1638
- async initializeClient() {
1639
- var _a, _b, _c, _d, _e;
1640
- const host = ((_a = this == null ? void 0 : this.options) == null ? void 0 : _a.host) || process.env.FTP_HOST;
1641
- const port = parseInt(
1642
- String(((_b = this == null ? void 0 : this.options) == null ? void 0 : _b.port) || process.env.FTP_PORT),
1643
- 10
1644
- );
1645
- const user = ((_c = this == null ? void 0 : this.options) == null ? void 0 : _c.user) || process.env.FTP_USER;
1646
- const password = ((_d = this == null ? void 0 : this.options) == null ? void 0 : _d.password) || process.env.FTP_PASSWORD;
1647
- await this.client.access({
1648
- host,
1649
- port,
1650
- user,
1651
- password,
1652
- secure: ((_e = this == null ? void 0 : this.options) == null ? void 0 : _e.secure) || false
1653
- });
1654
- }
1655
- async withClient(fn) {
1656
- try {
1657
- await this.initializeClient();
1658
- return await fn();
1659
- } finally {
1660
- this.client.close();
1661
- }
1662
- }
1663
- async list(options) {
1664
- return this.withClient(async () => {
1665
- const prefix = options.prefix || "";
1666
- const path = `${this.bucketName}/${prefix}`;
1667
- try {
1668
- const list = await this.client.list(path);
1669
- const items = list.map(
1670
- (item) => ({
1671
- key: prefix + item.name,
1672
- lastModified: item.modifiedAt || /* @__PURE__ */ new Date(),
1673
- size: item.size,
1674
- eTag: ""
1675
- })
1676
- );
1677
- return {
1678
- items,
1679
- pagination: null,
1680
- count: items.length
1681
- };
1682
- } catch (e) {
1683
- return { items: [], pagination: null, count: 0 };
1684
- }
1685
- });
1686
- }
1687
- async getObject(key) {
1688
- await this.initializeClient();
1689
- const passThrough = new stream.PassThrough();
1690
- const path = `${this.bucketName}/${key}`;
1691
- const stats = await this.client.size(path);
1692
- this.client.downloadTo(passThrough, path).then(() => passThrough.end()).catch((err) => passThrough.emit("error", err));
1693
- const cleanup = () => {
1694
- this.client.close();
1695
- };
1696
- passThrough.on("end", cleanup);
1697
- passThrough.on("error", cleanup);
1698
- return {
1699
- body: passThrough,
1700
- contentLength: stats,
1701
- lastModified: /* @__PURE__ */ new Date(),
1702
- metadata: {}
1703
- };
1704
- }
1705
- async upload(key, body) {
1706
- return this.withClient(async () => {
1707
- await this.client.cd("/");
1708
- try {
1709
- await this.client.cd(this.bucketName);
1710
- } catch (e) {
1711
- await this.client.send(`MKD ${this.bucketName}`);
1712
- await this.client.cd(this.bucketName);
1713
- }
1714
- const parts = key.split("/");
1715
- parts.pop();
1716
- for (const part of parts) {
1717
- if (!part)
1718
- continue;
1719
- try {
1720
- await this.client.cd(part);
1721
- } catch (e) {
1722
- await this.client.send(`MKD ${part}`);
1723
- await this.client.cd(part);
1724
- }
1725
- }
1726
- await this.client.cd("/");
1727
- const fullPath = `${this.bucketName}/${key}`;
1728
- const stream3 = body instanceof stream.Readable ? body : stream.Readable.from([body]);
1729
- await this.client.uploadFrom(stream3, fullPath);
1730
- return { key };
1731
- });
1732
- }
1733
- async delete(key) {
1734
- return this.withClient(async () => {
1735
- await this.client.remove(`${this.bucketName}/${key}`);
1736
- return true;
1737
- });
1738
- }
1739
- async close() {
1740
- this.client.close();
1741
- }
1742
- // Unsupported Operations
1743
- async getDownloadUrl(_key, _expiresInMinutes) {
1744
- throw new Error("FTP does not support pre-signed URLs");
1745
- }
1746
- async getUploadUrl(_key, _expiresInMinutes) {
1747
- throw new Error("FTP does not support pre-signed URLs");
1748
- }
1749
- async getHeadObject(_key) {
1750
- throw new Error("Operation not supported");
1751
- }
1752
- createUploadWriteStream(_key) {
1753
- throw new Error("Operation not supported");
1754
- }
1755
- async getHeadBucket() {
1756
- throw new Error("Operation not supported");
1757
- }
1758
- async generateUploadIdMultipart(_key) {
1759
- throw new Error("Multipart upload is not supported");
1760
- }
1761
- async listMultipartUploadsForBucket() {
1762
- throw new Error("Multipart upload is not supported");
1763
- }
1764
- async listMultipartUploadsForKey(_key, _uploadId) {
1765
- throw new Error("Multipart upload is not supported");
1766
- }
1767
- async uploadMultipart(_key, _file, _partNumber, _uploadId) {
1768
- throw new Error("Multipart upload is not supported");
1769
- }
1770
- async completeMultipartUpload(_key, _uploadId) {
1771
- throw new Error("Multipart upload is not supported");
1772
- }
1773
- async abortMultipartUpload(_key, _uploadId) {
1774
- throw new Error("Method not implemented.");
1775
- }
1776
- async getMultipartUploadPresignedUrl(_key, _uploadId, _partNumber, _expiresInMinutes) {
1777
- throw new Error("Multipart upload is not supported");
1778
- }
1779
- };
1780
1002
 
1781
1003
  // src/shared/utils/constants.ts
1782
1004
  var OBJECT_STORAGE_SERVICE_TYPES = {
1783
1005
  AWS_S3: "aws_s3",
1784
- AZURE_BLOB_STORAGE: "azure_blob_storage",
1785
- FTP: "ftp",
1786
- SFTP: "sftp"
1006
+ AZURE_BLOB_STORAGE: "azure_blob_storage"
1787
1007
  };
1788
1008
 
1789
1009
  // src/services/objectStorageFactory.service.ts
@@ -1795,11 +1015,7 @@ var ObjectStorageFactory = class {
1795
1015
  case OBJECT_STORAGE_SERVICE_TYPES.AWS_S3:
1796
1016
  return new S3StorageService(bucketName, options);
1797
1017
  case OBJECT_STORAGE_SERVICE_TYPES.AZURE_BLOB_STORAGE:
1798
- return new BlobStorageService(bucketName, options);
1799
- case OBJECT_STORAGE_SERVICE_TYPES.FTP:
1800
- return new FtpStorageService(bucketName, options);
1801
- case OBJECT_STORAGE_SERVICE_TYPES.SFTP:
1802
- return new SftpStorageService(bucketName, options);
1018
+ return new BlobStorageService(bucketName);
1803
1019
  default:
1804
1020
  throw new Error(
1805
1021
  `Unsupported object storage provider: ${provider}`
@@ -1825,13 +1041,11 @@ var ObjectStorageService = class _ObjectStorageService {
1825
1041
  *
1826
1042
  * @param {ListRequestOptions} options - The options to apply to the list operation.
1827
1043
  * @param {string} [bucketName] - The name of the bucket to list objects from. If not provided, the default bucket name will be used.
1828
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1829
1044
  * @return {Promise<ListResponse>} A promise that resolves to the list of objects.
1830
1045
  */
1831
- static async list(options, bucketName, objectStorageOptions) {
1046
+ static async list(options, bucketName) {
1832
1047
  return _ObjectStorageService.getObjectStorageServiceInstance(
1833
- bucketName,
1834
- objectStorageOptions
1048
+ bucketName
1835
1049
  ).then((instance) => instance.list(options));
1836
1050
  }
1837
1051
  /**
@@ -1839,13 +1053,11 @@ var ObjectStorageService = class _ObjectStorageService {
1839
1053
  *
1840
1054
  * @param {ListRequestOptions} options - The options to apply to the list operation.
1841
1055
  * @param {string} [bucketName] - The name of the bucket to list objects from. If not provided, the default bucket name will be used.
1842
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1843
1056
  * @return {Promise<ListResponse>} A promise that resolves to the list of all objects.
1844
1057
  */
1845
- static async listAll(options, bucketName, objectStorageOptions) {
1058
+ static async listAll(options, bucketName) {
1846
1059
  return _ObjectStorageService.getObjectStorageServiceInstance(
1847
- bucketName,
1848
- objectStorageOptions
1060
+ bucketName
1849
1061
  ).then((instance) => instance.listAll(options));
1850
1062
  }
1851
1063
  /**
@@ -1853,27 +1065,21 @@ var ObjectStorageService = class _ObjectStorageService {
1853
1065
  *
1854
1066
  * @param {string} key - The key of the object to retrieve.
1855
1067
  * @param {string} [bucketName] - The name of the bucket where the object is stored. If not provided, the default bucket name will be used.
1856
- * @param {IGetObjectOptions} [options] - The options to apply to the get operation.
1857
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1858
1068
  * @return {Promise<GetObjectResponse>} A promise that resolves to the retrieved object.
1859
1069
  */
1860
- static async getObject(key, bucketName, options, objectStorageOptions) {
1070
+ static async getObject(key, bucketName, options) {
1861
1071
  return _ObjectStorageService.getObjectStorageServiceInstance(
1862
- bucketName,
1863
- objectStorageOptions
1072
+ bucketName
1864
1073
  ).then((instance) => instance.getObject(key, options));
1865
1074
  }
1866
1075
  /**
1867
1076
  * Retrieves an object info (without file content) from the object storage service.
1868
1077
  * @param key - The key of the object to retrieve.
1869
- * @param bucketName - The name of the bucket where the object is stored. If not provided, the default bucket name will be used.
1870
- * @param objectStorageOptions - The options for the object storage service.
1871
1078
  * @returns A promise that resolves to the info of the file.
1872
1079
  */
1873
- static async getHeadObject(key, bucketName, objectStorageOptions) {
1080
+ static async getHeadObject(key, bucketName) {
1874
1081
  return _ObjectStorageService.getObjectStorageServiceInstance(
1875
- bucketName,
1876
- objectStorageOptions
1082
+ bucketName
1877
1083
  ).then((instance) => instance.getHeadObject(key));
1878
1084
  }
1879
1085
  /**
@@ -1882,13 +1088,11 @@ var ObjectStorageService = class _ObjectStorageService {
1882
1088
  * @param {string} key - The key of the object for which to generate the signed URL.
1883
1089
  * @param {number} expiresInMinutes - The number of minutes until the signed URL expires.
1884
1090
  * @param {string} [bucketName] - The name of the bucket where the object is stored. If not provided, the default bucket name will be used.
1885
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1886
1091
  * @return {Promise<string>} A promise that resolves to the generated signed URL.
1887
1092
  */
1888
- static async getDownloadUrl(key, expiresInMinutes, bucketName, objectStorageOptions) {
1093
+ static async getDownloadUrl(key, expiresInMinutes, bucketName) {
1889
1094
  return _ObjectStorageService.getObjectStorageServiceInstance(
1890
- bucketName,
1891
- objectStorageOptions
1095
+ bucketName
1892
1096
  ).then((instance) => instance.getDownloadUrl(key, expiresInMinutes));
1893
1097
  }
1894
1098
  /**
@@ -1897,13 +1101,11 @@ var ObjectStorageService = class _ObjectStorageService {
1897
1101
  * @param {string} key - The key of the object for which to generate the upload URL.
1898
1102
  * @param {number} expiresInMinutes - The number of minutes until the upload URL expires.
1899
1103
  * @param {string} [bucketName] - The name of the bucket where the object will be stored. If not provided, the default bucket name will be used.
1900
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1901
1104
  * @return {Promise<string>} A promise that resolves to the generated upload URL.
1902
1105
  */
1903
- static async getUploadUrl(key, expiresInMinutes, bucketName, objectStorageOptions) {
1106
+ static async getUploadUrl(key, expiresInMinutes, bucketName) {
1904
1107
  return _ObjectStorageService.getObjectStorageServiceInstance(
1905
- bucketName,
1906
- objectStorageOptions
1108
+ bucketName
1907
1109
  ).then((instance) => instance.getUploadUrl(key, expiresInMinutes));
1908
1110
  }
1909
1111
  /**
@@ -1913,13 +1115,11 @@ var ObjectStorageService = class _ObjectStorageService {
1913
1115
  * @param {FileContent} body - The content of the file to upload.
1914
1116
  * @param {Object} [metadata] - Optional metadata to associate with the object.
1915
1117
  * @param {string} [bucketName] - The name of the bucket where the object will be stored. If not provided, the default bucket name will be used.
1916
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1917
1118
  * @return {Promise<UploadResponse>} A promise that resolves to the response of the upload operation.
1918
1119
  */
1919
- static async upload(key, body, metadata, bucketName, objectStorageOptions) {
1120
+ static async upload(key, body, metadata, bucketName) {
1920
1121
  return _ObjectStorageService.getObjectStorageServiceInstance(
1921
- bucketName,
1922
- objectStorageOptions
1122
+ bucketName
1923
1123
  ).then((instance) => instance.upload(key, body, metadata));
1924
1124
  }
1925
1125
  /**
@@ -1927,13 +1127,11 @@ var ObjectStorageService = class _ObjectStorageService {
1927
1127
  *
1928
1128
  * @param {string} key - The key of the object to create the upload write stream for.
1929
1129
  * @param {string} [bucketName] - The name of the bucket where the object will be stored. If not provided, the default bucket name will be used.
1930
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1931
1130
  * @return {Promise<CreateUploadWriteStreamResponse>} A promise that resolves to the response of the upload operation.
1932
1131
  */
1933
- static async createUploadWriteStream(key, bucketName, objectStorageOptions) {
1132
+ static async createUploadWriteStream(key, bucketName) {
1934
1133
  return _ObjectStorageService.getObjectStorageServiceInstance(
1935
- bucketName,
1936
- objectStorageOptions
1134
+ bucketName
1937
1135
  ).then((instance) => instance.createUploadWriteStream(key));
1938
1136
  }
1939
1137
  /**
@@ -1941,13 +1139,11 @@ var ObjectStorageService = class _ObjectStorageService {
1941
1139
  *
1942
1140
  * @param {string | string[]} key - The key or array of keys of the objects to delete.
1943
1141
  * @param {string} [bucketName] - The name of the bucket where the objects are stored. If not provided, the default bucket name will be used.
1944
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1945
1142
  * @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.
1946
1143
  */
1947
- static async delete(key, bucketName, objectStorageOptions) {
1144
+ static async delete(key, bucketName) {
1948
1145
  return _ObjectStorageService.getObjectStorageServiceInstance(
1949
- bucketName,
1950
- objectStorageOptions
1146
+ bucketName
1951
1147
  ).then(async (instance) => {
1952
1148
  if (Array.isArray(key)) {
1953
1149
  const deleteBlobPromises = key.map(async (blobName) => {
@@ -1973,13 +1169,11 @@ var ObjectStorageService = class _ObjectStorageService {
1973
1169
  * Retrieves the head bucket from the object storage service.
1974
1170
  *
1975
1171
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
1976
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1977
1172
  * @return {Promise<HeadBucketResponse>} A promise that resolves to the head bucket response.
1978
1173
  */
1979
- static async getHeadBucket(bucketName, objectStorageOptions) {
1174
+ static async getHeadBucket(bucketName) {
1980
1175
  return _ObjectStorageService.getObjectStorageServiceInstance(
1981
- bucketName,
1982
- objectStorageOptions
1176
+ bucketName
1983
1177
  ).then((instance) => instance.getHeadBucket());
1984
1178
  }
1985
1179
  /**
@@ -1987,13 +1181,11 @@ var ObjectStorageService = class _ObjectStorageService {
1987
1181
  *
1988
1182
  * @param {string} key - The key of the object to upload.
1989
1183
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
1990
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
1991
1184
  * @return {Promise<string>} A promise that resolves to the generated upload ID.
1992
1185
  */
1993
- static async generateUploadIdMultipart(key, bucketName, objectStorageOptions) {
1186
+ static async generateUploadIdMultipart(key, bucketName) {
1994
1187
  return _ObjectStorageService.getObjectStorageServiceInstance(
1995
- bucketName,
1996
- objectStorageOptions
1188
+ bucketName
1997
1189
  ).then((instance) => instance.generateUploadIdMultipart(key));
1998
1190
  }
1999
1191
  /**
@@ -2002,13 +1194,11 @@ var ObjectStorageService = class _ObjectStorageService {
2002
1194
  * @param {string} key - The key of the object to retrieve uploads for.
2003
1195
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
2004
1196
  * @param {string} [uploadId] - The upload ID to filter the results by.
2005
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
2006
1197
  * @return {Promise<ListPartsMultipartUploadResponse>} A promise that resolves to the list of multipart uploads for the specified key.
2007
1198
  */
2008
- static async listMultipartUploadsForKey(key, bucketName, uploadId, objectStorageOptions) {
1199
+ static async listMultipartUploadsForKey(key, bucketName, uploadId) {
2009
1200
  return _ObjectStorageService.getObjectStorageServiceInstance(
2010
- bucketName,
2011
- objectStorageOptions
1201
+ bucketName
2012
1202
  ).then(
2013
1203
  (instance) => instance.listMultipartUploadsForKey(key, uploadId)
2014
1204
  );
@@ -2017,13 +1207,11 @@ var ObjectStorageService = class _ObjectStorageService {
2017
1207
  * Retrieves a list of all multipart uploads for a specified bucket in the object storage service.
2018
1208
  *
2019
1209
  * @param {string} [bucketName] - The name of the bucket. If not provided, the default bucket name will be used.
2020
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
2021
1210
  * @return {Promise<ListMultipartUploadsResponse>} A promise that resolves to the list of multipart uploads for the specified bucket.
2022
1211
  */
2023
- static async listMultipartUploadsForBucket(bucketName, objectStorageOptions) {
1212
+ static async listMultipartUploadsForBucket(bucketName) {
2024
1213
  return _ObjectStorageService.getObjectStorageServiceInstance(
2025
- bucketName,
2026
- objectStorageOptions
1214
+ bucketName
2027
1215
  ).then((instance) => instance.listMultipartUploadsForBucket());
2028
1216
  }
2029
1217
  /**
@@ -2034,13 +1222,11 @@ var ObjectStorageService = class _ObjectStorageService {
2034
1222
  * @param {number} partNumber - The number of the part being uploaded.
2035
1223
  * @param {string} [uploadId] - The ID of the multipart upload.
2036
1224
  * @param {string} [bucketName] - The name of the bucket to upload the file to. If not provided, the default bucket name will be used.
2037
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
2038
1225
  * @return {Promise<string>} A Promise that resolves to the base64 encoded block ID of the uploaded part.
2039
1226
  */
2040
- static async uploadMultipart(key, file, partNumber, uploadId, bucketName, objectStorageOptions) {
1227
+ static async uploadMultipart(key, file, partNumber, uploadId, bucketName) {
2041
1228
  return _ObjectStorageService.getObjectStorageServiceInstance(
2042
- bucketName,
2043
- objectStorageOptions
1229
+ bucketName
2044
1230
  ).then(
2045
1231
  (instance) => instance.uploadMultipart(key, file, partNumber, uploadId)
2046
1232
  );
@@ -2051,13 +1237,11 @@ var ObjectStorageService = class _ObjectStorageService {
2051
1237
  * @param {string} key - The key of the object to complete the multipart upload for.
2052
1238
  * @param {string} uploadId - The ID of the multipart upload to complete.
2053
1239
  * @param {string} [bucketName] - The name of the bucket to complete the multipart upload in. If not provided, the default bucket name will be used.
2054
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
2055
1240
  * @return {Promise<void>} A Promise that resolves when the multipart upload is completed.
2056
1241
  */
2057
- static async completeMultipartUpload(key, uploadId, bucketName, objectStorageOptions) {
1242
+ static async completeMultipartUpload(key, uploadId, bucketName) {
2058
1243
  return _ObjectStorageService.getObjectStorageServiceInstance(
2059
- bucketName,
2060
- objectStorageOptions
1244
+ bucketName
2061
1245
  ).then((instance) => instance.completeMultipartUpload(key, uploadId));
2062
1246
  }
2063
1247
  /**
@@ -2066,13 +1250,11 @@ var ObjectStorageService = class _ObjectStorageService {
2066
1250
  * @param {string} key - The key of the object to abort the multipart upload for.
2067
1251
  * @param {string} uploadId - The ID of the multipart upload to abort.
2068
1252
  * @param {string} [bucketName] - The name of the bucket to abort the multipart upload in. If not provided, the default bucket name will be used.
2069
- * @param {ObjectStorageOptions} [objectStorageOptions] - The options for the object storage service.
2070
1253
  * @return {Promise<void>} A Promise that resolves when the multipart upload is aborted.
2071
1254
  */
2072
- static async abortMultipartUpload(key, uploadId, bucketName, objectStorageOptions) {
1255
+ static async abortMultipartUpload(key, uploadId, bucketName) {
2073
1256
  return _ObjectStorageService.getObjectStorageServiceInstance(
2074
- bucketName,
2075
- objectStorageOptions
1257
+ bucketName
2076
1258
  ).then((instance) => instance.abortMultipartUpload(key, uploadId));
2077
1259
  }
2078
1260
  /**