@aws-amplify/graphql-model-transformer 2.2.0-rds-1.0 → 2.2.0-rds-2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -1
- package/lib/graphql-model-transformer.d.ts.map +1 -1
- package/lib/graphql-model-transformer.js +2 -1
- package/lib/graphql-model-transformer.js.map +1 -1
- package/lib/rds-lambda.zip +0 -0
- package/lib/rds-notification-lambda.zip +0 -0
- package/lib/rds-patching-lambda.zip +0 -0
- package/lib/resolvers/rds/mutation.d.ts.map +1 -1
- package/lib/resolvers/rds/mutation.js +67 -58
- package/lib/resolvers/rds/mutation.js.map +1 -1
- package/lib/resolvers/rds/query.d.ts.map +1 -1
- package/lib/resolvers/rds/query.js +2 -1
- package/lib/resolvers/rds/query.js.map +1 -1
- package/lib/resolvers/rds/resolver.d.ts +2 -2
- package/lib/resolvers/rds/resolver.d.ts.map +1 -1
- package/lib/resolvers/rds/resolver.js +66 -19
- package/lib/resolvers/rds/resolver.js.map +1 -1
- package/lib/resources/rds-model-resource-generator.d.ts.map +1 -1
- package/lib/resources/rds-model-resource-generator.js +1 -2
- package/lib/resources/rds-model-resource-generator.js.map +1 -1
- package/package.json +7 -7
- package/publish-notification-lambda/node_modules/.package-lock.json +35 -14
- package/publish-notification-lambda/node_modules/@types/node/README.md +1 -1
- package/publish-notification-lambda/node_modules/@types/node/package.json +2 -2
- package/publish-notification-lambda/node_modules/compress-commons/CHANGELOG.md +2 -0
- package/publish-notification-lambda/node_modules/compress-commons/package.json +5 -5
- package/publish-notification-lambda/node_modules/crc32-stream/CHANGELOG.md +2 -0
- package/publish-notification-lambda/node_modules/crc32-stream/package.json +3 -3
- package/publish-notification-lambda/node_modules/zip-stream/CHANGELOG.md +2 -0
- package/publish-notification-lambda/node_modules/zip-stream/node_modules/archiver-utils/LICENSE +22 -0
- package/publish-notification-lambda/node_modules/zip-stream/node_modules/archiver-utils/README.md +6 -0
- package/publish-notification-lambda/node_modules/zip-stream/node_modules/archiver-utils/package.json +54 -0
- package/publish-notification-lambda/node_modules/zip-stream/package.json +10 -10
- package/publish-notification-lambda/package-lock.json +35 -14
- package/rds-lambda/handler.ts +5 -1
- package/rds-lambda/node_modules/.package-lock.json +104 -84
- package/rds-lambda/node_modules/@babel/core/package.json +14 -14
- package/rds-lambda/node_modules/@babel/core/src/config/files/index-browser.ts +2 -2
- package/rds-lambda/node_modules/@babel/core/src/config/files/index.ts +4 -4
- package/rds-lambda/node_modules/@babel/core/src/config/resolve-targets-browser.ts +1 -1
- package/rds-lambda/node_modules/@babel/core/src/config/resolve-targets.ts +1 -1
- package/rds-lambda/node_modules/@babel/core/src/transform-file.ts +5 -5
- package/rds-lambda/node_modules/@babel/generator/package.json +4 -4
- package/rds-lambda/node_modules/@babel/helper-compilation-targets/package.json +2 -2
- package/rds-lambda/node_modules/@babel/helper-module-imports/README.md +1 -1
- package/rds-lambda/node_modules/@babel/helper-module-imports/package.json +4 -4
- package/rds-lambda/node_modules/@babel/helper-module-transforms/package.json +5 -5
- package/rds-lambda/node_modules/@babel/helper-validator-identifier/README.md +1 -1
- package/rds-lambda/node_modules/@babel/helper-validator-identifier/package.json +1 -1
- package/rds-lambda/node_modules/@babel/helper-validator-option/README.md +1 -1
- package/rds-lambda/node_modules/@babel/helper-validator-option/package.json +1 -1
- package/rds-lambda/node_modules/@babel/helpers/package.json +6 -6
- package/rds-lambda/node_modules/@babel/parser/package.json +2 -2
- package/rds-lambda/node_modules/@babel/template/README.md +1 -1
- package/rds-lambda/node_modules/@babel/template/package.json +4 -4
- package/rds-lambda/node_modules/@babel/traverse/package.json +6 -6
- package/rds-lambda/node_modules/@babel/types/package.json +4 -4
- package/rds-lambda/node_modules/@types/node/README.md +1 -1
- package/rds-lambda/node_modules/@types/node/package.json +2 -2
- package/rds-lambda/node_modules/caniuse-lite/package.json +1 -1
- package/rds-lambda/node_modules/compress-commons/CHANGELOG.md +2 -0
- package/rds-lambda/node_modules/compress-commons/package.json +5 -5
- package/rds-lambda/node_modules/crc32-stream/CHANGELOG.md +2 -0
- package/rds-lambda/node_modules/crc32-stream/package.json +3 -3
- package/rds-lambda/node_modules/electron-to-chromium/full-chromium-versions.json +1 -1
- package/rds-lambda/node_modules/electron-to-chromium/full-versions.json +1 -1
- package/rds-lambda/node_modules/electron-to-chromium/package.json +1 -1
- package/rds-lambda/node_modules/electron-to-chromium/versions.json +1 -1
- package/rds-lambda/node_modules/pure-rand/CHANGELOG.md +6 -0
- package/rds-lambda/node_modules/pure-rand/package.json +20 -15
- package/rds-lambda/node_modules/zip-stream/CHANGELOG.md +2 -0
- package/rds-lambda/node_modules/zip-stream/node_modules/archiver-utils/LICENSE +22 -0
- package/rds-lambda/node_modules/zip-stream/node_modules/archiver-utils/README.md +6 -0
- package/rds-lambda/node_modules/zip-stream/node_modules/archiver-utils/package.json +54 -0
- package/rds-lambda/node_modules/zip-stream/package.json +10 -10
- package/rds-lambda/package-lock.json +104 -84
- package/rds-patching-lambda/node_modules/.package-lock.json +35 -14
- package/rds-patching-lambda/node_modules/@types/node/README.md +1 -1
- package/rds-patching-lambda/node_modules/@types/node/package.json +2 -2
- package/rds-patching-lambda/node_modules/compress-commons/CHANGELOG.md +2 -0
- package/rds-patching-lambda/node_modules/compress-commons/package.json +5 -5
- package/rds-patching-lambda/node_modules/crc32-stream/CHANGELOG.md +2 -0
- package/rds-patching-lambda/node_modules/crc32-stream/package.json +3 -3
- package/rds-patching-lambda/node_modules/zip-stream/CHANGELOG.md +2 -0
- package/rds-patching-lambda/node_modules/zip-stream/node_modules/archiver-utils/LICENSE +22 -0
- package/rds-patching-lambda/node_modules/zip-stream/node_modules/archiver-utils/README.md +6 -0
- package/rds-patching-lambda/node_modules/zip-stream/node_modules/archiver-utils/package.json +54 -0
- package/rds-patching-lambda/node_modules/zip-stream/package.json +10 -10
- package/rds-patching-lambda/package-lock.json +35 -14
- package/src/__tests__/__snapshots__/model-transformer.test.ts.snap +26 -26
- package/src/__tests__/model-transformer.test.ts +60 -2
- package/src/graphql-model-transformer.ts +2 -1
- package/src/resolvers/rds/mutation.ts +15 -9
- package/src/resolvers/rds/query.ts +2 -1
- package/src/resolvers/rds/resolver.ts +73 -7
- package/src/resources/rds-model-resource-generator.ts +1 -2
- package/tsconfig.tsbuildinfo +1 -1
@@ -1,5 +1,7 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
**4.1.2** — <small>_September 2, 2023_</small> — [Diff](https://github.com/archiverjs/node-compress-commons/compare/4.1.1...4.1.2)
|
4
|
+
|
3
5
|
**4.1.1** — <small>_May 30th, 2021_</small> — [Diff](https://github.com/archiverjs/node-compress-commons/compare/4.1.0...4.1.1)
|
4
6
|
|
5
7
|
### Maintenance
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "compress-commons",
|
3
|
-
"version": "4.1.
|
3
|
+
"version": "4.1.2",
|
4
4
|
"description": "a library that defines a common interface for working with archive formats within node",
|
5
5
|
"homepage": "https://github.com/archiverjs/node-compress-commons",
|
6
6
|
"author": {
|
@@ -32,10 +32,10 @@
|
|
32
32
|
"readable-stream": "^3.6.0"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"chai": "
|
36
|
-
"mkdirp": "
|
37
|
-
"mocha": "
|
38
|
-
"rimraf": "
|
35
|
+
"chai": "4.3.8",
|
36
|
+
"mkdirp": "2.1.6",
|
37
|
+
"mocha": "9.2.2",
|
38
|
+
"rimraf": "3.0.2"
|
39
39
|
},
|
40
40
|
"keywords": [
|
41
41
|
"compress",
|
@@ -1,5 +1,7 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
**4.0.3** — <small>_September 2, 2023_</small> — [Diff](https://github.com/archiverjs/node-crc32-stream/compare/4.0.2...4.0.3)
|
4
|
+
|
3
5
|
**4.0.2** — <small>_February 3, 2021_</small> — [Diff](https://github.com/archiverjs/node-crc32-stream/compare/4.0.1...4.0.2)
|
4
6
|
|
5
7
|
### Bug Fixes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "crc32-stream",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.3",
|
4
4
|
"description": "a streaming CRC32 checksumer",
|
5
5
|
"homepage": "https://github.com/archiverjs/node-crc32-stream",
|
6
6
|
"author": {
|
@@ -30,8 +30,8 @@
|
|
30
30
|
"readable-stream": "^3.4.0"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
|
-
"chai": "
|
34
|
-
"mocha": "
|
33
|
+
"chai": "4.3.8",
|
34
|
+
"mocha": "9.2.2"
|
35
35
|
},
|
36
36
|
"keywords": [
|
37
37
|
"crc32-stream",
|
@@ -1,5 +1,7 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
**4.1.1** - <small>September 2, 2023</small> — [Diff](https://github.com/archiverjs/node-zip-stream/compare/4.1.0...4.1.1)
|
4
|
+
|
3
5
|
**4.1.0** - <small>March 2, 2021</small> — [Diff](https://github.com/archiverjs/node-zip-stream/compare/4.0.5...4.1.0)
|
4
6
|
|
5
7
|
## Features
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Chris Talkington.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Archiver Utils
|
2
|
+
|
3
|
+
## Things of Interest
|
4
|
+
- [Changelog](https://github.com/archiverjs/archiver-utils/releases)
|
5
|
+
- [Contributing](https://github.com/archiverjs/archiver-utils/blob/master/CONTRIBUTING.md)
|
6
|
+
- [MIT License](https://github.com/archiverjs/archiver-utils/blob/master/LICENSE)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
{
|
2
|
+
"name": "archiver-utils",
|
3
|
+
"version": "3.0.4",
|
4
|
+
"license": "MIT",
|
5
|
+
"description": "utility functions for archiver",
|
6
|
+
"homepage": "https://github.com/archiverjs/archiver-utils#readme",
|
7
|
+
"author": {
|
8
|
+
"name": "Chris Talkington",
|
9
|
+
"url": "http://christalkington.com/"
|
10
|
+
},
|
11
|
+
"repository": {
|
12
|
+
"type": "git",
|
13
|
+
"url": "https://github.com/archiverjs/archiver-utils.git"
|
14
|
+
},
|
15
|
+
"bugs": {
|
16
|
+
"url": "https://github.com/archiverjs/archiver-utils/issues"
|
17
|
+
},
|
18
|
+
"keywords": [
|
19
|
+
"archiver",
|
20
|
+
"utils"
|
21
|
+
],
|
22
|
+
"main": "index.js",
|
23
|
+
"files": [
|
24
|
+
"index.js",
|
25
|
+
"file.js"
|
26
|
+
],
|
27
|
+
"engines": {
|
28
|
+
"node": ">= 10"
|
29
|
+
},
|
30
|
+
"scripts": {
|
31
|
+
"test": "mocha --reporter dot"
|
32
|
+
},
|
33
|
+
"dependencies": {
|
34
|
+
"glob": "^7.2.3",
|
35
|
+
"graceful-fs": "^4.2.0",
|
36
|
+
"lazystream": "^1.0.0",
|
37
|
+
"lodash.defaults": "^4.2.0",
|
38
|
+
"lodash.difference": "^4.5.0",
|
39
|
+
"lodash.flatten": "^4.4.0",
|
40
|
+
"lodash.isplainobject": "^4.0.6",
|
41
|
+
"lodash.union": "^4.6.0",
|
42
|
+
"normalize-path": "^3.0.0",
|
43
|
+
"readable-stream": "^3.6.0"
|
44
|
+
},
|
45
|
+
"devDependencies": {
|
46
|
+
"chai": "4.3.8",
|
47
|
+
"mkdirp": "3.0.1",
|
48
|
+
"mocha": "9.2.2",
|
49
|
+
"rimraf": "3.0.2"
|
50
|
+
},
|
51
|
+
"publishConfig": {
|
52
|
+
"registry": "https://registry.npmjs.org/"
|
53
|
+
}
|
54
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "zip-stream",
|
3
|
-
"version": "4.1.
|
3
|
+
"version": "4.1.1",
|
4
4
|
"description": "a streaming zip archive generator.",
|
5
5
|
"homepage": "https://github.com/archiverjs/node-zip-stream",
|
6
6
|
"author": {
|
@@ -27,18 +27,18 @@
|
|
27
27
|
"jsdoc": "jsdoc -c jsdoc.json README.md"
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
|
-
"archiver-utils": "^
|
31
|
-
"compress-commons": "^4.1.
|
30
|
+
"archiver-utils": "^3.0.4",
|
31
|
+
"compress-commons": "^4.1.2",
|
32
32
|
"readable-stream": "^3.6.0"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"archiver-jsdoc-theme": "
|
36
|
-
"chai": "
|
37
|
-
"jsdoc": "
|
38
|
-
"minami": "
|
39
|
-
"mkdirp": "
|
40
|
-
"mocha": "
|
41
|
-
"rimraf": "
|
35
|
+
"archiver-jsdoc-theme": "1.1.3",
|
36
|
+
"chai": "4.3.8",
|
37
|
+
"jsdoc": "3.6.11",
|
38
|
+
"minami": "1.2.3",
|
39
|
+
"mkdirp": "2.1.6",
|
40
|
+
"mocha": "9.2.2",
|
41
|
+
"rimraf": "3.0.2"
|
42
42
|
},
|
43
43
|
"keywords": [
|
44
44
|
"archive",
|
@@ -1089,9 +1089,9 @@
|
|
1089
1089
|
}
|
1090
1090
|
},
|
1091
1091
|
"node_modules/@types/node": {
|
1092
|
-
"version": "20.5.
|
1093
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.
|
1094
|
-
"integrity": "sha512-
|
1092
|
+
"version": "20.5.9",
|
1093
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.9.tgz",
|
1094
|
+
"integrity": "sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==",
|
1095
1095
|
"dev": true
|
1096
1096
|
},
|
1097
1097
|
"node_modules/ansi-regex": {
|
@@ -1327,9 +1327,9 @@
|
|
1327
1327
|
"dev": true
|
1328
1328
|
},
|
1329
1329
|
"node_modules/compress-commons": {
|
1330
|
-
"version": "4.1.
|
1331
|
-
"resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.
|
1332
|
-
"integrity": "sha512-
|
1330
|
+
"version": "4.1.2",
|
1331
|
+
"resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.2.tgz",
|
1332
|
+
"integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==",
|
1333
1333
|
"dev": true,
|
1334
1334
|
"dependencies": {
|
1335
1335
|
"buffer-crc32": "^0.2.13",
|
@@ -1366,9 +1366,9 @@
|
|
1366
1366
|
}
|
1367
1367
|
},
|
1368
1368
|
"node_modules/crc32-stream": {
|
1369
|
-
"version": "4.0.
|
1370
|
-
"resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.
|
1371
|
-
"integrity": "sha512-
|
1369
|
+
"version": "4.0.3",
|
1370
|
+
"resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.3.tgz",
|
1371
|
+
"integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==",
|
1372
1372
|
"dev": true,
|
1373
1373
|
"dependencies": {
|
1374
1374
|
"crc-32": "^1.2.0",
|
@@ -1879,13 +1879,34 @@
|
|
1879
1879
|
}
|
1880
1880
|
},
|
1881
1881
|
"node_modules/zip-stream": {
|
1882
|
-
"version": "4.1.
|
1883
|
-
"resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.
|
1884
|
-
"integrity": "sha512-
|
1882
|
+
"version": "4.1.1",
|
1883
|
+
"resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.1.tgz",
|
1884
|
+
"integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==",
|
1885
1885
|
"dev": true,
|
1886
1886
|
"dependencies": {
|
1887
|
-
"archiver-utils": "^
|
1888
|
-
"compress-commons": "^4.1.
|
1887
|
+
"archiver-utils": "^3.0.4",
|
1888
|
+
"compress-commons": "^4.1.2",
|
1889
|
+
"readable-stream": "^3.6.0"
|
1890
|
+
},
|
1891
|
+
"engines": {
|
1892
|
+
"node": ">= 10"
|
1893
|
+
}
|
1894
|
+
},
|
1895
|
+
"node_modules/zip-stream/node_modules/archiver-utils": {
|
1896
|
+
"version": "3.0.4",
|
1897
|
+
"resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-3.0.4.tgz",
|
1898
|
+
"integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==",
|
1899
|
+
"dev": true,
|
1900
|
+
"dependencies": {
|
1901
|
+
"glob": "^7.2.3",
|
1902
|
+
"graceful-fs": "^4.2.0",
|
1903
|
+
"lazystream": "^1.0.0",
|
1904
|
+
"lodash.defaults": "^4.2.0",
|
1905
|
+
"lodash.difference": "^4.5.0",
|
1906
|
+
"lodash.flatten": "^4.4.0",
|
1907
|
+
"lodash.isplainobject": "^4.0.6",
|
1908
|
+
"lodash.union": "^4.6.0",
|
1909
|
+
"normalize-path": "^3.0.0",
|
1889
1910
|
"readable-stream": "^3.6.0"
|
1890
1911
|
},
|
1891
1912
|
"engines": {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
-
exports[`ModelTransformer:
|
3
|
+
exports[`ModelTransformer: id with non string type should require the field on create mutation 1`] = `
|
4
4
|
"type Task {
|
5
5
|
id: Int!
|
6
6
|
title: String!
|
@@ -219,7 +219,7 @@ type Subscription {
|
|
219
219
|
"
|
220
220
|
`;
|
221
221
|
|
222
|
-
exports[`ModelTransformer:
|
222
|
+
exports[`ModelTransformer: should filter known input types from create and update input fields 1`] = `
|
223
223
|
"type Test {
|
224
224
|
id: ID!
|
225
225
|
email: Email
|
@@ -504,7 +504,7 @@ input ModelSubscriptionEmailFilterInput {
|
|
504
504
|
"
|
505
505
|
`;
|
506
506
|
|
507
|
-
exports[`ModelTransformer:
|
507
|
+
exports[`ModelTransformer: should generate enum input objects 1`] = `
|
508
508
|
"type Post {
|
509
509
|
id: ID!
|
510
510
|
title: String!
|
@@ -1029,7 +1029,7 @@ input ModelSubscriptionCommentFilterInput {
|
|
1029
1029
|
"
|
1030
1030
|
`;
|
1031
1031
|
|
1032
|
-
exports[`ModelTransformer:
|
1032
|
+
exports[`ModelTransformer: should generate sync resolver with ConflictHandlerType.Automerge 1`] = `
|
1033
1033
|
Object {
|
1034
1034
|
"Mutation.createPost.init.1.req.vtl": "## [Start] Initialization default values. **
|
1035
1035
|
$util.qr($ctx.stash.put(\\"defaultValues\\", $util.defaultIfNull($ctx.stash.defaultValues, {})))
|
@@ -1616,7 +1616,7 @@ $util.toJson(null)
|
|
1616
1616
|
}
|
1617
1617
|
`;
|
1618
1618
|
|
1619
|
-
exports[`ModelTransformer:
|
1619
|
+
exports[`ModelTransformer: should generate sync resolver with ConflictHandlerType.LAMBDA 1`] = `
|
1620
1620
|
Object {
|
1621
1621
|
"Mutation.createPost.init.1.req.vtl": "## [Start] Initialization default values. **
|
1622
1622
|
$util.qr($ctx.stash.put(\\"defaultValues\\", $util.defaultIfNull($ctx.stash.defaultValues, {})))
|
@@ -2203,7 +2203,7 @@ $util.toJson(null)
|
|
2203
2203
|
}
|
2204
2204
|
`;
|
2205
2205
|
|
2206
|
-
exports[`ModelTransformer:
|
2206
|
+
exports[`ModelTransformer: should generate sync resolver with ConflictHandlerType.Optimistic 1`] = `
|
2207
2207
|
Object {
|
2208
2208
|
"Mutation.createPost.init.1.req.vtl": "## [Start] Initialization default values. **
|
2209
2209
|
$util.qr($ctx.stash.put(\\"defaultValues\\", $util.defaultIfNull($ctx.stash.defaultValues, {})))
|
@@ -2790,7 +2790,7 @@ $util.toJson(null)
|
|
2790
2790
|
}
|
2791
2791
|
`;
|
2792
2792
|
|
2793
|
-
exports[`ModelTransformer:
|
2793
|
+
exports[`ModelTransformer: should have timestamps as nullable fields when the type makes it non-nullable 1`] = `
|
2794
2794
|
"type Post {
|
2795
2795
|
id: ID!
|
2796
2796
|
str: String
|
@@ -3029,7 +3029,7 @@ type Subscription {
|
|
3029
3029
|
"
|
3030
3030
|
`;
|
3031
3031
|
|
3032
|
-
exports[`ModelTransformer:
|
3032
|
+
exports[`ModelTransformer: should have timestamps as nullable fields when the type makes it non-nullable 2`] = `
|
3033
3033
|
"## [Start] Create Request template. **
|
3034
3034
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
3035
3035
|
## Set the default values to put request **
|
@@ -3098,7 +3098,7 @@ $util.toJson($PutObject)
|
|
3098
3098
|
## [End] Create Request template. **"
|
3099
3099
|
`;
|
3100
3100
|
|
3101
|
-
exports[`ModelTransformer:
|
3101
|
+
exports[`ModelTransformer: should have timestamps as nullable fields when the type makes it non-nullable 3`] = `
|
3102
3102
|
"## [Start] Mutation Update resolver. **
|
3103
3103
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
3104
3104
|
## Set the default values to put request **
|
@@ -3232,7 +3232,7 @@ $util.toJson($UpdateItem)
|
|
3232
3232
|
## [End] Mutation Update resolver. **"
|
3233
3233
|
`;
|
3234
3234
|
|
3235
|
-
exports[`ModelTransformer:
|
3235
|
+
exports[`ModelTransformer: should not add default primary key when ID is defined 1`] = `
|
3236
3236
|
"## [Start] Create Request template. **
|
3237
3237
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
3238
3238
|
## Set the default values to put request **
|
@@ -3301,7 +3301,7 @@ $util.toJson($PutObject)
|
|
3301
3301
|
## [End] Create Request template. **"
|
3302
3302
|
`;
|
3303
3303
|
|
3304
|
-
exports[`ModelTransformer:
|
3304
|
+
exports[`ModelTransformer: should not generate superfluous input and filter types 1`] = `
|
3305
3305
|
"type Entity {
|
3306
3306
|
id: ID!
|
3307
3307
|
str: String
|
@@ -3465,7 +3465,7 @@ type Query {
|
|
3465
3465
|
"
|
3466
3466
|
`;
|
3467
3467
|
|
3468
|
-
exports[`ModelTransformer:
|
3468
|
+
exports[`ModelTransformer: should not to auto generate createdAt and updatedAt when the type in schema is not AWSDateTime 1`] = `
|
3469
3469
|
"type Post {
|
3470
3470
|
id: ID!
|
3471
3471
|
str: String
|
@@ -3704,7 +3704,7 @@ type Subscription {
|
|
3704
3704
|
"
|
3705
3705
|
`;
|
3706
3706
|
|
3707
|
-
exports[`ModelTransformer:
|
3707
|
+
exports[`ModelTransformer: should not to auto generate createdAt and updatedAt when the type in schema is not AWSDateTime 2`] = `
|
3708
3708
|
"## [Start] Create Request template. **
|
3709
3709
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
3710
3710
|
## Set the default values to put request **
|
@@ -3773,7 +3773,7 @@ $util.toJson($PutObject)
|
|
3773
3773
|
## [End] Create Request template. **"
|
3774
3774
|
`;
|
3775
3775
|
|
3776
|
-
exports[`ModelTransformer:
|
3776
|
+
exports[`ModelTransformer: should not to auto generate createdAt and updatedAt when the type in schema is not AWSDateTime 3`] = `
|
3777
3777
|
"## [Start] Mutation Update resolver. **
|
3778
3778
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
3779
3779
|
## Set the default values to put request **
|
@@ -3907,7 +3907,7 @@ $util.toJson($UpdateItem)
|
|
3907
3907
|
## [End] Mutation Update resolver. **"
|
3908
3908
|
`;
|
3909
3909
|
|
3910
|
-
exports[`ModelTransformer:
|
3910
|
+
exports[`ModelTransformer: should not to include createdAt and updatedAt field when timestamps is set to null 1`] = `
|
3911
3911
|
"type Post {
|
3912
3912
|
id: ID!
|
3913
3913
|
str: String
|
@@ -4134,7 +4134,7 @@ type Subscription {
|
|
4134
4134
|
"
|
4135
4135
|
`;
|
4136
4136
|
|
4137
|
-
exports[`ModelTransformer:
|
4137
|
+
exports[`ModelTransformer: should not to include createdAt and updatedAt field when timestamps is set to null 2`] = `
|
4138
4138
|
"## [Start] Create Request template. **
|
4139
4139
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
4140
4140
|
## Set the default values to put request **
|
@@ -4203,7 +4203,7 @@ $util.toJson($PutObject)
|
|
4203
4203
|
## [End] Create Request template. **"
|
4204
4204
|
`;
|
4205
4205
|
|
4206
|
-
exports[`ModelTransformer:
|
4206
|
+
exports[`ModelTransformer: should not to include createdAt and updatedAt field when timestamps is set to null 3`] = `
|
4207
4207
|
"## [Start] Mutation Update resolver. **
|
4208
4208
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
4209
4209
|
## Set the default values to put request **
|
@@ -4337,7 +4337,7 @@ $util.toJson($UpdateItem)
|
|
4337
4337
|
## [End] Mutation Update resolver. **"
|
4338
4338
|
`;
|
4339
4339
|
|
4340
|
-
exports[`ModelTransformer:
|
4340
|
+
exports[`ModelTransformer: should successfully transform rds schema with array and object fields 1`] = `
|
4341
4341
|
"type Note {
|
4342
4342
|
id: ID!
|
4343
4343
|
content: String!
|
@@ -4572,7 +4572,7 @@ type Subscription {
|
|
4572
4572
|
"
|
4573
4573
|
`;
|
4574
4574
|
|
4575
|
-
exports[`ModelTransformer:
|
4575
|
+
exports[`ModelTransformer: should successfully transform rds schema with array and object fields 2`] = `
|
4576
4576
|
Object {
|
4577
4577
|
"Mutation.createNote.init.1.req.vtl": "## [Start] Initialization default values. **
|
4578
4578
|
$util.qr($ctx.stash.put(\\"defaultValues\\", $util.defaultIfNull($ctx.stash.defaultValues, {})))
|
@@ -4806,7 +4806,7 @@ $util.toJson(null)
|
|
4806
4806
|
}
|
4807
4807
|
`;
|
4808
4808
|
|
4809
|
-
exports[`ModelTransformer:
|
4809
|
+
exports[`ModelTransformer: should successfully transform simple Embeddable type (non-model) schema 1`] = `
|
4810
4810
|
"type NonModelType {
|
4811
4811
|
id: ID!
|
4812
4812
|
title: String!
|
@@ -4964,7 +4964,7 @@ enum ModelSortDirection {
|
|
4964
4964
|
"
|
4965
4965
|
`;
|
4966
4966
|
|
4967
|
-
exports[`ModelTransformer:
|
4967
|
+
exports[`ModelTransformer: should successfully transform simple non-capitalized Model/Embeddable type (non-model) name schema 1`] = `
|
4968
4968
|
"type modelType {
|
4969
4969
|
id: ID!
|
4970
4970
|
title: String!
|
@@ -5206,7 +5206,7 @@ type Subscription {
|
|
5206
5206
|
"
|
5207
5207
|
`;
|
5208
5208
|
|
5209
|
-
exports[`ModelTransformer:
|
5209
|
+
exports[`ModelTransformer: should support timestamp parameters when generating resolvers and output schema 1`] = `
|
5210
5210
|
"type Post {
|
5211
5211
|
id: ID!
|
5212
5212
|
str: String
|
@@ -5435,7 +5435,7 @@ type Subscription {
|
|
5435
5435
|
"
|
5436
5436
|
`;
|
5437
5437
|
|
5438
|
-
exports[`ModelTransformer:
|
5438
|
+
exports[`ModelTransformer: should support timestamp parameters when generating resolvers and output schema 2`] = `
|
5439
5439
|
"## [Start] Create Request template. **
|
5440
5440
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
5441
5441
|
## Set the default values to put request **
|
@@ -5504,7 +5504,7 @@ $util.toJson($PutObject)
|
|
5504
5504
|
## [End] Create Request template. **"
|
5505
5505
|
`;
|
5506
5506
|
|
5507
|
-
exports[`ModelTransformer:
|
5507
|
+
exports[`ModelTransformer: should support timestamp parameters when generating resolvers and output schema 3`] = `
|
5508
5508
|
"## [Start] Mutation Update resolver. **
|
5509
5509
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
5510
5510
|
## Set the default values to put request **
|
@@ -5638,7 +5638,7 @@ $util.toJson($UpdateItem)
|
|
5638
5638
|
## [End] Mutation Update resolver. **"
|
5639
5639
|
`;
|
5640
5640
|
|
5641
|
-
exports[`ModelTransformer:
|
5641
|
+
exports[`ModelTransformer: the datastore table should be configured 1`] = `
|
5642
5642
|
"## [Start] Sync Request template. **
|
5643
5643
|
#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) )
|
5644
5644
|
#set( $queryFilterContainsAuthField = false )
|
@@ -5722,7 +5722,7 @@ null
|
|
5722
5722
|
## [End] Sync Request template. **"
|
5723
5723
|
`;
|
5724
5724
|
|
5725
|
-
exports[`ModelTransformer:
|
5725
|
+
exports[`ModelTransformer: the datastore table should be configured 2`] = `
|
5726
5726
|
"## [Start] ResponseTemplate. **
|
5727
5727
|
#if( $ctx.error )
|
5728
5728
|
$util.error($ctx.error.message, $ctx.error.type, $ctx.result)
|
@@ -15,8 +15,9 @@ import {
|
|
15
15
|
verifyInputCount,
|
16
16
|
verifyMatchingTypes,
|
17
17
|
} from './test-utils/helpers';
|
18
|
+
import { VpcSubnetConfig } from '@aws-amplify/graphql-transformer-interfaces';
|
18
19
|
|
19
|
-
describe('ModelTransformer:
|
20
|
+
describe('ModelTransformer:', () => {
|
20
21
|
it('should successfully transform simple valid schema', async () => {
|
21
22
|
const validSchema = `
|
22
23
|
type Post @model {
|
@@ -626,7 +627,7 @@ describe('ModelTransformer: ', () => {
|
|
626
627
|
expect(verifyInputCount(parsed, 'TagInput', 1)).toBeTruthy();
|
627
628
|
});
|
628
629
|
|
629
|
-
it('
|
630
|
+
it('should generate filter inputs', () => {
|
630
631
|
const validSchema = `
|
631
632
|
type Post @model {
|
632
633
|
id: ID!
|
@@ -1569,4 +1570,61 @@ describe('ModelTransformer: ', () => {
|
|
1569
1570
|
expect(out.schema).toMatchSnapshot();
|
1570
1571
|
expect(out.resolvers).toMatchSnapshot();
|
1571
1572
|
});
|
1573
|
+
|
1574
|
+
it('sql lambda with vpc config should generate correct stack', async () => {
|
1575
|
+
const validSchema = `
|
1576
|
+
type Note @model {
|
1577
|
+
id: ID!
|
1578
|
+
content: String!
|
1579
|
+
}
|
1580
|
+
`;
|
1581
|
+
|
1582
|
+
const modelToDatasourceMap = new Map<string, DatasourceType>();
|
1583
|
+
modelToDatasourceMap.set('Note', {
|
1584
|
+
dbType: 'MySQL',
|
1585
|
+
provisionDB: false,
|
1586
|
+
});
|
1587
|
+
const sqlLambdaVpcConfig: VpcSubnetConfig = {
|
1588
|
+
vpcConfig: {
|
1589
|
+
vpcId: 'vpc-123',
|
1590
|
+
subnetIds: ['sub-123', 'sub-456'],
|
1591
|
+
securityGroupIds: ['sg-123'],
|
1592
|
+
},
|
1593
|
+
subnetAvailabilityZoneConfig: [
|
1594
|
+
{
|
1595
|
+
SubnetId: 'sub-123',
|
1596
|
+
AvailabilityZone: 'az-123'
|
1597
|
+
},
|
1598
|
+
{
|
1599
|
+
SubnetId: 'sub-456',
|
1600
|
+
AvailabilityZone: 'az-456'
|
1601
|
+
},
|
1602
|
+
],
|
1603
|
+
}
|
1604
|
+
const out = testTransform({
|
1605
|
+
schema: validSchema,
|
1606
|
+
transformers: [new ModelTransformer()],
|
1607
|
+
modelToDatasourceMap,
|
1608
|
+
sqlLambdaVpcConfig,
|
1609
|
+
});
|
1610
|
+
expect(out).toBeDefined();
|
1611
|
+
|
1612
|
+
validateModelSchema(parse(out.schema));
|
1613
|
+
expect(out.stacks).toBeDefined();
|
1614
|
+
expect(out.stacks.RdsApiStack).toBeDefined();
|
1615
|
+
expect(out.stacks.RdsApiStack.Resources).toBeDefined();
|
1616
|
+
const resourcesIds = Object.keys(out.stacks.RdsApiStack.Resources!) as string[];
|
1617
|
+
const sqlLambda = out.stacks.RdsApiStack.Resources![resourcesIds.find((resource) => resource.startsWith('RDSLambdaLogicalID'))!];
|
1618
|
+
expect(sqlLambda).toBeDefined();
|
1619
|
+
expect(sqlLambda.Properties).toBeDefined();
|
1620
|
+
expect(sqlLambda.Properties?.VpcConfig).toBeDefined();
|
1621
|
+
expect(sqlLambda.Properties?.VpcConfig?.SubnetIds).toBeDefined();
|
1622
|
+
expect(sqlLambda.Properties?.VpcConfig?.SubnetIds).toEqual(
|
1623
|
+
expect.arrayContaining(['sub-123', 'sub-456']),
|
1624
|
+
);
|
1625
|
+
expect(sqlLambda.Properties?.VpcConfig?.SecurityGroupIds).toBeDefined();
|
1626
|
+
expect(sqlLambda.Properties?.VpcConfig?.SecurityGroupIds).toEqual(
|
1627
|
+
expect.arrayContaining(['sg-123']),
|
1628
|
+
);
|
1629
|
+
});
|
1572
1630
|
});
|
@@ -698,7 +698,7 @@ export class ModelTransformer extends TransformerModelBase implements Transforme
|
|
698
698
|
}
|
699
699
|
case SubscriptionFieldType.ON_CREATE:
|
700
700
|
case SubscriptionFieldType.ON_DELETE:
|
701
|
-
case SubscriptionFieldType.ON_UPDATE:
|
701
|
+
case SubscriptionFieldType.ON_UPDATE: {
|
702
702
|
const filterInputName = toPascalCase(['ModelSubscription', type.name.value, 'FilterInput']);
|
703
703
|
const filterInputs = createEnumModelFilters(ctx, type);
|
704
704
|
filterInputs.push(makeSubscriptionQueryFilterInput(ctx, filterInputName, type));
|
@@ -710,6 +710,7 @@ export class ModelTransformer extends TransformerModelBase implements Transforme
|
|
710
710
|
});
|
711
711
|
|
712
712
|
return [makeInputValueDefinition('filter', makeNamedType(filterInputName))];
|
713
|
+
}
|
713
714
|
|
714
715
|
default:
|
715
716
|
throw new Error('Unknown operation type');
|
@@ -55,11 +55,12 @@ export const generateCreateInitSlotTemplate = (modelConfig: ModelDirectiveConfig
|
|
55
55
|
return printBlock('Initialization default values')(compoundExpression(statements));
|
56
56
|
};
|
57
57
|
|
58
|
-
export const generateLambdaCreateRequestTemplate = (tableName: string, operationName: string, ctx: TransformerContextProvider): string =>
|
59
|
-
|
58
|
+
export const generateLambdaCreateRequestTemplate = (tableName: string, operationName: string, ctx: TransformerContextProvider): string => {
|
59
|
+
const mappedTableName = ctx.resourceHelper.getModelNameMapping(tableName);
|
60
|
+
return printBlock('Invoke RDS Lambda data source')(
|
60
61
|
compoundExpression([
|
61
62
|
set(ref('lambdaInput'), obj({})),
|
62
|
-
set(ref('lambdaInput.table'), str(
|
63
|
+
set(ref('lambdaInput.table'), str(mappedTableName)),
|
63
64
|
set(ref('lambdaInput.args'), obj({})),
|
64
65
|
set(ref('lambdaInput.operation'), str('CREATE')),
|
65
66
|
set(ref('lambdaInput.operationName'), str(operationName)),
|
@@ -82,6 +83,7 @@ export const generateLambdaCreateRequestTemplate = (tableName: string, operation
|
|
82
83
|
}),
|
83
84
|
]),
|
84
85
|
);
|
86
|
+
};
|
85
87
|
|
86
88
|
/**
|
87
89
|
* Generate VTL template that sets the default values for Update mutation
|
@@ -123,11 +125,12 @@ export const generateLambdaUpdateRequestTemplate = (
|
|
123
125
|
operationName: string,
|
124
126
|
modelIndexFields: string[],
|
125
127
|
ctx: TransformerContextProvider,
|
126
|
-
): string =>
|
127
|
-
|
128
|
+
): string => {
|
129
|
+
const mappedTableName = ctx.resourceHelper.getModelNameMapping(tableName);
|
130
|
+
return printBlock('Invoke RDS Lambda data source')(
|
128
131
|
compoundExpression([
|
129
132
|
set(ref('lambdaInput'), obj({})),
|
130
|
-
set(ref('lambdaInput.table'), str(
|
133
|
+
set(ref('lambdaInput.table'), str(mappedTableName)),
|
131
134
|
set(ref('lambdaInput.args'), obj({})),
|
132
135
|
set(ref('lambdaInput.operation'), str('UPDATE')),
|
133
136
|
set(ref('lambdaInput.operationName'), str(operationName)),
|
@@ -151,6 +154,7 @@ export const generateLambdaUpdateRequestTemplate = (
|
|
151
154
|
}),
|
152
155
|
]),
|
153
156
|
);
|
157
|
+
};
|
154
158
|
|
155
159
|
/**
|
156
160
|
* Generate VTL template that calls the lambda for a Delete mutation
|
@@ -160,11 +164,12 @@ export const generateLambdaDeleteRequestTemplate = (
|
|
160
164
|
operationName: string,
|
161
165
|
modelIndexFields: string[],
|
162
166
|
ctx: TransformerContextProvider,
|
163
|
-
): string =>
|
164
|
-
|
167
|
+
): string => {
|
168
|
+
const mappedTableName = ctx.resourceHelper.getModelNameMapping(tableName);
|
169
|
+
return printBlock('Invoke RDS Lambda data source')(
|
165
170
|
compoundExpression([
|
166
171
|
set(ref('lambdaInput'), obj({})),
|
167
|
-
set(ref('lambdaInput.table'), str(
|
172
|
+
set(ref('lambdaInput.table'), str(mappedTableName)),
|
168
173
|
set(ref('lambdaInput.args'), ref('context.arguments')),
|
169
174
|
set(ref('lambdaInput.operation'), str('DELETE')),
|
170
175
|
set(ref('lambdaInput.operationName'), str(operationName)),
|
@@ -182,3 +187,4 @@ export const generateLambdaDeleteRequestTemplate = (
|
|
182
187
|
}),
|
183
188
|
]),
|
184
189
|
);
|
190
|
+
};
|