@simpleapps-com/augur-utils 2026.11.5 → 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.
package/EXPORTS.md CHANGED
@@ -27,6 +27,7 @@
27
27
  | `createImageConfig` | function | Creates a frozen ImageConfig object. |
28
28
  | `days` | const | `n` days, in seconds. |
29
29
  | `derivePrice` | function | Pure price derivation — usable in hooks AND server components. |
30
+ | `errorLogLine` | function | 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`. |
30
31
  | `faqLd` | const | A FAQ page's FAQPage markup as text: one Question per entry. |
31
32
  | `firstAddressIdFrom` | function | The first id in `ids` from `i` on, null when none is (each already read by `addressIdOf`). |
32
33
  | `floorSeconds` | const | Milliseconds as whole seconds, rounded down. |
@@ -48,6 +49,7 @@
48
49
  | `isUsableAddressId` | function | 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`. |
49
50
  | `lineHasQuantity` | function | Whether a cart line has a quantity (augur always stores one; the type allows null). |
50
51
  | `linePriceAt` | function | 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. |
52
+ | `logLineOf` | function | 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. |
51
53
  | `millis` | const | `n` milliseconds, for a duration under a second. |
52
54
  | `millisOf` | const | `n` as `Millis`, or null unless it is a safe integer at least 0. |
53
55
  | `minusMillis` | const | A reading less a duration, never below 0. |
package/README.md CHANGED
@@ -25,9 +25,15 @@ pnpm add @simpleapps-com/augur-utils
25
25
  TypeScript in `src/`, built to `dist/` (ESM and CJS) by tsup. The decisions are proved
26
26
  (`src/rules.ts`, `src/price-outcome.ts`, `src/image-rules.ts`, `src/json-ld-rules.ts`,
27
27
  `src/cart-line-rules.ts`, `src/address-id.ts`; model `models/AugurUtils.dfy`, links
28
- `models/links/augur-utils-*.dfy`);
28
+ `models/links/augur-utils-*.dfy`; `src/log-line.ts` against the security model
29
+ `models/AugurServerSecurity.dfy`);
29
30
  the rest is tested at 100%.
30
31
 
32
+ Log lines (`src/log-line.ts`): the augur packages log fixed text and, for a thrown error, its
33
+ type name only (`errorLogLine(context, error)`, `logLineOf(context, name)`), never its message,
34
+ cause, stack or any payload, so a token, a customer's details or an upstream body never reach a
35
+ log (owner 2026-11-16: "remove any log leak").
36
+
31
37
  Cart-line pricing (#93) lives in `src/cart-line-rules.ts`: `lineHasQuantity`, `priceQueryRuns`
32
38
  (augur never stores a null quantity, `models/AugurCommerceCartLine.dfy`; the type allows one, and
33
39
  such a line is not priced), `pricingSettledFrom` / `pricingLoadingFrom` (over the prices that are
package/dist/index.cjs CHANGED
@@ -826,6 +826,22 @@ function generateProductJsonLd(doc, options) {
826
826
  return JSON.stringify(omitEmpty(merged));
827
827
  }
828
828
 
829
+ // src/log-line.ts
830
+ function logLineOf(context, errorName) {
831
+ if (errorName === "") return context;
832
+ return context + ": " + errorName;
833
+ }
834
+ function errorNameOf(hasType, typeName, name) {
835
+ if (hasType && typeName !== "") return typeName;
836
+ return name;
837
+ }
838
+ function errorLogLine(context, error) {
839
+ if (!(error instanceof Error)) return logLineOf(context, "");
840
+ const type = error.type;
841
+ const hasType = typeof type === "string";
842
+ return logLineOf(context, errorNameOf(hasType, hasType ? type : "", error.name));
843
+ }
844
+
829
845
  // src/result.ts
830
846
  function unwrap(result) {
831
847
  if (!result.ok) throw new Error(unwrapMessage(result.error));
@@ -1391,5 +1407,7 @@ function pushTrackingData(data) {
1391
1407
 
1392
1408
 
1393
1409
 
1394
- exports.BLUR_DATA_URL = BLUR_DATA_URL; exports.BillingAddressInvoiceSchema = BillingAddressInvoiceSchema; exports.BillingAddressSchema = BillingAddressSchema; exports.CACHE_CONFIG = CACHE_CONFIG; exports.CONTIGUOUS_STATES = CONTIGUOUS_STATES; exports.ShippingAddressSchema = ShippingAddressSchema; exports.US_STATES = US_STATES; exports.US_STATES_FULL = US_STATES_FULL; exports.US_TERRITORIES = US_TERRITORIES; exports.VALIDATION_PATTERNS = VALIDATION_PATTERNS; exports.addMillis = addMillis2; exports.addressIdOf = addressIdOf; exports.addressIdOfText = addressIdOfText; exports.breadcrumbLd = breadcrumbLd2; exports.buildCheckoutPayload = buildCheckoutPayload; exports.buildImageLoader = buildImageLoader; exports.buildTrackingData = buildTrackingData; exports.categorySortBy = categorySortBy; exports.cleanMoney = cleanMoney; exports.cn = _chunk5UMFBGVAcjs.cn; exports.createImageConfig = createImageConfig; exports.days = days2; exports.derivePrice = derivePrice; exports.faqLd = faqLd2; exports.firstAddressIdFrom = firstAddressIdFrom; exports.floorSeconds = floorSeconds2; exports.formatPrice = formatPrice; exports.generateBreadcrumbJsonLd = generateBreadcrumbJsonLd; exports.generateProductJsonLd = generateProductJsonLd; exports.getBusinessDay = getBusinessDay; exports.getDefaultImageUrl = getDefaultImageUrl; exports.getImageSrcSet = getImageSrcSet; exports.getImageUrl = getImageUrl; exports.getPaymentStatus = getPaymentStatus; exports.getSchemaAvailability = getSchemaAvailability; exports.getShippingLeadDate = getShippingLeadDate; exports.hasPriceBreaks = hasPriceBreaks; exports.hours = hours2; exports.idRef = idRef2; exports.isAddressDifferent = isAddressDifferent; exports.isServerRuntime = isServerRuntime; exports.isUsableAddressId = isUsableAddressId; exports.lineHasQuantity = lineHasQuantity; exports.linePriceAt = linePriceAt; exports.millis = millis2; exports.millisOf = millisOf2; exports.minusMillis = minusMillis2; exports.minutes = minutes2; exports.nodeHead = nodeHead2; exports.normalizePath = normalizePath; exports.paginateOffset = paginateOffset; exports.priceQueryRuns = priceQueryRuns; exports.priceQueryUnit = priceQueryUnit; exports.pricingLoadingFrom = pricingLoadingFrom; exports.pricingSettledFrom = pricingSettledFrom; exports.pushTrackingData = pushTrackingData; exports.resolveAddressId = resolveAddressId; exports.resolveGcTime = resolveGcTime; exports.resolveStock = resolveStock; exports.roundHalfAway = roundHalfAway; exports.sanitizeHtmlImages = sanitizeHtmlImages; exports.seconds = seconds2; exports.secondsOf = secondsOf2; exports.serializeCategoryFilters = serializeCategoryFilters; exports.serializeSearchParams = serializeSearchParams; exports.serializeTransforms = serializeTransforms; exports.tierBrowserGcTime = tierBrowserGcTime; exports.tierStaleTime = tierStaleTime; exports.toMillis = toMillis2; exports.trackAddToCart = trackAddToCart; exports.trackViewItem = trackViewItem; exports.transformShipToAddress = transformShipToAddress; exports.unwrap = unwrap; exports.unwrapOr = unwrapOr; exports.wholeSeconds = wholeSeconds2;
1410
+
1411
+
1412
+ exports.BLUR_DATA_URL = BLUR_DATA_URL; exports.BillingAddressInvoiceSchema = BillingAddressInvoiceSchema; exports.BillingAddressSchema = BillingAddressSchema; exports.CACHE_CONFIG = CACHE_CONFIG; exports.CONTIGUOUS_STATES = CONTIGUOUS_STATES; exports.ShippingAddressSchema = ShippingAddressSchema; exports.US_STATES = US_STATES; exports.US_STATES_FULL = US_STATES_FULL; exports.US_TERRITORIES = US_TERRITORIES; exports.VALIDATION_PATTERNS = VALIDATION_PATTERNS; exports.addMillis = addMillis2; exports.addressIdOf = addressIdOf; exports.addressIdOfText = addressIdOfText; exports.breadcrumbLd = breadcrumbLd2; exports.buildCheckoutPayload = buildCheckoutPayload; exports.buildImageLoader = buildImageLoader; exports.buildTrackingData = buildTrackingData; exports.categorySortBy = categorySortBy; exports.cleanMoney = cleanMoney; exports.cn = _chunk5UMFBGVAcjs.cn; exports.createImageConfig = createImageConfig; exports.days = days2; exports.derivePrice = derivePrice; exports.errorLogLine = errorLogLine; exports.faqLd = faqLd2; exports.firstAddressIdFrom = firstAddressIdFrom; exports.floorSeconds = floorSeconds2; exports.formatPrice = formatPrice; exports.generateBreadcrumbJsonLd = generateBreadcrumbJsonLd; exports.generateProductJsonLd = generateProductJsonLd; exports.getBusinessDay = getBusinessDay; exports.getDefaultImageUrl = getDefaultImageUrl; exports.getImageSrcSet = getImageSrcSet; exports.getImageUrl = getImageUrl; exports.getPaymentStatus = getPaymentStatus; exports.getSchemaAvailability = getSchemaAvailability; exports.getShippingLeadDate = getShippingLeadDate; exports.hasPriceBreaks = hasPriceBreaks; exports.hours = hours2; exports.idRef = idRef2; exports.isAddressDifferent = isAddressDifferent; exports.isServerRuntime = isServerRuntime; exports.isUsableAddressId = isUsableAddressId; exports.lineHasQuantity = lineHasQuantity; exports.linePriceAt = linePriceAt; exports.logLineOf = logLineOf; exports.millis = millis2; exports.millisOf = millisOf2; exports.minusMillis = minusMillis2; exports.minutes = minutes2; exports.nodeHead = nodeHead2; exports.normalizePath = normalizePath; exports.paginateOffset = paginateOffset; exports.priceQueryRuns = priceQueryRuns; exports.priceQueryUnit = priceQueryUnit; exports.pricingLoadingFrom = pricingLoadingFrom; exports.pricingSettledFrom = pricingSettledFrom; exports.pushTrackingData = pushTrackingData; exports.resolveAddressId = resolveAddressId; exports.resolveGcTime = resolveGcTime; exports.resolveStock = resolveStock; exports.roundHalfAway = roundHalfAway; exports.sanitizeHtmlImages = sanitizeHtmlImages; exports.seconds = seconds2; exports.secondsOf = secondsOf2; exports.serializeCategoryFilters = serializeCategoryFilters; exports.serializeSearchParams = serializeSearchParams; exports.serializeTransforms = serializeTransforms; exports.tierBrowserGcTime = tierBrowserGcTime; exports.tierStaleTime = tierStaleTime; exports.toMillis = toMillis2; exports.trackAddToCart = trackAddToCart; exports.trackViewItem = trackViewItem; exports.transformShipToAddress = transformShipToAddress; exports.unwrap = unwrap; exports.unwrapOr = unwrapOr; exports.wholeSeconds = wholeSeconds2;
1395
1413
  //# sourceMappingURL=index.cjs.map