s3db.js 19.1.1 → 19.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/recker-http-handler.js +25 -36
- package/dist/clients/recker-http-handler.js.map +1 -1
- package/dist/concerns/logger-redact.js +0 -1
- package/dist/concerns/logger-redact.js.map +1 -1
- package/dist/plugins/api/index.js +1 -0
- package/dist/plugins/api/index.js.map +1 -1
- package/dist/plugins/cache.plugin.js +1 -0
- package/dist/plugins/cache.plugin.js.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/s3db.cjs +40 -39
- package/dist/s3db.cjs.map +1 -1
- package/dist/s3db.es.js +41 -45
- package/dist/s3db.es.js.map +1 -1
- package/dist/types/clients/recker-http-handler.d.ts +3 -3
- package/dist/types/clients/recker-http-handler.d.ts.map +1 -1
- package/dist/types/clients/types.d.ts +1 -0
- package/dist/types/clients/types.d.ts.map +1 -1
- package/dist/types/concerns/logger-redact.d.ts.map +1 -1
- package/dist/types/plugins/api/index.d.ts +1 -0
- package/dist/types/plugins/api/index.d.ts.map +1 -1
- package/dist/types/plugins/cache.plugin.d.ts +2 -1
- package/dist/types/plugins/cache.plugin.d.ts.map +1 -1
- package/dist/types/plugins/index.d.ts +1 -1
- package/dist/types/plugins/index.d.ts.map +1 -1
- package/mcp/data/embeddings-core.json +1 -1
- package/mcp/data/embeddings-plugins.json +1 -1
- package/package.json +6 -6
- package/src/clients/recker-http-handler.ts +31 -59
- package/src/clients/types.ts +1 -0
- package/src/concerns/logger-redact.ts +0 -1
- package/src/plugins/api/index.ts +11 -0
- package/src/plugins/cache.plugin.ts +1 -0
- package/src/plugins/index.ts +5 -1
package/dist/s3db.cjs
CHANGED
|
@@ -6,7 +6,6 @@ var path$2 = require('path');
|
|
|
6
6
|
var EventEmitter = require('events');
|
|
7
7
|
var lodashEs = require('lodash-es');
|
|
8
8
|
var recker = require('recker');
|
|
9
|
-
var node_stream = require('node:stream');
|
|
10
9
|
var clientS3 = require('@aws-sdk/client-s3');
|
|
11
10
|
var crypto$2 = require('crypto');
|
|
12
11
|
var nanoid = require('nanoid');
|
|
@@ -310,7 +309,6 @@ function parseRetryAfter$1(headerValue) {
|
|
|
310
309
|
return undefined;
|
|
311
310
|
}
|
|
312
311
|
class ReckerHttpHandler {
|
|
313
|
-
metadata = { handlerProtocol: 'h2' };
|
|
314
312
|
options;
|
|
315
313
|
client;
|
|
316
314
|
deduplicator;
|
|
@@ -387,23 +385,16 @@ class ReckerHttpHandler {
|
|
|
387
385
|
circuitBreakerTrips: 0,
|
|
388
386
|
};
|
|
389
387
|
}
|
|
388
|
+
get metadata() {
|
|
389
|
+
return this.client?.metadata ?? { handlerProtocol: 'http/1.1' };
|
|
390
|
+
}
|
|
390
391
|
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
391
|
-
const protocol = request.protocol || 'https:';
|
|
392
|
-
const defaultPort = protocol === 'https:' ? 443 : 80;
|
|
393
|
-
const port = request.port || defaultPort;
|
|
394
392
|
const hostname = request.hostname;
|
|
395
|
-
const url = `${protocol}//${hostname}:${port}${request.path}`;
|
|
396
393
|
const method = request.method;
|
|
397
394
|
if (this.circuitBreaker && !this.circuitBreaker.canRequest(hostname)) {
|
|
398
395
|
this.metrics.circuitBreakerTrips++;
|
|
399
396
|
throw new Error(`Circuit breaker OPEN for ${hostname}`);
|
|
400
397
|
}
|
|
401
|
-
const headers = {};
|
|
402
|
-
for (const [key, value] of Object.entries(request.headers)) {
|
|
403
|
-
if (value !== undefined) {
|
|
404
|
-
headers[key] = value;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
398
|
const doRequest = async () => {
|
|
408
399
|
this.metrics.requests++;
|
|
409
400
|
let lastError;
|
|
@@ -412,20 +403,32 @@ class ReckerHttpHandler {
|
|
|
412
403
|
while (attempt < maxAttempts) {
|
|
413
404
|
attempt++;
|
|
414
405
|
try {
|
|
415
|
-
const
|
|
416
|
-
|
|
406
|
+
const headers = {};
|
|
407
|
+
for (const [key, value] of Object.entries(request.headers)) {
|
|
408
|
+
if (value !== undefined) {
|
|
409
|
+
headers[key] = value;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const result = await this.client.handle({
|
|
413
|
+
protocol: request.protocol,
|
|
414
|
+
hostname: request.hostname,
|
|
415
|
+
port: request.port,
|
|
416
|
+
path: request.path,
|
|
417
|
+
query: request.query,
|
|
418
|
+
method: request.method,
|
|
417
419
|
headers,
|
|
418
420
|
body: request.body,
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
421
|
+
}, {
|
|
422
|
+
abortSignal,
|
|
423
|
+
requestTimeout: requestTimeout || this.options.bodyTimeout,
|
|
422
424
|
});
|
|
425
|
+
const statusCode = result.response.statusCode;
|
|
423
426
|
if (this.options.enableRetry && attempt < maxAttempts &&
|
|
424
|
-
isRetryableError(null,
|
|
427
|
+
isRetryableError(null, statusCode)) {
|
|
425
428
|
this.metrics.retries++;
|
|
426
429
|
let delay;
|
|
427
430
|
if (this.options.respectRetryAfter) {
|
|
428
|
-
const retryAfter = parseRetryAfter$1(
|
|
431
|
+
const retryAfter = parseRetryAfter$1(result.response.headers['retry-after'] ?? null);
|
|
429
432
|
delay = retryAfter !== undefined
|
|
430
433
|
? Math.min(retryAfter, this.options.maxRetryDelay)
|
|
431
434
|
: calculateRetryDelay(attempt, this.options.retryDelay, this.options.maxRetryDelay, this.options.retryJitter);
|
|
@@ -439,22 +442,7 @@ class ReckerHttpHandler {
|
|
|
439
442
|
if (this.circuitBreaker) {
|
|
440
443
|
this.circuitBreaker.recordSuccess(hostname);
|
|
441
444
|
}
|
|
442
|
-
|
|
443
|
-
if (reckerResponse.body) {
|
|
444
|
-
body = node_stream.Readable.fromWeb(reckerResponse.body);
|
|
445
|
-
}
|
|
446
|
-
const responseHeaders = {};
|
|
447
|
-
for (const [key, value] of reckerResponse.headers.entries()) {
|
|
448
|
-
responseHeaders[key] = value;
|
|
449
|
-
}
|
|
450
|
-
return {
|
|
451
|
-
response: {
|
|
452
|
-
statusCode: reckerResponse.status,
|
|
453
|
-
reason: reckerResponse.statusText,
|
|
454
|
-
headers: responseHeaders,
|
|
455
|
-
body
|
|
456
|
-
}
|
|
457
|
-
};
|
|
445
|
+
return result;
|
|
458
446
|
}
|
|
459
447
|
catch (error) {
|
|
460
448
|
lastError = error;
|
|
@@ -463,7 +451,6 @@ class ReckerHttpHandler {
|
|
|
463
451
|
}
|
|
464
452
|
if (this.options.enableRetry && attempt < maxAttempts && isRetryableError(error)) {
|
|
465
453
|
this.metrics.retries++;
|
|
466
|
-
// Check for HTTP/2 specific retry delay (e.g., ENHANCE_YOUR_CALM)
|
|
467
454
|
const h2Delay = getHttp2RetryDelay(error);
|
|
468
455
|
const delay = h2Delay !== undefined
|
|
469
456
|
? Math.min(h2Delay, this.options.maxRetryDelay)
|
|
@@ -477,6 +464,8 @@ class ReckerHttpHandler {
|
|
|
477
464
|
throw lastError;
|
|
478
465
|
};
|
|
479
466
|
if (this.deduplicator) {
|
|
467
|
+
const protocol = request.protocol || 'https:';
|
|
468
|
+
const url = `${protocol}//${hostname}${request.path}`;
|
|
480
469
|
const originalRequests = this.metrics.requests;
|
|
481
470
|
const result = await this.deduplicator.dedupe(method, url, doRequest);
|
|
482
471
|
if (this.metrics.requests === originalRequests) {
|
|
@@ -1636,7 +1625,6 @@ const BUILT_IN_SENSITIVE_FIELDS = [
|
|
|
1636
1625
|
'certificatekey',
|
|
1637
1626
|
'certificate_key',
|
|
1638
1627
|
'certificate-key',
|
|
1639
|
-
'key',
|
|
1640
1628
|
'credential',
|
|
1641
1629
|
'credentials',
|
|
1642
1630
|
'hash',
|
|
@@ -18272,8 +18260,8 @@ class Database extends SafeEventEmitter {
|
|
|
18272
18260
|
})();
|
|
18273
18261
|
this.version = '1';
|
|
18274
18262
|
this.s3dbVersion = (() => {
|
|
18275
|
-
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.1.
|
|
18276
|
-
? globalThis['19.1.
|
|
18263
|
+
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.1.3'] !== 'undefined' && globalThis['19.1.3'] !== '19.1.3'
|
|
18264
|
+
? globalThis['19.1.3']
|
|
18277
18265
|
: 'latest'));
|
|
18278
18266
|
return ok ? version : 'latest';
|
|
18279
18267
|
})();
|
|
@@ -51065,6 +51053,9 @@ function deleteChunkedCookie(context, name, options = {}, cookieJar = null) {
|
|
|
51065
51053
|
});
|
|
51066
51054
|
});
|
|
51067
51055
|
}
|
|
51056
|
+
function isChunkedCookie(context, name) {
|
|
51057
|
+
return !!getCookie(context, `${name}.__chunks`);
|
|
51058
|
+
}
|
|
51068
51059
|
|
|
51069
51060
|
const logger$i = createLogger({
|
|
51070
51061
|
name: 'OidcValidator',
|
|
@@ -64059,14 +64050,19 @@ class ApiPlugin extends Plugin {
|
|
|
64059
64050
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
64060
64051
|
__proto__: null,
|
|
64061
64052
|
ApiPlugin: ApiPlugin,
|
|
64053
|
+
CookieChunkOverflowError: CookieChunkOverflowError,
|
|
64062
64054
|
OIDCClient: OIDCClient,
|
|
64063
64055
|
OpenGraphHelper: OpenGraphHelper,
|
|
64064
64056
|
RouteContext: RouteContext$1,
|
|
64065
64057
|
createContextInjectionMiddleware: createContextInjectionMiddleware,
|
|
64058
|
+
deleteChunkedCookie: deleteChunkedCookie,
|
|
64066
64059
|
ejsEngine: ejsEngine,
|
|
64067
64060
|
errorResponse: errorResponse,
|
|
64061
|
+
getChunkedCookie: getChunkedCookie,
|
|
64062
|
+
isChunkedCookie: isChunkedCookie,
|
|
64068
64063
|
jsxEngine: jsxEngine,
|
|
64069
64064
|
pugEngine: pugEngine,
|
|
64065
|
+
setChunkedCookie: setChunkedCookie,
|
|
64070
64066
|
setupTemplateEngine: setupTemplateEngine,
|
|
64071
64067
|
successResponse: successResponse,
|
|
64072
64068
|
withContext: withContext
|
|
@@ -160512,6 +160508,7 @@ exports.decodeIPv6 = decodeIPv6;
|
|
|
160512
160508
|
exports.decodeMoney = decodeMoney;
|
|
160513
160509
|
exports.decrypt = decrypt;
|
|
160514
160510
|
exports.default = S3db;
|
|
160511
|
+
exports.deleteChunkedCookie = deleteChunkedCookie;
|
|
160515
160512
|
exports.detectIPVersion = detectIPVersion;
|
|
160516
160513
|
exports.dictionaryDecode = dictionaryDecode;
|
|
160517
160514
|
exports.dictionaryEncode = dictionaryEncode;
|
|
@@ -160550,6 +160547,7 @@ exports.getBitFast = getBitFast;
|
|
|
160550
160547
|
exports.getCacheMemoryUsage = getCacheMemoryUsage;
|
|
160551
160548
|
exports.getCacheStats = getCacheStats;
|
|
160552
160549
|
exports.getCachedValidator = getCachedValidator;
|
|
160550
|
+
exports.getChunkedCookie = getChunkedCookie;
|
|
160553
160551
|
exports.getCronManager = getCronManager;
|
|
160554
160552
|
exports.getCurrencyDecimals = getCurrencyDecimals;
|
|
160555
160553
|
exports.getDictionaryStats = getDictionaryStats;
|
|
@@ -160570,6 +160568,7 @@ exports.idGenerator = idGenerator;
|
|
|
160570
160568
|
exports.initializeNanoid = initializeNanoid;
|
|
160571
160569
|
exports.intervalToCron = intervalToCron;
|
|
160572
160570
|
exports.isBcryptHash = isBcryptHash;
|
|
160571
|
+
exports.isChunkedCookie = isChunkedCookie;
|
|
160573
160572
|
exports.isPreconditionFailure = isPreconditionFailure;
|
|
160574
160573
|
exports.isReckerAvailable = isReckerAvailable;
|
|
160575
160574
|
exports.isSensitiveField = isSensitiveField;
|
|
@@ -160622,8 +160621,10 @@ exports.releaseValidator = releaseValidator;
|
|
|
160622
160621
|
exports.resetCronManager = resetCronManager;
|
|
160623
160622
|
exports.resetGlobalLogger = resetGlobalLogger;
|
|
160624
160623
|
exports.resetProcessManager = resetProcessManager;
|
|
160624
|
+
exports.resolveCacheMemoryLimit = resolveCacheMemoryLimit;
|
|
160625
160625
|
exports.setBit = setBit;
|
|
160626
160626
|
exports.setBitFast = setBitFast;
|
|
160627
|
+
exports.setChunkedCookie = setChunkedCookie;
|
|
160627
160628
|
exports.setupTemplateEngine = setupTemplateEngine;
|
|
160628
160629
|
exports.sha256 = sha256;
|
|
160629
160630
|
exports.sleep = sleep$1;
|