(dataFiles: DataFile[], mediaFiles: AssetProxy[], options: PersistOptions)
| 920 | } |
| 921 | |
| 922 | async persistFiles(dataFiles: DataFile[], mediaFiles: AssetProxy[], options: PersistOptions) { |
| 923 | const files = mediaFiles.concat(dataFiles); |
| 924 | const uploadPromises = files.map(file => this.uploadBlob(file)); |
| 925 | await Promise.all(uploadPromises); |
| 926 | |
| 927 | if (!options.useWorkflow) { |
| 928 | return this.getDefaultBranch() |
| 929 | .then(branchData => |
| 930 | this.updateTree(branchData.commit.sha, files as { sha: string; path: string }[]), |
| 931 | ) |
| 932 | .then(changeTree => this.commit(options.commitMessage, changeTree)) |
| 933 | .then(response => this.patchBranch(this.branch, response.sha)); |
| 934 | } else { |
| 935 | const mediaFilesList = (mediaFiles as { sha: string; path: string }[]).map( |
| 936 | ({ sha, path }) => ({ |
| 937 | path: trimStart(path, '/'), |
| 938 | sha, |
| 939 | }), |
| 940 | ); |
| 941 | const slug = dataFiles[0].slug; |
| 942 | return this.editorialWorkflowGit(files as TreeFile[], slug, mediaFilesList, options); |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | async getFileSha(path: string, { repoURL = this.repoURL, branch = this.branch } = {}) { |
| 947 | /** |
no test coverage detected