@ykdz/template 0.0.38 → 0.0.41

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 (227) hide show
  1. package/dist/application.d.ts +1 -52
  2. package/dist/application.js +0 -81
  3. package/dist/cli.js +14 -28
  4. package/dist/input-schemas.d.ts +30 -0
  5. package/dist/input-schemas.js +75 -0
  6. package/dist/main.d.ts +3 -14
  7. package/dist/main.js +496 -378
  8. package/dist/result-schemas.d.ts +222 -0
  9. package/dist/result-schemas.js +74 -0
  10. package/dist/standard-schema.d.ts +3 -0
  11. package/dist/standard-schema.js +29 -0
  12. package/node_modules/@standard-schema/spec/LICENSE +21 -0
  13. package/node_modules/@standard-schema/spec/README.md +198 -0
  14. package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
  15. package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
  16. package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
  17. package/node_modules/@standard-schema/spec/dist/index.js +0 -0
  18. package/node_modules/@standard-schema/spec/package.json +52 -0
  19. package/node_modules/@types/node/LICENSE +21 -0
  20. package/node_modules/@types/node/README.md +15 -0
  21. package/node_modules/@types/node/assert/strict.d.ts +111 -0
  22. package/node_modules/@types/node/assert.d.ts +1115 -0
  23. package/node_modules/@types/node/async_hooks.d.ts +619 -0
  24. package/node_modules/@types/node/buffer.buffer.d.ts +477 -0
  25. package/node_modules/@types/node/buffer.d.ts +1941 -0
  26. package/node_modules/@types/node/child_process.d.ts +1480 -0
  27. package/node_modules/@types/node/cluster.d.ts +578 -0
  28. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  29. package/node_modules/@types/node/console.d.ts +453 -0
  30. package/node_modules/@types/node/constants.d.ts +21 -0
  31. package/node_modules/@types/node/crypto.d.ts +5484 -0
  32. package/node_modules/@types/node/dgram.d.ts +715 -0
  33. package/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
  34. package/node_modules/@types/node/dns/promises.d.ts +503 -0
  35. package/node_modules/@types/node/dns.d.ts +923 -0
  36. package/node_modules/@types/node/domain.d.ts +166 -0
  37. package/node_modules/@types/node/events.d.ts +967 -0
  38. package/node_modules/@types/node/fs/promises.d.ts +1354 -0
  39. package/node_modules/@types/node/fs.d.ts +4777 -0
  40. package/node_modules/@types/node/globals.d.ts +170 -0
  41. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  42. package/node_modules/@types/node/http.d.ts +2246 -0
  43. package/node_modules/@types/node/http2.d.ts +2882 -0
  44. package/node_modules/@types/node/https.d.ts +585 -0
  45. package/node_modules/@types/node/index.d.ts +101 -0
  46. package/node_modules/@types/node/inspector.d.ts +323 -0
  47. package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  48. package/node_modules/@types/node/module.d.ts +844 -0
  49. package/node_modules/@types/node/net.d.ts +1197 -0
  50. package/node_modules/@types/node/os.d.ts +507 -0
  51. package/node_modules/@types/node/package.json +140 -0
  52. package/node_modules/@types/node/path.d.ts +200 -0
  53. package/node_modules/@types/node/perf_hooks.d.ts +1054 -0
  54. package/node_modules/@types/node/process.d.ts +2101 -0
  55. package/node_modules/@types/node/punycode.d.ts +117 -0
  56. package/node_modules/@types/node/querystring.d.ts +152 -0
  57. package/node_modules/@types/node/readline/promises.d.ts +161 -0
  58. package/node_modules/@types/node/readline.d.ts +600 -0
  59. package/node_modules/@types/node/repl.d.ts +438 -0
  60. package/node_modules/@types/node/sea.d.ts +162 -0
  61. package/node_modules/@types/node/sqlite.d.ts +1182 -0
  62. package/node_modules/@types/node/stream/consumers.d.ts +45 -0
  63. package/node_modules/@types/node/stream/promises.d.ts +90 -0
  64. package/node_modules/@types/node/stream/web.d.ts +596 -0
  65. package/node_modules/@types/node/stream.d.ts +1707 -0
  66. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  67. package/node_modules/@types/node/test.d.ts +2656 -0
  68. package/node_modules/@types/node/timers/promises.d.ts +108 -0
  69. package/node_modules/@types/node/timers.d.ts +285 -0
  70. package/node_modules/@types/node/tls.d.ts +1314 -0
  71. package/node_modules/@types/node/trace_events.d.ts +197 -0
  72. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +473 -0
  73. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  74. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  75. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  76. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  77. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  78. package/node_modules/@types/node/tty.d.ts +209 -0
  79. package/node_modules/@types/node/url.d.ts +1103 -0
  80. package/node_modules/@types/node/util.d.ts +2376 -0
  81. package/node_modules/@types/node/v8.d.ts +1010 -0
  82. package/node_modules/@types/node/vm.d.ts +1160 -0
  83. package/node_modules/@types/node/wasi.d.ts +202 -0
  84. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  85. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  86. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  87. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  88. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  89. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  90. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  91. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  92. package/node_modules/@types/node/worker_threads.d.ts +894 -0
  93. package/node_modules/@types/node/zlib.d.ts +768 -0
  94. package/node_modules/@valibot/to-json-schema/LICENSE.md +9 -0
  95. package/node_modules/@valibot/to-json-schema/README.md +475 -0
  96. package/node_modules/@valibot/to-json-schema/dist/index.cjs +800 -0
  97. package/node_modules/@valibot/to-json-schema/dist/index.d.cts +991 -0
  98. package/node_modules/@valibot/to-json-schema/dist/index.d.mts +991 -0
  99. package/node_modules/@valibot/to-json-schema/dist/index.min.cjs +1 -0
  100. package/node_modules/@valibot/to-json-schema/dist/index.min.mjs +1 -0
  101. package/node_modules/@valibot/to-json-schema/dist/index.mjs +795 -0
  102. package/node_modules/@valibot/to-json-schema/package.json +75 -0
  103. package/node_modules/@ykdz/cli-contract/LICENSE +21 -0
  104. package/node_modules/@ykdz/cli-contract/dist/atomic-variant-compiler.d.ts +17 -0
  105. package/node_modules/@ykdz/cli-contract/dist/atomic-variant-compiler.js +55 -0
  106. package/node_modules/@ykdz/cli-contract/dist/cli-contract.d.ts +1164 -0
  107. package/node_modules/@ykdz/cli-contract/dist/cli-contract.js +1408 -0
  108. package/node_modules/@ykdz/cli-contract/dist/cli-execution.d.ts +54 -0
  109. package/node_modules/@ykdz/cli-contract/dist/cli-execution.js +708 -0
  110. package/node_modules/@ykdz/cli-contract/dist/cli-invocation.d.ts +174 -0
  111. package/node_modules/@ykdz/cli-contract/dist/cli-invocation.js +524 -0
  112. package/node_modules/@ykdz/cli-contract/dist/cli-write-error.d.ts +10 -0
  113. package/node_modules/@ykdz/cli-contract/dist/cli-write-error.js +14 -0
  114. package/node_modules/@ykdz/cli-contract/dist/contract-definition-error.d.ts +260 -0
  115. package/node_modules/@ykdz/cli-contract/dist/contract-definition-error.js +130 -0
  116. package/node_modules/@ykdz/cli-contract/dist/contract-execution-error.d.ts +63 -0
  117. package/node_modules/@ykdz/cli-contract/dist/contract-execution-error.js +17 -0
  118. package/node_modules/@ykdz/cli-contract/dist/contract-schema-compiler.d.ts +6 -0
  119. package/node_modules/@ykdz/cli-contract/dist/contract-schema-compiler.js +532 -0
  120. package/node_modules/@ykdz/cli-contract/dist/contract-schema.d.ts +14 -0
  121. package/node_modules/@ykdz/cli-contract/dist/contract-schema.js +1 -0
  122. package/node_modules/@ykdz/cli-contract/dist/description.d.ts +2 -0
  123. package/node_modules/@ykdz/cli-contract/dist/description.js +13 -0
  124. package/node_modules/@ykdz/cli-contract/dist/index.d.ts +8 -0
  125. package/node_modules/@ykdz/cli-contract/dist/index.js +7 -0
  126. package/node_modules/@ykdz/cli-contract/dist/json-value.d.ts +4 -0
  127. package/node_modules/@ykdz/cli-contract/dist/json-value.js +64 -0
  128. package/node_modules/@ykdz/cli-contract/dist/node.d.ts +21 -0
  129. package/node_modules/@ykdz/cli-contract/dist/node.js +109 -0
  130. package/node_modules/@ykdz/cli-contract/dist/outcome-fact.d.ts +162 -0
  131. package/node_modules/@ykdz/cli-contract/dist/outcome-fact.js +113 -0
  132. package/node_modules/@ykdz/cli-contract/dist/outcome-wire.d.ts +53 -0
  133. package/node_modules/@ykdz/cli-contract/dist/outcome-wire.js +189 -0
  134. package/node_modules/@ykdz/cli-contract/dist/stream-variant-compiler.d.ts +16 -0
  135. package/node_modules/@ykdz/cli-contract/dist/stream-variant-compiler.js +45 -0
  136. package/node_modules/@ykdz/cli-contract/package.json +69 -0
  137. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +20 -0
  138. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +38 -2
  139. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.d.ts +19 -0
  140. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.js +1 -1
  141. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +2 -1
  142. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +2 -1
  143. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.js +9 -5
  144. package/node_modules/@ykdz/template-builtin-presets/package.json +2 -1
  145. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/AGENTS.md.template +5 -3
  146. package/node_modules/@ykdz/template-builtin-presets/templates/{shared/devcontainer/node-pnpm.Dockerfile → foundation/devcontainer/base.Dockerfile} +14 -1
  147. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/devcontainer/rust.Dockerfile +1 -5
  148. package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/github-cli.Dockerfile +1 -3
  149. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/artifact.ts +128 -59
  150. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/handoff.ts +80 -8
  151. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/readiness.ts +7 -3
  152. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli.ts +9 -19
  153. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/main.ts +144 -60
  154. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/standard-schema.ts +37 -0
  155. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/lookup.journey.ts +71 -0
  156. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/integration/command.test.ts +118 -59
  157. package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +0 -1
  158. package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +0 -19
  159. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +3 -2
  160. package/node_modules/@ykdz/template-core/dist/project-blueprint.d.ts +15 -0
  161. package/node_modules/@ykdz/template-core/dist/project-blueprint.js +1 -1
  162. package/node_modules/@ykdz/template-core/dist/project-github.d.ts +0 -59
  163. package/node_modules/@ykdz/template-core/dist/project-github.js +0 -67
  164. package/node_modules/undici-types/LICENSE +21 -0
  165. package/node_modules/undici-types/README.md +6 -0
  166. package/node_modules/undici-types/agent.d.ts +32 -0
  167. package/node_modules/undici-types/api.d.ts +43 -0
  168. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  169. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  170. package/node_modules/undici-types/cache.d.ts +36 -0
  171. package/node_modules/undici-types/client-stats.d.ts +15 -0
  172. package/node_modules/undici-types/client.d.ts +123 -0
  173. package/node_modules/undici-types/connector.d.ts +36 -0
  174. package/node_modules/undici-types/content-type.d.ts +21 -0
  175. package/node_modules/undici-types/cookies.d.ts +30 -0
  176. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  177. package/node_modules/undici-types/dispatcher.d.ts +279 -0
  178. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  179. package/node_modules/undici-types/errors.d.ts +177 -0
  180. package/node_modules/undici-types/eventsource.d.ts +66 -0
  181. package/node_modules/undici-types/fetch.d.ts +211 -0
  182. package/node_modules/undici-types/formdata.d.ts +108 -0
  183. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  184. package/node_modules/undici-types/global-origin.d.ts +7 -0
  185. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  186. package/node_modules/undici-types/handlers.d.ts +15 -0
  187. package/node_modules/undici-types/header.d.ts +160 -0
  188. package/node_modules/undici-types/index.d.ts +91 -0
  189. package/node_modules/undici-types/interceptors.d.ts +80 -0
  190. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  191. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  192. package/node_modules/undici-types/mock-client.d.ts +27 -0
  193. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  194. package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  195. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  196. package/node_modules/undici-types/package.json +55 -0
  197. package/node_modules/undici-types/patch.d.ts +29 -0
  198. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  199. package/node_modules/undici-types/pool.d.ts +41 -0
  200. package/node_modules/undici-types/proxy-agent.d.ts +29 -0
  201. package/node_modules/undici-types/readable.d.ts +68 -0
  202. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  203. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  204. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  205. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  206. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  207. package/node_modules/undici-types/util.d.ts +18 -0
  208. package/node_modules/undici-types/utility.d.ts +7 -0
  209. package/node_modules/undici-types/webidl.d.ts +347 -0
  210. package/node_modules/undici-types/websocket.d.ts +188 -0
  211. package/package.json +5 -3
  212. package/dist/command-result.d.ts +0 -9
  213. package/dist/command-result.js +0 -231
  214. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/greet.journey.ts +0 -46
  215. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/unit/greet.test.ts +0 -15
  216. package/node_modules/commander/LICENSE +0 -22
  217. package/node_modules/commander/Readme.md +0 -1172
  218. package/node_modules/commander/index.js +0 -21
  219. package/node_modules/commander/lib/argument.js +0 -147
  220. package/node_modules/commander/lib/command.js +0 -2790
  221. package/node_modules/commander/lib/error.js +0 -36
  222. package/node_modules/commander/lib/help.js +0 -731
  223. package/node_modules/commander/lib/option.js +0 -377
  224. package/node_modules/commander/lib/suggestSimilar.js +0 -99
  225. package/node_modules/commander/package-support.json +0 -19
  226. package/node_modules/commander/package.json +0 -64
  227. package/node_modules/commander/typings/index.d.ts +0 -1113
@@ -0,0 +1,585 @@
1
+ /**
2
+ * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
3
+ * separate module.
4
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/https.js)
5
+ */
6
+ declare module "https" {
7
+ import { NonSharedBuffer } from "node:buffer";
8
+ import { Duplex } from "node:stream";
9
+ import * as tls from "node:tls";
10
+ import * as http from "node:http";
11
+ import { URL } from "node:url";
12
+ interface ServerOptions<
13
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
14
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
15
+ > extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
16
+ interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
17
+ checkServerIdentity?:
18
+ | ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
19
+ | undefined;
20
+ rejectUnauthorized?: boolean | undefined; // Defaults to true
21
+ servername?: string | undefined; // SNI TLS Extension
22
+ }
23
+ interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
24
+ maxCachedSessions?: number | undefined;
25
+ }
26
+ /**
27
+ * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
28
+ *
29
+ * Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden to customize
30
+ * how TLS connections are established.
31
+ *
32
+ * > See [`agent.createConnection()`](https://nodejs.org/docs/latest-v24.x/api/http.html#agentcreateconnectionoptions-callback)
33
+ * for details on overriding this method, including asynchronous socket creation with a callback.
34
+ * @since v0.4.5
35
+ */
36
+ class Agent extends http.Agent {
37
+ constructor(options?: AgentOptions);
38
+ options: AgentOptions;
39
+ createConnection(
40
+ options: RequestOptions,
41
+ callback?: (err: Error | null, stream: Duplex) => void,
42
+ ): Duplex | null | undefined;
43
+ getName(options?: RequestOptions): string;
44
+ }
45
+ interface Server<
46
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
47
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
48
+ > extends http.Server<Request, Response> {}
49
+ /**
50
+ * See `http.Server` for more information.
51
+ * @since v0.3.4
52
+ */
53
+ class Server<
54
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
55
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
56
+ > extends tls.Server {
57
+ constructor(requestListener?: http.RequestListener<Request, Response>);
58
+ constructor(
59
+ options: ServerOptions<Request, Response>,
60
+ requestListener?: http.RequestListener<Request, Response>,
61
+ );
62
+ /**
63
+ * Closes all connections connected to this server.
64
+ * @since v18.2.0
65
+ */
66
+ closeAllConnections(): void;
67
+ /**
68
+ * Closes all connections connected to this server which are not sending a request or waiting for a response.
69
+ * @since v18.2.0
70
+ */
71
+ closeIdleConnections(): void;
72
+ addListener(event: string, listener: (...args: any[]) => void): this;
73
+ addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
74
+ addListener(
75
+ event: "newSession",
76
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
77
+ ): this;
78
+ addListener(
79
+ event: "OCSPRequest",
80
+ listener: (
81
+ certificate: NonSharedBuffer,
82
+ issuer: NonSharedBuffer,
83
+ callback: (err: Error | null, resp: Buffer | null) => void,
84
+ ) => void,
85
+ ): this;
86
+ addListener(
87
+ event: "resumeSession",
88
+ listener: (
89
+ sessionId: NonSharedBuffer,
90
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
91
+ ) => void,
92
+ ): this;
93
+ addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
94
+ addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
95
+ addListener(event: "close", listener: () => void): this;
96
+ addListener(event: "connection", listener: (socket: Duplex) => void): this;
97
+ addListener(event: "error", listener: (err: Error) => void): this;
98
+ addListener(event: "listening", listener: () => void): this;
99
+ addListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
100
+ addListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
101
+ addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
102
+ addListener(
103
+ event: "connect",
104
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
105
+ ): this;
106
+ addListener(event: "request", listener: http.RequestListener<Request, Response>): this;
107
+ addListener(
108
+ event: "upgrade",
109
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
110
+ ): this;
111
+ emit(event: string, ...args: any[]): boolean;
112
+ emit(event: "keylog", line: NonSharedBuffer, tlsSocket: tls.TLSSocket): boolean;
113
+ emit(
114
+ event: "newSession",
115
+ sessionId: NonSharedBuffer,
116
+ sessionData: NonSharedBuffer,
117
+ callback: () => void,
118
+ ): boolean;
119
+ emit(
120
+ event: "OCSPRequest",
121
+ certificate: NonSharedBuffer,
122
+ issuer: NonSharedBuffer,
123
+ callback: (err: Error | null, resp: Buffer | null) => void,
124
+ ): boolean;
125
+ emit(
126
+ event: "resumeSession",
127
+ sessionId: NonSharedBuffer,
128
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
129
+ ): boolean;
130
+ emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean;
131
+ emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean;
132
+ emit(event: "close"): boolean;
133
+ emit(event: "connection", socket: Duplex): boolean;
134
+ emit(event: "error", err: Error): boolean;
135
+ emit(event: "listening"): boolean;
136
+ emit(
137
+ event: "checkContinue",
138
+ req: InstanceType<Request>,
139
+ res: InstanceType<Response>,
140
+ ): boolean;
141
+ emit(
142
+ event: "checkExpectation",
143
+ req: InstanceType<Request>,
144
+ res: InstanceType<Response>,
145
+ ): boolean;
146
+ emit(event: "clientError", err: Error, socket: Duplex): boolean;
147
+ emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer): boolean;
148
+ emit(
149
+ event: "request",
150
+ req: InstanceType<Request>,
151
+ res: InstanceType<Response>,
152
+ ): boolean;
153
+ emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer): boolean;
154
+ on(event: string, listener: (...args: any[]) => void): this;
155
+ on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
156
+ on(
157
+ event: "newSession",
158
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
159
+ ): this;
160
+ on(
161
+ event: "OCSPRequest",
162
+ listener: (
163
+ certificate: NonSharedBuffer,
164
+ issuer: NonSharedBuffer,
165
+ callback: (err: Error | null, resp: Buffer | null) => void,
166
+ ) => void,
167
+ ): this;
168
+ on(
169
+ event: "resumeSession",
170
+ listener: (
171
+ sessionId: NonSharedBuffer,
172
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
173
+ ) => void,
174
+ ): this;
175
+ on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
176
+ on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
177
+ on(event: "close", listener: () => void): this;
178
+ on(event: "connection", listener: (socket: Duplex) => void): this;
179
+ on(event: "error", listener: (err: Error) => void): this;
180
+ on(event: "listening", listener: () => void): this;
181
+ on(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
182
+ on(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
183
+ on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
184
+ on(
185
+ event: "connect",
186
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
187
+ ): this;
188
+ on(event: "request", listener: http.RequestListener<Request, Response>): this;
189
+ on(
190
+ event: "upgrade",
191
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
192
+ ): this;
193
+ once(event: string, listener: (...args: any[]) => void): this;
194
+ once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
195
+ once(
196
+ event: "newSession",
197
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
198
+ ): this;
199
+ once(
200
+ event: "OCSPRequest",
201
+ listener: (
202
+ certificate: NonSharedBuffer,
203
+ issuer: NonSharedBuffer,
204
+ callback: (err: Error | null, resp: Buffer | null) => void,
205
+ ) => void,
206
+ ): this;
207
+ once(
208
+ event: "resumeSession",
209
+ listener: (
210
+ sessionId: NonSharedBuffer,
211
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
212
+ ) => void,
213
+ ): this;
214
+ once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
215
+ once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
216
+ once(event: "close", listener: () => void): this;
217
+ once(event: "connection", listener: (socket: Duplex) => void): this;
218
+ once(event: "error", listener: (err: Error) => void): this;
219
+ once(event: "listening", listener: () => void): this;
220
+ once(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
221
+ once(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
222
+ once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
223
+ once(
224
+ event: "connect",
225
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
226
+ ): this;
227
+ once(event: "request", listener: http.RequestListener<Request, Response>): this;
228
+ once(
229
+ event: "upgrade",
230
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
231
+ ): this;
232
+ prependListener(event: string, listener: (...args: any[]) => void): this;
233
+ prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
234
+ prependListener(
235
+ event: "newSession",
236
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
237
+ ): this;
238
+ prependListener(
239
+ event: "OCSPRequest",
240
+ listener: (
241
+ certificate: NonSharedBuffer,
242
+ issuer: NonSharedBuffer,
243
+ callback: (err: Error | null, resp: Buffer | null) => void,
244
+ ) => void,
245
+ ): this;
246
+ prependListener(
247
+ event: "resumeSession",
248
+ listener: (
249
+ sessionId: NonSharedBuffer,
250
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
251
+ ) => void,
252
+ ): this;
253
+ prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
254
+ prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
255
+ prependListener(event: "close", listener: () => void): this;
256
+ prependListener(event: "connection", listener: (socket: Duplex) => void): this;
257
+ prependListener(event: "error", listener: (err: Error) => void): this;
258
+ prependListener(event: "listening", listener: () => void): this;
259
+ prependListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
260
+ prependListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
261
+ prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
262
+ prependListener(
263
+ event: "connect",
264
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
265
+ ): this;
266
+ prependListener(event: "request", listener: http.RequestListener<Request, Response>): this;
267
+ prependListener(
268
+ event: "upgrade",
269
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
270
+ ): this;
271
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
272
+ prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
273
+ prependOnceListener(
274
+ event: "newSession",
275
+ listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
276
+ ): this;
277
+ prependOnceListener(
278
+ event: "OCSPRequest",
279
+ listener: (
280
+ certificate: NonSharedBuffer,
281
+ issuer: NonSharedBuffer,
282
+ callback: (err: Error | null, resp: Buffer | null) => void,
283
+ ) => void,
284
+ ): this;
285
+ prependOnceListener(
286
+ event: "resumeSession",
287
+ listener: (
288
+ sessionId: NonSharedBuffer,
289
+ callback: (err: Error | null, sessionData: Buffer | null) => void,
290
+ ) => void,
291
+ ): this;
292
+ prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
293
+ prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
294
+ prependOnceListener(event: "close", listener: () => void): this;
295
+ prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this;
296
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
297
+ prependOnceListener(event: "listening", listener: () => void): this;
298
+ prependOnceListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
299
+ prependOnceListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
300
+ prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
301
+ prependOnceListener(
302
+ event: "connect",
303
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
304
+ ): this;
305
+ prependOnceListener(event: "request", listener: http.RequestListener<Request, Response>): this;
306
+ prependOnceListener(
307
+ event: "upgrade",
308
+ listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
309
+ ): this;
310
+ }
311
+ /**
312
+ * ```js
313
+ * // curl -k https://localhost:8000/
314
+ * import https from 'node:https';
315
+ * import fs from 'node:fs';
316
+ *
317
+ * const options = {
318
+ * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
319
+ * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
320
+ * };
321
+ *
322
+ * https.createServer(options, (req, res) => {
323
+ * res.writeHead(200);
324
+ * res.end('hello world\n');
325
+ * }).listen(8000);
326
+ * ```
327
+ *
328
+ * Or
329
+ *
330
+ * ```js
331
+ * import https from 'node:https';
332
+ * import fs from 'node:fs';
333
+ *
334
+ * const options = {
335
+ * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
336
+ * passphrase: 'sample',
337
+ * };
338
+ *
339
+ * https.createServer(options, (req, res) => {
340
+ * res.writeHead(200);
341
+ * res.end('hello world\n');
342
+ * }).listen(8000);
343
+ * ```
344
+ * @since v0.3.4
345
+ * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`.
346
+ * @param requestListener A listener to be added to the `'request'` event.
347
+ */
348
+ function createServer<
349
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
350
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
351
+ >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
352
+ function createServer<
353
+ Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
354
+ Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
355
+ >(
356
+ options: ServerOptions<Request, Response>,
357
+ requestListener?: http.RequestListener<Request, Response>,
358
+ ): Server<Request, Response>;
359
+ /**
360
+ * Makes a request to a secure web server.
361
+ *
362
+ * The following additional `options` from `tls.connect()` are also accepted: `ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`, `honorCipherOrder`, `key`, `passphrase`,
363
+ * `pfx`, `rejectUnauthorized`, `secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`, `highWaterMark`.
364
+ *
365
+ * `options` can be an object, a string, or a `URL` object. If `options` is a
366
+ * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
367
+ *
368
+ * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to
369
+ * upload a file with a POST request, then write to the `ClientRequest` object.
370
+ *
371
+ * ```js
372
+ * import https from 'node:https';
373
+ *
374
+ * const options = {
375
+ * hostname: 'encrypted.google.com',
376
+ * port: 443,
377
+ * path: '/',
378
+ * method: 'GET',
379
+ * };
380
+ *
381
+ * const req = https.request(options, (res) => {
382
+ * console.log('statusCode:', res.statusCode);
383
+ * console.log('headers:', res.headers);
384
+ *
385
+ * res.on('data', (d) => {
386
+ * process.stdout.write(d);
387
+ * });
388
+ * });
389
+ *
390
+ * req.on('error', (e) => {
391
+ * console.error(e);
392
+ * });
393
+ * req.end();
394
+ * ```
395
+ *
396
+ * Example using options from `tls.connect()`:
397
+ *
398
+ * ```js
399
+ * const options = {
400
+ * hostname: 'encrypted.google.com',
401
+ * port: 443,
402
+ * path: '/',
403
+ * method: 'GET',
404
+ * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
405
+ * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
406
+ * };
407
+ * options.agent = new https.Agent(options);
408
+ *
409
+ * const req = https.request(options, (res) => {
410
+ * // ...
411
+ * });
412
+ * ```
413
+ *
414
+ * Alternatively, opt out of connection pooling by not using an `Agent`.
415
+ *
416
+ * ```js
417
+ * const options = {
418
+ * hostname: 'encrypted.google.com',
419
+ * port: 443,
420
+ * path: '/',
421
+ * method: 'GET',
422
+ * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
423
+ * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
424
+ * agent: false,
425
+ * };
426
+ *
427
+ * const req = https.request(options, (res) => {
428
+ * // ...
429
+ * });
430
+ * ```
431
+ *
432
+ * Example using a `URL` as `options`:
433
+ *
434
+ * ```js
435
+ * const options = new URL('https://abc:xyz@example.com');
436
+ *
437
+ * const req = https.request(options, (res) => {
438
+ * // ...
439
+ * });
440
+ * ```
441
+ *
442
+ * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
443
+ *
444
+ * ```js
445
+ * import tls from 'node:tls';
446
+ * import https from 'node:https';
447
+ * import crypto from 'node:crypto';
448
+ *
449
+ * function sha256(s) {
450
+ * return crypto.createHash('sha256').update(s).digest('base64');
451
+ * }
452
+ * const options = {
453
+ * hostname: 'github.com',
454
+ * port: 443,
455
+ * path: '/',
456
+ * method: 'GET',
457
+ * checkServerIdentity: function(host, cert) {
458
+ * // Make sure the certificate is issued to the host we are connected to
459
+ * const err = tls.checkServerIdentity(host, cert);
460
+ * if (err) {
461
+ * return err;
462
+ * }
463
+ *
464
+ * // Pin the public key, similar to HPKP pin-sha256 pinning
465
+ * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
466
+ * if (sha256(cert.pubkey) !== pubkey256) {
467
+ * const msg = 'Certificate verification error: ' +
468
+ * `The public key of '${cert.subject.CN}' ` +
469
+ * 'does not match our pinned fingerprint';
470
+ * return new Error(msg);
471
+ * }
472
+ *
473
+ * // Pin the exact certificate, rather than the pub key
474
+ * const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' +
475
+ * 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16';
476
+ * if (cert.fingerprint256 !== cert256) {
477
+ * const msg = 'Certificate verification error: ' +
478
+ * `The certificate of '${cert.subject.CN}' ` +
479
+ * 'does not match our pinned fingerprint';
480
+ * return new Error(msg);
481
+ * }
482
+ *
483
+ * // This loop is informational only.
484
+ * // Print the certificate and public key fingerprints of all certs in the
485
+ * // chain. Its common to pin the public key of the issuer on the public
486
+ * // internet, while pinning the public key of the service in sensitive
487
+ * // environments.
488
+ * do {
489
+ * console.log('Subject Common Name:', cert.subject.CN);
490
+ * console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256);
491
+ *
492
+ * hash = crypto.createHash('sha256');
493
+ * console.log(' Public key ping-sha256:', sha256(cert.pubkey));
494
+ *
495
+ * lastprint256 = cert.fingerprint256;
496
+ * cert = cert.issuerCertificate;
497
+ * } while (cert.fingerprint256 !== lastprint256);
498
+ *
499
+ * },
500
+ * };
501
+ *
502
+ * options.agent = new https.Agent(options);
503
+ * const req = https.request(options, (res) => {
504
+ * console.log('All OK. Server matched our pinned cert or public key');
505
+ * console.log('statusCode:', res.statusCode);
506
+ * // Print the HPKP values
507
+ * console.log('headers:', res.headers['public-key-pins']);
508
+ *
509
+ * res.on('data', (d) => {});
510
+ * });
511
+ *
512
+ * req.on('error', (e) => {
513
+ * console.error(e.message);
514
+ * });
515
+ * req.end();
516
+ * ```
517
+ *
518
+ * Outputs for example:
519
+ *
520
+ * ```text
521
+ * Subject Common Name: github.com
522
+ * Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16
523
+ * Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=
524
+ * Subject Common Name: DigiCert SHA2 Extended Validation Server CA
525
+ * Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A
526
+ * Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=
527
+ * Subject Common Name: DigiCert High Assurance EV Root CA
528
+ * Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF
529
+ * Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18=
530
+ * All OK. Server matched our pinned cert or public key
531
+ * statusCode: 200
532
+ * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=";
533
+ * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4=";
534
+ * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains
535
+ * ```
536
+ * @since v0.3.6
537
+ * @param options Accepts all `options` from `request`, with some differences in default values:
538
+ */
539
+ function request(
540
+ options: RequestOptions | string | URL,
541
+ callback?: (res: http.IncomingMessage) => void,
542
+ ): http.ClientRequest;
543
+ function request(
544
+ url: string | URL,
545
+ options: RequestOptions,
546
+ callback?: (res: http.IncomingMessage) => void,
547
+ ): http.ClientRequest;
548
+ /**
549
+ * Like `http.get()` but for HTTPS.
550
+ *
551
+ * `options` can be an object, a string, or a `URL` object. If `options` is a
552
+ * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
553
+ *
554
+ * ```js
555
+ * import https from 'node:https';
556
+ *
557
+ * https.get('https://encrypted.google.com/', (res) => {
558
+ * console.log('statusCode:', res.statusCode);
559
+ * console.log('headers:', res.headers);
560
+ *
561
+ * res.on('data', (d) => {
562
+ * process.stdout.write(d);
563
+ * });
564
+ *
565
+ * }).on('error', (e) => {
566
+ * console.error(e);
567
+ * });
568
+ * ```
569
+ * @since v0.3.6
570
+ * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`.
571
+ */
572
+ function get(
573
+ options: RequestOptions | string | URL,
574
+ callback?: (res: http.IncomingMessage) => void,
575
+ ): http.ClientRequest;
576
+ function get(
577
+ url: string | URL,
578
+ options: RequestOptions,
579
+ callback?: (res: http.IncomingMessage) => void,
580
+ ): http.ClientRequest;
581
+ let globalAgent: Agent;
582
+ }
583
+ declare module "node:https" {
584
+ export * from "https";
585
+ }