Feat: multi content authoring (#4139)

This commit is contained in:
Erez Rokah
2020-09-20 10:30:46 -07:00
committed by GitHub
parent 7968e01e29
commit cb2ad687ee
65 changed files with 4331 additions and 1521 deletions

View File

@ -30,11 +30,17 @@ export interface ImplementationEntry {
file: { path: string; label?: string; id?: string | null; author?: string; updatedOn?: string };
}
export interface UnpublishedEntryDiff {
id: string;
path: string;
newFile: boolean;
}
export interface UnpublishedEntry {
slug: string;
collection: string;
status: string;
diffs: { id: string; path: string; newFile: boolean }[];
diffs: UnpublishedEntryDiff[];
updatedAt: string;
}
@ -45,13 +51,23 @@ export interface Map {
set: <T>(key: string, value: T) => Map;
}
export type DataFile = {
path: string;
slug: string;
raw: string;
newPath?: string;
};
export type AssetProxy = {
path: string;
fileObj?: File;
toBase64?: () => Promise<string>;
};
export type Entry = { path: string; slug: string; raw: string; newPath?: string };
export type Entry = {
dataFiles: DataFile[];
assets: AssetProxy[];
};
export type PersistOptions = {
newEntry?: boolean;
@ -116,9 +132,9 @@ export interface Implementation {
getMedia: (folder?: string) => Promise<ImplementationMediaFile[]>;
getMediaFile: (path: string) => Promise<ImplementationMediaFile>;
persistEntry: (obj: Entry, assetProxies: AssetProxy[], opts: PersistOptions) => Promise<void>;
persistEntry: (entry: Entry, opts: PersistOptions) => Promise<void>;
persistMedia: (file: AssetProxy, opts: PersistOptions) => Promise<ImplementationMediaFile>;
deleteFile: (path: string, commitMessage: string) => Promise<void>;
deleteFiles: (paths: string[], commitMessage: string) => Promise<void>;
unpublishedEntries: () => Promise<string[]>;
unpublishedEntry: (args: {

View File

@ -20,6 +20,7 @@ import { asyncLock, AsyncLock as AL } from './asyncLock';
import {
Implementation as I,
ImplementationEntry as IE,
UnpublishedEntryDiff as UED,
UnpublishedEntry as UE,
ImplementationMediaFile as IMF,
ImplementationFile as IF,
@ -40,6 +41,7 @@ import {
UnpublishedEntryMediaFile as UEMF,
blobToFileObj,
allEntriesByFolder,
DataFile as DF,
} from './implementation';
import {
readFile,
@ -76,6 +78,7 @@ import {
export type AsyncLock = AL;
export type Implementation = I;
export type ImplementationEntry = IE;
export type UnpublishedEntryDiff = UED;
export type UnpublishedEntry = UE;
export type ImplementationMediaFile = IMF;
export type ImplementationFile = IF;
@ -91,6 +94,7 @@ export type ApiRequest = AR;
export type Config = C;
export type FetchError = FE;
export type PointerFile = PF;
export type DataFile = DF;
export const NetlifyCmsLibUtil = {
APIError,