1
1
/* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { PartialDeep } from "type-fest"
3
2
import {
4
3
EnvContext ,
5
4
ProcessingResult ,
@@ -58,34 +57,32 @@ export {
58
57
ThreadMatchConfig ,
59
58
V1Config ,
60
59
V1Rule ,
61
- VariableEntry ,
60
+ VariableEntry
62
61
}
63
62
64
63
/**
65
64
* Run Gmail Processor with the given config
66
- * @param configJson - GmailProcessor configuration JSON - @see Config
65
+ * @param config - GmailProcessor configuration JSON - @see Config
67
66
* @param runMode - The processing mode - @see RunMode
68
67
* @param ctx - The environment context to be used for processing - @see EnvContext
69
68
* @returns Processing result - @see ProcessingResult
70
69
*/
71
70
export function run (
72
- configJson : PartialDeep < Config > ,
71
+ config : Config ,
73
72
runMode : string = RunMode . SAFE_MODE ,
74
73
ctx : EnvContext = EnvProvider . defaultContext ( runMode as RunMode ) ,
75
74
) : ProcessingResult {
76
- return GmailProcessor . runWithJson ( configJson , ctx )
75
+ return GmailProcessor . runWithJson ( config , ctx )
77
76
}
78
77
79
78
/**
80
79
* Convert a GMail2GDrive v1.x config JSON into a Gmail Processor config
81
- * @param v1configJson - JSON of the v1 config
80
+ * @param v1config - JSON of the v1 config - @see V1Config
82
81
* @returns Converted JSON config - @see Config
83
82
*/
84
- export function convertV1Config (
85
- v1configJson : PartialDeep < V1Config > ,
86
- ) : PartialDeep < Config > {
83
+ export function convertV1Config ( v1config : V1Config ) : Config {
87
84
return GmailProcessor . getEssentialConfig (
88
- V1ToV2Converter . v1ConfigToV2ConfigJson ( v1configJson ) ,
85
+ V1ToV2Converter . v1ConfigToV2ConfigJson ( v1config ) ,
89
86
)
90
87
}
91
88
@@ -101,3 +98,5 @@ export function convertV1Config(
101
98
; ( globalThis as any ) . ProcessingStage = ProcessingStage
102
99
; ( globalThis as any ) . RunMode = RunMode
103
100
; ( globalThis as any ) . V1Config = V1Config
101
+ ; ( globalThis as any ) . convertV1Config = convertV1Config
102
+ ; ( globalThis as any ) . run = run
0 commit comments