veryfront 0.1.704 → 0.1.705
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/esm/deno.js +1 -1
- package/esm/src/build/binary-plugin-includes.d.ts +1 -0
- package/esm/src/build/binary-plugin-includes.d.ts.map +1 -1
- package/esm/src/build/binary-plugin-includes.js +17 -1
- package/esm/src/cache/backends/api.js +1 -1
- package/esm/src/cache/backends/memory.js +1 -1
- package/esm/src/cache/backends/redis.js +1 -1
- package/esm/src/cache/{backends/batch-results.d.ts → batch-results.d.ts} +6 -6
- package/esm/src/cache/batch-results.d.ts.map +1 -0
- package/esm/src/cache/{backends/batch-results.js → batch-results.js} +6 -6
- package/esm/src/cache/request-cache-batcher.d.ts.map +1 -1
- package/esm/src/cache/request-cache-batcher.js +4 -5
- package/esm/src/cache/tokenizing-gateway.d.ts.map +1 -1
- package/esm/src/cache/tokenizing-gateway.js +11 -15
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/esm/src/cache/backends/batch-results.d.ts.map +0 -1
package/esm/deno.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare const BINARY_TAILWIND_PLUGIN_PACKAGES: readonly ["tailwindcss-animate@1.0.7", "@tailwindcss/typography@0.5.19", "@tailwindcss/forms@0.5.11", "tailwind-scrollbar-hide@2.0.0", "daisyui@5.5.14"];
|
|
2
|
+
export declare function resolveTailwindPluginBundlePackage(packageName: string): string;
|
|
2
3
|
export declare function getTailwindPluginBundleUrl(packageName: string): string;
|
|
3
4
|
export declare function getBinaryPluginBundleIncludes(): string[];
|
|
4
5
|
export { BINARY_TAILWIND_PLUGIN_PACKAGES };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-plugin-includes.d.ts","sourceRoot":"","sources":["../../../src/src/build/binary-plugin-includes.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,+BAA+B,0JAM3B,CAAC;
|
|
1
|
+
{"version":3,"file":"binary-plugin-includes.d.ts","sourceRoot":"","sources":["../../../src/src/build/binary-plugin-includes.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,+BAA+B,0JAM3B,CAAC;AAgBX,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAM9E;AAED,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED,wBAAgB,6BAA6B,IAAI,MAAM,EAAE,CAExD;AAED,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -5,8 +5,24 @@ const BINARY_TAILWIND_PLUGIN_PACKAGES = [
|
|
|
5
5
|
"tailwind-scrollbar-hide@2.0.0",
|
|
6
6
|
"daisyui@5.5.14",
|
|
7
7
|
];
|
|
8
|
+
function barePackageName(spec) {
|
|
9
|
+
if (spec.startsWith("@")) {
|
|
10
|
+
const versionIndex = spec.indexOf("@", 1);
|
|
11
|
+
return versionIndex === -1 ? spec : spec.slice(0, versionIndex);
|
|
12
|
+
}
|
|
13
|
+
const versionIndex = spec.indexOf("@");
|
|
14
|
+
return versionIndex === -1 ? spec : spec.slice(0, versionIndex);
|
|
15
|
+
}
|
|
16
|
+
const BINARY_TAILWIND_PLUGIN_PACKAGE_BY_NAME = new Map(BINARY_TAILWIND_PLUGIN_PACKAGES.map((pkg) => [barePackageName(pkg), pkg]));
|
|
17
|
+
export function resolveTailwindPluginBundlePackage(packageName) {
|
|
18
|
+
if (packageName.includes("@", packageName.startsWith("@") ? 1 : 0)) {
|
|
19
|
+
return packageName;
|
|
20
|
+
}
|
|
21
|
+
return BINARY_TAILWIND_PLUGIN_PACKAGE_BY_NAME.get(packageName) ?? packageName;
|
|
22
|
+
}
|
|
8
23
|
export function getTailwindPluginBundleUrl(packageName) {
|
|
9
|
-
|
|
24
|
+
const resolvedPackage = resolveTailwindPluginBundlePackage(packageName);
|
|
25
|
+
return `https://esm.sh/${resolvedPackage}?bundle&external=tailwindcss&target=denonext`;
|
|
10
26
|
}
|
|
11
27
|
export function getBinaryPluginBundleIncludes() {
|
|
12
28
|
return BINARY_TAILWIND_PLUGIN_PACKAGES.map(getTailwindPluginBundleUrl);
|
|
@@ -5,7 +5,7 @@ import { SpanNames } from "../../observability/tracing/span-names.js";
|
|
|
5
5
|
import { tryGetCacheKeyContext } from "../cache-key-builder.js";
|
|
6
6
|
import { CircuitBreakerOpen, getCircuitBreaker } from "../../utils/circuit-breaker.js";
|
|
7
7
|
import { getEnvValue } from "./helpers.js";
|
|
8
|
-
import { buildBatchResults } from "
|
|
8
|
+
import { buildBatchResults } from "../batch-results.js";
|
|
9
9
|
import { REQUEST_ERROR } from "../../errors/index.js";
|
|
10
10
|
const logger = baseLogger.component("api-cache-backend");
|
|
11
11
|
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MEMORY_CACHE_MAX_ENTRIES, MEMORY_CACHE_MAX_SIZE_BYTES, } from "../../utils/constants/cache.js";
|
|
2
|
-
import { buildBatchResults } from "
|
|
2
|
+
import { buildBatchResults } from "../batch-results.js";
|
|
3
3
|
const DEFAULT_TTL_SECONDS = 300;
|
|
4
4
|
const MAX_REGEX_CACHE_SIZE = 100;
|
|
5
5
|
export class MemoryCacheBackend {
|
|
@@ -2,7 +2,7 @@ import { logger as baseLogger } from "../../utils/index.js";
|
|
|
2
2
|
import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
3
3
|
import { SpanNames } from "../../observability/tracing/span-names.js";
|
|
4
4
|
import { getRedisClient, isRedisConfigured, } from "../../utils/redis-client.js";
|
|
5
|
-
import { buildBatchResults } from "
|
|
5
|
+
import { buildBatchResults } from "../batch-results.js";
|
|
6
6
|
const logger = baseLogger.component("redis-cache-backend");
|
|
7
7
|
// Re-export for use by factory
|
|
8
8
|
export { isRedisConfigured };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared batch-result assembly for cache
|
|
2
|
+
* Shared batch-result assembly for cache reads.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Cache backends and cache gateways often resolve a requested key list into a
|
|
5
|
+
* `Map<string, string | null>` where each requested key is present and missing
|
|
6
|
+
* values resolve to `null`. This helper centralizes that assembly so callers
|
|
7
|
+
* only supply the resolver.
|
|
8
8
|
*
|
|
9
|
-
* @module cache/
|
|
9
|
+
* @module cache/batch-results
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* Build a `Map` of batch results by resolving each key in order.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-results.d.ts","sourceRoot":"","sources":["../../../src/src/cache/batch-results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GACtC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAM5B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared batch-result assembly for cache
|
|
2
|
+
* Shared batch-result assembly for cache reads.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Cache backends and cache gateways often resolve a requested key list into a
|
|
5
|
+
* `Map<string, string | null>` where each requested key is present and missing
|
|
6
|
+
* values resolve to `null`. This helper centralizes that assembly so callers
|
|
7
|
+
* only supply the resolver.
|
|
8
8
|
*
|
|
9
|
-
* @module cache/
|
|
9
|
+
* @module cache/batch-results
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* Build a `Map` of batch results by resolving each key in order.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-cache-batcher.d.ts","sourceRoot":"","sources":["../../../src/src/cache/request-cache-batcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAK/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"request-cache-batcher.d.ts","sourceRoot":"","sources":["../../../src/src/cache/request-cache-batcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAK/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAClC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAC7C,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CAC1D;AAMD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAexE;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,GAAG,SAAS,CAExE;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkCxB;AAgDD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEzE;AAED,wBAAgB,oBAAoB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAK9E"}
|
|
@@ -3,6 +3,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
3
3
|
import { ensureError } from "../errors/veryfront-error.js";
|
|
4
4
|
import { logger as baseLogger } from "../utils/index.js";
|
|
5
5
|
import { MAX_BATCH_SIZE } from "../utils/constants/limits.js";
|
|
6
|
+
import { buildBatchResults } from "./batch-results.js";
|
|
6
7
|
const logger = baseLogger.component("request-cache-batcher");
|
|
7
8
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
8
9
|
const BATCH_DELAY_MS = 1;
|
|
@@ -90,11 +91,9 @@ async function flushBatch(ctx, backend) {
|
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
async function getIndividually(backend, keys) {
|
|
93
|
-
const
|
|
94
|
-
await Promise.all(keys.map(async (key) =>
|
|
95
|
-
|
|
96
|
-
}));
|
|
97
|
-
return results;
|
|
94
|
+
const entries = new Map();
|
|
95
|
+
await Promise.all(keys.map(async (key) => entries.set(key, await backend.get(key))));
|
|
96
|
+
return buildBatchResults(keys, (key) => entries.get(key) ?? null);
|
|
98
97
|
}
|
|
99
98
|
export function setInRequestCache(key, value) {
|
|
100
99
|
asyncLocalStorage.getStore()?.cache.set(key, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenizing-gateway.d.ts","sourceRoot":"","sources":["../../../src/src/cache/tokenizing-gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"tokenizing-gateway.d.ts","sourceRoot":"","sources":["../../../src/src/cache/tokenizing-gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,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,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzE;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,GACX,sBAAsB,CAExB"}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @module cache/tokenizing-gateway
|
|
14
14
|
*/
|
|
15
15
|
import { logger } from "../utils/index.js";
|
|
16
|
+
import { buildBatchResults } from "./batch-results.js";
|
|
16
17
|
import { assertPortableCode, detokenizeAllCachePaths, tokenizeAllVeryFrontPaths } from "./paths.js";
|
|
17
18
|
/**
|
|
18
19
|
* TokenizingCacheGateway wraps a CacheBackend and enforces tokenization
|
|
@@ -54,30 +55,25 @@ export class TokenizingCacheGateway {
|
|
|
54
55
|
* Get multiple codes from cache with automatic detokenization.
|
|
55
56
|
*/
|
|
56
57
|
async getCodeBatch(keys) {
|
|
57
|
-
const results = new Map();
|
|
58
58
|
if (keys.length === 0)
|
|
59
|
-
return
|
|
59
|
+
return new Map();
|
|
60
60
|
if (!this.backend.getBatch) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
return results;
|
|
61
|
+
const values = new Map();
|
|
62
|
+
await Promise.all(keys.map(async (key) => values.set(key, await this.getCode(key))));
|
|
63
|
+
return buildBatchResults(keys, (key) => values.get(key) ?? null);
|
|
66
64
|
}
|
|
67
65
|
const rawResults = await this.backend.getBatch(keys);
|
|
68
|
-
|
|
66
|
+
return buildBatchResults(keys, (key) => {
|
|
67
|
+
const raw = rawResults.get(key) ?? null;
|
|
69
68
|
if (!raw) {
|
|
70
|
-
|
|
71
|
-
continue;
|
|
69
|
+
return null;
|
|
72
70
|
}
|
|
73
71
|
// Only detokenize for distributed backends
|
|
74
72
|
if (!this.isDistributed()) {
|
|
75
|
-
|
|
76
|
-
continue;
|
|
73
|
+
return raw;
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
return results;
|
|
75
|
+
return detokenizeAllCachePaths(raw);
|
|
76
|
+
});
|
|
81
77
|
}
|
|
82
78
|
/**
|
|
83
79
|
* Store code in cache with automatic tokenization.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-results.d.ts","sourceRoot":"","sources":["../../../../src/src/cache/backends/batch-results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GACtC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAM5B"}
|