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/services/members/middleware.js
ghost/core/core/server/services/members/middleware.js
const crypto = require('crypto'); const _ = require('lodash'); const logging = require('@tryghost/logging'); const membersService = require('./service'); const emailSuppressionList = require('../email-suppression-list'); const models = require('../../models'); const urlUtils = require('../../../shared/url-utils'); cons...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/service.js
ghost/core/core/server/services/members/service.js
const _ = require('lodash'); const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const MembersSSR = require('./members-ssr'); const db = require('../../data/db'); const MembersConfigProvider = require('./MembersConfigProvider'); const makeMembersCSVImporter = require('./importer'); const M...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-ssr.js
ghost/core/core/server/services/members/members-ssr.js
const {parse: parseUrl} = require('url'); const createCookies = require('cookies'); const debug = require('@tryghost/debug')('members-ssr'); const { BadRequestError, IncorrectUsageError } = require('@tryghost/errors'); /** * @typedef {import('http').IncomingMessage} Request * @typedef {import('http').Server...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/api.js
ghost/core/core/server/services/members/api.js
const stripeService = require('../stripe'); const settingsCache = require('../../../shared/settings-cache'); const settingsHelpers = require('../../services/settings-helpers'); const MembersApi = require('./members-api/members-api'); const logging = require('@tryghost/logging'); const mail = require('../mail'); const m...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/SingleUseTokenProvider.js
ghost/core/core/server/services/members/SingleUseTokenProvider.js
// @ts-check const {ValidationError} = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const crypto = require('node:crypto'); const {hotp} = require('otplib'); const messages = { OTC_SECRET_NOT_CONFIGURED: 'OTC secret not configured', INVALID_OTC_VERIFICATION_HASH: 'Invalid OTC verification ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/content-gating.js
ghost/core/core/server/services/members/content-gating.js
const nql = require('@tryghost/nql'); // @ts-check /** @typedef { boolean } AccessFlag */ const PERMIT_ACCESS = true; const BLOCK_ACCESS = false; // TODO: better place to store this? const MEMBER_NQL_EXPANSIONS = [{ key: 'products', replacement: 'products.slug' }, { key: 'product', replacement: 'prod...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/stripe-connect.js
ghost/core/core/server/services/members/stripe-connect.js
const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const {Buffer} = require('buffer'); const {randomBytes} = require('crypto'); const {URL} = require('url'); const config = require('../../../shared/config'); const urlUtils = require('../../../shared/url-utils'); const messages = { i...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/utils.js
ghost/core/core/server/services/members/utils.js
function formatNewsletterResponse(newsletters) { return newsletters.map(({id, uuid, name, description, sort_order: sortOrder}) => { return { id, uuid, name, description, sort_order: sortOrder }; }); } module.exports.formatNewsletterRes...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/jobs/clean-tokens.js
ghost/core/core/server/services/members/jobs/clean-tokens.js
const {parentPort} = require('worker_threads'); const debug = require('@tryghost/debug')('jobs:clean-tokens'); const moment = require('moment'); // Exit early when cancelled to prevent stalling shutdown. No cleanup needed when cancelling as everything is idempotent and will pick up // where it left off on next run fun...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/jobs/index.js
ghost/core/core/server/services/members/jobs/index.js
const path = require('path'); const jobsService = require('../../jobs'); let hasScheduled = { expiredComped: false, tokens: false }; module.exports = { async scheduleExpiredCompCleanupJob() { if ( !hasScheduled.expiredComped && !process.env.NODE_ENV.startsWith('test') ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/jobs/clean-expired-comped.js
ghost/core/core/server/services/members/jobs/clean-expired-comped.js
const {parentPort} = require('worker_threads'); const ObjectId = require('bson-objectid').default; const {chunk: chunkArray} = require('lodash'); const debug = require('@tryghost/debug')('jobs:clean-expired-comped'); const moment = require('moment'); // recurring job to clean expired complimentary subscriptions // Ex...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/members-api.js
ghost/core/core/server/services/members/members-api/members-api.js
const {Router} = require('express'); const body = require('body-parser'); const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); const PaymentsService = require('./services/PaymentsService'); const TokenService = require('./services/TokenService'); const GeolocationService = require(...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/services/PaymentsService.js
ghost/core/core/server/services/members/members-api/services/PaymentsService.js
const logging = require('@tryghost/logging'); const DomainEvents = require('@tryghost/domain-events'); const TierCreatedEvent = require('../../../../../../core/server/services/tiers/TierCreatedEvent'); const TierPriceChangeEvent = require('../../../../../../core/server/services/tiers/TierPriceChangeEvent'); const TierN...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/services/GeolocationService.js
ghost/core/core/server/services/members/members-api/services/GeolocationService.js
const got = require('got'); const IPV4_REGEX = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; const IPV6_REGEX = /^(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}$/i; module.exports = class GeolocationService { async getGeolocationFromIP(ipAddress) { if (!ipAddress || (!I...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/services/MemberBREADService.js
ghost/core/core/server/services/members/members-api/services/MemberBREADService.js
const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); const tpl = require('@tryghost/tpl'); const moment = require('moment'); const messages = { stripeNotConnected: 'Missing Stripe connection.', memberAlreadyExists: 'Member already exists.' }; /** * @typedef {object} ILabs...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/services/TokenService.js
ghost/core/core/server/services/members/members-api/services/TokenService.js
const jose = require('node-jose'); const jwt = require('jsonwebtoken'); module.exports = class TokenService { constructor({ privateKey, publicKey, issuer }) { this._keyStore = jose.JWK.createKeyStore(); this._keyStoreReady = this._keyStore.add(privateKey, 'pem'); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/controllers/MemberController.js
ghost/core/core/server/services/members/members-api/controllers/MemberController.js
const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const messages = { blockedEmailDomain: 'Memberships from this email domain are currently restricted.' }; module.exports = class MemberController { /** * @param {object} deps * @param {any} deps.memberRepository * ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/controllers/RouterController.js
ghost/core/core/server/services/members/members-api/controllers/RouterController.js
const tpl = require('@tryghost/tpl'); const logging = require('@tryghost/logging'); const sanitizeHtml = require('sanitize-html'); const {BadRequestError, NoPermissionError, UnauthorizedError, DisabledFeatureError, NotFoundError} = require('@tryghost/errors'); const errors = require('@tryghost/errors'); const {isEmail}...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/controllers/WellKnownController.js
ghost/core/core/server/services/members/members-api/controllers/WellKnownController.js
const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); const tpl = require('@tryghost/tpl'); const messages = { keyStoreError: 'There was an error with the keystore. Please check the settings.' }; /** * @typedef {import('node-jose').JWK[]} JWKS */ /** * @typedef {object} ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/utils/normalize-email.js
ghost/core/core/server/services/members/members-api/utils/normalize-email.js
const punycode = require('punycode/'); /** * Normalizes email addresses by converting Unicode domains to ASCII (punycode) * This prevents homograph attacks where Unicode characters are used to spoof * domains * * @param {string} email The email address to normalize * @returns {string} The normalized email addres...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/repositories/ProductRepository.js
ghost/core/core/server/services/members/members-api/repositories/ProductRepository.js
const {UpdateCollisionError, NotFoundError, MethodNotAllowedError, ValidationError, BadRequestError} = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const messages = { priceMustBeInteger: 'Tier prices must be an integer.', priceIsNegative: 'Tier prices must not be negative', maxPriceEx...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/repositories/EventRepository.js
ghost/core/core/server/services/members/members-api/repositories/EventRepository.js
const errors = require('@tryghost/errors'); const nql = require('@tryghost/nql'); const mingo = require('mingo'); const {replaceFilters, expandFilters, splitFilter, getUsedKeys, chainTransformers, mapKeys, rejectStatements} = require('@tryghost/mongo-utils'); /** * This mongo transformer ignores the provided filter o...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
true
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/members-api/repositories/MemberRepository.js
ghost/core/core/server/services/members/members-api/repositories/MemberRepository.js
const _ = require('lodash'); const errors = require('@tryghost/errors'); const logging = require('@tryghost/logging'); const tpl = require('@tryghost/tpl'); const DomainEvents = require('@tryghost/domain-events'); const {SubscriptionActivatedEvent, MemberCreatedEvent, SubscriptionCreatedEvent, MemberSubscribeEvent, Sub...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
true
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/emails/signup.js
ghost/core/core/server/services/members/emails/signup.js
module.exports = ({t, siteTitle, email, url, accentColor = '#15212A', siteDomain, siteUrl}) => ` <!doctype html> <html> <head> <meta name="viewport" content="width=device-width"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>πŸ™Œ ${t('Complete your sign up to {siteTitle}!', {sit...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/emails/update-email.js
ghost/core/core/server/services/members/emails/update-email.js
module.exports = ({t, email, url, accentColor = '#15212A', siteDomain, siteUrl}) => ` <!doctype html> <html> <head> <meta name="viewport" content="width=device-width"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>${t('Confirm your email address')}</title> <style> /* -...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/emails/signin.js
ghost/core/core/server/services/members/emails/signin.js
/* eslint-disable indent */ module.exports = ({t, siteTitle, email, url, otc, accentColor = '#15212A', siteDomain, siteUrl}) => ` <!doctype html> <html> <head> <meta name="viewport" content="width=device-width"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> ${otc ? `<title>πŸ”‘...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/emails/subscribe.js
ghost/core/core/server/services/members/emails/subscribe.js
module.exports = ({t, siteTitle, email, url, accentColor = '#15212A', siteDomain, siteUrl}) => ` <!doctype html> <html> <head> <meta name="viewport" content="width=device-width"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>πŸ“« ${t('Confirm your subscription to {siteTitle}', {...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/emails/signup-paid.js
ghost/core/core/server/services/members/emails/signup-paid.js
module.exports = ({t, siteTitle, email, url, accentColor = '#15212A', siteDomain, siteUrl}) => ` <!doctype html> <html> <head> <meta name="viewport" content="width=device-width"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>πŸ™Œ ${t('Thank you for signing up to {siteTitle}!'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/stats/MembersStats.js
ghost/core/core/server/services/members/stats/MembersStats.js
const moment = require('moment-timezone'); const dateFormat = 'YYYY-MM-DD HH:mm:ss'; class MembersStats { /** * @param {Object} config * @param {Object} config.db - an instance holding knex connection to the database * @param {Object} config.settingsCache - an instance of the Ghost Settings Cache ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/exporter/query.js
ghost/core/core/server/services/members/exporter/query.js
const models = require('../../../models'); const {knex} = require('../../../data/db'); const moment = require('moment'); const logging = require('@tryghost/logging'); const {Transform} = require('stream'); /** * Process a batch of members with all their related data * @param {Array} members - Array of member records...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/importer/MembersCSVImporter.js
ghost/core/core/server/services/members/importer/MembersCSVImporter.js
const moment = require('moment-timezone'); const path = require('path'); const fs = require('fs-extra'); const metrics = require('@tryghost/metrics'); const membersCSV = require('@tryghost/members-csv'); const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const emailTemplate = require('./e...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/importer/email-template.js
ghost/core/core/server/services/members/importer/email-template.js
function formatNumber(number) { return number.toLocaleString(); } const iff = (cond, yes, no) => (cond ? yes : no); module.exports = ({result, siteUrl, membersUrl, emailRecipient}) => ` <!doctype html> <html> <head> <meta name="viewport" content="width=device-width"> <meta http-equiv="Content-Type" conte...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/importer/index.js
ghost/core/core/server/services/members/importer/index.js
const MembersCSVImporter = require('./MembersCSVImporter'); const MembersCSVImporterStripeUtils = require('./MembersCSVImporterStripeUtils'); /** * @typedef {import('./MembersCSVImporter').MembersCSVImporterOptions} MembersCSVImporterOptions */ /** * @typedef {Object} MakeImporterDeps * @property {Object} stripeA...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/importer/labels.js
ghost/core/core/server/services/members/importer/labels.js
const _ = require('lodash'); const moment = require('moment-timezone'); const models = require('../../../models'); const findOrCreateLabels = async (labels, options) => { const existingLabels = []; const createdLabels = []; for (const label of labels) { const existingLabel = await models.Label.fin...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/members/importer/MembersCSVImporterStripeUtils.js
ghost/core/core/server/services/members/importer/MembersCSVImporterStripeUtils.js
const {DataImportError} = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const messages = { productNotFound: 'Cannot find Product {id}', noStripeConnection: 'Cannot {action} without a Stripe Connection', forceNoCustomer: 'Cannot find Stripe customer to update subscription', forceNoE...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-address/index.js
ghost/core/core/server/services/email-address/index.js
const EmailAddressServiceWrapper = require('./EmailAddressServiceWrapper'); module.exports = new EmailAddressServiceWrapper();
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-address/EmailAddressServiceWrapper.js
ghost/core/core/server/services/email-address/EmailAddressServiceWrapper.js
class EmailAddressServiceWrapper { /** * @type {import('./EmailAddressService').EmailAddressService} */ service; init() { if (this.service) { return; } const labs = require('../../../shared/labs'); const config = require('../../../shared/config'); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/email-address/EmailAddressParser.js
ghost/core/core/server/services/email-address/EmailAddressParser.js
const addressparser = require('nodemailer/lib/addressparser'); /** * @typedef {Object} EmailAddress * @property {string} address - The email address * @property {string} [name] - Optional name associated with the email */ module.exports = class EmailAddressParser { /** * Parse an email string into an Ema...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/route-settings/yaml-parser.js
ghost/core/core/server/services/route-settings/yaml-parser.js
const yaml = require('js-yaml'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { parsingError: { message: 'Could not parse provided YAML file: {context}.', help: 'Check provided file for typos and fix the named issues.' }, invalidYamlForm...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/route-settings/RouteSettings.js
ghost/core/core/server/services/route-settings/RouteSettings.js
const fs = require('fs-extra'); const crypto = require('crypto'); const urlService = require('../url'); const debug = require('@tryghost/debug')('services:route-settings'); const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const bridge = require('../../../bridge'); const messages = { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/route-settings/index.js
ghost/core/core/server/services/route-settings/index.js
const config = require('../../../shared/config'); const parseYaml = require('./yaml-parser'); let settingsLoader; let routeSettings; module.exports = { init: async () => { const RouteSettings = require('./RouteSettings'); const SettingsLoader = require('./SettingsLoader'); const DefaultSet...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/route-settings/SettingsLoader.js
ghost/core/core/server/services/route-settings/SettingsLoader.js
const fs = require('fs-extra'); const debug = require('@tryghost/debug')('frontend:services:settings:settings-loader'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const validate = require('./validate'); const messages = { settingsLoaderError: `Error trying to load YAML settin...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/route-settings/SettingsPathManager.js
ghost/core/core/server/services/route-settings/SettingsPathManager.js
const path = require('path'); const tpl = require('@tryghost/tpl'); const format = require('date-fns/format'); const {IncorrectUsageError} = require('@tryghost/errors'); const messages = { incorrectPathsParameter: 'Attempted to setup settings path manager without paths values.' }; class SettingsPathManager { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/route-settings/validate.js
ghost/core/core/server/services/route-settings/validate.js
const _ = require('lodash'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const _private = {}; let RESOURCE_CONFIG; const messages = { validationError: 'The following definition "{at}" is invalid: {reason}', invalidResourceError: 'Resource key not supported. {resourceKey}',...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/services/route-settings/DefaultSettingsManager.js
ghost/core/core/server/services/route-settings/DefaultSettingsManager.js
const fs = require('fs-extra'); const path = require('path'); const debug = require('@tryghost/debug')('frontend:services:settings:ensure-settings'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { ensureSettings: 'Error trying to access settings files in {path}...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/email-recipient-failure.js
ghost/core/core/server/models/email-recipient-failure.js
const ghostBookshelf = require('./base'); const EmailRecipientFailure = ghostBookshelf.Model.extend({ tableName: 'email_recipient_failures', hasTimestamps: false, defaults() { return { }; }, email() { return this.belongsTo('Email', 'email_id'); }, member() { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-product-event.js
ghost/core/core/server/models/member-product-event.js
const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const ghostBookshelf = require('./base'); const messages = { cannotPerformAction: 'Cannot {action} MemberProductEvent' }; const MemberProductEvent = ghostBookshelf.Model.extend({ tableName: 'members_product_events', member(...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-paid-subscription-event.js
ghost/core/core/server/models/member-paid-subscription-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberPaidSubscriptionEvent = ghostBookshelf.Model.extend({ tableName: 'members_paid_subscription_events', member() { return this.belongsTo('Member', 'member_id', 'id'); }, stripeSubscription() { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/tag-public.js
ghost/core/core/server/models/tag-public.js
const ghostBookshelf = require('./base'); const tag = require('./tag'); const TagPublic = tag.Tag.extend({ shouldHavePosts: { joinTo: 'tag_id', joinTable: 'posts_tags' } }); const TagsPublic = ghostBookshelf.Collection.extend({ model: TagPublic }); module.exports = { TagPublic: ghostB...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-email-change-event.js
ghost/core/core/server/models/member-email-change-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberEmailChangeEvent = ghostBookshelf.Model.extend({ tableName: 'members_email_change_events', member() { return this.belongsTo('Member', 'member_id', 'id'); } }, { async edit() { throw new er...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-newsletter.js
ghost/core/core/server/models/member-newsletter.js
const ghostBookshelf = require('./base'); const MemberNewsletter = ghostBookshelf.Model.extend({ tableName: 'members_newsletters' }); module.exports = { MemberNewsletter: ghostBookshelf.model('MemberNewsletter', MemberNewsletter) };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/suppression.js
ghost/core/core/server/models/suppression.js
const ghostBookshelf = require('./base'); const Suppression = ghostBookshelf.Model.extend({ tableName: 'suppressions' }); module.exports = { Suppression: ghostBookshelf.model('Suppression', Suppression) };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/milestone.js
ghost/core/core/server/models/milestone.js
const ghostBookshelf = require('./base'); const Milestone = ghostBookshelf.Model.extend({ tableName: 'milestones' }); module.exports = { Milestone: ghostBookshelf.model('Milestone', Milestone) };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/outbox.js
ghost/core/core/server/models/outbox.js
const ghostBookshelf = require('./base'); const OUTBOX_STATUSES = { PENDING: 'pending', PROCESSING: 'processing', FAILED: 'failed', COMPLETED: 'completed' }; const Outbox = ghostBookshelf.Model.extend({ tableName: 'outbox', defaults() { return { status: OUTBOX_STATUSES.PEN...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/user.js
ghost/core/core/server/models/user.js
const validator = require('@tryghost/validator'); const ObjectId = require('bson-objectid').default; const ghostBookshelf = require('./base'); const baseUtils = require('./base/utils'); const limitService = require('../services/limits'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
true
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/automated-email.js
ghost/core/core/server/models/automated-email.js
const ghostBookshelf = require('./base'); const urlUtils = require('../../shared/url-utils'); const lexicalLib = require('../lib/lexical'); const AutomatedEmail = ghostBookshelf.Model.extend({ tableName: 'automated_emails', defaults() { return { status: 'inactive' }; }, pa...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-stripe-customer.js
ghost/core/core/server/models/member-stripe-customer.js
const ghostBookshelf = require('./base'); const MemberStripeCustomer = ghostBookshelf.Model.extend({ tableName: 'members_stripe_customers', relationships: ['subscriptions'], relationshipBelongsTo: { subscriptions: 'members_stripe_customers_subscriptions' }, subscriptions() { retu...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/comment-like.js
ghost/core/core/server/models/comment-like.js
const ghostBookshelf = require('./base'); const CommentLike = ghostBookshelf.Model.extend({ tableName: 'comment_likes', defaults: function defaults() { return {}; }, comment() { return this.belongsTo('Comment', 'comment_id'); }, member() { return this.belongsTo('Membe...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/donation-payment-event.js
ghost/core/core/server/models/donation-payment-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const DonationPaymentEvent = ghostBookshelf.Model.extend({ tableName: 'donation_payment_events', member() { return this.belongsTo('Member', 'member_id', 'id'); }, postAttribution() { return this.belo...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member.js
ghost/core/core/server/models/member.js
const ghostBookshelf = require('./base'); const crypto = require('crypto'); const _ = require('lodash'); const config = require('../../shared/config'); const Member = ghostBookshelf.Model.extend({ tableName: 'members', actionsCollectCRUD: true, actionsResourceType: 'member', defaults() { retu...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/newsletter.js
ghost/core/core/server/models/newsletter.js
const ghostBookshelf = require('./base'); const ObjectID = require('bson-objectid').default; const crypto = require('crypto'); const urlUtils = require('../../shared/url-utils'); const Newsletter = ghostBookshelf.Model.extend({ tableName: 'newsletters', defaults: function defaults() { return { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/index.js
ghost/core/core/server/models/index.js
/** * Dependencies */ const _ = require('lodash'); const debug = require('@tryghost/debug')('models'); const glob = require('glob'); // enable event listeners require('./base/listeners'); /** * Expose all models */ exports = module.exports; function init() { const baseNow = Date.now(); exports.Base = re...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/snippet.js
ghost/core/core/server/models/snippet.js
const ghostBookshelf = require('./base'); const urlUtils = require('../../shared/url-utils'); const mobiledocLib = require('../lib/mobiledoc'); const lexicalLib = require('../lib/lexical'); const _ = require('lodash'); const Snippet = ghostBookshelf.Model.extend({ tableName: 'snippets', actionsCollectCRUD: tr...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/mobiledoc-revision.js
ghost/core/core/server/models/mobiledoc-revision.js
const ghostBookshelf = require('./base'); const MobiledocRevision = ghostBookshelf.Model.extend({ tableName: 'mobiledoc_revisions' }, { permittedOptions(methodName) { let options = ghostBookshelf.Model.permittedOptions.call(this, methodName); const validOptions = { findAll: ['filter...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/recommendation-click-event.js
ghost/core/core/server/models/recommendation-click-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const RecommendationClickEvent = ghostBookshelf.Model.extend({ tableName: 'recommendation_click_events' }, { async edit() { throw new errors.IncorrectUsageError({ message: 'Cannot edit RecommendationClickE...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/invite.js
ghost/core/core/server/models/invite.js
const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const security = require('@tryghost/security'); const moment = require('moment'); const settingsCache = require('../../shared/settings-cache'); const limitService = require('../services/limits'); const ghostBookshelf = require('./base');...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/stripe-customer-subscription.js
ghost/core/core/server/models/stripe-customer-subscription.js
const ghostBookshelf = require('./base'); const _ = require('lodash'); const StripeCustomerSubscription = ghostBookshelf.Model.extend({ tableName: 'members_stripe_customers_subscriptions', defaults: { mrr: 0 }, customer() { return this.belongsTo('MemberStripeCustomer', 'customer_id', ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/recommendation.js
ghost/core/core/server/models/recommendation.js
const ghostBookshelf = require('./base'); const Recommendation = ghostBookshelf.Model.extend({ tableName: 'recommendations', defaults: {} }, {}); module.exports = { Recommendation: ghostBookshelf.model('Recommendation', Recommendation) };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-click-event.js
ghost/core/core/server/models/member-click-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberClickEvent = ghostBookshelf.Model.extend({ tableName: 'members_click_events', link() { return this.belongsTo('Redirect', 'redirect_id'); }, member() { return this.belongsTo('Member', 'mem...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-status-event.js
ghost/core/core/server/models/member-status-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberStatusEvent = ghostBookshelf.Model.extend({ tableName: 'members_status_events', member() { return this.belongsTo('Member', 'member_id', 'id'); }, customQuery(qb, options) { if (options.ag...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/post-revision.js
ghost/core/core/server/models/post-revision.js
const ghostBookshelf = require('./base'); const _ = require('lodash'); const PostRevision = ghostBookshelf.Model.extend({ tableName: 'post_revisions', author() { return this.belongsTo('User', 'author_id'); }, permittedOptions(methodName) { let options = ghostBookshelf.Model.permittedO...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/collection.js
ghost/core/core/server/models/collection.js
const ghostBookshelf = require('./base'); const urlUtils = require('../../shared/url-utils'); const Collection = ghostBookshelf.Model.extend({ tableName: 'collections', hooks: { belongsToMany: { /** * @this {Collection} * @param {*} existing * @param ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/role-utils.js
ghost/core/core/server/models/role-utils.js
// check if the user has an assigned role // so that we can stop writing this everywhere: //_.some(loadedPermissions.user.roles, {name: 'Administrator'}) function checkUserPermissionsForRole(loadedPermissions, roleName) { if (!loadedPermissions?.user?.roles) { return false; } return loadedPermissi...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/recommendation-subscribe-event.js
ghost/core/core/server/models/recommendation-subscribe-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const RecommendationSubscribeEvent = ghostBookshelf.Model.extend({ tableName: 'recommendation_subscribe_events' }, { async edit() { throw new errors.IncorrectUsageError({ message: 'Cannot edit Recommendati...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/redirect.js
ghost/core/core/server/models/redirect.js
const ghostBookshelf = require('./base'); const urlUtils = require('../../shared/url-utils'); const Redirect = ghostBookshelf.Model.extend({ tableName: 'redirects', post() { return this.belongsTo('Post', 'post_id'); }, formatOnWrite(attrs) { if (attrs.to) { attrs.to = urlU...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/email-spam-complaint-event.js
ghost/core/core/server/models/email-spam-complaint-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const EmailSpamComplaintEvent = ghostBookshelf.Model.extend({ tableName: 'email_spam_complaint_events', filterRelations: function filterRelations() { return { email: { // Mongo-knex doesn'...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/custom-theme-setting.js
ghost/core/core/server/models/custom-theme-setting.js
const _ = require('lodash'); const ghostBookshelf = require('./base'); const urlUtils = require('../../shared/url-utils'); const CustomThemeSetting = ghostBookshelf.Model.extend({ tableName: 'custom_theme_settings', parse() { const attrs = ghostBookshelf.Model.prototype.parse.apply(this, arguments); ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-created-event.js
ghost/core/core/server/models/member-created-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberCreatedEvent = ghostBookshelf.Model.extend({ tableName: 'members_created_events', member() { return this.belongsTo('Member', 'member_id', 'id'); }, /** * The subscription created event that ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/webhook.js
ghost/core/core/server/models/webhook.js
const ghostBookshelf = require('./base'); const ghostVersion = require('@tryghost/version'); let Webhook; let Webhooks; Webhook = ghostBookshelf.Model.extend({ tableName: 'webhooks', actionsCollectCRUD: true, actionsResourceType: 'webhook', defaults() { return { api_version: `v${g...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/job.js
ghost/core/core/server/models/job.js
const ghostBookshelf = require('./base'); const Job = ghostBookshelf.Model.extend({ tableName: 'jobs' }); module.exports = { Job: ghostBookshelf.model('Job', Job) };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-cancel-event.js
ghost/core/core/server/models/member-cancel-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberCancelEvent = ghostBookshelf.Model.extend({ tableName: 'members_cancel_events', member() { return this.belongsTo('Member', 'member_id', 'id'); } }, { async edit() { throw new errors.Incorr...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/single-use-token.js
ghost/core/core/server/models/single-use-token.js
const ghostBookshelf = require('./base'); const crypto = require('crypto'); const SingleUseToken = ghostBookshelf.Model.extend({ tableName: 'tokens', defaults() { return { used_count: 0, otc_used_count: 0, uuid: crypto.randomUUID(), token: crypto ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/subscription-created-event.js
ghost/core/core/server/models/subscription-created-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const SubscriptionCreatedEvent = ghostBookshelf.Model.extend({ tableName: 'members_subscription_created_events', member() { return this.belongsTo('Member', 'member_id', 'id'); }, /** * The member create...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/collection-post.js
ghost/core/core/server/models/collection-post.js
const ghostBookshelf = require('./base'); const CollectionPost = ghostBookshelf.Model.extend({ tableName: 'collections_posts' }); module.exports = { CollectionPost: ghostBookshelf.model('CollectionPost', CollectionPost) };
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/post.js
ghost/core/core/server/models/post.js
// # Post Model const _ = require('lodash'); const crypto = require('crypto'); const moment = require('moment'); const {sequence} = require('@tryghost/promise'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const nql = require('@tryghost/nql'); const htmlToPlaintext = require('@tryg...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
true
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/author.js
ghost/core/core/server/models/author.js
const ghostBookshelf = require('./base'); const user = require('./user'); const Author = user.User.extend({ shouldHavePosts: { joinTo: 'author_id', joinTable: 'posts_authors' } }); const Authors = ghostBookshelf.Collection.extend({ model: Author }); module.exports = { Author: ghostBoo...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/posts-meta.js
ghost/core/core/server/models/posts-meta.js
const ghostBookshelf = require('./base'); const urlUtils = require('../../shared/url-utils'); const PostsMeta = ghostBookshelf.Model.extend({ tableName: 'posts_meta', defaults: function defaults() { return { email_only: false }; }, formatOnWrite(attrs) { ['og_image...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/role.js
ghost/core/core/server/models/role.js
const _ = require('lodash'); const ghostBookshelf = require('./base'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const {setIsRoles} = require('./role-utils'); const messages = { roleNotFound: 'Role not found', notEnoughPermission: 'You do not have permission to perform t...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/stripe-price.js
ghost/core/core/server/models/stripe-price.js
const ghostBookshelf = require('./base'); const StripePrice = ghostBookshelf.Model.extend({ tableName: 'stripe_prices', stripeProduct() { return this.belongsTo('StripeProduct', 'stripe_product_id', 'stripe_product_id'); } }); const StripePrices = ghostBookshelf.Collection.extend({ model: Stri...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/permission.js
ghost/core/core/server/models/permission.js
const ghostBookshelf = require('./base'); let Permission; let Permissions; Permission = ghostBookshelf.Model.extend({ tableName: 'permissions', relationships: ['roles'], relationshipBelongsTo: { roles: 'roles' }, /** * The base model keeps only the columns, which are defined in the...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/label.js
ghost/core/core/server/models/label.js
const ghostBookshelf = require('./base'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const messages = { labelNotFound: 'Label not found.' }; let Label; let Labels; Label = ghostBookshelf.Model.extend({ tableName: 'labels', actionsCollectCRUD: true, actionsReso...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/product.js
ghost/core/core/server/models/product.js
const ghostBookshelf = require('./base'); const _ = require('lodash'); const Product = ghostBookshelf.Model.extend({ tableName: 'products', actionsCollectCRUD: true, actionsResourceType: 'product', defaults: { active: true, visibility: 'none', trial_days: 0 }, relatio...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/comment-report.js
ghost/core/core/server/models/comment-report.js
const ghostBookshelf = require('./base'); const CommentReport = ghostBookshelf.Model.extend({ tableName: 'comment_reports', defaults: function defaults() { return {}; }, comment() { return this.belongsTo('Comment', 'comment_id'); }, member() { return this.belongsTo('M...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/email-recipient.js
ghost/core/core/server/models/email-recipient.js
const ghostBookshelf = require('./base'); const EmailRecipient = ghostBookshelf.Model.extend({ tableName: 'email_recipients', hasTimestamps: false, filterRelations: function filterRelations() { return { email: { // Mongo-knex doesn't support belongsTo relations ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/offer.js
ghost/core/core/server/models/offer.js
const ghostBookshelf = require('./base'); const Offer = ghostBookshelf.Model.extend({ tableName: 'offers', actionsCollectCRUD: true, actionsResourceType: 'offer', product() { return this.belongsTo('Product', 'product_id', 'id'); } }); module.exports = { Offer: ghostBookshelf.model('O...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-payment-event.js
ghost/core/core/server/models/member-payment-event.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberPaymentEvent = ghostBookshelf.Model.extend({ tableName: 'members_payment_events', member() { return this.belongsTo('Member', 'member_id', 'id'); }, customQuery(qb, options) { if (options....
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/comment.js
ghost/core/core/server/models/comment.js
const ghostBookshelf = require('./base'); const _ = require('lodash'); const errors = require('@tryghost/errors'); const tpl = require('@tryghost/tpl'); const {ValidationError} = require('@tryghost/errors'); const messages = { emptyComment: 'The body of a comment cannot be empty', commentNotFound: 'Comment cou...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/member-feedback.js
ghost/core/core/server/models/member-feedback.js
const errors = require('@tryghost/errors'); const ghostBookshelf = require('./base'); const MemberFeedback = ghostBookshelf.Model.extend({ tableName: 'members_feedback', post() { return this.belongsTo('Post', 'post_id', 'id'); }, member() { return this.belongsTo('Member', 'member_...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/settings.js
ghost/core/core/server/models/settings.js
const _ = require('lodash'); const crypto = require('crypto'); const keypair = require('keypair'); const ObjectID = require('bson-objectid').default; const ghostBookshelf = require('./base'); const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const validator = require('@tryghost/validator...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false
TryGhost/Ghost
https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/models/api-key.js
ghost/core/core/server/models/api-key.js
const omit = require('lodash/omit'); const security = require('@tryghost/security'); const ghostBookshelf = require('./base'); const {Role} = require('./role'); const ApiKey = ghostBookshelf.Model.extend({ tableName: 'api_keys', actionsCollectCRUD: true, actionsResourceType: 'api_key', defaults() { ...
javascript
MIT
31ecb69a147e71743e74014b4e04ccce09ab8c1a
2026-01-04T14:57:14.657301Z
false