@o11y-one/sdk 0.1.0 → 0.1.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/README.md +9 -7
- package/dist/client.d.ts +12 -10
- package/dist/client.js +11 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ import { O11yClient, classify } from "@o11y-one/sdk";
|
|
|
16
16
|
import { AgenticEvaluationService } from "@o11y-one/api-agentic/o11y_one/agentic/v1/evaluation_pb";
|
|
17
17
|
|
|
18
18
|
const o11y = new O11yClient({
|
|
19
|
-
baseUrl: "https://
|
|
19
|
+
baseUrl: "https://grpc.o11y.one",
|
|
20
20
|
credential: process.env.O11Y_API_KEY, // o11y_mach.<selector>.<secret>
|
|
21
21
|
orgId: process.env.O11Y_ORG_ID,
|
|
22
22
|
});
|
|
@@ -76,9 +76,11 @@ JWT and a machine credential presented there is rejected.
|
|
|
76
76
|
|
|
77
77
|
## Runtime support
|
|
78
78
|
|
|
79
|
-
The default transport is
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
transport and install `credentialInterceptor()` on it.
|
|
79
|
+
The default transport is gRPC-web via `@connectrpc/connect-web`, which needs
|
|
80
|
+
only a spec-compatible `fetch`. That covers browsers, Node 26, Deno, Bun and
|
|
81
|
+
Cloudflare Workers. `@connectrpc/connect-node` is a dependency for callers who
|
|
82
|
+
want the Node-specific HTTP/2 transport and construct it themselves; pass the
|
|
83
|
+
resulting transport's options through `ClientOptions` or build your own
|
|
84
|
+
transport and install `credentialInterceptor()` on it. The API serves gRPC and
|
|
85
|
+
gRPC-web only, so a transport you build must speak one of those, not the
|
|
86
|
+
Connect protocol.
|
package/dist/client.d.ts
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* rot the first time a field is added upstream.
|
|
10
10
|
*/
|
|
11
11
|
import { type Client, type Interceptor, type Transport } from "@connectrpc/connect";
|
|
12
|
-
import { type
|
|
12
|
+
import { type GrpcWebTransportOptions } from "@connectrpc/connect-web";
|
|
13
13
|
import type { DescService } from "@bufbuild/protobuf";
|
|
14
14
|
export interface ClientOptions {
|
|
15
15
|
/**
|
|
16
|
-
* Base URL of the O11y One
|
|
16
|
+
* Base URL of the O11y One gRPC endpoint, e.g. `https://grpc.o11y.one`.
|
|
17
17
|
* No trailing path — connect-es appends `/<package>.<Service>/<Method>`.
|
|
18
18
|
*/
|
|
19
19
|
baseUrl: string;
|
|
@@ -39,7 +39,7 @@ export interface ClientOptions {
|
|
|
39
39
|
* `typeof globalThis.fetch`, which would force the DOM lib into this package's
|
|
40
40
|
* compilation for the sake of one type and drag every DOM global in with it.
|
|
41
41
|
*/
|
|
42
|
-
fetch?:
|
|
42
|
+
fetch?: GrpcWebTransportOptions["fetch"];
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* An interceptor that stamps the credential and scoping headers onto every
|
|
@@ -70,14 +70,16 @@ export declare function credentialInterceptor(options: {
|
|
|
70
70
|
tenantId?: string;
|
|
71
71
|
}): Interceptor;
|
|
72
72
|
/**
|
|
73
|
-
* Build a
|
|
73
|
+
* Build a gRPC-web transport with the credential interceptor installed.
|
|
74
74
|
*
|
|
75
|
-
* Protocol note:
|
|
76
|
-
*
|
|
77
|
-
* HTTP/2 prior knowledge
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
75
|
+
* Protocol note: gRPC-web, not Connect. The API serves gRPC and gRPC-web and
|
|
76
|
+
* does not speak the Connect protocol; gRPC-web is the one of the two that
|
|
77
|
+
* needs no HTTP/2 prior knowledge, so it survives proxies and CI egress rules,
|
|
78
|
+
* and it is what o11y-web speaks. `createGrpcWebTransport` from
|
|
79
|
+
* `@connectrpc/connect-web` works in browsers, in Node 26 (whose global fetch
|
|
80
|
+
* is sufficient), and in Workers; `@connectrpc/connect-node` is a dependency
|
|
81
|
+
* only for callers who need the Node-specific HTTP/2 transport and reach for it
|
|
82
|
+
* themselves.
|
|
81
83
|
*/
|
|
82
84
|
export declare function createTransport(options: ClientOptions): Transport;
|
|
83
85
|
/**
|
package/dist/client.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* rot the first time a field is added upstream.
|
|
10
10
|
*/
|
|
11
11
|
import { createClient } from "@connectrpc/connect";
|
|
12
|
-
import {
|
|
12
|
+
import { createGrpcWebTransport, } from "@connectrpc/connect-web";
|
|
13
13
|
import { assertLooksLikeMachineCredential, CREDENTIAL_HEADER, ORG_ID_HEADER, TENANT_ID_HEADER, } from "./auth.js";
|
|
14
14
|
/**
|
|
15
15
|
* An interceptor that stamps the credential and scoping headers onto every
|
|
@@ -52,17 +52,19 @@ export function credentialInterceptor(options) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Build a
|
|
55
|
+
* Build a gRPC-web transport with the credential interceptor installed.
|
|
56
56
|
*
|
|
57
|
-
* Protocol note:
|
|
58
|
-
*
|
|
59
|
-
* HTTP/2 prior knowledge
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
57
|
+
* Protocol note: gRPC-web, not Connect. The API serves gRPC and gRPC-web and
|
|
58
|
+
* does not speak the Connect protocol; gRPC-web is the one of the two that
|
|
59
|
+
* needs no HTTP/2 prior knowledge, so it survives proxies and CI egress rules,
|
|
60
|
+
* and it is what o11y-web speaks. `createGrpcWebTransport` from
|
|
61
|
+
* `@connectrpc/connect-web` works in browsers, in Node 26 (whose global fetch
|
|
62
|
+
* is sufficient), and in Workers; `@connectrpc/connect-node` is a dependency
|
|
63
|
+
* only for callers who need the Node-specific HTTP/2 transport and reach for it
|
|
64
|
+
* themselves.
|
|
63
65
|
*/
|
|
64
66
|
export function createTransport(options) {
|
|
65
|
-
return
|
|
67
|
+
return createGrpcWebTransport({
|
|
66
68
|
baseUrl: options.baseUrl,
|
|
67
69
|
// Binary wire format: smaller, and it round-trips proto3 field presence
|
|
68
70
|
// without the JSON mapping's ambiguities.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o11y-one/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Hand-written client wrapper over @o11y-one/api-agentic: transport construction, credential injection, and the O11y One error taxonomy.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@connectrpc/connect": "^2.2.0",
|
|
20
20
|
"@connectrpc/connect-node": "^2.2.0",
|
|
21
21
|
"@connectrpc/connect-web": "^2.2.0",
|
|
22
|
-
"@o11y-one/api-agentic": "0.1.
|
|
22
|
+
"@o11y-one/api-agentic": "0.1.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "^7.0.2"
|