MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / getLocalDraftParts

Function getLocalDraftParts

shared/session-paths.ts:20–39  ·  view source on GitHub ↗
(sessionPath: string | null | undefined)

Source from the content-addressed store, hash-verified

18}
19
20function getLocalDraftParts(sessionPath: string | null | undefined) {
21 if (typeof sessionPath !== 'string' || !isLocalSessionPath(sessionPath)) {
22 return null
23 }
24
25 const [, encodedProjectId = '', encodedChatGroupId = ''] =
26 sessionPath.match(localSessionPathPattern) ?? []
27 if (encodedProjectId.length === 0) {
28 return null
29 }
30
31 try {
32 return {
33 projectId: decodeURIComponent(encodedProjectId),
34 chatGroupId: encodedChatGroupId ? decodeURIComponent(encodedChatGroupId) : null,
35 }
36 } catch {
37 return null
38 }
39}
40
41export function getLocalDraftProjectId(sessionPath: string | null | undefined) {
42 return getLocalDraftParts(sessionPath)?.projectId ?? null

Callers 2

getLocalDraftProjectIdFunction · 0.85
getLocalDraftChatGroupIdFunction · 0.85

Calls 1

isLocalSessionPathFunction · 0.85

Tested by

no test coverage detected