contentful-migration
Version:
Migration tooling for contentful
591 lines • 26.6 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const Intents = __importStar(require("../intent/index"));
const actionCreators = {
contentType: {
create: (id, instanceId, callsite) => {
return new Intents.ContentTypeCreate({
type: 'contentType/create',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: { contentTypeId: id }
});
},
update: (id, instanceId, callsite, property, value) => {
return new Intents.ContentTypeUpdate({
type: 'contentType/update',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
props: {
[property]: value
}
}
});
},
setAnnotations: (id, instanceId, callsite, annotationIds) => new Intents.ContentTypeAnnotate({
type: 'contentType/update',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
annotations: annotationIds
}
}),
delete: (id, instanceId, callsite) => {
return new Intents.ContentTypeDelete({
type: 'contentType/delete',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: { contentTypeId: id }
});
},
transformEntries: (id, instanceId, transformation, callsite) => new Intents.EntryTransform({
type: 'contentType/transformEntries',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
transformation,
contentTypeId: id
}
}),
deriveLinkedEntries: (id, instanceId, derivation, callsite) => new Intents.EntryDerive({
type: 'contentType/deriveEntries',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
derivation,
contentTypeId: id
}
}),
transformEntriesToType: (instanceId, entryTransformationToType, callsite) => new Intents.EntryTransformToType({
type: 'contentType/transformEntriesToType',
meta: {
contentTypeInstanceId: `contentType/${entryTransformationToType.sourceContentType}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
entryTransformationToType,
contentTypeId: entryTransformationToType.sourceContentType
}
}),
changeEditorInterface: (id, instanceId, callsite, fieldId, widgetId, settings = {}, widgetNamespace) => new Intents.EditorInterfaceUpdate({
type: 'contentType/changeEditorInterface',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
editorInterface: {
fieldId,
widgetId,
settings,
widgetNamespace
}
}
}),
copyEditorInterface: (id, instanceId, callsite, sourceFieldId, destinationFieldId) => new Intents.EditorInterfaceCopy({
type: 'contentType/copyEditorInterface',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
editorInterfaceCopy: {
source: sourceFieldId,
destination: destinationFieldId
}
}
}),
resetEditorInterface: (id, instanceId, callsite, fieldId) => new Intents.EditorInterfaceReset({
type: 'contentType/resetEditorInterface',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
editorInterfaceReset: {
fieldId
}
}
}),
resetEntryEditor: (id, instanceId, callsite) => new Intents.EntryEditorResetToDefault({
type: 'contentType/resetEntryEditor',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id
}
}),
configureEntryEditor: (id, instanceId, callsite, widgetNamespace, widgetId, settings) => new Intents.EntryEditorConfigure({
type: 'contentType/configureEntryEditor',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
entryEditor: {
widgetId,
widgetNamespace,
settings
}
}
}),
configureEntryEditors: (id, instanceId, callsite, editors) => new Intents.EntryEditorsConfigure({
type: 'contentType/configureEntryEditors',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
entryEditors: editors
}
}),
createEditorLayout: (id, instanceId, callsite) => new Intents.EditorLayoutCreate({
type: 'contentType/createEditorLayout',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id
}
}),
deleteEditorLayout: (contentTypeId, contentTypeInstanceId, callsite) => new Intents.EditorLayoutDelete({
type: 'contentType/deleteEditorLayout',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId
}
}),
addSidebarWidget: (id, instanceId, callsite, widgetId, widgetNamespace, insertBeforeWidgetId, settings = {}) => new Intents.SidebarWidgetAdd({
type: 'contentType/addSidebarWidget',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
sidebarWidget: {
widgetId,
widgetNamespace,
settings,
insertBeforeWidgetId
}
}
}),
updateSidebarWidget: (id, instanceId, callsite, widgetId, widgetNamespace, settings = {}) => new Intents.SidebarWidgetUpdate({
type: 'contentType/updateSidebarWidget',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
sidebarWidget: {
widgetId,
settings,
widgetNamespace
}
}
}),
removeSidebarWidget: (id, instanceId, callsite, widgetId, widgetNamespace) => new Intents.SidebarWidgetRemove({
type: 'contentType/removeSidebarWidget',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
sidebarWidget: {
widgetId,
widgetNamespace
}
}
}),
resetSidebarToDefault: (id, instanceId, callsite) => new Intents.SidebarResetToDefault({
type: 'contentType/resetSidebarToDefault',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id
}
}),
setTagsForEntries: (id, instanceId, entryTransformationForTags, callsite) => new Intents.EntrySetTags({
type: 'contentType/setTagsForEntries',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
entryTransformationForTags,
contentTypeId: id
}
})
},
editorLayout: {
changeFieldGroupControl: (contentTypeId, contentTypeInstanceId, fieldGroupId, callsite, groupControl) => new Intents.EditorLayoutChangeFieldGroupControl({
type: 'contentType/updateGroupControl',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldGroupId,
groupControl
}
}),
createFieldGroup: (id, instanceId, callsite, fieldGroupId, parentId = undefined) => new Intents.EditorLayoutCreateFieldGroup({
type: 'contentType/createEditorLayoutFieldGroup',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
fieldGroupId,
parentFieldGroupId: parentId
}
}),
deleteEditorLayoutFieldGroup: (id, instanceId, callsite, fieldGroupId) => new Intents.EditorLayoutDeleteFieldGroup({
type: 'contentType/deleteEditorLayoutFieldGroup',
meta: {
contentTypeInstanceId: `contentType/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId: id,
fieldGroupId
}
}),
changeFieldGroupId: (contentTypeId, contentTypeInstanceId, fieldGroupId, newFieldGroupId, callsite) => new Intents.EditorLayoutChangeFieldGroupId({
type: 'contentType/changeEditorLayoutFieldGroupId',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldGroupId,
newFieldGroupId
}
}),
callInvalidEditorLayoutMethod: (contentTypeId, contentTypeInstanceId, callsite, invalidMethod) => new Intents.EditorLayoutInvalidMethod({
type: 'contentType/callInvalidEditorLayoutMethod',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
invalidMethod
}
}),
updateFieldGroup: (contentTypeId, contentTypeInstanceId, fieldGroupId, callsite, property, value) => new Intents.EditorLayoutUpdateFieldGroup({
type: 'contentType/updateEditorLayoutFieldGroup',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldGroupId,
fieldGroupProps: {
[property]: value
}
}
}),
moveField: (contentTypeId, contentTypeInstanceId, fieldId, fieldGroupId, movement, callsite) => new Intents.EditorLayoutMoveField({
type: 'contentType/moveFieldInEditorLayout',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldId,
fieldGroupId,
movement
}
})
},
field: {
create: (contentTypeId, contentTypeInstanceId, fieldId, fieldInstanceId, callsite) => new Intents.FieldCreate({
type: 'field/create',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
fieldInstanceId: `fields/${fieldId}/${fieldInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldId
}
}),
update: (contentTypeId, contentTypeInstanceId, fieldId, fieldInstanceId, callsite, property, value) => new Intents.FieldUpdate({
type: 'field/update',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
fieldInstanceId: `fields/${fieldId}/${fieldInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldId,
props: {
[property]: value
}
}
}),
move: (contentTypeId, contentTypeInstanceId, fieldId, fieldInstanceId, callsite, movement) => new Intents.FieldMove({
type: 'field/move',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
fieldInstanceId: `fields/${fieldId}/${fieldInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldId,
movement
}
}),
rename: (contentTypeId, contentTypeInstanceId, fieldId, fieldInstanceId, callsite, value) => new Intents.FieldRename({
type: 'field/rename',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
fieldInstanceId: `fields/${fieldId}/${fieldInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldId,
props: {
newId: value
}
}
}),
delete: (contentTypeId, contentTypeInstanceId, fieldId, fieldInstanceId, callsite) => new Intents.FieldDelete({
type: 'field/delete',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
fieldInstanceId: `fields/${fieldId}/${fieldInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldId
}
}),
setAnnotations: (contentTypeId, contentTypeInstanceId, fieldId, fieldInstanceId, callsite, annotationIds, fieldAnnotationPayload) => new Intents.FieldAnnotate({
type: 'field/annotate',
meta: {
contentTypeInstanceId: `contentType/${contentTypeId}/${contentTypeInstanceId}`,
fieldInstanceId: `fields/${fieldId}/${fieldInstanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
contentTypeId,
fieldId,
annotations: annotationIds,
fieldAnnotationPayload
}
})
},
tag: {
create: (id, instanceId, callsite, visibility = 'private') => {
return new Intents.TagCreate({
type: 'tag/create',
meta: {
tagInstanceId: `tag/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: { tagId: id, tagVisibility: visibility }
});
},
update: (id, instanceId, callsite, property, value) => {
return new Intents.TagUpdate({
type: 'tag/update',
meta: {
tagInstanceId: `tag/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: {
tagId: id,
props: {
[property]: value
}
}
});
},
delete: (id, instanceId, callsite) => {
return new Intents.TagDelete({
type: 'tag/delete',
meta: {
tagInstanceId: `tag/${id}/${instanceId}`,
callsite: {
file: callsite === null || callsite === void 0 ? void 0 : callsite.getFileName(),
line: callsite === null || callsite === void 0 ? void 0 : callsite.getLineNumber()
}
},
payload: { tagId: id }
});
}
}
};
exports.default = actionCreators;
//# sourceMappingURL=action-creators.js.map