Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: "20"
node-version: lts/*

- name: Build Rust workspace
run: cargo build --workspace
Expand All @@ -49,3 +49,11 @@ jobs:
- name: Run integration tests
working-directory: tests
run: npm test

- name: Upload HTML report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: tests/playwright-report/
retention-days: 14
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"printWidth": 100
"printWidth": 100,
"plugins": ["prettier-plugin-jinja-template"]
}
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ hmac = "0.12"
log = "0.4"
rand = "0.8"
sha2 = "0.10"
url = "2.5"
minijinja = { version = "2.12", features = ["loader"] }
minijinja-autoreload = "2.12.0"
minijinja-embed = "2.12.0"
Expand Down
72 changes: 45 additions & 27 deletions crates/observation-tools-client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
/* eslint-disable */
/** Client for observation-tools */
export declare class Client {
beginExecution(name: string): ExecutionHandle;
beginExecution(name: string): ExecutionHandle
/**
* Begin a new execution with a specific ID (for testing)
*
* This allows tests to create an execution with a known ID, enabling
* navigation to the execution URL before the execution is uploaded.
*/
beginExecutionWithId(id: string, name: string): ExecutionHandle;
beginExecutionWithId(id: string, name: string): ExecutionHandle
}

/** Builder for Client */
export declare class ClientBuilder {
/** Create a new client builder */
constructor();
constructor()
/** Set the base URL for the server */
setBaseUrl(url: string): void;
setBaseUrl(url: string): void
/** Set the API key for authentication */
setApiKey(apiKey: string): void;
setApiKey(apiKey: string): void
/** Build the client */
build(): Client;
build(): Client
}

/** Handle to an execution that can be used to send observations */
export declare class ExecutionHandle {
/** Get the execution ID as a string */
get idString(): string;
get idString(): string
/** Get the URL to the execution page */
get url(): string;
get url(): string
/**
* Create and send an observation
*
Expand All @@ -41,14 +41,23 @@ export declare class ExecutionHandle {
* * `source_line` - Optional source line number
* * `metadata` - Optional metadata as an array of [key, value] pairs
*/
observe(
name: string,
payloadJson: string,
labels?: Array<string> | undefined | null,
sourceFile?: string | undefined | null,
sourceLine?: number | undefined | null,
metadata?: Array<Array<string>> | undefined | null,
): string;
observe(name: string, payloadJson: string, labels?: Array<string> | undefined | null, sourceFile?: string | undefined | null, sourceLine?: number | undefined | null, metadata?: Array<Array<string>> | undefined | null): string
/**
* Create and send an observation with a specific ID (for testing)
*
* This allows tests to create an observation with a known ID, enabling
* navigation to the observation URL before the observation is uploaded.
*
* # Arguments
* * `id` - The observation ID to use
* * `name` - The name of the observation
* * `payload_json` - The data to observe as a JSON string
* * `labels` - Optional array of labels for categorization
* * `source_file` - Optional source file path
* * `source_line` - Optional source line number
* * `metadata` - Optional metadata as an array of [key, value] pairs
*/
observeWithId(id: string, name: string, payloadJson: string, labels?: Array<string> | undefined | null, sourceFile?: string | undefined | null, sourceLine?: number | undefined | null, metadata?: Array<Array<string>> | undefined | null): string
}

/**
Expand All @@ -59,19 +68,19 @@ export declare class ExecutionHandle {
*/
export declare class ObservationBuilder {
/** Create a new observation builder with the given name */
constructor(name: string);
constructor(name: string)
/** Add a label to the observation */
label(label: string): this;
label(label: string): this
/** Add metadata to the observation */
metadata(key: string, value: string): this;
metadata(key: string, value: string): this
/** Set the source info for the observation */
source(file: string, line: number): this;
source(file: string, line: number): this
/** Set the payload as JSON data */
jsonPayload(jsonString: string): ObservationBuilderWithPayload;
jsonPayload(jsonString: string): ObservationBuilderWithPayload
/** Set the payload with custom data and MIME type */
rawPayload(data: string, mimeType: string): ObservationBuilderWithPayload;
rawPayload(data: string, mimeType: string): ObservationBuilderWithPayload
/** Set the payload as markdown content */
markdownPayload(content: string): ObservationBuilderWithPayload;
markdownPayload(content: string): ObservationBuilderWithPayload
}

/**
Expand All @@ -90,15 +99,15 @@ export declare class ObservationBuilderWithPayload {
*
* If sending fails, returns a stub that will fail on `wait_for_upload()`.
*/
send(execution: ExecutionHandle): SendObservation;
send(execution: ExecutionHandle): SendObservation
}

export declare class ObservationHandle {
get url(): string;
get url(): string
}

export declare class SendObservation {
handle(): ObservationHandle;
handle(): ObservationHandle
}

/**
Expand All @@ -107,4 +116,13 @@ export declare class SendObservation {
* This allows tests to generate an execution ID before creating the execution,
* enabling navigation to the execution URL before the execution is uploaded.
*/
export declare function generateExecutionId(): string;
export declare function generateExecutionId(): string

/**
* Generate a new observation ID (for testing)
*
* This allows tests to generate an observation ID before creating the
* observation, enabling navigation to the observation URL before the
* observation is uploaded.
*/
export declare function generateObservationId(): string
Loading
Loading