{"_id":"@dloizides/orval-preset","name":"@dloizides/orval-preset","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"@dloizides/orval-preset","version":"1.0.1","description":"Shared Orval generation setup for the dloizides.com SaaS frontends: a 6-API config factory (defineOrvalConfig), the per-service mutator registry, and the axios-bridge createHttpClient factory (transport injected as a port). Owned shape erevna-web and kata","keywords":["orval","react-query","openapi","codegen","mutator","dloizides"],"author":{"name":"dloizides"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/openmindednewby/orval-preset.git"},"homepage":"https://github.com/openmindednewby/orval-preset#readme","bugs":{"url":"https://github.com/openmindednewby/orval-preset/issues"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"}}},"sideEffects":false,"engines":{"node":">=18.0.0"},"scripts":{"build":"rimraf dist && tsup","build:watch":"tsup --watch","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","lint":"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix","typecheck":"tsc --noEmit","clean":"rimraf dist","security:audit":"npm audit --audit-level=high","deps:outdated":"npm outdated || exit 0","deps:unused":"npx depcheck --ignores \"@types/jest,@types/node,rimraf\"","deps:licenses":"npx license-checker --onlyAllow \"MIT;Apache-2.0;ISC;BSD-2-Clause;BSD-3-Clause;0BSD;Unlicense;CC0-1.0\"","deps:health":"npm run deps:outdated && npm run deps:unused","prepublishOnly":"npm run clean && npm run build && npm run test"},"devDependencies":{"@types/jest":"^29.5.0","@types/node":"^20.19.32","@typescript-eslint/eslint-plugin":"^7.0.0","@typescript-eslint/parser":"^7.0.0","eslint":"^8.57.0","eslint-plugin-sonarjs":"^4.0.3","jest":"^29.7.0","jest-environment-jsdom":"^29.7.0","rimraf":"^5.0.0","ts-jest":"^29.1.0","tsup":"^8.0.0","typescript":"^5.4.0"},"_id":"@dloizides/orval-preset@1.0.1","gitHead":"2ce9f42c59c8c3266816952feab14d113d6a0381","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-Y2DWALvWagAz8UaPwEwqpgp60qzVYpFkYRfjdKJrPYXzS3aZcCjshaykoqZVFLmXw57541zWcDsJ51Oto98dZg==","shasum":"1c4db39c9b470b863909af828fbdedcb58662a09","tarball":"https://registry.npmjs.org/@dloizides/orval-preset/-/orval-preset-1.0.1.tgz","fileCount":10,"unpackedSize":90363,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDSAzFSrzXFEqtQFt5SxmA3XfdDEincyy/tATAQCXg3YAiAVBEgB2a9QOVYLEDg8OloRQpgVbXlPyPEx3pJzRFDiKw=="}]},"_npmUser":{"name":"dloizides","email":"loizidesdemetris@gmail.com"},"directories":{},"maintainers":[{"name":"dloizides","email":"loizidesdemetris@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/orval-preset_1.0.1_1781444993046_0.7941340269345492"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-14T13:49:52.927Z","1.0.1":"2026-06-14T13:49:53.190Z","modified":"2026-06-14T13:49:53.406Z"},"maintainers":[{"name":"dloizides","email":"loizidesdemetris@gmail.com"}],"description":"Shared Orval generation setup for the dloizides.com SaaS frontends: a 6-API config factory (defineOrvalConfig), the per-service mutator registry, and the axios-bridge createHttpClient factory (transport injected as a port). Owned shape erevna-web and kata","homepage":"https://github.com/openmindednewby/orval-preset#readme","keywords":["orval","react-query","openapi","codegen","mutator","dloizides"],"repository":{"type":"git","url":"git+https://github.com/openmindednewby/orval-preset.git"},"author":{"name":"dloizides"},"bugs":{"url":"https://github.com/openmindednewby/orval-preset/issues"},"license":"MIT","readme":"# @dloizides/orval-preset\n\nShared [Orval](https://orval.dev) generation setup for the dloizides.com SaaS\nfrontends (`erevna-web` + `katalogos-web`).\n\nBoth apps generate React Query hooks from the **same six OpenAPI services**\n(onlineMenu / identity / questioner / content / notification / payment) with a\nbyte-for-byte identical config, mutator registry, and axios-bridge http client.\nThis package owns that shared shape. Each app keeps only its own\n`swagger/*.json` inputs, output paths, and the generated client dirs.\n\n## Surface\n\n| Export | When | Purpose |\n| --- | --- | --- |\n| `defineOrvalConfig(opts)` | build-time | Builds the 6-API Orval config from app paths. |\n| `customInstance`, `identityInstance`, `questionerInstance`, `contentInstance`, `notificationInstance`, `paymentInstance` | runtime | The mutators referenced by the generated hooks; they delegate to the registry. |\n| `registerMutators` / `getMutator` | runtime | The registry the app populates at startup with the real http clients. |\n| `createHttpClient(httpService, opts)` | runtime | Axios-bridge factory; the app injects its own `httpService` transport (port). |\n\n## Build-time: `orval.config.js`\n\n```js\nconst { defineOrvalConfig } = require('@dloizides/orval-preset');\n\nmodule.exports = defineOrvalConfig({\n  swaggerDir: './src/server/swagger',\n  outDir: './src/server/autoGeneratedHooks',\n  mutatorPath: './src/server/mutators',\n});\n```\n\n`mutatorPath` is the directory the generated hooks import their mutator from.\nKeep a thin local shim at that path that re-exports from this package, so the\ngenerated import paths stay stable across regenerations:\n\n```ts\n// src/server/mutators/onlineMenuMutator.ts\nexport { customInstance, customInstance as default } from '@dloizides/orval-preset';\n```\n\n## Runtime: registration + http client\n\n```ts\n// src/server/httpClient.ts\nimport { createHttpClient } from '@dloizides/orval-preset';\nimport * as httpService from '../lib/httpService';\nimport { BFF_API_BASE } from './bffRoutes';\n\nexport const customInstance = createHttpClient(httpService, {\n  baseURL: BFF_API_BASE.menus,\n  withCredentials: true,\n});\n```\n\n```ts\n// app entry point\nimport { registerMutators } from '@dloizides/orval-preset';\nimport { customInstance } from './server/httpClient';\n// …the other five httpClient* files…\n\nregisterMutators({ customInstance /* , … */ });\n```\n\nThe `httpService` port must expose `get` / `post` / `postForm` / `put` /\n`patch` / `deleteMethod` (the surface the apps' axios bridge already provides).\n\n## Why a port, not a baked-in axios\n\n`createHttpClient` takes the transport as an argument so the package never\nimports a product, a realm, or a concrete axios instance. The app's UI axios\n(`@dloizides/bff-web-client`) and this mutator transport remain separate\ninstances by design; unifying them is a future optimization.\n","readmeFilename":"README.md","_rev":"1-f37a10126d49f33662dc5179decd215e"}