Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/plugin-search-backend-node

Package Overview
Dependencies
Maintainers
4
Versions
1079
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/plugin-search-backend-node - npm Package Compare versions

Comparing version 0.0.0-nightly-20217521743 to 0.0.0-nightly-202191622432

16

CHANGELOG.md
# @backstage/plugin-search-backend-node
## 0.0.0-nightly-20217521743
## 0.4.2
### Patch Changes
- a13f21cdc: Implement optional `pageCursor` based paging in search.
To use paging in your app, add a `<SearchResultPager />` to your
`SearchPage.tsx`.
- Updated dependencies
- @backstage/search-common@0.2.0
## 0.4.1
### Patch Changes
- d9c13d535: Implements configuration and indexing functionality for ElasticSearch search engine. Adds indexing, searching and default translator for ElasticSearch and modifies default backend example-app to use ES if it is configured.

@@ -75,3 +87,3 @@

- Updated dependencies
- @backstage/search-common@0.0.0-nightly-20217521743
- @backstage/search-common@0.1.3

@@ -78,0 +90,0 @@ ## 0.4.0

@@ -137,2 +137,3 @@ 'use strict';

}) => {
const pageSize = 25;
return {

@@ -177,3 +178,4 @@ lunrQueryBuilder: (q) => {

},
documentTypes: types
documentTypes: types,
pageSize
};

@@ -202,3 +204,3 @@ };

async query(query) {
const {lunrQueryBuilder, documentTypes} = this.translator(query);
const {lunrQueryBuilder, documentTypes, pageSize} = this.translator(query);
const results = [];

@@ -223,6 +225,14 @@ Object.keys(this.lunrIndices).filter((type) => !documentTypes || documentTypes.includes(type)).forEach((type) => {

});
const {page} = decodePageCursor(query.pageCursor);
const offset = page * pageSize;
const hasPreviousPage = page > 0;
const hasNextPage = results.length > offset + pageSize;
const nextPageCursor = hasNextPage ? encodePageCursor({page: page + 1}) : void 0;
const previousPageCursor = hasPreviousPage ? encodePageCursor({page: page - 1}) : void 0;
const realResultSet = {
results: results.map((d) => {
results: results.slice(offset, offset + pageSize).map((d) => {
return {type: d.type, document: this.docStore[d.result.ref]};
})
}),
nextPageCursor,
previousPageCursor
};

@@ -232,2 +242,13 @@ return realResultSet;

}
function decodePageCursor(pageCursor) {
if (!pageCursor) {
return {page: 0};
}
return {
page: Number(Buffer.from(pageCursor, "base64").toString("utf-8"))
};
}
function encodePageCursor({page}) {
return Buffer.from(`${page}`, "utf-8").toString("base64");
}

@@ -234,0 +255,0 @@ exports.IndexBuilder = IndexBuilder;

@@ -89,2 +89,3 @@ import { DocumentCollator, DocumentDecorator, SearchEngine, IndexableDocument, QueryTranslator, SearchQuery, SearchResultSet } from '@backstage/search-common';

documentTypes?: string[];
pageSize: number;
};

@@ -91,0 +92,0 @@ declare type LunrQueryTranslator = (query: SearchQuery) => ConcreteLunrQuery;

9

package.json
{
"name": "@backstage/plugin-search-backend-node",
"version": "0.0.0-nightly-20217521743",
"description": "A library for Backstage backend plugins that want to interact with the search backend plugin",
"version": "0.0.0-nightly-202191622432",
"main": "dist/index.cjs.js",

@@ -22,3 +23,3 @@ "types": "dist/index.d.ts",

"dependencies": {
"@backstage/search-common": "^0.0.0-nightly-20217521743",
"@backstage/search-common": "^0.0.0-nightly-202191622432",
"winston": "^3.2.1",

@@ -29,4 +30,4 @@ "lunr": "^2.3.9",

"devDependencies": {
"@backstage/backend-common": "^0.0.0-nightly-20217521743",
"@backstage/cli": "^0.0.0-nightly-20217521743"
"@backstage/backend-common": "^0.0.0-nightly-202191622432",
"@backstage/cli": "^0.0.0-nightly-202191622432"
},

@@ -33,0 +34,0 @@ "files": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc