@geekmidas/manifest 10.0.0-alpha.124 → 10.0.0-alpha.126

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
@@ -1010,6 +1010,23 @@ function publicEnvFor(declaration, manifest) {
1010
1010
  return keys;
1011
1011
  }
1012
1012
  //#endregion
1013
+ //#region src/derived.ts
1014
+ /** Where a processor keeps what it made, in the bucket it reads. */
1015
+ const DERIVED_PREFIX = ".gkm-derived/";
1016
+ /** How long a derivative is kept when its file server does not say. */
1017
+ const DEFAULT_DERIVED_DAYS = 30;
1018
+ /**
1019
+ * The days a bucket keeps what is under each prefix: what it declared, and —
1020
+ * when a file server over it has processors — the derived prefix, for the
1021
+ * longest any of those servers asked. `undefined` when it expires nothing.
1022
+ */
1023
+ function bucketExpiry(manifest, bucketId) {
1024
+ const expire = { ...manifest[bucketId]?.expire ?? {} };
1025
+ const processed = Object.values(manifest).filter((d) => d.kind === "file-server" && d.of === bucketId && (d.processors?.length ?? 0) > 0);
1026
+ if (processed.length > 0 && expire[".gkm-derived/"] === void 0) expire[DERIVED_PREFIX] = Math.max(...processed.map((s) => s.derivedDays ?? 30));
1027
+ return Object.keys(expire).length > 0 ? expire : void 0;
1028
+ }
1029
+ //#endregion
1013
1030
  //#region src/encryption.ts
1014
1031
  /**
1015
1032
  * The `kms://` URL an `Encryption` construct reads on AWS.
@@ -1233,8 +1250,10 @@ function drawSecret(pick, format = {}) {
1233
1250
  //#endregion
1234
1251
  exports.CLIENT_IP_HEADER = CLIENT_IP_HEADER;
1235
1252
  exports.DATABASE_FOLDERS = DATABASE_FOLDERS;
1253
+ exports.DEFAULT_DERIVED_DAYS = DEFAULT_DERIVED_DAYS;
1236
1254
  exports.DEFAULT_POSTGRES_VERSION = DEFAULT_POSTGRES_VERSION;
1237
1255
  exports.DEFAULT_STAGE_URL = DEFAULT_STAGE_URL;
1256
+ exports.DERIVED_PREFIX = DERIVED_PREFIX;
1238
1257
  exports.DERIVES_FROM = DERIVES_FROM;
1239
1258
  exports.IllegalDerivation = IllegalDerivation;
1240
1259
  exports.InvalidConstructId = InvalidConstructId;
@@ -1248,6 +1267,7 @@ exports.SECRET_SYMBOLS = SECRET_SYMBOLS;
1248
1267
  exports.TELEMETRY_KEYS = TELEMETRY_KEYS;
1249
1268
  exports.UnknownParent = UnknownParent;
1250
1269
  exports.assertDerivations = assertDerivations;
1270
+ exports.bucketExpiry = bucketExpiry;
1251
1271
  exports.cacheTable = cacheTable;
1252
1272
  exports.canonicalId = canonicalId;
1253
1273
  exports.cloudName = cloudName;