@adtrackify/at-service-common 1.2.16 → 1.2.18
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/__tests__/helpers/subscription-helper.spec.d.ts +1 -1
- package/dist/__tests__/helpers/subscription-helper.spec.js +27 -27
- package/dist/clients/generic/cognito-client.d.ts +19 -19
- package/dist/clients/generic/cognito-client.js +139 -139
- package/dist/clients/generic/dynamodb-client.d.ts +15 -15
- package/dist/clients/generic/dynamodb-client.js +122 -122
- package/dist/clients/generic/eventbridge-client.d.ts +14 -14
- package/dist/clients/generic/eventbridge-client.js +45 -45
- package/dist/clients/generic/http-client.d.ts +30 -30
- package/dist/clients/generic/http-client.js +28 -28
- package/dist/clients/generic/index.d.ts +6 -6
- package/dist/clients/generic/index.js +6 -6
- package/dist/clients/generic/s3-client.d.ts +6 -9
- package/dist/clients/generic/s3-client.js +24 -28
- package/dist/clients/generic/s3-client.js.map +1 -1
- package/dist/clients/generic/sqs-client.d.ts +14 -14
- package/dist/clients/generic/sqs-client.js +34 -34
- package/dist/clients/index.d.ts +3 -3
- package/dist/clients/index.js +3 -3
- package/dist/clients/internal-api/accounts-client.d.ts +82 -82
- package/dist/clients/internal-api/accounts-client.js +78 -78
- package/dist/clients/internal-api/destinations-client.d.ts +54 -54
- package/dist/clients/internal-api/destinations-client.js +36 -36
- package/dist/clients/internal-api/index.d.ts +4 -4
- package/dist/clients/internal-api/index.js +4 -4
- package/dist/clients/internal-api/shopify-app-install-client.d.ts +57 -57
- package/dist/clients/internal-api/shopify-app-install-client.js +42 -42
- package/dist/clients/internal-api/users-auth-client.d.ts +61 -61
- package/dist/clients/internal-api/users-auth-client.js +73 -73
- package/dist/clients/third-party/index.d.ts +1 -1
- package/dist/clients/third-party/index.js +1 -1
- package/dist/clients/third-party/shopify-client.d.ts +90 -90
- package/dist/clients/third-party/shopify-client.js +121 -121
- package/dist/helpers/index.d.ts +5 -5
- package/dist/helpers/index.js +5 -5
- package/dist/helpers/input-validation-helper.d.ts +2 -2
- package/dist/helpers/input-validation-helper.js +18 -18
- package/dist/helpers/logging-helper.d.ts +14 -1
- package/dist/helpers/logging-helper.js +39 -9
- package/dist/helpers/logging-helper.js.map +1 -1
- package/dist/helpers/response-helper.d.ts +36 -36
- package/dist/helpers/response-helper.js +35 -35
- package/dist/helpers/shopify-helper.d.ts +9 -9
- package/dist/helpers/shopify-helper.js +23 -23
- package/dist/helpers/subscription-helper.d.ts +8 -8
- package/dist/helpers/subscription-helper.js +181 -181
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +66 -37
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +5 -5
- package/dist/libs/crypto.d.ts +1 -1
- package/dist/libs/crypto.js +5 -5
- package/dist/libs/dates.d.ts +3 -3
- package/dist/libs/dates.js +10 -10
- package/dist/libs/http-error.d.ts +21 -21
- package/dist/libs/http-error.js +55 -55
- package/dist/libs/http-status-codes.d.ts +58 -58
- package/dist/libs/http-status-codes.js +59 -59
- package/dist/libs/index.d.ts +6 -6
- package/dist/libs/index.js +6 -6
- package/dist/libs/url.d.ts +1 -1
- package/dist/libs/url.js +9 -9
- package/dist/services/eventbridge-integration-service.d.ts +9 -9
- package/dist/services/eventbridge-integration-service.js +24 -24
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/types/api-response.d.ts +6 -6
- package/dist/types/api-response.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/internal-events/event-detail-types.d.ts +20 -20
- package/dist/types/internal-events/event-detail-types.js +24 -24
- package/dist/types/internal-events/index.d.ts +1 -1
- package/dist/types/internal-events/index.js +1 -1
- package/package.json +4 -4
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import * as log from 'lambda-log';
|
|
2
|
-
import { axiosHttpService } from '../generic/http-client.js';
|
|
3
|
-
export class AccountsClient {
|
|
4
|
-
BASE_API_URL;
|
|
5
|
-
ACCOUNTS_API_KEY;
|
|
6
|
-
constructor(baseApiUrl, accountsApiKey) {
|
|
7
|
-
this.BASE_API_URL = baseApiUrl;
|
|
8
|
-
this.ACCOUNTS_API_KEY = accountsApiKey;
|
|
9
|
-
}
|
|
10
|
-
getConfig = () => {
|
|
11
|
-
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;
|
|
12
|
-
const params = {
|
|
13
|
-
baseURL: SERVICE_API_ROOT_URL
|
|
14
|
-
};
|
|
15
|
-
if (this.ACCOUNTS_API_KEY) {
|
|
16
|
-
params.headers = {
|
|
17
|
-
common: {
|
|
18
|
-
'x-api-key': this.ACCOUNTS_API_KEY
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return params;
|
|
23
|
-
};
|
|
24
|
-
getClient = async () => {
|
|
25
|
-
return axiosHttpService(this.getConfig());
|
|
26
|
-
};
|
|
27
|
-
createAccount = async (createAccountRequest) => {
|
|
28
|
-
const client = await this.getClient();
|
|
29
|
-
const createAccountResponse = await client.post('', createAccountRequest);
|
|
30
|
-
log.info('createAccountResponse', { createAccountResponse });
|
|
31
|
-
return createAccountResponse;
|
|
32
|
-
};
|
|
33
|
-
updateAccount = async (accountId, body) => {
|
|
34
|
-
const client = await this.getClient();
|
|
35
|
-
const response = await client.patch(`/${accountId}/`, body);
|
|
36
|
-
log.info('update Account response', { response });
|
|
37
|
-
return response;
|
|
38
|
-
};
|
|
39
|
-
addOwner = async (accountId, userId) => {
|
|
40
|
-
const client = await this.getClient();
|
|
41
|
-
const addOwnerResponse = await client.post('/addOwner', { accountId, userId });
|
|
42
|
-
log.info('addOwnerResponse', { addOwnerResponse });
|
|
43
|
-
return addOwnerResponse;
|
|
44
|
-
};
|
|
45
|
-
isAuthorizedUser = async (userId, accountId, pixelId) => {
|
|
46
|
-
const client = await this.getClient();
|
|
47
|
-
const body = {
|
|
48
|
-
userId, accountId, pixelId
|
|
49
|
-
};
|
|
50
|
-
const response = await client.post('/checkUserAuthorization', body);
|
|
51
|
-
log.info('checkUserAuthorization', { response });
|
|
52
|
-
return response;
|
|
53
|
-
};
|
|
54
|
-
adminDeleteAccount = async (accountId) => {
|
|
55
|
-
const client = await this.getClient();
|
|
56
|
-
const success = await client.delete(`/${accountId}`);
|
|
57
|
-
log.info('adminDeleteAccount');
|
|
58
|
-
return success;
|
|
59
|
-
};
|
|
60
|
-
getPixelConfigById = async (pixelId) => {
|
|
61
|
-
const client = await this.getClient();
|
|
62
|
-
const pixelResponse = await client.get(`/px/${pixelId}/config`);
|
|
63
|
-
log.debug('get pixelResponse', { pixelResponse });
|
|
64
|
-
return pixelResponse;
|
|
65
|
-
};
|
|
66
|
-
getAccount = async (accountId) => {
|
|
67
|
-
const client = await this.getClient();
|
|
68
|
-
const response = await client.get(`/${accountId}/`);
|
|
69
|
-
log.info('get account response', { response });
|
|
70
|
-
return response;
|
|
71
|
-
};
|
|
72
|
-
addUserToAccount = async (accountId, userId) => {
|
|
73
|
-
const client = await this.getClient();
|
|
74
|
-
const response = await client.post('/addUser', { accountId, userId });
|
|
75
|
-
log.info('add user account response', { response });
|
|
76
|
-
return response;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
1
|
+
import * as log from 'lambda-log';
|
|
2
|
+
import { axiosHttpService } from '../generic/http-client.js';
|
|
3
|
+
export class AccountsClient {
|
|
4
|
+
BASE_API_URL;
|
|
5
|
+
ACCOUNTS_API_KEY;
|
|
6
|
+
constructor(baseApiUrl, accountsApiKey) {
|
|
7
|
+
this.BASE_API_URL = baseApiUrl;
|
|
8
|
+
this.ACCOUNTS_API_KEY = accountsApiKey;
|
|
9
|
+
}
|
|
10
|
+
getConfig = () => {
|
|
11
|
+
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;
|
|
12
|
+
const params = {
|
|
13
|
+
baseURL: SERVICE_API_ROOT_URL
|
|
14
|
+
};
|
|
15
|
+
if (this.ACCOUNTS_API_KEY) {
|
|
16
|
+
params.headers = {
|
|
17
|
+
common: {
|
|
18
|
+
'x-api-key': this.ACCOUNTS_API_KEY
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return params;
|
|
23
|
+
};
|
|
24
|
+
getClient = async () => {
|
|
25
|
+
return axiosHttpService(this.getConfig());
|
|
26
|
+
};
|
|
27
|
+
createAccount = async (createAccountRequest) => {
|
|
28
|
+
const client = await this.getClient();
|
|
29
|
+
const createAccountResponse = await client.post('', createAccountRequest);
|
|
30
|
+
log.info('createAccountResponse', { createAccountResponse });
|
|
31
|
+
return createAccountResponse;
|
|
32
|
+
};
|
|
33
|
+
updateAccount = async (accountId, body) => {
|
|
34
|
+
const client = await this.getClient();
|
|
35
|
+
const response = await client.patch(`/${accountId}/`, body);
|
|
36
|
+
log.info('update Account response', { response });
|
|
37
|
+
return response;
|
|
38
|
+
};
|
|
39
|
+
addOwner = async (accountId, userId) => {
|
|
40
|
+
const client = await this.getClient();
|
|
41
|
+
const addOwnerResponse = await client.post('/addOwner', { accountId, userId });
|
|
42
|
+
log.info('addOwnerResponse', { addOwnerResponse });
|
|
43
|
+
return addOwnerResponse;
|
|
44
|
+
};
|
|
45
|
+
isAuthorizedUser = async (userId, accountId, pixelId) => {
|
|
46
|
+
const client = await this.getClient();
|
|
47
|
+
const body = {
|
|
48
|
+
userId, accountId, pixelId
|
|
49
|
+
};
|
|
50
|
+
const response = await client.post('/checkUserAuthorization', body);
|
|
51
|
+
log.info('checkUserAuthorization', { response });
|
|
52
|
+
return response;
|
|
53
|
+
};
|
|
54
|
+
adminDeleteAccount = async (accountId) => {
|
|
55
|
+
const client = await this.getClient();
|
|
56
|
+
const success = await client.delete(`/${accountId}`);
|
|
57
|
+
log.info('adminDeleteAccount');
|
|
58
|
+
return success;
|
|
59
|
+
};
|
|
60
|
+
getPixelConfigById = async (pixelId) => {
|
|
61
|
+
const client = await this.getClient();
|
|
62
|
+
const pixelResponse = await client.get(`/px/${pixelId}/config`);
|
|
63
|
+
log.debug('get pixelResponse', { pixelResponse });
|
|
64
|
+
return pixelResponse;
|
|
65
|
+
};
|
|
66
|
+
getAccount = async (accountId) => {
|
|
67
|
+
const client = await this.getClient();
|
|
68
|
+
const response = await client.get(`/${accountId}/`);
|
|
69
|
+
log.info('get account response', { response });
|
|
70
|
+
return response;
|
|
71
|
+
};
|
|
72
|
+
addUserToAccount = async (accountId, userId) => {
|
|
73
|
+
const client = await this.getClient();
|
|
74
|
+
const response = await client.post('/addUser', { accountId, userId });
|
|
75
|
+
log.info('add user account response', { response });
|
|
76
|
+
return response;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
79
|
//# sourceMappingURL=accounts-client.js.map
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { ApiResponse } from '../../types/api-response.js';
|
|
2
|
-
import { Destination } from '@adtrackify/at-tracking-event-types';
|
|
3
|
-
export interface GetDestinationsResponseData {
|
|
4
|
-
destinations: Destination[];
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
export interface CreateDestinationResponseData {
|
|
8
|
-
destination: Destination;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
export declare class DestinationsClient {
|
|
12
|
-
BASE_API_URL: string;
|
|
13
|
-
DESTINATIONS_API_KEY: string;
|
|
14
|
-
constructor(baseApiUrl: string, destinationsApiKey: string);
|
|
15
|
-
getConfig: () => {
|
|
16
|
-
baseURL: string;
|
|
17
|
-
headers: {
|
|
18
|
-
common: {
|
|
19
|
-
'x-api-key': string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
getClient: () => Promise<{
|
|
24
|
-
instance: () => import("axios").AxiosInstance;
|
|
25
|
-
get: (url: string, config?: any) => Promise<{
|
|
26
|
-
headers: any;
|
|
27
|
-
data: any;
|
|
28
|
-
status: any;
|
|
29
|
-
}>;
|
|
30
|
-
post: (url: string, data?: any, config?: any) => Promise<{
|
|
31
|
-
headers: any;
|
|
32
|
-
data: any;
|
|
33
|
-
status: any;
|
|
34
|
-
}>;
|
|
35
|
-
delete: (url: string, config?: any) => Promise<{
|
|
36
|
-
headers: any;
|
|
37
|
-
data: any;
|
|
38
|
-
status: any;
|
|
39
|
-
}>;
|
|
40
|
-
put: (url: string, data?: any, config?: any) => Promise<{
|
|
41
|
-
headers: any;
|
|
42
|
-
data: any;
|
|
43
|
-
status: any;
|
|
44
|
-
}>;
|
|
45
|
-
patch: (url: string, data?: any, config?: any) => Promise<{
|
|
46
|
-
headers: any;
|
|
47
|
-
data: any;
|
|
48
|
-
status: any;
|
|
49
|
-
}>;
|
|
50
|
-
setBaseUrl: (url: string) => boolean;
|
|
51
|
-
}>;
|
|
52
|
-
createDestination: (createDestinationRequest: any) => Promise<ApiResponse<CreateDestinationResponseData>>;
|
|
53
|
-
getPixelDestinations: (pixelId: string) => Promise<ApiResponse<GetDestinationsResponseData>>;
|
|
54
|
-
}
|
|
1
|
+
import { ApiResponse } from '../../types/api-response.js';
|
|
2
|
+
import { Destination } from '@adtrackify/at-tracking-event-types';
|
|
3
|
+
export interface GetDestinationsResponseData {
|
|
4
|
+
destinations: Destination[];
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface CreateDestinationResponseData {
|
|
8
|
+
destination: Destination;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export declare class DestinationsClient {
|
|
12
|
+
BASE_API_URL: string;
|
|
13
|
+
DESTINATIONS_API_KEY: string;
|
|
14
|
+
constructor(baseApiUrl: string, destinationsApiKey: string);
|
|
15
|
+
getConfig: () => {
|
|
16
|
+
baseURL: string;
|
|
17
|
+
headers: {
|
|
18
|
+
common: {
|
|
19
|
+
'x-api-key': string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
getClient: () => Promise<{
|
|
24
|
+
instance: () => import("axios").AxiosInstance;
|
|
25
|
+
get: (url: string, config?: any) => Promise<{
|
|
26
|
+
headers: any;
|
|
27
|
+
data: any;
|
|
28
|
+
status: any;
|
|
29
|
+
}>;
|
|
30
|
+
post: (url: string, data?: any, config?: any) => Promise<{
|
|
31
|
+
headers: any;
|
|
32
|
+
data: any;
|
|
33
|
+
status: any;
|
|
34
|
+
}>;
|
|
35
|
+
delete: (url: string, config?: any) => Promise<{
|
|
36
|
+
headers: any;
|
|
37
|
+
data: any;
|
|
38
|
+
status: any;
|
|
39
|
+
}>;
|
|
40
|
+
put: (url: string, data?: any, config?: any) => Promise<{
|
|
41
|
+
headers: any;
|
|
42
|
+
data: any;
|
|
43
|
+
status: any;
|
|
44
|
+
}>;
|
|
45
|
+
patch: (url: string, data?: any, config?: any) => Promise<{
|
|
46
|
+
headers: any;
|
|
47
|
+
data: any;
|
|
48
|
+
status: any;
|
|
49
|
+
}>;
|
|
50
|
+
setBaseUrl: (url: string) => boolean;
|
|
51
|
+
}>;
|
|
52
|
+
createDestination: (createDestinationRequest: any) => Promise<ApiResponse<CreateDestinationResponseData>>;
|
|
53
|
+
getPixelDestinations: (pixelId: string) => Promise<ApiResponse<GetDestinationsResponseData>>;
|
|
54
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import * as log from 'lambda-log';
|
|
2
|
-
import { axiosHttpService } from '../generic/http-client.js';
|
|
3
|
-
export class DestinationsClient {
|
|
4
|
-
BASE_API_URL;
|
|
5
|
-
DESTINATIONS_API_KEY;
|
|
6
|
-
constructor(baseApiUrl, destinationsApiKey) {
|
|
7
|
-
this.BASE_API_URL = baseApiUrl;
|
|
8
|
-
this.DESTINATIONS_API_KEY = destinationsApiKey;
|
|
9
|
-
}
|
|
10
|
-
getConfig = () => {
|
|
11
|
-
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;
|
|
12
|
-
return {
|
|
13
|
-
baseURL: SERVICE_API_ROOT_URL,
|
|
14
|
-
headers: {
|
|
15
|
-
common: {
|
|
16
|
-
'x-api-key': this.DESTINATIONS_API_KEY
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
getClient = async () => {
|
|
22
|
-
return axiosHttpService(this.getConfig());
|
|
23
|
-
};
|
|
24
|
-
createDestination = async (createDestinationRequest) => {
|
|
25
|
-
const client = await this.getClient();
|
|
26
|
-
const response = await client.post('/', createDestinationRequest);
|
|
27
|
-
log.info('createDestinationResponse', { response });
|
|
28
|
-
return response;
|
|
29
|
-
};
|
|
30
|
-
getPixelDestinations = async (pixelId) => {
|
|
31
|
-
const client = await this.getClient();
|
|
32
|
-
const response = await client.get(`/?pixelId=${pixelId}`);
|
|
33
|
-
log.info('getPixelResponse', { response });
|
|
34
|
-
return response;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
1
|
+
import * as log from 'lambda-log';
|
|
2
|
+
import { axiosHttpService } from '../generic/http-client.js';
|
|
3
|
+
export class DestinationsClient {
|
|
4
|
+
BASE_API_URL;
|
|
5
|
+
DESTINATIONS_API_KEY;
|
|
6
|
+
constructor(baseApiUrl, destinationsApiKey) {
|
|
7
|
+
this.BASE_API_URL = baseApiUrl;
|
|
8
|
+
this.DESTINATIONS_API_KEY = destinationsApiKey;
|
|
9
|
+
}
|
|
10
|
+
getConfig = () => {
|
|
11
|
+
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;
|
|
12
|
+
return {
|
|
13
|
+
baseURL: SERVICE_API_ROOT_URL,
|
|
14
|
+
headers: {
|
|
15
|
+
common: {
|
|
16
|
+
'x-api-key': this.DESTINATIONS_API_KEY
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
getClient = async () => {
|
|
22
|
+
return axiosHttpService(this.getConfig());
|
|
23
|
+
};
|
|
24
|
+
createDestination = async (createDestinationRequest) => {
|
|
25
|
+
const client = await this.getClient();
|
|
26
|
+
const response = await client.post('/', createDestinationRequest);
|
|
27
|
+
log.info('createDestinationResponse', { response });
|
|
28
|
+
return response;
|
|
29
|
+
};
|
|
30
|
+
getPixelDestinations = async (pixelId) => {
|
|
31
|
+
const client = await this.getClient();
|
|
32
|
+
const response = await client.get(`/?pixelId=${pixelId}`);
|
|
33
|
+
log.info('getPixelResponse', { response });
|
|
34
|
+
return response;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
37
|
//# sourceMappingURL=destinations-client.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './destinations-client.js';
|
|
2
|
-
export * from './accounts-client.js';
|
|
3
|
-
export * from './users-auth-client.js';
|
|
4
|
-
export * from './shopify-app-install-client.js';
|
|
1
|
+
export * from './destinations-client.js';
|
|
2
|
+
export * from './accounts-client.js';
|
|
3
|
+
export * from './users-auth-client.js';
|
|
4
|
+
export * from './shopify-app-install-client.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './destinations-client.js';
|
|
2
|
-
export * from './accounts-client.js';
|
|
3
|
-
export * from './users-auth-client.js';
|
|
4
|
-
export * from './shopify-app-install-client.js';
|
|
1
|
+
export * from './destinations-client.js';
|
|
2
|
+
export * from './accounts-client.js';
|
|
3
|
+
export * from './users-auth-client.js';
|
|
4
|
+
export * from './shopify-app-install-client.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { ApiResponse } from '../../types/api-response.js';
|
|
2
|
-
import { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';
|
|
3
|
-
export interface ShopifyAppInstallResponseData {
|
|
4
|
-
shopifyAppInstall: ShopifyAppInstall;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
export interface UpdateShopifyAppInstallRequest {
|
|
8
|
-
appSubscriptionStatus?: ShopifyAppSubscriptionStatus;
|
|
9
|
-
pixelId?: string;
|
|
10
|
-
shopifyAppInstallId: string;
|
|
11
|
-
isAppEnabled?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class ShopifyAppInstallClient {
|
|
14
|
-
BASE_API_URL: string;
|
|
15
|
-
SHOPIFY_APP_INSTALL_API_KEY: string;
|
|
16
|
-
constructor(baseApiUrl: string, shopifyAppInstallApiKey: string);
|
|
17
|
-
getConfig: () => {
|
|
18
|
-
baseURL: string;
|
|
19
|
-
headers: {
|
|
20
|
-
common: {
|
|
21
|
-
'x-api-key': string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
getClient: () => Promise<{
|
|
26
|
-
instance: () => import("axios").AxiosInstance;
|
|
27
|
-
get: (url: string, config?: any) => Promise<{
|
|
28
|
-
headers: any;
|
|
29
|
-
data: any;
|
|
30
|
-
status: any;
|
|
31
|
-
}>;
|
|
32
|
-
post: (url: string, data?: any, config?: any) => Promise<{
|
|
33
|
-
headers: any;
|
|
34
|
-
data: any;
|
|
35
|
-
status: any;
|
|
36
|
-
}>;
|
|
37
|
-
delete: (url: string, config?: any) => Promise<{
|
|
38
|
-
headers: any;
|
|
39
|
-
data: any;
|
|
40
|
-
status: any;
|
|
41
|
-
}>;
|
|
42
|
-
put: (url: string, data?: any, config?: any) => Promise<{
|
|
43
|
-
headers: any;
|
|
44
|
-
data: any;
|
|
45
|
-
status: any;
|
|
46
|
-
}>;
|
|
47
|
-
patch: (url: string, data?: any, config?: any) => Promise<{
|
|
48
|
-
headers: any;
|
|
49
|
-
data: any;
|
|
50
|
-
status: any;
|
|
51
|
-
}>;
|
|
52
|
-
setBaseUrl: (url: string) => boolean;
|
|
53
|
-
}>;
|
|
54
|
-
updateShopifyAppInstall: (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
|
|
55
|
-
getShopifyAppInstall: (shopifyAppInstallId: string) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
|
|
56
|
-
getShopifyAppInstallByShop: (shop: string) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
|
|
57
|
-
}
|
|
1
|
+
import { ApiResponse } from '../../types/api-response.js';
|
|
2
|
+
import { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';
|
|
3
|
+
export interface ShopifyAppInstallResponseData {
|
|
4
|
+
shopifyAppInstall: ShopifyAppInstall;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface UpdateShopifyAppInstallRequest {
|
|
8
|
+
appSubscriptionStatus?: ShopifyAppSubscriptionStatus;
|
|
9
|
+
pixelId?: string;
|
|
10
|
+
shopifyAppInstallId: string;
|
|
11
|
+
isAppEnabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class ShopifyAppInstallClient {
|
|
14
|
+
BASE_API_URL: string;
|
|
15
|
+
SHOPIFY_APP_INSTALL_API_KEY: string;
|
|
16
|
+
constructor(baseApiUrl: string, shopifyAppInstallApiKey: string);
|
|
17
|
+
getConfig: () => {
|
|
18
|
+
baseURL: string;
|
|
19
|
+
headers: {
|
|
20
|
+
common: {
|
|
21
|
+
'x-api-key': string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
getClient: () => Promise<{
|
|
26
|
+
instance: () => import("axios").AxiosInstance;
|
|
27
|
+
get: (url: string, config?: any) => Promise<{
|
|
28
|
+
headers: any;
|
|
29
|
+
data: any;
|
|
30
|
+
status: any;
|
|
31
|
+
}>;
|
|
32
|
+
post: (url: string, data?: any, config?: any) => Promise<{
|
|
33
|
+
headers: any;
|
|
34
|
+
data: any;
|
|
35
|
+
status: any;
|
|
36
|
+
}>;
|
|
37
|
+
delete: (url: string, config?: any) => Promise<{
|
|
38
|
+
headers: any;
|
|
39
|
+
data: any;
|
|
40
|
+
status: any;
|
|
41
|
+
}>;
|
|
42
|
+
put: (url: string, data?: any, config?: any) => Promise<{
|
|
43
|
+
headers: any;
|
|
44
|
+
data: any;
|
|
45
|
+
status: any;
|
|
46
|
+
}>;
|
|
47
|
+
patch: (url: string, data?: any, config?: any) => Promise<{
|
|
48
|
+
headers: any;
|
|
49
|
+
data: any;
|
|
50
|
+
status: any;
|
|
51
|
+
}>;
|
|
52
|
+
setBaseUrl: (url: string) => boolean;
|
|
53
|
+
}>;
|
|
54
|
+
updateShopifyAppInstall: (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
|
|
55
|
+
getShopifyAppInstall: (shopifyAppInstallId: string) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
|
|
56
|
+
getShopifyAppInstallByShop: (shop: string) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
|
|
57
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import log from 'lambda-log';
|
|
2
|
-
import { axiosHttpService } from '../generic/http-client.js';
|
|
3
|
-
export class ShopifyAppInstallClient {
|
|
4
|
-
BASE_API_URL;
|
|
5
|
-
SHOPIFY_APP_INSTALL_API_KEY;
|
|
6
|
-
constructor(baseApiUrl, shopifyAppInstallApiKey) {
|
|
7
|
-
this.BASE_API_URL = baseApiUrl;
|
|
8
|
-
this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;
|
|
9
|
-
}
|
|
10
|
-
getConfig = () => {
|
|
11
|
-
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;
|
|
12
|
-
return {
|
|
13
|
-
baseURL: SERVICE_API_ROOT_URL,
|
|
14
|
-
headers: {
|
|
15
|
-
common: {
|
|
16
|
-
'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
getClient = async () => {
|
|
22
|
-
return axiosHttpService(this.getConfig());
|
|
23
|
-
};
|
|
24
|
-
updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
|
|
25
|
-
const client = await this.getClient();
|
|
26
|
-
const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
|
|
27
|
-
log.info('updateShopifyAppInstall', { response });
|
|
28
|
-
return response;
|
|
29
|
-
};
|
|
30
|
-
getShopifyAppInstall = async (shopifyAppInstallId) => {
|
|
31
|
-
const client = await this.getClient();
|
|
32
|
-
const response = await client.get(`/${shopifyAppInstallId}`);
|
|
33
|
-
log.info('getShopifyAppInstall', { response });
|
|
34
|
-
return response;
|
|
35
|
-
};
|
|
36
|
-
getShopifyAppInstallByShop = async (shop) => {
|
|
37
|
-
const client = await this.getClient();
|
|
38
|
-
const response = await client.get(`/?shop=${shop}`);
|
|
39
|
-
log.info('getShopifyAppInstallByShop', { response });
|
|
40
|
-
return response;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
1
|
+
import log from 'lambda-log';
|
|
2
|
+
import { axiosHttpService } from '../generic/http-client.js';
|
|
3
|
+
export class ShopifyAppInstallClient {
|
|
4
|
+
BASE_API_URL;
|
|
5
|
+
SHOPIFY_APP_INSTALL_API_KEY;
|
|
6
|
+
constructor(baseApiUrl, shopifyAppInstallApiKey) {
|
|
7
|
+
this.BASE_API_URL = baseApiUrl;
|
|
8
|
+
this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;
|
|
9
|
+
}
|
|
10
|
+
getConfig = () => {
|
|
11
|
+
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;
|
|
12
|
+
return {
|
|
13
|
+
baseURL: SERVICE_API_ROOT_URL,
|
|
14
|
+
headers: {
|
|
15
|
+
common: {
|
|
16
|
+
'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
getClient = async () => {
|
|
22
|
+
return axiosHttpService(this.getConfig());
|
|
23
|
+
};
|
|
24
|
+
updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
|
|
25
|
+
const client = await this.getClient();
|
|
26
|
+
const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
|
|
27
|
+
log.info('updateShopifyAppInstall', { response });
|
|
28
|
+
return response;
|
|
29
|
+
};
|
|
30
|
+
getShopifyAppInstall = async (shopifyAppInstallId) => {
|
|
31
|
+
const client = await this.getClient();
|
|
32
|
+
const response = await client.get(`/${shopifyAppInstallId}`);
|
|
33
|
+
log.info('getShopifyAppInstall', { response });
|
|
34
|
+
return response;
|
|
35
|
+
};
|
|
36
|
+
getShopifyAppInstallByShop = async (shop) => {
|
|
37
|
+
const client = await this.getClient();
|
|
38
|
+
const response = await client.get(`/?shop=${shop}`);
|
|
39
|
+
log.info('getShopifyAppInstallByShop', { response });
|
|
40
|
+
return response;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
43
|
//# sourceMappingURL=shopify-app-install-client.js.map
|