@adtrackify/at-service-common 1.0.18 → 1.0.20

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
@@ -77,7 +77,7 @@ declare module '@adtrackify/at-service-common/clients/index' {
77
77
  }
78
78
  declare module '@adtrackify/at-service-common/clients/internal-api/destinations-client' {
79
79
  import { Destination } from 'aws-sdk/clients/lexmodelbuildingservice';
80
- import { ApiResponse } from '@adtrackify/at-service-common/types/api-response';
80
+ import { ApiResponse, ErrorData } from '@adtrackify/at-service-common/types/api-response';
81
81
  export class DestinationsClient {
82
82
  BASE_API_URL: string;
83
83
  DESTINATIONS_API_KEY: string;
@@ -124,7 +124,7 @@ declare module '@adtrackify/at-service-common/clients/internal-api/destinations-
124
124
  } | any>>;
125
125
  getPixelDestinations: (pixelId: string) => Promise<ApiResponse<{
126
126
  destinations: Destination[];
127
- } | any>>;
127
+ } | ErrorData>>;
128
128
  }
129
129
  export default DestinationsClient;
130
130
 
@@ -303,6 +303,7 @@ declare module '@adtrackify/at-service-common/types/api-response' {
303
303
  status: number;
304
304
  headers?: AxiosResponseHeaders;
305
305
  }
306
+ export type ErrorData = any;
306
307
 
307
308
  }
308
309
  declare module '@adtrackify/at-service-common/types/db/destination' {
package/dist/index.js CHANGED
@@ -628120,39 +628120,12 @@ var axiosHttpService = (config = {}) => {
628120
628120
 
628121
628121
  // src/clients/internal-api/destinations-client.ts
628122
628122
  import * as log2 from "lambda-log";
628123
- var DestinationsClient = class {
628124
- BASE_API_URL;
628125
- DESTINATIONS_API_KEY;
628126
- constructor(baseApiUrl, destinationsApiKey) {
628127
- this.BASE_API_URL = baseApiUrl;
628128
- this.DESTINATIONS_API_KEY = destinationsApiKey;
628129
- }
628130
- getConfig = () => {
628131
- const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;
628132
- return {
628133
- baseURL: SERVICE_API_ROOT_URL,
628134
- headers: {
628135
- common: {
628136
- "x-api-key": this.DESTINATIONS_API_KEY
628137
- }
628138
- }
628139
- };
628140
- };
628141
- getClient = async () => {
628142
- return axiosHttpService(this.getConfig());
628143
- };
628144
- createDestination = async (createDestinationRequest) => {
628145
- const client2 = await this.getClient();
628146
- const createDestinationResponse = await client2.post("/", createDestinationRequest);
628147
- log2.info("createDestinationResponse", { createDestinationResponse });
628148
- return createDestinationResponse;
628149
- };
628150
- getPixelDestinations = async (pixelId) => {
628151
- const client2 = await this.getClient();
628152
- const pixelDestinationsResponse = await client2.get(`/?pixelId=${pixelId}`);
628153
- log2.info("pixelDestinationsResponse", { pixelDestinationsResponse });
628154
- return pixelDestinationsResponse;
628155
- };
628123
+
628124
+ // src/libs/crypto.ts
628125
+ import crypto from "crypto";
628126
+ var generatePublicKey = () => {
628127
+ const publicKey = crypto.randomBytes(26);
628128
+ return publicKey.toString("utf8");
628156
628129
  };
628157
628130
 
628158
628131
  // src/libs/http-error.ts
@@ -628236,6 +628209,111 @@ __publicField(HttpError, "badGateway", () => new _HttpError(502));
628236
628209
  __publicField(HttpError, "serviceUnavailable", (headers) => new _HttpError(503, void 0, void 0, headers));
628237
628210
  __publicField(HttpError, "gatewayTimeout", () => new _HttpError(504));
628238
628211
 
628212
+ // src/libs/http-status-codes.ts
628213
+ var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
628214
+ HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
628215
+ HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
628216
+ HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
628217
+ HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
628218
+ HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
628219
+ HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
628220
+ HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
628221
+ HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
628222
+ HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
628223
+ HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
628224
+ HttpStatusCodes2[HttpStatusCodes2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
628225
+ HttpStatusCodes2[HttpStatusCodes2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
628226
+ HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
628227
+ HttpStatusCodes2[HttpStatusCodes2["MOVED_TEMPORARILY"] = 302] = "MOVED_TEMPORARILY";
628228
+ HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
628229
+ HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
628230
+ HttpStatusCodes2[HttpStatusCodes2["USE_PROXY"] = 305] = "USE_PROXY";
628231
+ HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
628232
+ HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
628233
+ HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
628234
+ HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
628235
+ HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
628236
+ HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
628237
+ HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
628238
+ HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
628239
+ HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
628240
+ HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
628241
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
628242
+ HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
628243
+ HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
628244
+ HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
628245
+ HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
628246
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_TOO_LONG"] = 413] = "REQUEST_TOO_LONG";
628247
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
628248
+ HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
628249
+ HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
628250
+ HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
628251
+ HttpStatusCodes2[HttpStatusCodes2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
628252
+ HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_SPACE_ON_RESOURCE"] = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE";
628253
+ HttpStatusCodes2[HttpStatusCodes2["METHOD_FAILURE"] = 420] = "METHOD_FAILURE";
628254
+ HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
628255
+ HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
628256
+ HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
628257
+ HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
628258
+ HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
628259
+ HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
628260
+ HttpStatusCodes2[HttpStatusCodes2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
628261
+ HttpStatusCodes2[HttpStatusCodes2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
628262
+ HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
628263
+ HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
628264
+ HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
628265
+ HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
628266
+ HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
628267
+ HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
628268
+ HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
628269
+ HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
628270
+ return HttpStatusCodes2;
628271
+ })(HttpStatusCodes || {});
628272
+
628273
+ // src/clients/internal-api/destinations-client.ts
628274
+ var DestinationsClient = class {
628275
+ BASE_API_URL;
628276
+ DESTINATIONS_API_KEY;
628277
+ constructor(baseApiUrl, destinationsApiKey) {
628278
+ this.BASE_API_URL = baseApiUrl;
628279
+ this.DESTINATIONS_API_KEY = destinationsApiKey;
628280
+ }
628281
+ getConfig = () => {
628282
+ const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;
628283
+ return {
628284
+ baseURL: SERVICE_API_ROOT_URL,
628285
+ headers: {
628286
+ common: {
628287
+ "x-api-key": this.DESTINATIONS_API_KEY
628288
+ }
628289
+ }
628290
+ };
628291
+ };
628292
+ getClient = async () => {
628293
+ return axiosHttpService(this.getConfig());
628294
+ };
628295
+ createDestination = async (createDestinationRequest) => {
628296
+ const client2 = await this.getClient();
628297
+ const createDestinationResponse = await client2.post("/", createDestinationRequest);
628298
+ log2.info("createDestinationResponse", { createDestinationResponse });
628299
+ return {
628300
+ status: createDestinationResponse.status,
628301
+ headers: createDestinationResponse.headers,
628302
+ data: createDestinationResponse.status === 200 /* OK */ ? createDestinationResponse.data : createDestinationResponse.data
628303
+ };
628304
+ };
628305
+ getPixelDestinations = async (pixelId) => {
628306
+ const client2 = await this.getClient();
628307
+ const response = await client2.get(`/?pixelId=${pixelId}`);
628308
+ log2.info("getPixelResponse", { response });
628309
+ return {
628310
+ status: response.status,
628311
+ headers: response.headers,
628312
+ data: response.status === 200 /* OK */ ? response.data : response.data
628313
+ };
628314
+ };
628315
+ };
628316
+
628239
628317
  // src/helpers/input-validation-helper.ts
628240
628318
  import * as log3 from "lambda-log";
628241
628319
  var validateInput = (schema, input) => {
@@ -628301,74 +628379,6 @@ var buildResponse = (statusCode, body = {}) => {
628301
628379
  };
628302
628380
  };
628303
628381
 
628304
- // src/libs/crypto.ts
628305
- import crypto from "crypto";
628306
- var generatePublicKey = () => {
628307
- const publicKey = crypto.randomBytes(26);
628308
- return publicKey.toString("utf8");
628309
- };
628310
-
628311
- // src/libs/http-status-codes.ts
628312
- var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
628313
- HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
628314
- HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
628315
- HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
628316
- HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
628317
- HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
628318
- HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
628319
- HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
628320
- HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
628321
- HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
628322
- HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
628323
- HttpStatusCodes2[HttpStatusCodes2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
628324
- HttpStatusCodes2[HttpStatusCodes2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
628325
- HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
628326
- HttpStatusCodes2[HttpStatusCodes2["MOVED_TEMPORARILY"] = 302] = "MOVED_TEMPORARILY";
628327
- HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
628328
- HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
628329
- HttpStatusCodes2[HttpStatusCodes2["USE_PROXY"] = 305] = "USE_PROXY";
628330
- HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
628331
- HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
628332
- HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
628333
- HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
628334
- HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
628335
- HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
628336
- HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
628337
- HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
628338
- HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
628339
- HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
628340
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
628341
- HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
628342
- HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
628343
- HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
628344
- HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
628345
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_TOO_LONG"] = 413] = "REQUEST_TOO_LONG";
628346
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
628347
- HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
628348
- HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
628349
- HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
628350
- HttpStatusCodes2[HttpStatusCodes2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
628351
- HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_SPACE_ON_RESOURCE"] = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE";
628352
- HttpStatusCodes2[HttpStatusCodes2["METHOD_FAILURE"] = 420] = "METHOD_FAILURE";
628353
- HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
628354
- HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
628355
- HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
628356
- HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
628357
- HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
628358
- HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
628359
- HttpStatusCodes2[HttpStatusCodes2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
628360
- HttpStatusCodes2[HttpStatusCodes2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
628361
- HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
628362
- HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
628363
- HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
628364
- HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
628365
- HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
628366
- HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
628367
- HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
628368
- HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
628369
- return HttpStatusCodes2;
628370
- })(HttpStatusCodes || {});
628371
-
628372
628382
  // src/types/db/destinations.ts
628373
628383
  var DESTINATIONS = /* @__PURE__ */ ((DESTINATIONS2) => {
628374
628384
  DESTINATIONS2["FACEBOOK"] = "facebook";