From 6975e3ab25e38cbb8af2fbb97fe9bc55a2ed0552 Mon Sep 17 00:00:00 2001
From: Steel <mael.acier@ensiie.fr>
Date: Tue, 12 Dec 2023 00:36:07 +0100
Subject: [PATCH] fix: public export

---
 package.json           | 6 +++++-
 src/{lib => }/app.d.ts | 0
 src/lib/index.ts       | 3 +--
 src/lib/public.ts      | 2 ++
 src/lib/types.ts       | 9 +++++++--
 5 files changed, 15 insertions(+), 5 deletions(-)
 rename src/{lib => }/app.d.ts (100%)
 create mode 100644 src/lib/public.ts

diff --git a/package.json b/package.json
index e361de3..5730653 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@arise/aidc-sveltekit",
-  "version": "0.0.8",
+  "version": "0.0.9",
   "type": "module",
   "scripts": {
     "dev": "vite dev",
@@ -20,6 +20,10 @@
     ".": {
       "types": "./dist/index.d.ts",
       "svelte": "./dist/index.js"
+    },
+    "./public": {
+      "types": "./dist/public.d.ts",
+      "svelte": "./dist/public.js"
     }
   },
   "files": [
diff --git a/src/lib/app.d.ts b/src/app.d.ts
similarity index 100%
rename from src/lib/app.d.ts
rename to src/app.d.ts
diff --git a/src/lib/index.ts b/src/lib/index.ts
index e261e2e..8ea634a 100644
--- a/src/lib/index.ts
+++ b/src/lib/index.ts
@@ -5,9 +5,8 @@ import type { Config, InternalConfig } from "./types.js";
 import * as paths from "./paths.js";
 import { authCookieBuilder, tokenSetCookieBuilder } from "./cookies.js";
 
-export type { AuthData as AriseData, Config, Locals } from "./types.js";
 export { handleBuilder as ariseIdConnectBuilder } from "./index.js";
-export * as authPaths from "./paths.js";
+export * from "./public.js";
 
 function addBase(path: string): string {
   return `${base}${path}`;
diff --git a/src/lib/public.ts b/src/lib/public.ts
new file mode 100644
index 0000000..5b41012
--- /dev/null
+++ b/src/lib/public.ts
@@ -0,0 +1,2 @@
+export type { AuthData as AriseData, Config } from "./types.js";
+export * as authPaths from "./paths.js";
diff --git a/src/lib/types.ts b/src/lib/types.ts
index ae7f85f..0995ebf 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -17,8 +17,13 @@ export type AuthData = {
   error?: errors.OPError | errors.RPError;
 };
 
-export interface Locals {
-  arise: AuthData;
+declare global {
+  // eslint-disable-next-line @typescript-eslint/no-namespace
+  namespace App {
+    interface Locals {
+      arise: AuthData;
+    }
+  }
 }
 
 type Paths = {
-- 
GitLab