Skip to content

Commit 9ea5afd

Browse files
committed
feat(javascript): generate abtesting v3 alpha client
1 parent 95669ad commit 9ea5afd

File tree

8 files changed

+143
-69
lines changed

8 files changed

+143
-69
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version": "0.0.1-alpha.1",
3+
"repository": {
4+
"type": "git",
5+
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
6+
},
7+
"homepage": "https://github.com/algolia/algoliasearch-client-javascript/packages/abtesting#readme",
8+
"type": "module",
9+
"license": "MIT",
10+
"author": "Algolia",
11+
"scripts": {
12+
"build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js",
13+
"clean": "rm -rf ./dist || true",
14+
"test:bundle": "publint . && attw --pack ."
15+
},
16+
"name": "@algolia/abtesting",
17+
"description": "JavaScript client for abtesting",
18+
"exports": {
19+
".": {
20+
"node": {
21+
"types": {
22+
"import": "./dist/node.d.ts",
23+
"module": "./dist/node.d.ts",
24+
"require": "./dist/node.d.cts"
25+
},
26+
"import": "./dist/builds/node.js",
27+
"module": "./dist/builds/node.js",
28+
"require": "./dist/builds/node.cjs"
29+
},
30+
"worker": {
31+
"types": "./dist/worker.d.ts",
32+
"default": "./dist/builds/worker.js"
33+
},
34+
"default": {
35+
"types": "./dist/browser.d.ts",
36+
"module": "./dist/builds/browser.js",
37+
"import": "./dist/builds/browser.js",
38+
"default": "./dist/builds/browser.umd.js"
39+
}
40+
},
41+
"./dist/builds/*": "./dist/builds/*.js"
42+
},
43+
"jsdelivr": "./dist/builds/browser.umd.js",
44+
"unpkg": "./dist/builds/browser.umd.js",
45+
"react-native": "./dist/builds/browser.js",
46+
"files": [
47+
"dist",
48+
"index.js",
49+
"index.d.ts"
50+
],
51+
"dependencies": {
52+
"@algolia/client-common": "5.23.4",
53+
"@algolia/requester-browser-xhr": "5.23.4",
54+
"@algolia/requester-node-http": "5.23.4",
55+
"@algolia/requester-fetch": "5.23.4"
56+
},
57+
"devDependencies": {
58+
"@arethetypeswrong/cli": "0.17.4",
59+
"@types/node": "22.14.1",
60+
"publint": "0.3.12",
61+
"rollup": "4.39.0",
62+
"tsup": "8.4.0",
63+
"typescript": "5.8.3"
64+
},
65+
"engines": {
66+
"node": ">= 14.0.0"
67+
}
68+
}

config/clients.config.json

+5
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@
138138
"name": "abtesting",
139139
"output": "clients/algoliasearch-client-javascript/packages/client-abtesting"
140140
},
141+
{
142+
"name": "abtesting-v3",
143+
"output": "clients/algoliasearch-client-javascript/packages/abtesting",
144+
"isStandaloneClient": true
145+
},
141146
{
142147
"name": "analytics",
143148
"output": "clients/algoliasearch-client-javascript/packages/client-analytics"

config/clients.schema.json

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"type": "string",
1313
"enum": [
1414
"abtesting",
15+
"abtesting-v3",
1516
"analytics",
1617
"composition",
1718
"ingestion",
@@ -34,6 +35,7 @@
3435
"enum": [
3536
"algoliasearch",
3637
"abtesting",
38+
"abtesting-v3",
3739
"analytics",
3840
"composition",
3941
"composition-full",

specs/abtesting-v3/common/parameters.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ ID:
55
description: Unique A/B test identifier.
66
required: true
77
schema:
8-
$ref: "#/abTestID"
8+
$ref: '#/abTestID'
99

1010
# misc
1111
index:
1212
type: string
1313
description: Index name of the A/B test variant (case-sensitive).
14-
example: "delcourt_production"
14+
example: 'delcourt_production'
1515

1616
abTestID:
1717
type: integer
@@ -75,7 +75,7 @@ currencies:
7575
mean: 43.7
7676
standardDeviation: 10.3
7777
additionalProperties:
78-
$ref: "#/currency"
78+
$ref: '#/currency'
7979
x-additionalPropertiesName: currency code
8080

8181
currency:
@@ -84,7 +84,7 @@ currency:
8484
currency:
8585
type: string
8686
description: Currency code.
87-
example: "USD"
87+
example: 'USD'
8888
revenue:
8989
type: number
9090
format: double

specs/abtesting-v3/common/schemas/ABTest.yml

+15-16
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,31 @@ ABTests:
33
- type: array
44
description: A/B tests.
55
items:
6-
$ref: "#/ABTest"
7-
- type: "null"
8-
description: No A/B tests are configured for this application.
6+
$ref: '#/ABTest'
7+
- type: 'null'
98

109
ABTest:
1110
type: object
1211
additionalProperties: false
1312
properties:
1413
abTestID:
15-
$ref: "../parameters.yml#/abTestID"
14+
$ref: '../parameters.yml#/abTestID'
1615
updatedAt:
17-
$ref: "../parameters.yml#/updatedAt"
16+
$ref: '../parameters.yml#/updatedAt'
1817
createdAt:
19-
$ref: "../parameters.yml#/createdAt"
18+
$ref: '../parameters.yml#/createdAt'
2019
endAt:
21-
$ref: "../parameters.yml#/endAt"
20+
$ref: '../parameters.yml#/endAt'
2221
name:
23-
$ref: "../parameters.yml#/name"
22+
$ref: '../parameters.yml#/name'
2423
status:
25-
$ref: "#/Status"
24+
$ref: '#/Status'
2625
variants:
27-
$ref: "Variant.yml#/variants"
26+
$ref: 'Variant.yml#/variants'
2827
configuration:
29-
$ref: "#/ABTestConfiguration"
28+
$ref: '#/ABTestConfiguration'
3029
migratedAbTestID:
31-
$ref: "#/MigratedABTestId"
30+
$ref: '#/MigratedABTestId'
3231
required:
3332
- status
3433
- name
@@ -60,11 +59,11 @@ ABTestConfiguration:
6059
description: A/B test configuration.
6160
properties:
6261
outliers:
63-
$ref: "#/Outliers"
62+
$ref: '#/Outliers'
6463
emptySearch:
65-
$ref: "#/EmptySearch"
64+
$ref: '#/EmptySearch'
6665
minimumDetectableEffect:
67-
$ref: "#/MinimumDetectableEffect"
66+
$ref: '#/MinimumDetectableEffect'
6867

6968
Outliers:
7069
type: object
@@ -96,7 +95,7 @@ MinimumDetectableEffect:
9695
Smallest difference in an observable metric between variants.
9796
For example, to detect a 10% difference between variants, set this value to 0.1.
9897
metric:
99-
$ref: "#/EffectMetric"
98+
$ref: '#/EffectMetric'
10099
required:
101100
- size
102101
- metric

specs/abtesting-v3/common/schemas/Timeseries.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Timeseries:
33
additionalProperties: false
44
properties:
55
abTestID:
6-
$ref: "../parameters.yml#/abTestID"
6+
$ref: '../parameters.yml#/abTestID'
77
variants:
8-
$ref: "#/timeseriesVariants"
8+
$ref: '#/timeseriesVariants'
99
required:
1010
- abTestID
1111
- variants
@@ -18,18 +18,18 @@ timeseriesVariants:
1818
The first variant is your _control_ index, typically your production index.
1919
All of the additional variants are indexes with changed settings that you want to test against the control.
2020
items:
21-
$ref: "#/timeseriesVariant"
21+
$ref: '#/timeseriesVariant'
2222

2323
timeseriesVariant:
2424
type: object
2525
properties:
2626
dates:
27-
$ref: "#/metricDates"
27+
$ref: '#/metricDates'
2828

2929
metricDates:
3030
type: array
3131
items:
32-
$ref: "#/metricDate"
32+
$ref: '#/metricDate'
3333

3434
metricDate:
3535
type: object
@@ -40,4 +40,4 @@ metricDate:
4040
format: date
4141
example: 2025-06-15
4242
metrics:
43-
$ref: "Variant.yml#/metrics"
43+
$ref: 'Variant.yml#/metrics'

specs/abtesting-v3/paths/abtests.yml

+33-33
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,49 @@ post:
1616
additionalProperties: false
1717
properties:
1818
name:
19-
$ref: "../common/parameters.yml#/name"
19+
$ref: '../common/parameters.yml#/name'
2020
variants:
2121
type: array
2222
description: A/B test variants.
2323
minItems: 2
2424
items:
25-
$ref: "../common/schemas/AddABTestsVariant.yml#/AddABTestsVariant"
25+
$ref: '../common/schemas/AddABTestsVariant.yml#/AddABTestsVariant'
2626
metrics:
2727
type: array
2828
description: A/B test metrics involved in the test. Only these metrics will be considered when calculating results.
2929
items:
30-
$ref: "../common/parameters.yml#/metric"
30+
$ref: '../common/parameters.yml#/metric'
3131
configuration:
32-
$ref: "../common/schemas/ABTest.yml#/ABTestConfiguration"
32+
$ref: '../common/schemas/ABTest.yml#/ABTestConfiguration'
3333
endAt:
34-
$ref: "../common/parameters.yml#/endAt"
34+
$ref: '../common/parameters.yml#/endAt'
3535
required:
3636
- name
3737
- variants
3838
- metrics
3939
- endAt
4040
responses:
41-
"200":
41+
'200':
4242
description: OK
4343
headers:
4444
x-ratelimit-limit:
45-
$ref: "../../common/responses/rateLimit.yml#/x-ratelimit-limit"
45+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-limit'
4646
x-ratelimit-remaining:
47-
$ref: "../../common/responses/rateLimit.yml#/x-ratelimit-remaining"
47+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-remaining'
4848
x-ratelimit-reset:
49-
$ref: "../../common/responses/rateLimit.yml#/x-ratelimit-reset"
49+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-reset'
5050
content:
5151
application/json:
5252
schema:
53-
$ref: "../common/schemas/ABTestResponse.yml#/ABTestResponse"
54-
"400":
55-
$ref: "../../common/responses/BadRequest.yml"
56-
"402":
57-
$ref: "../../common/responses/FeatureNotEnabled.yml"
58-
"403":
59-
$ref: "../../common/responses/MethodNotAllowed.yml"
60-
"404":
61-
$ref: "../../common/responses/IndexNotFound.yml"
53+
$ref: '../common/schemas/ABTestResponse.yml#/ABTestResponse'
54+
'400':
55+
$ref: '../../common/responses/BadRequest.yml'
56+
'402':
57+
$ref: '../../common/responses/FeatureNotEnabled.yml'
58+
'403':
59+
$ref: '../../common/responses/MethodNotAllowed.yml'
60+
'404':
61+
$ref: '../../common/responses/IndexNotFound.yml'
6262

6363
get:
6464
tags:
@@ -87,25 +87,25 @@ get:
8787
- name: indexPrefix
8888
in: query
8989
description: Index name prefix. Only A/B tests for indices starting with this string are included in the response.
90-
example: "dev_"
90+
example: 'dev_'
9191
schema:
9292
type: string
9393
- name: indexSuffix
9494
in: query
9595
description: Index name suffix. Only A/B tests for indices ending with this string are included in the response.
96-
example: "_development"
96+
example: '_development'
9797
schema:
9898
type: string
9999
responses:
100-
"200":
100+
'200':
101101
description: OK
102102
headers:
103103
x-ratelimit-limit:
104-
$ref: "../../common/responses/rateLimit.yml#/x-ratelimit-limit"
104+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-limit'
105105
x-ratelimit-remaining:
106-
$ref: "../../common/responses/rateLimit.yml#/x-ratelimit-remaining"
106+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-remaining'
107107
x-ratelimit-reset:
108-
$ref: "../../common/responses/rateLimit.yml#/x-ratelimit-reset"
108+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-reset'
109109
content:
110110
application/json:
111111
schema:
@@ -114,7 +114,7 @@ get:
114114
additionalProperties: false
115115
properties:
116116
abtests:
117-
$ref: "../common/schemas/ABTest.yml#/ABTests"
117+
$ref: '../common/schemas/ABTest.yml#/ABTests'
118118
count:
119119
type: integer
120120
description: Number of A/B tests.
@@ -127,11 +127,11 @@ get:
127127
- abtests
128128
- count
129129
- total
130-
"400":
131-
$ref: "../../common/responses/BadRequest.yml"
132-
"402":
133-
$ref: "../../common/responses/FeatureNotEnabled.yml"
134-
"403":
135-
$ref: "../../common/responses/MethodNotAllowed.yml"
136-
"404":
137-
$ref: "../../common/responses/IndexNotFound.yml"
130+
'400':
131+
$ref: '../../common/responses/BadRequest.yml'
132+
'402':
133+
$ref: '../../common/responses/FeatureNotEnabled.yml'
134+
'403':
135+
$ref: '../../common/responses/MethodNotAllowed.yml'
136+
'404':
137+
$ref: '../../common/responses/IndexNotFound.yml'

0 commit comments

Comments
 (0)