microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/extension/networkInspector/networkMessageData.ts
81lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | /** |
| 5 | * @preserve |
| 6 | * Start region: the code is borrowed from https://github.com/facebook/flipper/blob/v0.79.1/desktop/plugins/network/types.tsx |
| 7 | * |
| 8 | * Copyright (c) Facebook, Inc. and its affiliates. |
| 9 | * |
| 10 | * This source code is licensed under the MIT license found in the |
| 11 | * LICENSE file in the root directory of this source tree. |
| 12 | * |
| 13 | * @format |
| 14 | */ |
| 15 | |
| 16 | export type ResponseFollowupChunk = { |
| 17 | id: string; |
| 18 | totalChunks: number; |
| 19 | index: number; |
| 20 | data: string; |
| 21 | }; |
| 22 | |
| 23 | export type RequestId = string; |
| 24 | |
| 25 | export type Header = { |
| 26 | key: string; |
| 27 | value: string; |
| 28 | }; |
| 29 | |
| 30 | export type Insights = { |
| 31 | dnsLookupTime: number | null | undefined; |
| 32 | connectTime: number | null | undefined; |
| 33 | sslHandshakeTime: number | null | undefined; |
| 34 | preTransferTime: number | null | undefined; |
| 35 | redirectsTime: number | null | undefined; |
| 36 | timeToFirstByte: number | null | undefined; |
| 37 | transferTime: number | null | undefined; |
| 38 | postProcessingTime: number | null | undefined; |
| 39 | // Amount of transferred data can be different from total size of payload. |
| 40 | bytesTransfered: number | null | undefined; |
| 41 | transferSpeed: number | null | undefined; |
| 42 | retries: RetryInsights | null | undefined; |
| 43 | }; |
| 44 | |
| 45 | export type RetryInsights = { |
| 46 | count: number; |
| 47 | limit: number; |
| 48 | timeSpent: number; |
| 49 | }; |
| 50 | |
| 51 | export type Request = { |
| 52 | id: RequestId; |
| 53 | timestamp: number; |
| 54 | method: string; |
| 55 | url: string; |
| 56 | headers: Array<Header>; |
| 57 | data?: string | null; |
| 58 | }; |
| 59 | |
| 60 | export type Response = { |
| 61 | id: RequestId; |
| 62 | timestamp: number; |
| 63 | status: number; |
| 64 | reason: string; |
| 65 | headers: Array<Header>; |
| 66 | data?: string | null; |
| 67 | isMock: boolean; |
| 68 | insights?: Insights | null; |
| 69 | totalChunks?: number; |
| 70 | index?: number; |
| 71 | }; |
| 72 | |
| 73 | export type PartialResponse = { |
| 74 | initialResponse?: Response; |
| 75 | followupChunks: { [id: number]: string }; |
| 76 | }; |
| 77 | |
| 78 | /** |
| 79 | * @preserve |
| 80 | * End region: https://github.com/facebook/flipper/blob/v0.79.1/desktop/plugins/network/types.tsx |
| 81 | */ |
| 82 | |