ghost 4.41.1 → 4.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/boot.js +24 -6
- package/core/built/assets/ghost-dark-97613c037232aba4490489431ce170ca.css +1 -0
- package/core/built/assets/{ghost.min-8e2e6c7a01fde044c566c1650a36bfc2.js → ghost.min-20096eef632760c3a2906e243adbd24b.js} +1035 -841
- package/core/built/assets/ghost.min-c08ce1872f0e09edb63eb13c43606d18.css +1 -0
- package/core/built/assets/{vendor.min-9094db77ba3190cb10876f8e42e1d90d.js → vendor.min-21f79c68a284acb1b70039f3f63e5507.js} +68 -68
- package/core/built/assets/{vendor.min-2c8ad32b7960bb605ebc20097fee5ebd.css → vendor.min-ba66b98f7c24fa40e061c7ffc94f4e23.css} +214 -0
- package/core/frontend/helpers/price.js +1 -0
- package/core/frontend/web/middleware/error-handler.js +5 -3
- package/core/server/api/canary/email-preview.js +2 -1
- package/core/server/api/canary/{email.js → emails.js} +0 -0
- package/core/server/api/canary/index.js +11 -3
- package/core/server/api/canary/{memberSigninUrls.js → member-signin-urls.js} +0 -1
- package/core/server/api/canary/{membersStripeConnect.js → members-stripe-connect.js} +0 -0
- package/core/server/api/canary/members.js +0 -45
- package/core/server/api/canary/newsletters.js +45 -0
- package/core/server/api/canary/stats.js +14 -0
- package/core/server/api/canary/utils/serializers/output/authentication.js +4 -0
- package/core/server/api/canary/utils/serializers/output/default.js +35 -0
- package/core/server/api/canary/utils/serializers/output/email-previews.js +7 -0
- package/core/server/api/canary/utils/serializers/output/index.js +18 -42
- package/core/server/api/canary/utils/serializers/output/mappers/authors.js +1 -0
- package/core/server/api/canary/utils/serializers/output/mappers/index.js +2 -1
- package/core/server/api/canary/utils/serializers/output/mappers/integrations.js +1 -1
- package/core/server/api/canary/utils/serializers/output/mappers/snippets.js +36 -0
- package/core/server/api/canary/utils/serializers/output/members-stripe-connect.js +6 -0
- package/core/server/api/canary/utils/serializers/output/members.js +2 -2
- package/core/server/api/canary/utils/serializers/output/oembed.js +2 -2
- package/core/server/api/canary/utils/serializers/output/offers.js +8 -0
- package/core/server/api/canary/utils/serializers/output/redirects.js +2 -2
- package/core/server/api/canary/utils/serializers/output/schedules.js +2 -2
- package/core/server/api/canary/utils/serializers/output/session.js +9 -0
- package/core/server/api/canary/utils/serializers/output/settings.js +64 -37
- package/core/server/api/canary/utils/serializers/output/slack.js +9 -0
- package/core/server/api/canary/utils/serializers/output/themes.js +3 -24
- package/core/server/api/canary/utils/serializers/output/users.js +0 -23
- package/core/server/api/shared/serializers/handle.js +25 -11
- package/core/server/data/exporter/table-lists.js +1 -0
- package/core/server/data/migrations/utils.js +1 -1
- package/core/server/data/migrations/versions/4.42/2022-03-21-17-17-add.js +20 -0
- package/core/server/data/migrations/versions/4.42/2022-03-30-15-44-add-newsletter-permissions.js +28 -0
- package/core/server/data/schema/commands.js +13 -13
- package/core/server/data/schema/schema.js +18 -0
- package/core/server/models/newsletter.js +9 -0
- package/core/server/services/mega/template.js +25 -13
- package/core/server/services/members/service.js +2 -1
- package/core/server/services/offers/service.js +11 -8
- package/core/server/services/stats/index.js +1 -0
- package/core/server/services/stats/lib/members-stats-service.js +165 -0
- package/core/server/services/stats/service.js +6 -0
- package/core/server/services/themes/validate.js +4 -3
- package/core/server/services/webhooks/webhooks-service.js +3 -1
- package/core/server/web/admin/app.js +8 -0
- package/core/server/web/admin/views/default-prod.html +5 -5
- package/core/server/web/admin/views/default.html +5 -5
- package/core/server/web/api/canary/admin/routes.js +8 -2
- package/core/shared/config/defaults.json +2 -2
- package/core/shared/config/env/config.development.json +26 -0
- package/core/shared/config/env/config.production.json +21 -0
- package/core/shared/config/env/config.testing-mysql.json +59 -0
- package/core/shared/config/env/config.testing.json +58 -0
- package/core/shared/labs.js +3 -1
- package/core/shared/settings-cache/cache.js +1 -1
- package/package.json +66 -66
- package/yarn.lock +1609 -1781
- package/.c8rc.json +0 -34
- package/.eslintrc.js +0 -118
- package/core/built/assets/ghost-dark-6fbe502f2bb2cde92e15b2f1a9da57a0.css +0 -1
- package/core/built/assets/ghost.min-09301e5bd933cf6d24368e98a4d898a9.css +0 -1
- package/core/server/api/canary/utils/serializers/output/actions.js +0 -13
- package/core/server/api/canary/utils/serializers/output/authors.js +0 -21
- package/core/server/api/canary/utils/serializers/output/email-preview.js +0 -7
- package/core/server/api/canary/utils/serializers/output/emails.js +0 -22
- package/core/server/api/canary/utils/serializers/output/identities.js +0 -7
- package/core/server/api/canary/utils/serializers/output/integrations.js +0 -34
- package/core/server/api/canary/utils/serializers/output/invites.js +0 -24
- package/core/server/api/canary/utils/serializers/output/labels.js +0 -25
- package/core/server/api/canary/utils/serializers/output/mappers/labels.js +0 -4
- package/core/server/api/canary/utils/serializers/output/member-signin_urls.js +0 -7
- package/core/server/api/canary/utils/serializers/output/snippets.js +0 -97
- package/core/server/api/canary/utils/serializers/output/tags.js +0 -25
- package/core/server/api/canary/utils/serializers/output/webhooks.js +0 -15
- package/jsconfig.json +0 -13
|
@@ -1202,6 +1202,220 @@ ol .occluded-content {
|
|
|
1202
1202
|
height: 0;
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
+
:root {
|
|
1206
|
+
/* The named -duration and -delay variables will be lowered to near zero when using the setupPromiseModals test helper */
|
|
1207
|
+
--epm-animation-backdrop-in-duration: 0.3s;
|
|
1208
|
+
--epm-animation-backdrop-out-duration: 0.18s;
|
|
1209
|
+
--epm-animation-modal-in-duration: 0.3s;
|
|
1210
|
+
--epm-animation-modal-out-duration: 0.18s;
|
|
1211
|
+
--epm-animation-backdrop-in-delay: 0s;
|
|
1212
|
+
--epm-animation-backdrop-out-delay: 0s;
|
|
1213
|
+
--epm-animation-modal-in-delay: 0s;
|
|
1214
|
+
--epm-animation-modal-out-delay: 0s;
|
|
1215
|
+
--epm-animation-backdrop-in: var(--epm-animation-backdrop-in-duration) ease var(--epm-animation-backdrop-in-delay) forwards epm-backdrop-in;
|
|
1216
|
+
--epm-animation-backdrop-out: var(--epm-animation-backdrop-out-duration) ease var(--epm-animation-backdrop-out-delay) forwards epm-backdrop-out;
|
|
1217
|
+
--epm-animation-modal-in: var(--epm-animation-modal-in-duration) ease-out var(--epm-animation-modal-in-delay) forwards epm-modal-in;
|
|
1218
|
+
--epm-animation-modal-out: var(--epm-animation-modal-out-duration) ease-out var(--epm-animation-modal-out-delay) forwards epm-modal-out;
|
|
1219
|
+
--epm-backdrop-background: #2d3748CD;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1223
|
+
:root {
|
|
1224
|
+
--epm-animation-backdrop-in-duration: 0s;
|
|
1225
|
+
--epm-animation-backdrop-out-duration: 0s;
|
|
1226
|
+
--epm-animation-modal-in-duration: 0s;
|
|
1227
|
+
--epm-animation-modal-out-duration: 0s;
|
|
1228
|
+
--epm-animation-backdrop-in-delay: 0s;
|
|
1229
|
+
--epm-animation-backdrop-out-delay: 0s;
|
|
1230
|
+
--epm-animation-modal-in-delay: 0s;
|
|
1231
|
+
--epm-animation-modal-out-delay: 0s;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
.epm-scrolling-disabled {
|
|
1236
|
+
overflow: hidden;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
.epm-backdrop,
|
|
1240
|
+
.epm-modal-container {
|
|
1241
|
+
position: fixed;
|
|
1242
|
+
top: 0;
|
|
1243
|
+
right: 0;
|
|
1244
|
+
bottom: 0;
|
|
1245
|
+
left: 0;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
.epm-backdrop {
|
|
1249
|
+
background-color: #2d3748CD;
|
|
1250
|
+
background-color: var(--epm-backdrop-background);
|
|
1251
|
+
opacity: 0;
|
|
1252
|
+
-webkit-animation: 0.3s ease 0s forwards epm-backdrop-in;
|
|
1253
|
+
animation: 0.3s ease 0s forwards epm-backdrop-in;
|
|
1254
|
+
-webkit-animation: var(--epm-animation-backdrop-in);
|
|
1255
|
+
animation: var(--epm-animation-backdrop-in);
|
|
1256
|
+
-webkit-animation-delay: 0s;
|
|
1257
|
+
animation-delay: 0s;
|
|
1258
|
+
-webkit-animation-delay: var(--epm-animation-backdrop-in-delay);
|
|
1259
|
+
animation-delay: var(--epm-animation-backdrop-in-delay);
|
|
1260
|
+
-webkit-animation-duration: 0.3s;
|
|
1261
|
+
animation-duration: 0.3s;
|
|
1262
|
+
-webkit-animation-duration: var(--epm-animation-backdrop-in-duration);
|
|
1263
|
+
animation-duration: var(--epm-animation-backdrop-in-duration);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
.epm-modal-container {
|
|
1267
|
+
display: flex;
|
|
1268
|
+
align-items: center;
|
|
1269
|
+
justify-content: center;
|
|
1270
|
+
overflow: auto;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
.epm-animating .epm-modal-container {
|
|
1274
|
+
overflow: unset;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
.epm-modal {
|
|
1278
|
+
margin: auto;
|
|
1279
|
+
transform: translate(0, -30vh) scale(1.1);
|
|
1280
|
+
opacity: 0;
|
|
1281
|
+
-webkit-animation: 0.3s ease-out 0s forwards epm-modal-in;
|
|
1282
|
+
animation: 0.3s ease-out 0s forwards epm-modal-in;
|
|
1283
|
+
-webkit-animation: var(--epm-animation-modal-in);
|
|
1284
|
+
animation: var(--epm-animation-modal-in);
|
|
1285
|
+
-webkit-animation-delay: 0s;
|
|
1286
|
+
animation-delay: 0s;
|
|
1287
|
+
-webkit-animation-delay: var(--epm-animation-modal-in-delay);
|
|
1288
|
+
animation-delay: var(--epm-animation-modal-in-delay);
|
|
1289
|
+
-webkit-animation-duration: 0.3s;
|
|
1290
|
+
animation-duration: 0.3s;
|
|
1291
|
+
-webkit-animation-duration: var(--epm-animation-modal-in-duration);
|
|
1292
|
+
animation-duration: var(--epm-animation-modal-in-duration);
|
|
1293
|
+
-webkit-overflow-scrolling: touch; /* momentum-based scrolling for Safari on iOS */
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
.epm-backdrop.epm-out {
|
|
1297
|
+
opacity: 1;
|
|
1298
|
+
-webkit-animation: 0.18s ease 0s forwards epm-backdrop-out;
|
|
1299
|
+
animation: 0.18s ease 0s forwards epm-backdrop-out;
|
|
1300
|
+
-webkit-animation: var(--epm-animation-backdrop-out);
|
|
1301
|
+
animation: var(--epm-animation-backdrop-out);
|
|
1302
|
+
-webkit-animation-delay: 0s;
|
|
1303
|
+
animation-delay: 0s;
|
|
1304
|
+
-webkit-animation-delay: var(--epm-animation-backdrop-out-delay);
|
|
1305
|
+
animation-delay: var(--epm-animation-backdrop-out-delay);
|
|
1306
|
+
-webkit-animation-duration: 0.18s;
|
|
1307
|
+
animation-duration: 0.18s;
|
|
1308
|
+
-webkit-animation-duration: var(--epm-animation-backdrop-out-duration);
|
|
1309
|
+
animation-duration: var(--epm-animation-backdrop-out-duration);
|
|
1310
|
+
pointer-events: none;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
.epm-modal.epm-out {
|
|
1314
|
+
transform: translate(0, 0) scale(1);
|
|
1315
|
+
opacity: 1;
|
|
1316
|
+
-webkit-animation: 0.18s ease-out 0s forwards epm-modal-out;
|
|
1317
|
+
animation: 0.18s ease-out 0s forwards epm-modal-out;
|
|
1318
|
+
-webkit-animation: var(--epm-animation-modal-out);
|
|
1319
|
+
animation: var(--epm-animation-modal-out);
|
|
1320
|
+
-webkit-animation-delay: 0s;
|
|
1321
|
+
animation-delay: 0s;
|
|
1322
|
+
-webkit-animation-delay: var(--epm-animation-modal-out-delay);
|
|
1323
|
+
animation-delay: var(--epm-animation-modal-out-delay);
|
|
1324
|
+
-webkit-animation-duration: 0.18s;
|
|
1325
|
+
animation-duration: 0.18s;
|
|
1326
|
+
-webkit-animation-duration: var(--epm-animation-modal-out-duration);
|
|
1327
|
+
animation-duration: var(--epm-animation-modal-out-duration);
|
|
1328
|
+
pointer-events: none;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
@-webkit-keyframes epm-backdrop-in {
|
|
1332
|
+
0% {
|
|
1333
|
+
opacity: 0;
|
|
1334
|
+
}
|
|
1335
|
+
100% {
|
|
1336
|
+
opacity: 1;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
@keyframes epm-backdrop-in {
|
|
1341
|
+
0% {
|
|
1342
|
+
opacity: 0;
|
|
1343
|
+
}
|
|
1344
|
+
100% {
|
|
1345
|
+
opacity: 1;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
@-webkit-keyframes epm-backdrop-out {
|
|
1350
|
+
0% {
|
|
1351
|
+
opacity: 1;
|
|
1352
|
+
}
|
|
1353
|
+
100% {
|
|
1354
|
+
opacity: 0;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
@keyframes epm-backdrop-out {
|
|
1359
|
+
0% {
|
|
1360
|
+
opacity: 1;
|
|
1361
|
+
}
|
|
1362
|
+
100% {
|
|
1363
|
+
opacity: 0;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
@-webkit-keyframes epm-modal-in {
|
|
1368
|
+
0% {
|
|
1369
|
+
transform: translate(0, -30vh) scale(1.1);
|
|
1370
|
+
opacity: 0;
|
|
1371
|
+
}
|
|
1372
|
+
72% {
|
|
1373
|
+
transform: translate(0, 0) scale(0.99);
|
|
1374
|
+
opacity: 1;
|
|
1375
|
+
}
|
|
1376
|
+
100% {
|
|
1377
|
+
transform: translate(0, 0) scale(1);
|
|
1378
|
+
opacity: 1;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
@keyframes epm-modal-in {
|
|
1383
|
+
0% {
|
|
1384
|
+
transform: translate(0, -30vh) scale(1.1);
|
|
1385
|
+
opacity: 0;
|
|
1386
|
+
}
|
|
1387
|
+
72% {
|
|
1388
|
+
transform: translate(0, 0) scale(0.99);
|
|
1389
|
+
opacity: 1;
|
|
1390
|
+
}
|
|
1391
|
+
100% {
|
|
1392
|
+
transform: translate(0, 0) scale(1);
|
|
1393
|
+
opacity: 1;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
@-webkit-keyframes epm-modal-out {
|
|
1398
|
+
0% {
|
|
1399
|
+
transform: translate(0, 0) scale(1);
|
|
1400
|
+
opacity: 1;
|
|
1401
|
+
}
|
|
1402
|
+
100% {
|
|
1403
|
+
transform: translate(0, -10vh) scale(0.8);
|
|
1404
|
+
opacity: 0;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
@keyframes epm-modal-out {
|
|
1409
|
+
0% {
|
|
1410
|
+
transform: translate(0, 0) scale(1);
|
|
1411
|
+
opacity: 1;
|
|
1412
|
+
}
|
|
1413
|
+
100% {
|
|
1414
|
+
transform: translate(0, -10vh) scale(0.8);
|
|
1415
|
+
opacity: 0;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1205
1419
|
.ember-tooltip-base {
|
|
1206
1420
|
display: none;
|
|
1207
1421
|
height: 0;
|
|
@@ -58,6 +58,7 @@ module.exports = function price(planOrAmount, options) {
|
|
|
58
58
|
}
|
|
59
59
|
options = options || {};
|
|
60
60
|
options.hash = options.hash || {};
|
|
61
|
+
// NOTE: potentially breaking place once site.lang is removed in favor of site.locale
|
|
61
62
|
const {currency, numberFormat = 'short', currencyFormat = 'symbol', locale = _.get(options, 'data.site.lang', 'en')} = options.hash;
|
|
62
63
|
if (plan) {
|
|
63
64
|
return formatter({
|
|
@@ -7,7 +7,7 @@ const config = require('../../../shared/config');
|
|
|
7
7
|
const helpers = require('../../services/routing/helpers');
|
|
8
8
|
|
|
9
9
|
// @TODO: make this properly shared code
|
|
10
|
-
const {prepareError} = require('@tryghost/mw-error-handler');
|
|
10
|
+
const {prepareError, prepareStack} = require('@tryghost/mw-error-handler');
|
|
11
11
|
|
|
12
12
|
const messages = {
|
|
13
13
|
oopsErrorTemplateHasError: 'Oops, seems there is an error in the error template.',
|
|
@@ -84,10 +84,12 @@ const themeErrorRenderer = (err, req, res, next) => {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
module.exports.handleThemeResponse = [
|
|
87
|
-
// Handle the error in Sentry
|
|
88
|
-
sentry.errorHandler,
|
|
89
87
|
// Make sure the error can be served
|
|
90
88
|
prepareError,
|
|
89
|
+
// Handle the error in Sentry
|
|
90
|
+
sentry.errorHandler,
|
|
91
|
+
// Format the stack for the user
|
|
92
|
+
prepareStack,
|
|
91
93
|
// Render the error using theme template
|
|
92
94
|
themeErrorRenderer
|
|
93
95
|
];
|
|
File without changes
|
|
@@ -78,7 +78,7 @@ module.exports = {
|
|
|
78
78
|
},
|
|
79
79
|
|
|
80
80
|
get membersStripeConnect() {
|
|
81
|
-
return shared.pipeline(require('./
|
|
81
|
+
return shared.pipeline(require('./members-stripe-connect'), localUtils);
|
|
82
82
|
},
|
|
83
83
|
|
|
84
84
|
get members() {
|
|
@@ -98,7 +98,7 @@ module.exports = {
|
|
|
98
98
|
},
|
|
99
99
|
|
|
100
100
|
get memberSigninUrls() {
|
|
101
|
-
return shared.pipeline(require('./
|
|
101
|
+
return shared.pipeline(require('./member-signin-urls.js'), localUtils);
|
|
102
102
|
},
|
|
103
103
|
|
|
104
104
|
get labels() {
|
|
@@ -158,7 +158,7 @@ module.exports = {
|
|
|
158
158
|
},
|
|
159
159
|
|
|
160
160
|
get emails() {
|
|
161
|
-
return shared.pipeline(require('./
|
|
161
|
+
return shared.pipeline(require('./emails'), localUtils);
|
|
162
162
|
},
|
|
163
163
|
|
|
164
164
|
get site() {
|
|
@@ -169,6 +169,10 @@ module.exports = {
|
|
|
169
169
|
return shared.pipeline(require('./snippets'), localUtils);
|
|
170
170
|
},
|
|
171
171
|
|
|
172
|
+
get stats() {
|
|
173
|
+
return shared.pipeline(require('./stats'), localUtils);
|
|
174
|
+
},
|
|
175
|
+
|
|
172
176
|
get customThemeSettings() {
|
|
173
177
|
return shared.pipeline(require('./custom-theme-settings'), localUtils);
|
|
174
178
|
},
|
|
@@ -177,6 +181,10 @@ module.exports = {
|
|
|
177
181
|
return require('./utils/serializers');
|
|
178
182
|
},
|
|
179
183
|
|
|
184
|
+
get newsletters() {
|
|
185
|
+
return shared.pipeline(require('./newsletters'), localUtils);
|
|
186
|
+
},
|
|
187
|
+
|
|
180
188
|
/**
|
|
181
189
|
* Content API Controllers
|
|
182
190
|
*
|
|
File without changes
|
|
@@ -452,51 +452,6 @@ module.exports = {
|
|
|
452
452
|
};
|
|
453
453
|
}
|
|
454
454
|
},
|
|
455
|
-
subscriberStats: {
|
|
456
|
-
permissions: {
|
|
457
|
-
method: 'browse'
|
|
458
|
-
},
|
|
459
|
-
async query() {
|
|
460
|
-
const statsData = await membersService.api.events.getSubscriptions();
|
|
461
|
-
const totalSubscriptions = (_.last(statsData) && _.last(statsData).subscribed) || 0;
|
|
462
|
-
statsData.forEach((d) => {
|
|
463
|
-
d.date = moment(d.date).format('YYYY-MM-DD');
|
|
464
|
-
});
|
|
465
|
-
return {
|
|
466
|
-
resource: 'subscribers',
|
|
467
|
-
total: totalSubscriptions,
|
|
468
|
-
data: statsData.map((d) => {
|
|
469
|
-
return Object.assign({}, {
|
|
470
|
-
date: moment(d.date).format('YYYY-MM-DD'),
|
|
471
|
-
value: d.subscribed
|
|
472
|
-
});
|
|
473
|
-
})
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
grossVolumeStats: {
|
|
478
|
-
permissions: {
|
|
479
|
-
method: 'browse'
|
|
480
|
-
},
|
|
481
|
-
async query() {
|
|
482
|
-
const volumeData = await membersService.api.events.getVolume();
|
|
483
|
-
const volumeStats = Object.keys(volumeData).map((curr) => {
|
|
484
|
-
return {
|
|
485
|
-
currency: curr,
|
|
486
|
-
data: volumeData[curr].map((d) => {
|
|
487
|
-
return Object.assign({}, {
|
|
488
|
-
date: moment(d.date).format('YYYY-MM-DD'),
|
|
489
|
-
value: d.volume
|
|
490
|
-
});
|
|
491
|
-
})
|
|
492
|
-
};
|
|
493
|
-
});
|
|
494
|
-
return {
|
|
495
|
-
resource: 'gross-volume',
|
|
496
|
-
data: volumeStats
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
455
|
|
|
501
456
|
activityFeed: {
|
|
502
457
|
options: [
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const models = require('../../models');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
docName: 'newsletters',
|
|
5
|
+
|
|
6
|
+
browse: {
|
|
7
|
+
options: [
|
|
8
|
+
'filter',
|
|
9
|
+
'fields',
|
|
10
|
+
'limit',
|
|
11
|
+
'order',
|
|
12
|
+
'page'
|
|
13
|
+
],
|
|
14
|
+
permissions: true,
|
|
15
|
+
query(frame) {
|
|
16
|
+
return models.Newsletter.findPage(frame.options);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
add: {
|
|
21
|
+
statusCode: 201,
|
|
22
|
+
permissions: true,
|
|
23
|
+
async query(frame) {
|
|
24
|
+
return models.Newsletter.add(frame.data.newsletters[0], frame.options);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
edit: {
|
|
29
|
+
headers: {},
|
|
30
|
+
options: [
|
|
31
|
+
'id'
|
|
32
|
+
],
|
|
33
|
+
validation: {
|
|
34
|
+
options: {
|
|
35
|
+
id: {
|
|
36
|
+
required: true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
permissions: true,
|
|
41
|
+
async query(frame) {
|
|
42
|
+
return models.Newsletter.edit(frame.data.newsletters[0], frame.options);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const statsService = require('../../services/stats');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
docName: 'stats',
|
|
5
|
+
memberCountHistory: {
|
|
6
|
+
permissions: {
|
|
7
|
+
docName: 'members',
|
|
8
|
+
method: 'browse'
|
|
9
|
+
},
|
|
10
|
+
async query() {
|
|
11
|
+
return await statsService.members.getCountHistory();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const debug = require('@tryghost/debug')('api:canary:utils:serializers:output:default');
|
|
2
|
+
const mappers = require('./mappers');
|
|
3
|
+
|
|
4
|
+
const mapResponse = (docName, mappable, frame) => {
|
|
5
|
+
if (mappers[docName]) {
|
|
6
|
+
return mappers[docName](mappable, frame);
|
|
7
|
+
} else if (mappable.toJSON) {
|
|
8
|
+
return mappable.toJSON(frame.options);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return mappable;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
all(response, apiConfig, frame) {
|
|
16
|
+
const {docName, method} = apiConfig;
|
|
17
|
+
debug('serializing', docName, method);
|
|
18
|
+
|
|
19
|
+
if (!response) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
frame.response = {};
|
|
24
|
+
|
|
25
|
+
if (response.data) {
|
|
26
|
+
frame.response[docName] = response.data.map(model => mapResponse(docName, model, frame));
|
|
27
|
+
} else {
|
|
28
|
+
frame.response[docName] = [mapResponse(docName, response, frame)];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (response.meta) {
|
|
32
|
+
frame.response.meta = response.meta;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -9,6 +9,10 @@ module.exports = {
|
|
|
9
9
|
return require('./all');
|
|
10
10
|
},
|
|
11
11
|
|
|
12
|
+
get default() {
|
|
13
|
+
return require('./default');
|
|
14
|
+
},
|
|
15
|
+
|
|
12
16
|
get authentication() {
|
|
13
17
|
return require('./authentication');
|
|
14
18
|
},
|
|
@@ -17,10 +21,6 @@ module.exports = {
|
|
|
17
21
|
return require('./db');
|
|
18
22
|
},
|
|
19
23
|
|
|
20
|
-
get integrations() {
|
|
21
|
-
return require('./integrations');
|
|
22
|
-
},
|
|
23
|
-
|
|
24
24
|
get pages() {
|
|
25
25
|
return require('./pages');
|
|
26
26
|
},
|
|
@@ -41,18 +41,10 @@ module.exports = {
|
|
|
41
41
|
return require('./schedules');
|
|
42
42
|
},
|
|
43
43
|
|
|
44
|
-
get webhooks() {
|
|
45
|
-
return require('./webhooks');
|
|
46
|
-
},
|
|
47
|
-
|
|
48
44
|
get posts() {
|
|
49
45
|
return require('./posts');
|
|
50
46
|
},
|
|
51
47
|
|
|
52
|
-
get invites() {
|
|
53
|
-
return require('./invites');
|
|
54
|
-
},
|
|
55
|
-
|
|
56
48
|
get settings() {
|
|
57
49
|
return require('./settings');
|
|
58
50
|
},
|
|
@@ -77,14 +69,6 @@ module.exports = {
|
|
|
77
69
|
return require('./tiers');
|
|
78
70
|
},
|
|
79
71
|
|
|
80
|
-
get member_signin_urls() {
|
|
81
|
-
return require('./member-signin_urls');
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
get identities() {
|
|
85
|
-
return require('./identities');
|
|
86
|
-
},
|
|
87
|
-
|
|
88
72
|
get images() {
|
|
89
73
|
return require('./images');
|
|
90
74
|
},
|
|
@@ -97,10 +81,6 @@ module.exports = {
|
|
|
97
81
|
return require('./files');
|
|
98
82
|
},
|
|
99
83
|
|
|
100
|
-
get tags() {
|
|
101
|
-
return require('./tags');
|
|
102
|
-
},
|
|
103
|
-
|
|
104
84
|
get users() {
|
|
105
85
|
return require('./users');
|
|
106
86
|
},
|
|
@@ -117,10 +97,6 @@ module.exports = {
|
|
|
117
97
|
return require('./oembed');
|
|
118
98
|
},
|
|
119
99
|
|
|
120
|
-
get authors() {
|
|
121
|
-
return require('./authors');
|
|
122
|
-
},
|
|
123
|
-
|
|
124
100
|
get config() {
|
|
125
101
|
return require('./config');
|
|
126
102
|
},
|
|
@@ -129,31 +105,31 @@ module.exports = {
|
|
|
129
105
|
return require('./themes');
|
|
130
106
|
},
|
|
131
107
|
|
|
132
|
-
get actions() {
|
|
133
|
-
return require('./actions');
|
|
134
|
-
},
|
|
135
|
-
|
|
136
108
|
get site() {
|
|
137
109
|
return require('./site');
|
|
138
110
|
},
|
|
139
111
|
|
|
140
|
-
get
|
|
141
|
-
return require('./email-
|
|
112
|
+
get email_previews() {
|
|
113
|
+
return require('./email-previews');
|
|
142
114
|
},
|
|
143
115
|
|
|
144
|
-
get
|
|
145
|
-
return require('./
|
|
116
|
+
get custom_theme_settings() {
|
|
117
|
+
return require('./custom-theme-settings');
|
|
146
118
|
},
|
|
147
119
|
|
|
148
|
-
get
|
|
149
|
-
return require('./
|
|
120
|
+
get slack() {
|
|
121
|
+
return require('./slack');
|
|
150
122
|
},
|
|
151
123
|
|
|
152
|
-
get
|
|
153
|
-
return require('./
|
|
124
|
+
get session() {
|
|
125
|
+
return require('./session');
|
|
154
126
|
},
|
|
155
127
|
|
|
156
|
-
get
|
|
157
|
-
return require('./
|
|
128
|
+
get offers() {
|
|
129
|
+
return require('./offers');
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
get members_stripe_connect() {
|
|
133
|
+
return require('./members-stripe-connect');
|
|
158
134
|
}
|
|
159
135
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./users');
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
actions: require('./actions'),
|
|
3
|
+
authors: require('./authors'),
|
|
3
4
|
emails: require('./emails'),
|
|
4
5
|
images: require('./images'),
|
|
5
6
|
integrations: require('./integrations'),
|
|
6
|
-
labels: require('./labels'),
|
|
7
7
|
pages: require('./pages'),
|
|
8
8
|
posts: require('./posts'),
|
|
9
9
|
settings: require('./settings'),
|
|
10
|
+
snippets: require('./snippets'),
|
|
10
11
|
tags: require('./tags'),
|
|
11
12
|
users: require('./users')
|
|
12
13
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('bookshelf').Model} snippet
|
|
3
|
+
* @param {Frame} frame
|
|
4
|
+
*
|
|
5
|
+
* @returns {SerializedSnippet}
|
|
6
|
+
*/
|
|
7
|
+
module.exports = (snippet, frame) => {
|
|
8
|
+
const json = snippet.toJSON(frame.options);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
id: json.id,
|
|
12
|
+
name: json.name,
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
mobiledoc: json.mobiledoc,
|
|
15
|
+
created_at: json.created_at,
|
|
16
|
+
updated_at: json.updated_at,
|
|
17
|
+
created_by: json.created_by,
|
|
18
|
+
updated_by: json.updated_by
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {Object} SerializedSnippet
|
|
24
|
+
* @prop {string} id
|
|
25
|
+
* @prop {string=} name
|
|
26
|
+
* @prop {string=} mobiledoc
|
|
27
|
+
* @prop {string} created_at
|
|
28
|
+
* @prop {string} updated_at
|
|
29
|
+
* @prop {string} created_by
|
|
30
|
+
* @prop {string} updated_by
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {Object<string, any>} Frame
|
|
35
|
+
* @prop {Object} options
|
|
36
|
+
*/
|