Skip to main content
Home
This release is 2 versions behind 0.0.22 — the latest version of @alator21/jobless-machine. Jump to latest

Test framework

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 days ago (0.0.20)
class AllCopy
extends Copy<Con>

A copy strategy that copies all step outputs to the context with a prefix. This is the most common copy strategy, automatically adding a namespace to outputs.

Examples

Example 1

// Step exports: {id: "123", name: "Fluffy", age: 3}
// With AllCopy.create("pet."), context gets:
// - "pet.id": "123"
// - "pet.name": "Fluffy"
// - "pet.age": 3

const copy = AllCopy.create("pet.");

// Exclude HTTP internal fields
const copy = AllCopy.createExceptHttp("get.");

Constructors

new
AllCopy(
prefix: Prefix,
except?: string[],
)

Type Parameters

Con extends Record<string, unknown>
Prefix extends string = string

Properties

private
readonly
_prefix: Prefix

Methods

Get the prefix for this copy strategy. This is used for type-level validation in steps.

populateContext(
context: Context<Con>,
dataMap: Map<string, ValueWrapper<Con[keyof Con]>>,
): void

Static Methods

create<
Con2 extends Record<string, unknown>,
P extends string = string,
>
(prefix: P): AllCopy<Con2, P>

Create an AllCopy that prefixes all step outputs.

createExceptHttp<
Con2 extends Record<string, unknown>,
P extends string = string,
>
(prefix: string): AllCopy<Con2>

Create an AllCopy that excludes HTTP internal fields (_httpResponse, _httpError). Useful when you want to copy HTTP response data but not the internal response objects.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@alator21/jobless-machine

Import symbol

import { AllCopy } from "@alator21/jobless-machine";
or

Import directly with a jsr specifier

import { AllCopy } from "jsr:@alator21/jobless-machine";

Add Package

pnpm i jsr:@alator21/jobless-machine
or (using pnpm 10.8 or older)
pnpm dlx jsr add @alator21/jobless-machine

Import symbol

import { AllCopy } from "@alator21/jobless-machine";

Add Package

yarn add jsr:@alator21/jobless-machine
or (using Yarn 4.8 or older)
yarn dlx jsr add @alator21/jobless-machine

Import symbol

import { AllCopy } from "@alator21/jobless-machine";

Add Package

vlt install jsr:@alator21/jobless-machine

Import symbol

import { AllCopy } from "@alator21/jobless-machine";

Add Package

npx jsr add @alator21/jobless-machine

Import symbol

import { AllCopy } from "@alator21/jobless-machine";

Add Package

bunx jsr add @alator21/jobless-machine

Import symbol

import { AllCopy } from "@alator21/jobless-machine";