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
10 changes: 5 additions & 5 deletions apps/ccv2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"build:check": "wrangler deploy --dry-run --outdir .wrangler/build"
},
"dependencies": {
"hono": "4.13.18",
"jose": "^6.2.17",
"hono": "4.13.20",
"jose": "^6.2.18",
"yaml": "^2.9.1",
"zod": "^4.6.7"
},
"devDependencies": {
"@apidevtools/swagger-parser": "^13.1.0",
"@cloudflare/vitest-plugin": "1.8.2",
"@cloudflare/vitest-plugin": "1.9.0",
"@types/node": "26.6.6",
"typescript": "7.0.2",
"vitest": "5.1.0",
"wrangler": "4.162.0"
"vitest": "5.1.1",
"wrangler": "4.166.0"
}
}
238 changes: 180 additions & 58 deletions apps/ccv2/worker-configuration.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
// Generated by Wrangler by running `wrangler types --env-interface=CloudflareBindings` (hash: e475e972506a6f559a8d0bc4e2503bd0)
// Runtime types generated with workerd@1.20261113.1 2026-10-14
// Runtime types generated with workerd@1.20261119.1 2026-10-14
interface __BaseEnv_CloudflareBindings {
RUN_CREATION_RATE_LIMIT: RateLimit;
ALLOWED_ORIGINS: "https://commercekit.tools,http://localhost:5173";
Expand Down Expand Up @@ -71,60 +71,6 @@ and limitations under the License.
/* eslint-disable */
// noinspection JSUnusedGlobalSymbols
declare var onmessage: never;
/**
* The **`DOMException`** interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
*/
readonly code: number;
static readonly INDEX_SIZE_ERR: number;
static readonly DOMSTRING_SIZE_ERR: number;
static readonly HIERARCHY_REQUEST_ERR: number;
static readonly WRONG_DOCUMENT_ERR: number;
static readonly INVALID_CHARACTER_ERR: number;
static readonly NO_DATA_ALLOWED_ERR: number;
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
static readonly NOT_FOUND_ERR: number;
static readonly NOT_SUPPORTED_ERR: number;
static readonly INUSE_ATTRIBUTE_ERR: number;
static readonly INVALID_STATE_ERR: number;
static readonly SYNTAX_ERR: number;
static readonly INVALID_MODIFICATION_ERR: number;
static readonly NAMESPACE_ERR: number;
static readonly INVALID_ACCESS_ERR: number;
static readonly VALIDATION_ERR: number;
static readonly TYPE_MISMATCH_ERR: number;
static readonly SECURITY_ERR: number;
static readonly NETWORK_ERR: number;
static readonly ABORT_ERR: number;
static readonly URL_MISMATCH_ERR: number;
static readonly QUOTA_EXCEEDED_ERR: number;
static readonly TIMEOUT_ERR: number;
static readonly INVALID_NODE_TYPE_ERR: number;
static readonly DATA_CLONE_ERR: number;
get stack(): any;
set stack(value: any);
}
type WorkerGlobalScopeEventMap = {
fetch: FetchEvent;
scheduled: ScheduledEvent;
Expand Down Expand Up @@ -995,6 +941,7 @@ declare class Blob {
}
interface BlobOptions {
type?: string;
endings?: "transparent" | "native";
}
/**
* The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.
Expand All @@ -1019,6 +966,7 @@ declare class File extends Blob {
interface FileOptions {
type?: string;
lastModified?: number;
endings?: "transparent" | "native";
}
/**
* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
Expand Down Expand Up @@ -2704,15 +2652,15 @@ interface ReadableStreamValuesOptions {
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
constructor(format: "gzip" | "deflate" | "deflate-raw");
constructor(format: "gzip" | "deflate" | "deflate-raw" | "brotli");
}
/**
* The **`DecompressionStream`** interface of the Compression Streams API decompresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
constructor(format: "gzip" | "deflate" | "deflate-raw");
constructor(format: "gzip" | "deflate" | "deflate-raw" | "brotli");
}
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.
Expand Down Expand Up @@ -2951,6 +2899,12 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
*/
readyState: number;
/**
* The **`WebSocket.bufferedAmount`** read-only property returns the number of bytes of data that have been queued using calls to send() but not yet transmitted to the network. This value resets to zero once all queued data has been sent. This value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/bufferedAmount)
*/
bufferedAmount: number;
/**
* The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
*
Expand Down Expand Up @@ -3327,6 +3281,11 @@ interface Tracing {
withActiveSpan<T, A extends unknown[]>(span: Span, callback: (...args: A) => T, ...args: A): T;
Span: typeof Span;
}
interface TracingSpanLink {
context: TracingSpanContext;
attributes?: Record<string, boolean | number | string | undefined>;
droppedAttributesCount?: number;
}
declare abstract class Span {
get isTraced(): boolean;
spanContext(): TracingSpanContext;
Expand All @@ -3351,6 +3310,8 @@ declare abstract class Span {
updateName(name: string): this;
setStatus(status: TracingSpanStatus): this;
end(): void;
addLink(link: TracingSpanLink): this;
addLinks(links: readonly TracingSpanLink[]): this;
}
type TracingSpanStatusCode = "unset" | "ok" | "error";
interface TracingSpanStatus {
Expand Down Expand Up @@ -11707,6 +11668,49 @@ type BrowserRunDevtools = {
type BrowserRunCloseSessionResult = {
status: 'closing' | 'closed';
};
/** Library the script runs against. Omit it to receive a raw CDP client. */
type BrowserRunScriptLibrary = 'playwright' | 'puppeteer';
/** Options for `script()`. */
type BrowserRunScriptOptions = {
/** Library whose objects are passed to the script. Omit it for raw CDP. */
library?: BrowserRunScriptLibrary;
/** Maximum run time of the script in milliseconds, not counting browser
* acquisition. Between 1 and 120000.
* @default 60000
*/
timeout?: number;
/** How long the session stays open without activity after the run, in
* milliseconds. Between 10000 and 1200000.
* @default 60000
*/
keepAlive?: number;
/** Use the experimental pool, whose browsers enable Chrome features before
* they reach stable Chrome.
* @default false
*/
lab?: boolean;
/** Record the browser session. @default false */
recording?: boolean;
};
/** Options for `scriptInSession()`. */
type BrowserRunScriptSessionOptions = {
/** Library whose objects are passed to the script. Omit it for raw CDP. */
library?: BrowserRunScriptLibrary;
/** Maximum run time of the script in milliseconds. Between 1 and 120000.
* @default 60000
*/
timeout?: number;
/** Page target the script attaches to, such as the `cf-browser-target-id`
* header returned by `script()`. Defaults to the session's first page.
*/
targetId?: string;
};
/** JSON success body of `script()` and `scriptInSession()`. */
type BrowserRunScriptSuccessResponse = {
success: true;
/** The script's return value, or `null` when it returned nothing. */
result: unknown;
};
/**
* Browser Run API binding for automating headless browsers.
* @see https://developers.cloudflare.com/browser-run/
Expand Down Expand Up @@ -11889,6 +11893,53 @@ declare abstract class BrowserRun {
getSession(sessionId: string): Promise<BrowserRunSession | null>;
/** Close a browser session. */
closeSession(sessionId: string): Promise<BrowserRunCloseSessionResult>;
/**
* Run a script against a new browser session.
* @param code - Source of an async function. It receives the selected
* library's objects (Playwright `{ page, context, browser }`, Puppeteer
* `{ page, browser }`) or, without `library`, a CDP client.
* @param options - Library, timeout and session launch options.
* @returns A `Response` containing one of:
*
* **Success (HTTP 200):**
* - `BrowserRunScriptSuccessResponse` JSON with `Content-Type: application/json`
* when the script returns a JSON-serializable value or nothing
* - The raw body and content type when the script returns binary or other
* non-JSON output
*
* **Error:**
* - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
* - HTTP 408 when the script exceeds `timeout`
* - HTTP 422 when the script fails to compile or throws
* - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
* throw before any request is made.
*
* **Headers:**
* - `cf-browser-session-id`: Session kept open for `scriptInSession()`
* - `cf-browser-target-id`: Page target the script ran on
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
*/
script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
/**
* Run a script against an existing browser session, such as one kept open by
* `script()`.
* @param sessionId - Session to run in, such as the `cf-browser-session-id`
* header returned by `script()`.
* @param code - Source of an async function, as for `script()`.
* @param options - Library, timeout and page target options.
* @returns A `Response` with the same success bodies as `script()`.
*
* **Error:**
* - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
* - HTTP 404 when the session or `targetId` does not exist
* - HTTP 410 when the session is already closed
* - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
* throw before any request is made.
*
* **Headers:**
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
*/
scriptInSession(sessionId: string, code: string, options?: BrowserRunScriptSessionOptions): Promise<Response>;
/** DevTools JSON methods exposed through one nested binding target. */
get devtools(): BrowserRunDevtools;
}
Expand Down Expand Up @@ -12912,6 +12963,60 @@ declare abstract class D1PreparedStatement {
// ignored when `Disposable` is included in the standard lib.
interface Disposable {
}
/**
* The **`DOMException`** interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
*/
readonly code: number;
static readonly INDEX_SIZE_ERR: number;
static readonly DOMSTRING_SIZE_ERR: number;
static readonly HIERARCHY_REQUEST_ERR: number;
static readonly WRONG_DOCUMENT_ERR: number;
static readonly INVALID_CHARACTER_ERR: number;
static readonly NO_DATA_ALLOWED_ERR: number;
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
static readonly NOT_FOUND_ERR: number;
static readonly NOT_SUPPORTED_ERR: number;
static readonly INUSE_ATTRIBUTE_ERR: number;
static readonly INVALID_STATE_ERR: number;
static readonly SYNTAX_ERR: number;
static readonly INVALID_MODIFICATION_ERR: number;
static readonly NAMESPACE_ERR: number;
static readonly INVALID_ACCESS_ERR: number;
static readonly VALIDATION_ERR: number;
static readonly TYPE_MISMATCH_ERR: number;
static readonly SECURITY_ERR: number;
static readonly NETWORK_ERR: number;
static readonly ABORT_ERR: number;
static readonly URL_MISMATCH_ERR: number;
static readonly QUOTA_EXCEEDED_ERR: number;
static readonly TIMEOUT_ERR: number;
static readonly INVALID_NODE_TYPE_ERR: number;
static readonly DATA_CLONE_ERR: number;
get stack(): any;
set stack(value: any);
}
declare module 'cloudflare:durable-objects' {
/**
* Marks Durable Object methods as safe to run more than once. The runtime may then retry calls
Expand Down Expand Up @@ -15155,6 +15260,22 @@ declare namespace TailStream {
readonly type: "spanUpdate";
readonly info: SpanUpdateInfo;
}
/** A causal relationship to a span, including spans in another trace. */
interface SpanLink {
readonly context: {
readonly traceId: string;
readonly spanId: string;
readonly traceFlags: number;
};
readonly attributes: readonly Attribute[];
/** Attributes dropped before this link was recorded. */
readonly droppedAttributesCount: number;
}
/** Links added to the receiver identified by the event's spanContext. */
interface SpanLinks {
readonly type: "spanLinks";
readonly links: readonly SpanLink[];
}
interface DiagnosticChannelEvent {
readonly type: "diagnosticChannel";
readonly channel: string;
Expand Down Expand Up @@ -15208,7 +15329,7 @@ declare namespace TailStream {
readonly type: "attributes";
readonly info: Attribute[];
}
type EventType = Onset | Outcome | SpanOpen | SpanClose | SpanUpdate | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;
type EventType = Onset | Outcome | SpanOpen | SpanClose | SpanUpdate | SpanLinks | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;
// Context in which this trace event lives.
interface SpanContext {
// Single id for the entire top-level invocation
Expand Down Expand Up @@ -15244,6 +15365,7 @@ declare namespace TailStream {
spanOpen?: TailEventHandler<SpanOpen>;
spanClose?: TailEventHandler<SpanClose>;
spanUpdate?: TailEventHandler<SpanUpdate>;
spanLinks?: TailEventHandler<SpanLinks>;
diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
exception?: TailEventHandler<Exception>;
log?: TailEventHandler<Log>;
Expand Down
Loading