createPromptAccessResolvers (prompts/access.ts)

librechat · packages/api/src/prompts/access.ts · typescript · MIT
auth, database

Creates resolvers to fetch prompt groups and prompts for access checks.

// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { isValidObjectIdString } from '@librechat/data-schemas';
import type { PromptDatabase, PromptGroupRecord, PromptRecord } from './types';
import { toPromptGroupRecord, toPromptRecord } from './records';

export interface PromptViaGroupResource {
  /** The parent group ID, which the access check uses for the ACL lookup. */
  readonly _id: string;
  readonly prompt: PromptRecord;
}

/**
 * Resolvers for the prompt access middleware. A malformed ID or a missing record returns
 * null, so the access check sends its resource 404. A read failure throws, so the access
 * check sends its 500. On success the record becomes `req.resourc

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key