decap-cms-lib-util 3.0.0 → 3.0.2-beta.0
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/CHANGELOG.md +51 -310
- package/dist/decap-cms-lib-util.js +1 -1
- package/dist/decap-cms-lib-util.js.map +1 -1
- package/dist/esm/API.js +1 -2
- package/dist/esm/APIError.js +1 -2
- package/dist/esm/APIUtils.js +3 -6
- package/dist/esm/AccessTokenError.js +1 -2
- package/dist/esm/Cursor.js +1 -2
- package/dist/esm/EditorialWorkflowError.js +1 -2
- package/dist/esm/git-lfs.js +5 -6
- package/dist/esm/implementation.js +2 -2
- package/dist/esm/index.js +4 -5
- package/dist/esm/localForage.js +1 -2
- package/dist/esm/unsentRequest.js +4 -5
- package/package.json +3 -3
- package/src/implementation.ts +2 -0
package/dist/esm/API.js
CHANGED
|
@@ -140,7 +140,7 @@ function isPreviewContext(context, previewContext) {
|
|
|
140
140
|
}
|
|
141
141
|
return PREVIEW_CONTEXT_KEYWORDS.some(keyword => context.includes(keyword));
|
|
142
142
|
}
|
|
143
|
-
let PreviewState = /*#__PURE__*/function (PreviewState) {
|
|
143
|
+
let PreviewState = exports.PreviewState = /*#__PURE__*/function (PreviewState) {
|
|
144
144
|
PreviewState["Other"] = "other";
|
|
145
145
|
PreviewState["Success"] = "success";
|
|
146
146
|
return PreviewState;
|
|
@@ -149,7 +149,6 @@ let PreviewState = /*#__PURE__*/function (PreviewState) {
|
|
|
149
149
|
* Retrieve a deploy preview URL from an array of statuses. By default, a
|
|
150
150
|
* matching status is inferred via `isPreviewContext`.
|
|
151
151
|
*/
|
|
152
|
-
exports.PreviewState = PreviewState;
|
|
153
152
|
function getPreviewStatus(statuses, previewContext) {
|
|
154
153
|
return statuses.find(({
|
|
155
154
|
context
|
package/dist/esm/APIError.js
CHANGED
|
@@ -28,8 +28,7 @@ function _extendableBuiltin(cls) {
|
|
|
28
28
|
}
|
|
29
29
|
return ExtendableBuiltin;
|
|
30
30
|
}
|
|
31
|
-
const API_ERROR = 'API_ERROR';
|
|
32
|
-
exports.API_ERROR = API_ERROR;
|
|
31
|
+
const API_ERROR = exports.API_ERROR = 'API_ERROR';
|
|
33
32
|
class APIError extends _extendableBuiltin(Error) {
|
|
34
33
|
constructor(message, status, api, meta = {}) {
|
|
35
34
|
super(message);
|
package/dist/esm/APIUtils.js
CHANGED
|
@@ -11,12 +11,9 @@ exports.isCMSLabel = isCMSLabel;
|
|
|
11
11
|
exports.labelToStatus = labelToStatus;
|
|
12
12
|
exports.parseContentKey = parseContentKey;
|
|
13
13
|
exports.statusToLabel = statusToLabel;
|
|
14
|
-
const CMS_BRANCH_PREFIX = 'cms';
|
|
15
|
-
exports.
|
|
16
|
-
const
|
|
17
|
-
exports.DEFAULT_PR_BODY = DEFAULT_PR_BODY;
|
|
18
|
-
const MERGE_COMMIT_MESSAGE = 'Automatically generated. Merged on Decap CMS.';
|
|
19
|
-
exports.MERGE_COMMIT_MESSAGE = MERGE_COMMIT_MESSAGE;
|
|
14
|
+
const CMS_BRANCH_PREFIX = exports.CMS_BRANCH_PREFIX = 'cms';
|
|
15
|
+
const DEFAULT_PR_BODY = exports.DEFAULT_PR_BODY = 'Automatically generated by Decap CMS';
|
|
16
|
+
const MERGE_COMMIT_MESSAGE = exports.MERGE_COMMIT_MESSAGE = 'Automatically generated. Merged on Decap CMS.';
|
|
20
17
|
const DEFAULT_DECAP_CMS_LABEL_PREFIX = 'decap-cms/';
|
|
21
18
|
function getLabelPrefix(labelPrefix) {
|
|
22
19
|
return labelPrefix || DEFAULT_DECAP_CMS_LABEL_PREFIX;
|
|
@@ -28,8 +28,7 @@ function _extendableBuiltin(cls) {
|
|
|
28
28
|
}
|
|
29
29
|
return ExtendableBuiltin;
|
|
30
30
|
}
|
|
31
|
-
const ACCESS_TOKEN_ERROR = 'ACCESS_TOKEN_ERROR';
|
|
32
|
-
exports.ACCESS_TOKEN_ERROR = ACCESS_TOKEN_ERROR;
|
|
31
|
+
const ACCESS_TOKEN_ERROR = exports.ACCESS_TOKEN_ERROR = 'ACCESS_TOKEN_ERROR';
|
|
33
32
|
class AccessTokenError extends _extendableBuiltin(Error) {
|
|
34
33
|
constructor(message) {
|
|
35
34
|
super(message);
|
package/dist/esm/Cursor.js
CHANGED
|
@@ -131,5 +131,4 @@ class Cursor {
|
|
|
131
131
|
// backends with a compatibility layer, as part of the backend API
|
|
132
132
|
// refactor.
|
|
133
133
|
exports.default = Cursor;
|
|
134
|
-
const CURSOR_COMPATIBILITY_SYMBOL = Symbol('cursor key for compatibility with old backends');
|
|
135
|
-
exports.CURSOR_COMPATIBILITY_SYMBOL = CURSOR_COMPATIBILITY_SYMBOL;
|
|
134
|
+
const CURSOR_COMPATIBILITY_SYMBOL = exports.CURSOR_COMPATIBILITY_SYMBOL = Symbol('cursor key for compatibility with old backends');
|
|
@@ -28,8 +28,7 @@ function _extendableBuiltin(cls) {
|
|
|
28
28
|
}
|
|
29
29
|
return ExtendableBuiltin;
|
|
30
30
|
}
|
|
31
|
-
const EDITORIAL_WORKFLOW_ERROR = 'EDITORIAL_WORKFLOW_ERROR';
|
|
32
|
-
exports.EDITORIAL_WORKFLOW_ERROR = EDITORIAL_WORKFLOW_ERROR;
|
|
31
|
+
const EDITORIAL_WORKFLOW_ERROR = exports.EDITORIAL_WORKFLOW_ERROR = 'EDITORIAL_WORKFLOW_ERROR';
|
|
33
32
|
class EditorialWorkflowError extends _extendableBuiltin(Error) {
|
|
34
33
|
constructor(message, notUnderEditorialWorkflow) {
|
|
35
34
|
super(message);
|
package/dist/esm/git-lfs.js
CHANGED
|
@@ -16,8 +16,8 @@ var _getBlobSHA = _interopRequireDefault(require("./getBlobSHA"));
|
|
|
16
16
|
const _excluded = ["size", "oid"]; //
|
|
17
17
|
// Pointer file parsing
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
function ownKeys(
|
|
20
|
-
function _objectSpread(
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
21
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
22
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
23
23
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -33,7 +33,7 @@ function isNonEmptyString(str) {
|
|
|
33
33
|
return str !== '';
|
|
34
34
|
}
|
|
35
35
|
const withoutEmptyLines = (0, _flow2.default)([(0, _map2.default)(str => str.trim()), (0, _filter2.default)(isNonEmptyString)]);
|
|
36
|
-
const parsePointerFile = (0, _flow2.default)([splitIntoLines, withoutEmptyLines, (0, _map2.default)(splitIntoWords), _fromPairs2.default, _ref => {
|
|
36
|
+
const parsePointerFile = exports.parsePointerFile = (0, _flow2.default)([splitIntoLines, withoutEmptyLines, (0, _map2.default)(splitIntoWords), _fromPairs2.default, _ref => {
|
|
37
37
|
let {
|
|
38
38
|
size,
|
|
39
39
|
oid
|
|
@@ -47,7 +47,7 @@ const parsePointerFile = (0, _flow2.default)([splitIntoLines, withoutEmptyLines,
|
|
|
47
47
|
|
|
48
48
|
//
|
|
49
49
|
// .gitattributes file parsing
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
function removeGitAttributesCommentsFromLine(line) {
|
|
52
52
|
return line.split('#')[0];
|
|
53
53
|
}
|
|
@@ -68,8 +68,7 @@ function parseGitPatternAttribute(attributeString) {
|
|
|
68
68
|
const parseGitPatternAttributes = (0, _flow2.default)([(0, _map2.default)(parseGitPatternAttribute), _fromPairs2.default]);
|
|
69
69
|
const parseGitAttributesPatternLine = (0, _flow2.default)([splitIntoWords, ([pattern, ...attributes]) => [pattern, parseGitPatternAttributes(attributes)]]);
|
|
70
70
|
const parseGitAttributesFileToPatternAttributePairs = (0, _flow2.default)([splitIntoLines, (0, _map2.default)(removeGitAttributesCommentsFromLine), withoutEmptyLines, (0, _map2.default)(parseGitAttributesPatternLine)]);
|
|
71
|
-
const getLargeMediaPatternsFromGitAttributesFile = (0, _flow2.default)([parseGitAttributesFileToPatternAttributePairs, (0, _filter2.default)(([, attributes]) => attributes.filter === 'lfs' && attributes.diff === 'lfs' && attributes.merge === 'lfs'), (0, _map2.default)(([pattern]) => pattern)]);
|
|
72
|
-
exports.getLargeMediaPatternsFromGitAttributesFile = getLargeMediaPatternsFromGitAttributesFile;
|
|
71
|
+
const getLargeMediaPatternsFromGitAttributesFile = exports.getLargeMediaPatternsFromGitAttributesFile = (0, _flow2.default)([parseGitAttributesFileToPatternAttributePairs, (0, _filter2.default)(([, attributes]) => attributes.filter === 'lfs' && attributes.diff === 'lfs' && attributes.merge === 'lfs'), (0, _map2.default)(([pattern]) => pattern)]);
|
|
73
72
|
function createPointerFile({
|
|
74
73
|
size,
|
|
75
74
|
sha
|
|
@@ -18,8 +18,8 @@ var _unionBy2 = _interopRequireDefault(require("lodash/unionBy"));
|
|
|
18
18
|
var _semaphore = _interopRequireDefault(require("semaphore"));
|
|
19
19
|
var _path = require("./path");
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
function ownKeys(
|
|
22
|
-
function _objectSpread(
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
23
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
24
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
25
25
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
package/dist/esm/index.js
CHANGED
|
@@ -344,10 +344,10 @@ var _implementation = require("./implementation");
|
|
|
344
344
|
var _API = require("./API");
|
|
345
345
|
var _APIUtils = require("./APIUtils");
|
|
346
346
|
var _gitLfs = require("./git-lfs");
|
|
347
|
-
function _getRequireWildcardCache(
|
|
348
|
-
function _interopRequireWildcard(
|
|
347
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
348
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
349
349
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
350
|
-
const DecapCmsLibUtil = {
|
|
350
|
+
const DecapCmsLibUtil = exports.DecapCmsLibUtil = {
|
|
351
351
|
APIError: _APIError.default,
|
|
352
352
|
Cursor: _Cursor.default,
|
|
353
353
|
CURSOR_COMPATIBILITY_SYMBOL: _Cursor.CURSOR_COMPATIBILITY_SYMBOL,
|
|
@@ -399,5 +399,4 @@ const DecapCmsLibUtil = {
|
|
|
399
399
|
allEntriesByFolder: _implementation.allEntriesByFolder,
|
|
400
400
|
AccessTokenError: _AccessTokenError.default,
|
|
401
401
|
throwOnConflictingBranches: _API.throwOnConflictingBranches
|
|
402
|
-
};
|
|
403
|
-
exports.DecapCmsLibUtil = DecapCmsLibUtil;
|
|
402
|
+
};
|
package/dist/esm/localForage.js
CHANGED
|
@@ -9,8 +9,8 @@ var _curry = _interopRequireDefault(require("lodash/curry"));
|
|
|
9
9
|
var _flow = _interopRequireDefault(require("lodash/flow"));
|
|
10
10
|
var _isString = _interopRequireDefault(require("lodash/isString"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function ownKeys(
|
|
13
|
-
function _objectSpread(
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
15
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
16
16
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -107,7 +107,7 @@ const withRoot = getCurriedRequestProcessor((root, req) => req.update('url', p =
|
|
|
107
107
|
}
|
|
108
108
|
return root && p && p[0] !== '/' && root[root.length - 1] !== '/' ? `${root}/${p}` : `${root}${p}`;
|
|
109
109
|
}));
|
|
110
|
-
var _default = {
|
|
110
|
+
var _default = exports.default = {
|
|
111
111
|
toURL,
|
|
112
112
|
fromURL,
|
|
113
113
|
fromFetchArguments,
|
|
@@ -119,5 +119,4 @@ var _default = {
|
|
|
119
119
|
withRoot,
|
|
120
120
|
withNoCache,
|
|
121
121
|
fetchWithTimeout
|
|
122
|
-
};
|
|
123
|
-
exports.default = _default;
|
|
122
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decap-cms-lib-util",
|
|
3
3
|
"description": "Shared utilities for Decap CMS.",
|
|
4
|
-
"version": "3.0.0",
|
|
4
|
+
"version": "3.0.2-beta.0",
|
|
5
5
|
"repository": "https://github.com/decaporg/decap-cms/tree/master/packages/decap-cms-lib-util",
|
|
6
6
|
"bugs": "https://github.com/decaporg/decap-cms/issues",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"scripts": {
|
|
15
|
-
"develop": "
|
|
15
|
+
"develop": "npm run build:esm -- --watch",
|
|
16
16
|
"build": "cross-env NODE_ENV=production webpack",
|
|
17
17
|
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
|
|
18
18
|
},
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"immutable": "^3.7.6",
|
|
26
26
|
"lodash": "^4.17.11"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "d7a43e3bb45259ab0789362ea804df31fec77e21"
|
|
29
29
|
}
|
package/src/implementation.ts
CHANGED
|
@@ -111,6 +111,7 @@ export type Config = {
|
|
|
111
111
|
proxy_url?: string;
|
|
112
112
|
auth_type?: string;
|
|
113
113
|
app_id?: string;
|
|
114
|
+
base_url?: string;
|
|
114
115
|
cms_label_prefix?: string;
|
|
115
116
|
api_version?: string;
|
|
116
117
|
};
|
|
@@ -177,6 +178,7 @@ export interface Implementation {
|
|
|
177
178
|
folder: string,
|
|
178
179
|
extension: string,
|
|
179
180
|
depth: number,
|
|
181
|
+
pathRegex?: RegExp,
|
|
180
182
|
) => Promise<ImplementationEntry[]>;
|
|
181
183
|
traverseCursor?: (
|
|
182
184
|
cursor: Cursor,
|