@enfyra/sdk-nuxt 0.7.1 → 0.7.2

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.
package/dist/module.cjs CHANGED
@@ -98,16 +98,6 @@ declare module '#imports' {
98
98
  handler: resolve("./runtime/server/api/logout.post"),
99
99
  method: "post"
100
100
  });
101
- kit.addServerHandler({
102
- route: `${apiPrefix}/auth/:provider`,
103
- handler: resolve("./runtime/server/api/auth/[provider].get"),
104
- method: "get"
105
- });
106
- kit.addServerHandler({
107
- route: `${apiPrefix}/auth/:provider/callback`,
108
- handler: resolve("./runtime/server/api/auth/[provider]/callback.get"),
109
- method: "get"
110
- });
111
101
  kit.addServerHandler({
112
102
  route: `${apiPrefix}/auth/callback`,
113
103
  handler: resolve("./runtime/server/api/auth/callback.get"),
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;AAED,wBAgJG"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;AAED,wBAoIG"}
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.7.1",
7
+ "version": "0.7.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -95,16 +95,6 @@ declare module '#imports' {
95
95
  handler: resolve("./runtime/server/api/logout.post"),
96
96
  method: "post"
97
97
  });
98
- addServerHandler({
99
- route: `${apiPrefix}/auth/:provider`,
100
- handler: resolve("./runtime/server/api/auth/[provider].get"),
101
- method: "get"
102
- });
103
- addServerHandler({
104
- route: `${apiPrefix}/auth/:provider/callback`,
105
- handler: resolve("./runtime/server/api/auth/[provider]/callback.get"),
106
- method: "get"
107
- });
108
98
  addServerHandler({
109
99
  route: `${apiPrefix}/auth/callback`,
110
100
  handler: resolve("./runtime/server/api/auth/callback.get"),
@@ -70,7 +70,7 @@ export function useEnfyraAuth() {
70
70
  return;
71
71
  }
72
72
  const currentUrl = window.location.href;
73
- window.location.href = `${baseUrl}/auth/${provider}?redirect=${encodeURIComponent(currentUrl)}`;
73
+ window.location.href = `/api/auth/${provider}?redirect=${encodeURIComponent(currentUrl)}`;
74
74
  };
75
75
  return {
76
76
  me,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/sdk-nuxt",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "description": "Nuxt SDK for Enfyra CMS",
6
6
  "repository": {
package/src/module.ts CHANGED
@@ -130,19 +130,7 @@ declare module '#imports' {
130
130
  method: "post",
131
131
  });
132
132
 
133
- // OAuth routes
134
- addServerHandler({
135
- route: `${apiPrefix}/auth/:provider`,
136
- handler: resolve("./runtime/server/api/auth/[provider].get"),
137
- method: "get",
138
- });
139
-
140
- addServerHandler({
141
- route: `${apiPrefix}/auth/:provider/callback`,
142
- handler: resolve("./runtime/server/api/auth/[provider]/callback.get"),
143
- method: "get",
144
- });
145
-
133
+ // OAuth callback - sets cookies and redirects
146
134
  addServerHandler({
147
135
  route: `${apiPrefix}/auth/callback`,
148
136
  handler: resolve("./runtime/server/api/auth/callback.get"),
@@ -87,7 +87,7 @@ export function useEnfyraAuth(): UseEnfyraAuthReturn {
87
87
  }
88
88
 
89
89
  const currentUrl = window.location.href;
90
- window.location.href = `${baseUrl}/auth/${provider}?redirect=${encodeURIComponent(currentUrl)}`;
90
+ window.location.href = `/api/auth/${provider}?redirect=${encodeURIComponent(currentUrl)}`;
91
91
  };
92
92
 
93
93
  return {
@@ -1,3 +0,0 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
2
- export default _default;
3
- //# sourceMappingURL=callback.get.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callback.get.d.ts","sourceRoot":"","sources":["../../../../../../src/runtime/server/api/auth/[provider]/callback.get.ts"],"names":[],"mappings":";AAQA,wBAYG"}
@@ -1,16 +0,0 @@
1
- import {
2
- defineEventHandler,
3
- getQuery,
4
- sendRedirect
5
- } from "h3";
6
- import { useRuntimeConfig } from "#imports";
7
- import { normalizeUrl } from "../../../../utils/url.js";
8
- export default defineEventHandler(async (event) => {
9
- const config = useRuntimeConfig();
10
- const apiUrl = config.public.enfyraSDK?.apiUrl;
11
- const provider = event.context.params?.provider;
12
- const query = getQuery(event);
13
- const queryString = new URLSearchParams(query).toString();
14
- const backendUrl = normalizeUrl(apiUrl, `/auth/${provider}/callback?${queryString}`);
15
- return sendRedirect(event, backendUrl, 302);
16
- });
@@ -1,3 +0,0 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
2
- export default _default;
3
- //# sourceMappingURL=%5Bprovider%5D.get.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"[provider].get.d.ts","sourceRoot":"","sources":["../../../../../src/runtime/server/api/auth/[provider].get.ts"],"names":[],"mappings":";AAYA,wBAyBG"}
@@ -1,31 +0,0 @@
1
- import {
2
- defineEventHandler,
3
- getQuery,
4
- createError,
5
- sendError,
6
- sendRedirect
7
- } from "h3";
8
- import { useRuntimeConfig } from "#imports";
9
- import { normalizeUrl } from "../../../utils/url.js";
10
- const VALID_PROVIDERS = ["google", "facebook", "github"];
11
- export default defineEventHandler(async (event) => {
12
- const config = useRuntimeConfig();
13
- const apiUrl = config.public.enfyraSDK?.apiUrl;
14
- const provider = event.context.params?.provider;
15
- if (!provider || !VALID_PROVIDERS.includes(provider)) {
16
- return sendError(
17
- event,
18
- createError({
19
- statusCode: 400,
20
- statusMessage: `Invalid OAuth provider: ${provider}`
21
- })
22
- );
23
- }
24
- const query = getQuery(event);
25
- const redirectUrl = query.redirect;
26
- let oauthUrl = normalizeUrl(apiUrl, `/auth/${provider}`);
27
- if (redirectUrl) {
28
- oauthUrl += `?redirect=${encodeURIComponent(redirectUrl)}`;
29
- }
30
- return sendRedirect(event, oauthUrl, 302);
31
- });
@@ -1,21 +0,0 @@
1
- import {
2
- defineEventHandler,
3
- getQuery,
4
- sendRedirect,
5
- } from "h3";
6
- import { useRuntimeConfig } from "#imports";
7
- import { normalizeUrl } from "../../../../utils/url";
8
-
9
- export default defineEventHandler(async (event) => {
10
- const config = useRuntimeConfig();
11
- const apiUrl = config.public.enfyraSDK?.apiUrl;
12
- const provider = event.context.params?.provider;
13
-
14
- const query = getQuery(event);
15
- const queryString = new URLSearchParams(query as Record<string, string>).toString();
16
-
17
- // Redirect to backend OAuth callback
18
- const backendUrl = normalizeUrl(apiUrl, `/auth/${provider}/callback?${queryString}`);
19
-
20
- return sendRedirect(event, backendUrl, 302);
21
- });
@@ -1,38 +0,0 @@
1
- import {
2
- defineEventHandler,
3
- getQuery,
4
- createError,
5
- sendError,
6
- sendRedirect,
7
- } from "h3";
8
- import { useRuntimeConfig } from "#imports";
9
- import { normalizeUrl } from "../../../utils/url";
10
-
11
- const VALID_PROVIDERS = ["google", "facebook", "github"];
12
-
13
- export default defineEventHandler(async (event) => {
14
- const config = useRuntimeConfig();
15
- const apiUrl = config.public.enfyraSDK?.apiUrl;
16
- const provider = event.context.params?.provider;
17
-
18
- if (!provider || !VALID_PROVIDERS.includes(provider)) {
19
- return sendError(
20
- event,
21
- createError({
22
- statusCode: 400,
23
- statusMessage: `Invalid OAuth provider: ${provider}`,
24
- })
25
- );
26
- }
27
-
28
- const query = getQuery(event);
29
- const redirectUrl = query.redirect as string | undefined;
30
-
31
- // Build backend OAuth URL
32
- let oauthUrl = normalizeUrl(apiUrl, `/auth/${provider}`);
33
- if (redirectUrl) {
34
- oauthUrl += `?redirect=${encodeURIComponent(redirectUrl)}`;
35
- }
36
-
37
- return sendRedirect(event, oauthUrl, 302);
38
- });