Skip to content

Commit

Permalink
docs(lib-dynamodb): add release tags and re-exports to lib-dynamodb (#…
Browse files Browse the repository at this point in the history
…4759)

* docs(lib-dynamodb): add release tags and re-exports to lib-dynamodb

* fix(style): trailing spaces
  • Loading branch information
MYoung25 authored May 25, 2023
1 parent 2c1015a commit 4e4c7f4
Show file tree
Hide file tree
Showing 23 changed files with 300 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public void run() {
writer.addImport(serviceName, serviceName, "@aws-sdk/client-dynamodb");
writer.addImport(configType, configType, "@aws-sdk/client-dynamodb");
writer.addImport("Client", "__Client", "@aws-sdk/smithy-client");
writer.writeDocs("@public");
writer.write("export { __Client };");
generateInputOutputImports(serviceInputTypes, serviceOutputTypes);

generateInputOutputTypeUnion(serviceInputTypes,
Expand All @@ -80,7 +82,7 @@ public void run() {
writer.write("");
generateConfiguration();

writer.writeDocs(DocumentClientUtils.getClientDocs());
writer.writeDocs(DocumentClientUtils.getClientDocs() + "\n\n@public");
writer.openBlock("export class $L extends __Client<$T, $L, $L, $L> {", "}",
DocumentClientUtils.CLIENT_NAME,
ApplicationProtocol.createDefaultHttpApplicationProtocol().getOptionsType(),
Expand Down Expand Up @@ -124,6 +126,7 @@ private void generateInputOutputImports(String serviceInputTypes, String service
}

private void generateInputOutputTypeUnion(String typeName, Function<Symbol, String> mapper) {
writer.writeDocs("@public");
Set<OperationShape> containedOperations =
new TreeSet<>(TopDownIndex.of(model).getContainedOperations(service));

Expand Down Expand Up @@ -179,11 +182,13 @@ private void generateClientConstructor() {
private void generateConfiguration() {
writer.pushState(CLIENT_CONFIG_SECTION);
String translateConfigType = DocumentClientUtils.CLIENT_TRANSLATE_CONFIG_TYPE;
writer.writeDocs("@public");
writer.openBlock("export type $L = {", "}", translateConfigType, () -> {
generateTranslateConfigOption(DocumentClientUtils.CLIENT_MARSHALL_OPTIONS);
generateTranslateConfigOption(DocumentClientUtils.CLIENT_UNMARSHALL_OPTIONS);
});
writer.write("");
writer.writeDocs("@public");
writer.openBlock("export type $L = $L & {", "};", DocumentClientUtils.CLIENT_CONFIG_NAME,
configType, () -> {
writer.write("$L?: $L;", DocumentClientUtils.CLIENT_TRANSLATE_CONFIG_KEY, translateConfigType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,18 @@ public void run() {
String servicePath = Paths.get(".", DocumentClientUtils.CLIENT_NAME).toString();
String configType = DocumentClientUtils.CLIENT_CONFIG_NAME;


// Add required imports.
writer.addImport(configType, configType, servicePath);
writer.addImport(
"DynamoDBDocumentClientCommand",
"DynamoDBDocumentClientCommand",
"./baseCommand/DynamoDBDocumentClientCommand"
);
writer.addImport("Command", "$Command", "@aws-sdk/smithy-client");

writer.writeDocs("@public");
writer.write("export { DynamoDBDocumentClientCommand, $$Command };");

generateInputAndOutputTypes();

Expand All @@ -117,7 +122,9 @@ public void run() {
});

String name = DocumentClientUtils.getModifiedName(symbol.getName());
writer.writeDocs(DocumentClientUtils.getCommandDocs(symbol.getName()));
writer.writeDocs(DocumentClientUtils.getCommandDocs(symbol.getName())
+ "\n\n@public"
);
writer.openBlock(
"export class $L extends DynamoDBDocumentClientCommand<" + ioTypes + ", $L> {",
"}",
Expand Down Expand Up @@ -289,6 +296,7 @@ private void writeType(
Optional<StructureShape> optionalShape,
List<MemberShape> membersWithAttr
) {
writer.writeDocs("@public");
if (optionalShape.isPresent()) {
writer.addImport(originalTypeName, "__" + originalTypeName, "@aws-sdk/client-dynamodb");
if (membersWithAttr.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public void run() {
writer.addImport(paginationType, paginationType,
Paths.get(".", getInterfaceFilelocation().replace(".ts", "")).toString());

writer.writeDocs("@public");
writer.write("export { Paginator }");

writeCommandRequest();
writeMethodRequest();
writePager();
Expand Down Expand Up @@ -123,6 +126,11 @@ static void generateServicePaginationInterfaces(TypeScriptWriter writer) {
DocumentClientUtils.CLIENT_FULL_NAME,
Paths.get(".", DocumentClientUtils.CLIENT_FULL_NAME).toString());

writer.writeDocs("@public");
writer.write("export { PaginationConfiguration };");
writer.write("");

writer.writeDocs("@public");
writer.openBlock("export interface $LPaginationConfiguration extends PaginationConfiguration {",
"}", DocumentClientUtils.CLIENT_FULL_NAME, () -> {
writer.write("client: $L | $L;", DocumentClientUtils.CLIENT_FULL_NAME, DocumentClientUtils.CLIENT_NAME);
Expand All @@ -137,6 +145,10 @@ private void writePager() {
String inputTokenName = paginatedInfo.getPaginatedTrait().getInputToken().get();
String outputTokenName = paginatedInfo.getPaginatedTrait().getOutputToken().get();

writer.writeDocs("@public\n\n"
+ String.format("@param %s - {@link %s}%n", inputTypeName, inputTypeName)
+ String.format("@returns {@link %s}%n", outputTypeName)
);
writer.openBlock(
"export async function* paginate$L(config: $L, input: $L, ...additionalArguments: any): Paginator<$L>{",
"}", operationName, paginationType, inputTypeName, outputTypeName, () -> {
Expand Down Expand Up @@ -188,7 +200,7 @@ private void writePager() {
* exposes the entire service.
*/
private void writeMethodRequest() {
writer.writeDocs("@private");
writer.writeDocs("@internal");
writer.openBlock(
"const makePagedRequest = async (client: $L, input: $L, ...args: any): Promise<$L> => {",
"}", DocumentClientUtils.CLIENT_FULL_NAME, inputTypeName,
Expand All @@ -203,7 +215,7 @@ private void writeMethodRequest() {
* environments and does not generally expose the entire service.
*/
private void writeCommandRequest() {
writer.writeDocs("@private");
writer.writeDocs("@internal");
writer.openBlock(
"const makePagedClientRequest = async (client: $L, input: $L, ...args: any): Promise<$L> => {",
"}", DocumentClientUtils.CLIENT_NAME, inputTypeName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ && containsAttributeValue(model, symbolProvider, unionMember, parents)) {
static String getCommandDocs(String operationName) {
return "Accepts native JavaScript types instead of `AttributeValue`s, and calls\n"
+ operationName + " operation from "
+ "{@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.\n\n"
+ "{@link @aws-sdk/client-dynamodb#"
+ operationName
+ "}.\n\n"
+ "JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes \n"
+ "required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.";
}
Expand Down Expand Up @@ -173,6 +175,6 @@ static String getClientDocs() {
+ "```json\n"
+ "[null, false, 1, \"two\"]\n"
+ "```\n\n"
+ "@see {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}";
+ "@see {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb | @aws-sdk/client-dynamodb}";
}
}
28 changes: 14 additions & 14 deletions lib/lib-dynamodb/src/DynamoDBDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { DynamoDBDocumentClient, TranslateConfig } from "./DynamoDBDocumentClien
* [null, false, 1, "two"]
* ```
*
* @see {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}
* @see {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb | @aws-sdk/client-dynamodb}
*/
export class DynamoDBDocument extends DynamoDBDocumentClient {
static from(client: DynamoDBClient, translateConfig?: TranslateConfig) {
Expand All @@ -86,7 +86,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* BatchExecuteStatementCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* BatchExecuteStatementCommand operation from {@link @aws-sdk/client-dynamodb#BatchExecuteStatementCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -122,7 +122,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* BatchGetItemCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* BatchGetItemCommand operation from {@link @aws-sdk/client-dynamodb#BatchGetItemCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -152,7 +152,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* BatchWriteItemCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* BatchWriteItemCommand operation from {@link @aws-sdk/client-dynamodb#BatchWriteItemCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -182,7 +182,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* DeleteItemCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* DeleteItemCommand operation from {@link @aws-sdk/client-dynamodb#DeleteItemCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -212,7 +212,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* ExecuteStatementCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* ExecuteStatementCommand operation from {@link @aws-sdk/client-dynamodb#ExecuteStatementCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -248,7 +248,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* ExecuteTransactionCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* ExecuteTransactionCommand operation from {@link @aws-sdk/client-dynamodb#ExecuteTransactionCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -284,7 +284,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* GetItemCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* GetItemCommand operation from {@link @aws-sdk/client-dynamodb#GetItemCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -314,7 +314,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* PutItemCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* PutItemCommand operation from {@link @aws-sdk/client-dynamodb#PutItemCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -344,7 +344,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* QueryCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* QueryCommand operation from {@link @aws-sdk/client-dynamodb#QueryCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -374,7 +374,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* ScanCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* ScanCommand operation from {@link @aws-sdk/client-dynamodb#ScanCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -404,7 +404,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* TransactGetItemsCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* TransactGetItemsCommand operation from {@link @aws-sdk/client-dynamodb#TransactGetItemsCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -434,7 +434,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* TransactWriteItemsCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* TransactWriteItemsCommand operation from {@link @aws-sdk/client-dynamodb#TransactWriteItemsCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down Expand Up @@ -470,7 +470,7 @@ export class DynamoDBDocument extends DynamoDBDocumentClient {

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* UpdateItemCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* UpdateItemCommand operation from {@link @aws-sdk/client-dynamodb#UpdateItemCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
Expand Down
20 changes: 19 additions & 1 deletion lib/lib-dynamodb/src/DynamoDBDocumentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ import { TransactGetCommandInput, TransactGetCommandOutput } from "./commands/Tr
import { TransactWriteCommandInput, TransactWriteCommandOutput } from "./commands/TransactWriteCommand";
import { UpdateCommandInput, UpdateCommandOutput } from "./commands/UpdateCommand";

/**
* @public
*/
export { __Client };
/**
* @public
*/
export type ServiceInputTypes =
| __ServiceInputTypes
| BatchExecuteStatementCommandInput
Expand All @@ -42,6 +49,9 @@ export type ServiceInputTypes =
| TransactWriteCommandInput
| UpdateCommandInput;

/**
* @public
*/
export type ServiceOutputTypes =
| __ServiceOutputTypes
| BatchExecuteStatementCommandOutput
Expand All @@ -58,11 +68,17 @@ export type ServiceOutputTypes =
| TransactWriteCommandOutput
| UpdateCommandOutput;

/**
* @public
*/
export type TranslateConfig = {
marshallOptions?: marshallOptions;
unmarshallOptions?: unmarshallOptions;
};

/**
* @public
*/
export type DynamoDBDocumentClientResolvedConfig = DynamoDBClientResolvedConfig & {
translateConfig?: TranslateConfig;
};
Expand Down Expand Up @@ -111,7 +127,9 @@ export type DynamoDBDocumentClientResolvedConfig = DynamoDBClientResolvedConfig
* [null, false, 1, "two"]
* ```
*
* @see {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}
* @see {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb | @aws-sdk/client-dynamodb}
*
* @public
*/
export class DynamoDBDocumentClient extends __Client<
__HttpHandlerOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ import {
import { KeyNode, marshallInput, unmarshallOutput } from "../commands/utils";
import { DynamoDBDocumentClientResolvedConfig } from "../DynamoDBDocumentClient";

// /** @public */
// export { $Command, DynamoDBDocumentClientResolvedConfig };

/**
* Base class for Commands in lib-dynamodb used to pass middleware to
* the underlying DynamoDBClient Commands.
*
* @public
*/
export abstract class DynamoDBDocumentClientCommand<
Input extends object,
Expand Down
16 changes: 15 additions & 1 deletion lib/lib-dynamodb/src/commands/BatchExecuteStatementCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ import {
BatchStatementRequest,
BatchStatementResponse,
} from "@aws-sdk/client-dynamodb";
import { Command as $Command } from "@aws-sdk/smithy-client";
import { Handler, HttpHandlerOptions as __HttpHandlerOptions, MiddlewareStack } from "@aws-sdk/types";
import { NativeAttributeValue } from "@aws-sdk/util-dynamodb";

import { DynamoDBDocumentClientCommand } from "../baseCommand/DynamoDBDocumentClientCommand";
import { DynamoDBDocumentClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DynamoDBDocumentClient";

/**
* @public
*/
export { DynamoDBDocumentClientCommand, $Command };

/**
* @public
*/
export type BatchExecuteStatementCommandInput = Omit<__BatchExecuteStatementCommandInput, "Statements"> & {
Statements:
| (Omit<BatchStatementRequest, "Parameters"> & {
Expand All @@ -20,6 +29,9 @@ export type BatchExecuteStatementCommandInput = Omit<__BatchExecuteStatementComm
| undefined;
};

/**
* @public
*/
export type BatchExecuteStatementCommandOutput = Omit<__BatchExecuteStatementCommandOutput, "Responses"> & {
Responses?: (Omit<BatchStatementResponse, "Item"> & {
Item?: Record<string, NativeAttributeValue>;
Expand All @@ -28,10 +40,12 @@ export type BatchExecuteStatementCommandOutput = Omit<__BatchExecuteStatementCom

/**
* Accepts native JavaScript types instead of `AttributeValue`s, and calls
* BatchExecuteStatementCommand operation from {@link https://www.npmjs.com/package/@aws-sdk/client-dynamodb @aws-sdk/client-dynamodb}.
* BatchExecuteStatementCommand operation from {@link @aws-sdk/client-dynamodb#BatchExecuteStatementCommand}.
*
* JavaScript objects passed in as parameters are marshalled into `AttributeValue` shapes
* required by Amazon DynamoDB. Responses from DynamoDB are unmarshalled into plain JavaScript objects.
*
* @public
*/
export class BatchExecuteStatementCommand extends DynamoDBDocumentClientCommand<
BatchExecuteStatementCommandInput,
Expand Down
Loading

0 comments on commit 4e4c7f4

Please sign in to comment.