Saltar al contenido

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 regenerar hostModules.generated.ts con python3 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_VERSION y 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/address y checkout, modules/happyHour/*, modules/combos/*, modules/display/*, modules/kiosk/*): los plugins compilados contra la 1 que los importaban se reconstruyen con apiVersion: 2. Se añade qrcode y, 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ónValoresSolo tipos
@host/http/authACCESS_TOKEN_TTL_S authOf hasPermission invalidateRoleCache requireAnyPermission requireAuth requirePermission resolveAuth signAccessTokenAuthContext
@host/http/crudIdParams crudCrudOptions
@host/http/errorsApiError ERROR_HTTP_STATUS errorBody notFoundErrorBody ErrorCode
@host/http/issues ·defaultMessage fieldIssue invalidField issueCode withCode zodIssueFieldIssue IssueParams
@host/http/paginationDateRangeQuery PageQuery offsetOf paged queryBoolPageQuery Paged
@host/http/reorder ·ReorderBody mountReorder nextSortOrder reorderBy reorderInTxMountReorderOptions ReorderOptions
@host/http/replyparse—

jobs ​

ImportaciónValoresSolo tipos
@host/jobs/queue ·enqueue runDueJobsJobHandler JobHandlers JobRow

lib ​

ImportaciónValoresSolo tipos
@host/lib/auditaudit diffAuditEntry
@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 walkPhrasesContentLocale
@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 webhookUrlsDeliveryPlatformProvider InboundPlatformOrder PlatformCapabilities PlatformCreds PlatformOrderRef PlatformPush PlatformSetup PushResult RejectCode
@host/lib/deliveryPlatforms/glovo ·glovoPush parseGlovoOrder verifyGlovoTokenGlovoCreds
@host/lib/deliveryPlatforms/http ·NetworkError detail outcome request skippedHttpResult
@host/lib/deliveryPlatforms/justeat ·justeatPush parseJetOrder verifyJetKey verifyJetSignatureJustEatCreds
@host/lib/deliveryPlatforms/ubereats ·UberAuthError fetchUberOrder parseUberEvent parseUberOrder resetUberTokens uberPush verifyUberSignatureUberCreds UberEvent
@host/lib/domainEventscallHook clearDomainHandlers emitDomain filterHook firstHook newDomainRegistry registerDomainHandlers registerHooks runWithDomainRegistryDomainContext DomainEventName DomainHandler DomainHandlers DomainRegistry HookHandlers
@host/lib/email ·LogEmailSender SmtpEmailSender createEmailSenderEmailAttachment EmailMessage EmailSendResult EmailSender
@host/lib/emailTemplate ·brandedEmail button emailBrand esc isBranded textToEmailHtmlEmailBrand
@host/lib/extPayments ·findExtPayment registerExtPayment syncExtPaymentExtPaymentRef
@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 setFeaturesFeatureKey Features ModuleMeta
@host/lib/floorReservations ·reservedTables withReservedTablesTableReservation
@host/lib/fulfillment ·deliveryAvailable quoteDelivery reserveSlot resolveFulfillmentDeliveryQuote FulfillmentInput ResolvedFulfillment
@host/lib/googleApi ·GOOGLE_ERROR_STEPS GOOGLE_V4_STEPS GoogleApiError googleHttp googleRequest mapGoogleErrorGoogleErrorKind GoogleRequest
@host/lib/googleBusinessProvider ·GB_CONNECTION GB_SETTINGS_KEY GoogleBusinessClient clearTokenCache getAccessToken hasRefreshToken writeReviewUrlGAccount 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 verifyStateOAuthClient OAuthState
@host/lib/i18ncurrentLocale customerRequestLocale fmtMoney fmtNumber intlLocale isLocale localeIsExplicit registerI18n runInLocale runWithLocale toLocale tr trFor trKey trStored trStoredWith weekdayName withRequestLocaleLocale TrParams
@host/lib/idsnewCode newId slugify ulid—
@host/lib/integrations ·describeIntegration getIntegration saveIntegrationIntegrationProvider
@host/lib/modulesMODULE_CATEGORY_LIST MODULE_KEY_RE assertModuleEnabled dependentsOf getOptionalModule invalidateFeatures isCoreModule isModuleEnabled listOptionalModules moduleCatalog moduleCatalogItem moduleFeatures moduleSchedules mustGet publishModulesChanged requireModule setModuleEnabled setModuleRegistry skipIfModuleDisabled validateManifestsModuleCatalogItem
@host/lib/mollie ·MOLLIE mollieReal publicWebhookUrl—
@host/lib/notifynotifyNotificationI18n NotifyInput NotifyText
@host/lib/openingHours ·isLocalOpen openingHours openingRanges—
@host/lib/opsSharedactorOf attachmentsSchema csvText hhmm idParam isoDate rangeQuery—
@host/lib/orderLabels ·kioskLabel shortNumber—
@host/lib/permissionsALL_PERMISSIONS DEFAULT_ROLES PERMISSION_GROUPS isPermission pluginPermissionGroups registerPluginPermissionsPermission PermissionGroup PluginPermissionGroup
@host/lib/redsys ·REDSYS_EUR REDSYS_SIGNATURE_VERSIONS REDSYS_URLS RedsysError isRedsysKey isRedsysOrder isRefundApproved newRedsysOrder redsysBizumForm redsysEnvelope redsysRefund redsysSign redsysVerify responseToOutcomeBizumOutcome RedsysConfig RedsysEnvelope RedsysEnvironment RedsysPaymentInput RedsysRefundResult RedsysResult RedsysSignatureVersion
@host/lib/redsysBizum ·BIZUM_PROVIDER isBizumId loadRedsys newBizumId redsysBizumBizumCreateInput RedsysBizumProvider RedsysMissing RedsysSetup
@host/lib/salesWindow ·PRICE_CHANNELS SALES_CHANNELS priceChannelOf priceChannelOfSales windowBlocks windowOpenSalesChannel SalesWindow WindowBlock
@host/lib/settingsgetSetting patchSetting setSetting—
@host/lib/socialLinks ·SOCIAL_NETWORKS socialLinkSocialItem SocialNetwork
@host/lib/tables ·tableExists—
@host/lib/timeDAY_START_HOUR TIMEZONE addDays businessRange currentBusinessDate localDate localTime localWeekday zonedToUtc—
@host/lib/translations ·I18N_LOCALES I18N_LOCALE_NAMES Translations isI18nLocale placeholdersOf requestedI18nLocale saveTranslation translationRowsI18nLocale TrCell TrRow
@host/lib/verifactu ·QR_BASE_URLS amountText canonicalString dateEs generationStamp isTaxId recordHash truncateToSecond vatBreakdown verificationUrlAeatBatchResult 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 setAeatTransportForTestsAeatEnvironment AeatLine AeatParsed AeatService AeatSoapOptions AeatSystemInfo AeatTransport CertKind
@host/lib/verifactuCert ·CERT_PROVIDER CertError EXPIRY_WARNING_DAYS MAX_P12_BYTES certificateStatus loadTlsMaterial parseP12 removeCertificate saveCertificate statusOfCertMeta CertStatus ParsedCert
@host/lib/verifactuSign ·DSIG POLICY SignError XADES signRecordXml verifyRecordSignatureSignatureCheck 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 whatsappSetupMetaTemplate PhoneInfo SentMessage TemplateComponents WhatsappCreds WhatsappErrorKind WhatsappSetup

modules/catalog ​

ImportaciónValoresSolo tipos
@host/modules/catalog/cost.service ·computeCost lineCost marginOf recalculateCost unitFactorCostBreakdown 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 writeMenuSettingsDigitalCategory DigitalMenu DigitalProduct MenuEntity MenuKind MenuLocale MenuSettings TrCell TrRow
@host/modules/catalog/menus.service ·buildMenu resolvePublicMenuPublicCategory PublicMenu PublicProduct
@host/modules/catalog/pricing.service ·effectivePrice effectivePriceDetail effectivePrices loadBusinessRules pickPrice pickPriceWithRules ruleMatchesTimeEffectivePrice EffectivePriceDetail PriceChannel PriceOpts PriceRule
@host/modules/catalog/products.service ·assertRefs loadProduct modifierGroupsFor presentProduct productExtras productQuery publishAvailability requireProduct setAllergens setModifierGroups setProductAvailability tagsOf tagsValueModifierGroupWithOptions PresentedProduct
@host/modules/catalog/qr.service ·newQrToken orderQrUrl presentQr qrImages resolveTarget scanUrlOf validateTargetQrRow

modules/commerce ​

ImportaciónValoresSolo tipos
@host/modules/commerce/inventory.service ·alertText applyMovement checkAllAlerts convertQty deductStockForOrder evaluateExpiry evaluateStockAlert itemExtras newEffects notDeleted publishEffects restockReturnedItems roundQty stockStatusEffects MovementInput StockStatus

modules/core ​

ImportaciónValoresSolo tipos
@host/modules/core/jobs ·emailJobs emailSender resolveSmtp setJobDb—
@host/modules/core/louisSettings ·DEFAULTS LOUIS_PROVIDERS LouisSettingsPatch LouisSettingsSchema SETTINGS_KEY readLouisSettings resolveLocale welcomeForLouisSettings
@host/modules/core/settingsDefaults ·OPENING_HOURS_DEFAULT SETTINGS_DEFAULTS SETTINGS_SECTIONSOpeningHours SettingsSection

modules/crm ​

ImportaciónValoresSolo 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 isBirthdayBirthdayView
@host/modules/crm/campaigns.service ·addressColumn campaignAudience campaignContent campaignRecipientsWhere requeueCampaign startCampaignCampaign
@host/modules/crm/challenges.service ·activeChallenges challengesFor computeProgress evaluateChallenges streakState weekStartOfChallengeRow ChallengesForOpts StreakState
@host/modules/crm/coupons.service ·couponByCode redeemCoupon uniqueCouponCode validateCouponCoupon ValidateInput ValidateResult
@host/modules/crm/customers.service ·customerOr404 findOrCreateCustomerFindOrCreateInput
@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 wasDeletedContactAccountView 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 verifySignupTokenQueueInput Recipient SendResult Vars
@host/modules/crm/push.service ·isExpoToken queuePush sendPushPushMessage
@host/modules/crm/redeem.service ·redeemBlock redeemRewardFor throwRedeemBlockRedeemBlock RedeemOutcome
@host/modules/crm/runtime ·crmRuntime setCrmRuntimeCrmRuntime
@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 storeViewClubStore 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ónValoresSolo tipos
@host/modules/forecast/read ·contextOf diffDays latestRun loadPoints metricAt metricsOf pct periodOf runBrief runFull runRowOf seriesMetaOf targetOf totalOf totalsFor warningOut warningsOutHistPoint Period Point Total
@host/modules/forecast/weather.summary ·skyKind weatherSummaryWeatherDayOut WeatherKind

modules/insights ​

ImportaciónValoresSolo tipos
@host/modules/insights/ai/client ·DEFAULT_MODEL generateText resolveAi setAiClientFactory textOfAiClient AiContext
@host/modules/insights/ai/openai ·OPENAI_DEFAULT_MODEL OPENAI_MODELS openAiKey resolveOpenAi setOpenAiClientFactoryOpenAiClient OpenAiMessage OpenAiRequest OpenAiResponse OpenAiTool OpenAiToolCall

modules/pos ​

ImportaciónValoresSolo tipos
@host/modules/pos/common ·DENOMINATIONS IdParams OPEN_ORDER_STATUSES Outbox POS_CONFIG_DEFAULTS TABLE_ORDER_SOURCES denominationsTotal logOrder orderingEnabled posConfig posSettings setPrepStatus withTxCtx PosConfig PrepStatus
@host/modules/pos/format ·money—
@host/modules/pos/mollie.routes ·handleMolliePayment mollieRoutes startCardPayment—
@host/modules/pos/online.checkout ·offerChannelOfOrder priceChannelOfOffer quoteOrderAppliedCombo AppliedOffer OfferChannel OfferEnv OfferLineFacts Quote QuoteItem QuoteLine
@host/modules/pos/online.coupon ·applyOnlineCoupon previewMemberCoupon previewOnlineCouponCouponPreview
@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 trackingUrlOnlineAction
@host/modules/pos/orders.service ·addItem assertDiscountLimit assertOpen cancelOrder completeOrder confirmOrder createOrder ensurePaidEmitted lockOrder moveItems openTableOrder orderDetail recalcOrder releaseOrderCoupons removeItem reopenOrder sendOrder syncTableStatus touchOrder updateItemCreateOrderInput Ctx ItemInput ItemPatch Order
@host/modules/pos/payments.service ·cancelPayment lockPayment recordPayment refundPaymentPayment PaymentInput
@host/modules/pos/pricing ·modifierOptions productForSaleModifierOption 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 syncOrderQrWithConfigOrderQrRow
@host/modules/pos/qrOrders.service ·pendingQrOrders qrOrdersState withinScheduleQrOrdersReason QrOrdersState
@host/modules/pos/totals ·computeTotals discountAmount prorateTotalsDiscount TotalsItem TotalsResult

modules/posv3 ​

ImportaciónValoresSolo tipos
@host/modules/posv3/auth ·DEFAULT_FEATURES bearerToken deviceByToken deviceFeatures deviceOf requireDevice requireWorker signWorkerToken v3Keys workerOfDeviceCtx DeviceFeatures DeviceKind V3Keys WorkerCtx
@host/modules/posv3/errors ·V3Error V3_ERROR_STATUS installV3ErrorHandling ok v3ErrorReplyV3ErrorBody V3ErrorCode
@host/modules/posv3/ids ·numOf numsOf refOf refsOfRefKind
@host/modules/posv3/workers ·discountNeedsManager employeeAccess requireManagerPin workersRoutesWorkerPermission

núcleo ​

ImportaciónValoresSolo tipos
@host/brand ·BRAND—
@host/dbPG_PARSERS createDb jsonConn 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.

Contrato con el host: apiVersion 2. Sitio estático: no recoge datos ni usa servicios de terceros.