@ckirg/corelib-cloud 0.1.22
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.
- package/LICENSE +21 -0
- package/README.md +252 -0
- package/dist/aws/RequestUnlimited-EKXQGSQT.mjs +2 -0
- package/dist/aws/bun-GK5CEVAU.mjs +2 -0
- package/dist/aws/chunk-27GDSGEE.mjs +2 -0
- package/dist/aws/chunk-F2KTMAO3.mjs +6 -0
- package/dist/aws/chunk-QCE23AKJ.mjs +8 -0
- package/dist/aws/chunk-STPKE4A5.mjs +24 -0
- package/dist/aws/chunk-V3XZ4XYN.mjs +2 -0
- package/dist/aws/chunk-VULBPPPP.mjs +2 -0
- package/dist/aws/chunk-Y7RZHZ53.mjs +2 -0
- package/dist/aws/cloudflare-BDB3FS4Y.mjs +2 -0
- package/dist/aws/deno-AIUOFIXG.mjs +2 -0
- package/dist/aws/dist-VV3A6A7N.mjs +118 -0
- package/dist/aws/gcp-ZEEIATV7.mjs +438 -0
- package/dist/aws/handler.mjs +63 -0
- package/dist/aws/lambda-S3DVSSBV.mjs +3 -0
- package/dist/aws/node-A7ZN443L.mjs +2 -0
- package/dist/aws/node-RM2WPPZL.mjs +8 -0
- package/dist/aws/src-W4SC2UPB.mjs +23 -0
- package/dist/aws/utils-KMHFLZAJ.mjs +2 -0
- package/dist/cloudflare/RequestUnlimited-QCOTVU4G.js +1 -0
- package/dist/cloudflare/bun-O4EJPGLH.js +1 -0
- package/dist/cloudflare/chunk-DGDAVQYC.js +1 -0
- package/dist/cloudflare/chunk-EQSCULS7.js +2 -0
- package/dist/cloudflare/chunk-O3XYZ4KS.js +1 -0
- package/dist/cloudflare/chunk-PVAE643M.js +1 -0
- package/dist/cloudflare/chunk-QPTGW2LL.js +1 -0
- package/dist/cloudflare/cloudflare-I5A4OJEG.js +1 -0
- package/dist/cloudflare/deno-KE6IVNNU.js +1 -0
- package/dist/cloudflare/dist-GZV6T6K3.js +117 -0
- package/dist/cloudflare/gcp-MNKOPDML.js +1 -0
- package/dist/cloudflare/lambda-PLZQW4BF.js +1 -0
- package/dist/cloudflare/node-DRV76TUB.js +1 -0
- package/dist/cloudflare/utils-7K7MHQMD.js +1 -0
- package/dist/cloudflare/worker.js +62 -0
- package/dist/cloudrun/RequestUnlimited-YQAPYTOH.js +2 -0
- package/dist/cloudrun/bun-BONNABBU.js +2 -0
- package/dist/cloudrun/chunk-5B5BV7SP.js +8 -0
- package/dist/cloudrun/chunk-5CIUNKHO.js +2 -0
- package/dist/cloudrun/chunk-CFQMQATE.js +24 -0
- package/dist/cloudrun/chunk-FYZPEVAA.js +2 -0
- package/dist/cloudrun/chunk-GB4XIPDS.js +6 -0
- package/dist/cloudrun/chunk-JUVTJQ7I.js +2 -0
- package/dist/cloudrun/chunk-ZXZVHMQF.js +2 -0
- package/dist/cloudrun/cloudflare-Q3ZW7CDF.js +2 -0
- package/dist/cloudrun/deno-CPTVGH3A.js +2 -0
- package/dist/cloudrun/dist-VT4HJLSH.js +118 -0
- package/dist/cloudrun/gcp-W76U73T6.js +438 -0
- package/dist/cloudrun/lambda-NKM4QA4M.js +3 -0
- package/dist/cloudrun/node-LVHXMIYI.js +8 -0
- package/dist/cloudrun/node-SKMPZMFE.js +2 -0
- package/dist/cloudrun/server.js +67 -0
- package/dist/cloudrun/src-2WWXNWVC.js +23 -0
- package/dist/cloudrun/utils-SDRX3ZUT.js +2 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Costas Kirgoussios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# ts-cloud: Multi-Edge TypeScript Proxy Service
|
|
2
|
+
|
|
3
|
+
A portable TypeScript service exposing identical HTTP endpoints across **Cloudflare Workers**, **AWS Lambda**, and **Google Cloud Run**.
|
|
4
|
+
|
|
5
|
+
> [!IMPORTANT]
|
|
6
|
+
> Not on the public npm registry — install from GitHub Releases. See the [root install guide](../README.md#-installation-for-external-projects).
|
|
7
|
+
|
|
8
|
+
This project is part of the Corelib monorepo and is tightly coupled with `@ckirg/corelib` and `@ckirg/corelib-markets`, utilizing their core abstractions for database connectivity, resilient HTTP requests, and structured logging.
|
|
9
|
+
|
|
10
|
+
## Core Features
|
|
11
|
+
|
|
12
|
+
- **Shared Routing (Hono)**: A single, config-agnostic `Hono` application instance shared across all platforms.
|
|
13
|
+
- **Resilient Proxying**: Leverages `@ckirg/corelib`'s `endPoint` utility for proxied requests with built-in retries and timeouts.
|
|
14
|
+
- **Nasdaq Market Data**: Specialized edge proxy for the Nasdaq API, enforcing required headers and providing high-resilience fetching via `@ckirg/corelib-markets`.
|
|
15
|
+
- **SQL on the Edge**: Executes parameterized SQLite/Turso queries directly from the edge via the central SQL endpoint.
|
|
16
|
+
- **Structured Edge Logging**: Implements a custom `StrictLogger` for edge environments that outputs structured JSON to `console.log`.
|
|
17
|
+
- **Platform Adapters**: Thin entry points for Cloudflare, AWS Lambda, and Cloud Run that handle environment extraction and context injection.
|
|
18
|
+
|
|
19
|
+
## Project Structure
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
src/
|
|
23
|
+
├── core/
|
|
24
|
+
│ ├── router.ts # Shared Hono application logic and routes
|
|
25
|
+
│ └── logger.ts # Edge-optimized structured logger
|
|
26
|
+
├── database/
|
|
27
|
+
│ └── SqlCloud.ts # SQL query router (Turso)
|
|
28
|
+
├── retrieve/
|
|
29
|
+
│ └── RequestUnlimitedCloud.ts # Generic HTTP proxy router
|
|
30
|
+
├── markets/
|
|
31
|
+
│ └── nasdaq/
|
|
32
|
+
│ ├── ApiNasdaqUnlimitedCloud.ts # Nasdaq-specific proxy router
|
|
33
|
+
│ └── MarketStatusCloud.ts # Nasdaq Market Status proxy router
|
|
34
|
+
└── platform/
|
|
35
|
+
├── cloudflare/ # Cloudflare Worker entry point
|
|
36
|
+
├── aws/ # AWS Lambda (ESM) handler
|
|
37
|
+
└── cloudrun/ # Google Cloud Run (Node.js) server
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API Endpoints
|
|
41
|
+
|
|
42
|
+
### Core Endpoints
|
|
43
|
+
- **`GET /health`**: Returns system status and current platform.
|
|
44
|
+
- **`GET /api/v1/health`**: Versioned health check.
|
|
45
|
+
|
|
46
|
+
### Data & Proxy Endpoints
|
|
47
|
+
- **`POST /api/v1/ky`**: Generic resilient HTTP proxy (supports single or bulk parallel requests).
|
|
48
|
+
- **`GET /api/v1/ky`**: Transparent single-URL proxy via `?url=` query parameter. Returns target response body and status directly. Used by `RequestProxied`.
|
|
49
|
+
- **`POST /api/v1/markets/nasdaq`**: Nasdaq-specific resilient market data proxy.
|
|
50
|
+
- **`GET /api/v1/markets/nasdaq`**: Transparent single-URL Nasdaq proxy via `?url=` query parameter. Enforces Nasdaq headers and returns target response body and status directly. Used by `RequestProxied`.
|
|
51
|
+
- **`POST /api/v1/markets/nasdaq/historical`**: Yahoo Finance historical data proxy.
|
|
52
|
+
- **`GET /api/v1/markets/nasdaq/status`**: Fetches current Nasdaq market status (Open/Closed/Pre/After).
|
|
53
|
+
- **`GET /api/v1/markets/nasdaq/groups/top100`**: Retrieves the list of current Nasdaq 100 constituent symbols.
|
|
54
|
+
- **`POST /api/v1/sql`**: Executes a parameterized SQL query on Turso/LibSQL.
|
|
55
|
+
|
|
56
|
+
## Usage Examples
|
|
57
|
+
|
|
58
|
+
### Health Check
|
|
59
|
+
```bash
|
|
60
|
+
curl https://your-service-url/health
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### RequestUnlimited (Generic Edge Proxy)
|
|
64
|
+
Expose corelib's resilient fetching logic via the `/api/v1/ky` endpoint.
|
|
65
|
+
|
|
66
|
+
#### Single Request
|
|
67
|
+
```bash
|
|
68
|
+
curl -X POST https://your-service-url/api/v1/ky \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{
|
|
71
|
+
"url": "https://api.github.com/zen"
|
|
72
|
+
}'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Bulk Parallel Requests
|
|
76
|
+
```bash
|
|
77
|
+
curl -X POST https://your-service-url/api/v1/ky \
|
|
78
|
+
-H "Content-Type: application/json" \
|
|
79
|
+
-d '{
|
|
80
|
+
"endPoints": [
|
|
81
|
+
{ "url": "https://api.a.com/status" },
|
|
82
|
+
{ "url": "https://api.b.com/data", "options": { "timeout": 2000 } }
|
|
83
|
+
]
|
|
84
|
+
}'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Transparent GET Proxy (used by RequestProxied)
|
|
88
|
+
```bash
|
|
89
|
+
curl "https://your-service-url/api/v1/ky?url=https://api.github.com/zen"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Nasdaq Market Data (ApiNasdaqUnlimitedCloud)
|
|
93
|
+
Specialized proxy for Nasdaq API calls. Enforces correct browser-like headers and provides automatic retries.
|
|
94
|
+
|
|
95
|
+
#### Single Quote Info
|
|
96
|
+
```bash
|
|
97
|
+
curl -X POST https://your-service-url/api/v1/markets/nasdaq \
|
|
98
|
+
-H "Content-Type: application/json" \
|
|
99
|
+
-d '{
|
|
100
|
+
"url": "https://api.nasdaq.com/api/quote/AAPL/info?assetclass=stocks"
|
|
101
|
+
}'
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Transparent GET Proxy (used by RequestProxied)
|
|
105
|
+
```bash
|
|
106
|
+
curl "https://your-service-url/api/v1/markets/nasdaq?url=https://api.nasdaq.com/api/quote/AAPL/info?assetclass=stocks"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Market Status
|
|
110
|
+
```bash
|
|
111
|
+
curl https://your-service-url/api/v1/markets/nasdaq/status
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Nasdaq 100 Symbols
|
|
115
|
+
```bash
|
|
116
|
+
curl https://your-service-url/api/v1/markets/nasdaq/groups/top100
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Historical Data Proxy
|
|
120
|
+
```bash
|
|
121
|
+
curl -X POST https://your-service-url/api/v1/markets/nasdaq/historical \
|
|
122
|
+
-H "Content-Type: application/json" \
|
|
123
|
+
-d '{
|
|
124
|
+
"symbol": "AAPL",
|
|
125
|
+
"options": { "period1": "2023-01-01", "interval": "1d" }
|
|
126
|
+
}'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### SQL Query (Turso)
|
|
130
|
+
Execute SQL queries directly via the edge service.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
curl -X POST https://your-service-url/api/v1/sql \
|
|
134
|
+
-H "Content-Type: application/json" \
|
|
135
|
+
-d '{
|
|
136
|
+
"sql": "SELECT * FROM users WHERE active = ?",
|
|
137
|
+
"params": [true]
|
|
138
|
+
}'
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Configuration Boilerplate
|
|
142
|
+
|
|
143
|
+
### Cloudflare Workers (`wrangler.toml`)
|
|
144
|
+
|
|
145
|
+
The project ships with a `wrangler.toml`. Below is its current structure — adjust `name`, `main`, and the commented `[vars]` block to suit your account. The `[alias]` stubs are **required** to keep Node-only server deps (pino, postgres, @libsql/client) out of the Cloudflare bundle:
|
|
146
|
+
|
|
147
|
+
```toml
|
|
148
|
+
name = "ts-cloud"
|
|
149
|
+
main = "src/platform/cloudflare/worker.ts"
|
|
150
|
+
compatibility_date = "2025-02-04"
|
|
151
|
+
compatibility_flags = ["nodejs_compat"]
|
|
152
|
+
|
|
153
|
+
# Stubs for Node-only deps that must not execute on the edge.
|
|
154
|
+
# Keep these — removing them breaks the Cloudflare bundle.
|
|
155
|
+
[alias]
|
|
156
|
+
"pino" = "./src/platform/cloudflare/server-dep-stub.mjs"
|
|
157
|
+
"pino-pretty" = "./src/platform/cloudflare/server-dep-stub.mjs"
|
|
158
|
+
"pino-lambda" = "./src/platform/cloudflare/server-dep-stub.mjs"
|
|
159
|
+
"pino-socket" = "./src/platform/cloudflare/server-dep-stub.mjs"
|
|
160
|
+
"@google-cloud/pino-logging-gcp-config" = "./src/platform/cloudflare/server-dep-stub.mjs"
|
|
161
|
+
"postgres" = "./src/platform/cloudflare/server-dep-stub.mjs"
|
|
162
|
+
"@libsql/client" = "./src/platform/cloudflare/server-dep-stub.mjs"
|
|
163
|
+
|
|
164
|
+
[dev]
|
|
165
|
+
port = 3000
|
|
166
|
+
|
|
167
|
+
[vars]
|
|
168
|
+
PLATFORM = "cloudflare"
|
|
169
|
+
# CORELIB_TURSO_URL = "" # set via wrangler secret put CORELIB_TURSO_URL
|
|
170
|
+
# CORELIB_TURSO_TOKEN = "" # set via wrangler secret put CORELIB_TURSO_TOKEN
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### AWS Lambda
|
|
174
|
+
|
|
175
|
+
No `samconfig` is included — deploy using the AWS CLI after building:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pnpm run build
|
|
179
|
+
cd dist/aws && zip -r function.zip handler.js
|
|
180
|
+
aws lambda update-function-code --function-name YOUR_FUNCTION_NAME --zip-file fileb://function.zip
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Set `CORELIB_TURSO_URL` and `CORELIB_TURSO_TOKEN` as Lambda environment variables in the console or via `aws lambda update-function-configuration`.
|
|
184
|
+
|
|
185
|
+
### Google Cloud Run
|
|
186
|
+
|
|
187
|
+
No `cloudrun` deploy config is included — deploy directly from source:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
gcloud run deploy ts-cloud \
|
|
191
|
+
--source . \
|
|
192
|
+
--command "node" \
|
|
193
|
+
--args "dist/cloudrun/server.js" \
|
|
194
|
+
--set-env-vars "CORELIB_TURSO_URL=libsql://your-db.turso.io,CORELIB_TURSO_TOKEN=your-token"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Development & Build
|
|
198
|
+
|
|
199
|
+
### Prerequisites
|
|
200
|
+
Ensure the Corelib monorepo dependencies are installed:
|
|
201
|
+
```bash
|
|
202
|
+
pnpm install
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Local Development (Cloudflare)
|
|
206
|
+
Run the service locally using Wrangler and Vitest:
|
|
207
|
+
```bash
|
|
208
|
+
# Start local dev server
|
|
209
|
+
pnpm run dev
|
|
210
|
+
|
|
211
|
+
# Run worker-specific tests
|
|
212
|
+
pnpm run test:worker
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Building Platform Bundles
|
|
216
|
+
Build all three platform-specific bundles into the `dist/` directory:
|
|
217
|
+
```bash
|
|
218
|
+
pnpm run build
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
This generates:
|
|
222
|
+
- `dist/cloudflare/worker.js`: Optimized ESM bundle for Cloudflare Workers.
|
|
223
|
+
- `dist/aws/handler.js`: ESM bundle for AWS Lambda (Node 24+).
|
|
224
|
+
- `dist/cloudrun/server.js`: ESM bundle for Google Cloud Run (Node 24+).
|
|
225
|
+
|
|
226
|
+
## Deployment
|
|
227
|
+
|
|
228
|
+
### Cloudflare Workers
|
|
229
|
+
```bash
|
|
230
|
+
pnpm exec wrangler deploy src/platform/cloudflare/worker.ts
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### AWS Lambda
|
|
234
|
+
1. Build the bundle: `pnpm run build`
|
|
235
|
+
2. Zip the output: `cd dist/aws && zip -r function.zip handler.js`
|
|
236
|
+
3. Update Lambda code: `aws lambda update-function-code --function-name YOUR_FUNC --zip-file fileb://function.zip`
|
|
237
|
+
|
|
238
|
+
### Google Cloud Run
|
|
239
|
+
Deploy from the generated bundle:
|
|
240
|
+
```bash
|
|
241
|
+
gcloud run deploy ts-cloud \
|
|
242
|
+
--source . \
|
|
243
|
+
--command "node" \
|
|
244
|
+
--args "dist/cloudrun/server.js"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Configuration
|
|
248
|
+
|
|
249
|
+
The service expects the following environment variables (where applicable):
|
|
250
|
+
- `CORELIB_TURSO_URL`: The URL of your Turso database.
|
|
251
|
+
- `CORELIB_TURSO_TOKEN`: The authentication token for Turso.
|
|
252
|
+
- `PORT`: (Cloud Run only) The port the server should listen on (defaults to 3000).
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-QCE23AKJ.mjs";import"./chunk-Y7RZHZ53.mjs";import"./chunk-V3XZ4XYN.mjs";import"./chunk-VULBPPPP.mjs";export{g as DEFAULT_REQUEST_OPTIONS,d as MAX_BACKOFF_LIMIT_MS,a as MAX_RETRY_LIMIT,c as MAX_TIMEOUT_MS,b as MIN_TIMEOUT_MS,j as RequestUnlimited,e as clampNumber,h as endPoint,i as endPoints,f as fullJitterDelay};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as g}from"./chunk-F2KTMAO3.mjs";import"./chunk-27GDSGEE.mjs";import{c as p,d as i}from"./chunk-STPKE4A5.mjs";import"./chunk-V3XZ4XYN.mjs";import{e as s,h as n}from"./chunk-VULBPPPP.mjs";n();var o=s(p(),1),a=s(g(),1);import{Writable as d}from"stream";var f=process.env.LOG_PRETTY==="true"||process.env.NODE_ENV!=="production"&&process.env.LOG_PRETTY!=="false",e=process.env.LOG_LEVEL||"info",m=new d({write(t,v,c){let r=globalThis.__wsLogWrite;r&&r(typeof t=="string"?t:t.toString("utf8")),c()}}),l=o.default.multistream([{level:e,stream:f?(0,a.default)({colorize:!0,translateTime:"SYS:standard",ignore:"pid,hostname"}):process.stdout},{level:e,stream:m}]),u=(0,o.default)({level:e,redact:["password","secret","token","authorization","apiKey"]},l),L=new i(u),S=L;export{S as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as z,c as p,h as f}from"./chunk-VULBPPPP.mjs";var O=p((k,j)=>{"use strict";f();j.exports=F;function F(e,r){if(e&&r)return F(e)(r);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(n){o[n]=e[n]}),o;function o(){for(var n=new Array(arguments.length),t=0;t<n.length;t++)n[t]=arguments[t];var u=e.apply(this,n),i=n[n.length-1];return typeof u=="function"&&u!==i&&Object.keys(i).forEach(function(c){u[c]=i[c]}),u}}});var L=p((ee,E)=>{"use strict";f();var P=O();E.exports=P(y);E.exports.strict=P(R);y.proto=y(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return y(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return R(this)},configurable:!0})});function y(e){var r=function(){return r.called?r.value:(r.called=!0,r.value=e.apply(this,arguments))};return r.called=!1,r}function R(e){var r=function(){if(r.called)throw new Error(r.onceError);return r.called=!0,r.value=e.apply(this,arguments)},o=e.name||"Function wrapped with `once`";return r.onceError=o+" shouldn't be called more than once",r.called=!1,r}});var _=p((ne,T)=>{"use strict";f();var C=L(),D=function(){},G=global.Bare?queueMicrotask:process.nextTick.bind(process),I=function(e){return e.setHeader&&typeof e.abort=="function"},J=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},H=function(e,r,o){if(typeof r=="function")return H(e,null,r);r||(r={}),o=C(o||D);var n=e._writableState,t=e._readableState,u=r.readable||r.readable!==!1&&e.readable,i=r.writable||r.writable!==!1&&e.writable,c=!1,a=function(){e.writable||l()},l=function(){i=!1,u||o.call(e)},x=function(){u=!1,i||o.call(e)},S=function(d){o.call(e,d?new Error("exited with error code: "+d):null)},A=function(d){o.call(e,d)},s=function(){G(W)},W=function(){if(!c){if(u&&!(t&&t.ended&&!t.destroyed))return o.call(e,new Error("premature close"));if(i&&!(n&&n.ended&&!n.destroyed))return o.call(e,new Error("premature close"))}},g=function(){e.req.on("finish",l)};return I(e)?(e.on("complete",l),e.on("abort",s),e.req?g():e.on("request",g)):i&&!n&&(e.on("end",a),e.on("close",a)),J(e)&&e.on("exit",S),e.on("end",x),e.on("finish",l),r.error!==!1&&e.on("error",A),e.on("close",s),function(){c=!0,e.removeListener("complete",l),e.removeListener("abort",s),e.removeListener("request",g),e.req&&e.req.removeListener("finish",l),e.removeListener("end",a),e.removeListener("close",a),e.removeListener("finish",l),e.removeListener("exit",S),e.removeListener("end",x),e.removeListener("error",A),e.removeListener("close",s)}};T.exports=H});var $=p((ie,M)=>{"use strict";f();var K=L(),N=_(),h;try{h=z("fs")}catch{}var v=function(){},Q=typeof process>"u"?!1:/^v?\.0/.test(process.version),w=function(e){return typeof e=="function"},U=function(e){return!Q||!h?!1:(e instanceof(h.ReadStream||v)||e instanceof(h.WriteStream||v))&&w(e.close)},V=function(e){return e.setHeader&&w(e.abort)},X=function(e,r,o,n){n=K(n);var t=!1;e.on("close",function(){t=!0}),N(e,{readable:r,writable:o},function(i){if(i)return n(i);t=!0,n()});var u=!1;return function(i){if(!t&&!u){if(u=!0,U(e))return e.close(v);if(V(e))return e.abort();if(w(e.destroy))return e.destroy();n(i||new Error("stream was destroyed"))}}},B=function(e){e()},Y=function(e,r){return e.pipe(r)},Z=function(){var e=Array.prototype.slice.call(arguments),r=w(e[e.length-1]||v)&&e.pop()||v;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var o,n=e.map(function(t,u){var i=u<e.length-1,c=u>0;return X(t,i,c,function(a){o||(o=a),a&&n.forEach(B),!i&&(n.forEach(B),r(o))})});return e.reduce(Y)};M.exports=Z});export{_ as a,$ as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as pr}from"./chunk-27GDSGEE.mjs";import{a as yr,b as dr}from"./chunk-STPKE4A5.mjs";import{a as I,c as h,h as f}from"./chunk-VULBPPPP.mjs";var me=h(p=>{"use strict";f();Object.defineProperty(p,"__esModule",{value:!0});var mr=I("tty");function gr(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var pe=gr(mr),{env:q={},argv:Ge=[],platform:hr=""}=typeof process>"u"?{}:process,br="NO_COLOR"in q||Ge.includes("--no-color"),Or="FORCE_COLOR"in q||Ge.includes("--color"),Lr=hr==="win32",ke=q.TERM==="dumb",Er=pe&&pe.isatty&&pe.isatty(1)&&q.TERM&&!ke,Cr="CI"in q&&("GITHUB_ACTIONS"in q||"GITLAB_CI"in q||"CIRCLECI"in q),Ve=!br&&(Or||Lr&&!ke||Er||Cr),He=(e,r,t,n,i=r.substring(0,e)+n,o=r.substring(e+t.length),s=o.indexOf(t))=>i+(s<0?o:He(s,o,t,n)),wr=(e,r,t,n,i)=>e<0?t+r+n:t+He(e,r,n,i)+n,Sr=(e,r,t=e,n=e.length+1)=>i=>i||!(i===""||i===void 0)?wr((""+i).indexOf(r,n),i,e,r,t):"",m=(e,r,t)=>Sr(`\x1B[${e}m`,`\x1B[${r}m`,t),ze={reset:m(0,0),bold:m(1,22,"\x1B[22m\x1B[1m"),dim:m(2,22,"\x1B[22m\x1B[2m"),italic:m(3,23),underline:m(4,24),inverse:m(7,27),hidden:m(8,28),strikethrough:m(9,29),black:m(30,39),red:m(31,39),green:m(32,39),yellow:m(33,39),blue:m(34,39),magenta:m(35,39),cyan:m(36,39),white:m(37,39),gray:m(90,39),bgBlack:m(40,49),bgRed:m(41,49),bgGreen:m(42,49),bgYellow:m(43,49),bgBlue:m(44,49),bgMagenta:m(45,49),bgCyan:m(46,49),bgWhite:m(47,49),blackBright:m(90,39),redBright:m(91,39),greenBright:m(92,39),yellowBright:m(93,39),blueBright:m(94,39),magentaBright:m(95,39),cyanBright:m(96,39),whiteBright:m(97,39),bgBlackBright:m(100,49),bgRedBright:m(101,49),bgGreenBright:m(102,49),bgYellowBright:m(103,49),bgBlueBright:m(104,49),bgMagentaBright:m(105,49),bgCyanBright:m(106,49),bgWhiteBright:m(107,49)},Ye=({useColor:e=Ve}={})=>e?ze:Object.keys(ze).reduce((r,t)=>({...r,[t]:String}),{}),{reset:Mr,bold:jr,dim:Dr,italic:Tr,underline:_r,inverse:vr,hidden:Br,strikethrough:xr,black:Pr,red:Nr,green:qr,yellow:Ar,blue:Kr,magenta:Fr,cyan:Rr,white:Ir,gray:$r,bgBlack:Wr,bgRed:zr,bgGreen:Gr,bgYellow:kr,bgBlue:Vr,bgMagenta:Hr,bgCyan:Yr,bgWhite:Ur,blackBright:Jr,redBright:Zr,greenBright:Xr,yellowBright:Qr,blueBright:en,magentaBright:tn,cyanBright:rn,whiteBright:nn,bgBlackBright:on,bgRedBright:sn,bgGreenBright:cn,bgYellowBright:un,bgBlueBright:fn,bgMagentaBright:ln,bgCyanBright:an,bgWhiteBright:yn}=Ye();p.bgBlack=Wr;p.bgBlackBright=on;p.bgBlue=Vr;p.bgBlueBright=fn;p.bgCyan=Yr;p.bgCyanBright=an;p.bgGreen=Gr;p.bgGreenBright=cn;p.bgMagenta=Hr;p.bgMagentaBright=ln;p.bgRed=zr;p.bgRedBright=sn;p.bgWhite=Ur;p.bgWhiteBright=yn;p.bgYellow=kr;p.bgYellowBright=un;p.black=Pr;p.blackBright=Jr;p.blue=Kr;p.blueBright=en;p.bold=jr;p.createColors=Ye;p.cyan=Rr;p.cyanBright=rn;p.dim=Dr;p.gray=$r;p.green=qr;p.greenBright=Xr;p.hidden=Br;p.inverse=vr;p.isColorSupported=Ve;p.italic=Tr;p.magenta=Fr;p.magentaBright=tn;p.red=Nr;p.redBright=Zr;p.reset=Mr;p.strikethrough=xr;p.underline=_r;p.white=Ir;p.whiteBright=nn;p.yellow=Ar;p.yellowBright=Qr});var Xe=h((To,Ze)=>{"use strict";f();var{Transform:dn}=I("stream"),{StringDecoder:pn}=I("string_decoder"),A=Symbol("last"),te=Symbol("decoder");function mn(e,r,t){let n;if(this.overflow){if(n=this[te].write(e).split(this.matcher),n.length===1)return t();n.shift(),this.overflow=!1}else this[A]+=this[te].write(e),n=this[A].split(this.matcher);this[A]=n.pop();for(let i=0;i<n.length;i++)try{Je(this,this.mapper(n[i]))}catch(o){return t(o)}if(this.overflow=this[A].length>this.maxLength,this.overflow&&!this.skipOverflow){t(new Error("maximum buffer reached"));return}t()}function gn(e){if(this[A]+=this[te].end(),this[A])try{Je(this,this.mapper(this[A]))}catch(r){return e(r)}e()}function Je(e,r){r!==void 0&&e.push(r)}function Ue(e){return e}function hn(e,r,t){switch(e=e||/\r?\n/,r=r||Ue,t=t||{},arguments.length){case 1:typeof e=="function"?(r=e,e=/\r?\n/):typeof e=="object"&&!(e instanceof RegExp)&&!e[Symbol.split]&&(t=e,e=/\r?\n/);break;case 2:typeof e=="function"?(t=r,r=e,e=/\r?\n/):typeof r=="object"&&(t=r,r=Ue)}t=Object.assign({},t),t.autoDestroy=!0,t.transform=mn,t.flush=gn,t.readableObjectMode=!0;let n=new dn(t);return n[A]="",n[te]=new pn("utf8"),n.matcher=e,n.mapper=r,n.maxLength=t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,o){this._writableState.errorEmitted=!1,o(i)},n}Ze.exports=hn});var nt=h((vo,rt)=>{"use strict";f();var Qe=Symbol.for("pino.metadata"),bn=Xe(),{Duplex:On}=I("stream"),{parentPort:et,workerData:tt}=I("worker_threads");function Ln(){let e,r,t=new Promise((n,i)=>{e=n,r=i});return t.resolve=e,t.reject=r,t}rt.exports=function(r,t={}){let n=t.expectPinoConfig===!0&&tt?.workerData?.pinoWillSendConfig===!0,i=t.parse==="lines",o=typeof t.parseLine=="function"?t.parseLine:JSON.parse,s=t.close||En,c=bn(function(u){let a;try{a=o(u)}catch(y){this.emit("unknown",u,y);return}if(a===null){this.emit("unknown",u,"Null value ignored");return}return typeof a!="object"&&(a={data:a,time:Date.now()}),c[Qe]&&(c.lastTime=a.time,c.lastLevel=a.level,c.lastObj=a),i?u:a},{autoDestroy:!0});if(c._destroy=function(u,a){let y=s(u,a);y&&typeof y.then=="function"&&y.then(a,a)},t.expectPinoConfig===!0&&tt?.workerData?.pinoWillSendConfig!==!0&&setImmediate(()=>{c.emit("error",new Error("This transport is not compatible with the current version of pino. Please upgrade pino to the latest version."))}),t.metadata!==!1&&(c[Qe]=!0,c.lastTime=0,c.lastLevel=0,c.lastObj=null),n){let u={},a=Ln();return et.on("message",function y(g){g.code==="PINO_CONFIG"&&(u=g.config,a.resolve(),et.off("message",y))}),Object.defineProperties(c,{levels:{get(){return u.levels}},messageKey:{get(){return u.messageKey}},errorKey:{get(){return u.errorKey}}}),a.then(d)}return d();function d(){let u=r(c);if(u&&typeof u.catch=="function")u.catch(a=>{c.destroy(a)}),u=null;else if(t.enablePipelining&&u)return On.from({writable:c,readable:u});return c}};function En(e,r){process.nextTick(r,e)}});var P=h((xo,it)=>{"use strict";f();it.exports={DATE_FORMAT:"yyyy-mm-dd HH:MM:ss.l o",DATE_FORMAT_SIMPLE:"HH:MM:ss.l",ERROR_LIKE_KEYS:["err","error"],MESSAGE_KEY:"msg",LEVEL_KEY:"level",LEVEL_LABEL:"levelLabel",TIMESTAMP_KEY:"time",LEVELS:{default:"USERLVL",60:"FATAL",50:"ERROR",40:"WARN",30:"INFO",20:"DEBUG",10:"TRACE"},LEVEL_NAMES:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},LOGGER_KEYS:["pid","hostname","name","level","time","timestamp","caller"]}});var re=h((No,ct)=>{"use strict";f();ct.exports=Cn;var{LEVELS:ot,LEVEL_NAMES:st}=P();function Cn(e,r,t){let n=e?r||ot:Object.assign({},ot,r),i=e?t||st:Object.assign({},st,t);return function(o){let s="default";return Number.isInteger(+o)?s=Object.prototype.hasOwnProperty.call(n,o)?o:s:s=Object.prototype.hasOwnProperty.call(i,o.toLowerCase())?i[o.toLowerCase()]:s,[n[s],s]}}});var Oe=h((Ao,at)=>{"use strict";f();var x=e=>e,ne={default:x,60:x,50:x,40:x,30:x,20:x,10:x,message:x,greyMessage:x,property:x},{createColors:ut}=me(),wn=re(),Z=ut({useColor:!0}),{white:ge,bgRed:Sn,red:Mn,yellow:jn,green:Dn,blue:Tn,gray:he,cyan:ft,magenta:lt}=Z,J={default:ge,60:Sn,50:Mn,40:jn,30:Dn,20:Tn,10:he,message:ft,greyMessage:he,property:lt};function _n(e){return e.reduce(function(r,[t,n]){return r[t]=typeof Z[n]=="function"?Z[n]:ge,r},{default:ge,message:ft,greyMessage:he,property:lt})}function be(e){return function(r,t,{customLevels:n,customLevelNames:i}={}){let[o,s]=wn(e,n,i)(r);return Object.prototype.hasOwnProperty.call(t,s)?t[s](o):t.default(o)}}function vn(e){let r=be(e),t=function(n,i){return r(n,ne,i)};return t.message=ne.message,t.greyMessage=ne.greyMessage,t.property=ne.property,t.colors=ut({useColor:!1}),t}function Bn(e){let r=be(e),t=function(n,i){return r(n,J,i)};return t.message=J.message,t.property=J.property,t.greyMessage=J.greyMessage,t.colors=Z,t}function xn(e,r){let t=_n(e),n=r?t:Object.assign({},J,t),i=be(r),o=function(s,c){return i(s,n,c)};return o.colors=Z,o.message=o.message||n.message,o.property=o.property||n.property,o.greyMessage=o.greyMessage||n.greyMessage,o}at.exports=function(r=!1,t,n){return r&&t!==void 0?xn(t,n):r?Bn(n):vn(n)}});var Le=h((Fo,yt)=>{"use strict";f();yt.exports=function(){}});var pt=h((Io,dt)=>{"use strict";f();dt.exports=qn;var{isMainThread:Pn}=I("worker_threads"),Nn=yr(),ie=Le();function qn(e){let r=new Nn(e);return r.on("error",t),!e.sync&&Pn&&An(r),r;function t(n){if(n.code==="EPIPE"){r.write=ie,r.end=ie,r.flushSync=ie,r.destroy=ie;return}r.removeListener("error",t)}}function An(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let r=dr();r.register(e,Kn),e.on("close",function(){r.unregister(e)})}}function Kn(e,r){e.destroyed||(r==="beforeExit"?(e.flush(),e.on("drain",function(){e.end()})):e.flushSync())}});var oe=h((Wo,mt)=>{"use strict";f();mt.exports=Fn;function Fn(e){return e instanceof Date&&!Number.isNaN(e.getTime())}});var Ee=h((Go,gt)=>{"use strict";f();gt.exports=In;var Rn=oe();function In(e){let r=new Date(e);return Rn(r)||(r=new Date(+e)),r}});var se=h((Vo,ht)=>{"use strict";f();ht.exports=$n;function $n(e){let r=[],t=!1,n="";for(let i=0;i<e.length;i++){let o=e.charAt(i);if(o==="\\"){t=!0;continue}if(t){t=!1,n+=o;continue}if(o==="."){r.push(n),n="";continue}n+=o}return n.length&&r.push(n),r}});var G=h((Yo,bt)=>{"use strict";f();bt.exports=zn;var Wn=se();function zn(e,r){let t=Array.isArray(r)?r:Wn(r);for(let n of t){if(!Object.prototype.hasOwnProperty.call(e,n))return;e=e[n]}return e}});var Ce=h((Jo,Ot)=>{"use strict";f();Ot.exports=Vn;var Gn=G(),kn=se();function Vn(e,r){let t=kn(r),n=t.pop();e=Gn(e,t),e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,n)&&delete e[n]}});var Mt=h(ue=>{"use strict";f();var Hn=Function.prototype.toString,Yn=Object.prototype.toString;function Et(e){if(!e)return Object.create(null);let r=e.constructor;if(r===Object)return e===Object.prototype?{}:Object.create(e);if(r&&~Hn.call(r).indexOf("[native code]"))try{return new r}catch{}return Object.create(e)}function Un(e){let r=e[Symbol.toStringTag];if(r)return r;let t=Yn.call(e);return t.substring(8,t.length-1)}var{hasOwnProperty:Jn,propertyIsEnumerable:Zn}=Object.prototype;function Lt(e,r,t,n){let i=Object.getOwnPropertyDescriptor(e,t)||{configurable:!0,enumerable:!0,value:e[t],writable:!0},o=i.get||i.set?i:{configurable:i.configurable,enumerable:i.enumerable,value:n.copier(i.value,n),writable:i.writable};try{Object.defineProperty(r,t,o)}catch{r[t]=o.get?o.get():o.value}}function ce(e,r,t){let n=Object.getOwnPropertyNames(e);for(let o=0;o<n.length;++o)Lt(e,r,n[o],t);let i=Object.getOwnPropertySymbols(e);for(let o=0;o<i.length;++o)Lt(e,r,i[o],t);return r}function Xn(e,r){let t=new r.Constructor;r.cache.set(e,t);for(let n=0;n<e.length;++n)t[n]=r.copier(e[n],r);return t}function Qn(e,r){let t=new r.Constructor;return r.cache.set(e,t),ce(e,t,r)}function Ct(e,r){return e.slice(0)}function ei(e,r){return e.slice(0,e.size,e.type)}function ti(e,r){return new r.Constructor(Ct(e.buffer))}function ri(e,r){return new r.Constructor(e.getTime())}function wt(e,r){let t=new r.Constructor;return r.cache.set(e,t),e.forEach((n,i)=>{t.set(i,r.copier(n,r))}),t}function ni(e,r){return ce(e,wt(e,r),r)}function ii(e,r){let t=Et(r.prototype);r.cache.set(e,t);for(let i in e)Jn.call(e,i)&&(t[i]=r.copier(e[i],r));let n=Object.getOwnPropertySymbols(e);for(let i=0;i<n.length;++i){let o=n[i];Zn.call(e,o)&&(t[o]=r.copier(e[o],r))}return t}function oi(e,r){let t=Et(r.prototype);return r.cache.set(e,t),ce(e,t,r)}function we(e,r){return new r.Constructor(e.valueOf())}function si(e,r){let t=new r.Constructor(e.source,e.flags);return t.lastIndex=e.lastIndex,t}function k(e,r){return e}function St(e,r){let t=new r.Constructor;return r.cache.set(e,t),e.forEach(n=>{t.add(r.copier(n,r))}),t}function ci(e,r){return ce(e,St(e,r),r)}function ui(){return new WeakMap}function fi({createCache:e,methods:r,strict:t}){let n={array:t?Qn:Xn,arrayBuffer:Ct,asyncGenerator:k,blob:ei,dataView:ti,date:ri,error:k,generator:k,map:t?ni:wt,object:t?oi:ii,regExp:si,set:t?ci:St},i=r?Object.assign(n,r):n,o=li(i),s=e||ui;if(!o.Object||!o.Array)throw new Error("An object and array copier must be provided.");return{createCache:s,copiers:o,methods:i,strict:!!t}}function li(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:we,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:we,Object:e.object,Promise:k,RegExp:e.regExp,Set:e.set,String:we,WeakMap:k,WeakSet:k,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer}}function Se(e={}){let{createCache:r,copiers:t}=fi(e),{Array:n,Object:i}=t;function o(s,c){if(c.prototype=c.Constructor=void 0,!s||typeof s!="object")return s;if(c.cache.has(s))return c.cache.get(s);if(c.prototype=Object.getPrototypeOf(s),c.Constructor=c.prototype&&c.prototype.constructor,!c.Constructor||c.Constructor===Object)return i(s,c);if(Array.isArray(s))return n(s,c);let d=t[Un(s)];return d?d(s,c):typeof s.then=="function"?s:i(s,c)}return function(c){return o(c,{Constructor:void 0,cache:r(),copier:o,prototype:void 0})}}var ai=Se({strict:!0}),yi=Se();ue.copy=yi;ue.copyStrict=ai;ue.createCopier=Se});var Me=h((es,jt)=>{"use strict";f();jt.exports=gi;var{createCopier:di}=Mt(),pi=di({}),mi=Ce();function gi({log:e,context:r}){let{ignoreKeys:t,includeKeys:n}=r,i=pi(e);if(n){let o={};return n.forEach(s=>{o[s]=i[s]}),o}return t.forEach(o=>{mi(i,o)}),i}});var Tt=h((je,Dt)=>{"use strict";f();function V(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?V=function(t){return typeof t}:V=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(e)}(function(e){var r=arguments,t=(function(){var d=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,u=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,a=/[^-+\dA-Z]/g;return function(y,g,E,T){if(r.length===1&&c(y)==="string"&&!/\d/.test(y)&&(g=y,y=void 0),y=y||y===0?y:new Date,y instanceof Date||(y=new Date(y)),isNaN(y))throw TypeError("Invalid date");g=String(t.masks[g]||g||t.masks.default);var S=g.slice(0,4);(S==="UTC:"||S==="GMT:")&&(g=g.slice(4),E=!0,S==="GMT:"&&(T=!0));var C=function(){return E?"getUTC":"get"},L=function(){return y[C()+"Date"]()},w=function(){return y[C()+"Day"]()},M=function(){return y[C()+"Month"]()},_=function(){return y[C()+"FullYear"]()},j=function(){return y[C()+"Hours"]()},F=function(){return y[C()+"Minutes"]()},z=function(){return y[C()+"Seconds"]()},R=function(){return y[C()+"Milliseconds"]()},v=function(){return E?0:y.getTimezoneOffset()},B=function(){return o(y)},N=function(){return s(y)},D={d:function(){return L()},dd:function(){return n(L())},ddd:function(){return t.i18n.dayNames[w()]},DDD:function(){return i({y:_(),m:M(),d:L(),_:C(),dayName:t.i18n.dayNames[w()],short:!0})},dddd:function(){return t.i18n.dayNames[w()+7]},DDDD:function(){return i({y:_(),m:M(),d:L(),_:C(),dayName:t.i18n.dayNames[w()+7]})},m:function(){return M()+1},mm:function(){return n(M()+1)},mmm:function(){return t.i18n.monthNames[M()]},mmmm:function(){return t.i18n.monthNames[M()+12]},yy:function(){return String(_()).slice(2)},yyyy:function(){return n(_(),4)},h:function(){return j()%12||12},hh:function(){return n(j()%12||12)},H:function(){return j()},HH:function(){return n(j())},M:function(){return F()},MM:function(){return n(F())},s:function(){return z()},ss:function(){return n(z())},l:function(){return n(R(),3)},L:function(){return n(Math.floor(R()/10))},t:function(){return j()<12?t.i18n.timeNames[0]:t.i18n.timeNames[1]},tt:function(){return j()<12?t.i18n.timeNames[2]:t.i18n.timeNames[3]},T:function(){return j()<12?t.i18n.timeNames[4]:t.i18n.timeNames[5]},TT:function(){return j()<12?t.i18n.timeNames[6]:t.i18n.timeNames[7]},Z:function(){return T?"GMT":E?"UTC":(String(y).match(u)||[""]).pop().replace(a,"").replace(/GMT\+0000/g,"UTC")},o:function(){return(v()>0?"-":"+")+n(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+n(Math.floor(Math.abs(v())/60),2)+":"+n(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][L()%10>3?0:(L()%100-L()%10!=10)*L()%10]},W:function(){return B()},WW:function(){return n(B())},N:function(){return N()}};return g.replace(d,function(l){return l in D?D[l]():l.slice(1,l.length-1)})}})();t.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},t.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]};var n=function(u,a){for(u=String(u),a=a||2;u.length<a;)u="0"+u;return u},i=function(u){var a=u.y,y=u.m,g=u.d,E=u._,T=u.dayName,S=u.short,C=S===void 0?!1:S,L=new Date,w=new Date;w.setDate(w[E+"Date"]()-1);var M=new Date;M.setDate(M[E+"Date"]()+1);var _=function(){return L[E+"Date"]()},j=function(){return L[E+"Month"]()},F=function(){return L[E+"FullYear"]()},z=function(){return w[E+"Date"]()},R=function(){return w[E+"Month"]()},v=function(){return w[E+"FullYear"]()},B=function(){return M[E+"Date"]()},N=function(){return M[E+"Month"]()},D=function(){return M[E+"FullYear"]()};return F()===a&&j()===y&&_()===g?C?"Tdy":"Today":v()===a&&R()===y&&z()===g?C?"Ysd":"Yesterday":D()===a&&N()===y&&B()===g?C?"Tmw":"Tomorrow":T},o=function(u){var a=new Date(u.getFullYear(),u.getMonth(),u.getDate());a.setDate(a.getDate()-(a.getDay()+6)%7+3);var y=new Date(a.getFullYear(),0,4);y.setDate(y.getDate()-(y.getDay()+6)%7+3);var g=a.getTimezoneOffset()-y.getTimezoneOffset();a.setHours(a.getHours()-g);var E=(a-y)/(864e5*7);return 1+Math.floor(E)},s=function(u){var a=u.getDay();return a===0&&(a=7),a},c=function(u){return u===null?"null":u===void 0?"undefined":V(u)!=="object"?V(u):Array.isArray(u)?"array":{}.toString.call(u).slice(8,-1).toLowerCase()};typeof define=="function"&&define.amd?define(function(){return t}):(typeof je>"u"?"undefined":V(je))==="object"?Dt.exports=t:e.dateFormat=t})(void 0)});var De=h((ns,_t)=>{"use strict";f();_t.exports=Ei;var{DATE_FORMAT:hi,DATE_FORMAT_SIMPLE:bi}=P(),X=Tt(),Oi=Ee(),Li=oe();function Ei(e,r=!1){if(r===!1)return e;let t=Oi(e);if(!Li(t))return e;if(r===!0)return X(t,bi);let n=r.toUpperCase();if(n==="SYS:STANDARD")return X(t,hi);let i=n.substr(0,4);return i==="SYS:"||i==="UTC:"?i==="UTC:"?X(t,r):X(t,r.slice(4)):X(t,`UTC:${r}`)}});var Te=h((os,vt)=>{"use strict";f();vt.exports=Ci;function Ci(e){return e?typeof e=="string"?e.split(",").reduce((r,t,n)=>{let[i,o=n]=t.split(":");return r[i.toLowerCase()]=o,r},{}):Object.prototype.toString.call(e)==="[object Object]"?Object.keys(e).reduce((r,t)=>(r[t.toLowerCase()]=e[t],r),{}):{}:{}}});var _e=h((cs,Bt)=>{"use strict";f();Bt.exports=wi;function wi(e){return e?typeof e=="string"?e.split(",").reduce((r,t,n)=>{let[i,o=n]=t.split(":");return r[o]=i.toUpperCase(),r},{default:"USERLVL"}):Object.prototype.toString.call(e)==="[object Object]"?Object.keys(e).reduce((r,t)=>(r[e[t]]=t.toUpperCase(),r),{default:"USERLVL"}):{}:{}}});var ve=h((fs,xt)=>{"use strict";f();xt.exports=Mi;var Si=G();function Mi(e,r){return e=e.replace(/{if (.*?)}(.*?){end}/g,t),e=e.replace(/{if (.*?)}/g,""),e=e.replace(/{end}/g,""),e.replace(/\s+/g," ").trim();function t(n,i,o){let s=Si(r,i);return s&&o.includes(i)?o.replace(new RegExp("{"+i+"}","g"),s):""}}});var fe=h((as,Pt)=>{"use strict";f();Pt.exports=ji;function ji(e){return Object.prototype.toString.apply(e)==="[object Object]"}});var Q=h((ds,Nt)=>{"use strict";f();Nt.exports=Di;function Di({input:e,ident:r=" ",eol:t=`
|
|
3
|
+
`}){let n=e.split(/\r?\n/);for(let i=1;i<n.length;i+=1)n[i]=r+n[i];return n.join(t)}});var Ft=h((ms,Kt)=>{"use strict";f();Kt.exports=Bi;var{LEVEL_NAMES:qt}=P(),At=Oe(),Ti=_e(),_i=Te(),vi=re();function Bi(e){let r=e.crlf?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,t=" ",{customPrettifiers:n,errorLikeObjectKeys:i,hideObject:o,levelFirst:s,levelKey:c,levelLabel:d,messageFormat:u,messageKey:a,minimumLevel:y,singleLine:g,timestampKey:E,translateTime:T}=e,S=e.errorProps.split(","),C=typeof e.useOnlyCustomProps=="boolean"?e.useOnlyCustomProps:e.useOnlyCustomProps==="true",L=Ti(e.customLevels),w=_i(e.customLevels),M=vi(C,L,w),_;if(e.customColors)if(typeof e.customColors=="string")_=e.customColors.split(",").reduce((B,N)=>{let[D,l]=N.split(":"),U=(C?e.customLevels:w[D]!==void 0)?w[D]:qt[D],de=U!==void 0?U:D;return B.push([de,l]),B},[]);else if(typeof e.customColors=="object")_=Object.keys(e.customColors).reduce((B,N)=>{let[D,l]=[N,e.customColors[N]],U=(C?e.customLevels:w[D]!==void 0)?w[D]:qt[D],de=U!==void 0?U:D;return B.push([de,l]),B},[]);else throw new Error("options.customColors must be of type string or object.");let j={customLevels:L,customLevelNames:w};C===!0&&!e.customLevels&&(j.customLevels=void 0,j.customLevelNames=void 0);let F=e.include!==void 0?new Set(e.include.split(",")):void 0,z=!F&&e.ignore?new Set(e.ignore.split(",")):void 0,R=At(e.colorize,_,C),v=e.colorizeObjects?R:At(!1,[],!1);return{EOL:r,IDENT:t,colorizer:R,customColors:_,customLevelNames:w,customLevels:L,customPrettifiers:n,customProperties:j,errorLikeObjectKeys:i,errorProps:S,getLevelLabelData:M,hideObject:o,ignoreKeys:z,includeKeys:F,levelFirst:s,levelKey:c,levelLabel:d,messageFormat:u,messageKey:a,minimumLevel:y,objectColorizer:v,singleLine:g,timestampKey:E,translateTime:T,useOnlyCustomProps:C}}});var Gt=h((hs,zt)=>{"use strict";f();zt.exports=ee;ee.default=ee;ee.stable=$t;ee.stableStringify=$t;var le="[...]",Rt="[Circular]",W=[],$=[];function It(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function ee(e,r,t,n){typeof n>"u"&&(n=It()),Be(e,"",0,[],void 0,0,n);var i;try{$.length===0?i=JSON.stringify(e,r,t):i=JSON.stringify(e,Wt(r),t)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;W.length!==0;){var o=W.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function H(e,r,t,n){var i=Object.getOwnPropertyDescriptor(n,t);i.get!==void 0?i.configurable?(Object.defineProperty(n,t,{value:e}),W.push([n,t,r,i])):$.push([r,t,e]):(n[t]=e,W.push([n,t,r]))}function Be(e,r,t,n,i,o,s){o+=1;var c;if(typeof e=="object"&&e!==null){for(c=0;c<n.length;c++)if(n[c]===e){H(Rt,e,r,i);return}if(typeof s.depthLimit<"u"&&o>s.depthLimit){H(le,e,r,i);return}if(typeof s.edgesLimit<"u"&&t+1>s.edgesLimit){H(le,e,r,i);return}if(n.push(e),Array.isArray(e))for(c=0;c<e.length;c++)Be(e[c],c,c,n,e,o,s);else{var d=Object.keys(e);for(c=0;c<d.length;c++){var u=d[c];Be(e[u],u,c,n,e,o,s)}}n.pop()}}function xi(e,r){return e<r?-1:e>r?1:0}function $t(e,r,t,n){typeof n>"u"&&(n=It());var i=xe(e,"",0,[],void 0,0,n)||e,o;try{$.length===0?o=JSON.stringify(i,r,t):o=JSON.stringify(i,Wt(r),t)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;W.length!==0;){var s=W.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return o}function xe(e,r,t,n,i,o,s){o+=1;var c;if(typeof e=="object"&&e!==null){for(c=0;c<n.length;c++)if(n[c]===e){H(Rt,e,r,i);return}try{if(typeof e.toJSON=="function")return}catch{return}if(typeof s.depthLimit<"u"&&o>s.depthLimit){H(le,e,r,i);return}if(typeof s.edgesLimit<"u"&&t+1>s.edgesLimit){H(le,e,r,i);return}if(n.push(e),Array.isArray(e))for(c=0;c<e.length;c++)xe(e[c],c,c,n,e,o,s);else{var d={},u=Object.keys(e).sort(xi);for(c=0;c<u.length;c++){var a=u[c];xe(e[a],a,c,n,e,o,s),d[a]=e[a]}if(typeof i<"u")W.push([i,r,e]),i[r]=d;else return d}n.pop()}}function Wt(e){return e=typeof e<"u"?e:function(r,t){return t},function(r,t){if($.length>0)for(var n=0;n<$.length;n++){var i=$[n];if(i[1]===r&&i[0]===t){t=i[2],$.splice(n,1);break}}return e.call(this,r,t)}}});var Pe=h((Os,kt)=>{"use strict";f();kt.exports=Ni;var Pi=Q();function Ni({keyName:e,lines:r,eol:t,ident:n}){let i="",o=Pi({input:r,ident:n,eol:t}),s=`${n}${e}: ${o}${t}`.split(t);for(let c=0;c<s.length;c+=1){c!==0&&(i+=t);let d=s[c];if(/^\s*"stack"/.test(d)){let u=/^(\s*"stack":)\s*(".*"),?$/.exec(d);if(u&&u.length===3){let a=/^\s*/.exec(d)[0].length+4,y=" ".repeat(a),g=u[2];i+=u[1]+t+y+JSON.parse(g).replace(/\n/g,t+y)}else i+=d}else i+=d}return i}});var ae=h((Es,Vt)=>{"use strict";f();Vt.exports=Fi;var{LOGGER_KEYS:qi}=P(),Ne=Gt(),Ai=Q(),Ki=Pe();function Fi({log:e,excludeLoggerKeys:r=!0,skipKeys:t=[],context:n}){let{EOL:i,IDENT:o,customPrettifiers:s,errorLikeObjectKeys:c,objectColorizer:d,singleLine:u,colorizer:a}=n,y=[].concat(t);r===!0&&Array.prototype.push.apply(y,qi);let g="",{plain:E,errors:T}=Object.entries(e).reduce(({plain:S,errors:C},[L,w])=>{if(y.includes(L)===!1){let M=typeof s[L]=="function"?s[L](w,L,e,{colors:a.colors}):w;c.includes(L)?C[L]=M:S[L]=M}return{plain:S,errors:C}},{plain:{},errors:{}});return u?(Object.keys(E).length>0&&(g+=d.greyMessage(Ne(E))),g+=i,g=g.replace(/\\\\/gi,"\\")):Object.entries(E).forEach(([S,C])=>{let L=typeof s[S]=="function"?C:Ne(C,null,2);if(L===void 0)return;L=L.replace(/\\\\/gi,"\\");let w=Ai({input:L,ident:o,eol:i});g+=`${o}${d.property(S)}:${w.startsWith(i)?"":" "}${w}${i}`}),Object.entries(T).forEach(([S,C])=>{let L=typeof s[S]=="function"?C:Ne(C,null,2);L!==void 0&&(g+=Ki({keyName:S,lines:L,eol:i,ident:o}))}),g}});var qe=h((ws,Ht)=>{"use strict";f();Ht.exports=zi;var{LOGGER_KEYS:Ri}=P(),Ii=fe(),$i=Q(),Wi=ae();function zi({log:e,context:r}){let{EOL:t,IDENT:n,errorProps:i,messageKey:o}=r,s=e.stack,c=$i({input:s,ident:n,eol:t}),d=`${n}${c}${t}`;if(i.length>0){let u=Ri.concat(o,"type","stack"),a;i[0]==="*"?a=Object.keys(e).filter(y=>u.includes(y)===!1):a=i.filter(y=>u.includes(y)===!1);for(let y=0;y<a.length;y+=1){let g=a[y];if(g in e){if(Ii(e[g])){let E=Wi({log:e[g],excludeLoggerKeys:!1,context:{...r,IDENT:n+n}});d=`${d}${n}${g}: {${t}${E}${n}}${t}`;continue}d=`${d}${n}${g}: ${e[g]}${t}`}}}return d}});var Ae=h((Ms,Yt)=>{"use strict";f();Yt.exports=ki;var Gi=G();function ki({log:e,context:r}){let{colorizer:t,customLevels:n,customLevelNames:i,levelKey:o,getLevelLabelData:s}=r,c=r.customPrettifiers?.level,d=Gi(e,o);if(d===void 0)return;let u=t(d,{customLevels:n,customLevelNames:i});if(c){let[a]=s(d);return c(d,o,e,{label:a,labelColorized:u,colors:t.colors})}return u}});var Ke=h((Ds,Jt)=>{"use strict";f();Jt.exports=Yi;var{LEVELS:Vi}=P(),Ut=G(),Hi=ve();function Yi({log:e,context:r}){let{colorizer:t,customLevels:n,levelKey:i,levelLabel:o,messageFormat:s,messageKey:c,useOnlyCustomProps:d}=r;if(s&&typeof s=="string"){let u=Hi(s,e),a=String(u).replace(/{([^{}]+)}/g,function(y,g){let E;if(g===o&&(E=Ut(e,i))!==void 0)return(d?n===void 0:n[E]===void 0)?Vi[E]:n[E];let T=Ut(e,g);return T!==void 0?T:""});return t.message(a)}if(s&&typeof s=="function"){let u=s(e,c,o,{colors:t.colors});return t.message(u)}if(c in e&&!(typeof e[c]!="string"&&typeof e[c]!="number"&&typeof e[c]!="boolean"))return t.message(e[c])}});var Fe=h((_s,Zt)=>{"use strict";f();Zt.exports=Ui;function Ui({log:e,context:r}){let{customPrettifiers:t,colorizer:n}=r,i="";if(e.name||e.pid||e.hostname){if(i+="(",e.name&&(i+=t.name?t.name(e.name,"name",e,{colors:n.colors}):e.name),e.pid){let o=t.pid?t.pid(e.pid,"pid",e,{colors:n.colors}):e.pid;e.name&&e.pid?i+="/"+o:i+=o}if(e.hostname){let o=t.hostname?t.hostname(e.hostname,"hostname",e,{colors:n.colors}):e.hostname;i+=`${i==="("?"on":" on"} ${o}`}i+=")"}if(e.caller){let o=t.caller?t.caller(e.caller,"caller",e,{colors:n.colors}):e.caller;i+=`${i===""?"":" "}<${o}>`}if(i!=="")return i}});var Re=h((Bs,Xt)=>{"use strict";f();Xt.exports=Zi;var Ji=De();function Zi({log:e,context:r}){let{timestampKey:t,translateTime:n}=r,i=r.customPrettifiers?.time,o=null;if(t in e?o=e[t]:"timestamp"in e&&(o=e.timestamp),o===null)return;let s=n?Ji(o,n):o;return i?i(s):`[${s}]`}});var er=h((Ps,Qt)=>{"use strict";f();Qt.exports={buildSafeSonicBoom:pt(),createDate:Ee(),deleteLogProperty:Ce(),filterLog:Me(),formatTime:De(),getPropertyValue:G(),handleCustomLevelsNamesOpts:Te(),handleCustomLevelsOpts:_e(),interpretConditionals:ve(),isObject:fe(),isValidDate:oe(),joinLinesWithIndentation:Q(),noop:Le(),parseFactoryOptions:Ft(),prettifyErrorLog:qe(),prettifyError:Pe(),prettifyLevel:Ae(),prettifyMessage:Ke(),prettifyMetadata:Fe(),prettifyObject:ae(),prettifyTime:Re(),splitPropertyKey:se(),getLevelLabelData:re()}});var or=h((qs,Y)=>{"use strict";f();var Xi=typeof Buffer<"u",tr=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,rr=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function nr(e,r,t){t==null&&r!==null&&typeof r=="object"&&(t=r,r=void 0),Xi&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let n=JSON.parse(e,r);if(n===null||typeof n!="object")return n;let i=t&&t.protoAction||"error",o=t&&t.constructorAction||"error";if(i==="ignore"&&o==="ignore")return n;if(i!=="ignore"&&o!=="ignore"){if(tr.test(e)===!1&&rr.test(e)===!1)return n}else if(i!=="ignore"&&o==="ignore"){if(tr.test(e)===!1)return n}else if(rr.test(e)===!1)return n;return ir(n,{protoAction:i,constructorAction:o,safe:t&&t.safe})}function ir(e,{protoAction:r="error",constructorAction:t="error",safe:n}={}){let i=[e];for(;i.length;){let o=i;i=[];for(let s of o){if(r!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(n===!0)return null;if(r==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&s.constructor!==null&&typeof s.constructor=="object"&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(n===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let c in s){let d=s[c];d&&typeof d=="object"&&i.push(d)}}}return e}function Ie(e,r,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return nr(e,r,t)}finally{Error.stackTraceLimit=n}}function Qi(e,r){let{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return nr(e,r,{safe:!0})}catch{return}finally{Error.stackTraceLimit=t}}Y.exports=Ie;Y.exports.default=Ie;Y.exports.parse=Ie;Y.exports.safeParse=Qi;Y.exports.scan=ir});var ur=h((Ks,cr)=>{"use strict";f();cr.exports=ao;var eo=or(),sr=fe(),to=qe(),ro=Ae(),no=Ke(),io=Fe(),oo=ae(),so=Re(),co=Me(),{LEVELS:uo,LEVEL_KEY:fo,LEVEL_NAMES:$e}=P(),lo=e=>{try{return{value:eo.parse(e,{protoAction:"remove"})}}catch(r){return{err:r}}};function ao(e){let r;if(sr(e))r=e;else{let c=lo(e);if(c.err||!sr(c.value))return e+this.EOL;r=c.value}if(this.minimumLevel){let c;this.useOnlyCustomProps?c=this.customLevels:c=this.customLevelNames[this.minimumLevel]!==void 0;let d;if(c?d=this.customLevelNames[this.minimumLevel]:d=$e[this.minimumLevel],d||(d=typeof this.minimumLevel=="string"?$e[this.minimumLevel]:$e[uo[this.minimumLevel].toLowerCase()]),r[this.levelKey===void 0?fo:this.levelKey]<d)return}let t=no({log:r,context:this.context});(this.ignoreKeys||this.includeKeys)&&(r=co({log:r,context:this.context}));let n=ro({log:r,context:{...this.context,...this.context.customProperties}}),i=io({log:r,context:this.context}),o=so({log:r,context:this.context}),s="";if(this.levelFirst&&n&&(s=`${n}`),o&&s===""?s=`${o}`:o&&(s=`${s} ${o}`),!this.levelFirst&&n&&(s.length>0?s=`${s} ${n}`:s=n),i&&(s.length>0?s=`${s} ${i}:`:s=i),s.endsWith(":")===!1&&s!==""&&(s+=":"),t!==void 0&&(s.length>0?s=`${s} ${t}`:s=t),s.length>0&&!this.singleLine&&(s+=this.EOL),r.type==="Error"&&typeof r.stack=="string"){let c=to({log:r,context:this.context});this.singleLine&&(s+=this.EOL),s+=c}else if(this.hideObject===!1){let c=[this.messageKey,this.levelKey,this.timestampKey].map(u=>u.replaceAll(/\\/g,"")).filter(u=>typeof r[u]=="string"||typeof r[u]=="number"||typeof r[u]=="boolean"),d=oo({log:r,skipKeys:c,context:this.context});this.singleLine&&!/^\s$/.test(d)&&(s+=" "),s+=d}return s}});var Mo=h((Rs,K)=>{"use strict";f();var{isColorSupported:fr}=me(),yo=pr(),{Transform:po}=I("stream"),mo=nt(),go=Oe(),{ERROR_LIKE_KEYS:lr,LEVEL_KEY:ho,LEVEL_LABEL:bo,MESSAGE_KEY:Oo,TIMESTAMP_KEY:Lo}=P(),{buildSafeSonicBoom:Eo,parseFactoryOptions:Co}=er(),wo=ur(),So={colorize:fr,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:lr,errorProps:"",hideObject:!1,ignore:"hostname",include:void 0,levelFirst:!1,levelKey:ho,levelLabel:bo,messageFormat:null,messageKey:Oo,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:Lo,translateTime:!0,useOnlyCustomProps:!0};function We(e){let r=Co(Object.assign({},So,e));return wo.bind({...r,context:r})}function ye(e={}){let r=We(e),t;return mo(function(n){n.on("message",function o(s){!s||s.code!=="PINO_CONFIG"||(Object.assign(e,{messageKey:s.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||lr,s.config.errorKey])),customLevels:s.config.levels.values}),r=We(e),n.off("message",o))});let i=new po({objectMode:!0,autoDestroy:!0,transform(o,s,c){let d=r(o);c(null,d)}});return typeof e.destination=="object"&&typeof e.destination.write=="function"?t=e.destination:t=Eo({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),n.on("unknown",function(o){t.write(o+`
|
|
6
|
+
`)}),yo(n,i,t),i},{parse:"lines",close(n,i){t.on("close",()=>{i(n)})}})}K.exports=ye;K.exports.build=ye;K.exports.PinoPretty=ye;K.exports.prettyFactory=We;K.exports.colorizerFactory=go;K.exports.isColorSupported=fr;K.exports.default=ye});export{Mo as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as M,c as te,d as re,g as ke,h as $,i as ne,j as Te,k as Se,l as xe,m as oe}from"./chunk-Y7RZHZ53.mjs";import{a as Ee}from"./chunk-V3XZ4XYN.mjs";import{h as l}from"./chunk-VULBPPPP.mjs";l();l();var T={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},ir={defaultMerge:T.defaultMerge};function ct(t,e){return e}function ut(t,e){return t.filter(r=>r!==void 0)}var Oe;(function(t){t[t.NOT=0]="NOT",t[t.RECORD=1]="RECORD",t[t.ARRAY=2]="ARRAY",t[t.SET=3]="SET",t[t.MAP=4]="MAP",t[t.OTHER=5]="OTHER"})(Oe||(Oe={}));function Pe(t){return typeof t!="object"||t===null?0:Array.isArray(t)?2:dt(t)?1:t instanceof Set?3:t instanceof Map?4:5}function ft(t){let e=new Set;for(let r of t)for(let n of[...Object.keys(r),...Object.getOwnPropertySymbols(r)])e.add(n);return e}function lt(t,e){return typeof t=="object"&&Object.prototype.propertyIsEnumerable.call(t,e)}function Ce(t){let e=0,r=t[0]?.[Symbol.iterator]();return{[Symbol.iterator](){return{next(){do{if(r===void 0)return{done:!0,value:void 0};let n=r.next();if(n.done===!0){e+=1,r=t[e]?.[Symbol.iterator]();continue}return{done:!1,value:n.value}}while(!0)}}}}}var Me=["[object Object]","[object Module]"];function dt(t){if(!Me.includes(Object.prototype.toString.call(t)))return!1;let{constructor:e}=t;if(e===void 0)return!0;let r=e.prototype;return!(r===null||typeof r!="object"||!Me.includes(Object.prototype.toString.call(r))||!r.hasOwnProperty("isPrototypeOf"))}function ht(t,e,r){let n={};for(let o of ft(t)){let s=[];for(let a of t)lt(a,o)&&s.push(a[o]);if(s.length===0)continue;let i=e.metaDataUpdater(r,{key:o,parents:t}),c=Ae(s,e,i);c!==T.skip&&(o==="__proto__"?Object.defineProperty(n,o,{value:c,configurable:!0,enumerable:!0,writable:!0}):n[o]=c)}return n}function pt(t){return t.flat()}function mt(t){return new Set(Ce(t))}function gt(t){return new Map(Ce(t))}function yt(t){return t.at(-1)}var B={mergeRecords:ht,mergeArrays:pt,mergeSets:mt,mergeMaps:gt,mergeOthers:yt};function J(t,e){let r=wt(t,n);function n(...o){return Ae(o,r,e)}return n}function wt(t,e){return{defaultMergeFunctions:B,mergeFunctions:{...B,...Object.fromEntries(Object.entries(t).filter(([r,n])=>Object.hasOwn(B,r)).map(([r,n])=>n===!1?[r,B.mergeOthers]:[r,n]))},metaDataUpdater:t.metaDataUpdater??ct,deepmerge:e,useImplicitDefaultMerging:t.enableImplicitDefaultMerging??!1,filterValues:t.filterValues===!1?void 0:t.filterValues??ut,actions:T}}function Ae(t,e,r){let n=e.filterValues?.(t,r)??t;if(n.length===0)return;if(n.length===1)return se(n,e,r);let o=Pe(n[0]);if(o!==0&&o!==5){for(let s=1;s<n.length;s++)if(Pe(n[s])!==o)return se(n,e,r)}switch(o){case 1:return bt(n,e,r);case 2:return Rt(n,e,r);case 3:return Et(n,e,r);case 4:return kt(n,e,r);default:return se(n,e,r)}}function bt(t,e,r){let n=e.mergeFunctions.mergeRecords(t,e,r);return n===T.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeRecords!==e.defaultMergeFunctions.mergeRecords?e.defaultMergeFunctions.mergeRecords(t,e,r):n}function Rt(t,e,r){let n=e.mergeFunctions.mergeArrays(t,e,r);return n===T.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeArrays!==e.defaultMergeFunctions.mergeArrays?e.defaultMergeFunctions.mergeArrays(t):n}function Et(t,e,r){let n=e.mergeFunctions.mergeSets(t,e,r);return n===T.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeSets!==e.defaultMergeFunctions.mergeSets?e.defaultMergeFunctions.mergeSets(t):n}function kt(t,e,r){let n=e.mergeFunctions.mergeMaps(t,e,r);return n===T.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeMaps!==e.defaultMergeFunctions.mergeMaps?e.defaultMergeFunctions.mergeMaps(t):n}function se(t,e,r){let n=e.mergeFunctions.mergeOthers(t,e,r);return n===T.defaultMerge||e.useImplicitDefaultMerging&&n===void 0&&e.mergeFunctions.mergeOthers!==e.defaultMergeFunctions.mergeOthers?e.defaultMergeFunctions.mergeOthers(t):n}l();l();l();l();var R=class extends Error{name="KyError";get isKyError(){return!0}};var E=class extends R{name="HTTPError";response;request;options;data;constructor(e,r,n){let o=e.status||e.status===0?e.status:"",s=e.statusText??"",i=`${o} ${s}`.trim(),c=i?`status code ${i}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.response=e,this.request=r,this.options=n}};l();var C=class extends R{name="NetworkError";request;constructor(e,r){super(`Request failed due to a network error: ${e.method} ${e.url}`,r),this.request=e}};l();var A=class extends Error{name="NonError";value;constructor(e){let r="Non-error value was thrown";try{typeof e=="string"?r=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(r=e.message)}catch{}super(r),this.value=e}};l();var x=class extends R{name="ForceRetryError";customDelay;code;customRequest;constructor(e){let r=e?.cause?e.cause instanceof Error?e.cause:new A(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",r?{cause:r}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};l();var V=class extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}};l();var b=class extends R{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}};l();l();var ie=(()=>{let t=!1,e=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(o){if(o instanceof Error&&o.message==="unsupported BodyInit type")return!1;throw o}return t&&!e})(),je=typeof globalThis.AbortController=="function",W=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",qe=typeof globalThis.ReadableStream=="function",Ie=typeof globalThis.FormData=="function",K=["get","post","put","patch","head","delete"],Tt=()=>{};Tt();var Fe={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},j=2147483647,ve=40,Y=Symbol("stop"),N=class{options;constructor(e){this.options=e}},Ne=t=>new N(t),Le={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},_e={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var X=new TextEncoder,St=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(let[r,n]of t)e+=ve,e+=X.encode(`Content-Disposition: form-data; name="${r}"`).byteLength,e+=typeof n=="string"?X.encode(n).byteLength:n.size;return e}return t instanceof Blob?t.size:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:typeof t=="string"?X.encode(t).byteLength:t instanceof URLSearchParams?X.encode(t.toString()).byteLength:0},De=(t,e,r)=>{let n,o=0;return t.pipeThrough(new TransformStream({transform(s,i){if(i.enqueue(s),n){o+=n.byteLength;let c=e===0?0:o/e;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(e,o),transferredBytes:o},n)}n=s},flush(){n&&(o+=n.byteLength,r?.({percent:1,totalBytes:Math.max(e,o),transferredBytes:o},n))}}))},Ue=(t,e)=>{if(!t.body)return t;let r={status:t.status,statusText:t.statusText,headers:t.headers};if(t.status===204)return new Response(null,r);let n=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(De(t.body,n,e),r)},ze=(t,e,r)=>{if(!t.body)return t;let n=St(r??t.body);return new Request(t,{duplex:"half",body:De(t.body,n,e)})};l();l();var k=t=>t!==null&&typeof t=="object";var xt=Symbol("replaceOption"),ae=t=>k(t)&&t[xt]===!0?{isReplace:!0,value:t.value}:{isReplace:!1,value:t};var _=(...t)=>{for(let e of t)if((!k(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return fe({},...t)},ue=(t={},e={})=>{let r=new globalThis.Headers(t),n=e instanceof globalThis.Headers,o=new globalThis.Headers(e);for(let[s,i]of o.entries())n&&i==="undefined"||i===void 0?r.delete(s):r.set(s,i);return r},ce=t=>{if(!k(t)||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},q=t=>{if(t instanceof URLSearchParams){let e=new URLSearchParams(t),r=t[S];return r&&(e[S]=new Set(r)),e}return t instanceof globalThis.Headers?new globalThis.Headers(t):Array.isArray(t)?[...t]:ce(t)?{...t}:t},Ot=t=>Object.fromEntries(Object.entries(t).filter(e=>e[1]!==void 0)),Pt=(t,e)=>ce(t)&&ce(e)?Ot({...t,...e}):ue(t,e);function L(t,e,r){return Object.hasOwn(e,r)&&e[r]===void 0?[]:fe(t[r]??[],e[r]??[])}var G=(t={},e={})=>({init:L(t,e,"init"),beforeRequest:L(t,e,"beforeRequest"),beforeRetry:L(t,e,"beforeRetry"),beforeError:L(t,e,"beforeError"),afterResponse:L(t,e,"afterResponse")}),S=Symbol("deletedParameters"),Mt=(t,e)=>{let r=new URLSearchParams,n=new Set;for(let o of[t,e])if(o!==void 0)if(o instanceof URLSearchParams){for(let[i,c]of o.entries())r.append(i,c),n.delete(i);let s=o[S];if(s)for(let i of s)r.delete(i),n.add(i)}else if(Array.isArray(o))for(let s of o){if(!Array.isArray(s)||s.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(s[0]),String(s[1])),n.delete(String(s[0]))}else if(k(o))for(let[s,i]of Object.entries(o))i===void 0?(r.delete(s),n.add(s)):(r.append(s,String(i)),n.delete(s));else{let s=new URLSearchParams(o);for(let[i,c]of s.entries())r.append(i,c),n.delete(i)}return n.size>0&&(r[S]=n),r},fe=(...t)=>{let e={},r={},n={},o,s=[];for(let i of t)if(Array.isArray(i))Array.isArray(e)||(e=[]),e=[...e,...i];else if(k(i)){for(let[c,a]of Object.entries(i)){if(c==="signal"&&a instanceof globalThis.AbortSignal){s.push(a);continue}let f=ae(a),{isReplace:u}=f;if(a=f.value,c==="context"){if(a!=null&&(!k(a)||Array.isArray(a)))throw new TypeError("The `context` option must be an object");e={...e,context:a==null?{}:u?{...a}:{...e.context,...a}};continue}if(c==="searchParams"){a==null?o=void 0:u?o=a:o=o===void 0?a:Mt(o,a);continue}k(a)&&!u&&c in e&&(a=fe(e[c],a)),e={...e,[c]:a}}if(k(i.hooks)){let{value:c,isReplace:a}=ae(i.hooks);n=G(a?{}:n,c),e.hooks=n}if(k(i.headers)){let{value:c,isReplace:a}=ae(i.headers);r=a?q(c):Pt(r,c),e.headers=r}}return o!==void 0&&(e.searchParams=o),s.length>0&&(s.length===1?e.signal=s[0]:W?e.signal=AbortSignal.any(s):e.signal=s.at(-1)),e};l();var $e=t=>K.includes(t)?t.toUpperCase():t,Ct=["get","put","head","delete","options","trace"],At=[408,413,429,500,502,503,504],jt=[413,429,503],He={limit:2,methods:Ct,statusCodes:At,afterStatusCodes:jt,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},Be=(t={})=>{if(typeof t=="number")return{...He,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");let e=Object.fromEntries(Object.entries({...t,methods:t.methods?.map(r=>r.toLowerCase())}).filter(([,r])=>r!==void 0));return{...He,...e}};l();async function le(t,e,r,n){return new Promise((o,s)=>{let i=setTimeout(()=>{r&&r.abort(),s(new b(t))},n.timeout);n.fetch(t,e).then(o).catch(s).then(()=>{clearTimeout(i)})})}l();async function Q(t,{signal:e}){return new Promise((r,n)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",o,{once:!0}));function o(){clearTimeout(s),n(e.reason)}let s=setTimeout(()=>{e?.removeEventListener("abort",o),r()},t)})}l();var Je=t=>{let e={};for(let r in t)Object.hasOwn(t,r)&&!(r in _e)&&!(r in Le)&&(e[r]=t[r]);return e},Ve=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0||!!t[S]?.size:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;l();var qt=Object.prototype.toString,It=t=>qt.call(t)==="[object Error]",Ft=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function de(t){if(!(t&&It(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")||r==="Failed to fetch"||r.startsWith("Failed to fetch (")&&r.endsWith(")")?!0:Ft.has(r)}l();var he=(t,e)=>t instanceof e||t?.name===e.name;function We(t){return he(t,E)}function Ke(t){return he(t,C)}function Ye(t){return he(t,b)}var vt=10*1024*1024,Nt="The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl",D=Symbol("timedOutResponseData"),Lt=t=>{let e=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(t),r=e?.[1]??e?.[2];if(r)try{return new TextDecoder(r)}catch{}return new TextDecoder},Xe="The `schema` argument must follow the Standard Schema specification",_t=t=>typeof t!="object"?t:{...t,...t.methods&&{methods:[...t.methods]},...t.statusCodes&&{statusCodes:[...t.statusCodes]},...t.afterStatusCodes&&{afterStatusCodes:[...t.afterStatusCodes]}},Ze=Object.prototype.toString,Ge=t=>t instanceof globalThis.Request||Ze.call(t)==="[object Request]",U=t=>t instanceof globalThis.Response||Ze.call(t)==="[object Response]",Dt=t=>Array.isArray(t)?t.map(e=>[...e]):q(t);function Ut(t){let e={...t,json:q(t.json),context:q(t.context),headers:q(t.headers),searchParams:Dt(t.searchParams)};return t.retry!==void 0&&(e.retry=_t(t.retry)),e}var Qe=async(t,e)=>{if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError(Xe);let r=e["~standard"];if(typeof r!="object"||r===null||typeof r.validate!="function")throw new TypeError(Xe);let n=await r.validate(t);if(n.issues)throw new V(n.issues);return n.value},z=class t{static create(e,r){let n=r.hooks?.init??[],o=n.length>0?Ut(r):r;for(let a of n)a(o);let s=new t(e,o),i=async()=>{if(typeof s.#e.timeout=="number"&&s.#e.timeout>j)throw new RangeError(`The \`timeout\` option cannot be greater than ${j}`);if(typeof s.#e.totalTimeout=="number"&&s.#e.totalTimeout>j)throw new RangeError(`The \`totalTimeout\` option cannot be greater than ${j}`);await Promise.resolve();let a=await s.#F(),f=a??await s.#P(async()=>s.#w()),u=a!==void 0||s.#y();for(;;){if(f===void 0)return f;if(U(f))try{f=await s.#v(f)}catch(m){if(!(m instanceof x))throw m;let w=await s.#g(m,async()=>s.#w());if(w===void 0)return w;f=w,u=s.#y();continue}let d=f;if(!d.ok&&d.type!=="opaque"&&(typeof s.#e.throwHttpErrors=="function"?s.#e.throwHttpErrors(d.status):s.#e.throwHttpErrors)){let m=new E(d,s.#a(d),s.#i()),w=m;if(m.data=await s.#A(d),u)throw w;let g=await s.#g(m,async()=>s.#w());if(g===void 0)return g;f=g,u=s.#y();continue}break}if(!U(f))return f;if(s.#S(f),s.#e.onDownloadProgress){if(typeof s.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!qe)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");let d=f.clone();return s.#n(f),Ue(d,s.#e.onDownloadProgress)}return f},c=(async()=>{try{return await i()}catch(a){if(!(a instanceof Error)||s.#k.has(a))throw a;let f=a;for(let u of s.#e.hooks.beforeError){let d=await u({request:s.request,options:s.#i(),error:f,retryCount:s.#r});d instanceof Error&&(f=d)}throw f}finally{let a=s.#E;s.#m(a?.body??void 0),s.request!==a&&s.#m(s.request.body??void 0)}})();for(let[a,f]of Object.entries(Fe))a==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(c[a]=async u=>{s.request.headers.set("accept",s.request.headers.get("accept")||f);let d=await c;if(a!=="json")return d[a]();let m=await d.text();if(m==="")return u!==void 0?Qe(void 0,u):JSON.parse(m);let w=o.parseJson?await o.parseJson(m,{request:s.#a(d),response:d}):JSON.parse(m);return u===void 0?w:Qe(w,u)});return c}static#c(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0)):e}request;#o;#r=0;#t;#e;#E;#u;#k=new WeakSet;#f;#p;#l=!1;#T=new WeakMap;constructor(e,r={}){if(this.#t=e,Object.hasOwn(r,"prefixUrl"))throw new Error(Nt);if(this.#e={...r,headers:ue(this.#t.headers,r.headers),hooks:G({},r.hooks),method:$e(r.method??this.#t.method??"GET"),prefix:String(r.prefix||""),retry:Be(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,totalTimeout:r.totalTimeout??!1,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(typeof this.#t=="string"){if(this.#e.prefix){let o=this.#e.prefix.replace(/\/+$/,""),s=this.#t.replace(/^\/+/,"");this.#t=`${o}/${s}`}if(this.#e.baseUrl){let o;try{o=new URL(this.#t)}catch{}o||(this.#t=new URL(this.#t,new Request(this.#e.baseUrl).url))}}je&&W&&(this.#u=this.#e.signal??this.#t.signal,this.#o=new globalThis.AbortController,this.#e.signal=this.#O()),ie&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));let n=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(Ie&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!n&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),Ve(this.#e.searchParams)){let o=new URL(this.request.url),s=this.#e.searchParams?.[S];if(s)for(let i of s)o.searchParams.delete(i);if(typeof this.#e.searchParams=="string"){let i=this.#e.searchParams.replace(/^\?/,"");i!==""&&(o.search=o.search?`${o.search}&${i}`:`?${i}`)}else{let i=new URLSearchParams(t.#c(this.#e.searchParams));for(let[c,a]of i.entries())o.searchParams.append(c,a)}if(this.#e.searchParams&&typeof this.#e.searchParams=="object"&&!Array.isArray(this.#e.searchParams)&&!(this.#e.searchParams instanceof URLSearchParams))for(let[i,c]of Object.entries(this.#e.searchParams))c===void 0&&o.searchParams.delete(i);this.request=new globalThis.Request(o,this.#e)}if(this.#e.onUploadProgress&&typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");this.#p=typeof this.#e.totalTimeout=="number"?this.#M():void 0}#s(){let e=this.#e.retry.delay(this.#r+1),r=e;return this.#e.retry.jitter===!0?r=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(r=this.#e.retry.jitter(e),(!Number.isFinite(r)||r<0)&&(r=e)),Math.min(this.#e.retry.backoffLimit,r)}async#C(e){if(this.#r>=this.#e.retry.limit)throw e;let r=e instanceof Error?e:new A(e);if(r instanceof x)return r.customDelay??this.#s();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){let n=await this.#e.retry.shouldRetry({error:r,retryCount:this.#r+1});if(n===!1)throw e;if(n===!0)return this.#s()}if(Ye(e)){if(!this.#e.retry.retryOnTimeout)throw e;return this.#s()}if(We(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let n=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let o=Number(n)*1e3;return Number.isNaN(o)?o=Date.parse(n)-Date.now():o>=Date.parse("2024-01-01")&&(o-=Date.now()),Number.isFinite(o)?(o=Math.max(0,o),Math.min(this.#e.retry.maxRetryAfter,o)):Math.min(this.#e.retry.maxRetryAfter,this.#s())}if(e.response.status===413)throw e;return this.#s()}if(!Ke(e))throw e;return this.#s()}#S(e){let r=this.#a(e);return this.#e.parseJson&&(e.json=async()=>{let n=await e.text();return n===""?JSON.parse(n):this.#e.parseJson(n,{request:r,response:e})}),e}async#A(e){let r=await this.#q(e,this.#x());if(r===D){this.#d();return}if(!r)return;if(!this.#j(e.headers.get("content-type")??""))return r;let n=await this.#I(r,e,this.#x(),this.#a(e));if(n===D){this.#d();return}return n}#x(){let e=this.#e.timeout===!1?1e4:this.#e.timeout,r=this.#h();if(r===void 0)return e;if(r<=0)throw new b(this.request);return Math.min(e,r)}#j(e){let r=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(r)}async#q(e,r){let{body:n}=e;if(!n)try{return await e.text()}catch{return}let o;try{o=n.getReader()}catch{return}let s=Lt(e.headers.get("content-type")??""),i=[],c=0,a=(async()=>{try{for(;;){let{done:d,value:m}=await o.read();if(d)break;if(c+=m.byteLength,c>vt){o.cancel().catch(()=>{});return}i.push(s.decode(m,{stream:!0}))}}catch{return}return i.push(s.decode()),i.join("")})(),f=new Promise(d=>{let m=setTimeout(()=>{d(D)},r);a.finally(()=>{clearTimeout(m)})}),u=await Promise.race([a,f]);return u===D&&o.cancel().catch(()=>{}),u}async#I(e,r,n,o){let s;try{return await Promise.race([Promise.resolve().then(()=>this.#e.parseJson?this.#e.parseJson(e,{request:o,response:r}):JSON.parse(e)),new Promise(i=>{s=setTimeout(()=>{i(D)},n)})])}catch{return}finally{clearTimeout(s)}}#m(e){e&&e.cancel().catch(()=>{})}#n(e){this.#m(e.body??void 0)}#O(){return this.#u?AbortSignal.any([this.#u,this.#o.signal]):this.#o.signal}#d(){let e=this.#h();if(e!==void 0&&e<=0)throw new b(this.request)}async#F(){for(let e of this.#e.hooks.beforeRequest){let r=await e({request:this.request,options:this.#i(),retryCount:0});if(Ge(r))this.#b(r);else if(U(r))return r}}async#v(e){let r=this.#a(e);for(let n of this.#e.hooks.afterResponse){let o=this.#R(e.clone(),r);this.#S(o);let s;try{s=await n({request:this.request,options:this.#i(),response:o,retryCount:this.#r})}catch(c){throw o!==e&&this.#n(o),this.#n(e),c}if(s instanceof N)throw o!==e&&this.#n(o),this.#n(e),new x(s.options);let i=U(s)?this.#R(s,r):e;o!==e&&o!==i&&o.body!==i.body&&this.#n(o),e!==i&&e.body!==i.body&&this.#n(e),e=i}return e}async#P(e){try{return await e()}catch(r){return this.#g(r,e)}}async#g(e,r){this.#l=!1;let n=Math.min(await this.#C(e),j),o={signal:this.#u},s=this.#h();if(s!==void 0){if(s<=0)throw new b(this.request);if(n>=s)throw await Q(s,o),new b(this.request)}if(await Q(n,o),this.#d(),e instanceof x&&e.customRequest){let i=new globalThis.Request(e.customRequest,this.#e.signal?{signal:this.#e.signal}:void 0);this.#b(i)}for(let i of this.#e.hooks.beforeRetry){let c;try{c=await i({request:this.request,options:this.#i(),error:e,retryCount:this.#r+1})}catch(a){throw a instanceof Error&&a!==e&&this.#k.add(a),a}if(Ge(c)){this.#b(c);break}if(U(c))return this.#l=!0,this.#r++,c;if(c===Y)return}return this.#d(),this.#r++,this.#P(r)}#y(){let e=this.#l;return this.#l=!1,e}async#w(){this.#o?.signal.aborted&&(this.#o=new globalThis.AbortController,this.#e.signal=this.#O(),this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));let e=Je(this.#e),r=this.#e.retry.limit>0?this.request.clone():void 0,n=this.#N(this.request,this.#e.body??void 0);this.#E=n,r&&(this.request=r);try{let o=this.#h();if(o!==void 0&&o<=0)throw new b(this.request);let s=this.#e.timeout===!1?o:o===void 0?this.#e.timeout:Math.min(this.#e.timeout,o),i=s===void 0?await this.#e.fetch(n,e):await le(n,e,this.#o,{timeout:s,fetch:this.#e.fetch});return this.#R(i,n)}catch(o){throw de(o)?new C(this.request,{cause:o}):o}}#h(){if(this.#p===void 0)return;let e=this.#M()-this.#p;return Math.max(0,this.#e.totalTimeout-e)}#M(){return globalThis.performance?.now()??Date.now()}#i(){if(!this.#f){let{hooks:e,json:r,parseJson:n,stringifyJson:o,searchParams:s,timeout:i,totalTimeout:c,throwHttpErrors:a,fetch:f,...u}=this.#e;this.#f=Object.freeze(u)}return this.#f}#b(e){this.#f=void 0,this.request=e}#a(e){return this.#T.get(e)??this.request}#R(e,r){return this.#T.set(e,r),e}#N(e,r){return!this.#e.onUploadProgress||!e.body||!ie?e:ze(e,this.#e.onUploadProgress,r??this.#e.body??void 0)}};var pe=t=>{let e=(r,n)=>z.create(r,_(t,n));for(let r of K)e[r]=(n,o)=>z.create(n,_(t,o,{method:r}));return e.create=r=>pe(_(r)),e.extend=r=>(typeof r=="function"&&(r=r(t??{})),pe(_(t,r))),e.stop=Y,e.retry=Ne,e},zt=pe(),et=zt;l();l();var tt=Symbol("isNonError");function Z(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,enumerable:!1,configurable:!1})}function Ht(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(typeof t=="bigint")return`${t}n`;if(typeof t=="symbol")return t.toString();if(typeof t=="function")return`[Function${t.name?` ${t.name}`:" (anonymous)"}]`;if(t instanceof Error)try{return String(t)}catch{return"<Unserializable error>"}try{return JSON.stringify(t)}catch{try{return String(t)}catch{return"<Unserializable value>"}}}var I=class t extends Error{constructor(e,{superclass:r=Error}={}){if(t.isNonError(e))return e;if(e instanceof Error)throw new TypeError("Do not pass Error instances to NonError. Throw the error directly instead.");super(`Non-error value: ${Ht(e)}`),r!==Error&&Object.setPrototypeOf(this,r.prototype),Z(this,"name","NonError"),Z(this,tt,!0),Z(this,"isNonError",!0),Z(this,"value",e)}static isNonError(e){return e?.[tt]===!0}static#c(e,r){try{let n=e(...r);return n&&typeof n.then=="function"?(async()=>{try{return await n}catch(o){throw o instanceof Error?o:new t(o)}})():n}catch(n){throw n instanceof Error?n:new t(n)}}static try(e){return t.#c(e,[])}static wrap(e){return(...r)=>t.#c(e,r)}static[Symbol.hasInstance](e){return t.isNonError(e)}};l();var $t=[Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(t=>[t.name,t]),rt=new Map($t),nt=new Map;var Bt=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1},{property:"errors",enumerable:!1}],me=new WeakSet,Jt=t=>{me.add(t);let e=t.toJSON();return me.delete(t),e},Vt=t=>{if(t==="NonError")return new I;let e=nt.get(t);if(e)return e();let r=rt.get(t)??Error;return r===AggregateError?new r([]):new r},ge=({from:t,seen:e,to:r,forceEnumerable:n,maxDepth:o,depth:s,useToJSON:i,serialize:c})=>{if(r||(Array.isArray(t)?r=[]:!c&&Wt(t)?r=Vt(t.name):r={}),e.add(t),s>=o)return e.delete(t),r;if(i&&typeof t.toJSON=="function"&&!me.has(t))return e.delete(t),Jt(t);let a=f=>ge({from:f,seen:e,forceEnumerable:n,maxDepth:o,depth:s+1,useToJSON:i,serialize:c});for(let f of Object.keys(t)){let u=t[f];if(u&&u instanceof Uint8Array&&u.constructor.name==="Buffer"){r[f]=c?"[object Buffer]":u;continue}if(u!==null&&typeof u=="object"&&typeof u.pipe=="function"){r[f]=c?"[object Stream]":u;continue}if(typeof u=="function"){c||(r[f]=u);continue}if(c&&typeof u=="bigint"){r[f]=`${u}n`;continue}if(!u||typeof u!="object"){try{r[f]=u}catch{}continue}if(!e.has(u)){r[f]=a(u);continue}r[f]="[Circular]"}if(c||r instanceof Error)for(let{property:f,enumerable:u}of Bt){let d=t[f];if(d==null||Object.getOwnPropertyDescriptor(r,f)?.configurable===!1)continue;let w=d;typeof d=="object"&&(w=e.has(d)?"[Circular]":a(d)),Object.defineProperty(r,f,{value:w,enumerable:n||u,configurable:!0,writable:!0})}return e.delete(t),r};function O(t,e={}){let{maxDepth:r=Number.POSITIVE_INFINITY,useToJSON:n=!0}=e;return typeof t=="object"&&t!==null?ge({from:t,seen:new Set,forceEnumerable:!0,maxDepth:r,depth:0,useToJSON:n,serialize:!0}):(typeof t=="function"&&(t="<Function>"),ge({from:new I(t),seen:new Set,forceEnumerable:!0,maxDepth:r,depth:0,useToJSON:n,serialize:!0}))}function Wt(t){return!!t&&typeof t=="object"&&typeof t.name=="string"&&typeof t.message=="string"&&typeof t.stack=="string"}l();l();import{EventEmitter as Yt}from"events";var ye={markets:{chromeVersion:"146",nasdaq:{statusEndpoint:"https://api.nasdaq.com/api/market-info",monitor:{liveIntervalSec:10,closedIntervalSec:3600,warnIntervalSec:60},symbols:{nasdaqListedUrl:"https://www.nasdaqtrader.com/dynamic/symdir/nasdaqlisted.txt",otherListedUrl:"https://www.nasdaqtrader.com/dynamic/symdir/otherlisted.txt",initialBackoffMs:1e3,maxRetryBackoffMs:36e5,maxFetchRetries:10},quotes:{concurrencyLimit:5}}},retrieve:{timeout:5e4,retry:{limit:5,backoffLimit:3e3}}};l();async function ot(t){let{getEnv:e}=await import("./utils-KMHFLZAJ.mjs"),r=(await import("crypto")).default,n=e("CORELIB_AES_PASSWORD");if(!n)throw new Error("Decryption failed: CORELIB_AES_PASSWORD environment variable is not set.");let o=t.split(`
|
|
3
|
+
`).map(u=>u.trim()).filter(Boolean);if(o.length<2)throw new Error("Invalid .enc file format. Expected IV on line 1 and Ciphertext on line 2.");let s=Buffer.from(o[0],"base64"),i=Buffer.from(o[1],"base64"),c=Buffer.from(n,"hex"),a=r.createDecipheriv("aes-256-cbc",c,s),f=a.update(i);return f=Buffer.concat([f,a.final()]),JSON.parse(f.toString("utf8"))}var we=J({mergeArrays:!1}),Xt=t=>!t.split(/[.-]/).some(e=>e==="__proto__"||e==="constructor"||e==="prototype");function F(t,e){for(let r of Object.keys(t))r in e||delete t[r];for(let r of Object.keys(e)){let n=e[r];n&&typeof n=="object"&&!Array.isArray(n)?((!t[r]||typeof t[r]!="object"||Array.isArray(t[r]))&&(t[r]={}),F(t[r],n)):t[r]=n}}function Gt(t,e,r,n){let o=t;for(;;){if(r(e.join(o,"pnpm-workspace.yaml")))return e.basename(o);let s=e.join(o,"package.json");if(r(s))try{if(JSON.parse(n(s)).workspaces)return e.basename(o)}catch{}let i=e.dirname(o);if(i===o)break;o=i}return e.basename(t)}var P=class t extends Yt{static instance;_config={};_defaultsPath;static _logger=M.child({section:"ConfigManager"});_initPromise=null;_isInitialized=!1;_mutationChain=Promise.resolve();_inFlightTempConfig=null;static _prematureWarnEmitted=!1;constructor(){super();let e=Se(),r=e;try{let{join:n}=re()("node:path");r=n(e,"ConfigManager.json")}catch{r=`${e}/ConfigManager.json`}this._defaultsPath=r,F(this._config,ye),globalThis.sysconfig=this._config}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(e){!this._isInitialized&&!t._prematureWarnEmitted&&oe()!=="production"&&(t._prematureWarnEmitted=!0,t._logger.warn(`ConfigManager.get("${e}") called before initialize() resolved; returning seeded default`));let r=e.split("."),n=this._config;for(let o of r){if(n===null||typeof n!="object"||!(o in n))return;n=n[o]}return n}static get(e){return t.getInstance().get(e)}initialize(e){return this._initPromise?this._initPromise:(this._initPromise=this._enqueue(()=>this.runInitSequence(e)).then(()=>{this._isInitialized=!0,this._initPromise=null},r=>{throw this._initPromise=null,r}),this._initPromise)}async runInitSequence(e){t._logger.trace("initialize: start");let r=e??(typeof process<"u"&&Array.isArray(process.argv)?process.argv.slice(2):[]),n,o={};for(let i=0;i<r.length;i++){let c=r[i];if(c==="-C"||c==="--config"){i+1<r.length&&!r[i+1].startsWith("-")&&(n=r[++i]);continue}if(c.startsWith("--config=")){n=c.slice(9);continue}if(!c.startsWith("--"))continue;let a=c.slice(2);if(a===""||a.startsWith("="))continue;let f,u=a.indexOf("=");u>-1?(f=a.slice(u+1),a=a.slice(0,u)):i+1<r.length&&!r[i+1].startsWith("-")?f=r[++i]:f=!0,o[a]=f}t._logger.trace("initialize: resolved",{hasConfigPath:n!=null,overrideCount:Object.keys(o).length});let s={};this._inFlightTempConfig=s;try{if(this.loadDefaults(s),n){let i=await this.fetchExternalConfig(n);this.processHierarchy(i,s)}this.applyEnvOverrides(s),this.applyCliOverrides(o,s),F(this._config,s),t._logger.trace("initialize: committed",{keys:Object.keys(this._config??{}).length}),this.emit("initialized",this._config)}finally{this._inFlightTempConfig=null}}_enqueue(e){let r=this._mutationChain.then(e,e);return this._mutationChain=r.then(()=>{},()=>{}),r}getConfig(){return this._config}get isInitialized(){return this._isInitialized}whenReady(){return this._isInitialized?Promise.resolve():this._initPromise??Promise.resolve()}loadExternalConfig(e){return this._enqueue(()=>this.loadExternalConfigInner(e))}async loadExternalConfigInner(e){try{let r=await this.fetchExternalConfig(e),n=structuredClone(this._config);this._inFlightTempConfig=n;try{this.processHierarchy(r,n),this.applyEnvOverrides(n),F(this._config,n),this.emit("configLoaded",this._config)}finally{this._inFlightTempConfig=null}}catch(r){throw this.logError(`Failed to load external config dynamically from ${e}`,r),r}}loadDefaults(e){let r={...ye};if(ne(this._defaultsPath))try{r=JSON.parse($(this._defaultsPath))}catch(n){this.logError("Failed to load defaults",n)}F(e,r)}async fetchExternalConfig(e){t._logger.trace("external config",{source:e.startsWith("http")?"http":"file"});let r;if(e.startsWith("http")){let{endPoint:s}=await import("./RequestUnlimited-EKXQGSQT.mjs"),i=await s(e);if(i.status==="error")throw new Error("Failed to fetch external config");r=i.value.body}else r=$(e);let n=e.toLowerCase();if(n.endsWith(".enc")){t._logger.trace("decrypting .enc config");let s=this.validateConfigObject(await ot(r),e);return t._logger.trace("decryption ok"),s}let o=await import("./dist-VV3A6A7N.mjs");return n.endsWith(".yaml")||n.endsWith(".yml")?this.validateConfigObject(o.parseYAML(r),e):n.endsWith(".toml")?this.validateConfigObject(o.parseTOML(r),e):n.endsWith(".json5")?this.validateConfigObject(o.parseJSON5(r),e):n.endsWith(".jsonc")?this.validateConfigObject(o.parseJSONC(r),e):n.endsWith(".ini")?this.validateConfigObject(o.parseINI(r),e):this.validateConfigObject(o.parseJSON(r),e)}validateConfigObject(e,r){if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`Config from "${r}" must be a JSON object, got ${Array.isArray(e)?"array":typeof e}`);return e}processHierarchy(e,r){if(!e)return;let n=this.getAppName(),o=xe(),s=oe(),i=e.commonAll||{},c=Object.keys(e).find(u=>u.toLowerCase()===n.toLowerCase()),a=c?e[c]:null;if(a){a.common&&(i=we(i,a.common));let u=a[o];if(u){let d=u[s];d&&(i=we(i,d))}}let f=we(r,i);F(r,f)}applyEnvOverrides(e){let r="CORELIB_",n=ke();Object.keys(n).forEach(o=>{if(o.startsWith(r)){let s=o.slice(r.length).toLowerCase().replace(/_/g,".");t._logger.trace("env override",{key:s});let i=this.parseValue(n[o]);this.setPath(e,s,i)}})}applyCliOverrides(e,r){Object.keys(e).forEach(n=>{if(n==="config")return;if(!Xt(n)){t._logger.warn(`Dropped unsafe CLI override key "${n}" (prototype-pollution guard)`);return}let o=n.replace(/-/g,".");t._logger.trace("cli override",{key:o});let s=this.parseValue(e[n]);this.setPath(r,o,s)})}updateValue(e,r){this.setPath(this._config,e,r),this._inFlightTempConfig!==null&&this.setPath(this._inFlightTempConfig,e,r),this.emit("change",{path:e,value:r}),this.emit(`change:${e}`,r)}setPath(e,r,n){let o=r.split("."),s=e;for(;o.length>1;){let i=o.shift();(!(i in s)||typeof s[i]!="object"||s[i]===null)&&(s[i]={}),s=s[i]}s[o[0]]=n}parseValue(e){if(typeof e!="string")return e;if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}"))try{return JSON.parse(e)}catch(r){return this.logError("Failed to parse complex JSON from CLI/Env flag",r),e}return e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:!Number.isNaN(Number(e))&&e.trim()!==""?Number(e):e}getAppName(){try{let e=Ee();if(e==="node"||e==="bun"||typeof import.meta<"u"&&import.meta.url&&import.meta.url.startsWith("file:")){let r=re()("node:path");return Gt(Te(),r,n=>ne(n),n=>$(n))}return"edge-app"}catch(e){return this.logError("Failed to get app name from cwd. Falling back to default-app",e),"default-app"}}logError(e,r){let n=r?O(r):void 0;t._logger.error(e,{error:n})}toJsonString(){return JSON.stringify(this._config)}toBuffer(){return Buffer.from(this.toJsonString())}__resetForTests(){this._initPromise=null,this._isInitialized=!1,this._inFlightTempConfig=null,this._mutationChain=Promise.resolve(),t._prematureWarnEmitted=!1}};l();var Qt=M.child({section:"RequestResponseSerialize"});async function be(t){if(!t)return null;let e={};t.headers.forEach((o,s)=>{e[s.toLowerCase()]=o});let r,n=t.headers.get("content-type")||"";try{if(t.bodyUsed)r="[Body already consumed]";else{let o=await t.clone().text();if(n.includes("application/json"))try{r=JSON.parse(o)}catch{r=o}else r=o}}catch(o){Qt.warn("Failed to read response body",{status:t.status,url:t.url,bodyUsed:t.bodyUsed,error:O(o)}),r="[Error reading body]"}return{ok:t.ok,status:t.status,statusText:t.statusText,headers:e,url:t.url,redirected:t.redirected,type:t.type,body:r}}var y=M.child({section:"RequestUnlimited"}),Zt=J({mergeArrays:!1}),er=10,tr=1e3,rr=12e4,nr=6e4;function Re(t,e,r,n){return typeof t!="number"||!Number.isFinite(t)?n:Math.min(r,Math.max(e,t))}function st(t){try{let e=t instanceof URL?t:new URL(t instanceof Request?t.url:t);return`${e.origin}${e.pathname}`}catch{return"[unparseable url]"}}function or(t,e){let r=Math.min(e,300*2**(t-1)),n=Math.round(Math.random()*r);return y.trace("retry delay computed",{attempt:t,base:r,cap:e,delayMs:n}),n}var H={timeout:5e4,throwHttpErrors:!0,retry:{limit:5,methods:["get","post","put","delete","patch"],backoffLimit:3e3,shouldRetry:({error:t,retryCount:e})=>{if(t instanceof E&&t.response){let r=t.response.status;if(r===429&&e<=5)return y.trace("retry decision",{status:r,willRetry:!0}),!0;if(r>=400&&r<500)return y.trace("retry decision: skip",{status:r,willRetry:!1}),!1;let n=r>=500;return y.trace(n?"retry decision":"retry decision: skip",{status:r,willRetry:n}),n}return y.trace("retry decision",{willRetry:!0}),!0}},method:"get",headers:{"content-type":"application/json",accept:"application/json"},hooks:{beforeRetry:[]}};function it(t){let e={};for(let r in t)Object.hasOwn(t,r)&&t[r]!==void 0&&(e[r.toLowerCase()]=t[r]);return e}async function at(t,e={}){let r=it(H.headers||{}),n=e.headers?it(e.headers):{},{headers:o,hooks:s,...i}=e,c=Re(P.get("retrieve.timeout"),tr,rr,5e4),a=Re(P.get("retrieve.retry.limit"),0,er,5),f=Re(P.get("retrieve.retry.backoffLimit"),0,nr,3e3),u=te(),d=performance.now();y.trace("endPoint: request",{cid:u,url:st(t),timeout:c,retryLimit:a,backoffLimit:f});let m=H.retry,w=Zt(H,{timeout:c,retry:{...m,limit:a,backoffLimit:f,delay:g=>or(g,f)}},i,{headers:{...r,...n},hooks:{beforeRetry:[...H.hooks?.beforeRetry||[],async({retryCount:g})=>{y.trace("endPoint: retry",{cid:u,retryCount:g,durationMs:performance.now()-d})},...s?.beforeRetry||[]]}});try{let g=await et(t,w),v=await be(g);return y.trace("endPoint: ok",{cid:u,durationMs:performance.now()-d,url:st(t),status:g.status}),{status:"success",value:v}}catch(g){if(g instanceof E||g.response){let ee=await be(g.response);return y.trace("endPoint: error",{cid:u,durationMs:performance.now()-d,status:ee?.status,errorMsg:"HTTP error"}),y.warn("HTTP Error",{cid:u,status:ee?.status,url:t.toString()}),{status:"error",reason:ee}}let v=O(g);return y.trace("endPoint: error",{cid:u,durationMs:performance.now()-d,errorMsg:v?.message??"internal/network error"}),y.error("Internal/Network Error",{cid:u,error:v}),{status:"error",reason:v}}}async function sr(t,e={}){let r=te(),n=performance.now();y.trace("endPoints: batch",{cid:r,count:t.length});let o=t.map(a=>at(a,e)),i=(await Promise.allSettled(o)).map(a=>a.status==="fulfilled"?a.value:{status:"error",reason:O(a.reason)}),c=i.filter(a=>a.status==="success").length;return y.trace("endPoints: done",{cid:r,durationMs:performance.now()-n,ok:c,failed:i.length-c}),i}var co={defaults:H,endPoint:at,endPoints:sr};export{O as a,er as b,tr as c,rr as d,nr as e,Re as f,or as g,H as h,at as i,sr as j,co as k,P as l};
|
|
4
|
+
/*! Bundled license information:
|
|
5
|
+
|
|
6
|
+
ky/distribution/index.js:
|
|
7
|
+
(*! MIT License © Sindre Sorhus *)
|
|
8
|
+
*/
|