@adtrackify/at-service-common 1.1.13 → 1.1.15

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/jest.config.ts CHANGED
@@ -1,41 +1,41 @@
1
- /*eslint-disable */
2
-
3
- export default {
4
- globals: {
5
- 'ts-jest': {
6
- isolatedModules: true
7
- },
8
- '@swc/jest': {
9
- isolatedModules: true
10
- }
11
-
12
- },
13
- roots: [ '<rootDir>/src' ],
14
- testRegex: '\\.spec\\.(js|ts)$',
15
- transform: {
16
- "^.+\\.(t|j)sx?$": [ "@swc/jest" ],
17
- },
18
- moduleFileExtensions: [ 'js', 'json', 'ts' ],
19
- transformIgnorePatterns: [],
20
- runner: 'groups',
21
- verbose: false,
22
- coverageThreshold: {
23
- global: {
24
- branches: 0,
25
- functions: 0,
26
- lines: 0,
27
- statements: 0
28
- }
29
- },
30
- coverageReporters: [ 'html', 'text', 'text-summary', 'cobertura' ],
31
- reporters: [ 'default', 'jest-junit' ],
32
- collectCoverageFrom: [
33
- 'src/**/*.ts',
34
- '!src/**/*.spec.js',
35
- 'src/**/*.js',
36
- '!src/**/*.spec.ts',
37
- '!src/**/tests/**'
38
- ],
39
- setupFilesAfterEnv: [],
40
- };
1
+ /*eslint-disable */
2
+
3
+ export default {
4
+ globals: {
5
+ 'ts-jest': {
6
+ isolatedModules: true
7
+ },
8
+ '@swc/jest': {
9
+ isolatedModules: true
10
+ }
11
+
12
+ },
13
+ roots: [ '<rootDir>/src' ],
14
+ testRegex: '\\.spec\\.(js|ts)$',
15
+ transform: {
16
+ "^.+\\.(t|j)sx?$": [ "@swc/jest" ],
17
+ },
18
+ moduleFileExtensions: [ 'js', 'json', 'ts' ],
19
+ transformIgnorePatterns: [],
20
+ runner: 'groups',
21
+ verbose: false,
22
+ coverageThreshold: {
23
+ global: {
24
+ branches: 0,
25
+ functions: 0,
26
+ lines: 0,
27
+ statements: 0
28
+ }
29
+ },
30
+ coverageReporters: [ 'html', 'text', 'text-summary', 'cobertura' ],
31
+ reporters: [ 'default', 'jest-junit' ],
32
+ collectCoverageFrom: [
33
+ 'src/**/*.ts',
34
+ '!src/**/*.spec.js',
35
+ 'src/**/*.js',
36
+ '!src/**/*.spec.ts',
37
+ '!src/**/tests/**'
38
+ ],
39
+ setupFilesAfterEnv: [],
40
+ };
41
41
  /*eslint-enable */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtrackify/at-service-common",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",
@@ -103,4 +103,4 @@
103
103
  "author": "",
104
104
  "license": "ISC",
105
105
  "homepage": "https://bitbucket.org/eacap/at-service-common#readme"
106
- }
106
+ }
@@ -1,41 +1,41 @@
1
-
2
- /**
3
- * @group unit
4
- */
5
-
6
- /* eslint-disable */
7
-
8
- jest.mock('lambda-log');
9
- import * as Logger from 'lambda-log';
10
- import { getPlanDetails } from '../../helpers';
11
-
12
- describe('postmark service email test', () => {
13
- jest.spyOn(Logger, 'warn').mockImplementation(() => {
14
- return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
15
- });
16
- jest.spyOn(Logger, 'info').mockImplementation(() => {
17
- return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
18
- });
19
- jest.spyOn(Logger, 'debug').mockImplementation(() => {
20
- return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
21
- });
22
- jest.spyOn(Logger, 'error').mockImplementation(() => {
23
- return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
24
- });
25
-
26
- beforeEach(async () => {
27
-
28
- });
29
-
30
- afterEach(() => {
31
- jest.resetAllMocks();
32
- });
33
-
34
-
35
- it('should call send email message', async () => {
36
- const plan = getPlanDetails(2, 'dev');
37
- console.log(plan);
38
- expect(plan).not.toEqual(null);
39
- });
40
-
1
+
2
+ /**
3
+ * @group unit
4
+ */
5
+
6
+ /* eslint-disable */
7
+
8
+ jest.mock('lambda-log');
9
+ import * as Logger from 'lambda-log';
10
+ import { getPlanDetails } from '../../helpers';
11
+
12
+ describe('postmark service email test', () => {
13
+ jest.spyOn(Logger, 'warn').mockImplementation(() => {
14
+ return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
15
+ });
16
+ jest.spyOn(Logger, 'info').mockImplementation(() => {
17
+ return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
18
+ });
19
+ jest.spyOn(Logger, 'debug').mockImplementation(() => {
20
+ return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
21
+ });
22
+ jest.spyOn(Logger, 'error').mockImplementation(() => {
23
+ return new Logger.LogMessage({ level: 'null', msg: 'null' }, {});
24
+ });
25
+
26
+ beforeEach(async () => {
27
+
28
+ });
29
+
30
+ afterEach(() => {
31
+ jest.resetAllMocks();
32
+ });
33
+
34
+
35
+ it('should call send email message', async () => {
36
+ const plan = getPlanDetails(2, 'dev');
37
+ console.log(plan);
38
+ expect(plan).not.toEqual(null);
39
+ });
40
+
41
41
  });
@@ -1,8 +1,8 @@
1
- declare module 'axios/lib/adapters/http' {
2
- import { AxiosAdapter } from 'axios';
3
-
4
- const httpAdapter: AxiosAdapter;
5
- namespace httpAdapter { }
6
-
7
- export = httpAdapter;
1
+ declare module 'axios/lib/adapters/http' {
2
+ import { AxiosAdapter } from 'axios';
3
+
4
+ const httpAdapter: AxiosAdapter;
5
+ namespace httpAdapter { }
6
+
7
+ export = httpAdapter;
8
8
  }
@@ -1,11 +1,11 @@
1
1
  import { DynamoDBClient, QueryOutput } from '@aws-sdk/client-dynamodb';
2
- import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
2
+ import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
3
3
  import * as log from 'lambda-log';
4
4
 
5
5
  const marshallOptions = {
6
6
  convertEmptyValues: false,
7
7
  removeUndefinedValues: false,
8
- convertClassInstanceToMap: false
8
+ convertClassInstanceToMap: true
9
9
  };
10
10
 
11
11
  const unmarshallOptions = {
@@ -1,58 +1,58 @@
1
- import * as log from 'lambda-log';
2
- //const log = require('lambda-log');
3
- import { ApiResponse } from '../../types/api-response';
4
- import { axiosHttpService } from '../generic/http-client';
5
- import { Destination } from '@adtrackify/at-tracking-event-types';
6
- //const BASE_API_URL = process.env.BASE_API_URL;
7
- //const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;
8
-
9
- export interface GetDestinationsResponseData {
10
- destinations: Destination[];
11
- [ key: string ]: any;
12
- }
13
- export interface CreateDestinationResponseData {
14
- destination: Destination;
15
- [ key: string ]: any;
16
- }
17
-
18
-
19
- export class DestinationsClient {
20
-
21
- public BASE_API_URL: string;
22
- public DESTINATIONS_API_KEY: string;
23
-
24
- constructor (baseApiUrl: string, destinationsApiKey: string) {
25
- this.BASE_API_URL = baseApiUrl;
26
- this.DESTINATIONS_API_KEY = destinationsApiKey;
27
- }
28
-
29
- getConfig = () => {
30
- const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;
31
- return {
32
- baseURL: SERVICE_API_ROOT_URL,
33
- headers: {
34
- common: {
35
- 'x-api-key': this.DESTINATIONS_API_KEY
36
- }
37
- }
38
- };
39
- };
40
-
41
- getClient = async () => {
42
- return axiosHttpService(this.getConfig());
43
- };
44
-
45
- createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {
46
- const client = await this.getClient();
47
- const response = await client.post('/', createDestinationRequest);
48
- log.info('createDestinationResponse', { response });
49
- return response as ApiResponse<CreateDestinationResponseData>;
50
- };
51
-
52
- getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {
53
- const client = await this.getClient();
54
- const response = await client.get(`/?pixelId=${pixelId}`);
55
- log.info('getPixelResponse', { response });
56
- return response as ApiResponse<GetDestinationsResponseData>;
57
- };
58
- }
1
+ import * as log from 'lambda-log';
2
+ //const log = require('lambda-log');
3
+ import { ApiResponse } from '../../types/api-response';
4
+ import { axiosHttpService } from '../generic/http-client';
5
+ import { Destination } from '@adtrackify/at-tracking-event-types';
6
+ //const BASE_API_URL = process.env.BASE_API_URL;
7
+ //const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;
8
+
9
+ export interface GetDestinationsResponseData {
10
+ destinations: Destination[];
11
+ [ key: string ]: any;
12
+ }
13
+ export interface CreateDestinationResponseData {
14
+ destination: Destination;
15
+ [ key: string ]: any;
16
+ }
17
+
18
+
19
+ export class DestinationsClient {
20
+
21
+ public BASE_API_URL: string;
22
+ public DESTINATIONS_API_KEY: string;
23
+
24
+ constructor (baseApiUrl: string, destinationsApiKey: string) {
25
+ this.BASE_API_URL = baseApiUrl;
26
+ this.DESTINATIONS_API_KEY = destinationsApiKey;
27
+ }
28
+
29
+ getConfig = () => {
30
+ const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;
31
+ return {
32
+ baseURL: SERVICE_API_ROOT_URL,
33
+ headers: {
34
+ common: {
35
+ 'x-api-key': this.DESTINATIONS_API_KEY
36
+ }
37
+ }
38
+ };
39
+ };
40
+
41
+ getClient = async () => {
42
+ return axiosHttpService(this.getConfig());
43
+ };
44
+
45
+ createDestination = async (createDestinationRequest: any): Promise<ApiResponse<CreateDestinationResponseData>> => {
46
+ const client = await this.getClient();
47
+ const response = await client.post('/', createDestinationRequest);
48
+ log.info('createDestinationResponse', { response });
49
+ return response as ApiResponse<CreateDestinationResponseData>;
50
+ };
51
+
52
+ getPixelDestinations = async (pixelId: string): Promise<ApiResponse<GetDestinationsResponseData>> => {
53
+ const client = await this.getClient();
54
+ const response = await client.get(`/?pixelId=${pixelId}`);
55
+ log.info('getPixelResponse', { response });
56
+ return response as ApiResponse<GetDestinationsResponseData>;
57
+ };
58
+ }
@@ -1,4 +1,4 @@
1
- export * from './destinations-client';
2
- export * from './accounts-client';
3
- export * from './users-auth-client';
4
- export * from './shopify-app-install-client';
1
+ export * from './destinations-client';
2
+ export * from './accounts-client';
3
+ export * from './users-auth-client';
4
+ export * from './shopify-app-install-client';
@@ -1,66 +1,66 @@
1
- import log from 'lambda-log';
2
- import { ApiResponse } from '../../types/api-response';
3
- import { axiosHttpService } from '../generic/http-client';
4
- import { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';
5
- //const BASE_API_URL = process.env.BASE_API_URL;
6
- //const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;
7
-
8
- export interface ShopifyAppInstallResponseData {
9
- shopifyAppInstall: ShopifyAppInstall;
10
- [ key: string ]: any;
11
- }
12
-
13
- export interface UpdateShopifyAppInstallRequest {
14
- appSubscriptionStatus?: ShopifyAppSubscriptionStatus,
15
- pixelId?: string,
16
- shopifyAppInstallId: string;
17
- isAppEnabled?: boolean;
18
- }
19
-
20
- export class ShopifyAppInstallClient {
21
-
22
- public BASE_API_URL: string;
23
- public SHOPIFY_APP_INSTALL_API_KEY: string;
24
-
25
- constructor (baseApiUrl: string, shopifyAppInstallApiKey: string) {
26
- this.BASE_API_URL = baseApiUrl;
27
- this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;
28
- }
29
-
30
- getConfig = () => {
31
- const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;
32
- return {
33
- baseURL: SERVICE_API_ROOT_URL,
34
- headers: {
35
- common: {
36
- 'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY
37
- }
38
- }
39
- };
40
- };
41
-
42
- getClient = async () => {
43
- return axiosHttpService(this.getConfig());
44
- };
45
-
46
- updateShopifyAppInstall = async (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {
47
- const client = await this.getClient();
48
- const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
49
- log.info('updateShopifyAppInstall', { response });
50
- return response as ApiResponse<ShopifyAppInstallResponseData>;
51
- };
52
-
53
- getShopifyAppInstall = async (shopifyAppInstallId: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {
54
- const client = await this.getClient();
55
- const response = await client.get(`/${shopifyAppInstallId}`);
56
- log.info('getShopifyAppInstall', { response });
57
- return response as ApiResponse<ShopifyAppInstallResponseData>;
58
- };
59
-
60
- getShopifyAppInstallByShop = async (shop: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {
61
- const client = await this.getClient();
62
- const response = await client.get(`/?shop=${shop}`);
63
- log.info('getShopifyAppInstallByShop', { response });
64
- return response as ApiResponse<ShopifyAppInstallResponseData>;
65
- }
66
- }
1
+ import log from 'lambda-log';
2
+ import { ApiResponse } from '../../types/api-response';
3
+ import { axiosHttpService } from '../generic/http-client';
4
+ import { ShopifyAppInstall, ShopifyAppSubscriptionStatus } from '@adtrackify/at-tracking-event-types';
5
+ //const BASE_API_URL = process.env.BASE_API_URL;
6
+ //const DESTINATIONS_API_KEY = process.env.DESTINATIONS_API_KEY;
7
+
8
+ export interface ShopifyAppInstallResponseData {
9
+ shopifyAppInstall: ShopifyAppInstall;
10
+ [ key: string ]: any;
11
+ }
12
+
13
+ export interface UpdateShopifyAppInstallRequest {
14
+ appSubscriptionStatus?: ShopifyAppSubscriptionStatus,
15
+ pixelId?: string,
16
+ shopifyAppInstallId: string;
17
+ isAppEnabled?: boolean;
18
+ }
19
+
20
+ export class ShopifyAppInstallClient {
21
+
22
+ public BASE_API_URL: string;
23
+ public SHOPIFY_APP_INSTALL_API_KEY: string;
24
+
25
+ constructor (baseApiUrl: string, shopifyAppInstallApiKey: string) {
26
+ this.BASE_API_URL = baseApiUrl;
27
+ this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;
28
+ }
29
+
30
+ getConfig = () => {
31
+ const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;
32
+ return {
33
+ baseURL: SERVICE_API_ROOT_URL,
34
+ headers: {
35
+ common: {
36
+ 'x-api-key': this.SHOPIFY_APP_INSTALL_API_KEY
37
+ }
38
+ }
39
+ };
40
+ };
41
+
42
+ getClient = async () => {
43
+ return axiosHttpService(this.getConfig());
44
+ };
45
+
46
+ updateShopifyAppInstall = async (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {
47
+ const client = await this.getClient();
48
+ const response = await client.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
49
+ log.info('updateShopifyAppInstall', { response });
50
+ return response as ApiResponse<ShopifyAppInstallResponseData>;
51
+ };
52
+
53
+ getShopifyAppInstall = async (shopifyAppInstallId: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {
54
+ const client = await this.getClient();
55
+ const response = await client.get(`/${shopifyAppInstallId}`);
56
+ log.info('getShopifyAppInstall', { response });
57
+ return response as ApiResponse<ShopifyAppInstallResponseData>;
58
+ };
59
+
60
+ getShopifyAppInstallByShop = async (shop: string): Promise<ApiResponse<ShopifyAppInstallResponseData>> => {
61
+ const client = await this.getClient();
62
+ const response = await client.get(`/?shop=${shop}`);
63
+ log.info('getShopifyAppInstallByShop', { response });
64
+ return response as ApiResponse<ShopifyAppInstallResponseData>;
65
+ }
66
+ }