repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/posts.js
ghost/core/core/server/api/endpoints/utils/serializers/input/posts.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:posts'); const {ValidationError} = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const url = require('./utils/url'); const slugFilterOrder = require('./utils/slug-filter-order'); const local...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/authors.js
ghost/core/core/server/api/endpoints/utils/serializers/input/authors.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:authors'); const slugFilterOrder = require('./utils/slug-filter-order'); const utils = require('../../index'); function setDefaultOrder(frame) { if (!frame.options.order && frame.options.filter) { frame.options.autoOrder = slug...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/integrations.js
ghost/core/core/server/api/endpoints/utils/serializers/input/integrations.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:integrations'); function setDefaultFilter(frame) { if (frame.options.filter) { frame.options.filter = `(${frame.options.filter})+type:[custom,builtin,core]`; } else { frame.options.filte...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/index.js
ghost/core/core/server/api/endpoints/utils/serializers/input/index.js
module.exports = { get db() { return require('./db'); }, get emails() { return require('./emails'); }, get integrations() { return require('./integrations'); }, get pages() { return require('./pages'); }, get posts() { return require('./pos...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/comments.js
ghost/core/core/server/api/endpoints/utils/serializers/input/comments.js
module.exports = { all(_apiConfig, frame) { if (!frame.options.withRelated || frame.options.withRelated.length === 0) { return; } // Map the 'liked' relation to 'count.liked' frame.options.withRelated = frame.options.withRelated.map((relation) => { if (relati...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/webhooks.js
ghost/core/core/server/api/endpoints/utils/serializers/input/webhooks.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:webhooks'); module.exports = { add(apiConfig, frame) { debug('add'); if (_.get(frame, 'options.context.integration.id')) { frame.data.webhooks[0].integration_id = frame.options....
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/tiers.js
ghost/core/core/server/api/endpoints/utils/serializers/input/tiers.js
const {BadRequestError} = require('@tryghost/errors'); const localUtils = require('../../index'); const nql = require('@tryghost/nql-lang'); const tpl = require('@tryghost/tpl'); const messages = { invalidNQLFilter: 'The NQL filter you passed was invalid.' }; const forceActiveFilter = (frame) => { if (frame.o...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/db.js
ghost/core/core/server/api/endpoints/utils/serializers/input/db.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:db'); const optionsUtil = require('@tryghost/api-framework').utils.options; const INTERNAL_OPTIONS = ['transacting', 'forUpdate']; module.exports = { all(apiConfig, frame) { debug('serialize all');...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/tags.js
ghost/core/core/server/api/endpoints/utils/serializers/input/tags.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:tags'); const url = require('./utils/url'); const slugFilterOrder = require('./utils/slug-filter-order'); const utils = require('../../index'); function setDefaultOrder(frame) { let defaultOrder = 'name asc'; if (!frame.options.or...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/users.js
ghost/core/core/server/api/endpoints/utils/serializers/input/users.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:users'); const url = require('./utils/url'); module.exports = { read(apiConfig, frame) { debug('read'); if (frame.data.id === 'me' && frame.options.context && frame.options.context.user) { frame.data.id = f...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/mentions.js
ghost/core/core/server/api/endpoints/utils/serializers/input/mentions.js
module.exports = { browse(_apiConfig, frame) { // Force source:-~^'https://brid.gy/' to be added to the filter const filterBridgy = `source:-~^'https://brid.gy/'`; if (frame.options.filter) { frame.options.filter = `${frame.options.filter}+${filterBridgy}`; } else { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/members.js
ghost/core/core/server/api/endpoints/utils/serializers/input/members.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:members'); const mapNQLKeyValues = require('@tryghost/nql').utils.mapKeyValues; function defaultRelations(frame) { if (frame.options.withRelated) { return; } if (frame.options.columns && !f...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/settings.js
ghost/core/core/server/api/endpoints/utils/serializers/input/settings.js
const _ = require('lodash'); const url = require('./utils/url'); const localUtils = require('../../index'); const settingsCache = require('../../../../../../shared/settings-cache'); const {WRITABLE_KEYS_ALLOWLIST} = require('../../../../../../shared/labs'); const EDITABLE_SETTINGS = [ 'title', 'description', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/media.js
ghost/core/core/server/api/endpoints/utils/serializers/input/media.js
const path = require('path'); module.exports = { uploadThumbnail(apiConfig, frame) { const parentFileName = path.basename(frame.data.url, path.extname(frame.data.url)); frame.file.name = `${parentFileName}_thumb${frame.file.ext}`; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/emails.js
ghost/core/core/server/api/endpoints/utils/serializers/input/emails.js
module.exports = { browseFailures(apiConfig, frame) { if (!frame.options.withRelated) { return; } // Fix snake case API <-> internal camelCase frame.options.withRelated = frame.options.withRelated.map((r) => { if (r === 'email_recipient') { re...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/utils/settings-key-group-mapper.js
ghost/core/core/server/api/endpoints/utils/serializers/input/utils/settings-key-group-mapper.js
// NOTE: mapping is based on maping present in migration - 3.22/04-populate-settings-groups-and-flags const keyGroupMapping = { members_public_key: 'core', members_private_key: 'core', members_email_auth_secret: 'core', members_otc_secret: 'core', db_hash: 'core', next_update_check: 'core', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/utils/settings-filter-type-group-mapper.js
ghost/core/core/server/api/endpoints/utils/serializers/input/utils/settings-filter-type-group-mapper.js
const typeGroupMapping = { core: [ 'core' ], blog: [ 'site', 'labs', 'slack', 'unsplash', 'views' ], theme: [ 'theme' ], members: [ 'members' ], private: [ 'private' ], portal: [ 'portal' ], ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/utils/settings-key-type-mapper.js
ghost/core/core/server/api/endpoints/utils/serializers/input/utils/settings-key-type-mapper.js
// NOTE: mapping is based on maping present in migration - 3.22/07-update-type-for-settings const keyTypeMapping = { db_hash: 'string', admin_session_secret: 'string', theme_session_secret: 'string', ghost_public_key: 'string', ghost_private_key: 'string', title: 'string', description: 'stri...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/utils/clean.js
ghost/core/core/server/api/endpoints/utils/serializers/input/utils/clean.js
const _ = require('lodash'); const tagRelation = (attrs) => { return _.pick(attrs, [ 'id', 'name', 'slug' ]); }; module.exports.pagesTag = tagRelation; module.exports.postsTag = tagRelation;
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/utils/slug-filter-order.js
ghost/core/core/server/api/endpoints/utils/serializers/input/utils/slug-filter-order.js
const slugFilterOrder = (table, filter) => { let orderMatch = filter.match(/slug:\s?\[(.*)\]/); if (orderMatch) { let orderSlugs = orderMatch[1].split(','); let order = 'CASE '; orderSlugs.forEach((slug, index) => { order += `WHEN \`${table}\`.\`slug\` = '${slug}' THEN ${in...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/input/utils/url.js
ghost/core/core/server/api/endpoints/utils/serializers/input/utils/url.js
const urlUtils = require('../../../../../../../shared/url-utils'); const handleImageUrl = (imageUrl) => { try { const imageURL = new URL(imageUrl, urlUtils.getSiteUrl()); const siteURL = new URL(urlUtils.getSiteUrl()); const subdir = siteURL.pathname.replace(/\/$/, ''); const imageP...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/tinybird.js
ghost/core/core/server/api/endpoints/utils/serializers/output/tinybird.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:tinybird'); module.exports = { all(data, apiConfig, frame) { debug('all'); frame.response = { tinybird: data }; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/themes.js
ghost/core/core/server/api/endpoints/utils/serializers/output/themes.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:themes'); module.exports = { all(data, apiConfig, frame) { debug('all'); frame.response = data; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/pages.js
ghost/core/core/server/api/endpoints/utils/serializers/output/pages.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:pages'); const mappers = require('./mappers'); const tiersService = require('../../../../../services/tiers'); module.exports = { async all(models, apiConfig, frame) { debug('all'); // CASE: e.g. destroy returns null ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/slack.js
ghost/core/core/server/api/endpoints/utils/serializers/output/slack.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:slack'); module.exports = { all(data, apiConfig, frame) { debug('all'); frame.response = data; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/posts.js
ghost/core/core/server/api/endpoints/utils/serializers/output/posts.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:posts'); const mappers = require('./mappers'); const papaparse = require('papaparse'); const tiersService = require('../../../../../services/tiers'); module.exports = { async all(models, apiConfig, frame) { debug('all'); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mail.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mail.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:mail'); module.exports = { all(response, apiConfig, frame) { debug('all'); const toReturn = _.cloneDeep(frame.data); delete toReturn.mail[0].options; // Sendmail returns ex...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/index.js
ghost/core/core/server/api/endpoints/utils/serializers/output/index.js
// ESLint Override Notice // This is a valid index.js file - it just exports a lot of stuff! // Long term we would like to change the API architecture to reduce this file, // but that's not the problem the index.js max - line eslint "proxy" rule is there to solve. /* eslint-disable max-lines */ module.exports = { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/notifications.js
ghost/core/core/server/api/endpoints/utils/serializers/output/notifications.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:notifications'); module.exports = { all(response, apiConfig, frame) { debug('all'); if (!response) { return; } if (!response || !response.length) { frame.response = { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/default.js
ghost/core/core/server/api/endpoints/utils/serializers/output/default.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:default'); const mappers = require('./mappers'); const mapResponse = (docName, mappable, frame) => { if (mappers[docName]) { return mappers[docName](mappable, frame); } else if (mappable.toJSON) { return mappable.t...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/images.js
ghost/core/core/server/api/endpoints/utils/serializers/output/images.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:images'); const mappers = require('./mappers'); module.exports = { upload(path, apiConfig, frame) { debug('upload'); return frame.response = { images: [{ url: mappers.images(path), ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/slugs.js
ghost/core/core/server/api/endpoints/utils/serializers/output/slugs.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:slugs'); module.exports = { all(slug, apiConfig, frame) { debug('all'); frame.response = { slugs: [{slug}] }; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/schedules.js
ghost/core/core/server/api/endpoints/utils/serializers/output/schedules.js
module.exports = { all(data, apiConfig, frame) { frame.response = data; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/site.js
ghost/core/core/server/api/endpoints/utils/serializers/output/site.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:site'); module.exports = { read(data, apiConfig, frame) { debug('read'); frame.response = { site: _.pick(data, [ 'title', 'description', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/comments.js
ghost/core/core/server/api/endpoints/utils/serializers/output/comments.js
module.exports = { counts(response, apiConfig, frame) { frame.response = response; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/custom-theme-settings.js
ghost/core/core/server/api/endpoints/utils/serializers/output/custom-theme-settings.js
module.exports = { browse(models, apiConfig, frame) { frame.response = { custom_theme_settings: models }; }, edit(models, apiConfig, frame) { frame.response = { custom_theme_settings: models }; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/explore.js
ghost/core/core/server/api/endpoints/utils/serializers/output/explore.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:explore'); module.exports = { all(data, apiConfig, frame) { debug('all'); frame.response = { explore: data }; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/config.js
ghost/core/core/server/api/endpoints/utils/serializers/output/config.js
const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:config'); module.exports = { all(data, apiConfig, frame) { debug('all'); const keys = [ 'version', 'environment', 'database', 'mail', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/roles.js
ghost/core/core/server/api/endpoints/utils/serializers/output/roles.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:roles'); const canThis = require('../../../../../services/permissions').canThis; module.exports = { async browse(models, apiConfig, frame) { debug('browse'); const roles = models.toJSON(frame.options); if (fr...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/tiers.js
ghost/core/core/server/api/endpoints/utils/serializers/output/tiers.js
//@ts-check const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:tiers'); module.exports = { browse: createSerializer('browse', paginatedTiers), read: createSerializer('read', singleTier), edit: createSerializer('edit', singleTier), add: createSerializer('add', singleTier) }...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/db.js
ghost/core/core/server/api/endpoints/utils/serializers/output/db.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:db'); module.exports = { backupContent(filename, apiConfig, frame) { debug('backupContent'); frame.response = { db: [{filename: filename}] }; }, exportContent(exportedData, apiConfig, fram...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/users.js
ghost/core/core/server/api/endpoints/utils/serializers/output/users.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:users'); const tpl = require('@tryghost/tpl'); const messages = { pwdChangedSuccessfully: 'Password changed successfully.' }; module.exports = { destroy(filename, apiConfig, frame) { debug('destroy'); frame.respo...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/previews.js
ghost/core/core/server/api/endpoints/utils/serializers/output/previews.js
const mappers = require('./mappers'); const tiersService = require('../../../../../services/tiers'); module.exports = { async all(model, apiConfig, frame) { const tiersPage = await tiersService.api.browse({}); const tiers = tiersPage.data?.map((tierModel) => { const json = tierModel.toJ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/links.js
ghost/core/core/server/api/endpoints/utils/serializers/output/links.js
module.exports = { bulkEdit(data, apiConfig, frame) { frame.response = data; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/oembed.js
ghost/core/core/server/api/endpoints/utils/serializers/output/oembed.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:oembed'); const mappers = require('./mappers'); module.exports = { all(data, apiConfig, frame) { debug('all'); if (data?.metadata?.thumbnail) { data.metadata.thumbnail = mappers.oembed(data.metadata.thumbna...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/all.js
ghost/core/core/server/api/endpoints/utils/serializers/output/all.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:all'); const _ = require('lodash'); const removeXBY = (object) => { for (const [key, value] of Object.entries(object)) { // CASE: go deeper if (_.isObject(value) || _.isArray(value)) { removeXBY(value); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/members.js
ghost/core/core/server/api/endpoints/utils/serializers/output/members.js
//@ts-check const _ = require('lodash'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:members'); const {unparse} = require('@tryghost/members-csv'); const mappers = require('./mappers'); const {Transform} = require('stream'); const papaparse = require('papaparse'); module.exports = ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/redirects.js
ghost/core/core/server/api/endpoints/utils/serializers/output/redirects.js
module.exports = { all(data, apiConfig, frame) { frame.response = data; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/email-posts.js
ghost/core/core/server/api/endpoints/utils/serializers/output/email-posts.js
const mappers = require('./mappers'); const gating = require('./utils/post-gating'); const tiersService = require('../../../../../services/tiers'); module.exports = { async read(model, apiConfig, frame) { const tiersPage = await tiersService.api.browse({}); const tiers = tiersPage.data?.map((tierMo...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/settings.js
ghost/core/core/server/api/endpoints/utils/serializers/output/settings.js
const _ = require('lodash'); const utils = require('../../index'); const mappers = require('./mappers'); /** @typedef {import('@tryghost/api-framework').Frame} Frame */ /** * Filters an object based on a given filter object * @private * @param {Object} settings * @param {String} filter * @returns {*} */ functio...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/search-index.js
ghost/core/core/server/api/endpoints/utils/serializers/output/search-index.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:search-index'); const _ = require('lodash'); const mappers = require('./mappers'); const utils = require('../../index'); module.exports = { async fetchPosts(models, apiConfig, frame) { debug('fetchPosts'); let posts ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/media.js
ghost/core/core/server/api/endpoints/utils/serializers/output/media.js
const config = require('../../../../../../shared/config'); const urlUtils = require('../../../../../../shared/url-utils'); function getURL(urlPath) { const media = new RegExp('^' + config.getSubdir() + '/' + urlUtils.STATIC_MEDIA_URL_PREFIX); const absolute = media.test(urlPath) ? true : false; if (absolu...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/files.js
ghost/core/core/server/api/endpoints/utils/serializers/output/files.js
const config = require('../../../../../../shared/config'); const urlUtils = require('../../../../../../shared/url-utils'); function getURL(urlPath) { const media = new RegExp('^' + config.getSubdir() + '/' + urlUtils.STATIC_FILES_URL_PREFIX); const absolute = media.test(urlPath) ? true : false; if (absolu...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/authentication.js
ghost/core/core/server/api/endpoints/utils/serializers/output/authentication.js
const tpl = require('@tryghost/tpl'); const mappers = require('./mappers'); const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:authentication'); const messages = { checkEmailForInstructions: 'Check your email for further instructions.', passwordChanged: 'Password updated', inv...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/members-stripe-connect.js
ghost/core/core/server/api/endpoints/utils/serializers/output/members-stripe-connect.js
module.exports = { all() { // No response return; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/emails.js
ghost/core/core/server/api/endpoints/utils/serializers/output/emails.js
const batchMapper = require('./mappers/email-batches'); const failureMapper = require('./mappers/email-failures'); module.exports = { browseBatches(response, apiConfig, frame) { frame.response = {}; if (response.data) { frame.response.batches = response.data.map(model => batchMapper(mo...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/session.js
ghost/core/core/server/api/endpoints/utils/serializers/output/session.js
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:session'); module.exports = { all(data, apiConfig, frame) { debug('all'); frame.response = data; } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/pages.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/pages.js
const mapPost = require('./posts'); module.exports = async (model, frame, options) => { const jsonModel = await mapPost(model, frame, options); delete jsonModel.email_subject; delete jsonModel.email_segment; delete jsonModel.email_only; delete jsonModel.newsletter_id; return jsonModel; };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/posts.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/posts.js
const _ = require('lodash'); const mapTag = require('./tags'); const mapUser = require('./users'); const mapEmail = require('./emails'); const clean = require('../utils/clean'); const date = require('../utils/date'); const extraAttrs = require('../utils/extra-attrs'); const gating = require('../utils/post-gating'); c...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/authors.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/authors.js
module.exports = require('./users');
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/integrations.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/integrations.js
module.exports = (model, frame) => { const jsonModel = model.toJSON(frame.options); if (jsonModel.api_keys) { jsonModel.api_keys.forEach((key) => { if (key.type === 'admin') { key.secret = `${key.id}:${key.secret}`; } }); } return jsonModel; };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/index.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/index.js
module.exports = { actions: require('./actions'), activityFeedEvents: require('./activity-feed-events'), authors: require('./authors'), comments: require('./comments'), emails: require('./emails'), emailBatches: require('./email-batches'), emailFailures: require('./email-failures'), imag...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/images.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/images.js
const url = require('../utils/url'); module.exports = (path) => { return url.forImage(path); };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/newsletters.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/newsletters.js
const utils = require('../../../index'); const emailAddressService = require('../../../../../../services/email-address'); module.exports = (model, frame) => { const jsonModel = model.toJSON(frame.options); if (utils.isContentAPI(frame)) { const serialized = { id: jsonModel.id, ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/comments.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/comments.js
const _ = require('lodash'); const utils = require('../../..'); const url = require('../utils/url'); const htmlToPlaintext = require('@tryghost/html-to-plaintext'); const commentFields = [ 'id', 'parent_id', 'in_reply_to_id', 'in_reply_to_snippet', 'status', 'html', 'created_at', 'edite...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/tags.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/tags.js
const clean = require('../utils/clean'); const url = require('../utils/url'); module.exports = (model, frame) => { const jsonModel = model.toJSON ? model.toJSON(frame.options) : model; url.forTag(model.id, jsonModel, frame.options); clean.tag(jsonModel, frame); return jsonModel; };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/users.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/users.js
const clean = require('../utils/clean'); const url = require('../utils/url'); module.exports = (model, frame) => { const jsonModel = model.toJSON ? model.toJSON(frame.options) : model; url.forUser(model.id, jsonModel, frame.options); clean.author(jsonModel, frame); return jsonModel; };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/mentions.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/mentions.js
module.exports = (model) => { const json = model.toJSON(); return { id: json.id, source: json.source, target: json.target, timestamp: json.timestamp, payload: json.payload, resource: json.resource, source_title: json.sourceTitle, source_site_title...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/oembed.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/oembed.js
const url = require('../utils/url'); module.exports = (path) => { return url.forImage(path); };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/email-batches.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/email-batches.js
const _ = require('lodash'); const batchFields = [ 'id', 'provider_id', 'status', 'member_segment', 'created_at', 'updated_at', 'error_status_code', 'error_message', 'error_data' ]; const countFields = [ 'recipients' ]; const batchMapper = (model, frame) => { const jsonMod...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/offers.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/offers.js
const utils = require('../../../index'); module.exports = (model, frame) => { // Offer data is already returned as json via members service const jsonModel = model; if (utils.isContentAPI(frame)) { const serialized = { id: jsonModel.id, name: jsonModel.name, dis...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/settings.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/settings.js
const _ = require('lodash'); module.exports = (attrs) => { if (Array.isArray(attrs)) { return attrs.map((setting) => { return _.pick(setting, ['key', 'value', 'is_read_only']); }); } return attrs; };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/actions.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/actions.js
const clean = require('../utils/clean'); module.exports = (model, frame) => { const attrs = model.toJSON(frame.options); clean.action(attrs); return attrs; };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/email-failures.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/email-failures.js
const _ = require('lodash'); const memberFields = [ 'id', 'uuid', 'name', 'email', 'avatar_image' ]; const failureFields = [ 'id', 'code', 'enhanced_code', 'message', 'severity', 'failed_at', 'event_id' ]; const emailRecipientFields = [ 'id', 'batch_id', 'p...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/snippets.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/snippets.js
/** * @param {import('bookshelf').Model} snippet * @param {Frame} frame * * @returns {SerializedSnippet} */ module.exports = (snippet, frame) => { const json = snippet.toJSON(frame.options); return { id: json.id, name: json.name, // @ts-ignore mobiledoc: json.mobiledoc, ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/activity-feed-events.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/activity-feed-events.js
const mapComment = require('./comments'); const url = require('../utils/url'); const _ = require('lodash'); const memberFields = [ 'id', 'uuid', 'name', 'email', 'avatar_image' ]; const postFields = [ 'id', 'uuid', 'title', 'url' ]; const commentEventMapper = (json, frame) => { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/emails.js
ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/emails.js
const emailService = require('../../../../../../services/email-service'); module.exports = (model, frame) => { const jsonModel = model.toJSON ? model.toJSON(frame.options) : model; // Ensure we're not outputting unwanted replacement strings when viewing email contents // TODO: extract this to a utility, i...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/utils/post-gating.js
ghost/core/core/server/api/endpoints/utils/serializers/output/utils/post-gating.js
const membersService = require('../../../../../../services/members'); const labs = require('../../../../../../../shared/labs'); const htmlToPlaintext = require('@tryghost/html-to-plaintext'); const {PERMIT_ACCESS} = membersService.contentGating; // Match the start of a gated block - fast regex as a pre-check before d...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/utils/extra-attrs.js
ghost/core/core/server/api/endpoints/utils/serializers/output/utils/extra-attrs.js
const readingMinutes = require('@tryghost/helpers').utils.readingMinutes; /** * * @param {Object} options - frame options * @param {import('../../../../../../models/post')} model - Bookshelf model of Post * @param {Object} attrs - JSON object of Post * @returns {void} - modifies attrs */ module.exports.forPost =...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/utils/clean.js
ghost/core/core/server/api/endpoints/utils/serializers/output/utils/clean.js
const _ = require('lodash'); const localUtils = require('../../../index'); const tag = (attrs, frame) => { if (localUtils.isContentAPI(frame)) { delete attrs.created_at; delete attrs.updated_at; // We are standardising on returning null from the Content API for any empty values if ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/utils/date.js
ghost/core/core/server/api/endpoints/utils/serializers/output/utils/date.js
const moment = require('moment-timezone'); const settingsCache = require('../../../../../../../shared/settings-cache'); const format = (date) => { return moment(date) .tz(settingsCache.get('timezone')) .toISOString(true); }; const forPost = (attrs) => { ['created_at', 'updated_at', 'published_...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/serializers/output/utils/url.js
ghost/core/core/server/api/endpoints/utils/serializers/output/utils/url.js
const urlService = require('../../../../../../services/url'); const urlUtils = require('../../../../../../../shared/url-utils'); const localUtils = require('../../../index'); const forPost = (id, attrs, frame) => { attrs.url = urlService.getUrlByResourceId(id, {absolute: true}); /** * CASE: admin api sho...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/index.js
ghost/core/core/server/api/endpoints/utils/validators/index.js
module.exports = { get input() { return require('./input'); }, get output() { return require('./output'); } };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/utils/json-schema.js
ghost/core/core/server/api/endpoints/utils/validators/utils/json-schema.js
const jsonSchema = require('@tryghost/admin-api-schema'); /** * * @param {Object} apiConfig "frame" api configuration object * @param {string} apiConfig.docName the name of the resource * @param {string} apiConfig.method API's method name * @param {import('@tryghost/api-framework').Frame} frame "frame" object wit...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/password_reset.js
ghost/core/core/server/api/endpoints/utils/validators/input/password_reset.js
/* eslint-disable ghost/filenames/match-regex */ const validator = require('@tryghost/validator'); const debug = require('@tryghost/debug')('api:endpoints:utils:validators:input:passwordreset'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { newPasswordsDoNotMa...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/invitations.js
ghost/core/core/server/api/endpoints/utils/validators/input/invitations.js
const validator = require('@tryghost/validator'); const debug = require('@tryghost/debug')('api:endpoints:utils:validators:input:invitation'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { noEmailProvided: 'No email provided.', noNameProvided: 'No name pro...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/setup.js
ghost/core/core/server/api/endpoints/utils/validators/input/setup.js
const debug = require('@tryghost/debug')('api:endpoints:utils:validators:input:updateSetup'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { notTheBlogOwner: 'You are not the site owner.' }; module.exports = { updateSetup(apiConfig, frame) { debug(...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/invites.js
ghost/core/core/server/api/endpoints/utils/validators/input/invites.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../../../../models'); const messages = { userAlreadyRegistered: 'User is already registered.' }; module.exports = { async add(apiConfig, frame) { const user = await models.User.findOne({email: ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/pages.js
ghost/core/core/server/api/endpoints/utils/validators/input/pages.js
const jsonSchema = require('../utils/json-schema'); const models = require('../../../../../models'); const {ValidationError} = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const messages = { invalidVisibilityFilter: 'Invalid filter in visibility_filter property', onlySingleContentSource: ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/posts.js
ghost/core/core/server/api/endpoints/utils/validators/input/posts.js
const jsonSchema = require('../utils/json-schema'); const models = require('../../../../../models'); const {ValidationError} = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const messages = { invalidVisibilityFilter: 'Invalid filter in visibility_filter property', onlySingleContentSource: ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/index.js
ghost/core/core/server/api/endpoints/utils/validators/input/index.js
// ESLint Override Notice // This is a valid index.js file - it just exports a lot of stuff! // Long term we would like to change the API architecture to reduce this file, // but that's not the problem the index.js max - line eslint "proxy" rule is there to solve. /* eslint-disable max-lines */ module.exports = { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/images.js
ghost/core/core/server/api/endpoints/utils/validators/input/images.js
const jsonSchema = require('../utils/json-schema'); const config = require('../../../../../../shared/config'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const {imageSize, blogIcon} = require('../../../../../lib/image'); const messages = { isNotSquare: 'Please select a valid ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/webhooks.js
ghost/core/core/server/api/endpoints/utils/validators/input/webhooks.js
const _ = require('lodash'); const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const jsonSchema = require('../utils/json-schema'); const messages = { schemaValidationFailed: 'Validation failed for \'{key}\'.', noIntegrationIdProvidedContext: 'You may only create webhooks with \'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/tiers.js
ghost/core/core/server/api/endpoints/utils/validators/input/tiers.js
const jsonSchema = require('../utils/json-schema'); module.exports = { add: jsonSchema.validate, edit: jsonSchema.validate };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/tags.js
ghost/core/core/server/api/endpoints/utils/validators/input/tags.js
const jsonSchema = require('../utils/json-schema'); module.exports = { add: jsonSchema.validate, edit: jsonSchema.validate };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/users.js
ghost/core/core/server/api/endpoints/utils/validators/input/users.js
const debug = require('@tryghost/debug')('api:endpoints:utils:validators:input:users'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { newPasswordsDoNotMatch: 'Your new passwords do not match' }; module.exports = { changePassword(apiConfig, frame) { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/oembed.js
ghost/core/core/server/api/endpoints/utils/validators/input/oembed.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { noUrlProvided: 'No url provided.' }; module.exports = { read(apiConfig, frame) { if (!frame.data.url || !frame.data.url.trim()) { return Promise.reject(new errors.BadRequestError({ ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/members.js
ghost/core/core/server/api/endpoints/utils/validators/input/members.js
const jsonSchema = require('../utils/json-schema'); module.exports = { add: jsonSchema.validate, edit: jsonSchema.validate };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/settings.js
ghost/core/core/server/api/endpoints/utils/validators/input/settings.js
const _ = require('lodash'); const {ValidationError} = require('@tryghost/errors'); const validator = require('@tryghost/validator'); const tpl = require('@tryghost/tpl'); const AnnouncementBarSettings = require('../../../../../services/announcement-bar-service/AnnouncementBarSettings'); const messages = { invalid...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/labels.js
ghost/core/core/server/api/endpoints/utils/validators/input/labels.js
const jsonSchema = require('../utils/json-schema'); module.exports = { add: jsonSchema.validate, edit: jsonSchema.validate };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false