@sapphire/plugin-api 3.0.2 → 3.0.3-next.03ab078.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.
@@ -1,21 +1,21 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MimeTypes = void 0;
4
4
  var MimeTypes;
5
5
  (function (MimeTypes) {
6
- MimeTypes['ApplicationFormUrlEncoded'] = 'application/x-www-form-urlencoded';
7
- MimeTypes['ApplicationJson'] = 'application/json';
8
- MimeTypes['AudioOgg'] = 'audio/ogg';
9
- MimeTypes['AudioOpus'] = 'audio/opus';
10
- MimeTypes['AudioWebm'] = 'audio/webm';
11
- MimeTypes['ImageGif'] = 'image/gif';
12
- MimeTypes['ImageJpg'] = 'image/jpeg';
13
- MimeTypes['ImagePng'] = 'image/png';
14
- MimeTypes['ImageWebp'] = 'image/webp';
15
- MimeTypes['TextPlain'] = 'text/plain';
16
- MimeTypes['VideoMp4'] = 'video/mp4';
17
- MimeTypes['VideoMpeg'] = 'video/mpeg';
18
- MimeTypes['VideoOgg'] = 'video/ogg';
19
- MimeTypes['VideoWebm'] = 'video/webm';
20
- })((MimeTypes = exports.MimeTypes || (exports.MimeTypes = {})));
21
- //# sourceMappingURL=MimeTypes.js.map
6
+ MimeTypes["ApplicationFormUrlEncoded"] = "application/x-www-form-urlencoded";
7
+ MimeTypes["ApplicationJson"] = "application/json";
8
+ MimeTypes["AudioOgg"] = "audio/ogg";
9
+ MimeTypes["AudioOpus"] = "audio/opus";
10
+ MimeTypes["AudioWebm"] = "audio/webm";
11
+ MimeTypes["ImageGif"] = "image/gif";
12
+ MimeTypes["ImageJpg"] = "image/jpeg";
13
+ MimeTypes["ImagePng"] = "image/png";
14
+ MimeTypes["ImageWebp"] = "image/webp";
15
+ MimeTypes["TextPlain"] = "text/plain";
16
+ MimeTypes["VideoMp4"] = "video/mp4";
17
+ MimeTypes["VideoMpeg"] = "video/mpeg";
18
+ MimeTypes["VideoOgg"] = "video/ogg";
19
+ MimeTypes["VideoWebm"] = "video/webm";
20
+ })(MimeTypes = exports.MimeTypes || (exports.MimeTypes = {}));
21
+ //# sourceMappingURL=MimeTypes.js.map
@@ -1,5 +1,5 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RouteData = exports.TypeState = void 0;
4
4
  const [slash, colon] = [47, 58];
5
5
  /**
@@ -7,71 +7,78 @@ const [slash, colon] = [47, 58];
7
7
  */
8
8
  var TypeState;
9
9
  (function (TypeState) {
10
- /**
11
- * @since 1.0.0
12
- */
13
- TypeState[(TypeState['Static'] = 0)] = 'Static';
14
- /**
15
- * @since 1.0.0
16
- */
17
- TypeState[(TypeState['Dynamic'] = 1)] = 'Dynamic';
18
- })((TypeState = exports.TypeState || (exports.TypeState = {})));
10
+ /**
11
+ * @since 1.0.0
12
+ */
13
+ TypeState[TypeState["Static"] = 0] = "Static";
14
+ /**
15
+ * @since 1.0.0
16
+ */
17
+ TypeState[TypeState["Dynamic"] = 1] = "Dynamic";
18
+ })(TypeState = exports.TypeState || (exports.TypeState = {}));
19
19
  class RouteData {
20
- constructor(path) {
21
- Object.defineProperty(this, 'path', {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: void 0
26
- });
27
- Object.defineProperty(this, 'static', {
28
- enumerable: true,
29
- configurable: true,
30
- writable: true,
31
- value: void 0
32
- });
33
- Object.defineProperty(this, 'parts', {
34
- enumerable: true,
35
- configurable: true,
36
- writable: true,
37
- value: void 0
38
- });
39
- this.path = path;
40
- this.parts = RouteData.split(path).map(RouteData.parsePart.bind(null));
41
- this.static = this.parts.every((part) => part.type === 0 /* Static */);
42
- }
43
- match(split) {
44
- if (split.length !== this.parts.length) return null;
45
- if (this.static) return this.parts.every((part, index) => part.value === split[index]) ? {} : null;
46
- const parameters = [];
47
- for (let i = 0; i < this.parts.length; ++i) {
48
- const part = this.parts[i];
49
- const value = split[i];
50
- if (part.type === 0 /* Static */) {
51
- if (part.value === value) continue;
52
- return null;
53
- }
54
- parameters.push([part.value, value]);
55
- }
56
- return Object.fromEntries(parameters);
57
- }
58
- /**
59
- * @since 1.0.0
60
- */
61
- static parsePart(value) {
62
- const type = value.charCodeAt(0) === colon ? 1 /* Dynamic */ : 0; /* Static */
63
- if (type === 1 /* Dynamic */) value = value.substring(1);
64
- return { value, type };
65
- }
66
- /**
67
- * @since 1.0.0
68
- */
69
- static split(url) {
70
- if (url.length === 1 && url.charCodeAt(0) === slash) return [''];
71
- if (url.charCodeAt(0) === slash) url = url.substring(1);
72
- if (url.length > 0 && url.charCodeAt(url.length - 1) === slash) url = url.substring(0, url.length - 1);
73
- return url.split('/');
74
- }
20
+ constructor(path) {
21
+ Object.defineProperty(this, "path", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
27
+ Object.defineProperty(this, "static", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: void 0
32
+ });
33
+ Object.defineProperty(this, "parts", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: void 0
38
+ });
39
+ this.path = path;
40
+ this.parts = RouteData.split(path).map(RouteData.parsePart.bind(null));
41
+ this.static = this.parts.every((part) => part.type === 0 /* Static */);
42
+ }
43
+ match(split) {
44
+ if (split.length !== this.parts.length)
45
+ return null;
46
+ if (this.static)
47
+ return this.parts.every((part, index) => part.value === split[index]) ? {} : null;
48
+ const parameters = [];
49
+ for (let i = 0; i < this.parts.length; ++i) {
50
+ const part = this.parts[i];
51
+ const value = split[i];
52
+ if (part.type === 0 /* Static */) {
53
+ if (part.value === value)
54
+ continue;
55
+ return null;
56
+ }
57
+ parameters.push([part.value, value]);
58
+ }
59
+ return Object.fromEntries(parameters);
60
+ }
61
+ /**
62
+ * @since 1.0.0
63
+ */
64
+ static parsePart(value) {
65
+ const type = value.charCodeAt(0) === colon ? 1 /* Dynamic */ : 0 /* Static */;
66
+ if (type === 1 /* Dynamic */)
67
+ value = value.substring(1);
68
+ return { value, type };
69
+ }
70
+ /**
71
+ * @since 1.0.0
72
+ */
73
+ static split(url) {
74
+ if (url.length === 1 && url.charCodeAt(0) === slash)
75
+ return [''];
76
+ if (url.charCodeAt(0) === slash)
77
+ url = url.substring(1);
78
+ if (url.length > 0 && url.charCodeAt(url.length - 1) === slash)
79
+ url = url.substring(0, url.length - 1);
80
+ return url.split('/');
81
+ }
75
82
  }
76
83
  exports.RouteData = RouteData;
77
- //# sourceMappingURL=RouteData.js.map
84
+ //# sourceMappingURL=RouteData.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/plugin-api",
3
- "version": "3.0.2",
3
+ "version": "3.0.3-next.03ab078.0",
4
4
  "description": "Plugin for @sapphire/framework to expose a REST API",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -33,10 +33,10 @@
33
33
  "prepublishOnly": "yarn build"
34
34
  },
35
35
  "dependencies": {
36
- "@types/node-fetch": "^2.5.12",
36
+ "@types/node-fetch": "2.5.12",
37
37
  "@types/psl": "^1.1.0",
38
38
  "@types/ws": "^8.2.0",
39
- "node-fetch": "^2.6.5",
39
+ "node-fetch": "2.6.6",
40
40
  "psl": "^1.8.0",
41
41
  "tslib": "^2.3.1"
42
42
  },
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "13ea3258845d66442eb4e1949f2c7f58420df33f"
73
+ "gitHead": "03ab078b5a15f9b567c5201445a65ea45fb19297"
74
74
  }