@stacksjs/ts-cloud 0.2.15 → 0.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.
@@ -29,7 +29,45 @@ export interface AWSClientConfig {
29
29
  retryDelay?: number;
30
30
  cacheEnabled?: boolean;
31
31
  defaultCacheTTL?: number;
32
+ /**
33
+ * Override the S3 endpoint host for S3-compatible providers (Backblaze B2,
34
+ * Hetzner Object Storage). Host only, no scheme — e.g.
35
+ * `s3.us-west-004.backblazeb2.com` or `fsn1.your-objectstorage.com`.
36
+ * When omitted, the standard AWS S3 endpoint is used.
37
+ */
38
+ endpoint?: string;
39
+ /**
40
+ * Force path-style addressing (bucket in the path) instead of
41
+ * virtual-hosted style (bucket in the host). Defaults to virtual-hosted,
42
+ * which AWS, Backblaze B2 and Hetzner all support.
43
+ */
44
+ forcePathStyle?: boolean;
32
45
  }
46
+ /**
47
+ * Resolve the S3 (or S3-compatible) host and canonical request path.
48
+ *
49
+ * Supports AWS S3 plus S3-compatible providers (Backblaze B2, Hetzner Object
50
+ * Storage) by allowing an endpoint override and path- vs virtual-hosted-style
51
+ * addressing. With no `endpoint` and no `forcePathStyle` the result is byte-for-byte
52
+ * identical to the previous AWS-only behavior, so existing callers are unaffected.
53
+ *
54
+ * The returned `path` is used for BOTH the request URL and the SigV4 canonical
55
+ * URI, so the signature always matches the wire request.
56
+ */
57
+ export declare function resolveS3Endpoint(options: {
58
+ region: string;
59
+ /** Original request path, e.g. '/key', '/bucket/key' or '/'. */
60
+ path: string;
61
+ /** Bucket name when the request is bucket-scoped (virtual-hosted eligible). */
62
+ bucket?: string;
63
+ /** Endpoint host override, e.g. 's3.us-west-004.backblazeb2.com'. */
64
+ endpoint?: string;
65
+ /** Force path-style addressing (bucket in path) instead of virtual-hosted. */
66
+ forcePathStyle?: boolean;
67
+ }): {
68
+ host: string;
69
+ path: string;
70
+ };
33
71
  export interface AWSError extends Error {
34
72
  code?: string;
35
73
  statusCode?: number;
@@ -207,6 +207,11 @@ export declare class CloudFrontClient {
207
207
  * CloudFront requires specific XML structures - this method handles the complex nesting
208
208
  */
209
209
  private buildDistributionConfigXml;
210
+ /**
211
+ * Allow POST/PUT/PATCH/DELETE on the default cache behavior (and API cache behaviors).
212
+ * Required when CloudFront fronts a Bun/Node app on EC2 instead of a static S3 site.
213
+ */
214
+ ensureDynamicHttpMethods(distributionId: string): Promise<boolean>;
210
215
  /**
211
216
  * Add aliases to a distribution
212
217
  */
@@ -3,6 +3,7 @@
3
3
  * Direct API calls for AWS services (no SDK dependencies)
4
4
  */
5
5
  export * from './client';
6
+ export * from '../object-storage';
6
7
  export * from './cloudformation';
7
8
  export * from './cost-explorer';
8
9
  export * from './ec2';
package/dist/aws/s3.d.ts CHANGED
@@ -35,6 +35,29 @@ export interface S3Object {
35
35
  Size: number;
36
36
  ETag?: string;
37
37
  }
38
+ /**
39
+ * Options for configuring an {@link S3Client} against AWS S3 or an
40
+ * S3-compatible provider (Backblaze B2, Hetzner Object Storage).
41
+ */
42
+ export interface S3ClientOptions {
43
+ /**
44
+ * Endpoint host override (no scheme) for S3-compatible providers, e.g.
45
+ * `s3.us-west-004.backblazeb2.com` or `fsn1.your-objectstorage.com`.
46
+ */
47
+ endpoint?: string;
48
+ /** Force path-style addressing instead of virtual-hosted. Defaults to virtual-hosted. */
49
+ forcePathStyle?: boolean;
50
+ /**
51
+ * Explicit credentials. When set, these take precedence over profile/env
52
+ * resolution — used by S3-compatible providers whose keys live in
53
+ * provider-specific env vars rather than the AWS chain.
54
+ */
55
+ credentials?: {
56
+ accessKeyId: string;
57
+ secretAccessKey: string;
58
+ sessionToken?: string;
59
+ };
60
+ }
38
61
  /**
39
62
  * S3 client using direct API calls
40
63
  */
@@ -42,12 +65,23 @@ export declare class S3Client {
42
65
  private client;
43
66
  private region;
44
67
  private explicitProfile?;
45
- constructor(region?: string, profile?: string);
68
+ private endpoint?;
69
+ private forcePathStyle?;
70
+ private explicitCredentials?;
71
+ constructor(region?: string, profile?: string, options?: S3ClientOptions);
46
72
  /**
47
- * Get AWS credentials (used by presigned URL / bucket-policy paths that bypass AWSClient.request).
48
- * Honors the same explicit-vs-implicit profile semantics as the constructor.
73
+ * Get credentials (used by presigned URL / bucket-policy paths that bypass AWSClient.request).
74
+ * Explicit credentials win; otherwise honors the same explicit-vs-implicit profile
75
+ * semantics as the constructor.
49
76
  */
50
77
  private getCredentials;
78
+ /** Base S3 endpoint host (no bucket): the provider endpoint or AWS default. */
79
+ private s3BaseHost;
80
+ /**
81
+ * Virtual-hosted-style host for a bucket. In path-style mode the bucket lives
82
+ * in the request path instead, so this returns the bare base host.
83
+ */
84
+ private s3VirtualHost;
51
85
  /**
52
86
  * List all S3 buckets in the account
53
87
  */
package/dist/aws/ses.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * AWS SES (Simple Email Service) Operations
3
3
  * Direct API calls without AWS SDK dependency
4
4
  */
5
+ import type { AWSCredentials } from './client';
5
6
  export interface EmailIdentity {
6
7
  IdentityType?: 'EMAIL_ADDRESS' | 'DOMAIN' | 'MANAGED_DOMAIN';
7
8
  IdentityName?: string;
@@ -28,7 +29,15 @@ export interface SendEmailResult {
28
29
  export declare class SESClient {
29
30
  private client;
30
31
  private region;
31
- constructor(region?: string);
32
+ /**
33
+ * @param region - AWS region (defaults to `us-east-1`)
34
+ * @param credentials - Optional explicit credentials. When omitted, AWSClient
35
+ * falls back to the env-var chain (`AWS_ACCESS_KEY_ID`, etc.) and then to
36
+ * `~/.aws/credentials`. Pass explicit creds when the caller has them
37
+ * under a non-default config key (e.g. `services.ses.credentials`) so a
38
+ * per-service identity doesn't have to overload the global env vars.
39
+ */
40
+ constructor(region?: string, credentials?: AWSCredentials);
32
41
  /**
33
42
  * Create email identity (domain or email address)
34
43
  * Uses SES v2 API