@cloud-copilot/iam-expand 0.1.10 → 0.1.11
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/cjs/expand_file.d.ts +3 -2
- package/dist/cjs/expand_file.d.ts.map +1 -1
- package/dist/cjs/expand_file.js +14 -15
- package/dist/cjs/expand_file.js.map +1 -1
- package/dist/esm/expand_file.d.ts +3 -2
- package/dist/esm/expand_file.d.ts.map +1 -1
- package/dist/esm/expand_file.js +14 -15
- package/dist/esm/expand_file.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ExpandIamActionsOptions } from "./expand.js";
|
|
2
2
|
/**
|
|
3
|
-
* Takes any JSON document and expands any Action
|
|
3
|
+
* Takes any JSON document and expands any Action or NotAction string or array of strings in the document.
|
|
4
|
+
* *MODIFIES THE DOCUMENT IN PLACE*
|
|
4
5
|
*
|
|
5
6
|
* @param options the options to use when expanding the actions
|
|
6
7
|
* @param document the JSON document to expand
|
|
7
8
|
* @param key the key of the current node in the document
|
|
8
|
-
* @returns the
|
|
9
|
+
* @returns the original JSON document with any actions expanded in place
|
|
9
10
|
*/
|
|
10
11
|
export declare function expandJsonDocument(options: Partial<ExpandIamActionsOptions>, document: any, key?: string): Promise<any>;
|
|
11
12
|
//# sourceMappingURL=expand_file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand_file.d.ts","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,uBAAuB,EAAE,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"expand_file.d.ts","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CA0B7H"}
|
package/dist/cjs/expand_file.js
CHANGED
|
@@ -3,36 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.expandJsonDocument = expandJsonDocument;
|
|
4
4
|
const expand_js_1 = require("./expand.js");
|
|
5
5
|
/**
|
|
6
|
-
* Takes any JSON document and expands any Action
|
|
6
|
+
* Takes any JSON document and expands any Action or NotAction string or array of strings in the document.
|
|
7
|
+
* *MODIFIES THE DOCUMENT IN PLACE*
|
|
7
8
|
*
|
|
8
9
|
* @param options the options to use when expanding the actions
|
|
9
10
|
* @param document the JSON document to expand
|
|
10
11
|
* @param key the key of the current node in the document
|
|
11
|
-
* @returns the
|
|
12
|
+
* @returns the original JSON document with any actions expanded in place
|
|
12
13
|
*/
|
|
13
14
|
async function expandJsonDocument(options, document, key) {
|
|
14
15
|
if (key === 'Action' || key === 'NotAction') {
|
|
15
16
|
if (typeof document === 'string') {
|
|
16
|
-
return
|
|
17
|
+
return (0, expand_js_1.expandIamActions)(document, options);
|
|
17
18
|
}
|
|
18
19
|
if (Array.isArray(document) && document.length > 0 && typeof document[0] === 'string') {
|
|
19
|
-
|
|
20
|
-
return value;
|
|
20
|
+
return (0, expand_js_1.expandIamActions)(document, options);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (Array.isArray(document)) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const results = [];
|
|
25
|
+
for (const item of document) {
|
|
26
|
+
results.push(await expandJsonDocument(options, item));
|
|
27
|
+
}
|
|
28
|
+
return results;
|
|
27
29
|
}
|
|
28
|
-
if (typeof document === 'object') {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
for (const key of keys) {
|
|
32
|
-
const value = document[key];
|
|
33
|
-
newObject[key] = await expandJsonDocument(options, value, key);
|
|
30
|
+
if (typeof document === 'object' && document !== null) {
|
|
31
|
+
for (const key of Object.keys(document)) {
|
|
32
|
+
document[key] = await expandJsonDocument(options, document[key], key);
|
|
34
33
|
}
|
|
35
|
-
return
|
|
34
|
+
return document;
|
|
36
35
|
}
|
|
37
36
|
return document;
|
|
38
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand_file.js","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"expand_file.js","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":";;AAWA,gDA0BC;AArCD,2CAAwE;AAExE;;;;;;;;GAQG;AACI,KAAK,UAAU,kBAAkB,CAAC,OAAyC,EAAE,QAAa,EAAE,GAAY;IAC7G,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;QAC5C,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,IAAA,4BAAgB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YACtF,OAAO,IAAA,4BAAgB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,MAAM,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ExpandIamActionsOptions } from "./expand.js";
|
|
2
2
|
/**
|
|
3
|
-
* Takes any JSON document and expands any Action
|
|
3
|
+
* Takes any JSON document and expands any Action or NotAction string or array of strings in the document.
|
|
4
|
+
* *MODIFIES THE DOCUMENT IN PLACE*
|
|
4
5
|
*
|
|
5
6
|
* @param options the options to use when expanding the actions
|
|
6
7
|
* @param document the JSON document to expand
|
|
7
8
|
* @param key the key of the current node in the document
|
|
8
|
-
* @returns the
|
|
9
|
+
* @returns the original JSON document with any actions expanded in place
|
|
9
10
|
*/
|
|
10
11
|
export declare function expandJsonDocument(options: Partial<ExpandIamActionsOptions>, document: any, key?: string): Promise<any>;
|
|
11
12
|
//# sourceMappingURL=expand_file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand_file.d.ts","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,uBAAuB,EAAE,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"expand_file.d.ts","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CA0B7H"}
|
package/dist/esm/expand_file.js
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import { expandIamActions } from "./expand.js";
|
|
2
2
|
/**
|
|
3
|
-
* Takes any JSON document and expands any Action
|
|
3
|
+
* Takes any JSON document and expands any Action or NotAction string or array of strings in the document.
|
|
4
|
+
* *MODIFIES THE DOCUMENT IN PLACE*
|
|
4
5
|
*
|
|
5
6
|
* @param options the options to use when expanding the actions
|
|
6
7
|
* @param document the JSON document to expand
|
|
7
8
|
* @param key the key of the current node in the document
|
|
8
|
-
* @returns the
|
|
9
|
+
* @returns the original JSON document with any actions expanded in place
|
|
9
10
|
*/
|
|
10
11
|
export async function expandJsonDocument(options, document, key) {
|
|
11
12
|
if (key === 'Action' || key === 'NotAction') {
|
|
12
13
|
if (typeof document === 'string') {
|
|
13
|
-
return
|
|
14
|
+
return expandIamActions(document, options);
|
|
14
15
|
}
|
|
15
16
|
if (Array.isArray(document) && document.length > 0 && typeof document[0] === 'string') {
|
|
16
|
-
|
|
17
|
-
return value;
|
|
17
|
+
return expandIamActions(document, options);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
if (Array.isArray(document)) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const results = [];
|
|
22
|
+
for (const item of document) {
|
|
23
|
+
results.push(await expandJsonDocument(options, item));
|
|
24
|
+
}
|
|
25
|
+
return results;
|
|
24
26
|
}
|
|
25
|
-
if (typeof document === 'object') {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
for (const key of keys) {
|
|
29
|
-
const value = document[key];
|
|
30
|
-
newObject[key] = await expandJsonDocument(options, value, key);
|
|
27
|
+
if (typeof document === 'object' && document !== null) {
|
|
28
|
+
for (const key of Object.keys(document)) {
|
|
29
|
+
document[key] = await expandJsonDocument(options, document[key], key);
|
|
31
30
|
}
|
|
32
|
-
return
|
|
31
|
+
return document;
|
|
33
32
|
}
|
|
34
33
|
return document;
|
|
35
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand_file.js","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA2B,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"expand_file.js","sourceRoot":"","sources":["../../src/expand_file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAyC,EAAE,QAAa,EAAE,GAAY;IAC7G,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;QAC5C,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YACtF,OAAO,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,MAAM,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-copilot/iam-expand",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Expand AWS IAM Actions with Wildcards",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"types": "dist/cjs/index.d.ts",
|
|
19
19
|
"bin": {
|
|
20
|
-
"iam-expand": "dist/
|
|
20
|
+
"iam-expand": "dist/esm/cli.js"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "npx tsc -p tsconfig.cjs.json && npx tsc -p tsconfig.esm.json && ./postbuild.sh",
|