MCPcopy Create free account
hub / github.com/hashintel/hash / isWebScopedKeyForWeb

Function isWebScopedKeyForWeb

apps/hash-api/src/analysis/shared/storage-key.ts:26–36  ·  view source on GitHub ↗
(key: string, webId: WebId)

Source from the content-addressed store, hash-verified

24): string => [ANALYSIS_STORAGE_PREFIX, webId, namespace, ...parts].join("/");
25
26export const isWebScopedKeyForWeb = (key: string, webId: WebId): boolean => {
27 const [prefix, scopedWebId, ...artifactParts] = key.split("/");
28 return (
29 prefix === ANALYSIS_STORAGE_PREFIX &&
30 scopedWebId === webId &&
31 artifactParts.length > 0 &&
32 artifactParts.every(
33 (part) => part.length > 0 && part !== "." && part !== "..",
34 )
35 );
36};
37
38/**
39 * Slugs are the only values interpolated into storage keys from client input.

Callers 2

keyWithinAuthorisedWebFunction · 0.90

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected