@envelop/resource-limitations 2.4.0-alpha-731c100.0 → 2.4.0-alpha-22f3089.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +29 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ ## `@envelop/resource-limitations`
2
+
3
+ This plugins uses `extended-valiations` concept ([details here](https://github.com/n1ru4l/envelop/tree/main/packages/plugins/extended-validation#envelopextended-validation)) for implemeting a resource-limitations rate-limit similar to GitHub GraphQL API (see https://docs.github.com/en/graphql/overview/resource-limitations for more details)
4
+
5
+ ## Getting Started
6
+
7
+ ```
8
+ yarn add @envelop/resource-limitations
9
+ ```
10
+
11
+ ## Usage Example
12
+
13
+ ```ts
14
+ import { envelop } from '@envelop/core';
15
+ import { useResourceLimitations } from '@envelop/resource-limitations';
16
+
17
+ const getEnveloped = envelop({
18
+ plugins: [
19
+ // ... other plugins ...
20
+ useResourceLimitations({
21
+ nodeCostLimit: 500000, // optional, default to 500000
22
+ paginationArgumentMaximum: 100, // optional, default to 100
23
+ paginationArgumentMinimum: 1, // optional, default to 1
24
+ paginationArgumentScalars: ['ConnectionInt'], // optional, use if connections use a different scalar type as the argument instead of `Int`
25
+ extensions: false, // set this to `true` in order to add the calculated const to the response of queries
26
+ }),
27
+ ],
28
+ });
29
+ ```
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@envelop/resource-limitations",
3
- "version": "2.4.0-alpha-731c100.0",
3
+ "version": "2.4.0-alpha-22f3089.0",
4
4
  "description": "A rate-limit implementation based on resource limitations and static calculation of the score (similar to GitHub GraphQL API)",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "@envelop/core": "2.4.0-alpha-731c100.0",
7
+ "@envelop/core": "2.4.0-alpha-22f3089.0",
8
8
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
9
9
  },
10
10
  "dependencies": {
11
- "@envelop/extended-validation": "1.7.0-alpha-731c100.0",
11
+ "@envelop/extended-validation": "1.7.0-alpha-22f3089.0",
12
12
  "@graphql-tools/utils": "^8.6.1"
13
13
  },
14
14
  "repository": {