@serve.zone/dcrouter 14.1.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/dist_serve/bundle.js +1 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.dcrouter.d.ts +26 -0
- package/dist_ts/classes.dcrouter.js +491 -58
- package/dist_ts/config/classes.reference-resolver.js +3 -1
- package/dist_ts/db/documents/classes.cached.email.d.ts +4 -2
- package/dist_ts/db/documents/classes.cached.email.js +25 -5
- package/dist_ts/http3/http3-route-augmentation.js +2 -1
- package/dist_ts/plugins.d.ts +4 -2
- package/dist_ts/plugins.js +5 -3
- package/dist_ts_migrations/index.js +2 -2
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/network/ops-view-sourceprofiles.js +2 -1
- package/package.json +5 -4
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.dcrouter.ts +592 -60
- package/ts/config/classes.reference-resolver.ts +1 -0
- package/ts/db/documents/classes.cached.email.ts +31 -5
- package/ts/http3/http3-route-augmentation.ts +1 -0
- package/ts/plugins.ts +4 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/network/ops-view-sourceprofiles.ts +1 -0
|
@@ -479,6 +479,7 @@ export class ReferenceResolver {
|
|
|
479
479
|
if (override.basicAuth !== undefined) merged.basicAuth = override.basicAuth;
|
|
480
480
|
if (override.jwtAuth !== undefined) merged.jwtAuth = override.jwtAuth;
|
|
481
481
|
if (override.vpn !== undefined) merged.vpn = override.vpn;
|
|
482
|
+
if (override.challenge !== undefined) merged.challenge = override.challenge;
|
|
482
483
|
|
|
483
484
|
return merged;
|
|
484
485
|
}
|
|
@@ -6,7 +6,7 @@ const TTL = plugins.smartdata.smartdataTtlValues;
|
|
|
6
6
|
/**
|
|
7
7
|
* Email status in the cache
|
|
8
8
|
*/
|
|
9
|
-
export type TCachedEmailStatus = 'pending' | 'processing' | 'delivered' | 'failed' | 'deferred';
|
|
9
|
+
export type TCachedEmailStatus = 'pending' | 'processing' | 'queued' | 'delivered' | 'failed' | 'deferred';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Helper to get the smartdata database instance
|
|
@@ -169,12 +169,38 @@ export class CachedEmail extends plugins.smartdata.SmartdataCachedDocument<Cache
|
|
|
169
169
|
/**
|
|
170
170
|
* Find all emails pending delivery (status = pending and nextAttempt <= now)
|
|
171
171
|
*/
|
|
172
|
-
public static async findPendingForDelivery(): Promise<CachedEmail[]> {
|
|
172
|
+
public static async findPendingForDelivery(limit = 25): Promise<CachedEmail[]> {
|
|
173
173
|
const now = new Date();
|
|
174
|
-
return await CachedEmail.
|
|
175
|
-
status: 'pending',
|
|
174
|
+
return await CachedEmail.findLimited({
|
|
175
|
+
status: { $in: ['pending', 'deferred', 'processing'] },
|
|
176
176
|
nextAttempt: { $lte: now },
|
|
177
|
-
});
|
|
177
|
+
}, limit);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public static async findQueuedForRecovery(limit = 25): Promise<CachedEmail[]> {
|
|
181
|
+
return await CachedEmail.findLimited({
|
|
182
|
+
status: 'queued',
|
|
183
|
+
}, limit);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
private static async findLimited(filter: Record<string, any>, limit: number): Promise<CachedEmail[]> {
|
|
187
|
+
const safeLimit = Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : 25;
|
|
188
|
+
if (safeLimit === 0) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
const collection = (CachedEmail as typeof CachedEmail & {
|
|
192
|
+
collection: plugins.smartdata.SmartdataCollection<CachedEmail>;
|
|
193
|
+
}).collection;
|
|
194
|
+
const cursor = await collection.getCursor(
|
|
195
|
+
filter,
|
|
196
|
+
CachedEmail as unknown as typeof plugins.smartdata.SmartDataDbDoc,
|
|
197
|
+
);
|
|
198
|
+
cursor.mongodbCursor.limit(safeLimit);
|
|
199
|
+
try {
|
|
200
|
+
return await cursor.toArray();
|
|
201
|
+
} finally {
|
|
202
|
+
await cursor.close();
|
|
203
|
+
}
|
|
178
204
|
}
|
|
179
205
|
|
|
180
206
|
/**
|
package/ts/plugins.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as fs from 'node:fs';
|
|
|
4
4
|
import * as crypto from 'node:crypto';
|
|
5
5
|
import * as http from 'node:http';
|
|
6
6
|
import * as net from 'node:net';
|
|
7
|
+
import * as buffer from 'node:buffer';
|
|
7
8
|
import * as os from 'node:os';
|
|
8
9
|
import * as path from 'node:path';
|
|
9
10
|
import * as tls from 'node:tls';
|
|
@@ -15,6 +16,7 @@ export {
|
|
|
15
16
|
crypto,
|
|
16
17
|
http,
|
|
17
18
|
net,
|
|
19
|
+
buffer,
|
|
18
20
|
os,
|
|
19
21
|
path,
|
|
20
22
|
tls,
|
|
@@ -52,6 +54,7 @@ export {
|
|
|
52
54
|
import * as projectinfo from '@push.rocks/projectinfo';
|
|
53
55
|
import * as qenv from '@push.rocks/qenv';
|
|
54
56
|
import * as smartacme from '@push.rocks/smartacme';
|
|
57
|
+
import * as smartchallenge from '@push.rocks/smartchallenge';
|
|
55
58
|
import * as smartdata from '@push.rocks/smartdata';
|
|
56
59
|
import * as smartdns from '@push.rocks/smartdns';
|
|
57
60
|
import * as smartfs from '@push.rocks/smartfs';
|
|
@@ -72,7 +75,7 @@ import * as smartrx from '@push.rocks/smartrx';
|
|
|
72
75
|
import * as smartunique from '@push.rocks/smartunique';
|
|
73
76
|
import * as taskbuffer from '@push.rocks/taskbuffer';
|
|
74
77
|
|
|
75
|
-
export { projectinfo, qenv, smartacme, smartdata, smartdns, smartfs, smartguard, smartjwt, smartlog, smartmetrics, smartdb, smartmta, smartnetwork, smartpath, smartproxy, smartpromise, smartradius, smartrequest, smartrx, smartunique, smartvpn, taskbuffer };
|
|
78
|
+
export { projectinfo, qenv, smartacme, smartchallenge, smartdata, smartdns, smartfs, smartguard, smartjwt, smartlog, smartmetrics, smartdb, smartmta, smartnetwork, smartpath, smartproxy, smartpromise, smartradius, smartrequest, smartrx, smartunique, smartvpn, taskbuffer };
|
|
76
79
|
|
|
77
80
|
// Define SmartLog types for use in error handling
|
|
78
81
|
export type TLogLevel = 'error' | 'warn' | 'info' | 'success' | 'debug';
|
|
@@ -240,6 +240,7 @@ export class OpsViewSourceProfiles extends DeesElement {
|
|
|
240
240
|
ipBlockList,
|
|
241
241
|
...(maxConnections ? { maxConnections } : {}),
|
|
242
242
|
...(rateLimit ? { rateLimit } : {}),
|
|
243
|
+
...(profile.security?.challenge ? { challenge: profile.security.challenge } : {}),
|
|
243
244
|
},
|
|
244
245
|
});
|
|
245
246
|
modalArg.destroy();
|