@adtrackify/at-service-common 1.2.25 → 1.2.26

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.
Files changed (74) hide show
  1. package/dist/__tests__/helpers/subscription-helper.spec.d.ts +1 -1
  2. package/dist/__tests__/helpers/subscription-helper.spec.js +27 -27
  3. package/dist/clients/generic/cognito-client.d.ts +19 -19
  4. package/dist/clients/generic/cognito-client.js +139 -139
  5. package/dist/clients/generic/dynamodb-client.d.ts +15 -15
  6. package/dist/clients/generic/dynamodb-client.js +122 -122
  7. package/dist/clients/generic/eventbridge-client.d.ts +14 -14
  8. package/dist/clients/generic/eventbridge-client.js +45 -45
  9. package/dist/clients/generic/http-client.d.ts +30 -30
  10. package/dist/clients/generic/http-client.js +28 -28
  11. package/dist/clients/generic/index.d.ts +6 -6
  12. package/dist/clients/generic/index.js +6 -6
  13. package/dist/clients/generic/s3-client.d.ts +9 -9
  14. package/dist/clients/generic/s3-client.js +29 -29
  15. package/dist/clients/generic/s3-client.js.map +1 -1
  16. package/dist/clients/generic/sqs-client.d.ts +14 -14
  17. package/dist/clients/generic/sqs-client.js +34 -34
  18. package/dist/clients/index.d.ts +3 -3
  19. package/dist/clients/index.js +3 -3
  20. package/dist/clients/internal-api/accounts-client.d.ts +82 -82
  21. package/dist/clients/internal-api/accounts-client.js +78 -78
  22. package/dist/clients/internal-api/destinations-client.d.ts +54 -54
  23. package/dist/clients/internal-api/destinations-client.js +36 -36
  24. package/dist/clients/internal-api/index.d.ts +4 -4
  25. package/dist/clients/internal-api/index.js +4 -4
  26. package/dist/clients/internal-api/shopify-app-install-client.d.ts +57 -57
  27. package/dist/clients/internal-api/shopify-app-install-client.js +42 -42
  28. package/dist/clients/internal-api/users-auth-client.d.ts +61 -61
  29. package/dist/clients/internal-api/users-auth-client.js +73 -73
  30. package/dist/clients/third-party/index.d.ts +1 -1
  31. package/dist/clients/third-party/index.js +1 -1
  32. package/dist/clients/third-party/shopify-client.d.ts +90 -90
  33. package/dist/clients/third-party/shopify-client.js +121 -121
  34. package/dist/helpers/index.d.ts +5 -5
  35. package/dist/helpers/index.js +5 -5
  36. package/dist/helpers/input-validation-helper.d.ts +2 -2
  37. package/dist/helpers/input-validation-helper.js +18 -18
  38. package/dist/helpers/logging-helper.d.ts +15 -15
  39. package/dist/helpers/logging-helper.js +53 -53
  40. package/dist/helpers/response-helper.d.ts +36 -36
  41. package/dist/helpers/response-helper.js +35 -35
  42. package/dist/helpers/shopify-helper.d.ts +9 -9
  43. package/dist/helpers/shopify-helper.js +23 -23
  44. package/dist/helpers/subscription-helper.d.ts +8 -8
  45. package/dist/helpers/subscription-helper.js +181 -181
  46. package/dist/index.d.ts +5 -5
  47. package/dist/index.esm.js +2 -2
  48. package/dist/index.esm.js.map +2 -2
  49. package/dist/index.js +5 -5
  50. package/dist/libs/crypto.d.ts +1 -1
  51. package/dist/libs/crypto.js +5 -5
  52. package/dist/libs/dates.d.ts +3 -3
  53. package/dist/libs/dates.js +10 -10
  54. package/dist/libs/http-error.d.ts +21 -21
  55. package/dist/libs/http-error.js +55 -55
  56. package/dist/libs/http-status-codes.d.ts +58 -58
  57. package/dist/libs/http-status-codes.js +59 -59
  58. package/dist/libs/index.d.ts +6 -6
  59. package/dist/libs/index.js +6 -6
  60. package/dist/libs/url.d.ts +1 -1
  61. package/dist/libs/url.js +9 -9
  62. package/dist/services/eventbridge-integration-service.d.ts +9 -9
  63. package/dist/services/eventbridge-integration-service.js +24 -24
  64. package/dist/services/index.d.ts +1 -1
  65. package/dist/services/index.js +1 -1
  66. package/dist/types/api-response.d.ts +6 -6
  67. package/dist/types/api-response.js +1 -1
  68. package/dist/types/index.d.ts +1 -1
  69. package/dist/types/index.js +1 -1
  70. package/dist/types/internal-events/event-detail-types.d.ts +20 -20
  71. package/dist/types/internal-events/event-detail-types.js +24 -24
  72. package/dist/types/internal-events/index.d.ts +1 -1
  73. package/dist/types/internal-events/index.js +1 -1
  74. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- import { EventBridgeClient as EventBridge } from '@aws-sdk/client-eventbridge';
2
- export declare class EventBridgeClient {
3
- eventBridge: EventBridge;
4
- EVENT_BUS_NAME: string;
5
- constructor(eventBusName: string);
6
- buildAndSendEvent: (eventSource: string, eventType: string, eventData: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
7
- buildEvent: (eventType: string, eventData: any, eventId?: string, eventTime?: string) => {
8
- eventId: string;
9
- eventType: string;
10
- eventTime: string;
11
- eventData: any;
12
- };
13
- putEvent: (source: string, detailType: string, data: any, headers?: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
14
- }
1
+ import { EventBridgeClient as EventBridge } from '@aws-sdk/client-eventbridge';
2
+ export declare class EventBridgeClient {
3
+ eventBridge: EventBridge;
4
+ EVENT_BUS_NAME: string;
5
+ constructor(eventBusName: string);
6
+ buildAndSendEvent: (eventSource: string, eventType: string, eventData: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
7
+ buildEvent: (eventType: string, eventData: any, eventId?: string, eventTime?: string) => {
8
+ eventId: string;
9
+ eventType: string;
10
+ eventTime: string;
11
+ eventData: any;
12
+ };
13
+ putEvent: (source: string, detailType: string, data: any, headers?: any) => Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
14
+ }
@@ -1,46 +1,46 @@
1
- import { EventBridgeClient as EventBridge, PutEventsCommand } from '@aws-sdk/client-eventbridge';
2
- import { v4 as uuidv4 } from 'uuid';
3
- import { getCurrentTimestamp } from '../../libs/dates.js';
4
- import { Logger } from '../../index.js';
5
- export class EventBridgeClient {
6
- eventBridge;
7
- EVENT_BUS_NAME;
8
- constructor(eventBusName) {
9
- this.eventBridge = new EventBridge({});
10
- this.EVENT_BUS_NAME = eventBusName;
11
- }
12
- buildAndSendEvent = async (eventSource, eventType, eventData) => {
13
- const event = this.buildEvent(eventType, eventData);
14
- return await this.putEvent(eventSource, eventType, event);
15
- };
16
- buildEvent = (eventType, eventData, eventId = uuidv4(), eventTime = getCurrentTimestamp()) => {
17
- return {
18
- eventId,
19
- eventType,
20
- eventTime,
21
- eventData
22
- };
23
- };
24
- putEvent = async (source, detailType, data, headers = null) => {
25
- const params = {
26
- Entries: [{
27
- Detail: JSON.stringify({ headers, data }),
28
- DetailType: detailType,
29
- EventBusName: this.EVENT_BUS_NAME,
30
- Source: source,
31
- Time: new Date(),
32
- }],
33
- };
34
- const putEventscommand = new PutEventsCommand(params);
35
- const response = await this.eventBridge.send(putEventscommand);
36
- Logger.debug('EventBus Event Published', {
37
- eventBusName: this.EVENT_BUS_NAME,
38
- eventSource: source,
39
- eventType: detailType,
40
- event: data,
41
- response
42
- });
43
- return response;
44
- };
45
- }
1
+ import { EventBridgeClient as EventBridge, PutEventsCommand } from '@aws-sdk/client-eventbridge';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { getCurrentTimestamp } from '../../libs/dates.js';
4
+ import { Logger } from '../../index.js';
5
+ export class EventBridgeClient {
6
+ eventBridge;
7
+ EVENT_BUS_NAME;
8
+ constructor(eventBusName) {
9
+ this.eventBridge = new EventBridge({});
10
+ this.EVENT_BUS_NAME = eventBusName;
11
+ }
12
+ buildAndSendEvent = async (eventSource, eventType, eventData) => {
13
+ const event = this.buildEvent(eventType, eventData);
14
+ return await this.putEvent(eventSource, eventType, event);
15
+ };
16
+ buildEvent = (eventType, eventData, eventId = uuidv4(), eventTime = getCurrentTimestamp()) => {
17
+ return {
18
+ eventId,
19
+ eventType,
20
+ eventTime,
21
+ eventData
22
+ };
23
+ };
24
+ putEvent = async (source, detailType, data, headers = null) => {
25
+ const params = {
26
+ Entries: [{
27
+ Detail: JSON.stringify({ headers, data }),
28
+ DetailType: detailType,
29
+ EventBusName: this.EVENT_BUS_NAME,
30
+ Source: source,
31
+ Time: new Date(),
32
+ }],
33
+ };
34
+ const putEventscommand = new PutEventsCommand(params);
35
+ const response = await this.eventBridge.send(putEventscommand);
36
+ Logger.debug('EventBus Event Published', {
37
+ eventBusName: this.EVENT_BUS_NAME,
38
+ eventSource: source,
39
+ eventType: detailType,
40
+ event: data,
41
+ response
42
+ });
43
+ return response;
44
+ };
45
+ }
46
46
  //# sourceMappingURL=eventbridge-client.js.map
@@ -1,30 +1,30 @@
1
- import { CreateAxiosDefaults } from 'axios';
2
- export declare const axiosHttpService: (config?: CreateAxiosDefaults) => {
3
- instance: () => import("axios").AxiosInstance;
4
- get: (url: string, config?: any) => Promise<{
5
- headers: any;
6
- data: any;
7
- status: any;
8
- }>;
9
- post: (url: string, data?: any, config?: any) => Promise<{
10
- headers: any;
11
- data: any;
12
- status: any;
13
- }>;
14
- delete: (url: string, config?: any) => Promise<{
15
- headers: any;
16
- data: any;
17
- status: any;
18
- }>;
19
- put: (url: string, data?: any, config?: any) => Promise<{
20
- headers: any;
21
- data: any;
22
- status: any;
23
- }>;
24
- patch: (url: string, data?: any, config?: any) => Promise<{
25
- headers: any;
26
- data: any;
27
- status: any;
28
- }>;
29
- setBaseUrl: (url: string) => boolean;
30
- };
1
+ import { CreateAxiosDefaults } from 'axios';
2
+ export declare const axiosHttpService: (config?: CreateAxiosDefaults) => {
3
+ instance: () => import("axios").AxiosInstance;
4
+ get: (url: string, config?: any) => Promise<{
5
+ headers: any;
6
+ data: any;
7
+ status: any;
8
+ }>;
9
+ post: (url: string, data?: any, config?: any) => Promise<{
10
+ headers: any;
11
+ data: any;
12
+ status: any;
13
+ }>;
14
+ delete: (url: string, config?: any) => Promise<{
15
+ headers: any;
16
+ data: any;
17
+ status: any;
18
+ }>;
19
+ put: (url: string, data?: any, config?: any) => Promise<{
20
+ headers: any;
21
+ data: any;
22
+ status: any;
23
+ }>;
24
+ patch: (url: string, data?: any, config?: any) => Promise<{
25
+ headers: any;
26
+ data: any;
27
+ status: any;
28
+ }>;
29
+ setBaseUrl: (url: string) => boolean;
30
+ };
@@ -1,29 +1,29 @@
1
- import axios from 'axios';
2
- import https from 'https';
3
- const httpResponse = (res = {}) => {
4
- return {
5
- headers: res?.headers || {},
6
- data: res?.data || {},
7
- status: res?.status || 0,
8
- };
9
- };
10
- const handleAxiosError = (error) => {
11
- if (!error?.response && !error?.request)
12
- throw error;
13
- return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });
14
- };
15
- export const axiosHttpService = (config = {}) => {
16
- config.adapter = 'http';
17
- config.httpsAgent = new https.Agent({ keepAlive: true });
18
- const axiosService = axios.create(config);
19
- return {
20
- instance: () => axiosService,
21
- get: (url, config) => axiosService.get(url, config).then(httpResponse, handleAxiosError),
22
- post: (url, data, config) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),
23
- delete: (url, config) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),
24
- put: (url, data, config) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),
25
- patch: (url, data, config) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),
26
- setBaseUrl: (url) => !!(axiosService.defaults.baseURL = url)
27
- };
28
- };
1
+ import axios from 'axios';
2
+ import https from 'https';
3
+ const httpResponse = (res = {}) => {
4
+ return {
5
+ headers: res?.headers || {},
6
+ data: res?.data || {},
7
+ status: res?.status || 0,
8
+ };
9
+ };
10
+ const handleAxiosError = (error) => {
11
+ if (!error?.response && !error?.request)
12
+ throw error;
13
+ return error.response ? httpResponse(error.response) : httpResponse({ status: 500, data: { error: error.request } });
14
+ };
15
+ export const axiosHttpService = (config = {}) => {
16
+ config.adapter = 'http';
17
+ config.httpsAgent = new https.Agent({ keepAlive: true });
18
+ const axiosService = axios.create(config);
19
+ return {
20
+ instance: () => axiosService,
21
+ get: (url, config) => axiosService.get(url, config).then(httpResponse, handleAxiosError),
22
+ post: (url, data, config) => axiosService.post(url, data, config).then(httpResponse, handleAxiosError),
23
+ delete: (url, config) => axiosService.delete(url, config).then(httpResponse, handleAxiosError),
24
+ put: (url, data, config) => axiosService.put(url, data, config).then(httpResponse, handleAxiosError),
25
+ patch: (url, data, config) => axiosService.patch(url, data, config).then(httpResponse, handleAxiosError),
26
+ setBaseUrl: (url) => !!(axiosService.defaults.baseURL = url)
27
+ };
28
+ };
29
29
  //# sourceMappingURL=http-client.js.map
@@ -1,6 +1,6 @@
1
- export * from './dynamodb-client.js';
2
- export * from './eventbridge-client.js';
3
- export * from './http-client.js';
4
- export * from './s3-client.js';
5
- export * from './cognito-client.js';
6
- export * from './sqs-client.js';
1
+ export * from './dynamodb-client.js';
2
+ export * from './eventbridge-client.js';
3
+ export * from './http-client.js';
4
+ export * from './s3-client.js';
5
+ export * from './cognito-client.js';
6
+ export * from './sqs-client.js';
@@ -1,7 +1,7 @@
1
- export * from './dynamodb-client.js';
2
- export * from './eventbridge-client.js';
3
- export * from './http-client.js';
4
- export * from './s3-client.js';
5
- export * from './cognito-client.js';
6
- export * from './sqs-client.js';
1
+ export * from './dynamodb-client.js';
2
+ export * from './eventbridge-client.js';
3
+ export * from './http-client.js';
4
+ export * from './s3-client.js';
5
+ export * from './cognito-client.js';
6
+ export * from './sqs-client.js';
7
7
  //# sourceMappingURL=index.js.map
@@ -1,9 +1,9 @@
1
- import { ObjectCannedACL, PutObjectCommandOutput, S3 } from '@aws-sdk/client-s3';
2
- export declare class S3Client {
3
- s3: S3;
4
- constructor(region?: string);
5
- uploadJson(path: string, bucket: string, jsonData: any, ACL?: ObjectCannedACL | string, retryCount?: number): Promise<{
6
- status: boolean;
7
- response: PutObjectCommandOutput;
8
- }>;
9
- }
1
+ import { ObjectCannedACL, PutObjectCommandOutput, S3 } from '@aws-sdk/client-s3';
2
+ export declare class S3Client {
3
+ s3: S3;
4
+ constructor(region?: string);
5
+ uploadJson(path: string, bucket: string, jsonData: any, ACL?: ObjectCannedACL | string, retryCount?: number): Promise<{
6
+ status: boolean;
7
+ response: PutObjectCommandOutput;
8
+ }>;
9
+ }
@@ -1,30 +1,30 @@
1
- import { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';
2
- import { Logger } from '../../index.js';
3
- export class S3Client {
4
- s3;
5
- constructor(region = 'us-west-2') {
6
- this.s3 = new S3({ region });
7
- }
8
- async uploadJson(path, bucket, jsonData, ACL = ObjectCannedACL.private, retryCount = 0) {
9
- try {
10
- const res = await this.s3.putObject({
11
- ACL,
12
- Bucket: bucket,
13
- ContentType: 'application/json; charset=utf-8',
14
- Body: JSON.stringify(jsonData),
15
- Key: path
16
- });
17
- return { status: true, response: res };
18
- }
19
- catch (error) {
20
- Logger.error('Error in s3 upload json', { error });
21
- if (retryCount <= 5) {
22
- retryCount++;
23
- Logger.error('retrying to uploadJson', { path, bucket, jsonData, ACL, retryCount });
24
- return await this.uploadJson(path, bucket, jsonData, ACL, retryCount);
25
- }
26
- return { status: false, response: jsonData };
27
- }
28
- }
29
- }
1
+ import { ObjectCannedACL, S3 } from '@aws-sdk/client-s3';
2
+ import { Logger } from '../../index.js';
3
+ export class S3Client {
4
+ s3;
5
+ constructor(region = 'us-west-2') {
6
+ this.s3 = new S3({ region });
7
+ }
8
+ async uploadJson(path, bucket, jsonData, ACL = ObjectCannedACL.private, retryCount = 0) {
9
+ try {
10
+ const res = await this.s3.putObject({
11
+ ACL,
12
+ Bucket: bucket,
13
+ ContentType: 'application/json; charset=utf-8',
14
+ Body: JSON.stringify(jsonData),
15
+ Key: path
16
+ });
17
+ return { status: true, response: res };
18
+ }
19
+ catch (error) {
20
+ Logger.error('Error in s3 upload json', { error });
21
+ if (retryCount > 0) {
22
+ retryCount--;
23
+ Logger.error('retrying to uploadJson', { path, bucket, jsonData, ACL, retryCount });
24
+ return await this.uploadJson(path, bucket, jsonData, ACL, retryCount);
25
+ }
26
+ return { status: false, response: jsonData };
27
+ }
28
+ }
29
+ }
30
30
  //# sourceMappingURL=s3-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"s3-client.js","sourceRoot":"","sources":["../../../src/clients/generic/s3-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA0B,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,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declare class SQSClient {
3
- sqs: SQS;
4
- queueUrl: string;
5
- constructor(region: string, accountId: string, queueName: string);
6
- buildAndSendMessage: (messageType: string, messageBody: any, deplaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
7
- buildMessage: (messageType: string, messageBody: any, messageId?: string, messageTime?: string) => {
8
- messageId: string;
9
- messageType: string;
10
- messageTime: string;
11
- messageBody: any;
12
- };
13
- sendMessage: (messageBody: any, delaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
14
- }
1
+ import { SQS } from '@aws-sdk/client-sqs';
2
+ export declare class SQSClient {
3
+ sqs: SQS;
4
+ queueUrl: string;
5
+ constructor(region: string, accountId: string, queueName: string);
6
+ buildAndSendMessage: (messageType: string, messageBody: any, deplaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
7
+ buildMessage: (messageType: string, messageBody: any, messageId?: string, messageTime?: string) => {
8
+ messageId: string;
9
+ messageType: string;
10
+ messageTime: string;
11
+ messageBody: any;
12
+ };
13
+ sendMessage: (messageBody: any, delaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
14
+ }
@@ -1,35 +1,35 @@
1
- import { SQS } from '@aws-sdk/client-sqs';
2
- import { v4 as uuidv4 } from 'uuid';
3
- import { getCurrentTimestamp } from '../../libs/dates.js';
4
- import { Logger } from '../../index.js';
5
- export class SQSClient {
6
- sqs;
7
- queueUrl;
8
- constructor(region, accountId, queueName) {
9
- this.sqs = new SQS({ region });
10
- this.queueUrl = `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`;
11
- }
12
- buildAndSendMessage = async (messageType, messageBody, deplaySeconds = 0) => {
13
- const message = this.buildMessage(messageType, messageBody);
14
- return await this.sendMessage(message, deplaySeconds);
15
- };
16
- buildMessage = (messageType, messageBody, messageId = uuidv4(), messageTime = getCurrentTimestamp()) => {
17
- return {
18
- messageId,
19
- messageType,
20
- messageTime,
21
- messageBody
22
- };
23
- };
24
- sendMessage = async (messageBody, delaySeconds = 0) => {
25
- const params = {
26
- QueueUrl: this.queueUrl,
27
- DelaySeconds: delaySeconds,
28
- MessageBody: JSON.stringify(messageBody)
29
- };
30
- const response = await this.sqs.sendMessage(params);
31
- Logger.debug('SQS Message Sent', { queueUrl: this.queueUrl, messageBody, delaySeconds, response });
32
- return response;
33
- };
34
- }
1
+ import { SQS } from '@aws-sdk/client-sqs';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { getCurrentTimestamp } from '../../libs/dates.js';
4
+ import { Logger } from '../../index.js';
5
+ export class SQSClient {
6
+ sqs;
7
+ queueUrl;
8
+ constructor(region, accountId, queueName) {
9
+ this.sqs = new SQS({ region });
10
+ this.queueUrl = `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`;
11
+ }
12
+ buildAndSendMessage = async (messageType, messageBody, deplaySeconds = 0) => {
13
+ const message = this.buildMessage(messageType, messageBody);
14
+ return await this.sendMessage(message, deplaySeconds);
15
+ };
16
+ buildMessage = (messageType, messageBody, messageId = uuidv4(), messageTime = getCurrentTimestamp()) => {
17
+ return {
18
+ messageId,
19
+ messageType,
20
+ messageTime,
21
+ messageBody
22
+ };
23
+ };
24
+ sendMessage = async (messageBody, delaySeconds = 0) => {
25
+ const params = {
26
+ QueueUrl: this.queueUrl,
27
+ DelaySeconds: delaySeconds,
28
+ MessageBody: JSON.stringify(messageBody)
29
+ };
30
+ const response = await this.sqs.sendMessage(params);
31
+ Logger.debug('SQS Message Sent', { queueUrl: this.queueUrl, messageBody, delaySeconds, response });
32
+ return response;
33
+ };
34
+ }
35
35
  //# sourceMappingURL=sqs-client.js.map
@@ -1,3 +1,3 @@
1
- export * from './generic/index.js';
2
- export * from './internal-api/index.js';
3
- export * from './third-party/index.js';
1
+ export * from './generic/index.js';
2
+ export * from './internal-api/index.js';
3
+ export * from './third-party/index.js';
@@ -1,4 +1,4 @@
1
- export * from './generic/index.js';
2
- export * from './internal-api/index.js';
3
- export * from './third-party/index.js';
1
+ export * from './generic/index.js';
2
+ export * from './internal-api/index.js';
3
+ export * from './third-party/index.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1,82 +1,82 @@
1
- import { ApiResponse } from '../../types/api-response.js';
2
- import { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';
3
- export interface AccountResponseData {
4
- account: Account;
5
- [key: string]: any;
6
- }
7
- export interface IsAuthorizedUserResponseData {
8
- isAccountUser: boolean;
9
- [key: string]: any;
10
- }
11
- export interface PixelConfigResponseData {
12
- id: string;
13
- destinations: Destination[];
14
- [key: string]: any;
15
- }
16
- export interface AddUserToAccountResponseData {
17
- userId: string;
18
- accountId: string;
19
- }
20
- export interface UpdateAccountRequest {
21
- accountName?: string;
22
- companyName?: string;
23
- primaryEmail?: string;
24
- ownerId?: string;
25
- subscriptionId?: string;
26
- accountStatus?: ACCOUNT_STATUS;
27
- }
28
- export declare class AccountsClient {
29
- BASE_API_URL: string;
30
- ACCOUNTS_API_KEY?: string;
31
- constructor(baseApiUrl: string, accountsApiKey?: string);
32
- getConfig: () => any;
33
- getClient: () => Promise<{
34
- instance: () => import("axios").AxiosInstance;
35
- get: (url: string, config?: any) => Promise<{
36
- headers: any;
37
- data: any;
38
- status: any;
39
- }>;
40
- post: (url: string, data?: any, config?: any) => Promise<{
41
- headers: any;
42
- data: any;
43
- status: any;
44
- }>;
45
- delete: (url: string, config?: any) => Promise<{
46
- headers: any;
47
- data: any;
48
- status: any;
49
- }>;
50
- put: (url: string, data?: any, config?: any) => Promise<{
51
- headers: any;
52
- data: any;
53
- status: any;
54
- }>;
55
- patch: (url: string, data?: any, config?: any) => Promise<{
56
- headers: any;
57
- data: any;
58
- status: any;
59
- }>;
60
- setBaseUrl: (url: string) => boolean;
61
- }>;
62
- createAccount: (createAccountRequest: any) => Promise<{
63
- headers: any;
64
- data: any;
65
- status: any;
66
- }>;
67
- updateAccount: (accountId: string, body: any) => Promise<ApiResponse<AccountResponseData>>;
68
- addOwner: (accountId: string, userId: string) => Promise<{
69
- headers: any;
70
- data: any;
71
- status: any;
72
- }>;
73
- isAuthorizedUser: (userId: string, accountId: string, pixelId?: string) => Promise<ApiResponse<IsAuthorizedUserResponseData>>;
74
- adminDeleteAccount: (accountId: string) => Promise<{
75
- headers: any;
76
- data: any;
77
- status: any;
78
- }>;
79
- getPixelConfigById: (pixelId: string) => Promise<ApiResponse<PixelConfigResponseData>>;
80
- getAccount: (accountId: string) => Promise<ApiResponse<AccountResponseData>>;
81
- addUserToAccount: (accountId: string, userId: string) => Promise<ApiResponse<AddUserToAccountResponseData>>;
82
- }
1
+ import { ApiResponse } from '../../types/api-response.js';
2
+ import { Account, ACCOUNT_STATUS, Destination } from '@adtrackify/at-tracking-event-types';
3
+ export interface AccountResponseData {
4
+ account: Account;
5
+ [key: string]: any;
6
+ }
7
+ export interface IsAuthorizedUserResponseData {
8
+ isAccountUser: boolean;
9
+ [key: string]: any;
10
+ }
11
+ export interface PixelConfigResponseData {
12
+ id: string;
13
+ destinations: Destination[];
14
+ [key: string]: any;
15
+ }
16
+ export interface AddUserToAccountResponseData {
17
+ userId: string;
18
+ accountId: string;
19
+ }
20
+ export interface UpdateAccountRequest {
21
+ accountName?: string;
22
+ companyName?: string;
23
+ primaryEmail?: string;
24
+ ownerId?: string;
25
+ subscriptionId?: string;
26
+ accountStatus?: ACCOUNT_STATUS;
27
+ }
28
+ export declare class AccountsClient {
29
+ BASE_API_URL: string;
30
+ ACCOUNTS_API_KEY?: string;
31
+ constructor(baseApiUrl: string, accountsApiKey?: string);
32
+ getConfig: () => any;
33
+ getClient: () => Promise<{
34
+ instance: () => import("axios").AxiosInstance;
35
+ get: (url: string, config?: any) => Promise<{
36
+ headers: any;
37
+ data: any;
38
+ status: any;
39
+ }>;
40
+ post: (url: string, data?: any, config?: any) => Promise<{
41
+ headers: any;
42
+ data: any;
43
+ status: any;
44
+ }>;
45
+ delete: (url: string, config?: any) => Promise<{
46
+ headers: any;
47
+ data: any;
48
+ status: any;
49
+ }>;
50
+ put: (url: string, data?: any, config?: any) => Promise<{
51
+ headers: any;
52
+ data: any;
53
+ status: any;
54
+ }>;
55
+ patch: (url: string, data?: any, config?: any) => Promise<{
56
+ headers: any;
57
+ data: any;
58
+ status: any;
59
+ }>;
60
+ setBaseUrl: (url: string) => boolean;
61
+ }>;
62
+ createAccount: (createAccountRequest: any) => Promise<{
63
+ headers: any;
64
+ data: any;
65
+ status: any;
66
+ }>;
67
+ updateAccount: (accountId: string, body: any) => Promise<ApiResponse<AccountResponseData>>;
68
+ addOwner: (accountId: string, userId: string) => Promise<{
69
+ headers: any;
70
+ data: any;
71
+ status: any;
72
+ }>;
73
+ isAuthorizedUser: (userId: string, accountId: string, pixelId?: string) => Promise<ApiResponse<IsAuthorizedUserResponseData>>;
74
+ adminDeleteAccount: (accountId: string) => Promise<{
75
+ headers: any;
76
+ data: any;
77
+ status: any;
78
+ }>;
79
+ getPixelConfigById: (pixelId: string) => Promise<ApiResponse<PixelConfigResponseData>>;
80
+ getAccount: (accountId: string) => Promise<ApiResponse<AccountResponseData>>;
81
+ addUserToAccount: (accountId: string, userId: string) => Promise<ApiResponse<AddUserToAccountResponseData>>;
82
+ }