@adtrackify/at-service-common 1.0.38 → 1.0.40
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/index.d.ts +14 -12
- package/dist/index.js +166 -151
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/src/helpers/index.ts +2 -1
- package/src/helpers/input-validation-helper.ts +3 -3
- package/src/helpers/shopify-helper.ts +39 -0
- package/src/libs/index.ts +1 -1
- package/src/libs/shopify.ts +0 -25
package/dist/index.js
CHANGED
|
@@ -267,33 +267,33 @@ var require_json = __commonJS({
|
|
|
267
267
|
populateHostPrefix(req);
|
|
268
268
|
}
|
|
269
269
|
function extractError(resp) {
|
|
270
|
-
var
|
|
270
|
+
var error4 = {};
|
|
271
271
|
var httpResponse2 = resp.httpResponse;
|
|
272
|
-
|
|
273
|
-
if (typeof
|
|
274
|
-
|
|
272
|
+
error4.code = httpResponse2.headers["x-amzn-errortype"] || "UnknownError";
|
|
273
|
+
if (typeof error4.code === "string") {
|
|
274
|
+
error4.code = error4.code.split(":")[0];
|
|
275
275
|
}
|
|
276
276
|
if (httpResponse2.body.length > 0) {
|
|
277
277
|
try {
|
|
278
278
|
var e = JSON.parse(httpResponse2.body.toString());
|
|
279
279
|
var code = e.__type || e.code || e.Code;
|
|
280
280
|
if (code) {
|
|
281
|
-
|
|
281
|
+
error4.code = code.split("#").pop();
|
|
282
282
|
}
|
|
283
|
-
if (
|
|
284
|
-
|
|
283
|
+
if (error4.code === "RequestEntityTooLarge") {
|
|
284
|
+
error4.message = "Request body must be less than 1 MB";
|
|
285
285
|
} else {
|
|
286
|
-
|
|
286
|
+
error4.message = e.message || e.Message || null;
|
|
287
287
|
}
|
|
288
288
|
} catch (e2) {
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
error4.statusCode = httpResponse2.statusCode;
|
|
290
|
+
error4.message = httpResponse2.statusMessage;
|
|
291
291
|
}
|
|
292
292
|
} else {
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
error4.statusCode = httpResponse2.statusCode;
|
|
294
|
+
error4.message = httpResponse2.statusCode.toString();
|
|
295
295
|
}
|
|
296
|
-
resp.error = util.error(new Error(),
|
|
296
|
+
resp.error = util.error(new Error(), error4);
|
|
297
297
|
}
|
|
298
298
|
function extractData(resp) {
|
|
299
299
|
var body = resp.httpResponse.body.toString() || "{}";
|
|
@@ -3039,15 +3039,15 @@ var require_sequential_executor = __commonJS({
|
|
|
3039
3039
|
},
|
|
3040
3040
|
callListeners: function callListeners(listeners, args, doneCallback, prevError) {
|
|
3041
3041
|
var self = this;
|
|
3042
|
-
var
|
|
3042
|
+
var error4 = prevError || null;
|
|
3043
3043
|
function callNextListener(err) {
|
|
3044
3044
|
if (err) {
|
|
3045
|
-
|
|
3045
|
+
error4 = AWS3.util.error(error4 || new Error(), err);
|
|
3046
3046
|
if (self._haltHandlersOnError) {
|
|
3047
|
-
return doneCallback.call(self,
|
|
3047
|
+
return doneCallback.call(self, error4);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
3050
|
-
self.callListeners(listeners, args, doneCallback,
|
|
3050
|
+
self.callListeners(listeners, args, doneCallback, error4);
|
|
3051
3051
|
}
|
|
3052
3052
|
while (listeners.length > 0) {
|
|
3053
3053
|
var listener = listeners.shift();
|
|
@@ -3058,15 +3058,15 @@ var require_sequential_executor = __commonJS({
|
|
|
3058
3058
|
try {
|
|
3059
3059
|
listener.apply(self, args);
|
|
3060
3060
|
} catch (err) {
|
|
3061
|
-
|
|
3061
|
+
error4 = AWS3.util.error(error4 || new Error(), err);
|
|
3062
3062
|
}
|
|
3063
|
-
if (
|
|
3064
|
-
doneCallback.call(self,
|
|
3063
|
+
if (error4 && self._haltHandlersOnError) {
|
|
3064
|
+
doneCallback.call(self, error4);
|
|
3065
3065
|
return;
|
|
3066
3066
|
}
|
|
3067
3067
|
}
|
|
3068
3068
|
}
|
|
3069
|
-
doneCallback.call(self,
|
|
3069
|
+
doneCallback.call(self, error4);
|
|
3070
3070
|
},
|
|
3071
3071
|
addListeners: function addListeners(listeners) {
|
|
3072
3072
|
var self = this;
|
|
@@ -3656,18 +3656,18 @@ var require_service = __commonJS({
|
|
|
3656
3656
|
monitoringEvent.FinalHttpStatusCode = response.httpResponse.statusCode;
|
|
3657
3657
|
}
|
|
3658
3658
|
if (response.error) {
|
|
3659
|
-
var
|
|
3659
|
+
var error4 = response.error;
|
|
3660
3660
|
var statusCode = response.httpResponse.statusCode;
|
|
3661
3661
|
if (statusCode > 299) {
|
|
3662
|
-
if (
|
|
3663
|
-
monitoringEvent.FinalAwsException =
|
|
3664
|
-
if (
|
|
3665
|
-
monitoringEvent.FinalAwsExceptionMessage =
|
|
3662
|
+
if (error4.code)
|
|
3663
|
+
monitoringEvent.FinalAwsException = error4.code;
|
|
3664
|
+
if (error4.message)
|
|
3665
|
+
monitoringEvent.FinalAwsExceptionMessage = error4.message;
|
|
3666
3666
|
} else {
|
|
3667
|
-
if (
|
|
3668
|
-
monitoringEvent.FinalSdkException =
|
|
3669
|
-
if (
|
|
3670
|
-
monitoringEvent.FinalSdkExceptionMessage =
|
|
3667
|
+
if (error4.code || error4.name)
|
|
3668
|
+
monitoringEvent.FinalSdkException = error4.code || error4.name;
|
|
3669
|
+
if (error4.message)
|
|
3670
|
+
monitoringEvent.FinalSdkExceptionMessage = error4.message;
|
|
3671
3671
|
}
|
|
3672
3672
|
}
|
|
3673
3673
|
return monitoringEvent;
|
|
@@ -3708,17 +3708,17 @@ var require_service = __commonJS({
|
|
|
3708
3708
|
attemptFailEvent: function attemptFailEvent(request) {
|
|
3709
3709
|
var monitoringEvent = this.apiAttemptEvent(request);
|
|
3710
3710
|
var response = request.response;
|
|
3711
|
-
var
|
|
3711
|
+
var error4 = response.error;
|
|
3712
3712
|
if (response.httpResponse.statusCode > 299) {
|
|
3713
|
-
if (
|
|
3714
|
-
monitoringEvent.AwsException =
|
|
3715
|
-
if (
|
|
3716
|
-
monitoringEvent.AwsExceptionMessage =
|
|
3713
|
+
if (error4.code)
|
|
3714
|
+
monitoringEvent.AwsException = error4.code;
|
|
3715
|
+
if (error4.message)
|
|
3716
|
+
monitoringEvent.AwsExceptionMessage = error4.message;
|
|
3717
3717
|
} else {
|
|
3718
|
-
if (
|
|
3719
|
-
monitoringEvent.SdkException =
|
|
3720
|
-
if (
|
|
3721
|
-
monitoringEvent.SdkExceptionMessage =
|
|
3718
|
+
if (error4.code || error4.name)
|
|
3719
|
+
monitoringEvent.SdkException = error4.code || error4.name;
|
|
3720
|
+
if (error4.message)
|
|
3721
|
+
monitoringEvent.SdkExceptionMessage = error4.message;
|
|
3722
3722
|
}
|
|
3723
3723
|
return monitoringEvent;
|
|
3724
3724
|
},
|
|
@@ -3828,30 +3828,30 @@ var require_service = __commonJS({
|
|
|
3828
3828
|
retryDelays: function retryDelays(retryCount, err) {
|
|
3829
3829
|
return AWS3.util.calculateRetryDelay(retryCount, this.config.retryDelayOptions, err);
|
|
3830
3830
|
},
|
|
3831
|
-
retryableError: function retryableError(
|
|
3832
|
-
if (this.timeoutError(
|
|
3831
|
+
retryableError: function retryableError(error4) {
|
|
3832
|
+
if (this.timeoutError(error4))
|
|
3833
3833
|
return true;
|
|
3834
|
-
if (this.networkingError(
|
|
3834
|
+
if (this.networkingError(error4))
|
|
3835
3835
|
return true;
|
|
3836
|
-
if (this.expiredCredentialsError(
|
|
3836
|
+
if (this.expiredCredentialsError(error4))
|
|
3837
3837
|
return true;
|
|
3838
|
-
if (this.throttledError(
|
|
3838
|
+
if (this.throttledError(error4))
|
|
3839
3839
|
return true;
|
|
3840
|
-
if (
|
|
3840
|
+
if (error4.statusCode >= 500)
|
|
3841
3841
|
return true;
|
|
3842
3842
|
return false;
|
|
3843
3843
|
},
|
|
3844
|
-
networkingError: function networkingError(
|
|
3845
|
-
return
|
|
3844
|
+
networkingError: function networkingError(error4) {
|
|
3845
|
+
return error4.code === "NetworkingError";
|
|
3846
3846
|
},
|
|
3847
|
-
timeoutError: function timeoutError(
|
|
3848
|
-
return
|
|
3847
|
+
timeoutError: function timeoutError(error4) {
|
|
3848
|
+
return error4.code === "TimeoutError";
|
|
3849
3849
|
},
|
|
3850
|
-
expiredCredentialsError: function expiredCredentialsError(
|
|
3851
|
-
return
|
|
3850
|
+
expiredCredentialsError: function expiredCredentialsError(error4) {
|
|
3851
|
+
return error4.code === "ExpiredTokenException";
|
|
3852
3852
|
},
|
|
3853
|
-
clockSkewError: function clockSkewError(
|
|
3854
|
-
switch (
|
|
3853
|
+
clockSkewError: function clockSkewError(error4) {
|
|
3854
|
+
switch (error4.code) {
|
|
3855
3855
|
case "RequestTimeTooSkewed":
|
|
3856
3856
|
case "RequestExpired":
|
|
3857
3857
|
case "InvalidSignatureException":
|
|
@@ -3876,10 +3876,10 @@ var require_service = __commonJS({
|
|
|
3876
3876
|
return Math.abs(this.getSkewCorrectedDate().getTime() - newServerTime) >= 3e5;
|
|
3877
3877
|
}
|
|
3878
3878
|
},
|
|
3879
|
-
throttledError: function throttledError(
|
|
3880
|
-
if (
|
|
3879
|
+
throttledError: function throttledError(error4) {
|
|
3880
|
+
if (error4.statusCode === 429)
|
|
3881
3881
|
return true;
|
|
3882
|
-
switch (
|
|
3882
|
+
switch (error4.code) {
|
|
3883
3883
|
case "ProvisionedThroughputExceededException":
|
|
3884
3884
|
case "Throttling":
|
|
3885
3885
|
case "ThrottlingException":
|
|
@@ -4599,9 +4599,9 @@ var require_discover_endpoint = __commonJS({
|
|
|
4599
4599
|
}
|
|
4600
4600
|
}
|
|
4601
4601
|
function invalidateCachedEndpoints(response) {
|
|
4602
|
-
var
|
|
4602
|
+
var error4 = response.error;
|
|
4603
4603
|
var httpResponse2 = response.httpResponse;
|
|
4604
|
-
if (
|
|
4604
|
+
if (error4 && (error4.code === "InvalidEndpointException" || httpResponse2.statusCode === 421)) {
|
|
4605
4605
|
var request = response.request;
|
|
4606
4606
|
var operations = request.service.api.operations || {};
|
|
4607
4607
|
var inputShape = operations[request.operation] ? operations[request.operation].input : void 0;
|
|
@@ -5003,7 +5003,7 @@ var require_event_listeners = __commonJS({
|
|
|
5003
5003
|
resp.request.emit("httpDownloadProgress", [value, resp]);
|
|
5004
5004
|
});
|
|
5005
5005
|
}
|
|
5006
|
-
function
|
|
5006
|
+
function error4(err) {
|
|
5007
5007
|
if (err.code !== "RequestAbortedError") {
|
|
5008
5008
|
var errCode = err.code === "TimeoutError" ? err.code : "NetworkingError";
|
|
5009
5009
|
err = AWS3.util.error(err, {
|
|
@@ -5026,11 +5026,11 @@ var require_event_listeners = __commonJS({
|
|
|
5026
5026
|
resp.request.httpRequest,
|
|
5027
5027
|
httpOptions,
|
|
5028
5028
|
callback,
|
|
5029
|
-
|
|
5029
|
+
error4
|
|
5030
5030
|
);
|
|
5031
5031
|
progress(stream);
|
|
5032
5032
|
} catch (err) {
|
|
5033
|
-
|
|
5033
|
+
error4(err);
|
|
5034
5034
|
}
|
|
5035
5035
|
}
|
|
5036
5036
|
var timeDiff = (resp.request.service.getSkewCorrectedDate() - this.signedAt) / 1e3;
|
|
@@ -5598,9 +5598,9 @@ var require_jmespath = __commonJS({
|
|
|
5598
5598
|
tokens.push({ type: TOK_PIPE, value: "|", start });
|
|
5599
5599
|
}
|
|
5600
5600
|
} else {
|
|
5601
|
-
var
|
|
5602
|
-
|
|
5603
|
-
throw
|
|
5601
|
+
var error4 = new Error("Unknown character:" + stream[this._current]);
|
|
5602
|
+
error4.name = "LexerError";
|
|
5603
|
+
throw error4;
|
|
5604
5604
|
}
|
|
5605
5605
|
}
|
|
5606
5606
|
return tokens;
|
|
@@ -5784,11 +5784,11 @@ var require_jmespath = __commonJS({
|
|
|
5784
5784
|
var ast = this.expression(0);
|
|
5785
5785
|
if (this._lookahead(0) !== TOK_EOF) {
|
|
5786
5786
|
var t = this._lookaheadToken(0);
|
|
5787
|
-
var
|
|
5787
|
+
var error4 = new Error(
|
|
5788
5788
|
"Unexpected token type: " + t.type + ", value: " + t.value
|
|
5789
5789
|
);
|
|
5790
|
-
|
|
5791
|
-
throw
|
|
5790
|
+
error4.name = "ParserError";
|
|
5791
|
+
throw error4;
|
|
5792
5792
|
}
|
|
5793
5793
|
return ast;
|
|
5794
5794
|
},
|
|
@@ -5969,15 +5969,15 @@ var require_jmespath = __commonJS({
|
|
|
5969
5969
|
this._advance();
|
|
5970
5970
|
} else {
|
|
5971
5971
|
var t = this._lookaheadToken(0);
|
|
5972
|
-
var
|
|
5973
|
-
|
|
5974
|
-
throw
|
|
5972
|
+
var error4 = new Error("Expected " + tokenType + ", got: " + t.type);
|
|
5973
|
+
error4.name = "ParserError";
|
|
5974
|
+
throw error4;
|
|
5975
5975
|
}
|
|
5976
5976
|
},
|
|
5977
5977
|
_errorToken: function(token) {
|
|
5978
|
-
var
|
|
5979
|
-
|
|
5980
|
-
throw
|
|
5978
|
+
var error4 = new Error("Invalid token (" + token.type + '): "' + token.value + '"');
|
|
5979
|
+
error4.name = "ParserError";
|
|
5980
|
+
throw error4;
|
|
5981
5981
|
},
|
|
5982
5982
|
_parseIndexExpression: function() {
|
|
5983
5983
|
if (this._lookahead(0) === TOK_COLON || this._lookahead(1) === TOK_COLON) {
|
|
@@ -6016,9 +6016,9 @@ var require_jmespath = __commonJS({
|
|
|
6016
6016
|
this._advance();
|
|
6017
6017
|
} else {
|
|
6018
6018
|
var t = this._lookahead(0);
|
|
6019
|
-
var
|
|
6020
|
-
|
|
6021
|
-
throw
|
|
6019
|
+
var error4 = new Error("Syntax error, unexpected token: " + t.value + "(" + t.type + ")");
|
|
6020
|
+
error4.name = "Parsererror";
|
|
6021
|
+
throw error4;
|
|
6022
6022
|
}
|
|
6023
6023
|
currentToken = this._lookahead(0);
|
|
6024
6024
|
}
|
|
@@ -6058,9 +6058,9 @@ var require_jmespath = __commonJS({
|
|
|
6058
6058
|
right = this._parseDotRHS(rbp);
|
|
6059
6059
|
} else {
|
|
6060
6060
|
var t = this._lookaheadToken(0);
|
|
6061
|
-
var
|
|
6062
|
-
|
|
6063
|
-
throw
|
|
6061
|
+
var error4 = new Error("Sytanx error, unexpected token: " + t.value + "(" + t.type + ")");
|
|
6062
|
+
error4.name = "ParserError";
|
|
6063
|
+
throw error4;
|
|
6064
6064
|
}
|
|
6065
6065
|
return right;
|
|
6066
6066
|
},
|
|
@@ -6324,9 +6324,9 @@ var require_jmespath = __commonJS({
|
|
|
6324
6324
|
if (step === null) {
|
|
6325
6325
|
step = 1;
|
|
6326
6326
|
} else if (step === 0) {
|
|
6327
|
-
var
|
|
6328
|
-
|
|
6329
|
-
throw
|
|
6327
|
+
var error4 = new Error("Invalid slice, step cannot be 0");
|
|
6328
|
+
error4.name = "RuntimeError";
|
|
6329
|
+
throw error4;
|
|
6330
6330
|
}
|
|
6331
6331
|
var stepValueNegative = step < 0 ? true : false;
|
|
6332
6332
|
if (start === null) {
|
|
@@ -7012,8 +7012,8 @@ var require_request = __commonJS({
|
|
|
7012
7012
|
if (statusCode < 300) {
|
|
7013
7013
|
req.removeListener("httpData", AWS3.EventListeners.Core.HTTP_DATA);
|
|
7014
7014
|
req.removeListener("httpError", AWS3.EventListeners.Core.HTTP_ERROR);
|
|
7015
|
-
req.on("httpError", function streamHttpError(
|
|
7016
|
-
resp.error =
|
|
7015
|
+
req.on("httpError", function streamHttpError(error4) {
|
|
7016
|
+
resp.error = error4;
|
|
7017
7017
|
resp.error.retryable = false;
|
|
7018
7018
|
});
|
|
7019
7019
|
var shouldCheckContentLength = false;
|
|
@@ -9362,7 +9362,7 @@ var require_util = __commonJS({
|
|
|
9362
9362
|
var match = str.match(/^\s*function (.+)\(/);
|
|
9363
9363
|
return match ? match[1] : str;
|
|
9364
9364
|
},
|
|
9365
|
-
error: function
|
|
9365
|
+
error: function error4(err, options2) {
|
|
9366
9366
|
var originalError = null;
|
|
9367
9367
|
if (typeof err.message === "string" && err.message !== "") {
|
|
9368
9368
|
if (typeof options2 === "string" || options2 && options2.message) {
|
|
@@ -9682,9 +9682,9 @@ var require_util = __commonJS({
|
|
|
9682
9682
|
var profilesFromCreds = iniLoader.loadFrom({
|
|
9683
9683
|
filename: filename || process.env[util.configOptInEnv] && process.env[util.sharedCredentialsFileEnv]
|
|
9684
9684
|
});
|
|
9685
|
-
} catch (
|
|
9685
|
+
} catch (error4) {
|
|
9686
9686
|
if (!process.env[util.configOptInEnv])
|
|
9687
|
-
throw
|
|
9687
|
+
throw error4;
|
|
9688
9688
|
}
|
|
9689
9689
|
for (var i = 0, profileNames = Object.keys(profilesFromConfig); i < profileNames.length; i++) {
|
|
9690
9690
|
profiles[profileNames[i]] = objectAssign(profiles[profileNames[i]] || {}, profilesFromConfig[profileNames[i]]);
|
|
@@ -10079,9 +10079,9 @@ var require_parse_event = __commonJS({
|
|
|
10079
10079
|
function parseError(message) {
|
|
10080
10080
|
var errorCode = message.headers[":error-code"];
|
|
10081
10081
|
var errorMessage = message.headers[":error-message"];
|
|
10082
|
-
var
|
|
10083
|
-
|
|
10084
|
-
return
|
|
10082
|
+
var error4 = new Error(errorMessage.value || errorMessage);
|
|
10083
|
+
error4.code = error4.name = errorCode.value || errorCode;
|
|
10084
|
+
return error4;
|
|
10085
10085
|
}
|
|
10086
10086
|
module.exports = {
|
|
10087
10087
|
parseEvent
|
|
@@ -14788,7 +14788,7 @@ var require_sax = __commonJS({
|
|
|
14788
14788
|
parser.script = "";
|
|
14789
14789
|
break;
|
|
14790
14790
|
default:
|
|
14791
|
-
|
|
14791
|
+
error4(parser, "Max buffer length exceeded: " + buffers[i]);
|
|
14792
14792
|
}
|
|
14793
14793
|
}
|
|
14794
14794
|
maxActual = Math.max(maxActual, len);
|
|
@@ -15276,7 +15276,7 @@ var require_sax = __commonJS({
|
|
|
15276
15276
|
text = text.replace(/\s+/g, " ");
|
|
15277
15277
|
return text;
|
|
15278
15278
|
}
|
|
15279
|
-
function
|
|
15279
|
+
function error4(parser, er) {
|
|
15280
15280
|
closeText(parser);
|
|
15281
15281
|
if (parser.trackPosition) {
|
|
15282
15282
|
er += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c;
|
|
@@ -15290,7 +15290,7 @@ var require_sax = __commonJS({
|
|
|
15290
15290
|
if (parser.sawRoot && !parser.closedRoot)
|
|
15291
15291
|
strictFail(parser, "Unclosed root tag");
|
|
15292
15292
|
if (parser.state !== S.BEGIN && parser.state !== S.BEGIN_WHITESPACE && parser.state !== S.TEXT) {
|
|
15293
|
-
|
|
15293
|
+
error4(parser, "Unexpected end");
|
|
15294
15294
|
}
|
|
15295
15295
|
closeText(parser);
|
|
15296
15296
|
parser.c = "";
|
|
@@ -15304,7 +15304,7 @@ var require_sax = __commonJS({
|
|
|
15304
15304
|
throw new Error("bad call to strictFail");
|
|
15305
15305
|
}
|
|
15306
15306
|
if (parser.strict) {
|
|
15307
|
-
|
|
15307
|
+
error4(parser, message);
|
|
15308
15308
|
}
|
|
15309
15309
|
}
|
|
15310
15310
|
function newTag(parser) {
|
|
@@ -15545,7 +15545,7 @@ var require_sax = __commonJS({
|
|
|
15545
15545
|
throw this.error;
|
|
15546
15546
|
}
|
|
15547
15547
|
if (parser.closed) {
|
|
15548
|
-
return
|
|
15548
|
+
return error4(
|
|
15549
15549
|
parser,
|
|
15550
15550
|
"Cannot write after close. Assign an onready handler."
|
|
15551
15551
|
);
|
|
@@ -16258,11 +16258,11 @@ var require_parser2 = __commonJS({
|
|
|
16258
16258
|
});
|
|
16259
16259
|
this.saxParser.errThrown = false;
|
|
16260
16260
|
this.saxParser.onerror = function(_this) {
|
|
16261
|
-
return function(
|
|
16261
|
+
return function(error4) {
|
|
16262
16262
|
_this.saxParser.resume();
|
|
16263
16263
|
if (!_this.saxParser.errThrown) {
|
|
16264
16264
|
_this.saxParser.errThrown = true;
|
|
16265
|
-
return _this.emit("error",
|
|
16265
|
+
return _this.emit("error", error4);
|
|
16266
16266
|
}
|
|
16267
16267
|
};
|
|
16268
16268
|
}(this);
|
|
@@ -16559,10 +16559,10 @@ var require_node_parser = __commonJS({
|
|
|
16559
16559
|
NodeXmlParser.prototype.parse = function(xml, shape) {
|
|
16560
16560
|
shape = shape || {};
|
|
16561
16561
|
var result = null;
|
|
16562
|
-
var
|
|
16562
|
+
var error4 = null;
|
|
16563
16563
|
var parser = new xml2js.Parser(options2);
|
|
16564
16564
|
parser.parseString(xml, function(e, r) {
|
|
16565
|
-
|
|
16565
|
+
error4 = e;
|
|
16566
16566
|
result = r;
|
|
16567
16567
|
});
|
|
16568
16568
|
if (result) {
|
|
@@ -16571,8 +16571,8 @@ var require_node_parser = __commonJS({
|
|
|
16571
16571
|
data.ResponseMetadata = parseXml(result.ResponseMetadata[0], {});
|
|
16572
16572
|
}
|
|
16573
16573
|
return data;
|
|
16574
|
-
} else if (
|
|
16575
|
-
throw util.error(
|
|
16574
|
+
} else if (error4) {
|
|
16575
|
+
throw util.error(error4, { code: "XMLParserError", retryable: true });
|
|
16576
16576
|
} else {
|
|
16577
16577
|
return parseXml({}, shape);
|
|
16578
16578
|
}
|
|
@@ -16980,11 +16980,11 @@ var require_token_file_web_identity_credentials = __commonJS({
|
|
|
16980
16980
|
if (!this.service) {
|
|
16981
16981
|
var stsConfig = AWS3.util.merge({}, this.clientConfig);
|
|
16982
16982
|
this.service = new STS(stsConfig);
|
|
16983
|
-
this.service.retryableError = function(
|
|
16984
|
-
if (
|
|
16983
|
+
this.service.retryableError = function(error4) {
|
|
16984
|
+
if (error4.code === "IDPCommunicationErrorException" || error4.code === "InvalidIdentityToken") {
|
|
16985
16985
|
return true;
|
|
16986
16986
|
} else {
|
|
16987
|
-
return AWS3.Service.prototype.retryableError.call(this,
|
|
16987
|
+
return AWS3.Service.prototype.retryableError.call(this, error4);
|
|
16988
16988
|
}
|
|
16989
16989
|
};
|
|
16990
16990
|
}
|
|
@@ -235337,12 +235337,12 @@ var require_route53 = __commonJS({
|
|
|
235337
235337
|
var path = request.httpRequest.path;
|
|
235338
235338
|
request.httpRequest.path = path.replace(/\/%2F\w+%2F/, "/");
|
|
235339
235339
|
},
|
|
235340
|
-
retryableError: function retryableError(
|
|
235341
|
-
if (
|
|
235340
|
+
retryableError: function retryableError(error4) {
|
|
235341
|
+
if (error4.code === "PriorRequestNotComplete" && error4.statusCode === 400) {
|
|
235342
235342
|
return true;
|
|
235343
235343
|
} else {
|
|
235344
235344
|
var _super = AWS3.Service.prototype.retryableError;
|
|
235345
|
-
return _super.call(this,
|
|
235345
|
+
return _super.call(this, error4);
|
|
235346
235346
|
}
|
|
235347
235347
|
}
|
|
235348
235348
|
});
|
|
@@ -240268,22 +240268,22 @@ var require_managed_upload = __commonJS({
|
|
|
240268
240268
|
data.Bucket = this.request.params.Bucket;
|
|
240269
240269
|
upload.callback(err, data);
|
|
240270
240270
|
},
|
|
240271
|
-
progress: function progress(
|
|
240271
|
+
progress: function progress(info7) {
|
|
240272
240272
|
var upload = this._managedUpload;
|
|
240273
240273
|
if (this.operation === "putObject") {
|
|
240274
|
-
|
|
240275
|
-
|
|
240274
|
+
info7.part = 1;
|
|
240275
|
+
info7.key = this.params.Key;
|
|
240276
240276
|
} else {
|
|
240277
|
-
upload.totalUploadedBytes +=
|
|
240278
|
-
this._lastUploadedBytes =
|
|
240279
|
-
|
|
240277
|
+
upload.totalUploadedBytes += info7.loaded - this._lastUploadedBytes;
|
|
240278
|
+
this._lastUploadedBytes = info7.loaded;
|
|
240279
|
+
info7 = {
|
|
240280
240280
|
loaded: upload.totalUploadedBytes,
|
|
240281
240281
|
total: upload.totalBytes,
|
|
240282
240282
|
part: this.params.PartNumber,
|
|
240283
240283
|
key: this.params.Key
|
|
240284
240284
|
};
|
|
240285
240285
|
}
|
|
240286
|
-
upload.emit("httpUploadProgress", [
|
|
240286
|
+
upload.emit("httpUploadProgress", [info7]);
|
|
240287
240287
|
}
|
|
240288
240288
|
});
|
|
240289
240289
|
AWS3.util.mixin(AWS3.S3.ManagedUpload, AWS3.SequentialExecutor);
|
|
@@ -240663,22 +240663,22 @@ var require_s32 = __commonJS({
|
|
|
240663
240663
|
});
|
|
240664
240664
|
}
|
|
240665
240665
|
},
|
|
240666
|
-
retryableError: function retryableError(
|
|
240667
|
-
if (operationsWith200StatusCodeError[request.operation] &&
|
|
240666
|
+
retryableError: function retryableError(error4, request) {
|
|
240667
|
+
if (operationsWith200StatusCodeError[request.operation] && error4.statusCode === 200) {
|
|
240668
240668
|
return true;
|
|
240669
240669
|
} else if (request._requestRegionForBucket && request.service.bucketRegionCache[request._requestRegionForBucket]) {
|
|
240670
240670
|
return false;
|
|
240671
|
-
} else if (
|
|
240671
|
+
} else if (error4 && error4.code === "RequestTimeout") {
|
|
240672
240672
|
return true;
|
|
240673
|
-
} else if (
|
|
240674
|
-
request.httpRequest.region =
|
|
240675
|
-
if (
|
|
240673
|
+
} else if (error4 && regionRedirectErrorCodes.indexOf(error4.code) != -1 && error4.region && error4.region != request.httpRequest.region) {
|
|
240674
|
+
request.httpRequest.region = error4.region;
|
|
240675
|
+
if (error4.statusCode === 301) {
|
|
240676
240676
|
request.service.updateReqBucketRegion(request);
|
|
240677
240677
|
}
|
|
240678
240678
|
return true;
|
|
240679
240679
|
} else {
|
|
240680
240680
|
var _super = AWS3.Service.prototype.retryableError;
|
|
240681
|
-
return _super.call(this,
|
|
240681
|
+
return _super.call(this, error4, request);
|
|
240682
240682
|
}
|
|
240683
240683
|
},
|
|
240684
240684
|
updateReqBucketRegion: function updateReqBucketRegion(request, region) {
|
|
@@ -240794,10 +240794,10 @@ var require_s32 = __commonJS({
|
|
|
240794
240794
|
req.service.extractRequestIds(resp);
|
|
240795
240795
|
},
|
|
240796
240796
|
requestBucketRegion: function requestBucketRegion(resp, done) {
|
|
240797
|
-
var
|
|
240797
|
+
var error4 = resp.error;
|
|
240798
240798
|
var req = resp.request;
|
|
240799
240799
|
var bucket = req.params.Bucket || null;
|
|
240800
|
-
if (!
|
|
240800
|
+
if (!error4 || !bucket || error4.region || req.operation === "listObjects" || AWS3.util.isNode() && req.operation === "headBucket" || error4.statusCode === 400 && req.operation !== "headObject" || regionRedirectErrorCodes.indexOf(error4.code) === -1) {
|
|
240801
240801
|
return done();
|
|
240802
240802
|
}
|
|
240803
240803
|
var reqOperation = AWS3.util.isNode() ? "headBucket" : "listObjects";
|
|
@@ -240808,7 +240808,7 @@ var require_s32 = __commonJS({
|
|
|
240808
240808
|
regionReq._requestRegionForBucket = bucket;
|
|
240809
240809
|
regionReq.send(function() {
|
|
240810
240810
|
var region = req.service.bucketRegionCache[bucket] || null;
|
|
240811
|
-
|
|
240811
|
+
error4.region = region;
|
|
240812
240812
|
done();
|
|
240813
240813
|
});
|
|
240814
240814
|
},
|
|
@@ -240816,10 +240816,10 @@ var require_s32 = __commonJS({
|
|
|
240816
240816
|
if (!AWS3.util.isBrowser()) {
|
|
240817
240817
|
return done();
|
|
240818
240818
|
}
|
|
240819
|
-
var
|
|
240819
|
+
var error4 = resp.error;
|
|
240820
240820
|
var request = resp.request;
|
|
240821
240821
|
var bucket = request.params.Bucket;
|
|
240822
|
-
if (!
|
|
240822
|
+
if (!error4 || error4.code !== "NetworkingError" || !bucket || request.httpRequest.region === "us-east-1") {
|
|
240823
240823
|
return done();
|
|
240824
240824
|
}
|
|
240825
240825
|
var service = request.service;
|
|
@@ -404643,12 +404643,12 @@ var require_rdsdataservice = __commonJS({
|
|
|
404643
404643
|
"node_modules/aws-sdk/lib/services/rdsdataservice.js"() {
|
|
404644
404644
|
var AWS3 = require_core();
|
|
404645
404645
|
AWS3.util.update(AWS3.RDSDataService.prototype, {
|
|
404646
|
-
retryableError: function retryableError(
|
|
404647
|
-
if (
|
|
404646
|
+
retryableError: function retryableError(error4) {
|
|
404647
|
+
if (error4.code === "BadRequestException" && error4.message && error4.message.match(/^Communications link failure/) && error4.statusCode === 400) {
|
|
404648
404648
|
return true;
|
|
404649
404649
|
} else {
|
|
404650
404650
|
var _super = AWS3.Service.prototype.retryableError;
|
|
404651
|
-
return _super.call(this,
|
|
404651
|
+
return _super.call(this, error4);
|
|
404652
404652
|
}
|
|
404653
404653
|
}
|
|
404654
404654
|
});
|
|
@@ -628126,10 +628126,10 @@ var httpResponse = (res = {}) => {
|
|
|
628126
628126
|
status: res?.status || 0
|
|
628127
628127
|
};
|
|
628128
628128
|
};
|
|
628129
|
-
var handleAxiosError = (
|
|
628130
|
-
if (!
|
|
628131
|
-
throw
|
|
628132
|
-
return
|
|
628129
|
+
var handleAxiosError = (error4) => {
|
|
628130
|
+
if (!error4?.response && !error4?.request)
|
|
628131
|
+
throw error4;
|
|
628132
|
+
return error4.response ? httpResponse(error4.response) : httpResponse({ status: 500, data: { error: error4.request } });
|
|
628133
628133
|
};
|
|
628134
628134
|
var axiosHttpService = (config = {}) => {
|
|
628135
628135
|
config.adapter = httpAdapter;
|
|
@@ -628383,6 +628383,9 @@ __publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, paylo
|
|
|
628383
628383
|
return res;
|
|
628384
628384
|
});
|
|
628385
628385
|
|
|
628386
|
+
// src/helpers/input-validation-helper.ts
|
|
628387
|
+
import * as log7 from "lambda-log";
|
|
628388
|
+
|
|
628386
628389
|
// src/libs/http-error.ts
|
|
628387
628390
|
import { strict as assert } from "assert";
|
|
628388
628391
|
var deepClone = (o = {}) => JSON.parse(JSON.stringify(o));
|
|
@@ -628465,13 +628468,12 @@ __publicField(HttpError, "serviceUnavailable", (headers) => new _HttpError(503,
|
|
|
628465
628468
|
__publicField(HttpError, "gatewayTimeout", () => new _HttpError(504));
|
|
628466
628469
|
|
|
628467
628470
|
// src/helpers/input-validation-helper.ts
|
|
628468
|
-
import * as log7 from "lambda-log";
|
|
628469
628471
|
var validateInput = (schema, input) => {
|
|
628470
|
-
const { error:
|
|
628471
|
-
if (
|
|
628472
|
-
log7.info("", { error:
|
|
628473
|
-
const httperr = HttpError.badRequest("
|
|
628474
|
-
errors:
|
|
628472
|
+
const { error: error4, value } = schema.validate(input);
|
|
628473
|
+
if (error4) {
|
|
628474
|
+
log7.info("", { error: error4 });
|
|
628475
|
+
const httperr = HttpError.badRequest("Bad Request", {
|
|
628476
|
+
errors: error4.details.map((detail) => ({
|
|
628475
628477
|
message: detail?.message,
|
|
628476
628478
|
key: detail?.context?.key,
|
|
628477
628479
|
path: detail?.path
|
|
@@ -628501,13 +628503,13 @@ var success = (body) => {
|
|
|
628501
628503
|
var defaultError = {
|
|
628502
628504
|
message: "internalServerError"
|
|
628503
628505
|
};
|
|
628504
|
-
var failure = (
|
|
628505
|
-
statusCode =
|
|
628506
|
+
var failure = (error4, statusCode = 500) => {
|
|
628507
|
+
statusCode = error4?.statusCode ?? statusCode;
|
|
628506
628508
|
let body = defaultError;
|
|
628507
|
-
if (
|
|
628508
|
-
body =
|
|
628509
|
-
} else if (
|
|
628510
|
-
body = { message:
|
|
628509
|
+
if (error4?.body) {
|
|
628510
|
+
body = error4.body;
|
|
628511
|
+
} else if (error4?.message) {
|
|
628512
|
+
body = { message: error4.message };
|
|
628511
628513
|
} else if (statusCode === 500) {
|
|
628512
628514
|
body = defaultError;
|
|
628513
628515
|
}
|
|
@@ -628529,6 +628531,10 @@ var buildResponse = (statusCode, body = {}) => {
|
|
|
628529
628531
|
};
|
|
628530
628532
|
};
|
|
628531
628533
|
|
|
628534
|
+
// src/helpers/shopify-helper.ts
|
|
628535
|
+
import { createHmac } from "crypto";
|
|
628536
|
+
import * as log9 from "lambda-log";
|
|
628537
|
+
|
|
628532
628538
|
// src/libs/crypto.ts
|
|
628533
628539
|
import crypto from "crypto";
|
|
628534
628540
|
var generatePublicKey = () => {
|
|
@@ -628597,9 +628603,6 @@ var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
|
|
|
628597
628603
|
return HttpStatusCodes2;
|
|
628598
628604
|
})(HttpStatusCodes || {});
|
|
628599
628605
|
|
|
628600
|
-
// src/libs/shopify.ts
|
|
628601
|
-
import { createHmac } from "crypto";
|
|
628602
|
-
|
|
628603
628606
|
// src/libs/url.ts
|
|
628604
628607
|
var mapObjectToQueryString = (inputObj) => {
|
|
628605
628608
|
const qsp = Object.entries(inputObj).sort((a, b) => a[0] < b[0] ? -1 : 1);
|
|
@@ -628611,13 +628614,24 @@ var mapObjectToQueryString = (inputObj) => {
|
|
|
628611
628614
|
return qs;
|
|
628612
628615
|
};
|
|
628613
628616
|
|
|
628614
|
-
// src/
|
|
628615
|
-
var
|
|
628617
|
+
// src/helpers/shopify-helper.ts
|
|
628618
|
+
var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
628616
628619
|
delete validationParams.hmac;
|
|
628617
628620
|
const hmacString = mapObjectToQueryString(validationParams);
|
|
628618
628621
|
const generatedHash = createHmac("sha256", shopifyAppApiSecret).update(hmacString).digest("hex");
|
|
628619
628622
|
return generatedHash === validationHmac;
|
|
628620
628623
|
};
|
|
628624
|
+
var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
628625
|
+
log9.info("Validating shopify request is authentic", { validationParams });
|
|
628626
|
+
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
628627
|
+
if (!isValid) {
|
|
628628
|
+
const message = "Failed: Shopify Request hmac validation";
|
|
628629
|
+
log9.error(message);
|
|
628630
|
+
throw HttpError.badRequest(message);
|
|
628631
|
+
}
|
|
628632
|
+
log9.info("Sucess: Shopify Request hmac validation");
|
|
628633
|
+
return true;
|
|
628634
|
+
};
|
|
628621
628635
|
|
|
628622
628636
|
// src/types/internal-events/event-detail-types.ts
|
|
628623
628637
|
var ADTRACKIFY_EVENT_TYPES = /* @__PURE__ */ ((ADTRACKIFY_EVENT_TYPES2) => {
|
|
@@ -628650,10 +628664,11 @@ export {
|
|
|
628650
628664
|
getCurrentDate,
|
|
628651
628665
|
getCurrentTimestamp,
|
|
628652
628666
|
getDateFromTimestamp,
|
|
628667
|
+
isShopifyRequestValid,
|
|
628653
628668
|
mapObjectToQueryString,
|
|
628654
628669
|
success,
|
|
628655
628670
|
validateInput,
|
|
628656
|
-
|
|
628671
|
+
validateShopifyRequest
|
|
628657
628672
|
};
|
|
628658
628673
|
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
|
|
628659
628674
|
//# sourceMappingURL=index.js.map
|