aws-iam-managed-policies 0.0.656 → 0.0.685

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/dist/index.js CHANGED
@@ -4,26 +4,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getPolicyDiffByVersions = exports.getPolicyDocumentByVersion = exports.getLatestPolicyDocument = exports.getPolicyByName = exports.getPolicyCount = exports.listPolicies = void 0;
7
- var deep_object_diff_1 = require("deep-object-diff");
8
- var managedPolicies_json_1 = __importDefault(require("./managedPolicies.json"));
9
- var sortObjectByPropertyNames = function (obj) { return Object.keys(obj).sort().reduce(function (objEntries, key) {
7
+ const deep_object_diff_1 = require("deep-object-diff");
8
+ const managedPolicies_json_1 = __importDefault(require("./managedPolicies.json"));
9
+ const managedPolicies = managedPolicies_json_1.default;
10
+ const sortObjectByPropertyNames = (obj) => Object.keys(obj).sort().reduce((objEntries, key) => {
10
11
  objEntries[key] = obj[key];
11
12
  return objEntries;
12
- }, {}); };
13
+ }, {});
13
14
  /**
14
15
  * Retrieve a list of all included IAM Managed Polcies.
15
16
  * @returns {Array} An array of IAM Managed Policy names.
16
17
  */
17
- var listPolicies = function () {
18
- return Object.keys(sortObjectByPropertyNames(managedPolicies_json_1.default));
18
+ const listPolicies = () => {
19
+ return Object.keys(sortObjectByPropertyNames(managedPolicies));
19
20
  };
20
21
  exports.listPolicies = listPolicies;
21
22
  /**
22
23
  * Get the number of included IAM Managed Polcies.
23
24
  * @returns {number} The count of IAM Managed Policies.
24
25
  */
25
- var getPolicyCount = function () {
26
- return Object.keys(managedPolicies_json_1.default).length;
26
+ const getPolicyCount = () => {
27
+ return Object.keys(managedPolicies).length;
27
28
  };
28
29
  exports.getPolicyCount = getPolicyCount;
29
30
  /**
@@ -32,13 +33,13 @@ exports.getPolicyCount = getPolicyCount;
32
33
  * @returns {object} The IAM Managed Policy if found.
33
34
  * @throws Will throw an error if not found by the name.
34
35
  */
35
- var getPolicyByName = function (policyName) {
36
- var policy = managedPolicies_json_1.default[policyName];
36
+ const getPolicyByName = (policyName) => {
37
+ const policy = managedPolicies[policyName];
37
38
  if (policy) {
38
39
  return policy;
39
40
  }
40
41
  else {
41
- throw new Error("IAM Managed Policy '".concat(policyName, "' wasn't found!"));
42
+ throw new Error(`IAM Managed Policy '${policyName}' wasn't found!`);
42
43
  }
43
44
  };
44
45
  exports.getPolicyByName = getPolicyByName;
@@ -48,14 +49,14 @@ exports.getPolicyByName = getPolicyByName;
48
49
  * @returns {object} The IAM Managed Policy document if found.
49
50
  * @throws Will throw an error if not found by the name.
50
51
  */
51
- var getLatestPolicyDocument = function (policyName) {
52
- var policy = managedPolicies_json_1.default[policyName];
52
+ const getLatestPolicyDocument = (policyName) => {
53
+ const policy = managedPolicies[policyName];
53
54
  if (policy) {
54
- var latestVersionId = policy.latestVersionId;
55
+ const latestVersionId = policy.latestVersionId;
55
56
  return policy.versions[latestVersionId].document;
56
57
  }
57
58
  else {
58
- throw new Error("IAM Managed Policy '".concat(policyName, "' wasn't found!"));
59
+ throw new Error(`IAM Managed Policy '${policyName}' wasn't found!`);
59
60
  }
60
61
  };
61
62
  exports.getLatestPolicyDocument = getLatestPolicyDocument;
@@ -66,13 +67,13 @@ exports.getLatestPolicyDocument = getLatestPolicyDocument;
66
67
  * @returns {object} The IAM Managed Policy document if found.
67
68
  * @throws Will throw an error if not found by the name.
68
69
  */
69
- var getPolicyDocumentByVersion = function (policyName, policyVersion) {
70
- var policy = managedPolicies_json_1.default[policyName];
71
- if (policy && policy.versions["v".concat(policyVersion)]) {
72
- return policy.versions["v".concat(policyVersion)].document;
70
+ const getPolicyDocumentByVersion = (policyName, policyVersion) => {
71
+ const policy = managedPolicies[policyName];
72
+ if (policy && policy.versions[`v${policyVersion}`]) {
73
+ return policy.versions[`v${policyVersion}`].document;
73
74
  }
74
75
  else {
75
- throw new Error("IAM Managed Policy '".concat(policyName, "' wasn't found in version '").concat(policyVersion, "'!"));
76
+ throw new Error(`IAM Managed Policy '${policyName}' wasn't found in version '${policyVersion}'!`);
76
77
  }
77
78
  };
78
79
  exports.getPolicyDocumentByVersion = getPolicyDocumentByVersion;
@@ -84,19 +85,19 @@ exports.getPolicyDocumentByVersion = getPolicyDocumentByVersion;
84
85
  * @returns {object} The diff of the IAM Managed Policy document versions if found.
85
86
  * @throws Will throw an error if not found by the name or the respective policy document versions.
86
87
  */
87
- var getPolicyDiffByVersions = function (policyName, oldPolicyVersion, newPolicyVersion) {
88
- var policy = managedPolicies_json_1.default[policyName];
88
+ const getPolicyDiffByVersions = (policyName, oldPolicyVersion, newPolicyVersion) => {
89
+ const policy = managedPolicies[policyName];
89
90
  if (policy) {
90
- if (!policy.versions["v".concat(oldPolicyVersion)]) {
91
- throw new Error("IAM Managed Policy '".concat(policyName, "' wasn't found in version '").concat(oldPolicyVersion, "'!"));
91
+ if (!policy.versions[`v${oldPolicyVersion}`]) {
92
+ throw new Error(`IAM Managed Policy '${policyName}' wasn't found in version '${oldPolicyVersion}'!`);
92
93
  }
93
- if (!policy.versions["v".concat(newPolicyVersion)]) {
94
- throw new Error("IAM Managed Policy '".concat(policyName, "' wasn't found in version '").concat(newPolicyVersion, "'!"));
94
+ if (!policy.versions[`v${newPolicyVersion}`]) {
95
+ throw new Error(`IAM Managed Policy '${policyName}' wasn't found in version '${newPolicyVersion}'!`);
95
96
  }
96
- return (0, deep_object_diff_1.detailedDiff)(policy.versions["v".concat(oldPolicyVersion)].document, policy.versions["v".concat(newPolicyVersion)].document);
97
+ return (0, deep_object_diff_1.detailedDiff)(policy.versions[`v${oldPolicyVersion}`].document, policy.versions[`v${newPolicyVersion}`].document);
97
98
  }
98
99
  else {
99
- throw new Error("IAM Managed Policy '".concat(policyName, "' wasn't found!"));
100
+ throw new Error(`IAM Managed Policy '${policyName}' wasn't found!`);
100
101
  }
101
102
  };
102
103
  exports.getPolicyDiffByVersions = getPolicyDiffByVersions;
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/managedPolicies.json
3
- size: 77426576 bytes
4
- sha256: e2afe7c7ded101654db177dbf560ff903bbae0402c9f39990591ccab634c64c0
3
+ size: 81019938 bytes
4
+ sha256: 0c87f88bccbd7f625f6c7454a401510d92302733dc9faa40c6dfc76d77d7373a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-iam-managed-policies",
3
- "version": "0.0.656",
3
+ "version": "0.0.685",
4
4
  "description": "Provides AWS IAM Managed Policies historical data as a convenient npm package that can be used in other OSS projects.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -8,8 +8,9 @@
8
8
  ".": "./dist/index.js"
9
9
  },
10
10
  "scripts": {
11
- "gather-managed-policies": "ts-node --transpile-only --log-error process/gatherManagedPolicies.ts",
12
- "backfill-managed-policies": "ts-node --transpile-only --log-error process/backfillManagedPoliciesHistory.ts",
11
+ "gather-managed-policies": "tsx process/gatherManagedPolicies.ts",
12
+ "backfill-managed-policies": "tsx process/backfillManagedPoliciesHistory.ts",
13
+ "typecheck": "tsc --project tsconfig.json",
13
14
  "build": "rm -rf dist/ && tsc --build src/",
14
15
  "generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose"
15
16
  },
@@ -33,14 +34,14 @@
33
34
  },
34
35
  "homepage": "https://github.com/tobilg/aws-iam-managed-policies#readme",
35
36
  "devDependencies": {
36
- "@types/node": "^20.4.9",
37
- "aws-sdk": "^2.1432.0",
38
- "jsdoc": "^4.0.2",
39
- "jsdoc-fresh": "^3.0.0",
37
+ "@types/node": "^22",
38
+ "aws-sdk": "^2.1693.0",
39
+ "jsdoc": "^4.0.5",
40
+ "jsdoc-fresh": "^6.0.0",
40
41
  "mkdirp": "^3.0.1",
41
- "p-limit": "3.1.0",
42
- "ts-node": "^10.9.1",
43
- "typescript": "^5.1.6"
42
+ "p-limit": "7.3.3",
43
+ "tsx": "^4.23.15",
44
+ "typescript": "^6.0.3"
44
45
  },
45
46
  "dependencies": {
46
47
  "deep-object-diff": "^1.1.9"