@uniformdev/canvas-next 19.19.0 → 19.20.1-alpha.32

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/index.esm.js CHANGED
@@ -161,7 +161,7 @@ var createPreviewHandler = ({ secret, enhance, resolveFullPath } = {}) => async
161
161
  res.setHeader("Access-Control-Allow-Origin", "*");
162
162
  res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept");
163
163
  res.setHeader("Access-Control-Allow-Methods", "GET");
164
- return res.status(204);
164
+ return res.status(204).end();
165
165
  }
166
166
  return res.status(501).json({ message: `Method "${method}" not implemented` });
167
167
  };
package/dist/index.js CHANGED
@@ -207,7 +207,7 @@ var createPreviewHandler = ({ secret, enhance, resolveFullPath } = {}) => async
207
207
  res.setHeader("Access-Control-Allow-Origin", "*");
208
208
  res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept");
209
209
  res.setHeader("Access-Control-Allow-Methods", "GET");
210
- return res.status(204);
210
+ return res.status(204).end();
211
211
  }
212
212
  return res.status(501).json({ message: `Method "${method}" not implemented` });
213
213
  };
package/dist/index.mjs CHANGED
@@ -161,7 +161,7 @@ var createPreviewHandler = ({ secret, enhance, resolveFullPath } = {}) => async
161
161
  res.setHeader("Access-Control-Allow-Origin", "*");
162
162
  res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Accept");
163
163
  res.setHeader("Access-Control-Allow-Methods", "GET");
164
- return res.status(204);
164
+ return res.status(204).end();
165
165
  }
166
166
  return res.status(501).json({ message: `Method "${method}" not implemented` });
167
167
  };
@@ -4,7 +4,7 @@ import { a as UniformPreviewData } from '../models-092c0912.js';
4
4
  import * as querystring from 'querystring';
5
5
  import { ParsedUrlQuery } from 'querystring';
6
6
  export { w as withUniformGetStaticPaths } from '../withUniformGetStaticPaths-6a31a8f8.js';
7
- import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, unstable_RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
7
+ import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
8
8
  import '@uniformdev/canvas-react';
9
9
  import '@uniformdev/project-map';
10
10
 
@@ -13,7 +13,7 @@ type HandleRouteNotFoundFunction<TContext, TResult> = (result: RouteGetResponseN
13
13
  type HandleRouteRedirectFunction<TContext, TResult> = (requestUrl: string, redirect: RouteGetResponseRedirect, context: TContext, defaultHandler: (redirect: RouteGetResponseRedirect) => TResult, duration: number) => TResult;
14
14
  type RouteHandlerOptions<TContext, TResult, TSuccessResult> = {
15
15
  /** If you need to override the default client, you can pass it here */
16
- client?: unstable_RouteClient;
16
+ client?: RouteClient;
17
17
  /** A string that you want to strip from the resolved context.resolvedUrl. Useful when calling from a nested folder which is not part of your project map structure */
18
18
  prefix?: string;
19
19
  /** Useful when you need to modify the path passed to the API */
@@ -40,18 +40,18 @@ type RouteHandlerOptions<TContext, TResult, TSuccessResult> = {
40
40
  * Static and dynamic routing as well as redirection is automatically supported.
41
41
  * Custom behavior can be added by passing in options to hook to specific processing events.
42
42
  */
43
- declare const unstable_withUniformGetServerSideProps: <TProps extends {
43
+ declare const withUniformGetServerSideProps: <TProps extends {
44
44
  [key: string]: any;
45
45
  } = {
46
46
  data: RootComponentInstance;
47
47
  }>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>> | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
48
48
 
49
49
  /**
50
- * Creates an implementation of `getServerSideProps` using the Uniform Route API.
50
+ * Creates an implementation of `getStaticProps` using the Uniform Route API.
51
51
  * Static and dynamic routing as well as redirection is automatically supported.
52
52
  * Custom behavior can be added by passing in options to hook to specific processing events.
53
53
  */
54
- declare const unstable_withUniformGetStaticProps: <TProps extends {
54
+ declare const withUniformGetStaticProps: <TProps extends {
55
55
  [key: string]: any;
56
56
  } = {
57
57
  data: RootComponentInstance;
@@ -60,7 +60,12 @@ declare const unstable_withUniformGetStaticProps: <TProps extends {
60
60
  param?: string | undefined;
61
61
  }) | undefined) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
62
62
 
63
- declare const unstable_getServerSideProps: next.GetServerSideProps<{
63
+ /**
64
+ * Default implementation of getServerSideProps with routes
65
+ * To configure custom behavior, use:
66
+ * export getServerSideProps = withUniformGetServerSideProps({ ... });
67
+ */
68
+ declare const getServerSideProps: next.GetServerSideProps<{
64
69
  data: {
65
70
  type: string;
66
71
  parameters?: {
@@ -179,7 +184,12 @@ declare const unstable_getServerSideProps: next.GetServerSideProps<{
179
184
  };
180
185
  }, querystring.ParsedUrlQuery, UniformPreviewData>;
181
186
 
182
- declare const unstable_getStaticProps: next.GetStaticProps<{
187
+ /**
188
+ * Default implementation of getStaticProps with routes
189
+ * To configure custom behavior, use:
190
+ * export getStaticProps = withUniformGetStaticProps({ ... });
191
+ */
192
+ declare const getStaticProps: next.GetStaticProps<{
183
193
  data: {
184
194
  type: string;
185
195
  parameters?: {
@@ -297,9 +307,16 @@ declare const unstable_getStaticProps: next.GetStaticProps<{
297
307
  } | undefined;
298
308
  };
299
309
  }, querystring.ParsedUrlQuery, UniformPreviewData>;
310
+ /**
311
+ * Default implementation of getStaticPaths with routes
312
+ * To configure custom behavior, use:
313
+ * export getStaticPaths = withUniformGetStaticProps({ ... });
314
+ *
315
+ * NOTE: fallback must be supported. You cannot generate static paths for dynamic routes which contain query parameters.
316
+ */
300
317
  declare const getStaticPaths: () => Promise<{
301
318
  paths: string[] | undefined;
302
319
  fallback: boolean;
303
320
  }>;
304
321
 
305
- export { HandleRouteCompositionFunction, HandleRouteNotFoundFunction, HandleRouteRedirectFunction, RouteHandlerOptions, getStaticPaths, unstable_getServerSideProps, unstable_getStaticProps, unstable_withUniformGetServerSideProps, unstable_withUniformGetStaticProps };
322
+ export { HandleRouteCompositionFunction, HandleRouteNotFoundFunction, HandleRouteRedirectFunction, RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticProps };
@@ -20,12 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/route/index.ts
21
21
  var route_exports = {};
22
22
  __export(route_exports, {
23
+ getServerSideProps: () => getServerSideProps2,
23
24
  getStaticPaths: () => getStaticPaths2,
24
- unstable_getServerSideProps: () => unstable_getServerSideProps,
25
- unstable_getStaticProps: () => unstable_getStaticProps,
26
- unstable_withUniformGetServerSideProps: () => unstable_withUniformGetServerSideProps,
27
- unstable_withUniformGetStaticProps: () => unstable_withUniformGetStaticProps,
28
- withUniformGetStaticPaths: () => withUniformGetStaticPaths
25
+ getStaticProps: () => getStaticProps2,
26
+ withUniformGetServerSideProps: () => withUniformGetServerSideProps2,
27
+ withUniformGetStaticPaths: () => withUniformGetStaticPaths,
28
+ withUniformGetStaticProps: () => withUniformGetStaticProps2
29
29
  });
30
30
  module.exports = __toCommonJS(route_exports);
31
31
 
@@ -356,7 +356,7 @@ function createRouteFetcher(options) {
356
356
  silent,
357
357
  parseContext
358
358
  } = options;
359
- const routeClient = client || new import_canvas4.unstable_RouteClient({
359
+ const routeClient = client || new import_canvas4.RouteClient({
360
360
  apiKey: process.env.UNIFORM_API_KEY,
361
361
  projectId: process.env.UNIFORM_PROJECT_ID,
362
362
  edgeApiHost: process.env.UNIFORM_CLI_BASE_EDGE_URL
@@ -463,7 +463,7 @@ function createRouteFetcher(options) {
463
463
  }
464
464
 
465
465
  // src/route/withUniformGetServerSideProps.ts
466
- var unstable_withUniformGetServerSideProps = (options) => {
466
+ var withUniformGetServerSideProps2 = (options) => {
467
467
  const defaultHandleRedirect = (requestUrl, matched) => {
468
468
  if (matched.redirect.targetStatusCode > 400) {
469
469
  return {
@@ -505,7 +505,7 @@ var unstable_withUniformGetServerSideProps = (options) => {
505
505
 
506
506
  // src/route/withUniformGetStaticProps.ts
507
507
  var import_redirect2 = require("@uniformdev/redirect");
508
- var unstable_withUniformGetStaticProps = (options) => {
508
+ var withUniformGetStaticProps2 = (options) => {
509
509
  const defaultHandleRedirect = (requestUrl, matched) => {
510
510
  return {
511
511
  redirect: {
@@ -544,15 +544,15 @@ var unstable_withUniformGetStaticProps = (options) => {
544
544
  };
545
545
 
546
546
  // src/route/index.ts
547
- var unstable_getServerSideProps = unstable_withUniformGetServerSideProps();
548
- var unstable_getStaticProps = unstable_withUniformGetStaticProps();
547
+ var getServerSideProps2 = withUniformGetServerSideProps2();
548
+ var getStaticProps2 = withUniformGetStaticProps2();
549
549
  var getStaticPaths2 = withUniformGetStaticPaths();
550
550
  // Annotate the CommonJS export names for ESM import in node:
551
551
  0 && (module.exports = {
552
+ getServerSideProps,
552
553
  getStaticPaths,
553
- unstable_getServerSideProps,
554
- unstable_getStaticProps,
555
- unstable_withUniformGetServerSideProps,
556
- unstable_withUniformGetStaticProps,
557
- withUniformGetStaticPaths
554
+ getStaticProps,
555
+ withUniformGetServerSideProps,
556
+ withUniformGetStaticPaths,
557
+ withUniformGetStaticProps
558
558
  });
@@ -63,7 +63,7 @@ import { RedirectClient } from "@uniformdev/redirect";
63
63
  import {
64
64
  ApiClientError,
65
65
  EMPTY_COMPOSITION,
66
- unstable_RouteClient
66
+ RouteClient
67
67
  } from "@uniformdev/canvas";
68
68
  import { red as red2 } from "colorette";
69
69
  function createRouteFetcher(options) {
@@ -82,7 +82,7 @@ function createRouteFetcher(options) {
82
82
  silent,
83
83
  parseContext
84
84
  } = options;
85
- const routeClient = client || new unstable_RouteClient({
85
+ const routeClient = client || new RouteClient({
86
86
  apiKey: process.env.UNIFORM_API_KEY,
87
87
  projectId: process.env.UNIFORM_PROJECT_ID,
88
88
  edgeApiHost: process.env.UNIFORM_CLI_BASE_EDGE_URL
@@ -189,7 +189,7 @@ function createRouteFetcher(options) {
189
189
  }
190
190
 
191
191
  // src/route/withUniformGetServerSideProps.ts
192
- var unstable_withUniformGetServerSideProps = (options) => {
192
+ var withUniformGetServerSideProps = (options) => {
193
193
  const defaultHandleRedirect = (requestUrl, matched) => {
194
194
  if (matched.redirect.targetStatusCode > 400) {
195
195
  return {
@@ -231,7 +231,7 @@ var unstable_withUniformGetServerSideProps = (options) => {
231
231
 
232
232
  // src/route/withUniformGetStaticProps.ts
233
233
  import { RedirectClient as RedirectClient2 } from "@uniformdev/redirect";
234
- var unstable_withUniformGetStaticProps = (options) => {
234
+ var withUniformGetStaticProps = (options) => {
235
235
  const defaultHandleRedirect = (requestUrl, matched) => {
236
236
  return {
237
237
  redirect: {
@@ -270,14 +270,14 @@ var unstable_withUniformGetStaticProps = (options) => {
270
270
  };
271
271
 
272
272
  // src/route/index.ts
273
- var unstable_getServerSideProps = unstable_withUniformGetServerSideProps();
274
- var unstable_getStaticProps = unstable_withUniformGetStaticProps();
273
+ var getServerSideProps = withUniformGetServerSideProps();
274
+ var getStaticProps = withUniformGetStaticProps();
275
275
  var getStaticPaths = withUniformGetStaticPaths();
276
276
  export {
277
+ getServerSideProps,
277
278
  getStaticPaths,
278
- unstable_getServerSideProps,
279
- unstable_getStaticProps,
280
- unstable_withUniformGetServerSideProps,
281
- unstable_withUniformGetStaticProps,
282
- withUniformGetStaticPaths
279
+ getStaticProps,
280
+ withUniformGetServerSideProps,
281
+ withUniformGetStaticPaths,
282
+ withUniformGetStaticProps
283
283
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next",
3
- "version": "19.19.0",
3
+ "version": "19.20.1-alpha.32+9ad53dedb",
4
4
  "description": "Next.js SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -63,11 +63,11 @@
63
63
  "document": "api-extractor run --local"
64
64
  },
65
65
  "dependencies": {
66
- "@uniformdev/canvas": "19.19.0",
67
- "@uniformdev/canvas-react": "19.19.0",
68
- "@uniformdev/project-map": "19.19.0",
69
- "@uniformdev/redirect": "19.19.0",
70
- "@uniformdev/richtext": "19.19.0",
66
+ "@uniformdev/canvas": "19.20.1-alpha.32+9ad53dedb",
67
+ "@uniformdev/canvas-react": "19.20.1-alpha.32+9ad53dedb",
68
+ "@uniformdev/project-map": "19.20.1-alpha.32+9ad53dedb",
69
+ "@uniformdev/redirect": "19.20.1-alpha.32+9ad53dedb",
70
+ "@uniformdev/richtext": "19.20.1-alpha.32+9ad53dedb",
71
71
  "colorette": "2.0.20"
72
72
  },
73
73
  "peerDependencies": {
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "631d1e21b1303220d80bea12611ea6c98d5fe354"
90
+ "gitHead": "9ad53dedb0a0c580abc314fe1422f48a09efd0aa"
91
91
  }