@carlonicora/nextjs-jsonapi 3.28.2 → 4.0.1
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/{BlockNoteEditor-36VL2TNM.js → BlockNoteEditor-BXMTGKDV.js} +21 -20
- package/dist/BlockNoteEditor-BXMTGKDV.js.map +1 -0
- package/dist/{BlockNoteEditor-4IDXT6ZU.mjs → BlockNoteEditor-FGVQP35E.mjs} +9 -8
- package/dist/{BlockNoteEditor-4IDXT6ZU.mjs.map → BlockNoteEditor-FGVQP35E.mjs.map} +1 -1
- package/dist/{BlockNoteViewer-KRTAFTUX.mjs → BlockNoteViewer-DQYT6IJW.mjs} +3 -3
- package/dist/{BlockNoteViewer-7BFNTN4E.js → BlockNoteViewer-YH7G66PS.js} +4 -4
- package/dist/{BlockNoteViewer-7BFNTN4E.js.map → BlockNoteViewer-YH7G66PS.js.map} +1 -1
- package/dist/{HandbookSectionInterface-DgYH--Ik.d.mts → HandbookSectionInterface-BYsmnPEz.d.mts} +1 -1
- package/dist/{HandbookSectionInterface-Ck1wZJ81.d.ts → HandbookSectionInterface-OePKPbqN.d.ts} +1 -1
- package/dist/{JsonApiRequest-UHOWNI3O.mjs → JsonApiRequest-MEP6AXDT.mjs} +2 -2
- package/dist/JsonApiRequest-OB6WL4LA.js +26 -0
- package/dist/{JsonApiRequest-TE5WD3WS.js.map → JsonApiRequest-OB6WL4LA.js.map} +1 -1
- package/dist/ServerSession-DFNNNkg7.d.ts +29 -0
- package/dist/ServerSession-DK1z0_Ql.d.mts +29 -0
- package/dist/{analytics.modules-CfczU12P.d.ts → analytics.modules-Bsacu6ik.d.ts} +1 -1
- package/dist/{analytics.modules-pzGwMASI.d.mts → analytics.modules-txdCLNG-.d.mts} +1 -1
- package/dist/billing/index.js +404 -402
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +10 -8
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-7B4E42R5.mjs → chunk-3CZ2GK5R.mjs} +33 -9
- package/dist/chunk-3CZ2GK5R.mjs.map +1 -0
- package/dist/{chunk-4Z45NYPR.js → chunk-5W5MN7JP.js} +14 -83
- package/dist/chunk-5W5MN7JP.js.map +1 -0
- package/dist/{chunk-CAKOFJZD.js → chunk-6OFANJTE.js} +195 -142
- package/dist/chunk-6OFANJTE.js.map +1 -0
- package/dist/{chunk-5TRFNKJS.js → chunk-6TUB7Y6T.js} +23 -25
- package/dist/chunk-6TUB7Y6T.js.map +1 -0
- package/dist/{chunk-37DMFVLN.mjs → chunk-7SCREMTX.mjs} +4 -3
- package/dist/{chunk-37DMFVLN.mjs.map → chunk-7SCREMTX.mjs.map} +1 -1
- package/dist/{chunk-Q6J2ICKO.mjs → chunk-ADZSH3MG.mjs} +3 -72
- package/dist/chunk-ADZSH3MG.mjs.map +1 -0
- package/dist/{chunk-E3I4MT53.mjs → chunk-AQZ3T4BR.mjs} +71 -18
- package/dist/chunk-AQZ3T4BR.mjs.map +1 -0
- package/dist/{chunk-SJLXPHK5.mjs → chunk-E2LENTUH.mjs} +22 -24
- package/dist/chunk-E2LENTUH.mjs.map +1 -0
- package/dist/chunk-EBEXWN3I.mjs +17 -0
- package/dist/chunk-EBEXWN3I.mjs.map +1 -0
- package/dist/chunk-G4JR3SFV.js +28 -0
- package/dist/chunk-G4JR3SFV.js.map +1 -0
- package/dist/chunk-IK65TDQH.js +15 -0
- package/dist/chunk-IK65TDQH.js.map +1 -0
- package/dist/{chunk-GHFMKH3M.js → chunk-JEQ34Z5E.js} +62 -38
- package/dist/chunk-JEQ34Z5E.js.map +1 -0
- package/dist/{chunk-KOTKKBJT.js → chunk-NFCXUAE6.js} +1328 -1183
- package/dist/chunk-NFCXUAE6.js.map +1 -0
- package/dist/chunk-OEOK6A3P.js +17 -0
- package/dist/chunk-OEOK6A3P.js.map +1 -0
- package/dist/chunk-PW42LRSL.mjs +28 -0
- package/dist/chunk-PW42LRSL.mjs.map +1 -0
- package/dist/{chunk-U65JPKO3.mjs → chunk-R6ZYB4VN.mjs} +2 -2
- package/dist/chunk-T7SAW3UW.mjs +15 -0
- package/dist/chunk-T7SAW3UW.mjs.map +1 -0
- package/dist/{chunk-GKDHYB2R.js → chunk-TWBZ2GSX.js} +3 -3
- package/dist/{chunk-GKDHYB2R.js.map → chunk-TWBZ2GSX.js.map} +1 -1
- package/dist/{chunk-26MQIJNB.js → chunk-WGVNJXZO.js} +4 -3
- package/dist/chunk-WGVNJXZO.js.map +1 -0
- package/dist/{chunk-HPUV6FBW.mjs → chunk-WJC4SYRL.mjs} +2131 -1986
- package/dist/chunk-WJC4SYRL.mjs.map +1 -0
- package/dist/client/index.d.mts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +6 -5
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +13 -12
- package/dist/components/index.d.mts +16 -6
- package/dist/components/index.d.ts +16 -6
- package/dist/components/index.js +8 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +9 -6
- package/dist/{config-3N1LSrcC.d.ts → config-B6UB7j69.d.ts} +1 -1
- package/dist/{config-BmufyEj6.d.mts → config-CEAq4Ozy.d.mts} +10 -1
- package/dist/{config-AVtuvfM1.d.ts → config-DydDHCfb.d.ts} +10 -1
- package/dist/{config-BSKTYDoh.d.mts → config-n-ZpPmOL.d.mts} +1 -1
- package/dist/contexts/index.d.mts +28 -4
- package/dist/contexts/index.d.ts +28 -4
- package/dist/contexts/index.js +10 -5
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +9 -4
- package/dist/core/index.d.mts +6 -6
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +5 -5
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +4 -4
- package/dist/features/analytics/index.d.mts +2 -2
- package/dist/features/analytics/index.d.ts +2 -2
- package/dist/features/analytics/index.js +124 -123
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +6 -5
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.d.mts +10 -2
- package/dist/features/analytics/server.d.ts +10 -2
- package/dist/features/analytics/server.js +8 -6
- package/dist/features/analytics/server.js.map +1 -1
- package/dist/features/analytics/server.mjs +6 -4
- package/dist/features/analytics/server.mjs.map +1 -1
- package/dist/features/help/index.d.mts +2 -2
- package/dist/features/help/index.d.ts +2 -2
- package/dist/features/help/index.js +39 -38
- package/dist/features/help/index.js.map +1 -1
- package/dist/features/help/index.mjs +5 -4
- package/dist/features/help/index.mjs.map +1 -1
- package/dist/features/tokenusage/index.d.mts +2 -2
- package/dist/features/tokenusage/index.d.ts +2 -2
- package/dist/features/tokenusage/index.js +127 -126
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +6 -5
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -9
- package/dist/next-config/index.d.mts +43 -0
- package/dist/next-config/index.d.ts +43 -0
- package/dist/next-config/index.js +230 -0
- package/dist/next-config/index.js.map +1 -0
- package/dist/next-config/index.mjs +230 -0
- package/dist/next-config/index.mjs.map +1 -0
- package/dist/{request-FXF63NSQ.mjs → request-3IUMNVOS.mjs} +2 -2
- package/dist/request-LZBAOT3Y.js +8 -0
- package/dist/request-LZBAOT3Y.js.map +1 -0
- package/dist/server/cachedGet.d.mts +28 -0
- package/dist/server/cachedGet.d.ts +28 -0
- package/dist/server/cachedGet.js +60 -0
- package/dist/server/cachedGet.js.map +1 -0
- package/dist/server/cachedGet.mjs +60 -0
- package/dist/server/cachedGet.mjs.map +1 -0
- package/dist/server/cachedGet.stub.d.mts +7 -0
- package/dist/server/cachedGet.stub.d.ts +7 -0
- package/dist/server/cachedGet.stub.js +17 -0
- package/dist/server/cachedGet.stub.js.map +1 -0
- package/dist/server/cachedGet.stub.mjs +17 -0
- package/dist/server/cachedGet.stub.mjs.map +1 -0
- package/dist/server/index.d.mts +27 -25
- package/dist/server/index.d.ts +27 -25
- package/dist/server/index.js +13 -6
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +15 -8
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/{types-D0uLYV2P.d.mts → types-Bq_UA8Lg.d.mts} +1 -1
- package/dist/{types-Cn153-mH.d.ts → types-bsm8Fp55.d.ts} +1 -1
- package/dist/{usePageUrlGenerator-B-3FRKBD.d.ts → usePageUrlGenerator-J_ECv-oQ.d.ts} +1 -1
- package/dist/{usePageUrlGenerator-CCJ_cdQy.d.mts → usePageUrlGenerator-uKBjAKqC.d.mts} +1 -1
- package/package.json +12 -1
- package/src/components/forms/__tests__/EditorSheet.test.tsx +25 -1
- package/src/components/forms/__tests__/useEditorDialog.test.ts +164 -1
- package/src/components/forms/useEditorDialog.ts +69 -2
- package/src/contexts/SessionContext.tsx +20 -0
- package/src/contexts/SocketContext.tsx +30 -3
- package/src/contexts/ViewportContext.tsx +17 -2
- package/src/contexts/__tests__/SessionContext.test.tsx +58 -0
- package/src/contexts/__tests__/SocketContext.session.test.tsx +77 -0
- package/src/contexts/index.ts +1 -0
- package/src/core/abstracts/AbstractService.ts +4 -6
- package/src/core/abstracts/__tests__/AbstractService.locale.test.ts +64 -0
- package/src/features/analytics/components/server/AnalyticsAdminPage.tsx +5 -1
- package/src/features/analytics/components/server/AnalyticsJourneyPage.tsx +5 -1
- package/src/features/notification/contexts/NotificationContext.tsx +5 -2
- package/src/features/notification/contexts/__tests__/NotificationContext.spec.tsx +22 -0
- package/src/features/user/contexts/CurrentUserContext.tsx +7 -5
- package/src/features/user/contexts/__tests__/CurrentUserContext.spec.tsx +63 -3
- package/src/hooks/__tests__/useSocket.render.test.ts +22 -0
- package/src/hooks/useSocket.ts +0 -1
- package/src/i18n/__tests__/config.test.ts +27 -0
- package/src/i18n/config.ts +17 -0
- package/src/i18n/index.ts +2 -0
- package/src/next-config/__tests__/createNextConfig.test.ts +268 -0
- package/src/next-config/csp.ts +128 -0
- package/src/next-config/headers.ts +61 -0
- package/src/next-config/index.ts +114 -0
- package/src/server/JsonApiServer.ts +3 -1
- package/src/server/ServerSession.ts +29 -1
- package/src/server/__tests__/JsonApiServer.test.ts +41 -0
- package/src/server/__tests__/ServerSession.read.test.ts +67 -0
- package/src/server/__tests__/cache.test.ts +48 -0
- package/src/server/__tests__/cachedGet.test.ts +125 -0
- package/src/server/__tests__/request.test.ts +96 -1
- package/src/server/cache.ts +21 -4
- package/src/server/cacheDigest.ts +10 -0
- package/src/server/cacheProfiles.ts +15 -0
- package/src/server/cachedGet.stub.ts +15 -0
- package/src/server/cachedGet.ts +80 -0
- package/src/server/request.ts +33 -32
- package/src/shadcnui/ui/__tests__/sidebar.menu-skeleton.test.tsx +50 -0
- package/src/shadcnui/ui/__tests__/sidebar.session.test.tsx +133 -0
- package/src/shadcnui/ui/sidebar.tsx +121 -18
- package/src/testing/matchers/jsonApiMatchers.ts +1 -0
- package/src/unified/JsonApiRequest.ts +4 -1
- package/src/unified/__tests__/JsonApiGet.cache.test.ts +51 -0
- package/src/utils/__tests__/map-thenable.test.ts +29 -0
- package/src/utils/__tests__/use-mobile.test.tsx +102 -1
- package/src/utils/map-thenable.ts +15 -0
- package/src/utils/use-mobile.tsx +13 -4
- package/dist/BlockNoteEditor-36VL2TNM.js.map +0 -1
- package/dist/JsonApiRequest-TE5WD3WS.js +0 -26
- package/dist/chunk-26MQIJNB.js.map +0 -1
- package/dist/chunk-4Z45NYPR.js.map +0 -1
- package/dist/chunk-5TRFNKJS.js.map +0 -1
- package/dist/chunk-7B4E42R5.mjs.map +0 -1
- package/dist/chunk-CAKOFJZD.js.map +0 -1
- package/dist/chunk-E3I4MT53.mjs.map +0 -1
- package/dist/chunk-GHFMKH3M.js.map +0 -1
- package/dist/chunk-HPUV6FBW.mjs.map +0 -1
- package/dist/chunk-KOTKKBJT.js.map +0 -1
- package/dist/chunk-Q6J2ICKO.mjs.map +0 -1
- package/dist/chunk-SJLXPHK5.mjs.map +0 -1
- package/dist/request-ZTX6I63X.js +0 -8
- package/dist/request-ZTX6I63X.js.map +0 -1
- /package/dist/{BlockNoteViewer-KRTAFTUX.mjs.map → BlockNoteViewer-DQYT6IJW.mjs.map} +0 -0
- /package/dist/{JsonApiRequest-UHOWNI3O.mjs.map → JsonApiRequest-MEP6AXDT.mjs.map} +0 -0
- /package/dist/{chunk-U65JPKO3.mjs.map → chunk-R6ZYB4VN.mjs.map} +0 -0
- /package/dist/{request-FXF63NSQ.mjs.map → request-3IUMNVOS.mjs.map} +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "../chunk-PAWJFY3S.mjs";
|
|
4
|
+
|
|
5
|
+
// src/next-config/csp.ts
|
|
6
|
+
var SERVICE_SOURCES = {
|
|
7
|
+
stripe: {
|
|
8
|
+
"script-src": ["https://js.stripe.com"],
|
|
9
|
+
"img-src": ["https://*.stripe.com"],
|
|
10
|
+
"connect-src": ["https://api.stripe.com"],
|
|
11
|
+
"frame-src": ["https://js.stripe.com", "https://hooks.stripe.com"]
|
|
12
|
+
},
|
|
13
|
+
googleMaps: {
|
|
14
|
+
"script-src": ["https://maps.googleapis.com"],
|
|
15
|
+
"img-src": ["https://maps.googleapis.com", "https://maps.gstatic.com"],
|
|
16
|
+
"connect-src": ["https://maps.googleapis.com", "https://places.googleapis.com"]
|
|
17
|
+
},
|
|
18
|
+
turnstile: {
|
|
19
|
+
"script-src": ["https://challenges.cloudflare.com"],
|
|
20
|
+
"connect-src": ["https://challenges.cloudflare.com"],
|
|
21
|
+
"frame-src": ["https://challenges.cloudflare.com"]
|
|
22
|
+
},
|
|
23
|
+
discord: {
|
|
24
|
+
"img-src": ["https://cdn.discordapp.com"]
|
|
25
|
+
},
|
|
26
|
+
googleFonts: {
|
|
27
|
+
"style-src": ["https://fonts.googleapis.com"],
|
|
28
|
+
"font-src": ["https://fonts.gstatic.com"]
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function listImageSources(env) {
|
|
32
|
+
return env.IMAGE_SOURCES ? env.IMAGE_SOURCES.split(",").map((s) => s.trim()) : [];
|
|
33
|
+
}
|
|
34
|
+
__name(listImageSources, "listImageSources");
|
|
35
|
+
function buildCsp(options, env) {
|
|
36
|
+
const apiUrl = env.NEXT_PUBLIC_API_URL || "";
|
|
37
|
+
const imageSources = listImageSources(env);
|
|
38
|
+
const services = options.services ?? [];
|
|
39
|
+
const fetchDirectives = {
|
|
40
|
+
// Scripts: self, and unsafe-inline/eval for Next.js
|
|
41
|
+
"script-src": { base: ["'self'", "'unsafe-inline'", "'unsafe-eval'"], fromEnv: [] },
|
|
42
|
+
// Styles: self and unsafe-inline for styled-components/emotion
|
|
43
|
+
"style-src": { base: ["'self'", "'unsafe-inline'"], fromEnv: [] },
|
|
44
|
+
// Images: self, data URIs, blobs, and configured image sources
|
|
45
|
+
"img-src": { base: ["'self'", "data:", "blob:"], fromEnv: imageSources },
|
|
46
|
+
// Fonts: self
|
|
47
|
+
"font-src": { base: ["'self'"], fromEnv: [] },
|
|
48
|
+
// Connect: self, API (http + ws for socket.io), and storage (for uploads)
|
|
49
|
+
"connect-src": {
|
|
50
|
+
base: ["'self'"],
|
|
51
|
+
fromEnv: [
|
|
52
|
+
apiUrl,
|
|
53
|
+
// Add WebSocket URL for socket.io (convert http->ws, https->wss)
|
|
54
|
+
apiUrl.replace(/^http/, "ws"),
|
|
55
|
+
env.NEXT_PUBLIC_ADDRESS || "",
|
|
56
|
+
...imageSources
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
// Frames: self
|
|
60
|
+
"frame-src": { base: ["'self'"], fromEnv: [] },
|
|
61
|
+
// Worker sources: self and blob (for Web Workers with dynamic imports)
|
|
62
|
+
"worker-src": { base: ["'self'", "blob:"], fromEnv: [] }
|
|
63
|
+
};
|
|
64
|
+
const directive = /* @__PURE__ */ __name((name) => {
|
|
65
|
+
const { base, fromEnv } = fetchDirectives[name];
|
|
66
|
+
const fromServices = services.flatMap((service) => SERVICE_SOURCES[service][name] ?? []);
|
|
67
|
+
const sources = [...base, ...fromServices, ...options.csp?.[name] ?? [], ...fromEnv].filter(
|
|
68
|
+
(source) => source !== ""
|
|
69
|
+
);
|
|
70
|
+
return [name, ...new Set(sources)].join(" ");
|
|
71
|
+
}, "directive");
|
|
72
|
+
return [
|
|
73
|
+
"default-src 'self'",
|
|
74
|
+
directive("script-src"),
|
|
75
|
+
directive("style-src"),
|
|
76
|
+
directive("img-src"),
|
|
77
|
+
directive("font-src"),
|
|
78
|
+
directive("connect-src"),
|
|
79
|
+
directive("frame-src"),
|
|
80
|
+
// Frame ancestors: deny embedding (equivalent to X-Frame-Options: DENY)
|
|
81
|
+
"frame-ancestors 'none'",
|
|
82
|
+
// Form actions: only self
|
|
83
|
+
"form-action 'self'",
|
|
84
|
+
// Base URI: only self
|
|
85
|
+
"base-uri 'self'",
|
|
86
|
+
// Object sources: none (no plugins)
|
|
87
|
+
"object-src 'none'",
|
|
88
|
+
directive("worker-src"),
|
|
89
|
+
// Upgrade insecure requests in production.
|
|
90
|
+
//
|
|
91
|
+
// NOT under E2E_BUILD: the e2e harness runs a PRODUCTION build (for speed)
|
|
92
|
+
// and serves it over plain http on a custom hostname. With this directive
|
|
93
|
+
// the browser rewrites every /_next/static asset to https, which nothing is
|
|
94
|
+
// listening on — every chunk fails with ERR_SSL_PROTOCOL_ERROR, the page
|
|
95
|
+
// never hydrates, and each spec sees only server-rendered markup.
|
|
96
|
+
env.NODE_ENV === "production" && env.E2E_BUILD !== "true" ? "upgrade-insecure-requests" : ""
|
|
97
|
+
].filter(Boolean).join("; ");
|
|
98
|
+
}
|
|
99
|
+
__name(buildCsp, "buildCsp");
|
|
100
|
+
|
|
101
|
+
// src/next-config/headers.ts
|
|
102
|
+
function buildSecurityHeaders(options, env) {
|
|
103
|
+
const camera = options.permissionsPolicy?.camera === "none" ? "" : "self";
|
|
104
|
+
return [
|
|
105
|
+
{
|
|
106
|
+
// Apply to all routes
|
|
107
|
+
source: "/:path*",
|
|
108
|
+
headers: [
|
|
109
|
+
// Content Security Policy - prevents XSS attacks
|
|
110
|
+
{
|
|
111
|
+
key: "Content-Security-Policy",
|
|
112
|
+
value: buildCsp(options, env)
|
|
113
|
+
},
|
|
114
|
+
// X-Frame-Options - prevents clickjacking (backup for older browsers)
|
|
115
|
+
{
|
|
116
|
+
key: "X-Frame-Options",
|
|
117
|
+
value: "DENY"
|
|
118
|
+
},
|
|
119
|
+
// X-Content-Type-Options - prevents MIME sniffing
|
|
120
|
+
{
|
|
121
|
+
key: "X-Content-Type-Options",
|
|
122
|
+
value: "nosniff"
|
|
123
|
+
},
|
|
124
|
+
// Strict-Transport-Security - enforces HTTPS (1 year, include subdomains).
|
|
125
|
+
// Omitted under E2E_BUILD for the same reason as upgrade-insecure-requests:
|
|
126
|
+
// the suite speaks plain http, and an HSTS pin would force https on every
|
|
127
|
+
// later request to this host from the same browser profile.
|
|
128
|
+
...env.E2E_BUILD === "true" ? [] : [
|
|
129
|
+
{
|
|
130
|
+
key: "Strict-Transport-Security",
|
|
131
|
+
value: "max-age=31536000; includeSubDomains"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
// Referrer-Policy - controls referrer information
|
|
135
|
+
{
|
|
136
|
+
key: "Referrer-Policy",
|
|
137
|
+
value: "strict-origin-when-cross-origin"
|
|
138
|
+
},
|
|
139
|
+
// Permissions-Policy - restricts browser features
|
|
140
|
+
{
|
|
141
|
+
key: "Permissions-Policy",
|
|
142
|
+
value: `camera=(${camera}), microphone=(), geolocation=()`
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
__name(buildSecurityHeaders, "buildSecurityHeaders");
|
|
149
|
+
|
|
150
|
+
// src/next-config/index.ts
|
|
151
|
+
function parseImageSources(env) {
|
|
152
|
+
return env.IMAGE_SOURCES ? env.IMAGE_SOURCES.split(",").map((url) => {
|
|
153
|
+
const { hostname, protocol, port } = new URL(url.trim());
|
|
154
|
+
return {
|
|
155
|
+
protocol: protocol.replace(":", ""),
|
|
156
|
+
hostname,
|
|
157
|
+
port: port || void 0
|
|
158
|
+
};
|
|
159
|
+
}) : [];
|
|
160
|
+
}
|
|
161
|
+
__name(parseImageSources, "parseImageSources");
|
|
162
|
+
function createNextConfig(options) {
|
|
163
|
+
const env = process.env;
|
|
164
|
+
const reactCompiler = options.reactCompiler === true;
|
|
165
|
+
const config = {
|
|
166
|
+
// The e2e stack (scripts/e2e.sh) runs a PRODUCTION build of this app while a
|
|
167
|
+
// `next dev` server may still be running against the same worktree. `next
|
|
168
|
+
// build` and `next dev` share `.next`, so a build performed underneath a live
|
|
169
|
+
// dev server clobbers it and that dev server then 404s every route. Giving
|
|
170
|
+
// the e2e build its own directory keeps the two independent. E2E_BUILD must
|
|
171
|
+
// be set for `next build` AND for `next start`, or `start` looks in `.next`
|
|
172
|
+
// and serves someone else's output.
|
|
173
|
+
...env.E2E_BUILD === "true" ? { distDir: ".next-e2e" } : {},
|
|
174
|
+
cacheComponents: true,
|
|
175
|
+
partialPrefetching: true,
|
|
176
|
+
reactCompiler,
|
|
177
|
+
experimental: {
|
|
178
|
+
serverActions: {
|
|
179
|
+
bodySizeLimit: "5mb"
|
|
180
|
+
},
|
|
181
|
+
// Required by `unauthorized()` (next/navigation), which ServerSession.checkPermission
|
|
182
|
+
// calls to deny access. Without this flag the function throws a plain Error instead of
|
|
183
|
+
// rendering the nearest unauthorized.tsx.
|
|
184
|
+
authInterrupts: options.authInterrupts ?? true,
|
|
185
|
+
turbopackGc: true,
|
|
186
|
+
turbopackLazyDynamicImports: true,
|
|
187
|
+
...reactCompiler ? { turbopackRustReactCompiler: true } : {}
|
|
188
|
+
},
|
|
189
|
+
allowedDevOrigins: options.devOrigins,
|
|
190
|
+
pageExtensions: options.mdx ? ["ts", "tsx", "mdx"] : ["ts", "tsx"],
|
|
191
|
+
images: {
|
|
192
|
+
minimumCacheTTL: options.imageMinimumCacheTTL ?? 60,
|
|
193
|
+
remotePatterns: parseImageSources(env),
|
|
194
|
+
dangerouslyAllowLocalIP: true
|
|
195
|
+
},
|
|
196
|
+
poweredByHeader: false,
|
|
197
|
+
reactStrictMode: false,
|
|
198
|
+
env: {
|
|
199
|
+
NEXT_PUBLIC_API_URL: env.NEXT_PUBLIC_API_URL ?? "",
|
|
200
|
+
NEXT_PUBLIC_ADDRESS: env.NEXT_PUBLIC_ADDRESS ?? "",
|
|
201
|
+
NEXT_PUBLIC_VAPID_PUBLIC_KEY: env.NEXT_PUBLIC_VAPID_PUBLIC_KEY ?? "",
|
|
202
|
+
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY ?? "",
|
|
203
|
+
...options.env
|
|
204
|
+
},
|
|
205
|
+
// Inlined replacement for @serwist/turbopack's withSerwist wrapper, which
|
|
206
|
+
// does nothing but append these two entries. Requiring the package here
|
|
207
|
+
// instead CRASHES production: it is a devDependency, next.config.js is loaded
|
|
208
|
+
// at RUNTIME by `next start`, and the web-production image installs with
|
|
209
|
+
// --prod. Do not re-add a require of any devDependency to this file.
|
|
210
|
+
...options.serwist ? { serverExternalPackages: ["esbuild", "esbuild-wasm"] } : {},
|
|
211
|
+
// Next 16 builds AND serves dev with Turbopack, so this is what pins yjs to a
|
|
212
|
+
// single instance in both modes.
|
|
213
|
+
turbopack: {
|
|
214
|
+
resolveAlias: {
|
|
215
|
+
yjs: "./node_modules/yjs"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
if (options.securityHeaders !== false) {
|
|
220
|
+
config.headers = async () => buildSecurityHeaders(options, process.env);
|
|
221
|
+
}
|
|
222
|
+
if (options.rewrites) config.rewrites = options.rewrites;
|
|
223
|
+
return options.extend ? options.extend(config) : config;
|
|
224
|
+
}
|
|
225
|
+
__name(createNextConfig, "createNextConfig");
|
|
226
|
+
export {
|
|
227
|
+
buildCsp,
|
|
228
|
+
createNextConfig
|
|
229
|
+
};
|
|
230
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/next-config/csp.ts","../../src/next-config/headers.ts","../../src/next-config/index.ts"],"sourcesContent":["// Runtime imports: none. next.config.js loads this at RUNTIME under `next start`\n// in an image installed with --prod, so it may import only Node built-ins.\n\nexport type CspDirective =\n \"script-src\" | \"style-src\" | \"img-src\" | \"font-src\" | \"connect-src\" | \"frame-src\" | \"worker-src\";\n\n/**\n * Third-party services an app may load. Each one adds its hosts to the\n * directives it needs; nothing is allowed unless the app names it.\n *\n * - `stripe`: the billing feature (`@carlonicora/nextjs-jsonapi/billing`).\n * - `googleMaps`: `FormPlaceAutocomplete` (Places API) and Maps JS/static tiles.\n * - `turnstile`: Cloudflare Turnstile widgets (contact and waitlist forms).\n * - `discord`: Discord avatars shown for users who log in with Discord.\n * - `googleFonts`: fonts linked at runtime from Google Fonts. Not needed for\n * `next/font/google`, which self-hosts at build time.\n */\nexport type CspService = \"stripe\" | \"googleMaps\" | \"turnstile\" | \"discord\" | \"googleFonts\";\n\nexport interface CspOptions {\n services?: CspService[];\n csp?: Partial<Record<CspDirective, string[]>>;\n}\n\nconst SERVICE_SOURCES: Record<CspService, Partial<Record<CspDirective, string[]>>> = {\n stripe: {\n \"script-src\": [\"https://js.stripe.com\"],\n \"img-src\": [\"https://*.stripe.com\"],\n \"connect-src\": [\"https://api.stripe.com\"],\n \"frame-src\": [\"https://js.stripe.com\", \"https://hooks.stripe.com\"],\n },\n googleMaps: {\n \"script-src\": [\"https://maps.googleapis.com\"],\n \"img-src\": [\"https://maps.googleapis.com\", \"https://maps.gstatic.com\"],\n \"connect-src\": [\"https://maps.googleapis.com\", \"https://places.googleapis.com\"],\n },\n turnstile: {\n \"script-src\": [\"https://challenges.cloudflare.com\"],\n \"connect-src\": [\"https://challenges.cloudflare.com\"],\n \"frame-src\": [\"https://challenges.cloudflare.com\"],\n },\n discord: {\n \"img-src\": [\"https://cdn.discordapp.com\"],\n },\n googleFonts: {\n \"style-src\": [\"https://fonts.googleapis.com\"],\n \"font-src\": [\"https://fonts.gstatic.com\"],\n },\n};\n\nfunction listImageSources(env: NodeJS.ProcessEnv): string[] {\n return env.IMAGE_SOURCES ? env.IMAGE_SOURCES.split(\",\").map((s) => s.trim()) : [];\n}\n\n// Build CSP directives\n// Note: 'unsafe-inline' and 'unsafe-eval' needed for Next.js dev mode and some runtime features\n// In production, consider using nonces for stricter CSP\nexport function buildCsp(options: CspOptions, env: NodeJS.ProcessEnv): string {\n const apiUrl = env.NEXT_PUBLIC_API_URL || \"\";\n const imageSources = listImageSources(env);\n const services = options.services ?? [];\n\n // Each fetch directive: what Next itself needs, then the named services, then\n // the app's extras, then the sources derived from the env.\n const fetchDirectives: Record<CspDirective, { base: string[]; fromEnv: string[] }> = {\n // Scripts: self, and unsafe-inline/eval for Next.js\n \"script-src\": { base: [\"'self'\", \"'unsafe-inline'\", \"'unsafe-eval'\"], fromEnv: [] },\n // Styles: self and unsafe-inline for styled-components/emotion\n \"style-src\": { base: [\"'self'\", \"'unsafe-inline'\"], fromEnv: [] },\n // Images: self, data URIs, blobs, and configured image sources\n \"img-src\": { base: [\"'self'\", \"data:\", \"blob:\"], fromEnv: imageSources },\n // Fonts: self\n \"font-src\": { base: [\"'self'\"], fromEnv: [] },\n // Connect: self, API (http + ws for socket.io), and storage (for uploads)\n \"connect-src\": {\n base: [\"'self'\"],\n fromEnv: [\n apiUrl,\n // Add WebSocket URL for socket.io (convert http->ws, https->wss)\n apiUrl.replace(/^http/, \"ws\"),\n env.NEXT_PUBLIC_ADDRESS || \"\",\n ...imageSources,\n ],\n },\n // Frames: self\n \"frame-src\": { base: [\"'self'\"], fromEnv: [] },\n // Worker sources: self and blob (for Web Workers with dynamic imports)\n \"worker-src\": { base: [\"'self'\", \"blob:\"], fromEnv: [] },\n };\n\n const directive = (name: CspDirective): string => {\n const { base, fromEnv } = fetchDirectives[name];\n const fromServices = services.flatMap((service) => SERVICE_SOURCES[service][name] ?? []);\n const sources = [...base, ...fromServices, ...(options.csp?.[name] ?? []), ...fromEnv].filter(\n (source) => source !== \"\",\n );\n return [name, ...new Set(sources)].join(\" \");\n };\n\n return [\n \"default-src 'self'\",\n directive(\"script-src\"),\n directive(\"style-src\"),\n directive(\"img-src\"),\n directive(\"font-src\"),\n directive(\"connect-src\"),\n directive(\"frame-src\"),\n // Frame ancestors: deny embedding (equivalent to X-Frame-Options: DENY)\n \"frame-ancestors 'none'\",\n // Form actions: only self\n \"form-action 'self'\",\n // Base URI: only self\n \"base-uri 'self'\",\n // Object sources: none (no plugins)\n \"object-src 'none'\",\n directive(\"worker-src\"),\n // Upgrade insecure requests in production.\n //\n // NOT under E2E_BUILD: the e2e harness runs a PRODUCTION build (for speed)\n // and serves it over plain http on a custom hostname. With this directive\n // the browser rewrites every /_next/static asset to https, which nothing is\n // listening on — every chunk fails with ERR_SSL_PROTOCOL_ERROR, the page\n // never hydrates, and each spec sees only server-rendered markup.\n env.NODE_ENV === \"production\" && env.E2E_BUILD !== \"true\" ? \"upgrade-insecure-requests\" : \"\",\n ]\n .filter(Boolean)\n .join(\"; \");\n}\n","// Runtime imports: relative only. See csp.ts.\nimport { buildCsp, type CspOptions } from \"./csp\";\n\nexport interface SecurityHeaderOptions extends CspOptions {\n permissionsPolicy?: { camera?: \"none\" | \"self\" };\n}\n\nexport interface HeaderRule {\n source: string;\n headers: { key: string; value: string }[];\n}\n\nexport function buildSecurityHeaders(options: SecurityHeaderOptions, env: NodeJS.ProcessEnv): HeaderRule[] {\n const camera = options.permissionsPolicy?.camera === \"none\" ? \"\" : \"self\";\n\n return [\n {\n // Apply to all routes\n source: \"/:path*\",\n headers: [\n // Content Security Policy - prevents XSS attacks\n {\n key: \"Content-Security-Policy\",\n value: buildCsp(options, env),\n },\n // X-Frame-Options - prevents clickjacking (backup for older browsers)\n {\n key: \"X-Frame-Options\",\n value: \"DENY\",\n },\n // X-Content-Type-Options - prevents MIME sniffing\n {\n key: \"X-Content-Type-Options\",\n value: \"nosniff\",\n },\n // Strict-Transport-Security - enforces HTTPS (1 year, include subdomains).\n // Omitted under E2E_BUILD for the same reason as upgrade-insecure-requests:\n // the suite speaks plain http, and an HSTS pin would force https on every\n // later request to this host from the same browser profile.\n ...(env.E2E_BUILD === \"true\"\n ? []\n : [\n {\n key: \"Strict-Transport-Security\",\n value: \"max-age=31536000; includeSubDomains\",\n },\n ]),\n // Referrer-Policy - controls referrer information\n {\n key: \"Referrer-Policy\",\n value: \"strict-origin-when-cross-origin\",\n },\n // Permissions-Policy - restricts browser features\n {\n key: \"Permissions-Policy\",\n value: `camera=(${camera}), microphone=(), geolocation=()`,\n },\n ],\n },\n ];\n}\n","// Shared next.config for the nja fleet. Apps wrap the result with their own\n// plugins: `withNextIntl(withMDX(createNextConfig({...})))`.\n//\n// next.config.js is loaded at RUNTIME by `next start`, and the production image\n// installs with --prod. This entry may therefore import only Node built-ins at\n// runtime: never next-intl, @next/mdx, serwist or any devDependency. `next` is\n// imported for its types only.\nimport type { NextConfig } from \"next\";\nimport { buildCsp, type CspDirective, type CspService } from \"./csp\";\nimport { buildSecurityHeaders } from \"./headers\";\n\nexport { buildCsp };\nexport type { CspDirective, CspService };\n\nexport interface NjaNextConfigOptions {\n devOrigins: string[];\n /** Third-party services the app loads; each adds its own hosts to the CSP. Nothing is allowed by default. */\n services?: CspService[];\n /** Extra CSP sources per directive, for hosts no named service covers. */\n csp?: Partial<Record<CspDirective, string[]>>;\n env?: Record<string, string>;\n imageMinimumCacheTTL?: number;\n permissionsPolicy?: { camera?: \"none\" | \"self\" };\n mdx?: boolean;\n serwist?: boolean;\n securityHeaders?: boolean;\n authInterrupts?: boolean;\n reactCompiler?: boolean;\n rewrites?: NextConfig[\"rewrites\"];\n extend?: (config: NextConfig) => NextConfig;\n}\n\ntype RemotePattern = { protocol: \"http\" | \"https\"; hostname: string; port?: string };\n\nfunction parseImageSources(env: NodeJS.ProcessEnv): RemotePattern[] {\n return env.IMAGE_SOURCES\n ? env.IMAGE_SOURCES.split(\",\").map((url) => {\n const { hostname, protocol, port } = new URL(url.trim());\n return {\n protocol: protocol.replace(\":\", \"\") as RemotePattern[\"protocol\"],\n hostname,\n port: port || undefined,\n };\n })\n : [];\n}\n\nexport function createNextConfig(options: NjaNextConfigOptions): NextConfig {\n const env = process.env;\n const reactCompiler = options.reactCompiler === true;\n\n const config: NextConfig = {\n // The e2e stack (scripts/e2e.sh) runs a PRODUCTION build of this app while a\n // `next dev` server may still be running against the same worktree. `next\n // build` and `next dev` share `.next`, so a build performed underneath a live\n // dev server clobbers it and that dev server then 404s every route. Giving\n // the e2e build its own directory keeps the two independent. E2E_BUILD must\n // be set for `next build` AND for `next start`, or `start` looks in `.next`\n // and serves someone else's output.\n ...(env.E2E_BUILD === \"true\" ? { distDir: \".next-e2e\" } : {}),\n cacheComponents: true,\n partialPrefetching: true,\n reactCompiler,\n experimental: {\n serverActions: {\n bodySizeLimit: \"5mb\",\n },\n // Required by `unauthorized()` (next/navigation), which ServerSession.checkPermission\n // calls to deny access. Without this flag the function throws a plain Error instead of\n // rendering the nearest unauthorized.tsx.\n authInterrupts: options.authInterrupts ?? true,\n turbopackGc: true,\n turbopackLazyDynamicImports: true,\n ...(reactCompiler ? { turbopackRustReactCompiler: true } : {}),\n },\n allowedDevOrigins: options.devOrigins,\n pageExtensions: options.mdx ? [\"ts\", \"tsx\", \"mdx\"] : [\"ts\", \"tsx\"],\n images: {\n minimumCacheTTL: options.imageMinimumCacheTTL ?? 60,\n remotePatterns: parseImageSources(env),\n dangerouslyAllowLocalIP: true,\n },\n poweredByHeader: false,\n reactStrictMode: false,\n env: {\n NEXT_PUBLIC_API_URL: env.NEXT_PUBLIC_API_URL ?? \"\",\n NEXT_PUBLIC_ADDRESS: env.NEXT_PUBLIC_ADDRESS ?? \"\",\n NEXT_PUBLIC_VAPID_PUBLIC_KEY: env.NEXT_PUBLIC_VAPID_PUBLIC_KEY ?? \"\",\n NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY ?? \"\",\n ...options.env,\n },\n // Inlined replacement for @serwist/turbopack's withSerwist wrapper, which\n // does nothing but append these two entries. Requiring the package here\n // instead CRASHES production: it is a devDependency, next.config.js is loaded\n // at RUNTIME by `next start`, and the web-production image installs with\n // --prod. Do not re-add a require of any devDependency to this file.\n ...(options.serwist ? { serverExternalPackages: [\"esbuild\", \"esbuild-wasm\"] } : {}),\n // Next 16 builds AND serves dev with Turbopack, so this is what pins yjs to a\n // single instance in both modes.\n turbopack: {\n resolveAlias: {\n yjs: \"./node_modules/yjs\",\n },\n },\n };\n\n if (options.securityHeaders !== false) {\n config.headers = async () => buildSecurityHeaders(options, process.env);\n }\n\n if (options.rewrites) config.rewrites = options.rewrites;\n\n return options.extend ? options.extend(config) : config;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk6TUB7Y6Tjs = require('./chunk-6TUB7Y6T.js');
|
|
4
|
+
require('./chunk-7QVYU63E.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.serverRequest = _chunk6TUB7Y6Tjs.serverRequest;
|
|
8
|
+
//# sourceMappingURL=request-LZBAOT3Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/request-LZBAOT3Y.js"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,uDAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/request-LZBAOT3Y.js"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { A as ApiData } from '../ApiData-DPKNfY-9.mjs';
|
|
2
|
+
|
|
3
|
+
/** Reads the HTTP status from an `HTTP_<status>` digest, or `undefined` when there is none. */
|
|
4
|
+
declare function statusFromDigest(error: unknown): number | undefined;
|
|
5
|
+
|
|
6
|
+
interface CachedGetParams {
|
|
7
|
+
url: string;
|
|
8
|
+
/** A cacheLife profile name, or a tag. */
|
|
9
|
+
cache: string;
|
|
10
|
+
language: string;
|
|
11
|
+
companyId?: string;
|
|
12
|
+
additionalHeaders?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Token-free cached GET for shared data.
|
|
16
|
+
*
|
|
17
|
+
* The arguments are the cache key, so they never carry a token, a cookie value
|
|
18
|
+
* or a user id. The request is sent without `Authorization`: an endpoint that
|
|
19
|
+
* needs a token is per-user and must not set `cache`.
|
|
20
|
+
*
|
|
21
|
+
* A non-OK response or an unreachable API throws, so Next does not store the
|
|
22
|
+
* entry. The status travels in `error.digest` as `HTTP_<status>` (503 when the
|
|
23
|
+
* API is unreachable), because `digest` is the only property that survives
|
|
24
|
+
* into production. Read it back with `statusFromDigest`.
|
|
25
|
+
*/
|
|
26
|
+
declare function cachedServerGet(params: CachedGetParams): Promise<ApiData>;
|
|
27
|
+
|
|
28
|
+
export { type CachedGetParams, cachedServerGet, statusFromDigest };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { A as ApiData } from '../ApiData-DPKNfY-9.js';
|
|
2
|
+
|
|
3
|
+
/** Reads the HTTP status from an `HTTP_<status>` digest, or `undefined` when there is none. */
|
|
4
|
+
declare function statusFromDigest(error: unknown): number | undefined;
|
|
5
|
+
|
|
6
|
+
interface CachedGetParams {
|
|
7
|
+
url: string;
|
|
8
|
+
/** A cacheLife profile name, or a tag. */
|
|
9
|
+
cache: string;
|
|
10
|
+
language: string;
|
|
11
|
+
companyId?: string;
|
|
12
|
+
additionalHeaders?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Token-free cached GET for shared data.
|
|
16
|
+
*
|
|
17
|
+
* The arguments are the cache key, so they never carry a token, a cookie value
|
|
18
|
+
* or a user id. The request is sent without `Authorization`: an endpoint that
|
|
19
|
+
* needs a token is per-user and must not set `cache`.
|
|
20
|
+
*
|
|
21
|
+
* A non-OK response or an unreachable API throws, so Next does not store the
|
|
22
|
+
* entry. The status travels in `error.digest` as `HTTP_<status>` (503 when the
|
|
23
|
+
* API is unreachable), because `digest` is the only property that survives
|
|
24
|
+
* into production. Read it back with `statusFromDigest`.
|
|
25
|
+
*/
|
|
26
|
+
declare function cachedServerGet(params: CachedGetParams): Promise<ApiData>;
|
|
27
|
+
|
|
28
|
+
export { type CachedGetParams, cachedServerGet, statusFromDigest };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkOEOK6A3Pjs = require('../chunk-OEOK6A3P.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkIK65TDQHjs = require('../chunk-IK65TDQH.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
10
|
+
|
|
11
|
+
// src/server/cachedGet.ts
|
|
12
|
+
var _cache = require('next/cache');
|
|
13
|
+
function httpError(status, statusText) {
|
|
14
|
+
return Object.assign(new Error(statusText), { status, digest: `HTTP_${status}` });
|
|
15
|
+
}
|
|
16
|
+
_chunk7QVYU63Ejs.__name.call(void 0, httpError, "httpError");
|
|
17
|
+
async function cachedServerGet(params) {
|
|
18
|
+
"use cache";
|
|
19
|
+
if (_chunkIK65TDQHjs.CACHE_PROFILES.includes(params.cache)) {
|
|
20
|
+
_cache.cacheLife.call(void 0, params.cache);
|
|
21
|
+
} else {
|
|
22
|
+
_cache.cacheTag.call(void 0, params.cache);
|
|
23
|
+
_cache.cacheLife.call(void 0, "max");
|
|
24
|
+
}
|
|
25
|
+
const headers = {
|
|
26
|
+
Accept: "application/json",
|
|
27
|
+
...params.additionalHeaders,
|
|
28
|
+
"x-language": params.language
|
|
29
|
+
};
|
|
30
|
+
if (params.companyId) {
|
|
31
|
+
headers["x-companyid"] = params.companyId;
|
|
32
|
+
}
|
|
33
|
+
let apiResponse;
|
|
34
|
+
try {
|
|
35
|
+
apiResponse = await fetch(params.url, { method: "GET", headers });
|
|
36
|
+
} catch (e) {
|
|
37
|
+
throw httpError(503, "Service Unavailable");
|
|
38
|
+
}
|
|
39
|
+
if (!apiResponse.ok) {
|
|
40
|
+
throw httpError(apiResponse.status, apiResponse.statusText);
|
|
41
|
+
}
|
|
42
|
+
let data;
|
|
43
|
+
try {
|
|
44
|
+
data = await apiResponse.json();
|
|
45
|
+
} catch (e2) {
|
|
46
|
+
data = void 0;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
data,
|
|
50
|
+
ok: apiResponse.ok,
|
|
51
|
+
status: apiResponse.status,
|
|
52
|
+
statusText: apiResponse.statusText
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
_chunk7QVYU63Ejs.__name.call(void 0, cachedServerGet, "cachedServerGet");
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
exports.cachedServerGet = cachedServerGet; exports.statusFromDigest = _chunkOEOK6A3Pjs.statusFromDigest;
|
|
60
|
+
//# sourceMappingURL=cachedGet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/cachedGet.js","../../src/server/cachedGet.ts"],"names":[],"mappings":"AAAA;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACA;ACLA,mCAAoC;AAepC,SAAS,SAAA,CAAU,MAAA,EAAgB,UAAA,EAA2B;AAC5D,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,IAAI,KAAA,CAAM,UAAU,CAAA,EAAG,EAAE,MAAA,EAAQ,MAAA,EAAQ,CAAA,KAAA,EAAQ,MAAM,CAAA,EAAA;AAC9E;AAFS;AAgBwE;AAC/E,EAAA;AAE2D,EAAA;AACnB,IAAA;AACjC,EAAA;AACgB,IAAA;AACN,IAAA;AACjB,EAAA;AAEwC,EAAA;AAC9B,IAAA;AACE,IAAA;AACW,IAAA;AACvB,EAAA;AACsB,EAAA;AACY,IAAA;AAClC,EAAA;AAEI,EAAA;AACA,EAAA;AAC8D,IAAA;AAC1D,EAAA;AACoC,IAAA;AAC5C,EAAA;AAEqB,EAAA;AACuC,IAAA;AAC5D,EAAA;AAEI,EAAA;AACA,EAAA;AAC4B,IAAA;AACxB,EAAA;AACC,IAAA;AACT,EAAA;AAEO,EAAA;AACL,IAAA;AACgB,IAAA;AACI,IAAA;AACI,IAAA;AAC1B,EAAA;AACF;AA3CsB;ADmByD;AACA;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/cachedGet.js","sourcesContent":[null,"// Server-only utilities (NOT server actions - these cannot be called from client components)\n//\n// Reached through `@carlonicora/nextjs-jsonapi/cached-get` under the `react-server`\n// condition only; every other bundle gets `cachedGet.stub.ts` (see package.json).\n\nimport { cacheLife, cacheTag } from \"next/cache\";\nimport { ApiData } from \"../core/interfaces/ApiData\";\nimport { CACHE_PROFILES, CacheProfile } from \"./cacheProfiles\";\n\nexport { statusFromDigest } from \"./cacheDigest\";\n\nexport interface CachedGetParams {\n url: string;\n /** A cacheLife profile name, or a tag. */\n cache: string;\n language: string;\n companyId?: string;\n additionalHeaders?: Record<string, string>;\n}\n\nfunction httpError(status: number, statusText: string): Error {\n return Object.assign(new Error(statusText), { status, digest: `HTTP_${status}` });\n}\n\n/**\n * Token-free cached GET for shared data.\n *\n * The arguments are the cache key, so they never carry a token, a cookie value\n * or a user id. The request is sent without `Authorization`: an endpoint that\n * needs a token is per-user and must not set `cache`.\n *\n * A non-OK response or an unreachable API throws, so Next does not store the\n * entry. The status travels in `error.digest` as `HTTP_<status>` (503 when the\n * API is unreachable), because `digest` is the only property that survives\n * into production. Read it back with `statusFromDigest`.\n */\nexport async function cachedServerGet(params: CachedGetParams): Promise<ApiData> {\n \"use cache\";\n\n if (CACHE_PROFILES.includes(params.cache as CacheProfile)) {\n cacheLife(params.cache as CacheProfile);\n } else {\n cacheTag(params.cache);\n cacheLife(\"max\");\n }\n\n const headers: Record<string, string> = {\n Accept: \"application/json\",\n ...params.additionalHeaders,\n \"x-language\": params.language,\n };\n if (params.companyId) {\n headers[\"x-companyid\"] = params.companyId;\n }\n\n let apiResponse: Response;\n try {\n apiResponse = await fetch(params.url, { method: \"GET\", headers });\n } catch {\n throw httpError(503, \"Service Unavailable\");\n }\n\n if (!apiResponse.ok) {\n throw httpError(apiResponse.status, apiResponse.statusText);\n }\n\n let data: any;\n try {\n data = await apiResponse.json();\n } catch {\n data = undefined;\n }\n\n return {\n data,\n ok: apiResponse.ok,\n status: apiResponse.status,\n statusText: apiResponse.statusText,\n };\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
statusFromDigest
|
|
3
|
+
} from "../chunk-EBEXWN3I.mjs";
|
|
4
|
+
import {
|
|
5
|
+
CACHE_PROFILES
|
|
6
|
+
} from "../chunk-T7SAW3UW.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__name
|
|
9
|
+
} from "../chunk-PAWJFY3S.mjs";
|
|
10
|
+
|
|
11
|
+
// src/server/cachedGet.ts
|
|
12
|
+
import { cacheLife, cacheTag } from "next/cache";
|
|
13
|
+
function httpError(status, statusText) {
|
|
14
|
+
return Object.assign(new Error(statusText), { status, digest: `HTTP_${status}` });
|
|
15
|
+
}
|
|
16
|
+
__name(httpError, "httpError");
|
|
17
|
+
async function cachedServerGet(params) {
|
|
18
|
+
"use cache";
|
|
19
|
+
if (CACHE_PROFILES.includes(params.cache)) {
|
|
20
|
+
cacheLife(params.cache);
|
|
21
|
+
} else {
|
|
22
|
+
cacheTag(params.cache);
|
|
23
|
+
cacheLife("max");
|
|
24
|
+
}
|
|
25
|
+
const headers = {
|
|
26
|
+
Accept: "application/json",
|
|
27
|
+
...params.additionalHeaders,
|
|
28
|
+
"x-language": params.language
|
|
29
|
+
};
|
|
30
|
+
if (params.companyId) {
|
|
31
|
+
headers["x-companyid"] = params.companyId;
|
|
32
|
+
}
|
|
33
|
+
let apiResponse;
|
|
34
|
+
try {
|
|
35
|
+
apiResponse = await fetch(params.url, { method: "GET", headers });
|
|
36
|
+
} catch {
|
|
37
|
+
throw httpError(503, "Service Unavailable");
|
|
38
|
+
}
|
|
39
|
+
if (!apiResponse.ok) {
|
|
40
|
+
throw httpError(apiResponse.status, apiResponse.statusText);
|
|
41
|
+
}
|
|
42
|
+
let data;
|
|
43
|
+
try {
|
|
44
|
+
data = await apiResponse.json();
|
|
45
|
+
} catch {
|
|
46
|
+
data = void 0;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
data,
|
|
50
|
+
ok: apiResponse.ok,
|
|
51
|
+
status: apiResponse.status,
|
|
52
|
+
statusText: apiResponse.statusText
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
__name(cachedServerGet, "cachedServerGet");
|
|
56
|
+
export {
|
|
57
|
+
cachedServerGet,
|
|
58
|
+
statusFromDigest
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=cachedGet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/server/cachedGet.ts"],"sourcesContent":["// Server-only utilities (NOT server actions - these cannot be called from client components)\n//\n// Reached through `@carlonicora/nextjs-jsonapi/cached-get` under the `react-server`\n// condition only; every other bundle gets `cachedGet.stub.ts` (see package.json).\n\nimport { cacheLife, cacheTag } from \"next/cache\";\nimport { ApiData } from \"../core/interfaces/ApiData\";\nimport { CACHE_PROFILES, CacheProfile } from \"./cacheProfiles\";\n\nexport { statusFromDigest } from \"./cacheDigest\";\n\nexport interface CachedGetParams {\n url: string;\n /** A cacheLife profile name, or a tag. */\n cache: string;\n language: string;\n companyId?: string;\n additionalHeaders?: Record<string, string>;\n}\n\nfunction httpError(status: number, statusText: string): Error {\n return Object.assign(new Error(statusText), { status, digest: `HTTP_${status}` });\n}\n\n/**\n * Token-free cached GET for shared data.\n *\n * The arguments are the cache key, so they never carry a token, a cookie value\n * or a user id. The request is sent without `Authorization`: an endpoint that\n * needs a token is per-user and must not set `cache`.\n *\n * A non-OK response or an unreachable API throws, so Next does not store the\n * entry. The status travels in `error.digest` as `HTTP_<status>` (503 when the\n * API is unreachable), because `digest` is the only property that survives\n * into production. Read it back with `statusFromDigest`.\n */\nexport async function cachedServerGet(params: CachedGetParams): Promise<ApiData> {\n \"use cache\";\n\n if (CACHE_PROFILES.includes(params.cache as CacheProfile)) {\n cacheLife(params.cache as CacheProfile);\n } else {\n cacheTag(params.cache);\n cacheLife(\"max\");\n }\n\n const headers: Record<string, string> = {\n Accept: \"application/json\",\n ...params.additionalHeaders,\n \"x-language\": params.language,\n };\n if (params.companyId) {\n headers[\"x-companyid\"] = params.companyId;\n }\n\n let apiResponse: Response;\n try {\n apiResponse = await fetch(params.url, { method: \"GET\", headers });\n } catch {\n throw httpError(503, \"Service Unavailable\");\n }\n\n if (!apiResponse.ok) {\n throw httpError(apiResponse.status, apiResponse.statusText);\n }\n\n let data: any;\n try {\n data = await apiResponse.json();\n } catch {\n data = undefined;\n }\n\n return {\n data,\n ok: apiResponse.ok,\n status: apiResponse.status,\n statusText: apiResponse.statusText,\n };\n}\n"],"mappings":";;;;;;;;;;;AAKA,SAAS,WAAW,gBAAgB;AAepC,SAAS,UAAU,QAAgB,YAA2B;AAC5D,SAAO,OAAO,OAAO,IAAI,MAAM,UAAU,GAAG,EAAE,QAAQ,QAAQ,QAAQ,MAAM,GAAG,CAAC;AAClF;AAFS;AAgBT,eAAsB,gBAAgB,QAA2C;AAC/E;AAEA,MAAI,eAAe,SAAS,OAAO,KAAqB,GAAG;AACzD,cAAU,OAAO,KAAqB;AAAA,EACxC,OAAO;AACL,aAAS,OAAO,KAAK;AACrB,cAAU,KAAK;AAAA,EACjB;AAEA,QAAM,UAAkC;AAAA,IACtC,QAAQ;AAAA,IACR,GAAG,OAAO;AAAA,IACV,cAAc,OAAO;AAAA,EACvB;AACA,MAAI,OAAO,WAAW;AACpB,YAAQ,aAAa,IAAI,OAAO;AAAA,EAClC;AAEA,MAAI;AACJ,MAAI;AACF,kBAAc,MAAM,MAAM,OAAO,KAAK,EAAE,QAAQ,OAAO,QAAQ,CAAC;AAAA,EAClE,QAAQ;AACN,UAAM,UAAU,KAAK,qBAAqB;AAAA,EAC5C;AAEA,MAAI,CAAC,YAAY,IAAI;AACnB,UAAM,UAAU,YAAY,QAAQ,YAAY,UAAU;AAAA,EAC5D;AAEA,MAAI;AACJ,MAAI;AACF,WAAO,MAAM,YAAY,KAAK;AAAA,EAChC,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,IAAI,YAAY;AAAA,IAChB,QAAQ,YAAY;AAAA,IACpB,YAAY,YAAY;AAAA,EAC1B;AACF;AA3CsB;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { A as ApiData } from '../ApiData-DPKNfY-9.mjs';
|
|
2
|
+
import { CachedGetParams } from './cachedGet.mjs';
|
|
3
|
+
export { statusFromDigest } from './cachedGet.mjs';
|
|
4
|
+
|
|
5
|
+
declare function cachedServerGet(_params: CachedGetParams): Promise<ApiData>;
|
|
6
|
+
|
|
7
|
+
export { CachedGetParams, cachedServerGet };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { A as ApiData } from '../ApiData-DPKNfY-9.js';
|
|
2
|
+
import { CachedGetParams } from './cachedGet.js';
|
|
3
|
+
export { statusFromDigest } from './cachedGet.js';
|
|
4
|
+
|
|
5
|
+
declare function cachedServerGet(_params: CachedGetParams): Promise<ApiData>;
|
|
6
|
+
|
|
7
|
+
export { CachedGetParams, cachedServerGet };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkOEOK6A3Pjs = require('../chunk-OEOK6A3P.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
7
|
+
|
|
8
|
+
// src/server/cachedGet.stub.ts
|
|
9
|
+
async function cachedServerGet(_params) {
|
|
10
|
+
throw new Error("cachedServerGet is server-only: it was resolved outside the react-server condition");
|
|
11
|
+
}
|
|
12
|
+
_chunk7QVYU63Ejs.__name.call(void 0, cachedServerGet, "cachedServerGet");
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.cachedServerGet = cachedServerGet; exports.statusFromDigest = _chunkOEOK6A3Pjs.statusFromDigest;
|
|
17
|
+
//# sourceMappingURL=cachedGet.stub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/cachedGet.stub.js","../../src/server/cachedGet.stub.ts"],"names":[],"mappings":"AAAA;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACA;ACKA,MAAA,SAAsB,eAAA,CAAgB,OAAA,EAA4C;AAChF,EAAA,MAAM,IAAI,KAAA,CAAM,oFAAoF,CAAA;AACtG;AAFsB,qCAAA,eAAA,EAAA,iBAAA,CAAA;ADAtB;AACE;AACA;AACF,wGAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/server/cachedGet.stub.js","sourcesContent":[null,"// What `@carlonicora/nextjs-jsonapi/cached-get` resolves to outside the `react-server`\n// condition (client components, their SSR pass). The shared request code reaches\n// `serverRequest` from client hooks too, and Next rejects `\"use cache\"` and\n// `cacheLife`/`cacheTag` in those bundles. Nothing there calls the cached path: it\n// only runs on the server, where the real `cachedGet.ts` is resolved instead.\n\nimport type { ApiData } from \"../core/interfaces/ApiData\";\nimport type { CachedGetParams } from \"./cachedGet\";\n\nexport { statusFromDigest } from \"./cacheDigest\";\nexport type { CachedGetParams } from \"./cachedGet\";\n\nexport async function cachedServerGet(_params: CachedGetParams): Promise<ApiData> {\n throw new Error(\"cachedServerGet is server-only: it was resolved outside the react-server condition\");\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
statusFromDigest
|
|
3
|
+
} from "../chunk-EBEXWN3I.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "../chunk-PAWJFY3S.mjs";
|
|
7
|
+
|
|
8
|
+
// src/server/cachedGet.stub.ts
|
|
9
|
+
async function cachedServerGet(_params) {
|
|
10
|
+
throw new Error("cachedServerGet is server-only: it was resolved outside the react-server condition");
|
|
11
|
+
}
|
|
12
|
+
__name(cachedServerGet, "cachedServerGet");
|
|
13
|
+
export {
|
|
14
|
+
cachedServerGet,
|
|
15
|
+
statusFromDigest
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=cachedGet.stub.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/server/cachedGet.stub.ts"],"sourcesContent":["// What `@carlonicora/nextjs-jsonapi/cached-get` resolves to outside the `react-server`\n// condition (client components, their SSR pass). The shared request code reaches\n// `serverRequest` from client hooks too, and Next rejects `\"use cache\"` and\n// `cacheLife`/`cacheTag` in those bundles. Nothing there calls the cached path: it\n// only runs on the server, where the real `cachedGet.ts` is resolved instead.\n\nimport type { ApiData } from \"../core/interfaces/ApiData\";\nimport type { CachedGetParams } from \"./cachedGet\";\n\nexport { statusFromDigest } from \"./cacheDigest\";\nexport type { CachedGetParams } from \"./cachedGet\";\n\nexport async function cachedServerGet(_params: CachedGetParams): Promise<ApiData> {\n throw new Error(\"cachedServerGet is server-only: it was resolved outside the react-server condition\");\n}\n"],"mappings":";;;;;;;;AAYA,eAAsB,gBAAgB,SAA4C;AAChF,QAAM,IAAI,MAAM,oFAAoF;AACtG;AAFsB;","names":[]}
|