dcl-ops-lib 8.3.3 → 9.1.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/acceptBastion.js CHANGED
@@ -1,23 +1,14 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.makeSecurityGroupAccessibleFromBastion = void 0;
13
4
  const aws = require("@pulumi/aws");
14
5
  const values_1 = require("./values");
15
6
  const withCache_1 = require("./withCache");
16
7
  const utils_1 = require("./utils");
17
- const bastionSecurityGroupId = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
18
- const config = yield (0, values_1.getEnvConfiguration)();
8
+ const bastionSecurityGroupId = (0, withCache_1.default)(async () => {
9
+ const config = await (0, values_1.getEnvConfiguration)();
19
10
  return config.bastionSecurityGroupId;
20
- }));
11
+ });
21
12
  function makeSecurityGroupAccessibleFromBastion(securityGroup, ruleName = "") {
22
13
  new aws.ec2.SecurityGroupRule((0, utils_1.withRuleName)("accesible-from-bastion-v2", ruleName), {
23
14
  securityGroupId: securityGroup.id,
package/acceptDb.js CHANGED
@@ -1,25 +1,16 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.acceptDbSecurityGroupId = exports.acceptDbSecurityGroup = void 0;
13
4
  const aws = require("@pulumi/aws");
14
5
  const values_1 = require("./values");
15
6
  const withCache_1 = require("./withCache");
16
- exports.acceptDbSecurityGroup = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
17
- const config = yield (0, values_1.getEnvConfiguration)();
7
+ exports.acceptDbSecurityGroup = (0, withCache_1.default)(async () => {
8
+ const config = await (0, values_1.getEnvConfiguration)();
18
9
  return aws.ec2.getSecurityGroup({ id: config.dbSecurity });
19
- }));
20
- exports.acceptDbSecurityGroupId = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
21
- const config = yield (0, values_1.getEnvConfiguration)();
10
+ });
11
+ exports.acceptDbSecurityGroupId = (0, withCache_1.default)(async () => {
12
+ const config = await (0, values_1.getEnvConfiguration)();
22
13
  return config.dbSecurity;
23
- }));
14
+ });
24
15
  exports.default = exports.acceptDbSecurityGroup;
25
16
  //# sourceMappingURL=acceptDb.js.map
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.makeSecurityGroupAccessibleByCloudflare = exports.makeSecurityGroupAccessTheInternetV2 = void 0;
13
4
  const aws = require("@pulumi/aws");
@@ -27,31 +18,29 @@ function makeSecurityGroupAccessTheInternetV2(securityGroup, ruleName = "") {
27
18
  }
28
19
  exports.makeSecurityGroupAccessTheInternetV2 = makeSecurityGroupAccessTheInternetV2;
29
20
  /** Enables ingress traffic from cloudflare CIDRs */
30
- function makeSecurityGroupAccessibleByCloudflare(securityGroup) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- const ips = yield cloudflare.getIpRanges({});
33
- for (let block of ips.ipv4CidrBlocks) {
34
- const hash = (0, utils_1.sha256hash)(block).substring(0, 6);
35
- new aws.ec2.SecurityGroupRule(`accept-cf-80-${hash}`, {
36
- protocol: "tcp",
37
- fromPort: 80,
38
- toPort: 80,
39
- cidrBlocks: [block],
40
- type: "ingress",
41
- securityGroupId: securityGroup.id,
42
- description: `pulumi-supra-${hash}`,
43
- }, { deleteBeforeReplace: true });
44
- new aws.ec2.SecurityGroupRule(`accept-cf-443-${hash}`, {
45
- protocol: "tcp",
46
- fromPort: 443,
47
- toPort: 443,
48
- cidrBlocks: [block],
49
- type: "ingress",
50
- securityGroupId: securityGroup.id,
51
- description: `pulumi-supra-${hash}`,
52
- }, { deleteBeforeReplace: true });
53
- }
54
- });
21
+ async function makeSecurityGroupAccessibleByCloudflare(securityGroup) {
22
+ const ips = await cloudflare.getIpRanges({});
23
+ for (let block of ips.ipv4CidrBlocks) {
24
+ const hash = (0, utils_1.sha256hash)(block).substring(0, 6);
25
+ new aws.ec2.SecurityGroupRule(`accept-cf-80-${hash}`, {
26
+ protocol: "tcp",
27
+ fromPort: 80,
28
+ toPort: 80,
29
+ cidrBlocks: [block],
30
+ type: "ingress",
31
+ securityGroupId: securityGroup.id,
32
+ description: `pulumi-supra-${hash}`,
33
+ }, { deleteBeforeReplace: true });
34
+ new aws.ec2.SecurityGroupRule(`accept-cf-443-${hash}`, {
35
+ protocol: "tcp",
36
+ fromPort: 443,
37
+ toPort: 443,
38
+ cidrBlocks: [block],
39
+ type: "ingress",
40
+ securityGroupId: securityGroup.id,
41
+ description: `pulumi-supra-${hash}`,
42
+ }, { deleteBeforeReplace: true });
43
+ }
55
44
  }
56
45
  exports.makeSecurityGroupAccessibleByCloudflare = makeSecurityGroupAccessibleByCloudflare;
57
46
  //# sourceMappingURL=accessTheInternet.js.map
package/alb.js CHANGED
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.getAlb = void 0;
13
4
  const aws = require("@pulumi/aws");
@@ -21,12 +12,12 @@ const cache = {
21
12
  dns: undefined,
22
13
  listener: null
23
14
  };
24
- exports.getAlb = (0, withCache_1.default)(() => __awaiter(void 0, void 0, void 0, function* () {
25
- const dns = yield supra_1.supra.getOutputValue("dns");
26
- const loadBalancer = yield supra_1.supra.requireOutputValue("albInstance");
27
- const elbValues = yield supra_1.supra.requireOutputValue("elbValues");
28
- const alb = yield aws.lb.getLoadBalancer({ arn: loadBalancer.arn });
29
- const listener = yield aws.lb.getListener({ arn: elbValues.listenerArn });
15
+ exports.getAlb = (0, withCache_1.default)(async () => {
16
+ const dns = await supra_1.supra.getOutputValue("dns");
17
+ const loadBalancer = await supra_1.supra.requireOutputValue("albInstance");
18
+ const elbValues = await supra_1.supra.requireOutputValue("elbValues");
19
+ const alb = await aws.lb.getLoadBalancer({ arn: loadBalancer.arn });
20
+ const listener = await aws.lb.getListener({ arn: elbValues.listenerArn });
30
21
  return { dns, alb, listener };
31
- }));
22
+ });
32
23
  //# sourceMappingURL=alb.js.map
package/buildStatic.js CHANGED
@@ -8,7 +8,6 @@ const cloudflare_1 = require("./cloudflare");
8
8
  const domain_1 = require("./domain");
9
9
  const getDomainAndSubdomain_1 = require("./getDomainAndSubdomain");
10
10
  function buildStatic(staticSite) {
11
- var _a;
12
11
  const protect = !staticSite.unprotect;
13
12
  // Load the Pulumi program configuration. These act as the "parameters" to the Pulumi program,
14
13
  // so that different Pulumi Stacks can be brought up using the same code.
@@ -28,7 +27,7 @@ function buildStatic(staticSite) {
28
27
  // requests for "foo/" to "foo/index.html".
29
28
  website: {
30
29
  indexDocument: "index.html",
31
- errorDocument: (_a = staticSite.defaultPath) !== null && _a !== void 0 ? _a : "404.html",
30
+ errorDocument: staticSite.defaultPath ?? "404.html",
32
31
  },
33
32
  forceDestroy: staticSite.destroy === true
34
33
  };
package/cloudflare.js CHANGED
@@ -1,26 +1,15 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.setRecord = exports.deployWorker = exports.getAccountId = exports.getZoneId = void 0;
13
4
  const pulumi = require("@pulumi/pulumi");
14
5
  const cloudflare = require("@pulumi/cloudflare");
15
6
  const domain_1 = require("./domain");
16
7
  const fs_1 = require("fs");
17
- function getZoneId() {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const res = yield cloudflare.getZones({ filter: { name: domain_1.publicDomain } });
20
- if (res.zones.length == 0)
21
- throw new Error(`Zone ${domain_1.publicDomain} not found`);
22
- return res.zones[0].id;
23
- });
8
+ async function getZoneId() {
9
+ const res = await cloudflare.getZones({ filter: { name: domain_1.publicDomain } });
10
+ if (res.zones.length == 0)
11
+ throw new Error(`Zone ${domain_1.publicDomain} not found`);
12
+ return res.zones[0].id;
24
13
  }
25
14
  exports.getZoneId = getZoneId;
26
15
  function getAccountId() {
@@ -32,50 +21,51 @@ function getAccountId() {
32
21
  }
33
22
  }
34
23
  exports.getAccountId = getAccountId;
35
- function deployWorker(workerName, config) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- // get file contents
38
- const content = (0, fs_1.readFileSync)(config.jsWorkerFileName).toString();
39
- // build array of global variables for the workers
40
- const plainTextBindings = [];
41
- Object.entries(config.env || {}).forEach(([name, text]) => {
42
- plainTextBindings.push({ name, text });
43
- });
44
- // create the worker
45
- const worker = new cloudflare.WorkerScript(`${workerName}-${domain_1.publicTLD}`, Object.assign({ name: `${workerName}-${domain_1.publicTLD}`, content,
46
- plainTextBindings, accountId: getAccountId() }, (config.overrides || {})));
47
- const ret = { [workerName + "-" + domain_1.publicTLD]: worker.id, worker };
48
- // create the routes
49
- let count = 0;
50
- for (let pattern of config.routes) {
51
- const contentRoute = new cloudflare.WorkerRoute(`${workerName}-route-${count}`, {
52
- pattern,
53
- scriptName: worker.name,
54
- zoneId: getZoneId(),
55
- }, { aliases: [pulumi.interpolate `${workerName}-route-${pattern}`] });
56
- count++;
57
- ret[workerName + "-" + domain_1.publicTLD + "-route"] = contentRoute.id;
58
- }
59
- return ret;
24
+ async function deployWorker(workerName, config) {
25
+ // get file contents
26
+ const content = (0, fs_1.readFileSync)(config.jsWorkerFileName).toString();
27
+ // build array of global variables for the workers
28
+ const plainTextBindings = [];
29
+ Object.entries(config.env || {}).forEach(([name, text]) => {
30
+ plainTextBindings.push({ name, text });
60
31
  });
32
+ // create the worker
33
+ const worker = new cloudflare.WorkerScript(`${workerName}-${domain_1.publicTLD}`, {
34
+ name: `${workerName}-${domain_1.publicTLD}`,
35
+ content,
36
+ plainTextBindings,
37
+ accountId: getAccountId(),
38
+ ...(config.overrides || {}),
39
+ });
40
+ const ret = { [workerName + "-" + domain_1.publicTLD]: worker.id, worker };
41
+ // create the routes
42
+ let count = 0;
43
+ for (let pattern of config.routes) {
44
+ const contentRoute = new cloudflare.WorkerRoute(`${workerName}-route-${count}`, {
45
+ pattern,
46
+ scriptName: worker.name,
47
+ zoneId: getZoneId(),
48
+ }, { aliases: [pulumi.interpolate `${workerName}-route-${pattern}`] });
49
+ count++;
50
+ ret[workerName + "-" + domain_1.publicTLD + "-route"] = contentRoute.id;
51
+ }
52
+ return ret;
61
53
  }
62
54
  exports.deployWorker = deployWorker;
63
- function setRecord(config) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- if (!config.proxied && config.ttl < 120) {
66
- throw new Error("Min TTL is 120");
67
- }
68
- // create the record
69
- const record = new cloudflare.Record(`${config.recordName}-${config.type}-${domain_1.publicTLD}`, {
70
- type: config.type,
71
- name: config.recordName,
72
- value: config.value,
73
- ttl: config.proxied ? 1 : config.ttl,
74
- zoneId: getZoneId(),
75
- proxied: config.proxied,
76
- }, { deleteBeforeReplace: true });
77
- return record;
78
- });
55
+ async function setRecord(config) {
56
+ if (!config.proxied && config.ttl < 120) {
57
+ throw new Error("Min TTL is 120");
58
+ }
59
+ // create the record
60
+ const record = new cloudflare.Record(`${config.recordName}-${config.type}-${domain_1.publicTLD}`, {
61
+ type: config.type,
62
+ name: config.recordName,
63
+ value: config.value,
64
+ ttl: config.proxied ? 1 : config.ttl,
65
+ zoneId: getZoneId(),
66
+ proxied: config.proxied,
67
+ }, { deleteBeforeReplace: true });
68
+ return record;
79
69
  }
80
70
  exports.setRecord = setRecord;
81
71
  //# sourceMappingURL=cloudflare.js.map
@@ -2,6 +2,7 @@ import * as aws from "@pulumi/aws";
2
2
  import * as pulumi from "@pulumi/pulumi";
3
3
  import { ExtraExposedServiceOptions } from "./exposePublicService";
4
4
  import { HealthCheck } from "@pulumi/aws/ecs";
5
+ import { Team } from "./fargateHelpers";
5
6
  export declare const getDefaultLogs: (serviceName: string, logGroup: aws.cloudwatch.LogGroup) => aws.ecs.LogConfiguration;
6
7
  export declare function getClusterInstance(cluster: string | aws.ecs.Cluster | undefined): Promise<pulumi.Output<string> | string>;
7
8
  export type ALBMapping = {
@@ -42,7 +43,7 @@ export type FargateTaskOptions = {
42
43
  taskRolePolicies?: Record<string, pulumi.Input<string> | aws.iam.Policy>;
43
44
  secrets?: aws.ecs.Secret[];
44
45
  ignoreServiceDiscovery?: boolean;
45
- team: "dapps" | "platform" | "data" | "marketing" | "infra";
46
+ team: Team;
46
47
  metrics?: {
47
48
  port?: number | string;
48
49
  path: "/metrics";
@@ -127,7 +128,7 @@ export type InternalServiceOptions = {
127
128
  forceNewDeployment?: boolean;
128
129
  dependsOn?: pulumi.Resource[];
129
130
  volumes?: pulumi.Input<aws.types.input.ecs.TaskDefinitionVolume[]>;
130
- team: string;
131
+ team: Team;
131
132
  targetGroups: aws.alb.TargetGroup[];
132
133
  runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform;
133
134
  appAutoscaling?: {