contentful-export 8.1.0-exo.1 → 8.1.1
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/index.js +4 -2
- package/dist/parseOptions.js +1 -1
- package/dist/tasks/get-space-data.js +2 -129
- package/dist/usageParams.js +4 -4
- package/package.json +4 -3
- package/types.d.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -76,11 +76,11 @@ function runContentfulExport(params) {
|
|
|
76
76
|
skipContentModel: options.skipContentModel,
|
|
77
77
|
skipEditorInterfaces: options.skipEditorInterfaces,
|
|
78
78
|
skipContent: options.skipContent,
|
|
79
|
+
skipAssets: options.skipAssets,
|
|
79
80
|
skipWebhooks: options.skipWebhooks,
|
|
80
81
|
skipRoles: options.skipRoles,
|
|
81
82
|
skipTags: options.skipTags,
|
|
82
83
|
stripTags: options.stripTags,
|
|
83
|
-
includeExperienceOrchestration: options.includeExperienceOrchestration,
|
|
84
84
|
listrOptions,
|
|
85
85
|
queryEntries: options.queryEntries,
|
|
86
86
|
queryAssets: options.queryAssets
|
|
@@ -113,7 +113,9 @@ function runContentfulExport(params) {
|
|
|
113
113
|
task: ctx => {
|
|
114
114
|
return _bfj.default.write(options.logFilePath, ctx.data, {
|
|
115
115
|
circular: 'ignore',
|
|
116
|
-
space: 2
|
|
116
|
+
space: 2,
|
|
117
|
+
bufferLength: 1024,
|
|
118
|
+
yieldRate: 16384
|
|
117
119
|
});
|
|
118
120
|
}
|
|
119
121
|
}]);
|
package/dist/parseOptions.js
CHANGED
|
@@ -26,11 +26,11 @@ function parseOptions(params) {
|
|
|
26
26
|
skipContentModel: false,
|
|
27
27
|
skipEditorInterfaces: false,
|
|
28
28
|
skipContent: false,
|
|
29
|
+
skipAssets: false,
|
|
29
30
|
skipWebhooks: false,
|
|
30
31
|
skipTags: false,
|
|
31
32
|
stripTags: false,
|
|
32
33
|
maxAllowedLimit: 1000,
|
|
33
|
-
includeExperienceOrchestration: false,
|
|
34
34
|
saveFile: true,
|
|
35
35
|
useVerboseRenderer: false,
|
|
36
36
|
rawProxy: false
|
|
@@ -23,6 +23,7 @@ function getFullSourceSpace({
|
|
|
23
23
|
environmentId = 'master',
|
|
24
24
|
skipContentModel,
|
|
25
25
|
skipContent,
|
|
26
|
+
skipAssets,
|
|
26
27
|
skipWebhooks,
|
|
27
28
|
skipRoles,
|
|
28
29
|
skipEditorInterfaces,
|
|
@@ -31,7 +32,6 @@ function getFullSourceSpace({
|
|
|
31
32
|
includeDrafts,
|
|
32
33
|
includeArchived,
|
|
33
34
|
maxAllowedLimit,
|
|
34
|
-
includeExperienceOrchestration,
|
|
35
35
|
listrOptions,
|
|
36
36
|
queryEntries,
|
|
37
37
|
queryAssets
|
|
@@ -115,7 +115,7 @@ function getFullSourceSpace({
|
|
|
115
115
|
ctx.data.assets = items;
|
|
116
116
|
});
|
|
117
117
|
}),
|
|
118
|
-
skip: () => skipContent
|
|
118
|
+
skip: () => skipContent || skipAssets
|
|
119
119
|
}, {
|
|
120
120
|
title: 'Fetching locales data',
|
|
121
121
|
task: (0, _contentfulBatchLibs.wrapTask)(ctx => {
|
|
@@ -149,102 +149,6 @@ function getFullSourceSpace({
|
|
|
149
149
|
});
|
|
150
150
|
}),
|
|
151
151
|
skip: () => skipRoles || environmentId !== 'master' && 'Roles can only be exported from master environment'
|
|
152
|
-
}, {
|
|
153
|
-
title: 'Fetching Design Tokens data',
|
|
154
|
-
task: (0, _contentfulBatchLibs.wrapTask)(async ctx => {
|
|
155
|
-
try {
|
|
156
|
-
ctx.data.designTokens = await cursorPagedGet({
|
|
157
|
-
client,
|
|
158
|
-
spaceId,
|
|
159
|
-
environmentId,
|
|
160
|
-
method: 'designToken.getMany'
|
|
161
|
-
});
|
|
162
|
-
} catch (err) {
|
|
163
|
-
_contentfulBatchLibs.logEmitter.emit('warning', `Skipping Design Tokens export: ${err.message}`);
|
|
164
|
-
ctx.data.designTokens = [];
|
|
165
|
-
}
|
|
166
|
-
}),
|
|
167
|
-
skip: () => !includeExperienceOrchestration
|
|
168
|
-
}, {
|
|
169
|
-
title: 'Fetching Component Types data',
|
|
170
|
-
task: (0, _contentfulBatchLibs.wrapTask)(async ctx => {
|
|
171
|
-
try {
|
|
172
|
-
ctx.data.componentTypes = await cursorPagedGet({
|
|
173
|
-
client,
|
|
174
|
-
spaceId,
|
|
175
|
-
environmentId,
|
|
176
|
-
method: 'componentType.getMany'
|
|
177
|
-
});
|
|
178
|
-
} catch (err) {
|
|
179
|
-
_contentfulBatchLibs.logEmitter.emit('warning', `Skipping Component Types export: ${err.message}`);
|
|
180
|
-
ctx.data.componentTypes = [];
|
|
181
|
-
}
|
|
182
|
-
}),
|
|
183
|
-
skip: () => !includeExperienceOrchestration
|
|
184
|
-
}, {
|
|
185
|
-
title: 'Fetching Templates data',
|
|
186
|
-
task: (0, _contentfulBatchLibs.wrapTask)(async ctx => {
|
|
187
|
-
try {
|
|
188
|
-
ctx.data.templates = await cursorPagedGet({
|
|
189
|
-
client,
|
|
190
|
-
spaceId,
|
|
191
|
-
environmentId,
|
|
192
|
-
method: 'template.getMany'
|
|
193
|
-
});
|
|
194
|
-
} catch (err) {
|
|
195
|
-
_contentfulBatchLibs.logEmitter.emit('warning', `Skipping Templates export: ${err.message}`);
|
|
196
|
-
ctx.data.templates = [];
|
|
197
|
-
}
|
|
198
|
-
}),
|
|
199
|
-
skip: () => !includeExperienceOrchestration
|
|
200
|
-
}, {
|
|
201
|
-
title: 'Fetching Data Assemblies data',
|
|
202
|
-
task: (0, _contentfulBatchLibs.wrapTask)(async ctx => {
|
|
203
|
-
try {
|
|
204
|
-
ctx.data.dataAssemblies = await cursorPagedGet({
|
|
205
|
-
client,
|
|
206
|
-
spaceId,
|
|
207
|
-
environmentId,
|
|
208
|
-
method: 'dataAssembly.getMany'
|
|
209
|
-
});
|
|
210
|
-
} catch (err) {
|
|
211
|
-
_contentfulBatchLibs.logEmitter.emit('warning', `Skipping Data Assemblies export: ${err.message}`);
|
|
212
|
-
ctx.data.dataAssemblies = [];
|
|
213
|
-
}
|
|
214
|
-
}),
|
|
215
|
-
skip: () => !includeExperienceOrchestration
|
|
216
|
-
}, {
|
|
217
|
-
title: 'Fetching Fragments data',
|
|
218
|
-
task: (0, _contentfulBatchLibs.wrapTask)(async ctx => {
|
|
219
|
-
try {
|
|
220
|
-
ctx.data.fragments = await cursorPagedGet({
|
|
221
|
-
client,
|
|
222
|
-
spaceId,
|
|
223
|
-
environmentId,
|
|
224
|
-
method: 'fragment.getMany'
|
|
225
|
-
});
|
|
226
|
-
} catch (err) {
|
|
227
|
-
_contentfulBatchLibs.logEmitter.emit('warning', `Skipping Fragments export: ${err.message}`);
|
|
228
|
-
ctx.data.fragments = [];
|
|
229
|
-
}
|
|
230
|
-
}),
|
|
231
|
-
skip: () => !includeExperienceOrchestration
|
|
232
|
-
}, {
|
|
233
|
-
title: 'Fetching Experiences data',
|
|
234
|
-
task: (0, _contentfulBatchLibs.wrapTask)(async ctx => {
|
|
235
|
-
try {
|
|
236
|
-
ctx.data.experiences = await cursorPagedGet({
|
|
237
|
-
client,
|
|
238
|
-
spaceId,
|
|
239
|
-
environmentId,
|
|
240
|
-
method: 'experience.getMany'
|
|
241
|
-
});
|
|
242
|
-
} catch (err) {
|
|
243
|
-
_contentfulBatchLibs.logEmitter.emit('warning', `Skipping Experiences export: ${err.message}`);
|
|
244
|
-
ctx.data.experiences = [];
|
|
245
|
-
}
|
|
246
|
-
}),
|
|
247
|
-
skip: () => !includeExperienceOrchestration
|
|
248
152
|
}], listrOptions);
|
|
249
153
|
}
|
|
250
154
|
function getEditorInterfaces(contentTypes) {
|
|
@@ -263,37 +167,6 @@ function getEditorInterfaces(contentTypes) {
|
|
|
263
167
|
});
|
|
264
168
|
}
|
|
265
169
|
|
|
266
|
-
/**
|
|
267
|
-
* Gets all ExO entities using cursor-based pagination (pageNext/pagePrev tokens).
|
|
268
|
-
* ExO list endpoints do not support skip-based pagination or the order param.
|
|
269
|
-
*/
|
|
270
|
-
async function cursorPagedGet({
|
|
271
|
-
client,
|
|
272
|
-
spaceId,
|
|
273
|
-
environmentId,
|
|
274
|
-
method
|
|
275
|
-
}) {
|
|
276
|
-
const [entity, operation] = method.split('.');
|
|
277
|
-
const allItems = [];
|
|
278
|
-
let pageNext = null;
|
|
279
|
-
do {
|
|
280
|
-
var _response$pages$next, _response$pages;
|
|
281
|
-
const query = {
|
|
282
|
-
spaceId,
|
|
283
|
-
environmentId,
|
|
284
|
-
limit: pageLimit
|
|
285
|
-
};
|
|
286
|
-
if (pageNext) {
|
|
287
|
-
query.pageNext = pageNext;
|
|
288
|
-
}
|
|
289
|
-
const response = await client[entity][operation](query);
|
|
290
|
-
allItems.push(...response.items);
|
|
291
|
-
_contentfulBatchLibs.logEmitter.emit('info', `Fetched ${allItems.length} ${entity} items`);
|
|
292
|
-
pageNext = (_response$pages$next = (_response$pages = response.pages) === null || _response$pages === void 0 ? void 0 : _response$pages.next) !== null && _response$pages$next !== void 0 ? _response$pages$next : null;
|
|
293
|
-
} while (pageNext);
|
|
294
|
-
return allItems;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
170
|
/**
|
|
298
171
|
* Gets all the existing entities based on pagination parameters.
|
|
299
172
|
* The first call will have no aggregated response. Subsequent calls will
|
package/dist/usageParams.js
CHANGED
|
@@ -41,6 +41,10 @@ var _default = exports.default = _yargs.default.version(_package.default.version
|
|
|
41
41
|
describe: 'Skip exporting assets and entries',
|
|
42
42
|
type: 'boolean',
|
|
43
43
|
default: false
|
|
44
|
+
}).option('skip-assets', {
|
|
45
|
+
describe: 'Skip exporting assets',
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
default: false
|
|
44
48
|
}).option('skip-roles', {
|
|
45
49
|
describe: 'Skip exporting roles and permissions',
|
|
46
50
|
type: 'boolean',
|
|
@@ -103,10 +107,6 @@ var _default = exports.default = _yargs.default.version(_package.default.version
|
|
|
103
107
|
describe: 'Display progress in new lines instead of displaying a busy spinner and the status in the same line. Useful for CI.',
|
|
104
108
|
type: 'boolean',
|
|
105
109
|
default: false
|
|
106
|
-
}).option('include-experience-orchestration', {
|
|
107
|
-
describe: 'Include Experience Orchestration entities (Component Types, Templates, Data Assemblies, Fragments, Experiences, Design Tokens). Requires exo_m1 entitlement on the source space.',
|
|
108
|
-
type: 'boolean',
|
|
109
|
-
default: false
|
|
110
110
|
}).option('header', {
|
|
111
111
|
alias: 'H',
|
|
112
112
|
type: 'string',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentful-export",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "this tool allows you to export a space to a JSON dump",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "types.d.ts",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"prerelease": true
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
|
-
"name": "
|
|
114
|
+
"name": "exo",
|
|
115
115
|
"channel": "exo",
|
|
116
116
|
"prerelease": "exo"
|
|
117
117
|
}
|
|
@@ -144,6 +144,7 @@
|
|
|
144
144
|
]
|
|
145
145
|
},
|
|
146
146
|
"overrides": {
|
|
147
|
-
"cross-spawn": "^7.0.6"
|
|
147
|
+
"cross-spawn": "^7.0.6",
|
|
148
|
+
"undici": "^6.27.0"
|
|
148
149
|
}
|
|
149
150
|
}
|
package/types.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface Options {
|
|
|
21
21
|
queryAssets?: string[];
|
|
22
22
|
rawProxy?: boolean;
|
|
23
23
|
saveFile?: boolean;
|
|
24
|
+
skipAssets?: boolean;
|
|
24
25
|
skipContent?: boolean;
|
|
25
26
|
skipContentModel?: boolean;
|
|
26
27
|
skipEditorInterfaces?: boolean;
|
|
@@ -28,10 +29,9 @@ export interface Options {
|
|
|
28
29
|
skipWebhooks?: boolean;
|
|
29
30
|
skipTags?: boolean;
|
|
30
31
|
useVerboseRenderer?: boolean;
|
|
31
|
-
includeExperienceOrchestration?: boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
type ContentfulExportField = 'contentTypes' | 'entries' | 'assets' | 'locales' | 'tags' | 'webhooks' | 'roles' | 'editorInterfaces'
|
|
34
|
+
type ContentfulExportField = 'contentTypes' | 'entries' | 'assets' | 'locales' | 'tags' | 'webhooks' | 'roles' | 'editorInterfaces';
|
|
35
35
|
|
|
36
36
|
declare const runContentfulExport: (params: Options) => Promise<Record<ContentfulExportField, unknown[]>>
|
|
37
37
|
export default runContentfulExport
|