@geekmidas/manifest 10.0.0-alpha.195 → 10.0.0-alpha.197
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.cjs +48 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +63 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +45 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -88,6 +88,11 @@ const PUBLIC = {
|
|
|
88
88
|
"database-reader": [],
|
|
89
89
|
"database-schema": [],
|
|
90
90
|
cache: [],
|
|
91
|
+
maps: [
|
|
92
|
+
"browserKey",
|
|
93
|
+
"androidKey",
|
|
94
|
+
"iosKey"
|
|
95
|
+
],
|
|
91
96
|
secret: [],
|
|
92
97
|
credential: [],
|
|
93
98
|
encryption: [],
|
|
@@ -906,6 +911,28 @@ function fileServerName(surfaceId) {
|
|
|
906
911
|
return surfaceId.endsWith("Server") && surfaceId.length > 6 ? surfaceId.slice(0, -6) : surfaceId;
|
|
907
912
|
}
|
|
908
913
|
//#endregion
|
|
914
|
+
//#region src/maps.ts
|
|
915
|
+
/** Every role, in the order a provider creates them. */
|
|
916
|
+
const MAPS_ROLES = [
|
|
917
|
+
"apiKey",
|
|
918
|
+
"browserKey",
|
|
919
|
+
"androidKey",
|
|
920
|
+
"iosKey"
|
|
921
|
+
];
|
|
922
|
+
/**
|
|
923
|
+
* The roles a caller of `kind` holds: a site the browser key, a mobile app
|
|
924
|
+
* one per platform, anything else — a process on a server — the server key.
|
|
925
|
+
*/
|
|
926
|
+
function mapsRolesFor(kind) {
|
|
927
|
+
if (kind === "site") return ["browserKey"];
|
|
928
|
+
if (kind === "mobile-app") return ["androidKey", "iosKey"];
|
|
929
|
+
return ["apiKey"];
|
|
930
|
+
}
|
|
931
|
+
/** The keys a caller of `kind` is handed of the `Maps` construct `id`. */
|
|
932
|
+
function mapsKeysFor(id, kind) {
|
|
933
|
+
return mapsRolesFor(kind).map((role) => providedKeyFor(id, "maps", role));
|
|
934
|
+
}
|
|
935
|
+
//#endregion
|
|
909
936
|
//#region src/derive.ts
|
|
910
937
|
/** Whether a declaration names a parent. */
|
|
911
938
|
function isDerived(declaration) {
|
|
@@ -999,6 +1026,22 @@ function dependentsOf(manifest, id) {
|
|
|
999
1026
|
return callers.sort();
|
|
1000
1027
|
}
|
|
1001
1028
|
/**
|
|
1029
|
+
* The keys of the `Maps` construct `id` its callers hold, by role — the
|
|
1030
|
+
* graph read backwards, as an API's trusted origins are: a server process
|
|
1031
|
+
* that depends on it is why there is a server key, a site why there is a
|
|
1032
|
+
* browser key, a mobile app why there are an Android and an iOS key. Each
|
|
1033
|
+
* role lists its callers, sorted; a role nobody holds is absent.
|
|
1034
|
+
*/
|
|
1035
|
+
function mapsCallers(manifest, id) {
|
|
1036
|
+
const callers = {};
|
|
1037
|
+
for (const caller of dependentsOf(manifest, id)) {
|
|
1038
|
+
const kind = manifest[caller]?.kind;
|
|
1039
|
+
if (!kind) continue;
|
|
1040
|
+
for (const role of mapsRolesFor(kind)) callers[role] = [...callers[role] ?? [], caller];
|
|
1041
|
+
}
|
|
1042
|
+
return callers;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1002
1045
|
* How each site variant names a value it ships to the browser.
|
|
1003
1046
|
*
|
|
1004
1047
|
* The prefix *is* the framework's contract — `VITE_`, `NEXT_PUBLIC_` and
|
|
@@ -1046,6 +1089,7 @@ function publicValues(declaration, manifest) {
|
|
|
1046
1089
|
const target = manifest[id];
|
|
1047
1090
|
if (!target) return;
|
|
1048
1091
|
for (const role of PUBLIC[target.kind] ?? []) {
|
|
1092
|
+
if (target.kind === "maps" && !mapsRolesFor(declaration.kind).includes(role)) continue;
|
|
1049
1093
|
const key = providedKeyFor(id, target.kind, role);
|
|
1050
1094
|
values.set(key, {
|
|
1051
1095
|
id,
|
|
@@ -1721,6 +1765,7 @@ exports.InvalidApiGatewayWebSocketUrl = InvalidApiGatewayWebSocketUrl;
|
|
|
1721
1765
|
exports.InvalidConstructId = InvalidConstructId;
|
|
1722
1766
|
exports.InvalidHostLabel = InvalidHostLabel;
|
|
1723
1767
|
exports.KMS_SCHEME = KMS_SCHEME;
|
|
1768
|
+
exports.MAPS_ROLES = MAPS_ROLES;
|
|
1724
1769
|
exports.MIGRATIONS_ROOT = MIGRATIONS_ROOT;
|
|
1725
1770
|
exports.NoUrlForStage = NoUrlForStage;
|
|
1726
1771
|
exports.PUBLIC = PUBLIC;
|
|
@@ -1762,6 +1807,9 @@ exports.isWebOrigin = isWebOrigin;
|
|
|
1762
1807
|
exports.isWildcardSite = isWildcardSite;
|
|
1763
1808
|
exports.kebabCase = kebabCase;
|
|
1764
1809
|
exports.kmsUrl = kmsUrl;
|
|
1810
|
+
exports.mapsCallers = mapsCallers;
|
|
1811
|
+
exports.mapsKeysFor = mapsKeysFor;
|
|
1812
|
+
exports.mapsRolesFor = mapsRolesFor;
|
|
1765
1813
|
exports.migrationFolder = migrationFolder;
|
|
1766
1814
|
exports.migrationTargets = migrationTargets;
|
|
1767
1815
|
exports.mobileOrigins = mobileOrigins;
|