@aws-amplify/graphql-api-construct 1.6.0-secrets-manager.0 → 1.6.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.
Files changed (139) hide show
  1. package/.jsii +298 -348
  2. package/API.md +14 -18
  3. package/CHANGELOG.md +11 -2
  4. package/README.md +17 -75
  5. package/lib/amplify-dynamodb-table-wrapper.d.ts +6 -1
  6. package/lib/amplify-dynamodb-table-wrapper.js +9 -2
  7. package/lib/amplify-graphql-api.d.ts +2 -2
  8. package/lib/amplify-graphql-api.js +10 -7
  9. package/lib/amplify-graphql-definition.js +1 -1
  10. package/lib/index.d.ts +1 -1
  11. package/lib/index.js +1 -1
  12. package/lib/internal/construct-exports.js +13 -3
  13. package/lib/internal/data-source-config.js +4 -37
  14. package/lib/model-datasource-strategy-types.d.ts +1 -25
  15. package/lib/model-datasource-strategy-types.js +1 -1
  16. package/lib/sql-model-datasource-strategy.d.ts +1 -13
  17. package/lib/sql-model-datasource-strategy.js +4 -26
  18. package/lib/types.d.ts +17 -5
  19. package/lib/types.js +1 -1
  20. package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +13 -1
  21. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts.map +1 -1
  22. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js +34 -1
  23. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js.map +1 -1
  24. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.d.ts.map +1 -1
  25. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js +0 -3
  26. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js.map +1 -1
  27. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.d.ts.map +1 -1
  28. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js +3 -2
  29. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js.map +1 -1
  30. package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +20 -14
  31. package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +11 -1
  32. package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +15 -9
  33. package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +5 -1
  34. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +14 -9
  35. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +5 -1
  36. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +14 -9
  37. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +9 -1
  38. package/node_modules/@aws-amplify/graphql-index-transformer/package.json +15 -9
  39. package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +9 -1
  40. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
  41. package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +16 -14
  42. package/node_modules/@aws-amplify/graphql-model-transformer/API.md +1 -1
  43. package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +12 -3
  44. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts.map +1 -1
  45. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js +12 -9
  46. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js.map +1 -1
  47. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.d.ts.map +1 -1
  48. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.js.map +1 -1
  49. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.d.ts +1 -1
  50. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.d.ts.map +1 -1
  51. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.js +9 -1
  52. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.js.map +1 -1
  53. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
  54. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
  55. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
  56. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts +1 -5
  57. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts.map +1 -1
  58. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js +26 -71
  59. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js.map +1 -1
  60. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -1
  61. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +1 -0
  62. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -1
  63. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts.map +1 -1
  64. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js +7 -21
  65. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js.map +1 -1
  66. package/node_modules/@aws-amplify/graphql-model-transformer/package.json +17 -11
  67. package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +5 -1
  68. package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
  69. package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +14 -9
  70. package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +11 -1
  71. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.d.ts.map +1 -1
  72. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js +13 -3
  73. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js.map +1 -1
  74. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +17 -11
  75. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +11 -1
  76. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  77. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +15 -9
  78. package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +9 -1
  79. package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +16 -10
  80. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +9 -3
  81. package/node_modules/@aws-amplify/graphql-transformer/package.json +23 -17
  82. package/node_modules/@aws-amplify/graphql-transformer-core/API.md +12 -0
  83. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +7 -1
  84. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +1 -1
  85. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts.map +1 -1
  86. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js +6 -2
  87. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
  88. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.d.ts +2 -0
  89. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.d.ts.map +1 -1
  90. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.js +14 -0
  91. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.js.map +1 -1
  92. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts +1 -1
  93. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts.map +1 -1
  94. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js +5 -1
  95. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js.map +1 -1
  96. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.d.ts +4 -0
  97. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.d.ts.map +1 -1
  98. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.js +18 -1
  99. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.js.map +1 -1
  100. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +14 -9
  101. package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +5 -27
  102. package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +2 -2
  103. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts +1 -12
  104. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts.map +1 -1
  105. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js +0 -22
  106. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js.map +1 -1
  107. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-output-provider.d.ts +2 -0
  108. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-output-provider.d.ts.map +1 -1
  109. package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +8 -3
  110. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/model-datasource/types.ts +1 -76
  111. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-output-provider.ts +4 -0
  112. package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
  113. package/node_modules/graphql-mapping-template/CHANGELOG.md +4 -0
  114. package/node_modules/graphql-mapping-template/package.json +10 -4
  115. package/node_modules/graphql-transformer-common/API.md +14 -0
  116. package/node_modules/graphql-transformer-common/CHANGELOG.md +10 -0
  117. package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.d.ts +13 -0
  118. package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.d.ts.map +1 -0
  119. package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.js +16 -0
  120. package/node_modules/graphql-transformer-common/lib/TypescriptSchemaConstants.js.map +1 -0
  121. package/node_modules/graphql-transformer-common/lib/index.d.ts +1 -0
  122. package/node_modules/graphql-transformer-common/lib/index.d.ts.map +1 -1
  123. package/node_modules/graphql-transformer-common/lib/index.js +1 -0
  124. package/node_modules/graphql-transformer-common/lib/index.js.map +1 -1
  125. package/node_modules/graphql-transformer-common/package.json +11 -5
  126. package/package.json +27 -21
  127. package/src/amplify-dynamodb-table-wrapper.ts +9 -1
  128. package/src/amplify-graphql-api.ts +15 -7
  129. package/src/index.ts +1 -0
  130. package/src/internal/construct-exports.ts +14 -4
  131. package/src/internal/data-source-config.ts +9 -42
  132. package/src/model-datasource-strategy-types.ts +1 -33
  133. package/src/sql-model-datasource-strategy.ts +1 -32
  134. package/src/types.ts +19 -6
  135. package/node_modules/@aws-amplify/graphql-function-transformer/LICENSE +0 -201
  136. package/node_modules/@aws-amplify/graphql-http-transformer/LICENSE +0 -201
  137. package/node_modules/@aws-amplify/graphql-predictions-transformer/LICENSE +0 -201
  138. package/node_modules/@aws-amplify/graphql-transformer-core/LICENSE +0 -201
  139. package/node_modules/@aws-amplify/graphql-transformer-interfaces/LICENSE +0 -201
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.20.15](https://github.com/aws-amplify/amplify-category-api/compare/graphql-mapping-template@4.20.14...graphql-mapping-template@4.20.15) (2024-02-28)
7
+
8
+ **Note:** Version bump only for package graphql-mapping-template
9
+
6
10
  ## [4.20.14](https://github.com/aws-amplify/amplify-category-api/compare/graphql-mapping-template@4.20.13...graphql-mapping-template@4.20.14) (2023-12-18)
7
11
 
8
12
  **Note:** Version bump only for package graphql-mapping-template
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql-mapping-template",
3
- "version": "4.20.14",
3
+ "version": "4.20.15",
4
4
  "description": "An AST wrapper around AWS AppSync resolvers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,14 +42,20 @@
42
42
  "coverageProvider": "v8",
43
43
  "coverageThreshold": {
44
44
  "global": {
45
- "branches": 63,
46
- "functions": 33,
47
- "lines": 59
45
+ "branches": 60,
46
+ "functions": 32,
47
+ "lines": 50
48
48
  }
49
49
  },
50
50
  "coverageReporters": [
51
51
  "clover",
52
52
  "text"
53
+ ],
54
+ "collectCoverageFrom": [
55
+ "src/**/*.ts"
56
+ ],
57
+ "coveragePathIgnorePatterns": [
58
+ "/__tests__/"
53
59
  ]
54
60
  }
55
61
  }
@@ -500,6 +500,20 @@ export function toUpper(word: string): string;
500
500
  // @public (undocumented)
501
501
  export const transformedArgsRef: ReferenceNode;
502
502
 
503
+ // @public (undocumented)
504
+ export const TYPESCRIPT_DATA_SCHEMA_CONSTANTS: {
505
+ SCHEMA_PACKAGE: string;
506
+ MODEL_METHOD: string;
507
+ SCHEMA_METHOD: string;
508
+ IDENTIFIER_METHOD: string;
509
+ ARRAY_METHOD: string;
510
+ REQUIRED_METHOD: string;
511
+ STRING_METHOD: string;
512
+ ENUM_METHOD: string;
513
+ REFERENCE_A: string;
514
+ EXPORT_VARIABLE_NAME: string;
515
+ };
516
+
503
517
  // @public (undocumented)
504
518
  export function unwrapNonNull(type: TypeNode): any;
505
519
 
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.28.1](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.28.0...graphql-transformer-common@4.28.1) (2024-02-28)
7
+
8
+ **Note:** Version bump only for package graphql-transformer-common
9
+
10
+ # [4.28.0](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.27.1...graphql-transformer-common@4.28.0) (2024-02-05)
11
+
12
+ ### Features
13
+
14
+ - **api:** generate typescript data schema from sql schema internal representation ([#2225](https://github.com/aws-amplify/amplify-category-api/issues/2225)) ([460b077](https://github.com/aws-amplify/amplify-category-api/commit/460b0776af82932d2b42a2b7720b49b91fdbd45c))
15
+
6
16
  ## [4.27.1](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.27.0...graphql-transformer-common@4.27.1) (2023-12-18)
7
17
 
8
18
  **Note:** Version bump only for package graphql-transformer-common
@@ -0,0 +1,13 @@
1
+ export declare const TYPESCRIPT_DATA_SCHEMA_CONSTANTS: {
2
+ SCHEMA_PACKAGE: string;
3
+ MODEL_METHOD: string;
4
+ SCHEMA_METHOD: string;
5
+ IDENTIFIER_METHOD: string;
6
+ ARRAY_METHOD: string;
7
+ REQUIRED_METHOD: string;
8
+ STRING_METHOD: string;
9
+ ENUM_METHOD: string;
10
+ REFERENCE_A: string;
11
+ EXPORT_VARIABLE_NAME: string;
12
+ };
13
+ //# sourceMappingURL=TypescriptSchemaConstants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypescriptSchemaConstants.d.ts","sourceRoot":"","sources":["../src/TypescriptSchemaConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC;;;;;;;;;;;CAW5C,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TYPESCRIPT_DATA_SCHEMA_CONSTANTS = void 0;
4
+ exports.TYPESCRIPT_DATA_SCHEMA_CONSTANTS = {
5
+ SCHEMA_PACKAGE: '@aws-amplify/data-schema',
6
+ MODEL_METHOD: 'model',
7
+ SCHEMA_METHOD: 'schema',
8
+ IDENTIFIER_METHOD: 'identifier',
9
+ ARRAY_METHOD: 'array',
10
+ REQUIRED_METHOD: 'required',
11
+ STRING_METHOD: 'string',
12
+ ENUM_METHOD: 'enum',
13
+ REFERENCE_A: 'a',
14
+ EXPORT_VARIABLE_NAME: 'schema',
15
+ };
16
+ //# sourceMappingURL=TypescriptSchemaConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypescriptSchemaConstants.js","sourceRoot":"","sources":["../src/TypescriptSchemaConstants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gCAAgC,GAAG;IAC9C,cAAc,EAAE,0BAA0B;IAC1C,YAAY,EAAE,OAAO;IACrB,aAAa,EAAE,QAAQ;IACvB,iBAAiB,EAAE,YAAY;IAC/B,YAAY,EAAE,OAAO;IACrB,eAAe,EAAE,UAAU;IAC3B,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,GAAG;IAChB,oBAAoB,EAAE,QAAQ;CAC/B,CAAC"}
@@ -12,4 +12,5 @@ export * from './dynamodbUtils';
12
12
  export * from './SyncResourceIDs';
13
13
  export * from './PredictionsResourceIDs';
14
14
  export * from './transformedArgs';
15
+ export * from './TypescriptSchemaConstants';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
@@ -28,4 +28,5 @@ __exportStar(require("./dynamodbUtils"), exports);
28
28
  __exportStar(require("./SyncResourceIDs"), exports);
29
29
  __exportStar(require("./PredictionsResourceIDs"), exports);
30
30
  __exportStar(require("./transformedArgs"), exports);
31
+ __exportStar(require("./TypescriptSchemaConstants"), exports);
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,+CAA6B;AAC7B,yCAAuB;AACvB,wDAAsC;AACtC,qDAAmC;AACnC,0DAAwC;AACxC,8CAA4B;AAC5B,oDAAkC;AAClC,wDAAsC;AACtC,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,2DAAyC;AACzC,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,+CAA6B;AAC7B,yCAAuB;AACvB,wDAAsC;AACtC,qDAAmC;AACnC,0DAAwC;AACxC,8CAA4B;AAC5B,oDAAkC;AAClC,wDAAsC;AACtC,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,2DAAyC;AACzC,oDAAkC;AAClC,8DAA4C"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql-transformer-common",
3
- "version": "4.27.1",
3
+ "version": "4.28.1",
4
4
  "description": "Common code and constants for AppSync Transformers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "graphql": "^15.5.0",
28
- "graphql-mapping-template": "4.20.14",
28
+ "graphql-mapping-template": "4.20.15",
29
29
  "md5": "^2.2.1",
30
30
  "pluralize": "8.0.0"
31
31
  },
@@ -37,9 +37,9 @@
37
37
  "coverageProvider": "v8",
38
38
  "coverageThreshold": {
39
39
  "global": {
40
- "branches": 63,
41
- "functions": 11,
42
- "lines": 27
40
+ "branches": 35,
41
+ "functions": 8,
42
+ "lines": 8
43
43
  }
44
44
  },
45
45
  "coverageReporters": [
@@ -58,6 +58,12 @@
58
58
  "jsx",
59
59
  "json",
60
60
  "node"
61
+ ],
62
+ "collectCoverageFrom": [
63
+ "src/**/*.ts"
64
+ ],
65
+ "coveragePathIgnorePatterns": [
66
+ "/__tests__/"
61
67
  ]
62
68
  }
63
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/graphql-api-construct",
3
- "version": "1.6.0-secrets-manager.0",
3
+ "version": "1.6.0",
4
4
  "description": "AppSync GraphQL Api Construct using Amplify GraphQL Transformer.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -75,20 +75,20 @@
75
75
  "dependencies": {
76
76
  "@aws-amplify/backend-output-schemas": "^0.4.0",
77
77
  "@aws-amplify/backend-output-storage": "^0.2.2",
78
- "@aws-amplify/graphql-auth-transformer": "3.3.6-secrets-manager.0",
79
- "@aws-amplify/graphql-default-value-transformer": "2.2.5-secrets-manager.0",
80
- "@aws-amplify/graphql-function-transformer": "2.1.17-secrets-manager.0",
81
- "@aws-amplify/graphql-http-transformer": "2.1.17-secrets-manager.0",
82
- "@aws-amplify/graphql-index-transformer": "2.3.5-secrets-manager.0",
83
- "@aws-amplify/graphql-maps-to-transformer": "3.4.6-secrets-manager.0",
84
- "@aws-amplify/graphql-model-transformer": "2.5.0-secrets-manager.0",
85
- "@aws-amplify/graphql-predictions-transformer": "2.1.17-secrets-manager.0",
86
- "@aws-amplify/graphql-relational-transformer": "2.3.6-secrets-manager.0",
87
- "@aws-amplify/graphql-searchable-transformer": "2.5.2-secrets-manager.0",
88
- "@aws-amplify/graphql-sql-transformer": "0.2.5-secrets-manager.0",
89
- "@aws-amplify/graphql-transformer": "1.4.0-secrets-manager.0",
90
- "@aws-amplify/graphql-transformer-core": "2.4.5-secrets-manager.0",
91
- "@aws-amplify/graphql-transformer-interfaces": "3.4.0-secrets-manager.0",
78
+ "@aws-amplify/graphql-auth-transformer": "3.4.1",
79
+ "@aws-amplify/graphql-default-value-transformer": "2.3.1",
80
+ "@aws-amplify/graphql-function-transformer": "2.1.18",
81
+ "@aws-amplify/graphql-http-transformer": "2.1.18",
82
+ "@aws-amplify/graphql-index-transformer": "2.3.7",
83
+ "@aws-amplify/graphql-maps-to-transformer": "3.4.8",
84
+ "@aws-amplify/graphql-model-transformer": "2.6.0",
85
+ "@aws-amplify/graphql-predictions-transformer": "2.1.18",
86
+ "@aws-amplify/graphql-relational-transformer": "2.4.1",
87
+ "@aws-amplify/graphql-searchable-transformer": "2.6.1",
88
+ "@aws-amplify/graphql-sql-transformer": "0.2.7",
89
+ "@aws-amplify/graphql-transformer": "1.3.12",
90
+ "@aws-amplify/graphql-transformer-core": "2.5.0",
91
+ "@aws-amplify/graphql-transformer-interfaces": "3.4.0",
92
92
  "@aws-amplify/platform-core": "^0.2.0",
93
93
  "@aws-amplify/plugin-types": "^0.4.1",
94
94
  "charenc": "^0.0.2",
@@ -96,8 +96,8 @@
96
96
  "fs-extra": "^8.1.0",
97
97
  "graceful-fs": "^4.2.11",
98
98
  "graphql": "^15.5.0",
99
- "graphql-mapping-template": "4.20.14",
100
- "graphql-transformer-common": "4.27.1",
99
+ "graphql-mapping-template": "4.20.15",
100
+ "graphql-transformer-common": "4.28.1",
101
101
  "hjson": "^3.2.2",
102
102
  "immer": "^9.0.12",
103
103
  "is-buffer": "^2.0.5",
@@ -112,7 +112,7 @@
112
112
  "zod": "^3.22.3"
113
113
  },
114
114
  "devDependencies": {
115
- "@aws-amplify/graphql-transformer-test-utils": "0.4.5-secrets-manager.0",
115
+ "@aws-amplify/graphql-transformer-test-utils": "0.4.6",
116
116
  "@types/fs-extra": "^8.0.1",
117
117
  "@types/node": "^12.12.6",
118
118
  "aws-cdk-lib": "2.80.0",
@@ -162,14 +162,20 @@
162
162
  "global": {
163
163
  "branches": 90,
164
164
  "functions": 90,
165
- "lines": 90
165
+ "lines": 60
166
166
  }
167
167
  },
168
168
  "coverageReporters": [
169
169
  "clover",
170
170
  "text"
171
171
  ],
172
- "testEnvironment": "../../FixJestEnvironment.js"
172
+ "testEnvironment": "../../FixJestEnvironment.js",
173
+ "collectCoverageFrom": [
174
+ "src/**/*.ts"
175
+ ],
176
+ "coveragePathIgnorePatterns": [
177
+ "/__tests__/"
178
+ ]
173
179
  },
174
- "gitHead": "1b45d39e2064522f7bce51bd8bf5135742d4ce14"
180
+ "gitHead": "9a0fb53d5df94e76811cbbdc4f3fc98fc6278c41"
175
181
  }
@@ -1,4 +1,4 @@
1
- import { CfnResource } from 'aws-cdk-lib';
1
+ import { CfnResource, RemovalPolicy } from 'aws-cdk-lib';
2
2
  import { BillingMode, StreamViewType } from 'aws-cdk-lib/aws-dynamodb';
3
3
 
4
4
  const AMPLIFY_DYNAMODB_TABLE_RESOURCE_TYPE = 'Custom::AmplifyDynamoDBTable';
@@ -110,6 +110,14 @@ export class AmplifyDynamoDbTableWrapper {
110
110
  }
111
111
  }
112
112
 
113
+ /**
114
+ * Set the deletion policy of the resource based on the removal policy specified.
115
+ * @param policy removal policy to set
116
+ */
117
+ applyRemovalPolicy(policy: RemovalPolicy): void {
118
+ this.resource.applyRemovalPolicy(policy);
119
+ }
120
+
113
121
  /**
114
122
  * Specify how you are charged for read and write throughput and how you manage capacity.
115
123
  */
@@ -36,7 +36,7 @@ import type {
36
36
  FunctionSlot,
37
37
  IBackendOutputStorageStrategy,
38
38
  AddFunctionProps,
39
- ConflictResolution,
39
+ DataStoreConfiguration,
40
40
  IAmplifyGraphqlDefinition,
41
41
  } from './types';
42
42
  import {
@@ -120,9 +120,9 @@ export class AmplifyGraphqlApi extends Construct {
120
120
  public readonly apiId: string;
121
121
 
122
122
  /**
123
- * Conflict resolution setting
123
+ * DataStore conflict resolution setting
124
124
  */
125
- private readonly conflictResolution: ConflictResolution | undefined;
125
+ private readonly dataStoreConfiguration: DataStoreConfiguration | undefined;
126
126
 
127
127
  /**
128
128
  * Be very careful editing this value. This is the string that is used to identify graphql stacks in BI metrics
@@ -152,8 +152,17 @@ export class AmplifyGraphqlApi extends Construct {
152
152
  translationBehavior,
153
153
  functionNameMap,
154
154
  outputStorageStrategy,
155
+ dataStoreConfiguration,
155
156
  } = props;
156
157
 
158
+ if (conflictResolution && dataStoreConfiguration) {
159
+ throw new Error(
160
+ `conflictResolution is deprecated. conflictResolution and dataStoreConfiguration cannot be used together. Please use dataStoreConfiguration.`,
161
+ );
162
+ }
163
+
164
+ this.dataStoreConfiguration = dataStoreConfiguration || conflictResolution;
165
+
157
166
  const dataSources = getMetadataDataSources(definition);
158
167
 
159
168
  new AttributionMetadataStorage().storeAttributionMetadata(Stack.of(scope), this.stackType, path.join(__dirname, '..', 'package.json'), {
@@ -201,7 +210,7 @@ export class AmplifyGraphqlApi extends Construct {
201
210
  },
202
211
  authConfig,
203
212
  stackMapping: stackMappings ?? {},
204
- resolverConfig: conflictResolution ? convertToResolverConfig(conflictResolution) : undefined,
213
+ resolverConfig: this.dataStoreConfiguration ? convertToResolverConfig(this.dataStoreConfiguration) : undefined,
205
214
  transformParameters: {
206
215
  ...defaultTranslationBehavior,
207
216
  ...(translationBehavior ?? {}),
@@ -217,7 +226,6 @@ export class AmplifyGraphqlApi extends Construct {
217
226
  this.codegenAssets = new CodegenAssets(this, 'AmplifyCodegenAssets', { modelSchema: definition.schema });
218
227
 
219
228
  this.resources = getGeneratedResources(this);
220
- this.conflictResolution = conflictResolution;
221
229
  this.generatedFunctionSlots = getGeneratedFunctionSlots(assetManager.resolverAssets);
222
230
  this.storeOutput(outputStorageStrategy);
223
231
 
@@ -255,8 +263,8 @@ export class AmplifyGraphqlApi extends Construct {
255
263
  output.payload.awsAppsyncAdditionalAuthenticationTypes = additionalAuthTypes;
256
264
  }
257
265
 
258
- if (this.conflictResolution?.project?.handlerType) {
259
- output.payload.awsAppsyncConflictResolutionMode = this.conflictResolution?.project?.handlerType;
266
+ if (this.dataStoreConfiguration?.project?.handlerType) {
267
+ output.payload.awsAppsyncConflictResolutionMode = this.dataStoreConfiguration?.project?.handlerType;
260
268
  }
261
269
 
262
270
  outputStorageStrategy.addBackendOutputEntry(graphqlOutputKey, output);
package/src/index.ts CHANGED
@@ -20,6 +20,7 @@ export type {
20
20
  FunctionSlot,
21
21
  FunctionSlotOverride,
22
22
  ConflictResolution,
23
+ DataStoreConfiguration,
23
24
  ConflictDetectionType,
24
25
  OptimisticConflictResolutionStrategy,
25
26
  CustomConflictResolutionStrategy,
@@ -8,7 +8,7 @@ import {
8
8
  CfnDataSource,
9
9
  GraphqlApi,
10
10
  } from 'aws-cdk-lib/aws-appsync';
11
- import { CfnTable, Table } from 'aws-cdk-lib/aws-dynamodb';
11
+ import { CfnTable, Table, ITable } from 'aws-cdk-lib/aws-dynamodb';
12
12
  import { CfnRole, Role } from 'aws-cdk-lib/aws-iam';
13
13
  import { CfnResource, NestedStack } from 'aws-cdk-lib';
14
14
  import { getResourceName } from '@aws-amplify/graphql-transformer-core';
@@ -17,6 +17,16 @@ import { AmplifyGraphqlApiResources, FunctionSlot } from '../types';
17
17
  import { AmplifyDynamoDbTableWrapper } from '../amplify-dynamodb-table-wrapper';
18
18
  import { walkAndProcessNodes } from './construct-tree';
19
19
 
20
+ /**
21
+ * Check if a resource is implementing table interface
22
+ * The required properties need to be present in the input
23
+ * https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ITable.html#properties
24
+ * @param table table resource
25
+ * @returns whether the resource is a ITable or not
26
+ */
27
+ function isITable(table: any): table is ITable {
28
+ return 'env' in table && 'node' in table && 'stack' in table && 'tableArn' in table && 'tableName' in table;
29
+ }
20
30
  /**
21
31
  * Everything below here is intended to help us gather the
22
32
  * output values and render out the L1 resources for access.
@@ -33,7 +43,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
33
43
  const cfnResolvers: Record<string, CfnResolver> = {};
34
44
  const cfnFunctionConfigurations: Record<string, CfnFunctionConfiguration> = {};
35
45
  const cfnDataSources: Record<string, CfnDataSource> = {};
36
- const tables: Record<string, Table> = {};
46
+ const tables: Record<string, ITable> = {};
37
47
  const cfnTables: Record<string, CfnTable> = {};
38
48
  const amplifyDynamoDbTables: Record<string, AmplifyDynamoDbTableWrapper> = {};
39
49
  const roles: Record<string, Role> = {};
@@ -72,7 +82,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
72
82
  cfnFunctionConfigurations[resourceName] = currentScope;
73
83
  return;
74
84
  }
75
- if (currentScope instanceof Table) {
85
+ if (currentScope instanceof Table || isITable(currentScope)) {
76
86
  tables[resourceName] = currentScope;
77
87
  return;
78
88
  }
@@ -123,7 +133,6 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
123
133
  return {
124
134
  graphqlApi: GraphqlApi.fromGraphqlApiAttributes(scope, 'L2GraphqlApi', { graphqlApiId: cfnGraphqlApi.attrApiId }),
125
135
  tables,
126
- amplifyDynamoDbTables,
127
136
  roles,
128
137
  functions,
129
138
  nestedStacks,
@@ -135,6 +144,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
135
144
  cfnFunctionConfigurations,
136
145
  cfnDataSources,
137
146
  cfnTables,
147
+ amplifyDynamoDbTables,
138
148
  cfnRoles,
139
149
  cfnFunctions,
140
150
  additionalCfnResources,
@@ -6,12 +6,7 @@ import {
6
6
  isMutationNode,
7
7
  fieldsWithSqlDirective,
8
8
  } from '@aws-amplify/graphql-transformer-core';
9
- import {
10
- DataSourceStrategiesProvider,
11
- isSqlModelDataSourceSsmDbConnectionConfig,
12
- isSqlModelDataSourceSecretsManagerDbConnectionConfig,
13
- } from '@aws-amplify/graphql-transformer-interfaces';
14
- import { Token, Arn, ArnFormat } from 'aws-cdk-lib';
9
+ import { DataSourceStrategiesProvider } from '@aws-amplify/graphql-transformer-interfaces';
15
10
  import {
16
11
  CustomSqlDataSourceStrategy as ConstructCustomSqlDataSourceStrategy,
17
12
  ModelDataSourceStrategy as ConstructModelDataSourceStrategy,
@@ -189,47 +184,19 @@ export const schemaByMergingDefinitions = (definitions: IAmplifyGraphqlDefinitio
189
184
  * @param strategy user provided model data source strategy
190
185
  * @returns validates and throws an error if the strategy is invalid
191
186
  */
192
- export const validateDataSourceStrategy = (strategy: ConstructModelDataSourceStrategy): void => {
187
+ export const validateDataSourceStrategy = (strategy: ConstructModelDataSourceStrategy) => {
193
188
  if (!isSqlStrategy(strategy)) {
194
189
  return;
195
190
  }
196
191
 
197
192
  const dbConnectionConfig = strategy.dbConnectionConfig;
198
- if (isSqlModelDataSourceSsmDbConnectionConfig(dbConnectionConfig)) {
199
- const invalidSSMPaths = Object.values(dbConnectionConfig).filter((value) => typeof value === 'string' && !isValidSSMPath(value));
200
- if (invalidSSMPaths.length > 0) {
201
- throw new Error(
202
- `Invalid data source strategy "${
203
- strategy.name
204
- }". Following SSM paths must start with '/' in dbConnectionConfig: ${invalidSSMPaths.join(', ')}.`,
205
- );
206
- }
207
- } else if (isSqlModelDataSourceSecretsManagerDbConnectionConfig(dbConnectionConfig)) {
208
- if (!Token.isUnresolved(dbConnectionConfig.secretArn)) {
209
- try {
210
- const arnComponents = Arn.split(dbConnectionConfig.secretArn, ArnFormat.COLON_RESOURCE_NAME);
211
- if (arnComponents.service !== 'secretsmanager' || arnComponents.resource !== 'secret') {
212
- // error message does not matter because it inside try/catch
213
- throw new Error();
214
- }
215
- } catch {
216
- throw new Error(`Invalid data source strategy "${strategy.name}". The value of secretArn is not a valid Secrets Manager ARN.`);
217
- }
218
- }
219
-
220
- if (dbConnectionConfig.keyArn && !Token.isUnresolved(dbConnectionConfig.keyArn)) {
221
- try {
222
- const arnComponents = Arn.split(dbConnectionConfig.keyArn, ArnFormat.SLASH_RESOURCE_NAME);
223
- if (arnComponents.service !== 'kms' || arnComponents.resource !== 'key') {
224
- // error message does not matter because it inside try/catch
225
- throw new Error();
226
- }
227
- } catch {
228
- throw new Error(`Invalid data source strategy "${strategy.name}". The value of keyArn is not a valid KMS ARN.`);
229
- }
230
- }
231
- } else {
232
- throw new Error(`Invalid data source strategy "${strategy.name}". dbConnectionConfig does not include SSM paths or Secret ARN.`);
193
+ const invalidSSMPaths = Object.values(dbConnectionConfig).filter((value) => typeof value === 'string' && !isValidSSMPath(value));
194
+ if (invalidSSMPaths.length > 0) {
195
+ throw new Error(
196
+ `Invalid data source strategy "${
197
+ strategy.name
198
+ }". Following SSM paths must start with '/' in dbConnectionConfig: ${invalidSSMPaths.join(', ')}.`,
199
+ );
233
200
  }
234
201
  };
235
202
 
@@ -116,44 +116,12 @@ export interface SubnetAvailabilityZone {
116
116
  readonly availabilityZone: string;
117
117
  }
118
118
 
119
- /**
120
- * The credentials the lambda data source will use to connect to the database.
121
- *
122
- * @experimental
123
- */
124
- export type SqlModelDataSourceDbConnectionConfig =
125
- | SqlModelDataSourceSecretsManagerDbConnectionConfig
126
- | SqlModelDataSourceSsmDbConnectionConfig;
127
-
128
- /**
129
- * The credentials stored in Secrets Manager that the lambda data source will use to connect to the database.
130
- *
131
- * The managed secret should be in the same region as the lambda.
132
- * @experimental
133
- */
134
- export interface SqlModelDataSourceSecretsManagerDbConnectionConfig {
135
- /** The ARN of the managed secret with username, password, and hostname to use when connecting to the database. **/
136
- readonly secretArn: string;
137
-
138
- /** The ARN of the customer managed encryption key for the secret. If not supplied, the secret is expected to be encrypted with the default AWS-managed key. **/
139
- readonly keyArn?: string;
140
-
141
- /** The port number of the database proxy, cluster, or instance. */
142
- readonly port: number;
143
-
144
- /** The database name. */
145
- readonly databaseName: string;
146
-
147
- /** The hostame of the database. */
148
- readonly hostname: string;
149
- }
150
-
151
119
  /**
152
120
  * The Secure Systems Manager parameter paths the Lambda data source will use to connect to the database.
153
121
  *
154
122
  * These parameters are retrieved from Secure Systems Manager in the same region as the Lambda.
155
123
  */
156
- export interface SqlModelDataSourceSsmDbConnectionConfig {
124
+ export interface SqlModelDataSourceDbConnectionConfig {
157
125
  /** The Secure Systems Manager parameter containing the hostname of the database. For RDS-based SQL data sources, this can be the hostname
158
126
  * of a database proxy, cluster, or instance.
159
127
  */
@@ -1,12 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { isSqlDbType } from '@aws-amplify/graphql-transformer-core';
4
- import {
5
- SQLLambdaModelDataSourceStrategy,
6
- SqlModelDataSourceDbConnectionConfig,
7
- SqlModelDataSourceSsmDbConnectionConfig,
8
- SqlModelDataSourceSecretsManagerDbConnectionConfig,
9
- } from './model-datasource-strategy-types';
4
+ import { SQLLambdaModelDataSourceStrategy, SqlModelDataSourceDbConnectionConfig } from './model-datasource-strategy-types';
10
5
 
11
6
  /**
12
7
  * Type predicate that returns true if the object is a SQLLambdaModelDataSourceStrategy.
@@ -29,15 +24,6 @@ export const isSQLLambdaModelDataSourceStrategy = (obj: any): obj is SQLLambdaMo
29
24
  * @returns true if the object is shaped like a SqlModelDataSourceDbConnectionConfig
30
25
  */
31
26
  export const isSqlModelDataSourceDbConnectionConfig = (obj: any): obj is SqlModelDataSourceDbConnectionConfig => {
32
- return isSqlModelDataSourceSsmDbConnectionConfig(obj) || isSqlModelDataSourceSecretsManagerDbConnectionConfig(obj);
33
- };
34
-
35
- /**
36
- * Type predicate that returns true if the object is a SqlModelDataSourceSsmDbConnectionConfig.
37
- * @param obj the object to inspect
38
- * @returns true if the object is shaped like a SqlModelDataSourceSsmDbConnectionConfig
39
- */
40
- export const isSqlModelDataSourceSsmDbConnectionConfig = (obj: any): obj is SqlModelDataSourceSsmDbConnectionConfig => {
41
27
  return (
42
28
  (typeof obj === 'object' || typeof obj === 'function') &&
43
29
  typeof obj.hostnameSsmPath === 'string' &&
@@ -48,23 +34,6 @@ export const isSqlModelDataSourceSsmDbConnectionConfig = (obj: any): obj is SqlM
48
34
  );
49
35
  };
50
36
 
51
- /**
52
- * Type predicate that returns true if the object is a SqlModelDataSourceSecretsManagerDbConnectionConfig.
53
- * @param obj the object to inspect
54
- * @returns true if the object is shaped like a SqlModelDataSourceSecretsManagerDbConnectionConfig
55
- */
56
- export const isSqlModelDataSourceSecretsManagerDbConnectionConfig = (
57
- obj: any,
58
- ): obj is SqlModelDataSourceSecretsManagerDbConnectionConfig => {
59
- return (
60
- (typeof obj === 'object' || typeof obj === 'function') &&
61
- typeof obj.secretArn === 'string' &&
62
- typeof obj.port === 'number' &&
63
- typeof obj.databaseName === 'string' &&
64
- typeof obj.hostname == 'string'
65
- );
66
- };
67
-
68
37
  /**
69
38
  * Class exposing utilities to produce SQLLambdaModelDataSourceStrategy objects given various inputs.
70
39
  */