@simpleapps-com/augur-utils 2026.11.4 → 2026.11.6

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.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A log line: `context`, then `": "` and `errorName` when there is one. There is no way to pass
3
+ * anything else, so a token, a customer's details or an upstream body never reach a log.
4
+ *
5
+ * @ensures exactly the model's LogLine
6
+ */
7
+ export declare function logLineOf(context: string, errorName: string): string;
8
+ /**
9
+ * The name logged for an error: Auth.js errors carry a `type` ("JWTSessionError") that survives
10
+ * minification, others only their `name`.
11
+ *
12
+ * @ensures exactly the model's ErrorNameOf
13
+ */
14
+ export declare function errorNameOf(hasType: boolean, typeName: string, name: string): string;
15
+ /**
16
+ * The log line for a thrown value: `context` and the error's type name only. The one place the
17
+ * packages read a caught value for a log; it reads `type` and `name`, never `message`, `cause` or
18
+ * `stack`.
19
+ */
20
+ export declare function errorLogLine(context: string, error: unknown): string;
21
+ //# sourceMappingURL=log-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-line.d.ts","sourceRoot":"","sources":["../src/log-line.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAMpE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMpF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAKpE"}
package/llms.txt CHANGED
@@ -24,6 +24,8 @@ The docs are at https://augur.build/docs/packages (the API reference lists every
24
24
  ## @simpleapps-com/augur-utils
25
25
 
26
26
  - const: addMillis - A clock reading plus a duration, both milliseconds: when something expires.
27
+ - function: addressIdOf - Any value as an address id, null when it isn't one: absent, a number that is not a safe integer at least 1 (0, -5, 1.5, NaN, Infinity), or a text `addressIdOfText` refuses. Only reads the value's kind; the decisions are the proved `posIntOf` and `addressIdOfText`.
28
+ - function: addressIdOfText - A text as an address id: trimmed, decimal digits with at least one that is not 0, and a safe integer; null for "", " ", "0", "000", "-1", "1.0", "1e3", "0x10", "abc" and past 2^53 - 1.
27
29
  - const: BillingAddressInvoiceSchema - Valibot schema for billing address with required PO number (invoice payments).
28
30
  - const: BillingAddressSchema - Valibot schema for billing address validation. Less strict than shipping: allows PO Box, no email/phone required.
29
31
  - const: BLUR_DATA_URL - 1x1 transparent PNG for Next.js `<Image blurDataURL={...}>` placeholders.
@@ -39,14 +41,16 @@ The docs are at https://augur.build/docs/packages (the API reference lists every
39
41
  - function: createImageConfig - Creates a frozen ImageConfig object.
40
42
  - const: days - `n` days, in seconds.
41
43
  - function: derivePrice - Pure price derivation — usable in hooks AND server components.
44
+ - function: errorLogLine - The log line for a thrown value: `context` and the error's type name only. The one place the packages read a caught value for a log; it reads `type` and `name`, never `message`, `cause` or `stack`.
42
45
  - const: faqLd - A FAQ page's FAQPage markup as text: one Question per entry.
46
+ - function: firstAddressIdFrom - The first id in `ids` from `i` on, null when none is (each already read by `addressIdOf`).
43
47
  - const: floorSeconds - Milliseconds as whole seconds, rounded down.
44
48
  - function: formatPrice - Locale-aware currency formatting. Defaults to USD -- consumers can override locale and currency.
45
49
  - function: generateBreadcrumbJsonLd - Generates a Schema.org BreadcrumbList JSON-LD object from an array of breadcrumb items.
46
50
  - function: generateProductJsonLd - Generates a Schema.org Product JSON-LD string from an inventory document. Returns null if the item is suppressed, unnamed, or has no price.
47
51
  - function: getBusinessDay - Get the Nth business day from today (skipping weekends).
48
52
  - function: getDefaultImageUrl - Returns the default/placeholder image URL. Per-call `options.defaultImage` overrides `config.defaultImage`.
49
- - function: getImageSrcSet - Generates a `srcset` string for responsive images.
53
+ - function: getImageSrcSet - Generates a `srcset` string for responsive images: one entry per width with a URL, so a blank or denied image with no default gives `""`.
50
54
  - function: getImageUrl - Builds a full agr.media URL for the given image path and transforms.
51
55
  - function: getPaymentStatus - Returns "Paid", "Partially Paid", or "Unpaid" based on invoice payment flags and amounts.
52
56
  - function: getSchemaAvailability - Maps resolved stock to a Schema.org availability URL.
@@ -56,20 +60,23 @@ The docs are at https://augur.build/docs/packages (the API reference lists every
56
60
  - const: idRef - A reference to another node by its @id, as JSON text.
57
61
  - function: isAddressDifferent - Compares a user-entered address with a SmartyStreets-validated address. Returns true if any field differs (case-insensitive for address/city, exact match for state abbreviation and zip code).
58
62
  - function: isServerRuntime - Returns true when running outside a browser (Node SSR, edge, Deno). Mirrors `isServer` in `@tanstack/query-core` (`build/modern/utils.js`). Evaluated per call, not at module scope, so `"use client"` modules that also run during SSR resolve correctly on each pass.
63
+ - function: isUsableAddressId - Whether `value` is a usable address id (`addressIdOf` gives one). A plain boolean, not a type guard: "0" is a string that is no id, so a false MUST NOT narrow it away from `string`.
59
64
  - function: lineHasQuantity - Whether a cart line has a quantity (augur always stores one; the type allows null).
60
65
  - function: linePriceAt - Line `i`'s unit price from the per-line list (cart order): its own, fetched at its own quantity, so one item on two lines (two units of measure) keeps two prices; 0 past the end.
66
+ - function: logLineOf - A log line: `context`, then `": "` and `errorName` when there is one. There is no way to pass anything else, so a token, a customer's details or an upstream body never reach a log.
61
67
  - const: millis - `n` milliseconds, for a duration under a second.
62
68
  - const: millisOf - `n` as `Millis`, or null unless it is a safe integer at least 0.
63
69
  - const: minusMillis - A reading less a duration, never below 0.
64
70
  - const: minutes - `n` minutes, in seconds.
65
71
  - const: nodeHead - The schema.org context and a node's type: its first two members, as JSON text.
66
- - function: normalizePath - Normalizes an image path by: 1. Returning it as-is if it starts with `http` (external URL). 2. Stripping configured prefixes (defaults: `/images`, `images`). 3. Prepending `defaultPath` for bare filenames (no `/`). 4. Stripping leading slashes.
72
+ - function: normalizePath - Normalizes an image path by: 1. Returning the path after the origin for a URL on one of `ownOrigins` (the site's own image host: `https://images.<clientDomain>/a/b.jpg` → `a/b.jpg`). 2. Returning `""` for a plain `http://` URL (denied), and any other URL (`https://` in any case, or protocol-relative `//host/…`) as-is (external). 3. Stripping configured prefixes (defaults: `/images`, `images`). 4. Prepending `defaultPath` for bare filenames (no `/`). 5. Stripping leading slashes.
67
73
  - function: paginateOffset - Returns a copy of filters with offset adjusted for the given page.
68
74
  - function: priceQueryRuns - Whether a line's price query runs: a customer, an itemId, and a quantity (the price engine is never asked for a quantity nobody entered).
69
75
  - function: priceQueryUnit - The unit of measure a line's price query asks for: the line's own, so a CASE/6 line is priced per case, not as one EACH (the price engine prices a query without a unit in the item's default selling unit); null for a missing or blank unit (a line saved before the client required one).
70
76
  - function: pricingLoadingFrom - Cart pricing is loading when any query that runs is loading.
71
77
  - function: pricingSettledFrom - Cart pricing is settled when every query that runs has succeeded: a line whose query never runs (no quantity, no itemId, no customer) can't hold it back (its query stays pending and idle).
72
78
  - function: pushTrackingData - Push ecommerce tracking data to window.dataLayer using the GA4 clear-then-push pattern.
79
+ - function: resolveAddressId - The first usable address id among `candidates`, in order, or null when none is: a caller's id, then the session's, then the site's default. "" and "0" are passed over, never read as 0.
73
80
  - function: resolveGcTime - Returns the React Query `gcTime` to use for a query built in this runtime. On the server returns `Infinity`, which query-core treats as "schedule no GC timer", so a per-request QueryClient is freed when the request ends. A finite value would start a timer that pins the whole request cache. In the browser returns `clientGcTime` unchanged. The result is a `number`, not `Millis`: `Infinity` is no whole number of milliseconds.
74
81
  - function: resolveStock - Pure stock resolution -- usable in hooks AND server components.
75
82
  - function: roundHalfAway - Round half away from zero to `decimals` places.
@@ -93,6 +100,8 @@ The docs are at https://augur.build/docs/packages (the API reference lists every
93
100
  - const: US_TERRITORIES - US territories (PR, GU, VI, AS, MP).
94
101
  - const: VALIDATION_PATTERNS - Common regex patterns used for form validation across augur-hosted sites.
95
102
  - const: wholeSeconds - An outside count of seconds, rounded down; 0 when it is then no safe integer at least 0.
103
+ - type: AddressId
104
+ - type: AddressIdInput
96
105
  - type: AddToCartEventParams
97
106
  - type: BillingAddress
98
107
  - type: BreadcrumbJsonLdItem
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleapps-com/augur-utils",
3
- "version": "2026.11.4",
3
+ "version": "2026.11.6",
4
4
  "description": "Shared types, cache configuration, and utility functions for Augur ecommerce sites",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  "@atlas/foundation": "0.0.0",
66
66
  "@atlas/utils": "0.0.0",
67
67
  "@atlas/vitest-config": "0.0.0",
68
- "@simpleapps-com/augur-api": "2026.11.5"
68
+ "@simpleapps-com/augur-api": "2026.11.10"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=22.0.0"