platform-types 1.10.807 → 1.10.809

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.
@@ -1,16 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PRODUCT_MEDIA_INVALID_REASONS = exports.MAX_PRODUCT_PICTURE_ALT_CHARS = exports.PRODUCT_UPSERT_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_CAP = exports.PUBLIC_PRODUCT_SUGGEST_ERROR_CODES = exports.PUBLIC_PRODUCT_BY_SLUG_ERROR_CODES = exports.PRODUCT_PUBLISH_OVERDUE_AFTER_MS = exports.PRODUCT_PUBLISH_AT_MAX_AHEAD_MS = exports.PRODUCT_POST_ERROR_CODES = exports.PRODUCT_IDENTITY_ERROR_CODES = exports.PRODUCT_EXPORT_ERROR_CODES = exports.PRODUCT_CATALOG_EXPORT_COLUMNS = exports.RECENT_PURCHASES_MAX = exports.BEST_SELLERS_MAX = exports.DISCOVERY_SORTS = exports.MAX_BASE_QUANTITY = exports.BASE_QUANTITY_DECIMAL_PLACES = void 0;
3
+ exports.PRODUCT_MEDIA_INVALID_REASONS = exports.MAX_PRODUCT_PICTURE_ALT_CHARS = exports.PRODUCT_UPSERT_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_ERROR_CODES = exports.PRODUCT_UPSERT_ROW_CAP = exports.PUBLIC_PRODUCT_SUGGEST_ERROR_CODES = exports.PUBLIC_PRODUCT_BY_SLUG_ERROR_CODES = exports.PRODUCT_PUBLISH_OVERDUE_AFTER_MS = exports.PRODUCT_PUBLISH_AT_MAX_AHEAD_MS = exports.PRODUCT_POST_ERROR_CODES = exports.PRODUCT_IDENTITY_ERROR_CODES = exports.PRODUCT_EXPORT_ERROR_CODES = exports.PRODUCT_CATALOG_EXPORT_COLUMNS = exports.RECENT_PURCHASES_MAX = exports.BEST_SELLERS_MAX = exports.DISCOVERY_FACETS = exports.DISCOVERY_SORTS = exports.MAX_BASE_QUANTITY = exports.BASE_QUANTITY_DECIMAL_PLACES = void 0;
4
4
  /** Maximum decimal places in a canonical base quantity; inputs are exact, never rounded. */
5
5
  exports.BASE_QUANTITY_DECIMAL_PLACES = 6;
6
6
  /** Absolute base-quantity input bound; signed adjustments admit the negative of this value. */
7
7
  exports.MAX_BASE_QUANTITY = 1_000_000;
8
8
  /**
9
9
  * The `sort` values Web `GET /products?mode=discover` serves. `newest` is
10
- * descending product id; name and price sorts are not served (no index can
11
- * order them inside one bounded request).
10
+ * descending product id; `price_asc` / `price_desc` are the caller's own price
11
+ * (see `PublicProductDiscoverInput.sort`). Name sorts are not served.
12
12
  */
13
- exports.DISCOVERY_SORTS = ['newest'];
13
+ exports.DISCOVERY_SORTS = ['newest', 'price_asc', 'price_desc'];
14
+ /**
15
+ * The facets Web `GET /products?mode=discover` can count (`facets=brand,tag,category`).
16
+ * `brand` tallies `brandId`, `tag` each of `tagIds`, `category` the EXACT `categoryId`
17
+ * (the filter matches no descendants, so a rolled-up parent would select nothing).
18
+ */
19
+ exports.DISCOVERY_FACETS = ['brand', 'tag', 'category'];
14
20
  /** Most products the store's best-seller ranking holds, and web `mode=best-sellers` returns. */
15
21
  exports.BEST_SELLERS_MAX = 50;
16
22
  /** Most distinct products a buyer's recent-purchases row holds, and web `mode=recently-bought` returns. */
package/dist/product.d.ts CHANGED
@@ -4,11 +4,18 @@ export declare const BASE_QUANTITY_DECIMAL_PLACES = 6;
4
4
  export declare const MAX_BASE_QUANTITY = 1000000;
5
5
  /**
6
6
  * The `sort` values Web `GET /products?mode=discover` serves. `newest` is
7
- * descending product id; name and price sorts are not served (no index can
8
- * order them inside one bounded request).
7
+ * descending product id; `price_asc` / `price_desc` are the caller's own price
8
+ * (see `PublicProductDiscoverInput.sort`). Name sorts are not served.
9
9
  */
10
- export declare const DISCOVERY_SORTS: readonly ["newest"];
10
+ export declare const DISCOVERY_SORTS: readonly ["newest", "price_asc", "price_desc"];
11
11
  export type DiscoverySort = (typeof DISCOVERY_SORTS)[number];
12
+ /**
13
+ * The facets Web `GET /products?mode=discover` can count (`facets=brand,tag,category`).
14
+ * `brand` tallies `brandId`, `tag` each of `tagIds`, `category` the EXACT `categoryId`
15
+ * (the filter matches no descendants, so a rolled-up parent would select nothing).
16
+ */
17
+ export declare const DISCOVERY_FACETS: readonly ["brand", "tag", "category"];
18
+ export type DiscoveryFacet = (typeof DISCOVERY_FACETS)[number];
12
19
  /** Most products the store's best-seller ranking holds, and web `mode=best-sellers` returns. */
13
20
  export declare const BEST_SELLERS_MAX = 50;
14
21
  /** Most distinct products a buyer's recent-purchases row holds, and web `mode=recently-bought` returns. */
@@ -273,14 +280,58 @@ declare global {
273
280
  isNew?: 'true';
274
281
  /**
275
282
  * A member of `DISCOVERY_SORTS`. `newest` = descending product id (mint
276
- * order), on every filter combination. A well-formed value the api does not
277
- * serve is 400 `DISCOVERY_SORT_UNSUPPORTED` ({@link DiscoverySortRefusal});
278
- * one not matching `^[a-z_]{1,32}$` is 400 `INVALID_DISCOVERY_QUERY`. An
279
- * empty value is absent. Bound into the cursor when present.
283
+ * order), on every filter combination. `price_asc` / `price_desc` = the
284
+ * caller's own price, as each row is priced for them: in the store's display
285
+ * currency, an open offer counting as the price, no quantity break. Rows the
286
+ * caller is shown no price for (a hidden slot, every row for a guest of a
287
+ * store that hides prices) come LAST in both directions; equal prices and
288
+ * that unpriced tail are newest first. A price sort reads the whole filtered
289
+ * set on every page, so a set too large for one read is 400
290
+ * `DISCOVERY_SORT_UNSUPPORTED` after the reads, with `supportedSorts`
291
+ * naming what that query can be served in, and a read the time budget cut
292
+ * short is 503 `PRODUCT_LOOKUP_INCOMPLETE` (retryable). A price cursor is
293
+ * also bound to the caller's price list: resumed under another (a sign-in,
294
+ * a list change) it is 400 `INVALID_CURSOR`. A well-formed value the api does
295
+ * not serve is 400 `DISCOVERY_SORT_UNSUPPORTED` ({@link DiscoverySortRefusal})
296
+ * before any read; one not matching `^[a-z_]{1,32}$` is 400
297
+ * `INVALID_DISCOVERY_QUERY`. An empty value is absent. Bound into the cursor
298
+ * when present.
280
299
  */
281
300
  sort?: string;
282
301
  /** The previous response's `LastEvaluatedKey`, under the SAME filters and sort; else 400 INVALID_CURSOR. */
283
302
  startKey?: string;
303
+ /**
304
+ * Comma-separated `DISCOVERY_FACETS` members to count. Unknown members are
305
+ * ignored; a value outside `^[\w,-]{1,128}$` is 400 `INVALID_DISCOVERY_QUERY`.
306
+ * Honoured only on a first page (no `startKey`), ignored after it. Never bound
307
+ * into the cursor.
308
+ */
309
+ facets?: string;
310
+ }
311
+ /**
312
+ * One facet value: applied as its filter with the other current filters, it returns at
313
+ * least `count` rows across the walk — exactly `count` unless the facets are `truncated`.
314
+ */
315
+ interface DiscoveryFacetValue {
316
+ id: string;
317
+ count: number;
318
+ }
319
+ /**
320
+ * The values each requested facet can take under the current query, count
321
+ * descending. Disjunctive: a facet is counted with every other filter applied
322
+ * but not its own, so the picked brand still lists its sibling brands. A
323
+ * facet absent from the request is absent here.
324
+ */
325
+ interface DiscoveryFacets {
326
+ brand?: DiscoveryFacetValue[];
327
+ tag?: DiscoveryFacetValue[];
328
+ category?: DiscoveryFacetValue[];
329
+ /**
330
+ * The count walk hit its read budget before the catalogue ended: every
331
+ * listed value still returns rows, but counts are lower bounds and a value
332
+ * may be missing — fall back to the store-wide list for anything unlisted.
333
+ */
334
+ truncated?: true;
284
335
  }
285
336
  /** One page of a discovery walk; `data` can be empty while `LastEvaluatedKey` is set. */
286
337
  interface PublicProductDiscoverResponse {
@@ -291,6 +342,12 @@ declare global {
291
342
  sort?: (typeof DISCOVERY_SORTS)[number];
292
343
  /** Present while rows remain; absent means the walk is complete. */
293
344
  LastEvaluatedKey?: string;
345
+ /**
346
+ * Only on a first page whose request named a known facet. Also absent when the
347
+ * count failed (the rows still answer) — read absence as "fall back to the
348
+ * store-wide lists", never as "no values".
349
+ */
350
+ facets?: DiscoveryFacets;
294
351
  }
295
352
  /**
296
353
  * Web `GET /products?mode=best-sellers` and `mode=recently-bought`: at most 50 rows, no cursor,
@@ -335,8 +392,14 @@ declare global {
335
392
  truncated?: true;
336
393
  }
337
394
  /** Refusals of Web `GET /products?mode=discover`. */
338
- type DiscoveryErrorCode = 'INVALID_DISCOVERY_QUERY' | 'INVALID_CURSOR' | 'DISCOVERY_SORT_UNSUPPORTED';
339
- /** 400 body for a well-formed `sort` the api does not serve; `supportedSorts` lists what it does. */
395
+ type DiscoveryErrorCode = 'INVALID_DISCOVERY_QUERY' | 'INVALID_CURSOR' | 'DISCOVERY_SORT_UNSUPPORTED'
396
+ /** 503: a price-sorted walk the time budget cut short; retry. */
397
+ | 'PRODUCT_LOOKUP_INCOMPLETE';
398
+ /**
399
+ * 400 body for a `sort` the api does not serve for this request; `supportedSorts` lists what
400
+ * it does — every member for an unknown value, the non-price sorts when a price sort's
401
+ * filtered set was too large to read whole.
402
+ */
340
403
  interface DiscoverySortRefusal {
341
404
  message: string;
342
405
  error: 'DISCOVERY_SORT_UNSUPPORTED';
package/dist/product.js CHANGED
@@ -4,10 +4,16 @@ export const BASE_QUANTITY_DECIMAL_PLACES = 6;
4
4
  export const MAX_BASE_QUANTITY = 1_000_000;
5
5
  /**
6
6
  * The `sort` values Web `GET /products?mode=discover` serves. `newest` is
7
- * descending product id; name and price sorts are not served (no index can
8
- * order them inside one bounded request).
7
+ * descending product id; `price_asc` / `price_desc` are the caller's own price
8
+ * (see `PublicProductDiscoverInput.sort`). Name sorts are not served.
9
9
  */
10
- export const DISCOVERY_SORTS = ['newest'];
10
+ export const DISCOVERY_SORTS = ['newest', 'price_asc', 'price_desc'];
11
+ /**
12
+ * The facets Web `GET /products?mode=discover` can count (`facets=brand,tag,category`).
13
+ * `brand` tallies `brandId`, `tag` each of `tagIds`, `category` the EXACT `categoryId`
14
+ * (the filter matches no descendants, so a rolled-up parent would select nothing).
15
+ */
16
+ export const DISCOVERY_FACETS = ['brand', 'tag', 'category'];
11
17
  /** Most products the store's best-seller ranking holds, and web `mode=best-sellers` returns. */
12
18
  export const BEST_SELLERS_MAX = 50;
13
19
  /** Most distinct products a buyer's recent-purchases row holds, and web `mode=recently-bought` returns. */
@@ -762,6 +762,8 @@ declare global {
762
762
  /** Web `mode=discover`'s `sort`; an unserved one answers 400 `DISCOVERY_SORT_UNSUPPORTED`. */
763
763
  sort?: DiscoverySort;
764
764
  startKey?: string;
765
+ /** Web `mode=discover`'s `facets`: counted on a first page only, answered as `facets`. */
766
+ facets?: string;
765
767
  }
766
768
  /**
767
769
  * Web `GET /products?updatedAt=`'s recency listing (the shop's «Ingresos» page), with the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.807",
3
+ "version": "1.10.809",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",