Skip to content

Commit ccc521c

Browse files
committed
fix(lib-dynamodb): input types conflicts with client-dynamodb
aws#6654 added `| undefined` to optional model props, but the types in lib-dynamodb wasn't updated to reflect that change. This leaves consumers using `exactOptionalPropertyTypes: true` with ts errors when trying to use almost any of the commands in lib-dynamodb Fixes aws#6668
1 parent 663b3c6 commit ccc521c

10 files changed

+103
-77
lines changed

lib/lib-dynamodb/src/commands/BatchExecuteStatementCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export { DynamoDBDocumentClientCommand, $Command };
1818
export type BatchExecuteStatementCommandInput = Omit<__BatchExecuteStatementCommandInput, "Statements"> & {
1919
Statements:
2020
| (Omit<BatchStatementRequest, "Parameters"> & {
21-
Parameters?: NativeAttributeValue[];
21+
Parameters?: NativeAttributeValue[] | undefined;
2222
})[]
2323
| undefined;
2424
};

lib/lib-dynamodb/src/commands/BatchWriteCommand.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ export type BatchWriteCommandInput = Omit<__BatchWriteItemCommandInput, "Request
2020
| Record<
2121
string,
2222
(Omit<WriteRequest, "PutRequest" | "DeleteRequest"> & {
23-
PutRequest?: Omit<PutRequest, "Item"> & {
24-
Item: Record<string, NativeAttributeValue> | undefined;
25-
};
26-
DeleteRequest?: Omit<DeleteRequest, "Key"> & {
27-
Key: Record<string, NativeAttributeValue> | undefined;
28-
};
23+
PutRequest?:
24+
| (Omit<PutRequest, "Item"> & {
25+
Item: Record<string, NativeAttributeValue> | undefined;
26+
})
27+
| undefined;
28+
DeleteRequest?:
29+
| (Omit<DeleteRequest, "Key"> & {
30+
Key: Record<string, NativeAttributeValue> | undefined;
31+
})
32+
| undefined;
2933
})[]
3034
>
3135
| undefined;

lib/lib-dynamodb/src/commands/DeleteCommand.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ export { DynamoDBDocumentClientCommand, $Command };
1717
*/
1818
export type DeleteCommandInput = Omit<__DeleteItemCommandInput, "Key" | "Expected" | "ExpressionAttributeValues"> & {
1919
Key: Record<string, NativeAttributeValue> | undefined;
20-
Expected?: Record<
21-
string,
22-
Omit<ExpectedAttributeValue, "Value" | "AttributeValueList"> & {
23-
Value?: NativeAttributeValue;
24-
AttributeValueList?: NativeAttributeValue[];
25-
}
26-
>;
27-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
20+
Expected?:
21+
| Record<
22+
string,
23+
| Omit<ExpectedAttributeValue, "Value" | "AttributeValueList"> & {
24+
Value?: NativeAttributeValue;
25+
AttributeValueList?: NativeAttributeValue[] | undefined;
26+
}
27+
>
28+
| undefined;
29+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
2830
};
2931

3032
/**

lib/lib-dynamodb/src/commands/ExecuteStatementCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export { DynamoDBDocumentClientCommand, $Command };
1616
* @public
1717
*/
1818
export type ExecuteStatementCommandInput = Omit<__ExecuteStatementCommandInput, "Parameters"> & {
19-
Parameters?: NativeAttributeValue[];
19+
Parameters?: NativeAttributeValue[] | undefined;
2020
};
2121

2222
/**

lib/lib-dynamodb/src/commands/ExecuteTransactionCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export { DynamoDBDocumentClientCommand, $Command };
1818
export type ExecuteTransactionCommandInput = Omit<__ExecuteTransactionCommandInput, "TransactStatements"> & {
1919
TransactStatements:
2020
| (Omit<ParameterizedStatement, "Parameters"> & {
21-
Parameters?: NativeAttributeValue[];
21+
Parameters?: NativeAttributeValue[] | undefined;
2222
})[]
2323
| undefined;
2424
};

lib/lib-dynamodb/src/commands/PutCommand.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ export { DynamoDBDocumentClientCommand, $Command };
1717
*/
1818
export type PutCommandInput = Omit<__PutItemCommandInput, "Item" | "Expected" | "ExpressionAttributeValues"> & {
1919
Item: Record<string, NativeAttributeValue> | undefined;
20-
Expected?: Record<
21-
string,
22-
Omit<ExpectedAttributeValue, "Value" | "AttributeValueList"> & {
23-
Value?: NativeAttributeValue;
24-
AttributeValueList?: NativeAttributeValue[];
25-
}
26-
>;
27-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
20+
Expected?:
21+
| Record<
22+
string,
23+
Omit<ExpectedAttributeValue, "Value" | "AttributeValueList"> & {
24+
Value?: NativeAttributeValue | undefined;
25+
AttributeValueList?: NativeAttributeValue[] | undefined;
26+
}
27+
>
28+
| undefined;
29+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
2830
};
2931

3032
/**

lib/lib-dynamodb/src/commands/QueryCommand.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,24 @@ export type QueryCommandInput = Omit<
1919
__QueryCommandInput,
2020
"KeyConditions" | "QueryFilter" | "ExclusiveStartKey" | "ExpressionAttributeValues"
2121
> & {
22-
KeyConditions?: Record<
23-
string,
24-
Omit<Condition, "AttributeValueList"> & {
25-
AttributeValueList?: NativeAttributeValue[];
26-
}
27-
>;
28-
QueryFilter?: Record<
29-
string,
30-
Omit<Condition, "AttributeValueList"> & {
31-
AttributeValueList?: NativeAttributeValue[];
32-
}
33-
>;
34-
ExclusiveStartKey?: Record<string, NativeAttributeValue>;
35-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
22+
KeyConditions?:
23+
| Record<
24+
string,
25+
Omit<Condition, "AttributeValueList"> & {
26+
AttributeValueList?: NativeAttributeValue[] | undefined;
27+
}
28+
>
29+
| undefined;
30+
QueryFilter?:
31+
| Record<
32+
string,
33+
Omit<Condition, "AttributeValueList"> & {
34+
AttributeValueList?: NativeAttributeValue[] | undefined;
35+
}
36+
>
37+
| undefined;
38+
ExclusiveStartKey?: Record<string, NativeAttributeValue> | undefined;
39+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
3640
};
3741

3842
/**

lib/lib-dynamodb/src/commands/ScanCommand.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ export type ScanCommandInput = Omit<
1919
__ScanCommandInput,
2020
"ScanFilter" | "ExclusiveStartKey" | "ExpressionAttributeValues"
2121
> & {
22-
ScanFilter?: Record<
23-
string,
24-
Omit<Condition, "AttributeValueList"> & {
25-
AttributeValueList?: NativeAttributeValue[];
26-
}
27-
>;
28-
ExclusiveStartKey?: Record<string, NativeAttributeValue>;
29-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
22+
ScanFilter?:
23+
| Record<
24+
string,
25+
Omit<Condition, "AttributeValueList"> & {
26+
AttributeValueList?: NativeAttributeValue[] | undefined;
27+
}
28+
>
29+
| undefined;
30+
ExclusiveStartKey?: Record<string, NativeAttributeValue> | undefined;
31+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
3032
};
3133

3234
/**

lib/lib-dynamodb/src/commands/TransactWriteCommand.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,30 @@ export { DynamoDBDocumentClientCommand, $Command };
1818
export type TransactWriteCommandInput = Omit<__TransactWriteItemsCommandInput, "TransactItems"> & {
1919
TransactItems:
2020
| (Omit<TransactWriteItem, "ConditionCheck" | "Put" | "Delete" | "Update"> & {
21-
ConditionCheck?: Omit<ConditionCheck, "Key" | "ExpressionAttributeValues"> & {
22-
Key: Record<string, NativeAttributeValue> | undefined;
23-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
24-
};
25-
Put?: Omit<Put, "Item" | "ExpressionAttributeValues"> & {
26-
Item: Record<string, NativeAttributeValue> | undefined;
27-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
28-
};
29-
Delete?: Omit<Delete, "Key" | "ExpressionAttributeValues"> & {
30-
Key: Record<string, NativeAttributeValue> | undefined;
31-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
32-
};
33-
Update?: Omit<Update, "Key" | "ExpressionAttributeValues"> & {
34-
Key: Record<string, NativeAttributeValue> | undefined;
35-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
36-
};
21+
ConditionCheck?:
22+
| (Omit<ConditionCheck, "Key" | "ExpressionAttributeValues"> & {
23+
Key: Record<string, NativeAttributeValue> | undefined;
24+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
25+
})
26+
| undefined;
27+
Put?:
28+
| (Omit<Put, "Item" | "ExpressionAttributeValues"> & {
29+
Item: Record<string, NativeAttributeValue> | undefined;
30+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
31+
})
32+
| undefined;
33+
Delete?:
34+
| (Omit<Delete, "Key" | "ExpressionAttributeValues"> & {
35+
Key: Record<string, NativeAttributeValue> | undefined;
36+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
37+
})
38+
| undefined;
39+
Update?:
40+
| (Omit<Update, "Key" | "ExpressionAttributeValues"> & {
41+
Key: Record<string, NativeAttributeValue> | undefined;
42+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
43+
})
44+
| undefined;
3745
})[]
3846
| undefined;
3947
};

lib/lib-dynamodb/src/commands/UpdateCommand.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,24 @@ export type UpdateCommandInput = Omit<
2020
"Key" | "AttributeUpdates" | "Expected" | "ExpressionAttributeValues"
2121
> & {
2222
Key: Record<string, NativeAttributeValue> | undefined;
23-
AttributeUpdates?: Record<
24-
string,
25-
Omit<AttributeValueUpdate, "Value"> & {
26-
Value?: NativeAttributeValue;
27-
}
28-
>;
29-
Expected?: Record<
30-
string,
31-
Omit<ExpectedAttributeValue, "Value" | "AttributeValueList"> & {
32-
Value?: NativeAttributeValue;
33-
AttributeValueList?: NativeAttributeValue[];
34-
}
35-
>;
36-
ExpressionAttributeValues?: Record<string, NativeAttributeValue>;
23+
AttributeUpdates?:
24+
| Record<
25+
string,
26+
Omit<AttributeValueUpdate, "Value"> & {
27+
Value?: NativeAttributeValue;
28+
}
29+
>
30+
| undefined;
31+
Expected?:
32+
| Record<
33+
string,
34+
Omit<ExpectedAttributeValue, "Value" | "AttributeValueList"> & {
35+
Value?: NativeAttributeValue;
36+
AttributeValueList?: NativeAttributeValue[] | undefined;
37+
}
38+
>
39+
| undefined;
40+
ExpressionAttributeValues?: Record<string, NativeAttributeValue> | undefined;
3741
};
3842

3943
/**

0 commit comments

Comments
 (0)