@ttoss/cloud-roles 0.8.18 → 0.8.19

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.
@@ -0,0 +1,38 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/index.ts
4
+ var IAM_PATH = "/custom-iam/";
5
+ var createRolesTemplate = ({
6
+ path = IAM_PATH,
7
+ resources
8
+ }) => {
9
+ Object.values(resources).forEach(resource => {
10
+ if (!resource.Properties.Path) {
11
+ resource.Properties.Path = path;
12
+ }
13
+ });
14
+ const outputs = Object.keys(resources).reduce((acc, key) => {
15
+ const newKey = key + "Arn";
16
+ acc[newKey] = {
17
+ Description: `Arn of the ${key} role.`,
18
+ Value: {
19
+ "Fn::GetAtt": [key, "Arn"]
20
+ },
21
+ Export: {
22
+ Name: {
23
+ "Fn::Join": [":", [{
24
+ Ref: "AWS::StackName"
25
+ }, newKey]]
26
+ }
27
+ }
28
+ };
29
+ return acc;
30
+ }, {});
31
+ return {
32
+ AWSTemplateFormatVersion: "2010-09-09",
33
+ Description: "Roles template. Created by @ttoss/cloud-roles.",
34
+ Resources: resources,
35
+ Outputs: outputs
36
+ };
37
+ };
38
+ export { IAM_PATH, createRolesTemplate };
@@ -0,0 +1,13 @@
1
+ import { IAMRoleResource } from '@ttoss/cloudformation';
2
+ export { CloudFormationTemplate, IAMRoleResource, Outputs } from '@ttoss/cloudformation';
3
+
4
+ declare const IAM_PATH = "/custom-iam/";
5
+
6
+ declare const createRolesTemplate: ({ path, resources, }: {
7
+ path?: string;
8
+ resources: {
9
+ [key: string]: IAMRoleResource;
10
+ };
11
+ }) => any;
12
+
13
+ export { IAM_PATH, createRolesTemplate };
@@ -0,0 +1,13 @@
1
+ import { IAMRoleResource } from '@ttoss/cloudformation';
2
+ export { CloudFormationTemplate, IAMRoleResource, Outputs } from '@ttoss/cloudformation';
3
+
4
+ declare const IAM_PATH = "/custom-iam/";
5
+
6
+ declare const createRolesTemplate: ({ path, resources, }: {
7
+ path?: string;
8
+ resources: {
9
+ [key: string]: IAMRoleResource;
10
+ };
11
+ }) => any;
12
+
13
+ export { IAM_PATH, createRolesTemplate };
package/dist/index.js ADDED
@@ -0,0 +1,72 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ "use strict";
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
24
+ value: true
25
+ }), mod);
26
+
27
+ // src/index.ts
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ IAM_PATH: () => IAM_PATH,
31
+ createRolesTemplate: () => createRolesTemplate
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+ var IAM_PATH = "/custom-iam/";
35
+ var createRolesTemplate = ({
36
+ path = IAM_PATH,
37
+ resources
38
+ }) => {
39
+ Object.values(resources).forEach(resource => {
40
+ if (!resource.Properties.Path) {
41
+ resource.Properties.Path = path;
42
+ }
43
+ });
44
+ const outputs = Object.keys(resources).reduce((acc, key) => {
45
+ const newKey = key + "Arn";
46
+ acc[newKey] = {
47
+ Description: `Arn of the ${key} role.`,
48
+ Value: {
49
+ "Fn::GetAtt": [key, "Arn"]
50
+ },
51
+ Export: {
52
+ Name: {
53
+ "Fn::Join": [":", [{
54
+ Ref: "AWS::StackName"
55
+ }, newKey]]
56
+ }
57
+ }
58
+ };
59
+ return acc;
60
+ }, {});
61
+ return {
62
+ AWSTemplateFormatVersion: "2010-09-09",
63
+ Description: "Roles template. Created by @ttoss/cloud-roles.",
64
+ Resources: resources,
65
+ Outputs: outputs
66
+ };
67
+ };
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ IAM_PATH,
71
+ createRolesTemplate
72
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/cloud-roles",
3
- "version": "0.8.18",
3
+ "version": "0.8.19",
4
4
  "description": "Create CloudFormation templates for roles with TypeScript.",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -23,14 +23,14 @@
23
23
  "src"
24
24
  ],
25
25
  "dependencies": {
26
- "@ttoss/cloudformation": "^0.10.9"
26
+ "@ttoss/cloudformation": "^0.10.10"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^29.5.13",
30
30
  "jest": "^29.7.0",
31
31
  "tsup": "^8.3.0",
32
- "@ttoss/test-utils": "^2.1.15",
33
- "@ttoss/config": "^1.33.0"
32
+ "@ttoss/test-utils": "^2.1.16",
33
+ "@ttoss/config": "^1.34.0"
34
34
  },
35
35
  "keywords": [],
36
36
  "publishConfig": {