@slates/aws-sdk-http-handler 1.0.0-rc.2 → 1.0.0-rc.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.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
- import { AxiosInstance } from 'axios';
2
1
  import { HttpHandler, HttpRequest, HttpResponse } from '@smithy/protocol-http';
3
2
  import { HttpHandlerOptions } from '@smithy/types';
3
+ import { createAxios } from 'slates';
4
4
 
5
+ type SlatesAxiosInstance = ReturnType<typeof createAxios>;
5
6
  interface SlatesAwsSdkHttpHandlerConfig {
6
- axiosInstance?: AxiosInstance;
7
+ axiosInstance?: SlatesAxiosInstance;
7
8
  requestTimeout?: number;
8
9
  }
9
10
  declare class SlatesAwsSdkHttpHandler implements HttpHandler<SlatesAwsSdkHttpHandlerConfig> {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { AxiosInstance } from 'axios';
2
1
  import { HttpHandler, HttpRequest, HttpResponse } from '@smithy/protocol-http';
3
2
  import { HttpHandlerOptions } from '@smithy/types';
3
+ import { createAxios } from 'slates';
4
4
 
5
+ type SlatesAxiosInstance = ReturnType<typeof createAxios>;
5
6
  interface SlatesAwsSdkHttpHandlerConfig {
6
- axiosInstance?: AxiosInstance;
7
+ axiosInstance?: SlatesAxiosInstance;
7
8
  requestTimeout?: number;
8
9
  }
9
10
  declare class SlatesAwsSdkHttpHandler implements HttpHandler<SlatesAwsSdkHttpHandlerConfig> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slates/aws-sdk-http-handler",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,16 +27,16 @@
27
27
  "unpkg": "./dist/index.module.js",
28
28
  "scripts": {
29
29
  "test": "vitest run --config vitest.config.ts --passWithNoTests",
30
- "lint": "prettier src/**/*.ts --check",
31
30
  "build": "tsup --config ../../tsup.packages.config.ts",
32
- "typecheck": "tsc --noEmit"
31
+ "typecheck": "tsc --noEmit",
32
+ "biome:check": "biome check --write src"
33
33
  },
34
34
  "dependencies": {
35
35
  "@smithy/protocol-http": "^5.3.14",
36
36
  "@smithy/querystring-builder": "^4.2.14",
37
37
  "@smithy/types": "^4.14.1",
38
38
  "axios": "^1.13.2",
39
- "slates": "1.0.0-rc.11"
39
+ "slates": "1.0.0-rc.14"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@slates/tsconfig": "1.0.0-rc.1",
package/src/index.test.ts CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  } from 'node:http';
7
7
  import type { AddressInfo } from 'node:net';
8
8
  import { HttpRequest } from '@smithy/protocol-http';
9
- import { SlateContext, runWithContext } from 'slates';
9
+ import { runWithContext, SlateContext } from 'slates';
10
10
  import { describe, expect, it } from 'vitest';
11
11
  import { SlatesAwsSdkHttpHandler } from './index';
12
12
 
@@ -36,7 +36,9 @@ let listen = async (
36
36
  handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>
37
37
  ) => {
38
38
  let server = createServer((req, res) => {
39
- void handler(req, res);
39
+ Promise.resolve(handler(req, res)).catch(error => {
40
+ res.destroy(error instanceof Error ? error : new Error(String(error)));
41
+ });
40
42
  });
41
43
 
42
44
  await new Promise<void>((resolve, reject) => {
package/src/index.ts CHANGED
@@ -1,11 +1,12 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { HttpResponse, type HttpHandler, type HttpRequest } from '@smithy/protocol-http';
1
+ import { type HttpHandler, type HttpRequest, HttpResponse } from '@smithy/protocol-http';
3
2
  import { buildQueryString } from '@smithy/querystring-builder';
4
3
  import type { HttpHandlerOptions } from '@smithy/types';
5
4
  import { createAxios } from 'slates';
6
5
 
6
+ type SlatesAxiosInstance = ReturnType<typeof createAxios>;
7
+
7
8
  export interface SlatesAwsSdkHttpHandlerConfig {
8
- axiosInstance?: AxiosInstance;
9
+ axiosInstance?: SlatesAxiosInstance;
9
10
  requestTimeout?: number;
10
11
  }
11
12
 
@@ -106,7 +107,7 @@ let normalizeTransportError = (error: unknown) => {
106
107
  };
107
108
 
108
109
  export class SlatesAwsSdkHttpHandler implements HttpHandler<SlatesAwsSdkHttpHandlerConfig> {
109
- private readonly axiosClient: AxiosInstance;
110
+ private readonly axiosClient: SlatesAxiosInstance;
110
111
  private config: SlatesAwsSdkHttpHandlerConfig;
111
112
 
112
113
  constructor(config: SlatesAwsSdkHttpHandlerConfig = {}) {