@supernova-studio/client 0.10.2 → 0.12.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/client",
3
- "version": "0.10.2",
3
+ "version": "0.12.0",
4
4
  "description": "Supernova Data Models",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -1,18 +1,17 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
 
3
- import { DocumentationItemConfiguration } from "@supernova-studio/model"
3
+ import { DocumentationItemConfiguration } from "@supernova-studio/model";
4
4
 
5
5
  export const CreateBulkElementsInput = z.object({
6
+ parentPersistentId: z.string().uuid(),
6
7
  persistentId: z.string().uuid(),
7
8
  title: z.string(),
8
- configuration: DocumentationItemConfiguration,
9
- parentPersistentId: z.string().nullish(),
10
- afterPersistentId: z.string().nullish(),
9
+ configuration: DocumentationItemConfiguration.optional(),
10
+ afterPersistentId: z.string().uuid().optional(),
11
11
  });
12
12
 
13
13
  export type CreateBulkElementsInput = z.infer<typeof CreateBulkElementsInput>;
14
14
 
15
-
16
15
  export const UpdateBulkElementsInput = z.object({
17
16
  id: z.string(),
18
17
  title: z.string().optional(),
@@ -23,29 +22,26 @@ export const UpdateBulkElementsInput = z.object({
23
22
 
24
23
  export type UpdateBulkElementsInput = z.infer<typeof UpdateBulkElementsInput>;
25
24
 
26
-
27
25
  export const DeleteBulkElementsInput = z.array(z.string());
28
26
 
29
27
  export type DeleteBulkElementsInput = z.infer<typeof DeleteBulkElementsInput>;
30
28
 
31
-
32
29
  export const DuplicateBulkElementsInput = z.object({
33
30
  id: z.string(),
34
31
  persistentId: z.string().uuid(),
35
32
  parentPersistentId: z.string().uuid(),
36
- afterPersistentId: z.string().uuid().nullish(),
33
+ afterPersistentId: z.string().uuid().optional(),
37
34
  });
38
35
 
39
36
  export type DuplicateBulkElementsInput = z.infer<typeof DuplicateBulkElementsInput>;
40
37
 
41
-
42
38
  export const BulkEditDocPageElementsInput = z.object({
43
- documentationPages: z.object({
44
- create: z.array(CreateBulkElementsInput).optional(),
45
- update: z.array(UpdateBulkElementsInput).optional(),
46
- delete: DeleteBulkElementsInput.optional(),
47
- duplicate: z.array(DuplicateBulkElementsInput).optional()
48
- })
39
+ documentationPages: z.object({
40
+ create: z.array(CreateBulkElementsInput).optional(),
41
+ update: z.array(UpdateBulkElementsInput).optional(),
42
+ delete: DeleteBulkElementsInput.optional(),
43
+ duplicate: z.array(DuplicateBulkElementsInput).optional(),
44
+ }),
49
45
  });
50
46
 
51
- export type BulkEditDocPageElementsInput = z.infer<typeof BulkEditDocPageElementsInput>;
47
+ export type BulkEditDocPageElementsInput = z.infer<typeof BulkEditDocPageElementsInput>;
@@ -1,6 +1,4 @@
1
1
  import { z } from "zod";
2
- import { RoomTypeSchema } from "@supernova-studio/model";
3
-
4
2
  export const PostLiveblocksAuth = z.object({
5
3
  room: z.string(),
6
4
  });
@@ -114,20 +114,6 @@ export function blockToProsemirrorNode(
114
114
  });
115
115
  }
116
116
 
117
- // Embed
118
- const embedProperty = BlockDefinitionUtils.firstEmbedProperty(definition);
119
- const embedType = serializeEmbedType(block.data.packageId);
120
- if (embedProperty && embedType) {
121
- return serializeAsEmbed(
122
- {
123
- block: block,
124
- definition: definition,
125
- property: embedProperty,
126
- },
127
- embedType
128
- );
129
- }
130
-
131
117
  // Divider
132
118
  if (block.data.packageId === "io.supernova.block.divider") {
133
119
  return serializeAsDivider({
@@ -241,7 +227,7 @@ function serializeAsMultiRichTextBlock(input: InputWithProperty): ProsemirrorNod
241
227
 
242
228
  function serializeAsMultiParagraph(input: MultiRichTextInputWithValue): ProsemirrorNode {
243
229
  return {
244
- type: "bulletlist",
230
+ type: "bulletList",
245
231
  attrs: {
246
232
  ...serializeBlockNodeAttributes(input),
247
233
  },
@@ -251,7 +237,7 @@ function serializeAsMultiParagraph(input: MultiRichTextInputWithValue): Prosemir
251
237
 
252
238
  function serializeAsOrderedList(input: MultiRichTextInputWithValue): ProsemirrorNode {
253
239
  return {
254
- type: "orderedlist",
240
+ type: "orderedList",
255
241
  attrs: {
256
242
  ...serializeBlockNodeAttributes(input),
257
243
  start: "1",
@@ -262,7 +248,7 @@ function serializeAsOrderedList(input: MultiRichTextInputWithValue): Prosemirror
262
248
 
263
249
  function serializeAsUnorderedList(input: MultiRichTextInputWithValue): ProsemirrorNode {
264
250
  return {
265
- type: "bulletlist",
251
+ type: "bulletList",
266
252
  attrs: {
267
253
  ...serializeBlockNodeAttributes(input),
268
254
  },
@@ -272,7 +258,7 @@ function serializeAsUnorderedList(input: MultiRichTextInputWithValue): Prosemirr
272
258
 
273
259
  function serializeAsListItem(text: PageBlockText): ProsemirrorNode {
274
260
  return {
275
- type: "listitem",
261
+ type: "listItem",
276
262
  content: [
277
263
  {
278
264
  type: "paragraph",
@@ -381,41 +367,6 @@ function serializeTableNode(node: PageBlockItemTableNode): ProsemirrorNode {
381
367
  }
382
368
  }
383
369
 
384
- //
385
- // Embeds
386
- //
387
-
388
- function serializeAsEmbed(input: InputWithProperty, embedType: string): ProsemirrorNode {
389
- const { block, definition, property: embedProperty } = input;
390
-
391
- const blockItem = BlockParsingUtils.singleBlockItem(block);
392
- const embedValue = BlockParsingUtils.embedPropertyValue(blockItem, embedProperty.id);
393
-
394
- return {
395
- type: "embed",
396
- attrs: {
397
- ...serializeBlockNodeAttributes(input),
398
- type: embedType,
399
- url: embedValue.value,
400
- height: embedValue.height,
401
- caption: embedValue.caption,
402
- },
403
- };
404
- }
405
-
406
- function serializeEmbedType(blockDefinitionId: string): string | undefined {
407
- switch (blockDefinitionId) {
408
- case "io.supernova.block.embed":
409
- return "generic";
410
- case "io.supernova.block.embed-youtube":
411
- return "youtube";
412
- case "io.supernova.block.embed-figma":
413
- return "figma";
414
- }
415
-
416
- return undefined;
417
- }
418
-
419
370
  //
420
371
  // Divider
421
372
  //
@@ -562,7 +513,7 @@ export function serializeAsCustomBlock(block: PageBlockEditorModel, definition:
562
513
  attrs: {
563
514
  id: block.id,
564
515
  definitionId: block.data.packageId,
565
- variantId: block.data.variantId,
516
+ ...(block.data.variantId && { variantId: block.data.variantId }),
566
517
  items: JSON.stringify(items),
567
518
 
568
519
  ...(columns && { columns: columns }),