Commit Graph

112 Commits

Author SHA1 Message Date
Sam Lord
e1cc803ca3 Published new versions
- @tryghost/adapter-manager@0.2.24
 - @tryghost/errors@1.1.0
 - @tryghost/image-transform@1.0.24
 - @tryghost/limit-service@1.0.6
 - @tryghost/minifier@0.1.7
 - @tryghost/package-json@1.0.12
 - @tryghost/release-utils@0.7.7
 - @tryghost/session-service@0.1.34
2021-12-01 17:29:28 +00:00
Sam Lord
e66cba66f1 Published new versions
- @tryghost/adapter-manager@0.2.23
 - @tryghost/errors@1.0.4
 - @tryghost/image-transform@1.0.23
 - @tryghost/limit-service@1.0.5
 - @tryghost/minifier@0.1.6
 - @tryghost/package-json@1.0.11
 - @tryghost/release-utils@0.7.6
 - @tryghost/session-service@0.1.33
2021-11-30 17:12:21 +00:00
Sam Lord
8ae35ccfa1 Published new versions
- @tryghost/adapter-manager@0.2.22
 - @tryghost/errors@1.0.3
 - @tryghost/image-transform@1.0.22
 - @tryghost/limit-service@1.0.4
 - @tryghost/minifier@0.1.5
 - @tryghost/package-json@1.0.10
 - @tryghost/release-utils@0.7.5
 - @tryghost/session-service@0.1.32
2021-11-30 16:37:15 +00:00
Sam Lord
6576313a3b Published new versions
- @tryghost/adapter-manager@0.2.21
 - @tryghost/errors@1.0.2
 - @tryghost/image-transform@1.0.21
 - @tryghost/limit-service@1.0.3
 - @tryghost/minifier@0.1.4
 - @tryghost/package-json@1.0.9
 - @tryghost/release-utils@0.7.4
 - @tryghost/session-service@0.1.31
2021-11-30 14:41:30 +00:00
Sam Lord
ac6cbf3d58 Published new versions
- @tryghost/adapter-manager@0.2.20
 - @tryghost/errors@1.0.1
 - @tryghost/image-transform@1.0.20
 - @tryghost/job-manager@0.8.15
 - @tryghost/limit-service@1.0.2
 - @tryghost/minifier@0.1.3
 - @tryghost/package-json@1.0.8
 - @tryghost/release-utils@0.7.3
 - @tryghost/session-service@0.1.30
2021-11-30 13:59:24 +00:00
Sam Lord
ffde968c47 Published new versions
- @tryghost/adapter-manager@0.2.19
 - @tryghost/errors@1.0.0
 - @tryghost/image-transform@1.0.19
 - @tryghost/job-manager@0.8.14
 - @tryghost/limit-service@1.0.1
 - @tryghost/minifier@0.1.2
 - @tryghost/package-json@1.0.7
 - @tryghost/release-utils@0.7.2
 - @tryghost/session-service@0.1.29
2021-11-30 11:31:51 +00:00
Sam Lord
ee7b1e4dc6 Combine @tryghost/ignition-errors with @tryghost/errors
refs: https://github.com/TryGhost/Toolbox/issues/147
2021-11-30 11:31:10 +00:00
Naz
27cc7a06cb Published new versions
- @tryghost/limit-service@1.0.0
2021-10-26 15:52:50 +04:00
Naz
0b8d0feb87 Updated JSDocs for limit-service module
no issue
2021-10-26 15:51:15 +04:00
Naz
a61bf71a16 Added missing "should" imports
no issue
2021-10-26 15:50:43 +04:00
Naz
f6fbfe712a Added custom formatter to uploads limit
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

 - Provides readable bytes -> megabytes conversion for filesize limit
2021-10-26 15:49:59 +04:00
Naz
4172f993d4 Added custom formatter functionality to MaxLimit
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

 - Some variables (like file size) would be hard to comprehend with the default formatting. Instead allowed MaxLimit to be configured with a custom formatter
2021-10-26 15:49:26 +04:00
Naz
945e7ab520 Added "uploads" limit type
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

 - The limit is here to accomodate file size checks
 - An example configuration is in the README
2021-10-26 15:46:36 +04:00
Naz
91a2e54484 Added ability to pass in "currentCount" for limited resource
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

- When checking limits for a nondb-resource type (like file size) there is no way to "currentCountQuery", so the value has to be passed in directly into the limit to evaluate against configured "max" limit
2021-10-26 15:42:10 +04:00
Naz
9c695a363c Improved JSDocs in limit package
no issue

- There were a few errors and little inconsistencies that needed a cleanup
2021-10-26 11:23:42 +04:00
Naz
aef6c19933 Fixed uses ov currentCountQuery
no issue

- The currentCountQuery method takes in  no parameters!
2021-10-26 11:15:15 +04:00
Naz
d6d88d4f70 Improved JSDocs in limit package
no issue

- There were a few errors and little inconsistencies that needed a cleanup
2021-10-26 11:11:59 +04:00
Naz
3c6bb95234 Fixed typos 2021-10-26 10:52:09 +04:00
Naz
10e9c30b15 Added JSDoc with types to the Limit base constructor
no issue

- Improved type checking a little
2021-10-26 10:51:25 +04:00
Naz
bd4204dbc5 Fixed returned value type
no issue

- The return type was incorrectly declared thworing error during type checking
2021-10-26 10:48:27 +04:00
Naz
c8d840c211 Improved test coverage for limit-service module
no issue

- The aim is to achieve 100% unit test coverage for servies and small modules. This change covers few more bases brining limit-service's module coverage from 80% to 94%.
2021-10-25 18:18:04 +04:00
Naz
8520c8a746 Published new versions
- @tryghost/adapter-manager@0.2.18
 - @tryghost/bootstrap-socket@0.2.13
 - @tryghost/config-url-helpers@0.1.3
 - @tryghost/constants@0.1.12
 - @tryghost/errors@0.2.17
 - @tryghost/image-transform@1.0.17
 - @tryghost/job-manager@0.8.11
 - @tryghost/limit-service@0.6.5
 - @tryghost/moleculer-service-from-class@0.2.21
 - @tryghost/mw-session-from-token@0.1.26
 - @tryghost/package-json@1.0.6
 - @tryghost/pretty-cli@1.2.22
 - @tryghost/promise@0.1.13
 - @tryghost/release-utils@0.7.1
 - @tryghost/security@0.2.13
 - @tryghost/session-service@0.1.28
 - @tryghost/settings-path-manager@0.1.2
 - @tryghost/vhost-middleware@1.0.19
 - @tryghost/zip@1.1.18
2021-10-22 16:01:20 +04:00
Daniel Lockyer
81f566b44a Added codecov.io coverage uploader to CI
refs linear.app/tryghost/issue/CORE-74/improve-the-test-situation

- this commit adds the codecov GitHub Action into CI so we can upload
  coverage reports
- the coverage files need to be in XML for them to work with
  codecov, so this commit also adds cobertura (XML) as a reporter
2021-10-20 11:56:20 +02:00
Renovate Bot
ebe62e27c1 Update dependency mocha to v9.1.3 2021-10-15 08:26:58 +00:00
Renovate Bot
dee321eebc Update dependency c8 to v7.10.0 2021-10-06 23:39:01 +00:00
Daniel Lockyer
fd94548b1e Published new versions
- @tryghost/adapter-manager@0.2.17
 - @tryghost/bootstrap-socket@0.2.12
 - @tryghost/constants@0.1.11
 - @tryghost/errors@0.2.16
 - @tryghost/image-transform@1.0.16
 - @tryghost/job-manager@0.8.10
 - @tryghost/limit-service@0.6.4
 - @tryghost/moleculer-service-from-class@0.2.20
 - @tryghost/mw-session-from-token@0.1.25
 - @tryghost/package-json@1.0.5
 - @tryghost/pretty-cli@1.2.21
 - @tryghost/promise@0.1.12
 - @tryghost/release-utils@0.7.0
 - @tryghost/security@0.2.12
 - @tryghost/session-service@0.1.27
 - @tryghost/vhost-middleware@1.0.18
 - @tryghost/zip@1.1.17
2021-10-01 16:57:18 +01:00
Daniel Lockyer
d1c58466b5 Updated repository links
no issue

- this repo changes from `master` to `main` a while back, but the
  repository links needed updating too
2021-10-01 14:34:06 +01:00
Naz
8f4c4f66b5 Published new versions
- @tryghost/adapter-manager@0.2.16
 - @tryghost/bootstrap-socket@0.2.11
 - @tryghost/config-url-helpers@0.1.2
 - @tryghost/constants@0.1.10
 - @tryghost/errors@0.2.15
 - @tryghost/image-transform@1.0.15
 - @tryghost/job-manager@0.8.9
 - @tryghost/limit-service@0.6.3
 - @tryghost/moleculer-service-from-class@0.2.19
 - @tryghost/mw-session-from-token@0.1.24
 - @tryghost/package-json@1.0.4
 - @tryghost/pretty-cli@1.2.20
 - @tryghost/promise@0.1.11
 - @tryghost/release-utils@0.6.17
 - @tryghost/security@0.2.11
 - @tryghost/session-service@0.1.26
 - @tryghost/settings-path-manager@0.1.0
 - @tryghost/tpl@0.1.5
 - @tryghost/vhost-middleware@1.0.17
 - @tryghost/zip@1.1.16
2021-09-30 19:23:46 +02:00
Renovate Bot
81bb6465fb Update dependency mocha to v9.1.2 2021-09-27 01:04:25 +00:00
Renovate Bot
4a1da452e9 Update Test & linting packages 2021-09-22 14:29:23 +00:00
Naz
b428648665 Published new versions
- @tryghost/adapter-manager@0.2.15
 - @tryghost/bootstrap-socket@0.2.10
 - @tryghost/config-url-helpers@0.1.1
 - @tryghost/constants@0.1.9
 - @tryghost/errors@0.2.14
 - @tryghost/image-transform@1.0.14
 - @tryghost/job-manager@0.8.8
 - @tryghost/limit-service@0.6.2
 - @tryghost/moleculer-service-from-class@0.2.18
 - @tryghost/mw-session-from-token@0.1.23
 - @tryghost/package-json@1.0.3
 - @tryghost/pretty-cli@1.2.19
 - @tryghost/promise@0.1.10
 - @tryghost/release-utils@0.6.16
 - @tryghost/security@0.2.10
 - @tryghost/session-service@0.1.25
 - @tryghost/tpl@0.1.4
 - @tryghost/vhost-middleware@1.0.16
 - @tryghost/zip@1.1.15
2021-09-22 11:59:35 +02:00
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
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
ff5ee78825 Update dependency c8 to v7.9.0 2021-09-10 04:03:35 +00:00
Renovate Bot
2b7e2676eb Update dependency c8 to v7.8.0 2021-07-28 17:56:14 +00: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
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
Renovate Bot
c72d090c97 Update dependency mocha to v9 2021-06-09 09:58:44 +00:00
Renovate Bot
80b56b8976 Update dependency sinon to v11 2021-05-24 22:37:15 +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
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