|
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 local IP family, e.g., "IPv4" or "IPv6". */ |
12 | | - localFamily: string |
13 | | - /** The string representation of the remote IP address. */ |
14 | | - remoteAddress: string |
15 | | - /** The numeric representation of the remote port. For example, 80 or 21. */ |
16 | | - remotePort: number |
17 | | - /** The string representation of the remote IP family, e.g., "IPv4" or "IPv6". */ |
18 | | - remoteFamily: string |
19 | | -} |
20 | | -/** Options for creating a new PHP request. */ |
21 | | -export interface PhpRequestOptions { |
22 | | - /** The HTTP method for the request. */ |
23 | | - method?: string |
24 | | - /** The URL for the request. */ |
25 | | - url: string |
26 | | - /** The headers for the request. */ |
27 | | - headers?: Headers |
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 | | - /** The headers for the response. */ |
38 | | - headers?: Headers |
39 | | - /** The body for the response. */ |
40 | | - body?: Uint8Array |
41 | | - /** The log for the response. */ |
42 | | - log?: Uint8Array |
43 | | - /** The exception for the response. */ |
44 | | - exception?: string |
45 | | -} |
46 | | -export interface PhpRewriteCondOptions { |
47 | | - type: string |
48 | | - args?: Array<string> |
49 | | -} |
50 | | -export interface PhpRewriterOptions { |
51 | | - type: string |
52 | | - args: Array<string> |
53 | | -} |
54 | | -export interface PhpConditionalRewriterOptions { |
55 | | - operation?: string |
56 | | - conditions?: Array<PhpRewriteCondOptions> |
57 | | - rewriters: Array<PhpRewriterOptions> |
58 | | -} |
59 | | -/** Options for creating a new PHP instance. */ |
60 | | -export interface PhpOptions { |
61 | | - /** The command-line arguments for the PHP instance. */ |
62 | | - argv?: Array<string> |
63 | | - /** The document root for the PHP instance. */ |
64 | | - docroot?: string |
65 | | - /** Throw request errors */ |
66 | | - throwRequestErrors?: boolean |
67 | | - /** Request rewriter */ |
68 | | - rewriter?: Rewriter |
69 | | -} |
70 | | -export type PhpHeaders = Headers |
| 2 | +/* eslint-disable */ |
71 | 3 | /** |
72 | 4 | * A multi-map of HTTP headers. |
73 | 5 | * |
@@ -233,7 +165,7 @@ export declare class Headers { |
233 | 165 | * } |
234 | 166 | * ``` |
235 | 167 | */ |
236 | | - entries(): Array<Entry> |
| 168 | + entries(): Array<Entry<string, string>> |
237 | 169 | /** |
238 | 170 | * Get an iterator over the header keys. |
239 | 171 | * |
@@ -283,7 +215,86 @@ export declare class Headers { |
283 | 215 | */ |
284 | 216 | forEach(this: this, callback: (arg0: string, arg1: string, arg2: this) => void): void |
285 | 217 | } |
286 | | -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 | + |
287 | 298 | /** |
288 | 299 | * A PHP request. |
289 | 300 | * |
@@ -379,7 +390,8 @@ export declare class Request { |
379 | 390 | */ |
380 | 391 | get body(): Buffer |
381 | 392 | } |
382 | | -export type PhpResponse = Response |
| 393 | +export type PhpRequest = Request |
| 394 | + |
383 | 395 | /** A PHP response. */ |
384 | 396 | export declare class Response { |
385 | 397 | /** |
@@ -473,85 +485,81 @@ export declare class Response { |
473 | 485 | */ |
474 | 486 | get exception(): string | null |
475 | 487 | } |
476 | | -export type PhpRewriter = Rewriter |
| 488 | +export type PhpResponse = Response |
| 489 | + |
477 | 490 | export declare class Rewriter { |
478 | 491 | constructor(options: Array<PhpConditionalRewriterOptions>) |
479 | 492 | rewrite(request: Request, docroot: string): Request |
480 | 493 | } |
481 | | -export type PhpRuntime = Php |
482 | | -/** |
483 | | - * A PHP instance. |
484 | | - * |
485 | | - * # Examples |
486 | | - * |
487 | | - * ```js |
488 | | - * const php = new Php({ |
489 | | - * code: 'echo "Hello, world!";' |
490 | | - * }); |
491 | | - * |
492 | | - * const response = php.handleRequest(new Request({ |
493 | | - * method: 'GET', |
494 | | - * url: 'http://example.com' |
495 | | - * })); |
496 | | - * |
497 | | - * console.log(response.status); |
498 | | - * console.log(response.body); |
499 | | - * ``` |
500 | | - */ |
501 | | -export declare class Php { |
502 | | - /** |
503 | | - * Create a new PHP instance. |
504 | | - * |
505 | | - * # Examples |
506 | | - * |
507 | | - * ```js |
508 | | - * const php = new Php({ |
509 | | - * docroot: process.cwd(), |
510 | | - * argv: process.argv |
511 | | - * }); |
512 | | - * ``` |
513 | | - */ |
514 | | - constructor(options?: PhpOptions | undefined | null) |
515 | | - /** |
516 | | - * Handle a PHP request. |
517 | | - * |
518 | | - * # Examples |
519 | | - * |
520 | | - * ```js |
521 | | - * const php = new Php({ |
522 | | - * docroot: process.cwd(), |
523 | | - * argv: process.argv |
524 | | - * }); |
525 | | - * |
526 | | - * const response = php.handleRequest(new Request({ |
527 | | - * method: 'GET', |
528 | | - * url: 'http://example.com' |
529 | | - * })); |
530 | | - * |
531 | | - * console.log(response.status); |
532 | | - * console.log(response.body); |
533 | | - * ``` |
534 | | - */ |
535 | | - handleRequest(request: Request, signal?: AbortSignal | undefined | null): Promise<unknown> |
536 | | - /** |
537 | | - * Handle a PHP request synchronously. |
538 | | - * |
539 | | - * # Examples |
540 | | - * |
541 | | - * ```js |
542 | | - * const php = new Php({ |
543 | | - * docroot: process.cwd(), |
544 | | - * argv: process.argv |
545 | | - * }); |
546 | | - * |
547 | | - * const response = php.handleRequestSync(new Request({ |
548 | | - * method: 'GET', |
549 | | - * url: 'http://example.com' |
550 | | - * })); |
551 | | - * |
552 | | - * console.log(response.status); |
553 | | - * console.log(response.body); |
554 | | - * ``` |
555 | | - */ |
556 | | - handleRequestSync(request: Request): Response |
| 494 | +export type PhpRewriter = Rewriter |
| 495 | + |
| 496 | +export interface PhpConditionalRewriterOptions { |
| 497 | + operation?: string |
| 498 | + conditions?: Array<PhpRewriteCondOptions> |
| 499 | + rewriters: Array<PhpRewriterOptions> |
| 500 | +} |
| 501 | + |
| 502 | +/** Options for creating a new PHP instance. */ |
| 503 | +export interface PhpOptions { |
| 504 | + /** The command-line arguments for the PHP instance. */ |
| 505 | + argv?: Array<string> |
| 506 | + /** The document root for the PHP instance. */ |
| 507 | + docroot?: string |
| 508 | + /** Throw request errors */ |
| 509 | + throwRequestErrors?: boolean |
| 510 | + /** Request rewriter */ |
| 511 | + rewriter?: Rewriter |
| 512 | +} |
| 513 | + |
| 514 | +/** Options for creating a new PHP request. */ |
| 515 | +export interface PhpRequestOptions { |
| 516 | + /** The HTTP method for the request. */ |
| 517 | + method?: string |
| 518 | + /** The URL for the request. */ |
| 519 | + url: string |
| 520 | + /** The headers for the request. */ |
| 521 | + headers?: Headers |
| 522 | + /** The body for the request. */ |
| 523 | + body?: Uint8Array |
| 524 | + /** The socket information for the request. */ |
| 525 | + socket?: PhpRequestSocketOptions |
| 526 | +} |
| 527 | + |
| 528 | +export interface PhpRequestSocketOptions { |
| 529 | + /** The string representation of the local IP address the remote client is connecting on. */ |
| 530 | + localAddress: string |
| 531 | + /** The numeric representation of the local port. For example, 80 or 21. */ |
| 532 | + localPort: number |
| 533 | + /** The string representation of the local IP family, e.g., "IPv4" or "IPv6". */ |
| 534 | + localFamily: string |
| 535 | + /** The string representation of the remote IP address. */ |
| 536 | + remoteAddress: string |
| 537 | + /** The numeric representation of the remote port. For example, 80 or 21. */ |
| 538 | + remotePort: number |
| 539 | + /** The string representation of the remote IP family, e.g., "IPv4" or "IPv6". */ |
| 540 | + remoteFamily: string |
| 541 | +} |
| 542 | + |
| 543 | +/** Options for creating a new PHP response. */ |
| 544 | +export interface PhpResponseOptions { |
| 545 | + /** The HTTP status code for the response. */ |
| 546 | + status?: number |
| 547 | + /** The headers for the response. */ |
| 548 | + headers?: Headers |
| 549 | + /** The body for the response. */ |
| 550 | + body?: Uint8Array |
| 551 | + /** The log for the response. */ |
| 552 | + log?: Uint8Array |
| 553 | + /** The exception for the response. */ |
| 554 | + exception?: string |
| 555 | +} |
| 556 | + |
| 557 | +export interface PhpRewriteCondOptions { |
| 558 | + type: string |
| 559 | + args?: Array<string> |
| 560 | +} |
| 561 | + |
| 562 | +export interface PhpRewriterOptions { |
| 563 | + type: string |
| 564 | + args: Array<string> |
557 | 565 | } |
0 commit comments