Commit Graph

597 Commits

Author SHA1 Message Date
Renovate Bot
4269795c4a Update dependency typescript to v4.1.4 2021-02-09 20:39:11 +00:00
Daniel Lockyer
d8f529ef78 Published new versions
- @tryghost/adapter-manager@0.2.8
 - @tryghost/bootstrap-socket@0.2.6
 - @tryghost/constants@0.1.5
 - @tryghost/errors@0.2.8
 - @tryghost/image-transform@1.0.8
 - @tryghost/job-manager@0.7.2
 - @tryghost/moleculer-service-from-class@0.2.11
 - @tryghost/mw-session-from-token@0.1.15
 - @tryghost/pretty-cli@1.2.14
 - @tryghost/promise@0.1.5
 - @tryghost/release-utils@0.6.11
 - @tryghost/security@0.2.5
 - @tryghost/session-service@0.1.16
 - @tryghost/vhost-middleware@1.0.12
 - @tryghost/zip@1.1.9
2021-02-09 11:54:13 +00:00
Daniel Lockyer
8e8b217d4e Updated release to optionally take a targetRef
no issue

- this should allow us to pass in the branch if needed
2021-02-09 11:51:33 +00:00
Daniel Lockyer
810ef47561 Updated base branch for releases in release utils
- we switched from master to main so we need to do the same here
2021-02-09 11:48:37 +00:00
Renovate Bot
2293e0b29f Update dependency date-fns to v2.17.0 2021-02-05 15:11:27 +00:00
Renovate Bot
68d94d8880 Update dependency delay to v5 2021-02-01 15:50:32 +00:00
Renovate Bot
53f0e8855c Update dependency delay to v4.4.1 2021-02-01 01:06:49 +00:00
Renovate Bot
bed0f10fff Update dependency emoji-regex to v9.2.1 2021-01-29 10:19:13 +00:00
Renovate Bot
078ab5374a Update dependency fastq to v1.10.1 2021-01-28 12:00:32 +00:00
Renovate Bot
cf22028c80 Update dependency ghost-ignition to v4.4.3 2021-01-27 13:11:49 +00:00
Renovate Bot
7b21b682ce Update dependency supertest to v6.1.3 2021-01-25 21:31:18 +00:00
John O'Nolan
61109d57a0 2021 2021-01-25 16:20:43 +00:00
Renovate Bot
9d636f25fd Update dependency supertest to v6.1.2 2021-01-25 06:54:13 +00:00
Renovate Bot
4531b94d6b Update dependency sinon to v9.2.4 2021-01-25 00:43:01 +00:00
Renovate Bot
cd5efa81c0 Update dependency ghost-ignition to v4.4.2 2021-01-22 15:03:09 +00:00
Renovate Bot
776a6235ae Update dependency ghost-ignition to v4.4.1 2021-01-21 18:43:54 +00:00
Renovate Bot
c3b713a2a6 Update dependency ghost-ignition to v4.4.0 2021-01-21 16:17:56 +00:00
Aileen Nowak
7f4d2bb06e Updated links to ghost.org sites
no issue

Follow-up task of the updated Ghost Docs structure. Updated links reflecting the new structure to prevent unnecessary 404s and redirects.
2021-01-20 09:59:45 +13:00
Renovate Bot
90fabddb5d Update dependency fs-extra to v9.1.0 2021-01-19 19:34:19 +00:00
Renovate Bot
ba35d61e58 Update dependency bree to v4.1.1 2021-01-19 17:59:57 +00:00
Renovate Bot
097820103c Update dependency supertest to v6.1.1 2021-01-15 19:06:54 +00:00
Renovate Bot
a13f907e21 Update dependency supertest to v6.1.0 2021-01-15 16:07:08 +00:00
Renovate Bot
0870ca7c54 Update dependency ghost-ignition to v4.3.0 2021-01-13 15:18:31 +00:00
Daniel Lockyer
c4e2208158 Published new versions
- @tryghost/adapter-manager@0.2.7
 - @tryghost/bootstrap-socket@0.2.5
 - @tryghost/constants@0.1.4
 - @tryghost/errors@0.2.7
 - @tryghost/image-transform@1.0.7
 - @tryghost/job-manager@0.7.1
 - @tryghost/moleculer-service-from-class@0.2.10
 - @tryghost/mw-session-from-token@0.1.14
 - @tryghost/pretty-cli@1.2.13
 - @tryghost/promise@0.1.4
 - @tryghost/release-utils@0.6.10
 - @tryghost/security@0.2.4
 - @tryghost/session-service@0.1.15
 - @tryghost/vhost-middleware@1.0.11
 - @tryghost/zip@1.1.8
2021-01-12 16:43:48 +00:00
Daniel Lockyer
f6d5480c4f Renamed TryGhost/Ghost-Utils links to TryGhost/Utils
no issue

- this repository has been renamed so this commit just brings all the
  links inline with this change
2021-01-12 16:40:16 +00:00
Naz
34411cfcc1 Improved documentation and job examples
refs  #122

- As job signature has changed in 3bca4f63b8 and documentation needed updates accordingly
2021-01-07 15:17:38 +13:00
Renovate Bot
70dff36657 Update dependency sinon to v9.2.3 2021-01-06 15:05:05 +00:00
Naz
f0ef03476d Published new versions
- @tryghost/adapter-manager@0.2.6
 - @tryghost/job-manager@0.7.0
2021-01-06 16:07:24 +13:00
Naz
5d97e6586b Changed test grouping to distinct types of jobs 2021-01-06 13:46:47 +13:00
Naz
3bca4f63b8 Refactored job manager interface to consist of single addJob method
refs #122

- In future changes there's a plan to add "inline" scheduled jobs, which would conflict current method naming.
- The amount of parameters in the methods was more than 3, so it made sense to transform them into an options object
- Scheduling still doesn't work for "inline" jobs. This should be solved as a part of upstream library (https://github.com/breejs/bree/issues/68)
2021-01-06 13:45:23 +13:00
Renovate Bot
ca71762fee Update dependency p-wait-for to v3.2.0 2021-01-01 17:06:03 +00:00
Renovate Bot
6eab4de6c4 Update dependency cron-validate to v1.4.2 2020-12-25 17:25:51 +00:00
Renovate Bot
14894a90fc Update dependency @types/sinon to v9.0.10 2020-12-23 19:11:34 +00:00
Renovate Bot
753bd121d1 Update dependency fastq to v1.10.0 2020-12-21 01:07:04 +00:00
Naz
2528f7978a Published new versions
- @tryghost/adapter-manager@0.2.5
 - @tryghost/bootstrap-socket@0.2.4
 - @tryghost/constants@0.1.3
 - @tryghost/errors@0.2.6
 - @tryghost/image-transform@1.0.6
 - @tryghost/job-manager@0.6.0
 - @tryghost/moleculer-service-from-class@0.2.9
 - @tryghost/mw-session-from-token@0.1.13
 - @tryghost/pretty-cli@1.2.12
 - @tryghost/promise@0.1.3
 - @tryghost/release-utils@0.6.9
 - @tryghost/security@0.2.3
 - @tryghost/session-service@0.1.14
 - @tryghost/zip@1.1.7
2020-12-14 17:36:18 +13:00
Naz
1bee6d4fde Fixed flaky job-manager test 2020-12-14 17:16:55 +13:00
Naz
c13d8a2fa6 Added errorHandler option to customize job error logic
closes https://github.com/TryGhost/Ghost-Utils/issues/118

- Custom error handling is needed to be able to override default bree
error handling logic.
- bree bump to 4.1.0 also fixed logging errors (object Object fix in
tests)
- The handler function receives two parameters. First contains an error
that has been thrown by the job. Second, job and worker metadata
2020-12-14 16:09:36 +13:00
Renovate Bot
0aff1a305e Update dependency typescript to v4.1.3 2020-12-11 22:10:12 +00:00
Renovate Bot
c3e3935c6d Update dependency sinon to v9.2.2 2020-12-11 12:43:04 +00:00
Thibaut Patel
bd3afeb112 Made the package-json module ready to be exported (#12451)
no issue
2020-12-10 11:37:43 +01:00
Naz
516311aa43 Published new versions
- @tryghost/adapter-manager@0.2.4
 - @tryghost/job-manager@0.5.0
 - @tryghost/mw-session-from-token@0.1.12
 - @tryghost/session-service@0.1.13
2020-12-09 20:29:53 +13:00
Naz
13e8336de9 Updated docs around inline/offloaded jobs
no issue

- Provided more context about which type of job does what and introduced naming to be able to distinguish them
- The naming is still to be reviewed by peers
2020-12-09 20:04:09 +13:00
Naz
2462e9642e Added documentation for immediate jobs 2020-12-09 20:02:36 +13:00
Naz
7457393b5b Added jsdoc to bree job builder 2020-12-09 19:34:04 +13:00
Naz
7ece94f411 Added support for immediate offloaded jobs
closes #117

- Having immediately executable offloaded jobs is necessary to be able to run usecases like: send batched emails now, or any other job that does not need to be scheduled
- Changed "simple" job timeout to make tests run faster
2020-12-09 19:11:17 +13:00
Renovate Bot
9a6ed2f180 Update dependency @types/mocha to v8.2.0 2020-12-08 15:22:46 +00:00
Naz
12eb035bdc Published new versions
- @tryghost/job-manager@0.4.0
2020-12-08 16:44:24 +13:00
Naz
320e7feb0e Added ability to remove scheduled jobs
closes #119

- A future use-case which this feature caters for is allowing to migrate "post scheduler" to use job manager instead of managing scheduling itself
- removeJob method will be needed to allow "rescheduling" of the post
2020-12-08 16:43:18 +13:00
Naz
86b9f0d2ce Renamed when parameter
no issue

- Semantically "at" fits better as it matches the name of similarly purposed UNIX utility
2020-12-03 16:22:56 +13:00
Naz
30c9112bb5 Updated example of scheduled on off job using date 2020-12-03 15:53:10 +13:00
Naz
eb0eb2d744 Added support for one off scheduled jobs
closes #115

- When scheduling one off job for future execution you can now pass in Date as a first parameter to `scheduleJob` method
2020-12-02 21:26:15 +13:00
Naz
ed29a29704 Published new versions
- @tryghost/job-manager@0.3.4
2020-12-02 00:22:20 +13:00
Naz
35f8933070 Fixed cron definition not accepting seconds parameter 2020-12-02 00:19:01 +13:00
Naz
404209ba30 Published new versions
- @tryghost/job-manager@0.3.3
2020-11-30 15:36:54 +13:00
Naz
715789406d Improved job registration logging 2020-11-30 15:35:57 +13:00
Naz
3892e57194 Added docs on how each method executes the job 2020-11-30 15:30:45 +13:00
Naz
238ff4abdb Clarified usecases of 'done' and 'cancelled' job events
no issue

- Added docs around which events are suited best for job termination/completeion
2020-11-30 13:48:07 +13:00
Naz
6389df346c Published new versions
- @tryghost/adapter-manager@0.2.3
 - @tryghost/job-manager@0.3.2
2020-11-26 11:08:10 +13:00
Daniel Lockyer
6d42c391c5 Added JSDoc comments into package-json lib 2020-11-25 11:29:04 +00:00
Daniel Lockyer
7f09052ba1 Reverted "Refactored remaining function in package-json lib to use async-await"
- this reverts commit 2be01e7cbd.
- reverting until I can figure out why the tests are broken
2020-11-25 10:57:55 +00:00
Daniel Lockyer
2be01e7cbd Refactored remaining function in package-json lib to use async-await
- this helps simplify the code and gets rid of Promise chaining
- apparently I can't easily use an async function within filter, so I've
  left it for now
2020-11-25 10:44:15 +00:00
Daniel Lockyer
0971506948 Refactored package-json lib to use more async-await
- this helps get rid of all the promise chaining and indentation,
  resulting in cleaner code
2020-11-25 09:19:35 +00:00
Daniel Lockyer
9d29686f6a Refactored package-json lib into a class
- this helps bring all the code together so we can extract it in the
  future
- turning it into a class also lets us easily inject the i18n instance
  and store it locally
2020-11-25 09:19:35 +00:00
Naz
73b60854cd Added documentation about bthread polyfill
refs https://github.com/TryGhost/Ghost/issues/12402
2020-11-25 15:21:02 +13:00
Naz
a2fdc69a23 Added docs about job lifecycle
refs https://github.com/orgs/TryGhost/projects/36#card-49938015
2020-11-25 15:03:54 +13:00
Naz
d1df62f84c Added description about graceful job termination 2020-11-25 13:56:01 +13:00
Naz
d94830071d Added description for job termination best practice 2020-11-25 13:55:34 +13:00
Naz
c3ab2be076 Added examples of job and job manager initialization 2020-11-25 13:44:04 +13:00
Renovate Bot
31149f3ade Update dependency @types/sinon to v9.0.9 2020-11-24 08:45:40 +00:00
Naz
bc93a166e9 Updated readme with instructions about jobs
refs https://github.com/TryGhost/Ghost/issues/12402

- Describes different types of jobs that could be executed depending on the nature of the jobs.
- Lays down ground rules on how to design scheduled jobs
2020-11-24 20:15:02 +13:00
Naz
1340306f4c Updated job manager module description documentation 2020-11-24 19:55:51 +13:00
Naz
58bc922c0e Fixed tests for cron expression validation
refs c0cecd71fe
2020-11-24 16:44:54 +13:00
Naz
67e664208a Added documentation about job scheduling
refs https://github.com/TryGhost/Ghost/issues/12402

- Adds examples on how to queue regular "immediate" and reccuring "scheduled" jobs
2020-11-24 16:40:35 +13:00
Naz
c0cecd71fe 🐛 Fixed cron expression to read seconds parameter
no issue

- When providing a crontab schedule expression it should always contain 6 elements first one of them being a "seconds" schedule description . For example: '0/5 * * * * *' - meaning to run every 5 seconds
2020-11-24 16:37:46 +13:00
Naz
a8cb12250b Published new versions
- @tryghost/adapter-manager@0.2.2
 - @tryghost/job-manager@0.3.1
 - @tryghost/moleculer-service-from-class@0.2.8
 - @tryghost/mw-session-from-token@0.1.11
 - @tryghost/session-service@0.1.12
2020-11-23 16:14:42 +13:00
Naz
a7570680fb Updated type definitions files that changed with bump of typescript version
refs 295887dd24
2020-11-23 16:13:51 +13:00
Naz
a7b523e0f3 Bumped bree version to 4.0.0
refs https://github.com/breejs/bree/issues/50
refs f1ab159

- This bree version allows to avoid additional flag setting when initializing scheduled job
2020-11-23 16:03:36 +13:00
Renovate Bot
e27b788d48 Update dependency cron-validate to v1.4.1 2020-11-23 02:06:12 +00:00
Naz
f1ab1597e8 Changed scheduled jobs not run immediately after initialization
refs https://github.com/breejs/bree/issues/50
2020-11-23 14:24:24 +13:00
Renovate Bot
295887dd24 Update dependency typescript to v4.1.2 2020-11-19 22:44:50 +00:00
Naz
06bc47678b Published new versions
- @tryghost/adapter-manager@0.2.1
 - @tryghost/job-manager@0.3.0
 - @tryghost/mw-session-from-token@0.1.10
 - @tryghost/security@0.2.2
 - @tryghost/session-service@0.1.11
 - @tryghost/zip@1.1.6
2020-11-19 18:17:14 +13:00
Naz
986a59abda Moved job metadata attribute to global bree config
no issue

- Because every job is getting this attribute anyways there's no need to keep it nested on per-job bases
2020-11-19 18:15:52 +13:00
Naz
4b18cbcbdb Added support for worker threads in scheduled jobs
no issue

- When jobs are performing CPU intensive tasks they block main process'
event loop. They also can cause memory leaks or unexpected crashes
effectively crashing the parent proccess. To address these issues jobs need to be performed off of main
process. Worker Threads (https://nodejs.org/dist/latest-v12.x/docs/api/worker_threads.html)
are the best candidate for such work.
- These changes introduce an integration on top of bree
(https://github.com/breejs/bree/) which allows to run recurring
jobs in worker thereads. It falls back to child process execution for
Node v10 running without `--experimental-worker` flag.
- bree was chosen not only because it gives a polyfill for older Node
versions. It has support for some of the future use-cases Ghost is looking to
implement, like scheduled jobs.
- This changeset also includes a complete example of job running on an
interval with a possibility for graceful shutdown
2020-11-19 17:59:36 +13:00
Naz
e6e7dc93dd Added test coverage for graceful job queue shutdown 2020-11-17 18:14:37 +13:00
Renovate Bot
788014c8e0 Update dependency @types/mocha to v8.0.4 2020-11-11 01:41:25 +00:00
Renovate Bot
25bc90e615 Update dependency @tryghost/string to v0.1.14 2020-11-10 10:50:57 +00:00
Daniel Lockyer
8d9e26cb83 Switched symlink to symlinkSync
- we don't provide a callback for this so we want it synchronous
  but `symlink` is async. Switching to `symlinkSync` should now fix the
  flaky tests
2020-11-10 10:48:25 +00:00
Naz
9cbbef0398 Published new versions
- @tryghost/job-manager@0.2.0
2020-11-10 17:16:09 +13:00
Naz
7925f12fcc Fixed lint for arrow function use in beforeEach block 2020-11-10 17:15:08 +13:00
Naz
d8f7db8773 Cleaned up test 2020-11-10 17:11:31 +13:00
Naz
85b51524c9 Added loggign and more graceful error handling
no issue

- This is a quick implementation change to prevent from queue stalling and never becoming idle in case there's an error thrown from within the job function/module
- More robust error handling should be designed soon!
2020-11-10 17:11:24 +13:00
Naz
7dac72d6bf Added test coverage for basic job registration 2020-11-10 16:35:04 +13:00
Naz
c85ec6aaa5 Added support for job execution from module path
no issue

- Jobs should not always be functions, one of the standard practices is having a job defined in a module as a self contained executable function
- First parameter of `addJob` function now also handles path to modules which it imports and executes
2020-11-10 16:32:47 +13:00
Naz
70b42e3a75 Switched cron validation library to cron-validate
no issue

- Previous library was relyting on try/catch block to check if the expression is valid. Flow control through error catching is not considered a good practice and can effect performance (https://riptutorial.com/javascript/example/5297/avoid-try-catch-in-performance-critical-functions)
2020-11-10 13:33:01 +13:00
Naz
ae4f35ddd8 Changed scheduleJob method signature to take when parameter first
no issue

- Accepting the schedule or a data when scheduled job should be run would follow a signature used in other established frameworks: (1) https://github.com/mperham/sidekiq/wiki/Ent-Periodic-Jobs#definition
- Another reason to put scheduling parameter first is this would allow leaving an optional "data" parameter as last
2020-11-10 13:15:10 +13:00
Naz
9abbe60e10 Published new versions
- @tryghost/adapter-manager@0.2.0
 - @tryghost/bootstrap-socket@0.2.3
 - @tryghost/constants@0.1.2
 - @tryghost/errors@0.2.5
 - @tryghost/image-transform@1.0.5
 - @tryghost/job-manager@0.1.2
 - @tryghost/moleculer-service-from-class@0.2.7
 - @tryghost/mw-session-from-token@0.1.9
 - @tryghost/pretty-cli@1.2.11
 - @tryghost/promise@0.1.2
 - @tryghost/release-utils@0.6.8
 - @tryghost/security@0.2.1
 - @tryghost/session-service@0.1.10
 - @tryghost/vhost-middleware@1.0.10
 - @tryghost/zip@1.1.5
2020-11-05 17:38:41 +13:00
Naz
d1bbd79ece Updated JSDoc 2020-11-05 17:36:51 +13:00
Naz
1b1794063f Added experimental job scheduling feature
no issue

- This method should be used with caution and should serve as a playground for upcoming new feature of scheduled jobs support
2020-11-05 17:36:29 +13:00
Naz
3da365999d Added cron expression validation
no issue

- CRON format is the most common one used for job scheduling and is well known to most developers
- This will become one of supported formats for job scheduling
2020-11-05 17:07:27 +13:00
Naz
5506c64ae4 Added logging 2020-11-05 16:42:23 +13:00
Naz
48597b0056 Added JSDoc description 2020-11-05 16:41:16 +13:00
Naz
8c24e093d3 Added basic test checking module API 2020-11-05 16:39:51 +13:00
Renovate Bot
84fa9ce4f0 Update dependency supertest to v6.0.1 2020-11-04 14:38:51 +00:00
Kukhyeon Heo
1d707b59a6 Removed global.Promise override (#12182)
closed #11943 

* Remove global.Promise
* Fix brute-knex bluebird error.
* Fix api-acceptance tests.
* Fix unit tests
2020-11-04 10:55:47 +00:00
Renovate Bot
a85408eed9 Update dependency ghost-ignition to v4.2.4 2020-11-04 10:19:32 +00:00
Renovate Bot
3802972c71 Update dependency mocha to v8.2.1 2020-11-02 23:07:13 +00:00
Renovate Bot
c37f2e9686 Update dependency ghost-ignition to v4.2.3 2020-10-29 15:17:22 +00:00
Renovate Bot
e3b2d86115 Update dependency supertest to v6 2020-10-28 19:53:29 +00:00
Renovate Bot
2a3159aec6 Update dependency execa to v4.1.0 2020-10-28 12:06:04 +00:00
Renovate Bot
b7f78dade1 Update dependency fastq to v1.9.0 2020-10-28 11:06:06 +00:00
Renovate Bot
afd2b07d9f Update dependency sinon to v9.2.1 2020-10-28 09:04:46 +00:00
Renovate Bot
0be17bca34 Update dependency typescript to v4.0.5 2020-10-26 23:25:01 +00:00
Austin Burdine
e37d08b5d0 🔥 Added support for Node 14 2020-10-23 12:57:02 +01:00
Renovate Bot
0590f0cd72 Update dependency sharp to v0.26.2 2020-10-21 11:03:47 +01:00
Matt Hanley
11af5797fd Fixed line prefix for warning level log 2020-10-21 11:01:52 +01:00
Andrew Hutchings
48d88c5651 vhost-middleware: Removed unused dependencies
closes #105
2020-10-21 11:00:51 +01:00
Renovate Bot
05eb5b4cdc Update dependency @tryghost/string to v0.1.13 2020-10-21 10:06:12 +01:00
Renovate Bot
7858f64671 Update dependency emoji-regex to v9.2.0 2020-10-20 17:15:10 +00:00
naz
c4b6351a74 Fixed "no-shadow" linting error in server modules (#12287)
refs 143921948d

- Continuation of changes started in referenced commit
2020-10-20 12:02:56 +13:00
Renovate Bot
22c32fee0d Update dependency mocha to v8.2.0 2020-10-16 21:24:13 +00:00
Renovate Bot
163b10d2ab Update dependency emoji-regex to v9.1.1 2020-10-13 13:23:39 +00:00
Renovate Bot
e2b880ff01 Update dependency folder-hash to v4 2020-10-12 20:06:16 +00:00
Renovate Bot
e6c3664125 Update dependency @types/sinon to v9.0.8 2020-10-06 20:15:26 +00:00
Renovate Bot
38af1013b7 Update dependency sinon to v9.2.0 2020-10-06 19:10:59 +00:00
Renovate Bot
09a5f584c3 Update dependency @tryghost/string to v0.1.12 2020-09-30 03:05:47 +00:00
Renovate Bot
a7e0e73f16 Update dependency sinon to v9.1.0 2020-09-29 22:07:11 +00:00
Renovate Bot
7dc6f3e7f6 Update dependency @types/sinon to v9.0.7 2020-09-29 20:05:14 +00:00
Renovate Bot
7f2accca8d Update dependency moleculer to v0.14.11 2020-09-28 04:05:59 +00:00
Renovate Bot
e582d07a85 Update dependency @types/sinon to v9.0.6 2020-09-28 00:05:49 +00:00
Renovate Bot
8566984603 Update dependency supertest to v5 2020-09-25 13:36:18 +00:00
Nazar Gargol
1f73b85e5e Published new versions
- @tryghost/adapter-manager@0.1.11
 - @tryghost/bootstrap-socket@0.2.2
 - @tryghost/constants@0.1.1
 - @tryghost/errors@0.2.4
 - @tryghost/image-transform@1.0.4
 - @tryghost/job-manager@0.1.1
 - @tryghost/moleculer-service-from-class@0.2.6
 - @tryghost/mw-session-from-token@0.1.8
 - @tryghost/pretty-cli@1.2.10
 - @tryghost/promise@0.1.1
 - @tryghost/release-utils@0.6.7
 - @tryghost/security@0.2.0
 - @tryghost/session-service@0.1.9
 - @tryghost/vhost-middleware@1.0.9
 - @tryghost/zip@1.1.4
2020-09-22 15:36:49 +12:00
Nazar Gargol
d33b377c6a Corrected "declared in uppper scope" linting errors 2020-09-22 15:33:30 +12:00
Nazar Gargol
07972312ed Extended resetToken.compare return result with reason for comparison failure
refs https://github.com/TryGhost/Ghost/issues/11878

- To be able to identify the reason behind comparison failure on more granular level (like token expiration) had to provide additional information in return result for falsy token comparisons
2020-09-22 15:31:15 +12:00
Nazar Gargol
54f9ff24c2 Extended test coverage for tokens module
refs https://github.com/TryGhost/Ghost/issues/11878

- There are multiple reasons why the token can be invalid. This coverage is meant cover these reasons and pave the way for introduction of more rganular errors causing the invlid token
2020-09-22 13:17:07 +12:00
Renovate Bot
01f6345c08 Update dependency sharp to v0.26.1 2020-09-21 00:05:28 +00:00
Renovate Bot
c4edcbce63 Update dependency typescript to v4.0.3 2020-09-18 20:18:17 +00:00
Renovate Bot
6addf093a9 Update dependency folder-hash to v3.3.3 2020-09-02 11:32:41 +00:00
Renovate Bot
0633b9a7fe Update dependency mocha to v8.1.3 2020-08-28 21:05:06 +00:00
Renovate Bot
155daf42c8 Update dependency mocha to v8.1.2 2020-08-25 20:08:54 +00:00
Renovate Bot
8fe0c84005 Update dependency sharp to v0.26.0 2020-08-25 19:02:24 +00:00
Renovate Bot
d1d244b935 Update dependency moleculer to v0.14.10 2020-08-24 00:06:15 +00:00
Renovate Bot
c121c95721 Update dependency @types/sinon to v9.0.5 2020-08-21 18:56:05 +00:00
Renovate Bot
521ad81727 Update dependency typescript to v4 2020-08-20 16:03:03 +00:00
Renovate Bot
a134e8460d Update dependency @types/mocha to v8.0.3 2020-08-17 21:03:40 +00:00
Renovate Bot
e5ba7185ee Update dependency lodash to v4.17.20 2020-08-13 17:20:11 +00:00
Renovate Bot
cfa076f739 Update dependency @tryghost/string to v0.1.11 2020-08-13 09:25:00 +00:00
Renovate Bot
0a6c935153 Update dependency sinon to v9.0.3 2020-08-11 21:07:08 +00:00
Renovate Bot
831ec9f980 Update dependency @types/mocha to v8.0.2 2020-08-11 21:06:10 +00:00
Hannah Wolfe
7501b19557 Published new versions
- @tryghost/job-manager@0.1.0
2020-08-11 21:22:33 +01:00
Hannah Wolfe
2c1417da88 Added new job manager package
- Minimal working version of a job manager
- Uses fastq for handling the queue
- Exposes 2 methods: addJob and shutdown
2020-08-11 21:17:52 +01:00
Daniel Lockyer
e303baa184 Published new versions
- @tryghost/promise@0.1.0
 - @tryghost/release-utils@0.6.6
2020-08-11 18:37:00 +01:00
Daniel Lockyer
16f11b929f Added index.js file to export lib packages 2020-08-11 18:33:30 +01:00
Daniel Lockyer
db19e1605e Added Bluebird dependency 2020-08-11 18:33:21 +01:00
Daniel Lockyer
8c8fad3403 Updated tests filenames and fixed local requires
- fixed local requires to point to this new package
2020-08-11 18:28:51 +01:00
Daniel Lockyer
ee2f417298 Merged promise files and history from TryGhost/Ghost
* extracted promise lib files and tests from Ghost
* includes commits:
  Updated var declarations to const/let and no lists
  Move tests from core to root (#11700)
  Extended sequence utility
  Moved pipeline/sequence to lib/promise
2020-08-11 18:24:26 +01:00
Daniel Lockyer
ffe83649e4 Created @tryghost/promise package 2020-08-11 18:24:26 +01:00
Daniel Lockyer
c4de1841d0 Fixed files remaining in root after changelog test
- we didn't clear up the files after we were done with them so they
  stuck around in the root folder
2020-08-11 16:34:35 +01:00
Daniel Lockyer
dcc269b9a9 Published new versions
- @tryghost/security@0.1.0
2020-08-11 13:49:57 +01:00
Daniel Lockyer
ccf0f074c7 Added missing dependencies for new @tryghost/security package 2020-08-11 13:47:34 +01:00
Daniel Lockyer
ec0ed397d9 Moved test files to correct name
- `yarn test` will look for files matching `*.test.js`, so this commit
  fixes the name for the tests
2020-08-11 13:45:21 +01:00
Daniel Lockyer
14a53f696e Populated index.js with exports to package components
- pulled lib/index.js up to root and fixed paths
2020-08-11 13:38:44 +01:00
Daniel Lockyer
aa1c597e71 Removed template test file
- real tests have been pulled in so we don't need this
2020-08-11 13:35:40 +01:00
Daniel Lockyer
ff9e980fcb Merged security files and history from TryGhost/Ghost
* included commits:
  Updated var declarations to const/let and no lists
  Move tests from core to root (#11700)
  Updated to use slugify method from SDK for safe string
  Added Node v10 Support (#10058)
  Dynamic Routing: Added migration for routes.yaml file (#9692)
  Fixed missing Bluebird require in `security/password.js` (#9624)
  🔥  Drop Node v4 Support
  Added unit tests for models.Invite.add
  Added lib.security.password lib
  Moved unique identifier generation to lib/security
  Moved tokens, url safe and safe string utility to lib/security
2020-08-11 13:30:09 +01:00
Daniel Lockyer
82a698ec0b Created @tryghost/security package 2020-08-11 13:29:32 +01:00
Daniel Lockyer
ab5ced6bdd Published new versions
- @tryghost/adapter-manager@0.1.10
 - @tryghost/bootstrap-socket@0.2.1
 - @tryghost/constants@0.1.0
 - @tryghost/errors@0.2.3
 - @tryghost/image-transform@1.0.3
 - @tryghost/moleculer-service-from-class@0.2.5
 - @tryghost/mw-session-from-token@0.1.7
 - @tryghost/pretty-cli@1.2.9
 - @tryghost/release-utils@0.6.5
 - @tryghost/session-service@0.1.8
 - @tryghost/vhost-middleware@1.0.8
 - @tryghost/zip@1.1.3
2020-08-11 12:42:52 +01:00
Daniel Lockyer
592c3068fc Merged constants file and history from TryGhost/Ghost
- extracted from `core/server/lib` of TryGhost/Ghost
2020-08-11 12:41:01 +01:00
Daniel Lockyer
f1c26f7ebe Created @tryghost/constants package 2020-08-11 12:24:16 +01:00
Renovate Bot
9e11010f6a Update dependency sinon to v9.0.3 2020-08-11 08:02:08 +00:00
Daniel Lockyer
26452f0d3a Published new versions
- @tryghost/adapter-manager@0.1.9
 - @tryghost/errors@0.2.2
 - @tryghost/image-transform@1.0.2
 - @tryghost/session-service@0.1.7
 - @tryghost/vhost-middleware@1.0.7
2020-08-10 17:10:00 +01:00
Renovate Bot
33e070a152 Update dependency ghost-ignition to v4.2.2 2020-08-10 10:43:54 +00:00
Hannah Wolfe
71e1c309d9 Published new versions
- @tryghost/bootstrap-socket@0.2.0
2020-08-09 17:18:30 +01:00
Hannah Wolfe
a01d44fa6a Refactored bootstrap-socket API for testability
- this makes it much easier to stub this behaviour in tests
- also makes more sense
2020-08-09 17:15:46 +01:00
Hannah Wolfe
ab291cb922 Published new versions
- @tryghost/bootstrap-socket@0.1.0
2020-08-07 17:02:41 +01:00
Hannah Wolfe
014469f49b Added new bootstrap-socket package with a test
- History merged from Ghost, setup package structure and added a test
- This is exactly the kind of code that we should keep separate to Ghost, as it's rarely touched
- It's much easier to reason about and test when it's on its own
2020-08-07 16:59:25 +01:00
Hannah Wolfe
2bce6a4210 Merged bootstrap-socket file and history from TryGhost/Ghost 2020-08-07 16:53:32 +01:00
Hannah Wolfe
19be905a75 Moved bootstrap socket logic out of server
- this logic is a dependency rather than part of the server code
- moved it out ready to be moved elsewhere, doesn't need to be here
2020-08-07 16:27:45 +01:00
Daniel Lockyer
9f3114d1a1 Published new versions
- @tryghost/adapter-manager@0.1.8
 - @tryghost/errors@0.2.1
 - @tryghost/image-transform@1.0.1
 - @tryghost/moleculer-service-from-class@0.2.4
 - @tryghost/mw-session-from-token@0.1.6
 - @tryghost/pretty-cli@1.2.8
 - @tryghost/release-utils@0.6.4
 - @tryghost/session-service@0.1.6
 - @tryghost/vhost-middleware@1.0.6
 - @tryghost/zip@1.1.2
2020-08-07 16:06:21 +01:00
Renovate Bot
eec654445b Update dependency moleculer to v0.14.9 2020-08-06 16:43:02 +00:00
Renovate Bot
16dbfbc207 Update dependency mocha to v8.1.1 2020-08-04 19:32:11 +00:00
Renovate Bot
8af8886f86 Update Test & linting packages 2020-08-04 15:05:13 +00:00
Daniel Lockyer
e751f94500 Updated test theme package.json dependencies
- these were getting quite old and started flagging security issues in
  GitHub
2020-08-04 15:03:53 +01:00
Daniel Lockyer
7f8ded6057 Updated execa to v4 with code modifications
- `shellSync` was removed in execa v2
- this commit switches the usage to the recommended replacement; `sync`
- also adds a test for changelog, the part of code which uses execa
2020-08-04 14:59:55 +01:00
Daniel Lockyer
3978858b83 Remove trailing commas from .eslintrc.js files
- the upcoming eslint update flags errors for trailing commas, so this
  commits tidies that up
2020-08-04 14:48:07 +01:00
Renovate Bot
a3a62baa5a Update dependency @types/mocha to v8 2020-08-04 13:33:58 +00:00
Renovate Bot
2ce2e8ccad Update dependency typescript to v3.9.7 2020-08-04 13:28:40 +00:00
Renovate Bot
0b79572bb8 Update dependency sharp to v0.25.4 2020-08-04 13:23:09 +00:00
Renovate Bot
78e24b36f9 Update dependency request-promise to v4.2.6 2020-08-04 13:17:50 +00:00
Renovate Bot
a2b21ed08a Update dependency moleculer to v0.14.8 2020-08-04 13:00:37 +00:00
Renovate Bot
8f0bd37efd Update dependency lodash to v4.17.19 [SECURITY] 2020-08-04 12:38:39 +00:00
Renovate Bot
fd19cc0d37 Update dependency folder-hash to v3.3.2 2020-08-04 12:37:37 +00:00
Renovate Bot
d586ad780b Update dependency fs-extra to v9.0.1 2020-08-04 12:32:34 +00:00
Renovate Bot
da5d140ae6 Update dependency chalk to v4.1.0 2020-08-04 12:24:08 +00:00
Daniel Lockyer
d3459271bf Updated zip test to reflect intended behaviour
- the symlink test has been failing for some time because recent minors
  of Node 12 produce different size zip files
- we were checking that the produced zip is a specific size, but we
  basically just want to check it's smaller than the original folder
- this commit updates the test with the size of the original folder,
  found by running `du -b test/fixtures/test-theme/`
2020-08-04 13:05:34 +01:00
Kevin Ansfield
aef24f9ac3 Published new versions
- @tryghost/adapter-manager@0.1.7
 - @tryghost/image-transform@1.0.0
 - @tryghost/moleculer-service-from-class@0.2.3
 - @tryghost/mw-session-from-token@0.1.5
 - @tryghost/session-service@0.1.5
2020-07-02 18:01:49 +01:00
Kevin Ansfield
b02d82fb24 Added canTransformFiles() method
refs https://github.com/TryGhost/Ghost/issues/11944

- it's useful for consuming applications to know if images can be transformed outside of actually performing the transform (eg, when outputting "resized" image URLs)
- added `canTransformFiles()` that returns a boolean for whether or not `sharp` is installed
2020-07-02 18:00:12 +01:00
Renovate Bot
b4f8587e96 Update dependency typescript to v3.9.5 2020-06-04 19:20:06 +00:00
Fabien O'Carroll
76478e4c74 Published new versions
- @tryghost/adapter-manager@0.1.6
 - @tryghost/errors@0.2.0
 - @tryghost/image-transform@0.2.4
 - @tryghost/moleculer-service-from-class@0.2.2
 - @tryghost/mw-session-from-token@0.1.4
 - @tryghost/pretty-cli@1.2.7
 - @tryghost/release-utils@0.6.3
 - @tryghost/session-service@0.1.4
 - @tryghost/vhost-middleware@1.0.5
 - @tryghost/zip@1.1.1
2020-05-26 18:19:01 +02:00
Vikas Potluri
8ed65ff1e5 Add PasswordResetRequiredError (#68)
refs TryGhost/Ghost#11835

- this error was added after this package was created. Once this gets released, we will be able to remove the errors file in the core 🥳
2020-05-26 17:09:44 +01:00
Renovate Bot
52f7aa09a8 Update dependency mocha to v7.2.0 2020-05-25 01:19:06 +00:00
Renovate Bot
7e56dfc286 Update dependency moleculer to v0.14.7 2020-05-22 18:15:58 +00:00
Renovate Bot
597538c575 Update dependency @types/sinon to v9.0.4 2020-05-21 22:17:35 +00:00
Renovate Bot
af9f20a195 Update dependency typescript to v3.9.3 2020-05-20 01:15:35 +00:00
Renovate Bot
957c62d040 Update dependency @types/sinon to v9.0.3 2020-05-19 20:15:48 +00:00
Fabien O'Carroll
c352667fb8 Published new versions
- @tryghost/moleculer-service-from-class@0.2.1
2020-05-18 15:41:58 +02:00
Fabien O'Carroll
6023d90089 Improved handling of invalid actions
no-issue
2020-05-18 15:41:16 +02:00
Fabien O'Carroll
f6bc34dbb2 Published new versions
- @tryghost/adapter-manager@0.1.5
 - @tryghost/image-transform@0.2.3
 - @tryghost/moleculer-service-from-class@0.2.0
 - @tryghost/mw-session-from-token@0.1.3
 - @tryghost/session-service@0.1.3
2020-05-18 15:22:55 +02:00
Fabien O'Carroll
9f9a67c453 Updated type definition files
no-issue
2020-05-18 15:21:44 +02:00
Fabien O'Carroll
2d520ec32f Used versions for service deps and instance (#63)
no-issue

This is a major change and will require that we explicitly define the
versions of the services which we depend on. This will make sure that
updated services will always be sure of what actions their dependents
will have.
2020-05-18 15:16:41 +02:00
Renovate Bot
e369bb92d3 Update dependency sharp to v0.25.3 2020-05-18 01:14:51 +00:00
Renovate Bot
59e1cb6444 Update dependency @types/sinon to v9.0.1 2020-05-15 15:13:13 +00:00
Renovate Bot
892d96fd83 Update dependency typescript to v3.9.2 2020-05-12 23:15:03 +00:00
Hannah Wolfe
ed3f229136 Published new versions
- @tryghost/adapter-manager@0.1.4
 - @tryghost/errors@0.1.3
 - @tryghost/image-transform@0.2.2
 - @tryghost/moleculer-service-from-class@0.1.3
 - @tryghost/mw-session-from-token@0.1.2
 - @tryghost/pretty-cli@1.2.6
 - @tryghost/release-utils@0.6.2
 - @tryghost/session-service@0.1.2
 - @tryghost/vhost-middleware@1.0.4
 - @tryghost/zip@1.1.0
2020-05-08 16:23:52 +01:00
Hannah Wolfe
7964f6ec82 Added dotfile support and set it on by default
refs https://github.com/TryGhost/Ghost/issues/11794

- archiver has an undocumented dot option, that allows you to include dotfiles
- our existing tests had a dotfile, but we didn't check properly that everything exists
- Swapped to using folder-hash to compare if the original, and compressed-then-decompressed folders are identical
- Added an example of a dotfolder with nested dotfile
- Updated compress to use the dot option, make it optional but on by default
2020-05-08 16:21:20 +01:00
Renovate Bot
242db117a8 Update dependency ghost-ignition to v4.2.1 2020-05-04 01:15:54 +00:00
Hannah Wolfe
18ce837e9a Refactor common pattern in service files
- Use array destructuring
- Use @tryghost/errors
- Part of the big move towards decoupling, this gives visibility on what's being used where
- Biting off manageable chunks / fixing bits of code I'm refactoring for other reasons
2020-04-30 20:48:42 +01:00
Hannah Wolfe
1199859571 Updated var declarations to const/let and no lists
- All var declarations are now const or let as per ES6
- All comma-separated lists / chained declarations are now one declaration per line
- This is for clarity/readability but also made running the var-to-const/let switch smoother
- ESLint rules updated to match

How this was done:

- npm install -g jscodeshift
- git clone https://github.com/cpojer/js-codemod.git
- git clone git@github.com:TryGhost/Ghost.git shallow-ghost
- cd shallow-ghost
- jscodeshift -t ../js-codemod/transforms/unchain-variables.js . -v=2
- jscodeshift -t ../js-codemod/transforms/no-vars.js . -v=2
- yarn
- yarn test
- yarn lint / fix various lint errors (almost all indent) by opening files and saving in vscode
- grunt test-regression
- sorted!
2020-04-29 16:51:13 +01:00
Hannah Wolfe
36675b6494 Updated var declarations to const/let and no lists
- All var declarations are now const or let as per ES6
- All comma-separated lists / chained declarations are now one declaration per line
- This is for clarity/readability but also made running the var-to-const/let switch smoother
- ESLint rules updated to match

How this was done:

- npm install -g jscodeshift
- git clone https://github.com/cpojer/js-codemod.git
- git clone git@github.com:TryGhost/Ghost.git shallow-ghost
- cd shallow-ghost
- jscodeshift -t ../js-codemod/transforms/unchain-variables.js . -v=2
- jscodeshift -t ../js-codemod/transforms/no-vars.js . -v=2
- yarn
- yarn test
- yarn lint / fix various lint errors (almost all indent) by opening files and saving in vscode
- grunt test-regression
- sorted!
2020-04-29 16:51:13 +01:00
Hannah Wolfe
3db4f8d331 Updated var declarations to const/let and no lists
- All var declarations are now const or let as per ES6
- All comma-separated lists / chained declarations are now one declaration per line
- This is for clarity/readability but also made running the var-to-const/let switch smoother
- ESLint rules updated to match

How this was done:

- npm install -g jscodeshift
- git clone https://github.com/cpojer/js-codemod.git
- git clone git@github.com:TryGhost/Ghost.git shallow-ghost
- cd shallow-ghost
- jscodeshift -t ../js-codemod/transforms/unchain-variables.js . -v=2
- jscodeshift -t ../js-codemod/transforms/no-vars.js . -v=2
- yarn
- yarn test
- yarn lint / fix various lint errors (almost all indent) by opening files and saving in vscode
- grunt test-regression
- sorted!
2020-04-29 16:51:13 +01:00
Renovate Bot
3497384003 Update dependency mocha to v7.1.2 2020-04-27 01:16:32 +00:00
Renovate Bot
8e1838877c Update dependency sywac to v1.3.0 2020-04-22 15:15:29 +00:00
Renovate Bot
5cec68ca01 Update dependency emoji-regex to v9 2020-04-22 15:57:56 +01:00
Renovate Bot
ea7b6a493d Update dependency chalk to v4 2020-04-22 15:50:19 +01:00
Renovate Bot
23f85b9dbb Update dependency request to v2.88.2 2020-04-22 15:49:04 +01:00
Renovate Bot
f561bdd7fb Update dependency request-promise to v4.2.5 2020-04-22 14:45:06 +00:00
Renovate Bot
1e393e56ef Update dependency archiver to v4 2020-04-22 15:43:45 +01:00
Renovate Bot
f900bff55e Update dependency ghost-ignition to v4.1.0 2020-04-22 14:15:01 +00:00
Renovate Bot
ba5925768c Update dependency lodash to v4.17.15 2020-04-22 13:24:17 +00:00
Renovate Bot
fd59b63dbf Update dependency bluebird to v3.7.2 2020-04-22 12:14:58 +00:00
Daniel Lockyer
2ef0b76371 Pinned all dependencies
no issue
2020-04-22 12:21:42 +01:00
Renovate Bot
5be8b5714c Pin dependencies 2020-04-22 12:15:08 +01:00
Fabien O'Carroll
36a201697f Published new versions
- @tryghost/moleculer-service-from-class@0.1.2
2020-04-17 18:10:05 +02:00
Fabien O'Carroll
74bd32a572 Added debug logging to createServiceProxy
no-issue
2020-04-17 18:07:30 +02:00
Fabien O'Carroll
c8417f8ee8 Published new versions
- @tryghost/moleculer-service-from-class@0.1.1
2020-04-16 15:58:47 +02:00
Fabien O'Carroll
299be9cc2e Updated logs to use debug rather than info
no-issue

This reduces noise in moleculer logs
2020-04-16 15:57:55 +02:00
Fabien O'Carroll
2802e1eb03 Published new versions
- @tryghost/adapter-manager@0.1.3
 - @tryghost/errors@0.1.2
 - @tryghost/image-transform@0.2.1
 - @tryghost/moleculer-service-from-class@0.1.0
 - @tryghost/mw-session-from-token@0.1.1
 - @tryghost/pretty-cli@1.2.5
 - @tryghost/release-utils@0.6.1
 - @tryghost/session-service@0.1.1
 - @tryghost/vhost-middleware@1.0.3
 - @tryghost/zip@1.0.1
2020-04-16 15:15:35 +02:00
Fabien O'Carroll
e05a5b4164 Added @tryghost/moleculer-service-from-class
no-issue

This is a wrapper used by CREAM to create moleculer service config from
class definitions
2020-04-16 15:14:03 +02:00
Renovate Bot
bcec46d0cf Update dependency sinon to v9.0.2 2020-04-08 12:16:19 +00:00
Hannah Wolfe
4626407970 Published new versions
- @tryghost/zip@1.0.0
2020-04-08 12:55:01 +01:00
Hannah Wolfe
adfb3fe499 Consistent interface and response
- Creating a better, more long-term API here
- compress and extract are opposite, neat terms
- Use new Promise to get rid of callback argument when using archiver to compress a folder
- Add options argument, and make a couple of key details configurable
- Make the response intelligable
- Ensure both functions are consistent
- Updated tests to match
2020-04-08 12:48:20 +01:00
Hannah Wolfe
62c2fce6cc Switch to OG extract-zip w/ promise based interface
- switch back from @tryghost/extract-zip to extract-zip now that it has been fixed (and is much better maintained)
- switch the internal interface to be fully promise-based and test promise-based too
2020-04-08 12:48:20 +01:00
Daniel Lockyer
fec30521ad Published new versions
- @tryghost/adapter-manager@0.1.2
2020-04-07 15:42:49 +01:00
Fabien O'Carroll
f618bc5fcd Improved error messages for loading adapters
no-issue

Adds back functionality from
3988029472
2020-04-07 16:33:39 +02:00
Fabien O'Carroll
645ca9a547 Published new versions
- @tryghost/adapter-manager@0.1.1
2020-04-07 15:30:03 +02:00
Fabien O'Carroll
db96ccbfe5 Added check for Adapter prototype name
no-issue

This fixes issues when the adapter is using a different "instance" of
the base class, so we check the names are the same.
2020-04-07 15:29:15 +02:00
Daniel Lockyer
9ffee44ab7 Published new versions
- @tryghost/release-utils@0.6.0
2020-04-07 12:53:52 +01:00
Daniel Lockyer
62dbc9097b Added extraText to release
no issue
2020-04-07 12:50:54 +01:00
Fabien O'Carroll
583d357675 Published new versions
- @tryghost/adapter-manager@0.1.0
 - @tryghost/mw-session-from-token@0.1.0
2020-04-05 15:59:56 +02:00
Fabien O'Carroll
814c513b53 Added @tryghost/mw-session-from-token module (#32)
no-issue
2020-04-05 15:58:33 +02:00
Fabien O'Carroll
44db45b7c3 Added @tryghost/adapter-manager module (#38)
no-issue
2020-04-05 15:54:47 +02:00
Fabien O'Carroll
4990c05448 Published new versions
- @tryghost/session-service@0.1.0
2020-04-02 15:46:07 +02:00