storyblok 4.14.1 → 4.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.d.mts +140 -29
- package/dist/config/index.d.ts +140 -29
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.mjs +105 -82
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/config/index.d.mts
CHANGED
|
@@ -69,6 +69,20 @@ interface MigrationsRunOptions extends CommandOptions {
|
|
|
69
69
|
publish?: 'all' | 'published' | 'published-with-changes';
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Options for the datasources delete command.
|
|
74
|
+
*/
|
|
75
|
+
interface DeleteDatasourceOptions {
|
|
76
|
+
/**
|
|
77
|
+
* The datasource id to delete by, if provided. If not set, the command will delete by name.
|
|
78
|
+
*/
|
|
79
|
+
id?: string;
|
|
80
|
+
/**
|
|
81
|
+
* If true, skip confirmation prompt (for CI or automation)
|
|
82
|
+
*/
|
|
83
|
+
force?: boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
72
86
|
/**
|
|
73
87
|
* Interface representing the options for the `datasources pull` command.
|
|
74
88
|
*/
|
|
@@ -113,6 +127,8 @@ interface PushDatasourcesOptions extends CommandOptions {
|
|
|
113
127
|
suffix?: string;
|
|
114
128
|
}
|
|
115
129
|
|
|
130
|
+
type MigrationsRollbackOptions = CommandOptions;
|
|
131
|
+
|
|
116
132
|
interface GenerateTypesOptions {
|
|
117
133
|
separateFiles?: boolean;
|
|
118
134
|
strict?: boolean;
|
|
@@ -125,6 +141,73 @@ interface GenerateTypesOptions {
|
|
|
125
141
|
compilerOptions?: string;
|
|
126
142
|
}
|
|
127
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Interface representing the options for the `pull-languages` command.
|
|
146
|
+
*/
|
|
147
|
+
interface PullLanguagesOptions extends CommandOptions {
|
|
148
|
+
/**
|
|
149
|
+
* The path to save the languages file to.
|
|
150
|
+
* Defaults to `.storyblok/languages`.
|
|
151
|
+
* @default `.storyblok/languages`
|
|
152
|
+
*/
|
|
153
|
+
path?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The space ID.
|
|
156
|
+
* @required true
|
|
157
|
+
*/
|
|
158
|
+
space: string;
|
|
159
|
+
/**
|
|
160
|
+
* The filename to save the file as.
|
|
161
|
+
* Defaults to `DEFAULT_LANGUAGES_FILENAME`. The file will be saved as `<filename>.<space>.json`.
|
|
162
|
+
* @default DEFAULT_LANGUAGES_FILENAME
|
|
163
|
+
*/
|
|
164
|
+
filename?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The suffix to add to the filename.
|
|
167
|
+
* Defaults to the space ID.
|
|
168
|
+
* @default space
|
|
169
|
+
*/
|
|
170
|
+
suffix?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface PullAssetsOptions extends CommandOptions {
|
|
174
|
+
dryRun?: boolean;
|
|
175
|
+
query?: string;
|
|
176
|
+
assetToken?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface PushAssetsOptions extends CommandOptions {
|
|
180
|
+
from?: string;
|
|
181
|
+
data?: string;
|
|
182
|
+
shortFilename?: string;
|
|
183
|
+
folder?: string;
|
|
184
|
+
cleanup?: boolean;
|
|
185
|
+
updateStories?: boolean;
|
|
186
|
+
assetToken?: string;
|
|
187
|
+
dryRun?: boolean;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface PullStoriesOptions extends CommandOptions {
|
|
191
|
+
dryRun?: boolean;
|
|
192
|
+
query?: string;
|
|
193
|
+
startsWith?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface PushStoriesOptions extends CommandOptions {
|
|
197
|
+
from?: string;
|
|
198
|
+
dryRun?: boolean;
|
|
199
|
+
publish?: string;
|
|
200
|
+
cleanup?: boolean;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface PruneLogsOptions extends CommandOptions {
|
|
204
|
+
keep: number;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
interface PruneReportsOptions extends CommandOptions {
|
|
208
|
+
keep: number;
|
|
209
|
+
}
|
|
210
|
+
|
|
128
211
|
/**
|
|
129
212
|
* Makes all properties in T optional recursively
|
|
130
213
|
*/
|
|
@@ -132,7 +215,6 @@ type DeepPartial<T> = T extends object ? {
|
|
|
132
215
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
133
216
|
} : T;
|
|
134
217
|
|
|
135
|
-
type PlainObject = Record<string, any>;
|
|
136
218
|
interface ApiConfig {
|
|
137
219
|
maxRetries: number;
|
|
138
220
|
maxConcurrency: number;
|
|
@@ -159,6 +241,8 @@ interface UiConfig {
|
|
|
159
241
|
}
|
|
160
242
|
interface GlobalConfig {
|
|
161
243
|
region?: RegionCode;
|
|
244
|
+
space?: number | string;
|
|
245
|
+
path?: string;
|
|
162
246
|
api: ApiConfig;
|
|
163
247
|
log: LogConfig;
|
|
164
248
|
report: ReportConfig;
|
|
@@ -167,41 +251,68 @@ interface GlobalConfig {
|
|
|
167
251
|
}
|
|
168
252
|
type StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;
|
|
169
253
|
type CommandConfig<T> = Partial<StripCommandOption<T>>;
|
|
170
|
-
interface
|
|
171
|
-
space?: number;
|
|
254
|
+
interface SharedConfigOptions {
|
|
255
|
+
space?: number | string;
|
|
172
256
|
path?: string;
|
|
173
|
-
pull?: CommandConfig<PullComponentsOptions>;
|
|
174
|
-
push?: CommandConfig<PushComponentsOptions>;
|
|
175
257
|
}
|
|
176
|
-
interface
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
258
|
+
interface CommandOptionsMap {
|
|
259
|
+
components: {
|
|
260
|
+
pull: PullComponentsOptions;
|
|
261
|
+
push: PushComponentsOptions;
|
|
262
|
+
};
|
|
263
|
+
datasources: {
|
|
264
|
+
pull: PullDatasourcesOptions;
|
|
265
|
+
push: PushDatasourcesOptions;
|
|
266
|
+
delete: DeleteDatasourceOptions;
|
|
267
|
+
};
|
|
268
|
+
migrations: {
|
|
269
|
+
generate: MigrationsGenerateOptions;
|
|
270
|
+
run: MigrationsRunOptions;
|
|
271
|
+
rollback: MigrationsRollbackOptions;
|
|
272
|
+
};
|
|
273
|
+
types: {
|
|
274
|
+
generate: GenerateTypesOptions;
|
|
275
|
+
};
|
|
276
|
+
languages: {
|
|
277
|
+
pull: PullLanguagesOptions;
|
|
278
|
+
};
|
|
279
|
+
assets: {
|
|
280
|
+
pull: PullAssetsOptions;
|
|
281
|
+
push: PushAssetsOptions;
|
|
282
|
+
};
|
|
283
|
+
stories: {
|
|
284
|
+
pull: PullStoriesOptions;
|
|
285
|
+
push: PushStoriesOptions;
|
|
286
|
+
};
|
|
287
|
+
logs: {
|
|
288
|
+
list: Record<string, never>;
|
|
289
|
+
prune: PruneLogsOptions;
|
|
290
|
+
};
|
|
291
|
+
reports: {
|
|
292
|
+
list: Record<string, never>;
|
|
293
|
+
prune: PruneReportsOptions;
|
|
294
|
+
};
|
|
187
295
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
components?: ComponentsModuleConfig;
|
|
195
|
-
datasources?: DatasourcesModuleConfig;
|
|
196
|
-
migrations?: MigrationsModuleConfig;
|
|
197
|
-
types?: TypesModuleConfig;
|
|
296
|
+
type SubcommandConfig<T> = SharedConfigOptions & CommandConfig<T>;
|
|
297
|
+
type ModuleConfig<Subs extends Record<string, any>> = SharedConfigOptions & {
|
|
298
|
+
[K in keyof Subs]?: SubcommandConfig<Subs[K]>;
|
|
299
|
+
};
|
|
300
|
+
type ModulesConfig = {
|
|
301
|
+
[K in keyof CommandOptionsMap]?: ModuleConfig<CommandOptionsMap[K]>;
|
|
198
302
|
};
|
|
303
|
+
type ComponentsModuleConfig = ModulesConfig['components'];
|
|
304
|
+
type DatasourcesModuleConfig = ModulesConfig['datasources'];
|
|
305
|
+
type MigrationsModuleConfig = ModulesConfig['migrations'];
|
|
306
|
+
type TypesModuleConfig = ModulesConfig['types'];
|
|
307
|
+
type LanguagesModuleConfig = ModulesConfig['languages'];
|
|
308
|
+
type AssetsModuleConfig = ModulesConfig['assets'];
|
|
309
|
+
type StoriesModuleConfig = ModulesConfig['stories'];
|
|
310
|
+
type LogsModuleConfig = ModulesConfig['logs'];
|
|
311
|
+
type ReportsModuleConfig = ModulesConfig['reports'];
|
|
199
312
|
interface StoryblokConfig extends DeepPartial<GlobalConfig> {
|
|
200
|
-
space?: number;
|
|
201
|
-
path?: string;
|
|
202
313
|
modules?: ModulesConfig;
|
|
203
314
|
}
|
|
204
315
|
declare function defineConfig<T extends StoryblokConfig>(config: T): T;
|
|
205
316
|
|
|
206
317
|
export { defineConfig };
|
|
207
|
-
export type { ComponentsModuleConfig, DatasourcesModuleConfig, MigrationsModuleConfig, ModulesConfig, StoryblokConfig, TypesModuleConfig };
|
|
318
|
+
export type { AssetsModuleConfig, ComponentsModuleConfig, DatasourcesModuleConfig, LanguagesModuleConfig, LogsModuleConfig, MigrationsModuleConfig, ModulesConfig, ReportsModuleConfig, StoriesModuleConfig, StoryblokConfig, TypesModuleConfig };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -69,6 +69,20 @@ interface MigrationsRunOptions extends CommandOptions {
|
|
|
69
69
|
publish?: 'all' | 'published' | 'published-with-changes';
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Options for the datasources delete command.
|
|
74
|
+
*/
|
|
75
|
+
interface DeleteDatasourceOptions {
|
|
76
|
+
/**
|
|
77
|
+
* The datasource id to delete by, if provided. If not set, the command will delete by name.
|
|
78
|
+
*/
|
|
79
|
+
id?: string;
|
|
80
|
+
/**
|
|
81
|
+
* If true, skip confirmation prompt (for CI or automation)
|
|
82
|
+
*/
|
|
83
|
+
force?: boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
72
86
|
/**
|
|
73
87
|
* Interface representing the options for the `datasources pull` command.
|
|
74
88
|
*/
|
|
@@ -113,6 +127,8 @@ interface PushDatasourcesOptions extends CommandOptions {
|
|
|
113
127
|
suffix?: string;
|
|
114
128
|
}
|
|
115
129
|
|
|
130
|
+
type MigrationsRollbackOptions = CommandOptions;
|
|
131
|
+
|
|
116
132
|
interface GenerateTypesOptions {
|
|
117
133
|
separateFiles?: boolean;
|
|
118
134
|
strict?: boolean;
|
|
@@ -125,6 +141,73 @@ interface GenerateTypesOptions {
|
|
|
125
141
|
compilerOptions?: string;
|
|
126
142
|
}
|
|
127
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Interface representing the options for the `pull-languages` command.
|
|
146
|
+
*/
|
|
147
|
+
interface PullLanguagesOptions extends CommandOptions {
|
|
148
|
+
/**
|
|
149
|
+
* The path to save the languages file to.
|
|
150
|
+
* Defaults to `.storyblok/languages`.
|
|
151
|
+
* @default `.storyblok/languages`
|
|
152
|
+
*/
|
|
153
|
+
path?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The space ID.
|
|
156
|
+
* @required true
|
|
157
|
+
*/
|
|
158
|
+
space: string;
|
|
159
|
+
/**
|
|
160
|
+
* The filename to save the file as.
|
|
161
|
+
* Defaults to `DEFAULT_LANGUAGES_FILENAME`. The file will be saved as `<filename>.<space>.json`.
|
|
162
|
+
* @default DEFAULT_LANGUAGES_FILENAME
|
|
163
|
+
*/
|
|
164
|
+
filename?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The suffix to add to the filename.
|
|
167
|
+
* Defaults to the space ID.
|
|
168
|
+
* @default space
|
|
169
|
+
*/
|
|
170
|
+
suffix?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface PullAssetsOptions extends CommandOptions {
|
|
174
|
+
dryRun?: boolean;
|
|
175
|
+
query?: string;
|
|
176
|
+
assetToken?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface PushAssetsOptions extends CommandOptions {
|
|
180
|
+
from?: string;
|
|
181
|
+
data?: string;
|
|
182
|
+
shortFilename?: string;
|
|
183
|
+
folder?: string;
|
|
184
|
+
cleanup?: boolean;
|
|
185
|
+
updateStories?: boolean;
|
|
186
|
+
assetToken?: string;
|
|
187
|
+
dryRun?: boolean;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface PullStoriesOptions extends CommandOptions {
|
|
191
|
+
dryRun?: boolean;
|
|
192
|
+
query?: string;
|
|
193
|
+
startsWith?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface PushStoriesOptions extends CommandOptions {
|
|
197
|
+
from?: string;
|
|
198
|
+
dryRun?: boolean;
|
|
199
|
+
publish?: string;
|
|
200
|
+
cleanup?: boolean;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface PruneLogsOptions extends CommandOptions {
|
|
204
|
+
keep: number;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
interface PruneReportsOptions extends CommandOptions {
|
|
208
|
+
keep: number;
|
|
209
|
+
}
|
|
210
|
+
|
|
128
211
|
/**
|
|
129
212
|
* Makes all properties in T optional recursively
|
|
130
213
|
*/
|
|
@@ -132,7 +215,6 @@ type DeepPartial<T> = T extends object ? {
|
|
|
132
215
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
133
216
|
} : T;
|
|
134
217
|
|
|
135
|
-
type PlainObject = Record<string, any>;
|
|
136
218
|
interface ApiConfig {
|
|
137
219
|
maxRetries: number;
|
|
138
220
|
maxConcurrency: number;
|
|
@@ -159,6 +241,8 @@ interface UiConfig {
|
|
|
159
241
|
}
|
|
160
242
|
interface GlobalConfig {
|
|
161
243
|
region?: RegionCode;
|
|
244
|
+
space?: number | string;
|
|
245
|
+
path?: string;
|
|
162
246
|
api: ApiConfig;
|
|
163
247
|
log: LogConfig;
|
|
164
248
|
report: ReportConfig;
|
|
@@ -167,41 +251,68 @@ interface GlobalConfig {
|
|
|
167
251
|
}
|
|
168
252
|
type StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;
|
|
169
253
|
type CommandConfig<T> = Partial<StripCommandOption<T>>;
|
|
170
|
-
interface
|
|
171
|
-
space?: number;
|
|
254
|
+
interface SharedConfigOptions {
|
|
255
|
+
space?: number | string;
|
|
172
256
|
path?: string;
|
|
173
|
-
pull?: CommandConfig<PullComponentsOptions>;
|
|
174
|
-
push?: CommandConfig<PushComponentsOptions>;
|
|
175
257
|
}
|
|
176
|
-
interface
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
258
|
+
interface CommandOptionsMap {
|
|
259
|
+
components: {
|
|
260
|
+
pull: PullComponentsOptions;
|
|
261
|
+
push: PushComponentsOptions;
|
|
262
|
+
};
|
|
263
|
+
datasources: {
|
|
264
|
+
pull: PullDatasourcesOptions;
|
|
265
|
+
push: PushDatasourcesOptions;
|
|
266
|
+
delete: DeleteDatasourceOptions;
|
|
267
|
+
};
|
|
268
|
+
migrations: {
|
|
269
|
+
generate: MigrationsGenerateOptions;
|
|
270
|
+
run: MigrationsRunOptions;
|
|
271
|
+
rollback: MigrationsRollbackOptions;
|
|
272
|
+
};
|
|
273
|
+
types: {
|
|
274
|
+
generate: GenerateTypesOptions;
|
|
275
|
+
};
|
|
276
|
+
languages: {
|
|
277
|
+
pull: PullLanguagesOptions;
|
|
278
|
+
};
|
|
279
|
+
assets: {
|
|
280
|
+
pull: PullAssetsOptions;
|
|
281
|
+
push: PushAssetsOptions;
|
|
282
|
+
};
|
|
283
|
+
stories: {
|
|
284
|
+
pull: PullStoriesOptions;
|
|
285
|
+
push: PushStoriesOptions;
|
|
286
|
+
};
|
|
287
|
+
logs: {
|
|
288
|
+
list: Record<string, never>;
|
|
289
|
+
prune: PruneLogsOptions;
|
|
290
|
+
};
|
|
291
|
+
reports: {
|
|
292
|
+
list: Record<string, never>;
|
|
293
|
+
prune: PruneReportsOptions;
|
|
294
|
+
};
|
|
187
295
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
components?: ComponentsModuleConfig;
|
|
195
|
-
datasources?: DatasourcesModuleConfig;
|
|
196
|
-
migrations?: MigrationsModuleConfig;
|
|
197
|
-
types?: TypesModuleConfig;
|
|
296
|
+
type SubcommandConfig<T> = SharedConfigOptions & CommandConfig<T>;
|
|
297
|
+
type ModuleConfig<Subs extends Record<string, any>> = SharedConfigOptions & {
|
|
298
|
+
[K in keyof Subs]?: SubcommandConfig<Subs[K]>;
|
|
299
|
+
};
|
|
300
|
+
type ModulesConfig = {
|
|
301
|
+
[K in keyof CommandOptionsMap]?: ModuleConfig<CommandOptionsMap[K]>;
|
|
198
302
|
};
|
|
303
|
+
type ComponentsModuleConfig = ModulesConfig['components'];
|
|
304
|
+
type DatasourcesModuleConfig = ModulesConfig['datasources'];
|
|
305
|
+
type MigrationsModuleConfig = ModulesConfig['migrations'];
|
|
306
|
+
type TypesModuleConfig = ModulesConfig['types'];
|
|
307
|
+
type LanguagesModuleConfig = ModulesConfig['languages'];
|
|
308
|
+
type AssetsModuleConfig = ModulesConfig['assets'];
|
|
309
|
+
type StoriesModuleConfig = ModulesConfig['stories'];
|
|
310
|
+
type LogsModuleConfig = ModulesConfig['logs'];
|
|
311
|
+
type ReportsModuleConfig = ModulesConfig['reports'];
|
|
199
312
|
interface StoryblokConfig extends DeepPartial<GlobalConfig> {
|
|
200
|
-
space?: number;
|
|
201
|
-
path?: string;
|
|
202
313
|
modules?: ModulesConfig;
|
|
203
314
|
}
|
|
204
315
|
declare function defineConfig<T extends StoryblokConfig>(config: T): T;
|
|
205
316
|
|
|
206
317
|
export { defineConfig };
|
|
207
|
-
export type { ComponentsModuleConfig, DatasourcesModuleConfig, MigrationsModuleConfig, ModulesConfig, StoryblokConfig, TypesModuleConfig };
|
|
318
|
+
export type { AssetsModuleConfig, ComponentsModuleConfig, DatasourcesModuleConfig, LanguagesModuleConfig, LogsModuleConfig, MigrationsModuleConfig, ModulesConfig, ReportsModuleConfig, StoriesModuleConfig, StoryblokConfig, TypesModuleConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/lib/config/types.ts"],"sourcesContent":["import type { RegionCode } from '../../constants';\nimport type { Command, Option } from 'commander';\nimport type { CommandOptions } from '../../types';\nimport type { PullComponentsOptions } from '../../commands/components/pull/constants';\nimport type { PushComponentsOptions } from '../../commands/components/push/constants';\nimport type { PullDatasourcesOptions } from '../../commands/datasources/pull/constants';\nimport type { PushDatasourcesOptions } from '../../commands/datasources/push/constants';\nimport type { MigrationsGenerateOptions } from '../../commands/migrations/generate/constants';\nimport type { MigrationsRunOptions } from '../../commands/migrations/run/constants';\nimport type { GenerateTypesOptions } from '../../commands/types/generate/constants';\nimport type { DeepPartial } from '../../utils/types';\n\nexport type PlainObject = Record<string, any>;\n\nexport interface ApiConfig {\n maxRetries: number;\n maxConcurrency: number;\n}\n\nexport interface LogConsoleConfig {\n enabled: boolean;\n level: string;\n}\n\nexport interface LogFileConfig {\n enabled: boolean;\n level: string;\n maxFiles: number;\n}\n\nexport interface LogConfig {\n console: LogConsoleConfig;\n file: LogFileConfig;\n}\n\nexport interface ReportConfig {\n enabled: boolean;\n maxFiles: number;\n}\n\nexport interface UiConfig {\n enabled: boolean;\n}\n\nexport interface GlobalConfig {\n region?: RegionCode;\n api: ApiConfig;\n log: LogConfig;\n report: ReportConfig;\n ui: UiConfig;\n verbose: boolean;\n}\n\nexport interface ResolvedCliConfig extends GlobalConfig {\n [key: string]: any;\n}\n\ntype StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;\ntype CommandConfig<T> = Partial<StripCommandOption<T>>;\n\nexport interface
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/lib/config/types.ts"],"sourcesContent":["import type { RegionCode } from '../../constants';\nimport type { Command, Option } from 'commander';\nimport type { CommandOptions } from '../../types';\nimport type { PullComponentsOptions } from '../../commands/components/pull/constants';\nimport type { PushComponentsOptions } from '../../commands/components/push/constants';\nimport type { PullDatasourcesOptions } from '../../commands/datasources/pull/constants';\nimport type { PushDatasourcesOptions } from '../../commands/datasources/push/constants';\nimport type { DeleteDatasourceOptions } from '../../commands/datasources/delete/constants';\nimport type { MigrationsGenerateOptions } from '../../commands/migrations/generate/constants';\nimport type { MigrationsRunOptions } from '../../commands/migrations/run/constants';\nimport type { MigrationsRollbackOptions } from '../../commands/migrations/rollback/types';\nimport type { GenerateTypesOptions } from '../../commands/types/generate/constants';\nimport type { PullLanguagesOptions } from '../../commands/languages/constants';\nimport type { PullAssetsOptions } from '../../commands/assets/pull/types';\nimport type { PushAssetsOptions } from '../../commands/assets/push/types';\nimport type { PullStoriesOptions } from '../../commands/stories/pull/types';\nimport type { PushStoriesOptions } from '../../commands/stories/push/types';\nimport type { PruneLogsOptions } from '../../commands/logs/prune/types';\nimport type { PruneReportsOptions } from '../../commands/reports/prune/types';\nimport type { DeepPartial } from '../../utils/types';\n\nexport type PlainObject = Record<string, any>;\n\nexport interface ApiConfig {\n maxRetries: number;\n maxConcurrency: number;\n}\n\nexport interface LogConsoleConfig {\n enabled: boolean;\n level: string;\n}\n\nexport interface LogFileConfig {\n enabled: boolean;\n level: string;\n maxFiles: number;\n}\n\nexport interface LogConfig {\n console: LogConsoleConfig;\n file: LogFileConfig;\n}\n\nexport interface ReportConfig {\n enabled: boolean;\n maxFiles: number;\n}\n\nexport interface UiConfig {\n enabled: boolean;\n}\n\nexport interface GlobalConfig {\n region?: RegionCode;\n space?: number | string;\n path?: string;\n api: ApiConfig;\n log: LogConfig;\n report: ReportConfig;\n ui: UiConfig;\n verbose: boolean;\n}\n\nexport interface ResolvedCliConfig extends GlobalConfig {\n [key: string]: any;\n}\n\ntype StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;\ntype CommandConfig<T> = Partial<StripCommandOption<T>>;\n\nexport interface SharedConfigOptions {\n space?: number | string;\n path?: string;\n}\n\nexport interface CommandOptionsMap {\n components: { pull: PullComponentsOptions; push: PushComponentsOptions };\n datasources: { pull: PullDatasourcesOptions; push: PushDatasourcesOptions; delete: DeleteDatasourceOptions };\n migrations: { generate: MigrationsGenerateOptions; run: MigrationsRunOptions; rollback: MigrationsRollbackOptions };\n types: { generate: GenerateTypesOptions };\n languages: { pull: PullLanguagesOptions };\n assets: { pull: PullAssetsOptions; push: PushAssetsOptions };\n stories: { pull: PullStoriesOptions; push: PushStoriesOptions };\n logs: { list: Record<string, never>; prune: PruneLogsOptions };\n reports: { list: Record<string, never>; prune: PruneReportsOptions };\n}\n\ntype SubcommandConfig<T> = SharedConfigOptions & CommandConfig<T>;\n\ntype ModuleConfig<Subs extends Record<string, any>> = SharedConfigOptions & {\n [K in keyof Subs]?: SubcommandConfig<Subs[K]>;\n};\n\nexport type ModulesConfig = {\n [K in keyof CommandOptionsMap]?: ModuleConfig<CommandOptionsMap[K]>;\n};\n\nexport type ComponentsModuleConfig = ModulesConfig['components'];\nexport type DatasourcesModuleConfig = ModulesConfig['datasources'];\nexport type MigrationsModuleConfig = ModulesConfig['migrations'];\nexport type TypesModuleConfig = ModulesConfig['types'];\nexport type LanguagesModuleConfig = ModulesConfig['languages'];\nexport type AssetsModuleConfig = ModulesConfig['assets'];\nexport type StoriesModuleConfig = ModulesConfig['stories'];\nexport type LogsModuleConfig = ModulesConfig['logs'];\nexport type ReportsModuleConfig = ModulesConfig['reports'];\n\nexport interface StoryblokConfig extends DeepPartial<GlobalConfig> {\n modules?: ModulesConfig;\n}\n\nexport function defineConfig<T extends StoryblokConfig>(config: T): T {\n return config;\n}\n\nexport type OptionParser<T> = (value: string, previous?: T) => T;\n\nexport interface GlobalOptionDefinition<T = unknown> {\n flags: string;\n description: string;\n defaultValue?: T;\n parser?: OptionParser<T>;\n}\n\nexport interface ConfigLocation {\n cwd: string;\n configFile: string;\n}\n\nexport type CommanderOption = Option;\nexport type CommanderCommand = Command;\n"],"names":[],"mappings":"AAgHO,SAAS,aAAwC,MAAc,EAAA;AACpE,EAAO,OAAA,MAAA;AACT;;;;"}
|