@ttoss/cloudformation 0.2.2 → 0.4.0

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/esm/index.js CHANGED
@@ -15,7 +15,7 @@ import * as path2 from "path";
15
15
  import * as fs from "fs";
16
16
  import * as path from "path";
17
17
 
18
- // src/cloudFormationTemplate.ts
18
+ // src/cloudFormationYamlTemplate.ts
19
19
  import yaml from "js-yaml";
20
20
  var cloudFormationTypes = [
21
21
  {
package/dist/index.d.ts CHANGED
@@ -5,6 +5,9 @@ interface Parameter {
5
5
  Type: string;
6
6
  NoEcho?: boolean;
7
7
  }
8
+ type Parameters = {
9
+ [key: string]: Parameter;
10
+ };
8
11
  interface Resource {
9
12
  Type: string;
10
13
  DeletionPolicy?: 'Delete' | 'Retain';
@@ -13,6 +16,39 @@ interface Resource {
13
16
  Condition?: string;
14
17
  Properties: any;
15
18
  }
19
+ interface IAMRoleResource extends Resource {
20
+ Type: 'AWS::IAM::Role';
21
+ Properties: {
22
+ AssumeRolePolicyDocument: {
23
+ Version: '2012-10-17';
24
+ Statement: {
25
+ Effect: 'Allow' | 'Deny';
26
+ Action: string;
27
+ Principal: any;
28
+ }[];
29
+ };
30
+ ManagedPolicyArns?: string[];
31
+ Path?: string;
32
+ Policies?: {
33
+ PolicyName: string;
34
+ PolicyDocument: {
35
+ Version: '2012-10-17';
36
+ Statement: {
37
+ Effect: 'Allow' | 'Deny';
38
+ Action: string | string[];
39
+ Resource: string | string[] | {
40
+ [key: string]: string;
41
+ } | {
42
+ [key: string]: string;
43
+ }[];
44
+ }[];
45
+ };
46
+ }[];
47
+ };
48
+ }
49
+ type Resources = {
50
+ [key: string]: IAMRoleResource | Resource;
51
+ };
16
52
  type Output = {
17
53
  Description?: string;
18
54
  Value: string | any;
@@ -20,21 +56,19 @@ type Output = {
20
56
  Name: string | any;
21
57
  };
22
58
  };
23
- interface CloudFormationTemplate {
59
+ type Outputs = {
60
+ [key: string]: Output;
61
+ };
62
+ type CloudFormationTemplate = {
24
63
  AWSTemplateFormatVersion: '2010-09-09';
64
+ Description?: string;
25
65
  Transform?: 'AWS::Serverless-2016-10-31';
26
66
  Mappings?: any;
27
67
  Conditions?: any;
28
- Parameters?: {
29
- [key: string]: Parameter;
30
- };
31
- Resources: {
32
- [key: string]: Resource;
33
- };
34
- Outputs?: {
35
- [key: string]: Output;
36
- };
37
- }
68
+ Parameters?: Parameters;
69
+ Resources: Resources;
70
+ Outputs?: Outputs;
71
+ };
38
72
 
39
73
  declare const findAndReadCloudFormationTemplate: ({ templatePath: defaultTemplatePath, }: {
40
74
  templatePath?: string;
@@ -44,4 +78,4 @@ declare const readObjectFile: ({ path }: {
44
78
  path: string;
45
79
  }) => any;
46
80
 
47
- export { findAndReadCloudFormationTemplate, readObjectFile as unstable_readObjectFile };
81
+ export { CloudFormationTemplate, IAMRoleResource, Output, Outputs, Parameter, Parameters, Resource, Resources, findAndReadCloudFormationTemplate, readObjectFile as unstable_readObjectFile };
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ var path2 = __toESM(require("path"));
40
40
  var fs = __toESM(require("fs"));
41
41
  var path = __toESM(require("path"));
42
42
 
43
- // src/cloudFormationTemplate.ts
43
+ // src/cloudFormationYamlTemplate.ts
44
44
  var import_js_yaml = __toESM(require("js-yaml"));
45
45
  var cloudFormationTypes = [
46
46
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/cloudformation",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "CloudFormation utils.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -23,14 +23,14 @@
23
23
  "ts-node": "^10.9.1"
24
24
  },
25
25
  "devDependencies": {
26
- "@ttoss/config": "^1.26.0",
27
- "@ttoss/test-utils": "^1.20.0",
28
- "@types/jest": "^29.2.4",
26
+ "@ttoss/config": "^1.27.0",
27
+ "@ttoss/test-utils": "^1.20.1",
28
+ "@types/jest": "^29.2.5",
29
29
  "jest": "^29.3.1"
30
30
  },
31
31
  "keywords": [],
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "f3b33b88d475925960f557619d710f11f831c144"
35
+ "gitHead": "2bf304efc726a34b95859bb9b6fe8749c1a16844"
36
36
  }
@@ -0,0 +1,72 @@
1
+ export interface Parameter {
2
+ AllowedValues?: string[];
3
+ Default?: string | number;
4
+ Description?: string;
5
+ Type: string;
6
+ NoEcho?: boolean;
7
+ }
8
+
9
+ export type Parameters = { [key: string]: Parameter };
10
+
11
+ export interface Resource {
12
+ Type: string;
13
+ DeletionPolicy?: 'Delete' | 'Retain';
14
+ Description?: string;
15
+ DependsOn?: string[] | string;
16
+ Condition?: string;
17
+ Properties: any;
18
+ }
19
+
20
+ export interface IAMRoleResource extends Resource {
21
+ Type: 'AWS::IAM::Role';
22
+ Properties: {
23
+ AssumeRolePolicyDocument: {
24
+ Version: '2012-10-17';
25
+ Statement: {
26
+ Effect: 'Allow' | 'Deny';
27
+ Action: string;
28
+ Principal: any;
29
+ }[];
30
+ };
31
+ ManagedPolicyArns?: string[];
32
+ Path?: string;
33
+ Policies?: {
34
+ PolicyName: string;
35
+ PolicyDocument: {
36
+ Version: '2012-10-17';
37
+ Statement: {
38
+ Effect: 'Allow' | 'Deny';
39
+ Action: string | string[];
40
+ Resource:
41
+ | string
42
+ | string[]
43
+ | { [key: string]: string }
44
+ | { [key: string]: string }[];
45
+ }[];
46
+ };
47
+ }[];
48
+ };
49
+ }
50
+
51
+ export type Resources = { [key: string]: IAMRoleResource | Resource };
52
+
53
+ export type Output = {
54
+ Description?: string;
55
+ Value: string | any;
56
+ Export?: {
57
+ Name: string | any;
58
+ };
59
+ };
60
+
61
+ export type Outputs = { [key: string]: Output };
62
+
63
+ export type CloudFormationTemplate = {
64
+ AWSTemplateFormatVersion: '2010-09-09';
65
+ Description?: string;
66
+ Transform?: 'AWS::Serverless-2016-10-31';
67
+ Mappings?: any;
68
+ Conditions?: any;
69
+ Parameters?: Parameters;
70
+ Resources: Resources;
71
+ Outputs?: Outputs;
72
+ };
@@ -1,40 +1,6 @@
1
+ import { CloudFormationTemplate } from './CloudFormationTemplate';
1
2
  import yaml from 'js-yaml';
2
3
 
3
- interface Parameter {
4
- AllowedValues?: string[];
5
- Default?: string | number;
6
- Description?: string;
7
- Type: string;
8
- NoEcho?: boolean;
9
- }
10
-
11
- export interface Resource {
12
- Type: string;
13
- DeletionPolicy?: 'Delete' | 'Retain';
14
- Description?: string;
15
- DependsOn?: string[] | string;
16
- Condition?: string;
17
- Properties: any;
18
- }
19
-
20
- export type Output = {
21
- Description?: string;
22
- Value: string | any;
23
- Export?: {
24
- Name: string | any;
25
- };
26
- };
27
-
28
- export interface CloudFormationTemplate {
29
- AWSTemplateFormatVersion: '2010-09-09';
30
- Transform?: 'AWS::Serverless-2016-10-31';
31
- Mappings?: any;
32
- Conditions?: any;
33
- Parameters?: { [key: string]: Parameter };
34
- Resources: { [key: string]: Resource };
35
- Outputs?: { [key: string]: Output };
36
- }
37
-
38
4
  export interface TagAndType {
39
5
  tag: string;
40
6
  options: yaml.TypeConstructorOptions;
@@ -1,6 +1,6 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
- import { CloudFormationTemplate } from './cloudFormationTemplate';
3
+ import { CloudFormationTemplate } from './CloudFormationTemplate';
4
4
  import { readCloudFormationYamlTemplate } from './readCloudFormationYamlTemplate';
5
5
  import { readObjectFile } from './readObjectFile';
6
6
 
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { findAndReadCloudFormationTemplate } from './findAndReadCloudFormationTemplate';
2
+ export * from './CloudFormationTemplate';
2
3
 
3
4
  /**
4
5
  * Unstable API.
@@ -1,10 +1,10 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
+ import { CloudFormationTemplate } from './CloudFormationTemplate';
3
4
  import {
4
- CloudFormationTemplate,
5
5
  TagAndType,
6
6
  loadCloudFormationTemplate,
7
- } from './cloudFormationTemplate';
7
+ } from './cloudFormationYamlTemplate';
8
8
 
9
9
  const getTypes = (): TagAndType[] => {
10
10
  return [