naystack 1.5.11 → 1.5.12

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.
@@ -24,6 +24,7 @@ __export(auth_exports, {
24
24
  getContext: () => getContext,
25
25
  getEmailAuthRoutes: () => getEmailAuthRoutes,
26
26
  getRefreshToken: () => getRefreshToken,
27
+ getRefreshedInstagramAccessToken: () => getRefreshedInstagramAccessToken,
27
28
  initGoogleAuth: () => initGoogleAuth,
28
29
  initInstagramAuth: () => initInstagramAuth
29
30
  });
@@ -411,7 +412,7 @@ function initGoogleAuth(props) {
411
412
  var import_server5 = require("next/server");
412
413
 
413
414
  // src/auth/instagram/utils.ts
414
- async function getRefreshedAccessToken(token) {
415
+ async function getRefreshedInstagramAccessToken(token) {
415
416
  const request = await fetch(
416
417
  `https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=${token}`
417
418
  );
@@ -474,7 +475,7 @@ var import_server4 = require("next/server");
474
475
 
475
476
  // src/auth/instagram/route.ts
476
477
  var getInstagramRoute = ({
477
- successRedirectURL,
478
+ redirectURL,
478
479
  errorRedirectURL,
479
480
  onUser
480
481
  }) => {
@@ -502,15 +503,14 @@ var getInstagramRoute = ({
502
503
  instagramData.accessToken
503
504
  );
504
505
  if (errorMessage) return handleError2(errorMessage);
505
- return import_server5.NextResponse.redirect(successRedirectURL);
506
+ return import_server5.NextResponse.redirect(redirectURL);
506
507
  };
507
508
  };
508
509
 
509
510
  // src/auth/instagram/index.ts
510
511
  function initInstagramAuth(props) {
511
512
  return {
512
- GET: getInstagramRoute(props),
513
- getRefreshedAccessToken
513
+ GET: getInstagramRoute(props)
514
514
  };
515
515
  }
516
516
 
@@ -526,6 +526,7 @@ async function getRefreshToken() {
526
526
  getContext,
527
527
  getEmailAuthRoutes,
528
528
  getRefreshToken,
529
+ getRefreshedInstagramAccessToken,
529
530
  initGoogleAuth,
530
531
  initInstagramAuth
531
532
  });
@@ -4,10 +4,10 @@ export { initInstagramAuth } from './instagram/index.mjs';
4
4
  export { getRefreshToken } from './utils/token.mjs';
5
5
  export { checkAuthStatus } from './email/token.mjs';
6
6
  export { getContext } from './email/utils.mjs';
7
+ export { getRefreshedInstagramAccessToken } from './instagram/utils.mjs';
7
8
  import 'next/server';
8
9
  import './email/types.mjs';
9
10
  import './types.mjs';
10
11
  import 'googleapis';
11
- import './instagram/utils.mjs';
12
12
  import '../socials/instagram/types.mjs';
13
13
  import '../graphql/types.mjs';
@@ -4,10 +4,10 @@ export { initInstagramAuth } from './instagram/index.js';
4
4
  export { getRefreshToken } from './utils/token.js';
5
5
  export { checkAuthStatus } from './email/token.js';
6
6
  export { getContext } from './email/utils.js';
7
+ export { getRefreshedInstagramAccessToken } from './instagram/utils.js';
7
8
  import 'next/server';
8
9
  import './email/types.js';
9
10
  import './types.js';
10
11
  import 'googleapis';
11
- import './instagram/utils.js';
12
12
  import '../socials/instagram/types.js';
13
13
  import '../graphql/types.js';
@@ -380,7 +380,7 @@ function initGoogleAuth(props) {
380
380
  import { NextResponse as NextResponse5 } from "next/server";
381
381
 
382
382
  // src/auth/instagram/utils.ts
383
- async function getRefreshedAccessToken(token) {
383
+ async function getRefreshedInstagramAccessToken(token) {
384
384
  const request = await fetch(
385
385
  `https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=${token}`
386
386
  );
@@ -443,7 +443,7 @@ import { NextResponse as NextResponse4 } from "next/server";
443
443
 
444
444
  // src/auth/instagram/route.ts
445
445
  var getInstagramRoute = ({
446
- successRedirectURL,
446
+ redirectURL,
447
447
  errorRedirectURL,
448
448
  onUser
449
449
  }) => {
@@ -471,15 +471,14 @@ var getInstagramRoute = ({
471
471
  instagramData.accessToken
472
472
  );
473
473
  if (errorMessage) return handleError2(errorMessage);
474
- return NextResponse5.redirect(successRedirectURL);
474
+ return NextResponse5.redirect(redirectURL);
475
475
  };
476
476
  };
477
477
 
478
478
  // src/auth/instagram/index.ts
479
479
  function initInstagramAuth(props) {
480
480
  return {
481
- GET: getInstagramRoute(props),
482
- getRefreshedAccessToken
481
+ GET: getInstagramRoute(props)
483
482
  };
484
483
  }
485
484
 
@@ -494,6 +493,7 @@ export {
494
493
  getContext,
495
494
  getEmailAuthRoutes,
496
495
  getRefreshToken,
496
+ getRefreshedInstagramAccessToken,
497
497
  initGoogleAuth,
498
498
  initInstagramAuth
499
499
  };
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/auth/instagram/index.ts
21
21
  var instagram_exports = {};
22
22
  __export(instagram_exports, {
23
+ getRefreshedInstagramAccessToken: () => getRefreshedInstagramAccessToken,
23
24
  initInstagramAuth: () => initInstagramAuth
24
25
  });
25
26
  module.exports = __toCommonJS(instagram_exports);
@@ -98,7 +99,7 @@ function getUserIdFromAccessToken(refreshToken) {
98
99
  }
99
100
 
100
101
  // src/auth/instagram/utils.ts
101
- async function getRefreshedAccessToken(token) {
102
+ async function getRefreshedInstagramAccessToken(token) {
102
103
  const request = await fetch(
103
104
  `https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=${token}`
104
105
  );
@@ -161,7 +162,7 @@ var import_server2 = require("next/server");
161
162
 
162
163
  // src/auth/instagram/route.ts
163
164
  var getInstagramRoute = ({
164
- successRedirectURL,
165
+ redirectURL,
165
166
  errorRedirectURL,
166
167
  onUser
167
168
  }) => {
@@ -189,18 +190,18 @@ var getInstagramRoute = ({
189
190
  instagramData.accessToken
190
191
  );
191
192
  if (errorMessage) return handleError(errorMessage);
192
- return import_server3.NextResponse.redirect(successRedirectURL);
193
+ return import_server3.NextResponse.redirect(redirectURL);
193
194
  };
194
195
  };
195
196
 
196
197
  // src/auth/instagram/index.ts
197
198
  function initInstagramAuth(props) {
198
199
  return {
199
- GET: getInstagramRoute(props),
200
- getRefreshedAccessToken
200
+ GET: getInstagramRoute(props)
201
201
  };
202
202
  }
203
203
  // Annotate the CommonJS export names for ESM import in node:
204
204
  0 && (module.exports = {
205
+ getRefreshedInstagramAccessToken,
205
206
  initInstagramAuth
206
207
  });
@@ -1,22 +1,20 @@
1
1
  import * as next_server from 'next/server';
2
- import { getRefreshedAccessToken } from './utils.mjs';
2
+ export { getRefreshedInstagramAccessToken } from './utils.mjs';
3
3
  import { InstagramUser } from '../../socials/instagram/types.mjs';
4
4
 
5
5
  /**
6
6
  * Options for initializing Instagram OAuth via {@link initInstagramAuth}.
7
7
  *
8
8
  * @property onUser - Called with `(instagramUser, appUserId, accessToken)` after successful OAuth. Return a string to show as error (redirects to `errorRedirectURL`); return `void` on success.
9
- * @property successRedirectURL - Where to redirect after successful Instagram auth.
9
+ * @property redirectURL - Where to redirect after successful Instagram auth.
10
10
  * @property errorRedirectURL - Where to redirect on error (with `?error=` query param).
11
- * @property refreshKey - Your app secret (e.g. `REFRESH_KEY` env var) used in the flow.
12
11
  *
13
12
  * @category Auth
14
13
  */
15
14
  interface InitInstagramAuthOptions {
16
15
  onUser: (data: InstagramUser, id: number | null, accessToken: string) => Promise<string | void>;
17
- successRedirectURL: string;
16
+ redirectURL: string;
18
17
  errorRedirectURL: string;
19
- refreshKey: string;
20
18
  }
21
19
  /**
22
20
  * Initializes Instagram OAuth. Returns a GET handler for the OAuth callback and a helper to refresh long-lived tokens.
@@ -47,7 +45,6 @@ interface InitInstagramAuthOptions {
47
45
  */
48
46
  declare function initInstagramAuth(props: InitInstagramAuthOptions): {
49
47
  GET: (req: next_server.NextRequest) => Promise<next_server.NextResponse<unknown>>;
50
- getRefreshedAccessToken: typeof getRefreshedAccessToken;
51
48
  };
52
49
 
53
50
  export { type InitInstagramAuthOptions, initInstagramAuth };
@@ -1,22 +1,20 @@
1
1
  import * as next_server from 'next/server';
2
- import { getRefreshedAccessToken } from './utils.js';
2
+ export { getRefreshedInstagramAccessToken } from './utils.js';
3
3
  import { InstagramUser } from '../../socials/instagram/types.js';
4
4
 
5
5
  /**
6
6
  * Options for initializing Instagram OAuth via {@link initInstagramAuth}.
7
7
  *
8
8
  * @property onUser - Called with `(instagramUser, appUserId, accessToken)` after successful OAuth. Return a string to show as error (redirects to `errorRedirectURL`); return `void` on success.
9
- * @property successRedirectURL - Where to redirect after successful Instagram auth.
9
+ * @property redirectURL - Where to redirect after successful Instagram auth.
10
10
  * @property errorRedirectURL - Where to redirect on error (with `?error=` query param).
11
- * @property refreshKey - Your app secret (e.g. `REFRESH_KEY` env var) used in the flow.
12
11
  *
13
12
  * @category Auth
14
13
  */
15
14
  interface InitInstagramAuthOptions {
16
15
  onUser: (data: InstagramUser, id: number | null, accessToken: string) => Promise<string | void>;
17
- successRedirectURL: string;
16
+ redirectURL: string;
18
17
  errorRedirectURL: string;
19
- refreshKey: string;
20
18
  }
21
19
  /**
22
20
  * Initializes Instagram OAuth. Returns a GET handler for the OAuth callback and a helper to refresh long-lived tokens.
@@ -47,7 +45,6 @@ interface InitInstagramAuthOptions {
47
45
  */
48
46
  declare function initInstagramAuth(props: InitInstagramAuthOptions): {
49
47
  GET: (req: next_server.NextRequest) => Promise<next_server.NextResponse<unknown>>;
50
- getRefreshedAccessToken: typeof getRefreshedAccessToken;
51
48
  };
52
49
 
53
50
  export { type InitInstagramAuthOptions, initInstagramAuth };
@@ -72,7 +72,7 @@ function getUserIdFromAccessToken(refreshToken) {
72
72
  }
73
73
 
74
74
  // src/auth/instagram/utils.ts
75
- async function getRefreshedAccessToken(token) {
75
+ async function getRefreshedInstagramAccessToken(token) {
76
76
  const request = await fetch(
77
77
  `https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=${token}`
78
78
  );
@@ -135,7 +135,7 @@ import { NextResponse as NextResponse2 } from "next/server";
135
135
 
136
136
  // src/auth/instagram/route.ts
137
137
  var getInstagramRoute = ({
138
- successRedirectURL,
138
+ redirectURL,
139
139
  errorRedirectURL,
140
140
  onUser
141
141
  }) => {
@@ -163,17 +163,17 @@ var getInstagramRoute = ({
163
163
  instagramData.accessToken
164
164
  );
165
165
  if (errorMessage) return handleError(errorMessage);
166
- return NextResponse3.redirect(successRedirectURL);
166
+ return NextResponse3.redirect(redirectURL);
167
167
  };
168
168
  };
169
169
 
170
170
  // src/auth/instagram/index.ts
171
171
  function initInstagramAuth(props) {
172
172
  return {
173
- GET: getInstagramRoute(props),
174
- getRefreshedAccessToken
173
+ GET: getInstagramRoute(props)
175
174
  };
176
175
  }
177
176
  export {
177
+ getRefreshedInstagramAccessToken,
178
178
  initInstagramAuth
179
179
  };
@@ -152,7 +152,7 @@ var import_server2 = require("next/server");
152
152
 
153
153
  // src/auth/instagram/route.ts
154
154
  var getInstagramRoute = ({
155
- successRedirectURL,
155
+ redirectURL,
156
156
  errorRedirectURL,
157
157
  onUser
158
158
  }) => {
@@ -180,7 +180,7 @@ var getInstagramRoute = ({
180
180
  instagramData.accessToken
181
181
  );
182
182
  if (errorMessage) return handleError(errorMessage);
183
- return import_server3.NextResponse.redirect(successRedirectURL);
183
+ return import_server3.NextResponse.redirect(redirectURL);
184
184
  };
185
185
  };
186
186
  // Annotate the CommonJS export names for ESM import in node:
@@ -8,6 +8,6 @@ import '../../socials/instagram/types.mjs';
8
8
  * @param options - InitInstagramAuthOptions (onUser, redirect URLs)
9
9
  * @returns Async route handler for the OAuth callback
10
10
  */
11
- declare const getInstagramRoute: ({ successRedirectURL, errorRedirectURL, onUser, }: InitInstagramAuthOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
11
+ declare const getInstagramRoute: ({ redirectURL, errorRedirectURL, onUser, }: InitInstagramAuthOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
12
12
 
13
13
  export { getInstagramRoute };
@@ -8,6 +8,6 @@ import '../../socials/instagram/types.js';
8
8
  * @param options - InitInstagramAuthOptions (onUser, redirect URLs)
9
9
  * @returns Async route handler for the OAuth callback
10
10
  */
11
- declare const getInstagramRoute: ({ successRedirectURL, errorRedirectURL, onUser, }: InitInstagramAuthOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
11
+ declare const getInstagramRoute: ({ redirectURL, errorRedirectURL, onUser, }: InitInstagramAuthOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
12
12
 
13
13
  export { getInstagramRoute };
@@ -128,7 +128,7 @@ import { NextResponse as NextResponse2 } from "next/server";
128
128
 
129
129
  // src/auth/instagram/route.ts
130
130
  var getInstagramRoute = ({
131
- successRedirectURL,
131
+ redirectURL,
132
132
  errorRedirectURL,
133
133
  onUser
134
134
  }) => {
@@ -156,7 +156,7 @@ var getInstagramRoute = ({
156
156
  instagramData.accessToken
157
157
  );
158
158
  if (errorMessage) return handleError(errorMessage);
159
- return NextResponse3.redirect(successRedirectURL);
159
+ return NextResponse3.redirect(redirectURL);
160
160
  };
161
161
  };
162
162
  export {
@@ -21,7 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var utils_exports = {};
22
22
  __export(utils_exports, {
23
23
  getLongLivedToken: () => getLongLivedToken,
24
- getRefreshedAccessToken: () => getRefreshedAccessToken
24
+ getRefreshedInstagramAccessToken: () => getRefreshedInstagramAccessToken
25
25
  });
26
26
  module.exports = __toCommonJS(utils_exports);
27
27
 
@@ -75,7 +75,7 @@ function getEnv(key, skipCheck) {
75
75
  }
76
76
 
77
77
  // src/auth/instagram/utils.ts
78
- async function getRefreshedAccessToken(token) {
78
+ async function getRefreshedInstagramAccessToken(token) {
79
79
  const request = await fetch(
80
80
  `https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=${token}`
81
81
  );
@@ -113,5 +113,5 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
113
113
  // Annotate the CommonJS export names for ESM import in node:
114
114
  0 && (module.exports = {
115
115
  getLongLivedToken,
116
- getRefreshedAccessToken
116
+ getRefreshedInstagramAccessToken
117
117
  });
@@ -3,7 +3,7 @@
3
3
  * @param token - Current long-lived access token
4
4
  * @returns New access token or undefined
5
5
  */
6
- declare function getRefreshedAccessToken(token: string): Promise<string | undefined>;
6
+ declare function getRefreshedInstagramAccessToken(token: string): Promise<string | undefined>;
7
7
  /**
8
8
  * Exchanges an OAuth code for a long-lived Instagram access token.
9
9
  * @param code - OAuth authorization code from redirect
@@ -17,4 +17,4 @@ declare function getLongLivedToken(code: string, redirectURL: string, clientId:
17
17
  userId: string;
18
18
  } | undefined>;
19
19
 
20
- export { getLongLivedToken, getRefreshedAccessToken };
20
+ export { getLongLivedToken, getRefreshedInstagramAccessToken };
@@ -3,7 +3,7 @@
3
3
  * @param token - Current long-lived access token
4
4
  * @returns New access token or undefined
5
5
  */
6
- declare function getRefreshedAccessToken(token: string): Promise<string | undefined>;
6
+ declare function getRefreshedInstagramAccessToken(token: string): Promise<string | undefined>;
7
7
  /**
8
8
  * Exchanges an OAuth code for a long-lived Instagram access token.
9
9
  * @param code - OAuth authorization code from redirect
@@ -17,4 +17,4 @@ declare function getLongLivedToken(code: string, redirectURL: string, clientId:
17
17
  userId: string;
18
18
  } | undefined>;
19
19
 
20
- export { getLongLivedToken, getRefreshedAccessToken };
20
+ export { getLongLivedToken, getRefreshedInstagramAccessToken };
@@ -48,7 +48,7 @@ function getEnv(key, skipCheck) {
48
48
  }
49
49
 
50
50
  // src/auth/instagram/utils.ts
51
- async function getRefreshedAccessToken(token) {
51
+ async function getRefreshedInstagramAccessToken(token) {
52
52
  const request = await fetch(
53
53
  `https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=${token}`
54
54
  );
@@ -85,5 +85,5 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
85
85
  }
86
86
  export {
87
87
  getLongLivedToken,
88
- getRefreshedAccessToken
88
+ getRefreshedInstagramAccessToken
89
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.5.11",
3
+ "version": "1.5.12",
4
4
  "description": "A stack built with Next + GraphQL + S3 + Auth",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",