naystack 1.2.19 → 1.2.21
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/auth/email/client.cjs.js +3 -3
- package/dist/auth/email/client.d.mts +2 -2
- package/dist/auth/email/client.d.ts +2 -2
- package/dist/auth/email/client.esm.js +2 -2
- package/dist/graphql/client.cjs.js +3 -5
- package/dist/graphql/client.d.mts +2 -5
- package/dist/graphql/client.d.ts +2 -5
- package/dist/graphql/client.esm.js +3 -5
- package/dist/graphql/init.d.mts +1 -1
- package/dist/graphql/init.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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
|
-
|
|
91
|
+
getAuthWrapper,
|
|
92
92
|
getEmailAuthUtils,
|
|
93
93
|
useSetToken,
|
|
94
94
|
useToken
|
|
@@ -41,16 +41,14 @@ 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 = ({
|
|
45
|
-
|
|
46
|
-
cacheConfig,
|
|
47
|
-
authEndpoint
|
|
44
|
+
var getApolloWrapper = (endpoint, {
|
|
45
|
+
cacheConfig
|
|
48
46
|
}) => {
|
|
49
47
|
function makeClient() {
|
|
50
48
|
return new import_client_integration_nextjs.ApolloClient({
|
|
51
49
|
cache: new import_client_integration_nextjs.InMemoryCache(cacheConfig),
|
|
52
50
|
link: new import_client.HttpLink({
|
|
53
|
-
uri:
|
|
51
|
+
uri: endpoint
|
|
54
52
|
})
|
|
55
53
|
});
|
|
56
54
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
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
4
|
import react__default, { PropsWithChildren } from 'react';
|
|
6
5
|
|
|
7
|
-
declare const getApolloWrapper: (
|
|
8
|
-
graphqlUri: string;
|
|
9
|
-
authEndpoint: string;
|
|
6
|
+
declare const getApolloWrapper: (endpoint: string, { cacheConfig, }: {
|
|
10
7
|
cacheConfig?: InMemoryCacheConfig;
|
|
11
8
|
}) => ({ children }: PropsWithChildren) => react__default.JSX.Element;
|
|
12
9
|
declare const tokenContext: (token?: string | null) => {
|
package/dist/graphql/client.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
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
4
|
import react__default, { PropsWithChildren } from 'react';
|
|
6
5
|
|
|
7
|
-
declare const getApolloWrapper: (
|
|
8
|
-
graphqlUri: string;
|
|
9
|
-
authEndpoint: string;
|
|
6
|
+
declare const getApolloWrapper: (endpoint: string, { cacheConfig, }: {
|
|
10
7
|
cacheConfig?: InMemoryCacheConfig;
|
|
11
8
|
}) => ({ children }: PropsWithChildren) => react__default.JSX.Element;
|
|
12
9
|
declare const tokenContext: (token?: string | null) => {
|
|
@@ -17,16 +17,14 @@ import React, {
|
|
|
17
17
|
useEffect,
|
|
18
18
|
useState
|
|
19
19
|
} from "react";
|
|
20
|
-
var getApolloWrapper = ({
|
|
21
|
-
|
|
22
|
-
cacheConfig,
|
|
23
|
-
authEndpoint
|
|
20
|
+
var getApolloWrapper = (endpoint, {
|
|
21
|
+
cacheConfig
|
|
24
22
|
}) => {
|
|
25
23
|
function makeClient() {
|
|
26
24
|
return new ApolloClient({
|
|
27
25
|
cache: new InMemoryCache(cacheConfig),
|
|
28
26
|
link: new HttpLink({
|
|
29
|
-
uri:
|
|
27
|
+
uri: endpoint
|
|
30
28
|
})
|
|
31
29
|
});
|
|
32
30
|
}
|
package/dist/graphql/init.d.mts
CHANGED
|
@@ -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>;
|
package/dist/graphql/init.d.ts
CHANGED
|
@@ -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>;
|