Commit Graph

608 Commits

Author SHA1 Message Date
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
Renovate Bot
c3e3935c6d Update dependency sinon to v9.2.2 2020-12-11 12:43:04 +00:00