limen-auth 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/dist/bearer-Cqmrmjjf.mjs +84 -0
  4. package/dist/bearer-Cqmrmjjf.mjs.map +1 -0
  5. package/dist/client-Er91De-z.mjs +705 -0
  6. package/dist/client-Er91De-z.mjs.map +1 -0
  7. package/dist/constants-CsR2pQ_9.mjs +15 -0
  8. package/dist/constants-CsR2pQ_9.mjs.map +1 -0
  9. package/dist/define-plugin-C7WOGU4b.mjs +24 -0
  10. package/dist/define-plugin-C7WOGU4b.mjs.map +1 -0
  11. package/dist/define-plugin-Dv0xXIaH.d.mts +450 -0
  12. package/dist/define-plugin-Dv0xXIaH.d.mts.map +1 -0
  13. package/dist/errors-4YJYt6f0.mjs +37 -0
  14. package/dist/errors-4YJYt6f0.mjs.map +1 -0
  15. package/dist/helpers-Cs3VtXdv.mjs +54 -0
  16. package/dist/helpers-Cs3VtXdv.mjs.map +1 -0
  17. package/dist/helpers-CvmKjWi2.d.mts +10 -0
  18. package/dist/helpers-CvmKjWi2.d.mts.map +1 -0
  19. package/dist/index-B8SpHkSd.d.mts +48 -0
  20. package/dist/index-B8SpHkSd.d.mts.map +1 -0
  21. package/dist/index-C6atwjEq.d.mts +65 -0
  22. package/dist/index-C6atwjEq.d.mts.map +1 -0
  23. package/dist/index-C9EuA9UZ.d.mts +32 -0
  24. package/dist/index-C9EuA9UZ.d.mts.map +1 -0
  25. package/dist/index-Cgr2wHmM.d.mts +87 -0
  26. package/dist/index-Cgr2wHmM.d.mts.map +1 -0
  27. package/dist/index-DV6YcNSu.d.mts +81 -0
  28. package/dist/index-DV6YcNSu.d.mts.map +1 -0
  29. package/dist/index-dEksIImj.d.mts +28 -0
  30. package/dist/index-dEksIImj.d.mts.map +1 -0
  31. package/dist/index.d.mts +30 -0
  32. package/dist/index.d.mts.map +1 -0
  33. package/dist/index.mjs +12 -0
  34. package/dist/index.mjs.map +1 -0
  35. package/dist/plugins/bearer/index.d.mts +2 -0
  36. package/dist/plugins/bearer/index.mjs +2 -0
  37. package/dist/plugins/credential/index.d.mts +2 -0
  38. package/dist/plugins/credential/index.mjs +50 -0
  39. package/dist/plugins/credential/index.mjs.map +1 -0
  40. package/dist/plugins/index.d.mts +7 -0
  41. package/dist/plugins/index.mjs +7 -0
  42. package/dist/plugins/magic-link/index.d.mts +2 -0
  43. package/dist/plugins/magic-link/index.mjs +21 -0
  44. package/dist/plugins/magic-link/index.mjs.map +1 -0
  45. package/dist/plugins/oauth/index.d.mts +2 -0
  46. package/dist/plugins/oauth/index.mjs +56 -0
  47. package/dist/plugins/oauth/index.mjs.map +1 -0
  48. package/dist/plugins/session-jwt/index.d.mts +2 -0
  49. package/dist/plugins/session-jwt/index.mjs +2 -0
  50. package/dist/plugins/two-factor/index.d.mts +2 -0
  51. package/dist/plugins/two-factor/index.mjs +52 -0
  52. package/dist/plugins/two-factor/index.mjs.map +1 -0
  53. package/dist/react/index.d.mts +24 -0
  54. package/dist/react/index.d.mts.map +1 -0
  55. package/dist/react/index.mjs +31 -0
  56. package/dist/react/index.mjs.map +1 -0
  57. package/dist/route-DGxvFqWl.mjs +19 -0
  58. package/dist/route-DGxvFqWl.mjs.map +1 -0
  59. package/dist/session-jwt-DgLdMQxP.mjs +129 -0
  60. package/dist/session-jwt-DgLdMQxP.mjs.map +1 -0
  61. package/dist/solid/index.d.mts +25 -0
  62. package/dist/solid/index.d.mts.map +1 -0
  63. package/dist/solid/index.mjs +28 -0
  64. package/dist/solid/index.mjs.map +1 -0
  65. package/dist/svelte/index.d.mts +25 -0
  66. package/dist/svelte/index.d.mts.map +1 -0
  67. package/dist/svelte/index.mjs +18 -0
  68. package/dist/svelte/index.mjs.map +1 -0
  69. package/dist/vue/index.d.mts +36 -0
  70. package/dist/vue/index.d.mts.map +1 -0
  71. package/dist/vue/index.mjs +36 -0
  72. package/dist/vue/index.mjs.map +1 -0
  73. package/package.json +123 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["createCoreClient"],"sources":["../../src/vue/vue-store.ts","../../src/vue/index.ts"],"sourcesContent":["import type { Store, StoreValue } from \"nanostores\";\nimport type { DeepReadonly, ShallowRef, UnwrapNestedRefs } from \"vue\";\nimport { getCurrentScope, onScopeDispose, readonly, shallowRef } from \"vue\";\n\n/** What {@link useStore} returns: a readonly reactive ref of the store value. */\nexport type ReactiveValue<Value> = DeepReadonly<UnwrapNestedRefs<ShallowRef<Value>>>;\n\n/**\n * Subscribe a Vue component to a nanostores store.\n *\n * Modeled on `@nanostores/vue`'s `useStore`: a `shallowRef` mirrors the store\n * value, `subscribe` keeps it in sync (firing once immediately), and the\n * listener is torn down on scope dispose. On the server (no `window`) it reads\n * once without subscribing, so a store seeded with `initialSession` renders\n * without leaving a subscription behind.\n */\nexport function useStore<SomeStore extends Store>(store: SomeStore): ReactiveValue<StoreValue<SomeStore>> {\n type Value = StoreValue<SomeStore>;\n\n const state = shallowRef<Value>(store.get());\n\n if (typeof window !== \"undefined\") {\n const unsubscribe = store.subscribe((value) => {\n state.value = value;\n });\n if (getCurrentScope()) {\n onScopeDispose(unsubscribe);\n }\n }\n\n return readonly(state);\n}\n","import { createAuthClient as createCoreClient } from \"../client\";\nimport type { AnyClientPlugin } from \"../define-plugin\";\nimport type { SessionState } from \"../session-store\";\nimport type { Prettify } from \"../type-utils\";\nimport type { AuthClient, CreateAuthClientOptions } from \"../types\";\nimport type { ReactiveValue } from \"./vue-store\";\nimport { useStore } from \"./vue-store\";\n\n/**\n * An {@link AuthClient} augmented with Vue composables.\n */\nexport type VueAuthClient<Plugins extends readonly AnyClientPlugin[], TFields = unknown> = Prettify<\n AuthClient<Plugins, TFields> & {\n /**\n * Reactively read the session store as a readonly ref. Updates whenever\n * `{ data, isPending, error }` changes.\n */\n useSession: () => ReactiveValue<SessionState<TFields>>;\n }\n>;\n\n/**\n * Create a Limen auth client with Vue composables attached.\n */\nexport function createAuthClient<const Plugins extends readonly AnyClientPlugin[] = readonly [], TFields = unknown>(\n opts: CreateAuthClientOptions<Plugins, TFields>,\n): VueAuthClient<Plugins, TFields> {\n const client = createCoreClient<Plugins, TFields>(opts);\n const useSession = (): ReactiveValue<SessionState<TFields>> => useStore(client.$session);\n\n return Object.assign(client, { useSession }) as VueAuthClient<Plugins, TFields>;\n}\n\nexport type { SessionState, SessionStore } from \"../session-store\";\nexport type { AuthClient, CreateAuthClientOptions, Session, User } from \"../types\";\nexport { useStore } from \"./vue-store\";\nexport type { ReactiveValue } from \"./vue-store\";\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAgB,SAAkC,OAAwD;CAGxG,MAAM,QAAQ,WAAkB,MAAM,IAAI,CAAC;CAE3C,IAAI,OAAO,WAAW,aAAa;EACjC,MAAM,cAAc,MAAM,WAAW,UAAU;GAC7C,MAAM,QAAQ;EAChB,CAAC;EACD,IAAI,gBAAgB,GAClB,eAAe,WAAW;CAE9B;CAEA,OAAO,SAAS,KAAK;AACvB;;;;;;ACPA,SAAgB,iBACd,MACiC;CACjC,MAAM,SAASA,mBAAmC,IAAI;CACtD,MAAM,mBAAyD,SAAS,OAAO,QAAQ;CAEvF,OAAO,OAAO,OAAO,QAAQ,EAAE,WAAW,CAAC;AAC7C"}
package/package.json ADDED
@@ -0,0 +1,123 @@
1
+ {
2
+ "name": "limen-auth",
3
+ "version": "0.0.0",
4
+ "description": "TypeScript authentication client for Limen — framework-agnostic core with React, Vue, Svelte, and Solid adapters.",
5
+ "keywords": [
6
+ "limen",
7
+ "auth",
8
+ "authentication",
9
+ "session",
10
+ "oauth",
11
+ "two-factor",
12
+ "magic-link",
13
+ "jwt",
14
+ "react",
15
+ "vue",
16
+ "svelte",
17
+ "solid",
18
+ "typescript",
19
+ "sdk"
20
+ ],
21
+ "homepage": "https://github.com/thecodearcher/limen#readme",
22
+ "bugs": "https://github.com/thecodearcher/limen/issues",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/thecodearcher/limen.git",
26
+ "directory": "clients/typescript/packages/client"
27
+ },
28
+ "license": "MIT",
29
+ "author": "Brian Iyoha <brian.iyoha@gmail.com>",
30
+ "type": "module",
31
+ "module": "./dist/index.mjs",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "import": {
38
+ "types": "./dist/index.d.mts",
39
+ "default": "./dist/index.mjs"
40
+ }
41
+ },
42
+ "./react": {
43
+ "import": {
44
+ "types": "./dist/react/index.d.mts",
45
+ "default": "./dist/react/index.mjs"
46
+ }
47
+ },
48
+ "./vue": {
49
+ "import": {
50
+ "types": "./dist/vue/index.d.mts",
51
+ "default": "./dist/vue/index.mjs"
52
+ }
53
+ },
54
+ "./svelte": {
55
+ "import": {
56
+ "types": "./dist/svelte/index.d.mts",
57
+ "default": "./dist/svelte/index.mjs"
58
+ }
59
+ },
60
+ "./solid": {
61
+ "import": {
62
+ "types": "./dist/solid/index.d.mts",
63
+ "default": "./dist/solid/index.mjs"
64
+ }
65
+ },
66
+ "./plugins": {
67
+ "import": {
68
+ "types": "./dist/plugins/index.d.mts",
69
+ "default": "./dist/plugins/index.mjs"
70
+ }
71
+ },
72
+ "./plugins/*": {
73
+ "import": {
74
+ "types": "./dist/plugins/*/index.d.mts",
75
+ "default": "./dist/plugins/*/index.mjs"
76
+ }
77
+ }
78
+ },
79
+ "files": [
80
+ "dist",
81
+ "README.md"
82
+ ],
83
+ "sideEffects": false,
84
+ "dependencies": {
85
+ "nanostores": "^1.3.0"
86
+ },
87
+ "peerDependencies": {
88
+ "react": ">=18",
89
+ "solid-js": ">=1",
90
+ "svelte": ">=4",
91
+ "vue": ">=3"
92
+ },
93
+ "peerDependenciesMeta": {
94
+ "react": {
95
+ "optional": true
96
+ },
97
+ "solid-js": {
98
+ "optional": true
99
+ },
100
+ "svelte": {
101
+ "optional": true
102
+ },
103
+ "vue": {
104
+ "optional": true
105
+ }
106
+ },
107
+ "devDependencies": {
108
+ "@testing-library/react": "^16.1.0",
109
+ "@types/react": "^19.0.0",
110
+ "happy-dom": "^20.10.5",
111
+ "react": "^19.0.0",
112
+ "react-dom": "^19.0.0",
113
+ "solid-js": "^1.9.0",
114
+ "svelte": "^5.0.0",
115
+ "vitest": "^4.1.9",
116
+ "vue": "^3.5.0"
117
+ },
118
+ "scripts": {
119
+ "build": "tsdown",
120
+ "typecheck": "tsc --noEmit",
121
+ "test": "vitest run"
122
+ }
123
+ }