@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.js CHANGED
@@ -377,7 +377,8 @@ var DataSourceFigmaRemote = _zod.z.object({
377
377
  scope: DataSourceFigmaScope,
378
378
  state: DataSourceFigmaState,
379
379
  lastImportMetadata: DataSourceFigmaImportMetadata.optional(),
380
- downloadChunkSize: _zod.z.number().optional()
380
+ downloadChunkSize: _zod.z.number().optional(),
381
+ figmaRenderChunkSize: _zod.z.number().optional()
381
382
  });
382
383
  var DataSourceTokenStudioRemote = _zod.z.object({
383
384
  type: _zod.z.literal(DataSourceRemoteType.Enum.TokenStudio)
@@ -875,7 +876,8 @@ var PageBlockImageType = _zod.z.enum(["Upload", "Asset", "FigmaFrame"]);
875
876
  var PageBlockImageAlignment = _zod.z.enum(["Left", "Center", "Stretch"]);
876
877
  var PageBlockTableCellAlignment = _zod.z.enum(["Left", "Center", "Right"]);
877
878
  var PageBlockAppearanceV2 = _zod.z.object({
878
- itemBackgroundColor: ColorValue
879
+ itemBackgroundColor: ColorValue.optional(),
880
+ numberOfColumns: _zod.z.number().optional()
879
881
  });
880
882
  var PageBlockItemUntypedValue = _zod.z.object({
881
883
  value: _zod.z.any()
@@ -1977,20 +1979,26 @@ var DocumentationPage = _zod.z.object({
1977
1979
  updatedAt: _zod.z.date()
1978
1980
  });
1979
1981
  var NpmRegistryAuthType = _zod.z.enum(["Basic", "Bearer", "None", "Custom"]);
1980
- var NpmRegistryType = _zod.z.enum(["NPMJS", "GitHub", "AzureDevOps", "Artifactory", "Custom"]);
1982
+ var registryTypesWithoutAzure = ["NPMJS", "GitHub", "Artifactory", "Custom"];
1983
+ var NpmRegistryType = _zod.z.enum([...registryTypesWithoutAzure, "AzureDevOps"]);
1984
+ var NpmRegistryTypeWithoutAzure = _zod.z.enum(registryTypesWithoutAzure);
1981
1985
  var NpmRegistryBasicAuthConfig = _zod.z.object({
1986
+ registryType: NpmRegistryType,
1982
1987
  authType: _zod.z.literal(NpmRegistryAuthType.Enum.Basic),
1983
1988
  username: _zod.z.string(),
1984
1989
  password: _zod.z.string()
1985
1990
  });
1986
1991
  var NpmRegistryBearerAuthConfig = _zod.z.object({
1992
+ registryType: NpmRegistryTypeWithoutAzure,
1987
1993
  authType: _zod.z.literal(NpmRegistryAuthType.Enum.Bearer),
1988
1994
  accessToken: _zod.z.string()
1989
1995
  });
1990
1996
  var NpmRegistryNoAuthConfig = _zod.z.object({
1997
+ registryType: NpmRegistryTypeWithoutAzure,
1991
1998
  authType: _zod.z.literal(NpmRegistryAuthType.Enum.None)
1992
1999
  });
1993
2000
  var NpmRegistrCustomAuthConfig = _zod.z.object({
2001
+ registryType: NpmRegistryTypeWithoutAzure,
1994
2002
  authType: _zod.z.literal(NpmRegistryAuthType.Enum.Custom),
1995
2003
  authHeaderName: _zod.z.string(),
1996
2004
  authHeaderValue: _zod.z.string()
@@ -2002,7 +2010,6 @@ var NpmRegistryAuthConfig = _zod.z.discriminatedUnion("authType", [
2002
2010
  NpmRegistrCustomAuthConfig
2003
2011
  ]);
2004
2012
  var NpmRegistryConfigBase = _zod.z.object({
2005
- registryType: NpmRegistryType,
2006
2013
  enabledScopes: _zod.z.array(_zod.z.string()),
2007
2014
  customRegistryUrl: _zod.z.string().optional(),
2008
2015
  bypassProxy: _zod.z.boolean().default(false),
@@ -2062,6 +2069,14 @@ var WorkspaceMembership = _zod.z.object({
2062
2069
  workspaceId: _zod.z.string(),
2063
2070
  workspaceRole: _zod.z.nativeEnum(WorkspaceRole)
2064
2071
  });
2072
+ var UpdateMembershipRolesInput = _zod.z.object({
2073
+ members: _zod.z.array(
2074
+ _zod.z.object({
2075
+ userId: _zod.z.string(),
2076
+ role: _zod.z.nativeEnum(WorkspaceRole)
2077
+ })
2078
+ )
2079
+ });
2065
2080
  var WorkspaceIpWhitelistEntry = _zod.z.object({
2066
2081
  isEnabled: _zod.z.boolean(),
2067
2082
  name: _zod.z.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: (_nullishCoalesce(prosemirrorDoc.content, () => ( []))).map((prosemirrorNode) => {
5808
- const definitionId = _optionalChain([prosemirrorNode, 'access', _10 => _10.attrs, 'optionalAccess', _11 => _11.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,
@@ -5899,7 +5921,7 @@ function parseAsMultiRichText(prosemirrorNode, definition, property) {
5899
5921
  value: (_nullishCoalesce(prosemirrorNode.content, () => ( []))).map((listItem) => {
5900
5922
  if (listItem.type !== "listitem")
5901
5923
  return null;
5902
- if (!_optionalChain([listItem, 'access', _12 => _12.content, 'optionalAccess', _13 => _13.length]))
5924
+ if (!_optionalChain([listItem, 'access', _10 => _10.content, 'optionalAccess', _11 => _11.length]))
5903
5925
  return parseRichText([]);
5904
5926
  const paragraph = listItem.content[0];
5905
5927
  if (paragraph.type !== "paragraph")
@@ -5938,11 +5960,13 @@ function parseRichTextAttribute(mark) {
5938
5960
  case "code":
5939
5961
  return { type: "Code" };
5940
5962
  case "link":
5941
- const itemId = _optionalChain([mark, 'access', _14 => _14.attrs, 'optionalAccess', _15 => _15.itemId]);
5942
- const href = _optionalChain([mark, 'access', _16 => _16.attrs, 'optionalAccess', _17 => _17.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
- openInNewWindow: _optionalChain([mark, 'access', _18 => _18.attrs, 'optionalAccess', _19 => _19.target]) !== "_self",
5969
+ openInNewWindow: _optionalChain([mark, 'access', _12 => _12.attrs, 'optionalAccess', _13 => _13.target]) !== "_self",
5946
5970
  documentationItemId: itemId,
5947
5971
  link: href
5948
5972
  };
@@ -5951,19 +5975,22 @@ 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
- const tableChild = _optionalChain([prosemirrorNode, 'access', _20 => _20.content, 'optionalAccess', _21 => _21.find, 'call', _22 => _22((c) => c.type === "table")]);
5983
+ const tableChild = _optionalChain([prosemirrorNode, 'access', _14 => _14.content, 'optionalAccess', _15 => _15.find, 'call', _16 => _16((c) => c.type === "table")]);
5957
5984
  if (!tableChild) {
5958
5985
  return emptyTable(id, variantId, 0);
5959
5986
  }
5960
- const rows = _nullishCoalesce(_optionalChain([tableChild, 'access', _23 => _23.content, 'optionalAccess', _24 => _24.filter, 'call', _25 => _25((c) => c.type === "tableRow" && !!_optionalChain([c, 'access', _26 => _26.content, 'optionalAccess', _27 => _27.length]))]), () => ( []));
5987
+ const rows = _nullishCoalesce(_optionalChain([tableChild, 'access', _17 => _17.content, 'optionalAccess', _18 => _18.filter, 'call', _19 => _19((c) => c.type === "tableRow" && !!_optionalChain([c, 'access', _20 => _20.content, 'optionalAccess', _21 => _21.length]))]), () => ( []));
5961
5988
  if (!rows.length) {
5962
5989
  return emptyTable(id, variantId, 0);
5963
5990
  }
5964
- const rowHeaderCells = _nullishCoalesce(_optionalChain([rows, 'access', _28 => _28[0], 'access', _29 => _29.content, 'optionalAccess', _30 => _30.filter, 'call', _31 => _31((c) => c.type === "tableHeader"), 'access', _32 => _32.length]), () => ( 0));
5965
- const columnHeaderCells = rows.filter((r) => _optionalChain([r, 'access', _33 => _33.content, 'optionalAccess', _34 => _34[0], 'optionalAccess', _35 => _35.type]) === "tableHeader").length;
5966
- const hasHeaderRow = _optionalChain([rows, 'access', _36 => _36[0], 'access', _37 => _37.content, 'optionalAccess', _38 => _38.length]) === rowHeaderCells;
5991
+ const rowHeaderCells = _nullishCoalesce(_optionalChain([rows, 'access', _22 => _22[0], 'access', _23 => _23.content, 'optionalAccess', _24 => _24.filter, 'call', _25 => _25((c) => c.type === "tableHeader"), 'access', _26 => _26.length]), () => ( 0));
5992
+ const columnHeaderCells = rows.filter((r) => _optionalChain([r, 'access', _27 => _27.content, 'optionalAccess', _28 => _28[0], 'optionalAccess', _29 => _29.type]) === "tableHeader").length;
5993
+ const hasHeaderRow = _optionalChain([rows, 'access', _30 => _30[0], 'access', _31 => _31.content, 'optionalAccess', _32 => _32.length]) === rowHeaderCells;
5967
5994
  const hasHeaderColumn = rows.length === columnHeaderCells;
5968
5995
  const tableValue = {
5969
5996
  showBorder: hasBorder,
@@ -5973,7 +6000,7 @@ function parseAsTable(prosemirrorNode, definition, property) {
5973
6000
  };
5974
6001
  tableValue.value = rows.map((row) => {
5975
6002
  return {
5976
- cells: (_nullishCoalesce(row.content, () => ( []))).map(parseAsTableCell)
6003
+ cells: (_nullishCoalesce(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) {
@@ -6234,7 +6296,7 @@ function parseProsemirrorBlockAttribute(prosemirrorNode, attributeName) {
6234
6296
  return attributeValue;
6235
6297
  }
6236
6298
  function parseProsemirrorOptionalBlockAttribute(prosemirrorNode, attributeName) {
6237
- return _nullishCoalesce(_optionalChain([prosemirrorNode, 'access', _39 => _39.attrs, 'optionalAccess', _40 => _40[attributeName]]), () => ( void 0));
6299
+ return _nullishCoalesce(_optionalChain([prosemirrorNode, 'access', _33 => _33.attrs, 'optionalAccess', _34 => _34[attributeName]]), () => ( void 0));
6238
6300
  }
6239
6301
  function nonNullFilter2(item) {
6240
6302
  return item !== null;