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 14 commits 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
}
}
158 changes: 158 additions & 0 deletions specs/abtesting-v3/common/parameters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# path
ID:
in: path
name: id
description: Unique A/B test identifier.
required: true
schema:
$ref: '#/abTestID'

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

abTestID:
type: integer
description: Unique A/B test identifier.
example: 224

abTestScheduleID:
type: integer
description: Unique scheduled A/B test identifier.
example: 224

endAt:
type: string
description: End date and time of the A/B test, in RFC 3339 format.
example: 2023-06-17T00:00:00Z

createdAt:
type: string
description: Date and time when the A/B test was created, in RFC 3339 format.
example: 2023-06-15T15:06:04.249906Z

updatedAt:
type: string
description: Date and time when the A/B test was last updated, in RFC 3339 format.
example: 2023-06-15T15:06:44.400601Z

scheduledAt:
type: string
description: Date and time when the A/B test is scheduled to start, in RFC 3339 format.
example: 2023-06-15T15:06:44.400601Z

name:
type: string
description: A/B test name.
example: Custom ranking sales rank test

description:
type: string
description: Description for this variant.
example: Current production index

trafficPercentage:
type: integer
description: Percentage of search requests each variant receives.
minimum: 1
maximum: 99
example: 60

currencies:
type: object
description: A/B test currencies.
example:
USD:
currency: USD
revenue: 120.0
mean: 53.7
standardDeviation: 12.3
EUR:
currency: EUR
revenue: 100.0
mean: 43.7
standardDeviation: 10.3
additionalProperties:
$ref: '#/currency'
x-additionalPropertiesName: currency code

currency:
type: object
properties:
currency:
type: string
description: Currency code.
example: 'USD'
revenue:
type: number
format: double
description: Revenue for this currency.
example: 120.0
mean:
type: number
format: double
description: Mean for this currency.
example: 53.7
standardDeviation:
type: number
format: double
description: Standard deviation for this currency.
example: 12.3

filterEffects:
type: object
description: A/B test filter effects resulting from configuration settings.
properties:
outliers:
title: outliersFilter
type: object
description: Outliers removed from the A/B test as a result of configuration settings.
example:
usersCount: 1
trackedSearchesCount: 237
properties:
usersCount:
type: integer
description: Number of users removed from the A/B test.
example: 1
trackedSearchesCount:
type: integer
description: Number of tracked searches removed from the A/B test.
example: 237
emptySearch:
title: emptySearchFilter
type: object
description: Empty searches removed from the A/B test as a result of configuration settings.
example:
usersCount: 1
trackedSearchesCount: 237
properties:
usersCount:
type: integer
description: Number of users removed from the A/B test.
example: 1
trackedSearchesCount:
type: integer
description: Number of tracked searches removed from the A/B test.
example: 237

metric:
type: object
description: Defines a metric to be retrieved during an A/B test.
properties:
name:
type: string
description: Name of the metric.
dimension:
type: string
description: Dimension of the metric, for example, in case of a revenue metric it could be USD, EUR...
required:
- name
example:
- name: revenue
dimension: USD
- name: conversionRate
- name: clickThroughRate
- name: trackedSearchCount
Loading
Loading