mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
fix fmt
This commit is contained in:
parent
bbd57c917e
commit
36cbc22327
@ -658,7 +658,7 @@ export default class AnalyticsDatabaseService<
|
|||||||
return await this.onBeforeCreate(createBy);
|
return await this.onBeforeCreate(createBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async create(createBy: CreateBy<TBaseModel>): Promise<void> {
|
public async create(createBy: CreateBy<TBaseModel>): Promise<TBaseModel> {
|
||||||
const onCreate: OnCreate<TBaseModel> = createBy.props.ignoreHooks
|
const onCreate: OnCreate<TBaseModel> = createBy.props.ignoreHooks
|
||||||
? { createBy, carryForward: [] }
|
? { createBy, carryForward: [] }
|
||||||
: await this._onBeforeCreate(createBy);
|
: await this._onBeforeCreate(createBy);
|
||||||
@ -728,6 +728,9 @@ export default class AnalyticsDatabaseService<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return createBy.data;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await this.onCreateError(error as Exception);
|
await this.onCreateError(error as Exception);
|
||||||
throw this.getException(error as Exception);
|
throw this.getException(error as Exception);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { JSONObject } from 'Common/Types/JSON';
|
|
||||||
import { Stream } from 'stream';
|
import { Stream } from 'stream';
|
||||||
|
|
||||||
export default class StreamUtil {
|
export default class StreamUtil {
|
||||||
@ -20,29 +19,10 @@ export default class StreamUtil {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async toJSONArray(
|
|
||||||
stream: Stream
|
|
||||||
): Promise<Array<JSONObject>> {
|
|
||||||
const text = await this.convertStreamToText(stream);
|
|
||||||
return JSON.parse(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async toStringArray(
|
public static async toStringArray(
|
||||||
stream: Stream
|
stream: Stream
|
||||||
): Promise<Array<string>> {
|
): Promise<Array<string>> {
|
||||||
return new Promise<Array<string>>(
|
const text: string = await StreamUtil.convertStreamToText(stream);
|
||||||
(resolve: Function, reject: Function) => {
|
return text.split('\n');
|
||||||
const data: Array<string> = [];
|
|
||||||
stream.on('data', (chunk: any) => {
|
|
||||||
data.push(chunk);
|
|
||||||
});
|
|
||||||
stream.on('end', () => {
|
|
||||||
resolve(data);
|
|
||||||
});
|
|
||||||
stream.on('error', (err: Error) => {
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user