@mj-biz-apps/orders-server
v5.14.0
Published
BizApps Orders server bootstrap - GraphQL resolvers and class registrations for the unified order-management Open App
Maintainers
Keywords
Readme
@mj-biz-apps/orders-server
The bootstrap. Its job is to make sure every @RegisterClass decorator in this app has actually
fired before a request is served.
Why it exists
MJ resolves entity subclasses and remotable operations through ClassFactory at runtime. A
decorator only registers when its module is loaded, and a bundler will happily tree-shake a
module nothing imports by name. The failure mode is quiet and expensive: Metadata.GetEntityObject
returns the base entity, Save() writes the row without running a single business rule, and the
order books with no journal entry.
So this package imports the Load* anchors explicitly:
LoadOrderEntityServer();
LoadRefundPaymentOperation(); // 'Orders.RefundPayment' (D17)
LoadApplyAccountCreditOperation(); // 'Orders.ApplyAccountCredit' (D68)
LoadPreviewPriceOperation(); // 'Orders.PreviewPrice' (D69)
LoadDefaultPriceResolver(); // the resolver the walk falls back to
LoadPromotionEngine(); // the promotion qualifier seam (D70)
LoadTaxResolver(); // the address → jurisdiction seam (D73)Each anchor is an empty exported function. Its only purpose is to be a name a bundler cannot prove is unused.
Adding a registered class? Add its anchor here. Nothing will fail loudly if you forget — the base class will be used instead, and the first symptom is a financial one.
Also here
config.ts— server configurationsrc/generated/— CodeGen's GraphQL resolvers. Do not edit; see the Entities package README.MJ_SERVER_EXTENSIONS— webhook + checkout edge declarations. MJ bootstrap collects this (orpackage.jsonmemberjunction.serverExtensions) from hosts that list this package indynamicPackages.server[]. Hostmj.config.cjsserverExtensions[]overlays by DriverClass.GET /checkout/:slug— public HTML host for a distribution; POSTs stay on the same edge. Pre-auth. HostserverExtensions[]can setEnabled: falseto suppress. Settings:TrustedProxyHops(default 0 — ignoreX-Forwarded-For; set to the number of reverse proxies that append to it),RateLimitMax/RateLimitMaxGlobal.
Verifying registration
The integration suite is the real check: it resolves entities through the same ClassFactory a
request does, so a missing anchor shows up as a rule not running. If a check fails in a way that
looks like "the guard didn't fire", suspect a missing anchor before suspecting the guard.
