@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.
Files changed (103) hide show
  1. package/LICENSE +160 -0
  2. package/README.md +195 -0
  3. package/dist/index.cjs +5285 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.mjs +5222 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/types/client/client.d.ts +35 -0
  8. package/dist/types/client/client.d.ts.map +1 -0
  9. package/dist/types/client/connection.d.ts +57 -0
  10. package/dist/types/client/connection.d.ts.map +1 -0
  11. package/dist/types/client/multiplexer.d.ts +65 -0
  12. package/dist/types/client/multiplexer.d.ts.map +1 -0
  13. package/dist/types/core/buffer.d.ts +63 -0
  14. package/dist/types/core/buffer.d.ts.map +1 -0
  15. package/dist/types/core/errors.d.ts +94 -0
  16. package/dist/types/core/errors.d.ts.map +1 -0
  17. package/dist/types/core/iterator.d.ts +66 -0
  18. package/dist/types/core/iterator.d.ts.map +1 -0
  19. package/dist/types/core/lifecycle.d.ts +41 -0
  20. package/dist/types/core/lifecycle.d.ts.map +1 -0
  21. package/dist/types/core/task-group.d.ts +23 -0
  22. package/dist/types/core/task-group.d.ts.map +1 -0
  23. package/dist/types/core/types.d.ts +92 -0
  24. package/dist/types/core/types.d.ts.map +1 -0
  25. package/dist/types/domains/_routes.d.ts +10 -0
  26. package/dist/types/domains/_routes.d.ts.map +1 -0
  27. package/dist/types/domains/base.d.ts +26 -0
  28. package/dist/types/domains/base.d.ts.map +1 -0
  29. package/dist/types/domains/kv/client.d.ts +18 -0
  30. package/dist/types/domains/kv/client.d.ts.map +1 -0
  31. package/dist/types/domains/kv/codec.d.ts +22 -0
  32. package/dist/types/domains/kv/codec.d.ts.map +1 -0
  33. package/dist/types/domains/kv/transaction.d.ts +19 -0
  34. package/dist/types/domains/kv/transaction.d.ts.map +1 -0
  35. package/dist/types/domains/kv/types.d.ts +47 -0
  36. package/dist/types/domains/kv/types.d.ts.map +1 -0
  37. package/dist/types/domains/lease/client.d.ts +18 -0
  38. package/dist/types/domains/lease/client.d.ts.map +1 -0
  39. package/dist/types/domains/lease/codec.d.ts +69 -0
  40. package/dist/types/domains/lease/codec.d.ts.map +1 -0
  41. package/dist/types/domains/lease/index.d.ts +9 -0
  42. package/dist/types/domains/lease/index.d.ts.map +1 -0
  43. package/dist/types/domains/lease/types.d.ts +88 -0
  44. package/dist/types/domains/lease/types.d.ts.map +1 -0
  45. package/dist/types/domains/notice/client.d.ts +17 -0
  46. package/dist/types/domains/notice/client.d.ts.map +1 -0
  47. package/dist/types/domains/notice/codec.d.ts +42 -0
  48. package/dist/types/domains/notice/codec.d.ts.map +1 -0
  49. package/dist/types/domains/notice/index.d.ts +9 -0
  50. package/dist/types/domains/notice/index.d.ts.map +1 -0
  51. package/dist/types/domains/notice/types.d.ts +44 -0
  52. package/dist/types/domains/notice/types.d.ts.map +1 -0
  53. package/dist/types/domains/queue/client.d.ts +18 -0
  54. package/dist/types/domains/queue/client.d.ts.map +1 -0
  55. package/dist/types/domains/queue/codec.d.ts +82 -0
  56. package/dist/types/domains/queue/codec.d.ts.map +1 -0
  57. package/dist/types/domains/queue/index.d.ts +9 -0
  58. package/dist/types/domains/queue/index.d.ts.map +1 -0
  59. package/dist/types/domains/queue/types.d.ts +97 -0
  60. package/dist/types/domains/queue/types.d.ts.map +1 -0
  61. package/dist/types/domains/rpc/client.d.ts +17 -0
  62. package/dist/types/domains/rpc/client.d.ts.map +1 -0
  63. package/dist/types/domains/rpc/codec.d.ts +82 -0
  64. package/dist/types/domains/rpc/codec.d.ts.map +1 -0
  65. package/dist/types/domains/rpc/index.d.ts +8 -0
  66. package/dist/types/domains/rpc/index.d.ts.map +1 -0
  67. package/dist/types/domains/rpc/types.d.ts +67 -0
  68. package/dist/types/domains/rpc/types.d.ts.map +1 -0
  69. package/dist/types/domains/schedule/client.d.ts +19 -0
  70. package/dist/types/domains/schedule/client.d.ts.map +1 -0
  71. package/dist/types/domains/schedule/codec.d.ts +63 -0
  72. package/dist/types/domains/schedule/codec.d.ts.map +1 -0
  73. package/dist/types/domains/schedule/index.d.ts +8 -0
  74. package/dist/types/domains/schedule/index.d.ts.map +1 -0
  75. package/dist/types/domains/schedule/types.d.ts +69 -0
  76. package/dist/types/domains/schedule/types.d.ts.map +1 -0
  77. package/dist/types/domains/stream/client.d.ts +27 -0
  78. package/dist/types/domains/stream/client.d.ts.map +1 -0
  79. package/dist/types/domains/stream/codec.d.ts +124 -0
  80. package/dist/types/domains/stream/codec.d.ts.map +1 -0
  81. package/dist/types/domains/stream/index.d.ts +8 -0
  82. package/dist/types/domains/stream/index.d.ts.map +1 -0
  83. package/dist/types/domains/stream/session.d.ts +8 -0
  84. package/dist/types/domains/stream/session.d.ts.map +1 -0
  85. package/dist/types/domains/stream/types.d.ts +150 -0
  86. package/dist/types/domains/stream/types.d.ts.map +1 -0
  87. package/dist/types/frame/codec.d.ts +29 -0
  88. package/dist/types/frame/codec.d.ts.map +1 -0
  89. package/dist/types/frame/types.d.ts +71 -0
  90. package/dist/types/frame/types.d.ts.map +1 -0
  91. package/dist/types/index.d.ts +25 -0
  92. package/dist/types/index.d.ts.map +1 -0
  93. package/dist/types/protocol/response.d.ts +27 -0
  94. package/dist/types/protocol/response.d.ts.map +1 -0
  95. package/dist/types/transport/factory.d.ts +6 -0
  96. package/dist/types/transport/factory.d.ts.map +1 -0
  97. package/dist/types/transport/tcp.d.ts +6 -0
  98. package/dist/types/transport/tcp.d.ts.map +1 -0
  99. package/dist/types/transport/types.d.ts +17 -0
  100. package/dist/types/transport/types.d.ts.map +1 -0
  101. package/dist/types/transport/websocket.d.ts +6 -0
  102. package/dist/types/transport/websocket.d.ts.map +1 -0
  103. package/package.json +72 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Queue domain types
3
+ * Per fitz-go/internal/domains/queue/queue.go
4
+ */
5
+ import { Connection } from "../../client/connection";
6
+ /**
7
+ * Queue item represents a reserved queue message.
8
+ * It carries the route and token required for `extend()` and `complete()`.
9
+ */
10
+ export type QueueItem = ReturnType<typeof createQueueItem>;
11
+ export declare function createQueueItem(id: bigint, token: bigint, body: Uint8Array, route: string, connection: Connection): {
12
+ body: Uint8Array<ArrayBufferLike>;
13
+ extend: (leaseSecs: number, signal?: AbortSignal) => Promise<void>;
14
+ complete: (signal?: AbortSignal) => Promise<void>;
15
+ testOnlyInvalidToken: () => bigint;
16
+ testOnlyCompleteWithToken: (tokenToUse: bigint, signal?: AbortSignal) => Promise<void>;
17
+ };
18
+ /**
19
+ * Availability notification from a queue.
20
+ */
21
+ export interface AvailabilityNotification {
22
+ route: string;
23
+ }
24
+ /**
25
+ * Handler for availability notifications.
26
+ */
27
+ export type AvailabilityHandler = (notification: AvailabilityNotification) => void | Promise<void>;
28
+ /**
29
+ * Queue availability subscription.
30
+ */
31
+ export type QueueSubscription = ReturnType<typeof createQueueSubscription>;
32
+ export declare function createQueueSubscription(subId: bigint, pattern: string, unsubscribeFn: (subId: bigint) => Promise<void>): {
33
+ subId: bigint;
34
+ pattern: string;
35
+ unsubscribe: () => Promise<void>;
36
+ };
37
+ /**
38
+ * Queue operation status codes
39
+ */
40
+ export declare enum QueueStatus {
41
+ Ok = 0,
42
+ QueueNotFound = 1,
43
+ MessageNotFound = 2,
44
+ InvalidToken = 3,
45
+ QueueFull = 4,
46
+ InvalidDelay = 5
47
+ }
48
+ /**
49
+ * Options for enqueue operations.
50
+ */
51
+ export interface EnqueueOptions {
52
+ priority?: number;
53
+ delayMs?: number;
54
+ ttlMs?: number;
55
+ }
56
+ /**
57
+ * Internal codec response types.
58
+ */
59
+ export interface QueueEnqueueResponse {
60
+ status: number;
61
+ messageId?: bigint;
62
+ errorCode?: number;
63
+ errorMessage?: string;
64
+ }
65
+ export interface QueueReserveResponse {
66
+ status: number;
67
+ items?: Array<{
68
+ id: bigint;
69
+ token: bigint;
70
+ body: Uint8Array;
71
+ }>;
72
+ cursor?: Uint8Array;
73
+ errorCode?: number;
74
+ errorMessage?: string;
75
+ }
76
+ export interface QueueExtendResponse {
77
+ status: number;
78
+ errorCode?: number;
79
+ errorMessage?: string;
80
+ }
81
+ export interface QueueCompleteResponse {
82
+ status: number;
83
+ errorCode?: number;
84
+ errorMessage?: string;
85
+ }
86
+ export interface QueueSubscribeResponse {
87
+ status: number;
88
+ subId?: bigint;
89
+ errorCode?: number;
90
+ errorMessage?: string;
91
+ }
92
+ export interface QueueUnsubscribeResponse {
93
+ status: number;
94
+ errorCode?: number;
95
+ errorMessage?: string;
96
+ }
97
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/domains/queue/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAE3D,wBAAgB,eAAe,CAC7B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,UAAU;;wBAEW,MAAM,WAAW,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;wBAa5C,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;gCAa3B,MAAM;4CAGzB,MAAM,WACT,WAAW,KACnB,OAAO,CAAC,IAAI,CAAC;EAoBjB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,wBAAwB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnG;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3E,wBAAgB,uBAAuB,CACrC,KAAK,EA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AAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * RPC domain client.
3
+ */
4
+ import { RequestOptions, ResponseFrame, RpcHandler, RpcSubscription } from "./types";
5
+ import type { Connection } from "../../client/connection";
6
+ export type RpcClient = ReturnType<typeof createRpcClient>;
7
+ type RpcClientConstructor = {
8
+ new (connection: Connection): RpcClient;
9
+ (connection: Connection): RpcClient;
10
+ };
11
+ export declare const RpcClient: RpcClientConstructor;
12
+ export declare function createRpcClient(connection: Connection): {
13
+ call: (route: string, body: Uint8Array, options?: RequestOptions) => Promise<AsyncIterableIterator<ResponseFrame>>;
14
+ registerWorker: (route: string, handler: RpcHandler) => Promise<RpcSubscription>;
15
+ };
16
+ export * from "./types";
17
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/domains/rpc/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,eAAe,EAIhB,MAAM,SAAS,CAAC;AAiBjB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAuN1D,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAE3D,KAAK,oBAAoB,GAAG;IAC1B,KAAK,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACxC,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,oBAEY,CAAC;AAErC,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU;kBAwC3C,MAAM,QACP,UAAU,YACN,cAAc,KACvB,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;4BAoCX,MAAM,WAAW,UAAU,KAAG,OAAO,CAAC,eAAe,CAAC;EAoJ5F;AAED,cAAc,SAAS,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * RPC domain codec for encoding/decoding messages
3
+ * Per fitz-go/internal/domains/rpc/protocol.go
4
+ */
5
+ import { SubscribeResponse, UnsubscribeResponse } from "./types";
6
+ export declare const acquirePooledCorrelationId: () => Uint8Array;
7
+ export declare const releasePooledCorrelationId: (correlationId: Uint8Array) => void;
8
+ export declare const RpcCodec: {
9
+ /**
10
+ * Generate a random 16-byte correlation ID
11
+ * Per fitz-go rpc.go: crypto/rand.Read(correlationID[:])
12
+ */
13
+ generateCorrelationId(): Uint8Array;
14
+ /**
15
+ * Encode RPC_REQUEST (302)
16
+ * Payload: [bytes correlation_id][string route][string reply_route][bytes body]
17
+ * Where bytes/string = [u32 BE len][data]
18
+ */
19
+ encodeRequest(correlationId: Uint8Array, route: string, replyRoute: string, body: Uint8Array): Uint8Array;
20
+ encodeCallRequest(correlationId: Uint8Array, route: string, body: Uint8Array): Uint8Array;
21
+ /**
22
+ * Decode RPC_REQUEST response (standard [u8 status][payload])
23
+ * Just validates OK status; no additional payload expected
24
+ */
25
+ decodeRequestResponse(payload: Uint8Array): {
26
+ status: number;
27
+ };
28
+ /**
29
+ * Encode RPC_RESPONSE (303)
30
+ * Payload: [bytes correlation_id][u64 sequence][bytes body][u8 stream_end]
31
+ */
32
+ encodeResponse(correlationId: Uint8Array, sequence: bigint, body: Uint8Array, streamEnd: boolean): Uint8Array;
33
+ decodeResponse(payload: Uint8Array): {
34
+ correlationId: Uint8Array;
35
+ sequence: bigint;
36
+ body: Uint8Array;
37
+ streamEnd: boolean;
38
+ };
39
+ decodeResponseKey(payload: Uint8Array): {
40
+ correlationKey: bigint;
41
+ sequence: bigint;
42
+ body: Uint8Array;
43
+ streamEnd: boolean;
44
+ };
45
+ /**
46
+ * Encode RPC_SUBSCRIBE_WORKER (304)
47
+ * Payload: [string worker_route]
48
+ */
49
+ encodeSubscribeWorker(route: string): Uint8Array;
50
+ /**
51
+ * Decode SUBSCRIBE_WORKER response (standard [u8 status])
52
+ */
53
+ decodeSubscribeWorkerResponse(payload: Uint8Array): SubscribeResponse;
54
+ /**
55
+ * Encode RPC_UNSUBSCRIBE_WORKER (305)
56
+ * Payload: [string worker_route]
57
+ */
58
+ encodeUnsubscribeWorker(route: string): Uint8Array;
59
+ /**
60
+ * Decode UNSUBSCRIBE_WORKER response (standard [u8 status])
61
+ */
62
+ decodeUnsubscribeWorkerResponse(payload: Uint8Array): UnsubscribeResponse;
63
+ /**
64
+ * Decode a standard RPC error body.
65
+ * Format: [u8 status=1][u32 error_code][string message]
66
+ */
67
+ decodeErrorBody(payload: Uint8Array): {
68
+ code: number;
69
+ message: string;
70
+ } | null;
71
+ /**
72
+ * Decode incoming RPC_REQUEST (302) for worker mode
73
+ * Payload: [u32 corrLen=16][16 bytes correlation_id][string route][string reply_route][bytes body]
74
+ */
75
+ decodeInboundRequest(payload: Uint8Array): {
76
+ correlationId: Uint8Array;
77
+ route: string;
78
+ replyRoute: string;
79
+ body: Uint8Array;
80
+ };
81
+ };
82
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/domains/rpc/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAqBjE,eAAO,MAAM,0BAA0B,QAAO,UAG7C,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,eAAe,UAAU,KAAG,IAQtE,CAAC;AAiCF,eAAO,MAAM,QAAQ;IACnB;;;OAGG;6BACsB,UAAU;IAMnC;;;;OAIG;iCAEc,UAAU,SAClB,MAAM,cACD,MAAM,QACZ,UAAU,GACf,UAAU;qCA4BoB,UAAU,SAAS,MAAM,QAAQ,UAAU,GAAG,UAAU;IA4BzF;;;OAGG;mCAC4B,UAAU,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAW9D;;;OAGG;kCAEc,UAAU,YACf,MAAM,QACV,UAAU,aACL,OAAO,GACjB,UAAU;4BA8BW,UAAU,GAAG;QACnC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,UAAU,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;KACpB;+BAgD0B,UAAU,GAAG;QACtC,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,UAAU,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;KACpB;IAiDD;;;OAGG;iCAC0B,MAAM,GAAG,UAAU;IAIhD;;OAEG;2CACoC,UAAU,GAAG,iBAAiB;IAWrE;;;OAGG;mCAC4B,MAAM,GAAG,UAAU;IAIlD;;OAEG;6CACsC,UAAU,GAAG,mBAAmB;IAWzE;;;OAGG;6BACsB,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAmB9E;;;OAGG;kCAC2B,UAAU,GAAG;QACzC,aAAa,EAAE,UAAU,CAAC;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,UAAU,CAAC;KAClB;CA4CF,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * RPC domain exports
3
+ */
4
+ export { RpcClient } from "./client";
5
+ export { RpcCodec } from "./codec";
6
+ export type { RpcSubscription } from "./types";
7
+ export { RpcStatus, type ResponseFrame, type InboundRequest, type ResponseWriter, type RpcHandler, type RequestOptions, } from "./types";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domains/rpc/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * RPC domain types
3
+ * Per fitz-go/internal/domains/rpc/rpc.go
4
+ */
5
+ /**
6
+ * Single response frame from a streaming RPC call
7
+ */
8
+ export interface ResponseFrame {
9
+ body: Uint8Array;
10
+ sequence: bigint;
11
+ }
12
+ /**
13
+ * Inbound RPC request received by a worker
14
+ */
15
+ export interface InboundRequest {
16
+ route: string;
17
+ replyRoute: string;
18
+ body: Uint8Array;
19
+ }
20
+ /**
21
+ * Allows a worker to send responses back to the caller
22
+ */
23
+ export interface ResponseWriter {
24
+ send(body: Uint8Array, isEnd: boolean): Promise<void>;
25
+ }
26
+ /**
27
+ * Handler for incoming RPC requests (worker mode)
28
+ */
29
+ export type RpcHandler = (req: InboundRequest, writer: ResponseWriter) => Promise<void>;
30
+ /**
31
+ * Active worker registration
32
+ */
33
+ export type RpcSubscription = ReturnType<typeof createRpcSubscription>;
34
+ export declare function createRpcSubscription(route: string, unsubscribeFn: (route: string) => Promise<void>): {
35
+ route: string;
36
+ unsubscribe: () => Promise<void>;
37
+ };
38
+ /**
39
+ * RPC request options
40
+ */
41
+ export interface RequestOptions {
42
+ timeoutMs?: number;
43
+ signal?: AbortSignal;
44
+ }
45
+ /**
46
+ * RPC status codes (from server responses)
47
+ */
48
+ export declare enum RpcStatus {
49
+ Ok = 0,
50
+ Timeout = 1,
51
+ HandlerNotFound = 2,
52
+ HandlerError = 3,
53
+ InvalidRequest = 4
54
+ }
55
+ /**
56
+ * Response to RPC_SUBSCRIBE request
57
+ */
58
+ export interface SubscribeResponse {
59
+ status: number;
60
+ }
61
+ /**
62
+ * Response to RPC_UNSUBSCRIBE request
63
+ */
64
+ export interface UnsubscribeResponse {
65
+ status: number;
66
+ }
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/domains/rpc/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;;uBAEjB,OAAO,CAAC,IAAI,CAAC;EAQ5C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,EAAE,IAAI;IACN,OAAO,IAAI;IACX,eAAe,IAAI;IACnB,YAAY,IAAI;IAChB,cAAc,IAAI;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Schedule domain client.
3
+ */
4
+ import type { Connection } from "../../client/connection";
5
+ import { ScheduleEntry, ScheduleHandler, ScheduleSubscription } from "./types";
6
+ export type ScheduleClient = ReturnType<typeof createScheduleClient>;
7
+ export declare function createScheduleClient(connection: Connection): {
8
+ create: (route: string, cronExpr: string, payload?: Uint8Array) => Promise<string>;
9
+ cancel: (route: string) => Promise<void>;
10
+ list: (offset?: bigint, limit?: bigint) => Promise<[ScheduleEntry[], bigint]>;
11
+ subscribe: (pattern: string, handler: ScheduleHandler) => Promise<ScheduleSubscription>;
12
+ };
13
+ type ScheduleClientConstructor = {
14
+ new (connection: Connection): ScheduleClient;
15
+ (connection: Connection): ScheduleClient;
16
+ };
17
+ export declare const ScheduleClient: ScheduleClientConstructor;
18
+ export * from "./types";
19
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/domains/schedule/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAW1D,OAAO,EACL,aAAa,EAEb,eAAe,EAEf,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAQjB,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAErE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU;oBA8BhD,MAAM,YACH,MAAM,YACP,UAAU,KAClB,OAAO,CAAC,MAAM,CAAC;oBAWW,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;oBAQzC,MAAM,UACP,MAAM,KACZ,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE,MAAM,CAAC,CAAC;yBAO1B,MAAM,WACN,eAAe,KACvB,OAAO,CAAC,oBAAoB,CAAC;EA+HjC;AAED,KAAK,yBAAyB,GAAG;IAC/B,KAAK,UAAU,EAAE,UAAU,GAAG,cAAc,CAAC;IAC7C,CAAC,UAAU,EAAE,UAAU,GAAG,cAAc,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,yBAEY,CAAC;AAE1C,cAAc,SAAS,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Schedule domain codec for encoding/decoding messages
3
+ * Per fitz-go/internal/domains/schedule
4
+ */
5
+ import { DecodedScheduleNotification, ScheduleCreateResponse, ScheduleCancelResponse, ScheduleListResponse, ScheduleSubscribeResponse, ScheduleUnsubscribeResponse } from "./types";
6
+ export declare const ScheduleCodec: {
7
+ /**
8
+ * Encode CREATE request
9
+ * Payload: [route: string][cron: string][payload: bytes]
10
+ */
11
+ encodeCreate(route: string, cronExpr: string, payload: Uint8Array): Uint8Array;
12
+ /**
13
+ * Decode CREATE response
14
+ * Success payload: [optional has_schedule_id: u8][schedule_id: string if has=1]
15
+ */
16
+ decodeCreateResponse(data: Uint8Array): ScheduleCreateResponse;
17
+ /**
18
+ * Encode CANCEL request
19
+ * Payload: [route: string]
20
+ */
21
+ encodeCancel(route: string): Uint8Array;
22
+ /**
23
+ * Decode CANCEL response
24
+ * Success payload: empty
25
+ */
26
+ decodeCancelResponse(_data: Uint8Array): ScheduleCancelResponse;
27
+ /**
28
+ * Encode LIST request
29
+ * Payload: [optional offset: u64][optional limit: u64]
30
+ */
31
+ encodeList(offset?: bigint, limit?: bigint): Uint8Array;
32
+ /**
33
+ * Decode LIST response
34
+ * Success payload: [total_count: u64][has_entry: u8]...[route: string][cron: string][payload: bytes when has_entry=1]
35
+ */
36
+ decodeListResponse(data: Uint8Array): ScheduleListResponse;
37
+ /**
38
+ * Encode SUBSCRIBE request
39
+ * Payload: [pattern: string]
40
+ */
41
+ encodeSubscribe(pattern: string): Uint8Array;
42
+ /**
43
+ * Decode SUBSCRIBE response
44
+ * Success payload: [has_sub_id: u8][sub_id: u64 if has=1]
45
+ */
46
+ decodeSubscribeResponse(data: Uint8Array): ScheduleSubscribeResponse;
47
+ /**
48
+ * Encode UNSUBSCRIBE request
49
+ * Payload: [pattern: string]
50
+ */
51
+ encodeUnsubscribe(pattern: string): Uint8Array;
52
+ /**
53
+ * Decode UNSUBSCRIBE response
54
+ * Success payload: empty
55
+ */
56
+ decodeUnsubscribeResponse(_data: Uint8Array): ScheduleUnsubscribeResponse;
57
+ /**
58
+ * Decode NOTIFY notification (MSG_SCHEDULE_NOTIFY 705)
59
+ * Payload: [subscription_id: u64][payload: bytes]
60
+ */
61
+ decodeNotification(payload: Uint8Array): DecodedScheduleNotification;
62
+ };
63
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/domains/schedule/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,2BAA2B,EAE3B,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,aAAa;IACxB;;;OAGG;wBACiB,MAAM,YAAY,MAAM,WAAW,UAAU,GAAG,UAAU;IAS9E;;;OAGG;+BACwB,UAAU,GAAG,sBAAsB;IAU9D;;;OAGG;wBACiB,MAAM,GAAG,UAAU;IAMvC;;;OAGG;gCACyB,UAAU,GAAG,sBAAsB;IAI/D;;;OAGG;wBACgB,MAAM,UAAc,MAAM,GAAQ,UAAU;IAO/D;;;OAGG;6BACsB,UAAU,GAAG,oBAAoB;IA6B1D;;;OAGG;6BACsB,MAAM,GAAG,UAAU;IAM5C;;;OAGG;kCAC2B,UAAU,GAAG,yBAAyB;IAiBpE;;;OAGG;+BACwB,MAAM,GAAG,UAAU;IAM9C;;;OAGG;qCAC8B,UAAU,GAAG,2BAA2B;IAIzE;;;OAGG;gCACyB,UAAU,GAAG,2BAA2B;CAcrE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Schedule domain exports
3
+ */
4
+ export { ScheduleClient } from "./client";
5
+ export { ScheduleCodec } from "./codec";
6
+ export type { ScheduleEntry, ScheduleNotification, ScheduleHandler, ScheduleCreateResponse, ScheduleCancelResponse, ScheduleListResponse, ScheduleSubscribeResponse, ScheduleUnsubscribeResponse, ScheduleSubscription, } from "./types";
7
+ export { ScheduleError } from "./types";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domains/schedule/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Schedule domain types
3
+ * Per fitz-go/internal/domains/schedule (cron-based task scheduling)
4
+ */
5
+ /**
6
+ * ScheduleEntry represents a schedule returned by List
7
+ * Per CLIENT_SPEC: route, cron, payload
8
+ */
9
+ export interface ScheduleEntry {
10
+ id: string;
11
+ route: string;
12
+ cron: string;
13
+ payload: Uint8Array;
14
+ }
15
+ /**
16
+ * Notification is the payload delivered when a schedule fires (SCHEDULE_NOTIFY 705)
17
+ */
18
+ export interface ScheduleNotification {
19
+ payload: Uint8Array;
20
+ }
21
+ export interface DecodedScheduleNotification {
22
+ subId: bigint;
23
+ payload: Uint8Array;
24
+ }
25
+ /**
26
+ * ScheduleHandler is called when a schedule fires for a subscribed pattern
27
+ * It is fire-and-forget; the return value is not used
28
+ */
29
+ export type ScheduleHandler = (notification: ScheduleNotification) => void | Promise<void>;
30
+ /**
31
+ * ScheduleSubscription represents an active subscription to schedule fire notifications
32
+ */
33
+ export type ScheduleSubscription = ReturnType<typeof createScheduleSubscription>;
34
+ export declare function createScheduleSubscription(subId: bigint, pattern: string, unsubscribeFn: () => Promise<void>): {
35
+ subId: bigint;
36
+ pattern: string;
37
+ unsubscribe: () => Promise<void>;
38
+ };
39
+ export interface ScheduleCreateResponse {
40
+ scheduleId?: string;
41
+ }
42
+ export type ScheduleCancelResponse = Record<string, never>;
43
+ export interface ScheduleListResponse {
44
+ totalCount: bigint;
45
+ entries: ScheduleEntry[];
46
+ }
47
+ export interface ScheduleSubscribeResponse {
48
+ subId: bigint;
49
+ }
50
+ export type ScheduleUnsubscribeResponse = Record<string, never>;
51
+ /**
52
+ * Schedule domain errors
53
+ */
54
+ export declare class ScheduleError extends Error {
55
+ readonly code?: string;
56
+ constructor(message: string, code?: string);
57
+ }
58
+ /**
59
+ * Schedule operation status codes
60
+ */
61
+ export declare enum ScheduleStatus {
62
+ Ok = 0,
63
+ ScheduleNotFound = 1,
64
+ TaskNotFound = 2,
65
+ InvalidCron = 3,
66
+ InvalidDelay = 4,
67
+ InvalidTimestamp = 5
68
+ }
69
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/domains/schedule/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,CAAC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 /**
2
+ * Stream domain client for append-only log operations.
3
+ *
4
+ * Stream uses session-based transactional semantics:
5
+ * 1. `begin()` starts a write session
6
+ * 2. `append(expectedOffset, ...)` on the session adds records with OCC
7
+ * 3. `commit()` or `rollback()` finalizes the session
8
+ */
9
+ import { StreamSession, StreamRecord, StreamMetadata, StreamReadOptions, StreamReadPage, StreamCommitHandler, StreamSubscription } from "./types";
10
+ import type { Connection } from "../../client/connection";
11
+ export type StreamClient = ReturnType<typeof createStreamClient>;
12
+ export declare function createStreamClient(connection: Connection): {
13
+ begin: (route: string, ingestMetadata?: Uint8Array) => Promise<StreamSession>;
14
+ readPage: (route: string, startOffset: bigint, limit?: number, options?: StreamReadOptions) => Promise<StreamReadPage>;
15
+ read: (route: string, startOffset: bigint, limit?: number, options?: StreamReadOptions) => Promise<StreamRecord[]>;
16
+ consume: (route: string, startOffset: bigint, limit?: number, options?: StreamReadOptions) => Promise<AsyncIterable<StreamRecord>>;
17
+ peek: (route: string) => Promise<StreamRecord | null>;
18
+ metadata: (route: string) => Promise<StreamMetadata>;
19
+ subscribe: (pattern: string, handler: StreamCommitHandler) => Promise<StreamSubscription>;
20
+ };
21
+ type StreamClientConstructor = {
22
+ new (connection: Connection): StreamClient;
23
+ (connection: Connection): StreamClient;
24
+ };
25
+ export declare const StreamClient: StreamClientConstructor;
26
+ export * from "./types";
27
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/domains/stream/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,aAAa,EACb,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,cAAc,EAEd,mBAAmB,EAEnB,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAcjB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAO1D,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU;mBA6B3B,MAAM,mBAAmB,UAAU,KAAG,OAAO,CAAC,aAAa,CAAC;sBAgB/E,MAAM,eACA,MAAM,UACZ,MAAM,YACH,iBAAiB,KAC1B,OAAO,CAAC,cAAc,CAAC;kBAoBjB,MAAM,eACA,MAAM,UACZ,MAAM,YACH,iBAAiB,KAC1B,OAAO,CAAC,YAAY,EAAE,CAAC;qBAMjB,MAAM,eACA,MAAM,UACZ,MAAM,YACH,iBAAiB,KAC1B,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;kBAKZ,MAAM,KAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;sBAWjC,MAAM,KAAG,OAAO,CAAC,cAAc,CAAC;yBAkBpD,MAAM,WACN,mBAAmB,KAC3B,OAAO,CAAC,kBAAkB,CAAC;EA0J/B;AAED,KAAK,uBAAuB,GAAG;IAC7B,KAAK,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC;IAC3C,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,uBAEY,CAAC;AAExC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Stream domain codec for encoding/decoding messages
3
+ * Per CLIENT_SPEC.md and fitz-go/internal/domains/stream/protocol.go
4
+ */
5
+ import { BufferReader } from "../../core/buffer";
6
+ import { StreamCommitMode, StreamCommitPayload, StreamDiscriminator, StreamFilteredReason, StreamMetadata, StreamRecord, StreamReadCursor, StreamReadItem, StreamReadOptions } from "./types";
7
+ export declare const StreamCodec: {
8
+ /**
9
+ * Encode BEGIN request
10
+ * Payload: [route: string][has_ingest_metadata: u8][ingest_metadata?: bytes]
11
+ */
12
+ encodeBegin(route: string, ingestMetadata?: Uint8Array): Uint8Array;
13
+ /**
14
+ * Decode BEGIN response
15
+ * Payload: [status: u8][has_session_id: u8][session_id?: u64][data: bytes]
16
+ */
17
+ decodeBeginResponse(payload: Uint8Array): {
18
+ status: number;
19
+ sessionId?: bigint;
20
+ };
21
+ /**
22
+ * Encode APPEND request
23
+ * Payload: [session_id: u64][expected_offset: u64][body: bytes][has_metadata: u8][metadata?: bytes][has_discriminator: u8][discriminator?: string]
24
+ */
25
+ encodeAppend(sessionId: bigint, expectedOffset: bigint, body: Uint8Array, metadata?: Uint8Array, discriminator?: StreamDiscriminator): Uint8Array;
26
+ /**
27
+ * Decode APPEND response
28
+ * Payload: [status: u8][has_session_id: u8][session_id?: u64][data: bytes]
29
+ */
30
+ decodeAppendResponse(payload: Uint8Array): {
31
+ status: number;
32
+ offset?: bigint;
33
+ };
34
+ /**
35
+ * Encode COMMIT request
36
+ * Payload: [session_id: u64][mode: u8]
37
+ */
38
+ encodeCommit(sessionId: bigint, mode: StreamCommitMode): Uint8Array;
39
+ /**
40
+ * Decode COMMIT response
41
+ * Payload: [status: u8]
42
+ */
43
+ decodeCommitResponse(payload: Uint8Array): {
44
+ status: number;
45
+ };
46
+ /**
47
+ * Encode ROLLBACK request
48
+ * Payload: [session_id: u64]
49
+ */
50
+ encodeRollback(sessionId: bigint): Uint8Array;
51
+ /**
52
+ * Decode ROLLBACK response
53
+ * Payload: [status: u8]
54
+ */
55
+ decodeRollbackResponse(payload: Uint8Array): {
56
+ status: number;
57
+ };
58
+ /**
59
+ * Encode READ request
60
+ * Payload: [route: string][start_offset: u64][limit: u64][has_max_bytes: u8][max_bytes?: u64][has_filter: u8][filter_length?: u32][filter?: bincode]
61
+ */
62
+ encodeRead(route: string, startOffset: bigint, limit: number, options?: StreamReadOptions): Uint8Array;
63
+ /**
64
+ * Decode READ response
65
+ * Payload: [status: u8][has_session_id: u8][session_id?: u64][data: bytes]
66
+ */
67
+ decodeReadResponse(payload: Uint8Array): {
68
+ status: number;
69
+ items: StreamReadItem[];
70
+ cursor?: StreamReadCursor;
71
+ };
72
+ /**
73
+ * Encode LAST request
74
+ * Payload: [route: string]
75
+ */
76
+ encodeLast(route: string): Uint8Array;
77
+ /**
78
+ * Decode LAST response
79
+ * Payload: [status: u8][has_session_id: u8][session_id?: u64][data: bytes]
80
+ */
81
+ decodeLastResponse(payload: Uint8Array): {
82
+ status: number;
83
+ record?: StreamRecord;
84
+ };
85
+ /**
86
+ * Encode METADATA request.
87
+ * Payload: [route: string]
88
+ */
89
+ encodeMetadata(route: string): Uint8Array;
90
+ /**
91
+ * Decode METADATA response.
92
+ * Payload: [status: u8][has_session_id: u8][session_id?: u64][data: bytes]
93
+ */
94
+ decodeMetadataResponse(payload: Uint8Array): {
95
+ status: number;
96
+ metadata?: StreamMetadata;
97
+ };
98
+ encodeSubscribe(pattern: string): Uint8Array;
99
+ decodeSubscribeResponse(payload: Uint8Array): {
100
+ status: number;
101
+ subId?: bigint;
102
+ };
103
+ encodeUnsubscribe(pattern: string): Uint8Array;
104
+ decodeUnsubscribeResponse(payload: Uint8Array): {
105
+ status: number;
106
+ };
107
+ decodeNotification(payload: Uint8Array): {
108
+ subId: bigint;
109
+ route: string;
110
+ rawPayload: Uint8Array;
111
+ parsedPayload: StreamCommitPayload;
112
+ };
113
+ decodeStreamRecord(reader: BufferReader): StreamRecord;
114
+ flattenStreamReadItems(items: StreamReadItem[]): StreamRecord[];
115
+ decodeStreamReadItem(reader: BufferReader): StreamReadItem;
116
+ decodeStreamFilteredReason(reader: BufferReader): StreamFilteredReason | undefined;
117
+ readOptionalBytes(reader: BufferReader): Uint8Array | undefined;
118
+ decodeWrappedResponse(payload: Uint8Array): {
119
+ status: number;
120
+ sessionId?: bigint;
121
+ data: Uint8Array;
122
+ };
123
+ };
124
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/domains/stream/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,gBAAgB,EAChB,mBAA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CAAC,EAAE,cAAc,CAAC;KAC3B;6BA+BwB,MAAM,GAAG,UAAU;qCAMX,UAAU,GAAG;QAC5C,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;+BAe0B,MAAM,GAAG,UAAU;uCAMX,UAAU,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;gCAKtC,UAAU,GAAG;QACvC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,UAAU,CAAC;QACvB,aAAa,EAAE,mBAAmB,CAAC;KACpC;+BAqB0B,YAAY,GAAG,YAAY;kCAkBxB,cAAc,EAAE,GAAG,YAAY,EAAE;iCAIlC,YAAY,GAAG,cAAc;uCAuBvB,YAAY,GAAG,oBAAoB,GAAG,SAAS;8BAgBxD,YAAY,GAAG,UAAU,GAAG,SAAS;mCAUhC,UAAU,GAAG;QAC1C,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,UAAU,CAAC;KAClB;CAuBF,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Stream domain exports
3
+ */
4
+ export { StreamClient } from "./client";
5
+ export { StreamCodec } from "./codec";
6
+ export type { StreamSession, StreamRecord, StreamMetadata, StreamDiscriminator, StreamFilteredReason, StreamFilterClause, StreamFilterSet, StreamAppendOptions, StreamReadOptions, StreamReadCursor, StreamReadEvent, StreamReadFiltered, StreamReadFilteredRange, StreamReadItem, StreamReadPage, StreamCommitNotification, StreamCommitHandler, StreamSubscription, } from "./types";
7
+ export { StreamStatus } from "./types";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domains/stream/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}