alinea 2.0.0-preview.1 → 2.0.0-preview.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/LICENSES.md +34 -7
  3. package/dist/adapter/next/DevRemote.d.ts +3 -0
  4. package/dist/adapter/next/DevRemote.js +37 -0
  5. package/dist/adapter/next/ForwardCredentials.d.ts +1 -0
  6. package/dist/adapter/next/ForwardCredentials.js +17 -0
  7. package/dist/adapter/next/cms.js +86 -38
  8. package/dist/adapter/next/context.d.ts +1 -1
  9. package/dist/adapter/next/context.js +11 -3
  10. package/dist/adapter/next/handler.d.ts +2 -0
  11. package/dist/adapter/next/handler.js +23 -16
  12. package/dist/adapter/next/previews.js +3 -1
  13. package/dist/adapter/next/previews.spec.d.ts +1 -0
  14. package/dist/adapter/next/with-alinea.js +18 -16
  15. package/dist/backend/Handler.d.ts +14 -13
  16. package/dist/backend/Handler.js +53 -22
  17. package/dist/backend/resolver/ParsePreview.d.ts +8 -4
  18. package/dist/backend/resolver/ParsePreview.js +40 -43
  19. package/dist/bundled.d.ts +318 -77
  20. package/dist/chunks/{chunk-LUBOGJCG.js → chunk-6V4TAD2N.js} +1 -1
  21. package/dist/chunks/{chunk-TL7ZW6BX.js → chunk-A3XXZBOQ.js} +2535 -2999
  22. package/dist/chunks/chunk-AC5ATYI3.js +1434 -0
  23. package/dist/chunks/{chunk-FRYHNUEK.js → chunk-HFBZMKIN.js} +6 -3
  24. package/dist/chunks/{chunk-7ORQ7BYK.js → chunk-KMLLLZ6X.js} +202 -269
  25. package/dist/chunks/{chunk-IWN3T3FL.js → chunk-O7XWTMCB.js} +1 -1
  26. package/dist/chunks/{chunk-53DZYORR.js → chunk-PAYSVIYI.js} +76 -176
  27. package/dist/chunks/{chunk-YK3OSMDM.js → chunk-S4AU6SRS.js} +188 -158
  28. package/dist/chunks/{chunk-I7X64JTZ.js → chunk-VXZM6V4P.js} +4 -4
  29. package/dist/cli/Generate.js +3 -13
  30. package/dist/cli/Serve.js +7 -3
  31. package/dist/cli/bin.js +8 -5
  32. package/dist/cli/generate/CopyStaticFiles.js +2 -3
  33. package/dist/cli/generate/DevDB.d.ts +1 -1
  34. package/dist/cli/generate/DevDB.js +3 -5
  35. package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
  36. package/dist/cli/serve/CreateLocalServer.js +3 -2
  37. package/dist/cli/serve/DevServer.d.ts +3 -2
  38. package/dist/cli/serve/DevServer.js +60 -3
  39. package/dist/cli/serve/ServeContext.d.ts +1 -0
  40. package/dist/cli/serve/StartServer.d.ts +1 -0
  41. package/dist/cli/serve/StartServer.js +6 -1
  42. package/dist/cli/util/EnsureLibs.js +2 -2
  43. package/dist/cli/util/EnsureNode.js +2 -2
  44. package/dist/cloud/CloudRemote.js +1 -1
  45. package/dist/components/Breadcrumbs.js +6 -6
  46. package/dist/components/Button.js +6 -6
  47. package/dist/components/Calendar.js +13 -13
  48. package/dist/components/Checkbox.js +8 -8
  49. package/dist/components/CheckboxGroup.js +6 -6
  50. package/dist/components/ColorSwatch.js +6 -6
  51. package/dist/components/ColorSwatchPicker.js +6 -6
  52. package/dist/components/ComboBox.js +17 -17
  53. package/dist/components/DateField.js +7 -7
  54. package/dist/components/DatePicker.js +9 -9
  55. package/dist/components/DateRangePicker.js +14 -14
  56. package/dist/components/Dialog.js +6 -6
  57. package/dist/components/Disclosure.js +13 -13
  58. package/dist/components/DropZone.js +6 -6
  59. package/dist/components/Label.js +14 -14
  60. package/dist/components/Link.js +6 -6
  61. package/dist/components/List.js +34 -34
  62. package/dist/components/Menu.js +9 -9
  63. package/dist/components/Modal.js +9 -9
  64. package/dist/components/MultipleSelect.js +28 -28
  65. package/dist/components/NumberField.d.ts +2 -1
  66. package/dist/components/NumberField.js +22 -12
  67. package/dist/components/Popover.js +6 -6
  68. package/dist/components/ProgressCircle.js +9 -9
  69. package/dist/components/RadioGroup.js +6 -6
  70. package/dist/components/SearchField.js +14 -14
  71. package/dist/components/Select.js +16 -16
  72. package/dist/components/Surface.js +2 -2
  73. package/dist/components/Switch.js +8 -8
  74. package/dist/components/Table.js +14 -14
  75. package/dist/components/Tabs.js +9 -9
  76. package/dist/components/TagGroup.js +6 -6
  77. package/dist/components/TextField.js +10 -10
  78. package/dist/components/TimeField.js +8 -8
  79. package/dist/components/Toggle.js +8 -8
  80. package/dist/components/Toolbar.js +8 -8
  81. package/dist/components/Tooltip.js +9 -9
  82. package/dist/components/Tree.d.ts +4 -2
  83. package/dist/components/Tree.js +27 -13
  84. package/dist/core/Client.js +3 -2
  85. package/dist/core/Config.d.ts +4 -0
  86. package/dist/core/Config.js +6 -0
  87. package/dist/core/Connection.d.ts +2 -2
  88. package/dist/core/Connection.js +7 -0
  89. package/dist/core/Graph.d.ts +4 -5
  90. package/dist/core/Infer.d.ts +8 -1
  91. package/dist/core/ListRow.d.ts +2 -0
  92. package/dist/core/OrderBy.d.ts +7 -3
  93. package/dist/core/TextDoc.d.ts +11 -0
  94. package/dist/core/Trace.d.ts +8 -0
  95. package/dist/core/Trace.js +32 -0
  96. package/dist/core/db/CommitRequest.d.ts +0 -3
  97. package/dist/core/db/CommitRequest.js +0 -9
  98. package/dist/core/db/EntryAliases.js +1 -4
  99. package/dist/core/db/EntryDB.js +1 -1
  100. package/dist/core/db/EntryIndex.d.ts +10 -0
  101. package/dist/core/db/EntryIndex.js +117 -9
  102. package/dist/core/db/EntryResolver.js +110 -35
  103. package/dist/core/db/EntryTransaction.d.ts +1 -2
  104. package/dist/core/db/EntryTransaction.js +26 -13
  105. package/dist/core/db/LocalDB.d.ts +2 -3
  106. package/dist/core/db/LocalDB.js +24 -19
  107. package/dist/core/db/Operation.d.ts +2 -2
  108. package/dist/core/db/Operation.js +11 -1
  109. package/dist/core/field/RichTextField.d.ts +30 -3
  110. package/dist/core/field/RichTextField.js +125 -41
  111. package/dist/core/media/MediaAltField.d.ts +1 -0
  112. package/dist/core/media/MediaAltField.js +9 -1
  113. package/dist/core/source/OverlaySource.d.ts +12 -0
  114. package/dist/core/source/OverlaySource.js +50 -0
  115. package/dist/core/source/Source.d.ts +1 -1
  116. package/dist/core/source/Source.js +3 -3
  117. package/dist/dashboard/App.css +158 -0
  118. package/dist/dashboard/App.js +10 -4
  119. package/dist/dashboard/app/AccessDenied.d.ts +16 -1
  120. package/dist/dashboard/app/AccessDenied.js +20 -11
  121. package/dist/dashboard/app/ActivityStatus.js +15 -15
  122. package/dist/dashboard/app/AuthView.js +11 -11
  123. package/dist/dashboard/app/Badge.js +2 -2
  124. package/dist/dashboard/app/CompactField.js +12 -12
  125. package/dist/dashboard/app/DashboardErrorBoundary.js +4 -4
  126. package/dist/dashboard/app/DashboardLayout.js +22 -19
  127. package/dist/dashboard/app/EntryHeader.js +10 -10
  128. package/dist/dashboard/app/EntryReferences.js +10 -10
  129. package/dist/dashboard/app/EntrySidebar.d.ts +1 -1
  130. package/dist/dashboard/app/EntrySidebar.js +16 -15
  131. package/dist/dashboard/app/EntrySidebarPreview.d.ts +1 -1
  132. package/dist/dashboard/app/EntrySidebarPreview.js +60 -29
  133. package/dist/dashboard/app/EntrySidebarPreview.story.d.ts +6 -1
  134. package/dist/dashboard/app/EntryTranslationBanner.js +7 -7
  135. package/dist/dashboard/app/Explorer.d.ts +2 -1
  136. package/dist/dashboard/app/Explorer.js +63 -51
  137. package/dist/dashboard/app/ExplorerCards.js +51 -55
  138. package/dist/dashboard/app/ExplorerFileCard.js +20 -20
  139. package/dist/dashboard/app/ExplorerList.js +14 -14
  140. package/dist/dashboard/app/ExplorerModal.js +1 -1
  141. package/dist/dashboard/app/ExplorerTable.js +59 -59
  142. package/dist/dashboard/app/ExternalLinkPicker.js +15 -4
  143. package/dist/dashboard/app/LinkPicker.js +40 -15
  144. package/dist/dashboard/app/LocaleMenu.js +8 -8
  145. package/dist/dashboard/app/SidebarLayout.d.ts +8 -0
  146. package/dist/dashboard/app/SidebarLayout.js +1169 -0
  147. package/dist/dashboard/app/SidebarTree.js +56 -64
  148. package/dist/dashboard/app/WorkspaceMenu.js +14 -14
  149. package/dist/dashboard/app/WorkspaceRoots.js +24 -24
  150. package/dist/dashboard/app/editor/FileEditor.js +29 -30
  151. package/dist/dashboard/app/editor/FilePreview.js +6 -6
  152. package/dist/dashboard/app/editor/MediaAltField.view.d.ts +1 -1
  153. package/dist/dashboard/app/editor/MediaAltField.view.js +6 -9
  154. package/dist/dashboard/app/modals/CreateEntry.js +5 -5
  155. package/dist/dashboard/app/pages/EntryPage.js +49 -25
  156. package/dist/dashboard/app/pages/UsersPage.js +35 -35
  157. package/dist/dashboard/app/ui/DashboardModal.js +23 -23
  158. package/dist/dashboard/app/ui/Rail.js +3 -3
  159. package/dist/dashboard/app/ui/Sidebar.js +2 -2
  160. package/dist/dashboard/atoms/auth.js +2 -0
  161. package/dist/dashboard/atoms/dashboard.d.ts +9 -0
  162. package/dist/dashboard/atoms/dashboard.js +17 -0
  163. package/dist/dashboard/atoms/editor.d.ts +7 -1
  164. package/dist/dashboard/atoms/editor.js +4 -1
  165. package/dist/dashboard/atoms/entry.d.ts +3 -1
  166. package/dist/dashboard/atoms/entry.js +55 -15
  167. package/dist/dashboard/atoms/explorer.js +3 -8
  168. package/dist/dashboard/atoms/preview.d.ts +3 -0
  169. package/dist/dashboard/atoms/preview.js +18 -1
  170. package/dist/dashboard/hooks.d.ts +4 -2
  171. package/dist/dashboard/hooks.js +9 -5
  172. package/dist/dashboard/icons.d.ts +1 -0
  173. package/dist/dashboard/icons.js +10 -0
  174. package/dist/field/code/CodeField.view.js +13 -13
  175. package/dist/field/date/DateField.view.js +12 -2
  176. package/dist/field/link/EntryLink.d.ts +1 -1
  177. package/dist/field/link/EntryLink.js +1 -0
  178. package/dist/field/link/Link.js +3 -2
  179. package/dist/field/link/LinkField.d.ts +5 -0
  180. package/dist/field/link/LinkField.view.js +115 -87
  181. package/dist/field/list/ListField.view.js +22 -33
  182. package/dist/field/metadata/MetadataField.d.ts +2 -0
  183. package/dist/field/metadata/MetadataField.js +2 -1
  184. package/dist/field/metadata/MetadataField.view.js +18 -18
  185. package/dist/field/number/NumberField.d.ts +2 -0
  186. package/dist/field/number/NumberField.view.js +4 -2
  187. package/dist/field/richtext/PickTextLink.d.ts +7 -0
  188. package/dist/field/richtext/PickTextLink.js +104 -2
  189. package/dist/field/richtext/ReferenceLink.d.ts +4 -1
  190. package/dist/field/richtext/ReferenceLink.js +18 -4
  191. package/dist/field/richtext/RichTextBlock.js +2 -2
  192. package/dist/field/richtext/RichTextDocument.d.ts +7 -2
  193. package/dist/field/richtext/RichTextDocument.js +34 -5
  194. package/dist/field/richtext/RichTextExtensions.d.ts +3 -1
  195. package/dist/field/richtext/RichTextExtensions.js +2701 -7464
  196. package/dist/field/richtext/RichTextField.d.ts +4 -0
  197. package/dist/field/richtext/RichTextField.story.d.ts +4 -0
  198. package/dist/field/richtext/RichTextField.view.js +43 -20
  199. package/dist/field/richtext/RichTextInsertMenu.js +279 -493
  200. package/dist/field/richtext/RichTextToolbar.d.ts +5 -2
  201. package/dist/field/richtext/RichTextToolbar.js +38 -3
  202. package/dist/field/richtext/Toolbar.d.ts +19 -1
  203. package/dist/field/richtext/Toolbar.js +18 -13
  204. package/dist/field/richtext/extensions/Anchor.js +1 -1
  205. package/dist/field/richtext/extensions/Link.js +1 -1
  206. package/dist/field/richtext/extensions/Small.js +1 -1
  207. package/dist/field/select/SelectField.view.js +8 -6
  208. package/dist/index.css +240 -14
  209. package/dist/next.cjs +18 -16
  210. package/dist/next.d.ts +2 -1
  211. package/dist/next.edge.d.ts +2 -1
  212. package/dist/preview/PreviewMessage.d.ts +3 -0
  213. package/dist/preview/PreviewMessage.js +1 -0
  214. package/dist/preview/RegisterPreview.js +29 -9
  215. package/dist/preview/widget.js +6 -12
  216. package/dist/query.d.ts +7 -7
  217. package/dist/ui/RichText.d.ts +1 -0
  218. package/dist/ui/RichText.js +29 -2
  219. package/package.json +6 -3
  220. package/dist/chunks/{chunk-JFROOUG6.js → chunk-NIVGVRDS.js} +17 -17
@@ -17,6 +17,7 @@ import {
17
17
  BLOB_SEQUENCE_CONTENT_TYPE,
18
18
  encodeBlobSequence
19
19
  } from "alinea/core/BlobTransport";
20
+ import { developmentKeyHeader } from "alinea/core/Connection";
20
21
  import { ErrorCode, HttpError } from "alinea/core/HttpError";
21
22
  import { assertUploadSize } from "alinea/core/media/UploadLimits";
22
23
  import { Permission, Policy } from "alinea/core/Role";
@@ -26,7 +27,7 @@ import { base64 } from "alinea/core/util/Encoding";
26
27
  import { isRecord } from "alinea/core/util/Objects";
27
28
  import { InvalidCredentialsError, MissingCredentialsError } from "./Auth.js";
28
29
  import { HandleAction } from "./HandleAction.js";
29
- import { createPreviewParser } from "./resolver/ParsePreview.js";
30
+ import { applyPreview, decodePreviewRequest } from "./resolver/ParsePreview.js";
30
31
  import { compressResponse } from "./router/Router.js";
31
32
  import { createThrottledSync } from "./util/Syncable.js";
32
33
  var PrepareBody = object({
@@ -37,13 +38,10 @@ function createHandler({
37
38
  cms,
38
39
  remote = (context) => new CloudRemote(context, cms.config),
39
40
  db,
41
+ forwardMutations,
40
42
  ...hooks
41
43
  }) {
42
44
  const throttle = createThrottledSync();
43
- const previewParser = PLazy.from(async () => {
44
- const local = await db;
45
- return createPreviewParser(local);
46
- });
47
45
  return async function handle(request, context) {
48
46
  const dev = process.env.ALINEA_DEV_SERVER;
49
47
  const local = await db;
@@ -93,11 +91,10 @@ function createHandler({
93
91
  };
94
92
  } catch (cause) {
95
93
  if (cause instanceof MissingCredentialsError) {
96
- const authorization = request.headers.get("authorization");
97
- const bearer = authorization?.slice("Bearer ".length);
94
+ const credential = context.isDev ? request.headers.get(developmentKeyHeader) : request.headers.get("authorization")?.slice("Bearer ".length);
98
95
  if (!context.apiKey)
99
96
  throw new MissingCredentialsError("Missing API key", { cause });
100
- if (bearer !== context.apiKey)
97
+ if (credential !== context.apiKey)
101
98
  throw new InvalidCredentialsError("Expected matching api key", {
102
99
  cause
103
100
  });
@@ -164,43 +161,77 @@ function createHandler({
164
161
  const scope = getScope(cms.config);
165
162
  const query = scope.parse(raw);
166
163
  if (!query.preview) {
167
- await periodicSync(cnx, query.syncInterval);
164
+ await periodicSync(
165
+ cnx,
166
+ query.disableSync ? Number.POSITIVE_INFINITY : query.syncInterval ?? cms.config.syncInterval
167
+ );
168
168
  } else {
169
- const { parse } = await previewParser;
170
- const preview = await parse(query.preview, () => local.syncWith(cnx));
171
- query.preview = preview;
169
+ const preview = await decodePreviewRequest(query.preview);
170
+ if ("contentHash" in preview && local.sha !== preview.contentHash)
171
+ await local.syncWith(cnx);
172
+ query.preview = await applyPreview(local, preview);
172
173
  }
173
174
  return Response.json(await local.resolve(query) ?? null);
174
175
  }
175
176
  if (action === HandleAction.Mutate && request.method === "POST") {
177
+ if (forwardMutations && userCtx) {
178
+ const forwarded = await forwardMutations(request.clone(), userCtx);
179
+ if (forwarded) return forwarded;
180
+ }
176
181
  const user = expectUser();
177
182
  expectJson();
178
183
  const policy = await user.policy;
179
- const mutations = await body;
184
+ let mutations = await body;
185
+ await local.syncWith(cnx);
186
+ const adjusted = await hooks.beforeCommit?.({ mutations });
187
+ if (adjusted) mutations = adjusted;
180
188
  const attempt = async (retry = 0) => {
181
- await local.syncWith(cnx);
189
+ if (retry > 0) await local.syncWith(cnx);
182
190
  const request2 = {
183
191
  ...await local.request(mutations, policy),
184
192
  user: user.claims
185
193
  };
186
194
  try {
187
- let { sha } = await cnx.write(request2);
188
- if (sha === request2.intoSha) {
195
+ let { sha: sha2 } = await cnx.write(request2);
196
+ if (sha2 === request2.intoSha) {
189
197
  await local.write(request2);
190
198
  } else {
191
- sha = await local.syncWith(cnx);
199
+ sha2 = await local.syncWith(cnx);
192
200
  }
193
- return sha;
201
+ return sha2;
194
202
  } catch (error) {
195
- if (error instanceof ShaMismatchError && retry < 3)
196
- return attempt(retry + 1);
203
+ const isConflict = error instanceof ShaMismatchError || error instanceof HttpError && error.code === 409 || error instanceof Response && error.status === 409;
204
+ if (isConflict && retry < 3) return attempt(retry + 1);
197
205
  throw error;
198
206
  }
199
207
  };
200
- return Response.json({ sha: await attempt() });
208
+ const sha = await attempt();
209
+ try {
210
+ await hooks.afterCommit?.({
211
+ mutations,
212
+ sha
213
+ });
214
+ } catch (error) {
215
+ console.error("Alinea afterCommit hook failed", error);
216
+ }
217
+ return Response.json({ sha });
201
218
  }
202
219
  if (action === HandleAction.Commit && request.method === "POST") {
203
- throw new Error("Mutations expected");
220
+ if (!context.isDev)
221
+ throw new HttpError(400, "Commits are only accepted in development");
222
+ const developmentKey = request.headers.get(developmentKeyHeader);
223
+ if (!context.apiKey || developmentKey !== context.apiKey)
224
+ throw new HttpError(401, "Invalid development commit credentials");
225
+ const user = expectUser();
226
+ expectJson();
227
+ const commit = {
228
+ ...await body,
229
+ user: user.claims
230
+ };
231
+ let { sha } = await cnx.write(commit);
232
+ if (sha === commit.intoSha) await local.write(commit);
233
+ else sha = await local.syncWith(cnx);
234
+ return Response.json({ sha });
204
235
  }
205
236
  if (action === HandleAction.History && request.method === "GET") {
206
237
  expectUser();
@@ -1,5 +1,9 @@
1
1
  import type { LocalDB } from 'alinea/core/db/LocalDB';
2
- import type { PreviewRequest } from 'alinea/core/Preview';
3
- export declare function createPreviewParser(local: LocalDB): {
4
- parse(preview: PreviewRequest, sync: () => Promise<unknown>): Promise<PreviewRequest | undefined>;
5
- };
2
+ import { Entry } from 'alinea/core/Entry';
3
+ import type { PreviewRequest, PreviewUpdate } from 'alinea/core/Preview';
4
+ export interface DecodedEntryPreview {
5
+ entry: Entry;
6
+ }
7
+ export type DecodedPreviewRequest = PreviewUpdate | DecodedEntryPreview;
8
+ export declare function decodePreviewRequest(preview: PreviewRequest): Promise<DecodedPreviewRequest>;
9
+ export declare function applyPreview(local: LocalDB, preview: DecodedPreviewRequest): Promise<PreviewRequest | undefined>;
@@ -5,53 +5,50 @@ import { JsonLoader } from "alinea/backend/loader/JsonLoader";
5
5
  import { Entry } from "alinea/core/Entry";
6
6
  import { createRecord, parseRecord } from "alinea/core/EntryRecord";
7
7
  import { applyFilePatch } from "alinea/core/source/FilePatch";
8
+ import { trace } from "alinea/core/Trace";
8
9
  import { createEntryRow } from "alinea/core/util/EntryRows";
9
10
  import { decodePreviewPayload } from "alinea/preview/PreviewPayload";
10
11
  var decoder = new TextDecoder();
11
- function createPreviewParser(local) {
12
- return {
13
- async parse(preview, sync) {
14
- if (!(preview && "payload" in preview)) return preview;
15
- const payload = await decodePreviewPayload(preview.payload);
16
- if (local.sha !== payload.contentHash) {
17
- await sync();
18
- if (local.sha !== payload.contentHash) return;
19
- }
20
- const entry = await local.first({
21
- select: Entry,
22
- id: payload.entryId,
23
- locale: payload.locale,
24
- status: "preferDraft"
25
- });
26
- if (!entry) return;
27
- const baseText = decoder.decode(
28
- JsonLoader.format(
29
- local.config.schema,
30
- createRecord(entry, entry.status)
31
- )
32
- );
33
- let updatedText;
34
- try {
35
- updatedText = await applyFilePatch(baseText, payload.patch);
36
- } catch {
37
- return;
38
- }
39
- const { data } = parseRecord(JSON.parse(updatedText));
40
- const { rowHash: _rowHash, fileHash: _fileHash, ...withoutHashes } = entry;
41
- const patched = await createEntryRow(
42
- local.config,
43
- {
44
- ...withoutHashes,
45
- title: data.title,
46
- data,
47
- path: entry.path
48
- },
49
- entry.status
50
- );
51
- return { entry: patched };
12
+ async function decodePreviewRequest(preview) {
13
+ if ("entry" in preview) return preview;
14
+ return decodePreviewPayload(preview.payload);
15
+ }
16
+ async function applyPreview(local, preview) {
17
+ if ("entry" in preview) return preview;
18
+ const span = trace(local.config, "alinea.preview.apply");
19
+ return span(async () => {
20
+ const entry = await local.first({
21
+ select: Entry,
22
+ id: preview.entryId,
23
+ locale: preview.locale,
24
+ status: "preferDraft"
25
+ });
26
+ if (!entry) return;
27
+ const baseText = decoder.decode(
28
+ JsonLoader.format(local.config.schema, createRecord(entry, entry.status))
29
+ );
30
+ let updatedText;
31
+ try {
32
+ updatedText = await applyFilePatch(baseText, preview.patch);
33
+ } catch {
34
+ return;
52
35
  }
53
- };
36
+ const { data } = parseRecord(JSON.parse(updatedText));
37
+ const { rowHash: _rowHash, fileHash: _fileHash, ...withoutHashes } = entry;
38
+ const patched = await createEntryRow(
39
+ local.config,
40
+ {
41
+ ...withoutHashes,
42
+ title: data.title,
43
+ data,
44
+ path: entry.path
45
+ },
46
+ entry.status
47
+ );
48
+ return { entry: patched };
49
+ });
54
50
  }
55
51
  export {
56
- createPreviewParser
52
+ applyPreview,
53
+ decodePreviewRequest
57
54
  };