naystack 1.7.28 → 1.7.30
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/index.cjs.js +9 -4
- package/dist/auth/email/index.esm.js +7 -2
- package/dist/auth/email/next.cjs.js +7 -2
- package/dist/auth/email/next.esm.js +7 -2
- package/dist/auth/index.cjs.js +19 -14
- package/dist/auth/index.esm.js +7 -2
- package/dist/graphql/index.cjs.js +7 -2
- package/dist/graphql/index.esm.js +7 -2
- package/dist/graphql/server.cjs.js +7 -2
- package/dist/graphql/server.d.mts +11 -2
- package/dist/graphql/server.d.ts +11 -2
- package/dist/graphql/server.esm.js +7 -2
- package/package.json +1 -1
|
@@ -38,7 +38,7 @@ __export(email_exports, {
|
|
|
38
38
|
setupEmailAuth: () => setupEmailAuth
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(email_exports);
|
|
41
|
-
var
|
|
41
|
+
var import_server6 = require("next/server");
|
|
42
42
|
|
|
43
43
|
// src/utils/route.ts
|
|
44
44
|
var import_server = require("next/server");
|
|
@@ -372,13 +372,18 @@ var import_react3 = __toESM(require("react"));
|
|
|
372
372
|
var import_client = require("@apollo/client");
|
|
373
373
|
var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
|
|
374
374
|
var import_headers2 = require("next/headers");
|
|
375
|
+
var import_server4 = require("next/server");
|
|
375
376
|
var import_react = __toESM(require("react"));
|
|
376
377
|
var import_react2 = require("react");
|
|
377
|
-
function Injector({
|
|
378
|
+
async function Injector({
|
|
378
379
|
fetch: fetch2,
|
|
379
380
|
Component,
|
|
380
|
-
props
|
|
381
|
+
props,
|
|
382
|
+
isStatic
|
|
381
383
|
}) {
|
|
384
|
+
if (!isStatic) {
|
|
385
|
+
await (0, import_server4.connection)();
|
|
386
|
+
}
|
|
382
387
|
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 }));
|
|
383
388
|
}
|
|
384
389
|
async function InjectorSuspensed({
|
|
@@ -436,7 +441,7 @@ function setupEmailAuth(options) {
|
|
|
436
441
|
req.headers.get("origin"),
|
|
437
442
|
allowedOrigins
|
|
438
443
|
);
|
|
439
|
-
return new
|
|
444
|
+
return new import_server6.NextResponse(null, {
|
|
440
445
|
status: 204,
|
|
441
446
|
headers: corsHeaders ?? void 0
|
|
442
447
|
});
|
|
@@ -337,13 +337,18 @@ import {
|
|
|
337
337
|
} from "@apollo/client";
|
|
338
338
|
import { registerApolloClient } from "@apollo/client-integration-nextjs";
|
|
339
339
|
import { cookies as cookies2 } from "next/headers";
|
|
340
|
+
import { connection } from "next/server";
|
|
340
341
|
import React from "react";
|
|
341
342
|
import { Suspense } from "react";
|
|
342
|
-
function Injector({
|
|
343
|
+
async function Injector({
|
|
343
344
|
fetch: fetch2,
|
|
344
345
|
Component,
|
|
345
|
-
props
|
|
346
|
+
props,
|
|
347
|
+
isStatic
|
|
346
348
|
}) {
|
|
349
|
+
if (!isStatic) {
|
|
350
|
+
await connection();
|
|
351
|
+
}
|
|
347
352
|
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
|
|
348
353
|
}
|
|
349
354
|
async function InjectorSuspensed({
|
|
@@ -95,13 +95,18 @@ function getEnv(key, skipCheck) {
|
|
|
95
95
|
var import_client = require("@apollo/client");
|
|
96
96
|
var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
|
|
97
97
|
var import_headers = require("next/headers");
|
|
98
|
+
var import_server = require("next/server");
|
|
98
99
|
var import_react = __toESM(require("react"));
|
|
99
100
|
var import_react2 = require("react");
|
|
100
|
-
function Injector({
|
|
101
|
+
async function Injector({
|
|
101
102
|
fetch: fetch2,
|
|
102
103
|
Component,
|
|
103
|
-
props
|
|
104
|
+
props,
|
|
105
|
+
isStatic
|
|
104
106
|
}) {
|
|
107
|
+
if (!isStatic) {
|
|
108
|
+
await (0, import_server.connection)();
|
|
109
|
+
}
|
|
105
110
|
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 }));
|
|
106
111
|
}
|
|
107
112
|
async function InjectorSuspensed({
|
|
@@ -64,13 +64,18 @@ import {
|
|
|
64
64
|
} from "@apollo/client";
|
|
65
65
|
import { registerApolloClient } from "@apollo/client-integration-nextjs";
|
|
66
66
|
import { cookies } from "next/headers";
|
|
67
|
+
import { connection } from "next/server";
|
|
67
68
|
import React from "react";
|
|
68
69
|
import { Suspense } from "react";
|
|
69
|
-
function Injector({
|
|
70
|
+
async function Injector({
|
|
70
71
|
fetch: fetch2,
|
|
71
72
|
Component,
|
|
72
|
-
props
|
|
73
|
+
props,
|
|
74
|
+
isStatic
|
|
73
75
|
}) {
|
|
76
|
+
if (!isStatic) {
|
|
77
|
+
await connection();
|
|
78
|
+
}
|
|
74
79
|
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
|
|
75
80
|
}
|
|
76
81
|
async function InjectorSuspensed({
|
package/dist/auth/index.cjs.js
CHANGED
|
@@ -44,7 +44,7 @@ __export(auth_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(auth_exports);
|
|
45
45
|
|
|
46
46
|
// src/auth/email/index.ts
|
|
47
|
-
var
|
|
47
|
+
var import_server6 = require("next/server");
|
|
48
48
|
|
|
49
49
|
// src/utils/route.ts
|
|
50
50
|
var import_server = require("next/server");
|
|
@@ -390,13 +390,18 @@ var import_react3 = __toESM(require("react"));
|
|
|
390
390
|
var import_client = require("@apollo/client");
|
|
391
391
|
var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
|
|
392
392
|
var import_headers2 = require("next/headers");
|
|
393
|
+
var import_server4 = require("next/server");
|
|
393
394
|
var import_react = __toESM(require("react"));
|
|
394
395
|
var import_react2 = require("react");
|
|
395
|
-
function Injector({
|
|
396
|
+
async function Injector({
|
|
396
397
|
fetch: fetch2,
|
|
397
398
|
Component,
|
|
398
|
-
props
|
|
399
|
+
props,
|
|
400
|
+
isStatic
|
|
399
401
|
}) {
|
|
402
|
+
if (!isStatic) {
|
|
403
|
+
await (0, import_server4.connection)();
|
|
404
|
+
}
|
|
400
405
|
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 }));
|
|
401
406
|
}
|
|
402
407
|
async function InjectorSuspensed({
|
|
@@ -454,7 +459,7 @@ function setupEmailAuth(options) {
|
|
|
454
459
|
req.headers.get("origin"),
|
|
455
460
|
allowedOrigins
|
|
456
461
|
);
|
|
457
|
-
return new
|
|
462
|
+
return new import_server6.NextResponse(null, {
|
|
458
463
|
status: 204,
|
|
459
464
|
headers: corsHeaders ?? void 0
|
|
460
465
|
});
|
|
@@ -465,7 +470,7 @@ function setupEmailAuth(options) {
|
|
|
465
470
|
|
|
466
471
|
// src/auth/google/get.ts
|
|
467
472
|
var import_googleapis = require("googleapis");
|
|
468
|
-
var
|
|
473
|
+
var import_server7 = require("next/server");
|
|
469
474
|
var import_uuid = require("uuid");
|
|
470
475
|
var getGoogleGetRoute = ({
|
|
471
476
|
getUserIdFromEmail,
|
|
@@ -502,7 +507,7 @@ var getGoogleGetRoute = ({
|
|
|
502
507
|
prompt: "consent",
|
|
503
508
|
redirect_uri: url
|
|
504
509
|
});
|
|
505
|
-
const res =
|
|
510
|
+
const res = import_server7.NextResponse.redirect(authorizationUrl);
|
|
506
511
|
res.cookies.set("state", state2, {
|
|
507
512
|
httpOnly: true,
|
|
508
513
|
secure: true
|
|
@@ -523,11 +528,11 @@ var getGoogleGetRoute = ({
|
|
|
523
528
|
const finalRedirectURL = stateRedirectURL || redirectURL;
|
|
524
529
|
const finalErrorURL = stateErrorRedirectURL || errorRedirectURL || finalRedirectURL;
|
|
525
530
|
if (error) {
|
|
526
|
-
return
|
|
531
|
+
return import_server7.NextResponse.redirect(finalErrorURL);
|
|
527
532
|
}
|
|
528
533
|
const state = req.nextUrl.searchParams.get("state") || void 0;
|
|
529
534
|
if (code && state) {
|
|
530
|
-
if (localState !== state) return
|
|
535
|
+
if (localState !== state) return import_server7.NextResponse.redirect(finalErrorURL);
|
|
531
536
|
const { tokens } = await oauth2Client.getToken(code);
|
|
532
537
|
oauth2Client.setCredentials(tokens);
|
|
533
538
|
const userInfoRequest = await import_googleapis.google.oauth2({
|
|
@@ -540,7 +545,7 @@ var getGoogleGetRoute = ({
|
|
|
540
545
|
const id = await getUserIdFromEmail(user, data);
|
|
541
546
|
if (id) {
|
|
542
547
|
const targetUrl = new URL(finalRedirectURL, req.nextUrl.origin);
|
|
543
|
-
const res =
|
|
548
|
+
const res = import_server7.NextResponse.redirect(targetUrl);
|
|
544
549
|
res.cookies.set(
|
|
545
550
|
REFRESH_COOKIE_NAME,
|
|
546
551
|
generateRefreshToken(id),
|
|
@@ -558,7 +563,7 @@ var getGoogleGetRoute = ({
|
|
|
558
563
|
}
|
|
559
564
|
}
|
|
560
565
|
}
|
|
561
|
-
return
|
|
566
|
+
return import_server7.NextResponse.redirect(finalErrorURL);
|
|
562
567
|
};
|
|
563
568
|
};
|
|
564
569
|
|
|
@@ -570,7 +575,7 @@ function setupGoogleAuth(props) {
|
|
|
570
575
|
}
|
|
571
576
|
|
|
572
577
|
// src/auth/instagram/route.ts
|
|
573
|
-
var
|
|
578
|
+
var import_server9 = require("next/server");
|
|
574
579
|
|
|
575
580
|
// src/auth/instagram/utils.ts
|
|
576
581
|
async function getRefreshedInstagramAccessToken(token) {
|
|
@@ -632,7 +637,7 @@ var getInstagramUser = (token, id, fields) => {
|
|
|
632
637
|
};
|
|
633
638
|
|
|
634
639
|
// src/socials/meta-webhook.ts
|
|
635
|
-
var
|
|
640
|
+
var import_server8 = require("next/server");
|
|
636
641
|
|
|
637
642
|
// src/auth/instagram/route.ts
|
|
638
643
|
var getInstagramRoute = ({
|
|
@@ -640,7 +645,7 @@ var getInstagramRoute = ({
|
|
|
640
645
|
errorRedirectURL,
|
|
641
646
|
onUser
|
|
642
647
|
}) => {
|
|
643
|
-
const handleError2 = (message) =>
|
|
648
|
+
const handleError2 = (message) => import_server9.NextResponse.redirect(`${errorRedirectURL}?error=${message}`);
|
|
644
649
|
return async (req) => {
|
|
645
650
|
const accessCode = req.nextUrl.searchParams.get("code");
|
|
646
651
|
const error = req.nextUrl.searchParams.get("error");
|
|
@@ -664,7 +669,7 @@ var getInstagramRoute = ({
|
|
|
664
669
|
instagramData.accessToken
|
|
665
670
|
);
|
|
666
671
|
if (errorMessage) return handleError2(errorMessage);
|
|
667
|
-
return
|
|
672
|
+
return import_server9.NextResponse.redirect(redirectURL);
|
|
668
673
|
};
|
|
669
674
|
};
|
|
670
675
|
|
package/dist/auth/index.esm.js
CHANGED
|
@@ -349,13 +349,18 @@ import {
|
|
|
349
349
|
} from "@apollo/client";
|
|
350
350
|
import { registerApolloClient } from "@apollo/client-integration-nextjs";
|
|
351
351
|
import { cookies as cookies2 } from "next/headers";
|
|
352
|
+
import { connection } from "next/server";
|
|
352
353
|
import React from "react";
|
|
353
354
|
import { Suspense } from "react";
|
|
354
|
-
function Injector({
|
|
355
|
+
async function Injector({
|
|
355
356
|
fetch: fetch2,
|
|
356
357
|
Component,
|
|
357
|
-
props
|
|
358
|
+
props,
|
|
359
|
+
isStatic
|
|
358
360
|
}) {
|
|
361
|
+
if (!isStatic) {
|
|
362
|
+
await connection();
|
|
363
|
+
}
|
|
359
364
|
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
|
|
360
365
|
}
|
|
361
366
|
async function InjectorSuspensed({
|
|
@@ -938,13 +938,18 @@ function FieldLibrary(type, queries) {
|
|
|
938
938
|
var import_client = require("@apollo/client");
|
|
939
939
|
var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
|
|
940
940
|
var import_headers3 = require("next/headers");
|
|
941
|
+
var import_server6 = require("next/server");
|
|
941
942
|
var import_react2 = __toESM(require("react"));
|
|
942
943
|
var import_react3 = require("react");
|
|
943
|
-
function Injector({
|
|
944
|
+
async function Injector({
|
|
944
945
|
fetch: fetch2,
|
|
945
946
|
Component,
|
|
946
|
-
props
|
|
947
|
+
props,
|
|
948
|
+
isStatic
|
|
947
949
|
}) {
|
|
950
|
+
if (!isStatic) {
|
|
951
|
+
await (0, import_server6.connection)();
|
|
952
|
+
}
|
|
948
953
|
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 }));
|
|
949
954
|
}
|
|
950
955
|
async function InjectorSuspensed({
|
|
@@ -936,13 +936,18 @@ import {
|
|
|
936
936
|
} from "@apollo/client";
|
|
937
937
|
import { registerApolloClient } from "@apollo/client-integration-nextjs";
|
|
938
938
|
import { cookies as cookies3 } from "next/headers";
|
|
939
|
+
import { connection } from "next/server";
|
|
939
940
|
import React from "react";
|
|
940
941
|
import { Suspense } from "react";
|
|
941
|
-
function Injector({
|
|
942
|
+
async function Injector({
|
|
942
943
|
fetch: fetch2,
|
|
943
944
|
Component,
|
|
944
|
-
props
|
|
945
|
+
props,
|
|
946
|
+
isStatic
|
|
945
947
|
}) {
|
|
948
|
+
if (!isStatic) {
|
|
949
|
+
await connection();
|
|
950
|
+
}
|
|
946
951
|
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
|
|
947
952
|
}
|
|
948
953
|
async function InjectorSuspensed({
|
|
@@ -37,6 +37,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
37
37
|
var import_client = require("@apollo/client");
|
|
38
38
|
var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
|
|
39
39
|
var import_headers = require("next/headers");
|
|
40
|
+
var import_server = require("next/server");
|
|
40
41
|
var import_react = __toESM(require("react"));
|
|
41
42
|
var import_react2 = require("react");
|
|
42
43
|
|
|
@@ -91,11 +92,15 @@ function getEnv(key, skipCheck) {
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
// src/graphql/server.tsx
|
|
94
|
-
function Injector({
|
|
95
|
+
async function Injector({
|
|
95
96
|
fetch,
|
|
96
97
|
Component,
|
|
97
|
-
props
|
|
98
|
+
props,
|
|
99
|
+
isStatic
|
|
98
100
|
}) {
|
|
101
|
+
if (!isStatic) {
|
|
102
|
+
await (0, import_server.connection)();
|
|
103
|
+
}
|
|
99
104
|
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, props }));
|
|
100
105
|
}
|
|
101
106
|
async function InjectorSuspensed({
|
|
@@ -19,10 +19,18 @@ type ComponentProps<Y> = OmittedProps<Y> extends Record<string, never> ? {
|
|
|
19
19
|
* This is the primary way to inject server-side data into client components in naystack.
|
|
20
20
|
* Use `.authCall()` or `.call()` from your query definitions inside the `fetch` function.
|
|
21
21
|
*
|
|
22
|
+
* By default, `Injector` calls `connection()` from `next/server` before
|
|
23
|
+
* running `fetch`, marking the surrounding route segment as dynamic. This
|
|
24
|
+
* is what consumers almost always want: data fetched at request time
|
|
25
|
+
* should not be statically prerendered. Pass `isStatic` when you
|
|
26
|
+
* are intentionally rendering inside a cached/static segment (e.g. the
|
|
27
|
+
* `fetch` is wrapped in `"use cache"`).
|
|
28
|
+
*
|
|
22
29
|
* @param injectorProps - Configuration object.
|
|
23
30
|
* @param injectorProps.fetch - Async function that returns the data to pass to the component. Runs on the server.
|
|
24
31
|
* @param injectorProps.Component - React component that receives `{ data?: T; loading: boolean }` plus any extra props.
|
|
25
32
|
* @param injectorProps.props - Optional. Any additional props to pass to `Component`. Required if the Component has props other than `data` and `loading`.
|
|
33
|
+
* @param injectorProps.isStatic - Optional. When true, suppresses the implicit `connection()` call. Default: false.
|
|
26
34
|
* @returns A React element that suspends until `fetch()` completes, then renders `Component` with the data.
|
|
27
35
|
*
|
|
28
36
|
* @example Simple usage:
|
|
@@ -63,13 +71,14 @@ type ComponentProps<Y> = OmittedProps<Y> extends Record<string, never> ? {
|
|
|
63
71
|
*
|
|
64
72
|
* @category GraphQL
|
|
65
73
|
*/
|
|
66
|
-
declare function Injector<T, Y>({ fetch, Component, props, }: {
|
|
74
|
+
declare function Injector<T, Y>({ fetch, Component, props, isStatic, }: {
|
|
67
75
|
fetch: () => Promise<T>;
|
|
68
76
|
Component: FC<{
|
|
69
77
|
data?: T;
|
|
70
78
|
loading: boolean;
|
|
71
79
|
} & Y>;
|
|
72
|
-
|
|
80
|
+
isStatic?: boolean;
|
|
81
|
+
} & ComponentProps<Y>): Promise<React__default.JSX.Element>;
|
|
73
82
|
/**
|
|
74
83
|
* Runs a raw GraphQL query on the server using the registered Apollo client.
|
|
75
84
|
* Cookies are forwarded automatically so the backend can identify the user.
|
package/dist/graphql/server.d.ts
CHANGED
|
@@ -19,10 +19,18 @@ type ComponentProps<Y> = OmittedProps<Y> extends Record<string, never> ? {
|
|
|
19
19
|
* This is the primary way to inject server-side data into client components in naystack.
|
|
20
20
|
* Use `.authCall()` or `.call()` from your query definitions inside the `fetch` function.
|
|
21
21
|
*
|
|
22
|
+
* By default, `Injector` calls `connection()` from `next/server` before
|
|
23
|
+
* running `fetch`, marking the surrounding route segment as dynamic. This
|
|
24
|
+
* is what consumers almost always want: data fetched at request time
|
|
25
|
+
* should not be statically prerendered. Pass `isStatic` when you
|
|
26
|
+
* are intentionally rendering inside a cached/static segment (e.g. the
|
|
27
|
+
* `fetch` is wrapped in `"use cache"`).
|
|
28
|
+
*
|
|
22
29
|
* @param injectorProps - Configuration object.
|
|
23
30
|
* @param injectorProps.fetch - Async function that returns the data to pass to the component. Runs on the server.
|
|
24
31
|
* @param injectorProps.Component - React component that receives `{ data?: T; loading: boolean }` plus any extra props.
|
|
25
32
|
* @param injectorProps.props - Optional. Any additional props to pass to `Component`. Required if the Component has props other than `data` and `loading`.
|
|
33
|
+
* @param injectorProps.isStatic - Optional. When true, suppresses the implicit `connection()` call. Default: false.
|
|
26
34
|
* @returns A React element that suspends until `fetch()` completes, then renders `Component` with the data.
|
|
27
35
|
*
|
|
28
36
|
* @example Simple usage:
|
|
@@ -63,13 +71,14 @@ type ComponentProps<Y> = OmittedProps<Y> extends Record<string, never> ? {
|
|
|
63
71
|
*
|
|
64
72
|
* @category GraphQL
|
|
65
73
|
*/
|
|
66
|
-
declare function Injector<T, Y>({ fetch, Component, props, }: {
|
|
74
|
+
declare function Injector<T, Y>({ fetch, Component, props, isStatic, }: {
|
|
67
75
|
fetch: () => Promise<T>;
|
|
68
76
|
Component: FC<{
|
|
69
77
|
data?: T;
|
|
70
78
|
loading: boolean;
|
|
71
79
|
} & Y>;
|
|
72
|
-
|
|
80
|
+
isStatic?: boolean;
|
|
81
|
+
} & ComponentProps<Y>): Promise<React__default.JSX.Element>;
|
|
73
82
|
/**
|
|
74
83
|
* Runs a raw GraphQL query on the server using the registered Apollo client.
|
|
75
84
|
* Cookies are forwarded automatically so the backend can identify the user.
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@apollo/client";
|
|
7
7
|
import { registerApolloClient } from "@apollo/client-integration-nextjs";
|
|
8
8
|
import { cookies } from "next/headers";
|
|
9
|
+
import { connection } from "next/server";
|
|
9
10
|
import React from "react";
|
|
10
11
|
import { Suspense } from "react";
|
|
11
12
|
|
|
@@ -60,11 +61,15 @@ function getEnv(key, skipCheck) {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
// src/graphql/server.tsx
|
|
63
|
-
function Injector({
|
|
64
|
+
async function Injector({
|
|
64
65
|
fetch,
|
|
65
66
|
Component,
|
|
66
|
-
props
|
|
67
|
+
props,
|
|
68
|
+
isStatic
|
|
67
69
|
}) {
|
|
70
|
+
if (!isStatic) {
|
|
71
|
+
await connection();
|
|
72
|
+
}
|
|
68
73
|
return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React.createElement(InjectorSuspensed, { Component, fetch, props }));
|
|
69
74
|
}
|
|
70
75
|
async function InjectorSuspensed({
|