Skip to content

Move packages #23135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,13 @@ COPY ghost/email-service/package.json ghost/email-service/package.json
COPY ghost/html-to-plaintext/package.json ghost/html-to-plaintext/package.json
COPY ghost/i18n/package.json ghost/i18n/package.json
COPY ghost/job-manager/package.json ghost/job-manager/package.json
COPY ghost/link-replacer/package.json ghost/link-replacer/package.json
COPY ghost/member-attribution/package.json ghost/member-attribution/package.json
COPY ghost/members-csv/package.json ghost/members-csv/package.json
COPY ghost/mw-error-handler/package.json ghost/mw-error-handler/package.json
COPY ghost/mw-vhost/package.json ghost/mw-vhost/package.json
COPY ghost/offers/package.json ghost/offers/package.json
COPY ghost/post-events/package.json ghost/post-events/package.json
COPY ghost/post-revisions/package.json ghost/post-revisions/package.json
COPY ghost/prometheus-metrics/package.json ghost/prometheus-metrics/package.json
COPY ghost/security/package.json ghost/security/package.json
COPY ghost/tiers/package.json ghost/tiers/package.json
COPY ghost/webmentions/package.json ghost/webmentions/package.json

## Install dependencies
Expand Down
10 changes: 1 addition & 9 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,13 @@ services:
- node_modules_ghost_html-to-plaintext:/home/ghost/ghost/html-to-plaintext/node_modules:delegated
- node_modules_ghost_i18n:/home/ghost/ghost/i18n/node_modules:delegated
- node_modules_ghost_job-manager:/home/ghost/ghost/job-manager/node_modules:delegated
- node_modules_ghost_link-replacer:/home/ghost/ghost/link-replacer/node_modules:delegated
- node_modules_ghost_member-attribution:/home/ghost/ghost/member-attribution/node_modules:delegated
- node_modules_ghost_members-csv:/home/ghost/ghost/members-csv/node_modules:delegated
- node_modules_ghost_mw-error-handler:/home/ghost/ghost/mw-error-handler/node_modules:delegated
- node_modules_ghost_mw-vhost:/home/ghost/ghost/mw-vhost/node_modules:delegated
- node_modules_ghost_offers:/home/ghost/ghost/offers/node_modules:delegated
- node_modules_ghost_post-events:/home/ghost/ghost/post-events/node_modules:delegated
- node_modules_ghost_post-revisions:/home/ghost/ghost/post-revisions/node_modules:delegated
- node_modules_ghost_prometheus-metrics:/home/ghost/ghost/prometheus-metrics/node_modules:delegated
- node_modules_ghost_security:/home/ghost/ghost/security/node_modules:delegated
- node_modules_ghost_tiers:/home/ghost/ghost/tiers/node_modules:delegated
- node_modules_ghost_webmentions:/home/ghost/ghost/webmentions/node_modules:delegated
- node_modules_apps_admin-x-activitypub:/home/ghost/apps/admin-x-activitypub/node_modules:delegated
- node_modules_apps_admin-x-design-system:/home/ghost/apps/admin-x-design-system/node_modules:delegated
Expand Down Expand Up @@ -92,7 +88,7 @@ services:
dockerfile: ./.docker/Dockerfile
target: tinybird
working_dir: /home/ghost/ghost/web-analytics
profiles: [ tinybird]
profiles: [ tinybird ]
tty: true

browser-tests:
Expand Down Expand Up @@ -192,17 +188,13 @@ volumes:
node_modules_ghost_html-to-plaintext: {}
node_modules_ghost_i18n: {}
node_modules_ghost_job-manager: {}
node_modules_ghost_link-replacer: {}
node_modules_ghost_member-attribution: {}
node_modules_ghost_members-csv: {}
node_modules_ghost_mw-error-handler: {}
node_modules_ghost_mw-vhost: {}
node_modules_ghost_offers: {}
node_modules_ghost_post-events: {}
node_modules_ghost_post-revisions: {}
node_modules_ghost_prometheus-metrics: {}
node_modules_ghost_security: {}
node_modules_ghost_tiers: {}
node_modules_ghost_webmentions: {}
node_modules_apps_admin-x-activitypub: {}
node_modules_apps_admin-x-design-system: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EmailServiceWrapper {
const lexicalLib = require('../../lib/lexical');
const urlUtils = require('../../../shared/url-utils');
const memberAttribution = require('../member-attribution');
const linkReplacer = require('@tryghost/link-replacer');
const linkReplacer = require('../lib/link-replacer');
const linkTracking = require('../link-tracking');
const audienceFeedback = require('../audience-feedback');
const storageUtils = require('../../adapters/storage/utils');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class LinkReplacer {
/**
* Replaces the links in the provided HTML
* @param {string} html
* @param {(url: URL, originalPath: string): Promise<URL|string|false>} replaceLink
* @param {(url: URL, originalPath: string) => Promise<URL|string|false>} replaceLink
* @param {object} options
* @param {string} [options.base] If you want to replace relative links, this will replace them to an absolute link and call the replaceLink method too
* @returns {Promise<string>}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {slugify} = require('@tryghost/string');
const LinkReplacer = require('@tryghost/link-replacer');
const LinkReplacer = require('../lib/link-replacer');

const blockedReferrerDomains = [
// Facebook has some restrictions on the 'ref' attribute (max 15 chars + restricted character set) that breaks links if we add ?ref=longer-string
Expand Down
8 changes: 5 additions & 3 deletions ghost/core/core/server/services/member-attribution/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ class MemberAttributionServiceWrapper {
}

// Wire up all the dependencies
const {
MemberAttributionService, UrlTranslator, ReferrerTranslator, AttributionBuilder, OutboundLinkTagger
} = require('@tryghost/member-attribution');
const MemberAttributionService = require('./MemberAttributionService');
const UrlTranslator = require('./UrlTranslator');
const ReferrerTranslator = require('./ReferrerTranslator');
const AttributionBuilder = require('./AttributionBuilder');
const OutboundLinkTagger = require('./OutboundLinkTagger');
const models = require('../../models');

const urlTranslator = new UrlTranslator({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const DEFAULT_CSV_HEADER_MAPPING = {
* @property {string} storagePath - The path to store CSV's in before importing
* @property {Function} getTimezone - function returning currently configured timezone
* @property {() => Object} getMembersRepository - member model access instance for data access and manipulation
* @property {() => Promise<import('@tryghost/tiers/lib/Tier')>} getDefaultTier - async function returning default Member Tier
* @property {(string) => Promise<import('@tryghost/tiers/lib/Tier')>} getTierByName - async function returning Member Tier by name
* @property {() => Promise<import('../../tiers/Tier')>} getDefaultTier - async function returning default Member Tier
* @property {(string) => Promise<import('../../tiers/Tier')>} getTierByName - async function returning Member Tier by name
* @property {Function} sendEmail - function sending an email
* @property {(string) => boolean} isSet - Method checking if specific feature is enabled
* @property {({job, offloaded, name}) => void} addJob - Method registering an async job
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
const logging = require('@tryghost/logging');
const DomainEvents = require('@tryghost/domain-events');
const {TierCreatedEvent, TierPriceChangeEvent, TierNameChangeEvent} = require('@tryghost/tiers');
const OfferCreatedEvent = require('@tryghost/members-offers').events.OfferCreatedEvent;
const TierCreatedEvent = require('../../../../../../core/server/services/tiers/TierCreatedEvent');
const TierPriceChangeEvent = require('../../../../../../core/server/services/tiers/TierPriceChangeEvent');
const TierNameChangeEvent = require('../../../../../../core/server/services/tiers/TierNameChangeEvent');
const OfferCreatedEvent = require('../../../../../../core/server/services/offers/domain/events/OfferCreatedEvent');
const {BadRequestError} = require('@tryghost/errors');

class PaymentsService {
/**
* @param {object} deps
* @param {import('bookshelf').Model} deps.Offer
* @param {import('@tryghost/members-offers/lib/application/OffersAPI')} deps.offersAPI
* @param {import('@tryghost/members-stripe-service/lib/StripeAPI')} deps.stripeAPIService
* @param {import('../../../offers/application/OffersAPI')} deps.offersAPI
* @param {import('../../../stripe/StripeAPI')} deps.stripeAPIService
* @param {{get(key: string): any}} deps.settingsCache
*/
constructor(deps) {
Expand Down Expand Up @@ -55,7 +57,7 @@ class PaymentsService {

/**
* @param {object} params
* @param {Tier} params.tier
* @param {import('../../../tiers/Tier')} params.tier
* @param {Tier.Cadence} params.cadence
* @param {Offer} [params.offer]
* @param {Member} [params.member]
Expand Down Expand Up @@ -127,15 +129,15 @@ class PaymentsService {
if (member && isAuthenticated) {
customer = await this.getCustomerForMember(member);
}

const data = {
priceId: (await this.getPriceForDonations()).id,
metadata,
successUrl: successUrl,
cancelUrl: cancelUrl,
customer,
customerEmail: !customer && email ? email : null,
personalNote: personalNote
personalNote: personalNote

};

Expand Down Expand Up @@ -181,7 +183,7 @@ class PaymentsService {
}

/**
* @param {import('@tryghost/tiers').Tier} tier
* @param {import('../../../tiers/Tier')} tier
* @returns {Promise<{id: string}>}
*/
async getProductForTier(tier) {
Expand Down Expand Up @@ -209,7 +211,7 @@ class PaymentsService {
}

/**
* @param {import('@tryghost/tiers').Tier} tier
* @param {import('../../../tiers/Tier')} tier
* @returns {Promise<import('stripe').default.Product>}
*/
async createProductForTier(tier) {
Expand All @@ -222,7 +224,7 @@ class PaymentsService {
}

/**
* @param {import('@tryghost/tiers').Tier} tier
* @param {import('../../../tiers/Tier')} tier
* @returns {Promise<void>}
*/
async updateNameForTierProducts(tier) {
Expand Down Expand Up @@ -396,7 +398,7 @@ class PaymentsService {
}

/**
* @param {import('@tryghost/tiers').Tier} tier
* @param {import('../../../tiers/Tier')} tier
* @param {'month'|'year'} cadence
* @returns {Promise<{id: string}>}
*/
Expand Down Expand Up @@ -440,7 +442,7 @@ class PaymentsService {
}

/**
* @param {import('@tryghost/tiers').Tier} tier
* @param {import('../../../tiers/Tier')} tier
* @param {'month'|'year'} cadence
* @returns {Promise<import('stripe').default.Price>}
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const {flowRight} = require('lodash');
const {mapKeyValues, mapQuery} = require('@tryghost/mongo-utils');
const DomainEvents = require('@tryghost/domain-events');
const {Offer} = require('@tryghost/members-offers');
const Offer = require('./domain/models/Offer');
const sentry = require('../../../shared/sentry');
const logger = require('@tryghost/logging');

Expand Down Expand Up @@ -93,7 +93,7 @@ class OfferBookshelfRepository {
* @private
* @param {import('bookshelf').Model<any>} model
* @param {BaseOptions} options
* @returns {Promise<import('@tryghost/members-offers').Offer>}
* @returns {Promise<import('./domain/models/Offer')>}
*/
async mapToOffer(model, options) {
const json = model.toJSON();
Expand Down Expand Up @@ -140,7 +140,7 @@ class OfferBookshelfRepository {
/**
* @param {string} id
* @param {BaseOptions} [options]
* @returns {Promise<import('@tryghost/members-offers').Offer>}
* @returns {Promise<import('./domain/models/Offer')>}
*/
async getById(id, options) {
const model = await this.OfferModel.findOne({id}, {
Expand All @@ -158,7 +158,7 @@ class OfferBookshelfRepository {
/**
* @param {string} id stripe_coupon_id
* @param {BaseOptions} [options]
* @returns {Promise<import('@tryghost/members-offers').Offer>}
* @returns {Promise<import('./domain/models/Offer')>}
*/
async getByStripeCouponId(id, options) {
const model = await this.OfferModel.findOne({stripe_coupon_id: id}, {
Expand All @@ -175,7 +175,7 @@ class OfferBookshelfRepository {

/**
* @param {ListOptions} options
* @returns {Promise<import('@tryghost/members-offers').Offer[]>}
* @returns {Promise<import('./domain/models/Offer')[]>}
*/
async getAll(options) {
const models = await this.OfferModel.findAll({
Expand All @@ -194,7 +194,7 @@ class OfferBookshelfRepository {
}

/**
* @param {import('@tryghost/members-offers').Offer} offer
* @param {import('./domain/models/Offer')} offer
* @param {BaseOptions} [options]
* @returns {Promise<void>}
*/
Expand Down
3 changes: 1 addition & 2 deletions ghost/core/core/server/services/offers/service.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const OffersModule = require('@tryghost/members-offers');

const DynamicRedirectManager = require('../lib/DynamicRedirectManager');
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');
const models = require('../../models');
const OfferBookshelfRepository = require('./OfferBookshelfRepository');
const OffersModule = require('./OffersModule');

let redirectManager;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @typedef {object} TierActivatedEventData
* @prop {Tier} tier
* @prop {import('./Tier')} tier
*/

class TierActivatedEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @typedef {object} TierArchivedEventData
* @prop {Tier} tier
* @prop {import('./Tier')} tier
*/

class TierArchivedEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @typedef {object} TierCreatedEventData
* @prop {Tier} tier
* @prop {import('./Tier')} tier
*/

class TierCreatedEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @typedef {object} TierNameChangeEventData
* @prop {Tier} tier
* @prop {import('./Tier')} tier
*/

class TierNameChangeEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @typedef {object} TierPriceChangeEventData
* @prop {Tier} tier
* @prop {import('./Tier')} tier
*/

class TierPriceChangeEvent {
Expand Down
14 changes: 7 additions & 7 deletions ghost/core/core/server/services/tiers/TierRepository.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const {Tier} = require('@tryghost/tiers');
const Tier = require('./Tier');
const nql = require('@tryghost/nql');

/**
* @typedef {import('@tryghost/tiers/lib/TiersAPI').ITierRepository} ITierRepository
* @typedef {import('./TiersAPI').ITierRepository} ITierRepository
*/

/**
* @implements {ITierRepository}
*/
module.exports = class TierRepository {
/** @type {import('@tryghost/tiers/lib/Tier')[]} */
/** @type {import('./Tier')[]} */
#store = [];
/** @type {Object.<string, true>} */
#ids = {};
Expand Down Expand Up @@ -44,7 +44,7 @@ module.exports = class TierRepository {
}

/**
* @param {import('@tryghost/tiers/lib/Tier')} tier
* @param {import('./Tier')} tier
* @returns {any}
*/
toPrimitive(tier) {
Expand Down Expand Up @@ -83,7 +83,7 @@ module.exports = class TierRepository {
/**
* @param {object} [options]
* @param {string} [options.filter]
* @returns {Promise<import('@tryghost/tiers/lib/Tier')[]>}
* @returns {Promise<import('./Tier')[]>}
*/
async getAll(options = {}) {
const filter = nql();
Expand All @@ -97,7 +97,7 @@ module.exports = class TierRepository {

/**
* @param {import('bson-objectid').default} id
* @returns {Promise<import('@tryghost/tiers/lib/Tier')>}
* @returns {Promise<import('./Tier')>}
*/
async getById(id) {
const found = this.#store.find((item) => {
Expand All @@ -112,7 +112,7 @@ module.exports = class TierRepository {
}

/**
* @param {import('@tryghost/tiers/lib/Tier')} tier
* @param {import('./Tier')} tier
* @returns {Promise<void>}
*/
async save(tier) {
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/core/server/services/tiers/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class TiersServiceWrapper {
return;
}

const {TiersAPI} = require('@tryghost/tiers');
const TiersAPI = require('./TiersAPI');
const DomainEvents = require('@tryghost/domain-events');

const models = require('../../models');
Expand Down
Loading
Loading