@knapsack/core 4.68.5 → 4.68.6--canary.4549.dbe7f16.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 +33 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
36
|
+
// ../../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/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
38
|
+
"../../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/cjs_shims.js"() {
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -490,8 +490,7 @@ var __export2 = /* @__PURE__ */ __name((target, all) => {
|
|
|
490
490
|
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
491
491
|
}, "__export");
|
|
492
492
|
function isColor(color) {
|
|
493
|
-
if (typeof color !== "string")
|
|
494
|
-
return false;
|
|
493
|
+
if (typeof color !== "string") return false;
|
|
495
494
|
try {
|
|
496
495
|
return !!import_color_string.default.get(color);
|
|
497
496
|
} catch (e) {
|
|
@@ -759,8 +758,7 @@ var UiConfigV10Struct = (0, import_superstruct.object)({
|
|
|
759
758
|
})
|
|
760
759
|
});
|
|
761
760
|
function isTokenReference(val) {
|
|
762
|
-
if (typeof val !== "string")
|
|
763
|
-
return false;
|
|
761
|
+
if (typeof val !== "string") return false;
|
|
764
762
|
const totalOpenBrackets = val.split("{").length - 1;
|
|
765
763
|
return totalOpenBrackets === 1 && val.startsWith("{") && val.endsWith("}");
|
|
766
764
|
}
|
|
@@ -779,8 +777,7 @@ __name2(isNotTokenReference, "isNotTokenReference");
|
|
|
779
777
|
var TokenReferenceStruct = s.define(
|
|
780
778
|
"Token Reference",
|
|
781
779
|
(value) => {
|
|
782
|
-
if (typeof value !== "string")
|
|
783
|
-
return false;
|
|
780
|
+
if (typeof value !== "string") return false;
|
|
784
781
|
if (isNotTokenReference(value)) {
|
|
785
782
|
return "Must start and end with curly braces";
|
|
786
783
|
}
|
|
@@ -1199,8 +1196,7 @@ __name2(isTokenValueShadow, "isTokenValueShadow");
|
|
|
1199
1196
|
var TokenValueShadowStruct = s2.define(
|
|
1200
1197
|
"Shadow Value",
|
|
1201
1198
|
(value) => {
|
|
1202
|
-
if (isTokenValueShadow(value))
|
|
1203
|
-
return true;
|
|
1199
|
+
if (isTokenValueShadow(value)) return true;
|
|
1204
1200
|
return `Expected a shadow value, got ${JSON.stringify(value)}`;
|
|
1205
1201
|
}
|
|
1206
1202
|
);
|
|
@@ -1545,8 +1541,7 @@ __name2(isTokenSrcExtensions, "isTokenSrcExtensions");
|
|
|
1545
1541
|
}
|
|
1546
1542
|
]);
|
|
1547
1543
|
function isTokenSrc(tokenObject) {
|
|
1548
|
-
if ((0, import_utils4.isObject)(tokenObject) && (0, import_utils4.isObjKey)("$value", tokenObject))
|
|
1549
|
-
return true;
|
|
1544
|
+
if ((0, import_utils4.isObject)(tokenObject) && (0, import_utils4.isObjKey)("$value", tokenObject)) return true;
|
|
1550
1545
|
return false;
|
|
1551
1546
|
}
|
|
1552
1547
|
__name(isTokenSrc, "isTokenSrc");
|
|
@@ -1614,8 +1609,7 @@ function isTemplateDemo(demo) {
|
|
|
1614
1609
|
__name(isTemplateDemo, "isTemplateDemo");
|
|
1615
1610
|
__name2(isTemplateDemo, "isTemplateDemo");
|
|
1616
1611
|
function isKsAppClientDataNoMeta(data) {
|
|
1617
|
-
if (!(0, import_utils.isObject)(data))
|
|
1618
|
-
return false;
|
|
1612
|
+
if (!(0, import_utils.isObject)(data)) return false;
|
|
1619
1613
|
const requiredKeys = [
|
|
1620
1614
|
"assetSetsState",
|
|
1621
1615
|
"customPagesState",
|
|
@@ -1624,10 +1618,8 @@ function isKsAppClientDataNoMeta(data) {
|
|
|
1624
1618
|
"tokensSrc",
|
|
1625
1619
|
"db"
|
|
1626
1620
|
];
|
|
1627
|
-
if (!requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data)))
|
|
1628
|
-
|
|
1629
|
-
if (!(0, import_utils.isObjKey)("metaState", data))
|
|
1630
|
-
return true;
|
|
1621
|
+
if (!requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data))) return false;
|
|
1622
|
+
if (!(0, import_utils.isObjKey)("metaState", data)) return true;
|
|
1631
1623
|
return false;
|
|
1632
1624
|
}
|
|
1633
1625
|
__name(isKsAppClientDataNoMeta, "isKsAppClientDataNoMeta");
|
|
@@ -1637,8 +1629,7 @@ var KsAppClientDataNoMetaStruct = (0, import_superstruct5.define)(
|
|
|
1637
1629
|
isKsAppClientDataNoMeta
|
|
1638
1630
|
);
|
|
1639
1631
|
function isKsAppClientDataAndMeta(data) {
|
|
1640
|
-
if (!(0, import_utils.isObject)(data))
|
|
1641
|
-
return false;
|
|
1632
|
+
if (!(0, import_utils.isObject)(data)) return false;
|
|
1642
1633
|
const requiredKeys = [
|
|
1643
1634
|
"assetSetsState",
|
|
1644
1635
|
"customPagesState",
|
|
@@ -1683,8 +1674,7 @@ var KsMetaStateStruct = (0, import_superstruct5.type)({
|
|
|
1683
1674
|
});
|
|
1684
1675
|
var isKsMetaState = KsMetaStateStruct.is;
|
|
1685
1676
|
function isKsAppClientDataNoMetaV3(data) {
|
|
1686
|
-
if (!(0, import_utils.isObject)(data))
|
|
1687
|
-
return false;
|
|
1677
|
+
if (!(0, import_utils.isObject)(data)) return false;
|
|
1688
1678
|
const requiredKeys = [
|
|
1689
1679
|
"assetSetsState",
|
|
1690
1680
|
"customPagesState",
|
|
@@ -1693,10 +1683,8 @@ function isKsAppClientDataNoMetaV3(data) {
|
|
|
1693
1683
|
"settingsState",
|
|
1694
1684
|
"tokensState"
|
|
1695
1685
|
];
|
|
1696
|
-
if (!requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data)))
|
|
1697
|
-
|
|
1698
|
-
if (!(0, import_utils.isObjKey)("metaState", data))
|
|
1699
|
-
return true;
|
|
1686
|
+
if (!requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data))) return false;
|
|
1687
|
+
if (!(0, import_utils.isObjKey)("metaState", data)) return true;
|
|
1700
1688
|
return false;
|
|
1701
1689
|
}
|
|
1702
1690
|
__name(isKsAppClientDataNoMetaV3, "isKsAppClientDataNoMetaV3");
|
|
@@ -1706,8 +1694,7 @@ var KsAppClientDataNoMetaStructV3 = (0, import_superstruct6.define)(
|
|
|
1706
1694
|
isKsAppClientDataNoMetaV3
|
|
1707
1695
|
);
|
|
1708
1696
|
function isKsAppClientDataAndMetaV3(data) {
|
|
1709
|
-
if (!(0, import_utils.isObject)(data))
|
|
1710
|
-
return false;
|
|
1697
|
+
if (!(0, import_utils.isObject)(data)) return false;
|
|
1711
1698
|
const requiredKeys = [
|
|
1712
1699
|
"assetSetsState",
|
|
1713
1700
|
"customPagesState",
|
|
@@ -1767,10 +1754,8 @@ var KsRemoteChangeRuntime = s3.type({
|
|
|
1767
1754
|
});
|
|
1768
1755
|
var KsRemoteChangesStructRuntime = s3.array(KsRemoteChangeRuntime);
|
|
1769
1756
|
function isKsJsImports(imports) {
|
|
1770
|
-
if (!Array.isArray(imports))
|
|
1771
|
-
|
|
1772
|
-
if (imports.length === 0)
|
|
1773
|
-
return true;
|
|
1757
|
+
if (!Array.isArray(imports)) return false;
|
|
1758
|
+
if (imports.length === 0) return true;
|
|
1774
1759
|
const [anImport] = imports;
|
|
1775
1760
|
if (anImport.type === "pattern-template" && typeof anImport.patternId !== "string")
|
|
1776
1761
|
return false;
|
|
@@ -1789,8 +1774,7 @@ function isKsJsImports(imports) {
|
|
|
1789
1774
|
if (anImport.type === "extra" && typeof anImport.importInfo.path !== "string")
|
|
1790
1775
|
return false;
|
|
1791
1776
|
if (anImport.type === "extra" && typeof anImport.importInfo.names !== "undefined") {
|
|
1792
|
-
if (!Array.isArray(anImport.importInfo.names))
|
|
1793
|
-
return false;
|
|
1777
|
+
if (!Array.isArray(anImport.importInfo.names)) return false;
|
|
1794
1778
|
if (anImport.importInfo.names.some((name) => typeof name !== "string"))
|
|
1795
1779
|
return false;
|
|
1796
1780
|
}
|
|
@@ -1799,25 +1783,19 @@ function isKsJsImports(imports) {
|
|
|
1799
1783
|
__name(isKsJsImports, "isKsJsImports");
|
|
1800
1784
|
__name2(isKsJsImports, "isKsJsImports");
|
|
1801
1785
|
function isKsRendererClientGlobalImportedModules(mods) {
|
|
1802
|
-
if (!(0, import_utils.isObject)(mods))
|
|
1803
|
-
return false;
|
|
1786
|
+
if (!(0, import_utils.isObject)(mods)) return false;
|
|
1804
1787
|
for (const key in mods) {
|
|
1805
|
-
if (typeof mods[key] !== "function")
|
|
1806
|
-
return false;
|
|
1788
|
+
if (typeof mods[key] !== "function") return false;
|
|
1807
1789
|
}
|
|
1808
1790
|
return true;
|
|
1809
1791
|
}
|
|
1810
1792
|
__name(isKsRendererClientGlobalImportedModules, "isKsRendererClientGlobalImportedModules");
|
|
1811
1793
|
__name2(isKsRendererClientGlobalImportedModules, "isKsRendererClientGlobalImportedModules");
|
|
1812
1794
|
function isKsRendererClientGlobal(knapsack) {
|
|
1813
|
-
if (!(0, import_utils.isObject)(knapsack))
|
|
1814
|
-
|
|
1815
|
-
if (knapsack.
|
|
1816
|
-
|
|
1817
|
-
if (typeof knapsack.getImport !== "function")
|
|
1818
|
-
return false;
|
|
1819
|
-
if (!Array.isArray(knapsack.allAvailableImports))
|
|
1820
|
-
return false;
|
|
1795
|
+
if (!(0, import_utils.isObject)(knapsack)) return false;
|
|
1796
|
+
if (knapsack.typeName !== "KsRendererClientGlobal") return false;
|
|
1797
|
+
if (typeof knapsack.getImport !== "function") return false;
|
|
1798
|
+
if (!Array.isArray(knapsack.allAvailableImports)) return false;
|
|
1821
1799
|
if (!isKsRendererClientGlobalImportedModules(knapsack.importedModules)) {
|
|
1822
1800
|
return false;
|
|
1823
1801
|
}
|
|
@@ -1850,8 +1828,8 @@ __name(getKsRendererClientGlobal, "getKsRendererClientGlobal");
|
|
|
1850
1828
|
__name2(getKsRendererClientGlobal, "getKsRendererClientGlobal");
|
|
1851
1829
|
var plugins_exports = {};
|
|
1852
1830
|
__export2(plugins_exports, {
|
|
1853
|
-
ACTIONS: () => ACTIONS,
|
|
1854
|
-
endpoint: () => endpoint
|
|
1831
|
+
ACTIONS: /* @__PURE__ */ __name(() => ACTIONS, "ACTIONS"),
|
|
1832
|
+
endpoint: /* @__PURE__ */ __name(() => endpoint, "endpoint")
|
|
1855
1833
|
});
|
|
1856
1834
|
var endpoint = `/plugins`;
|
|
1857
1835
|
var ACTIONS = /* @__PURE__ */ ((ACTIONS3) => {
|
|
@@ -1860,8 +1838,8 @@ var ACTIONS = /* @__PURE__ */ ((ACTIONS3) => {
|
|
|
1860
1838
|
})(ACTIONS || {});
|
|
1861
1839
|
var files_exports = {};
|
|
1862
1840
|
__export2(files_exports, {
|
|
1863
|
-
ACTIONS: () => ACTIONS2,
|
|
1864
|
-
endpoint: () => endpoint2
|
|
1841
|
+
ACTIONS: /* @__PURE__ */ __name(() => ACTIONS2, "ACTIONS"),
|
|
1842
|
+
endpoint: /* @__PURE__ */ __name(() => endpoint2, "endpoint")
|
|
1865
1843
|
});
|
|
1866
1844
|
var endpoint2 = `/files`;
|
|
1867
1845
|
var ACTIONS2 = /* @__PURE__ */ ((ACTIONS3) => {
|
|
@@ -1933,8 +1911,7 @@ var JwtWithCustomClaimsStruct = (0, import_superstruct7.assign)(
|
|
|
1933
1911
|
);
|
|
1934
1912
|
function expandSitesByRole(sitesByRole) {
|
|
1935
1913
|
return Object.entries(sitesByRole).reduce((cur, [roleId, siteIds]) => {
|
|
1936
|
-
if (!isRoleValid(roleId))
|
|
1937
|
-
return cur;
|
|
1914
|
+
if (!isRoleValid(roleId)) return cur;
|
|
1938
1915
|
siteIds.forEach((siteId) => {
|
|
1939
1916
|
cur[siteId] = roleId;
|
|
1940
1917
|
});
|
|
@@ -1946,7 +1923,7 @@ var defaultAnonymousKsClaims = {
|
|
|
1946
1923
|
isSuperAdmin: false,
|
|
1947
1924
|
userId: "",
|
|
1948
1925
|
siteRoleMap: {},
|
|
1949
|
-
getSiteRole: () => "ANONYMOUS"
|
|
1926
|
+
getSiteRole: /* @__PURE__ */ __name(() => "ANONYMOUS", "getSiteRole")
|
|
1950
1927
|
};
|
|
1951
1928
|
var getKsClaims = /* @__PURE__ */ __name((claims) => {
|
|
1952
1929
|
if (!JwtWithCustomClaimsStruct.is(claims)) {
|
|
@@ -1957,11 +1934,10 @@ var getKsClaims = /* @__PURE__ */ __name((claims) => {
|
|
|
1957
1934
|
return {
|
|
1958
1935
|
...ksClaims,
|
|
1959
1936
|
siteRoleMap,
|
|
1960
|
-
getSiteRole: (siteId) => {
|
|
1961
|
-
if (ksClaims.isSuperAdmin)
|
|
1962
|
-
return "ADMIN";
|
|
1937
|
+
getSiteRole: /* @__PURE__ */ __name((siteId) => {
|
|
1938
|
+
if (ksClaims.isSuperAdmin) return "ADMIN";
|
|
1963
1939
|
return siteRoleMap[siteId] || "ANONYMOUS";
|
|
1964
|
-
}
|
|
1940
|
+
}, "getSiteRole")
|
|
1965
1941
|
};
|
|
1966
1942
|
}, "getKsClaims");
|
|
1967
1943
|
|