@aws-amplify/graphql-model-transformer 1.4.0 → 1.5.0-no-internal-synth.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/CHANGELOG.md +10 -0
- 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/resolver.d.ts +5 -5
- package/lib/resolvers/rds/resolver.d.ts.map +1 -1
- package/lib/resolvers/rds/resolver.js +14 -11
- package/lib/resolvers/rds/resolver.js.map +1 -1
- package/lib/resources/dynamo-model-resource-generator.d.ts +2 -2
- package/lib/resources/dynamo-model-resource-generator.d.ts.map +1 -1
- package/lib/resources/dynamo-model-resource-generator.js +48 -43
- package/lib/resources/dynamo-model-resource-generator.js.map +1 -1
- package/lib/resources/model-resource-generator.js +3 -3
- package/lib/resources/model-resource-generator.js.map +1 -1
- package/lib/resources/rds-model-resource-generator.js +13 -13
- package/package.json +7 -6
- package/publish-notification-lambda/node_modules/.package-lock.json +13 -13
- package/publish-notification-lambda/node_modules/@smithy/protocol-http/package.json +2 -2
- package/publish-notification-lambda/node_modules/@smithy/types/README.md +37 -0
- package/publish-notification-lambda/node_modules/@smithy/types/package.json +3 -2
- package/publish-notification-lambda/node_modules/@types/node/README.md +2 -2
- package/publish-notification-lambda/node_modules/@types/node/package.json +2 -7
- package/publish-notification-lambda/node_modules/tslib/package.json +1 -1
- package/publish-notification-lambda/node_modules/tslib/tslib.es6.mjs +1 -1
- package/publish-notification-lambda/package-lock.json +13 -13
- package/rds-lambda/node_modules/.package-lock.json +370 -345
- package/rds-lambda/node_modules/@babel/code-frame/README.md +1 -1
- package/rds-lambda/node_modules/@babel/code-frame/package.json +3 -2
- package/rds-lambda/node_modules/@babel/core/cjs-proxy.cjs +3 -1
- package/rds-lambda/node_modules/@babel/core/package.json +10 -10
- package/rds-lambda/node_modules/@babel/generator/package.json +3 -3
- package/rds-lambda/node_modules/@babel/helper-compilation-targets/package.json +1 -5
- package/rds-lambda/node_modules/@babel/helpers/package.json +6 -6
- package/rds-lambda/node_modules/@babel/highlight/README.md +1 -1
- package/rds-lambda/node_modules/@babel/highlight/package.json +2 -3
- package/rds-lambda/node_modules/@babel/parser/package.json +3 -3
- package/rds-lambda/node_modules/@babel/traverse/package.json +6 -5
- package/rds-lambda/node_modules/@babel/types/README.md +1 -1
- package/rds-lambda/node_modules/@babel/types/package.json +3 -4
- package/rds-lambda/node_modules/@jest/console/package.json +5 -5
- package/rds-lambda/node_modules/@jest/core/package.json +20 -20
- package/rds-lambda/node_modules/@jest/environment/package.json +4 -4
- package/rds-lambda/node_modules/@jest/expect/package.json +4 -4
- package/rds-lambda/node_modules/@jest/expect-utils/package.json +3 -3
- package/rds-lambda/node_modules/@jest/fake-timers/package.json +6 -6
- package/rds-lambda/node_modules/@jest/globals/package.json +5 -5
- package/rds-lambda/node_modules/@jest/reporters/package.json +10 -10
- package/rds-lambda/node_modules/@jest/test-result/package.json +5 -5
- package/rds-lambda/node_modules/@jest/test-sequencer/package.json +5 -5
- package/rds-lambda/node_modules/@jest/transform/package.json +6 -6
- package/rds-lambda/node_modules/@jridgewell/resolve-uri/package.json +2 -2
- package/rds-lambda/node_modules/@jridgewell/trace-mapping/package.json +3 -3
- package/rds-lambda/node_modules/@smithy/protocol-http/package.json +2 -2
- package/rds-lambda/node_modules/@smithy/types/README.md +37 -0
- package/rds-lambda/node_modules/@smithy/types/package.json +3 -2
- package/rds-lambda/node_modules/@types/node/README.md +2 -2
- package/rds-lambda/node_modules/@types/node/package.json +2 -7
- package/rds-lambda/node_modules/babel-jest/package.json +4 -4
- package/rds-lambda/node_modules/browserslist/package.json +4 -4
- package/rds-lambda/node_modules/caniuse-lite/package.json +1 -1
- package/rds-lambda/node_modules/dedent/README.md +56 -0
- package/rds-lambda/node_modules/dedent/dist/dedent.d.mts +17 -0
- package/rds-lambda/node_modules/dedent/dist/dedent.mjs +59 -0
- package/rds-lambda/node_modules/dedent/package.json +54 -10
- 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/expect/package.json +7 -7
- package/rds-lambda/node_modules/is-core-module/CHANGELOG.md +7 -0
- package/rds-lambda/node_modules/is-core-module/core.json +3 -3
- package/rds-lambda/node_modules/is-core-module/package.json +5 -5
- package/rds-lambda/node_modules/istanbul-lib-report/CHANGELOG.md +7 -0
- package/rds-lambda/node_modules/istanbul-lib-report/package.json +5 -6
- package/rds-lambda/node_modules/istanbul-reports/CHANGELOG.md +7 -0
- package/rds-lambda/node_modules/istanbul-reports/package.json +1 -1
- package/rds-lambda/node_modules/jest/package.json +4 -4
- package/rds-lambda/node_modules/jest-circus/package.json +13 -14
- package/rds-lambda/node_modules/jest-cli/package.json +7 -7
- package/rds-lambda/node_modules/jest-config/package.json +11 -11
- package/rds-lambda/node_modules/jest-diff/package.json +4 -4
- package/rds-lambda/node_modules/jest-each/package.json +4 -4
- package/rds-lambda/node_modules/jest-environment-node/package.json +7 -7
- package/rds-lambda/node_modules/jest-haste-map/package.json +4 -4
- package/rds-lambda/node_modules/jest-leak-detector/package.json +3 -3
- package/rds-lambda/node_modules/jest-matcher-utils/package.json +5 -5
- package/rds-lambda/node_modules/jest-message-util/package.json +3 -3
- package/rds-lambda/node_modules/jest-mock/package.json +3 -3
- package/rds-lambda/node_modules/jest-resolve/package.json +5 -5
- package/rds-lambda/node_modules/jest-resolve-dependencies/package.json +7 -7
- package/rds-lambda/node_modules/jest-runner/package.json +17 -17
- package/rds-lambda/node_modules/jest-runtime/package.json +15 -15
- package/rds-lambda/node_modules/jest-snapshot/package.json +12 -12
- package/rds-lambda/node_modules/jest-util/package.json +2 -2
- package/rds-lambda/node_modules/jest-validate/package.json +3 -3
- package/rds-lambda/node_modules/jest-watcher/package.json +4 -4
- package/rds-lambda/node_modules/jest-worker/package.json +4 -4
- package/rds-lambda/node_modules/make-dir/license +1 -1
- package/rds-lambda/node_modules/make-dir/node_modules/lru-cache/LICENSE +15 -0
- package/rds-lambda/node_modules/make-dir/node_modules/lru-cache/README.md +166 -0
- package/rds-lambda/node_modules/make-dir/node_modules/lru-cache/package.json +34 -0
- package/rds-lambda/node_modules/make-dir/node_modules/semver/LICENSE +15 -0
- package/rds-lambda/node_modules/make-dir/node_modules/semver/README.md +637 -0
- package/rds-lambda/node_modules/make-dir/node_modules/semver/package.json +87 -0
- package/rds-lambda/node_modules/make-dir/node_modules/semver/range.bnf +16 -0
- package/rds-lambda/node_modules/make-dir/node_modules/yallist/LICENSE +15 -0
- package/rds-lambda/node_modules/make-dir/node_modules/yallist/README.md +204 -0
- package/rds-lambda/node_modules/make-dir/node_modules/yallist/package.json +29 -0
- package/rds-lambda/node_modules/make-dir/package.json +15 -11
- package/rds-lambda/node_modules/make-dir/readme.md +1 -1
- package/rds-lambda/node_modules/pretty-format/package.json +3 -3
- package/rds-lambda/node_modules/resolve/lib/core.json +4 -1
- package/rds-lambda/node_modules/resolve/package.json +6 -6
- package/rds-lambda/node_modules/tslib/package.json +1 -1
- package/rds-lambda/node_modules/tslib/tslib.es6.mjs +1 -1
- package/rds-lambda/package-lock.json +370 -345
- package/rds-patching-lambda/node_modules/.package-lock.json +13 -13
- package/rds-patching-lambda/node_modules/@smithy/protocol-http/package.json +2 -2
- package/rds-patching-lambda/node_modules/@smithy/types/README.md +37 -0
- package/rds-patching-lambda/node_modules/@smithy/types/package.json +3 -2
- package/rds-patching-lambda/node_modules/@types/node/README.md +2 -2
- package/rds-patching-lambda/node_modules/@types/node/package.json +2 -7
- package/rds-patching-lambda/node_modules/tslib/package.json +1 -1
- package/rds-patching-lambda/node_modules/tslib/tslib.es6.mjs +1 -1
- package/rds-patching-lambda/package-lock.json +13 -13
- package/src/__tests__/model-directive-arguments.test.ts +23 -28
- package/src/__tests__/model-transformer.test.ts +138 -160
- package/src/resolvers/rds/resolver.ts +19 -17
- package/src/resources/dynamo-model-resource-generator.ts +50 -47
- package/src/resources/model-resource-generator.ts +3 -3
- package/src/resources/rds-model-resource-generator.ts +13 -13
- package/tsconfig.tsbuildinfo +1 -1
- package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/LICENSE +0 -21
- package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/README.md +0 -200
- package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -164
- package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
- package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/package.json +0 -75
- package/rds-lambda/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +0 -198
- package/rds-lambda/node_modules/@types/prettier/LICENSE +0 -21
- package/rds-lambda/node_modules/@types/prettier/README.md +0 -16
- package/rds-lambda/node_modules/@types/prettier/package.json +0 -65
|
@@ -22,25 +22,25 @@ class RdsModelResourceGenerator extends model_resource_generator_1.ModelResource
|
|
|
22
22
|
if (this.isEnabled()) {
|
|
23
23
|
const secretEntry = context.datasourceSecretParameterLocations.get(graphql_transformer_core_1.MYSQL_DB_TYPE);
|
|
24
24
|
const { RDSLambdaIAMRoleLogicalID, RDSPatchingLambdaIAMRoleLogicalID, RDSLambdaLogicalID, RDSPatchingLambdaLogicalID, RDSLambdaDataSourceLogicalID, RDSPatchingSubscriptionLogicalID, } = graphql_transformer_common_1.ResourceConstants.RESOURCES;
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
(0, rds_1.setRDSLayerMappings)(
|
|
28
|
-
const role = (0, rds_1.createRdsLambdaRole)(context.resourceHelper.generateIAMRoleName(RDSLambdaIAMRoleLogicalID),
|
|
29
|
-
const lambda = (0, rds_1.createRdsLambda)(
|
|
25
|
+
const lambdaRoleScope = context.stackManager.getScopeFor(RDSLambdaIAMRoleLogicalID, exports.RDS_STACK_NAME);
|
|
26
|
+
const lambdaScope = context.stackManager.getScopeFor(RDSLambdaLogicalID, exports.RDS_STACK_NAME);
|
|
27
|
+
(0, rds_1.setRDSLayerMappings)(lambdaScope, context.rdsLayerMapping);
|
|
28
|
+
const role = (0, rds_1.createRdsLambdaRole)(context.resourceHelper.generateIAMRoleName(RDSLambdaIAMRoleLogicalID), lambdaRoleScope, secretEntry);
|
|
29
|
+
const lambda = (0, rds_1.createRdsLambda)(lambdaScope, context.api, role, {
|
|
30
30
|
username: (_a = secretEntry === null || secretEntry === void 0 ? void 0 : secretEntry.username) !== null && _a !== void 0 ? _a : '',
|
|
31
31
|
password: (_b = secretEntry === null || secretEntry === void 0 ? void 0 : secretEntry.password) !== null && _b !== void 0 ? _b : '',
|
|
32
32
|
host: (_c = secretEntry === null || secretEntry === void 0 ? void 0 : secretEntry.host) !== null && _c !== void 0 ? _c : '',
|
|
33
33
|
port: (_d = secretEntry === null || secretEntry === void 0 ? void 0 : secretEntry.port) !== null && _d !== void 0 ? _d : '',
|
|
34
34
|
database: (_e = secretEntry === null || secretEntry === void 0 ? void 0 : secretEntry.database) !== null && _e !== void 0 ? _e : '',
|
|
35
35
|
}, context.sqlLambdaVpcConfig);
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const patchingLambdaRole = (0, rds_1.createRdsPatchingLambdaRole)(context.resourceHelper.generateIAMRoleName(RDSPatchingLambdaIAMRoleLogicalID),
|
|
39
|
-
const patchingLambda = (0, rds_1.createRdsPatchingLambda)(
|
|
36
|
+
const patchingLambdaRoleScope = context.stackManager.getScopeFor(RDSPatchingLambdaIAMRoleLogicalID, exports.RDS_STACK_NAME);
|
|
37
|
+
const patchingLambdaScope = context.stackManager.getScopeFor(RDSPatchingLambdaLogicalID, exports.RDS_STACK_NAME);
|
|
38
|
+
const patchingLambdaRole = (0, rds_1.createRdsPatchingLambdaRole)(context.resourceHelper.generateIAMRoleName(RDSPatchingLambdaIAMRoleLogicalID), patchingLambdaRoleScope, lambda.functionArn);
|
|
39
|
+
const patchingLambda = (0, rds_1.createRdsPatchingLambda)(patchingLambdaScope, context.api, patchingLambdaRole, {
|
|
40
40
|
LAMBDA_FUNCTION_ARN: lambda.functionArn,
|
|
41
41
|
});
|
|
42
|
-
const
|
|
43
|
-
const snsTopic = aws_sns_1.Topic.fromTopicArn(
|
|
42
|
+
const patchingSubscriptionScope = context.stackManager.getScopeFor(RDSPatchingSubscriptionLogicalID, exports.RDS_STACK_NAME);
|
|
43
|
+
const snsTopic = aws_sns_1.Topic.fromTopicArn(patchingSubscriptionScope, 'RDSPatchingTopic', RDS_PATCHING_SNS_TOPIC_ARN);
|
|
44
44
|
const subscription = new aws_sns_subscriptions_1.LambdaSubscription(patchingLambda, {
|
|
45
45
|
filterPolicy: {
|
|
46
46
|
Region: aws_sns_2.SubscriptionFilter.stringFilter({
|
|
@@ -49,8 +49,8 @@ class RdsModelResourceGenerator extends model_resource_generator_1.ModelResource
|
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
snsTopic.addSubscription(subscription);
|
|
52
|
-
const
|
|
53
|
-
const rdsDatasource = context.api.host.addLambdaDataSource(`${RDSLambdaDataSourceLogicalID}`, lambda, {},
|
|
52
|
+
const lambdaDataSourceScope = context.stackManager.getScopeFor(RDSLambdaDataSourceLogicalID, exports.RDS_STACK_NAME);
|
|
53
|
+
const rdsDatasource = context.api.host.addLambdaDataSource(`${RDSLambdaDataSourceLogicalID}`, lambda, {}, lambdaDataSourceScope);
|
|
54
54
|
this.models.forEach((model) => {
|
|
55
55
|
context.dataSources.add(model, rdsDatasource);
|
|
56
56
|
this.datasourceMap[model.name.value] = rdsDatasource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/graphql-model-transformer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-no-internal-synth.0",
|
|
4
4
|
"description": "Amplify graphql @model transformer",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,17 +32,18 @@
|
|
|
32
32
|
"extract-api": "ts-node ../../scripts/extract-api.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-amplify/graphql-transformer-core": "1.
|
|
36
|
-
"@aws-amplify/graphql-transformer-interfaces": "2.3.0",
|
|
35
|
+
"@aws-amplify/graphql-transformer-core": "1.5.0-no-internal-synth.0",
|
|
36
|
+
"@aws-amplify/graphql-transformer-interfaces": "2.3.1-no-internal-synth.0",
|
|
37
37
|
"graphql": "^15.5.0",
|
|
38
|
-
"graphql-mapping-template": "4.20.
|
|
39
|
-
"graphql-transformer-common": "4.25.0"
|
|
38
|
+
"graphql-mapping-template": "4.20.12-no-internal-synth.0",
|
|
39
|
+
"graphql-transformer-common": "4.25.1-no-internal-synth.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"aws-cdk-lib": "^2.80.0",
|
|
43
43
|
"constructs": "^10.0.5"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"@aws-amplify/graphql-transformer-test-utils": "0.1.1-no-internal-synth.0",
|
|
46
47
|
"@types/node": "^12.12.6"
|
|
47
48
|
},
|
|
48
49
|
"jest": {
|
|
@@ -70,5 +71,5 @@
|
|
|
70
71
|
"overrides"
|
|
71
72
|
]
|
|
72
73
|
},
|
|
73
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "30702c5c4cfabbd99cd7cbc74afd667f0a8b0f13"
|
|
74
75
|
}
|
|
@@ -1100,11 +1100,11 @@
|
|
|
1100
1100
|
}
|
|
1101
1101
|
},
|
|
1102
1102
|
"node_modules/@smithy/protocol-http": {
|
|
1103
|
-
"version": "1.
|
|
1104
|
-
"resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-1.
|
|
1105
|
-
"integrity": "sha512-
|
|
1103
|
+
"version": "1.2.0",
|
|
1104
|
+
"resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-1.2.0.tgz",
|
|
1105
|
+
"integrity": "sha512-GfGfruksi3nXdFok5RhgtOnWe5f6BndzYfmEXISD+5gAGdayFGpjWu5pIqIweTudMtse20bGbc+7MFZXT1Tb8Q==",
|
|
1106
1106
|
"dependencies": {
|
|
1107
|
-
"@smithy/types": "^1.
|
|
1107
|
+
"@smithy/types": "^1.2.0",
|
|
1108
1108
|
"tslib": "^2.5.0"
|
|
1109
1109
|
},
|
|
1110
1110
|
"engines": {
|
|
@@ -1112,9 +1112,9 @@
|
|
|
1112
1112
|
}
|
|
1113
1113
|
},
|
|
1114
1114
|
"node_modules/@smithy/types": {
|
|
1115
|
-
"version": "1.
|
|
1116
|
-
"resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.
|
|
1117
|
-
"integrity": "sha512-
|
|
1115
|
+
"version": "1.2.0",
|
|
1116
|
+
"resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz",
|
|
1117
|
+
"integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==",
|
|
1118
1118
|
"dependencies": {
|
|
1119
1119
|
"tslib": "^2.5.0"
|
|
1120
1120
|
},
|
|
@@ -1123,9 +1123,9 @@
|
|
|
1123
1123
|
}
|
|
1124
1124
|
},
|
|
1125
1125
|
"node_modules/@types/node": {
|
|
1126
|
-
"version": "20.4.
|
|
1127
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.
|
|
1128
|
-
"integrity": "sha512-
|
|
1126
|
+
"version": "20.4.8",
|
|
1127
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.8.tgz",
|
|
1128
|
+
"integrity": "sha512-0mHckf6D2DiIAzh8fM8f3HQCvMKDpK94YQ0DSVkfWTG9BZleYIWudw9cJxX8oCk9bM+vAkDyujDV6dmKHbvQpg==",
|
|
1129
1129
|
"dev": true
|
|
1130
1130
|
},
|
|
1131
1131
|
"node_modules/ansi-regex": {
|
|
@@ -1808,9 +1808,9 @@
|
|
|
1808
1808
|
}
|
|
1809
1809
|
},
|
|
1810
1810
|
"node_modules/tslib": {
|
|
1811
|
-
"version": "2.6.
|
|
1812
|
-
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.
|
|
1813
|
-
"integrity": "sha512-
|
|
1811
|
+
"version": "2.6.1",
|
|
1812
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz",
|
|
1813
|
+
"integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig=="
|
|
1814
1814
|
},
|
|
1815
1815
|
"node_modules/typescript": {
|
|
1816
1816
|
"version": "5.1.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/protocol-http",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@smithy/types": "^1.
|
|
26
|
+
"@smithy/types": "^1.2.0",
|
|
27
27
|
"tslib": "^2.5.0"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
@@ -2,3 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@smithy/types)
|
|
4
4
|
[](https://www.npmjs.com/package/@smithy/types)
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
This package is mostly used internally by generated clients.
|
|
9
|
+
Some public components have independent applications.
|
|
10
|
+
|
|
11
|
+
### Scenario: Narrowing a smithy-typescript generated client's output payload blob types
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
This is mostly relevant to operations with streaming bodies such as within
|
|
16
|
+
the S3Client in the AWS SDK for JavaScript v3.
|
|
17
|
+
|
|
18
|
+
Because blob payload types are platform dependent, you may wish to indicate in your application that a client is running in a specific
|
|
19
|
+
environment. This narrows the blob payload types.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
23
|
+
import type { NodeJsClient, SdkStream, StreamingBlobPayloadOutputTypes } from "@smithy/types";
|
|
24
|
+
import type { IncomingMessage } from "node:http";
|
|
25
|
+
|
|
26
|
+
// default client init.
|
|
27
|
+
const s3Default = new S3Client({});
|
|
28
|
+
|
|
29
|
+
// client init with type narrowing.
|
|
30
|
+
const s3NarrowType = new S3Client({}) as NodeJsClient<S3Client>;
|
|
31
|
+
|
|
32
|
+
// The default type of blob payloads is a wide union type including multiple possible
|
|
33
|
+
// request handlers.
|
|
34
|
+
const body1: StreamingBlobPayloadOutputTypes = (await s3Default.send(new GetObjectCommand({ Key: "", Bucket: "" })))
|
|
35
|
+
.Body!;
|
|
36
|
+
|
|
37
|
+
// This is of the narrower type SdkStream<IncomingMessage> representing
|
|
38
|
+
// blob payload responses using specifically the node:http request handler.
|
|
39
|
+
const body2: SdkStream<IncomingMessage> = (await s3NarrowType.send(new GetObjectCommand({ Key: "", Bucket: "" })))
|
|
40
|
+
.Body!;
|
|
41
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
|
12
12
|
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
|
|
13
13
|
"format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",
|
|
14
|
-
"test": "tsc -p tsconfig.test.json"
|
|
14
|
+
"test": "tsc -p tsconfig.test.json",
|
|
15
|
+
"extract:docs": "api-extractor run --local"
|
|
15
16
|
},
|
|
16
17
|
"main": "./dist-cjs/index.js",
|
|
17
18
|
"module": "./dist-es/index.js",
|
|
@@ -8,9 +8,9 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sat, 05 Aug 2023 10:32:49 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
15
15
|
# Credits
|
|
16
|
-
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [
|
|
16
|
+
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "20.4.
|
|
3
|
+
"version": "20.4.8",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -110,11 +110,6 @@
|
|
|
110
110
|
"url": "https://github.com/eps1lon",
|
|
111
111
|
"githubUsername": "eps1lon"
|
|
112
112
|
},
|
|
113
|
-
{
|
|
114
|
-
"name": "Simon Schick",
|
|
115
|
-
"url": "https://github.com/SimonSchick",
|
|
116
|
-
"githubUsername": "SimonSchick"
|
|
117
|
-
},
|
|
118
113
|
{
|
|
119
114
|
"name": "Thomas den Hollander",
|
|
120
115
|
"url": "https://github.com/ThomasdenH",
|
|
@@ -232,6 +227,6 @@
|
|
|
232
227
|
},
|
|
233
228
|
"scripts": {},
|
|
234
229
|
"dependencies": {},
|
|
235
|
-
"typesPublisherContentHash": "
|
|
230
|
+
"typesPublisherContentHash": "9acef897909a6e2f2e35b1241c4aee3acd41d6d87a7676afe8d21d5c84e063ad",
|
|
236
231
|
"typeScriptVersion": "4.3"
|
|
237
232
|
}
|
|
@@ -294,7 +294,7 @@ export function __classPrivateFieldIn(state, receiver) {
|
|
|
294
294
|
|
|
295
295
|
export function __addDisposableResource(env, value, async) {
|
|
296
296
|
if (value !== null && value !== void 0) {
|
|
297
|
-
if (typeof value !== "object") throw new TypeError("Object expected.");
|
|
297
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
298
298
|
var dispose;
|
|
299
299
|
if (async) {
|
|
300
300
|
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
@@ -1114,11 +1114,11 @@
|
|
|
1114
1114
|
}
|
|
1115
1115
|
},
|
|
1116
1116
|
"node_modules/@smithy/protocol-http": {
|
|
1117
|
-
"version": "1.
|
|
1118
|
-
"resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-1.
|
|
1119
|
-
"integrity": "sha512-
|
|
1117
|
+
"version": "1.2.0",
|
|
1118
|
+
"resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-1.2.0.tgz",
|
|
1119
|
+
"integrity": "sha512-GfGfruksi3nXdFok5RhgtOnWe5f6BndzYfmEXISD+5gAGdayFGpjWu5pIqIweTudMtse20bGbc+7MFZXT1Tb8Q==",
|
|
1120
1120
|
"dependencies": {
|
|
1121
|
-
"@smithy/types": "^1.
|
|
1121
|
+
"@smithy/types": "^1.2.0",
|
|
1122
1122
|
"tslib": "^2.5.0"
|
|
1123
1123
|
},
|
|
1124
1124
|
"engines": {
|
|
@@ -1126,9 +1126,9 @@
|
|
|
1126
1126
|
}
|
|
1127
1127
|
},
|
|
1128
1128
|
"node_modules/@smithy/types": {
|
|
1129
|
-
"version": "1.
|
|
1130
|
-
"resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.
|
|
1131
|
-
"integrity": "sha512-
|
|
1129
|
+
"version": "1.2.0",
|
|
1130
|
+
"resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz",
|
|
1131
|
+
"integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==",
|
|
1132
1132
|
"dependencies": {
|
|
1133
1133
|
"tslib": "^2.5.0"
|
|
1134
1134
|
},
|
|
@@ -1137,9 +1137,9 @@
|
|
|
1137
1137
|
}
|
|
1138
1138
|
},
|
|
1139
1139
|
"node_modules/@types/node": {
|
|
1140
|
-
"version": "20.4.
|
|
1141
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.
|
|
1142
|
-
"integrity": "sha512-
|
|
1140
|
+
"version": "20.4.8",
|
|
1141
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.8.tgz",
|
|
1142
|
+
"integrity": "sha512-0mHckf6D2DiIAzh8fM8f3HQCvMKDpK94YQ0DSVkfWTG9BZleYIWudw9cJxX8oCk9bM+vAkDyujDV6dmKHbvQpg==",
|
|
1143
1143
|
"dev": true
|
|
1144
1144
|
},
|
|
1145
1145
|
"node_modules/ansi-regex": {
|
|
@@ -1822,9 +1822,9 @@
|
|
|
1822
1822
|
}
|
|
1823
1823
|
},
|
|
1824
1824
|
"node_modules/tslib": {
|
|
1825
|
-
"version": "2.6.
|
|
1826
|
-
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.
|
|
1827
|
-
"integrity": "sha512-
|
|
1825
|
+
"version": "2.6.1",
|
|
1826
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz",
|
|
1827
|
+
"integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig=="
|
|
1828
1828
|
},
|
|
1829
1829
|
"node_modules/typescript": {
|
|
1830
1830
|
"version": "5.1.3",
|