@adtrackify/at-service-common 1.1.11 → 1.1.13

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 CHANGED
@@ -73,11 +73,12 @@ declare module '@adtrackify/at-service-common/clients/generic/index' {
73
73
  export * from '@adtrackify/at-service-common/clients/generic/dynamodb-client';
74
74
  export * from '@adtrackify/at-service-common/clients/generic/eventbridge-client';
75
75
  export * from '@adtrackify/at-service-common/clients/generic/http-client';
76
+ export * from '@adtrackify/at-service-common/clients/generic/s3-client';
76
77
 
77
78
  }
78
79
  declare module '@adtrackify/at-service-common/clients/generic/s3-client' {
79
80
  import { S3 } from '@aws-sdk/client-s3';
80
- export default class S3Client {
81
+ export class S3Client {
81
82
  s3: S3;
82
83
  constructor(accessKeyId: string, secretAccessKey: string);
83
84
  uploadJson(path: string, bucket: string, jsonData: any): Promise<unknown>;
package/dist/index.js CHANGED
@@ -200,10 +200,10 @@ var httpResponse = (res = {}) => {
200
200
  status: res?.status || 0
201
201
  };
202
202
  };
203
- var handleAxiosError = (error5) => {
204
- if (!error5?.response && !error5?.request)
205
- throw error5;
206
- return error5.response ? httpResponse(error5.response) : httpResponse({ status: 500, data: { error: error5.request } });
203
+ var handleAxiosError = (error6) => {
204
+ if (!error6?.response && !error6?.request)
205
+ throw error6;
206
+ return error6.response ? httpResponse(error6.response) : httpResponse({ status: 500, data: { error: error6.request } });
207
207
  };
208
208
  var axiosHttpService = (config = {}) => {
209
209
  config.adapter = httpAdapter;
@@ -221,8 +221,37 @@ var axiosHttpService = (config = {}) => {
221
221
  };
222
222
  };
223
223
 
224
- // src/clients/internal-api/destinations-client.ts
224
+ // src/clients/generic/s3-client.ts
225
+ import { S3 } from "@aws-sdk/client-s3";
225
226
  import * as log3 from "lambda-log";
227
+ var S3Client = class {
228
+ s3;
229
+ constructor(accessKeyId, secretAccessKey) {
230
+ this.s3 = new S3({
231
+ credentials: {
232
+ accessKeyId,
233
+ secretAccessKey
234
+ }
235
+ });
236
+ }
237
+ async uploadJson(path, bucket, jsonData) {
238
+ try {
239
+ const res = await this.s3.putObject({
240
+ Bucket: bucket,
241
+ ContentType: "application/json; charset=utf-8",
242
+ Body: JSON.stringify(jsonData),
243
+ Key: path
244
+ });
245
+ return res;
246
+ } catch (error6) {
247
+ log3.error("Error in s3 upload json", { error: error6 });
248
+ return error6;
249
+ }
250
+ }
251
+ };
252
+
253
+ // src/clients/internal-api/destinations-client.ts
254
+ import * as log4 from "lambda-log";
226
255
  var DestinationsClient = class {
227
256
  BASE_API_URL;
228
257
  DESTINATIONS_API_KEY;
@@ -247,19 +276,19 @@ var DestinationsClient = class {
247
276
  createDestination = async (createDestinationRequest) => {
248
277
  const client2 = await this.getClient();
249
278
  const response = await client2.post("/", createDestinationRequest);
250
- log3.info("createDestinationResponse", { response });
279
+ log4.info("createDestinationResponse", { response });
251
280
  return response;
252
281
  };
253
282
  getPixelDestinations = async (pixelId) => {
254
283
  const client2 = await this.getClient();
255
284
  const response = await client2.get(`/?pixelId=${pixelId}`);
256
- log3.info("getPixelResponse", { response });
285
+ log4.info("getPixelResponse", { response });
257
286
  return response;
258
287
  };
259
288
  };
260
289
 
261
290
  // src/clients/internal-api/accounts-client.ts
262
- import * as log4 from "lambda-log";
291
+ import * as log5 from "lambda-log";
263
292
  var AccountsClient = class {
264
293
  BASE_API_URL;
265
294
  ACCOUNTS_API_KEY;
@@ -287,19 +316,19 @@ var AccountsClient = class {
287
316
  createAccount = async (createAccountRequest) => {
288
317
  const client2 = await this.getClient();
289
318
  const createAccountResponse = await client2.post("", createAccountRequest);
290
- log4.info("createAccountResponse", { createAccountResponse });
319
+ log5.info("createAccountResponse", { createAccountResponse });
291
320
  return createAccountResponse;
292
321
  };
293
322
  updateAccount = async (accountId, body) => {
294
323
  const client2 = await this.getClient();
295
324
  const response = await client2.patch(`/${accountId}/`, body);
296
- log4.info("update Account response", { response });
325
+ log5.info("update Account response", { response });
297
326
  return response;
298
327
  };
299
328
  addOwner = async (accountId, userId) => {
300
329
  const client2 = await this.getClient();
301
330
  const addOwnerResponse = await client2.post("/addOwner", { accountId, userId });
302
- log4.info("addOwnerResponse", { addOwnerResponse });
331
+ log5.info("addOwnerResponse", { addOwnerResponse });
303
332
  return addOwnerResponse;
304
333
  };
305
334
  isAuthorizedUser = async (userId, accountId, pixelId) => {
@@ -310,41 +339,41 @@ var AccountsClient = class {
310
339
  pixelId
311
340
  };
312
341
  const response = await client2.post("/checkUserAuthorization", body);
313
- log4.info("checkUserAuthorization", { response });
342
+ log5.info("checkUserAuthorization", { response });
314
343
  return response;
315
344
  };
316
345
  adminDeleteAccount = async (accountId) => {
317
346
  const client2 = await this.getClient();
318
347
  const success2 = await client2.delete(`/${accountId}`);
319
- log4.info("adminDeleteAccount");
348
+ log5.info("adminDeleteAccount");
320
349
  return success2;
321
350
  };
322
351
  getPixelConfigById = async (pixelId) => {
323
352
  const client2 = await this.getClient();
324
353
  const pixelResponse = await client2.get(`/px/${pixelId}/config`);
325
- log4.debug("get pixelResponse", { pixelResponse });
354
+ log5.debug("get pixelResponse", { pixelResponse });
326
355
  return pixelResponse;
327
356
  };
328
357
  getAccount = async (accountId) => {
329
358
  const client2 = await this.getClient();
330
359
  const response = await client2.get(`/${accountId}/`);
331
- log4.info("get account response", { response });
360
+ log5.info("get account response", { response });
332
361
  return response;
333
362
  };
334
363
  addUserToAccount = async (accountId, userId) => {
335
364
  const client2 = await this.getClient();
336
365
  const response = await client2.post("/addUser", { accountId, userId });
337
- log4.info("add user account response", { response });
366
+ log5.info("add user account response", { response });
338
367
  return response;
339
368
  };
340
369
  };
341
370
 
342
371
  // src/clients/internal-api/users-auth-client.ts
343
- import * as log6 from "lambda-log";
372
+ import * as log7 from "lambda-log";
344
373
 
345
374
  // src/helpers/shopify-helper.ts
346
375
  import { createHmac } from "crypto";
347
- import * as log5 from "lambda-log";
376
+ import * as log6 from "lambda-log";
348
377
 
349
378
  // src/libs/url.ts
350
379
  var mapObjectToQueryString = (inputObj) => {
@@ -365,14 +394,14 @@ var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecr
365
394
  return generatedHash === validationHmac;
366
395
  };
367
396
  var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
368
- log5.info("Validating shopify request is authentic", { validationParams });
397
+ log6.info("Validating shopify request is authentic", { validationParams });
369
398
  const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
370
399
  if (!isValid) {
371
400
  const message = "Failed: Shopify Request hmac validation";
372
- log5.error(message);
401
+ log6.error(message);
373
402
  throw HttpError.badRequest(message);
374
403
  }
375
- log5.info("Sucess: Shopify Request hmac validation");
404
+ log6.info("Sucess: Shopify Request hmac validation");
376
405
  return true;
377
406
  };
378
407
 
@@ -542,19 +571,19 @@ var UsersAuthClient = class {
542
571
  return user;
543
572
  };
544
573
  signupUser = async (userSignupRequest) => {
545
- log6.info("Attempting to signup user", { email: userSignupRequest.email });
574
+ log7.info("Attempting to signup user", { email: userSignupRequest.email });
546
575
  const client2 = await this.getClient();
547
576
  const response = await client2.post("/signup", userSignupRequest);
548
577
  if (response.status !== 200 || !response?.data?.user) {
549
578
  const message = "User Signup Failed";
550
- log6.error(message, { response });
579
+ log7.error(message, { response });
551
580
  throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
552
581
  }
553
- log6.info("User Signup Successful", { response });
582
+ log7.info("User Signup Successful", { response });
554
583
  return response.data.user;
555
584
  };
556
585
  adminConfirmUser = async (email) => {
557
- log6.info("Attempting to admin confirm user", { email });
586
+ log7.info("Attempting to admin confirm user", { email });
558
587
  const client2 = await this.getClient();
559
588
  const response = await client2.post(
560
589
  "/admin/confirm",
@@ -569,10 +598,10 @@ var UsersAuthClient = class {
569
598
  );
570
599
  if (response.status !== 200) {
571
600
  const message = "Admin User Confirmation Failed";
572
- log6.error(message, { response });
601
+ log7.error(message, { response });
573
602
  throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
574
603
  }
575
- log6.info("Admin User Confirmation Successful", { response });
604
+ log7.info("Admin User Confirmation Successful", { response });
576
605
  return response;
577
606
  };
578
607
  getUserByEmail = async (email) => {
@@ -585,13 +614,13 @@ var UsersAuthClient = class {
585
614
  email
586
615
  }
587
616
  });
588
- log6.info("getUserResponse", { getUserResponse });
617
+ log7.info("getUserResponse", { getUserResponse });
589
618
  return getUserResponse;
590
619
  };
591
620
  };
592
621
 
593
622
  // src/clients/internal-api/shopify-app-install-client.ts
594
- import log7 from "lambda-log";
623
+ import log8 from "lambda-log";
595
624
  var ShopifyAppInstallClient = class {
596
625
  BASE_API_URL;
597
626
  SHOPIFY_APP_INSTALL_API_KEY;
@@ -616,25 +645,25 @@ var ShopifyAppInstallClient = class {
616
645
  updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
617
646
  const client2 = await this.getClient();
618
647
  const response = await client2.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
619
- log7.info("updateShopifyAppInstall", { response });
648
+ log8.info("updateShopifyAppInstall", { response });
620
649
  return response;
621
650
  };
622
651
  getShopifyAppInstall = async (shopifyAppInstallId) => {
623
652
  const client2 = await this.getClient();
624
653
  const response = await client2.get(`/${shopifyAppInstallId}`);
625
- log7.info("getShopifyAppInstall", { response });
654
+ log8.info("getShopifyAppInstall", { response });
626
655
  return response;
627
656
  };
628
657
  getShopifyAppInstallByShop = async (shop) => {
629
658
  const client2 = await this.getClient();
630
659
  const response = await client2.get(`/?shop=${shop}`);
631
- log7.info("getShopifyAppInstallByShop", { response });
660
+ log8.info("getShopifyAppInstallByShop", { response });
632
661
  return response;
633
662
  };
634
663
  };
635
664
 
636
665
  // src/clients/third-party/shopify-client.ts
637
- import * as log8 from "lambda-log";
666
+ import * as log9 from "lambda-log";
638
667
  var _ShopifyClient = class {
639
668
  };
640
669
  var ShopifyClient = _ShopifyClient;
@@ -678,9 +707,9 @@ __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, e
678
707
  };
679
708
  const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
680
709
  if (res.status >= 400) {
681
- log8.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
710
+ log9.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
682
711
  }
683
- log8.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
712
+ log9.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
684
713
  return res;
685
714
  });
686
715
  __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
@@ -695,7 +724,7 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
695
724
  };
696
725
  const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload);
697
726
  if (res.status >= 400) {
698
- log8.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
727
+ log9.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
699
728
  }
700
729
  return res;
701
730
  });
@@ -703,7 +732,7 @@ __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessTok
703
732
  const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/shop.json`;
704
733
  const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
705
734
  if (res.status >= 400) {
706
- log8.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
735
+ log9.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
707
736
  }
708
737
  return res;
709
738
  });
@@ -718,7 +747,7 @@ __publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken,
718
747
  };
719
748
  const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
720
749
  if (res.status >= 400) {
721
- log8.error("Failed to create App Subscription", { shop, accessToken, url });
750
+ log9.error("Failed to create App Subscription", { shop, accessToken, url });
722
751
  }
723
752
  return res;
724
753
  });
@@ -727,7 +756,7 @@ __publicField(ShopifyClient, "cancelAppSubscription", async (shop, accessToken,
727
756
  const client2 = axiosHttpService();
728
757
  const res = await client2.delete(url, { headers: { "X-Shopify-Access-Token": accessToken } });
729
758
  if (res.status !== 200) {
730
- log8.error("Failed to cancel recurring App billing", { shop, accessToken, url });
759
+ log9.error("Failed to cancel recurring App billing", { shop, accessToken, url });
731
760
  }
732
761
  return res;
733
762
  });
@@ -735,57 +764,57 @@ __publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) =
735
764
  const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
736
765
  const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
737
766
  if (res.status >= 400) {
738
- log8.error("Failed to get App Subscriptions", { shop, accessToken, url });
767
+ log9.error("Failed to get App Subscriptions", { shop, accessToken, url });
739
768
  }
740
769
  return res;
741
770
  });
742
771
  __publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload) => {
743
772
  const client2 = axiosHttpService();
744
773
  const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken, "Content-Type": "application/json" } });
745
- log8.debug("Shopify Client Response", { res });
774
+ log9.debug("Shopify Client Response", { res });
746
775
  return res;
747
776
  });
748
777
  __publicField(ShopifyClient, "genericShopifyGet", async (url, accessToken) => {
749
778
  const client2 = axiosHttpService();
750
779
  const res = await client2.get(url, { headers: { "X-Shopify-Access-Token": accessToken } });
751
- log8.debug("Shopify Client Response", { res });
780
+ log9.debug("Shopify Client Response", { res });
752
781
  return res;
753
782
  });
754
783
  __publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, payload) => {
755
784
  const client2 = axiosHttpService();
756
785
  const res = await client2.put(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
757
- log8.debug("Shopify Client Response", { res });
786
+ log9.debug("Shopify Client Response", { res });
758
787
  return res;
759
788
  });
760
789
 
761
790
  // src/helpers/input-validation-helper.ts
762
- import * as log9 from "lambda-log";
791
+ import * as log10 from "lambda-log";
763
792
  var validateInput = (schema, input) => {
764
- const { error: error5, value } = schema.validate(input);
765
- if (error5) {
766
- log9.info("", { error: error5 });
793
+ const { error: error6, value } = schema.validate(input);
794
+ if (error6) {
795
+ log10.info("", { error: error6 });
767
796
  const httperr = HttpError.badRequest("Bad Request", {
768
- errors: error5.details.map((detail) => ({
797
+ errors: error6.details.map((detail) => ({
769
798
  message: detail?.message,
770
799
  key: detail?.context?.key,
771
800
  path: detail?.path
772
801
  }))
773
802
  });
774
- log9.info("", { httperr });
803
+ log10.info("", { httperr });
775
804
  throw httperr;
776
805
  }
777
806
  return value;
778
807
  };
779
808
 
780
809
  // src/helpers/logging-helper.ts
781
- import * as log10 from "lambda-log";
810
+ import * as log11 from "lambda-log";
782
811
  var stage = process?.env?.STAGE;
783
812
  var configureLogger = (event, context, debug4 = true) => {
784
- log10.options.meta.stage = stage;
785
- log10.options.meta.source_name = context?.functionName || "unknown";
786
- log10.options.meta.awsRequestId = context?.awsRequestId || "unknown";
787
- log10.options.meta.lambdaEvent = event;
788
- log10.options.debug = debug4;
813
+ log11.options.meta.stage = stage;
814
+ log11.options.meta.source_name = context?.functionName || "unknown";
815
+ log11.options.meta.awsRequestId = context?.awsRequestId || "unknown";
816
+ log11.options.meta.lambdaEvent = event;
817
+ log11.options.debug = debug4;
789
818
  };
790
819
 
791
820
  // src/helpers/response-helper.ts
@@ -795,13 +824,13 @@ var success = (body) => {
795
824
  var defaultError = {
796
825
  message: "internalServerError"
797
826
  };
798
- var failure = (error5, statusCode = 500) => {
799
- statusCode = error5?.statusCode ?? statusCode;
827
+ var failure = (error6, statusCode = 500) => {
828
+ statusCode = error6?.statusCode ?? statusCode;
800
829
  let body = defaultError;
801
- if (error5?.body) {
802
- body = error5.body;
803
- } else if (error5?.message) {
804
- body = { message: error5.message };
830
+ if (error6?.body) {
831
+ body = error6.body;
832
+ } else if (error6?.message) {
833
+ body = { message: error6.message };
805
834
  } else if (statusCode === 500) {
806
835
  body = defaultError;
807
836
  }
@@ -1086,6 +1115,7 @@ export {
1086
1115
  HttpError,
1087
1116
  HttpStatusCodes,
1088
1117
  PostmarkRequestType,
1118
+ S3Client,
1089
1119
  ShopifyAppInstallClient,
1090
1120
  ShopifyClient,
1091
1121
  StripeBillingMap,
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/clients/generic/dynamodb-client.ts", "../src/clients/generic/eventbridge-client.ts", "../src/libs/dates.ts", "../src/clients/generic/http-client.ts", "../src/clients/internal-api/destinations-client.ts", "../src/clients/internal-api/accounts-client.ts", "../src/clients/internal-api/users-auth-client.ts", "../src/helpers/shopify-helper.ts", "../src/libs/url.ts", "../src/libs/crypto.ts", "../src/libs/http-error.ts", "../src/libs/http-status-codes.ts", "../src/clients/internal-api/shopify-app-install-client.ts", "../src/clients/third-party/shopify-client.ts", "../src/helpers/input-validation-helper.ts", "../src/helpers/logging-helper.ts", "../src/helpers/response-helper.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/account.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/destinations.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/third-party-destination-configs.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/shopify-app-install.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/subscription.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/adtrackify-standard-events.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/tracking-events/tracking-event-type.ts", "../src/helpers/subscription-helper.ts", "../src/types/internal-events/event-detail-types.ts", "../src/services/eventbridge-integration-service.ts"],
4
- "sourcesContent": ["import { DynamoDBClient, QueryOutput } from '@aws-sdk/client-dynamodb';\nimport { DynamoDBDocument } from '@aws-sdk/lib-dynamodb'; \nimport * as log from 'lambda-log';\n\nconst marshallOptions = {\n convertEmptyValues: false,\n removeUndefinedValues: false,\n convertClassInstanceToMap: false\n};\n\nconst unmarshallOptions = {\n wrapNumbers: false,\n};\n\nconst translateConfig = { marshallOptions, unmarshallOptions };\nconst ddbClient = new DynamoDBClient({});\nconst client = DynamoDBDocument.from(ddbClient, translateConfig);\n\nexport class DynamoDbClient {\n static safeGet = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.get(params);\n return res?.Item ?? null;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo Client Get Failed' });\n return null;\n }\n };\n\n static safePut = async (tableName: string, data: any) => {\n try {\n const params = {\n TableName: tableName,\n Item: data\n };\n const res = await client.put(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed simplePut' });\n return null;\n }\n };\n\n static safeDelete = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.delete(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeDelete' });\n return null;\n }\n };\n\n static safeQueryByGSI = async (tableName: string, gsiName: string, keyName: string, keyValue: any) => {\n const query = {\n TableName: tableName,\n IndexName: gsiName,\n KeyConditionExpression: `${keyName} = :value`,\n ExpressionAttributeValues: {\n ':value': keyValue\n }\n };\n const results = await DynamoDbClient.queryAll(query);\n return results;\n };\n\n static safeBatchGet = async (tableName: string, keys: any) => {\n try {\n const params: any = {\n RequestItems: {}\n };\n params.RequestItems[ tableName ] = {\n Keys: keys\n };\n const res = await client.batchGet(params);\n log.info('batchget res', { batchGetRes: res });\n if (res?.Responses?.[ tableName ]) {\n return res?.Responses?.[ tableName ];\n }\n return [];\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeBatchGet' });\n return [];\n }\n };\n\n static queryAll = async (params: any) => {\n try {\n log.info('Invoke Query All', { params });\n let currentResult: QueryOutput, exclusiveStartKey;\n let accumulatedResults: any[] = [];\n do {\n params.ExclusiveStartKey = exclusiveStartKey;\n params.Limit = 200;\n currentResult = await client.query(params);\n if (currentResult.Items) {\n exclusiveStartKey = currentResult.LastEvaluatedKey;\n accumulatedResults = [ ...accumulatedResults, ...currentResult.Items ];\n }\n } while (currentResult.Items && currentResult.Items.length > 0 && currentResult.LastEvaluatedKey);\n return accumulatedResults;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed queryAll' });\n return null;\n }\n };\n\n static batchGet = (params: any) => client.batchGet(params);\n static get = (params: any) => client.get(params);\n static put = (params: any) => client.put(params);\n static query = (params: any) => client.query(params);\n static scan = (params: any) => client.scan(params);\n static update = (params: any) => client.update(params);\n static delete = (params: any) => client.delete(params);\n}", "import { EventBridgeClient as EventBridge, PutEventsCommand, PutEventsCommandInput } from '@aws-sdk/client-eventbridge';\nimport { v4 as uuidv4 } from 'uuid';\nimport { getCurrentTimestamp } from '../../libs/dates';\nimport * as log from 'lambda-log';\n\nexport class EventBridgeClient {\n public eventBridge: EventBridge;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridge = new EventBridge({});\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public buildAndSendEvent = async (eventSource: string, eventType: string, eventData: any) => {\n const event = this.buildEvent(eventType, eventData);\n return await this.putEvent(eventSource, eventType, event);\n };\n\n public buildEvent = (eventType: string, eventData: any, eventId: string = uuidv4(), eventTime: string = getCurrentTimestamp()) => {\n return {\n eventId,\n eventType,\n eventTime,\n eventData\n };\n };\n\n public putEvent = async (source: string, detailType: string, data: any, headers: any = null) => {\n const params: PutEventsCommandInput = {\n Entries: [ {\n Detail: JSON.stringify({ headers, data }),\n DetailType: detailType,\n EventBusName: this.EVENT_BUS_NAME,\n Source: source,\n Time: new Date(),\n } ],\n };\n const putEventscommand = new PutEventsCommand(params);\n const response = await this.eventBridge.send(putEventscommand);\n log.debug('EventBus Event Published',\n {\n eventBusName: this.EVENT_BUS_NAME,\n eventSource: source,\n eventType: detailType,\n event: data,\n response\n });\n return response;\n };\n\n}\n\n", "\nimport { DateTime } from 'luxon';\n\nexport const getCurrentTimestamp = (): string => {\n return DateTime.utc().toJSDate().toISOString();\n}\n\nexport const getDateFromTimestamp = (timestamp: string) => {\n return timestamp.split('T')[0];\n}\n\nexport const getCurrentDate = (): string => {\n return getDateFromTimestamp(getCurrentTimestamp());\n}", "import axios from 'axios';\nimport axiosRetry from 'axios-retry';\nimport https from 'https';\nimport httpAdapter from 'axios/lib/adapters/http';\n\nconst httpResponse = (res: any = {}) => {\n return {\n headers: res?.header || {},\n data: res?.data || {},\n status: res?.status || 0,\n };\n};\n\nconst handleAxiosError = (error: any) => {\n if (!error?.response && !error?.request) throw error;\n return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });\n};\n\nexport const axiosHttpService = (config: any = {}) => {\n config.adapter = httpAdapter;\n config.httpsAgent = new https.Agent({ keepAlive: true });\n const axiosService = axios.create(config);\n\n axiosRetry(axiosService, { retryDelay: axiosRetry.exponentialDelay, retries: 3 });\n\n return {\n instance: () => axiosService,\n get: (url: string, config?: any) => axiosService.get(url, config).then(httpResponse, handleAxiosError),\n post: (url: string, data?: any, config?: any) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),\n delete: (url: string, config?: any) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),\n put: (url: string, data?: any, config?: any) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),\n patch: (url: string, data?: any, config?: any) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),\n setBaseUrl: (url: string) => !!(axiosService.defaults.baseURL = url)\n };\n};\n", "import * as log from 'lambda-log';\n//const log = require('lambda-log');\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { Destination } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface GetDestinationsResponseData {\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface CreateDestinationResponseData {\n destination: Destination;\n [ key: string ]: any;\n}\n\n\nexport class DestinationsClient {\n\n public BASE_API_URL: string;\n public DESTINATIONS_API_KEY: string;\n\n constructor (baseApiUrl: string, destinationsApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.DESTINATIONS_API_KEY = destinationsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.DESTINATIONS_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/', createDestinationRequest);\n log.info('createDestinationResponse', { response });\n return response as ApiResponse<CreateDestinationResponseData>;\n };\n\n getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?pixelId=${pixelId}`);\n log.info('getPixelResponse', { response });\n return response as ApiResponse<GetDestinationsResponseData>;\n };\n}\n", "import * as log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';\nimport { axiosHttpService } from '../generic/http-client';\n\n//const BASE_API_URL = process.env.BASE_API_URL;\n\n//const SERVICE_API_ROOT_URL = `${BASE_API_URL}/accounts`;\n//const ACCOUNTS_API_KEY = process.env.ACCOUNTS_API_KEY;\n\nexport interface AccountResponseData {\n account: Account;\n [ key: string ]: any;\n}\n\nexport interface IsAuthorizedUserResponseData {\n isAccountUser: boolean;\n [ key: string ]: any;\n}\nexport interface PixelConfigResponseData {\n id: string;\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface AddUserToAccountResponseData {\n userId: string;\n accountId: string;\n}\n\nexport interface UpdateAccountRequest {\n accountName?: string,\n companyName?: string,\n primaryEmail?: string,\n ownerId?: string,\n subscriptionId?: string,\n accountStatus?: ACCOUNT_STATUS;\n}\n\nexport class AccountsClient {\n public BASE_API_URL: string;\n public ACCOUNTS_API_KEY?: string;\n\n constructor (baseApiUrl: string, accountsApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.ACCOUNTS_API_KEY = accountsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;\n const params: any = {\n baseURL: SERVICE_API_ROOT_URL\n };\n if (this.ACCOUNTS_API_KEY) {\n params.headers = {\n common: {\n 'x-api-key': this.ACCOUNTS_API_KEY\n }\n };\n }\n return params;\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createAccount = async (createAccountRequest: any) => {\n const client = await this.getClient();\n const createAccountResponse = await client.post('', createAccountRequest);\n log.info('createAccountResponse', { createAccountResponse });\n return createAccountResponse;\n };\n updateAccount = async (accountId: string, body: any): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.patch(`/${accountId}/`, body);\n log.info('update Account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addOwner = async (accountId: string, userId: string) => {\n const client = await this.getClient();\n const addOwnerResponse = await client.post('/addOwner', { accountId, userId });\n log.info('addOwnerResponse', { addOwnerResponse });\n return addOwnerResponse;\n };\n isAuthorizedUser = async (userId: string, accountId: string, pixelId?: string): Promise<ApiResponse<IsAuthorizedUserResponseData>> => {\n const client = await this.getClient();\n const body = {\n userId, accountId, pixelId\n };\n const response = await client.post('/checkUserAuthorization', body);\n log.info('checkUserAuthorization', { response });\n return response as ApiResponse<IsAuthorizedUserResponseData>;\n };\n adminDeleteAccount = async (accountId: string) => {\n const client = await this.getClient();\n const success = await client.delete(`/${accountId}`);\n log.info('adminDeleteAccount');\n return success;\n };\n getPixelConfigById = async (pixelId: string): Promise<ApiResponse<PixelConfigResponseData>> => {\n const client = await this.getClient();\n const pixelResponse = await client.get(`/px/${pixelId}/config`);\n log.debug('get pixelResponse', { pixelResponse });\n return pixelResponse;\n };\n getAccount = async (accountId: string): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${accountId}/`);\n log.info('get account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addUserToAccount = async (accountId: string, userId: string): Promise<ApiResponse<AddUserToAccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/addUser', { accountId, userId });\n log.info('add user account response', { response });\n return response as ApiResponse<AddUserToAccountResponseData>;\n };\n\n\n // setAccountSubscriptionId = async (accountId: string, subscriptionId: string): Promise<ApiResponse<any>> => {\n // const client = await this.getClient();\n // const pixelResponse = await client.get(`/px/${pixelId}/config`);\n // log.debug('pixelResponse', { pixelResponse });\n // return pixelResponse;\n // };\n}", "import { User } from '@adtrackify/at-tracking-event-types';\nimport * as log from 'lambda-log';\nimport { HttpError, HttpStatusCodes } from '../../libs';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\n\nexport interface UserResponseData {\n user: User;\n [ key: string ]: any;\n}\n\nexport interface UserSignupRequest {\n email: string,\n password: string,\n givenName: string,\n familyName: string;\n}\n\nexport class UsersAuthClient {\n\n public SERVICE_API_ROOT_URL: string;\n public BASE_API_URL: string;\n public USERS_AUTH_API_KEY: string;\n constructor (baseApiUrl: string, usersAuthApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.USERS_AUTH_API_KEY = usersAuthApiKey as string;\n this.SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/auth`;\n }\n\n getConfig = () => {\n return {\n baseURL: this.SERVICE_API_ROOT_URL,\n headers: {\n common: {\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n signupAndConfirmUser = async (userSignupRequest: any): Promise<any> => {\n const user = await this.signupUser(userSignupRequest);\n await this.adminConfirmUser(user.email);\n // if fail - delete user and throw error\n return user;\n };\n\n signupUser = async (userSignupRequest: UserSignupRequest): Promise<any> => {\n log.info('Attempting to signup user', { email: userSignupRequest.email });\n\n const client = await this.getClient();\n const response = await client.post('/signup', userSignupRequest);\n\n // Check if Successful or throw error\n if (response.status !== 200 || !response?.data?.user) {\n const message = 'User Signup Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('User Signup Successful', { response });\n return response.data.user;\n };\n\n //userName is same as user id\n adminConfirmUser = async (email: string) => {\n //confirm user\n //@TODO update user auth service with admin confirm user endpoint\n log.info('Attempting to admin confirm user', { email });\n\n const client = await this.getClient();\n const response = await client.post('/admin/confirm',\n {\n email\n }, {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n }\n }\n );\n\n // Check if Successful or throw error\n if (response.status !== 200) {\n const message = 'Admin User Confirmation Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('Admin User Confirmation Successful', { response });\n return response;\n };\n\n getUserByEmail = async (email: string): Promise<ApiResponse<UserResponseData>> => {\n const client = await this.getClient();\n const getUserResponse = await client.get('/lookup', {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n },\n params: {\n email\n }\n });\n log.info('getUserResponse', { getUserResponse });\n return getUserResponse;\n };\n\n}\n\n", "import { createHmac } from 'crypto';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs';\nimport { mapObjectToQueryString } from '../libs/url';\nexport interface ShopifyRequestValidationParameters {\n code: string,\n hmac?: string,\n shop: string,\n state: string,\n timestamp: string;\n}\n\nexport const isShopifyRequestValid = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string): boolean => {\n // remove hmac if it exists\n // map input to query string\n // generate hash using api secret key and validate it matches hmac\n delete validationParams.hmac;\n const hmacString = mapObjectToQueryString(validationParams);\n\n\n const generatedHash = createHmac('sha256', shopifyAppApiSecret)\n .update(hmacString)\n .digest('hex');\n\n return generatedHash === validationHmac;\n};\n\nexport const validateShopifyRequest = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => {\n log.info('Validating shopify request is authentic', { validationParams });\n const isValid = isShopifyRequestValid(validationParams, validationHmac as string, shopifyAppApiSecret);\n if (!isValid) {\n const message = 'Failed: Shopify Request hmac validation';\n log.error(message);\n throw HttpError.badRequest(message);\n }\n log.info('Sucess: Shopify Request hmac validation');\n return true;\n}\n\n", "// Record<string, string> is any object\nexport const mapObjectToQueryString = (inputObj: any): string => {\n const qsp = Object.entries(inputObj).sort((a, b) => a[ 0 ] < b[ 0 ] ? -1 : 1);\n const urlParams = new URLSearchParams();\n qsp.map(p => {\n urlParams.append(p[ 0 ], p[ 1 ] as string);\n });\n const qs = urlParams.toString();\n return qs;\n};", "import crypto from 'crypto';\n\nexport const generatePublicKey = (): string => {\n const publicKey = crypto.randomBytes(26);\n return publicKey.toString('utf8');\n};", "/* eslint-disable no-dupe-class-members */\nimport { strict as assert } from 'assert';\n\nconst deepClone = (o = {}) => JSON.parse(JSON.stringify(o));\nconst containsStackTrace = (text = '') => /at.+\\.js:\\d+:\\d+/.test(text);\nconst objectContainsStackTrace = (obj: any) =>\n !obj ? false : containsStackTrace(JSON.stringify(obj));\n\n// may only be expanded by governance, never reduced\nconst supportedStatusCodes: any = {\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 403: 'Forbidden',\n 404: 'Not Found',\n 405: 'Method Not Allowed',\n 409: 'Conflict',\n 412: 'Precondition Failed',\n 413: 'Payload Too Large',\n 415: 'Unsupported Media Type',\n 428: 'Precondition Required',\n 429: 'Too Many Requests',\n 500: 'Internal Server Error',\n 501: 'Not Implemented',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n 504: 'Gateway Timeout'\n};\n\nconst supportedStatusCodesMessage = `statusCode must be one of the following: ${JSON.stringify(Object.keys(supportedStatusCodes))}`;\n//const onlyStatusCodeMessage = 'Server errors may not specify any parameter except statusCode';\n\n//const isNullOrUndefined = (value: any) => value === null || value === undefined;\n\nexport class HttpError extends Error {\n body: {\n [ key: string ]: any;\n };\n headers: object[];\n statusCode: number;\n isServerError: boolean;\n\n constructor (statusCode: number,\n message?: string,\n body?: {\n [ key: string ]: any;\n },\n headers?: object[]) {\n assert(statusCode in supportedStatusCodes, supportedStatusCodesMessage);\n\n const isServerError = statusCode > 499;\n\n assert(\n body === undefined || typeof body === 'object',\n 'body must be an object or omitted'\n );\n assert(\n headers === undefined || typeof headers === 'object',\n 'headers must be an object or omitted'\n );\n\n message = message ?? supportedStatusCodes[ statusCode ];\n\n assert(\n !containsStackTrace(message) && !objectContainsStackTrace(body),\n 'the message or data parameters may not contain errors or stack traces'\n );\n\n super(message);\n\n this.body = deepClone(body);\n this.headers = deepClone(headers);\n this.statusCode = statusCode;\n this.isServerError = isServerError;\n if (!this?.body?.message) {\n this.body.message = this.message;\n }\n }\n\n\n static get supportedStatusCodes() { return supportedStatusCodes; }\n static badRequest = (message?: string, body?: object, headers?: object[]) => { return new HttpError(400, message, body, headers); };\n static unauthorized = (message?: string, body?: object, headers?: object[]) => new HttpError(401, message, body, headers);\n static forbidden = (message?: string, body?: object, headers?: object[]) => new HttpError(403, message, body, headers);\n static notFound = (message?: string, body?: object, headers?: object[]) => new HttpError(404, message, body, headers);\n static internal = (message?: string, body?: object, headers?: object[]) => new HttpError(500, message, body, headers);\n static notImplemented = () => new HttpError(501);\n static badGateway = () => new HttpError(502);\n static serviceUnavailable = (headers: object[]) => new HttpError(503, undefined, undefined, headers);\n static gatewayTimeout = () => new HttpError(504);\n}\n", "export enum HttpStatusCodes {\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1\n *\n * This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished.\n */\n CONTINUE = 100,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2\n *\n * This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too.\n */\n SWITCHING_PROTOCOLS = 101,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1\n *\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n */\n PROCESSING = 102,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1\n *\n * The request has succeeded. The meaning of a success varies depending on the HTTP method:\n * GET: The resource has been fetched and is transmitted in the message body.\n * HEAD: The entity headers are in the message body.\n * POST: The resource describing the result of the action is transmitted in the message body.\n * TRACE: The message body contains the request message as received by the server\n */\n OK = 200,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2\n *\n * The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request.\n */\n CREATED = 201,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3\n *\n * The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing.\n */\n ACCEPTED = 202,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4\n *\n * This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5\n *\n * There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.\n */\n NO_CONTENT = 204,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6\n *\n * This response code is sent after accomplishing request to tell user agent reset document view which sent this request.\n */\n RESET_CONTENT = 205,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1\n *\n * This response code is used because of range header sent by the client to separate download into multiple streams.\n */\n PARTIAL_CONTENT = 206,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2\n *\n * A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate.\n */\n MULTI_STATUS = 207,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1\n *\n * The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses.\n */\n MULTIPLE_CHOICES = 300,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2\n *\n * This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response.\n */\n MOVED_PERMANENTLY = 301,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3\n *\n * This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.\n */\n MOVED_TEMPORARILY = 302,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4\n *\n * Server sent this response to directing client to get requested resource to another URI with an GET request.\n */\n SEE_OTHER = 303,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1\n *\n * This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response.\n */\n NOT_MODIFIED = 304,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6\n *\n * Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.\n */\n USE_PROXY = 305,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7\n *\n * Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n TEMPORARY_REDIRECT = 307,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3\n *\n * This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n PERMANENT_REDIRECT = 308,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1\n *\n * This response means that server could not understand the request due to invalid syntax.\n */\n BAD_REQUEST = 400,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1\n *\n * Although the HTTP standard specifies \"unauthorized\", semantically this response means \"unauthenticated\". That is, the client must authenticate itself to get the requested response.\n */\n UNAUTHORIZED = 401,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2\n *\n * This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently.\n */\n PAYMENT_REQUIRED = 402,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3\n *\n * The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server.\n */\n FORBIDDEN = 403,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4\n *\n * The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web.\n */\n NOT_FOUND = 404,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5\n *\n * The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code.\n */\n METHOD_NOT_ALLOWED = 405,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6\n *\n * This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent.\n */\n NOT_ACCEPTABLE = 406,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2\n *\n * This is similar to 401 but authentication is needed to be done by a proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7\n *\n * This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.\n */\n REQUEST_TIMEOUT = 408,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8\n *\n * This response is sent when a request conflicts with the current state of the server.\n */\n CONFLICT = 409,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9\n *\n * This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for \"limited-time, promotional services\". APIs should not feel compelled to indicate resources that have been deleted with this status code.\n */\n GONE = 410,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10\n *\n * The server rejected the request because the Content-Length header field is not defined and the server requires it.\n */\n LENGTH_REQUIRED = 411,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2\n *\n * The client has indicated preconditions in its headers which the server does not meet.\n */\n PRECONDITION_FAILED = 412,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11\n *\n * Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field.\n */\n REQUEST_TOO_LONG = 413,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12\n *\n * The URI requested by the client is longer than the server is willing to interpret.\n */\n REQUEST_URI_TOO_LONG = 414,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13\n *\n * The media format of the requested data is not supported by the server, so the server is rejecting the request.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4\n *\n * The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data.\n */\n REQUESTED_RANGE_NOT_SATISFIABLE = 416,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14\n *\n * This response code means the expectation indicated by the Expect request header field can't be met by the server.\n */\n EXPECTATION_FAILED = 417,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2\n *\n * Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\". The resulting entity body MAY be short and stout.\n */\n IM_A_TEAPOT = 418,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action.\n */\n INSUFFICIENT_SPACE_ON_RESOURCE = 419,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt\n *\n * A deprecated response used by the Spring Framework when a method has failed.\n */\n METHOD_FAILURE = 420,\n /**\n * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2\n *\n * Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI.\n */\n MISDIRECTED_REQUEST = 421,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3\n *\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4\n *\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5\n *\n * The request failed due to failure of a previous request.\n */\n FAILED_DEPENDENCY = 424,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3\n *\n * The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.\n */\n PRECONDITION_REQUIRED = 428,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4\n *\n * The user has sent too many requests in a given amount of time (\"rate limiting\").\n */\n TOO_MANY_REQUESTS = 429,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5\n *\n * The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7725\n *\n * The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1\n *\n * The server encountered an unexpected condition that prevented it from fulfilling the request.\n */\n INTERNAL_SERVER_ERROR = 500,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2\n *\n * The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.\n */\n NOT_IMPLEMENTED = 501,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3\n *\n * This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.\n */\n BAD_GATEWAY = 502,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4\n *\n * The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.\n */\n SERVICE_UNAVAILABLE = 503,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5\n *\n * This error response is given when the server is acting as a gateway and cannot get a response in time.\n */\n GATEWAY_TIMEOUT = 504,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6\n *\n * The HTTP version used in the request is not supported by the server.\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.\n */\n INSUFFICIENT_STORAGE = 507,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6\n *\n * The 511 status code indicates that the client needs to authenticate to gain network access.\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511\n}", "import log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface ShopifyAppInstallResponseData {\n shopifyAppInstall: ShopifyAppInstall;\n [ key: string ]: any;\n}\n\nexport interface UpdateShopifyAppInstallRequest {\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus,\n pixelId?: string,\n shopifyAppInstallId: string;\n isAppEnabled?: boolean;\n}\n\nexport class ShopifyAppInstallClient {\n\n public BASE_API_URL: string;\n public SHOPIFY_APP_INSTALL_API_KEY: string;\n\n constructor (baseApiUrl: string, shopifyAppInstallApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n updateShopifyAppInstall = async (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);\n log.info('updateShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstall = async (shopifyAppInstallId: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${shopifyAppInstallId}`);\n log.info('getShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstallByShop = async (shop: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?shop=${shop}`);\n log.info('getShopifyAppInstallByShop', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>; \n }\n}\n", "import { axiosHttpService } from '../generic/http-client';\nimport * as log from 'lambda-log';\n\nexport class ShopifyClient {\n static _shopify_api_version = process.env.SHOPIFY_API_VERSION as string;\n static getConfig = (shopifyDomain: string, accessToken: string) => {\n const config = {\n baseURL: `https://${shopifyDomain}/admin/api/${this._shopify_api_version}`,\n headers: {\n common: {\n 'X-Shopify-Access-Token': accessToken,\n },\n },\n };\n return config;\n };\n\n static getClient = (shopifyDomain: string, accessToken: string) => {\n return axiosHttpService(\n this.getConfig(shopifyDomain, accessToken)\n );\n };\n\n static registerApp = async (shop: string, code: string, appKey: string, appSecret: string) => {\n const client = axiosHttpService();\n const url = 'https://' + shop + '/admin/oauth/access_token';\n const payload = {\n client_id: appKey,\n client_secret: appSecret,\n code\n };\n const res = await client.post(url, payload);\n return res;\n };\n\n static registerWebhookTopic = async (shop: string, accessToken: string, eventBridgeArn: string, topic: string) => {\n const client = axiosHttpService();\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks.json`;\n const payload = {\n webhook: {\n topic,\n address: eventBridgeArn,\n format: 'json'\n }\n };\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n if (res.status >= 400) {\n log.error('Failed to register Webhook Topic', { shop, accessToken, eventBridgeArn, topic, url, payload });\n }\n log.debug('Shopify Client Webhook Registration Response', { registrationResponse: res });\n return res;\n };\n\n static updateShopifyAppMetafield = async (shop: string, accessToken: string, pixelId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/metafields.json`;\n const payload = {\n metafield: {\n namespace: 'adtr',\n key: 'adtr.config',\n value: pixelId,\n type: 'single_line_text_field'\n }\n };\n const res = await this.genericShopifyPost(url, accessToken, payload);\n\n if (res.status >= 400) {\n log.error('Failed to update Shopify app Metafield ', { shop, accessToken, url, payload });\n }\n return res;\n };\n\n static getShopifyStoreProperties = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/shop.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n\n if (res.status >= 400) {\n log.error('Failed to get Shopify Store Properties', { shop, accessToken, url });\n }\n return res;\n };\n\n static createAppSubscription = async (shop: string, accessToken: string,\n planName: string, price: number, returnUrl: string, trialDays: number, test?: boolean) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const recurring_application_charge = {\n name: planName,\n price,\n return_url: returnUrl,\n trial_days: trialDays,\n test\n };\n const res = await this.genericShopifyPost(url, accessToken, { recurring_application_charge });\n if (res.status >= 400) {\n log.error('Failed to create App Subscription', { shop, accessToken, url });\n }\n return res;\n };\n\n static cancelAppSubscription = async (shop: string, accessToken: string, chargeId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges/${chargeId}.json`;\n const client = axiosHttpService();\n const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n\n if (res.status !== 200) {\n log.error('Failed to cancel recurring App billing', { shop, accessToken, url });\n }\n return res;\n };\n\n static listAppSubscriptions = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n if (res.status >= 400) {\n log.error('Failed to get App Subscriptions', { shop, accessToken, url });\n }\n return res;\n };\n\n static genericShopifyPost = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken, 'Content-Type': 'application/json' } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyGet = async (url: string, accessToken: string) => {\n const client = axiosHttpService();\n const res = await client.get(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyPut = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.put(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n}\n", "import Joi from 'joi';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs/http-error';\n\nexport const validateInput = (schema: Joi.ObjectSchema<any>, input: any) => {\n const { error, value } = schema.validate(input);\n if (error) {\n log.info('', { error });\n\n const httperr = HttpError.badRequest('Bad Request', {\n errors: error.details.map(detail => ({\n message: detail?.message,\n key: detail?.context?.key,\n path: detail?.path,\n }))\n });\n\n log.info('', { httperr });\n throw httperr;\n }\n return value;\n};", "import * as log from 'lambda-log';\nconst stage = process?.env?.STAGE;\n\nexport const configureLogger = (event: any, context: any, debug = true) => {\n log.options.meta.stage = stage;\n log.options.meta.source_name = context?.functionName || 'unknown';\n log.options.meta.awsRequestId = context?.awsRequestId || 'unknown';\n log.options.meta.lambdaEvent = event;\n log.options.debug = debug;\n}", "\nexport const success = (body: any) => {\n return buildResponse(200, body);\n}\n\nconst defaultError = {\n message: 'internalServerError'\n}\n\nexport const failure = (error: any, statusCode = 500) => {\n statusCode = error?.statusCode ?? statusCode;\n\n let body = defaultError;\n if (error?.body) {\n body = error.body;\n }\n else if (error?.message) {\n body = { message: error.message };\n } else if (statusCode === 500) {\n body = defaultError;\n }\n return buildResponse(statusCode, body);\n}\n\nexport const buildResponse = (statusCode: number, body: any = {}) => {\n delete body.stack;\n return {\n statusCode: statusCode,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Credentials': true,\n 'cache-control': 'max-age=86400',\n Date: new Date(),\n 'Last-Modified': new Date(),\n 'Access-Control-Allow-Headers':\n 'Content-Type, Content-Encoding'\n },\n body: JSON.stringify(body),\n };\n}\n", "import { Subscription } from './subscription';\n\nexport interface Account {\n id: string,\n accountName: string,\n companyName?: string,\n accountStatus: ACCOUNT_STATUS,\n primaryEmail: string,\n publicApiKey?: string,\n subscriptionId?: string,\n pixels?: Pixel[],\n subscription?: Subscription;\n ownerId?: string,\n createdAt: string,\n updatedAt: string;\n}\n\n\nexport interface Pixel {\n id: string;\n accountId: string;\n name: string;\n createdAt: string,\n updatedAt: string;\n}\n\nexport enum ACCOUNT_STATUS {\n PENDING = 'pending',\n ACTIVE = 'active',\n INACTIVE = 'inactive'\n}", "\r\nexport interface Destination {\r\n id: string,\r\n accountId: string,\r\n pixelId: string,\r\n destination: string;\r\n displayName?: string,\r\n enabled: boolean;\r\n configuration?: UserDestinationConfiguration,\r\n createdAt: string,\r\n updatedAt: string;\r\n}\r\n\r\nexport enum DESTINATIONS {\r\n FACEBOOK = 'facebook',\r\n TIKTOK = 'tiktok',\r\n GOOGLE_ADS = 'googleAds',\r\n GOOGLE_ANALYTICS_4 = 'googleAnalytics4',\r\n HUBSPOT = 'hubspot',\r\n WEBHOOK = 'webhook',\r\n CUSTOM_HTML = 'customHTML',\r\n CUSTOM_JS = 'customJS',\r\n SNAPCHAT = 'snapchat',\r\n TWITTER = 'twitter',\r\n REDDIT = 'reddit'\r\n}\r\n\r\nexport interface UserDestinationConfiguration {\r\n [ key: string ]: any;\r\n eventBlacklist?: string[];\r\n events?: EventConfiguration[];\r\n trigger?: DestinationTriggerConfiguration;\r\n}\r\n\r\nexport interface DestinationTriggerConfiguration {\r\n shopify?: ShopifyTriggerConfiguration;\r\n exludeDomains?: string[];\r\n excludePages?: string[];\r\n domains?: string[];\r\n pages?: string[];\r\n}\r\n\r\nexport interface ShopifyTriggerConfiguration {\r\n enabled: boolean;\r\n collections?: string[];\r\n tags?: string[];\r\n}\r\n\r\n\r\nexport interface EventConfiguration {\r\n sourceEventName: string;\r\n exclude?: boolean;\r\n sample: EventSampleConfiguration;\r\n transformations?: EventTransformation[];\r\n}\r\n\r\nexport interface EventTransformation {\r\n transformationEventName: string;\r\n enabled: boolean;\r\n}\r\n\r\nexport interface EventSampleConfiguration {\r\n enabled: boolean;\r\n rate: number;\r\n}\r\n\r\n", "import { Destination, UserDestinationConfiguration } from './destinations';\r\n\r\nexport interface AdTrackifyFacebookDestination extends Destination {\r\n configuration: FacebookPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyTikTokDestination extends Destination {\r\n configuration: TiktokPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyGoogleAnalytics4Destination extends Destination {\r\n configuration: GoogleAnalytics4Configuration;\r\n}\r\n\r\n// Destination Specific configurations below\r\nexport interface FacebookPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface TiktokPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface GoogleAnalytics4Configuration extends UserDestinationConfiguration {\r\n apiSecret: string;\r\n measurementId: string;\r\n}\r\n\r\nexport interface GoogleAdsConfiguration extends UserDestinationConfiguration {\r\n pixelId: string;\r\n conversionID: string;\r\n}\r\n\r\nexport interface HubspotPixelConfiguration extends UserDestinationConfiguration {\r\n hubspotId: string;\r\n}\r\n\r\nexport interface SnapchatPixelConfiguration extends UserDestinationConfiguration {\r\n snapchatPixelId: string;\r\n}\r\n\r\nexport interface TwitterPixelConfiguration extends UserDestinationConfiguration {\r\n twitterPixelId: string;\r\n}\r\n\r\nexport interface WebhookConfiguration extends UserDestinationConfiguration {\r\n webhookUrl: string;\r\n}\r\n\r\nexport interface CustomHTMLConfiguration extends UserDestinationConfiguration {\r\n html: string;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport interface CustomJSConfiguration extends UserDestinationConfiguration {\r\n script: string;\r\n async: boolean;\r\n defer: boolean;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport enum CustomHTMLLocation {\r\n HEADER = 'header',\r\n FOOTER = 'footer',\r\n BODY = 'body'\r\n}\r\n\r\n", "export interface ShopifyAppInstall {\n shopifyAppInstallId: string;\n shop: string;\n accessToken?: string;\n appStatus?: string;\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus;\n code?: string;\n hmac?: string;\n host?: string;\n installRequest?: ShopifyInstallRequest;\n isAppEnabled?: boolean;\n pixelId?: string;\n shopInfo?: any;\n state?: string;\n timestamp?: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport enum ShopifyAppInstallStatus {\n STARTED = 'started',\n COMPLETED = 'completed',\n UNINSTALLED = 'uninstalled',\n FAILED = 'failed',\n NONE = 'none'\n}\nexport enum ShopifyAppSubscriptionStatus {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\n\nexport interface ShopifyInstallRequest {\n shop?: string;\n session?: string;\n hmac?: string;\n host?: string;\n nonce?: string;\n timestamp?: string;\n status?: string;\n}\n\nexport interface ShopifyStoreInfo {\n // TBD based on shopify api\n [ key: string ]: any;\n}", "\nexport interface Subscription {\n id: string,\n accountId?: string,\n shopifyAppInstallId?: string,\n shopifyDomain?: string,\n stripeCustomerId?: string,\n stripeSubscriptionId?: string,\n stripeCompletedCheckoutSession?: any;\n shopifyChargeId?: string;\n subscriptionPlan?: SubscriptionPlan,\n status?: SUBSCRIPTION_STATUS,\n paymentStatus?: PAYMENT_STATUS,\n paymentGateway?: PAYMENT_GATEWAY,\n createdAt: string,\n updatedAt: string,\n\n}\nexport interface SubscriptionPlan {\n id: number;\n planName: string;\n displayName: string;\n description: string;\n sku: string;\n price: string;\n displayPrice: string;\n billingFrequency: PLAN_BILLING_FREQUENCY;\n trialLengthDays?: number;\n trialRequiresCreditCard?: boolean;\n planDesc?: string[];\n unitPriceText?: string;\n isHighlighted?: boolean;\n isBanner?: boolean;\n bannerText?: string;\n bannerColor?: string;\n stripePriceId?: string;\n stripeProductId?: string;\n}\n\nexport enum PLAN_BILLING_FREQUENCY {\n MONTHLY = 'monthly',\n YEARLY = 'yearly'\n}\n\nexport enum PAYMENT_STATUS {\n CURRENT = 'current',\n PAST_DUE = 'past_due',\n CANCELLED = 'cancelled',\n FAILED = 'failed'\n}\n\nexport enum SUBSCRIPTION_STATUS {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\nexport enum PAYMENT_GATEWAY {\n STRIPE = 'stripe',\n PAYPAL = 'paypal',\n SHOPIFY = 'shopify'\n}\n", "export enum ADTRACKIFY_STANDARD_EVENT {\n ADD_PAYMENT_INFO = 'add_payment_info',\n ADD_SHIPPING_INFO = 'add_shipping_info',\n ADD_TO_CART = 'add_to_cart',\n ADD_TO_WISHLIST = 'add_to_wishlist',\n // COMPLETE_REGISTRATION: 'complete_registration',\n // CONTACT: 'contact',\n INITIATE_CHECKOUT = 'initiate_checkout',\n LEAD = 'lead',\n LOGIN = 'login',\n PAGE_VIEW = 'page_view',\n PURCHASE = 'purchase',\n REFUND = 'refund',\n SEARCH = 'search',\n // START_TRIAL: 'start_trial',\n // SUBMIT_APPLICATION: 'submit_application',\n // SUBSCRIBE: 'subscribe',\n SIGN_UP = 'sign_up',\n VIEW_CART = 'view_cart',\n VIEW_CONTENT = 'view_content',\n\n\n //\n SELECT_SHIPPING_METHOD = 'select_shipping_method',\n VIRTUALIZED_VIEWED_PAYMENT_FORM = 'virtualized_viewd_payment_form'\n}", "import { ADTRACKIFY_STANDARD_EVENT } from '../adtrackify-standard-events';\nimport { AddressInfo } from '../common/address';\nimport { TrackingEventContext } from './tracking-event-context';\nimport { TrackingEventIdentity } from './tracking-event-identity';\n\nexport interface TrackingEvent {\n id: string;\n type: string;\n name: ADTRACKIFY_STANDARD_EVENT;\n pixelId: string;\n context?: TrackingEventContext;\n identity?: TrackingEventIdentity;\n data?: TrackingEventData;\n testCode?: string;\n sentAtEpoch?: number;\n collectedAt?: string;\n version: string;\n}\n\nexport interface TrackingEventData {\n [ key: string ]: any;\n firstName?: string;\n lastName?: string;\n email?: string;\n phone?: string;\n addresses?: AddressInfo[];\n cartId?: string;\n transactionId?: string;\n affiliation?: string;\n currency?: string;\n price?: number;\n subtotalPrice?: number;\n value?: number;\n tax?: number;\n shipping?: number;\n coupon?: string;\n paymentType?: string;\n shippingTier?: string;\n creativeName?: string;\n creativeSlot?: string;\n locationId?: string;\n promotionId?: string;\n promotionName?: string;\n items?: GenericContent[];\n}\n\nexport interface GenericContent {\n [ key: string ]: any;\n content_type?: string;\n id?: string;\n name?: string;\n sku?: string;\n brand?: string;\n variant?: string;\n coupon?: string;\n currency?: string;\n discount?: number;\n index?: number;\n value?: number;\n price?: number;\n quantity?: number;\n url?: string;\n locationId?: string;\n imageUrl?: string;\n category?: string;\n category2?: string;\n category3?: string;\n category4?: string;\n category5?: string;\n}\n\n\nexport const Currencies: string[] = [ 'AED', 'ARS', 'AUD', 'BDT', 'BIF', 'BOB', 'BRL', 'CAD', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CZK', 'DKK', 'DZD', 'EGP', 'EUR', 'GBP', 'GTQ', 'HKD', 'HNL', 'HUF', 'IDR', 'ILS', 'INR', 'ISK', 'JPY', 'KES', 'KRW', 'KWD', 'KZT', 'MAD', 'MOP', 'MXN', 'MYR', 'NGN', 'NIO', 'NOK', 'NZD', 'PEN', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RUB', 'SAR', 'SEK', 'SGD', 'THB', 'TRY', 'TWD', 'USD', 'VES', 'VND', 'ZAR' ];\n\n", "import { SubscriptionPlan, PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';\n\nexport const StripeBillingMap: any = {\n dev2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod2: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n },\n dev: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n }\n};\n\nexport const CommonPlanInfo = [\n //'60-day Risk Free Trial',\n 'Free Server Side Tracking & Conversion API',\n 'MultiPixel Support (Multiple facebook, tiktok, etc)',\n 'Corrects Facebook Conversion Tracking post IOS14',\n 'Increase ROAS & Attribution Data',\n 'Enhanced Fingerprinting & Identity Resolution',\n 'Unlimited Integrations',\n 'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'\n];\n\nexport const SubscriptionPlanSeedItems: {\n items: SubscriptionPlan[];\n} = {\n items: [ {\n id: 1,\n planName: 'free',\n displayName: 'Free',\n sku: 'ADT-001',\n description: 'Free Plan - Monthly',\n price: '0',\n displayPrice: '$0',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 0,\n trialRequiresCreditCard: false,\n planDesc: [\n ...CommonPlanInfo,\n 'Free Up to 500 orders/month (50,000 events)*'\n ],\n unitPriceText: 'try now - free forever',\n isHighlighted: false,\n isBanner: false\n },\n // STARTER PLANS\n {\n id: 2,\n planName: 'starter_monthly',\n displayName: 'Starter',\n sku: 'ADT-002',\n description: 'Starter Plan - Monthly',\n price: '79.99',\n displayPrice: '$79.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n }, {\n id: 3,\n planName: 'starter_yearly',\n displayName: 'Starter',\n sku: 'ADT-003',\n description: 'Starter Plan - Yearly',\n price: '767.90',\n displayPrice: '$63.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 30,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n unitPriceText: 'billed yearly ($767.90) - 20% savings',\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n },\n // SCALE PLANS\n {\n id: 4,\n planName: 'scale_monthly',\n displayName: 'Scale',\n sku: 'ADT-004',\n description: 'Scale Plan - Monthly',\n price: '199.99',\n displayPrice: '$199.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: '',\n isHighlighted: false,\n isBanner: false\n }, {\n id: 5,\n planName: 'scale_yearly',\n displayName: 'Scale',\n sku: 'ADT-005',\n description: 'Scale Plan - Yearly',\n price: '1823.91',\n displayPrice: '$151.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: 'billed yearly ($1823.91) - 24% savings',\n isHighlighted: false,\n isBanner: false\n },\n // // GROWTH PLANS\n // {\n // id: 6,\n // planName: 'growth_monthly',\n // displayName: 'Growth',\n // sku: 'ADT-006',\n // description: 'Growth Plan - Monthly',\n // price: '199.99',\n // displayPrice: '$199.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '60-day Risk Free Trial',\n // ...CommonPlanInfo,\n // '250,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($540) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // }, {\n // id: 7,\n // planName: 'growth_yearly',\n // displayName: 'Growth',\n // sku: 'ADT-007',\n // description: 'Growth Plan - Yearly',\n // price: '1799.91',\n // displayPrice: '$149.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '30-day Risk Free Trial',\n // 'Fixes IOS14.5 tracking',\n // 'Multi Pixel Support',\n // 'Enhanced Tracking / Attribution',\n // 'Unlimited Facebook Conversion API',\n // 'Unlimited Integrations',\n // 'Easy no code setup',\n // '100,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($1799.91) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // },\n ]\n};\n\n\nexport const getPlanDetails = (planId: number, stage: string) => {\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[ 0 ] as any;\n plan.stripePriceId = StripeBillingMap[ stage ][ plan.planName ];\n return plan as SubscriptionPlan;\n};\n\nexport const getPlanByStripePriceId = (stripePriceId: string, stage: string) => {\n const stripePriceIds = StripeBillingMap[ stage ];\n const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[ key ] === stripePriceId);\n\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[ 0 ] as any;\n plan.stripePriceId = stripePriceId;\n\n return plan as SubscriptionPlan;\n};", "export enum ADTRACKIFY_EVENT_TYPES {\n NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED = 'shopifySubscriptionCreated',\n NOTIFY_SUBSCRIPTION_SIGNUP_COMPLETED = 'subscription.signupCompleted',\n REQUEST_SET_ACCOUNT_OWNER = 'setAccountOwner',\n REQUEST_SET_ACCOUNT_SUBSCRIPTION_ID = 'setAccountSubscriptionId',\n}\n\nexport enum ADTRACKIFY_EVENT_SOURCES {\n SUBSCRIPTIONS = 'subscriptions',\n}", "import { EventBridgeClient } from '../clients';\nimport { Message, TemplatedMessage } from 'postmark';\n\nexport const enum PostmarkRequestType {\n SINGLE_EMAIL = 'single_email',\n TEMPLATE_EMAIL = 'template_email'\n}\n\nexport enum ADTRACKIFY_EVENT_BRIDGE_EVENTS {\n SEND_POSTMARK_EMAIL = 'integration.sendPostmarkEmail',\n}\n\nexport class EventBridgeIntegrationService {\n public eventBridgeClient: EventBridgeClient;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridgeClient = new EventBridgeClient(eventBusName);\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public sendPostmarkEmailEvent = async (eventSource: string, postmarkMessage: Message, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.SINGLE_EMAIL,\n postmarkServerToken\n });\n };\n\n public sendPostmarkTemplatedEmailEvent = async (eventSource: string, postmarkMessage: TemplatedMessage, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.TEMPLATE_EMAIL,\n postmarkServerToken\n });\n };\n\n}\n"],
5
- "mappings": ";;;;;;;;AAAA,SAAS,sBAAmC;AAC5C,SAAS,wBAAwB;AACjC,YAAY,SAAS;AAErB,IAAM,kBAAkB;AAAA,EACtB,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,2BAA2B;AAC7B;AAEA,IAAM,oBAAoB;AAAA,EACxB,aAAa;AACf;AAEA,IAAM,kBAAkB,EAAE,iBAAiB,kBAAkB;AAC7D,IAAM,YAAY,IAAI,eAAe,CAAC,CAAC;AACvC,IAAM,SAAS,iBAAiB,KAAK,WAAW,eAAe;AAExD,IAAM,kBAAN,MAAqB;AA4G5B;AA5GO,IAAM,iBAAN;AACL,cADW,gBACJ,WAAU,OAAO,WAAmB,SAAiB,aAAkB;AAC5E,MAAI;AACF,UAAM,SAAS;AAAA,MACb,WAAW;AAAA,MACX,KAAK;AAAA,QACH,CAAE,UAAW;AAAA,MACf;AAAA,IACF;AACA,UAAM,MAAM,MAAM,OAAO,IAAI,MAAM;AACnC,WAAO,KAAK,QAAQ;AAAA,EACtB,SAAS,GAAP;AACA,IAAI,UAAM,GAAG,EAAE,SAAS,2BAA2B,CAAC;AACpD,WAAO;AAAA,EACT;AACF;AAEA,cAjBW,gBAiBJ,WAAU,OAAO,WAAmB,SAAc;AACvD,MAAI;AACF,UAAM,SAAS;AAAA,MACb,WAAW;AAAA,MACX,MAAM;AAAA,IACR;AACA,UAAM,MAAM,MAAM,OAAO,IAAI,MAAM;AACnC,WAAO;AAAA,EACT,SAAS,GAAP;AACA,IAAI,UAAM,GAAG,EAAE,SAAS,0BAA0B,CAAC;AACnD,WAAO;A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SAAAA;AAAA,GAAA;AAKX,IAAK,iCAAL,kBAAKC,oCAAL;AACL,EAAAA,gCAAA,yBAAsB;AADZ,SAAAA;AAAA,GAAA;AAIL,IAAM,gCAAN,MAAoC;AAAA,EAClC;AAAA,EACA;AAAA,EAEP,YAAa,cAAsB;AACjC,SAAK,oBAAoB,IAAI,kBAAkB,YAAY;AAC3D,SAAK,iBAAiB;AAAA,EACxB;AAAA,EAEO,yBAAyB,OAAO,aAAqB,iBAA0B,wBAAgC;AACpH,WAAO,MAAM,KAAK,kBAAkB;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,QACE;AAAA,QACA,qBAAqB;AAAA,QACrB;AAAA,MACF;AAAA,IAAC;AAAA,EACL;AAAA,EAEO,kCAAkC,OAAO,aAAqB,iBAAmC,wBAAgC;AACtI,WAAO,MAAM,KAAK,kBAAkB;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,QACE;AAAA,QACA,qBAAqB;AAAA,QACrB;AAAA,MACF;AAAA,IAAC;AAAA,EACL;AAEF;",
6
- "names": ["log", "error", "config", "log", "client", "log", "client", "success", "log", "log", "a", "p", "HttpStatusCodes", "client", "log", "client", "log", "log", "client", "log", "error", "log", "debug", "error", "ACCOUNT_STATUS", "DESTINATIONS", "CustomHTMLLocation", "ShopifyAppInstallStatus", "ShopifyAppSubscriptionStatus", "PLAN_BILLING_FREQUENCY", "PAYMENT_STATUS", "SUBSCRIPTION_STATUS", "PAYMENT_GATEWAY", "ADTRACKIFY_STANDARD_EVENT", "stage", "x", "ADTRACKIFY_EVENT_TYPES", "ADTRACKIFY_EVENT_SOURCES", "PostmarkRequestType", "ADTRACKIFY_EVENT_BRIDGE_EVENTS"]
3
+ "sources": ["../src/clients/generic/dynamodb-client.ts", "../src/clients/generic/eventbridge-client.ts", "../src/libs/dates.ts", "../src/clients/generic/http-client.ts", "../src/clients/generic/s3-client.ts", "../src/clients/internal-api/destinations-client.ts", "../src/clients/internal-api/accounts-client.ts", "../src/clients/internal-api/users-auth-client.ts", "../src/helpers/shopify-helper.ts", "../src/libs/url.ts", "../src/libs/crypto.ts", "../src/libs/http-error.ts", "../src/libs/http-status-codes.ts", "../src/clients/internal-api/shopify-app-install-client.ts", "../src/clients/third-party/shopify-client.ts", "../src/helpers/input-validation-helper.ts", "../src/helpers/logging-helper.ts", "../src/helpers/response-helper.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/account.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/destinations.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/destinations/third-party-destination-configs.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/shopify-app-install.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/api/subscription.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/adtrackify-standard-events.ts", "../node_modules/@adtrackify/at-tracking-event-types/src/types/tracking-events/tracking-event-type.ts", "../src/helpers/subscription-helper.ts", "../src/types/internal-events/event-detail-types.ts", "../src/services/eventbridge-integration-service.ts"],
4
+ "sourcesContent": ["import { DynamoDBClient, QueryOutput } from '@aws-sdk/client-dynamodb';\nimport { DynamoDBDocument } from '@aws-sdk/lib-dynamodb'; \nimport * as log from 'lambda-log';\n\nconst marshallOptions = {\n convertEmptyValues: false,\n removeUndefinedValues: false,\n convertClassInstanceToMap: false\n};\n\nconst unmarshallOptions = {\n wrapNumbers: false,\n};\n\nconst translateConfig = { marshallOptions, unmarshallOptions };\nconst ddbClient = new DynamoDBClient({});\nconst client = DynamoDBDocument.from(ddbClient, translateConfig);\n\nexport class DynamoDbClient {\n static safeGet = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.get(params);\n return res?.Item ?? null;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo Client Get Failed' });\n return null;\n }\n };\n\n static safePut = async (tableName: string, data: any) => {\n try {\n const params = {\n TableName: tableName,\n Item: data\n };\n const res = await client.put(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed simplePut' });\n return null;\n }\n };\n\n static safeDelete = async (tableName: string, keyName: string, keyValue: any) => {\n try {\n const params = {\n TableName: tableName,\n Key: {\n [ keyName ]: keyValue\n }\n };\n const res = await client.delete(params);\n return res;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeDelete' });\n return null;\n }\n };\n\n static safeQueryByGSI = async (tableName: string, gsiName: string, keyName: string, keyValue: any) => {\n const query = {\n TableName: tableName,\n IndexName: gsiName,\n KeyConditionExpression: `${keyName} = :value`,\n ExpressionAttributeValues: {\n ':value': keyValue\n }\n };\n const results = await DynamoDbClient.queryAll(query);\n return results;\n };\n\n static safeBatchGet = async (tableName: string, keys: any) => {\n try {\n const params: any = {\n RequestItems: {}\n };\n params.RequestItems[ tableName ] = {\n Keys: keys\n };\n const res = await client.batchGet(params);\n log.info('batchget res', { batchGetRes: res });\n if (res?.Responses?.[ tableName ]) {\n return res?.Responses?.[ tableName ];\n }\n return [];\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed safeBatchGet' });\n return [];\n }\n };\n\n static queryAll = async (params: any) => {\n try {\n log.info('Invoke Query All', { params });\n let currentResult: QueryOutput, exclusiveStartKey;\n let accumulatedResults: any[] = [];\n do {\n params.ExclusiveStartKey = exclusiveStartKey;\n params.Limit = 200;\n currentResult = await client.query(params);\n if (currentResult.Items) {\n exclusiveStartKey = currentResult.LastEvaluatedKey;\n accumulatedResults = [ ...accumulatedResults, ...currentResult.Items ];\n }\n } while (currentResult.Items && currentResult.Items.length > 0 && currentResult.LastEvaluatedKey);\n return accumulatedResults;\n } catch (e: any) {\n log.error(e, { message: 'Dynamo failed queryAll' });\n return null;\n }\n };\n\n static batchGet = (params: any) => client.batchGet(params);\n static get = (params: any) => client.get(params);\n static put = (params: any) => client.put(params);\n static query = (params: any) => client.query(params);\n static scan = (params: any) => client.scan(params);\n static update = (params: any) => client.update(params);\n static delete = (params: any) => client.delete(params);\n}", "import { EventBridgeClient as EventBridge, PutEventsCommand, PutEventsCommandInput } from '@aws-sdk/client-eventbridge';\nimport { v4 as uuidv4 } from 'uuid';\nimport { getCurrentTimestamp } from '../../libs/dates';\nimport * as log from 'lambda-log';\n\nexport class EventBridgeClient {\n public eventBridge: EventBridge;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridge = new EventBridge({});\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public buildAndSendEvent = async (eventSource: string, eventType: string, eventData: any) => {\n const event = this.buildEvent(eventType, eventData);\n return await this.putEvent(eventSource, eventType, event);\n };\n\n public buildEvent = (eventType: string, eventData: any, eventId: string = uuidv4(), eventTime: string = getCurrentTimestamp()) => {\n return {\n eventId,\n eventType,\n eventTime,\n eventData\n };\n };\n\n public putEvent = async (source: string, detailType: string, data: any, headers: any = null) => {\n const params: PutEventsCommandInput = {\n Entries: [ {\n Detail: JSON.stringify({ headers, data }),\n DetailType: detailType,\n EventBusName: this.EVENT_BUS_NAME,\n Source: source,\n Time: new Date(),\n } ],\n };\n const putEventscommand = new PutEventsCommand(params);\n const response = await this.eventBridge.send(putEventscommand);\n log.debug('EventBus Event Published',\n {\n eventBusName: this.EVENT_BUS_NAME,\n eventSource: source,\n eventType: detailType,\n event: data,\n response\n });\n return response;\n };\n\n}\n\n", "\nimport { DateTime } from 'luxon';\n\nexport const getCurrentTimestamp = (): string => {\n return DateTime.utc().toJSDate().toISOString();\n}\n\nexport const getDateFromTimestamp = (timestamp: string) => {\n return timestamp.split('T')[0];\n}\n\nexport const getCurrentDate = (): string => {\n return getDateFromTimestamp(getCurrentTimestamp());\n}", "import axios from 'axios';\nimport axiosRetry from 'axios-retry';\nimport https from 'https';\nimport httpAdapter from 'axios/lib/adapters/http';\n\nconst httpResponse = (res: any = {}) => {\n return {\n headers: res?.header || {},\n data: res?.data || {},\n status: res?.status || 0,\n };\n};\n\nconst handleAxiosError = (error: any) => {\n if (!error?.response && !error?.request) throw error;\n return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });\n};\n\nexport const axiosHttpService = (config: any = {}) => {\n config.adapter = httpAdapter;\n config.httpsAgent = new https.Agent({ keepAlive: true });\n const axiosService = axios.create(config);\n\n axiosRetry(axiosService, { retryDelay: axiosRetry.exponentialDelay, retries: 3 });\n\n return {\n instance: () => axiosService,\n get: (url: string, config?: any) => axiosService.get(url, config).then(httpResponse, handleAxiosError),\n post: (url: string, data?: any, config?: any) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),\n delete: (url: string, config?: any) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),\n put: (url: string, data?: any, config?: any) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),\n patch: (url: string, data?: any, config?: any) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),\n setBaseUrl: (url: string) => !!(axiosService.defaults.baseURL = url)\n };\n};\n", "import { S3 } from '@aws-sdk/client-s3';\nimport * as log from 'lambda-log';\n\nexport class S3Client {\n s3: S3;\n\n constructor(accessKeyId: string, secretAccessKey: string){\n this.s3 = new S3({\n credentials: {\n accessKeyId,\n secretAccessKey\n }\n })\n }\n\n async uploadJson(path: string, bucket: string, jsonData: any){\n try {\n const res = await this.s3.putObject({\n Bucket: bucket,\n ContentType: 'application/json; charset=utf-8',\n Body: JSON.stringify(jsonData),\n Key: path\n });\n\n return res;\n } catch (error) {\n log.error('Error in s3 upload json', { error });\n return error;\n }\n }\n}", "import * as log from 'lambda-log';\n//const log = require('lambda-log');\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { Destination } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface GetDestinationsResponseData {\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface CreateDestinationResponseData {\n destination: Destination;\n [ key: string ]: any;\n}\n\n\nexport class DestinationsClient {\n\n public BASE_API_URL: string;\n public DESTINATIONS_API_KEY: string;\n\n constructor (baseApiUrl: string, destinationsApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.DESTINATIONS_API_KEY = destinationsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.DESTINATIONS_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/', createDestinationRequest);\n log.info('createDestinationResponse', { response });\n return response as ApiResponse<CreateDestinationResponseData>;\n };\n\n getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?pixelId=${pixelId}`);\n log.info('getPixelResponse', { response });\n return response as ApiResponse<GetDestinationsResponseData>;\n };\n}\n", "import * as log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';\nimport { axiosHttpService } from '../generic/http-client';\n\n//const BASE_API_URL = process.env.BASE_API_URL;\n\n//const SERVICE_API_ROOT_URL = `${BASE_API_URL}/accounts`;\n//const ACCOUNTS_API_KEY = process.env.ACCOUNTS_API_KEY;\n\nexport interface AccountResponseData {\n account: Account;\n [ key: string ]: any;\n}\n\nexport interface IsAuthorizedUserResponseData {\n isAccountUser: boolean;\n [ key: string ]: any;\n}\nexport interface PixelConfigResponseData {\n id: string;\n destinations: Destination[];\n [ key: string ]: any;\n}\nexport interface AddUserToAccountResponseData {\n userId: string;\n accountId: string;\n}\n\nexport interface UpdateAccountRequest {\n accountName?: string,\n companyName?: string,\n primaryEmail?: string,\n ownerId?: string,\n subscriptionId?: string,\n accountStatus?: ACCOUNT_STATUS;\n}\n\nexport class AccountsClient {\n public BASE_API_URL: string;\n public ACCOUNTS_API_KEY?: string;\n\n constructor (baseApiUrl: string, accountsApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.ACCOUNTS_API_KEY = accountsApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;\n const params: any = {\n baseURL: SERVICE_API_ROOT_URL\n };\n if (this.ACCOUNTS_API_KEY) {\n params.headers = {\n common: {\n 'x-api-key': this.ACCOUNTS_API_KEY\n }\n };\n }\n return params;\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n createAccount = async (createAccountRequest: any) => {\n const client = await this.getClient();\n const createAccountResponse = await client.post('', createAccountRequest);\n log.info('createAccountResponse', { createAccountResponse });\n return createAccountResponse;\n };\n updateAccount = async (accountId: string, body: any): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.patch(`/${accountId}/`, body);\n log.info('update Account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addOwner = async (accountId: string, userId: string) => {\n const client = await this.getClient();\n const addOwnerResponse = await client.post('/addOwner', { accountId, userId });\n log.info('addOwnerResponse', { addOwnerResponse });\n return addOwnerResponse;\n };\n isAuthorizedUser = async (userId: string, accountId: string, pixelId?: string): Promise<ApiResponse<IsAuthorizedUserResponseData>> => {\n const client = await this.getClient();\n const body = {\n userId, accountId, pixelId\n };\n const response = await client.post('/checkUserAuthorization', body);\n log.info('checkUserAuthorization', { response });\n return response as ApiResponse<IsAuthorizedUserResponseData>;\n };\n adminDeleteAccount = async (accountId: string) => {\n const client = await this.getClient();\n const success = await client.delete(`/${accountId}`);\n log.info('adminDeleteAccount');\n return success;\n };\n getPixelConfigById = async (pixelId: string): Promise<ApiResponse<PixelConfigResponseData>> => {\n const client = await this.getClient();\n const pixelResponse = await client.get(`/px/${pixelId}/config`);\n log.debug('get pixelResponse', { pixelResponse });\n return pixelResponse;\n };\n getAccount = async (accountId: string): Promise<ApiResponse<AccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${accountId}/`);\n log.info('get account response', { response });\n return response as ApiResponse<AccountResponseData>;\n };\n addUserToAccount = async (accountId: string, userId: string): Promise<ApiResponse<AddUserToAccountResponseData>> => {\n const client = await this.getClient();\n const response = await client.post('/addUser', { accountId, userId });\n log.info('add user account response', { response });\n return response as ApiResponse<AddUserToAccountResponseData>;\n };\n\n\n // setAccountSubscriptionId = async (accountId: string, subscriptionId: string): Promise<ApiResponse<any>> => {\n // const client = await this.getClient();\n // const pixelResponse = await client.get(`/px/${pixelId}/config`);\n // log.debug('pixelResponse', { pixelResponse });\n // return pixelResponse;\n // };\n}", "import { User } from '@adtrackify/at-tracking-event-types';\nimport * as log from 'lambda-log';\nimport { HttpError, HttpStatusCodes } from '../../libs';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\n\nexport interface UserResponseData {\n user: User;\n [ key: string ]: any;\n}\n\nexport interface UserSignupRequest {\n email: string,\n password: string,\n givenName: string,\n familyName: string;\n}\n\nexport class UsersAuthClient {\n\n public SERVICE_API_ROOT_URL: string;\n public BASE_API_URL: string;\n public USERS_AUTH_API_KEY: string;\n constructor (baseApiUrl: string, usersAuthApiKey?: string) {\n this.BASE_API_URL = baseApiUrl;\n this.USERS_AUTH_API_KEY = usersAuthApiKey as string;\n this.SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/auth`;\n }\n\n getConfig = () => {\n return {\n baseURL: this.SERVICE_API_ROOT_URL,\n headers: {\n common: {\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n signupAndConfirmUser = async (userSignupRequest: any): Promise<any> => {\n const user = await this.signupUser(userSignupRequest);\n await this.adminConfirmUser(user.email);\n // if fail - delete user and throw error\n return user;\n };\n\n signupUser = async (userSignupRequest: UserSignupRequest): Promise<any> => {\n log.info('Attempting to signup user', { email: userSignupRequest.email });\n\n const client = await this.getClient();\n const response = await client.post('/signup', userSignupRequest);\n\n // Check if Successful or throw error\n if (response.status !== 200 || !response?.data?.user) {\n const message = 'User Signup Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('User Signup Successful', { response });\n return response.data.user;\n };\n\n //userName is same as user id\n adminConfirmUser = async (email: string) => {\n //confirm user\n //@TODO update user auth service with admin confirm user endpoint\n log.info('Attempting to admin confirm user', { email });\n\n const client = await this.getClient();\n const response = await client.post('/admin/confirm',\n {\n email\n }, {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n }\n }\n );\n\n // Check if Successful or throw error\n if (response.status !== 200) {\n const message = 'Admin User Confirmation Failed';\n log.error(message, { response });\n throw new HttpError(HttpStatusCodes.INTERNAL_SERVER_ERROR, message);\n }\n\n log.info('Admin User Confirmation Successful', { response });\n return response;\n };\n\n getUserByEmail = async (email: string): Promise<ApiResponse<UserResponseData>> => {\n const client = await this.getClient();\n const getUserResponse = await client.get('/lookup', {\n headers: {\n 'x-api-key': this.USERS_AUTH_API_KEY\n },\n params: {\n email\n }\n });\n log.info('getUserResponse', { getUserResponse });\n return getUserResponse;\n };\n\n}\n\n", "import { createHmac } from 'crypto';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs';\nimport { mapObjectToQueryString } from '../libs/url';\nexport interface ShopifyRequestValidationParameters {\n code: string,\n hmac?: string,\n shop: string,\n state: string,\n timestamp: string;\n}\n\nexport const isShopifyRequestValid = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string): boolean => {\n // remove hmac if it exists\n // map input to query string\n // generate hash using api secret key and validate it matches hmac\n delete validationParams.hmac;\n const hmacString = mapObjectToQueryString(validationParams);\n\n\n const generatedHash = createHmac('sha256', shopifyAppApiSecret)\n .update(hmacString)\n .digest('hex');\n\n return generatedHash === validationHmac;\n};\n\nexport const validateShopifyRequest = (validationParams: ShopifyRequestValidationParameters, validationHmac: string, shopifyAppApiSecret: string) => {\n log.info('Validating shopify request is authentic', { validationParams });\n const isValid = isShopifyRequestValid(validationParams, validationHmac as string, shopifyAppApiSecret);\n if (!isValid) {\n const message = 'Failed: Shopify Request hmac validation';\n log.error(message);\n throw HttpError.badRequest(message);\n }\n log.info('Sucess: Shopify Request hmac validation');\n return true;\n}\n\n", "// Record<string, string> is any object\nexport const mapObjectToQueryString = (inputObj: any): string => {\n const qsp = Object.entries(inputObj).sort((a, b) => a[ 0 ] < b[ 0 ] ? -1 : 1);\n const urlParams = new URLSearchParams();\n qsp.map(p => {\n urlParams.append(p[ 0 ], p[ 1 ] as string);\n });\n const qs = urlParams.toString();\n return qs;\n};", "import crypto from 'crypto';\n\nexport const generatePublicKey = (): string => {\n const publicKey = crypto.randomBytes(26);\n return publicKey.toString('utf8');\n};", "/* eslint-disable no-dupe-class-members */\nimport { strict as assert } from 'assert';\n\nconst deepClone = (o = {}) => JSON.parse(JSON.stringify(o));\nconst containsStackTrace = (text = '') => /at.+\\.js:\\d+:\\d+/.test(text);\nconst objectContainsStackTrace = (obj: any) =>\n !obj ? false : containsStackTrace(JSON.stringify(obj));\n\n// may only be expanded by governance, never reduced\nconst supportedStatusCodes: any = {\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 403: 'Forbidden',\n 404: 'Not Found',\n 405: 'Method Not Allowed',\n 409: 'Conflict',\n 412: 'Precondition Failed',\n 413: 'Payload Too Large',\n 415: 'Unsupported Media Type',\n 428: 'Precondition Required',\n 429: 'Too Many Requests',\n 500: 'Internal Server Error',\n 501: 'Not Implemented',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n 504: 'Gateway Timeout'\n};\n\nconst supportedStatusCodesMessage = `statusCode must be one of the following: ${JSON.stringify(Object.keys(supportedStatusCodes))}`;\n//const onlyStatusCodeMessage = 'Server errors may not specify any parameter except statusCode';\n\n//const isNullOrUndefined = (value: any) => value === null || value === undefined;\n\nexport class HttpError extends Error {\n body: {\n [ key: string ]: any;\n };\n headers: object[];\n statusCode: number;\n isServerError: boolean;\n\n constructor (statusCode: number,\n message?: string,\n body?: {\n [ key: string ]: any;\n },\n headers?: object[]) {\n assert(statusCode in supportedStatusCodes, supportedStatusCodesMessage);\n\n const isServerError = statusCode > 499;\n\n assert(\n body === undefined || typeof body === 'object',\n 'body must be an object or omitted'\n );\n assert(\n headers === undefined || typeof headers === 'object',\n 'headers must be an object or omitted'\n );\n\n message = message ?? supportedStatusCodes[ statusCode ];\n\n assert(\n !containsStackTrace(message) && !objectContainsStackTrace(body),\n 'the message or data parameters may not contain errors or stack traces'\n );\n\n super(message);\n\n this.body = deepClone(body);\n this.headers = deepClone(headers);\n this.statusCode = statusCode;\n this.isServerError = isServerError;\n if (!this?.body?.message) {\n this.body.message = this.message;\n }\n }\n\n\n static get supportedStatusCodes() { return supportedStatusCodes; }\n static badRequest = (message?: string, body?: object, headers?: object[]) => { return new HttpError(400, message, body, headers); };\n static unauthorized = (message?: string, body?: object, headers?: object[]) => new HttpError(401, message, body, headers);\n static forbidden = (message?: string, body?: object, headers?: object[]) => new HttpError(403, message, body, headers);\n static notFound = (message?: string, body?: object, headers?: object[]) => new HttpError(404, message, body, headers);\n static internal = (message?: string, body?: object, headers?: object[]) => new HttpError(500, message, body, headers);\n static notImplemented = () => new HttpError(501);\n static badGateway = () => new HttpError(502);\n static serviceUnavailable = (headers: object[]) => new HttpError(503, undefined, undefined, headers);\n static gatewayTimeout = () => new HttpError(504);\n}\n", "export enum HttpStatusCodes {\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1\n *\n * This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished.\n */\n CONTINUE = 100,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2\n *\n * This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too.\n */\n SWITCHING_PROTOCOLS = 101,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1\n *\n * This code indicates that the server has received and is processing the request, but no response is available yet.\n */\n PROCESSING = 102,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1\n *\n * The request has succeeded. The meaning of a success varies depending on the HTTP method:\n * GET: The resource has been fetched and is transmitted in the message body.\n * HEAD: The entity headers are in the message body.\n * POST: The resource describing the result of the action is transmitted in the message body.\n * TRACE: The message body contains the request message as received by the server\n */\n OK = 200,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2\n *\n * The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request.\n */\n CREATED = 201,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3\n *\n * The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing.\n */\n ACCEPTED = 202,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4\n *\n * This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response.\n */\n NON_AUTHORITATIVE_INFORMATION = 203,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5\n *\n * There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.\n */\n NO_CONTENT = 204,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6\n *\n * This response code is sent after accomplishing request to tell user agent reset document view which sent this request.\n */\n RESET_CONTENT = 205,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1\n *\n * This response code is used because of range header sent by the client to separate download into multiple streams.\n */\n PARTIAL_CONTENT = 206,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2\n *\n * A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate.\n */\n MULTI_STATUS = 207,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1\n *\n * The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses.\n */\n MULTIPLE_CHOICES = 300,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2\n *\n * This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response.\n */\n MOVED_PERMANENTLY = 301,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3\n *\n * This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.\n */\n MOVED_TEMPORARILY = 302,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4\n *\n * Server sent this response to directing client to get requested resource to another URI with an GET request.\n */\n SEE_OTHER = 303,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1\n *\n * This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response.\n */\n NOT_MODIFIED = 304,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6\n *\n * Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.\n */\n USE_PROXY = 305,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7\n *\n * Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n TEMPORARY_REDIRECT = 307,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3\n *\n * This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request.\n */\n PERMANENT_REDIRECT = 308,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1\n *\n * This response means that server could not understand the request due to invalid syntax.\n */\n BAD_REQUEST = 400,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1\n *\n * Although the HTTP standard specifies \"unauthorized\", semantically this response means \"unauthenticated\". That is, the client must authenticate itself to get the requested response.\n */\n UNAUTHORIZED = 401,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2\n *\n * This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently.\n */\n PAYMENT_REQUIRED = 402,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3\n *\n * The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server.\n */\n FORBIDDEN = 403,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4\n *\n * The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web.\n */\n NOT_FOUND = 404,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5\n *\n * The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code.\n */\n METHOD_NOT_ALLOWED = 405,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6\n *\n * This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent.\n */\n NOT_ACCEPTABLE = 406,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2\n *\n * This is similar to 401 but authentication is needed to be done by a proxy.\n */\n PROXY_AUTHENTICATION_REQUIRED = 407,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7\n *\n * This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.\n */\n REQUEST_TIMEOUT = 408,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8\n *\n * This response is sent when a request conflicts with the current state of the server.\n */\n CONFLICT = 409,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9\n *\n * This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for \"limited-time, promotional services\". APIs should not feel compelled to indicate resources that have been deleted with this status code.\n */\n GONE = 410,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10\n *\n * The server rejected the request because the Content-Length header field is not defined and the server requires it.\n */\n LENGTH_REQUIRED = 411,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2\n *\n * The client has indicated preconditions in its headers which the server does not meet.\n */\n PRECONDITION_FAILED = 412,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11\n *\n * Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field.\n */\n REQUEST_TOO_LONG = 413,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12\n *\n * The URI requested by the client is longer than the server is willing to interpret.\n */\n REQUEST_URI_TOO_LONG = 414,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13\n *\n * The media format of the requested data is not supported by the server, so the server is rejecting the request.\n */\n UNSUPPORTED_MEDIA_TYPE = 415,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4\n *\n * The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data.\n */\n REQUESTED_RANGE_NOT_SATISFIABLE = 416,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14\n *\n * This response code means the expectation indicated by the Expect request header field can't be met by the server.\n */\n EXPECTATION_FAILED = 417,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2\n *\n * Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\". The resulting entity body MAY be short and stout.\n */\n IM_A_TEAPOT = 418,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request. This condition is considered to be temporary. If the request which received this status code was the result of a user action, the request MUST NOT be repeated until it is requested by a separate user action.\n */\n INSUFFICIENT_SPACE_ON_RESOURCE = 419,\n /**\n * @deprecated\n * Official Documentation @ https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt\n *\n * A deprecated response used by the Spring Framework when a method has failed.\n */\n METHOD_FAILURE = 420,\n /**\n * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7540#section-9.1.2\n *\n * Defined in the specification of HTTP/2 to indicate that a server is not able to produce a response for the combination of scheme and authority that are included in the request URI.\n */\n MISDIRECTED_REQUEST = 421,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3\n *\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UNPROCESSABLE_ENTITY = 422,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4\n *\n * The resource that is being accessed is locked.\n */\n LOCKED = 423,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5\n *\n * The request failed due to failure of a previous request.\n */\n FAILED_DEPENDENCY = 424,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3\n *\n * The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.\n */\n PRECONDITION_REQUIRED = 428,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4\n *\n * The user has sent too many requests in a given amount of time (\"rate limiting\").\n */\n TOO_MANY_REQUESTS = 429,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5\n *\n * The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.\n */\n REQUEST_HEADER_FIELDS_TOO_LARGE = 431,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7725\n *\n * The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government.\n */\n UNAVAILABLE_FOR_LEGAL_REASONS = 451,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1\n *\n * The server encountered an unexpected condition that prevented it from fulfilling the request.\n */\n INTERNAL_SERVER_ERROR = 500,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2\n *\n * The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.\n */\n NOT_IMPLEMENTED = 501,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3\n *\n * This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.\n */\n BAD_GATEWAY = 502,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4\n *\n * The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.\n */\n SERVICE_UNAVAILABLE = 503,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5\n *\n * This error response is given when the server is acting as a gateway and cannot get a response in time.\n */\n GATEWAY_TIMEOUT = 504,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6\n *\n * The HTTP version used in the request is not supported by the server.\n */\n HTTP_VERSION_NOT_SUPPORTED = 505,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6\n *\n * The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.\n */\n INSUFFICIENT_STORAGE = 507,\n /**\n * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6\n *\n * The 511 status code indicates that the client needs to authenticate to gain network access.\n */\n NETWORK_AUTHENTICATION_REQUIRED = 511\n}", "import log from 'lambda-log';\nimport { ApiResponse } from '../../types/api-response';\nimport { axiosHttpService } from '../generic/http-client';\nimport { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';\n//const BASE_API_URL = process.env.BASE_API_URL;\n//const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;\n\nexport interface ShopifyAppInstallResponseData {\n shopifyAppInstall: ShopifyAppInstall;\n [ key: string ]: any;\n}\n\nexport interface UpdateShopifyAppInstallRequest {\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus,\n pixelId?: string,\n shopifyAppInstallId: string;\n isAppEnabled?: boolean;\n}\n\nexport class ShopifyAppInstallClient {\n\n public BASE_API_URL: string;\n public SHOPIFY_APP_INSTALL_API_KEY: string;\n\n constructor (baseApiUrl: string, shopifyAppInstallApiKey: string) {\n this.BASE_API_URL = baseApiUrl;\n this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;\n }\n\n getConfig = () => {\n const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;\n return {\n baseURL: SERVICE_API_ROOT_URL,\n headers: {\n common: {\n 'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY\n }\n }\n };\n };\n\n getClient = async () => {\n return axiosHttpService(this.getConfig());\n };\n\n updateShopifyAppInstall = async (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);\n log.info('updateShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstall = async (shopifyAppInstallId: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/${shopifyAppInstallId}`);\n log.info('getShopifyAppInstall', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>;\n };\n\n getShopifyAppInstallByShop = async (shop: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {\n const client = await this.getClient();\n const response = await client.get(`/?shop=${shop}`);\n log.info('getShopifyAppInstallByShop', { response });\n return response as ApiResponse<ShopifyAppInstallResponseData>; \n }\n}\n", "import { axiosHttpService } from '../generic/http-client';\nimport * as log from 'lambda-log';\n\nexport class ShopifyClient {\n static _shopify_api_version = process.env.SHOPIFY_API_VERSION as string;\n static getConfig = (shopifyDomain: string, accessToken: string) => {\n const config = {\n baseURL: `https://${shopifyDomain}/admin/api/${this._shopify_api_version}`,\n headers: {\n common: {\n 'X-Shopify-Access-Token': accessToken,\n },\n },\n };\n return config;\n };\n\n static getClient = (shopifyDomain: string, accessToken: string) => {\n return axiosHttpService(\n this.getConfig(shopifyDomain, accessToken)\n );\n };\n\n static registerApp = async (shop: string, code: string, appKey: string, appSecret: string) => {\n const client = axiosHttpService();\n const url = 'https://' + shop + '/admin/oauth/access_token';\n const payload = {\n client_id: appKey,\n client_secret: appSecret,\n code\n };\n const res = await client.post(url, payload);\n return res;\n };\n\n static registerWebhookTopic = async (shop: string, accessToken: string, eventBridgeArn: string, topic: string) => {\n const client = axiosHttpService();\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/webhooks.json`;\n const payload = {\n webhook: {\n topic,\n address: eventBridgeArn,\n format: 'json'\n }\n };\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n if (res.status >= 400) {\n log.error('Failed to register Webhook Topic', { shop, accessToken, eventBridgeArn, topic, url, payload });\n }\n log.debug('Shopify Client Webhook Registration Response', { registrationResponse: res });\n return res;\n };\n\n static updateShopifyAppMetafield = async (shop: string, accessToken: string, pixelId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/metafields.json`;\n const payload = {\n metafield: {\n namespace: 'adtr',\n key: 'adtr.config',\n value: pixelId,\n type: 'single_line_text_field'\n }\n };\n const res = await this.genericShopifyPost(url, accessToken, payload);\n\n if (res.status >= 400) {\n log.error('Failed to update Shopify app Metafield ', { shop, accessToken, url, payload });\n }\n return res;\n };\n\n static getShopifyStoreProperties = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/shop.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n\n if (res.status >= 400) {\n log.error('Failed to get Shopify Store Properties', { shop, accessToken, url });\n }\n return res;\n };\n\n static createAppSubscription = async (shop: string, accessToken: string,\n planName: string, price: number, returnUrl: string, trialDays: number, test?: boolean) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const recurring_application_charge = {\n name: planName,\n price,\n return_url: returnUrl,\n trial_days: trialDays,\n test\n };\n const res = await this.genericShopifyPost(url, accessToken, { recurring_application_charge });\n if (res.status >= 400) {\n log.error('Failed to create App Subscription', { shop, accessToken, url });\n }\n return res;\n };\n\n static cancelAppSubscription = async (shop: string, accessToken: string, chargeId: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges/${chargeId}.json`;\n const client = axiosHttpService();\n const res = await client.delete(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n\n if (res.status !== 200) {\n log.error('Failed to cancel recurring App billing', { shop, accessToken, url });\n }\n return res;\n };\n\n static listAppSubscriptions = async (shop: string, accessToken: string) => {\n const url = `https://${shop}/admin/api/${this._shopify_api_version}/recurring_application_charges.json`;\n const res = await this.genericShopifyGet(url, accessToken);\n if (res.status >= 400) {\n log.error('Failed to get App Subscriptions', { shop, accessToken, url });\n }\n return res;\n };\n\n static genericShopifyPost = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken, 'Content-Type': 'application/json' } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyGet = async (url: string, accessToken: string) => {\n const client = axiosHttpService();\n const res = await client.get(url, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n\n static genericShopifyPut = async (url: string, accessToken: string, payload: any) => {\n const client = axiosHttpService();\n const res = await client.put(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });\n log.debug('Shopify Client Response', { res });\n return res;\n };\n}\n", "import Joi from 'joi';\nimport * as log from 'lambda-log';\nimport { HttpError } from '../libs/http-error';\n\nexport const validateInput = (schema: Joi.ObjectSchema<any>, input: any) => {\n const { error, value } = schema.validate(input);\n if (error) {\n log.info('', { error });\n\n const httperr = HttpError.badRequest('Bad Request', {\n errors: error.details.map(detail => ({\n message: detail?.message,\n key: detail?.context?.key,\n path: detail?.path,\n }))\n });\n\n log.info('', { httperr });\n throw httperr;\n }\n return value;\n};", "import * as log from 'lambda-log';\nconst stage = process?.env?.STAGE;\n\nexport const configureLogger = (event: any, context: any, debug = true) => {\n log.options.meta.stage = stage;\n log.options.meta.source_name = context?.functionName || 'unknown';\n log.options.meta.awsRequestId = context?.awsRequestId || 'unknown';\n log.options.meta.lambdaEvent = event;\n log.options.debug = debug;\n}", "\nexport const success = (body: any) => {\n return buildResponse(200, body);\n}\n\nconst defaultError = {\n message: 'internalServerError'\n}\n\nexport const failure = (error: any, statusCode = 500) => {\n statusCode = error?.statusCode ?? statusCode;\n\n let body = defaultError;\n if (error?.body) {\n body = error.body;\n }\n else if (error?.message) {\n body = { message: error.message };\n } else if (statusCode === 500) {\n body = defaultError;\n }\n return buildResponse(statusCode, body);\n}\n\nexport const buildResponse = (statusCode: number, body: any = {}) => {\n delete body.stack;\n return {\n statusCode: statusCode,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Credentials': true,\n 'cache-control': 'max-age=86400',\n Date: new Date(),\n 'Last-Modified': new Date(),\n 'Access-Control-Allow-Headers':\n 'Content-Type, Content-Encoding'\n },\n body: JSON.stringify(body),\n };\n}\n", "import { Subscription } from './subscription';\n\nexport interface Account {\n id: string,\n accountName: string,\n companyName?: string,\n accountStatus: ACCOUNT_STATUS,\n primaryEmail: string,\n publicApiKey?: string,\n subscriptionId?: string,\n pixels?: Pixel[],\n subscription?: Subscription;\n ownerId?: string,\n createdAt: string,\n updatedAt: string;\n}\n\n\nexport interface Pixel {\n id: string;\n accountId: string;\n name: string;\n createdAt: string,\n updatedAt: string;\n}\n\nexport enum ACCOUNT_STATUS {\n PENDING = 'pending',\n ACTIVE = 'active',\n INACTIVE = 'inactive'\n}", "\r\nexport interface Destination {\r\n id: string,\r\n accountId: string,\r\n pixelId: string,\r\n destination: string;\r\n displayName?: string,\r\n enabled: boolean;\r\n configuration?: UserDestinationConfiguration,\r\n createdAt: string,\r\n updatedAt: string;\r\n}\r\n\r\nexport enum DESTINATIONS {\r\n FACEBOOK = 'facebook',\r\n TIKTOK = 'tiktok',\r\n GOOGLE_ADS = 'googleAds',\r\n GOOGLE_ANALYTICS_4 = 'googleAnalytics4',\r\n HUBSPOT = 'hubspot',\r\n WEBHOOK = 'webhook',\r\n CUSTOM_HTML = 'customHTML',\r\n CUSTOM_JS = 'customJS',\r\n SNAPCHAT = 'snapchat',\r\n TWITTER = 'twitter',\r\n REDDIT = 'reddit'\r\n}\r\n\r\nexport interface UserDestinationConfiguration {\r\n [ key: string ]: any;\r\n eventBlacklist?: string[];\r\n events?: EventConfiguration[];\r\n trigger?: DestinationTriggerConfiguration;\r\n}\r\n\r\nexport interface DestinationTriggerConfiguration {\r\n shopify?: ShopifyTriggerConfiguration;\r\n exludeDomains?: string[];\r\n excludePages?: string[];\r\n domains?: string[];\r\n pages?: string[];\r\n}\r\n\r\nexport interface ShopifyTriggerConfiguration {\r\n enabled: boolean;\r\n collections?: string[];\r\n tags?: string[];\r\n}\r\n\r\n\r\nexport interface EventConfiguration {\r\n sourceEventName: string;\r\n exclude?: boolean;\r\n sample: EventSampleConfiguration;\r\n transformations?: EventTransformation[];\r\n}\r\n\r\nexport interface EventTransformation {\r\n transformationEventName: string;\r\n enabled: boolean;\r\n}\r\n\r\nexport interface EventSampleConfiguration {\r\n enabled: boolean;\r\n rate: number;\r\n}\r\n\r\n", "import { Destination, UserDestinationConfiguration } from './destinations';\r\n\r\nexport interface AdTrackifyFacebookDestination extends Destination {\r\n configuration: FacebookPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyTikTokDestination extends Destination {\r\n configuration: TiktokPixelConfiguration;\r\n}\r\n\r\nexport interface AdTrackifyGoogleAnalytics4Destination extends Destination {\r\n configuration: GoogleAnalytics4Configuration;\r\n}\r\n\r\n// Destination Specific configurations below\r\nexport interface FacebookPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface TiktokPixelConfiguration extends UserDestinationConfiguration {\r\n apiAccessToken?: string;\r\n enableConversionAPI: boolean;\r\n pixelId: string;\r\n}\r\n\r\nexport interface GoogleAnalytics4Configuration extends UserDestinationConfiguration {\r\n apiSecret: string;\r\n measurementId: string;\r\n}\r\n\r\nexport interface GoogleAdsConfiguration extends UserDestinationConfiguration {\r\n pixelId: string;\r\n conversionID: string;\r\n}\r\n\r\nexport interface HubspotPixelConfiguration extends UserDestinationConfiguration {\r\n hubspotId: string;\r\n}\r\n\r\nexport interface SnapchatPixelConfiguration extends UserDestinationConfiguration {\r\n snapchatPixelId: string;\r\n}\r\n\r\nexport interface TwitterPixelConfiguration extends UserDestinationConfiguration {\r\n twitterPixelId: string;\r\n}\r\n\r\nexport interface WebhookConfiguration extends UserDestinationConfiguration {\r\n webhookUrl: string;\r\n}\r\n\r\nexport interface CustomHTMLConfiguration extends UserDestinationConfiguration {\r\n html: string;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport interface CustomJSConfiguration extends UserDestinationConfiguration {\r\n script: string;\r\n async: boolean;\r\n defer: boolean;\r\n location: CustomHTMLLocation;\r\n}\r\n\r\nexport enum CustomHTMLLocation {\r\n HEADER = 'header',\r\n FOOTER = 'footer',\r\n BODY = 'body'\r\n}\r\n\r\n", "export interface ShopifyAppInstall {\n shopifyAppInstallId: string;\n shop: string;\n accessToken?: string;\n appStatus?: string;\n appSubscriptionStatus?: ShopifyAppSubscriptionStatus;\n code?: string;\n hmac?: string;\n host?: string;\n installRequest?: ShopifyInstallRequest;\n isAppEnabled?: boolean;\n pixelId?: string;\n shopInfo?: any;\n state?: string;\n timestamp?: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport enum ShopifyAppInstallStatus {\n STARTED = 'started',\n COMPLETED = 'completed',\n UNINSTALLED = 'uninstalled',\n FAILED = 'failed',\n NONE = 'none'\n}\nexport enum ShopifyAppSubscriptionStatus {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\n\nexport interface ShopifyInstallRequest {\n shop?: string;\n session?: string;\n hmac?: string;\n host?: string;\n nonce?: string;\n timestamp?: string;\n status?: string;\n}\n\nexport interface ShopifyStoreInfo {\n // TBD based on shopify api\n [ key: string ]: any;\n}", "\nexport interface Subscription {\n id: string,\n accountId?: string,\n shopifyAppInstallId?: string,\n shopifyDomain?: string,\n stripeCustomerId?: string,\n stripeSubscriptionId?: string,\n stripeCompletedCheckoutSession?: any;\n shopifyChargeId?: string;\n subscriptionPlan?: SubscriptionPlan,\n status?: SUBSCRIPTION_STATUS,\n paymentStatus?: PAYMENT_STATUS,\n paymentGateway?: PAYMENT_GATEWAY,\n createdAt: string,\n updatedAt: string,\n\n}\nexport interface SubscriptionPlan {\n id: number;\n planName: string;\n displayName: string;\n description: string;\n sku: string;\n price: string;\n displayPrice: string;\n billingFrequency: PLAN_BILLING_FREQUENCY;\n trialLengthDays?: number;\n trialRequiresCreditCard?: boolean;\n planDesc?: string[];\n unitPriceText?: string;\n isHighlighted?: boolean;\n isBanner?: boolean;\n bannerText?: string;\n bannerColor?: string;\n stripePriceId?: string;\n stripeProductId?: string;\n}\n\nexport enum PLAN_BILLING_FREQUENCY {\n MONTHLY = 'monthly',\n YEARLY = 'yearly'\n}\n\nexport enum PAYMENT_STATUS {\n CURRENT = 'current',\n PAST_DUE = 'past_due',\n CANCELLED = 'cancelled',\n FAILED = 'failed'\n}\n\nexport enum SUBSCRIPTION_STATUS {\n ACTIVE = 'active', // approved and billed to shop\n CANCELLED = 'cancelled', // cancelled, uninstalled or cancellation\n DECLINED = 'declined', // subscription declined by merchant\n EXPIRED = 'expired', //wasn't approved within two days of being created\n FROZEN = 'frozen', //on hold due to not payment\n PENDING = 'pending', // pending approval\n NOT_SUBMITTED = 'na' // billing has not yet been attempted\n}\nexport enum PAYMENT_GATEWAY {\n STRIPE = 'stripe',\n PAYPAL = 'paypal',\n SHOPIFY = 'shopify'\n}\n", "export enum ADTRACKIFY_STANDARD_EVENT {\n ADD_PAYMENT_INFO = 'add_payment_info',\n ADD_SHIPPING_INFO = 'add_shipping_info',\n ADD_TO_CART = 'add_to_cart',\n ADD_TO_WISHLIST = 'add_to_wishlist',\n // COMPLETE_REGISTRATION: 'complete_registration',\n // CONTACT: 'contact',\n INITIATE_CHECKOUT = 'initiate_checkout',\n LEAD = 'lead',\n LOGIN = 'login',\n PAGE_VIEW = 'page_view',\n PURCHASE = 'purchase',\n REFUND = 'refund',\n SEARCH = 'search',\n // START_TRIAL: 'start_trial',\n // SUBMIT_APPLICATION: 'submit_application',\n // SUBSCRIBE: 'subscribe',\n SIGN_UP = 'sign_up',\n VIEW_CART = 'view_cart',\n VIEW_CONTENT = 'view_content',\n\n\n //\n SELECT_SHIPPING_METHOD = 'select_shipping_method',\n VIRTUALIZED_VIEWED_PAYMENT_FORM = 'virtualized_viewd_payment_form'\n}", "import { ADTRACKIFY_STANDARD_EVENT } from '../adtrackify-standard-events';\nimport { AddressInfo } from '../common/address';\nimport { TrackingEventContext } from './tracking-event-context';\nimport { TrackingEventIdentity } from './tracking-event-identity';\n\nexport interface TrackingEvent {\n id: string;\n type: string;\n name: ADTRACKIFY_STANDARD_EVENT;\n pixelId: string;\n context?: TrackingEventContext;\n identity?: TrackingEventIdentity;\n data?: TrackingEventData;\n testCode?: string;\n sentAtEpoch?: number;\n collectedAt?: string;\n version: string;\n}\n\nexport interface TrackingEventData {\n [ key: string ]: any;\n firstName?: string;\n lastName?: string;\n email?: string;\n phone?: string;\n addresses?: AddressInfo[];\n cartId?: string;\n transactionId?: string;\n affiliation?: string;\n currency?: string;\n price?: number;\n subtotalPrice?: number;\n value?: number;\n tax?: number;\n shipping?: number;\n coupon?: string;\n paymentType?: string;\n shippingTier?: string;\n creativeName?: string;\n creativeSlot?: string;\n locationId?: string;\n promotionId?: string;\n promotionName?: string;\n items?: GenericContent[];\n}\n\nexport interface GenericContent {\n [ key: string ]: any;\n content_type?: string;\n id?: string;\n name?: string;\n sku?: string;\n brand?: string;\n variant?: string;\n coupon?: string;\n currency?: string;\n discount?: number;\n index?: number;\n value?: number;\n price?: number;\n quantity?: number;\n url?: string;\n locationId?: string;\n imageUrl?: string;\n category?: string;\n category2?: string;\n category3?: string;\n category4?: string;\n category5?: string;\n}\n\n\nexport const Currencies: string[] = [ 'AED', 'ARS', 'AUD', 'BDT', 'BIF', 'BOB', 'BRL', 'CAD', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CZK', 'DKK', 'DZD', 'EGP', 'EUR', 'GBP', 'GTQ', 'HKD', 'HNL', 'HUF', 'IDR', 'ILS', 'INR', 'ISK', 'JPY', 'KES', 'KRW', 'KWD', 'KZT', 'MAD', 'MOP', 'MXN', 'MYR', 'NGN', 'NIO', 'NOK', 'NZD', 'PEN', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RUB', 'SAR', 'SEK', 'SGD', 'THB', 'TRY', 'TWD', 'USD', 'VES', 'VND', 'ZAR' ];\n\n", "import { SubscriptionPlan, PLAN_BILLING_FREQUENCY } from '@adtrackify/at-tracking-event-types';\n\nexport const StripeBillingMap: any = {\n dev2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa2: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod2: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n },\n dev: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n qa: {\n 'free': 'price_1JzjbKK7krGh4037ezNbGJEm',\n 'starter_monthly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'starter_yearly': 'price_1JwzsGK7krGh4037Li0hPpsZ',\n 'scale_monthly': 'price_1JzjcSK7krGh4037yh34LPk3',\n 'scale_yearly': 'price_1JzjcSK7krGh4037QiBJYfnD',\n 'growth_monthly': 'price_1Jzje1K7krGh4037KErHBp5N',\n 'growth_yearly': 'price_1Jzje1K7krGh4037MhCUhTDh'\n },\n prod: {\n 'free': 'price_1KAFsIK7krGh4037RsaAYMEl',\n 'starter_monthly': 'price_1KAFsMK7krGh4037Lz3P0ksU',\n 'starter_yearly': 'price_1KAFsMK7krGh4037Dj1WmSi8',\n 'scale_monthly': 'price_1KAFrxK7krGh4037zWCdaTly',\n 'scale_yearly': 'price_1KAFrxK7krGh40375fhymyWP',\n 'growth_monthly': 'price_1KAFs7K7krGh4037JChjz5Cr',\n 'growth_yearly': 'price_1KAFs7K7krGh4037rZElg12s'\n }\n};\n\nexport const CommonPlanInfo = [\n //'60-day Risk Free Trial',\n 'Free Server Side Tracking & Conversion API',\n 'MultiPixel Support (Multiple facebook, tiktok, etc)',\n 'Corrects Facebook Conversion Tracking post IOS14',\n 'Increase ROAS & Attribution Data',\n 'Enhanced Fingerprinting & Identity Resolution',\n 'Unlimited Integrations',\n 'Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)'\n];\n\nexport const SubscriptionPlanSeedItems: {\n items: SubscriptionPlan[];\n} = {\n items: [ {\n id: 1,\n planName: 'free',\n displayName: 'Free',\n sku: 'ADT-001',\n description: 'Free Plan - Monthly',\n price: '0',\n displayPrice: '$0',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 0,\n trialRequiresCreditCard: false,\n planDesc: [\n ...CommonPlanInfo,\n 'Free Up to 500 orders/month (50,000 events)*'\n ],\n unitPriceText: 'try now - free forever',\n isHighlighted: false,\n isBanner: false\n },\n // STARTER PLANS\n {\n id: 2,\n planName: 'starter_monthly',\n displayName: 'Starter',\n sku: 'ADT-002',\n description: 'Starter Plan - Monthly',\n price: '79.99',\n displayPrice: '$79.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n }, {\n id: 3,\n planName: 'starter_yearly',\n displayName: 'Starter',\n sku: 'ADT-003',\n description: 'Starter Plan - Yearly',\n price: '767.90',\n displayPrice: '$63.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 30,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 2,000 orders/month (250,000 events)*'\n ],\n unitPriceText: 'billed yearly ($767.90) - 20% savings',\n isHighlighted: true,\n isBanner: true,\n bannerColor: 'blue',\n bannerText: 'MOST POPULAR'\n },\n // SCALE PLANS\n {\n id: 4,\n planName: 'scale_monthly',\n displayName: 'Scale',\n sku: 'ADT-004',\n description: 'Scale Plan - Monthly',\n price: '199.99',\n displayPrice: '$199.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: '',\n isHighlighted: false,\n isBanner: false\n }, {\n id: 5,\n planName: 'scale_yearly',\n displayName: 'Scale',\n sku: 'ADT-005',\n description: 'Scale Plan - Yearly',\n price: '1823.91',\n displayPrice: '$151.99',\n billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n trialLengthDays: 60,\n trialRequiresCreditCard: false,\n planDesc: [\n '60-day Risk Free Trial',\n ...CommonPlanInfo,\n 'Up to 7,500 orders/month (750,000 events)*'\n ],\n unitPriceText: 'billed yearly ($1823.91) - 24% savings',\n isHighlighted: false,\n isBanner: false\n },\n // // GROWTH PLANS\n // {\n // id: 6,\n // planName: 'growth_monthly',\n // displayName: 'Growth',\n // sku: 'ADT-006',\n // description: 'Growth Plan - Monthly',\n // price: '199.99',\n // displayPrice: '$199.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '60-day Risk Free Trial',\n // ...CommonPlanInfo,\n // '250,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($540) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // }, {\n // id: 7,\n // planName: 'growth_yearly',\n // displayName: 'Growth',\n // sku: 'ADT-007',\n // description: 'Growth Plan - Yearly',\n // price: '1799.91',\n // displayPrice: '$149.99',\n // billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,\n // trialLengthDays: 60,\n // trialRequiresCreditCard: false,\n // planDesc: [\n // '30-day Risk Free Trial',\n // 'Fixes IOS14.5 tracking',\n // 'Multi Pixel Support',\n // 'Enhanced Tracking / Attribution',\n // 'Unlimited Facebook Conversion API',\n // 'Unlimited Integrations',\n // 'Easy no code setup',\n // '100,000 tracking events/mo'\n // ],\n // unitPriceText: 'billed yearly ($1799.91) - 25% savings',\n // isHighlighted: false,\n // isBanner: true,\n // bannerColor: 'orange',\n // bannerText: 'BEST VALUE'\n // },\n ]\n};\n\n\nexport const getPlanDetails = (planId: number, stage: string) => {\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.id === planId)[ 0 ] as any;\n plan.stripePriceId = StripeBillingMap[ stage ][ plan.planName ];\n return plan as SubscriptionPlan;\n};\n\nexport const getPlanByStripePriceId = (stripePriceId: string, stage: string) => {\n const stripePriceIds = StripeBillingMap[ stage ];\n const planName = Object.keys(stripePriceIds).find(key => stripePriceIds[ key ] === stripePriceId);\n\n const plan = SubscriptionPlanSeedItems.items.filter(x => x.planName === planName)[ 0 ] as any;\n plan.stripePriceId = stripePriceId;\n\n return plan as SubscriptionPlan;\n};", "export enum ADTRACKIFY_EVENT_TYPES {\n NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED = 'shopifySubscriptionCreated',\n NOTIFY_SUBSCRIPTION_SIGNUP_COMPLETED = 'subscription.signupCompleted',\n REQUEST_SET_ACCOUNT_OWNER = 'setAccountOwner',\n REQUEST_SET_ACCOUNT_SUBSCRIPTION_ID = 'setAccountSubscriptionId',\n}\n\nexport enum ADTRACKIFY_EVENT_SOURCES {\n SUBSCRIPTIONS = 'subscriptions',\n}", "import { EventBridgeClient } from '../clients';\nimport { Message, TemplatedMessage } from 'postmark';\n\nexport const enum PostmarkRequestType {\n SINGLE_EMAIL = 'single_email',\n TEMPLATE_EMAIL = 'template_email'\n}\n\nexport enum ADTRACKIFY_EVENT_BRIDGE_EVENTS {\n SEND_POSTMARK_EMAIL = 'integration.sendPostmarkEmail',\n}\n\nexport class EventBridgeIntegrationService {\n public eventBridgeClient: EventBridgeClient;\n public EVENT_BUS_NAME: string;\n\n constructor (eventBusName: string) {\n this.eventBridgeClient = new EventBridgeClient(eventBusName);\n this.EVENT_BUS_NAME = eventBusName;\n }\n\n public sendPostmarkEmailEvent = async (eventSource: string, postmarkMessage: Message, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.SINGLE_EMAIL,\n postmarkServerToken\n });\n };\n\n public sendPostmarkTemplatedEmailEvent = async (eventSource: string, postmarkMessage: TemplatedMessage, postmarkServerToken: string) => {\n return await this.eventBridgeClient.buildAndSendEvent(\n eventSource,\n ADTRACKIFY_EVENT_BRIDGE_EVENTS.SEND_POSTMARK_EMAIL,\n {\n postmarkMessage,\n postmarkRequestType: PostmarkRequestType.TEMPLATE_EMAIL,\n postmarkServerToken\n });\n };\n\n}\n"],
5
+ "mappings": ";;;;;;;;AAAA,SAAS,sBAAmC;AAC5C,SAAS,wBAAwB;AACjC,YAAY,SAAS;AAErB,IAAM,kBAAkB;AAAA,EACtB,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,2BAA2B;AAC7B;AAEA,IAAM,oBAAoB;AAAA,EACxB,aAAa;AACf;AAEA,IAAM,kBAAkB,EAAE,iBAAiB,kBAAkB;AAC7D,IAAM,YAAY,IAAI,eAAe,CAAC,CAAC;AACvC,IAAM,SAAS,iBAAiB,KAAK,WAAW,eAAe;AAExD,IAAM,kBAAN,MAAqB;AA4G5B;AA5GO,IAAM,iBAAN;AACL,cADW,gBACJ,WAAU,OAAO,WAAmB,SAAiB,aAAkB;AAC5E,MAAI;AACF,UAAM,SAAS;AAAA,MACb,WAAW;AAAA,MACX,KAAK;AAAA,QACH,CAAE,UAAW;AAAA,MACf;AAAA,IACF;AACA,UAAM,MAAM,MAAM,OAAO,IAAI,MAAM;AACnC,WAAO,KAAK,QAAQ;AAAA,EACtB,SAAS,GAAP;AACA,IAAI,UAAM,GAAG,EAAE,SAAS,2BAA2B,CAAC;AACpD,WAAO;AAAA,EACT;AACF;AAEA,cAjBW,gBAiBJ,WAAU,OAAO,WAAmB,SAAc;AACvD,MAAI;AACF,UAAM,SAAS;AAAA,MACb,WAAW;AAAA,MACX,MAAM;AAAA,IACR;AACA,UAAM,MAAM,MAAM,OAAO,IAAI,MAAM;AACnC,WAAO;AAAA,EACT,SAAS,GAAP;AACA,IAAI,UAAM,GAAG,EAAE,SAAS,0BAA0B,CAAC;AACn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log", "error", "log", "client", "log", "client", "success", "log", "log", "a", "p", "HttpStatusCodes", "client", "log", "client", "log", "log", "client", "log", "error", "log", "debug", "error", "ACCOUNT_STATUS", "DESTINATIONS", "CustomHTMLLocation", "ShopifyAppInstallStatus", "ShopifyAppSubscriptionStatus", "PLAN_BILLING_FREQUENCY", "PAYMENT_STATUS", "SUBSCRIPTION_STATUS", "PAYMENT_GATEWAY", "ADTRACKIFY_STANDARD_EVENT", "stage", "x", "ADTRACKIFY_EVENT_TYPES", "ADTRACKIFY_EVENT_SOURCES", "PostmarkRequestType", "ADTRACKIFY_EVENT_BRIDGE_EVENTS"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtrackify/at-service-common",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",
@@ -1,3 +1,4 @@
1
1
  export * from './dynamodb-client';
2
2
  export * from './eventbridge-client';
3
3
  export * from './http-client';
4
+ export * from './s3-client';
@@ -1,7 +1,7 @@
1
1
  import { S3 } from '@aws-sdk/client-s3';
2
2
  import * as log from 'lambda-log';
3
3
 
4
- export default class S3Client {
4
+ export class S3Client {
5
5
  s3: S3;
6
6
 
7
7
  constructor(accessKeyId: string, secretAccessKey: string){