@zintrust/core 0.1.24 → 0.1.25
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/package.json +4 -3
- package/src/auth/Auth.d.ts.map +1 -0
- package/src/boot/Application.d.ts.map +1 -1
- package/src/boot/Application.js +8 -0
- package/src/boot/bootstrap.js +34 -15
- package/src/cache/drivers/RedisDriver.d.ts.map +1 -1
- package/src/cache/drivers/RedisDriver.js +10 -5
- package/src/cli/CLI.d.ts.map +1 -1
- package/src/cli/CLI.js +6 -0
- package/src/cli/commands/QueueCommand.d.ts.map +1 -1
- package/src/cli/commands/QueueCommand.js +89 -39
- package/src/cli/commands/QueueLockCommand.d.ts +7 -0
- package/src/cli/commands/QueueLockCommand.d.ts.map +1 -0
- package/src/cli/commands/QueueLockCommand.js +138 -0
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +15 -3
- package/src/cli/commands/TemplatesCommand.js +1 -1
- package/src/cli/commands/WorkerCommands.d.ts.map +1 -1
- package/src/cli/commands/WorkerCommands.js +46 -22
- package/src/cli/scaffolding/ProjectScaffolder.js +2 -2
- package/src/cli/scaffolding/RouteGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/RouteGenerator.js +27 -28
- package/src/cli/services/VersionChecker.d.ts +53 -0
- package/src/cli/services/VersionChecker.d.ts.map +1 -0
- package/src/cli/services/VersionChecker.js +176 -0
- package/src/cli/workers/QueueWorkRunner.d.ts.map +1 -1
- package/src/cli/workers/QueueWorkRunner.js +128 -7
- package/src/common/ExternalServiceUtils.d.ts +2 -2
- package/src/config/app.d.ts +4 -0
- package/src/config/app.d.ts.map +1 -1
- package/src/config/app.js +9 -0
- package/src/config/constants.d.ts +140 -10
- package/src/config/constants.d.ts.map +1 -1
- package/src/config/constants.js +86 -5
- package/src/config/index.d.ts +1 -0
- package/src/config/index.d.ts.map +1 -1
- package/src/config/middleware.d.ts +6 -6
- package/src/config/middleware.d.ts.map +1 -1
- package/src/config/middleware.js +6 -7
- package/src/config/queue.d.ts +4 -0
- package/src/config/queue.d.ts.map +1 -1
- package/src/config/queue.js +1 -1
- package/src/config/redis.d.ts +17 -0
- package/src/config/redis.d.ts.map +1 -0
- package/src/config/redis.js +54 -0
- package/src/config/type.d.ts +3 -0
- package/src/config/type.d.ts.map +1 -1
- package/src/http/Request.d.ts +10 -1
- package/src/http/Request.d.ts.map +1 -1
- package/src/http/Request.js +79 -7
- package/src/http/error-pages/ErrorPageRenderer.d.ts.map +1 -1
- package/src/http/error-pages/ErrorPageRenderer.js +4 -3
- package/src/index.d.ts +14 -11
- package/src/index.d.ts.map +1 -1
- package/src/index.js +18 -11
- package/src/lang/lang.d.ts +23 -0
- package/src/lang/lang.d.ts.map +1 -0
- package/src/lang/lang.js +22 -0
- package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -1
- package/src/middleware/ErrorHandlerMiddleware.js +9 -1
- package/src/migrations/schema/SchemaCompiler.js +1 -1
- package/src/migrations/schema/types.d.ts +1 -1
- package/src/migrations/schema/types.d.ts.map +1 -1
- package/src/node.d.ts +1 -1
- package/src/node.d.ts.map +1 -1
- package/src/node.js +1 -1
- package/src/orm/Database.d.ts +1 -1
- package/src/orm/Database.d.ts.map +1 -1
- package/src/orm/Database.js +22 -3
- package/src/performance/Optimizer.js +1 -1
- package/src/routing/Router.d.ts +6 -2
- package/src/routing/Router.d.ts.map +1 -1
- package/src/routing/Router.js +19 -4
- package/src/runtime/PluginManager.js +1 -1
- package/src/runtime/PluginRegistry.js +2 -2
- package/src/start.d.ts.map +1 -1
- package/src/start.js +8 -7
- package/src/templates/TemplateRegistry.js +2 -2
- package/src/templates/TemplateRegistry.ts +2 -2
- package/src/templates/feature/Queue.ts.tpl +114 -0
- package/src/templates/project/basic/app/Controllers/UserController.ts.tpl +22 -0
- package/src/templates/project/basic/config/queue.ts.tpl +19 -0
- package/src/templates/project/basic/package.json.tpl +2 -1
- package/src/templates/project/basic/src/index.ts.tpl +0 -3
- package/src/tools/broadcast/drivers/Redis.d.ts.map +1 -1
- package/src/tools/broadcast/drivers/Redis.js +8 -56
- package/src/tools/mail/Mail.d.ts +1 -29
- package/src/tools/mail/Mail.d.ts.map +1 -1
- package/src/tools/mail/Mail.js +1 -111
- package/src/tools/mail/drivers/SendGrid.d.ts.map +1 -1
- package/src/tools/mail/drivers/SendGrid.js +4 -3
- package/src/tools/mail/drivers/Smtp.d.ts.map +1 -1
- package/src/tools/mail/drivers/Smtp.js +32 -10
- package/src/tools/mail/index.d.ts +40 -0
- package/src/tools/mail/index.d.ts.map +1 -0
- package/src/tools/mail/index.js +129 -0
- package/src/tools/mail/template-loader.d.ts +10 -0
- package/src/tools/mail/template-loader.d.ts.map +1 -0
- package/src/tools/mail/template-loader.js +101 -0
- package/src/tools/mail/template-utils.d.ts +10 -0
- package/src/tools/mail/template-utils.d.ts.map +1 -0
- package/src/tools/mail/template-utils.js +16 -0
- package/src/tools/mail/templates/index.d.ts +30 -0
- package/src/tools/mail/templates/index.d.ts.map +1 -1
- package/src/tools/mail/templates/index.js +69 -0
- package/src/tools/queue/AdvancedQueue.d.ts +19 -0
- package/src/tools/queue/AdvancedQueue.d.ts.map +1 -0
- package/src/tools/queue/AdvancedQueue.js +352 -0
- package/src/tools/queue/DeduplicationBuilder.d.ts +20 -0
- package/src/tools/queue/DeduplicationBuilder.d.ts.map +1 -0
- package/src/tools/queue/DeduplicationBuilder.js +77 -0
- package/src/tools/queue/LockProvider.d.ts +25 -0
- package/src/tools/queue/LockProvider.d.ts.map +1 -0
- package/src/tools/queue/LockProvider.js +276 -0
- package/src/tools/queue/Queue.d.ts.map +1 -1
- package/src/tools/queue/Queue.js +2 -1
- package/src/tools/queue/QueueExtensions.d.ts +46 -0
- package/src/tools/queue/QueueExtensions.d.ts.map +1 -0
- package/src/tools/queue/QueueExtensions.js +129 -0
- package/src/tools/queue/QueueRuntimeRegistration.d.ts.map +1 -1
- package/src/tools/queue/QueueRuntimeRegistration.js +2 -2
- package/src/tools/queue/drivers/Database.d.ts +23 -0
- package/src/tools/queue/drivers/Database.d.ts.map +1 -0
- package/src/tools/queue/drivers/Database.js +123 -0
- package/src/tools/queue/drivers/Redis.d.ts.map +1 -1
- package/src/tools/queue/drivers/Redis.js +11 -82
- package/src/tools/queue/index.d.ts +9 -0
- package/src/tools/queue/index.d.ts.map +1 -0
- package/src/tools/queue/index.js +7 -0
- package/src/tools/redis/RedisKeyManager.d.ts +64 -0
- package/src/tools/redis/RedisKeyManager.d.ts.map +1 -0
- package/src/tools/redis/RedisKeyManager.js +124 -0
- package/src/types/Queue.d.ts +62 -0
- package/src/types/Queue.d.ts.map +1 -0
- package/src/types/Queue.js +5 -0
- package/src/features/Auth.d.ts.map +0 -1
- package/src/features/Queue.d.ts +0 -21
- package/src/features/Queue.d.ts.map +0 -1
- package/src/features/Queue.js +0 -33
- package/src/templates/features/Queue.ts.tpl +0 -47
- package/src/tools/mail/templates/markdown/index.d.ts +0 -17
- package/src/tools/mail/templates/markdown/index.d.ts.map +0 -1
- package/src/tools/mail/templates/markdown/index.js +0 -49
- package/src/tools/mail/templates/markdown/registry.d.ts +0 -15
- package/src/tools/mail/templates/markdown/registry.d.ts.map +0 -1
- package/src/tools/mail/templates/markdown/registry.js +0 -34
- package/src/tools/mail/templates/markdown/validator.d.ts +0 -16
- package/src/tools/mail/templates/markdown/validator.d.ts.map +0 -1
- package/src/tools/mail/templates/markdown/validator.js +0 -24
- /package/src/{features → auth}/Auth.d.ts +0 -0
- /package/src/{features → auth}/Auth.js +0 -0
- /package/src/templates/{features → auth}/Auth.ts.tpl +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Broadcast } from '../../tools/broadcast/Broadcast.js';
|
|
2
|
+
import { Env } from '../../config/env.js';
|
|
2
3
|
import { Logger } from '../../config/logger.js';
|
|
3
4
|
import { queueConfig } from '../../config/queue.js';
|
|
4
5
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
6
|
+
import { ZintrustLang } from '../../lang/lang.js';
|
|
5
7
|
import { Notification } from '../../tools/notification/Notification.js';
|
|
8
|
+
import { createLockProvider, getLockProvider, registerLockProvider } from '../../tools/queue/LockProvider.js';
|
|
6
9
|
import { Queue } from '../../tools/queue/Queue.js';
|
|
7
10
|
import { registerQueuesFromRuntimeConfig } from '../../tools/queue/QueueRuntimeRegistration.js';
|
|
8
11
|
const isKind = (value) => value === 'broadcast' || value === 'notification';
|
|
@@ -44,9 +47,119 @@ const shouldStop = (startedAtMs, timeoutSeconds) => {
|
|
|
44
47
|
const elapsedMs = Date.now() - startedAtMs;
|
|
45
48
|
return elapsedMs >= timeoutSeconds * 1000;
|
|
46
49
|
};
|
|
50
|
+
const QUEUE_META_KEY = '__zintrustQueueMeta';
|
|
51
|
+
let lockProviderCache = null;
|
|
52
|
+
const getLockProviderForQueue = () => {
|
|
53
|
+
if (lockProviderCache)
|
|
54
|
+
return lockProviderCache;
|
|
55
|
+
const providerName = Env.get('QUEUE_LOCK_PROVIDER', ZintrustLang.REDIS).trim();
|
|
56
|
+
const prefix = Env.get('QUEUE_LOCK_PREFIX', ZintrustLang.ZINTRUST_LOCKS_PREFIX).trim();
|
|
57
|
+
const defaultTtl = Env.getInt('QUEUE_DEFAULT_DEDUP_TTL', ZintrustLang.ZINTRUST_LOCKS_TTL);
|
|
58
|
+
const existing = getLockProvider(providerName);
|
|
59
|
+
if (existing) {
|
|
60
|
+
lockProviderCache = existing;
|
|
61
|
+
return existing;
|
|
62
|
+
}
|
|
63
|
+
const provider = createLockProvider({
|
|
64
|
+
type: providerName === ZintrustLang.REDIS ? ZintrustLang.REDIS : ZintrustLang.MEMORY,
|
|
65
|
+
prefix: prefix.length > 0 ? prefix : ZintrustLang.ZINTRUST_LOCKS_PREFIX,
|
|
66
|
+
defaultTtl,
|
|
67
|
+
});
|
|
68
|
+
registerLockProvider(providerName, provider);
|
|
69
|
+
lockProviderCache = provider;
|
|
70
|
+
return provider;
|
|
71
|
+
};
|
|
72
|
+
const extractQueueMeta = (payload) => {
|
|
73
|
+
const metaValue = payload[QUEUE_META_KEY];
|
|
74
|
+
if (metaValue !== undefined && metaValue !== null && typeof metaValue === 'object') {
|
|
75
|
+
const { [QUEUE_META_KEY]: metaRaw, ...rest } = payload;
|
|
76
|
+
return { payload: rest, meta: metaRaw };
|
|
77
|
+
}
|
|
78
|
+
return { payload, meta: undefined };
|
|
79
|
+
};
|
|
80
|
+
const resolveConditionStatus = (condition) => {
|
|
81
|
+
const normalized = condition.trim().toLowerCase();
|
|
82
|
+
if (normalized.includes('failed') || normalized.includes('error'))
|
|
83
|
+
return 'failed';
|
|
84
|
+
if (normalized.includes('success') || normalized.includes('completed'))
|
|
85
|
+
return 'success';
|
|
86
|
+
// Try to extract explicit comparison like: job.result.status === "completed"
|
|
87
|
+
const match = new RegExp(/status\s*={1,3}\s*['"]([a-z]+)['"]/).exec(normalized);
|
|
88
|
+
const capturedValue = match?.[1];
|
|
89
|
+
if (capturedValue !== null && capturedValue !== undefined && capturedValue.length > 0) {
|
|
90
|
+
const value = capturedValue;
|
|
91
|
+
if (value === 'failed' || value === 'error')
|
|
92
|
+
return 'failed';
|
|
93
|
+
if (value === 'success' || value === 'completed')
|
|
94
|
+
return 'success';
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
const shouldReleaseForOutcome = (releaseAfter, outcome) => {
|
|
99
|
+
if (releaseAfter === 'success')
|
|
100
|
+
return outcome === 'success';
|
|
101
|
+
if (releaseAfter === 'failed')
|
|
102
|
+
return outcome === 'failed';
|
|
103
|
+
if (typeof releaseAfter === 'string') {
|
|
104
|
+
const normalized = releaseAfter.toLowerCase();
|
|
105
|
+
if (normalized.includes('failed') || normalized.includes('error'))
|
|
106
|
+
return outcome === 'failed';
|
|
107
|
+
if (normalized.includes('success') || normalized.includes('completed'))
|
|
108
|
+
return outcome === 'success';
|
|
109
|
+
const fromCondition = resolveConditionStatus(normalized);
|
|
110
|
+
return fromCondition !== null && fromCondition === outcome;
|
|
111
|
+
}
|
|
112
|
+
if (releaseAfter !== null && releaseAfter !== undefined && typeof releaseAfter === 'object') {
|
|
113
|
+
const condition = String(releaseAfter.condition ?? '').toLowerCase();
|
|
114
|
+
const fromCondition = resolveConditionStatus(condition);
|
|
115
|
+
return fromCondition !== null && fromCondition === outcome;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
};
|
|
119
|
+
const releaseLockAfterResult = async (meta, outcome) => {
|
|
120
|
+
if (meta === undefined)
|
|
121
|
+
return;
|
|
122
|
+
const deduplicationId = meta.deduplicationId;
|
|
123
|
+
if (deduplicationId === undefined || deduplicationId === null) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const deduplicationKey = String(deduplicationId).trim();
|
|
127
|
+
if (deduplicationKey === '')
|
|
128
|
+
return;
|
|
129
|
+
const releaseAfter = meta.releaseAfter;
|
|
130
|
+
if (releaseAfter === undefined || releaseAfter === null || releaseAfter === '')
|
|
131
|
+
return;
|
|
132
|
+
if (!shouldReleaseForOutcome(releaseAfter, outcome))
|
|
133
|
+
return;
|
|
134
|
+
const provider = getLockProviderForQueue();
|
|
135
|
+
const doRelease = async () => {
|
|
136
|
+
const status = await provider.status(deduplicationKey);
|
|
137
|
+
if (!status.exists)
|
|
138
|
+
return;
|
|
139
|
+
await provider.release({
|
|
140
|
+
key: deduplicationKey,
|
|
141
|
+
ttl: status.ttl ?? 0,
|
|
142
|
+
acquired: true,
|
|
143
|
+
expires: status.expires ?? new Date(),
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const delay = typeof releaseAfter === 'object' && typeof releaseAfter.delay === 'number'
|
|
147
|
+
? releaseAfter.delay
|
|
148
|
+
: 0;
|
|
149
|
+
if (delay > 0) {
|
|
150
|
+
const timeoutId = globalThis.setTimeout(() => {
|
|
151
|
+
void doRelease();
|
|
152
|
+
}, delay);
|
|
153
|
+
timeoutId.unref();
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
await doRelease();
|
|
157
|
+
}
|
|
158
|
+
};
|
|
47
159
|
const processMessage = async (options, msg, maxAttempts, result) => {
|
|
48
160
|
const payload = msg.payload ?? {};
|
|
49
|
-
const
|
|
161
|
+
const { payload: payloadWithoutMeta, meta } = extractQueueMeta(payload);
|
|
162
|
+
const kind = options.kind ?? detectKindFromPayload(payloadWithoutMeta);
|
|
50
163
|
if (kind === undefined) {
|
|
51
164
|
Logger.warn('Queue worker: unknown job payload; dropping', {
|
|
52
165
|
queue: options.queueName,
|
|
@@ -57,24 +170,28 @@ const processMessage = async (options, msg, maxAttempts, result) => {
|
|
|
57
170
|
await Queue.ack(options.queueName, msg.id, options.driverName);
|
|
58
171
|
return 'continue';
|
|
59
172
|
}
|
|
60
|
-
const timestamp = getTimestamp(
|
|
173
|
+
const timestamp = getTimestamp(payloadWithoutMeta);
|
|
61
174
|
if (typeof timestamp === 'number' && timestamp > Date.now()) {
|
|
62
175
|
// Not due yet: re-enqueue and stop after rotating the head once.
|
|
63
|
-
|
|
176
|
+
const payloadForRequeue = meta
|
|
177
|
+
? { ...payloadWithoutMeta, [QUEUE_META_KEY]: meta }
|
|
178
|
+
: payloadWithoutMeta;
|
|
179
|
+
await Queue.enqueue(options.queueName, payloadForRequeue, options.driverName);
|
|
64
180
|
await Queue.ack(options.queueName, msg.id, options.driverName);
|
|
65
181
|
result.notDueRequeued++;
|
|
66
182
|
return 'break';
|
|
67
183
|
}
|
|
68
|
-
const attempts = getAttempts(
|
|
184
|
+
const attempts = getAttempts(payloadWithoutMeta);
|
|
69
185
|
try {
|
|
70
186
|
if (kind === 'broadcast') {
|
|
71
|
-
const job =
|
|
187
|
+
const job = payloadWithoutMeta;
|
|
72
188
|
await Broadcast.send(job.channel, job.event, job.data);
|
|
73
189
|
}
|
|
74
190
|
else {
|
|
75
|
-
const job =
|
|
191
|
+
const job = payloadWithoutMeta;
|
|
76
192
|
await Notification.send(job.recipient, job.message, job.options ?? {});
|
|
77
193
|
}
|
|
194
|
+
await releaseLockAfterResult(meta, 'success');
|
|
78
195
|
await Queue.ack(options.queueName, msg.id, options.driverName);
|
|
79
196
|
result.processed++;
|
|
80
197
|
return 'continue';
|
|
@@ -91,10 +208,14 @@ const processMessage = async (options, msg, maxAttempts, result) => {
|
|
|
91
208
|
error,
|
|
92
209
|
});
|
|
93
210
|
if (canRetry) {
|
|
94
|
-
|
|
211
|
+
const payloadForRetry = meta
|
|
212
|
+
? { ...payloadWithoutMeta, [QUEUE_META_KEY]: meta }
|
|
213
|
+
: payloadWithoutMeta;
|
|
214
|
+
await Queue.enqueue(options.queueName, withAttempts(payloadForRetry, nextAttempts), options.driverName);
|
|
95
215
|
result.retried++;
|
|
96
216
|
}
|
|
97
217
|
else {
|
|
218
|
+
await releaseLockAfterResult(meta, 'failed');
|
|
98
219
|
result.dropped++;
|
|
99
220
|
}
|
|
100
221
|
await Queue.ack(options.queueName, msg.id, options.driverName);
|
|
@@ -47,7 +47,7 @@ export declare const HealthUtils: {
|
|
|
47
47
|
* Build health response
|
|
48
48
|
*/
|
|
49
49
|
buildHealthResponse(status: "healthy" | "unhealthy" | "alive" | "ready" | "not_ready", environment: string, extra?: Record<string, unknown>): {
|
|
50
|
-
status: "
|
|
50
|
+
status: "ready" | "unhealthy" | "healthy" | "alive" | "not_ready";
|
|
51
51
|
timestamp: string;
|
|
52
52
|
environment: string;
|
|
53
53
|
};
|
|
@@ -55,7 +55,7 @@ export declare const HealthUtils: {
|
|
|
55
55
|
* Build error health response
|
|
56
56
|
*/
|
|
57
57
|
buildErrorResponse(status: "unhealthy" | "not_ready", environment: string, error: Error, extra?: Record<string, unknown>): {
|
|
58
|
-
status: "
|
|
58
|
+
status: "ready" | "unhealthy" | "healthy" | "alive" | "not_ready";
|
|
59
59
|
timestamp: string;
|
|
60
60
|
environment: string;
|
|
61
61
|
};
|
package/src/config/app.d.ts
CHANGED
package/src/config/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/config/app.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,cAAc,CAAC;AAoI3D,QAAA,MAAM,UAAU,QAAO,MAAM,CAAC,UAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/config/app.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,cAAc,CAAC;AAoI3D,QAAA,MAAM,UAAU,QAAO,MAAM,CAAC,UAA2B,CAAC;AAsF1D,eAAO,MAAM,SAAS;IAtEpB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;kCACc,OAAO;IAIxB;;OAEG;iCACa,OAAO;IAIvB;;OAEG;8BACU,OAAO;IAIpB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;+BA/EkB,MAAM,CAAC,UAAU;kCAhDd,MAAM;EAsIoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC"}
|
package/src/config/app.js
CHANGED
|
@@ -117,11 +117,20 @@ const normalizeMode = () => {
|
|
|
117
117
|
return 'testing';
|
|
118
118
|
return 'development';
|
|
119
119
|
};
|
|
120
|
+
const Prefix = () => {
|
|
121
|
+
const app_name = (Env.APP_NAME || 'zintrust').toLowerCase().replaceAll(/\s/g, '_');
|
|
122
|
+
const env = Env.NODE_ENV;
|
|
123
|
+
return `${app_name}_zintrust_${env}`;
|
|
124
|
+
};
|
|
120
125
|
const appConfigObj = {
|
|
121
126
|
/**
|
|
122
127
|
* Application name
|
|
123
128
|
*/
|
|
124
129
|
name: readEnvString('APP_NAME', Env.APP_NAME),
|
|
130
|
+
/**
|
|
131
|
+
* Application prefix
|
|
132
|
+
*/
|
|
133
|
+
prefix: Prefix(),
|
|
125
134
|
/**
|
|
126
135
|
* Application environment
|
|
127
136
|
*/
|
|
@@ -23,16 +23,81 @@ declare const MIME_TYPES: {
|
|
|
23
23
|
readonly JS: "text/javascript";
|
|
24
24
|
readonly CSS: "text/css";
|
|
25
25
|
readonly PNG: "image/png";
|
|
26
|
-
readonly JPG: "image/
|
|
26
|
+
readonly JPG: "image/jpeg";
|
|
27
|
+
readonly JPEG: "image/jpeg";
|
|
27
28
|
readonly GIF: "image/gif";
|
|
29
|
+
readonly ICO: "image/x-icon";
|
|
28
30
|
readonly SVG: "image/svg+xml";
|
|
29
|
-
readonly
|
|
31
|
+
readonly WEBP: "image/webp";
|
|
32
|
+
readonly AVIF: "image/avif";
|
|
33
|
+
readonly HEIC: "image/heic";
|
|
34
|
+
readonly HEIF: "image/heif";
|
|
35
|
+
readonly BMP: "image/bmp";
|
|
36
|
+
readonly TIFF: "image/tiff";
|
|
30
37
|
readonly MP4: "video/mp4";
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
38
|
+
readonly WEBM: "video/webm";
|
|
39
|
+
readonly OGG: "video/ogg";
|
|
40
|
+
readonly AVI: "video/x-msvideo";
|
|
41
|
+
readonly MOV: "video/quicktime";
|
|
42
|
+
readonly WMV: "video/x-ms-wmv";
|
|
43
|
+
readonly FLV: "video/x-flv";
|
|
44
|
+
readonly MKV: "video/x-matroska";
|
|
45
|
+
readonly M4V: "video/x-m4v";
|
|
46
|
+
readonly WAV: "audio/wav";
|
|
47
|
+
readonly MP3: "audio/mpeg";
|
|
48
|
+
readonly OGA: "audio/ogg";
|
|
49
|
+
readonly FLAC: "audio/flac";
|
|
50
|
+
readonly AAC: "audio/aac";
|
|
51
|
+
readonly M4A: "audio/mp4";
|
|
52
|
+
readonly WMA: "audio/x-ms-wma";
|
|
53
|
+
readonly WOFF: "font/woff";
|
|
54
|
+
readonly WOFF2: "font/woff2";
|
|
55
|
+
readonly TTF: "font/ttf";
|
|
56
|
+
readonly OTF: "font/otf";
|
|
33
57
|
readonly EOT: "application/vnd.ms-fontobject";
|
|
34
|
-
readonly
|
|
58
|
+
readonly PDF: "application/pdf";
|
|
59
|
+
readonly DOC: "application/msword";
|
|
60
|
+
readonly DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
61
|
+
readonly XLS: "application/vnd.ms-excel";
|
|
62
|
+
readonly XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
63
|
+
readonly PPT: "application/vnd.ms-powerpoint";
|
|
64
|
+
readonly PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
65
|
+
readonly ODT: "application/vnd.oasis.opendocument.text";
|
|
66
|
+
readonly ODS: "application/vnd.oasis.opendocument.spreadsheet";
|
|
67
|
+
readonly ODP: "application/vnd.oasis.opendocument.presentation";
|
|
68
|
+
readonly ZIP: "application/zip";
|
|
69
|
+
readonly RAR: "application/x-rar-compressed";
|
|
70
|
+
readonly TAR: "application/x-tar";
|
|
71
|
+
readonly GZIP: "application/gzip";
|
|
72
|
+
readonly SEVEN_Z: "application/x-7z-compressed";
|
|
73
|
+
readonly PLIST: "application/x-plist";
|
|
74
|
+
readonly IPA: "application/octet-stream";
|
|
75
|
+
readonly MOBILECONFIG: "application/x-apple-aspen-config";
|
|
76
|
+
readonly APK: "application/vnd.android.package-archive";
|
|
77
|
+
readonly AAB: "application/x-authorware-bin";
|
|
78
|
+
readonly MANIFEST: "application/manifest+json";
|
|
79
|
+
readonly WEBAPP: "application/x-web-app-manifest+json";
|
|
80
|
+
readonly XML: "application/xml";
|
|
81
|
+
readonly YAML: "application/x-yaml";
|
|
82
|
+
readonly CSV: "text/csv";
|
|
83
|
+
readonly RTF: "application/rtf";
|
|
35
84
|
readonly WASM: "application/wasm";
|
|
85
|
+
readonly EXE: "application/x-msdownload";
|
|
86
|
+
readonly DMG: "application/x-apple-diskimage";
|
|
87
|
+
readonly XHTML: "application/xhtml+xml";
|
|
88
|
+
readonly ATOM: "application/atom+xml";
|
|
89
|
+
readonly RSS: "application/rss+xml";
|
|
90
|
+
readonly PEM: "application/x-pem-file";
|
|
91
|
+
readonly P12: "application/x-pkcs12";
|
|
92
|
+
readonly PFX: "application/x-pkcs12";
|
|
93
|
+
readonly CRT: "application/x-x509-ca-cert";
|
|
94
|
+
readonly CER: "application/x-x509-ca-cert";
|
|
95
|
+
readonly SQLITE: "application/x-sqlite3";
|
|
96
|
+
readonly GLTF: "model/gltf+json";
|
|
97
|
+
readonly GLB: "model/gltf-binary";
|
|
98
|
+
readonly OBJ: "model/obj";
|
|
99
|
+
readonly CUR: "image/x-icon";
|
|
100
|
+
readonly ANI: "application/x-navi-animation";
|
|
36
101
|
};
|
|
37
102
|
declare const ENV_KEYS: {
|
|
38
103
|
readonly NODE_ENV: "NODE_ENV";
|
|
@@ -75,16 +140,81 @@ export declare const Constants: Readonly<{
|
|
|
75
140
|
readonly JS: "text/javascript";
|
|
76
141
|
readonly CSS: "text/css";
|
|
77
142
|
readonly PNG: "image/png";
|
|
78
|
-
readonly JPG: "image/
|
|
143
|
+
readonly JPG: "image/jpeg";
|
|
144
|
+
readonly JPEG: "image/jpeg";
|
|
79
145
|
readonly GIF: "image/gif";
|
|
146
|
+
readonly ICO: "image/x-icon";
|
|
80
147
|
readonly SVG: "image/svg+xml";
|
|
81
|
-
readonly
|
|
148
|
+
readonly WEBP: "image/webp";
|
|
149
|
+
readonly AVIF: "image/avif";
|
|
150
|
+
readonly HEIC: "image/heic";
|
|
151
|
+
readonly HEIF: "image/heif";
|
|
152
|
+
readonly BMP: "image/bmp";
|
|
153
|
+
readonly TIFF: "image/tiff";
|
|
82
154
|
readonly MP4: "video/mp4";
|
|
83
|
-
readonly
|
|
84
|
-
readonly
|
|
155
|
+
readonly WEBM: "video/webm";
|
|
156
|
+
readonly OGG: "video/ogg";
|
|
157
|
+
readonly AVI: "video/x-msvideo";
|
|
158
|
+
readonly MOV: "video/quicktime";
|
|
159
|
+
readonly WMV: "video/x-ms-wmv";
|
|
160
|
+
readonly FLV: "video/x-flv";
|
|
161
|
+
readonly MKV: "video/x-matroska";
|
|
162
|
+
readonly M4V: "video/x-m4v";
|
|
163
|
+
readonly WAV: "audio/wav";
|
|
164
|
+
readonly MP3: "audio/mpeg";
|
|
165
|
+
readonly OGA: "audio/ogg";
|
|
166
|
+
readonly FLAC: "audio/flac";
|
|
167
|
+
readonly AAC: "audio/aac";
|
|
168
|
+
readonly M4A: "audio/mp4";
|
|
169
|
+
readonly WMA: "audio/x-ms-wma";
|
|
170
|
+
readonly WOFF: "font/woff";
|
|
171
|
+
readonly WOFF2: "font/woff2";
|
|
172
|
+
readonly TTF: "font/ttf";
|
|
173
|
+
readonly OTF: "font/otf";
|
|
85
174
|
readonly EOT: "application/vnd.ms-fontobject";
|
|
86
|
-
readonly
|
|
175
|
+
readonly PDF: "application/pdf";
|
|
176
|
+
readonly DOC: "application/msword";
|
|
177
|
+
readonly DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
178
|
+
readonly XLS: "application/vnd.ms-excel";
|
|
179
|
+
readonly XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
180
|
+
readonly PPT: "application/vnd.ms-powerpoint";
|
|
181
|
+
readonly PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
182
|
+
readonly ODT: "application/vnd.oasis.opendocument.text";
|
|
183
|
+
readonly ODS: "application/vnd.oasis.opendocument.spreadsheet";
|
|
184
|
+
readonly ODP: "application/vnd.oasis.opendocument.presentation";
|
|
185
|
+
readonly ZIP: "application/zip";
|
|
186
|
+
readonly RAR: "application/x-rar-compressed";
|
|
187
|
+
readonly TAR: "application/x-tar";
|
|
188
|
+
readonly GZIP: "application/gzip";
|
|
189
|
+
readonly SEVEN_Z: "application/x-7z-compressed";
|
|
190
|
+
readonly PLIST: "application/x-plist";
|
|
191
|
+
readonly IPA: "application/octet-stream";
|
|
192
|
+
readonly MOBILECONFIG: "application/x-apple-aspen-config";
|
|
193
|
+
readonly APK: "application/vnd.android.package-archive";
|
|
194
|
+
readonly AAB: "application/x-authorware-bin";
|
|
195
|
+
readonly MANIFEST: "application/manifest+json";
|
|
196
|
+
readonly WEBAPP: "application/x-web-app-manifest+json";
|
|
197
|
+
readonly XML: "application/xml";
|
|
198
|
+
readonly YAML: "application/x-yaml";
|
|
199
|
+
readonly CSV: "text/csv";
|
|
200
|
+
readonly RTF: "application/rtf";
|
|
87
201
|
readonly WASM: "application/wasm";
|
|
202
|
+
readonly EXE: "application/x-msdownload";
|
|
203
|
+
readonly DMG: "application/x-apple-diskimage";
|
|
204
|
+
readonly XHTML: "application/xhtml+xml";
|
|
205
|
+
readonly ATOM: "application/atom+xml";
|
|
206
|
+
readonly RSS: "application/rss+xml";
|
|
207
|
+
readonly PEM: "application/x-pem-file";
|
|
208
|
+
readonly P12: "application/x-pkcs12";
|
|
209
|
+
readonly PFX: "application/x-pkcs12";
|
|
210
|
+
readonly CRT: "application/x-x509-ca-cert";
|
|
211
|
+
readonly CER: "application/x-x509-ca-cert";
|
|
212
|
+
readonly SQLITE: "application/x-sqlite3";
|
|
213
|
+
readonly GLTF: "model/gltf+json";
|
|
214
|
+
readonly GLB: "model/gltf-binary";
|
|
215
|
+
readonly OBJ: "model/obj";
|
|
216
|
+
readonly CUR: "image/x-icon";
|
|
217
|
+
readonly ANI: "application/x-navi-animation";
|
|
88
218
|
};
|
|
89
219
|
ENV_KEYS: {
|
|
90
220
|
readonly NODE_ENV: "NODE_ENV";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAA,MAAM,YAAY;;;;;;;;;;;;CAYR,CAAC;AAEX,QAAA,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAA,MAAM,YAAY;;;;;;;;;;;;CAYR,CAAC;AAEX,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHN,CAAC;AAEX,QAAA,MAAM,QAAQ;;;;;;;;;;;CAWJ,CAAC;AAEX,QAAA,MAAM,QAAQ;;;;CAIJ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKpB,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/src/config/constants.js
CHANGED
|
@@ -22,17 +22,98 @@ const MIME_TYPES = {
|
|
|
22
22
|
TEXT: 'text/plain',
|
|
23
23
|
JS: 'text/javascript',
|
|
24
24
|
CSS: 'text/css',
|
|
25
|
+
// Images
|
|
25
26
|
PNG: 'image/png',
|
|
26
|
-
JPG: 'image/
|
|
27
|
+
JPG: 'image/jpeg',
|
|
28
|
+
JPEG: 'image/jpeg',
|
|
27
29
|
GIF: 'image/gif',
|
|
30
|
+
ICO: 'image/x-icon',
|
|
28
31
|
SVG: 'image/svg+xml',
|
|
29
|
-
|
|
32
|
+
WEBP: 'image/webp',
|
|
33
|
+
AVIF: 'image/avif',
|
|
34
|
+
HEIC: 'image/heic',
|
|
35
|
+
HEIF: 'image/heif',
|
|
36
|
+
BMP: 'image/bmp',
|
|
37
|
+
TIFF: 'image/tiff',
|
|
38
|
+
// Videos
|
|
30
39
|
MP4: 'video/mp4',
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
WEBM: 'video/webm',
|
|
41
|
+
OGG: 'video/ogg',
|
|
42
|
+
AVI: 'video/x-msvideo',
|
|
43
|
+
MOV: 'video/quicktime',
|
|
44
|
+
WMV: 'video/x-ms-wmv',
|
|
45
|
+
FLV: 'video/x-flv',
|
|
46
|
+
MKV: 'video/x-matroska',
|
|
47
|
+
M4V: 'video/x-m4v',
|
|
48
|
+
// Audio
|
|
49
|
+
WAV: 'audio/wav',
|
|
50
|
+
MP3: 'audio/mpeg',
|
|
51
|
+
OGA: 'audio/ogg',
|
|
52
|
+
FLAC: 'audio/flac',
|
|
53
|
+
AAC: 'audio/aac',
|
|
54
|
+
M4A: 'audio/mp4',
|
|
55
|
+
WMA: 'audio/x-ms-wma',
|
|
56
|
+
// Fonts
|
|
57
|
+
WOFF: 'font/woff',
|
|
58
|
+
WOFF2: 'font/woff2',
|
|
59
|
+
TTF: 'font/ttf',
|
|
60
|
+
OTF: 'font/otf',
|
|
33
61
|
EOT: 'application/vnd.ms-fontobject',
|
|
34
|
-
|
|
62
|
+
// Documents
|
|
63
|
+
PDF: 'application/pdf',
|
|
64
|
+
DOC: 'application/msword',
|
|
65
|
+
DOCX: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
66
|
+
XLS: 'application/vnd.ms-excel',
|
|
67
|
+
XLSX: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
68
|
+
PPT: 'application/vnd.ms-powerpoint',
|
|
69
|
+
PPTX: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
70
|
+
ODT: 'application/vnd.oasis.opendocument.text',
|
|
71
|
+
ODS: 'application/vnd.oasis.opendocument.spreadsheet',
|
|
72
|
+
ODP: 'application/vnd.oasis.opendocument.presentation',
|
|
73
|
+
// Archives
|
|
74
|
+
ZIP: 'application/zip',
|
|
75
|
+
RAR: 'application/x-rar-compressed',
|
|
76
|
+
TAR: 'application/x-tar',
|
|
77
|
+
GZIP: 'application/gzip',
|
|
78
|
+
SEVEN_Z: 'application/x-7z-compressed',
|
|
79
|
+
// iOS specific
|
|
80
|
+
PLIST: 'application/x-plist',
|
|
81
|
+
IPA: 'application/octet-stream',
|
|
82
|
+
MOBILECONFIG: 'application/x-apple-aspen-config',
|
|
83
|
+
// Android specific
|
|
84
|
+
APK: 'application/vnd.android.package-archive',
|
|
85
|
+
AAB: 'application/x-authorware-bin',
|
|
86
|
+
// Web/App Manifests
|
|
87
|
+
MANIFEST: 'application/manifest+json',
|
|
88
|
+
WEBAPP: 'application/x-web-app-manifest+json',
|
|
89
|
+
// API/Data formats
|
|
90
|
+
XML: 'application/xml',
|
|
91
|
+
YAML: 'application/x-yaml',
|
|
92
|
+
CSV: 'text/csv',
|
|
93
|
+
RTF: 'application/rtf',
|
|
94
|
+
// Binary/Executable
|
|
35
95
|
WASM: 'application/wasm',
|
|
96
|
+
EXE: 'application/x-msdownload',
|
|
97
|
+
DMG: 'application/x-apple-diskimage',
|
|
98
|
+
// Standards
|
|
99
|
+
XHTML: 'application/xhtml+xml',
|
|
100
|
+
ATOM: 'application/atom+xml',
|
|
101
|
+
RSS: 'application/rss+xml',
|
|
102
|
+
// Security/Certificates
|
|
103
|
+
PEM: 'application/x-pem-file',
|
|
104
|
+
P12: 'application/x-pkcs12',
|
|
105
|
+
PFX: 'application/x-pkcs12',
|
|
106
|
+
CRT: 'application/x-x509-ca-cert',
|
|
107
|
+
CER: 'application/x-x509-ca-cert',
|
|
108
|
+
// Database
|
|
109
|
+
SQLITE: 'application/x-sqlite3',
|
|
110
|
+
// 3D/VR
|
|
111
|
+
GLTF: 'model/gltf+json',
|
|
112
|
+
GLB: 'model/gltf-binary',
|
|
113
|
+
OBJ: 'model/obj',
|
|
114
|
+
// Other common formats
|
|
115
|
+
CUR: 'image/x-icon',
|
|
116
|
+
ANI: 'application/x-navi-animation',
|
|
36
117
|
};
|
|
37
118
|
const ENV_KEYS = {
|
|
38
119
|
NODE_ENV: 'NODE_ENV',
|
package/src/config/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { createRedisConnection } from './workers';
|
|
|
20
20
|
export declare const config: Readonly<{
|
|
21
21
|
readonly app: Readonly<{
|
|
22
22
|
readonly name: string;
|
|
23
|
+
readonly prefix: string;
|
|
23
24
|
readonly environment: import("./type").StartMode;
|
|
24
25
|
readonly port: number;
|
|
25
26
|
readonly host: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;8BAZc,CAAC;;;;;;;;;;;;;;;;;;;;2EAAC,CAAA;;;;;;;;;;;;;;;;;;;;8BAD2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAmBrD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;EAKA,CAAC;AAEZ,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { MiddlewareConfigType } from './type';
|
|
2
|
-
export declare
|
|
3
|
-
email
|
|
4
|
-
password
|
|
5
|
-
name
|
|
6
|
-
count
|
|
7
|
-
}
|
|
2
|
+
export declare const MiddlewareBody: {
|
|
3
|
+
readonly email: "email";
|
|
4
|
+
readonly password: "password";
|
|
5
|
+
readonly name: "name";
|
|
6
|
+
readonly count: "count";
|
|
7
|
+
};
|
|
8
8
|
export type MiddlewaresType = {
|
|
9
9
|
skipPaths: string[];
|
|
10
10
|
fillRateLimit: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/config/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA+DzD,
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/config/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA+DzD,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,aAAa,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,qBAAqB,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3E,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;EAiBuB,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AA0MxD,wBAAgB,sBAAsB,IAAI,oBAAoB,CAqB7D;AA0BD,eAAO,MAAM,gBAAgB,EAAE,oBAY7B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
package/src/config/middleware.js
CHANGED
|
@@ -12,13 +12,12 @@ import { ValidationMiddleware } from '../middleware/ValidationMiddleware.js';
|
|
|
12
12
|
import { StartupConfigFile, StartupConfigFileRegistry } from '../runtime/StartupConfigFileRegistry.js';
|
|
13
13
|
import { Sanitizer } from '../security/Sanitizer.js';
|
|
14
14
|
import { Schema } from '../validation/Validator.js';
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})(MiddlewareBody || (MiddlewareBody = {}));
|
|
15
|
+
export const MiddlewareBody = {
|
|
16
|
+
email: 'email',
|
|
17
|
+
password: 'password',
|
|
18
|
+
name: 'name',
|
|
19
|
+
count: 'count',
|
|
20
|
+
};
|
|
22
21
|
export const MiddlewareKeys = Object.freeze({
|
|
23
22
|
log: true,
|
|
24
23
|
error: true,
|
package/src/config/queue.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ export type QueueConfigOverrides = Partial<{
|
|
|
25
25
|
refreshIntervalMs: number;
|
|
26
26
|
};
|
|
27
27
|
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Helper: Create base driver configurations from environment
|
|
30
|
+
*/
|
|
31
|
+
export declare const createBaseDrivers: () => QueueDriversConfig;
|
|
28
32
|
declare const createQueueConfig: () => {
|
|
29
33
|
default: QueueDriverName;
|
|
30
34
|
drivers: QueueDriversConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/config/queue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGhG,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC;IACzC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACnF,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAClC,WAAW,EAAE,OAAO,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/config/queue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGhG,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC;IACzC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACnF,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAClC,WAAW,EAAE,OAAO,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH,CAAC,CAAC;AAOH;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAO,kBA+BnC,CAAC;AAsBH,QAAA,MAAM,iBAAiB,QAAO;IAC5B,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,SAAS,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACjF,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACnF,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAClC,WAAW,EAAE,OAAO,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CAuEH,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAqB/D,eAAO,MAAM,WAAW,EAAE,WAYxB,CAAC"}
|
package/src/config/queue.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RedisBroadcastDriverConfig } from './type';
|
|
2
|
+
import type { QueueMessage } from '../tools/queue/Queue';
|
|
3
|
+
export type QueueDriver = {
|
|
4
|
+
enqueue<T = unknown>(queue: string, payload: T): Promise<string>;
|
|
5
|
+
dequeue<T = unknown>(queue: string): Promise<QueueMessage<T> | undefined>;
|
|
6
|
+
ack(queue: string, id: string): Promise<void>;
|
|
7
|
+
length(queue: string): Promise<number>;
|
|
8
|
+
drain(queue: string): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export type RedisPublishClient = {
|
|
11
|
+
connect?: () => Promise<void>;
|
|
12
|
+
publish(channel: string, message: string): Promise<number>;
|
|
13
|
+
};
|
|
14
|
+
export declare const buildRedisUrl: (config?: RedisBroadcastDriverConfig) => string;
|
|
15
|
+
export declare const getRedisUrl: (config?: RedisBroadcastDriverConfig) => string | null;
|
|
16
|
+
export declare const ensureDriver: <T = QueueDriver>(type?: "queue" | "publish") => Promise<T>;
|
|
17
|
+
//# sourceMappingURL=redis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../../src/config/redis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC1E,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,0BAA0B,KAAG,MAYnE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,SAAS,0BAA0B,KAAG,MAAM,GAAG,IAW1E,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,CAAC,GAAG,WAAW,EAAE,OAAO,OAAO,GAAG,SAAS,KAAG,OAAO,CAAC,CAAC,CAqCzF,CAAC"}
|