@mints-cloud/cxf-codegen 1.0.0

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.
Files changed (41) hide show
  1. package/README.md +117 -0
  2. package/dist/components/ApiCall.d.ts +19 -0
  3. package/dist/components/ApiCall.d.ts.map +1 -0
  4. package/dist/components/ApiCall.js +92 -0
  5. package/dist/components/IsrPageWrapper.d.ts +1 -0
  6. package/dist/components/IsrPageWrapper.d.ts.map +1 -0
  7. package/dist/components/IsrPageWrapper.js +1 -0
  8. package/dist/index.d.ts +12 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +53 -0
  11. package/dist/lib/api-call-hooks.d.ts +25 -0
  12. package/dist/lib/api-call-hooks.d.ts.map +1 -0
  13. package/dist/lib/api-call-hooks.js +267 -0
  14. package/dist/lib/api-route-helpers.d.ts +10 -0
  15. package/dist/lib/api-route-helpers.d.ts.map +1 -0
  16. package/dist/lib/api-route-helpers.js +73 -0
  17. package/dist/lib/cxf-auth.d.ts +43 -0
  18. package/dist/lib/cxf-auth.d.ts.map +1 -0
  19. package/dist/lib/cxf-auth.js +189 -0
  20. package/dist/lib/server-props.d.ts +77 -0
  21. package/dist/lib/server-props.d.ts.map +1 -0
  22. package/dist/lib/server-props.js +353 -0
  23. package/dist/next.config.d.ts +9 -0
  24. package/dist/next.config.d.ts.map +1 -0
  25. package/dist/next.config.js +19 -0
  26. package/dist/pages/api/assets.d.ts +4 -0
  27. package/dist/pages/api/assets.d.ts.map +1 -0
  28. package/dist/pages/api/assets.js +30 -0
  29. package/dist/pages/api/cxf.d.ts +4 -0
  30. package/dist/pages/api/cxf.d.ts.map +1 -0
  31. package/dist/pages/api/cxf.js +48 -0
  32. package/dist/pages/app.d.ts +4 -0
  33. package/dist/pages/app.d.ts.map +1 -0
  34. package/dist/pages/app.js +28 -0
  35. package/dist/pages/plasmic-host.d.ts +3 -0
  36. package/dist/pages/plasmic-host.d.ts.map +1 -0
  37. package/dist/pages/plasmic-host.js +15 -0
  38. package/dist/register.d.ts +2 -0
  39. package/dist/register.d.ts.map +1 -0
  40. package/dist/register.js +91 -0
  41. package/package.json +100 -0
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildQueryString = buildQueryString;
4
+ exports.normalizePath = normalizePath;
5
+ exports.setAuthCookies = setAuthCookies;
6
+ exports.handleError = handleError;
7
+ exports.sendResponse = sendResponse;
8
+ const cxf_auth_1 = require("./cxf-auth");
9
+ function buildQueryString(query) {
10
+ const params = new URLSearchParams();
11
+ Object.entries(query).forEach(([key, value]) => {
12
+ if (key !== "path" && value != null) {
13
+ if (Array.isArray(value)) {
14
+ value.forEach((v) => params.append(key, String(v)));
15
+ }
16
+ else {
17
+ params.append(key, String(value));
18
+ }
19
+ }
20
+ });
21
+ const str = params.toString();
22
+ return str ? `?${str}` : "";
23
+ }
24
+ function normalizePath(pathSegments) {
25
+ if (!pathSegments || (Array.isArray(pathSegments) && pathSegments.length === 0)) {
26
+ throw new Error("Missing path");
27
+ }
28
+ return (Array.isArray(pathSegments) ? pathSegments : [pathSegments])
29
+ .join("/")
30
+ .replace(/^\/+/, "");
31
+ }
32
+ function setAuthCookies(res, tokens) {
33
+ const cookieOptions = { secure: true, sameSite: "Lax", httpOnly: true, path: "/" };
34
+ const cookies = [];
35
+ if (tokens.accessToken) {
36
+ cookies.push((0, cxf_auth_1.buildCookieString)(cxf_auth_1.CXF_COOKIE_NAMES.ACCESS_TOKEN, tokens.accessToken, cookieOptions));
37
+ }
38
+ if (tokens.refreshToken) {
39
+ cookies.push((0, cxf_auth_1.buildCookieString)(cxf_auth_1.CXF_COOKIE_NAMES.REFRESH_TOKEN, tokens.refreshToken, cookieOptions));
40
+ }
41
+ if (cookies.length > 0) {
42
+ res.setHeader("Set-Cookie", cookies);
43
+ }
44
+ }
45
+ function handleError(res, err) {
46
+ const dev = process.env.NODE_ENV !== "production";
47
+ return res.status(500).json({
48
+ error: err?.message || "Unknown error",
49
+ ...(dev && { cause: err?.cause?.code || err?.code, note: "Check CXF_BASE_URL, protocol, DNS, and network reachability" }),
50
+ });
51
+ }
52
+ async function sendResponse(res, response) {
53
+ const contentType = response.headers.get("content-type") || "";
54
+ const status = response.status;
55
+ // JSON
56
+ if (contentType.includes("application/json")) {
57
+ const data = await response.json();
58
+ return res.status(status).json(data);
59
+ }
60
+ // Text (incl. SVG/XML)
61
+ if (contentType.startsWith("text/") || contentType.includes("xml") || contentType.includes("svg")) {
62
+ const text = await response.text();
63
+ if (contentType)
64
+ res.setHeader("content-type", contentType);
65
+ return res.status(status).send(text);
66
+ }
67
+ // Binary (images, files)
68
+ const arrayBuffer = await response.arrayBuffer();
69
+ const buffer = Buffer.from(arrayBuffer);
70
+ if (contentType)
71
+ res.setHeader("content-type", contentType);
72
+ return res.status(status).send(buffer);
73
+ }
@@ -0,0 +1,43 @@
1
+ export declare const CXF_COOKIE_NAMES: {
2
+ readonly ACCESS_TOKEN: "cxf_contact_access_token";
3
+ readonly REFRESH_TOKEN: "cxf_contact_refresh_token";
4
+ };
5
+ export declare const CXF_HEADER_NAMES: {
6
+ readonly ACCESS_TOKEN: "Access-Token";
7
+ readonly REFRESH_TOKEN: "Refresh-Token";
8
+ readonly API_KEY: "Api-Key";
9
+ readonly USER_TOKEN: "User-Token";
10
+ };
11
+ export interface CxfTokens {
12
+ accessToken: string | null;
13
+ refreshToken: string | null;
14
+ }
15
+ export declare function getTokensFromCookies(cookieHeader?: string | null): CxfTokens;
16
+ export declare function buildAuthHeaders(tokens: CxfTokens, apiKey?: string | null, userToken?: string | null): Record<string, string>;
17
+ export declare function makeAuthenticatedRequest(url: string, options?: {
18
+ method?: string;
19
+ body?: any;
20
+ tokens?: CxfTokens;
21
+ apiKey?: string | null;
22
+ userToken?: string | null;
23
+ cookieHeader?: string | null;
24
+ retryOnAuthError?: boolean;
25
+ }): Promise<{
26
+ response: Response;
27
+ newTokens: CxfTokens;
28
+ }>;
29
+ export declare function extractSetCookieHeaders(response: Response): string[];
30
+ export declare function extractTokensFromSetCookie(setCookieHeaders: string[] | null | undefined): CxfTokens;
31
+ export declare function buildCookieHeader(tokens: CxfTokens): string;
32
+ export declare function getCxfBaseUrl(): string;
33
+ export declare function getCxfApiKey(type?: "public" | "dev" | "user"): string | null;
34
+ export declare function buildCookieString(name: string, value: string, options?: {
35
+ secure?: boolean;
36
+ sameSite?: "Strict" | "Lax" | "None";
37
+ maxAge?: number;
38
+ path?: string;
39
+ httpOnly?: boolean;
40
+ }): string;
41
+ export declare function setTokensAsCookies(tokens: CxfTokens): void;
42
+ export declare function clearAuthCookies(): void;
43
+ //# sourceMappingURL=cxf-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cxf-auth.d.ts","sourceRoot":"","sources":["../../src/lib/cxf-auth.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAiBD,wBAAgB,oBAAoB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAS5E;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EACtB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACvB,GACL,OAAO,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC,CAmDD;AAMD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAAE,CAUpE;AAED,wBAAgB,0BAA0B,CACxC,gBAAgB,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAC5C,SAAS,CAmBX;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAS3D;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED,wBAAgB,YAAY,CAAC,IAAI,GAAE,QAAQ,GAAG,KAAK,GAAG,MAAiB,GAAG,MAAM,GAAG,IAAI,CAYtF;AAMD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACf,GACL,MAAM,CAaR;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuB1D;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAQvC"}
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ // CXF authentication and cookie handling utilities
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CXF_HEADER_NAMES = exports.CXF_COOKIE_NAMES = void 0;
5
+ exports.getTokensFromCookies = getTokensFromCookies;
6
+ exports.buildAuthHeaders = buildAuthHeaders;
7
+ exports.makeAuthenticatedRequest = makeAuthenticatedRequest;
8
+ exports.extractSetCookieHeaders = extractSetCookieHeaders;
9
+ exports.extractTokensFromSetCookie = extractTokensFromSetCookie;
10
+ exports.buildCookieHeader = buildCookieHeader;
11
+ exports.getCxfBaseUrl = getCxfBaseUrl;
12
+ exports.getCxfApiKey = getCxfApiKey;
13
+ exports.buildCookieString = buildCookieString;
14
+ exports.setTokensAsCookies = setTokensAsCookies;
15
+ exports.clearAuthCookies = clearAuthCookies;
16
+ exports.CXF_COOKIE_NAMES = {
17
+ ACCESS_TOKEN: "cxf_contact_access_token",
18
+ REFRESH_TOKEN: "cxf_contact_refresh_token",
19
+ };
20
+ exports.CXF_HEADER_NAMES = {
21
+ ACCESS_TOKEN: "Access-Token",
22
+ REFRESH_TOKEN: "Refresh-Token",
23
+ API_KEY: "Api-Key",
24
+ USER_TOKEN: "User-Token",
25
+ };
26
+ // ============================================================================
27
+ // Universal functions (work in both client and server)
28
+ // ============================================================================
29
+ function parseCookies(cookieString) {
30
+ const cookies = {};
31
+ cookieString.split(";").forEach((cookie) => {
32
+ const [name, ...rest] = cookie.trim().split("=");
33
+ if (name && rest.length > 0) {
34
+ cookies[name] = decodeURIComponent(rest.join("="));
35
+ }
36
+ });
37
+ return cookies;
38
+ }
39
+ function getTokensFromCookies(cookieHeader) {
40
+ const cookieString = typeof window !== "undefined" ? document.cookie : cookieHeader || "";
41
+ const cookies = parseCookies(cookieString);
42
+ return {
43
+ accessToken: cookies[exports.CXF_COOKIE_NAMES.ACCESS_TOKEN] || null,
44
+ refreshToken: cookies[exports.CXF_COOKIE_NAMES.REFRESH_TOKEN] || null,
45
+ };
46
+ }
47
+ function buildAuthHeaders(tokens, apiKey, userToken) {
48
+ const headers = {
49
+ Accept: "application/json",
50
+ "Content-Type": "application/json",
51
+ };
52
+ if (apiKey)
53
+ headers[exports.CXF_HEADER_NAMES.API_KEY] = apiKey;
54
+ if (tokens.accessToken)
55
+ headers[exports.CXF_HEADER_NAMES.ACCESS_TOKEN] = tokens.accessToken;
56
+ if (tokens.refreshToken)
57
+ headers[exports.CXF_HEADER_NAMES.REFRESH_TOKEN] = tokens.refreshToken;
58
+ if (userToken)
59
+ headers[exports.CXF_HEADER_NAMES.USER_TOKEN] = userToken;
60
+ return headers;
61
+ }
62
+ async function makeAuthenticatedRequest(url, options = {}) {
63
+ const { method = "GET", body, tokens: providedTokens, apiKey, userToken, cookieHeader, retryOnAuthError = true, } = options;
64
+ const tokens = providedTokens || getTokensFromCookies(cookieHeader);
65
+ const buildRequestOptions = (tokens, cookieStr) => {
66
+ const headers = buildAuthHeaders(tokens, apiKey, userToken);
67
+ if (cookieStr) {
68
+ headers.Cookie = cookieStr;
69
+ }
70
+ const requestOptions = { method, headers };
71
+ if (body && method !== "GET" && method !== "HEAD") {
72
+ requestOptions.body = typeof body === "string" ? body : JSON.stringify(body);
73
+ }
74
+ return requestOptions;
75
+ };
76
+ const cookieStr = cookieHeader || buildCookieHeader(tokens);
77
+ let response = await fetch(url, buildRequestOptions(tokens, cookieStr));
78
+ const setCookieHeaders = extractSetCookieHeaders(response);
79
+ let newTokens = extractTokensFromSetCookie(setCookieHeaders);
80
+ if (!newTokens.accessToken && !newTokens.refreshToken) {
81
+ newTokens = tokens;
82
+ }
83
+ if (retryOnAuthError &&
84
+ (response.status === 401 || response.status === 419) &&
85
+ (newTokens.accessToken || newTokens.refreshToken)) {
86
+ const retryCookieStr = buildCookieHeader(newTokens);
87
+ response = await fetch(url, buildRequestOptions(newTokens, retryCookieStr));
88
+ const retrySetCookieHeaders = extractSetCookieHeaders(response);
89
+ const retryTokens = extractTokensFromSetCookie(retrySetCookieHeaders);
90
+ if (retryTokens.accessToken || retryTokens.refreshToken) {
91
+ newTokens = retryTokens;
92
+ }
93
+ }
94
+ return { response, newTokens };
95
+ }
96
+ // ============================================================================
97
+ // Server-side only functions
98
+ // ============================================================================
99
+ function extractSetCookieHeaders(response) {
100
+ const headers = response.headers;
101
+ if (typeof headers.getSetCookie === "function") {
102
+ return headers.getSetCookie();
103
+ }
104
+ const rawHeaders = headers.raw?.() || {};
105
+ const setCookieRaw = rawHeaders["set-cookie"] || rawHeaders["Set-Cookie"] || [];
106
+ return Array.isArray(setCookieRaw) ? setCookieRaw : [setCookieRaw];
107
+ }
108
+ function extractTokensFromSetCookie(setCookieHeaders) {
109
+ const tokens = { accessToken: null, refreshToken: null };
110
+ if (!setCookieHeaders)
111
+ return tokens;
112
+ for (const header of setCookieHeaders) {
113
+ const match = header.match(/^([^=]+)=([^;]+)/);
114
+ if (!match)
115
+ continue;
116
+ const name = match[1].trim();
117
+ const value = match[2].trim();
118
+ if (name === exports.CXF_COOKIE_NAMES.ACCESS_TOKEN) {
119
+ tokens.accessToken = value;
120
+ }
121
+ else if (name === exports.CXF_COOKIE_NAMES.REFRESH_TOKEN) {
122
+ tokens.refreshToken = value;
123
+ }
124
+ }
125
+ return tokens;
126
+ }
127
+ function buildCookieHeader(tokens) {
128
+ const cookies = [];
129
+ if (tokens.accessToken) {
130
+ cookies.push(`${exports.CXF_COOKIE_NAMES.ACCESS_TOKEN}=${encodeURIComponent(tokens.accessToken)}`);
131
+ }
132
+ if (tokens.refreshToken) {
133
+ cookies.push(`${exports.CXF_COOKIE_NAMES.REFRESH_TOKEN}=${encodeURIComponent(tokens.refreshToken)}`);
134
+ }
135
+ return cookies.join("; ");
136
+ }
137
+ function getCxfBaseUrl() {
138
+ const baseUrl = (process.env.CXF_BASE_URL || process.env.URL || "").trim();
139
+ if (!baseUrl) {
140
+ throw new Error("Missing CXF_BASE_URL or URL environment variable");
141
+ }
142
+ return baseUrl.replace(/\/+$/, "");
143
+ }
144
+ function getCxfApiKey(type = "public") {
145
+ const envKeys = {
146
+ dev: ["CXF_DEV_API_KEY"],
147
+ user: ["CXF_USER_API_KEY"],
148
+ public: ["CXF_API_KEY", "API_KEY"],
149
+ };
150
+ const key = envKeys[type]
151
+ .map((k) => process.env[k])
152
+ .find((v) => v?.trim());
153
+ return key?.trim() || null;
154
+ }
155
+ // ============================================================================
156
+ // Client-side only functions
157
+ // ============================================================================
158
+ function buildCookieString(name, value, options = {}) {
159
+ const { secure = true, sameSite = "Lax", maxAge, path = "/", httpOnly } = options;
160
+ const parts = [
161
+ `${name}=${encodeURIComponent(value)}`,
162
+ `Path=${path}`,
163
+ maxAge && `Max-Age=${maxAge}`,
164
+ secure && "Secure",
165
+ httpOnly && "HttpOnly",
166
+ `SameSite=${sameSite}`,
167
+ ].filter(Boolean);
168
+ return parts.join("; ");
169
+ }
170
+ function setTokensAsCookies(tokens) {
171
+ if (typeof window === "undefined") {
172
+ console.warn("setTokensAsCookies can only be called client-side");
173
+ return;
174
+ }
175
+ const cookieOptions = { secure: true, sameSite: "Lax" };
176
+ if (tokens.accessToken) {
177
+ document.cookie = buildCookieString(exports.CXF_COOKIE_NAMES.ACCESS_TOKEN, tokens.accessToken, cookieOptions);
178
+ }
179
+ if (tokens.refreshToken) {
180
+ document.cookie = buildCookieString(exports.CXF_COOKIE_NAMES.REFRESH_TOKEN, tokens.refreshToken, cookieOptions);
181
+ }
182
+ }
183
+ function clearAuthCookies() {
184
+ if (typeof window === "undefined")
185
+ return;
186
+ const clearCookie = (name) => `${name}=; Path=/; Max-Age=0; Secure; SameSite=Lax`;
187
+ document.cookie = clearCookie(exports.CXF_COOKIE_NAMES.ACCESS_TOKEN);
188
+ document.cookie = clearCookie(exports.CXF_COOKIE_NAMES.REFRESH_TOKEN);
189
+ }
@@ -0,0 +1,77 @@
1
+ import * as React from "react";
2
+ import { GetStaticProps, GetServerSideProps } from "next";
3
+ import { ReactElement, ComponentType } from "react";
4
+ export interface EndpointConfig {
5
+ endpointPath: string;
6
+ params?: Record<string, any>;
7
+ }
8
+ export interface ServerPageProps {
9
+ queryCache?: Record<string, any>;
10
+ endpointData?: Record<string, any>;
11
+ buildId?: string;
12
+ buildTimestamp?: string;
13
+ queriesFound?: number;
14
+ _prefetchEnabled?: boolean;
15
+ }
16
+ export interface ServerPageWrapperProps extends ServerPageProps {
17
+ children: ReactElement;
18
+ }
19
+ export declare const EndpointDataContext: React.Context<Record<string, any>>;
20
+ export declare function normalizeEndpointPath(endpointPath: string): string;
21
+ export declare function buildQueryString(params?: Record<string, any>): string;
22
+ export declare function buildEndpointKey(endpointPath: string, params?: Record<string, any>): string;
23
+ export type PrefetchRequest = {
24
+ endpointPath: string;
25
+ params?: Record<string, any>;
26
+ };
27
+ export declare const PrefetchCollectorContext: React.Context<{
28
+ register: (req: PrefetchRequest) => void;
29
+ } | null>;
30
+ export declare function PrefetchCollectorProvider({ children, collector, }: {
31
+ children: React.ReactNode;
32
+ collector: PrefetchRequest[];
33
+ }): import("react/jsx-runtime").JSX.Element;
34
+ /**
35
+ * Wrapper component that provides pre-fetched data to child components.
36
+ *
37
+ * CACHING STRATEGY:
38
+ * - queryCache: Pre-fetched Plasmic query data (from extractPlasmicQueryData)
39
+ * - endpointData: Pre-fetched custom endpoint data (from ApiCall)
40
+ *
41
+ * Components receive data via React Context, eliminating client-side loading states.
42
+ * This enables instant page loads with zero API calls on initial render.
43
+ */
44
+ export declare function ServerPageWrapper({ children, queryCache, endpointData, buildId, buildTimestamp, queriesFound, }: ServerPageWrapperProps): import("react/jsx-runtime").JSX.Element;
45
+ /**
46
+ * Create Next.js data fetching functions with ISR/SSR support.
47
+ *
48
+ * PRERENDERING PROCESS:
49
+ * 1. Renders the Plasmic component to discover all API calls
50
+ * - extractPlasmicQueryData: Discovers Plasmic queries
51
+ * - PrefetchCollectorProvider: Collects ApiCall requests
52
+ *
53
+ * 2. Prefetches all discovered data in parallel
54
+ * - Fetches Plasmic query data
55
+ * - Fetches custom endpoint data (with Contact Auth when available)
56
+ * - Deduplicates requests by cache key
57
+ *
58
+ * 3. Returns props with data
59
+ * - ISR mode: Caches data with revalidate period (stale-while-revalidate)
60
+ * - SSR mode: Returns fresh data on every request
61
+ *
62
+ * CACHING BEHAVIOR:
63
+ * - ISR: Data cached at build time, regenerates in background after revalidate
64
+ * - SSR: Fresh data on every request, always has access to request cookies
65
+ */
66
+ export declare function createServerProps<P extends ServerPageProps = ServerPageProps>(path: string, PlasmicComponent: ComponentType<any>, options?: {
67
+ mode?: "isr" | "ssr";
68
+ revalidate?: number;
69
+ endpoints?: EndpointConfig[];
70
+ generateParams?: () => Promise<Array<{
71
+ [key: string]: string | string[];
72
+ }>>;
73
+ }): {
74
+ getStaticProps?: GetStaticProps<P>;
75
+ getServerSideProps?: GetServerSideProps<P>;
76
+ };
77
+ //# sourceMappingURL=server-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-props.d.ts","sourceRoot":"","sources":["../../src/lib/server-props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKpD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,QAAQ,EAAE,YAAY,CAAC;CACxB;AAID,eAAO,MAAM,mBAAmB,oCAA+C,CAAC;AAEhF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAGlE;AAGD,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAgBrE;AAID,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAI3F;AAeD,MAAM,MAAM,eAAe,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAAC;AACrF,eAAO,MAAM,wBAAwB;cACzB,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI;SAC3B,CAAC;AAIhB,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,2CAUA;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,OAAO,EACP,cAAc,EACd,YAAY,GACb,EAAE,sBAAsB,2CAwCxB;AAqID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAC3E,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,aAAa,CAAC,GAAG,CAAC,EACpC,OAAO,GAAE;IACP,IAAI,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC,CAAC;CACxE,GACL;IACD,cAAc,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACnC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAC5C,CAwGA"}