@relkit/client 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +21 -0
- package/dist/server.js.map +1 -0
- package/package.json +7 -1
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RouterContract, RouterContractClient } from "@orpc/contract";
|
|
2
|
+
import { type CreateClientOptions, type DefaultContract } from "./index.js";
|
|
3
|
+
/** Bun server client with operation-time W3C propagation. Response bodies remain untouched. */
|
|
4
|
+
export declare function createServerClient<Contract extends RouterContract = DefaultContract>(options: CreateClientOptions): RouterContractClient<Contract>;
|
|
5
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAgB,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAE1F,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,QAAQ,SAAS,cAAc,GAAG,eAAe,EAClF,OAAO,EAAE,mBAAmB,GAC3B,oBAAoB,CAAC,QAAQ,CAAC,CAmBhC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { injectTraceContext } from "@relkit/contracts";
|
|
2
|
+
import { currentExecutionContext, publicTrace, RelkitSpan, spanContext } from "@relkit/invocation";
|
|
3
|
+
import { createClient } from "./index.js";
|
|
4
|
+
/** Bun server client with operation-time W3C propagation. Response bodies remain untouched. */
|
|
5
|
+
export function createServerClient(options) {
|
|
6
|
+
const fetcher = options.fetch ?? globalThis.fetch;
|
|
7
|
+
return createClient({
|
|
8
|
+
...options,
|
|
9
|
+
fetch: ((input, init) => publicTrace.span("relkit.client.request", {
|
|
10
|
+
kind: "client",
|
|
11
|
+
attributes: { "http.request.method": init?.method ?? "POST" },
|
|
12
|
+
}, () => {
|
|
13
|
+
const headers = new Headers(init?.headers);
|
|
14
|
+
const active = currentExecutionContext()?.span;
|
|
15
|
+
if (active instanceof RelkitSpan)
|
|
16
|
+
injectTraceContext(headers, spanContext(active));
|
|
17
|
+
return fetcher(input, { ...init, headers });
|
|
18
|
+
})),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEnG,OAAO,EAAE,YAAY,EAAkD,MAAM,YAAY,CAAC;AAE1F,+FAA+F;AAC/F,MAAM,UAAU,kBAAkB,CAChC,OAA4B;IAE5B,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;IAClD,OAAO,YAAY,CAAW;QAC5B,GAAG,OAAO;QACV,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CACtB,WAAW,CAAC,IAAI,CACd,uBAAuB,EACvB;YACE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,IAAI,MAAM,EAAE;SAC9D,EACD,GAAG,EAAE;YACH,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,uBAAuB,EAAE,EAAE,IAAI,CAAC;YAC/C,IAAI,MAAM,YAAY,UAAU;gBAAE,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YACnF,OAAO,OAAO,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9C,CAAC,CACF,CAA4B;KAChC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relkit/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Typed RELKIT client helpers, including TanStack Query integration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,12 +27,18 @@
|
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
28
|
"import": "./dist/index.js"
|
|
29
29
|
},
|
|
30
|
+
"./server": {
|
|
31
|
+
"types": "./dist/server.d.ts",
|
|
32
|
+
"bun": "./dist/server.js"
|
|
33
|
+
},
|
|
30
34
|
"./tanstack-query": {
|
|
31
35
|
"types": "./dist/tanstack-query.d.ts",
|
|
32
36
|
"import": "./dist/tanstack-query.js"
|
|
33
37
|
}
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
40
|
+
"@relkit/contracts": "0.4.0",
|
|
41
|
+
"@relkit/invocation": "0.4.0",
|
|
36
42
|
"@orpc/client": "2.0.0-beta.31",
|
|
37
43
|
"@orpc/contract": "2.0.0-beta.31",
|
|
38
44
|
"@orpc/tanstack-query": "2.0.0-beta.31"
|