@cntryl/fitz 0.0.1
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/LICENSE +160 -0
- package/README.md +195 -0
- package/dist/index.cjs +5285 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +5222 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/client/client.d.ts +35 -0
- package/dist/types/client/client.d.ts.map +1 -0
- package/dist/types/client/connection.d.ts +57 -0
- package/dist/types/client/connection.d.ts.map +1 -0
- package/dist/types/client/multiplexer.d.ts +65 -0
- package/dist/types/client/multiplexer.d.ts.map +1 -0
- package/dist/types/core/buffer.d.ts +63 -0
- package/dist/types/core/buffer.d.ts.map +1 -0
- package/dist/types/core/errors.d.ts +94 -0
- package/dist/types/core/errors.d.ts.map +1 -0
- package/dist/types/core/iterator.d.ts +66 -0
- package/dist/types/core/iterator.d.ts.map +1 -0
- package/dist/types/core/lifecycle.d.ts +41 -0
- package/dist/types/core/lifecycle.d.ts.map +1 -0
- package/dist/types/core/task-group.d.ts +23 -0
- package/dist/types/core/task-group.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +92 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/domains/_routes.d.ts +10 -0
- package/dist/types/domains/_routes.d.ts.map +1 -0
- package/dist/types/domains/base.d.ts +26 -0
- package/dist/types/domains/base.d.ts.map +1 -0
- package/dist/types/domains/kv/client.d.ts +18 -0
- package/dist/types/domains/kv/client.d.ts.map +1 -0
- package/dist/types/domains/kv/codec.d.ts +22 -0
- package/dist/types/domains/kv/codec.d.ts.map +1 -0
- package/dist/types/domains/kv/transaction.d.ts +19 -0
- package/dist/types/domains/kv/transaction.d.ts.map +1 -0
- package/dist/types/domains/kv/types.d.ts +47 -0
- package/dist/types/domains/kv/types.d.ts.map +1 -0
- package/dist/types/domains/lease/client.d.ts +18 -0
- package/dist/types/domains/lease/client.d.ts.map +1 -0
- package/dist/types/domains/lease/codec.d.ts +69 -0
- package/dist/types/domains/lease/codec.d.ts.map +1 -0
- package/dist/types/domains/lease/index.d.ts +9 -0
- package/dist/types/domains/lease/index.d.ts.map +1 -0
- package/dist/types/domains/lease/types.d.ts +88 -0
- package/dist/types/domains/lease/types.d.ts.map +1 -0
- package/dist/types/domains/notice/client.d.ts +17 -0
- package/dist/types/domains/notice/client.d.ts.map +1 -0
- package/dist/types/domains/notice/codec.d.ts +42 -0
- package/dist/types/domains/notice/codec.d.ts.map +1 -0
- package/dist/types/domains/notice/index.d.ts +9 -0
- package/dist/types/domains/notice/index.d.ts.map +1 -0
- package/dist/types/domains/notice/types.d.ts +44 -0
- package/dist/types/domains/notice/types.d.ts.map +1 -0
- package/dist/types/domains/queue/client.d.ts +18 -0
- package/dist/types/domains/queue/client.d.ts.map +1 -0
- package/dist/types/domains/queue/codec.d.ts +82 -0
- package/dist/types/domains/queue/codec.d.ts.map +1 -0
- package/dist/types/domains/queue/index.d.ts +9 -0
- package/dist/types/domains/queue/index.d.ts.map +1 -0
- package/dist/types/domains/queue/types.d.ts +97 -0
- package/dist/types/domains/queue/types.d.ts.map +1 -0
- package/dist/types/domains/rpc/client.d.ts +17 -0
- package/dist/types/domains/rpc/client.d.ts.map +1 -0
- package/dist/types/domains/rpc/codec.d.ts +82 -0
- package/dist/types/domains/rpc/codec.d.ts.map +1 -0
- package/dist/types/domains/rpc/index.d.ts +8 -0
- package/dist/types/domains/rpc/index.d.ts.map +1 -0
- package/dist/types/domains/rpc/types.d.ts +67 -0
- package/dist/types/domains/rpc/types.d.ts.map +1 -0
- package/dist/types/domains/schedule/client.d.ts +19 -0
- package/dist/types/domains/schedule/client.d.ts.map +1 -0
- package/dist/types/domains/schedule/codec.d.ts +63 -0
- package/dist/types/domains/schedule/codec.d.ts.map +1 -0
- package/dist/types/domains/schedule/index.d.ts +8 -0
- package/dist/types/domains/schedule/index.d.ts.map +1 -0
- package/dist/types/domains/schedule/types.d.ts +69 -0
- package/dist/types/domains/schedule/types.d.ts.map +1 -0
- package/dist/types/domains/stream/client.d.ts +27 -0
- package/dist/types/domains/stream/client.d.ts.map +1 -0
- package/dist/types/domains/stream/codec.d.ts +124 -0
- package/dist/types/domains/stream/codec.d.ts.map +1 -0
- package/dist/types/domains/stream/index.d.ts +8 -0
- package/dist/types/domains/stream/index.d.ts.map +1 -0
- package/dist/types/domains/stream/session.d.ts +8 -0
- package/dist/types/domains/stream/session.d.ts.map +1 -0
- package/dist/types/domains/stream/types.d.ts +150 -0
- package/dist/types/domains/stream/types.d.ts.map +1 -0
- package/dist/types/frame/codec.d.ts +29 -0
- package/dist/types/frame/codec.d.ts.map +1 -0
- package/dist/types/frame/types.d.ts +71 -0
- package/dist/types/frame/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/protocol/response.d.ts +27 -0
- package/dist/types/protocol/response.d.ts.map +1 -0
- package/dist/types/transport/factory.d.ts +6 -0
- package/dist/types/transport/factory.d.ts.map +1 -0
- package/dist/types/transport/tcp.d.ts +6 -0
- package/dist/types/transport/tcp.d.ts.map +1 -0
- package/dist/types/transport/types.d.ts +17 -0
- package/dist/types/transport/types.d.ts.map +1 -0
- package/dist/types/transport/websocket.d.ts +6 -0
- package/dist/types/transport/websocket.d.ts.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KV domain client.
|
|
3
|
+
*/
|
|
4
|
+
import { KvTransaction } from "./transaction";
|
|
5
|
+
import { KvBeginOptions } from "./types";
|
|
6
|
+
import type { Connection } from "../../client/connection";
|
|
7
|
+
export type KvClient = ReturnType<typeof createKvClient>;
|
|
8
|
+
export declare function createKvClient(connection: Connection): {
|
|
9
|
+
begin: (route: string, options: KvBeginOptions) => Promise<KvTransaction>;
|
|
10
|
+
};
|
|
11
|
+
type KvClientConstructor = {
|
|
12
|
+
new (connection: Connection): KvClient;
|
|
13
|
+
(connection: Connection): KvClient;
|
|
14
|
+
};
|
|
15
|
+
export declare const KvClient: KvClientConstructor;
|
|
16
|
+
export type { KvTransaction } from "./transaction";
|
|
17
|
+
export * from "./types";
|
|
18
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/domains/kv/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAuB,aAAa,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAC;AAInD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAEzD,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU;mBAGvB,MAAM,WAAW,cAAc,KAAG,OAAO,CAAC,aAAa,CAAC;EAyBrF;AAED,KAAK,mBAAmB,GAAG;IACzB,KAAK,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC;IACvC,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,mBAEY,CAAC;AAEpC,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KV domain codec.
|
|
3
|
+
*/
|
|
4
|
+
import { KvBeginResponse, KvGetResponse, KvScanOptions, KvScanResponse, KvStatusResponse, TxMode, DurabilityMode } from "./types";
|
|
5
|
+
export declare const KvCodec: {
|
|
6
|
+
encodeBegin(route: string, mode: TxMode, durability: DurabilityMode): Uint8Array;
|
|
7
|
+
decodeBeginResponse(payload: Uint8Array): KvBeginResponse;
|
|
8
|
+
encodePut(txId: bigint, route: string, key: Uint8Array, value: Uint8Array): Uint8Array;
|
|
9
|
+
encodeInsert(txId: bigint, route: string, key: Uint8Array, value: Uint8Array): Uint8Array;
|
|
10
|
+
decodeStatusResponse(payload: Uint8Array): KvStatusResponse;
|
|
11
|
+
decodePutResponse(payload: Uint8Array): KvStatusResponse;
|
|
12
|
+
encodeGet(txId: bigint, route: string, key: Uint8Array): Uint8Array;
|
|
13
|
+
decodeGetResponse(payload: Uint8Array): KvGetResponse;
|
|
14
|
+
encodeDelete(txId: bigint, route: string, key: Uint8Array): Uint8Array;
|
|
15
|
+
encodeDeleteRange(txId: bigint, route: string, startKey: Uint8Array, endKey: Uint8Array): Uint8Array;
|
|
16
|
+
encodeCommit(txId: bigint, route: string): Uint8Array;
|
|
17
|
+
encodeRollback(txId: bigint, route: string): Uint8Array;
|
|
18
|
+
encodeScan(txId: bigint, route: string, options?: KvScanOptions): Uint8Array;
|
|
19
|
+
decodeScanResponse(payload: Uint8Array): KvScanResponse;
|
|
20
|
+
encodeDurability(durability: DurabilityMode): number;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/domains/kv/codec.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EACL,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,OAAO;uBACC,MAAM,QAAQ,MAAM,cAAc,cAAc,GAAG,UAAU;iCAQnD,UAAU,GAAG,eAAe;oBAOzC,MAAM,SAAS,MAAM,OAAO,UAAU,SAAS,UAAU,GAAG,UAAU;uBAWnE,MAAM,SAAS,MAAM,OAAO,UAAU,SAAS,UAAU,GAAG,UAAU;kCAI3D,UAAU,GAAG,gBAAgB;+BAKhC,UAAU,GAAG,gBAAgB;oBAIxC,MAAM,SAAS,MAAM,OAAO,UAAU,GAAG,UAAU;+BASxC,UAAU,GAAG,aAAa;uBAkBlC,MAAM,SAAS,MAAM,OAAO,UAAU,GAAG,UAAU;4BAU9D,MAAM,SACL,MAAM,YACH,UAAU,UACZ,UAAU,GACjB,UAAU;uBAWM,MAAM,SAAS,MAAM,GAAG,UAAU;yBAOhC,MAAM,SAAS,MAAM,GAAG,UAAU;qBAItC,MAAM,SAAS,MAAM,YAAW,aAAa,GAAQ,UAAU;gCAgCpD,UAAU,GAAG,cAAc;iCAwB1B,cAAc,GAAG,MAAM;CAUrD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KV transaction wrapper.
|
|
3
|
+
*/
|
|
4
|
+
import { Connection } from "../../client/connection";
|
|
5
|
+
import { KvGetResult, KvScanOptions } from "./types";
|
|
6
|
+
export type KvTransaction = ReturnType<typeof createKvTransaction>;
|
|
7
|
+
export declare function createKvTransaction(connection: Connection, route: string, txId: bigint): {
|
|
8
|
+
put: (key: Uint8Array, value: Uint8Array, signal?: AbortSignal) => Promise<void>;
|
|
9
|
+
insert: (key: Uint8Array, value: Uint8Array, signal?: AbortSignal) => Promise<void>;
|
|
10
|
+
get: (key: Uint8Array, signal?: AbortSignal) => Promise<KvGetResult>;
|
|
11
|
+
delete: (key: Uint8Array, signal?: AbortSignal) => Promise<void>;
|
|
12
|
+
deleteRange: (startKey: Uint8Array, endKey: Uint8Array, signal?: AbortSignal) => Promise<void>;
|
|
13
|
+
scan: (options?: KvScanOptions, signal?: AbortSignal) => Promise<AsyncIterable<Uint8Array>>;
|
|
14
|
+
commit: (signal?: AbortSignal) => Promise<void>;
|
|
15
|
+
rollback: (signal?: AbortSignal) => Promise<void>;
|
|
16
|
+
getTxId: () => bigint;
|
|
17
|
+
isOpen: () => boolean;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/domains/kv/transaction.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAY,MAAM,SAAS,CAAC;AAc/D,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEnE,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;eAgC7D,UAAU,SAAS,UAAU,WAAW,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;kBAQpF,UAAU,SACR,UAAU,WACR,WAAW,KACnB,OAAO,CAAC,IAAI,CAAC;eAOQ,UAAU,WAAW,WAAW,KAAG,OAAO,CAAC,WAAW,CAAC;kBAYhD,UAAU,WAAW,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;4BAQnE,UAAU,UACZ,UAAU,WACT,WAAW,KACnB,OAAO,CAAC,IAAI,CAAC;qBAQL,aAAa,WACb,WAAW,KACnB,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;sBASN,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;wBASzB,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;mBAgBxC,MAAM;kBAEP,OAAO;EAc3B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KV domain types.
|
|
3
|
+
*/
|
|
4
|
+
export type TxMode = "ReadOnly" | "ReadWrite";
|
|
5
|
+
export type DurabilityMode = "Buffered" | "Sync";
|
|
6
|
+
export interface KvBeginOptions {
|
|
7
|
+
mode?: TxMode;
|
|
8
|
+
durability: DurabilityMode;
|
|
9
|
+
}
|
|
10
|
+
export interface KvScanOptions {
|
|
11
|
+
startKey?: Uint8Array;
|
|
12
|
+
endKey?: Uint8Array;
|
|
13
|
+
limit?: number;
|
|
14
|
+
reverse?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type KvGetResult = {
|
|
17
|
+
type: "found";
|
|
18
|
+
value: Uint8Array;
|
|
19
|
+
} | {
|
|
20
|
+
type: "not-found";
|
|
21
|
+
};
|
|
22
|
+
export interface KvBeginResponse {
|
|
23
|
+
status: number;
|
|
24
|
+
txId?: bigint;
|
|
25
|
+
}
|
|
26
|
+
export interface KvStatusResponse {
|
|
27
|
+
status: number;
|
|
28
|
+
}
|
|
29
|
+
export interface KvGetResponse {
|
|
30
|
+
status: number;
|
|
31
|
+
found: boolean;
|
|
32
|
+
value?: Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
export interface KvScanResponse {
|
|
35
|
+
status: number;
|
|
36
|
+
keys: Uint8Array[];
|
|
37
|
+
nextCursor?: Uint8Array;
|
|
38
|
+
}
|
|
39
|
+
export declare enum KvStatus {
|
|
40
|
+
Ok = 0,
|
|
41
|
+
TransactionAborted = 1,
|
|
42
|
+
LeaseExpired = 2,
|
|
43
|
+
ConflictingWrite = 3,
|
|
44
|
+
KeyNotFound = 4,
|
|
45
|
+
OperationNotAllowed = 5
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/domains/kv/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAEvF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,oBAAY,QAAQ;IAClB,EAAE,IAAI;IACN,kBAAkB,IAAI;IACtB,YAAY,IAAI;IAChB,gBAAgB,IAAI;IACpB,WAAW,IAAI;IACf,mBAAmB,IAAI;CACxB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lease domain client.
|
|
3
|
+
*/
|
|
4
|
+
import type { Connection } from "../../client/connection";
|
|
5
|
+
import { ChangeHandler, Lease, LeaseInfo, LeaseSubscription } from "./types";
|
|
6
|
+
export type LeaseClient = ReturnType<typeof createLeaseClient>;
|
|
7
|
+
export declare function createLeaseClient(connection: Connection): {
|
|
8
|
+
acquire: (route: string, ttlSecs: number) => Promise<Lease>;
|
|
9
|
+
query: (route: string) => Promise<LeaseInfo>;
|
|
10
|
+
subscribe: (pattern: string, handler: ChangeHandler) => Promise<LeaseSubscription>;
|
|
11
|
+
};
|
|
12
|
+
type LeaseClientConstructor = {
|
|
13
|
+
new (connection: Connection): LeaseClient;
|
|
14
|
+
(connection: Connection): LeaseClient;
|
|
15
|
+
};
|
|
16
|
+
export declare const LeaseClient: LeaseClientConstructor;
|
|
17
|
+
export * from "./types";
|
|
18
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/domains/lease/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAW1D,OAAO,EACL,aAAa,EAEb,KAAK,EACL,SAAS,EACT,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAOjB,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU;qBA0BxB,MAAM,WAAW,MAAM,KAAG,OAAO,CAAC,KAAK,CAAC;mBAc1C,MAAM,KAAG,OAAO,CAAC,SAAS,CAAC;yBAiBrB,MAAM,WAAW,aAAa,KAAG,OAAO,CAAC,iBAAiB,CAAC;EAyF9F;AAED,KAAK,sBAAsB,GAAG;IAC5B,KAAK,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC;IAC1C,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,sBAEY,CAAC;AAEvC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lease domain codec for encoding/decoding messages
|
|
3
|
+
* Per fitz-go/internal/domains/lease/protocol.go
|
|
4
|
+
*/
|
|
5
|
+
import { AcquireResponse, QueryResponse, SubscribeResponse, UnsubscribeResponse } from "./types";
|
|
6
|
+
export declare const LeaseCodec: {
|
|
7
|
+
/**
|
|
8
|
+
* Encode ACQUIRE request
|
|
9
|
+
* Payload: [string route][string client_id (empty)][u64 ttl_seconds]
|
|
10
|
+
*/
|
|
11
|
+
encodeAcquire(route: string, ttlSecs: number): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Decode ACQUIRE response
|
|
14
|
+
* Standard response: [u8 status=0][u8 response_type][u64 fencing_token]
|
|
15
|
+
* response_type: 0=Acquired, 1=AlreadyHeld (idempotent)
|
|
16
|
+
*/
|
|
17
|
+
decodeAcquireResponse(payload: Uint8Array): AcquireResponse;
|
|
18
|
+
/**
|
|
19
|
+
* Encode EXTEND request
|
|
20
|
+
* Payload: [string route][string client_id (empty)][u64 fencing_token][u64 ttl_seconds]
|
|
21
|
+
*/
|
|
22
|
+
encodeExtend(route: string, token: bigint, ttlSecs: number): Uint8Array;
|
|
23
|
+
encodeRenew(route: string, token: bigint, ttlSecs: number): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Encode RELEASE request
|
|
26
|
+
* Payload: [string route][string client_id (empty)][u64 fencing_token]
|
|
27
|
+
*/
|
|
28
|
+
encodeRelease(route: string, token: bigint): Uint8Array;
|
|
29
|
+
/**
|
|
30
|
+
* Encode QUERY request
|
|
31
|
+
* Payload: [string route]
|
|
32
|
+
*/
|
|
33
|
+
encodeQuery(route: string): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* Decode QUERY response
|
|
36
|
+
* Free: [u8 has_holder=0][u32 pending_waiters]
|
|
37
|
+
* Held: [u8 has_holder=1][string owner_id][u64 ttl_remaining_secs][u32 pending_waiters]
|
|
38
|
+
*/
|
|
39
|
+
decodeQueryResponse(payload: Uint8Array): QueryResponse;
|
|
40
|
+
/**
|
|
41
|
+
* Encode SUBSCRIBE request
|
|
42
|
+
* Payload: [string pattern]
|
|
43
|
+
*/
|
|
44
|
+
encodeSubscribe(pattern: string): Uint8Array;
|
|
45
|
+
/**
|
|
46
|
+
* Decode SUBSCRIBE response
|
|
47
|
+
* Standard response: [u8 status=0][u64 subscription_id]
|
|
48
|
+
*/
|
|
49
|
+
decodeSubscribeResponse(payload: Uint8Array): SubscribeResponse;
|
|
50
|
+
/**
|
|
51
|
+
* Encode UNSUBSCRIBE request
|
|
52
|
+
* Payload: [string pattern]
|
|
53
|
+
*/
|
|
54
|
+
encodeUnsubscribe(pattern: string): Uint8Array;
|
|
55
|
+
/**
|
|
56
|
+
* Decode UNSUBSCRIBE response
|
|
57
|
+
* Standard response: [u8 status=0]
|
|
58
|
+
*/
|
|
59
|
+
decodeUnsubscribeResponse(payload: Uint8Array): UnsubscribeResponse;
|
|
60
|
+
/**
|
|
61
|
+
* Decode NOTIFY (409) message
|
|
62
|
+
* Payload: [u64 subscription_id][string route][bytes payload]
|
|
63
|
+
*/
|
|
64
|
+
decodeNotification(payload: Uint8Array): {
|
|
65
|
+
subId: bigint;
|
|
66
|
+
route: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/domains/lease/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEjG,eAAO,MAAM,UAAU;IACrB;;;OAGG;yBACkB,MAAM,WAAW,MAAM,GAAG,UAAU;IAQzD;;;;OAIG;mCAC4B,UAAU,GAAG,eAAe;IAyB3D;;;OAGG;wBACiB,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,UAAU;uBASpD,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,UAAU;IAItE;;;OAGG;yBACkB,MAAM,SAAS,MAAM,GAAG,UAAU;IAQvD;;;OAGG;uBACgB,MAAM,GAAG,UAAU;IAMtC;;;;OAIG;iCAC0B,UAAU,GAAG,aAAa;IA6BvD;;;OAGG;6BACsB,MAAM,GAAG,UAAU;IAM5C;;;OAGG;qCAC8B,UAAU,GAAG,iBAAiB;IAmB/D;;;OAGG;+BACwB,MAAM,GAAG,UAAU;IAM9C;;;OAGG;uCACgC,UAAU,GAAG,mBAAmB;IASnE;;;OAGG;gCACyB,UAAU,GAAG;QACvC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf;CAOF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lease domain exports
|
|
3
|
+
*/
|
|
4
|
+
export { LeaseClient } from "./client";
|
|
5
|
+
export { LeaseCodec } from "./codec";
|
|
6
|
+
export type { Lease, LeaseSubscription } from "./types";
|
|
7
|
+
export { LeaseStatus } from "./types";
|
|
8
|
+
export type { ChangeNotification, ChangeHandler, LeaseInfo, AcquireResponse, QueryResponse, SubscribeResponse, UnsubscribeResponse, } from "./types";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domains/lease/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lease domain types
|
|
3
|
+
* Per fitz-go/internal/domains/lease/lease.go
|
|
4
|
+
*/
|
|
5
|
+
import type { Connection } from "../../client/connection";
|
|
6
|
+
/**
|
|
7
|
+
* Change notification when a lease is released or expires
|
|
8
|
+
*/
|
|
9
|
+
export interface ChangeNotification {
|
|
10
|
+
route: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Handler for lease change notifications
|
|
14
|
+
*/
|
|
15
|
+
export type ChangeHandler = (notif: ChangeNotification) => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Active lease change subscription
|
|
18
|
+
*/
|
|
19
|
+
export type LeaseSubscription = ReturnType<typeof createLeaseSubscription>;
|
|
20
|
+
export declare function createLeaseSubscription(subId: bigint, pattern: string, unsubscribeFn: (subId: bigint) => Promise<void>): {
|
|
21
|
+
subId: bigint;
|
|
22
|
+
pattern: string;
|
|
23
|
+
unsubscribe: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Lease handle representing an acquired lease
|
|
27
|
+
* Provides renew() and release() methods
|
|
28
|
+
*/
|
|
29
|
+
export type Lease = ReturnType<typeof createLease>;
|
|
30
|
+
export declare function createLease(token: bigint, expiresAt: bigint, route: string, connection: Connection): {
|
|
31
|
+
extend: (ttlSecs: number, signal?: AbortSignal) => Promise<bigint>;
|
|
32
|
+
release: (signal?: AbortSignal) => Promise<void>;
|
|
33
|
+
getExpiry: () => bigint;
|
|
34
|
+
testOnlyInvalidToken: () => bigint;
|
|
35
|
+
testOnlyExtendWithToken: (tokenToUse: bigint, ttlSecs: number, signal?: AbortSignal) => Promise<bigint>;
|
|
36
|
+
testOnlyReleaseWithToken: (tokenToUse: bigint, signal?: AbortSignal) => Promise<void>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Response to ACQUIRE request
|
|
40
|
+
*/
|
|
41
|
+
export interface AcquireResponse {
|
|
42
|
+
token: bigint;
|
|
43
|
+
expiresAt?: bigint;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Lease information from QUERY request
|
|
47
|
+
*/
|
|
48
|
+
export interface LeaseInfo {
|
|
49
|
+
isHeld: boolean;
|
|
50
|
+
owner?: string;
|
|
51
|
+
token?: bigint;
|
|
52
|
+
ttlRemainingSecs?: bigint;
|
|
53
|
+
expiresAt?: bigint;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Response to QUERY request
|
|
57
|
+
*/
|
|
58
|
+
export interface QueryResponse {
|
|
59
|
+
status: number;
|
|
60
|
+
isHeld?: boolean;
|
|
61
|
+
owner?: string;
|
|
62
|
+
token?: bigint;
|
|
63
|
+
ttlRemainingSecs?: bigint;
|
|
64
|
+
expiresAt?: bigint;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Response to SUBSCRIBE request
|
|
68
|
+
*/
|
|
69
|
+
export interface SubscribeResponse {
|
|
70
|
+
status: number;
|
|
71
|
+
subId?: bigint;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Response to UNSUBSCRIBE request
|
|
75
|
+
*/
|
|
76
|
+
export interface UnsubscribeResponse {
|
|
77
|
+
status: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Lease status codes
|
|
81
|
+
*/
|
|
82
|
+
export declare enum LeaseStatus {
|
|
83
|
+
Ok = 0,
|
|
84
|
+
LeaseHeld = 1,
|
|
85
|
+
NotFound = 2,
|
|
86
|
+
InvalidToken = 3
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/domains/lease/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;;;uBAEjB,OAAO,CAAC,IAAI,CAAC;EAS5C;AAED;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAEnD,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,UAAU;sBAKS,MAAM,WAAW,WAAW,KAAG,OAAO,CAAC,MAAM,CAAC;uBAc7C,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;qBAMrC,MAAM;gCAEK,MAAM;0CAGzB,MAAM,WACT,MAAM,WACN,WAAW,KACnB,OAAO,CAAC,MAAM,CAAC;2CAeJ,MAAM,WACT,WAAW,KACnB,OAAO,CAAC,IAAI,CAAC;EAcjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,EAAE,IAAI;IACN,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,YAAY,IAAI;CACjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notice domain client.
|
|
3
|
+
*/
|
|
4
|
+
import { NoticeHandler, NoticeSubscription } from "./types";
|
|
5
|
+
import type { Connection as ConnectionType } from "../../client/connection";
|
|
6
|
+
export type NoticeClient = ReturnType<typeof createNoticeClient>;
|
|
7
|
+
export declare function createNoticeClient(connection: ConnectionType): {
|
|
8
|
+
publish: (route: string, body: Uint8Array) => Promise<void>;
|
|
9
|
+
subscribe: (pattern: string, handler: NoticeHandler) => Promise<NoticeSubscription>;
|
|
10
|
+
};
|
|
11
|
+
type NoticeClientConstructor = {
|
|
12
|
+
new (connection: ConnectionType): NoticeClient;
|
|
13
|
+
(connection: ConnectionType): NoticeClient;
|
|
14
|
+
};
|
|
15
|
+
export declare const NoticeClient: NoticeClientConstructor;
|
|
16
|
+
export * from "./types";
|
|
17
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/domains/notice/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAA4B,aAAa,EAAa,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAO5E,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc;qBA6B7B,MAAM,QAAQ,UAAU,KAAG,OAAO,CAAC,IAAI,CAAC;yBAe3D,MAAM,WACN,aAAa,KACrB,OAAO,CAAC,kBAAkB,CAAC;EA+F/B;AAED,KAAK,uBAAuB,GAAG;IAC7B,KAAK,UAAU,EAAE,cAAc,GAAG,YAAY,CAAC;IAC/C,CAAC,UAAU,EAAE,cAAc,GAAG,YAAY,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,uBAEY,CAAC;AAExC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notice domain codec for encoding/decoding messages
|
|
3
|
+
* Per fitz-go/internal/domains/notice/protocol.go
|
|
4
|
+
*/
|
|
5
|
+
import { SubscribeResponse, UnsubscribeResponse } from "./types";
|
|
6
|
+
export declare const NoticeCodec: {
|
|
7
|
+
/**
|
|
8
|
+
* Encode PUBLISH request (fire-and-forget, no response)
|
|
9
|
+
* Payload: [string route][bytes body]
|
|
10
|
+
*/
|
|
11
|
+
encodePublish(route: string, body: Uint8Array): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Encode SUBSCRIBE request
|
|
14
|
+
* Payload: [string pattern]
|
|
15
|
+
*/
|
|
16
|
+
encodeSubscribe(pattern: string): Uint8Array;
|
|
17
|
+
/**
|
|
18
|
+
* Decode SUBSCRIBE response
|
|
19
|
+
* Standard response: [u8 status=0][u8 has_sub_id][u64 sub_id if has=1]
|
|
20
|
+
*/
|
|
21
|
+
decodeSubscribeResponse(payload: Uint8Array): SubscribeResponse;
|
|
22
|
+
/**
|
|
23
|
+
* Encode UNSUBSCRIBE request
|
|
24
|
+
* Payload: [u64 subscription_id]
|
|
25
|
+
*/
|
|
26
|
+
encodeUnsubscribe(subId: bigint): Uint8Array;
|
|
27
|
+
/**
|
|
28
|
+
* Decode UNSUBSCRIBE response
|
|
29
|
+
* Standard response: [u8 status=0]
|
|
30
|
+
*/
|
|
31
|
+
decodeUnsubscribeResponse(): UnsubscribeResponse;
|
|
32
|
+
/**
|
|
33
|
+
* Decode NOTIFY (504) message
|
|
34
|
+
* Payload: [u64 subscription_id][string route][bytes body]
|
|
35
|
+
*/
|
|
36
|
+
decodeNotification(payload: Uint8Array): {
|
|
37
|
+
subId: bigint;
|
|
38
|
+
route: string;
|
|
39
|
+
body: Uint8Array;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/domains/notice/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEjE,eAAO,MAAM,WAAW;IACtB;;;OAGG;yBACkB,MAAM,QAAQ,UAAU,GAAG,UAAU;IAQ1D;;;OAGG;6BACsB,MAAM,GAAG,UAAU;IAM5C;;;OAGG;qCAC8B,UAAU,GAAG,iBAAiB;IAqB/D;;;OAGG;6BACsB,MAAM,GAAG,UAAU;IAM5C;;;OAGG;iCAC0B,mBAAmB;IAIhD;;;OAGG;gCACyB,UAAU,GAAG;QACvC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,UAAU,CAAC;KAClB;CASF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notice domain exports
|
|
3
|
+
*/
|
|
4
|
+
export { NoticeClient } from "./client";
|
|
5
|
+
export { NoticeCodec } from "./codec";
|
|
6
|
+
export type { NoticeSubscription } from "./types";
|
|
7
|
+
export { NoticeStatus } from "./types";
|
|
8
|
+
export type { NoticeMsg, NoticeHandler, SubscribeResponse, UnsubscribeResponse } from "./types";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domains/notice/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notice domain types (Pub/Sub)
|
|
3
|
+
* Per fitz-go/internal/domains/notice/notice.go
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Received notification message
|
|
7
|
+
*/
|
|
8
|
+
export interface NoticeMsg {
|
|
9
|
+
route: string;
|
|
10
|
+
body: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Handler for incoming notifications
|
|
14
|
+
*/
|
|
15
|
+
export type NoticeHandler = (msg: NoticeMsg) => Promise<void> | void;
|
|
16
|
+
/**
|
|
17
|
+
* Active notice subscription
|
|
18
|
+
*/
|
|
19
|
+
export type NoticeSubscription = ReturnType<typeof createNoticeSubscription>;
|
|
20
|
+
export declare function createNoticeSubscription(subId: bigint, pattern: string, unsubscribeFn: (subId: bigint) => Promise<void>): {
|
|
21
|
+
subId: bigint;
|
|
22
|
+
pattern: string;
|
|
23
|
+
unsubscribe: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Response to SUBSCRIBE request
|
|
27
|
+
*/
|
|
28
|
+
export interface SubscribeResponse {
|
|
29
|
+
status: number;
|
|
30
|
+
subId?: bigint;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Response to UNSUBSCRIBE request
|
|
34
|
+
*/
|
|
35
|
+
export interface UnsubscribeResponse {
|
|
36
|
+
status: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Notice status codes
|
|
40
|
+
*/
|
|
41
|
+
export declare enum NoticeStatus {
|
|
42
|
+
Ok = 0
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/domains/notice/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE7E,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;;;uBAEjB,OAAO,CAAC,IAAI,CAAC;EAS5C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,EAAE,IAAI;CACP"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue domain client.
|
|
3
|
+
*/
|
|
4
|
+
import type { Connection } from "../../client/connection";
|
|
5
|
+
import { AvailabilityHandler, EnqueueOptions, QueueItem, QueueSubscription } from "./types";
|
|
6
|
+
export type QueueClient = ReturnType<typeof createQueueClient>;
|
|
7
|
+
export declare function createQueueClient(connection: Connection): {
|
|
8
|
+
enqueue: (route: string, body: Uint8Array, options?: EnqueueOptions) => Promise<bigint>;
|
|
9
|
+
reserve: (route: string, leaseSeconds: number, batchSize?: number, waitSeconds?: number) => Promise<QueueItem[]>;
|
|
10
|
+
subscribe: (pattern: string, handler: AvailabilityHandler) => Promise<QueueSubscription>;
|
|
11
|
+
};
|
|
12
|
+
type QueueClientConstructor = {
|
|
13
|
+
new (connection: Connection): QueueClient;
|
|
14
|
+
(connection: Connection): QueueClient;
|
|
15
|
+
};
|
|
16
|
+
export declare const QueueClient: QueueClientConstructor;
|
|
17
|
+
export * from "./types";
|
|
18
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/domains/queue/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAW1D,OAAO,EACL,mBAAmB,EAEnB,cAAc,EACd,SAAS,EAET,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAOjB,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU;qBA8B7C,MAAM,QACP,UAAU,YACN,cAAc,KACvB,OAAO,CAAC,MAAM,CAAC;qBAeT,MAAM,gBACC,MAAM,cACT,MAAM,gBACJ,MAAM,KAClB,OAAO,CAAC,SAAS,EAAE,CAAC;yBA6EZ,MAAM,WACN,mBAAmB,KAC3B,OAAO,CAAC,iBAAiB,CAAC;EA2I9B;AAED,KAAK,sBAAsB,GAAG;IAC5B,KAAK,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC;IAC1C,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,sBAEY,CAAC;AAEvC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue domain codec for encoding and decoding protocol messages.
|
|
3
|
+
*/
|
|
4
|
+
import { BufferReader } from "../../core/buffer";
|
|
5
|
+
import { QueueEnqueueResponse, QueueReserveResponse, QueueCompleteResponse, QueueExtendResponse, QueueSubscribeResponse, QueueUnsubscribeResponse, EnqueueOptions } from "./types";
|
|
6
|
+
export declare const QueueCodec: {
|
|
7
|
+
/**
|
|
8
|
+
* Encode ENQUEUE request.
|
|
9
|
+
* Payload: [route: string][body_len: u32][body: bytes][has_delay: u8][delay_seconds: u64 if has_delay]
|
|
10
|
+
*/
|
|
11
|
+
encodeEnqueue(route: string, body: Uint8Array, options?: EnqueueOptions): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Decode ENQUEUE response.
|
|
14
|
+
* Payload: [status: u8][message_id: u64]
|
|
15
|
+
*/
|
|
16
|
+
decodeEnqueueResponse(payload: Uint8Array): QueueEnqueueResponse;
|
|
17
|
+
/**
|
|
18
|
+
* Encode RESERVE request.
|
|
19
|
+
* Payload: [route: string][lease_seconds: u64][has_batch_size: u8][batch_size: u32]
|
|
20
|
+
*
|
|
21
|
+
* Long polling is handled client-side by QueueClient.reserve().
|
|
22
|
+
*/
|
|
23
|
+
encodeReserve(route: string, leaseSeconds: number, batchSize?: number): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Decode RESERVE response.
|
|
26
|
+
* Payload: [status: u8][lease_count: u32]([message_id: u64][lease_token: u64][body_len: u32][body: bytes] ...)
|
|
27
|
+
*/
|
|
28
|
+
decodeReserveResponse(payload: Uint8Array): QueueReserveResponse;
|
|
29
|
+
/**
|
|
30
|
+
* Encode COMPLETE request.
|
|
31
|
+
* Payload: [route: string][message_id: u64][lease_token: u64]
|
|
32
|
+
*/
|
|
33
|
+
encodeComplete(route: string, messageId: bigint, leaseToken: bigint): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* Decode COMPLETE response.
|
|
36
|
+
* Payload: [status: u8]
|
|
37
|
+
*/
|
|
38
|
+
decodeCompleteResponse(payload: Uint8Array): QueueCompleteResponse;
|
|
39
|
+
/**
|
|
40
|
+
* Encode EXTEND request.
|
|
41
|
+
* Payload: [route: string][message_id: u64][lease_token: u64][lease_seconds: u64]
|
|
42
|
+
*/
|
|
43
|
+
encodeExtend(route: string, messageId: bigint, leaseToken: bigint, leaseSeconds: number): Uint8Array;
|
|
44
|
+
/**
|
|
45
|
+
* Decode EXTEND response.
|
|
46
|
+
* Payload: [status: u8]
|
|
47
|
+
*/
|
|
48
|
+
decodeExtendResponse(payload: Uint8Array): QueueExtendResponse;
|
|
49
|
+
/**
|
|
50
|
+
* Encode SUBSCRIBE request.
|
|
51
|
+
* Payload: [pattern: string]
|
|
52
|
+
*/
|
|
53
|
+
encodeSubscribe(pattern: string): Uint8Array;
|
|
54
|
+
/**
|
|
55
|
+
* Decode SUBSCRIBE response.
|
|
56
|
+
* Payload: [status: u8][sub_id: u64]
|
|
57
|
+
*/
|
|
58
|
+
decodeSubscribeResponse(payload: Uint8Array): QueueSubscribeResponse;
|
|
59
|
+
/**
|
|
60
|
+
* Encode UNSUBSCRIBE request.
|
|
61
|
+
* Payload: [pattern: string]
|
|
62
|
+
*/
|
|
63
|
+
encodeUnsubscribe(pattern: string): Uint8Array;
|
|
64
|
+
/**
|
|
65
|
+
* Decode UNSUBSCRIBE response.
|
|
66
|
+
* Payload: [status: u8]
|
|
67
|
+
*/
|
|
68
|
+
decodeUnsubscribeResponse(payload: Uint8Array): QueueUnsubscribeResponse;
|
|
69
|
+
/**
|
|
70
|
+
* Decode notification payload.
|
|
71
|
+
* Payload: [sub_id: u64][route: string]
|
|
72
|
+
*/
|
|
73
|
+
decodeNotification(payload: Uint8Array): {
|
|
74
|
+
subId: bigint;
|
|
75
|
+
route: string;
|
|
76
|
+
};
|
|
77
|
+
decodeErrorResponse(reader: BufferReader): {
|
|
78
|
+
errorCode?: number;
|
|
79
|
+
errorMessage?: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/domains/queue/codec.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAgB,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,UAAU;IACrB;;;OAGG;yBACkB,MAAM,QAAQ,UAAU,YAAY,cAAc,GAAG,UAAU;IAgBpF;;;OAGG;mCAC4B,UAAU,GAAG,oBAAoB;IAchE;;;;;OAKG;yBACkB,MAAM,gBAAgB,MAAM,cAAc,MAAM,GAAG,UAAU;IAclF;;;OAGG;mCAC4B,UAAU,GAAG,oBAAoB;IA2BhE;;;OAGG;0BACmB,MAAM,aAAa,MAAM,cAAc,MAAM,GAAG,UAAU;IAQhF;;;OAGG;oCAC6B,UAAU,GAAG,qBAAqB;IAUlE;;;OAGG;wBAEM,MAAM,aACF,MAAM,cACL,MAAM,gBACJ,MAAM,GACnB,UAAU;IASb;;;OAGG;kCAC2B,UAAU,GAAG,mBAAmB;IAU9D;;;OAGG;6BACsB,MAAM,GAAG,UAAU;IAM5C;;;OAGG;qCAC8B,UAAU,GAAG,sBAAsB;IAyBpE;;;OAGG;+BACwB,MAAM,GAAG,UAAU;IAM9C;;;OAGG;uCACgC,UAAU,GAAG,wBAAwB;IAUxE;;;OAGG;gCACyB,UAAU,GAAG;QACvC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf;gCAQ2B,YAAY,GAAG;QACzC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;CAgBF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue domain exports
|
|
3
|
+
*/
|
|
4
|
+
export { QueueClient } from "./client";
|
|
5
|
+
export { QueueCodec } from "./codec";
|
|
6
|
+
export type { QueueItem, QueueSubscription } from "./types";
|
|
7
|
+
export { QueueStatus } from "./types";
|
|
8
|
+
export type { EnqueueOptions, QueueEnqueueResponse, QueueReserveResponse, QueueExtendResponse, QueueCompleteResponse, QueueSubscribeResponse, QueueUnsubscribeResponse, AvailabilityNotification, AvailabilityHandler, } from "./types";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domains/queue/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|