|
1 |
| -/* tslint:disable */ |
2 |
| -/* eslint-disable */ |
3 |
| - |
4 | 1 | /* auto-generated by NAPI-RS */
|
5 |
| - |
6 |
| -export interface PhpRequestSocketOptions { |
7 |
| - /** The string representation of the local IP address the remote client is connecting on. */ |
8 |
| - localAddress: string |
9 |
| - /** The numeric representation of the local port. For example, 80 or 21. */ |
10 |
| - localPort: number |
11 |
| - /** The string representation of the remote IP address. */ |
12 |
| - remoteAddress: string |
13 |
| - /** The numeric representation of the remote port. For example, 80 or 21. */ |
14 |
| - remotePort: number |
15 |
| -} |
16 |
| -/** Options for creating a new PHP request. */ |
17 |
| -export interface PhpRequestOptions { |
18 |
| - /** The HTTP method for the request. */ |
19 |
| - method?: string |
20 |
| - /** The URL for the request. */ |
21 |
| - url: string |
22 |
| - /** |
23 |
| - * The headers for the request. |
24 |
| - * TODO: Figure out how to accept a Headers instance |
25 |
| - * TODO: Figure out how to support both single values without array wrap |
26 |
| - */ |
27 |
| - headers?: Record<string, Array<string>> |
28 |
| - /** The body for the request. */ |
29 |
| - body?: Uint8Array |
30 |
| - /** The socket information for the request. */ |
31 |
| - socket?: PhpRequestSocketOptions |
32 |
| -} |
33 |
| -/** Options for creating a new PHP response. */ |
34 |
| -export interface PhpResponseOptions { |
35 |
| - /** The HTTP status code for the response. */ |
36 |
| - status?: number |
37 |
| - /** |
38 |
| - * The headers for the response. |
39 |
| - * TODO: Figure out how to accept a Headers instance |
40 |
| - * TODO: Figure out how to support both single values without array wrap |
41 |
| - */ |
42 |
| - headers?: Record<string, Array<string>> |
43 |
| - /** The body for the response. */ |
44 |
| - body?: Uint8Array |
45 |
| - /** The log for the response. */ |
46 |
| - log?: Uint8Array |
47 |
| - /** The exception for the response. */ |
48 |
| - exception?: string |
49 |
| -} |
50 |
| -/** Options for creating a new PHP instance. */ |
51 |
| -export interface PhpOptions { |
52 |
| - /** The command-line arguments for the PHP instance. */ |
53 |
| - argv?: Array<string> |
54 |
| - /** The document root for the PHP instance. */ |
55 |
| - docroot?: string |
56 |
| - /** Throw request errors */ |
57 |
| - throwRequestErrors?: boolean |
58 |
| -} |
59 |
| -undefinedundefined |
60 |
| -export type PhpHeaders = Headers |
| 2 | +/* eslint-disable */ |
61 | 3 | /**
|
62 | 4 | * A multi-map of HTTP headers.
|
63 | 5 | *
|
@@ -273,7 +215,86 @@ export declare class Headers {
|
273 | 215 | */
|
274 | 216 | forEach(this: this, callback: (arg0: string, arg1: string, arg2: this) => void): void
|
275 | 217 | }
|
276 |
| -export type PhpRequest = Request |
| 218 | +export type PhpHeaders = Headers |
| 219 | + |
| 220 | +/** |
| 221 | + * A PHP instance. |
| 222 | + * |
| 223 | + * # Examples |
| 224 | + * |
| 225 | + * ```js |
| 226 | + * const php = new Php({ |
| 227 | + * code: 'echo "Hello, world!";' |
| 228 | + * }); |
| 229 | + * |
| 230 | + * const response = php.handleRequest(new Request({ |
| 231 | + * method: 'GET', |
| 232 | + * url: 'http://example.com' |
| 233 | + * })); |
| 234 | + * |
| 235 | + * console.log(response.status); |
| 236 | + * console.log(response.body); |
| 237 | + * ``` |
| 238 | + */ |
| 239 | +export declare class Php { |
| 240 | + /** |
| 241 | + * Create a new PHP instance. |
| 242 | + * |
| 243 | + * # Examples |
| 244 | + * |
| 245 | + * ```js |
| 246 | + * const php = new Php({ |
| 247 | + * docroot: process.cwd(), |
| 248 | + * argv: process.argv |
| 249 | + * }); |
| 250 | + * ``` |
| 251 | + */ |
| 252 | + constructor(options?: PhpOptions | undefined | null) |
| 253 | + /** |
| 254 | + * Handle a PHP request. |
| 255 | + * |
| 256 | + * # Examples |
| 257 | + * |
| 258 | + * ```js |
| 259 | + * const php = new Php({ |
| 260 | + * docroot: process.cwd(), |
| 261 | + * argv: process.argv |
| 262 | + * }); |
| 263 | + * |
| 264 | + * const response = php.handleRequest(new Request({ |
| 265 | + * method: 'GET', |
| 266 | + * url: 'http://example.com' |
| 267 | + * })); |
| 268 | + * |
| 269 | + * console.log(response.status); |
| 270 | + * console.log(response.body); |
| 271 | + * ``` |
| 272 | + */ |
| 273 | + handleRequest(request: Request, signal?: AbortSignal | undefined | null): Promise<unknown> |
| 274 | + /** |
| 275 | + * Handle a PHP request synchronously. |
| 276 | + * |
| 277 | + * # Examples |
| 278 | + * |
| 279 | + * ```js |
| 280 | + * const php = new Php({ |
| 281 | + * docroot: process.cwd(), |
| 282 | + * argv: process.argv |
| 283 | + * }); |
| 284 | + * |
| 285 | + * const response = php.handleRequestSync(new Request({ |
| 286 | + * method: 'GET', |
| 287 | + * url: 'http://example.com' |
| 288 | + * })); |
| 289 | + * |
| 290 | + * console.log(response.status); |
| 291 | + * console.log(response.body); |
| 292 | + * ``` |
| 293 | + */ |
| 294 | + handleRequestSync(request: Request): Response |
| 295 | +} |
| 296 | +export type PhpRuntime = Php |
| 297 | + |
277 | 298 | /**
|
278 | 299 | * A PHP request.
|
279 | 300 | *
|
@@ -369,7 +390,8 @@ export declare class Request {
|
369 | 390 | */
|
370 | 391 | get body(): Buffer
|
371 | 392 | }
|
372 |
| -export type PhpResponse = Response |
| 393 | +export type PhpRequest = Request |
| 394 | + |
373 | 395 | /** A PHP response. */
|
374 | 396 | export declare class Response {
|
375 | 397 | /**
|
@@ -463,80 +485,61 @@ export declare class Response {
|
463 | 485 | */
|
464 | 486 | get exception(): string | null
|
465 | 487 | }
|
466 |
| -export type PhpRuntime = Php |
467 |
| -/** |
468 |
| - * A PHP instance. |
469 |
| - * |
470 |
| - * # Examples |
471 |
| - * |
472 |
| - * ```js |
473 |
| - * const php = new Php({ |
474 |
| - * code: 'echo "Hello, world!";' |
475 |
| - * }); |
476 |
| - * |
477 |
| - * const response = php.handleRequest(new Request({ |
478 |
| - * method: 'GET', |
479 |
| - * url: 'http://example.com' |
480 |
| - * })); |
481 |
| - * |
482 |
| - * console.log(response.status); |
483 |
| - * console.log(response.body); |
484 |
| - * ``` |
485 |
| - */ |
486 |
| -export declare class Php { |
487 |
| - /** |
488 |
| - * Create a new PHP instance. |
489 |
| - * |
490 |
| - * # Examples |
491 |
| - * |
492 |
| - * ```js |
493 |
| - * const php = new Php({ |
494 |
| - * docroot: process.cwd(), |
495 |
| - * argv: process.argv |
496 |
| - * }); |
497 |
| - * ``` |
498 |
| - */ |
499 |
| - constructor(options?: PhpOptions | undefined | null) |
| 488 | +export type PhpResponse = Response |
| 489 | + |
| 490 | +/** Options for creating a new PHP instance. */ |
| 491 | +export interface PhpOptions { |
| 492 | + /** The command-line arguments for the PHP instance. */ |
| 493 | + argv?: Array<string> |
| 494 | + /** The document root for the PHP instance. */ |
| 495 | + docroot?: string |
| 496 | + /** Throw request errors */ |
| 497 | + throwRequestErrors?: boolean |
| 498 | +} |
| 499 | + |
| 500 | +/** Options for creating a new PHP request. */ |
| 501 | +export interface PhpRequestOptions { |
| 502 | + /** The HTTP method for the request. */ |
| 503 | + method?: string |
| 504 | + /** The URL for the request. */ |
| 505 | + url: string |
500 | 506 | /**
|
501 |
| - * Handle a PHP request. |
502 |
| - * |
503 |
| - * # Examples |
504 |
| - * |
505 |
| - * ```js |
506 |
| - * const php = new Php({ |
507 |
| - * docroot: process.cwd(), |
508 |
| - * argv: process.argv |
509 |
| - * }); |
510 |
| - * |
511 |
| - * const response = php.handleRequest(new Request({ |
512 |
| - * method: 'GET', |
513 |
| - * url: 'http://example.com' |
514 |
| - * })); |
515 |
| - * |
516 |
| - * console.log(response.status); |
517 |
| - * console.log(response.body); |
518 |
| - * ``` |
| 507 | + * The headers for the request. |
| 508 | + * TODO: Figure out how to accept a Headers instance |
| 509 | + * TODO: Figure out how to support both single values without array wrap |
519 | 510 | */
|
520 |
| - handleRequest(request: Request, signal?: AbortSignal | undefined | null): Promise<unknown> |
| 511 | + headers?: Record<string, Array<string>> |
| 512 | + /** The body for the request. */ |
| 513 | + body?: Uint8Array |
| 514 | + /** The socket information for the request. */ |
| 515 | + socket?: PhpRequestSocketOptions |
| 516 | +} |
| 517 | + |
| 518 | +export interface PhpRequestSocketOptions { |
| 519 | + /** The string representation of the local IP address the remote client is connecting on. */ |
| 520 | + localAddress: string |
| 521 | + /** The numeric representation of the local port. For example, 80 or 21. */ |
| 522 | + localPort: number |
| 523 | + /** The string representation of the remote IP address. */ |
| 524 | + remoteAddress: string |
| 525 | + /** The numeric representation of the remote port. For example, 80 or 21. */ |
| 526 | + remotePort: number |
| 527 | +} |
| 528 | + |
| 529 | +/** Options for creating a new PHP response. */ |
| 530 | +export interface PhpResponseOptions { |
| 531 | + /** The HTTP status code for the response. */ |
| 532 | + status?: number |
521 | 533 | /**
|
522 |
| - * Handle a PHP request synchronously. |
523 |
| - * |
524 |
| - * # Examples |
525 |
| - * |
526 |
| - * ```js |
527 |
| - * const php = new Php({ |
528 |
| - * docroot: process.cwd(), |
529 |
| - * argv: process.argv |
530 |
| - * }); |
531 |
| - * |
532 |
| - * const response = php.handleRequestSync(new Request({ |
533 |
| - * method: 'GET', |
534 |
| - * url: 'http://example.com' |
535 |
| - * })); |
536 |
| - * |
537 |
| - * console.log(response.status); |
538 |
| - * console.log(response.body); |
539 |
| - * ``` |
| 534 | + * The headers for the response. |
| 535 | + * TODO: Figure out how to accept a Headers instance |
| 536 | + * TODO: Figure out how to support both single values without array wrap |
540 | 537 | */
|
541 |
| - handleRequestSync(request: Request): Response |
| 538 | + headers?: Record<string, Array<string>> |
| 539 | + /** The body for the response. */ |
| 540 | + body?: Uint8Array |
| 541 | + /** The log for the response. */ |
| 542 | + log?: Uint8Array |
| 543 | + /** The exception for the response. */ |
| 544 | + exception?: string |
542 | 545 | }
|
0 commit comments