@ts-cloud/core 0.16.41 → 0.16.43

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.
package/dist/types.d.ts CHANGED
@@ -584,6 +584,28 @@ export interface InfrastructureConfig {
584
584
  * }
585
585
  */
586
586
  r2?: R2Config;
587
+ /**
588
+ * Cloudflare Workers, bundled with `Bun.build` and uploaded through
589
+ * Cloudflare's account API on `cloud deploy` (see `reconcileCloudflareWorkers`).
590
+ *
591
+ * Keyed by a logical name; `name` is the script name in Cloudflare. Like
592
+ * `r2`, nothing here touches AWS, and the deploy needs `CLOUDFLARE_API_TOKEN`
593
+ * and `CLOUDFLARE_ACCOUNT_ID` in the env.
594
+ *
595
+ * @example
596
+ * workers: {
597
+ * tiles: {
598
+ * name: 'my-app-tiles',
599
+ * entry: 'workers/tiles.ts',
600
+ * bindings: {
601
+ * r2Buckets: { TILES: 'my-app-tiles' },
602
+ * vars: { CACHE_SECONDS: '86400' },
603
+ * },
604
+ * customDomains: ['tiles.example.com'],
605
+ * },
606
+ * }
607
+ */
608
+ workers?: Record<string, WorkerConfig>;
587
609
  security?: SecurityConfig;
588
610
  monitoring?: MonitoringConfig;
589
611
  api?: ApiConfig;
@@ -1928,6 +1950,16 @@ export interface DnsZoneConfig {
1928
1950
  * reported rather than failing the deploy.
1929
1951
  */
1930
1952
  minTlsVersion?: '1.0' | '1.1' | '1.2' | '1.3';
1953
+ /**
1954
+ * Tiered cache: a data center that misses asks an upper-tier data center
1955
+ * before the origin, so the origin answers once per region rather than once
1956
+ * per city. `smart` lets Cloudflare choose the upper tier by latency to the
1957
+ * origin; `generic` uses a fixed set; `off` turns it off. Free on every plan.
1958
+ * It applies to everything Cloudflare caches through the CDN, including a
1959
+ * Worker's `fetch()` subrequests, but not to a Worker's Cache API, which is
1960
+ * local to one data center.
1961
+ */
1962
+ tieredCache?: 'smart' | 'generic' | 'off';
1931
1963
  }
1932
1964
  /**
1933
1965
  * The registrar half of {@link DnsConfig}.
@@ -2289,6 +2321,40 @@ export interface R2Config {
2289
2321
  /** Buckets keyed by a logical name (the key is not the bucket name; `name` is). */
2290
2322
  buckets: Record<string, R2BucketConfig>;
2291
2323
  }
2324
+ /** Bindings a Worker is uploaded with. Secrets are not declared here; see {@link WorkerConfig}. */
2325
+ export interface WorkerBindingsConfig {
2326
+ /** R2 buckets, keyed by the binding name the Worker reads (`env.TILES`) with the bucket name as the value. */
2327
+ r2Buckets?: Record<string, string>;
2328
+ /** Plain-text environment variables, keyed by binding name. Visible in the dashboard; not for secrets. */
2329
+ vars?: Record<string, string>;
2330
+ }
2331
+ /**
2332
+ * One Cloudflare Worker (an ES module Worker), deployed from a TypeScript or
2333
+ * JavaScript entry that is bundled into a single module.
2334
+ *
2335
+ * Secrets set out of band (`wrangler secret put`, the dashboard) survive a
2336
+ * deploy: the upload keeps existing `secret_text` bindings rather than
2337
+ * replacing them.
2338
+ */
2339
+ export interface WorkerConfig {
2340
+ /** Script name in Cloudflare (lowercase letters, digits, `-` and `_`, up to 63 chars). */
2341
+ name: string;
2342
+ /** Entry module, relative to the project root, e.g. `workers/tiles.ts`. */
2343
+ entry: string;
2344
+ /** Workers runtime compatibility date. @default '2025-09-01' */
2345
+ compatibilityDate?: string;
2346
+ /** Workers runtime compatibility flags, e.g. `['nodejs_compat']`. */
2347
+ compatibilityFlags?: string[];
2348
+ bindings?: WorkerBindingsConfig;
2349
+ /**
2350
+ * Hostnames the Worker serves as Workers Custom Domains. Cloudflare creates
2351
+ * the DNS record and certificate itself, so a hostname must not already have
2352
+ * a DNS record or be attached to an R2 bucket or another Worker: the deploy
2353
+ * warns and leaves it alone rather than detaching anything. Attached, never
2354
+ * detached: removing a hostname from config leaves it attached.
2355
+ */
2356
+ customDomains?: string[];
2357
+ }
2292
2358
  export interface StorageItemConfig {
2293
2359
  /**
2294
2360
  * Physical S3 bucket name. When omitted, defaults to `{slug}-{environment}-{key}`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
3
  "type": "module",
4
- "version": "0.16.41",
4
+ "version": "0.16.43",
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.16.41"
34
+ "@ts-cloud/aws-types": "0.16.43"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"