pulse-sdk 0.0.6 → 1.0.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/proto/client.d.ts +3 -0
- package/dist/proto/client.js +20 -6
- package/dist/proto/pulse.proto +10 -1
- package/package.json +9 -8
package/dist/proto/client.d.ts
CHANGED
package/dist/proto/client.js
CHANGED
|
@@ -36,28 +36,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.loaded = exports.packageDefinition = void 0;
|
|
39
40
|
exports.createClient = createClient;
|
|
40
41
|
const fs_1 = __importDefault(require("fs"));
|
|
41
42
|
const path_1 = __importDefault(require("path"));
|
|
42
43
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
43
44
|
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
44
|
-
// Prefer the proto
|
|
45
|
-
|
|
45
|
+
// Prefer the cached proto (downloaded from server), then bundled, then repo.
|
|
46
|
+
const cachedProto = path_1.default.resolve(__dirname, 'pulse.cached.proto');
|
|
46
47
|
const bundledProto = path_1.default.resolve(__dirname, 'pulse.proto');
|
|
47
48
|
const repoProto = path_1.default.resolve(__dirname, '../../../../internal/api/proto/pulse.proto');
|
|
49
|
+
// Try to update proto from server
|
|
50
|
+
// try {
|
|
51
|
+
// const host = process.env.PULSE_HOST || 'localhost';
|
|
52
|
+
// const port = process.env.PULSE_HTTP_PORT || '5555';
|
|
53
|
+
// const url = `http://${host}:${port}/proto`;
|
|
54
|
+
// // Use curl to download with a short timeout (1s)
|
|
55
|
+
// execSync(`curl -s -m 1 -o "${cachedProto}" "${url}"`, { stdio: 'ignore' });
|
|
56
|
+
// } catch (e) {
|
|
57
|
+
// // Failed to fetch, will fall back to existing files
|
|
58
|
+
// }
|
|
48
59
|
let PROTO_PATH = bundledProto;
|
|
49
|
-
if (
|
|
60
|
+
if (fs_1.default.existsSync(cachedProto)) {
|
|
61
|
+
PROTO_PATH = cachedProto;
|
|
62
|
+
}
|
|
63
|
+
else if (!fs_1.default.existsSync(bundledProto)) {
|
|
50
64
|
// fallback to repo proto for local development
|
|
51
65
|
PROTO_PATH = repoProto;
|
|
52
66
|
}
|
|
53
|
-
|
|
67
|
+
exports.packageDefinition = protoLoader.loadSync(PROTO_PATH, {
|
|
54
68
|
keepCase: true,
|
|
55
69
|
longs: String,
|
|
56
70
|
enums: String,
|
|
57
71
|
defaults: true,
|
|
58
72
|
oneofs: true,
|
|
59
73
|
});
|
|
60
|
-
|
|
74
|
+
exports.loaded = grpc.loadPackageDefinition(exports.packageDefinition).pulse.v1;
|
|
61
75
|
function createClient(address) {
|
|
62
|
-
return new loaded.PulseService(address, grpc.credentials.createInsecure());
|
|
76
|
+
return new exports.loaded.PulseService(address, grpc.credentials.createInsecure());
|
|
63
77
|
}
|
package/dist/proto/pulse.proto
CHANGED
|
@@ -56,9 +56,18 @@ message CreateTopicRequest {
|
|
|
56
56
|
string topic = 1;
|
|
57
57
|
bool fifo = 2;
|
|
58
58
|
int64 retention_bytes = 3;
|
|
59
|
-
int64 retention_time = 4;
|
|
59
|
+
int64 retention_time = 4;
|
|
60
|
+
int32 flush_threshold = 5;
|
|
61
|
+
int64 flush_interval = 6;
|
|
62
|
+
int64 segment_size = 7;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
message CreateTopicResponse {
|
|
63
66
|
bool success = 1;
|
|
64
67
|
}
|
|
68
|
+
|
|
69
|
+
message ListTopicsRequest {}
|
|
70
|
+
|
|
71
|
+
message ListTopicsResponse {
|
|
72
|
+
repeated string topics = 1;
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pulse-sdk",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Pulse SDK for Node.js/TypeScript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,21 +22,22 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.0.0",
|
|
24
24
|
"jest": "^29.0.0",
|
|
25
|
-
"ts-jest": "^29.0.0"
|
|
26
|
-
|
|
25
|
+
"ts-jest": "^29.0.0",
|
|
26
|
+
"@types/jest": "^29.0.0",
|
|
27
27
|
"@types/js-yaml": "^4.0.5"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@grpc/grpc-js": "^1.8.0",
|
|
31
31
|
"protobufjs": "^7.2.0",
|
|
32
|
-
"@grpc/proto-loader": "^0.7.0"
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
,
|
|
32
|
+
"@grpc/proto-loader": "^0.7.0",
|
|
33
|
+
"js-yaml": "^4.1.0"
|
|
34
|
+
},
|
|
36
35
|
"jest": {
|
|
37
36
|
"preset": "ts-jest",
|
|
38
37
|
"testEnvironment": "node",
|
|
39
|
-
"testMatch": [
|
|
38
|
+
"testMatch": [
|
|
39
|
+
"**/tests/**/*.test.ts"
|
|
40
|
+
],
|
|
40
41
|
"globalTeardown": "<rootDir>/tests/globalTeardown.js"
|
|
41
42
|
}
|
|
42
43
|
}
|