UNPKG

1.58 kBSource Map (JSON)View Raw
1{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/lib/graph/transform.ts"],"names":[],"mappings":";;;AAAA,+BAAkE;AAClE,8CAA2C;AAqBpC,MAAM,oBAAoB,GAAG,CAAC,WAAkC,EAAa,EAAE,CACpF,WAAI,CACF,qBAAS,CAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACtB,MAAM,eAAe,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC;IAEjD,OAAO,eAAe,IAAI,KAAK,CAAC;AAClC,CAAC,CAAC,CACH,CAAC;AAPS,QAAA,oBAAoB,wBAO7B","sourcesContent":["import { MonoTypeOperatorFunction, Observable, pipe } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\nimport { BuildGraph } from './build-graph';\n\n/**\n * A transformation applied over the build graph.\n *\n * By design, a pipeable operator over `BuildGraph`.\n * - A transformation takes a `BuildGraph` as input (from previous transformations).\n * - A transformation performs some operations based on the graph's data, potentially modifying nodes in the graph.\n * - It returns a `BuildGraph` that will be passed to subsequent transformations.\n *\n * @link https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators\n */\nexport interface Transform extends MonoTypeOperatorFunction<BuildGraph> {\n (source$: Observable<BuildGraph>): Observable<BuildGraph>;\n}\n\nexport interface PromiseBasedTransform {\n (graph: BuildGraph): Promise<BuildGraph | void> | BuildGraph | void;\n}\n\nexport const transformFromPromise = (transformFn: PromiseBasedTransform): Transform =>\n pipe(\n switchMap(async graph => {\n const transformResult = await transformFn(graph);\n\n return transformResult || graph;\n }),\n );\n"]}
\No newline at end of file