@geekmidas/manifest 10.0.0-alpha.170 → 10.0.0-alpha.171

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 CHANGED
@@ -1053,6 +1053,21 @@ function publicValues(declaration, manifest) {
1053
1053
  return [...values.values()];
1054
1054
  }
1055
1055
  /**
1056
+ * Whether an edge hands its caller what a server holds of the target — a
1057
+ * bucket's connection and the key pair that signs for it — or only the
1058
+ * target's public values.
1059
+ *
1060
+ * A server process's edge always does: it presigns and writes. A site's or a
1061
+ * mobile app's does only when it named the server half
1062
+ * (`.dependsOn([documents.server])`), for a server half that uploads or
1063
+ * presigns. Its plain edge to a bucket is to where the bucket's links are
1064
+ * signed (`<T>_SIGNED_ORIGIN`): a page that shows presigned links needs to
1065
+ * allow their host, and nothing that writes to the bucket.
1066
+ */
1067
+ function reachesServerHalf(caller, edge) {
1068
+ return !isPublicDeclaration(caller) || edge.server === true;
1069
+ }
1070
+ /**
1056
1071
  * The keys a site's bundle needs, mapped to the key each value comes from —
1057
1072
  * `{ VITE_API_URL: 'API_URL' }` — its edges' public values, and a site's own
1058
1073
  * address (`{ VITE_WEB_URL: 'WEB_URL' }`).
@@ -1259,19 +1274,31 @@ function hostLabels(source) {
1259
1274
  }
1260
1275
  /** One label of a DNS name: lowercase letters, digits and inner hyphens. */
1261
1276
  const LABEL$1 = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
1262
- /** An alias or redirect that cannot be a label of its own under the domain. */
1277
+ /**
1278
+ * A `subdomain`, alias or redirect that cannot be a label of its own under
1279
+ * the domain.
1280
+ */
1263
1281
  var InvalidHostLabel = class extends Error {
1264
1282
  id;
1265
1283
  label;
1266
1284
  field;
1267
1285
  constructor(id, label, field) {
1268
- super(`'${id}' lists '${label}' in ${field}, which is not a host label it can add: each entry is one lowercase label under the stage's domain ('rest', 'www') — no '*', no dots — listed once, and not the construct's own label. Fix or remove the entry.`);
1286
+ super(field === "subdomain" ? `'${id}' has subdomain: '${label}', which is not a host label: it is one lowercase label under the stage's domain ('telemetry', 'logs') — letters, digits and inner hyphens, no '*' and no dots.` : `'${id}' lists '${label}' in ${field}, which is not a host label it can add: each entry is one lowercase label under the stage's domain ('rest', 'www') — no '*', no dots — listed once, and not the construct's own label. Fix or remove the entry.`);
1269
1287
  this.id = id;
1270
1288
  this.label = label;
1271
1289
  this.field = field;
1272
1290
  this.name = "InvalidHostLabel";
1273
1291
  }
1274
1292
  };
1293
+ /**
1294
+ * A construct's own `subdomain`, checked where it is constructed: one label,
1295
+ * never a wildcard — for a construct that cannot answer on every subdomain.
1296
+ *
1297
+ * @throws {InvalidHostLabel} for `'*'`, a dot, or anything not a DNS label
1298
+ */
1299
+ function assertSubdomainLabel(id, subdomain) {
1300
+ if (!LABEL$1.test(subdomain)) throw new InvalidHostLabel(id, subdomain, "subdomain");
1301
+ }
1275
1302
  /** A wildcard site with aliases or redirects. */
1276
1303
  var WildcardSiteCannotHaveAliases = class extends Error {
1277
1304
  id;
@@ -1654,6 +1681,7 @@ exports.WildcardSiteCannotHaveAliases = WildcardSiteCannotHaveAliases;
1654
1681
  exports.apiGatewayWebSocketUrl = apiGatewayWebSocketUrl;
1655
1682
  exports.assertDerivations = assertDerivations;
1656
1683
  exports.assertHostLabels = assertHostLabels;
1684
+ exports.assertSubdomainLabel = assertSubdomainLabel;
1657
1685
  exports.bucketExpiry = bucketExpiry;
1658
1686
  exports.cacheTable = cacheTable;
1659
1687
  exports.canonicalId = canonicalId;
@@ -1686,6 +1714,7 @@ exports.providedKeyFor = providedKeyFor;
1686
1714
  exports.provisionOrder = provisionOrder;
1687
1715
  exports.publicEnvFor = publicEnvFor;
1688
1716
  exports.publicValues = publicValues;
1717
+ exports.reachesServerHalf = reachesServerHalf;
1689
1718
  exports.receiptRecipients = receiptRecipients;
1690
1719
  exports.schemeBase = schemeBase;
1691
1720
  exports.scopedName = scopedName;