UNPKG

1.64 kBTypeScriptView Raw
1import { Tree } from '@angular-devkit/schematics';
2import { Observable } from 'rxjs';
3export interface TransformWithPath<T> {
4 (aSource: T | undefined, aPath: string): Observable<T | undefined>;
5}
6export interface TransformWithoutPath<T> {
7 (aSource: T | undefined): Observable<T | undefined>;
8}
9export declare type TransformCallback<T> = TransformWithPath<T> | TransformWithoutPath<T>;
10/**
11 * Reads a text file from the tree and then transforms it using the given function. If the result
12 * is null or undefined, the file will be deleted, else replaced or created.
13 *
14 * @param aName name of the file
15 * @param aOp the operator
16 * @param aTree the tree to work in
17 */
18export declare function rxTransformTextFile(aName: string, aOp: TransformCallback<string>, aTree: Tree): Observable<string>;
19/**
20 * Reads a JSON file from the tree and then transforms it using the given function. If the result
21 * is null or undefined, the file will be deleted, else replaced or created.
22 *
23 * @param aName name of the file
24 * @param aOp the operator
25 * @param aTree the tree to work in
26 */
27export declare function rxTransformJsonFile(aName: string, aOp: TransformCallback<any>, aTree: Tree): Observable<string>;
28/**
29 * Reads a line based file from the tree and then transforms it using the given function. If the result
30 * is null or undefined, the file will be deleted, else replaced or created.
31 *
32 * @param aName name of the file
33 * @param aOp the operator
34 * @param aTree the tree to work in
35 */
36export declare function rxTransformLinesFile(aName: string, aOp: TransformCallback<string[]>, aTree: Tree): Observable<string>;