@ts-cloud/core 0.2.3 → 0.2.4

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 (226) hide show
  1. package/dist/advanced-features.test.d.ts +1 -0
  2. package/dist/aws/cloudformation.d.ts +136 -0
  3. package/dist/aws/cloudfront.d.ts +45 -0
  4. package/dist/aws/credentials.d.ts +77 -0
  5. package/dist/aws/credentials.test.d.ts +4 -0
  6. package/dist/aws/index.d.ts +10 -0
  7. package/dist/aws/s3.d.ts +256 -0
  8. package/dist/aws/s3.test.d.ts +4 -0
  9. package/dist/aws/signature.d.ts +142 -0
  10. package/dist/aws/signature.test.d.ts +4 -0
  11. package/dist/backup/disaster-recovery.d.ts +140 -0
  12. package/dist/backup/disaster-recovery.test.d.ts +1 -0
  13. package/dist/backup/index.d.ts +8 -0
  14. package/dist/backup/manager.d.ts +172 -0
  15. package/dist/backup/manager.test.d.ts +1 -0
  16. package/dist/cicd/circleci.d.ts +50 -0
  17. package/dist/cicd/github-actions.d.ts +62 -0
  18. package/dist/cicd/gitlab-ci.d.ts +50 -0
  19. package/dist/cicd/index.d.ts +7 -0
  20. package/dist/cli/history.d.ts +137 -0
  21. package/dist/cli/index.d.ts +9 -0
  22. package/dist/cli/progress.d.ts +193 -0
  23. package/dist/cli/repl.d.ts +148 -0
  24. package/dist/cli/suggestions.d.ts +74 -0
  25. package/dist/cli/table.d.ts +73 -0
  26. package/dist/cli/table.test.d.ts +1 -0
  27. package/dist/cloudformation/builder.d.ts +93 -0
  28. package/dist/cloudformation/builder.test.d.ts +4 -0
  29. package/dist/cloudformation/builders/api-gateway.d.ts +30 -0
  30. package/dist/cloudformation/builders/cache.d.ts +35 -0
  31. package/dist/cloudformation/builders/cdn.d.ts +34 -0
  32. package/dist/cloudformation/builders/compute.d.ts +68 -0
  33. package/dist/cloudformation/builders/database.d.ts +61 -0
  34. package/dist/cloudformation/builders/functions.d.ts +32 -0
  35. package/dist/cloudformation/builders/messaging.d.ts +17 -0
  36. package/dist/cloudformation/builders/monitoring.d.ts +39 -0
  37. package/dist/cloudformation/builders/network.d.ts +14 -0
  38. package/dist/cloudformation/builders/queue.d.ts +16 -0
  39. package/dist/cloudformation/builders/security.d.ts +31 -0
  40. package/dist/cloudformation/builders/storage.d.ts +36 -0
  41. package/dist/cloudformation/index.d.ts +10 -0
  42. package/dist/cloudformation/types.d.ts +200 -0
  43. package/dist/compliance/aws-config.d.ts +175 -0
  44. package/dist/compliance/cloudtrail.d.ts +132 -0
  45. package/dist/compliance/compliance.test.d.ts +1 -0
  46. package/dist/compliance/guardduty.d.ts +176 -0
  47. package/dist/compliance/index.d.ts +12 -0
  48. package/dist/compliance/security-hub.d.ts +178 -0
  49. package/dist/containers/build-optimization.d.ts +155 -0
  50. package/dist/containers/containers.test.d.ts +1 -0
  51. package/dist/containers/image-scanning.d.ts +144 -0
  52. package/dist/containers/index.d.ts +8 -0
  53. package/dist/containers/registry.d.ts +129 -0
  54. package/dist/containers/service-mesh.d.ts +254 -0
  55. package/dist/database/database.test.d.ts +1 -0
  56. package/dist/database/index.d.ts +8 -0
  57. package/dist/database/migrations.d.ts +153 -0
  58. package/dist/database/performance.d.ts +219 -0
  59. package/dist/database/replicas.d.ts +218 -0
  60. package/dist/database/users.d.ts +165 -0
  61. package/dist/dependency-graph.d.ts +37 -0
  62. package/dist/deployment/ab-testing.d.ts +165 -0
  63. package/dist/deployment/blue-green.d.ts +140 -0
  64. package/dist/deployment/canary.d.ts +165 -0
  65. package/dist/deployment/deployment.test.d.ts +1 -0
  66. package/dist/deployment/index.d.ts +12 -0
  67. package/dist/deployment/progressive.d.ts +50 -0
  68. package/dist/dns/dns.test.d.ts +1 -0
  69. package/dist/dns/dnssec.d.ts +120 -0
  70. package/dist/dns/index.d.ts +7 -0
  71. package/dist/dns/resolver.d.ts +216 -0
  72. package/dist/dns/routing.d.ts +277 -0
  73. package/dist/email/advanced/analytics.d.ts +107 -0
  74. package/dist/email/advanced/index.d.ts +10 -0
  75. package/dist/email/advanced/rules.d.ts +131 -0
  76. package/dist/email/advanced/scheduling.d.ts +81 -0
  77. package/dist/email/advanced/search.d.ts +91 -0
  78. package/dist/email/advanced/shared-mailboxes.d.ts +109 -0
  79. package/dist/email/advanced/templates.d.ts +95 -0
  80. package/dist/email/advanced/threading.d.ts +65 -0
  81. package/dist/email/analytics.d.ts +189 -0
  82. package/dist/email/bounce-handling.d.ts +171 -0
  83. package/dist/email/email.test.d.ts +1 -0
  84. package/dist/email/handlers/__tests__/inbound.test.d.ts +1 -0
  85. package/dist/email/handlers/__tests__/outbound.test.d.ts +1 -0
  86. package/dist/email/handlers/converter.d.ts +11 -0
  87. package/dist/email/handlers/feedback.d.ts +11 -0
  88. package/dist/email/handlers/inbound.d.ts +13 -0
  89. package/dist/email/handlers/outbound.d.ts +13 -0
  90. package/dist/email/index.d.ts +10 -0
  91. package/dist/email/reputation.d.ts +133 -0
  92. package/dist/email/templates.d.ts +124 -0
  93. package/dist/errors/index.d.ts +177 -0
  94. package/dist/errors/index.test.d.ts +4 -0
  95. package/dist/health-checks/index.d.ts +35 -0
  96. package/dist/index.d.ts +15 -256
  97. package/dist/index.js +228 -80
  98. package/dist/intrinsic-functions.d.ts +77 -0
  99. package/dist/lambda/concurrency.d.ts +146 -0
  100. package/dist/lambda/destinations.d.ts +141 -0
  101. package/dist/lambda/dlq.d.ts +160 -0
  102. package/dist/lambda/index.d.ts +10 -0
  103. package/dist/lambda/lambda.test.d.ts +1 -0
  104. package/dist/lambda/layers.d.ts +117 -0
  105. package/dist/lambda/versions.d.ts +145 -0
  106. package/dist/lambda/vpc.d.ts +164 -0
  107. package/dist/local/config.d.ts +44 -0
  108. package/dist/local/index.d.ts +5 -0
  109. package/dist/local/mock-aws.d.ts +69 -0
  110. package/dist/modules/ai.d.ts +108 -0
  111. package/dist/modules/api.d.ts +157 -0
  112. package/dist/modules/auth.d.ts +262 -0
  113. package/dist/modules/cache.d.ts +108 -0
  114. package/dist/modules/cdn.d.ts +305 -0
  115. package/dist/modules/communication.d.ts +117 -0
  116. package/dist/modules/compute.d.ts +1376 -0
  117. package/dist/modules/database.d.ts +144 -0
  118. package/dist/modules/deployment.d.ts +372 -0
  119. package/dist/modules/dns.d.ts +143 -0
  120. package/dist/modules/email.d.ts +314 -0
  121. package/dist/modules/filesystem.d.ts +132 -0
  122. package/dist/modules/index.d.ts +31 -0
  123. package/dist/modules/messaging.d.ts +210 -0
  124. package/dist/modules/monitoring.d.ts +574 -0
  125. package/dist/modules/network.d.ts +148 -0
  126. package/dist/modules/parameter-store.d.ts +143 -0
  127. package/dist/modules/permissions.d.ts +245 -0
  128. package/dist/modules/phone.d.ts +125 -0
  129. package/dist/modules/queue.d.ts +411 -0
  130. package/dist/modules/redirects.d.ts +140 -0
  131. package/dist/modules/registry.d.ts +189 -0
  132. package/dist/modules/search.d.ts +135 -0
  133. package/dist/modules/secrets.d.ts +149 -0
  134. package/dist/modules/security.d.ts +219 -0
  135. package/dist/modules/sms.d.ts +130 -0
  136. package/dist/modules/storage.d.ts +344 -0
  137. package/dist/modules/workflow.d.ts +288 -0
  138. package/dist/multi-account/config.d.ts +166 -0
  139. package/dist/multi-account/index.d.ts +6 -0
  140. package/dist/multi-account/manager.d.ts +181 -0
  141. package/dist/multi-region/cross-region.d.ts +204 -0
  142. package/dist/multi-region/index.d.ts +7 -0
  143. package/dist/multi-region/manager.d.ts +136 -0
  144. package/dist/multi-region/regions.d.ts +98 -0
  145. package/dist/network-security/index.d.ts +55 -0
  146. package/dist/observability/index.d.ts +8 -0
  147. package/dist/observability/logs.d.ts +213 -0
  148. package/dist/observability/metrics.d.ts +187 -0
  149. package/dist/observability/observability.test.d.ts +1 -0
  150. package/dist/observability/synthetics.d.ts +189 -0
  151. package/dist/observability/xray.d.ts +193 -0
  152. package/dist/phone/advanced/analytics.d.ts +83 -0
  153. package/dist/phone/advanced/callbacks.d.ts +67 -0
  154. package/dist/phone/advanced/index.d.ts +7 -0
  155. package/dist/phone/advanced/ivr-builder.d.ts +130 -0
  156. package/dist/phone/advanced/recording.d.ts +62 -0
  157. package/dist/phone/handlers/__tests__/incoming-call.test.d.ts +1 -0
  158. package/dist/phone/handlers/incoming-call.d.ts +10 -0
  159. package/dist/phone/handlers/missed-call.d.ts +9 -0
  160. package/dist/phone/handlers/voicemail.d.ts +10 -0
  161. package/dist/phone/index.d.ts +5 -0
  162. package/dist/presets/api-backend.d.ts +11 -0
  163. package/dist/presets/data-pipeline.d.ts +11 -0
  164. package/dist/presets/extend.d.ts +194 -0
  165. package/dist/presets/extend.test.d.ts +4 -0
  166. package/dist/presets/fullstack-app.d.ts +12 -0
  167. package/dist/presets/index.d.ts +13 -0
  168. package/dist/presets/jamstack.d.ts +12 -0
  169. package/dist/presets/microservices.d.ts +18 -0
  170. package/dist/presets/ml-api.d.ts +13 -0
  171. package/dist/presets/nodejs-server.d.ts +14 -0
  172. package/dist/presets/nodejs-serverless.d.ts +14 -0
  173. package/dist/presets/realtime-app.d.ts +11 -0
  174. package/dist/presets/static-site.d.ts +12 -0
  175. package/dist/presets/traditional-web-app.d.ts +16 -0
  176. package/dist/presets/wordpress.d.ts +12 -0
  177. package/dist/preview/github.d.ts +32 -0
  178. package/dist/preview/github.test.d.ts +1 -0
  179. package/dist/preview/index.d.ts +10 -0
  180. package/dist/preview/manager.d.ts +101 -0
  181. package/dist/preview/manager.test.d.ts +1 -0
  182. package/dist/preview/notifications.d.ts +89 -0
  183. package/dist/preview/notifications.test.d.ts +1 -0
  184. package/dist/queue/batch-processing.d.ts +138 -0
  185. package/dist/queue/dlq-monitoring.d.ts +143 -0
  186. package/dist/queue/fifo.d.ts +131 -0
  187. package/dist/queue/index.d.ts +8 -0
  188. package/dist/queue/management.d.ts +162 -0
  189. package/dist/queue/queue.test.d.ts +1 -0
  190. package/dist/resource-mgmt/index.d.ts +44 -0
  191. package/dist/resource-naming.d.ts +26 -0
  192. package/dist/s3/index.d.ts +227 -0
  193. package/dist/schema/index.d.ts +12 -0
  194. package/dist/security/certificate-manager.d.ts +184 -0
  195. package/dist/security/index.d.ts +8 -0
  196. package/dist/security/scanning.d.ts +196 -0
  197. package/dist/security/secrets-manager.d.ts +204 -0
  198. package/dist/security/secrets-rotation.d.ts +167 -0
  199. package/dist/security/security.test.d.ts +1 -0
  200. package/dist/sms/advanced/ab-testing.d.ts +74 -0
  201. package/dist/sms/advanced/analytics.d.ts +75 -0
  202. package/dist/sms/advanced/campaigns.d.ts +96 -0
  203. package/dist/sms/advanced/chatbot.d.ts +67 -0
  204. package/dist/sms/advanced/index.d.ts +9 -0
  205. package/dist/sms/advanced/link-tracking.d.ts +60 -0
  206. package/dist/sms/advanced/mms.d.ts +60 -0
  207. package/dist/sms/handlers/__tests__/send.test.d.ts +1 -0
  208. package/dist/sms/handlers/delivery-status.d.ts +10 -0
  209. package/dist/sms/handlers/receive.d.ts +10 -0
  210. package/dist/sms/handlers/send.d.ts +10 -0
  211. package/dist/sms/index.d.ts +5 -0
  212. package/dist/stack-diff.d.ts +38 -0
  213. package/dist/static-site/index.d.ts +49 -0
  214. package/dist/template-builder.d.ts +42 -0
  215. package/dist/template-validator.d.ts +28 -0
  216. package/dist/types.d.ts +2514 -0
  217. package/dist/utils/cache.d.ts +117 -0
  218. package/dist/utils/diff.d.ts +52 -0
  219. package/dist/utils/hash.d.ts +73 -0
  220. package/dist/utils/index.d.ts +7 -0
  221. package/dist/utils/parallel.d.ts +78 -0
  222. package/dist/validators/credentials.d.ts +30 -0
  223. package/dist/validators/credentials.test.d.ts +4 -0
  224. package/dist/validators/quotas.d.ts +64 -0
  225. package/dist/validators/quotas.test.d.ts +4 -0
  226. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,136 @@
1
+ /**
2
+ * AWS CloudFormation API Client
3
+ * Direct API calls without AWS SDK dependency
4
+ */
5
+ export interface CloudFormationStack {
6
+ StackName: string;
7
+ StackId?: string;
8
+ StackStatus?: string;
9
+ CreationTime?: string;
10
+ LastUpdatedTime?: string;
11
+ StackStatusReason?: string;
12
+ Description?: string;
13
+ Parameters?: Array<{
14
+ ParameterKey: string;
15
+ ParameterValue: string;
16
+ }>;
17
+ Outputs?: Array<{
18
+ OutputKey: string;
19
+ OutputValue: string;
20
+ Description?: string;
21
+ }>;
22
+ Tags?: Array<{
23
+ Key: string;
24
+ Value: string;
25
+ }>;
26
+ }
27
+ export interface CreateStackOptions {
28
+ stackName: string;
29
+ templateBody?: string;
30
+ templateURL?: string;
31
+ parameters?: Record<string, string>;
32
+ capabilities?: string[];
33
+ tags?: Record<string, string>;
34
+ timeoutInMinutes?: number;
35
+ onFailure?: 'DO_NOTHING' | 'ROLLBACK' | 'DELETE';
36
+ }
37
+ export interface UpdateStackOptions {
38
+ stackName: string;
39
+ templateBody?: string;
40
+ templateURL?: string;
41
+ parameters?: Record<string, string>;
42
+ capabilities?: string[];
43
+ tags?: Record<string, string>;
44
+ }
45
+ export interface StackEvent {
46
+ EventId: string;
47
+ StackName: string;
48
+ LogicalResourceId: string;
49
+ PhysicalResourceId?: string;
50
+ ResourceType: string;
51
+ Timestamp: string;
52
+ ResourceStatus: string;
53
+ ResourceStatusReason?: string;
54
+ }
55
+ /**
56
+ * CloudFormation API Client
57
+ */
58
+ export declare class CloudFormationClient {
59
+ private readonly profile;
60
+ private credentials;
61
+ private region;
62
+ constructor(region?: string, profile?: string);
63
+ /**
64
+ * Initialize client with credentials
65
+ */
66
+ init(): Promise<void>;
67
+ /**
68
+ * Ensure credentials are loaded
69
+ */
70
+ private ensureCredentials;
71
+ /**
72
+ * Make a CloudFormation API request
73
+ */
74
+ private request;
75
+ /**
76
+ * Create a new CloudFormation stack
77
+ */
78
+ createStack(options: CreateStackOptions): Promise<string>;
79
+ /**
80
+ * Update an existing CloudFormation stack
81
+ */
82
+ updateStack(options: UpdateStackOptions): Promise<string>;
83
+ /**
84
+ * Delete a CloudFormation stack
85
+ */
86
+ deleteStack(stackName: string): Promise<void>;
87
+ /**
88
+ * Describe a CloudFormation stack
89
+ */
90
+ describeStack(stackName: string): Promise<CloudFormationStack>;
91
+ /**
92
+ * List all CloudFormation stacks
93
+ */
94
+ listStacks(statusFilter?: string[]): Promise<CloudFormationStack[]>;
95
+ /**
96
+ * Get stack events
97
+ */
98
+ describeStackEvents(stackName: string): Promise<StackEvent[]>;
99
+ /**
100
+ * Wait for stack to reach a terminal state
101
+ */
102
+ waitForStack(stackName: string, desiredStates: string[], onProgress?: (event: StackEvent) => void): Promise<CloudFormationStack>;
103
+ /**
104
+ * Wait for stack using waiter-style name (e.g., 'stack-create-complete')
105
+ * Convenience method that maps waiter names to CloudFormation states
106
+ */
107
+ waitForStackWithProgress(stackName: string, waiterName: string, onProgress?: (event: StackEvent) => void): Promise<CloudFormationStack>;
108
+ /**
109
+ * Create a change set
110
+ */
111
+ createChangeSet(options: {
112
+ stackName: string;
113
+ changeSetName: string;
114
+ templateBody?: string;
115
+ templateURL?: string;
116
+ parameters?: Record<string, string>;
117
+ capabilities?: string[];
118
+ }): Promise<string>;
119
+ /**
120
+ * Execute a change set
121
+ */
122
+ executeChangeSet(changeSetName: string, stackName: string): Promise<void>;
123
+ /**
124
+ * Describe stacks (SDK-compatible interface returning { Stacks: [...] })
125
+ * Accepts either a string stackName or an object { stackName: string }
126
+ */
127
+ describeStacks(input: string | {
128
+ stackName: string;
129
+ }): Promise<{
130
+ Stacks: CloudFormationStack[];
131
+ }>;
132
+ /**
133
+ * Get stack outputs as a key-value map
134
+ */
135
+ getStackOutputs(stackName: string): Promise<Record<string, string>>;
136
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * AWS CloudFront API Client
3
+ * Direct API calls for CloudFront invalidations without AWS SDK
4
+ */
5
+ export interface InvalidationOptions {
6
+ distributionId: string;
7
+ paths: string[];
8
+ callerReference?: string;
9
+ }
10
+ /**
11
+ * CloudFront API Client
12
+ */
13
+ export declare class CloudFrontClient {
14
+ private readonly profile;
15
+ private credentials;
16
+ constructor(profile?: string);
17
+ /**
18
+ * Initialize client with credentials
19
+ */
20
+ init(): Promise<void>;
21
+ /**
22
+ * Ensure credentials are loaded
23
+ */
24
+ private ensureCredentials;
25
+ /**
26
+ * Create a cache invalidation
27
+ */
28
+ createInvalidation(options: InvalidationOptions): Promise<string>;
29
+ /**
30
+ * Get invalidation status
31
+ */
32
+ getInvalidation(distributionId: string, invalidationId: string): Promise<any>;
33
+ /**
34
+ * List invalidations for a distribution
35
+ */
36
+ listInvalidations(distributionId: string): Promise<any[]>;
37
+ /**
38
+ * Wait for invalidation to complete
39
+ */
40
+ waitForInvalidation(distributionId: string, invalidationId: string, maxAttempts?: number, pollInterval?: number): Promise<void>;
41
+ /**
42
+ * Invalidate all files in a distribution
43
+ */
44
+ invalidateAll(distributionId: string): Promise<string>;
45
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * AWS Credential Providers
3
+ *
4
+ * Automatically load AWS credentials from various sources:
5
+ * - Environment variables
6
+ * - Shared credentials file (~/.aws/credentials)
7
+ * - EC2 instance metadata
8
+ * - ECS task metadata
9
+ * - Web identity token (for Kubernetes/IRSA)
10
+ */
11
+ export interface AWSCredentials {
12
+ accessKeyId: string;
13
+ secretAccessKey: string;
14
+ sessionToken?: string;
15
+ expiration?: Date;
16
+ region?: string;
17
+ }
18
+ export interface CredentialProviderOptions {
19
+ /** Profile name for shared credentials file (default: 'default' or AWS_PROFILE env var) */
20
+ profile?: string;
21
+ /** Path to credentials file (default: ~/.aws/credentials) */
22
+ credentialsFile?: string;
23
+ /** Path to config file (default: ~/.aws/config) */
24
+ configFile?: string;
25
+ /** Timeout for metadata requests in ms (default: 1000) */
26
+ timeout?: number;
27
+ }
28
+ /**
29
+ * Get credentials from environment variables
30
+ * Checks: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
31
+ */
32
+ export declare function fromEnvironment(): AWSCredentials | null;
33
+ /**
34
+ * Get credentials from shared credentials file (~/.aws/credentials)
35
+ */
36
+ export declare function fromSharedCredentials(options?: CredentialProviderOptions): AWSCredentials | null;
37
+ /**
38
+ * Get credentials from EC2 instance metadata service (IMDSv2)
39
+ */
40
+ export declare function fromEC2Metadata(options?: CredentialProviderOptions): Promise<AWSCredentials | null>;
41
+ /**
42
+ * Get credentials from ECS task metadata
43
+ */
44
+ export declare function fromECSMetadata(options?: CredentialProviderOptions): Promise<AWSCredentials | null>;
45
+ /**
46
+ * Get credentials from web identity token (for Kubernetes/IRSA)
47
+ */
48
+ export declare function fromWebIdentity(options?: CredentialProviderOptions): Promise<AWSCredentials | null>;
49
+ /**
50
+ * Get credentials using the default credential chain
51
+ * Tries providers in order: Environment -> Shared Credentials -> Web Identity -> ECS -> EC2
52
+ */
53
+ export declare function getCredentials(options?: CredentialProviderOptions): Promise<AWSCredentials>;
54
+ /**
55
+ * Create a credential provider that caches and auto-refreshes credentials
56
+ */
57
+ export declare function createCredentialProvider(options?: CredentialProviderOptions): () => Promise<AWSCredentials>;
58
+ export interface AWSProfile {
59
+ name: string;
60
+ accessKeyId: string;
61
+ secretAccessKey: string;
62
+ sessionToken?: string;
63
+ region?: string;
64
+ }
65
+ /**
66
+ * Resolve AWS credentials from various sources
67
+ * @deprecated Use getCredentials() instead
68
+ */
69
+ export declare function resolveCredentials(profile?: string): Promise<AWSCredentials>;
70
+ /**
71
+ * Resolve AWS region from environment or config
72
+ */
73
+ export declare function resolveRegion(profile?: string): string;
74
+ /**
75
+ * Get AWS account ID using STS GetCallerIdentity
76
+ */
77
+ export declare function getAccountId(credentials?: AWSCredentials): Promise<string>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * AWS Credentials Provider Tests
3
+ */
4
+ export {};
@@ -0,0 +1,10 @@
1
+ export { signRequest, signRequestAsync, makeAWSRequest, makeAWSRequestAsync, makeAWSRequestOnce, createPresignedUrl, createPresignedUrlAsync, detectServiceRegion, clearSigningKeyCache, getSigningKeyCacheSize, parseXMLResponse, parseJSONResponse, isNodeCryptoAvailable, isWebCryptoAvailable, } from './signature';
2
+ export type { SignatureOptions, SignedRequest, PresignedUrlOptions, RetryOptions, } from './signature';
3
+ export { fromEnvironment, fromSharedCredentials, fromEC2Metadata, fromECSMetadata, fromWebIdentity, getCredentials, createCredentialProvider, resolveCredentials, resolveRegion, getAccountId, } from './credentials';
4
+ export type { AWSCredentials, AWSProfile, CredentialProviderOptions, } from './credentials';
5
+ export { CloudFormationClient, } from './cloudformation';
6
+ export type { CloudFormationStack, CreateStackOptions, UpdateStackOptions, StackEvent, } from './cloudformation';
7
+ export { S3Client, S3Error, createS3Client, } from './s3';
8
+ export type { S3ClientOptions, GetObjectOptions, PutObjectOptions, ListObjectsOptions, ListObjectsResult, S3Object, HeadObjectResult, CopyObjectOptions, MultipartUploadOptions, MultipartProgress, } from './s3';
9
+ export { CloudFrontClient, } from './cloudfront';
10
+ export type { InvalidationOptions, } from './cloudfront';
@@ -0,0 +1,256 @@
1
+ /**
2
+ * S3 High-Level API
3
+ *
4
+ * Simple, intuitive interface for S3 operations:
5
+ * - get, put, delete, list, head, copy
6
+ * - Streaming uploads/downloads
7
+ * - Multipart uploads for large files
8
+ * - Automatic content type detection
9
+ */
10
+ import { type RetryOptions } from './signature';
11
+ import { type AWSCredentials, type CredentialProviderOptions } from './credentials';
12
+ export interface S3ClientOptions {
13
+ /** AWS region (default: 'us-east-1') */
14
+ region?: string;
15
+ /** Custom endpoint URL (for MinIO, LocalStack, etc.) */
16
+ endpoint?: string;
17
+ /** Force path-style URLs instead of virtual-hosted-style */
18
+ forcePathStyle?: boolean;
19
+ /** AWS credentials (if not provided, uses credential chain) */
20
+ credentials?: AWSCredentials;
21
+ /** Credential provider options */
22
+ credentialOptions?: CredentialProviderOptions;
23
+ /** Retry options for requests */
24
+ retryOptions?: RetryOptions;
25
+ }
26
+ export interface GetObjectOptions {
27
+ /** Byte range to fetch (e.g., 'bytes=0-1023') */
28
+ range?: string;
29
+ /** Only return if modified since this date */
30
+ ifModifiedSince?: Date;
31
+ /** Only return if ETag matches */
32
+ ifMatch?: string;
33
+ /** Only return if ETag doesn't match */
34
+ ifNoneMatch?: string;
35
+ /** Response content-type override */
36
+ responseContentType?: string;
37
+ /** Response content-disposition override */
38
+ responseContentDisposition?: string;
39
+ }
40
+ export interface PutObjectOptions {
41
+ /** Content type (auto-detected if not provided) */
42
+ contentType?: string;
43
+ /** Content encoding (e.g., 'gzip') */
44
+ contentEncoding?: string;
45
+ /** Cache-Control header */
46
+ cacheControl?: string;
47
+ /** Content-Disposition header */
48
+ contentDisposition?: string;
49
+ /** Custom metadata (x-amz-meta-*) */
50
+ metadata?: Record<string, string>;
51
+ /** Storage class (STANDARD, REDUCED_REDUNDANCY, GLACIER, etc.) */
52
+ storageClass?: string;
53
+ /** Server-side encryption (AES256, aws:kms) */
54
+ serverSideEncryption?: string;
55
+ /** ACL (private, public-read, etc.) */
56
+ acl?: string;
57
+ /** Tagging (URL-encoded key=value pairs) */
58
+ tagging?: string;
59
+ }
60
+ export interface ListObjectsOptions {
61
+ /** Prefix to filter objects */
62
+ prefix?: string;
63
+ /** Delimiter for grouping (usually '/') */
64
+ delimiter?: string;
65
+ /** Maximum number of keys to return (default: 1000) */
66
+ maxKeys?: number;
67
+ /** Continuation token for pagination */
68
+ continuationToken?: string;
69
+ /** Start listing after this key */
70
+ startAfter?: string;
71
+ }
72
+ export interface ListObjectsResult {
73
+ contents: S3Object[];
74
+ commonPrefixes: string[];
75
+ isTruncated: boolean;
76
+ continuationToken?: string;
77
+ nextContinuationToken?: string;
78
+ keyCount: number;
79
+ maxKeys: number;
80
+ prefix?: string;
81
+ delimiter?: string;
82
+ }
83
+ export interface S3Object {
84
+ key: string;
85
+ lastModified: Date;
86
+ etag: string;
87
+ size: number;
88
+ storageClass: string;
89
+ }
90
+ export interface HeadObjectResult {
91
+ contentLength: number;
92
+ contentType: string;
93
+ etag: string;
94
+ lastModified: Date;
95
+ metadata: Record<string, string>;
96
+ storageClass?: string;
97
+ serverSideEncryption?: string;
98
+ }
99
+ export interface CopyObjectOptions {
100
+ /** Metadata directive (COPY or REPLACE) */
101
+ metadataDirective?: 'COPY' | 'REPLACE';
102
+ /** New metadata (only used if metadataDirective is REPLACE) */
103
+ metadata?: Record<string, string>;
104
+ /** Content type (only used if metadataDirective is REPLACE) */
105
+ contentType?: string;
106
+ /** Storage class for the copy */
107
+ storageClass?: string;
108
+ /** ACL for the copy */
109
+ acl?: string;
110
+ }
111
+ export interface MultipartUploadOptions extends PutObjectOptions {
112
+ /** Part size in bytes (default: 5MB, minimum: 5MB) */
113
+ partSize?: number;
114
+ /** Maximum concurrent uploads (default: 4) */
115
+ concurrency?: number;
116
+ /** Progress callback */
117
+ onProgress?: (progress: MultipartProgress) => void;
118
+ }
119
+ export interface MultipartProgress {
120
+ loaded: number;
121
+ total: number;
122
+ part: number;
123
+ totalParts: number;
124
+ }
125
+ export interface PresignedUrlOptions {
126
+ /** Expiration time in seconds (default: 3600 = 1 hour) */
127
+ expiresIn?: number;
128
+ /** HTTP method (default: 'GET') */
129
+ method?: string;
130
+ }
131
+ /**
132
+ * S3 Client for high-level S3 operations
133
+ */
134
+ export declare class S3Client {
135
+ private region;
136
+ private endpoint;
137
+ private forcePathStyle;
138
+ private credentials?;
139
+ private credentialOptions?;
140
+ private retryOptions;
141
+ constructor(options?: S3ClientOptions);
142
+ /**
143
+ * Get credentials (cached or from provider chain)
144
+ */
145
+ private getCredentials;
146
+ /**
147
+ * Build S3 URL for a bucket/key
148
+ */
149
+ private buildUrl;
150
+ /**
151
+ * Get an object from S3
152
+ */
153
+ get(bucket: string, key: string, options?: GetObjectOptions): Promise<Response>;
154
+ /**
155
+ * Get object as text
156
+ */
157
+ getText(bucket: string, key: string, options?: GetObjectOptions): Promise<string>;
158
+ /**
159
+ * Get object as JSON
160
+ */
161
+ getJSON<T = unknown>(bucket: string, key: string, options?: GetObjectOptions): Promise<T>;
162
+ /**
163
+ * Get object as ArrayBuffer
164
+ */
165
+ getBuffer(bucket: string, key: string, options?: GetObjectOptions): Promise<ArrayBuffer>;
166
+ /**
167
+ * Put an object to S3
168
+ * Automatically uses multipart upload for large files (>5MB)
169
+ */
170
+ put(bucket: string, key: string, body: string | ArrayBuffer | Uint8Array | Blob | ReadableStream, options?: PutObjectOptions): Promise<{
171
+ etag: string;
172
+ }>;
173
+ /**
174
+ * Simple PUT for small files
175
+ */
176
+ private putSimple;
177
+ /**
178
+ * Delete an object from S3
179
+ */
180
+ delete(bucket: string, key: string): Promise<void>;
181
+ /**
182
+ * Delete multiple objects from S3
183
+ */
184
+ deleteMany(bucket: string, keys: string[]): Promise<{
185
+ deleted: string[];
186
+ errors: Array<{
187
+ key: string;
188
+ error: string;
189
+ }>;
190
+ }>;
191
+ /**
192
+ * List objects in a bucket
193
+ */
194
+ list(bucket: string, options?: ListObjectsOptions): Promise<ListObjectsResult>;
195
+ /**
196
+ * List all objects with automatic pagination
197
+ */
198
+ listAll(bucket: string, options?: Omit<ListObjectsOptions, 'continuationToken'>): AsyncGenerator<S3Object>;
199
+ /**
200
+ * Check if an object exists and get its metadata
201
+ */
202
+ head(bucket: string, key: string): Promise<HeadObjectResult | null>;
203
+ /**
204
+ * Check if an object exists
205
+ */
206
+ exists(bucket: string, key: string): Promise<boolean>;
207
+ /**
208
+ * Copy an object
209
+ */
210
+ copy(sourceBucket: string, sourceKey: string, destBucket: string, destKey: string, options?: CopyObjectOptions): Promise<{
211
+ etag: string;
212
+ }>;
213
+ /**
214
+ * Generate a presigned URL for an object
215
+ */
216
+ getPresignedUrl(bucket: string, key: string, options?: PresignedUrlOptions): Promise<string>;
217
+ /**
218
+ * Multipart upload for large files or streams
219
+ */
220
+ uploadMultipart(bucket: string, key: string, body: ReadableStream | Blob | ArrayBuffer | Uint8Array, options?: MultipartUploadOptions): Promise<{
221
+ etag: string;
222
+ }>;
223
+ /**
224
+ * Initiate a multipart upload
225
+ */
226
+ private initiateMultipartUpload;
227
+ /**
228
+ * Upload parts of a multipart upload
229
+ */
230
+ private uploadParts;
231
+ /**
232
+ * Complete a multipart upload
233
+ */
234
+ private completeMultipartUpload;
235
+ /**
236
+ * Abort a multipart upload
237
+ */
238
+ abortMultipartUpload(bucket: string, key: string, uploadId: string): Promise<void>;
239
+ /**
240
+ * Empty all objects in a bucket and then delete the bucket
241
+ */
242
+ emptyAndDeleteBucket(bucket: string): Promise<void>;
243
+ }
244
+ /**
245
+ * S3 Error class
246
+ */
247
+ export declare class S3Error extends Error {
248
+ statusCode: number;
249
+ bucket: string;
250
+ key?: string | undefined;
251
+ constructor(message: string, statusCode: number, bucket: string, key?: string | undefined);
252
+ }
253
+ /**
254
+ * Convenience function to create an S3 client
255
+ */
256
+ export declare function createS3Client(options?: S3ClientOptions): S3Client;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * S3 Client Tests
3
+ */
4
+ export {};
@@ -0,0 +1,142 @@
1
+ /**
2
+ * AWS Signature Version 4 Signing Process
3
+ * Implements request signing for direct AWS API calls without SDK
4
+ *
5
+ * Reference: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
6
+ *
7
+ * Browser compatible: Use async functions (signRequestAsync, createPresignedUrlAsync)
8
+ * Node.js/Bun: Use sync functions for better performance (signRequest, createPresignedUrl)
9
+ */
10
+ export interface SignatureOptions {
11
+ method: string;
12
+ url: string;
13
+ /** Service name - if not provided, will be auto-detected from URL */
14
+ service?: string;
15
+ /** Region - if not provided, will be auto-detected from URL */
16
+ region?: string;
17
+ headers?: Record<string, string>;
18
+ body?: string;
19
+ accessKeyId: string;
20
+ secretAccessKey: string;
21
+ sessionToken?: string;
22
+ /**
23
+ * Optional external cache for signing keys
24
+ * If not provided, uses internal cache
25
+ * Supports both Buffer (Node.js) and Uint8Array (browser)
26
+ */
27
+ cache?: Map<string, Buffer | Uint8Array>;
28
+ /**
29
+ * Sign via query string instead of Authorization header
30
+ * Used for presigned URLs (e.g., S3 presigned URLs)
31
+ */
32
+ signQuery?: boolean;
33
+ /**
34
+ * Expiration time in seconds for presigned URLs (default: 86400 = 24 hours)
35
+ * Only used when signQuery is true
36
+ */
37
+ expiresIn?: number;
38
+ /**
39
+ * Custom datetime for signing (format: YYYYMMDDTHHMMSSZ)
40
+ * If not provided, uses current time
41
+ * Useful for testing and reproducibility
42
+ */
43
+ datetime?: string;
44
+ }
45
+ export interface SignedRequest {
46
+ url: string;
47
+ method: string;
48
+ headers: Record<string, string>;
49
+ body?: string;
50
+ }
51
+ export interface PresignedUrlOptions {
52
+ url: string;
53
+ method?: string;
54
+ accessKeyId: string;
55
+ secretAccessKey: string;
56
+ sessionToken?: string;
57
+ /** Service name - if not provided, will be auto-detected from URL */
58
+ service?: string;
59
+ /** Region - if not provided, will be auto-detected from URL */
60
+ region?: string;
61
+ /** Expiration time in seconds (default: 3600 = 1 hour, max: 604800 = 7 days) */
62
+ expiresIn?: number;
63
+ /** Optional external cache for signing keys */
64
+ cache?: Map<string, Buffer | Uint8Array>;
65
+ }
66
+ export interface RetryOptions {
67
+ /** Maximum number of retry attempts (default: 3) */
68
+ maxRetries?: number;
69
+ /** Initial delay in ms before first retry (default: 100) */
70
+ initialDelayMs?: number;
71
+ /** Maximum delay in ms between retries (default: 5000) */
72
+ maxDelayMs?: number;
73
+ /** HTTP status codes that should trigger a retry (default: [429, 500, 502, 503, 504]) */
74
+ retryableStatusCodes?: number[];
75
+ /** Request timeout in milliseconds (default: 30000 = 30 seconds) */
76
+ timeoutMs?: number;
77
+ }
78
+ /**
79
+ * Detect service and region from AWS URL
80
+ * Supports standard AWS endpoints, Lambda URLs, R2, and Backblaze B2
81
+ */
82
+ export declare function detectServiceRegion(url: string | URL): {
83
+ service: string;
84
+ region: string;
85
+ };
86
+ /**
87
+ * Sign an AWS request using Signature Version 4
88
+ */
89
+ export declare function signRequest(options: SignatureOptions): SignedRequest;
90
+ /**
91
+ * Sign an AWS request using Signature Version 4 (async - browser compatible)
92
+ * Use this in browser environments where crypto.subtle is available
93
+ */
94
+ export declare function signRequestAsync(options: SignatureOptions): Promise<SignedRequest>;
95
+ /**
96
+ * Generate a presigned URL for AWS requests (e.g., S3 GetObject, PutObject)
97
+ */
98
+ export declare function createPresignedUrl(options: PresignedUrlOptions): string;
99
+ /**
100
+ * Generate a presigned URL for AWS requests (async - browser compatible)
101
+ */
102
+ export declare function createPresignedUrlAsync(options: PresignedUrlOptions): Promise<string>;
103
+ /**
104
+ * Make a signed AWS API request with automatic retry
105
+ */
106
+ export declare function makeAWSRequest(options: SignatureOptions, retryOptions?: RetryOptions): Promise<Response>;
107
+ /**
108
+ * Make a signed AWS API request without retry (for backwards compatibility)
109
+ */
110
+ export declare function makeAWSRequestOnce(options: SignatureOptions): Promise<Response>;
111
+ /**
112
+ * Make a signed AWS API request with automatic retry (async - browser compatible)
113
+ * Use this in browser environments where crypto.subtle is available
114
+ */
115
+ export declare function makeAWSRequestAsync(options: SignatureOptions, retryOptions?: RetryOptions): Promise<Response>;
116
+ /**
117
+ * Parse XML response from AWS
118
+ */
119
+ export declare function parseXMLResponse<T = any>(response: Response): Promise<T>;
120
+ /**
121
+ * Parse JSON response from AWS
122
+ */
123
+ export declare function parseJSONResponse<T = any>(response: Response): Promise<T>;
124
+ /**
125
+ * Clear the internal signing key cache
126
+ * Call this when credentials change or for testing
127
+ */
128
+ export declare function clearSigningKeyCache(): void;
129
+ /**
130
+ * Get current cache size (for diagnostics)
131
+ */
132
+ export declare function getSigningKeyCacheSize(): number;
133
+ /**
134
+ * Check if Node.js crypto is available (for sync operations)
135
+ * Returns true in Node.js/Bun, false in browser
136
+ */
137
+ export declare function isNodeCryptoAvailable(): boolean;
138
+ /**
139
+ * Check if Web Crypto API is available (for async operations)
140
+ * Returns true in modern browsers and Node.js 15+
141
+ */
142
+ export declare function isWebCryptoAvailable(): boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * AWS Signature V4 Tests
3
+ */
4
+ export {};