@cloud-copilot/iam-lens 0.1.12 → 0.1.14

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,54 @@
1
+ export type PermissionEffect = 'Allow' | 'Deny';
2
+ export type PermissionConditions = Record<string, Record<string, string[]>>;
3
+ /**
4
+ * An immutable representation of a single permission for a specific action.
5
+ *
6
+ * This will eventually have methods like "merge with another permission",
7
+ * "check if overlaps with another permission", "subtract a deny permission",
8
+ * etc and those will all return a new Permission instance.
9
+ */
10
+ export declare class Permission {
11
+ readonly effect: PermissionEffect;
12
+ readonly service: string;
13
+ readonly action: string;
14
+ readonly resource: string[] | undefined;
15
+ readonly notResource: string[] | undefined;
16
+ readonly conditions: Record<string, Record<string, string[]>> | undefined;
17
+ constructor(effect: PermissionEffect, service: string, action: string, resource: string[] | undefined, notResource: string[] | undefined, conditions: Record<string, Record<string, string[]>> | undefined);
18
+ /**
19
+ * Returns true if this Permission completely includes the other Permission.
20
+ * Only supports merging of "Allow" permissions (same effect, service, action).
21
+ */
22
+ includes(other: Permission): boolean;
23
+ /**
24
+ * Returns the union of this Permission with another.
25
+ * If one includes the other, return the including Permission.
26
+ * Otherwise, attempt to merge conditions and resource/notResource.
27
+ * If merge yields a single Permission, return it; else return both.
28
+ */
29
+ union(other: Permission): Permission[];
30
+ /**
31
+ * Returns the intersection of this Permission with another.
32
+ * Always returns exactly one Permission. If there is no overlap,
33
+ * returns undefined.
34
+ */
35
+ intersection(other: Permission): Permission | undefined;
36
+ /**
37
+ * Subtract a Deny permission from this Allow permission.
38
+ * Returns an array of resulting Allow permissions (may be empty if fully denied).
39
+ */
40
+ subtract(other: Permission): Permission[];
41
+ }
42
+ /**
43
+ * Returns a new PermissionConditions object with all operator and context keys lowercased.
44
+ */
45
+ export declare function normalizeConditionKeys(conds: PermissionConditions): PermissionConditions;
46
+ /**
47
+ * Invert a set of IAM condition clauses for Deny → allow inversion.
48
+ * Preserves ForAllValues:/ForAnyValue: prefixes and IfExists suffixes.
49
+ *
50
+ * @param conds the condition clauses to invert
51
+ * @return a new set of inverted conditions
52
+ */
53
+ export declare function invertConditions(conds: Record<string, Record<string, string[]>>): Record<string, Record<string, string[]>>;
54
+ //# sourceMappingURL=permission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../../src/canWhat/permission.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAA;AAE/C,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;AAU3E;;;;;;GAMG;AACH,qBAAa,UAAU;aAEH,MAAM,EAAE,gBAAgB;aACxB,OAAO,EAAE,MAAM;aACf,MAAM,EAAE,MAAM;aACd,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS;aAC9B,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS;aACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS;gBALhE,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,EAC9B,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,EACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS;IASlF;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAyH3C;;;;;OAKG;IACI,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE;IAiE7C;;;;OAIG;IACI,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS;IAkL9D;;;OAGG;I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