veryfront 0.1.1051 → 0.1.1052
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/agent/memory/redis.d.ts +8 -1
- package/esm/src/agent/memory/redis.d.ts.map +1 -1
- package/esm/src/agent/memory/redis.js +88 -25
- package/esm/src/cache/dependency-graph.d.ts +2 -0
- package/esm/src/cache/dependency-graph.d.ts.map +1 -1
- package/esm/src/cache/dependency-graph.js +28 -0
- package/esm/src/config/loader.d.ts +10 -0
- package/esm/src/config/loader.d.ts.map +1 -1
- package/esm/src/config/loader.js +33 -1
- package/esm/src/platform/compat/fs.d.ts +1 -1
- package/esm/src/platform/compat/fs.d.ts.map +1 -1
- package/esm/src/platform/compat/fs.js +7 -1
- package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.js +7 -1
- package/esm/src/server/services/static/static-file.service.d.ts.map +1 -1
- package/esm/src/server/services/static/static-file.service.js +20 -8
- package/esm/src/utils/bundle-manifest-init.d.ts.map +1 -1
- package/esm/src/utils/bundle-manifest-init.js +11 -25
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
- package/esm/src/utils/bundle-manifest-kv.d.ts +0 -18
- package/esm/src/utils/bundle-manifest-kv.d.ts.map +0 -1
- package/esm/src/utils/bundle-manifest-kv.js +0 -33
- package/esm/src/utils/bundle-manifest-redis.d.ts +0 -19
- package/esm/src/utils/bundle-manifest-redis.d.ts.map +0 -1
- package/esm/src/utils/bundle-manifest-redis.js +0 -33
package/esm/deno.js
CHANGED
|
@@ -8,6 +8,10 @@ import { type Memory, type MemoryConfigBase, type MemoryStats, type MinimalMessa
|
|
|
8
8
|
/**
|
|
9
9
|
* Redis client interface (compatible with ioredis and node-redis)
|
|
10
10
|
*/
|
|
11
|
+
export interface RedisEvalOptions {
|
|
12
|
+
keys: string[];
|
|
13
|
+
arguments: string[];
|
|
14
|
+
}
|
|
11
15
|
export interface RedisClient {
|
|
12
16
|
get(key: string): Promise<string | null>;
|
|
13
17
|
set(key: string, value: string, options?: {
|
|
@@ -15,6 +19,9 @@ export interface RedisClient {
|
|
|
15
19
|
}): Promise<unknown>;
|
|
16
20
|
del(key: string): Promise<number>;
|
|
17
21
|
expire(key: string, seconds: number): Promise<number>;
|
|
22
|
+
eval?(script: string, options: RedisEvalOptions): Promise<unknown>;
|
|
23
|
+
sendCommand?(args: string[]): Promise<unknown>;
|
|
24
|
+
call?(command: string, ...args: string[]): Promise<unknown>;
|
|
18
25
|
}
|
|
19
26
|
/**
|
|
20
27
|
* Redis memory configuration
|
|
@@ -46,7 +53,7 @@ export declare class RedisMemory<M extends MinimalMessage = MinimalMessage> impl
|
|
|
46
53
|
clear(): Promise<void>;
|
|
47
54
|
getStats(): Promise<MemoryStats>;
|
|
48
55
|
touch(): Promise<void>;
|
|
49
|
-
private
|
|
56
|
+
private atomicAdd;
|
|
50
57
|
}
|
|
51
58
|
/** Create redis memory. */
|
|
52
59
|
export declare function createRedisMemory<M extends MinimalMessage = MinimalMessage>(agentId: string, config: RedisMemoryConfig): RedisMemory<M>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/memory/redis.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAI/B;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE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lp-setup.js";
|
|
|
9
9
|
import { agentLogger } from "../../utils/logger/logger.js";
|
|
10
10
|
const DEFAULT_TTL = 86_400; // 24 hours
|
|
11
11
|
const DEFAULT_KEY_PREFIX = "veryfront:agent:memory:";
|
|
12
|
+
const ATOMIC_ADD_SCRIPT = `
|
|
13
|
+
local key = KEYS[1]
|
|
14
|
+
local message_json = ARGV[1]
|
|
15
|
+
local max_messages = tonumber(ARGV[2]) or 0
|
|
16
|
+
local max_tokens = tonumber(ARGV[3]) or 0
|
|
17
|
+
local ttl = tonumber(ARGV[4]) or 0
|
|
18
|
+
|
|
19
|
+
local function decode_json(value, label)
|
|
20
|
+
local ok, decoded = pcall(cjson.decode, value)
|
|
21
|
+
if not ok then
|
|
22
|
+
return nil, redis.error_reply("CORRUPT_REDIS_MEMORY_JSON:" .. label)
|
|
23
|
+
end
|
|
24
|
+
if type(decoded) ~= "table" then
|
|
25
|
+
return nil, redis.error_reply("CORRUPT_REDIS_MEMORY_JSON:" .. label)
|
|
26
|
+
end
|
|
27
|
+
return decoded, nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
local messages = {}
|
|
31
|
+
local current = redis.call("GET", key)
|
|
32
|
+
if current and current ~= "" then
|
|
33
|
+
local decoded, decode_error = decode_json(current, "stored")
|
|
34
|
+
if decode_error then return decode_error end
|
|
35
|
+
messages = decoded
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
local message, message_error = decode_json(message_json, "message")
|
|
39
|
+
if message_error then return message_error end
|
|
40
|
+
table.insert(messages, message)
|
|
41
|
+
|
|
42
|
+
if max_messages > 0 then
|
|
43
|
+
while #messages > max_messages do
|
|
44
|
+
table.remove(messages, 1)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
local function message_text_length(item)
|
|
49
|
+
if type(item) ~= "table" or type(item.parts) ~= "table" then return 0 end
|
|
50
|
+
local total = 0
|
|
51
|
+
for _, part in ipairs(item.parts) do
|
|
52
|
+
if type(part) == "table" and part.type == "text" and type(part.text) == "string" then
|
|
53
|
+
total = total + string.len(part.text)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
return total
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
local function estimate_tokens(items)
|
|
60
|
+
local total = 0
|
|
61
|
+
for _, item in ipairs(items) do
|
|
62
|
+
total = total + message_text_length(item)
|
|
63
|
+
end
|
|
64
|
+
return math.ceil(total / 4)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if max_tokens > 0 then
|
|
68
|
+
while #messages > 1 and estimate_tokens(messages) > max_tokens do
|
|
69
|
+
table.remove(messages, 1)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
local encoded = cjson.encode(messages)
|
|
74
|
+
if ttl > 0 then
|
|
75
|
+
redis.call("SET", key, encoded, "EX", ttl)
|
|
76
|
+
else
|
|
77
|
+
redis.call("SET", key, encoded)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
return #messages
|
|
81
|
+
`;
|
|
12
82
|
/** Implement redis memory. */
|
|
13
83
|
export class RedisMemory {
|
|
14
84
|
client;
|
|
@@ -48,22 +118,7 @@ export class RedisMemory {
|
|
|
48
118
|
add(message) {
|
|
49
119
|
return withSpan("agent.memory.redis.add", async () => {
|
|
50
120
|
const key = this.getKey();
|
|
51
|
-
|
|
52
|
-
// exposes only get/set/del/expire (no eval/rPush), so concurrent add()
|
|
53
|
-
// calls on the same key can lose updates (last writer wins). Given an
|
|
54
|
-
// atomic list op or Lua eval, prefer an atomic append here.
|
|
55
|
-
let messages = this.parseMessages(await this.client.get(key));
|
|
56
|
-
messages.push(message);
|
|
57
|
-
const { maxMessages, maxTokens } = this.config;
|
|
58
|
-
if (maxMessages && messages.length > maxMessages) {
|
|
59
|
-
messages = messages.slice(-maxMessages);
|
|
60
|
-
}
|
|
61
|
-
if (maxTokens) {
|
|
62
|
-
messages = this.trimToTokenLimit(messages);
|
|
63
|
-
}
|
|
64
|
-
// TTL <= 0 means no expiration
|
|
65
|
-
const options = this.ttl > 0 ? { EX: this.ttl } : undefined;
|
|
66
|
-
await this.client.set(key, JSON.stringify(messages), options);
|
|
121
|
+
await this.atomicAdd(key, message);
|
|
67
122
|
}, { "memory.type": "redis", "memory.agent_id": this.agentId, "memory.ttl": this.ttl });
|
|
68
123
|
}
|
|
69
124
|
getMessages() {
|
|
@@ -92,16 +147,24 @@ export class RedisMemory {
|
|
|
92
147
|
await this.client.expire(this.getKey(), this.ttl);
|
|
93
148
|
}, { "memory.type": "redis", "memory.agent_id": this.agentId, "memory.ttl": this.ttl });
|
|
94
149
|
}
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
150
|
+
atomicAdd(key, message) {
|
|
151
|
+
const args = [
|
|
152
|
+
JSON.stringify(message),
|
|
153
|
+
String(this.config.maxMessages ?? 0),
|
|
154
|
+
String(this.config.maxTokens ?? 0),
|
|
155
|
+
String(this.ttl),
|
|
156
|
+
];
|
|
157
|
+
if (typeof this.client.sendCommand === "function") {
|
|
158
|
+
return this.client.sendCommand(["EVAL", ATOMIC_ADD_SCRIPT, "1", key, ...args]).then(() => { });
|
|
103
159
|
}
|
|
104
|
-
|
|
160
|
+
if (typeof this.client.call === "function") {
|
|
161
|
+
return this.client.call("EVAL", ATOMIC_ADD_SCRIPT, "1", key, ...args).then(() => { });
|
|
162
|
+
}
|
|
163
|
+
if (typeof this.client.eval === "function") {
|
|
164
|
+
return this.client.eval(ATOMIC_ADD_SCRIPT, { keys: [key], arguments: args }).then(() => { });
|
|
165
|
+
}
|
|
166
|
+
throw new Error("RedisMemory requires Redis sendCommand(), call(), or eval() for atomic add(); " +
|
|
167
|
+
"non-atomic GET/SET append is not supported");
|
|
105
168
|
}
|
|
106
169
|
}
|
|
107
170
|
/** Create redis memory. */
|
|
@@ -9,6 +9,7 @@ export declare class DependencyGraph {
|
|
|
9
9
|
getDirectDependencies(filePath: string): string[];
|
|
10
10
|
getTransitiveDependencies(filePath: string): string[];
|
|
11
11
|
getDependents(filePath: string): string[];
|
|
12
|
+
removeModule(filePath: string): void;
|
|
12
13
|
wouldCreateCycle(from: string, to: string): boolean;
|
|
13
14
|
clear(): void;
|
|
14
15
|
getAllModules(): string[];
|
|
@@ -24,6 +25,7 @@ export interface DependencyHashCache {
|
|
|
24
25
|
buildQueue: Promise<void>;
|
|
25
26
|
}
|
|
26
27
|
export declare function createDependencyHashCache(): DependencyHashCache;
|
|
28
|
+
export declare function invalidateDependencyHashCache(cache: DependencyHashCache, changedPaths: Iterable<string>): number;
|
|
27
29
|
export declare function extractImports(code: string): Promise<string[]>;
|
|
28
30
|
/**
|
|
29
31
|
* Filter imports to only local/relative paths (excludes npm, URLs, and framework imports).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-graph.d.ts","sourceRoot":"","sources":["../../../src/src/cache/dependency-graph.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,qBAAa,eAAe;IAC1B,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,UAAU,CAAkC;IAEpD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI;IAwBzD,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAIjD,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAUrD,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAUzC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO;IAInD,KAAK,IAAI,IAAI;IAKb,aAAa,IAAI,MAAM,EAAE;IAIzB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,uBAAuB;IAsB/B,OAAO,CAAC,iBAAiB;CAgB1B;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,E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AAC,MAAM,CAAC,CAgBjB"}
|
|
@@ -45,6 +45,18 @@ export class DependencyGraph {
|
|
|
45
45
|
visited.delete(filePath);
|
|
46
46
|
return Array.from(visited);
|
|
47
47
|
}
|
|
48
|
+
removeModule(filePath) {
|
|
49
|
+
const previousDeps = this.dependencies.get(filePath);
|
|
50
|
+
if (previousDeps) {
|
|
51
|
+
for (const dep of previousDeps) {
|
|
52
|
+
const dependents = this.dependents.get(dep);
|
|
53
|
+
dependents?.delete(filePath);
|
|
54
|
+
if (dependents?.size === 0)
|
|
55
|
+
this.dependents.delete(dep);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
this.dependencies.delete(filePath);
|
|
59
|
+
}
|
|
48
60
|
wouldCreateCycle(from, to) {
|
|
49
61
|
return this.hasTransitiveDependency(to, from, new Set(), new Set());
|
|
50
62
|
}
|
|
@@ -99,6 +111,22 @@ export function createDependencyHashCache() {
|
|
|
99
111
|
buildQueue: Promise.resolve(),
|
|
100
112
|
};
|
|
101
113
|
}
|
|
114
|
+
export function invalidateDependencyHashCache(cache, changedPaths) {
|
|
115
|
+
const modulesToInvalidate = new Set();
|
|
116
|
+
for (const changedPath of changedPaths) {
|
|
117
|
+
modulesToInvalidate.add(changedPath);
|
|
118
|
+
for (const dependent of cache.graph.getDependents(changedPath)) {
|
|
119
|
+
modulesToInvalidate.add(dependent);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (const filePath of modulesToInvalidate) {
|
|
123
|
+
cache.completedModules.delete(filePath);
|
|
124
|
+
cache.contentHashes.delete(filePath);
|
|
125
|
+
cache.inProgressModules.delete(filePath);
|
|
126
|
+
cache.graph.removeModule(filePath);
|
|
127
|
+
}
|
|
128
|
+
return modulesToInvalidate.size;
|
|
129
|
+
}
|
|
102
130
|
export async function extractImports(code) {
|
|
103
131
|
const parsed = await parseAllImports(code);
|
|
104
132
|
return parsed.imports.map((imp) => imp.specifier);
|
|
@@ -3,6 +3,16 @@ import type { RuntimeAdapter } from "../platform/adapters/base.js";
|
|
|
3
3
|
export type { VeryfrontConfig } from "./schemas/index.js";
|
|
4
4
|
/** @internal Exported for tests: merges user config over fresh defaults (deep for nested objects). */
|
|
5
5
|
export declare function mergeConfigs(userConfig: Partial<VeryfrontConfig>): VeryfrontConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Rewrite bare `veryfront` import specifiers to the inline config shim so
|
|
8
|
+
* temp-file config modules can load. Static imports only (`import ... from
|
|
9
|
+
* "veryfront"` and side-effect `import "veryfront"`); subpaths like
|
|
10
|
+
* `veryfront/head` are left untouched and will fail loudly, which is correct —
|
|
11
|
+
* they have no meaning in a config file.
|
|
12
|
+
*
|
|
13
|
+
* @internal exported for tests
|
|
14
|
+
*/
|
|
15
|
+
export declare function rewriteBareVeryfrontConfigImports(source: string): string;
|
|
6
16
|
/** @internal */
|
|
7
17
|
export declare function transpileConfigSourceForImport(source: string, configPath: string): Promise<string>;
|
|
8
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/src/config/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAiCnE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsJ1D,sGAAsG;AACtG,wBAAgB,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAuFlF;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/src/config/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAiCnE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsJ1D,sGAAsG;AACtG,wBAAgB,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAuFlF;AAqFD;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED,gBAAgB;AAChB,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAUjB;AA4FD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAmF1B;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAI9E"}
|
package/esm/src/config/loader.js
CHANGED
|
@@ -289,7 +289,7 @@ async function loadConfigFromTempFile(source, configPath, loadUrl) {
|
|
|
289
289
|
const tempDir = await fs.makeTempDir({ prefix: "vf-config-" });
|
|
290
290
|
const tempFile = join(tempDir, `config${extension}`);
|
|
291
291
|
try {
|
|
292
|
-
await fs.writeTextFile(tempFile, processedSource);
|
|
292
|
+
await fs.writeTextFile(tempFile, rewriteBareVeryfrontConfigImports(processedSource));
|
|
293
293
|
const configModule = await import(loadUrl(tempFile));
|
|
294
294
|
return configModule.default || configModule;
|
|
295
295
|
}
|
|
@@ -297,6 +297,38 @@ async function loadConfigFromTempFile(source, configPath, loadUrl) {
|
|
|
297
297
|
await fs.remove(tempDir, { recursive: true });
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Inline stand-in for the bare `veryfront` specifier in user config files.
|
|
302
|
+
*
|
|
303
|
+
* Config modules loaded through {@link loadConfigFromTempFile} execute from a
|
|
304
|
+
* temp file, where bare specifiers have no resolver: Node has no node_modules
|
|
305
|
+
* relative to the temp dir, and compiled Deno binaries have no import map for
|
|
306
|
+
* external dynamic imports. Every config helper the framework entrypoint
|
|
307
|
+
* exposes is a thin pure function, so a data: URL module is a faithful
|
|
308
|
+
* stand-in. Written with double quotes only — encodeURIComponent escapes
|
|
309
|
+
* them, keeping the URL safe inside either quote style of the rewritten
|
|
310
|
+
* import statement.
|
|
311
|
+
*/
|
|
312
|
+
const VERYFRONT_CONFIG_SHIM = [
|
|
313
|
+
"export const defineConfig = (config) => config;",
|
|
314
|
+
"export const defineConfigWithEnv = (factory, envConfig) =>",
|
|
315
|
+
' factory(envConfig?.nodeEnv ?? globalThis.Deno?.env?.get?.("NODE_ENV") ??',
|
|
316
|
+
' globalThis.process?.env?.NODE_ENV ?? "production");',
|
|
317
|
+
"export const mergeConfigs = (...configs) => Object.assign({}, ...configs);",
|
|
318
|
+
].join("\n");
|
|
319
|
+
const VERYFRONT_CONFIG_SHIM_URL = `data:text/javascript,${encodeURIComponent(VERYFRONT_CONFIG_SHIM)}`;
|
|
320
|
+
/**
|
|
321
|
+
* Rewrite bare `veryfront` import specifiers to the inline config shim so
|
|
322
|
+
* temp-file config modules can load. Static imports only (`import ... from
|
|
323
|
+
* "veryfront"` and side-effect `import "veryfront"`); subpaths like
|
|
324
|
+
* `veryfront/head` are left untouched and will fail loudly, which is correct —
|
|
325
|
+
* they have no meaning in a config file.
|
|
326
|
+
*
|
|
327
|
+
* @internal exported for tests
|
|
328
|
+
*/
|
|
329
|
+
export function rewriteBareVeryfrontConfigImports(source) {
|
|
330
|
+
return source.replace(/(\bfrom\s*|\bimport\s+)(["'])veryfront\2/g, (_match, prefix, quote) => `${prefix}${quote}${VERYFRONT_CONFIG_SHIM_URL}${quote}`);
|
|
331
|
+
}
|
|
300
332
|
/** @internal */
|
|
301
333
|
export async function transpileConfigSourceForImport(source, configPath) {
|
|
302
334
|
const { transform } = await import("../extensions/bundler/index.js");
|
|
@@ -69,7 +69,7 @@ export declare function symlink(target: string, path: string): Promise<void>;
|
|
|
69
69
|
*/
|
|
70
70
|
export declare function realPath(path: string): Promise<string>;
|
|
71
71
|
/** Error shape for is not found. */
|
|
72
|
-
export declare function isNotFoundError(error: unknown): boolean;
|
|
72
|
+
export declare function isNotFoundError(error: unknown, seen?: Set<unknown>): boolean;
|
|
73
73
|
/** Error shape for is already exists. */
|
|
74
74
|
export declare function isAlreadyExistsError(error: unknown): boolean;
|
|
75
75
|
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/fs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAgBpD,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,OAAO,CACL,IA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C;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAED;AAED,uBAAuB;AACvB,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1E;AAED,+BAA+B;AAC/B,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQzE;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5D;AAWD,oCAAoC;AACpC,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,CAAC,OAAO,CAAa,GAAG,OAAO,CAmBvF;AAED,yCAAyC;AACzC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAI5D"}
|
|
@@ -288,7 +288,10 @@ export async function realPath(path) {
|
|
|
288
288
|
return await fs.realpath(path);
|
|
289
289
|
}
|
|
290
290
|
/** Error shape for is not found. */
|
|
291
|
-
export function isNotFoundError(error) {
|
|
291
|
+
export function isNotFoundError(error, seen = new Set()) {
|
|
292
|
+
if (seen.has(error))
|
|
293
|
+
return false;
|
|
294
|
+
seen.add(error);
|
|
292
295
|
const NotFound = dntShim.dntGlobalThis.Deno?.errors?.NotFound;
|
|
293
296
|
if (isDeno && NotFound && error instanceof NotFound)
|
|
294
297
|
return true;
|
|
@@ -298,6 +301,9 @@ export function isNotFoundError(error) {
|
|
|
298
301
|
error.slug === "file-not-found") {
|
|
299
302
|
return true;
|
|
300
303
|
}
|
|
304
|
+
if (error instanceof Error && "cause" in error) {
|
|
305
|
+
return isNotFoundError(error.cause, seen);
|
|
306
|
+
}
|
|
301
307
|
return false;
|
|
302
308
|
}
|
|
303
309
|
/** Error shape for is already exists. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-bridge.d.ts","sourceRoot":"","sources":["../../../src/src/runtime/runtime-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2DAA2D,CAAC;AAC9G,OAAO,KAAK,EACV,yBAAyB,EAEzB,mBAAmB,EACnB,6BAA6B,EAC7B,cAAc,EACf,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EAEb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,4BAA4B,EAAE,CAAC;IACzC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,2BAA2B,CAAC,EAAE,6BAA6B,CAAC;IAC5D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,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1C;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB;;;;;;;GAUlD;AACD,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAsBjE"}
|
|
@@ -600,14 +600,20 @@ export function streamText(options) {
|
|
|
600
600
|
// set their flag synchronously before the first `await` below, so concurrent
|
|
601
601
|
// dual consumption is detected and teed correctly).
|
|
602
602
|
const hasStarted = { full: false, text: false };
|
|
603
|
+
let rawBranch = null;
|
|
603
604
|
let teed = null;
|
|
604
605
|
const acquire = async (branch) => {
|
|
605
606
|
const other = branch === "full" ? "text" : "full";
|
|
606
607
|
const { stream } = await directResultPromise;
|
|
608
|
+
if (rawBranch !== null && rawBranch !== branch) {
|
|
609
|
+
throw new Error("Consume fullStream and textStream concurrently, or consume only one branch");
|
|
610
|
+
}
|
|
607
611
|
// Only one branch consumed (the common case): hand it the raw stream so it
|
|
608
612
|
// reads with full backpressure and nothing is buffered.
|
|
609
|
-
if (!hasStarted[other] && teed === null)
|
|
613
|
+
if (!hasStarted[other] && teed === null) {
|
|
614
|
+
rawBranch = branch;
|
|
610
615
|
return stream;
|
|
616
|
+
}
|
|
611
617
|
// Both branches are consumed: tee once (memoized) so each sees every chunk.
|
|
612
618
|
if (teed === null)
|
|
613
619
|
teed = Promise.resolve(stream.tee());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-file.service.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/services/static/static-file.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"static-file.service.d.ts","sourceRoot":"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AAI,CAE7E;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoC;IAChE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAoD;IAElF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAuB;gBAEnC,MAAM,CAAC,EAAE,oBAAoB;IAIzC,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,aAAa;IAWf,WAAW,CACf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAsBrB,eAAe;YAiCf,mBAAmB;IA4CjC,OAAO,CAAC,sBAAsB;YAmBhB,oBAAoB;YAYpB,iBAAiB;IA+C/B,OAAO,CAAC,qBAAqB;IAyC7B,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQzC,OAAO,CAAC,eAAe;IAUvB,MAAM,CAAC,UAAU,IAAI,IAAI;CAI1B"}
|
|
@@ -16,6 +16,14 @@ import { normalizeChunkPath } from "../../utils/chunk-utils.js";
|
|
|
16
16
|
import { computeEtag } from "../../handlers/utils/etag.js";
|
|
17
17
|
import { getContentType as getContentTypeFromExt } from "../../handlers/utils/content-types.js";
|
|
18
18
|
const logger = serverLogger.component("static-file-service");
|
|
19
|
+
function isExpectedCandidateMiss(error) {
|
|
20
|
+
if (isNotFoundError(error))
|
|
21
|
+
return true;
|
|
22
|
+
const maybeVeryfrontError = error;
|
|
23
|
+
return error instanceof Error &&
|
|
24
|
+
maybeVeryfrontError.name === "VeryfrontError" &&
|
|
25
|
+
maybeVeryfrontError.slug === "security-violation";
|
|
26
|
+
}
|
|
19
27
|
let injectedDeps = null;
|
|
20
28
|
/**
|
|
21
29
|
* Inject dependencies for testing. Pass null to reset to defaults.
|
|
@@ -50,11 +58,14 @@ export class StaticFileService {
|
|
|
50
58
|
const fs = this.getFileSystem(options);
|
|
51
59
|
const normalizedPath = requestPath === "/" ? "/index.html" : requestPath;
|
|
52
60
|
const candidates = await this.buildCandidates(normalizedPath, options, fs);
|
|
61
|
+
const unexpectedErrors = [];
|
|
53
62
|
for (const candidate of candidates) {
|
|
54
|
-
const result = await this.tryResolveCandidate(candidate, requestPath, options, fs);
|
|
63
|
+
const result = await this.tryResolveCandidate(candidate, requestPath, options, fs, unexpectedErrors);
|
|
55
64
|
if (result)
|
|
56
65
|
return result;
|
|
57
66
|
}
|
|
67
|
+
if (unexpectedErrors.length > 0)
|
|
68
|
+
throw unexpectedErrors[0];
|
|
58
69
|
return null;
|
|
59
70
|
}
|
|
60
71
|
async buildCandidates(normalizedPath, options, fs) {
|
|
@@ -83,7 +94,7 @@ export class StaticFileService {
|
|
|
83
94
|
}
|
|
84
95
|
return candidates;
|
|
85
96
|
}
|
|
86
|
-
async tryResolveCandidate(candidate, requestPath, options, fs) {
|
|
97
|
+
async tryResolveCandidate(candidate, requestPath, options, fs, unexpectedErrors) {
|
|
87
98
|
try {
|
|
88
99
|
const info = await fs.stat(candidate.path);
|
|
89
100
|
if (!info.isFile)
|
|
@@ -105,12 +116,13 @@ export class StaticFileService {
|
|
|
105
116
|
// candidate the security layer rejects (outside the allowed roots), just
|
|
106
117
|
// means "this candidate does not apply" — resolveFile() must still try the
|
|
107
118
|
// remaining candidates, so we fall through to null rather than throwing.
|
|
108
|
-
// Genuinely unexpected errors are logged for diagnosability
|
|
109
|
-
// fail resolution of a sibling candidate that would have
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
if (!
|
|
119
|
+
// Genuinely unexpected errors are logged and recorded for diagnosability,
|
|
120
|
+
// but must not fail resolution of a sibling candidate that would have
|
|
121
|
+
// matched. resolveFile() rethrows the first recorded error only after all
|
|
122
|
+
// candidates miss, so transient I/O failures surface as 5xx instead of
|
|
123
|
+
// cacheable 404s without breaking candidate probing.
|
|
124
|
+
if (!isExpectedCandidateMiss(error)) {
|
|
125
|
+
unexpectedErrors.push(error);
|
|
114
126
|
logger.debug("Static file candidate did not resolve", {
|
|
115
127
|
path: candidate.path,
|
|
116
128
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-manifest-init.d.ts","sourceRoot":"","sources":["../../../src/src/utils/bundle-manifest-init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,oEAAoE;AACpE,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE;QACN,cAAc,CAAC,EAAE;YACf,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,GAAG,CAAC,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"bundle-manifest-init.d.ts","sourceRoot":"","sources":["../../../src/src/utils/bundle-manifest-init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,oEAAoE;AACpE,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE;QACN,cAAc,CAAC,EAAE;YACf,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,GAAG,CAAC,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH;AAiBD,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,aAAa,GAAG,YAAY,EAClC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,CAiCf;AAmBD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,aAAa,GAAG,YAAY,GACjC,MAAM,GAAG,SAAS,CAMpB"}
|
|
@@ -2,6 +2,12 @@ import { serverLogger } from "./logger/index.js";
|
|
|
2
2
|
import { InMemoryBundleManifestStore, setBundleManifestStore, } from "./bundle-manifest.js";
|
|
3
3
|
import { BUNDLE_MANIFEST_DEV_TTL_MS, BUNDLE_MANIFEST_PROD_TTL_MS } from "./constants/cache.js";
|
|
4
4
|
const logger = serverLogger.component("bundle-manifest");
|
|
5
|
+
class UnsupportedBundleManifestStoreError extends Error {
|
|
6
|
+
constructor(storeType) {
|
|
7
|
+
super(`Bundle manifest store type "${storeType}" is configured but is not implemented`);
|
|
8
|
+
this.name = "UnsupportedBundleManifestStoreError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
5
11
|
export async function initializeBundleManifest(config, mode, adapter) {
|
|
6
12
|
const manifestConfig = config.cache?.bundleManifest;
|
|
7
13
|
const enabled = manifestConfig?.enabled ?? mode === "production";
|
|
@@ -25,40 +31,20 @@ export async function initializeBundleManifest(config, mode, adapter) {
|
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
catch (error) {
|
|
34
|
+
if (error instanceof UnsupportedBundleManifestStoreError)
|
|
35
|
+
throw error;
|
|
28
36
|
logger.error("Failed to initialize store, using in-memory fallback", {
|
|
29
37
|
error,
|
|
30
38
|
});
|
|
31
39
|
setBundleManifestStore(new InMemoryBundleManifestStore());
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
|
-
async function createStore(storeType,
|
|
35
|
-
const bundleManifest = cacheConfig?.bundleManifest;
|
|
42
|
+
async function createStore(storeType, _cacheConfig, _adapter) {
|
|
36
43
|
if (storeType === "redis") {
|
|
37
|
-
|
|
38
|
-
const redisUrl = bundleManifest?.redisUrl ??
|
|
39
|
-
adapter?.env.get("VERYFRONT_BUNDLE_MANIFEST_REDIS_URL");
|
|
40
|
-
const store = new RedisBundleManifestStore({
|
|
41
|
-
url: redisUrl,
|
|
42
|
-
keyPrefix: bundleManifest?.keyPrefix,
|
|
43
|
-
}, adapter);
|
|
44
|
-
if (!(await store.isAvailable())) {
|
|
45
|
-
logger.warn("Redis not available, falling back to in-memory");
|
|
46
|
-
return new InMemoryBundleManifestStore();
|
|
47
|
-
}
|
|
48
|
-
logger.debug("Redis store initialized");
|
|
49
|
-
return store;
|
|
44
|
+
throw new UnsupportedBundleManifestStoreError(storeType);
|
|
50
45
|
}
|
|
51
46
|
if (storeType === "kv") {
|
|
52
|
-
|
|
53
|
-
const store = new KVBundleManifestStore({
|
|
54
|
-
keyPrefix: bundleManifest?.keyPrefix,
|
|
55
|
-
});
|
|
56
|
-
if (!(await store.isAvailable())) {
|
|
57
|
-
logger.warn("KV not available, falling back to in-memory");
|
|
58
|
-
return new InMemoryBundleManifestStore();
|
|
59
|
-
}
|
|
60
|
-
logger.debug("KV store initialized");
|
|
61
|
-
return store;
|
|
47
|
+
throw new UnsupportedBundleManifestStoreError(storeType);
|
|
62
48
|
}
|
|
63
49
|
logger.debug("In-memory store initialized");
|
|
64
50
|
return new InMemoryBundleManifestStore();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1052",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -329,10 +329,10 @@
|
|
|
329
329
|
"@types/react": "19.2.14",
|
|
330
330
|
"@types/react-dom": "19.2.3",
|
|
331
331
|
"ws": "8.21.0",
|
|
332
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
333
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
334
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
335
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
332
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1052",
|
|
333
|
+
"@veryfront/ext-content-mdx": "0.1.1052",
|
|
334
|
+
"@veryfront/ext-css-tailwind": "0.1.1052",
|
|
335
|
+
"@veryfront/ext-parser-babel": "0.1.1052"
|
|
336
336
|
},
|
|
337
337
|
"devDependencies": {
|
|
338
338
|
"@types/node": "20.9.0"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { BundleCode, BundleManifestStats, BundleManifestStore, BundleMetadata } from "./bundle-manifest.js";
|
|
2
|
-
interface KVBundleManifestStoreOptions {
|
|
3
|
-
keyPrefix?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class KVBundleManifestStore implements BundleManifestStore {
|
|
6
|
-
constructor(_options: KVBundleManifestStoreOptions);
|
|
7
|
-
isAvailable(): Promise<boolean>;
|
|
8
|
-
getBundleMetadata(_key: string): Promise<BundleMetadata | undefined>;
|
|
9
|
-
setBundleMetadata(_key: string, _metadata: BundleMetadata, _ttlMs?: number): Promise<void>;
|
|
10
|
-
getBundleCode(_hash: string): Promise<BundleCode | undefined>;
|
|
11
|
-
setBundleCode(_hash: string, _code: BundleCode, _ttlMs?: number): Promise<void>;
|
|
12
|
-
deleteBundle(_key: string): Promise<void>;
|
|
13
|
-
invalidateSource(_source: string): Promise<number>;
|
|
14
|
-
clear(): Promise<void>;
|
|
15
|
-
getStats(): Promise<BundleManifestStats>;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=bundle-manifest-kv.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-manifest-kv.d.ts","sourceRoot":"","sources":["../../../src/src/utils/bundle-manifest-kv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,UAAU,4BAA4B;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,qBAAa,qBAAsB,YAAW,mBAAmB;gBACnD,QAAQ,EAAE,4BAA4B;IAElD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAIpE,iBAAiB,CACf,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,cAAc,EACzB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IAIhB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAI7D,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,QAAQ,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAGzC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
function notImplemented() {
|
|
2
|
-
return Promise.reject(new Error("KV bundle manifest store not implemented"));
|
|
3
|
-
}
|
|
4
|
-
export class KVBundleManifestStore {
|
|
5
|
-
constructor(_options) { }
|
|
6
|
-
isAvailable() {
|
|
7
|
-
return Promise.resolve(false);
|
|
8
|
-
}
|
|
9
|
-
getBundleMetadata(_key) {
|
|
10
|
-
return notImplemented();
|
|
11
|
-
}
|
|
12
|
-
setBundleMetadata(_key, _metadata, _ttlMs) {
|
|
13
|
-
return notImplemented();
|
|
14
|
-
}
|
|
15
|
-
getBundleCode(_hash) {
|
|
16
|
-
return notImplemented();
|
|
17
|
-
}
|
|
18
|
-
setBundleCode(_hash, _code, _ttlMs) {
|
|
19
|
-
return notImplemented();
|
|
20
|
-
}
|
|
21
|
-
deleteBundle(_key) {
|
|
22
|
-
return notImplemented();
|
|
23
|
-
}
|
|
24
|
-
invalidateSource(_source) {
|
|
25
|
-
return notImplemented();
|
|
26
|
-
}
|
|
27
|
-
clear() {
|
|
28
|
-
return notImplemented();
|
|
29
|
-
}
|
|
30
|
-
getStats() {
|
|
31
|
-
return notImplemented();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BundleCode, BundleManifestStats, BundleManifestStore, BundleMetadata } from "./bundle-manifest.js";
|
|
2
|
-
interface RedisBundleManifestStoreOptions {
|
|
3
|
-
url?: string;
|
|
4
|
-
keyPrefix?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare class RedisBundleManifestStore implements BundleManifestStore {
|
|
7
|
-
constructor(_options: RedisBundleManifestStoreOptions, _adapter?: unknown);
|
|
8
|
-
isAvailable(): Promise<boolean>;
|
|
9
|
-
getBundleMetadata(_key: string): Promise<BundleMetadata | undefined>;
|
|
10
|
-
setBundleMetadata(_key: string, _metadata: BundleMetadata, _ttlMs?: number): Promise<void>;
|
|
11
|
-
getBundleCode(_hash: string): Promise<BundleCode | undefined>;
|
|
12
|
-
setBundleCode(_hash: string, _code: BundleCode, _ttlMs?: number): Promise<void>;
|
|
13
|
-
deleteBundle(_key: string): Promise<void>;
|
|
14
|
-
invalidateSource(_source: string): Promise<number>;
|
|
15
|
-
clear(): Promise<void>;
|
|
16
|
-
getStats(): Promise<BundleManifestStats>;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=bundle-manifest-redis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-manifest-redis.d.ts","sourceRoot":"","sources":["../../../src/src/utils/bundle-manifest-redis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,UAAU,+BAA+B;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,qBAAa,wBAAyB,YAAW,mBAAmB;gBACtD,QAAQ,EAAE,+BAA+B,EAAE,QAAQ,CAAC,EAAE,OAAO;IAEzE,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAIpE,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAI7D,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,QAAQ,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAGzC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
function notImplemented() {
|
|
2
|
-
return Promise.reject(new Error("Redis bundle manifest store not implemented"));
|
|
3
|
-
}
|
|
4
|
-
export class RedisBundleManifestStore {
|
|
5
|
-
constructor(_options, _adapter) { }
|
|
6
|
-
isAvailable() {
|
|
7
|
-
return Promise.resolve(false);
|
|
8
|
-
}
|
|
9
|
-
getBundleMetadata(_key) {
|
|
10
|
-
return notImplemented();
|
|
11
|
-
}
|
|
12
|
-
setBundleMetadata(_key, _metadata, _ttlMs) {
|
|
13
|
-
return notImplemented();
|
|
14
|
-
}
|
|
15
|
-
getBundleCode(_hash) {
|
|
16
|
-
return notImplemented();
|
|
17
|
-
}
|
|
18
|
-
setBundleCode(_hash, _code, _ttlMs) {
|
|
19
|
-
return notImplemented();
|
|
20
|
-
}
|
|
21
|
-
deleteBundle(_key) {
|
|
22
|
-
return notImplemented();
|
|
23
|
-
}
|
|
24
|
-
invalidateSource(_source) {
|
|
25
|
-
return notImplemented();
|
|
26
|
-
}
|
|
27
|
-
clear() {
|
|
28
|
-
return notImplemented();
|
|
29
|
-
}
|
|
30
|
-
getStats() {
|
|
31
|
-
return notImplemented();
|
|
32
|
-
}
|
|
33
|
-
}
|