AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { apId, ProjectId, sanitizeObjectForPostgresql } from '@activepieces/core-utils'
import { PutStoreEntryRequest, StoreEntry } from '@activepieces/shared'
import { repoFactory } from '../core/db/repo-factory'
import { StoreEntryEntity } from './store-entry-entity'
const storeEntryRepo = repoFactory<StoreEntry>(StoreEntryEntity)
export const storeEntryService = {
async upsert({ projectId, request }: { projectId: ProjectId, request: PutStoreEntryRequest }): Promise<StoreEntry | null> {
const value = sanitizeObjectForPostgresql(request.value)
const insertResult = await storeEntryRepo().upsert({
id: apId(),
key: request.key,
value,
projectId,
}, ['projectId', 'key'])
return {
projectId,
key: request.key,
value,
id: insertResult.identifiers[0].id,
created: insertResult.generatedMaps[0].created,
updated: insertResult.generatedMaps[0].updated,
}
},
async getOne({
projectId,
key,
}: {
projectId: ProjectId
key: string
}): Promise<StoreEntry | null> {
return storeEntryRepo().findOneBy({
projectId,
key,
})
},
async delete({
projectId,
key,
}: {
projectId: ProjectId
key: string
}): Promise<void> {
await storeEntryRepo().delete({
projectId,
key,
})
},
}