@vite-hub/rate-limit 0.5.1 → 0.6.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/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as writeCliFailure, E as askOnTerminal, O as readViteHubDevTargetOption, n as callOperationFromCli, u as table } from "./operations-
|
|
1
|
+
import { A as writeCliFailure, E as askOnTerminal, O as readViteHubDevTargetOption, n as callOperationFromCli, u as table } from "./operations-BZsu-Ssx.js";
|
|
2
2
|
import { t as redactInspectionText } from "./inspect-Dqvi9vUt.js";
|
|
3
3
|
import { t as rateLimitErrorDiagnostics } from "./error-diagnostics-ulOX0clN.js";
|
|
4
4
|
import { r as parseRateLimitWindow } from "./policy-CMsNKnqo.js";
|
|
@@ -914,7 +914,8 @@ const reservedOperationNamespaces = [
|
|
|
914
914
|
"login",
|
|
915
915
|
"logout",
|
|
916
916
|
"update",
|
|
917
|
-
"whoami"
|
|
917
|
+
"whoami",
|
|
918
|
+
"apps"
|
|
918
919
|
]
|
|
919
920
|
];
|
|
920
921
|
/** Input keys that the generated CLI commands read themselves. */
|
|
@@ -1286,7 +1287,7 @@ async function callOperation(target, name, input) {
|
|
|
1286
1287
|
const url = new URL(operationRpcPath.slice(1), base);
|
|
1287
1288
|
origin = url.origin;
|
|
1288
1289
|
const env = target.roots?.length ? {} : target.env;
|
|
1289
|
-
try {
|
|
1290
|
+
if (!target.authorization) try {
|
|
1290
1291
|
readConsoleSigningKey(env);
|
|
1291
1292
|
} catch (error) {
|
|
1292
1293
|
return {
|
|
@@ -1298,15 +1299,18 @@ async function callOperation(target, name, input) {
|
|
|
1298
1299
|
};
|
|
1299
1300
|
}
|
|
1300
1301
|
const outcome = await callOperationRpc(name, input ?? {}, async (body) => {
|
|
1301
|
-
const
|
|
1302
|
+
const signal = target.signal ?? AbortSignal.timeout(target.timeout ?? 3e4);
|
|
1303
|
+
const headers = target.authorization ? operationHeaders() : await signedOperationHeaders(env, url, body);
|
|
1304
|
+
if (target.authorization) headers.set("authorization", target.authorization);
|
|
1302
1305
|
if (target.confirmed !== void 0) headers.set(operationConfirmationHeader, target.confirmed ? "confirmed" : "required");
|
|
1303
1306
|
if (target.roots?.length) headers.set(operationExpectedRootsHeader, target.roots.map(projectRootHash).join(","));
|
|
1307
|
+
signal.throwIfAborted();
|
|
1304
1308
|
const response = await (target.fetch ?? fetch)(url.href, {
|
|
1305
1309
|
body,
|
|
1306
1310
|
headers,
|
|
1307
1311
|
method: "POST",
|
|
1308
1312
|
redirect: "manual",
|
|
1309
|
-
signal
|
|
1313
|
+
signal
|
|
1310
1314
|
});
|
|
1311
1315
|
const text = await response.text();
|
|
1312
1316
|
let json;
|
|
@@ -1343,7 +1347,7 @@ async function callOperation(target, name, input) {
|
|
|
1343
1347
|
} : void 0);
|
|
1344
1348
|
if (failure) {
|
|
1345
1349
|
if (target.roots?.length && failure.status === 401) failure.fix = `Pass --url ${base.href.slice(0, -1)} to send credentials. A command sends none to the dev server that it finds. ${failure.fix ?? "Set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key that `vitehub secret console-key` printed, and its public key in VITEHUB_CONSOLE_KEY_<NAME> on the app."}`;
|
|
1346
|
-
if ((failure.status === 401 || failure.status === 403) && !hasCredentials(env) && !failure.fix) failure.fix = target.roots?.length ? `Pass --url <origin> to send deployment credentials. ${operationCredentialHint}` : operationCredentialHint;
|
|
1350
|
+
if ((failure.status === 401 || failure.status === 403) && !target.authorization && !hasCredentials(env) && !failure.fix) failure.fix = target.roots?.length ? `Pass --url <origin> to send deployment credentials. ${operationCredentialHint}` : operationCredentialHint;
|
|
1347
1351
|
return {
|
|
1348
1352
|
ok: false,
|
|
1349
1353
|
...failure
|
package/dist/operations.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as internalErrorDiagnostics, a as operationRootHeader, c as projectRootHash, d as toOperationFailure, f as defineOperation, g as readOperationRpcCall, h as operationRpcRefusal, i as createOperationRegistry, l as runOperation, o as operationRpcHeader, p as answerOperationRpc, s as operationsOf, t as assertOperationProject } from "./operations-
|
|
1
|
+
import { F as internalErrorDiagnostics, a as operationRootHeader, c as projectRootHash, d as toOperationFailure, f as defineOperation, g as readOperationRpcCall, h as operationRpcRefusal, i as createOperationRegistry, l as runOperation, o as operationRpcHeader, p as answerOperationRpc, s as operationsOf, t as assertOperationProject } from "./operations-BZsu-Ssx.js";
|
|
2
2
|
import { n as isViteHubLoopbackPeer } from "./dev-peer-D0vOxmrD.js";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
// ../internal/src/secret.ts
|
package/dist/vite.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ interface ViteHubConsoleOperationAction {
|
|
|
158
158
|
operation: string;
|
|
159
159
|
input: Readonly<Record<string, string>>;
|
|
160
160
|
/**
|
|
161
|
-
* The result is `{ url }`, such as a
|
|
161
|
+
* The result is `{ url }`, such as a provider sign-in: the Console opens it in a new tab, and loads
|
|
162
162
|
* the list again when the person comes back. The URL must be `https:`, or `http:` on a loopback host.
|
|
163
163
|
*/
|
|
164
164
|
tab?: true;
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as isServerEnvironment, D as readViteHubDevServerFile, F as internalErrorDiagnostics, M as cloneRecord, N as isRecord, P as isRecordOrFunction, S as getResolvedFeatureOptions, T as shouldSkipViteProviderBuild, _ as invariant, b as createNoExternalAddition, j as writeViteHubDevServerFile, k as removeViteHubDevServerFile, m as operationRpcPath, r as collectOperationContributions, w as resolveViteHubProjectRoot, x as getDeploymentHost, y as VITEHUB_PROJECT_ROOT } from "./operations-
|
|
1
|
+
import { C as isServerEnvironment, D as readViteHubDevServerFile, F as internalErrorDiagnostics, M as cloneRecord, N as isRecord, P as isRecordOrFunction, S as getResolvedFeatureOptions, T as shouldSkipViteProviderBuild, _ as invariant, b as createNoExternalAddition, j as writeViteHubDevServerFile, k as removeViteHubDevServerFile, m as operationRpcPath, r as collectOperationContributions, w as resolveViteHubProjectRoot, x as getDeploymentHost, y as VITEHUB_PROJECT_ROOT } from "./operations-BZsu-Ssx.js";
|
|
2
2
|
import { i as resolve$1, n as relativeDefinitionFile, r as dirname$1 } from "./inspect-Dqvi9vUt.js";
|
|
3
3
|
import { t as addViteHubDevPeerDevHandler } from "./dev-peer-D0vOxmrD.js";
|
|
4
4
|
import { a as rateLimitPolicyKeys, i as rateLimitPolicyKey, n as normalizeRateLimitPolicy, t as declaredRateLimitPolicy } from "./policy-CMsNKnqo.js";
|
|
@@ -401,7 +401,11 @@ function mergeProviderOutputConfig(existing, value, ownership = {}) {
|
|
|
401
401
|
/** Select the runtime constants from one resolved Vite configuration. */
|
|
402
402
|
function resolveViteHubBundleDefines(config) {
|
|
403
403
|
const defines = {};
|
|
404
|
-
for (const name of [
|
|
404
|
+
for (const name of [
|
|
405
|
+
"__VITEHUB_PUBLIC_URL__",
|
|
406
|
+
"__VITEHUB_APP_BASE_URL__",
|
|
407
|
+
"__VITEHUB_CONSOLE_URL__"
|
|
408
|
+
]) {
|
|
405
409
|
const value = config.define?.[name];
|
|
406
410
|
if (typeof value === "string") defines[name] = value;
|
|
407
411
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/rate-limit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Provider-neutral Rate Limit primitives and Vite deployment integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@valibot/to-json-schema": "^1.8.0",
|
|
70
|
-
"@vite-hub/runtime": "0.
|
|
70
|
+
"@vite-hub/runtime": "0.6.0",
|
|
71
71
|
"birpc": "^4.2.0",
|
|
72
72
|
"h3": "^2.0.8",
|
|
73
73
|
"nostics": "1.4.0",
|