This commit is contained in:
45
node_modules/decap-cms-lib-util/dist/esm/APIUtils.js
generated
vendored
Normal file
45
node_modules/decap-cms-lib-util/dist/esm/APIUtils.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.MERGE_COMMIT_MESSAGE = exports.DEFAULT_PR_BODY = exports.CMS_BRANCH_PREFIX = void 0;
|
||||
exports.branchFromContentKey = branchFromContentKey;
|
||||
exports.contentKeyFromBranch = contentKeyFromBranch;
|
||||
exports.generateContentKey = generateContentKey;
|
||||
exports.isCMSLabel = isCMSLabel;
|
||||
exports.labelToStatus = labelToStatus;
|
||||
exports.parseContentKey = parseContentKey;
|
||||
exports.statusToLabel = statusToLabel;
|
||||
const CMS_BRANCH_PREFIX = exports.CMS_BRANCH_PREFIX = 'cms';
|
||||
const DEFAULT_PR_BODY = exports.DEFAULT_PR_BODY = 'Automatically generated by Decap CMS';
|
||||
const MERGE_COMMIT_MESSAGE = exports.MERGE_COMMIT_MESSAGE = 'Automatically generated. Merged on Decap CMS.';
|
||||
const DEFAULT_DECAP_CMS_LABEL_PREFIX = 'decap-cms/';
|
||||
function getLabelPrefix(labelPrefix) {
|
||||
return labelPrefix || DEFAULT_DECAP_CMS_LABEL_PREFIX;
|
||||
}
|
||||
function isCMSLabel(label, labelPrefix) {
|
||||
return label.startsWith(getLabelPrefix(labelPrefix));
|
||||
}
|
||||
function labelToStatus(label, labelPrefix) {
|
||||
return label.slice(getLabelPrefix(labelPrefix).length);
|
||||
}
|
||||
function statusToLabel(status, labelPrefix) {
|
||||
return `${getLabelPrefix(labelPrefix)}${status}`;
|
||||
}
|
||||
function generateContentKey(collectionName, slug) {
|
||||
return `${collectionName}/${slug}`;
|
||||
}
|
||||
function parseContentKey(contentKey) {
|
||||
const index = contentKey.indexOf('/');
|
||||
return {
|
||||
collection: contentKey.slice(0, index),
|
||||
slug: contentKey.slice(index + 1)
|
||||
};
|
||||
}
|
||||
function contentKeyFromBranch(branch) {
|
||||
return branch.slice(`${CMS_BRANCH_PREFIX}/`.length);
|
||||
}
|
||||
function branchFromContentKey(contentKey) {
|
||||
return `${CMS_BRANCH_PREFIX}/${contentKey}`;
|
||||
}
|
||||
Reference in New Issue
Block a user