@ucdjs/pipelines-core 0.0.1-beta.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-PRESENT Lucas Nørgård
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @ucdjs/pipelines-core
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+ [![codecov][codecov-src]][codecov-href]
6
+
7
+ > [!IMPORTANT]
8
+ > This is an internal package. It may change without warning and is not subject to semantic versioning. Use at your own risk.
9
+
10
+ A collection of core pipeline functionalities for the UCD project.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @ucdjs/pipelines-core
16
+ ```
17
+
18
+ ## 📄 License
19
+
20
+ Published under [MIT License](./LICENSE).
21
+
22
+ [npm-version-src]: https://img.shields.io/npm/v/@ucdjs/pipelines-core?style=flat&colorA=18181B&colorB=4169E1
23
+ [npm-version-href]: https://npmjs.com/package/@ucdjs/pipelines-core
24
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@ucdjs/pipelines-core?style=flat&colorA=18181B&colorB=4169E1
25
+ [npm-downloads-href]: https://npmjs.com/package/@ucdjs/pipelines-core
26
+ [codecov-src]: https://img.shields.io/codecov/c/gh/ucdjs/ucd?style=flat&colorA=18181B&colorB=4169E1
27
+ [codecov-href]: https://codecov.io/gh/ucdjs/ucd
@@ -0,0 +1,531 @@
1
+ import { a as ParsedRow, c as PropertyJson, d as ResolverFn, f as RouteOutput, i as ParseContext, l as ResolveContext, n as FileContext, o as ParserFn, p as RowContext, r as FilterContext, s as PipelineFilter, t as DefaultRange, u as ResolvedEntry } from "./types-t7nns1Hx.mjs";
2
+ import { a as PipelineTransformDefinition, c as definePipelineTransform, i as InferTransformOutput, n as ChainTransforms, o as TransformContext, r as InferTransformInput, s as applyTransforms, t as AnyPipelineTransformDefinition } from "./transform-BSrhinRr.mjs";
3
+ import { a as SourceBackend, c as definePipelineSource, i as PipelineSourceDefinition, l as resolveMultipleSourceFiles, n as InferSourceId, o as SourceFileContext, r as InferSourceIds, s as StreamOptions, t as FileMetadata, u as resolveSourceFiles } from "./source-DYH0SvDh.mjs";
4
+ import { z } from "zod";
5
+
6
+ //#region src/dependencies.d.ts
7
+ type RouteDependency = `route:${string}`;
8
+ type ArtifactDependency = `artifact:${string}:${string}`;
9
+ type PipelineDependency = RouteDependency | ArtifactDependency;
10
+ interface ParsedRouteDependency {
11
+ type: "route";
12
+ routeId: string;
13
+ }
14
+ interface ParsedArtifactDependency {
15
+ type: "artifact";
16
+ routeId: string;
17
+ artifactName: string;
18
+ }
19
+ type ParsedDependency = ParsedRouteDependency | ParsedArtifactDependency;
20
+ type ParseDependencyType<T extends string> = T extends `route:${infer RouteId}` ? {
21
+ type: "route";
22
+ routeId: RouteId;
23
+ } : T extends `artifact:${infer RouteId}:${infer ArtifactName}` ? {
24
+ type: "artifact";
25
+ routeId: RouteId;
26
+ artifactName: ArtifactName;
27
+ } : never;
28
+ type ExtractRouteDependencies<T extends readonly PipelineDependency[]> = { [K in keyof T]: T[K] extends `route:${infer RouteId}` ? RouteId : never }[number];
29
+ type ExtractArtifactDependencies<T extends readonly PipelineDependency[]> = { [K in keyof T]: T[K] extends `artifact:${infer RouteId}:${infer ArtifactName}` ? {
30
+ routeId: RouteId;
31
+ artifactName: ArtifactName;
32
+ } : never }[number];
33
+ type ExtractArtifactKeys<T extends readonly PipelineDependency[]> = { [K in keyof T]: T[K] extends `artifact:${infer RouteId}:${infer ArtifactName}` ? `${RouteId}:${ArtifactName}` : never }[number];
34
+ declare function parseDependency(dep: PipelineDependency): ParsedDependency;
35
+ declare function isRouteDependency(dep: PipelineDependency): dep is RouteDependency;
36
+ declare function isArtifactDependency(dep: PipelineDependency): dep is ArtifactDependency;
37
+ declare function createRouteDependency(routeId: string): RouteDependency;
38
+ declare function createArtifactDependency(routeId: string, artifactName: string): ArtifactDependency;
39
+ //#endregion
40
+ //#region src/route.d.ts
41
+ interface ArtifactDefinition<TSchema extends z.ZodType = z.ZodType> {
42
+ _type: "artifact" | "global-artifact";
43
+ schema: TSchema;
44
+ scope: "version" | "global";
45
+ }
46
+ type InferArtifactType<T extends ArtifactDefinition> = T extends ArtifactDefinition<infer TSchema> ? z.infer<TSchema> : never;
47
+ interface RouteResolveContext<TArtifactKeys extends string = string, TEmits extends Record<string, ArtifactDefinition> = Record<string, ArtifactDefinition>> {
48
+ version: string;
49
+ file: FileContext;
50
+ getArtifact: <K extends TArtifactKeys>(key: K) => unknown;
51
+ emitArtifact: <K extends keyof TEmits & string>(key: K, value: InferArtifactType<TEmits[K]>) => void;
52
+ normalizeEntries: (entries: ResolvedEntry[]) => ResolvedEntry[];
53
+ now: () => string;
54
+ }
55
+ type PipelineRouteResolver<TDepends extends readonly PipelineDependency[], TEmits extends Record<string, ArtifactDefinition>, TTransforms extends readonly AnyPipelineTransformDefinition[], TOutput> = (ctx: RouteResolveContext<ExtractArtifactKeys<TDepends>, TEmits>, rows: AsyncIterable<TTransforms extends readonly [] ? ParsedRow : ChainTransforms<ParsedRow, TTransforms>>) => Promise<TOutput>;
56
+ interface PipelineRouteDefinition<TId extends string = string, TDepends extends readonly PipelineDependency[] = readonly PipelineDependency[], TEmits extends Record<string, ArtifactDefinition> = Record<string, ArtifactDefinition>, TTransforms extends readonly AnyPipelineTransformDefinition[] = readonly [], TOutput = PropertyJson[]> {
57
+ id: TId;
58
+ filter: PipelineFilter;
59
+ depends?: TDepends;
60
+ emits?: TEmits;
61
+ parser: ParserFn;
62
+ transforms?: TTransforms;
63
+ resolver: PipelineRouteResolver<TDepends, TEmits, TTransforms, TOutput>;
64
+ out?: RouteOutput;
65
+ cache?: boolean;
66
+ }
67
+ type AnyPipelineRouteDefinition = PipelineRouteDefinition<any, any, any, any, any>;
68
+ declare function definePipelineRoute<const TId extends string, const TDepends extends readonly PipelineDependency[] = readonly [], const TEmits extends Record<string, ArtifactDefinition> = Record<string, never>, const TTransforms extends readonly AnyPipelineTransformDefinition[] = readonly [], TOutput = PropertyJson[]>(definition: PipelineRouteDefinition<TId, TDepends, TEmits, TTransforms, TOutput>): PipelineRouteDefinition<TId, TDepends, TEmits, TTransforms, TOutput>;
69
+ type InferRoute<T> = T extends PipelineRouteDefinition<infer TId, infer TDepends, infer TEmits, infer TTransforms extends readonly PipelineTransformDefinition<any, any>[], infer TOutput> ? {
70
+ id: TId;
71
+ depends: TDepends;
72
+ emits: TEmits;
73
+ transforms: TTransforms;
74
+ output: TOutput;
75
+ } : never;
76
+ type InferRoutesOutput<T extends readonly AnyPipelineRouteDefinition[]> = T[number] extends PipelineRouteDefinition<any, any, any, any, infer TOutput> ? TOutput extends unknown[] ? TOutput[number] : TOutput : never;
77
+ type InferEmittedArtifactsFromRoute<T> = T extends PipelineRouteDefinition<any, any, infer TEmits, any, any> ? { [K in keyof TEmits]: TEmits[K] extends ArtifactDefinition<infer TSchema> ? z.infer<TSchema> : never } : never;
78
+ //#endregion
79
+ //#region src/dag.d.ts
80
+ interface DAGNode {
81
+ id: string;
82
+ dependencies: Set<string>;
83
+ dependents: Set<string>;
84
+ emittedArtifacts: Set<string>;
85
+ }
86
+ interface DAG {
87
+ nodes: Map<string, DAGNode>;
88
+ executionOrder: string[];
89
+ }
90
+ interface DAGValidationError {
91
+ type: "cycle" | "missing-route" | "missing-artifact" | "duplicate-route";
92
+ message: string;
93
+ details: {
94
+ routeId?: string;
95
+ dependencyId?: string;
96
+ cycle?: string[];
97
+ };
98
+ }
99
+ interface DAGValidationResult {
100
+ valid: boolean;
101
+ errors: DAGValidationError[];
102
+ dag?: DAG;
103
+ }
104
+ declare function buildDAG(routes: readonly PipelineRouteDefinition<any, any, any, any, any>[]): DAGValidationResult;
105
+ declare function getExecutionLayers(dag: DAG): string[][];
106
+ //#endregion
107
+ //#region src/events.d.ts
108
+ type PipelineEventType = "pipeline:start" | "pipeline:end" | "version:start" | "version:end" | "artifact:start" | "artifact:end" | "artifact:produced" | "artifact:consumed" | "file:matched" | "file:skipped" | "file:fallback" | "parse:start" | "parse:end" | "resolve:start" | "resolve:end" | "cache:hit" | "cache:miss" | "cache:store" | "error";
109
+ interface PipelineStartEvent {
110
+ id: string;
111
+ type: "pipeline:start";
112
+ versions: string[];
113
+ spanId: string;
114
+ timestamp: number;
115
+ }
116
+ interface PipelineEndEvent {
117
+ id: string;
118
+ type: "pipeline:end";
119
+ durationMs: number;
120
+ spanId: string;
121
+ timestamp: number;
122
+ }
123
+ interface VersionStartEvent {
124
+ id: string;
125
+ type: "version:start";
126
+ version: string;
127
+ spanId: string;
128
+ timestamp: number;
129
+ }
130
+ interface VersionEndEvent {
131
+ id: string;
132
+ type: "version:end";
133
+ version: string;
134
+ durationMs: number;
135
+ spanId: string;
136
+ timestamp: number;
137
+ }
138
+ interface ArtifactStartEvent {
139
+ id: string;
140
+ type: "artifact:start";
141
+ artifactId: string;
142
+ version: string;
143
+ spanId: string;
144
+ timestamp: number;
145
+ }
146
+ interface ArtifactEndEvent {
147
+ id: string;
148
+ type: "artifact:end";
149
+ artifactId: string;
150
+ version: string;
151
+ durationMs: number;
152
+ spanId: string;
153
+ timestamp: number;
154
+ }
155
+ interface ArtifactProducedEvent {
156
+ id: string;
157
+ type: "artifact:produced";
158
+ artifactId: string;
159
+ routeId: string;
160
+ version: string;
161
+ spanId: string;
162
+ timestamp: number;
163
+ }
164
+ interface ArtifactConsumedEvent {
165
+ id: string;
166
+ type: "artifact:consumed";
167
+ artifactId: string;
168
+ routeId: string;
169
+ version: string;
170
+ spanId: string;
171
+ timestamp: number;
172
+ }
173
+ interface FileMatchedEvent {
174
+ id: string;
175
+ type: "file:matched";
176
+ file: FileContext;
177
+ routeId: string;
178
+ spanId: string;
179
+ timestamp: number;
180
+ }
181
+ interface FileSkippedEvent {
182
+ id: string;
183
+ type: "file:skipped";
184
+ file: FileContext;
185
+ reason: "no-match" | "filtered";
186
+ spanId: string;
187
+ timestamp: number;
188
+ }
189
+ interface FileFallbackEvent {
190
+ id: string;
191
+ type: "file:fallback";
192
+ file: FileContext;
193
+ spanId: string;
194
+ timestamp: number;
195
+ }
196
+ interface ParseStartEvent {
197
+ id: string;
198
+ type: "parse:start";
199
+ file: FileContext;
200
+ routeId: string;
201
+ spanId: string;
202
+ timestamp: number;
203
+ }
204
+ interface ParseEndEvent {
205
+ id: string;
206
+ type: "parse:end";
207
+ file: FileContext;
208
+ routeId: string;
209
+ rowCount: number;
210
+ durationMs: number;
211
+ spanId: string;
212
+ timestamp: number;
213
+ }
214
+ interface ResolveStartEvent {
215
+ id: string;
216
+ type: "resolve:start";
217
+ file: FileContext;
218
+ routeId: string;
219
+ spanId: string;
220
+ timestamp: number;
221
+ }
222
+ interface ResolveEndEvent {
223
+ id: string;
224
+ type: "resolve:end";
225
+ file: FileContext;
226
+ routeId: string;
227
+ outputCount: number;
228
+ durationMs: number;
229
+ spanId: string;
230
+ timestamp: number;
231
+ }
232
+ interface CacheHitEvent {
233
+ id: string;
234
+ type: "cache:hit";
235
+ routeId: string;
236
+ file: FileContext;
237
+ version: string;
238
+ spanId: string;
239
+ timestamp: number;
240
+ }
241
+ interface CacheMissEvent {
242
+ id: string;
243
+ type: "cache:miss";
244
+ routeId: string;
245
+ file: FileContext;
246
+ version: string;
247
+ spanId: string;
248
+ timestamp: number;
249
+ }
250
+ interface CacheStoreEvent {
251
+ id: string;
252
+ type: "cache:store";
253
+ routeId: string;
254
+ file: FileContext;
255
+ version: string;
256
+ spanId: string;
257
+ timestamp: number;
258
+ }
259
+ interface PipelineErrorEvent {
260
+ id: string;
261
+ type: "error";
262
+ error: PipelineError;
263
+ spanId: string;
264
+ timestamp: number;
265
+ }
266
+ type PipelineEvent = PipelineStartEvent | PipelineEndEvent | VersionStartEvent | VersionEndEvent | ArtifactStartEvent | ArtifactEndEvent | ArtifactProducedEvent | ArtifactConsumedEvent | FileMatchedEvent | FileSkippedEvent | FileFallbackEvent | ParseStartEvent | ParseEndEvent | ResolveStartEvent | ResolveEndEvent | CacheHitEvent | CacheMissEvent | CacheStoreEvent | PipelineErrorEvent;
267
+ type PipelineErrorScope = "pipeline" | "version" | "file" | "route" | "artifact";
268
+ interface PipelineError {
269
+ scope: PipelineErrorScope;
270
+ message: string;
271
+ error?: unknown;
272
+ file?: FileContext;
273
+ routeId?: string;
274
+ artifactId?: string;
275
+ version?: string;
276
+ }
277
+ type PipelineGraphNodeType = "source" | "file" | "route" | "artifact" | "output";
278
+ type PipelineGraphNode = {
279
+ id: string;
280
+ type: "source";
281
+ version: string;
282
+ } | {
283
+ id: string;
284
+ type: "file";
285
+ file: FileContext;
286
+ } | {
287
+ id: string;
288
+ type: "route";
289
+ routeId: string;
290
+ } | {
291
+ id: string;
292
+ type: "artifact";
293
+ artifactId: string;
294
+ } | {
295
+ id: string;
296
+ type: "output";
297
+ outputIndex: number;
298
+ property?: string;
299
+ };
300
+ type PipelineGraphEdgeType = "provides" | "matched" | "parsed" | "resolved" | "uses-artifact";
301
+ interface PipelineGraphEdge {
302
+ from: string;
303
+ to: string;
304
+ type: PipelineGraphEdgeType;
305
+ }
306
+ interface PipelineGraph {
307
+ nodes: PipelineGraphNode[];
308
+ edges: PipelineGraphEdge[];
309
+ }
310
+ type PipelineEventInput = Omit<PipelineStartEvent, "id" | "spanId"> & {
311
+ id?: string;
312
+ spanId?: string;
313
+ } | Omit<PipelineEndEvent, "id" | "spanId"> & {
314
+ id?: string;
315
+ spanId?: string;
316
+ } | Omit<VersionStartEvent, "id" | "spanId"> & {
317
+ id?: string;
318
+ spanId?: string;
319
+ } | Omit<VersionEndEvent, "id" | "spanId"> & {
320
+ id?: string;
321
+ spanId?: string;
322
+ } | Omit<ArtifactStartEvent, "id" | "spanId"> & {
323
+ id?: string;
324
+ spanId?: string;
325
+ } | Omit<ArtifactEndEvent, "id" | "spanId"> & {
326
+ id?: string;
327
+ spanId?: string;
328
+ } | Omit<ArtifactProducedEvent, "id" | "spanId"> & {
329
+ id?: string;
330
+ spanId?: string;
331
+ } | Omit<ArtifactConsumedEvent, "id" | "spanId"> & {
332
+ id?: string;
333
+ spanId?: string;
334
+ } | Omit<FileMatchedEvent, "id" | "spanId"> & {
335
+ id?: string;
336
+ spanId?: string;
337
+ } | Omit<FileSkippedEvent, "id" | "spanId"> & {
338
+ id?: string;
339
+ spanId?: string;
340
+ } | Omit<FileFallbackEvent, "id" | "spanId"> & {
341
+ id?: string;
342
+ spanId?: string;
343
+ } | Omit<ParseStartEvent, "id" | "spanId"> & {
344
+ id?: string;
345
+ spanId?: string;
346
+ } | Omit<ParseEndEvent, "id" | "spanId"> & {
347
+ id?: string;
348
+ spanId?: string;
349
+ } | Omit<ResolveStartEvent, "id" | "spanId"> & {
350
+ id?: string;
351
+ spanId?: string;
352
+ } | Omit<ResolveEndEvent, "id" | "spanId"> & {
353
+ id?: string;
354
+ spanId?: string;
355
+ } | Omit<CacheHitEvent, "id" | "spanId"> & {
356
+ id?: string;
357
+ spanId?: string;
358
+ } | Omit<CacheMissEvent, "id" | "spanId"> & {
359
+ id?: string;
360
+ spanId?: string;
361
+ } | Omit<CacheStoreEvent, "id" | "spanId"> & {
362
+ id?: string;
363
+ spanId?: string;
364
+ } | Omit<PipelineErrorEvent, "id" | "spanId"> & {
365
+ id?: string;
366
+ spanId?: string;
367
+ };
368
+ //#endregion
369
+ //#region src/filters.d.ts
370
+ declare function byName(name: string): PipelineFilter;
371
+ declare function byDir(dir: FileContext["dir"]): PipelineFilter;
372
+ declare function byExt(ext: string): PipelineFilter;
373
+ declare function byGlob(pattern: string): PipelineFilter;
374
+ declare function byPath(pathPattern: string | RegExp): PipelineFilter;
375
+ declare function byProp(pattern: string | RegExp): PipelineFilter;
376
+ declare function bySource(sourceIds: string | string[]): PipelineFilter;
377
+ declare function and(...filters: PipelineFilter[]): PipelineFilter;
378
+ declare function or(...filters: PipelineFilter[]): PipelineFilter;
379
+ declare function not(filter: PipelineFilter): PipelineFilter;
380
+ declare function always(): PipelineFilter;
381
+ declare function never(): PipelineFilter;
382
+ //#endregion
383
+ //#region src/pipeline.d.ts
384
+ interface FallbackRouteDefinition<TArtifacts extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> {
385
+ /**
386
+ * Optional filter to restrict which unmatched files the fallback handles.
387
+ */
388
+ filter?: PipelineFilter;
389
+ /**
390
+ * Parser function that yields parsed rows from file content.
391
+ */
392
+ parser: (ctx: ParseContext) => AsyncIterable<ParsedRow>;
393
+ /**
394
+ * Resolver function that transforms parsed rows into output.
395
+ */
396
+ resolver: (ctx: ResolveContext<TArtifacts>, rows: AsyncIterable<ParsedRow>) => Promise<TOutput>;
397
+ }
398
+ interface PipelineDefinitionSpec<TSources extends readonly PipelineSourceDefinition[] = readonly PipelineSourceDefinition[], TRoutes extends readonly AnyPipelineRouteDefinition[] = readonly AnyPipelineRouteDefinition[], TFallback extends FallbackRouteDefinition<any, unknown> | undefined = undefined> {
399
+ /**
400
+ * Unique identifier for the pipeline.
401
+ */
402
+ id: string;
403
+ /**
404
+ * Human-readable name for the pipeline.
405
+ */
406
+ name: string;
407
+ /**
408
+ * Description of what this pipeline does.
409
+ */
410
+ description?: string;
411
+ /**
412
+ * Tags associated with this pipeline.
413
+ */
414
+ tags?: string[];
415
+ /**
416
+ * Unicode versions this pipeline processes.
417
+ */
418
+ versions: string[];
419
+ /**
420
+ * Input sources that provide files to the pipeline.
421
+ */
422
+ inputs: TSources;
423
+ /**
424
+ * Routes that process matched files.
425
+ */
426
+ routes: TRoutes;
427
+ /**
428
+ * Global filter to include/exclude files before routing.
429
+ */
430
+ include?: PipelineFilter;
431
+ /**
432
+ * If true, throw error for files with no matching route (and no fallback).
433
+ * @default false
434
+ */
435
+ strict?: boolean;
436
+ /**
437
+ * Maximum concurrent route executions.
438
+ * @default 4
439
+ */
440
+ concurrency?: number;
441
+ /**
442
+ * Fallback handler for files that don't match any route.
443
+ */
444
+ fallback?: TFallback;
445
+ /**
446
+ * Event handler for pipeline events.
447
+ * Note: This is stored but not invoked by the definition itself.
448
+ * The executor is responsible for calling this.
449
+ */
450
+ onEvent?: (event: PipelineEvent) => void | Promise<void>;
451
+ }
452
+ type PipelineDefinitionOptions<TSources extends readonly PipelineSourceDefinition[] = readonly PipelineSourceDefinition[], TRoutes extends readonly PipelineRouteDefinition<any, any, any, any, any>[] = readonly PipelineRouteDefinition<any, any, any, any, any>[], TFallback extends FallbackRouteDefinition<any, unknown> | undefined = undefined> = PipelineDefinitionSpec<TSources, TRoutes, TFallback>;
453
+ type PipelineDefinition<TId extends string = string, TSources extends readonly PipelineSourceDefinition[] = readonly PipelineSourceDefinition[], TRoutes extends readonly PipelineRouteDefinition<any, any, any, any, any>[] = readonly PipelineRouteDefinition<any, any, any, any, any>[], TFallback extends FallbackRouteDefinition<any, unknown> | undefined = undefined> = Readonly<PipelineDefinitionSpec<TSources, TRoutes, TFallback>> & {
454
+ /**
455
+ * Marker to identify this as a pipeline definition.
456
+ */
457
+ readonly _type: "pipeline-definition";
458
+ /**
459
+ * Unique identifier for the pipeline.
460
+ */
461
+ readonly id: TId;
462
+ /**
463
+ * If true, throw error for files with no matching route (and no fallback).
464
+ */
465
+ readonly strict: boolean;
466
+ /**
467
+ * Maximum concurrent route executions.
468
+ */
469
+ readonly concurrency: number;
470
+ /**
471
+ * Precomputed DAG (Directed Acyclic Graph) for route execution order.
472
+ * Built at definition time from route dependencies.
473
+ */
474
+ readonly dag: DAG;
475
+ /**
476
+ * Tags associated with this pipeline.
477
+ */
478
+ readonly tags: string[];
479
+ };
480
+ type AnyPipelineDefinition = PipelineDefinition<any, any, any, any>;
481
+ type InferPipelineOutput<TRoutes extends readonly PipelineRouteDefinition<any, any, any, any, any>[], TFallback extends FallbackRouteDefinition<any, unknown> | undefined> = TFallback extends FallbackRouteDefinition<any, infer TFallbackOutput> ? InferRoutesOutput<TRoutes> | TFallbackOutput : InferRoutesOutput<TRoutes>;
482
+ type InferPipelineSourceIds<T> = T extends PipelineDefinition<any, infer TSources, any, any> ? InferSourceIds<TSources> : never;
483
+ type InferPipelineRouteIds<T> = T extends PipelineDefinition<any, any, infer TRoutes, any> ? TRoutes[number] extends PipelineRouteDefinition<infer TId, any, any, any, any> ? TId : never : never;
484
+ /**
485
+ * Define a pipeline configuration.
486
+ *
487
+ * This returns a pure data structure describing the pipeline.
488
+ * To execute the pipeline, pass it to a pipeline executor.
489
+ *
490
+ * @example
491
+ * ```ts
492
+ * const pipeline = definePipeline({
493
+ * id: "my-pipeline",
494
+ * name: "My Pipeline",
495
+ * versions: ["16.0.0"],
496
+ * inputs: [mySource],
497
+ * routes: [myRoute],
498
+ * });
499
+ *
500
+ * // Execute with an executor
501
+ * const executor = createPipelineExecutor({ pipelines: [pipeline] });
502
+ * const result = await executor.run();
503
+ * ```
504
+ */
505
+ declare function definePipeline<const TId extends string, const TSources extends readonly PipelineSourceDefinition[], const TRoutes extends readonly PipelineRouteDefinition<any, any, any, any, any>[], const TFallback extends FallbackRouteDefinition<any, unknown> | undefined = undefined>(options: Omit<PipelineDefinitionSpec<readonly [...TSources], readonly [...TRoutes], TFallback>, "inputs" | "routes"> & {
506
+ id: TId;
507
+ inputs: readonly [...TSources];
508
+ routes: readonly [...TRoutes];
509
+ }): PipelineDefinition<TId, TSources, TRoutes, TFallback>;
510
+ declare function isPipelineDefinition(value: unknown): value is PipelineDefinition;
511
+ declare function getPipelineRouteIds<T extends PipelineDefinition>(pipeline: T): string[];
512
+ declare function getPipelineSourceIds<T extends PipelineDefinition>(pipeline: T): string[];
513
+ //#endregion
514
+ //#region src/utils/arrays.d.ts
515
+ /**
516
+ * Split a line into exactly 2 fields.
517
+ * Returns a tuple [first, second] or null if not enough fields.
518
+ *
519
+ * After null check, TypeScript knows both elements exist and are strings.
520
+ */
521
+ declare function splitTwoFields(line: string, delimiter: string): [string, string] | null;
522
+ /**
523
+ * Split a line with minimum field count check.
524
+ * Returns the array or null if not enough fields.
525
+ *
526
+ * Use when you need more than 2 fields (e.g., UnicodeData with 14 fields).
527
+ * Access fields with nullish coalescing: `fields[0] ?? ""`
528
+ */
529
+ declare function splitMinFields(line: string, delimiter: string, minFields: number): string[] | null;
530
+ //#endregion
531
+ export { type AnyPipelineDefinition, type AnyPipelineRouteDefinition, type ArtifactConsumedEvent, type ArtifactDefinition, type ArtifactEndEvent, type ArtifactProducedEvent, type ArtifactStartEvent, type CacheHitEvent, type CacheMissEvent, type CacheStoreEvent, type ChainTransforms, type DAG, type DAGNode, type DAGValidationError, type DAGValidationResult, type DefaultRange, type ExtractArtifactDependencies, type ExtractArtifactKeys, type ExtractRouteDependencies, type FallbackRouteDefinition, type FileContext, type FileFallbackEvent, type FileMatchedEvent, type FileMetadata, type FileSkippedEvent, type FilterContext, type InferArtifactType, type InferEmittedArtifactsFromRoute, type InferPipelineOutput, type InferPipelineRouteIds, type InferPipelineSourceIds, type InferRoute, type InferRoutesOutput, type InferSourceId, type InferSourceIds, type InferTransformInput, type InferTransformOutput, type ParseContext, type ParseDependencyType, type ParseEndEvent, type ParseStartEvent, type ParsedArtifactDependency, type ParsedDependency, type ParsedRouteDependency, type ParsedRow, type ParserFn, type PipelineDefinition, type PipelineDefinitionOptions, type PipelineDefinitionSpec, type PipelineDependency, type PipelineEndEvent, type PipelineError, type PipelineErrorEvent, type PipelineErrorScope, type PipelineEvent, type PipelineEventInput, type PipelineEventType, type PipelineFilter, type PipelineGraph, type PipelineGraphEdge, type PipelineGraphEdgeType, type PipelineGraphNode, type PipelineGraphNodeType, type PipelineRouteDefinition, type PipelineSourceDefinition, type PipelineStartEvent, type PipelineTransformDefinition, type PropertyJson, type ResolveContext, type ResolveEndEvent, type ResolveStartEvent, type ResolvedEntry, type ResolverFn, type RouteOutput, type RouteResolveContext, type RowContext, type SourceBackend, type SourceFileContext, type StreamOptions, type TransformContext, type VersionEndEvent, type VersionStartEvent, always, and, applyTransforms, buildDAG, byDir, byExt, byGlob, byName, byPath, byProp, bySource, createArtifactDependency, createRouteDependency, definePipeline, definePipelineRoute, definePipelineSource, definePipelineTransform, getExecutionLayers, getPipelineRouteIds, getPipelineSourceIds, isArtifactDependency, isPipelineDefinition, isRouteDependency, never, not, or, parseDependency, resolveMultipleSourceFiles, resolveSourceFiles, splitMinFields, splitTwoFields };