@ts-cloud/core 0.7.55 → 0.7.57

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.
Files changed (44) hide show
  1. package/dist/aws/cloudformation.d.ts +0 -4
  2. package/dist/aws/cloudfront.d.ts +0 -4
  3. package/dist/aws/credentials.d.ts +0 -10
  4. package/dist/aws/index.d.ts +7 -7
  5. package/dist/aws/s3.d.ts +2 -2
  6. package/dist/backup/index.d.ts +3 -3
  7. package/dist/cloudformation/builder.d.ts +1 -1
  8. package/dist/cloudformation/builders/api-gateway.d.ts +2 -0
  9. package/dist/cloudformation/builders/api-gateway.test.d.ts +1 -0
  10. package/dist/cloudformation/builders/compute-fargate.test.d.ts +1 -0
  11. package/dist/cloudformation/builders/compute.d.ts +31 -1
  12. package/dist/cloudformation/index.d.ts +2 -2
  13. package/dist/compliance/index.d.ts +5 -5
  14. package/dist/deployment/index.d.ts +7 -7
  15. package/dist/errors/index.d.ts +2 -2
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +3839 -4039
  18. package/dist/modules/ai.d.ts +1 -1
  19. package/dist/modules/auth.d.ts +1 -1
  20. package/dist/modules/cdn.d.ts +1 -1
  21. package/dist/modules/deployment.d.ts +1 -1
  22. package/dist/modules/monitoring.d.ts +1 -1
  23. package/dist/modules/phone.d.ts +0 -5
  24. package/dist/modules/secrets.d.ts +1 -1
  25. package/dist/modules/sms.d.ts +2 -2
  26. package/dist/modules/storage.d.ts +1 -2
  27. package/dist/modules/workflow.d.ts +1 -1
  28. package/dist/presets/fullstack-app.d.ts +17 -0
  29. package/dist/presets/fullstack-app.test.d.ts +1 -0
  30. package/dist/presets/index.d.ts +1 -1
  31. package/dist/preview/index.d.ts +4 -4
  32. package/dist/runtime/adapter.ts +22 -13
  33. package/dist/serverless/app-image.d.ts +0 -12
  34. package/dist/serverless/composer.d.ts +1 -1
  35. package/dist/serverless/runtimes/index.d.ts +0 -9
  36. package/dist/serverless/zip.d.ts +0 -9
  37. package/dist/serverless-php/layer-build.d.ts +1 -13
  38. package/dist/serverless-php/package-php.d.ts +1 -1
  39. package/dist/serverless-php/runtime-assets.d.ts +0 -7
  40. package/dist/types.d.ts +21 -0
  41. package/dist/utils/cache.d.ts +0 -4
  42. package/dist/utils/hash.d.ts +0 -4
  43. package/dist/validators/quotas.d.ts +0 -4
  44. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import type { IAMRole, IAMManagedPolicy } from '@ts-cloud/aws-types';
1
+ import type { IAMManagedPolicy, IAMRole } from '@ts-cloud/aws-types';
2
2
  import type { EnvironmentType } from '../types';
3
3
  export interface BedrockRoleOptions {
4
4
  slug: string;
@@ -1,4 +1,4 @@
1
- import type { CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoIdentityPool, CognitoIdentityPoolRoleAttachment, IAMRole } from '@ts-cloud/aws-types';
1
+ import type { CognitoIdentityPool, CognitoIdentityPoolRoleAttachment, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, IAMRole } from '@ts-cloud/aws-types';
2
2
  import type { EnvironmentType } from '../types';
3
3
  export interface UserPoolOptions {
4
4
  slug: string;
@@ -1,4 +1,4 @@
1
- import type { CloudFrontDistribution, CloudFrontOriginAccessControl, LambdaFunction, IAMRole } from '@ts-cloud/aws-types';
1
+ import type { CloudFrontDistribution, CloudFrontOriginAccessControl, IAMRole, LambdaFunction } from '@ts-cloud/aws-types';
2
2
  import type { EnvironmentType } from '../types';
3
3
  export interface DistributionOptions {
4
4
  slug: string;
@@ -1,4 +1,4 @@
1
- import type { CodeDeployApplication, CodeDeployDeploymentGroup, CodeDeployDeploymentConfig } from '@ts-cloud/aws-types';
1
+ import type { CodeDeployApplication, CodeDeployDeploymentConfig, CodeDeployDeploymentGroup } from '@ts-cloud/aws-types';
2
2
  import type { EnvironmentType } from '../types';
3
3
  /**
4
4
  * Asset file with hash information
@@ -1,4 +1,4 @@
1
- import type { CloudWatchAlarm, CloudWatchDashboard, CloudWatchLogGroup, CloudWatchLogStream, CloudWatchMetricFilter, CloudWatchCompositeAlarm } from '@ts-cloud/aws-types';
1
+ import type { CloudWatchAlarm, CloudWatchCompositeAlarm, CloudWatchDashboard, CloudWatchLogGroup, CloudWatchLogStream, CloudWatchMetricFilter } from '@ts-cloud/aws-types';
2
2
  import type { EnvironmentType } from '../types';
3
3
  export interface AlarmOptions {
4
4
  slug: string;
@@ -1,8 +1,3 @@
1
- /**
2
- * Phone/Voice Module for CloudFormation
3
- *
4
- * Provides CloudFormation resources for Amazon Connect phone infrastructure
5
- */
6
1
  export interface PhoneConfig {
7
2
  slug: string;
8
3
  environment: string;
@@ -2,7 +2,7 @@
2
2
  * Secrets Manager Module
3
3
  * Clean API for AWS Secrets Manager
4
4
  */
5
- import type { SecretsManagerSecret, SecretsManagerSecretTargetAttachment, SecretsManagerRotationSchedule } from '@ts-cloud/aws-types';
5
+ import type { SecretsManagerRotationSchedule, SecretsManagerSecret, SecretsManagerSecretTargetAttachment } from '@ts-cloud/aws-types';
6
6
  export interface SecretOptions {
7
7
  slug: string;
8
8
  environment: string;
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * Provides CloudFormation resources for AWS Pinpoint SMS infrastructure
5
5
  */
6
- import { handler as sendHandler } from '../sms/handlers/send';
7
- import { handler as receiveHandler } from '../sms/handlers/receive';
8
6
  import { handler as deliveryStatusHandler } from '../sms/handlers/delivery-status';
7
+ import { handler as receiveHandler } from '../sms/handlers/receive';
8
+ import { handler as sendHandler } from '../sms/handlers/send';
9
9
  export interface SmsConfig {
10
10
  slug: string;
11
11
  environment: string;
@@ -1,5 +1,4 @@
1
- import type { BackupPlan, BackupSelection, BackupVault, S3Bucket, S3BucketPolicy } from '@ts-cloud/aws-types';
2
- import type { IAMRole } from '@ts-cloud/aws-types';
1
+ import type { BackupPlan, BackupSelection, BackupVault, IAMRole, S3Bucket, S3BucketPolicy } from '@ts-cloud/aws-types';
3
2
  import type { EnvironmentType } from '../types';
4
3
  export interface BucketOptions {
5
4
  name?: string;
@@ -1,4 +1,4 @@
1
- import type { StepFunctionsStateMachine, IAMRole } from '@ts-cloud/aws-types';
1
+ import type { IAMRole, StepFunctionsStateMachine } from '@ts-cloud/aws-types';
2
2
  import type { EnvironmentType } from '../types';
3
3
  export interface StateMachineOptions {
4
4
  slug: string;
@@ -1,4 +1,21 @@
1
1
  import type { CloudConfig } from '../types';
2
+ /**
3
+ * Backend-only companion stack for an already deployed S3/CloudFront frontend.
4
+ * The caller attaches AppLoadBalancerDnsName to the existing distribution only
5
+ * after this stack is healthy.
6
+ */
7
+ export declare function createExistingStaticFullStackPreset(options: {
8
+ name: string;
9
+ slug: string;
10
+ domain: string;
11
+ imageUri: string;
12
+ certificateArn?: string;
13
+ originVerifySecret?: string;
14
+ desiredCount?: number;
15
+ database?: boolean;
16
+ cache?: boolean;
17
+ queue?: boolean;
18
+ }): Partial<CloudConfig>;
2
19
  /**
3
20
  * Full Stack App Preset
4
21
  * Perfect for: Complete web applications with frontend and API
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,7 @@ export { createStaticSitePreset } from './static-site';
2
2
  export { createNodeJsServerPreset } from './nodejs-server';
3
3
  export { createNodeJsServerlessPreset } from './nodejs-serverless';
4
4
  export { createServerlessNodePreset } from './serverless-node';
5
- export { createFullStackAppPreset } from './fullstack-app';
5
+ export { createExistingStaticFullStackPreset, createFullStackAppPreset } from './fullstack-app';
6
6
  export { createApiBackendPreset } from './api-backend';
7
7
  export { createWordPressPreset } from './wordpress';
8
8
  export { createJamstackPreset } from './jamstack';
@@ -2,9 +2,9 @@
2
2
  * Preview Environments
3
3
  * Ephemeral environments for PR/branch previews
4
4
  */
5
- export { PreviewEnvironmentManager, previewManager, } from './manager';
6
- export type { PreviewEnvironment, PreviewEnvironmentOptions, PreviewCleanupOptions, } from './manager';
7
- export { generatePreviewWorkflow, generateCleanupWorkflow, generateCostReportWorkflow, } from './github';
5
+ export { PreviewEnvironmentManager, previewManager } from './manager';
6
+ export type { PreviewEnvironment, PreviewEnvironmentOptions, PreviewCleanupOptions } from './manager';
7
+ export { generatePreviewWorkflow, generateCleanupWorkflow, generateCostReportWorkflow } from './github';
8
8
  export type { GitHubWorkflowOptions } from './github';
9
- export { PreviewNotificationService, previewNotifications, } from './notifications';
9
+ export { PreviewNotificationService, previewNotifications } from './notifications';
10
10
  export type { NotificationChannel, SlackConfig, DiscordConfig, EmailConfig, WebhookConfig, NotificationEvent, } from './notifications';
@@ -107,7 +107,8 @@ export function resolveApp(mod: unknown): ServerlessApp {
107
107
 
108
108
  // ── Body / content helpers ──────────────────────────────────────────────────
109
109
 
110
- const TEXT_CONTENT = /^(?:text\/|application\/(?:json|xml|javascript|graphql|x-www-form-urlencoded|.*\+json|.*\+xml)|image\/svg)/i
110
+ const TEXT_CONTENT =
111
+ /^(?:text\/|application\/(?:json|xml|javascript|graphql|x-www-form-urlencoded|.*\+json|.*\+xml)|image\/svg)/i
111
112
 
112
113
  function isTextContentType(contentType: string | null): boolean {
113
114
  // No declared type → treat as text (the common case for `new Response(str)`).
@@ -130,7 +131,7 @@ export interface HttpAdapterOptions {
130
131
  }
131
132
  }
132
133
 
133
- function readMaintenance(opts?: HttpAdapterOptions): { enabled: boolean, bypassSecret?: string } {
134
+ function readMaintenance(opts?: HttpAdapterOptions): { enabled: boolean; bypassSecret?: string } {
134
135
  if (opts?.maintenance) return opts.maintenance
135
136
  const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env ?? {}
136
137
  return {
@@ -168,9 +169,10 @@ export async function responseToResult(response: Response): Promise<ApiGatewayPr
168
169
  const cookies: string[] = []
169
170
 
170
171
  // `getSetCookie` is available in the Lambda runtime's undici Headers.
171
- const setCookies = typeof (response.headers as { getSetCookie?: () => string[] }).getSetCookie === 'function'
172
- ? (response.headers as { getSetCookie: () => string[] }).getSetCookie()
173
- : []
172
+ const setCookies =
173
+ typeof (response.headers as { getSetCookie?: () => string[] }).getSetCookie === 'function'
174
+ ? (response.headers as { getSetCookie: () => string[] }).getSetCookie()
175
+ : []
174
176
  for (const c of setCookies) cookies.push(c)
175
177
 
176
178
  response.headers.forEach((value, key) => {
@@ -203,13 +205,19 @@ export function createHttpHandler(handler: FetchHandler | undefined, opts?: Http
203
205
  }
204
206
 
205
207
  if (!handler) {
206
- return { statusCode: 501, headers: { 'content-type': 'text/plain' }, body: 'No HTTP handler configured', isBase64Encoded: false }
208
+ return {
209
+ statusCode: 501,
210
+ headers: { 'content-type': 'text/plain' },
211
+ body: 'No HTTP handler configured',
212
+ isBase64Encoded: false,
213
+ }
207
214
  }
208
215
 
209
216
  const maintenance = readMaintenance(opts)
210
217
  if (maintenance.enabled) {
211
- const bypass = event.headers?.['x-maintenance-bypass']
212
- ?? (event.cookies?.find(c => c.startsWith('tscloud_bypass='))?.split('=')[1])
218
+ const bypass =
219
+ event.headers?.['x-maintenance-bypass'] ??
220
+ event.cookies?.find((c) => c.startsWith('tscloud_bypass='))?.split('=')[1]
213
221
  if (!maintenance.bypassSecret || bypass !== maintenance.bypassSecret) {
214
222
  return {
215
223
  statusCode: 503,
@@ -231,8 +239,7 @@ export function createHttpHandler(handler: FetchHandler | undefined, opts?: Http
231
239
  function parseRecordBody(body: string): unknown {
232
240
  try {
233
241
  return JSON.parse(body)
234
- }
235
- catch {
242
+ } catch {
236
243
  return body
237
244
  }
238
245
  }
@@ -253,8 +260,7 @@ export function createQueueHandler(handler: JobHandler | undefined): LambdaQueue
253
260
  for (const record of event.Records ?? []) {
254
261
  try {
255
262
  await handler(parseRecordBody(record.body), record)
256
- }
257
- catch {
263
+ } catch {
258
264
  batchItemFailures.push({ itemIdentifier: record.messageId })
259
265
  }
260
266
  }
@@ -279,7 +285,10 @@ export function createCliHandler(handler: CommandHandler | undefined): LambdaCli
279
285
  }
280
286
 
281
287
  /** Convenience: build all three Lambda handlers from a resolved app. */
282
- export function createHandlers(app: ServerlessApp, opts?: HttpAdapterOptions): {
288
+ export function createHandlers(
289
+ app: ServerlessApp,
290
+ opts?: HttpAdapterOptions,
291
+ ): {
283
292
  http: LambdaHttpHandler
284
293
  queue: LambdaQueueHandler
285
294
  cli: LambdaCliHandler
@@ -1,15 +1,3 @@
1
- /**
2
- * Generates the application container-image Dockerfile for serverless apps that
3
- * exceed the 250 MB zip/layer limit (`packaging: 'image'`). Lambda runs the
4
- * image directly (up to 10 GB).
5
- *
6
- * - Node/Bun: FROM the AWS Lambda Node base image; the bundled handler is copied
7
- * to the task root and the function's `ImageConfig.Command` selects the export.
8
- * - PHP: a self-contained multi-stage build — stage 1 compiles + relocates PHP
9
- * (the same recipe as the runtime layer), stage 2 is the `provided.al2023`
10
- * base with /opt (runtime) + /var/task (app) baked in; the bootstrap selects
11
- * the mode from `TSCLOUD_LAMBDA_MODE`.
12
- */
13
1
  export interface AppImageDockerfileOptions {
14
2
  kind: 'node' | 'bun' | 'php';
15
3
  /** Node runtime tag (e.g. '20') — used for the Lambda Node base image. */
@@ -10,8 +10,8 @@
10
10
  * stack updates never revert the deployed code. Alias-based blue/green is a v2
11
11
  * refinement.
12
12
  */
13
- import type { CloudConfig, EnvironmentType, ServerlessAppConfig } from '../types';
14
13
  import type { CloudFormationTemplate } from '../cloudformation/types';
14
+ import type { CloudConfig, EnvironmentType, ServerlessAppConfig } from '../types';
15
15
  export interface ComposeOptions {
16
16
  config: Pick<CloudConfig, 'project'>;
17
17
  environment: EnvironmentType;
@@ -1,12 +1,3 @@
1
- /**
2
- * Unified custom-runtime (`provided.al2023`) layer builders for Node and Bun.
3
- *
4
- * Both ship the same shape as the PHP runtime layer — a binary + a `bootstrap`
5
- * entrypoint + the shared {@link runtime.mjs} Runtime API loop — so newer Node
6
- * versions (e.g. 24, beyond AWS's managed runtimes) and Bun run on Lambda the
7
- * same way Laravel/PHP does. Unlike the PHP layer these need no Docker: the
8
- * official binary is downloaded and zipped directly.
9
- */
10
1
  export type RuntimeArch = 'x86_64' | 'arm64';
11
2
  /** The shared Runtime API loop source (bundled into every node/bun layer). */
12
3
  export declare function sharedRuntimeLoop(): string;
@@ -1,12 +1,3 @@
1
- /**
2
- * Minimal, dependency-free ZIP writer for Lambda deployment artifacts.
3
- *
4
- * Lambda deployment packages must be ZIP archives. This generalizes the
5
- * single-file writer in `ts-cloud/src/aws/lambda.ts` to multiple files so the
6
- * same code path serves a bundled Node/Bun handler (one file) and a full
7
- * PHP/Laravel application tree (many files). Uses Node's `zlib` only — no
8
- * third-party zip dependency, in keeping with the zero-dependency ethos.
9
- */
10
1
  export interface ZipEntry {
11
2
  /** POSIX path inside the archive (forward slashes). */
12
3
  name: string;
@@ -1,16 +1,4 @@
1
- /**
2
- * Builds the ts-cloud PHP runtime layer ZIP.
3
- *
4
- * Runs the generated Dockerfile to produce a /opt tree (PHP + php-fpm +
5
- * extensions for AL2023), extracts it, injects the runtime assets
6
- * (bootstrap/runtime loops/fpm config), and packages everything as a Lambda
7
- * layer ZIP. Publishing the ZIP as a layer version is done by the CLI using the
8
- * ts-cloud Lambda client; this module only produces the artifact.
9
- *
10
- * Requires Docker. Intended to run in CI to publish a versioned, ts-cloud-owned
11
- * layer that user deploys reference (no per-deploy compilation).
12
- */
13
- import { type PhpDockerfileOptions } from './dockerfile';
1
+ import type { PhpDockerfileOptions } from './dockerfile';
14
2
  export interface BuildPhpLayerOptions extends PhpDockerfileOptions {
15
3
  /** Target architecture. @default 'x86_64' */
16
4
  architecture?: 'x86_64' | 'arm64';
@@ -7,8 +7,8 @@
7
7
  * Build hooks (composer install + artisan caches) run before packaging because
8
8
  * the Lambda filesystem is read-only at runtime.
9
9
  */
10
+ import type { ZipEntry } from '../serverless/zip';
10
11
  import type { ServerlessAppConfig } from '../types';
11
- import { type ZipEntry } from '../serverless/zip';
12
12
  /** Paths excluded from the PHP deployment artifact by default. */
13
13
  export declare const PHP_DEFAULT_EXCLUDES: string[];
14
14
  export interface PackagePhpOptions {
@@ -1,10 +1,3 @@
1
- /**
2
- * Accessors for the in-repo PHP runtime asset sources (bootstrap, runtime loops,
3
- * FastCGI client) and the Laravel-on-Lambda environment defaults.
4
- *
5
- * The layer builder bundles these files plus the generated php-fpm.conf into the
6
- * ts-cloud PHP runtime layer (mounted at /opt on Lambda).
7
- */
8
1
  export interface RuntimeAsset {
9
2
  /** Path inside the layer, relative to /opt. */
10
3
  path: string;
package/dist/types.d.ts CHANGED
@@ -238,6 +238,7 @@ export interface ApiGatewayConfig {
238
238
  customDomain?: {
239
239
  domain?: string;
240
240
  certificateArn?: string;
241
+ dnsProvider?: 'route53' | 'external';
241
242
  };
242
243
  authorizer?: {
243
244
  type?: string;
@@ -2253,6 +2254,11 @@ export interface ComputeConfig {
2253
2254
  domain?: string;
2254
2255
  certificateArn?: string;
2255
2256
  };
2257
+ originVerifyHeader?: {
2258
+ name?: string;
2259
+ value?: string;
2260
+ };
2261
+ deletionProtection?: boolean;
2256
2262
  };
2257
2263
  };
2258
2264
  /**
@@ -2638,6 +2644,21 @@ export interface ComputeProxyConfig {
2638
2644
  onDemandTls?: boolean;
2639
2645
  /** Contact email for the ACME account when {@link onDemandTls} is enabled. */
2640
2646
  onDemandTlsEmail?: string;
2647
+ /**
2648
+ * Issue on-demand certs from Let's Encrypt's **staging** directory instead of
2649
+ * production. Untrusted by browsers, but effectively un-rate-limited — useful
2650
+ * when bringing up many new hostnames at once and only checking wiring.
2651
+ *
2652
+ * Always emitted into the rpx fragment, including the `false` default, rather
2653
+ * than left undefined: `obtainCertificate` selects the production directory
2654
+ * only on an explicit `false`, so an absent flag silently yields staging
2655
+ * certs that chain to an untrusted root while issuance reports success.
2656
+ * Stating the intent here keeps the deploy correct regardless of the
2657
+ * defaulting behaviour of whatever rpx version the box has installed.
2658
+ *
2659
+ * @default false
2660
+ */
2661
+ onDemandTlsStaging?: boolean;
2641
2662
  /**
2642
2663
  * Webroot the gateway serves ACME http-01 challenge tokens from on `:80` (and
2643
2664
  * that the deploy-time issuance + renewal cron write tokens into). Only used
@@ -1,7 +1,3 @@
1
- /**
2
- * Caching utilities for performance optimization
3
- * Caches CloudFormation templates, credentials, and other data
4
- */
5
1
  export interface CacheOptions {
6
2
  ttl?: number;
7
3
  maxSize?: number;
@@ -1,7 +1,3 @@
1
- /**
2
- * File hashing utilities for deployment optimization
3
- * Fast hashing for detecting changed files
4
- */
5
1
  export interface FileHash {
6
2
  path: string;
7
3
  hash: string;
@@ -1,7 +1,3 @@
1
- /**
2
- * AWS Service Quota Checking
3
- * Check if deployment will exceed service limits
4
- */
5
1
  export interface ServiceQuota {
6
2
  service: string;
7
3
  quotaName: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
- "version": "0.7.55",
4
3
  "type": "module",
4
+ "version": "0.7.57",
5
5
  "description": "Core CloudFormation generation library for ts-cloud",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@ts-cloud/aws-types": "0.7.55"
34
+ "@ts-cloud/aws-types": "0.7.57"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"