Commit Graph

596 Commits

Author SHA1 Message Date
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