@adtrackify/at-service-common 1.1.20 → 1.2.0
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/__tests__/helpers/subscription-helper.spec.d.ts +1 -0
- package/dist/__tests__/helpers/subscription-helper.spec.js +28 -0
- package/dist/__tests__/helpers/subscription-helper.spec.js.map +1 -0
- package/dist/clients/generic/cognito-client.d.ts +19 -0
- package/dist/clients/generic/cognito-client.js +140 -0
- package/dist/clients/generic/cognito-client.js.map +1 -0
- package/dist/clients/generic/dynamodb-client.d.ts +15 -0
- package/dist/clients/generic/dynamodb-client.js +123 -0
- package/dist/clients/generic/dynamodb-client.js.map +1 -0
- package/dist/clients/generic/eventbridge-client.d.ts +14 -0
- package/dist/clients/generic/eventbridge-client.js +46 -0
- package/dist/clients/generic/eventbridge-client.js.map +1 -0
- package/dist/clients/generic/http-client.d.ts +29 -0
- package/dist/clients/generic/http-client.js +30 -0
- package/dist/clients/generic/http-client.js.map +1 -0
- package/{src/clients/generic/index.ts → dist/clients/generic/index.d.ts} +5 -5
- package/dist/clients/generic/index.js +6 -0
- package/dist/clients/generic/index.js.map +1 -0
- package/dist/clients/generic/s3-client.d.ts +6 -0
- package/dist/clients/generic/s3-client.js +25 -0
- package/dist/clients/generic/s3-client.js.map +1 -0
- package/{src/clients/index.ts → dist/clients/index.d.ts} +3 -3
- package/dist/clients/index.js +4 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/internal-api/accounts-client.d.ts +82 -0
- package/dist/clients/internal-api/accounts-client.js +79 -0
- package/dist/clients/internal-api/accounts-client.js.map +1 -0
- package/dist/clients/internal-api/destinations-client.d.ts +54 -0
- package/dist/clients/internal-api/destinations-client.js +37 -0
- package/dist/clients/internal-api/destinations-client.js.map +1 -0
- package/{src/clients/internal-api/index.ts → dist/clients/internal-api/index.d.ts} +4 -4
- package/dist/clients/internal-api/index.js +5 -0
- package/dist/clients/internal-api/index.js.map +1 -0
- package/dist/clients/internal-api/shopify-app-install-client.d.ts +57 -0
- package/dist/clients/internal-api/shopify-app-install-client.js +43 -0
- package/dist/clients/internal-api/shopify-app-install-client.js.map +1 -0
- package/dist/clients/internal-api/users-auth-client.d.ts +61 -0
- package/dist/clients/internal-api/users-auth-client.js +74 -0
- package/dist/clients/internal-api/users-auth-client.js.map +1 -0
- package/dist/clients/third-party/index.d.ts +1 -0
- package/dist/clients/third-party/index.js +2 -0
- package/dist/clients/third-party/index.js.map +1 -0
- package/dist/clients/third-party/shopify-client.d.ts +90 -0
- package/dist/clients/third-party/shopify-client.js +122 -0
- package/dist/clients/third-party/shopify-client.js.map +1 -0
- package/{src/helpers/index.ts → dist/helpers/index.d.ts} +5 -5
- package/dist/helpers/index.js +6 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/input-validation-helper.d.ts +2 -0
- package/dist/helpers/input-validation-helper.js +19 -0
- package/dist/helpers/input-validation-helper.js.map +1 -0
- package/dist/helpers/logging-helper.d.ts +1 -0
- package/dist/helpers/logging-helper.js +10 -0
- package/dist/helpers/logging-helper.js.map +1 -0
- package/dist/helpers/response-helper.d.ts +36 -0
- package/dist/helpers/response-helper.js +36 -0
- package/dist/helpers/response-helper.js.map +1 -0
- package/dist/helpers/shopify-helper.d.ts +9 -0
- package/dist/helpers/shopify-helper.js +24 -0
- package/dist/helpers/shopify-helper.js.map +1 -0
- package/dist/helpers/subscription-helper.d.ts +8 -0
- package/dist/helpers/subscription-helper.js +182 -0
- package/dist/helpers/subscription-helper.js.map +1 -0
- package/dist/index.d.ts +5 -737
- package/dist/index.esm.js +6 -2
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +6 -1404
- package/dist/index.js.map +1 -7
- package/dist/libs/crypto.d.ts +1 -0
- package/dist/libs/crypto.js +6 -0
- package/dist/libs/crypto.js.map +1 -0
- package/dist/libs/dates.d.ts +3 -0
- package/dist/libs/dates.js +11 -0
- package/dist/libs/dates.js.map +1 -0
- package/dist/libs/http-error.d.ts +21 -0
- package/dist/libs/http-error.js +56 -0
- package/dist/libs/http-error.js.map +1 -0
- package/dist/libs/http-status-codes.d.ts +58 -0
- package/dist/libs/http-status-codes.js +60 -0
- package/dist/libs/http-status-codes.js.map +1 -0
- package/{src/libs/index.ts → dist/libs/index.d.ts} +6 -7
- package/dist/libs/index.js +7 -0
- package/dist/libs/index.js.map +1 -0
- package/dist/libs/url.d.ts +1 -0
- package/dist/libs/url.js +10 -0
- package/dist/libs/url.js.map +1 -0
- package/dist/services/eventbridge-integration-service.d.ts +9 -0
- package/dist/services/eventbridge-integration-service.js +25 -0
- package/dist/services/eventbridge-integration-service.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -0
- package/{src/types/api-response.ts → dist/types/api-response.d.ts} +6 -6
- package/dist/types/api-response.js +2 -0
- package/dist/types/api-response.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/internal-events/event-detail-types.d.ts +20 -0
- package/dist/types/internal-events/event-detail-types.js +25 -0
- package/dist/types/internal-events/event-detail-types.js.map +1 -0
- package/dist/types/internal-events/index.d.ts +1 -0
- package/dist/types/internal-events/index.js +2 -0
- package/dist/types/internal-events/index.js.map +1 -0
- package/package.json +11 -10
- package/.editorconfig +0 -12
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -37
- package/.husky/pre-push +0 -4
- package/.vscode/settings.json +0 -10
- package/bitbucket-pipelines.yml +0 -20
- package/build.js +0 -39
- package/env.yml +0 -9
- package/jest.config.ts +0 -41
- package/src/__tests__/helpers/subscription-helper.spec.ts +0 -41
- package/src/clients/generic/axios.d.ts +0 -8
- package/src/clients/generic/cognito-client.ts +0 -154
- package/src/clients/generic/dynamodb-client.ts +0 -127
- package/src/clients/generic/eventbridge-client.ts +0 -53
- package/src/clients/generic/http-client.ts +0 -34
- package/src/clients/generic/s3-client.ts +0 -27
- package/src/clients/internal-api/accounts-client.ts +0 -126
- package/src/clients/internal-api/destinations-client.ts +0 -58
- package/src/clients/internal-api/shopify-app-install-client.ts +0 -66
- package/src/clients/internal-api/users-auth-client.ts +0 -112
- package/src/clients/third-party/index.ts +0 -1
- package/src/clients/third-party/shopify-client.ts +0 -139
- package/src/helpers/input-validation-helper.ts +0 -22
- package/src/helpers/logging-helper.ts +0 -10
- package/src/helpers/response-helper.ts +0 -40
- package/src/helpers/shopify-helper.ts +0 -39
- package/src/helpers/subscription-helper.ts +0 -243
- package/src/index.ts +0 -5
- package/src/libs/crypto.ts +0 -6
- package/src/libs/dates.ts +0 -14
- package/src/libs/http-error.ts +0 -90
- package/src/libs/http-status-codes.ts +0 -344
- package/src/libs/url.ts +0 -10
- package/src/services/eventbridge-integration-service.ts +0 -44
- package/src/services/index.ts +0 -1
- package/src/types/index.ts +0 -1
- package/src/types/internal-events/event-detail-types.ts +0 -10
- package/src/types/internal-events/index.ts +0 -1
- package/tsconfig.json +0 -35
- package/tsconfig.tsbuildinfo +0 -1
- package/tslint.json +0 -6
package/dist/index.js
CHANGED
|
@@ -1,1404 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var __publicField = (obj, key, value) => {
|
|
31
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
|
-
return value;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// src/index.ts
|
|
36
|
-
var src_exports = {};
|
|
37
|
-
__export(src_exports, {
|
|
38
|
-
ADTRACKIFY_EVENT_BRIDGE_EVENTS: () => ADTRACKIFY_EVENT_BRIDGE_EVENTS,
|
|
39
|
-
ADTRACKIFY_EVENT_SOURCES: () => ADTRACKIFY_EVENT_SOURCES,
|
|
40
|
-
ADTRACKIFY_EVENT_TYPES: () => ADTRACKIFY_EVENT_TYPES,
|
|
41
|
-
AccountsClient: () => AccountsClient,
|
|
42
|
-
CognitoClient: () => CognitoClient,
|
|
43
|
-
CommonPlanInfo: () => CommonPlanInfo,
|
|
44
|
-
DestinationsClient: () => DestinationsClient,
|
|
45
|
-
DynamoDbClient: () => DynamoDbClient,
|
|
46
|
-
EventBridgeClient: () => EventBridgeClient,
|
|
47
|
-
EventBridgeIntegrationService: () => EventBridgeIntegrationService,
|
|
48
|
-
HttpError: () => HttpError,
|
|
49
|
-
HttpStatusCodes: () => HttpStatusCodes,
|
|
50
|
-
PostmarkRequestType: () => PostmarkRequestType,
|
|
51
|
-
S3Client: () => S3Client,
|
|
52
|
-
ShopifyAppInstallClient: () => ShopifyAppInstallClient,
|
|
53
|
-
ShopifyClient: () => ShopifyClient,
|
|
54
|
-
StripeBillingMap: () => StripeBillingMap,
|
|
55
|
-
SubscriptionPlanSeedItems: () => SubscriptionPlanSeedItems,
|
|
56
|
-
UsersAuthClient: () => UsersAuthClient,
|
|
57
|
-
axiosHttpService: () => axiosHttpService,
|
|
58
|
-
buildResponse: () => buildResponse,
|
|
59
|
-
configureLogger: () => configureLogger,
|
|
60
|
-
dictToAwsAttributes: () => dictToAwsAttributes,
|
|
61
|
-
failure: () => failure,
|
|
62
|
-
generatePublicKey: () => generatePublicKey,
|
|
63
|
-
getCurrentDate: () => getCurrentDate,
|
|
64
|
-
getCurrentTimestamp: () => getCurrentTimestamp,
|
|
65
|
-
getDateFromTimestamp: () => getDateFromTimestamp,
|
|
66
|
-
getPlanByStripePriceId: () => getPlanByStripePriceId,
|
|
67
|
-
getPlanDetails: () => getPlanDetails,
|
|
68
|
-
isShopifyRequestValid: () => isShopifyRequestValid,
|
|
69
|
-
mapObjectToQueryString: () => mapObjectToQueryString,
|
|
70
|
-
success: () => success,
|
|
71
|
-
validateInput: () => validateInput,
|
|
72
|
-
validateShopifyRequest: () => validateShopifyRequest
|
|
73
|
-
});
|
|
74
|
-
module.exports = __toCommonJS(src_exports);
|
|
75
|
-
|
|
76
|
-
// src/clients/generic/dynamodb-client.ts
|
|
77
|
-
var import_client_dynamodb = require("@aws-sdk/client-dynamodb");
|
|
78
|
-
var import_lib_dynamodb = require("@aws-sdk/lib-dynamodb");
|
|
79
|
-
var log = __toESM(require("lambda-log"), 1);
|
|
80
|
-
var marshallOptions = {
|
|
81
|
-
convertEmptyValues: false,
|
|
82
|
-
removeUndefinedValues: false,
|
|
83
|
-
convertClassInstanceToMap: true
|
|
84
|
-
};
|
|
85
|
-
var unmarshallOptions = {
|
|
86
|
-
wrapNumbers: false
|
|
87
|
-
};
|
|
88
|
-
var translateConfig = { marshallOptions, unmarshallOptions };
|
|
89
|
-
var ddbClient = new import_client_dynamodb.DynamoDBClient({});
|
|
90
|
-
var client = import_lib_dynamodb.DynamoDBDocument.from(ddbClient, translateConfig);
|
|
91
|
-
var _DynamoDbClient = class {
|
|
92
|
-
};
|
|
93
|
-
var DynamoDbClient = _DynamoDbClient;
|
|
94
|
-
__publicField(DynamoDbClient, "safeGet", async (tableName, keyName, keyValue) => {
|
|
95
|
-
try {
|
|
96
|
-
const params = {
|
|
97
|
-
TableName: tableName,
|
|
98
|
-
Key: {
|
|
99
|
-
[keyName]: keyValue
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const res = await client.get(params);
|
|
103
|
-
return res?.Item ?? null;
|
|
104
|
-
} catch (e) {
|
|
105
|
-
log.error(e, { message: "Dynamo Client Get Failed" });
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
__publicField(DynamoDbClient, "safePut", async (tableName, data) => {
|
|
110
|
-
try {
|
|
111
|
-
const params = {
|
|
112
|
-
TableName: tableName,
|
|
113
|
-
Item: data
|
|
114
|
-
};
|
|
115
|
-
const res = await client.put(params);
|
|
116
|
-
return res;
|
|
117
|
-
} catch (e) {
|
|
118
|
-
log.error(e, { message: "Dynamo failed simplePut" });
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
__publicField(DynamoDbClient, "safeDelete", async (tableName, keyName, keyValue) => {
|
|
123
|
-
try {
|
|
124
|
-
const params = {
|
|
125
|
-
TableName: tableName,
|
|
126
|
-
Key: {
|
|
127
|
-
[keyName]: keyValue
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const res = await client.delete(params);
|
|
131
|
-
return res;
|
|
132
|
-
} catch (e) {
|
|
133
|
-
log.error(e, { message: "Dynamo failed safeDelete" });
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
__publicField(DynamoDbClient, "safeQueryByGSI", async (tableName, gsiName, keyName, keyValue) => {
|
|
138
|
-
const query = {
|
|
139
|
-
TableName: tableName,
|
|
140
|
-
IndexName: gsiName,
|
|
141
|
-
KeyConditionExpression: `${keyName} = :value`,
|
|
142
|
-
ExpressionAttributeValues: {
|
|
143
|
-
":value": keyValue
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
const results = await _DynamoDbClient.queryAll(query);
|
|
147
|
-
return results;
|
|
148
|
-
});
|
|
149
|
-
__publicField(DynamoDbClient, "safeBatchGet", async (tableName, keys) => {
|
|
150
|
-
try {
|
|
151
|
-
const params = {
|
|
152
|
-
RequestItems: {}
|
|
153
|
-
};
|
|
154
|
-
params.RequestItems[tableName] = {
|
|
155
|
-
Keys: keys
|
|
156
|
-
};
|
|
157
|
-
const res = await client.batchGet(params);
|
|
158
|
-
log.info("batchget res", { batchGetRes: res });
|
|
159
|
-
if (res?.Responses?.[tableName]) {
|
|
160
|
-
return res?.Responses?.[tableName];
|
|
161
|
-
}
|
|
162
|
-
return [];
|
|
163
|
-
} catch (e) {
|
|
164
|
-
log.error(e, { message: "Dynamo failed safeBatchGet" });
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
__publicField(DynamoDbClient, "queryAll", async (params) => {
|
|
169
|
-
try {
|
|
170
|
-
log.info("Invoke Query All", { params });
|
|
171
|
-
let currentResult, exclusiveStartKey;
|
|
172
|
-
let accumulatedResults = [];
|
|
173
|
-
do {
|
|
174
|
-
params.ExclusiveStartKey = exclusiveStartKey;
|
|
175
|
-
params.Limit = 200;
|
|
176
|
-
currentResult = await client.query(params);
|
|
177
|
-
if (currentResult.Items) {
|
|
178
|
-
exclusiveStartKey = currentResult.LastEvaluatedKey;
|
|
179
|
-
accumulatedResults = [...accumulatedResults, ...currentResult.Items];
|
|
180
|
-
}
|
|
181
|
-
} while (currentResult.Items && currentResult.Items.length > 0 && currentResult.LastEvaluatedKey);
|
|
182
|
-
return accumulatedResults;
|
|
183
|
-
} catch (e) {
|
|
184
|
-
log.error(e, { message: "Dynamo failed queryAll" });
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
__publicField(DynamoDbClient, "batchGet", (params) => client.batchGet(params));
|
|
189
|
-
__publicField(DynamoDbClient, "get", (params) => client.get(params));
|
|
190
|
-
__publicField(DynamoDbClient, "put", (params) => client.put(params));
|
|
191
|
-
__publicField(DynamoDbClient, "query", (params) => client.query(params));
|
|
192
|
-
__publicField(DynamoDbClient, "scan", (params) => client.scan(params));
|
|
193
|
-
__publicField(DynamoDbClient, "update", (params) => client.update(params));
|
|
194
|
-
__publicField(DynamoDbClient, "delete", (params) => client.delete(params));
|
|
195
|
-
|
|
196
|
-
// src/clients/generic/eventbridge-client.ts
|
|
197
|
-
var import_client_eventbridge = require("@aws-sdk/client-eventbridge");
|
|
198
|
-
var import_uuid = require("uuid");
|
|
199
|
-
|
|
200
|
-
// src/libs/dates.ts
|
|
201
|
-
var import_luxon = require("luxon");
|
|
202
|
-
var getCurrentTimestamp = () => {
|
|
203
|
-
return import_luxon.DateTime.utc().toJSDate().toISOString();
|
|
204
|
-
};
|
|
205
|
-
var getDateFromTimestamp = (timestamp) => {
|
|
206
|
-
return timestamp.split("T")[0];
|
|
207
|
-
};
|
|
208
|
-
var getCurrentDate = () => {
|
|
209
|
-
return getDateFromTimestamp(getCurrentTimestamp());
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
// src/clients/generic/eventbridge-client.ts
|
|
213
|
-
var log2 = __toESM(require("lambda-log"), 1);
|
|
214
|
-
var EventBridgeClient = class {
|
|
215
|
-
eventBridge;
|
|
216
|
-
EVENT_BUS_NAME;
|
|
217
|
-
constructor(eventBusName) {
|
|
218
|
-
this.eventBridge = new import_client_eventbridge.EventBridgeClient({});
|
|
219
|
-
this.EVENT_BUS_NAME = eventBusName;
|
|
220
|
-
}
|
|
221
|
-
buildAndSendEvent = async (eventSource, eventType, eventData) => {
|
|
222
|
-
const event = this.buildEvent(eventType, eventData);
|
|
223
|
-
return await this.putEvent(eventSource, eventType, event);
|
|
224
|
-
};
|
|
225
|
-
buildEvent = (eventType, eventData, eventId = (0, import_uuid.v4)(), eventTime = getCurrentTimestamp()) => {
|
|
226
|
-
return {
|
|
227
|
-
eventId,
|
|
228
|
-
eventType,
|
|
229
|
-
eventTime,
|
|
230
|
-
eventData
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
putEvent = async (source, detailType, data, headers = null) => {
|
|
234
|
-
const params = {
|
|
235
|
-
Entries: [{
|
|
236
|
-
Detail: JSON.stringify({ headers, data }),
|
|
237
|
-
DetailType: detailType,
|
|
238
|
-
EventBusName: this.EVENT_BUS_NAME,
|
|
239
|
-
Source: source,
|
|
240
|
-
Time: /* @__PURE__ */ new Date()
|
|
241
|
-
}]
|
|
242
|
-
};
|
|
243
|
-
const putEventscommand = new import_client_eventbridge.PutEventsCommand(params);
|
|
244
|
-
const response = await this.eventBridge.send(putEventscommand);
|
|
245
|
-
log2.debug(
|
|
246
|
-
"EventBus Event Published",
|
|
247
|
-
{
|
|
248
|
-
eventBusName: this.EVENT_BUS_NAME,
|
|
249
|
-
eventSource: source,
|
|
250
|
-
eventType: detailType,
|
|
251
|
-
event: data,
|
|
252
|
-
response
|
|
253
|
-
}
|
|
254
|
-
);
|
|
255
|
-
return response;
|
|
256
|
-
};
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
// src/clients/generic/http-client.ts
|
|
260
|
-
var import_axios = __toESM(require("axios"), 1);
|
|
261
|
-
var import_https = __toESM(require("https"), 1);
|
|
262
|
-
var import_http = __toESM(require("axios/lib/adapters/http"), 1);
|
|
263
|
-
var httpResponse = (res = {}) => {
|
|
264
|
-
return {
|
|
265
|
-
headers: res?.header || {},
|
|
266
|
-
data: res?.data || {},
|
|
267
|
-
status: res?.status || 0
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
var handleAxiosError = (error7) => {
|
|
271
|
-
if (!error7?.response && !error7?.request)
|
|
272
|
-
throw error7;
|
|
273
|
-
return error7.response ? httpResponse(error7.response) : httpResponse({ status: 500, data: { error: error7.request } });
|
|
274
|
-
};
|
|
275
|
-
var axiosHttpService = (config = {}) => {
|
|
276
|
-
config.adapter = import_http.default;
|
|
277
|
-
config.httpsAgent = new import_https.default.Agent({ keepAlive: true });
|
|
278
|
-
const axiosService = import_axios.default.create(config);
|
|
279
|
-
return {
|
|
280
|
-
instance: () => axiosService,
|
|
281
|
-
get: (url, config2) => axiosService.get(url, config2).then(httpResponse, handleAxiosError),
|
|
282
|
-
post: (url, data, config2) => axiosService.post(url, data, config2).then(httpResponse, handleAxiosError),
|
|
283
|
-
delete: (url, config2) => axiosService.delete(url, config2).then(httpResponse, handleAxiosError),
|
|
284
|
-
put: (url, data, config2) => axiosService.put(url, data, config2).then(httpResponse, handleAxiosError),
|
|
285
|
-
patch: (url, data, config2) => axiosService.patch(url, data, config2).then(httpResponse, handleAxiosError),
|
|
286
|
-
setBaseUrl: (url) => !!(axiosService.defaults.baseURL = url)
|
|
287
|
-
};
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
// src/clients/generic/s3-client.ts
|
|
291
|
-
var import_client_s3 = require("@aws-sdk/client-s3");
|
|
292
|
-
var log3 = __toESM(require("lambda-log"), 1);
|
|
293
|
-
var S3Client = class {
|
|
294
|
-
s3;
|
|
295
|
-
constructor(region = "us-west-2") {
|
|
296
|
-
this.s3 = new import_client_s3.S3({ region });
|
|
297
|
-
}
|
|
298
|
-
async uploadJson(path, bucket, jsonData, ACL = import_client_s3.ObjectCannedACL.private) {
|
|
299
|
-
try {
|
|
300
|
-
const res = await this.s3.putObject({
|
|
301
|
-
ACL,
|
|
302
|
-
Bucket: bucket,
|
|
303
|
-
ContentType: "application/json; charset=utf-8",
|
|
304
|
-
Body: JSON.stringify(jsonData),
|
|
305
|
-
Key: path
|
|
306
|
-
});
|
|
307
|
-
return res;
|
|
308
|
-
} catch (error7) {
|
|
309
|
-
log3.error("Error in s3 upload json", { error: error7 });
|
|
310
|
-
return error7;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
// src/clients/generic/cognito-client.ts
|
|
316
|
-
var import_client_cognito_identity_provider = require("@aws-sdk/client-cognito-identity-provider");
|
|
317
|
-
var log4 = __toESM(require("lambda-log"), 1);
|
|
318
|
-
function dictToAwsAttributes(input) {
|
|
319
|
-
delete input.email;
|
|
320
|
-
delete input.password;
|
|
321
|
-
const output = [];
|
|
322
|
-
for (const att in input) {
|
|
323
|
-
if (Object.prototype.hasOwnProperty.call(input, att)) {
|
|
324
|
-
output.push({ Name: att, Value: input[att] });
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return output;
|
|
328
|
-
}
|
|
329
|
-
var buildAttributes = (data) => {
|
|
330
|
-
const attributes = {
|
|
331
|
-
name: data.givenName,
|
|
332
|
-
family_name: data.familyName
|
|
333
|
-
};
|
|
334
|
-
return dictToAwsAttributes(attributes);
|
|
335
|
-
};
|
|
336
|
-
var CognitoClient = class {
|
|
337
|
-
cognitoClient;
|
|
338
|
-
USER_POOL_ID;
|
|
339
|
-
USER_POOL_NO_SECRET_CLIENT_ID;
|
|
340
|
-
constructor(userPoolId, userPoolNoSecretClientId) {
|
|
341
|
-
this.cognitoClient = new import_client_cognito_identity_provider.CognitoIdentityProvider({});
|
|
342
|
-
this.USER_POOL_ID = userPoolId;
|
|
343
|
-
this.USER_POOL_NO_SECRET_CLIENT_ID = userPoolNoSecretClientId;
|
|
344
|
-
}
|
|
345
|
-
signupUser = async (data) => {
|
|
346
|
-
const params = {
|
|
347
|
-
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
348
|
-
Password: data.password,
|
|
349
|
-
Username: data.email,
|
|
350
|
-
UserAttributes: buildAttributes(data)
|
|
351
|
-
};
|
|
352
|
-
const cognitoResponse = await this.cognitoClient.signUp(params);
|
|
353
|
-
log4.debug("Successfully Registered User", { cognitoResponse });
|
|
354
|
-
return cognitoResponse;
|
|
355
|
-
};
|
|
356
|
-
forgotPassword = async (email) => {
|
|
357
|
-
await this.adminEmailVerify(email);
|
|
358
|
-
const params = {
|
|
359
|
-
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
360
|
-
Username: email
|
|
361
|
-
};
|
|
362
|
-
const cognitoResponse = await this.cognitoClient.forgotPassword(params);
|
|
363
|
-
log4.debug("Sent Forgot Password", { cognitoResponse });
|
|
364
|
-
return cognitoResponse;
|
|
365
|
-
};
|
|
366
|
-
adminEmailVerify = async (email) => {
|
|
367
|
-
try {
|
|
368
|
-
const user = await this.getUserByEmail(email);
|
|
369
|
-
if (user && user?.UserStatus === "CONFIRMED" && user?.email_verified !== "true") {
|
|
370
|
-
await this.forceValidateEmail(email);
|
|
371
|
-
}
|
|
372
|
-
} catch (error7) {
|
|
373
|
-
log4.error("Failed admin email verify", { error: error7 });
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
forceValidateEmail = async (email) => {
|
|
377
|
-
try {
|
|
378
|
-
const params = {
|
|
379
|
-
UserPoolId: this.USER_POOL_ID,
|
|
380
|
-
Username: email,
|
|
381
|
-
UserAttributes: [
|
|
382
|
-
{
|
|
383
|
-
Name: "email_verified",
|
|
384
|
-
Value: "true"
|
|
385
|
-
}
|
|
386
|
-
]
|
|
387
|
-
};
|
|
388
|
-
await this.cognitoClient.adminUpdateUserAttributes(params);
|
|
389
|
-
} catch (error7) {
|
|
390
|
-
log4.error("Failed force validate email", { email, error: error7 });
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
adminConfirmUser = async (data) => {
|
|
394
|
-
const params = {
|
|
395
|
-
UserPoolId: this.USER_POOL_ID,
|
|
396
|
-
Username: data.email
|
|
397
|
-
};
|
|
398
|
-
const cognitoResponse = await this.cognitoClient.adminConfirmSignUp(params);
|
|
399
|
-
await this.forceValidateEmail(data.email);
|
|
400
|
-
log4.debug("Admin Successfully Confirmed User", { cognitoResponse });
|
|
401
|
-
return cognitoResponse;
|
|
402
|
-
};
|
|
403
|
-
confirmUser = async (data) => {
|
|
404
|
-
const params = {
|
|
405
|
-
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
406
|
-
ConfirmationCode: data.confirmationCode,
|
|
407
|
-
Username: data.email
|
|
408
|
-
};
|
|
409
|
-
const cognitoResponse = await this.cognitoClient.confirmSignUp(params);
|
|
410
|
-
log4.debug("Successfully Confirmed User", { cognitoResponse });
|
|
411
|
-
return cognitoResponse;
|
|
412
|
-
};
|
|
413
|
-
resendCode = async (email) => {
|
|
414
|
-
const params = {
|
|
415
|
-
ClientId: this.USER_POOL_NO_SECRET_CLIENT_ID,
|
|
416
|
-
Username: email
|
|
417
|
-
};
|
|
418
|
-
await this.cognitoClient.resendConfirmationCode(params);
|
|
419
|
-
log4.debug("Successfully Resend Confirmation Code", { email });
|
|
420
|
-
return;
|
|
421
|
-
};
|
|
422
|
-
adminDeleteUser = async (userId) => {
|
|
423
|
-
const params = {
|
|
424
|
-
UserPoolId: this.USER_POOL_ID,
|
|
425
|
-
Username: userId
|
|
426
|
-
};
|
|
427
|
-
await this.cognitoClient.adminDeleteUser(params);
|
|
428
|
-
return true;
|
|
429
|
-
};
|
|
430
|
-
getUserByEmail = async (email) => {
|
|
431
|
-
const params = {
|
|
432
|
-
UserPoolId: this.USER_POOL_ID,
|
|
433
|
-
Filter: `email="${email}"`,
|
|
434
|
-
Limit: 1
|
|
435
|
-
};
|
|
436
|
-
const cognitoResponse = await this.cognitoClient.listUsers(params);
|
|
437
|
-
log4.debug("Get Users by Email", { cognitoResponse });
|
|
438
|
-
if (cognitoResponse?.Users && cognitoResponse?.Users.length > 0) {
|
|
439
|
-
const attributes = cognitoResponse.Users[0].Attributes;
|
|
440
|
-
const user = {
|
|
441
|
-
...cognitoResponse.Users[0],
|
|
442
|
-
Attributes: void 0,
|
|
443
|
-
id: cognitoResponse.Users[0].sub
|
|
444
|
-
};
|
|
445
|
-
attributes.forEach((attr) => {
|
|
446
|
-
user[attr.Name] = attr?.Value;
|
|
447
|
-
});
|
|
448
|
-
return user;
|
|
449
|
-
}
|
|
450
|
-
return null;
|
|
451
|
-
};
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
// src/clients/internal-api/destinations-client.ts
|
|
455
|
-
var log5 = __toESM(require("lambda-log"), 1);
|
|
456
|
-
var DestinationsClient = class {
|
|
457
|
-
BASE_API_URL;
|
|
458
|
-
DESTINATIONS_API_KEY;
|
|
459
|
-
constructor(baseApiUrl, destinationsApiKey) {
|
|
460
|
-
this.BASE_API_URL = baseApiUrl;
|
|
461
|
-
this.DESTINATIONS_API_KEY = destinationsApiKey;
|
|
462
|
-
}
|
|
463
|
-
getConfig = () => {
|
|
464
|
-
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/destinations`;
|
|
465
|
-
return {
|
|
466
|
-
baseURL: SERVICE_API_ROOT_URL,
|
|
467
|
-
headers: {
|
|
468
|
-
common: {
|
|
469
|
-
"x-api-key": this.DESTINATIONS_API_KEY
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
};
|
|
474
|
-
getClient = async () => {
|
|
475
|
-
return axiosHttpService(this.getConfig());
|
|
476
|
-
};
|
|
477
|
-
createDestination = async (createDestinationRequest) => {
|
|
478
|
-
const client2 = await this.getClient();
|
|
479
|
-
const response = await client2.post("/", createDestinationRequest);
|
|
480
|
-
log5.info("createDestinationResponse", { response });
|
|
481
|
-
return response;
|
|
482
|
-
};
|
|
483
|
-
getPixelDestinations = async (pixelId) => {
|
|
484
|
-
const client2 = await this.getClient();
|
|
485
|
-
const response = await client2.get(`/?pixelId=${pixelId}`);
|
|
486
|
-
log5.info("getPixelResponse", { response });
|
|
487
|
-
return response;
|
|
488
|
-
};
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
// src/clients/internal-api/accounts-client.ts
|
|
492
|
-
var log6 = __toESM(require("lambda-log"), 1);
|
|
493
|
-
var AccountsClient = class {
|
|
494
|
-
BASE_API_URL;
|
|
495
|
-
ACCOUNTS_API_KEY;
|
|
496
|
-
constructor(baseApiUrl, accountsApiKey) {
|
|
497
|
-
this.BASE_API_URL = baseApiUrl;
|
|
498
|
-
this.ACCOUNTS_API_KEY = accountsApiKey;
|
|
499
|
-
}
|
|
500
|
-
getConfig = () => {
|
|
501
|
-
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/accounts`;
|
|
502
|
-
const params = {
|
|
503
|
-
baseURL: SERVICE_API_ROOT_URL
|
|
504
|
-
};
|
|
505
|
-
if (this.ACCOUNTS_API_KEY) {
|
|
506
|
-
params.headers = {
|
|
507
|
-
common: {
|
|
508
|
-
"x-api-key": this.ACCOUNTS_API_KEY
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
return params;
|
|
513
|
-
};
|
|
514
|
-
getClient = async () => {
|
|
515
|
-
return axiosHttpService(this.getConfig());
|
|
516
|
-
};
|
|
517
|
-
createAccount = async (createAccountRequest) => {
|
|
518
|
-
const client2 = await this.getClient();
|
|
519
|
-
const createAccountResponse = await client2.post("", createAccountRequest);
|
|
520
|
-
log6.info("createAccountResponse", { createAccountResponse });
|
|
521
|
-
return createAccountResponse;
|
|
522
|
-
};
|
|
523
|
-
updateAccount = async (accountId, body) => {
|
|
524
|
-
const client2 = await this.getClient();
|
|
525
|
-
const response = await client2.patch(`/${accountId}/`, body);
|
|
526
|
-
log6.info("update Account response", { response });
|
|
527
|
-
return response;
|
|
528
|
-
};
|
|
529
|
-
addOwner = async (accountId, userId) => {
|
|
530
|
-
const client2 = await this.getClient();
|
|
531
|
-
const addOwnerResponse = await client2.post("/addOwner", { accountId, userId });
|
|
532
|
-
log6.info("addOwnerResponse", { addOwnerResponse });
|
|
533
|
-
return addOwnerResponse;
|
|
534
|
-
};
|
|
535
|
-
isAuthorizedUser = async (userId, accountId, pixelId) => {
|
|
536
|
-
const client2 = await this.getClient();
|
|
537
|
-
const body = {
|
|
538
|
-
userId,
|
|
539
|
-
accountId,
|
|
540
|
-
pixelId
|
|
541
|
-
};
|
|
542
|
-
const response = await client2.post("/checkUserAuthorization", body);
|
|
543
|
-
log6.info("checkUserAuthorization", { response });
|
|
544
|
-
return response;
|
|
545
|
-
};
|
|
546
|
-
adminDeleteAccount = async (accountId) => {
|
|
547
|
-
const client2 = await this.getClient();
|
|
548
|
-
const success2 = await client2.delete(`/${accountId}`);
|
|
549
|
-
log6.info("adminDeleteAccount");
|
|
550
|
-
return success2;
|
|
551
|
-
};
|
|
552
|
-
getPixelConfigById = async (pixelId) => {
|
|
553
|
-
const client2 = await this.getClient();
|
|
554
|
-
const pixelResponse = await client2.get(`/px/${pixelId}/config`);
|
|
555
|
-
log6.debug("get pixelResponse", { pixelResponse });
|
|
556
|
-
return pixelResponse;
|
|
557
|
-
};
|
|
558
|
-
getAccount = async (accountId) => {
|
|
559
|
-
const client2 = await this.getClient();
|
|
560
|
-
const response = await client2.get(`/${accountId}/`);
|
|
561
|
-
log6.info("get account response", { response });
|
|
562
|
-
return response;
|
|
563
|
-
};
|
|
564
|
-
addUserToAccount = async (accountId, userId) => {
|
|
565
|
-
const client2 = await this.getClient();
|
|
566
|
-
const response = await client2.post("/addUser", { accountId, userId });
|
|
567
|
-
log6.info("add user account response", { response });
|
|
568
|
-
return response;
|
|
569
|
-
};
|
|
570
|
-
// setAccountSubscriptionId = async (accountId: string, subscriptionId: string): Promise<ApiResponse<any>> => {
|
|
571
|
-
// const client = await this.getClient();
|
|
572
|
-
// const pixelResponse = await client.get(`/px/${pixelId}/config`);
|
|
573
|
-
// log.debug('pixelResponse', { pixelResponse });
|
|
574
|
-
// return pixelResponse;
|
|
575
|
-
// };
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
// src/clients/internal-api/users-auth-client.ts
|
|
579
|
-
var log7 = __toESM(require("lambda-log"), 1);
|
|
580
|
-
|
|
581
|
-
// src/libs/http-error.ts
|
|
582
|
-
var import_assert = require("assert");
|
|
583
|
-
var deepClone = (o = {}) => JSON.parse(JSON.stringify(o));
|
|
584
|
-
var containsStackTrace = (text = "") => /at.+\.js:\d+:\d+/.test(text);
|
|
585
|
-
var objectContainsStackTrace = (obj) => !obj ? false : containsStackTrace(JSON.stringify(obj));
|
|
586
|
-
var supportedStatusCodes = {
|
|
587
|
-
400: "Bad Request",
|
|
588
|
-
401: "Unauthorized",
|
|
589
|
-
403: "Forbidden",
|
|
590
|
-
404: "Not Found",
|
|
591
|
-
405: "Method Not Allowed",
|
|
592
|
-
409: "Conflict",
|
|
593
|
-
412: "Precondition Failed",
|
|
594
|
-
413: "Payload Too Large",
|
|
595
|
-
415: "Unsupported Media Type",
|
|
596
|
-
428: "Precondition Required",
|
|
597
|
-
429: "Too Many Requests",
|
|
598
|
-
500: "Internal Server Error",
|
|
599
|
-
501: "Not Implemented",
|
|
600
|
-
502: "Bad Gateway",
|
|
601
|
-
503: "Service Unavailable",
|
|
602
|
-
504: "Gateway Timeout"
|
|
603
|
-
};
|
|
604
|
-
var supportedStatusCodesMessage = `statusCode must be one of the following: ${JSON.stringify(Object.keys(supportedStatusCodes))}`;
|
|
605
|
-
var _HttpError = class extends Error {
|
|
606
|
-
body;
|
|
607
|
-
headers;
|
|
608
|
-
statusCode;
|
|
609
|
-
isServerError;
|
|
610
|
-
constructor(statusCode, message, body, headers) {
|
|
611
|
-
(0, import_assert.strict)(statusCode in supportedStatusCodes, supportedStatusCodesMessage);
|
|
612
|
-
const isServerError = statusCode > 499;
|
|
613
|
-
(0, import_assert.strict)(
|
|
614
|
-
body === void 0 || typeof body === "object",
|
|
615
|
-
"body must be an object or omitted"
|
|
616
|
-
);
|
|
617
|
-
(0, import_assert.strict)(
|
|
618
|
-
headers === void 0 || typeof headers === "object",
|
|
619
|
-
"headers must be an object or omitted"
|
|
620
|
-
);
|
|
621
|
-
message = message ?? supportedStatusCodes[statusCode];
|
|
622
|
-
(0, import_assert.strict)(
|
|
623
|
-
!containsStackTrace(message) && !objectContainsStackTrace(body),
|
|
624
|
-
"the message or data parameters may not contain errors or stack traces"
|
|
625
|
-
);
|
|
626
|
-
super(message);
|
|
627
|
-
this.body = deepClone(body);
|
|
628
|
-
this.headers = deepClone(headers);
|
|
629
|
-
this.statusCode = statusCode;
|
|
630
|
-
this.isServerError = isServerError;
|
|
631
|
-
if (!this?.body?.message) {
|
|
632
|
-
this.body.message = this.message;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
static get supportedStatusCodes() {
|
|
636
|
-
return supportedStatusCodes;
|
|
637
|
-
}
|
|
638
|
-
};
|
|
639
|
-
var HttpError = _HttpError;
|
|
640
|
-
__publicField(HttpError, "badRequest", (message, body, headers) => {
|
|
641
|
-
return new _HttpError(400, message, body, headers);
|
|
642
|
-
});
|
|
643
|
-
__publicField(HttpError, "unauthorized", (message, body, headers) => new _HttpError(401, message, body, headers));
|
|
644
|
-
__publicField(HttpError, "forbidden", (message, body, headers) => new _HttpError(403, message, body, headers));
|
|
645
|
-
__publicField(HttpError, "notFound", (message, body, headers) => new _HttpError(404, message, body, headers));
|
|
646
|
-
__publicField(HttpError, "internal", (message, body, headers) => new _HttpError(500, message, body, headers));
|
|
647
|
-
__publicField(HttpError, "notImplemented", () => new _HttpError(501));
|
|
648
|
-
__publicField(HttpError, "badGateway", () => new _HttpError(502));
|
|
649
|
-
__publicField(HttpError, "serviceUnavailable", (headers) => new _HttpError(503, void 0, void 0, headers));
|
|
650
|
-
__publicField(HttpError, "gatewayTimeout", () => new _HttpError(504));
|
|
651
|
-
|
|
652
|
-
// src/libs/http-status-codes.ts
|
|
653
|
-
var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
|
|
654
|
-
HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
|
|
655
|
-
HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
656
|
-
HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
|
|
657
|
-
HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
|
|
658
|
-
HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
|
|
659
|
-
HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
660
|
-
HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
661
|
-
HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
662
|
-
HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
663
|
-
HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
664
|
-
HttpStatusCodes2[HttpStatusCodes2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
665
|
-
HttpStatusCodes2[HttpStatusCodes2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
|
|
666
|
-
HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
667
|
-
HttpStatusCodes2[HttpStatusCodes2["MOVED_TEMPORARILY"] = 302] = "MOVED_TEMPORARILY";
|
|
668
|
-
HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
669
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
670
|
-
HttpStatusCodes2[HttpStatusCodes2["USE_PROXY"] = 305] = "USE_PROXY";
|
|
671
|
-
HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
672
|
-
HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
673
|
-
HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
674
|
-
HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
675
|
-
HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
676
|
-
HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
677
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
678
|
-
HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
679
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
680
|
-
HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
681
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
682
|
-
HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
|
|
683
|
-
HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
|
|
684
|
-
HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
685
|
-
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
686
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUEST_TOO_LONG"] = 413] = "REQUEST_TOO_LONG";
|
|
687
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
|
|
688
|
-
HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
689
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
690
|
-
HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
691
|
-
HttpStatusCodes2[HttpStatusCodes2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
|
|
692
|
-
HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_SPACE_ON_RESOURCE"] = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE";
|
|
693
|
-
HttpStatusCodes2[HttpStatusCodes2["METHOD_FAILURE"] = 420] = "METHOD_FAILURE";
|
|
694
|
-
HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
695
|
-
HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
696
|
-
HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
|
|
697
|
-
HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
698
|
-
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
699
|
-
HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
700
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
|
|
701
|
-
HttpStatusCodes2[HttpStatusCodes2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
|
|
702
|
-
HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
703
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
704
|
-
HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
705
|
-
HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
706
|
-
HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
707
|
-
HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
708
|
-
HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
709
|
-
HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
710
|
-
return HttpStatusCodes2;
|
|
711
|
-
})(HttpStatusCodes || {});
|
|
712
|
-
|
|
713
|
-
// src/clients/internal-api/users-auth-client.ts
|
|
714
|
-
var UsersAuthClient = class {
|
|
715
|
-
SERVICE_API_ROOT_URL;
|
|
716
|
-
BASE_API_URL;
|
|
717
|
-
USERS_AUTH_API_KEY;
|
|
718
|
-
constructor(baseApiUrl, usersAuthApiKey) {
|
|
719
|
-
this.BASE_API_URL = baseApiUrl;
|
|
720
|
-
this.USERS_AUTH_API_KEY = usersAuthApiKey;
|
|
721
|
-
this.SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/auth`;
|
|
722
|
-
}
|
|
723
|
-
getConfig = () => {
|
|
724
|
-
return {
|
|
725
|
-
baseURL: this.SERVICE_API_ROOT_URL,
|
|
726
|
-
headers: {
|
|
727
|
-
common: {}
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
};
|
|
731
|
-
getClient = async () => {
|
|
732
|
-
return axiosHttpService(this.getConfig());
|
|
733
|
-
};
|
|
734
|
-
signupAndConfirmUser = async (userSignupRequest) => {
|
|
735
|
-
const user = await this.signupUser(userSignupRequest);
|
|
736
|
-
await this.adminConfirmUser(user.email);
|
|
737
|
-
return user;
|
|
738
|
-
};
|
|
739
|
-
signupUser = async (userSignupRequest) => {
|
|
740
|
-
log7.info("Attempting to signup user", { email: userSignupRequest.email });
|
|
741
|
-
const client2 = await this.getClient();
|
|
742
|
-
const response = await client2.post("/signup", userSignupRequest);
|
|
743
|
-
if (response.status !== 200 || !response?.data?.user) {
|
|
744
|
-
const message = "User Signup Failed";
|
|
745
|
-
log7.error(message, { response });
|
|
746
|
-
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
747
|
-
}
|
|
748
|
-
log7.info("User Signup Successful", { response });
|
|
749
|
-
return response.data.user;
|
|
750
|
-
};
|
|
751
|
-
//userName is same as user id
|
|
752
|
-
adminConfirmUser = async (email) => {
|
|
753
|
-
log7.info("Attempting to admin confirm user", { email });
|
|
754
|
-
const client2 = await this.getClient();
|
|
755
|
-
const response = await client2.post(
|
|
756
|
-
"/admin/confirm",
|
|
757
|
-
{
|
|
758
|
-
email
|
|
759
|
-
},
|
|
760
|
-
{
|
|
761
|
-
headers: {
|
|
762
|
-
"x-api-key": this.USERS_AUTH_API_KEY
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
);
|
|
766
|
-
if (response.status !== 200) {
|
|
767
|
-
const message = "Admin User Confirmation Failed";
|
|
768
|
-
log7.error(message, { response });
|
|
769
|
-
throw new HttpError(500 /* INTERNAL_SERVER_ERROR */, message);
|
|
770
|
-
}
|
|
771
|
-
log7.info("Admin User Confirmation Successful", { response });
|
|
772
|
-
return response;
|
|
773
|
-
};
|
|
774
|
-
getUserByEmail = async (email) => {
|
|
775
|
-
const client2 = await this.getClient();
|
|
776
|
-
const getUserResponse = await client2.get("/lookup", {
|
|
777
|
-
headers: {
|
|
778
|
-
"x-api-key": this.USERS_AUTH_API_KEY
|
|
779
|
-
},
|
|
780
|
-
params: {
|
|
781
|
-
email
|
|
782
|
-
}
|
|
783
|
-
});
|
|
784
|
-
log7.info("getUserResponse", { getUserResponse });
|
|
785
|
-
return getUserResponse;
|
|
786
|
-
};
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
// src/clients/internal-api/shopify-app-install-client.ts
|
|
790
|
-
var import_lambda_log = __toESM(require("lambda-log"), 1);
|
|
791
|
-
var ShopifyAppInstallClient = class {
|
|
792
|
-
BASE_API_URL;
|
|
793
|
-
SHOPIFY_APP_INSTALL_API_KEY;
|
|
794
|
-
constructor(baseApiUrl, shopifyAppInstallApiKey) {
|
|
795
|
-
this.BASE_API_URL = baseApiUrl;
|
|
796
|
-
this.SHOPIFY_APP_INSTALL_API_KEY = shopifyAppInstallApiKey;
|
|
797
|
-
}
|
|
798
|
-
getConfig = () => {
|
|
799
|
-
const SERVICE_API_ROOT_URL = `${this.BASE_API_URL}/shopify-app-installs`;
|
|
800
|
-
return {
|
|
801
|
-
baseURL: SERVICE_API_ROOT_URL,
|
|
802
|
-
headers: {
|
|
803
|
-
common: {
|
|
804
|
-
"x-api-key": this.SHOPIFY_APP_INSTALL_API_KEY
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
};
|
|
808
|
-
};
|
|
809
|
-
getClient = async () => {
|
|
810
|
-
return axiosHttpService(this.getConfig());
|
|
811
|
-
};
|
|
812
|
-
updateShopifyAppInstall = async (shopifyAppInstallId, updateShopifyAppInstallRequest) => {
|
|
813
|
-
const client2 = await this.getClient();
|
|
814
|
-
const response = await client2.put(`/${shopifyAppInstallId}`, updateShopifyAppInstallRequest);
|
|
815
|
-
import_lambda_log.default.info("updateShopifyAppInstall", { response });
|
|
816
|
-
return response;
|
|
817
|
-
};
|
|
818
|
-
getShopifyAppInstall = async (shopifyAppInstallId) => {
|
|
819
|
-
const client2 = await this.getClient();
|
|
820
|
-
const response = await client2.get(`/${shopifyAppInstallId}`);
|
|
821
|
-
import_lambda_log.default.info("getShopifyAppInstall", { response });
|
|
822
|
-
return response;
|
|
823
|
-
};
|
|
824
|
-
getShopifyAppInstallByShop = async (shop) => {
|
|
825
|
-
const client2 = await this.getClient();
|
|
826
|
-
const response = await client2.get(`/?shop=${shop}`);
|
|
827
|
-
import_lambda_log.default.info("getShopifyAppInstallByShop", { response });
|
|
828
|
-
return response;
|
|
829
|
-
};
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
// src/clients/third-party/shopify-client.ts
|
|
833
|
-
var log9 = __toESM(require("lambda-log"), 1);
|
|
834
|
-
var _ShopifyClient = class {
|
|
835
|
-
};
|
|
836
|
-
var ShopifyClient = _ShopifyClient;
|
|
837
|
-
__publicField(ShopifyClient, "_shopify_api_version", process.env.SHOPIFY_API_VERSION);
|
|
838
|
-
__publicField(ShopifyClient, "getConfig", (shopifyDomain, accessToken) => {
|
|
839
|
-
const config = {
|
|
840
|
-
baseURL: `https://${shopifyDomain}/admin/api/${_ShopifyClient._shopify_api_version}`,
|
|
841
|
-
headers: {
|
|
842
|
-
common: {
|
|
843
|
-
"X-Shopify-Access-Token": accessToken
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
};
|
|
847
|
-
return config;
|
|
848
|
-
});
|
|
849
|
-
__publicField(ShopifyClient, "getClient", (shopifyDomain, accessToken) => {
|
|
850
|
-
return axiosHttpService(
|
|
851
|
-
_ShopifyClient.getConfig(shopifyDomain, accessToken)
|
|
852
|
-
);
|
|
853
|
-
});
|
|
854
|
-
__publicField(ShopifyClient, "registerApp", async (shop, code, appKey, appSecret) => {
|
|
855
|
-
const client2 = axiosHttpService();
|
|
856
|
-
const url = "https://" + shop + "/admin/oauth/access_token";
|
|
857
|
-
const payload = {
|
|
858
|
-
client_id: appKey,
|
|
859
|
-
client_secret: appSecret,
|
|
860
|
-
code
|
|
861
|
-
};
|
|
862
|
-
const res = await client2.post(url, payload);
|
|
863
|
-
return res;
|
|
864
|
-
});
|
|
865
|
-
__publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, eventBridgeArn, topic) => {
|
|
866
|
-
const client2 = axiosHttpService();
|
|
867
|
-
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/webhooks.json`;
|
|
868
|
-
const payload = {
|
|
869
|
-
webhook: {
|
|
870
|
-
topic,
|
|
871
|
-
address: eventBridgeArn,
|
|
872
|
-
format: "json"
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
876
|
-
if (res.status >= 400) {
|
|
877
|
-
log9.error("Failed to register Webhook Topic", { shop, accessToken, eventBridgeArn, topic, url, payload });
|
|
878
|
-
}
|
|
879
|
-
log9.debug("Shopify Client Webhook Registration Response", { registrationResponse: res });
|
|
880
|
-
return res;
|
|
881
|
-
});
|
|
882
|
-
__publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
|
|
883
|
-
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/metafields.json`;
|
|
884
|
-
const payload = {
|
|
885
|
-
metafield: {
|
|
886
|
-
namespace: "adtr",
|
|
887
|
-
key: "adtr.config",
|
|
888
|
-
value: pixelId,
|
|
889
|
-
type: "single_line_text_field"
|
|
890
|
-
}
|
|
891
|
-
};
|
|
892
|
-
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload);
|
|
893
|
-
if (res.status >= 400) {
|
|
894
|
-
log9.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
|
|
895
|
-
}
|
|
896
|
-
return res;
|
|
897
|
-
});
|
|
898
|
-
__publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessToken) => {
|
|
899
|
-
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/shop.json`;
|
|
900
|
-
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
901
|
-
if (res.status >= 400) {
|
|
902
|
-
log9.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
|
|
903
|
-
}
|
|
904
|
-
return res;
|
|
905
|
-
});
|
|
906
|
-
__publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken, planName, price, returnUrl, trialDays, test) => {
|
|
907
|
-
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
908
|
-
const recurring_application_charge = {
|
|
909
|
-
name: planName,
|
|
910
|
-
price,
|
|
911
|
-
return_url: returnUrl,
|
|
912
|
-
trial_days: trialDays,
|
|
913
|
-
test
|
|
914
|
-
};
|
|
915
|
-
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, { recurring_application_charge });
|
|
916
|
-
if (res.status >= 400) {
|
|
917
|
-
log9.error("Failed to create App Subscription", { shop, accessToken, url });
|
|
918
|
-
}
|
|
919
|
-
return res;
|
|
920
|
-
});
|
|
921
|
-
__publicField(ShopifyClient, "cancelAppSubscription", async (shop, accessToken, chargeId) => {
|
|
922
|
-
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges/${chargeId}.json`;
|
|
923
|
-
const client2 = axiosHttpService();
|
|
924
|
-
const res = await client2.delete(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
925
|
-
if (res.status !== 200) {
|
|
926
|
-
log9.error("Failed to cancel recurring App billing", { shop, accessToken, url });
|
|
927
|
-
}
|
|
928
|
-
return res;
|
|
929
|
-
});
|
|
930
|
-
__publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) => {
|
|
931
|
-
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
932
|
-
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|
|
933
|
-
if (res.status >= 400) {
|
|
934
|
-
log9.error("Failed to get App Subscriptions", { shop, accessToken, url });
|
|
935
|
-
}
|
|
936
|
-
return res;
|
|
937
|
-
});
|
|
938
|
-
__publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload) => {
|
|
939
|
-
const client2 = axiosHttpService();
|
|
940
|
-
const res = await client2.post(url, payload, { headers: { "X-Shopify-Access-Token": accessToken, "Content-Type": "application/json" } });
|
|
941
|
-
log9.debug("Shopify Client Response", { res });
|
|
942
|
-
return res;
|
|
943
|
-
});
|
|
944
|
-
__publicField(ShopifyClient, "genericShopifyGet", async (url, accessToken) => {
|
|
945
|
-
const client2 = axiosHttpService();
|
|
946
|
-
const res = await client2.get(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
947
|
-
log9.debug("Shopify Client Response", { res });
|
|
948
|
-
return res;
|
|
949
|
-
});
|
|
950
|
-
__publicField(ShopifyClient, "genericShopifyPut", async (url, accessToken, payload) => {
|
|
951
|
-
const client2 = axiosHttpService();
|
|
952
|
-
const res = await client2.put(url, payload, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
953
|
-
log9.debug("Shopify Client Response", { res });
|
|
954
|
-
return res;
|
|
955
|
-
});
|
|
956
|
-
|
|
957
|
-
// src/helpers/input-validation-helper.ts
|
|
958
|
-
var log10 = __toESM(require("lambda-log"), 1);
|
|
959
|
-
var validateInput = (schema, input) => {
|
|
960
|
-
const { error: error7, value } = schema.validate(input);
|
|
961
|
-
if (error7) {
|
|
962
|
-
log10.info("", { error: error7 });
|
|
963
|
-
const httperr = HttpError.badRequest("Bad Request", {
|
|
964
|
-
errors: error7.details.map((detail) => ({
|
|
965
|
-
message: detail?.message,
|
|
966
|
-
key: detail?.context?.key,
|
|
967
|
-
path: detail?.path
|
|
968
|
-
}))
|
|
969
|
-
});
|
|
970
|
-
log10.info("", { httperr });
|
|
971
|
-
throw httperr;
|
|
972
|
-
}
|
|
973
|
-
return value;
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
// src/helpers/logging-helper.ts
|
|
977
|
-
var log11 = __toESM(require("lambda-log"), 1);
|
|
978
|
-
var stage = process?.env?.STAGE;
|
|
979
|
-
var configureLogger = (event, context, debug5 = true) => {
|
|
980
|
-
log11.options.meta.stage = stage;
|
|
981
|
-
log11.options.meta.source_name = context?.functionName || "unknown";
|
|
982
|
-
log11.options.meta.awsRequestId = context?.awsRequestId || "unknown";
|
|
983
|
-
log11.options.meta.lambdaEvent = event;
|
|
984
|
-
log11.options.debug = debug5;
|
|
985
|
-
};
|
|
986
|
-
|
|
987
|
-
// src/helpers/response-helper.ts
|
|
988
|
-
var success = (body) => {
|
|
989
|
-
return buildResponse(200, body);
|
|
990
|
-
};
|
|
991
|
-
var defaultError = {
|
|
992
|
-
message: "internalServerError"
|
|
993
|
-
};
|
|
994
|
-
var failure = (error7, statusCode = 500) => {
|
|
995
|
-
statusCode = error7?.statusCode ?? statusCode;
|
|
996
|
-
let body = defaultError;
|
|
997
|
-
if (error7?.body) {
|
|
998
|
-
body = error7.body;
|
|
999
|
-
} else if (error7?.message) {
|
|
1000
|
-
body = { message: error7.message };
|
|
1001
|
-
} else if (statusCode === 500) {
|
|
1002
|
-
body = defaultError;
|
|
1003
|
-
}
|
|
1004
|
-
return buildResponse(statusCode, body);
|
|
1005
|
-
};
|
|
1006
|
-
var buildResponse = (statusCode, body = {}) => {
|
|
1007
|
-
delete body.stack;
|
|
1008
|
-
return {
|
|
1009
|
-
statusCode,
|
|
1010
|
-
headers: {
|
|
1011
|
-
"Access-Control-Allow-Origin": "*",
|
|
1012
|
-
"Access-Control-Allow-Credentials": true,
|
|
1013
|
-
"cache-control": "max-age=86400",
|
|
1014
|
-
Date: /* @__PURE__ */ new Date(),
|
|
1015
|
-
"Last-Modified": /* @__PURE__ */ new Date(),
|
|
1016
|
-
"Access-Control-Allow-Headers": "Content-Type, Content-Encoding"
|
|
1017
|
-
},
|
|
1018
|
-
body: JSON.stringify(body)
|
|
1019
|
-
};
|
|
1020
|
-
};
|
|
1021
|
-
|
|
1022
|
-
// src/helpers/shopify-helper.ts
|
|
1023
|
-
var import_crypto = require("crypto");
|
|
1024
|
-
var log12 = __toESM(require("lambda-log"), 1);
|
|
1025
|
-
|
|
1026
|
-
// src/libs/url.ts
|
|
1027
|
-
var mapObjectToQueryString = (inputObj) => {
|
|
1028
|
-
const qsp = Object.entries(inputObj).sort((a, b) => a[0] < b[0] ? -1 : 1);
|
|
1029
|
-
const urlParams = new URLSearchParams();
|
|
1030
|
-
qsp.map((p2) => {
|
|
1031
|
-
urlParams.append(p2[0], p2[1]);
|
|
1032
|
-
});
|
|
1033
|
-
const qs = urlParams.toString();
|
|
1034
|
-
return qs;
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
|
-
// src/helpers/shopify-helper.ts
|
|
1038
|
-
var isShopifyRequestValid = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
1039
|
-
delete validationParams.hmac;
|
|
1040
|
-
const hmacString = mapObjectToQueryString(validationParams);
|
|
1041
|
-
const generatedHash = (0, import_crypto.createHmac)("sha256", shopifyAppApiSecret).update(hmacString).digest("hex");
|
|
1042
|
-
return generatedHash === validationHmac;
|
|
1043
|
-
};
|
|
1044
|
-
var validateShopifyRequest = (validationParams, validationHmac, shopifyAppApiSecret) => {
|
|
1045
|
-
log12.info("Validating shopify request is authentic", { validationParams });
|
|
1046
|
-
const isValid = isShopifyRequestValid(validationParams, validationHmac, shopifyAppApiSecret);
|
|
1047
|
-
if (!isValid) {
|
|
1048
|
-
const message = "Failed: Shopify Request hmac validation";
|
|
1049
|
-
log12.error(message);
|
|
1050
|
-
throw HttpError.badRequest(message);
|
|
1051
|
-
}
|
|
1052
|
-
log12.info("Sucess: Shopify Request hmac validation");
|
|
1053
|
-
return true;
|
|
1054
|
-
};
|
|
1055
|
-
|
|
1056
|
-
// node_modules/@adtrackify/at-tracking-event-types/dist/index.js
|
|
1057
|
-
var s = ((n) => (n.PENDING = "pending", n.ACTIVE = "active", n.INACTIVE = "inactive", n))(s || {});
|
|
1058
|
-
var g = ((i) => (i.FACEBOOK = "facebook", i.TIKTOK = "tiktok", i.GOOGLE_ADS = "googleAds", i.GOOGLE_ANALYTICS_4 = "googleAnalytics4", i.HUBSPOT = "hubspot", i.WEBHOOK = "webhook", i.CUSTOM_HTML = "customHTML", i.CUSTOM_JS = "customJS", i.SNAPCHAT = "snapchat", i.TWITTER = "twitter", i.REDDIT = "reddit", i))(g || {});
|
|
1059
|
-
var c = ((n) => (n.HEADER = "header", n.FOOTER = "footer", n.BODY = "body", n))(c || {});
|
|
1060
|
-
var p = ((o) => (o.STARTED = "started", o.COMPLETED = "completed", o.UNINSTALLED = "uninstalled", o.FAILED = "failed", o.NONE = "none", o))(p || {});
|
|
1061
|
-
var d = ((e) => (e.ACTIVE = "active", e.CANCELLED = "cancelled", e.DECLINED = "declined", e.EXPIRED = "expired", e.FROZEN = "frozen", e.PENDING = "pending", e.NOT_SUBMITTED = "na", e))(d || {});
|
|
1062
|
-
var f = ((a) => (a.MONTHLY = "monthly", a.YEARLY = "yearly", a))(f || {});
|
|
1063
|
-
var m = ((r) => (r.CURRENT = "current", r.PAST_DUE = "past_due", r.CANCELLED = "cancelled", r.FAILED = "failed", r))(m || {});
|
|
1064
|
-
var l = ((e) => (e.ACTIVE = "active", e.CANCELLED = "cancelled", e.DECLINED = "declined", e.EXPIRED = "expired", e.FROZEN = "frozen", e.PENDING = "pending", e.NOT_SUBMITTED = "na", e))(l || {});
|
|
1065
|
-
var u = ((n) => (n.STRIPE = "stripe", n.PAYPAL = "paypal", n.SHOPIFY = "shopify", n))(u || {});
|
|
1066
|
-
var x = ((t) => (t.ADD_PAYMENT_INFO = "add_payment_info", t.ADD_SHIPPING_INFO = "add_shipping_info", t.ADD_TO_CART = "add_to_cart", t.ADD_TO_WISHLIST = "add_to_wishlist", t.INITIATE_CHECKOUT = "initiate_checkout", t.LEAD = "lead", t.LOGIN = "login", t.PAGE_VIEW = "page_view", t.PURCHASE = "purchase", t.REFUND = "refund", t.SEARCH = "search", t.SIGN_UP = "sign_up", t.VIEW_CART = "view_cart", t.VIEW_CONTENT = "view_content", t.SELECT_SHIPPING_METHOD = "select_shipping_method", t.VIRTUALIZED_VIEWED_PAYMENT_FORM = "virtualized_viewd_payment_form", t.METRIC = "metric", t.WEB_VITAL = "web_vital", t))(x || {});
|
|
1067
|
-
var C = ((r) => (r.TRACKING = "tracking", r.METRIC = "metric", r.IDENTIFY = "identify", r.LOG = "log", r))(C || {});
|
|
1068
|
-
|
|
1069
|
-
// src/helpers/subscription-helper.ts
|
|
1070
|
-
var StripeBillingMap = {
|
|
1071
|
-
dev2: {
|
|
1072
|
-
"free": "price_1JzjbKK7krGh4037ezNbGJEm",
|
|
1073
|
-
"starter_monthly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1074
|
-
"starter_yearly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1075
|
-
"scale_monthly": "price_1JzjcSK7krGh4037yh34LPk3",
|
|
1076
|
-
"scale_yearly": "price_1JzjcSK7krGh4037QiBJYfnD",
|
|
1077
|
-
"growth_monthly": "price_1Jzje1K7krGh4037KErHBp5N",
|
|
1078
|
-
"growth_yearly": "price_1Jzje1K7krGh4037MhCUhTDh"
|
|
1079
|
-
},
|
|
1080
|
-
qa2: {
|
|
1081
|
-
"free": "price_1JzjbKK7krGh4037ezNbGJEm",
|
|
1082
|
-
"starter_monthly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1083
|
-
"starter_yearly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1084
|
-
"scale_monthly": "price_1JzjcSK7krGh4037yh34LPk3",
|
|
1085
|
-
"scale_yearly": "price_1JzjcSK7krGh4037QiBJYfnD",
|
|
1086
|
-
"growth_monthly": "price_1Jzje1K7krGh4037KErHBp5N",
|
|
1087
|
-
"growth_yearly": "price_1Jzje1K7krGh4037MhCUhTDh"
|
|
1088
|
-
},
|
|
1089
|
-
prod2: {
|
|
1090
|
-
"free": "price_1KAFsIK7krGh4037RsaAYMEl",
|
|
1091
|
-
"starter_monthly": "price_1KAFsMK7krGh4037Lz3P0ksU",
|
|
1092
|
-
"starter_yearly": "price_1KAFsMK7krGh4037Dj1WmSi8",
|
|
1093
|
-
"scale_monthly": "price_1KAFrxK7krGh4037zWCdaTly",
|
|
1094
|
-
"scale_yearly": "price_1KAFrxK7krGh40375fhymyWP",
|
|
1095
|
-
"growth_monthly": "price_1KAFs7K7krGh4037JChjz5Cr",
|
|
1096
|
-
"growth_yearly": "price_1KAFs7K7krGh4037rZElg12s"
|
|
1097
|
-
},
|
|
1098
|
-
dev: {
|
|
1099
|
-
"free": "price_1JzjbKK7krGh4037ezNbGJEm",
|
|
1100
|
-
"starter_monthly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1101
|
-
"starter_yearly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1102
|
-
"scale_monthly": "price_1JzjcSK7krGh4037yh34LPk3",
|
|
1103
|
-
"scale_yearly": "price_1JzjcSK7krGh4037QiBJYfnD",
|
|
1104
|
-
"growth_monthly": "price_1Jzje1K7krGh4037KErHBp5N",
|
|
1105
|
-
"growth_yearly": "price_1Jzje1K7krGh4037MhCUhTDh"
|
|
1106
|
-
},
|
|
1107
|
-
qa: {
|
|
1108
|
-
"free": "price_1JzjbKK7krGh4037ezNbGJEm",
|
|
1109
|
-
"starter_monthly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1110
|
-
"starter_yearly": "price_1JwzsGK7krGh4037Li0hPpsZ",
|
|
1111
|
-
"scale_monthly": "price_1JzjcSK7krGh4037yh34LPk3",
|
|
1112
|
-
"scale_yearly": "price_1JzjcSK7krGh4037QiBJYfnD",
|
|
1113
|
-
"growth_monthly": "price_1Jzje1K7krGh4037KErHBp5N",
|
|
1114
|
-
"growth_yearly": "price_1Jzje1K7krGh4037MhCUhTDh"
|
|
1115
|
-
},
|
|
1116
|
-
prod: {
|
|
1117
|
-
"free": "price_1KAFsIK7krGh4037RsaAYMEl",
|
|
1118
|
-
"starter_monthly": "price_1KAFsMK7krGh4037Lz3P0ksU",
|
|
1119
|
-
"starter_yearly": "price_1KAFsMK7krGh4037Dj1WmSi8",
|
|
1120
|
-
"scale_monthly": "price_1KAFrxK7krGh4037zWCdaTly",
|
|
1121
|
-
"scale_yearly": "price_1KAFrxK7krGh40375fhymyWP",
|
|
1122
|
-
"growth_monthly": "price_1KAFs7K7krGh4037JChjz5Cr",
|
|
1123
|
-
"growth_yearly": "price_1KAFs7K7krGh4037rZElg12s"
|
|
1124
|
-
}
|
|
1125
|
-
};
|
|
1126
|
-
var CommonPlanInfo = [
|
|
1127
|
-
//'60-day Risk Free Trial',
|
|
1128
|
-
"Free Server Side Tracking & Conversion API",
|
|
1129
|
-
"MultiPixel Support (Multiple facebook, tiktok, etc)",
|
|
1130
|
-
"Corrects Facebook Conversion Tracking post IOS14",
|
|
1131
|
-
"Increase ROAS & Attribution Data",
|
|
1132
|
-
"Enhanced Fingerprinting & Identity Resolution",
|
|
1133
|
-
"Unlimited Integrations",
|
|
1134
|
-
"Advanced Integrations (Webhooks, Custom JS/HTML, Hubspot)"
|
|
1135
|
-
];
|
|
1136
|
-
var SubscriptionPlanSeedItems = {
|
|
1137
|
-
items: [
|
|
1138
|
-
{
|
|
1139
|
-
id: 1,
|
|
1140
|
-
planName: "free",
|
|
1141
|
-
displayName: "Free",
|
|
1142
|
-
sku: "ADT-001",
|
|
1143
|
-
description: "Free Plan - Monthly",
|
|
1144
|
-
price: "0",
|
|
1145
|
-
displayPrice: "$0",
|
|
1146
|
-
billingFrequency: f.MONTHLY,
|
|
1147
|
-
trialLengthDays: 0,
|
|
1148
|
-
trialRequiresCreditCard: false,
|
|
1149
|
-
planDesc: [
|
|
1150
|
-
...CommonPlanInfo,
|
|
1151
|
-
"Free Up to 500 orders/month (50,000 events)*"
|
|
1152
|
-
],
|
|
1153
|
-
unitPriceText: "try now - free forever",
|
|
1154
|
-
isHighlighted: false,
|
|
1155
|
-
isBanner: false
|
|
1156
|
-
},
|
|
1157
|
-
// STARTER PLANS
|
|
1158
|
-
{
|
|
1159
|
-
id: 2,
|
|
1160
|
-
planName: "starter_monthly",
|
|
1161
|
-
displayName: "Starter",
|
|
1162
|
-
sku: "ADT-002",
|
|
1163
|
-
description: "Starter Plan - Monthly",
|
|
1164
|
-
price: "79.99",
|
|
1165
|
-
displayPrice: "$79.99",
|
|
1166
|
-
billingFrequency: f.MONTHLY,
|
|
1167
|
-
trialLengthDays: 60,
|
|
1168
|
-
trialRequiresCreditCard: false,
|
|
1169
|
-
planDesc: [
|
|
1170
|
-
"60-day Risk Free Trial",
|
|
1171
|
-
...CommonPlanInfo,
|
|
1172
|
-
"Up to 2,000 orders/month (250,000 events)*"
|
|
1173
|
-
],
|
|
1174
|
-
isHighlighted: true,
|
|
1175
|
-
isBanner: true,
|
|
1176
|
-
bannerColor: "blue",
|
|
1177
|
-
bannerText: "MOST POPULAR"
|
|
1178
|
-
},
|
|
1179
|
-
{
|
|
1180
|
-
id: 3,
|
|
1181
|
-
planName: "starter_yearly",
|
|
1182
|
-
displayName: "Starter",
|
|
1183
|
-
sku: "ADT-003",
|
|
1184
|
-
description: "Starter Plan - Yearly",
|
|
1185
|
-
price: "767.90",
|
|
1186
|
-
displayPrice: "$63.99",
|
|
1187
|
-
billingFrequency: f.YEARLY,
|
|
1188
|
-
trialLengthDays: 30,
|
|
1189
|
-
trialRequiresCreditCard: false,
|
|
1190
|
-
planDesc: [
|
|
1191
|
-
"60-day Risk Free Trial",
|
|
1192
|
-
...CommonPlanInfo,
|
|
1193
|
-
"Up to 2,000 orders/month (250,000 events)*"
|
|
1194
|
-
],
|
|
1195
|
-
unitPriceText: "billed yearly ($767.90) - 20% savings",
|
|
1196
|
-
isHighlighted: true,
|
|
1197
|
-
isBanner: true,
|
|
1198
|
-
bannerColor: "blue",
|
|
1199
|
-
bannerText: "MOST POPULAR"
|
|
1200
|
-
},
|
|
1201
|
-
// SCALE PLANS
|
|
1202
|
-
{
|
|
1203
|
-
id: 4,
|
|
1204
|
-
planName: "scale_monthly",
|
|
1205
|
-
displayName: "Scale",
|
|
1206
|
-
sku: "ADT-004",
|
|
1207
|
-
description: "Scale Plan - Monthly",
|
|
1208
|
-
price: "199.99",
|
|
1209
|
-
displayPrice: "$199.99",
|
|
1210
|
-
billingFrequency: f.MONTHLY,
|
|
1211
|
-
trialLengthDays: 60,
|
|
1212
|
-
trialRequiresCreditCard: false,
|
|
1213
|
-
planDesc: [
|
|
1214
|
-
"60-day Risk Free Trial",
|
|
1215
|
-
...CommonPlanInfo,
|
|
1216
|
-
"Up to 7,500 orders/month (750,000 events)*"
|
|
1217
|
-
],
|
|
1218
|
-
unitPriceText: "",
|
|
1219
|
-
isHighlighted: false,
|
|
1220
|
-
isBanner: false
|
|
1221
|
-
},
|
|
1222
|
-
{
|
|
1223
|
-
id: 5,
|
|
1224
|
-
planName: "scale_yearly",
|
|
1225
|
-
displayName: "Scale",
|
|
1226
|
-
sku: "ADT-005",
|
|
1227
|
-
description: "Scale Plan - Yearly",
|
|
1228
|
-
price: "1823.91",
|
|
1229
|
-
displayPrice: "$151.99",
|
|
1230
|
-
billingFrequency: f.YEARLY,
|
|
1231
|
-
trialLengthDays: 60,
|
|
1232
|
-
trialRequiresCreditCard: false,
|
|
1233
|
-
planDesc: [
|
|
1234
|
-
"60-day Risk Free Trial",
|
|
1235
|
-
...CommonPlanInfo,
|
|
1236
|
-
"Up to 7,500 orders/month (750,000 events)*"
|
|
1237
|
-
],
|
|
1238
|
-
unitPriceText: "billed yearly ($1823.91) - 24% savings",
|
|
1239
|
-
isHighlighted: false,
|
|
1240
|
-
isBanner: false
|
|
1241
|
-
}
|
|
1242
|
-
// // GROWTH PLANS
|
|
1243
|
-
// {
|
|
1244
|
-
// id: 6,
|
|
1245
|
-
// planName: 'growth_monthly',
|
|
1246
|
-
// displayName: 'Growth',
|
|
1247
|
-
// sku: 'ADT-006',
|
|
1248
|
-
// description: 'Growth Plan - Monthly',
|
|
1249
|
-
// price: '199.99',
|
|
1250
|
-
// displayPrice: '$199.99',
|
|
1251
|
-
// billingFrequency: PLAN_BILLING_FREQUENCY.MONTHLY,
|
|
1252
|
-
// trialLengthDays: 60,
|
|
1253
|
-
// trialRequiresCreditCard: false,
|
|
1254
|
-
// planDesc: [
|
|
1255
|
-
// '60-day Risk Free Trial',
|
|
1256
|
-
// ...CommonPlanInfo,
|
|
1257
|
-
// '250,000 tracking events/mo'
|
|
1258
|
-
// ],
|
|
1259
|
-
// unitPriceText: 'billed yearly ($540) - 25% savings',
|
|
1260
|
-
// isHighlighted: false,
|
|
1261
|
-
// isBanner: true,
|
|
1262
|
-
// bannerColor: 'orange',
|
|
1263
|
-
// bannerText: 'BEST VALUE'
|
|
1264
|
-
// }, {
|
|
1265
|
-
// id: 7,
|
|
1266
|
-
// planName: 'growth_yearly',
|
|
1267
|
-
// displayName: 'Growth',
|
|
1268
|
-
// sku: 'ADT-007',
|
|
1269
|
-
// description: 'Growth Plan - Yearly',
|
|
1270
|
-
// price: '1799.91',
|
|
1271
|
-
// displayPrice: '$149.99',
|
|
1272
|
-
// billingFrequency: PLAN_BILLING_FREQUENCY.YEARLY,
|
|
1273
|
-
// trialLengthDays: 60,
|
|
1274
|
-
// trialRequiresCreditCard: false,
|
|
1275
|
-
// planDesc: [
|
|
1276
|
-
// '30-day Risk Free Trial',
|
|
1277
|
-
// 'Fixes IOS14.5 tracking',
|
|
1278
|
-
// 'Multi Pixel Support',
|
|
1279
|
-
// 'Enhanced Tracking / Attribution',
|
|
1280
|
-
// 'Unlimited Facebook Conversion API',
|
|
1281
|
-
// 'Unlimited Integrations',
|
|
1282
|
-
// 'Easy no code setup',
|
|
1283
|
-
// '100,000 tracking events/mo'
|
|
1284
|
-
// ],
|
|
1285
|
-
// unitPriceText: 'billed yearly ($1799.91) - 25% savings',
|
|
1286
|
-
// isHighlighted: false,
|
|
1287
|
-
// isBanner: true,
|
|
1288
|
-
// bannerColor: 'orange',
|
|
1289
|
-
// bannerText: 'BEST VALUE'
|
|
1290
|
-
// },
|
|
1291
|
-
]
|
|
1292
|
-
};
|
|
1293
|
-
var getPlanDetails = (planId, stage2) => {
|
|
1294
|
-
const plan = SubscriptionPlanSeedItems.items.filter((x2) => x2.id === planId)[0];
|
|
1295
|
-
plan.stripePriceId = StripeBillingMap[stage2][plan.planName];
|
|
1296
|
-
return plan;
|
|
1297
|
-
};
|
|
1298
|
-
var getPlanByStripePriceId = (stripePriceId, stage2) => {
|
|
1299
|
-
const stripePriceIds = StripeBillingMap[stage2];
|
|
1300
|
-
const planName = Object.keys(stripePriceIds).find((key) => stripePriceIds[key] === stripePriceId);
|
|
1301
|
-
const plan = SubscriptionPlanSeedItems.items.filter((x2) => x2.planName === planName)[0];
|
|
1302
|
-
plan.stripePriceId = stripePriceId;
|
|
1303
|
-
return plan;
|
|
1304
|
-
};
|
|
1305
|
-
|
|
1306
|
-
// src/libs/crypto.ts
|
|
1307
|
-
var import_crypto2 = __toESM(require("crypto"), 1);
|
|
1308
|
-
var generatePublicKey = () => {
|
|
1309
|
-
const publicKey = import_crypto2.default.randomBytes(26);
|
|
1310
|
-
return publicKey.toString("utf8");
|
|
1311
|
-
};
|
|
1312
|
-
|
|
1313
|
-
// src/types/internal-events/event-detail-types.ts
|
|
1314
|
-
var ADTRACKIFY_EVENT_TYPES = /* @__PURE__ */ ((ADTRACKIFY_EVENT_TYPES2) => {
|
|
1315
|
-
ADTRACKIFY_EVENT_TYPES2["NOTIFY_SHOPIFY_SUBSCRIPTION_CREATED"] = "shopifySubscriptionCreated";
|
|
1316
|
-
ADTRACKIFY_EVENT_TYPES2["NOTIFY_SUBSCRIPTION_SIGNUP_COMPLETED"] = "subscription.signupCompleted";
|
|
1317
|
-
ADTRACKIFY_EVENT_TYPES2["REQUEST_SET_ACCOUNT_OWNER"] = "setAccountOwner";
|
|
1318
|
-
ADTRACKIFY_EVENT_TYPES2["REQUEST_SET_ACCOUNT_SUBSCRIPTION_ID"] = "setAccountSubscriptionId";
|
|
1319
|
-
return ADTRACKIFY_EVENT_TYPES2;
|
|
1320
|
-
})(ADTRACKIFY_EVENT_TYPES || {});
|
|
1321
|
-
var ADTRACKIFY_EVENT_SOURCES = /* @__PURE__ */ ((ADTRACKIFY_EVENT_SOURCES2) => {
|
|
1322
|
-
ADTRACKIFY_EVENT_SOURCES2["SUBSCRIPTIONS"] = "subscriptions";
|
|
1323
|
-
return ADTRACKIFY_EVENT_SOURCES2;
|
|
1324
|
-
})(ADTRACKIFY_EVENT_SOURCES || {});
|
|
1325
|
-
|
|
1326
|
-
// src/services/eventbridge-integration-service.ts
|
|
1327
|
-
var PostmarkRequestType = /* @__PURE__ */ ((PostmarkRequestType2) => {
|
|
1328
|
-
PostmarkRequestType2["SINGLE_EMAIL"] = "single_email";
|
|
1329
|
-
PostmarkRequestType2["TEMPLATE_EMAIL"] = "template_email";
|
|
1330
|
-
return PostmarkRequestType2;
|
|
1331
|
-
})(PostmarkRequestType || {});
|
|
1332
|
-
var ADTRACKIFY_EVENT_BRIDGE_EVENTS = /* @__PURE__ */ ((ADTRACKIFY_EVENT_BRIDGE_EVENTS2) => {
|
|
1333
|
-
ADTRACKIFY_EVENT_BRIDGE_EVENTS2["SEND_POSTMARK_EMAIL"] = "integration.sendPostmarkEmail";
|
|
1334
|
-
return ADTRACKIFY_EVENT_BRIDGE_EVENTS2;
|
|
1335
|
-
})(ADTRACKIFY_EVENT_BRIDGE_EVENTS || {});
|
|
1336
|
-
var EventBridgeIntegrationService = class {
|
|
1337
|
-
eventBridgeClient;
|
|
1338
|
-
EVENT_BUS_NAME;
|
|
1339
|
-
constructor(eventBusName) {
|
|
1340
|
-
this.eventBridgeClient = new EventBridgeClient(eventBusName);
|
|
1341
|
-
this.EVENT_BUS_NAME = eventBusName;
|
|
1342
|
-
}
|
|
1343
|
-
sendPostmarkEmailEvent = async (eventSource, postmarkMessage, postmarkServerToken) => {
|
|
1344
|
-
return await this.eventBridgeClient.buildAndSendEvent(
|
|
1345
|
-
eventSource,
|
|
1346
|
-
"integration.sendPostmarkEmail" /* SEND_POSTMARK_EMAIL */,
|
|
1347
|
-
{
|
|
1348
|
-
postmarkMessage,
|
|
1349
|
-
postmarkRequestType: "single_email" /* SINGLE_EMAIL */,
|
|
1350
|
-
postmarkServerToken
|
|
1351
|
-
}
|
|
1352
|
-
);
|
|
1353
|
-
};
|
|
1354
|
-
sendPostmarkTemplatedEmailEvent = async (eventSource, postmarkMessage, postmarkServerToken) => {
|
|
1355
|
-
return await this.eventBridgeClient.buildAndSendEvent(
|
|
1356
|
-
eventSource,
|
|
1357
|
-
"integration.sendPostmarkEmail" /* SEND_POSTMARK_EMAIL */,
|
|
1358
|
-
{
|
|
1359
|
-
postmarkMessage,
|
|
1360
|
-
postmarkRequestType: "template_email" /* TEMPLATE_EMAIL */,
|
|
1361
|
-
postmarkServerToken
|
|
1362
|
-
}
|
|
1363
|
-
);
|
|
1364
|
-
};
|
|
1365
|
-
};
|
|
1366
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1367
|
-
0 && (module.exports = {
|
|
1368
|
-
ADTRACKIFY_EVENT_BRIDGE_EVENTS,
|
|
1369
|
-
ADTRACKIFY_EVENT_SOURCES,
|
|
1370
|
-
ADTRACKIFY_EVENT_TYPES,
|
|
1371
|
-
AccountsClient,
|
|
1372
|
-
CognitoClient,
|
|
1373
|
-
CommonPlanInfo,
|
|
1374
|
-
DestinationsClient,
|
|
1375
|
-
DynamoDbClient,
|
|
1376
|
-
EventBridgeClient,
|
|
1377
|
-
EventBridgeIntegrationService,
|
|
1378
|
-
HttpError,
|
|
1379
|
-
HttpStatusCodes,
|
|
1380
|
-
PostmarkRequestType,
|
|
1381
|
-
S3Client,
|
|
1382
|
-
ShopifyAppInstallClient,
|
|
1383
|
-
ShopifyClient,
|
|
1384
|
-
StripeBillingMap,
|
|
1385
|
-
SubscriptionPlanSeedItems,
|
|
1386
|
-
UsersAuthClient,
|
|
1387
|
-
axiosHttpService,
|
|
1388
|
-
buildResponse,
|
|
1389
|
-
configureLogger,
|
|
1390
|
-
dictToAwsAttributes,
|
|
1391
|
-
failure,
|
|
1392
|
-
generatePublicKey,
|
|
1393
|
-
getCurrentDate,
|
|
1394
|
-
getCurrentTimestamp,
|
|
1395
|
-
getDateFromTimestamp,
|
|
1396
|
-
getPlanByStripePriceId,
|
|
1397
|
-
getPlanDetails,
|
|
1398
|
-
isShopifyRequestValid,
|
|
1399
|
-
mapObjectToQueryString,
|
|
1400
|
-
success,
|
|
1401
|
-
validateInput,
|
|
1402
|
-
validateShopifyRequest
|
|
1403
|
-
});
|
|
1404
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './clients/index.js';
|
|
2
|
+
export * from './helpers/index.js';
|
|
3
|
+
export * from './libs/index.js';
|
|
4
|
+
export * from './types/index.js';
|
|
5
|
+
export * from './services/index.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|