@zintrust/core 3.0.2 → 3.0.4
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Production-grade TypeScript backend framework for JavaScript",
|
|
5
5
|
"homepage": "https://zintrust.com",
|
|
6
6
|
"repository": {
|
|
@@ -213,19 +213,19 @@
|
|
|
213
213
|
"./package.json": "./package.json"
|
|
214
214
|
},
|
|
215
215
|
"dependencies": {
|
|
216
|
-
"@zedgi/zedgi-client": "^1.0.
|
|
216
|
+
"@zedgi/zedgi-client": "^1.0.6",
|
|
217
217
|
"@cloudflare/containers": "^0.3.7",
|
|
218
218
|
"bcryptjs": "^3.0.3",
|
|
219
|
-
"bullmq": "^5.
|
|
219
|
+
"bullmq": "^5.80.2",
|
|
220
220
|
"chalk": "^5.6.2",
|
|
221
221
|
"commander": "^15.0.0",
|
|
222
222
|
"inquirer": "^14.0.2",
|
|
223
223
|
"ioredis": "^5.11.1",
|
|
224
224
|
"jsonwebtoken": "^9.0.3",
|
|
225
|
-
"mysql2": "^3.22.
|
|
225
|
+
"mysql2": "^3.22.6",
|
|
226
226
|
"pg": "^8.22.0",
|
|
227
|
-
"redis": "^6.0
|
|
228
|
-
"tsx": "^4.
|
|
227
|
+
"redis": "^6.1.0",
|
|
228
|
+
"tsx": "^4.23.1"
|
|
229
229
|
},
|
|
230
230
|
"overrides": {
|
|
231
231
|
"ajv": "^8.18.0",
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zintrust/core v3.0.
|
|
2
|
+
* @zintrust/core v3.0.4
|
|
3
3
|
*
|
|
4
4
|
* ZinTrust Framework - Production-Grade TypeScript Backend
|
|
5
5
|
* Built for performance, type safety, and exceptional developer experience
|
|
6
6
|
*
|
|
7
7
|
* Build Information:
|
|
8
|
-
* Built: 2026-07-
|
|
8
|
+
* Built: 2026-07-14T19:37:30.278Z
|
|
9
9
|
* Node: >=20.0.0
|
|
10
10
|
* License: MIT
|
|
11
11
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Available at runtime for debugging and health checks
|
|
22
22
|
*/
|
|
23
23
|
export const ZINTRUST_VERSION = '0.1.41';
|
|
24
|
-
export const ZINTRUST_BUILD_DATE = '2026-07-
|
|
24
|
+
export const ZINTRUST_BUILD_DATE = '2026-07-14T19:37:30.239Z'; // Replaced during build
|
|
25
25
|
export { Application } from './boot/Application.js';
|
|
26
26
|
export { AwsSigV4 } from './common/index.js';
|
|
27
27
|
export { SignedRequest } from './security/SignedRequest.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../src/worker-runtime/rpc-client.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../../src/worker-runtime/rpc-client.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAWF,eAAO,MAAM,oBAAoB,QAAO,OAAkC,CAAC;AAE3E,eAAO,MAAM,4BAA4B,QAAO,MAI/C,CAAC;AAOF,eAAO,MAAM,8BAA8B,QAAO,OAC0B,CAAC;AAiO7E,wFAAwF;AACxF,eAAO,MAAM,OAAO,GAClB,WAAW,MAAM,EACjB,qBAAqB,MAAM,KAC1B,OAAO,CAAC,SAAS,GAAG,SAAS,CAkB/B,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,MAAM,GACjB,WAAW,MAAM,EACjB,OAAO,MAAM,EACb,cAAc,OAAO,KACpB,OAAO,CAAC,IAAI,CAOd,CAAC;AAEF,gCAAgC;AAChC,eAAO,MAAM,OAAO,GAAU,WAAW,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAW5F,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,gBAAgB,EAAE,CAO9D,CAAC"}
|
|
@@ -109,7 +109,7 @@ const createZedgiOptions = () => {
|
|
|
109
109
|
}
|
|
110
110
|
return options;
|
|
111
111
|
};
|
|
112
|
-
const
|
|
112
|
+
const getZedgiClient = async () => {
|
|
113
113
|
if (zedgiClient === undefined) {
|
|
114
114
|
const options = createZedgiOptions();
|
|
115
115
|
try {
|
|
@@ -120,8 +120,10 @@ const getZedgiRedisClient = async () => {
|
|
|
120
120
|
throw ErrorFactory.createConfigError('@zedgi/zedgi-client is required when QUEUE_CONNECTION=queue-zedgi is used by the Worker runtime.', error);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
return zedgiClient;
|
|
124
|
+
};
|
|
125
|
+
const resolveZedgiRedisCredentialSelector = () => {
|
|
126
|
+
return resolveZedgiRedisProfile() ?? resolveZedgiRedisCredential();
|
|
125
127
|
};
|
|
126
128
|
const call = async (service, method, payload = {}) => {
|
|
127
129
|
const baseUrl = getBaseUrl();
|
|
@@ -174,29 +176,32 @@ const normalizePulledJob = (raw) => {
|
|
|
174
176
|
attempts,
|
|
175
177
|
};
|
|
176
178
|
};
|
|
177
|
-
const
|
|
179
|
+
const createZedgiBullMqError = (method, error) => {
|
|
178
180
|
const record = error !== null && typeof error === 'object' ? error : {};
|
|
179
181
|
const code = typeof record['code'] === 'string' ? record['code'] : '';
|
|
180
182
|
const statusCode = typeof record['statusCode'] === 'number' ? record['statusCode'] : undefined;
|
|
181
183
|
const message = error instanceof Error ? error.message : String(error);
|
|
182
184
|
if (code === 'ZEDGI_HOOK_NOT_FOUND' || statusCode === 404) {
|
|
183
|
-
return ErrorFactory.createConfigError(`Zedgi backend/account does not expose required queue consumer hook ${
|
|
185
|
+
return ErrorFactory.createConfigError(`Zedgi backend/account does not expose required queue consumer hook ${method}. Enable bull:dequeue, bull:ack, and bull:fail for queue-zedgi workers.`, error);
|
|
184
186
|
}
|
|
185
|
-
return ErrorFactory.createConfigError(`Zedgi queue consumer hook ${
|
|
187
|
+
return ErrorFactory.createConfigError(`Zedgi queue consumer hook ${method} failed: ${message}`, error);
|
|
186
188
|
};
|
|
187
|
-
const
|
|
189
|
+
const callZedgiBullMqOperation = async (operation, payload) => {
|
|
190
|
+
const method = `bull:${operation}`;
|
|
188
191
|
try {
|
|
189
|
-
const
|
|
190
|
-
return await
|
|
192
|
+
const client = await getZedgiClient();
|
|
193
|
+
return await client.call('redis', method, payload, {
|
|
194
|
+
credential: resolveZedgiRedisCredentialSelector(),
|
|
195
|
+
});
|
|
191
196
|
}
|
|
192
197
|
catch (error) {
|
|
193
|
-
throw
|
|
198
|
+
throw createZedgiBullMqError(method, error);
|
|
194
199
|
}
|
|
195
200
|
};
|
|
196
201
|
/** Atomically claim and pull the next waiting job for a queue, or undefined if none. */
|
|
197
202
|
export const pullJob = async (queueName, visibilityTimeoutMs) => {
|
|
198
203
|
if (isZedgiQueueSelected()) {
|
|
199
|
-
const result = await
|
|
204
|
+
const result = await callZedgiBullMqOperation('dequeue', {
|
|
200
205
|
target: queueName,
|
|
201
206
|
visibilityTimeoutMs,
|
|
202
207
|
});
|
|
@@ -211,7 +216,7 @@ export const pullJob = async (queueName, visibilityTimeoutMs) => {
|
|
|
211
216
|
/** Mark a pulled job completed. */
|
|
212
217
|
export const ackJob = async (queueName, jobId, returnValue) => {
|
|
213
218
|
if (isZedgiQueueSelected()) {
|
|
214
|
-
await
|
|
219
|
+
await callZedgiBullMqOperation('ack', { target: queueName, args: [jobId, returnValue] });
|
|
215
220
|
return;
|
|
216
221
|
}
|
|
217
222
|
await call('queue', 'ack', queuePayload({ queueName, jobId, returnValue }));
|
|
@@ -219,7 +224,7 @@ export const ackJob = async (queueName, jobId, returnValue) => {
|
|
|
219
224
|
/** Mark a pulled job failed. */
|
|
220
225
|
export const failJob = async (queueName, jobId, reason) => {
|
|
221
226
|
if (isZedgiQueueSelected()) {
|
|
222
|
-
await
|
|
227
|
+
await callZedgiBullMqOperation('fail', { target: queueName, args: [jobId, reason] });
|
|
223
228
|
return;
|
|
224
229
|
}
|
|
225
230
|
try {
|
|
@@ -231,6 +236,9 @@ export const failJob = async (queueName, jobId, reason) => {
|
|
|
231
236
|
};
|
|
232
237
|
/** List worker lifecycle records the backend holds (status running/stopped). */
|
|
233
238
|
export const listWorkers = async () => {
|
|
239
|
+
if (isZedgiQueueSelected()) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
234
242
|
const result = await call('worker', 'list', {});
|
|
235
243
|
return Array.isArray(result) ? result : [];
|
|
236
244
|
};
|