{"name":"@smithy/types","version":"3.6.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'","build:cjs":"node ../../scripts/inline types","build:es":"yarn g:tsc -p tsconfig.es.json","build:types":"yarn g:tsc -p tsconfig.types.json","build:types:downlevel":"rimraf dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4 && node scripts/downlevel","stage-release":"rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0","lint":"eslint -c ../../.eslintrc.js \"src/**/*.ts\"","format":"prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"","test":"yarn g:tsc -p tsconfig.test.json","extract:docs":"api-extractor run --local"},"main":"./dist-cjs/index.js","module":"./dist-es/index.js","types":"./dist-types/index.d.ts","author":{"name":"AWS Smithy Team","url":"https://smithy.io"},"license":"Apache-2.0","dependencies":{"tslib":"^2.6.2"},"engines":{"node":">=16.0.0"},"typesVersions":{"<=4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"homepage":"https://github.com/awslabs/smithy-typescript/tree/main/packages/types","repository":{"type":"git","url":"git+https://github.com/awslabs/smithy-typescript.git","directory":"packages/types"},"devDependencies":{"concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typedoc":"0.23.23"},"typedoc":{"entryPoint":"src/index.ts"},"publishConfig":{"directory":".release/package"},"_id":"@smithy/types@3.6.0","gitHead":"5de4524d147db44e627dadf222238552d6ff613d","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)","bugs":{"url":"https://github.com/awslabs/smithy-typescript/issues"},"_nodeVersion":"18.20.4","_npmVersion":"10.7.0","dist":{"integrity":"sha512-8VXK/KzOHefoC65yRgCn5vG1cysPJjHnOVt9d0ybFQSmJgQj152vMn4EkYhGuaOmnnZvCPav/KnYyE6/KsNZ2w==","shasum":"03a52bfd62ee4b7b2a1842c8ae3ada7a0a5ff3a4","tarball":"http://registry-npm.ywwl.com/@smithy/types/download/@smithy/types-3.6.0.tgz","fileCount":263,"unpackedSize":243472,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBJtOrSWMuFbgf4UfIusGK1kMbVBVH8fzHMyGS6FAcB9AiAMweqEqLr/JuTyUuKLgL7QzGJNLMmZV3guDk9/54TzGA=="}],"size":50290,"noattachment":false,"key":"/@smithy/types/-/@smithy/types-3.6.0.tgz"},"_npmUser":{"name":"smithy-team","email":"aws-smithy-team+npm@amazon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/types_3.6.0_1729522613110_0.9500936836266145"},"_hasShrinkwrap":false,"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  // @ts-expect-error (undefined not assignable to string)\n  Key: undefined,\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\nWhen using the transform on non-aggregated client with the `Command` syntax,\nthe input cannot be validated because it goes through another class.\n\n```ts\nimport { S3Client, ListBucketsCommand, GetObjectCommand, GetObjectCommandInput } from \"@aws-sdk/client-s3\";\nimport type { AssertiveClient, UncheckedClient, NoUndefined } from \"@smithy/types\";\n\nconst s3 = new S3Client({}) as UncheckedClient<S3Client>;\n\nconst list = await s3.send(\n  new ListBucketsCommand({\n    // command inputs are not validated by the type transform.\n    // because this is a separate class.\n  })\n);\n\n/**\n * Although less ergonomic, you can use the NoUndefined<T>\n * transform on the input type.\n */\nconst getObjectInput: NoUndefined<GetObjectCommandInput> = {\n  Bucket: \"undefined\",\n  // @ts-expect-error (undefined not assignable to string)\n  Key: undefined,\n  // optional params can still be undefined.\n  SSECustomerAlgorithm: undefined,\n};\n\nconst get = s3.send(new GetObjectCommand(getObjectInput));\n\n// outputs are still transformed.\nawait get.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":1729522613439,"maintainers":[{"name":"smithy-team","email":"aws-smithy-team+npm@amazon.com"},{"name":"trivikr-aws","email":"trivikr@amazon.com"}],"_cnpm_publish_time":1729522613439,"dist-tags":{"latest":"4.20.0"}}