watch-tail 0.1.0
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 +210 -0
- package/build/client/_app/immutable/assets/0.B1NsRRrX.css +2 -0
- package/build/client/_app/immutable/assets/0.B1NsRRrX.css.br +0 -0
- package/build/client/_app/immutable/assets/0.B1NsRRrX.css.gz +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DCKWcE8r.js +1 -0
- package/build/client/_app/immutable/chunks/DCKWcE8r.js.br +0 -0
- package/build/client/_app/immutable/chunks/DCKWcE8r.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DDRhiz1-.js +1 -0
- package/build/client/_app/immutable/chunks/DDRhiz1-.js.br +0 -0
- package/build/client/_app/immutable/chunks/DDRhiz1-.js.gz +0 -0
- package/build/client/_app/immutable/chunks/ZAD2y5xJ.js +3 -0
- package/build/client/_app/immutable/chunks/ZAD2y5xJ.js.br +0 -0
- package/build/client/_app/immutable/chunks/ZAD2y5xJ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.DIoggGwf.js +2 -0
- package/build/client/_app/immutable/entry/app.DIoggGwf.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DIoggGwf.js.gz +0 -0
- package/build/client/_app/immutable/entry/start._YXgjuSB.js +1 -0
- package/build/client/_app/immutable/entry/start._YXgjuSB.js.br +0 -0
- package/build/client/_app/immutable/entry/start._YXgjuSB.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.D5bYt7iX.js +1 -0
- package/build/client/_app/immutable/nodes/0.D5bYt7iX.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.D5bYt7iX.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DBX83mYX.js +1 -0
- package/build/client/_app/immutable/nodes/1.DBX83mYX.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DBX83mYX.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.DiH-2moC.js +5 -0
- package/build/client/_app/immutable/nodes/2.DiH-2moC.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DiH-2moC.js.gz +0 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/client/robots.txt +3 -0
- package/build/client/robots.txt.br +0 -0
- package/build/client/robots.txt.gz +0 -0
- package/build/env.js +70 -0
- package/build/env.js.map +1 -0
- package/build/handler.js +24 -0
- package/build/handler.js.map +1 -0
- package/build/index.js +147 -0
- package/build/index.js.map +1 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js.map +1 -0
- package/build/server/chunks/chunks/env2.js-D7xrfc37.js +316 -0
- package/build/server/chunks/chunks/env2.js-D7xrfc37.js.map +1 -0
- package/build/server/chunks/chunks/exports.js-CvFPPbaH.js +263 -0
- package/build/server/chunks/chunks/exports.js-CvFPPbaH.js.map +1 -0
- package/build/server/chunks/chunks/internal.js-DdmUz1r3.js +1191 -0
- package/build/server/chunks/chunks/internal.js-DdmUz1r3.js.map +1 -0
- package/build/server/chunks/chunks/internal2.js-DZ8ZzzjN.js +22 -0
- package/build/server/chunks/chunks/internal2.js-DZ8ZzzjN.js.map +1 -0
- package/build/server/chunks/chunks/regions.js-IQPMyP5C.js +52 -0
- package/build/server/chunks/chunks/regions.js-IQPMyP5C.js.map +1 -0
- package/build/server/chunks/chunks/server.js-ByNB8uti.js +3659 -0
- package/build/server/chunks/chunks/server.js-ByNB8uti.js.map +1 -0
- package/build/server/chunks/chunks/shared-server.js-Dn5XheXH.js +22 -0
- package/build/server/chunks/chunks/shared-server.js-Dn5XheXH.js.map +1 -0
- package/build/server/chunks/chunks/shared.js-CgjUIvRK.js +776 -0
- package/build/server/chunks/chunks/shared.js-CgjUIvRK.js.map +1 -0
- package/build/server/chunks/chunks/state.js-ClLTNPGs.js +86 -0
- package/build/server/chunks/chunks/state.js-ClLTNPGs.js.map +1 -0
- package/build/server/chunks/chunks/time-range.js-BLMT8aU3.js +102 -0
- package/build/server/chunks/chunks/time-range.js-BLMT8aU3.js.map +1 -0
- package/build/server/chunks/chunks/uneval.js-DaakSYFQ.js +488 -0
- package/build/server/chunks/chunks/uneval.js-DaakSYFQ.js.map +1 -0
- package/build/server/chunks/chunks/utils.js-BIlHjgGW.js +933 -0
- package/build/server/chunks/chunks/utils.js-BIlHjgGW.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/health/_server.ts.js-aiNZfkco.js +41 -0
- package/build/server/chunks/entries/endpoints/api/health/_server.ts.js-aiNZfkco.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/log-groups/_server.ts.js-D143-vRl.js +120 -0
- package/build/server/chunks/entries/endpoints/api/log-groups/_server.ts.js-D143-vRl.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/regions/_server.ts.js-CDNL7msU.js +88 -0
- package/build/server/chunks/entries/endpoints/api/regions/_server.ts.js-CDNL7msU.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/stream/_server.ts.js-D_i-xW6_.js +610 -0
- package/build/server/chunks/entries/endpoints/api/stream/_server.ts.js-D_i-xW6_.js.map +1 -0
- package/build/server/chunks/entries/fallbacks/error.svelte.js-qFLa8EVy.js +17 -0
- package/build/server/chunks/entries/fallbacks/error.svelte.js-qFLa8EVy.js.map +1 -0
- package/build/server/chunks/entries/pages/_layout.svelte.js-Bx7lXkAi.js +22 -0
- package/build/server/chunks/entries/pages/_layout.svelte.js-Bx7lXkAi.js.map +1 -0
- package/build/server/chunks/entries/pages/_page.svelte.js-BsvaKqbk.js +1264 -0
- package/build/server/chunks/entries/pages/_page.svelte.js-BsvaKqbk.js.map +1 -0
- package/build/server/chunks/handler-nVqa-QPz.js +1735 -0
- package/build/server/chunks/handler-nVqa-QPz.js.map +1 -0
- package/build/server/chunks/index.js-CtbhHm7L.js +3803 -0
- package/build/server/chunks/index.js-CtbhHm7L.js.map +1 -0
- package/build/server/chunks/manifest.js-BwUys8gK.js +70 -0
- package/build/server/chunks/manifest.js-BwUys8gK.js.map +1 -0
- package/build/server/chunks/nodes/0.js-Dl0J9d3p.js +9 -0
- package/build/server/chunks/nodes/0.js-Dl0J9d3p.js.map +1 -0
- package/build/server/chunks/nodes/1.js-dXZVW92o.js +9 -0
- package/build/server/chunks/nodes/1.js-dXZVW92o.js.map +1 -0
- package/build/server/chunks/nodes/2.js-aMMUenQc.js +9 -0
- package/build/server/chunks/nodes/2.js-aMMUenQc.js.map +1 -0
- package/build/shims.js +33 -0
- package/build/shims.js.map +1 -0
- package/dist/cli/bin.js +9 -0
- package/dist/cli/completions.js +99 -0
- package/dist/cli/index.js +183 -0
- package/dist/cli/options.js +171 -0
- package/dist/cli/server.js +126 -0
- package/dist/cli/ui.js +75 -0
- package/dist/lib/cli/aws.js +264 -0
- package/dist/lib/time-range.js +106 -0
- package/package.json +106 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { b as private_env } from './shared-server.js-Dn5XheXH.js';
|
|
2
|
+
import { j as json } from './utils.js-BIlHjgGW.js';
|
|
3
|
+
import { CloudWatchLogsClient } from '@aws-sdk/client-cloudwatch-logs';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
|
|
7
|
+
//#region src/lib/server/api.ts
|
|
8
|
+
/**
|
|
9
|
+
* Builds a JSON error response that never leaks stack traces.
|
|
10
|
+
*
|
|
11
|
+
* Use 400 for bad input, 502 for upstream CloudWatch Logs failures and 499
|
|
12
|
+
* when the client aborted the request.
|
|
13
|
+
*/
|
|
14
|
+
function apiError(status, message, code, details) {
|
|
15
|
+
const body = { error: message };
|
|
16
|
+
if (code !== void 0) body.code = code;
|
|
17
|
+
return json(body, { status });
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/lib/server/aws.ts
|
|
21
|
+
/**
|
|
22
|
+
* Throwaway credentials for local emulators only.
|
|
23
|
+
*
|
|
24
|
+
* floci and LocalStack verify the request signature but accept any non-empty
|
|
25
|
+
* key pair, so these keys make a local endpoint work out of the box.
|
|
26
|
+
*/
|
|
27
|
+
var EMULATOR_CREDENTIALS = {
|
|
28
|
+
accessKeyId: "test",
|
|
29
|
+
secretAccessKey: "test"
|
|
30
|
+
};
|
|
31
|
+
/** Environment variables that indicate that ambient credentials are configured. */
|
|
32
|
+
var CREDENTIAL_ENV_KEYS = [
|
|
33
|
+
"AWS_ACCESS_KEY_ID",
|
|
34
|
+
"AWS_PROFILE",
|
|
35
|
+
"AWS_SHARED_CREDENTIALS_FILE",
|
|
36
|
+
"AWS_CONFIG_FILE",
|
|
37
|
+
"AWS_WEB_IDENTITY_TOKEN_FILE",
|
|
38
|
+
"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",
|
|
39
|
+
"AWS_CONTAINER_CREDENTIALS_FULL_URI",
|
|
40
|
+
"AWS_ROLE_ARN"
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Display-only region used when nothing else can be resolved. It is never sent
|
|
44
|
+
* to the SDK.
|
|
45
|
+
*/
|
|
46
|
+
var FALLBACK_REGION = "us-east-1";
|
|
47
|
+
/** User-facing hint for a malformed `region` query parameter. */
|
|
48
|
+
var REGION_PARAM_HINT = "Invalid region: expected a region code such as us-east-1 or us-west-2-lax-1a";
|
|
49
|
+
/** Region codes and local-zone codes only: lowercase letters, digits and dashes. */
|
|
50
|
+
var REGION_PATTERN = /^[a-z0-9-]{1,64}$/;
|
|
51
|
+
/** Hosts that are always considered local, including the IPv6 loopback form. */
|
|
52
|
+
var LOCAL_HOSTS = /* @__PURE__ */ new Set([
|
|
53
|
+
"localhost",
|
|
54
|
+
"127.0.0.1",
|
|
55
|
+
"0.0.0.0",
|
|
56
|
+
"::1",
|
|
57
|
+
"[::1]"
|
|
58
|
+
]);
|
|
59
|
+
/** Substrings that identify a known local AWS emulator. */
|
|
60
|
+
var LOCAL_HINTS = ["floci", "localstack"];
|
|
61
|
+
var MAX_DETAIL_LENGTH = 300;
|
|
62
|
+
/** Trims a value and treats blank strings as absent. */
|
|
63
|
+
function normalize(value) {
|
|
64
|
+
if (typeof value !== "string") return null;
|
|
65
|
+
const trimmed = value.trim();
|
|
66
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
67
|
+
}
|
|
68
|
+
/** Extracts a lowercase host from an endpoint, tolerating missing schemes. */
|
|
69
|
+
function hostOf(endpoint) {
|
|
70
|
+
try {
|
|
71
|
+
return new URL(endpoint).hostname.toLowerCase();
|
|
72
|
+
} catch {
|
|
73
|
+
return (/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i.exec(endpoint)?.[1] ?? endpoint).toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** True when the endpoint targets a local emulator such as floci or LocalStack. */
|
|
77
|
+
function isLocalEndpoint(endpoint) {
|
|
78
|
+
const host = hostOf(endpoint);
|
|
79
|
+
if (LOCAL_HOSTS.has(host)) return true;
|
|
80
|
+
return LOCAL_HINTS.some((hint) => host.includes(hint));
|
|
81
|
+
}
|
|
82
|
+
/** True when any ambient credential source is configured (non-blank) in the environment. */
|
|
83
|
+
function hasAmbientCredentials(env) {
|
|
84
|
+
return CREDENTIAL_ENV_KEYS.some((key) => normalize(env[key]) !== null);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolves the region, endpoint, local flag and credential source for CloudWatch Logs.
|
|
88
|
+
*
|
|
89
|
+
* Region precedence: an explicit region parameter, then `AWS_REGION`, then
|
|
90
|
+
* `AWS_DEFAULT_REGION`. When none of them is set the result is `null`, which
|
|
91
|
+
* lets the SDK resolve the region from the ambient AWS configuration (profile,
|
|
92
|
+
* SSO, instance metadata) instead of this app inventing one.
|
|
93
|
+
*
|
|
94
|
+
* Credentials stay `ambient` unless the endpoint is local and no ambient
|
|
95
|
+
* credential source is configured at all, in which case the emulator's
|
|
96
|
+
* throwaway keys are used.
|
|
97
|
+
*/
|
|
98
|
+
function resolveAwsConfig(env, regionParam) {
|
|
99
|
+
const endpoint = normalize(env.AWS_ENDPOINT_URL_LOGS) ?? normalize(env.AWS_ENDPOINT_URL);
|
|
100
|
+
const region = normalize(regionParam) ?? normalize(env.AWS_REGION) ?? normalize(env.AWS_DEFAULT_REGION);
|
|
101
|
+
const local = endpoint !== null && isLocalEndpoint(endpoint);
|
|
102
|
+
return {
|
|
103
|
+
region,
|
|
104
|
+
endpoint,
|
|
105
|
+
local,
|
|
106
|
+
credentials: local && !hasAmbientCredentials(env) ? "emulator-default" : "ambient"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validates the optional `region` query parameter.
|
|
111
|
+
*
|
|
112
|
+
* A blank value means "not supplied" and is accepted as `null`. Any other
|
|
113
|
+
* value must look like a region code or a local-zone code.
|
|
114
|
+
*/
|
|
115
|
+
function parseRegionParam(value) {
|
|
116
|
+
const trimmed = typeof value === "string" ? value.trim() : "";
|
|
117
|
+
if (trimmed.length === 0) return {
|
|
118
|
+
ok: true,
|
|
119
|
+
region: null
|
|
120
|
+
};
|
|
121
|
+
if (!REGION_PATTERN.test(trimmed)) return {
|
|
122
|
+
ok: false,
|
|
123
|
+
region: null
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
ok: true,
|
|
127
|
+
region: trimmed
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Creates a CloudWatch Logs client.
|
|
132
|
+
*
|
|
133
|
+
* Credentials stay ambient unless {@link AwsConfig.credentials} asks for the
|
|
134
|
+
* emulator defaults: this never reads key material from the environment and
|
|
135
|
+
* never sets `credentials` for a real AWS endpoint, so the SDK default provider
|
|
136
|
+
* chain is used unchanged. The region is only set when the caller asked for
|
|
137
|
+
* one, so the SDK can otherwise resolve it from `AWS_REGION`, the shared
|
|
138
|
+
* profile or SSO.
|
|
139
|
+
*/
|
|
140
|
+
function createLogsClient(config) {
|
|
141
|
+
const options = { maxAttempts: 3 };
|
|
142
|
+
if (config.region !== null) options.region = config.region;
|
|
143
|
+
if (config.endpoint !== null) options.endpoint = config.endpoint;
|
|
144
|
+
if (config.credentials === "emulator-default") options.credentials = EMULATOR_CREDENTIALS;
|
|
145
|
+
return new CloudWatchLogsClient(options);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Resolves the region to show in responses.
|
|
149
|
+
*
|
|
150
|
+
* Returns the requested region when there is one, otherwise asks the client,
|
|
151
|
+
* whose region provider reads `AWS_REGION`, the profile region and finally the
|
|
152
|
+
* `[default]` profile. The provider call is local (no network request) and it
|
|
153
|
+
* throws when nothing can be found, so any failure falls back to
|
|
154
|
+
* {@link FALLBACK_REGION}: this value is informational and must never break a
|
|
155
|
+
* response.
|
|
156
|
+
*/
|
|
157
|
+
async function resolveEffectiveRegion(client, config) {
|
|
158
|
+
if (config.region !== null) return config.region;
|
|
159
|
+
try {
|
|
160
|
+
const region = await client.config.region();
|
|
161
|
+
return typeof region === "string" && region.trim().length > 0 ? region.trim() : FALLBACK_REGION;
|
|
162
|
+
} catch {
|
|
163
|
+
return FALLBACK_REGION;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
var ERROR_MESSAGES = {
|
|
167
|
+
aborted: "The CloudWatch Logs request was aborted",
|
|
168
|
+
"missing-credentials": "AWS credentials are missing or expired",
|
|
169
|
+
"missing-region": "No AWS region is configured. Set AWS_REGION or add a region to your AWS profile.",
|
|
170
|
+
"access-denied": "Access denied by CloudWatch Logs",
|
|
171
|
+
"not-found": "The CloudWatch Logs resource was not found",
|
|
172
|
+
unreachable: "The CloudWatch Logs endpoint is unreachable",
|
|
173
|
+
throttled: "CloudWatch Logs is throttling requests",
|
|
174
|
+
unknown: "CloudWatch Logs request failed"
|
|
175
|
+
};
|
|
176
|
+
/** Codes whose message is user guidance and must not be amended with SDK text. */
|
|
177
|
+
var FIXED_MESSAGE_CODES = /* @__PURE__ */ new Set(["missing-region"]);
|
|
178
|
+
/** Collects name, message, status and a lowercase search haystack from an error chain. */
|
|
179
|
+
function readErrorFacts(error) {
|
|
180
|
+
const parts = [];
|
|
181
|
+
let name = "";
|
|
182
|
+
let message = "";
|
|
183
|
+
let code = "";
|
|
184
|
+
let status = null;
|
|
185
|
+
let current = error;
|
|
186
|
+
for (let depth = 0; depth < 4 && current !== null && current !== void 0; depth += 1) {
|
|
187
|
+
if (current instanceof Error) {
|
|
188
|
+
if (name === "") name = current.name;
|
|
189
|
+
if (message === "") message = current.message;
|
|
190
|
+
parts.push(current.name, current.message);
|
|
191
|
+
} else if (typeof current === "string") {
|
|
192
|
+
if (message === "") message = current;
|
|
193
|
+
parts.push(current);
|
|
194
|
+
} else if (typeof current === "object") {
|
|
195
|
+
const like = current;
|
|
196
|
+
if (name === "" && typeof like.name === "string") name = like.name;
|
|
197
|
+
if (message === "" && typeof like.message === "string") message = like.message;
|
|
198
|
+
if (code === "" && typeof like.code === "string") code = like.code;
|
|
199
|
+
if (status === null && typeof like.$metadata?.httpStatusCode === "number") status = like.$metadata.httpStatusCode;
|
|
200
|
+
if (typeof like.name === "string") parts.push(like.name);
|
|
201
|
+
if (typeof like.message === "string") parts.push(like.message);
|
|
202
|
+
if (typeof like.code === "string") parts.push(like.code);
|
|
203
|
+
current = like.cause;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
name,
|
|
210
|
+
message: message.trim(),
|
|
211
|
+
code,
|
|
212
|
+
status,
|
|
213
|
+
haystack: parts.join(" ").toLowerCase()
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/** True when the error says that no AWS region could be resolved. */
|
|
217
|
+
function isRegionFailure(loweredName, haystack) {
|
|
218
|
+
return loweredName.includes("regionprovider") || loweredName.includes("regionnotset") || loweredName.includes("missingregion") || haystack.includes("region is missing") || haystack.includes("region is not configured") || haystack.includes("region is required") || haystack.includes("missing region") || haystack.includes("no region is configured") || haystack.includes("region not set") || haystack.includes("region must be specified") || haystack.includes("region not accepted") || haystack.includes("is not a valid hostname component");
|
|
219
|
+
}
|
|
220
|
+
/** Maps a thrown value to a machine-readable error code. */
|
|
221
|
+
function classify(facts) {
|
|
222
|
+
const { name, code, status, haystack } = facts;
|
|
223
|
+
const loweredName = name.toLowerCase();
|
|
224
|
+
if (loweredName === "aborterror" || code === "ABORT_ERR" || code === "ERR_CANCELED") return "aborted";
|
|
225
|
+
if (loweredName.includes("credentialsprovider") || loweredName.includes("expiredtoken") || haystack.includes("could not load credentials") || haystack.includes("credential is expired") || haystack.includes("token has expired") || haystack.includes("resolve credentials")) return "missing-credentials";
|
|
226
|
+
if (isRegionFailure(loweredName, haystack)) return "missing-region";
|
|
227
|
+
if (loweredName.includes("accessdenied") || loweredName.includes("invalidclienttokenid") || loweredName.includes("invalidsignature") || loweredName.includes("unrecognizedclient") || loweredName.includes("unauthorized") || loweredName.includes("signaturedoesnotmatch") || status === 401 || status === 403) return "access-denied";
|
|
228
|
+
if (loweredName.includes("resourcenotfound") || loweredName.includes("loggroupnotfound") || haystack.includes("does not exist") || status === 404) return "not-found";
|
|
229
|
+
if (loweredName.includes("throttl") || loweredName.includes("toomanyrequests") || loweredName.includes("requestlimitexceeded") || status === 429) return "throttled";
|
|
230
|
+
if ([
|
|
231
|
+
"econnrefused",
|
|
232
|
+
"econnreset",
|
|
233
|
+
"enotfound",
|
|
234
|
+
"eaiagain",
|
|
235
|
+
"etimedout",
|
|
236
|
+
"ehostunreach",
|
|
237
|
+
"enetunreach"
|
|
238
|
+
].some((token) => haystack.includes(token)) || haystack.includes("connection refused") || haystack.includes("socket hang up") || haystack.includes("fetch failed") || haystack.includes("getaddrinfo") || haystack.includes("network error") || haystack.includes("timeout") || haystack.includes("unreachable")) return "unreachable";
|
|
239
|
+
return "unknown";
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Turns a thrown SDK or network error into a short human message plus a
|
|
243
|
+
* machine-readable code such as `missing-credentials`, `missing-region` or
|
|
244
|
+
* `unreachable`.
|
|
245
|
+
*/
|
|
246
|
+
function describeAwsError(error) {
|
|
247
|
+
const facts = readErrorFacts(error);
|
|
248
|
+
const code = classify(facts);
|
|
249
|
+
const base = ERROR_MESSAGES[code] ?? ERROR_MESSAGES.unknown;
|
|
250
|
+
if (FIXED_MESSAGE_CODES.has(code)) return {
|
|
251
|
+
message: base,
|
|
252
|
+
code
|
|
253
|
+
};
|
|
254
|
+
const detail = facts.message.length > MAX_DETAIL_LENGTH ? `${facts.message.slice(0, MAX_DETAIL_LENGTH)}...` : facts.message;
|
|
255
|
+
return {
|
|
256
|
+
message: detail.length > 0 && !base.toLowerCase().includes(detail.toLowerCase()) ? `${base}: ${detail}` : base,
|
|
257
|
+
code
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/lib/server/env.ts
|
|
262
|
+
/** Name of the git-ignored file that holds local (floci) connection settings. */
|
|
263
|
+
var LOCAL_ENV_FILE = ".env.local";
|
|
264
|
+
var localEnvChecked = false;
|
|
265
|
+
/** Reads `process.env` through `globalThis`, so this file needs no `@types/node`. */
|
|
266
|
+
function processEnv() {
|
|
267
|
+
return globalThis.process?.env ?? {};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Loads a dotenv file into `process.env`.
|
|
271
|
+
*
|
|
272
|
+
* Existing environment variables win, matching `node --env-file` semantics.
|
|
273
|
+
* Returns true only when a file was found and parsed.
|
|
274
|
+
*/
|
|
275
|
+
function loadEnvFile(path) {
|
|
276
|
+
const runtime = globalThis;
|
|
277
|
+
const loader = runtime.process?.loadEnvFile;
|
|
278
|
+
if (typeof loader !== "function" || !existsSync(path)) return false;
|
|
279
|
+
try {
|
|
280
|
+
loader.call(runtime.process, path);
|
|
281
|
+
return true;
|
|
282
|
+
} catch {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Loads `<cwd>/.env.local` once.
|
|
288
|
+
*
|
|
289
|
+
* SvelteKit exposes `.env` values through `$env/dynamic/private`, but the AWS
|
|
290
|
+
* SDK's credential and region providers read `process.env` directly, so the
|
|
291
|
+
* file has to be applied to the process too. Run `pnpm floci:up` to create it.
|
|
292
|
+
*/
|
|
293
|
+
function ensureLocalEnv(cwd) {
|
|
294
|
+
if (localEnvChecked) return false;
|
|
295
|
+
localEnvChecked = true;
|
|
296
|
+
const base = globalThis.process?.cwd?.();
|
|
297
|
+
if (base === void 0) return false;
|
|
298
|
+
return loadEnvFile(join(base, LOCAL_ENV_FILE));
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Reads the effective server environment.
|
|
302
|
+
*
|
|
303
|
+
* `$env/dynamic/private` does resolve under vitest, but it is a snapshot taken
|
|
304
|
+
* when the module is first evaluated, so the live `process.env` map is merged
|
|
305
|
+
* last and wins.
|
|
306
|
+
*/
|
|
307
|
+
function readEnv() {
|
|
308
|
+
ensureLocalEnv();
|
|
309
|
+
return {
|
|
310
|
+
...private_env,
|
|
311
|
+
...processEnv()
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export { REGION_PARAM_HINT as R, apiError as a, readEnv as b, createLogsClient as c, resolveEffectiveRegion as d, describeAwsError as e, parseRegionParam as p, resolveAwsConfig as r };
|
|
316
|
+
//# sourceMappingURL=env2.js-D7xrfc37.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env2.js-D7xrfc37.js","sources":["../../../../.svelte-kit/output/server/chunks/env2.js"],"sourcesContent":["import { t as private_env } from \"./shared-server.js\";\nimport { json } from \"@sveltejs/kit\";\nimport { CloudWatchLogsClient } from \"@aws-sdk/client-cloudwatch-logs\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n//#region src/lib/server/api.ts\n/**\n* Builds a JSON error response that never leaks stack traces.\n*\n* Use 400 for bad input, 502 for upstream CloudWatch Logs failures and 499\n* when the client aborted the request.\n*/\nfunction apiError(status, message, code, details) {\n\tconst body = { error: message };\n\tif (code !== void 0) body.code = code;\n\tif (details !== void 0 && details.length > 0) body.details = details;\n\treturn json(body, { status });\n}\n//#endregion\n//#region src/lib/server/aws.ts\n/**\n* Throwaway credentials for local emulators only.\n*\n* floci and LocalStack verify the request signature but accept any non-empty\n* key pair, so these keys make a local endpoint work out of the box.\n*/\nvar EMULATOR_CREDENTIALS = {\n\taccessKeyId: \"test\",\n\tsecretAccessKey: \"test\"\n};\n/** Environment variables that indicate that ambient credentials are configured. */\nvar CREDENTIAL_ENV_KEYS = [\n\t\"AWS_ACCESS_KEY_ID\",\n\t\"AWS_PROFILE\",\n\t\"AWS_SHARED_CREDENTIALS_FILE\",\n\t\"AWS_CONFIG_FILE\",\n\t\"AWS_WEB_IDENTITY_TOKEN_FILE\",\n\t\"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\",\n\t\"AWS_CONTAINER_CREDENTIALS_FULL_URI\",\n\t\"AWS_ROLE_ARN\"\n];\n/**\n* Display-only region used when nothing else can be resolved. It is never sent\n* to the SDK.\n*/\nvar FALLBACK_REGION = \"us-east-1\";\n/** User-facing hint for a malformed `region` query parameter. */\nvar REGION_PARAM_HINT = \"Invalid region: expected a region code such as us-east-1 or us-west-2-lax-1a\";\n/** Region codes and local-zone codes only: lowercase letters, digits and dashes. */\nvar REGION_PATTERN = /^[a-z0-9-]{1,64}$/;\n/** Hosts that are always considered local, including the IPv6 loopback form. */\nvar LOCAL_HOSTS = /* @__PURE__ */ new Set([\n\t\"localhost\",\n\t\"127.0.0.1\",\n\t\"0.0.0.0\",\n\t\"::1\",\n\t\"[::1]\"\n]);\n/** Substrings that identify a known local AWS emulator. */\nvar LOCAL_HINTS = [\"floci\", \"localstack\"];\nvar MAX_DETAIL_LENGTH = 300;\n/** Trims a value and treats blank strings as absent. */\nfunction normalize(value) {\n\tif (typeof value !== \"string\") return null;\n\tconst trimmed = value.trim();\n\treturn trimmed.length > 0 ? trimmed : null;\n}\n/** Extracts a lowercase host from an endpoint, tolerating missing schemes. */\nfunction hostOf(endpoint) {\n\ttry {\n\t\treturn new URL(endpoint).hostname.toLowerCase();\n\t} catch {\n\t\treturn (/^[a-z][a-z0-9+.-]*:\\/\\/([^/?#]+)/i.exec(endpoint)?.[1] ?? endpoint).toLowerCase();\n\t}\n}\n/** True when the endpoint targets a local emulator such as floci or LocalStack. */\nfunction isLocalEndpoint(endpoint) {\n\tconst host = hostOf(endpoint);\n\tif (LOCAL_HOSTS.has(host)) return true;\n\treturn LOCAL_HINTS.some((hint) => host.includes(hint));\n}\n/** True when any ambient credential source is configured (non-blank) in the environment. */\nfunction hasAmbientCredentials(env) {\n\treturn CREDENTIAL_ENV_KEYS.some((key) => normalize(env[key]) !== null);\n}\n/**\n* Resolves the region, endpoint, local flag and credential source for CloudWatch Logs.\n*\n* Region precedence: an explicit region parameter, then `AWS_REGION`, then\n* `AWS_DEFAULT_REGION`. When none of them is set the result is `null`, which\n* lets the SDK resolve the region from the ambient AWS configuration (profile,\n* SSO, instance metadata) instead of this app inventing one.\n*\n* Credentials stay `ambient` unless the endpoint is local and no ambient\n* credential source is configured at all, in which case the emulator's\n* throwaway keys are used.\n*/\nfunction resolveAwsConfig(env, regionParam) {\n\tconst endpoint = normalize(env.AWS_ENDPOINT_URL_LOGS) ?? normalize(env.AWS_ENDPOINT_URL);\n\tconst region = normalize(regionParam) ?? normalize(env.AWS_REGION) ?? normalize(env.AWS_DEFAULT_REGION);\n\tconst local = endpoint !== null && isLocalEndpoint(endpoint);\n\treturn {\n\t\tregion,\n\t\tendpoint,\n\t\tlocal,\n\t\tcredentials: local && !hasAmbientCredentials(env) ? \"emulator-default\" : \"ambient\"\n\t};\n}\n/**\n* Validates the optional `region` query parameter.\n*\n* A blank value means \"not supplied\" and is accepted as `null`. Any other\n* value must look like a region code or a local-zone code.\n*/\nfunction parseRegionParam(value) {\n\tconst trimmed = typeof value === \"string\" ? value.trim() : \"\";\n\tif (trimmed.length === 0) return {\n\t\tok: true,\n\t\tregion: null\n\t};\n\tif (!REGION_PATTERN.test(trimmed)) return {\n\t\tok: false,\n\t\tregion: null\n\t};\n\treturn {\n\t\tok: true,\n\t\tregion: trimmed\n\t};\n}\n/**\n* Creates a CloudWatch Logs client.\n*\n* Credentials stay ambient unless {@link AwsConfig.credentials} asks for the\n* emulator defaults: this never reads key material from the environment and\n* never sets `credentials` for a real AWS endpoint, so the SDK default provider\n* chain is used unchanged. The region is only set when the caller asked for\n* one, so the SDK can otherwise resolve it from `AWS_REGION`, the shared\n* profile or SSO.\n*/\nfunction createLogsClient(config) {\n\tconst options = { maxAttempts: 3 };\n\tif (config.region !== null) options.region = config.region;\n\tif (config.endpoint !== null) options.endpoint = config.endpoint;\n\tif (config.credentials === \"emulator-default\") options.credentials = EMULATOR_CREDENTIALS;\n\treturn new CloudWatchLogsClient(options);\n}\n/**\n* Resolves the region to show in responses.\n*\n* Returns the requested region when there is one, otherwise asks the client,\n* whose region provider reads `AWS_REGION`, the profile region and finally the\n* `[default]` profile. The provider call is local (no network request) and it\n* throws when nothing can be found, so any failure falls back to\n* {@link FALLBACK_REGION}: this value is informational and must never break a\n* response.\n*/\nasync function resolveEffectiveRegion(client, config) {\n\tif (config.region !== null) return config.region;\n\ttry {\n\t\tconst region = await client.config.region();\n\t\treturn typeof region === \"string\" && region.trim().length > 0 ? region.trim() : FALLBACK_REGION;\n\t} catch {\n\t\treturn FALLBACK_REGION;\n\t}\n}\nvar ERROR_MESSAGES = {\n\taborted: \"The CloudWatch Logs request was aborted\",\n\t\"missing-credentials\": \"AWS credentials are missing or expired\",\n\t\"missing-region\": \"No AWS region is configured. Set AWS_REGION or add a region to your AWS profile.\",\n\t\"access-denied\": \"Access denied by CloudWatch Logs\",\n\t\"not-found\": \"The CloudWatch Logs resource was not found\",\n\tunreachable: \"The CloudWatch Logs endpoint is unreachable\",\n\tthrottled: \"CloudWatch Logs is throttling requests\",\n\tunknown: \"CloudWatch Logs request failed\"\n};\n/** Codes whose message is user guidance and must not be amended with SDK text. */\nvar FIXED_MESSAGE_CODES = /* @__PURE__ */ new Set([\"missing-region\"]);\n/** Collects name, message, status and a lowercase search haystack from an error chain. */\nfunction readErrorFacts(error) {\n\tconst parts = [];\n\tlet name = \"\";\n\tlet message = \"\";\n\tlet code = \"\";\n\tlet status = null;\n\tlet current = error;\n\tfor (let depth = 0; depth < 4 && current !== null && current !== void 0; depth += 1) {\n\t\tif (current instanceof Error) {\n\t\t\tif (name === \"\") name = current.name;\n\t\t\tif (message === \"\") message = current.message;\n\t\t\tparts.push(current.name, current.message);\n\t\t} else if (typeof current === \"string\") {\n\t\t\tif (message === \"\") message = current;\n\t\t\tparts.push(current);\n\t\t} else if (typeof current === \"object\") {\n\t\t\tconst like = current;\n\t\t\tif (name === \"\" && typeof like.name === \"string\") name = like.name;\n\t\t\tif (message === \"\" && typeof like.message === \"string\") message = like.message;\n\t\t\tif (code === \"\" && typeof like.code === \"string\") code = like.code;\n\t\t\tif (status === null && typeof like.$metadata?.httpStatusCode === \"number\") status = like.$metadata.httpStatusCode;\n\t\t\tif (typeof like.name === \"string\") parts.push(like.name);\n\t\t\tif (typeof like.message === \"string\") parts.push(like.message);\n\t\t\tif (typeof like.code === \"string\") parts.push(like.code);\n\t\t\tcurrent = like.cause;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\treturn {\n\t\tname,\n\t\tmessage: message.trim(),\n\t\tcode,\n\t\tstatus,\n\t\thaystack: parts.join(\" \").toLowerCase()\n\t};\n}\n/** True when the error says that no AWS region could be resolved. */\nfunction isRegionFailure(loweredName, haystack) {\n\treturn loweredName.includes(\"regionprovider\") || loweredName.includes(\"regionnotset\") || loweredName.includes(\"missingregion\") || haystack.includes(\"region is missing\") || haystack.includes(\"region is not configured\") || haystack.includes(\"region is required\") || haystack.includes(\"missing region\") || haystack.includes(\"no region is configured\") || haystack.includes(\"region not set\") || haystack.includes(\"region must be specified\") || haystack.includes(\"region not accepted\") || haystack.includes(\"is not a valid hostname component\");\n}\n/** Maps a thrown value to a machine-readable error code. */\nfunction classify(facts) {\n\tconst { name, code, status, haystack } = facts;\n\tconst loweredName = name.toLowerCase();\n\tif (loweredName === \"aborterror\" || code === \"ABORT_ERR\" || code === \"ERR_CANCELED\") return \"aborted\";\n\tif (loweredName.includes(\"credentialsprovider\") || loweredName.includes(\"expiredtoken\") || haystack.includes(\"could not load credentials\") || haystack.includes(\"credential is expired\") || haystack.includes(\"token has expired\") || haystack.includes(\"resolve credentials\")) return \"missing-credentials\";\n\tif (isRegionFailure(loweredName, haystack)) return \"missing-region\";\n\tif (loweredName.includes(\"accessdenied\") || loweredName.includes(\"invalidclienttokenid\") || loweredName.includes(\"invalidsignature\") || loweredName.includes(\"unrecognizedclient\") || loweredName.includes(\"unauthorized\") || loweredName.includes(\"signaturedoesnotmatch\") || status === 401 || status === 403) return \"access-denied\";\n\tif (loweredName.includes(\"resourcenotfound\") || loweredName.includes(\"loggroupnotfound\") || haystack.includes(\"does not exist\") || status === 404) return \"not-found\";\n\tif (loweredName.includes(\"throttl\") || loweredName.includes(\"toomanyrequests\") || loweredName.includes(\"requestlimitexceeded\") || status === 429) return \"throttled\";\n\tif ([\n\t\t\"econnrefused\",\n\t\t\"econnreset\",\n\t\t\"enotfound\",\n\t\t\"eaiagain\",\n\t\t\"etimedout\",\n\t\t\"ehostunreach\",\n\t\t\"enetunreach\"\n\t].some((token) => haystack.includes(token)) || haystack.includes(\"connection refused\") || haystack.includes(\"socket hang up\") || haystack.includes(\"fetch failed\") || haystack.includes(\"getaddrinfo\") || haystack.includes(\"network error\") || haystack.includes(\"timeout\") || haystack.includes(\"unreachable\")) return \"unreachable\";\n\treturn \"unknown\";\n}\n/**\n* Turns a thrown SDK or network error into a short human message plus a\n* machine-readable code such as `missing-credentials`, `missing-region` or\n* `unreachable`.\n*/\nfunction describeAwsError(error) {\n\tconst facts = readErrorFacts(error);\n\tconst code = classify(facts);\n\tconst base = ERROR_MESSAGES[code] ?? ERROR_MESSAGES.unknown;\n\tif (FIXED_MESSAGE_CODES.has(code)) return {\n\t\tmessage: base,\n\t\tcode\n\t};\n\tconst detail = facts.message.length > MAX_DETAIL_LENGTH ? `${facts.message.slice(0, MAX_DETAIL_LENGTH)}...` : facts.message;\n\treturn {\n\t\tmessage: detail.length > 0 && !base.toLowerCase().includes(detail.toLowerCase()) ? `${base}: ${detail}` : base,\n\t\tcode\n\t};\n}\n//#endregion\n//#region src/lib/server/env.ts\n/** Name of the git-ignored file that holds local (floci) connection settings. */\nvar LOCAL_ENV_FILE = \".env.local\";\nvar localEnvChecked = false;\n/** Reads `process.env` through `globalThis`, so this file needs no `@types/node`. */\nfunction processEnv() {\n\treturn globalThis.process?.env ?? {};\n}\n/**\n* Loads a dotenv file into `process.env`.\n*\n* Existing environment variables win, matching `node --env-file` semantics.\n* Returns true only when a file was found and parsed.\n*/\nfunction loadEnvFile(path) {\n\tconst runtime = globalThis;\n\tconst loader = runtime.process?.loadEnvFile;\n\tif (typeof loader !== \"function\" || !existsSync(path)) return false;\n\ttry {\n\t\tloader.call(runtime.process, path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Loads `<cwd>/.env.local` once.\n*\n* SvelteKit exposes `.env` values through `$env/dynamic/private`, but the AWS\n* SDK's credential and region providers read `process.env` directly, so the\n* file has to be applied to the process too. Run `pnpm floci:up` to create it.\n*/\nfunction ensureLocalEnv(cwd) {\n\tif (localEnvChecked) return false;\n\tlocalEnvChecked = true;\n\tconst base = cwd ?? globalThis.process?.cwd?.();\n\tif (base === void 0) return false;\n\treturn loadEnvFile(join(base, LOCAL_ENV_FILE));\n}\n/**\n* Reads the effective server environment.\n*\n* `$env/dynamic/private` does resolve under vitest, but it is a snapshot taken\n* when the module is first evaluated, so the live `process.env` map is merged\n* last and wins.\n*/\nfunction readEnv() {\n\tensureLocalEnv();\n\treturn {\n\t\t...private_env,\n\t\t...processEnv()\n\t};\n}\n//#endregion\nexport { describeAwsError as a, resolveEffectiveRegion as c, createLogsClient as i, apiError as l, FALLBACK_REGION as n, parseRegionParam as o, REGION_PARAM_HINT as r, resolveAwsConfig as s, readEnv as t };\n"],"names":[],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;AAClD,CAAC,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AAChC,CAAC,IAAI,IAAI,KAAK,MAAM,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI;AAEtC,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,oBAAoB,GAAG;AAC3B,CAAC,WAAW,EAAE,MAAM;AACpB,CAAC,eAAe,EAAE;AAClB,CAAC;AACD;AACA,IAAI,mBAAmB,GAAG;AAC1B,CAAC,mBAAmB;AACpB,CAAC,aAAa;AACd,CAAC,6BAA6B;AAC9B,CAAC,iBAAiB;AAClB,CAAC,6BAA6B;AAC9B,CAAC,wCAAwC;AACzC,CAAC,oCAAoC;AACrC,CAAC;AACD,CAAC;AACD;AACA;AACA;AACA;AACA,IAAI,eAAe,GAAG,WAAW;AACjC;AACG,IAAC,iBAAiB,GAAG;AACxB;AACA,IAAI,cAAc,GAAG,mBAAmB;AACxC;AACA,IAAI,WAAW,mBAAmB,IAAI,GAAG,CAAC;AAC1C,CAAC,WAAW;AACZ,CAAC,WAAW;AACZ,CAAC,SAAS;AACV,CAAC,KA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,CAAC,OAAO,EAAE,GAAG,IAAI;AAChD,CAAC,IAAI,IAAI,KAAK,MAAM,EAAE,OAAO,KAAK;AAClC,CAAC,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,GAAG;AACnB,CAAC,cAAc,EAAE;AACjB,CAAC,OAAO;AACR,EAAE,GAAG,WAAW;AAChB,EAAE,GAAG,UAAU;AACf,EAAE;AACF;;"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
var internal = new URL("sveltekit-internal://");
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} base
|
|
4
|
+
* @param {string} path
|
|
5
|
+
*/
|
|
6
|
+
function resolve(base, path) {
|
|
7
|
+
if (path[0] === "/" && path[1] === "/") return path;
|
|
8
|
+
let url = new URL(base, internal);
|
|
9
|
+
url = new URL(path, url);
|
|
10
|
+
return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} path
|
|
14
|
+
* @param {import('types').TrailingSlash} trailing_slash
|
|
15
|
+
*/
|
|
16
|
+
function normalize_path(path, trailing_slash) {
|
|
17
|
+
if (path === "/" || trailing_slash === "ignore") return path;
|
|
18
|
+
if (trailing_slash === "never") return path.endsWith("/") ? path.slice(0, -1) : path;
|
|
19
|
+
else if (trailing_slash === "always" && !path.endsWith("/")) return path + "/";
|
|
20
|
+
return path;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Decode pathname excluding %25 to prevent further double decoding of params
|
|
24
|
+
* @param {string} pathname
|
|
25
|
+
*/
|
|
26
|
+
function decode_pathname(pathname) {
|
|
27
|
+
return pathname.split("%25").map(decodeURI).join("%25");
|
|
28
|
+
}
|
|
29
|
+
/** @param {Record<string, string>} params */
|
|
30
|
+
function decode_params(params) {
|
|
31
|
+
for (const key in params) params[key] = decodeURIComponent(params[key]);
|
|
32
|
+
return params;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @param {URL} url
|
|
36
|
+
* @param {() => void} callback
|
|
37
|
+
* @param {(search_param: string) => void} search_params_callback
|
|
38
|
+
* @param {boolean} [allow_hash]
|
|
39
|
+
*/
|
|
40
|
+
function make_trackable(url, callback, search_params_callback, allow_hash = false) {
|
|
41
|
+
const tracked = new URL(url);
|
|
42
|
+
Object.defineProperty(tracked, "searchParams", {
|
|
43
|
+
value: new Proxy(tracked.searchParams, { get(obj, key) {
|
|
44
|
+
if (key === "get" || key === "getAll" || key === "has") return (param, ...rest) => {
|
|
45
|
+
search_params_callback(param);
|
|
46
|
+
return obj[key](param, ...rest);
|
|
47
|
+
};
|
|
48
|
+
callback();
|
|
49
|
+
const value = Reflect.get(obj, key);
|
|
50
|
+
return typeof value === "function" ? value.bind(obj) : value;
|
|
51
|
+
} }),
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* URL properties that could change during the lifetime of the page,
|
|
57
|
+
* which excludes things like `origin`
|
|
58
|
+
* @type {(keyof URL)[]}
|
|
59
|
+
*/
|
|
60
|
+
const tracked_url_properties = [
|
|
61
|
+
"href",
|
|
62
|
+
"pathname",
|
|
63
|
+
"search",
|
|
64
|
+
"toString",
|
|
65
|
+
"toJSON"
|
|
66
|
+
];
|
|
67
|
+
if (allow_hash) tracked_url_properties.push("hash");
|
|
68
|
+
for (const property of tracked_url_properties) Object.defineProperty(tracked, property, {
|
|
69
|
+
get() {
|
|
70
|
+
callback();
|
|
71
|
+
return url[property];
|
|
72
|
+
},
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
tracked[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
77
|
+
return inspect(url, opts);
|
|
78
|
+
};
|
|
79
|
+
tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
80
|
+
return inspect(url.searchParams, opts);
|
|
81
|
+
};
|
|
82
|
+
if (!allow_hash) disable_hash(tracked);
|
|
83
|
+
return tracked;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Disallow access to `url.hash` on the server and in `load`
|
|
87
|
+
* @param {URL} url
|
|
88
|
+
*/
|
|
89
|
+
function disable_hash(url) {
|
|
90
|
+
allow_nodejs_console_log(url);
|
|
91
|
+
Object.defineProperty(url, "hash", { get() {
|
|
92
|
+
throw new Error("Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead");
|
|
93
|
+
} });
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Disallow access to `url.search` and `url.searchParams` during prerendering
|
|
97
|
+
* @param {URL} url
|
|
98
|
+
*/
|
|
99
|
+
function disable_search(url) {
|
|
100
|
+
allow_nodejs_console_log(url);
|
|
101
|
+
for (const property of ["search", "searchParams"]) Object.defineProperty(url, property, { get() {
|
|
102
|
+
throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);
|
|
103
|
+
} });
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Allow URL to be console logged, bypassing disabled properties.
|
|
107
|
+
* @param {URL} url
|
|
108
|
+
*/
|
|
109
|
+
function allow_nodejs_console_log(url) {
|
|
110
|
+
url[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
111
|
+
return inspect(new URL(url), opts);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.57.0_vite@8.2.2_@types_ab6e39593f61aae0ad0b9a1bac6935c7/node_modules/@sveltejs/kit/src/utils/hash.js
|
|
116
|
+
/**
|
|
117
|
+
* Hash using djb2
|
|
118
|
+
* @param {import('types').StrictBody[]} values
|
|
119
|
+
*/
|
|
120
|
+
function hash(...values) {
|
|
121
|
+
let hash = 5381;
|
|
122
|
+
for (const value of values) if (typeof value === "string") {
|
|
123
|
+
let i = value.length;
|
|
124
|
+
while (i) hash = hash * 33 ^ value.charCodeAt(--i);
|
|
125
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
126
|
+
const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
127
|
+
let i = buffer.length;
|
|
128
|
+
while (i) hash = hash * 33 ^ buffer[--i];
|
|
129
|
+
} else throw new TypeError("value must be a string or TypedArray");
|
|
130
|
+
return (hash >>> 0).toString(36);
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.57.0_vite@8.2.2_@types_ab6e39593f61aae0ad0b9a1bac6935c7/node_modules/@sveltejs/kit/src/utils/routing.js
|
|
134
|
+
/**
|
|
135
|
+
* @param {RegExpMatchArray} match
|
|
136
|
+
* @param {import('types').RouteParam[]} params
|
|
137
|
+
* @param {Record<string, import('@sveltejs/kit').ParamMatcher>} matchers
|
|
138
|
+
*/
|
|
139
|
+
function exec(match, params, matchers) {
|
|
140
|
+
/** @type {Record<string, string>} */
|
|
141
|
+
const result = {};
|
|
142
|
+
const values = match.slice(1);
|
|
143
|
+
const values_needing_match = values.filter((value) => value !== void 0);
|
|
144
|
+
let buffered = 0;
|
|
145
|
+
for (let i = 0; i < params.length; i += 1) {
|
|
146
|
+
const param = params[i];
|
|
147
|
+
let value = values[i - buffered];
|
|
148
|
+
if (param.chained && param.rest && buffered) {
|
|
149
|
+
value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
|
|
150
|
+
buffered = 0;
|
|
151
|
+
}
|
|
152
|
+
if (value === void 0) {
|
|
153
|
+
if (param.rest) value = "";
|
|
154
|
+
else continue;
|
|
155
|
+
}
|
|
156
|
+
if (!param.matcher || matchers[param.matcher](value)) {
|
|
157
|
+
result[param.name] = value;
|
|
158
|
+
const next_param = params[i + 1];
|
|
159
|
+
const next_value = values[i + 1];
|
|
160
|
+
if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) buffered = 0;
|
|
161
|
+
if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) buffered = 0;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (param.optional && param.chained) {
|
|
165
|
+
buffered++;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (buffered) return;
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Find the first route that matches the given path
|
|
175
|
+
* @template {{pattern: RegExp, params: import('types').RouteParam[]}} Route
|
|
176
|
+
* @param {string} path - The decoded pathname to match
|
|
177
|
+
* @param {Route[]} routes
|
|
178
|
+
* @param {Record<string, import('@sveltejs/kit').ParamMatcher>} matchers
|
|
179
|
+
* @returns {{ route: Route, params: Record<string, string> } | null}
|
|
180
|
+
*/
|
|
181
|
+
function find_route(path, routes, matchers) {
|
|
182
|
+
for (const route of routes) {
|
|
183
|
+
const match = route.pattern.exec(path);
|
|
184
|
+
if (!match) continue;
|
|
185
|
+
const matched = exec(match, route.params, matchers);
|
|
186
|
+
if (matched) return {
|
|
187
|
+
route,
|
|
188
|
+
params: decode_params(matched)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region node_modules/.pnpm/@sveltejs+kit@2.70.3_@sveltejs+vite-plugin-svelte@7.3.0_svelte@5.57.0_vite@8.2.2_@types_ab6e39593f61aae0ad0b9a1bac6935c7/node_modules/@sveltejs/kit/src/utils/exports.js
|
|
195
|
+
/**
|
|
196
|
+
* @param {Set<string>} expected
|
|
197
|
+
*/
|
|
198
|
+
function validator(expected) {
|
|
199
|
+
/**
|
|
200
|
+
* @param {any} module
|
|
201
|
+
* @param {string} [file]
|
|
202
|
+
*/
|
|
203
|
+
function validate(module, file) {
|
|
204
|
+
if (!module) return;
|
|
205
|
+
for (const key in module) {
|
|
206
|
+
if (key[0] === "_" || expected.has(key)) continue;
|
|
207
|
+
const values = [...expected.values()];
|
|
208
|
+
const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
|
|
209
|
+
throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return validate;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @param {string} key
|
|
216
|
+
* @param {string} ext
|
|
217
|
+
* @returns {string | void}
|
|
218
|
+
*/
|
|
219
|
+
function hint_for_supported_files(key, ext = ".js") {
|
|
220
|
+
const supported_files = [];
|
|
221
|
+
if (valid_layout_exports.has(key)) supported_files.push(`+layout${ext}`);
|
|
222
|
+
if (valid_page_exports.has(key)) supported_files.push(`+page${ext}`);
|
|
223
|
+
if (valid_layout_server_exports.has(key)) supported_files.push(`+layout.server${ext}`);
|
|
224
|
+
if (valid_page_server_exports.has(key)) supported_files.push(`+page.server${ext}`);
|
|
225
|
+
if (valid_server_exports.has(key)) supported_files.push(`+server${ext}`);
|
|
226
|
+
if (supported_files.length > 0) return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
|
|
227
|
+
}
|
|
228
|
+
var valid_layout_exports = /* @__PURE__ */ new Set([
|
|
229
|
+
"load",
|
|
230
|
+
"prerender",
|
|
231
|
+
"csr",
|
|
232
|
+
"ssr",
|
|
233
|
+
"trailingSlash",
|
|
234
|
+
"config"
|
|
235
|
+
]);
|
|
236
|
+
var valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
|
|
237
|
+
var valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
|
|
238
|
+
var valid_page_server_exports = /* @__PURE__ */ new Set([
|
|
239
|
+
...valid_layout_server_exports,
|
|
240
|
+
"actions",
|
|
241
|
+
"entries"
|
|
242
|
+
]);
|
|
243
|
+
var valid_server_exports = /* @__PURE__ */ new Set([
|
|
244
|
+
"GET",
|
|
245
|
+
"POST",
|
|
246
|
+
"PATCH",
|
|
247
|
+
"PUT",
|
|
248
|
+
"DELETE",
|
|
249
|
+
"OPTIONS",
|
|
250
|
+
"HEAD",
|
|
251
|
+
"fallback",
|
|
252
|
+
"prerender",
|
|
253
|
+
"trailingSlash",
|
|
254
|
+
"config",
|
|
255
|
+
"entries"
|
|
256
|
+
]);
|
|
257
|
+
var validate_layout_exports = validator(valid_layout_exports);
|
|
258
|
+
var validate_page_exports = validator(valid_page_exports);
|
|
259
|
+
var validate_layout_server_exports = validator(valid_layout_server_exports);
|
|
260
|
+
var validate_page_server_exports = validator(valid_page_server_exports);
|
|
261
|
+
|
|
262
|
+
export { disable_search as a, validate_layout_exports as b, validate_page_server_exports as c, decode_pathname as d, validate_page_exports as e, find_route as f, hash as h, make_trackable as m, normalize_path as n, resolve as r, validate_layout_server_exports as v };
|
|
263
|
+
//# sourceMappingURL=exports.js-CvFPPbaH.js.map
|