MCPcopy Create free account
hub / github.com/cloudflare/computer / assertSessionId

Function assertSessionId

packages/computer/src/artifacts/scope.ts:24–35  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

22
23/** Validate a session id and return it, or throw. */
24export function assertSessionId(sessionId: string): string {
25 if (sessionId.length === 0) {
26 throw new InvalidSessionIdError(sessionId, "must not be empty");
27 }
28 if (!VALID_REPO_NAME.test(sessionId)) {
29 throw new InvalidSessionIdError(sessionId, VALID_REPO_NAME_DESCRIPTION);
30 }
31 if (sessionId.includes(SCOPE_SEPARATOR)) {
32 throw new InvalidSessionIdError(sessionId, `must not contain '${SCOPE_SEPARATOR}'`);
33 }
34 return sessionId;
35}
36
37/** Validate a local repo name and return it, or throw. */
38export function assertLocalName(name: string): string {

Callers 3

scope.test.tsFile · 0.85
scopedNameFunction · 0.85
scopePrefixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected