nuxt-auther 1.2.2 → 1.2.3

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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-auther",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "configKey": "auth",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0 <5.0.0"
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ import { existsSync } from 'fs';
7
7
  import { hash } from 'ohash';
8
8
 
9
9
  const name = "nuxt-auther";
10
- const version = "1.2.2";
10
+ const version = "1.2.3";
11
11
 
12
12
  const OAUTH2DEFAULTS = {
13
13
  accessType: void 0,
@@ -155,7 +155,7 @@ function addAuthorize(nuxt, strategy, useForms = false) {
155
155
  strategy.endpoints.token = endpoint;
156
156
  strategy.responseType = "code";
157
157
  addTemplate({
158
- filename: `authorize-${strategy.name}.ts`,
158
+ filename: `authorize-${strategy.name}.js`,
159
159
  write: true,
160
160
  getContents: () => authorizeGrant({
161
161
  strategy,
@@ -169,7 +169,7 @@ function addAuthorize(nuxt, strategy, useForms = false) {
169
169
  addServerHandler({
170
170
  route: endpoint,
171
171
  method: "post",
172
- handler: join(nuxt.options.buildDir, `authorize-${strategy.name}.ts`)
172
+ handler: join(nuxt.options.buildDir, `authorize-${strategy.name}.js`)
173
173
  });
174
174
  }
175
175
  function addLocalAuthorize(nuxt, strategy) {
@@ -179,7 +179,7 @@ function addLocalAuthorize(nuxt, strategy) {
179
179
  strategy.endpoints.login.url = endpoint;
180
180
  strategy.endpoints.refresh.url = endpoint;
181
181
  addTemplate({
182
- filename: `local-${strategy.name}.ts`,
182
+ filename: `local-${strategy.name}.js`,
183
183
  write: true,
184
184
  getContents: () => localAuthorizeGrant({
185
185
  strategy,
@@ -190,7 +190,7 @@ function addLocalAuthorize(nuxt, strategy) {
190
190
  addServerHandler({
191
191
  route: endpoint,
192
192
  method: "post",
193
- handler: join(nuxt.options.buildDir, `local-${strategy.name}.ts`)
193
+ handler: join(nuxt.options.buildDir, `local-${strategy.name}.js`)
194
194
  });
195
195
  }
196
196
  function initializePasswordGrantFlow(nuxt, strategy) {
@@ -202,7 +202,7 @@ function initializePasswordGrantFlow(nuxt, strategy) {
202
202
  strategy.endpoints.login.url = endpoint;
203
203
  strategy.endpoints.refresh.url = endpoint;
204
204
  addTemplate({
205
- filename: `password-${strategy.name}.ts`,
205
+ filename: `password-${strategy.name}.js`,
206
206
  write: true,
207
207
  getContents: () => passwordGrant({
208
208
  strategy,
@@ -214,7 +214,7 @@ function initializePasswordGrantFlow(nuxt, strategy) {
214
214
  addServerHandler({
215
215
  route: endpoint,
216
216
  method: "post",
217
- handler: join(nuxt.options.buildDir, `password-${strategy.name}.ts`)
217
+ handler: join(nuxt.options.buildDir, `password-${strategy.name}.js`)
218
218
  });
219
219
  }
220
220
  function assignAbsoluteEndpoints(strategy) {
@@ -241,9 +241,9 @@ function assignAbsoluteEndpoints(strategy) {
241
241
  function authorizeGrant(opt) {
242
242
  return `import { defineEventHandler, readBody, createError, getCookie } from 'h3'
243
243
  // @ts-expect-error: virtual file
244
- import { config } from '#nuxt-auth-options'
245
244
  import { serialize } from 'cookie-es'
246
245
 
246
+ const config = useRuntimeConfig().auth
247
247
  const options = ${serialize(opt, { space: 4 })}
248
248
 
249
249
  function addTokenPrefix(token, tokenType) {
@@ -318,7 +318,7 @@ export default defineEventHandler(async (event) => {
318
318
  headers
319
319
  })
320
320
 
321
- let cookies = event.node.res.getHeader('Set-Cookie') as string[] || [];
321
+ let cookies = event.node.res.getHeader('Set-Cookie') || [];
322
322
 
323
323
  cookies = Array.isArray(cookies) ? cookies : cookies ? [cookies] : [];
324
324
 
@@ -352,9 +352,9 @@ export default defineEventHandler(async (event) => {
352
352
  function localAuthorizeGrant(opt) {
353
353
  return `import { defineEventHandler, readBody, createError, getCookie, getRequestHeader } from 'h3'
354
354
  // @ts-expect-error: virtual file
355
- import { config } from '#nuxt-auth-options'
356
355
  import { serialize } from 'cookie-es'
357
356
 
357
+ const config = useRuntimeConfig().auth
358
358
  const options = ${serialize(opt, { space: 4 })}
359
359
 
360
360
  function addTokenPrefix(token, tokenType) {
@@ -425,7 +425,7 @@ export default defineEventHandler(async (event) => {
425
425
  })
426
426
  }
427
427
 
428
- let cookies = event.node.res.getHeader('Set-Cookie') as string[] || [];
428
+ let cookies = event.node.res.getHeader('Set-Cookie') || [];
429
429
 
430
430
  cookies = Array.isArray(cookies) ? cookies : cookies ? [cookies] : [];
431
431
 
@@ -15,7 +15,7 @@ export function addAuthorize(nuxt, strategy, useForms = false) {
15
15
  strategy.endpoints.token = endpoint;
16
16
  strategy.responseType = "code";
17
17
  addTemplate({
18
- filename: `authorize-${strategy.name}.ts`,
18
+ filename: `authorize-${strategy.name}.js`,
19
19
  write: true,
20
20
  getContents: () => authorizeGrant({
21
21
  strategy,
@@ -29,7 +29,7 @@ export function addAuthorize(nuxt, strategy, useForms = false) {
29
29
  addServerHandler({
30
30
  route: endpoint,
31
31
  method: "post",
32
- handler: join(nuxt.options.buildDir, `authorize-${strategy.name}.ts`)
32
+ handler: join(nuxt.options.buildDir, `authorize-${strategy.name}.js`)
33
33
  });
34
34
  }
35
35
  export function addLocalAuthorize(nuxt, strategy) {
@@ -39,7 +39,7 @@ export function addLocalAuthorize(nuxt, strategy) {
39
39
  strategy.endpoints.login.url = endpoint;
40
40
  strategy.endpoints.refresh.url = endpoint;
41
41
  addTemplate({
42
- filename: `local-${strategy.name}.ts`,
42
+ filename: `local-${strategy.name}.js`,
43
43
  write: true,
44
44
  getContents: () => localAuthorizeGrant({
45
45
  strategy,
@@ -50,7 +50,7 @@ export function addLocalAuthorize(nuxt, strategy) {
50
50
  addServerHandler({
51
51
  route: endpoint,
52
52
  method: "post",
53
- handler: join(nuxt.options.buildDir, `local-${strategy.name}.ts`)
53
+ handler: join(nuxt.options.buildDir, `local-${strategy.name}.js`)
54
54
  });
55
55
  }
56
56
  export function initializePasswordGrantFlow(nuxt, strategy) {
@@ -62,7 +62,7 @@ export function initializePasswordGrantFlow(nuxt, strategy) {
62
62
  strategy.endpoints.login.url = endpoint;
63
63
  strategy.endpoints.refresh.url = endpoint;
64
64
  addTemplate({
65
- filename: `password-${strategy.name}.ts`,
65
+ filename: `password-${strategy.name}.js`,
66
66
  write: true,
67
67
  getContents: () => passwordGrant({
68
68
  strategy,
@@ -74,7 +74,7 @@ export function initializePasswordGrantFlow(nuxt, strategy) {
74
74
  addServerHandler({
75
75
  route: endpoint,
76
76
  method: "post",
77
- handler: join(nuxt.options.buildDir, `password-${strategy.name}.ts`)
77
+ handler: join(nuxt.options.buildDir, `password-${strategy.name}.js`)
78
78
  });
79
79
  }
80
80
  export function assignAbsoluteEndpoints(strategy) {
@@ -101,9 +101,9 @@ export function assignAbsoluteEndpoints(strategy) {
101
101
  export function authorizeGrant(opt) {
102
102
  return `import { defineEventHandler, readBody, createError, getCookie } from 'h3'
103
103
  // @ts-expect-error: virtual file
104
- import { config } from '#nuxt-auth-options'
105
104
  import { serialize } from 'cookie-es'
106
105
 
106
+ const config = useRuntimeConfig().auth
107
107
  const options = ${serialize(opt, { space: 4 })}
108
108
 
109
109
  function addTokenPrefix(token, tokenType) {
@@ -178,7 +178,7 @@ export default defineEventHandler(async (event) => {
178
178
  headers
179
179
  })
180
180
 
181
- let cookies = event.node.res.getHeader('Set-Cookie') as string[] || [];
181
+ let cookies = event.node.res.getHeader('Set-Cookie') || [];
182
182
 
183
183
  cookies = Array.isArray(cookies) ? cookies : cookies ? [cookies] : [];
184
184
 
@@ -212,9 +212,9 @@ export default defineEventHandler(async (event) => {
212
212
  export function localAuthorizeGrant(opt) {
213
213
  return `import { defineEventHandler, readBody, createError, getCookie, getRequestHeader } from 'h3'
214
214
  // @ts-expect-error: virtual file
215
- import { config } from '#nuxt-auth-options'
216
215
  import { serialize } from 'cookie-es'
217
216
 
217
+ const config = useRuntimeConfig().auth
218
218
  const options = ${serialize(opt, { space: 4 })}
219
219
 
220
220
  function addTokenPrefix(token, tokenType) {
@@ -285,7 +285,7 @@ export default defineEventHandler(async (event) => {
285
285
  })
286
286
  }
287
287
 
288
- let cookies = event.node.res.getHeader('Set-Cookie') as string[] || [];
288
+ let cookies = event.node.res.getHeader('Set-Cookie') || [];
289
289
 
290
290
  cookies = Array.isArray(cookies) ? cookies : cookies ? [cookies] : [];
291
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-auther",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Authentication module for Nuxt.JS",
5
5
  "homepage": "https://github.com/zerosdev/nuxt-auther",
6
6
  "author": "zerosdev",