@small-tech/https 6.0.0 → 6.0.1

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 (2) hide show
  1. package/index.d.ts +60 -0
  2. package/package.json +4 -2
package/index.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ import {
2
+ ClientRequest,
3
+ IncomingMessage,
4
+ ServerResponse,
5
+ RequestListener,
6
+ } from "node:http"
7
+ import { RequestOptions, Server, ServerOptions } from "node:https"
8
+ import EventEmitter from "node:events"
9
+ import { AutoEncryptedLocalhostServer } from "@small-tech/auto-encrypt-localhost"
10
+ import { AutoEncryptedServer, AutoEncryptOptions } from "@small-tech/auto-encrypt"
11
+
12
+ export class Events extends EventEmitter {
13
+ CREATING_SERVER: symbol
14
+ SERVER_CREATED: symbol
15
+ SERVER_CLOSED: symbol
16
+ }
17
+
18
+ export const events: Events
19
+ export const SMALL_TECH_HOME_PATH: string
20
+ export const DEFAULT_SETTINGS_PATH: string
21
+
22
+ export type SmallTechHttpsOptions = AutoEncryptOptions & {
23
+ staging?: boolean
24
+ }
25
+
26
+ export function request(
27
+ options: RequestOptions | string | URL,
28
+ callback?: (res: IncomingMessage) => void
29
+ ): ClientRequest
30
+
31
+ export function request(
32
+ url: string | URL,
33
+ options: RequestOptions,
34
+ callback?: (res: IncomingMessage) => void
35
+ ): ClientRequest
36
+
37
+
38
+ declare const _default: typeof import("node:https") & {
39
+ createServer: typeof createServer
40
+ request: typeof request
41
+ }
42
+
43
+ declare class https {
44
+ static async createServer<
45
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
46
+ Response extends typeof ServerResponse = typeof ServerResponse
47
+ >(
48
+ requestListener?: RequestListener<Request, Response>
49
+ ): Promise<AutoEncryptedLocalhostServer> | Promise<AutoEncryptedServer>
50
+
51
+ static async createServer<
52
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
53
+ Response extends typeof ServerResponse = typeof ServerResponse
54
+ >(
55
+ options: SmallTechHttpsOptions,
56
+ requestListener?: RequestListener<Request, Response>
57
+ ): Promise<AutoEncryptedLocalhostServer> | Promise<AutoEncryptedServer>
58
+ }
59
+
60
+ export default https
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@small-tech/https",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "A drop-in standard Node.js HTTPS module replacement with both automatic development-time (localhost) certificates via Auto Encrypt Localhost and automatic production certificates via Auto Encrypt.",
5
5
  "main": "index.js",
6
6
  "files": [
7
- "lib"
7
+ "lib",
8
+ "index.d.ts"
8
9
  ],
9
10
  "type": "module",
11
+ "types": "index.d.ts",
10
12
  "engines": {
11
13
  "node": ">=18.20.0"
12
14
  },