refactor: introduce type-only imports (#5462)
This commit is contained in:
parent
e4a29d5991
commit
fc07ce6854
@ -78,11 +78,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'require-atomic-updates': [0],
|
'no-duplicate-imports': [0], // handled by @typescript-eslint
|
||||||
'import/no-named-as-default': 0,
|
'@typescript-eslint/ban-types': [0], // TODO enable in future
|
||||||
'@typescript-eslint/no-non-null-assertion': [0],
|
'@typescript-eslint/no-non-null-assertion': [0],
|
||||||
'@typescript-eslint/camelcase': [0],
|
'@typescript-eslint/consistent-type-imports': 'error',
|
||||||
'@typescript-eslint/explicit-function-return-type': [0],
|
'@typescript-eslint/explicit-function-return-type': [0],
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': [0],
|
||||||
|
'@typescript-eslint/no-duplicate-imports': 'error',
|
||||||
'@typescript-eslint/no-use-before-define': [
|
'@typescript-eslint/no-use-before-define': [
|
||||||
'error',
|
'error',
|
||||||
{ functions: false, classes: true, variables: true },
|
{ functions: false, classes: true, variables: true },
|
||||||
|
@ -100,8 +100,8 @@
|
|||||||
"@types/jwt-decode": "^2.2.1",
|
"@types/jwt-decode": "^2.2.1",
|
||||||
"@types/lodash": "^4.14.149",
|
"@types/lodash": "^4.14.149",
|
||||||
"@types/uuid": "^3.4.6",
|
"@types/uuid": "^3.4.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.9.0",
|
"@typescript-eslint/eslint-plugin": "^4.25.0",
|
||||||
"@typescript-eslint/parser": "^2.9.0",
|
"@typescript-eslint/parser": "^4.25.0",
|
||||||
"all-contributors-cli": "^6.0.0",
|
"all-contributors-cli": "^6.0.0",
|
||||||
"axios": "^0.21.0",
|
"axios": "^0.21.0",
|
||||||
"babel-core": "^7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
|
2
packages/netlify-cms-app/index.d.ts
vendored
2
packages/netlify-cms-app/index.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
declare module 'netlify-cms-app' {
|
declare module 'netlify-cms-app' {
|
||||||
import { CMS } from 'netlify-cms-core';
|
import type { CMS } from 'netlify-cms-core';
|
||||||
|
|
||||||
export const NetlifyCmsApp: CMS;
|
export const NetlifyCmsApp: CMS;
|
||||||
|
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
import { partial, result, trim, trimStart } from 'lodash';
|
import { partial, result, trim, trimStart } from 'lodash';
|
||||||
|
import type { ApiRequest, AssetProxy, PersistOptions, DataFile } from 'netlify-cms-lib-util';
|
||||||
import {
|
import {
|
||||||
localForage,
|
localForage,
|
||||||
APIError,
|
APIError,
|
||||||
ApiRequest,
|
|
||||||
unsentRequest,
|
unsentRequest,
|
||||||
requestWithBackoff,
|
requestWithBackoff,
|
||||||
responseParser,
|
responseParser,
|
||||||
AssetProxy,
|
|
||||||
PersistOptions,
|
|
||||||
readFile,
|
readFile,
|
||||||
DEFAULT_PR_BODY,
|
DEFAULT_PR_BODY,
|
||||||
MERGE_COMMIT_MESSAGE,
|
MERGE_COMMIT_MESSAGE,
|
||||||
@ -20,10 +18,9 @@ import {
|
|||||||
statusToLabel,
|
statusToLabel,
|
||||||
PreviewState,
|
PreviewState,
|
||||||
readFileMetadata,
|
readFileMetadata,
|
||||||
DataFile,
|
|
||||||
branchFromContentKey,
|
branchFromContentKey,
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
import { Map } from 'immutable';
|
import type { Map } from 'immutable';
|
||||||
import { dirname, basename } from 'path';
|
import { dirname, basename } from 'path';
|
||||||
|
|
||||||
export const API_NAME = 'Azure DevOps';
|
export const API_NAME = 'Azure DevOps';
|
||||||
@ -304,7 +301,6 @@ export default class API {
|
|||||||
const url = result.coreAttributes?.Avatar?.value?.value;
|
const url = result.coreAttributes?.Avatar?.value?.value;
|
||||||
const user = {
|
const user = {
|
||||||
name: name || email || '',
|
name: name || email || '',
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
avatar_url: `data:image/png;base64,${url}`,
|
avatar_url: `data:image/png;base64,${url}`,
|
||||||
email,
|
email,
|
||||||
};
|
};
|
||||||
@ -492,7 +488,6 @@ export default class API {
|
|||||||
return statuses.map(({ context, state, targetUrl }) => ({
|
return statuses.map(({ context, state, targetUrl }) => ({
|
||||||
context: context.name,
|
context: context.name,
|
||||||
state: state === AzureCommitStatusState.SUCCEEDED ? PreviewState.Success : PreviewState.Other,
|
state: state === AzureCommitStatusState.SUCCEEDED ? PreviewState.Success : PreviewState.Other,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
target_url: targetUrl,
|
target_url: targetUrl,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,31 @@
|
|||||||
import { trimStart, trim } from 'lodash';
|
import { trimStart, trim } from 'lodash';
|
||||||
import semaphore, { Semaphore } from 'semaphore';
|
import type { Semaphore } from 'semaphore';
|
||||||
|
import semaphore from 'semaphore';
|
||||||
import AuthenticationPage from './AuthenticationPage';
|
import AuthenticationPage from './AuthenticationPage';
|
||||||
import API, { API_NAME } from './API';
|
import API, { API_NAME } from './API';
|
||||||
import {
|
import type {
|
||||||
Credentials,
|
Credentials,
|
||||||
Implementation,
|
Implementation,
|
||||||
ImplementationFile,
|
ImplementationFile,
|
||||||
ImplementationMediaFile,
|
ImplementationMediaFile,
|
||||||
DisplayURL,
|
DisplayURL,
|
||||||
basename,
|
|
||||||
Entry,
|
Entry,
|
||||||
AssetProxy,
|
AssetProxy,
|
||||||
PersistOptions,
|
PersistOptions,
|
||||||
|
Config,
|
||||||
|
AsyncLock,
|
||||||
|
User,
|
||||||
|
UnpublishedEntryMediaFile,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
|
basename,
|
||||||
getMediaDisplayURL,
|
getMediaDisplayURL,
|
||||||
generateContentKey,
|
generateContentKey,
|
||||||
getMediaAsBlob,
|
getMediaAsBlob,
|
||||||
Config,
|
|
||||||
getPreviewStatus,
|
getPreviewStatus,
|
||||||
asyncLock,
|
asyncLock,
|
||||||
AsyncLock,
|
|
||||||
runWithLock,
|
runWithLock,
|
||||||
User,
|
|
||||||
unpublishedEntries,
|
unpublishedEntries,
|
||||||
UnpublishedEntryMediaFile,
|
|
||||||
entriesByFiles,
|
entriesByFiles,
|
||||||
filterByExtension,
|
filterByExtension,
|
||||||
branchFromContentKey,
|
branchFromContentKey,
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
import { flow, get } from 'lodash';
|
import { flow, get } from 'lodash';
|
||||||
|
import type {
|
||||||
|
ApiRequest,
|
||||||
|
AssetProxy,
|
||||||
|
PersistOptions,
|
||||||
|
FetchError,
|
||||||
|
DataFile,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
import {
|
import {
|
||||||
localForage,
|
localForage,
|
||||||
unsentRequest,
|
unsentRequest,
|
||||||
@ -7,9 +14,6 @@ import {
|
|||||||
basename,
|
basename,
|
||||||
Cursor,
|
Cursor,
|
||||||
APIError,
|
APIError,
|
||||||
ApiRequest,
|
|
||||||
AssetProxy,
|
|
||||||
PersistOptions,
|
|
||||||
readFile,
|
readFile,
|
||||||
CMS_BRANCH_PREFIX,
|
CMS_BRANCH_PREFIX,
|
||||||
generateContentKey,
|
generateContentKey,
|
||||||
@ -20,13 +24,11 @@ import {
|
|||||||
DEFAULT_PR_BODY,
|
DEFAULT_PR_BODY,
|
||||||
MERGE_COMMIT_MESSAGE,
|
MERGE_COMMIT_MESSAGE,
|
||||||
PreviewState,
|
PreviewState,
|
||||||
FetchError,
|
|
||||||
parseContentKey,
|
parseContentKey,
|
||||||
branchFromContentKey,
|
branchFromContentKey,
|
||||||
requestWithBackoff,
|
requestWithBackoff,
|
||||||
readFileMetadata,
|
readFileMetadata,
|
||||||
throwOnConflictingBranches,
|
throwOnConflictingBranches,
|
||||||
DataFile,
|
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
import { dirname } from 'path';
|
import { dirname } from 'path';
|
||||||
import { oneLine } from 'common-tags';
|
import { oneLine } from 'common-tags';
|
||||||
@ -373,7 +375,6 @@ export default class API {
|
|||||||
const result: BitBucketSrcResult = await this.requestJSON({
|
const result: BitBucketSrcResult = await this.requestJSON({
|
||||||
url: `${this.repoURL}/src/${node}/${path}`,
|
url: `${this.repoURL}/src/${node}/${path}`,
|
||||||
params: {
|
params: {
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
max_depth: depth,
|
max_depth: depth,
|
||||||
pagelen,
|
pagelen,
|
||||||
},
|
},
|
||||||
@ -553,7 +554,6 @@ export default class API {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: DEFAULT_PR_BODY,
|
description: DEFAULT_PR_BODY,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
close_source_branch: true,
|
close_source_branch: true,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@ -653,8 +653,8 @@ export default class API {
|
|||||||
params: {
|
params: {
|
||||||
pagelen: 50,
|
pagelen: 50,
|
||||||
q: oneLine`
|
q: oneLine`
|
||||||
source.repository.full_name = "${this.repo}"
|
source.repository.full_name = "${this.repo}"
|
||||||
AND state = "${BitBucketPullRequestState.OPEN}"
|
AND state = "${BitBucketPullRequestState.OPEN}"
|
||||||
AND destination.branch.name = "${this.branch}"
|
AND destination.branch.name = "${this.branch}"
|
||||||
AND comment_count > 0
|
AND comment_count > 0
|
||||||
AND ${sourceQuery}
|
AND ${sourceQuery}
|
||||||
@ -725,9 +725,7 @@ export default class API {
|
|||||||
headers: { 'Content-Type': APPLICATION_JSON },
|
headers: { 'Content-Type': APPLICATION_JSON },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
message: MERGE_COMMIT_MESSAGE,
|
message: MERGE_COMMIT_MESSAGE,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
close_source_branch: true,
|
close_source_branch: true,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
merge_strategy: this.mergeStrategy,
|
merge_strategy: this.mergeStrategy,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@ -787,7 +785,6 @@ export default class API {
|
|||||||
state === BitBucketPullRequestStatusState.Successful
|
state === BitBucketPullRequestStatusState.Successful
|
||||||
? PreviewState.Success
|
? PreviewState.Success
|
||||||
: PreviewState.Other,
|
: PreviewState.Other,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
target_url: url,
|
target_url: url,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import minimatch from 'minimatch';
|
import minimatch from 'minimatch';
|
||||||
import { ApiRequest, PointerFile, unsentRequest } from 'netlify-cms-lib-util';
|
import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util';
|
||||||
|
import { unsentRequest } from 'netlify-cms-lib-util';
|
||||||
|
|
||||||
type MakeAuthorizedRequest = (req: ApiRequest) => Promise<Response>;
|
type MakeAuthorizedRequest = (req: ApiRequest) => Promise<Response>;
|
||||||
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import semaphore, { Semaphore } from 'semaphore';
|
import type { Semaphore } from 'semaphore';
|
||||||
|
import semaphore from 'semaphore';
|
||||||
import { trimStart } from 'lodash';
|
import { trimStart } from 'lodash';
|
||||||
import { stripIndent } from 'common-tags';
|
import { stripIndent } from 'common-tags';
|
||||||
import {
|
import type {
|
||||||
CURSOR_COMPATIBILITY_SYMBOL,
|
|
||||||
filterByExtension,
|
|
||||||
unsentRequest,
|
|
||||||
basename,
|
|
||||||
getBlobSHA,
|
|
||||||
Entry,
|
Entry,
|
||||||
ApiRequest,
|
ApiRequest,
|
||||||
Cursor,
|
Cursor,
|
||||||
@ -14,23 +10,30 @@ import {
|
|||||||
PersistOptions,
|
PersistOptions,
|
||||||
DisplayURL,
|
DisplayURL,
|
||||||
Implementation,
|
Implementation,
|
||||||
entriesByFolder,
|
|
||||||
entriesByFiles,
|
|
||||||
User,
|
User,
|
||||||
Credentials,
|
Credentials,
|
||||||
getMediaDisplayURL,
|
|
||||||
getMediaAsBlob,
|
|
||||||
Config,
|
Config,
|
||||||
ImplementationFile,
|
ImplementationFile,
|
||||||
|
AsyncLock,
|
||||||
|
FetchError,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
|
CURSOR_COMPATIBILITY_SYMBOL,
|
||||||
|
filterByExtension,
|
||||||
|
unsentRequest,
|
||||||
|
basename,
|
||||||
|
getBlobSHA,
|
||||||
|
entriesByFolder,
|
||||||
|
entriesByFiles,
|
||||||
|
getMediaDisplayURL,
|
||||||
|
getMediaAsBlob,
|
||||||
unpublishedEntries,
|
unpublishedEntries,
|
||||||
runWithLock,
|
runWithLock,
|
||||||
AsyncLock,
|
|
||||||
asyncLock,
|
asyncLock,
|
||||||
getPreviewStatus,
|
getPreviewStatus,
|
||||||
getLargeMediaPatternsFromGitAttributesFile,
|
getLargeMediaPatternsFromGitAttributesFile,
|
||||||
getPointerFileForMediaFileObj,
|
getPointerFileForMediaFileObj,
|
||||||
getLargeMediaFilteredMediaFiles,
|
getLargeMediaFilteredMediaFiles,
|
||||||
FetchError,
|
|
||||||
blobToFileObj,
|
blobToFileObj,
|
||||||
contentKeyFromBranch,
|
contentKeyFromBranch,
|
||||||
generateContentKey,
|
generateContentKey,
|
||||||
@ -220,9 +223,7 @@ export default class BitbucketBackend implements Implementation {
|
|||||||
name: user.display_name,
|
name: user.display_name,
|
||||||
login: user.username,
|
login: user.username,
|
||||||
token: state.token,
|
token: state.token,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
avatar_url: user.links.avatar.href,
|
avatar_url: user.links.avatar.href,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
refresh_token: state.refresh_token,
|
refresh_token: state.refresh_token,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -238,27 +239,23 @@ export default class BitbucketBackend implements Implementation {
|
|||||||
// instantiating a new Authenticator on each refresh isn't ideal,
|
// instantiating a new Authenticator on each refresh isn't ideal,
|
||||||
if (!this.authenticator) {
|
if (!this.authenticator) {
|
||||||
const cfg = {
|
const cfg = {
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
base_url: this.baseUrl,
|
base_url: this.baseUrl,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
site_id: this.siteId,
|
site_id: this.siteId,
|
||||||
};
|
};
|
||||||
this.authenticator = new NetlifyAuthenticator(cfg);
|
this.authenticator = new NetlifyAuthenticator(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refreshedTokenPromise = this.authenticator! // eslint-disable-next-line @typescript-eslint/camelcase
|
this.refreshedTokenPromise = this.authenticator!.refresh({
|
||||||
.refresh({ provider: 'bitbucket', refresh_token: this.refreshToken as string })
|
provider: 'bitbucket',
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
refresh_token: this.refreshToken as string,
|
||||||
.then(({ token, refresh_token }) => {
|
}).then(({ token, refresh_token }) => {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
this.refreshToken = refresh_token;
|
||||||
this.refreshToken = refresh_token;
|
this.refreshedTokenPromise = undefined;
|
||||||
this.refreshedTokenPromise = undefined;
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
this.updateUserCredentials({ token, refresh_token });
|
||||||
this.updateUserCredentials({ token, refresh_token });
|
return token;
|
||||||
return token;
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return this.refreshedTokenPromise;
|
return this.refreshedTokenPromise;
|
||||||
}
|
}
|
||||||
@ -320,7 +317,7 @@ export default class BitbucketBackend implements Implementation {
|
|||||||
API_NAME,
|
API_NAME,
|
||||||
);
|
);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
||||||
return files;
|
return files;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { API as GithubAPI } from 'netlify-cms-backend-github';
|
import { API as GithubAPI } from 'netlify-cms-backend-github';
|
||||||
import { Config as GitHubConfig, Diff } from 'netlify-cms-backend-github/src/API';
|
import type { Config as GitHubConfig, Diff } from 'netlify-cms-backend-github/src/API';
|
||||||
import { APIError, FetchError } from 'netlify-cms-lib-util';
|
import type { FetchError } from 'netlify-cms-lib-util';
|
||||||
import { Octokit } from '@octokit/rest';
|
import { APIError } from 'netlify-cms-lib-util';
|
||||||
|
import type { Octokit } from '@octokit/rest';
|
||||||
|
|
||||||
type Config = GitHubConfig & {
|
type Config = GitHubConfig & {
|
||||||
apiRoot: string;
|
apiRoot: string;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { API as GitlabAPI } from 'netlify-cms-backend-gitlab';
|
import { API as GitlabAPI } from 'netlify-cms-backend-gitlab';
|
||||||
import { Config as GitHubConfig, CommitAuthor } from 'netlify-cms-backend-gitlab/src/API';
|
import type { Config as GitHubConfig, CommitAuthor } from 'netlify-cms-backend-gitlab/src/API';
|
||||||
import { unsentRequest, ApiRequest } from 'netlify-cms-lib-util';
|
import type { ApiRequest } from 'netlify-cms-lib-util';
|
||||||
|
import { unsentRequest } from 'netlify-cms-lib-util';
|
||||||
|
|
||||||
type Config = GitHubConfig & { tokenPromise: () => Promise<string>; commitAuthor: CommitAuthor };
|
type Config = GitHubConfig & { tokenPromise: () => Promise<string>; commitAuthor: CommitAuthor };
|
||||||
|
|
||||||
|
@ -2,10 +2,7 @@ import GoTrue from 'gotrue-js';
|
|||||||
import jwtDecode from 'jwt-decode';
|
import jwtDecode from 'jwt-decode';
|
||||||
import { get, pick, intersection } from 'lodash';
|
import { get, pick, intersection } from 'lodash';
|
||||||
import ini from 'ini';
|
import ini from 'ini';
|
||||||
import {
|
import type {
|
||||||
APIError,
|
|
||||||
unsentRequest,
|
|
||||||
basename,
|
|
||||||
ApiRequest,
|
ApiRequest,
|
||||||
AssetProxy,
|
AssetProxy,
|
||||||
PersistOptions,
|
PersistOptions,
|
||||||
@ -15,14 +12,19 @@ import {
|
|||||||
DisplayURL,
|
DisplayURL,
|
||||||
User,
|
User,
|
||||||
Credentials,
|
Credentials,
|
||||||
entriesByFiles,
|
|
||||||
Config,
|
Config,
|
||||||
ImplementationFile,
|
ImplementationFile,
|
||||||
|
DisplayURLObject,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
|
APIError,
|
||||||
|
unsentRequest,
|
||||||
|
basename,
|
||||||
|
entriesByFiles,
|
||||||
parsePointerFile,
|
parsePointerFile,
|
||||||
getLargeMediaPatternsFromGitAttributesFile,
|
getLargeMediaPatternsFromGitAttributesFile,
|
||||||
getPointerFileForMediaFileObj,
|
getPointerFileForMediaFileObj,
|
||||||
getLargeMediaFilteredMediaFiles,
|
getLargeMediaFilteredMediaFiles,
|
||||||
DisplayURLObject,
|
|
||||||
AccessTokenError,
|
AccessTokenError,
|
||||||
PreviewState,
|
PreviewState,
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
@ -32,7 +34,8 @@ import { BitbucketBackend, API as BitBucketAPI } from 'netlify-cms-backend-bitbu
|
|||||||
import GitHubAPI from './GitHubAPI';
|
import GitHubAPI from './GitHubAPI';
|
||||||
import GitLabAPI from './GitLabAPI';
|
import GitLabAPI from './GitLabAPI';
|
||||||
import AuthenticationPage from './AuthenticationPage';
|
import AuthenticationPage from './AuthenticationPage';
|
||||||
import { getClient, Client } from './netlify-lfs-client';
|
import type { Client } from './netlify-lfs-client';
|
||||||
|
import { getClient } from './netlify-lfs-client';
|
||||||
|
|
||||||
const STATUS_PAGE = 'https://www.netlifystatus.com';
|
const STATUS_PAGE = 'https://www.netlifystatus.com';
|
||||||
const GIT_GATEWAY_STATUS_ENDPOINT = `${STATUS_PAGE}/api/v2/components.json`;
|
const GIT_GATEWAY_STATUS_ENDPOINT = `${STATUS_PAGE}/api/v2/components.json`;
|
||||||
@ -325,7 +328,6 @@ export default class GitGateway implements Implementation {
|
|||||||
const userData = {
|
const userData = {
|
||||||
name: user.user_metadata.full_name || user.email.split('@').shift()!,
|
name: user.user_metadata.full_name || user.email.split('@').shift()!,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
avatar_url: user.user_metadata.avatar_url,
|
avatar_url: user.user_metadata.avatar_url,
|
||||||
metadata: user.user_metadata,
|
metadata: user.user_metadata,
|
||||||
};
|
};
|
||||||
@ -475,10 +477,7 @@ export default class GitGateway implements Implementation {
|
|||||||
rootURL: this.netlifyLargeMediaURL,
|
rootURL: this.netlifyLargeMediaURL,
|
||||||
makeAuthorizedRequest: this.requestFunction,
|
makeAuthorizedRequest: this.requestFunction,
|
||||||
patterns,
|
patterns,
|
||||||
transformImages: this.transformImages
|
transformImages: this.transformImages ? { nf_resize: 'fit', w: 560, h: 320 } : false,
|
||||||
? // eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
{ nf_resize: 'fit', w: 560, h: 320 }
|
|
||||||
: false,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { flow, fromPairs, map } from 'lodash/fp';
|
import { flow, fromPairs, map } from 'lodash/fp';
|
||||||
import { isPlainObject, isEmpty } from 'lodash';
|
import { isPlainObject, isEmpty } from 'lodash';
|
||||||
import minimatch from 'minimatch';
|
import minimatch from 'minimatch';
|
||||||
import { ApiRequest, PointerFile, unsentRequest } from 'netlify-cms-lib-util';
|
import type { ApiRequest, PointerFile } from 'netlify-cms-lib-util';
|
||||||
|
import { unsentRequest } from 'netlify-cms-lib-util';
|
||||||
|
|
||||||
type MakeAuthorizedRequest = (req: ApiRequest) => Promise<Response>;
|
type MakeAuthorizedRequest = (req: ApiRequest) => Promise<Response>;
|
||||||
|
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
import semaphore, { Semaphore } from 'semaphore';
|
import type { Semaphore } from 'semaphore';
|
||||||
|
import semaphore from 'semaphore';
|
||||||
import { initial, last, partial, result, trimStart, trim } from 'lodash';
|
import { initial, last, partial, result, trimStart, trim } from 'lodash';
|
||||||
import { oneLine } from 'common-tags';
|
import { oneLine } from 'common-tags';
|
||||||
|
import type {
|
||||||
|
AssetProxy,
|
||||||
|
DataFile,
|
||||||
|
PersistOptions,
|
||||||
|
FetchError,
|
||||||
|
ApiRequest,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
import {
|
import {
|
||||||
getAllResponses,
|
getAllResponses,
|
||||||
APIError,
|
APIError,
|
||||||
EditorialWorkflowError,
|
EditorialWorkflowError,
|
||||||
localForage,
|
localForage,
|
||||||
basename,
|
basename,
|
||||||
AssetProxy,
|
|
||||||
DataFile,
|
|
||||||
PersistOptions,
|
|
||||||
readFileMetadata,
|
readFileMetadata,
|
||||||
CMS_BRANCH_PREFIX,
|
CMS_BRANCH_PREFIX,
|
||||||
generateContentKey,
|
generateContentKey,
|
||||||
DEFAULT_PR_BODY,
|
DEFAULT_PR_BODY,
|
||||||
MERGE_COMMIT_MESSAGE,
|
MERGE_COMMIT_MESSAGE,
|
||||||
PreviewState,
|
PreviewState,
|
||||||
FetchError,
|
|
||||||
parseContentKey,
|
parseContentKey,
|
||||||
branchFromContentKey,
|
branchFromContentKey,
|
||||||
isCMSLabel,
|
isCMSLabel,
|
||||||
@ -26,11 +30,10 @@ import {
|
|||||||
contentKeyFromBranch,
|
contentKeyFromBranch,
|
||||||
requestWithBackoff,
|
requestWithBackoff,
|
||||||
unsentRequest,
|
unsentRequest,
|
||||||
ApiRequest,
|
|
||||||
throwOnConflictingBranches,
|
throwOnConflictingBranches,
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
import { dirname } from 'path';
|
import { dirname } from 'path';
|
||||||
import { Octokit } from '@octokit/rest';
|
import type { Octokit } from '@octokit/rest';
|
||||||
|
|
||||||
type GitHubUser = Octokit.UsersGetAuthenticatedResponse;
|
type GitHubUser = Octokit.UsersGetAuthenticatedResponse;
|
||||||
type GitCreateTreeParamsTree = Octokit.GitCreateTreeParamsTree;
|
type GitCreateTreeParamsTree = Octokit.GitCreateTreeParamsTree;
|
||||||
@ -492,7 +495,6 @@ export default class API {
|
|||||||
...(head ? { head: await this.getHeadReference(head) } : {}),
|
...(head ? { head: await this.getHeadReference(head) } : {}),
|
||||||
base: this.branch,
|
base: this.branch,
|
||||||
state,
|
state,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -858,7 +860,6 @@ export default class API {
|
|||||||
);
|
);
|
||||||
return resp.statuses.map(s => ({
|
return resp.statuses.map(s => ({
|
||||||
context: s.context,
|
context: s.context,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
target_url: s.target_url,
|
target_url: s.target_url,
|
||||||
state:
|
state:
|
||||||
s.state === GitHubCommitStatusState.Success ? PreviewState.Success : PreviewState.Other,
|
s.state === GitHubCommitStatusState.Success ? PreviewState.Success : PreviewState.Other,
|
||||||
@ -1306,10 +1307,8 @@ export default class API {
|
|||||||
{
|
{
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
commit_message: MERGE_COMMIT_MESSAGE,
|
commit_message: MERGE_COMMIT_MESSAGE,
|
||||||
sha: pullrequest.head.sha,
|
sha: pullrequest.head.sha,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
merge_method: this.mergeMethod,
|
merge_method: this.mergeMethod,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@ -1415,7 +1414,6 @@ export default class API {
|
|||||||
async createTree(baseSha: string, tree: TreeEntry[]) {
|
async createTree(baseSha: string, tree: TreeEntry[]) {
|
||||||
const result: Octokit.GitCreateTreeResponse = await this.request(`${this.repoURL}/git/trees`, {
|
const result: Octokit.GitCreateTreeResponse = await this.request(`${this.repoURL}/git/trees`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
body: JSON.stringify({ base_tree: baseSha, tree }),
|
body: JSON.stringify({ base_tree: baseSha, tree }),
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { ApolloClient, QueryOptions, MutationOptions, OperationVariables } from 'apollo-client';
|
import type { QueryOptions, MutationOptions, OperationVariables } from 'apollo-client';
|
||||||
|
import { ApolloClient } from 'apollo-client';
|
||||||
|
import type { NormalizedCacheObject } from 'apollo-cache-inmemory';
|
||||||
import {
|
import {
|
||||||
InMemoryCache,
|
InMemoryCache,
|
||||||
defaultDataIdFromObject,
|
defaultDataIdFromObject,
|
||||||
IntrospectionFragmentMatcher,
|
IntrospectionFragmentMatcher,
|
||||||
NormalizedCacheObject,
|
|
||||||
} from 'apollo-cache-inmemory';
|
} from 'apollo-cache-inmemory';
|
||||||
import { createHttpLink } from 'apollo-link-http';
|
import { createHttpLink } from 'apollo-link-http';
|
||||||
import { setContext } from 'apollo-link-context';
|
import { setContext } from 'apollo-link-context';
|
||||||
@ -18,11 +19,12 @@ import {
|
|||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
import { trim, trimStart } from 'lodash';
|
import { trim, trimStart } from 'lodash';
|
||||||
import introspectionQueryResultData from './fragmentTypes';
|
import introspectionQueryResultData from './fragmentTypes';
|
||||||
import API, { Config, BlobArgs, API_NAME, PullRequestState, MOCK_PULL_REQUEST } from './API';
|
import type { Config, BlobArgs } from './API';
|
||||||
|
import API, { API_NAME, PullRequestState, MOCK_PULL_REQUEST } from './API';
|
||||||
import * as queries from './queries';
|
import * as queries from './queries';
|
||||||
import * as mutations from './mutations';
|
import * as mutations from './mutations';
|
||||||
import { GraphQLError } from 'graphql';
|
import type { GraphQLError } from 'graphql';
|
||||||
import { Octokit } from '@octokit/rest';
|
import type { Octokit } from '@octokit/rest';
|
||||||
|
|
||||||
const NO_CACHE = 'no-cache';
|
const NO_CACHE = 'no-cache';
|
||||||
const CACHE_FIRST = 'cache-first';
|
const CACHE_FIRST = 'cache-first';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import gql from 'graphql-tag';
|
import { gql } from 'graphql-tag';
|
||||||
|
|
||||||
export const repository = gql`
|
export const repository = gql`
|
||||||
fragment RepositoryParts on Repository {
|
fragment RepositoryParts on Repository {
|
||||||
|
@ -1,39 +1,42 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import semaphore, { Semaphore } from 'semaphore';
|
import type { Semaphore } from 'semaphore';
|
||||||
|
import semaphore from 'semaphore';
|
||||||
import trimStart from 'lodash/trimStart';
|
import trimStart from 'lodash/trimStart';
|
||||||
import { stripIndent } from 'common-tags';
|
import { stripIndent } from 'common-tags';
|
||||||
import {
|
import type {
|
||||||
CURSOR_COMPATIBILITY_SYMBOL,
|
|
||||||
Cursor,
|
|
||||||
asyncLock,
|
|
||||||
basename,
|
|
||||||
AsyncLock,
|
AsyncLock,
|
||||||
Implementation,
|
Implementation,
|
||||||
AssetProxy,
|
AssetProxy,
|
||||||
PersistOptions,
|
PersistOptions,
|
||||||
DisplayURL,
|
DisplayURL,
|
||||||
|
User,
|
||||||
|
Credentials,
|
||||||
|
Config,
|
||||||
|
ImplementationFile,
|
||||||
|
UnpublishedEntryMediaFile,
|
||||||
|
Entry,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
|
CURSOR_COMPATIBILITY_SYMBOL,
|
||||||
|
Cursor,
|
||||||
|
asyncLock,
|
||||||
|
basename,
|
||||||
getBlobSHA,
|
getBlobSHA,
|
||||||
entriesByFolder,
|
entriesByFolder,
|
||||||
entriesByFiles,
|
entriesByFiles,
|
||||||
unpublishedEntries,
|
unpublishedEntries,
|
||||||
User,
|
|
||||||
getMediaDisplayURL,
|
getMediaDisplayURL,
|
||||||
getMediaAsBlob,
|
getMediaAsBlob,
|
||||||
Credentials,
|
|
||||||
filterByExtension,
|
filterByExtension,
|
||||||
Config,
|
|
||||||
ImplementationFile,
|
|
||||||
getPreviewStatus,
|
getPreviewStatus,
|
||||||
UnpublishedEntryMediaFile,
|
|
||||||
runWithLock,
|
runWithLock,
|
||||||
blobToFileObj,
|
blobToFileObj,
|
||||||
contentKeyFromBranch,
|
contentKeyFromBranch,
|
||||||
unsentRequest,
|
unsentRequest,
|
||||||
branchFromContentKey,
|
branchFromContentKey,
|
||||||
Entry,
|
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
import AuthenticationPage from './AuthenticationPage';
|
import AuthenticationPage from './AuthenticationPage';
|
||||||
import { Octokit } from '@octokit/rest';
|
import type { Octokit } from '@octokit/rest';
|
||||||
import API, { API_NAME } from './API';
|
import API, { API_NAME } from './API';
|
||||||
import GraphQLAPI from './GraphQLAPI';
|
import GraphQLAPI from './GraphQLAPI';
|
||||||
|
|
||||||
@ -391,7 +394,7 @@ export default class GitHub implements Implementation {
|
|||||||
this.api!.readFileMetadata.bind(this.api),
|
this.api!.readFileMetadata.bind(this.api),
|
||||||
API_NAME,
|
API_NAME,
|
||||||
);
|
);
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
||||||
return files;
|
return files;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import gql from 'graphql-tag';
|
import { gql } from 'graphql-tag';
|
||||||
import * as fragments from './fragments';
|
import * as fragments from './fragments';
|
||||||
|
|
||||||
// updateRef only works for branches at the moment
|
// updateRef only works for branches at the moment
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import gql from 'graphql-tag';
|
import { gql } from 'graphql-tag';
|
||||||
import { oneLine } from 'common-tags';
|
import { oneLine } from 'common-tags';
|
||||||
import * as fragments from './fragments';
|
import * as fragments from './fragments';
|
||||||
|
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
import type {
|
||||||
|
ApiRequest,
|
||||||
|
DataFile,
|
||||||
|
AssetProxy,
|
||||||
|
PersistOptions,
|
||||||
|
FetchError,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
import {
|
import {
|
||||||
localForage,
|
localForage,
|
||||||
parseLinkHeader,
|
parseLinkHeader,
|
||||||
@ -5,10 +12,6 @@ import {
|
|||||||
then,
|
then,
|
||||||
APIError,
|
APIError,
|
||||||
Cursor,
|
Cursor,
|
||||||
ApiRequest,
|
|
||||||
DataFile,
|
|
||||||
AssetProxy,
|
|
||||||
PersistOptions,
|
|
||||||
readFile,
|
readFile,
|
||||||
CMS_BRANCH_PREFIX,
|
CMS_BRANCH_PREFIX,
|
||||||
generateContentKey,
|
generateContentKey,
|
||||||
@ -24,7 +27,6 @@ import {
|
|||||||
branchFromContentKey,
|
branchFromContentKey,
|
||||||
requestWithBackoff,
|
requestWithBackoff,
|
||||||
readFileMetadata,
|
readFileMetadata,
|
||||||
FetchError,
|
|
||||||
throwOnConflictingBranches,
|
throwOnConflictingBranches,
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
@ -301,7 +303,6 @@ export default class API {
|
|||||||
try {
|
try {
|
||||||
const result: GitLabCommit[] = await this.requestJSON({
|
const result: GitLabCommit[] = await this.requestJSON({
|
||||||
url: `${this.repoURL}/repository/commits`,
|
url: `${this.repoURL}/repository/commits`,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
params: { path, ref_name: this.branch },
|
params: { path, ref_name: this.branch },
|
||||||
});
|
});
|
||||||
const commit = result[0];
|
const commit = result[0];
|
||||||
@ -396,7 +397,6 @@ export default class API {
|
|||||||
let { cursor, entries: initialEntries } = await this.fetchCursorAndEntries({
|
let { cursor, entries: initialEntries } = await this.fetchCursorAndEntries({
|
||||||
url: `${this.repoURL}/repository/tree`,
|
url: `${this.repoURL}/repository/tree`,
|
||||||
// Get the maximum number of entries per page
|
// Get the maximum number of entries per page
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
params: { path, ref: branch, per_page: 100, recursive },
|
params: { path, ref: branch, per_page: 100, recursive },
|
||||||
});
|
});
|
||||||
entries.push(...initialEntries);
|
entries.push(...initialEntries);
|
||||||
@ -425,9 +425,7 @@ export default class API {
|
|||||||
) {
|
) {
|
||||||
const actions = items.map(item => ({
|
const actions = items.map(item => ({
|
||||||
action: item.action,
|
action: item.action,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
file_path: item.path,
|
file_path: item.path,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
...(item.oldPath ? { previous_path: item.oldPath } : {}),
|
...(item.oldPath ? { previous_path: item.oldPath } : {}),
|
||||||
...(item.base64Content !== undefined
|
...(item.base64Content !== undefined
|
||||||
? { content: item.base64Content, encoding: 'base64' }
|
? { content: item.base64Content, encoding: 'base64' }
|
||||||
@ -436,17 +434,13 @@ export default class API {
|
|||||||
|
|
||||||
const commitParams: CommitsParams = {
|
const commitParams: CommitsParams = {
|
||||||
branch,
|
branch,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
commit_message: commitMessage,
|
commit_message: commitMessage,
|
||||||
actions,
|
actions,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
...(newBranch ? { start_branch: this.branch } : {}),
|
...(newBranch ? { start_branch: this.branch } : {}),
|
||||||
};
|
};
|
||||||
if (this.commitAuthor) {
|
if (this.commitAuthor) {
|
||||||
const { name, email } = this.commitAuthor;
|
const { name, email } = this.commitAuthor;
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
commitParams.author_name = name;
|
commitParams.author_name = name;
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
commitParams.author_email = email;
|
commitParams.author_email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,13 +522,10 @@ export default class API {
|
|||||||
|
|
||||||
deleteFiles = (paths: string[], commitMessage: string) => {
|
deleteFiles = (paths: string[], commitMessage: string) => {
|
||||||
const branch = this.branch;
|
const branch = this.branch;
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
const commitParams: CommitsParams = { commit_message: commitMessage, branch };
|
const commitParams: CommitsParams = { commit_message: commitMessage, branch };
|
||||||
if (this.commitAuthor) {
|
if (this.commitAuthor) {
|
||||||
const { name, email } = this.commitAuthor;
|
const { name, email } = this.commitAuthor;
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
commitParams.author_name = name;
|
commitParams.author_name = name;
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
commitParams.author_email = email;
|
commitParams.author_email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,9 +542,7 @@ export default class API {
|
|||||||
state: 'opened',
|
state: 'opened',
|
||||||
labels: 'Any',
|
labels: 'Any',
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
target_branch: this.branch,
|
target_branch: this.branch,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
...(sourceBranch ? { source_branch: sourceBranch } : {}),
|
...(sourceBranch ? { source_branch: sourceBranch } : {}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -686,7 +675,6 @@ export default class API {
|
|||||||
rebase = await this.requestJSON({
|
rebase = await this.requestJSON({
|
||||||
url: `${this.repoURL}/merge_requests/${mergeRequest.iid}`,
|
url: `${this.repoURL}/merge_requests/${mergeRequest.iid}`,
|
||||||
params: {
|
params: {
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
include_rebase_in_progress: true,
|
include_rebase_in_progress: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -708,14 +696,11 @@ export default class API {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `${this.repoURL}/merge_requests`,
|
url: `${this.repoURL}/merge_requests`,
|
||||||
params: {
|
params: {
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
source_branch: branch,
|
source_branch: branch,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
target_branch: this.branch,
|
target_branch: this.branch,
|
||||||
title: commitMessage,
|
title: commitMessage,
|
||||||
description: DEFAULT_PR_BODY,
|
description: DEFAULT_PR_BODY,
|
||||||
labels: statusToLabel(status, this.cmsLabelPrefix),
|
labels: statusToLabel(status, this.cmsLabelPrefix),
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
remove_source_branch: true,
|
remove_source_branch: true,
|
||||||
squash: this.squashMerges,
|
squash: this.squashMerges,
|
||||||
},
|
},
|
||||||
@ -790,12 +775,9 @@ export default class API {
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
url: `${this.repoURL}/merge_requests/${mergeRequest.iid}/merge`,
|
url: `${this.repoURL}/merge_requests/${mergeRequest.iid}/merge`,
|
||||||
params: {
|
params: {
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
merge_commit_message: MERGE_COMMIT_MESSAGE,
|
merge_commit_message: MERGE_COMMIT_MESSAGE,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
squash_commit_message: MERGE_COMMIT_MESSAGE,
|
squash_commit_message: MERGE_COMMIT_MESSAGE,
|
||||||
squash: this.squashMerges,
|
squash: this.squashMerges,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
should_remove_source_branch: true,
|
should_remove_source_branch: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -813,7 +795,6 @@ export default class API {
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
url: `${this.repoURL}/merge_requests/${mergeRequest.iid}`,
|
url: `${this.repoURL}/merge_requests/${mergeRequest.iid}`,
|
||||||
params: {
|
params: {
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
state_event: 'close',
|
state_event: 'close',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -864,11 +845,9 @@ export default class API {
|
|||||||
const branch = branchFromContentKey(contentKey);
|
const branch = branchFromContentKey(contentKey);
|
||||||
const mergeRequest = await this.getBranchMergeRequest(branch);
|
const mergeRequest = await this.getBranchMergeRequest(branch);
|
||||||
const statuses: GitLabCommitStatus[] = await this.getMergeRequestStatues(mergeRequest, branch);
|
const statuses: GitLabCommitStatus[] = await this.getMergeRequestStatues(mergeRequest, branch);
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
return statuses.map(({ name, status, target_url }) => ({
|
return statuses.map(({ name, status, target_url }) => ({
|
||||||
context: name,
|
context: name,
|
||||||
state: status === GitLabCommitStatuses.Success ? PreviewState.Success : PreviewState.Other,
|
state: status === GitLabCommitStatuses.Success ? PreviewState.Success : PreviewState.Other,
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
target_url,
|
target_url,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,32 @@
|
|||||||
import trimStart from 'lodash/trimStart';
|
import trimStart from 'lodash/trimStart';
|
||||||
import semaphore, { Semaphore } from 'semaphore';
|
import type { Semaphore } from 'semaphore';
|
||||||
|
import semaphore from 'semaphore';
|
||||||
import { trim } from 'lodash';
|
import { trim } from 'lodash';
|
||||||
import { stripIndent } from 'common-tags';
|
import { stripIndent } from 'common-tags';
|
||||||
import {
|
import type {
|
||||||
CURSOR_COMPATIBILITY_SYMBOL,
|
|
||||||
basename,
|
|
||||||
Entry,
|
Entry,
|
||||||
AssetProxy,
|
AssetProxy,
|
||||||
PersistOptions,
|
PersistOptions,
|
||||||
Cursor,
|
Cursor,
|
||||||
Implementation,
|
Implementation,
|
||||||
DisplayURL,
|
DisplayURL,
|
||||||
entriesByFolder,
|
|
||||||
entriesByFiles,
|
|
||||||
getMediaDisplayURL,
|
|
||||||
getMediaAsBlob,
|
|
||||||
User,
|
User,
|
||||||
Credentials,
|
Credentials,
|
||||||
Config,
|
Config,
|
||||||
ImplementationFile,
|
ImplementationFile,
|
||||||
|
UnpublishedEntryMediaFile,
|
||||||
|
AsyncLock,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
|
CURSOR_COMPATIBILITY_SYMBOL,
|
||||||
|
basename,
|
||||||
|
entriesByFolder,
|
||||||
|
entriesByFiles,
|
||||||
|
getMediaDisplayURL,
|
||||||
|
getMediaAsBlob,
|
||||||
unpublishedEntries,
|
unpublishedEntries,
|
||||||
getPreviewStatus,
|
getPreviewStatus,
|
||||||
UnpublishedEntryMediaFile,
|
|
||||||
asyncLock,
|
asyncLock,
|
||||||
AsyncLock,
|
|
||||||
runWithLock,
|
runWithLock,
|
||||||
getBlobSHA,
|
getBlobSHA,
|
||||||
blobToFileObj,
|
blobToFileObj,
|
||||||
@ -178,7 +181,7 @@ export default class GitLab implements Implementation {
|
|||||||
this.api!.readFileMetadata.bind(this.api),
|
this.api!.readFileMetadata.bind(this.api),
|
||||||
API_NAME,
|
API_NAME,
|
||||||
);
|
);
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
||||||
return files;
|
return files;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {
|
import type {
|
||||||
Entry,
|
Entry,
|
||||||
AssetProxy,
|
AssetProxy,
|
||||||
PersistOptions,
|
PersistOptions,
|
||||||
@ -6,10 +6,12 @@ import {
|
|||||||
Config,
|
Config,
|
||||||
Implementation,
|
Implementation,
|
||||||
ImplementationFile,
|
ImplementationFile,
|
||||||
|
UnpublishedEntry,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
EditorialWorkflowError,
|
EditorialWorkflowError,
|
||||||
APIError,
|
APIError,
|
||||||
unsentRequest,
|
unsentRequest,
|
||||||
UnpublishedEntry,
|
|
||||||
blobToFileObj,
|
blobToFileObj,
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
import AuthenticationPage from './AuthenticationPage';
|
import AuthenticationPage from './AuthenticationPage';
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import { attempt, isError, take, unset, isEmpty } from 'lodash';
|
import { attempt, isError, take, unset, isEmpty } from 'lodash';
|
||||||
import uuid from 'uuid/v4';
|
import uuid from 'uuid/v4';
|
||||||
import {
|
import type {
|
||||||
EditorialWorkflowError,
|
|
||||||
Cursor,
|
|
||||||
CURSOR_COMPATIBILITY_SYMBOL,
|
|
||||||
basename,
|
|
||||||
Implementation,
|
Implementation,
|
||||||
Entry,
|
Entry,
|
||||||
ImplementationEntry,
|
ImplementationEntry,
|
||||||
@ -15,6 +11,12 @@ import {
|
|||||||
ImplementationFile,
|
ImplementationFile,
|
||||||
DataFile,
|
DataFile,
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
|
EditorialWorkflowError,
|
||||||
|
Cursor,
|
||||||
|
CURSOR_COMPATIBILITY_SYMBOL,
|
||||||
|
basename,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
import { extname, dirname } from 'path';
|
import { extname, dirname } from 'path';
|
||||||
import AuthenticationPage from './AuthenticationPage';
|
import AuthenticationPage from './AuthenticationPage';
|
||||||
|
|
||||||
@ -199,7 +201,7 @@ export default class TestBackend implements Implementation {
|
|||||||
}));
|
}));
|
||||||
const cursor = getCursor(folder, extension, entries, 0, depth);
|
const cursor = getCursor(folder, extension, entries, 0, depth);
|
||||||
const ret = take(entries, pageSize);
|
const ret = take(entries, pageSize);
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
ret[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
ret[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
|
||||||
return Promise.resolve(ret);
|
return Promise.resolve(ret);
|
||||||
|
4
packages/netlify-cms-core/index.d.ts
vendored
4
packages/netlify-cms-core/index.d.ts
vendored
@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
declare module 'netlify-cms-core' {
|
declare module 'netlify-cms-core' {
|
||||||
import React, { ComponentType } from 'react';
|
import type { ComponentType } from 'react';
|
||||||
import { List, Map } from 'immutable';
|
import type { List, Map } from 'immutable';
|
||||||
|
|
||||||
export type CmsBackendType =
|
export type CmsBackendType =
|
||||||
| 'azure'
|
| 'azure'
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { Map } from 'immutable';
|
import { Map } from 'immutable';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
import thunk, { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { AnyAction } from 'redux';
|
import thunk from 'redux-thunk';
|
||||||
|
import type { AnyAction } from 'redux';
|
||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'ts-jest/utils';
|
||||||
import { getAsset, ADD_ASSET, LOAD_ASSET_REQUEST } from '../media';
|
import { getAsset, ADD_ASSET, LOAD_ASSET_REQUEST } from '../media';
|
||||||
import { selectMediaFilePath } from '../../reducers/entries';
|
import { selectMediaFilePath } from '../../reducers/entries';
|
||||||
import { State } from '../../types/redux';
|
import type { State } from '../../types/redux';
|
||||||
import AssetProxy from '../../valueObjects/AssetProxy';
|
import AssetProxy from '../../valueObjects/AssetProxy';
|
||||||
|
|
||||||
const middlewares = [thunk];
|
const middlewares = [thunk];
|
||||||
@ -25,7 +26,7 @@ describe('media', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getAsset', () => {
|
describe('getAsset', () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
global.URL = { createObjectURL: jest.fn() };
|
global.URL = { createObjectURL: jest.fn() };
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ describe('media', () => {
|
|||||||
|
|
||||||
// TODO change to proper payload when immutable is removed
|
// TODO change to proper payload when immutable is removed
|
||||||
// from 'collections' and 'entries' state slices
|
// from 'collections' and 'entries' state slices
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const result = store.dispatch(getAsset(payload));
|
const result = store.dispatch(getAsset(payload));
|
||||||
const actions = store.getActions();
|
const actions = store.getActions();
|
||||||
@ -54,7 +55,7 @@ describe('media', () => {
|
|||||||
const store = mockStore({
|
const store = mockStore({
|
||||||
// TODO change to proper store data when immutable is removed
|
// TODO change to proper store data when immutable is removed
|
||||||
// from 'config' state slice
|
// from 'config' state slice
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
config: Map(),
|
config: Map(),
|
||||||
medias: {
|
medias: {
|
||||||
@ -67,7 +68,7 @@ describe('media', () => {
|
|||||||
|
|
||||||
// TODO change to proper payload when immutable is removed
|
// TODO change to proper payload when immutable is removed
|
||||||
// from 'collections' and 'entries' state slices
|
// from 'collections' and 'entries' state slices
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const result = store.dispatch(getAsset(payload));
|
const result = store.dispatch(getAsset(payload));
|
||||||
const actions = store.getActions();
|
const actions = store.getActions();
|
||||||
@ -97,7 +98,7 @@ describe('media', () => {
|
|||||||
|
|
||||||
// TODO change to proper payload when immutable is removed
|
// TODO change to proper payload when immutable is removed
|
||||||
// from 'collections' state slice
|
// from 'collections' state slice
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const result = store.dispatch(getAsset(payload));
|
const result = store.dispatch(getAsset(payload));
|
||||||
const actions = store.getActions();
|
const actions = store.getActions();
|
||||||
@ -120,7 +121,7 @@ describe('media', () => {
|
|||||||
|
|
||||||
// TODO change to proper payload when immutable is removed
|
// TODO change to proper payload when immutable is removed
|
||||||
// from 'collections' and 'entries' state slices
|
// from 'collections' and 'entries' state slices
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const result = store.dispatch(getAsset(payload));
|
const result = store.dispatch(getAsset(payload));
|
||||||
const actions = store.getActions();
|
const actions = store.getActions();
|
||||||
@ -150,7 +151,7 @@ describe('media', () => {
|
|||||||
|
|
||||||
// TODO change to proper payload when immutable is removed
|
// TODO change to proper payload when immutable is removed
|
||||||
// from 'collections' and 'entries' state slices
|
// from 'collections' and 'entries' state slices
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const result = store.dispatch(getAsset(payload));
|
const result = store.dispatch(getAsset(payload));
|
||||||
const actions = store.getActions();
|
const actions = store.getActions();
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { actions as notifActions } from 'redux-notifications';
|
import { actions as notifActions } from 'redux-notifications';
|
||||||
import { Credentials, User } from 'netlify-cms-lib-util';
|
import type { Credentials, User } from 'netlify-cms-lib-util';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { currentBackend } from '../backend';
|
import { currentBackend } from '../backend';
|
||||||
import { State } from '../types/redux';
|
import type { State } from '../types/redux';
|
||||||
|
|
||||||
const { notifSend, notifClear } = notifActions;
|
const { notifSend, notifClear } = notifActions;
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ import { fromJS } from 'immutable';
|
|||||||
import deepmerge from 'deepmerge';
|
import deepmerge from 'deepmerge';
|
||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
import { trimStart, trim, isEmpty } from 'lodash';
|
import { trimStart, trim, isEmpty } from 'lodash';
|
||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { SIMPLE as SIMPLE_PUBLISH_MODE } from '../constants/publishModes';
|
import { SIMPLE as SIMPLE_PUBLISH_MODE } from '../constants/publishModes';
|
||||||
import { validateConfig } from '../constants/configSchema';
|
import { validateConfig } from '../constants/configSchema';
|
||||||
import { selectDefaultSortableFields } from '../reducers/collections';
|
import { selectDefaultSortableFields } from '../reducers/collections';
|
||||||
@ -12,7 +12,7 @@ import { getIntegrations, selectIntegration } from '../reducers/integrations';
|
|||||||
import { resolveBackend } from '../backend';
|
import { resolveBackend } from '../backend';
|
||||||
import { I18N, I18N_FIELD, I18N_STRUCTURE } from '../lib/i18n';
|
import { I18N, I18N_FIELD, I18N_STRUCTURE } from '../lib/i18n';
|
||||||
import { FILES, FOLDER } from '../constants/collectionTypes';
|
import { FILES, FOLDER } from '../constants/collectionTypes';
|
||||||
import {
|
import type {
|
||||||
CmsCollection,
|
CmsCollection,
|
||||||
CmsConfig,
|
CmsConfig,
|
||||||
CmsField,
|
CmsField,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { actions as notifActions } from 'redux-notifications';
|
import { actions as notifActions } from 'redux-notifications';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { currentBackend } from '../backend';
|
import { currentBackend } from '../backend';
|
||||||
import { selectDeployPreview } from '../reducers';
|
import { selectDeployPreview } from '../reducers';
|
||||||
import { Collection, Entry, State } from '../types/redux';
|
import type { Collection, Entry, State } from '../types/redux';
|
||||||
|
|
||||||
const { notifSend } = notifActions;
|
const { notifSend } = notifActions;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import { actions as notifActions } from 'redux-notifications';
|
import { actions as notifActions } from 'redux-notifications';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { Map, List } from 'immutable';
|
import { Map, List } from 'immutable';
|
||||||
import { currentBackend, slugFromCustomPath } from '../backend';
|
import { currentBackend, slugFromCustomPath } from '../backend';
|
||||||
import {
|
import {
|
||||||
@ -10,7 +10,8 @@ import {
|
|||||||
selectUnpublishedEntry,
|
selectUnpublishedEntry,
|
||||||
} from '../reducers';
|
} from '../reducers';
|
||||||
import { selectEditingDraft } from '../reducers/entries';
|
import { selectEditingDraft } from '../reducers/entries';
|
||||||
import { EDITORIAL_WORKFLOW, status, Status } from '../constants/publishModes';
|
import type { Status } from '../constants/publishModes';
|
||||||
|
import { EDITORIAL_WORKFLOW, status } from '../constants/publishModes';
|
||||||
import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util';
|
import { EDITORIAL_WORKFLOW_ERROR } from 'netlify-cms-lib-util';
|
||||||
import {
|
import {
|
||||||
loadEntry,
|
loadEntry,
|
||||||
@ -24,9 +25,16 @@ import { createAssetProxy } from '../valueObjects/AssetProxy';
|
|||||||
import { addAssets } from './media';
|
import { addAssets } from './media';
|
||||||
import { loadMedia } from './mediaLibrary';
|
import { loadMedia } from './mediaLibrary';
|
||||||
import ValidationErrorTypes from '../constants/validationErrorTypes';
|
import ValidationErrorTypes from '../constants/validationErrorTypes';
|
||||||
import { Collection, EntryMap, State, Collections, EntryDraft, MediaFile } from '../types/redux';
|
import type {
|
||||||
import { AnyAction } from 'redux';
|
Collection,
|
||||||
import { EntryValue } from '../valueObjects/Entry';
|
EntryMap,
|
||||||
|
State,
|
||||||
|
Collections,
|
||||||
|
EntryDraft,
|
||||||
|
MediaFile,
|
||||||
|
} from '../types/redux';
|
||||||
|
import type { AnyAction } from 'redux';
|
||||||
|
import type { EntryValue } from '../valueObjects/Entry';
|
||||||
import { navigateToEntry } from '../routing/history';
|
import { navigateToEntry } from '../routing/history';
|
||||||
|
|
||||||
const { notifSend } = notifActions;
|
const { notifSend } = notifActions;
|
||||||
|
@ -1,31 +1,36 @@
|
|||||||
import { fromJS, List, Map, Set } from 'immutable';
|
import type { Set } from 'immutable';
|
||||||
|
import { fromJS, List, Map } from 'immutable';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
import { actions as notifActions } from 'redux-notifications';
|
import { actions as notifActions } from 'redux-notifications';
|
||||||
import { serializeValues } from '../lib/serializeEntryValues';
|
import { serializeValues } from '../lib/serializeEntryValues';
|
||||||
import { currentBackend, Backend } from '../backend';
|
import type { Backend } from '../backend';
|
||||||
|
import { currentBackend } from '../backend';
|
||||||
import { getIntegrationProvider } from '../integrations';
|
import { getIntegrationProvider } from '../integrations';
|
||||||
import { selectIntegration, selectPublishedSlugs } from '../reducers';
|
import { selectIntegration, selectPublishedSlugs } from '../reducers';
|
||||||
import { selectFields, updateFieldByKey } from '../reducers/collections';
|
import { selectFields, updateFieldByKey } from '../reducers/collections';
|
||||||
import { selectCollectionEntriesCursor } from '../reducers/cursors';
|
import { selectCollectionEntriesCursor } from '../reducers/cursors';
|
||||||
import { Cursor, ImplementationMediaFile } from 'netlify-cms-lib-util';
|
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
|
||||||
import { createEntry, EntryValue } from '../valueObjects/Entry';
|
import { Cursor } from 'netlify-cms-lib-util';
|
||||||
import AssetProxy, { createAssetProxy } from '../valueObjects/AssetProxy';
|
import type { EntryValue } from '../valueObjects/Entry';
|
||||||
|
import { createEntry } from '../valueObjects/Entry';
|
||||||
|
import type AssetProxy from '../valueObjects/AssetProxy';
|
||||||
|
import { createAssetProxy } from '../valueObjects/AssetProxy';
|
||||||
import ValidationErrorTypes from '../constants/validationErrorTypes';
|
import ValidationErrorTypes from '../constants/validationErrorTypes';
|
||||||
import { addAssets, getAsset } from './media';
|
import { addAssets, getAsset } from './media';
|
||||||
import {
|
import type {
|
||||||
Collection,
|
Collection,
|
||||||
EntryMap,
|
EntryMap,
|
||||||
State,
|
State,
|
||||||
EntryFields,
|
EntryFields,
|
||||||
EntryField,
|
EntryField,
|
||||||
SortDirection,
|
|
||||||
ViewFilter,
|
ViewFilter,
|
||||||
ViewGroup,
|
ViewGroup,
|
||||||
Entry,
|
Entry,
|
||||||
} from '../types/redux';
|
} from '../types/redux';
|
||||||
|
import { SortDirection } from '../types/redux';
|
||||||
|
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { waitForMediaLibraryToLoad, loadMedia } from './mediaLibrary';
|
import { waitForMediaLibraryToLoad, loadMedia } from './mediaLibrary';
|
||||||
import { waitUntil } from './waitUntil';
|
import { waitUntil } from './waitUntil';
|
||||||
import { selectIsFetching, selectEntriesSortFields, selectEntryByPath } from '../reducers/entries';
|
import { selectIsFetching, selectEntriesSortFields, selectEntryByPath } from '../reducers/entries';
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import AssetProxy, { createAssetProxy } from '../valueObjects/AssetProxy';
|
import type AssetProxy from '../valueObjects/AssetProxy';
|
||||||
import { Collection, State, EntryMap, EntryField } from '../types/redux';
|
import { createAssetProxy } from '../valueObjects/AssetProxy';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { Collection, State, EntryMap, EntryField } from '../types/redux';
|
||||||
import { AnyAction } from 'redux';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
|
import type { AnyAction } from 'redux';
|
||||||
import { isAbsolutePath } from 'netlify-cms-lib-util';
|
import { isAbsolutePath } from 'netlify-cms-lib-util';
|
||||||
import { selectMediaFilePath } from '../reducers/entries';
|
import { selectMediaFilePath } from '../reducers/entries';
|
||||||
import { selectMediaFileByPath } from '../reducers/mediaLibrary';
|
import { selectMediaFileByPath } from '../reducers/mediaLibrary';
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { Map } from 'immutable';
|
import { Map } from 'immutable';
|
||||||
import { actions as notifActions } from 'redux-notifications';
|
import { actions as notifActions } from 'redux-notifications';
|
||||||
import { basename, getBlobSHA, ImplementationMediaFile } from 'netlify-cms-lib-util';
|
import type { ImplementationMediaFile } from 'netlify-cms-lib-util';
|
||||||
|
import { basename, getBlobSHA } from 'netlify-cms-lib-util';
|
||||||
import { currentBackend } from '../backend';
|
import { currentBackend } from '../backend';
|
||||||
import AssetProxy, { createAssetProxy } from '../valueObjects/AssetProxy';
|
import type AssetProxy from '../valueObjects/AssetProxy';
|
||||||
|
import { createAssetProxy } from '../valueObjects/AssetProxy';
|
||||||
import { selectIntegration } from '../reducers';
|
import { selectIntegration } from '../reducers';
|
||||||
import {
|
import {
|
||||||
selectMediaFilePath,
|
selectMediaFilePath,
|
||||||
@ -14,15 +16,15 @@ import { getIntegrationProvider } from '../integrations';
|
|||||||
import { addAsset, removeAsset } from './media';
|
import { addAsset, removeAsset } from './media';
|
||||||
import { addDraftEntryMediaFile, removeDraftEntryMediaFile } from './entries';
|
import { addDraftEntryMediaFile, removeDraftEntryMediaFile } from './entries';
|
||||||
import { sanitizeSlug } from '../lib/urlHelper';
|
import { sanitizeSlug } from '../lib/urlHelper';
|
||||||
import {
|
import type {
|
||||||
State,
|
State,
|
||||||
MediaFile,
|
MediaFile,
|
||||||
DisplayURLState,
|
DisplayURLState,
|
||||||
MediaLibraryInstance,
|
MediaLibraryInstance,
|
||||||
EntryField,
|
EntryField,
|
||||||
} from '../types/redux';
|
} from '../types/redux';
|
||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { waitUntilWithTimeout } from './waitUntil';
|
import { waitUntilWithTimeout } from './waitUntil';
|
||||||
|
|
||||||
const { notifSend } = notifActions;
|
const { notifSend } = notifActions;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
import { State } from '../types/redux';
|
import type { State } from '../types/redux';
|
||||||
import { currentBackend } from '../backend';
|
import { currentBackend } from '../backend';
|
||||||
import { getIntegrationProvider } from '../integrations';
|
import { getIntegrationProvider } from '../integrations';
|
||||||
import { selectIntegration } from '../reducers';
|
import { selectIntegration } from '../reducers';
|
||||||
import { EntryValue } from '../valueObjects/Entry';
|
import type { EntryValue } from '../valueObjects/Entry';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constant Declarations
|
* Constant Declarations
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ThunkDispatch } from 'redux-thunk';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { actions as notifActions } from 'redux-notifications';
|
import { actions as notifActions } from 'redux-notifications';
|
||||||
import { State } from '../types/redux';
|
import type { State } from '../types/redux';
|
||||||
import { currentBackend } from '../backend';
|
import { currentBackend } from '../backend';
|
||||||
|
|
||||||
const { notifSend, notifDismiss } = notifActions;
|
const { notifSend, notifDismiss } = notifActions;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { WAIT_UNTIL_ACTION, WaitActionArgs } from '../redux/middleware/waitUntilAction';
|
import type { WaitActionArgs } from '../redux/middleware/waitUntilAction';
|
||||||
import { ThunkDispatch } from 'redux-thunk';
|
import { WAIT_UNTIL_ACTION } from '../redux/middleware/waitUntilAction';
|
||||||
import { AnyAction } from 'redux';
|
import type { ThunkDispatch } from 'redux-thunk';
|
||||||
import { State } from '../types/redux';
|
import type { AnyAction } from 'redux';
|
||||||
|
import type { State } from '../types/redux';
|
||||||
|
|
||||||
export function waitUntil({ predicate, run }: WaitActionArgs) {
|
export function waitUntil({ predicate, run }: WaitActionArgs) {
|
||||||
return {
|
return {
|
||||||
|
@ -1,24 +1,27 @@
|
|||||||
import { attempt, flatten, isError, uniq, trim, sortBy, get, set } from 'lodash';
|
import { attempt, flatten, isError, uniq, trim, sortBy, get, set } from 'lodash';
|
||||||
import { List, Map, fromJS, Set } from 'immutable';
|
import type { Map } from 'immutable';
|
||||||
|
import { List, fromJS, Set } from 'immutable';
|
||||||
import * as fuzzy from 'fuzzy';
|
import * as fuzzy from 'fuzzy';
|
||||||
import {
|
import type {
|
||||||
localForage,
|
|
||||||
Cursor,
|
|
||||||
CURSOR_COMPATIBILITY_SYMBOL,
|
|
||||||
EditorialWorkflowError,
|
|
||||||
Implementation as BackendImplementation,
|
Implementation as BackendImplementation,
|
||||||
DisplayURL,
|
DisplayURL,
|
||||||
ImplementationEntry,
|
ImplementationEntry,
|
||||||
Credentials,
|
Credentials,
|
||||||
User,
|
User,
|
||||||
getPathDepth,
|
|
||||||
blobToFileObj,
|
|
||||||
asyncLock,
|
|
||||||
AsyncLock,
|
AsyncLock,
|
||||||
UnpublishedEntry,
|
UnpublishedEntry,
|
||||||
DataFile,
|
DataFile,
|
||||||
UnpublishedEntryDiff,
|
UnpublishedEntryDiff,
|
||||||
} from 'netlify-cms-lib-util';
|
} from 'netlify-cms-lib-util';
|
||||||
|
import {
|
||||||
|
localForage,
|
||||||
|
Cursor,
|
||||||
|
CURSOR_COMPATIBILITY_SYMBOL,
|
||||||
|
EditorialWorkflowError,
|
||||||
|
getPathDepth,
|
||||||
|
blobToFileObj,
|
||||||
|
asyncLock,
|
||||||
|
} from 'netlify-cms-lib-util';
|
||||||
import { basename, join, extname, dirname } from 'path';
|
import { basename, join, extname, dirname } from 'path';
|
||||||
import { stringTemplate } from 'netlify-cms-lib-widgets';
|
import { stringTemplate } from 'netlify-cms-lib-widgets';
|
||||||
import { resolveFormat } from './formats/formats';
|
import { resolveFormat } from './formats/formats';
|
||||||
@ -37,12 +40,13 @@ import {
|
|||||||
selectFieldsComments,
|
selectFieldsComments,
|
||||||
selectHasMetaPath,
|
selectHasMetaPath,
|
||||||
} from './reducers/collections';
|
} from './reducers/collections';
|
||||||
import { createEntry, EntryValue } from './valueObjects/Entry';
|
import type { EntryValue } from './valueObjects/Entry';
|
||||||
|
import { createEntry } from './valueObjects/Entry';
|
||||||
import { sanitizeChar } from './lib/urlHelper';
|
import { sanitizeChar } from './lib/urlHelper';
|
||||||
import { getBackend, invokeEvent } from './lib/registry';
|
import { getBackend, invokeEvent } from './lib/registry';
|
||||||
import { commitMessageFormatter, slugFormatter, previewUrlFormatter } from './lib/formatters';
|
import { commitMessageFormatter, slugFormatter, previewUrlFormatter } from './lib/formatters';
|
||||||
import { status } from './constants/publishModes';
|
import { status } from './constants/publishModes';
|
||||||
import {
|
import type {
|
||||||
CmsConfig,
|
CmsConfig,
|
||||||
EntryMap,
|
EntryMap,
|
||||||
FilterRule,
|
FilterRule,
|
||||||
@ -53,7 +57,7 @@ import {
|
|||||||
State,
|
State,
|
||||||
EntryField,
|
EntryField,
|
||||||
} from './types/redux';
|
} from './types/redux';
|
||||||
import AssetProxy from './valueObjects/AssetProxy';
|
import type AssetProxy from './valueObjects/AssetProxy';
|
||||||
import { FOLDER, FILES } from './constants/collectionTypes';
|
import { FOLDER, FILES } from './constants/collectionTypes';
|
||||||
import { selectCustomPath } from './reducers/entryDraft';
|
import { selectCustomPath } from './reducers/entryDraft';
|
||||||
import {
|
import {
|
||||||
@ -523,7 +527,7 @@ export class Backend {
|
|||||||
from. This is done to prevent traverseCursor from requiring a
|
from. This is done to prevent traverseCursor from requiring a
|
||||||
`collection` argument.
|
`collection` argument.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const cursor = Cursor.create(loadedEntries[CURSOR_COMPATIBILITY_SYMBOL]).wrapData({
|
const cursor = Cursor.create(loadedEntries[CURSOR_COMPATIBILITY_SYMBOL]).wrapData({
|
||||||
cursorType: 'collectionEntries',
|
cursorType: 'collectionEntries',
|
||||||
@ -611,7 +615,7 @@ export class Backend {
|
|||||||
const entries = await Promise.all(collectionEntriesRequests).then(arrays => flatten(arrays));
|
const entries = await Promise.all(collectionEntriesRequests).then(arrays => flatten(arrays));
|
||||||
|
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
throw new Error({ message: 'Errors ocurred while searching entries locally!', errors });
|
throw new Error({ message: 'Errors ocurred while searching entries locally!', errors });
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,10 @@ import { get } from 'lodash';
|
|||||||
import yamlFormatter from './yaml';
|
import yamlFormatter from './yaml';
|
||||||
import tomlFormatter from './toml';
|
import tomlFormatter from './toml';
|
||||||
import jsonFormatter from './json';
|
import jsonFormatter from './json';
|
||||||
import {
|
import type { Delimiter } from './frontmatter';
|
||||||
FrontmatterInfer,
|
import { FrontmatterInfer, frontmatterJSON, frontmatterTOML, frontmatterYAML } from './frontmatter';
|
||||||
frontmatterJSON,
|
import type { Collection, EntryObject, Format } from '../types/redux';
|
||||||
frontmatterTOML,
|
import type { EntryValue } from '../valueObjects/Entry';
|
||||||
frontmatterYAML,
|
|
||||||
Delimiter,
|
|
||||||
} from './frontmatter';
|
|
||||||
import { Collection, EntryObject, Format } from '../types/redux';
|
|
||||||
import { EntryValue } from '../valueObjects/Entry';
|
|
||||||
|
|
||||||
export const frontmatterFormats = ['yaml-frontmatter', 'toml-frontmatter', 'json-frontmatter'];
|
export const frontmatterFormats = ['yaml-frontmatter', 'toml-frontmatter', 'json-frontmatter'];
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ export class FrontmatterFormatter {
|
|||||||
const trimLastLineBreak = body.slice(-1) !== '\n';
|
const trimLastLineBreak = body.slice(-1) !== '\n';
|
||||||
const file = matter.stringify(body, meta, {
|
const file = matter.stringify(body, meta, {
|
||||||
engines: parsers,
|
engines: parsers,
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore `sortedKeys` is not recognized by gray-matter, so it gets passed through to the parser
|
// @ts-ignore `sortedKeys` is not recognized by gray-matter, so it gets passed through to the parser
|
||||||
sortedKeys,
|
sortedKeys,
|
||||||
comments,
|
comments,
|
||||||
|
@ -6,7 +6,7 @@ import { sortKeys } from './helpers';
|
|||||||
|
|
||||||
function outputReplacer(_key: string, value: unknown) {
|
function outputReplacer(_key: string, value: unknown) {
|
||||||
if (moment.isMoment(value)) {
|
if (moment.isMoment(value)) {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return value.format(value._f);
|
return value.format(value._f);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import yaml from 'yaml';
|
import yaml from 'yaml';
|
||||||
import { sortKeys } from './helpers';
|
import { sortKeys } from './helpers';
|
||||||
import { YAMLMap, YAMLSeq, Pair, Node } from 'yaml/types';
|
import type { YAMLMap, YAMLSeq, Pair, Node } from 'yaml/types';
|
||||||
|
|
||||||
function addComments(items: Array<Pair>, comments: Record<string, string>, prefix = '') {
|
function addComments(items: Array<Pair>, comments: Record<string, string>, prefix = '') {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Map } from 'immutable';
|
import type { Map } from 'immutable';
|
||||||
import { flow, partialRight, trimEnd, trimStart } from 'lodash';
|
import { flow, partialRight, trimEnd, trimStart } from 'lodash';
|
||||||
import { sanitizeSlug } from './urlHelper';
|
import { sanitizeSlug } from './urlHelper';
|
||||||
import { stringTemplate } from 'netlify-cms-lib-widgets';
|
import { stringTemplate } from 'netlify-cms-lib-widgets';
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
selectInferedField,
|
selectInferedField,
|
||||||
getFileFromSlug,
|
getFileFromSlug,
|
||||||
} from '../reducers/collections';
|
} from '../reducers/collections';
|
||||||
import { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux';
|
import type { Collection, CmsConfig, CmsSlug, EntryMap } from '../types/redux';
|
||||||
import { stripIndent } from 'common-tags';
|
import { stripIndent } from 'common-tags';
|
||||||
import { FILES } from '../constants/collectionTypes';
|
import { FILES } from '../constants/collectionTypes';
|
||||||
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';
|
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Map, List } from 'immutable';
|
import { Map, List } from 'immutable';
|
||||||
import { set, trimEnd, groupBy, escapeRegExp } from 'lodash';
|
import { set, trimEnd, groupBy, escapeRegExp } from 'lodash';
|
||||||
import { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux';
|
import type { Collection, Entry, EntryDraft, EntryField, EntryMap } from '../types/redux';
|
||||||
import { selectEntrySlug } from '../reducers/collections';
|
import { selectEntrySlug } from '../reducers/collections';
|
||||||
import { EntryValue } from '../valueObjects/Entry';
|
import type { EntryValue } from '../valueObjects/Entry';
|
||||||
|
|
||||||
export const I18N = 'i18n';
|
export const I18N = 'i18n';
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import urlJoin from 'url-join';
|
|||||||
import diacritics from 'diacritics';
|
import diacritics from 'diacritics';
|
||||||
import sanitizeFilename from 'sanitize-filename';
|
import sanitizeFilename from 'sanitize-filename';
|
||||||
import { isString, escapeRegExp, flow, partialRight } from 'lodash';
|
import { isString, escapeRegExp, flow, partialRight } from 'lodash';
|
||||||
import { CmsSlug } from '../types/redux';
|
import type { CmsSlug } from '../types/redux';
|
||||||
|
|
||||||
function getUrl(urlString: string, direct?: boolean) {
|
function getUrl(urlString: string, direct?: boolean) {
|
||||||
return `${direct ? '/#' : ''}${urlString}`;
|
return `${direct ? '/#' : ''}${urlString}`;
|
||||||
|
@ -7,7 +7,7 @@ import { getMediaLibrary } from './lib/registry';
|
|||||||
import { store } from './redux';
|
import { store } from './redux';
|
||||||
import { configFailed } from './actions/config';
|
import { configFailed } from './actions/config';
|
||||||
import { createMediaLibrary, insertMedia } from './actions/mediaLibrary';
|
import { createMediaLibrary, insertMedia } from './actions/mediaLibrary';
|
||||||
import { MediaLibraryInstance } from './types/redux';
|
import type { MediaLibraryInstance } from './types/redux';
|
||||||
|
|
||||||
type MediaLibraryOptions = {};
|
type MediaLibraryOptions = {};
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ interface MediaLibrary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleInsert(url: string) {
|
function handleInsert(url: string) {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return store.dispatch(insertMedia(url, undefined));
|
return store.dispatch(insertMedia(url, undefined));
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import auth, { defaultState } from '../auth';
|
|||||||
|
|
||||||
describe('auth', () => {
|
describe('auth', () => {
|
||||||
it('should handle an empty state', () => {
|
it('should handle an empty state', () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore auth reducer doesn't accept empty action
|
// @ts-ignore auth reducer doesn't accept empty action
|
||||||
expect(auth(undefined, {})).toEqual(defaultState);
|
expect(auth(undefined, {})).toEqual(defaultState);
|
||||||
});
|
});
|
||||||
|
@ -3,7 +3,7 @@ import config, { selectLocale } from '../config';
|
|||||||
|
|
||||||
describe('config', () => {
|
describe('config', () => {
|
||||||
it('should handle an empty state', () => {
|
it('should handle an empty state', () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore config reducer doesn't accept empty action
|
// @ts-ignore config reducer doesn't accept empty action
|
||||||
expect(config(undefined, {})).toEqual({ isFetching: true });
|
expect(config(undefined, {})).toEqual({ isFetching: true });
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import integrations from '../integrations';
|
import integrations from '../integrations';
|
||||||
import { CONFIG_SUCCESS, ConfigAction } from '../../actions/config';
|
import type { ConfigAction } from '../../actions/config';
|
||||||
|
import { CONFIG_SUCCESS } from '../../actions/config';
|
||||||
import { FOLDER } from '../../constants/collectionTypes';
|
import { FOLDER } from '../../constants/collectionTypes';
|
||||||
|
|
||||||
describe('integrations', () => {
|
describe('integrations', () => {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
import { User } from 'netlify-cms-lib-util';
|
import type { User } from 'netlify-cms-lib-util';
|
||||||
|
import type { AuthAction } from '../actions/auth';
|
||||||
import {
|
import {
|
||||||
AUTH_REQUEST,
|
AUTH_REQUEST,
|
||||||
AUTH_SUCCESS,
|
AUTH_SUCCESS,
|
||||||
AUTH_FAILURE,
|
AUTH_FAILURE,
|
||||||
AUTH_REQUEST_DONE,
|
AUTH_REQUEST_DONE,
|
||||||
LOGOUT,
|
LOGOUT,
|
||||||
AuthAction,
|
|
||||||
} from '../actions/auth';
|
} from '../actions/auth';
|
||||||
|
|
||||||
export type Auth = {
|
export type Auth = {
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import { List, Set, fromJS, OrderedMap } from 'immutable';
|
import { List, Set, fromJS, OrderedMap } from 'immutable';
|
||||||
import { get, escapeRegExp } from 'lodash';
|
import { get, escapeRegExp } from 'lodash';
|
||||||
import consoleError from '../lib/consoleError';
|
import consoleError from '../lib/consoleError';
|
||||||
import { CONFIG_SUCCESS, ConfigAction } from '../actions/config';
|
import type { ConfigAction } from '../actions/config';
|
||||||
|
import { CONFIG_SUCCESS } from '../actions/config';
|
||||||
import { FILES, FOLDER } from '../constants/collectionTypes';
|
import { FILES, FOLDER } from '../constants/collectionTypes';
|
||||||
import { COMMIT_DATE, COMMIT_AUTHOR } from '../constants/commitProps';
|
import { COMMIT_DATE, COMMIT_AUTHOR } from '../constants/commitProps';
|
||||||
import { INFERABLE_FIELDS, IDENTIFIER_FIELDS, SORTABLE_FIELDS } from '../constants/fieldInference';
|
import { INFERABLE_FIELDS, IDENTIFIER_FIELDS, SORTABLE_FIELDS } from '../constants/fieldInference';
|
||||||
import { formatExtensions } from '../formats/formats';
|
import { formatExtensions } from '../formats/formats';
|
||||||
import {
|
import type {
|
||||||
Collection,
|
Collection,
|
||||||
Collections,
|
Collections,
|
||||||
CollectionFiles,
|
CollectionFiles,
|
||||||
@ -19,7 +20,7 @@ import {
|
|||||||
import { selectMediaFolder } from './entries';
|
import { selectMediaFolder } from './entries';
|
||||||
import { stringTemplate } from 'netlify-cms-lib-widgets';
|
import { stringTemplate } from 'netlify-cms-lib-widgets';
|
||||||
import { summaryFormatter } from '../lib/formatters';
|
import { summaryFormatter } from '../lib/formatters';
|
||||||
import { Backend } from '../backend';
|
import type { Backend } from '../backend';
|
||||||
|
|
||||||
const { keyToPathArray } = stringTemplate;
|
const { keyToPathArray } = stringTemplate;
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
import { CONFIG_REQUEST, CONFIG_SUCCESS, CONFIG_FAILURE, ConfigAction } from '../actions/config';
|
import type { ConfigAction } from '../actions/config';
|
||||||
|
import { CONFIG_REQUEST, CONFIG_SUCCESS, CONFIG_FAILURE } from '../actions/config';
|
||||||
import { EDITORIAL_WORKFLOW } from '../constants/publishModes';
|
import { EDITORIAL_WORKFLOW } from '../constants/publishModes';
|
||||||
import { CmsConfig } from '../types/redux';
|
import type { CmsConfig } from '../types/redux';
|
||||||
|
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
isFetching: true,
|
isFetching: true,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
|
import type { DeploysAction } from '../actions/deploys';
|
||||||
import {
|
import {
|
||||||
DEPLOY_PREVIEW_REQUEST,
|
DEPLOY_PREVIEW_REQUEST,
|
||||||
DEPLOY_PREVIEW_SUCCESS,
|
DEPLOY_PREVIEW_SUCCESS,
|
||||||
DEPLOY_PREVIEW_FAILURE,
|
DEPLOY_PREVIEW_FAILURE,
|
||||||
DeploysAction,
|
|
||||||
} from '../actions/deploys';
|
} from '../actions/deploys';
|
||||||
|
|
||||||
export type Deploys = {
|
export type Deploys = {
|
||||||
|
@ -19,7 +19,7 @@ import {
|
|||||||
UNPUBLISHED_ENTRY_DELETE_SUCCESS,
|
UNPUBLISHED_ENTRY_DELETE_SUCCESS,
|
||||||
} from '../actions/editorialWorkflow';
|
} from '../actions/editorialWorkflow';
|
||||||
import { CONFIG_SUCCESS } from '../actions/config';
|
import { CONFIG_SUCCESS } from '../actions/config';
|
||||||
import { EditorialWorkflowAction, EditorialWorkflow, Entities } from '../types/redux';
|
import type { EditorialWorkflowAction, EditorialWorkflow, Entities } from '../types/redux';
|
||||||
|
|
||||||
function unpublishedEntries(state = Map(), action: EditorialWorkflowAction) {
|
function unpublishedEntries(state = Map(), action: EditorialWorkflowAction) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
CHANGE_VIEW_STYLE,
|
CHANGE_VIEW_STYLE,
|
||||||
} from '../actions/entries';
|
} from '../actions/entries';
|
||||||
import { SEARCH_ENTRIES_SUCCESS } from '../actions/search';
|
import { SEARCH_ENTRIES_SUCCESS } from '../actions/search';
|
||||||
import {
|
import type {
|
||||||
EntriesAction,
|
EntriesAction,
|
||||||
EntryRequestPayload,
|
EntryRequestPayload,
|
||||||
EntrySuccessPayload,
|
EntrySuccessPayload,
|
||||||
@ -41,7 +41,6 @@ import {
|
|||||||
SortMap,
|
SortMap,
|
||||||
SortObject,
|
SortObject,
|
||||||
Sort,
|
Sort,
|
||||||
SortDirection,
|
|
||||||
Filter,
|
Filter,
|
||||||
Group,
|
Group,
|
||||||
FilterMap,
|
FilterMap,
|
||||||
@ -53,6 +52,7 @@ import {
|
|||||||
EntriesGroupFailurePayload,
|
EntriesGroupFailurePayload,
|
||||||
GroupOfEntries,
|
GroupOfEntries,
|
||||||
} from '../types/redux';
|
} from '../types/redux';
|
||||||
|
import { SortDirection } from '../types/redux';
|
||||||
import { folderFormatter } from '../lib/formatters';
|
import { folderFormatter } from '../lib/formatters';
|
||||||
import { isAbsolutePath, basename } from 'netlify-cms-lib-util';
|
import { isAbsolutePath, basename } from 'netlify-cms-lib-util';
|
||||||
import { trim, once, sortBy, set, orderBy, groupBy } from 'lodash';
|
import { trim, once, sortBy, set, orderBy, groupBy } from 'lodash';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
import { USE_OPEN_AUTHORING } from '../actions/auth';
|
import { USE_OPEN_AUTHORING } from '../actions/auth';
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ import mediaLibrary from './mediaLibrary';
|
|||||||
import deploys, * as fromDeploys from './deploys';
|
import deploys, * as fromDeploys from './deploys';
|
||||||
import globalUI from './globalUI';
|
import globalUI from './globalUI';
|
||||||
import status from './status';
|
import status from './status';
|
||||||
import { Status } from '../constants/publishModes';
|
import type { Status } from '../constants/publishModes';
|
||||||
import { State, Collection } from '../types/redux';
|
import type { State, Collection } from '../types/redux';
|
||||||
|
|
||||||
const reducers = {
|
const reducers = {
|
||||||
auth,
|
auth,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { fromJS } from 'immutable';
|
import { fromJS } from 'immutable';
|
||||||
import { CONFIG_SUCCESS, ConfigAction } from '../actions/config';
|
import type { ConfigAction } from '../actions/config';
|
||||||
import { Integrations, CmsConfig } from '../types/redux';
|
import { CONFIG_SUCCESS } from '../actions/config';
|
||||||
|
import type { Integrations, CmsConfig } from '../types/redux';
|
||||||
|
|
||||||
interface Acc {
|
interface Acc {
|
||||||
providers: Record<string, {}>;
|
providers: Record<string, {}>;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Map, List } from 'immutable';
|
import { Map, List } from 'immutable';
|
||||||
import uuid from 'uuid/v4';
|
import uuid from 'uuid/v4';
|
||||||
|
import type { MediaLibraryAction } from '../actions/mediaLibrary';
|
||||||
import {
|
import {
|
||||||
MEDIA_LIBRARY_OPEN,
|
MEDIA_LIBRARY_OPEN,
|
||||||
MEDIA_LIBRARY_CLOSE,
|
MEDIA_LIBRARY_CLOSE,
|
||||||
@ -18,11 +19,10 @@ import {
|
|||||||
MEDIA_DISPLAY_URL_REQUEST,
|
MEDIA_DISPLAY_URL_REQUEST,
|
||||||
MEDIA_DISPLAY_URL_SUCCESS,
|
MEDIA_DISPLAY_URL_SUCCESS,
|
||||||
MEDIA_DISPLAY_URL_FAILURE,
|
MEDIA_DISPLAY_URL_FAILURE,
|
||||||
MediaLibraryAction,
|
|
||||||
} from '../actions/mediaLibrary';
|
} from '../actions/mediaLibrary';
|
||||||
import { selectEditingDraft, selectMediaFolder } from './entries';
|
import { selectEditingDraft, selectMediaFolder } from './entries';
|
||||||
import { selectIntegration } from './';
|
import { selectIntegration } from './';
|
||||||
import {
|
import type {
|
||||||
State,
|
State,
|
||||||
MediaLibraryInstance,
|
MediaLibraryInstance,
|
||||||
MediaFile,
|
MediaFile,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
|
import type { MediasAction } from '../actions/media';
|
||||||
import {
|
import {
|
||||||
ADD_ASSETS,
|
ADD_ASSETS,
|
||||||
ADD_ASSET,
|
ADD_ASSET,
|
||||||
@ -6,9 +7,8 @@ import {
|
|||||||
LOAD_ASSET_REQUEST,
|
LOAD_ASSET_REQUEST,
|
||||||
LOAD_ASSET_SUCCESS,
|
LOAD_ASSET_SUCCESS,
|
||||||
LOAD_ASSET_FAILURE,
|
LOAD_ASSET_FAILURE,
|
||||||
MediasAction,
|
|
||||||
} from '../actions/media';
|
} from '../actions/media';
|
||||||
import AssetProxy from '../valueObjects/AssetProxy';
|
import type AssetProxy from '../valueObjects/AssetProxy';
|
||||||
|
|
||||||
export type Medias = {
|
export type Medias = {
|
||||||
[path: string]: { asset: AssetProxy | undefined; isLoading: boolean; error: Error | null };
|
[path: string]: { asset: AssetProxy | undefined; isLoading: boolean; error: Error | null };
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
|
|
||||||
|
import type { SearchAction } from '../actions/search';
|
||||||
import {
|
import {
|
||||||
QUERY_FAILURE,
|
QUERY_FAILURE,
|
||||||
QUERY_REQUEST,
|
QUERY_REQUEST,
|
||||||
@ -8,9 +9,8 @@ import {
|
|||||||
SEARCH_ENTRIES_FAILURE,
|
SEARCH_ENTRIES_FAILURE,
|
||||||
SEARCH_ENTRIES_REQUEST,
|
SEARCH_ENTRIES_REQUEST,
|
||||||
SEARCH_ENTRIES_SUCCESS,
|
SEARCH_ENTRIES_SUCCESS,
|
||||||
SearchAction,
|
|
||||||
} from '../actions/search';
|
} from '../actions/search';
|
||||||
import { EntryValue } from '../valueObjects/Entry';
|
import type { EntryValue } from '../valueObjects/Entry';
|
||||||
|
|
||||||
export type Search = {
|
export type Search = {
|
||||||
isFetching: boolean;
|
isFetching: boolean;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
import { STATUS_REQUEST, STATUS_SUCCESS, STATUS_FAILURE, StatusAction } from '../actions/status';
|
import type { StatusAction } from '../actions/status';
|
||||||
|
import { STATUS_REQUEST, STATUS_SUCCESS, STATUS_FAILURE } from '../actions/status';
|
||||||
|
|
||||||
export type Status = {
|
export type Status = {
|
||||||
isFetching: boolean;
|
isFetching: boolean;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { createStore, applyMiddleware, AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
|
import { createStore, applyMiddleware } from 'redux';
|
||||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
import { composeWithDevTools } from 'redux-devtools-extension';
|
||||||
import thunkMiddleware, { ThunkMiddleware } from 'redux-thunk';
|
import type { ThunkMiddleware } from 'redux-thunk';
|
||||||
|
import thunkMiddleware from 'redux-thunk';
|
||||||
import { waitUntilAction } from './middleware/waitUntilAction';
|
import { waitUntilAction } from './middleware/waitUntilAction';
|
||||||
import createRootReducer from '../reducers/combinedReducer';
|
import createRootReducer from '../reducers/combinedReducer';
|
||||||
import { State } from '../types/redux';
|
import type { State } from '../types/redux';
|
||||||
import { Reducer } from 'react';
|
import type { Reducer } from 'react';
|
||||||
|
|
||||||
const store = createStore<State | undefined, AnyAction, unknown, unknown>(
|
const store = createStore<State | undefined, AnyAction, unknown, unknown>(
|
||||||
createRootReducer() as unknown as Reducer<State | undefined, AnyAction>,
|
createRootReducer() as unknown as Reducer<State | undefined, AnyAction>,
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
* action coming through the system. Think of it as a thunk that
|
* action coming through the system. Think of it as a thunk that
|
||||||
* blocks until the condition is met.
|
* blocks until the condition is met.
|
||||||
*/
|
*/
|
||||||
import { Middleware, MiddlewareAPI, Dispatch, AnyAction } from 'redux';
|
import type { Middleware, MiddlewareAPI, Dispatch, AnyAction } from 'redux';
|
||||||
import { State } from '../../types/redux';
|
import type { State } from '../../types/redux';
|
||||||
|
|
||||||
export const WAIT_UNTIL_ACTION = 'WAIT_UNTIL_ACTION';
|
export const WAIT_UNTIL_ACTION = 'WAIT_UNTIL_ACTION';
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createHashHistory, History } from 'history';
|
import type { History } from 'history';
|
||||||
|
import { createHashHistory } from 'history';
|
||||||
import { mocked } from 'ts-jest/utils';
|
import { mocked } from 'ts-jest/utils';
|
||||||
|
|
||||||
jest.mock('history');
|
jest.mock('history');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { CmsConfig } from './redux';
|
import type { CmsConfig } from './redux';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { Action } from 'redux';
|
import type { Action } from 'redux';
|
||||||
import { StaticallyTypedRecord } from './immutable';
|
import type { StaticallyTypedRecord } from './immutable';
|
||||||
import { Map, List, OrderedMap, Set } from 'immutable';
|
import type { Map, List, OrderedMap, Set } from 'immutable';
|
||||||
import { FILES, FOLDER } from '../constants/collectionTypes';
|
import type { FILES, FOLDER } from '../constants/collectionTypes';
|
||||||
import { MediaFile as BackendMediaFile } from '../backend';
|
import type { MediaFile as BackendMediaFile } from '../backend';
|
||||||
import { Auth } from '../reducers/auth';
|
import type { Auth } from '../reducers/auth';
|
||||||
import { Status } from '../reducers/status';
|
import type { Status } from '../reducers/status';
|
||||||
import { Medias } from '../reducers/medias';
|
import type { Medias } from '../reducers/medias';
|
||||||
import { Deploys } from '../reducers/deploys';
|
import type { Deploys } from '../reducers/deploys';
|
||||||
import { Search } from '../reducers/search';
|
import type { Search } from '../reducers/search';
|
||||||
import { GlobalUI } from '../reducers/globalUI';
|
import type { GlobalUI } from '../reducers/globalUI';
|
||||||
import { formatExtensions } from '../formats/formats';
|
import type { formatExtensions } from '../formats/formats';
|
||||||
|
|
||||||
export type CmsBackendType =
|
export type CmsBackendType =
|
||||||
| 'azure'
|
| 'azure'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { EntryField } from '../types/redux';
|
import type { EntryField } from '../types/redux';
|
||||||
|
|
||||||
interface AssetProxyArgs {
|
interface AssetProxyArgs {
|
||||||
path: string;
|
path: string;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { isBoolean } from 'lodash';
|
import { isBoolean } from 'lodash';
|
||||||
import { MediaFile } from '../backend';
|
import type { MediaFile } from '../backend';
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
partial?: boolean;
|
partial?: boolean;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { asyncLock, AsyncLock } from './asyncLock';
|
import type { AsyncLock } from './asyncLock';
|
||||||
|
import { asyncLock } from './asyncLock';
|
||||||
import unsentRequest from './unsentRequest';
|
import unsentRequest from './unsentRequest';
|
||||||
import APIError from './APIError';
|
import APIError from './APIError';
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { filter, flow, fromPairs, map } from 'lodash/fp';
|
import { filter, flow, fromPairs, map } from 'lodash/fp';
|
||||||
import getBlobSHA from './getBlobSHA';
|
import getBlobSHA from './getBlobSHA';
|
||||||
import { AssetProxy } from './implementation';
|
import type { AssetProxy } from './implementation';
|
||||||
|
|
||||||
export interface PointerFile {
|
export interface PointerFile {
|
||||||
size: number;
|
size: number;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import semaphore, { Semaphore } from 'semaphore';
|
import type { Semaphore } from 'semaphore';
|
||||||
|
import semaphore from 'semaphore';
|
||||||
import { unionBy, sortBy } from 'lodash';
|
import { unionBy, sortBy } from 'lodash';
|
||||||
import Cursor from './Cursor';
|
import type Cursor from './Cursor';
|
||||||
import { AsyncLock } from './asyncLock';
|
import type { AsyncLock } from './asyncLock';
|
||||||
import { FileMetadata } from './API';
|
import type { FileMetadata } from './API';
|
||||||
import { basename } from './path';
|
import { basename } from './path';
|
||||||
|
|
||||||
export type DisplayURLObject = { id: string; path: string };
|
export type DisplayURLObject = { id: string; path: string };
|
||||||
|
@ -16,8 +16,9 @@ import {
|
|||||||
} from './backendUtil';
|
} from './backendUtil';
|
||||||
import loadScript from './loadScript';
|
import loadScript from './loadScript';
|
||||||
import getBlobSHA from './getBlobSHA';
|
import getBlobSHA from './getBlobSHA';
|
||||||
import { asyncLock, AsyncLock as AL } from './asyncLock';
|
import type { AsyncLock as AL } from './asyncLock';
|
||||||
import {
|
import { asyncLock } from './asyncLock';
|
||||||
|
import type {
|
||||||
Implementation as I,
|
Implementation as I,
|
||||||
ImplementationEntry as IE,
|
ImplementationEntry as IE,
|
||||||
UnpublishedEntryDiff as UED,
|
UnpublishedEntryDiff as UED,
|
||||||
@ -31,26 +32,27 @@ import {
|
|||||||
Entry as E,
|
Entry as E,
|
||||||
PersistOptions as PO,
|
PersistOptions as PO,
|
||||||
AssetProxy as AP,
|
AssetProxy as AP,
|
||||||
|
Config as C,
|
||||||
|
UnpublishedEntryMediaFile as UEMF,
|
||||||
|
DataFile as DF,
|
||||||
|
} from './implementation';
|
||||||
|
import {
|
||||||
entriesByFiles,
|
entriesByFiles,
|
||||||
entriesByFolder,
|
entriesByFolder,
|
||||||
unpublishedEntries,
|
unpublishedEntries,
|
||||||
getMediaDisplayURL,
|
getMediaDisplayURL,
|
||||||
getMediaAsBlob,
|
getMediaAsBlob,
|
||||||
runWithLock,
|
runWithLock,
|
||||||
Config as C,
|
|
||||||
UnpublishedEntryMediaFile as UEMF,
|
|
||||||
blobToFileObj,
|
blobToFileObj,
|
||||||
allEntriesByFolder,
|
allEntriesByFolder,
|
||||||
DataFile as DF,
|
|
||||||
} from './implementation';
|
} from './implementation';
|
||||||
|
import type { FetchError as FE, ApiRequest as AR } from './API';
|
||||||
import {
|
import {
|
||||||
readFile,
|
readFile,
|
||||||
readFileMetadata,
|
readFileMetadata,
|
||||||
isPreviewContext,
|
isPreviewContext,
|
||||||
getPreviewStatus,
|
getPreviewStatus,
|
||||||
PreviewState,
|
PreviewState,
|
||||||
FetchError as FE,
|
|
||||||
ApiRequest as AR,
|
|
||||||
requestWithBackoff,
|
requestWithBackoff,
|
||||||
throwOnConflictingBranches,
|
throwOnConflictingBranches,
|
||||||
} from './API';
|
} from './API';
|
||||||
@ -66,13 +68,13 @@ import {
|
|||||||
branchFromContentKey,
|
branchFromContentKey,
|
||||||
contentKeyFromBranch,
|
contentKeyFromBranch,
|
||||||
} from './APIUtils';
|
} from './APIUtils';
|
||||||
|
import type { PointerFile as PF } from './git-lfs';
|
||||||
import {
|
import {
|
||||||
createPointerFile,
|
createPointerFile,
|
||||||
getLargeMediaFilteredMediaFiles,
|
getLargeMediaFilteredMediaFiles,
|
||||||
getLargeMediaPatternsFromGitAttributesFile,
|
getLargeMediaPatternsFromGitAttributesFile,
|
||||||
parsePointerFile,
|
parsePointerFile,
|
||||||
getPointerFileForMediaFileObj,
|
getPointerFileForMediaFileObj,
|
||||||
PointerFile as PF,
|
|
||||||
} from './git-lfs';
|
} from './git-lfs';
|
||||||
|
|
||||||
export type AsyncLock = AL;
|
export type AsyncLock = AL;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { isNumber } from 'lodash';
|
import { isNumber } from 'lodash';
|
||||||
import { List } from 'immutable';
|
import type { List } from 'immutable';
|
||||||
|
|
||||||
export function validateMinMax(
|
export function validateMinMax(
|
||||||
t: (key: string, options: unknown) => string,
|
t: (key: string, options: unknown) => string,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { registerCommonMiddlewares } from './middlewares/common';
|
import { registerCommonMiddlewares } from './middlewares/common';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import express from 'express';
|
import type express from 'express';
|
||||||
import { registerCommonMiddlewares } from './middlewares/common';
|
import { registerCommonMiddlewares } from './middlewares/common';
|
||||||
import { registerMiddleware as localGit } from './middlewares/localGit';
|
import { registerMiddleware as localGit } from './middlewares/localGit';
|
||||||
import { registerMiddleware as localFs } from './middlewares/localFs';
|
import { registerMiddleware as localFs } from './middlewares/localFs';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import winston from 'winston';
|
import type winston from 'winston';
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import morgan from 'morgan';
|
import morgan from 'morgan';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { defaultSchema, joi } from '.';
|
import { defaultSchema, joi } from '.';
|
||||||
import express from 'express';
|
import type express from 'express';
|
||||||
import Joi from '@hapi/joi';
|
import type Joi from '@hapi/joi';
|
||||||
|
|
||||||
function assetFailure(result: Joi.ValidationResult, expectedMessage: string) {
|
function assetFailure(result: Joi.ValidationResult, expectedMessage: string) {
|
||||||
const { error } = result;
|
const { error } = result;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import express from 'express';
|
import type express from 'express';
|
||||||
import Joi from '@hapi/joi';
|
import Joi from '@hapi/joi';
|
||||||
|
|
||||||
const allowedActions = [
|
const allowedActions = [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
import Joi from '@hapi/joi';
|
import type Joi from '@hapi/joi';
|
||||||
import { getSchema } from '.';
|
import { getSchema } from '.';
|
||||||
|
|
||||||
function assetFailure(result: Joi.ValidationResult, expectedMessage: string) {
|
function assetFailure(result: Joi.ValidationResult, expectedMessage: string) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import winston from 'winston';
|
import type winston from 'winston';
|
||||||
import express from 'express';
|
import type express from 'express';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { defaultSchema, joi } from '../joi';
|
import { defaultSchema, joi } from '../joi';
|
||||||
import { pathTraversal } from '../joi/customValidators';
|
import { pathTraversal } from '../joi/customValidators';
|
||||||
import {
|
import type {
|
||||||
EntriesByFolderParams,
|
EntriesByFolderParams,
|
||||||
EntriesByFilesParams,
|
EntriesByFilesParams,
|
||||||
GetEntryParams,
|
GetEntryParams,
|
||||||
@ -32,7 +32,6 @@ export function localFsMiddleware({ repoPath, logger }: FsOptions) {
|
|||||||
case 'info': {
|
case 'info': {
|
||||||
res.json({
|
res.json({
|
||||||
repo: path.basename(repoPath),
|
repo: path.basename(repoPath),
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
publish_modes: ['simple'],
|
publish_modes: ['simple'],
|
||||||
type: 'local_fs',
|
type: 'local_fs',
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
import Joi from '@hapi/joi';
|
import type Joi from '@hapi/joi';
|
||||||
import express from 'express';
|
import type express from 'express';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
import { validateRepo, getSchema, localGitMiddleware } from '.';
|
import { validateRepo, getSchema, localGitMiddleware } from '.';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import winston from 'winston';
|
import type winston from 'winston';
|
||||||
import express from 'express';
|
import type express from 'express';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import {
|
import {
|
||||||
@ -13,7 +13,7 @@ import {
|
|||||||
} from 'netlify-cms-lib-util/src/APIUtils';
|
} from 'netlify-cms-lib-util/src/APIUtils';
|
||||||
import { parse } from 'what-the-diff';
|
import { parse } from 'what-the-diff';
|
||||||
import { defaultSchema, joi } from '../joi';
|
import { defaultSchema, joi } from '../joi';
|
||||||
import {
|
import type {
|
||||||
EntriesByFolderParams,
|
EntriesByFolderParams,
|
||||||
EntriesByFilesParams,
|
EntriesByFilesParams,
|
||||||
GetEntryParams,
|
GetEntryParams,
|
||||||
@ -181,7 +181,6 @@ export function localGitMiddleware({ repoPath, logger }: GitOptions) {
|
|||||||
if (body.action === 'info') {
|
if (body.action === 'info') {
|
||||||
res.json({
|
res.json({
|
||||||
repo: path.basename(repoPath),
|
repo: path.basename(repoPath),
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
publish_modes: ['simple', 'editorial_workflow'],
|
publish_modes: ['simple', 'editorial_workflow'],
|
||||||
type: 'local_git',
|
type: 'local_git',
|
||||||
});
|
});
|
||||||
|
86
yarn.lock
86
yarn.lock
@ -3351,11 +3351,6 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.10.tgz#61cc8469849e5bcdd0c7044122265c39cec10cf4"
|
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.10.tgz#61cc8469849e5bcdd0c7044122265c39cec10cf4"
|
||||||
integrity sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==
|
integrity sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==
|
||||||
|
|
||||||
"@types/eslint-visitor-keys@^1.0.0":
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
|
|
||||||
integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==
|
|
||||||
|
|
||||||
"@types/express-serve-static-core@^4.17.18":
|
"@types/express-serve-static-core@^4.17.18":
|
||||||
version "4.17.20"
|
version "4.17.20"
|
||||||
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.20.tgz#44caee029f2c26c46711da5e845cdc12167ad72d"
|
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.20.tgz#44caee029f2c26c46711da5e845cdc12167ad72d"
|
||||||
@ -3763,49 +3758,76 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71"
|
resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71"
|
||||||
integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg==
|
integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg==
|
||||||
|
|
||||||
"@typescript-eslint/eslint-plugin@^2.9.0":
|
"@typescript-eslint/eslint-plugin@^4.25.0":
|
||||||
version "2.34.0"
|
version "4.25.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.25.0.tgz#d82657b6ab4caa4c3f888ff923175fadc2f31f2a"
|
||||||
integrity sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==
|
integrity sha512-Qfs3dWkTMKkKwt78xp2O/KZQB8MPS1UQ5D3YW2s6LQWBE1074BE+Rym+b1pXZIX3M3fSvPUDaCvZLKV2ylVYYQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/experimental-utils" "2.34.0"
|
"@typescript-eslint/experimental-utils" "4.25.0"
|
||||||
|
"@typescript-eslint/scope-manager" "4.25.0"
|
||||||
|
debug "^4.1.1"
|
||||||
functional-red-black-tree "^1.0.1"
|
functional-red-black-tree "^1.0.1"
|
||||||
|
lodash "^4.17.15"
|
||||||
regexpp "^3.0.0"
|
regexpp "^3.0.0"
|
||||||
|
semver "^7.3.2"
|
||||||
tsutils "^3.17.1"
|
tsutils "^3.17.1"
|
||||||
|
|
||||||
"@typescript-eslint/experimental-utils@2.34.0":
|
"@typescript-eslint/experimental-utils@4.25.0":
|
||||||
version "2.34.0"
|
version "4.25.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.25.0.tgz#b2febcfa715d2c1806fd5f0335193a6cd270df54"
|
||||||
integrity sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==
|
integrity sha512-f0doRE76vq7NEEU0tw+ajv6CrmPelw5wLoaghEHkA2dNLFb3T/zJQqGPQ0OYt5XlZaS13MtnN+GTPCuUVg338w==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/json-schema" "^7.0.3"
|
"@types/json-schema" "^7.0.3"
|
||||||
"@typescript-eslint/typescript-estree" "2.34.0"
|
"@typescript-eslint/scope-manager" "4.25.0"
|
||||||
|
"@typescript-eslint/types" "4.25.0"
|
||||||
|
"@typescript-eslint/typescript-estree" "4.25.0"
|
||||||
eslint-scope "^5.0.0"
|
eslint-scope "^5.0.0"
|
||||||
eslint-utils "^2.0.0"
|
eslint-utils "^2.0.0"
|
||||||
|
|
||||||
"@typescript-eslint/parser@^2.9.0":
|
"@typescript-eslint/parser@^4.25.0":
|
||||||
version "2.34.0"
|
version "4.25.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.25.0.tgz#6b2cb6285aa3d55bfb263c650739091b0f19aceb"
|
||||||
integrity sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==
|
integrity sha512-OZFa1SKyEJpAhDx8FcbWyX+vLwh7OEtzoo2iQaeWwxucyfbi0mT4DijbOSsTgPKzGHr6GrF2V5p/CEpUH/VBxg==
|
||||||
dependencies:
|
|
||||||
"@types/eslint-visitor-keys" "^1.0.0"
|
|
||||||
"@typescript-eslint/experimental-utils" "2.34.0"
|
|
||||||
"@typescript-eslint/typescript-estree" "2.34.0"
|
|
||||||
eslint-visitor-keys "^1.1.0"
|
|
||||||
|
|
||||||
"@typescript-eslint/typescript-estree@2.34.0":
|
|
||||||
version "2.34.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5"
|
|
||||||
integrity sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@typescript-eslint/scope-manager" "4.25.0"
|
||||||
|
"@typescript-eslint/types" "4.25.0"
|
||||||
|
"@typescript-eslint/typescript-estree" "4.25.0"
|
||||||
debug "^4.1.1"
|
debug "^4.1.1"
|
||||||
eslint-visitor-keys "^1.1.0"
|
|
||||||
glob "^7.1.6"
|
"@typescript-eslint/scope-manager@4.25.0":
|
||||||
|
version "4.25.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.25.0.tgz#9d86a5bcc46ef40acd03d85ad4e908e5aab8d4ca"
|
||||||
|
integrity sha512-2NElKxMb/0rya+NJG1U71BuNnp1TBd1JgzYsldsdA83h/20Tvnf/HrwhiSlNmuq6Vqa0EzidsvkTArwoq+tH6w==
|
||||||
|
dependencies:
|
||||||
|
"@typescript-eslint/types" "4.25.0"
|
||||||
|
"@typescript-eslint/visitor-keys" "4.25.0"
|
||||||
|
|
||||||
|
"@typescript-eslint/types@4.25.0":
|
||||||
|
version "4.25.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.25.0.tgz#0e444a5c5e3c22d7ffa5e16e0e60510b3de5af87"
|
||||||
|
integrity sha512-+CNINNvl00OkW6wEsi32wU5MhHti2J25TJsJJqgQmJu3B3dYDBcmOxcE5w9cgoM13TrdE/5ND2HoEnBohasxRQ==
|
||||||
|
|
||||||
|
"@typescript-eslint/typescript-estree@4.25.0":
|
||||||
|
version "4.25.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.25.0.tgz#942e4e25888736bff5b360d9b0b61e013d0cfa25"
|
||||||
|
integrity sha512-1B8U07TGNAFMxZbSpF6jqiDs1cVGO0izVkf18Q/SPcUAc9LhHxzvSowXDTvkHMWUVuPpagupaW63gB6ahTXVlg==
|
||||||
|
dependencies:
|
||||||
|
"@typescript-eslint/types" "4.25.0"
|
||||||
|
"@typescript-eslint/visitor-keys" "4.25.0"
|
||||||
|
debug "^4.1.1"
|
||||||
|
globby "^11.0.1"
|
||||||
is-glob "^4.0.1"
|
is-glob "^4.0.1"
|
||||||
lodash "^4.17.15"
|
|
||||||
semver "^7.3.2"
|
semver "^7.3.2"
|
||||||
tsutils "^3.17.1"
|
tsutils "^3.17.1"
|
||||||
|
|
||||||
|
"@typescript-eslint/visitor-keys@4.25.0":
|
||||||
|
version "4.25.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.25.0.tgz#863e7ed23da4287c5b469b13223255d0fde6aaa7"
|
||||||
|
integrity sha512-AmkqV9dDJVKP/TcZrbf6s6i1zYXt5Hl8qOLrRDTFfRNae4+LB8A4N3i+FLZPW85zIxRy39BgeWOfMS3HoH5ngg==
|
||||||
|
dependencies:
|
||||||
|
"@typescript-eslint/types" "4.25.0"
|
||||||
|
eslint-visitor-keys "^2.0.0"
|
||||||
|
|
||||||
"@webassemblyjs/ast@1.9.0":
|
"@webassemblyjs/ast@1.9.0":
|
||||||
version "1.9.0"
|
version "1.9.0"
|
||||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
|
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user