MCPcopy
hub / github.com/thedotmack/claude-mem / string

Method string

plugin/scripts/server-service.cjs:228–228  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

226 ORDER BY observation_sources.created_at ASC
227 `,[e.observationId,e.projectId,e.teamId])).rows.map(TD)}}});function AD(t){return{id:t.id,teamId:t.team_id,name:t.name,metadata:mt(t.metadata),createdAtEpoch:Pe(t.created_at),updatedAtEpoch:Pe(t.updated_at)}}var En,_o=R(()=>{"use strict";vn();En=class{constructor(e){this.client=e}client;async create(e){let r=e.id??We(),n=await ne(this.client,`
228 INSERT INTO projects (id, team_id, name, metadata)
229 VALUES ($1, $2, $3, $4::jsonb)
230 RETURNING *
231 `,[r,e.teamId,e.name,JSON.stringify(e.metadata??{})]);return AD(n)}async getByIdForTeam(e,r){let n=await ne(this.client,"SELECT * FROM projects WHERE id = $1 AND team_id = $2",[e,r]);return n?AD(n):null}}});function RD(t){return/^Bearer\s+(.+)$/i.exec(t.trim())?.[1]?.trim()||null}function OD(t){let e=t.ip||t.socket.remoteAddress||"";return e==="127.0.0.1"||e==="::1"||e==="::ffff:127.0.0.1"||e==="localhost"}function jD(t){let e=Cre(t.header("host")??"");return e==="127.0.0.1"||e==="localhost"||e==="::1"}function Cre(t){let e=t.trim().toLowerCase();if(e.startsWith("[")){let n=e.indexOf("]");return n===-1?e:e.slice(1,n)}let r=e.lastIndexOf(":");return r>-1&&/^\d+$/.test(e.slice(r+1))?e.slice(0,r):e}function CD(t){return!!(t.header("forwarded")||t.header("x-forwarded-for")||t.header("x-forwarded-host")||t.header("x-real-ip"))}var KD=R(()=>{"use strict"});function ta(t,e={}){return async(r,n,i)=>{try{let s=e.authMode??process.env.CLAUDE_MEM_AUTH_MODE??"api-key",a=r.header("authorization")??"",o=r.header("x-api-key")?.trim()??"",c=RD(a)||o||null,l=e.allowLocalDevBypass??process.env.CLAUDE_MEM_ALLOW_LOCAL_DEV_BYPASS==="1";if(!c&&s==="local-dev"&&l&&OD(r)&&jD(r)&&!CD(r)){let p={userId:null,organizationId:null,teamId:e.localDevTeamId??null,projectId:null,scopes:["local-dev"],apiKeyId:null,mode:"local-dev"};r.authContext=p,i();return}if(!c){n.status(401).json({error:"Unauthorized",message:"Missing API key (Authorization: Bearer <key> or X-Api-Key: <key>)"});return}let u=await Kre(t,c,e.requiredScopes??[]);if(!u){n.status(403).json({error:"Forbidden",message:"Invalid API key or insufficient scope"});return}let d={userId:null,organizationId:null,teamId:u.teamId,projectId:u.projectId,scopes:u.scopes,apiKeyId:u.apiKeyId,mode:"api-key"};r.authContext=d,i()}catch(s){i(s)}}}async function Kre(t,e,r){let n=(0,PD.createHash)("sha256").update(e).digest("hex"),s=(await t.query(`

Callers 15

server-service.cjsFile · 0.80
KieFunction · 0.80
JieFunction · 0.80
GieFunction · 0.80
JMFunction · 0.80
setupRoutesMethod · 0.80
worker-service.cjsFile · 0.80
setupRoutesMethod · 0.80
YUeFunction · 0.80
A2eFunction · 0.80
HJFunction · 0.80
BJFunction · 0.80

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected