New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/plugin-search-react

Package Overview
Dependencies
Maintainers
4
Versions
992
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/plugin-search-react - npm Package Compare versions

Comparing version 0.1.1-next.0 to 0.2.0-next.1

26

CHANGELOG.md
# @backstage/plugin-search-react
## 0.2.0-next.1
### Minor Changes
- bdbe620797: **BREAKING**: `SearchContextProviderForStorybook` and `SearchApiProviderForStorybook` has been deleted. New mock implementation of the `SearchApi` introduced. If you need to mock the api we recommend you to do the following:
```tsx
import {
searchApiRef,
MockSearchApi,
SearchContextProvider,
} from '@backstage/plugin-search-react';
import { TestApiProvider } from '@backstage/test-utils';
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
<SearchContextProvider>
<Component />
</SearchContextProvider>
</TestApiProvider>;
```
### Patch Changes
- Updated dependencies
- @backstage/core-plugin-api@1.0.2-next.0
## 0.1.1-next.0

@@ -4,0 +30,0 @@

44

dist/index.d.ts
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
import { SearchQuery, SearchResultSet } from '@backstage/plugin-search-common';
import { JsonObject } from '@backstage/types';
import React, { PropsWithChildren, ComponentProps } from 'react';
import React, { PropsWithChildren } from 'react';
import { AsyncState } from 'react-use/lib/useAsync';

@@ -17,2 +17,12 @@

}
/**
* @public
*
* Search Api Mock that can be used in tests and storybooks
*/
declare class MockSearchApi implements SearchApi {
mockedResults?: SearchResultSet | undefined;
constructor(mockedResults?: SearchResultSet | undefined);
query(): Promise<SearchResultSet>;
}

@@ -69,32 +79,2 @@ /**

/**
* Props for {@link SearchApiProviderForStorybook}
* @public
*/
declare type SearchApiProviderForStorybookProps = ComponentProps<typeof SearchContextProvider> & {
mockedResults?: SearchResultSet;
};
/**
* Props for {@link SearchContextProviderForStorybook}
* @public
*/
declare type SearchContextProviderForStorybookProps = PropsWithChildren<{
mockedResults?: SearchResultSet;
}>;
/**
* Utility api provider only for use in Storybook stories.
*
* @public
*/
declare function SearchApiProviderForStorybook(props: SearchApiProviderForStorybookProps): JSX.Element;
/**
* Utility context provider only for use in Storybook stories. You should use
* the real `<SearchContextProvider>` exported by `@backstage/plugin-search-react` in
* your app instead of this! In some cases (like the search page) it may
* already be provided on your behalf.
*
* @public
*/
declare const SearchContextProviderForStorybook: (props: SearchContextProviderForStorybookProps) => JSX.Element;
export { SearchApi, SearchApiProviderForStorybook, SearchApiProviderForStorybookProps, SearchContextProvider, SearchContextProviderForStorybook, SearchContextProviderForStorybookProps, SearchContextProviderProps, SearchContextState, SearchContextValue, searchApiRef, useSearch, useSearchContextCheck };
export { MockSearchApi, SearchApi, SearchContextProvider, SearchContextProviderProps, SearchContextState, SearchContextValue, searchApiRef, useSearch, useSearchContextCheck };

@@ -6,4 +6,2 @@ import { createApiRef, useApi, AnalyticsContext } from '@backstage/core-plugin-api';

import usePrevious from 'react-use/lib/usePrevious';
import { ApiProvider } from '@backstage/core-app-api';
import { TestApiRegistry } from '@backstage/test-utils';

@@ -13,2 +11,10 @@ const searchApiRef = createApiRef({

});
class MockSearchApi {
constructor(mockedResults) {
this.mockedResults = mockedResults;
}
query() {
return Promise.resolve(this.mockedResults || { results: [] });
}
}

@@ -89,20 +95,3 @@ const SearchContext = createVersionedContext("search-context");

function SearchApiProviderForStorybook(props) {
const { mockedResults, children } = props;
const query = () => Promise.resolve(mockedResults || {});
const apiRegistry = TestApiRegistry.from([searchApiRef, { query }]);
return /* @__PURE__ */ React.createElement(ApiProvider, {
apis: apiRegistry,
children
});
}
const SearchContextProviderForStorybook = (props) => {
return /* @__PURE__ */ React.createElement(SearchApiProviderForStorybook, {
...props
}, /* @__PURE__ */ React.createElement(SearchContextProvider, {
children: props.children
}));
};
export { SearchApiProviderForStorybook, SearchContextProvider, SearchContextProviderForStorybook, searchApiRef, useSearch, useSearchContextCheck };
export { MockSearchApi, SearchContextProvider, searchApiRef, useSearch, useSearchContextCheck };
//# sourceMappingURL=index.esm.js.map
{
"name": "@backstage/plugin-search-react",
"version": "0.1.1-next.0",
"version": "0.2.0-next.1",
"main": "dist/index.esm.js",

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

"dependencies": {
"@backstage/core-plugin-api": "^1.0.1",
"@backstage/core-plugin-api": "^1.0.2-next.0",
"@backstage/plugin-search-common": "^0.3.3",

@@ -46,4 +46,4 @@ "@backstage/types": "^1.0.0",

"devDependencies": {
"@backstage/core-app-api": "^1.0.1",
"@backstage/test-utils": "^1.0.2-next.0",
"@backstage/core-app-api": "^1.0.2-next.0",
"@backstage/test-utils": "^1.1.0-next.1",
"@testing-library/jest-dom": "^5.10.1",

@@ -56,3 +56,3 @@ "@testing-library/react": "^12.1.3",

],
"gitHead": "88ee375f5ee44b7a7917297785ddf88691fe3381"
"gitHead": "0b3df66a238c66a5498dab85b1ed85a8607289f1"
}

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