@backstage/plugin-search-react 1.7.4-next.1 → 1.7.4-next.2

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
@@ -1,5 +1,19 @@
1
1
  # @backstage/plugin-search-react
2
2
 
3
+ ## 1.7.4-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 36c94b8: Refactor of the alpha exports due to API change in how extension IDs are constructed.
8
+ - Updated dependencies
9
+ - @backstage/frontend-plugin-api@0.4.0-next.2
10
+ - @backstage/theme@0.5.0-next.1
11
+ - @backstage/core-components@0.13.9-next.2
12
+ - @backstage/core-plugin-api@1.8.1-next.1
13
+ - @backstage/types@1.1.1
14
+ - @backstage/version-bridge@1.0.7
15
+ - @backstage/plugin-search-common@1.2.8
16
+
3
17
  ## 1.7.4-next.1
4
18
 
5
19
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "1.7.4-next.1",
3
+ "version": "1.7.4-next.2",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.d.ts CHANGED
@@ -23,9 +23,13 @@ type SearchResultItemExtensionOptions<TConfig extends {
23
23
  noTrack?: boolean;
24
24
  }> = {
25
25
  /**
26
- * The extension id.
26
+ * The extension namespace.
27
27
  */
28
- id: string;
28
+ namespace?: string;
29
+ /**
30
+ * The extension name.
31
+ */
32
+ name?: string;
29
33
  /**
30
34
  * The extension attachment point (e.g., search modal or page).
31
35
  */
@@ -52,6 +56,6 @@ type SearchResultItemExtensionOptions<TConfig extends {
52
56
  /** @alpha */
53
57
  declare function createSearchResultListItemExtension<TConfig extends {
54
58
  noTrack?: boolean;
55
- }>(options: SearchResultItemExtensionOptions<TConfig>): _backstage_frontend_plugin_api.Extension<TConfig>;
59
+ }>(options: SearchResultItemExtensionOptions<TConfig>): _backstage_frontend_plugin_api.ExtensionDefinition<TConfig>;
56
60
 
57
61
  export { BaseSearchResultListItemProps, SearchResultItemExtensionComponent, SearchResultItemExtensionOptions, SearchResultItemExtensionPredicate, createSearchResultListItemExtension, searchResultItemExtensionData };
package/dist/alpha.esm.js CHANGED
@@ -9,16 +9,17 @@ import '@backstage/core-components';
9
9
  const searchResultItemExtensionData = createExtensionDataRef("plugin.search.result.item.data");
10
10
  function createSearchResultListItemExtension(options) {
11
11
  var _a;
12
- const id = `plugin.search.result.item.${options.id}`;
13
12
  const configSchema = "configSchema" in options ? options.configSchema : createSchemaFromZod(
14
13
  (z) => z.object({
15
14
  noTrack: z.boolean().default(false)
16
15
  })
17
16
  );
18
17
  return createExtension({
19
- id,
18
+ kind: "search-result-list-item",
19
+ namespace: options.namespace,
20
+ name: options.name,
20
21
  attachTo: (_a = options.attachTo) != null ? _a : {
21
- id: "plugin.search.page",
22
+ id: "page:search",
22
23
  input: "items"
23
24
  },
24
25
  configSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 React, { lazy } from 'react';\n\nimport { ListItemProps } from '@material-ui/core';\n\nimport {\n ExtensionBoundary,\n PortableSchema,\n createExtension,\n createExtensionDataRef,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport { SearchDocument, SearchResult } from '@backstage/plugin-search-common';\n\nimport { SearchResultListItemExtension } from './extensions';\n\n/** @alpha */\nexport type BaseSearchResultListItemProps<T = {}> = T & {\n rank?: number;\n result?: SearchDocument;\n} & Omit<ListItemProps, 'button'>;\n\n/** @alpha */\nexport type SearchResultItemExtensionComponent = <\n P extends BaseSearchResultListItemProps,\n>(\n props: P,\n) => JSX.Element | null;\n\n/** @alpha */\nexport type SearchResultItemExtensionPredicate = (\n result: SearchResult,\n) => boolean;\n\n/** @alpha */\nexport const searchResultItemExtensionData = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>('plugin.search.result.item.data');\n\n/** @alpha */\nexport type SearchResultItemExtensionOptions<\n TConfig extends { noTrack?: boolean },\n> = {\n /**\n * The extension id.\n */\n id: string;\n /**\n * The extension attachment point (e.g., search modal or page).\n */\n attachTo?: { id: string; input: string };\n /**\n * Optional extension config schema.\n */\n configSchema?: PortableSchema<TConfig>;\n /**\n * The extension component.\n */\n component: (options: {\n config: TConfig;\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n};\n\n/** @alpha */\nexport function createSearchResultListItemExtension<\n TConfig extends { noTrack?: boolean },\n>(options: SearchResultItemExtensionOptions<TConfig>) {\n const id = `plugin.search.result.item.${options.id}`;\n\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({\n noTrack: z.boolean().default(false),\n }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n id,\n attachTo: options.attachTo ?? {\n id: 'plugin.search.page',\n input: 'items',\n },\n configSchema,\n output: {\n item: searchResultItemExtensionData,\n },\n factory({ config, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .component({ config })\n .then(component => ({ default: component })),\n ) as unknown as SearchResultItemExtensionComponent;\n\n return {\n item: {\n predicate: options.predicate,\n component: props => (\n <ExtensionBoundary node={node}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >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,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,IACjB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,6BAAA;AAAA,YAAA;AAAA,cACC,MAAM,KAAM,CAAA,IAAA;AAAA,cACZ,QAAQ,KAAM,CAAA,MAAA;AAAA,cACd,SAAS,MAAO,CAAA,OAAA;AAAA,aAAA;AAAA,4BAEhB,KAAA,CAAA,aAAA,CAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,WAEnC,CAAA;AAAA,SAEJ;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 React, { lazy } from 'react';\n\nimport { ListItemProps } from '@material-ui/core';\n\nimport {\n ExtensionBoundary,\n PortableSchema,\n createExtension,\n createExtensionDataRef,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport { SearchDocument, SearchResult } from '@backstage/plugin-search-common';\n\nimport { SearchResultListItemExtension } from './extensions';\n\n/** @alpha */\nexport type BaseSearchResultListItemProps<T = {}> = T & {\n rank?: number;\n result?: SearchDocument;\n} & Omit<ListItemProps, 'button'>;\n\n/** @alpha */\nexport type SearchResultItemExtensionComponent = <\n P extends BaseSearchResultListItemProps,\n>(\n props: P,\n) => JSX.Element | null;\n\n/** @alpha */\nexport type SearchResultItemExtensionPredicate = (\n result: SearchResult,\n) => boolean;\n\n/** @alpha */\nexport const searchResultItemExtensionData = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>('plugin.search.result.item.data');\n\n/** @alpha */\nexport type SearchResultItemExtensionOptions<\n TConfig extends { noTrack?: boolean },\n> = {\n /**\n * The extension namespace.\n */\n namespace?: string;\n /**\n * The extension name.\n */\n name?: string;\n /**\n * The extension attachment point (e.g., search modal or page).\n */\n attachTo?: { id: string; input: string };\n /**\n * Optional extension config schema.\n */\n configSchema?: PortableSchema<TConfig>;\n /**\n * The extension component.\n */\n component: (options: {\n config: TConfig;\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n};\n\n/** @alpha */\nexport function createSearchResultListItemExtension<\n TConfig extends { noTrack?: boolean },\n>(options: SearchResultItemExtensionOptions<TConfig>) {\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({\n noTrack: z.boolean().default(false),\n }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n kind: 'search-result-list-item',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? {\n id: 'page:search',\n input: 'items',\n },\n configSchema,\n output: {\n item: searchResultItemExtensionData,\n },\n factory({ config, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .component({ config })\n .then(component => ({ default: component })),\n ) as unknown as SearchResultItemExtensionComponent;\n\n return {\n item: {\n predicate: options.predicate,\n component: props => (\n <ExtensionBoundary node={node}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <ExtensionComponent {...props} />\n </SearchResultListItemExtension>\n </ExtensionBoundary>\n ),\n },\n };\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;AAkDa,MAAA,6BAAA,GAAgC,uBAG1C,gCAAgC,EAAA;AAoC5B,SAAS,oCAEd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AAA,MAAA;AAAA,cACd,SAAS,MAAO,CAAA,OAAA;AAAA,aAAA;AAAA,4BAEhB,KAAA,CAAA,aAAA,CAAC,kBAAoB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,WAEnC,CAAA;AAAA,SAEJ;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "1.7.4-next.1",
3
+ "version": "1.7.4-next.2",
4
4
  "main": "./dist/index.esm.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -43,11 +43,11 @@
43
43
  "start": "backstage-cli package start"
44
44
  },
45
45
  "dependencies": {
46
- "@backstage/core-components": "^0.13.9-next.1",
46
+ "@backstage/core-components": "^0.13.9-next.2",
47
47
  "@backstage/core-plugin-api": "^1.8.1-next.1",
48
- "@backstage/frontend-plugin-api": "^0.4.0-next.1",
48
+ "@backstage/frontend-plugin-api": "^0.4.0-next.2",
49
49
  "@backstage/plugin-search-common": "^1.2.8",
50
- "@backstage/theme": "^0.5.0-next.0",
50
+ "@backstage/theme": "^0.5.0-next.1",
51
51
  "@backstage/types": "^1.1.1",
52
52
  "@backstage/version-bridge": "^1.0.7",
53
53
  "@material-ui/core": "^4.12.2",
@@ -64,11 +64,11 @@
64
64
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@backstage/cli": "^0.25.0-next.1",
67
+ "@backstage/cli": "^0.25.0-next.2",
68
68
  "@backstage/core-app-api": "^1.11.2-next.1",
69
- "@backstage/frontend-app-api": "^0.4.0-next.1",
70
- "@backstage/frontend-test-utils": "^0.1.0-next.1",
71
- "@backstage/test-utils": "^1.4.6-next.1",
69
+ "@backstage/frontend-app-api": "^0.4.0-next.2",
70
+ "@backstage/frontend-test-utils": "^0.1.0-next.2",
71
+ "@backstage/test-utils": "^1.4.6-next.2",
72
72
  "@testing-library/dom": "^9.0.0",
73
73
  "@testing-library/jest-dom": "^6.0.0",
74
74
  "@testing-library/react": "^14.0.0",