@adtrackify/at-service-common 1.0.42 → 1.0.43

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.js CHANGED
@@ -267,33 +267,33 @@ var require_json = __commonJS({
267
267
  populateHostPrefix(req);
268
268
  }
269
269
  function extractError(resp) {
270
- var error4 = {};
270
+ var error5 = {};
271
271
  var httpResponse2 = resp.httpResponse;
272
- error4.code = httpResponse2.headers["x-amzn-errortype"] || "UnknownError";
273
- if (typeof error4.code === "string") {
274
- error4.code = error4.code.split(":")[0];
272
+ error5.code = httpResponse2.headers["x-amzn-errortype"] || "UnknownError";
273
+ if (typeof error5.code === "string") {
274
+ error5.code = error5.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
- error4.code = code.split("#").pop();
281
+ error5.code = code.split("#").pop();
282
282
  }
283
- if (error4.code === "RequestEntityTooLarge") {
284
- error4.message = "Request body must be less than 1 MB";
283
+ if (error5.code === "RequestEntityTooLarge") {
284
+ error5.message = "Request body must be less than 1 MB";
285
285
  } else {
286
- error4.message = e.message || e.Message || null;
286
+ error5.message = e.message || e.Message || null;
287
287
  }
288
288
  } catch (e2) {
289
- error4.statusCode = httpResponse2.statusCode;
290
- error4.message = httpResponse2.statusMessage;
289
+ error5.statusCode = httpResponse2.statusCode;
290
+ error5.message = httpResponse2.statusMessage;
291
291
  }
292
292
  } else {
293
- error4.statusCode = httpResponse2.statusCode;
294
- error4.message = httpResponse2.statusCode.toString();
293
+ error5.statusCode = httpResponse2.statusCode;
294
+ error5.message = httpResponse2.statusCode.toString();
295
295
  }
296
- resp.error = util.error(new Error(), error4);
296
+ resp.error = util.error(new Error(), error5);
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 error4 = prevError || null;
3042
+ var error5 = prevError || null;
3043
3043
  function callNextListener(err) {
3044
3044
  if (err) {
3045
- error4 = AWS3.util.error(error4 || new Error(), err);
3045
+ error5 = AWS3.util.error(error5 || new Error(), err);
3046
3046
  if (self._haltHandlersOnError) {
3047
- return doneCallback.call(self, error4);
3047
+ return doneCallback.call(self, error5);
3048
3048
  }
3049
3049
  }
3050
- self.callListeners(listeners, args, doneCallback, error4);
3050
+ self.callListeners(listeners, args, doneCallback, error5);
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
- error4 = AWS3.util.error(error4 || new Error(), err);
3061
+ error5 = AWS3.util.error(error5 || new Error(), err);
3062
3062
  }
3063
- if (error4 && self._haltHandlersOnError) {
3064
- doneCallback.call(self, error4);
3063
+ if (error5 && self._haltHandlersOnError) {
3064
+ doneCallback.call(self, error5);
3065
3065
  return;
3066
3066
  }
3067
3067
  }
3068
3068
  }
3069
- doneCallback.call(self, error4);
3069
+ doneCallback.call(self, error5);
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 error4 = response.error;
3659
+ var error5 = response.error;
3660
3660
  var statusCode = response.httpResponse.statusCode;
3661
3661
  if (statusCode > 299) {
3662
- if (error4.code)
3663
- monitoringEvent.FinalAwsException = error4.code;
3664
- if (error4.message)
3665
- monitoringEvent.FinalAwsExceptionMessage = error4.message;
3662
+ if (error5.code)
3663
+ monitoringEvent.FinalAwsException = error5.code;
3664
+ if (error5.message)
3665
+ monitoringEvent.FinalAwsExceptionMessage = error5.message;
3666
3666
  } else {
3667
- if (error4.code || error4.name)
3668
- monitoringEvent.FinalSdkException = error4.code || error4.name;
3669
- if (error4.message)
3670
- monitoringEvent.FinalSdkExceptionMessage = error4.message;
3667
+ if (error5.code || error5.name)
3668
+ monitoringEvent.FinalSdkException = error5.code || error5.name;
3669
+ if (error5.message)
3670
+ monitoringEvent.FinalSdkExceptionMessage = error5.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 error4 = response.error;
3711
+ var error5 = response.error;
3712
3712
  if (response.httpResponse.statusCode > 299) {
3713
- if (error4.code)
3714
- monitoringEvent.AwsException = error4.code;
3715
- if (error4.message)
3716
- monitoringEvent.AwsExceptionMessage = error4.message;
3713
+ if (error5.code)
3714
+ monitoringEvent.AwsException = error5.code;
3715
+ if (error5.message)
3716
+ monitoringEvent.AwsExceptionMessage = error5.message;
3717
3717
  } else {
3718
- if (error4.code || error4.name)
3719
- monitoringEvent.SdkException = error4.code || error4.name;
3720
- if (error4.message)
3721
- monitoringEvent.SdkExceptionMessage = error4.message;
3718
+ if (error5.code || error5.name)
3719
+ monitoringEvent.SdkException = error5.code || error5.name;
3720
+ if (error5.message)
3721
+ monitoringEvent.SdkExceptionMessage = error5.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(error4) {
3832
- if (this.timeoutError(error4))
3831
+ retryableError: function retryableError(error5) {
3832
+ if (this.timeoutError(error5))
3833
3833
  return true;
3834
- if (this.networkingError(error4))
3834
+ if (this.networkingError(error5))
3835
3835
  return true;
3836
- if (this.expiredCredentialsError(error4))
3836
+ if (this.expiredCredentialsError(error5))
3837
3837
  return true;
3838
- if (this.throttledError(error4))
3838
+ if (this.throttledError(error5))
3839
3839
  return true;
3840
- if (error4.statusCode >= 500)
3840
+ if (error5.statusCode >= 500)
3841
3841
  return true;
3842
3842
  return false;
3843
3843
  },
3844
- networkingError: function networkingError(error4) {
3845
- return error4.code === "NetworkingError";
3844
+ networkingError: function networkingError(error5) {
3845
+ return error5.code === "NetworkingError";
3846
3846
  },
3847
- timeoutError: function timeoutError(error4) {
3848
- return error4.code === "TimeoutError";
3847
+ timeoutError: function timeoutError(error5) {
3848
+ return error5.code === "TimeoutError";
3849
3849
  },
3850
- expiredCredentialsError: function expiredCredentialsError(error4) {
3851
- return error4.code === "ExpiredTokenException";
3850
+ expiredCredentialsError: function expiredCredentialsError(error5) {
3851
+ return error5.code === "ExpiredTokenException";
3852
3852
  },
3853
- clockSkewError: function clockSkewError(error4) {
3854
- switch (error4.code) {
3853
+ clockSkewError: function clockSkewError(error5) {
3854
+ switch (error5.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(error4) {
3880
- if (error4.statusCode === 429)
3879
+ throttledError: function throttledError(error5) {
3880
+ if (error5.statusCode === 429)
3881
3881
  return true;
3882
- switch (error4.code) {
3882
+ switch (error5.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 error4 = response.error;
4602
+ var error5 = response.error;
4603
4603
  var httpResponse2 = response.httpResponse;
4604
- if (error4 && (error4.code === "InvalidEndpointException" || httpResponse2.statusCode === 421)) {
4604
+ if (error5 && (error5.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 error4(err) {
5006
+ function error5(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
- error4
5029
+ error5
5030
5030
  );
5031
5031
  progress(stream);
5032
5032
  } catch (err) {
5033
- error4(err);
5033
+ error5(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 error4 = new Error("Unknown character:" + stream[this._current]);
5602
- error4.name = "LexerError";
5603
- throw error4;
5601
+ var error5 = new Error("Unknown character:" + stream[this._current]);
5602
+ error5.name = "LexerError";
5603
+ throw error5;
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 error4 = new Error(
5787
+ var error5 = new Error(
5788
5788
  "Unexpected token type: " + t.type + ", value: " + t.value
5789
5789
  );
5790
- error4.name = "ParserError";
5791
- throw error4;
5790
+ error5.name = "ParserError";
5791
+ throw error5;
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 error4 = new Error("Expected " + tokenType + ", got: " + t.type);
5973
- error4.name = "ParserError";
5974
- throw error4;
5972
+ var error5 = new Error("Expected " + tokenType + ", got: " + t.type);
5973
+ error5.name = "ParserError";
5974
+ throw error5;
5975
5975
  }
5976
5976
  },
5977
5977
  _errorToken: function(token) {
5978
- var error4 = new Error("Invalid token (" + token.type + '): "' + token.value + '"');
5979
- error4.name = "ParserError";
5980
- throw error4;
5978
+ var error5 = new Error("Invalid token (" + token.type + '): "' + token.value + '"');
5979
+ error5.name = "ParserError";
5980
+ throw error5;
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 error4 = new Error("Syntax error, unexpected token: " + t.value + "(" + t.type + ")");
6020
- error4.name = "Parsererror";
6021
- throw error4;
6019
+ var error5 = new Error("Syntax error, unexpected token: " + t.value + "(" + t.type + ")");
6020
+ error5.name = "Parsererror";
6021
+ throw error5;
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 error4 = new Error("Sytanx error, unexpected token: " + t.value + "(" + t.type + ")");
6062
- error4.name = "ParserError";
6063
- throw error4;
6061
+ var error5 = new Error("Sytanx error, unexpected token: " + t.value + "(" + t.type + ")");
6062
+ error5.name = "ParserError";
6063
+ throw error5;
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 error4 = new Error("Invalid slice, step cannot be 0");
6328
- error4.name = "RuntimeError";
6329
- throw error4;
6327
+ var error5 = new Error("Invalid slice, step cannot be 0");
6328
+ error5.name = "RuntimeError";
6329
+ throw error5;
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(error4) {
7016
- resp.error = error4;
7015
+ req.on("httpError", function streamHttpError(error5) {
7016
+ resp.error = error5;
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 error4(err, options2) {
9365
+ error: function error5(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 (error4) {
9685
+ } catch (error5) {
9686
9686
  if (!process.env[util.configOptInEnv])
9687
- throw error4;
9687
+ throw error5;
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 error4 = new Error(errorMessage.value || errorMessage);
10083
- error4.code = error4.name = errorCode.value || errorCode;
10084
- return error4;
10082
+ var error5 = new Error(errorMessage.value || errorMessage);
10083
+ error5.code = error5.name = errorCode.value || errorCode;
10084
+ return error5;
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
- error4(parser, "Max buffer length exceeded: " + buffers[i]);
14791
+ error5(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 error4(parser, er) {
15279
+ function error5(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
- error4(parser, "Unexpected end");
15293
+ error5(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
- error4(parser, message);
15307
+ error5(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 error4(
15548
+ return error5(
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(error4) {
16261
+ return function(error5) {
16262
16262
  _this.saxParser.resume();
16263
16263
  if (!_this.saxParser.errThrown) {
16264
16264
  _this.saxParser.errThrown = true;
16265
- return _this.emit("error", error4);
16265
+ return _this.emit("error", error5);
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 error4 = null;
16562
+ var error5 = null;
16563
16563
  var parser = new xml2js.Parser(options2);
16564
16564
  parser.parseString(xml, function(e, r) {
16565
- error4 = e;
16565
+ error5 = 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 (error4) {
16575
- throw util.error(error4, { code: "XMLParserError", retryable: true });
16574
+ } else if (error5) {
16575
+ throw util.error(error5, { 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(error4) {
16984
- if (error4.code === "IDPCommunicationErrorException" || error4.code === "InvalidIdentityToken") {
16983
+ this.service.retryableError = function(error5) {
16984
+ if (error5.code === "IDPCommunicationErrorException" || error5.code === "InvalidIdentityToken") {
16985
16985
  return true;
16986
16986
  } else {
16987
- return AWS3.Service.prototype.retryableError.call(this, error4);
16987
+ return AWS3.Service.prototype.retryableError.call(this, error5);
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(error4) {
235341
- if (error4.code === "PriorRequestNotComplete" && error4.statusCode === 400) {
235340
+ retryableError: function retryableError(error5) {
235341
+ if (error5.code === "PriorRequestNotComplete" && error5.statusCode === 400) {
235342
235342
  return true;
235343
235343
  } else {
235344
235344
  var _super = AWS3.Service.prototype.retryableError;
235345
- return _super.call(this, error4);
235345
+ return _super.call(this, error5);
235346
235346
  }
235347
235347
  }
235348
235348
  });
@@ -240663,22 +240663,22 @@ var require_s32 = __commonJS({
240663
240663
  });
240664
240664
  }
240665
240665
  },
240666
- retryableError: function retryableError(error4, request) {
240667
- if (operationsWith200StatusCodeError[request.operation] && error4.statusCode === 200) {
240666
+ retryableError: function retryableError(error5, request) {
240667
+ if (operationsWith200StatusCodeError[request.operation] && error5.statusCode === 200) {
240668
240668
  return true;
240669
240669
  } else if (request._requestRegionForBucket && request.service.bucketRegionCache[request._requestRegionForBucket]) {
240670
240670
  return false;
240671
- } else if (error4 && error4.code === "RequestTimeout") {
240671
+ } else if (error5 && error5.code === "RequestTimeout") {
240672
240672
  return true;
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) {
240673
+ } else if (error5 && regionRedirectErrorCodes.indexOf(error5.code) != -1 && error5.region && error5.region != request.httpRequest.region) {
240674
+ request.httpRequest.region = error5.region;
240675
+ if (error5.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, error4, request);
240681
+ return _super.call(this, error5, 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 error4 = resp.error;
240797
+ var error5 = resp.error;
240798
240798
  var req = resp.request;
240799
240799
  var bucket = req.params.Bucket || null;
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) {
240800
+ if (!error5 || !bucket || error5.region || req.operation === "listObjects" || AWS3.util.isNode() && req.operation === "headBucket" || error5.statusCode === 400 && req.operation !== "headObject" || regionRedirectErrorCodes.indexOf(error5.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
- error4.region = region;
240811
+ error5.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 error4 = resp.error;
240819
+ var error5 = resp.error;
240820
240820
  var request = resp.request;
240821
240821
  var bucket = request.params.Bucket;
240822
- if (!error4 || error4.code !== "NetworkingError" || !bucket || request.httpRequest.region === "us-east-1") {
240822
+ if (!error5 || error5.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(error4) {
404647
- if (error4.code === "BadRequestException" && error4.message && error4.message.match(/^Communications link failure/) && error4.statusCode === 400) {
404646
+ retryableError: function retryableError(error5) {
404647
+ if (error5.code === "BadRequestException" && error5.message && error5.message.match(/^Communications link failure/) && error5.statusCode === 400) {
404648
404648
  return true;
404649
404649
  } else {
404650
404650
  var _super = AWS3.Service.prototype.retryableError;
404651
- return _super.call(this, error4);
404651
+ return _super.call(this, error5);
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 = (error4) => {
628130
- if (!error4?.response && !error4?.request)
628131
- throw error4;
628132
- return error4.response ? httpResponse(error4.response) : httpResponse({ status: 500, data: { error: error4.request } });
628129
+ var handleAxiosError = (error5) => {
628130
+ if (!error5?.response && !error5?.request)
628131
+ throw error5;
628132
+ return error5.response ? httpResponse(error5.response) : httpResponse({ status: 500, data: { error: error5.request } });
628133
628133
  };
628134
628134
  var axiosHttpService = (config = {}) => {
628135
628135
  config.adapter = httpAdapter;
@@ -628216,6 +628216,12 @@ var AccountsClient = class {
628216
628216
  log4.info("createAccountResponse", { createAccountResponse });
628217
628217
  return createAccountResponse;
628218
628218
  };
628219
+ updateAccount = async (accountId, body) => {
628220
+ const client2 = await this.getClient();
628221
+ const response = await client2.patch(`/${accountId}/`, body);
628222
+ log4.info("update Account response", { response });
628223
+ return response;
628224
+ };
628219
628225
  addOwner = async (accountId, userId) => {
628220
628226
  const client2 = await this.getClient();
628221
628227
  const addOwnerResponse = await client2.post("/addOwner", { accountId, userId });
@@ -628248,7 +628254,192 @@ var AccountsClient = class {
628248
628254
  };
628249
628255
 
628250
628256
  // src/clients/internal-api/users-auth-client.ts
628257
+ import * as log6 from "lambda-log";
628258
+
628259
+ // src/helpers/shopify-helper.ts
628260
+ import { createHmac } from "crypto";
628251
628261
  import * as log5 from "lambda-log";
628262
+
628263
+ // src/libs/url.ts
628264
+ var mapObjectToQueryString = (inputObj) => {
628265
+ const qsp = Object.entries(inputObj).sort((a, b) => a[0] < b[0] ? -1 : 1);
628266
+ const urlParams = new URLSearchParams();
628267
+ qsp.map((p) => {
628268
+ urlParams.append(p[0], p[1]);
628269
+ });
628270
+ const qs = urlParams.toString();
628271
+ return qs;
628272
+ };
628273
+
628274
+ // src/helpers/shopify-helper.ts
628275
+ var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
628276
+ delete validationParams.hmac;
628277
+ const hmacString = mapObjectToQueryString(validationParams);
628278
+ const generatedHash = createHmac("sha256", shopifyAppApiSecret).update(hmacString).digest("hex");
628279
+ return generatedHash === validationHmac;
628280
+ };
628281
+ var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
628282
+ log5.info("Validating shopify request is authentic", { validationParams });
628283
+ const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
628284
+ if (!isValid) {
628285
+ const message = "Failed: Shopify Request hmac validation";
628286
+ log5.error(message);
628287
+ throw HttpError.badRequest(message);
628288
+ }
628289
+ log5.info("Sucess: Shopify Request hmac validation");
628290
+ return true;
628291
+ };
628292
+
628293
+ // src/libs/crypto.ts
628294
+ import crypto from "crypto";
628295
+ var generatePublicKey = () => {
628296
+ const publicKey = crypto.randomBytes(26);
628297
+ return publicKey.toString("utf8");
628298
+ };
628299
+
628300
+ // src/libs/http-error.ts
628301
+ import { strict as assert } from "assert";
628302
+ var deepClone = (o = {}) => JSON.parse(JSON.stringify(o));
628303
+ var containsStackTrace = (text = "") => /at.+\.js:\d+:\d+/.test(text);
628304
+ var objectContainsStackTrace = (obj) => !obj ? false : containsStackTrace(JSON.stringify(obj));
628305
+ var supportedStatusCodes = {
628306
+ 400: "Bad Request",
628307
+ 401: "Unauthorized",
628308
+ 403: "Forbidden",
628309
+ 404: "Not Found",
628310
+ 405: "Method Not Allowed",
628311
+ 409: "Conflict",
628312
+ 412: "Precondition Failed",
628313
+ 413: "Payload Too Large",
628314
+ 415: "Unsupported Media Type",
628315
+ 428: "Precondition Required",
628316
+ 429: "Too Many Requests",
628317
+ 500: "Internal Server Error",
628318
+ 501: "Not Implemented",
628319
+ 502: "Bad Gateway",
628320
+ 503: "Service Unavailable",
628321
+ 504: "Gateway Timeout"
628322
+ };
628323
+ var supportedStatusCodesMessage = `statusCode must be one of the following: ${JSON.stringify(Object.keys(supportedStatusCodes))}`;
628324
+ var onlyStatusCodeMessage = "Server errors may not specify any parameter except statusCode";
628325
+ var isNullOrUndefined = (value) => value === null || value === void 0;
628326
+ var _HttpError = class extends Error {
628327
+ body;
628328
+ headers;
628329
+ statusCode;
628330
+ isServerError;
628331
+ constructor(statusCode, message, body, headers) {
628332
+ assert(statusCode in supportedStatusCodes, supportedStatusCodesMessage);
628333
+ const isServerError = statusCode > 499;
628334
+ if (isServerError) {
628335
+ assert(
628336
+ isNullOrUndefined(message) && isNullOrUndefined(body),
628337
+ onlyStatusCodeMessage
628338
+ );
628339
+ message = supportedStatusCodes[statusCode];
628340
+ } else {
628341
+ assert(
628342
+ body === void 0 || typeof body === "object",
628343
+ "body must be an object or omitted"
628344
+ );
628345
+ assert(
628346
+ headers === void 0 || typeof headers === "object",
628347
+ "headers must be an object or omitted"
628348
+ );
628349
+ message = message ?? supportedStatusCodes[statusCode];
628350
+ assert(
628351
+ !containsStackTrace(message) && !objectContainsStackTrace(body),
628352
+ "the message or data parameters may not contain errors or stack traces"
628353
+ );
628354
+ }
628355
+ super(message);
628356
+ this.body = deepClone(body);
628357
+ this.headers = deepClone(headers);
628358
+ this.statusCode = statusCode;
628359
+ this.isServerError = isServerError;
628360
+ if (!this?.body?.message) {
628361
+ this.body.message = this.message;
628362
+ }
628363
+ }
628364
+ static get supportedStatusCodes() {
628365
+ return supportedStatusCodes;
628366
+ }
628367
+ };
628368
+ var HttpError = _HttpError;
628369
+ __publicField(HttpError, "badRequest", (message, body, headers) => {
628370
+ return new _HttpError(400, message, body, headers);
628371
+ });
628372
+ __publicField(HttpError, "unauthorized", (message, body, headers) => new _HttpError(401, message, body, headers));
628373
+ __publicField(HttpError, "forbidden", (message, body, headers) => new _HttpError(403, message, body, headers));
628374
+ __publicField(HttpError, "notFound", (message, body, headers) => new _HttpError(404, message, body, headers));
628375
+ __publicField(HttpError, "internal", (message, body, headers) => new _HttpError(500, message, body, headers));
628376
+ __publicField(HttpError, "notImplemented", () => new _HttpError(501));
628377
+ __publicField(HttpError, "badGateway", () => new _HttpError(502));
628378
+ __publicField(HttpError, "serviceUnavailable", (headers) => new _HttpError(503, void 0, void 0, headers));
628379
+ __publicField(HttpError, "gatewayTimeout", () => new _HttpError(504));
628380
+
628381
+ // src/libs/http-status-codes.ts
628382
+ var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
628383
+ HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
628384
+ HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
628385
+ HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
628386
+ HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
628387
+ HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
628388
+ HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
628389
+ HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
628390
+ HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
628391
+ HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
628392
+ HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
628393
+ HttpStatusCodes2[HttpStatusCodes2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
628394
+ HttpStatusCodes2[HttpStatusCodes2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
628395
+ HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
628396
+ HttpStatusCodes2[HttpStatusCodes2["MOVED_TEMPORARILY"] = 302] = "MOVED_TEMPORARILY";
628397
+ HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
628398
+ HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
628399
+ HttpStatusCodes2[HttpStatusCodes2["USE_PROXY"] = 305] = "USE_PROXY";
628400
+ HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
628401
+ HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
628402
+ HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
628403
+ HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
628404
+ HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
628405
+ HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
628406
+ HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
628407
+ HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
628408
+ HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
628409
+ HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
628410
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
628411
+ HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
628412
+ HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
628413
+ HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
628414
+ HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
628415
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_TOO_LONG"] = 413] = "REQUEST_TOO_LONG";
628416
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
628417
+ HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
628418
+ HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
628419
+ HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
628420
+ HttpStatusCodes2[HttpStatusCodes2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
628421
+ HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_SPACE_ON_RESOURCE"] = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE";
628422
+ HttpStatusCodes2[HttpStatusCodes2["METHOD_FAILURE"] = 420] = "METHOD_FAILURE";
628423
+ HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
628424
+ HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
628425
+ HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
628426
+ HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
628427
+ HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
628428
+ HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
628429
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
628430
+ HttpStatusCodes2[HttpStatusCodes2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
628431
+ HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
628432
+ HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
628433
+ HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
628434
+ HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
628435
+ HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
628436
+ HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
628437
+ HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
628438
+ HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
628439
+ return HttpStatusCodes2;
628440
+ })(HttpStatusCodes || {});
628441
+
628442
+ // src/clients/internal-api/users-auth-client.ts
628252
628443
  var UsersAuthClient = class {
628253
628444
  SERVICE_API_ROOT_URL;
628254
628445
  BASE_API_URL;
@@ -628269,11 +628460,41 @@ var UsersAuthClient = class {
628269
628460
  getClient = async () => {
628270
628461
  return axiosHttpService(this.getConfig());
628271
628462
  };
628463
+ signupAndConfirmUser = async (userSignupRequest) => {
628464
+ const user = await this.signupUser(userSignupRequest);
628465
+ await this.adminConfirmUser(user.email);
628466
+ return user;
628467
+ };
628272
628468
  signupUser = async (userSignupRequest) => {
628469
+ log6.info("Attempting to signup user", { email: userSignupRequest.email });
628273
628470
  const client2 = await this.getClient();
628274
- const signupUserResponse = await client2.post("/signup", userSignupRequest);
628275
- log5.info("signupUser response", { signupUserResponse });
628276
- return signupUserResponse;
628471
+ const response = await client2.post("/signup", userSignupRequest);
628472
+ if (response.status !== 200 || !response?.data?.user) {
628473
+ const message = "User Signup Failed";
628474
+ log6.error(message, { response });
628475
+ throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
628476
+ }
628477
+ log6.info("User Signup Successful", { response });
628478
+ return response.data.user;
628479
+ };
628480
+ adminConfirmUser = async (userName) => {
628481
+ log6.info("Attempting to admin confirm user", { userName });
628482
+ const client2 = await this.getClient();
628483
+ const response = await client2.post("/admin/confirm", {
628484
+ headers: {
628485
+ "x-api-key": this.USERS_AUTH_API_KEY
628486
+ },
628487
+ params: {
628488
+ userName
628489
+ }
628490
+ });
628491
+ if (response.status !== 200) {
628492
+ const message = "Admin User Confirmation Failed";
628493
+ log6.error(message, { response });
628494
+ throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
628495
+ }
628496
+ log6.info("Admin User Confirmation Successful", { response });
628497
+ return response.data.user;
628277
628498
  };
628278
628499
  getUserByEmail = async (email) => {
628279
628500
  const client2 = await this.getClient();
@@ -628285,13 +628506,13 @@ var UsersAuthClient = class {
628285
628506
  email
628286
628507
  }
628287
628508
  });
628288
- log5.info("getUserResponse", { getUserResponse });
628509
+ log6.info("getUserResponse", { getUserResponse });
628289
628510
  return getUserResponse;
628290
628511
  };
628291
628512
  };
628292
628513
 
628293
628514
  // src/clients/third-party/shopify-client.ts
628294
- import * as log6 from "lambda-log";
628515
+ import * as log7 from "lambda-log";
628295
628516
  var _shopify_api_version = process.env.SHOPIFY_API_VERSION;
628296
628517
  var _ShopifyClient = class {
628297
628518
  };
@@ -628335,9 +628556,9 @@ __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, e
628335
628556
  };
628336
628557
  const res = await client2.post(url, payload2, { headers: { "X-Shopify-Access-Token": accessToken } });
628337
628558
  if (res.status >= 400) {
628338
- log6.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload: payload2 });
628559
+ log7.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload: payload2 });
628339
628560
  }
628340
- log6.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
628561
+ log7.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
628341
628562
  return res;
628342
628563
  });
628343
628564
  __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
@@ -628352,7 +628573,7 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
628352
628573
  };
628353
628574
  const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload2);
628354
628575
  if (res.status >= 400) {
628355
- log6.error("Failed to register Webhook Topic", { shop, accessToken, url, payload: payload2 });
628576
+ log7.error("Failed to register Webhook Topic", { shop, accessToken, url, payload: payload2 });
628356
628577
  }
628357
628578
  return res;
628358
628579
  });
@@ -628360,140 +628581,57 @@ __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessTok
628360
628581
  const url = `https://${shop}/admin/api/${_shopify_api_version}/shop.json`;
628361
628582
  const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
628362
628583
  if (res.status >= 400) {
628363
- log6.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
628584
+ log7.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
628364
628585
  }
628365
628586
  return res;
628366
628587
  });
628367
628588
  __publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload2) => {
628368
628589
  const client2 = axiosHttpService();
628369
628590
  const res = await client2.post(url, payload2, { headers: { "X-Shopify-Access-Token": accessToken } });
628370
- log6.debug("Shopify Client Response", { res });
628591
+ log7.debug("Shopify Client Response", { res });
628371
628592
  return res;
628372
628593
  });
628373
628594
  __publicField(ShopifyClient, "genericShopifyGet", async (url, accessToken) => {
628374
628595
  const client2 = axiosHttpService();
628375
628596
  const res = await client2.get(url, { headers: { "X-Shopify-Access-Token": accessToken } });
628376
- log6.debug("Shopify Client Response", { res });
628597
+ log7.debug("Shopify Client Response", { res });
628377
628598
  return res;
628378
628599
  });
628379
628600
  __publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, payload2) => {
628380
628601
  const client2 = axiosHttpService();
628381
628602
  const res = await client2.put(url, payload2, { headers: { "X-Shopify-Access-Token": accessToken } });
628382
- log6.debug("Shopify Client Response", { res });
628603
+ log7.debug("Shopify Client Response", { res });
628383
628604
  return res;
628384
628605
  });
628385
628606
 
628386
628607
  // src/helpers/input-validation-helper.ts
628387
- import * as log7 from "lambda-log";
628388
-
628389
- // src/libs/http-error.ts
628390
- import { strict as assert } from "assert";
628391
- var deepClone = (o = {}) => JSON.parse(JSON.stringify(o));
628392
- var containsStackTrace = (text = "") => /at.+\.js:\d+:\d+/.test(text);
628393
- var objectContainsStackTrace = (obj) => !obj ? false : containsStackTrace(JSON.stringify(obj));
628394
- var supportedStatusCodes = {
628395
- 400: "Bad Request",
628396
- 401: "Unauthorized",
628397
- 403: "Forbidden",
628398
- 404: "Not Found",
628399
- 405: "Method Not Allowed",
628400
- 409: "Conflict",
628401
- 412: "Precondition Failed",
628402
- 413: "Payload Too Large",
628403
- 415: "Unsupported Media Type",
628404
- 428: "Precondition Required",
628405
- 429: "Too Many Requests",
628406
- 500: "Internal Server Error",
628407
- 501: "Not Implemented",
628408
- 502: "Bad Gateway",
628409
- 503: "Service Unavailable",
628410
- 504: "Gateway Timeout"
628411
- };
628412
- var supportedStatusCodesMessage = `statusCode must be one of the following: ${JSON.stringify(Object.keys(supportedStatusCodes))}`;
628413
- var onlyStatusCodeMessage = "Server errors may not specify any parameter except statusCode";
628414
- var isNullOrUndefined = (value) => value === null || value === void 0;
628415
- var _HttpError = class extends Error {
628416
- body;
628417
- headers;
628418
- statusCode;
628419
- isServerError;
628420
- constructor(statusCode, message, body, headers) {
628421
- assert(statusCode in supportedStatusCodes, supportedStatusCodesMessage);
628422
- const isServerError = statusCode > 499;
628423
- if (isServerError) {
628424
- assert(
628425
- isNullOrUndefined(message) && isNullOrUndefined(body),
628426
- onlyStatusCodeMessage
628427
- );
628428
- message = supportedStatusCodes[statusCode];
628429
- } else {
628430
- assert(
628431
- body === void 0 || typeof body === "object",
628432
- "body must be an object or omitted"
628433
- );
628434
- assert(
628435
- headers === void 0 || typeof headers === "object",
628436
- "headers must be an object or omitted"
628437
- );
628438
- message = message ?? supportedStatusCodes[statusCode];
628439
- assert(
628440
- !containsStackTrace(message) && !objectContainsStackTrace(body),
628441
- "the message or data parameters may not contain errors or stack traces"
628442
- );
628443
- }
628444
- super(message);
628445
- this.body = deepClone(body);
628446
- this.headers = deepClone(headers);
628447
- this.statusCode = statusCode;
628448
- this.isServerError = isServerError;
628449
- if (!this?.body?.message) {
628450
- this.body.message = this.message;
628451
- }
628452
- }
628453
- static get supportedStatusCodes() {
628454
- return supportedStatusCodes;
628455
- }
628456
- };
628457
- var HttpError = _HttpError;
628458
- __publicField(HttpError, "badRequest", (message, body, headers) => {
628459
- return new _HttpError(400, message, body, headers);
628460
- });
628461
- __publicField(HttpError, "unauthorized", (message, body, headers) => new _HttpError(401, message, body, headers));
628462
- __publicField(HttpError, "forbidden", (message, body, headers) => new _HttpError(403, message, body, headers));
628463
- __publicField(HttpError, "notFound", (message, body, headers) => new _HttpError(404, message, body, headers));
628464
- __publicField(HttpError, "internal", (message, body, headers) => new _HttpError(500, message, body, headers));
628465
- __publicField(HttpError, "notImplemented", () => new _HttpError(501));
628466
- __publicField(HttpError, "badGateway", () => new _HttpError(502));
628467
- __publicField(HttpError, "serviceUnavailable", (headers) => new _HttpError(503, void 0, void 0, headers));
628468
- __publicField(HttpError, "gatewayTimeout", () => new _HttpError(504));
628469
-
628470
- // src/helpers/input-validation-helper.ts
628608
+ import * as log8 from "lambda-log";
628471
628609
  var validateInput = (schema, input) => {
628472
- const { error: error4, value } = schema.validate(input);
628473
- if (error4) {
628474
- log7.info("", { error: error4 });
628610
+ const { error: error5, value } = schema.validate(input);
628611
+ if (error5) {
628612
+ log8.info("", { error: error5 });
628475
628613
  const httperr = HttpError.badRequest("Bad Request", {
628476
- errors: error4.details.map((detail) => ({
628614
+ errors: error5.details.map((detail) => ({
628477
628615
  message: detail?.message,
628478
628616
  key: detail?.context?.key,
628479
628617
  path: detail?.path
628480
628618
  }))
628481
628619
  });
628482
- log7.info("", { httperr });
628620
+ log8.info("", { httperr });
628483
628621
  throw httperr;
628484
628622
  }
628485
628623
  return value;
628486
628624
  };
628487
628625
 
628488
628626
  // src/helpers/logging-helper.ts
628489
- import * as log8 from "lambda-log";
628627
+ import * as log9 from "lambda-log";
628490
628628
  var stage = process?.env?.STAGE;
628491
628629
  var configureLogger = (event, context, debug4 = true) => {
628492
- log8.options.meta.stage = stage;
628493
- log8.options.meta.source_name = context?.functionName || "unknown";
628494
- log8.options.meta.awsRequestId = context?.awsRequestId || "unknown";
628495
- log8.options.meta.lambdaEvent = event;
628496
- log8.options.debug = debug4;
628630
+ log9.options.meta.stage = stage;
628631
+ log9.options.meta.source_name = context?.functionName || "unknown";
628632
+ log9.options.meta.awsRequestId = context?.awsRequestId || "unknown";
628633
+ log9.options.meta.lambdaEvent = event;
628634
+ log9.options.debug = debug4;
628497
628635
  };
628498
628636
 
628499
628637
  // src/helpers/response-helper.ts
@@ -628503,13 +628641,13 @@ var success = (body) => {
628503
628641
  var defaultError = {
628504
628642
  message: "internalServerError"
628505
628643
  };
628506
- var failure = (error4, statusCode = 500) => {
628507
- statusCode = error4?.statusCode ?? statusCode;
628644
+ var failure = (error5, statusCode = 500) => {
628645
+ statusCode = error5?.statusCode ?? statusCode;
628508
628646
  let body = defaultError;
628509
- if (error4?.body) {
628510
- body = error4.body;
628511
- } else if (error4?.message) {
628512
- body = { message: error4.message };
628647
+ if (error5?.body) {
628648
+ body = error5.body;
628649
+ } else if (error5?.message) {
628650
+ body = { message: error5.message };
628513
628651
  } else if (statusCode === 500) {
628514
628652
  body = defaultError;
628515
628653
  }
@@ -628531,108 +628669,6 @@ var buildResponse = (statusCode, body = {}) => {
628531
628669
  };
628532
628670
  };
628533
628671
 
628534
- // src/helpers/shopify-helper.ts
628535
- import { createHmac } from "crypto";
628536
- import * as log9 from "lambda-log";
628537
-
628538
- // src/libs/crypto.ts
628539
- import crypto from "crypto";
628540
- var generatePublicKey = () => {
628541
- const publicKey = crypto.randomBytes(26);
628542
- return publicKey.toString("utf8");
628543
- };
628544
-
628545
- // src/libs/http-status-codes.ts
628546
- var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
628547
- HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
628548
- HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
628549
- HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
628550
- HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
628551
- HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
628552
- HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
628553
- HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
628554
- HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
628555
- HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
628556
- HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
628557
- HttpStatusCodes2[HttpStatusCodes2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
628558
- HttpStatusCodes2[HttpStatusCodes2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
628559
- HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
628560
- HttpStatusCodes2[HttpStatusCodes2["MOVED_TEMPORARILY"] = 302] = "MOVED_TEMPORARILY";
628561
- HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
628562
- HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
628563
- HttpStatusCodes2[HttpStatusCodes2["USE_PROXY"] = 305] = "USE_PROXY";
628564
- HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
628565
- HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
628566
- HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
628567
- HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
628568
- HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
628569
- HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
628570
- HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
628571
- HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
628572
- HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
628573
- HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
628574
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
628575
- HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
628576
- HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
628577
- HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
628578
- HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
628579
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_TOO_LONG"] = 413] = "REQUEST_TOO_LONG";
628580
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
628581
- HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
628582
- HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
628583
- HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
628584
- HttpStatusCodes2[HttpStatusCodes2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
628585
- HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_SPACE_ON_RESOURCE"] = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE";
628586
- HttpStatusCodes2[HttpStatusCodes2["METHOD_FAILURE"] = 420] = "METHOD_FAILURE";
628587
- HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
628588
- HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
628589
- HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
628590
- HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
628591
- HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
628592
- HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
628593
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
628594
- HttpStatusCodes2[HttpStatusCodes2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
628595
- HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
628596
- HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
628597
- HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
628598
- HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
628599
- HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
628600
- HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
628601
- HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
628602
- HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
628603
- return HttpStatusCodes2;
628604
- })(HttpStatusCodes || {});
628605
-
628606
- // src/libs/url.ts
628607
- var mapObjectToQueryString = (inputObj) => {
628608
- const qsp = Object.entries(inputObj).sort((a, b) => a[0] < b[0] ? -1 : 1);
628609
- const urlParams = new URLSearchParams();
628610
- qsp.map((p) => {
628611
- urlParams.append(p[0], p[1]);
628612
- });
628613
- const qs = urlParams.toString();
628614
- return qs;
628615
- };
628616
-
628617
- // src/helpers/shopify-helper.ts
628618
- var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
628619
- delete validationParams.hmac;
628620
- const hmacString = mapObjectToQueryString(validationParams);
628621
- const generatedHash = createHmac("sha256", shopifyAppApiSecret).update(hmacString).digest("hex");
628622
- return generatedHash === validationHmac;
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
- };
628635
-
628636
628672
  // src/types/internal-events/event-detail-types.ts
628637
628673
  var ADTRACKIFY_EVENT_TYPES = /* @__PURE__ */ ((ADTRACKIFY_EVENT_TYPES2) => {
628638
628674
  ADTRACKIFY_EVENT_TYPES2["NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED"] = "shopifySubscriptionCreated";