@backstage/plugin-search-backend 0.2.7 → 0.2.8
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 +8 -0
- package/dist/index.cjs.js +4 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @backstage/plugin-search-backend
|
|
2
2
|
|
|
3
|
+
## 0.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dcd1a0c3f4: Minor improvement to the API reports, by not unpacking arguments directly
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-common@0.9.13
|
|
10
|
+
|
|
3
11
|
## 0.2.7
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -8,13 +8,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var Router__default = /*#__PURE__*/_interopDefaultLegacy(Router);
|
|
10
10
|
|
|
11
|
-
async function createRouter({
|
|
12
|
-
engine,
|
|
13
|
-
|
|
14
|
-
}) {
|
|
15
|
-
const router = Router__default['default']();
|
|
11
|
+
async function createRouter(options) {
|
|
12
|
+
const { engine, logger } = options;
|
|
13
|
+
const router = Router__default["default"]();
|
|
16
14
|
router.get("/query", async (req, res) => {
|
|
17
|
-
const {term, filters = {}, types, pageCursor} = req.query;
|
|
15
|
+
const { term, filters = {}, types, pageCursor } = req.query;
|
|
18
16
|
logger.info(`Search request received: term="${term}", filters=${JSON.stringify(filters)}, types=${types ? types.join(",") : ""}, pageCursor=${pageCursor != null ? pageCursor : ""}`);
|
|
19
17
|
try {
|
|
20
18
|
const results = await (engine == null ? void 0 : engine.query(req.query));
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport express from 'express';\nimport Router from 'express-promise-router';\nimport { Logger } from 'winston';\nimport { SearchQuery, SearchResultSet } from '@backstage/search-common';\nimport { SearchEngine } from '@backstage/plugin-search-backend-node';\n\
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport express from 'express';\nimport Router from 'express-promise-router';\nimport { Logger } from 'winston';\nimport { SearchQuery, SearchResultSet } from '@backstage/search-common';\nimport { SearchEngine } from '@backstage/plugin-search-backend-node';\n\nexport type RouterOptions = {\n engine: SearchEngine;\n logger: Logger;\n};\n\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const { engine, logger } = options;\n const router = Router();\n router.get(\n '/query',\n async (\n req: express.Request<any, unknown, unknown, SearchQuery>,\n res: express.Response<SearchResultSet>,\n ) => {\n const { term, filters = {}, types, pageCursor } = req.query;\n logger.info(\n `Search request received: term=\"${term}\", filters=${JSON.stringify(\n filters,\n )}, types=${types ? types.join(',') : ''}, pageCursor=${\n pageCursor ?? ''\n }`,\n );\n\n try {\n const results = await engine?.query(req.query);\n res.send(results);\n } catch (err) {\n throw new Error(\n `There was a problem performing the search query. ${err}`,\n );\n }\n },\n );\n\n return router;\n}\n"],"names":["Router"],"mappings":";;;;;;;;;;4BA4BE,SACyB;AACzB,QAAM,EAAE,QAAQ,WAAW;AAC3B,QAAM,SAASA;AACf,SAAO,IACL,UACA,OACE,KACA,QACG;AACH,UAAM,EAAE,MAAM,UAAU,IAAI,OAAO,eAAe,IAAI;AACtD,WAAO,KACL,kCAAkC,kBAAkB,KAAK,UACvD,mBACU,QAAQ,MAAM,KAAK,OAAO,kBACpC,kCAAc;AAIlB,QAAI;AACF,YAAM,UAAU,wCAAc,MAAM,IAAI;AACxC,UAAI,KAAK;AAAA,aACF,KAAP;AACA,YAAM,IAAI,MACR,oDAAoD;AAAA;AAAA;AAM5D,SAAO;AAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ declare type RouterOptions = {
|
|
|
6
6
|
engine: SearchEngine;
|
|
7
7
|
logger: Logger;
|
|
8
8
|
};
|
|
9
|
-
declare function createRouter(
|
|
9
|
+
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
10
10
|
|
|
11
|
-
export { createRouter };
|
|
11
|
+
export { RouterOptions, createRouter };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-search-backend",
|
|
3
3
|
"description": "The Backstage backend plugin that provides your backstage app with search",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.8",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"clean": "backstage-cli clean"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@backstage/backend-common": "^0.9.
|
|
23
|
+
"@backstage/backend-common": "^0.9.13",
|
|
24
24
|
"@backstage/plugin-search-backend-node": "^0.4.2",
|
|
25
25
|
"@backstage/search-common": "^0.2.0",
|
|
26
26
|
"@types/express": "^4.17.6",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"yn": "^4.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@backstage/cli": "^0.
|
|
33
|
+
"@backstage/cli": "^0.10.1",
|
|
34
34
|
"@types/supertest": "^2.0.8",
|
|
35
35
|
"supertest": "^6.1.3"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "562be0b43016294e27af3ad024191bb86b13b1c1"
|
|
41
41
|
}
|