@findlane/server 0.25.0 → 0.27.0

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/index.cjs CHANGED
@@ -357,6 +357,7 @@ class SearchServerClient {
357
357
  productCounts: (options = {}) => report("product-counts", options),
358
358
  product: (objectID, options = {}) => report(`products/${encodeURIComponent(objectID)}`, options),
359
359
  revenue: (options = {}) => report("revenue", options),
360
+ filterSales: (options = {}) => report("filter-sales", options),
360
361
  banners: (options = {}) => request(`/banners?range=${options.range ?? "30d"}`, "GET", undefined, options.signal)
361
362
  },
362
363
  upsert: (records, signal) => request("/records", "POST", { records }, signal),
@@ -380,6 +381,8 @@ class SearchServerClient {
380
381
  const stage = await beginReplacement(stageId, options.signal);
381
382
  if (stage.status === "committed")
382
383
  return { acceptedRevision: stage.acceptedRevision, recordCount: stage.recordCount, replaced: true };
384
+ if (stage.status === "committing")
385
+ return await commitReplacement(stageId, stage.batchCount, stage.recordCount, options.signal);
383
386
  if (stage.status !== "open")
384
387
  throw new Error(`Stage is ${stage.status}`);
385
388
  let batch = [];
package/dist/index.d.cts CHANGED
@@ -21,7 +21,12 @@ export type IndexSettings = {
21
21
  }[];
22
22
  facetFields: string[];
23
23
  filterFields?: string[];
24
- typoTolerance: boolean;
24
+ /** Prefixes and typos match (true, the default), or not (false). `"min"` keeps only the results with the
25
+ * fewest typos, and `"strict"` those and the ones with one more, ranked after them, as Algolia's modes do. */
26
+ typoTolerance: boolean | "min" | "strict";
27
+ /** The last query word matches as the start of longer words from its first letter, numbers too, for search
28
+ * boxes that search as you type. Off by default, when words match as prefixes from 3 letters. */
29
+ shortPrefixes?: boolean;
25
30
  /** Words of at least `oneTypo` letters match with one typo, and of at least `twoTypos` with two.
26
31
  * `{ oneTypo: 4, twoTypos: 7 }` by default; oneTypo is 3 to 20, twoTypos from oneTypo to 50. */
27
32
  typoWordLengths?: {
@@ -691,7 +696,8 @@ export type IndexingStatus = {
691
696
  };
692
697
  export type ReplacementStage = {
693
698
  stageId: string;
694
- status: "open" | "committed" | "aborted";
699
+ /** "committing" (0.27.0): a big stage's commit going on in steps; committing it again waits for it. */
700
+ status: "open" | "committing" | "committed" | "aborted";
695
701
  baseRevision: number;
696
702
  recordCount: number;
697
703
  batchCount: number;
@@ -750,6 +756,13 @@ export type ServerEvent = {
750
756
  list?: "goesWith" | "similar" | "together" | "related";
751
757
  from?: string;
752
758
  timestamp?: number;
759
+ /** When the search wasn't made on the store but opened from outside it: an ad, an email, or another site's
760
+ * link. Revenue from search leaves these clicks out. */
761
+ landing?: "ad" | "email" | "link";
762
+ /** With `landing: "ad"`: the ad's network, from its click ID or tags. */
763
+ network?: "google" | "microsoft" | "meta" | "tiktok" | "x" | "linkedin" | "pinterest" | "snapchat";
764
+ /** The filters of the search the click came from, as the search took them, for sales by filter value. */
765
+ filters?: Record<string, unknown>;
753
766
  } | {
754
767
  type: "addToCart";
755
768
  items: EventItem[];
@@ -1115,6 +1128,8 @@ export type RevenueQuery = {
1115
1128
  carts: number;
1116
1129
  orders: number;
1117
1130
  revenue: number;
1131
+ /** Orders' value after this search when an ad, an email or another site opened it, not counted in `revenue`. */
1132
+ openedRevenue: number;
1118
1133
  typed: string[];
1119
1134
  };
1120
1135
  /** A product's orders and their value, beside those found through search, and the query it was found by most. */
@@ -1126,6 +1141,7 @@ export type RevenueProduct = {
1126
1141
  revenue: number;
1127
1142
  searchOrders: number;
1128
1143
  searchRevenue: number;
1144
+ openedRevenue: number;
1129
1145
  topQuery: string | null;
1130
1146
  };
1131
1147
  /** Revenue from search (0.20.0): purchases and add-to-carts of products the shopper clicked in search results in
@@ -1144,6 +1160,24 @@ export type RevenueReport = AnalyticsReport & {
1144
1160
  searchCarts: number;
1145
1161
  searchCartValue: number;
1146
1162
  searchClicks: number;
1163
+ /** Orders and add-to-carts after searches an ad, an email or another site's link opened (0.26.0): the shopper didn't
1164
+ * search, so they're left out of the search numbers. By kind, with the clicks on such searches. */
1165
+ opened: {
1166
+ orders: number;
1167
+ revenue: number;
1168
+ carts: number;
1169
+ cartValue: number;
1170
+ clicks: number;
1171
+ byKind: Record<"ad" | "email" | "link", {
1172
+ orders: number;
1173
+ revenue: number;
1174
+ }>;
1175
+ };
1176
+ /** Orders in the main currency cancelled or refunded since (0.27.0), which every number above leaves out, and their value. */
1177
+ cancelled: {
1178
+ orders: number;
1179
+ revenue: number;
1180
+ };
1147
1181
  otherCurrencies: {
1148
1182
  currency: string;
1149
1183
  orders: number;
@@ -1164,6 +1198,31 @@ export type RevenueReport = AnalyticsReport & {
1164
1198
  /** The products bought after a search, the most revenue from search first, up to 50. */
1165
1199
  products: RevenueProduct[];
1166
1200
  };
1201
+ /** A filter value's clicks on results while it was chosen, and the add-to-carts, orders and revenue of the products
1202
+ * clicked. */
1203
+ export type FilterValueSales = {
1204
+ value: string;
1205
+ clicks: number;
1206
+ carts: number;
1207
+ orders: number;
1208
+ revenue: number;
1209
+ };
1210
+ /** Sales by filter value (0.26.0): for each facet field, the values shoppers filtered on, on searches and on category
1211
+ * pages apart, attributed as revenue from search is. A click with several values counts for each. From when clicks
1212
+ * started carrying filters (`since`). */
1213
+ export type FilterSalesReport = AnalyticsReport & {
1214
+ computedAt: string;
1215
+ since: string;
1216
+ currency: string | null;
1217
+ fields: {
1218
+ field: string;
1219
+ search: FilterValueSales[];
1220
+ page: FilterValueSales[];
1221
+ }[];
1222
+ /** Searches without filters, to compare with. */
1223
+ unfiltered: Omit<FilterValueSales, "value">;
1224
+ visitorIds: boolean;
1225
+ };
1167
1226
  export declare class FindlaneError extends Error {
1168
1227
  status: number;
1169
1228
  constructor(status: number, message: string);
@@ -1351,6 +1410,8 @@ export declare class SearchServerClient {
1351
1410
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1352
1411
  * product (0.20.0). */
1353
1412
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
1413
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
1414
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1354
1415
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1355
1416
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1356
1417
  banners: (options?: {
@@ -1557,6 +1618,8 @@ export declare class SearchServerClient {
1557
1618
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1558
1619
  * product (0.20.0). */
1559
1620
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
1621
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
1622
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1560
1623
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1561
1624
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1562
1625
  banners: (options?: {
@@ -1761,6 +1824,8 @@ export declare class SearchServerClient {
1761
1824
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1762
1825
  * product (0.20.0). */
1763
1826
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
1827
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
1828
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1764
1829
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1765
1830
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1766
1831
  banners: (options?: {
@@ -1965,6 +2030,8 @@ export declare class SearchServerClient {
1965
2030
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1966
2031
  * product (0.20.0). */
1967
2032
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2033
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2034
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1968
2035
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1969
2036
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1970
2037
  banners: (options?: {
@@ -2169,6 +2236,8 @@ export declare class SearchServerClient {
2169
2236
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2170
2237
  * product (0.20.0). */
2171
2238
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2239
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2240
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2172
2241
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2173
2242
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2174
2243
  banners: (options?: {
@@ -2373,6 +2442,8 @@ export declare class SearchServerClient {
2373
2442
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2374
2443
  * product (0.20.0). */
2375
2444
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2445
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2446
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2376
2447
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2377
2448
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2378
2449
  banners: (options?: {
@@ -2577,6 +2648,8 @@ export declare class SearchServerClient {
2577
2648
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2578
2649
  * product (0.20.0). */
2579
2650
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2651
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2652
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2580
2653
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2581
2654
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2582
2655
  banners: (options?: {
@@ -2781,6 +2854,8 @@ export declare class SearchServerClient {
2781
2854
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2782
2855
  * product (0.20.0). */
2783
2856
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2857
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2858
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2784
2859
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2785
2860
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2786
2861
  banners: (options?: {
@@ -2985,6 +3060,8 @@ export declare class SearchServerClient {
2985
3060
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2986
3061
  * product (0.20.0). */
2987
3062
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
3063
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
3064
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2988
3065
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2989
3066
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2990
3067
  banners: (options?: {
@@ -3189,6 +3266,8 @@ export declare class SearchServerClient {
3189
3266
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
3190
3267
  * product (0.20.0). */
3191
3268
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
3269
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
3270
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
3192
3271
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
3193
3272
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
3194
3273
  banners: (options?: {
@@ -3393,6 +3472,8 @@ export declare class SearchServerClient {
3393
3472
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
3394
3473
  * product (0.20.0). */
3395
3474
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
3475
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
3476
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
3396
3477
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
3397
3478
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
3398
3479
  banners: (options?: {
package/dist/index.d.ts CHANGED
@@ -21,7 +21,12 @@ export type IndexSettings = {
21
21
  }[];
22
22
  facetFields: string[];
23
23
  filterFields?: string[];
24
- typoTolerance: boolean;
24
+ /** Prefixes and typos match (true, the default), or not (false). `"min"` keeps only the results with the
25
+ * fewest typos, and `"strict"` those and the ones with one more, ranked after them, as Algolia's modes do. */
26
+ typoTolerance: boolean | "min" | "strict";
27
+ /** The last query word matches as the start of longer words from its first letter, numbers too, for search
28
+ * boxes that search as you type. Off by default, when words match as prefixes from 3 letters. */
29
+ shortPrefixes?: boolean;
25
30
  /** Words of at least `oneTypo` letters match with one typo, and of at least `twoTypos` with two.
26
31
  * `{ oneTypo: 4, twoTypos: 7 }` by default; oneTypo is 3 to 20, twoTypos from oneTypo to 50. */
27
32
  typoWordLengths?: {
@@ -691,7 +696,8 @@ export type IndexingStatus = {
691
696
  };
692
697
  export type ReplacementStage = {
693
698
  stageId: string;
694
- status: "open" | "committed" | "aborted";
699
+ /** "committing" (0.27.0): a big stage's commit going on in steps; committing it again waits for it. */
700
+ status: "open" | "committing" | "committed" | "aborted";
695
701
  baseRevision: number;
696
702
  recordCount: number;
697
703
  batchCount: number;
@@ -750,6 +756,13 @@ export type ServerEvent = {
750
756
  list?: "goesWith" | "similar" | "together" | "related";
751
757
  from?: string;
752
758
  timestamp?: number;
759
+ /** When the search wasn't made on the store but opened from outside it: an ad, an email, or another site's
760
+ * link. Revenue from search leaves these clicks out. */
761
+ landing?: "ad" | "email" | "link";
762
+ /** With `landing: "ad"`: the ad's network, from its click ID or tags. */
763
+ network?: "google" | "microsoft" | "meta" | "tiktok" | "x" | "linkedin" | "pinterest" | "snapchat";
764
+ /** The filters of the search the click came from, as the search took them, for sales by filter value. */
765
+ filters?: Record<string, unknown>;
753
766
  } | {
754
767
  type: "addToCart";
755
768
  items: EventItem[];
@@ -1115,6 +1128,8 @@ export type RevenueQuery = {
1115
1128
  carts: number;
1116
1129
  orders: number;
1117
1130
  revenue: number;
1131
+ /** Orders' value after this search when an ad, an email or another site opened it, not counted in `revenue`. */
1132
+ openedRevenue: number;
1118
1133
  typed: string[];
1119
1134
  };
1120
1135
  /** A product's orders and their value, beside those found through search, and the query it was found by most. */
@@ -1126,6 +1141,7 @@ export type RevenueProduct = {
1126
1141
  revenue: number;
1127
1142
  searchOrders: number;
1128
1143
  searchRevenue: number;
1144
+ openedRevenue: number;
1129
1145
  topQuery: string | null;
1130
1146
  };
1131
1147
  /** Revenue from search (0.20.0): purchases and add-to-carts of products the shopper clicked in search results in
@@ -1144,6 +1160,24 @@ export type RevenueReport = AnalyticsReport & {
1144
1160
  searchCarts: number;
1145
1161
  searchCartValue: number;
1146
1162
  searchClicks: number;
1163
+ /** Orders and add-to-carts after searches an ad, an email or another site's link opened (0.26.0): the shopper didn't
1164
+ * search, so they're left out of the search numbers. By kind, with the clicks on such searches. */
1165
+ opened: {
1166
+ orders: number;
1167
+ revenue: number;
1168
+ carts: number;
1169
+ cartValue: number;
1170
+ clicks: number;
1171
+ byKind: Record<"ad" | "email" | "link", {
1172
+ orders: number;
1173
+ revenue: number;
1174
+ }>;
1175
+ };
1176
+ /** Orders in the main currency cancelled or refunded since (0.27.0), which every number above leaves out, and their value. */
1177
+ cancelled: {
1178
+ orders: number;
1179
+ revenue: number;
1180
+ };
1147
1181
  otherCurrencies: {
1148
1182
  currency: string;
1149
1183
  orders: number;
@@ -1164,6 +1198,31 @@ export type RevenueReport = AnalyticsReport & {
1164
1198
  /** The products bought after a search, the most revenue from search first, up to 50. */
1165
1199
  products: RevenueProduct[];
1166
1200
  };
1201
+ /** A filter value's clicks on results while it was chosen, and the add-to-carts, orders and revenue of the products
1202
+ * clicked. */
1203
+ export type FilterValueSales = {
1204
+ value: string;
1205
+ clicks: number;
1206
+ carts: number;
1207
+ orders: number;
1208
+ revenue: number;
1209
+ };
1210
+ /** Sales by filter value (0.26.0): for each facet field, the values shoppers filtered on, on searches and on category
1211
+ * pages apart, attributed as revenue from search is. A click with several values counts for each. From when clicks
1212
+ * started carrying filters (`since`). */
1213
+ export type FilterSalesReport = AnalyticsReport & {
1214
+ computedAt: string;
1215
+ since: string;
1216
+ currency: string | null;
1217
+ fields: {
1218
+ field: string;
1219
+ search: FilterValueSales[];
1220
+ page: FilterValueSales[];
1221
+ }[];
1222
+ /** Searches without filters, to compare with. */
1223
+ unfiltered: Omit<FilterValueSales, "value">;
1224
+ visitorIds: boolean;
1225
+ };
1167
1226
  export declare class FindlaneError extends Error {
1168
1227
  status: number;
1169
1228
  constructor(status: number, message: string);
@@ -1351,6 +1410,8 @@ export declare class SearchServerClient {
1351
1410
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1352
1411
  * product (0.20.0). */
1353
1412
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
1413
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
1414
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1354
1415
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1355
1416
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1356
1417
  banners: (options?: {
@@ -1557,6 +1618,8 @@ export declare class SearchServerClient {
1557
1618
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1558
1619
  * product (0.20.0). */
1559
1620
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
1621
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
1622
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1560
1623
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1561
1624
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1562
1625
  banners: (options?: {
@@ -1761,6 +1824,8 @@ export declare class SearchServerClient {
1761
1824
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1762
1825
  * product (0.20.0). */
1763
1826
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
1827
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
1828
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1764
1829
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1765
1830
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1766
1831
  banners: (options?: {
@@ -1965,6 +2030,8 @@ export declare class SearchServerClient {
1965
2030
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
1966
2031
  * product (0.20.0). */
1967
2032
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2033
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2034
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
1968
2035
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
1969
2036
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
1970
2037
  banners: (options?: {
@@ -2169,6 +2236,8 @@ export declare class SearchServerClient {
2169
2236
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2170
2237
  * product (0.20.0). */
2171
2238
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2239
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2240
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2172
2241
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2173
2242
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2174
2243
  banners: (options?: {
@@ -2373,6 +2442,8 @@ export declare class SearchServerClient {
2373
2442
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2374
2443
  * product (0.20.0). */
2375
2444
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2445
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2446
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2376
2447
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2377
2448
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2378
2449
  banners: (options?: {
@@ -2577,6 +2648,8 @@ export declare class SearchServerClient {
2577
2648
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2578
2649
  * product (0.20.0). */
2579
2650
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2651
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2652
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2580
2653
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2581
2654
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2582
2655
  banners: (options?: {
@@ -2781,6 +2854,8 @@ export declare class SearchServerClient {
2781
2854
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2782
2855
  * product (0.20.0). */
2783
2856
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
2857
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
2858
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2784
2859
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2785
2860
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2786
2861
  banners: (options?: {
@@ -2985,6 +3060,8 @@ export declare class SearchServerClient {
2985
3060
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
2986
3061
  * product (0.20.0). */
2987
3062
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
3063
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
3064
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
2988
3065
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
2989
3066
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
2990
3067
  banners: (options?: {
@@ -3189,6 +3266,8 @@ export declare class SearchServerClient {
3189
3266
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
3190
3267
  * product (0.20.0). */
3191
3268
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
3269
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
3270
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
3192
3271
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
3193
3272
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
3194
3273
  banners: (options?: {
@@ -3393,6 +3472,8 @@ export declare class SearchServerClient {
3393
3472
  /** Revenue from search: orders and add-to-carts of products found through search, per query and per
3394
3473
  * product (0.20.0). */
3395
3474
  revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
3475
+ /** Sales by filter value: each facet value's clicks, add-to-carts, orders and revenue (0.26.0). */
3476
+ filterSales: (options?: Omit<AnalyticsOptions, "source">) => Promise<FilterSalesReport>;
3396
3477
  /** Each banner's shown (shoppers' searches that showed it, cache answers included) and clicks, by its rule,
3397
3478
  * over the last 7, 30 (by default) or 90 days (0.23.0). */
3398
3479
  banners: (options?: {
package/dist/index.js CHANGED
@@ -311,6 +311,7 @@ class SearchServerClient {
311
311
  productCounts: (options = {}) => report("product-counts", options),
312
312
  product: (objectID, options = {}) => report(`products/${encodeURIComponent(objectID)}`, options),
313
313
  revenue: (options = {}) => report("revenue", options),
314
+ filterSales: (options = {}) => report("filter-sales", options),
314
315
  banners: (options = {}) => request(`/banners?range=${options.range ?? "30d"}`, "GET", undefined, options.signal)
315
316
  },
316
317
  upsert: (records, signal) => request("/records", "POST", { records }, signal),
@@ -334,6 +335,8 @@ class SearchServerClient {
334
335
  const stage = await beginReplacement(stageId, options.signal);
335
336
  if (stage.status === "committed")
336
337
  return { acceptedRevision: stage.acceptedRevision, recordCount: stage.recordCount, replaced: true };
338
+ if (stage.status === "committing")
339
+ return await commitReplacement(stageId, stage.batchCount, stage.recordCount, options.signal);
337
340
  if (stage.status !== "open")
338
341
  throw new Error(`Stage is ${stage.status}`);
339
342
  let batch = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findlane/server",
3
- "version": "0.25.0",
3
+ "version": "0.27.0",
4
4
  "description": "Findlane server SDK: upload catalogs, manage index settings, and search with a secret workspace API key.",
5
5
  "keywords": ["findlane", "search", "full-text search", "typo tolerance", "ecommerce search", "search api", "sdk"],
6
6
  "license": "MIT",