Apariencia
Módulos del host de la API (@host/*)
Un plugin de API importa del host con @host/<ruta>. Esa ruta es la clave del registro globalThis.__HURY_API__, no una ruta de ficheros: solo existe lo que enumera esta página. Las librerías kysely, zod, fastify, pdfkit, jose, passkit-generator, qrcode y @anthropic-ai/sdk también las entrega el host: no se empaquetan.
Reglas
import { x } from "@host/lib/ids"funciona;import * as ids from …no (el compilador lo rechaza).- Los imports de solo tipo (
import type …) se borran al compilar y no cuentan: puedes tipar con cualquier ruta del código del host. - Tras añadir un
@host/…nuevo por valor a un plugin del repositorio, hay que regenerarhostModules.generated.tsconpython3 tools/plugin-build/gen-host.py, recompilar el host y desplegarlo antes que el plugin. Si no, el plugin falla al cargar con «Cannot read properties of undefined». - Ampliar el contrato (módulos o exportaciones nuevas) es compatible. Cambiar o quitar algo existente sube
PLUGIN_API_VERSIONy exige reconstruir los plugins que lo usaban. Política única: sin alias para lo retirado.
Versión del contrato
El host acepta plugins con apiVersion menor o igual que la suya. Historial:
- 1: contrato inicial.
- 2: módulos que dejaron de ser del host y pasan a ser plugins o a vivir en el núcleo (
modules/reservations/*,modules/tableBill/service,modules/delivery/addressycheckout,modules/happyHour/*,modules/combos/*,modules/display/*,modules/kiosk/*): los plugins compilados contra la 1 que los importaban se reconstruyen conapiVersion: 2. Se añadeqrcodey, en el panel, los slots de plugin (PluginAdminModule.slots).
Módulos disponibles
Versión del contrato: apiVersion 2. 104 módulos @host/*; librerías que el host entrega tal cual: fastify, kysely, zod, pdfkit, jose, qrcode (y pdfkit, passkit-generator, @anthropic-ai/sdk según el registro).
http
| Importación | Valores | Solo tipos |
|---|---|---|
@host/http/auth | ACCESS_TOKEN_TTL_S authOf hasPermission invalidateRoleCache requireAnyPermission requireAuth requirePermission resolveAuth signAccessToken | AuthContext |
@host/http/crud | IdParams crud | CrudOptions |
@host/http/errors | ApiError ERROR_HTTP_STATUS errorBody notFound | ErrorBody ErrorCode |
@host/http/issues · | defaultMessage fieldIssue invalidField issueCode withCode zodIssue | FieldIssue IssueParams |
@host/http/pagination | DateRangeQuery PageQuery offsetOf paged queryBool | PageQuery Paged |
@host/http/reorder · | ReorderBody mountReorder nextSortOrder reorderBy reorderInTx | MountReorderOptions ReorderOptions |
@host/http/reply | parse | — |
jobs
| Importación | Valores | Solo tipos |
|---|---|---|
@host/jobs/queue · | enqueue runDueJobs | JobHandler JobHandlers JobRow |
lib
| Importación | Valores | Solo tipos |
|---|---|---|
@host/lib/audit | audit diff | AuditEntry |
@host/lib/cardPayments · | cardConfigured cardPaidLabel cardPaidOrderIds cardProvider cardProviderOrNull isCardProvider providerByName resolveCardProvider | — |
@host/lib/contentI18n · | CONTENT_LOCALES baseLocale explicitLocale forgetBaseLocale isPhrase localize localizeApp localizePhrases normalizeConditional phraseId registerContentI18n requestLocale targetLocales walkPhrases | ContentLocale |
@host/lib/crypto · | decryptSecret deriveKey encryptSecret hashPassword hmacHex pinHmac randomToken sha256Hex verifyPassword | — |
@host/lib/deliveryAddress · | DeliveryAddressInput | — |
@host/lib/deliveryPlatformProvider · | ACCEPT_WINDOW_MINUTES CAPABILITIES DELIVERY_PLATFORMS PLATFORM_NAMES REJECT_CODES deliveryPlatformProvider loadCreds platformSetup setupFrom webhookUrls | DeliveryPlatformProvider InboundPlatformOrder PlatformCapabilities PlatformCreds PlatformOrderRef PlatformPush PlatformSetup PushResult RejectCode |
@host/lib/deliveryPlatforms/glovo · | glovoPush parseGlovoOrder verifyGlovoToken | GlovoCreds |
@host/lib/deliveryPlatforms/http · | NetworkError detail outcome request skipped | HttpResult |
@host/lib/deliveryPlatforms/justeat · | justeatPush parseJetOrder verifyJetKey verifyJetSignature | JustEatCreds |
@host/lib/deliveryPlatforms/ubereats · | UberAuthError fetchUberOrder parseUberEvent parseUberOrder resetUberTokens uberPush verifyUberSignature | UberCreds UberEvent |
@host/lib/domainEvents | callHook clearDomainHandlers emitDomain filterHook firstHook newDomainRegistry registerDomainHandlers registerHooks runWithDomainRegistry | DomainContext DomainEventName DomainHandler DomainHandlers DomainRegistry HookHandlers |
@host/lib/email · | LogEmailSender SmtpEmailSender createEmailSender | EmailAttachment EmailMessage EmailSendResult EmailSender |
@host/lib/emailTemplate · | brandedEmail button emailBrand esc isBranded textToEmailHtml | EmailBrand |
@host/lib/extPayments · | findExtPayment registerExtPayment syncExtPayment | ExtPaymentRef |
@host/lib/featureGate · | assertFeatureOn featureDisabled requireFeature | — |
@host/lib/features · | FEATURE_KEYS FEATURE_ROUTES MODULES_META_KEY allFeatureKeys checkDependencies envFeaturesOff featureDefault featureForPath featureOn getFeatures invalidateFeatures isAdminOnlyPlugin isFeatureKey normalizeRoutePath optInKeys readFeatures setAdminOnlyPlugins setFeatures | FeatureKey Features ModuleMeta |
@host/lib/floorReservations · | reservedTables withReservedTables | TableReservation |
@host/lib/fulfillment · | deliveryAvailable quoteDelivery reserveSlot resolveFulfillment | DeliveryQuote FulfillmentInput ResolvedFulfillment |
@host/lib/googleApi · | GOOGLE_ERROR_STEPS GOOGLE_V4_STEPS GoogleApiError googleHttp googleRequest mapGoogleError | GoogleErrorKind GoogleRequest |
@host/lib/googleBusinessProvider · | GB_CONNECTION GB_SETTINGS_KEY GoogleBusinessClient clearTokenCache getAccessToken hasRefreshToken writeReviewUrl | GAccount GLocation GMedia GPlaceActionLink GPost GReview GVerification GVerificationOption GoogleCtx |
@host/lib/googleOAuth · | GOOGLE_AUTH_URL GOOGLE_REVOKE_URL GOOGLE_SCOPE GOOGLE_TOKEN_URL OAUTH_CALLBACK_PATH STATE_TTL_MS buildConsentUrl exchangeCode newNonce redirectUri refreshAccessToken resolveOAuthClient revokeToken signState verifyState | OAuthClient OAuthState |
@host/lib/i18n | currentLocale customerRequestLocale fmtMoney fmtNumber intlLocale isLocale localeIsExplicit registerI18n runInLocale runWithLocale toLocale tr trFor trKey trStored trStoredWith weekdayName withRequestLocale | Locale TrParams |
@host/lib/ids | newCode newId slugify ulid | — |
@host/lib/integrations · | describeIntegration getIntegration saveIntegration | IntegrationProvider |
@host/lib/modules | MODULE_CATEGORY_LIST MODULE_KEY_RE assertModuleEnabled dependentsOf getOptionalModule invalidateFeatures isCoreModule isModuleEnabled listOptionalModules moduleCatalog moduleCatalogItem moduleFeatures moduleSchedules mustGet publishModulesChanged requireModule setModuleEnabled setModuleRegistry skipIfModuleDisabled validateManifests | ModuleCatalogItem |
@host/lib/mollie · | MOLLIE mollieReal publicWebhookUrl | — |
@host/lib/notify | notify | NotificationI18n NotifyInput NotifyText |
@host/lib/openingHours · | isLocalOpen openingHours openingRanges | — |
@host/lib/opsShared | actorOf attachmentsSchema csvText hhmm idParam isoDate rangeQuery | — |
@host/lib/orderLabels · | kioskLabel shortNumber | — |
@host/lib/permissions | ALL_PERMISSIONS DEFAULT_ROLES PERMISSION_GROUPS isPermission pluginPermissionGroups registerPluginPermissions | Permission PermissionGroup PluginPermissionGroup |
@host/lib/redsys · | REDSYS_EUR REDSYS_SIGNATURE_VERSIONS REDSYS_URLS RedsysError isRedsysKey isRedsysOrder isRefundApproved newRedsysOrder redsysBizumForm redsysEnvelope redsysRefund redsysSign redsysVerify responseToOutcome | BizumOutcome RedsysConfig RedsysEnvelope RedsysEnvironment RedsysPaymentInput RedsysRefundResult RedsysResult RedsysSignatureVersion |
@host/lib/redsysBizum · | BIZUM_PROVIDER isBizumId loadRedsys newBizumId redsysBizum | BizumCreateInput RedsysBizumProvider RedsysMissing RedsysSetup |
@host/lib/salesWindow · | PRICE_CHANNELS SALES_CHANNELS priceChannelOf priceChannelOfSales windowBlocks windowOpen | SalesChannel SalesWindow WindowBlock |
@host/lib/settings | getSetting patchSetting setSetting | — |
@host/lib/socialLinks · | SOCIAL_NETWORKS socialLink | SocialItem SocialNetwork |
@host/lib/tables · | tableExists | — |
@host/lib/time | DAY_START_HOUR TIMEZONE addDays businessRange currentBusinessDate localDate localTime localWeekday zonedToUtc | — |
@host/lib/translations · | I18N_LOCALES I18N_LOCALE_NAMES Translations isI18nLocale placeholdersOf requestedI18nLocale saveTranslation translationRows | I18nLocale TrCell TrRow |
@host/lib/verifactu · | QR_BASE_URLS amountText canonicalString dateEs generationStamp isTaxId recordHash truncateToSecond vatBreakdown verificationUrl | AeatBatchResult AeatProvider AeatRecord AeatResult HashInput VerifactuEnvironment VerifactuModeKind |
@host/lib/verifactuAeat · | AEAT_ENDPOINTS AeatSoapProvider AeatTransportError DEFAULT_WAIT_SECONDS MAX_BATCH NS_SF NS_SUM buildRecordXml buildSuministroXml defaultEndpoint httpsTransport mapResponse parseResponse setAeatTransportForTests | AeatEnvironment AeatLine AeatParsed AeatService AeatSoapOptions AeatSystemInfo AeatTransport CertKind |
@host/lib/verifactuCert · | CERT_PROVIDER CertError EXPIRY_WARNING_DAYS MAX_P12_BYTES certificateStatus loadTlsMaterial parseP12 removeCertificate saveCertificate statusOf | CertMeta CertStatus ParsedCert |
@host/lib/verifactuSign · | DSIG POLICY SignError XADES signRecordXml verifyRecordSignature | SignatureCheck SigningMaterial |
@host/lib/whatsappCloud · | DEFAULT_GRAPH_VERSION GRAPH_ORIGIN WHATSAPP_ERROR_STEPS WhatsappApiError createTemplate deleteTemplate editTemplate listTemplates loadWhatsappCreds mapWhatsappError markRead phoneInfo sendTemplate sendText tierLimit waNumber whatsappHttp whatsappSetup | MetaTemplate PhoneInfo SentMessage TemplateComponents WhatsappCreds WhatsappErrorKind WhatsappSetup |
modules/catalog
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/catalog/cost.service · | computeCost lineCost marginOf recalculateCost unitFactor | CostBreakdown CostLine |
@host/modules/catalog/menuI18n.service · | MENU_KINDS MENU_LOCALES MENU_LOCALE_NAMES MENU_SETTINGS_DEFAULTS MENU_SETTINGS_KEY Translations buildDigitalMenu fieldsOf isMenuLocale kindOfId localizeOrderMenu menuEntities menuUrl readMenuSettings requestedMenuLocale translationRows visibilityTree writeMenuSettings | DigitalCategory DigitalMenu DigitalProduct MenuEntity MenuKind MenuLocale MenuSettings TrCell TrRow |
@host/modules/catalog/menus.service · | buildMenu resolvePublicMenu | PublicCategory PublicMenu PublicProduct |
@host/modules/catalog/pricing.service · | effectivePrice effectivePriceDetail effectivePrices loadBusinessRules pickPrice pickPriceWithRules ruleMatchesTime | EffectivePrice EffectivePriceDetail PriceChannel PriceOpts PriceRule |
@host/modules/catalog/products.service · | assertRefs loadProduct modifierGroupsFor presentProduct productExtras productQuery publishAvailability requireProduct setAllergens setModifierGroups setProductAvailability tagsOf tagsValue | ModifierGroupWithOptions PresentedProduct |
@host/modules/catalog/qr.service · | newQrToken orderQrUrl presentQr qrImages resolveTarget scanUrlOf validateTarget | QrRow |
modules/commerce
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/commerce/inventory.service · | alertText applyMovement checkAllAlerts convertQty deductStockForOrder evaluateExpiry evaluateStockAlert itemExtras newEffects notDeleted publishEffects restockReturnedItems roundQty stockStatus | Effects MovementInput StockStatus |
modules/core
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/core/jobs · | emailJobs emailSender resolveSmtp setJobDb | — |
@host/modules/core/louisSettings · | DEFAULTS LOUIS_PROVIDERS LouisSettingsPatch LouisSettingsSchema SETTINGS_KEY readLouisSettings resolveLocale welcomeFor | LouisSettings |
@host/modules/core/settingsDefaults · | OPENING_HOURS_DEFAULT SETTINGS_DEFAULTS SETTINGS_SECTIONS | OpeningHours SettingsSection |
modules/crm
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/crm/activity · | activityTitle logActivity | — |
@host/modules/crm/app.routes · | appRoutes contactChangeWindow customerByEmail customerByPhone normAppPhone signAppToken | — |
@host/modules/crm/appAuth · | appCustomer optionalAppCustomer readAppToken sameText signAppToken signPublic | — |
@host/modules/crm/birthday.service · | birthdayFor birthdayKeys grantBirthdays isBirthday | BirthdayView |
@host/modules/crm/campaigns.service · | addressColumn campaignAudience campaignContent campaignRecipientsWhere requeueCampaign startCampaign | Campaign |
@host/modules/crm/challenges.service · | activeChallenges challengesFor computeProgress evaluateChallenges streakState weekStartOf | ChallengeRow ChallengesForOpts StreakState |
@host/modules/crm/coupons.service · | couponByCode redeemCoupon uniqueCouponCode validateCoupon | Coupon ValidateInput ValidateResult |
@host/modules/crm/customers.service · | customerOr404 findOrCreateCustomer | FindOrCreateInput |
@host/modules/crm/locale · | customerLocale localeFor rememberLocale | — |
@host/modules/crm/loyalty.service · | DEFAULT_TIERS LOYALTY_DEFAULTS accountView addPoints ensureAccount loyaltySettings meetsTier nextTier normalizeTier onCustomerCreated onOrderPaid onPaymentRefunded pendingPointsOf perksResolver pointsForAmount tierFor verifyCustomer wasDeletedContact | AccountView AddPointsInput LoyaltySettings LoyaltyTier PerkView TierPerk |
@host/modules/crm/memberCode · | ensureMemberCode newMemberCode | — |
@host/modules/crm/messaging.service · | TEMPLATE_VARIABLES buildEmail confirmUrl customerVars deliver memberCardUrl queueMessages refreshCampaignCounts renderTemplate runSendJob sampleVars sendSms sendTwilio signCustomerToken signupLinkUrl unsubscribeUrl verifyCustomerToken verifySignupToken | QueueInput Recipient SendResult Vars |
@host/modules/crm/push.service · | isExpoToken queuePush sendPush | PushMessage |
@host/modules/crm/redeem.service · | redeemBlock redeemRewardFor throwRedeemBlock | RedeemBlock RedeemOutcome |
@host/modules/crm/runtime · | crmRuntime setCrmRuntime | CrmRuntime |
@host/modules/crm/stores.service · | StoreIdsBody StorePricesBody activeStores appStore appStoreId checkStoreIds defaultStore forgetStores inStore installStoreId isActiveStore pointsCostIn resolveStore rewardIn rewardNotInStore staffStore staffStoreChoices staffStoreId storeHeader storeIdsColumn storeIdsOf storeOrderingResolver storePricesColumn storePricesOf storeView | ClubStore StaffStore StaffStoreChoices |
@host/modules/crm/util · | appKeysFrom chunk columnExists contactHashes csvCell csvRow jsonb likeTerm normEmail normPhone tableExists | — |
@host/modules/crm/walletAssets · | WALLET_ICON WALLET_STRIP_2X WALLET_STRIP_3X | — |
modules/forecast
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/forecast/read · | contextOf diffDays latestRun loadPoints metricAt metricsOf pct periodOf runBrief runFull runRowOf seriesMetaOf targetOf totalOf totalsFor warningOut warningsOut | HistPoint Period Point Total |
@host/modules/forecast/weather.summary · | skyKind weatherSummary | WeatherDayOut WeatherKind |
modules/insights
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/insights/ai/client · | DEFAULT_MODEL generateText resolveAi setAiClientFactory textOf | AiClient AiContext |
@host/modules/insights/ai/openai · | OPENAI_DEFAULT_MODEL OPENAI_MODELS openAiKey resolveOpenAi setOpenAiClientFactory | OpenAiClient OpenAiMessage OpenAiRequest OpenAiResponse OpenAiTool OpenAiToolCall |
modules/pos
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/pos/common · | DENOMINATIONS IdParams OPEN_ORDER_STATUSES Outbox POS_CONFIG_DEFAULTS TABLE_ORDER_SOURCES denominationsTotal logOrder orderingEnabled posConfig posSettings setPrepStatus withTx | Ctx PosConfig PrepStatus |
@host/modules/pos/format · | money | — |
@host/modules/pos/mollie.routes · | handleMolliePayment mollieRoutes startCardPayment | — |
@host/modules/pos/online.checkout · | offerChannelOfOrder priceChannelOfOffer quoteOrder | AppliedCombo AppliedOffer OfferChannel OfferEnv OfferLineFacts Quote QuoteItem QuoteLine |
@host/modules/pos/online.coupon · | applyOnlineCoupon previewMemberCoupon previewOnlineCoupon | CouponPreview |
@host/modules/pos/online.pricing · | checkoutLines clearLineOffers offerDiscountsRemoved offerEnvFor priceChangedError recordQuoteOffers syncBundles syncLineOffers syncQuoteBundles | — |
@host/modules/pos/online.service · | OPEN_ONLINE_FULFILLMENT findOpenOnlineOrder mergeQrIntoTable onlineTransition trackingUrl | OnlineAction |
@host/modules/pos/orders.service · | addItem assertDiscountLimit assertOpen cancelOrder completeOrder confirmOrder createOrder ensurePaidEmitted lockOrder moveItems openTableOrder orderDetail recalcOrder releaseOrderCoupons removeItem reopenOrder sendOrder syncTableStatus touchOrder updateItem | CreateOrderInput Ctx ItemInput ItemPatch Order |
@host/modules/pos/payments.service · | cancelPayment lockPayment recordPayment refundPayment | Payment PaymentInput |
@host/modules/pos/pricing · | modifierOptions productForSale | ModifierOption PriceChannel ProductForSale |
@host/modules/pos/promotions · | couponRoutes syncPromotions | — |
@host/modules/pos/qrCode.service · | QR_CODE_BYTES QR_GRACE_MS codeMatches currentOrderQr ensureOrderQr newOrderCode renewOrderQr rotationOf syncOrderQrWithConfig | OrderQrRow |
@host/modules/pos/qrOrders.service · | pendingQrOrders qrOrdersState withinSchedule | QrOrdersReason QrOrdersState |
@host/modules/pos/totals · | computeTotals discountAmount prorate | TotalsDiscount TotalsItem TotalsResult |
modules/posv3
| Importación | Valores | Solo tipos |
|---|---|---|
@host/modules/posv3/auth · | DEFAULT_FEATURES bearerToken deviceByToken deviceFeatures deviceOf requireDevice requireWorker signWorkerToken v3Keys workerOf | DeviceCtx DeviceFeatures DeviceKind V3Keys WorkerCtx |
@host/modules/posv3/errors · | V3Error V3_ERROR_STATUS installV3ErrorHandling ok v3ErrorReply | V3ErrorBody V3ErrorCode |
@host/modules/posv3/ids · | numOf numsOf refOf refsOf | RefKind |
@host/modules/posv3/workers · | discountNeedsManager employeeAccess requireManagerPin workersRoutes | WorkerPermission |
núcleo
| Importación | Valores | Solo tipos |
|---|---|---|
@host/brand · | BRAND | — |
@host/db | PG_PARSERS createDb json | Conn Db |
Los módulos sin marca son los de la lista fija de hostRegistry.ts; los marcados con «·» los añade gen-host.py al contrato porque algún plugin los importa por valor.