@cloud-copilot/iam-convert 0.1.1 → 0.1.2

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/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # iam-convert: Convert JSON Policy Documents to Markdown
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/@cloud-copilot/iam-convert.svg?logo=nodedotjs)](https://www.npmjs.com/package/@cloud-copilot/iam-convert) [![License: AGPL v3](https://img.shields.io/github/license/cloud-copilot/cli)](LICENSE.txt)
4
+
5
+ CLI and Node Library to convert JSON IAM Policy Documents to other formats for Infrastructure as Code.
6
+
7
+ ## Available Formats
8
+
9
+ - Terraform - an aws_iam_policy_document data source
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ # Install the CLI
15
+ npm install -g @cloud-copilot/iam-convert
16
+
17
+ ## Install the Node Library
18
+ npm install @cloud-copilot/iam-convert
19
+ ```
20
+
21
+ ## CLI Usage
22
+
23
+ ```bash
24
+ # Convert a JSON policy document to terraform and send to stdout
25
+ iam-convert --file path/to/policy.json
26
+
27
+ # Download a policy and convert it to terraform
28
+ curl "https://government-secrets.s3.amazonaws.com/secret-policy.json" | iam-convert > secret-policy.tf
29
+
30
+ # View all options
31
+ iam-convert --help
32
+ ```
33
+
34
+ ## Typescript/Javascript Usage
35
+
36
+ ```typescript
37
+ import { convert } from '@cloud-copilot/iam-convert'
38
+ import { loadPolicy } from '@cloud-copilot/iam-policy'
39
+
40
+ const policy = {
41
+ Version: '2012-10-17',
42
+ Statement: [
43
+ {
44
+ Effect: 'Allow',
45
+ Action: 's3:GetObject',
46
+ Resource: 'arn:aws:s3:::my-bucket/*'
47
+ }
48
+ ]
49
+ }
50
+
51
+ const terraformDataSource = convert(policy, 'tf')
52
+
53
+ console.log(terraformDataSource)
54
+ ```
@@ -1,5 +1,5 @@
1
- import { Policy } from "@cloud-copilot/iam-policy";
2
- import { StringBuffer } from "../util/StringBuffer.js";
1
+ import { Policy } from '@cloud-copilot/iam-policy';
2
+ import { StringBuffer } from '../util/StringBuffer.js';
3
3
  export interface Converter {
4
4
  /**
5
5
  * Converts the given policy to a new format in the given StringBuffer
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../src/converters/converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CACrD"}
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../src/converters/converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,MAAM,WAAW,SAAS;IACxB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CACpD"}
@@ -1,5 +1,5 @@
1
- import { Policy } from "@cloud-copilot/iam-policy";
2
- import { StringBuffer } from "../util/StringBuffer.js";
1
+ import { Policy } from '@cloud-copilot/iam-policy';
2
+ import { StringBuffer } from '../util/StringBuffer.js';
3
3
  export interface Converter {
4
4
  /**
5
5
  * Converts the given policy to a new format in the given StringBuffer
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../src/converters/converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CACrD"}
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../src/converters/converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,MAAM,WAAW,SAAS;IACxB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CACpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-copilot/iam-convert",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Convert AWS IAM JSON policies to other formats",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,8 +42,15 @@
42
42
  "homepage": "https://github.com/cloud-copilot/iam-convert#readme",
43
43
  "devDependencies": {
44
44
  "@cloud-copilot/prettier-config": "^0.1.1",
45
+ "@semantic-release/changelog": "^6.0.3",
46
+ "@semantic-release/commit-analyzer": "^13.0.1",
47
+ "@semantic-release/git": "^10.0.1",
48
+ "@semantic-release/github": "^11.0.1",
49
+ "@semantic-release/npm": "^12.0.1",
50
+ "@semantic-release/release-notes-generator": "^14.0.3",
45
51
  "@types/node": "^22.5.0",
46
52
  "@vitest/coverage-v8": "^2.0.5",
53
+ "semantic-release": "^24.2.1",
47
54
  "typescript": "^5.5.4",
48
55
  "vitest": "^2.0.5"
49
56
  },
@@ -51,5 +58,60 @@
51
58
  "@cloud-copilot/cli": "^0.1.1",
52
59
  "@cloud-copilot/iam-policy": "^0.1.12"
53
60
  },
54
- "prettier": "@cloud-copilot/prettier-config"
61
+ "prettier": "@cloud-copilot/prettier-config",
62
+ "release": {
63
+ "branches": [
64
+ "main"
65
+ ],
66
+ "plugins": [
67
+ [
68
+ "@semantic-release/commit-analyzer",
69
+ {
70
+ "releaseRules": [
71
+ {
72
+ "type": "feat",
73
+ "release": "patch"
74
+ },
75
+ {
76
+ "type": "fix",
77
+ "release": "patch"
78
+ },
79
+ {
80
+ "breaking": true,
81
+ "release": "patch"
82
+ },
83
+ {
84
+ "type": "*",
85
+ "release": "patch"
86
+ }
87
+ ]
88
+ }
89
+ ],
90
+ "@semantic-release/release-notes-generator",
91
+ "@semantic-release/changelog",
92
+ [
93
+ "@semantic-release/npm",
94
+ {
95
+ "npmPublish": true
96
+ }
97
+ ],
98
+ [
99
+ "@semantic-release/git",
100
+ {
101
+ "assets": [
102
+ "package.json",
103
+ "package-lock.json",
104
+ "CHANGELOG.md"
105
+ ],
106
+ "message": "chore(release): ${nextRelease.version} [skip ci]"
107
+ }
108
+ ],
109
+ [
110
+ "@semantic-release/github",
111
+ {
112
+ "assets": []
113
+ }
114
+ ]
115
+ ]
116
+ }
55
117
  }