@supernova-studio/client 0.5.0 → 0.7.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/dist/index.mjs CHANGED
@@ -377,7 +377,8 @@ var DataSourceFigmaRemote = z14.object({
377
377
  scope: DataSourceFigmaScope,
378
378
  state: DataSourceFigmaState,
379
379
  lastImportMetadata: DataSourceFigmaImportMetadata.optional(),
380
- downloadChunkSize: z14.number().optional()
380
+ downloadChunkSize: z14.number().optional(),
381
+ figmaRenderChunkSize: z14.number().optional()
381
382
  });
382
383
  var DataSourceTokenStudioRemote = z14.object({
383
384
  type: z14.literal(DataSourceRemoteType.Enum.TokenStudio)
@@ -875,7 +876,8 @@ var PageBlockImageType = z33.enum(["Upload", "Asset", "FigmaFrame"]);
875
876
  var PageBlockImageAlignment = z33.enum(["Left", "Center", "Stretch"]);
876
877
  var PageBlockTableCellAlignment = z33.enum(["Left", "Center", "Right"]);
877
878
  var PageBlockAppearanceV2 = z33.object({
878
- itemBackgroundColor: ColorValue
879
+ itemBackgroundColor: ColorValue.optional(),
880
+ numberOfColumns: z33.number().optional()
879
881
  });
880
882
  var PageBlockItemUntypedValue = z33.object({
881
883
  value: z33.any()
@@ -1977,20 +1979,26 @@ var DocumentationPage = z88.object({
1977
1979
  updatedAt: z88.date()
1978
1980
  });
1979
1981
  var NpmRegistryAuthType = z89.enum(["Basic", "Bearer", "None", "Custom"]);
1980
- var NpmRegistryType = z89.enum(["NPMJS", "GitHub", "AzureDevOps", "Artifactory", "Custom"]);
1982
+ var registryTypesWithoutAzure = ["NPMJS", "GitHub", "Artifactory", "Custom"];
1983
+ var NpmRegistryType = z89.enum([...registryTypesWithoutAzure, "AzureDevOps"]);
1984
+ var NpmRegistryTypeWithoutAzure = z89.enum(registryTypesWithoutAzure);
1981
1985
  var NpmRegistryBasicAuthConfig = z89.object({
1986
+ registryType: NpmRegistryType,
1982
1987
  authType: z89.literal(NpmRegistryAuthType.Enum.Basic),
1983
1988
  username: z89.string(),
1984
1989
  password: z89.string()
1985
1990
  });
1986
1991
  var NpmRegistryBearerAuthConfig = z89.object({
1992
+ registryType: NpmRegistryTypeWithoutAzure,
1987
1993
  authType: z89.literal(NpmRegistryAuthType.Enum.Bearer),
1988
1994
  accessToken: z89.string()
1989
1995
  });
1990
1996
  var NpmRegistryNoAuthConfig = z89.object({
1997
+ registryType: NpmRegistryTypeWithoutAzure,
1991
1998
  authType: z89.literal(NpmRegistryAuthType.Enum.None)
1992
1999
  });
1993
2000
  var NpmRegistrCustomAuthConfig = z89.object({
2001
+ registryType: NpmRegistryTypeWithoutAzure,
1994
2002
  authType: z89.literal(NpmRegistryAuthType.Enum.Custom),
1995
2003
  authHeaderName: z89.string(),
1996
2004
  authHeaderValue: z89.string()
@@ -2002,7 +2010,6 @@ var NpmRegistryAuthConfig = z89.discriminatedUnion("authType", [
2002
2010
  NpmRegistrCustomAuthConfig
2003
2011
  ]);
2004
2012
  var NpmRegistryConfigBase = z89.object({
2005
- registryType: NpmRegistryType,
2006
2013
  enabledScopes: z89.array(z89.string()),
2007
2014
  customRegistryUrl: z89.string().optional(),
2008
2015
  bypassProxy: z89.boolean().default(false),
@@ -2062,6 +2069,14 @@ var WorkspaceMembership = z96.object({
2062
2069
  workspaceId: z96.string(),
2063
2070
  workspaceRole: z96.nativeEnum(WorkspaceRole)
2064
2071
  });
2072
+ var UpdateMembershipRolesInput = z96.object({
2073
+ members: z96.array(
2074
+ z96.object({
2075
+ userId: z96.string(),
2076
+ role: z96.nativeEnum(WorkspaceRole)
2077
+ })
2078
+ )
2079
+ });
2065
2080
  var WorkspaceIpWhitelistEntry = z97.object({
2066
2081
  isEnabled: z97.boolean(),
2067
2082
  name: z97.string(),
@@ -4420,7 +4435,8 @@ function serializeAsCustomBlock(block, definition) {
4420
4435
  id: block.id,
4421
4436
  definitionId: block.data.packageId,
4422
4437
  variantId: block.data.variantId,
4423
- items: JSON.stringify(items)
4438
+ items: JSON.stringify(items),
4439
+ appearance: JSON.stringify(block.data.appearance)
4424
4440
  }
4425
4441
  };
4426
4442
  }
@@ -5805,7 +5821,7 @@ function prosemirrorDocToPage(prosemirrorDoc, definitions) {
5805
5821
  const definitionsById = mapByUnique(definitions, (d) => d.id);
5806
5822
  return {
5807
5823
  blocks: (prosemirrorDoc.content ?? []).map((prosemirrorNode) => {
5808
- const definitionId = prosemirrorNode.attrs?.definitionId;
5824
+ const definitionId = parseProsemirrorBlockAttribute(prosemirrorNode, "definitionId");
5809
5825
  if (!definitionId)
5810
5826
  throw new Error(`Node is missing defintion id`);
5811
5827
  if (typeof definitionId !== "string")
@@ -5841,7 +5857,10 @@ function prosemirrorNodeToBlock(prosemirrorNode, definition) {
5841
5857
  }
5842
5858
  function parseAsRichText(prosemirrorNode, definition, property) {
5843
5859
  const id = parseProsemirrorBlockAttribute(prosemirrorNode, "id");
5844
- const variantId = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
5860
+ if (typeof id !== "string")
5861
+ return null;
5862
+ const variantIdRaw = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
5863
+ const variantId = typeof variantIdRaw === "string" ? variantIdRaw : void 0;
5845
5864
  const calloutType = parseCalloutType(parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "type"));
5846
5865
  return {
5847
5866
  // TODO Artem: indent
@@ -5882,7 +5901,10 @@ function parseCalloutType(prosemirrorCalloutType) {
5882
5901
  }
5883
5902
  function parseAsMultiRichText(prosemirrorNode, definition, property) {
5884
5903
  const id = parseProsemirrorBlockAttribute(prosemirrorNode, "id");
5885
- const variantId = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
5904
+ if (typeof id !== "string")
5905
+ return null;
5906
+ const variantIdRaw = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
5907
+ const variantId = typeof variantIdRaw === "string" ? variantIdRaw : void 0;
5886
5908
  return {
5887
5909
  // TODO Artem: indent
5888
5910
  id,
@@ -5938,8 +5960,10 @@ function parseRichTextAttribute(mark) {
5938
5960
  case "code":
5939
5961
  return { type: "Code" };
5940
5962
  case "link":
5941
- const itemId = mark.attrs?.itemId;
5942
- const href = mark.attrs?.href;
5963
+ const itemIdRaw = parseProsemirrorBlockAttribute(mark, "itemId");
5964
+ const itemId = typeof itemIdRaw === "string" ? itemIdRaw : void 0;
5965
+ const hrefRaw = parseProsemirrorBlockAttribute(mark, "href");
5966
+ const href = typeof hrefRaw === "string" ? hrefRaw : void 0;
5943
5967
  return {
5944
5968
  type: "Link",
5945
5969
  openInNewWindow: mark.attrs?.target !== "_self",
@@ -5951,7 +5975,10 @@ function parseRichTextAttribute(mark) {
5951
5975
  }
5952
5976
  function parseAsTable(prosemirrorNode, definition, property) {
5953
5977
  const id = parseProsemirrorBlockAttribute(prosemirrorNode, "id");
5954
- const variantId = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
5978
+ if (typeof id !== "string")
5979
+ return null;
5980
+ const variantIdRaw = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
5981
+ const variantId = typeof variantIdRaw === "string" ? variantIdRaw : void 0;
5955
5982
  const hasBorder = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "hasBorder") !== false;
5956
5983
  const tableChild = prosemirrorNode.content?.find((c) => c.type === "table");
5957
5984
  if (!tableChild) {
@@ -5973,7 +6000,7 @@ function parseAsTable(prosemirrorNode, definition, property) {
5973
6000
  };
5974
6001
  tableValue.value = rows.map((row) => {
5975
6002
  return {
5976
- cells: (row.content ?? []).map(parseAsTableCell)
6003
+ cells: (row.content ?? []).map(parseAsTableCell).filter(nonNullFilter2)
5977
6004
  };
5978
6005
  });
5979
6006
  return {
@@ -5995,6 +6022,8 @@ function parseAsTable(prosemirrorNode, definition, property) {
5995
6022
  }
5996
6023
  function parseAsTableCell(prosemirrorNode) {
5997
6024
  const id = parseProsemirrorBlockAttribute(prosemirrorNode, "id");
6025
+ if (typeof id !== "string")
6026
+ return null;
5998
6027
  const textAlign = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "textAlign");
5999
6028
  let columnWidth;
6000
6029
  const columnWidthArray = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "colwidth");
@@ -6091,7 +6120,10 @@ function emptyTableCellContent() {
6091
6120
  }
6092
6121
  function parseAsEmbed(prosemirrorNode, definition, property) {
6093
6122
  const id = parseProsemirrorBlockAttribute(prosemirrorNode, "id");
6094
- const variantId = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
6123
+ if (typeof id !== "string")
6124
+ return null;
6125
+ const variantIdRaw = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
6126
+ const variantId = typeof variantIdRaw === "string" ? variantIdRaw : void 0;
6095
6127
  const url = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "url");
6096
6128
  const caption = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "caption");
6097
6129
  const height = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "height");
@@ -6118,7 +6150,10 @@ function parseAsEmbed(prosemirrorNode, definition, property) {
6118
6150
  }
6119
6151
  function parseAsDivider(prosemirrorNode, definition) {
6120
6152
  const id = parseProsemirrorBlockAttribute(prosemirrorNode, "id");
6121
- const variantId = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
6153
+ if (typeof id !== "string")
6154
+ return null;
6155
+ const variantIdRaw = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
6156
+ const variantId = typeof variantIdRaw === "string" ? variantIdRaw : void 0;
6122
6157
  return {
6123
6158
  id,
6124
6159
  data: {
@@ -6131,24 +6166,51 @@ function parseAsDivider(prosemirrorNode, definition) {
6131
6166
  }
6132
6167
  function parseAsCustomBlock(prosemirrorNode, definition) {
6133
6168
  const id = parseProsemirrorBlockAttribute(prosemirrorNode, "id");
6134
- const variantId = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
6135
- const itemsString = parseProsemirrorBlockAttribute(prosemirrorNode, "items");
6136
- const itemsJson = JSON.parse(itemsString);
6137
- if (!Array.isArray(itemsJson)) {
6138
- console.error("Block `items` property must be a json array");
6169
+ if (typeof id !== "string")
6170
+ return null;
6171
+ const variantIdRaw = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "variantId");
6172
+ const variantId = typeof variantIdRaw === "string" ? variantIdRaw : void 0;
6173
+ const appearance = parseAppearance(prosemirrorNode);
6174
+ const parsedItems = parseBlockItems(prosemirrorNode, definition);
6175
+ if (!parsedItems)
6139
6176
  return null;
6140
- }
6141
- const parsedItems = itemsJson.map((i) => parseItem(i, definition)).filter(nonNullFilter2);
6142
6177
  return {
6143
6178
  id,
6144
6179
  data: {
6145
6180
  packageId: definition.id,
6146
6181
  indentLevel: 0,
6147
6182
  ...variantId && { variantId },
6183
+ appearance,
6148
6184
  items: parsedItems
6149
6185
  }
6150
6186
  };
6151
6187
  }
6188
+ function parseBlockItems(prosemirrorNode, definition) {
6189
+ const itemsString = parseProsemirrorBlockAttribute(prosemirrorNode, "items");
6190
+ if (typeof itemsString !== "string")
6191
+ return null;
6192
+ const itemsJson = JSON.parse(itemsString);
6193
+ if (!Array.isArray(itemsJson)) {
6194
+ console.error("Block `items` property must be a json array");
6195
+ return null;
6196
+ }
6197
+ return itemsJson.map((i) => parseItem(i, definition)).filter(nonNullFilter2);
6198
+ }
6199
+ function parseAppearance(prosemirrorNode) {
6200
+ const appearance = {};
6201
+ const columns = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "columns");
6202
+ if (typeof columns === "number") {
6203
+ appearance.numberOfColumns = columns;
6204
+ }
6205
+ const backgroundColor = parseProsemirrorOptionalBlockAttribute(prosemirrorNode, "backgroundColor");
6206
+ if (typeof backgroundColor === "string") {
6207
+ const parsedColor = ColorValue.safeParse(JSON.parse(backgroundColor));
6208
+ if (parsedColor.success) {
6209
+ appearance.itemBackgroundColor = parsedColor.data;
6210
+ }
6211
+ }
6212
+ return appearance;
6213
+ }
6152
6214
  function parseItem(rawItem, definition) {
6153
6215
  const parsedItem = PageBlockItemV2.safeParse(rawItem);
6154
6216
  if (!parsedItem.success) {