naystack 1.4.35 → 1.4.37

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.
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var email_exports = {};
22
22
  __export(email_exports, {
23
23
  checkAuthStatus: () => checkAuthStatus,
24
+ getContext: () => getContext,
24
25
  getEmailAuthRoutes: () => getEmailAuthRoutes
25
26
  });
26
27
  module.exports = __toCommonJS(email_exports);
@@ -309,5 +310,6 @@ function getEmailAuthRoutes(options) {
309
310
  // Annotate the CommonJS export names for ESM import in node:
310
311
  0 && (module.exports = {
311
312
  checkAuthStatus,
313
+ getContext,
312
314
  getEmailAuthRoutes
313
315
  });
@@ -1,7 +1,9 @@
1
1
  import * as next_server from 'next/server';
2
2
  import { InitRoutesOptions } from './types.mjs';
3
3
  export { checkAuthStatus } from './token.mjs';
4
+ export { getContext } from './utils.mjs';
4
5
  import '../types.mjs';
6
+ import '../../graphql/types.mjs';
5
7
 
6
8
  declare function getEmailAuthRoutes(options: InitRoutesOptions): {
7
9
  GET: (req: next_server.NextRequest) => Promise<next_server.NextResponse<{
@@ -1,7 +1,9 @@
1
1
  import * as next_server from 'next/server';
2
2
  import { InitRoutesOptions } from './types.js';
3
3
  export { checkAuthStatus } from './token.js';
4
+ export { getContext } from './utils.js';
4
5
  import '../types.js';
6
+ import '../../graphql/types.js';
5
7
 
6
8
  declare function getEmailAuthRoutes(options: InitRoutesOptions): {
7
9
  GET: (req: next_server.NextRequest) => Promise<next_server.NextResponse<{
@@ -281,5 +281,6 @@ function getEmailAuthRoutes(options) {
281
281
  }
282
282
  export {
283
283
  checkAuthStatus,
284
+ getContext,
284
285
  getEmailAuthRoutes
285
286
  };
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var auth_exports = {};
22
22
  __export(auth_exports, {
23
23
  checkAuthStatus: () => checkAuthStatus,
24
+ getContext: () => getContext,
24
25
  getEmailAuthRoutes: () => getEmailAuthRoutes,
25
26
  getRefreshToken: () => getRefreshToken,
26
27
  initGoogleAuth: () => initGoogleAuth,
@@ -522,6 +523,7 @@ async function getRefreshToken() {
522
523
  // Annotate the CommonJS export names for ESM import in node:
523
524
  0 && (module.exports = {
524
525
  checkAuthStatus,
526
+ getContext,
525
527
  getEmailAuthRoutes,
526
528
  getRefreshToken,
527
529
  initGoogleAuth,
@@ -3,9 +3,11 @@ export { initGoogleAuth } from './google/index.mjs';
3
3
  export { initInstagramAuth } from './instagram/index.mjs';
4
4
  export { getRefreshToken } from './utils/token.mjs';
5
5
  export { checkAuthStatus } from './email/token.mjs';
6
+ export { getContext } from './email/utils.mjs';
6
7
  import 'next/server';
7
8
  import './email/types.mjs';
8
9
  import './types.mjs';
9
10
  import 'googleapis';
10
11
  import './instagram/utils.mjs';
11
12
  import '../socials/instagram/types.mjs';
13
+ import '../graphql/types.mjs';
@@ -3,9 +3,11 @@ export { initGoogleAuth } from './google/index.js';
3
3
  export { initInstagramAuth } from './instagram/index.js';
4
4
  export { getRefreshToken } from './utils/token.js';
5
5
  export { checkAuthStatus } from './email/token.js';
6
+ export { getContext } from './email/utils.js';
6
7
  import 'next/server';
7
8
  import './email/types.js';
8
9
  import './types.js';
9
10
  import 'googleapis';
10
11
  import './instagram/utils.js';
11
12
  import '../socials/instagram/types.js';
13
+ import '../graphql/types.js';
@@ -491,6 +491,7 @@ async function getRefreshToken() {
491
491
  }
492
492
  export {
493
493
  checkAuthStatus,
494
+ getContext,
494
495
  getEmailAuthRoutes,
495
496
  getRefreshToken,
496
497
  initGoogleAuth,
@@ -682,7 +682,8 @@ var getContext = (req) => {
682
682
  async function initGraphQLServer({
683
683
  authChecker,
684
684
  resolvers,
685
- plugins
685
+ plugins,
686
+ getContext: overrideGetContext
686
687
  }) {
687
688
  const { typeDefs, resolvers: builtResolvers } = await (0, import_type_graphql.buildTypeDefsAndResolvers)({
688
689
  validate: true,
@@ -706,7 +707,7 @@ async function initGraphQLServer({
706
707
  status400ForVariableCoercionErrors: true
707
708
  });
708
709
  const handler = (0, import_next.startServerAndCreateNextHandler)(server, {
709
- context: getContext
710
+ context: overrideGetContext || getContext
710
711
  });
711
712
  return {
712
713
  GET: (request) => handler(request),
@@ -669,7 +669,8 @@ var getContext = (req) => {
669
669
  async function initGraphQLServer({
670
670
  authChecker,
671
671
  resolvers,
672
- plugins
672
+ plugins,
673
+ getContext: overrideGetContext
673
674
  }) {
674
675
  const { typeDefs, resolvers: builtResolvers } = await buildTypeDefsAndResolvers({
675
676
  validate: true,
@@ -693,7 +694,7 @@ async function initGraphQLServer({
693
694
  status400ForVariableCoercionErrors: true
694
695
  });
695
696
  const handler = startServerAndCreateNextHandler(server, {
696
- context: getContext
697
+ context: overrideGetContext || getContext
697
698
  });
698
699
  return {
699
700
  GET: (request) => handler(request),
@@ -135,7 +135,8 @@ var getContext = (req) => {
135
135
  async function initGraphQLServer({
136
136
  authChecker,
137
137
  resolvers,
138
- plugins
138
+ plugins,
139
+ getContext: overrideGetContext
139
140
  }) {
140
141
  const { typeDefs, resolvers: builtResolvers } = await (0, import_type_graphql.buildTypeDefsAndResolvers)({
141
142
  validate: true,
@@ -159,7 +160,7 @@ async function initGraphQLServer({
159
160
  status400ForVariableCoercionErrors: true
160
161
  });
161
162
  const handler = (0, import_next.startServerAndCreateNextHandler)(server, {
162
- context: getContext
163
+ context: overrideGetContext || getContext
163
164
  });
164
165
  return {
165
166
  GET: (request) => handler(request),
@@ -2,10 +2,11 @@ import { ApolloServerPlugin } from '@apollo/server';
2
2
  import { NextRequest } from 'next/server';
3
3
  import { AuthChecker, NonEmptyArray } from 'type-graphql';
4
4
 
5
- declare function initGraphQLServer({ authChecker, resolvers, plugins, }: {
5
+ declare function initGraphQLServer({ authChecker, resolvers, plugins, getContext: overrideGetContext, }: {
6
6
  authChecker?: AuthChecker<any>;
7
7
  resolvers: NonEmptyArray<Function>;
8
8
  plugins?: ApolloServerPlugin[];
9
+ getContext?: (req: NextRequest) => Promise<any> | any;
9
10
  }): Promise<{
10
11
  GET: (request: NextRequest) => Promise<Response>;
11
12
  POST: (request: NextRequest) => Promise<Response>;
@@ -2,10 +2,11 @@ import { ApolloServerPlugin } from '@apollo/server';
2
2
  import { NextRequest } from 'next/server';
3
3
  import { AuthChecker, NonEmptyArray } from 'type-graphql';
4
4
 
5
- declare function initGraphQLServer({ authChecker, resolvers, plugins, }: {
5
+ declare function initGraphQLServer({ authChecker, resolvers, plugins, getContext: overrideGetContext, }: {
6
6
  authChecker?: AuthChecker<any>;
7
7
  resolvers: NonEmptyArray<Function>;
8
8
  plugins?: ApolloServerPlugin[];
9
+ getContext?: (req: NextRequest) => Promise<any> | any;
9
10
  }): Promise<{
10
11
  GET: (request: NextRequest) => Promise<Response>;
11
12
  POST: (request: NextRequest) => Promise<Response>;
@@ -116,7 +116,8 @@ var getContext = (req) => {
116
116
  async function initGraphQLServer({
117
117
  authChecker,
118
118
  resolvers,
119
- plugins
119
+ plugins,
120
+ getContext: overrideGetContext
120
121
  }) {
121
122
  const { typeDefs, resolvers: builtResolvers } = await buildTypeDefsAndResolvers({
122
123
  validate: true,
@@ -140,7 +141,7 @@ async function initGraphQLServer({
140
141
  status400ForVariableCoercionErrors: true
141
142
  });
142
143
  const handler = startServerAndCreateNextHandler(server, {
143
- context: getContext
144
+ context: overrideGetContext || getContext
144
145
  });
145
146
  return {
146
147
  GET: (request) => handler(request),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.4.35",
3
+ "version": "1.4.37",
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",