This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

102
angular.json Normal file
View File

@@ -0,0 +1,102 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"first-app": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"inlineTemplate": true,
"inlineStyle": true,
"style": "scss",
"skipTests": true
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:interceptor": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:resolver": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": "dist/first-app",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "first-app:build:production"
},
"development": {
"buildTarget": "first-app:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular/build:extract-i18n",
"options": {
"buildTarget": "first-app:build"
}
}
}
}
},
"cli": {
"analytics": "adc9b1d4-eb29-44a7-a415-4a1995b64857"
}
}

1
node_modules/.bin/acorn generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../acorn/bin/acorn

1
node_modules/.bin/baseline-browser-mapping generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../baseline-browser-mapping/dist/cli.js

1
node_modules/.bin/browserslist generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../browserslist/cli.js

1
node_modules/.bin/download-lmdb-prebuilds generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../lmdb/bin/download-prebuilds.js

1
node_modules/.bin/download-msgpackr-prebuilds generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../msgpackr-extract/bin/download-prebuilds.js

1
node_modules/.bin/errno generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../errno/cli.js

1
node_modules/.bin/esbuild generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../esbuild/bin/esbuild

1
node_modules/.bin/glob generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../glob/dist/esm/bin.mjs

1
node_modules/.bin/image-size generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../image-size/bin/image-size.js

1
node_modules/.bin/installed-package-contents generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../@npmcli/installed-package-contents/bin/index.js

1
node_modules/.bin/jsesc generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../jsesc/bin/jsesc

1
node_modules/.bin/json5 generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../json5/lib/cli.js

1
node_modules/.bin/lessc generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../less/bin/lessc

1
node_modules/.bin/mime generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mime/cli.js

1
node_modules/.bin/mkdirp generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mkdirp/bin/cmd.js

1
node_modules/.bin/nanoid generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../nanoid/bin/nanoid.cjs

1
node_modules/.bin/needle generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../needle/bin/needle

1
node_modules/.bin/ng generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../@angular/cli/bin/ng.js

1
node_modules/.bin/ng-xi18n generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../@angular/compiler-cli/bundles/src/bin/ng_xi18n.js

1
node_modules/.bin/ngc generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../@angular/compiler-cli/bundles/src/bin/ngc.js

1
node_modules/.bin/node-gyp generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../node-gyp/bin/node-gyp.js

1
node_modules/.bin/node-gyp-build-optional-packages generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../node-gyp-build-optional-packages/bin.js

View File

@@ -0,0 +1 @@
../node-gyp-build-optional-packages/optional.js

1
node_modules/.bin/node-gyp-build-optional-packages-test generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../node-gyp-build-optional-packages/build-test.js

1
node_modules/.bin/node-which generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../which/bin/node-which

1
node_modules/.bin/nopt generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../nopt/bin/nopt.js

1
node_modules/.bin/pacote generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../pacote/bin/index.js

1
node_modules/.bin/parser generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../@babel/parser/bin/babel-parser.js

1
node_modules/.bin/resolve generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../resolve/bin/resolve

1
node_modules/.bin/rollup generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../rollup/dist/bin/rollup

1
node_modules/.bin/sass generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../sass/sass.js

1
node_modules/.bin/semver generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../semver/bin/semver.js

1
node_modules/.bin/ts-node generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../ts-node/dist/bin.js

1
node_modules/.bin/ts-node-cwd generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../ts-node/dist/bin-cwd.js

1
node_modules/.bin/ts-node-esm generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../ts-node/dist/bin-esm.js

1
node_modules/.bin/ts-node-script generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../ts-node/dist/bin-script.js

1
node_modules/.bin/ts-node-transpile-only generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../ts-node/dist/bin-transpile.js

1
node_modules/.bin/ts-script generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../ts-node/dist/bin-script-deprecated.js

1
node_modules/.bin/tsc generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../typescript/bin/tsc

1
node_modules/.bin/tsserver generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../typescript/bin/tsserver

1
node_modules/.bin/update-browserslist-db generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../update-browserslist-db/cli.js

7291
node_modules/.package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

21
node_modules/@algolia/abtesting/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-Present Algolia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

77
node_modules/@algolia/abtesting/README.md generated vendored Normal file
View File

@@ -0,0 +1,77 @@
<p align="center">
<a href="https://www.algolia.com">
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
</a>
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
<p align="center">
<a href="https://npmjs.org/package/@algolia/abtesting"><img src="https://img.shields.io/npm/v/@algolia/abtesting.svg?style=flat-square" alt="NPM version"></img></a>
<a href="http://npm-stat.com/charts.html?package=@algolia/abtesting"><img src="https://img.shields.io/npm/dm/@algolia/abtesting.svg?style=flat-square" alt="NPM downloads"></a>
<a href="https://www.jsdelivr.com/package/npm/@algolia/abtesting"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/abtesting/badge" alt="jsDelivr Downloads"></img></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
</p>
</p>
<p align="center">
<a href="https://www.algolia.com/doc/libraries/javascript/" target="_blank">Documentation</a>
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a>
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a>
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a>
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a>
<a href="https://www.algolia.com/doc/libraries/javascript/v5/" target="_blank">FAQ</a>
<a href="https://alg.li/support" target="_blank">Support</a>
</p>
## ✨ Features
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
- Works both on the **browser** and **node.js**
- **UMD and ESM compatible**, you can use it with any module loader
- Built with TypeScript
## 💡 Getting Started
> [!TIP]
> This API client is already a dependency of [the algoliasearch client](https://www.npmjs.com/package/algoliasearch), you don't need to manually install `@algolia/abtesting` if you already have `algoliasearch` installed.
To get started, you first need to install @algolia/abtesting (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
### With a package manager
```bash
yarn add @algolia/abtesting@1.1.0
# or
npm install @algolia/abtesting@1.1.0
# or
pnpm add @algolia/abtesting@1.1.0
```
### Without a package manager
Add the following JavaScript snippet to the <head> of your website:
```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/abtesting@1.1.0/dist/builds/browser.umd.js"></script>
```
### Usage
You can now import the Algolia API client in your project and play with it.
```js
import { abtestingV3Client } from '@algolia/abtesting';
const client = abtestingV3Client('YOUR_APP_ID', 'YOUR_API_KEY');
```
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/abtesting-v3/)**.
## ❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/libraries/javascript/v5/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
## 📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).

712
node_modules/@algolia/abtesting/dist/browser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,712 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.1.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

473
node_modules/@algolia/abtesting/dist/builds/browser.js generated vendored Normal file
View File

@@ -0,0 +1,473 @@
// builds/browser.ts
import { createXhrRequester } from "@algolia/requester-browser-xhr";
import {
createBrowserLocalStorageCache,
createFallbackableCache,
createMemoryCache,
createNullLogger
} from "@algolia/client-common";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.1.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.metrics) {
throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/3/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/browser.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 1e3,
read: 2e3,
write: 3e4
},
logger: createNullLogger(),
requester: createXhrRequester(),
algoliaAgents: [{ segment: "Browser" }],
authMode: "WithinQueryParameters",
responsesCache: createMemoryCache(),
requestsCache: createMemoryCache({ serializable: false }),
hostsCache: createFallbackableCache({
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()]
}),
...options
});
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=browser.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

467
node_modules/@algolia/abtesting/dist/builds/fetch.js generated vendored Normal file
View File

@@ -0,0 +1,467 @@
// builds/fetch.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.1.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.metrics) {
throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/3/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/fetch.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Fetch" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=fetch.js.map

File diff suppressed because one or more lines are too long

493
node_modules/@algolia/abtesting/dist/builds/node.cjs generated vendored Normal file
View File

@@ -0,0 +1,493 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// builds/node.ts
var node_exports = {};
__export(node_exports, {
abtestingV3Client: () => abtestingV3Client,
apiClientVersion: () => apiClientVersion
});
module.exports = __toCommonJS(node_exports);
var import_requester_node_http = require("@algolia/requester-node-http");
var import_client_common2 = require("@algolia/client-common");
// src/abtestingV3Client.ts
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "1.1.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.metrics) {
throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/3/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: (0, import_client_common2.createNullLogger)(),
requester: (0, import_requester_node_http.createHttpRequester)(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: (0, import_client_common2.createNullCache)(),
requestsCache: (0, import_client_common2.createNullCache)(),
hostsCache: (0, import_client_common2.createMemoryCache)(),
...options
})
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
abtestingV3Client,
apiClientVersion
});
//# sourceMappingURL=node.cjs.map

File diff suppressed because one or more lines are too long

467
node_modules/@algolia/abtesting/dist/builds/node.js generated vendored Normal file
View File

@@ -0,0 +1,467 @@
// builds/node.ts
import { createHttpRequester } from "@algolia/requester-node-http";
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.1.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.metrics) {
throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/3/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createHttpRequester(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=node.js.map

File diff suppressed because one or more lines are too long

467
node_modules/@algolia/abtesting/dist/builds/worker.js generated vendored Normal file
View File

@@ -0,0 +1,467 @@
// builds/worker.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.1.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.metrics) {
throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/3/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/worker.ts
function abtestingV3Client(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingV3Client({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Worker" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingV3Client,
apiClientVersion
};
//# sourceMappingURL=worker.js.map

File diff suppressed because one or more lines are too long

713
node_modules/@algolia/abtesting/dist/fetch.d.ts generated vendored Normal file
View File

@@ -0,0 +1,713 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.1.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

713
node_modules/@algolia/abtesting/dist/node.d.cts generated vendored Normal file
View File

@@ -0,0 +1,713 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.1.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

713
node_modules/@algolia/abtesting/dist/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1,713 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.1.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

View File

@@ -0,0 +1,459 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/abtestingV3Client.ts
var abtestingV3Client_exports = {};
__export(abtestingV3Client_exports, {
REGIONS: () => REGIONS,
apiClientVersion: () => apiClientVersion,
createAbtestingV3Client: () => createAbtestingV3Client
});
module.exports = __toCommonJS(abtestingV3Client_exports);
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "1.1.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.metrics) {
throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/3/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
REGIONS,
apiClientVersion,
createAbtestingV3Client
});
//# sourceMappingURL=abtestingV3Client.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,432 @@
// src/abtestingV3Client.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.1.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingV3Client({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "AbtestingV3",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.metrics) {
throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/3/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getTimeseries`.");
}
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
if (startDate !== void 0) {
queryParameters["startDate"] = startDate.toString();
}
if (endDate !== void 0) {
queryParameters["endDate"] = endDate.toString();
}
if (metric !== void 0) {
queryParameters["metric"] = metric.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
const requestPath = "/3/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
if (direction !== void 0) {
queryParameters["direction"] = direction.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.metrics) {
throw new Error("Parameter `scheduleABTestsRequest.metrics` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/3/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
export {
REGIONS,
apiClientVersion,
createAbtestingV3Client
};
//# sourceMappingURL=abtestingV3Client.js.map

File diff suppressed because one or more lines are too long

713
node_modules/@algolia/abtesting/dist/worker.d.ts generated vendored Normal file
View File

@@ -0,0 +1,713 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Multiple-testing correction method applied when evaluating metric significance.
*/
type ErrorCorrectionType = 'bonferroni' | 'benjamini-hochberg';
/**
* Boolean filter applied to the A/B test population. Each filter targets a boolean metric and decides whether to include (true) or exclude (false) matching records.
*/
type MetricsFilter = {
/**
* Metric domain (for example `abtesting`, `personalization`).
*/
domain: string;
/**
* Public metric name.
*/
name: string;
/**
* Whether the experiment should record the effects of this filter.
*/
trackEffects?: boolean | undefined;
/**
* If true, keep items that match the filter; if false, exclude them.
*/
includes?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate' | 'noResultsRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
errorCorrection?: ErrorCorrectionType | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
/**
* Metric specific metadata.
*/
type MetricMetadata = {
/**
* Only present in case the metric is \'revenue\'. It is the amount exceeding the 95th percentile of global revenue transactions involved in the AB Test. This amount is not considered when calculating statistical significance. It is tied to a per revenue-currency pair contrary to other global filter effects (such as outliers and empty search count).
*/
winsorizedValue?: number | undefined;
/**
* Mean value for this metric.
*/
mean?: number | undefined;
};
type MetricResult = {
name: string;
/**
* Date and time when the metric was last updated, in RFC 3339 format.
*/
updatedAt: string;
value: number;
/**
* The upper bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCIHigh?: number | undefined;
/**
* The lower bound of the 95% confidence interval for the metric value. The confidence interval is calculated using either the relative ratio or relative difference between the metric values for the control and the variant. Relative ratio is used for metrics that are ratios (e.g., click-through rate, conversion rate), while relative difference is used for continuous metrics (e.g., revenue).
*/
valueCILow?: number | undefined;
/**
* PValue for the first variant (control) will always be 0. For the other variants, pValue is calculated for the current variant based on the control.
*/
pValue: number;
/**
* Dimension defined during test creation.
*/
dimension?: string | undefined;
metadata?: MetricMetadata | undefined;
/**
* The value that was computed during error correction. It is used to determine significance of the metric pValue. The critical value is calculated using Bonferroni or Benjamini-Hochberg corrections, based on the given configuration during the A/B test creation.
*/
criticalValue?: number | undefined;
/**
* Whether the pValue is significant or not based on the critical value and the error correction algorithm used.
*/
significant?: boolean | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
/**
* Variant specific metadata.
*/
type VariantMetadata = {
filterEffects?: FilterEffects | undefined;
};
type Variant = {
/**
* Description for this variant.
*/
description: string;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `minimumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics: Array<MetricResult>;
metadata?: VariantMetadata | undefined;
/**
* Search parameters applied to this variant when the same index is used for multiple variants. Only present if custom search parameters were provided during test creation.
*/
customSearchParameters?: Record<string, unknown> | undefined;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
/**
* Unique migrated A/B test identifier.
*/
migratedAbTestID?: number | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
/**
* Defines a metric to be retrieved during an A/B test.
*/
type CreateMetric = {
/**
* Name of the metric.
*/
name: string;
/**
* Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
*/
dimension?: string | undefined;
};
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
/**
* List of metric filters applied to the test population.
*/
filters?: Array<MetricsFilter> | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* A/B tests.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
*/
metrics: Array<CreateMetric>;
configuration?: ABTestConfiguration | undefined;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
type MetricDate = {
/**
* Date where the metric was updated, in RFC 3339 format.
*/
date?: string | undefined;
/**
* All ABTest metrics that were defined during test creation.
*/
metrics?: Array<MetricResult> | undefined;
};
type TimeseriesVariant = {
dates?: Array<MetricDate> | undefined;
};
type Timeseries = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* A/B test timeseries variants. The first variant is your _control_ index, typically your production index. All of the additional variants are indexes with changed settings that you want to test against the control.
*/
variants: Array<TimeseriesVariant>;
};
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
type Direction = 'asc' | 'desc';
type MetricName = 'search_count' | 'tracked_search_count' | 'user_count' | 'tracked_user_count' | 'no_result_count' | 'add_to_cart_count' | 'purchase_count' | 'clicked_search_count' | 'converted_search_count' | 'click_through_rate' | 'conversion_rate' | 'add_to_cart_rate' | 'purchase_rate' | 'average_click_position' | 'revenue';
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getTimeseries` method.
*/
type GetTimeseriesProps = {
/**
* Unique A/B test identifier.
*/
id: number;
/**
* Start date of the period to analyze, in `YYYY-MM-DD` format.
*/
startDate?: string | undefined;
/**
* End date of the period to analyze, in `YYYY-MM-DD` format.
*/
endDate?: string | undefined;
/**
* List of metrics to retrieve. If not specified, all metrics are returned.
*/
metric?: Array<MetricName> | undefined;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
/**
* Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
*/
direction?: Direction | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "1.1.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingV3Client({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Retrieves timeseries for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getTimeseries - The getTimeseries object.
* @param getTimeseries.id - Unique A/B test identifier.
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getTimeseries({ id, startDate, endDate, metric }: GetTimeseriesProps, requestOptions?: RequestOptions): Promise<Timeseries>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix, direction }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
declare function abtestingV3Client(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingV3Client;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingV3Client, type AddABTestsRequest, type AddABTestsVariant, type CreateMetric, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type Direction, type EffectMetric, type EmptySearchFilter, type ErrorBase, type ErrorCorrectionType, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type GetTimeseriesProps, type ListABTestsProps, type ListABTestsResponse, type MetricDate, type MetricMetadata, type MetricName, type MetricResult, type MetricsFilter, type MinimumDetectableEffect, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Timeseries, type TimeseriesVariant, type Variant, type VariantMetadata, abtestingV3Client, apiClientVersion };

1
node_modules/@algolia/abtesting/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/node';

1
node_modules/@algolia/abtesting/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('./dist/builds/node.cjs');

68
node_modules/@algolia/abtesting/package.json generated vendored Normal file
View File

@@ -0,0 +1,68 @@
{
"version": "1.1.0",
"repository": {
"type": "git",
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
},
"homepage": "https://github.com/algolia/algoliasearch-client-javascript/tree/main/packages/abtesting#readme",
"type": "module",
"license": "MIT",
"author": "Algolia",
"scripts": {
"build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js",
"clean": "rm -rf ./dist || true",
"test:bundle": "publint . && attw --pack ."
},
"name": "@algolia/abtesting",
"description": "JavaScript client for abtesting",
"exports": {
".": {
"node": {
"types": {
"import": "./dist/node.d.ts",
"module": "./dist/node.d.ts",
"require": "./dist/node.d.cts"
},
"import": "./dist/builds/node.js",
"module": "./dist/builds/node.js",
"require": "./dist/builds/node.cjs"
},
"worker": {
"types": "./dist/worker.d.ts",
"default": "./dist/builds/worker.js"
},
"default": {
"types": "./dist/browser.d.ts",
"module": "./dist/builds/browser.js",
"import": "./dist/builds/browser.js",
"default": "./dist/builds/browser.umd.js"
}
},
"./dist/builds/*": "./dist/builds/*.js"
},
"jsdelivr": "./dist/builds/browser.umd.js",
"unpkg": "./dist/builds/browser.umd.js",
"react-native": "./dist/builds/browser.js",
"files": [
"dist",
"index.js",
"index.d.ts"
],
"dependencies": {
"@algolia/client-common": "5.35.0",
"@algolia/requester-browser-xhr": "5.35.0",
"@algolia/requester-fetch": "5.35.0",
"@algolia/requester-node-http": "5.35.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.18.2",
"@types/node": "22.16.5",
"publint": "0.3.12",
"rollup": "4.41.0",
"tsup": "8.5.0",
"typescript": "5.8.3"
},
"engines": {
"node": ">= 14.0.0"
}
}

21
node_modules/@algolia/client-abtesting/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-Present Algolia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

77
node_modules/@algolia/client-abtesting/README.md generated vendored Normal file
View File

@@ -0,0 +1,77 @@
<p align="center">
<a href="https://www.algolia.com">
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
</a>
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
<p align="center">
<a href="https://npmjs.org/package/@algolia/client-abtesting"><img src="https://img.shields.io/npm/v/@algolia/client-abtesting.svg?style=flat-square" alt="NPM version"></img></a>
<a href="http://npm-stat.com/charts.html?package=@algolia/client-abtesting"><img src="https://img.shields.io/npm/dm/@algolia/client-abtesting.svg?style=flat-square" alt="NPM downloads"></a>
<a href="https://www.jsdelivr.com/package/npm/@algolia/client-abtesting"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/client-abtesting/badge" alt="jsDelivr Downloads"></img></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
</p>
</p>
<p align="center">
<a href="https://www.algolia.com/doc/libraries/javascript/" target="_blank">Documentation</a>
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a>
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a>
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a>
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a>
<a href="https://www.algolia.com/doc/libraries/javascript/v5/" target="_blank">FAQ</a>
<a href="https://alg.li/support" target="_blank">Support</a>
</p>
## ✨ Features
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
- Works both on the **browser** and **node.js**
- **UMD and ESM compatible**, you can use it with any module loader
- Built with TypeScript
## 💡 Getting Started
> [!TIP]
> This API client is already a dependency of [the algoliasearch client](https://www.npmjs.com/package/algoliasearch), you don't need to manually install `@algolia/client-abtesting` if you already have `algoliasearch` installed.
To get started, you first need to install @algolia/client-abtesting (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
### With a package manager
```bash
yarn add @algolia/client-abtesting@5.35.0
# or
npm install @algolia/client-abtesting@5.35.0
# or
pnpm add @algolia/client-abtesting@5.35.0
```
### Without a package manager
Add the following JavaScript snippet to the <head> of your website:
```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-abtesting@5.35.0/dist/builds/browser.umd.js"></script>
```
### Usage
You can now import the Algolia API client in your project and play with it.
```js
import { abtestingClient } from '@algolia/client-abtesting';
const client = abtestingClient('YOUR_APP_ID', 'YOUR_API_KEY');
```
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/abtesting/)**.
## ❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/libraries/javascript/v5/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
## 📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).

View File

@@ -0,0 +1,629 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Configuration for handling empty searches.
*/
type EmptySearch = {
/**
* Whether to exclude empty searches when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* Configuration for handling outliers.
*/
type Outliers = {
/**
* Whether to exclude outliers when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
type Currency = {
/**
* Currency code.
*/
currency?: string | undefined;
/**
* Revenue for this currency.
*/
revenue?: number | undefined;
/**
* Mean for this currency.
*/
mean?: number | undefined;
/**
* Standard deviation for this currency.
*/
standardDeviation?: number | undefined;
/**
* The amount of revenue for this currency that was removed after capping purchase amounts to the 95th percentile.
*/
winsorizedAmount?: number | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
type Variant = {
/**
* Number of add-to-cart events for this variant.
*/
addToCartCount: number;
/**
* [Add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate) for this variant.
*/
addToCartRate?: number | null | undefined;
/**
* [Average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) for this variant.
*/
averageClickPosition?: number | null | undefined;
/**
* Number of click events for this variant.
*/
clickCount: number;
/**
* [Click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate) for this variant.
*/
clickThroughRate?: number | null | undefined;
/**
* Number of click events for this variant.
*/
conversionCount: number;
/**
* [Conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate) for this variant.
*/
conversionRate?: number | null | undefined;
/**
* A/B test currencies.
*/
currencies?: {
[key: string]: Currency;
} | undefined;
/**
* Description for this variant.
*/
description?: string | undefined;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
filterEffects?: FilterEffects | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for this variant.
*/
noResultCount: number | null;
/**
* Number of purchase events for this variant.
*/
purchaseCount: number;
/**
* [Purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate) for this variant.
*/
purchaseRate?: number | null | undefined;
/**
* Number of searches for this variant.
*/
searchCount: number | null;
/**
* Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
*/
trackedSearchCount?: number | undefined;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Number of users that made searches to this variant.
*/
userCount: number | null;
/**
* Number of users that made tracked searches to this variant.
*/
trackedUserCount: number | null;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
clickSignificance?: number | null | undefined;
conversionSignificance?: number | null | undefined;
addToCartSignificance?: number | null | undefined;
purchaseSignificance?: number | null | undefined;
revenueSignificance?: {
[key: string]: number;
} | null | undefined;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. The second variant is an index with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* The list of A/B tests, null if no A/B tests are configured for this application.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "5.35.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
declare function abtestingClient(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingClient;
type AbtestingClient = ReturnType<typeof createAbtestingClient>;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type Currency, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type EffectMetric, type EmptySearch, type EmptySearchFilter, type ErrorBase, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type ListABTestsProps, type ListABTestsResponse, type MinimumDetectableEffect, type Outliers, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Variant, abtestingClient, apiClientVersion };

View File

@@ -0,0 +1,427 @@
// builds/browser.ts
import { createXhrRequester } from "@algolia/requester-browser-xhr";
import {
createBrowserLocalStorageCache,
createFallbackableCache,
createMemoryCache,
createNullLogger
} from "@algolia/client-common";
// src/abtestingClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.35.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Abtesting",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/2/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/2/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/browser.ts
function abtestingClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return createAbtestingClient({
appId,
apiKey,
region,
timeouts: {
connect: 1e3,
read: 2e3,
write: 3e4
},
logger: createNullLogger(),
requester: createXhrRequester(),
algoliaAgents: [{ segment: "Browser" }],
authMode: "WithinQueryParameters",
responsesCache: createMemoryCache(),
requestsCache: createMemoryCache({ serializable: false }),
hostsCache: createFallbackableCache({
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()]
}),
...options
});
}
export {
abtestingClient,
apiClientVersion
};
//# sourceMappingURL=browser.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,421 @@
// builds/fetch.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/abtestingClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.35.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Abtesting",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/2/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/2/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/fetch.ts
function abtestingClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Fetch" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingClient,
apiClientVersion
};
//# sourceMappingURL=fetch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,447 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// builds/node.ts
var node_exports = {};
__export(node_exports, {
abtestingClient: () => abtestingClient,
apiClientVersion: () => apiClientVersion
});
module.exports = __toCommonJS(node_exports);
var import_requester_node_http = require("@algolia/requester-node-http");
var import_client_common2 = require("@algolia/client-common");
// src/abtestingClient.ts
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "5.35.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "Abtesting",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/2/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/2/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function abtestingClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: (0, import_client_common2.createNullLogger)(),
requester: (0, import_requester_node_http.createHttpRequester)(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: (0, import_client_common2.createNullCache)(),
requestsCache: (0, import_client_common2.createNullCache)(),
hostsCache: (0, import_client_common2.createMemoryCache)(),
...options
})
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
abtestingClient,
apiClientVersion
});
//# sourceMappingURL=node.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,421 @@
// builds/node.ts
import { createHttpRequester } from "@algolia/requester-node-http";
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
// src/abtestingClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.35.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Abtesting",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/2/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/2/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function abtestingClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createHttpRequester(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingClient,
apiClientVersion
};
//# sourceMappingURL=node.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,421 @@
// builds/worker.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/abtestingClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.35.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Abtesting",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/2/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/2/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// builds/worker.ts
function abtestingClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createAbtestingClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Worker" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
abtestingClient,
apiClientVersion
};
//# sourceMappingURL=worker.js.map

File diff suppressed because one or more lines are too long

630
node_modules/@algolia/client-abtesting/dist/fetch.d.ts generated vendored Normal file
View File

@@ -0,0 +1,630 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Configuration for handling empty searches.
*/
type EmptySearch = {
/**
* Whether to exclude empty searches when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* Configuration for handling outliers.
*/
type Outliers = {
/**
* Whether to exclude outliers when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
type Currency = {
/**
* Currency code.
*/
currency?: string | undefined;
/**
* Revenue for this currency.
*/
revenue?: number | undefined;
/**
* Mean for this currency.
*/
mean?: number | undefined;
/**
* Standard deviation for this currency.
*/
standardDeviation?: number | undefined;
/**
* The amount of revenue for this currency that was removed after capping purchase amounts to the 95th percentile.
*/
winsorizedAmount?: number | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
type Variant = {
/**
* Number of add-to-cart events for this variant.
*/
addToCartCount: number;
/**
* [Add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate) for this variant.
*/
addToCartRate?: number | null | undefined;
/**
* [Average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) for this variant.
*/
averageClickPosition?: number | null | undefined;
/**
* Number of click events for this variant.
*/
clickCount: number;
/**
* [Click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate) for this variant.
*/
clickThroughRate?: number | null | undefined;
/**
* Number of click events for this variant.
*/
conversionCount: number;
/**
* [Conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate) for this variant.
*/
conversionRate?: number | null | undefined;
/**
* A/B test currencies.
*/
currencies?: {
[key: string]: Currency;
} | undefined;
/**
* Description for this variant.
*/
description?: string | undefined;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
filterEffects?: FilterEffects | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for this variant.
*/
noResultCount: number | null;
/**
* Number of purchase events for this variant.
*/
purchaseCount: number;
/**
* [Purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate) for this variant.
*/
purchaseRate?: number | null | undefined;
/**
* Number of searches for this variant.
*/
searchCount: number | null;
/**
* Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
*/
trackedSearchCount?: number | undefined;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Number of users that made searches to this variant.
*/
userCount: number | null;
/**
* Number of users that made tracked searches to this variant.
*/
trackedUserCount: number | null;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
clickSignificance?: number | null | undefined;
conversionSignificance?: number | null | undefined;
addToCartSignificance?: number | null | undefined;
purchaseSignificance?: number | null | undefined;
revenueSignificance?: {
[key: string]: number;
} | null | undefined;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. The second variant is an index with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* The list of A/B tests, null if no A/B tests are configured for this application.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "5.35.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingClient = ReturnType<typeof createAbtestingClient>;
declare function abtestingClient(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingClient;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type Currency, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type EffectMetric, type EmptySearch, type EmptySearchFilter, type ErrorBase, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type ListABTestsProps, type ListABTestsResponse, type MinimumDetectableEffect, type Outliers, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Variant, abtestingClient, apiClientVersion };

630
node_modules/@algolia/client-abtesting/dist/node.d.cts generated vendored Normal file
View File

@@ -0,0 +1,630 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Configuration for handling empty searches.
*/
type EmptySearch = {
/**
* Whether to exclude empty searches when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* Configuration for handling outliers.
*/
type Outliers = {
/**
* Whether to exclude outliers when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
type Currency = {
/**
* Currency code.
*/
currency?: string | undefined;
/**
* Revenue for this currency.
*/
revenue?: number | undefined;
/**
* Mean for this currency.
*/
mean?: number | undefined;
/**
* Standard deviation for this currency.
*/
standardDeviation?: number | undefined;
/**
* The amount of revenue for this currency that was removed after capping purchase amounts to the 95th percentile.
*/
winsorizedAmount?: number | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
type Variant = {
/**
* Number of add-to-cart events for this variant.
*/
addToCartCount: number;
/**
* [Add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate) for this variant.
*/
addToCartRate?: number | null | undefined;
/**
* [Average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) for this variant.
*/
averageClickPosition?: number | null | undefined;
/**
* Number of click events for this variant.
*/
clickCount: number;
/**
* [Click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate) for this variant.
*/
clickThroughRate?: number | null | undefined;
/**
* Number of click events for this variant.
*/
conversionCount: number;
/**
* [Conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate) for this variant.
*/
conversionRate?: number | null | undefined;
/**
* A/B test currencies.
*/
currencies?: {
[key: string]: Currency;
} | undefined;
/**
* Description for this variant.
*/
description?: string | undefined;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
filterEffects?: FilterEffects | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for this variant.
*/
noResultCount: number | null;
/**
* Number of purchase events for this variant.
*/
purchaseCount: number;
/**
* [Purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate) for this variant.
*/
purchaseRate?: number | null | undefined;
/**
* Number of searches for this variant.
*/
searchCount: number | null;
/**
* Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
*/
trackedSearchCount?: number | undefined;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Number of users that made searches to this variant.
*/
userCount: number | null;
/**
* Number of users that made tracked searches to this variant.
*/
trackedUserCount: number | null;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
clickSignificance?: number | null | undefined;
conversionSignificance?: number | null | undefined;
addToCartSignificance?: number | null | undefined;
purchaseSignificance?: number | null | undefined;
revenueSignificance?: {
[key: string]: number;
} | null | undefined;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. The second variant is an index with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* The list of A/B tests, null if no A/B tests are configured for this application.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "5.35.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingClient = ReturnType<typeof createAbtestingClient>;
declare function abtestingClient(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingClient;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type Currency, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type EffectMetric, type EmptySearch, type EmptySearchFilter, type ErrorBase, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type ListABTestsProps, type ListABTestsResponse, type MinimumDetectableEffect, type Outliers, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Variant, abtestingClient, apiClientVersion };

630
node_modules/@algolia/client-abtesting/dist/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1,630 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Configuration for handling empty searches.
*/
type EmptySearch = {
/**
* Whether to exclude empty searches when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* Configuration for handling outliers.
*/
type Outliers = {
/**
* Whether to exclude outliers when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
type Currency = {
/**
* Currency code.
*/
currency?: string | undefined;
/**
* Revenue for this currency.
*/
revenue?: number | undefined;
/**
* Mean for this currency.
*/
mean?: number | undefined;
/**
* Standard deviation for this currency.
*/
standardDeviation?: number | undefined;
/**
* The amount of revenue for this currency that was removed after capping purchase amounts to the 95th percentile.
*/
winsorizedAmount?: number | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
type Variant = {
/**
* Number of add-to-cart events for this variant.
*/
addToCartCount: number;
/**
* [Add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate) for this variant.
*/
addToCartRate?: number | null | undefined;
/**
* [Average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) for this variant.
*/
averageClickPosition?: number | null | undefined;
/**
* Number of click events for this variant.
*/
clickCount: number;
/**
* [Click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate) for this variant.
*/
clickThroughRate?: number | null | undefined;
/**
* Number of click events for this variant.
*/
conversionCount: number;
/**
* [Conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate) for this variant.
*/
conversionRate?: number | null | undefined;
/**
* A/B test currencies.
*/
currencies?: {
[key: string]: Currency;
} | undefined;
/**
* Description for this variant.
*/
description?: string | undefined;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
filterEffects?: FilterEffects | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for this variant.
*/
noResultCount: number | null;
/**
* Number of purchase events for this variant.
*/
purchaseCount: number;
/**
* [Purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate) for this variant.
*/
purchaseRate?: number | null | undefined;
/**
* Number of searches for this variant.
*/
searchCount: number | null;
/**
* Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
*/
trackedSearchCount?: number | undefined;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Number of users that made searches to this variant.
*/
userCount: number | null;
/**
* Number of users that made tracked searches to this variant.
*/
trackedUserCount: number | null;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
clickSignificance?: number | null | undefined;
conversionSignificance?: number | null | undefined;
addToCartSignificance?: number | null | undefined;
purchaseSignificance?: number | null | undefined;
revenueSignificance?: {
[key: string]: number;
} | null | undefined;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. The second variant is an index with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* The list of A/B tests, null if no A/B tests are configured for this application.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "5.35.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingClient = ReturnType<typeof createAbtestingClient>;
declare function abtestingClient(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingClient;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type Currency, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type EffectMetric, type EmptySearch, type EmptySearchFilter, type ErrorBase, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type ListABTestsProps, type ListABTestsResponse, type MinimumDetectableEffect, type Outliers, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Variant, abtestingClient, apiClientVersion };

View File

@@ -0,0 +1,413 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/abtestingClient.ts
var abtestingClient_exports = {};
__export(abtestingClient_exports, {
REGIONS: () => REGIONS,
apiClientVersion: () => apiClientVersion,
createAbtestingClient: () => createAbtestingClient
});
module.exports = __toCommonJS(abtestingClient_exports);
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "5.35.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "Abtesting",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/2/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/2/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
REGIONS,
apiClientVersion,
createAbtestingClient
});
//# sourceMappingURL=abtestingClient.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,386 @@
// src/abtestingClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.35.0";
var REGIONS = ["de", "us"];
function getDefaultHosts(region) {
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createAbtestingClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Abtesting",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest, requestOptions) {
if (!addABTestsRequest) {
throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
}
if (!addABTestsRequest.name) {
throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
}
if (!addABTestsRequest.variants) {
throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
}
if (!addABTestsRequest.endAt) {
throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
}
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: addABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `deleteABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest, requestOptions) {
if (!estimateABTestRequest) {
throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.configuration) {
throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");
}
if (!estimateABTestRequest.variants) {
throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");
}
const requestPath = "/2/abtests/estimate";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: estimateABTestRequest
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `getABTest`.");
}
const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
const requestPath = "/2/abtests";
const headers = {};
const queryParameters = {};
if (offset !== void 0) {
queryParameters["offset"] = offset.toString();
}
if (limit !== void 0) {
queryParameters["limit"] = limit.toString();
}
if (indexPrefix !== void 0) {
queryParameters["indexPrefix"] = indexPrefix.toString();
}
if (indexSuffix !== void 0) {
queryParameters["indexSuffix"] = indexSuffix.toString();
}
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest, requestOptions) {
if (!scheduleABTestsRequest) {
throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.name) {
throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.variants) {
throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.scheduledAt) {
throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
}
if (!scheduleABTestsRequest.endAt) {
throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
}
const requestPath = "/2/abtests/schedule";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: scheduleABTestsRequest
};
return transporter.request(request, requestOptions);
},
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }, requestOptions) {
if (!id) {
throw new Error("Parameter `id` is required when calling `stopABTest`.");
}
const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
}
};
}
export {
REGIONS,
apiClientVersion,
createAbtestingClient
};
//# sourceMappingURL=abtestingClient.js.map

File diff suppressed because one or more lines are too long

630
node_modules/@algolia/client-abtesting/dist/worker.d.ts generated vendored Normal file
View File

@@ -0,0 +1,630 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
/**
* Configuration for handling empty searches.
*/
type EmptySearch = {
/**
* Whether to exclude empty searches when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* Metric for which you want to detect the smallest relative difference.
*/
type EffectMetric = 'addToCartRate' | 'clickThroughRate' | 'conversionRate' | 'purchaseRate';
/**
* Configuration for the smallest difference between test variants you want to detect.
*/
type MinimumDetectableEffect = {
/**
* Smallest difference in an observable metric between variants. For example, to detect a 10% difference between variants, set this value to 0.1.
*/
size: number;
metric: EffectMetric;
};
/**
* Configuration for handling outliers.
*/
type Outliers = {
/**
* Whether to exclude outliers when calculating A/B test results.
*/
exclude?: boolean | undefined;
};
/**
* A/B test configuration.
*/
type ABTestConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect?: MinimumDetectableEffect | undefined;
};
/**
* A/B test status. - `active`. The A/B test is live and search traffic is split between the two variants. - `stopped`. You stopped the A/B test. The A/B test data is still available for analysis. - `expired`. The A/B test was automatically stopped after reaching its end date. - `failed`. Creating the A/B test failed.
*/
type Status = 'active' | 'stopped' | 'expired' | 'failed';
type Currency = {
/**
* Currency code.
*/
currency?: string | undefined;
/**
* Revenue for this currency.
*/
revenue?: number | undefined;
/**
* Mean for this currency.
*/
mean?: number | undefined;
/**
* Standard deviation for this currency.
*/
standardDeviation?: number | undefined;
/**
* The amount of revenue for this currency that was removed after capping purchase amounts to the 95th percentile.
*/
winsorizedAmount?: number | undefined;
};
/**
* Empty searches removed from the A/B test as a result of configuration settings.
*/
type EmptySearchFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* Outliers removed from the A/B test as a result of configuration settings.
*/
type OutliersFilter = {
/**
* Number of users removed from the A/B test.
*/
usersCount?: number | undefined;
/**
* Number of tracked searches removed from the A/B test.
*/
trackedSearchesCount?: number | undefined;
};
/**
* A/B test filter effects resulting from configuration settings.
*/
type FilterEffects = {
outliers?: OutliersFilter | undefined;
emptySearch?: EmptySearchFilter | undefined;
};
type Variant = {
/**
* Number of add-to-cart events for this variant.
*/
addToCartCount: number;
/**
* [Add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate) for this variant.
*/
addToCartRate?: number | null | undefined;
/**
* [Average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) for this variant.
*/
averageClickPosition?: number | null | undefined;
/**
* Number of click events for this variant.
*/
clickCount: number;
/**
* [Click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate) for this variant.
*/
clickThroughRate?: number | null | undefined;
/**
* Number of click events for this variant.
*/
conversionCount: number;
/**
* [Conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate) for this variant.
*/
conversionRate?: number | null | undefined;
/**
* A/B test currencies.
*/
currencies?: {
[key: string]: Currency;
} | undefined;
/**
* Description for this variant.
*/
description?: string | undefined;
/**
* Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response.
*/
estimatedSampleSize?: number | undefined;
filterEffects?: FilterEffects | undefined;
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for this variant.
*/
noResultCount: number | null;
/**
* Number of purchase events for this variant.
*/
purchaseCount: number;
/**
* [Purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate) for this variant.
*/
purchaseRate?: number | null | undefined;
/**
* Number of searches for this variant.
*/
searchCount: number | null;
/**
* Number of tracked searches. Tracked searches are search requests where the `clickAnalytics` parameter is true.
*/
trackedSearchCount?: number | undefined;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Number of users that made searches to this variant.
*/
userCount: number | null;
/**
* Number of users that made tracked searches to this variant.
*/
trackedUserCount: number | null;
};
type ABTest = {
/**
* Unique A/B test identifier.
*/
abTestID: number;
clickSignificance?: number | null | undefined;
conversionSignificance?: number | null | undefined;
addToCartSignificance?: number | null | undefined;
purchaseSignificance?: number | null | undefined;
revenueSignificance?: {
[key: string]: number;
} | null | undefined;
/**
* Date and time when the A/B test was last updated, in RFC 3339 format.
*/
updatedAt: string;
/**
* Date and time when the A/B test was created, in RFC 3339 format.
*/
createdAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
/**
* A/B test name.
*/
name: string;
status: Status;
/**
* A/B test variants. The first variant is your _control_ index, typically your production index. The second variant is an index with changed settings that you want to test against the control.
*/
variants: Array<Variant>;
configuration?: ABTestConfiguration | undefined;
};
type ABTestResponse = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Unique A/B test identifier.
*/
abTestID: number;
/**
* Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task\'s progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
*/
taskID: number;
};
type AbTestsVariant = {
/**
* Index name of the A/B test variant (case-sensitive).
*/
index: string;
/**
* Percentage of search requests each variant receives.
*/
trafficPercentage: number;
/**
* Description for this variant.
*/
description?: string | undefined;
};
/**
* Search parameters to add to the test variant. Only use this parameter if the two variants use the same index.
*/
type CustomSearchParams = {
customSearchParameters: Record<string, unknown>;
};
type AbTestsVariantSearchParams = AbTestsVariant & CustomSearchParams;
type AddABTestsVariant = AbTestsVariant | AbTestsVariantSearchParams;
type AddABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* A/B test configuration for estimating the sample size and duration using minimum detectable effect.
*/
type EstimateConfiguration = {
outliers?: Outliers | undefined;
emptySearch?: EmptySearch | undefined;
minimumDetectableEffect: MinimumDetectableEffect;
};
type EstimateABTestRequest = {
configuration: EstimateConfiguration;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
};
type EstimateABTestResponse = {
/**
* Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic.
*/
durationDays?: number | undefined;
/**
* Sample size estimates for each variant. The first element is the control variant. Each element is the estimated number of searches required to achieve the desired statistical significance.
*/
sampleSizes?: Array<number> | undefined;
};
type ListABTestsResponse = {
/**
* The list of A/B tests, null if no A/B tests are configured for this application.
*/
abtests: Array<ABTest> | null;
/**
* Number of A/B tests.
*/
count: number;
/**
* Number of retrievable A/B tests.
*/
total: number;
};
type ScheduleABTestResponse = {
/**
* Unique scheduled A/B test identifier.
*/
abTestScheduleID: number;
};
type ScheduleABTestsRequest = {
/**
* A/B test name.
*/
name: string;
/**
* A/B test variants.
*/
variants: Array<AddABTestsVariant>;
/**
* Date and time when the A/B test is scheduled to start, in RFC 3339 format.
*/
scheduledAt: string;
/**
* End date and time of the A/B test, in RFC 3339 format.
*/
endAt: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteABTest` method.
*/
type DeleteABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `getABTest` method.
*/
type GetABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
/**
* Properties for the `listABTests` method.
*/
type ListABTestsProps = {
/**
* Position of the first item to return.
*/
offset?: number | undefined;
/**
* Number of items to return.
*/
limit?: number | undefined;
/**
* Index name prefix. Only A/B tests for indices starting with this string are included in the response.
*/
indexPrefix?: string | undefined;
/**
* Index name suffix. Only A/B tests for indices ending with this string are included in the response.
*/
indexSuffix?: string | undefined;
};
/**
* Properties for the `stopABTest` method.
*/
type StopABTestProps = {
/**
* Unique A/B test identifier.
*/
id: number;
};
declare const apiClientVersion = "5.35.0";
declare const REGIONS: readonly ["de", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region?: Region | undefined;
};
declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new A/B test.
*
* Required API Key ACLs:
* - editSettings
* @param addABTestsRequest - The addABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes an A/B test by its ID.
*
* Required API Key ACLs:
* - editSettings
* @param deleteABTest - The deleteABTest object.
* @param deleteABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
/**
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
*
* Required API Key ACLs:
* - analytics
* @param estimateABTestRequest - The estimateABTestRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
estimateABTest(estimateABTestRequest: EstimateABTestRequest, requestOptions?: RequestOptions): Promise<EstimateABTestResponse>;
/**
* Retrieves the details for an A/B test by its ID.
*
* Required API Key ACLs:
* - analytics
* @param getABTest - The getABTest object.
* @param getABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest>;
/**
* Lists all A/B tests you configured for this application.
*
* Required API Key ACLs:
* - analytics
* @param listABTests - The listABTests object.
* @param listABTests.offset - Position of the first item to return.
* @param listABTests.limit - Number of items to return.
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
listABTests({ offset, limit, indexPrefix, indexSuffix }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
/**
* Schedule an A/B test to be started at a later time.
*
* Required API Key ACLs:
* - editSettings
* @param scheduleABTestsRequest - The scheduleABTestsRequest object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
scheduleABTest(scheduleABTestsRequest: ScheduleABTestsRequest, requestOptions?: RequestOptions): Promise<ScheduleABTestResponse>;
/**
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
*
* Required API Key ACLs:
* - editSettings
* @param stopABTest - The stopABTest object.
* @param stopABTest.id - Unique A/B test identifier.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type AbtestingClient = ReturnType<typeof createAbtestingClient>;
declare function abtestingClient(appId: string, apiKey: string, region?: Region | undefined, options?: ClientOptions | undefined): AbtestingClient;
export { type ABTest, type ABTestConfiguration, type ABTestResponse, type AbTestsVariant, type AbTestsVariantSearchParams, type AbtestingClient, type AddABTestsRequest, type AddABTestsVariant, type Currency, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type CustomSearchParams, type DeleteABTestProps, type EffectMetric, type EmptySearch, type EmptySearchFilter, type ErrorBase, type EstimateABTestRequest, type EstimateABTestResponse, type EstimateConfiguration, type FilterEffects, type GetABTestProps, type ListABTestsProps, type ListABTestsResponse, type MinimumDetectableEffect, type Outliers, type OutliersFilter, type Region, type RegionOptions, type ScheduleABTestResponse, type ScheduleABTestsRequest, type Status, type StopABTestProps, type Variant, abtestingClient, apiClientVersion };

1
node_modules/@algolia/client-abtesting/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './dist/node';

1
node_modules/@algolia/client-abtesting/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('./dist/builds/node.cjs');

68
node_modules/@algolia/client-abtesting/package.json generated vendored Normal file
View File

@@ -0,0 +1,68 @@
{
"version": "5.35.0",
"repository": {
"type": "git",
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
},
"homepage": "https://github.com/algolia/algoliasearch-client-javascript/tree/main/packages/client-abtesting#readme",
"type": "module",
"license": "MIT",
"author": "Algolia",
"scripts": {
"build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js",
"clean": "rm -rf ./dist || true",
"test:bundle": "publint . && attw --pack ."
},
"name": "@algolia/client-abtesting",
"description": "JavaScript client for client-abtesting",
"exports": {
".": {
"node": {
"types": {
"import": "./dist/node.d.ts",
"module": "./dist/node.d.ts",
"require": "./dist/node.d.cts"
},
"import": "./dist/builds/node.js",
"module": "./dist/builds/node.js",
"require": "./dist/builds/node.cjs"
},
"worker": {
"types": "./dist/worker.d.ts",
"default": "./dist/builds/worker.js"
},
"default": {
"types": "./dist/browser.d.ts",
"module": "./dist/builds/browser.js",
"import": "./dist/builds/browser.js",
"default": "./dist/builds/browser.umd.js"
}
},
"./dist/builds/*": "./dist/builds/*.js"
},
"jsdelivr": "./dist/builds/browser.umd.js",
"unpkg": "./dist/builds/browser.umd.js",
"react-native": "./dist/builds/browser.js",
"files": [
"dist",
"index.js",
"index.d.ts"
],
"dependencies": {
"@algolia/client-common": "5.35.0",
"@algolia/requester-browser-xhr": "5.35.0",
"@algolia/requester-fetch": "5.35.0",
"@algolia/requester-node-http": "5.35.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.18.2",
"@types/node": "22.16.5",
"publint": "0.3.12",
"rollup": "4.41.0",
"tsup": "8.5.0",
"typescript": "5.8.3"
},
"engines": {
"node": ">= 14.0.0"
}
}

21
node_modules/@algolia/client-analytics/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-Present Algolia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

77
node_modules/@algolia/client-analytics/README.md generated vendored Normal file
View File

@@ -0,0 +1,77 @@
<p align="center">
<a href="https://www.algolia.com">
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
</a>
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
<p align="center">
<a href="https://npmjs.org/package/@algolia/client-analytics"><img src="https://img.shields.io/npm/v/@algolia/client-analytics.svg?style=flat-square" alt="NPM version"></img></a>
<a href="http://npm-stat.com/charts.html?package=@algolia/client-analytics"><img src="https://img.shields.io/npm/dm/@algolia/client-analytics.svg?style=flat-square" alt="NPM downloads"></a>
<a href="https://www.jsdelivr.com/package/npm/@algolia/client-analytics"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/client-analytics/badge" alt="jsDelivr Downloads"></img></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
</p>
</p>
<p align="center">
<a href="https://www.algolia.com/doc/libraries/javascript/" target="_blank">Documentation</a>
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a>
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a>
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a>
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a>
<a href="https://www.algolia.com/doc/libraries/javascript/v5/" target="_blank">FAQ</a>
<a href="https://alg.li/support" target="_blank">Support</a>
</p>
## ✨ Features
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
- Works both on the **browser** and **node.js**
- **UMD and ESM compatible**, you can use it with any module loader
- Built with TypeScript
## 💡 Getting Started
> [!TIP]
> This API client is already a dependency of [the algoliasearch client](https://www.npmjs.com/package/algoliasearch), you don't need to manually install `@algolia/client-analytics` if you already have `algoliasearch` installed.
To get started, you first need to install @algolia/client-analytics (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
### With a package manager
```bash
yarn add @algolia/client-analytics@5.35.0
# or
npm install @algolia/client-analytics@5.35.0
# or
pnpm add @algolia/client-analytics@5.35.0
```
### Without a package manager
Add the following JavaScript snippet to the <head> of your website:
```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-analytics@5.35.0/dist/builds/browser.umd.js"></script>
```
### Usage
You can now import the Algolia API client in your project and play with it.
```js
import { analyticsClient } from '@algolia/client-analytics';
const client = analyticsClient('YOUR_APP_ID', 'YOUR_API_KEY');
```
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/analytics/)**.
## ❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/libraries/javascript/v5/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
## 📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).

1738
node_modules/@algolia/client-analytics/dist/browser.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More