No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

applyHash.js 1.3KB

12345678910111213141516171819202122
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.applyBackendHashToBackends = void 0;
  4. const backend_1 = require("../backend");
  5. const hash_1 = require("./hash");
  6. function applyBackendHashToBackends(wantBackends, context) {
  7. var _a;
  8. for (const [codebase, wantBackend] of Object.entries(wantBackends)) {
  9. const source = (_a = context === null || context === void 0 ? void 0 : context.sources) === null || _a === void 0 ? void 0 : _a[codebase];
  10. const envHash = (0, hash_1.getEnvironmentVariablesHash)(wantBackend);
  11. applyBackendHashToEndpoints(wantBackend, envHash, source === null || source === void 0 ? void 0 : source.functionsSourceV1Hash, source === null || source === void 0 ? void 0 : source.functionsSourceV2Hash);
  12. }
  13. }
  14. exports.applyBackendHashToBackends = applyBackendHashToBackends;
  15. function applyBackendHashToEndpoints(wantBackend, envHash, sourceV1Hash, sourceV2Hash) {
  16. for (const endpoint of (0, backend_1.allEndpoints)(wantBackend)) {
  17. const secretsHash = (0, hash_1.getSecretsHash)(endpoint);
  18. const isV2 = endpoint.platform === "gcfv2";
  19. const sourceHash = isV2 ? sourceV2Hash : sourceV1Hash;
  20. endpoint.hash = (0, hash_1.getEndpointHash)(sourceHash, envHash, secretsHash);
  21. }
  22. }