@bypixeltv/kvstore 0.0.0-stage → 0.1.0-SNAPSHOT.24
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 +27 -2
- package/dist/index.d.ts +98 -0
- package/dist/index.js +131 -0
- package/dist/kvstore.proto +147 -0
- package/package.json +34 -4
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bypixeltv/kvstore
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node.js 22+ gRPC client for [KVStore](https://github.com/byPixelTV/kvstore).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { KVStoreClient } from "@bypixeltv/kvstore";
|
|
7
|
+
|
|
8
|
+
const kvstore = new KVStoreClient("kv.example.com:50051", {
|
|
9
|
+
apiKey: process.env.KVSTORE_API_KEY,
|
|
10
|
+
});
|
|
11
|
+
const controller = new AbortController();
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
await kvstore.setJson("players", "alice", { coins: 100 });
|
|
15
|
+
console.log(await kvstore.getJson<{ coins: number }>("players", "alice"));
|
|
16
|
+
|
|
17
|
+
for await (const change of kvstore.onChange("players", { signal: controller.signal })) {
|
|
18
|
+
console.log(change.key, change.deleted);
|
|
19
|
+
}
|
|
20
|
+
} finally {
|
|
21
|
+
kvstore.close();
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use `controller.abort()` to unsubscribe. Use `watch` and `cursorFromChange` for checkpoints
|
|
26
|
+
and replay after a disconnect. Connect to the router for a sharded deployment.
|
|
27
|
+
See the [KVStore SDK documentation](https://github.com/byPixelTV/kvstore#sdks) for recovery,
|
|
28
|
+
wire types and release channels.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export interface ClientOptions {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
plaintext?: boolean;
|
|
4
|
+
tls?: {
|
|
5
|
+
ca?: Buffer;
|
|
6
|
+
key?: Buffer;
|
|
7
|
+
cert?: Buffer;
|
|
8
|
+
};
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface Cursor {
|
|
12
|
+
revision?: string;
|
|
13
|
+
vector?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WatchOptions {
|
|
16
|
+
key?: string;
|
|
17
|
+
after?: Cursor;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
export interface GetResult {
|
|
21
|
+
found: boolean;
|
|
22
|
+
value: Buffer;
|
|
23
|
+
revision: string;
|
|
24
|
+
expiresAtUnixMs: string;
|
|
25
|
+
}
|
|
26
|
+
export type SetResult = Pick<GetResult, "revision" | "expiresAtUnixMs">;
|
|
27
|
+
export interface DeleteResult {
|
|
28
|
+
deleted: boolean;
|
|
29
|
+
revision: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Head {
|
|
32
|
+
revision: string;
|
|
33
|
+
oldestAvailableRevision: string;
|
|
34
|
+
cursor: string;
|
|
35
|
+
supportsExpiration: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface Change {
|
|
38
|
+
namespace: string;
|
|
39
|
+
key: string;
|
|
40
|
+
revision: string;
|
|
41
|
+
value: Buffer;
|
|
42
|
+
deleted: boolean;
|
|
43
|
+
checkpoint: boolean;
|
|
44
|
+
cursor: string;
|
|
45
|
+
shard: number;
|
|
46
|
+
expiresAtUnixMs: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ScanRecord {
|
|
49
|
+
snapshotRevision: string;
|
|
50
|
+
key: string;
|
|
51
|
+
value: Buffer;
|
|
52
|
+
revision: string;
|
|
53
|
+
checkpoint: boolean;
|
|
54
|
+
cursor: string;
|
|
55
|
+
shard: number;
|
|
56
|
+
expiresAtUnixMs: string;
|
|
57
|
+
}
|
|
58
|
+
interface Key {
|
|
59
|
+
namespace: string;
|
|
60
|
+
key: string;
|
|
61
|
+
}
|
|
62
|
+
export type BatchOperation = Key & ({
|
|
63
|
+
value: Uint8Array;
|
|
64
|
+
expiresAtUnixMs?: number;
|
|
65
|
+
delete?: false;
|
|
66
|
+
} | {
|
|
67
|
+
delete: true;
|
|
68
|
+
});
|
|
69
|
+
export interface BatchResult extends DeleteResult {
|
|
70
|
+
grpcCode: number;
|
|
71
|
+
error: string;
|
|
72
|
+
}
|
|
73
|
+
export declare function cursorFromChange(change: Change): Cursor;
|
|
74
|
+
/** Use the checkpoint from a completed scan. Sharded scans checkpoint at the end. */
|
|
75
|
+
export declare function cursorFromScan(checkpoint: ScanRecord): Cursor;
|
|
76
|
+
export declare function needsRescan(error: unknown): boolean;
|
|
77
|
+
export declare class KVStoreClient {
|
|
78
|
+
private readonly rpc;
|
|
79
|
+
private readonly metadata;
|
|
80
|
+
private readonly timeoutMs;
|
|
81
|
+
constructor(target: string, { apiKey, plaintext, tls, timeoutMs }?: ClientOptions);
|
|
82
|
+
close(): void;
|
|
83
|
+
private unary;
|
|
84
|
+
get(namespace: string, key: string, consistency?: "strong" | "eventual"): Promise<GetResult>;
|
|
85
|
+
set(namespace: string, key: string, value: Uint8Array, expiresAtUnixMs?: number): Promise<SetResult>;
|
|
86
|
+
delete(namespace: string, key: string): Promise<DeleteResult>;
|
|
87
|
+
/** Results are ordered. A transport failure can leave the outcome unknown. */
|
|
88
|
+
batchWrite(operations: BatchOperation[]): Promise<BatchResult[]>;
|
|
89
|
+
getJson<T>(namespace: string, key: string): Promise<T | undefined>;
|
|
90
|
+
setJson<T>(namespace: string, key: string, value: T, expiresAtUnixMs?: number): Promise<SetResult>;
|
|
91
|
+
head(signal?: AbortSignal): Promise<Head>;
|
|
92
|
+
scan(namespace: string, signal?: AbortSignal): AsyncGenerator<ScanRecord>;
|
|
93
|
+
/** Pass a cursor to replay changes. With no cursor the stream starts at Head. */
|
|
94
|
+
watch(namespace: string, options?: WatchOptions): AsyncGenerator<Change>;
|
|
95
|
+
/** Iterate over committed changes. Use watch when you need cursor checkpoints. */
|
|
96
|
+
onChange(namespace: string, options?: WatchOptions): AsyncGenerator<Change>;
|
|
97
|
+
}
|
|
98
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as grpc from "@grpc/grpc-js";
|
|
2
|
+
import { loadSync } from "@grpc/proto-loader";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
const definition = loadSync(fileURLToPath(new URL("./kvstore.proto", import.meta.url)), {
|
|
5
|
+
defaults: true,
|
|
6
|
+
longs: String,
|
|
7
|
+
});
|
|
8
|
+
const service = grpc.loadPackageDefinition(definition);
|
|
9
|
+
function expiration(ms) {
|
|
10
|
+
if (!Number.isSafeInteger(ms) || ms < 0) {
|
|
11
|
+
throw new RangeError("expiresAtUnixMs must be a nonnegative safe integer");
|
|
12
|
+
}
|
|
13
|
+
return String(ms);
|
|
14
|
+
}
|
|
15
|
+
async function* frames(open, signal) {
|
|
16
|
+
signal?.throwIfAborted();
|
|
17
|
+
const stream = open();
|
|
18
|
+
const abort = () => stream.cancel();
|
|
19
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
20
|
+
try {
|
|
21
|
+
for await (const frame of stream) {
|
|
22
|
+
yield frame;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
signal?.removeEventListener("abort", abort);
|
|
27
|
+
stream.cancel();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function cursorFromChange(change) {
|
|
31
|
+
return change.cursor ? { vector: change.cursor } : { revision: change.revision };
|
|
32
|
+
}
|
|
33
|
+
/** Use the checkpoint from a completed scan. Sharded scans checkpoint at the end. */
|
|
34
|
+
export function cursorFromScan(checkpoint) {
|
|
35
|
+
if (!checkpoint.checkpoint)
|
|
36
|
+
throw new TypeError("Expected a scan checkpoint");
|
|
37
|
+
return checkpoint.cursor ? { vector: checkpoint.cursor } : { revision: checkpoint.snapshotRevision };
|
|
38
|
+
}
|
|
39
|
+
export function needsRescan(error) {
|
|
40
|
+
if (typeof error !== "object" || error === null || !("code" in error))
|
|
41
|
+
return false;
|
|
42
|
+
return error.code === grpc.status.OUT_OF_RANGE || error.code === grpc.status.FAILED_PRECONDITION;
|
|
43
|
+
}
|
|
44
|
+
export class KVStoreClient {
|
|
45
|
+
rpc;
|
|
46
|
+
metadata = new grpc.Metadata();
|
|
47
|
+
timeoutMs;
|
|
48
|
+
constructor(target, { apiKey, plaintext = false, tls, timeoutMs = 5000 } = {}) {
|
|
49
|
+
if (plaintext && tls)
|
|
50
|
+
throw new TypeError("plaintext and tls are mutually exclusive");
|
|
51
|
+
if (!!tls?.key !== !!tls?.cert)
|
|
52
|
+
throw new TypeError("mTLS requires both key and cert");
|
|
53
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0)
|
|
54
|
+
throw new RangeError("timeoutMs must be positive");
|
|
55
|
+
this.timeoutMs = timeoutMs;
|
|
56
|
+
const credentials = plaintext ? grpc.credentials.createInsecure() :
|
|
57
|
+
grpc.credentials.createSsl(tls?.ca, tls?.key, tls?.cert);
|
|
58
|
+
this.rpc = new service.kvstore.v1.KVStore(target, credentials);
|
|
59
|
+
if (apiKey)
|
|
60
|
+
this.metadata.set("authorization", `Bearer ${apiKey}`);
|
|
61
|
+
}
|
|
62
|
+
close() {
|
|
63
|
+
this.rpc.close();
|
|
64
|
+
}
|
|
65
|
+
unary(rpc, request, signal) {
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
signal?.throwIfAborted();
|
|
68
|
+
const abort = () => call.cancel();
|
|
69
|
+
const call = rpc.call(this.rpc, request, this.metadata, { deadline: Date.now() + this.timeoutMs }, (err, response) => {
|
|
70
|
+
signal?.removeEventListener("abort", abort);
|
|
71
|
+
if (err)
|
|
72
|
+
reject(err);
|
|
73
|
+
else
|
|
74
|
+
resolve(response);
|
|
75
|
+
});
|
|
76
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
get(namespace, key, consistency = "strong") {
|
|
80
|
+
return this.unary(this.rpc.get, { namespace, key, consistency: consistency === "strong" ? 0 : 1 });
|
|
81
|
+
}
|
|
82
|
+
set(namespace, key, value, expiresAtUnixMs = 0) {
|
|
83
|
+
return this.unary(this.rpc.set, { namespace, key, value, expiresAtUnixMs: expiration(expiresAtUnixMs) });
|
|
84
|
+
}
|
|
85
|
+
delete(namespace, key) {
|
|
86
|
+
return this.unary(this.rpc.delete, { namespace, key });
|
|
87
|
+
}
|
|
88
|
+
/** Results are ordered. A transport failure can leave the outcome unknown. */
|
|
89
|
+
async batchWrite(operations) {
|
|
90
|
+
const request = operations.map(op => op.delete
|
|
91
|
+
? { namespace: op.namespace, key: op.key, delete: true }
|
|
92
|
+
: { namespace: op.namespace, key: op.key, value: op.value, expiresAtUnixMs: expiration(op.expiresAtUnixMs ?? 0) });
|
|
93
|
+
return (await this.unary(this.rpc.batchWrite, { operations: request })).results;
|
|
94
|
+
}
|
|
95
|
+
async getJson(namespace, key) {
|
|
96
|
+
const result = await this.get(namespace, key);
|
|
97
|
+
return result.found ? JSON.parse(result.value.toString("utf8")) : undefined;
|
|
98
|
+
}
|
|
99
|
+
async setJson(namespace, key, value, expiresAtUnixMs = 0) {
|
|
100
|
+
const json = JSON.stringify(value);
|
|
101
|
+
if (json === undefined)
|
|
102
|
+
throw new TypeError("value has no JSON representation");
|
|
103
|
+
return this.set(namespace, key, Buffer.from(json), expiresAtUnixMs);
|
|
104
|
+
}
|
|
105
|
+
head(signal) {
|
|
106
|
+
return this.unary(this.rpc.head, { useVectorCursor: true }, signal);
|
|
107
|
+
}
|
|
108
|
+
scan(namespace, signal) {
|
|
109
|
+
return frames(() => this.rpc.scan({ namespace, useVectorCursor: true }, this.metadata), signal);
|
|
110
|
+
}
|
|
111
|
+
/** Pass a cursor to replay changes. With no cursor the stream starts at Head. */
|
|
112
|
+
async *watch(namespace, options = {}) {
|
|
113
|
+
const { key = "", signal } = options;
|
|
114
|
+
let after = options.after;
|
|
115
|
+
if (!after) {
|
|
116
|
+
const { cursor, revision } = await this.head(signal);
|
|
117
|
+
after = { vector: cursor, revision };
|
|
118
|
+
}
|
|
119
|
+
const vector = after.vector ?? "";
|
|
120
|
+
yield* frames(() => this.rpc.watch({
|
|
121
|
+
namespace, key, afterRevision: vector ? "0" : after.revision ?? "0", cursor: vector, useVectorCursor: true,
|
|
122
|
+
}, this.metadata), signal);
|
|
123
|
+
}
|
|
124
|
+
/** Iterate over committed changes. Use watch when you need cursor checkpoints. */
|
|
125
|
+
async *onChange(namespace, options = {}) {
|
|
126
|
+
for await (const change of this.watch(namespace, options)) {
|
|
127
|
+
if (!change.checkpoint)
|
|
128
|
+
yield change;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package kvstore.v1;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/byPixelTV/kvstore/gen/go/kvstore/v1;kvstorev1";
|
|
6
|
+
|
|
7
|
+
service KVStore {
|
|
8
|
+
rpc Get(GetRequest) returns (GetResponse);
|
|
9
|
+
rpc Set(SetRequest) returns (SetResponse);
|
|
10
|
+
rpc Delete(DeleteRequest) returns (DeleteResponse);
|
|
11
|
+
// Single shard: atomic; multi-shard: independent shard batches, per-item outcomes.
|
|
12
|
+
// Clients MUST NOT blindly retry UNKNOWN_OUTCOME on a network failure.
|
|
13
|
+
rpc BatchWrite(BatchWriteRequest) returns (BatchWriteResponse);
|
|
14
|
+
rpc Head(HeadRequest) returns (HeadResponse);
|
|
15
|
+
rpc Watch(WatchRequest) returns (stream WatchResponse);
|
|
16
|
+
rpc Scan(ScanRequest) returns (stream ScanResponse);
|
|
17
|
+
// Internal Raft-replicated write fence for lossless live slot migration.
|
|
18
|
+
// Only trusted router may call this, authenticated by the join token.
|
|
19
|
+
rpc FenceSlot(FenceSlotRequest) returns (FenceSlotResponse);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// STRONG is the default for backwards compatibility. EVENTUAL reads from
|
|
23
|
+
// the selected node's committed local FSM and may be behind the leader.
|
|
24
|
+
enum ReadConsistency {
|
|
25
|
+
READ_CONSISTENCY_STRONG = 0;
|
|
26
|
+
READ_CONSISTENCY_EVENTUAL = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message GetRequest {
|
|
30
|
+
string namespace = 1;
|
|
31
|
+
string key = 2;
|
|
32
|
+
ReadConsistency consistency = 3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message GetResponse {
|
|
36
|
+
bool found = 1;
|
|
37
|
+
bytes value = 2;
|
|
38
|
+
uint64 revision = 3;
|
|
39
|
+
int64 expires_at_unix_ms = 4;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message SetRequest {
|
|
43
|
+
string namespace = 1;
|
|
44
|
+
string key = 2;
|
|
45
|
+
bytes value = 3;
|
|
46
|
+
// Absolute Unix time in milliseconds. Zero stores a persistent value.
|
|
47
|
+
int64 expires_at_unix_ms = 4;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message SetResponse {
|
|
51
|
+
uint64 revision = 1;
|
|
52
|
+
int64 expires_at_unix_ms = 2;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message DeleteRequest {
|
|
56
|
+
string namespace = 1;
|
|
57
|
+
string key = 2;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
message DeleteResponse {
|
|
61
|
+
bool deleted = 1;
|
|
62
|
+
uint64 revision = 2;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Maximum 128 operations and 192 KiB of raw values per request. Within each
|
|
66
|
+
// shard operations are ordered and atomic; across shards they are NOT atomic.
|
|
67
|
+
message BatchWriteOperation {
|
|
68
|
+
string namespace = 1;
|
|
69
|
+
string key = 2;
|
|
70
|
+
bytes value = 3;
|
|
71
|
+
bool delete = 4;
|
|
72
|
+
int64 expires_at_unix_ms = 5;
|
|
73
|
+
}
|
|
74
|
+
message BatchWriteRequest { repeated BatchWriteOperation operations = 1; }
|
|
75
|
+
message BatchWriteResult {
|
|
76
|
+
uint64 revision = 1;
|
|
77
|
+
bool deleted = 2;
|
|
78
|
+
// 0 on success; otherwise a canonical gRPC status code for THIS item.
|
|
79
|
+
// On a transport timeout, the outcome may be unknown: never blindly retry.
|
|
80
|
+
uint32 grpc_code = 3;
|
|
81
|
+
string error = 4;
|
|
82
|
+
}
|
|
83
|
+
message BatchWriteResponse { repeated BatchWriteResult results = 1; }
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
// On standalone and single-Raft: Head gives the authoritative revision.
|
|
87
|
+
// Multi-Raft requires use_vector_cursor and returns cursor (revision=0).
|
|
88
|
+
message HeadRequest { bool use_vector_cursor = 1; }
|
|
89
|
+
message HeadResponse {
|
|
90
|
+
uint64 revision = 1;
|
|
91
|
+
uint64 oldest_available_revision = 2;
|
|
92
|
+
// Opaque cursor for multi-Raft. Set use_vector_cursor on requests.
|
|
93
|
+
string cursor = 3;
|
|
94
|
+
bool supports_expiration = 4;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// A namespace is mandatory. An empty key watches all keys in that namespace.
|
|
98
|
+
// After_revision is an exclusive cursor; checkpoints advance the cursor when
|
|
99
|
+
// other keys changed. OUT_OF_RANGE means a full cache resync is required.
|
|
100
|
+
message WatchRequest {
|
|
101
|
+
string namespace = 1;
|
|
102
|
+
string key = 2;
|
|
103
|
+
uint64 after_revision = 3;
|
|
104
|
+
// Multi-Raft requires a per-shard cursor vector; legacy uint64 cursors are invalid.
|
|
105
|
+
string cursor = 4;
|
|
106
|
+
bool use_vector_cursor = 5;
|
|
107
|
+
}
|
|
108
|
+
message WatchResponse {
|
|
109
|
+
uint64 revision = 1;
|
|
110
|
+
string namespace = 2;
|
|
111
|
+
string key = 3;
|
|
112
|
+
bytes value = 4;
|
|
113
|
+
bool deleted = 5;
|
|
114
|
+
bool checkpoint = 6;
|
|
115
|
+
string cursor = 7;
|
|
116
|
+
uint32 shard = 8;
|
|
117
|
+
int64 expires_at_unix_ms = 9;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Single-Raft: the first message is a consistent snapshot checkpoint; then
|
|
121
|
+
// Watch(after_revision=snapshot_revision). Multi-Raft: request vector mode,
|
|
122
|
+
// consume all records, then the FINAL checkpoint with the opaque cursor.
|
|
123
|
+
// Resync by Watch(cursor=final_checkpoint.cursor) in vector mode.
|
|
124
|
+
message ScanRequest {
|
|
125
|
+
string namespace = 1;
|
|
126
|
+
bool use_vector_cursor = 2;
|
|
127
|
+
}
|
|
128
|
+
message ScanResponse {
|
|
129
|
+
uint64 snapshot_revision = 1;
|
|
130
|
+
string key = 2;
|
|
131
|
+
bytes value = 3;
|
|
132
|
+
uint64 revision = 4;
|
|
133
|
+
bool checkpoint = 5;
|
|
134
|
+
// Final checkpoint after ALL shard snapshots have completed.
|
|
135
|
+
string cursor = 6;
|
|
136
|
+
uint32 shard = 7;
|
|
137
|
+
int64 expires_at_unix_ms = 8;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// A fence is replicated within the source/target Raft group and applied in
|
|
141
|
+
// Raft log order. A sealed slot rejects later SET/DELETE, even after restart.
|
|
142
|
+
message FenceSlotRequest {
|
|
143
|
+
string namespace = 1;
|
|
144
|
+
uint32 slot = 2;
|
|
145
|
+
bool sealed = 3;
|
|
146
|
+
}
|
|
147
|
+
message FenceSlotResponse {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bypixeltv/kvstore",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-SNAPSHOT.24",
|
|
4
|
+
"description": "Node.js and TypeScript gRPC client for KVStore",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/byPixelTV/kvstore.git",
|
|
21
|
+
"directory": "sdk/typescript"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc && node copy-proto.mjs",
|
|
25
|
+
"test": "npm run build && node --test",
|
|
26
|
+
"prepack": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@grpc/grpc-js": "^1.14.0",
|
|
30
|
+
"@grpc/proto-loader": "^0.8.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.0.0",
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
|
+
}
|
|
36
|
+
}
|