@alline/core
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -0,1 +1,8 @@ | ||
# [2.2.0](https://gitlab.com/alline/core/compare/v2.1.0...v2.2.0) (2020-05-19) | ||
### Features | ||
* allow hooks to be extended ([b8dd7b5](https://gitlab.com/alline/core/commit/b8dd7b51cc2a4d7728196f10c7fd908b8eeff410)) | ||
# [2.1.0](https://gitlab.com/alline/core/compare/v2.0.0...v2.1.0) (2020-05-18) | ||
@@ -2,0 +9,0 @@ |
@@ -8,7 +8,7 @@ import { AsyncSeriesHook, AsyncSeriesWaterfallHook } from "tapable"; | ||
} | ||
export declare abstract class EpisodeDeserializer { | ||
hooks: EpisodeDeserializerHook; | ||
constructor(); | ||
export declare abstract class EpisodeDeserializer<T extends {} = {}> { | ||
hooks: EpisodeDeserializerHook & T; | ||
constructor(hooks: T); | ||
deserialize(context: EpisodeContext): Promise<Episode>; | ||
protected abstract onDeserialize(context: EpisodeContext): Promise<Episode>; | ||
} |
@@ -5,6 +5,7 @@ "use strict"; | ||
class EpisodeDeserializer { | ||
constructor() { | ||
constructor(hooks) { | ||
this.hooks = { | ||
beforeDeserialize: new tapable_1.AsyncSeriesHook(["context"]), | ||
afterDeserialize: new tapable_1.AsyncSeriesWaterfallHook(["data"]) | ||
afterDeserialize: new tapable_1.AsyncSeriesWaterfallHook(["data"]), | ||
...hooks | ||
}; | ||
@@ -11,0 +12,0 @@ } |
@@ -7,7 +7,7 @@ import { AsyncSeriesWaterfallHook } from "tapable"; | ||
} | ||
export declare abstract class EpisodeScraper { | ||
hooks: EpisodeScraperHook; | ||
constructor(); | ||
export declare abstract class EpisodeScraper<T extends {} = {}> { | ||
hooks: EpisodeScraperHook & T; | ||
constructor(hooks: T); | ||
scrap(context: EpisodeContext, initialResult: EpisodeResult): Promise<EpisodeResult>; | ||
protected abstract onScrap(context: EpisodeContext, result: EpisodeResult): Promise<EpisodeResult>; | ||
} |
@@ -5,6 +5,7 @@ "use strict"; | ||
class EpisodeScraper { | ||
constructor() { | ||
constructor(hooks) { | ||
this.hooks = { | ||
beforeScrap: new tapable_1.AsyncSeriesWaterfallHook(["context"]), | ||
afterScrap: new tapable_1.AsyncSeriesWaterfallHook(["result"]) | ||
afterScrap: new tapable_1.AsyncSeriesWaterfallHook(["result"]), | ||
...hooks | ||
}; | ||
@@ -11,0 +12,0 @@ } |
@@ -8,7 +8,7 @@ import { AsyncSeriesHook, AsyncSeriesWaterfallHook } from "tapable"; | ||
} | ||
export declare abstract class EpisodeSerializer { | ||
hooks: EpisodeSerializerHook; | ||
constructor(); | ||
export declare abstract class EpisodeSerializer<T extends {} = {}> { | ||
hooks: EpisodeSerializerHook & T; | ||
constructor(hooks: T); | ||
serialize(context: EpisodeContext, data: Episode): Promise<void>; | ||
protected abstract onSerialize(context: EpisodeContext, data: Episode): Promise<void>; | ||
} |
@@ -5,6 +5,7 @@ "use strict"; | ||
class EpisodeSerializer { | ||
constructor() { | ||
constructor(hooks) { | ||
this.hooks = { | ||
beforeSerialize: new tapable_1.AsyncSeriesWaterfallHook(["data"]), | ||
afterSerialize: new tapable_1.AsyncSeriesHook(["context"]) | ||
afterSerialize: new tapable_1.AsyncSeriesHook(["context"]), | ||
...hooks | ||
}; | ||
@@ -11,0 +12,0 @@ } |
@@ -7,7 +7,7 @@ import { AsyncSeriesHook, AsyncSeriesWaterfallHook } from "tapable"; | ||
} | ||
export declare abstract class ImageSerializer { | ||
hooks: ImageSerializerHook; | ||
constructor(); | ||
export declare abstract class ImageSerializer<T extends {} = {}> { | ||
hooks: ImageSerializerHook & T; | ||
constructor(hooks: T); | ||
serialize(context: EpisodeContext, images: string[]): Promise<void>; | ||
protected abstract onSerialize(context: EpisodeContext, images: string[]): Promise<void>; | ||
} |
@@ -5,6 +5,7 @@ "use strict"; | ||
class ImageSerializer { | ||
constructor() { | ||
constructor(hooks) { | ||
this.hooks = { | ||
beforeSerialize: new tapable_1.AsyncSeriesWaterfallHook(["images"]), | ||
afterSerialize: new tapable_1.AsyncSeriesHook(["context"]) | ||
afterSerialize: new tapable_1.AsyncSeriesHook(["context"]), | ||
...hooks | ||
}; | ||
@@ -11,0 +12,0 @@ } |
{ | ||
"name": "@alline/core", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Core for Alline.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31913
278