@avsbhq/cli 3.7.0 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +10 -12
- package/dist/types/variation-code.d.ts +1 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -34135,6 +34135,7 @@ var ApiClient = class extends ApiTransport {
|
|
|
34135
34135
|
};
|
|
34136
34136
|
|
|
34137
34137
|
// src/lib/flagsApi.ts
|
|
34138
|
+
var IF_MATCH_HEADER = "X-Avsb-If-Match";
|
|
34138
34139
|
var FlagsApiClient = class extends ApiClient {
|
|
34139
34140
|
v1Project(projectRef) {
|
|
34140
34141
|
return `/api/v1/projects/${encodeURIComponent(String(projectRef))}`;
|
|
@@ -34153,9 +34154,9 @@ var FlagsApiClient = class extends ApiClient {
|
|
|
34153
34154
|
}
|
|
34154
34155
|
/**
|
|
34155
34156
|
* One flag, WITH its ETag. The ETag is what makes a safe update possible:
|
|
34156
|
-
* `avsb flags update` sends it back
|
|
34157
|
-
* made between the read and the write is refused (412)
|
|
34158
|
-
* overwritten.
|
|
34157
|
+
* `avsb flags update` sends it back on the conditional-write header, so a
|
|
34158
|
+
* change someone else made between the read and the write is refused (412)
|
|
34159
|
+
* instead of silently overwritten.
|
|
34159
34160
|
*/
|
|
34160
34161
|
async getFlag(projectRef, flagRef) {
|
|
34161
34162
|
return this.requestWithMeta(
|
|
@@ -34179,7 +34180,7 @@ var FlagsApiClient = class extends ApiClient {
|
|
|
34179
34180
|
{
|
|
34180
34181
|
method: "PATCH",
|
|
34181
34182
|
body: JSON.stringify(patch),
|
|
34182
|
-
headers: ifMatch ? {
|
|
34183
|
+
headers: ifMatch ? { [IF_MATCH_HEADER]: ifMatch } : {}
|
|
34183
34184
|
}
|
|
34184
34185
|
);
|
|
34185
34186
|
}
|
|
@@ -40040,8 +40041,10 @@ function buildUpdateMetricBindingPatch(opts) {
|
|
|
40040
40041
|
if (opts.denominatorMetric !== void 0) patch.denominatorMetricId = opts.denominatorMetric;
|
|
40041
40042
|
if (opts.percentile !== void 0) {
|
|
40042
40043
|
const p = Number(opts.percentile);
|
|
40043
|
-
if (!Number.isFinite(p)) {
|
|
40044
|
-
failCommand(
|
|
40044
|
+
if (!Number.isFinite(p) || p <= 0 || p >= 100) {
|
|
40045
|
+
failCommand(
|
|
40046
|
+
new CliError("cli_usage", "--percentile must be a number strictly between 0 and 100.")
|
|
40047
|
+
);
|
|
40045
40048
|
}
|
|
40046
40049
|
patch.percentile = p;
|
|
40047
40050
|
}
|
|
@@ -40176,13 +40179,8 @@ var metricBindingsUpdateCommand = new Command("update").argument("<metricBinding
|
|
|
40176
40179
|
const spinner = ora("Updating metric binding...").start();
|
|
40177
40180
|
try {
|
|
40178
40181
|
const response = await api.updateMetricBinding(shortId, metricBindingId, patch);
|
|
40179
|
-
const { metricBinding
|
|
40182
|
+
const { metricBinding } = response.data;
|
|
40180
40183
|
spinner.succeed(`Metric binding updated: ${metricBinding.name} (${metricBindingIdLabel(metricBinding)})`);
|
|
40181
|
-
if (amendment?.required) {
|
|
40182
|
-
warn(
|
|
40183
|
-
`Change requires an amendment on sealed analysis plan(s). Fields: ${amendment.requiredFields.join(", ")}`
|
|
40184
|
-
);
|
|
40185
|
-
}
|
|
40186
40184
|
printMetricBindingDetails(metricBinding);
|
|
40187
40185
|
} catch (err) {
|
|
40188
40186
|
spinner.fail("Failed to update metric binding");
|
|
@@ -15,12 +15,6 @@
|
|
|
15
15
|
// Not a module, for the same reason as `avsb.d.ts`: these are global names, and
|
|
16
16
|
// an `export` would hide all of them. Frozen at launch: rename nothing, add only.
|
|
17
17
|
|
|
18
|
-
/** Recommendations client pre-bound to the running experiment and variation. */
|
|
19
|
-
interface AvsbBoundRecsClient extends AvsbRecsClient {
|
|
20
|
-
/** Resolve THIS variation's bound recipe, so one code block serves every variation. */
|
|
21
|
-
getBound(req?: Omit<AvsbRecsRequest, 'recipe'>): Promise<AvsbRecsResult>
|
|
22
|
-
}
|
|
23
|
-
|
|
24
18
|
/** What every user-code surface receives. Self-cleaning helpers are torn down for you. */
|
|
25
19
|
interface AvsbCodeOptions {
|
|
26
20
|
/** Present in variation and trigger code. */
|
|
@@ -37,7 +31,7 @@ interface AvsbCodeOptions {
|
|
|
37
31
|
onRemove(cb: () => void): void
|
|
38
32
|
track: AvsbTrackFunction
|
|
39
33
|
/** Impressions and clicks attribute to this variation automatically. */
|
|
40
|
-
recs:
|
|
34
|
+
recs: AvsbRecsClient
|
|
41
35
|
getVisitorId(): string | null
|
|
42
36
|
/** The visitor's numeric **Variation ID** in that experiment, or null. Takes the numeric **Experiment ID** from the experiment details panel, NOT the `experimentId` above (that one is the internal id). */
|
|
43
37
|
getVariation(experimentId: string | number): string | null
|