Commit Graph

809 Commits

Author SHA1 Message Date
Naz
ceb2b7e5ea Moved error messages to "messages" hash
refs https://linear.app/tryghost/issue/CORE-49/fix-errors-in-utils-repo-limit-service

- As I've touched these files did a little refactor and changed where the error messages are stored to keep it up with our lates coding standard - having "messages" hash defined in the module storing all messages that have pottential for i18y in the future.
2021-09-22 11:57:49 +02:00
Naz
ee43133dd9 Fixed error initialization syntax
refs https://linear.app/tryghost/issue/CORE-9/remove-eslint-warnings

- Used an incorrect string parameter constructor for ghost errors previously. The errors should be initialized with an object containing a "message" property
2021-09-22 11:51:37 +02:00
Naz
4b70c7e0c0 Removed use of native JS Error objects
closes https://linear.app/tryghost/issue/CORE-55/fix-errors-in-utils-repo-job-manager

- The latest ESLint rules forbid use of native JS errors, updated the codebase before bumping the ESLint version
2021-09-22 11:50:21 +02:00
Naz
be6c8ea390 Removed use of native JS Error objects
closes https://linear.app/tryghost/issue/CORE-54/fix-errors-in-utils-repo-release-utils

- The latest ESLint rules forbid use of native JS errors, updated the codebase before bumping the ESLint version
2021-09-22 11:49:02 +02:00
Naz
2b82d2afce Removed use of native JS Error objects
refs https://linear.app/tryghost/issue/CORE-49/fix-errors-in-utils-repo-limit-service

- The latest ESLint rules forbid use of native JS errors, updated the codebase before bumping the ESLint version
2021-09-22 11:32:02 +02:00
Renovate Bot
a28a2a23a5 Update dependency date-fns to v2.24.0 2021-09-17 07:39:17 +00:00
Renovate Bot
ced3a5251c Update dependency @sinonjs/fake-timers to v8 2021-09-15 11:49:45 +00:00
Renovate Bot
ff5ee78825 Update dependency c8 to v7.9.0 2021-09-10 04:03:35 +00:00
Renovate Bot
9725d5b3c0 Update dependency mocha to v9.1.1 2021-08-31 07:48:45 +00:00
Renovate Bot
65760e061e Update dependency sharp to ^0.29.0 2021-08-23 09:13:58 +02:00
Renovate Bot
d08cf7a8d4 Update dependency mocha to v9.1.0 2021-08-23 03:00:02 +00:00
Renovate Bot
daab0d1f5d Update dependency supertest to v6.1.6 2021-08-17 22:28:32 +00:00
Renovate Bot
92a531cb9c Update dependency supertest to v6.1.5 2021-08-11 17:38:29 +00:00
Renovate Bot
2b7e2676eb Update dependency c8 to v7.8.0 2021-07-28 17:56:14 +00:00
Renovate Bot
c14ae3052e Update dependency sinon to v11.1.2 2021-07-28 14:22:50 +00:00
Renovate Bot
4b976d3e0c Update dependency mocha to v9.0.3 2021-07-27 04:02:33 +00:00
Renovate Bot
798f7d1421 Update dependency date-fns to v2.23.0 2021-07-23 07:26:46 +00:00
Renovate Bot
0ad9fcf8dd Update dependency supertest to v6.1.4 2021-07-21 05:00:25 +00:00
Daniel Lockyer
1d6b8c1875 Stopped type declaration files from being generated
refs https://github.com/TryGhost/Team/issues/870

- currently, a handful of packages in this repo generate type
  declarations when building
- we're aiming to go more in the direction of better inline jsdoc, and
  we want to clean up all generated files and use of external types
- this commit removes the `typescript` dependency, removes the pretest
  commands that run the builds, and cleans up anywhere where we
  configure types
2021-07-14 11:51:14 +01:00
Daniel Lockyer
f918398779 Added c8 test coverage to all packages
refs https://github.com/TryGhost/Team/issues/870

- using `c8` allows us to see test coverage for all packages in the repo
- this commit adds `c8` as a dev dependency and prepends the `mocha`
  command with `c8` so it runs on all tests
2021-07-14 11:26:06 +01:00
Renovate Bot
9979768591 Update dependency @types/mocha to v8.2.3 2021-07-07 01:36:51 +00:00
Renovate Bot
950689fb35 Update dependency @types/express to v4.17.13 2021-07-06 21:26:50 +00:00
Renovate Bot
13a8b5386c Update Test & linting packages 2021-07-06 04:14:03 +00:00
Naz
c06fe94469 Published new versions
- @tryghost/maintenance@0.1.2
 - @tryghost/update-check-service@0.2.0
2021-07-02 18:56:12 +04:00
Naz
664b933bc8 Removed logging dependency from update check constructor
refs https://github.com/TryGhost/Team/issues/727

- The latest code standards require using @tryghost/logging module instead of injecting it as a parameter in the construcotr
- Left it as an optional constructor parameter to make testing easier
2021-07-02 18:54:50 +04:00
Naz
98a64ed0f8 Removed i18n dependency from update check constructor
refs https://github.com/TryGhost/Team/issues/727

- The latest code standards require using tpl module in combination with local messages object instead of i18n  injected in the constructor
2021-07-02 18:48:12 +04:00
Renovate Bot
b56dc030ea Update dependency typescript to v4.3.5 2021-07-01 01:11:31 +00:00
Naz
7ea81dc50d Fixed uk -> us English wording 2021-06-24 17:44:09 +04:00
Renovate Bot
e77e20e6eb Update dependency mocha to v9 2021-06-23 17:01:28 +00:00
Naz
bc3ea7e12e Skipped notificaiton processing when no valid data
refs https://github.com/TryGhost/Team/issues/754

- When there are no message objects coming from the external update check service in the response there is no need to continue to process the data and fire off unneeded queries
2021-06-23 19:14:47 +04:00
Naz
65d863d74b Added debug calls
refs https://github.com/TryGhost/Team/issues/754

- These debug messages are useful to see what kind of data came in and was processed by the update check
2021-06-23 19:13:11 +04:00
Naz
b0af1f9ddb Switched configurations to use main instead of master
no issue

- The repo was migrated to main branch as "main" and needed update in configs
2021-06-23 19:04:16 +04:00
Naz
9e5fe475c8 Improved code safety in update check's check method
refs https://github.com/TryGhost/Team/issues/754

- The api call can also generate an error which would bubble up to a client. This is not a good design if the client has to know to handle internal errors of the module
- By having try block wrap around whole block it makes the error handling behave the same way throughout the check process
2021-06-23 18:57:45 +04:00
Renovate Bot
895c93ad46 Update dependency typescript to v4.3.4 2021-06-17 18:53:56 +00:00
Renovate Bot
ec7805b7f0 Pin dependency c8 to 7.7.3 2021-06-17 13:57:17 +00:00
Hannah Wolfe
d259fcc4c6 Published new versions
- @tryghost/config-url-helpers@0.1.0
2021-06-17 14:55:21 +01:00
Hannah Wolfe
5b43d82742 Improved types in config-url-helpers 2021-06-17 13:53:09 +01:00
Hannah Wolfe
eb829a050b Prepared config-url-helpers for their intended use
- added getSubdir, getSiteUrl and getAdminUrl methods from url-utils
- refactored them so they are designed to be bound by nconf
- exposed a bindAll method
- moved over the tests and refactor from a class instance to nconf bindings
2021-06-17 11:41:50 +01:00
Sam Lord
320e689ad4 Published new versions
- @tryghost/adapter-manager@0.2.14
 - @tryghost/config-url-helpers@0.0.1
 - @tryghost/errors@0.2.13
 - @tryghost/image-transform@1.0.13
 - @tryghost/moleculer-service-from-class@0.2.17
 - @tryghost/mw-session-from-token@0.1.22
 - @tryghost/package-json@1.0.2
 - @tryghost/session-service@0.1.24
 - @tryghost/tpl@0.1.3
2021-06-17 10:50:39 +01:00
Sam Lord
095d64b449 Switch to ES6 classes for errors, use @tryghost/ignition errors
no issue

Replaces the usage of ghost-ignition with @tryghost/ignition-errors,
and switched to using the more modern ES6 class syntax over the
`.call(this, ...)` syntax used previously in both Ignition and here.
2021-06-17 10:26:19 +01:00
Renovate Bot
e8f7a4c158 Update dependency typescript to v4.3.3 2021-06-16 23:47:07 +00:00
Hannah Wolfe
3927c9002c Fixed merge error for deduplicate subdirectory
- tried to move history and fucked up git filter-repo :(
2021-06-16 20:22:06 +01:00
Hannah Wolfe
f98bcf150c Merged deduplicate subdirectory util from SDK/url-utils 2021-06-16 17:55:14 +01:00
Hannah Wolfe
0d965276a1 Added new config-url-helpers package
- This will contain a small number of helpers for getting correctly formatted urls from config
2021-06-16 17:54:30 +01:00
Renovate Bot
ede081837b Update dependency c8 to v7.7.3 2021-06-15 13:11:52 +00:00
Daniel Lockyer
939d4d9591 Published new versions
- @tryghost/package-json@1.0.1
 - @tryghost/tpl@0.1.2
2021-06-15 14:10:54 +01:00
Renovate Bot
8bed51c7aa Pin dependency c8 to v7.7.2 2021-06-15 10:05:23 +00:00
Daniel Lockyer
e14beeb7d2 Moved c8 to devDependencies
no issue

- `c8` is only used to check coverage in testing and we don't directly
  use it from within `tpl`, so this can be moved to `devDependencies`
2021-06-15 11:04:14 +01:00
Renovate Bot
f248f0d347 Update dependency c8 to v7.7.3 2021-06-14 00:31:49 +00:00
Hannah Wolfe
9eed5d69ef Published new versions
- @tryghost/package-json@1.0.0
 - @tryghost/tpl@0.1.1
2021-06-09 15:50:58 +01:00
Hannah Wolfe
1daa6eda61 Improved typing in package-json
- fixed type warnings
- introduced explicit use of bluebird to help with type warnings and also make it clear when we're actually using Bluebird features
2021-06-09 15:44:04 +01:00
Hannah Wolfe
93e4577caf Removed class pattern
- removed the class pattern in the simplest possible way
- have package-json expose only the public methods
- move parse to an independent, not public file so that we can test it independently still
2021-06-09 14:39:41 +01:00
Hannah Wolfe
dd129e0920 Removed use of i18n in package-json
- We are going to get rid of the internal i18n tool because it doesn't solve a real use case
- Instead, we have a new tpl utility that does basic string interpolation
- This makes this module less complex as it no longer requires dependency injection to work
2021-06-09 14:10:04 +01:00
Hannah Wolfe
224c6996f1 Added new tests & missing return type to tpl
- Ensuring that various strings from en.json will work
- Added missing return type
2021-06-09 12:25:45 +01:00
Hannah Wolfe
b06e2a4577 Published new versions
- @tryghost/adapter-manager@0.2.13
 - @tryghost/bootstrap-socket@0.2.9
 - @tryghost/constants@0.1.8
 - @tryghost/errors@0.2.12
 - @tryghost/image-transform@1.0.12
 - @tryghost/job-manager@0.8.7
 - @tryghost/limit-service@0.6.1
 - @tryghost/moleculer-service-from-class@0.2.16
 - @tryghost/mw-session-from-token@0.1.21
 - @tryghost/package-json@0.1.2
 - @tryghost/pretty-cli@1.2.18
 - @tryghost/promise@0.1.9
 - @tryghost/release-utils@0.6.15
 - @tryghost/security@0.2.9
 - @tryghost/session-service@0.1.23
 - @tryghost/tpl@0.1.0
 - @tryghost/vhost-middleware@1.0.15
 - @tryghost/zip@1.1.14
2021-06-09 12:10:10 +01:00
Hannah Wolfe
1a0436b540 Added ts-ignore for lodash interpolate
- ts complains the value may be undefined but in reality it never is
- plus we don't care about this error in this context as the test is checking that the value is set to its default
2021-06-09 12:00:07 +01:00
Hannah Wolfe
f2b1d37cd4 Renamed package-json tests to use .test.js pattern
- all our modules use .test.js instead of the _spec.js pattern we use in Ghost
- updated for consistency
2021-06-09 11:57:52 +01:00
Hannah Wolfe
202e0a0bb6 Added coverage reporting for tpl package
- this is 100% already
2021-06-09 11:57:52 +01:00
Renovate Bot
c72d090c97 Update dependency mocha to v9 2021-06-09 09:58:44 +00:00
Hannah Wolfe
6d3a629690 Added minimal tpl() template helper
- This mini helper wraps lodash template and supports `{...}` as the delimiters
- It's designed to use and support the exact same patterns we already have in our en.json strings
E.g. The {flagName} flag must be enabled in labs if you wish to use the \\{\\{{helperName}\\}\\} helper.
- This allows us to get rid of our old, broken i18n helper and still keep some of the smart messaging we have setup
- It also keeps the refactor surface area minimal
2021-06-09 10:04:49 +01:00
naz
d45ef018fe Added UpateCheckService usage example 2021-06-03 21:41:38 +12:00
Naz
74a949e38c Published new versions
- @tryghost/maintenance@0.1.1
 - @tryghost/update-check-service@0.1.0
2021-06-03 13:11:58 +04:00
Naz
aced29681f Updated package entry points
refs https://github.com/TryGhost/Team/issues/728

- The package does not have an index.js file!
2021-06-03 13:05:54 +04:00
Naz
2cd6cd9140 Documented notifications api parameter
refs https://github.com/TryGhost/Team/issues/728

- This was missing from the JSDoc
2021-06-03 13:04:47 +04:00
Naz
ba3c351aad Added missing module dependencies for update-check-service
refs TryGhost/Team#728

- These are dependancies that have to come with the update check service
- Used exact same versions of Bluebird/moment/lodash as in current
TryGhost/Ghost main
2021-06-02 18:25:15 +04:00
Naz
fd4e0a44c4 Fixed tests
refs TryGhost/Team#728

- After history migration the tests were referencing modules using
previous folder structure
2021-06-02 18:22:54 +04:00
Naz
cb2c40d2cb Merged update-check-service files and histry from TryGhost/Ghost 2021-06-02 18:19:30 +04:00
Naz
494880778d Added update check service initial commit
refs https://github.com/TryGhost/Team/issues/728
2021-06-02 18:17:56 +04:00
Naz
7121efb010 Removed GhostMailer parameter from UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary parameter data makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Instead of passing in a whole GhostMailer instance passing only an email sending function, which again - makes things way more manageable to reason about
- The end of refactor, next will be a move of the UpdateCheckService into a separate module in tryghost/core
2021-06-02 15:18:32 +04:00
Naz
a4e5436df7 Removed ghostVersion parameter from UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary parameter data makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Burned ghostVersion module passing in vafor of just one additional config parameter. Now the module along with unit tests can be easily extracted out of the codebase!
2021-06-02 15:08:26 +04:00
Naz
796e2caaff Removed urlFor parameter from UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Substituted a parameter with already existing 'siteUrl' config value. No need to duplicate work!
2021-06-02 14:37:29 +04:00
Naz
7ce5ab27c3 Limited the API surface of the UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- Limited urlUtils to only one function as that's all the UpdateCheck uses. Next step will be removing the function completely as and passing a 'blogURL' as a config value (way better readability this way)
2021-06-02 14:31:07 +04:00
Naz
94700863a4 Limited the API surface of the UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- This is continuation of the previous commit. TLDR: Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- There are 8 different configs that NotificationService depends upon it will need some further investigation around which ones are even needed anymore and the naming is not the best. To keep the time cap at bay leaving it at what it is.
2021-06-02 14:08:29 +04:00
Naz
361166dde0 Limited the API surface of the UpdateCheckService
refs https://github.com/TryGhost/Team/issues/728

- Passing only the necessary API endpoint function makes it easier to reason about what dependencies the UpdateCheckService has to deal with
- The instance initialization had to be moved insided the module's exports to resolve "models" module initialization failure
2021-06-02 14:08:29 +04:00
Renovate Bot
899e3fb0d8 Update dependency @types/sinon to v10.0.2 2021-06-02 08:02:37 +00:00
Naz
1fd689ba45 Renamed update check test suite
refs https://github.com/TryGhost/Team/issues/728

- Previous name was after the do-all-the-things mega module that have now become an "initializer" for the UpdateCheckService class. The unit tests are testing the latter, so the rename is a cleanup from the previous ways
2021-06-01 17:53:46 +04:00
Naz
df048ab2c2 Added update check notificaitons test coverage
refs https://github.com/TryGhost/Team/issues/728

- This is a continuation of the test coverage for the UpdateCheckService.
- Covers scpecial cases of notification processing within Update Check
- The refactor inside the update check service was a convenience to get rid or the Bluebird dependency completely. Also, some minor preventative code added to avoid errors from referencing undefined objects
2021-06-01 17:35:10 +04:00
Naz
60473d608d Updated UpdateCheckService methods to async/await
refs https://github.com/TryGhost/Team/issues/728

- In additions to easier tracking of "this" context in the unit tests it gets rid of unnecessary Bluebird's "reflect" method which was making unit test dependent on Bluebird's specific Promise implementation
2021-06-01 17:35:10 +04:00
Naz
fd58343d65 Extraced update check code into a separate service
refs https://github.com/TryGhost/Team/issues/728

- This is a first step before moving update check code into an outside codebase.
- The aim is to have a self-contained module which could be unit tested and have a very clear API
2021-06-01 17:35:10 +04:00
Renovate Bot
4fbd1ac31f Update dependency @sinonjs/fake-timers to v7.1.2 2021-05-28 15:50:34 +00:00
Renovate Bot
b47312607d Update dependency date-fns to v2.22.1 2021-05-28 12:23:22 +00:00
Renovate Bot
f35a07f4cb Update dependency date-fns to v2.22.0 2021-05-28 08:51:25 +00:00
Renovate Bot
2f926c740d Update dependency @sinonjs/fake-timers to v7.1.1 2021-05-27 11:58:34 +00:00
Renovate Bot
773991c1e6 Update dependency typescript to v4.3.2 2021-05-26 19:12:39 +00:00
Renovate Bot
24161773f3 Update dependency @types/sinon to v10.0.1 2021-05-25 20:31:28 +00:00
Renovate Bot
95e93b82b6 Update dependency @types/express to v4.17.12 2021-05-25 17:31:48 +00:00
Renovate Bot
80b56b8976 Update dependency sinon to v11 2021-05-24 22:37:15 +00:00
Renovate Bot
b71fe10342 Update dependency @sinonjs/fake-timers to v7.1.0 2021-05-21 13:51:02 +00:00
Naz
f2c1ee2263 Published new versions
- @tryghost/limit-service@0.6.0
2021-05-21 14:16:04 +04:00
Naz
ad0d1ab557 Fixed indescribable error in allowlist limit
https://github.com/TryGhost/Team/issues/663

-  When there is no parameter passed at all it was a generic 'Cannot read property 'value' of undefined' message which wasn't helpful in recognizing what the actual problem was
- Have added additional guarding logic to throw a descriptive error
2021-05-21 14:09:27 +04:00
Naz
f0a5fc975c Fixed error "swallowing"
no issue

- I've discovered the "IncorrectUsageError" error was silently swallowed and the method returned a false positibe when an allowlist limit type was called with incorrect parameters
- In cases like this it's best to surface the real error early otherwise the logic might produce unsafe results!
2021-05-21 14:02:35 +04:00
Naz
9632e98dd2 Added a convenience method checking if any limits are acceded
refs https://github.com/TryGhost/Team/issues/662

- There is a need to check if any of the current limits are over limit in Daisy. This method is the simplest possible implementation to check if any of them are over limit
- Possible future iterations might include a list of names of the limits that have been acceded and their error messages
- The `checkIfAnyOverLimit` method should be treated as a starter to work up the complexity as needed
2021-05-21 13:24:55 +04:00
Thibaut Patel
4b92e67334 Published new versions
- @tryghost/session-service@0.1.22
2021-05-14 18:03:17 +02:00
Thibaut Patel
6bfefa02ac Added a CSRF bypass to enable OAuth
issue https://github.com/TryGhost/Team/issues/614
2021-05-14 17:38:33 +02:00
Naz
6a08297c3a Published new versions
- @tryghost/job-manager@0.8.6
 - @tryghost/limit-service@0.5.1
2021-05-12 16:42:36 +04:00
Naz
88f0c332b4 Exposed additional "name" variable in error templates
refs https://github.com/TryGhost/Team/issues/587

- There was a need to be able to use the "name" of the limit inside of error templates like so: `{{name}}` (reference https://github.com/TryGhost/Team/issues/587#issuecomment-814281794)
- This change allows to form custom error messages using following variable: `{{name}}` which is the same as the `name` property provided in the configuration for the limit
2021-05-12 14:43:52 +04:00
Thibaut Patel
2b46145f88 Updated the example for the customThemes configuration
no issue
2021-05-12 11:56:41 +02:00
Naz
e26597e045 Added header to the section
no issue

- Made it clear what this part of the doc is about
2021-05-11 17:15:22 +04:00
Naz
7ec5e4bd72 Added documentation for names of limits
refs https://github.com/TryGhost/Team/issues/510

- There's a limited type of limit "names" supported by the limit service, so worth specifying them upfront. Also some limits are univerally aplicable like "flag" or "allowlist" and some are restricted like "max" and "maxPeriodic"
2021-05-11 17:14:58 +04:00
Naz
420ba250a3 Added documentation for types of limits
refs https://github.com/TryGhost/Team/issues/588
refs https://github.com/TryGhost/Team/issues/510

- There's a limited type of limits supported by the limit service and it's worth to have a conceptual description of how they work and how to use them
2021-05-11 17:13:18 +04:00
Naz
12b31a7b4b Added customThemes limit to config example
refs https://github.com/TryGhost/Team/issues/590

- The "allowList" type of configuration was missing from the example, added it for reference
2021-05-11 16:31:34 +04:00
Naz
37fa30fd6b Added emails limit to documentation example
refs https://github.com/TryGhost/Team/issues/588

- The "emails" limit was added with recent changes and could be configured as either "flag" or "maxPeridoci" type of limit
- More docs on different types of limits to follow
2021-05-11 16:29:10 +04:00
Renovate Bot
e6343c985f Update dependency date-fns to v2.21.3 2021-05-10 01:34:46 +00:00
Naz
30f1194cf9 Published new versions
- @tryghost/limit-service@0.5.0
 - @tryghost/package-json@0.1.1
2021-05-07 18:23:35 +04:00
Naz
612cc2b513 Added addedCount to max and maxPeriodic limits
refs https://github.com/TryGhost/Team/issues/588

- The `addedCount` parameter in `errorIfWouldGoOverLimit` method allows to specify a custom resource count that is about to be added. Example usecase is when we'd want to send a 100 emails and current limit is 99, and none have been sent so far. With previous implementation the check would've passed because it only checked for single resource that would be added through "+1". Current implementation allows to specify the amount of recources to be added
2021-05-07 18:13:01 +04:00
Naz
4f0a7fa1d3 Fixed query counting total emails sent in a period
refs https://github.com/TryGhost/Team/issues/588

- The previous query was quickly copied from stats-service which was using incorrect table for the count
- Updated version sums up email_count values for emails in given period of time
2021-05-07 17:58:01 +04:00
Daniel Lockyer
a81d90b126 Added c8 coverage to package-json tests
no issue

- this commit adds the c8 dependency to the `package-json`, and prepends
  it to the test alias so we can see the coverage in tests
- note: we're apparently already at 100%!
2021-05-07 12:36:36 +01:00
Naz
763875a15b Published new versions
- @tryghost/job-manager@0.8.5
 - @tryghost/limit-service@0.4.4
 - @tryghost/mw-session-from-token@0.1.20
 - @tryghost/package-json@0.1.0
 - @tryghost/session-service@0.1.21
 - @tryghost/zip@1.1.13
2021-05-07 15:00:07 +04:00
Naz
bd360e620f Removed date-fns dev dependency
refs https://github.com/TryGhost/Team/issues/588
refs 6a1e722648

- date-fns proved to be unable to manipulate dates in consistent UTC format and was substitured with luxon in referenced commit. Removing it from tests for consistency
2021-05-07 14:56:40 +04:00
Naz
6a1e722648 Fixed time difference calculation in DST timezones
refs https://github.com/TryGhost/Team/issues/588

- date-fns proved to be unable to manipulate dates consistently in UTC timezone. Keeping all calculations and formatting in UTC is key to have consistency in dates when dealing in inter-system dates
- day.js also failed the test for correct UTC manipulation. See https://github.com/iamkun/dayjs/issues/1271 for example bug which prevents from consistent correct calculation
- luxon was the best option which WORKED. It's also a recommended successor for moment.js with really nice docs and active support
2021-05-07 14:41:52 +04:00
Naz
16e21236ba Clarified test name 2021-05-07 11:46:33 +04:00
Renovate Bot
131011fad4 Update dependency extract-zip to v2.0.1 2021-05-06 20:06:06 +00:00
Renovate Bot
8b576d501a Update dependency @types/express to v4.17.11 2021-05-06 18:16:07 +00:00
Renovate Bot
3d4e65ebc3 Pin dependency date-fns to 2.21.2 2021-05-06 16:14:06 +00:00
Daniel Lockyer
e0a966d6af Fixed package-json test requires
no issue

- these tests have just been extracted from Ghost so the paths are wrong
  and they're missing the global utils import
2021-05-06 15:16:29 +01:00
Daniel Lockyer
e74c682cba Added export for package-json library contents
no issue

- our code is already in the `lib` folder so we just need to export it
2021-05-06 15:16:29 +01:00
Daniel Lockyer
3f1462296e Added required dependencies for package-json
no issue

- this package has just been extracted from Ghost and we need to add the
  dependencies it uses into the `package.json`
2021-05-06 15:16:29 +01:00
Daniel Lockyer
d2d4bbe8ed Merged package-json files and history from TryGhost/Ghost 2021-05-06 15:16:29 +01:00
Daniel Lockyer
a0e2c4d45f Added initial package-json package
no issue

- this adds the templated package from Slimer ready for pulling the
  history in from Ghost
2021-05-06 15:16:29 +01:00
Naz
9c738b13d1 Added added maxPeriodical checks
refs https://github.com/TryGhost/Team/issues/588

- This bit is putting together all the pieces for periodical limit checks. More tests are to come
2021-05-06 17:48:31 +04:00
Naz
ebfad4bea4 Added currentCountQuery for emails limit
refs https://github.com/TryGhost/Team/issues/588

- This is a basic implementation which needs a review. Implemented it to fix failing tests in main
- Start date is expected to come formatted for DB's needs
2021-05-06 17:37:50 +04:00
Daniel Lockyer
95cfa97747 Changed Error to IncorrectUsageError in package-json
no issue

- `Error` is very generic for this case and `IncorrectUsageError`
  will populate the resulting error with the correct error code
- the `message` was pulled out to its own statement so we can avoid long
  lines
2021-05-06 13:22:59 +01:00
Daniel Lockyer
eea93d55f4 Moved package-json wrapper outside implementation folder
no issue

- we're preparing the `package-json` lib to be extracted out of Ghost into
  its own package so moving the initialization wrapper outside of the
  folder makes the process a lot easier
2021-05-06 12:56:21 +01:00
Naz
0d242b96ef Added maxPeriodic limit support to limit service
refs https://github.com/TryGhost/Team/issues/588

- The limit service can now be initialized with a config which has a 'maxPeriodic' key identifying it's a special type of limit taking subscription cycles into account
- Example configuration can be found in the included unit tests
2021-05-06 15:50:36 +04:00
Naz
1483a5c758 Fixed IncorrectUsageError initialization
no issue

- The error takes in an options object which should contain "message" property instead of a string
2021-05-06 15:50:36 +04:00
Naz
4f41c2a206 Added utility calculating date of last period start
refs https://github.com/TryGhost/Team/issues/588

- There's a need to calculate when the last period has started to be able to generate correct counting queries for the "maxPeriodical" limit
- It operatest on ISO strings as an input and output in UTC timezone to take timezone calculations out of the equation
- Refer to inclucded unit tests for example calculations
2021-05-06 15:50:36 +04:00
Naz
413549f9c0 Added "maxPeriodic" limit type
refs https://github.com/TryGhost/Team/issues/588

- This is a scaffolding for a new limit type which should allow to check limits based on periods (for example related to billing, subscription cycles)
2021-05-06 15:50:36 +04:00
Renovate Bot
84fa478e0f Update dependency date-fns to v2.21.2 2021-05-05 09:35:35 +00:00
Naz
a240582094 Fixed typos 2021-05-05 12:42:30 +04:00
Hannah Wolfe
e1b18aba2c Moved i18n to shared
refs 90ca836cb6

- i18n is used everywhere but only requires shared or external packages, therefore it's a good candidate for living in shared
- this reduces invalid requires across frontend and server, and lets us use it everywhere until we come up with a better option
2021-05-04 13:03:38 +01:00
Hannah Wolfe
90ca836cb6 Expanded requires of lib/common i18n and events
- Having these as destructured from the same package is hindering refactoring now
- Events should really only ever be used server-side
- i18n should be a shared module for now so it can be used everywhere until we figure out something better
- Having them seperate also allows us to lint them properly
2021-05-03 17:14:52 +01:00
Naz
9c668317de Published new versions
- @tryghost/limit-service@0.4.3
2021-05-03 12:05:01 +04:00
Naz
47a6956175 Added test coverage for flag type of limits
refs https://github.com/TryGhost/Team/issues/588

- This is by no means an thorought test coverage but ensures the basics work and provides examples of how the limit should be used. To be continued :)
2021-05-03 12:02:01 +04:00
Naz
a5eba60c23 Added flag limit support for "emails"
refs https://github.com/TryGhost/Team/issues/588

- This is a step 1 in the introduction of email limits. Next step would be allowing this limit to support "periodical limit checks"
2021-05-03 11:47:55 +04:00
Naz
d720851ec6 Fixed failing build
refs 8d97bdec6e

- Had a stray code commited in refed commit
2021-05-03 11:11:23 +04:00
Naz
8d97bdec6e Added notes about how config module works
no issue

- I was a little confused seeing an empty object in the config moduele -  `customThemes: {}` and initially thought we could get rid of it to reduce the amount of code. Afte quick dig found out that there's a purpuse behind it being there! It's an allowlist of the properites that can be defined within the limit service
- Added notes to clarify the usecase and avoid ambiguity in the future
2021-05-03 11:07:57 +04:00
Daniel Lockyer
098801de2c Published new versions
- @tryghost/adapter-manager@0.2.12
 - @tryghost/errors@0.2.11
 - @tryghost/image-transform@1.0.11
 - @tryghost/job-manager@0.8.4
 - @tryghost/limit-service@0.4.2
 - @tryghost/moleculer-service-from-class@0.2.15
 - @tryghost/mw-session-from-token@0.1.19
 - @tryghost/pretty-cli@1.2.17
 - @tryghost/promise@0.1.8
 - @tryghost/release-utils@0.6.14
 - @tryghost/security@0.2.8
 - @tryghost/session-service@0.1.20
 - @tryghost/zip@1.1.12
2021-04-19 10:25:57 +01:00
Naz
5c89a5bec2 Published new versions
- @tryghost/adapter-manager@0.2.11
 - @tryghost/job-manager@0.8.3
 - @tryghost/limit-service@0.4.1
 - @tryghost/moleculer-service-from-class@0.2.14
 - @tryghost/mw-session-from-token@0.1.18
 - @tryghost/session-service@0.1.19
2021-04-17 08:12:34 +12:00
Renovate Bot
3184ca584d Pin dependencies 2021-04-16 12:28:10 +00:00
Daniel Lockyer
efac091357 Re-pinned @types/express to 4.17.x
no issue

- later updates of this package contain different types that we haven't
  changed our code for yet, so I need to revert the pinning to force
  this specific version for now
2021-04-16 13:26:34 +01:00
Daniel Lockyer
d37146f6fd Re-pinned extract-zip to v2.0.0
no issue

- `extract-zip` v2.0.1 currently requires Node 10.17.0, which we're not
  ready to bump our minimums to
- we'll probably bump this when we drop Node 10 at the end of April 2021
2021-04-16 13:13:55 +01:00
Daniel Lockyer
713cbd3cc4 Unpinned all dependencies
no issue

- this Utils repo contains libraries, whose dependencies should not be
  pinned in order to reduce multiple versions of the same package
  appearing for consumers
2021-04-16 13:06:54 +01:00
Renovate Bot
2d0ee67e9c Update dependency sharp to v0.28.1 2021-04-15 14:14:46 +01:00
Renovate Bot
e703a414b2 Update dependency date-fns to v2.21.1 2021-04-15 09:45:52 +00:00
Renovate Bot
bc2b3aa6d1 Update dependency @tryghost/string to v0.1.17 2021-04-15 10:42:52 +01:00
Renovate Bot
0ad3198d17 Update dependency date-fns to v2.21.0 2021-04-14 13:51:00 +00:00
Renovate Bot
989c7bee30 Update dependency @sinonjs/fake-timers to v7 2021-04-14 13:50:00 +00:00
Renovate Bot
36f461509f Update dependency @types/sinon to v10 2021-04-14 10:15:13 +00:00
Renovate Bot
a7fee2ad49 Update dependency date-fns to v2.20.3 2021-04-13 14:30:20 +00:00
Renovate Bot
fdd209a9c3 Update dependency date-fns to v2.20.2 2021-04-12 14:12:39 +00:00
Renovate Bot
2b0685396c Update dependency date-fns to v2.20.1 2021-04-09 13:02:54 +00:00
Naz
1802d46c1d Added a limit reset when loadLimits called repeatedly
refs https://github.com/TryGhost/Team/issues/599

- There are cases when there'a a need to reload limits with a new set of configuration. For example, when Ghost is run in a test environment is a soft reboot is done
- Resetting previous value of limits avoids having conflicting state after multiple calls
2021-04-09 23:44:12 +12:00
Naz
6c0aabadea Added a not to flag limit "errorIfIsOverLimit" method
refs https://github.com/TryGhost/Team/issues/510

- Flag limits are impossible to check if they are "over a limit already" as they are just that - on/off flags. Therefore it should be directly noted that the method is there to keep the "Limit" interface and not be relied upon
2021-04-09 16:10:14 +12:00
Thibaut Patel
8381346dce Added allowlist limit (#144)
issue https://github.com/TryGhost/Team/issues/510
2021-04-08 17:29:53 +02:00
Thibaut Patel
8c6ec8b214 Added a test to confirm isLimited behavior of an unkown key
no issue
2021-04-08 15:07:30 +02:00
Renovate Bot
666907f853 Update dependency date-fns to v2.20.0 2021-04-08 04:47:36 +00:00
Renovate Bot
e2eb29a5a1 Update dependency typescript to v4.2.4 2021-04-07 19:50:01 +00:00
Naz
4d6733b927 Improved docs around {{max}} & {{count}}
refs https://github.com/TryGhost/Team/issues/587

- Improved description and provided example use of error message template variables that are available for "MaxLimit" types of limits
2021-04-07 18:14:18 +12:00
Naz
0f049fbb94 Improved query formatting
refs https://github.com/TryGhost/Team/issues/599

- Oneliners with lots of chained commands are hardly readable on small screens
2021-04-07 18:13:10 +12:00
Naz
e11c0f43cf Published new versions
- @tryghost/adapter-manager@0.2.10
 - @tryghost/bootstrap-socket@0.2.8
 - @tryghost/constants@0.1.7
 - @tryghost/errors@0.2.10
 - @tryghost/image-transform@1.0.10
 - @tryghost/job-manager@0.8.2
 - @tryghost/limit-service@0.4.0
 - @tryghost/moleculer-service-from-class@0.2.13
 - @tryghost/mw-session-from-token@0.1.17
 - @tryghost/pretty-cli@1.2.16
 - @tryghost/promise@0.1.7
 - @tryghost/release-utils@0.6.13
 - @tryghost/security@0.2.7
 - @tryghost/session-service@0.1.18
 - @tryghost/vhost-middleware@1.0.14
 - @tryghost/zip@1.1.11
2021-04-07 13:47:32 +12:00
Naz
2ef3626123 Added newly generated TypeScript definiton files
no issue

- These files kept generating a new ouput when trying to publish an unrelated package. Assuming the generation is orrect and commiting this just to get things out of the way (type definition files should not break any functionality)
2021-04-07 13:41:49 +12:00
Naz
01f18aa4fa Added test coverage for {{max}} and {{count}}
refs https://github.com/TryGhost/Team/issues/510

- {{max}} and {{count}} variable usage was not covered but had valid usecases in the library client's, so considered to "document" them through tests
- For more context these variables are available in custom `error` templates that are provided with each limit
2021-04-07 13:31:42 +12:00
Naz
36dd9219c9 Added docs for currentCountQuery usage
refs https://github.com/TryGhost/Team/issues/597

- Documented example usacase for currentCountQuery override intoruced in previous commit
2021-04-06 17:05:44 +12:00
Naz
f4f48712c5 Added custom count queries for "max" limits
refs https://github.com/TryGhost/Team/issues/597

- When the library is used on a client without a DB connection (e.g. frontend client running in a browser) the library needs to expose a way to override count queries.
- The way these can be used is giving a count based on a HTTP request or some other data provider
- Example use with max limit like "staff" would be loading the limit servcie if following way:
```
            const limitService = new LimitService();

            let limits = {
                staff: {
                    max: 2,
                    currentCountQuery: () => 5
                }
            };

            limitService.loadLimits({limits, errors});

            await limitService.checkIsOverLimit('staff')
```
2021-04-06 16:45:46 +12:00
Naz
326cbf0d34 Fixed test missing a whitespace
refs https://github.com/TryGhost/Team/issues/597
refs a1962f38cd
2021-04-05 16:29:07 +12:00
Naz
fd61555763 Updated docs/examples with errors parameter
refs https://github.com/TryGhost/Team/issues/597
refs a1962f38cd

- As errors dependency has been removed in refed commit, updated the docs with correct usage of the library.
2021-04-05 16:21:35 +12:00
Naz
a1962f38cd Removed ghost-ignition's errors dependency
refs https://github.com/TryGhost/Team/issues/597

- To be able to transpile the library for different runtimes (make it polymorphic) had to get rid of dependencies that were not compatible with ES  Modules
- By making errors an injectable constructor option it removes the depencency and allows to transpile the library for multiple targets
- The `errors` option is now a required parameter for `loadLimits` method. It errors if it's missing (error message copy inspired by content api error 69fcea0582/packages/content-api/lib/index.js (L21))
2021-04-05 16:17:57 +12:00
Naz
6741818265 Added JSDoc to FlagLimit constructor
refs https://github.com/TryGhost/Team/issues/597

- Before adding more parameters documented existing ones
2021-04-05 16:03:36 +12:00
Naz
c16f13b106 Added JSDoc to loadLimits method
refs https://github.com/TryGhost/Team/issues/597

- Before adding more parameters documented existing ones
- Created LimitConfig type definition to have easier look into the structure of limit conifiguration
2021-04-05 16:02:35 +12:00
Renovate Bot
01a3e89ef5 Update dependency sinon to v10 2021-04-02 01:16:56 +00:00
Renovate Bot
88e443a935 Update dependency typescript to v4.2.3 2021-04-01 23:47:38 +00:00
Renovate Bot
8fc2a06351 Update dependency lodash to v4.17.21 2021-04-01 22:14:30 +00:00
Renovate Bot
2ef913b6e7 Update dependency ghost-ignition to v4.6.1 2021-04-01 20:59:39 +00:00
Renovate Bot
e9bd226686 Update dependency folder-hash to v4.0.1 2021-04-01 19:48:51 +00:00
Renovate Bot
5fbbc6e7bb Update dependency fastq to v1.11.0 2021-04-01 18:31:46 +00:00
Renovate Bot
7101366757 Update dependency emoji-regex to v9.2.2 2021-04-01 17:36:48 +00:00
Renovate Bot
47391855dd Update dependency date-fns to v2.19.0 2021-04-01 15:59:57 +00:00
Renovate Bot
8075074e9a Update dependency cron-validate to v1.4.3 2021-04-01 14:33:16 +00:00
Renovate Bot
5afbf3f501 Update dependency @types/sinon to v9.0.11 2021-04-01 14:09:23 +00:00
Renovate Bot
4d59a4d869 Update dependency @types/mocha to v8.2.2 2021-04-01 12:23:38 +00:00
Naz
d6a803ce2b Added docs for limit service common ussecases
refs https://github.com/TryGhost/Team/issues/587

- Documented common usecases such as:
1. initialization and configuration of limit service
2. usage of "max" types of limits
2021-04-01 23:07:16 +13:00
Renovate Bot
ff22540ef2 Update Test & linting packages 2021-04-01 09:44:12 +00:00
Naz
2d5aff434c Added optional max limit override to errorIfIsOverLimit
refs https://github.com/TryGhost/Team/issues/587
refs 73e7319406

- It's a symmetric change to the one introduce in the refenreced commit
- TLDR: allows to check if limit was reached if the user changes the limit
2021-04-01 18:27:29 +13:00
Naz
5dd3752f15 Added test coverage for is over limit check
refs https://github.com/TryGhost/Team/issues/587

- There was no test coverage for MaxLimit's errorIfIsOverLimit check. Added basic test to make sure upcoming modifications don't break existing functionality
2021-04-01 18:10:07 +13:00
Naz
3bcc4256f5 Grouped MaxLimit test cases into describe groups
refs https://github.com/TryGhost/Team/issues/587

- Clenup before adding even more test coverage
2021-04-01 18:03:32 +13:00
Naz
73e7319406 Added optional max limit override to errorIfWouldGoOverLimit
refs https://github.com/TryGhost/Team/issues/587

- The optional {max} passed as an option allows to override currently configured limit and do a theoretical new limit check. For example:  check if the max limit will be exceeded if the limit changes (user changes plans)
2021-04-01 17:59:52 +13:00
Naz
0838186abd Added JSDoc to MaxLimit constructor
refs https://github.com/TryGhost/Team/issues/587

- Having a JSDoc gives better intellisense when the class is instantiated and provides clues about what each parameter might be used for
2021-04-01 17:29:26 +13:00
Naz
57e24b3677 Added incorrect 'max' usage error to MaxLimit
refs https://github.com/TryGhost/Team/issues/587

- When the 'max' configuration is missing the instance of the class breaks when used unexpectedly. Followed similar approach to currentCountQuery check  by failing fast in the constructor
2021-04-01 17:20:56 +13:00
Naz
299d3e3bd4 Added test coverage for max limit class
refs https://github.com/TryGhost/Team/issues/587

- Test were missing for class initialization and around how the limit currently works.
- Before extending it's behavior throught its valuable to cover current functionality to not accidentally break anything
2021-04-01 17:17:45 +13:00
naz
df222e6d64 Updated readme with module description
refs https://github.com/TryGhost/Team/issues/510

- Explained the intention and responsibility ares of the module
2021-03-31 13:05:46 +13:00
Hannah Wolfe
b72c428c2e Published new versions
- @tryghost/limit-service@0.3.0
2021-03-04 20:46:49 +00:00
Hannah Wolfe
2163ec6057 Changed casing of limit names + fixed handling
refs: https://github.com/TryGhost/Team/issues/510

- Ghost config always uses camelcase. This was incorrectly implemented with snake case originally
- Swap to use camelCase by default, which is desirable, but support both
- It's really easy to support both in the loader and isLimited check, so we do this to stop ourselves tripping on this later
2021-03-04 20:39:09 +00:00
Hannah Wolfe
314a1138c3 Published new versions
- @tryghost/limit-service@0.2.1
2021-03-04 18:15:13 +00:00
Hannah Wolfe
47478eb1f9 Added proper number formatting for error messages
refs: https://github.com/TryGhost/Team/issues/510

- We should always format numbers correctly with thousand separators when we're displaying them to users
2021-03-04 18:08:25 +00:00
Hannah Wolfe
abac3a5eed Published new versions
- @tryghost/limit-service@0.2.0
2021-03-04 13:35:20 +00:00
Hannah Wolfe
75e857b76b Updated staff count query to include invites
refs: https://github.com/TryGhost/Team/issues/510

- we need to make sure we take into account any invites that could be accepted at any time
- this counts all invites for non-contributor roles as well as all users who aren't contributors
- this should stop there being loop holes to inviting staff users
2021-03-04 13:31:41 +00:00
Hannah Wolfe
cf21244e31 Published new versions
- @tryghost/limit-service@0.1.1
2021-03-03 17:56:02 +00:00
Hannah Wolfe
feb872eb3e Fixed clobbering the lodash template settings
refs: https://github.com/lodash/lodash/issues/705

- Was seeing unexpected token = errors when using lodash templates in Ghost
- This is because we're setting template settings globally in this dependency and it affects every other user of lodash
- Using runInContext keeps this templateSettings change local to this lib
- Test proves that after requiring limits we can require lodash and have the default values again
2021-03-03 17:54:36 +00:00
Hannah Wolfe
7dc95f96c4 Published new versions
- @tryghost/limit-service@0.1.0
2021-03-03 12:20:40 +00:00
Hannah Wolfe
201e133386 Added limit service initial commit
- This provides some basic functionality and error message generation for adding host-based limits in Ghost
- It is a first-pass, needs unit tests etc
2021-03-03 12:19:48 +00:00
Naz
4bd8dc90ed Published new versions
- @tryghost/job-manager@0.8.1
2021-03-03 12:27:50 +13:00
Naz
6b2494a5bc Bumped bree to 6.2.0
refs 55060e323c

- This bump was meant to be done when the referenced changes landed. Without it parts of worker thread messages are lost
2021-03-03 12:26:37 +13:00
Naz
0e951cad36 Published new versions
- @tryghost/adapter-manager@0.2.9
 - @tryghost/bootstrap-socket@0.2.7
 - @tryghost/constants@0.1.6
 - @tryghost/errors@0.2.9
 - @tryghost/image-transform@1.0.9
 - @tryghost/job-manager@0.8.0
 - @tryghost/moleculer-service-from-class@0.2.12
 - @tryghost/mw-session-from-token@0.1.16
 - @tryghost/pretty-cli@1.2.15
 - @tryghost/promise@0.1.6
 - @tryghost/release-utils@0.6.12
 - @tryghost/security@0.2.6
 - @tryghost/session-service@0.1.17
 - @tryghost/vhost-middleware@1.0.13
 - @tryghost/zip@1.1.10
2021-02-22 19:13:32 +13:00
Naz
0e2c5cdb45 Fixed typo 2021-02-22 19:10:55 +13:00
Naz
55060e323c Added workerMessageHandler option to ctr options
refs https://github.com/TryGhost/Ghost/issues/12496

- `workerMessageHandler` option allows for custom worker message handling and allows to eliminate a need for loggers of any type inside of jobs.
- removing loggers from jobs solves file hanle leak which used to cause Ghost process to crash (see referenced issue)
2021-02-22 19:10:47 +13:00
Naz
0e1c2ececb Fixed a typo 2021-02-22 18:54:23 +13:00
Naz
57c3b4428d Fixed spelling mistakes 2021-02-22 13:11:19 +13:00
Renovate Bot
741232161e Update dependency ghost-ignition to v4.4.4 2021-02-18 17:41:28 +00:00
Renovate Bot
12efe8e428 Update dependency @types/mocha to v8.2.1 2021-02-17 17:09:45 +00:00
Renovate Bot
8863bfd654 Update dependency archiver to v4.0.2 2021-02-15 04:16:44 +00:00
Renovate Bot
9399866e95 Update dependency mocha to v8.3.0 2021-02-11 19:30:19 +00:00
Renovate Bot
a130b84060 Update dependency typescript to v4.1.5 2021-02-10 21:17:57 +00:00
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