Commit Graph

787 Commits

Author SHA1 Message Date
Naz
e67595fe51 Published new versions
- @tryghost/api-version-compatibility-service@0.1.1
 - @tryghost/database-info@0.3.3
 - @tryghost/mw-api-version-mismatch@0.1.1
 - @tryghost/version-notifications-data-service@0.1.0
2022-04-22 14:48:16 +08:00
Naz
48c7c9b73a Implemented a version notification data service
refs https://github.com/TryGhost/Toolbox/issues/292

- The version notification data service serves as data manger for version compatibility service
- There's not much logic mostly fetching data from proficed services and filtering/serializing it into a needed format
2022-04-22 14:47:18 +08:00
Naz
38dc003258 Added scaffolding for version notification data service
refs https://github.com/TryGhost/Toolbox/issues/292

- This will be filled up with version nofitication data access logic
2022-04-22 14:47:18 +08:00
Renovate Bot
12f823c677 Update dependency knex to v2 2022-04-21 20:54:58 +00:00
Renovate Bot
e3b7a15d30 Update dependency c8 to v7.11.2 2022-04-21 12:59:13 +00:00
Naz
014fafbafb Published new versions
- @tryghost/adapter-manager@0.2.29
 - @tryghost/api-version-compatibility-service@0.1.0
 - @tryghost/bootstrap-socket@0.2.18
 - @tryghost/config-url-helpers@0.1.6
 - @tryghost/constants@1.0.3
 - @tryghost/database-info@0.3.2
 - @tryghost/image-transform@1.0.30
 - @tryghost/job-manager@0.8.22
 - @tryghost/limit-service@1.0.11
 - @tryghost/minifier@0.1.13
 - @tryghost/moleculer-service-from-class@0.2.24
 - @tryghost/mw-api-version-mismatch@0.1.0
 - @tryghost/mw-error-handler@0.2.1
 - @tryghost/mw-session-from-token@0.1.29
 - @tryghost/mw-update-user-last-seen@0.1.4
 - @tryghost/package-json@1.0.19
 - @tryghost/pretty-cli@1.2.25
 - @tryghost/promise@0.1.16
 - @tryghost/release-utils@0.7.13
 - @tryghost/security@0.2.16
 - @tryghost/session-service@0.1.39
 - @tryghost/settings-path-manager@0.1.5
 - @tryghost/vhost-middleware@1.0.23
 - @tryghost/zip@1.1.23
2022-04-21 20:58:17 +08:00
Naz
d5d594c72a Added test coverage to mw-api-version-mismatch
refs https://github.com/TryGhost/Toolbox/issues/292

- There's no good reason to not write tests!
2022-04-21 20:29:52 +08:00
Naz
f21a403538 Fixed incompatibility subject line
refs https://github.com/TryGhost/Toolbox/issues/292

- This is the subject line with the latest proposed copy
2022-04-21 16:01:56 +08:00
Naz
8414e927f9 Added handling of multiple owners to notify
refs https://github.com/TryGhost/Toolbox/issues/292

- There can be multiple users in the Ghost instance that should be notifiied about version mismatch. Following the logic of the security notifications these are users with 'Owner' and 'Administrator' roles. To have the most up to date list of the emails to notify the emails fetching was made dinamic and is now passed in as a 'fetchEmailsToNotify' function.
- Also fixed the subject of the email to match the final copy
2022-04-21 15:57:43 +08:00
Naz
258b0acc51 Added specific 'code' properties for RequestNotAcceptableError
refs https://github.com/TryGhost/Toolbox/issues/292

- There's a need to distinguish different types of RequestNotAcceptableError erros by their code. The code is also having an instructional name to give it more explicit utility (nice clue for a developer seeing the error)
2022-04-21 15:57:43 +08:00
Naz
4873303658 Added handling for version missmatch as a midleware
refs https://github.com/TryGhost/Toolbox/issues/292

- This middleware is meant to deal with version missmatch erros and call a service that does all the business logic. Having this handling in a separate module allows for thisngs to be loosely coupled
2022-04-21 15:57:43 +08:00
Naz
a7fccf1bf8 Fixed email sending
refs https://github.com/TryGhost/Toolbox/issues/292

- The standard sendEmail function used in Ghost accepts three non-optional parameters: to, subject, and html. Have extended the usage with these three required fields
2022-04-21 15:57:43 +08:00
Naz
786f5429db Bootstrapped api version mismatch middleware
refs https://github.com/TryGhost/Toolbox/issues/292

- Fresh package out of Super Slimer and removed outdated patters, like using "should"
2022-04-21 15:57:43 +08:00
Naz
188707c5bb Added previously handled checking logic
refs https://github.com/TryGhost/Toolbox/issues/292

- Added additional logic needed to check if the passed in `Accept-Version` header has been handled
2022-04-21 15:57:43 +08:00
Naz
a009616206 Removed useless code 2022-04-21 15:57:43 +08:00
Naz
a8333f22d8 Added bare bones functionality sending an email
refs https://github.com/TryGhost/Toolbox/issues/292

- Super happy path scenario which handles sending information with some basic incompatibility information
- It's meant to be built up upon! More to follow :)
2022-04-21 15:57:43 +08:00
Naz
e66ef401bd Removed boilerplate test suite 2022-04-21 15:57:43 +08:00
Naz
e247c6b9a7 Removed should dependency 2022-04-21 15:57:43 +08:00
Naz
178856cf82 Bootstrapped api version compatibility package
refs https://github.com/TryGhost/Toolbox/issues/292

- Fresh package out of Super Slimer
2022-04-21 15:57:43 +08:00
Renovate Bot
430608c9c3 Update dependency c8 to v7.11.2 2022-04-20 18:23:57 +00:00
Renovate Bot
59795bb312 Update dependency @tryghost/errors to v1.2.11 2022-04-18 21:03:51 +00:00
Renovate Bot
8a29c2d8d9 Update dependency knex to v1.0.7 2022-04-13 12:20:36 +00:00
Renovate Bot
65b91e4895 Update dependency @sinonjs/fake-timers to v9.1.2 2022-04-13 10:09:23 +00:00
Naz
ebc8881d65 Renamed variables to match their content
refs https://github.com/TryGhost/Toolbox/issues/280

- The naming of variables should've been vice-versa. Should make the code less confusing now
2022-04-13 13:30:16 +08:00
Renovate Bot
6804e5d2c6 Update dependency knex to v1.0.6 2022-04-12 11:28:36 +00:00
Naz
129bf04b0e Published new versions
- @tryghost/database-info@0.3.1
 - @tryghost/mw-error-handler@0.2.0
2022-04-08 14:30:50 +08:00
Naz
ee7655213e Added 406 response for outdated Ghost instance
refs https://github.com/TryGhost/Toolbox/issues/280

- When an outdated client receives a 404 as a response there's no clear way to act on it. Plain 404 says nothing about need to update.
- In such cases the resourceNotFound handler should return a 406 error indicating the Ghost instance needs an update.
2022-04-08 12:52:41 +08:00
Naz
88500e0704 Added 406 response for outdated API clients
refs https://github.com/TryGhost/Toolbox/issues/280

- When an outdated client receives a 404 as a response there's no clear way to act on it. Plain 404 says nothing about need to update.
- In such cases the resourceNotFound handler should return a 406 error indicating the client need to update.
2022-04-08 12:40:37 +08:00
Naz
d81accdebf Changed require declaration to be more readable
no issue

-  When adding more methods under test to this file the require statement will becom difficult to read in one long line. Multiline statement is way nicer to track in git history too
2022-04-08 11:24:03 +08:00
Renovate Bot
cca620cb35 Update dependency knex to v1.0.5 2022-04-04 21:38:20 +00:00
Sam Lord
c742848f57 Published new versions
- @tryghost/mw-error-handler@0.1.8
2022-04-04 17:16:15 +01:00
Sam Lord
5537942bdf Updated @tryghost/errors
no issue

Prevents errors with `hideStack: true` from displaying the stack
2022-04-04 17:13:13 +01:00
Daniel Lockyer
43f559690b Published new versions
- @tryghost/package-json@1.0.18
2022-04-01 14:13:28 +01:00
Daniel Lockyer
d29b8e65ec Fixed symlinked directories ignored when reading packages
refs bd6a295674

- earlier this week I refactored this block of code to get rid of
  explicit `stat` calls, to make the fs operations a little more
  lightweight
- I inadvertantly forgot that readdir doesn't follow symlinks, and we
  were previously use stat that does, so it was ignoring themes that were
  symlinked into `content/themes`
- instead of rolling back my change, I've added an if-statement to call
  `fs.stat` and check the origin of the symlink to see if it's a
  directory
- also added a test that fails without this change
2022-04-01 14:07:04 +01:00
Daniel Lockyer
22d13193e8 Deeleted unused module
- this was an experiment that didn't pan out, and I don't plan on using
  it again
2022-04-01 12:47:16 +01:00
Daniel Lockyer
a19fe06baf Published new versions
- @tryghost/knex-sqlite3@0.1.1
2022-03-29 08:44:38 +01:00
Daniel Lockyer
f39a1ce06c Added sqlite3 as an optional dependency
refs https://github.com/TryGhost/Toolbox/issues/213

- this bundles SQLite so it is abstracted away from consumers of this
  package
2022-03-29 08:43:29 +01:00
Daniel Lockyer
03ba3a4d43 Published new versions
- @tryghost/knex-sqlite3@0.1.0
2022-03-28 21:59:44 +01:00
Daniel Lockyer
cf334a6b57 Added @tryghost/knex-sqlite3 package
refs https://github.com/TryGhost/Toolbox/issues/213

- this package exports a custom dialect that extends `sqlite3` but uses
  the original `node-sqlite3` module
2022-03-28 21:59:18 +01:00
Daniel Lockyer
1a6eaff799 Published new versions
- @tryghost/database-info@0.3.0
 - @tryghost/image-transform@1.0.29
 - @tryghost/package-json@1.0.17
 - @tryghost/zip@1.1.22
2022-03-28 13:59:37 +01:00
Daniel Lockyer
aad55e83d9 Added helper methods for detecting database from config
refs https://github.com/TryGhost/Toolbox/issues/213

- this means we can remove some more hardcoded strings and refactor
  database code to be more abstract
2022-03-28 13:54:50 +01:00
Renovate Bot
446deab43b Update dependency fs-extra to v10 2022-03-28 11:32:09 +01:00
Daniel Lockyer
bd6a295674 Refactored to more efficient fs call for reading packages
- we don't need to do both a `fs.readdir` and a `fs.stat` because
  `fs.readdir` has the `withFileTypes` which returns the directory entry
  info and so this avoids an extra stat syscall
2022-03-28 11:31:45 +01:00
Daniel Lockyer
14a087536f Published new versions
- @tryghost/minifier@0.1.12
 - @tryghost/mw-error-handler@0.1.7
 - @tryghost/update-check-service@0.3.2
 - @tryghost/zip@1.1.21
2022-03-24 11:02:25 +00:00
Renovate Bot
6a805a436d Update dependency @tryghost/errors to v1 2022-03-24 10:39:08 +00:00
Daniel Lockyer
4b1db9d998 Unpinned dependencies
- libraries should have dependencies unpinned so we can rely on
  lockfiles and reduce duplicates
- this commit unpins a handful of dependencies
2022-03-24 10:31:31 +00:00
Daniel Lockyer
52365c6f99 Published new versions
- @tryghost/mw-error-handler@0.1.6
2022-03-24 10:10:26 +00:00
Daniel Lockyer
10e97cad23 Handled unknown errors when preparing user message
- in the event we get an unknown error bubble up, we don't handle the
  templating on the error name
- `@tryghost/tpl` throws an error because we pass an undefined string:
  `Cannot read properties of undefined (reading 'replace')`
- this commit adds handling to fallback to a different user message in
  that event so we don't cause a 500 error
2022-03-24 10:06:55 +00:00
Sam Lord
866c746455 Published new versions
- @tryghost/database-info@0.2.5
 - @tryghost/mw-error-handler@0.1.5
2022-03-21 09:38:38 +00:00
Sam Lord
d65ba072f9 Split prepareError from prepareStack
no issue

Change to error handling caused all theme errors to be reported in Sentry, this fix (and a respective fix in Ghost) allows the error to be prepared for sentry before replacing the stack
2022-03-21 09:38:05 +00:00