@algolia/wizard 0.36.0 → 0.38.0-rc.131.265

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.
@@ -4,13 +4,18 @@ Install `instantsearch.js` (v4)
4
4
 
5
5
  ## Search client: always use the lite client
6
6
 
7
- Import the client from `algoliasearch/lite` and alias it to `algoliasearch`
7
+ Import the client from `algoliasearch/lite` and alias it to `algoliasearch`.
8
+ `ALGOLIA_APP_ID`, `ALGOLIA_SEARCH_API_KEY`, and `ALGOLIA_INDEX_NAME` below are
9
+ the constants exported from the project's shared client-side config module —
10
+ these are public values, safe to commit; never hardcode them inline or read
11
+ them from an env var.
8
12
 
9
13
  ```ts
10
14
  import { liteClient as algoliasearch } from 'algoliasearch/lite'
15
+ import { ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY } from '<the project's shared config module>'
11
16
 
12
17
  // Instantiate ONCE, outside components, with a stable reference.
13
- const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
18
+ const searchClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY)
14
19
  ```
15
20
 
16
21
  ## Vanilla (`instantsearch.js` v4)
@@ -19,11 +24,16 @@ const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
19
24
  import { liteClient as algoliasearch } from 'algoliasearch/lite'
20
25
  import instantsearch from 'instantsearch.js'
21
26
  import { searchBox, hits } from 'instantsearch.js/es/widgets'
27
+ import {
28
+ ALGOLIA_APP_ID,
29
+ ALGOLIA_SEARCH_API_KEY,
30
+ ALGOLIA_INDEX_NAME,
31
+ } from '<the project's shared config module>'
22
32
 
23
- const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
33
+ const searchClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY)
24
34
 
25
35
  const search = instantsearch({
26
- indexName: 'INDEX_NAME',
36
+ indexName: ALGOLIA_INDEX_NAME,
27
37
  searchClient,
28
38
  insights: true,
29
39
  })
@@ -53,7 +63,7 @@ case, install `search-insights` from npm and pass its default export as
53
63
  import aa from 'search-insights'
54
64
 
55
65
  const search = instantsearch({
56
- indexName: 'INDEX_NAME',
66
+ indexName: ALGOLIA_INDEX_NAME,
57
67
  searchClient,
58
68
  insights: { insightsClient: aa },
59
69
  })
@@ -4,13 +4,18 @@ Install `react-instantsearch` (v7)
4
4
 
5
5
  ## Search client: always use the lite client
6
6
 
7
- Import the client from `algoliasearch/lite` and alias it to `algoliasearch`
7
+ Import the client from `algoliasearch/lite` and alias it to `algoliasearch`.
8
+ `ALGOLIA_APP_ID`, `ALGOLIA_SEARCH_API_KEY`, and `ALGOLIA_INDEX_NAME` below are
9
+ the constants exported from the project's shared client-side config module —
10
+ these are public values, safe to commit; never hardcode them inline or read
11
+ them from an env var.
8
12
 
9
13
  ```ts
10
14
  import { liteClient as algoliasearch } from 'algoliasearch/lite'
15
+ import { ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY } from '<the project's shared config module>'
11
16
 
12
17
  // Instantiate ONCE, outside components, with a stable reference.
13
- const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
18
+ const searchClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY)
14
19
  ```
15
20
 
16
21
  ## React (`react-instantsearch` v7)
@@ -18,19 +23,19 @@ const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
18
23
  ```tsx
19
24
  import { liteClient as algoliasearch } from 'algoliasearch/lite'
20
25
  import { InstantSearch, SearchBox, Hits } from 'react-instantsearch'
26
+ import {
27
+ ALGOLIA_APP_ID,
28
+ ALGOLIA_SEARCH_API_KEY,
29
+ ALGOLIA_INDEX_NAME,
30
+ } from '<the project's shared config module>'
21
31
 
22
- // Read from PUBLIC env vars; never hardcode. (Vite shown; use the framework's
23
- // convention: NEXT_PUBLIC_* for Next.js, etc.)
24
- const searchClient = algoliasearch(
25
- import.meta.env.VITE_ALGOLIA_APP_ID,
26
- import.meta.env.VITE_ALGOLIA_SEARCH_API_KEY,
27
- )
32
+ const searchClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY)
28
33
 
29
34
  export function Search() {
30
35
  return (
31
36
  <InstantSearch
32
37
  searchClient={searchClient}
33
- indexName="INDEX_NAME"
38
+ indexName={ALGOLIA_INDEX_NAME}
34
39
  insights={true}
35
40
  >
36
41
  <SearchBox />
@@ -4,13 +4,18 @@ Install `vue-instantsearch` (v4)
4
4
 
5
5
  ## Search client: always use the lite client
6
6
 
7
- Import the client from `algoliasearch/lite` and alias it to `algoliasearch`
7
+ Import the client from `algoliasearch/lite` and alias it to `algoliasearch`.
8
+ `ALGOLIA_APP_ID`, `ALGOLIA_SEARCH_API_KEY`, and `ALGOLIA_INDEX_NAME` below are
9
+ the constants exported from the project's shared client-side config module —
10
+ these are public values, safe to commit; never hardcode them inline or read
11
+ them from an env var.
8
12
 
9
13
  ```ts
10
14
  import { liteClient as algoliasearch } from 'algoliasearch/lite'
15
+ import { ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY } from '<the project's shared config module>'
11
16
 
12
17
  // Instantiate ONCE, outside components, with a stable reference.
13
- const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
18
+ const searchClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY)
14
19
  ```
15
20
 
16
21
  ## Vue (`vue-instantsearch` v4)
@@ -19,7 +24,7 @@ const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
19
24
  <template>
20
25
  <ais-instant-search
21
26
  :search-client="searchClient"
22
- index-name="INDEX_NAME"
27
+ :index-name="ALGOLIA_INDEX_NAME"
23
28
  :insights="true"
24
29
  >
25
30
  <ais-search-box />
@@ -29,11 +34,13 @@ const searchClient = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
29
34
 
30
35
  <script setup>
31
36
  import { liteClient as algoliasearch } from 'algoliasearch/lite'
37
+ import {
38
+ ALGOLIA_APP_ID,
39
+ ALGOLIA_SEARCH_API_KEY,
40
+ ALGOLIA_INDEX_NAME,
41
+ } from '<the project's shared config module>'
32
42
 
33
- const searchClient = algoliasearch(
34
- import.meta.env.VITE_ALGOLIA_APP_ID,
35
- import.meta.env.VITE_ALGOLIA_SEARCH_API_KEY,
36
- )
43
+ const searchClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY)
37
44
  </script>
38
45
  ```
39
46
 
@@ -5,10 +5,19 @@ route, or programmatic queries). For UI, prefer `instantsearch-setup-<framework>
5
5
 
6
6
  ## Client
7
7
 
8
+ `ALGOLIA_APP_ID`, `ALGOLIA_SEARCH_API_KEY`, and `ALGOLIA_INDEX_NAME` below are
9
+ the constants exported from the project's shared client-side config module —
10
+ these are public values, safe to commit; never hardcode them inline or read
11
+ them from an env var.
12
+
8
13
  ```ts
9
14
  import { algoliasearch } from 'algoliasearch'
15
+ import {
16
+ ALGOLIA_APP_ID,
17
+ ALGOLIA_SEARCH_API_KEY,
18
+ } from '<the project's shared config module>'
10
19
 
11
- const client = algoliasearch(APP_ID, SEARCH_ONLY_KEY)
20
+ const client = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY)
12
21
  ```
13
22
 
14
23
  In v5 there is no `client.initIndex(...)`. Index methods take the index name as a
@@ -18,7 +27,7 @@ parameter on the client. Every method takes a single options object.
18
27
 
19
28
  ```ts
20
29
  const { hits, nbHits } = await client.searchSingleIndex({
21
- indexName: 'INDEX_NAME',
30
+ indexName: ALGOLIA_INDEX_NAME,
22
31
  searchParams: { query: 'shoes', hitsPerPage: 20, page: 0 },
23
32
  })
24
33
  ```
@@ -28,7 +37,7 @@ const { hits, nbHits } = await client.searchSingleIndex({
28
37
  ```ts
29
38
  const { results } = await client.search({
30
39
  requests: [
31
- { indexName: 'INDEX_NAME', query: 'shoes' },
40
+ { indexName: ALGOLIA_INDEX_NAME, query: 'shoes' },
32
41
  { indexName: 'OTHER_INDEX', query: 'shoes' },
33
42
  ],
34
43
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.36.0",
3
+ "version": "0.38.0-rc.131.265",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {
@@ -24,6 +24,7 @@
24
24
  "reset": "tsx ./scripts/reset-state.ts",
25
25
  "test:fixtures": "touch .env && tsx --env-file=.env ./fixtures/run-fixtures.ts",
26
26
  "test:tools": "tsx ./tool-evals/toolEval.ts",
27
+ "test:tools:improve": "tsx ./tool-evals/improveFromPlan.ts",
27
28
  "test": "vitest",
28
29
  "typecheck": "tsc --noEmit -p tsconfig.json"
29
30
  },