@adtrackify/at-service-common 1.0.24 → 1.0.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.
package/dist/index.d.ts CHANGED
@@ -77,6 +77,10 @@ declare module '@adtrackify/at-service-common/clients/index' {
77
77
  }
78
78
  declare module '@adtrackify/at-service-common/clients/internal-api/accounts-client' {
79
79
  import { ApiResponse } from '@adtrackify/at-service-common/types/api-response';
80
+ export interface IsAuthorizedUserResponseData {
81
+ isAccountUser: boolean;
82
+ [key: string]: any;
83
+ }
80
84
  export class AccountsClient {
81
85
  BASE_API_URL: string;
82
86
  ACCOUNTS_API_KEY: string;
@@ -120,16 +124,19 @@ declare module '@adtrackify/at-service-common/clients/internal-api/accounts-clie
120
124
  }>;
121
125
  isAuthorizedUser: (userId: string, accountId: string, pixelId: string) => Promise<ApiResponse<IsAuthorizedUserResponseData>>;
122
126
  }
123
- export interface IsAuthorizedUserResponseData {
124
- isAccountUser: boolean;
125
- [key: string]: any;
126
- }
127
- export default AccountsClient;
128
127
 
129
128
  }
130
129
  declare module '@adtrackify/at-service-common/clients/internal-api/destinations-client' {
131
130
  import { ApiResponse } from '@adtrackify/at-service-common/types/api-response';
132
131
  import { Destination } from '@adtrackify/at-service-common/types/db/destination';
132
+ export interface GetDestinationsResponseData {
133
+ destinations: Destination[];
134
+ [key: string]: any;
135
+ }
136
+ export interface CreateDestinationResponseData {
137
+ destination: Destination;
138
+ [key: string]: any;
139
+ }
133
140
  export class DestinationsClient {
134
141
  BASE_API_URL: string;
135
142
  DESTINATIONS_API_KEY: string;
@@ -174,15 +181,6 @@ declare module '@adtrackify/at-service-common/clients/internal-api/destinations-
174
181
  createDestination: (createDestinationRequest: any) => Promise<ApiResponse<CreateDestinationResponseData>>;
175
182
  getPixelDestinations: (pixelId: string) => Promise<ApiResponse<GetDestinationsResponseData>>;
176
183
  }
177
- export interface GetDestinationsResponseData {
178
- destinations: Destination[];
179
- [key: string]: any;
180
- }
181
- export interface CreateDestinationResponseData {
182
- destination: Destination;
183
- [key: string]: any;
184
- }
185
- export default DestinationsClient;
186
184
 
187
185
  }
188
186
  declare module '@adtrackify/at-service-common/clients/internal-api/index' {
@@ -245,7 +243,7 @@ declare module '@adtrackify/at-service-common/helpers/response-helper' {
245
243
 
246
244
  }
247
245
  declare module '@adtrackify/at-service-common/index' {
248
- export * from '@adtrackify/at-service-common/clients/generic/index';
246
+ export * from '@adtrackify/at-service-common/clients/index';
249
247
  export * from '@adtrackify/at-service-common/helpers/index';
250
248
  export * from '@adtrackify/at-service-common/libs/index';
251
249
  export * from '@adtrackify/at-service-common/types/index';
package/dist/index.js CHANGED
@@ -240268,22 +240268,22 @@ var require_managed_upload = __commonJS({
240268
240268
  data.Bucket = this.request.params.Bucket;
240269
240269
  upload.callback(err, data);
240270
240270
  },
240271
- progress: function progress(info3) {
240271
+ progress: function progress(info5) {
240272
240272
  var upload = this._managedUpload;
240273
240273
  if (this.operation === "putObject") {
240274
- info3.part = 1;
240275
- info3.key = this.params.Key;
240274
+ info5.part = 1;
240275
+ info5.key = this.params.Key;
240276
240276
  } else {
240277
- upload.totalUploadedBytes += info3.loaded - this._lastUploadedBytes;
240278
- this._lastUploadedBytes = info3.loaded;
240279
- info3 = {
240277
+ upload.totalUploadedBytes += info5.loaded - this._lastUploadedBytes;
240278
+ this._lastUploadedBytes = info5.loaded;
240279
+ info5 = {
240280
240280
  loaded: upload.totalUploadedBytes,
240281
240281
  total: upload.totalBytes,
240282
240282
  part: this.params.PartNumber,
240283
240283
  key: this.params.Key
240284
240284
  };
240285
240285
  }
240286
- upload.emit("httpUploadProgress", [info3]);
240286
+ upload.emit("httpUploadProgress", [info5]);
240287
240287
  }
240288
240288
  });
240289
240289
  AWS3.util.mixin(AWS3.S3.ManagedUpload, AWS3.SequentialExecutor);
@@ -628118,6 +628118,79 @@ var axiosHttpService = (config = {}) => {
628118
628118
  };
628119
628119
  };
628120
628120
 
628121
+ // src/clients/internal-api/destinations-client.ts
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 response = await client2.post("/", createDestinationRequest);
628147
+ log2.info("createDestinationResponse", { response });
628148
+ return response;
628149
+ };
628150
+ getPixelDestinations = async (pixelId) => {
628151
+ const client2 = await this.getClient();
628152
+ const response = await client2.get(`/?pixelId=${pixelId}`);
628153
+ log2.info("getPixelResponse", { response });
628154
+ return response;
628155
+ };
628156
+ };
628157
+
628158
+ // src/clients/internal-api/accounts-client.ts
628159
+ import * as log3 from "lambda-log";
628160
+ var AccountsClient = class {
628161
+ BASE_API_URL;
628162
+ ACCOUNTS_API_KEY;
628163
+ constructor(baseApiUrl, accountsApiKey) {
628164
+ this.BASE_API_URL = baseApiUrl;
628165
+ this.ACCOUNTS_API_KEY = accountsApiKey;
628166
+ }
628167
+ getConfig = () => {
628168
+ const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;
628169
+ return {
628170
+ baseURL: SERVICE_API_ROOT_URL,
628171
+ headers: {
628172
+ common: {
628173
+ "x-api-key": this.ACCOUNTS_API_KEY
628174
+ }
628175
+ }
628176
+ };
628177
+ };
628178
+ getClient = async () => {
628179
+ return axiosHttpService(this.getConfig());
628180
+ };
628181
+ isAuthorizedUser = async (userId, accountId, pixelId) => {
628182
+ const client2 = await this.getClient();
628183
+ const body = {
628184
+ userId,
628185
+ accountId,
628186
+ pixelId
628187
+ };
628188
+ const response = await client2.post("/checkUserAuthorization", body);
628189
+ log3.info("checkUserAuthorization", { response });
628190
+ return response;
628191
+ };
628192
+ };
628193
+
628121
628194
  // src/libs/http-error.ts
628122
628195
  import { strict as assert } from "assert";
628123
628196
  var deepClone = (o = {}) => JSON.parse(JSON.stringify(o));
@@ -628200,11 +628273,11 @@ __publicField(HttpError, "serviceUnavailable", (headers) => new _HttpError(503,
628200
628273
  __publicField(HttpError, "gatewayTimeout", () => new _HttpError(504));
628201
628274
 
628202
628275
  // src/helpers/input-validation-helper.ts
628203
- import * as log2 from "lambda-log";
628276
+ import * as log4 from "lambda-log";
628204
628277
  var validateInput = (schema, input) => {
628205
628278
  const { error: error2, value } = schema.validate(input);
628206
628279
  if (error2) {
628207
- log2.info("", { error: error2 });
628280
+ log4.info("", { error: error2 });
628208
628281
  const httperr = HttpError.badRequest("Input Validation Failure", {
628209
628282
  errors: error2.details.map((detail) => ({
628210
628283
  message: detail?.message,
@@ -628212,21 +628285,21 @@ var validateInput = (schema, input) => {
628212
628285
  path: detail?.path
628213
628286
  }))
628214
628287
  });
628215
- log2.info("", { httperr });
628288
+ log4.info("", { httperr });
628216
628289
  throw httperr;
628217
628290
  }
628218
628291
  return value;
628219
628292
  };
628220
628293
 
628221
628294
  // src/helpers/logging-helper.ts
628222
- import * as log3 from "lambda-log";
628295
+ import * as log5 from "lambda-log";
628223
628296
  var stage = process?.env?.STAGE;
628224
628297
  var configureLogger = (event, context, debug = true) => {
628225
- log3.options.meta.stage = stage;
628226
- log3.options.meta.source_name = context?.functionName || "unknown";
628227
- log3.options.meta.awsRequestId = context?.awsRequestId || "unknown";
628228
- log3.options.meta.lambdaEvent = event;
628229
- log3.options.debug = debug;
628298
+ log5.options.meta.stage = stage;
628299
+ log5.options.meta.source_name = context?.functionName || "unknown";
628300
+ log5.options.meta.awsRequestId = context?.awsRequestId || "unknown";
628301
+ log5.options.meta.lambdaEvent = event;
628302
+ log5.options.debug = debug;
628230
628303
  };
628231
628304
 
628232
628305
  // src/helpers/response-helper.ts
@@ -628341,7 +628414,9 @@ var DESTINATIONS = /* @__PURE__ */ ((DESTINATIONS2) => {
628341
628414
  return DESTINATIONS2;
628342
628415
  })(DESTINATIONS || {});
628343
628416
  export {
628417
+ AccountsClient,
628344
628418
  DESTINATIONS,
628419
+ DestinationsClient,
628345
628420
  DynamoDbClient,
628346
628421
  EventBridgeClient,
628347
628422
  HttpError,