mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 07:10:53 +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);
|
||||
}
|
||||
|
||||
public async create(createBy: CreateBy<TBaseModel>): Promise<void> {
|
||||
public async create(createBy: CreateBy<TBaseModel>): Promise<TBaseModel> {
|
||||
const onCreate: OnCreate<TBaseModel> = createBy.props.ignoreHooks
|
||||
? { createBy, carryForward: [] }
|
||||
: await this._onBeforeCreate(createBy);
|
||||
@ -728,6 +728,9 @@ export default class AnalyticsDatabaseService<
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return createBy.data;
|
||||
|
||||
} catch (error) {
|
||||
await this.onCreateError(error as Exception);
|
||||
throw this.getException(error as Exception);
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import { Stream } from 'stream';
|
||||
|
||||
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(
|
||||
stream: Stream
|
||||
): Promise<Array<string>> {
|
||||
return new Promise<Array<string>>(
|
||||
(resolve: Function, reject: Function) => {
|
||||
const data: Array<string> = [];
|
||||
stream.on('data', (chunk: any) => {
|
||||
data.push(chunk);
|
||||
});
|
||||
stream.on('end', () => {
|
||||
resolve(data);
|
||||
});
|
||||
stream.on('error', (err: Error) => {
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
);
|
||||
const text: string = await StreamUtil.convertStreamToText(stream);
|
||||
return text.split('\n');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user