@apify/utilities 2.35.11 → 3.0.0-beta.1
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/code_hash_manager.d.ts +34 -0
- package/code_hash_manager.js +66 -0
- package/code_hash_manager.js.map +1 -0
- package/crypto.d.ts +35 -0
- package/crypto.js +58 -0
- package/crypto.js.map +1 -0
- package/exponential_backoff.d.ts +9 -0
- package/exponential_backoff.js +47 -0
- package/exponential_backoff.js.map +1 -0
- package/health_checker.d.ts +61 -0
- package/health_checker.js +132 -0
- package/health_checker.js.map +1 -0
- package/hmac.d.ts +20 -0
- package/hmac.js +59 -0
- package/hmac.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.js +15 -0
- package/index.js.map +1 -0
- package/package.json +16 -21
- package/parse_boolean.d.ts +10 -0
- package/parse_boolean.js +25 -0
- package/parse_boolean.js.map +1 -0
- package/parse_jsonl_stream.d.ts +25 -0
- package/parse_jsonl_stream.js +79 -0
- package/parse_jsonl_stream.js.map +1 -0
- package/storages.d.ts +29 -0
- package/storages.js +37 -0
- package/storages.js.map +1 -0
- package/streams_utilities.d.ts +10 -0
- package/streams_utilities.js +26 -0
- package/streams_utilities.js.map +1 -0
- package/url_params_utils.d.ts +7 -0
- package/url_params_utils.js +11 -0
- package/url_params_utils.js.map +1 -0
- package/usernames.d.ts +10 -0
- package/usernames.js +1137 -0
- package/usernames.js.map +1 -0
- package/utilities.client.d.ts +125 -0
- package/utilities.client.js +408 -0
- package/utilities.client.js.map +1 -0
- package/utilities.d.ts +111 -0
- package/utilities.js +263 -0
- package/utilities.js.map +1 -0
- package/webhook_payload_template.d.ts +114 -0
- package/webhook_payload_template.js +245 -0
- package/webhook_payload_template.js.map +1 -0
- package/cjs/index.cjs +0 -2402
- package/cjs/index.cjs.map +0 -1
- package/cjs/index.d.ts +0 -609
- package/esm/index.d.mts +0 -609
- package/esm/index.mjs +0 -2314
- package/esm/index.mjs.map +0 -1
package/cjs/index.cjs
DELETED
|
@@ -1,2402 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
-
mod
|
|
29
|
-
));
|
|
30
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
|
-
|
|
33
|
-
// src/index.ts
|
|
34
|
-
var index_exports = {};
|
|
35
|
-
__export(index_exports, {
|
|
36
|
-
CHECK_TYPES: () => CHECK_TYPES,
|
|
37
|
-
CodeHashManager: () => CodeHashManager,
|
|
38
|
-
CodeHashMetaKey: () => CodeHashMetaKey,
|
|
39
|
-
HealthChecker: () => HealthChecker,
|
|
40
|
-
InvalidJsonError: () => InvalidJsonError,
|
|
41
|
-
InvalidVariableError: () => InvalidVariableError,
|
|
42
|
-
JsonVariable: () => JsonVariable,
|
|
43
|
-
ParseJsonlStream: () => ParseJsonlStream,
|
|
44
|
-
RetryableError: () => RetryableError,
|
|
45
|
-
WebhookPayloadTemplate: () => WebhookPayloadTemplate,
|
|
46
|
-
betterClearInterval: () => betterClearInterval,
|
|
47
|
-
betterSetInterval: () => betterSetInterval,
|
|
48
|
-
buildOrVersionNumberIntToStr: () => buildOrVersionNumberIntToStr,
|
|
49
|
-
checkParamPrototypeOrThrow: () => checkParamPrototypeOrThrow,
|
|
50
|
-
concatStreamToBuffer: () => concatStreamToBuffer,
|
|
51
|
-
configureLogger: () => configureLogger,
|
|
52
|
-
createHmacSignature: () => createHmacSignature,
|
|
53
|
-
createHmacSignatureAsync: () => createHmacSignatureAsync,
|
|
54
|
-
createInjectableRegExp: () => createInjectableRegExp,
|
|
55
|
-
createStorageContentSignature: () => createStorageContentSignature,
|
|
56
|
-
createStorageContentSignatureAsync: () => createStorageContentSignatureAsync,
|
|
57
|
-
cryptoRandomObjectId: () => cryptoRandomObjectId,
|
|
58
|
-
dateToString: () => dateToString,
|
|
59
|
-
delayPromise: () => delayPromise,
|
|
60
|
-
deterministicUniqueId: () => deterministicUniqueId,
|
|
61
|
-
escapeForBson: () => escapeForBson,
|
|
62
|
-
escapePropertyName: () => escapePropertyName,
|
|
63
|
-
escapeRegExp: () => escapeRegExp,
|
|
64
|
-
expressErrorHandler: () => expressErrorHandler,
|
|
65
|
-
getOrdinalSuffix: () => getOrdinalSuffix,
|
|
66
|
-
getRandomInt: () => getRandomInt,
|
|
67
|
-
http404Route: () => http404Route,
|
|
68
|
-
isBadForMongo: () => isBadForMongo,
|
|
69
|
-
isBuffer: () => isBuffer,
|
|
70
|
-
isForbiddenUsername: () => isForbiddenUsername,
|
|
71
|
-
isNullOrUndefined: () => isNullOrUndefined,
|
|
72
|
-
isUrlRelative: () => isUrlRelative,
|
|
73
|
-
jsonStringifyExtended: () => jsonStringifyExtended,
|
|
74
|
-
leftpad: () => leftpad,
|
|
75
|
-
markedDecreaseHeadsLevel: () => markedDecreaseHeadsLevel,
|
|
76
|
-
markedSetNofollowLinks: () => markedSetNofollowLinks,
|
|
77
|
-
normalizeUrl: () => normalizeUrl,
|
|
78
|
-
parseBooleanOrNull: () => parseBooleanOrNull,
|
|
79
|
-
parseDateFromJson: () => parseDateFromJson,
|
|
80
|
-
parseUrl: () => parseUrl,
|
|
81
|
-
privateDecrypt: () => privateDecrypt,
|
|
82
|
-
promisifyServerListen: () => promisifyServerListen,
|
|
83
|
-
publicEncrypt: () => publicEncrypt,
|
|
84
|
-
readStreamToString: () => readStreamToString,
|
|
85
|
-
removeFromArray: () => removeFromArray,
|
|
86
|
-
retryWithExpBackoff: () => retryWithExpBackoff,
|
|
87
|
-
separateImports: () => separateImports,
|
|
88
|
-
sequentializePromises: () => sequentializePromises,
|
|
89
|
-
splitFullName: () => splitFullName,
|
|
90
|
-
timeoutPromise: () => timeoutPromise,
|
|
91
|
-
traverseObject: () => traverseObject,
|
|
92
|
-
truncate: () => truncate,
|
|
93
|
-
unescapeFromBson: () => unescapeFromBson,
|
|
94
|
-
unescapePropertyName: () => unescapePropertyName,
|
|
95
|
-
weightedAverage: () => weightedAverage
|
|
96
|
-
});
|
|
97
|
-
module.exports = __toCommonJS(index_exports);
|
|
98
|
-
|
|
99
|
-
// src/utilities.ts
|
|
100
|
-
var import_node_crypto = __toESM(require("crypto"));
|
|
101
|
-
var import_log = __toESM(require("@apify/log"));
|
|
102
|
-
function cryptoRandomObjectId(length = 17) {
|
|
103
|
-
const chars = "abcdefghijklmnopqrstuvwxyzABCEDFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
104
|
-
const bytes = import_node_crypto.default.randomBytes(length);
|
|
105
|
-
let str = "";
|
|
106
|
-
for (let i = bytes.length - 1; i >= 0; i--) {
|
|
107
|
-
str += chars[(bytes[i] | 0) % chars.length];
|
|
108
|
-
}
|
|
109
|
-
return str;
|
|
110
|
-
}
|
|
111
|
-
__name(cryptoRandomObjectId, "cryptoRandomObjectId");
|
|
112
|
-
function deterministicUniqueId(key, length = 17) {
|
|
113
|
-
return import_node_crypto.default.createHash("sha256").update(key).digest("base64").replace(/(\+|\/|=)/g, "x").substr(0, length);
|
|
114
|
-
}
|
|
115
|
-
__name(deterministicUniqueId, "deterministicUniqueId");
|
|
116
|
-
function getRandomInt(maxExcluded) {
|
|
117
|
-
maxExcluded = Math.floor(maxExcluded);
|
|
118
|
-
return Math.floor(Math.random() * maxExcluded);
|
|
119
|
-
}
|
|
120
|
-
__name(getRandomInt, "getRandomInt");
|
|
121
|
-
function parseDateFromJson(date) {
|
|
122
|
-
if (typeof date === "string") {
|
|
123
|
-
return new Date(Date.parse(date));
|
|
124
|
-
}
|
|
125
|
-
return date;
|
|
126
|
-
}
|
|
127
|
-
__name(parseDateFromJson, "parseDateFromJson");
|
|
128
|
-
async function delayPromise(millis) {
|
|
129
|
-
return new Promise((resolve) => {
|
|
130
|
-
if (millis > 0) {
|
|
131
|
-
setTimeout(() => resolve(), millis);
|
|
132
|
-
} else {
|
|
133
|
-
resolve();
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
__name(delayPromise, "delayPromise");
|
|
138
|
-
function removeFromArray(array, element) {
|
|
139
|
-
const index = array.indexOf(element);
|
|
140
|
-
if (index >= 0) {
|
|
141
|
-
array.splice(index, 1);
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
__name(removeFromArray, "removeFromArray");
|
|
147
|
-
function http404Route(req, res) {
|
|
148
|
-
res.status(404);
|
|
149
|
-
res.send("Page not found");
|
|
150
|
-
}
|
|
151
|
-
__name(http404Route, "http404Route");
|
|
152
|
-
function expressErrorHandler(err, req, res, next) {
|
|
153
|
-
import_log.default.warning("Client HTTP request failed", { url: req.url, errMsg: err.message });
|
|
154
|
-
if (res.headersSent) {
|
|
155
|
-
next(err);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
res.status(505);
|
|
159
|
-
res.send("Internal server error");
|
|
160
|
-
}
|
|
161
|
-
__name(expressErrorHandler, "expressErrorHandler");
|
|
162
|
-
function betterSetInterval(func, delay) {
|
|
163
|
-
let scheduleNextRun;
|
|
164
|
-
let timeoutId;
|
|
165
|
-
let isRunning = true;
|
|
166
|
-
const funcWrapper = /* @__PURE__ */ __name(function() {
|
|
167
|
-
void new Promise((resolve) => {
|
|
168
|
-
resolve(func(() => void 0));
|
|
169
|
-
}).finally(scheduleNextRun);
|
|
170
|
-
}, "funcWrapper");
|
|
171
|
-
scheduleNextRun = /* @__PURE__ */ __name(function() {
|
|
172
|
-
if (isRunning) timeoutId = setTimeout(funcWrapper, delay);
|
|
173
|
-
}, "scheduleNextRun");
|
|
174
|
-
funcWrapper();
|
|
175
|
-
return {
|
|
176
|
-
_betterClearInterval() {
|
|
177
|
-
isRunning = false;
|
|
178
|
-
clearTimeout(timeoutId);
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
__name(betterSetInterval, "betterSetInterval");
|
|
183
|
-
function betterClearInterval(intervalID) {
|
|
184
|
-
if (intervalID && intervalID._betterClearInterval) {
|
|
185
|
-
try {
|
|
186
|
-
intervalID._betterClearInterval();
|
|
187
|
-
} catch (e) {
|
|
188
|
-
import_log.default.exception(e, "_betterClearInterval() threw an exception!?");
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
__name(betterClearInterval, "betterClearInterval");
|
|
193
|
-
function escapeRegExp(str) {
|
|
194
|
-
return String(str).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
195
|
-
}
|
|
196
|
-
__name(escapeRegExp, "escapeRegExp");
|
|
197
|
-
function leftpad(str, len, ch = " ") {
|
|
198
|
-
str = String(str);
|
|
199
|
-
let i = -1;
|
|
200
|
-
if (!ch && ch !== 0) ch = " ";
|
|
201
|
-
len -= str.length;
|
|
202
|
-
while (++i < len) {
|
|
203
|
-
str = ch + str;
|
|
204
|
-
}
|
|
205
|
-
return str;
|
|
206
|
-
}
|
|
207
|
-
__name(leftpad, "leftpad");
|
|
208
|
-
function weightedAverage(val1, weight1, val2, weight2) {
|
|
209
|
-
return (val1 * weight1 + val2 * weight2) / (weight1 + weight2);
|
|
210
|
-
}
|
|
211
|
-
__name(weightedAverage, "weightedAverage");
|
|
212
|
-
async function sequentializePromises(promises) {
|
|
213
|
-
if (!promises.length) return [];
|
|
214
|
-
const results = [];
|
|
215
|
-
for (const promiseOrFunc of promises) {
|
|
216
|
-
const promise = promiseOrFunc instanceof Function ? promiseOrFunc() : promiseOrFunc;
|
|
217
|
-
results.push(await promise);
|
|
218
|
-
}
|
|
219
|
-
return results;
|
|
220
|
-
}
|
|
221
|
-
__name(sequentializePromises, "sequentializePromises");
|
|
222
|
-
function checkParamPrototypeOrThrow(paramVal, paramName, prototypes, prototypeName, isOptional = false) {
|
|
223
|
-
if (isOptional && (paramVal === void 0 || paramVal === null)) return;
|
|
224
|
-
const hasCorrectPrototype = prototypes instanceof Array ? prototypes.some((prototype) => paramVal instanceof prototype) : paramVal instanceof prototypes;
|
|
225
|
-
if (!hasCorrectPrototype) throw new Error(`Parameter "${paramName}" must be an instance of ${prototypeName}`);
|
|
226
|
-
}
|
|
227
|
-
__name(checkParamPrototypeOrThrow, "checkParamPrototypeOrThrow");
|
|
228
|
-
function promisifyServerListen(server) {
|
|
229
|
-
return async (port) => {
|
|
230
|
-
return new Promise((resolve, reject) => {
|
|
231
|
-
function removeListeners() {
|
|
232
|
-
server.removeListener("error", onError);
|
|
233
|
-
server.removeListener("listening", onListening);
|
|
234
|
-
}
|
|
235
|
-
__name(removeListeners, "removeListeners");
|
|
236
|
-
function onError(err) {
|
|
237
|
-
removeListeners();
|
|
238
|
-
reject(err);
|
|
239
|
-
}
|
|
240
|
-
__name(onError, "onError");
|
|
241
|
-
function onListening() {
|
|
242
|
-
removeListeners();
|
|
243
|
-
resolve();
|
|
244
|
-
}
|
|
245
|
-
__name(onListening, "onListening");
|
|
246
|
-
server.on("error", onError);
|
|
247
|
-
server.on("listening", onListening);
|
|
248
|
-
server.listen(port);
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
__name(promisifyServerListen, "promisifyServerListen");
|
|
253
|
-
function configureLogger(givenLog, isProduction) {
|
|
254
|
-
if (isProduction) {
|
|
255
|
-
givenLog.setOptions({
|
|
256
|
-
level: import_log.LogLevel.INFO,
|
|
257
|
-
logger: new import_log.LoggerJson()
|
|
258
|
-
});
|
|
259
|
-
} else {
|
|
260
|
-
givenLog.setOptions({ level: import_log.LogLevel.DEBUG });
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
__name(configureLogger, "configureLogger");
|
|
264
|
-
async function timeoutPromise(promise, timeoutMillis, errorMessage = "Promise has timed-out") {
|
|
265
|
-
return new Promise((resolve, reject) => {
|
|
266
|
-
let timeout;
|
|
267
|
-
let hasFulfilled = false;
|
|
268
|
-
const callback = /* @__PURE__ */ __name((err, result) => {
|
|
269
|
-
if (hasFulfilled) return;
|
|
270
|
-
clearTimeout(timeout);
|
|
271
|
-
hasFulfilled = true;
|
|
272
|
-
if (err) {
|
|
273
|
-
reject(err);
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
resolve(result);
|
|
277
|
-
}, "callback");
|
|
278
|
-
promise.then((result) => callback(null, result), callback);
|
|
279
|
-
timeout = setTimeout(() => callback(new Error(errorMessage)), timeoutMillis);
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
__name(timeoutPromise, "timeoutPromise");
|
|
283
|
-
function createInjectableRegExp(regex) {
|
|
284
|
-
return new RegExp(regex.source.replace(/^\^|\$$/g, ""));
|
|
285
|
-
}
|
|
286
|
-
__name(createInjectableRegExp, "createInjectableRegExp");
|
|
287
|
-
|
|
288
|
-
// src/utilities.client.ts
|
|
289
|
-
var import_consts = require("@apify/consts");
|
|
290
|
-
function isNullOrUndefined(obj) {
|
|
291
|
-
return obj == null;
|
|
292
|
-
}
|
|
293
|
-
__name(isNullOrUndefined, "isNullOrUndefined");
|
|
294
|
-
function isBuffer(obj) {
|
|
295
|
-
return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
296
|
-
}
|
|
297
|
-
__name(isBuffer, "isBuffer");
|
|
298
|
-
function dateToString(date, middleT) {
|
|
299
|
-
if (!(date instanceof Date)) {
|
|
300
|
-
return "";
|
|
301
|
-
}
|
|
302
|
-
const year = date.getFullYear();
|
|
303
|
-
const month = date.getMonth() + 1;
|
|
304
|
-
const day = date.getDate();
|
|
305
|
-
const hours = date.getHours();
|
|
306
|
-
const minutes = date.getMinutes();
|
|
307
|
-
const seconds = date.getSeconds();
|
|
308
|
-
const millis = date.getMilliseconds();
|
|
309
|
-
const pad = /* @__PURE__ */ __name((num) => num < 10 ? `0${num}` : num, "pad");
|
|
310
|
-
const datePart = `${year}-${pad(month)}-${pad(day)}`;
|
|
311
|
-
const millisPart = millis < 10 ? `00${millis}` : millis < 100 ? `0${millis}` : millis;
|
|
312
|
-
const timePart = `${pad(hours)}:${pad(minutes)}:${pad(seconds)}.${millisPart}`;
|
|
313
|
-
return `${datePart}${middleT ? "T" : " "}${timePart}`;
|
|
314
|
-
}
|
|
315
|
-
__name(dateToString, "dateToString");
|
|
316
|
-
function truncate(str, maxLength, suffix = "...[truncated]") {
|
|
317
|
-
maxLength = Math.floor(maxLength);
|
|
318
|
-
if (suffix.length > maxLength) {
|
|
319
|
-
throw new Error("suffix string cannot be longer than maxLength");
|
|
320
|
-
}
|
|
321
|
-
if (typeof str === "string" && str.length > maxLength) {
|
|
322
|
-
str = str.substr(0, maxLength - suffix.length) + suffix;
|
|
323
|
-
}
|
|
324
|
-
return str;
|
|
325
|
-
}
|
|
326
|
-
__name(truncate, "truncate");
|
|
327
|
-
function getOrdinalSuffix(num) {
|
|
328
|
-
const s = ["th", "st", "nd", "rd"];
|
|
329
|
-
const v = num % 100;
|
|
330
|
-
return s[(v - 20) % 10] || s[v] || s[0];
|
|
331
|
-
}
|
|
332
|
-
__name(getOrdinalSuffix, "getOrdinalSuffix");
|
|
333
|
-
function parseUrl(str) {
|
|
334
|
-
if (typeof str !== "string") return {};
|
|
335
|
-
const o = {
|
|
336
|
-
strictMode: false,
|
|
337
|
-
key: [
|
|
338
|
-
"source",
|
|
339
|
-
"protocol",
|
|
340
|
-
"authority",
|
|
341
|
-
"userInfo",
|
|
342
|
-
"user",
|
|
343
|
-
"password",
|
|
344
|
-
"host",
|
|
345
|
-
"port",
|
|
346
|
-
"relative",
|
|
347
|
-
"path",
|
|
348
|
-
"directory",
|
|
349
|
-
"file",
|
|
350
|
-
"query",
|
|
351
|
-
"fragment"
|
|
352
|
-
],
|
|
353
|
-
q: {
|
|
354
|
-
name: "queryKey",
|
|
355
|
-
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
|
|
356
|
-
},
|
|
357
|
-
parser: {
|
|
358
|
-
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
|
|
359
|
-
// eslint-disable-line max-len,no-useless-escape
|
|
360
|
-
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
|
|
361
|
-
// eslint-disable-line max-len,no-useless-escape
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
const m = o.parser[o.strictMode ? "strict" : "loose"].exec(str);
|
|
365
|
-
const uri = {};
|
|
366
|
-
let i = o.key.length;
|
|
367
|
-
while (i--) uri[o.key[i]] = m[i] || "";
|
|
368
|
-
uri[o.q.name] = {};
|
|
369
|
-
uri[o.key[12]].replace(o.q.parser, ($0, $1, $2) => {
|
|
370
|
-
if ($1) uri[o.q.name][$1] = $2;
|
|
371
|
-
});
|
|
372
|
-
uri.fragmentKey = {};
|
|
373
|
-
if (uri.fragment) {
|
|
374
|
-
uri.fragment.replace(o.q.parser, (($0, $1, $2) => {
|
|
375
|
-
if ($1) uri.fragmentKey[$1] = $2;
|
|
376
|
-
}));
|
|
377
|
-
}
|
|
378
|
-
return uri;
|
|
379
|
-
}
|
|
380
|
-
__name(parseUrl, "parseUrl");
|
|
381
|
-
function normalizeUrl(url, keepFragment) {
|
|
382
|
-
if (typeof url !== "string" || !url.length) {
|
|
383
|
-
return null;
|
|
384
|
-
}
|
|
385
|
-
let urlObj;
|
|
386
|
-
try {
|
|
387
|
-
urlObj = new URL(url.trim());
|
|
388
|
-
} catch {
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
const { searchParams } = urlObj;
|
|
392
|
-
for (const key of [...searchParams.keys()]) {
|
|
393
|
-
if (key.startsWith("utm_")) {
|
|
394
|
-
searchParams.delete(key);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
searchParams.sort();
|
|
398
|
-
const protocol = urlObj.protocol.toLowerCase();
|
|
399
|
-
const host = urlObj.host.toLowerCase();
|
|
400
|
-
const path = urlObj.pathname.replace(/\/$/, "");
|
|
401
|
-
const search = searchParams.toString() ? `?${searchParams}` : "";
|
|
402
|
-
const hash = keepFragment ? urlObj.hash : "";
|
|
403
|
-
return `${protocol}//${host}${path}${search}${hash}`;
|
|
404
|
-
}
|
|
405
|
-
__name(normalizeUrl, "normalizeUrl");
|
|
406
|
-
function markedSetNofollowLinks(href, title, text, referrerHostname) {
|
|
407
|
-
let urlParsed;
|
|
408
|
-
try {
|
|
409
|
-
urlParsed = new URL(href);
|
|
410
|
-
} catch {
|
|
411
|
-
}
|
|
412
|
-
const isApifyLink = urlParsed && /(\.|^)apify\.com$/i.test(urlParsed.hostname);
|
|
413
|
-
const isSameHostname = !referrerHostname || urlParsed && urlParsed.hostname === referrerHostname;
|
|
414
|
-
if (isApifyLink && isSameHostname) {
|
|
415
|
-
return `<a href="${href}">${title || text}</a>`;
|
|
416
|
-
}
|
|
417
|
-
if (isApifyLink) {
|
|
418
|
-
return `<a rel="noopener noreferrer" target="_blank" href="${href}">${title || text}</a>`;
|
|
419
|
-
}
|
|
420
|
-
return `<a rel="noopener noreferrer nofollow" target="_blank" href="${href}">${title || text}</a>`;
|
|
421
|
-
}
|
|
422
|
-
__name(markedSetNofollowLinks, "markedSetNofollowLinks");
|
|
423
|
-
function markedDecreaseHeadsLevel(text, level) {
|
|
424
|
-
level += 1;
|
|
425
|
-
return `<h${level}>${text}</h${level}>`;
|
|
426
|
-
}
|
|
427
|
-
__name(markedDecreaseHeadsLevel, "markedDecreaseHeadsLevel");
|
|
428
|
-
function buildOrVersionNumberIntToStr(int) {
|
|
429
|
-
if (typeof int !== "number" || !(int >= 0)) return null;
|
|
430
|
-
const major = Math.floor(int / import_consts.VERSION_INT_MAJOR_BASE);
|
|
431
|
-
const remainder = int % import_consts.VERSION_INT_MAJOR_BASE;
|
|
432
|
-
const minor = Math.floor(remainder / import_consts.VERSION_INT_MINOR_BASE);
|
|
433
|
-
const build = remainder % import_consts.VERSION_INT_MINOR_BASE;
|
|
434
|
-
let str = `${major}.${minor}`;
|
|
435
|
-
if (build > 0) str += `.${build}`;
|
|
436
|
-
return str;
|
|
437
|
-
}
|
|
438
|
-
__name(buildOrVersionNumberIntToStr, "buildOrVersionNumberIntToStr");
|
|
439
|
-
var ESCAPE_DOT = "\uFF0E";
|
|
440
|
-
var ESCAPE_DOLLAR = "\uFF04";
|
|
441
|
-
var ESCAPE_TO_BSON = "\uFF54\uFF4F\uFF22\uFF33\uFF2F\uFF2E";
|
|
442
|
-
var ESCAPE_TO_STRING = "\uFF54\uFF4F\uFF33\uFF54\uFF52\uFF49\uFF4E\uFF47";
|
|
443
|
-
var ESCAPE_BSON_TYPE = "\uFF3F\uFF42\uFF53\uFF4F\uFF4E\uFF54\uFF59\uFF50\uFF45";
|
|
444
|
-
var ESCAPE_NULL = "";
|
|
445
|
-
var REGEXP_IS_ESCAPED = new RegExp(
|
|
446
|
-
`(${ESCAPE_DOT}|^${ESCAPE_DOLLAR}|^${ESCAPE_TO_BSON}$|^${ESCAPE_BSON_TYPE}|^${ESCAPE_TO_STRING}$)`
|
|
447
|
-
);
|
|
448
|
-
var REGEXP_DOT = new RegExp(ESCAPE_DOT, "g");
|
|
449
|
-
var REGEXP_DOLLAR = new RegExp(`^${ESCAPE_DOLLAR}`);
|
|
450
|
-
var REGEXP_TO_BSON = new RegExp(`^${ESCAPE_TO_BSON}$`);
|
|
451
|
-
var REGEXP_TO_STRING = new RegExp(`^${ESCAPE_TO_STRING}$`);
|
|
452
|
-
var REGEXP_BSON_TYPE = new RegExp(`^${ESCAPE_BSON_TYPE}$`);
|
|
453
|
-
function escapePropertyName(name) {
|
|
454
|
-
if (/(\.|^\$|^toBSON$|^_bsontype$|^toString$|\0)/.test(name)) {
|
|
455
|
-
name = name.replace(/\./g, ESCAPE_DOT);
|
|
456
|
-
name = name.replace(/^\$/, ESCAPE_DOLLAR);
|
|
457
|
-
name = name.replace(/^toBSON$/, ESCAPE_TO_BSON);
|
|
458
|
-
name = name.replace(/^toString$/, ESCAPE_TO_STRING);
|
|
459
|
-
name = name.replace(/^_bsontype$/, ESCAPE_BSON_TYPE);
|
|
460
|
-
name = name.replace(/\0/g, ESCAPE_NULL);
|
|
461
|
-
}
|
|
462
|
-
return name;
|
|
463
|
-
}
|
|
464
|
-
__name(escapePropertyName, "escapePropertyName");
|
|
465
|
-
function unescapePropertyName(name) {
|
|
466
|
-
if (REGEXP_IS_ESCAPED.test(name)) {
|
|
467
|
-
name = name.replace(REGEXP_DOT, ".");
|
|
468
|
-
name = name.replace(REGEXP_DOLLAR, "$");
|
|
469
|
-
name = name.replace(REGEXP_TO_BSON, "toBSON");
|
|
470
|
-
name = name.replace(REGEXP_TO_STRING, "toString");
|
|
471
|
-
name = name.replace(REGEXP_BSON_TYPE, "_bsontype");
|
|
472
|
-
}
|
|
473
|
-
return name;
|
|
474
|
-
}
|
|
475
|
-
__name(unescapePropertyName, "unescapePropertyName");
|
|
476
|
-
function traverseObject(obj, clone, transformFunc) {
|
|
477
|
-
if (obj === null || typeof obj !== "object" || Object.prototype.toString.call(obj) === "[object Date]" || isBuffer(obj))
|
|
478
|
-
return obj;
|
|
479
|
-
let result;
|
|
480
|
-
if (Array.isArray(obj)) {
|
|
481
|
-
result = clone ? new Array(obj.length) : obj;
|
|
482
|
-
for (let i = 0; i < obj.length; i++) {
|
|
483
|
-
const val = traverseObject(obj[i], clone, transformFunc);
|
|
484
|
-
if (clone) result[i] = val;
|
|
485
|
-
}
|
|
486
|
-
return result;
|
|
487
|
-
}
|
|
488
|
-
result = clone ? {} : obj;
|
|
489
|
-
for (const key in obj) {
|
|
490
|
-
const val = traverseObject(obj[key], clone, transformFunc);
|
|
491
|
-
const [transformedKey, transformedVal] = transformFunc(key, val);
|
|
492
|
-
if (key === transformedKey) {
|
|
493
|
-
if (clone || val !== transformedVal) result[key] = transformedVal;
|
|
494
|
-
} else {
|
|
495
|
-
result[transformedKey] = transformedVal;
|
|
496
|
-
if (!clone) delete obj[key];
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
return result;
|
|
500
|
-
}
|
|
501
|
-
__name(traverseObject, "traverseObject");
|
|
502
|
-
function escapeForBson(obj, clone = false) {
|
|
503
|
-
return traverseObject(obj, clone, (key, value) => [escapePropertyName(key), value]);
|
|
504
|
-
}
|
|
505
|
-
__name(escapeForBson, "escapeForBson");
|
|
506
|
-
function unescapeFromBson(obj, clone = false) {
|
|
507
|
-
return traverseObject(obj, clone, (key, value) => [unescapePropertyName(key), value]);
|
|
508
|
-
}
|
|
509
|
-
__name(unescapeFromBson, "unescapeFromBson");
|
|
510
|
-
function isBadForMongo(obj) {
|
|
511
|
-
let isBad = false;
|
|
512
|
-
try {
|
|
513
|
-
traverseObject(obj, false, (key, value) => {
|
|
514
|
-
const escapedKey = escapePropertyName(key);
|
|
515
|
-
if (key !== escapedKey) {
|
|
516
|
-
isBad = true;
|
|
517
|
-
throw new Error();
|
|
518
|
-
}
|
|
519
|
-
return [key, value];
|
|
520
|
-
});
|
|
521
|
-
} catch (e) {
|
|
522
|
-
if (!isBad) throw e;
|
|
523
|
-
}
|
|
524
|
-
return isBad;
|
|
525
|
-
}
|
|
526
|
-
__name(isBadForMongo, "isBadForMongo");
|
|
527
|
-
var _JsonVariable = class _JsonVariable {
|
|
528
|
-
constructor(name) {
|
|
529
|
-
__publicField(this, "name", name);
|
|
530
|
-
}
|
|
531
|
-
getToken() {
|
|
532
|
-
return `{{${this.name}}}`;
|
|
533
|
-
}
|
|
534
|
-
};
|
|
535
|
-
__name(_JsonVariable, "JsonVariable");
|
|
536
|
-
var JsonVariable = _JsonVariable;
|
|
537
|
-
function jsonStringifyExtended(value, replacer, space = 0) {
|
|
538
|
-
if (replacer && !(replacer instanceof Function))
|
|
539
|
-
throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
|
|
540
|
-
const replacements = {};
|
|
541
|
-
const extendedReplacer = /* @__PURE__ */ __name((key, val) => {
|
|
542
|
-
val = replacer ? replacer(key, val) : val;
|
|
543
|
-
if (val instanceof Function) return val.toString();
|
|
544
|
-
if (val instanceof JsonVariable) {
|
|
545
|
-
const randomToken = `<<<REPLACEMENT_TOKEN::${Math.random()}>>>`;
|
|
546
|
-
replacements[randomToken] = val.getToken();
|
|
547
|
-
return randomToken;
|
|
548
|
-
}
|
|
549
|
-
return val;
|
|
550
|
-
}, "extendedReplacer");
|
|
551
|
-
let stringifiedValue = JSON.stringify(value, extendedReplacer, space);
|
|
552
|
-
Object.entries(replacements).forEach(([replacementToken, replacementValue]) => {
|
|
553
|
-
stringifiedValue = stringifiedValue.replace(`"${replacementToken}"`, replacementValue);
|
|
554
|
-
});
|
|
555
|
-
return stringifiedValue;
|
|
556
|
-
}
|
|
557
|
-
__name(jsonStringifyExtended, "jsonStringifyExtended");
|
|
558
|
-
function splitFullName(fullName) {
|
|
559
|
-
if (typeof fullName !== "string") return [null, null];
|
|
560
|
-
const names = (fullName || "").trim().split(" ");
|
|
561
|
-
const nonEmptyNames = names.filter((val) => val);
|
|
562
|
-
if (nonEmptyNames.length === 0) {
|
|
563
|
-
return [null, null];
|
|
564
|
-
}
|
|
565
|
-
if (nonEmptyNames.length === 1) {
|
|
566
|
-
return [null, nonEmptyNames[0]];
|
|
567
|
-
}
|
|
568
|
-
return [names[0], nonEmptyNames.slice(1).join(" ")];
|
|
569
|
-
}
|
|
570
|
-
__name(splitFullName, "splitFullName");
|
|
571
|
-
function isUrlRelative(url) {
|
|
572
|
-
return import_consts.RELATIVE_URL_REGEX.test(url);
|
|
573
|
-
}
|
|
574
|
-
__name(isUrlRelative, "isUrlRelative");
|
|
575
|
-
|
|
576
|
-
// src/usernames.ts
|
|
577
|
-
var import_consts2 = require("@apify/consts");
|
|
578
|
-
var FORBIDDEN_USERNAMES_REGEXPS = [
|
|
579
|
-
// App routes
|
|
580
|
-
"page-not-found",
|
|
581
|
-
"docs",
|
|
582
|
-
"terms-of-use",
|
|
583
|
-
"about",
|
|
584
|
-
"pricing",
|
|
585
|
-
"privacy-policy",
|
|
586
|
-
"customers",
|
|
587
|
-
"request-form",
|
|
588
|
-
"request-solution",
|
|
589
|
-
"release-notes",
|
|
590
|
-
"jobs",
|
|
591
|
-
"api-reference",
|
|
592
|
-
"video-tutorials",
|
|
593
|
-
"acts",
|
|
594
|
-
"key-value-stores",
|
|
595
|
-
"schedules",
|
|
596
|
-
"account",
|
|
597
|
-
"sign-up",
|
|
598
|
-
"sign-in-discourse",
|
|
599
|
-
"admin",
|
|
600
|
-
"documentation",
|
|
601
|
-
"change-password",
|
|
602
|
-
"enroll-account",
|
|
603
|
-
"forgot-password",
|
|
604
|
-
"reset-password",
|
|
605
|
-
"sign-in",
|
|
606
|
-
"verify-email",
|
|
607
|
-
"live-status",
|
|
608
|
-
"browser-info",
|
|
609
|
-
"webhooks",
|
|
610
|
-
"health-check",
|
|
611
|
-
"api",
|
|
612
|
-
"change-log",
|
|
613
|
-
"dashboard",
|
|
614
|
-
"community",
|
|
615
|
-
"crawlers",
|
|
616
|
-
"ext",
|
|
617
|
-
"schemas",
|
|
618
|
-
// Various strings
|
|
619
|
-
"admin",
|
|
620
|
-
"administration",
|
|
621
|
-
"crawler",
|
|
622
|
-
"act",
|
|
623
|
-
"library",
|
|
624
|
-
"lib",
|
|
625
|
-
"apifier",
|
|
626
|
-
"team",
|
|
627
|
-
"contact",
|
|
628
|
-
"doc",
|
|
629
|
-
"documentation",
|
|
630
|
-
"for-business",
|
|
631
|
-
"for-developers",
|
|
632
|
-
"developers",
|
|
633
|
-
"business",
|
|
634
|
-
"integrations",
|
|
635
|
-
"job",
|
|
636
|
-
"setting",
|
|
637
|
-
"settings",
|
|
638
|
-
"privacy",
|
|
639
|
-
"policy",
|
|
640
|
-
"assets",
|
|
641
|
-
"help",
|
|
642
|
-
"config",
|
|
643
|
-
"configuration",
|
|
644
|
-
"terms",
|
|
645
|
-
"hiring",
|
|
646
|
-
"hire",
|
|
647
|
-
"status",
|
|
648
|
-
"status-page",
|
|
649
|
-
"solutions",
|
|
650
|
-
"support",
|
|
651
|
-
"market",
|
|
652
|
-
"marketplace",
|
|
653
|
-
"download",
|
|
654
|
-
"downloads",
|
|
655
|
-
"username",
|
|
656
|
-
"users",
|
|
657
|
-
"user",
|
|
658
|
-
"login",
|
|
659
|
-
"logout",
|
|
660
|
-
"signin",
|
|
661
|
-
"sign",
|
|
662
|
-
"signup",
|
|
663
|
-
"sign-out",
|
|
664
|
-
"signout",
|
|
665
|
-
"plugins",
|
|
666
|
-
"plug-ins",
|
|
667
|
-
"reset",
|
|
668
|
-
"password",
|
|
669
|
-
"passwords",
|
|
670
|
-
"square",
|
|
671
|
-
"profile-photos",
|
|
672
|
-
"profiles",
|
|
673
|
-
"true",
|
|
674
|
-
"false",
|
|
675
|
-
"js",
|
|
676
|
-
"css",
|
|
677
|
-
"img",
|
|
678
|
-
"images",
|
|
679
|
-
"image",
|
|
680
|
-
"partials",
|
|
681
|
-
"fonts",
|
|
682
|
-
"font",
|
|
683
|
-
"dynamic_templates",
|
|
684
|
-
"app",
|
|
685
|
-
"schedules",
|
|
686
|
-
"community",
|
|
687
|
-
"storage",
|
|
688
|
-
"storages",
|
|
689
|
-
"account",
|
|
690
|
-
"node_modules",
|
|
691
|
-
"bower_components",
|
|
692
|
-
"video",
|
|
693
|
-
"knowledgebase",
|
|
694
|
-
"forum",
|
|
695
|
-
"customers",
|
|
696
|
-
"blog",
|
|
697
|
-
"health-check",
|
|
698
|
-
"health",
|
|
699
|
-
"anim",
|
|
700
|
-
"forum_topics.json",
|
|
701
|
-
"forum_categories.json",
|
|
702
|
-
"me",
|
|
703
|
-
"you",
|
|
704
|
-
"him",
|
|
705
|
-
"she",
|
|
706
|
-
"it",
|
|
707
|
-
"external",
|
|
708
|
-
"actor",
|
|
709
|
-
"crawler",
|
|
710
|
-
"scheduler",
|
|
711
|
-
"api",
|
|
712
|
-
"sdk",
|
|
713
|
-
"puppeteer",
|
|
714
|
-
"webdriver",
|
|
715
|
-
"selenium",
|
|
716
|
-
"(selenium.*webdriver)",
|
|
717
|
-
"undefined",
|
|
718
|
-
"page-analyzer",
|
|
719
|
-
"wp-login.php",
|
|
720
|
-
"welcome.action",
|
|
721
|
-
"echo",
|
|
722
|
-
"proxy",
|
|
723
|
-
"super-proxy",
|
|
724
|
-
"gdpr",
|
|
725
|
-
"case-studies",
|
|
726
|
-
"use-cases",
|
|
727
|
-
"how-to",
|
|
728
|
-
"kb",
|
|
729
|
-
"cookies",
|
|
730
|
-
"cookie-policy",
|
|
731
|
-
"cookies-policy",
|
|
732
|
-
"powered-by",
|
|
733
|
-
"run",
|
|
734
|
-
"runs",
|
|
735
|
-
"actor",
|
|
736
|
-
"actors",
|
|
737
|
-
"act",
|
|
738
|
-
"acts",
|
|
739
|
-
"success-stories",
|
|
740
|
-
"roadmap",
|
|
741
|
-
"join-marketplace",
|
|
742
|
-
"presskit",
|
|
743
|
-
"press-kit",
|
|
744
|
-
"covid-19",
|
|
745
|
-
"covid",
|
|
746
|
-
"covid19",
|
|
747
|
-
"matfyz",
|
|
748
|
-
"ideas",
|
|
749
|
-
"public-actors",
|
|
750
|
-
"resources",
|
|
751
|
-
"partners",
|
|
752
|
-
"affiliate",
|
|
753
|
-
"industries",
|
|
754
|
-
"web-scraping",
|
|
755
|
-
"custom-solutions",
|
|
756
|
-
"solution-provider",
|
|
757
|
-
"alternatives",
|
|
758
|
-
"platform",
|
|
759
|
-
"freelancers",
|
|
760
|
-
"freelancer",
|
|
761
|
-
"partner",
|
|
762
|
-
"preview",
|
|
763
|
-
"templates",
|
|
764
|
-
"data-for-generative-ai",
|
|
765
|
-
"discord",
|
|
766
|
-
"praguecrawl",
|
|
767
|
-
"prague-crawl",
|
|
768
|
-
"bob",
|
|
769
|
-
"ai-agents",
|
|
770
|
-
"reel",
|
|
771
|
-
"video-reel",
|
|
772
|
-
"mcp",
|
|
773
|
-
"mcpc",
|
|
774
|
-
"model-context-protocol",
|
|
775
|
-
"modelcontextprotocol",
|
|
776
|
-
// 'apify.com' intentionally unescaped so "." matches any character, also blocking variants like "apify_com" or "apifyxcom"
|
|
777
|
-
"apify.com",
|
|
778
|
-
"design-kit",
|
|
779
|
-
"press-kit",
|
|
780
|
-
"scrapers",
|
|
781
|
-
"professional-services",
|
|
782
|
-
"challenge",
|
|
783
|
-
"challange",
|
|
784
|
-
"1m-challenge",
|
|
785
|
-
"1m-usd-challenge",
|
|
786
|
-
"contact-sales",
|
|
787
|
-
"creator",
|
|
788
|
-
"creators",
|
|
789
|
-
"creator-plan",
|
|
790
|
-
"request-an-integration",
|
|
791
|
-
"whitepaper",
|
|
792
|
-
"adviser",
|
|
793
|
-
"crawlee",
|
|
794
|
-
"ultimate-scraper",
|
|
795
|
-
"agent-skills",
|
|
796
|
-
// Apify platform resources
|
|
797
|
-
"key-value-store",
|
|
798
|
-
"request-queue",
|
|
799
|
-
"request-queues",
|
|
800
|
-
"build",
|
|
801
|
-
"builds",
|
|
802
|
-
"dataset",
|
|
803
|
-
"datasets",
|
|
804
|
-
"schedule",
|
|
805
|
-
"standby",
|
|
806
|
-
"pay-per-event",
|
|
807
|
-
"pay-per-result",
|
|
808
|
-
"pay-per-usage",
|
|
809
|
-
"ppe",
|
|
810
|
-
"ppr",
|
|
811
|
-
"compute-unit",
|
|
812
|
-
"compute-units",
|
|
813
|
-
// AI / LLM related
|
|
814
|
-
"agent",
|
|
815
|
-
"agents",
|
|
816
|
-
"agentic",
|
|
817
|
-
"llms",
|
|
818
|
-
"llm",
|
|
819
|
-
"openai",
|
|
820
|
-
"anthropic",
|
|
821
|
-
"claude",
|
|
822
|
-
"copilot",
|
|
823
|
-
"mistral",
|
|
824
|
-
"gemini",
|
|
825
|
-
"llama",
|
|
826
|
-
"chatbot",
|
|
827
|
-
"chatgpt",
|
|
828
|
-
"prompt",
|
|
829
|
-
"prompts",
|
|
830
|
-
"embeddings",
|
|
831
|
-
"vectors",
|
|
832
|
-
"rag",
|
|
833
|
-
// Agentic protocols / agentic payments / agent identity
|
|
834
|
-
"agentic-commerce",
|
|
835
|
-
"agentic-economy",
|
|
836
|
-
"agentic-payments",
|
|
837
|
-
"a2a",
|
|
838
|
-
"a2b",
|
|
839
|
-
"a2p",
|
|
840
|
-
"ap2",
|
|
841
|
-
"b2a",
|
|
842
|
-
"acp",
|
|
843
|
-
"ucp",
|
|
844
|
-
"mpp",
|
|
845
|
-
"x402",
|
|
846
|
-
"l402",
|
|
847
|
-
"anp",
|
|
848
|
-
"agp",
|
|
849
|
-
"erc-8004",
|
|
850
|
-
"kya",
|
|
851
|
-
"kyapay",
|
|
852
|
-
// Trust / verification / anti-impersonation handles
|
|
853
|
-
// (entries containing 'apify' are already blocked by USERNAME.RESTRICTED_REGEX)
|
|
854
|
-
"official",
|
|
855
|
-
"verified",
|
|
856
|
-
"certified",
|
|
857
|
-
"authorized",
|
|
858
|
-
"partner-official",
|
|
859
|
-
"gold-partner",
|
|
860
|
-
"premium-partner",
|
|
861
|
-
"staff",
|
|
862
|
-
"moderator",
|
|
863
|
-
"apify-admin",
|
|
864
|
-
// Apify subdomain / service names (current and future)
|
|
865
|
-
"console",
|
|
866
|
-
"cli",
|
|
867
|
-
"studio",
|
|
868
|
-
"gateway",
|
|
869
|
-
"workbench",
|
|
870
|
-
"agents-marketplace",
|
|
871
|
-
"agents-store",
|
|
872
|
-
"mcp-server",
|
|
873
|
-
"mcp-servers",
|
|
874
|
-
"mcp-gateway",
|
|
875
|
-
// Region / locale codes (3+ chars only; 1-2 char codes are blocked by USERNAME.MIN_LENGTH)
|
|
876
|
-
"asia",
|
|
877
|
-
"latam",
|
|
878
|
-
"emea",
|
|
879
|
-
"apac",
|
|
880
|
-
"i18n",
|
|
881
|
-
"l10n",
|
|
882
|
-
"localization",
|
|
883
|
-
"localisation",
|
|
884
|
-
// Currency / payment generics (open standards, not company brands)
|
|
885
|
-
"usd",
|
|
886
|
-
"eur",
|
|
887
|
-
"gbp",
|
|
888
|
-
"jpy",
|
|
889
|
-
"cny",
|
|
890
|
-
"usdc",
|
|
891
|
-
"usdt",
|
|
892
|
-
"btc",
|
|
893
|
-
"eth",
|
|
894
|
-
"sol",
|
|
895
|
-
"crypto",
|
|
896
|
-
"fiat",
|
|
897
|
-
"stablecoin",
|
|
898
|
-
"stablecoins",
|
|
899
|
-
"payment",
|
|
900
|
-
"payments",
|
|
901
|
-
"payout",
|
|
902
|
-
"payouts",
|
|
903
|
-
"invoice",
|
|
904
|
-
"invoices",
|
|
905
|
-
"wallet",
|
|
906
|
-
// Compliance / certifications
|
|
907
|
-
"soc",
|
|
908
|
-
"soc2",
|
|
909
|
-
"iso",
|
|
910
|
-
"iso-27001",
|
|
911
|
-
"hipaa",
|
|
912
|
-
"ccpa",
|
|
913
|
-
"pci",
|
|
914
|
-
"pci-dss",
|
|
915
|
-
"dpa",
|
|
916
|
-
"dpia",
|
|
917
|
-
"dmca",
|
|
918
|
-
"sla",
|
|
919
|
-
"eula",
|
|
920
|
-
"aml",
|
|
921
|
-
"kyc",
|
|
922
|
-
// Open-source / community roles
|
|
923
|
-
"contributor",
|
|
924
|
-
"contributors",
|
|
925
|
-
"maintainer",
|
|
926
|
-
"maintainers",
|
|
927
|
-
"core-team",
|
|
928
|
-
"oss",
|
|
929
|
-
"open-source",
|
|
930
|
-
"opensource",
|
|
931
|
-
"open-source-software",
|
|
932
|
-
// Anti-abuse / scam-bait names (frequently used in account fraud)
|
|
933
|
-
"spam",
|
|
934
|
-
"scam",
|
|
935
|
-
"phishing",
|
|
936
|
-
"malware",
|
|
937
|
-
"hack",
|
|
938
|
-
"hacked",
|
|
939
|
-
"giveaway",
|
|
940
|
-
"airdrop",
|
|
941
|
-
"bitcoin-giveaway",
|
|
942
|
-
"free-credits",
|
|
943
|
-
"free-money",
|
|
944
|
-
// Apify marketing / campaign slugs
|
|
945
|
-
"launch",
|
|
946
|
-
"launches",
|
|
947
|
-
"webinar",
|
|
948
|
-
"webinars",
|
|
949
|
-
"meetup",
|
|
950
|
-
"meetups",
|
|
951
|
-
"summit",
|
|
952
|
-
"conference",
|
|
953
|
-
"conferences",
|
|
954
|
-
// Organizations / workspaces / permissions
|
|
955
|
-
"org",
|
|
956
|
-
"orgs",
|
|
957
|
-
"organisation",
|
|
958
|
-
"workspace",
|
|
959
|
-
"workspaces",
|
|
960
|
-
"tenant",
|
|
961
|
-
"tenants",
|
|
962
|
-
"role",
|
|
963
|
-
"roles",
|
|
964
|
-
"permission",
|
|
965
|
-
"permissions",
|
|
966
|
-
// Auth / security
|
|
967
|
-
"saml",
|
|
968
|
-
"scim",
|
|
969
|
-
"token",
|
|
970
|
-
"tokens",
|
|
971
|
-
"apikey",
|
|
972
|
-
"api-key",
|
|
973
|
-
"api-keys",
|
|
974
|
-
"keys",
|
|
975
|
-
"secret",
|
|
976
|
-
"secrets",
|
|
977
|
-
// Billing / commerce
|
|
978
|
-
"coupon",
|
|
979
|
-
"coupons",
|
|
980
|
-
"discount",
|
|
981
|
-
"discounts",
|
|
982
|
-
"promos",
|
|
983
|
-
"refund",
|
|
984
|
-
"refunds",
|
|
985
|
-
"credit",
|
|
986
|
-
"credits",
|
|
987
|
-
"billing-portal",
|
|
988
|
-
// Infrastructure / environments
|
|
989
|
-
"production",
|
|
990
|
-
"prod",
|
|
991
|
-
"canary",
|
|
992
|
-
"internal",
|
|
993
|
-
"restricted",
|
|
994
|
-
// Communication
|
|
995
|
-
"conversations",
|
|
996
|
-
"reactions",
|
|
997
|
-
"mentions",
|
|
998
|
-
"channel",
|
|
999
|
-
"channels",
|
|
1000
|
-
"inbox",
|
|
1001
|
-
"no-reply",
|
|
1002
|
-
"noreply",
|
|
1003
|
-
// Legal / trust / web standards
|
|
1004
|
-
"accessibility",
|
|
1005
|
-
"imprint",
|
|
1006
|
-
"impressum",
|
|
1007
|
-
"trust",
|
|
1008
|
-
"trust-center",
|
|
1009
|
-
"security-center",
|
|
1010
|
-
// Brand protection / impersonation prevention
|
|
1011
|
-
"brand",
|
|
1012
|
-
"branding",
|
|
1013
|
-
"support-team",
|
|
1014
|
-
"abuse",
|
|
1015
|
-
// Incidents / updates
|
|
1016
|
-
"outage",
|
|
1017
|
-
"incident",
|
|
1018
|
-
"incidents",
|
|
1019
|
-
"what-is-new",
|
|
1020
|
-
"whatsnew",
|
|
1021
|
-
// Special files
|
|
1022
|
-
"index",
|
|
1023
|
-
"index\\.html",
|
|
1024
|
-
"(favicon\\.[a-z]+)",
|
|
1025
|
-
"BingSiteAuth.xml",
|
|
1026
|
-
"(google.+\\.html)",
|
|
1027
|
-
"robots\\.txt",
|
|
1028
|
-
"(sitemap\\.[a-z]+)",
|
|
1029
|
-
"(apple-touch-icon.*)",
|
|
1030
|
-
"security-whitepaper\\.pdf",
|
|
1031
|
-
"security\\.txt",
|
|
1032
|
-
"llms\\.txt",
|
|
1033
|
-
"llms-full\\.txt",
|
|
1034
|
-
"AGENTS\\.md",
|
|
1035
|
-
"CLAUDE\\.md",
|
|
1036
|
-
"auth\\.md",
|
|
1037
|
-
// All hidden files
|
|
1038
|
-
"(\\..*)",
|
|
1039
|
-
// Username starting with xxx-
|
|
1040
|
-
"(xxx-.*)",
|
|
1041
|
-
// Usernames containing inappropriate/adult content keywords.
|
|
1042
|
-
// Each entry requires non-letter boundaries on both sides so the keyword only
|
|
1043
|
-
// matches as a whole word — this avoids false positives like Akshit (shit),
|
|
1044
|
-
// Hancock (cock), Nudelman (nude), Uranus (anus), pussycat (pussy),
|
|
1045
|
-
// snaked (naked), scunthorpe (cunt), christoph-dick-media (dick — legitimate
|
|
1046
|
-
// German surname, not blocked), etc.
|
|
1047
|
-
"((.+[^a-z]|)porn([^a-z].+|))",
|
|
1048
|
-
"((.+[^a-z]|)vagina([^a-z].+|))",
|
|
1049
|
-
"((.+[^a-z]|)dildo([^a-z].+|))",
|
|
1050
|
-
"((.+[^a-z]|)nsfw([^a-z].+|))",
|
|
1051
|
-
"((.+[^a-z]|)hentai([^a-z].+|))",
|
|
1052
|
-
"((.+[^a-z]|)cunt([^a-z].+|))",
|
|
1053
|
-
"((.+[^a-z]|)fuck([^a-z].+|))",
|
|
1054
|
-
"((.+[^a-z]|)shit([^a-z].+|))",
|
|
1055
|
-
"((.+[^a-z]|)bitch([^a-z].+|))",
|
|
1056
|
-
"((.+[^a-z]|)slut([^a-z].+|))",
|
|
1057
|
-
"((.+[^a-z]|)whore([^a-z].+|))",
|
|
1058
|
-
"((.+[^a-z]|)boob([^a-z].+|))",
|
|
1059
|
-
"((.+[^a-z]|)tits([^a-z].+|))",
|
|
1060
|
-
"((.+[^a-z]|)cock([^a-z].+|))",
|
|
1061
|
-
"((.+[^a-z]|)anus([^a-z].+|))",
|
|
1062
|
-
"((.+[^a-z]|)pussy([^a-z].+|))",
|
|
1063
|
-
"((.+[^a-z]|)nude([^a-z].+|))",
|
|
1064
|
-
"((.+[^a-z]|)penis([^a-z].+|))",
|
|
1065
|
-
"((.+[^a-z]|)naked([^a-z].+|))",
|
|
1066
|
-
// Username starting with install-cli. (see https://docs.apify.com/cli/docs/installation)
|
|
1067
|
-
"(install-cli\\..*)",
|
|
1068
|
-
// Strings not starting with letter or number
|
|
1069
|
-
"([^0-9a-z].*)",
|
|
1070
|
-
// Strings not ending with letter or number
|
|
1071
|
-
"(.*[^0-9a-z])",
|
|
1072
|
-
// Strings where there's more than one underscore, comma or dash in row
|
|
1073
|
-
"(.*[_.\\-]{2}.*)",
|
|
1074
|
-
// Reserved usernames from https://github.com/shouldbee/reserved-usernames/blob/master/reserved-usernames.json
|
|
1075
|
-
"0",
|
|
1076
|
-
"about",
|
|
1077
|
-
"access",
|
|
1078
|
-
"account",
|
|
1079
|
-
"accounts",
|
|
1080
|
-
"activate",
|
|
1081
|
-
"activities",
|
|
1082
|
-
"activity",
|
|
1083
|
-
"ad",
|
|
1084
|
-
"add",
|
|
1085
|
-
"address",
|
|
1086
|
-
"adm",
|
|
1087
|
-
"admin",
|
|
1088
|
-
"administration",
|
|
1089
|
-
"administrator",
|
|
1090
|
-
"ads",
|
|
1091
|
-
"adult",
|
|
1092
|
-
"advertising",
|
|
1093
|
-
"affiliate",
|
|
1094
|
-
"affiliates",
|
|
1095
|
-
"ajax",
|
|
1096
|
-
"all",
|
|
1097
|
-
"alpha",
|
|
1098
|
-
"analysis",
|
|
1099
|
-
"analytics",
|
|
1100
|
-
"android",
|
|
1101
|
-
"anon",
|
|
1102
|
-
"anonymous",
|
|
1103
|
-
"api",
|
|
1104
|
-
"app",
|
|
1105
|
-
"apps",
|
|
1106
|
-
"archive",
|
|
1107
|
-
"archives",
|
|
1108
|
-
"article",
|
|
1109
|
-
"asct",
|
|
1110
|
-
"asset",
|
|
1111
|
-
"atom",
|
|
1112
|
-
"auth",
|
|
1113
|
-
"authentication",
|
|
1114
|
-
"avatar",
|
|
1115
|
-
"backup",
|
|
1116
|
-
"balancer-manager",
|
|
1117
|
-
"banner",
|
|
1118
|
-
"banners",
|
|
1119
|
-
"beta",
|
|
1120
|
-
"billing",
|
|
1121
|
-
"bin",
|
|
1122
|
-
"blog",
|
|
1123
|
-
"blogs",
|
|
1124
|
-
"board",
|
|
1125
|
-
"book",
|
|
1126
|
-
"bookmark",
|
|
1127
|
-
"bot",
|
|
1128
|
-
"bots",
|
|
1129
|
-
"bug",
|
|
1130
|
-
"business",
|
|
1131
|
-
"cache",
|
|
1132
|
-
"cadastro",
|
|
1133
|
-
"calendar",
|
|
1134
|
-
"call",
|
|
1135
|
-
"campaign",
|
|
1136
|
-
"cancel",
|
|
1137
|
-
"captcha",
|
|
1138
|
-
"career",
|
|
1139
|
-
"careers",
|
|
1140
|
-
"cart",
|
|
1141
|
-
"categories",
|
|
1142
|
-
"category",
|
|
1143
|
-
"cgi",
|
|
1144
|
-
"cgi-bin",
|
|
1145
|
-
"changelog",
|
|
1146
|
-
"chat",
|
|
1147
|
-
"check",
|
|
1148
|
-
"checking",
|
|
1149
|
-
"checkout",
|
|
1150
|
-
"client",
|
|
1151
|
-
"cliente",
|
|
1152
|
-
"clients",
|
|
1153
|
-
"code",
|
|
1154
|
-
"codereview",
|
|
1155
|
-
"comercial",
|
|
1156
|
-
"comment",
|
|
1157
|
-
"comments",
|
|
1158
|
-
"communities",
|
|
1159
|
-
"community",
|
|
1160
|
-
"company",
|
|
1161
|
-
"compare",
|
|
1162
|
-
"compras",
|
|
1163
|
-
"config",
|
|
1164
|
-
"configuration",
|
|
1165
|
-
"connect",
|
|
1166
|
-
"contact",
|
|
1167
|
-
"contact-us",
|
|
1168
|
-
"contact_us",
|
|
1169
|
-
"contactus",
|
|
1170
|
-
"contest",
|
|
1171
|
-
"contribute",
|
|
1172
|
-
"corp",
|
|
1173
|
-
"create",
|
|
1174
|
-
"css",
|
|
1175
|
-
"dashboard",
|
|
1176
|
-
"data",
|
|
1177
|
-
"db",
|
|
1178
|
-
"default",
|
|
1179
|
-
"delete",
|
|
1180
|
-
"demo",
|
|
1181
|
-
"design",
|
|
1182
|
-
"designer",
|
|
1183
|
-
"destroy",
|
|
1184
|
-
"dev",
|
|
1185
|
-
"devel",
|
|
1186
|
-
"developer",
|
|
1187
|
-
"developers",
|
|
1188
|
-
"diagram",
|
|
1189
|
-
"diary",
|
|
1190
|
-
"dict",
|
|
1191
|
-
"dictionary",
|
|
1192
|
-
"die",
|
|
1193
|
-
"dir",
|
|
1194
|
-
"direct_messages",
|
|
1195
|
-
"directory",
|
|
1196
|
-
"dist",
|
|
1197
|
-
"doc",
|
|
1198
|
-
"docs",
|
|
1199
|
-
"documentation",
|
|
1200
|
-
"domain",
|
|
1201
|
-
"download",
|
|
1202
|
-
"downloads",
|
|
1203
|
-
"ecommerce",
|
|
1204
|
-
"edit",
|
|
1205
|
-
"editor",
|
|
1206
|
-
"edu",
|
|
1207
|
-
"education",
|
|
1208
|
-
"email",
|
|
1209
|
-
"employment",
|
|
1210
|
-
"empty",
|
|
1211
|
-
"end",
|
|
1212
|
-
"enterprise",
|
|
1213
|
-
"entries",
|
|
1214
|
-
"entry",
|
|
1215
|
-
"error",
|
|
1216
|
-
"errors",
|
|
1217
|
-
"eval",
|
|
1218
|
-
"event",
|
|
1219
|
-
"events",
|
|
1220
|
-
"exit",
|
|
1221
|
-
"explore",
|
|
1222
|
-
"facebook",
|
|
1223
|
-
"faq",
|
|
1224
|
-
"favorite",
|
|
1225
|
-
"favorites",
|
|
1226
|
-
"feature",
|
|
1227
|
-
"features",
|
|
1228
|
-
"feed",
|
|
1229
|
-
"feedback",
|
|
1230
|
-
"feeds",
|
|
1231
|
-
"file",
|
|
1232
|
-
"files",
|
|
1233
|
-
"first",
|
|
1234
|
-
"flash",
|
|
1235
|
-
"fleet",
|
|
1236
|
-
"fleets",
|
|
1237
|
-
"flog",
|
|
1238
|
-
"follow",
|
|
1239
|
-
"followers",
|
|
1240
|
-
"following",
|
|
1241
|
-
"forgot",
|
|
1242
|
-
"form",
|
|
1243
|
-
"forum",
|
|
1244
|
-
"forums",
|
|
1245
|
-
"founder",
|
|
1246
|
-
"free",
|
|
1247
|
-
"friend",
|
|
1248
|
-
"friends",
|
|
1249
|
-
"ftp",
|
|
1250
|
-
"gadget",
|
|
1251
|
-
"gadgets",
|
|
1252
|
-
"game",
|
|
1253
|
-
"games",
|
|
1254
|
-
"get",
|
|
1255
|
-
"gift",
|
|
1256
|
-
"gifts",
|
|
1257
|
-
"gist",
|
|
1258
|
-
"github",
|
|
1259
|
-
"graph",
|
|
1260
|
-
"group",
|
|
1261
|
-
"groups",
|
|
1262
|
-
"guest",
|
|
1263
|
-
"guests",
|
|
1264
|
-
"help",
|
|
1265
|
-
"home",
|
|
1266
|
-
"homepage",
|
|
1267
|
-
"host",
|
|
1268
|
-
"hosting",
|
|
1269
|
-
"hostmaster",
|
|
1270
|
-
"hostname",
|
|
1271
|
-
"howto",
|
|
1272
|
-
"hpg",
|
|
1273
|
-
"html",
|
|
1274
|
-
"http",
|
|
1275
|
-
"httpd",
|
|
1276
|
-
"https",
|
|
1277
|
-
"i",
|
|
1278
|
-
"iamges",
|
|
1279
|
-
"icon",
|
|
1280
|
-
"icons",
|
|
1281
|
-
"id",
|
|
1282
|
-
"idea",
|
|
1283
|
-
"ideas",
|
|
1284
|
-
"image",
|
|
1285
|
-
"images",
|
|
1286
|
-
"imap",
|
|
1287
|
-
"img",
|
|
1288
|
-
"index",
|
|
1289
|
-
"indice",
|
|
1290
|
-
"info",
|
|
1291
|
-
"information",
|
|
1292
|
-
"inquiry",
|
|
1293
|
-
"instagram",
|
|
1294
|
-
"intranet",
|
|
1295
|
-
"invitations",
|
|
1296
|
-
"invite",
|
|
1297
|
-
"ipad",
|
|
1298
|
-
"iphone",
|
|
1299
|
-
"irc",
|
|
1300
|
-
"is",
|
|
1301
|
-
"issue",
|
|
1302
|
-
"issues",
|
|
1303
|
-
"it",
|
|
1304
|
-
"item",
|
|
1305
|
-
"items",
|
|
1306
|
-
"java",
|
|
1307
|
-
"javascript",
|
|
1308
|
-
"job",
|
|
1309
|
-
"jobs",
|
|
1310
|
-
"join",
|
|
1311
|
-
"js",
|
|
1312
|
-
"json",
|
|
1313
|
-
"jump",
|
|
1314
|
-
"knowledgebase",
|
|
1315
|
-
"language",
|
|
1316
|
-
"languages",
|
|
1317
|
-
"last",
|
|
1318
|
-
"ldap-status",
|
|
1319
|
-
"legal",
|
|
1320
|
-
"license",
|
|
1321
|
-
"link",
|
|
1322
|
-
"links",
|
|
1323
|
-
"linux",
|
|
1324
|
-
"list",
|
|
1325
|
-
"lists",
|
|
1326
|
-
"log",
|
|
1327
|
-
"log-in",
|
|
1328
|
-
"log-out",
|
|
1329
|
-
"log_in",
|
|
1330
|
-
"log_out",
|
|
1331
|
-
"login",
|
|
1332
|
-
"logout",
|
|
1333
|
-
"logs",
|
|
1334
|
-
"m",
|
|
1335
|
-
"mac",
|
|
1336
|
-
"mail",
|
|
1337
|
-
"mail1",
|
|
1338
|
-
"mail2",
|
|
1339
|
-
"mail3",
|
|
1340
|
-
"mail4",
|
|
1341
|
-
"mail5",
|
|
1342
|
-
"mailer",
|
|
1343
|
-
"mailing",
|
|
1344
|
-
"maintenance",
|
|
1345
|
-
"manager",
|
|
1346
|
-
"manual",
|
|
1347
|
-
"map",
|
|
1348
|
-
"maps",
|
|
1349
|
-
"marketing",
|
|
1350
|
-
"master",
|
|
1351
|
-
"me",
|
|
1352
|
-
"media",
|
|
1353
|
-
"member",
|
|
1354
|
-
"members",
|
|
1355
|
-
"message",
|
|
1356
|
-
"messages",
|
|
1357
|
-
"messenger",
|
|
1358
|
-
"microblog",
|
|
1359
|
-
"microblogs",
|
|
1360
|
-
"mine",
|
|
1361
|
-
"mis",
|
|
1362
|
-
"mob",
|
|
1363
|
-
"mobile",
|
|
1364
|
-
"movie",
|
|
1365
|
-
"movies",
|
|
1366
|
-
"mp3",
|
|
1367
|
-
"msg",
|
|
1368
|
-
"msn",
|
|
1369
|
-
"music",
|
|
1370
|
-
"musicas",
|
|
1371
|
-
"mx",
|
|
1372
|
-
"my",
|
|
1373
|
-
"mysql",
|
|
1374
|
-
"name",
|
|
1375
|
-
"named",
|
|
1376
|
-
"nan",
|
|
1377
|
-
"navi",
|
|
1378
|
-
"navigation",
|
|
1379
|
-
"net",
|
|
1380
|
-
"network",
|
|
1381
|
-
"new",
|
|
1382
|
-
"news",
|
|
1383
|
-
"newsletter",
|
|
1384
|
-
"nick",
|
|
1385
|
-
"nickname",
|
|
1386
|
-
"notes",
|
|
1387
|
-
"noticias",
|
|
1388
|
-
"notification",
|
|
1389
|
-
"notifications",
|
|
1390
|
-
"notify",
|
|
1391
|
-
"ns",
|
|
1392
|
-
"ns1",
|
|
1393
|
-
"ns10",
|
|
1394
|
-
"ns2",
|
|
1395
|
-
"ns3",
|
|
1396
|
-
"ns4",
|
|
1397
|
-
"ns5",
|
|
1398
|
-
"ns6",
|
|
1399
|
-
"ns7",
|
|
1400
|
-
"ns8",
|
|
1401
|
-
"ns9",
|
|
1402
|
-
"null",
|
|
1403
|
-
"oauth",
|
|
1404
|
-
"oauth_clients",
|
|
1405
|
-
"offer",
|
|
1406
|
-
"offers",
|
|
1407
|
-
"official",
|
|
1408
|
-
"old",
|
|
1409
|
-
"online",
|
|
1410
|
-
"openid",
|
|
1411
|
-
"operator",
|
|
1412
|
-
"order",
|
|
1413
|
-
"orders",
|
|
1414
|
-
"organization",
|
|
1415
|
-
"organizations",
|
|
1416
|
-
"overview",
|
|
1417
|
-
"owner",
|
|
1418
|
-
"owners",
|
|
1419
|
-
"page",
|
|
1420
|
-
"pager",
|
|
1421
|
-
"pages",
|
|
1422
|
-
"panel",
|
|
1423
|
-
"password",
|
|
1424
|
-
"payment",
|
|
1425
|
-
"perl",
|
|
1426
|
-
"phone",
|
|
1427
|
-
"photo",
|
|
1428
|
-
"photoalbum",
|
|
1429
|
-
"photos",
|
|
1430
|
-
"php",
|
|
1431
|
-
"phpmyadmin",
|
|
1432
|
-
"phppgadmin",
|
|
1433
|
-
"phpredisadmin",
|
|
1434
|
-
"pic",
|
|
1435
|
-
"pics",
|
|
1436
|
-
"ping",
|
|
1437
|
-
"plan",
|
|
1438
|
-
"plans",
|
|
1439
|
-
"plugin",
|
|
1440
|
-
"plugins",
|
|
1441
|
-
"policy",
|
|
1442
|
-
"pop",
|
|
1443
|
-
"pop3",
|
|
1444
|
-
"popular",
|
|
1445
|
-
"portal",
|
|
1446
|
-
"post",
|
|
1447
|
-
"postfix",
|
|
1448
|
-
"postmaster",
|
|
1449
|
-
"posts",
|
|
1450
|
-
"pr",
|
|
1451
|
-
"premium",
|
|
1452
|
-
"press",
|
|
1453
|
-
"price",
|
|
1454
|
-
"pricing",
|
|
1455
|
-
"privacy",
|
|
1456
|
-
"privacy-policy",
|
|
1457
|
-
"privacy_policy",
|
|
1458
|
-
"privacypolicy",
|
|
1459
|
-
"private",
|
|
1460
|
-
"product",
|
|
1461
|
-
"products",
|
|
1462
|
-
"profile",
|
|
1463
|
-
"project",
|
|
1464
|
-
"projects",
|
|
1465
|
-
"promo",
|
|
1466
|
-
"pub",
|
|
1467
|
-
"public",
|
|
1468
|
-
"purpose",
|
|
1469
|
-
"put",
|
|
1470
|
-
"python",
|
|
1471
|
-
"query",
|
|
1472
|
-
"random",
|
|
1473
|
-
"ranking",
|
|
1474
|
-
"read",
|
|
1475
|
-
"readme",
|
|
1476
|
-
"recent",
|
|
1477
|
-
"recruit",
|
|
1478
|
-
"recruitment",
|
|
1479
|
-
"register",
|
|
1480
|
-
"registration",
|
|
1481
|
-
"release",
|
|
1482
|
-
"remove",
|
|
1483
|
-
"replies",
|
|
1484
|
-
"report",
|
|
1485
|
-
"reports",
|
|
1486
|
-
"repositories",
|
|
1487
|
-
"repository",
|
|
1488
|
-
"req",
|
|
1489
|
-
"request",
|
|
1490
|
-
"requests",
|
|
1491
|
-
"reset",
|
|
1492
|
-
"roc",
|
|
1493
|
-
"root",
|
|
1494
|
-
"rss",
|
|
1495
|
-
"ruby",
|
|
1496
|
-
"rule",
|
|
1497
|
-
"sag",
|
|
1498
|
-
"sale",
|
|
1499
|
-
"sales",
|
|
1500
|
-
"sample",
|
|
1501
|
-
"samples",
|
|
1502
|
-
"save",
|
|
1503
|
-
"school",
|
|
1504
|
-
"script",
|
|
1505
|
-
"scripts",
|
|
1506
|
-
"search",
|
|
1507
|
-
"secure",
|
|
1508
|
-
"security",
|
|
1509
|
-
"self",
|
|
1510
|
-
"send",
|
|
1511
|
-
"server",
|
|
1512
|
-
"server-info",
|
|
1513
|
-
"server-status",
|
|
1514
|
-
"service",
|
|
1515
|
-
"services",
|
|
1516
|
-
"session",
|
|
1517
|
-
"sessions",
|
|
1518
|
-
"setting",
|
|
1519
|
-
"settings",
|
|
1520
|
-
"setup",
|
|
1521
|
-
"share",
|
|
1522
|
-
"shop",
|
|
1523
|
-
"show",
|
|
1524
|
-
"sign-in",
|
|
1525
|
-
"sign-up",
|
|
1526
|
-
"sign_in",
|
|
1527
|
-
"sign_up",
|
|
1528
|
-
"signin",
|
|
1529
|
-
"signout",
|
|
1530
|
-
"signup",
|
|
1531
|
-
"site",
|
|
1532
|
-
"sitemap",
|
|
1533
|
-
"sites",
|
|
1534
|
-
"smartphone",
|
|
1535
|
-
"smtp",
|
|
1536
|
-
"soporte",
|
|
1537
|
-
"source",
|
|
1538
|
-
"spec",
|
|
1539
|
-
"special",
|
|
1540
|
-
"sql",
|
|
1541
|
-
"src",
|
|
1542
|
-
"ssh",
|
|
1543
|
-
"ssl",
|
|
1544
|
-
"ssladmin",
|
|
1545
|
-
"ssladministrator",
|
|
1546
|
-
"sslwebmaster",
|
|
1547
|
-
"staff",
|
|
1548
|
-
"stage",
|
|
1549
|
-
"staging",
|
|
1550
|
-
"start",
|
|
1551
|
-
"stat",
|
|
1552
|
-
"state",
|
|
1553
|
-
"static",
|
|
1554
|
-
"stats",
|
|
1555
|
-
"status",
|
|
1556
|
-
"store",
|
|
1557
|
-
"stores",
|
|
1558
|
-
"stories",
|
|
1559
|
-
"style",
|
|
1560
|
-
"styleguide",
|
|
1561
|
-
"stylesheet",
|
|
1562
|
-
"stylesheets",
|
|
1563
|
-
"subdomain",
|
|
1564
|
-
"subscribe",
|
|
1565
|
-
"subscription",
|
|
1566
|
-
"subscriptions",
|
|
1567
|
-
"suporte",
|
|
1568
|
-
"support",
|
|
1569
|
-
"svn",
|
|
1570
|
-
"swf",
|
|
1571
|
-
"sys",
|
|
1572
|
-
"sysadmin",
|
|
1573
|
-
"sysadministrator",
|
|
1574
|
-
"system",
|
|
1575
|
-
"tablet",
|
|
1576
|
-
"tablets",
|
|
1577
|
-
"tag",
|
|
1578
|
-
"talk",
|
|
1579
|
-
"task",
|
|
1580
|
-
"tasks",
|
|
1581
|
-
"team",
|
|
1582
|
-
"teams",
|
|
1583
|
-
"tech",
|
|
1584
|
-
"telnet",
|
|
1585
|
-
"term",
|
|
1586
|
-
"terms",
|
|
1587
|
-
"terms-of-service",
|
|
1588
|
-
"terms_of_service",
|
|
1589
|
-
"termsofservice",
|
|
1590
|
-
"test",
|
|
1591
|
-
"test1",
|
|
1592
|
-
"test2",
|
|
1593
|
-
"test3",
|
|
1594
|
-
"teste",
|
|
1595
|
-
"testing",
|
|
1596
|
-
"tests",
|
|
1597
|
-
"theme",
|
|
1598
|
-
"themes",
|
|
1599
|
-
"thread",
|
|
1600
|
-
"threads",
|
|
1601
|
-
"tmp",
|
|
1602
|
-
"todo",
|
|
1603
|
-
"tool",
|
|
1604
|
-
"tools",
|
|
1605
|
-
"top",
|
|
1606
|
-
"topic",
|
|
1607
|
-
"topics",
|
|
1608
|
-
"tos",
|
|
1609
|
-
"tour",
|
|
1610
|
-
"translations",
|
|
1611
|
-
"trends",
|
|
1612
|
-
"tutorial",
|
|
1613
|
-
"tux",
|
|
1614
|
-
"tv",
|
|
1615
|
-
"twitter",
|
|
1616
|
-
"undef",
|
|
1617
|
-
"unfollow",
|
|
1618
|
-
"unsubscribe",
|
|
1619
|
-
"update",
|
|
1620
|
-
"upload",
|
|
1621
|
-
"uploads",
|
|
1622
|
-
"url",
|
|
1623
|
-
"usage",
|
|
1624
|
-
"user",
|
|
1625
|
-
"username",
|
|
1626
|
-
"users",
|
|
1627
|
-
"usuario",
|
|
1628
|
-
"vendas",
|
|
1629
|
-
"ver",
|
|
1630
|
-
"version",
|
|
1631
|
-
"video",
|
|
1632
|
-
"videos",
|
|
1633
|
-
"visitor",
|
|
1634
|
-
"watch",
|
|
1635
|
-
"weather",
|
|
1636
|
-
"web",
|
|
1637
|
-
"webhook",
|
|
1638
|
-
"webhooks",
|
|
1639
|
-
"webmail",
|
|
1640
|
-
"webmaster",
|
|
1641
|
-
"website",
|
|
1642
|
-
"websites",
|
|
1643
|
-
"welcome",
|
|
1644
|
-
"widget",
|
|
1645
|
-
"widgets",
|
|
1646
|
-
"wiki",
|
|
1647
|
-
"win",
|
|
1648
|
-
"windows",
|
|
1649
|
-
"word",
|
|
1650
|
-
"work",
|
|
1651
|
-
"works",
|
|
1652
|
-
"workshop",
|
|
1653
|
-
"ww",
|
|
1654
|
-
"wws",
|
|
1655
|
-
"www",
|
|
1656
|
-
"www1",
|
|
1657
|
-
"www2",
|
|
1658
|
-
"www3",
|
|
1659
|
-
"www4",
|
|
1660
|
-
"www5",
|
|
1661
|
-
"www6",
|
|
1662
|
-
"www7",
|
|
1663
|
-
"wwws",
|
|
1664
|
-
"wwww",
|
|
1665
|
-
"xfn",
|
|
1666
|
-
"xml",
|
|
1667
|
-
"xmpp",
|
|
1668
|
-
"xpg",
|
|
1669
|
-
"xxx",
|
|
1670
|
-
"yaml",
|
|
1671
|
-
"year",
|
|
1672
|
-
"yml",
|
|
1673
|
-
"you",
|
|
1674
|
-
"yourdomain",
|
|
1675
|
-
"yourname",
|
|
1676
|
-
"yoursite",
|
|
1677
|
-
"yourusername"
|
|
1678
|
-
];
|
|
1679
|
-
var FORBIDDEN_REGEXP = new RegExp(`^(${import_consts2.ANONYMOUS_USERNAME}|${FORBIDDEN_USERNAMES_REGEXPS.join("|")})$`, "i");
|
|
1680
|
-
function isForbiddenUsername(username) {
|
|
1681
|
-
return !!username.match(import_consts2.APIFY_ID_REGEX) || !!username.match(FORBIDDEN_REGEXP);
|
|
1682
|
-
}
|
|
1683
|
-
__name(isForbiddenUsername, "isForbiddenUsername");
|
|
1684
|
-
|
|
1685
|
-
// src/exponential_backoff.ts
|
|
1686
|
-
var import_log2 = __toESM(require("@apify/log"));
|
|
1687
|
-
var _RetryableError = class _RetryableError extends Error {
|
|
1688
|
-
constructor(error, ...args) {
|
|
1689
|
-
super(...args);
|
|
1690
|
-
__publicField(this, "error");
|
|
1691
|
-
this.error = error;
|
|
1692
|
-
}
|
|
1693
|
-
};
|
|
1694
|
-
__name(_RetryableError, "RetryableError");
|
|
1695
|
-
var RetryableError = _RetryableError;
|
|
1696
|
-
async function retryWithExpBackoff(params) {
|
|
1697
|
-
const { func, expBackoffMillis, expBackoffMaxRepeats } = params;
|
|
1698
|
-
if (typeof func !== "function") {
|
|
1699
|
-
throw new Error('Parameter "func" should be a function.');
|
|
1700
|
-
}
|
|
1701
|
-
if (typeof expBackoffMillis !== "number") {
|
|
1702
|
-
throw new Error('Parameter "expBackoffMillis" should be a number.');
|
|
1703
|
-
}
|
|
1704
|
-
if (typeof expBackoffMaxRepeats !== "number") {
|
|
1705
|
-
throw new Error('Parameter "expBackoffMaxRepeats" should be a number.');
|
|
1706
|
-
}
|
|
1707
|
-
for (let i = 0; ; i++) {
|
|
1708
|
-
let error;
|
|
1709
|
-
try {
|
|
1710
|
-
return await func();
|
|
1711
|
-
} catch (e) {
|
|
1712
|
-
error = e;
|
|
1713
|
-
}
|
|
1714
|
-
if (!(error instanceof RetryableError)) {
|
|
1715
|
-
throw error;
|
|
1716
|
-
}
|
|
1717
|
-
if (i >= expBackoffMaxRepeats - 1) {
|
|
1718
|
-
throw error.error;
|
|
1719
|
-
}
|
|
1720
|
-
const waitMillis = expBackoffMillis * 2 ** i;
|
|
1721
|
-
const rand = /* @__PURE__ */ __name((from, to) => from + Math.floor(Math.random() * (to - from + 1)), "rand");
|
|
1722
|
-
const randomizedWaitMillis = rand(waitMillis, waitMillis * 2);
|
|
1723
|
-
if (i === Math.round(expBackoffMaxRepeats / 2)) {
|
|
1724
|
-
import_log2.default.warning(`Retry failed ${i} times and will be repeated in ${randomizedWaitMillis}ms`, {
|
|
1725
|
-
originalError: error.error.message,
|
|
1726
|
-
errorDetails: Reflect.get(error.error, "details")
|
|
1727
|
-
});
|
|
1728
|
-
}
|
|
1729
|
-
await delayPromise(randomizedWaitMillis);
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
__name(retryWithExpBackoff, "retryWithExpBackoff");
|
|
1733
|
-
|
|
1734
|
-
// src/health_checker.ts
|
|
1735
|
-
var CHECK_TYPES = /* @__PURE__ */ ((CHECK_TYPES2) => {
|
|
1736
|
-
CHECK_TYPES2["MONGODB_PING"] = "MONGODB_PING";
|
|
1737
|
-
CHECK_TYPES2["MONGODB_READ"] = "MONGODB_READ";
|
|
1738
|
-
CHECK_TYPES2["MONGODB_WRITE"] = "MONGODB_WRITE";
|
|
1739
|
-
CHECK_TYPES2["REDIS"] = "REDIS";
|
|
1740
|
-
CHECK_TYPES2["REDIS_PING"] = "REDIS_PING";
|
|
1741
|
-
CHECK_TYPES2["REDIS_WRITE"] = "REDIS_WRITE";
|
|
1742
|
-
return CHECK_TYPES2;
|
|
1743
|
-
})(CHECK_TYPES || {});
|
|
1744
|
-
var _HealthChecker = class _HealthChecker {
|
|
1745
|
-
constructor(options) {
|
|
1746
|
-
__publicField(this, "options", options);
|
|
1747
|
-
__publicField(this, "checks");
|
|
1748
|
-
__publicField(this, "redisPrefix");
|
|
1749
|
-
__publicField(this, "redisTtlSecs");
|
|
1750
|
-
__publicField(this, "checkTimeoutMillis");
|
|
1751
|
-
__publicField(this, "mongoDbWriteTestCollection");
|
|
1752
|
-
__publicField(this, "mongoDbWriteTestRemoveOlderThanSecs");
|
|
1753
|
-
const {
|
|
1754
|
-
checks,
|
|
1755
|
-
redisPrefix = "health-check",
|
|
1756
|
-
redisTtlSecs = 15,
|
|
1757
|
-
checkTimeoutMillis = 15e3,
|
|
1758
|
-
mongoDbWriteTestCollection = "healthCheckPlayground",
|
|
1759
|
-
mongoDbWriteTestRemoveOlderThanSecs = 15
|
|
1760
|
-
} = options;
|
|
1761
|
-
if (!Array.isArray(checks)) throw new Error('Parameter "check" must be an array');
|
|
1762
|
-
checks.map((check) => this._validateCheck(check));
|
|
1763
|
-
this.checks = checks;
|
|
1764
|
-
this.redisPrefix = redisPrefix;
|
|
1765
|
-
this.redisTtlSecs = redisTtlSecs;
|
|
1766
|
-
this.checkTimeoutMillis = checkTimeoutMillis;
|
|
1767
|
-
this.mongoDbWriteTestCollection = mongoDbWriteTestCollection;
|
|
1768
|
-
this.mongoDbWriteTestRemoveOlderThanSecs = mongoDbWriteTestRemoveOlderThanSecs;
|
|
1769
|
-
}
|
|
1770
|
-
async ensureIsHealthy() {
|
|
1771
|
-
for (const check of this.checks) {
|
|
1772
|
-
try {
|
|
1773
|
-
const checkPromise = this._performCheck(check);
|
|
1774
|
-
await timeoutPromise(checkPromise, this.checkTimeoutMillis, "Check has timed-out");
|
|
1775
|
-
} catch (_err) {
|
|
1776
|
-
const err = _err;
|
|
1777
|
-
throw new Error(`Health check test "${check.type}" failed with an error: ${err.message}"`);
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
_validateCheck(check) {
|
|
1782
|
-
if (!(check.type in CHECK_TYPES)) throw new Error(`Check type "${check.type}" is invalid`);
|
|
1783
|
-
if (typeof check.client !== "object")
|
|
1784
|
-
throw new Error(`Check client must be an object got "${typeof check.client}" instead`);
|
|
1785
|
-
}
|
|
1786
|
-
async _performCheck(check) {
|
|
1787
|
-
switch (check.type) {
|
|
1788
|
-
case "MONGODB_PING" /* MONGODB_PING */:
|
|
1789
|
-
return this._testMongoDbPing(check);
|
|
1790
|
-
case "MONGODB_READ" /* MONGODB_READ */:
|
|
1791
|
-
return this._testMongoDbRead(check);
|
|
1792
|
-
case "MONGODB_WRITE" /* MONGODB_WRITE */:
|
|
1793
|
-
return this._testMongoDbWrite(check);
|
|
1794
|
-
case "REDIS_PING" /* REDIS_PING */:
|
|
1795
|
-
return this._testRedisPing(check);
|
|
1796
|
-
case "REDIS" /* REDIS */:
|
|
1797
|
-
case "REDIS_WRITE" /* REDIS_WRITE */:
|
|
1798
|
-
return this._testRedisWrite(check);
|
|
1799
|
-
default:
|
|
1800
|
-
throw new Error("Unknown check type");
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
async _testMongoDbPing({ client }) {
|
|
1804
|
-
const response = await client.command({ ping: 1 });
|
|
1805
|
-
if (response.ok !== 1) throw new Error(`Got ${response.ok} instead of 1!`);
|
|
1806
|
-
}
|
|
1807
|
-
async _testMongoDbRead({ client }) {
|
|
1808
|
-
const response = await client.listCollections().toArray();
|
|
1809
|
-
if (!Array.isArray(response)) throw new Error(`Got ${typeof response} instead of an array!`);
|
|
1810
|
-
}
|
|
1811
|
-
async _testMongoDbWrite({ client }) {
|
|
1812
|
-
const id = cryptoRandomObjectId();
|
|
1813
|
-
const collection = client.collection(this.mongoDbWriteTestCollection);
|
|
1814
|
-
await collection.deleteMany({
|
|
1815
|
-
createdAt: {
|
|
1816
|
-
$lt: new Date(Date.now() - this.mongoDbWriteTestRemoveOlderThanSecs * 1e3)
|
|
1817
|
-
}
|
|
1818
|
-
});
|
|
1819
|
-
await collection.insertOne({
|
|
1820
|
-
_id: id,
|
|
1821
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
1822
|
-
});
|
|
1823
|
-
const retrieved = await collection.findOne({ _id: id });
|
|
1824
|
-
if (!retrieved) throw new Error(`Item with ID "${id}" not found!`);
|
|
1825
|
-
}
|
|
1826
|
-
async _testRedisPing({ client }) {
|
|
1827
|
-
const response = await client.ping();
|
|
1828
|
-
if (response !== "PONG") throw new Error(`Got "${response}" instead of "PONG"!`);
|
|
1829
|
-
}
|
|
1830
|
-
async _testRedisWrite({ client }) {
|
|
1831
|
-
const key = `${this.redisPrefix}:${cryptoRandomObjectId()}`;
|
|
1832
|
-
const expected = "OK";
|
|
1833
|
-
await client.set(key, expected, "EX", this.redisTtlSecs);
|
|
1834
|
-
const given = await client.get(key);
|
|
1835
|
-
if (given !== expected) throw new Error(`Returned value "${given}" is not equal to "${expected}"!`);
|
|
1836
|
-
}
|
|
1837
|
-
};
|
|
1838
|
-
__name(_HealthChecker, "HealthChecker");
|
|
1839
|
-
__publicField(_HealthChecker, "CHECK_TYPES", CHECK_TYPES);
|
|
1840
|
-
var HealthChecker = _HealthChecker;
|
|
1841
|
-
|
|
1842
|
-
// src/parse_jsonl_stream.ts
|
|
1843
|
-
var import_node_stream = require("stream");
|
|
1844
|
-
var _ParseJsonlStream = class _ParseJsonlStream extends import_node_stream.Transform {
|
|
1845
|
-
constructor() {
|
|
1846
|
-
super(...arguments);
|
|
1847
|
-
__publicField(this, "pendingChunk", null);
|
|
1848
|
-
}
|
|
1849
|
-
parseLineAndEmitObject(line) {
|
|
1850
|
-
line = line.trim();
|
|
1851
|
-
if (!line) {
|
|
1852
|
-
return;
|
|
1853
|
-
}
|
|
1854
|
-
try {
|
|
1855
|
-
const obj = JSON.parse(line);
|
|
1856
|
-
this.emit("object", obj);
|
|
1857
|
-
} catch (e) {
|
|
1858
|
-
throw new Error(`Cannot parse JSON stream data ('${String(line)}'): ${String(e)}`);
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
_transform(chunk, encoding, callback) {
|
|
1862
|
-
let allData;
|
|
1863
|
-
if (this.pendingChunk) {
|
|
1864
|
-
allData = this.pendingChunk + chunk;
|
|
1865
|
-
this.pendingChunk = null;
|
|
1866
|
-
} else {
|
|
1867
|
-
allData = chunk;
|
|
1868
|
-
}
|
|
1869
|
-
const lines = allData.toString().split("\n");
|
|
1870
|
-
if (lines[lines.length - 1] !== "") {
|
|
1871
|
-
this.pendingChunk = lines.pop();
|
|
1872
|
-
}
|
|
1873
|
-
try {
|
|
1874
|
-
for (let i = 0; i < lines.length; i++) {
|
|
1875
|
-
this.parseLineAndEmitObject(lines[i]);
|
|
1876
|
-
}
|
|
1877
|
-
} catch (err) {
|
|
1878
|
-
callback(err, null);
|
|
1879
|
-
return;
|
|
1880
|
-
}
|
|
1881
|
-
callback(null, chunk);
|
|
1882
|
-
}
|
|
1883
|
-
// This function is called right after stream.end() is called by the writer.
|
|
1884
|
-
// It just tries to process the pending chunk and returns an error if that fails.
|
|
1885
|
-
_flush(callback) {
|
|
1886
|
-
if (this.pendingChunk) {
|
|
1887
|
-
try {
|
|
1888
|
-
this.parseLineAndEmitObject(this.pendingChunk);
|
|
1889
|
-
this.pendingChunk = null;
|
|
1890
|
-
} catch (err) {
|
|
1891
|
-
callback(err, null);
|
|
1892
|
-
return;
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
callback();
|
|
1896
|
-
}
|
|
1897
|
-
};
|
|
1898
|
-
__name(_ParseJsonlStream, "ParseJsonlStream");
|
|
1899
|
-
var ParseJsonlStream = _ParseJsonlStream;
|
|
1900
|
-
|
|
1901
|
-
// src/streams_utilities.ts
|
|
1902
|
-
async function concatStreamToBuffer(stream) {
|
|
1903
|
-
return new Promise((resolve, reject) => {
|
|
1904
|
-
const chunks = [];
|
|
1905
|
-
stream.on("data", (chunk) => {
|
|
1906
|
-
chunks.push(chunk);
|
|
1907
|
-
}).on("error", (e) => reject(e)).on("end", () => {
|
|
1908
|
-
const buffer = Buffer.concat(chunks);
|
|
1909
|
-
return resolve(buffer);
|
|
1910
|
-
});
|
|
1911
|
-
});
|
|
1912
|
-
}
|
|
1913
|
-
__name(concatStreamToBuffer, "concatStreamToBuffer");
|
|
1914
|
-
async function readStreamToString(stream, encoding) {
|
|
1915
|
-
const buffer = await concatStreamToBuffer(stream);
|
|
1916
|
-
return buffer.toString(encoding);
|
|
1917
|
-
}
|
|
1918
|
-
__name(readStreamToString, "readStreamToString");
|
|
1919
|
-
|
|
1920
|
-
// src/webhook_payload_template.ts
|
|
1921
|
-
var _WebhookPayloadTemplateError = class _WebhookPayloadTemplateError extends Error {
|
|
1922
|
-
constructor(message) {
|
|
1923
|
-
super(message);
|
|
1924
|
-
this.name = this.constructor.name;
|
|
1925
|
-
if (typeof Error.captureStackTrace === "function") {
|
|
1926
|
-
Error.captureStackTrace(this, this.constructor);
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
};
|
|
1930
|
-
__name(_WebhookPayloadTemplateError, "WebhookPayloadTemplateError");
|
|
1931
|
-
var WebhookPayloadTemplateError = _WebhookPayloadTemplateError;
|
|
1932
|
-
var _InvalidJsonError = class _InvalidJsonError extends WebhookPayloadTemplateError {
|
|
1933
|
-
constructor(originalError) {
|
|
1934
|
-
super(originalError.message);
|
|
1935
|
-
}
|
|
1936
|
-
};
|
|
1937
|
-
__name(_InvalidJsonError, "InvalidJsonError");
|
|
1938
|
-
var InvalidJsonError = _InvalidJsonError;
|
|
1939
|
-
var _InvalidVariableError = class _InvalidVariableError extends Error {
|
|
1940
|
-
constructor(variable) {
|
|
1941
|
-
super(`Invalid payload template variable: ${variable}`);
|
|
1942
|
-
}
|
|
1943
|
-
};
|
|
1944
|
-
__name(_InvalidVariableError, "InvalidVariableError");
|
|
1945
|
-
var InvalidVariableError = _InvalidVariableError;
|
|
1946
|
-
var _WebhookPayloadTemplate = class _WebhookPayloadTemplate {
|
|
1947
|
-
constructor(template, allowedVariables = null, context = {}) {
|
|
1948
|
-
__publicField(this, "template", template);
|
|
1949
|
-
__publicField(this, "allowedVariables", allowedVariables);
|
|
1950
|
-
__publicField(this, "context", context);
|
|
1951
|
-
__publicField(this, "payload");
|
|
1952
|
-
__publicField(this, "replacedVariables", []);
|
|
1953
|
-
this.payload = template;
|
|
1954
|
-
}
|
|
1955
|
-
/**
|
|
1956
|
-
* Parse existing webhook payload template string into an object, replacing
|
|
1957
|
-
* template variables using the provided context.
|
|
1958
|
-
*
|
|
1959
|
-
* Parse also validates the template structure, so it can be used
|
|
1960
|
-
* to check validity of the template JSON and usage of allowedVariables.
|
|
1961
|
-
*/
|
|
1962
|
-
static parse(payloadTemplate, allowedVariables = null, context = {}, options = {}) {
|
|
1963
|
-
const type = typeof payloadTemplate;
|
|
1964
|
-
if (type !== "string") throw new Error(`Cannot parse a ${type} payload template.`);
|
|
1965
|
-
const template = new _WebhookPayloadTemplate(payloadTemplate, allowedVariables, context);
|
|
1966
|
-
const data = template._parse();
|
|
1967
|
-
if (options.interpolateStrings) {
|
|
1968
|
-
return template._interpolate(data);
|
|
1969
|
-
}
|
|
1970
|
-
return data;
|
|
1971
|
-
}
|
|
1972
|
-
/**
|
|
1973
|
-
* Stringify an object into a webhook payload template.
|
|
1974
|
-
* Values created using `getTemplateVariable('foo.bar')`
|
|
1975
|
-
* will be stringified to `{{foo.bar}}` template variable.
|
|
1976
|
-
*/
|
|
1977
|
-
static stringify(objectTemplate, replacer, indent = 2) {
|
|
1978
|
-
const type = typeof objectTemplate;
|
|
1979
|
-
if (!objectTemplate || type !== "object") throw new Error(`Cannot stringify a ${type} payload template.`);
|
|
1980
|
-
return jsonStringifyExtended(objectTemplate, replacer, indent);
|
|
1981
|
-
}
|
|
1982
|
-
/**
|
|
1983
|
-
* Produces an instance of a template variable that can be used
|
|
1984
|
-
* in objects and will be stringified into `{{variableName}}` syntax.
|
|
1985
|
-
*
|
|
1986
|
-
* **Example:**
|
|
1987
|
-
* ```js
|
|
1988
|
-
* const resourceVariable = WebhookPayloadTemplate.getVariable('resource');
|
|
1989
|
-
* const objectTemplate = {
|
|
1990
|
-
* foo: 'foo',
|
|
1991
|
-
* bar: ['bar'],
|
|
1992
|
-
* res: resourceVariable,
|
|
1993
|
-
* }
|
|
1994
|
-
*
|
|
1995
|
-
* const payloadTemplate = WebhookPayloadTemplate.stringify(objectTemplate);
|
|
1996
|
-
* ```
|
|
1997
|
-
*
|
|
1998
|
-
* **Produces:**
|
|
1999
|
-
* ```json
|
|
2000
|
-
* {
|
|
2001
|
-
* "foo": "foo",
|
|
2002
|
-
* "bar": ["bar"],
|
|
2003
|
-
* "res": {{resource}},
|
|
2004
|
-
* }
|
|
2005
|
-
* ```
|
|
2006
|
-
*/
|
|
2007
|
-
static getVariable(variableName) {
|
|
2008
|
-
return new JsonVariable(variableName);
|
|
2009
|
-
}
|
|
2010
|
-
_parse() {
|
|
2011
|
-
let currentIndex = 0;
|
|
2012
|
-
while (true) {
|
|
2013
|
-
try {
|
|
2014
|
-
return JSON.parse(this.payload);
|
|
2015
|
-
} catch (err) {
|
|
2016
|
-
const position = this._findPositionOfNextVariable(currentIndex);
|
|
2017
|
-
if (!position) {
|
|
2018
|
-
throw new InvalidJsonError(err);
|
|
2019
|
-
}
|
|
2020
|
-
if (!position.isInsideString) {
|
|
2021
|
-
this._replaceVariable(position);
|
|
2022
|
-
}
|
|
2023
|
-
currentIndex = position.openBraceIndex + 1;
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
_interpolate(value) {
|
|
2028
|
-
if (typeof value === "string") {
|
|
2029
|
-
return this._interpolateString(value);
|
|
2030
|
-
}
|
|
2031
|
-
if (Array.isArray(value)) {
|
|
2032
|
-
return this._interpolateArray(value);
|
|
2033
|
-
}
|
|
2034
|
-
if (typeof value === "object" && value !== null) {
|
|
2035
|
-
return this._interpolateObject(value);
|
|
2036
|
-
}
|
|
2037
|
-
return value;
|
|
2038
|
-
}
|
|
2039
|
-
_interpolateString(value) {
|
|
2040
|
-
if (value.match(/^\{\{([a-zA-Z0-9.]+)\}\}$/)) {
|
|
2041
|
-
const variableName = value.substring(2, value.length - 2);
|
|
2042
|
-
this._validateVariableName(variableName);
|
|
2043
|
-
return this._getVariableValue(variableName);
|
|
2044
|
-
}
|
|
2045
|
-
return value.replace(/\{\{([a-zA-Z0-9.]+)\}\}/g, (match, variableName) => {
|
|
2046
|
-
this._validateVariableName(variableName);
|
|
2047
|
-
const variableValue = this._getVariableValue(variableName);
|
|
2048
|
-
return `${variableValue}`;
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
2051
|
-
_interpolateObject(value) {
|
|
2052
|
-
const result = {};
|
|
2053
|
-
Object.entries(value).forEach(([key, v]) => {
|
|
2054
|
-
result[key] = this._interpolate(v);
|
|
2055
|
-
});
|
|
2056
|
-
return result;
|
|
2057
|
-
}
|
|
2058
|
-
_interpolateArray(value) {
|
|
2059
|
-
return value.map(this._interpolate.bind(this));
|
|
2060
|
-
}
|
|
2061
|
-
_findPositionOfNextVariable(startIndex = 0) {
|
|
2062
|
-
const openBraceIndex = this.payload.indexOf("{{", startIndex);
|
|
2063
|
-
const closeBraceIndex = this.payload.indexOf("}}", openBraceIndex) + 1;
|
|
2064
|
-
const someVariableMaybeExists = openBraceIndex > -1 && closeBraceIndex > -1;
|
|
2065
|
-
if (!someVariableMaybeExists) return null;
|
|
2066
|
-
const isInsideString = this._isVariableInsideString(openBraceIndex);
|
|
2067
|
-
return { isInsideString, openBraceIndex, closeBraceIndex };
|
|
2068
|
-
}
|
|
2069
|
-
_isVariableInsideString(openBraceIndex) {
|
|
2070
|
-
const unescapedQuoteCount = this._countUnescapedDoubleQuotesUpToIndex(openBraceIndex);
|
|
2071
|
-
return unescapedQuoteCount % 2 === 1;
|
|
2072
|
-
}
|
|
2073
|
-
_countUnescapedDoubleQuotesUpToIndex(index) {
|
|
2074
|
-
const payloadSection = this.payload.substring(0, index);
|
|
2075
|
-
let unescapedQuoteCount = 0;
|
|
2076
|
-
for (let i = 0; i < payloadSection.length; i++) {
|
|
2077
|
-
const char = payloadSection[i];
|
|
2078
|
-
const prevChar = payloadSection[i - 1];
|
|
2079
|
-
if (char === '"' && prevChar !== "\\") {
|
|
2080
|
-
unescapedQuoteCount++;
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
return unescapedQuoteCount;
|
|
2084
|
-
}
|
|
2085
|
-
_replaceVariable({ openBraceIndex, closeBraceIndex }) {
|
|
2086
|
-
const variableName = this.payload.substring(openBraceIndex + 2, closeBraceIndex - 1);
|
|
2087
|
-
this._validateVariableName(variableName);
|
|
2088
|
-
const replacement = this._getVariableReplacement(variableName);
|
|
2089
|
-
this.replacedVariables.push({ variableName, replacement });
|
|
2090
|
-
this.payload = this.payload.substring(0, openBraceIndex) + replacement + this.payload.substring(closeBraceIndex + 1);
|
|
2091
|
-
}
|
|
2092
|
-
_validateVariableName(variableName) {
|
|
2093
|
-
if (this.allowedVariables === null) return;
|
|
2094
|
-
const [variable] = variableName.split(".");
|
|
2095
|
-
const isVariableValid = this.allowedVariables.has(variable);
|
|
2096
|
-
if (!isVariableValid) throw new InvalidVariableError(variableName);
|
|
2097
|
-
}
|
|
2098
|
-
_getVariableValue(variableName) {
|
|
2099
|
-
const [variable, ...properties] = variableName.split(".");
|
|
2100
|
-
const context = this.context[variable];
|
|
2101
|
-
const value = properties.reduce((ctx, prop) => {
|
|
2102
|
-
if (!ctx || typeof ctx !== "object") return null;
|
|
2103
|
-
return ctx[prop];
|
|
2104
|
-
}, context);
|
|
2105
|
-
return value;
|
|
2106
|
-
}
|
|
2107
|
-
_getVariableReplacement(variableName) {
|
|
2108
|
-
const value = this._getVariableValue(variableName);
|
|
2109
|
-
return value ? JSON.stringify(value) : null;
|
|
2110
|
-
}
|
|
2111
|
-
};
|
|
2112
|
-
__name(_WebhookPayloadTemplate, "WebhookPayloadTemplate");
|
|
2113
|
-
var WebhookPayloadTemplate = _WebhookPayloadTemplate;
|
|
2114
|
-
|
|
2115
|
-
// src/crypto.ts
|
|
2116
|
-
var import_node_crypto2 = __toESM(require("crypto"));
|
|
2117
|
-
var ENCRYPTION_ALGORITHM = "aes-256-gcm";
|
|
2118
|
-
var ENCRYPTION_KEY_LENGTH = 32;
|
|
2119
|
-
var ENCRYPTION_IV_LENGTH = 16;
|
|
2120
|
-
var ENCRYPTION_AUTH_TAG_LENGTH = 16;
|
|
2121
|
-
function publicEncrypt({ publicKey, value }) {
|
|
2122
|
-
const key = cryptoRandomObjectId(ENCRYPTION_KEY_LENGTH);
|
|
2123
|
-
const initVector = cryptoRandomObjectId(ENCRYPTION_IV_LENGTH);
|
|
2124
|
-
const cipher = import_node_crypto2.default.createCipheriv(ENCRYPTION_ALGORITHM, key, initVector);
|
|
2125
|
-
const bufferFromValue = Buffer.from(value, "utf-8");
|
|
2126
|
-
const bufferFromKey = Buffer.from(key, "utf-8");
|
|
2127
|
-
const bufferFromInitVector = Buffer.from(initVector, "utf-8");
|
|
2128
|
-
const passwordBuffer = Buffer.concat([bufferFromKey, bufferFromInitVector]);
|
|
2129
|
-
const encryptedValue = Buffer.concat([cipher.update(bufferFromValue), cipher.final(), cipher.getAuthTag()]);
|
|
2130
|
-
const encryptedPassword = import_node_crypto2.default.publicEncrypt(publicKey, passwordBuffer);
|
|
2131
|
-
return {
|
|
2132
|
-
encryptedPassword: encryptedPassword.toString("base64"),
|
|
2133
|
-
encryptedValue: encryptedValue.toString("base64")
|
|
2134
|
-
};
|
|
2135
|
-
}
|
|
2136
|
-
__name(publicEncrypt, "publicEncrypt");
|
|
2137
|
-
function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }) {
|
|
2138
|
-
const encryptedValueBuffer = Buffer.from(encryptedValue, "base64");
|
|
2139
|
-
const encryptedPasswordBuffer = Buffer.from(encryptedPassword, "base64");
|
|
2140
|
-
const passwordBuffer = import_node_crypto2.default.privateDecrypt(privateKey, encryptedPasswordBuffer);
|
|
2141
|
-
if (passwordBuffer.length !== ENCRYPTION_KEY_LENGTH + ENCRYPTION_IV_LENGTH) {
|
|
2142
|
-
throw new Error("privateDecrypt: Decryption failed, invalid password length!");
|
|
2143
|
-
}
|
|
2144
|
-
const authTagBuffer = encryptedValueBuffer.slice(encryptedValueBuffer.length - ENCRYPTION_AUTH_TAG_LENGTH);
|
|
2145
|
-
const encryptedDataBuffer = encryptedValueBuffer.slice(0, encryptedValueBuffer.length - ENCRYPTION_AUTH_TAG_LENGTH);
|
|
2146
|
-
const encryptionKeyBuffer = passwordBuffer.slice(0, ENCRYPTION_KEY_LENGTH);
|
|
2147
|
-
const initVectorBuffer = passwordBuffer.slice(ENCRYPTION_KEY_LENGTH);
|
|
2148
|
-
const decipher = import_node_crypto2.default.createDecipheriv(ENCRYPTION_ALGORITHM, encryptionKeyBuffer, initVectorBuffer);
|
|
2149
|
-
decipher.setAuthTag(authTagBuffer);
|
|
2150
|
-
return Buffer.concat([decipher.update(encryptedDataBuffer), decipher.final()]).toString("utf-8");
|
|
2151
|
-
}
|
|
2152
|
-
__name(privateDecrypt, "privateDecrypt");
|
|
2153
|
-
|
|
2154
|
-
// src/url_params_utils.ts
|
|
2155
|
-
function separateImports(code) {
|
|
2156
|
-
const lines = code.split("\n");
|
|
2157
|
-
return {
|
|
2158
|
-
code: lines.filter((line) => !line.trim().startsWith("import")).join("\n"),
|
|
2159
|
-
imports: lines.filter((line) => line.trim().startsWith("import")).join("\n")
|
|
2160
|
-
};
|
|
2161
|
-
}
|
|
2162
|
-
__name(separateImports, "separateImports");
|
|
2163
|
-
|
|
2164
|
-
// src/code_hash_manager.ts
|
|
2165
|
-
var import_node_crypto3 = require("crypto");
|
|
2166
|
-
var CodeHashMetaKey = /* @__PURE__ */ ((CodeHashMetaKey2) => {
|
|
2167
|
-
CodeHashMetaKey2["VERSION"] = "v";
|
|
2168
|
-
CodeHashMetaKey2["USER"] = "u";
|
|
2169
|
-
return CodeHashMetaKey2;
|
|
2170
|
-
})(CodeHashMetaKey || {});
|
|
2171
|
-
var _CodeHashManager = class _CodeHashManager {
|
|
2172
|
-
constructor(secret) {
|
|
2173
|
-
__publicField(this, "secret", secret);
|
|
2174
|
-
}
|
|
2175
|
-
/**
|
|
2176
|
-
* Encodes object (e.g. input for actor) to a string hash and uses the `secret` to sign the hash.
|
|
2177
|
-
*/
|
|
2178
|
-
encode(data, userId) {
|
|
2179
|
-
const meta = {
|
|
2180
|
-
["u" /* USER */]: userId,
|
|
2181
|
-
["v" /* VERSION */]: _CodeHashManager.VERSION
|
|
2182
|
-
};
|
|
2183
|
-
const metaBase64 = this.toBase64(JSON.stringify(meta));
|
|
2184
|
-
const inputBase64 = this.toBase64(JSON.stringify(data));
|
|
2185
|
-
const dataToSign = [metaBase64, inputBase64].join(_CodeHashManager.SECTION_SEPARATOR);
|
|
2186
|
-
const signature = this.generateSignature(dataToSign);
|
|
2187
|
-
const signatureBase64 = this.toBase64(signature);
|
|
2188
|
-
const parts = [metaBase64, inputBase64, signatureBase64];
|
|
2189
|
-
return parts.join(_CodeHashManager.SECTION_SEPARATOR);
|
|
2190
|
-
}
|
|
2191
|
-
decode(urlHash) {
|
|
2192
|
-
const parts = urlHash.split(_CodeHashManager.SECTION_SEPARATOR);
|
|
2193
|
-
const dataToSign = parts.slice(0, 2).join(_CodeHashManager.SECTION_SEPARATOR);
|
|
2194
|
-
const meta = JSON.parse(this.fromBase64(parts[0]).toString());
|
|
2195
|
-
const data = JSON.parse(this.fromBase64(parts[1]).toString());
|
|
2196
|
-
const signature = this.fromBase64(parts[2]);
|
|
2197
|
-
const expectedSignature = this.generateSignature(dataToSign);
|
|
2198
|
-
const isSignatureValid = (0, import_node_crypto3.timingSafeEqual)(signature, expectedSignature);
|
|
2199
|
-
return {
|
|
2200
|
-
data,
|
|
2201
|
-
meta: {
|
|
2202
|
-
userId: meta["u" /* USER */],
|
|
2203
|
-
version: meta["v" /* VERSION */],
|
|
2204
|
-
isSignatureValid
|
|
2205
|
-
}
|
|
2206
|
-
};
|
|
2207
|
-
}
|
|
2208
|
-
toBase64(data) {
|
|
2209
|
-
return Buffer.from(data).toString("base64url");
|
|
2210
|
-
}
|
|
2211
|
-
fromBase64(encoded) {
|
|
2212
|
-
return Buffer.from(encoded, "base64url");
|
|
2213
|
-
}
|
|
2214
|
-
generateSignature(data) {
|
|
2215
|
-
return (0, import_node_crypto3.createHmac)("sha256", this.secret).update(data).digest();
|
|
2216
|
-
}
|
|
2217
|
-
};
|
|
2218
|
-
__name(_CodeHashManager, "CodeHashManager");
|
|
2219
|
-
__publicField(_CodeHashManager, "SECTION_SEPARATOR", ".");
|
|
2220
|
-
__publicField(_CodeHashManager, "VERSION", 1);
|
|
2221
|
-
var CodeHashManager = _CodeHashManager;
|
|
2222
|
-
|
|
2223
|
-
// src/hmac.ts
|
|
2224
|
-
var import_node_crypto4 = __toESM(require("crypto"));
|
|
2225
|
-
var CHARSET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
2226
|
-
function encodeBase62(num) {
|
|
2227
|
-
if (num === 0n) {
|
|
2228
|
-
return CHARSET[0];
|
|
2229
|
-
}
|
|
2230
|
-
let res = "";
|
|
2231
|
-
while (num > 0n) {
|
|
2232
|
-
res = CHARSET[Number(num % 62n)] + res;
|
|
2233
|
-
num /= 62n;
|
|
2234
|
-
}
|
|
2235
|
-
return res;
|
|
2236
|
-
}
|
|
2237
|
-
__name(encodeBase62, "encodeBase62");
|
|
2238
|
-
function createHmacSignature(secretKey, message) {
|
|
2239
|
-
const signature = import_node_crypto4.default.createHmac("sha256", secretKey).update(message).digest("hex").substring(0, 30);
|
|
2240
|
-
return encodeBase62(BigInt(`0x${signature}`));
|
|
2241
|
-
}
|
|
2242
|
-
__name(createHmacSignature, "createHmacSignature");
|
|
2243
|
-
var subtleCrypto = globalThis.crypto?.subtle;
|
|
2244
|
-
async function ensureSubtleCryptoExists() {
|
|
2245
|
-
if (!subtleCrypto) {
|
|
2246
|
-
try {
|
|
2247
|
-
subtleCrypto = require("crypto")?.webcrypto?.subtle;
|
|
2248
|
-
if (subtleCrypto) return;
|
|
2249
|
-
} catch {
|
|
2250
|
-
}
|
|
2251
|
-
try {
|
|
2252
|
-
subtleCrypto = (await import("crypto"))?.webcrypto?.subtle;
|
|
2253
|
-
} catch {
|
|
2254
|
-
}
|
|
2255
|
-
if (!subtleCrypto) {
|
|
2256
|
-
throw new Error(`SubtleCrypto is not available in this environment.
|
|
2257
|
-
Please ensure you're running in an environment that supports Web Crypto API,
|
|
2258
|
-
or submit an issue to https://github.com/apify/apify-shared-js so we can help you further.`);
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2262
|
-
__name(ensureSubtleCryptoExists, "ensureSubtleCryptoExists");
|
|
2263
|
-
async function createHmacSignatureAsync(secretKey, message) {
|
|
2264
|
-
await ensureSubtleCryptoExists();
|
|
2265
|
-
const encoder = new TextEncoder();
|
|
2266
|
-
const key = await subtleCrypto.importKey(
|
|
2267
|
-
"raw",
|
|
2268
|
-
encoder.encode(secretKey),
|
|
2269
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
2270
|
-
false,
|
|
2271
|
-
["sign"]
|
|
2272
|
-
);
|
|
2273
|
-
const signatureBuffer = await subtleCrypto.sign("HMAC", key, encoder.encode(message));
|
|
2274
|
-
const signatureArray = new Uint8Array(signatureBuffer);
|
|
2275
|
-
const signatureHex = Array.from(signatureArray).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 30);
|
|
2276
|
-
return encodeBase62(BigInt(`0x${signatureHex}`));
|
|
2277
|
-
}
|
|
2278
|
-
__name(createHmacSignatureAsync, "createHmacSignatureAsync");
|
|
2279
|
-
|
|
2280
|
-
// src/storages.ts
|
|
2281
|
-
function createStorageContentSignature({
|
|
2282
|
-
resourceId,
|
|
2283
|
-
urlSigningSecretKey,
|
|
2284
|
-
expiresInMillis,
|
|
2285
|
-
version = 0
|
|
2286
|
-
}) {
|
|
2287
|
-
const expiresAt = expiresInMillis ? (/* @__PURE__ */ new Date()).getTime() + expiresInMillis : 0;
|
|
2288
|
-
const hmac = createHmacSignature(urlSigningSecretKey, `${version}.${expiresAt}.${resourceId}`);
|
|
2289
|
-
return Buffer.from(`${version}.${expiresAt}.${hmac}`).toString("base64url");
|
|
2290
|
-
}
|
|
2291
|
-
__name(createStorageContentSignature, "createStorageContentSignature");
|
|
2292
|
-
function typedArrayToBase64Url(typedArray) {
|
|
2293
|
-
let binary = "";
|
|
2294
|
-
for (let i = 0; i < typedArray.length; i++) {
|
|
2295
|
-
binary += String.fromCharCode(typedArray[i]);
|
|
2296
|
-
}
|
|
2297
|
-
const base64 = btoa(binary);
|
|
2298
|
-
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
2299
|
-
}
|
|
2300
|
-
__name(typedArrayToBase64Url, "typedArrayToBase64Url");
|
|
2301
|
-
async function createStorageContentSignatureAsync({
|
|
2302
|
-
resourceId,
|
|
2303
|
-
urlSigningSecretKey,
|
|
2304
|
-
expiresInMillis,
|
|
2305
|
-
version = 0
|
|
2306
|
-
}) {
|
|
2307
|
-
const expiresAt = expiresInMillis ? (/* @__PURE__ */ new Date()).getTime() + expiresInMillis : 0;
|
|
2308
|
-
const hmac = await createHmacSignatureAsync(urlSigningSecretKey, `${version}.${expiresAt}.${resourceId}`);
|
|
2309
|
-
return typedArrayToBase64Url(new TextEncoder().encode(`${version}.${expiresAt}.${hmac}`));
|
|
2310
|
-
}
|
|
2311
|
-
__name(createStorageContentSignatureAsync, "createStorageContentSignatureAsync");
|
|
2312
|
-
|
|
2313
|
-
// src/parse_boolean.ts
|
|
2314
|
-
var parseBooleanOrNull = /* @__PURE__ */ __name((value) => {
|
|
2315
|
-
if (value === true || value === 1) return true;
|
|
2316
|
-
if (value === false || value === 0) return false;
|
|
2317
|
-
if (typeof value === "string") {
|
|
2318
|
-
const lowerValue = value.trim().toLowerCase();
|
|
2319
|
-
if (lowerValue === "true" || lowerValue === "1") return true;
|
|
2320
|
-
if (lowerValue === "false" || lowerValue === "0") return false;
|
|
2321
|
-
}
|
|
2322
|
-
return null;
|
|
2323
|
-
}, "parseBooleanOrNull");
|
|
2324
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2325
|
-
0 && (module.exports = {
|
|
2326
|
-
CHECK_TYPES,
|
|
2327
|
-
CodeHashManager,
|
|
2328
|
-
CodeHashMetaKey,
|
|
2329
|
-
HealthChecker,
|
|
2330
|
-
InvalidJsonError,
|
|
2331
|
-
InvalidVariableError,
|
|
2332
|
-
JsonVariable,
|
|
2333
|
-
ParseJsonlStream,
|
|
2334
|
-
RetryableError,
|
|
2335
|
-
WebhookPayloadTemplate,
|
|
2336
|
-
betterClearInterval,
|
|
2337
|
-
betterSetInterval,
|
|
2338
|
-
buildOrVersionNumberIntToStr,
|
|
2339
|
-
checkParamPrototypeOrThrow,
|
|
2340
|
-
concatStreamToBuffer,
|
|
2341
|
-
configureLogger,
|
|
2342
|
-
createHmacSignature,
|
|
2343
|
-
createHmacSignatureAsync,
|
|
2344
|
-
createInjectableRegExp,
|
|
2345
|
-
createStorageContentSignature,
|
|
2346
|
-
createStorageContentSignatureAsync,
|
|
2347
|
-
cryptoRandomObjectId,
|
|
2348
|
-
dateToString,
|
|
2349
|
-
delayPromise,
|
|
2350
|
-
deterministicUniqueId,
|
|
2351
|
-
escapeForBson,
|
|
2352
|
-
escapePropertyName,
|
|
2353
|
-
escapeRegExp,
|
|
2354
|
-
expressErrorHandler,
|
|
2355
|
-
getOrdinalSuffix,
|
|
2356
|
-
getRandomInt,
|
|
2357
|
-
http404Route,
|
|
2358
|
-
isBadForMongo,
|
|
2359
|
-
isBuffer,
|
|
2360
|
-
isForbiddenUsername,
|
|
2361
|
-
isNullOrUndefined,
|
|
2362
|
-
isUrlRelative,
|
|
2363
|
-
jsonStringifyExtended,
|
|
2364
|
-
leftpad,
|
|
2365
|
-
markedDecreaseHeadsLevel,
|
|
2366
|
-
markedSetNofollowLinks,
|
|
2367
|
-
normalizeUrl,
|
|
2368
|
-
parseBooleanOrNull,
|
|
2369
|
-
parseDateFromJson,
|
|
2370
|
-
parseUrl,
|
|
2371
|
-
privateDecrypt,
|
|
2372
|
-
promisifyServerListen,
|
|
2373
|
-
publicEncrypt,
|
|
2374
|
-
readStreamToString,
|
|
2375
|
-
removeFromArray,
|
|
2376
|
-
retryWithExpBackoff,
|
|
2377
|
-
separateImports,
|
|
2378
|
-
sequentializePromises,
|
|
2379
|
-
splitFullName,
|
|
2380
|
-
timeoutPromise,
|
|
2381
|
-
traverseObject,
|
|
2382
|
-
truncate,
|
|
2383
|
-
unescapeFromBson,
|
|
2384
|
-
unescapePropertyName,
|
|
2385
|
-
weightedAverage
|
|
2386
|
-
});
|
|
2387
|
-
/*!
|
|
2388
|
-
* This module contains various server utility and helper functions.
|
|
2389
|
-
* Note that it automatically exports functions from utilities.client.js
|
|
2390
|
-
*
|
|
2391
|
-
* Author: Jan Curn (jan@apify.com)
|
|
2392
|
-
* Copyright(c) 2015 Apify. All rights reserved.
|
|
2393
|
-
*
|
|
2394
|
-
*/
|
|
2395
|
-
/*!
|
|
2396
|
-
* This module contains various client-side utility and helper functions.
|
|
2397
|
-
*
|
|
2398
|
-
* Author: Jan Curn (jan@apify.com)
|
|
2399
|
-
* Copyright(c) 2016 Apify. All rights reserved.
|
|
2400
|
-
*
|
|
2401
|
-
*/
|
|
2402
|
-
//# sourceMappingURL=index.cjs.map
|