@winible/winible-typed 2.69.0 → 2.69.2
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/typed-model/{recurly-payment-monitoring-whitelist.js → featured-capper.js} +22 -16
- package/dist/typed-model/featured-capper.js.map +1 -0
- package/dist/utils/campaignUtils.js +53 -1
- package/dist/utils/campaignUtils.js.map +1 -1
- package/package.json +1 -1
- package/utils/campaignUtils.ts +148 -1
- package/dist/event-collector-models/config/config.js +0 -30
- package/dist/event-collector-models/config/config.js.map +0 -1
- package/dist/migrations/20241123184623-recurly-payment-monitoring-whitelist.js +0 -33
- package/dist/migrations/20241123184623-recurly-payment-monitoring-whitelist.js.map +0 -1
- package/dist/typed-model/recurly-payment-monitoring-whitelist.js.map +0 -1
- package/event-collector-models/config/config.ts +0 -29
@@ -4,16 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const sequelize_1 = require("sequelize");
|
7
|
-
const user_1 = __importDefault(require("./user"));
|
8
7
|
const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
|
9
|
-
|
8
|
+
const user_1 = __importDefault(require("./user"));
|
9
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
10
|
+
class FeaturedCapper extends sequelize_1.Model {
|
10
11
|
}
|
11
|
-
|
12
|
+
FeaturedCapper.init({
|
12
13
|
id: {
|
13
14
|
type: sequelize_1.DataTypes.BIGINT,
|
14
15
|
primaryKey: true,
|
15
16
|
allowNull: false,
|
16
|
-
|
17
|
+
defaultValue: pb_sequelize_1.default.fn("next_id"),
|
17
18
|
},
|
18
19
|
userId: {
|
19
20
|
type: sequelize_1.DataTypes.BIGINT,
|
@@ -21,25 +22,30 @@ RecurlyPaymentMonitoringWhitelist.init({
|
|
21
22
|
field: "user_id",
|
22
23
|
references: {
|
23
24
|
model: user_1.default,
|
24
|
-
key: "id",
|
25
25
|
},
|
26
|
-
|
26
|
+
},
|
27
|
+
priority: {
|
28
|
+
type: sequelize_1.DataTypes.SMALLINT,
|
29
|
+
field: "priority",
|
30
|
+
},
|
31
|
+
customLabel: {
|
32
|
+
type: sequelize_1.DataTypes.STRING,
|
33
|
+
field: "custom_label",
|
27
34
|
},
|
28
35
|
createdAt: sequelize_1.DataTypes.DATE,
|
36
|
+
updatedAt: sequelize_1.DataTypes.DATE,
|
29
37
|
}, {
|
38
|
+
tableName: "featured_cappers",
|
30
39
|
sequelize: pb_sequelize_1.default,
|
31
|
-
tableName: "recurly_payment_monitoring_whitelist",
|
32
|
-
timestamps: false,
|
33
40
|
});
|
34
|
-
user_1.default.hasOne(
|
41
|
+
user_1.default.hasOne(FeaturedCapper, {
|
35
42
|
foreignKey: "userId",
|
36
43
|
sourceKey: "id",
|
37
|
-
as: "paymentMonitoringWhitelist",
|
38
44
|
});
|
39
|
-
|
40
|
-
foreignKey: "
|
41
|
-
|
42
|
-
|
45
|
+
FeaturedCapper.hasOne(user_1.default, {
|
46
|
+
foreignKey: "id",
|
47
|
+
sourceKey: "userId",
|
48
|
+
onDelete: "NO ACTION",
|
43
49
|
});
|
44
|
-
exports.default =
|
45
|
-
//# sourceMappingURL=
|
50
|
+
exports.default = FeaturedCapper;
|
51
|
+
//# sourceMappingURL=featured-capper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"featured-capper.js","sourceRoot":"","sources":["../../typed-model/featured-capper.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAE1B,mEAAmE;AACnE,MAAM,cAAe,SAAQ,iBAG5B;CAUA;AAED,cAAc,CAAC,IAAI,CACjB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,sBAAS,CAAC,EAAE,CAAC,SAAS,CAAC;KACtC;IACD,MAAM,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,KAAK,EAAE,cAAI;SACZ;KACF;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,QAAQ;QACxB,KAAK,EAAE,UAAU;KAClB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,cAAc;KACtB;IAED,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,cAAI,CAAC,MAAM,CAAC,cAAc,EAAE;IAC1B,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,cAAc,CAAC,MAAM,CAAC,cAAI,EAAE;IAC1B,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAC;AAEH,kBAAe,cAAc,CAAC"}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.buildDynamicContentWithReplacements = void 0;
|
4
|
+
const src_1 = require("../src");
|
3
5
|
const CLIENT_URL = process.env.CLIENT_URL;
|
4
6
|
const VARIABLE_MAP = {
|
5
7
|
FIRST_NAME: "{FIRST_NAME}",
|
@@ -35,6 +37,7 @@ const buildReplacements = (contact, campaignMessage) => {
|
|
35
37
|
}
|
36
38
|
return replacements;
|
37
39
|
};
|
40
|
+
// Deprecated Method
|
38
41
|
const buildSmsQueueInput = (senderId, contact, campaignMessage, scheduleSendTime // Optional: Used for absolute/relative timing
|
39
42
|
) => {
|
40
43
|
const replacements = buildReplacements(contact, campaignMessage);
|
@@ -53,6 +56,7 @@ const buildSmsQueueInput = (senderId, contact, campaignMessage, scheduleSendTime
|
|
53
56
|
configuration: configuration,
|
54
57
|
};
|
55
58
|
};
|
59
|
+
// Deprecated Method
|
56
60
|
const buildEmailQueueInput = (senderId, contact, campaignMessage, scheduleSendTime // Optional: Used for absolute/relative timing
|
57
61
|
) => {
|
58
62
|
const replacements = buildReplacements(contact, campaignMessage);
|
@@ -71,5 +75,53 @@ const buildEmailQueueInput = (senderId, contact, campaignMessage, scheduleSendTi
|
|
71
75
|
configuration: configuration,
|
72
76
|
};
|
73
77
|
};
|
74
|
-
|
78
|
+
const buildSmsSendQueueEntry = ({ phoneNumberAssigned, content, contactPhoneNumber, sendAt, timingType, sendLogId, }) => {
|
79
|
+
return {
|
80
|
+
type: "CAMPAIGN_SMS",
|
81
|
+
payload: {
|
82
|
+
configuration: Object.assign(Object.assign({ phoneNumber: phoneNumberAssigned, body: content, to: contactPhoneNumber }, (sendLogId && { sendLogId })), (timingType !== src_1.MessageTimingType.IMMEDIATE &&
|
83
|
+
sendAt && {
|
84
|
+
sendAt: new Date(sendAt),
|
85
|
+
scheduleType: "fixed",
|
86
|
+
})),
|
87
|
+
},
|
88
|
+
};
|
89
|
+
};
|
90
|
+
const buildEmailSendQueueEntry = ({ templateId, apiKey, from, unixSendAt, contactEmail, sendLogId, subject, content, campaignMessageId, unsubscribeUrl, }) => {
|
91
|
+
const personalizationEntry = Object.assign({ to: [{ email: contactEmail }], dynamic_template_data: {
|
92
|
+
subject: subject,
|
93
|
+
html: content,
|
94
|
+
unsubscribe_url: unsubscribeUrl || "",
|
95
|
+
} }, (sendLogId && {
|
96
|
+
custom_args: {
|
97
|
+
send_log_id: sendLogId,
|
98
|
+
},
|
99
|
+
}));
|
100
|
+
const batchKey = `${campaignMessageId}_${templateId}_${unixSendAt || "immediate"}`;
|
101
|
+
return {
|
102
|
+
type: "CAMPAIGN_EMAIL",
|
103
|
+
payload: {
|
104
|
+
configuration: Object.assign({ batchKey,
|
105
|
+
apiKey,
|
106
|
+
from, personalization: personalizationEntry, templateId }, (unixSendAt && {
|
107
|
+
sendAt: unixSendAt,
|
108
|
+
})),
|
109
|
+
},
|
110
|
+
};
|
111
|
+
};
|
112
|
+
const buildDynamicContentWithReplacements = (content, replacements) => {
|
113
|
+
for (const [key, value] of Object.entries(replacements)) {
|
114
|
+
content = (content || "").split(key).join(value);
|
115
|
+
}
|
116
|
+
return content;
|
117
|
+
};
|
118
|
+
exports.buildDynamicContentWithReplacements = buildDynamicContentWithReplacements;
|
119
|
+
exports.default = {
|
120
|
+
buildReplacements,
|
121
|
+
buildEmailQueueInput,
|
122
|
+
buildSmsQueueInput,
|
123
|
+
buildSmsSendQueueEntry,
|
124
|
+
buildEmailSendQueueEntry,
|
125
|
+
buildDynamicContentWithReplacements: exports.buildDynamicContentWithReplacements,
|
126
|
+
};
|
75
127
|
//# sourceMappingURL=campaignUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"campaignUtils.js","sourceRoot":"","sources":["../../utils/campaignUtils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"campaignUtils.js","sourceRoot":"","sources":["../../utils/campaignUtils.ts"],"names":[],"mappings":";;;AAAA,gCAA2C;AA0B3C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;AAE1C,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,cAAc;IAC1B,YAAY,EAAE,gBAAgB;IAC9B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,iBAAiB;IAChC,gBAAgB,EAAE,oBAAoB;CACvC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,OAAa,EAAE,eAAgC,EAAE,EAAE;IAC5E,IAAI,YAAY,GAA2B,EAAE,CAAC;IAE9C,MAAM,OAAO,GAAG,CAAC,eAAe,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACxE,MAAM,OAAO,G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,OAAO,CAAC,YAAY,CAAC,EAAE;QACvD,OAAO,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAClD;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AATW,QAAA,mCAAmC,uCAS9C;AAEF,kBAAe;IACb,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,sBAAsB;IACtB,wBAAwB;IACxB,mCAAmC,EAAnC,2CAAmC;CACpC,CAAC"}
|
package/package.json
CHANGED
package/utils/campaignUtils.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { MessageTimingType } from "../src";
|
1
2
|
import { CampaignMessage, User } from "../typed-model";
|
2
3
|
|
3
4
|
type CampaignMessageConfiguration = {
|
@@ -78,6 +79,7 @@ const buildReplacements = (contact: User, campaignMessage: CampaignMessage) => {
|
|
78
79
|
return replacements;
|
79
80
|
};
|
80
81
|
|
82
|
+
// Deprecated Method
|
81
83
|
const buildSmsQueueInput = (
|
82
84
|
senderId: string,
|
83
85
|
contact: User,
|
@@ -103,6 +105,7 @@ const buildSmsQueueInput = (
|
|
103
105
|
};
|
104
106
|
};
|
105
107
|
|
108
|
+
// Deprecated Method
|
106
109
|
const buildEmailQueueInput = (
|
107
110
|
senderId: string,
|
108
111
|
contact: User,
|
@@ -128,4 +131,148 @@ const buildEmailQueueInput = (
|
|
128
131
|
};
|
129
132
|
};
|
130
133
|
|
131
|
-
export
|
134
|
+
export type CampaignEmailMessageConfiguration = {
|
135
|
+
batchKey?: string;
|
136
|
+
apiKey?: string;
|
137
|
+
personalization?: any;
|
138
|
+
from?: {
|
139
|
+
email: string;
|
140
|
+
name: string;
|
141
|
+
};
|
142
|
+
templateId?: string;
|
143
|
+
sendAt?: number;
|
144
|
+
};
|
145
|
+
|
146
|
+
export type CampaignSmsMessageConfiguration = {
|
147
|
+
phoneNumber: string;
|
148
|
+
to: string;
|
149
|
+
body: string;
|
150
|
+
sendAt?: Date;
|
151
|
+
scheduleType?: "fixed";
|
152
|
+
sendLogId?: string;
|
153
|
+
};
|
154
|
+
|
155
|
+
export type EmailSendQueueEntry = {
|
156
|
+
type: string;
|
157
|
+
payload: {
|
158
|
+
configuration: CampaignEmailMessageConfiguration;
|
159
|
+
};
|
160
|
+
};
|
161
|
+
|
162
|
+
export type SmsSendQueueEntry = {
|
163
|
+
type: string;
|
164
|
+
payload: {
|
165
|
+
configuration: CampaignSmsMessageConfiguration;
|
166
|
+
};
|
167
|
+
};
|
168
|
+
|
169
|
+
const buildSmsSendQueueEntry = ({
|
170
|
+
phoneNumberAssigned,
|
171
|
+
content,
|
172
|
+
contactPhoneNumber,
|
173
|
+
sendAt,
|
174
|
+
timingType,
|
175
|
+
sendLogId,
|
176
|
+
}: {
|
177
|
+
phoneNumberAssigned: string;
|
178
|
+
content: string;
|
179
|
+
contactPhoneNumber: string;
|
180
|
+
sendAt?: Date;
|
181
|
+
timingType?: MessageTimingType;
|
182
|
+
sendLogId: string;
|
183
|
+
}): SmsSendQueueEntry => {
|
184
|
+
return {
|
185
|
+
type: "CAMPAIGN_SMS",
|
186
|
+
payload: {
|
187
|
+
configuration: {
|
188
|
+
phoneNumber: phoneNumberAssigned,
|
189
|
+
body: content,
|
190
|
+
to: contactPhoneNumber,
|
191
|
+
...(sendLogId && { sendLogId }),
|
192
|
+
...(timingType !== MessageTimingType.IMMEDIATE &&
|
193
|
+
sendAt && {
|
194
|
+
sendAt: new Date(sendAt),
|
195
|
+
scheduleType: "fixed",
|
196
|
+
}),
|
197
|
+
},
|
198
|
+
},
|
199
|
+
};
|
200
|
+
};
|
201
|
+
|
202
|
+
const buildEmailSendQueueEntry = ({
|
203
|
+
templateId,
|
204
|
+
apiKey,
|
205
|
+
from,
|
206
|
+
unixSendAt,
|
207
|
+
contactEmail,
|
208
|
+
sendLogId,
|
209
|
+
subject,
|
210
|
+
content,
|
211
|
+
campaignMessageId,
|
212
|
+
unsubscribeUrl,
|
213
|
+
}: {
|
214
|
+
templateId: string;
|
215
|
+
apiKey: string;
|
216
|
+
from: { email: string; name: string };
|
217
|
+
unixSendAt?: number;
|
218
|
+
contactEmail: string;
|
219
|
+
sendLogId?: string;
|
220
|
+
subject: string;
|
221
|
+
content: string;
|
222
|
+
campaignMessageId: string;
|
223
|
+
unsubscribeUrl: string;
|
224
|
+
}): EmailSendQueueEntry => {
|
225
|
+
const personalizationEntry = {
|
226
|
+
to: [{ email: contactEmail }],
|
227
|
+
dynamic_template_data: {
|
228
|
+
subject: subject,
|
229
|
+
html: content,
|
230
|
+
unsubscribe_url: unsubscribeUrl || "",
|
231
|
+
},
|
232
|
+
...(sendLogId && {
|
233
|
+
custom_args: {
|
234
|
+
send_log_id: sendLogId,
|
235
|
+
},
|
236
|
+
}),
|
237
|
+
};
|
238
|
+
|
239
|
+
const batchKey = `${campaignMessageId}_${templateId}_${
|
240
|
+
unixSendAt || "immediate"
|
241
|
+
}`;
|
242
|
+
|
243
|
+
return {
|
244
|
+
type: "CAMPAIGN_EMAIL",
|
245
|
+
payload: {
|
246
|
+
configuration: {
|
247
|
+
batchKey,
|
248
|
+
apiKey,
|
249
|
+
from,
|
250
|
+
personalization: personalizationEntry,
|
251
|
+
templateId,
|
252
|
+
...(unixSendAt && {
|
253
|
+
sendAt: unixSendAt,
|
254
|
+
}),
|
255
|
+
},
|
256
|
+
},
|
257
|
+
};
|
258
|
+
};
|
259
|
+
|
260
|
+
export const buildDynamicContentWithReplacements = (
|
261
|
+
content: string,
|
262
|
+
replacements: Record<string, string>
|
263
|
+
) => {
|
264
|
+
for (const [key, value] of Object.entries(replacements)) {
|
265
|
+
content = (content || "").split(key).join(value);
|
266
|
+
}
|
267
|
+
|
268
|
+
return content;
|
269
|
+
};
|
270
|
+
|
271
|
+
export default {
|
272
|
+
buildReplacements,
|
273
|
+
buildEmailQueueInput,
|
274
|
+
buildSmsQueueInput,
|
275
|
+
buildSmsSendQueueEntry,
|
276
|
+
buildEmailSendQueueEntry,
|
277
|
+
buildDynamicContentWithReplacements,
|
278
|
+
};
|
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
require("dotenv").config();
|
3
|
-
module.exports = {
|
4
|
-
development: {
|
5
|
-
dialect: "postgres",
|
6
|
-
host: process.env.TS_DB_HOST,
|
7
|
-
port: process.env.TS_DB_PORT,
|
8
|
-
database: process.env.TS_DB_NAME,
|
9
|
-
username: process.env.TS_DB_USER,
|
10
|
-
password: process.env.TS_DB_PASSWORD,
|
11
|
-
dialectOptions: {
|
12
|
-
ssl: false,
|
13
|
-
},
|
14
|
-
},
|
15
|
-
production: {
|
16
|
-
dialect: "postgres",
|
17
|
-
host: process.env.TS_DB_HOST,
|
18
|
-
port: process.env.TS_DB_PORT,
|
19
|
-
database: process.env.TS_DB_NAME,
|
20
|
-
username: process.env.TS_DB_USER,
|
21
|
-
password: process.env.TS_DB_PASSWORD,
|
22
|
-
dialectOptions: {
|
23
|
-
ssl: {
|
24
|
-
require: true,
|
25
|
-
rejectUnauthorized: false,
|
26
|
-
},
|
27
|
-
},
|
28
|
-
},
|
29
|
-
};
|
30
|
-
//# sourceMappingURL=config.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../event-collector-models/config/config.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAE3B,MAAM,CAAC,OAAO,GAAG;IACf,WAAW,EAAE;QACX,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC5B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAChC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAChC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QACpC,cAAc,EAAE;YACd,GAAG,EAAE,KAAK;SACX;KACF;IACD,UAAU,EAAE;QACV,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC5B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAChC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAChC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QACpC,cAAc,EAAE;YACd,GAAG,EAAE;gBACH,OAAO,EAAE,IAAI;gBACb,kBAAkB,EAAE,KAAK;aAC1B;SACF;KACF;CACF,CAAC"}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const sequelize_1 = require("sequelize");
|
4
|
-
exports.default = {
|
5
|
-
async up(queryInterface, sequelize) {
|
6
|
-
await queryInterface.createTable("recurly_payment_monitoring_whitelist", {
|
7
|
-
id: {
|
8
|
-
type: sequelize_1.DataTypes.BIGINT,
|
9
|
-
primaryKey: true,
|
10
|
-
allowNull: false,
|
11
|
-
autoIncrement: true,
|
12
|
-
},
|
13
|
-
user_id: {
|
14
|
-
type: sequelize_1.DataTypes.BIGINT,
|
15
|
-
allowNull: false,
|
16
|
-
references: {
|
17
|
-
model: "users",
|
18
|
-
key: "id",
|
19
|
-
},
|
20
|
-
onDelete: "CASCADE",
|
21
|
-
},
|
22
|
-
createdAt: {
|
23
|
-
type: sequelize_1.DataTypes.DATE,
|
24
|
-
allowNull: false,
|
25
|
-
defaultValue: sequelize.literal("NOW()"),
|
26
|
-
},
|
27
|
-
});
|
28
|
-
},
|
29
|
-
async down(queryInterface, sequelize) {
|
30
|
-
await queryInterface.dropTable("recurly_payment_monitoring_whitelist");
|
31
|
-
},
|
32
|
-
};
|
33
|
-
//# sourceMappingURL=20241123184623-recurly-payment-monitoring-whitelist.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"20241123184623-recurly-payment-monitoring-whitelist.js","sourceRoot":"","sources":["../../migrations/20241123184623-recurly-payment-monitoring-whitelist.ts"],"names":[],"mappings":";;AAAA,yCAAiE;AAEjE,kBAAe;IACb,KAAK,CAAC,EAAE,CAAC,cAA8B,EAAE,SAAoB;QAC3D,MAAM,cAAc,CAAC,WAAW,CAAC,sCAAsC,EAAE;YACvE,EAAE,EAAE;gBACF,IAAI,EAAE,qBAAS,CAAC,MAAM;gBACtB,UAAU,EAAE,IAAI;gBAChB,SAAS,EAAE,KAAK;gBAChB,aAAa,EAAE,IAAI;aACpB;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,qBAAS,CAAC,MAAM;gBACtB,SAAS,EAAE,KAAK;gBAChB,UAAU,EAAE;oBACV,KAAK,EAAE,OAAO;oBACd,GAAG,EAAE,IAAI;iBACV;gBACD,QAAQ,EAAE,SAAS;aACpB;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,qBAAS,CAAC,IAAI;gBACpB,SAAS,EAAE,KAAK;gBAChB,YAAY,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;aACzC;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,cAA8B,EAAE,SAAoB;QAC7D,MAAM,cAAc,CAAC,SAAS,CAAC,sCAAsC,CAAC,CAAC;IACzE,CAAC;CACF,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"recurly-payment-monitoring-whitelist.js","sourceRoot":"","sources":["../../typed-model/recurly-payment-monitoring-whitelist.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kDAA0B;AAE1B,kEAAuC;AAEvC,MAAM,iCAAkC,SAAQ,iBAG/C;CAIA;AAED,iCAAiC,CAAC,IAAI,CACpC;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;KACpB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,KAAK,EAAE,cAAI;YACX,GAAG,EAAE,IAAI;SACV;QACD,QAAQ,EAAE,SAAS;KACpB;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAT,sBAAS;IACT,SAAS,EAAE,sCAAsC;IACjD,UAAU,EAAE,KAAK;CAClB,CACF,CAAC;AAGF,cAAI,CAAC,MAAM,CAAC,iCAAiC,EAAE;IAC7C,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,IAAI;IACf,EAAE,EAAE,4BAA4B;CACjC,CAAC,CAAC;AAEH,iCAAiC,CAAC,SAAS,CAAC,cAAI,EAAE;IAChD,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,IAAI;IACf,EAAE,EAAE,MAAM;CACX,CAAC,CAAC;AAEH,kBAAe,iCAAiC,CAAC"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require("dotenv").config();
|
2
|
-
|
3
|
-
module.exports = {
|
4
|
-
development: {
|
5
|
-
dialect: "postgres",
|
6
|
-
host: process.env.TS_DB_HOST,
|
7
|
-
port: process.env.TS_DB_PORT,
|
8
|
-
database: process.env.TS_DB_NAME,
|
9
|
-
username: process.env.TS_DB_USER,
|
10
|
-
password: process.env.TS_DB_PASSWORD,
|
11
|
-
dialectOptions: {
|
12
|
-
ssl: false,
|
13
|
-
},
|
14
|
-
},
|
15
|
-
production: {
|
16
|
-
dialect: "postgres",
|
17
|
-
host: process.env.TS_DB_HOST,
|
18
|
-
port: process.env.TS_DB_PORT,
|
19
|
-
database: process.env.TS_DB_NAME,
|
20
|
-
username: process.env.TS_DB_USER,
|
21
|
-
password: process.env.TS_DB_PASSWORD,
|
22
|
-
dialectOptions: {
|
23
|
-
ssl: {
|
24
|
-
require: true,
|
25
|
-
rejectUnauthorized: false,
|
26
|
-
},
|
27
|
-
},
|
28
|
-
},
|
29
|
-
};
|