@knapsack/core 4.69.0--canary.4475.32644f6.0 → 4.69.0--canary.4412.1594dad.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.16.1__@swc+core@1.3.57_@swc+helpers_cstkf2rtisiifgkfujemx5llme/node_modules/tsup/assets/esm_shims.js
31
+ // ../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.1__@swc+core@1.3.57_@swc+helpers_ww5ypu3n2haukmlxcrky22ydmq/node_modules/tsup/assets/esm_shims.js
32
32
  var init_esm_shims = __esm({
33
- "../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.8_@types+node@20.16.1__@swc+core@1.3.57_@swc+helpers_cstkf2rtisiifgkfujemx5llme/node_modules/tsup/assets/esm_shims.js"() {
33
+ "../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.1__@swc+core@1.3.57_@swc+helpers_ww5ypu3n2haukmlxcrky22ydmq/node_modules/tsup/assets/esm_shims.js"() {
34
34
  }
35
35
  });
36
36
 
@@ -500,8 +500,7 @@ var __export = /* @__PURE__ */ __name((target, all) => {
500
500
  __defProp2(target, name, { get: all[name], enumerable: true });
501
501
  }, "__export");
502
502
  function isColor(color) {
503
- if (typeof color !== "string")
504
- return false;
503
+ if (typeof color !== "string") return false;
505
504
  try {
506
505
  return !!import_color_string.default.get(color);
507
506
  } catch (e) {
@@ -769,8 +768,7 @@ var UiConfigV10Struct = object2({
769
768
  })
770
769
  });
771
770
  function isTokenReference(val) {
772
- if (typeof val !== "string")
773
- return false;
771
+ if (typeof val !== "string") return false;
774
772
  const totalOpenBrackets = val.split("{").length - 1;
775
773
  return totalOpenBrackets === 1 && val.startsWith("{") && val.endsWith("}");
776
774
  }
@@ -789,8 +787,7 @@ __name2(isNotTokenReference, "isNotTokenReference");
789
787
  var TokenReferenceStruct = s.define(
790
788
  "Token Reference",
791
789
  (value) => {
792
- if (typeof value !== "string")
793
- return false;
790
+ if (typeof value !== "string") return false;
794
791
  if (isNotTokenReference(value)) {
795
792
  return "Must start and end with curly braces";
796
793
  }
@@ -1209,8 +1206,7 @@ __name2(isTokenValueShadow, "isTokenValueShadow");
1209
1206
  var TokenValueShadowStruct = s2.define(
1210
1207
  "Shadow Value",
1211
1208
  (value) => {
1212
- if (isTokenValueShadow(value))
1213
- return true;
1209
+ if (isTokenValueShadow(value)) return true;
1214
1210
  return `Expected a shadow value, got ${JSON.stringify(value)}`;
1215
1211
  }
1216
1212
  );
@@ -1555,8 +1551,7 @@ expectType3([
1555
1551
  }
1556
1552
  ]);
1557
1553
  function isTokenSrc(tokenObject) {
1558
- if (isObject3(tokenObject) && isObjKey3("$value", tokenObject))
1559
- return true;
1554
+ if (isObject3(tokenObject) && isObjKey3("$value", tokenObject)) return true;
1560
1555
  return false;
1561
1556
  }
1562
1557
  __name(isTokenSrc, "isTokenSrc");
@@ -1624,8 +1619,7 @@ function isTemplateDemo(demo) {
1624
1619
  __name(isTemplateDemo, "isTemplateDemo");
1625
1620
  __name2(isTemplateDemo, "isTemplateDemo");
1626
1621
  function isKsAppClientDataNoMeta(data) {
1627
- if (!isObject(data))
1628
- return false;
1622
+ if (!isObject(data)) return false;
1629
1623
  const requiredKeys = [
1630
1624
  "assetSetsState",
1631
1625
  "customPagesState",
@@ -1634,10 +1628,8 @@ function isKsAppClientDataNoMeta(data) {
1634
1628
  "tokensSrc",
1635
1629
  "db"
1636
1630
  ];
1637
- if (!requiredKeys.every((key) => isObjKey(key, data)))
1638
- return false;
1639
- if (!isObjKey("metaState", data))
1640
- return true;
1631
+ if (!requiredKeys.every((key) => isObjKey(key, data))) return false;
1632
+ if (!isObjKey("metaState", data)) return true;
1641
1633
  return false;
1642
1634
  }
1643
1635
  __name(isKsAppClientDataNoMeta, "isKsAppClientDataNoMeta");
@@ -1647,8 +1639,7 @@ var KsAppClientDataNoMetaStruct = define4(
1647
1639
  isKsAppClientDataNoMeta
1648
1640
  );
1649
1641
  function isKsAppClientDataAndMeta(data) {
1650
- if (!isObject(data))
1651
- return false;
1642
+ if (!isObject(data)) return false;
1652
1643
  const requiredKeys = [
1653
1644
  "assetSetsState",
1654
1645
  "customPagesState",
@@ -1693,8 +1684,7 @@ var KsMetaStateStruct = type6({
1693
1684
  });
1694
1685
  var isKsMetaState = KsMetaStateStruct.is;
1695
1686
  function isKsAppClientDataNoMetaV3(data) {
1696
- if (!isObject(data))
1697
- return false;
1687
+ if (!isObject(data)) return false;
1698
1688
  const requiredKeys = [
1699
1689
  "assetSetsState",
1700
1690
  "customPagesState",
@@ -1703,10 +1693,8 @@ function isKsAppClientDataNoMetaV3(data) {
1703
1693
  "settingsState",
1704
1694
  "tokensState"
1705
1695
  ];
1706
- if (!requiredKeys.every((key) => isObjKey(key, data)))
1707
- return false;
1708
- if (!isObjKey("metaState", data))
1709
- return true;
1696
+ if (!requiredKeys.every((key) => isObjKey(key, data))) return false;
1697
+ if (!isObjKey("metaState", data)) return true;
1710
1698
  return false;
1711
1699
  }
1712
1700
  __name(isKsAppClientDataNoMetaV3, "isKsAppClientDataNoMetaV3");
@@ -1716,8 +1704,7 @@ var KsAppClientDataNoMetaStructV3 = define5(
1716
1704
  isKsAppClientDataNoMetaV3
1717
1705
  );
1718
1706
  function isKsAppClientDataAndMetaV3(data) {
1719
- if (!isObject(data))
1720
- return false;
1707
+ if (!isObject(data)) return false;
1721
1708
  const requiredKeys = [
1722
1709
  "assetSetsState",
1723
1710
  "customPagesState",
@@ -1777,10 +1764,8 @@ var KsRemoteChangeRuntime = s3.type({
1777
1764
  });
1778
1765
  var KsRemoteChangesStructRuntime = s3.array(KsRemoteChangeRuntime);
1779
1766
  function isKsJsImports(imports) {
1780
- if (!Array.isArray(imports))
1781
- return false;
1782
- if (imports.length === 0)
1783
- return true;
1767
+ if (!Array.isArray(imports)) return false;
1768
+ if (imports.length === 0) return true;
1784
1769
  const [anImport] = imports;
1785
1770
  if (anImport.type === "pattern-template" && typeof anImport.patternId !== "string")
1786
1771
  return false;
@@ -1799,8 +1784,7 @@ function isKsJsImports(imports) {
1799
1784
  if (anImport.type === "extra" && typeof anImport.importInfo.path !== "string")
1800
1785
  return false;
1801
1786
  if (anImport.type === "extra" && typeof anImport.importInfo.names !== "undefined") {
1802
- if (!Array.isArray(anImport.importInfo.names))
1803
- return false;
1787
+ if (!Array.isArray(anImport.importInfo.names)) return false;
1804
1788
  if (anImport.importInfo.names.some((name) => typeof name !== "string"))
1805
1789
  return false;
1806
1790
  }
@@ -1809,25 +1793,19 @@ function isKsJsImports(imports) {
1809
1793
  __name(isKsJsImports, "isKsJsImports");
1810
1794
  __name2(isKsJsImports, "isKsJsImports");
1811
1795
  function isKsRendererClientGlobalImportedModules(mods) {
1812
- if (!isObject(mods))
1813
- return false;
1796
+ if (!isObject(mods)) return false;
1814
1797
  for (const key in mods) {
1815
- if (typeof mods[key] !== "function")
1816
- return false;
1798
+ if (typeof mods[key] !== "function") return false;
1817
1799
  }
1818
1800
  return true;
1819
1801
  }
1820
1802
  __name(isKsRendererClientGlobalImportedModules, "isKsRendererClientGlobalImportedModules");
1821
1803
  __name2(isKsRendererClientGlobalImportedModules, "isKsRendererClientGlobalImportedModules");
1822
1804
  function isKsRendererClientGlobal(knapsack) {
1823
- if (!isObject(knapsack))
1824
- return false;
1825
- if (knapsack.typeName !== "KsRendererClientGlobal")
1826
- return false;
1827
- if (typeof knapsack.getImport !== "function")
1828
- return false;
1829
- if (!Array.isArray(knapsack.allAvailableImports))
1830
- return false;
1805
+ if (!isObject(knapsack)) return false;
1806
+ if (knapsack.typeName !== "KsRendererClientGlobal") return false;
1807
+ if (typeof knapsack.getImport !== "function") return false;
1808
+ if (!Array.isArray(knapsack.allAvailableImports)) return false;
1831
1809
  if (!isKsRendererClientGlobalImportedModules(knapsack.importedModules)) {
1832
1810
  return false;
1833
1811
  }
@@ -1860,8 +1838,8 @@ __name(getKsRendererClientGlobal, "getKsRendererClientGlobal");
1860
1838
  __name2(getKsRendererClientGlobal, "getKsRendererClientGlobal");
1861
1839
  var plugins_exports = {};
1862
1840
  __export(plugins_exports, {
1863
- ACTIONS: () => ACTIONS,
1864
- endpoint: () => endpoint
1841
+ ACTIONS: /* @__PURE__ */ __name(() => ACTIONS, "ACTIONS"),
1842
+ endpoint: /* @__PURE__ */ __name(() => endpoint, "endpoint")
1865
1843
  });
1866
1844
  var endpoint = `/plugins`;
1867
1845
  var ACTIONS = /* @__PURE__ */ ((ACTIONS3) => {
@@ -1870,8 +1848,8 @@ var ACTIONS = /* @__PURE__ */ ((ACTIONS3) => {
1870
1848
  })(ACTIONS || {});
1871
1849
  var files_exports = {};
1872
1850
  __export(files_exports, {
1873
- ACTIONS: () => ACTIONS2,
1874
- endpoint: () => endpoint2
1851
+ ACTIONS: /* @__PURE__ */ __name(() => ACTIONS2, "ACTIONS"),
1852
+ endpoint: /* @__PURE__ */ __name(() => endpoint2, "endpoint")
1875
1853
  });
1876
1854
  var endpoint2 = `/files`;
1877
1855
  var ACTIONS2 = /* @__PURE__ */ ((ACTIONS3) => {
@@ -1943,8 +1921,7 @@ var JwtWithCustomClaimsStruct = assign2(
1943
1921
  );
1944
1922
  function expandSitesByRole(sitesByRole) {
1945
1923
  return Object.entries(sitesByRole).reduce((cur, [roleId, siteIds]) => {
1946
- if (!isRoleValid(roleId))
1947
- return cur;
1924
+ if (!isRoleValid(roleId)) return cur;
1948
1925
  siteIds.forEach((siteId) => {
1949
1926
  cur[siteId] = roleId;
1950
1927
  });
@@ -1956,7 +1933,7 @@ var defaultAnonymousKsClaims = {
1956
1933
  isSuperAdmin: false,
1957
1934
  userId: "",
1958
1935
  siteRoleMap: {},
1959
- getSiteRole: () => "ANONYMOUS"
1936
+ getSiteRole: /* @__PURE__ */ __name(() => "ANONYMOUS", "getSiteRole")
1960
1937
  };
1961
1938
  var getKsClaims = /* @__PURE__ */ __name((claims) => {
1962
1939
  if (!JwtWithCustomClaimsStruct.is(claims)) {
@@ -1967,11 +1944,10 @@ var getKsClaims = /* @__PURE__ */ __name((claims) => {
1967
1944
  return {
1968
1945
  ...ksClaims,
1969
1946
  siteRoleMap,
1970
- getSiteRole: (siteId) => {
1971
- if (ksClaims.isSuperAdmin)
1972
- return "ADMIN";
1947
+ getSiteRole: /* @__PURE__ */ __name((siteId) => {
1948
+ if (ksClaims.isSuperAdmin) return "ADMIN";
1973
1949
  return siteRoleMap[siteId] || "ANONYMOUS";
1974
- }
1950
+ }, "getSiteRole")
1975
1951
  };
1976
1952
  }, "getKsClaims");
1977
1953