platform-types 1.10.766 → 1.10.767

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/account.d.ts CHANGED
@@ -324,8 +324,11 @@ declare global {
324
324
  * `DATE_RANGE_INCOMPLETE`) before format (`DATE_MALFORMED`) before semantics
325
325
  * (`DATE_RANGE_INVERTED`, `DATE_RANGE_TOO_WIDE`).
326
326
  *
327
- * ⚠️ The storefront twin can only ever return `DATE_MALFORMED`: it reads no
328
- * `from`/`to`, having no store-wide branch to window.
327
+ * ⚠️ The storefront twin reads no `from`/`to`, having no store-wide branch
328
+ * to window. Its `GET /account` returns `DATE_MALFORMED` (for `date` or
329
+ * `until`) and `DATE_RANGE_INVERTED` (`until` before `date`). The storefront
330
+ * `GET /orders` and `GET /invoices` return the same two codes, for `until`
331
+ * only (see {@link WebOrdersQuery}, {@link WebInvoicesQuery}).
329
332
  */
330
333
  type AccountDateRangeError = 'DATE_AND_RANGE_EXCLUSIVE' | 'DATE_RANGE_INCOMPLETE' | 'DATE_MALFORMED' | 'DATE_RANGE_INVERTED' | 'DATE_RANGE_TOO_WIDE';
331
334
  /**
@@ -345,13 +348,15 @@ declare global {
345
348
  * - `INVALID_CURSOR` — **400.** The `?startKey=` did not decode, or decoded to
346
349
  * a cursor for another store or another customer, one whose own key sits
347
350
  * outside the statement's key range at either end, or one whose pins do not
348
- * hold. ⚠️ **There are TWO pins.** `balanceDate` must not be absent,
351
+ * hold. ⚠️ **There are THREE pins.** `balanceDate` must not be absent,
349
352
  * non-numeric or raised past the cursor's own key; `date` must EQUAL the
350
353
  * `?date=` of the request spending the cursor, because it is the boundary
351
354
  * both statement reads are split on — changing it mid-walk would read the
352
355
  * same rows through a different filter and silently skip or repeat every row
353
- * the move crossed. A client that wants a different window starts a new walk
354
- * with no cursor. ⚠️ Never
356
+ * the move crossed; and `until` must EQUAL the request's `?until=`, or the
357
+ * open-end sentinel `99991231` when the request sends none (a cursor minted
358
+ * before `until` existed carries no such pin and is refused once). A client
359
+ * that wants a different window starts a new walk with no cursor. ⚠️ Never
355
360
  * "restart from page one" on this: a client cannot tell a silent restart
356
361
  * from a legitimate first page, so a paging loop re-reads from the top and
357
362
  * appends every row twice. Discard the cursor and ask the user.
@@ -367,6 +372,56 @@ declare global {
367
372
  * computes no sum.
368
373
  */
369
374
  type AccountStatementError = 'INVALID_CURSOR' | 'CUSTOMER_LEDGER_TRUNCATED';
375
+ /**
376
+ * How the storefront statement PDF (`GET /account?mode=pdf`) can REFUSE,
377
+ * beyond {@link AccountDateRangeError} (same window validation as the JSON
378
+ * page) and `CUSTOMER_LEDGER_TRUNCATED` (the same 503 envelope). Neither
379
+ * prints a partial PDF — a statement with missing rows prints wrong running
380
+ * balances.
381
+ *
382
+ * - `ACCOUNT_STATEMENT_PDF_TOO_LONG` — **422.** More movements than one PDF
383
+ * prints (3000), the server's drain budget ran out before the walk ended,
384
+ * or too little time was left to render before the 29 s gateway ceiling.
385
+ * The shopper fixes it by narrowing `date`/`until`; no operator ERROR row.
386
+ * - `ACCOUNT_STATEMENT_PDF_INCOMPLETE` — **503.** Rows are missing that no
387
+ * cursor can fetch (the JSON page's `incomplete`), the store's ledger
388
+ * currency could not be read, or (defensively — no path to it is known) a
389
+ * cursor the server's own drain minted was refused on resume. The shopper cannot fix it. The operator sees one
390
+ * deduplicated ERROR row per cause per customer per day
391
+ * (`ACCOUNT_STATEMENT_PDF_INCOMPLETE#{cause}#{customerId}`) — except the
392
+ * legacy bare-row cut, already recorded as
393
+ * `ACCOUNT_BARE_ROWS_TRUNCATED#{customerId}` by the statement read itself.
394
+ * Expected, not a crash: a client should not report it as an exception.
395
+ */
396
+ type AccountStatementPdfError = 'ACCOUNT_STATEMENT_PDF_TOO_LONG' | 'ACCOUNT_STATEMENT_PDF_INCOMPLETE';
397
+ /**
398
+ * The query string of the storefront `GET /account` (CUSTOMER token). The
399
+ * customer is the token's, never a query value.
400
+ *
401
+ * An EMPTY value is the same as an absent one.
402
+ */
403
+ interface WebAccountQuery {
404
+ /**
405
+ * `YYYYMMDD`, Buenos Aires. The opening-balance boundary: "Saldo anterior"
406
+ * is the balance before midnight of this day, and movements WRITTEN from
407
+ * then on are listed. Defaults to today. Every front end sends `19700101`
408
+ * for the whole ledger.
409
+ */
410
+ date?: string;
411
+ /** The previous page's `LastEvaluatedKey`. See {@link AccountStatementPaging}. */
412
+ startKey?: string;
413
+ /**
414
+ * `YYYYMMDD`, Buenos Aires, INCLUSIVE: movements written through
415
+ * 23:59:59.999 of this day are listed, later ones are not. Absent means
416
+ * open-ended. It bounds only the listed half — the opening balance is
417
+ * unchanged — so the closing figure is the balance as of the end of `until`.
418
+ * Rows are windowed by when they were WRITTEN (`createdAt`), as for `date`.
419
+ * `400 DATE_MALFORMED` if not a real calendar day; `400 DATE_RANGE_INVERTED`
420
+ * if before `date` (`until === date` is one day). No span cap. Pinned in the
421
+ * cursor: repeat it on every page.
422
+ */
423
+ until?: string;
424
+ }
370
425
  /**
371
426
  * How a customer statement PAGES.
372
427
  *
@@ -386,11 +441,20 @@ declare global {
386
441
  * - It also pins `date`, so **every page of one walk must be requested with
387
442
  * the same `?date=`**. A different one is `400 INVALID_CURSOR`, not a
388
443
  * re-anchored page: `date` is the boundary both reads are split on.
444
+ * - And it pins `until` (storefront only), so **every page of one walk
445
+ * repeats the same `?until=`** — or none, on every page. A change is
446
+ * `400 INVALID_CURSOR`.
389
447
  * - ⚠️ **A page may be EMPTY and still carry a cursor.** The listing read has
390
448
  * a page budget and a wall-clock budget, and it can spend either on rows the
391
- * `dated` filter discards before it matches anything. An empty page beside a
449
+ * `createdAt` filter discards before it matches anything. An empty page beside a
392
450
  * `LastEvaluatedKey` means "keep paging", never "drained" — the cursor's
393
451
  * ABSENCE is the only end-of-walk signal.
452
+ * - ⚠️ **`?mode=pdf` does not page.** The storefront `GET /account?mode=pdf`
453
+ * drains the whole window server-side from page one (`?startKey=` is
454
+ * ignored) and answers `{ data: 'data:application/pdf;base64,…' }` — the
455
+ * envelope of the order and invoice PDFs — or one of
456
+ * {@link AccountStatementPdfError}. Any other `mode`, absent included, is
457
+ * the JSON page described here.
394
458
  * - A cursor is bound to its STORE and its CUSTOMER and cannot be spent
395
459
  * against either another. It is **not** bound to the surface: an
396
460
  * operator-minted cursor is spendable on the storefront and vice versa,
package/dist/invoice.d.ts CHANGED
@@ -54,6 +54,32 @@ declare global {
54
54
  /** The AUTHORITATIVE amount, as declared — never re-derived from `baseImp × alic`. */
55
55
  importe: number;
56
56
  }
57
+ /**
58
+ * The query string of the storefront `GET /invoices` (CUSTOMER token): the
59
+ * shopper's own authorized invoices, newest first. The customer is the
60
+ * token's, never a query value.
61
+ */
62
+ interface WebInvoicesQuery {
63
+ /**
64
+ * `YYYYMMDD` lower bound on the voucher's `dated`, inclusive. Defaults to
65
+ * one Buenos Aires calendar month before today, the day clamped to that
66
+ * month's last day (31 Mar → 28/29 Feb). Shape-checked only.
67
+ */
68
+ since?: string;
69
+ /** Rows READ per page, 1–1000 (default 1000). A page may come back short or empty beside a cursor. */
70
+ Limit?: string;
71
+ /** The previous page's `LastEvaluatedKey` (a raw sort key, not pinned to `since`/`until`). */
72
+ offSet?: string;
73
+ /**
74
+ * `YYYYMMDD` upper bound on `dated`, INCLUSIVE. Absent or empty means
75
+ * open-ended. `400 DATE_MALFORMED` if not a real calendar day;
76
+ * `400 DATE_RANGE_INVERTED` if before `since`. A tight window makes short
77
+ * and empty pages beside a cursor more frequent — the cursor stays the only
78
+ * keep-paging signal. Changing it mid-walk re-filters the remaining rows;
79
+ * restart the walk instead.
80
+ */
81
+ until?: string;
82
+ }
57
83
  interface Invoice extends CurrencyRateProvenance {
58
84
  storeId: string;
59
85
  invoiceId: string;
package/dist/order.d.ts CHANGED
@@ -435,6 +435,24 @@ declare global {
435
435
  province?: string;
436
436
  phone?: string;
437
437
  }
438
+ /**
439
+ * The query string of the storefront `GET /orders` (CUSTOMER token). The
440
+ * customer is the token's, never a query value.
441
+ */
442
+ interface WebOrdersQuery {
443
+ /** `YYYYMMDD` lower bound on `deliveredDate`, inclusive. Defaults to today (Buenos Aires). */
444
+ date?: string;
445
+ /** A point read of one of the caller's own orders; `date`/`until` are ignored. */
446
+ orderId?: string;
447
+ /**
448
+ * `YYYYMMDD` upper bound on `deliveredDate`, INCLUSIVE. Absent or empty
449
+ * means open-ended. `400 DATE_MALFORMED` if not a real calendar day;
450
+ * `400 DATE_RANGE_INVERTED` if before `date` (so send both — `date`
451
+ * defaults to today). ⚠️ It never hides PENDING orders: they carry no
452
+ * delivery day to window and are always returned, whatever the window.
453
+ */
454
+ until?: string;
455
+ }
438
456
  interface Order extends CurrencyRateProvenance, CurrencyRateFreshness {
439
457
  storeId: string;
440
458
  orderId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.766",
3
+ "version": "1.10.767",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",