@uniformdev/canvas 19.79.1-alpha.11 → 19.79.1-alpha.18

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.esm.js CHANGED
@@ -476,6 +476,7 @@ var CanvasClient = class extends ApiClient {
476
476
  }
477
477
  super(options);
478
478
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
479
+ this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
479
480
  }
480
481
  /** Fetches lists of Canvas compositions, optionally by type */
481
482
  async getCompositionList(params = {}) {
@@ -491,7 +492,7 @@ var CanvasClient = class extends ApiClient {
491
492
  ...params.diagnostics ? { diagnostics: "true" } : {}
492
493
  };
493
494
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
494
- return this.apiClient(edgeUrl);
495
+ return this.apiClient(edgeUrl, this.edgeApiRequestInit);
495
496
  }
496
497
  getCompositionByNodePath(options) {
497
498
  return this.getOneComposition(options);
@@ -531,7 +532,7 @@ var CanvasClient = class extends ApiClient {
531
532
  ...diagnostics ? { diagnostics: "true" } : {}
532
533
  };
533
534
  const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
534
- return this.apiClient(edgeUrl);
535
+ return this.apiClient(edgeUrl, this.edgeApiRequestInit);
535
536
  }
536
537
  /** Updates or creates a Canvas component definition */
537
538
  async updateComposition(body) {
@@ -626,73 +627,10 @@ var UncachedCategoryClient = class extends CategoryClient {
626
627
  }
627
628
  };
628
629
 
629
- // src/CompositionRelationshipClient.ts
630
- import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
631
- var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
632
- var unstable_CompositionRelationshipClient = class extends ApiClient3 {
633
- constructor(options) {
634
- super(options);
635
- this.getDefinitionsRelationships = async ({
636
- definitionIds,
637
- withCompositions
638
- }) => {
639
- const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
640
- type: "definition",
641
- projectId: this._options.projectId,
642
- definitionIds: definitionIds.join(","),
643
- withCompositions
644
- });
645
- return this.apiClient(url);
646
- };
647
- this.clearAllRelationships = async () => {
648
- const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
649
- return this.apiClient(url, {
650
- method: "POST",
651
- body: JSON.stringify({
652
- type: "clear",
653
- projectId: this._options.projectId
654
- })
655
- });
656
- };
657
- this.indexCompositionRelationships = async ({
658
- state,
659
- compositionId
660
- }) => {
661
- const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
662
- return this.apiClient(url, {
663
- method: "POST",
664
- body: JSON.stringify({
665
- type: "index",
666
- projectId: this._options.projectId,
667
- state,
668
- compositionId
669
- })
670
- });
671
- };
672
- this.getVersion = async () => {
673
- const url = this.createUrl("/api/v1/usage-tracking", {
674
- projectId: this._options.projectId
675
- });
676
- return this.apiClient(url).then((response) => response.version);
677
- };
678
- this.setVersion = async (version) => {
679
- const url = this.createUrl("/api/v1/usage-tracking");
680
- return this.apiClient(url, {
681
- method: "POST",
682
- body: JSON.stringify({
683
- projectId: this._options.projectId,
684
- version
685
- })
686
- });
687
- };
688
- this._options = options;
689
- }
690
- };
691
-
692
630
  // src/ContentClient.ts
693
- import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
631
+ import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
694
632
  var _contentTypesUrl, _entriesUrl;
695
- var _ContentClient = class _ContentClient extends ApiClient4 {
633
+ var _ContentClient = class _ContentClient extends ApiClient3 {
696
634
  constructor(options) {
697
635
  var _a;
698
636
  super(options);
@@ -705,9 +643,26 @@ var _ContentClient = class _ContentClient extends ApiClient4 {
705
643
  }
706
644
  getEntries(options) {
707
645
  const { projectId } = this.options;
708
- const { skipDataResolution, ...params } = options;
709
- const fetchUri = skipDataResolution ? this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, projectId }) : this.createUrl(__privateGet(_ContentClient, _entriesUrl), this.getEdgeOptions(params), this.edgeApiHost);
710
- return this.apiClient(fetchUri);
646
+ const { skipDataResolution, filters, ...params } = options;
647
+ const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
648
+ const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
649
+ let rhs = typeof value === "object" ? Object.values(value)[0] : value;
650
+ rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
651
+ return { ...acc, [lhs]: rhs };
652
+ }, {});
653
+ if (skipDataResolution) {
654
+ const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
655
+ return this.apiClient(url);
656
+ }
657
+ const edgeUrl = this.createUrl(
658
+ __privateGet(_ContentClient, _entriesUrl),
659
+ { ...this.getEdgeOptions(params), ...rewrittenFilters },
660
+ this.edgeApiHost
661
+ );
662
+ return this.apiClient(
663
+ edgeUrl,
664
+ this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
665
+ );
711
666
  }
712
667
  /** Fetches historical versions of an entry */
713
668
  async getEntryHistory(options) {
@@ -772,10 +727,10 @@ var UncachedContentClient = class extends ContentClient {
772
727
  };
773
728
 
774
729
  // src/DataSourceClient.ts
775
- import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
730
+ import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
776
731
  var dataSourceUrl = "/api/v1/data-source";
777
732
  var dataSourcesUrl = "/api/v1/data-sources";
778
- var DataSourceClient = class extends ApiClient5 {
733
+ var DataSourceClient = class extends ApiClient4 {
779
734
  constructor(options) {
780
735
  super(options);
781
736
  }
@@ -812,9 +767,9 @@ var DataSourceClient = class extends ApiClient5 {
812
767
  };
813
768
 
814
769
  // src/DataTypeClient.ts
815
- import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
770
+ import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
816
771
  var _url;
817
- var _DataTypeClient = class _DataTypeClient extends ApiClient6 {
772
+ var _DataTypeClient = class _DataTypeClient extends ApiClient5 {
818
773
  constructor(options) {
819
774
  super(options);
820
775
  }
@@ -985,6 +940,7 @@ var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
985
940
  var SECRET_QUERY_STRING_PARAM = "secret";
986
941
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
987
942
  var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
943
+ var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
988
944
  var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
989
945
  var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
990
946
  var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
@@ -1000,25 +956,9 @@ var EDGE_MIN_CACHE_TTL = 10;
1000
956
  var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1001
957
  var EDGE_DEFAULT_CACHE_TTL = 30;
1002
958
  var EDGE_CACHE_DISABLED = -1;
1003
-
1004
- // src/utils/entryConverter.ts
1005
- function convertEntryToPutEntry(entry) {
1006
- return {
1007
- entry: {
1008
- type: entry.entry.type,
1009
- _dataResources: entry.entry._dataResources,
1010
- _id: entry.entry._id,
1011
- _name: entry.entry._name,
1012
- _slug: entry.entry._slug,
1013
- fields: entry.entry.fields
1014
- },
1015
- state: entry.state,
1016
- projectId: entry.projectId
1017
- };
1018
- }
1019
- function getPropertiesValue(entity) {
1020
- return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
1021
- }
959
+ var ASSET_PARAMETER_TYPE = "asset";
960
+ var ASSETS_SOURCE_UNIFORM = "uniform-assets";
961
+ var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
1022
962
 
1023
963
  // src/utils/guards.ts
1024
964
  function isRootEntryReference(root) {
@@ -1027,6 +967,49 @@ function isRootEntryReference(root) {
1027
967
  function isEntryData(entryData) {
1028
968
  return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
1029
969
  }
970
+ function isAssetParamValue(value) {
971
+ return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
972
+ }
973
+ function isAssetParamValueItem(item) {
974
+ return Boolean(
975
+ item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
976
+ );
977
+ }
978
+
979
+ // src/utils/properties.ts
980
+ function getPropertiesValue(entity) {
981
+ return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
982
+ }
983
+ function getPropertyValue(parameter) {
984
+ return parameter ? parameter.value : parameter;
985
+ }
986
+ function flattenValues(data, options = {}) {
987
+ if (!data) {
988
+ return data;
989
+ } else if (Array.isArray(data) && options.toSingle) {
990
+ return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
991
+ } else if (Array.isArray(data)) {
992
+ return data.map((node) => flattenSingleNodeValues(node, options));
993
+ } else {
994
+ return flattenSingleNodeValues(data, options);
995
+ }
996
+ }
997
+ function flattenSingleNodeValues(data, options = {}) {
998
+ const { levels = 1 } = options;
999
+ const properties = getPropertiesValue(data);
1000
+ return properties ? Object.fromEntries(
1001
+ Object.entries(properties).map(([id, parameter]) => {
1002
+ const value = getPropertyValue(parameter);
1003
+ if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
1004
+ (isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
1005
+ const nestedOptions = { ...options, levels: levels - 1 };
1006
+ return [id, value.map((item) => flattenValues(item, nestedOptions))];
1007
+ } else {
1008
+ return [id, value];
1009
+ }
1010
+ })
1011
+ ) : properties;
1012
+ }
1030
1013
 
1031
1014
  // src/enhancement/walkNodeTree.ts
1032
1015
  function walkNodeTree(node, visitor, options) {
@@ -1250,7 +1233,7 @@ function walkNodeTree(node, visitor, options) {
1250
1233
  const propertyEntries = Object.entries(properties);
1251
1234
  for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
1252
1235
  const [propKey, propObject] = propertyEntries[propIndex];
1253
- if (propObject.type !== CANVAS_BLOCK_PARAM_TYPE)
1236
+ if (!isNestedNodeType(propObject.type))
1254
1237
  continue;
1255
1238
  const blocks = (_b = propObject.value) != null ? _b : [];
1256
1239
  for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
@@ -1276,6 +1259,9 @@ function walkNodeTree(node, visitor, options) {
1276
1259
  }
1277
1260
  } while (componentQueue.length > 0);
1278
1261
  }
1262
+ function isNestedNodeType(type) {
1263
+ return type === CANVAS_BLOCK_PARAM_TYPE;
1264
+ }
1279
1265
  function getBlockValue(component, parameterName) {
1280
1266
  var _a;
1281
1267
  const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
@@ -1567,6 +1553,31 @@ function getNounForLocation(parentLocation) {
1567
1553
  }
1568
1554
  return noun;
1569
1555
  }
1556
+ function getNounForNode(node) {
1557
+ let noun = "parameters";
1558
+ if (isEntryData(node)) {
1559
+ noun = "fields";
1560
+ }
1561
+ return noun;
1562
+ }
1563
+
1564
+ // src/enhancement/findInNodeTree.ts
1565
+ function findParameterInNodeTree(data, predicate) {
1566
+ const results = [];
1567
+ walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
1568
+ const parameters = getPropertiesValue(node);
1569
+ if (parameters) {
1570
+ Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
1571
+ results.push({
1572
+ key,
1573
+ pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
1574
+ parameter: field
1575
+ });
1576
+ });
1577
+ }
1578
+ });
1579
+ return results;
1580
+ }
1570
1581
 
1571
1582
  // src/enhancement/localize.ts
1572
1583
  function extractLocales({ component }) {
@@ -1583,23 +1594,31 @@ function extractLocales({ component }) {
1583
1594
  });
1584
1595
  return variations;
1585
1596
  }
1586
- function localize({
1587
- composition,
1588
- locale
1589
- }) {
1590
- walkNodeTree(composition, ({ type, node, actions }) => {
1597
+ function localize(options) {
1598
+ const nodes = "nodes" in options ? options.nodes : options.composition;
1599
+ const locale = options.locale;
1600
+ walkNodeTree(nodes, ({ type, node, actions }) => {
1591
1601
  if (type !== "component") {
1592
- actions.stopProcessingDescendants();
1602
+ if (typeof locale === "string") {
1603
+ localizeProperties(node.fields, locale);
1604
+ }
1593
1605
  return;
1594
1606
  }
1607
+ const shouldRunPropertyLocalization = typeof locale === "string";
1595
1608
  if (node.type === CANVAS_LOCALIZATION_TYPE) {
1596
1609
  const locales = extractLocales({ component: node });
1597
- const resolvedLocale = typeof locale === "string" ? locale : locale({ component: node, locales });
1610
+ const resolvedLocale = typeof locale === "string" ? locale : locale == null ? void 0 : locale({ component: node, locales });
1598
1611
  let replaceComponent;
1599
1612
  if (resolvedLocale) {
1600
1613
  replaceComponent = locales[resolvedLocale];
1601
1614
  }
1602
1615
  if (replaceComponent == null ? void 0 : replaceComponent.length) {
1616
+ replaceComponent.forEach((component) => {
1617
+ removeLocaleProperty(component);
1618
+ if (shouldRunPropertyLocalization) {
1619
+ localizeProperties(getPropertiesValue(component), locale);
1620
+ }
1621
+ });
1603
1622
  const [first, ...rest] = replaceComponent;
1604
1623
  actions.replace(first);
1605
1624
  if (rest.length) {
@@ -1608,6 +1627,42 @@ function localize({
1608
1627
  } else {
1609
1628
  actions.remove();
1610
1629
  }
1630
+ } else if (shouldRunPropertyLocalization) {
1631
+ localizeProperties(getPropertiesValue(node), locale);
1632
+ }
1633
+ });
1634
+ }
1635
+ function removeLocaleProperty(component) {
1636
+ const properties = getPropertiesValue(component);
1637
+ const localeTagProperty = properties == null ? void 0 : properties[CANVAS_LOCALE_TAG_PARAM];
1638
+ if (localeTagProperty) {
1639
+ delete properties[CANVAS_LOCALE_TAG_PARAM];
1640
+ }
1641
+ if (properties && Object.keys(properties).length === 0) {
1642
+ if ("fields" in component) {
1643
+ delete component.fields;
1644
+ }
1645
+ if ("parameters" in component) {
1646
+ delete component.parameters;
1647
+ }
1648
+ }
1649
+ }
1650
+ function localizeProperties(properties, locale) {
1651
+ if (!properties) {
1652
+ return void 0;
1653
+ }
1654
+ Object.entries(properties).forEach(([key, property]) => {
1655
+ var _a;
1656
+ if (!locale) {
1657
+ delete property.locales;
1658
+ }
1659
+ const currentLocaleValue = locale ? (_a = property.locales) == null ? void 0 : _a[locale] : void 0;
1660
+ if (currentLocaleValue !== void 0) {
1661
+ property.value = currentLocaleValue;
1662
+ }
1663
+ delete property.locales;
1664
+ if (property.value === void 0) {
1665
+ delete properties[key];
1611
1666
  }
1612
1667
  });
1613
1668
  }
@@ -1757,6 +1812,39 @@ function walkComponentTree(component, visitor, initialContext) {
1757
1812
  } while (componentQueue.length > 0);
1758
1813
  }
1759
1814
 
1815
+ // src/LocaleClient.ts
1816
+ import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
1817
+ var localesUrl = "/api/v1/locales";
1818
+ var LocaleClient = class extends ApiClient6 {
1819
+ constructor(options) {
1820
+ super(options);
1821
+ }
1822
+ /** Fetches all locales for a project */
1823
+ async get(options) {
1824
+ const { projectId } = this.options;
1825
+ const fetchUri = this.createUrl(localesUrl, { ...options, projectId });
1826
+ return await this.apiClient(fetchUri);
1827
+ }
1828
+ /** Updates or creates (based on id) a locale */
1829
+ async upsert(body) {
1830
+ const fetchUri = this.createUrl(localesUrl);
1831
+ await this.apiClient(fetchUri, {
1832
+ method: "PUT",
1833
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1834
+ expectNoContent: true
1835
+ });
1836
+ }
1837
+ /** Deletes a locale */
1838
+ async remove(body) {
1839
+ const fetchUri = this.createUrl(localesUrl);
1840
+ await this.apiClient(fetchUri, {
1841
+ method: "DELETE",
1842
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1843
+ expectNoContent: true
1844
+ });
1845
+ }
1846
+ };
1847
+
1760
1848
  // src/utils/hash.ts
1761
1849
  var generateHash = ({
1762
1850
  composition,
@@ -1835,7 +1923,7 @@ var createCanvasChannel = ({
1835
1923
  const handlers = {};
1836
1924
  const broadcastToItems = [...broadcastTo];
1837
1925
  const postMessage = (message) => {
1838
- broadcastToItems.forEach((item) => item.postMessage(JSON.stringify(message), "*"));
1926
+ broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
1839
1927
  };
1840
1928
  const selectComponent = (id) => {
1841
1929
  const message = {
@@ -2146,10 +2234,133 @@ var PromptClient = class extends ApiClient7 {
2146
2234
  }
2147
2235
  };
2148
2236
 
2149
- // src/RouteClient.ts
2237
+ // src/RelationshipClient.ts
2150
2238
  import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2239
+ var RELATIONSHIPS_URL = "/api/v1/relationships";
2240
+ var RelationshipClient = class extends ApiClient8 {
2241
+ constructor(options) {
2242
+ super(options);
2243
+ this.get = async (options) => {
2244
+ const { projectId } = this.options;
2245
+ const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
2246
+ return this.apiClient(url);
2247
+ };
2248
+ this.clearProjectRelationships = async () => {
2249
+ const { projectId } = this.options;
2250
+ const url = this.createUrl(RELATIONSHIPS_URL);
2251
+ return this.apiClient(url, {
2252
+ method: "POST",
2253
+ body: JSON.stringify({
2254
+ action: "clear",
2255
+ projectId
2256
+ })
2257
+ });
2258
+ };
2259
+ this.indexRelationships = async ({ state, id, type }) => {
2260
+ const { projectId } = this.options;
2261
+ const url = this.createUrl(RELATIONSHIPS_URL);
2262
+ return this.apiClient(url, {
2263
+ method: "POST",
2264
+ body: JSON.stringify({
2265
+ action: "index",
2266
+ type,
2267
+ projectId,
2268
+ state,
2269
+ id
2270
+ })
2271
+ });
2272
+ };
2273
+ this.getVersion = async () => {
2274
+ const { projectId } = this.options;
2275
+ const url = this.createUrl("/api/v1/usage-tracking", {
2276
+ projectId
2277
+ });
2278
+ return this.apiClient(url).then((response) => response.version);
2279
+ };
2280
+ this.setVersion = async (version) => {
2281
+ const { projectId } = this.options;
2282
+ const url = this.createUrl("/api/v1/usage-tracking");
2283
+ return this.apiClient(url, {
2284
+ method: "POST",
2285
+ body: JSON.stringify({
2286
+ projectId,
2287
+ version
2288
+ })
2289
+ });
2290
+ };
2291
+ }
2292
+ };
2293
+
2294
+ // src/ReleaseClient.ts
2295
+ import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
2296
+ var releasesUrl = "/api/v1/releases";
2297
+ var ReleaseClient = class extends ApiClient9 {
2298
+ constructor(options) {
2299
+ super(options);
2300
+ }
2301
+ /** Fetches all releases for a project */
2302
+ async get(options) {
2303
+ const { projectId } = this.options;
2304
+ const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
2305
+ return await this.apiClient(fetchUri);
2306
+ }
2307
+ /** Updates or creates (based on id) a release */
2308
+ async upsert(body) {
2309
+ const fetchUri = this.createUrl(releasesUrl);
2310
+ await this.apiClient(fetchUri, {
2311
+ method: "PUT",
2312
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2313
+ expectNoContent: true
2314
+ });
2315
+ }
2316
+ /** Deletes a release */
2317
+ async remove(body) {
2318
+ const fetchUri = this.createUrl(releasesUrl);
2319
+ await this.apiClient(fetchUri, {
2320
+ method: "DELETE",
2321
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2322
+ expectNoContent: true
2323
+ });
2324
+ }
2325
+ /** Readies or unreadies a release for merging */
2326
+ async ready(body) {
2327
+ const fetchUri = this.createUrl(releasesUrl);
2328
+ await this.apiClient(fetchUri, {
2329
+ method: "PATCH",
2330
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2331
+ expectNoContent: true
2332
+ });
2333
+ }
2334
+ };
2335
+
2336
+ // src/ReleaseContentsClient.ts
2337
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
2338
+ var releaseContentsUrl = "/api/v1/release-contents";
2339
+ var ReleaseContentsClient = class extends ApiClient10 {
2340
+ constructor(options) {
2341
+ super(options);
2342
+ }
2343
+ /** Fetches all entities added to a release */
2344
+ async get(options) {
2345
+ const { projectId } = this.options;
2346
+ const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
2347
+ return await this.apiClient(fetchUri);
2348
+ }
2349
+ /** Removes a release content from a release */
2350
+ async remove(body) {
2351
+ const fetchUri = this.createUrl(releaseContentsUrl);
2352
+ await this.apiClient(fetchUri, {
2353
+ method: "DELETE",
2354
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2355
+ expectNoContent: true
2356
+ });
2357
+ }
2358
+ };
2359
+
2360
+ // src/RouteClient.ts
2361
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
2151
2362
  var ROUTE_URL = "/api/v1/route";
2152
- var RouteClient = class extends ApiClient8 {
2363
+ var RouteClient = class extends ApiClient11 {
2153
2364
  constructor(options) {
2154
2365
  var _a;
2155
2366
  if (!options.limitPolicy) {
@@ -2162,10 +2373,16 @@ var RouteClient = class extends ApiClient8 {
2162
2373
  async getRoute(options) {
2163
2374
  const { projectId } = this.options;
2164
2375
  const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
2165
- return await this.apiClient(fetchUri);
2376
+ return await this.apiClient(
2377
+ fetchUri,
2378
+ this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
2379
+ );
2166
2380
  }
2167
2381
  };
2168
2382
 
2383
+ // src/types/locales.ts
2384
+ var LOCALE_DYNAMIC_INPUT_NAME = "locale";
2385
+
2169
2386
  // src/utils/createApiEnhancer.ts
2170
2387
  var createUniformApiEnhancer = ({ apiUrl }) => {
2171
2388
  return async (message) => {
@@ -2188,6 +2405,28 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
2188
2405
  };
2189
2406
  };
2190
2407
 
2408
+ // src/utils/entryConverter.ts
2409
+ function convertEntryToPutEntry(entry) {
2410
+ return {
2411
+ entry: {
2412
+ type: entry.entry.type,
2413
+ _dataResources: entry.entry._dataResources,
2414
+ _id: entry.entry._id,
2415
+ _name: entry.entry._name,
2416
+ _slug: entry.entry._slug,
2417
+ _pattern: entry.entry._pattern,
2418
+ _overridability: entry.entry._overridability,
2419
+ _overrides: entry.entry._overrides,
2420
+ fields: entry.entry.fields,
2421
+ _locales: entry.entry._locales
2422
+ },
2423
+ pattern: entry.pattern,
2424
+ state: entry.state,
2425
+ projectId: entry.projectId,
2426
+ releaseId: entry.releaseId
2427
+ };
2428
+ }
2429
+
2191
2430
  // src/utils/getParameterAttributes.ts
2192
2431
  var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
2193
2432
  var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
@@ -2317,9 +2556,14 @@ function parseVariableExpression(serialized, onToken) {
2317
2556
  continue;
2318
2557
  }
2319
2558
  if (char === variableSuffix && state === "variable") {
2559
+ if (serialized[index - 1] === escapeCharacter) {
2560
+ bufferEndIndex++;
2561
+ continue;
2562
+ }
2320
2563
  state = "text";
2321
2564
  if (bufferEndIndex > bufferStartIndex) {
2322
- if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "variable") === false) {
2565
+ const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
2566
+ if (handleToken(unescapedVariableName, "variable") === false) {
2323
2567
  return tokenCount;
2324
2568
  }
2325
2569
  bufferStartIndex = bufferEndIndex + variableSuffix.length;
@@ -2379,7 +2623,7 @@ import { produce } from "immer";
2379
2623
 
2380
2624
  // src/utils/variables/createVariableReference.ts
2381
2625
  function createVariableReference(variableName) {
2382
- return `\${${variableName}}`;
2626
+ return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
2383
2627
  }
2384
2628
 
2385
2629
  // src/utils/variables/bindVariablesToObject.ts
@@ -2463,6 +2707,9 @@ function handleRichTextNodeBinding(object, options) {
2463
2707
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
2464
2708
  var CanvasClientError = ApiClientError2;
2465
2709
  export {
2710
+ ASSETS_SOURCE_CUSTOM_URL,
2711
+ ASSETS_SOURCE_UNIFORM,
2712
+ ASSET_PARAMETER_TYPE,
2466
2713
  ATTRIBUTE_COMPONENT_ID,
2467
2714
  ATTRIBUTE_MULTILINE,
2468
2715
  ATTRIBUTE_PARAMETER_ID,
@@ -2503,11 +2750,17 @@ export {
2503
2750
  IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
2504
2751
  IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM,
2505
2752
  IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,
2753
+ IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM,
2506
2754
  IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM,
2507
2755
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2508
2756
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2757
+ LOCALE_DYNAMIC_INPUT_NAME,
2758
+ LocaleClient,
2509
2759
  PLACEHOLDER_ID,
2510
2760
  PromptClient,
2761
+ RelationshipClient,
2762
+ ReleaseClient,
2763
+ ReleaseContentsClient,
2511
2764
  RouteClient,
2512
2765
  SECRET_QUERY_STRING_PARAM,
2513
2766
  UncachedCanvasClient,
@@ -2526,21 +2779,29 @@ export {
2526
2779
  createVariableReference,
2527
2780
  enhance,
2528
2781
  extractLocales,
2782
+ findParameterInNodeTree,
2783
+ flattenValues,
2529
2784
  generateComponentPlaceholderId,
2530
2785
  generateHash,
2531
2786
  getBlockValue,
2532
2787
  getChannelName,
2533
2788
  getComponentJsonPointer,
2534
2789
  getComponentPath,
2790
+ getNounForLocation,
2791
+ getNounForNode,
2535
2792
  getParameterAttributes,
2536
2793
  getPropertiesValue,
2794
+ getPropertyValue,
2537
2795
  isAddComponentMessage,
2538
2796
  isAllowedReferrer,
2797
+ isAssetParamValue,
2798
+ isAssetParamValueItem,
2539
2799
  isComponentActionMessage,
2540
2800
  isComponentPlaceholderId,
2541
2801
  isDismissPlaceholderMessage,
2542
2802
  isEntryData,
2543
2803
  isMovingComponentMessage,
2804
+ isNestedNodeType,
2544
2805
  isOpenParameterEditorMessage,
2545
2806
  isReadyMessage,
2546
2807
  isReportRenderedCompositionsMessage,
@@ -2562,7 +2823,6 @@ export {
2562
2823
  nullLimitPolicy,
2563
2824
  parseVariableExpression,
2564
2825
  subscribeToComposition,
2565
- unstable_CompositionRelationshipClient,
2566
2826
  walkComponentTree,
2567
2827
  walkNodeTree
2568
2828
  };