@queuebase/node 1.2.0 → 1.3.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/dist/index.cjs +14 -13
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -13
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -55,7 +55,19 @@ function resolveConfig(config) {
|
|
|
55
55
|
|
|
56
56
|
// src/client.ts
|
|
57
57
|
function createClient(router, config) {
|
|
58
|
-
|
|
58
|
+
async function getStatus(jobId) {
|
|
59
|
+
const res = await fetch(`${config.apiUrl}/jobs/${jobId}`, {
|
|
60
|
+
headers: {
|
|
61
|
+
...config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
if (!res.ok) {
|
|
65
|
+
const error = await res.text().catch(() => "Unknown error");
|
|
66
|
+
throw new Error(`Failed to get job status: ${error}`);
|
|
67
|
+
}
|
|
68
|
+
return await res.json();
|
|
69
|
+
}
|
|
70
|
+
const client = { getStatus };
|
|
59
71
|
for (const [name, definition] of Object.entries(router)) {
|
|
60
72
|
const jobDef = definition;
|
|
61
73
|
client[name] = {
|
|
@@ -85,18 +97,7 @@ function createClient(router, config) {
|
|
|
85
97
|
const result = await response.json();
|
|
86
98
|
return {
|
|
87
99
|
jobId: result.jobId,
|
|
88
|
-
getStatus:
|
|
89
|
-
const res = await fetch(`${config.apiUrl}/jobs/${result.jobId}`, {
|
|
90
|
-
headers: {
|
|
91
|
-
...config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
if (!res.ok) {
|
|
95
|
-
const error = await res.text().catch(() => "Unknown error");
|
|
96
|
-
throw new Error(`Failed to get job status: ${error}`);
|
|
97
|
-
}
|
|
98
|
-
return await res.json();
|
|
99
|
-
}
|
|
100
|
+
getStatus: () => getStatus(result.jobId)
|
|
100
101
|
};
|
|
101
102
|
},
|
|
102
103
|
_def: jobDef
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueuebaseConfig, AnyJobDefinition,
|
|
1
|
+
import { QueuebaseConfig, AnyJobDefinition, JobClient } from '@queuebase/core';
|
|
2
2
|
export { AnyJobDefinition, EnqueueOptions, HandlerRequest, HandlerResponse, InferJobInput, InferJobOutput, JobContext, JobDefinition, JobRouter, createJobRouter, job, processJobCallback } from '@queuebase/core';
|
|
3
3
|
export { createNodeHandler } from './handler.cjs';
|
|
4
4
|
import 'node:http';
|
|
@@ -11,6 +11,6 @@ interface TransportConfig {
|
|
|
11
11
|
apiKey?: string;
|
|
12
12
|
callbackUrl: string;
|
|
13
13
|
}
|
|
14
|
-
declare function createClient<T extends Record<string, AnyJobDefinition>>(router: T, config: TransportConfig):
|
|
14
|
+
declare function createClient<T extends Record<string, AnyJobDefinition>>(router: T, config: TransportConfig): JobClient<T>;
|
|
15
15
|
|
|
16
16
|
export { createClient, defineConfig, resolveConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueuebaseConfig, AnyJobDefinition,
|
|
1
|
+
import { QueuebaseConfig, AnyJobDefinition, JobClient } from '@queuebase/core';
|
|
2
2
|
export { AnyJobDefinition, EnqueueOptions, HandlerRequest, HandlerResponse, InferJobInput, InferJobOutput, JobContext, JobDefinition, JobRouter, createJobRouter, job, processJobCallback } from '@queuebase/core';
|
|
3
3
|
export { createNodeHandler } from './handler.js';
|
|
4
4
|
import 'node:http';
|
|
@@ -11,6 +11,6 @@ interface TransportConfig {
|
|
|
11
11
|
apiKey?: string;
|
|
12
12
|
callbackUrl: string;
|
|
13
13
|
}
|
|
14
|
-
declare function createClient<T extends Record<string, AnyJobDefinition>>(router: T, config: TransportConfig):
|
|
14
|
+
declare function createClient<T extends Record<string, AnyJobDefinition>>(router: T, config: TransportConfig): JobClient<T>;
|
|
15
15
|
|
|
16
16
|
export { createClient, defineConfig, resolveConfig };
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,19 @@ function resolveConfig(config) {
|
|
|
29
29
|
|
|
30
30
|
// src/client.ts
|
|
31
31
|
function createClient(router, config) {
|
|
32
|
-
|
|
32
|
+
async function getStatus(jobId) {
|
|
33
|
+
const res = await fetch(`${config.apiUrl}/jobs/${jobId}`, {
|
|
34
|
+
headers: {
|
|
35
|
+
...config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
const error = await res.text().catch(() => "Unknown error");
|
|
40
|
+
throw new Error(`Failed to get job status: ${error}`);
|
|
41
|
+
}
|
|
42
|
+
return await res.json();
|
|
43
|
+
}
|
|
44
|
+
const client = { getStatus };
|
|
33
45
|
for (const [name, definition] of Object.entries(router)) {
|
|
34
46
|
const jobDef = definition;
|
|
35
47
|
client[name] = {
|
|
@@ -59,18 +71,7 @@ function createClient(router, config) {
|
|
|
59
71
|
const result = await response.json();
|
|
60
72
|
return {
|
|
61
73
|
jobId: result.jobId,
|
|
62
|
-
getStatus:
|
|
63
|
-
const res = await fetch(`${config.apiUrl}/jobs/${result.jobId}`, {
|
|
64
|
-
headers: {
|
|
65
|
-
...config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
if (!res.ok) {
|
|
69
|
-
const error = await res.text().catch(() => "Unknown error");
|
|
70
|
-
throw new Error(`Failed to get job status: ${error}`);
|
|
71
|
-
}
|
|
72
|
-
return await res.json();
|
|
73
|
-
}
|
|
74
|
+
getStatus: () => getStatus(result.jobId)
|
|
74
75
|
};
|
|
75
76
|
},
|
|
76
77
|
_def: jobDef
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@queuebase/node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"zod": "^3.24.1",
|
|
25
|
-
"@queuebase/core": "1.
|
|
25
|
+
"@queuebase/core": "1.3.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.10.5",
|