@jaypie/constructs 1.2.14 → 1.2.15
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.
|
@@ -66,9 +66,10 @@ export interface JaypieDynamoDbProps extends Omit<dynamodb.TablePropsV2, "global
|
|
|
66
66
|
* - Billing: PAY_PER_REQUEST (on-demand)
|
|
67
67
|
* - Removal policy: RETAIN in production, DESTROY otherwise
|
|
68
68
|
* - No GSIs by default (use `indexes` prop to add them)
|
|
69
|
+
* - Table name: CDK-generated (includes stack name and unique suffix)
|
|
69
70
|
*
|
|
70
71
|
* @example
|
|
71
|
-
* // Shorthand:
|
|
72
|
+
* // Shorthand: construct id is "JaypieDynamoDb-myApp", table name is CDK-generated
|
|
72
73
|
* const table = new JaypieDynamoDb(this, "myApp");
|
|
73
74
|
*
|
|
74
75
|
* @example
|
|
@@ -78,7 +79,7 @@ export interface JaypieDynamoDbProps extends Omit<dynamodb.TablePropsV2, "global
|
|
|
78
79
|
* });
|
|
79
80
|
*
|
|
80
81
|
* @example
|
|
81
|
-
* // With
|
|
82
|
+
* // With explicit table name (overrides CDK-generated name)
|
|
82
83
|
* const table = new JaypieDynamoDb(this, "MyTable", {
|
|
83
84
|
* tableName: "custom-table-name",
|
|
84
85
|
* indexes: [
|
package/dist/esm/index.js
CHANGED
|
@@ -2717,9 +2717,10 @@ function indexesToGsi(indexes) {
|
|
|
2717
2717
|
* - Billing: PAY_PER_REQUEST (on-demand)
|
|
2718
2718
|
* - Removal policy: RETAIN in production, DESTROY otherwise
|
|
2719
2719
|
* - No GSIs by default (use `indexes` prop to add them)
|
|
2720
|
+
* - Table name: CDK-generated (includes stack name and unique suffix)
|
|
2720
2721
|
*
|
|
2721
2722
|
* @example
|
|
2722
|
-
* // Shorthand:
|
|
2723
|
+
* // Shorthand: construct id is "JaypieDynamoDb-myApp", table name is CDK-generated
|
|
2723
2724
|
* const table = new JaypieDynamoDb(this, "myApp");
|
|
2724
2725
|
*
|
|
2725
2726
|
* @example
|
|
@@ -2729,7 +2730,7 @@ function indexesToGsi(indexes) {
|
|
|
2729
2730
|
* });
|
|
2730
2731
|
*
|
|
2731
2732
|
* @example
|
|
2732
|
-
* // With
|
|
2733
|
+
* // With explicit table name (overrides CDK-generated name)
|
|
2733
2734
|
* const table = new JaypieDynamoDb(this, "MyTable", {
|
|
2734
2735
|
* tableName: "custom-table-name",
|
|
2735
2736
|
* indexes: [
|
|
@@ -2741,10 +2742,10 @@ function indexesToGsi(indexes) {
|
|
|
2741
2742
|
class JaypieDynamoDb extends Construct {
|
|
2742
2743
|
constructor(scope, id, props = {}) {
|
|
2743
2744
|
// Determine if this is shorthand usage: new JaypieDynamoDb(this, "myApp")
|
|
2744
|
-
// In shorthand, id
|
|
2745
|
+
// In shorthand, construct id is prefixed for clarity; tableName left undefined
|
|
2746
|
+
// so CDK generates it with stack prefix (e.g., cdk-sponsor-project-env-nonce-app-JaypieDynamoDb-myApp-Table-XXXXX)
|
|
2745
2747
|
const isShorthand = !props.tableName && !id.includes("-");
|
|
2746
2748
|
const constructId = isShorthand ? `JaypieDynamoDb-${id}` : id;
|
|
2747
|
-
const tableName = props.tableName ?? (isShorthand ? id : undefined);
|
|
2748
2749
|
super(scope, constructId);
|
|
2749
2750
|
const { billing = dynamodb.Billing.onDemand(), indexes, partitionKey = {
|
|
2750
2751
|
name: "model",
|
|
@@ -2760,7 +2761,6 @@ class JaypieDynamoDb extends Construct {
|
|
|
2760
2761
|
partitionKey,
|
|
2761
2762
|
removalPolicy,
|
|
2762
2763
|
sortKey,
|
|
2763
|
-
tableName,
|
|
2764
2764
|
...restProps,
|
|
2765
2765
|
});
|
|
2766
2766
|
// Apply tags
|