naystack 1.5.19 → 1.5.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.
@@ -310,40 +310,21 @@ var getPutRoute = (options) => async (req) => {
310
310
  };
311
311
 
312
312
  // src/auth/email/server.tsx
313
+ var import_client2 = require("naystack/auth/email/client");
313
314
  var import_headers3 = require("next/headers");
314
315
 
315
- // src/auth/email/client.tsx
316
- var import_react = __toESM(require("react"));
317
- var TokenContext = (0, import_react.createContext)({
318
- token: null,
319
- setToken: () => null
320
- });
321
- function AuthApply({ data }) {
322
- const setToken = useSetToken();
323
- (0, import_react.useEffect)(() => {
324
- if (data) {
325
- setToken(data);
326
- }
327
- }, [data]);
328
- return null;
329
- }
330
- function useSetToken() {
331
- const { setToken } = (0, import_react.useContext)(TokenContext);
332
- return setToken;
333
- }
334
-
335
316
  // src/graphql/server.tsx
336
317
  var import_client = require("@apollo/client");
337
318
  var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
338
319
  var import_headers2 = require("next/headers");
339
- var import_react2 = __toESM(require("react"));
340
- var import_react3 = require("react");
320
+ var import_react = __toESM(require("react"));
321
+ var import_react2 = require("react");
341
322
  function Injector({
342
323
  fetch: fetch2,
343
324
  Component,
344
325
  props
345
326
  }) {
346
- return /* @__PURE__ */ import_react2.default.createElement(import_react3.Suspense, { fallback: /* @__PURE__ */ import_react2.default.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ import_react2.default.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
327
+ return /* @__PURE__ */ import_react.default.createElement(import_react2.Suspense, { fallback: /* @__PURE__ */ import_react.default.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ import_react.default.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
347
328
  }
348
329
  async function InjectorSuspensed({
349
330
  fetch: fetch2,
@@ -351,7 +332,7 @@ async function InjectorSuspensed({
351
332
  props
352
333
  }) {
353
334
  const data = await fetch2();
354
- return /* @__PURE__ */ import_react2.default.createElement(Component, { loading: false, ...props || {}, data });
335
+ return /* @__PURE__ */ import_react.default.createElement(Component, { loading: false, ...props || {}, data });
355
336
  }
356
337
  var { query: gqlQuery } = (0, import_client_integration_nextjs.registerApolloClient)(() => {
357
338
  return new import_client.ApolloClient({
@@ -378,7 +359,7 @@ function AuthFetch() {
378
359
  }
379
360
  }).then((res) => res.json()).then((data) => data.accessToken).catch(() => null);
380
361
  },
381
- Component: AuthApply
362
+ Component: import_client2.AuthApply
382
363
  }
383
364
  );
384
365
  }
@@ -271,34 +271,9 @@ var getPutRoute = (options) => async (req) => {
271
271
  };
272
272
 
273
273
  // src/auth/email/server.tsx
274
+ import { AuthApply } from "naystack/auth/email/client";
274
275
  import { cookies as cookies3 } from "next/headers";
275
276
 
276
- // src/auth/email/client.tsx
277
- import React2, {
278
- createContext,
279
- useCallback,
280
- useContext,
281
- useEffect,
282
- useState
283
- } from "react";
284
- var TokenContext = createContext({
285
- token: null,
286
- setToken: () => null
287
- });
288
- function AuthApply({ data }) {
289
- const setToken = useSetToken();
290
- useEffect(() => {
291
- if (data) {
292
- setToken(data);
293
- }
294
- }, [data]);
295
- return null;
296
- }
297
- function useSetToken() {
298
- const { setToken } = useContext(TokenContext);
299
- return setToken;
300
- }
301
-
302
277
  // src/graphql/server.tsx
303
278
  import {
304
279
  ApolloClient,
@@ -307,14 +282,14 @@ import {
307
282
  } from "@apollo/client";
308
283
  import { registerApolloClient } from "@apollo/client-integration-nextjs";
309
284
  import { cookies as cookies2 } from "next/headers";
310
- import React3 from "react";
285
+ import React2 from "react";
311
286
  import { Suspense } from "react";
312
287
  function Injector({
313
288
  fetch: fetch2,
314
289
  Component,
315
290
  props
316
291
  }) {
317
- return /* @__PURE__ */ React3.createElement(Suspense, { fallback: /* @__PURE__ */ React3.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React3.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
292
+ return /* @__PURE__ */ React2.createElement(Suspense, { fallback: /* @__PURE__ */ React2.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React2.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
318
293
  }
319
294
  async function InjectorSuspensed({
320
295
  fetch: fetch2,
@@ -322,7 +297,7 @@ async function InjectorSuspensed({
322
297
  props
323
298
  }) {
324
299
  const data = await fetch2();
325
- return /* @__PURE__ */ React3.createElement(Component, { loading: false, ...props || {}, data });
300
+ return /* @__PURE__ */ React2.createElement(Component, { loading: false, ...props || {}, data });
326
301
  }
327
302
  var { query: gqlQuery } = registerApolloClient(() => {
328
303
  return new ApolloClient({
@@ -33,10 +33,15 @@ __export(server_exports, {
33
33
  default: () => AuthFetch
34
34
  });
35
35
  module.exports = __toCommonJS(server_exports);
36
+ var import_client2 = require("naystack/auth/email/client");
36
37
  var import_headers2 = require("next/headers");
37
38
 
38
- // src/auth/email/client.tsx
39
+ // src/graphql/server.tsx
40
+ var import_client = require("@apollo/client");
41
+ var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
42
+ var import_headers = require("next/headers");
39
43
  var import_react = __toESM(require("react"));
44
+ var import_react2 = require("react");
40
45
 
41
46
  // src/env.ts
42
47
  var getEnvValue = (key) => {
@@ -87,37 +92,13 @@ function getEnv(key, skipCheck) {
87
92
  return value;
88
93
  }
89
94
 
90
- // src/auth/email/client.tsx
91
- var TokenContext = (0, import_react.createContext)({
92
- token: null,
93
- setToken: () => null
94
- });
95
- function AuthApply({ data }) {
96
- const setToken = useSetToken();
97
- (0, import_react.useEffect)(() => {
98
- if (data) {
99
- setToken(data);
100
- }
101
- }, [data]);
102
- return null;
103
- }
104
- function useSetToken() {
105
- const { setToken } = (0, import_react.useContext)(TokenContext);
106
- return setToken;
107
- }
108
-
109
95
  // src/graphql/server.tsx
110
- var import_client = require("@apollo/client");
111
- var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
112
- var import_headers = require("next/headers");
113
- var import_react2 = __toESM(require("react"));
114
- var import_react3 = require("react");
115
96
  function Injector({
116
97
  fetch: fetch2,
117
98
  Component,
118
99
  props
119
100
  }) {
120
- return /* @__PURE__ */ import_react2.default.createElement(import_react3.Suspense, { fallback: /* @__PURE__ */ import_react2.default.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ import_react2.default.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
101
+ return /* @__PURE__ */ import_react.default.createElement(import_react2.Suspense, { fallback: /* @__PURE__ */ import_react.default.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ import_react.default.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
121
102
  }
122
103
  async function InjectorSuspensed({
123
104
  fetch: fetch2,
@@ -125,7 +106,7 @@ async function InjectorSuspensed({
125
106
  props
126
107
  }) {
127
108
  const data = await fetch2();
128
- return /* @__PURE__ */ import_react2.default.createElement(Component, { loading: false, ...props || {}, data });
109
+ return /* @__PURE__ */ import_react.default.createElement(Component, { loading: false, ...props || {}, data });
129
110
  }
130
111
  var { query: gqlQuery } = (0, import_client_integration_nextjs.registerApolloClient)(() => {
131
112
  return new import_client.ApolloClient({
@@ -152,7 +133,7 @@ function AuthFetch() {
152
133
  }
153
134
  }).then((res) => res.json()).then((data) => data.accessToken).catch(() => null);
154
135
  },
155
- Component: AuthApply
136
+ Component: import_client2.AuthApply
156
137
  }
157
138
  );
158
139
  }
@@ -1,14 +1,17 @@
1
1
  // src/auth/email/server.tsx
2
+ import { AuthApply } from "naystack/auth/email/client";
2
3
  import { cookies as cookies2 } from "next/headers";
3
4
 
4
- // src/auth/email/client.tsx
5
- import React2, {
6
- createContext,
7
- useCallback,
8
- useContext,
9
- useEffect,
10
- useState
11
- } from "react";
5
+ // src/graphql/server.tsx
6
+ import {
7
+ ApolloClient,
8
+ HttpLink,
9
+ InMemoryCache
10
+ } from "@apollo/client";
11
+ import { registerApolloClient } from "@apollo/client-integration-nextjs";
12
+ import { cookies } from "next/headers";
13
+ import React2 from "react";
14
+ import { Suspense } from "react";
12
15
 
13
16
  // src/env.ts
14
17
  var getEnvValue = (key) => {
@@ -59,41 +62,13 @@ function getEnv(key, skipCheck) {
59
62
  return value;
60
63
  }
61
64
 
62
- // src/auth/email/client.tsx
63
- var TokenContext = createContext({
64
- token: null,
65
- setToken: () => null
66
- });
67
- function AuthApply({ data }) {
68
- const setToken = useSetToken();
69
- useEffect(() => {
70
- if (data) {
71
- setToken(data);
72
- }
73
- }, [data]);
74
- return null;
75
- }
76
- function useSetToken() {
77
- const { setToken } = useContext(TokenContext);
78
- return setToken;
79
- }
80
-
81
65
  // src/graphql/server.tsx
82
- import {
83
- ApolloClient,
84
- HttpLink,
85
- InMemoryCache
86
- } from "@apollo/client";
87
- import { registerApolloClient } from "@apollo/client-integration-nextjs";
88
- import { cookies } from "next/headers";
89
- import React3 from "react";
90
- import { Suspense } from "react";
91
66
  function Injector({
92
67
  fetch: fetch2,
93
68
  Component,
94
69
  props
95
70
  }) {
96
- return /* @__PURE__ */ React3.createElement(Suspense, { fallback: /* @__PURE__ */ React3.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React3.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
71
+ return /* @__PURE__ */ React2.createElement(Suspense, { fallback: /* @__PURE__ */ React2.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React2.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
97
72
  }
98
73
  async function InjectorSuspensed({
99
74
  fetch: fetch2,
@@ -101,7 +76,7 @@ async function InjectorSuspensed({
101
76
  props
102
77
  }) {
103
78
  const data = await fetch2();
104
- return /* @__PURE__ */ React3.createElement(Component, { loading: false, ...props || {}, data });
79
+ return /* @__PURE__ */ React2.createElement(Component, { loading: false, ...props || {}, data });
105
80
  }
106
81
  var { query: gqlQuery } = registerApolloClient(() => {
107
82
  return new ApolloClient({
@@ -326,40 +326,21 @@ var getPutRoute = (options) => async (req) => {
326
326
  };
327
327
 
328
328
  // src/auth/email/server.tsx
329
+ var import_client2 = require("naystack/auth/email/client");
329
330
  var import_headers3 = require("next/headers");
330
331
 
331
- // src/auth/email/client.tsx
332
- var import_react = __toESM(require("react"));
333
- var TokenContext = (0, import_react.createContext)({
334
- token: null,
335
- setToken: () => null
336
- });
337
- function AuthApply({ data }) {
338
- const setToken = useSetToken();
339
- (0, import_react.useEffect)(() => {
340
- if (data) {
341
- setToken(data);
342
- }
343
- }, [data]);
344
- return null;
345
- }
346
- function useSetToken() {
347
- const { setToken } = (0, import_react.useContext)(TokenContext);
348
- return setToken;
349
- }
350
-
351
332
  // src/graphql/server.tsx
352
333
  var import_client = require("@apollo/client");
353
334
  var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
354
335
  var import_headers2 = require("next/headers");
355
- var import_react2 = __toESM(require("react"));
356
- var import_react3 = require("react");
336
+ var import_react = __toESM(require("react"));
337
+ var import_react2 = require("react");
357
338
  function Injector({
358
339
  fetch: fetch2,
359
340
  Component,
360
341
  props
361
342
  }) {
362
- return /* @__PURE__ */ import_react2.default.createElement(import_react3.Suspense, { fallback: /* @__PURE__ */ import_react2.default.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ import_react2.default.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
343
+ return /* @__PURE__ */ import_react.default.createElement(import_react2.Suspense, { fallback: /* @__PURE__ */ import_react.default.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ import_react.default.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
363
344
  }
364
345
  async function InjectorSuspensed({
365
346
  fetch: fetch2,
@@ -367,7 +348,7 @@ async function InjectorSuspensed({
367
348
  props
368
349
  }) {
369
350
  const data = await fetch2();
370
- return /* @__PURE__ */ import_react2.default.createElement(Component, { loading: false, ...props || {}, data });
351
+ return /* @__PURE__ */ import_react.default.createElement(Component, { loading: false, ...props || {}, data });
371
352
  }
372
353
  var { query: gqlQuery } = (0, import_client_integration_nextjs.registerApolloClient)(() => {
373
354
  return new import_client.ApolloClient({
@@ -394,7 +375,7 @@ function AuthFetch() {
394
375
  }
395
376
  }).then((res) => res.json()).then((data) => data.accessToken).catch(() => null);
396
377
  },
397
- Component: AuthApply
378
+ Component: import_client2.AuthApply
398
379
  }
399
380
  );
400
381
  }
@@ -283,34 +283,9 @@ var getPutRoute = (options) => async (req) => {
283
283
  };
284
284
 
285
285
  // src/auth/email/server.tsx
286
+ import { AuthApply } from "naystack/auth/email/client";
286
287
  import { cookies as cookies3 } from "next/headers";
287
288
 
288
- // src/auth/email/client.tsx
289
- import React2, {
290
- createContext,
291
- useCallback,
292
- useContext,
293
- useEffect,
294
- useState
295
- } from "react";
296
- var TokenContext = createContext({
297
- token: null,
298
- setToken: () => null
299
- });
300
- function AuthApply({ data }) {
301
- const setToken = useSetToken();
302
- useEffect(() => {
303
- if (data) {
304
- setToken(data);
305
- }
306
- }, [data]);
307
- return null;
308
- }
309
- function useSetToken() {
310
- const { setToken } = useContext(TokenContext);
311
- return setToken;
312
- }
313
-
314
289
  // src/graphql/server.tsx
315
290
  import {
316
291
  ApolloClient,
@@ -319,14 +294,14 @@ import {
319
294
  } from "@apollo/client";
320
295
  import { registerApolloClient } from "@apollo/client-integration-nextjs";
321
296
  import { cookies as cookies2 } from "next/headers";
322
- import React3 from "react";
297
+ import React2 from "react";
323
298
  import { Suspense } from "react";
324
299
  function Injector({
325
300
  fetch: fetch2,
326
301
  Component,
327
302
  props
328
303
  }) {
329
- return /* @__PURE__ */ React3.createElement(Suspense, { fallback: /* @__PURE__ */ React3.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React3.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
304
+ return /* @__PURE__ */ React2.createElement(Suspense, { fallback: /* @__PURE__ */ React2.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React2.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
330
305
  }
331
306
  async function InjectorSuspensed({
332
307
  fetch: fetch2,
@@ -334,7 +309,7 @@ async function InjectorSuspensed({
334
309
  props
335
310
  }) {
336
311
  const data = await fetch2();
337
- return /* @__PURE__ */ React3.createElement(Component, { loading: false, ...props || {}, data });
312
+ return /* @__PURE__ */ React2.createElement(Component, { loading: false, ...props || {}, data });
338
313
  }
339
314
  var { query: gqlQuery } = registerApolloClient(() => {
340
315
  return new ApolloClient({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.5.19",
3
+ "version": "1.5.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",