### Install @nexload-sdk/healthcheck and @nexload-sdk/healthcheck-next Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/installation Install the healthcheck core and Next.js route packages with pnpm. Use npm install, yarn add, or bun add with the same package names if the project does not use pnpm. ```bash pnpm add @nexload-sdk/healthcheck @nexload-sdk/healthcheck-next ``` -------------------------------- ### Install with pnpm Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/payload/installation Install the required packages using pnpm. The optional Payload peer range is >=3. ```bash pnpm add @nexload-sdk/healthcheck @nexload-sdk/healthcheck-payload payload ``` -------------------------------- ### Install @nexload-sdk/healthcheck core package Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/installation Installs the core healthcheck package. The examples use pnpm; with another package manager, use npm install, yarn add, or bun add with the same package names. ```bash pnpm add @nexload-sdk/healthcheck ``` -------------------------------- ### Install @nexload-sdk/payload-fields with pnpm Source: https://gecut.github.io/nexload-sdk/packages/payload-fields/installation Install the package with the runtime peers used by your Payload project. The examples use pnpm; with another package manager, use npm install, yarn add, or bun add with the same package names. ```bash pnpm add @nexload-sdk/payload-fields payload @payloadcms/ui react react-dom ``` -------------------------------- ### Install @nexload-sdk/payload-operations with pnpm Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/installation Installs the package along with its required peer dependencies: payload, @payloadcms/sdk, and zod. The examples use pnpm; other package managers can use npm install, yarn add, or bun add with the same package names. ```bash pnpm add @nexload-sdk/payload-operations payload @payloadcms/sdk zod ``` -------------------------------- ### Install @nexload-sdk/payload-editor with pnpm Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/installation Install the package with its required peers. Use pnpm; with npm, yarn, or bun, substitute the corresponding install command with the same package names. Version 1.1.0 requires payload and @payloadcms/richtext-lexical from 3.68.5 up to, but not including, 4, and all @payloadcms/* dependencies must stay on exactly the same version. ```bash pnpm add @nexload-sdk/payload-editor payload @payloadcms/richtext-lexical ``` -------------------------------- ### Install optional healthcheck integrations Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/installation Installs optional integrations separately; they are not bundled with the core package. Do not install Node and Bun adapters merely to expose HTTP routes, as runtime probes and HTTP route factories solve different problems. ```bash pnpm add @nexload-sdk/healthcheck-node pnpm add @nexload-sdk/healthcheck-bun pnpm add @nexload-sdk/healthcheck-next pnpm add @nexload-sdk/healthcheck-prometheus pnpm add @nexload-sdk/healthcheck-otel pnpm add @nexload-sdk/healthcheck-payload payload ``` -------------------------------- ### Install @nexload-sdk/healthcheck-prometheus with core Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/prometheus/installation Install the healthcheck core and Prometheus serializers together. Use npm install, yarn add, or bun add with the same package names if the project does not use pnpm. No Prometheus client library is required; the package emits text and your application owns the HTTP endpoint and authentication. ```bash pnpm add @nexload-sdk/healthcheck @nexload-sdk/healthcheck-prometheus ``` -------------------------------- ### Install healthcheck-nextjs-routes Skill Source: https://gecut.github.io/nexload-sdk/agents/install Installs the healthcheck-nextjs-routes Skill, which provides guidance for creating a Next.js health route. This is an example of installing a specific Skill for a particular use case. ```bash npx skills add gecut/nexload-sdk --skill healthcheck-nextjs-routes ``` -------------------------------- ### Install @nexload-sdk/healthcheck and @nexload-sdk/healthcheck-node with pnpm Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/node/installation Install the healthcheck core and Node integration packages with pnpm. Use npm install, yarn add, or bun add with the same package names if the project does not use pnpm. ```bash pnpm add @nexload-sdk/healthcheck @nexload-sdk/healthcheck-node ``` -------------------------------- ### List available Skills with npx skills add --list Source: https://gecut.github.io/nexload-sdk/agents/install Lists the available Skills from the Nexload SDK repository before installing. The official skills CLI discovers the current skills/**/SKILL.md files, so the list command is the source of truth instead of a hard-coded count. ```bash npx skills add gecut/nexload-sdk --list ``` -------------------------------- ### Compose startup and HTTP checks with createHealthManager Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/examples Shows how to set up a health manager with a startup check and an HTTP check for the 'readiness' scope, then run the report and serialize it with stringifyHealthJson. The example uses the 'standard' profile and optional redaction. ```typescript import { createHealthManager, httpCheck, startupCheck, stringifyHealthJson, } from "@nexload-sdk/healthcheck"; const health = createHealthManager({ service: { name: "worker" }, checks: [ startupCheck({ isStarted: () => queue.connected }), httpCheck("upstream", "https://api.example.com/status", { scopes: ["readiness"], }), ], }); const report = await health.run("readiness", { profile: "standard", }); const body = stringifyHealthJson(report, { includeDetails: false, redact: true, }); ``` -------------------------------- ### Install a specific Skill with npx skills add --skill Source: https://gecut.github.io/nexload-sdk/agents/install Installs the healthcheck-core Skill for the current project. Use this command to add a specific Skill rather than installing all Skills. ```bash npx skills add gecut/nexload-sdk --skill healthcheck-core ``` -------------------------------- ### Expose OpenMetrics output with toOpenMetricsText Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/prometheus/examples Expose OpenMetrics output from a framework handler. The example imports toOpenMetricsText from the package, runs the health check, and returns a Response with the OpenMetrics text and appropriate headers. ```ts import { toOpenMetricsText } from "@nexload-sdk/healthcheck-prometheus"; const report = await health.run("all"); return new Response(toOpenMetricsText(report, { prefix: "my_service", defaultLabels: { version: process.env.APP_VERSION ?? "unknown" }, }), { headers: { "content-type": "application/openmetrics-text; version=1.0.0", "cache-control": "no-store" }, }); ``` -------------------------------- ### Install @nexload-sdk/payload-schema with pnpm Source: https://gecut.github.io/nexload-sdk/packages/payload-schema/installation Install the ESM-only Payload Schema package with supported Payload and Zod peers. Use pnpm; with another package manager, use npm install, yarn add, or bun add with the same package names. ```bash pnpm add @nexload-sdk/payload-schema payload zod ``` -------------------------------- ### Install packages with bun add Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/bun/installation Use the package manager already used by the project. The package names do not change with pnpm, npm, or Yarn. The packages are designed to run under Bun and are not an HTTP framework adapter. ```bash bun add @nexload-sdk/healthcheck @nexload-sdk/healthcheck-bun ``` -------------------------------- ### Install with pnpm: pnpm add @nexload-sdk/healthcheck @nexload-sdk/healthcheck-otel Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/otel/installation Adds the healthcheck core and OpenTelemetry transforms packages. Run this command in your project root using pnpm. ```bash pnpm add @nexload-sdk/healthcheck @nexload-sdk/healthcheck-otel ``` -------------------------------- ### Verify readiness endpoint with curl Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/quick-start Verifies the readiness endpoint after starting Next.js. The response should be 200, include cache-control: no-store, and contain a JSON report with "status":"ok" and "scope":"readiness". ```bash curl -i http://localhost:3000/api/health/ready ``` -------------------------------- ### Example Prometheus text output Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/prometheus/quick-start Example output of the Prometheus text conversion. The exact uptime value varies; the status series proves the report was serialized, and the runtime series proves report-level collector metrics were included. ```text nexload_health_status{service="api",scope="all",status="ok"} 1 nexload_service_uptime_seconds{service="api",scope="all"} 42 ``` -------------------------------- ### Update installed Skills with npx skills update Source: https://gecut.github.io/nexload-sdk/agents/install Updates installed Skills when you intentionally want newer guidance. Run this command to refresh your Skills to the latest versions. ```bash npx skills update ``` -------------------------------- ### createNextMetricsRoute function signature (TypeScript) Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/api Returns a GET handler for metrics. Requires a HealthManager and NextMetricsRouteOptions. ```typescript createNextMetricsRoute(manager: HealthManager, options: NextMetricsRouteOptions) => { GET: (request: Request) => Promise; } ``` -------------------------------- ### Define entity, compile Payload fields, and derive schema Source: https://gecut.github.io/nexload-sdk/packages/payload-schema/quick-start Defines a Product entity with text, slug, and number fields, compiles Payload fields via productEntity.payload.all(), and derives a Zod schema with pick() that makes inventory optional. The parse example shows trim and slug normalization: title becomes "New Product" and slug "new-product". The factory-level defaultValue is not converted to Zod .default(); it belongs to Payload. ```ts import { defineEntity, field, } from "@nexload-sdk/payload-schema"; import type { CollectionConfig } from "payload"; export const productEntity = defineEntity({ name: "Product", fields: { title: field.text({ required: true, trim: true }), slug: field.slug({ required: true }), inventory: field.number({ integer: true, safe: true, defaultValue: 0, }), }, }); export const Products: CollectionConfig = { slug: "products", fields: productEntity.payload.all(), }; export const createProductSchema = productEntity.schema(({ pick }) => pick(["title", "slug", "inventory"], { optional: ["inventory"], }), ); const input = createProductSchema.parse({ title: " New Product ", slug: " New Product ", }); console.log(input); // { title: "New Product", slug: "new-product" } ``` -------------------------------- ### Serve readiness report with Bun.serve and health.run Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/bun/examples Use this snippet to serve a readiness endpoint in Bun. It returns a 404 for any path other than "/readyz", runs the "readiness" health check, and responds with a JSON report, using HTTP 503 when the report status is "unhealthy" and 200 otherwise. The response includes "content-type: application/json" and "cache-control: no-store" headers. ```ts import { stringifyHealthJson } from "@nexload-sdk/healthcheck"; import { health } from "./health"; Bun.serve({ async fetch(request) { if (new URL(request.url).pathname !== "/readyz") return new Response("Not found", { status: 404 }); const report = await health.run("readiness"); return new Response(stringifyHealthJson(report), { status: report.status === "unhealthy" ? 503 : 200, headers: { "content-type": "application/json", "cache-control": "no-store" }, }); }, }); ``` -------------------------------- ### Connect a Bun server to a health manager with @nexload-sdk/healthcheck-bun Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/bun/quick-start Sets up a health manager for a Bun server using the @nexload-sdk/healthcheck-bun package. Imports createHealthManager and shutdownCheck from the core package, plus bunRuntimeAdapter and bunServerMetricsCheck from the Bun adapter. Creates a Bun server, defines a health manager with the service name "bun-api", and runs a readiness check that logs the status and runtime name. ```ts import { createHealthManager, shutdownCheck } from "@nexload-sdk/healthcheck"; import { bunRuntimeAdapter, bunServerMetricsCheck } from "@nexload-sdk/healthcheck-bun"; const server = Bun.serve({ fetch: () => new Response("ok") }); export const health = createHealthManager({ service: { name: "bun-api" }, runtime: bunRuntimeAdapter(), checks: [shutdownCheck(), bunServerMetricsCheck(server)], }); const report = await health.run("readiness"); console.log(report.status, report.runtime.name); // ok bun ``` -------------------------------- ### startupCheck Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/api Creates a health check definition for startup status. Accepts an options object with an isStarted function and optional scopes and timeout. ```APIDOC ## `startupCheck` ### Description Creates a health check definition for startup status. ### Signature ts startupCheck(options: { isStarted: () => boolean | Promise; scopes?: readonly HealthScope[]; timeoutMs?: number; }) => HealthCheckDefinition<"startup"> ### Parameters - **options** (object) - Required - Options for the startup check. - **isStarted** (function) - Required - A function that returns a boolean or Promise indicating whether the system has started. - **scopes** (readonly HealthScope[]) - Optional - Health scopes to associate with the check. - **timeoutMs** (number) - Optional - Timeout in milliseconds for the check. ### Returns - **HealthCheckDefinition<"startup">** - A health check definition for the startup check. ``` -------------------------------- ### Create health manager and run readiness report Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/quick-start Creates a health manager with shutdown, runtime, and memory checks, then runs a readiness report. The output shows a healthy first run with all three checks passing. ```ts import { createHealthManager, memoryCheck, runtimeInfoCheck, shutdownCheck, } from "@nexload-sdk/healthcheck"; export const health = createHealthManager({ service: { name: "api", version: process.env.APP_VERSION }, runtime: "auto", checks: [shutdownCheck(), runtimeInfoCheck(), memoryCheck()], }); const report = await health.run("readiness"); console.log(report.status, report.summary); ``` ```text ok { ok: 3, degraded: 0, unhealthy: 0, total: 3, criticalFailed: 0, nonCriticalFailed: 0 } ``` -------------------------------- ### Make one operation public with access overrides (ping operation) Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/guides Overrides the default access (`Boolean(req.user)`) for the `ping` operation to allow public access. Denied anonymous requests get 401, denied authenticated requests get 403. The access tree is partial but cannot contain unknown leaves, and the handler tree must match every operation exactly. ```typescript createPayloadEndpoints({ operations: cmsOperations, handlers, access: { overrides: { status: { ping: () => true, }, }, }, }); ``` -------------------------------- ### genericRuntimeAdapter Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/api Creates a generic runtime adapter that works across environments. ```APIDOC ## `genericRuntimeAdapter` ### Description Creates a generic runtime adapter that works across environments. ### Signature ```ts genericRuntimeAdapter() => RuntimeAdapter ``` ### Returns - **RuntimeAdapter** - The runtime adapter. ``` -------------------------------- ### createNextHealthRoute function signature (TypeScript) Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/api Returns an object with GET and HEAD handlers for health checks. Requires a HealthManager and NextHealthRouteOptions. ```typescript createNextHealthRoute(manager: HealthManager, options: NextHealthRouteOptions) => { GET: (request: Request) => Promise; HEAD: (request: Request) => Promise; } ``` -------------------------------- ### autoRuntimeAdapter Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/api Creates a runtime adapter that automatically selects the appropriate runtime environment. ```APIDOC ## `autoRuntimeAdapter` ### Description Creates a runtime adapter that automatically selects the appropriate runtime environment. ### Signature ```ts autoRuntimeAdapter() => RuntimeAdapter ``` ### Returns - **RuntimeAdapter** - The runtime adapter. ``` -------------------------------- ### resolveCurrency function signature Source: https://gecut.github.io/nexload-sdk/packages/payload-fields/api Signature for the public function resolveCurrency, which returns the definition of a given money currency. Use it to get currency metadata for formatting or parsing. ```ts resolveCurrency(currency: MoneyCurrency) => MoneyCurrencyDefinition ``` -------------------------------- ### Create health manager and run readiness check Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/quick-start Creates a health manager with shutdown, runtime info, and memory checks, then runs a readiness check and logs the status and summary. The output shows a healthy first run with all three checks passing. ```typescript import { createHealthManager, memoryCheck, runtimeInfoCheck, shutdownCheck, } from "@nexload-sdk/healthcheck"; export const health = createHealthManager({ service: { name: "api", version: process.env.APP_VERSION }, runtime: "auto", checks: [shutdownCheck(), runtimeInfoCheck(), memoryCheck()], }); const report = await health.run("readiness"); console.log(report.status, report.summary); ``` ```text ok { ok: 3, degraded: 0, unhealthy: 0, total: 3, criticalFailed: 0, nonCriticalFailed: 0 } ``` -------------------------------- ### Import universal and client APIs from root Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/installation Imports createCMSClient, defineCMSOperations, and operation from the package root for universal and client-side usage. ```typescript import { createCMSClient, defineCMSOperations, operation, } from "@nexload-sdk/payload-operations"; ``` -------------------------------- ### Create health manager with Node runtime and checks Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/node/quick-start Imports from @nexload-sdk/healthcheck and @nexload-sdk/healthcheck-node, creates a health manager with service name 'api', node runtime adapter, shutdown, memory, and container resource checks, and a process metrics collector. Then runs a readiness check and logs the status and runtime name. ```typescript import { createHealthManager, memoryCheck, shutdownCheck } from "@nexload-sdk/healthcheck"; import { containerResourceCheck, nodeRuntimeAdapter, processMetricsCollector, } from "@nexload-sdk/healthcheck-node"; export const health = createHealthManager({ service: { name: "api" }, runtime: nodeRuntimeAdapter(), checks: [shutdownCheck(), memoryCheck(), containerResourceCheck()], collectors: [processMetricsCollector()], }); const report = await health.run("readiness"); console.log(report.status, report.runtime.name); // ok node ``` -------------------------------- ### Import server API from /server entrypoint Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/installation Imports createPayloadEndpoints from the /server subpath. This entrypoint imports Payload runtime helpers and should not be used in browser bundles. ```typescript import { createPayloadEndpoints } from "@nexload-sdk/payload-operations/server"; ``` -------------------------------- ### bunRuntimeAdapter() Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/bun/api Public function exported by @nexload-sdk/healthcheck-bun. Returns the core runtime adapter. ```APIDOC ## bunRuntimeAdapter() ### Description Returns the core runtime adapter for the Bun runtime. ### Signature ```ts bunRuntimeAdapter() => RuntimeAdapter ``` ### Parameters None. ### Returns - **RuntimeAdapter** - The runtime adapter object. ``` -------------------------------- ### bunRuntimeInfoCheck(options?) Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/bun/api Public function exported by @nexload-sdk/healthcheck-bun. Creates the `bun.runtime` diagnostic check. ```APIDOC ## bunRuntimeInfoCheck(options?) ### Description Creates the `bun.runtime` diagnostic check. ### Signature ```ts bunRuntimeInfoCheck(options?: { scopes?: readonly HealthScope[]; }) => HealthCheckDefinition<"bun.runtime"> ``` ### Parameters #### Optional Parameters - **options** (object) - Optional configuration. - **scopes** (readonly HealthScope[]) - Optional. Health check scopes. ### Returns - **HealthCheckDefinition<"bun.runtime">** - The health check definition. ``` -------------------------------- ### bunServerMetricsCheck(server, options?) Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/bun/api Public function exported by @nexload-sdk/healthcheck-bun. Creates the `bun.server.metrics` health check. ```APIDOC ## bunServerMetricsCheck(server, options?) ### Description Creates the `bun.server.metrics` health check. ### Signature ```ts bunServerMetricsCheck(server: BunServerLike, options?: { scopes?: readonly HealthScope[]; }) => HealthCheckDefinition<"bun.server.metrics"> ``` ### Parameters #### Required Parameters - **server** (BunServerLike) - The Bun server-like object. #### Optional Parameters - **options** (object) - Optional configuration. - **scopes** (readonly HealthScope[]) - Optional. Health check scopes. ### Returns - **HealthCheckDefinition<"bun.server.metrics">** - The health check definition. ``` -------------------------------- ### Create editor with standard preset Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/installation Create an editor with the standard preset. Load the Payload config and open a rich-text field; a missing definition, unknown preset, invalid option, or duplicate native feature fails synchronously while config loads. If Payload reports incompatible Lexical types or duplicate packages, inspect the resolved versions of payload and @payloadcms/richtext-lexical first; do not solve version skew with casts. ```ts export const editor = createEditor({ preset: "standard" }); ``` -------------------------------- ### Configure container, TCP, and DNS health checks Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/node/guides Creates a list of health checks for container resource usage, TCP connectivity, and DNS resolution. Use this to configure readiness checks that keep infrastructure dependencies in readiness without restarting a healthy process on DNS or database outages. ```ts import { containerResourceCheck, dnsCheck, tcpCheck } from "@nexload-sdk/healthcheck-node"; const checks = [ containerResourceCheck({ memory: { usageRatio: { degraded: 0.85, unhealthy: 0.95 } }, scopes: ["diagnostics"], }), tcpCheck("postgres", { host: "db", port: 5432, timeoutMs: 500 }), dnsCheck("service-dns", { hostname: "api.internal", recordType: "A" }), ]; ``` -------------------------------- ### Create default Payload editor with standard preset Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/examples Sets up a single default editor for all Payload rich text fields using the standard preset. Requires the @nexload-sdk/payload-editor package and a Payload config with a Pages collection. ```ts import { createEditor } from "@nexload-sdk/payload-editor"; import { buildConfig } from "payload"; export default buildConfig({ editor: createEditor({ preset: "standard" }), collections: [Pages], }); ``` -------------------------------- ### BunServerLike Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/bun/api Public interface exported by @nexload-sdk/healthcheck-bun. Represents the minimal server shape. ```APIDOC ## Interface: BunServerLike ### Description Minimal server shape: pending request/WebSocket counters and optional subscribers. ### Properties - **pendingRequests** (number) - Optional. Number of pending requests. - **pendingWebSockets** (number) - Optional. Number of pending WebSockets. - **subscriberCount** ((topic: string) => number) - Optional. Function to get subscriber count for a topic. ``` -------------------------------- ### createEditor(options) Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Validates and merges one definition, creates managed feature providers in deterministic order, appends native extensions, and returns Payload's Lexical editor provider. ```APIDOC ## createEditor(options) ### Description Validates and merges one definition, creates managed feature providers in deterministic order, appends native extensions, and returns Payload's Lexical editor provider. ### Method Function ### Parameters - **options** (object) - Required - The editor definition to validate and merge. ### Returns - Payload's Lexical editor provider. ``` -------------------------------- ### CMSClientOptions Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/api Options for creating a CMS client, including base path, operations tree, payload client options, and plugins. ```APIDOC ## CMSClientOptions ### Description Configuration options for initializing a CMS client. ### Interface ```ts interface CMSClientOptions< TOperations extends CMSOperationsTree > { basePath?: string operations: TOperations payload: CMSPayloadClientOptions plugins?: readonly CMSClientPlugin[] } ``` ### Properties - **basePath** (string) - Optional - Base path for API requests. - **operations** (TOperations) - Required - The operations tree. - **payload** (CMSPayloadClientOptions) - Required - Payload client options. - **plugins** (readonly CMSClientPlugin[]) - Optional - Array of client plugins. ### Exported From - `@nexload-sdk/payload-operations` - `@nexload-sdk/payload-operations/client` ### Source [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/payload-operations/src/client/types.ts#L23) ``` -------------------------------- ### Import createEditor from @nexload-sdk/payload-editor Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/installation Import createEditor for server/config usage. The package is ESM-only and side-effect free; do not import it from browser components. The returned object is the result of Payload's native lexicalEditor(...) call and should be placed where Payload expects an editor provider. ```ts import { createEditor } from "@nexload-sdk/payload-editor"; ``` -------------------------------- ### RuntimeCpuSnapshot Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/api Interface representing a snapshot of CPU usage metrics. ```APIDOC ## RuntimeCpuSnapshot ### Description Interface representing a snapshot of CPU usage metrics. ### Interface ```ts interface RuntimeCpuSnapshot { userMicros: number | null systemMicros: number | null availableParallelism: number | null } ``` ### Properties - **userMicros** (number | null) - CPU time spent in user mode in microseconds. - **systemMicros** (number | null) - CPU time spent in system mode in microseconds. - **availableParallelism** (number | null) - The number of available parallel threads. ### Exported From `@nexload-sdk/healthcheck` ``` -------------------------------- ### Parse at an import boundary with formatSlug and parseMoneyToMinorUnits Source: https://gecut.github.io/nexload-sdk/packages/payload-fields/examples Formats a slug and parses a display price to minor units before creating a product via the Local API. The Local API receives the stored representation, not Admin display text. ```typescript import { formatSlug, parseMoneyToMinorUnits, } from "@nexload-sdk/payload-fields"; const data = { slug: formatSlug(row.title), price: parseMoneyToMinorUnits(row.displayPrice, "IRT"), }; await payload.create({ collection: "products", data }); ``` -------------------------------- ### createNextMetricsRoute Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/api Factory function that creates Next.js route handlers for metrics. ```APIDOC ## createNextMetricsRoute(manager, options) ### Description Creates Next.js App Router route handlers for metrics. Returns an object with a GET handler. ### Signature ```ts createNextMetricsRoute(manager: HealthManager, options: NextMetricsRouteOptions) => { GET: (request: Request) => Promise; } ``` ### Parameters - **manager** (HealthManager) - Required - The health manager instance. - **options** (NextMetricsRouteOptions) - Required - Configuration options for the metrics route. ### Returns - **GET** (function) - Handler for GET requests. ### Options (NextMetricsRouteOptions) - **format** ("prometheus" | "openmetrics" | "json") - Required - Metrics format. - **scope** (HealthRunScope) - Optional - Scope for the metrics run. - **protect** (NextHealthRouteProtection) - Optional - Protection configuration. - **prefix** (string) - Optional - Prefix for metric names. - **defaultLabels** (Record) - Optional - Default labels. ### Example ```ts import { createNextMetricsRoute } from '@nexload-sdk/healthcheck-next'; const { GET } = createNextMetricsRoute(manager, { format: 'prometheus', }); ``` ``` -------------------------------- ### Define an organization preset with defineEditorPreset Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/guides Defines a custom editor preset with specific features and uses it to create an editor. The preset restricts headings to h2 and h3, enables auto-linking with a max depth of 1, and includes an inline toolbar. ```ts import { createEditor, defineEditorPreset, } from "@nexload-sdk/payload-editor"; const landingPage = defineEditorPreset({ features: { paragraph: true, heading: { sizes: ["h2", "h3"] }, bold: true, link: { autoLink: true, maxDepth: 1 }, inlineToolbar: true, }, }); export const editor = createEditor({ preset: landingPage }); ``` -------------------------------- ### createEditor Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Creates a Payload editor instance using the provided options. ```APIDOC ## createEditor ### Description Creates a Payload editor instance using the provided options. ### Signature ```ts createEditor(options: CreateEditorOptions) => ReturnType ``` ### Parameters - **options** (`CreateEditorOptions`) - Required - Options for creating the editor. ### Returns - `ReturnType` - The created editor instance. ### Exported From `@nexload-sdk/payload-editor` ### Source https://github.com/gecut/nexload-sdk/blob/main/packages/payload-editor/src/create-editor.ts#L54 ``` -------------------------------- ### createPayloadEndpoints function signature Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/api Creates an array of endpoints for the server. Exported from @nexload-sdk/payload-operations/server. ```ts createPayloadEndpoints(options: CreatePayloadEndpointsOptions) => Endpoint[] ``` -------------------------------- ### Migrate lexicalEditor to createEditor with features object Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/migration Shows the migration from the old lexicalEditor factory with a features array to the new createEditor with a features object. The 'Before' block uses lexicalEditor with a function returning an array of feature instances, while the 'After' block uses createEditor with a features object mapping feature names to booleans. This is the core migration step for moving to Payload Editor 1.1.0. ```ts // Before lexicalEditor({ features: () => [ParagraphFeature(), BoldFeature()] }) ``` ```ts // After createEditor({ features: { paragraph: true, bold: true } }) ``` -------------------------------- ### Local API normalization with defineEntity Source: https://gecut.github.io/nexload-sdk/packages/payload-schema/examples Defines a Customer entity with a normalized email field and creates a Payload collection. The email is trimmed and lowercased, so the stored value becomes 'user@example.com'. The same canonical transform is available at customerEntity.fields.email.schema. ```ts const customerEntity = defineEntity({ name: "Customer", fields: { email: field.text({ trim: true, lowercase: true, required: true }), }, }); export const Customers = { slug: "customers", fields: customerEntity.payload.all(), }; await payload.create({ collection: "customers", data: { email: " USER@EXAMPLE.COM " }, }); ``` -------------------------------- ### LinkOptions Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Options for link feature. ```APIDOC ## LinkOptions ### Description Options for link feature. ### Interface Signature ```ts interface LinkOptions extends RelationalOptions { autoLink?: boolean } ``` ### Properties - **autoLink** (`boolean`) - Optional - Whether to enable auto-linking. - Inherits properties from `RelationalOptions`. ### Exported From `@nexload-sdk/payload-editor` ### Source https://github.com/gecut/nexload-sdk/blob/main/packages/payload-editor/src/types.ts#L31 ``` -------------------------------- ### Import public API from @nexload-sdk/payload-schema Source: https://gecut.github.io/nexload-sdk/packages/payload-schema/installation Import public API from the package root. The package is ESM-only, server/config safe, and side-effect free; internal compiler, adapter, registry, and IR modules are not public subpaths. ```ts import { defineEntity, field, PayloadSchemaError, } from "@nexload-sdk/payload-schema"; ``` -------------------------------- ### Create Next.js readiness route in app/api/health/ready/route.ts Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/quick-start Defines the readiness route in app/api/health/ready/route.ts. The route-module exports prevent Next.js caching and static treatment, and the factory sets no-store response headers. ```ts import { createNextHealthRoute } from "@nexload-sdk/healthcheck-next"; import { health } from "@/lib/health"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; export const revalidate = 0; export const fetchCache = "force-no-store"; export const { GET, HEAD } = createNextHealthRoute(health, { scope: "readiness", }); ``` -------------------------------- ### EditorPreset Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Represents an editor preset. ```APIDOC ## EditorPreset ### Description Represents an editor preset. ### Interface Signature ```ts interface EditorPreset { readonly [editorPresetBrand]: true readonly features: Readonly } ``` ### Properties - **editorPresetBrand** (`true`) - Required - Brand property to identify the preset. - **features** (`Readonly`) - Required - The feature configuration. ### Exported From `@nexload-sdk/payload-editor` ### Source https://github.com/gecut/nexload-sdk/blob/main/packages/payload-editor/src/types.ts#L57 ``` -------------------------------- ### Core API Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/api Core API functions for defining operations, creating clients, and defining plugins. ```APIDOC ## operation({ input, output, errors? }) ### Description Brands one immutable operation definition while preserving schema identity. ### Parameters - **input** (schema) - Required - The input schema for the operation. - **output** (schema) - Required - The output schema for the operation. - **errors** (object) - Optional - Error definitions. Error codes must be uppercase snake case, status must be 400–599, and messages must be non-empty. ## defineCMSOperations(tree) ### Description Validates and snapshots a direct recursive namespace. It accepts no `query` or `command` wrapper. ### Parameters - **tree** (object) - Required - The recursive namespace of operations. ## createCMSClient(options) ### Description Returns `{ payload, operations }`. `payload` is the actual `PayloadSDK` instance. `operations` mirrors the supplied contract. ### Parameters - **options** (CMSClientOptions) - Required - Configuration options. ### CMSClientOptions - **operations** (object) - Required - The operations contract. - **payload** (PayloadSDK) - Required - The Payload SDK instance. - **plugins** (array) - Optional - List of plugins. - **basePath** (string) - Optional - Base path for operations. ### Operation Calls Operation calls accept `Omit`; the package always supplies POST and the serialized body. ## defineClientPlugin(plugin) ### Description Validates and freezes a named transport wrapper. Plugin names must be unique; the first plugin is outermost. ### Parameters - **plugin** (object) - Required - The plugin definition. ``` -------------------------------- ### field Source: https://gecut.github.io/nexload-sdk/packages/payload-schema/api A frozen namespace of 14 field factories. ```APIDOC ## Namespace: field ### Description A frozen namespace of 14 field factories. ### Exported From `@nexload-sdk/payload-schema` ``` -------------------------------- ### HeadingOptions Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Options for heading feature. ```APIDOC ## HeadingOptions ### Description Options for heading feature. ### Interface Signature ```ts interface HeadingOptions { sizes?: readonly HeadingSize[] } ``` ### Properties - **sizes** (`readonly HeadingSize[]`) - Optional - Allowed heading sizes. ### Exported From `@nexload-sdk/payload-editor` ### Source https://github.com/gecut/nexload-sdk/blob/main/packages/payload-editor/src/types.ts#L24 ``` -------------------------------- ### CMSPayloadClientOptions interface Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/api Defines the options for the CMS payload client, including an optional baseInit, a required baseURL, and an optional fetch function. Exported from '@nexload-sdk/payload-operations' and '@nexload-sdk/payload-operations/client'. ```typescript interface CMSPayloadClientOptions { baseInit?: RequestInit baseURL: string fetch?: typeof fetch } ``` -------------------------------- ### Create CMS client with createCMSClient Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/quick-start Creates a client using the same contract. The client exposes cms.payload as the native PayloadSDK instance and cms.operations mirrors the contract tree without an extra namespace. ```ts import { createCMSClient } from "@nexload-sdk/payload-operations/client"; const cms = createCMSClient({ operations: cmsOperations, payload: { baseURL: "https://cms.example.com/api" }, }); const result = await cms.operations.account.rename({ name: "Nexload" }); ``` -------------------------------- ### CreatePayloadEndpointsOptions interface Source: https://gecut.github.io/nexload-sdk/packages/payload-operations/api Generic interface for configuring Payload endpoints, with options for access control, base path, handlers, and operations. Requires an operations tree type parameter. Exported from '@nexload-sdk/payload-operations/server'. ```typescript interface CreatePayloadEndpointsOptions< TOperations extends CMSOperationsTree > { access?: { default?: CMSOperationAccess overrides?: CMSOperationAccessOverrides } basePath?: string handlers: CMSOperationHandlers operations: TOperations } ``` -------------------------------- ### Configure stricter field editor with product-description preset Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/examples Creates a stricter editor for a product description field, restricting heading sizes to h2, limiting uploads to the product-media collection with maxDepth 0, and disabling the fixed toolbar. The editor is then assigned to a richText field definition. ```ts const productEditor = createEditor({ preset: "product-description", features: { heading: { sizes: ["h2"] }, upload: { allowedCollections: ["product-media"], maxDepth: 0, }, fixedToolbar: false, }, }); const description = { name: "description", type: "richText", editor: productEditor, } as const; ``` -------------------------------- ### DefineEditorPresetOptions Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Options for defining an editor preset. ```APIDOC ## DefineEditorPresetOptions ### Description Options for defining an editor preset. ### Interface Signature ```ts interface DefineEditorPresetOptions { readonly features: Readonly } ``` ### Properties - **features** (`Readonly`) - Required - The feature configuration for the preset. ### Exported From `@nexload-sdk/payload-editor` ### Source https://github.com/gecut/nexload-sdk/blob/main/packages/payload-editor/src/types.ts#L62 ``` -------------------------------- ### CreateEditorOptions type Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Defines the options for creating an editor. Requires either a preset or explicit features, but not both. Exported from @nexload-sdk/payload-editor. ```ts type CreateEditorOptions = CommonEditorOptions & ( | { readonly preset: EditorPresetName | EditorPreset readonly features?: Readonly } | { readonly preset?: never readonly features: Readonly } ); ``` -------------------------------- ### nodeRuntimeAdapter Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/node/api Public function exported by @nexload-sdk/healthcheck-node. Returns a runtime adapter for Node.js. ```APIDOC ## nodeRuntimeAdapter ### Description Public function exported by @nexload-sdk/healthcheck-node. Returns a runtime adapter for Node.js. ### Signature ```ts nodeRuntimeAdapter() => RuntimeAdapter ``` ### Returns - **RuntimeAdapter** - A runtime adapter. ``` -------------------------------- ### Import slugField and formatSlug from @nexload-sdk/payload-fields Source: https://gecut.github.io/nexload-sdk/packages/payload-fields/installation Import field factories from the root or their public semantic subpaths. Payload resolves the four ./admin/* exports from generated Import Map entries; do not hand-edit generated Import Map files. ```ts import { slugField } from "@nexload-sdk/payload-fields"; import { formatSlug } from "@nexload-sdk/payload-fields/slug"; ``` -------------------------------- ### HttpCheckOptions Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/api Options for an HTTP health check. ```APIDOC ### `HttpCheckOptions` ```ts interface HttpCheckOptions { scopes?: readonly HealthScope[] method?: "GET" | "HEAD" | "POST" headers?: HeadersInit body?: BodyInit | null } ``` [Source](https://github.com/gecut/nexload-sdk/blob/main/packages/healthcheck/core/src/core/types.ts#L10) ``` -------------------------------- ### Expose protected OpenMetrics route with createNextMetricsRoute Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/examples Creates a protected OpenMetrics route in Next.js. Requires a health object and sets the runtime to Node.js with dynamic rendering. The route is protected by a bearer token from the METRICS_TOKEN environment variable. ```ts import { createNextMetricsRoute } from "@nexload-sdk/healthcheck-next"; import { health } from "@/lib/health"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; export const { GET, HEAD } = createNextMetricsRoute(health, { format: "openmetrics", scope: "all", prefix: "web", protect: { bearerToken: process.env.METRICS_TOKEN! }, }); ``` -------------------------------- ### Create health manager in src/lib/health.ts Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/quick-start Creates a health manager instance in src/lib/health.ts. The manager is initialized with a service name, auto runtime detection, and a runtime info check. This file must be created before the Next.js route. ```ts import { createHealthManager, runtimeInfoCheck } from "@nexload-sdk/healthcheck"; export const health = createHealthManager({ service: { name: "web" }, runtime: "auto", checks: [runtimeInfoCheck()], }); ``` -------------------------------- ### payloadHealthCheck with collection settings and where key equals primary Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/payload/examples Use this minimum configuration to require a known settings document before accepting traffic. The call checks the "settings" collection for a document with key "primary", expects at least one document, and times out after 750 ms. ```ts import { payloadHealthCheck } from "@nexload-sdk/healthcheck-payload"; const payloadReady = payloadHealthCheck(payload, { collection: "settings", where: { key: { equals: "primary" } }, expectedMinDocuments: 1, limit: 1, depth: 0, timeoutMs: 750, }); ``` -------------------------------- ### Create protected diagnostics route with createNextHealthRoute Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/next/guides Creates a protected diagnostics route with bearer token authentication. Set includeDetails to true only for this route and keep the public /livez and /readyz routes with includeDetails false. The bearer token is read from the HEALTH_TOKEN environment variable. ```ts export const { GET, HEAD } = createNextHealthRoute(health, { scope: "diagnostics", includeDetails: true, protect: { bearerToken: process.env.HEALTH_TOKEN! }, }); ``` -------------------------------- ### defineEditorPreset(options) Source: https://gecut.github.io/nexload-sdk/packages/payload-editor/api Validates and snapshots a reusable feature definition. Only presets created by this function or built-in preset names are accepted. ```APIDOC ## defineEditorPreset(options) ### Description Validates and snapshots a reusable feature definition. Only presets created by this function or built-in preset names are accepted. ### Method Function ### Parameters - **options** (object) - Required - The feature definition to validate and snapshot. ### Returns - A snapshot of the feature definition. ``` -------------------------------- ### RuntimeCpuSnapshot interface Source: https://gecut.github.io/nexload-sdk/packages/healthcheck/core/api Represents a CPU usage snapshot. Use it to report CPU metrics in a runtime adapter. All fields are nullable. ```ts interface RuntimeCpuSnapshot { userMicros: number | null systemMicros: number | null availableParallelism: number | null } ```