Skip to content

feat(javascript): generate abtesting v3 alpha client #4783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: docs/abtests/api-v3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"version": "0.0.1-alpha.1",
"repository": {
"type": "git",
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
},
"homepage": "https://github.com/algolia/algoliasearch-client-javascript/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.23.4",
"@algolia/requester-browser-xhr": "5.23.4",
"@algolia/requester-node-http": "5.23.4",
"@algolia/requester-fetch": "5.23.4"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.17.4",
"@types/node": "22.14.1",
"publint": "0.3.12",
"rollup": "4.39.0",
"tsup": "8.4.0",
"typescript": "5.8.3"
},
"engines": {
"node": ">= 14.0.0"
}
}
5 changes: 5 additions & 0 deletions config/clients.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@
"name": "abtesting",
"output": "clients/algoliasearch-client-javascript/packages/client-abtesting"
},
{
"name": "abtesting-v3",
"output": "clients/algoliasearch-client-javascript/packages/abtesting",
"isStandaloneClient": true
},
{
"name": "analytics",
"output": "clients/algoliasearch-client-javascript/packages/client-analytics"
Expand Down
102 changes: 102 additions & 0 deletions config/clients.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"clients": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"enum": [
"abtesting",
"abtesting-v3",
"analytics",
"composition",
"ingestion",
"insights",
"monitoring",
"personalization",
"query-suggestions",
"recommend",
"search"
]
}
},
{
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"enum": [
"algoliasearch",
"abtesting",
"abtesting-v3",
"analytics",
"composition",
"composition-full",
"ingestion",
"insights",
"monitoring",
"personalization",
"query-suggestions",
"recommend",
"search"
]
},
"output": { "type": "string" },
"isStandaloneClient": { "type": "boolean", "description": "this property only matters for the javascript client, when `true`, your package will be built as a standalone client and not be part of `algoliasearch` directly. This is recommended for non stable APIs." },
"clientName": { "type": "string", "description": "when defined, the name of the generated instance of the client will be hardcoded, otherwise it defaults to the `spec` name, e.g. search -> searchClient" }
},
"required": ["name", "output"],
"additionalProperties": false
}
}
]
},
"folder": { "type": "string", "description": "the output folder of your client, usually matching the github repository name, e.g. clients/algoliasearch-client-dart" },
"gitRepoId": { "type": "string", "description": "the github repository name, without the organization or username that owns it, e.g. algoliasearch-client-php"},
"packageVersion": { "type": "string", "description": "the version to publish the packages with, it must be semver compatible, e.g. 1.2.3" },
"modelFolder": { "type": "string", "description": "the models folder, e.g. algoliasearch/models"},
"apiFolder": { "type": "string", "description": "the api folder, e.g. lib/src"},
"dockerImage": {
"type": "string",
"description": "whether your client requires a custom docker image with specific needs, most clients require 'apic_base'",
"enum": [
"apic_base",
"apic_ruby",
"apic_swift"
]
},
"tests": {
"type": "object",
"properties": {
"extension": { "type": "string", "description": "the test file extension, e.g. .test.ts" },
"outputFolder": { "type": "string", "description": "the test output folder, e.g. src/generated" }
},
"required": ["extension", "outputFolder"],
"additionalProperties": false
},
"snippets": {
"type": "object",
"properties": {
"extension": { "type": "string", "description": "the snippet file extension, e.g. .cs" },
"outputFolder": { "type": "string", "description": "the snippet output folder, e.g. src" }
},
"required": ["extension", "outputFolder"],
"additionalProperties": false
},
"supportedVersions": {
"type": "array",
"description": "hints the CI on what matrix to generate for this client, this must be language specific versions, e.g. versions of node",
"items": { "type": "string" }
}
},
"required": ["clients", "folder", "gitRepoId", "packageVersion", "modelFolder", "apiFolder", "tests", "snippets"],
"additionalProperties": false
}
}
8 changes: 4 additions & 4 deletions specs/abtesting-v3/common/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ ID:
description: Unique A/B test identifier.
required: true
schema:
$ref: "#/abTestID"
$ref: '#/abTestID'

# misc
index:
type: string
description: Index name of the A/B test variant (case-sensitive).
example: "delcourt_production"
example: 'delcourt_production'

abTestID:
type: integer
Expand Down Expand Up @@ -75,7 +75,7 @@ currencies:
mean: 43.7
standardDeviation: 10.3
additionalProperties:
$ref: "#/currency"
$ref: '#/currency'
x-additionalPropertiesName: currency code

currency:
Expand All @@ -84,7 +84,7 @@ currency:
currency:
type: string
description: Currency code.
example: "USD"
example: 'USD'
revenue:
type: number
format: double
Expand Down
31 changes: 15 additions & 16 deletions specs/abtesting-v3/common/schemas/ABTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@ ABTests:
- type: array
description: A/B tests.
items:
$ref: "#/ABTest"
- type: "null"
description: No A/B tests are configured for this application.
$ref: '#/ABTest'
- type: 'null'

ABTest:
type: object
additionalProperties: false
properties:
abTestID:
$ref: "../parameters.yml#/abTestID"
$ref: '../parameters.yml#/abTestID'
updatedAt:
$ref: "../parameters.yml#/updatedAt"
$ref: '../parameters.yml#/updatedAt'
createdAt:
$ref: "../parameters.yml#/createdAt"
$ref: '../parameters.yml#/createdAt'
endAt:
$ref: "../parameters.yml#/endAt"
$ref: '../parameters.yml#/endAt'
name:
$ref: "../parameters.yml#/name"
$ref: '../parameters.yml#/name'
status:
$ref: "#/Status"
$ref: '#/Status'
variants:
$ref: "Variant.yml#/variants"
$ref: 'Variant.yml#/variants'
configuration:
$ref: "#/ABTestConfiguration"
$ref: '#/ABTestConfiguration'
migratedAbTestID:
$ref: "#/MigratedABTestId"
$ref: '#/MigratedABTestId'
required:
- status
- name
Expand Down Expand Up @@ -60,11 +59,11 @@ ABTestConfiguration:
description: A/B test configuration.
properties:
outliers:
$ref: "#/Outliers"
$ref: '#/Outliers'
emptySearch:
$ref: "#/EmptySearch"
$ref: '#/EmptySearch'
minimumDetectableEffect:
$ref: "#/MinimumDetectableEffect"
$ref: '#/MinimumDetectableEffect'

Outliers:
type: object
Expand Down Expand Up @@ -96,7 +95,7 @@ MinimumDetectableEffect:
Smallest difference in an observable metric between variants.
For example, to detect a 10% difference between variants, set this value to 0.1.
metric:
$ref: "#/EffectMetric"
$ref: '#/EffectMetric'
required:
- size
- metric
Expand Down
12 changes: 6 additions & 6 deletions specs/abtesting-v3/common/schemas/Timeseries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Timeseries:
additionalProperties: false
properties:
abTestID:
$ref: "../parameters.yml#/abTestID"
$ref: '../parameters.yml#/abTestID'
variants:
$ref: "#/timeseriesVariants"
$ref: '#/timeseriesVariants'
required:
- abTestID
- variants
Expand All @@ -18,18 +18,18 @@ timeseriesVariants:
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.
items:
$ref: "#/timeseriesVariant"
$ref: '#/timeseriesVariant'

timeseriesVariant:
type: object
properties:
dates:
$ref: "#/metricDates"
$ref: '#/metricDates'

metricDates:
type: array
items:
$ref: "#/metricDate"
$ref: '#/metricDate'

metricDate:
type: object
Expand All @@ -40,4 +40,4 @@ metricDate:
format: date
example: 2025-06-15
metrics:
$ref: "Variant.yml#/metrics"
$ref: 'Variant.yml#/metrics'
Loading
Loading