@boboddy/sdk 0.2.15-alpha → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +87 -74
- package/dist/definitions/advancement-policies/cohort-advancement-policy.d.ts +117 -0
- package/dist/definitions/advancement-policies/cohort-fluent-rules.d.ts +126 -0
- package/dist/definitions/advancement-policies/index.d.ts +2 -0
- package/dist/definitions/advancement-policies/index.js +242 -0
- package/dist/definitions/pipelines/builder-helpers.d.ts +39 -8
- package/dist/definitions/pipelines/builder.d.ts +50 -44
- package/dist/definitions/pipelines/chain-graph.d.ts +19 -0
- package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +3 -3
- package/dist/definitions/pipelines/define-pipeline.d.ts +106 -13
- package/dist/definitions/pipelines/fan-out-builder.d.ts +66 -0
- package/dist/definitions/pipelines/index.js +561 -176
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +6 -6
- package/dist/definitions/steps/define-step.d.ts +7 -3
- package/dist/definitions/steps/index.js +87 -74
- package/dist/definitions/validation/index.js +91 -22
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/sdk.gen.d.ts +35 -33
- package/dist/generated/types.gen.d.ts +2323 -1900
- package/dist/index.js +561 -176
- package/dist/push/index.js +598 -204
- package/dist/step-execution-plane-client.d.ts +6 -6
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
|
+
import { type AdvanceAllCtx, type AdvanceAllResult, type AdvanceEachCtx, type AdvanceEachResult } from "../advancement-policies/cohort-fluent-rules";
|
|
3
|
+
import { type AnyTypedStep, type FanOutInputCtx, type IsAny, type LastSignalKeys, type PipelineMeta, type RequiredInputKeys } from "./builder-helpers";
|
|
4
|
+
import type { AnyBinding, PipelineNodeConfig } from "./define-pipeline";
|
|
5
|
+
import { PipelineStepBuilder } from "./builder";
|
|
6
|
+
/**
|
|
7
|
+
* `.fanOutStep()` (issue #167) split out of `builder.ts` (which would
|
|
8
|
+
* otherwise exceed this repo's `max-lines` limit) — genuinely mutually
|
|
9
|
+
* referential with `PipelineStepBuilder` (`beginFanOut` both is called from
|
|
10
|
+
* `PipelineStepBuilder.fanOutStep()` and returns a new one), so the import
|
|
11
|
+
* cycle is structural, not accidental.
|
|
12
|
+
*/
|
|
13
|
+
export type FanOutInputMapping<S extends AnyTypedStep> = Partial<Record<string, AnyBinding>> & (IsAny<S["__inputType"]> extends true ? unknown : S["__inputType"] extends object ? {
|
|
14
|
+
[K in RequiredInputKeys<S["__inputType"]>]: AnyBinding;
|
|
15
|
+
} : unknown);
|
|
16
|
+
/**
|
|
17
|
+
* `.fanOutStep(step, config)`'s sole config argument — `step` itself is a
|
|
18
|
+
* separate positional argument (mirroring `.step(step, options)`), not a
|
|
19
|
+
* field on this object. `K` is inferred from the literal value of
|
|
20
|
+
* `config.over` in the same pass TypeScript type-checks `config.input`,
|
|
21
|
+
* the same mechanism `builder.ts`'s `StepOptions` already relies on for
|
|
22
|
+
* `.step()` — see that type's doc comment for why overloads are avoided
|
|
23
|
+
* here too.
|
|
24
|
+
*/
|
|
25
|
+
export type FanOutStepConfig<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>, TFanOuts extends ReadonlyArray<AnyTypedStep>, S extends AnyTypedStep, K extends LastSignalKeys<TSteps> = LastSignalKeys<TSteps>> = {
|
|
26
|
+
/**
|
|
27
|
+
* The signal to resolve each branch from — constrained to the most
|
|
28
|
+
* recent ordinary step's declared signal keys (`TSteps`'s last element).
|
|
29
|
+
* Note this is the last *step*, not necessarily the fan-out's immediate
|
|
30
|
+
* graph predecessor: chaining a second `.fanOutStep()` right after
|
|
31
|
+
* `.advanceAll()` (with no intervening `.step()`) still only offers this
|
|
32
|
+
* same step's signals, since a `cohortGate` node produces no signals of
|
|
33
|
+
* its own to resolve from.
|
|
34
|
+
*
|
|
35
|
+
* A number-typed signal resolves a fixed branch count with no `item` on
|
|
36
|
+
* the input ctx (count-only mode); an array-typed signal resolves branch
|
|
37
|
+
* count from the array's length and adds a typed `item` to the input
|
|
38
|
+
* ctx for each branch.
|
|
39
|
+
*/
|
|
40
|
+
over: K;
|
|
41
|
+
input?: (ctx: FanOutInputCtx<TInput, TSteps, TFanOuts, K>) => FanOutInputMapping<S>;
|
|
42
|
+
/**
|
|
43
|
+
* Every branch's own continue/block decision (even the default "always
|
|
44
|
+
* continue" must be declared explicitly) — evaluated once per branch
|
|
45
|
+
* against that branch's own signals.
|
|
46
|
+
*/
|
|
47
|
+
advance: (ctx: AdvanceEachCtx<S["__signalKeys"], S["__signalTypeMap"]>) => AdvanceEachResult;
|
|
48
|
+
/**
|
|
49
|
+
* The whole-cohort decision, evaluated once the fan-out's branches have
|
|
50
|
+
* settled — a pure gate, not a step: nothing besides the fan-out+gate
|
|
51
|
+
* pair itself is appended to the pipeline's node sequence.
|
|
52
|
+
*/
|
|
53
|
+
advanceAll: (ctx: AdvanceAllCtx) => AdvanceAllResult;
|
|
54
|
+
timeout?: number | null;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Builds and pushes the `fanOut`+`cohortGate` node pair, resolves both the
|
|
58
|
+
* per-branch (`advance`) and whole-cohort (`advanceAll`) policies from
|
|
59
|
+
* `config`, and returns straight into a `PipelineStepBuilder` — mirroring
|
|
60
|
+
* how `pushStep` in `builder.ts` resolves a step's `advance` policy inline
|
|
61
|
+
* rather than through a chained `.advance()` call on an intermediate
|
|
62
|
+
* builder. Called from `PipelineStepBuilder.fanOutStep()` — factored out
|
|
63
|
+
* here (rather than inlined there) purely to keep the node-construction
|
|
64
|
+
* logic next to the types it feeds.
|
|
65
|
+
*/
|
|
66
|
+
export declare function beginFanOut<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>, TFanOuts extends ReadonlyArray<AnyTypedStep>, S extends AnyTypedStep, K extends LastSignalKeys<TSteps> = LastSignalKeys<TSteps>>(inputSchema: TInput, meta: Omit<PipelineMeta<TInput>, "additionalPipelineInput" | "additionalStepInput">, nodes: PipelineNodeConfig[], pipelineInputBindings: Record<string, AnyBinding>, pipelineStepInputBindings: Record<string, AnyBinding>, step: S, config: FanOutStepConfig<TInput, TSteps, TFanOuts, S, K>): PipelineStepBuilder<TInput, TSteps, [...TFanOuts, S]>;
|