{"name":"@smithy/types","version":"2.3.5","author":{"url":"https://smithy.io","name":"AWS Smithy Team"},"license":"Apache-2.0","_id":"@smithy/types@2.3.5","maintainers":[{"name":"smithy-team","email":"aws-smithy-team+npm@amazon.com"},{"name":"trivikr-aws","email":"trivikr@amazon.com"}],"homepage":"https://github.com/awslabs/smithy-typescript/tree/main/packages/types","bugs":{"url":"https://github.com/awslabs/smithy-typescript/issues"},"dist":{"shasum":"7684a74d4368f323b478bd9e99e7dc3a6156b5e5","tarball":"http://registry-npm.ywwl.com/@smithy/types/download/@smithy/types-2.3.5.tgz","fileCount":215,"integrity":"sha512-ehyDt8M9hehyxrLQGoA1BGPou8Js1Ocoh5M0ngDhJMqbFmNK5N6Xhr9/ZExWkyIW8XcGkiMPq3ZUEE0ScrhbuQ==","signatures":[{"sig":"MEUCIQC3mBuRg7r/ydwU2J2rI1n6bDtYDlwHgRhWPP4LpM1J0gIgGIJdgyWHubdol0pP97kj8bQj6Qe0LkEIt94pRdb3xW4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":207970,"size":41616,"noattachment":false,"key":"/@smithy/types/-/@smithy/types-2.3.5.tgz"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","engines":{"node":">=14.0.0"},"gitHead":"5fb6d4c68777a3d358158eddcb18d22da3fd5c8d","scripts":{"lint":"eslint -c ../../.eslintrc.js \"src/**/*.ts\"","test":"yarn g:tsc -p tsconfig.test.json","build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","format":"prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"","build:es":"yarn g:tsc -p tsconfig.es.json","build:cjs":"yarn g:tsc -p tsconfig.cjs.json","build:types":"yarn g:tsc -p tsconfig.types.json","extract:docs":"api-extractor run --local","stage-release":"rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz","build:types:downlevel":"rimraf dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4 && node scripts/downlevel"},"typedoc":{"entryPoint":"src/index.ts"},"_npmUser":{"name":"smithy-team","email":"aws-smithy-team+npm@amazon.com"},"repository":{"url":"git+https://github.com/awslabs/smithy-typescript.git","type":"git","directory":"packages/types"},"_npmVersion":"9.8.1","description":"[![NPM version](https://img.shields.io/npm/v/@smithy/types/latest.svg)](https://www.npmjs.com/package/@smithy/types) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/types.svg)](https://www.npmjs.com/package/@smithy/types)","directories":{},"_nodeVersion":"18.18.0","dependencies":{"tslib":"^2.5.0"},"publishConfig":{"directory":".release/package"},"typesVersions":{"<=4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"3.0.2","typedoc":"0.23.23","concurrently":"7.0.0","downlevel-dts":"0.10.1","@tsconfig/recommended":"1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/types_2.3.5_1696630494544_0.3882488096209502","host":"s3://npm-registry-packages"},"readme":"# @smithy/types\n\n[![NPM version](https://img.shields.io/npm/v/@smithy/types/latest.svg)](https://www.npmjs.com/package/@smithy/types)\n[![NPM downloads](https://img.shields.io/npm/dm/@smithy/types.svg)](https://www.npmjs.com/package/@smithy/types)\n\n## Usage\n\nThis package is mostly used internally by generated clients.\nSome public components have independent applications.\n\n---\n\n### Scenario: Removing `| undefined` from input and output structures\n\nGenerated shapes' members are unioned with `undefined` for\ninput shapes, and are `?` (optional) for output shapes.\n\n- for inputs, this defers the validation to the service.\n- for outputs, this strongly suggests that you should runtime-check the output data.\n\nIf you would like to skip these steps, use the `AssertiveClient` or\n`UncheckedClient` type helpers.\n\nUsing AWS S3 as an example:\n\n```ts\nimport { S3 } from \"@aws-sdk/client-s3\";\nimport type { AssertiveClient, UncheckedClient } from \"@smithy/types\";\n\nconst s3a = new S3({}) as AssertiveClient<S3>;\nconst s3b = new S3({}) as UncheckedClient<S3>;\n\n// AssertiveClient enforces required inputs are not undefined\n// and required outputs are not undefined.\nconst get = await s3a.getObject({\n  Bucket: \"\",\n  Key: \"\",\n});\n\n// UncheckedClient makes output fields non-nullable.\n// You should still perform type checks as you deem\n// necessary, but the SDK will no longer prompt you\n// with nullability errors.\nconst body = await (\n  await s3b.getObject({\n    Bucket: \"\",\n    Key: \"\",\n  })\n).Body.transformToString();\n```\n\n### Scenario: Narrowing a smithy-typescript generated client's output payload blob types\n\nThis is mostly relevant to operations with streaming bodies such as within\nthe S3Client in the AWS SDK for JavaScript v3.\n\nBecause blob payload types are platform dependent, you may wish to indicate in your application that a client is running in a specific\nenvironment. This narrows the blob payload types.\n\n```typescript\nimport { GetObjectCommand, S3Client } from \"@aws-sdk/client-s3\";\nimport type { NodeJsClient, SdkStream, StreamingBlobPayloadOutputTypes } from \"@smithy/types\";\nimport type { IncomingMessage } from \"node:http\";\n\n// default client init.\nconst s3Default = new S3Client({});\n\n// client init with type narrowing.\nconst s3NarrowType = new S3Client({}) as NodeJsClient<S3Client>;\n\n// The default type of blob payloads is a wide union type including multiple possible\n// request handlers.\nconst body1: StreamingBlobPayloadOutputTypes = (await s3Default.send(new GetObjectCommand({ Key: \"\", Bucket: \"\" })))\n  .Body!;\n\n// This is of the narrower type SdkStream<IncomingMessage> representing\n// blob payload responses using specifically the node:http request handler.\nconst body2: SdkStream<IncomingMessage> = (await s3NarrowType.send(new GetObjectCommand({ Key: \"\", Bucket: \"\" })))\n  .Body!;\n```\n","publish_time":1696630494785,"_cnpm_publish_time":1696630494785,"dist-tags":{"latest":"4.20.0"}}