autotel-aws 0.2.0

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 (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +540 -0
  3. package/dist/attributes.cjs +49 -0
  4. package/dist/attributes.cjs.map +1 -0
  5. package/dist/attributes.d.cts +117 -0
  6. package/dist/attributes.d.ts +117 -0
  7. package/dist/attributes.js +4 -0
  8. package/dist/attributes.js.map +1 -0
  9. package/dist/chunk-35F3UBOO.cjs +48 -0
  10. package/dist/chunk-35F3UBOO.cjs.map +1 -0
  11. package/dist/chunk-4TGVGEUN.cjs +84 -0
  12. package/dist/chunk-4TGVGEUN.cjs.map +1 -0
  13. package/dist/chunk-CIGXV6HA.js +192 -0
  14. package/dist/chunk-CIGXV6HA.js.map +1 -0
  15. package/dist/chunk-D5INYMRP.cjs +350 -0
  16. package/dist/chunk-D5INYMRP.cjs.map +1 -0
  17. package/dist/chunk-DF5PT3JK.js +387 -0
  18. package/dist/chunk-DF5PT3JK.js.map +1 -0
  19. package/dist/chunk-DGUM43GV.js +10 -0
  20. package/dist/chunk-DGUM43GV.js.map +1 -0
  21. package/dist/chunk-DHHLKZHI.cjs +23 -0
  22. package/dist/chunk-DHHLKZHI.cjs.map +1 -0
  23. package/dist/chunk-FKZOELBT.js +78 -0
  24. package/dist/chunk-FKZOELBT.js.map +1 -0
  25. package/dist/chunk-HMTKKKKP.cjs +390 -0
  26. package/dist/chunk-HMTKKKKP.cjs.map +1 -0
  27. package/dist/chunk-I4CKQ4RD.js +153 -0
  28. package/dist/chunk-I4CKQ4RD.js.map +1 -0
  29. package/dist/chunk-JEQ2X3Z6.cjs +12 -0
  30. package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
  31. package/dist/chunk-JMSFE6FJ.js +24 -0
  32. package/dist/chunk-JMSFE6FJ.js.map +1 -0
  33. package/dist/chunk-KUIOI74B.cjs +394 -0
  34. package/dist/chunk-KUIOI74B.cjs.map +1 -0
  35. package/dist/chunk-NQ65Y5AI.cjs +195 -0
  36. package/dist/chunk-NQ65Y5AI.cjs.map +1 -0
  37. package/dist/chunk-OB4XTAVK.cjs +345 -0
  38. package/dist/chunk-OB4XTAVK.cjs.map +1 -0
  39. package/dist/chunk-OHFR7WX5.js +341 -0
  40. package/dist/chunk-OHFR7WX5.js.map +1 -0
  41. package/dist/chunk-PZGYL7XZ.js +40 -0
  42. package/dist/chunk-PZGYL7XZ.js.map +1 -0
  43. package/dist/chunk-Q3DMMQ7K.cjs +164 -0
  44. package/dist/chunk-Q3DMMQ7K.cjs.map +1 -0
  45. package/dist/chunk-UZEJV2YD.cjs +139 -0
  46. package/dist/chunk-UZEJV2YD.cjs.map +1 -0
  47. package/dist/chunk-V4IQWFYN.js +341 -0
  48. package/dist/chunk-V4IQWFYN.js.map +1 -0
  49. package/dist/chunk-VZHQH75L.cjs +26 -0
  50. package/dist/chunk-VZHQH75L.cjs.map +1 -0
  51. package/dist/chunk-X6BY6PCK.js +386 -0
  52. package/dist/chunk-X6BY6PCK.js.map +1 -0
  53. package/dist/chunk-YG56NRIO.js +131 -0
  54. package/dist/chunk-YG56NRIO.js.map +1 -0
  55. package/dist/chunk-ZPDRKCAR.js +21 -0
  56. package/dist/chunk-ZPDRKCAR.js.map +1 -0
  57. package/dist/config-C7zV8Zm6.d.cts +125 -0
  58. package/dist/config-DxjTT8jd.d.ts +125 -0
  59. package/dist/dynamodb.cjs +14 -0
  60. package/dist/dynamodb.cjs.map +1 -0
  61. package/dist/dynamodb.d.cts +93 -0
  62. package/dist/dynamodb.d.ts +93 -0
  63. package/dist/dynamodb.js +5 -0
  64. package/dist/dynamodb.js.map +1 -0
  65. package/dist/eventbridge.cjs +279 -0
  66. package/dist/eventbridge.cjs.map +1 -0
  67. package/dist/eventbridge.d.cts +360 -0
  68. package/dist/eventbridge.d.ts +360 -0
  69. package/dist/eventbridge.js +273 -0
  70. package/dist/eventbridge.js.map +1 -0
  71. package/dist/index.cjs +251 -0
  72. package/dist/index.cjs.map +1 -0
  73. package/dist/index.d.cts +126 -0
  74. package/dist/index.d.ts +126 -0
  75. package/dist/index.js +48 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/kinesis.cjs +23 -0
  78. package/dist/kinesis.cjs.map +1 -0
  79. package/dist/kinesis.d.cts +360 -0
  80. package/dist/kinesis.d.ts +360 -0
  81. package/dist/kinesis.js +6 -0
  82. package/dist/kinesis.js.map +1 -0
  83. package/dist/lambda-auto.cjs +19 -0
  84. package/dist/lambda-auto.cjs.map +1 -0
  85. package/dist/lambda-auto.d.cts +2 -0
  86. package/dist/lambda-auto.d.ts +2 -0
  87. package/dist/lambda-auto.js +17 -0
  88. package/dist/lambda-auto.js.map +1 -0
  89. package/dist/lambda.cjs +42 -0
  90. package/dist/lambda.cjs.map +1 -0
  91. package/dist/lambda.d.cts +231 -0
  92. package/dist/lambda.d.ts +231 -0
  93. package/dist/lambda.js +5 -0
  94. package/dist/lambda.js.map +1 -0
  95. package/dist/s3.cjs +14 -0
  96. package/dist/s3.cjs.map +1 -0
  97. package/dist/s3.d.cts +77 -0
  98. package/dist/s3.d.ts +77 -0
  99. package/dist/s3.js +5 -0
  100. package/dist/s3.js.map +1 -0
  101. package/dist/sdk.cjs +31 -0
  102. package/dist/sdk.cjs.map +1 -0
  103. package/dist/sdk.d.cts +155 -0
  104. package/dist/sdk.d.ts +155 -0
  105. package/dist/sdk.js +6 -0
  106. package/dist/sdk.js.map +1 -0
  107. package/dist/sns.cjs +19 -0
  108. package/dist/sns.cjs.map +1 -0
  109. package/dist/sns.d.cts +256 -0
  110. package/dist/sns.d.ts +256 -0
  111. package/dist/sns.js +6 -0
  112. package/dist/sns.js.map +1 -0
  113. package/dist/sqs.cjs +23 -0
  114. package/dist/sqs.cjs.map +1 -0
  115. package/dist/sqs.d.cts +384 -0
  116. package/dist/sqs.d.ts +384 -0
  117. package/dist/sqs.js +6 -0
  118. package/dist/sqs.js.map +1 -0
  119. package/dist/step-functions.cjs +35 -0
  120. package/dist/step-functions.cjs.map +1 -0
  121. package/dist/step-functions.d.cts +423 -0
  122. package/dist/step-functions.d.ts +423 -0
  123. package/dist/step-functions.js +6 -0
  124. package/dist/step-functions.js.map +1 -0
  125. package/dist/testing.cjs +61 -0
  126. package/dist/testing.cjs.map +1 -0
  127. package/dist/testing.d.cts +39 -0
  128. package/dist/testing.d.ts +39 -0
  129. package/dist/testing.js +58 -0
  130. package/dist/testing.js.map +1 -0
  131. package/dist/types-3_ak5jhy.d.cts +76 -0
  132. package/dist/types-3_ak5jhy.d.ts +76 -0
  133. package/dist/types-UiBv_I_M.d.ts +16 -0
  134. package/dist/types-kTFVdSqO.d.cts +16 -0
  135. package/dist/xray.cjs +26 -0
  136. package/dist/xray.cjs.map +1 -0
  137. package/dist/xray.d.cts +23 -0
  138. package/dist/xray.d.ts +23 -0
  139. package/dist/xray.js +5 -0
  140. package/dist/xray.js.map +1 -0
  141. package/package.json +184 -0
@@ -0,0 +1,423 @@
1
+ import { TraceContext } from 'autotel';
2
+ import { SpanContext } from '@opentelemetry/api';
3
+
4
+ /**
5
+ * Step Functions instrumentation
6
+ *
7
+ * Provides semantic helpers for tracing AWS Step Functions operations
8
+ * with context propagation for distributed tracing across state machines.
9
+ *
10
+ * @example Start workflow with trace context
11
+ * ```typescript
12
+ * import { StepFunctionsExecutor, injectTraceContext } from 'autotel-aws/step-functions';
13
+ * import { SFNClient } from '@aws-sdk/client-sfn';
14
+ *
15
+ * const sfn = new SFNClient({});
16
+ * const executor = new StepFunctionsExecutor(sfn, {
17
+ * stateMachineArn: 'arn:aws:states:us-east-1:123456789:stateMachine:OrderProcessor'
18
+ * });
19
+ *
20
+ * // Start execution with automatic trace context injection
21
+ * const result = await executor.startExecution({
22
+ * input: { orderId: '123', items: [...] },
23
+ * name: 'order-123-execution'
24
+ * });
25
+ * ```
26
+ *
27
+ * @example Extract context in Lambda invoked by Step Functions
28
+ * ```typescript
29
+ * import { extractStepFunctionsContext } from 'autotel-aws/step-functions';
30
+ * import { wrapHandler } from 'autotel-aws/lambda';
31
+ *
32
+ * export const handler = wrapHandler(async (event) => {
33
+ * // Extract trace context from Step Functions input
34
+ * const parentContext = extractStepFunctionsContext(event);
35
+ *
36
+ * // Process the order (without the trace context fields)
37
+ * const { orderId, items } = event;
38
+ * await processOrder(orderId, items);
39
+ *
40
+ * return { status: 'completed' };
41
+ * });
42
+ * ```
43
+ *
44
+ * @example Activity worker with context propagation
45
+ * ```typescript
46
+ * import { StepFunctionsActivityWorker } from 'autotel-aws/step-functions';
47
+ *
48
+ * const worker = new StepFunctionsActivityWorker(sfn, {
49
+ * activityArn: 'arn:aws:states:us-east-1:123456789:activity:ProcessPayment'
50
+ * });
51
+ *
52
+ * // Worker extracts trace context and creates child spans
53
+ * await worker.poll(async (input, taskToken, ctx) => {
54
+ * ctx.setAttribute('payment.amount', input.amount);
55
+ * const result = await processPayment(input);
56
+ * return result;
57
+ * });
58
+ * ```
59
+ */
60
+
61
+ /**
62
+ * Step Functions operation configuration
63
+ */
64
+ interface TraceStepFunctionConfig {
65
+ /**
66
+ * State machine ARN
67
+ * Sets `aws.stepfunctions.state_machine_arn` attribute.
68
+ */
69
+ stateMachineArn: string;
70
+ /**
71
+ * Operation type
72
+ * Used to generate the span name: `stepfunctions.{operation}`
73
+ * @default 'execute'
74
+ */
75
+ operation?: 'StartExecution' | 'DescribeExecution' | 'StopExecution' | 'ListExecutions' | 'SendTaskSuccess' | 'SendTaskFailure' | 'execute';
76
+ }
77
+ /**
78
+ * Configuration for StepFunctionsExecutor
79
+ */
80
+ interface StepFunctionsExecutorConfig {
81
+ /**
82
+ * State machine ARN
83
+ */
84
+ stateMachineArn: string;
85
+ /**
86
+ * Inject W3C Trace Context into execution input
87
+ * @default true
88
+ */
89
+ injectTraceContext?: boolean;
90
+ /**
91
+ * Optional service name for tracing
92
+ */
93
+ service?: string;
94
+ }
95
+ /**
96
+ * Execution input with optional trace context
97
+ */
98
+ interface ExecutionInput<T = Record<string, unknown>> {
99
+ /**
100
+ * The input data for the execution
101
+ */
102
+ input: T;
103
+ /**
104
+ * Optional execution name (must be unique within 90 days)
105
+ */
106
+ name?: string;
107
+ /**
108
+ * Optional trace ID for idempotency
109
+ */
110
+ traceHeader?: string;
111
+ }
112
+ /**
113
+ * Configuration for StepFunctionsActivityWorker
114
+ */
115
+ interface StepFunctionsActivityWorkerConfig {
116
+ /**
117
+ * Activity ARN
118
+ */
119
+ activityArn: string;
120
+ /**
121
+ * Worker name for identification
122
+ */
123
+ workerName?: string;
124
+ /**
125
+ * Extract trace context from activity input
126
+ * @default true
127
+ */
128
+ extractTraceContext?: boolean;
129
+ /**
130
+ * Optional service name for tracing
131
+ */
132
+ service?: string;
133
+ }
134
+ /**
135
+ * Trace context fields injected into Step Functions input
136
+ */
137
+ interface TraceContextFields {
138
+ _traceContext?: {
139
+ traceparent: string;
140
+ tracestate?: string;
141
+ baggage?: string;
142
+ };
143
+ }
144
+ /**
145
+ * Inject W3C Trace Context into Step Functions execution input
146
+ *
147
+ * Adds `_traceContext` field with traceparent, tracestate, and baggage.
148
+ * This enables distributed tracing across Step Functions executions
149
+ * and Lambda functions invoked by the state machine.
150
+ *
151
+ * @param input - The original execution input
152
+ * @returns Input with trace context injected
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * const input = { orderId: '123', items: [...] };
157
+ * const inputWithContext = injectTraceContext(input);
158
+ * // { orderId: '123', items: [...], _traceContext: { traceparent: '...' } }
159
+ *
160
+ * await sfn.send(new StartExecutionCommand({
161
+ * stateMachineArn: 'arn:...',
162
+ * input: JSON.stringify(inputWithContext)
163
+ * }));
164
+ * ```
165
+ */
166
+ declare function injectTraceContext<T extends Record<string, unknown>>(input: T): T & TraceContextFields;
167
+ /**
168
+ * Extract W3C Trace Context from Step Functions input
169
+ *
170
+ * Extracts the `_traceContext` field added by injectTraceContext.
171
+ * Returns the SpanContext if present, or undefined.
172
+ *
173
+ * @param input - Step Functions input (event in Lambda handler)
174
+ * @returns SpanContext if trace context was found, undefined otherwise
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // In a Lambda invoked by Step Functions
179
+ * export const handler = async (event) => {
180
+ * const parentContext = extractStepFunctionsContext(event);
181
+ * // Use parentContext to link traces...
182
+ *
183
+ * // Access data without trace context
184
+ * const { orderId, items } = stripTraceContext(event);
185
+ * };
186
+ * ```
187
+ */
188
+ declare function extractStepFunctionsContext(input: unknown): SpanContext | undefined;
189
+ /**
190
+ * Strip trace context fields from Step Functions input
191
+ *
192
+ * Returns the input without `_traceContext` field for cleaner processing.
193
+ *
194
+ * @param input - Step Functions input with optional trace context
195
+ * @returns Input without trace context fields
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * const event = { orderId: '123', _traceContext: { ... } };
200
+ * const cleanInput = stripTraceContext(event);
201
+ * // { orderId: '123' }
202
+ * ```
203
+ */
204
+ declare function stripTraceContext<T extends Record<string, unknown>>(input: T): Omit<T, '_traceContext'>;
205
+ /**
206
+ * Trace Step Functions operations
207
+ *
208
+ * Creates a traced function that automatically sets Step Functions attributes.
209
+ *
210
+ * @param config - Step Functions operation configuration
211
+ * @returns A higher-order function that wraps your Step Functions operation with tracing
212
+ *
213
+ * @remarks
214
+ * Semantic attributes set automatically:
215
+ * - `aws.stepfunctions.state_machine_arn` - State machine ARN
216
+ *
217
+ * Additional attributes you should set in your handler:
218
+ * - `aws.stepfunctions.execution_arn` - Execution ARN
219
+ * - `aws.stepfunctions.execution_name` - Execution name
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * export const startWorkflow = traceStepFunction({
224
+ * stateMachineArn: 'arn:aws:states:us-east-1:123456789:stateMachine:OrderProcessor',
225
+ * operation: 'StartExecution'
226
+ * })(ctx => async (input: object, executionName?: string) => {
227
+ * const result = await sfn.send(new StartExecutionCommand({
228
+ * stateMachineArn: 'arn:aws:states:...',
229
+ * input: JSON.stringify(injectTraceContext(input)),
230
+ * name: executionName
231
+ * }));
232
+ *
233
+ * ctx.setAttribute('aws.stepfunctions.execution_arn', result.executionArn ?? '');
234
+ * return result;
235
+ * });
236
+ * ```
237
+ */
238
+ declare function traceStepFunction(config: TraceStepFunctionConfig): <TArgs extends unknown[], TReturn>(fn: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>) => (...args: TArgs) => Promise<TReturn>;
239
+ /**
240
+ * Step Functions Executor with automatic trace context injection
241
+ *
242
+ * Wraps an SFN client to automatically:
243
+ * - Create spans for all operations
244
+ * - Inject W3C Trace Context into execution input
245
+ * - Set proper semantic attributes
246
+ *
247
+ * @example Basic usage
248
+ * ```typescript
249
+ * import { StepFunctionsExecutor } from 'autotel-aws/step-functions';
250
+ * import { SFNClient } from '@aws-sdk/client-sfn';
251
+ *
252
+ * const sfn = new SFNClient({ region: 'us-east-1' });
253
+ * const executor = new StepFunctionsExecutor(sfn, {
254
+ * stateMachineArn: 'arn:aws:states:us-east-1:123456789:stateMachine:OrderProcessor'
255
+ * });
256
+ *
257
+ * // Start execution with automatic trace context
258
+ * const result = await executor.startExecution({
259
+ * input: { orderId: '123', items: ['item1', 'item2'] },
260
+ * name: 'order-123-execution'
261
+ * });
262
+ *
263
+ * console.log('Execution ARN:', result.executionArn);
264
+ * ```
265
+ *
266
+ * @example Express workflow (sync execution)
267
+ * ```typescript
268
+ * // Express workflows return synchronously
269
+ * const result = await executor.startSyncExecution({
270
+ * input: { orderId: '123' }
271
+ * });
272
+ *
273
+ * if (result.status === 'SUCCEEDED') {
274
+ * const output = JSON.parse(result.output || '{}');
275
+ * console.log('Workflow output:', output);
276
+ * }
277
+ * ```
278
+ */
279
+ declare class StepFunctionsExecutor<TClient extends {
280
+ send: (command: any) => Promise<any>;
281
+ } = any> {
282
+ private client;
283
+ private config;
284
+ private stateMachineName;
285
+ constructor(client: TClient, config: StepFunctionsExecutorConfig);
286
+ /**
287
+ * Start a new execution of the state machine
288
+ *
289
+ * @param execution - Execution input and optional name
290
+ * @returns Promise with execution ARN and start date
291
+ */
292
+ startExecution<T extends Record<string, unknown>>(execution: ExecutionInput<T>): Promise<{
293
+ executionArn?: string;
294
+ startDate?: Date;
295
+ }>;
296
+ /**
297
+ * Start a synchronous execution (Express workflows only)
298
+ *
299
+ * @param execution - Execution input and optional name
300
+ * @returns Promise with execution result including output
301
+ */
302
+ startSyncExecution<T extends Record<string, unknown>>(execution: ExecutionInput<T>): Promise<{
303
+ executionArn?: string;
304
+ status?: 'SUCCEEDED' | 'FAILED' | 'TIMED_OUT';
305
+ output?: string;
306
+ error?: string;
307
+ cause?: string;
308
+ billingDetails?: {
309
+ billedMemoryUsedInMB?: number;
310
+ billedDurationInMilliseconds?: number;
311
+ };
312
+ }>;
313
+ /**
314
+ * Describe an execution
315
+ *
316
+ * @param executionArn - ARN of the execution to describe
317
+ * @returns Promise with execution details
318
+ */
319
+ describeExecution(executionArn: string): Promise<{
320
+ executionArn?: string;
321
+ stateMachineArn?: string;
322
+ name?: string;
323
+ status?: string;
324
+ startDate?: Date;
325
+ stopDate?: Date;
326
+ input?: string;
327
+ output?: string;
328
+ error?: string;
329
+ cause?: string;
330
+ }>;
331
+ /**
332
+ * Stop an execution
333
+ *
334
+ * @param executionArn - ARN of the execution to stop
335
+ * @param options - Optional error and cause for the stop
336
+ * @returns Promise with stop date
337
+ */
338
+ stopExecution(executionArn: string, options?: {
339
+ error?: string;
340
+ cause?: string;
341
+ }): Promise<{
342
+ stopDate?: Date;
343
+ }>;
344
+ }
345
+ /**
346
+ * Step Functions Activity Worker with trace context extraction
347
+ *
348
+ * Polls for activity tasks and processes them with automatic tracing.
349
+ * Extracts trace context from task input for distributed tracing.
350
+ *
351
+ * @example Basic activity worker
352
+ * ```typescript
353
+ * import { StepFunctionsActivityWorker } from 'autotel-aws/step-functions';
354
+ * import { SFNClient } from '@aws-sdk/client-sfn';
355
+ *
356
+ * const sfn = new SFNClient({ region: 'us-east-1' });
357
+ * const worker = new StepFunctionsActivityWorker(sfn, {
358
+ * activityArn: 'arn:aws:states:us-east-1:123456789:activity:ProcessPayment',
359
+ * workerName: 'payment-worker-1'
360
+ * });
361
+ *
362
+ * // Process tasks with automatic tracing
363
+ * await worker.poll(async (input, taskToken, ctx) => {
364
+ * ctx.setAttribute('payment.amount', input.amount);
365
+ * ctx.setAttribute('payment.currency', input.currency);
366
+ *
367
+ * const result = await processPayment(input);
368
+ *
369
+ * ctx.setAttribute('payment.status', result.status);
370
+ * return result;
371
+ * });
372
+ * ```
373
+ *
374
+ * @example Continuous polling with error handling
375
+ * ```typescript
376
+ * async function runWorker() {
377
+ * while (true) {
378
+ * try {
379
+ * await worker.poll(async (input, taskToken, ctx) => {
380
+ * return await processTask(input);
381
+ * });
382
+ * } catch (error) {
383
+ * console.error('Worker error:', error);
384
+ * // Brief pause before retrying
385
+ * await new Promise(resolve => setTimeout(resolve, 1000));
386
+ * }
387
+ * }
388
+ * }
389
+ * ```
390
+ */
391
+ declare class StepFunctionsActivityWorker<TClient extends {
392
+ send: (command: any) => Promise<any>;
393
+ } = any> {
394
+ private client;
395
+ private config;
396
+ private activityName;
397
+ constructor(client: TClient, config: StepFunctionsActivityWorkerConfig);
398
+ /**
399
+ * Poll for an activity task and process it
400
+ *
401
+ * @param processor - Function to process the task input
402
+ * @returns Promise that resolves when the task is processed
403
+ */
404
+ poll<TInput extends Record<string, unknown>, TOutput>(processor: (input: TInput, taskToken: string, ctx: TraceContext) => Promise<TOutput>): Promise<void>;
405
+ /**
406
+ * Send a task heartbeat
407
+ *
408
+ * For long-running activities, send heartbeats to prevent timeout.
409
+ *
410
+ * @param taskToken - The task token from GetActivityTask
411
+ */
412
+ sendHeartbeat(taskToken: string): Promise<void>;
413
+ /**
414
+ * Send task failure
415
+ *
416
+ * @param taskToken - The task token from GetActivityTask
417
+ * @param error - Error code
418
+ * @param cause - Error cause description
419
+ */
420
+ sendFailure(taskToken: string, error: string, cause?: string): Promise<void>;
421
+ }
422
+
423
+ export { type ExecutionInput, StepFunctionsActivityWorker, type StepFunctionsActivityWorkerConfig, StepFunctionsExecutor, type StepFunctionsExecutorConfig, type TraceStepFunctionConfig, extractStepFunctionsContext, injectTraceContext, stripTraceContext, traceStepFunction };
@@ -0,0 +1,6 @@
1
+ export { StepFunctionsActivityWorker, StepFunctionsExecutor, extractStepFunctionsContext, injectTraceContext, stripTraceContext, traceStepFunction } from './chunk-DF5PT3JK.js';
2
+ import './chunk-YG56NRIO.js';
3
+ import './chunk-I4CKQ4RD.js';
4
+ import './chunk-DGUM43GV.js';
5
+ //# sourceMappingURL=step-functions.js.map
6
+ //# sourceMappingURL=step-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"step-functions.js"}
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ require('./chunk-JEQ2X3Z6.cjs');
4
+
5
+ // src/testing/lambda-harness.ts
6
+ function createMockLambdaContext(overrides) {
7
+ return {
8
+ awsRequestId: "test-request-id",
9
+ functionName: "test-function",
10
+ functionVersion: "$LATEST",
11
+ invokedFunctionArn: "arn:aws:lambda:us-east-1:123456789012:function:test-function",
12
+ memoryLimitInMB: "128",
13
+ getRemainingTimeInMillis: () => 3e4,
14
+ ...overrides
15
+ };
16
+ }
17
+ function createLambdaTestHarness() {
18
+ return {
19
+ /**
20
+ * Invoke a Lambda handler with test event and context
21
+ */
22
+ async invoke(handler, event, context) {
23
+ const mockContext = createMockLambdaContext(context);
24
+ return handler(event, mockContext);
25
+ }
26
+ };
27
+ }
28
+
29
+ // src/testing/localstack.ts
30
+ function createLocalStackHelpers() {
31
+ return {
32
+ /**
33
+ * Get LocalStack endpoint URL
34
+ * @param _service - Service name (currently unused, all services use same endpoint)
35
+ */
36
+ getEndpoint(_service) {
37
+ const host = process.env.LOCALSTACK_HOST || "localhost";
38
+ const port = process.env.LOCALSTACK_PORT || "4566";
39
+ return `http://${host}:${port}`;
40
+ },
41
+ /**
42
+ * Check if LocalStack is available
43
+ */
44
+ async isAvailable() {
45
+ try {
46
+ const response = await fetch(
47
+ `${this.getEndpoint("health")}/_localstack/health`,
48
+ { method: "GET" }
49
+ );
50
+ return response.ok;
51
+ } catch {
52
+ return false;
53
+ }
54
+ }
55
+ };
56
+ }
57
+
58
+ exports.createLambdaTestHarness = createLambdaTestHarness;
59
+ exports.createLocalStackHelpers = createLocalStackHelpers;
60
+ //# sourceMappingURL=testing.cjs.map
61
+ //# sourceMappingURL=testing.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/testing/lambda-harness.ts","../src/testing/localstack.ts"],"names":[],"mappings":";;;;;AAUO,SAAS,wBAAwB,SAAA,EAAmD;AACzF,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,iBAAA;AAAA,IACd,YAAA,EAAc,eAAA;AAAA,IACd,eAAA,EAAiB,SAAA;AAAA,IACjB,kBAAA,EAAoB,8DAAA;AAAA,IACpB,eAAA,EAAiB,KAAA;AAAA,IACjB,0BAA0B,MAAM,GAAA;AAAA,IAChC,GAAG;AAAA,GACL;AACF;AAKO,SAAS,uBAAA,GAA0B;AACxC,EAAA,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,MAAM,MAAA,CACJ,OAAA,EACA,KAAA,EACA,OAAA,EACkB;AAClB,MAAA,MAAM,WAAA,GAAc,wBAAwB,OAAO,CAAA;AACnD,MAAA,OAAO,OAAA,CAAQ,OAAO,WAAW,CAAA;AAAA,IACnC;AAAA,GACF;AACF;;;AC9BO,SAAS,uBAAA,GAA0B;AACxC,EAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,YAAY,QAAA,EAA0B;AACpC,MAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,eAAA,IAAmB,WAAA;AAC5C,MAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,eAAA,IAAmB,MAAA;AAC5C,MAAA,OAAO,CAAA,OAAA,EAAU,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,IAC/B,CAAA;AAAA;AAAA;AAAA;AAAA,IAKA,MAAM,WAAA,GAAgC;AACpC,MAAA,IAAI;AACF,QAAA,MAAM,WAAW,MAAM,KAAA;AAAA,UACrB,CAAA,EAAG,IAAA,CAAK,WAAA,CAAY,QAAQ,CAAC,CAAA,mBAAA,CAAA;AAAA,UAC7B,EAAE,QAAQ,KAAA;AAAM,SAClB;AACA,QAAA,OAAO,QAAA,CAAS,EAAA;AAAA,MAClB,CAAA,CAAA,MAAQ;AACN,QAAA,OAAO,KAAA;AAAA,MACT;AAAA,IACF;AAAA,GACF;AACF","file":"testing.cjs","sourcesContent":["/**\n * Lambda test harness utilities\n */\n\nimport type { LambdaHandler } from '../lambda/types';\nimport type { LambdaContext } from '../types';\n\n/**\n * Mock Lambda context for testing\n */\nexport function createMockLambdaContext(overrides?: Partial<LambdaContext>): LambdaContext {\n return {\n awsRequestId: 'test-request-id',\n functionName: 'test-function',\n functionVersion: '$LATEST',\n invokedFunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:test-function',\n memoryLimitInMB: '128',\n getRemainingTimeInMillis: () => 30_000,\n ...overrides,\n };\n}\n\n/**\n * Lambda test harness\n */\nexport function createLambdaTestHarness() {\n return {\n /**\n * Invoke a Lambda handler with test event and context\n */\n async invoke<TEvent, TResult>(\n handler: LambdaHandler<TEvent, TResult>,\n event: TEvent,\n context?: Partial<LambdaContext>\n ): Promise<TResult> {\n const mockContext = createMockLambdaContext(context);\n return handler(event, mockContext);\n },\n };\n}\n","/**\n * LocalStack integration helpers\n *\n * LocalStack is a cloud service emulator for local AWS development and testing.\n */\n\n/**\n * Create LocalStack helpers for testing\n */\nexport function createLocalStackHelpers() {\n return {\n /**\n * Get LocalStack endpoint URL\n * @param _service - Service name (currently unused, all services use same endpoint)\n */\n getEndpoint(_service: string): string {\n const host = process.env.LOCALSTACK_HOST || 'localhost';\n const port = process.env.LOCALSTACK_PORT || '4566';\n return `http://${host}:${port}`;\n },\n\n /**\n * Check if LocalStack is available\n */\n async isAvailable(): Promise<boolean> {\n try {\n const response = await fetch(\n `${this.getEndpoint('health')}/_localstack/health`,\n { method: 'GET' }\n );\n return response.ok;\n } catch {\n return false;\n }\n },\n };\n}\n"]}
@@ -0,0 +1,39 @@
1
+ import { L as LambdaHandler } from './types-kTFVdSqO.cjs';
2
+ import { a as LambdaContext } from './types-3_ak5jhy.cjs';
3
+ import '@opentelemetry/api';
4
+
5
+ /**
6
+ * Lambda test harness utilities
7
+ */
8
+
9
+ /**
10
+ * Lambda test harness
11
+ */
12
+ declare function createLambdaTestHarness(): {
13
+ /**
14
+ * Invoke a Lambda handler with test event and context
15
+ */
16
+ invoke<TEvent, TResult>(handler: LambdaHandler<TEvent, TResult>, event: TEvent, context?: Partial<LambdaContext>): Promise<TResult>;
17
+ };
18
+
19
+ /**
20
+ * LocalStack integration helpers
21
+ *
22
+ * LocalStack is a cloud service emulator for local AWS development and testing.
23
+ */
24
+ /**
25
+ * Create LocalStack helpers for testing
26
+ */
27
+ declare function createLocalStackHelpers(): {
28
+ /**
29
+ * Get LocalStack endpoint URL
30
+ * @param _service - Service name (currently unused, all services use same endpoint)
31
+ */
32
+ getEndpoint(_service: string): string;
33
+ /**
34
+ * Check if LocalStack is available
35
+ */
36
+ isAvailable(): Promise<boolean>;
37
+ };
38
+
39
+ export { createLambdaTestHarness, createLocalStackHelpers };
@@ -0,0 +1,39 @@
1
+ import { L as LambdaHandler } from './types-UiBv_I_M.js';
2
+ import { a as LambdaContext } from './types-3_ak5jhy.js';
3
+ import '@opentelemetry/api';
4
+
5
+ /**
6
+ * Lambda test harness utilities
7
+ */
8
+
9
+ /**
10
+ * Lambda test harness
11
+ */
12
+ declare function createLambdaTestHarness(): {
13
+ /**
14
+ * Invoke a Lambda handler with test event and context
15
+ */
16
+ invoke<TEvent, TResult>(handler: LambdaHandler<TEvent, TResult>, event: TEvent, context?: Partial<LambdaContext>): Promise<TResult>;
17
+ };
18
+
19
+ /**
20
+ * LocalStack integration helpers
21
+ *
22
+ * LocalStack is a cloud service emulator for local AWS development and testing.
23
+ */
24
+ /**
25
+ * Create LocalStack helpers for testing
26
+ */
27
+ declare function createLocalStackHelpers(): {
28
+ /**
29
+ * Get LocalStack endpoint URL
30
+ * @param _service - Service name (currently unused, all services use same endpoint)
31
+ */
32
+ getEndpoint(_service: string): string;
33
+ /**
34
+ * Check if LocalStack is available
35
+ */
36
+ isAvailable(): Promise<boolean>;
37
+ };
38
+
39
+ export { createLambdaTestHarness, createLocalStackHelpers };
@@ -0,0 +1,58 @@
1
+ import './chunk-DGUM43GV.js';
2
+
3
+ // src/testing/lambda-harness.ts
4
+ function createMockLambdaContext(overrides) {
5
+ return {
6
+ awsRequestId: "test-request-id",
7
+ functionName: "test-function",
8
+ functionVersion: "$LATEST",
9
+ invokedFunctionArn: "arn:aws:lambda:us-east-1:123456789012:function:test-function",
10
+ memoryLimitInMB: "128",
11
+ getRemainingTimeInMillis: () => 3e4,
12
+ ...overrides
13
+ };
14
+ }
15
+ function createLambdaTestHarness() {
16
+ return {
17
+ /**
18
+ * Invoke a Lambda handler with test event and context
19
+ */
20
+ async invoke(handler, event, context) {
21
+ const mockContext = createMockLambdaContext(context);
22
+ return handler(event, mockContext);
23
+ }
24
+ };
25
+ }
26
+
27
+ // src/testing/localstack.ts
28
+ function createLocalStackHelpers() {
29
+ return {
30
+ /**
31
+ * Get LocalStack endpoint URL
32
+ * @param _service - Service name (currently unused, all services use same endpoint)
33
+ */
34
+ getEndpoint(_service) {
35
+ const host = process.env.LOCALSTACK_HOST || "localhost";
36
+ const port = process.env.LOCALSTACK_PORT || "4566";
37
+ return `http://${host}:${port}`;
38
+ },
39
+ /**
40
+ * Check if LocalStack is available
41
+ */
42
+ async isAvailable() {
43
+ try {
44
+ const response = await fetch(
45
+ `${this.getEndpoint("health")}/_localstack/health`,
46
+ { method: "GET" }
47
+ );
48
+ return response.ok;
49
+ } catch {
50
+ return false;
51
+ }
52
+ }
53
+ };
54
+ }
55
+
56
+ export { createLambdaTestHarness, createLocalStackHelpers };
57
+ //# sourceMappingURL=testing.js.map
58
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/testing/lambda-harness.ts","../src/testing/localstack.ts"],"names":[],"mappings":";;;AAUO,SAAS,wBAAwB,SAAA,EAAmD;AACzF,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,iBAAA;AAAA,IACd,YAAA,EAAc,eAAA;AAAA,IACd,eAAA,EAAiB,SAAA;AAAA,IACjB,kBAAA,EAAoB,8DAAA;AAAA,IACpB,eAAA,EAAiB,KAAA;AAAA,IACjB,0BAA0B,MAAM,GAAA;AAAA,IAChC,GAAG;AAAA,GACL;AACF;AAKO,SAAS,uBAAA,GAA0B;AACxC,EAAA,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,MAAM,MAAA,CACJ,OAAA,EACA,KAAA,EACA,OAAA,EACkB;AAClB,MAAA,MAAM,WAAA,GAAc,wBAAwB,OAAO,CAAA;AACnD,MAAA,OAAO,OAAA,CAAQ,OAAO,WAAW,CAAA;AAAA,IACnC;AAAA,GACF;AACF;;;AC9BO,SAAS,uBAAA,GAA0B;AACxC,EAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,YAAY,QAAA,EAA0B;AACpC,MAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,eAAA,IAAmB,WAAA;AAC5C,MAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,eAAA,IAAmB,MAAA;AAC5C,MAAA,OAAO,CAAA,OAAA,EAAU,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,IAC/B,CAAA;AAAA;AAAA;AAAA;AAAA,IAKA,MAAM,WAAA,GAAgC;AACpC,MAAA,IAAI;AACF,QAAA,MAAM,WAAW,MAAM,KAAA;AAAA,UACrB,CAAA,EAAG,IAAA,CAAK,WAAA,CAAY,QAAQ,CAAC,CAAA,mBAAA,CAAA;AAAA,UAC7B,EAAE,QAAQ,KAAA;AAAM,SAClB;AACA,QAAA,OAAO,QAAA,CAAS,EAAA;AAAA,MAClB,CAAA,CAAA,MAAQ;AACN,QAAA,OAAO,KAAA;AAAA,MACT;AAAA,IACF;AAAA,GACF;AACF","file":"testing.js","sourcesContent":["/**\n * Lambda test harness utilities\n */\n\nimport type { LambdaHandler } from '../lambda/types';\nimport type { LambdaContext } from '../types';\n\n/**\n * Mock Lambda context for testing\n */\nexport function createMockLambdaContext(overrides?: Partial<LambdaContext>): LambdaContext {\n return {\n awsRequestId: 'test-request-id',\n functionName: 'test-function',\n functionVersion: '$LATEST',\n invokedFunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:test-function',\n memoryLimitInMB: '128',\n getRemainingTimeInMillis: () => 30_000,\n ...overrides,\n };\n}\n\n/**\n * Lambda test harness\n */\nexport function createLambdaTestHarness() {\n return {\n /**\n * Invoke a Lambda handler with test event and context\n */\n async invoke<TEvent, TResult>(\n handler: LambdaHandler<TEvent, TResult>,\n event: TEvent,\n context?: Partial<LambdaContext>\n ): Promise<TResult> {\n const mockContext = createMockLambdaContext(context);\n return handler(event, mockContext);\n },\n };\n}\n","/**\n * LocalStack integration helpers\n *\n * LocalStack is a cloud service emulator for local AWS development and testing.\n */\n\n/**\n * Create LocalStack helpers for testing\n */\nexport function createLocalStackHelpers() {\n return {\n /**\n * Get LocalStack endpoint URL\n * @param _service - Service name (currently unused, all services use same endpoint)\n */\n getEndpoint(_service: string): string {\n const host = process.env.LOCALSTACK_HOST || 'localhost';\n const port = process.env.LOCALSTACK_PORT || '4566';\n return `http://${host}:${port}`;\n },\n\n /**\n * Check if LocalStack is available\n */\n async isAvailable(): Promise<boolean> {\n try {\n const response = await fetch(\n `${this.getEndpoint('health')}/_localstack/health`,\n { method: 'GET' }\n );\n return response.ok;\n } catch {\n return false;\n }\n },\n };\n}\n"]}