contentful-migration
Advanced tools
Comparing version 4.8.0 to 4.8.1
@@ -73,8 +73,4 @@ "use strict"; | ||
const makeBaseUrl = (url) => { | ||
const parts = [ | ||
'spaces', spaceId, | ||
'environments', environmentId, | ||
(0, trim_1.default)(url, '/') | ||
]; | ||
return parts.filter(x => x !== '').join('/'); | ||
const parts = ['spaces', spaceId, 'environments', environmentId, (0, trim_1.default)(url, '/')]; | ||
return parts.filter((x) => x !== '').join('/'); | ||
}; | ||
@@ -138,3 +134,5 @@ return function makeRequest(requestConfig) { | ||
} | ||
const migrationName = argv.migrationFunction ? argv.migrationFunction.name : path.basename(argv.filePath, '.js'); | ||
const migrationName = argv.migrationFunction | ||
? argv.migrationFunction.name | ||
: path.basename(argv.filePath, '.js'); | ||
const errorsFile = path.join(process.cwd(), `errors-${migrationName}-${Date.now()}.log`); | ||
@@ -205,7 +203,9 @@ const batches = parseResult.batches; | ||
} | ||
return inquirer.prompt([{ | ||
return inquirer.prompt([ | ||
{ | ||
type: 'confirm', | ||
message: 'Do you want to apply the migration', | ||
name: 'applyMigration' | ||
}]); | ||
} | ||
]); | ||
}; | ||
@@ -215,3 +215,3 @@ const answers = await confirm({ skipConfirmation: argv.yes }); | ||
try { | ||
const successfulMigration = await (new listr2_1.Listr(tasks)).run(); | ||
const successfulMigration = await new listr2_1.Listr(tasks).run(); | ||
console.log((0, chalk_1.default) `🎉 {bold.green Migration successful}`); | ||
@@ -218,0 +218,0 @@ return successfulMigration; |
@@ -31,5 +31,5 @@ "use strict"; | ||
// Lines start at 1, arrays at 0 | ||
const line = (lineNumber - 1); | ||
const firstLine = (line > context) ? (line - context) : 0; | ||
const lastLine = (line + context) < lines.length ? line + context : lines.length; | ||
const line = lineNumber - 1; | ||
const firstLine = line > context ? line - context : 0; | ||
const lastLine = line + context < lines.length ? line + context : lines.length; | ||
return { | ||
@@ -52,3 +52,4 @@ before: lines.slice(firstLine, line), | ||
const fileErrorsMessage = (0, chalk_1.default) `{red Errors in ${file}}\n\n`; | ||
const errorMessages = errorsByFile[file].map((error) => { | ||
const errorMessages = errorsByFile[file] | ||
.map((error) => { | ||
const intent = error.details.intent; | ||
@@ -63,3 +64,4 @@ const callsite = intent.toRaw().meta.callsite; | ||
return (0, chalk_1.default) `{red Line ${String(callsite.line)}:} {bold ${error.message}}\n${formattedCode}`; | ||
}).join('\n'); | ||
}) | ||
.join('\n'); | ||
messages.push(`${fileErrorsMessage}${errorMessages}`); | ||
@@ -66,0 +68,0 @@ } |
@@ -41,3 +41,4 @@ "use strict"; | ||
describe: 'ID of the space to run the migration script on' | ||
}).option('environment-id', { | ||
}) | ||
.option('environment-id', { | ||
alias: 'e', | ||
@@ -88,4 +89,3 @@ describe: 'ID of the environment within the space to run the migration script on', | ||
.example('contentful-migration', '--space-id abcedef my-migration.js') | ||
.strict() | ||
.argv; | ||
.strict().argv; | ||
//# sourceMappingURL=usage-params.js.map |
@@ -39,3 +39,5 @@ "use strict"; | ||
this.identityKey = entryDerivation.identityKey; | ||
this.shouldPublish = (0, is_defined_1.default)(entryDerivation.shouldPublish) ? entryDerivation.shouldPublish : true; | ||
this.shouldPublish = (0, is_defined_1.default)(entryDerivation.shouldPublish) | ||
? entryDerivation.shouldPublish | ||
: true; | ||
} | ||
@@ -110,3 +112,3 @@ async applyTo(api) { | ||
}; | ||
const fieldValue = (field.type === 'Array') ? [{ sys }] : { sys }; | ||
const fieldValue = field.type === 'Array' ? [{ sys }] : { sys }; | ||
entry.setFieldForLocale(this.referenceField, locale, fieldValue); | ||
@@ -113,0 +115,0 @@ } |
@@ -103,3 +103,5 @@ "use strict"; | ||
if (!link.isInArray()) { | ||
link.element.setFieldForLocale(link.field, link.locale, { sys: { id: newEntryId, type: 'Link', linkType: 'Entry' } }); | ||
link.element.setFieldForLocale(link.field, link.locale, { | ||
sys: { id: newEntryId, type: 'Link', linkType: 'Entry' } | ||
}); | ||
} | ||
@@ -106,0 +108,0 @@ else { |
@@ -133,7 +133,7 @@ "use strict"; | ||
this._sidebar = Array.isArray(this._sidebar) ? this._sidebar : [].concat(sidebarwidget_1.DEFAULT_SIDEBAR_LIST); | ||
const isDuplicateWidget = this._sidebar.find(widget => widget.widgetId === widgetId && widget.widgetNamespace === widgetNamespace); | ||
const isDuplicateWidget = this._sidebar.find((widget) => widget.widgetId === widgetId && widget.widgetNamespace === widgetNamespace); | ||
if (isDuplicateWidget) { | ||
return; | ||
} | ||
const nextWidgetIndex = this._sidebar.map(w => w.widgetId).indexOf(insertBeforeWidgetId); | ||
const nextWidgetIndex = this._sidebar.map((w) => w.widgetId).indexOf(insertBeforeWidgetId); | ||
const newWidget = { | ||
@@ -154,3 +154,3 @@ disabled, | ||
this._sidebar = Array.isArray(this._sidebar) ? this._sidebar : [].concat(sidebarwidget_1.DEFAULT_SIDEBAR_LIST); | ||
const existingWidget = this._sidebar.find(widget => widget.widgetId === widgetId && widget.widgetNamespace === widgetNamespace); | ||
const existingWidget = this._sidebar.find((widget) => widget.widgetId === widgetId && widget.widgetNamespace === widgetNamespace); | ||
if (!existingWidget) { | ||
@@ -163,8 +163,10 @@ return; | ||
removeSidebarWidget(widgetId, widgetNamespace) { | ||
const currentSidebarWidgets = Array.isArray(this._sidebar) ? this._sidebar : [].concat(sidebarwidget_1.DEFAULT_SIDEBAR_LIST); | ||
const widgetToDisable = currentSidebarWidgets.find(widget => widget.widgetId === widgetId && widget.widgetNamespace === widgetNamespace); | ||
const currentSidebarWidgets = Array.isArray(this._sidebar) | ||
? this._sidebar | ||
: [].concat(sidebarwidget_1.DEFAULT_SIDEBAR_LIST); | ||
const widgetToDisable = currentSidebarWidgets.find((widget) => widget.widgetId === widgetId && widget.widgetNamespace === widgetNamespace); | ||
if (!widgetToDisable) { | ||
return; | ||
} | ||
this._sidebar = currentSidebarWidgets.filter(widget => widget.widgetId !== widgetId || widget.widgetNamespace !== widgetNamespace); | ||
this._sidebar = currentSidebarWidgets.filter((widget) => widget.widgetId !== widgetId || widget.widgetNamespace !== widgetNamespace); | ||
} | ||
@@ -171,0 +173,0 @@ resetSidebarToDefault() { |
@@ -36,7 +36,7 @@ "use strict"; | ||
.getIntents() | ||
.filter(intent => intent.isContentTransform() || | ||
.filter((intent) => intent.isContentTransform() || | ||
intent.isEntryDerive() || | ||
intent.isEntryTransformToType() || | ||
intent.isEntrySetTags()) | ||
.map(intent => intent.getContentTypeId())); | ||
.map((intent) => intent.getContentTypeId())); | ||
if (!loadAllEntries && ids.length === 0) { | ||
@@ -61,4 +61,5 @@ return []; | ||
// Also excluding tags here as they are independent of cts. | ||
const ids = _.uniq(intentList.getIntents() | ||
.filter((intent) => (!intent.isEditorInterfaceIntent() && !intent.isTagIntent())) | ||
const ids = _.uniq(intentList | ||
.getIntents() | ||
.filter((intent) => !intent.isEditorInterfaceIntent() && !intent.isTagIntent()) | ||
.reduce((ids, intent) => { | ||
@@ -78,5 +79,5 @@ const intentIds = intent.getRelatedContentTypeIds(); | ||
async getEditorInterfacesInIntents(intentList) { | ||
const contentTypeIds = _.uniq(intentList.getIntents() | ||
.filter((intent) => intent.isFieldRename() || | ||
intent.isEditorInterfaceIntent()) | ||
const contentTypeIds = _.uniq(intentList | ||
.getIntents() | ||
.filter((intent) => intent.isFieldRename() || intent.isEditorInterfaceIntent()) | ||
.reduce((ids, intent) => { | ||
@@ -100,3 +101,4 @@ const intentIds = intent.getRelatedContentTypeIds(); | ||
async checkContentTypesForDeletedCts(intentList, contentTypes) { | ||
const deletedCtIds = new Set(intentList.getIntents() | ||
const deletedCtIds = new Set(intentList | ||
.getIntents() | ||
.filter((intent) => intent.isContentTypeDelete()) | ||
@@ -123,5 +125,3 @@ .map((intent) => intent.getContentTypeId())); | ||
// Don't fetch tags if migration does not use any. | ||
if (!intentList | ||
.getIntents() | ||
.some((intent) => intent.requiresAllTags())) { | ||
if (!intentList.getIntents().some((intent) => intent.requiresAllTags())) { | ||
return []; | ||
@@ -141,3 +141,4 @@ } | ||
catch (error) { | ||
if (error.name === 'NotFound') { // TODO: expose status codes and use that instead. | ||
if (error.name === 'NotFound') { | ||
// TODO: expose status codes and use that instead. | ||
// Initialize a default structure for newly created content types. | ||
@@ -144,0 +145,0 @@ editorInterfaces.set(id, { |
@@ -43,3 +43,5 @@ "use strict"; | ||
for (const intent of this.intents) { | ||
const lastComposableIntent = composableIntents.length ? composableIntents[composableIntents.length - 1] : null; | ||
const lastComposableIntent = composableIntents.length | ||
? composableIntents[composableIntents.length - 1] | ||
: null; | ||
if (lastComposableIntent === null || intent.groupsWith(lastComposableIntent)) { | ||
@@ -46,0 +48,0 @@ composableIntents.push(intent); |
@@ -74,4 +74,4 @@ "use strict"; | ||
const actualType = (0, kind_of_1.default)(valueToValidate); | ||
const message = expectedType === 'alternatives' ? | ||
validationErrors.INVALID_VALUE_IN_ALTERNATIVES(propName, displayName, valueToValidate, error.details[0].context.types) | ||
const message = expectedType === 'alternatives' | ||
? validationErrors.INVALID_VALUE_IN_ALTERNATIVES(propName, displayName, valueToValidate, error.details[0].context.types) | ||
: validationErrors.INVALID_PROPERTY_TYPE(propName, displayName, actualType, expectedType); | ||
@@ -78,0 +78,0 @@ errors.push({ |
@@ -73,5 +73,3 @@ "use strict"; | ||
isAboutContentType() { | ||
return (this.isContentTypeUpdate() || | ||
this.isContentTypeCreate() || | ||
this.isContentTypeDelete()); | ||
return this.isContentTypeUpdate() || this.isContentTypeCreate() || this.isContentTypeDelete(); | ||
} | ||
@@ -78,0 +76,0 @@ isAboutField() { |
@@ -95,3 +95,3 @@ "use strict"; | ||
requiresAllTags() { | ||
return this.intents.some(intent => intent.requiresAllTags()); | ||
return this.intents.some((intent) => intent.requiresAllTags()); | ||
} | ||
@@ -108,6 +108,6 @@ groupsWith() { | ||
shouldSave() { | ||
return this.intents.some(intent => intent.shouldSave()); | ||
return this.intents.some((intent) => intent.shouldSave()); | ||
} | ||
shouldPublish() { | ||
return this.intents.some(intent => intent.shouldPublish()); | ||
return this.intents.some((intent) => intent.shouldPublish()); | ||
} | ||
@@ -120,3 +120,3 @@ isComposedIntent() { | ||
// intents are not a mix of ct intents and tag intents? | ||
return this.intents.some(intent => intent.isTagIntent()); | ||
return this.intents.some((intent) => intent.isTagIntent()); | ||
} | ||
@@ -168,3 +168,3 @@ getTagId() { | ||
.filter((intent) => intent.isSidebarUpdate()) | ||
.map(i => i.toPlanMessage().sections)); | ||
.map((i) => i.toPlanMessage().sections)); | ||
let createSections = []; | ||
@@ -171,0 +171,0 @@ for (const editorInterfaceIntent of editorInterfaceUpdates) { |
@@ -20,5 +20,3 @@ "use strict"; | ||
toActions() { | ||
return [ | ||
new content_type_create_1.ContentTypeCreateAction(this.getContentTypeId()) | ||
]; | ||
return [new content_type_create_1.ContentTypeCreateAction(this.getContentTypeId())]; | ||
} | ||
@@ -25,0 +23,0 @@ toPlanMessage() { |
@@ -16,7 +16,8 @@ "use strict"; | ||
const sameContentType = other.getContentTypeId() === this.getContentTypeId(); | ||
return (other.isContentTypeUpdate() || | ||
return ((other.isContentTypeUpdate() || | ||
other.isContentTypeCreate() || | ||
other.isFieldCreate() || | ||
other.isFieldUpdate() || | ||
other.isFieldMove()) && sameContentType; | ||
other.isFieldMove()) && | ||
sameContentType); | ||
} | ||
@@ -27,5 +28,3 @@ endsGroup() { | ||
toActions() { | ||
return [ | ||
new content_type_update_1.ContentTypeUpdateAction(this.getContentTypeId(), this.payload.props) | ||
]; | ||
return [new content_type_update_1.ContentTypeUpdateAction(this.getContentTypeId(), this.payload.props)]; | ||
} | ||
@@ -32,0 +31,0 @@ toPlanMessage() { |
@@ -18,5 +18,3 @@ "use strict"; | ||
groupsWith(other) { | ||
return other.isGroupable() | ||
&& other.isEditorInterfaceIntent() | ||
&& this.isSameContentType(other); | ||
return other.isGroupable() && other.isEditorInterfaceIntent() && this.isSameContentType(other); | ||
} | ||
@@ -23,0 +21,0 @@ endsGroup() { |
@@ -18,5 +18,3 @@ "use strict"; | ||
groupsWith(other) { | ||
return other.isGroupable() | ||
&& other.isEditorInterfaceIntent() | ||
&& this.isSameContentType(other); | ||
return other.isGroupable() && other.isEditorInterfaceIntent() && this.isSameContentType(other); | ||
} | ||
@@ -23,0 +21,0 @@ endsGroup() { |
@@ -21,5 +21,3 @@ "use strict"; | ||
groupsWith(other) { | ||
return other.isGroupable() | ||
&& other.isEditorInterfaceIntent() | ||
&& this.isSameContentType(other); | ||
return other.isGroupable() && other.isEditorInterfaceIntent() && this.isSameContentType(other); | ||
} | ||
@@ -43,9 +41,7 @@ endsGroup() { | ||
const { widgetId, fieldId, settings, widgetNamespace } = this.payload.editorInterface; | ||
let createDetails = [ | ||
(0, chalk_1.default) `{italic widgetId}: "${widgetId}"` | ||
]; | ||
let createDetails = [(0, chalk_1.default) `{italic widgetId}: "${widgetId}"`]; | ||
if (widgetNamespace) { | ||
createDetails = [...createDetails, (0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"`]; | ||
} | ||
Object.keys(settings).forEach(settingName => createDetails.push((0, chalk_1.default) `{italic ${settingName}}: "${settings[settingName].toString()}"`)); | ||
Object.keys(settings).forEach((settingName) => createDetails.push((0, chalk_1.default) `{italic ${settingName}}: "${settings[settingName].toString()}"`)); | ||
return { | ||
@@ -52,0 +48,0 @@ heading: (0, chalk_1.default) `Update field controls for Content Type {bold.yellow ${this.getContentTypeId()}}`, |
@@ -11,6 +11,3 @@ "use strict"; | ||
getRelatedContentTypeIds() { | ||
return [ | ||
this.getContentTypeId(), | ||
this.payload.derivation.derivedContentType | ||
]; | ||
return [this.getContentTypeId(), this.payload.derivation.derivedContentType]; | ||
} | ||
@@ -30,5 +27,3 @@ isEntryDerive() { | ||
toActions() { | ||
return [ | ||
new entry_derive_1.EntryDeriveAction(this.getContentTypeId(), this.payload.derivation) | ||
]; | ||
return [new entry_derive_1.EntryDeriveAction(this.getContentTypeId(), this.payload.derivation)]; | ||
} | ||
@@ -35,0 +30,0 @@ toPlanMessage() { |
@@ -30,5 +30,3 @@ "use strict"; | ||
heading: (0, chalk_1.default) `Updating tags on entries for {bold.yellow ${this.getContentTypeId()}}`, | ||
details: [ | ||
`from: ${this.payload.entryTransformationForTags.from}` | ||
], | ||
details: [`from: ${this.payload.entryTransformationForTags.from}`], | ||
sections: [] | ||
@@ -35,0 +33,0 @@ }; |
@@ -11,5 +11,3 @@ "use strict"; | ||
getRelatedContentTypeIds() { | ||
return [ | ||
this.payload.entryTransformationToType.sourceContentType | ||
]; | ||
return [this.payload.entryTransformationToType.sourceContentType]; | ||
} | ||
@@ -29,5 +27,3 @@ isEntryTransformToType() { | ||
toActions() { | ||
return [ | ||
new entry_transform_to_type_1.EntryTransformToTypeAction(this.payload.entryTransformationToType) | ||
]; | ||
return [new entry_transform_to_type_1.EntryTransformToTypeAction(this.payload.entryTransformationToType)]; | ||
} | ||
@@ -34,0 +30,0 @@ toPlanMessage() { |
@@ -15,7 +15,8 @@ "use strict"; | ||
const sameContentType = other.getContentTypeId() === this.getContentTypeId(); | ||
return (other.isContentTypeUpdate() || | ||
return ((other.isContentTypeUpdate() || | ||
other.isContentTypeCreate() || | ||
other.isFieldCreate() || | ||
other.isFieldUpdate() || | ||
other.isFieldMove()) && sameContentType; | ||
other.isFieldMove()) && | ||
sameContentType); | ||
} | ||
@@ -26,5 +27,3 @@ endsGroup() { | ||
toActions() { | ||
return [ | ||
new field_create_1.FieldCreateAction(this.getContentTypeId(), this.payload.fieldId) | ||
]; | ||
return [new field_create_1.FieldCreateAction(this.getContentTypeId(), this.payload.fieldId)]; | ||
} | ||
@@ -34,6 +33,8 @@ toPlanMessage() { | ||
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`, | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `Create field {yellow ${this.getFieldId()}}`, | ||
details: [] | ||
}], | ||
} | ||
], | ||
details: [] | ||
@@ -40,0 +41,0 @@ }; |
@@ -38,6 +38,8 @@ "use strict"; | ||
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`, | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `Delete field {yellow ${this.getFieldId()}}`, | ||
details: [] | ||
}], | ||
} | ||
], | ||
details: [] | ||
@@ -44,0 +46,0 @@ }; |
@@ -15,7 +15,8 @@ "use strict"; | ||
const sameContentType = other.getContentTypeId() === this.getContentTypeId(); | ||
return (other.isContentTypeUpdate() || | ||
return ((other.isContentTypeUpdate() || | ||
other.isContentTypeCreate() || | ||
other.isFieldCreate() || | ||
other.isFieldUpdate() || | ||
other.isFieldMove()) && sameContentType; | ||
other.isFieldMove()) && | ||
sameContentType); | ||
} | ||
@@ -35,3 +36,5 @@ endsGroup() { | ||
toActions() { | ||
return [new field_move_1.FieldMoveAction(this.getContentTypeId(), this.getFieldId(), this.getDirection(), this.getPivotId())]; | ||
return [ | ||
new field_move_1.FieldMoveAction(this.getContentTypeId(), this.getFieldId(), this.getDirection(), this.getPivotId()) | ||
]; | ||
} | ||
@@ -56,6 +59,8 @@ toPlanMessage() { | ||
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`, | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `{bold Move field {yellow ${this.getFieldId()}} ${humanizedMovement}}`, | ||
details: [] | ||
}], | ||
} | ||
], | ||
details: [] | ||
@@ -62,0 +67,0 @@ }; |
@@ -51,6 +51,8 @@ "use strict"; | ||
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`, | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `Rename field {yellow ${this.getFieldId()}} to {yellow ${this.getNewId()}}`, | ||
details: [] | ||
}], | ||
} | ||
], | ||
details: [] | ||
@@ -57,0 +59,0 @@ }; |
@@ -16,7 +16,8 @@ "use strict"; | ||
const sameContentType = other.getContentTypeId() === this.getContentTypeId(); | ||
return (other.isContentTypeUpdate() || | ||
return ((other.isContentTypeUpdate() || | ||
other.isContentTypeCreate() || | ||
other.isFieldCreate() || | ||
other.isFieldUpdate() || | ||
other.isFieldMove()) && sameContentType; | ||
other.isFieldMove()) && | ||
sameContentType); | ||
} | ||
@@ -37,6 +38,8 @@ endsGroup() { | ||
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`, | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `Update field {yellow ${this.getFieldId()}}`, | ||
details | ||
}], | ||
} | ||
], | ||
details: [] | ||
@@ -43,0 +46,0 @@ }; |
@@ -21,5 +21,3 @@ "use strict"; | ||
groupsWith(other) { | ||
return other.isGroupable() | ||
&& other.isEditorInterfaceIntent() | ||
&& this.isSameContentType(other); | ||
return other.isGroupable() && other.isEditorInterfaceIntent() && this.isSameContentType(other); | ||
} | ||
@@ -43,14 +41,13 @@ endsGroup() { | ||
const { settings, widgetId, widgetNamespace } = this.payload.sidebarWidget; | ||
const settingDetails = Object.keys(settings).map(settingName => (0, chalk_1.default) `{italic ${settingName}}: "${settings[settingName].toString()}"`); | ||
const createDetails = [ | ||
(0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"`, | ||
...settingDetails | ||
]; | ||
const settingDetails = Object.keys(settings).map((settingName) => (0, chalk_1.default) `{italic ${settingName}}: "${settings[settingName].toString()}"`); | ||
const createDetails = [(0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"`, ...settingDetails]; | ||
return { | ||
heading: (0, chalk_1.default) `Update sidebar for Content Type {bold.yellow ${this.getContentTypeId()}}`, | ||
details: [], | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `Add sidebar widget {yellow ${widgetId}}`, | ||
details: createDetails | ||
}] | ||
} | ||
] | ||
}; | ||
@@ -57,0 +54,0 @@ } |
@@ -21,5 +21,3 @@ "use strict"; | ||
groupsWith(other) { | ||
return other.isGroupable() | ||
&& other.isEditorInterfaceIntent() | ||
&& this.isSameContentType(other); | ||
return other.isGroupable() && other.isEditorInterfaceIntent() && this.isSameContentType(other); | ||
} | ||
@@ -46,8 +44,8 @@ endsGroup() { | ||
details: [], | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `Remove sidebar widget {yellow ${widgetId}}`, | ||
details: [ | ||
(0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"` | ||
] | ||
}] | ||
details: [(0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"`] | ||
} | ||
] | ||
}; | ||
@@ -54,0 +52,0 @@ } |
@@ -21,5 +21,3 @@ "use strict"; | ||
groupsWith(other) { | ||
return other.isGroupable() | ||
&& other.isEditorInterfaceIntent() | ||
&& this.isSameContentType(other); | ||
return other.isGroupable() && other.isEditorInterfaceIntent() && this.isSameContentType(other); | ||
} | ||
@@ -43,14 +41,13 @@ endsGroup() { | ||
const { settings, widgetId, widgetNamespace } = this.payload.sidebarWidget; | ||
const settingDetails = Object.keys(settings || {}).map(settingName => (0, chalk_1.default) `{italic ${settingName}}: "${settings[settingName].toString()}"`); | ||
const updateDetails = [ | ||
(0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"`, | ||
...settingDetails | ||
]; | ||
const settingDetails = Object.keys(settings || {}).map((settingName) => (0, chalk_1.default) `{italic ${settingName}}: "${settings[settingName].toString()}"`); | ||
const updateDetails = [(0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"`, ...settingDetails]; | ||
return { | ||
heading: (0, chalk_1.default) `Update editor interface for Content Type {bold.yellow ${this.getContentTypeId()}}`, | ||
details: [], | ||
sections: [{ | ||
sections: [ | ||
{ | ||
heading: (0, chalk_1.default) `Update sidebar widget {yellow ${widgetId}}`, | ||
details: updateDetails | ||
}] | ||
} | ||
] | ||
}; | ||
@@ -57,0 +54,0 @@ } |
@@ -35,5 +35,3 @@ "use strict"; | ||
toActions() { | ||
return [ | ||
new tag_create_1.TagCreateAction(this.getTagId(), this.getTagVisibility()) | ||
]; | ||
return [new tag_create_1.TagCreateAction(this.getTagId(), this.getTagVisibility())]; | ||
} | ||
@@ -40,0 +38,0 @@ toPlanMessage() { |
@@ -36,5 +36,3 @@ "use strict"; | ||
toActions() { | ||
return [ | ||
new tag_delete_1.TagDeleteAction(this.getTagId()) | ||
]; | ||
return [new tag_delete_1.TagDeleteAction(this.getTagId())]; | ||
} | ||
@@ -41,0 +39,0 @@ toPlanMessage() { |
@@ -34,5 +34,3 @@ "use strict"; | ||
toActions() { | ||
return [ | ||
new tag_update_1.TagUpdateAction(this.getTagId(), this.payload.props) | ||
]; | ||
return [new tag_update_1.TagUpdateAction(this.getTagId(), this.payload.props)]; | ||
} | ||
@@ -39,0 +37,0 @@ toPlanMessage() { |
@@ -35,3 +35,4 @@ "use strict"; | ||
if (intent.isEntryDerive()) { | ||
return intent.getRelatedContentTypeIds() | ||
return intent | ||
.getRelatedContentTypeIds() | ||
.map(checkContentTypeId) | ||
@@ -74,3 +75,4 @@ .filter(({ exists, willBeCreated }) => { | ||
if (intent.isEntryDerive()) { | ||
return intent.getRelatedContentTypeIds() | ||
return intent | ||
.getRelatedContentTypeIds() | ||
.map(checkContentTypeId) | ||
@@ -152,3 +154,4 @@ .filter(({ exists, willBeCreated }) => { | ||
if (intent.isEntryDerive()) { | ||
return intent.getRelatedContentTypeIds() | ||
return intent | ||
.getRelatedContentTypeIds() | ||
.map(checkContentTypeId) | ||
@@ -203,3 +206,5 @@ .filter(({ deleted }) => { | ||
const remote = contentTypes.map((ct) => ct.id); | ||
const toBeCreated = intents.filter((intent) => intent.isContentTypeCreate()).map((intent) => intent.getContentTypeId()); | ||
const toBeCreated = intents | ||
.filter((intent) => intent.isContentTypeCreate()) | ||
.map((intent) => intent.getContentTypeId()); | ||
let context = { | ||
@@ -206,0 +211,0 @@ remote: new Set(remote), |
@@ -32,5 +32,5 @@ "use strict"; | ||
const isDuplicate = chunk.slice(0, stepIndex).some((stepBefore) => { | ||
return stepBefore.payload.props && | ||
return (stepBefore.payload.props && | ||
isSameEntity(step, stepBefore) && | ||
stepBefore.payload.props.hasOwnProperty(prop); | ||
stepBefore.payload.props.hasOwnProperty(prop)); | ||
}); | ||
@@ -37,0 +37,0 @@ if (isDuplicate) { |
@@ -186,3 +186,5 @@ "use strict"; | ||
const nonExistingToReferenceField = !fieldSet.has(derivation.toReferenceField); | ||
const nonExistingDestinationFields = destinationFields ? derivation.derivedFields.filter((f) => !destinationFields.has(f)) : derivation.derivedFields; | ||
const nonExistingDestinationFields = destinationFields | ||
? derivation.derivedFields.filter((f) => !destinationFields.has(f)) | ||
: derivation.derivedFields; | ||
if (nonExistingSourceFields.length > 0) { | ||
@@ -189,0 +191,0 @@ errors.push(wrapError(deriveErrors.NON_EXISTING_SOURCE_FIELDS(sourceCT.id, nonExistingSourceFields), intent)); |
@@ -85,3 +85,3 @@ "use strict"; | ||
const tagName = intent.toRaw().payload.props.name; | ||
if (!context.remoteTags.find(tag => tag.name === tagName)) { | ||
if (!context.remoteTags.find((tag) => tag.name === tagName)) { | ||
return; | ||
@@ -144,3 +144,5 @@ } | ||
const remote = tags.map((tag) => tag.id); | ||
const toBeCreated = intents.filter((intent) => intent.isTagCreate()).map((intent) => intent.getTagId()); | ||
const toBeCreated = intents | ||
.filter((intent) => intent.isTagCreate()) | ||
.map((intent) => intent.getTagId()); | ||
let context = { | ||
@@ -147,0 +149,0 @@ remote: new Set(remote), |
@@ -48,6 +48,6 @@ "use strict"; | ||
hasValidationErrors() { | ||
return this.batches.some(batch => batch.validationErrors.length > 0); | ||
return this.batches.some((batch) => batch.validationErrors.length > 0); | ||
} | ||
hasRuntimeErrors() { | ||
return this.batches.some(batch => batch.runtimeErrors.length > 0); | ||
return this.batches.some((batch) => batch.runtimeErrors.length > 0); | ||
} | ||
@@ -148,3 +148,9 @@ hasStepsValidationErrors() { | ||
const locales = await fetcher.getLocalesForSpace(); | ||
const api = new offline_api_1.default({ contentTypes: existingCts, entries, locales, editorInterfacesByContentType: existingEditorInterfaces, tags: existingTags }); | ||
const api = new offline_api_1.default({ | ||
contentTypes: existingCts, | ||
entries, | ||
locales, | ||
editorInterfacesByContentType: existingEditorInterfaces, | ||
tags: existingTags | ||
}); | ||
await intentList.compressed().applyTo(api); | ||
@@ -151,0 +157,0 @@ const batches = await api.getRequestBatches(); |
@@ -354,3 +354,3 @@ "use strict"; | ||
props: { | ||
'newId': value | ||
newId: value | ||
} | ||
@@ -357,0 +357,0 @@ } |
@@ -18,3 +18,3 @@ 'use strict'; | ||
let instanceId; | ||
if ((typeof instanceCounts[id]) === 'undefined') { | ||
if (typeof instanceCounts[id] === 'undefined') { | ||
instanceId = 0; | ||
@@ -21,0 +21,0 @@ } |
@@ -28,3 +28,3 @@ "use strict"; | ||
const apiContentType = (0, lodash_1.omit)(ct.toAPI(), 'sys'); | ||
apiContentType.fields = apiContentType.fields.filter(field => !field.deleted); | ||
apiContentType.fields = apiContentType.fields.filter((field) => !field.deleted); | ||
return { | ||
@@ -31,0 +31,0 @@ method: 'PUT', |
@@ -21,3 +21,5 @@ "use strict"; | ||
const deletedFields = contentType.fields.filter((field) => field.deleted); | ||
const omittedFieldsInParent = publishedContentType ? publishedContentType.fields.filter((field) => field.omitted) : []; | ||
const omittedFieldsInParent = publishedContentType | ||
? publishedContentType.fields.filter((field) => field.omitted) | ||
: []; | ||
const deletedIds = deletedFields.map((field) => field.id); | ||
@@ -24,0 +26,0 @@ const omittedIds = omittedFieldsInParent.map((field) => field.id); |
@@ -63,3 +63,3 @@ "use strict"; | ||
'asset-hyperlink': Joi.array(), | ||
'hyperlink': Joi.array() | ||
hyperlink: Joi.array() | ||
})); | ||
@@ -66,0 +66,0 @@ const enabledMarks = validation('enabledMarks', Joi.array().items(Joi.string().valid('bold', 'italic', 'code', 'underline'))); |
@@ -37,3 +37,5 @@ "use strict"; | ||
name: Joi.string().required(), | ||
type: Joi.string().valid('Symbol', 'Text', 'Integer', 'Number', 'Date', 'Boolean', 'Object', 'Link', 'Array', 'Location', 'RichText').required(), | ||
type: Joi.string() | ||
.valid('Symbol', 'Text', 'Integer', 'Number', 'Date', 'Boolean', 'Object', 'Link', 'Array', 'Location', 'RichText') | ||
.required(), | ||
linkType: enforceDependency({ | ||
@@ -54,3 +56,5 @@ valid: Joi.string().valid('Asset', 'Entry'), | ||
validations: Joi.array().unique().items(field_validations_schema_1.default), | ||
defaultValue: Joi.object().strict().pattern(Joi.valid(...locales), Joi.when(Joi.ref('...type'), { | ||
defaultValue: Joi.object() | ||
.strict() | ||
.pattern(Joi.valid(...locales), Joi.when(Joi.ref('...type'), { | ||
otherwise: Joi.forbidden(), | ||
@@ -99,5 +103,9 @@ switch: [ | ||
const enforceDependency = function ({ valid, when, is }) { | ||
return valid.when(when, { | ||
is: is, then: Joi.any().required(), otherwise: Joi.any().forbidden() | ||
}).error((errors) => { | ||
return valid | ||
.when(when, { | ||
is: is, | ||
then: Joi.any().required(), | ||
otherwise: Joi.any().forbidden() | ||
}) | ||
.error((errors) => { | ||
return errors.map((error) => { | ||
@@ -104,0 +112,0 @@ const path = error.path; |
@@ -1,7 +0,7 @@ | ||
# [4.8.0](https://github.com/contentful/contentful-migration/compare/v4.7.2...v4.8.0) (2022-02-16) | ||
## [4.8.1](https://github.com/contentful/contentful-migration/compare/v4.8.0...v4.8.1) (2022-02-21) | ||
### Features | ||
### Bug Fixes | ||
* **options:** Expose retryLimit parameter ([88fc079](https://github.com/contentful/contentful-migration/commit/88fc0799b130c2699c22f2faae41e3e73fa4f933)) | ||
* add retryLimit to RunMigrationConfig type ([cbf28a4](https://github.com/contentful/contentful-migration/commit/cbf28a461c19eb957c84c0f6c84aa9954f883e3c)) | ||
@@ -8,0 +8,0 @@ # Change Log |
213
index.d.ts
@@ -10,5 +10,6 @@ import * as axios from 'axios' | ||
yes?: boolean | ||
retryLimit?: number | ||
} & ({ filePath: string } | { migrationFunction: MigrationFunction }) | ||
export function runMigration (config: RunMigrationConfig): Promise<any> | ||
export function runMigration(config: RunMigrationConfig): Promise<any> | ||
@@ -22,3 +23,14 @@ export interface Movement { | ||
type FieldType = 'Symbol' | 'Text' | 'Integer' | 'Number' | 'Date' | 'Boolean' | 'Object' | 'Location' | 'RichText' | 'Array' | 'Link' | ||
type FieldType = | ||
| 'Symbol' | ||
| 'Text' | ||
| 'Integer' | ||
| 'Number' | ||
| 'Date' | ||
| 'Boolean' | ||
| 'Object' | ||
| 'Location' | ||
| 'RichText' | ||
| 'Array' | ||
| 'Link' | ||
@@ -86,26 +98,40 @@ export interface IFieldOptions { | ||
type LinkMimetype = 'attachment' | 'plaintext' | 'image' | 'audio' | 'video' | 'richtext' | | ||
'presentation' | 'spreadsheet' | 'pdfdocument' | 'archive' | 'code' | 'markup' | ||
type LinkMimetype = | ||
| 'attachment' | ||
| 'plaintext' | ||
| 'image' | ||
| 'audio' | ||
| 'video' | ||
| 'richtext' | ||
| 'presentation' | ||
| 'spreadsheet' | ||
| 'pdfdocument' | ||
| 'archive' | ||
| 'code' | ||
| 'markup' | ||
export interface IValidation { | ||
/** Takes an array of content type ids and validates that the link points to an entry of that content type. */ | ||
linkContentType?: string[], | ||
linkContentType?: string[] | ||
/** Takes an array of values and validates that the field value is in this array. */ | ||
in?: string[] | number[], | ||
in?: string[] | number[] | ||
/** Takes a MIME type group name and validates that the link points to an asset of this group. */ | ||
linkMimetypeGroup?: LinkMimetype[], | ||
linkMimetypeGroup?: LinkMimetype[] | ||
/** Takes min and/or max parameters and validates the size of the array (number of objects in it). */ | ||
size?: { max?: number, min?: number }, | ||
size?: { max?: number; min?: number } | ||
/** Takes min and/or max parameters and validates the range of a value. */ | ||
range?: { max?: number, min?: number}, | ||
range?: { max?: number; min?: number } | ||
/** Takes a string that reflects a JS regex and flags, validates against a string. See JS reference for the parameters. */ | ||
regexp?: { pattern: string, flags?: string }, | ||
regexp?: { pattern: string; flags?: string } | ||
/** Validates that there are no other entries that have the same field value at the time of publication. */ | ||
unique?: true, | ||
unique?: true | ||
/** Validates that a value falls within a certain range of dates. */ | ||
dateRange?: { min?: string, max?: string }, | ||
dateRange?: { min?: string; max?: string } | ||
/** Validates that an image asset is of a certain image dimension. */ | ||
assetImageDimensions?: { width: { min?: number, max?: number }, height: { min?: number, max?: number } } | ||
assetImageDimensions?: { | ||
width: { min?: number; max?: number } | ||
height: { min?: number; max?: number } | ||
} | ||
/** Validates that an asset is of a certain file size. */ | ||
assetFileSize?: { max?: number, min?: number }, | ||
assetFileSize?: { max?: number; min?: number } | ||
@@ -121,3 +147,2 @@ message?: string | ||
export interface IEditorInterfaceOptions { | ||
/** This help text will show up below the field. */ | ||
@@ -161,14 +186,14 @@ helpText?: string | ||
/** Creates a field with provided id. */ | ||
createField (id: string, init?: IFieldOptions): Field | ||
createField(id: string, init?: IFieldOptions): Field | ||
/** Edits the field of provided id. */ | ||
editField (id: string, init?: IFieldOptions): Field | ||
editField(id: string, init?: IFieldOptions): Field | ||
moveField (id: string): Movement | ||
moveField(id: string): Movement | ||
/** Shorthand method to omit a field, publish its content type, and then delete the field. This implies that associated content for the field will be lost. */ | ||
deleteField (id: string): void | ||
deleteField(id: string): void | ||
/** Changes the field's ID. */ | ||
changeFieldId (oldId: string, newId: string): void | ||
changeFieldId(oldId: string, newId: string): void | ||
@@ -181,3 +206,7 @@ /** | ||
*/ | ||
configureEntryEditor(widgetNamespace: 'builtin' | 'extension' | 'app', widgetId: string, settings?: IEditorInterfaceOptions): void | ||
configureEntryEditor( | ||
widgetNamespace: 'builtin' | 'extension' | 'app', | ||
widgetId: string, | ||
settings?: IEditorInterfaceOptions | ||
): void | ||
@@ -192,3 +221,8 @@ /** | ||
*/ | ||
changeFieldControl (fieldId: string, widgetNamespace: 'builtin' | 'extension' | 'app', widgetId: string, settings?: IEditorInterfaceOptions): void | ||
changeFieldControl( | ||
fieldId: string, | ||
widgetNamespace: 'builtin' | 'extension' | 'app', | ||
widgetId: string, | ||
settings?: IEditorInterfaceOptions | ||
): void | ||
@@ -199,3 +233,8 @@ /** | ||
*/ | ||
changeEditorInterface (fieldId: string, widgetId: string, settings?: IEditorInterfaceOptions, widgetNamespace?: 'builtin' | 'extension'): void | ||
changeEditorInterface( | ||
fieldId: string, | ||
widgetId: string, | ||
settings?: IEditorInterfaceOptions, | ||
widgetNamespace?: 'builtin' | 'extension' | ||
): void | ||
@@ -207,3 +246,3 @@ /** | ||
*/ | ||
resetFieldControl (fieldId: string): void | ||
resetFieldControl(fieldId: string): void | ||
@@ -214,3 +253,3 @@ /** | ||
*/ | ||
resetEditorInterface (fieldId: string): void | ||
resetEditorInterface(fieldId: string): void | ||
@@ -223,3 +262,3 @@ /** | ||
*/ | ||
copyFieldControl (sourceFieldId: string, destinationFieldId: string): void | ||
copyFieldControl(sourceFieldId: string, destinationFieldId: string): void | ||
@@ -230,3 +269,3 @@ /** | ||
*/ | ||
copyEditorInterface (sourceFieldId: string, destinationFieldId: string): void | ||
copyEditorInterface(sourceFieldId: string, destinationFieldId: string): void | ||
@@ -241,6 +280,8 @@ /** | ||
*/ | ||
addSidebarWidget (widgetNamespace: 'sidebar-builtin' | 'extension' | 'app', | ||
widgetId: string, | ||
settings?: ISidebarWidgetSettings, | ||
insertBeforeWidgetId?: string | null): void | ||
addSidebarWidget( | ||
widgetNamespace: 'sidebar-builtin' | 'extension' | 'app', | ||
widgetId: string, | ||
settings?: ISidebarWidgetSettings, | ||
insertBeforeWidgetId?: string | null | ||
): void | ||
@@ -254,5 +295,7 @@ /** | ||
*/ | ||
updateSidebarWidget (widgetNamespace: 'sidebar-builtin' | 'extension' | 'app', | ||
widgetId: string, | ||
settings: ISidebarWidgetSettings): void | ||
updateSidebarWidget( | ||
widgetNamespace: 'sidebar-builtin' | 'extension' | 'app', | ||
widgetId: string, | ||
settings: ISidebarWidgetSettings | ||
): void | ||
@@ -265,4 +308,6 @@ /** | ||
*/ | ||
removeSidebarWidget (widgetNamespace: 'sidebar-builtin' | 'extension' | 'app', | ||
widgetId: string): void | ||
removeSidebarWidget( | ||
widgetNamespace: 'sidebar-builtin' | 'extension' | 'app', | ||
widgetId: string | ||
): void | ||
@@ -272,3 +317,3 @@ /** | ||
*/ | ||
resetSidebarToDefault (): void | ||
resetSidebarToDefault(): void | ||
} | ||
@@ -278,5 +323,5 @@ | ||
/** Name of the content type. */ | ||
name: string, | ||
name: string | ||
/** Description of the content type. */ | ||
description?: string, | ||
description?: string | ||
/** ID of the field to use as the display field for the content type. */ | ||
@@ -290,7 +335,7 @@ displayField?: string | ||
/** (required) – Content type ID */ | ||
contentType: string, | ||
contentType: string | ||
/** (required) – Array of the source field IDs */ | ||
from: string[], | ||
from: string[] | ||
/** (required) – Array of the target field IDs */ | ||
to: string[], | ||
to: string[] | ||
/** | ||
@@ -303,6 +348,6 @@ * (required) – Transformation function to be applied. | ||
* The return value must be an object with the same keys as specified in to. Their values will be written to the respective entry fields for the current locale (i.e. {nameField: 'myNewValue'}). If it returns undefined, this the values for this locale on the entry will be left untouched. | ||
*/ | ||
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any, | ||
*/ | ||
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any | ||
/** (optional) – If true, the transformed entries will be published. If false, they will remain in draft state. When the value is set to "preserve" items will be published only if the original entry was published as well (default true) */ | ||
shouldPublish?: boolean|"preserve" | ||
shouldPublish?: boolean | 'preserve' | ||
} | ||
@@ -312,15 +357,15 @@ | ||
/** (required) – Content type ID of source entries */ | ||
sourceContentType: string, | ||
sourceContentType: string | ||
/** (required) – Targeted Content type ID */ | ||
targetContentType: string, | ||
targetContentType: string | ||
/** (optional) – Array of the source field IDs, returns complete list of fields if not configured */ | ||
from?: string[], | ||
from?: string[] | ||
/** (required) - Function to create a new entry ID for the target entry */ | ||
identityKey: (fromFields: ContentFields) => string, | ||
identityKey: (fromFields: ContentFields) => string | ||
/** (optional) – Flag that specifies publishing of target entries, preserve will keep current states of the source entries (default false) */ | ||
shouldPublish?: boolean|"preserve", | ||
shouldPublish?: boolean | 'preserve' | ||
/** (optional) – Flag that specifies if linking entries should be updated with target entries (default false) */ | ||
updateReferences?: boolean, | ||
updateReferences?: boolean | ||
/** (optional) – Flag that specifies if source entries should be deleted (default false). Note that this flag does not support Rich Text Fields references. */ | ||
removeOldEntries?: boolean, | ||
removeOldEntries?: boolean | ||
/** | ||
@@ -333,4 +378,4 @@ * (required) – Transformation function to be applied. | ||
* The return value must be an object with the same keys as specified in to. Their values will be written to the respective entry fields for the current locale (i.e. {nameField: 'myNewValue'}). If it returns undefined, this the values for this locale on the entry will be left untouched. | ||
*/ | ||
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any, | ||
*/ | ||
transformEntryForLocale: (fromFields: ContentFields, currentLocale: string) => any | ||
} | ||
@@ -343,4 +388,4 @@ | ||
* This is the content type which has the 'from' fields | ||
*/ | ||
contentType: string, | ||
*/ | ||
contentType: string | ||
/** | ||
@@ -351,3 +396,3 @@ * (required) – Target content type ID | ||
*/ | ||
derivedContentType: string, | ||
derivedContentType: string | ||
/** | ||
@@ -359,5 +404,5 @@ * (required) – Array of the source field IDs | ||
*/ | ||
from: string[], | ||
from: string[] | ||
/** (required) – ID of the field on the source content type in which to insert the reference */ | ||
toReferenceField: string, | ||
toReferenceField: string | ||
/** | ||
@@ -369,3 +414,3 @@ * (required) – Array of the field IDs on the target content type | ||
*/ | ||
derivedFields: string[], | ||
derivedFields: string[] | ||
/** | ||
@@ -375,5 +420,5 @@ * (required) - Called once per source entry. Returns the ID used for the derived entry, which is also used for de-duplication so that multiple source entries can link to the same derived entry. | ||
*/ | ||
identityKey: (fromFields: ContentFields) => string, | ||
identityKey: (fromFields: ContentFields) => string | ||
/** (optional) – If true, both the source and the derived entries will be published. If false, both will remain in draft state. If preserve, will keep current states of the source entries (default true) */ | ||
shouldPublish?: boolean | 'preserve', | ||
shouldPublish?: boolean | 'preserve' | ||
/** | ||
@@ -385,3 +430,3 @@ * (required) – Function that generates the field values for the derived entry. | ||
* The return value must be an object with the same keys as specified in derivedFields. Their values will be written to the respective new entry fields for the current locale (i.e. {nameField: 'myNewValue'}) | ||
*/ | ||
*/ | ||
deriveEntryForLocale: (inputFields: ContentFields, locale: string) => { [field: string]: any } | ||
@@ -401,3 +446,3 @@ } | ||
/** Name of the tag. */ | ||
name: string, | ||
name: string | ||
} | ||
@@ -407,3 +452,3 @@ | ||
sys: { | ||
id: string, | ||
id: string | ||
type: 'Link' | ||
@@ -416,5 +461,5 @@ linkType: 'Tag' | ||
/** (required) – Content type ID */ | ||
contentType: string, | ||
contentType: string | ||
/** (required) – Array of the source field IDs */ | ||
from: string[], | ||
from: string[] | ||
/** | ||
@@ -429,7 +474,10 @@ * (required) – Transformation function to be applied. | ||
* | ||
*/ | ||
setTagsForEntry: (entryFields: ContentFields, entryTags: ITagLink[], apiTags: ITagLink[]) => ITagLink[] | undefined | ||
*/ | ||
setTagsForEntry: ( | ||
entryFields: ContentFields, | ||
entryTags: ITagLink[], | ||
apiTags: ITagLink[] | ||
) => ITagLink[] | undefined | ||
} | ||
/** | ||
@@ -453,3 +501,3 @@ * The main interface for creating and editing content types. | ||
*/ | ||
createContentType (id: string, init?: IContentTypeOptions): ContentType | ||
createContentType(id: string, init?: IContentTypeOptions): ContentType | ||
@@ -461,3 +509,3 @@ /** | ||
*/ | ||
editContentType (id: string, changes?: IContentTypeOptions): ContentType | ||
editContentType(id: string, changes?: IContentTypeOptions): ContentType | ||
@@ -468,3 +516,3 @@ /** | ||
*/ | ||
deleteContentType (id: string): void | ||
deleteContentType(id: string): void | ||
@@ -475,3 +523,3 @@ /** | ||
*/ | ||
transformEntries (transformation: ITransformEntriesConfig): void | ||
transformEntries(transformation: ITransformEntriesConfig): void | ||
@@ -482,3 +530,3 @@ /** | ||
*/ | ||
transformEntriesToType (transformation: ITransformEntriesToTypeConfig): void | ||
transformEntriesToType(transformation: ITransformEntriesToTypeConfig): void | ||
@@ -489,3 +537,3 @@ /** | ||
*/ | ||
deriveLinkedEntries (transformation: IDeriveLinkedEntriesConfig): void | ||
deriveLinkedEntries(transformation: IDeriveLinkedEntriesConfig): void | ||
@@ -505,3 +553,3 @@ /** | ||
*/ | ||
createTag (id: string, init?: ITagOptions, tagVisibility?: TagVisibility): ITag | ||
createTag(id: string, init?: ITagOptions, tagVisibility?: TagVisibility): ITag | ||
@@ -513,3 +561,3 @@ /** | ||
*/ | ||
editTag (id: string, changes?: ITagOptions): ITag | ||
editTag(id: string, changes?: ITagOptions): ITag | ||
@@ -520,3 +568,3 @@ /** | ||
*/ | ||
deleteTag (id: string): void | ||
deleteTag(id: string): void | ||
@@ -527,4 +575,3 @@ /** | ||
*/ | ||
setTagsForEntries (transformation: ISetTagsForEntriesConfig): void | ||
setTagsForEntries(transformation: ISetTagsForEntriesConfig): void | ||
} | ||
@@ -535,4 +582,4 @@ | ||
spaceId?: string | ||
environmentId?: string, | ||
proxy?: string, | ||
environmentId?: string | ||
proxy?: string | ||
rawProxy?: boolean | ||
@@ -539,0 +586,0 @@ } |
{ | ||
"name": "contentful-migration", | ||
"version": "4.8.0", | ||
"version": "4.8.1", | ||
"description": "Migration tooling for contentful", | ||
@@ -28,3 +28,3 @@ "author": "Contentful GmbH", | ||
"build-dev": "npm run clean && tsc -p tsconfig-dev.json", | ||
"prepare": "npm run build", | ||
"prepare": "npm run build && husky install", | ||
"test": "NOCK_RECORD=0 npm run build && npm run test:unit && npm run test:integration && npm run test:e2e && npm run lint && npm run test:typescript-declaration", | ||
@@ -37,2 +37,3 @@ "test:watch": "npm run test:unit -- --watch", | ||
"lint": "eslint 'examples/**/*.js' 'test/**/*.js' 'src/**/*.js' && tslint --project tsconfig-dev.json --config tslint.json -e '**/*.js'", | ||
"lint:fix": "prettier --write 'src/**/*.{ts,tsx,js,jsx}' 'test/**/*.{ts,tsx,js,jsx}' && eslint --fix 'examples/**/*.js' 'test/**/*.js' 'src/**/*.js' && tslint --fix --project tsconfig-dev.json --config tslint.json -e '**/*.js'", | ||
"semantic-release": "semantic-release", | ||
@@ -89,2 +90,3 @@ "travis-deploy-once": "travis-deploy-once", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.20.2", | ||
@@ -95,5 +97,8 @@ "eslint-plugin-mocha": "^9.0.0", | ||
"eslint-plugin-standard": "^5.0.0", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.3.4", | ||
"mocha": "^7.1.1", | ||
"nixt": "^0.5.1", | ||
"nock": "^13.0.0", | ||
"prettier": "^2.5.1", | ||
"rewire": "^5.0.0", | ||
@@ -109,2 +114,3 @@ "rimraf": "^3.0.2", | ||
"tslint": "^6.1.1", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-config-standard": "^9.0.0", | ||
@@ -144,3 +150,16 @@ "typescript": "^4.5.5", | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx}": [ | ||
"prettier --write", | ||
"eslint" | ||
], | ||
"*.{ts,tsx}": [ | ||
"prettier --write", | ||
"tslint" | ||
], | ||
"*.md": [ | ||
"prettier --write" | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
693509
8354
43