@algolia/wizard 0.9.0-rc.76.66 → 0.9.0-rc.77.67
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/dist/main.js
CHANGED
|
@@ -2414,6 +2414,48 @@ var LANGUAGE_PROFILES = {
|
|
|
2414
2414
|
verification: [],
|
|
2415
2415
|
envReadInstruction: "Read them from `ENV.fetch('NAME')`.",
|
|
2416
2416
|
skipDirs: ["vendor", "tmp", "log", "coverage"]
|
|
2417
|
+
},
|
|
2418
|
+
php: {
|
|
2419
|
+
id: "php",
|
|
2420
|
+
displayName: "PHP",
|
|
2421
|
+
aliases: ["php", "laravel", "symfony"],
|
|
2422
|
+
manifests: ["composer.json"],
|
|
2423
|
+
packageManagers: [
|
|
2424
|
+
{
|
|
2425
|
+
id: "composer",
|
|
2426
|
+
// `composer require` both declares and installs, and unlike editing
|
|
2427
|
+
// composer.json by hand it can't leave composer.lock out of date (which
|
|
2428
|
+
// makes a later `composer install` refuse to run).
|
|
2429
|
+
dependency: { mode: "wizard-installs" },
|
|
2430
|
+
installSteps: [
|
|
2431
|
+
{
|
|
2432
|
+
argv: [
|
|
2433
|
+
"composer",
|
|
2434
|
+
"require",
|
|
2435
|
+
"algolia/algoliasearch-client-php:^4",
|
|
2436
|
+
"--no-interaction",
|
|
2437
|
+
// Repo post-install scripts are the project's code, not ours to
|
|
2438
|
+
// trigger; Laravel's package:discover also fails in a bare tree.
|
|
2439
|
+
"--no-scripts"
|
|
2440
|
+
]
|
|
2441
|
+
}
|
|
2442
|
+
],
|
|
2443
|
+
ingest: {
|
|
2444
|
+
kind: "auto",
|
|
2445
|
+
argv: ["php", ENTRYPOINT_TOKEN],
|
|
2446
|
+
entrypointExtensions: [".php"]
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
],
|
|
2450
|
+
sdk: {
|
|
2451
|
+
packageName: "algolia/algoliasearch-client-php",
|
|
2452
|
+
versionPin: "^4",
|
|
2453
|
+
docKey: "php"
|
|
2454
|
+
},
|
|
2455
|
+
ingestEntrypointExample: `${INGEST_DIR}/ingest.php`,
|
|
2456
|
+
verification: [],
|
|
2457
|
+
envReadInstruction: "Read them from `getenv('NAME')`.",
|
|
2458
|
+
skipDirs: ["vendor", "node_modules"]
|
|
2417
2459
|
}
|
|
2418
2460
|
};
|
|
2419
2461
|
var DEFAULT_LANGUAGE_ID = "javascript";
|
|
@@ -3096,7 +3138,7 @@ var detectLanguageSchema = z16.object({
|
|
|
3096
3138
|
var detectLanguage = () => runAgent({
|
|
3097
3139
|
instructions: [
|
|
3098
3140
|
"Analyze the codebase and determine the programming languages and frameworks used",
|
|
3099
|
-
"Start from the dependency manifests: package.json, pyproject.toml, requirements.txt, Gemfile.",
|
|
3141
|
+
"Start from the dependency manifests: package.json, pyproject.toml, requirements.txt, Gemfile, composer.json.",
|
|
3100
3142
|
"List the language that owns the backend/data code first \u2014 that is the one an ingestion script will be written in.",
|
|
3101
3143
|
"If a superset language is found, exclude the subset language. TS-over-JS.",
|
|
3102
3144
|
"If a meta-framework is used, exclude the framework. Next-over-React.",
|
|
@@ -3149,7 +3191,7 @@ var MODE_CONFIG = {
|
|
|
3149
3191
|
"Analyze the codebase to find the data entities (models) that should be ingested into Algolia.",
|
|
3150
3192
|
"For each entity, return its name, the file path(s) where it is defined, and its indexable attribute keys (the fields a user would search or filter on).",
|
|
3151
3193
|
"Inspect the source of each entity to extract real field names for attributes \u2014 do not guess or leave attributes empty.",
|
|
3152
|
-
"Entities live wherever the stack keeps them: TypeScript interfaces or a Prisma schema, Django models.py, Rails app/models, Pydantic models.",
|
|
3194
|
+
"Entities live wherever the stack keeps them: TypeScript interfaces or a Prisma schema, Django models.py, Rails app/models, Laravel Eloquent models, Pydantic models.",
|
|
3153
3195
|
"Prefer domain models (e.g. Document, Product, User) over framework or infrastructure types.",
|
|
3154
3196
|
"Use as few tools as possible, but do not guess. If you cannot find any entities, return an empty array.",
|
|
3155
3197
|
"Ignore directories that may be related to testing, like `/fixtures`, `/tests`, etc",
|
|
@@ -3172,7 +3214,7 @@ var MODE_CONFIG = {
|
|
|
3172
3214
|
verification: {
|
|
3173
3215
|
instructions: [
|
|
3174
3216
|
"Analyze the codebase to determine which code-quality tools are available to validate changes.",
|
|
3175
|
-
"Look at the dependency manifest and config files for the project's languages: package.json scripts with tsconfig/eslint/prettier, pyproject.toml or setup.cfg (ruff, mypy, black), Gemfile with .rubocop.yml.",
|
|
3217
|
+
"Look at the dependency manifest and config files for the project's languages: package.json scripts with tsconfig/eslint/prettier, pyproject.toml or setup.cfg (ruff, mypy, black), Gemfile with .rubocop.yml, composer.json scripts (phpstan, pint).",
|
|
3176
3218
|
'Return the tool names as an array, e.g. ["eslint", "prettier", "tsc"] or ["ruff", "mypy"].',
|
|
3177
3219
|
"Use as few tools as possible, but do not guess. If you cannot find any, return an empty array.",
|
|
3178
3220
|
"Ignore directories that may be related to testing, like `/fixtures`, `/tests`, etc",
|
|
@@ -3200,7 +3242,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3200
3242
|
// package.json
|
|
3201
3243
|
var package_default = {
|
|
3202
3244
|
name: "@algolia/wizard",
|
|
3203
|
-
version: "0.9.0-rc.
|
|
3245
|
+
version: "0.9.0-rc.77.67",
|
|
3204
3246
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3205
3247
|
type: "module",
|
|
3206
3248
|
engines: {
|
|
@@ -18,6 +18,7 @@ Install the latest stable within the major; never pin an exact patch.
|
|
|
18
18
|
| JavaScript/TypeScript | `algoliasearch` | `^5` |
|
|
19
19
|
| Python | `algoliasearch` | `>=4,<5` |
|
|
20
20
|
| Ruby | `algolia` | `~> 3.0` |
|
|
21
|
+
| PHP | `algolia/algoliasearch-client-php` | `^4` |
|
|
21
22
|
|
|
22
23
|
## Search UI
|
|
23
24
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Save records (algoliasearch-client-php v4)
|
|
2
|
+
|
|
3
|
+
Adds records to an index. Write op — use a **write key**, server-side only.
|
|
4
|
+
|
|
5
|
+
Dependency: `algolia/algoliasearch-client-php` `^4` — the wizard runs
|
|
6
|
+
`composer require` for you; do not hand-edit `composer.json`.
|
|
7
|
+
|
|
8
|
+
`require 'vendor/autoload.php'` before anything else, or the class won't resolve
|
|
9
|
+
(from `.algolia-wizard/` the path is `__DIR__.'/../vendor/autoload.php'`).
|
|
10
|
+
|
|
11
|
+
```php
|
|
12
|
+
<?php
|
|
13
|
+
|
|
14
|
+
require __DIR__.'/../vendor/autoload.php';
|
|
15
|
+
|
|
16
|
+
use Algolia\AlgoliaSearch\Api\SearchClient;
|
|
17
|
+
|
|
18
|
+
$appId = getenv('ALGOLIA_APPLICATION_ID');
|
|
19
|
+
$apiKey = getenv('ALGOLIA_WRITE_API_KEY');
|
|
20
|
+
$indexName = 'playlists';
|
|
21
|
+
|
|
22
|
+
$client = SearchClient::create($appId, $apiKey);
|
|
23
|
+
$records = [['objectID' => '1', 'name' => 'Hot 100', 'visibility' => 'public']];
|
|
24
|
+
|
|
25
|
+
$responses = $client->saveObjects($indexName, $records, true);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```php
|
|
29
|
+
saveObjects(
|
|
30
|
+
string $indexName, // required
|
|
31
|
+
array $objects, // required
|
|
32
|
+
bool $waitForTasks = false,
|
|
33
|
+
int $batchSize = 1000,
|
|
34
|
+
array $requestOptions = []
|
|
35
|
+
) // => array of batch responses, one per 1,000-record batch
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Unlike the typed clients, PHP returns **plain associative arrays**, not objects:
|
|
39
|
+
`$responses[0]['taskID']`, `$responses[0]['objectIDs']`. Always an array of them —
|
|
40
|
+
never treat it as one response.
|
|
41
|
+
|
|
42
|
+
Read records from a JSON file:
|
|
43
|
+
|
|
44
|
+
```php
|
|
45
|
+
$records = json_decode(file_get_contents($recordsPath), true);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After a successful ingest, print `ALGOLIA_WIZARD_RECORD_COUNT=<n>` as the last
|
|
49
|
+
stdout line (`echo 'ALGOLIA_WIZARD_RECORD_COUNT='.count($records)."\n";`), with no
|
|
50
|
+
other output after it.
|