← back to Tk 10965 Zero Price Analysis

prevention/inventory-stamp-guard.mjs

22 lines

// inventory-stamp-guard.mjs — RE-EXPORT SHIM -> canonical master (2026-09-22 Option-B decouple).
// TK-10965 prevention test imports the canonical guard, not a stale local copy.
// The $0-orderable guard (TK-11357) has ONE source of truth: ~/Projects/_shared/dw-guards/.
//
// PORTABLE resolution (TK-11786 review fix): resolve the master via DW_SHARED_GUARDS or the
// per-user home dir, NOT a hardcoded /Users/macstudio3 path — mirrors validate-before-activate.js
// and internal-guard.js so this works on Kamatera (/root), Mac1, and any other home.
// ESM .mjs — CJS require() is NOT supported (fail-safe: prevents silent bad defaults).

import os from 'node:os';
import path from 'node:path';
import { pathToFileURL } from 'node:url';

const base = process.env.DW_SHARED_GUARDS || path.join(os.homedir(), 'Projects', '_shared', 'dw-guards');
const _m = await import(pathToFileURL(path.join(base, 'inventory-stamp-guard.mjs')).href);

export const PRICE_SUPPRESSED_TAGS = _m.PRICE_SUPPRESSED_TAGS;
export const isPriceSuppressed = _m.isPriceSuppressed;
export const isSellableVariant = _m.isSellableVariant;
export const isZeroPriceOrderableRisk = _m.isZeroPriceOrderableRisk;
export const safeStampQuantity = _m.safeStampQuantity;