@goldstack/template-s3 0.3.79 → 0.3.80

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.
@@ -1,4 +1,4 @@
1
- export * from './templateS3Bucket';
2
- export * from './types/S3Package';
3
- export declare const run: (args: string[]) => Promise<void>;
1
+ export * from './templateS3Bucket';
2
+ export * from './types/S3Package';
3
+ export declare const run: (args: string[]) => Promise<void>;
4
4
  //# sourceMappingURL=templateS3.d.ts.map
@@ -1,51 +1,51 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.run = void 0;
17
- const utils_package_1 = require("@goldstack/utils-package");
18
- const utils_cli_1 = require("@goldstack/utils-cli");
19
- const utils_terraform_1 = require("@goldstack/utils-terraform");
20
- const templateS3Deploy_1 = require("./templateS3Deploy");
21
- const utils_terraform_aws_1 = require("@goldstack/utils-terraform-aws");
22
- __exportStar(require("./templateS3Bucket"), exports);
23
- __exportStar(require("./types/S3Package"), exports);
24
- const utils_package_config_1 = require("@goldstack/utils-package-config");
25
- const yargs_1 = __importDefault(require("yargs"));
26
- const run = async (args) => {
27
- await (0, utils_cli_1.wrapCli)(async () => {
28
- const argv = (0, utils_package_1.buildCli)({
29
- yargs: yargs_1.default,
30
- deployCommands: (0, utils_package_1.buildDeployCommands)(),
31
- infraCommands: (0, utils_terraform_1.infraCommands)(),
32
- }).help().argv;
33
- const packageConfig = new utils_package_config_1.PackageConfig({
34
- packagePath: './',
35
- });
36
- const config = packageConfig.getConfig();
37
- const command = argv._[0];
38
- const [, , , ...opArgs] = args;
39
- if (command === 'infra') {
40
- await (0, utils_terraform_aws_1.terraformAwsCli)(opArgs);
41
- return;
42
- }
43
- if (command === 'deploy') {
44
- await (0, templateS3Deploy_1.deployCli)(config, ['deploy', ...opArgs]);
45
- return;
46
- }
47
- throw new Error('Unknown command: ' + command);
48
- });
49
- };
50
- exports.run = run;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.run = void 0;
17
+ const utils_package_1 = require("@goldstack/utils-package");
18
+ const utils_cli_1 = require("@goldstack/utils-cli");
19
+ const utils_terraform_1 = require("@goldstack/utils-terraform");
20
+ const templateS3Deploy_1 = require("./templateS3Deploy");
21
+ const utils_terraform_aws_1 = require("@goldstack/utils-terraform-aws");
22
+ __exportStar(require("./templateS3Bucket"), exports);
23
+ __exportStar(require("./types/S3Package"), exports);
24
+ const utils_package_config_1 = require("@goldstack/utils-package-config");
25
+ const yargs_1 = __importDefault(require("yargs"));
26
+ const run = async (args) => {
27
+ await (0, utils_cli_1.wrapCli)(async () => {
28
+ const argv = (0, utils_package_1.buildCli)({
29
+ yargs: yargs_1.default,
30
+ deployCommands: (0, utils_package_1.buildDeployCommands)(),
31
+ infraCommands: (0, utils_terraform_1.infraCommands)(),
32
+ }).help().argv;
33
+ const packageConfig = new utils_package_config_1.PackageConfig({
34
+ packagePath: './',
35
+ });
36
+ const config = packageConfig.getConfig();
37
+ const command = argv._[0];
38
+ const [, , , ...opArgs] = args;
39
+ if (command === 'infra') {
40
+ await (0, utils_terraform_aws_1.terraformAwsCli)(opArgs);
41
+ return;
42
+ }
43
+ if (command === 'deploy') {
44
+ await (0, templateS3Deploy_1.deployCli)(config, ['deploy', ...opArgs]);
45
+ return;
46
+ }
47
+ throw new Error('Unknown command: ' + command);
48
+ });
49
+ };
50
+ exports.run = run;
51
51
  //# sourceMappingURL=templateS3.js.map
@@ -1,4 +1,4 @@
1
- import S3 from 'aws-sdk/clients/s3';
2
- export declare const connect: (goldstackConfig: any, packageSchema: any, deploymentName?: string | undefined) => Promise<S3>;
3
- export declare const getBucketName: (goldstackConfig: any, packageSchema: any, deploymentName?: string | undefined) => Promise<string>;
1
+ import S3 from 'aws-sdk/clients/s3';
2
+ export declare const connect: (goldstackConfig: any, packageSchema: any, deploymentName?: string | undefined) => Promise<S3>;
3
+ export declare const getBucketName: (goldstackConfig: any, packageSchema: any, deploymentName?: string | undefined) => Promise<string>;
4
4
  //# sourceMappingURL=templateS3Bucket.d.ts.map
@@ -1,56 +1,56 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBucketName = exports.connect = void 0;
7
- const infra_aws_1 = require("@goldstack/infra-aws");
8
- const s3_1 = __importDefault(require("aws-sdk/clients/s3"));
9
- const mock_aws_s3_1 = __importDefault(require("mock-aws-s3"));
10
- const assert_1 = __importDefault(require("assert"));
11
- const utils_package_config_1 = require("@goldstack/utils-package-config");
12
- const connect = async (goldstackConfig, packageSchema, deploymentName) => {
13
- const packageConfig = new utils_package_config_1.PackageConfig({
14
- goldstackJson: goldstackConfig,
15
- packageSchema,
16
- });
17
- if (!deploymentName) {
18
- (0, assert_1.default)(process.env.GOLDSTACK_DEPLOYMENT, `Cannot connect to S3 bucket for package ${goldstackConfig.name}. Either specify a deploymentName or ensure environment variable GOLDSTACK_DEPLOYMENT is defined.`);
19
- deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
20
- }
21
- if (deploymentName === 'local') {
22
- mock_aws_s3_1.default.config.basePath = 'goldstackLocal/s3';
23
- const s3 = new mock_aws_s3_1.default.S3({
24
- params: {},
25
- });
26
- return s3;
27
- }
28
- const config = packageConfig.getConfigFromPackageConfig(goldstackConfig);
29
- const deployment = packageConfig.getDeployment(config, deploymentName);
30
- const awsUser = await (0, infra_aws_1.getAWSUser)(deployment.awsUser);
31
- const s3 = new s3_1.default({
32
- apiVersion: '2006-03-01',
33
- credentials: awsUser,
34
- region: deployment.awsRegion,
35
- });
36
- return s3;
37
- };
38
- exports.connect = connect;
39
- const getBucketName = async (goldstackConfig, packageSchema, deploymentName) => {
40
- const packageConfig = new utils_package_config_1.PackageConfig({
41
- goldstackJson: goldstackConfig,
42
- packageSchema,
43
- });
44
- if (!deploymentName) {
45
- (0, assert_1.default)(process.env.GOLDSTACK_DEPLOYMENT, `Cannot get S3 bucket name for package ${goldstackConfig.name}. Either specify a deploymentName or ensure environment variable GOLDSTACK_DEPLOYMENT is defined.`);
46
- deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
47
- }
48
- if (deploymentName === 'local') {
49
- return `local-${goldstackConfig.name}`;
50
- }
51
- const config = packageConfig.getConfigFromPackageConfig(goldstackConfig);
52
- const deployment = packageConfig.getDeployment(config, deploymentName);
53
- return deployment.configuration.bucketName;
54
- };
55
- exports.getBucketName = getBucketName;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getBucketName = exports.connect = void 0;
7
+ const infra_aws_1 = require("@goldstack/infra-aws");
8
+ const s3_1 = __importDefault(require("aws-sdk/clients/s3"));
9
+ const mock_aws_s3_1 = __importDefault(require("mock-aws-s3"));
10
+ const assert_1 = __importDefault(require("assert"));
11
+ const utils_package_config_1 = require("@goldstack/utils-package-config");
12
+ const connect = async (goldstackConfig, packageSchema, deploymentName) => {
13
+ const packageConfig = new utils_package_config_1.PackageConfig({
14
+ goldstackJson: goldstackConfig,
15
+ packageSchema,
16
+ });
17
+ if (!deploymentName) {
18
+ (0, assert_1.default)(process.env.GOLDSTACK_DEPLOYMENT, `Cannot connect to S3 bucket for package ${goldstackConfig.name}. Either specify a deploymentName or ensure environment variable GOLDSTACK_DEPLOYMENT is defined.`);
19
+ deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
20
+ }
21
+ if (deploymentName === 'local') {
22
+ mock_aws_s3_1.default.config.basePath = 'goldstackLocal/s3';
23
+ const s3 = new mock_aws_s3_1.default.S3({
24
+ params: {},
25
+ });
26
+ return s3;
27
+ }
28
+ const config = packageConfig.getConfigFromPackageConfig(goldstackConfig);
29
+ const deployment = packageConfig.getDeployment(config, deploymentName);
30
+ const awsUser = await (0, infra_aws_1.getAWSUser)(deployment.awsUser);
31
+ const s3 = new s3_1.default({
32
+ apiVersion: '2006-03-01',
33
+ credentials: awsUser,
34
+ region: deployment.awsRegion,
35
+ });
36
+ return s3;
37
+ };
38
+ exports.connect = connect;
39
+ const getBucketName = async (goldstackConfig, packageSchema, deploymentName) => {
40
+ const packageConfig = new utils_package_config_1.PackageConfig({
41
+ goldstackJson: goldstackConfig,
42
+ packageSchema,
43
+ });
44
+ if (!deploymentName) {
45
+ (0, assert_1.default)(process.env.GOLDSTACK_DEPLOYMENT, `Cannot get S3 bucket name for package ${goldstackConfig.name}. Either specify a deploymentName or ensure environment variable GOLDSTACK_DEPLOYMENT is defined.`);
46
+ deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
47
+ }
48
+ if (deploymentName === 'local') {
49
+ return `local-${goldstackConfig.name}`;
50
+ }
51
+ const config = packageConfig.getConfigFromPackageConfig(goldstackConfig);
52
+ const deployment = packageConfig.getDeployment(config, deploymentName);
53
+ return deployment.configuration.bucketName;
54
+ };
55
+ exports.getBucketName = getBucketName;
56
56
  //# sourceMappingURL=templateS3Bucket.js.map
@@ -1,3 +1,3 @@
1
- import { S3Configuration } from './types/S3Package';
2
- export declare const deployCli: (config: S3Configuration, args: string[]) => Promise<void>;
1
+ import { S3Configuration } from './types/S3Package';
2
+ export declare const deployCli: (config: S3Configuration, args: string[]) => Promise<void>;
3
3
  //# sourceMappingURL=templateS3Deploy.d.ts.map
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deployCli = void 0;
4
- const deployCli = async (config, args) => {
5
- throw new Error('Deploy not supported yet.');
6
- };
7
- exports.deployCli = deployCli;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployCli = void 0;
4
+ const deployCli = async (config, args) => {
5
+ throw new Error('Deploy not supported yet.');
6
+ };
7
+ exports.deployCli = deployCli;
8
8
  //# sourceMappingURL=templateS3Deploy.js.map
@@ -1,11 +1,11 @@
1
- import { AWSDeployment } from '@goldstack/infra-aws';
2
- import { TerraformDeployment } from '@goldstack/utils-terraform';
3
- import { Deployment } from '@goldstack/infra';
4
- import { S3DeploymentConfiguration } from './S3DeploymentConfiguration';
5
- export type { AWSDeployment, TerraformDeployment, Deployment, S3DeploymentConfiguration, };
6
- export interface ThisDeployment extends Deployment, AWSDeployment, TerraformDeployment {
7
- configuration: S3DeploymentConfiguration;
8
- }
9
- export type { ThisDeployment as S3Deployment };
10
- export default ThisDeployment;
1
+ import { AWSDeployment } from '@goldstack/infra-aws';
2
+ import { TerraformDeployment } from '@goldstack/utils-terraform';
3
+ import { Deployment } from '@goldstack/infra';
4
+ import { S3DeploymentConfiguration } from './S3DeploymentConfiguration';
5
+ export type { AWSDeployment, TerraformDeployment, Deployment, S3DeploymentConfiguration, };
6
+ export interface ThisDeployment extends Deployment, AWSDeployment, TerraformDeployment {
7
+ configuration: S3DeploymentConfiguration;
8
+ }
9
+ export type { ThisDeployment as S3Deployment };
10
+ export default ThisDeployment;
11
11
  //# sourceMappingURL=S3Deployment.d.ts.map
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=S3Deployment.js.map
@@ -1,14 +1,14 @@
1
- import { DeploymentConfiguration } from '@goldstack/infra';
2
- export type { DeploymentConfiguration };
3
- /**
4
- * The name of the bucket. No spaces, numbers or special characters other than '-' allowed.
5
- *
6
- * @title Bucket Name
7
- * @pattern ^[A-Za-z0-9-]*$
8
- */
9
- declare type BucketName = string;
10
- export interface ThisDeploymentConfiguration extends DeploymentConfiguration {
11
- bucketName: BucketName;
12
- }
13
- export type { ThisDeploymentConfiguration as S3DeploymentConfiguration };
1
+ import { DeploymentConfiguration } from '@goldstack/infra';
2
+ export type { DeploymentConfiguration };
3
+ /**
4
+ * The name of the bucket. No spaces, numbers or special characters other than '-' allowed.
5
+ *
6
+ * @title Bucket Name
7
+ * @pattern ^[A-Za-z0-9-]*$
8
+ */
9
+ declare type BucketName = string;
10
+ export interface ThisDeploymentConfiguration extends DeploymentConfiguration {
11
+ bucketName: BucketName;
12
+ }
13
+ export type { ThisDeploymentConfiguration as S3DeploymentConfiguration };
14
14
  //# sourceMappingURL=S3DeploymentConfiguration.d.ts.map
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=S3DeploymentConfiguration.js.map
@@ -1,22 +1,22 @@
1
- import { Package } from '@goldstack/utils-package';
2
- import { S3Configuration } from './S3PackageConfiguration';
3
- import { S3Deployment } from './S3Deployment';
4
- export type { S3Configuration, S3Deployment };
5
- /**
6
- * Places where the S3 bucket should be deployed to.
7
- *
8
- * @title Deployments
9
- */
10
- export declare type S3Deployments = S3Deployment[];
11
- /**
12
- * An S3 bucket.
13
- *
14
- * @title S3 Package
15
- */
16
- export interface ThisPackage extends Package {
17
- configuration: S3Configuration;
18
- deployments: S3Deployments;
19
- }
20
- export type { ThisPackage as S3Package };
21
- export default ThisPackage;
1
+ import { Package } from '@goldstack/utils-package';
2
+ import { S3Configuration } from './S3PackageConfiguration';
3
+ import { S3Deployment } from './S3Deployment';
4
+ export type { S3Configuration, S3Deployment };
5
+ /**
6
+ * Places where the S3 bucket should be deployed to.
7
+ *
8
+ * @title Deployments
9
+ */
10
+ export declare type S3Deployments = S3Deployment[];
11
+ /**
12
+ * An S3 bucket.
13
+ *
14
+ * @title S3 Package
15
+ */
16
+ export interface ThisPackage extends Package {
17
+ configuration: S3Configuration;
18
+ deployments: S3Deployments;
19
+ }
20
+ export type { ThisPackage as S3Package };
21
+ export default ThisPackage;
22
22
  //# sourceMappingURL=S3Package.d.ts.map
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=S3Package.js.map
@@ -1,14 +1,14 @@
1
- import { Configuration } from '@goldstack/utils-package';
2
- export type { Configuration };
3
- /**
4
- * S3 Configuration
5
- *
6
- * @title S3 Configuration
7
- *
8
- */
9
- export interface ThisPackageConfiguration extends Configuration {
10
- [propName: string]: any;
11
- }
12
- export type { ThisPackageConfiguration as S3Configuration };
13
- export default ThisPackageConfiguration;
1
+ import { Configuration } from '@goldstack/utils-package';
2
+ export type { Configuration };
3
+ /**
4
+ * S3 Configuration
5
+ *
6
+ * @title S3 Configuration
7
+ *
8
+ */
9
+ export interface ThisPackageConfiguration extends Configuration {
10
+ [propName: string]: any;
11
+ }
12
+ export type { ThisPackageConfiguration as S3Configuration };
13
+ export default ThisPackageConfiguration;
14
14
  //# sourceMappingURL=S3PackageConfiguration.d.ts.map
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=S3PackageConfiguration.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goldstack/template-s3",
3
- "version": "0.3.79",
3
+ "version": "0.3.80",
4
4
  "description": "Building blocks for linking a package to an AWS S3 bucket.",
5
5
  "keywords": [
6
6
  "goldstack",
@@ -54,8 +54,8 @@
54
54
  "@goldstack/utils-s3-deployment": "0.3.43",
55
55
  "@goldstack/utils-sh": "0.4.23",
56
56
  "@goldstack/utils-template": "0.3.25",
57
- "@goldstack/utils-terraform": "0.3.50",
58
- "@goldstack/utils-terraform-aws": "0.3.50",
57
+ "@goldstack/utils-terraform": "0.3.52",
58
+ "@goldstack/utils-terraform-aws": "0.3.51",
59
59
  "aws-sdk": "2.1001.0",
60
60
  "mock-aws-s3": "^4.0.2",
61
61
  "source-map-support": "^0.5.21",