@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.
@@ -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: [
@@ -2349,7 +2349,7 @@ class JaypieDatadogSecret extends JaypieEnvSecret {
2349
2349
  class JaypieDistribution extends constructs.Construct {
2350
2350
  constructor(scope, id, props) {
2351
2351
  super(scope, id);
2352
- const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, invokeMode = lambda__namespace.InvokeMode.BUFFERED, logBucket: logBucketProp, originReadTimeout = cdk.Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), roleTag = CDK$2.ROLE.API, zone: propsZone, ...distributionProps } = props;
2352
+ const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, logBucket: logBucketProp, originReadTimeout = cdk.Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), roleTag = CDK$2.ROLE.API, streaming = false, zone: propsZone, ...distributionProps } = props;
2353
2353
  // Validate environment variables
2354
2354
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
2355
2355
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2403,13 +2403,9 @@ class JaypieDistribution extends constructs.Construct {
2403
2403
  // IFunction before IFunctionUrl (IFunction doesn't have functionUrlId)
2404
2404
  let origin;
2405
2405
  if (handler) {
2406
- // Auto-detect invoke mode from handler if it has an invokeMode property
2407
- // Explicit invokeMode prop takes precedence over auto-detection
2408
- const resolvedInvokeMode = invokeMode !== lambda__namespace.InvokeMode.BUFFERED
2409
- ? invokeMode // Explicit non-default value, use it
2410
- : this.hasInvokeMode(handler)
2411
- ? handler.invokeMode // Auto-detect from handler
2412
- : invokeMode; // Use default BUFFERED
2406
+ const resolvedInvokeMode = streaming
2407
+ ? lambda__namespace.InvokeMode.RESPONSE_STREAM
2408
+ : lambda__namespace.InvokeMode.BUFFERED;
2413
2409
  if (this.isIFunction(handler)) {
2414
2410
  // Create FunctionUrl for the Lambda function
2415
2411
  const functionUrl = new lambda__namespace.FunctionUrl(this, "FunctionUrl", {
@@ -2563,13 +2559,6 @@ class JaypieDistribution extends constructs.Construct {
2563
2559
  "functionName" in handler &&
2564
2560
  !("url" in handler));
2565
2561
  }
2566
- hasInvokeMode(handler) {
2567
- // Check if handler has an invokeMode property for streaming support
2568
- return (typeof handler === "object" &&
2569
- handler !== null &&
2570
- "invokeMode" in handler &&
2571
- typeof handler.invokeMode === "string");
2572
- }
2573
2562
  isExportNameObject(value) {
2574
2563
  return (typeof value === "object" &&
2575
2564
  value !== null &&
@@ -2749,9 +2738,10 @@ function indexesToGsi(indexes) {
2749
2738
  * - Billing: PAY_PER_REQUEST (on-demand)
2750
2739
  * - Removal policy: RETAIN in production, DESTROY otherwise
2751
2740
  * - No GSIs by default (use `indexes` prop to add them)
2741
+ * - Table name: CDK-generated (includes stack name and unique suffix)
2752
2742
  *
2753
2743
  * @example
2754
- * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
2744
+ * // Shorthand: construct id is "JaypieDynamoDb-myApp", table name is CDK-generated
2755
2745
  * const table = new JaypieDynamoDb(this, "myApp");
2756
2746
  *
2757
2747
  * @example
@@ -2761,7 +2751,7 @@ function indexesToGsi(indexes) {
2761
2751
  * });
2762
2752
  *
2763
2753
  * @example
2764
- * // With custom indexes
2754
+ * // With explicit table name (overrides CDK-generated name)
2765
2755
  * const table = new JaypieDynamoDb(this, "MyTable", {
2766
2756
  * tableName: "custom-table-name",
2767
2757
  * indexes: [
@@ -2773,10 +2763,10 @@ function indexesToGsi(indexes) {
2773
2763
  class JaypieDynamoDb extends constructs.Construct {
2774
2764
  constructor(scope, id, props = {}) {
2775
2765
  // Determine if this is shorthand usage: new JaypieDynamoDb(this, "myApp")
2776
- // In shorthand, id becomes the tableName and construct id is prefixed
2766
+ // In shorthand, construct id is prefixed for clarity; tableName left undefined
2767
+ // so CDK generates it with stack prefix (e.g., cdk-sponsor-project-env-nonce-app-JaypieDynamoDb-myApp-Table-XXXXX)
2777
2768
  const isShorthand = !props.tableName && !id.includes("-");
2778
2769
  const constructId = isShorthand ? `JaypieDynamoDb-${id}` : id;
2779
- const tableName = props.tableName ?? (isShorthand ? id : undefined);
2780
2770
  super(scope, constructId);
2781
2771
  const { billing = dynamodb__namespace.Billing.onDemand(), indexes, partitionKey = {
2782
2772
  name: "model",
@@ -2792,7 +2782,6 @@ class JaypieDynamoDb extends constructs.Construct {
2792
2782
  partitionKey,
2793
2783
  removalPolicy,
2794
2784
  sortKey,
2795
- tableName,
2796
2785
  ...restProps,
2797
2786
  });
2798
2787
  // Apply tags