@adtrackify/at-service-common 1.0.25 → 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 +13 -13
- package/dist/index.js +91 -16
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/src/clients/internal-api/accounts-client.ts +7 -6
- package/src/clients/internal-api/destinations-client.ts +10 -10
- package/src/index.ts +1 -1
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,15 +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
127
|
|
|
128
128
|
}
|
|
129
129
|
declare module '@adtrackify/at-service-common/clients/internal-api/destinations-client' {
|
|
130
130
|
import { ApiResponse } from '@adtrackify/at-service-common/types/api-response';
|
|
131
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
|
+
}
|
|
132
140
|
export class DestinationsClient {
|
|
133
141
|
BASE_API_URL: string;
|
|
134
142
|
DESTINATIONS_API_KEY: string;
|
|
@@ -173,14 +181,6 @@ declare module '@adtrackify/at-service-common/clients/internal-api/destinations-
|
|
|
173
181
|
createDestination: (createDestinationRequest: any) => Promise<ApiResponse<CreateDestinationResponseData>>;
|
|
174
182
|
getPixelDestinations: (pixelId: string) => Promise<ApiResponse<GetDestinationsResponseData>>;
|
|
175
183
|
}
|
|
176
|
-
export interface GetDestinationsResponseData {
|
|
177
|
-
destinations: Destination[];
|
|
178
|
-
[key: string]: any;
|
|
179
|
-
}
|
|
180
|
-
export interface CreateDestinationResponseData {
|
|
181
|
-
destination: Destination;
|
|
182
|
-
[key: string]: any;
|
|
183
|
-
}
|
|
184
184
|
|
|
185
185
|
}
|
|
186
186
|
declare module '@adtrackify/at-service-common/clients/internal-api/index' {
|
|
@@ -243,7 +243,7 @@ declare module '@adtrackify/at-service-common/helpers/response-helper' {
|
|
|
243
243
|
|
|
244
244
|
}
|
|
245
245
|
declare module '@adtrackify/at-service-common/index' {
|
|
246
|
-
export * from '@adtrackify/at-service-common/clients/
|
|
246
|
+
export * from '@adtrackify/at-service-common/clients/index';
|
|
247
247
|
export * from '@adtrackify/at-service-common/helpers/index';
|
|
248
248
|
export * from '@adtrackify/at-service-common/libs/index';
|
|
249
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(
|
|
240271
|
+
progress: function progress(info5) {
|
|
240272
240272
|
var upload = this._managedUpload;
|
|
240273
240273
|
if (this.operation === "putObject") {
|
|
240274
|
-
|
|
240275
|
-
|
|
240274
|
+
info5.part = 1;
|
|
240275
|
+
info5.key = this.params.Key;
|
|
240276
240276
|
} else {
|
|
240277
|
-
upload.totalUploadedBytes +=
|
|
240278
|
-
this._lastUploadedBytes =
|
|
240279
|
-
|
|
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", [
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
628295
|
+
import * as log5 from "lambda-log";
|
|
628223
628296
|
var stage = process?.env?.STAGE;
|
|
628224
628297
|
var configureLogger = (event, context, debug = true) => {
|
|
628225
|
-
|
|
628226
|
-
|
|
628227
|
-
|
|
628228
|
-
|
|
628229
|
-
|
|
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,
|