@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: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
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 custom indexes
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: [
@@ -2749,9 +2749,10 @@ function indexesToGsi(indexes) {
2749
2749
  * - Billing: PAY_PER_REQUEST (on-demand)
2750
2750
  * - Removal policy: RETAIN in production, DESTROY otherwise
2751
2751
  * - No GSIs by default (use `indexes` prop to add them)
2752
+ * - Table name: CDK-generated (includes stack name and unique suffix)
2752
2753
  *
2753
2754
  * @example
2754
- * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
2755
+ * // Shorthand: construct id is "JaypieDynamoDb-myApp", table name is CDK-generated
2755
2756
  * const table = new JaypieDynamoDb(this, "myApp");
2756
2757
  *
2757
2758
  * @example
@@ -2761,7 +2762,7 @@ function indexesToGsi(indexes) {
2761
2762
  * });
2762
2763
  *
2763
2764
  * @example
2764
- * // With custom indexes
2765
+ * // With explicit table name (overrides CDK-generated name)
2765
2766
  * const table = new JaypieDynamoDb(this, "MyTable", {
2766
2767
  * tableName: "custom-table-name",
2767
2768
  * indexes: [
@@ -2773,10 +2774,10 @@ function indexesToGsi(indexes) {
2773
2774
  class JaypieDynamoDb extends constructs.Construct {
2774
2775
  constructor(scope, id, props = {}) {
2775
2776
  // Determine if this is shorthand usage: new JaypieDynamoDb(this, "myApp")
2776
- // In shorthand, id becomes the tableName and construct id is prefixed
2777
+ // In shorthand, construct id is prefixed for clarity; tableName left undefined
2778
+ // so CDK generates it with stack prefix (e.g., cdk-sponsor-project-env-nonce-app-JaypieDynamoDb-myApp-Table-XXXXX)
2777
2779
  const isShorthand = !props.tableName && !id.includes("-");
2778
2780
  const constructId = isShorthand ? `JaypieDynamoDb-${id}` : id;
2779
- const tableName = props.tableName ?? (isShorthand ? id : undefined);
2780
2781
  super(scope, constructId);
2781
2782
  const { billing = dynamodb__namespace.Billing.onDemand(), indexes, partitionKey = {
2782
2783
  name: "model",
@@ -2792,7 +2793,6 @@ class JaypieDynamoDb extends constructs.Construct {
2792
2793
  partitionKey,
2793
2794
  removalPolicy,
2794
2795
  sortKey,
2795
- tableName,
2796
2796
  ...restProps,
2797
2797
  });
2798
2798
  // Apply tags