@zintrust/workers 0.4.75 → 0.4.88
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/WorkerShutdownDurableObject.d.ts +12 -0
- package/dist/WorkerShutdownDurableObject.js +41 -0
- package/dist/build-manifest.json +40 -12
- package/dist/config/workerConfig.js +26 -3
- package/dist/createQueueWorker.js +4 -4
- package/dist/ui/workers/index.html +202 -0
- package/dist/ui/workers/main.js +1952 -0
- package/dist/ui/workers/styles.css +1350 -0
- package/dist/ui/workers/zintrust.svg +30 -0
- package/package.json +1 -1
- package/src/config/workerConfig.ts +34 -3
- package/src/createQueueWorker.ts +4 -4
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<svg width="120" height="120" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="zt-g2d" x1="10" y1="50" x2="90" y2="50" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#22c55e" />
|
|
5
|
+
<stop offset="1" stop-color="#38bdf8" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<circle cx="50" cy="50" r="34" stroke="rgba(255,255,255,0.16)" stroke-width="4" />
|
|
9
|
+
<ellipse cx="50" cy="50" rx="40" ry="18" stroke="url(#zt-g2d)" stroke-width="4" />
|
|
10
|
+
<ellipse cx="50" cy="50" rx="18" ry="40" stroke="url(#zt-g2d)" stroke-width="4" opacity="0.75" />
|
|
11
|
+
<circle cx="50" cy="50" r="6" fill="url(#zt-g2d)" />
|
|
12
|
+
<path
|
|
13
|
+
d="M40 52C35 52 32 49 32 44C32 39 35 36 40 36H48"
|
|
14
|
+
stroke="white"
|
|
15
|
+
stroke-width="6"
|
|
16
|
+
stroke-linecap="round"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M60 48C65 48 68 51 68 56C68 61 65 64 60 64H52"
|
|
20
|
+
stroke="white"
|
|
21
|
+
stroke-width="6"
|
|
22
|
+
stroke-linecap="round"
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d="M44 50H56"
|
|
26
|
+
stroke="rgba(255,255,255,0.22)"
|
|
27
|
+
stroke-width="6"
|
|
28
|
+
stroke-linecap="round"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -24,10 +24,41 @@ export const WorkerConfig = Object.freeze({
|
|
|
24
24
|
getWorkerBaseUrl: resolveWorkerApiUrl,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
+
const trimBoundaryUnderscores = (value: string): string => {
|
|
28
|
+
let start = 0;
|
|
29
|
+
let end = value.length;
|
|
30
|
+
|
|
31
|
+
while (start < end && value.charAt(start) === '_') {
|
|
32
|
+
start += 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
while (end > start && value.charAt(end - 1) === '_') {
|
|
36
|
+
end -= 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return value.slice(start, end);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const normalizeAppName = (value: string): string => {
|
|
43
|
+
const trimmed = value.trim().toLowerCase();
|
|
44
|
+
const collapsedWhitespace = trimmed.replaceAll(/\s+/g, '_');
|
|
45
|
+
const sanitized = collapsedWhitespace.replaceAll(/[^a-z0-9_:-]/g, '_');
|
|
46
|
+
const collapsedUnderscores = sanitized.replaceAll(/_+/g, '_');
|
|
47
|
+
const normalized = trimBoundaryUnderscores(collapsedUnderscores);
|
|
48
|
+
return normalized === '' ? 'zintrust' : normalized;
|
|
49
|
+
};
|
|
50
|
+
|
|
27
51
|
export const keyPrefix = (): string => {
|
|
28
52
|
const redisKeyPrefix = (Env.get('WORKER_PERSISTENCE_REDIS_KEY_PREFIX', '') ?? '').trim();
|
|
29
53
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
54
|
+
if (redisKeyPrefix !== '') {
|
|
55
|
+
return redisKeyPrefix;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const appName =
|
|
59
|
+
typeof appConfig.name === 'string' && appConfig.name.trim() !== ''
|
|
60
|
+
? appConfig.name
|
|
61
|
+
: Env.get('APP_NAME', 'zintrust');
|
|
62
|
+
|
|
63
|
+
return `${normalizeAppName(appName)}_zintrust:workers:`;
|
|
33
64
|
};
|
package/src/createQueueWorker.ts
CHANGED
|
@@ -41,9 +41,9 @@ const getTimeoutManager = (): unknown => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const getSystemTraceBridge = (): unknown => {
|
|
45
45
|
try {
|
|
46
|
-
return (Core as Record<string, unknown>)['
|
|
46
|
+
return (Core as Record<string, unknown>)['SystemTraceBridge'];
|
|
47
47
|
} catch {
|
|
48
48
|
return undefined;
|
|
49
49
|
}
|
|
@@ -238,7 +238,7 @@ const getHeartbeatStoreApi = (): HeartbeatStoreApi => {
|
|
|
238
238
|
};
|
|
239
239
|
|
|
240
240
|
const emitJobProcessed = (name: string): void => {
|
|
241
|
-
const bridge = (
|
|
241
|
+
const bridge = (getSystemTraceBridge() ?? {}) as {
|
|
242
242
|
emitJobProcessed?: (jobName: string) => void;
|
|
243
243
|
};
|
|
244
244
|
|
|
@@ -246,7 +246,7 @@ const emitJobProcessed = (name: string): void => {
|
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
const emitJobFailed = (name: string, error: Error): void => {
|
|
249
|
-
const bridge = (
|
|
249
|
+
const bridge = (getSystemTraceBridge() ?? {}) as {
|
|
250
250
|
emitJobFailed?: (jobName: string, failure: Error) => void;
|
|
251
251
|
};
|
|
252
252
|
|