@goldstack/template-s3 0.3.104 → 0.4.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.
@@ -1,3 +1,3 @@
1
- export * from './templateS3Bucket';
2
- export * from './types/S3Package';
1
+ export * from './templateS3Bucket';
2
+ export * from './types/S3Package';
3
3
  //# sourceMappingURL=templateS3.d.ts.map
@@ -1,19 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./templateS3Bucket"), exports);
18
- __exportStar(require("./types/S3Package"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./templateS3Bucket"), exports);
18
+ __exportStar(require("./types/S3Package"), exports);
19
19
  //# 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) => Promise<S3>;
3
- export declare const getBucketName: (goldstackConfig: any, packageSchema: any, deploymentName?: string) => Promise<string>;
1
+ import S3 from 'aws-sdk/clients/s3';
2
+ export declare const connect: (goldstackConfig: any, packageSchema: any, deploymentName?: string) => Promise<S3>;
3
+ export declare const getBucketName: (goldstackConfig: any, packageSchema: any, deploymentName?: string) => Promise<string>;
4
4
  //# sourceMappingURL=templateS3Bucket.d.ts.map
@@ -1,67 +1,67 @@
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
- /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
8
- const core_1 = require("aws-sdk/lib/core");
9
- const s3_1 = __importDefault(require("aws-sdk/clients/s3"));
10
- const utils_esbuild_1 = require("@goldstack/utils-esbuild");
11
- const assert_1 = __importDefault(require("assert"));
12
- const utils_package_config_embedded_1 = require("@goldstack/utils-package-config-embedded");
13
- const connect = async (goldstackConfig, packageSchema, deploymentName) => {
14
- const packageConfig = new utils_package_config_embedded_1.EmbeddedPackageConfig({
15
- goldstackJson: goldstackConfig,
16
- packageSchema,
17
- });
18
- if (!deploymentName) {
19
- (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.`);
20
- deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
21
- }
22
- if (deploymentName === 'local') {
23
- // only require this for local testing
24
- // eslint-disable-next-line @typescript-eslint/no-var-requires
25
- const AWSMock = require((0, utils_esbuild_1.excludeInBundle)('mock-aws-s3'));
26
- AWSMock.config.basePath = 'goldstackLocal/s3';
27
- const s3 = new AWSMock.S3({
28
- params: {},
29
- });
30
- return s3;
31
- }
32
- const deployment = packageConfig.getDeployment(deploymentName);
33
- let awsUser;
34
- if (process.env.AWS_ACCESS_KEY_ID) {
35
- awsUser = new core_1.EnvironmentCredentials('AWS');
36
- }
37
- else {
38
- // load this in lazy to enable omitting the dependency when bundling lambdas
39
- // eslint-disable-next-line @typescript-eslint/no-var-requires
40
- const infraAWSLib = require((0, utils_esbuild_1.excludeInBundle)('@goldstack/infra-aws'));
41
- awsUser = await infraAWSLib.getAWSUser(deployment.awsUser);
42
- }
43
- const s3 = new s3_1.default({
44
- apiVersion: '2006-03-01',
45
- credentials: awsUser,
46
- region: deployment.awsRegion,
47
- });
48
- return s3;
49
- };
50
- exports.connect = connect;
51
- const getBucketName = async (goldstackConfig, packageSchema, deploymentName) => {
52
- const packageConfig = new utils_package_config_embedded_1.EmbeddedPackageConfig({
53
- goldstackJson: goldstackConfig,
54
- packageSchema,
55
- });
56
- if (!deploymentName) {
57
- (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.`);
58
- deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
59
- }
60
- if (deploymentName === 'local') {
61
- return `local-${goldstackConfig.name}`;
62
- }
63
- const deployment = packageConfig.getDeployment(deploymentName);
64
- return deployment.configuration.bucketName;
65
- };
66
- 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
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
8
+ const core_1 = require("aws-sdk/lib/core");
9
+ const s3_1 = __importDefault(require("aws-sdk/clients/s3"));
10
+ const utils_esbuild_1 = require("@goldstack/utils-esbuild");
11
+ const assert_1 = __importDefault(require("assert"));
12
+ const utils_package_config_embedded_1 = require("@goldstack/utils-package-config-embedded");
13
+ const connect = async (goldstackConfig, packageSchema, deploymentName) => {
14
+ const packageConfig = new utils_package_config_embedded_1.EmbeddedPackageConfig({
15
+ goldstackJson: goldstackConfig,
16
+ packageSchema,
17
+ });
18
+ if (!deploymentName) {
19
+ (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.`);
20
+ deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
21
+ }
22
+ if (deploymentName === 'local') {
23
+ // only require this for local testing
24
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
25
+ const AWSMock = require((0, utils_esbuild_1.excludeInBundle)('mock-aws-s3'));
26
+ AWSMock.config.basePath = 'goldstackLocal/s3';
27
+ const s3 = new AWSMock.S3({
28
+ params: {},
29
+ });
30
+ return s3;
31
+ }
32
+ const deployment = packageConfig.getDeployment(deploymentName);
33
+ let awsUser;
34
+ if (process.env.AWS_ACCESS_KEY_ID) {
35
+ awsUser = new core_1.EnvironmentCredentials('AWS');
36
+ }
37
+ else {
38
+ // load this in lazy to enable omitting the dependency when bundling lambdas
39
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
40
+ const infraAWSLib = require((0, utils_esbuild_1.excludeInBundle)('@goldstack/infra-aws'));
41
+ awsUser = await infraAWSLib.getAWSUser(deployment.awsUser);
42
+ }
43
+ const s3 = new s3_1.default({
44
+ apiVersion: '2006-03-01',
45
+ credentials: awsUser,
46
+ region: deployment.awsRegion,
47
+ });
48
+ return s3;
49
+ };
50
+ exports.connect = connect;
51
+ const getBucketName = async (goldstackConfig, packageSchema, deploymentName) => {
52
+ const packageConfig = new utils_package_config_embedded_1.EmbeddedPackageConfig({
53
+ goldstackJson: goldstackConfig,
54
+ packageSchema,
55
+ });
56
+ if (!deploymentName) {
57
+ (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.`);
58
+ deploymentName = process.env.GOLDSTACK_DEPLOYMENT;
59
+ }
60
+ if (deploymentName === 'local') {
61
+ return `local-${goldstackConfig.name}`;
62
+ }
63
+ const deployment = packageConfig.getDeployment(deploymentName);
64
+ return deployment.configuration.bucketName;
65
+ };
66
+ exports.getBucketName = getBucketName;
67
67
  //# sourceMappingURL=templateS3Bucket.js.map
@@ -1,11 +1,11 @@
1
- import type { AWSDeployment } from '@goldstack/infra-aws';
2
- import type { TerraformDeployment } from '@goldstack/utils-terraform';
3
- import type { Deployment } from '@goldstack/infra';
4
- import type { 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 type { AWSDeployment } from '@goldstack/infra-aws';
2
+ import type { TerraformDeployment } from '@goldstack/utils-terraform';
3
+ import type { Deployment } from '@goldstack/infra';
4
+ import type { 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 type { 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 type { 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 type { Package } from '@goldstack/utils-package';
2
- import type { S3Configuration } from './S3PackageConfiguration';
3
- import type { 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 type { Package } from '@goldstack/utils-package';
2
+ import type { S3Configuration } from './S3PackageConfiguration';
3
+ import type { 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.104",
3
+ "version": "0.4.0",
4
4
  "description": "Building blocks for linking a package to an AWS S3 bucket.",
5
5
  "keywords": [
6
6
  "goldstack",
@@ -39,24 +39,24 @@
39
39
  "version:apply:force": "yarn version $@ && yarn version apply"
40
40
  },
41
41
  "dependencies": {
42
- "@goldstack/infra": "0.3.38",
43
- "@goldstack/infra-aws": "0.3.47",
44
- "@goldstack/utils-esbuild": "0.4.3",
45
- "@goldstack/utils-package": "0.3.41",
46
- "@goldstack/utils-package-config-embedded": "0.4.5",
47
- "@goldstack/utils-template": "0.3.37",
48
- "@goldstack/utils-terraform": "0.3.71",
42
+ "@goldstack/infra": "0.4.0",
43
+ "@goldstack/infra-aws": "0.4.0",
44
+ "@goldstack/utils-esbuild": "0.5.0",
45
+ "@goldstack/utils-package": "0.4.0",
46
+ "@goldstack/utils-package-config-embedded": "0.5.0",
47
+ "@goldstack/utils-template": "0.4.0",
48
+ "@goldstack/utils-terraform": "0.4.0",
49
49
  "aws-sdk": "2.1055.0",
50
50
  "mock-aws-s3": "^4.0.2",
51
51
  "source-map-support": "^0.5.21"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@goldstack/utils-docs-cli": "0.3.11",
55
- "@goldstack/utils-git": "0.1.36",
56
- "@goldstack/utils-package-config-generate": "0.2.17",
57
- "@types/jest": "^27.5.1",
55
+ "@goldstack/utils-git": "0.2.0",
56
+ "@goldstack/utils-package-config-generate": "0.3.0",
57
+ "@types/jest": "^28.1.8",
58
58
  "@types/mock-aws-s3": "^2.6.3",
59
- "@types/node": "^17.0.33",
59
+ "@types/node": "^18.7.13",
60
60
  "@types/yargs": "^17.0.10",
61
61
  "jest": "^28.1.0",
62
62
  "rimraf": "^3.0.2",