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