@gravito/stream 2.0.0 → 2.0.2
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/README.md +104 -288
- package/README.zh-TW.md +146 -13
- package/dist/index.cjs +5725 -646
- package/dist/index.d.cts +3456 -871
- package/dist/index.d.ts +3456 -871
- package/dist/index.js +5712 -642
- package/package.json +14 -8
- package/proto/queue.proto +101 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravito/stream",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,15 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
21
|
+
"proto",
|
|
21
22
|
"README.md",
|
|
22
23
|
"LICENSE"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
26
|
"build": "bun run build.ts",
|
|
26
|
-
"test": "bun test",
|
|
27
|
+
"test": "bun test --timeout=10000",
|
|
27
28
|
"typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck",
|
|
28
|
-
"test:coverage": "bun test --coverage --coverage-
|
|
29
|
-
"test:ci": "bun test --coverage --coverage-
|
|
29
|
+
"test:coverage": "bun test --timeout=10000 --coverage --coverage-reporter=lcov --coverage-dir coverage && bun run --bun scripts/check-coverage.ts",
|
|
30
|
+
"test:ci": "bun test --timeout=10000 --coverage --coverage-reporter=lcov --coverage-dir coverage && bun run --bun scripts/check-coverage.ts",
|
|
31
|
+
"test:unit": "bun test $(find tests -name '*.test.ts' ! -name '*.integration.test.ts' 2>/dev/null | tr '\\n' ' ') --timeout=10000",
|
|
32
|
+
"test:integration": "test $(find tests -name '*.integration.test.ts' 2>/dev/null | wc -l) -gt 0 && find tests -name '*.integration.test.ts' -print0 | xargs -0 bun test --timeout=10000 || echo 'No integration tests found'"
|
|
30
33
|
},
|
|
31
34
|
"keywords": [
|
|
32
35
|
"gravito",
|
|
@@ -42,9 +45,12 @@
|
|
|
42
45
|
"license": "MIT",
|
|
43
46
|
"dependencies": {
|
|
44
47
|
"@aws-sdk/client-sqs": "^3.955.0",
|
|
45
|
-
"@gravito/atlas": "
|
|
46
|
-
"@gravito/core": "
|
|
47
|
-
"
|
|
48
|
+
"@gravito/atlas": "^1.6.0",
|
|
49
|
+
"@gravito/core": "^1.6.1",
|
|
50
|
+
"@grpc/grpc-js": "^1.14.3",
|
|
51
|
+
"@grpc/proto-loader": "^0.8.0",
|
|
52
|
+
"cron-parser": "^5.4.0",
|
|
53
|
+
"p-limit": "^5.0.0"
|
|
48
54
|
},
|
|
49
55
|
"devDependencies": {
|
|
50
56
|
"@types/ioredis": "^5.0.0",
|
|
@@ -60,4 +66,4 @@
|
|
|
60
66
|
"url": "git+https://github.com/gravito-framework/gravito.git",
|
|
61
67
|
"directory": "packages/stream"
|
|
62
68
|
}
|
|
63
|
-
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package stream;
|
|
4
|
+
|
|
5
|
+
service QueueService {
|
|
6
|
+
// Pushes a job to the queue
|
|
7
|
+
rpc Push (PushRequest) returns (PushResponse);
|
|
8
|
+
|
|
9
|
+
// Pulls a job from the queue
|
|
10
|
+
rpc Pull (PullRequest) returns (PullResponse);
|
|
11
|
+
|
|
12
|
+
// Acknowledges a job completion
|
|
13
|
+
rpc Acknowledge (AcknowledgeRequest) returns (AcknowledgeResponse);
|
|
14
|
+
|
|
15
|
+
// Returns queue size
|
|
16
|
+
rpc Size (SizeRequest) returns (SizeResponse);
|
|
17
|
+
|
|
18
|
+
// Clears the queue
|
|
19
|
+
rpc Clear (ClearRequest) returns (ClearResponse);
|
|
20
|
+
|
|
21
|
+
// Get Queue Stats
|
|
22
|
+
rpc Stats (StatsRequest) returns (StatsResponse);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message Job {
|
|
26
|
+
string id = 1;
|
|
27
|
+
string type = 2; // 'json', 'class', 'msgpack'
|
|
28
|
+
string data = 3; // The serialized payload
|
|
29
|
+
string className = 4;
|
|
30
|
+
int64 createdAt = 5;
|
|
31
|
+
int32 delaySeconds = 6;
|
|
32
|
+
int32 attempts = 7;
|
|
33
|
+
int32 maxAttempts = 8;
|
|
34
|
+
string groupId = 9;
|
|
35
|
+
string priority = 10; // string representation (e.g. "high" or "10")
|
|
36
|
+
int64 failedAt = 11;
|
|
37
|
+
string error = 12;
|
|
38
|
+
int32 retryAfterSeconds = 13;
|
|
39
|
+
double retryMultiplier = 14;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message PushRequest {
|
|
43
|
+
string queue = 1;
|
|
44
|
+
Job job = 2;
|
|
45
|
+
JobPushOptions options = 3;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
message JobPushOptions {
|
|
49
|
+
string groupId = 1;
|
|
50
|
+
string priority = 2;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message PushResponse {
|
|
54
|
+
bool success = 1;
|
|
55
|
+
string message = 2;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
message PullRequest {
|
|
59
|
+
string queue = 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message PullResponse {
|
|
63
|
+
Job job = 1; // null/empty if no job
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
message AcknowledgeRequest {
|
|
67
|
+
string queue = 1;
|
|
68
|
+
string jobId = 2;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message AcknowledgeResponse {
|
|
72
|
+
bool success = 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message SizeRequest {
|
|
76
|
+
string queue = 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
message SizeResponse {
|
|
80
|
+
int32 size = 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message ClearRequest {
|
|
84
|
+
string queue = 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
message ClearResponse {
|
|
88
|
+
bool success = 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
message StatsRequest {
|
|
92
|
+
string queue = 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
message StatsResponse {
|
|
96
|
+
string queue = 1;
|
|
97
|
+
int32 size = 2;
|
|
98
|
+
int32 delayed = 3;
|
|
99
|
+
int32 failed = 4;
|
|
100
|
+
int32 reserved = 5;
|
|
101
|
+
}
|