路泰科技体检小程序UI设计新版本
qx
2025-08-06 fe97f78b9a343ee9fa45a3531d03d73dcd1df31b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import { Readable, Writable } from 'node:stream'
 
export default CacheHandler
 
declare namespace CacheHandler {
  export type CacheMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE'
 
  export interface CacheHandlerOptions {
    store: CacheStore
 
    cacheByDefault?: number
 
    type?: CacheOptions['type']
  }
 
  export interface CacheOptions {
    store?: CacheStore
 
    /**
     * The methods to cache
     * Note we can only cache safe methods. Unsafe methods (i.e. PUT, POST)
     *  invalidate the cache for a origin.
     * @see https://www.rfc-editor.org/rfc/rfc9111.html#name-invalidating-stored-respons
     * @see https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1
     */
    methods?: CacheMethods[]
 
    /**
     * RFC9111 allows for caching responses that we aren't explicitly told to
     *  cache or to not cache.
     * @see https://www.rfc-editor.org/rfc/rfc9111.html#section-3-5
     * @default undefined
     */
    cacheByDefault?: number
 
    /**
     * TODO docs
     * @default 'shared'
     */
    type?: 'shared' | 'private'
  }
 
  export interface CacheControlDirectives {
    'max-stale'?: number;
    'min-fresh'?: number;
    'max-age'?: number;
    's-maxage'?: number;
    'stale-while-revalidate'?: number;
    'stale-if-error'?: number;
    public?: true;
    private?: true | string[];
    'no-store'?: true;
    'no-cache'?: true | string[];
    'must-revalidate'?: true;
    'proxy-revalidate'?: true;
    immutable?: true;
    'no-transform'?: true;
    'must-understand'?: true;
    'only-if-cached'?: true;
  }
 
  export interface CacheKey {
    origin: string
    method: string
    path: string
    headers?: Record<string, string | string[]>
  }
 
  export interface CacheValue {
    statusCode: number
    statusMessage: string
    headers: Record<string, string | string[]>
    vary?: Record<string, string | string[] | null>
    etag?: string
    cacheControlDirectives?: CacheControlDirectives
    cachedAt: number
    staleAt: number
    deleteAt: number
  }
 
  export interface DeleteByUri {
    origin: string
    method: string
    path: string
  }
 
  type GetResult = {
    statusCode: number
    statusMessage: string
    headers: Record<string, string | string[]>
    vary?: Record<string, string | string[] | null>
    etag?: string
    body?: Readable | Iterable<Buffer> | AsyncIterable<Buffer> | Buffer | Iterable<string> | AsyncIterable<string> | string
    cacheControlDirectives: CacheControlDirectives,
    cachedAt: number
    staleAt: number
    deleteAt: number
  }
 
  /**
   * Underlying storage provider for cached responses
   */
  export interface CacheStore {
    get(key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined
 
    createWriteStream(key: CacheKey, val: CacheValue): Writable | undefined
 
    delete(key: CacheKey): void | Promise<void>
  }
 
  export interface MemoryCacheStoreOpts {
    /**
       * @default Infinity
       */
    maxCount?: number
 
    /**
     * @default Infinity
     */
    maxSize?: number
 
    /**
     * @default Infinity
     */
    maxEntrySize?: number
 
    errorCallback?: (err: Error) => void
  }
 
  export class MemoryCacheStore implements CacheStore {
    constructor (opts?: MemoryCacheStoreOpts)
 
    get (key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined
 
    createWriteStream (key: CacheKey, value: CacheValue): Writable | undefined
 
    delete (key: CacheKey): void | Promise<void>
  }
 
  export interface SqliteCacheStoreOpts {
    /**
     * Location of the database
     * @default ':memory:'
     */
    location?: string
 
    /**
     * @default Infinity
     */
    maxCount?: number
 
    /**
     * @default Infinity
     */
    maxEntrySize?: number
  }
 
  export class SqliteCacheStore implements CacheStore {
    constructor (opts?: SqliteCacheStoreOpts)
 
    /**
     * Closes the connection to the database
     */
    close (): void
 
    get (key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined
 
    createWriteStream (key: CacheKey, value: CacheValue): Writable | undefined
 
    delete (key: CacheKey): void | Promise<void>
  }
}