@epic-web/workshop-utils 6.45.6 → 6.46.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/README.md +61 -2
- package/dist/esm/apps.server.d.ts +2 -2
- package/dist/esm/apps.server.d.ts.map +1 -1
- package/dist/esm/apps.server.js.map +1 -1
- package/dist/esm/cache.server.d.ts +30 -0
- package/dist/esm/cache.server.d.ts.map +1 -1
- package/dist/esm/cache.server.js +67 -1
- package/dist/esm/cache.server.js.map +1 -1
- package/dist/esm/config.server.d.ts +118 -18
- package/dist/esm/config.server.d.ts.map +1 -1
- package/dist/esm/config.server.js +46 -7
- package/dist/esm/config.server.js.map +1 -1
- package/dist/esm/config.test.d.ts +2 -0
- package/dist/esm/config.test.d.ts.map +1 -0
- package/dist/esm/config.test.js +77 -0
- package/dist/esm/config.test.js.map +1 -0
- package/dist/esm/db.server.d.ts +8 -3
- package/dist/esm/db.server.d.ts.map +1 -1
- package/dist/esm/db.server.js +22 -17
- package/dist/esm/db.server.js.map +1 -1
- package/dist/esm/epic-api.server.d.ts +10 -1
- package/dist/esm/epic-api.server.d.ts.map +1 -1
- package/dist/esm/epic-api.server.js +43 -5
- package/dist/esm/epic-api.server.js.map +1 -1
- package/package.json +1 -1
|
@@ -249,6 +249,8 @@ export declare const directoryEmptyCache: {
|
|
|
249
249
|
};
|
|
250
250
|
export declare const discordCache: C.Cache<unknown>;
|
|
251
251
|
export declare const epicApiCache: C.Cache<unknown>;
|
|
252
|
+
export declare function makeGlobalFsCache<CacheEntryType>(name: string): C.Cache<CacheEntryType>;
|
|
253
|
+
export declare const githubCache: C.Cache<unknown>;
|
|
252
254
|
export declare const WorkshopCacheSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
253
255
|
key: z.ZodString;
|
|
254
256
|
entry: z.ZodObject<{
|
|
@@ -389,6 +391,34 @@ export declare function getAllWorkshopCaches(): Promise<{
|
|
|
389
391
|
}>;
|
|
390
392
|
}>;
|
|
391
393
|
}[]>;
|
|
394
|
+
export declare function globalCacheDirectoryExists(): Promise<boolean>;
|
|
395
|
+
export declare function getGlobalCaches(): Promise<{
|
|
396
|
+
workshopId: string;
|
|
397
|
+
caches: Array<{
|
|
398
|
+
name: string;
|
|
399
|
+
entries: Array<{
|
|
400
|
+
key: string;
|
|
401
|
+
entry: {
|
|
402
|
+
metadata: {
|
|
403
|
+
createdTime: number;
|
|
404
|
+
ttl?: number | null | undefined;
|
|
405
|
+
swr?: number | undefined;
|
|
406
|
+
};
|
|
407
|
+
value?: unknown;
|
|
408
|
+
};
|
|
409
|
+
size?: number | undefined;
|
|
410
|
+
filepath?: string | undefined;
|
|
411
|
+
} & {
|
|
412
|
+
filename: string;
|
|
413
|
+
}>;
|
|
414
|
+
skippedFiles?: Array<{
|
|
415
|
+
filename: string;
|
|
416
|
+
error: string;
|
|
417
|
+
size: number;
|
|
418
|
+
skipped: true;
|
|
419
|
+
}>;
|
|
420
|
+
}>;
|
|
421
|
+
}[]>;
|
|
392
422
|
export declare function getWorkshopFileCaches(): Promise<Record<string, any>>;
|
|
393
423
|
export declare function readEntryByPath(cacheFilePath: string): Promise<any>;
|
|
394
424
|
export declare function deleteCache(): Promise<null | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.server.d.ts","sourceRoot":"","sources":["../../src/cache.server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,qBAAqB,CAAA;AACxC,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAK1E,OAAO,CAAC,MAAM,KAAK,CAAA;AAUnB,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAA;AA+B1E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,EACxC,cAAsC,EACtC,WAA4C,GAC5C,GAAE;IACF,cAAc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GACH,EAAE;IACF,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ,oBAaA"}
|
package/dist/esm/cache.server.js
CHANGED
|
@@ -180,6 +180,50 @@ export const notificationsCache = makeSingletonCache('NotificationsCache');
|
|
|
180
180
|
export const directoryEmptyCache = makeSingletonCache('DirectoryEmptyCache');
|
|
181
181
|
export const discordCache = makeSingletonFsCache('DiscordCache');
|
|
182
182
|
export const epicApiCache = makeSingletonFsCache('EpicApiCache');
|
|
183
|
+
export function makeGlobalFsCache(name) {
|
|
184
|
+
return remember(`global-${name}`, () => {
|
|
185
|
+
const cacheInstanceDir = path.join(cacheDir, 'global', name);
|
|
186
|
+
const fsCache = {
|
|
187
|
+
name: `Filesystem cache (global-${name})`,
|
|
188
|
+
async get(key) {
|
|
189
|
+
const filePath = path.join(cacheInstanceDir, md5(key));
|
|
190
|
+
try {
|
|
191
|
+
const stats = await fsExtra.stat(filePath);
|
|
192
|
+
if (stats.size > MAX_CACHE_FILE_SIZE) {
|
|
193
|
+
const sizeInMB = (stats.size / (1024 * 1024)).toFixed(2);
|
|
194
|
+
log.warn(`Skipping large cache file ${filePath} (${sizeInMB}MB > 3MB limit). ` +
|
|
195
|
+
`Consider clearing "${name}" cache for key: ${key}`);
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
if (error instanceof Error &&
|
|
201
|
+
'code' in error &&
|
|
202
|
+
error.code === 'ENOENT') {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const data = await readJSONWithRetries(filePath);
|
|
207
|
+
if (data?.entry)
|
|
208
|
+
return data.entry;
|
|
209
|
+
return null;
|
|
210
|
+
},
|
|
211
|
+
async set(key, entry) {
|
|
212
|
+
const filePath = path.join(cacheInstanceDir, md5(key));
|
|
213
|
+
const tempPath = `${filePath}.tmp`;
|
|
214
|
+
await fsExtra.ensureDir(path.dirname(filePath));
|
|
215
|
+
await fsExtra.writeJSON(tempPath, { key, entry });
|
|
216
|
+
await fsExtra.move(tempPath, filePath, { overwrite: true });
|
|
217
|
+
},
|
|
218
|
+
async delete(key) {
|
|
219
|
+
const filePath = path.join(cacheInstanceDir, md5(key));
|
|
220
|
+
await fsExtra.remove(filePath);
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
return fsCache;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
export const githubCache = makeGlobalFsCache('GitHubCache');
|
|
183
227
|
async function readJsonFilesInDirectory(dir) {
|
|
184
228
|
const files = await fsExtra.readdir(dir);
|
|
185
229
|
const entries = await Promise.all(files
|
|
@@ -343,13 +387,35 @@ export const WorkshopCacheSchema = z
|
|
|
343
387
|
});
|
|
344
388
|
export async function getAllWorkshopCaches() {
|
|
345
389
|
const files = await readJsonFilesInDirectory(cacheDir);
|
|
346
|
-
|
|
390
|
+
// Exclude the global directory from workshop caches
|
|
391
|
+
const { global, ...workshopCaches } = files;
|
|
392
|
+
const parseResult = WorkshopCacheSchema.safeParse(workshopCaches);
|
|
347
393
|
if (!parseResult.success) {
|
|
348
394
|
log.error('Failed to parse workshop caches:', parseResult.error);
|
|
349
395
|
return [];
|
|
350
396
|
}
|
|
351
397
|
return parseResult.data;
|
|
352
398
|
}
|
|
399
|
+
export async function globalCacheDirectoryExists() {
|
|
400
|
+
const globalCacheDir = path.join(cacheDir, 'global');
|
|
401
|
+
return await fsExtra.exists(globalCacheDir);
|
|
402
|
+
}
|
|
403
|
+
export async function getGlobalCaches() {
|
|
404
|
+
const globalCacheDir = path.join(cacheDir, 'global');
|
|
405
|
+
if (!(await fsExtra.exists(globalCacheDir))) {
|
|
406
|
+
return [];
|
|
407
|
+
}
|
|
408
|
+
const files = await readJsonFilesInDirectory(globalCacheDir);
|
|
409
|
+
const parseResult = WorkshopCacheSchema.safeParse({ global: files });
|
|
410
|
+
if (!parseResult.success) {
|
|
411
|
+
log.error('Failed to parse global caches:', parseResult.error);
|
|
412
|
+
return [];
|
|
413
|
+
}
|
|
414
|
+
return parseResult.data.map((workshopCache) => ({
|
|
415
|
+
...workshopCache,
|
|
416
|
+
workshopId: 'global',
|
|
417
|
+
}));
|
|
418
|
+
}
|
|
353
419
|
export async function getWorkshopFileCaches() {
|
|
354
420
|
const workshopCacheDir = path.join(cacheDir, getEnv().EPICSHOP_WORKSHOP_INSTANCE_ID);
|
|
355
421
|
const caches = readJsonFilesInDirectory(workshopCacheDir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.server.js","sourceRoot":"","sources":["../../src/cache.server.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,CAAC,MAAM,qBAAqB,CAAA;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,GAAG,MAAM,SAAS,CAAA;AACzB,OAAO,CAAC,MAAM,KAAK,CAAA;AAOnB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,uBAAuB,EAAgB,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,eAAe;AAC3D,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAA;AAClC,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AAEhC,6EAA6E;AAC7E,MAAM,uBAAu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AG,GAKH;IACA,IAAI,OAAO,UAAU,KAAK,SAAS;QAAE,OAAO,UAAU,CAAA;IACtD,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,GAAG,EAAE,CAAC;QAC3C,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC3C,CAAC;IAED,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,IAAI,CAAA;IAC7B,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAA;IAEtB,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACtC,CAAC","sourcesContent":["// eslint-disable-next-line import/order -- this must be first\nimport { getEnv } from './init-env.js'\n\nimport path from 'path'\nimport * as C from '@epic-web/cachified'\nimport { type CacheEntry, type CreateReporter } from '@epic-web/cachified'\nimport { remember } from '@epic-web/remember'\nimport fsExtra from 'fs-extra'\nimport { LRUCache } from 'lru-cache'\nimport md5 from 'md5-hex'\nimport z from 'zod'\nimport {\n\ttype ExampleApp,\n\ttype PlaygroundApp,\n\ttype ProblemApp,\n\ttype SolutionApp,\n} from './apps.server.js'\nimport { resolveCacheDir } from './data-storage.server.js'\nimport { logger } from './logger.js'\nimport { type Notification } from './notifications.server.js'\nimport { cachifiedTimingReporter, type Timings } from './timing.server.js'\nimport { checkConnection } from './utils.server.js'\n\nconst MAX_CACHE_FILE_SIZE = 3 * 1024 * 1024 // 3MB in bytes\nconst cacheDir = resolveCacheDir()\nconst log = logger('epic:cache')\n\n// Throttle repeated Sentry reports for corrupted cache files to reduce noise\nconst corruptedReportThrottle = remember(\n\t'epic:cache:corruption-throttle',\n\t() => new LRUCache<string, number>({ max: 2000, ttl: 60_000 }),\n)\n\n// Format cache time helper function (copied from @epic-web/cachified for consistency)\nfunction formatCacheTime(\n\tmetadata: any,\n\tformatDuration: (ms: number) => string,\n): string {\n\tconst ttl = metadata?.ttl\n\tif (ttl === undefined || ttl === Infinity) return 'forever'\n\treturn formatDuration(ttl)\n}\n\n// Default duration formatter (copied from @epic-web/cachified for consistency)\nfunction defaultFormatDuration(ms: number): string {\n\tif (ms < 1000) return `${Math.round(ms)}ms`\n\tif (ms < 60000) return `${Math.round(ms / 1000)}s`\n\tif (ms < 3600000) return `${Math.round(ms / 60000)}m`\n\treturn `${Math.round(ms / 3600000)}h`\n}\n\n/**\n * Creates a cachified reporter that integrates with the Epic Workshop logger system.\n * Uses the pattern `epic:cache:{name-of-cache}` for logger namespaces.\n * Only logs when the specific cache namespace is enabled via NODE_DEBUG.\n */\nexport function epicCacheReporter<Value>({\n\tformatDuration = defaultFormatDuration,\n\tperformance = globalThis.performance || Date,\n}: {\n\tformatDuration?: (ms: number) => string\n\tperformance?: Pick<typeof Date, 'now'>\n} = {}): CreateReporter<Value> {\n\treturn ({ key, fallbackToCache, forceFresh, metadata, cache }) => {\n\t\t// Determine cache name for logger namespace\n\t\tconst cacheName =\n\t\t\tcache.name || cache.toString().replace(/^\\[object (.*?)]$/, '$1')\n\n\t\t// Create logger with epic:cache:{name} pattern\n\t\t// Extract a reasonable cache name from longer descriptions\n\t\tlet loggerSuffix = 'unknown'\n\t\tif (cacheName.includes('(') && cacheName.includes(')')) {\n\t\t\t// Extract name from \"Filesystem cache (CacheName)\" format\n\t\t\tconst match = cacheName.match(/\\(([^)]+)\\)/)\n\t\t\tloggerSuffix = (match?.[1] ?? 'unknown').toLowerCase()\n\t\t} else if (cacheName === 'LRUCache') {\n\t\t\t// For LRU caches, we can't determine the name from the cache object alone\n\t\t\tloggerSuffix = 'lru'\n\t\t} else {\n\t\t\tloggerSuffix = cacheName.toLowerCase()\n\t\t}\n\n\t\tconst cacheLog = log.logger(loggerSuffix)\n\n\t\tlet freshValue: unknown\n\t\tlet getFreshValueStartTs: number\n\t\tlet refreshValueStartTS: number\n\n\t\treturn (event) => {\n\t\t\tswitch (event.name) {\n\t\t\t\tcase 'getCachedValueStart': {\n\t\t\t\t\tcacheLog(`Starting cache lookup for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueEmpty': {\n\t\t\t\t\tcacheLog(`Cache miss for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueSuccess': {\n\t\t\t\t\tcacheLog(`Cache hit for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'done': {\n\t\t\t\t\tcacheLog(`Cache operation done for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueRead': {\n\t\t\t\t\tcacheLog(`Read cached value for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueHookPending': {\n\t\t\t\t\tcacheLog(`Waiting for ongoing fetch for fresh value for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueOutdated': {\n\t\t\t\t\tcacheLog(`Cached value for ${key} is outdated`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkCachedValueErrorObj': {\n\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t`check failed for cached value of ${key}\\nReason: ${event.reason}.\\nDeleting the cache key and trying to get a fresh value.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkFreshValueErrorObj': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`check failed for fresh value of ${key}\\nReason: ${event.reason}.`,\n\t\t\t\t\t\tfreshValue,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueCacheFallback': {\n\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t`Falling back to cached value for ${key} due to error getting fresh value.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkCachedValueError': {\n\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t`check failed for cached value of ${key}\\nReason: ${event.reason}.\\nDeleting the cache key and trying to get a fresh value.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueError': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`error with cache at ${key}. Deleting the cache key and trying to get a fresh value.`,\n\t\t\t\t\t\tevent.error,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueError': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`getting a fresh value for ${key} failed`,\n\t\t\t\t\t\t{ fallbackToCache, forceFresh },\n\t\t\t\t\t\tevent.error,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueStart': {\n\t\t\t\t\tgetFreshValueStartTs = performance.now()\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'writeFreshValueSuccess': {\n\t\t\t\t\tconst totalTime = performance.now() - getFreshValueStartTs\n\t\t\t\t\tif (event.written) {\n\t\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t\t`Updated the cache value for ${key}.`,\n\t\t\t\t\t\t\t`Getting a fresh value for this took ${formatDuration(\n\t\t\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\t\t)}.`,\n\t\t\t\t\t\t\t`Caching for ${formatCacheTime(\n\t\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t\t\tformatDuration,\n\t\t\t\t\t\t\t)} in ${cacheName}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t\t`Not updating the cache value for ${key}.`,\n\t\t\t\t\t\t\t`Getting a fresh value for this took ${formatDuration(\n\t\t\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\t\t)}.`,\n\t\t\t\t\t\t\t`Thereby exceeding caching time of ${formatCacheTime(\n\t\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t\t\tformatDuration,\n\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'writeFreshValueError': {\n\t\t\t\t\tlog.error(`error setting cache: ${key}`, event.error)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueSuccess': {\n\t\t\t\t\tfreshValue = event.value\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkFreshValueError': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`check failed for fresh value of ${key}\\nReason: ${event.reason}.`,\n\t\t\t\t\t\tfreshValue,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'refreshValueStart': {\n\t\t\t\t\trefreshValueStartTS = performance.now()\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'refreshValueSuccess': {\n\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t`Background refresh for ${key} successful.`,\n\t\t\t\t\t\t`Getting a fresh value for this took ${formatDuration(\n\t\t\t\t\t\t\tperformance.now() - refreshValueStartTS,\n\t\t\t\t\t\t)}.`,\n\t\t\t\t\t\t`Caching for ${formatCacheTime(\n\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t\tformatDuration,\n\t\t\t\t\t\t)} in ${cacheName}.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'refreshValueError': {\n\t\t\t\t\tlog.error(`Background refresh for ${key} failed.`, event.error)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\t// @ts-expect-error Defensive programming: log unknown events for debugging\n\t\t\t\t\tcacheLog(`Unknown cache event \"${event.name}\" for key ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport const solutionAppCache =\n\tmakeSingletonFsCache<SolutionApp>('SolutionAppCache')\nexport const problemAppCache =\n\tmakeSingletonFsCache<ProblemApp>('ProblemAppCache')\nexport const exampleAppCache =\n\tmakeSingletonFsCache<ExampleApp>('ExampleAppCache')\nexport const playgroundAppCache =\n\tmakeSingletonFsCache<PlaygroundApp>('PlaygroundAppCache')\nexport const diffCodeCache = makeSingletonFsCache<string>('DiffCodeCache')\nexport const diffFilesCache = makeSingletonFsCache<string>('DiffFilesCache')\nexport const copyUnignoredFilesCache = makeSingletonCache<string>(\n\t'CopyUnignoredFilesCache',\n)\nexport const compiledMarkdownCache = makeSingletonFsCache<string>(\n\t'CompiledMarkdownCache',\n)\nexport const compiledCodeCache = makeSingletonCache<string>('CompiledCodeCache')\nexport const ogCache = makeSingletonCache<string>('OgCache')\nexport const compiledInstructionMarkdownCache = makeSingletonFsCache<{\n\tcode: string\n\ttitle: string | null\n\tepicVideoEmbeds: Array<string>\n}>('CompiledInstructionMarkdownCache')\nexport const dirModifiedTimeCache = makeSingletonCache<number>(\n\t'DirModifiedTimeCache',\n)\nexport const connectionCache = makeSingletonCache<boolean>('ConnectionCache')\nexport const checkForUpdatesCache = makeSingletonCache<{\n\tupdatesAvailable: boolean\n\tlocalCommit: string\n\tremoteCommit: string\n\tdiffLink: string | null\n}>('CheckForUpdatesCache')\nexport const notificationsCache =\n\tmakeSingletonCache<Array<Notification>>('NotificationsCache')\nexport const directoryEmptyCache = makeSingletonCache<boolean>(\n\t'DirectoryEmptyCache',\n)\n\nexport const discordCache = makeSingletonFsCache('DiscordCache')\nexport const epicApiCache = makeSingletonFsCache('EpicApiCache')\n\nasync function readJsonFilesInDirectory(\n\tdir: string,\n): Promise<Record<string, any>> {\n\tconst files = await fsExtra.readdir(dir)\n\tconst entries = await Promise.all(\n\t\tfiles\n\t\t\t.filter((file) => {\n\t\t\t\t// Filter out system files that should not be parsed as JSON\n\t\t\t\tconst lowercaseFile = file.toLowerCase()\n\t\t\t\treturn (\n\t\t\t\t\t!lowercaseFile.startsWith('.ds_store') &&\n\t\t\t\t\t!lowercaseFile.startsWith('.') &&\n\t\t\t\t\t!lowercaseFile.includes('thumbs.db')\n\t\t\t\t)\n\t\t\t})\n\t\t\t.map(async (file) => {\n\t\t\t\tconst filePath = path.join(dir, file)\n\t\t\t\tconst stats = await fsExtra.stat(filePath)\n\t\t\t\tif (stats.isDirectory()) {\n\t\t\t\t\tconst subEntries = await readJsonFilesInDirectory(filePath)\n\t\t\t\t\treturn [file, subEntries]\n\t\t\t\t} else {\n\t\t\t\t\t// Check file size before attempting to read JSON\n\t\t\t\t\tif (stats.size > MAX_CACHE_FILE_SIZE) {\n\t\t\t\t\t\tconst sizeInMB = (stats.size / (1024 * 1024)).toFixed(2)\n\t\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t\t`Skipping large cache file ${filePath} (${sizeInMB}MB > 3MB limit). ` +\n\t\t\t\t\t\t\t\t`Consider clearing cache or excluding this file type from the admin interface.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\terror: `File too large (${sizeInMB}MB > 3MB limit)`,\n\t\t\t\t\t\t\t\tsize: stats.size,\n\t\t\t\t\t\t\t\tskipped: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\n\t\t\t\t\tconst data = await readJSONWithRetries(filePath)\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\treturn [file, { ...data, size: stats.size, filepath: filePath }]\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [file, null]\n\t\t\t\t}\n\t\t\t}),\n\t)\n\treturn Object.fromEntries(entries)\n}\n\n// Helper to read JSON with a couple retries; deletes corrupted files and warns\nasync function readJSONWithRetries(filePath: string): Promise<any | null> {\n\tconst maxRetries = 3\n\tconst baseDelay = 10\n\tfor (let attempt = 0; attempt <= maxRetries; attempt++) {\n\t\ttry {\n\t\t\treturn await fsExtra.readJSON(filePath)\n\t\t} catch (error: unknown) {\n\t\t\tif (\n\t\t\t\terror instanceof Error &&\n\t\t\t\t'code' in error &&\n\t\t\t\t(error as NodeJS.ErrnoException).code === 'ENOENT'\n\t\t\t) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst isJsonParseError =\n\t\t\t\terror instanceof SyntaxError ||\n\t\t\t\t(error instanceof Error && error.message.includes('JSON'))\n\n\t\t\tif (isJsonParseError) {\n\t\t\t\tif (attempt < maxRetries) {\n\t\t\t\t\tconst delay = baseDelay * Math.pow(2, attempt)\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`JSON parsing error on attempt ${attempt + 1}/${maxRetries + 1} for ${filePath}, retrying in ${delay}ms...`,\n\t\t\t\t\t)\n\t\t\t\t\tawait new Promise((r) => setTimeout(r, delay))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Final attempt failed: optionally report and delete file\n\t\t\t\tif (getEnv().SENTRY_DSN && getEnv().EPICSHOP_IS_PUBLISHED) {\n\t\t\t\t\tconst throttleKey = `readJSON:${md5(filePath)}`\n\t\t\t\t\tif (!corruptedReportThrottle.has(throttleKey)) {\n\t\t\t\t\t\tcorruptedReportThrottle.set(throttleKey, Date.now())\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst Sentry = await import('@sentry/react-router')\n\t\t\t\t\t\t\tSentry.withScope((scope) => {\n\t\t\t\t\t\t\t\tscope.setLevel('warning')\n\t\t\t\t\t\t\t\tscope.setTag('error_type', 'corrupted_cache_file')\n\t\t\t\t\t\t\t\tscope.setExtra('filePath', filePath)\n\t\t\t\t\t\t\t\tscope.setExtra('errorMessage', (error as Error).message)\n\t\t\t\t\t\t\t\tscope.setExtra('retryAttempts', attempt)\n\t\t\t\t\t\t\t\tSentry.captureException(error)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} catch (sentryError) {\n\t\t\t\t\t\t\tconsole.error('Failed to log to Sentry:', sentryError)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Always delete corrupted files so subsequent reads can refetch\n\t\t\t\ttry {\n\t\t\t\t\tawait fsExtra.remove(filePath)\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Deleted corrupted cache file after ${attempt + 1} attempts: ${filePath}`,\n\t\t\t\t\t)\n\t\t\t\t} catch (deleteError) {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Failed to delete corrupted cache file ${filePath}:`,\n\t\t\t\t\t\tdeleteError,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\t// Other errors: do not retry\n\t\t\tthrow error\n\t\t}\n\t}\n\n\treturn null\n}\n\nconst CacheEntrySchema = z.object({\n\tkey: z.string(),\n\tentry: z.object({\n\t\tvalue: z.unknown(),\n\t\tmetadata: z.object({\n\t\t\tcreatedTime: z.number(),\n\t\t\t// Stored JSON may serialize Infinity as null; allow number | null | undefined\n\t\t\tttl: z.number().nullable().optional(),\n\t\t\t// Some entries may omit swr; allow optional\n\t\t\tswr: z.number().optional(),\n\t\t}),\n\t}),\n\tsize: z.number().optional(), // File size in bytes\n\tfilepath: z.string().optional(), // Full filesystem path to the cache file\n})\n\n// Schema for files that were skipped due to size limits\nconst SkippedFileSchema = z.object({\n\terror: z.string(),\n\tsize: z.number(),\n\tskipped: z.literal(true),\n})\n\n// Combined schema that can handle both cache entries and skipped files\nconst CacheFileSchema = z.union([CacheEntrySchema, SkippedFileSchema])\n\ntype CacheEntryType = z.infer<typeof CacheEntrySchema>\n\nexport const WorkshopCacheSchema = z\n\t.record(z.record(z.record(CacheFileSchema)))\n\t.transform((workshopCaches) => {\n\t\ttype CacheEntryWithFilename = CacheEntryType & { filename: string }\n\t\ttype SkippedFileWithFilename = {\n\t\t\tfilename: string\n\t\t\terror: string\n\t\t\tsize: number\n\t\t\tskipped: true\n\t\t}\n\t\ttype Cache = {\n\t\t\tname: string\n\t\t\tentries: Array<CacheEntryWithFilename>\n\t\t\tskippedFiles?: Array<SkippedFileWithFilename>\n\t\t}\n\n\t\tconst cachesArray: Array<{\n\t\t\tworkshopId: string\n\t\t\tcaches: Array<Cache>\n\t\t}> = []\n\n\t\tfor (const [workshopId, caches] of Object.entries(workshopCaches)) {\n\t\t\tconst cachesInDir: Array<Cache> = []\n\t\t\tfor (const [cacheName, entriesObj] of Object.entries(caches)) {\n\t\t\t\tconst entries: Array<CacheEntryWithFilename> = []\n\t\t\t\tconst skippedFiles: Array<SkippedFileWithFilename> = []\n\n\t\t\t\tfor (const [key, value] of Object.entries(entriesObj)) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\ttypeof value === 'object' &&\n\t\t\t\t\t\t'skipped' in value &&\n\t\t\t\t\t\tvalue.skipped\n\t\t\t\t\t) {\n\t\t\t\t\t\t// This is a skipped file\n\t\t\t\t\t\tskippedFiles.push({\n\t\t\t\t\t\t\tfilename: key,\n\t\t\t\t\t\t\terror: value.error as string,\n\t\t\t\t\t\t\tsize: value.size as number,\n\t\t\t\t\t\t\tskipped: true,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a regular cache entry\n\t\t\t\t\t\tentries.push({ ...(value as CacheEntryType), filename: key })\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst cache: Cache = { name: cacheName, entries }\n\t\t\t\tif (skippedFiles.length > 0) {\n\t\t\t\t\tcache.skippedFiles = skippedFiles\n\t\t\t\t}\n\t\t\t\tcachesInDir.push(cache)\n\t\t\t}\n\t\t\tcachesArray.push({ workshopId, caches: cachesInDir })\n\t\t}\n\n\t\treturn cachesArray\n\t})\n\nexport async function getAllWorkshopCaches() {\n\tconst files = await readJsonFilesInDirectory(cacheDir)\n\tconst parseResult = WorkshopCacheSchema.safeParse(files)\n\tif (!parseResult.success) {\n\t\tlog.error('Failed to parse workshop caches:', parseResult.error)\n\t\treturn []\n\t}\n\treturn parseResult.data\n}\n\nexport async function getWorkshopFileCaches() {\n\tconst workshopCacheDir = path.join(\n\t\tcacheDir,\n\t\tgetEnv().EPICSHOP_WORKSHOP_INSTANCE_ID,\n\t)\n\tconst caches = readJsonFilesInDirectory(workshopCacheDir)\n\treturn caches\n}\n\nexport async function readEntryByPath(cacheFilePath: string) {\n\tconst filePath = path.join(cacheDir, cacheFilePath)\n\tconst data = await readJSONWithRetries(filePath)\n\treturn data?.entry ?? null\n}\n\nexport async function deleteCache() {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tif (await fsExtra.exists(cacheDir)) {\n\t\t\tawait fsExtra.remove(cacheDir)\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(`Error deleting the cache in ${cacheDir}`, error)\n\t}\n}\n\nexport async function deleteCacheEntry(cacheFilePath: string) {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tconst filePath = path.join(cacheDir, cacheFilePath)\n\t\tawait fsExtra.remove(filePath)\n\t} catch (error) {\n\t\tconsole.error(`Error deleting cache entry ${cacheFilePath}:`, error)\n\t}\n}\n\nexport async function deleteWorkshopCache(\n\tworkshopId: string,\n\tcacheName?: string,\n) {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tif (cacheName) {\n\t\t\t// Delete specific cache within workshop\n\t\t\tconst cachePath = path.join(cacheDir, workshopId, cacheName)\n\t\t\tif (await fsExtra.exists(cachePath)) {\n\t\t\t\tawait fsExtra.remove(cachePath)\n\t\t\t}\n\t\t} else {\n\t\t\t// Delete entire workshop cache directory\n\t\t\tconst workshopCachePath = path.join(cacheDir, workshopId)\n\t\t\tif (await fsExtra.exists(workshopCachePath)) {\n\t\t\t\tawait fsExtra.remove(workshopCachePath)\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t`Error deleting workshop cache ${workshopId}/${cacheName || 'all'}:`,\n\t\t\terror,\n\t\t)\n\t}\n}\n\nexport async function updateCacheEntry(cacheFilePath: string, newEntry: any) {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tconst filePath = path.join(cacheDir, cacheFilePath)\n\t\tconst existingData = await readJSONWithRetries(filePath)\n\t\tif (!existingData) {\n\t\t\tthrow new Error(`Cache file does not exist: ${cacheFilePath}`)\n\t\t}\n\n\t\tconst updatedData = {\n\t\t\t...existingData,\n\t\t\tentry: {\n\t\t\t\t...existingData.entry,\n\t\t\t\tvalue: newEntry,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...existingData.entry.metadata,\n\t\t\t\t\tcreatedTime: Date.now(), // Update timestamp\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tawait fsExtra.writeJSON(filePath, updatedData)\n\t\treturn updatedData.entry\n\t} catch (error) {\n\t\tconsole.error(`Error updating cache entry ${cacheFilePath}:`, error)\n\t\tthrow error\n\t}\n}\n\nexport function makeSingletonCache<CacheEntryType>(name: string) {\n\treturn remember(name, () => {\n\t\tconst lruInstance = new LRUCache<string, CacheEntry<CacheEntryType>>({\n\t\t\tmax: 1000,\n\t\t})\n\n\t\tconst lru = {\n\t\t\tname,\n\t\t\tset: (key, value) => {\n\t\t\t\tconst ttl = C.totalTtl(value.metadata)\n\t\t\t\tlruInstance.set(key, value, {\n\t\t\t\t\tttl: ttl === Infinity ? undefined : ttl,\n\t\t\t\t\tstart: value.metadata.createdTime,\n\t\t\t\t})\n\t\t\t\treturn value\n\t\t\t},\n\t\t\tget: (key) => lruInstance.get(key),\n\t\t\tdelete: (key) => lruInstance.delete(key),\n\t\t} satisfies C.Cache<CacheEntryType>\n\n\t\treturn lru\n\t})\n}\n\nexport function makeSingletonFsCache<CacheEntryType>(name: string) {\n\treturn remember(name, () => {\n\t\tconst cacheInstanceDir = path.join(\n\t\t\tcacheDir,\n\t\t\tgetEnv().EPICSHOP_WORKSHOP_INSTANCE_ID,\n\t\t\tname,\n\t\t)\n\n\t\tconst fsCache: C.Cache<CacheEntryType> = {\n\t\t\tname: `Filesystem cache (${name})`,\n\t\t\tasync get(key) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\n\t\t\t\t// Check file size before attempting to read\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = await fsExtra.stat(filePath)\n\t\t\t\t\tif (stats.size > MAX_CACHE_FILE_SIZE) {\n\t\t\t\t\t\tconst sizeInMB = (stats.size / (1024 * 1024)).toFixed(2)\n\t\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t\t`Skipping large cache file ${filePath} (${sizeInMB}MB > 3MB limit). ` +\n\t\t\t\t\t\t\t\t`Consider clearing \"${name}\" cache for key: ${key}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tif (\n\t\t\t\t\t\terror instanceof Error &&\n\t\t\t\t\t\t'code' in error &&\n\t\t\t\t\t\terror.code === 'ENOENT'\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t\t// For other stat errors, continue with the read attempt\n\t\t\t\t}\n\n\t\t\t\t// Use the shared helper which retries and deletes corrupted files\n\t\t\t\tconst data = await readJSONWithRetries(filePath)\n\t\t\t\tif (data?.entry) return data.entry\n\t\t\t\treturn null\n\n\t\t\t\t// This should never be reached, but just in case\n\t\t\t\treturn null\n\t\t\t},\n\t\t\tasync set(key, entry) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\t\t\t\tconst tempPath = `${filePath}.tmp`\n\t\t\t\tawait fsExtra.ensureDir(path.dirname(filePath))\n\t\t\t\t// Write to temp file first, then atomically move to final location\n\t\t\t\t// This prevents race conditions where readers see partially written JSON files\n\t\t\t\tawait fsExtra.writeJSON(tempPath, { key, entry })\n\t\t\t\tawait fsExtra.move(tempPath, filePath, { overwrite: true })\n\t\t\t},\n\t\t\tasync delete(key) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\t\t\t\tawait fsExtra.remove(filePath)\n\t\t\t},\n\t\t}\n\n\t\treturn fsCache\n\t})\n}\n\n/**\n * This wraps @epic-web/cachified to add a few handy features:\n *\n * 1. Automatic timing for timing headers\n * 2. Automatic force refresh based on the request and enhancement of forceFresh\n * to support comma-separated keys to force\n * 3. Offline fallback support. If a fallback is given and we are detected to be\n * offline, then the cached value is used regardless of whether it's expired and\n * if one is not present then the given fallback will be used.\n */\nexport async function cachified<Value>({\n\trequest,\n\ttimings,\n\tkey,\n\ttimingKey = key.length > 18 ? `${key.slice(0, 7)}...${key.slice(-8)}` : key,\n\tofflineFallbackValue,\n\t...options\n}: Omit<C.CachifiedOptions<Value>, 'forceFresh'> & {\n\trequest?: Request\n\ttimings?: Timings\n\tforceFresh?: boolean | string\n\ttimingKey?: string\n\tofflineFallbackValue?: Value\n}): Promise<Value> {\n\tif (offlineFallbackValue !== undefined) {\n\t\tconst isOnline = await checkConnection({ request, timings })\n\t\tif (!isOnline) {\n\t\t\tlog.warn(\n\t\t\t\t`Offline: using cached value for ${key} or offline fallback if no cache is present`,\n\t\t\t)\n\t\t\tconst cacheEntry = await options.cache.get(key)\n\t\t\treturn cacheEntry?.value ?? offlineFallbackValue\n\t\t}\n\t}\n\tconst forceFresh = await shouldForceFresh({\n\t\tforceFresh: options.forceFresh,\n\t\trequest,\n\t\tkey,\n\t})\n\treturn C.cachified(\n\t\t{\n\t\t\t...options,\n\t\t\tkey,\n\t\t\tforceFresh,\n\t\t},\n\t\tC.mergeReporters(\n\t\t\tcachifiedTimingReporter(timings, timingKey),\n\t\t\tepicCacheReporter(),\n\t\t),\n\t)\n}\n\nexport async function shouldForceFresh({\n\tforceFresh,\n\trequest,\n\tkey,\n}: {\n\tforceFresh?: boolean | string\n\trequest?: Request\n\tkey?: string\n}) {\n\tif (typeof forceFresh === 'boolean') return forceFresh\n\tif (typeof forceFresh === 'string' && key) {\n\t\treturn forceFresh.split(',').includes(key)\n\t}\n\n\tif (!request) return false\n\tconst fresh = new URL(request.url).searchParams.get('fresh')\n\tif (typeof fresh !== 'string') return false\n\tif (fresh === '') return true\n\tif (!key) return false\n\n\treturn fresh.split(',').includes(key)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cache.server.js","sourceRoot":"","sources":["../../src/cache.server.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,CAAC,MAAM,qBAAqB,CAAA;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,GAAG,MAAM,SAAS,CAAA;AACzB,OAAO,CAAC,MAAM,KAAK,CAAA;AAOnB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,uBAAuB,EAAgB,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,eAAe;AAC3D,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAA;AAClC,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AAEhC,6EAA6E;AAC7E,MAAM,uBAAuB,GAAG,QAAQ,CACvC,gCAAgC,E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first\nimport { getEnv } from './init-env.js'\n\nimport path from 'path'\nimport * as C from '@epic-web/cachified'\nimport { type CacheEntry, type CreateReporter } from '@epic-web/cachified'\nimport { remember } from '@epic-web/remember'\nimport fsExtra from 'fs-extra'\nimport { LRUCache } from 'lru-cache'\nimport md5 from 'md5-hex'\nimport z from 'zod'\nimport {\n\ttype ExampleApp,\n\ttype PlaygroundApp,\n\ttype ProblemApp,\n\ttype SolutionApp,\n} from './apps.server.js'\nimport { resolveCacheDir } from './data-storage.server.js'\nimport { logger } from './logger.js'\nimport { type Notification } from './notifications.server.js'\nimport { cachifiedTimingReporter, type Timings } from './timing.server.js'\nimport { checkConnection } from './utils.server.js'\n\nconst MAX_CACHE_FILE_SIZE = 3 * 1024 * 1024 // 3MB in bytes\nconst cacheDir = resolveCacheDir()\nconst log = logger('epic:cache')\n\n// Throttle repeated Sentry reports for corrupted cache files to reduce noise\nconst corruptedReportThrottle = remember(\n\t'epic:cache:corruption-throttle',\n\t() => new LRUCache<string, number>({ max: 2000, ttl: 60_000 }),\n)\n\n// Format cache time helper function (copied from @epic-web/cachified for consistency)\nfunction formatCacheTime(\n\tmetadata: any,\n\tformatDuration: (ms: number) => string,\n): string {\n\tconst ttl = metadata?.ttl\n\tif (ttl === undefined || ttl === Infinity) return 'forever'\n\treturn formatDuration(ttl)\n}\n\n// Default duration formatter (copied from @epic-web/cachified for consistency)\nfunction defaultFormatDuration(ms: number): string {\n\tif (ms < 1000) return `${Math.round(ms)}ms`\n\tif (ms < 60000) return `${Math.round(ms / 1000)}s`\n\tif (ms < 3600000) return `${Math.round(ms / 60000)}m`\n\treturn `${Math.round(ms / 3600000)}h`\n}\n\n/**\n * Creates a cachified reporter that integrates with the Epic Workshop logger system.\n * Uses the pattern `epic:cache:{name-of-cache}` for logger namespaces.\n * Only logs when the specific cache namespace is enabled via NODE_DEBUG.\n */\nexport function epicCacheReporter<Value>({\n\tformatDuration = defaultFormatDuration,\n\tperformance = globalThis.performance || Date,\n}: {\n\tformatDuration?: (ms: number) => string\n\tperformance?: Pick<typeof Date, 'now'>\n} = {}): CreateReporter<Value> {\n\treturn ({ key, fallbackToCache, forceFresh, metadata, cache }) => {\n\t\t// Determine cache name for logger namespace\n\t\tconst cacheName =\n\t\t\tcache.name || cache.toString().replace(/^\\[object (.*?)]$/, '$1')\n\n\t\t// Create logger with epic:cache:{name} pattern\n\t\t// Extract a reasonable cache name from longer descriptions\n\t\tlet loggerSuffix = 'unknown'\n\t\tif (cacheName.includes('(') && cacheName.includes(')')) {\n\t\t\t// Extract name from \"Filesystem cache (CacheName)\" format\n\t\t\tconst match = cacheName.match(/\\(([^)]+)\\)/)\n\t\t\tloggerSuffix = (match?.[1] ?? 'unknown').toLowerCase()\n\t\t} else if (cacheName === 'LRUCache') {\n\t\t\t// For LRU caches, we can't determine the name from the cache object alone\n\t\t\tloggerSuffix = 'lru'\n\t\t} else {\n\t\t\tloggerSuffix = cacheName.toLowerCase()\n\t\t}\n\n\t\tconst cacheLog = log.logger(loggerSuffix)\n\n\t\tlet freshValue: unknown\n\t\tlet getFreshValueStartTs: number\n\t\tlet refreshValueStartTS: number\n\n\t\treturn (event) => {\n\t\t\tswitch (event.name) {\n\t\t\t\tcase 'getCachedValueStart': {\n\t\t\t\t\tcacheLog(`Starting cache lookup for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueEmpty': {\n\t\t\t\t\tcacheLog(`Cache miss for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueSuccess': {\n\t\t\t\t\tcacheLog(`Cache hit for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'done': {\n\t\t\t\t\tcacheLog(`Cache operation done for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueRead': {\n\t\t\t\t\tcacheLog(`Read cached value for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueHookPending': {\n\t\t\t\t\tcacheLog(`Waiting for ongoing fetch for fresh value for ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueOutdated': {\n\t\t\t\t\tcacheLog(`Cached value for ${key} is outdated`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkCachedValueErrorObj': {\n\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t`check failed for cached value of ${key}\\nReason: ${event.reason}.\\nDeleting the cache key and trying to get a fresh value.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkFreshValueErrorObj': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`check failed for fresh value of ${key}\\nReason: ${event.reason}.`,\n\t\t\t\t\t\tfreshValue,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueCacheFallback': {\n\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t`Falling back to cached value for ${key} due to error getting fresh value.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkCachedValueError': {\n\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t`check failed for cached value of ${key}\\nReason: ${event.reason}.\\nDeleting the cache key and trying to get a fresh value.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getCachedValueError': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`error with cache at ${key}. Deleting the cache key and trying to get a fresh value.`,\n\t\t\t\t\t\tevent.error,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueError': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`getting a fresh value for ${key} failed`,\n\t\t\t\t\t\t{ fallbackToCache, forceFresh },\n\t\t\t\t\t\tevent.error,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueStart': {\n\t\t\t\t\tgetFreshValueStartTs = performance.now()\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'writeFreshValueSuccess': {\n\t\t\t\t\tconst totalTime = performance.now() - getFreshValueStartTs\n\t\t\t\t\tif (event.written) {\n\t\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t\t`Updated the cache value for ${key}.`,\n\t\t\t\t\t\t\t`Getting a fresh value for this took ${formatDuration(\n\t\t\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\t\t)}.`,\n\t\t\t\t\t\t\t`Caching for ${formatCacheTime(\n\t\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t\t\tformatDuration,\n\t\t\t\t\t\t\t)} in ${cacheName}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t\t`Not updating the cache value for ${key}.`,\n\t\t\t\t\t\t\t`Getting a fresh value for this took ${formatDuration(\n\t\t\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\t\t)}.`,\n\t\t\t\t\t\t\t`Thereby exceeding caching time of ${formatCacheTime(\n\t\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t\t\tformatDuration,\n\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'writeFreshValueError': {\n\t\t\t\t\tlog.error(`error setting cache: ${key}`, event.error)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'getFreshValueSuccess': {\n\t\t\t\t\tfreshValue = event.value\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'checkFreshValueError': {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`check failed for fresh value of ${key}\\nReason: ${event.reason}.`,\n\t\t\t\t\t\tfreshValue,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'refreshValueStart': {\n\t\t\t\t\trefreshValueStartTS = performance.now()\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'refreshValueSuccess': {\n\t\t\t\t\tcacheLog(\n\t\t\t\t\t\t`Background refresh for ${key} successful.`,\n\t\t\t\t\t\t`Getting a fresh value for this took ${formatDuration(\n\t\t\t\t\t\t\tperformance.now() - refreshValueStartTS,\n\t\t\t\t\t\t)}.`,\n\t\t\t\t\t\t`Caching for ${formatCacheTime(\n\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t\tformatDuration,\n\t\t\t\t\t\t)} in ${cacheName}.`,\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'refreshValueError': {\n\t\t\t\t\tlog.error(`Background refresh for ${key} failed.`, event.error)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\t// @ts-expect-error Defensive programming: log unknown events for debugging\n\t\t\t\t\tcacheLog(`Unknown cache event \"${event.name}\" for key ${key}`)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport const solutionAppCache =\n\tmakeSingletonFsCache<SolutionApp>('SolutionAppCache')\nexport const problemAppCache =\n\tmakeSingletonFsCache<ProblemApp>('ProblemAppCache')\nexport const exampleAppCache =\n\tmakeSingletonFsCache<ExampleApp>('ExampleAppCache')\nexport const playgroundAppCache =\n\tmakeSingletonFsCache<PlaygroundApp>('PlaygroundAppCache')\nexport const diffCodeCache = makeSingletonFsCache<string>('DiffCodeCache')\nexport const diffFilesCache = makeSingletonFsCache<string>('DiffFilesCache')\nexport const copyUnignoredFilesCache = makeSingletonCache<string>(\n\t'CopyUnignoredFilesCache',\n)\nexport const compiledMarkdownCache = makeSingletonFsCache<string>(\n\t'CompiledMarkdownCache',\n)\nexport const compiledCodeCache = makeSingletonCache<string>('CompiledCodeCache')\nexport const ogCache = makeSingletonCache<string>('OgCache')\nexport const compiledInstructionMarkdownCache = makeSingletonFsCache<{\n\tcode: string\n\ttitle: string | null\n\tepicVideoEmbeds: Array<string>\n}>('CompiledInstructionMarkdownCache')\nexport const dirModifiedTimeCache = makeSingletonCache<number>(\n\t'DirModifiedTimeCache',\n)\nexport const connectionCache = makeSingletonCache<boolean>('ConnectionCache')\nexport const checkForUpdatesCache = makeSingletonCache<{\n\tupdatesAvailable: boolean\n\tlocalCommit: string\n\tremoteCommit: string\n\tdiffLink: string | null\n}>('CheckForUpdatesCache')\nexport const notificationsCache =\n\tmakeSingletonCache<Array<Notification>>('NotificationsCache')\nexport const directoryEmptyCache = makeSingletonCache<boolean>(\n\t'DirectoryEmptyCache',\n)\n\nexport const discordCache = makeSingletonFsCache('DiscordCache')\nexport const epicApiCache = makeSingletonFsCache('EpicApiCache')\n\nexport function makeGlobalFsCache<CacheEntryType>(name: string) {\n\treturn remember(`global-${name}`, () => {\n\t\tconst cacheInstanceDir = path.join(cacheDir, 'global', name)\n\n\t\tconst fsCache: C.Cache<CacheEntryType> = {\n\t\t\tname: `Filesystem cache (global-${name})`,\n\t\t\tasync get(key) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = await fsExtra.stat(filePath)\n\t\t\t\t\tif (stats.size > MAX_CACHE_FILE_SIZE) {\n\t\t\t\t\t\tconst sizeInMB = (stats.size / (1024 * 1024)).toFixed(2)\n\t\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t\t`Skipping large cache file ${filePath} (${sizeInMB}MB > 3MB limit). ` +\n\t\t\t\t\t\t\t\t`Consider clearing \"${name}\" cache for key: ${key}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tif (\n\t\t\t\t\t\terror instanceof Error &&\n\t\t\t\t\t\t'code' in error &&\n\t\t\t\t\t\terror.code === 'ENOENT'\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst data = await readJSONWithRetries(filePath)\n\t\t\t\tif (data?.entry) return data.entry\n\t\t\t\treturn null\n\t\t\t},\n\t\t\tasync set(key, entry) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\t\t\t\tconst tempPath = `${filePath}.tmp`\n\t\t\t\tawait fsExtra.ensureDir(path.dirname(filePath))\n\t\t\t\tawait fsExtra.writeJSON(tempPath, { key, entry })\n\t\t\t\tawait fsExtra.move(tempPath, filePath, { overwrite: true })\n\t\t\t},\n\t\t\tasync delete(key) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\t\t\t\tawait fsExtra.remove(filePath)\n\t\t\t},\n\t\t}\n\n\t\treturn fsCache\n\t})\n}\n\nexport const githubCache = makeGlobalFsCache('GitHubCache')\n\nasync function readJsonFilesInDirectory(\n\tdir: string,\n): Promise<Record<string, any>> {\n\tconst files = await fsExtra.readdir(dir)\n\tconst entries = await Promise.all(\n\t\tfiles\n\t\t\t.filter((file) => {\n\t\t\t\t// Filter out system files that should not be parsed as JSON\n\t\t\t\tconst lowercaseFile = file.toLowerCase()\n\t\t\t\treturn (\n\t\t\t\t\t!lowercaseFile.startsWith('.ds_store') &&\n\t\t\t\t\t!lowercaseFile.startsWith('.') &&\n\t\t\t\t\t!lowercaseFile.includes('thumbs.db')\n\t\t\t\t)\n\t\t\t})\n\t\t\t.map(async (file) => {\n\t\t\t\tconst filePath = path.join(dir, file)\n\t\t\t\tconst stats = await fsExtra.stat(filePath)\n\t\t\t\tif (stats.isDirectory()) {\n\t\t\t\t\tconst subEntries = await readJsonFilesInDirectory(filePath)\n\t\t\t\t\treturn [file, subEntries]\n\t\t\t\t} else {\n\t\t\t\t\t// Check file size before attempting to read JSON\n\t\t\t\t\tif (stats.size > MAX_CACHE_FILE_SIZE) {\n\t\t\t\t\t\tconst sizeInMB = (stats.size / (1024 * 1024)).toFixed(2)\n\t\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t\t`Skipping large cache file ${filePath} (${sizeInMB}MB > 3MB limit). ` +\n\t\t\t\t\t\t\t\t`Consider clearing cache or excluding this file type from the admin interface.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\terror: `File too large (${sizeInMB}MB > 3MB limit)`,\n\t\t\t\t\t\t\t\tsize: stats.size,\n\t\t\t\t\t\t\t\tskipped: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\n\t\t\t\t\tconst data = await readJSONWithRetries(filePath)\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\treturn [file, { ...data, size: stats.size, filepath: filePath }]\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [file, null]\n\t\t\t\t}\n\t\t\t}),\n\t)\n\treturn Object.fromEntries(entries)\n}\n\n// Helper to read JSON with a couple retries; deletes corrupted files and warns\nasync function readJSONWithRetries(filePath: string): Promise<any | null> {\n\tconst maxRetries = 3\n\tconst baseDelay = 10\n\tfor (let attempt = 0; attempt <= maxRetries; attempt++) {\n\t\ttry {\n\t\t\treturn await fsExtra.readJSON(filePath)\n\t\t} catch (error: unknown) {\n\t\t\tif (\n\t\t\t\terror instanceof Error &&\n\t\t\t\t'code' in error &&\n\t\t\t\t(error as NodeJS.ErrnoException).code === 'ENOENT'\n\t\t\t) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst isJsonParseError =\n\t\t\t\terror instanceof SyntaxError ||\n\t\t\t\t(error instanceof Error && error.message.includes('JSON'))\n\n\t\t\tif (isJsonParseError) {\n\t\t\t\tif (attempt < maxRetries) {\n\t\t\t\t\tconst delay = baseDelay * Math.pow(2, attempt)\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`JSON parsing error on attempt ${attempt + 1}/${maxRetries + 1} for ${filePath}, retrying in ${delay}ms...`,\n\t\t\t\t\t)\n\t\t\t\t\tawait new Promise((r) => setTimeout(r, delay))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Final attempt failed: optionally report and delete file\n\t\t\t\tif (getEnv().SENTRY_DSN && getEnv().EPICSHOP_IS_PUBLISHED) {\n\t\t\t\t\tconst throttleKey = `readJSON:${md5(filePath)}`\n\t\t\t\t\tif (!corruptedReportThrottle.has(throttleKey)) {\n\t\t\t\t\t\tcorruptedReportThrottle.set(throttleKey, Date.now())\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst Sentry = await import('@sentry/react-router')\n\t\t\t\t\t\t\tSentry.withScope((scope) => {\n\t\t\t\t\t\t\t\tscope.setLevel('warning')\n\t\t\t\t\t\t\t\tscope.setTag('error_type', 'corrupted_cache_file')\n\t\t\t\t\t\t\t\tscope.setExtra('filePath', filePath)\n\t\t\t\t\t\t\t\tscope.setExtra('errorMessage', (error as Error).message)\n\t\t\t\t\t\t\t\tscope.setExtra('retryAttempts', attempt)\n\t\t\t\t\t\t\t\tSentry.captureException(error)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} catch (sentryError) {\n\t\t\t\t\t\t\tconsole.error('Failed to log to Sentry:', sentryError)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Always delete corrupted files so subsequent reads can refetch\n\t\t\t\ttry {\n\t\t\t\t\tawait fsExtra.remove(filePath)\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Deleted corrupted cache file after ${attempt + 1} attempts: ${filePath}`,\n\t\t\t\t\t)\n\t\t\t\t} catch (deleteError) {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Failed to delete corrupted cache file ${filePath}:`,\n\t\t\t\t\t\tdeleteError,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\t// Other errors: do not retry\n\t\t\tthrow error\n\t\t}\n\t}\n\n\treturn null\n}\n\nconst CacheEntrySchema = z.object({\n\tkey: z.string(),\n\tentry: z.object({\n\t\tvalue: z.unknown(),\n\t\tmetadata: z.object({\n\t\t\tcreatedTime: z.number(),\n\t\t\t// Stored JSON may serialize Infinity as null; allow number | null | undefined\n\t\t\tttl: z.number().nullable().optional(),\n\t\t\t// Some entries may omit swr; allow optional\n\t\t\tswr: z.number().optional(),\n\t\t}),\n\t}),\n\tsize: z.number().optional(), // File size in bytes\n\tfilepath: z.string().optional(), // Full filesystem path to the cache file\n})\n\n// Schema for files that were skipped due to size limits\nconst SkippedFileSchema = z.object({\n\terror: z.string(),\n\tsize: z.number(),\n\tskipped: z.literal(true),\n})\n\n// Combined schema that can handle both cache entries and skipped files\nconst CacheFileSchema = z.union([CacheEntrySchema, SkippedFileSchema])\n\ntype CacheEntryType = z.infer<typeof CacheEntrySchema>\n\nexport const WorkshopCacheSchema = z\n\t.record(z.record(z.record(CacheFileSchema)))\n\t.transform((workshopCaches) => {\n\t\ttype CacheEntryWithFilename = CacheEntryType & { filename: string }\n\t\ttype SkippedFileWithFilename = {\n\t\t\tfilename: string\n\t\t\terror: string\n\t\t\tsize: number\n\t\t\tskipped: true\n\t\t}\n\t\ttype Cache = {\n\t\t\tname: string\n\t\t\tentries: Array<CacheEntryWithFilename>\n\t\t\tskippedFiles?: Array<SkippedFileWithFilename>\n\t\t}\n\n\t\tconst cachesArray: Array<{\n\t\t\tworkshopId: string\n\t\t\tcaches: Array<Cache>\n\t\t}> = []\n\n\t\tfor (const [workshopId, caches] of Object.entries(workshopCaches)) {\n\t\t\tconst cachesInDir: Array<Cache> = []\n\t\t\tfor (const [cacheName, entriesObj] of Object.entries(caches)) {\n\t\t\t\tconst entries: Array<CacheEntryWithFilename> = []\n\t\t\t\tconst skippedFiles: Array<SkippedFileWithFilename> = []\n\n\t\t\t\tfor (const [key, value] of Object.entries(entriesObj)) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\ttypeof value === 'object' &&\n\t\t\t\t\t\t'skipped' in value &&\n\t\t\t\t\t\tvalue.skipped\n\t\t\t\t\t) {\n\t\t\t\t\t\t// This is a skipped file\n\t\t\t\t\t\tskippedFiles.push({\n\t\t\t\t\t\t\tfilename: key,\n\t\t\t\t\t\t\terror: value.error as string,\n\t\t\t\t\t\t\tsize: value.size as number,\n\t\t\t\t\t\t\tskipped: true,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a regular cache entry\n\t\t\t\t\t\tentries.push({ ...(value as CacheEntryType), filename: key })\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst cache: Cache = { name: cacheName, entries }\n\t\t\t\tif (skippedFiles.length > 0) {\n\t\t\t\t\tcache.skippedFiles = skippedFiles\n\t\t\t\t}\n\t\t\t\tcachesInDir.push(cache)\n\t\t\t}\n\t\t\tcachesArray.push({ workshopId, caches: cachesInDir })\n\t\t}\n\n\t\treturn cachesArray\n\t})\n\nexport async function getAllWorkshopCaches() {\n\tconst files = await readJsonFilesInDirectory(cacheDir)\n\t// Exclude the global directory from workshop caches\n\tconst { global, ...workshopCaches } = files\n\tconst parseResult = WorkshopCacheSchema.safeParse(workshopCaches)\n\tif (!parseResult.success) {\n\t\tlog.error('Failed to parse workshop caches:', parseResult.error)\n\t\treturn []\n\t}\n\treturn parseResult.data\n}\n\nexport async function globalCacheDirectoryExists(): Promise<boolean> {\n\tconst globalCacheDir = path.join(cacheDir, 'global')\n\treturn await fsExtra.exists(globalCacheDir)\n}\n\nexport async function getGlobalCaches() {\n\tconst globalCacheDir = path.join(cacheDir, 'global')\n\tif (!(await fsExtra.exists(globalCacheDir))) {\n\t\treturn []\n\t}\n\n\tconst files = await readJsonFilesInDirectory(globalCacheDir)\n\tconst parseResult = WorkshopCacheSchema.safeParse({ global: files })\n\tif (!parseResult.success) {\n\t\tlog.error('Failed to parse global caches:', parseResult.error)\n\t\treturn []\n\t}\n\treturn parseResult.data.map((workshopCache) => ({\n\t\t...workshopCache,\n\t\tworkshopId: 'global',\n\t}))\n}\n\nexport async function getWorkshopFileCaches() {\n\tconst workshopCacheDir = path.join(\n\t\tcacheDir,\n\t\tgetEnv().EPICSHOP_WORKSHOP_INSTANCE_ID,\n\t)\n\tconst caches = readJsonFilesInDirectory(workshopCacheDir)\n\treturn caches\n}\n\nexport async function readEntryByPath(cacheFilePath: string) {\n\tconst filePath = path.join(cacheDir, cacheFilePath)\n\tconst data = await readJSONWithRetries(filePath)\n\treturn data?.entry ?? null\n}\n\nexport async function deleteCache() {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tif (await fsExtra.exists(cacheDir)) {\n\t\t\tawait fsExtra.remove(cacheDir)\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(`Error deleting the cache in ${cacheDir}`, error)\n\t}\n}\n\nexport async function deleteCacheEntry(cacheFilePath: string) {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tconst filePath = path.join(cacheDir, cacheFilePath)\n\t\tawait fsExtra.remove(filePath)\n\t} catch (error) {\n\t\tconsole.error(`Error deleting cache entry ${cacheFilePath}:`, error)\n\t}\n}\n\nexport async function deleteWorkshopCache(\n\tworkshopId: string,\n\tcacheName?: string,\n) {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tif (cacheName) {\n\t\t\t// Delete specific cache within workshop\n\t\t\tconst cachePath = path.join(cacheDir, workshopId, cacheName)\n\t\t\tif (await fsExtra.exists(cachePath)) {\n\t\t\t\tawait fsExtra.remove(cachePath)\n\t\t\t}\n\t\t} else {\n\t\t\t// Delete entire workshop cache directory\n\t\t\tconst workshopCachePath = path.join(cacheDir, workshopId)\n\t\t\tif (await fsExtra.exists(workshopCachePath)) {\n\t\t\t\tawait fsExtra.remove(workshopCachePath)\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(\n\t\t\t`Error deleting workshop cache ${workshopId}/${cacheName || 'all'}:`,\n\t\t\terror,\n\t\t)\n\t}\n}\n\nexport async function updateCacheEntry(cacheFilePath: string, newEntry: any) {\n\tif (getEnv().EPICSHOP_DEPLOYED) return null\n\n\ttry {\n\t\tconst filePath = path.join(cacheDir, cacheFilePath)\n\t\tconst existingData = await readJSONWithRetries(filePath)\n\t\tif (!existingData) {\n\t\t\tthrow new Error(`Cache file does not exist: ${cacheFilePath}`)\n\t\t}\n\n\t\tconst updatedData = {\n\t\t\t...existingData,\n\t\t\tentry: {\n\t\t\t\t...existingData.entry,\n\t\t\t\tvalue: newEntry,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...existingData.entry.metadata,\n\t\t\t\t\tcreatedTime: Date.now(), // Update timestamp\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tawait fsExtra.writeJSON(filePath, updatedData)\n\t\treturn updatedData.entry\n\t} catch (error) {\n\t\tconsole.error(`Error updating cache entry ${cacheFilePath}:`, error)\n\t\tthrow error\n\t}\n}\n\nexport function makeSingletonCache<CacheEntryType>(name: string) {\n\treturn remember(name, () => {\n\t\tconst lruInstance = new LRUCache<string, CacheEntry<CacheEntryType>>({\n\t\t\tmax: 1000,\n\t\t})\n\n\t\tconst lru = {\n\t\t\tname,\n\t\t\tset: (key, value) => {\n\t\t\t\tconst ttl = C.totalTtl(value.metadata)\n\t\t\t\tlruInstance.set(key, value, {\n\t\t\t\t\tttl: ttl === Infinity ? undefined : ttl,\n\t\t\t\t\tstart: value.metadata.createdTime,\n\t\t\t\t})\n\t\t\t\treturn value\n\t\t\t},\n\t\t\tget: (key) => lruInstance.get(key),\n\t\t\tdelete: (key) => lruInstance.delete(key),\n\t\t} satisfies C.Cache<CacheEntryType>\n\n\t\treturn lru\n\t})\n}\n\nexport function makeSingletonFsCache<CacheEntryType>(name: string) {\n\treturn remember(name, () => {\n\t\tconst cacheInstanceDir = path.join(\n\t\t\tcacheDir,\n\t\t\tgetEnv().EPICSHOP_WORKSHOP_INSTANCE_ID,\n\t\t\tname,\n\t\t)\n\n\t\tconst fsCache: C.Cache<CacheEntryType> = {\n\t\t\tname: `Filesystem cache (${name})`,\n\t\t\tasync get(key) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\n\t\t\t\t// Check file size before attempting to read\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = await fsExtra.stat(filePath)\n\t\t\t\t\tif (stats.size > MAX_CACHE_FILE_SIZE) {\n\t\t\t\t\t\tconst sizeInMB = (stats.size / (1024 * 1024)).toFixed(2)\n\t\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t\t`Skipping large cache file ${filePath} (${sizeInMB}MB > 3MB limit). ` +\n\t\t\t\t\t\t\t\t`Consider clearing \"${name}\" cache for key: ${key}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tif (\n\t\t\t\t\t\terror instanceof Error &&\n\t\t\t\t\t\t'code' in error &&\n\t\t\t\t\t\terror.code === 'ENOENT'\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t\t// For other stat errors, continue with the read attempt\n\t\t\t\t}\n\n\t\t\t\t// Use the shared helper which retries and deletes corrupted files\n\t\t\t\tconst data = await readJSONWithRetries(filePath)\n\t\t\t\tif (data?.entry) return data.entry\n\t\t\t\treturn null\n\n\t\t\t\t// This should never be reached, but just in case\n\t\t\t\treturn null\n\t\t\t},\n\t\t\tasync set(key, entry) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\t\t\t\tconst tempPath = `${filePath}.tmp`\n\t\t\t\tawait fsExtra.ensureDir(path.dirname(filePath))\n\t\t\t\t// Write to temp file first, then atomically move to final location\n\t\t\t\t// This prevents race conditions where readers see partially written JSON files\n\t\t\t\tawait fsExtra.writeJSON(tempPath, { key, entry })\n\t\t\t\tawait fsExtra.move(tempPath, filePath, { overwrite: true })\n\t\t\t},\n\t\t\tasync delete(key) {\n\t\t\t\tconst filePath = path.join(cacheInstanceDir, md5(key))\n\t\t\t\tawait fsExtra.remove(filePath)\n\t\t\t},\n\t\t}\n\n\t\treturn fsCache\n\t})\n}\n\n/**\n * This wraps @epic-web/cachified to add a few handy features:\n *\n * 1. Automatic timing for timing headers\n * 2. Automatic force refresh based on the request and enhancement of forceFresh\n * to support comma-separated keys to force\n * 3. Offline fallback support. If a fallback is given and we are detected to be\n * offline, then the cached value is used regardless of whether it's expired and\n * if one is not present then the given fallback will be used.\n */\nexport async function cachified<Value>({\n\trequest,\n\ttimings,\n\tkey,\n\ttimingKey = key.length > 18 ? `${key.slice(0, 7)}...${key.slice(-8)}` : key,\n\tofflineFallbackValue,\n\t...options\n}: Omit<C.CachifiedOptions<Value>, 'forceFresh'> & {\n\trequest?: Request\n\ttimings?: Timings\n\tforceFresh?: boolean | string\n\ttimingKey?: string\n\tofflineFallbackValue?: Value\n}): Promise<Value> {\n\tif (offlineFallbackValue !== undefined) {\n\t\tconst isOnline = await checkConnection({ request, timings })\n\t\tif (!isOnline) {\n\t\t\tlog.warn(\n\t\t\t\t`Offline: using cached value for ${key} or offline fallback if no cache is present`,\n\t\t\t)\n\t\t\tconst cacheEntry = await options.cache.get(key)\n\t\t\treturn cacheEntry?.value ?? offlineFallbackValue\n\t\t}\n\t}\n\tconst forceFresh = await shouldForceFresh({\n\t\tforceFresh: options.forceFresh,\n\t\trequest,\n\t\tkey,\n\t})\n\treturn C.cachified(\n\t\t{\n\t\t\t...options,\n\t\t\tkey,\n\t\t\tforceFresh,\n\t\t},\n\t\tC.mergeReporters(\n\t\t\tcachifiedTimingReporter(timings, timingKey),\n\t\t\tepicCacheReporter(),\n\t\t),\n\t)\n}\n\nexport async function shouldForceFresh({\n\tforceFresh,\n\trequest,\n\tkey,\n}: {\n\tforceFresh?: boolean | string\n\trequest?: Request\n\tkey?: string\n}) {\n\tif (typeof forceFresh === 'boolean') return forceFresh\n\tif (typeof forceFresh === 'string' && key) {\n\t\treturn forceFresh.split(',').includes(key)\n\t}\n\n\tif (!request) return false\n\tconst fresh = new URL(request.url).searchParams.get('fresh')\n\tif (typeof fresh !== 'string') return false\n\tif (fresh === '') return true\n\tif (!key) return false\n\n\treturn fresh.split(',').includes(key)\n}\n"]}
|
|
@@ -24,8 +24,8 @@ export declare const StackBlitzConfigSchema: z.ZodObject<{
|
|
|
24
24
|
terminalHeight?: string | undefined;
|
|
25
25
|
hideNavigation?: string | undefined;
|
|
26
26
|
}>;
|
|
27
|
-
declare const
|
|
28
|
-
title: z.ZodString
|
|
27
|
+
declare const PartialWorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
28
|
+
title: z.ZodOptional<z.ZodString>;
|
|
29
29
|
subtitle: z.ZodOptional<z.ZodString>;
|
|
30
30
|
instructor: z.ZodOptional<z.ZodObject<{
|
|
31
31
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -43,8 +43,93 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
43
43
|
𝕏?: string | undefined;
|
|
44
44
|
xHandle?: string | undefined;
|
|
45
45
|
}>>;
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
product: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
host: z.ZodOptional<z.ZodString>;
|
|
48
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
49
|
+
displayNameShort: z.ZodOptional<z.ZodString>;
|
|
50
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
host?: string | undefined;
|
|
53
|
+
displayName?: string | undefined;
|
|
54
|
+
displayNameShort?: string | undefined;
|
|
55
|
+
slug?: string | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
host?: string | undefined;
|
|
58
|
+
displayName?: string | undefined;
|
|
59
|
+
displayNameShort?: string | undefined;
|
|
60
|
+
slug?: string | undefined;
|
|
61
|
+
}>>;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
title?: string | undefined;
|
|
64
|
+
subtitle?: string | undefined;
|
|
65
|
+
instructor?: {
|
|
66
|
+
name?: string | undefined;
|
|
67
|
+
avatar?: string | undefined;
|
|
68
|
+
𝕏?: string | undefined;
|
|
69
|
+
xHandle?: string | undefined;
|
|
70
|
+
} | undefined;
|
|
71
|
+
product?: {
|
|
72
|
+
host?: string | undefined;
|
|
73
|
+
displayName?: string | undefined;
|
|
74
|
+
displayNameShort?: string | undefined;
|
|
75
|
+
slug?: string | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
title?: string | undefined;
|
|
79
|
+
subtitle?: string | undefined;
|
|
80
|
+
instructor?: {
|
|
81
|
+
name?: string | undefined;
|
|
82
|
+
avatar?: string | undefined;
|
|
83
|
+
𝕏?: string | undefined;
|
|
84
|
+
xHandle?: string | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
product?: {
|
|
87
|
+
host?: string | undefined;
|
|
88
|
+
displayName?: string | undefined;
|
|
89
|
+
displayNameShort?: string | undefined;
|
|
90
|
+
slug?: string | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
}>, {
|
|
93
|
+
title?: string | undefined;
|
|
94
|
+
subtitle?: string | undefined;
|
|
95
|
+
instructor?: {
|
|
96
|
+
name?: string | undefined;
|
|
97
|
+
avatar?: string | undefined;
|
|
98
|
+
𝕏?: string | undefined;
|
|
99
|
+
xHandle?: string | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
product?: {
|
|
102
|
+
host?: string | undefined;
|
|
103
|
+
displayName?: string | undefined;
|
|
104
|
+
displayNameShort?: string | undefined;
|
|
105
|
+
slug?: string | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
} & {
|
|
108
|
+
product: {
|
|
109
|
+
host: string | undefined;
|
|
110
|
+
displayName: string | undefined;
|
|
111
|
+
displayNameShort: string | undefined;
|
|
112
|
+
slug: string | undefined;
|
|
113
|
+
};
|
|
114
|
+
}, {
|
|
115
|
+
title?: string | undefined;
|
|
116
|
+
subtitle?: string | undefined;
|
|
117
|
+
instructor?: {
|
|
118
|
+
name?: string | undefined;
|
|
119
|
+
avatar?: string | undefined;
|
|
120
|
+
𝕏?: string | undefined;
|
|
121
|
+
xHandle?: string | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
product?: {
|
|
124
|
+
host?: string | undefined;
|
|
125
|
+
displayName?: string | undefined;
|
|
126
|
+
displayNameShort?: string | undefined;
|
|
127
|
+
slug?: string | undefined;
|
|
128
|
+
} | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
export type PartialWorkshopConfig = z.infer<typeof PartialWorkshopConfigSchema>;
|
|
131
|
+
declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
132
|
+
title: z.ZodString;
|
|
48
133
|
subdomain: z.ZodOptional<z.ZodString>;
|
|
49
134
|
product: z.ZodDefault<z.ZodObject<{
|
|
50
135
|
host: z.ZodDefault<z.ZodString>;
|
|
@@ -66,8 +151,8 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
66
151
|
host?: string | undefined;
|
|
67
152
|
displayName?: string | undefined;
|
|
68
153
|
displayNameShort?: string | undefined;
|
|
69
|
-
logo?: string | undefined;
|
|
70
154
|
slug?: string | undefined;
|
|
155
|
+
logo?: string | undefined;
|
|
71
156
|
discordChannelId?: string | undefined;
|
|
72
157
|
discordTags?: string[] | undefined;
|
|
73
158
|
}>>;
|
|
@@ -147,6 +232,23 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
147
232
|
link?: string | undefined;
|
|
148
233
|
}>, "many">>>;
|
|
149
234
|
sidecarProcesses: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
235
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
236
|
+
instructor: z.ZodOptional<z.ZodObject<{
|
|
237
|
+
name: z.ZodOptional<z.ZodString>;
|
|
238
|
+
avatar: z.ZodOptional<z.ZodString>;
|
|
239
|
+
𝕏: z.ZodOptional<z.ZodString>;
|
|
240
|
+
xHandle: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
name?: string | undefined;
|
|
243
|
+
avatar?: string | undefined;
|
|
244
|
+
𝕏?: string | undefined;
|
|
245
|
+
xHandle?: string | undefined;
|
|
246
|
+
}, {
|
|
247
|
+
name?: string | undefined;
|
|
248
|
+
avatar?: string | undefined;
|
|
249
|
+
𝕏?: string | undefined;
|
|
250
|
+
xHandle?: string | undefined;
|
|
251
|
+
}>>;
|
|
150
252
|
}, "strip", z.ZodTypeAny, {
|
|
151
253
|
githubRepo: string;
|
|
152
254
|
githubRoot: string;
|
|
@@ -185,8 +287,6 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
185
287
|
𝕏?: string | undefined;
|
|
186
288
|
xHandle?: string | undefined;
|
|
187
289
|
} | undefined;
|
|
188
|
-
epicWorkshopHost?: string | undefined;
|
|
189
|
-
epicWorkshopSlug?: string | undefined;
|
|
190
290
|
subdomain?: string | undefined;
|
|
191
291
|
stackBlitzConfig?: {
|
|
192
292
|
title?: string | undefined;
|
|
@@ -211,18 +311,16 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
211
311
|
𝕏?: string | undefined;
|
|
212
312
|
xHandle?: string | undefined;
|
|
213
313
|
} | undefined;
|
|
214
|
-
epicWorkshopHost?: string | undefined;
|
|
215
|
-
epicWorkshopSlug?: string | undefined;
|
|
216
|
-
subdomain?: string | undefined;
|
|
217
314
|
product?: {
|
|
218
315
|
host?: string | undefined;
|
|
219
316
|
displayName?: string | undefined;
|
|
220
317
|
displayNameShort?: string | undefined;
|
|
221
|
-
logo?: string | undefined;
|
|
222
318
|
slug?: string | undefined;
|
|
319
|
+
logo?: string | undefined;
|
|
223
320
|
discordChannelId?: string | undefined;
|
|
224
321
|
discordTags?: string[] | undefined;
|
|
225
322
|
} | undefined;
|
|
323
|
+
subdomain?: string | undefined;
|
|
226
324
|
onboardingVideo?: string | string[] | undefined;
|
|
227
325
|
stackBlitzConfig?: {
|
|
228
326
|
title?: string | undefined;
|
|
@@ -257,9 +355,9 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
257
355
|
product: {
|
|
258
356
|
displayNameShort: string;
|
|
259
357
|
host: string;
|
|
260
|
-
slug: string | undefined;
|
|
261
358
|
displayName: string;
|
|
262
359
|
logo: string;
|
|
360
|
+
slug?: string | undefined;
|
|
263
361
|
discordChannelId?: string | undefined;
|
|
264
362
|
discordTags?: string[] | undefined;
|
|
265
363
|
};
|
|
@@ -291,8 +389,6 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
291
389
|
𝕏?: string | undefined;
|
|
292
390
|
xHandle?: string | undefined;
|
|
293
391
|
} | undefined;
|
|
294
|
-
epicWorkshopHost?: string | undefined;
|
|
295
|
-
epicWorkshopSlug?: string | undefined;
|
|
296
392
|
subdomain?: string | undefined;
|
|
297
393
|
stackBlitzConfig?: {
|
|
298
394
|
title?: string | undefined;
|
|
@@ -317,18 +413,16 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
317
413
|
𝕏?: string | undefined;
|
|
318
414
|
xHandle?: string | undefined;
|
|
319
415
|
} | undefined;
|
|
320
|
-
epicWorkshopHost?: string | undefined;
|
|
321
|
-
epicWorkshopSlug?: string | undefined;
|
|
322
|
-
subdomain?: string | undefined;
|
|
323
416
|
product?: {
|
|
324
417
|
host?: string | undefined;
|
|
325
418
|
displayName?: string | undefined;
|
|
326
419
|
displayNameShort?: string | undefined;
|
|
327
|
-
logo?: string | undefined;
|
|
328
420
|
slug?: string | undefined;
|
|
421
|
+
logo?: string | undefined;
|
|
329
422
|
discordChannelId?: string | undefined;
|
|
330
423
|
discordTags?: string[] | undefined;
|
|
331
424
|
} | undefined;
|
|
425
|
+
subdomain?: string | undefined;
|
|
332
426
|
onboardingVideo?: string | string[] | undefined;
|
|
333
427
|
stackBlitzConfig?: {
|
|
334
428
|
title?: string | undefined;
|
|
@@ -361,6 +455,12 @@ declare const WorkshopConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
361
455
|
sidecarProcesses?: Record<string, string> | undefined;
|
|
362
456
|
}>;
|
|
363
457
|
export type WorkshopConfig = z.infer<typeof WorkshopConfigSchema>;
|
|
458
|
+
/**
|
|
459
|
+
* Parse epicshop config from an arbitrary package.json object.
|
|
460
|
+
* Unlike getWorkshopConfig(), this doesn't require EPICSHOP_CONTEXT_CWD
|
|
461
|
+
* and returns partial/optional config suitable for external repos.
|
|
462
|
+
*/
|
|
463
|
+
export declare function parseEpicshopConfig(packageJson: unknown): PartialWorkshopConfig | null;
|
|
364
464
|
/**
|
|
365
465
|
* This used to support subdomains on localhost, but that caused too many issues.
|
|
366
466
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.server.d.ts","sourceRoot":"","sources":["../../src/config.server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;EAcjC,CAAA;
|
|
1
|
+
{"version":3,"file":"config.server.d.ts","sourceRoot":"","sources":["../../src/config.server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;EAcjC,CAAA;AAsDF,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAnBvB;QACR,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;QACxB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;QAC/B,gBAAgB,EAAE,MAAM,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