naystack 1.2.17 → 1.2.20

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.
@@ -20,18 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/file/utils.ts
21
21
  var utils_exports = {};
22
22
  __export(utils_exports, {
23
- deleteImage: () => deleteImage,
24
- getFileURL: () => getFileURL,
23
+ deleteFile: () => deleteFile,
24
+ getDownloadURL: () => getDownloadURL,
25
25
  getS3Client: () => getS3Client,
26
- getUploadFileURL: () => getUploadFileURL,
27
- uploadFile: () => uploadFile,
28
- uploadImage: () => uploadImage
26
+ getUploadURL: () => getUploadURL,
27
+ uploadBlob: () => uploadBlob,
28
+ uploadFile: () => uploadFile
29
29
  });
30
30
  module.exports = __toCommonJS(utils_exports);
31
- var import_node_crypto = require("crypto");
32
31
  var import_client_s3 = require("@aws-sdk/client-s3");
33
32
  var import_s3_request_presigner = require("@aws-sdk/s3-request-presigner");
34
- var import_functions = require("@vercel/functions");
35
33
  var getS3Client = (options) => new import_client_s3.S3Client({
36
34
  region: options.region,
37
35
  credentials: {
@@ -40,30 +38,34 @@ var getS3Client = (options) => new import_client_s3.S3Client({
40
38
  }
41
39
  });
42
40
  var getURLPrefix = (options) => `https://${options.bucket}.s3.${options.region}.amazonaws.com/`;
43
- function getHash(keys) {
44
- return (0, import_node_crypto.createHash)("sha256").update(keys.join("/")).digest("hex");
41
+ function getKey(keys) {
42
+ return typeof keys === "string" ? keys : keys.join("/");
45
43
  }
46
- var getUploadFileURL = (client, Bucket) => (keys, isPublic) => {
44
+ var getUploadURL = (client, Bucket) => (keys) => {
47
45
  const command = new import_client_s3.PutObjectCommand({
48
46
  Bucket,
49
- Key: getHash(keys),
50
- ACL: isPublic ? "public-read" : void 0
47
+ Key: getKey(keys),
48
+ ACL: "public-read"
51
49
  });
52
50
  return (0, import_s3_request_presigner.getSignedUrl)(client, command, { expiresIn: 300 });
53
51
  };
54
- var getFileURL = (options) => (keys) => {
55
- if (typeof keys === "string") return `${getURLPrefix(options)}${keys}`;
56
- return `${getURLPrefix(options)}${getHash(keys)}`;
52
+ var getDownloadURL = (options) => (keys) => {
53
+ return `${getURLPrefix(options)}${getKey(keys)}`;
57
54
  };
58
- var uploadImage = (client, options) => async (url, key, blob) => {
59
- const photoBlob = blob || await fetch(url).then((file) => file.blob());
60
- if (photoBlob) {
61
- (0, import_functions.waitUntil)(uploadFile(client, options.bucket)(photoBlob, getHash(key)));
62
- return getFileURL(options)(key);
55
+ var uploadFile = (client, options) => async (keys, {
56
+ url,
57
+ blob
58
+ }) => {
59
+ if (!blob && !url) return null;
60
+ const fileBlob = blob || await fetch(url).then((file) => file.blob());
61
+ if (fileBlob) {
62
+ const key = getKey(keys);
63
+ await uploadBlob(client, options.bucket)(fileBlob, key);
64
+ return getDownloadURL(options)(key);
63
65
  }
64
66
  return null;
65
67
  };
66
- var deleteImage = (client, options) => async (url) => {
68
+ var deleteFile = (client, options) => async (url) => {
67
69
  const key = url.split(getURLPrefix(options))[1];
68
70
  if (key) {
69
71
  try {
@@ -80,7 +82,7 @@ var deleteImage = (client, options) => async (url) => {
80
82
  }
81
83
  return false;
82
84
  };
83
- var uploadFile = (client, Bucket) => async (file, key) => {
85
+ var uploadBlob = (client, Bucket) => async (file, key) => {
84
86
  const fileBuffer = await file.arrayBuffer();
85
87
  return client.send(
86
88
  new import_client_s3.PutObjectCommand({
@@ -95,10 +97,10 @@ var uploadFile = (client, Bucket) => async (file, key) => {
95
97
  };
96
98
  // Annotate the CommonJS export names for ESM import in node:
97
99
  0 && (module.exports = {
98
- deleteImage,
99
- getFileURL,
100
+ deleteFile,
101
+ getDownloadURL,
100
102
  getS3Client,
101
- getUploadFileURL,
102
- uploadFile,
103
- uploadImage
103
+ getUploadURL,
104
+ uploadBlob,
105
+ uploadFile
104
106
  });
@@ -4,10 +4,13 @@ import { SetupFileUploadOptions } from './setup.mjs';
4
4
  import 'next/server';
5
5
 
6
6
  declare const getS3Client: (options: SetupFileUploadOptions) => S3Client;
7
- declare const getUploadFileURL: (client: S3Client, Bucket: string) => (keys: string[], isPublic?: boolean) => Promise<string>;
8
- declare const getFileURL: (options: SetupFileUploadOptions) => (keys: string | string[]) => string;
9
- declare const uploadImage: (client: S3Client, options: SetupFileUploadOptions) => (url: string, key: string[], blob?: Blob) => Promise<string | null>;
10
- declare const deleteImage: (client: S3Client, options: SetupFileUploadOptions) => (url: string) => Promise<boolean>;
11
- declare const uploadFile: (client: S3Client, Bucket: string) => (file: File | Blob, key: string) => Promise<_aws_sdk_client_s3.PutObjectCommandOutput>;
7
+ declare const getUploadURL: (client: S3Client, Bucket: string) => (keys: string | string[]) => Promise<string>;
8
+ declare const getDownloadURL: (options: SetupFileUploadOptions) => (keys: string | string[]) => string;
9
+ declare const uploadFile: (client: S3Client, options: SetupFileUploadOptions) => (keys: string | string[], { url, blob, }: {
10
+ blob?: Blob;
11
+ url?: string;
12
+ }) => Promise<string | null>;
13
+ declare const deleteFile: (client: S3Client, options: SetupFileUploadOptions) => (url: string) => Promise<boolean>;
14
+ declare const uploadBlob: (client: S3Client, Bucket: string) => (file: File | Blob, key: string) => Promise<_aws_sdk_client_s3.PutObjectCommandOutput>;
12
15
 
13
- export { deleteImage, getFileURL, getS3Client, getUploadFileURL, uploadFile, uploadImage };
16
+ export { deleteFile, getDownloadURL, getS3Client, getUploadURL, uploadBlob, uploadFile };
@@ -4,10 +4,13 @@ import { SetupFileUploadOptions } from './setup.js';
4
4
  import 'next/server';
5
5
 
6
6
  declare const getS3Client: (options: SetupFileUploadOptions) => S3Client;
7
- declare const getUploadFileURL: (client: S3Client, Bucket: string) => (keys: string[], isPublic?: boolean) => Promise<string>;
8
- declare const getFileURL: (options: SetupFileUploadOptions) => (keys: string | string[]) => string;
9
- declare const uploadImage: (client: S3Client, options: SetupFileUploadOptions) => (url: string, key: string[], blob?: Blob) => Promise<string | null>;
10
- declare const deleteImage: (client: S3Client, options: SetupFileUploadOptions) => (url: string) => Promise<boolean>;
11
- declare const uploadFile: (client: S3Client, Bucket: string) => (file: File | Blob, key: string) => Promise<_aws_sdk_client_s3.PutObjectCommandOutput>;
7
+ declare const getUploadURL: (client: S3Client, Bucket: string) => (keys: string | string[]) => Promise<string>;
8
+ declare const getDownloadURL: (options: SetupFileUploadOptions) => (keys: string | string[]) => string;
9
+ declare const uploadFile: (client: S3Client, options: SetupFileUploadOptions) => (keys: string | string[], { url, blob, }: {
10
+ blob?: Blob;
11
+ url?: string;
12
+ }) => Promise<string | null>;
13
+ declare const deleteFile: (client: S3Client, options: SetupFileUploadOptions) => (url: string) => Promise<boolean>;
14
+ declare const uploadBlob: (client: S3Client, Bucket: string) => (file: File | Blob, key: string) => Promise<_aws_sdk_client_s3.PutObjectCommandOutput>;
12
15
 
13
- export { deleteImage, getFileURL, getS3Client, getUploadFileURL, uploadFile, uploadImage };
16
+ export { deleteFile, getDownloadURL, getS3Client, getUploadURL, uploadBlob, uploadFile };
@@ -1,12 +1,10 @@
1
1
  // src/file/utils.ts
2
- import { createHash } from "crypto";
3
2
  import {
4
3
  DeleteObjectCommand,
5
4
  PutObjectCommand,
6
5
  S3Client
7
6
  } from "@aws-sdk/client-s3";
8
7
  import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
9
- import { waitUntil } from "@vercel/functions";
10
8
  var getS3Client = (options) => new S3Client({
11
9
  region: options.region,
12
10
  credentials: {
@@ -15,30 +13,34 @@ var getS3Client = (options) => new S3Client({
15
13
  }
16
14
  });
17
15
  var getURLPrefix = (options) => `https://${options.bucket}.s3.${options.region}.amazonaws.com/`;
18
- function getHash(keys) {
19
- return createHash("sha256").update(keys.join("/")).digest("hex");
16
+ function getKey(keys) {
17
+ return typeof keys === "string" ? keys : keys.join("/");
20
18
  }
21
- var getUploadFileURL = (client, Bucket) => (keys, isPublic) => {
19
+ var getUploadURL = (client, Bucket) => (keys) => {
22
20
  const command = new PutObjectCommand({
23
21
  Bucket,
24
- Key: getHash(keys),
25
- ACL: isPublic ? "public-read" : void 0
22
+ Key: getKey(keys),
23
+ ACL: "public-read"
26
24
  });
27
25
  return getSignedUrl(client, command, { expiresIn: 300 });
28
26
  };
29
- var getFileURL = (options) => (keys) => {
30
- if (typeof keys === "string") return `${getURLPrefix(options)}${keys}`;
31
- return `${getURLPrefix(options)}${getHash(keys)}`;
27
+ var getDownloadURL = (options) => (keys) => {
28
+ return `${getURLPrefix(options)}${getKey(keys)}`;
32
29
  };
33
- var uploadImage = (client, options) => async (url, key, blob) => {
34
- const photoBlob = blob || await fetch(url).then((file) => file.blob());
35
- if (photoBlob) {
36
- waitUntil(uploadFile(client, options.bucket)(photoBlob, getHash(key)));
37
- return getFileURL(options)(key);
30
+ var uploadFile = (client, options) => async (keys, {
31
+ url,
32
+ blob
33
+ }) => {
34
+ if (!blob && !url) return null;
35
+ const fileBlob = blob || await fetch(url).then((file) => file.blob());
36
+ if (fileBlob) {
37
+ const key = getKey(keys);
38
+ await uploadBlob(client, options.bucket)(fileBlob, key);
39
+ return getDownloadURL(options)(key);
38
40
  }
39
41
  return null;
40
42
  };
41
- var deleteImage = (client, options) => async (url) => {
43
+ var deleteFile = (client, options) => async (url) => {
42
44
  const key = url.split(getURLPrefix(options))[1];
43
45
  if (key) {
44
46
  try {
@@ -55,7 +57,7 @@ var deleteImage = (client, options) => async (url) => {
55
57
  }
56
58
  return false;
57
59
  };
58
- var uploadFile = (client, Bucket) => async (file, key) => {
60
+ var uploadBlob = (client, Bucket) => async (file, key) => {
59
61
  const fileBuffer = await file.arrayBuffer();
60
62
  return client.send(
61
63
  new PutObjectCommand({
@@ -69,10 +71,10 @@ var uploadFile = (client, Bucket) => async (file, key) => {
69
71
  );
70
72
  };
71
73
  export {
72
- deleteImage,
73
- getFileURL,
74
+ deleteFile,
75
+ getDownloadURL,
74
76
  getS3Client,
75
- getUploadFileURL,
76
- uploadFile,
77
- uploadImage
77
+ getUploadURL,
78
+ uploadBlob,
79
+ uploadFile
78
80
  };
@@ -31,53 +31,31 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/graphql/client.tsx
32
32
  var client_exports = {};
33
33
  __export(client_exports, {
34
- TokenContext: () => TokenContext,
35
34
  getApolloWrapper: () => getApolloWrapper,
36
35
  tokenContext: () => tokenContext,
37
36
  useAuthMutation: () => useAuthMutation,
38
- useAuthQuery: () => useAuthQuery,
39
- useSetToken: () => useSetToken,
40
- useToken: () => useToken
37
+ useAuthQuery: () => useAuthQuery
41
38
  });
42
39
  module.exports = __toCommonJS(client_exports);
43
40
  var import_client = require("@apollo/client");
44
41
  var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
42
+ var import_client2 = require("naystack/auth/email/client");
45
43
  var import_react = __toESM(require("react"));
46
- var TokenContext = (0, import_react.createContext)({
47
- token: null,
48
- setToken: () => null
49
- });
50
- var getApolloWrapper = ({
51
- graphqlUri,
52
- cacheConfig,
53
- authEndpoint
44
+ var getApolloWrapper = (endpoint, {
45
+ cacheConfig
54
46
  }) => {
55
47
  function makeClient() {
56
48
  return new import_client_integration_nextjs.ApolloClient({
57
49
  cache: new import_client_integration_nextjs.InMemoryCache(cacheConfig),
58
50
  link: new import_client.HttpLink({
59
- uri: graphqlUri
51
+ uri: endpoint
60
52
  })
61
53
  });
62
54
  }
63
55
  return ({ children }) => {
64
- const [token, setToken] = (0, import_react.useState)(null);
65
- (0, import_react.useEffect)(() => {
66
- fetch(authEndpoint, {
67
- credentials: "include"
68
- }).then((res) => res.json()).then((data) => setToken(data.accessToken));
69
- }, []);
70
- return /* @__PURE__ */ import_react.default.createElement(import_client_integration_nextjs.ApolloNextAppProvider, { makeClient }, /* @__PURE__ */ import_react.default.createElement(TokenContext.Provider, { value: { token, setToken } }, children));
56
+ return /* @__PURE__ */ import_react.default.createElement(import_client_integration_nextjs.ApolloNextAppProvider, { makeClient }, children);
71
57
  };
72
58
  };
73
- function useToken() {
74
- const { token } = (0, import_react.useContext)(TokenContext);
75
- return token;
76
- }
77
- function useSetToken() {
78
- const { setToken } = (0, import_react.useContext)(TokenContext);
79
- return setToken;
80
- }
81
59
  var tokenContext = (token) => {
82
60
  if (!token) return void 0;
83
61
  return {
@@ -88,31 +66,31 @@ var tokenContext = (token) => {
88
66
  };
89
67
  };
90
68
  function useAuthQuery(query, variables) {
91
- const token = useToken();
92
- const [fetch2, result] = (0, import_client.useLazyQuery)(query);
69
+ const token = (0, import_client2.useToken)();
70
+ const [fetch, result] = (0, import_client.useLazyQuery)(query);
93
71
  const [calledVars, setCalledVars] = (0, import_react.useState)();
94
72
  (0, import_react.useEffect)(() => {
95
73
  if (token && variables && calledVars !== JSON.stringify(variables)) {
96
74
  setCalledVars(JSON.stringify(variables));
97
- void fetch2({
75
+ void fetch({
98
76
  variables,
99
77
  context: tokenContext(token),
100
78
  fetchPolicy: "no-cache"
101
79
  });
102
80
  }
103
- }, [fetch2, token, variables, calledVars]);
81
+ }, [fetch, token, variables, calledVars]);
104
82
  const reFetch = (0, import_react.useCallback)(
105
- (v) => fetch2({
83
+ (v) => fetch({
106
84
  variables: v,
107
85
  context: tokenContext(token),
108
86
  fetchPolicy: "no-cache"
109
87
  }),
110
- [fetch2, token]
88
+ [fetch, token]
111
89
  );
112
90
  return [reFetch, result];
113
91
  }
114
92
  function useAuthMutation(mutation, options) {
115
- const token = useToken();
93
+ const token = (0, import_client2.useToken)();
116
94
  const [mutate, result] = (0, import_client.useMutation)(mutation, options);
117
95
  const method = (0, import_react.useCallback)(
118
96
  (variables) => mutate({
@@ -125,11 +103,8 @@ function useAuthMutation(mutation, options) {
125
103
  }
126
104
  // Annotate the CommonJS export names for ESM import in node:
127
105
  0 && (module.exports = {
128
- TokenContext,
129
106
  getApolloWrapper,
130
107
  tokenContext,
131
108
  useAuthMutation,
132
- useAuthQuery,
133
- useSetToken,
134
- useToken
109
+ useAuthQuery
135
110
  });
@@ -1,20 +1,11 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
- import { OperationVariables, MutationHookOptions } from '@apollo/client';
3
- import { InMemoryCacheConfig } from '@apollo/client/cache';
2
+ import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@apollo/client';
4
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
- import React__default, { Dispatch, SetStateAction, PropsWithChildren } from 'react';
4
+ import react__default, { PropsWithChildren } from 'react';
6
5
 
7
- declare const TokenContext: React__default.Context<{
8
- token: string | null;
9
- setToken: Dispatch<SetStateAction<string | null>>;
10
- }>;
11
- declare const getApolloWrapper: ({ graphqlUri, cacheConfig, authEndpoint, }: {
12
- graphqlUri: string;
13
- authEndpoint: string;
6
+ declare const getApolloWrapper: (endpoint: string, { cacheConfig, }: {
14
7
  cacheConfig?: InMemoryCacheConfig;
15
- }) => ({ children }: PropsWithChildren) => React__default.JSX.Element;
16
- declare function useToken(): string | null;
17
- declare function useSetToken(): React__default.Dispatch<React__default.SetStateAction<string | null>>;
8
+ }) => ({ children }: PropsWithChildren) => react__default.JSX.Element;
18
9
  declare const tokenContext: (token?: string | null) => {
19
10
  headers: {
20
11
  authorization: string;
@@ -24,4 +15,4 @@ declare const tokenContext: (token?: string | null) => {
24
15
  declare function useAuthQuery<T, V extends OperationVariables>(query: TypedDocumentNode<T, V>, variables?: V): readonly [(v?: V) => Promise<_apollo_client.QueryResult<T, V>>, _apollo_client.QueryResult<T, V>];
25
16
  declare function useAuthMutation<T, V extends OperationVariables>(mutation: TypedDocumentNode<T, V>, options?: MutationHookOptions<T, V>): readonly [(variables?: V) => Promise<_apollo_client.FetchResult<T>>, _apollo_client.MutationResult<T>];
26
17
 
27
- export { TokenContext, getApolloWrapper, tokenContext, useAuthMutation, useAuthQuery, useSetToken, useToken };
18
+ export { getApolloWrapper, tokenContext, useAuthMutation, useAuthQuery };
@@ -1,20 +1,11 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
- import { OperationVariables, MutationHookOptions } from '@apollo/client';
3
- import { InMemoryCacheConfig } from '@apollo/client/cache';
2
+ import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@apollo/client';
4
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
- import React__default, { Dispatch, SetStateAction, PropsWithChildren } from 'react';
4
+ import react__default, { PropsWithChildren } from 'react';
6
5
 
7
- declare const TokenContext: React__default.Context<{
8
- token: string | null;
9
- setToken: Dispatch<SetStateAction<string | null>>;
10
- }>;
11
- declare const getApolloWrapper: ({ graphqlUri, cacheConfig, authEndpoint, }: {
12
- graphqlUri: string;
13
- authEndpoint: string;
6
+ declare const getApolloWrapper: (endpoint: string, { cacheConfig, }: {
14
7
  cacheConfig?: InMemoryCacheConfig;
15
- }) => ({ children }: PropsWithChildren) => React__default.JSX.Element;
16
- declare function useToken(): string | null;
17
- declare function useSetToken(): React__default.Dispatch<React__default.SetStateAction<string | null>>;
8
+ }) => ({ children }: PropsWithChildren) => react__default.JSX.Element;
18
9
  declare const tokenContext: (token?: string | null) => {
19
10
  headers: {
20
11
  authorization: string;
@@ -24,4 +15,4 @@ declare const tokenContext: (token?: string | null) => {
24
15
  declare function useAuthQuery<T, V extends OperationVariables>(query: TypedDocumentNode<T, V>, variables?: V): readonly [(v?: V) => Promise<_apollo_client.QueryResult<T, V>>, _apollo_client.QueryResult<T, V>];
25
16
  declare function useAuthMutation<T, V extends OperationVariables>(mutation: TypedDocumentNode<T, V>, options?: MutationHookOptions<T, V>): readonly [(variables?: V) => Promise<_apollo_client.FetchResult<T>>, _apollo_client.MutationResult<T>];
26
17
 
27
- export { TokenContext, getApolloWrapper, tokenContext, useAuthMutation, useAuthQuery, useSetToken, useToken };
18
+ export { getApolloWrapper, tokenContext, useAuthMutation, useAuthQuery };
@@ -11,48 +11,27 @@ import {
11
11
  ApolloNextAppProvider,
12
12
  InMemoryCache
13
13
  } from "@apollo/client-integration-nextjs";
14
+ import { useToken } from "naystack/auth/email/client";
14
15
  import React, {
15
- createContext,
16
16
  useCallback,
17
- useContext,
18
17
  useEffect,
19
18
  useState
20
19
  } from "react";
21
- var TokenContext = createContext({
22
- token: null,
23
- setToken: () => null
24
- });
25
- var getApolloWrapper = ({
26
- graphqlUri,
27
- cacheConfig,
28
- authEndpoint
20
+ var getApolloWrapper = (endpoint, {
21
+ cacheConfig
29
22
  }) => {
30
23
  function makeClient() {
31
24
  return new ApolloClient({
32
25
  cache: new InMemoryCache(cacheConfig),
33
26
  link: new HttpLink({
34
- uri: graphqlUri
27
+ uri: endpoint
35
28
  })
36
29
  });
37
30
  }
38
31
  return ({ children }) => {
39
- const [token, setToken] = useState(null);
40
- useEffect(() => {
41
- fetch(authEndpoint, {
42
- credentials: "include"
43
- }).then((res) => res.json()).then((data) => setToken(data.accessToken));
44
- }, []);
45
- return /* @__PURE__ */ React.createElement(ApolloNextAppProvider, { makeClient }, /* @__PURE__ */ React.createElement(TokenContext.Provider, { value: { token, setToken } }, children));
32
+ return /* @__PURE__ */ React.createElement(ApolloNextAppProvider, { makeClient }, children);
46
33
  };
47
34
  };
48
- function useToken() {
49
- const { token } = useContext(TokenContext);
50
- return token;
51
- }
52
- function useSetToken() {
53
- const { setToken } = useContext(TokenContext);
54
- return setToken;
55
- }
56
35
  var tokenContext = (token) => {
57
36
  if (!token) return void 0;
58
37
  return {
@@ -64,25 +43,25 @@ var tokenContext = (token) => {
64
43
  };
65
44
  function useAuthQuery(query, variables) {
66
45
  const token = useToken();
67
- const [fetch2, result] = useLazyQuery(query);
46
+ const [fetch, result] = useLazyQuery(query);
68
47
  const [calledVars, setCalledVars] = useState();
69
48
  useEffect(() => {
70
49
  if (token && variables && calledVars !== JSON.stringify(variables)) {
71
50
  setCalledVars(JSON.stringify(variables));
72
- void fetch2({
51
+ void fetch({
73
52
  variables,
74
53
  context: tokenContext(token),
75
54
  fetchPolicy: "no-cache"
76
55
  });
77
56
  }
78
- }, [fetch2, token, variables, calledVars]);
57
+ }, [fetch, token, variables, calledVars]);
79
58
  const reFetch = useCallback(
80
- (v) => fetch2({
59
+ (v) => fetch({
81
60
  variables: v,
82
61
  context: tokenContext(token),
83
62
  fetchPolicy: "no-cache"
84
63
  }),
85
- [fetch2, token]
64
+ [fetch, token]
86
65
  );
87
66
  return [reFetch, result];
88
67
  }
@@ -99,11 +78,8 @@ function useAuthMutation(mutation, options) {
99
78
  return [method, result];
100
79
  }
101
80
  export {
102
- TokenContext,
103
81
  getApolloWrapper,
104
82
  tokenContext,
105
83
  useAuthMutation,
106
- useAuthQuery,
107
- useSetToken,
108
- useToken
84
+ useAuthQuery
109
85
  };
@@ -6,7 +6,7 @@ declare function initGraphQLServer({ authChecker, resolvers, plugins, getContext
6
6
  authChecker?: AuthChecker<any>;
7
7
  resolvers: NonEmptyArray<Function>;
8
8
  plugins?: ApolloServerPlugin[];
9
- getContext?: (req: NextRequest) => Promise<any>;
9
+ getContext?: (req: NextRequest) => Promise<any> | any;
10
10
  }): Promise<{
11
11
  GET: (request: NextRequest) => Promise<Response>;
12
12
  POST: (request: NextRequest) => Promise<Response>;
@@ -6,7 +6,7 @@ declare function initGraphQLServer({ authChecker, resolvers, plugins, getContext
6
6
  authChecker?: AuthChecker<any>;
7
7
  resolvers: NonEmptyArray<Function>;
8
8
  plugins?: ApolloServerPlugin[];
9
- getContext?: (req: NextRequest) => Promise<any>;
9
+ getContext?: (req: NextRequest) => Promise<any> | any;
10
10
  }): Promise<{
11
11
  GET: (request: NextRequest) => Promise<Response>;
12
12
  POST: (request: NextRequest) => Promise<Response>;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import * as react from 'react';
2
2
  import { FC } from 'react';
3
3
  import { OperationVariables } from '@apollo/client';
4
4
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
@@ -15,7 +15,7 @@ declare function Injector<T, Y>({ fetch, Component, props, }: {
15
15
  data?: T;
16
16
  loading: boolean;
17
17
  } & Y>;
18
- } & ComponentProps<Y>): React.JSX.Element;
18
+ } & ComponentProps<Y>): react.JSX.Element;
19
19
  declare const getGraphQLQuery: ({ uri }: {
20
20
  uri: string;
21
21
  }) => <T, V extends OperationVariables>(_query: TypedDocumentNode<T, V>, options?: {
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import * as react from 'react';
2
2
  import { FC } from 'react';
3
3
  import { OperationVariables } from '@apollo/client';
4
4
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
@@ -15,7 +15,7 @@ declare function Injector<T, Y>({ fetch, Component, props, }: {
15
15
  data?: T;
16
16
  loading: boolean;
17
17
  } & Y>;
18
- } & ComponentProps<Y>): React.JSX.Element;
18
+ } & ComponentProps<Y>): react.JSX.Element;
19
19
  declare const getGraphQLQuery: ({ uri }: {
20
20
  uri: string;
21
21
  }) => <T, V extends OperationVariables>(_query: TypedDocumentNode<T, V>, options?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.2.17",
3
+ "version": "1.2.20",
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",