@betterinternship/core 2.30.3 → 2.32.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/README.md +26 -26
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/auth/god-otp.js +6 -6
- package/dist/lib/config/cron.d.ts +6 -0
- package/dist/lib/config/cron.js +22 -0
- package/dist/lib/config/cron.js.map +1 -0
- package/dist/lib/config/index.d.ts +5 -0
- package/dist/lib/config/index.js +6 -0
- package/dist/lib/config/index.js.map +1 -0
- package/dist/lib/config/parse.d.ts +11 -0
- package/dist/lib/config/parse.js +89 -0
- package/dist/lib/config/parse.js.map +1 -0
- package/dist/lib/config/reader.d.ts +15 -0
- package/dist/lib/config/reader.js +132 -0
- package/dist/lib/config/reader.js.map +1 -0
- package/dist/lib/config/registry.d.ts +294 -0
- package/dist/lib/config/registry.js +247 -0
- package/dist/lib/config/registry.js.map +1 -0
- package/dist/lib/config/scheduler.d.ts +18 -0
- package/dist/lib/config/scheduler.js +72 -0
- package/dist/lib/config/scheduler.js.map +1 -0
- package/dist/lib/email/action.js +3 -3
- package/dist/lib/email/archive.js +3 -0
- package/dist/lib/email/archive.js.map +1 -1
- package/dist/lib/email/email.js +2 -0
- package/dist/lib/email/email.js.map +1 -1
- package/dist/lib/email/preview.js +20 -20
- package/dist/lib/email/shell.js +22 -22
- package/dist/lib/forms/field-preset-templates.js +8 -8
- package/dist/lib/pdf-viewer/form-previewer-rendering.js +7 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
export type ConfigGroup = 'Employer digests' | 'Stale listings' | 'Top pages' | 'Resumes' | 'Partners' | 'Docs jobs' | 'Employer stats';
|
|
2
|
+
interface ConfigDefBase {
|
|
3
|
+
env?: string;
|
|
4
|
+
group: ConfigGroup;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CronDef extends ConfigDefBase {
|
|
8
|
+
type: 'cron';
|
|
9
|
+
default: string;
|
|
10
|
+
timeZone?: string;
|
|
11
|
+
minIntervalMinutes: number;
|
|
12
|
+
}
|
|
13
|
+
export interface IntDef extends ConfigDefBase {
|
|
14
|
+
type: 'int';
|
|
15
|
+
default: number;
|
|
16
|
+
min: number;
|
|
17
|
+
max: number;
|
|
18
|
+
}
|
|
19
|
+
export interface BoolDef extends ConfigDefBase {
|
|
20
|
+
type: 'bool';
|
|
21
|
+
default: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface EnumDef extends ConfigDefBase {
|
|
24
|
+
type: 'enum';
|
|
25
|
+
options: readonly string[];
|
|
26
|
+
default: string;
|
|
27
|
+
}
|
|
28
|
+
export interface IntListDef extends ConfigDefBase {
|
|
29
|
+
type: 'int_list';
|
|
30
|
+
default: readonly number[];
|
|
31
|
+
min: number;
|
|
32
|
+
max: number;
|
|
33
|
+
maxItems: number;
|
|
34
|
+
}
|
|
35
|
+
export type ConfigDef = CronDef | IntDef | BoolDef | EnumDef | IntListDef;
|
|
36
|
+
export declare const CONFIG_REGISTRY: {
|
|
37
|
+
readonly 'career.digest.daily.cron': {
|
|
38
|
+
readonly type: "cron";
|
|
39
|
+
readonly env: "EMPLOYER_DIGEST_NOTIFICATION_INTERVAL";
|
|
40
|
+
readonly group: "Employer digests";
|
|
41
|
+
readonly description: "When the daily email of new applications goes out to employers.";
|
|
42
|
+
readonly default: "0 8 * * *";
|
|
43
|
+
readonly minIntervalMinutes: number;
|
|
44
|
+
};
|
|
45
|
+
readonly 'career.digest.shortlisted_reminder.cron': {
|
|
46
|
+
readonly type: "cron";
|
|
47
|
+
readonly env: "EMPLOYER_SHORTLISTED_REMINDER_NOTIFICATION_INTERVAL";
|
|
48
|
+
readonly group: "Employer digests";
|
|
49
|
+
readonly description: "When the shortlisted-applicants reminder is checked. It only sends in odd ISO weeks (Manila time).";
|
|
50
|
+
readonly default: "0 8 * * 1";
|
|
51
|
+
readonly timeZone: "Asia/Manila";
|
|
52
|
+
readonly minIntervalMinutes: number;
|
|
53
|
+
};
|
|
54
|
+
readonly 'career.digest.summary.cron': {
|
|
55
|
+
readonly type: "cron";
|
|
56
|
+
readonly env: "EMPLOYER_DIGEST_SUMMARY_NOTIFICATION_INTERVAL";
|
|
57
|
+
readonly group: "Employer digests";
|
|
58
|
+
readonly description: "When the weekly digest summary is posted to Discord.";
|
|
59
|
+
readonly default: "0 9 * * 1";
|
|
60
|
+
readonly timeZone: "Asia/Manila";
|
|
61
|
+
readonly minIntervalMinutes: number;
|
|
62
|
+
};
|
|
63
|
+
readonly 'career.stale_sweep.cron': {
|
|
64
|
+
readonly type: "cron";
|
|
65
|
+
readonly env: "STALE_SWEEP_CRON";
|
|
66
|
+
readonly group: "Stale listings";
|
|
67
|
+
readonly description: "When the stale-listings sweep runs.";
|
|
68
|
+
readonly default: "0 8 * * *";
|
|
69
|
+
readonly minIntervalMinutes: number;
|
|
70
|
+
};
|
|
71
|
+
readonly 'career.stale_sweep.mode': {
|
|
72
|
+
readonly type: "enum";
|
|
73
|
+
readonly env: "STALE_SWEEP_MODE";
|
|
74
|
+
readonly group: "Stale listings";
|
|
75
|
+
readonly description: "off does nothing, dry_run only reports what it would pause, live pauses the listings.";
|
|
76
|
+
readonly options: readonly ["off", "dry_run", "live"];
|
|
77
|
+
readonly default: "off";
|
|
78
|
+
};
|
|
79
|
+
readonly 'career.stale_sweep.dormant_days': {
|
|
80
|
+
readonly type: "int";
|
|
81
|
+
readonly env: "STALE_DORMANT_DAYS";
|
|
82
|
+
readonly group: "Stale listings";
|
|
83
|
+
readonly description: "An employer with no logins for this many days is dormant.";
|
|
84
|
+
readonly default: 120;
|
|
85
|
+
readonly min: 1;
|
|
86
|
+
readonly max: 3650;
|
|
87
|
+
};
|
|
88
|
+
readonly 'career.stale_sweep.unresponsive_days': {
|
|
89
|
+
readonly type: "int";
|
|
90
|
+
readonly env: "STALE_UNRESPONSIVE_DAYS";
|
|
91
|
+
readonly group: "Stale listings";
|
|
92
|
+
readonly description: "An employer with no logins for this many days, and an applicant still waiting, is unresponsive.";
|
|
93
|
+
readonly default: 30;
|
|
94
|
+
readonly min: 1;
|
|
95
|
+
readonly max: 3650;
|
|
96
|
+
};
|
|
97
|
+
readonly 'career.stale_sweep.neglect_days': {
|
|
98
|
+
readonly type: "int";
|
|
99
|
+
readonly env: "STALE_NEGLECT_DAYS";
|
|
100
|
+
readonly group: "Stale listings";
|
|
101
|
+
readonly description: "A listing with an applicant untouched for this many days, and no recent activity, counts as neglected.";
|
|
102
|
+
readonly default: 30;
|
|
103
|
+
readonly min: 1;
|
|
104
|
+
readonly max: 3650;
|
|
105
|
+
};
|
|
106
|
+
readonly 'career.stale_sweep.max_employers_per_run': {
|
|
107
|
+
readonly type: "int";
|
|
108
|
+
readonly env: "STALE_SWEEP_MAX_EMPLOYERS_PER_RUN";
|
|
109
|
+
readonly group: "Stale listings";
|
|
110
|
+
readonly description: "The most employers one sweep acts on.";
|
|
111
|
+
readonly default: 25;
|
|
112
|
+
readonly min: 1;
|
|
113
|
+
readonly max: 1000;
|
|
114
|
+
};
|
|
115
|
+
readonly 'career.top_pages.weekly_cron': {
|
|
116
|
+
readonly type: "cron";
|
|
117
|
+
readonly env: "TOP_PAGES_WEEKLY_CRON";
|
|
118
|
+
readonly group: "Top pages";
|
|
119
|
+
readonly description: "When the Top pages are regenerated for the new week. The week rolls over at Sunday 00:00 Manila by default.";
|
|
120
|
+
readonly default: "0 0 * * 0";
|
|
121
|
+
readonly timeZone: "Asia/Manila";
|
|
122
|
+
readonly minIntervalMinutes: number;
|
|
123
|
+
};
|
|
124
|
+
readonly 'career.top_pages.regen_on_sweep': {
|
|
125
|
+
readonly type: "bool";
|
|
126
|
+
readonly env: "TOP_PAGES_REGEN_ON_SWEEP";
|
|
127
|
+
readonly group: "Top pages";
|
|
128
|
+
readonly description: "Regenerate the Top pages after each stale-listings sweep, so paused listings show as hibernating.";
|
|
129
|
+
readonly default: false;
|
|
130
|
+
};
|
|
131
|
+
readonly 'career.top_pages.warm_concurrency': {
|
|
132
|
+
readonly type: "int";
|
|
133
|
+
readonly env: "TOP_PAGES_WARM_CONCURRENCY";
|
|
134
|
+
readonly group: "Top pages";
|
|
135
|
+
readonly description: "How many pages are warmed at once after a regeneration.";
|
|
136
|
+
readonly default: 4;
|
|
137
|
+
readonly min: 1;
|
|
138
|
+
readonly max: 32;
|
|
139
|
+
};
|
|
140
|
+
readonly 'career.top_pages.warm_max': {
|
|
141
|
+
readonly type: "int";
|
|
142
|
+
readonly env: "TOP_PAGES_WARM_MAX";
|
|
143
|
+
readonly group: "Top pages";
|
|
144
|
+
readonly description: "The most pages warmed after a regeneration.";
|
|
145
|
+
readonly default: 500;
|
|
146
|
+
readonly min: 1;
|
|
147
|
+
readonly max: 5000;
|
|
148
|
+
};
|
|
149
|
+
readonly 'career.top_pages.warm_verify_delay_ms': {
|
|
150
|
+
readonly type: "int";
|
|
151
|
+
readonly env: "TOP_PAGES_WARM_VERIFY_DELAY_MS";
|
|
152
|
+
readonly group: "Top pages";
|
|
153
|
+
readonly description: "Milliseconds to wait before checking that the warmed pages are live.";
|
|
154
|
+
readonly default: 15000;
|
|
155
|
+
readonly min: 1;
|
|
156
|
+
readonly max: 300000;
|
|
157
|
+
};
|
|
158
|
+
readonly 'career.resumes.max_per_user': {
|
|
159
|
+
readonly type: "int";
|
|
160
|
+
readonly env: "MAX_RESUMES_ALLOWED";
|
|
161
|
+
readonly group: "Resumes";
|
|
162
|
+
readonly description: "The most resumes one student can have uploaded.";
|
|
163
|
+
readonly default: 5;
|
|
164
|
+
readonly min: 1;
|
|
165
|
+
readonly max: 100;
|
|
166
|
+
};
|
|
167
|
+
readonly 'partners.signature_expiry_sweep.cron': {
|
|
168
|
+
readonly type: "cron";
|
|
169
|
+
readonly env: "IOM_SIGNATURE_EXPIRY_SWEEP_CRON";
|
|
170
|
+
readonly group: "Partners";
|
|
171
|
+
readonly description: "When MOA requests whose signing link has passed its deadline are marked expired.";
|
|
172
|
+
readonly default: "0 * * * *";
|
|
173
|
+
readonly minIntervalMinutes: 60;
|
|
174
|
+
};
|
|
175
|
+
readonly 'partners.expiry_sweep.cron': {
|
|
176
|
+
readonly type: "cron";
|
|
177
|
+
readonly env: "IOM_EXPIRY_SWEEP_CRON";
|
|
178
|
+
readonly group: "Partners";
|
|
179
|
+
readonly description: "When MOAs past their expiry date are marked expired.";
|
|
180
|
+
readonly default: "0 * * * *";
|
|
181
|
+
readonly minIntervalMinutes: 60;
|
|
182
|
+
};
|
|
183
|
+
readonly 'partners.parked_request_sweep.cron': {
|
|
184
|
+
readonly type: "cron";
|
|
185
|
+
readonly env: "IOM_PARKED_REQUEST_SWEEP_CRON";
|
|
186
|
+
readonly group: "Partners";
|
|
187
|
+
readonly description: "When parked auto-requests left behind by a restart are picked up again.";
|
|
188
|
+
readonly default: "0 * * * *";
|
|
189
|
+
readonly minIntervalMinutes: 60;
|
|
190
|
+
};
|
|
191
|
+
readonly 'partners.listing_acceptance_sweep.cron': {
|
|
192
|
+
readonly type: "cron";
|
|
193
|
+
readonly env: "IOM_LISTING_ACCEPTANCE_SWEEP_CRON";
|
|
194
|
+
readonly group: "Partners";
|
|
195
|
+
readonly description: "When waiting listing invites are promoted to accepted.";
|
|
196
|
+
readonly default: "0 * * * *";
|
|
197
|
+
readonly minIntervalMinutes: 60;
|
|
198
|
+
};
|
|
199
|
+
readonly 'partners.daily_notifications.cron': {
|
|
200
|
+
readonly type: "cron";
|
|
201
|
+
readonly env: "IOM_DAILY_NOTIFICATION_CRON";
|
|
202
|
+
readonly group: "Partners";
|
|
203
|
+
readonly description: "When lapsed documents are cleared and the expiry reminders are sent.";
|
|
204
|
+
readonly default: "0 8 * * *";
|
|
205
|
+
readonly timeZone: "Asia/Manila";
|
|
206
|
+
readonly minIntervalMinutes: number;
|
|
207
|
+
};
|
|
208
|
+
readonly 'partners.expiry_reminder_days': {
|
|
209
|
+
readonly type: "int_list";
|
|
210
|
+
readonly env: "IOM_EXPIRY_REMINDER_DAYS";
|
|
211
|
+
readonly group: "Partners";
|
|
212
|
+
readonly description: "How many days before expiry a reminder is sent, comma-separated (for example 30,7,1).";
|
|
213
|
+
readonly default: readonly [30, 7, 1];
|
|
214
|
+
readonly min: 1;
|
|
215
|
+
readonly max: 365;
|
|
216
|
+
readonly maxItems: 10;
|
|
217
|
+
};
|
|
218
|
+
readonly 'partners.expiring_soon_days': {
|
|
219
|
+
readonly type: "int";
|
|
220
|
+
readonly env: "IOM_EXPIRING_SOON_DAYS";
|
|
221
|
+
readonly group: "Partners";
|
|
222
|
+
readonly description: "A MOA expiring within this many days is shown as expiring soon.";
|
|
223
|
+
readonly default: 30;
|
|
224
|
+
readonly min: 1;
|
|
225
|
+
readonly max: 365;
|
|
226
|
+
};
|
|
227
|
+
readonly 'partners.max_active_moas_per_pair': {
|
|
228
|
+
readonly type: "int";
|
|
229
|
+
readonly env: "IOM_MAX_ACTIVE_MOAS_PER_PAIR";
|
|
230
|
+
readonly group: "Partners";
|
|
231
|
+
readonly description: "The most active MOAs one university and company pair can hold.";
|
|
232
|
+
readonly default: 3;
|
|
233
|
+
readonly min: 1;
|
|
234
|
+
readonly max: 20;
|
|
235
|
+
};
|
|
236
|
+
readonly 'partners.max_bulk_invite_recipients': {
|
|
237
|
+
readonly type: "int";
|
|
238
|
+
readonly env: "IOM_MAX_BULK_INVITE_RECIPIENTS";
|
|
239
|
+
readonly group: "Partners";
|
|
240
|
+
readonly description: "The most companies one bulk invite can include.";
|
|
241
|
+
readonly default: 100;
|
|
242
|
+
readonly min: 1;
|
|
243
|
+
readonly max: 1000;
|
|
244
|
+
};
|
|
245
|
+
readonly 'docs.mq_jobs_sweep.cron': {
|
|
246
|
+
readonly type: "cron";
|
|
247
|
+
readonly group: "Docs jobs";
|
|
248
|
+
readonly description: "When finished and failed background jobs are cleared out.";
|
|
249
|
+
readonly default: "0 3 * * *";
|
|
250
|
+
readonly minIntervalMinutes: 60;
|
|
251
|
+
};
|
|
252
|
+
readonly 'docs.mq_jobs_sweep.done_retention_days': {
|
|
253
|
+
readonly type: "int";
|
|
254
|
+
readonly group: "Docs jobs";
|
|
255
|
+
readonly description: "Finished background jobs are kept this many days.";
|
|
256
|
+
readonly default: 7;
|
|
257
|
+
readonly min: 1;
|
|
258
|
+
readonly max: 365;
|
|
259
|
+
};
|
|
260
|
+
readonly 'docs.mq_jobs_sweep.failed_retention_days': {
|
|
261
|
+
readonly type: "int";
|
|
262
|
+
readonly group: "Docs jobs";
|
|
263
|
+
readonly description: "Failed background jobs are kept this many days.";
|
|
264
|
+
readonly default: 30;
|
|
265
|
+
readonly min: 1;
|
|
266
|
+
readonly max: 365;
|
|
267
|
+
};
|
|
268
|
+
readonly 'tools.employer_login_metrics.cron': {
|
|
269
|
+
readonly type: "cron";
|
|
270
|
+
readonly group: "Employer stats";
|
|
271
|
+
readonly description: "When the employer login numbers on the Stats page are refreshed.";
|
|
272
|
+
readonly default: "0 0 * * *";
|
|
273
|
+
readonly timeZone: "Asia/Manila";
|
|
274
|
+
readonly minIntervalMinutes: 60;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
export type ConfigKey = keyof typeof CONFIG_REGISTRY;
|
|
278
|
+
type DefOf<K extends ConfigKey> = (typeof CONFIG_REGISTRY)[K];
|
|
279
|
+
export type ConfigValue<K extends ConfigKey> = DefOf<K> extends {
|
|
280
|
+
type: 'cron';
|
|
281
|
+
} ? string : DefOf<K> extends {
|
|
282
|
+
type: 'int';
|
|
283
|
+
} ? number : DefOf<K> extends {
|
|
284
|
+
type: 'bool';
|
|
285
|
+
} ? boolean : DefOf<K> extends {
|
|
286
|
+
type: 'int_list';
|
|
287
|
+
} ? number[] : DefOf<K> extends {
|
|
288
|
+
type: 'enum';
|
|
289
|
+
options: infer O;
|
|
290
|
+
} ? O extends readonly string[] ? O[number] : never : never;
|
|
291
|
+
export type ConfigRuntimeValue = string | number | boolean | number[];
|
|
292
|
+
export declare const CONFIG_KEYS: ConfigKey[];
|
|
293
|
+
export declare const isConfigKey: (key: string) => key is ConfigKey;
|
|
294
|
+
export {};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
const MANILA = 'Asia/Manila';
|
|
2
|
+
const HOURLY = 60;
|
|
3
|
+
const DAILY = 24 * 60;
|
|
4
|
+
export const CONFIG_REGISTRY = {
|
|
5
|
+
'career.digest.daily.cron': {
|
|
6
|
+
type: 'cron',
|
|
7
|
+
env: 'EMPLOYER_DIGEST_NOTIFICATION_INTERVAL',
|
|
8
|
+
group: 'Employer digests',
|
|
9
|
+
description: 'When the daily email of new applications goes out to employers.',
|
|
10
|
+
default: '0 8 * * *',
|
|
11
|
+
minIntervalMinutes: DAILY,
|
|
12
|
+
},
|
|
13
|
+
'career.digest.shortlisted_reminder.cron': {
|
|
14
|
+
type: 'cron',
|
|
15
|
+
env: 'EMPLOYER_SHORTLISTED_REMINDER_NOTIFICATION_INTERVAL',
|
|
16
|
+
group: 'Employer digests',
|
|
17
|
+
description: 'When the shortlisted-applicants reminder is checked. It only sends in odd ISO weeks (Manila time).',
|
|
18
|
+
default: '0 8 * * 1',
|
|
19
|
+
timeZone: MANILA,
|
|
20
|
+
minIntervalMinutes: DAILY,
|
|
21
|
+
},
|
|
22
|
+
'career.digest.summary.cron': {
|
|
23
|
+
type: 'cron',
|
|
24
|
+
env: 'EMPLOYER_DIGEST_SUMMARY_NOTIFICATION_INTERVAL',
|
|
25
|
+
group: 'Employer digests',
|
|
26
|
+
description: 'When the weekly digest summary is posted to Discord.',
|
|
27
|
+
default: '0 9 * * 1',
|
|
28
|
+
timeZone: MANILA,
|
|
29
|
+
minIntervalMinutes: DAILY,
|
|
30
|
+
},
|
|
31
|
+
'career.stale_sweep.cron': {
|
|
32
|
+
type: 'cron',
|
|
33
|
+
env: 'STALE_SWEEP_CRON',
|
|
34
|
+
group: 'Stale listings',
|
|
35
|
+
description: 'When the stale-listings sweep runs.',
|
|
36
|
+
default: '0 8 * * *',
|
|
37
|
+
minIntervalMinutes: DAILY,
|
|
38
|
+
},
|
|
39
|
+
'career.stale_sweep.mode': {
|
|
40
|
+
type: 'enum',
|
|
41
|
+
env: 'STALE_SWEEP_MODE',
|
|
42
|
+
group: 'Stale listings',
|
|
43
|
+
description: 'off does nothing, dry_run only reports what it would pause, live pauses the listings.',
|
|
44
|
+
options: ['off', 'dry_run', 'live'],
|
|
45
|
+
default: 'off',
|
|
46
|
+
},
|
|
47
|
+
'career.stale_sweep.dormant_days': {
|
|
48
|
+
type: 'int',
|
|
49
|
+
env: 'STALE_DORMANT_DAYS',
|
|
50
|
+
group: 'Stale listings',
|
|
51
|
+
description: 'An employer with no logins for this many days is dormant.',
|
|
52
|
+
default: 120,
|
|
53
|
+
min: 1,
|
|
54
|
+
max: 3650,
|
|
55
|
+
},
|
|
56
|
+
'career.stale_sweep.unresponsive_days': {
|
|
57
|
+
type: 'int',
|
|
58
|
+
env: 'STALE_UNRESPONSIVE_DAYS',
|
|
59
|
+
group: 'Stale listings',
|
|
60
|
+
description: 'An employer with no logins for this many days, and an applicant still waiting, is unresponsive.',
|
|
61
|
+
default: 30,
|
|
62
|
+
min: 1,
|
|
63
|
+
max: 3650,
|
|
64
|
+
},
|
|
65
|
+
'career.stale_sweep.neglect_days': {
|
|
66
|
+
type: 'int',
|
|
67
|
+
env: 'STALE_NEGLECT_DAYS',
|
|
68
|
+
group: 'Stale listings',
|
|
69
|
+
description: 'A listing with an applicant untouched for this many days, and no recent activity, counts as neglected.',
|
|
70
|
+
default: 30,
|
|
71
|
+
min: 1,
|
|
72
|
+
max: 3650,
|
|
73
|
+
},
|
|
74
|
+
'career.stale_sweep.max_employers_per_run': {
|
|
75
|
+
type: 'int',
|
|
76
|
+
env: 'STALE_SWEEP_MAX_EMPLOYERS_PER_RUN',
|
|
77
|
+
group: 'Stale listings',
|
|
78
|
+
description: 'The most employers one sweep acts on.',
|
|
79
|
+
default: 25,
|
|
80
|
+
min: 1,
|
|
81
|
+
max: 1000,
|
|
82
|
+
},
|
|
83
|
+
'career.top_pages.weekly_cron': {
|
|
84
|
+
type: 'cron',
|
|
85
|
+
env: 'TOP_PAGES_WEEKLY_CRON',
|
|
86
|
+
group: 'Top pages',
|
|
87
|
+
description: 'When the Top pages are regenerated for the new week. The week rolls over at Sunday 00:00 Manila by default.',
|
|
88
|
+
default: '0 0 * * 0',
|
|
89
|
+
timeZone: MANILA,
|
|
90
|
+
minIntervalMinutes: DAILY,
|
|
91
|
+
},
|
|
92
|
+
'career.top_pages.regen_on_sweep': {
|
|
93
|
+
type: 'bool',
|
|
94
|
+
env: 'TOP_PAGES_REGEN_ON_SWEEP',
|
|
95
|
+
group: 'Top pages',
|
|
96
|
+
description: 'Regenerate the Top pages after each stale-listings sweep, so paused listings show as hibernating.',
|
|
97
|
+
default: false,
|
|
98
|
+
},
|
|
99
|
+
'career.top_pages.warm_concurrency': {
|
|
100
|
+
type: 'int',
|
|
101
|
+
env: 'TOP_PAGES_WARM_CONCURRENCY',
|
|
102
|
+
group: 'Top pages',
|
|
103
|
+
description: 'How many pages are warmed at once after a regeneration.',
|
|
104
|
+
default: 4,
|
|
105
|
+
min: 1,
|
|
106
|
+
max: 32,
|
|
107
|
+
},
|
|
108
|
+
'career.top_pages.warm_max': {
|
|
109
|
+
type: 'int',
|
|
110
|
+
env: 'TOP_PAGES_WARM_MAX',
|
|
111
|
+
group: 'Top pages',
|
|
112
|
+
description: 'The most pages warmed after a regeneration.',
|
|
113
|
+
default: 500,
|
|
114
|
+
min: 1,
|
|
115
|
+
max: 5000,
|
|
116
|
+
},
|
|
117
|
+
'career.top_pages.warm_verify_delay_ms': {
|
|
118
|
+
type: 'int',
|
|
119
|
+
env: 'TOP_PAGES_WARM_VERIFY_DELAY_MS',
|
|
120
|
+
group: 'Top pages',
|
|
121
|
+
description: 'Milliseconds to wait before checking that the warmed pages are live.',
|
|
122
|
+
default: 15000,
|
|
123
|
+
min: 1,
|
|
124
|
+
max: 300000,
|
|
125
|
+
},
|
|
126
|
+
'career.resumes.max_per_user': {
|
|
127
|
+
type: 'int',
|
|
128
|
+
env: 'MAX_RESUMES_ALLOWED',
|
|
129
|
+
group: 'Resumes',
|
|
130
|
+
description: 'The most resumes one student can have uploaded.',
|
|
131
|
+
default: 5,
|
|
132
|
+
min: 1,
|
|
133
|
+
max: 100,
|
|
134
|
+
},
|
|
135
|
+
'partners.signature_expiry_sweep.cron': {
|
|
136
|
+
type: 'cron',
|
|
137
|
+
env: 'IOM_SIGNATURE_EXPIRY_SWEEP_CRON',
|
|
138
|
+
group: 'Partners',
|
|
139
|
+
description: 'When MOA requests whose signing link has passed its deadline are marked expired.',
|
|
140
|
+
default: '0 * * * *',
|
|
141
|
+
minIntervalMinutes: HOURLY,
|
|
142
|
+
},
|
|
143
|
+
'partners.expiry_sweep.cron': {
|
|
144
|
+
type: 'cron',
|
|
145
|
+
env: 'IOM_EXPIRY_SWEEP_CRON',
|
|
146
|
+
group: 'Partners',
|
|
147
|
+
description: 'When MOAs past their expiry date are marked expired.',
|
|
148
|
+
default: '0 * * * *',
|
|
149
|
+
minIntervalMinutes: HOURLY,
|
|
150
|
+
},
|
|
151
|
+
'partners.parked_request_sweep.cron': {
|
|
152
|
+
type: 'cron',
|
|
153
|
+
env: 'IOM_PARKED_REQUEST_SWEEP_CRON',
|
|
154
|
+
group: 'Partners',
|
|
155
|
+
description: 'When parked auto-requests left behind by a restart are picked up again.',
|
|
156
|
+
default: '0 * * * *',
|
|
157
|
+
minIntervalMinutes: HOURLY,
|
|
158
|
+
},
|
|
159
|
+
'partners.listing_acceptance_sweep.cron': {
|
|
160
|
+
type: 'cron',
|
|
161
|
+
env: 'IOM_LISTING_ACCEPTANCE_SWEEP_CRON',
|
|
162
|
+
group: 'Partners',
|
|
163
|
+
description: 'When waiting listing invites are promoted to accepted.',
|
|
164
|
+
default: '0 * * * *',
|
|
165
|
+
minIntervalMinutes: HOURLY,
|
|
166
|
+
},
|
|
167
|
+
'partners.daily_notifications.cron': {
|
|
168
|
+
type: 'cron',
|
|
169
|
+
env: 'IOM_DAILY_NOTIFICATION_CRON',
|
|
170
|
+
group: 'Partners',
|
|
171
|
+
description: 'When lapsed documents are cleared and the expiry reminders are sent.',
|
|
172
|
+
default: '0 8 * * *',
|
|
173
|
+
timeZone: MANILA,
|
|
174
|
+
minIntervalMinutes: DAILY,
|
|
175
|
+
},
|
|
176
|
+
'partners.expiry_reminder_days': {
|
|
177
|
+
type: 'int_list',
|
|
178
|
+
env: 'IOM_EXPIRY_REMINDER_DAYS',
|
|
179
|
+
group: 'Partners',
|
|
180
|
+
description: 'How many days before expiry a reminder is sent, comma-separated (for example 30,7,1).',
|
|
181
|
+
default: [30, 7, 1],
|
|
182
|
+
min: 1,
|
|
183
|
+
max: 365,
|
|
184
|
+
maxItems: 10,
|
|
185
|
+
},
|
|
186
|
+
'partners.expiring_soon_days': {
|
|
187
|
+
type: 'int',
|
|
188
|
+
env: 'IOM_EXPIRING_SOON_DAYS',
|
|
189
|
+
group: 'Partners',
|
|
190
|
+
description: 'A MOA expiring within this many days is shown as expiring soon.',
|
|
191
|
+
default: 30,
|
|
192
|
+
min: 1,
|
|
193
|
+
max: 365,
|
|
194
|
+
},
|
|
195
|
+
'partners.max_active_moas_per_pair': {
|
|
196
|
+
type: 'int',
|
|
197
|
+
env: 'IOM_MAX_ACTIVE_MOAS_PER_PAIR',
|
|
198
|
+
group: 'Partners',
|
|
199
|
+
description: 'The most active MOAs one university and company pair can hold.',
|
|
200
|
+
default: 3,
|
|
201
|
+
min: 1,
|
|
202
|
+
max: 20,
|
|
203
|
+
},
|
|
204
|
+
'partners.max_bulk_invite_recipients': {
|
|
205
|
+
type: 'int',
|
|
206
|
+
env: 'IOM_MAX_BULK_INVITE_RECIPIENTS',
|
|
207
|
+
group: 'Partners',
|
|
208
|
+
description: 'The most companies one bulk invite can include.',
|
|
209
|
+
default: 100,
|
|
210
|
+
min: 1,
|
|
211
|
+
max: 1000,
|
|
212
|
+
},
|
|
213
|
+
'docs.mq_jobs_sweep.cron': {
|
|
214
|
+
type: 'cron',
|
|
215
|
+
group: 'Docs jobs',
|
|
216
|
+
description: 'When finished and failed background jobs are cleared out.',
|
|
217
|
+
default: '0 3 * * *',
|
|
218
|
+
minIntervalMinutes: HOURLY,
|
|
219
|
+
},
|
|
220
|
+
'docs.mq_jobs_sweep.done_retention_days': {
|
|
221
|
+
type: 'int',
|
|
222
|
+
group: 'Docs jobs',
|
|
223
|
+
description: 'Finished background jobs are kept this many days.',
|
|
224
|
+
default: 7,
|
|
225
|
+
min: 1,
|
|
226
|
+
max: 365,
|
|
227
|
+
},
|
|
228
|
+
'docs.mq_jobs_sweep.failed_retention_days': {
|
|
229
|
+
type: 'int',
|
|
230
|
+
group: 'Docs jobs',
|
|
231
|
+
description: 'Failed background jobs are kept this many days.',
|
|
232
|
+
default: 30,
|
|
233
|
+
min: 1,
|
|
234
|
+
max: 365,
|
|
235
|
+
},
|
|
236
|
+
'tools.employer_login_metrics.cron': {
|
|
237
|
+
type: 'cron',
|
|
238
|
+
group: 'Employer stats',
|
|
239
|
+
description: 'When the employer login numbers on the Stats page are refreshed.',
|
|
240
|
+
default: '0 0 * * *',
|
|
241
|
+
timeZone: MANILA,
|
|
242
|
+
minIntervalMinutes: HOURLY,
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
export const CONFIG_KEYS = Object.keys(CONFIG_REGISTRY);
|
|
246
|
+
export const isConfigKey = (key) => Object.hasOwn(CONFIG_REGISTRY, key);
|
|
247
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../lib/config/registry.ts"],"names":[],"mappings":"AAqEA,MAAM,MAAM,GAAG,aAAa,CAAC;AAC7B,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,KAAK,GAAG,EAAE,GAAG,EAAE,CAAC;AAEtB,MAAM,CAAC,MAAM,eAAe,GAAG;IAE7B,0BAA0B,EAAE;QAC1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AAE,CAAC;QACN,GAAG,EAAE,GAAG;KACT;IACD,0CAA0C,EAAE;QAC1C,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,iDAAiD;QAC9D,OAAO,EAAE,EAAE;QACX,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,GAAG;KACT;IAGD,mCAAmC,EAAE;QACnC,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,kEAAkE;QACpE,OAAO,EAAE,WAAW;QACpB,QAAQ,EAAE,MAAM;QAChB,kBAAkB,EAAE,MAAM;KAC3B;CAC2C,CAAC;AA2B/C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAgB,CAAC;AAEvE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAoB,EAAE,CAC3D,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ConfigLogger } from './reader.js';
|
|
2
|
+
import { CONFIG_REGISTRY, type ConfigKey } from './registry.js';
|
|
3
|
+
export type CronConfigKey = {
|
|
4
|
+
[K in ConfigKey]: (typeof CONFIG_REGISTRY)[K] extends {
|
|
5
|
+
type: 'cron';
|
|
6
|
+
} ? K : never;
|
|
7
|
+
}[ConfigKey];
|
|
8
|
+
export interface ConfiguredCronOptions {
|
|
9
|
+
key: CronConfigKey;
|
|
10
|
+
name: string;
|
|
11
|
+
run: () => unknown;
|
|
12
|
+
logger?: ConfigLogger;
|
|
13
|
+
}
|
|
14
|
+
export interface ConfiguredCron {
|
|
15
|
+
stop(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const scheduleConfigured: (options: ConfiguredCronOptions) => Promise<ConfiguredCron>;
|
|
18
|
+
export declare const scheduleConfiguredGroup: (jobs: readonly ConfiguredCronOptions[]) => Promise<ConfiguredCron>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { loadCron } from './cron.js';
|
|
2
|
+
import { getConfigWithSource } from './reader.js';
|
|
3
|
+
import { CONFIG_REGISTRY } from './registry.js';
|
|
4
|
+
const WATCH_INTERVAL_MS = 60_000;
|
|
5
|
+
export const scheduleConfigured = async (options) => {
|
|
6
|
+
const { key, name, run } = options;
|
|
7
|
+
const logger = options.logger ?? {
|
|
8
|
+
log: (message) => console.log(`[config] ${message}`),
|
|
9
|
+
warn: (message) => console.warn(`[config] ${message}`),
|
|
10
|
+
error: (message) => console.error(`[config] ${message}`),
|
|
11
|
+
};
|
|
12
|
+
const def = CONFIG_REGISTRY[key];
|
|
13
|
+
const { CronJob } = await loadCron();
|
|
14
|
+
let running = null;
|
|
15
|
+
let stopped = false;
|
|
16
|
+
let applying = false;
|
|
17
|
+
const tick = async () => {
|
|
18
|
+
try {
|
|
19
|
+
await run();
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
logger.error(`Job "${name}" failed: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}`);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const apply = async () => {
|
|
26
|
+
if (stopped || applying)
|
|
27
|
+
return;
|
|
28
|
+
applying = true;
|
|
29
|
+
try {
|
|
30
|
+
const { value: expression, source } = await getConfigWithSource(key, logger);
|
|
31
|
+
if (stopped || running?.expression === expression)
|
|
32
|
+
return;
|
|
33
|
+
const job = CronJob.from({
|
|
34
|
+
cronTime: expression,
|
|
35
|
+
onTick: tick,
|
|
36
|
+
start: true,
|
|
37
|
+
timeZone: def.timeZone,
|
|
38
|
+
});
|
|
39
|
+
void running?.job.stop();
|
|
40
|
+
const previous = running?.expression;
|
|
41
|
+
running = { expression, job };
|
|
42
|
+
const next = job.nextDate().toISO() ?? 'unknown';
|
|
43
|
+
logger.log(previous === undefined
|
|
44
|
+
? `"${name}" scheduled: ${expression} (${source}), next run ${next}`
|
|
45
|
+
: `"${name}" rescheduled: ${previous} -> ${expression} (${source}), next run ${next}`);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
logger.error(`Could not schedule "${name}"${running ? ` (still on ${running.expression})` : ''}: ${error instanceof Error ? error.message : String(error)}`);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
applying = false;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
await apply();
|
|
55
|
+
const watcher = setInterval(() => void apply(), WATCH_INTERVAL_MS);
|
|
56
|
+
watcher.unref();
|
|
57
|
+
return {
|
|
58
|
+
stop: () => {
|
|
59
|
+
stopped = true;
|
|
60
|
+
clearInterval(watcher);
|
|
61
|
+
void running?.job.stop();
|
|
62
|
+
running = null;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export const scheduleConfiguredGroup = async (jobs) => {
|
|
67
|
+
const started = [];
|
|
68
|
+
for (const job of jobs)
|
|
69
|
+
started.push(await scheduleConfigured(job));
|
|
70
|
+
return { stop: () => started.forEach((job) => job.stop()) };
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../../lib/config/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAqB,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,eAAe,EAAgC,MAAM,eAAe,CAAC;AAwB9E,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAajC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,OAA8B,EACL,EAAE;IAC3B,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACnC,MAAM,MAAM,GAAiB,OAAO,CAAC,MAAM,IAAI;QAC7C,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,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AAI,EAAE,CAAC;YACzB,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC1C,IAAsC,EACb,EAAE;IAC3B,MAAM,OAAO,GAAqB,EAAE,CAAC;IACrC,KAAK,MAAM,GAAG,IAAI,IAAI;QAAE,OAAO,CAAC,IAAI,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;AAC9D,CAAC,CAAC"}
|
package/dist/lib/email/action.js
CHANGED
|
@@ -6,9 +6,9 @@ const escapeHtml = (value) => value
|
|
|
6
6
|
.replaceAll("'", ''');
|
|
7
7
|
export const renderEmailAction = ({ href, label }) => {
|
|
8
8
|
const escapedHref = escapeHtml(href);
|
|
9
|
-
return `<div style="margin:20px 0 0">
|
|
10
|
-
<a href="${escapedHref}" style="display:inline-block;padding:12px 22px;background:#155eef;color:#ffffff;border-radius:8px;text-decoration:none;font-size:14px;font-weight:700">${escapeHtml(label)} →</a>
|
|
11
|
-
<p style="margin:8px 0 0;font-size:11px;line-height:1.45;color:#8a94a8;word-break:break-all">Or copy this link: <a href="${escapedHref}" style="color:#64748b;text-decoration:underline;word-break:break-all">${escapedHref}</a></p>
|
|
9
|
+
return `<div style="margin:20px 0 0">
|
|
10
|
+
<a href="${escapedHref}" style="display:inline-block;padding:12px 22px;background:#155eef;color:#ffffff;border-radius:8px;text-decoration:none;font-size:14px;font-weight:700">${escapeHtml(label)} →</a>
|
|
11
|
+
<p style="margin:8px 0 0;font-size:11px;line-height:1.45;color:#8a94a8;word-break:break-all">Or copy this link: <a href="${escapedHref}" style="color:#64748b;text-decoration:underline;word-break:break-all">${escapedHref}</a></p>
|
|
12
12
|
</div>`;
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=action.js.map
|