@technical-1/core
v0.1.0
Published
Shared types, typed error hierarchy, and Logger interface for the @technical-1 Puppeteer suite
Downloads
43
Readme
@technical-1/core
Foundational package for the @technical-1 Puppeteer capability suite. Zero
runtime dependencies. Every capability package depends on this for shared
contracts.
Exports:
- Typed error hierarchy —
PptrKitError(base) andSelectorNotFoundError,NavigationError,TimeoutError,CaptchaError,ProxyError,SessionError. Each carries aretryableflag and a structuredcontext. Loggerinterface — the dependency-injected logging contract. No implementation lives here (see@technical-1/logger).- Shared option shapes —
LoggerOption,TimeoutOption.
import { SelectorNotFoundError, type Logger } from "@technical-1/core";Detecting suite errors across packages
This package is published in both ESM and CommonJS form. In mixed
ESM/CJS deployments a consumer can end up with two copies of the
constructors, so err instanceof PptrKitError is not reliable across
package boundaries. Detect and classify suite errors by the stable
properties instead — this is the contract @technical-1/retry and
other consumers rely on:
function isRetryable(err: unknown): boolean {
return (
typeof err === "object" &&
err !== null &&
"retryable" in err &&
(err as { retryable?: unknown }).retryable === true
);
}err.name (e.g. "NavigationError") is the cross-realm-safe discriminant
for the specific error type; err.retryable is the cross-realm-safe
retry signal.
