npms.io 2.2.0 → 2.2.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 2.2.1 (2022-04-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **npms.io:** Search query doesn't need to be encoded ([#959](https://github.com/ffflorian/api-clients/issues/959)) ([ea737a7](https://github.com/ffflorian/api-clients/commit/ea737a735f1c1bac5e5dd4dc1c02c860af0fb818))
12
+
13
+
14
+
15
+
16
+
6
17
  # 2.2.0 (2022-03-14)
7
18
 
8
19
 
@@ -12,21 +12,21 @@ export declare class SearchAPI {
12
12
  /**
13
13
  * Perform a search query.
14
14
  * @param query Besides normal text, `query` supports qualifiers to express filters and other modifiers:
15
- * - `scope:types:` Show/filter results that belong to the `@types` scope
16
- * - `author:sindresorhus:` Show/filter results in which `sindresorhus` is the author
17
- * - `maintainer:sindresorhus:` Show/filter results in which `sindresorhus` is qualifier as a maintainer
18
- * - `keywords:gulpplugin:` Show/filter results that have `gulpplugin` in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g.: `-framework`)
19
- * - `not:deprecated:` Exclude deprecated packages from the results
20
- * - `not:unstable:` Exclude packages whose version is `< 1.0.0`
21
- * - `not:insecure:` Exclude packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
22
- * - `is:deprecated:` Show/filter is deprecated packages
23
- * - `is:unstable:` Show/filter packages whose version is `< 1.0.0`
24
- * - `is:insecure:` Show/filter packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
25
- * - `boost-exact:false`: Do not boost exact matches, defaults to `true`
26
- * - `score-effect:14`: Set the effect that package scores have for the final search score, defaults to `15.3`
27
- * - `quality-weight:1`: Set the weight that quality has for the each package score, defaults to `1.95`
28
- * - `popularity-weight:1`: Set the weight that popularity has for the each package score, defaults to `3.3`
29
- * - `maintenance-weight:1`: Set the weight that the quality has for the each package score, defaults to `2.05`
15
+ * - `scope:types` Show/filter results that belong to the `@types` scope
16
+ * - `author:sindresorhus` Show/filter results in which `sindresorhus` is the author
17
+ * - `maintainer:sindresorhus` Show/filter results in which `sindresorhus` is qualifier as a maintainer
18
+ * - `keywords:gulpplugin` Show/filter results that have `gulpplugin` in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g.: `-framework`)
19
+ * - `not:deprecated` Exclude deprecated packages from the results
20
+ * - `not:unstable` Exclude packages whose version is `< 1.0.0`
21
+ * - `not:insecure` Exclude packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
22
+ * - `is:deprecated` Show/filter is deprecated packages
23
+ * - `is:unstable` Show/filter packages whose version is `< 1.0.0`
24
+ * - `is:insecure` Show/filter packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
25
+ * - `boost-exact:false` Do not boost exact matches, defaults to `true`
26
+ * - `score-effect:14` Set the effect that package scores have for the final search score, defaults to `15.3`
27
+ * - `quality-weight:1` Set the weight that quality has for the each package score, defaults to `1.95`
28
+ * - `popularity-weight:1` Set the weight that popularity has for the each package score, defaults to `3.3`
29
+ * - `maintenance-weight:1` Set the weight that the quality has for the each package score, defaults to `2.05`
30
30
  * @param options Additional search options
31
31
  * @see https://api-docs.npms.io/#api-Search-ExecuteSearchQuery
32
32
  */
@@ -23,11 +23,9 @@ class SearchAPI {
23
23
  getSuggestions(query, options = {}) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  const endpoint = Endpoints_1.Endpoint.Search.search();
26
- const params = {
26
+ const params = Object.assign({
27
27
  // eslint-disable-next-line id-length
28
- q: encodeURIComponent(query),
29
- size: options.size,
30
- };
28
+ q: query }, (options.size && { size: options.size }));
31
29
  const { data } = yield this.apiClient.get(endpoint, { params });
32
30
  return data;
33
31
  });
@@ -35,33 +33,30 @@ class SearchAPI {
35
33
  /**
36
34
  * Perform a search query.
37
35
  * @param query Besides normal text, `query` supports qualifiers to express filters and other modifiers:
38
- * - `scope:types:` Show/filter results that belong to the `@types` scope
39
- * - `author:sindresorhus:` Show/filter results in which `sindresorhus` is the author
40
- * - `maintainer:sindresorhus:` Show/filter results in which `sindresorhus` is qualifier as a maintainer
41
- * - `keywords:gulpplugin:` Show/filter results that have `gulpplugin` in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g.: `-framework`)
42
- * - `not:deprecated:` Exclude deprecated packages from the results
43
- * - `not:unstable:` Exclude packages whose version is `< 1.0.0`
44
- * - `not:insecure:` Exclude packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
45
- * - `is:deprecated:` Show/filter is deprecated packages
46
- * - `is:unstable:` Show/filter packages whose version is `< 1.0.0`
47
- * - `is:insecure:` Show/filter packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
48
- * - `boost-exact:false`: Do not boost exact matches, defaults to `true`
49
- * - `score-effect:14`: Set the effect that package scores have for the final search score, defaults to `15.3`
50
- * - `quality-weight:1`: Set the weight that quality has for the each package score, defaults to `1.95`
51
- * - `popularity-weight:1`: Set the weight that popularity has for the each package score, defaults to `3.3`
52
- * - `maintenance-weight:1`: Set the weight that the quality has for the each package score, defaults to `2.05`
36
+ * - `scope:types` Show/filter results that belong to the `@types` scope
37
+ * - `author:sindresorhus` Show/filter results in which `sindresorhus` is the author
38
+ * - `maintainer:sindresorhus` Show/filter results in which `sindresorhus` is qualifier as a maintainer
39
+ * - `keywords:gulpplugin` Show/filter results that have `gulpplugin` in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g.: `-framework`)
40
+ * - `not:deprecated` Exclude deprecated packages from the results
41
+ * - `not:unstable` Exclude packages whose version is `< 1.0.0`
42
+ * - `not:insecure` Exclude packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
43
+ * - `is:deprecated` Show/filter is deprecated packages
44
+ * - `is:unstable` Show/filter packages whose version is `< 1.0.0`
45
+ * - `is:insecure` Show/filter packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
46
+ * - `boost-exact:false` Do not boost exact matches, defaults to `true`
47
+ * - `score-effect:14` Set the effect that package scores have for the final search score, defaults to `15.3`
48
+ * - `quality-weight:1` Set the weight that quality has for the each package score, defaults to `1.95`
49
+ * - `popularity-weight:1` Set the weight that popularity has for the each package score, defaults to `3.3`
50
+ * - `maintenance-weight:1` Set the weight that the quality has for the each package score, defaults to `2.05`
53
51
  * @param options Additional search options
54
52
  * @see https://api-docs.npms.io/#api-Search-ExecuteSearchQuery
55
53
  */
56
54
  searchPackage(query, options = {}) {
57
55
  return __awaiter(this, void 0, void 0, function* () {
58
56
  const endpoint = Endpoints_1.Endpoint.Search.search();
59
- const params = {
60
- from: options.from,
57
+ const params = Object.assign(Object.assign({
61
58
  // eslint-disable-next-line id-length
62
- q: encodeURIComponent(query),
63
- size: options.size,
64
- };
59
+ q: query }, (options.from && { from: options.from })), (options.size && { size: options.size }));
65
60
  const { data } = yield this.apiClient.get(endpoint, { params });
66
61
  return data;
67
62
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SearchAPI.js","sourceRoot":"","sources":["../../src/api/SearchAPI.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,4CAAsC;AAGtC,MAAa,SAAS;IAGpB,YAAY,SAAwB;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACU,cAAc,CAAC,KAAa,EAAE,UAA8B,EAAE;;YACzE,MAAM,QAAQ,GAAG,oBAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAE1C,MAAM,MAAM,GAAG;gBACb,qCAAqC;gBACrC,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC;YAEF,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,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;YAC5D,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,aAAa,CAAC,KAAa,EAAE,UAAyB,EAAE;;YACnE,MAAM,QAAQ,GAAG,oBAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAE1C,MAAM,MAAM;gBACV,qCAAqC;gBACrC,CAAC,EAAE,KAAK,IACL,CAAC,OAAO,CAAC,IAAI,IAAI,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAC,CAAC,GACtC,CAAC,OAAO,CAAC,IAAI,IAAI,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAC,CAAC,CAC1C,CAAC;YAEF,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC;YAC5D,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF;AA3DD,8BA2DC"}
package/package.json CHANGED
@@ -7,8 +7,8 @@
7
7
  "devDependencies": {
8
8
  "@types/node": "~16",
9
9
  "rimraf": "3.0.2",
10
- "typedoc": "0.22.13",
11
- "typescript": "4.6.2"
10
+ "typedoc": "0.22.14",
11
+ "typescript": "4.6.3"
12
12
  },
13
13
  "engines": {
14
14
  "node": ">= 10.9"
@@ -33,6 +33,6 @@
33
33
  "dist": "yarn clean && yarn build:ts",
34
34
  "test": "exit 0"
35
35
  },
36
- "version": "2.2.0",
37
- "gitHead": "4f552a3933dc19d22644a55b17cf16293ccdb40a"
36
+ "version": "2.2.1",
37
+ "gitHead": "ded1923270e86bd0f305708455ebc66259ec40c6"
38
38
  }