2020-01-15 00:15:14 +02:00
|
|
|
import APIError from './APIError';
|
|
|
|
import Cursor, { CURSOR_COMPATIBILITY_SYMBOL } from './Cursor';
|
|
|
|
import EditorialWorkflowError, { EDITORIAL_WORKFLOW_ERROR } from './EditorialWorkflowError';
|
2020-06-03 12:44:03 +03:00
|
|
|
import AccessTokenError from './AccessTokenError';
|
2020-01-15 00:15:14 +02:00
|
|
|
import localForage from './localForage';
|
|
|
|
import { isAbsolutePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
|
|
|
|
import { onlySuccessfulPromises, flowAsync, then } from './promise';
|
|
|
|
import unsentRequest from './unsentRequest';
|
|
|
|
import {
|
2020-04-01 06:13:27 +03:00
|
|
|
filterByExtension,
|
2020-01-15 00:15:14 +02:00
|
|
|
getAllResponses,
|
|
|
|
parseLinkHeader,
|
|
|
|
parseResponse,
|
|
|
|
responseParser,
|
|
|
|
getPathDepth,
|
|
|
|
} from './backendUtil';
|
|
|
|
import loadScript from './loadScript';
|
|
|
|
import getBlobSHA from './getBlobSHA';
|
|
|
|
import { asyncLock, AsyncLock as AL } from './asyncLock';
|
|
|
|
import {
|
|
|
|
Implementation as I,
|
|
|
|
ImplementationEntry as IE,
|
|
|
|
ImplementationMediaFile as IMF,
|
|
|
|
ImplementationFile as IF,
|
|
|
|
DisplayURLObject as DUO,
|
|
|
|
DisplayURL as DU,
|
|
|
|
Credentials as Cred,
|
|
|
|
User as U,
|
|
|
|
Entry as E,
|
|
|
|
PersistOptions as PO,
|
|
|
|
AssetProxy as AP,
|
|
|
|
entriesByFiles,
|
|
|
|
entriesByFolder,
|
|
|
|
unpublishedEntries,
|
|
|
|
getMediaDisplayURL,
|
|
|
|
getMediaAsBlob,
|
|
|
|
runWithLock,
|
|
|
|
Config as C,
|
|
|
|
UnpublishedEntryMediaFile as UEMF,
|
2020-02-10 18:05:47 +02:00
|
|
|
blobToFileObj,
|
2020-04-01 06:13:27 +03:00
|
|
|
allEntriesByFolder,
|
2020-01-15 00:15:14 +02:00
|
|
|
} from './implementation';
|
|
|
|
import {
|
|
|
|
readFile,
|
2020-04-01 06:13:27 +03:00
|
|
|
readFileMetadata,
|
2020-04-01 11:44:39 +03:00
|
|
|
isPreviewContext,
|
|
|
|
getPreviewStatus,
|
|
|
|
PreviewState,
|
|
|
|
FetchError as FE,
|
|
|
|
ApiRequest as AR,
|
|
|
|
requestWithBackoff,
|
2020-06-09 19:03:19 +03:00
|
|
|
throwOnConflictingBranches,
|
2020-04-01 11:44:39 +03:00
|
|
|
} from './API';
|
|
|
|
import {
|
2020-01-15 00:15:14 +02:00
|
|
|
CMS_BRANCH_PREFIX,
|
|
|
|
generateContentKey,
|
|
|
|
isCMSLabel,
|
|
|
|
labelToStatus,
|
|
|
|
statusToLabel,
|
|
|
|
DEFAULT_PR_BODY,
|
|
|
|
MERGE_COMMIT_MESSAGE,
|
|
|
|
parseContentKey,
|
2020-01-22 23:47:34 +02:00
|
|
|
branchFromContentKey,
|
|
|
|
contentKeyFromBranch,
|
2020-04-01 11:44:39 +03:00
|
|
|
} from './APIUtils';
|
2020-01-21 18:57:36 +02:00
|
|
|
import {
|
|
|
|
createPointerFile,
|
|
|
|
getLargeMediaFilteredMediaFiles,
|
|
|
|
getLargeMediaPatternsFromGitAttributesFile,
|
|
|
|
parsePointerFile,
|
|
|
|
getPointerFileForMediaFileObj,
|
|
|
|
PointerFile as PF,
|
|
|
|
} from './git-lfs';
|
2020-01-15 00:15:14 +02:00
|
|
|
|
|
|
|
export type AsyncLock = AL;
|
|
|
|
export type Implementation = I;
|
|
|
|
export type ImplementationEntry = IE;
|
|
|
|
export type ImplementationMediaFile = IMF;
|
|
|
|
export type ImplementationFile = IF;
|
|
|
|
export type DisplayURL = DU;
|
|
|
|
export type DisplayURLObject = DUO;
|
|
|
|
export type Credentials = Cred;
|
|
|
|
export type User = U;
|
|
|
|
export type Entry = E;
|
|
|
|
export type UnpublishedEntryMediaFile = UEMF;
|
|
|
|
export type PersistOptions = PO;
|
|
|
|
export type AssetProxy = AP;
|
2020-04-01 06:13:27 +03:00
|
|
|
export type ApiRequest = AR;
|
2020-01-15 00:15:14 +02:00
|
|
|
export type Config = C;
|
|
|
|
export type FetchError = FE;
|
2020-01-21 18:57:36 +02:00
|
|
|
export type PointerFile = PF;
|
2020-01-15 00:15:14 +02:00
|
|
|
|
|
|
|
export const NetlifyCmsLibUtil = {
|
|
|
|
APIError,
|
|
|
|
Cursor,
|
|
|
|
CURSOR_COMPATIBILITY_SYMBOL,
|
|
|
|
EditorialWorkflowError,
|
|
|
|
EDITORIAL_WORKFLOW_ERROR,
|
|
|
|
localForage,
|
|
|
|
basename,
|
|
|
|
fileExtensionWithSeparator,
|
|
|
|
fileExtension,
|
|
|
|
onlySuccessfulPromises,
|
|
|
|
flowAsync,
|
|
|
|
then,
|
|
|
|
unsentRequest,
|
2020-04-01 06:13:27 +03:00
|
|
|
filterByExtension,
|
2020-01-15 00:15:14 +02:00
|
|
|
parseLinkHeader,
|
|
|
|
parseResponse,
|
|
|
|
responseParser,
|
|
|
|
loadScript,
|
|
|
|
getBlobSHA,
|
|
|
|
getPathDepth,
|
|
|
|
entriesByFiles,
|
|
|
|
entriesByFolder,
|
|
|
|
unpublishedEntries,
|
|
|
|
getMediaDisplayURL,
|
|
|
|
getMediaAsBlob,
|
|
|
|
readFile,
|
2020-04-01 06:13:27 +03:00
|
|
|
readFileMetadata,
|
2020-01-15 00:15:14 +02:00
|
|
|
CMS_BRANCH_PREFIX,
|
|
|
|
generateContentKey,
|
|
|
|
isCMSLabel,
|
|
|
|
labelToStatus,
|
|
|
|
statusToLabel,
|
|
|
|
DEFAULT_PR_BODY,
|
|
|
|
MERGE_COMMIT_MESSAGE,
|
|
|
|
isPreviewContext,
|
|
|
|
getPreviewStatus,
|
|
|
|
runWithLock,
|
|
|
|
PreviewState,
|
|
|
|
parseContentKey,
|
2020-01-21 18:57:36 +02:00
|
|
|
createPointerFile,
|
|
|
|
getLargeMediaFilteredMediaFiles,
|
|
|
|
getLargeMediaPatternsFromGitAttributesFile,
|
|
|
|
parsePointerFile,
|
|
|
|
getPointerFileForMediaFileObj,
|
2020-01-22 23:47:34 +02:00
|
|
|
branchFromContentKey,
|
|
|
|
contentKeyFromBranch,
|
2020-02-10 18:05:47 +02:00
|
|
|
blobToFileObj,
|
2020-04-01 06:13:27 +03:00
|
|
|
requestWithBackoff,
|
|
|
|
allEntriesByFolder,
|
2020-06-03 12:44:03 +03:00
|
|
|
AccessTokenError,
|
2020-06-09 19:03:19 +03:00
|
|
|
throwOnConflictingBranches,
|
2020-01-15 00:15:14 +02:00
|
|
|
};
|
|
|
|
export {
|
|
|
|
APIError,
|
|
|
|
Cursor,
|
|
|
|
CURSOR_COMPATIBILITY_SYMBOL,
|
|
|
|
EditorialWorkflowError,
|
|
|
|
EDITORIAL_WORKFLOW_ERROR,
|
|
|
|
localForage,
|
|
|
|
basename,
|
|
|
|
fileExtensionWithSeparator,
|
|
|
|
fileExtension,
|
|
|
|
onlySuccessfulPromises,
|
|
|
|
flowAsync,
|
|
|
|
then,
|
|
|
|
unsentRequest,
|
2020-04-01 06:13:27 +03:00
|
|
|
filterByExtension,
|
2020-01-15 00:15:14 +02:00
|
|
|
parseLinkHeader,
|
|
|
|
getAllResponses,
|
|
|
|
parseResponse,
|
|
|
|
responseParser,
|
|
|
|
loadScript,
|
|
|
|
getBlobSHA,
|
|
|
|
asyncLock,
|
|
|
|
isAbsolutePath,
|
|
|
|
getPathDepth,
|
|
|
|
entriesByFiles,
|
|
|
|
entriesByFolder,
|
|
|
|
unpublishedEntries,
|
|
|
|
getMediaDisplayURL,
|
|
|
|
getMediaAsBlob,
|
|
|
|
readFile,
|
2020-04-01 06:13:27 +03:00
|
|
|
readFileMetadata,
|
2020-01-15 00:15:14 +02:00
|
|
|
CMS_BRANCH_PREFIX,
|
|
|
|
generateContentKey,
|
|
|
|
isCMSLabel,
|
|
|
|
labelToStatus,
|
|
|
|
statusToLabel,
|
|
|
|
DEFAULT_PR_BODY,
|
|
|
|
MERGE_COMMIT_MESSAGE,
|
|
|
|
isPreviewContext,
|
|
|
|
getPreviewStatus,
|
|
|
|
runWithLock,
|
|
|
|
PreviewState,
|
|
|
|
parseContentKey,
|
2020-01-21 18:57:36 +02:00
|
|
|
createPointerFile,
|
|
|
|
getLargeMediaFilteredMediaFiles,
|
|
|
|
getLargeMediaPatternsFromGitAttributesFile,
|
|
|
|
parsePointerFile,
|
|
|
|
getPointerFileForMediaFileObj,
|
2020-01-22 23:47:34 +02:00
|
|
|
branchFromContentKey,
|
|
|
|
contentKeyFromBranch,
|
2020-02-10 18:05:47 +02:00
|
|
|
blobToFileObj,
|
2020-04-01 06:13:27 +03:00
|
|
|
requestWithBackoff,
|
|
|
|
allEntriesByFolder,
|
2020-06-03 12:44:03 +03:00
|
|
|
AccessTokenError,
|
2020-06-09 19:03:19 +03:00
|
|
|
throwOnConflictingBranches,
|
2020-01-15 00:15:14 +02:00
|
|
|
};
|