@@ -116,7 +116,6 @@ export type FormatOptions = {
116
116
* `,
117
117
* }
118
118
*/
119
-
120
119
export interface SFCFileInfo {
121
120
path : string
122
121
content : string
@@ -157,6 +156,40 @@ export interface SFCFileInfo {
157
156
declare function squeeze ( basePath : string , files : SFCFileInfo [ ] ) : MetaLocaleMessage
158
157
declare function infuse ( basePath : string , sources : SFCFileInfo [ ] , meta : MetaLocaleMessage , options ?: FormatOptions ) : SFCFileInfo [ ]
159
158
159
+ /**
160
+ * Provider factory function
161
+ */
162
+ export type ProviderFactory < T = { } > = ( configration : ProviderConfiguration < T > ) => Provider
163
+
164
+ /**
165
+ * Provider interface
166
+ */
167
+ export interface Provider {
168
+ /**
169
+ * push the resource to localization service
170
+ * @param resource the resource that push to localization service
171
+ * @param dryRun whether the CLI run as dryRun mode
172
+ */
173
+ push ( resource : ProviderPushResource , dryRun : boolean ) : Promise < void >
174
+ /**
175
+ * pull the resource from localization service
176
+ * @param locales locales that pull from localization service, if empty, you must pull the all locale messages
177
+ * @param dryRun whether the CLI run as dryRun mode
178
+ * @returns the resource of localization service
179
+ */
180
+ pull ( locales : Locale [ ] , dryRun : boolean ) : Promise < ProviderPullResource >
181
+ }
182
+
183
+ /**
184
+ * mode that can be processed with provider push
185
+ * - 'file-path':
186
+ * To use when the provider uses the locale message directly from the file.
187
+ * for example, used for file uploading.
188
+ * When specified that mode, `ProviderPushResource` are passed from the CLI as `files`.
189
+ * - 'locale-message':
190
+ * To use when the provider uses the locale message.
191
+ * When specified that mode, `ProviderPushResource` are passed from the CLI as `messaegs`.
192
+ */
160
193
export type ProviderPushMode = 'file-path' | 'locale-message'
161
194
162
195
export type ProviderPushFileInfo = {
@@ -172,13 +205,6 @@ export type ProviderPushResource = {
172
205
173
206
export type ProviderPullResource = LocaleMessages
174
207
175
- export interface Provider {
176
- push ( resource : ProviderPushResource , dryRun : boolean ) : Promise < void >
177
- pull ( locales : Locale [ ] , dryRun : boolean ) : Promise < ProviderPullResource >
178
- }
179
-
180
- export type ProviderFactory < T = { } > = ( configration : ProviderConfiguration < T > ) => Provider
181
-
182
208
/**
183
209
* ProviderConfiguration provider fields structure
184
210
* e.g.
@@ -189,7 +215,6 @@ export type ProviderFactory<T = {}> = (configration: ProviderConfiguration<T>) =
189
215
* "pushMode": "file-path"
190
216
* }
191
217
*/
192
-
193
218
export interface ProviderConfiguration < T = { } > {
194
219
provider : { [ key in keyof ProviderConfigurationValue < T > ] : ProviderConfigurationValue < T > [ key ] }
195
220
pushMode : ProviderPushMode
0 commit comments