@cloud-copilot/iam-data 0.2.202409011 → 0.3.202409011

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.
Files changed (59) hide show
  1. package/README.md +6 -4
  2. package/dist/cjs/actions.d.ts +3 -3
  3. package/dist/cjs/actions.d.ts.map +1 -1
  4. package/dist/cjs/actions.js +6 -6
  5. package/dist/cjs/actions.js.map +1 -1
  6. package/dist/cjs/conditionKeys.d.ts +3 -3
  7. package/dist/cjs/conditionKeys.d.ts.map +1 -1
  8. package/dist/cjs/conditionKeys.js +6 -6
  9. package/dist/cjs/conditionKeys.js.map +1 -1
  10. package/dist/cjs/data.d.ts +4 -4
  11. package/dist/cjs/data.d.ts.map +1 -1
  12. package/dist/cjs/data.js +5 -5
  13. package/dist/cjs/data.js.map +1 -1
  14. package/dist/cjs/readRelativeFile.d.ts +1 -1
  15. package/dist/cjs/readRelativeFile.d.ts.map +1 -1
  16. package/dist/cjs/readRelativeFile.js +4 -3
  17. package/dist/cjs/readRelativeFile.js.map +1 -1
  18. package/dist/cjs/resourceTypes.d.ts +3 -3
  19. package/dist/cjs/resourceTypes.d.ts.map +1 -1
  20. package/dist/cjs/resourceTypes.js +6 -6
  21. package/dist/cjs/resourceTypes.js.map +1 -1
  22. package/dist/cjs/services.d.ts +3 -3
  23. package/dist/cjs/services.d.ts.map +1 -1
  24. package/dist/cjs/services.js +5 -5
  25. package/dist/cjs/services.js.map +1 -1
  26. package/dist/cjs/version.d.ts +7 -1
  27. package/dist/cjs/version.d.ts.map +1 -1
  28. package/dist/cjs/version.js +26 -8
  29. package/dist/cjs/version.js.map +1 -1
  30. package/dist/esm/actions.d.ts +3 -3
  31. package/dist/esm/actions.d.ts.map +1 -1
  32. package/dist/esm/actions.js +6 -6
  33. package/dist/esm/actions.js.map +1 -1
  34. package/dist/esm/conditionKeys.d.ts +3 -3
  35. package/dist/esm/conditionKeys.d.ts.map +1 -1
  36. package/dist/esm/conditionKeys.js +6 -6
  37. package/dist/esm/conditionKeys.js.map +1 -1
  38. package/dist/esm/data.d.ts +4 -4
  39. package/dist/esm/data.d.ts.map +1 -1
  40. package/dist/esm/data.js +5 -5
  41. package/dist/esm/data.js.map +1 -1
  42. package/dist/esm/readRelativeFile.d.ts +1 -1
  43. package/dist/esm/readRelativeFile.d.ts.map +1 -1
  44. package/dist/esm/readRelativeFile.js +11 -4
  45. package/dist/esm/readRelativeFile.js.map +1 -1
  46. package/dist/esm/readRelativeFileEsm.d.ts.map +1 -1
  47. package/dist/esm/resourceTypes.d.ts +3 -3
  48. package/dist/esm/resourceTypes.d.ts.map +1 -1
  49. package/dist/esm/resourceTypes.js +6 -6
  50. package/dist/esm/resourceTypes.js.map +1 -1
  51. package/dist/esm/services.d.ts +3 -3
  52. package/dist/esm/services.d.ts.map +1 -1
  53. package/dist/esm/services.js +5 -5
  54. package/dist/esm/services.js.map +1 -1
  55. package/dist/esm/version.d.ts +7 -1
  56. package/dist/esm/version.d.ts.map +1 -1
  57. package/dist/esm/version.js +25 -8
  58. package/dist/esm/version.js.map +1 -1
  59. package/package.json +4 -2
package/README.md CHANGED
@@ -15,11 +15,13 @@ npm install @cloud-copilot/iam-data
15
15
  import { iamServiceKeys, iamActionDetails, iamActionsForService, iamServiceName } from '@cloud-copilot/iam-data';
16
16
 
17
17
  // Iterate through all actions in all services
18
- for(const serviceKey of iamServiceKeys()) {
19
- console.log(`Getting Actions for ${iamServiceName(serviceKey)}`);
20
- const actions = iamActionsForService(serviceKey);
18
+ const serviceKeys = await iamServiceKeys()
19
+ for(const serviceKey of serviceKeys) {
20
+ const serviceName = await iamServiceName(serviceKey);
21
+ console.log(`Getting Actions for ${serviceName}`);
22
+ const actions = await iamActionsForService(serviceKey);
21
23
  for(const action of actions) {
22
- const actionDetails = iamActionDetails(serviceKey, action);
24
+ const actionDetails = await iamActionDetails(serviceKey, action);
23
25
  console.log(actionDetails);
24
26
  }
25
27
  }
@@ -18,7 +18,7 @@ interface Action {
18
18
  * @param serviceKey the service key to get actions for, is case insensitive
19
19
  * @returns the actions for the service
20
20
  */
21
- export declare function iamActionsForService(serviceKey: string): string[];
21
+ export declare function iamActionsForService(serviceKey: string): Promise<string[]>;
22
22
  /**
23
23
  * Check if an action exists
24
24
  *
@@ -26,7 +26,7 @@ export declare function iamActionsForService(serviceKey: string): string[];
26
26
  * @param actionKey the action key to check for, is case insensitive
27
27
  * @returns true if the action exists, false otherwise
28
28
  */
29
- export declare function iamActionExists(serviceKey: string, actionKey: string): boolean;
29
+ export declare function iamActionExists(serviceKey: string, actionKey: string): Promise<boolean>;
30
30
  /**
31
31
  * Get the details for an action
32
32
  *
@@ -35,6 +35,6 @@ export declare function iamActionExists(serviceKey: string, actionKey: string):
35
35
  * @throws error if the service or action does not exist
36
36
  * @returns the details for the action
37
37
  */
38
- export declare function iamActionDetails(serviceKey: string, actionKey: string): Action;
38
+ export declare function iamActionDetails(serviceKey: string, actionKey: string): Promise<Action>;
39
39
  export {};
40
40
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGjE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAG9E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAM9E"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGhF;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG7F;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM7F"}
@@ -10,8 +10,8 @@ const data_js_1 = require("./data.js");
10
10
  * @param serviceKey the service key to get actions for, is case insensitive
11
11
  * @returns the actions for the service
12
12
  */
13
- function iamActionsForService(serviceKey) {
14
- const data = (0, data_js_1.readActionData)(serviceKey.toLowerCase());
13
+ async function iamActionsForService(serviceKey) {
14
+ const data = await (0, data_js_1.readActionData)(serviceKey.toLowerCase());
15
15
  return Object.values(data).map(action => action.name);
16
16
  }
17
17
  /**
@@ -21,8 +21,8 @@ function iamActionsForService(serviceKey) {
21
21
  * @param actionKey the action key to check for, is case insensitive
22
22
  * @returns true if the action exists, false otherwise
23
23
  */
24
- function iamActionExists(serviceKey, actionKey) {
25
- const data = (0, data_js_1.readActionData)(serviceKey.toLowerCase());
24
+ async function iamActionExists(serviceKey, actionKey) {
25
+ const data = await (0, data_js_1.readActionData)(serviceKey.toLowerCase());
26
26
  return !!data[actionKey.toLowerCase()];
27
27
  }
28
28
  /**
@@ -33,8 +33,8 @@ function iamActionExists(serviceKey, actionKey) {
33
33
  * @throws error if the service or action does not exist
34
34
  * @returns the details for the action
35
35
  */
36
- function iamActionDetails(serviceKey, actionKey) {
37
- const data = (0, data_js_1.readActionData)(serviceKey.toLowerCase());
36
+ async function iamActionDetails(serviceKey, actionKey) {
37
+ const data = await (0, data_js_1.readActionData)(serviceKey.toLowerCase());
38
38
  if (!data[actionKey.toLowerCase()]) {
39
39
  throw new Error(`Action ${actionKey} does not exist for service ${serviceKey}`);
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":";;AAwBA,oDAGC;AASD,0CAGC;AAUD,4CAMC;AAvDD,uCAA0C;AAkB1C;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,UAAkB;IACrD,MAAM,IAAI,GAAG,IAAA,wBAAc,EAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7E,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AACvD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,UAAkB,EAAE,SAAiB;IACnE,MAAM,IAAI,GAAG,IAAA,wBAAc,EAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7E,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,SAAiB;IACpE,MAAM,IAAI,GAAG,IAAA,wBAAc,EAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7E,IAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,+BAA+B,UAAU,EAAE,CAAC,CAAA;IACjF,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACtC,CAAC"}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":";;AAwBA,oDAGC;AASD,0CAGC;AAUD,4CAMC;AAvDD,uCAA0C;AAkB1C;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CAAC,UAAkB;IAC3D,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACnF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AACvD,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,eAAe,CAAC,UAAkB,EAAE,SAAiB;IACzE,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACnF,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,gBAAgB,CAAC,UAAkB,EAAE,SAAiB;IAC1E,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACnF,IAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,+BAA+B,UAAU,EAAE,CAAC,CAAA;IACjF,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACtC,CAAC"}
@@ -9,7 +9,7 @@ export interface ConditionKey {
9
9
  * @param serviceKey the service key to read the condition keys for, is case insensitive
10
10
  * @returns the condition keys for the service
11
11
  */
12
- export declare function iamConditionKeysForService(serviceKey: string): string[];
12
+ export declare function iamConditionKeysForService(serviceKey: string): Promise<string[]>;
13
13
  /**
14
14
  * Check if a condition key exists
15
15
  *
@@ -17,7 +17,7 @@ export declare function iamConditionKeysForService(serviceKey: string): string[]
17
17
  * @param conditionKey the condition key to check for, is case insensitive
18
18
  * @returns true if the condition key exists, false otherwise
19
19
  */
20
- export declare function iamConditionKeyExists(serviceKey: string, conditionKey: string): boolean;
20
+ export declare function iamConditionKeyExists(serviceKey: string, conditionKey: string): Promise<boolean>;
21
21
  /**
22
22
  * Get the details for a condition key
23
23
  *
@@ -26,5 +26,5 @@ export declare function iamConditionKeyExists(serviceKey: string, conditionKey:
26
26
  * @throws error if the service or condition key does not exist
27
27
  * @returns the details for the condition key
28
28
  */
29
- export declare function iamConditionKeyDetails(serviceKey: string, conditionKey: string): ConditionKey;
29
+ export declare function iamConditionKeyDetails(serviceKey: string, conditionKey: string): Promise<ConditionKey>;
30
30
  //# sourceMappingURL=conditionKeys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditionKeys.d.ts","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGvE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAGvF;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,CAM7F"}
1
+ {"version":3,"file":"conditionKeys.d.ts","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGtF;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGtG;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAM5G"}
@@ -10,8 +10,8 @@ const data_js_1 = require("./data.js");
10
10
  * @param serviceKey the service key to read the condition keys for, is case insensitive
11
11
  * @returns the condition keys for the service
12
12
  */
13
- function iamConditionKeysForService(serviceKey) {
14
- const data = (0, data_js_1.readConditionKeys)(serviceKey.toLowerCase());
13
+ async function iamConditionKeysForService(serviceKey) {
14
+ const data = await (0, data_js_1.readConditionKeys)(serviceKey.toLowerCase());
15
15
  return Object.values(data).map(conditionKey => conditionKey.key);
16
16
  }
17
17
  /**
@@ -21,8 +21,8 @@ function iamConditionKeysForService(serviceKey) {
21
21
  * @param conditionKey the condition key to check for, is case insensitive
22
22
  * @returns true if the condition key exists, false otherwise
23
23
  */
24
- function iamConditionKeyExists(serviceKey, conditionKey) {
25
- const data = (0, data_js_1.readConditionKeys)(serviceKey.toLowerCase());
24
+ async function iamConditionKeyExists(serviceKey, conditionKey) {
25
+ const data = await (0, data_js_1.readConditionKeys)(serviceKey.toLowerCase());
26
26
  return !!data[conditionKey.toLowerCase()];
27
27
  }
28
28
  /**
@@ -33,8 +33,8 @@ function iamConditionKeyExists(serviceKey, conditionKey) {
33
33
  * @throws error if the service or condition key does not exist
34
34
  * @returns the details for the condition key
35
35
  */
36
- function iamConditionKeyDetails(serviceKey, conditionKey) {
37
- const data = (0, data_js_1.readConditionKeys)(serviceKey.toLowerCase());
36
+ async function iamConditionKeyDetails(serviceKey, conditionKey) {
37
+ const data = await (0, data_js_1.readConditionKeys)(serviceKey.toLowerCase());
38
38
  if (!data[conditionKey.toLowerCase()]) {
39
39
  throw new Error(`Condition key ${conditionKey} does not exist for service ${serviceKey}`);
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"conditionKeys.js","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":";;AAcA,gEAGC;AASD,sDAGC;AAUD,wDAMC;AA7CD,uCAA6C;AAQ7C;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,UAAkB;IAC3D,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACtF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,UAAkB,EAAE,YAAoB;IAC5E,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACtF,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,UAAkB,EAAE,YAAoB;IAC7E,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACtF,IAAG,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,+BAA+B,UAAU,EAAE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AACzC,CAAC"}
1
+ {"version":3,"file":"conditionKeys.js","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":";;AAcA,gEAGC;AASD,sDAGC;AAUD,wDAMC;AA7CD,uCAA6C;AAQ7C;;;;;GAKG;AACI,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5F,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,qBAAqB,CAAC,UAAkB,EAAE,YAAoB;IAClF,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5F,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,sBAAsB,CAAC,UAAkB,EAAE,YAAoB;IACnF,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5F,IAAG,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,+BAA+B,UAAU,EAAE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AACzC,CAAC"}
@@ -1,23 +1,23 @@
1
- export declare function readDataFile<T>(...pathParts: string[]): T;
1
+ export declare function readDataFile<T>(...pathParts: string[]): Promise<T>;
2
2
  /**
3
3
  * Read the action data for a service
4
4
  *
5
5
  * @param serviceKey the service key to read the action data for
6
6
  * @returns the action data for the service
7
7
  */
8
- export declare function readActionData<T>(serviceKey: string): T;
8
+ export declare function readActionData<T>(serviceKey: string): Promise<T>;
9
9
  /**
10
10
  * Read the condition key data for a service
11
11
  *
12
12
  * @param serviceKey the service key to read the condition key data for
13
13
  * @returns the condition key data
14
14
  */
15
- export declare function readConditionKeys<T>(serviceKey: string): T;
15
+ export declare function readConditionKeys<T>(serviceKey: string): Promise<T>;
16
16
  /**
17
17
  * Read the resource type data for a service
18
18
  *
19
19
  * @param serviceKey the service key to read the resource type data for
20
20
  * @returns the resource type data
21
21
  */
22
- export declare function readResourceTypes<T>(serviceKey: string): T;
22
+ export declare function readResourceTypes<T>(serviceKey: string): Promise<T>;
23
23
  //# sourceMappingURL=data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,CAQzD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAE1D"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAKA,wBAAsB,YAAY,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAQxE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEtE;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzE;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzE"}
package/dist/cjs/data.js CHANGED
@@ -7,12 +7,12 @@ exports.readResourceTypes = readResourceTypes;
7
7
  const path_1 = require("path");
8
8
  const readRelativeFile_js_1 = require("./readRelativeFile.js");
9
9
  const dataCache = {};
10
- function readDataFile(...pathParts) {
10
+ async function readDataFile(...pathParts) {
11
11
  pathParts.unshift('data');
12
12
  const file = (0, path_1.join)(...pathParts);
13
13
  if (!dataCache[file]) {
14
14
  const data = (0, readRelativeFile_js_1.readRelativeFile)(pathParts);
15
- dataCache[file] = JSON.parse(data);
15
+ dataCache[file] = data;
16
16
  }
17
17
  return dataCache[file];
18
18
  }
@@ -22,7 +22,7 @@ function readDataFile(...pathParts) {
22
22
  * @param serviceKey the service key to read the action data for
23
23
  * @returns the action data for the service
24
24
  */
25
- function readActionData(serviceKey) {
25
+ async function readActionData(serviceKey) {
26
26
  return readDataFile('actions', `${serviceKey}.json`);
27
27
  }
28
28
  /**
@@ -31,7 +31,7 @@ function readActionData(serviceKey) {
31
31
  * @param serviceKey the service key to read the condition key data for
32
32
  * @returns the condition key data
33
33
  */
34
- function readConditionKeys(serviceKey) {
34
+ async function readConditionKeys(serviceKey) {
35
35
  return readDataFile('conditionKeys', `${serviceKey}.json`);
36
36
  }
37
37
  /**
@@ -40,7 +40,7 @@ function readConditionKeys(serviceKey) {
40
40
  * @param serviceKey the service key to read the resource type data for
41
41
  * @returns the resource type data
42
42
  */
43
- function readResourceTypes(serviceKey) {
43
+ async function readResourceTypes(serviceKey) {
44
44
  return readDataFile('resourceTypes', `${serviceKey}.json`);
45
45
  }
46
46
  //# sourceMappingURL=data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":";;AAKA,oCAQC;AAQD,wCAEC;AAQD,8CAEC;AAQD,8CAEC;AA3CD,+BAA4B;AAC5B,+DAAyD;AAEzD,MAAM,SAAS,GAAwB,EAAE,CAAC;AAE1C,SAAgB,YAAY,CAAI,GAAG,SAAmB;IACpD,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,GAAG,SAAS,CAAC,CAAC;IAChC,IAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,GAAG,IAAA,sCAAgB,EAAC,SAAS,CAAC,CAAA;QACxC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAI,UAAkB;IAClD,OAAO,YAAY,CAAI,SAAS,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAI,UAAkB;IACrD,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAI,UAAkB;IACrD,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC"}
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":";;AAKA,oCAQC;AAQD,wCAEC;AAQD,8CAEC;AAQD,8CAEC;AA3CD,+BAA4B;AAC5B,+DAAyD;AAEzD,MAAM,SAAS,GAAwB,EAAE,CAAC;AAEnC,KAAK,UAAU,YAAY,CAAI,GAAG,SAAmB;IAC1D,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,GAAG,SAAS,CAAC,CAAC;IAChC,IAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,GAAG,IAAA,sCAAgB,EAAC,SAAS,CAAC,CAAA;QACxC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACxB,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAI,UAAkB;IACxD,OAAO,YAAY,CAAI,SAAS,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAI,UAAkB;IAC3D,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAI,UAAkB;IAC3D,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC"}
@@ -4,5 +4,5 @@
4
4
  * @param file the path to the file to retrieve data for.
5
5
  * @returns the data from the file
6
6
  */
7
- export declare function readRelativeFile(pathParts: string[]): string;
7
+ export declare function readRelativeFile<T>(pathParts: string[]): Promise<T>;
8
8
  //# sourceMappingURL=readRelativeFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"readRelativeFile.d.ts","sourceRoot":"","sources":["../../src/readRelativeFile.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAE5D"}
1
+ {"version":3,"file":"readRelativeFile.d.ts","sourceRoot":"","sources":["../../src/readRelativeFile.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAGzE"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readRelativeFile = readRelativeFile;
4
- const fs_1 = require("fs");
4
+ const promises_1 = require("fs/promises");
5
5
  const path_1 = require("path");
6
6
  let root = (0, path_1.join)(__dirname, '..', '..');
7
7
  if (__dirname.endsWith('src')) {
@@ -13,7 +13,8 @@ if (__dirname.endsWith('src')) {
13
13
  * @param file the path to the file to retrieve data for.
14
14
  * @returns the data from the file
15
15
  */
16
- function readRelativeFile(pathParts) {
17
- return (0, fs_1.readFileSync)((0, path_1.join)(root, ...pathParts), 'utf8');
16
+ async function readRelativeFile(pathParts) {
17
+ const contents = await (0, promises_1.readFile)((0, path_1.join)(root, ...pathParts), 'utf8');
18
+ return JSON.parse(contents);
18
19
  }
19
20
  //# sourceMappingURL=readRelativeFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readRelativeFile.js","sourceRoot":"","sources":["../../src/readRelativeFile.ts"],"names":[],"mappings":";;AAcA,4CAEC;AAhBD,2BAAkC;AAClC,+BAA4B;AAE5B,IAAI,IAAI,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC,IAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAC7B,IAAI,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,SAAmB;IAClD,OAAO,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,IAAI,EAAE,GAAG,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"readRelativeFile.js","sourceRoot":"","sources":["../../src/readRelativeFile.ts"],"names":[],"mappings":";;AAcA,4CAGC;AAjBD,0CAAuC;AACvC,+BAA4B;AAE5B,IAAI,IAAI,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC,IAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAC7B,IAAI,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CAAI,SAAmB;IAC3D,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,IAAI,EAAE,GAAG,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAClE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -8,7 +8,7 @@ export interface ResourceType {
8
8
  * @param serviceKey the service key to get the resource types for, is case insensitive
9
9
  * @returns the resource types for the service
10
10
  */
11
- export declare function iamResourceTypesForService(serviceKey: string): string[];
11
+ export declare function iamResourceTypesForService(serviceKey: string): Promise<string[]>;
12
12
  /**
13
13
  * Check if a resource type exists for a service and resource type key
14
14
  *
@@ -16,7 +16,7 @@ export declare function iamResourceTypesForService(serviceKey: string): string[]
16
16
  * @param resourceTypeKey the resource type key to check for, is case insensitive
17
17
  * @returns true if the resource type exists, false otherwise
18
18
  */
19
- export declare function iamResourceTypeExists(serviceKey: string, resourceTypeKey: string): boolean;
19
+ export declare function iamResourceTypeExists(serviceKey: string, resourceTypeKey: string): Promise<boolean>;
20
20
  /**
21
21
  * Get the resource type for a service and resource type key
22
22
  *
@@ -25,5 +25,5 @@ export declare function iamResourceTypeExists(serviceKey: string, resourceTypeKe
25
25
  * @throws an error if the resource type does not exist
26
26
  * @returns the resource type
27
27
  */
28
- export declare function iamResourceTypeDetails(serviceKey: string, resourceTypeKey: string): ResourceType;
28
+ export declare function iamResourceTypeDetails(serviceKey: string, resourceTypeKey: string): Promise<ResourceType>;
29
29
  //# sourceMappingURL=resourceTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceTypes.d.ts","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGvE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAG1F;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,YAAY,CAMhG"}
1
+ {"version":3,"file":"resourceTypes.d.ts","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGtF;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGzG;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAM/G"}
@@ -9,8 +9,8 @@ const data_js_1 = require("./data.js");
9
9
  * @param serviceKey the service key to get the resource types for, is case insensitive
10
10
  * @returns the resource types for the service
11
11
  */
12
- function iamResourceTypesForService(serviceKey) {
13
- const data = (0, data_js_1.readResourceTypes)(serviceKey.toLowerCase());
12
+ async function iamResourceTypesForService(serviceKey) {
13
+ const data = await (0, data_js_1.readResourceTypes)(serviceKey.toLowerCase());
14
14
  return Object.values(data).map(resourceType => resourceType.key);
15
15
  }
16
16
  /**
@@ -20,8 +20,8 @@ function iamResourceTypesForService(serviceKey) {
20
20
  * @param resourceTypeKey the resource type key to check for, is case insensitive
21
21
  * @returns true if the resource type exists, false otherwise
22
22
  */
23
- function iamResourceTypeExists(serviceKey, resourceTypeKey) {
24
- const data = (0, data_js_1.readResourceTypes)(serviceKey.toLowerCase());
23
+ async function iamResourceTypeExists(serviceKey, resourceTypeKey) {
24
+ const data = await (0, data_js_1.readResourceTypes)(serviceKey.toLowerCase());
25
25
  return !!data[resourceTypeKey.toLowerCase()];
26
26
  }
27
27
  /**
@@ -32,8 +32,8 @@ function iamResourceTypeExists(serviceKey, resourceTypeKey) {
32
32
  * @throws an error if the resource type does not exist
33
33
  * @returns the resource type
34
34
  */
35
- function iamResourceTypeDetails(serviceKey, resourceTypeKey) {
36
- const data = (0, data_js_1.readResourceTypes)(serviceKey.toLowerCase());
35
+ async function iamResourceTypeDetails(serviceKey, resourceTypeKey) {
36
+ const data = await (0, data_js_1.readResourceTypes)(serviceKey.toLowerCase());
37
37
  if (!data[resourceTypeKey.toLowerCase()]) {
38
38
  throw new Error(`Resource type ${resourceTypeKey} does not exist for service ${serviceKey}`);
39
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resourceTypes.js","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":";;AAaA,gEAGC;AASD,sDAGC;AAUD,wDAMC;AA5CD,uCAA8C;AAQ9C;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,UAAkB;IAC3D,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACvF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,UAAkB,EAAE,eAAuB;IAC/E,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACvF,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,UAAkB,EAAE,eAAuB;IAChF,MAAM,IAAI,GAAG,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACvF,IAAG,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,iBAAiB,eAAe,+BAA+B,UAAU,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"file":"resourceTypes.js","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":";;AAaA,gEAGC;AASD,sDAGC;AAUD,wDAMC;AA5CD,uCAA8C;AAQ9C;;;;GAIG;AACI,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,qBAAqB,CAAC,UAAkB,EAAE,eAAuB;IACrF,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,sBAAsB,CAAC,UAAkB,EAAE,eAAuB;IACtF,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAiB,EAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,IAAG,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,iBAAiB,eAAe,+BAA+B,UAAU,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC7C,CAAC"}
@@ -3,14 +3,14 @@
3
3
  *
4
4
  * @returns an array of all service keys
5
5
  */
6
- export declare function iamServiceKeys(): string[];
6
+ export declare function iamServiceKeys(): Promise<string[]>;
7
7
  /**
8
8
  * Check if a service exists
9
9
  *
10
10
  * @param serviceKey the service key to check, is case insensitive
11
11
  * @returns true if the service exists, false otherwise
12
12
  */
13
- export declare function iamServiceExists(serviceKey: string): boolean;
13
+ export declare function iamServiceExists(serviceKey: string): Promise<boolean>;
14
14
  /**
15
15
  * Get the name of a service
16
16
  *
@@ -18,5 +18,5 @@ export declare function iamServiceExists(serviceKey: string): boolean;
18
18
  * @throws error if the service does not exist
19
19
  * @returns the name of the service
20
20
  */
21
- export declare function iamServiceName(serviceKey: string): string;
21
+ export declare function iamServiceName(serviceKey: string): Promise<string>;
22
22
  //# sourceMappingURL=services.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAG5D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMzD"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAExD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG3E;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxE"}
@@ -9,7 +9,7 @@ const data_js_1 = require("./data.js");
9
9
  *
10
10
  * @returns an array of all service keys
11
11
  */
12
- function iamServiceKeys() {
12
+ async function iamServiceKeys() {
13
13
  return (0, data_js_1.readDataFile)('services.json');
14
14
  }
15
15
  /**
@@ -18,8 +18,8 @@ function iamServiceKeys() {
18
18
  * @param serviceKey the service key to check, is case insensitive
19
19
  * @returns true if the service exists, false otherwise
20
20
  */
21
- function iamServiceExists(serviceKey) {
22
- const data = (0, data_js_1.readDataFile)('serviceNames.json');
21
+ async function iamServiceExists(serviceKey) {
22
+ const data = await (0, data_js_1.readDataFile)('serviceNames.json');
23
23
  return !!data[serviceKey.toLowerCase()];
24
24
  }
25
25
  /**
@@ -29,8 +29,8 @@ function iamServiceExists(serviceKey) {
29
29
  * @throws error if the service does not exist
30
30
  * @returns the name of the service
31
31
  */
32
- function iamServiceName(serviceKey) {
33
- const data = (0, data_js_1.readDataFile)('serviceNames.json');
32
+ async function iamServiceName(serviceKey) {
33
+ const data = await (0, data_js_1.readDataFile)('serviceNames.json');
34
34
  if (!data[serviceKey.toLowerCase()]) {
35
35
  throw new Error(`Service ${serviceKey} does not exist`);
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":";;AAOA,wCAEC;AAQD,4CAGC;AASD,wCAMC;AAnCD,uCAAyC;AAEzC;;;;GAIG;AACH,SAAgB,cAAc;IAC5B,OAAO,IAAA,sBAAY,EAAW,eAAe,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,UAAkB;IACjD,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAyB,mBAAmB,CAAC,CAAA;IACtE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,UAAkB;IAC/C,MAAM,IAAI,GAAG,IAAA,sBAAY,EAAyB,mBAAmB,CAAC,CAAA;IACtE,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,iBAAiB,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;AACvC,CAAC"}
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":";;AAOA,wCAEC;AAQD,4CAGC;AASD,wCAMC;AAnCD,uCAAyC;AAEzC;;;;GAIG;AACI,KAAK,UAAU,cAAc;IAClC,OAAO,IAAA,sBAAY,EAAW,eAAe,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IACvD,MAAM,IAAI,GAAG,MAAM,IAAA,sBAAY,EAAyB,mBAAmB,CAAC,CAAA;IAC5E,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,cAAc,CAAC,UAAkB;IACrD,MAAM,IAAI,GAAG,MAAM,IAAA,sBAAY,EAAyB,mBAAmB,CAAC,CAAA;IAC5E,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,iBAAiB,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;AACvC,CAAC"}
@@ -1,5 +1,11 @@
1
1
  /**
2
2
  * Get the version of the package
3
3
  */
4
- export declare function iamDataVersion(): string;
4
+ export declare function iamDataVersion(): Promise<string>;
5
+ /**
6
+ * Get the date the data was last updated
7
+ *
8
+ * @returns the date the data was last updated
9
+ */
10
+ export declare function iamDataUpdatedAt(): Promise<Date>;
5
11
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAQvC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAGtD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGtD"}
@@ -1,17 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.iamDataVersion = iamDataVersion;
4
+ exports.iamDataUpdatedAt = iamDataUpdatedAt;
4
5
  const readRelativeFile_js_1 = require("./readRelativeFile.js");
5
- let versionCache = undefined;
6
+ let packageCache = undefined;
6
7
  /**
7
- * Get the version of the package
8
+ * Get the package data version
9
+ *
10
+ * @returns the package data version
8
11
  */
9
- function iamDataVersion() {
10
- if (!versionCache) {
11
- const data = (0, readRelativeFile_js_1.readRelativeFile)(['package.json']);
12
- const packageInfo = JSON.parse(data);
13
- versionCache = packageInfo.version;
12
+ async function getPackageData() {
13
+ if (!packageCache) {
14
+ const packageInfo = await (0, readRelativeFile_js_1.readRelativeFile)(['package.json']);
15
+ packageCache = packageInfo;
14
16
  }
15
- return versionCache;
17
+ return packageCache;
18
+ }
19
+ /**
20
+ * Get the version of the package
21
+ */
22
+ async function iamDataVersion() {
23
+ const data = await getPackageData();
24
+ return data.version;
25
+ }
26
+ /**
27
+ * Get the date the data was last updated
28
+ *
29
+ * @returns the date the data was last updated
30
+ */
31
+ async function iamDataUpdatedAt() {
32
+ const data = await getPackageData();
33
+ return new Date(data.updatedAt);
16
34
  }
17
35
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAOA,wCAQC;AAfD,+DAAyD;AAEzD,IAAI,YAAY,GAAuB,SAAS,CAAC;AAEjD;;GAEG;AACH,SAAgB,cAAc;IAC5B,IAAG,CAAC,YAAY,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,IAAA,sCAAgB,EAAC,CAAC,cAAc,CAAC,CAAC,CAAC;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC;IACrC,CAAC;IAED,OAAO,YAAa,CAAA;AACtB,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAyBA,wCAGC;AAOD,4CAGC;AAtCD,+DAAyD;AAOzD,IAAI,YAAY,GAA4B,SAAS,CAAC;AAEtD;;;;GAIG;AACH,KAAK,UAAU,cAAc;IAC3B,IAAG,CAAC,YAAY,EAAE,CAAC;QACjB,MAAM,WAAW,GAAG,MAAM,IAAA,sCAAgB,EAAsB,CAAC,cAAc,CAAC,CAAC,CAAC;QAClF,YAAY,GAAG,WAAW,CAAC;IAC7B,CAAC;IACD,OAAO,YAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc;IAClC,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAC;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,gBAAgB;IACpC,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -18,7 +18,7 @@ interface Action {
18
18
  * @param serviceKey the service key to get actions for, is case insensitive
19
19
  * @returns the actions for the service
20
20
  */
21
- export declare function iamActionsForService(serviceKey: string): string[];
21
+ export declare function iamActionsForService(serviceKey: string): Promise<string[]>;
22
22
  /**
23
23
  * Check if an action exists
24
24
  *
@@ -26,7 +26,7 @@ export declare function iamActionsForService(serviceKey: string): string[];
26
26
  * @param actionKey the action key to check for, is case insensitive
27
27
  * @returns true if the action exists, false otherwise
28
28
  */
29
- export declare function iamActionExists(serviceKey: string, actionKey: string): boolean;
29
+ export declare function iamActionExists(serviceKey: string, actionKey: string): Promise<boolean>;
30
30
  /**
31
31
  * Get the details for an action
32
32
  *
@@ -35,6 +35,6 @@ export declare function iamActionExists(serviceKey: string, actionKey: string):
35
35
  * @throws error if the service or action does not exist
36
36
  * @returns the details for the action
37
37
  */
38
- export declare function iamActionDetails(serviceKey: string, actionKey: string): Action;
38
+ export declare function iamActionDetails(serviceKey: string, actionKey: string): Promise<Action>;
39
39
  export {};
40
40
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGjE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAG9E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAM9E"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGhF;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG7F;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM7F"}
@@ -5,8 +5,8 @@ import { readActionData } from "./data.js";
5
5
  * @param serviceKey the service key to get actions for, is case insensitive
6
6
  * @returns the actions for the service
7
7
  */
8
- export function iamActionsForService(serviceKey) {
9
- const data = readActionData(serviceKey.toLowerCase());
8
+ export async function iamActionsForService(serviceKey) {
9
+ const data = await readActionData(serviceKey.toLowerCase());
10
10
  return Object.values(data).map(action => action.name);
11
11
  }
12
12
  /**
@@ -16,8 +16,8 @@ export function iamActionsForService(serviceKey) {
16
16
  * @param actionKey the action key to check for, is case insensitive
17
17
  * @returns true if the action exists, false otherwise
18
18
  */
19
- export function iamActionExists(serviceKey, actionKey) {
20
- const data = readActionData(serviceKey.toLowerCase());
19
+ export async function iamActionExists(serviceKey, actionKey) {
20
+ const data = await readActionData(serviceKey.toLowerCase());
21
21
  return !!data[actionKey.toLowerCase()];
22
22
  }
23
23
  /**
@@ -28,8 +28,8 @@ export function iamActionExists(serviceKey, actionKey) {
28
28
  * @throws error if the service or action does not exist
29
29
  * @returns the details for the action
30
30
  */
31
- export function iamActionDetails(serviceKey, actionKey) {
32
- const data = readActionData(serviceKey.toLowerCase());
31
+ export async function iamActionDetails(serviceKey, actionKey) {
32
+ const data = await readActionData(serviceKey.toLowerCase());
33
33
  if (!data[actionKey.toLowerCase()]) {
34
34
  throw new Error(`Action ${actionKey} does not exist for service ${serviceKey}`);
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAkB1C;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACrD,MAAM,IAAI,GAAG,cAAc,CAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7E,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,SAAiB;IACnE,MAAM,IAAI,GAAG,cAAc,CAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7E,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB,EAAE,SAAiB;IACpE,MAAM,IAAI,GAAG,cAAc,CAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7E,IAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,+BAA+B,UAAU,EAAE,CAAC,CAAA;IACjF,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACtC,CAAC"}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAkB1C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,UAAkB;IAC3D,MAAM,IAAI,GAAG,MAAM,cAAc,CAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACnF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB,EAAE,SAAiB;IACzE,MAAM,IAAI,GAAG,MAAM,cAAc,CAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACnF,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB,EAAE,SAAiB;IAC1E,MAAM,IAAI,GAAG,MAAM,cAAc,CAAyB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACnF,IAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,+BAA+B,UAAU,EAAE,CAAC,CAAA;IACjF,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;AACtC,CAAC"}
@@ -9,7 +9,7 @@ export interface ConditionKey {
9
9
  * @param serviceKey the service key to read the condition keys for, is case insensitive
10
10
  * @returns the condition keys for the service
11
11
  */
12
- export declare function iamConditionKeysForService(serviceKey: string): string[];
12
+ export declare function iamConditionKeysForService(serviceKey: string): Promise<string[]>;
13
13
  /**
14
14
  * Check if a condition key exists
15
15
  *
@@ -17,7 +17,7 @@ export declare function iamConditionKeysForService(serviceKey: string): string[]
17
17
  * @param conditionKey the condition key to check for, is case insensitive
18
18
  * @returns true if the condition key exists, false otherwise
19
19
  */
20
- export declare function iamConditionKeyExists(serviceKey: string, conditionKey: string): boolean;
20
+ export declare function iamConditionKeyExists(serviceKey: string, conditionKey: string): Promise<boolean>;
21
21
  /**
22
22
  * Get the details for a condition key
23
23
  *
@@ -26,5 +26,5 @@ export declare function iamConditionKeyExists(serviceKey: string, conditionKey:
26
26
  * @throws error if the service or condition key does not exist
27
27
  * @returns the details for the condition key
28
28
  */
29
- export declare function iamConditionKeyDetails(serviceKey: string, conditionKey: string): ConditionKey;
29
+ export declare function iamConditionKeyDetails(serviceKey: string, conditionKey: string): Promise<ConditionKey>;
30
30
  //# sourceMappingURL=conditionKeys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditionKeys.d.ts","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGvE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAGvF;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,CAM7F"}
1
+ {"version":3,"file":"conditionKeys.d.ts","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGtF;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGtG;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAM5G"}
@@ -5,8 +5,8 @@ import { readConditionKeys } from "./data.js";
5
5
  * @param serviceKey the service key to read the condition keys for, is case insensitive
6
6
  * @returns the condition keys for the service
7
7
  */
8
- export function iamConditionKeysForService(serviceKey) {
9
- const data = readConditionKeys(serviceKey.toLowerCase());
8
+ export async function iamConditionKeysForService(serviceKey) {
9
+ const data = await readConditionKeys(serviceKey.toLowerCase());
10
10
  return Object.values(data).map(conditionKey => conditionKey.key);
11
11
  }
12
12
  /**
@@ -16,8 +16,8 @@ export function iamConditionKeysForService(serviceKey) {
16
16
  * @param conditionKey the condition key to check for, is case insensitive
17
17
  * @returns true if the condition key exists, false otherwise
18
18
  */
19
- export function iamConditionKeyExists(serviceKey, conditionKey) {
20
- const data = readConditionKeys(serviceKey.toLowerCase());
19
+ export async function iamConditionKeyExists(serviceKey, conditionKey) {
20
+ const data = await readConditionKeys(serviceKey.toLowerCase());
21
21
  return !!data[conditionKey.toLowerCase()];
22
22
  }
23
23
  /**
@@ -28,8 +28,8 @@ export function iamConditionKeyExists(serviceKey, conditionKey) {
28
28
  * @throws error if the service or condition key does not exist
29
29
  * @returns the details for the condition key
30
30
  */
31
- export function iamConditionKeyDetails(serviceKey, conditionKey) {
32
- const data = readConditionKeys(serviceKey.toLowerCase());
31
+ export async function iamConditionKeyDetails(serviceKey, conditionKey) {
32
+ const data = await readConditionKeys(serviceKey.toLowerCase());
33
33
  if (!data[conditionKey.toLowerCase()]) {
34
34
  throw new Error(`Condition key ${conditionKey} does not exist for service ${serviceKey}`);
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"conditionKeys.js","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAQ7C;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAAkB;IAC3D,MAAM,IAAI,GAAG,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACtF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB,EAAE,YAAoB;IAC5E,MAAM,IAAI,GAAG,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACtF,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB,EAAE,YAAoB;IAC7E,MAAM,IAAI,GAAG,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IACtF,IAAG,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,+BAA+B,UAAU,EAAE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AACzC,CAAC"}
1
+ {"version":3,"file":"conditionKeys.js","sourceRoot":"","sources":["../../src/conditionKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAQ7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5F,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,UAAkB,EAAE,YAAoB;IAClF,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5F,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,UAAkB,EAAE,YAAoB;IACnF,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5F,IAAG,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,+BAA+B,UAAU,EAAE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAA;AACzC,CAAC"}
@@ -1,23 +1,23 @@
1
- export declare function readDataFile<T>(...pathParts: string[]): T;
1
+ export declare function readDataFile<T>(...pathParts: string[]): Promise<T>;
2
2
  /**
3
3
  * Read the action data for a service
4
4
  *
5
5
  * @param serviceKey the service key to read the action data for
6
6
  * @returns the action data for the service
7
7
  */
8
- export declare function readActionData<T>(serviceKey: string): T;
8
+ export declare function readActionData<T>(serviceKey: string): Promise<T>;
9
9
  /**
10
10
  * Read the condition key data for a service
11
11
  *
12
12
  * @param serviceKey the service key to read the condition key data for
13
13
  * @returns the condition key data
14
14
  */
15
- export declare function readConditionKeys<T>(serviceKey: string): T;
15
+ export declare function readConditionKeys<T>(serviceKey: string): Promise<T>;
16
16
  /**
17
17
  * Read the resource type data for a service
18
18
  *
19
19
  * @param serviceKey the service key to read the resource type data for
20
20
  * @returns the resource type data
21
21
  */
22
- export declare function readResourceTypes<T>(serviceKey: string): T;
22
+ export declare function readResourceTypes<T>(serviceKey: string): Promise<T>;
23
23
  //# sourceMappingURL=data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,CAQzD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,CAE1D"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAKA,wBAAsB,YAAY,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAQxE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEtE;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzE;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEzE"}
package/dist/esm/data.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { join } from "path";
2
2
  import { readRelativeFile } from "./readRelativeFile.js";
3
3
  const dataCache = {};
4
- export function readDataFile(...pathParts) {
4
+ export async function readDataFile(...pathParts) {
5
5
  pathParts.unshift('data');
6
6
  const file = join(...pathParts);
7
7
  if (!dataCache[file]) {
8
8
  const data = readRelativeFile(pathParts);
9
- dataCache[file] = JSON.parse(data);
9
+ dataCache[file] = data;
10
10
  }
11
11
  return dataCache[file];
12
12
  }
@@ -16,7 +16,7 @@ export function readDataFile(...pathParts) {
16
16
  * @param serviceKey the service key to read the action data for
17
17
  * @returns the action data for the service
18
18
  */
19
- export function readActionData(serviceKey) {
19
+ export async function readActionData(serviceKey) {
20
20
  return readDataFile('actions', `${serviceKey}.json`);
21
21
  }
22
22
  /**
@@ -25,7 +25,7 @@ export function readActionData(serviceKey) {
25
25
  * @param serviceKey the service key to read the condition key data for
26
26
  * @returns the condition key data
27
27
  */
28
- export function readConditionKeys(serviceKey) {
28
+ export async function readConditionKeys(serviceKey) {
29
29
  return readDataFile('conditionKeys', `${serviceKey}.json`);
30
30
  }
31
31
  /**
@@ -34,7 +34,7 @@ export function readConditionKeys(serviceKey) {
34
34
  * @param serviceKey the service key to read the resource type data for
35
35
  * @returns the resource type data
36
36
  */
37
- export function readResourceTypes(serviceKey) {
37
+ export async function readResourceTypes(serviceKey) {
38
38
  return readDataFile('resourceTypes', `${serviceKey}.json`);
39
39
  }
40
40
  //# sourceMappingURL=data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,SAAS,GAAwB,EAAE,CAAC;AAE1C,MAAM,UAAU,YAAY,CAAI,GAAG,SAAmB;IACpD,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IAChC,IAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAA;QACxC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAI,UAAkB;IAClD,OAAO,YAAY,CAAI,SAAS,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAI,UAAkB;IACrD,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAI,UAAkB;IACrD,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC"}
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,SAAS,GAAwB,EAAE,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAI,GAAG,SAAmB;IAC1D,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IAChC,IAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAA;QACxC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACxB,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,UAAkB;IACxD,OAAO,YAAY,CAAI,SAAS,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAI,UAAkB;IAC3D,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAI,UAAkB;IAC3D,OAAO,YAAY,CAAI,eAAe,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;AAChE,CAAC"}
@@ -4,5 +4,5 @@
4
4
  * @param file the path to the file to retrieve data for.
5
5
  * @returns the data from the file
6
6
  */
7
- export declare function readRelativeFile(pathParts: string[]): string;
7
+ export declare function readRelativeFile<T>(pathParts: string[]): Promise<T>;
8
8
  //# sourceMappingURL=readRelativeFileEsm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"readRelativeFile.d.ts","sourceRoot":"","sources":["../../src/readRelativeFile.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAE5D"}
1
+ {"version":3,"file":"readRelativeFile.d.ts","sourceRoot":"","sources":["../../src/readRelativeFile.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAGzE"}
@@ -1,18 +1,25 @@
1
- import { readFileSync } from "fs";
1
+ import { readFile } from "fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { fileURLToPath, resolve } from "node:url";
4
- // import { join } from "path";
5
4
  // @ts-ignore
6
5
  let root = import.meta.url;
7
6
  root = resolve(root, join('..', '..'));
7
+ const fileSystem = root.startsWith('file://');
8
8
  /**
9
9
  * Get a data file from the data directory in ESM
10
10
  *
11
11
  * @param file the path to the file to retrieve data for.
12
12
  * @returns the data from the file
13
13
  */
14
- export function readRelativeFile(pathParts) {
14
+ export async function readRelativeFile(pathParts) {
15
15
  const relativePath = join(...pathParts);
16
- return readFileSync(fileURLToPath(resolve(root, relativePath)), 'utf-8');
16
+ if (fileSystem) {
17
+ const contents = await readFile(fileURLToPath(resolve(root, relativePath)), 'utf-8');
18
+ return JSON.parse(contents);
19
+ }
20
+ else {
21
+ const contents = await fetch(relativePath);
22
+ return await contents.json();
23
+ }
17
24
  }
18
25
  //# sourceMappingURL=readRelativeFileEsm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"readRelativeFileEsm.js","sourceRoot":"","sources":["../../src/readRelativeFileEsm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAClD,+BAA+B;AAE/B,aAAa;AACb,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAA;AAC1B,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAmB;IAClD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;IACvC,OAAO,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AAC1E,CAAC"}
1
+ {"version":3,"file":"readRelativeFileEsm.js","sourceRoot":"","sources":["../../src/readRelativeFileEsm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAElD,aAAa;AACb,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAA;AAC1B,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AACtC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAI,SAAmB;IAC3D,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;IACvC,IAAG,UAAU,EAAE,CAAC;QACd,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;QACpF,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,CAAA;QAC1C,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC9B,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"readRelativeFileEsm.d.ts","sourceRoot":"","sources":["../../src/readRelativeFileEsm.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAG5D"}
1
+ {"version":3,"file":"readRelativeFileEsm.d.ts","sourceRoot":"","sources":["../../src/readRelativeFileEsm.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CASzE"}
@@ -8,7 +8,7 @@ export interface ResourceType {
8
8
  * @param serviceKey the service key to get the resource types for, is case insensitive
9
9
  * @returns the resource types for the service
10
10
  */
11
- export declare function iamResourceTypesForService(serviceKey: string): string[];
11
+ export declare function iamResourceTypesForService(serviceKey: string): Promise<string[]>;
12
12
  /**
13
13
  * Check if a resource type exists for a service and resource type key
14
14
  *
@@ -16,7 +16,7 @@ export declare function iamResourceTypesForService(serviceKey: string): string[]
16
16
  * @param resourceTypeKey the resource type key to check for, is case insensitive
17
17
  * @returns true if the resource type exists, false otherwise
18
18
  */
19
- export declare function iamResourceTypeExists(serviceKey: string, resourceTypeKey: string): boolean;
19
+ export declare function iamResourceTypeExists(serviceKey: string, resourceTypeKey: string): Promise<boolean>;
20
20
  /**
21
21
  * Get the resource type for a service and resource type key
22
22
  *
@@ -25,5 +25,5 @@ export declare function iamResourceTypeExists(serviceKey: string, resourceTypeKe
25
25
  * @throws an error if the resource type does not exist
26
26
  * @returns the resource type
27
27
  */
28
- export declare function iamResourceTypeDetails(serviceKey: string, resourceTypeKey: string): ResourceType;
28
+ export declare function iamResourceTypeDetails(serviceKey: string, resourceTypeKey: string): Promise<ResourceType>;
29
29
  //# sourceMappingURL=resourceTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceTypes.d.ts","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGvE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAG1F;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,YAAY,CAMhG"}
1
+ {"version":3,"file":"resourceTypes.d.ts","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGtF;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGzG;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAM/G"}
@@ -4,8 +4,8 @@ import { readResourceTypes } from "./data.js";
4
4
  * @param serviceKey the service key to get the resource types for, is case insensitive
5
5
  * @returns the resource types for the service
6
6
  */
7
- export function iamResourceTypesForService(serviceKey) {
8
- const data = readResourceTypes(serviceKey.toLowerCase());
7
+ export async function iamResourceTypesForService(serviceKey) {
8
+ const data = await readResourceTypes(serviceKey.toLowerCase());
9
9
  return Object.values(data).map(resourceType => resourceType.key);
10
10
  }
11
11
  /**
@@ -15,8 +15,8 @@ export function iamResourceTypesForService(serviceKey) {
15
15
  * @param resourceTypeKey the resource type key to check for, is case insensitive
16
16
  * @returns true if the resource type exists, false otherwise
17
17
  */
18
- export function iamResourceTypeExists(serviceKey, resourceTypeKey) {
19
- const data = readResourceTypes(serviceKey.toLowerCase());
18
+ export async function iamResourceTypeExists(serviceKey, resourceTypeKey) {
19
+ const data = await readResourceTypes(serviceKey.toLowerCase());
20
20
  return !!data[resourceTypeKey.toLowerCase()];
21
21
  }
22
22
  /**
@@ -27,8 +27,8 @@ export function iamResourceTypeExists(serviceKey, resourceTypeKey) {
27
27
  * @throws an error if the resource type does not exist
28
28
  * @returns the resource type
29
29
  */
30
- export function iamResourceTypeDetails(serviceKey, resourceTypeKey) {
31
- const data = readResourceTypes(serviceKey.toLowerCase());
30
+ export async function iamResourceTypeDetails(serviceKey, resourceTypeKey) {
31
+ const data = await readResourceTypes(serviceKey.toLowerCase());
32
32
  if (!data[resourceTypeKey.toLowerCase()]) {
33
33
  throw new Error(`Resource type ${resourceTypeKey} does not exist for service ${serviceKey}`);
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resourceTypes.js","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAQ9C;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAAkB;IAC3D,MAAM,IAAI,GAAG,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACvF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB,EAAE,eAAuB;IAC/E,MAAM,IAAI,GAAG,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACvF,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB,EAAE,eAAuB;IAChF,MAAM,IAAI,GAAG,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACvF,IAAG,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,iBAAiB,eAAe,+BAA+B,UAAU,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"file":"resourceTypes.js","sourceRoot":"","sources":["../../src/resourceTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAQ9C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,UAAkB,EAAE,eAAuB;IACrF,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,UAAkB,EAAE,eAAuB;IACtF,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAA+B,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,IAAG,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,iBAAiB,eAAe,+BAA+B,UAAU,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;AAC7C,CAAC"}
@@ -3,14 +3,14 @@
3
3
  *
4
4
  * @returns an array of all service keys
5
5
  */
6
- export declare function iamServiceKeys(): string[];
6
+ export declare function iamServiceKeys(): Promise<string[]>;
7
7
  /**
8
8
  * Check if a service exists
9
9
  *
10
10
  * @param serviceKey the service key to check, is case insensitive
11
11
  * @returns true if the service exists, false otherwise
12
12
  */
13
- export declare function iamServiceExists(serviceKey: string): boolean;
13
+ export declare function iamServiceExists(serviceKey: string): Promise<boolean>;
14
14
  /**
15
15
  * Get the name of a service
16
16
  *
@@ -18,5 +18,5 @@ export declare function iamServiceExists(serviceKey: string): boolean;
18
18
  * @throws error if the service does not exist
19
19
  * @returns the name of the service
20
20
  */
21
- export declare function iamServiceName(serviceKey: string): string;
21
+ export declare function iamServiceName(serviceKey: string): Promise<string>;
22
22
  //# sourceMappingURL=services.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAG5D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMzD"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAExD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG3E;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxE"}
@@ -4,7 +4,7 @@ import { readDataFile } from './data.js';
4
4
  *
5
5
  * @returns an array of all service keys
6
6
  */
7
- export function iamServiceKeys() {
7
+ export async function iamServiceKeys() {
8
8
  return readDataFile('services.json');
9
9
  }
10
10
  /**
@@ -13,8 +13,8 @@ export function iamServiceKeys() {
13
13
  * @param serviceKey the service key to check, is case insensitive
14
14
  * @returns true if the service exists, false otherwise
15
15
  */
16
- export function iamServiceExists(serviceKey) {
17
- const data = readDataFile('serviceNames.json');
16
+ export async function iamServiceExists(serviceKey) {
17
+ const data = await readDataFile('serviceNames.json');
18
18
  return !!data[serviceKey.toLowerCase()];
19
19
  }
20
20
  /**
@@ -24,8 +24,8 @@ export function iamServiceExists(serviceKey) {
24
24
  * @throws error if the service does not exist
25
25
  * @returns the name of the service
26
26
  */
27
- export function iamServiceName(serviceKey) {
28
- const data = readDataFile('serviceNames.json');
27
+ export async function iamServiceName(serviceKey) {
28
+ const data = await readDataFile('serviceNames.json');
29
29
  if (!data[serviceKey.toLowerCase()]) {
30
30
  throw new Error(`Service ${serviceKey} does not exist`);
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAW,eAAe,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,MAAM,IAAI,GAAG,YAAY,CAAyB,mBAAmB,CAAC,CAAA;IACtE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,MAAM,IAAI,GAAG,YAAY,CAAyB,mBAAmB,CAAC,CAAA;IACtE,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,iBAAiB,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;AACvC,CAAC"}
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,OAAO,YAAY,CAAW,eAAe,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IACvD,MAAM,IAAI,GAAG,MAAM,YAAY,CAAyB,mBAAmB,CAAC,CAAA;IAC5E,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAAkB;IACrD,MAAM,IAAI,GAAG,MAAM,YAAY,CAAyB,mBAAmB,CAAC,CAAA;IAC5E,IAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,iBAAiB,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;AACvC,CAAC"}
@@ -1,5 +1,11 @@
1
1
  /**
2
2
  * Get the version of the package
3
3
  */
4
- export declare function iamDataVersion(): string;
4
+ export declare function iamDataVersion(): Promise<string>;
5
+ /**
6
+ * Get the date the data was last updated
7
+ *
8
+ * @returns the date the data was last updated
9
+ */
10
+ export declare function iamDataUpdatedAt(): Promise<Date>;
5
11
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAQvC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAGtD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGtD"}
@@ -1,14 +1,31 @@
1
1
  import { readRelativeFile } from "./readRelativeFile.js";
2
- let versionCache = undefined;
2
+ let packageCache = undefined;
3
3
  /**
4
- * Get the version of the package
4
+ * Get the package data version
5
+ *
6
+ * @returns the package data version
5
7
  */
6
- export function iamDataVersion() {
7
- if (!versionCache) {
8
- const data = readRelativeFile(['package.json']);
9
- const packageInfo = JSON.parse(data);
10
- versionCache = packageInfo.version;
8
+ async function getPackageData() {
9
+ if (!packageCache) {
10
+ const packageInfo = await readRelativeFile(['package.json']);
11
+ packageCache = packageInfo;
11
12
  }
12
- return versionCache;
13
+ return packageCache;
14
+ }
15
+ /**
16
+ * Get the version of the package
17
+ */
18
+ export async function iamDataVersion() {
19
+ const data = await getPackageData();
20
+ return data.version;
21
+ }
22
+ /**
23
+ * Get the date the data was last updated
24
+ *
25
+ * @returns the date the data was last updated
26
+ */
27
+ export async function iamDataUpdatedAt() {
28
+ const data = await getPackageData();
29
+ return new Date(data.updatedAt);
13
30
  }
14
31
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,IAAI,YAAY,GAAuB,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAG,CAAC,YAAY,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,gBAAgB,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC;IACrC,CAAC;IAED,OAAO,YAAa,CAAA;AACtB,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,IAAI,YAAY,GAA4B,SAAS,CAAC;AAEtD;;;;GAIG;AACH,KAAK,UAAU,cAAc;IAC3B,IAAG,CAAC,YAAY,EAAE,CAAC;QACjB,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAsB,CAAC,cAAc,CAAC,CAAC,CAAC;QAClF,YAAY,GAAG,WAAW,CAAC;IAC7B,CAAC;IACD,OAAO,YAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAC;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@cloud-copilot/iam-data",
3
- "version": "0.2.202409011",
3
+ "version": "0.3.202409011",
4
4
  "description": "AWS IAM Data",
5
5
  "repository": "github:cloud-copilot/iam-data",
6
+ "updatedAt": "2024-09-01T05:38:06.234Z",
6
7
  "exports": {
7
8
  ".": {
8
9
  "import": "./dist/esm/index.js",
@@ -17,7 +18,8 @@
17
18
  "types": "dist/cjs/index.d.ts",
18
19
  "scripts": {
19
20
  "test": "npx vitest --run",
20
- "build": "npx tsc -p tsconfig.cjs.json && npx tsc -p tsconfig.esm.json && ./postbuild.sh"
21
+ "build": "npx tsc -p tsconfig.cjs.json && npx tsc -p tsconfig.esm.json && ./postbuild.sh",
22
+ "prepare": "npm run build"
21
23
  },
22
24
  "keywords": [
23
25
  "AWS",