@jaypie/constructs 1.2.14 → 1.2.16

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.
@@ -1,9 +1,9 @@
1
1
  export { CDK } from "./constants";
2
2
  export { JaypieAccountLoggingBucket, JaypieAccountLoggingBucketProps, } from "./JaypieAccountLoggingBucket";
3
- export { JaypieApiGateway, JaypieApiGatewayProps, } from "./JaypieApiGateway";
3
+ export { JaypieApiGateway, JaypieApiGatewayProps } from "./JaypieApiGateway";
4
4
  export { JaypieAppStack } from "./JaypieAppStack";
5
5
  export { JaypieBucketQueuedLambda } from "./JaypieBucketQueuedLambda";
6
- export { JaypieCertificate, JaypieCertificateProps, } from "./JaypieCertificate";
6
+ export { JaypieCertificate, JaypieCertificateProps } from "./JaypieCertificate";
7
7
  export { JaypieDatadogBucket, JaypieDatadogBucketProps, } from "./JaypieDatadogBucket";
8
8
  export { JaypieDatadogForwarder, JaypieDatadogForwarderProps, } from "./JaypieDatadogForwarder";
9
9
  export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
@@ -61,11 +61,11 @@ export interface JaypieDistributionProps extends Omit<cloudfront.DistributionPro
61
61
  */
62
62
  host?: string | HostConfig;
63
63
  /**
64
- * Invoke mode for Lambda Function URLs.
65
- * Use RESPONSE_STREAM for streaming responses with createLambdaStreamHandler.
66
- * @default InvokeMode.BUFFERED
64
+ * Enable response streaming for Lambda Function URLs.
65
+ * Use with createLambdaStreamHandler for SSE/streaming responses.
66
+ * @default false
67
67
  */
68
- invokeMode?: lambda.InvokeMode;
68
+ streaming?: boolean;
69
69
  /**
70
70
  * Origin read timeout - how long CloudFront waits for a response from the origin.
71
71
  * This is the maximum time allowed for the origin to respond.
@@ -98,7 +98,6 @@ export declare class JaypieDistribution extends Construct implements cloudfront.
98
98
  private isIOrigin;
99
99
  private isIFunctionUrl;
100
100
  private isIFunction;
101
- private hasInvokeMode;
102
101
  private isExportNameObject;
103
102
  private resolveLogBucket;
104
103
  get env(): {
@@ -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: [
@@ -1,9 +1,9 @@
1
1
  export { CDK } from "./constants";
2
2
  export { JaypieAccountLoggingBucket, JaypieAccountLoggingBucketProps, } from "./JaypieAccountLoggingBucket";
3
- export { JaypieApiGateway, JaypieApiGatewayProps, } from "./JaypieApiGateway";
3
+ export { JaypieApiGateway, JaypieApiGatewayProps } from "./JaypieApiGateway";
4
4
  export { JaypieAppStack } from "./JaypieAppStack";
5
5
  export { JaypieBucketQueuedLambda } from "./JaypieBucketQueuedLambda";
6
- export { JaypieCertificate, JaypieCertificateProps, } from "./JaypieCertificate";
6
+ export { JaypieCertificate, JaypieCertificateProps } from "./JaypieCertificate";
7
7
  export { JaypieDatadogBucket, JaypieDatadogBucketProps, } from "./JaypieDatadogBucket";
8
8
  export { JaypieDatadogForwarder, JaypieDatadogForwarderProps, } from "./JaypieDatadogForwarder";
9
9
  export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
package/dist/esm/index.js CHANGED
@@ -2317,7 +2317,7 @@ class JaypieDatadogSecret extends JaypieEnvSecret {
2317
2317
  class JaypieDistribution extends Construct {
2318
2318
  constructor(scope, id, props) {
2319
2319
  super(scope, id);
2320
- const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, invokeMode = lambda.InvokeMode.BUFFERED, logBucket: logBucketProp, originReadTimeout = Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), roleTag = CDK$2.ROLE.API, zone: propsZone, ...distributionProps } = props;
2320
+ const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), roleTag = CDK$2.ROLE.API, streaming = false, zone: propsZone, ...distributionProps } = props;
2321
2321
  // Validate environment variables
2322
2322
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
2323
2323
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2371,13 +2371,9 @@ class JaypieDistribution extends Construct {
2371
2371
  // IFunction before IFunctionUrl (IFunction doesn't have functionUrlId)
2372
2372
  let origin;
2373
2373
  if (handler) {
2374
- // Auto-detect invoke mode from handler if it has an invokeMode property
2375
- // Explicit invokeMode prop takes precedence over auto-detection
2376
- const resolvedInvokeMode = invokeMode !== lambda.InvokeMode.BUFFERED
2377
- ? invokeMode // Explicit non-default value, use it
2378
- : this.hasInvokeMode(handler)
2379
- ? handler.invokeMode // Auto-detect from handler
2380
- : invokeMode; // Use default BUFFERED
2374
+ const resolvedInvokeMode = streaming
2375
+ ? lambda.InvokeMode.RESPONSE_STREAM
2376
+ : lambda.InvokeMode.BUFFERED;
2381
2377
  if (this.isIFunction(handler)) {
2382
2378
  // Create FunctionUrl for the Lambda function
2383
2379
  const functionUrl = new lambda.FunctionUrl(this, "FunctionUrl", {
@@ -2531,13 +2527,6 @@ class JaypieDistribution extends Construct {
2531
2527
  "functionName" in handler &&
2532
2528
  !("url" in handler));
2533
2529
  }
2534
- hasInvokeMode(handler) {
2535
- // Check if handler has an invokeMode property for streaming support
2536
- return (typeof handler === "object" &&
2537
- handler !== null &&
2538
- "invokeMode" in handler &&
2539
- typeof handler.invokeMode === "string");
2540
- }
2541
2530
  isExportNameObject(value) {
2542
2531
  return (typeof value === "object" &&
2543
2532
  value !== null &&
@@ -2717,9 +2706,10 @@ function indexesToGsi(indexes) {
2717
2706
  * - Billing: PAY_PER_REQUEST (on-demand)
2718
2707
  * - Removal policy: RETAIN in production, DESTROY otherwise
2719
2708
  * - No GSIs by default (use `indexes` prop to add them)
2709
+ * - Table name: CDK-generated (includes stack name and unique suffix)
2720
2710
  *
2721
2711
  * @example
2722
- * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
2712
+ * // Shorthand: construct id is "JaypieDynamoDb-myApp", table name is CDK-generated
2723
2713
  * const table = new JaypieDynamoDb(this, "myApp");
2724
2714
  *
2725
2715
  * @example
@@ -2729,7 +2719,7 @@ function indexesToGsi(indexes) {
2729
2719
  * });
2730
2720
  *
2731
2721
  * @example
2732
- * // With custom indexes
2722
+ * // With explicit table name (overrides CDK-generated name)
2733
2723
  * const table = new JaypieDynamoDb(this, "MyTable", {
2734
2724
  * tableName: "custom-table-name",
2735
2725
  * indexes: [
@@ -2741,10 +2731,10 @@ function indexesToGsi(indexes) {
2741
2731
  class JaypieDynamoDb extends Construct {
2742
2732
  constructor(scope, id, props = {}) {
2743
2733
  // Determine if this is shorthand usage: new JaypieDynamoDb(this, "myApp")
2744
- // In shorthand, id becomes the tableName and construct id is prefixed
2734
+ // In shorthand, construct id is prefixed for clarity; tableName left undefined
2735
+ // so CDK generates it with stack prefix (e.g., cdk-sponsor-project-env-nonce-app-JaypieDynamoDb-myApp-Table-XXXXX)
2745
2736
  const isShorthand = !props.tableName && !id.includes("-");
2746
2737
  const constructId = isShorthand ? `JaypieDynamoDb-${id}` : id;
2747
- const tableName = props.tableName ?? (isShorthand ? id : undefined);
2748
2738
  super(scope, constructId);
2749
2739
  const { billing = dynamodb.Billing.onDemand(), indexes, partitionKey = {
2750
2740
  name: "model",
@@ -2760,7 +2750,6 @@ class JaypieDynamoDb extends Construct {
2760
2750
  partitionKey,
2761
2751
  removalPolicy,
2762
2752
  sortKey,
2763
- tableName,
2764
2753
  ...restProps,
2765
2754
  });
2766
2755
  // Apply tags