storyblok 4.22.3 → 4.22.4
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.cjs +9 -0
- package/dist/config/index.cjs.map +1 -0
- package/dist/config/index.d.cts +363 -0
- package/dist/config/index.d.mts +148 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +29 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -6
- package/dist/constants-FGOZXcwP.d.mts +0 -149
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"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 rateLimit: number;\n /** @deprecated Use `rateLimit` instead. @todo(next-major): Remove this field. */\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: {\n pull: PullDatasourcesOptions;\n push: PushDatasourcesOptions;\n delete: DeleteDatasourceOptions;\n };\n migrations: {\n generate: MigrationsGenerateOptions;\n run: MigrationsRunOptions;\n rollback: MigrationsRollbackOptions;\n };\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"],"mappings":";;AA0HA,SAAgB,aAAwC,QAAc;CACpE,OAAO;AACT"}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import "commander";
|
|
2
|
+
import "@storyblok/management-api-client";
|
|
3
|
+
//#region src/constants.d.ts
|
|
4
|
+
declare const regionCodes: readonly ["eu", "us", "cn", "ca", "ap"];
|
|
5
|
+
type RegionCode = (typeof regionCodes)[number];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/types/index.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Interface representing the default options for a CLI command.
|
|
10
|
+
*/
|
|
11
|
+
interface CommandOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Indicates whether verbose output is enabled.
|
|
14
|
+
*/
|
|
15
|
+
verbose: boolean;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/commands/components/pull/constants.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* Interface representing the options for the `components pull` command.
|
|
21
|
+
*/
|
|
22
|
+
interface PullComponentsOptions extends CommandOptions {
|
|
23
|
+
/**
|
|
24
|
+
* The filename to save the file as.
|
|
25
|
+
* Defaults to `components`. The file will be saved as `<filename>.<space>.json`.
|
|
26
|
+
* @default `components
|
|
27
|
+
*/
|
|
28
|
+
filename?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The suffix to add to the filename.
|
|
31
|
+
* Defaults to the space ID.
|
|
32
|
+
* @default space
|
|
33
|
+
*/
|
|
34
|
+
suffix?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates whether to save each component to a separate file.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
separateFiles?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Glob pattern to select components by name. Matching components and their dependencies
|
|
42
|
+
* (assigned groups with ancestors, tags, presets, and schema-whitelisted groups/tags) are pulled.
|
|
43
|
+
*/
|
|
44
|
+
filter?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Component group name(s) or `Parent/Child` path(s) to select. Includes descendant groups.
|
|
47
|
+
* Repeatable; multiple values match any of the given groups.
|
|
48
|
+
*/
|
|
49
|
+
group?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Component tag name(s) to select. Repeatable and comma-separated; multiple values match any.
|
|
52
|
+
*/
|
|
53
|
+
tag?: string[];
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/commands/components/push/constants.d.ts
|
|
57
|
+
interface PushComponentsOptions extends CommandOptions {
|
|
58
|
+
/**
|
|
59
|
+
* The glob pattern filter to apply to components before pushing.
|
|
60
|
+
* Matching components and all their dependencies (groups, tags, other components)
|
|
61
|
+
* will be collected and pushed together.
|
|
62
|
+
* @default `.*`
|
|
63
|
+
*/
|
|
64
|
+
filter?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Indicates whether to save each component to a separate file.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
separateFiles?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The source space id.
|
|
72
|
+
*/
|
|
73
|
+
from?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Suffix to add to the component name.
|
|
76
|
+
*/
|
|
77
|
+
suffix?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Component group name(s) or `Parent/Child` path(s) to select from local files. Includes descendants.
|
|
80
|
+
* Repeatable; multiple values match any of the given groups.
|
|
81
|
+
*/
|
|
82
|
+
group?: string[];
|
|
83
|
+
/**
|
|
84
|
+
* Component tag name(s) to select from local files. Repeatable and comma-separated; multiple values match any.
|
|
85
|
+
*/
|
|
86
|
+
tag?: string[];
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/commands/datasources/pull/constants.d.ts
|
|
90
|
+
/**
|
|
91
|
+
* Interface representing the options for the `datasources pull` command.
|
|
92
|
+
*/
|
|
93
|
+
interface PullDatasourcesOptions extends CommandOptions {
|
|
94
|
+
/**
|
|
95
|
+
* The filename to save the file as.
|
|
96
|
+
* Defaults to `DEFAULT_DATASOURCES_FILENAME`. The file will be saved as `<filename>.<space>.json`.
|
|
97
|
+
* @default DEFAULT_DATASOURCES_FILENAME
|
|
98
|
+
*/
|
|
99
|
+
filename?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The suffix to add to the filename.
|
|
102
|
+
* Defaults to the space ID.
|
|
103
|
+
* @default space
|
|
104
|
+
*/
|
|
105
|
+
suffix?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Indicates whether to save each datasource to a separate file.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
separateFiles?: boolean;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/commands/datasources/push/constants.d.ts
|
|
114
|
+
interface PushDatasourcesOptions extends CommandOptions {
|
|
115
|
+
/**
|
|
116
|
+
* The glob pattern filter to apply to datasources before pushing.
|
|
117
|
+
* @default `.*`
|
|
118
|
+
*/
|
|
119
|
+
filter?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Indicates whether to save each component to a separate file.
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
separateFiles?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* The source space id.
|
|
127
|
+
*/
|
|
128
|
+
from?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Suffix to add to the component name.
|
|
131
|
+
*/
|
|
132
|
+
suffix?: string;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/commands/datasources/delete/constants.d.ts
|
|
136
|
+
/**
|
|
137
|
+
* Options for the datasources delete command.
|
|
138
|
+
*/
|
|
139
|
+
interface DeleteDatasourceOptions {
|
|
140
|
+
/**
|
|
141
|
+
* The datasource id to delete by, if provided. If not set, the command will delete by name.
|
|
142
|
+
*/
|
|
143
|
+
id?: string;
|
|
144
|
+
/**
|
|
145
|
+
* If true, skip confirmation prompt (for CI or automation)
|
|
146
|
+
*/
|
|
147
|
+
force?: boolean;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/commands/migrations/generate/constants.d.ts
|
|
151
|
+
interface MigrationsGenerateOptions extends CommandOptions {
|
|
152
|
+
suffix?: string;
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/commands/migrations/run/constants.d.ts
|
|
156
|
+
interface MigrationsRunOptions extends CommandOptions {
|
|
157
|
+
dryRun?: boolean;
|
|
158
|
+
filter?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The source space id to read migration files from.
|
|
161
|
+
*/
|
|
162
|
+
from?: string;
|
|
163
|
+
query?: string;
|
|
164
|
+
startsWith?: string;
|
|
165
|
+
publish?: "all" | "published" | "published-with-changes";
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/commands/migrations/rollback/types.d.ts
|
|
169
|
+
type MigrationsRollbackOptions = CommandOptions;
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/commands/types/generate/constants.d.ts
|
|
172
|
+
interface GenerateTypesOptions {
|
|
173
|
+
separateFiles?: boolean;
|
|
174
|
+
strict?: boolean;
|
|
175
|
+
typePrefix?: string;
|
|
176
|
+
typeSuffix?: string;
|
|
177
|
+
filename?: string;
|
|
178
|
+
path?: string;
|
|
179
|
+
suffix?: string;
|
|
180
|
+
customFieldsParser?: string;
|
|
181
|
+
compilerOptions?: string;
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/commands/languages/constants.d.ts
|
|
185
|
+
/**
|
|
186
|
+
* Interface representing the options for the `pull-languages` command.
|
|
187
|
+
*/
|
|
188
|
+
interface PullLanguagesOptions extends CommandOptions {
|
|
189
|
+
/**
|
|
190
|
+
* The path to save the languages file to.
|
|
191
|
+
* Defaults to `.storyblok/languages`.
|
|
192
|
+
* @default `.storyblok/languages`
|
|
193
|
+
*/
|
|
194
|
+
path?: string;
|
|
195
|
+
/**
|
|
196
|
+
* The space ID.
|
|
197
|
+
* @required true
|
|
198
|
+
*/
|
|
199
|
+
space: string;
|
|
200
|
+
/**
|
|
201
|
+
* The filename to save the file as.
|
|
202
|
+
* Defaults to `DEFAULT_LANGUAGES_FILENAME`. The file will be saved as `<filename>.<space>.json`.
|
|
203
|
+
* @default DEFAULT_LANGUAGES_FILENAME
|
|
204
|
+
*/
|
|
205
|
+
filename?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The suffix to add to the filename.
|
|
208
|
+
* Defaults to the space ID.
|
|
209
|
+
* @default space
|
|
210
|
+
*/
|
|
211
|
+
suffix?: string;
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/commands/assets/pull/types.d.ts
|
|
215
|
+
interface PullAssetsOptions extends CommandOptions {
|
|
216
|
+
dryRun?: boolean;
|
|
217
|
+
query?: string;
|
|
218
|
+
assetToken?: string;
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/commands/assets/push/types.d.ts
|
|
222
|
+
interface PushAssetsOptions extends CommandOptions {
|
|
223
|
+
from?: string;
|
|
224
|
+
data?: string;
|
|
225
|
+
shortFilename?: string;
|
|
226
|
+
folder?: string;
|
|
227
|
+
cleanup?: boolean;
|
|
228
|
+
updateStories?: boolean;
|
|
229
|
+
assetToken?: string;
|
|
230
|
+
dryRun?: boolean;
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/commands/stories/pull/types.d.ts
|
|
234
|
+
interface PullStoriesOptions extends CommandOptions {
|
|
235
|
+
dryRun?: boolean;
|
|
236
|
+
query?: string;
|
|
237
|
+
startsWith?: string;
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/commands/stories/push/types.d.ts
|
|
241
|
+
interface PushStoriesOptions extends CommandOptions {
|
|
242
|
+
from?: string;
|
|
243
|
+
dryRun?: boolean;
|
|
244
|
+
publish?: string;
|
|
245
|
+
cleanup?: boolean;
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/commands/logs/prune/types.d.ts
|
|
249
|
+
interface PruneLogsOptions extends CommandOptions {
|
|
250
|
+
keep: number;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/commands/reports/prune/types.d.ts
|
|
254
|
+
interface PruneReportsOptions extends CommandOptions {
|
|
255
|
+
keep: number;
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/utils/types.d.ts
|
|
259
|
+
/**
|
|
260
|
+
* Makes all properties in T optional recursively
|
|
261
|
+
*/
|
|
262
|
+
type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T;
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/lib/config/types.d.ts
|
|
265
|
+
interface ApiConfig {
|
|
266
|
+
maxRetries: number;
|
|
267
|
+
rateLimit: number;
|
|
268
|
+
/** @deprecated Use `rateLimit` instead. @todo(next-major): Remove this field. */
|
|
269
|
+
maxConcurrency?: number;
|
|
270
|
+
}
|
|
271
|
+
interface LogConsoleConfig {
|
|
272
|
+
enabled: boolean;
|
|
273
|
+
level: string;
|
|
274
|
+
}
|
|
275
|
+
interface LogFileConfig {
|
|
276
|
+
enabled: boolean;
|
|
277
|
+
level: string;
|
|
278
|
+
maxFiles: number;
|
|
279
|
+
}
|
|
280
|
+
interface LogConfig {
|
|
281
|
+
console: LogConsoleConfig;
|
|
282
|
+
file: LogFileConfig;
|
|
283
|
+
}
|
|
284
|
+
interface ReportConfig {
|
|
285
|
+
enabled: boolean;
|
|
286
|
+
maxFiles: number;
|
|
287
|
+
}
|
|
288
|
+
interface UiConfig {
|
|
289
|
+
enabled: boolean;
|
|
290
|
+
}
|
|
291
|
+
interface GlobalConfig {
|
|
292
|
+
region?: RegionCode;
|
|
293
|
+
space?: number | string;
|
|
294
|
+
path?: string;
|
|
295
|
+
api: ApiConfig;
|
|
296
|
+
log: LogConfig;
|
|
297
|
+
report: ReportConfig;
|
|
298
|
+
ui: UiConfig;
|
|
299
|
+
verbose: boolean;
|
|
300
|
+
}
|
|
301
|
+
type StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;
|
|
302
|
+
type CommandConfig<T> = Partial<StripCommandOption<T>>;
|
|
303
|
+
interface SharedConfigOptions {
|
|
304
|
+
space?: number | string;
|
|
305
|
+
path?: string;
|
|
306
|
+
}
|
|
307
|
+
interface CommandOptionsMap {
|
|
308
|
+
components: {
|
|
309
|
+
pull: PullComponentsOptions;
|
|
310
|
+
push: PushComponentsOptions;
|
|
311
|
+
};
|
|
312
|
+
datasources: {
|
|
313
|
+
pull: PullDatasourcesOptions;
|
|
314
|
+
push: PushDatasourcesOptions;
|
|
315
|
+
delete: DeleteDatasourceOptions;
|
|
316
|
+
};
|
|
317
|
+
migrations: {
|
|
318
|
+
generate: MigrationsGenerateOptions;
|
|
319
|
+
run: MigrationsRunOptions;
|
|
320
|
+
rollback: MigrationsRollbackOptions;
|
|
321
|
+
};
|
|
322
|
+
types: {
|
|
323
|
+
generate: GenerateTypesOptions;
|
|
324
|
+
};
|
|
325
|
+
languages: {
|
|
326
|
+
pull: PullLanguagesOptions;
|
|
327
|
+
};
|
|
328
|
+
assets: {
|
|
329
|
+
pull: PullAssetsOptions;
|
|
330
|
+
push: PushAssetsOptions;
|
|
331
|
+
};
|
|
332
|
+
stories: {
|
|
333
|
+
pull: PullStoriesOptions;
|
|
334
|
+
push: PushStoriesOptions;
|
|
335
|
+
};
|
|
336
|
+
logs: {
|
|
337
|
+
list: Record<string, never>;
|
|
338
|
+
prune: PruneLogsOptions;
|
|
339
|
+
};
|
|
340
|
+
reports: {
|
|
341
|
+
list: Record<string, never>;
|
|
342
|
+
prune: PruneReportsOptions;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
type SubcommandConfig<T> = SharedConfigOptions & CommandConfig<T>;
|
|
346
|
+
type ModuleConfig<Subs extends Record<string, any>> = SharedConfigOptions & { [K in keyof Subs]?: SubcommandConfig<Subs[K]>; };
|
|
347
|
+
type ModulesConfig = { [K in keyof CommandOptionsMap]?: ModuleConfig<CommandOptionsMap[K]>; };
|
|
348
|
+
type ComponentsModuleConfig = ModulesConfig["components"];
|
|
349
|
+
type DatasourcesModuleConfig = ModulesConfig["datasources"];
|
|
350
|
+
type MigrationsModuleConfig = ModulesConfig["migrations"];
|
|
351
|
+
type TypesModuleConfig = ModulesConfig["types"];
|
|
352
|
+
type LanguagesModuleConfig = ModulesConfig["languages"];
|
|
353
|
+
type AssetsModuleConfig = ModulesConfig["assets"];
|
|
354
|
+
type StoriesModuleConfig = ModulesConfig["stories"];
|
|
355
|
+
type LogsModuleConfig = ModulesConfig["logs"];
|
|
356
|
+
type ReportsModuleConfig = ModulesConfig["reports"];
|
|
357
|
+
interface StoryblokConfig extends DeepPartial<GlobalConfig> {
|
|
358
|
+
modules?: ModulesConfig;
|
|
359
|
+
}
|
|
360
|
+
declare function defineConfig<T extends StoryblokConfig>(config: T): T;
|
|
361
|
+
//#endregion
|
|
362
|
+
export { type AssetsModuleConfig, type ComponentsModuleConfig, type DatasourcesModuleConfig, type LanguagesModuleConfig, type LogsModuleConfig, type MigrationsModuleConfig, type ModulesConfig, type ReportsModuleConfig, type StoriesModuleConfig, type StoryblokConfig, type TypesModuleConfig, defineConfig };
|
|
363
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/config/index.d.mts
CHANGED
|
@@ -1,9 +1,137 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "commander";
|
|
2
|
+
import "@storyblok/management-api-client";
|
|
3
3
|
//#region src/constants.d.ts
|
|
4
4
|
declare const regionCodes: readonly ["eu", "us", "cn", "ca", "ap"];
|
|
5
5
|
type RegionCode = (typeof regionCodes)[number];
|
|
6
6
|
//#endregion
|
|
7
|
+
//#region src/types/index.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Interface representing the default options for a CLI command.
|
|
10
|
+
*/
|
|
11
|
+
interface CommandOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Indicates whether verbose output is enabled.
|
|
14
|
+
*/
|
|
15
|
+
verbose: boolean;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/commands/components/pull/constants.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* Interface representing the options for the `components pull` command.
|
|
21
|
+
*/
|
|
22
|
+
interface PullComponentsOptions extends CommandOptions {
|
|
23
|
+
/**
|
|
24
|
+
* The filename to save the file as.
|
|
25
|
+
* Defaults to `components`. The file will be saved as `<filename>.<space>.json`.
|
|
26
|
+
* @default `components
|
|
27
|
+
*/
|
|
28
|
+
filename?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The suffix to add to the filename.
|
|
31
|
+
* Defaults to the space ID.
|
|
32
|
+
* @default space
|
|
33
|
+
*/
|
|
34
|
+
suffix?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates whether to save each component to a separate file.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
separateFiles?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Glob pattern to select components by name. Matching components and their dependencies
|
|
42
|
+
* (assigned groups with ancestors, tags, presets, and schema-whitelisted groups/tags) are pulled.
|
|
43
|
+
*/
|
|
44
|
+
filter?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Component group name(s) or `Parent/Child` path(s) to select. Includes descendant groups.
|
|
47
|
+
* Repeatable; multiple values match any of the given groups.
|
|
48
|
+
*/
|
|
49
|
+
group?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Component tag name(s) to select. Repeatable and comma-separated; multiple values match any.
|
|
52
|
+
*/
|
|
53
|
+
tag?: string[];
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/commands/components/push/constants.d.ts
|
|
57
|
+
interface PushComponentsOptions extends CommandOptions {
|
|
58
|
+
/**
|
|
59
|
+
* The glob pattern filter to apply to components before pushing.
|
|
60
|
+
* Matching components and all their dependencies (groups, tags, other components)
|
|
61
|
+
* will be collected and pushed together.
|
|
62
|
+
* @default `.*`
|
|
63
|
+
*/
|
|
64
|
+
filter?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Indicates whether to save each component to a separate file.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
separateFiles?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The source space id.
|
|
72
|
+
*/
|
|
73
|
+
from?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Suffix to add to the component name.
|
|
76
|
+
*/
|
|
77
|
+
suffix?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Component group name(s) or `Parent/Child` path(s) to select from local files. Includes descendants.
|
|
80
|
+
* Repeatable; multiple values match any of the given groups.
|
|
81
|
+
*/
|
|
82
|
+
group?: string[];
|
|
83
|
+
/**
|
|
84
|
+
* Component tag name(s) to select from local files. Repeatable and comma-separated; multiple values match any.
|
|
85
|
+
*/
|
|
86
|
+
tag?: string[];
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/commands/datasources/pull/constants.d.ts
|
|
90
|
+
/**
|
|
91
|
+
* Interface representing the options for the `datasources pull` command.
|
|
92
|
+
*/
|
|
93
|
+
interface PullDatasourcesOptions extends CommandOptions {
|
|
94
|
+
/**
|
|
95
|
+
* The filename to save the file as.
|
|
96
|
+
* Defaults to `DEFAULT_DATASOURCES_FILENAME`. The file will be saved as `<filename>.<space>.json`.
|
|
97
|
+
* @default DEFAULT_DATASOURCES_FILENAME
|
|
98
|
+
*/
|
|
99
|
+
filename?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The suffix to add to the filename.
|
|
102
|
+
* Defaults to the space ID.
|
|
103
|
+
* @default space
|
|
104
|
+
*/
|
|
105
|
+
suffix?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Indicates whether to save each datasource to a separate file.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
separateFiles?: boolean;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/commands/datasources/push/constants.d.ts
|
|
114
|
+
interface PushDatasourcesOptions extends CommandOptions {
|
|
115
|
+
/**
|
|
116
|
+
* The glob pattern filter to apply to datasources before pushing.
|
|
117
|
+
* @default `.*`
|
|
118
|
+
*/
|
|
119
|
+
filter?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Indicates whether to save each component to a separate file.
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
separateFiles?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* The source space id.
|
|
127
|
+
*/
|
|
128
|
+
from?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Suffix to add to the component name.
|
|
131
|
+
*/
|
|
132
|
+
suffix?: string;
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
7
135
|
//#region src/commands/datasources/delete/constants.d.ts
|
|
8
136
|
/**
|
|
9
137
|
* Options for the datasources delete command.
|
|
@@ -19,6 +147,24 @@ interface DeleteDatasourceOptions {
|
|
|
19
147
|
force?: boolean;
|
|
20
148
|
}
|
|
21
149
|
//#endregion
|
|
150
|
+
//#region src/commands/migrations/generate/constants.d.ts
|
|
151
|
+
interface MigrationsGenerateOptions extends CommandOptions {
|
|
152
|
+
suffix?: string;
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/commands/migrations/run/constants.d.ts
|
|
156
|
+
interface MigrationsRunOptions extends CommandOptions {
|
|
157
|
+
dryRun?: boolean;
|
|
158
|
+
filter?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The source space id to read migration files from.
|
|
161
|
+
*/
|
|
162
|
+
from?: string;
|
|
163
|
+
query?: string;
|
|
164
|
+
startsWith?: string;
|
|
165
|
+
publish?: "all" | "published" | "published-with-changes";
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
22
168
|
//#region src/commands/migrations/rollback/types.d.ts
|
|
23
169
|
type MigrationsRollbackOptions = CommandOptions;
|
|
24
170
|
//#endregion
|
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -233,7 +233,13 @@ function createDefaultResolvedConfig() {
|
|
|
233
233
|
return structuredClone(BASE_GLOBAL_CONFIG);
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
236
|
+
//#region src/lib/config/types.ts
|
|
237
|
+
function defineConfig(config) {
|
|
238
|
+
return config;
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
236
241
|
//#region src/lib/config/loader.ts
|
|
242
|
+
const CONFIG_ENTRYPOINT_SPECIFIER = "storyblok/config";
|
|
237
243
|
/**
|
|
238
244
|
* Load configuration using c12
|
|
239
245
|
* This encapsulates the c12 dependency so it's only referenced within lib/config
|
|
@@ -248,7 +254,10 @@ async function loadConfig$1(options) {
|
|
|
248
254
|
globalRc: false,
|
|
249
255
|
dotenv: false,
|
|
250
256
|
packageJson: false,
|
|
251
|
-
jitiOptions: {
|
|
257
|
+
jitiOptions: {
|
|
258
|
+
tsconfigPaths: process.env.JITI_TSCONFIG_PATHS !== "false",
|
|
259
|
+
virtualModules: { [CONFIG_ENTRYPOINT_SPECIFIER]: { defineConfig } }
|
|
260
|
+
}
|
|
252
261
|
});
|
|
253
262
|
}
|
|
254
263
|
//#endregion
|
|
@@ -8325,17 +8334,34 @@ const multiassetFieldRefMapper = (data, options) => {
|
|
|
8325
8334
|
return data.map((d) => assetFieldRefMapper(d, options));
|
|
8326
8335
|
};
|
|
8327
8336
|
/**
|
|
8337
|
+
* An option field only holds a cross-space reference when its source is
|
|
8338
|
+
* `internal_stories`: the value is then a story uuid (or id, with `use_uuid`
|
|
8339
|
+
* off), which differs per space. Every other source is space-independent, so
|
|
8340
|
+
* remapping it would corrupt the value: `self` holds the inline option's own
|
|
8341
|
+
* `value`, `internal` and `external` hold a datasource entry's `value`, and
|
|
8342
|
+
* `internal_languages` holds a language code.
|
|
8343
|
+
*/
|
|
8344
|
+
const mapOptionValue = (value, schema, maps) => {
|
|
8345
|
+
if (!schema || !("source" in schema) || schema.source !== "internal_stories") return value;
|
|
8346
|
+
return maps.stories?.get(value) ?? value;
|
|
8347
|
+
};
|
|
8348
|
+
/**
|
|
8349
|
+
* Single option field reference mapper.
|
|
8350
|
+
*/
|
|
8351
|
+
const optionFieldRefMapper = (data, { schema, maps }) => mapOptionValue(data, schema, maps);
|
|
8352
|
+
/**
|
|
8328
8353
|
* Options field reference mapper.
|
|
8329
8354
|
*/
|
|
8330
8355
|
const optionsFieldRefMapper = (data, { schema, maps }) => {
|
|
8331
|
-
if (!
|
|
8332
|
-
return data.map((d) =>
|
|
8356
|
+
if (!Array.isArray(data)) return data;
|
|
8357
|
+
return data.map((d) => mapOptionValue(d, schema, maps));
|
|
8333
8358
|
};
|
|
8334
8359
|
const fieldRefMappers = {
|
|
8335
8360
|
asset: assetFieldRefMapper,
|
|
8336
8361
|
bloks: bloksFieldRefMapper,
|
|
8337
8362
|
multiasset: multiassetFieldRefMapper,
|
|
8338
8363
|
multilink: multilinkFieldRefMapper,
|
|
8364
|
+
option: optionFieldRefMapper,
|
|
8339
8365
|
options: optionsFieldRefMapper,
|
|
8340
8366
|
richtext: richtextFieldRefMapper
|
|
8341
8367
|
};
|