{"_id":"@authoss/duster-vue","_rev":"2-4807c24885828b88acb2b45a8ed39771","name":"@authoss/duster-vue","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@authoss/duster-vue","version":"0.1.0","keywords":["duster","authos","vue","oauth2","oidc","authentication","composables"],"license":"MIT","_id":"@authoss/duster-vue@0.1.0","maintainers":[{"name":"stevetosak","email":"stefantoska84@gmail.com"}],"homepage":"https://github.com/stevetosak/authos/tree/master/packages/vue#readme","bugs":{"url":"https://github.com/stevetosak/authos/issues"},"dist":{"shasum":"63bea665aabed0dfbbe516d2d3b7c87866b16e61","tarball":"https://registry.npmjs.org/@authoss/duster-vue/-/duster-vue-0.1.0.tgz","fileCount":9,"integrity":"sha512-QiYuK2t39ger4QADLov9TVkd1El6EQEMCIPvPfzlv8kSr4zCeQROmSUFKaAoCWDDeYuTk+0PpsgjqAS/dGb+4Q==","signatures":[{"sig":"MEUCIDLAn8BrTZJh2JaHNl1p1q6iaqfHwyB2aJqF1tMasFKXAiEA3mFBmJ4fsDJbEQAZq0EuZ1QycM2af4tL5SuG6n8ctcM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30080},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"e66fbb9230a463707ab38a712547ff553ef2aba7","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"stevetosak","email":"stefantoska84@gmail.com"},"repository":{"url":"git+https://github.com/stevetosak/authos.git","type":"git","directory":"packages/vue"},"_npmVersion":"10.8.2","description":"Vue 3 bindings for @authoss/duster-core — createDuster() plugin, useDuster(), <ProtectedRoute>.","directories":{},"sideEffects":false,"_nodeVersion":"20.19.0","dependencies":{"@authoss/duster-core":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vue":"^3.5.13","tsup":"^8.5.0","jsdom":"^26.1.0","typescript":"~5.7.2","@vue/test-utils":"^2.4.6"},"peerDependencies":{"vue":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/duster-vue_0.1.0_1788011813164_0.08056281082363648","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@authoss/duster-vue","version":"0.1.1","description":"Vue 3 bindings for @authoss/duster-core — createDuster() plugin, useDuster(), <ProtectedRoute>.","license":"MIT","type":"module","sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"repository":{"type":"git","url":"git+https://github.com/stevetosak/authos.git","directory":"packages/vue"},"homepage":"https://github.com/stevetosak/authos/tree/master/packages/vue#readme","bugs":{"url":"https://github.com/stevetosak/authos/issues"},"keywords":["duster","authos","vue","oauth2","oidc","authentication","composables"],"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"dependencies":{"@authoss/duster-core":"^0.1.1"},"peerDependencies":{"vue":"^3.4.0"},"devDependencies":{"@vue/test-utils":"^2.4.6","jsdom":"^26.1.0","tsup":"^8.5.0","typescript":"~5.7.2","vue":"^3.5.13"},"gitHead":"e66fbb9230a463707ab38a712547ff553ef2aba7","_id":"@authoss/duster-vue@0.1.1","_nodeVersion":"24.19.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-d+CTMWx4g+mBI6JFGCeP99TUHeAeCoPKOOQEhnWYUt9pZRzkbR2G4FdyPYcPXQ5M3rF8hbQeGVI9G17dT0cWOg==","shasum":"55b8c234143549a9f9b5a31286280e38243a4e4b","tarball":"https://registry.npmjs.org/@authoss/duster-vue/-/duster-vue-0.1.1.tgz","fileCount":9,"unpackedSize":30080,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@authoss%2fduster-vue@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC2zhrsQgv2CtaWjVNQ7Kgs/qF6lQa/+qjRLjSpRo/INgIgWymiS+B5OLWq7+yUK1BUUgHl+4kaNb14rqJSH1Zw5uE="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:eaf93d7b-04ca-46a5-b230-bbacab9600b0"}},"directories":{},"maintainers":[{"name":"stevetosak","email":"stefantoska84@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/duster-vue_0.1.1_1788012365867_0.9092830409777244"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-29T13:56:52.995Z","modified":"2026-08-29T14:06:06.422Z","0.1.0":"2026-08-29T13:56:53.292Z","0.1.1":"2026-08-29T14:06:06.030Z"},"bugs":{"url":"https://github.com/stevetosak/authos/issues"},"license":"MIT","homepage":"https://github.com/stevetosak/authos/tree/master/packages/vue#readme","keywords":["duster","authos","vue","oauth2","oidc","authentication","composables"],"repository":{"type":"git","url":"git+https://github.com/stevetosak/authos.git","directory":"packages/vue"},"description":"Vue 3 bindings for @authoss/duster-core — createDuster() plugin, useDuster(), <ProtectedRoute>.","maintainers":[{"name":"stevetosak","email":"stefantoska84@gmail.com"}],"readme":"# @authoss/duster-vue\n\nVue 3 bindings for [Duster](https://github.com/stevetosak/authos/tree/master/duster) — a thin layer\nover [`@authoss/duster-core`](../core). Reactive session state via `shallowRef`, no router\ndependency.\n\n```\nnpm i @authoss/duster-vue\n```\n\n## Usage\n\n```ts\nimport { createApp } from 'vue'\nimport { createDuster } from '@authoss/duster-vue'\nimport App from './App.vue'\n\ncreateApp(App)\n  .use(createDuster({ clientId: 'app_123', onUnauthenticated: 'redirect' }))\n  .mount('#app')\n```\n\n```ts\nimport { defineComponent, h } from 'vue'\nimport { useDuster, ProtectedRoute } from '@authoss/duster-vue'\n\nconst Nav = defineComponent(() => {\n  const { user, status, login, logout } = useDuster()\n  return () => {\n    if (status.value === 'loading') return null\n    return status.value === 'authenticated'\n      ? h('button', { onClick: () => logout() }, `Sign out ${user.value!.email}`)\n      : h('button', { onClick: () => login() }, 'Sign in')\n  }\n})\n\nconst Dashboard = defineComponent(() =>\n  () => h(ProtectedRoute, null, {\n    loading: () => h(Spinner),\n    default: () => h(SecretStuff),\n  }),\n)\n```\n\n## `createDuster(config)`\n\nThe Vue plugin. `config` is a `DusterConfig` — `clientId` (required), `baseUrl`, `basePath`,\n`onUnauthenticated` (`'redirect' | 'ignore' | fn`), `postLogoutRedirect`, `revalidateOnFocus`,\n`revalidateOnReconnect`, `fetch`. Provides one client for the app and runs the first `/me` on\ninstall; safe to call twice with the same `clientId` (one client, one in-flight `/me`).\n\n## `useDuster()`\n\nReturns `{ user, status, error, login, logout, refresh }` — `user` / `status` / `error` are\n`ComputedRef`s, so read them as `status.value` in `setup()` or `status` in a template. `status` is\n`'loading' | 'authenticated' | 'unauthenticated'`. `error` is set on a server / network failure and\ndoes **not** by itself mean logged-out. Call it in `setup()` (or another composable); throws if the\nplugin isn't installed. The store subscription is torn down with the component's effect scope.\n\n## `<ProtectedRoute>` (alias `<Protected>`)\n\nPresentational. Renders, in order: the `default` slot (authenticated) → `errorFallback` slot\n(server/network error while not authenticated) → `loading` slot → `fallback` slot. The redirect on\na missing session is driven by the plugin's `onUnauthenticated`, not this component — for an in-page\nlogin prompt, provide `fallback` and set `onUnauthenticated: 'ignore'`.\n\n## Router recipe\n\nNo router is bundled. For vue-router, gate in a navigation guard:\n\n```ts\nimport { getOrCreateDusterClient } from '@authoss/duster-core'\n\nconst duster = getOrCreateDusterClient({ clientId: 'app_123' })\n\nrouter.beforeEach(async (to) => {\n  if (!to.meta.protected) return true\n  await duster.init()\n  return duster.getSnapshot().status === 'authenticated' ? true : { name: 'login' }\n})\n```\n\nMIT © Authos\n","readmeFilename":"README.md"}