@adtrackify/at-service-common 2.0.14 → 2.0.16

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.
@@ -0,0 +1,48 @@
1
+ import { ApiResponse } from '../../types/api-response.js';
2
+ export interface LatestSessionResponseData {
3
+ identityId?: string;
4
+ sessionId?: string;
5
+ }
6
+ export declare class DbMgmtClient {
7
+ BASE_API_URL: string;
8
+ DB_MGMT_API_KEY: string;
9
+ constructor(baseApiUrl: string, dbMgmtApiKey: string);
10
+ getConfig: () => {
11
+ baseURL: string;
12
+ headers: {
13
+ common: {
14
+ 'x-api-key': string;
15
+ };
16
+ };
17
+ };
18
+ getClient: () => Promise<{
19
+ instance: () => import("axios").AxiosInstance;
20
+ get: (url: string, config?: any) => Promise<{
21
+ headers: any;
22
+ data: any;
23
+ status: any;
24
+ }>;
25
+ post: (url: string, data?: any, config?: any) => Promise<{
26
+ headers: any;
27
+ data: any;
28
+ status: any;
29
+ }>;
30
+ delete: (url: string, config?: any) => Promise<{
31
+ headers: any;
32
+ data: any;
33
+ status: any;
34
+ }>;
35
+ put: (url: string, data?: any, config?: any) => Promise<{
36
+ headers: any;
37
+ data: any;
38
+ status: any;
39
+ }>;
40
+ patch: (url: string, data?: any, config?: any) => Promise<{
41
+ headers: any;
42
+ data: any;
43
+ status: any;
44
+ }>;
45
+ setBaseUrl: (url: string) => boolean;
46
+ }>;
47
+ getLatestSession: (pixelId: string, ipAddress: string, userAgent: string, domain: string) => Promise<ApiResponse<LatestSessionResponseData>>;
48
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DbMgmtClient = void 0;
7
+ const lambda_log_1 = __importDefault(require("lambda-log"));
8
+ const http_client_js_1 = require("../generic/http-client.js");
9
+ class DbMgmtClient {
10
+ BASE_API_URL;
11
+ DB_MGMT_API_KEY;
12
+ constructor(baseApiUrl, dbMgmtApiKey) {
13
+ this.BASE_API_URL = baseApiUrl;
14
+ this.DB_MGMT_API_KEY = dbMgmtApiKey;
15
+ }
16
+ getConfig = () => {
17
+ const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/db-mgmt`;
18
+ return {
19
+ baseURL: SERVICE_API_ROOT_URL,
20
+ headers: {
21
+ common: {
22
+ 'x-api-key': this.DB_MGMT_API_KEY
23
+ }
24
+ }
25
+ };
26
+ };
27
+ getClient = async () => {
28
+ return (0, http_client_js_1.axiosHttpService)(this.getConfig());
29
+ };
30
+ getLatestSession = async (pixelId, ipAddress, userAgent, domain) => {
31
+ const client = await this.getClient();
32
+ const response = await client.post('/query/session', { pixelId, ipAddress, userAgent: domain });
33
+ lambda_log_1.default.debug('getLatestSession', { response });
34
+ return response;
35
+ };
36
+ }
37
+ exports.DbMgmtClient = DbMgmtClient;
38
+ //# sourceMappingURL=db-management-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-management-client.js","sourceRoot":"","sources":["../../../../src/clients/internal-api/db-management-client.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA6B;AAE7B,8DAA6D;AAM7D,MAAa,YAAY;IAEhB,YAAY,CAAS;IACrB,eAAe,CAAS;IAE/B,YAAY,UAAkB,EAAE,YAAoB;QAClD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC;IACtC,CAAC;IAED,SAAS,GAAG,GAAG,EAAE;QACf,MAAM,oBAAoB,GAAG,GAAG,IAAI,CAAC,YAAY,UAAU,CAAC;QAC5D,OAAO;YACL,OAAO,EAAE,oBAAoB;YAC7B,OAAO,EAAE;gBACP,MAAM,EAAE;oBACN,WAAW,EAAE,IAAI,CAAC,eAAe;iBAClC;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IAEF,SAAS,GAAG,KAAK,IAAI,EAAE;QACrB,OAAO,IAAA,iCAAgB,EAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5C,CAAC,CAAC;IAEF,gBAAgB,GAAG,KAAK,EAAE,OAAe,EAAE,SAAiB,EAAE,SAAiB,EAAE,MAAc,EAAmD,EAAE;QAClJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAChG,oBAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5C,OAAO,QAAkD,CAAC;IAC5D,CAAC,CAAC;CAGH;AAlCD,oCAkCC"}
@@ -3,3 +3,4 @@ export * from './accounts-client.js';
3
3
  export * from './users-auth-client.js';
4
4
  export * from './shopify-app-install-client.js';
5
5
  export * from './identity-client.js';
6
+ export * from './db-management-client.js';
@@ -19,4 +19,5 @@ __exportStar(require("./accounts-client.js"), exports);
19
19
  __exportStar(require("./users-auth-client.js"), exports);
20
20
  __exportStar(require("./shopify-app-install-client.js"), exports);
21
21
  __exportStar(require("./identity-client.js"), exports);
22
+ __exportStar(require("./db-management-client.js"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/clients/internal-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,uDAAqC;AACrC,yDAAuC;AACvC,kEAAgD;AAChD,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/clients/internal-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,uDAAqC;AACrC,yDAAuC;AACvC,kEAAgD;AAChD,uDAAqC;AACrC,4DAA0C"}
@@ -0,0 +1,48 @@
1
+ import { ApiResponse } from '../../types/api-response.js';
2
+ export interface LatestSessionResponseData {
3
+ identityId?: string;
4
+ sessionId?: string;
5
+ }
6
+ export declare class DbMgmtClient {
7
+ BASE_API_URL: string;
8
+ DB_MGMT_API_KEY: string;
9
+ constructor(baseApiUrl: string, dbMgmtApiKey: string);
10
+ getConfig: () => {
11
+ baseURL: string;
12
+ headers: {
13
+ common: {
14
+ 'x-api-key': string;
15
+ };
16
+ };
17
+ };
18
+ getClient: () => Promise<{
19
+ instance: () => import("axios").AxiosInstance;
20
+ get: (url: string, config?: any) => Promise<{
21
+ headers: any;
22
+ data: any;
23
+ status: any;
24
+ }>;
25
+ post: (url: string, data?: any, config?: any) => Promise<{
26
+ headers: any;
27
+ data: any;
28
+ status: any;
29
+ }>;
30
+ delete: (url: string, config?: any) => Promise<{
31
+ headers: any;
32
+ data: any;
33
+ status: any;
34
+ }>;
35
+ put: (url: string, data?: any, config?: any) => Promise<{
36
+ headers: any;
37
+ data: any;
38
+ status: any;
39
+ }>;
40
+ patch: (url: string, data?: any, config?: any) => Promise<{
41
+ headers: any;
42
+ data: any;
43
+ status: any;
44
+ }>;
45
+ setBaseUrl: (url: string) => boolean;
46
+ }>;
47
+ getLatestSession: (pixelId: string, ipAddress: string, userAgent: string, domain: string) => Promise<ApiResponse<LatestSessionResponseData>>;
48
+ }
@@ -0,0 +1,31 @@
1
+ import log from 'lambda-log';
2
+ import { axiosHttpService } from '../generic/http-client.js';
3
+ export class DbMgmtClient {
4
+ BASE_API_URL;
5
+ DB_MGMT_API_KEY;
6
+ constructor(baseApiUrl, dbMgmtApiKey) {
7
+ this.BASE_API_URL = baseApiUrl;
8
+ this.DB_MGMT_API_KEY = dbMgmtApiKey;
9
+ }
10
+ getConfig = () => {
11
+ const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/db-mgmt`;
12
+ return {
13
+ baseURL: SERVICE_API_ROOT_URL,
14
+ headers: {
15
+ common: {
16
+ 'x-api-key': this.DB_MGMT_API_KEY
17
+ }
18
+ }
19
+ };
20
+ };
21
+ getClient = async () => {
22
+ return axiosHttpService(this.getConfig());
23
+ };
24
+ getLatestSession = async (pixelId, ipAddress, userAgent, domain) => {
25
+ const client = await this.getClient();
26
+ const response = await client.post('/query/session', { pixelId, ipAddress, userAgent: domain });
27
+ log.debug('getLatestSession', { response });
28
+ return response;
29
+ };
30
+ }
31
+ //# sourceMappingURL=db-management-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-management-client.js","sourceRoot":"","sources":["../../../../src/clients/internal-api/db-management-client.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAM7D,MAAM,OAAO,YAAY;IAEhB,YAAY,CAAS;IACrB,eAAe,CAAS;IAE/B,YAAY,UAAkB,EAAE,YAAoB;QAClD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC;IACtC,CAAC;IAED,SAAS,GAAG,GAAG,EAAE;QACf,MAAM,oBAAoB,GAAG,GAAG,IAAI,CAAC,YAAY,UAAU,CAAC;QAC5D,OAAO;YACL,OAAO,EAAE,oBAAoB;YAC7B,OAAO,EAAE;gBACP,MAAM,EAAE;oBACN,WAAW,EAAE,IAAI,CAAC,eAAe;iBAClC;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IAEF,SAAS,GAAG,KAAK,IAAI,EAAE;QACrB,OAAO,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5C,CAAC,CAAC;IAEF,gBAAgB,GAAG,KAAK,EAAE,OAAe,EAAE,SAAiB,EAAE,SAAiB,EAAE,MAAc,EAAmD,EAAE;QAClJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAChG,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5C,OAAO,QAAkD,CAAC;IAC5D,CAAC,CAAC;CAGH"}
@@ -3,3 +3,4 @@ export * from './accounts-client.js';
3
3
  export * from './users-auth-client.js';
4
4
  export * from './shopify-app-install-client.js';
5
5
  export * from './identity-client.js';
6
+ export * from './db-management-client.js';
@@ -3,4 +3,5 @@ export * from './accounts-client.js';
3
3
  export * from './users-auth-client.js';
4
4
  export * from './shopify-app-install-client.js';
5
5
  export * from './identity-client.js';
6
+ export * from './db-management-client.js';
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/clients/internal-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/clients/internal-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtrackify/at-service-common",
3
- "version": "2.0.14",
3
+ "version": "2.0.16",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist/*"
@@ -50,12 +50,12 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@adtrackify/at-tracking-event-types": "^2.0.2",
53
- "@aws-sdk/client-cognito-identity-provider": "^3.282.0",
54
- "@aws-sdk/client-dynamodb": "^3.278.0",
55
- "@aws-sdk/client-eventbridge": "^3.278.0",
56
- "@aws-sdk/client-s3": "^3.282.0",
57
- "@aws-sdk/client-sqs": "^3.310.0",
58
- "@aws-sdk/lib-dynamodb": "^3.279.0",
53
+ "@aws-sdk/client-cognito-identity-provider": "^3.345.0",
54
+ "@aws-sdk/client-dynamodb": "^3.345.0",
55
+ "@aws-sdk/client-eventbridge": "^3.345.0",
56
+ "@aws-sdk/client-s3": "^3.345.0",
57
+ "@aws-sdk/client-sqs": "^3.345.0",
58
+ "@aws-sdk/lib-dynamodb": "^3.345.0",
59
59
  "@faker-js/faker": "^7.5.0",
60
60
  "@swc/core": "^1.3.1",
61
61
  "@swc/jest": "^0.2.22",