service-bridge 0.1.4

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 (51) hide show
  1. package/README.md +989 -0
  2. package/biome.json +28 -0
  3. package/bun.lock +249 -0
  4. package/dist/express.d.ts +51 -0
  5. package/dist/express.js +129 -0
  6. package/dist/fastify.d.ts +43 -0
  7. package/dist/fastify.js +122 -0
  8. package/dist/index.js +34507 -0
  9. package/dist/trace.d.ts +19 -0
  10. package/http/dist/express.d.ts +51 -0
  11. package/http/dist/express.d.ts.map +1 -0
  12. package/http/dist/express.test.d.ts +2 -0
  13. package/http/dist/express.test.d.ts.map +1 -0
  14. package/http/dist/fastify.d.ts +43 -0
  15. package/http/dist/fastify.d.ts.map +1 -0
  16. package/http/dist/fastify.test.d.ts +2 -0
  17. package/http/dist/fastify.test.d.ts.map +1 -0
  18. package/http/dist/index.d.ts +7 -0
  19. package/http/dist/index.d.ts.map +1 -0
  20. package/http/dist/trace.d.ts +19 -0
  21. package/http/dist/trace.d.ts.map +1 -0
  22. package/http/dist/trace.test.d.ts +2 -0
  23. package/http/dist/trace.test.d.ts.map +1 -0
  24. package/http/package.json +49 -0
  25. package/http/src/express.test.ts +125 -0
  26. package/http/src/express.ts +209 -0
  27. package/http/src/fastify.test.ts +142 -0
  28. package/http/src/fastify.ts +159 -0
  29. package/http/src/index.ts +10 -0
  30. package/http/src/sdk-augment.d.ts +11 -0
  31. package/http/src/servicebridge.d.ts +23 -0
  32. package/http/src/trace.test.ts +97 -0
  33. package/http/src/trace.ts +56 -0
  34. package/http/tsconfig.json +17 -0
  35. package/http/tsconfig.test.json +6 -0
  36. package/package.json +113 -0
  37. package/sdk/dist/generated/servicebridge-package-definition.d.ts +4912 -0
  38. package/sdk/dist/grpc-client.d.ts +344 -0
  39. package/sdk/dist/grpc-client.test.d.ts +1 -0
  40. package/sdk/dist/index.d.ts +2 -0
  41. package/sdk/package.json +31 -0
  42. package/sdk/scripts/generate-proto.ts +65 -0
  43. package/sdk/src/generated/servicebridge-package-definition.ts +5423 -0
  44. package/sdk/src/grpc-client.d.ts +332 -0
  45. package/sdk/src/grpc-client.d.ts.map +1 -0
  46. package/sdk/src/grpc-client.test.ts +422 -0
  47. package/sdk/src/grpc-client.ts +3088 -0
  48. package/sdk/src/index.d.ts +3 -0
  49. package/sdk/src/index.d.ts.map +1 -0
  50. package/sdk/src/index.ts +31 -0
  51. package/sdk/tsconfig.json +13 -0
@@ -0,0 +1,332 @@
1
+ export interface TraceCtx {
2
+ traceId: string;
3
+ spanId: string;
4
+ }
5
+ export declare function getTraceContext(): TraceCtx | undefined;
6
+ export declare function runWithTraceContext<T>(ctx: TraceCtx, fn: () => T): T;
7
+ /** Тип поля Protobuf-сообщения */
8
+ export type RpcFieldType = "string" | "int32" | "int64" | "uint32" | "uint64" | "float" | "double" | "bool" | "bytes";
9
+ /** Определение одного поля схемы */
10
+ export interface RpcFieldDef {
11
+ /** Тип поля */
12
+ type: RpcFieldType;
13
+ /** Уникальный номер поля (field number в proto) */
14
+ id: number;
15
+ /** Повторяющееся поле (массив) */
16
+ repeated?: boolean;
17
+ }
18
+ /** Схема сообщения: имя поля → определение */
19
+ export type RpcSchema = Record<string, RpcFieldDef>;
20
+ /** Входная и выходная схемы для RPC-функции */
21
+ export interface RpcSchemaOpts {
22
+ input?: RpcSchema;
23
+ output?: RpcSchema;
24
+ }
25
+ export interface RetryPolicy {
26
+ retries?: number;
27
+ retryDelay?: number;
28
+ }
29
+ export type WorkerTransport = "tls";
30
+ export interface WorkerTLSOpts {
31
+ caCert?: string | Buffer;
32
+ cert?: string | Buffer;
33
+ key?: string | Buffer;
34
+ serverName?: string;
35
+ }
36
+ export interface ServiceBridgeOpts extends RetryPolicy {
37
+ timeout?: number;
38
+ /** @deprecated No longer used — discovery is now lazy via LookupFunction. */
39
+ discoveryTimeout?: number;
40
+ /**
41
+ * How often (ms) each SbResolver re-polls LookupFunction to discover new replicas.
42
+ * Dead replicas are detected instantly by gRPC subchannel health monitoring.
43
+ * Default: 10 000 ms.
44
+ */
45
+ discoveryRefreshMs?: number;
46
+ queueMaxSize?: number;
47
+ queueOverflow?: "drop-oldest" | "drop-newest" | "error";
48
+ heartbeatIntervalMs?: number;
49
+ workerTransport?: WorkerTransport;
50
+ /**
51
+ * Explicit mTLS cert materials for the worker gRPC server.
52
+ * When omitted, they are provisioned automatically from the server on `serve()`:
53
+ * the SDK generates a key pair locally and posts the public key to
54
+ * `POST /api/tls/provision` — the private key never leaves the process.
55
+ */
56
+ workerTLS?: WorkerTLSOpts;
57
+ /**
58
+ * Base URL for the HTTP admin API used for auto-provisioning and management.
59
+ * Defaults to the gRPC host on port 14444 (e.g. "http://127.0.0.1:14444").
60
+ */
61
+ adminUrl?: string;
62
+ /**
63
+ * Optional admin session cookie for browser-authenticated HTTP API endpoints
64
+ * (for example, DELETE /api/workflow-runs/:id).
65
+ */
66
+ adminSessionCookie?: string;
67
+ /**
68
+ * Optional CSRF token paired with adminSessionCookie for unsafe HTTP methods.
69
+ */
70
+ adminCsrfToken?: string;
71
+ /**
72
+ * Optional Origin header value required by CSRF/origin checks on admin endpoints.
73
+ */
74
+ adminOrigin?: string;
75
+ /**
76
+ * When `true` (default), automatically patches `console.log / .info / .warn / .error / .debug`
77
+ * so that all console output is also shipped to ServiceBridge as structured log entries.
78
+ * Original console output is preserved (pass-through).
79
+ * Set to `false` to opt out.
80
+ */
81
+ captureLogs?: boolean;
82
+ }
83
+ export interface RpcOpts extends RetryPolicy {
84
+ timeout?: number;
85
+ traceId?: string;
86
+ parentSpanId?: string;
87
+ }
88
+ export interface EventOpts {
89
+ traceId?: string;
90
+ parentSpanId?: string;
91
+ idempotencyKey?: string;
92
+ headers?: Record<string, string>;
93
+ }
94
+ export interface HandleEventOpts {
95
+ concurrency?: number;
96
+ prefetch?: number;
97
+ groupName?: string;
98
+ retryPolicyJson?: string;
99
+ /** Server-side filter expression. Syntax: comma-separated AND conditions.
100
+ * Examples: "status=paid", "amount>100", "status=paid,amount>100", "region!=us-east" */
101
+ filterExpr?: string;
102
+ }
103
+ export interface HandleRpcOpts {
104
+ timeout?: number;
105
+ retryable?: boolean;
106
+ concurrency?: number;
107
+ /** Схема для авто-валидации и бинарного кодирования payload */
108
+ schema?: RpcSchemaOpts;
109
+ /**
110
+ * Whitelist of service names allowed to call this function.
111
+ * When set, the worker rejects Handle requests from services not in this list.
112
+ * Corresponds to the allowed_callers field on the service key.
113
+ * When mTLS is used, the x-caller-service header is cryptographically backed by the cert CN.
114
+ */
115
+ allowedCallers?: string[];
116
+ }
117
+ export interface ServeOpts {
118
+ host?: string;
119
+ instanceId?: string;
120
+ weight?: number;
121
+ transport?: WorkerTransport;
122
+ tls?: WorkerTLSOpts;
123
+ }
124
+ export interface ScheduleOpts {
125
+ cron?: string;
126
+ delay?: number;
127
+ timezone?: string;
128
+ misfire?: "fire_now" | "skip";
129
+ via?: "event" | "rpc" | "workflow";
130
+ retryPolicyJson?: string;
131
+ }
132
+ /** StreamWriter allows handlers to push incremental chunks during execution. */
133
+ export interface StreamWriter {
134
+ /**
135
+ * Append a chunk to the run's named stream.
136
+ * @param data - any JSON-serializable value
137
+ * @param key - stream key (default: "default"). Use named keys for multiple streams
138
+ * (e.g. "output", "log", "progress").
139
+ */
140
+ write(data: unknown, key?: string): Promise<void>;
141
+ /**
142
+ * Signal completion of a named stream (optional — server closes automatically when the run ends).
143
+ */
144
+ end(key?: string): Promise<void>;
145
+ }
146
+ export interface EventContext {
147
+ traceId: string;
148
+ spanId: string;
149
+ refs: Record<string, string>;
150
+ retry(delayMs?: number): void;
151
+ reject(reason: string): void;
152
+ /** Real-time stream writer. Use ctx.stream.write(data) to push chunks to subscribers. */
153
+ stream: StreamWriter;
154
+ }
155
+ /** Context passed as optional second argument to RPC handlers. */
156
+ export interface RpcContext {
157
+ traceId: string;
158
+ spanId: string;
159
+ /** Real-time stream writer. Use ctx.stream.write(data) to push chunks to subscribers. */
160
+ stream: StreamWriter;
161
+ }
162
+ type EventHandler = (payload: unknown, ctx: EventContext) => void | Promise<void>;
163
+ type FnHandler = (payload: unknown, ctx?: RpcContext) => unknown | Promise<unknown>;
164
+ export interface HttpSpan {
165
+ traceId: string;
166
+ spanId: string;
167
+ end(opts: {
168
+ statusCode?: number;
169
+ success?: boolean;
170
+ error?: string;
171
+ }): void;
172
+ }
173
+ export interface RunStreamEvent {
174
+ type: "chunk" | "run_complete";
175
+ runId: string;
176
+ key: string;
177
+ sequence: number;
178
+ data: unknown;
179
+ runStatus?: string;
180
+ }
181
+ export interface RunWorkflowResult {
182
+ runId: string;
183
+ traceId: string;
184
+ }
185
+ export interface RunWorkflowOpts {
186
+ traceId?: string;
187
+ }
188
+ export interface WatchRunOpts {
189
+ /** Filter by stream key. Empty = all keys. Default: "default". */
190
+ key?: string;
191
+ /** Replay chunks with sequence strictly greater than this value. 0 = full replay. */
192
+ fromSequence?: number;
193
+ }
194
+ export type ServiceBridgeErrorSeverity = "fatal" | "retriable" | "ignorable";
195
+ export declare class ServiceBridgeError extends Error {
196
+ code?: number;
197
+ component: string;
198
+ operation: string;
199
+ severity: ServiceBridgeErrorSeverity;
200
+ retryable: boolean;
201
+ cause?: unknown;
202
+ constructor(opts: {
203
+ message: string;
204
+ code?: number;
205
+ component: string;
206
+ operation: string;
207
+ severity: ServiceBridgeErrorSeverity;
208
+ cause?: unknown;
209
+ });
210
+ }
211
+ /**
212
+ * A single node in a workflow DAG.
213
+ *
214
+ * - `id` — unique step identifier; used in `deps` of other steps.
215
+ * - `deps` — IDs of steps that must succeed before this step runs.
216
+ * Empty array (default) = root step; receives the workflow input directly.
217
+ * - `if` — optional filter expression (same syntax as event filters).
218
+ * If it evaluates to false the step is skipped.
219
+ */
220
+ export type WorkflowStep = {
221
+ id: string;
222
+ type: "rpc";
223
+ ref: string;
224
+ deps?: string[];
225
+ if?: string;
226
+ timeoutMs?: number;
227
+ } | {
228
+ id: string;
229
+ type: "event";
230
+ ref: string;
231
+ deps?: string[];
232
+ if?: string;
233
+ } | {
234
+ id: string;
235
+ type: "event_wait";
236
+ ref: string;
237
+ deps?: string[];
238
+ if?: string;
239
+ timeoutMs?: number;
240
+ } | {
241
+ id: string;
242
+ type: "sleep";
243
+ durationMs: number;
244
+ deps?: string[];
245
+ if?: string;
246
+ } | {
247
+ id: string;
248
+ type: "workflow";
249
+ ref: string;
250
+ deps?: string[];
251
+ if?: string;
252
+ };
253
+ export interface ServiceBridgeService {
254
+ rpc<T = unknown>(fn: string, payload?: unknown, opts?: RpcOpts): Promise<T>;
255
+ event(topic: string, payload?: unknown, opts?: EventOpts): Promise<string>;
256
+ job(target: string, opts: ScheduleOpts): Promise<string>;
257
+ workflow(name: string, steps: WorkflowStep[]): Promise<string>;
258
+ runWorkflow(name: string, input?: unknown): Promise<RunWorkflowResult>;
259
+ cancelWorkflowRun(runId: string): Promise<void>;
260
+ /**
261
+ * Регистрирует обработчик RPC-функции.
262
+ * Если передан `opts.schema`, payload автоматически валидируется и
263
+ * кодируется/декодируется в бинарный Protobuf-формат вместо JSON.
264
+ * Схема также публикуется в server registry и используется вызывающей стороной.
265
+ */
266
+ handleRpc(fn: string, handler: FnHandler, opts?: HandleRpcOpts): ServiceBridgeService;
267
+ handleEvent(pattern: string, handler: EventHandler, opts?: HandleEventOpts): ServiceBridgeService;
268
+ serve(opts?: ServeOpts): Promise<void>;
269
+ stop(): void;
270
+ startHttpSpan(opts: {
271
+ method: string;
272
+ path: string;
273
+ traceId?: string;
274
+ parentSpanId?: string;
275
+ }): HttpSpan;
276
+ /**
277
+ * Register an HTTP endpoint in the ServiceBridge catalog.
278
+ * Call this once per route after your HTTP server is configured.
279
+ * The Express and Fastify adapters call this automatically — you only need
280
+ * this when integrating a different HTTP framework.
281
+ *
282
+ * @example
283
+ * await sb.registerHttpEndpoint({ method: 'GET', route: '/users/:id' });
284
+ */
285
+ registerHttpEndpoint(opts: {
286
+ /** HTTP method: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS */
287
+ method: string;
288
+ /** Route pattern including parameter placeholders, e.g. "/users/:id" */
289
+ route: string;
290
+ /** Stable identifier for this process instance. Defaults to a per-SDK UUID. */
291
+ instanceId?: string;
292
+ /** Address where this service can be reached, e.g. "http://10.0.0.1:3000" */
293
+ endpoint?: string;
294
+ /** Service names allowed to call this endpoint (RBAC). Default: [] (all allowed) */
295
+ allowedCallers?: string[];
296
+ /** Optional JSON schema string for request validation metadata. */
297
+ requestSchemaJson?: string;
298
+ /** Optional JSON schema string for response validation metadata. */
299
+ responseSchemaJson?: string;
300
+ /** Optional transport label for the endpoint instance (e.g. "http", "https"). */
301
+ transport?: string;
302
+ }): Promise<void>;
303
+ /**
304
+ * Subscribe to a run's real-time stream.
305
+ * Replays existing chunks then forwards new ones until the run completes or the caller breaks.
306
+ *
307
+ * @example
308
+ * const stream = sb.watchRun(runId, { key: "output" });
309
+ * for await (const chunk of stream) {
310
+ * process.stdout.write(chunk.data.token);
311
+ * }
312
+ */
313
+ watchRun(runId: string, opts?: WatchRunOpts): AsyncIterable<RunStreamEvent>;
314
+ /** @internal Used by captureConsole to forward intercepted log lines. */
315
+ readonly _log: (level: string, msg: string, attrs?: Record<string, string>) => void;
316
+ }
317
+ export declare function servicebridge(url: string, serviceKey: string, service?: string, globalOpts?: ServiceBridgeOpts): ServiceBridgeService;
318
+ /**
319
+ * Intercepts `console.log / .info / .warn / .error / .debug` so that every
320
+ * call is **also** shipped to ServiceBridge as a structured log entry.
321
+ *
322
+ * Original console output is preserved (pass-through) — nothing changes on
323
+ * the terminal side. Trace correlation works automatically via AsyncLocalStorage.
324
+ *
325
+ * @example
326
+ * const svc = servicebridge("localhost:14445", "my-key", "orders");
327
+ * captureConsole(svc); // call once at startup
328
+ * console.log("order created"); // appears on stdout AND in ServiceBridge
329
+ */
330
+ export declare function captureConsole(svc: ServiceBridgeService): void;
331
+ export {};
332
+ //# sourceMappingURL=grpc-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grpc-client.d.ts","sourceRoot":"","sources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