ghost 5.50.3 → 5.51.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.
Files changed (192) hide show
  1. package/components/tryghost-adapter-cache-memory-ttl-5.51.0.tgz +0 -0
  2. package/components/{tryghost-adapter-cache-redis-5.50.3.tgz → tryghost-adapter-cache-redis-5.51.0.tgz} +0 -0
  3. package/components/{tryghost-adapter-manager-5.50.3.tgz → tryghost-adapter-manager-5.51.0.tgz} +0 -0
  4. package/components/tryghost-announcement-bar-settings-5.51.0.tgz +0 -0
  5. package/components/{tryghost-api-framework-5.50.3.tgz → tryghost-api-framework-5.51.0.tgz} +0 -0
  6. package/components/{tryghost-api-version-compatibility-service-5.50.3.tgz → tryghost-api-version-compatibility-service-5.51.0.tgz} +0 -0
  7. package/components/tryghost-audience-feedback-5.51.0.tgz +0 -0
  8. package/components/tryghost-bootstrap-socket-5.51.0.tgz +0 -0
  9. package/components/tryghost-collections-5.51.0.tgz +0 -0
  10. package/components/tryghost-constants-5.51.0.tgz +0 -0
  11. package/components/tryghost-custom-theme-settings-service-5.51.0.tgz +0 -0
  12. package/components/{tryghost-data-generator-5.50.3.tgz → tryghost-data-generator-5.51.0.tgz} +0 -0
  13. package/components/tryghost-domain-events-5.51.0.tgz +0 -0
  14. package/components/tryghost-dynamic-routing-events-5.51.0.tgz +0 -0
  15. package/components/tryghost-email-analytics-provider-mailgun-5.51.0.tgz +0 -0
  16. package/components/{tryghost-email-analytics-service-5.50.3.tgz → tryghost-email-analytics-service-5.51.0.tgz} +0 -0
  17. package/components/tryghost-email-content-generator-5.51.0.tgz +0 -0
  18. package/components/{tryghost-email-events-5.50.3.tgz → tryghost-email-events-5.51.0.tgz} +0 -0
  19. package/components/tryghost-email-service-5.51.0.tgz +0 -0
  20. package/components/tryghost-email-suppression-list-5.51.0.tgz +0 -0
  21. package/components/tryghost-event-aware-cache-wrapper-5.51.0.tgz +0 -0
  22. package/components/{tryghost-express-dynamic-redirects-5.50.3.tgz → tryghost-express-dynamic-redirects-5.51.0.tgz} +0 -0
  23. package/components/{tryghost-external-media-inliner-5.50.3.tgz → tryghost-external-media-inliner-5.51.0.tgz} +0 -0
  24. package/components/{tryghost-extract-api-key-5.50.3.tgz → tryghost-extract-api-key-5.51.0.tgz} +0 -0
  25. package/components/tryghost-html-to-plaintext-5.51.0.tgz +0 -0
  26. package/components/tryghost-i18n-5.51.0.tgz +0 -0
  27. package/components/{tryghost-importer-handler-content-files-5.50.3.tgz → tryghost-importer-handler-content-files-5.51.0.tgz} +0 -0
  28. package/components/tryghost-importer-revue-5.51.0.tgz +0 -0
  29. package/components/tryghost-in-memory-repository-5.51.0.tgz +0 -0
  30. package/components/{tryghost-job-manager-5.50.3.tgz → tryghost-job-manager-5.51.0.tgz} +0 -0
  31. package/components/{tryghost-link-redirects-5.50.3.tgz → tryghost-link-redirects-5.51.0.tgz} +0 -0
  32. package/components/tryghost-link-replacer-5.51.0.tgz +0 -0
  33. package/components/{tryghost-link-tracking-5.50.3.tgz → tryghost-link-tracking-5.51.0.tgz} +0 -0
  34. package/components/{tryghost-magic-link-5.50.3.tgz → tryghost-magic-link-5.51.0.tgz} +0 -0
  35. package/components/{tryghost-mailgun-client-5.50.3.tgz → tryghost-mailgun-client-5.51.0.tgz} +0 -0
  36. package/components/{tryghost-member-attribution-5.50.3.tgz → tryghost-member-attribution-5.51.0.tgz} +0 -0
  37. package/components/{tryghost-member-events-5.50.3.tgz → tryghost-member-events-5.51.0.tgz} +0 -0
  38. package/components/{tryghost-members-api-5.50.3.tgz → tryghost-members-api-5.51.0.tgz} +0 -0
  39. package/components/{tryghost-members-csv-5.50.3.tgz → tryghost-members-csv-5.51.0.tgz} +0 -0
  40. package/components/tryghost-members-events-service-5.51.0.tgz +0 -0
  41. package/components/tryghost-members-importer-5.51.0.tgz +0 -0
  42. package/components/{tryghost-members-offers-5.50.3.tgz → tryghost-members-offers-5.51.0.tgz} +0 -0
  43. package/components/{tryghost-members-payments-5.50.3.tgz → tryghost-members-payments-5.51.0.tgz} +0 -0
  44. package/components/tryghost-members-ssr-5.51.0.tgz +0 -0
  45. package/components/tryghost-members-stripe-service-5.51.0.tgz +0 -0
  46. package/components/{tryghost-mentions-email-report-5.50.3.tgz → tryghost-mentions-email-report-5.51.0.tgz} +0 -0
  47. package/components/{tryghost-milestones-5.50.3.tgz → tryghost-milestones-5.51.0.tgz} +0 -0
  48. package/components/{tryghost-minifier-5.50.3.tgz → tryghost-minifier-5.51.0.tgz} +0 -0
  49. package/components/tryghost-mw-api-version-mismatch-5.51.0.tgz +0 -0
  50. package/components/{tryghost-mw-cache-control-5.50.3.tgz → tryghost-mw-cache-control-5.51.0.tgz} +0 -0
  51. package/components/tryghost-mw-error-handler-5.51.0.tgz +0 -0
  52. package/components/tryghost-mw-session-from-token-5.51.0.tgz +0 -0
  53. package/components/tryghost-mw-update-user-last-seen-5.51.0.tgz +0 -0
  54. package/components/{tryghost-mw-version-match-5.50.3.tgz → tryghost-mw-version-match-5.51.0.tgz} +0 -0
  55. package/components/tryghost-mw-vhost-5.51.0.tgz +0 -0
  56. package/components/{tryghost-oembed-service-5.50.3.tgz → tryghost-oembed-service-5.51.0.tgz} +0 -0
  57. package/components/{tryghost-package-json-5.50.3.tgz → tryghost-package-json-5.51.0.tgz} +0 -0
  58. package/components/tryghost-post-revisions-5.51.0.tgz +0 -0
  59. package/components/tryghost-posts-service-5.51.0.tgz +0 -0
  60. package/components/{tryghost-referrers-5.50.3.tgz → tryghost-referrers-5.51.0.tgz} +0 -0
  61. package/components/{tryghost-security-5.50.3.tgz → tryghost-security-5.51.0.tgz} +0 -0
  62. package/components/tryghost-session-service-5.51.0.tgz +0 -0
  63. package/components/tryghost-settings-path-manager-5.51.0.tgz +0 -0
  64. package/components/{tryghost-slack-notifications-5.50.3.tgz → tryghost-slack-notifications-5.51.0.tgz} +0 -0
  65. package/components/{tryghost-staff-service-5.50.3.tgz → tryghost-staff-service-5.51.0.tgz} +0 -0
  66. package/components/{tryghost-stats-service-5.50.3.tgz → tryghost-stats-service-5.51.0.tgz} +0 -0
  67. package/components/{tryghost-tiers-5.50.3.tgz → tryghost-tiers-5.51.0.tgz} +0 -0
  68. package/components/{tryghost-update-check-service-5.50.3.tgz → tryghost-update-check-service-5.51.0.tgz} +0 -0
  69. package/components/tryghost-verification-trigger-5.51.0.tgz +0 -0
  70. package/components/tryghost-version-notifications-data-service-5.51.0.tgz +0 -0
  71. package/components/{tryghost-webmentions-5.50.3.tgz → tryghost-webmentions-5.51.0.tgz} +0 -0
  72. package/core/boot.js +2 -0
  73. package/core/built/admin/assets/{chunk.143.4e9bfd70a2b07a1514b1.js → chunk.143.8807e7591c4589efad15.js} +5 -5
  74. package/core/built/admin/assets/{chunk.178.98f6d1db548183bddeca.js → chunk.178.5357f76a74bcd455226a.js} +4 -4
  75. package/core/built/admin/assets/{chunk.976.c9abe301de6422af2ab2.js → chunk.976.c3f393d6685c89bbaaca.js} +3 -3
  76. package/core/built/admin/assets/{ghost-f816730cbd6958a4ab1891ddeab0e65f.js → ghost-22c9d9cef7aa0ff08294f8ea69c344dd.js} +3696 -3690
  77. package/core/built/admin/assets/ghost-dark-2ec2e32362fa867723379a286fd0f0bd.css +1 -0
  78. package/core/built/admin/assets/ghost-e6482a0a19b228a9b9e71a9c5ea134ba.css +1 -0
  79. package/core/built/admin/index.html +5 -5
  80. package/core/frontend/src/cards/css/signup.css +1 -1
  81. package/core/server/api/endpoints/actions.js +3 -0
  82. package/core/server/api/endpoints/announcements.js +3 -0
  83. package/core/server/api/endpoints/authentication.js +18 -0
  84. package/core/server/api/endpoints/authors-public.js +6 -0
  85. package/core/server/api/endpoints/collections.js +31 -25
  86. package/core/server/api/endpoints/comments-members.js +30 -1
  87. package/core/server/api/endpoints/comments.js +3 -0
  88. package/core/server/api/endpoints/config.js +3 -0
  89. package/core/server/api/endpoints/custom-theme-settings.js +3 -0
  90. package/core/server/api/endpoints/db.js +8 -1
  91. package/core/server/api/endpoints/email-post.js +3 -0
  92. package/core/server/api/endpoints/email-previews.js +6 -1
  93. package/core/server/api/endpoints/emails.js +24 -0
  94. package/core/server/api/endpoints/explore.js +3 -0
  95. package/core/server/api/endpoints/feedback-members.js +3 -0
  96. package/core/server/api/endpoints/files.js +3 -0
  97. package/core/server/api/endpoints/identities.js +3 -0
  98. package/core/server/api/endpoints/images.js +3 -0
  99. package/core/server/api/endpoints/integrations.js +15 -0
  100. package/core/server/api/endpoints/invites.js +12 -0
  101. package/core/server/api/endpoints/labels.js +12 -2
  102. package/core/server/api/endpoints/links.js +3 -0
  103. package/core/server/api/endpoints/mail.js +3 -0
  104. package/core/server/api/endpoints/media.js +6 -0
  105. package/core/server/api/endpoints/member-signin-urls.js +3 -0
  106. package/core/server/api/endpoints/members-stripe-connect.js +3 -0
  107. package/core/server/api/endpoints/members.js +41 -9
  108. package/core/server/api/endpoints/mentions.js +6 -1
  109. package/core/server/api/endpoints/newsletters-public.js +3 -0
  110. package/core/server/api/endpoints/newsletters.js +9 -0
  111. package/core/server/api/endpoints/notifications.js +12 -0
  112. package/core/server/api/endpoints/oembed.js +3 -0
  113. package/core/server/api/endpoints/offers-public.js +3 -0
  114. package/core/server/api/endpoints/offers.js +6 -0
  115. package/core/server/api/endpoints/pages-public.js +6 -0
  116. package/core/server/api/endpoints/pages.js +15 -6
  117. package/core/server/api/endpoints/posts-public.js +6 -0
  118. package/core/server/api/endpoints/posts.js +17 -20
  119. package/core/server/api/endpoints/previews.js +3 -0
  120. package/core/server/api/endpoints/redirects.js +2 -1
  121. package/core/server/api/endpoints/roles.js +3 -0
  122. package/core/server/api/endpoints/schedules.js +6 -1
  123. package/core/server/api/endpoints/settings-public.js +3 -0
  124. package/core/server/api/endpoints/settings.js +11 -1
  125. package/core/server/api/endpoints/site.js +3 -0
  126. package/core/server/api/endpoints/slack.js +3 -0
  127. package/core/server/api/endpoints/snippets.js +15 -4
  128. package/core/server/api/endpoints/stats.js +15 -0
  129. package/core/server/api/endpoints/tags-public.js +6 -0
  130. package/core/server/api/endpoints/tags.js +9 -1
  131. package/core/server/api/endpoints/themes.js +15 -2
  132. package/core/server/api/endpoints/tiers-public.js +3 -0
  133. package/core/server/api/endpoints/tiers.js +6 -0
  134. package/core/server/api/endpoints/users.js +21 -1
  135. package/core/server/api/endpoints/utils/serializers/output/mappers/posts.js +13 -1
  136. package/core/server/api/endpoints/utils/serializers/output/settings.js +1 -1
  137. package/core/server/api/endpoints/webhooks.js +8 -2
  138. package/core/server/data/migrations/versions/5.51/2023-05-30-19-03-update-pintura-setting.js +19 -0
  139. package/core/server/data/migrations/versions/5.51/2023-06-07-10-17-add-collections-crud-persmissions.js +54 -0
  140. package/core/server/data/schema/default-settings/default-settings.json +1 -1
  141. package/core/server/data/schema/fixtures/FixtureManager.js +1 -0
  142. package/core/server/data/schema/fixtures/fixtures.json +35 -5
  143. package/core/server/services/collections/built-in-collections.js +8 -0
  144. package/core/server/services/collections/index.js +34 -10
  145. package/core/server/services/collections/update-events.js +15 -0
  146. package/core/server/services/posts/posts-service.js +3 -1
  147. package/core/server/services/segment/DomainEventsAnalytics.js +83 -0
  148. package/core/server/services/segment/ModelEventsAnalytics.js +108 -0
  149. package/core/server/services/segment/index.js +26 -38
  150. package/core/server/web/api/endpoints/admin/middleware.js +4 -0
  151. package/core/shared/config/defaults.json +1 -1
  152. package/core/shared/config/overrides.json +1 -0
  153. package/core/shared/labs.js +3 -3
  154. package/package.json +137 -137
  155. package/yarn.lock +44 -34
  156. package/components/tryghost-adapter-cache-memory-ttl-5.50.3.tgz +0 -0
  157. package/components/tryghost-announcement-bar-settings-5.50.3.tgz +0 -0
  158. package/components/tryghost-audience-feedback-5.50.3.tgz +0 -0
  159. package/components/tryghost-bootstrap-socket-5.50.3.tgz +0 -0
  160. package/components/tryghost-collections-5.50.3.tgz +0 -0
  161. package/components/tryghost-constants-5.50.3.tgz +0 -0
  162. package/components/tryghost-custom-theme-settings-service-5.50.3.tgz +0 -0
  163. package/components/tryghost-domain-events-5.50.3.tgz +0 -0
  164. package/components/tryghost-dynamic-routing-events-5.50.3.tgz +0 -0
  165. package/components/tryghost-email-analytics-provider-mailgun-5.50.3.tgz +0 -0
  166. package/components/tryghost-email-content-generator-5.50.3.tgz +0 -0
  167. package/components/tryghost-email-service-5.50.3.tgz +0 -0
  168. package/components/tryghost-email-suppression-list-5.50.3.tgz +0 -0
  169. package/components/tryghost-event-aware-cache-wrapper-5.50.3.tgz +0 -0
  170. package/components/tryghost-html-to-plaintext-5.50.3.tgz +0 -0
  171. package/components/tryghost-i18n-5.50.3.tgz +0 -0
  172. package/components/tryghost-importer-revue-5.50.3.tgz +0 -0
  173. package/components/tryghost-in-memory-repository-5.50.3.tgz +0 -0
  174. package/components/tryghost-link-replacer-5.50.3.tgz +0 -0
  175. package/components/tryghost-members-events-service-5.50.3.tgz +0 -0
  176. package/components/tryghost-members-importer-5.50.3.tgz +0 -0
  177. package/components/tryghost-members-ssr-5.50.3.tgz +0 -0
  178. package/components/tryghost-members-stripe-service-5.50.3.tgz +0 -0
  179. package/components/tryghost-mw-api-version-mismatch-5.50.3.tgz +0 -0
  180. package/components/tryghost-mw-error-handler-5.50.3.tgz +0 -0
  181. package/components/tryghost-mw-session-from-token-5.50.3.tgz +0 -0
  182. package/components/tryghost-mw-update-user-last-seen-5.50.3.tgz +0 -0
  183. package/components/tryghost-mw-vhost-5.50.3.tgz +0 -0
  184. package/components/tryghost-post-revisions-5.50.3.tgz +0 -0
  185. package/components/tryghost-posts-service-5.50.3.tgz +0 -0
  186. package/components/tryghost-session-service-5.50.3.tgz +0 -0
  187. package/components/tryghost-settings-path-manager-5.50.3.tgz +0 -0
  188. package/components/tryghost-verification-trigger-5.50.3.tgz +0 -0
  189. package/components/tryghost-version-notifications-data-service-5.50.3.tgz +0 -0
  190. package/core/built/admin/assets/ghost-01b4eb0cff8ee8478af9d4074a256756.css +0 -1
  191. package/core/built/admin/assets/ghost-dark-8dd7d236d17be6dbef26039409d0c34d.css +0 -1
  192. /package/core/built/admin/assets/{chunk.976.c9abe301de6422af2ab2.js.LICENSE.txt → chunk.976.c3f393d6685c89bbaaca.js.LICENSE.txt} +0 -0
@@ -4,6 +4,9 @@ const site = {
4
4
  docName: 'site',
5
5
 
6
6
  read: {
7
+ headers: {
8
+ cacheInvalidate: false
9
+ },
7
10
  permissions: false,
8
11
  query() {
9
12
  return publicConfig.site;
@@ -4,6 +4,9 @@ const events = require('../../lib/common/events');
4
4
  module.exports = {
5
5
  docName: 'slack',
6
6
  sendTest: {
7
+ headers: {
8
+ cacheInvalidate: false
9
+ },
7
10
  permissions: false,
8
11
  query() {
9
12
  events.emit('slack.test');
@@ -12,6 +12,9 @@ module.exports = {
12
12
  docName: 'snippets',
13
13
 
14
14
  browse: {
15
+ headers: {
16
+ cacheInvalidate: false
17
+ },
15
18
  options: [
16
19
  'limit',
17
20
  'order',
@@ -33,7 +36,9 @@ module.exports = {
33
36
  },
34
37
 
35
38
  read: {
36
- headers: {},
39
+ headers: {
40
+ cacheInvalidate: false
41
+ },
37
42
  options: [
38
43
  'formats'
39
44
  ],
@@ -57,7 +62,9 @@ module.exports = {
57
62
 
58
63
  add: {
59
64
  statusCode: 201,
60
- headers: {},
65
+ headers: {
66
+ cacheInvalidate: false
67
+ },
61
68
  options: [
62
69
  'formats'
63
70
  ],
@@ -75,7 +82,9 @@ module.exports = {
75
82
  },
76
83
 
77
84
  edit: {
78
- headers: {},
85
+ headers: {
86
+ cacheInvalidate: false
87
+ },
79
88
  options: [
80
89
  'id',
81
90
  'formats'
@@ -104,7 +113,9 @@ module.exports = {
104
113
 
105
114
  destroy: {
106
115
  statusCode: 204,
107
- headers: {},
116
+ headers: {
117
+ cacheInvalidate: false
118
+ },
108
119
  options: [
109
120
  'id'
110
121
  ],
@@ -3,6 +3,9 @@ const statsService = require('../../services/stats');
3
3
  module.exports = {
4
4
  docName: 'stats',
5
5
  memberCountHistory: {
6
+ headers: {
7
+ cacheInvalidate: false
8
+ },
6
9
  permissions: {
7
10
  docName: 'members',
8
11
  method: 'browse'
@@ -12,6 +15,9 @@ module.exports = {
12
15
  }
13
16
  },
14
17
  mrr: {
18
+ headers: {
19
+ cacheInvalidate: false
20
+ },
15
21
  permissions: {
16
22
  docName: 'members',
17
23
  method: 'browse'
@@ -21,6 +27,9 @@ module.exports = {
21
27
  }
22
28
  },
23
29
  subscriptions: {
30
+ headers: {
31
+ cacheInvalidate: false
32
+ },
24
33
  permissions: {
25
34
  docName: 'members',
26
35
  method: 'browse'
@@ -30,6 +39,9 @@ module.exports = {
30
39
  }
31
40
  },
32
41
  postReferrers: {
42
+ headers: {
43
+ cacheInvalidate: false
44
+ },
33
45
  data: [
34
46
  'id'
35
47
  ],
@@ -42,6 +54,9 @@ module.exports = {
42
54
  }
43
55
  },
44
56
  referrersHistory: {
57
+ headers: {
58
+ cacheInvalidate: false
59
+ },
45
60
  data: [
46
61
  'id'
47
62
  ],
@@ -14,6 +14,9 @@ module.exports = {
14
14
  docName: 'tags',
15
15
 
16
16
  browse: {
17
+ headers: {
18
+ cacheInvalidate: false
19
+ },
17
20
  cache: tagsPublicService.api?.cache,
18
21
  options: [
19
22
  'include',
@@ -38,6 +41,9 @@ module.exports = {
38
41
  },
39
42
 
40
43
  read: {
44
+ headers: {
45
+ cacheInvalidate: false
46
+ },
41
47
  options: [
42
48
  'include',
43
49
  'filter',
@@ -13,6 +13,9 @@ module.exports = {
13
13
  docName: 'tags',
14
14
 
15
15
  browse: {
16
+ headers: {
17
+ cacheInvalidate: false
18
+ },
16
19
  options: [
17
20
  'include',
18
21
  'filter',
@@ -36,6 +39,9 @@ module.exports = {
36
39
  },
37
40
 
38
41
  read: {
42
+ headers: {
43
+ cacheInvalidate: false
44
+ },
39
45
  options: [
40
46
  'include',
41
47
  'filter',
@@ -91,7 +97,9 @@ module.exports = {
91
97
  },
92
98
 
93
99
  edit: {
94
- headers: {},
100
+ headers: {
101
+ cacheInvalidate: false
102
+ },
95
103
  options: [
96
104
  'id',
97
105
  'include'
@@ -10,6 +10,9 @@ module.exports = {
10
10
  docName: 'themes',
11
11
 
12
12
  browse: {
13
+ headers: {
14
+ cacheInvalidate: false
15
+ },
13
16
  permissions: true,
14
17
  query() {
15
18
  return themeService.api.getJSON();
@@ -17,6 +20,9 @@ module.exports = {
17
20
  },
18
21
 
19
22
  readActive: {
23
+ headers: {
24
+ cacheInvalidate: false
25
+ },
20
26
  permissions: true,
21
27
  async query() {
22
28
  let themeName = settingsCache.get('active_theme');
@@ -59,7 +65,9 @@ module.exports = {
59
65
  },
60
66
 
61
67
  install: {
62
- headers: {},
68
+ headers: {
69
+ cacheInvalidate: false
70
+ },
63
71
  options: [
64
72
  'source',
65
73
  'ref'
@@ -94,7 +102,9 @@ module.exports = {
94
102
  },
95
103
 
96
104
  upload: {
97
- headers: {},
105
+ headers: {
106
+ cacheInvalidate: false
107
+ },
98
108
  permissions: {
99
109
  method: 'add'
100
110
  },
@@ -125,6 +135,9 @@ module.exports = {
125
135
  },
126
136
 
127
137
  download: {
138
+ headers: {
139
+ cacheInvalidate: false
140
+ },
128
141
  options: [
129
142
  'name'
130
143
  ],
@@ -4,6 +4,9 @@ module.exports = {
4
4
  docName: 'tiers',
5
5
 
6
6
  browse: {
7
+ headers: {
8
+ cacheInvalidate: false
9
+ },
7
10
  options: [
8
11
  'limit',
9
12
  'fields',
@@ -4,6 +4,9 @@ module.exports = {
4
4
  docName: 'tiers',
5
5
 
6
6
  browse: {
7
+ headers: {
8
+ cacheInvalidate: false
9
+ },
7
10
  options: [
8
11
  'limit',
9
12
  'fields',
@@ -22,6 +25,9 @@ module.exports = {
22
25
  },
23
26
 
24
27
  read: {
28
+ headers: {
29
+ cacheInvalidate: false
30
+ },
25
31
  data: [
26
32
  'id'
27
33
  ],
@@ -45,6 +45,9 @@ module.exports = {
45
45
  docName: 'users',
46
46
 
47
47
  browse: {
48
+ headers: {
49
+ cacheInvalidate: false
50
+ },
48
51
  options: [
49
52
  'include',
50
53
  'filter',
@@ -68,6 +71,9 @@ module.exports = {
68
71
  },
69
72
 
70
73
  read: {
74
+ headers: {
75
+ cacheInvalidate: false
76
+ },
71
77
  options: [
72
78
  'include',
73
79
  'filter',
@@ -103,7 +109,9 @@ module.exports = {
103
109
  },
104
110
 
105
111
  edit: {
106
- headers: {},
112
+ headers: {
113
+ cacheInvalidate: false
114
+ },
107
115
  options: [
108
116
  'id',
109
117
  'include'
@@ -166,6 +174,9 @@ module.exports = {
166
174
  },
167
175
 
168
176
  changePassword: {
177
+ headers: {
178
+ cacheInvalidate: false
179
+ },
169
180
  validation: {
170
181
  docName: 'password',
171
182
  data: {
@@ -188,6 +199,9 @@ module.exports = {
188
199
  },
189
200
 
190
201
  transferOwnership: {
202
+ headers: {
203
+ cacheInvalidate: false
204
+ },
191
205
  permissions(frame) {
192
206
  return models.Role.findOne({name: 'Owner'})
193
207
  .then((ownerRole) => {
@@ -200,6 +214,9 @@ module.exports = {
200
214
  },
201
215
 
202
216
  readToken: {
217
+ headers: {
218
+ cacheInvalidate: false
219
+ },
203
220
  options: [
204
221
  'id'
205
222
  ],
@@ -218,6 +235,9 @@ module.exports = {
218
235
  },
219
236
 
220
237
  regenerateToken: {
238
+ headers: {
239
+ cacheInvalidate: false
240
+ },
221
241
  options: [
222
242
  'id'
223
243
  ],
@@ -24,7 +24,19 @@ const labs = require('../../../../../../../shared/labs');
24
24
  module.exports = async (model, frame, options = {}) => {
25
25
  const {tiers: tiersData} = options || {};
26
26
 
27
- const jsonModel = model.toJSON(frame.options);
27
+ // NOTE: `model` is now overloaded and may be a bookshelf model or a POJO
28
+ let jsonModel = model;
29
+ if (typeof model.toJSON === 'function') {
30
+ jsonModel = model.toJSON(frame.options);
31
+ } else {
32
+ // This is to satisy the interface which extraAttrs needs
33
+ model = {
34
+ id: jsonModel.id,
35
+ get(attr) {
36
+ return jsonModel[attr];
37
+ }
38
+ };
39
+ }
28
40
 
29
41
  // Map email_recipient_filter to email_segment
30
42
  jsonModel.email_segment = jsonModel.email_recipient_filter;
@@ -33,7 +33,7 @@ function serializeSettings(models, apiConfig, frame) {
33
33
  // If this is public, we already have the right data, we just need to add an Array wrapper
34
34
  if (utils.isContentAPI(frame)) {
35
35
  filteredSettings = models;
36
-
36
+
37
37
  // Change the returned icon location to use a resized version, to prevent serving giant icon files
38
38
  const icon = filteredSettings.icon;
39
39
  if (icon) {
@@ -22,7 +22,8 @@ module.exports = {
22
22
  statusCode: 201,
23
23
  headers: {
24
24
  // NOTE: remove if there is ever a 'read' method
25
- location: false
25
+ location: false,
26
+ cacheInvalidate: false
26
27
  },
27
28
  options: [],
28
29
  data: [],
@@ -33,6 +34,9 @@ module.exports = {
33
34
  },
34
35
 
35
36
  edit: {
37
+ headers: {
38
+ cacheInvalidate: false
39
+ },
36
40
  permissions: {
37
41
  before: (frame) => {
38
42
  if (frame.options.context && frame.options.context.integration && frame.options.context.integration.id) {
@@ -84,7 +88,9 @@ module.exports = {
84
88
 
85
89
  destroy: {
86
90
  statusCode: 204,
87
- headers: {},
91
+ headers: {
92
+ cacheInvalidate: false
93
+ },
88
94
  options: [
89
95
  'id'
90
96
  ],
@@ -0,0 +1,19 @@
1
+ const logging = require('@tryghost/logging');
2
+ const {createTransactionalMigration} = require('../../utils');
3
+
4
+ module.exports = createTransactionalMigration(
5
+ async function up(knex) {
6
+ logging.info('Updating setting: "pintura" to "true"');
7
+ await knex('settings')
8
+ .where({
9
+ key: 'pintura'
10
+ })
11
+ .update({
12
+ value: 'true'
13
+ });
14
+ },
15
+
16
+ async function down() {
17
+ // no-op: this is a one way migration to set the default value for pintura integration
18
+ }
19
+ );
@@ -0,0 +1,54 @@
1
+ const {combineTransactionalMigrations, addPermissionWithRoles} = require('../../utils');
2
+
3
+ module.exports = combineTransactionalMigrations(
4
+ addPermissionWithRoles({
5
+ name: 'Browse collections',
6
+ action: 'browse',
7
+ object: 'collection'
8
+ }, [
9
+ 'Administrator',
10
+ 'Admin Integration',
11
+ 'Editor',
12
+ 'Author',
13
+ 'Contributor'
14
+ ]),
15
+ addPermissionWithRoles({
16
+ name: 'Read collections',
17
+ action: 'read',
18
+ object: 'collection'
19
+ }, [
20
+ 'Administrator',
21
+ 'Admin Integration',
22
+ 'Editor',
23
+ 'Author',
24
+ 'Contributor'
25
+ ]),
26
+ addPermissionWithRoles({
27
+ name: 'Edit collections',
28
+ action: 'edit',
29
+ object: 'collection'
30
+ }, [
31
+ 'Administrator',
32
+ 'Admin Integration',
33
+ 'Editor'
34
+ ]),
35
+ addPermissionWithRoles({
36
+ name: 'Add collections',
37
+ action: 'add',
38
+ object: 'collection'
39
+ }, [
40
+ 'Administrator',
41
+ 'Admin Integration',
42
+ 'Editor',
43
+ 'Author'
44
+ ]),
45
+ addPermissionWithRoles({
46
+ name: 'Delete collections',
47
+ action: 'destroy',
48
+ object: 'collection'
49
+ }, [
50
+ 'Administrator',
51
+ 'Admin Integration',
52
+ 'Editor'
53
+ ])
54
+ );
@@ -530,7 +530,7 @@
530
530
  },
531
531
  "pintura": {
532
532
  "pintura": {
533
- "defaultValue": "false",
533
+ "defaultValue": "true",
534
534
  "validations": {
535
535
  "isIn": [
536
536
  [
@@ -69,6 +69,7 @@ class FixtureManager {
69
69
  */
70
70
  async addAllFixtures(options) {
71
71
  const localOptions = _.merge({
72
+ autoRefresh: false,
72
73
  context: {internal: true},
73
74
  migrating: true
74
75
  }, options);
@@ -642,6 +642,31 @@
642
642
  "name": "Browse mentions",
643
643
  "action_type": "browse",
644
644
  "object_type": "mention"
645
+ },
646
+ {
647
+ "name": "Browse collections",
648
+ "action_type": "browse",
649
+ "object_type": "collection"
650
+ },
651
+ {
652
+ "name": "Read collections",
653
+ "action_type": "read",
654
+ "object_type": "collection"
655
+ },
656
+ {
657
+ "name": "Edit collections",
658
+ "action_type": "edit",
659
+ "object_type": "collection"
660
+ },
661
+ {
662
+ "name": "Add collections",
663
+ "action_type": "add",
664
+ "object_type": "collection"
665
+ },
666
+ {
667
+ "name": "Delete collections",
668
+ "action_type": "destroy",
669
+ "object_type": "collection"
645
670
  }
646
671
  ]
647
672
  },
@@ -785,7 +810,8 @@
785
810
  "explore": "read",
786
811
  "comment": "all",
787
812
  "link": "all",
788
- "mention": "browse"
813
+ "mention": "browse",
814
+ "collection": "all"
789
815
  },
790
816
  "DB Backup Integration": {
791
817
  "db": "all"
@@ -826,7 +852,8 @@
826
852
  "explore": "read",
827
853
  "comment": "all",
828
854
  "link": "all",
829
- "mention": "browse"
855
+ "mention": "browse",
856
+ "collection": "all"
830
857
  },
831
858
  "Editor": {
832
859
  "notification": "all",
@@ -843,7 +870,8 @@
843
870
  "snippet": "all",
844
871
  "label": ["browse", "read"],
845
872
  "product": ["browse", "read"],
846
- "newsletter": ["browse", "read"]
873
+ "newsletter": ["browse", "read"],
874
+ "collection": "all"
847
875
  },
848
876
  "Author": {
849
877
  "post": ["browse", "read", "add"],
@@ -858,7 +886,8 @@
858
886
  "snippet": ["browse", "read"],
859
887
  "label": ["browse", "read"],
860
888
  "product": ["browse", "read"],
861
- "newsletter": ["browse", "read"]
889
+ "newsletter": ["browse", "read"],
890
+ "collection": ["browse", "read", "add"]
862
891
  },
863
892
  "Contributor": {
864
893
  "post": ["browse", "read", "add"],
@@ -870,7 +899,8 @@
870
899
  "theme": ["browse"],
871
900
  "email_preview": "read",
872
901
  "email": "read",
873
- "snippet": ["browse", "read"]
902
+ "snippet": ["browse", "read"],
903
+ "collection": ["browse", "read"]
874
904
  }
875
905
  }
876
906
  },
@@ -0,0 +1,8 @@
1
+ module.exports = [{
2
+ title: 'Featured Posts',
3
+ slug: 'featured',
4
+ description: 'Collection of featured posts',
5
+ type: 'automatic',
6
+ deletable: false,
7
+ filter: 'featured:true'
8
+ }];
@@ -4,24 +4,48 @@ const {
4
4
  } = require('@tryghost/collections');
5
5
 
6
6
  class CollectionsServiceWrapper {
7
+ /** @type {CollectionsService} */
7
8
  api;
8
9
 
9
10
  constructor() {
11
+ const models = require('../../models');
12
+ const events = require('../../lib/common/events');
10
13
  const collectionsRepositoryInMemory = new CollectionsRepositoryInMemory();
11
14
 
12
15
  const collectionsService = new CollectionsService({
13
- collectionsRepository: collectionsRepositoryInMemory
16
+ collectionsRepository: collectionsRepositoryInMemory,
17
+ postsRepository: {
18
+ getAll: async ({filter}) => {
19
+ return models.Post.findAll({
20
+ // @NOTE: enforce "post" type to avoid ever fetching pages
21
+ filter: `(${filter})+type:post`
22
+ });
23
+ }
24
+ }
14
25
  });
15
26
 
16
- this.api = {
17
- browse: collectionsService.getAll.bind(collectionsService),
18
- read: collectionsService.getById.bind(collectionsService),
19
- add: collectionsService.createCollection.bind(collectionsService),
20
- edit: collectionsService.edit.bind(collectionsService),
21
- addPost: collectionsService.addPostToCollection.bind(collectionsService),
22
- destroy: collectionsService.destroy.bind(collectionsService),
23
- destroyCollectionPost: collectionsService.removePostFromCollection.bind(collectionsService)
24
- };
27
+ // @NOTE: these should be reworked to use the "Event" classes
28
+ // instead of Bookshelf model events
29
+ const updateEvents = require('./update-events');
30
+
31
+ // @NOTE: naive update implementation to keep things simple for the first version
32
+ for (const event of updateEvents) {
33
+ events.on(event, () => {
34
+ collectionsService.updateAutomaticCollections();
35
+ });
36
+ }
37
+
38
+ this.api = collectionsService;
39
+ }
40
+
41
+ async init() {
42
+ const featuredCollections = await this.api.getAll({filter: 'slug:featured'});
43
+
44
+ if (!featuredCollections.data.length) {
45
+ require('./built-in-collections').forEach((collection) => {
46
+ this.api.createCollection(collection);
47
+ });
48
+ }
25
49
  }
26
50
  }
27
51
 
@@ -0,0 +1,15 @@
1
+ module.exports = [
2
+ 'post.published',
3
+ 'post.published.edited',
4
+ 'post.unpublished',
5
+ 'tag.added',
6
+ 'tag.edited',
7
+ 'tag.attached',
8
+ 'tag.detached',
9
+ 'tag.deleted',
10
+ 'user.activated',
11
+ 'user.activated.edited',
12
+ 'user.attached',
13
+ 'user.detached',
14
+ 'user.deleted'
15
+ ];
@@ -12,6 +12,7 @@ const getPostServiceInstance = () => {
12
12
  const emailService = require('../email-service');
13
13
  const settingsCache = require('../../../shared/settings-cache');
14
14
  const settingsHelpers = require('../settings-helpers');
15
+ const collectionsService = require('../collections');
15
16
 
16
17
  const postStats = new PostStats();
17
18
 
@@ -37,7 +38,8 @@ const getPostServiceInstance = () => {
37
38
  isSet: flag => labs.isSet(flag), // don't use bind, that breaks test subbing of labs
38
39
  stats: postStats,
39
40
  emailService: emailService.service,
40
- postsExporter
41
+ postsExporter,
42
+ collectionsService: collectionsService.api
41
43
  });
42
44
  };
43
45