Skip to content

Useful Utils โ€‹

Every public API mono-utils ships, grouped by entry point. Type-only exports are left out โ€” import them from the same entry as the value they belong to.

Reach for these before writing custom code (Rule 13 in Template Rules).

mono-utils/runtime โ€‹

App runtime: config, state, cookies, JWT, and the helper bundles.

APIWhat it is
createMono(config)Vue plugin โ€” app.use(createMono(monoConfig)).
initMono(config)The federation init createMono wraps.
monoConfig()The resolved mono.config.ts at runtime.
monoEnv()Resolved env block.
monoState()Reactive mono state โ€” cookie, jwt, env, menu.
monoStatePatch() / monoStateReset()Patch / reset that state.
monoUseState() / useState()Nuxt-style shared state, usable in a Vue app.
nuxtStateKeys() / clearNuxtState()Inspect / clear those state keys.
monoProvide() / monoInject()Cross-app provide/inject โ€” see Provide & Inject.
monoCookie() / useMyCookie()Cookie read/write.
monoJwt() / useMyJwt()Decode a JWT cookie (cookieDecode).
monoToken() / useMyToken()Raw token access.
monoStorage() / useMyStorage()Local/session storage.
useMyFetch()Re-export of the fetching helper.
setMonoEventResolver(fn)Server-side cookie source for Nuxt โ€” set in app/plugins/mono.ts.
defineLayout(...)Declare a layout for the federated layout resolver.
MonoNotivueNotification renderer component.
MonoNotifActionThe action-notification card notif renders.
useMonoUtility()The helper bundle below.
useUtils()Same bundle plus numColTemplate (DevExtreme auto-numbering column).

useMonoUtility() helpers โ€‹

HelperSignatureWhat it does
notifnotif(options): Promise<void>Success / info / warning / error / promise toast, optional routing + redirect.
validateAllSchema({ schema, input, error }, cb?): Promise<boolean>Validate a whole form object against a Yup schema.
validateSchema({ schema, field, input, error }, cb?): Promise<boolean>Validate a single field.
validateAllSchemaCheck(error): booleantrue if any field is currently invalid.
clearSchemaValidation({ error })Recursively reset all errors.
replacerData({ fn, type, item, key, items })Add / update / remove a row in an array or a DevExtreme DataSource.
filterOrIn(field, values, combine?)Build an OData in / chained or filter.
dxFilterToString({ filter, encode? })DevExtreme filter object โ†’ OData v4 $filter string.
preventMinus()Block - on numeric fields; returns { onKeyDown, onPaste }.
isDate(value): value is DateValid Date or parseable date string/number.
isJSONString({ input, strict?, root? })Is this string valid JSON.
safeJSONParse(str): anyParse JSON with fallbacks; null on failure.

filterOrIn(field, values, combine?) has two output shapes, and they are not interchangeable:

ts
filterOrIn('OrderID', [1, 2])        // [['OrderID','=',1], 'or', ['OrderID','=',2]]
filterOrIn('OrderID', [1, 2], true)  // ['OrderID', 'in', [1, 2]]

The default or chain is what a DevExtreme store understands โ€” pass it to store().load({ filter }) or a DataSource.

The combine: true form is for the string path only: dxFilterToString renders it as OrderID in (1,2), for a URL you build yourself. It does not survive a round trip back into a store, in either direction:

what you pass to store().load({ filter })what is sentresult
['OrderID','in',[1,2]]nothingthrows E4003 โ€” Unknown filter operation is used: in
['OrderID in (1,2)']OrderID in (1,2) eq true400
'OrderID in (1,2)'OrderID in (1,2) eq true400
[['OrderID in (1,2)']](OrderID in (1,2) eq true)400
filterOrIn('OrderID',[1,2])(OrderID eq 1) or (OrderID eq 2)200

A lone string is read by DevExtreme as a boolean-field shorthand, so it always gets eq true appended โ€” there is no raw-$filter passthrough through filter. To send a literal $filter, set it in the store's beforeSend and leave filter out of the load options.

Note also that in is OData 4.01. A 4.0 service rejects it outright โ€” the public Northwind endpoint answers Microsoft.OData.Core.ODataException: Syntax error at position 10 โ€” while TripPin accepts it.

Yup is an optional peer โ€” see the Yup and Notivue addons.

mono-utils/fetching โ€‹

See Data Fetching and DataSource.

APIWhat it is
monoFetchREST fetch with auth, refresh and error handling.
monoFetchOdataOData fetch.
monoFetchOdataUniqueOData fetch for a single entity.
monoCreateFetcherBuild a reusable fetcher.
monoStaticDataSourceDataSource over a static array.
monoTryCatchDatasourceWrap a DataSource with error handling.
monoLoadChuckStoresChunked store loading.
monoConfigureFetching / monoResetFetchingConfigSet / clear runtime fetching options (e.g. unauthCall).
monoFetchingRuntimeThe current resolved fetching runtime.
monoRestBaseUrl / monoOdataBaseUrl / monoOdataSourceResolved API bases and OData service.
monoRequestTokenToken sent on requests.
monoMockDb / resetMonoMockDbMock IndexedDB backend โ€” see Mock API.
promiseWrapperAwait a promise into an error/data pair.

mono-utils/vite โ€‹

Everything a Vue Host or Remote wires in vite.config.ts โ€” see Setup.

APIWhat it is
monoRepo(options?)The entry point. await monoRepo({ command }) โ†’ mono.pages / layouts / components / autoImport / vite() / ecosystem().
monoVite(ctx, opts?)The mono plugin set โ€” register last.
monoVue(options?)Compat plugins for a Vue app against a Nuxt Host โ€” the hybrid pairing, possible but risky (alias: monoNuxtHost); register before VueRouter().
monoPages / monoPagesOptionsvue-router routesFolder + extendRoute, own and federated.
monoLayouts / monoLayoutsOptionslayoutsDirs, driven by template.
monoComponents / monoComponentsOptionsunplugin-vue-components dirs.
monoAutoImport / monoAutoImportOptionsunplugin-auto-import dirs + imports.
monoExtendRoute(options?)The extendRoute that stamps meta.layout.
reconcileEcoPlugins(plugins)Stand down a duplicate ecosystem plugin.
sanitizeForExpose(value)The sanitiser behind __MONO_CONFIG_EXPOSE__.
ecoKeyForSub(sub) / MONO_ECO_SUB_KEYS / MONO_ECO_PLUGIN_NAMESEcosystem key lookup tables.
createRootLoader(rootDir) / canResolveFromRoot(rootDir, id)Resolve a module from an app root.
parsePageMeta / parsePageMetaFromFileRead definePageMeta / definePage blocks.

Nuxt-compat transforms (added automatically when a federated app is type: 'nuxt'): monoStripPageMeta, monoPageMetaToDefinePage, monoLayoutSlotToRouterView, monoNuxtState, monoNuxtStateToRef, monoNuxtLink, monoNuxtLinkToRouterLink, monoRouterLink, monoRouterLinkToNuxtLink.

mono-utils/nuxt ยท mono-utils/nuxt-runtime โ€‹

APIWhat it is
mono-utils/nuxt (default)The Nuxt module โ€” aliases, server.fs.allow, the config define, ecosystem merge. Add to modules[].
setMonoEventResolver(fn)Server-side request resolver.
monoCookieDriver / monoCookieStorageh3-backed cookie driver for SSR.

mono-utils/config โ€‹

Loaded by mono.config.ts itself โ€” see Config.

APIWhat it is
defineConfig(config)Define mono.config.ts.
resolveMonoConfig(config)Resolve the extends chain into one config.
resolveExtendsAppNames / resolveExtendsEcosystemsWhich layers and directories are switched on.
resolveEnv(...)Resolve the env block.
srcDirForType(type) / MONO_SRC_DIR'vue' โ†’ src/, 'nuxt' โ†’ app/.
dedupeBy / dedupeConfigArraysMerge helpers for the name-keyed arrays.

Types: MonoConfig, MonoAppConfig, MonoAppType, MonoTemplate, MonoEnvConfig, MonoFetchingConfig, MonoJwtConfig, MonoApiEntry, MonoAuthConfig, MonoMockDbConfig, MonoSyncTransport, JWTCompleteTokenTypes, SidebarMenu, Permission.

mono-utils/config/node โ€‹

Node-only โ€” what the CLI and the build integrations use.

APIWhat it is
loadMonoConfig / getMonoConfigLoad mono.config.ts outside the browser (c12/jiti).
monoAlias(options?)Build the @mono-* alias map.
monoTsconfigPaths / buildMonoTsconfig / runMonoPrepareWhat mono prepare runs.
monoMissingApps / formatMissingApps / monoStubAliasesReport and stub apps not yet synced.
extractConfig / extractConfigName / stripCommentsSafeStatic parse of the config text (how type is read before eval).
MONO_DIR / MONO_APPS_DIR / MONO_TSCONFIG_REF.mono/ path constants.

Skills / session storage (mono skills): isSkillsEnabled, readToken, loadSkillsEnv, detectActor, ghRepoMeta, ghBranchExists, ghGetContent, ghPutFile, ghTree, GithubHttpError, normalizeAppId, resolveAppId, isGenericAppName, stagingRoot, loadStagedSession, listSessions, validateStagedSession, moveToFailed, removeSession, cacheDir, chunkConversation, redact, redactBuffer, buildSavePlan, runSave, runRead, runSearch, runCheck, runSessionShow.

mono-utils/mock-db โ€‹

The browser mock backend โ€” see Mock API.

APIWhat it is
createMockDb / openMockDb / monoMockDb / resetMonoMockDbCreate, open, access, reset the database.
createMockStoreA store over one entity.
parseMockSchemaParse the mockIndexedDB schema.
generateSeed / createRandom / orderEntitiesByDependencySeed generation.
executeQuery / matchMockRoute / toODataEnvelopeServe an OData request.
parseQuery / parseFilter / parseExpand / parseApply / parseField / parseKeySegment / tokenize / normalizeSegmentOData query parsing.
evaluateFilter / applyTransformsApply $filter / $apply in memory.
isIndexedDbAvailableEnvironment check.

mono-utils (root) โ€‹

APIWhat it is
monoEcosystem(options)Resolve ecosystem directories by hand.
mergeEcosystem(...)Merge two ecosystem sets.
htmlPath / htmlToVueResolve an HTML file and turn it into a Vue component.