naystack 1.2.20 → 1.2.22

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,7 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var client_exports = {};
22
22
  __export(client_exports, {
23
23
  TokenContext: () => TokenContext,
24
- getApolloWrapper: () => getApolloWrapper,
24
+ getAuthWrapper: () => getAuthWrapper,
25
25
  getEmailAuthUtils: () => getEmailAuthUtils,
26
26
  useSetToken: () => useSetToken,
27
27
  useToken: () => useToken
@@ -32,7 +32,7 @@ var TokenContext = (0, import_react.createContext)({
32
32
  token: null,
33
33
  setToken: () => null
34
34
  });
35
- var getApolloWrapper = (endpoint) => ({ children }) => {
35
+ var getAuthWrapper = (endpoint) => ({ children }) => {
36
36
  const [token, setToken] = (0, import_react.useState)(null);
37
37
  (0, import_react.useEffect)(() => {
38
38
  fetch(endpoint, {
@@ -111,7 +111,7 @@ function getEmailAuthUtils(endpoint) {
111
111
  // Annotate the CommonJS export names for ESM import in node:
112
112
  0 && (module.exports = {
113
113
  TokenContext,
114
- getApolloWrapper,
114
+ getAuthWrapper,
115
115
  getEmailAuthUtils,
116
116
  useSetToken,
117
117
  useToken
@@ -5,7 +5,7 @@ declare const TokenContext: react.Context<{
5
5
  token: string | null;
6
6
  setToken: Dispatch<SetStateAction<string | null>>;
7
7
  }>;
8
- declare const getApolloWrapper: (endpoint: string) => ({ children }: {
8
+ declare const getAuthWrapper: (endpoint: string) => ({ children }: {
9
9
  children: React.ReactNode;
10
10
  }) => react.JSX.Element;
11
11
  declare function useToken(): string | null;
@@ -16,4 +16,4 @@ declare function getEmailAuthUtils(endpoint: string): {
16
16
  useLogout: () => (data?: object) => Promise<void>;
17
17
  };
18
18
 
19
- export { TokenContext, getApolloWrapper, getEmailAuthUtils, useSetToken, useToken };
19
+ export { TokenContext, getAuthWrapper, getEmailAuthUtils, useSetToken, useToken };
@@ -5,7 +5,7 @@ declare const TokenContext: react.Context<{
5
5
  token: string | null;
6
6
  setToken: Dispatch<SetStateAction<string | null>>;
7
7
  }>;
8
- declare const getApolloWrapper: (endpoint: string) => ({ children }: {
8
+ declare const getAuthWrapper: (endpoint: string) => ({ children }: {
9
9
  children: React.ReactNode;
10
10
  }) => react.JSX.Element;
11
11
  declare function useToken(): string | null;
@@ -16,4 +16,4 @@ declare function getEmailAuthUtils(endpoint: string): {
16
16
  useLogout: () => (data?: object) => Promise<void>;
17
17
  };
18
18
 
19
- export { TokenContext, getApolloWrapper, getEmailAuthUtils, useSetToken, useToken };
19
+ export { TokenContext, getAuthWrapper, getEmailAuthUtils, useSetToken, useToken };
@@ -10,7 +10,7 @@ var TokenContext = createContext({
10
10
  token: null,
11
11
  setToken: () => null
12
12
  });
13
- var getApolloWrapper = (endpoint) => ({ children }) => {
13
+ var getAuthWrapper = (endpoint) => ({ children }) => {
14
14
  const [token, setToken] = useState(null);
15
15
  useEffect(() => {
16
16
  fetch(endpoint, {
@@ -88,7 +88,7 @@ function getEmailAuthUtils(endpoint) {
88
88
  }
89
89
  export {
90
90
  TokenContext,
91
- getApolloWrapper,
91
+ getAuthWrapper,
92
92
  getEmailAuthUtils,
93
93
  useSetToken,
94
94
  useToken
@@ -41,12 +41,10 @@ var import_client = require("@apollo/client");
41
41
  var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
42
42
  var import_client2 = require("naystack/auth/email/client");
43
43
  var import_react = __toESM(require("react"));
44
- var getApolloWrapper = (endpoint, {
45
- cacheConfig
46
- }) => {
44
+ var getApolloWrapper = (endpoint, options) => {
47
45
  function makeClient() {
48
46
  return new import_client_integration_nextjs.ApolloClient({
49
- cache: new import_client_integration_nextjs.InMemoryCache(cacheConfig),
47
+ cache: new import_client_integration_nextjs.InMemoryCache(options?.cacheConfig),
50
48
  link: new import_client.HttpLink({
51
49
  uri: endpoint
52
50
  })
@@ -3,7 +3,7 @@ import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@a
3
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
4
  import react__default, { PropsWithChildren } from 'react';
5
5
 
6
- declare const getApolloWrapper: (endpoint: string, { cacheConfig, }: {
6
+ declare const getApolloWrapper: (endpoint: string, options?: {
7
7
  cacheConfig?: InMemoryCacheConfig;
8
8
  }) => ({ children }: PropsWithChildren) => react__default.JSX.Element;
9
9
  declare const tokenContext: (token?: string | null) => {
@@ -3,7 +3,7 @@ import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@a
3
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
4
  import react__default, { PropsWithChildren } from 'react';
5
5
 
6
- declare const getApolloWrapper: (endpoint: string, { cacheConfig, }: {
6
+ declare const getApolloWrapper: (endpoint: string, options?: {
7
7
  cacheConfig?: InMemoryCacheConfig;
8
8
  }) => ({ children }: PropsWithChildren) => react__default.JSX.Element;
9
9
  declare const tokenContext: (token?: string | null) => {
@@ -17,12 +17,10 @@ import React, {
17
17
  useEffect,
18
18
  useState
19
19
  } from "react";
20
- var getApolloWrapper = (endpoint, {
21
- cacheConfig
22
- }) => {
20
+ var getApolloWrapper = (endpoint, options) => {
23
21
  function makeClient() {
24
22
  return new ApolloClient({
25
- cache: new InMemoryCache(cacheConfig),
23
+ cache: new InMemoryCache(options?.cacheConfig),
26
24
  link: new HttpLink({
27
25
  uri: endpoint
28
26
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
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",