directus-template-cli 0.1.4 → 0.1.5

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.
package/dist/lib/api.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AxiosRequestConfig, AxiosResponse } from 'axios';
2
2
  declare class Api {
3
3
  private instance;
4
+ private limiter;
4
5
  constructor();
5
6
  setBaseUrl(url: string): void;
6
7
  setAuthToken(token: string): void;
package/dist/lib/api.js CHANGED
@@ -3,9 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.api = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const axios_1 = tslib_1.__importDefault(require("axios"));
6
+ const bottleneck_1 = tslib_1.__importDefault(require("bottleneck"));
6
7
  class Api {
7
8
  constructor() {
8
9
  this.instance = axios_1.default.create();
10
+ this.limiter = new bottleneck_1.default({
11
+ minTime: 100, // Set min time between tasks here (1000 ms = 1 second)
12
+ // You can set other options here as well.
13
+ });
9
14
  }
10
15
  setBaseUrl(url) {
11
16
  this.instance.defaults.baseURL = url;
@@ -14,19 +19,19 @@ class Api {
14
19
  this.instance.defaults.headers.common.Authorization = `Bearer ${token}`;
15
20
  }
16
21
  get(url, config) {
17
- return this.instance.get(url, config);
22
+ return this.limiter.schedule(() => this.instance.get(url, config));
18
23
  }
19
24
  post(url, data, config) {
20
- return this.instance.post(url, data, config);
25
+ return this.limiter.schedule(() => this.instance.post(url, data, config));
21
26
  }
22
27
  put(url, data, config) {
23
- return this.instance.put(url, data, config);
28
+ return this.limiter.schedule(() => this.instance.put(url, data, config));
24
29
  }
25
30
  patch(url, data, config) {
26
- return this.instance.patch(url, data, config);
31
+ return this.limiter.schedule(() => this.instance.patch(url, data, config));
27
32
  }
28
33
  delete(url, config) {
29
- return this.instance.delete(url, config);
34
+ return this.limiter.schedule(() => this.instance.delete(url, config));
30
35
  }
31
36
  }
32
37
  exports.api = new Api();
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.4",
2
+ "version": "0.1.5",
3
3
  "commands": {
4
4
  "apply": {
5
5
  "id": "apply",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-template-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "CLI Utility for applying templates to a Directus instance.",
5
5
  "author": "bryantgillespie @bryantgillespie",
6
6
  "bin": {
@@ -21,11 +21,12 @@
21
21
  "@oclif/core": "^2",
22
22
  "@oclif/plugin-help": "^5",
23
23
  "@oclif/plugin-plugins": "^2.4.6",
24
- "inquirer": "^8.2.5",
25
24
  "axios": "^1.3.4",
25
+ "bottleneck": "^2.19.5",
26
26
  "dotenv": "^16.0.3",
27
27
  "formdata-node": "^5.0.0",
28
- "generate-password": "^1.7.0"
28
+ "generate-password": "^1.7.0",
29
+ "inquirer": "^8.2.5"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@oclif/test": "^2.3.16",
@@ -52,11 +53,7 @@
52
53
  "@oclif/plugin-plugins"
53
54
  ],
54
55
  "topicSeparator": " ",
55
- "topics": {
56
- "hello": {
57
- "description": "Say hello to the world and others"
58
- }
59
- }
56
+ "topics": {}
60
57
  },
61
58
  "scripts": {
62
59
  "build": "shx rm -rf dist && tsc -b",
@@ -72,7 +69,11 @@
72
69
  },
73
70
  "bugs": "https://github.com/directus-community/directus-template-cli/issues",
74
71
  "keywords": [
75
- "oclif"
72
+ "directus",
73
+ "templates",
74
+ "headless cms",
75
+ "directus cms",
76
+ "directus cli"
76
77
  ],
77
78
  "types": "dist/index.d.ts"
78
79
  }