@quell/server
Version:
Quell is an open-source NPM package providing a light-weight caching layer implementation and cache invalidation for GraphQL responses on both the client- and server-side. Use Quell to prevent redundant client-side API requests and to minimize costly serv
20 lines (19 loc) • 679 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createServerError = exports.getCacheID = void 0;
function getCacheID(proto, map) {
var _a;
const base = (_a = map[proto.__type]) !== null && _a !== void 0 ? _a : proto.__type;
return proto.__id ? `${base}--${proto.__id}` : String(base);
}
exports.getCacheID = getCacheID;
function createServerError(log, status = 400, userMessage) {
return {
log,
status,
message: {
err: userMessage !== null && userMessage !== void 0 ? userMessage : "An error occurred. Check server logs.",
},
};
}
exports.createServerError = createServerError;