@adtrackify/at-service-common 1.1.17 → 1.1.19

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
@@ -2,22 +2,25 @@ declare module '@adtrackify/at-service-common/__tests__/helpers/subscription-hel
2
2
  export {};
3
3
 
4
4
  }
5
- declare module '@adtrackify/at-service-common/clients/generic/cognito-service' {
5
+ declare module '@adtrackify/at-service-common/clients/generic/cognito-client' {
6
6
  export function dictToAwsAttributes(input: any): {
7
7
  Name: string;
8
8
  Value: any;
9
9
  }[];
10
- export class CognitoService {
11
- static setCredentials: (userPoolId: string, userPoolNoSecretClientId: string) => void;
12
- static signupUser: (data: any) => Promise<import("@aws-sdk/client-cognito-identity-provider").SignUpCommandOutput>;
13
- static forgotPassword: (email: string) => Promise<import("@aws-sdk/client-cognito-identity-provider").ForgotPasswordCommandOutput>;
14
- static adminEmailVerify: (email: string) => Promise<void>;
15
- static forceValidateEmail: (email: string) => Promise<void>;
16
- static adminConfirmUser: (data: any) => Promise<import("@aws-sdk/client-cognito-identity-provider").AdminConfirmSignUpCommandOutput>;
17
- static confirmUser: (data: any) => Promise<import("@aws-sdk/client-cognito-identity-provider").ConfirmSignUpCommandOutput>;
18
- static resendCode: (email: string) => Promise<void>;
19
- static adminDeleteUser: (userId: string) => Promise<boolean>;
20
- static getUserByEmail: (email: string) => Promise<any>;
10
+ export class CognitoClient {
11
+ cognitoClient: any;
12
+ USER_POOL_ID: string;
13
+ USER_POOL_NO_SECRET_CLIENT_ID: string;
14
+ constructor(userPoolId: string, userPoolNoSecretClientId: string);
15
+ signupUser: (data: any) => Promise<any>;
16
+ forgotPassword: (email: string) => Promise<any>;
17
+ adminEmailVerify: (email: string) => Promise<void>;
18
+ forceValidateEmail: (email: string) => Promise<void>;
19
+ adminConfirmUser: (data: any) => Promise<any>;
20
+ confirmUser: (data: any) => Promise<any>;
21
+ resendCode: (email: string) => Promise<void>;
22
+ adminDeleteUser: (userId: string) => Promise<boolean>;
23
+ getUserByEmail: (email: string) => Promise<any>;
21
24
  }
22
25
 
23
26
  }
@@ -93,14 +96,15 @@ declare module '@adtrackify/at-service-common/clients/generic/index' {
93
96
  export * from '@adtrackify/at-service-common/clients/generic/eventbridge-client';
94
97
  export * from '@adtrackify/at-service-common/clients/generic/http-client';
95
98
  export * from '@adtrackify/at-service-common/clients/generic/s3-client';
99
+ export * from '@adtrackify/at-service-common/clients/generic/cognito-client';
96
100
 
97
101
  }
98
102
  declare module '@adtrackify/at-service-common/clients/generic/s3-client' {
99
- import { S3 } from '@aws-sdk/client-s3';
103
+ import { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';
100
104
  export class S3Client {
101
105
  s3: S3;
102
- constructor(accessKeyId: string, secretAccessKey: string);
103
- uploadJson(path: string, bucket: string, jsonData: any): Promise<unknown>;
106
+ constructor(region?: string);
107
+ uploadJson(path: string, bucket: string, jsonData: any, ACL?: ObjectCannedACL | string): Promise<unknown>;
104
108
  }
105
109
 
106
110
  }
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 = (error6) => {
204
- if (!error6?.response && !error6?.request)
205
- throw error6;
206
- return error6.response ? httpResponse(error6.response) : httpResponse({ status: 500, data: { error: error6.request } });
203
+ var handleAxiosError = (error7) => {
204
+ if (!error7?.response && !error7?.request)
205
+ throw error7;
206
+ return error7.response ? httpResponse(error7.response) : httpResponse({ status: 500, data: { error: error7.request } });
207
207
  };
208
208
  var axiosHttpService = (config = {}) => {
209
209
  config.adapter = httpAdapter;
@@ -222,36 +222,171 @@ var axiosHttpService = (config = {}) => {
222
222
  };
223
223
 
224
224
  // src/clients/generic/s3-client.ts
225
- import { S3 } from "@aws-sdk/client-s3";
225
+ import { ObjectCannedACL, S3 } from "@aws-sdk/client-s3";
226
226
  import * as log3 from "lambda-log";
227
227
  var S3Client = class {
228
228
  s3;
229
- constructor(accessKeyId, secretAccessKey) {
230
- this.s3 = new S3({
231
- credentials: {
232
- accessKeyId,
233
- secretAccessKey
234
- }
235
- });
229
+ constructor(region = "us-west-2") {
230
+ this.s3 = new S3({ region });
236
231
  }
237
- async uploadJson(path, bucket, jsonData) {
232
+ async uploadJson(path, bucket, jsonData, ACL = ObjectCannedACL.private) {
238
233
  try {
239
234
  const res = await this.s3.putObject({
235
+ ACL,
240
236
  Bucket: bucket,
241
237
  ContentType: "application/json; charset=utf-8",
242
238
  Body: JSON.stringify(jsonData),
243
239
  Key: path
244
240
  });
245
241
  return res;
246
- } catch (error6) {
247
- log3.error("Error in s3 upload json", { error: error6 });
248
- return error6;
242
+ } catch (error7) {
243
+ log3.error("Error in s3 upload json", { error: error7 });
244
+ return error7;
249
245
  }
250
246
  }
251
247
  };
252
248
 
253
- // src/clients/internal-api/destinations-client.ts
249
+ // src/clients/generic/cognito-client.ts
250
+ import { CognitoIdentityProvider } from "@aws-sdk/client-cognito-identity-provider";
254
251
  import * as log4 from "lambda-log";
252
+ function dictToAwsAttributes(input) {
253
+ delete input.email;
254
+ delete input.password;
255
+ const output = [];
256
+ for (const att in input) {
257
+ if (Object.prototype.hasOwnProperty.call(input, att)) {
258
+ output.push({ Name: att, Value: input[att] });
259
+ }
260
+ }
261
+ return output;
262
+ }
263
+ var buildAttributes = (data) => {
264
+ const attributes = {
265
+ name: data.givenName,
266
+ family_name: data.familyName
267
+ };
268
+ return dictToAwsAttributes(attributes);
269
+ };
270
+ var CognitoClient = class {
271
+ cognitoClient;
272
+ USER_POOL_ID;
273
+ USER_POOL_NO_SECRET_CLIENT_ID;
274
+ constructor(userPoolId, userPoolNoSecretClientId) {
275
+ this.cognitoClient = new CognitoIdentityProvider({});
276
+ this.USER_POOL_ID = userPoolId;
277
+ this.USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId;
278
+ }
279
+ signupUser = async (data) => {
280
+ const params = {
281
+ ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
282
+ Password: data.password,
283
+ Username: data.email,
284
+ UserAttributes: buildAttributes(data)
285
+ };
286
+ const cognitoResponse = await this.cognitoClient.signUp(params);
287
+ log4.debug("Successfully Registered User", { cognitoResponse });
288
+ return cognitoResponse;
289
+ };
290
+ forgotPassword = async (email) => {
291
+ await this.adminEmailVerify(email);
292
+ const params = {
293
+ ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
294
+ Username: email
295
+ };
296
+ const cognitoResponse = await this.cognitoClient.forgotPassword(params);
297
+ log4.debug("Sent Forgot Password", { cognitoResponse });
298
+ return cognitoResponse;
299
+ };
300
+ adminEmailVerify = async (email) => {
301
+ try {
302
+ const user = await this.getUserByEmail(email);
303
+ if (user && user?.UserStatus === "CONFIRMED" && user?.email_verified !== "true") {
304
+ await this.forceValidateEmail(email);
305
+ }
306
+ } catch (error7) {
307
+ log4.error("Failed admin email verify", { error: error7 });
308
+ }
309
+ };
310
+ forceValidateEmail = async (email) => {
311
+ try {
312
+ const params = {
313
+ UserPoolId: this.USER_POOL_ID,
314
+ Username: email,
315
+ UserAttributes: [
316
+ {
317
+ Name: "email_verified",
318
+ Value: "true"
319
+ }
320
+ ]
321
+ };
322
+ await this.cognitoClient.adminUpdateUserAttributes(params);
323
+ } catch (error7) {
324
+ log4.error("Failed force validate email", { email, error: error7 });
325
+ }
326
+ };
327
+ adminConfirmUser = async (data) => {
328
+ const params = {
329
+ UserPoolId: this.USER_POOL_ID,
330
+ Username: data.email
331
+ };
332
+ const cognitoResponse = await this.cognitoClient.adminConfirmSignUp(params);
333
+ await this.forceValidateEmail(data.email);
334
+ log4.debug("Admin Successfully Confirmed User", { cognitoResponse });
335
+ return cognitoResponse;
336
+ };
337
+ confirmUser = async (data) => {
338
+ const params = {
339
+ ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
340
+ ConfirmationCode: data.confirmationCode,
341
+ Username: data.email
342
+ };
343
+ const cognitoResponse = await this.cognitoClient.confirmSignUp(params);
344
+ log4.debug("Successfully Confirmed User", { cognitoResponse });
345
+ return cognitoResponse;
346
+ };
347
+ resendCode = async (email) => {
348
+ const params = {
349
+ ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
350
+ Username: email
351
+ };
352
+ await this.cognitoClient.resendConfirmationCode(params);
353
+ log4.debug("Successfully Resend Confirmation Code", { email });
354
+ return;
355
+ };
356
+ adminDeleteUser = async (userId) => {
357
+ const params = {
358
+ UserPoolId: this.USER_POOL_ID,
359
+ Username: userId
360
+ };
361
+ await this.cognitoClient.adminDeleteUser(params);
362
+ return true;
363
+ };
364
+ getUserByEmail = async (email) => {
365
+ const params = {
366
+ UserPoolId: this.USER_POOL_ID,
367
+ Filter: `email="${email}"`,
368
+ Limit: 1
369
+ };
370
+ const cognitoResponse = await this.cognitoClient.listUsers(params);
371
+ log4.debug("Get Users by Email", { cognitoResponse });
372
+ if (cognitoResponse?.Users && cognitoResponse?.Users.length > 0) {
373
+ const attributes = cognitoResponse.Users[0].Attributes;
374
+ const user = {
375
+ ...cognitoResponse.Users[0],
376
+ Attributes: void 0,
377
+ id: cognitoResponse.Users[0].sub
378
+ };
379
+ attributes.forEach((attr) => {
380
+ user[attr.Name] = attr?.Value;
381
+ });
382
+ return user;
383
+ }
384
+ return null;
385
+ };
386
+ };
387
+
388
+ // src/clients/internal-api/destinations-client.ts
389
+ import * as log5 from "lambda-log";
255
390
  var DestinationsClient = class {
256
391
  BASE_API_URL;
257
392
  DESTINATIONS_API_KEY;
@@ -276,19 +411,19 @@ var DestinationsClient = class {
276
411
  createDestination = async (createDestinationRequest) => {
277
412
  const client2 = await this.getClient();
278
413
  const response = await client2.post("/", createDestinationRequest);
279
- log4.info("createDestinationResponse", { response });
414
+ log5.info("createDestinationResponse", { response });
280
415
  return response;
281
416
  };
282
417
  getPixelDestinations = async (pixelId) => {
283
418
  const client2 = await this.getClient();
284
419
  const response = await client2.get(`/?pixelId=${pixelId}`);
285
- log4.info("getPixelResponse", { response });
420
+ log5.info("getPixelResponse", { response });
286
421
  return response;
287
422
  };
288
423
  };
289
424
 
290
425
  // src/clients/internal-api/accounts-client.ts
291
- import * as log5 from "lambda-log";
426
+ import * as log6 from "lambda-log";
292
427
  var AccountsClient = class {
293
428
  BASE_API_URL;
294
429
  ACCOUNTS_API_KEY;
@@ -316,19 +451,19 @@ var AccountsClient = class {
316
451
  createAccount = async (createAccountRequest) => {
317
452
  const client2 = await this.getClient();
318
453
  const createAccountResponse = await client2.post("", createAccountRequest);
319
- log5.info("createAccountResponse", { createAccountResponse });
454
+ log6.info("createAccountResponse", { createAccountResponse });
320
455
  return createAccountResponse;
321
456
  };
322
457
  updateAccount = async (accountId, body) => {
323
458
  const client2 = await this.getClient();
324
459
  const response = await client2.patch(`/${accountId}/`, body);
325
- log5.info("update Account response", { response });
460
+ log6.info("update Account response", { response });
326
461
  return response;
327
462
  };
328
463
  addOwner = async (accountId, userId) => {
329
464
  const client2 = await this.getClient();
330
465
  const addOwnerResponse = await client2.post("/addOwner", { accountId, userId });
331
- log5.info("addOwnerResponse", { addOwnerResponse });
466
+ log6.info("addOwnerResponse", { addOwnerResponse });
332
467
  return addOwnerResponse;
333
468
  };
334
469
  isAuthorizedUser = async (userId, accountId, pixelId) => {
@@ -339,41 +474,41 @@ var AccountsClient = class {
339
474
  pixelId
340
475
  };
341
476
  const response = await client2.post("/checkUserAuthorization", body);
342
- log5.info("checkUserAuthorization", { response });
477
+ log6.info("checkUserAuthorization", { response });
343
478
  return response;
344
479
  };
345
480
  adminDeleteAccount = async (accountId) => {
346
481
  const client2 = await this.getClient();
347
482
  const success2 = await client2.delete(`/${accountId}`);
348
- log5.info("adminDeleteAccount");
483
+ log6.info("adminDeleteAccount");
349
484
  return success2;
350
485
  };
351
486
  getPixelConfigById = async (pixelId) => {
352
487
  const client2 = await this.getClient();
353
488
  const pixelResponse = await client2.get(`/px/${pixelId}/config`);
354
- log5.debug("get pixelResponse", { pixelResponse });
489
+ log6.debug("get pixelResponse", { pixelResponse });
355
490
  return pixelResponse;
356
491
  };
357
492
  getAccount = async (accountId) => {
358
493
  const client2 = await this.getClient();
359
494
  const response = await client2.get(`/${accountId}/`);
360
- log5.info("get account response", { response });
495
+ log6.info("get account response", { response });
361
496
  return response;
362
497
  };
363
498
  addUserToAccount = async (accountId, userId) => {
364
499
  const client2 = await this.getClient();
365
500
  const response = await client2.post("/addUser", { accountId, userId });
366
- log5.info("add user account response", { response });
501
+ log6.info("add user account response", { response });
367
502
  return response;
368
503
  };
369
504
  };
370
505
 
371
506
  // src/clients/internal-api/users-auth-client.ts
372
- import * as log7 from "lambda-log";
507
+ import * as log8 from "lambda-log";
373
508
 
374
509
  // src/helpers/shopify-helper.ts
375
510
  import { createHmac } from "crypto";
376
- import * as log6 from "lambda-log";
511
+ import * as log7 from "lambda-log";
377
512
 
378
513
  // src/libs/url.ts
379
514
  var mapObjectToQueryString = (inputObj) => {
@@ -394,14 +529,14 @@ var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecr
394
529
  return generatedHash === validationHmac;
395
530
  };
396
531
  var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
397
- log6.info("Validating shopify request is authentic", { validationParams });
532
+ log7.info("Validating shopify request is authentic", { validationParams });
398
533
  const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
399
534
  if (!isValid) {
400
535
  const message = "Failed: Shopify Request hmac validation";
401
- log6.error(message);
536
+ log7.error(message);
402
537
  throw HttpError.badRequest(message);
403
538
  }
404
- log6.info("Sucess: Shopify Request hmac validation");
539
+ log7.info("Sucess: Shopify Request hmac validation");
405
540
  return true;
406
541
  };
407
542
 
@@ -571,19 +706,19 @@ var UsersAuthClient = class {
571
706
  return user;
572
707
  };
573
708
  signupUser = async (userSignupRequest) => {
574
- log7.info("Attempting to signup user", { email: userSignupRequest.email });
709
+ log8.info("Attempting to signup user", { email: userSignupRequest.email });
575
710
  const client2 = await this.getClient();
576
711
  const response = await client2.post("/signup", userSignupRequest);
577
712
  if (response.status !== 200 || !response?.data?.user) {
578
713
  const message = "User Signup Failed";
579
- log7.error(message, { response });
714
+ log8.error(message, { response });
580
715
  throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
581
716
  }
582
- log7.info("User Signup Successful", { response });
717
+ log8.info("User Signup Successful", { response });
583
718
  return response.data.user;
584
719
  };
585
720
  adminConfirmUser = async (email) => {
586
- log7.info("Attempting to admin confirm user", { email });
721
+ log8.info("Attempting to admin confirm user", { email });
587
722
  const client2 = await this.getClient();
588
723
  const response = await client2.post(
589
724
  "/admin/confirm",
@@ -598,10 +733,10 @@ var UsersAuthClient = class {
598
733
  );
599
734
  if (response.status !== 200) {
600
735
  const message = "Admin User Confirmation Failed";
601
- log7.error(message, { response });
736
+ log8.error(message, { response });
602
737
  throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
603
738
  }
604
- log7.info("Admin User Confirmation Successful", { response });
739
+ log8.info("Admin User Confirmation Successful", { response });
605
740
  return response;
606
741
  };
607
742
  getUserByEmail = async (email) => {
@@ -614,13 +749,13 @@ var UsersAuthClient = class {
614
749
  email
615
750
  }
616
751
  });
617
- log7.info("getUserResponse", { getUserResponse });
752
+ log8.info("getUserResponse", { getUserResponse });
618
753
  return getUserResponse;
619
754
  };
620
755
  };
621
756
 
622
757
  // src/clients/internal-api/shopify-app-install-client.ts
623
- import log8 from "lambda-log";
758
+ import log9 from "lambda-log";
624
759
  var ShopifyAppInstallClient = class {
625
760
  BASE_API_URL;
626
761
  SHOPIFY_APP_INSTALL_API_KEY;
@@ -645,25 +780,25 @@ var ShopifyAppInstallClient = class {
645
780
  updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
646
781
  const client2 = await this.getClient();
647
782
  const response = await client2.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
648
- log8.info("updateShopifyAppInstall", { response });
783
+ log9.info("updateShopifyAppInstall", { response });
649
784
  return response;
650
785
  };
651
786
  getShopifyAppInstall = async (shopifyAppInstallId) => {
652
787
  const client2 = await this.getClient();
653
788
  const response = await client2.get(`/${shopifyAppInstallId}`);
654
- log8.info("getShopifyAppInstall", { response });
789
+ log9.info("getShopifyAppInstall", { response });
655
790
  return response;
656
791
  };
657
792
  getShopifyAppInstallByShop = async (shop) => {
658
793
  const client2 = await this.getClient();
659
794
  const response = await client2.get(`/?shop=${shop}`);
660
- log8.info("getShopifyAppInstallByShop", { response });
795
+ log9.info("getShopifyAppInstallByShop", { response });
661
796
  return response;
662
797
  };
663
798
  };
664
799
 
665
800
  // src/clients/third-party/shopify-client.ts
666
- import * as log9 from "lambda-log";
801
+ import * as log10 from "lambda-log";
667
802
  var _ShopifyClient = class {
668
803
  };
669
804
  var ShopifyClient = _ShopifyClient;
@@ -707,9 +842,9 @@ __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, e
707
842
  };
708
843
  const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
709
844
  if (res.status >= 400) {
710
- log9.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
845
+ log10.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
711
846
  }
712
- log9.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
847
+ log10.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
713
848
  return res;
714
849
  });
715
850
  __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
@@ -724,7 +859,7 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
724
859
  };
725
860
  const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload);
726
861
  if (res.status >= 400) {
727
- log9.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
862
+ log10.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
728
863
  }
729
864
  return res;
730
865
  });
@@ -732,7 +867,7 @@ __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessTok
732
867
  const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/shop.json`;
733
868
  const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
734
869
  if (res.status >= 400) {
735
- log9.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
870
+ log10.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
736
871
  }
737
872
  return res;
738
873
  });
@@ -747,7 +882,7 @@ __publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken,
747
882
  };
748
883
  const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
749
884
  if (res.status >= 400) {
750
- log9.error("Failed to create App Subscription", { shop, accessToken, url });
885
+ log10.error("Failed to create App Subscription", { shop, accessToken, url });
751
886
  }
752
887
  return res;
753
888
  });
@@ -756,7 +891,7 @@ __publicField(ShopifyClient, "cancelAppSubscription", async (shop, accessToken,
756
891
  const client2 = axiosHttpService();
757
892
  const res = await client2.delete(url, { headers: { "X-Shopify-Access-Token": accessToken } });
758
893
  if (res.status !== 200) {
759
- log9.error("Failed to cancel recurring App billing", { shop, accessToken, url });
894
+ log10.error("Failed to cancel recurring App billing", { shop, accessToken, url });
760
895
  }
761
896
  return res;
762
897
  });
@@ -764,57 +899,57 @@ __publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) =
764
899
  const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
765
900
  const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
766
901
  if (res.status >= 400) {
767
- log9.error("Failed to get App Subscriptions", { shop, accessToken, url });
902
+ log10.error("Failed to get App Subscriptions", { shop, accessToken, url });
768
903
  }
769
904
  return res;
770
905
  });
771
906
  __publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload) => {
772
907
  const client2 = axiosHttpService();
773
908
  const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken, "Content-Type": "application/json" } });
774
- log9.debug("Shopify Client Response", { res });
909
+ log10.debug("Shopify Client Response", { res });
775
910
  return res;
776
911
  });
777
912
  __publicField(ShopifyClient, "genericShopifyGet", async (url, accessToken) => {
778
913
  const client2 = axiosHttpService();
779
914
  const res = await client2.get(url, { headers: { "X-Shopify-Access-Token": accessToken } });
780
- log9.debug("Shopify Client Response", { res });
915
+ log10.debug("Shopify Client Response", { res });
781
916
  return res;
782
917
  });
783
918
  __publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, payload) => {
784
919
  const client2 = axiosHttpService();
785
920
  const res = await client2.put(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
786
- log9.debug("Shopify Client Response", { res });
921
+ log10.debug("Shopify Client Response", { res });
787
922
  return res;
788
923
  });
789
924
 
790
925
  // src/helpers/input-validation-helper.ts
791
- import * as log10 from "lambda-log";
926
+ import * as log11 from "lambda-log";
792
927
  var validateInput = (schema, input) => {
793
- const { error: error6, value } = schema.validate(input);
794
- if (error6) {
795
- log10.info("", { error: error6 });
928
+ const { error: error7, value } = schema.validate(input);
929
+ if (error7) {
930
+ log11.info("", { error: error7 });
796
931
  const httperr = HttpError.badRequest("Bad Request", {
797
- errors: error6.details.map((detail) => ({
932
+ errors: error7.details.map((detail) => ({
798
933
  message: detail?.message,
799
934
  key: detail?.context?.key,
800
935
  path: detail?.path
801
936
  }))
802
937
  });
803
- log10.info("", { httperr });
938
+ log11.info("", { httperr });
804
939
  throw httperr;
805
940
  }
806
941
  return value;
807
942
  };
808
943
 
809
944
  // src/helpers/logging-helper.ts
810
- import * as log11 from "lambda-log";
945
+ import * as log12 from "lambda-log";
811
946
  var stage = process?.env?.STAGE;
812
- var configureLogger = (event, context, debug4 = true) => {
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;
947
+ var configureLogger = (event, context, debug5 = true) => {
948
+ log12.options.meta.stage = stage;
949
+ log12.options.meta.source_name = context?.functionName || "unknown";
950
+ log12.options.meta.awsRequestId = context?.awsRequestId || "unknown";
951
+ log12.options.meta.lambdaEvent = event;
952
+ log12.options.debug = debug5;
818
953
  };
819
954
 
820
955
  // src/helpers/response-helper.ts
@@ -824,13 +959,13 @@ var success = (body) => {
824
959
  var defaultError = {
825
960
  message: "internalServerError"
826
961
  };
827
- var failure = (error6, statusCode = 500) => {
828
- statusCode = error6?.statusCode ?? statusCode;
962
+ var failure = (error7, statusCode = 500) => {
963
+ statusCode = error7?.statusCode ?? statusCode;
829
964
  let body = defaultError;
830
- if (error6?.body) {
831
- body = error6.body;
832
- } else if (error6?.message) {
833
- body = { message: error6.message };
965
+ if (error7?.body) {
966
+ body = error7.body;
967
+ } else if (error7?.message) {
968
+ body = { message: error7.message };
834
969
  } else if (statusCode === 500) {
835
970
  body = defaultError;
836
971
  }
@@ -1107,6 +1242,7 @@ export {
1107
1242
  ADTRACKIFY_EVENT_SOURCES,
1108
1243
  ADTRACKIFY_EVENT_TYPES,
1109
1244
  AccountsClient,
1245
+ CognitoClient,
1110
1246
  CommonPlanInfo,
1111
1247
  DestinationsClient,
1112
1248
  DynamoDbClient,
@@ -1124,6 +1260,7 @@ export {
1124
1260
  axiosHttpService,
1125
1261
  buildResponse,
1126
1262
  configureLogger,
1263
+ dictToAwsAttributes,
1127
1264
  failure,
1128
1265
  generatePublicKey,
1129
1266
  getCurrentDate,