@uniformdev/canvas-next 20.74.6-alpha.2 → 20.74.7-alpha.12
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/project-map/index.d.mts +19 -9
- package/dist/project-map/index.d.ts +19 -9
- package/dist/project-map/index.js +8 -6
- package/dist/project-map/index.mjs +10 -8
- package/dist/route/index.js +1 -1
- package/dist/route/index.mjs +1 -1
- package/dist/slug/index.d.mts +23 -12
- package/dist/slug/index.d.ts +23 -12
- package/dist/slug/index.js +22 -14
- package/dist/slug/index.mjs +25 -17
- package/package.json +8 -8
|
@@ -2,7 +2,7 @@ import * as next from 'next';
|
|
|
2
2
|
import { GetServerSidePropsContext, PreviewData, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
3
|
import { a as UniformGetServerSideProps, c as UniformPreviewData, b as UniformGetStaticProps } from '../models-BGg_qtcM.mjs';
|
|
4
4
|
import * as node_querystring from 'node:querystring';
|
|
5
|
-
import { CanvasClient, CompositionGetByNodePathParameters, DataResolutionOption } from '@uniformdev/canvas';
|
|
5
|
+
import { CanvasClient, CompositionDeliveryClient, CompositionDeliveryReadOptions, CompositionGetByNodePathParameters, DataResolutionOption } from '@uniformdev/canvas';
|
|
6
6
|
import { ParsedUrlQuery } from 'querystring';
|
|
7
7
|
import { ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map';
|
|
8
8
|
import '@uniformdev/canvas-react';
|
|
@@ -12,8 +12,10 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
12
12
|
} = {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}>(options?: {
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* If you need to override the default client, you can pass it here.
|
|
17
|
+
*/
|
|
18
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
17
19
|
/** 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
20
|
prefix?: string;
|
|
19
21
|
/** Useful when you need to modify the path passed to the API */
|
|
@@ -21,8 +23,11 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
21
23
|
/** Set to true if you want to include draft compositions */
|
|
22
24
|
preview?: boolean;
|
|
23
25
|
projectMapId?: string;
|
|
24
|
-
/** Way to override
|
|
25
|
-
requestOptions?: Omit<Partial<
|
|
26
|
+
/** Way to override get request params */
|
|
27
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
28
|
+
projectMapNodePath: string;
|
|
29
|
+
projectMapId?: string;
|
|
30
|
+
}>, "state"> | Omit<Partial<CompositionGetByNodePathParameters & DataResolutionOption>, "state">;
|
|
26
31
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
27
32
|
callback?: UniformGetServerSideProps<TProps>;
|
|
28
33
|
/** Disables logging of response information and timings */
|
|
@@ -60,10 +65,15 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
60
65
|
modifyPath?: (path: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string;
|
|
61
66
|
/** Set to true if you want to include draft compositions */
|
|
62
67
|
preview?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
/**
|
|
69
|
+
* If you need to override the default client, you can pass it here.
|
|
70
|
+
*/
|
|
71
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
72
|
+
/** Way to override get request params */
|
|
73
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
74
|
+
projectMapNodePath: string;
|
|
75
|
+
projectMapId?: string;
|
|
76
|
+
}>, "state"> | Omit<Partial<CompositionGetByNodePathParameters & DataResolutionOption>, "state">;
|
|
67
77
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
68
78
|
callback?: UniformGetStaticProps<TProps>;
|
|
69
79
|
/** Disables logging of response information and timings */
|
|
@@ -2,7 +2,7 @@ import * as next from 'next';
|
|
|
2
2
|
import { GetServerSidePropsContext, PreviewData, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
3
|
import { a as UniformGetServerSideProps, c as UniformPreviewData, b as UniformGetStaticProps } from '../models-BGg_qtcM.js';
|
|
4
4
|
import * as node_querystring from 'node:querystring';
|
|
5
|
-
import { CanvasClient, CompositionGetByNodePathParameters, DataResolutionOption } from '@uniformdev/canvas';
|
|
5
|
+
import { CanvasClient, CompositionDeliveryClient, CompositionDeliveryReadOptions, CompositionGetByNodePathParameters, DataResolutionOption } from '@uniformdev/canvas';
|
|
6
6
|
import { ParsedUrlQuery } from 'querystring';
|
|
7
7
|
import { ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map';
|
|
8
8
|
import '@uniformdev/canvas-react';
|
|
@@ -12,8 +12,10 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
12
12
|
} = {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}>(options?: {
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* If you need to override the default client, you can pass it here.
|
|
17
|
+
*/
|
|
18
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
17
19
|
/** 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
20
|
prefix?: string;
|
|
19
21
|
/** Useful when you need to modify the path passed to the API */
|
|
@@ -21,8 +23,11 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
21
23
|
/** Set to true if you want to include draft compositions */
|
|
22
24
|
preview?: boolean;
|
|
23
25
|
projectMapId?: string;
|
|
24
|
-
/** Way to override
|
|
25
|
-
requestOptions?: Omit<Partial<
|
|
26
|
+
/** Way to override get request params */
|
|
27
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
28
|
+
projectMapNodePath: string;
|
|
29
|
+
projectMapId?: string;
|
|
30
|
+
}>, "state"> | Omit<Partial<CompositionGetByNodePathParameters & DataResolutionOption>, "state">;
|
|
26
31
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
27
32
|
callback?: UniformGetServerSideProps<TProps>;
|
|
28
33
|
/** Disables logging of response information and timings */
|
|
@@ -60,10 +65,15 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
60
65
|
modifyPath?: (path: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string;
|
|
61
66
|
/** Set to true if you want to include draft compositions */
|
|
62
67
|
preview?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
/**
|
|
69
|
+
* If you need to override the default client, you can pass it here.
|
|
70
|
+
*/
|
|
71
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
72
|
+
/** Way to override get request params */
|
|
73
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
74
|
+
projectMapNodePath: string;
|
|
75
|
+
projectMapId?: string;
|
|
76
|
+
}>, "state"> | Omit<Partial<CompositionGetByNodePathParameters & DataResolutionOption>, "state">;
|
|
67
77
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
68
78
|
callback?: UniformGetStaticProps<TProps>;
|
|
69
79
|
/** Disables logging of response information and timings */
|
|
@@ -152,7 +152,7 @@ function resolveDiagnosticsDuration(data) {
|
|
|
152
152
|
|
|
153
153
|
// src/project-map/withUniformGetServerSideProps.ts
|
|
154
154
|
var withUniformGetServerSideProps = (options) => {
|
|
155
|
-
const canvasClient = (options == null ? void 0 : options.client) || new import_canvas.
|
|
155
|
+
const canvasClient = (options == null ? void 0 : options.client) || new import_canvas.CompositionDeliveryClient({
|
|
156
156
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
157
157
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
158
158
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -177,13 +177,14 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
177
177
|
} else {
|
|
178
178
|
try {
|
|
179
179
|
const time = Date.now();
|
|
180
|
-
const
|
|
180
|
+
const getParams = {
|
|
181
181
|
...options == null ? void 0 : options.requestOptions,
|
|
182
182
|
projectMapId,
|
|
183
183
|
projectMapNodePath: nodePath,
|
|
184
184
|
state: preview || (options == null ? void 0 : options.preview) ? import_canvas.CANVAS_DRAFT_STATE : import_canvas.CANVAS_PUBLISHED_STATE,
|
|
185
185
|
releaseId
|
|
186
|
-
}
|
|
186
|
+
};
|
|
187
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionByNodePath(getParams);
|
|
187
188
|
const duration = Date.now() - time;
|
|
188
189
|
composition = response.composition;
|
|
189
190
|
if (!(options == null ? void 0 : options.silent)) {
|
|
@@ -251,7 +252,7 @@ var resolveSlugFromParams = ({
|
|
|
251
252
|
// src/project-map/withUniformGetStaticProps.ts
|
|
252
253
|
var withUniformGetStaticProps = (options) => {
|
|
253
254
|
var _a;
|
|
254
|
-
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new import_canvas3.
|
|
255
|
+
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new import_canvas3.CompositionDeliveryClient({
|
|
255
256
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
256
257
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
257
258
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -279,13 +280,14 @@ var withUniformGetStaticProps = (options) => {
|
|
|
279
280
|
} else {
|
|
280
281
|
try {
|
|
281
282
|
const time = Date.now();
|
|
282
|
-
const
|
|
283
|
+
const getParams = {
|
|
283
284
|
...options == null ? void 0 : options.requestOptions,
|
|
284
285
|
projectMapId,
|
|
285
286
|
projectMapNodePath: pathString,
|
|
286
287
|
state: preview || (options == null ? void 0 : options.preview) ? import_canvas3.CANVAS_DRAFT_STATE : import_canvas3.CANVAS_PUBLISHED_STATE,
|
|
287
288
|
releaseId
|
|
288
|
-
}
|
|
289
|
+
};
|
|
290
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionByNodePath(getParams);
|
|
289
291
|
const duration = Date.now() - time;
|
|
290
292
|
composition = response.composition;
|
|
291
293
|
if (!(options == null ? void 0 : options.silent)) {
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
CANVAS_DRAFT_STATE,
|
|
12
12
|
CANVAS_PUBLISHED_STATE,
|
|
13
|
-
|
|
13
|
+
CompositionDeliveryClient,
|
|
14
14
|
EMPTY_COMPOSITION
|
|
15
15
|
} from "@uniformdev/canvas";
|
|
16
16
|
var withUniformGetServerSideProps = (options) => {
|
|
17
|
-
const canvasClient = (options == null ? void 0 : options.client) || new
|
|
17
|
+
const canvasClient = (options == null ? void 0 : options.client) || new CompositionDeliveryClient({
|
|
18
18
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
19
19
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
20
20
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -39,13 +39,14 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
39
39
|
} else {
|
|
40
40
|
try {
|
|
41
41
|
const time = Date.now();
|
|
42
|
-
const
|
|
42
|
+
const getParams = {
|
|
43
43
|
...options == null ? void 0 : options.requestOptions,
|
|
44
44
|
projectMapId,
|
|
45
45
|
projectMapNodePath: nodePath,
|
|
46
46
|
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE,
|
|
47
47
|
releaseId
|
|
48
|
-
}
|
|
48
|
+
};
|
|
49
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionByNodePath(getParams);
|
|
49
50
|
const duration = Date.now() - time;
|
|
50
51
|
composition = response.composition;
|
|
51
52
|
if (!(options == null ? void 0 : options.silent)) {
|
|
@@ -103,12 +104,12 @@ var withUniformGetStaticPaths = (options) => {
|
|
|
103
104
|
import {
|
|
104
105
|
CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3,
|
|
105
106
|
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3,
|
|
106
|
-
|
|
107
|
+
CompositionDeliveryClient as CompositionDeliveryClient2,
|
|
107
108
|
EMPTY_COMPOSITION as EMPTY_COMPOSITION2
|
|
108
109
|
} from "@uniformdev/canvas";
|
|
109
110
|
var withUniformGetStaticProps = (options) => {
|
|
110
111
|
var _a;
|
|
111
|
-
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new
|
|
112
|
+
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new CompositionDeliveryClient2({
|
|
112
113
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
113
114
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
114
115
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -136,13 +137,14 @@ var withUniformGetStaticProps = (options) => {
|
|
|
136
137
|
} else {
|
|
137
138
|
try {
|
|
138
139
|
const time = Date.now();
|
|
139
|
-
const
|
|
140
|
+
const getParams = {
|
|
140
141
|
...options == null ? void 0 : options.requestOptions,
|
|
141
142
|
projectMapId,
|
|
142
143
|
projectMapNodePath: pathString,
|
|
143
144
|
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE3 : CANVAS_PUBLISHED_STATE3,
|
|
144
145
|
releaseId
|
|
145
|
-
}
|
|
146
|
+
};
|
|
147
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionByNodePath(getParams);
|
|
146
148
|
const duration = Date.now() - time;
|
|
147
149
|
composition = response.composition;
|
|
148
150
|
if (!(options == null ? void 0 : options.silent)) {
|
package/dist/route/index.js
CHANGED
|
@@ -309,7 +309,7 @@ function createRouteFetcher(options) {
|
|
|
309
309
|
previewReleaseId
|
|
310
310
|
});
|
|
311
311
|
const time = Date.now();
|
|
312
|
-
const response = await routeClient.
|
|
312
|
+
const response = await routeClient.get({
|
|
313
313
|
...resolvedOptions,
|
|
314
314
|
state: (_b = (_a = resolvedOptions == null ? void 0 : resolvedOptions.state) != null ? _a : defaultPreviewState) != null ? _b : import_canvas.CANVAS_PUBLISHED_STATE,
|
|
315
315
|
dataSourceVariant: (0, import_canvas.getDataSourceVariantFromRouteGetParams)(
|
package/dist/route/index.mjs
CHANGED
|
@@ -173,7 +173,7 @@ function createRouteFetcher(options) {
|
|
|
173
173
|
previewReleaseId
|
|
174
174
|
});
|
|
175
175
|
const time = Date.now();
|
|
176
|
-
const response = await routeClient.
|
|
176
|
+
const response = await routeClient.get({
|
|
177
177
|
...resolvedOptions,
|
|
178
178
|
state: (_b = (_a = resolvedOptions == null ? void 0 : resolvedOptions.state) != null ? _a : defaultPreviewState) != null ? _b : CANVAS_PUBLISHED_STATE,
|
|
179
179
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams(
|
package/dist/slug/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as next from 'next';
|
|
|
2
2
|
import { GetServerSidePropsContext, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
3
|
import { c as UniformPreviewData, a as UniformGetServerSideProps, b as UniformGetStaticProps } from '../models-BGg_qtcM.mjs';
|
|
4
4
|
import * as node_querystring from 'node:querystring';
|
|
5
|
-
import { CanvasClient, CompositionGetBySlugParameters, DataResolutionOption, CompositionGetParameters, CompositionGetResponse } from '@uniformdev/canvas';
|
|
5
|
+
import { CanvasClient, CompositionDeliveryClient, CompositionDeliveryReadOptions, CompositionGetBySlugParameters, DataResolutionOption, CompositionManagementListQuery, CompositionGetParameters, CompositionGetResponse, CompositionManagementClient } from '@uniformdev/canvas';
|
|
6
6
|
import { ParsedUrlQuery } from 'querystring';
|
|
7
7
|
import '@uniformdev/canvas-react';
|
|
8
8
|
|
|
@@ -17,9 +17,13 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
17
17
|
modifySlug?: (slug: string, context: GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>) => string;
|
|
18
18
|
/** Set to true if you want to include draft compositions */
|
|
19
19
|
preview?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/**
|
|
21
|
+
* If you need to override the default client, you can pass it here.
|
|
22
|
+
*/
|
|
23
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
24
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
25
|
+
slug: string;
|
|
26
|
+
}>, "state"> | Omit<Partial<CompositionGetBySlugParameters & DataResolutionOption>, "state">;
|
|
23
27
|
callback?: UniformGetServerSideProps<TProps>;
|
|
24
28
|
/** Disables logging of response information and timings */
|
|
25
29
|
silent?: boolean;
|
|
@@ -31,12 +35,14 @@ declare const withUniformGetStaticPaths: (options?: {
|
|
|
31
35
|
prefix?: string;
|
|
32
36
|
/** Set to true if you want to include draft compositions */
|
|
33
37
|
preview?: boolean;
|
|
34
|
-
/** Way to override
|
|
35
|
-
requestOptions?: Partial<CompositionGetParameters>;
|
|
38
|
+
/** Way to override list request params */
|
|
39
|
+
requestOptions?: Partial<CompositionManagementListQuery> | Partial<CompositionGetParameters>;
|
|
36
40
|
/** Way to modify list of slugs before building array of paths */
|
|
37
41
|
callback?: (compositions: CompositionGetResponse[]) => Promise<CompositionGetResponse[]>;
|
|
38
|
-
/**
|
|
39
|
-
|
|
42
|
+
/**
|
|
43
|
+
* If you need to override the default client, you can pass it here.
|
|
44
|
+
*/
|
|
45
|
+
client?: CanvasClient | CompositionManagementClient;
|
|
40
46
|
}) => () => Promise<{
|
|
41
47
|
paths: string[];
|
|
42
48
|
fallback: boolean;
|
|
@@ -53,10 +59,15 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
53
59
|
modifySlug?: (slug: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string;
|
|
54
60
|
/** Set to true if you want to include draft compositions */
|
|
55
61
|
preview?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
/**
|
|
63
|
+
* If you need to override the default client, you can pass it here.
|
|
64
|
+
* @deprecated Passing a `CanvasClient` is deprecated; pass a `CompositionDeliveryClient` instead.
|
|
65
|
+
*/
|
|
66
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
67
|
+
/** Way to override get request params */
|
|
68
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
69
|
+
slug: string;
|
|
70
|
+
}>, "state"> | Omit<Partial<CompositionGetBySlugParameters & DataResolutionOption>, "state">;
|
|
60
71
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
61
72
|
callback?: UniformGetStaticProps<TProps>;
|
|
62
73
|
/** Disables logging of response information and timings */
|
package/dist/slug/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as next from 'next';
|
|
|
2
2
|
import { GetServerSidePropsContext, GetServerSideProps, GetStaticPropsContext, GetStaticProps } from 'next';
|
|
3
3
|
import { c as UniformPreviewData, a as UniformGetServerSideProps, b as UniformGetStaticProps } from '../models-BGg_qtcM.js';
|
|
4
4
|
import * as node_querystring from 'node:querystring';
|
|
5
|
-
import { CanvasClient, CompositionGetBySlugParameters, DataResolutionOption, CompositionGetParameters, CompositionGetResponse } from '@uniformdev/canvas';
|
|
5
|
+
import { CanvasClient, CompositionDeliveryClient, CompositionDeliveryReadOptions, CompositionGetBySlugParameters, DataResolutionOption, CompositionManagementListQuery, CompositionGetParameters, CompositionGetResponse, CompositionManagementClient } from '@uniformdev/canvas';
|
|
6
6
|
import { ParsedUrlQuery } from 'querystring';
|
|
7
7
|
import '@uniformdev/canvas-react';
|
|
8
8
|
|
|
@@ -17,9 +17,13 @@ declare const withUniformGetServerSideProps: <TProps extends {
|
|
|
17
17
|
modifySlug?: (slug: string, context: GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>) => string;
|
|
18
18
|
/** Set to true if you want to include draft compositions */
|
|
19
19
|
preview?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/**
|
|
21
|
+
* If you need to override the default client, you can pass it here.
|
|
22
|
+
*/
|
|
23
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
24
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
25
|
+
slug: string;
|
|
26
|
+
}>, "state"> | Omit<Partial<CompositionGetBySlugParameters & DataResolutionOption>, "state">;
|
|
23
27
|
callback?: UniformGetServerSideProps<TProps>;
|
|
24
28
|
/** Disables logging of response information and timings */
|
|
25
29
|
silent?: boolean;
|
|
@@ -31,12 +35,14 @@ declare const withUniformGetStaticPaths: (options?: {
|
|
|
31
35
|
prefix?: string;
|
|
32
36
|
/** Set to true if you want to include draft compositions */
|
|
33
37
|
preview?: boolean;
|
|
34
|
-
/** Way to override
|
|
35
|
-
requestOptions?: Partial<CompositionGetParameters>;
|
|
38
|
+
/** Way to override list request params */
|
|
39
|
+
requestOptions?: Partial<CompositionManagementListQuery> | Partial<CompositionGetParameters>;
|
|
36
40
|
/** Way to modify list of slugs before building array of paths */
|
|
37
41
|
callback?: (compositions: CompositionGetResponse[]) => Promise<CompositionGetResponse[]>;
|
|
38
|
-
/**
|
|
39
|
-
|
|
42
|
+
/**
|
|
43
|
+
* If you need to override the default client, you can pass it here.
|
|
44
|
+
*/
|
|
45
|
+
client?: CanvasClient | CompositionManagementClient;
|
|
40
46
|
}) => () => Promise<{
|
|
41
47
|
paths: string[];
|
|
42
48
|
fallback: boolean;
|
|
@@ -53,10 +59,15 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
53
59
|
modifySlug?: (slug: string, context: GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>) => string;
|
|
54
60
|
/** Set to true if you want to include draft compositions */
|
|
55
61
|
preview?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
/**
|
|
63
|
+
* If you need to override the default client, you can pass it here.
|
|
64
|
+
* @deprecated Passing a `CanvasClient` is deprecated; pass a `CompositionDeliveryClient` instead.
|
|
65
|
+
*/
|
|
66
|
+
client?: CanvasClient | CompositionDeliveryClient;
|
|
67
|
+
/** Way to override get request params */
|
|
68
|
+
requestOptions?: Omit<Partial<CompositionDeliveryReadOptions & {
|
|
69
|
+
slug: string;
|
|
70
|
+
}>, "state"> | Omit<Partial<CompositionGetBySlugParameters & DataResolutionOption>, "state">;
|
|
60
71
|
/** Custom handler to specify return value and modify composition - e.g. enhance with CMS data */
|
|
61
72
|
callback?: UniformGetStaticProps<TProps>;
|
|
62
73
|
/** Disables logging of response information and timings */
|
package/dist/slug/index.js
CHANGED
|
@@ -152,7 +152,7 @@ function resolveDiagnosticsDuration(data) {
|
|
|
152
152
|
|
|
153
153
|
// src/slug/withUniformGetServerSideProps.ts
|
|
154
154
|
var withUniformGetServerSideProps = (options) => {
|
|
155
|
-
const canvasClient = (options == null ? void 0 : options.client) || new import_canvas.
|
|
155
|
+
const canvasClient = (options == null ? void 0 : options.client) || new import_canvas.CompositionDeliveryClient({
|
|
156
156
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
157
157
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
158
158
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -176,13 +176,14 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
176
176
|
} else {
|
|
177
177
|
try {
|
|
178
178
|
const time = Date.now();
|
|
179
|
-
const
|
|
179
|
+
const getParams = {
|
|
180
180
|
...options == null ? void 0 : options.requestOptions,
|
|
181
181
|
slug,
|
|
182
182
|
state: preview || (options == null ? void 0 : options.preview) ? import_canvas.CANVAS_DRAFT_STATE : import_canvas.CANVAS_PUBLISHED_STATE,
|
|
183
183
|
diagnostics: true,
|
|
184
184
|
releaseId
|
|
185
|
-
}
|
|
185
|
+
};
|
|
186
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionBySlug(getParams);
|
|
186
187
|
const duration = Date.now() - time;
|
|
187
188
|
composition = response.composition;
|
|
188
189
|
if (!(options == null ? void 0 : options.silent)) {
|
|
@@ -209,16 +210,22 @@ var import_canvas2 = require("@uniformdev/canvas");
|
|
|
209
210
|
var withUniformGetStaticPaths = (options) => {
|
|
210
211
|
return async function wrappedGetStaticPaths() {
|
|
211
212
|
var _a;
|
|
212
|
-
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a :
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : (
|
|
214
|
+
// Build-time path enumeration only needs `_slug`, so read the lightweight
|
|
215
|
+
// canonical list from the origin (not the edge). bypassCache:false keeps the
|
|
216
|
+
// CDN-cacheable behavior of the old base CanvasClient at build time.
|
|
217
|
+
new import_canvas2.CompositionManagementClient({
|
|
218
|
+
apiKey: process.env.UNIFORM_API_KEY,
|
|
219
|
+
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
220
|
+
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
221
|
+
bypassCache: false
|
|
222
|
+
})
|
|
223
|
+
);
|
|
224
|
+
const listParams = {
|
|
219
225
|
...options == null ? void 0 : options.requestOptions,
|
|
220
226
|
state: (options == null ? void 0 : options.preview) ? import_canvas2.CANVAS_DRAFT_STATE : import_canvas2.CANVAS_PUBLISHED_STATE
|
|
221
|
-
}
|
|
227
|
+
};
|
|
228
|
+
const response = "list" in canvasClient ? await canvasClient.list(listParams) : await canvasClient.getCompositionList(listParams);
|
|
222
229
|
const compositions = (options == null ? void 0 : options.callback) ? await options.callback(response.compositions) : response.compositions;
|
|
223
230
|
const paths = compositions.filter((reference) => !!reference.composition._slug).map((composition) => {
|
|
224
231
|
var _a2;
|
|
@@ -247,7 +254,7 @@ var resolveSlugFromParams = ({
|
|
|
247
254
|
// src/slug/withUniformGetStaticProps.ts
|
|
248
255
|
var withUniformGetStaticProps = (options) => {
|
|
249
256
|
var _a;
|
|
250
|
-
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new import_canvas3.
|
|
257
|
+
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new import_canvas3.CompositionDeliveryClient({
|
|
251
258
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
252
259
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
253
260
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -274,12 +281,13 @@ var withUniformGetStaticProps = (options) => {
|
|
|
274
281
|
} else {
|
|
275
282
|
try {
|
|
276
283
|
const time = Date.now();
|
|
277
|
-
const
|
|
284
|
+
const getParams = {
|
|
278
285
|
slug: slugString,
|
|
279
286
|
state: preview || (options == null ? void 0 : options.preview) ? import_canvas3.CANVAS_DRAFT_STATE : import_canvas3.CANVAS_PUBLISHED_STATE,
|
|
280
287
|
...options == null ? void 0 : options.requestOptions,
|
|
281
288
|
releaseId
|
|
282
|
-
}
|
|
289
|
+
};
|
|
290
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionBySlug(getParams);
|
|
283
291
|
const duration = Date.now() - time;
|
|
284
292
|
composition = response.composition;
|
|
285
293
|
if (!(options == null ? void 0 : options.silent)) {
|
package/dist/slug/index.mjs
CHANGED
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
CANVAS_DRAFT_STATE,
|
|
12
12
|
CANVAS_PUBLISHED_STATE,
|
|
13
|
-
|
|
13
|
+
CompositionDeliveryClient,
|
|
14
14
|
EMPTY_COMPOSITION
|
|
15
15
|
} from "@uniformdev/canvas";
|
|
16
16
|
var withUniformGetServerSideProps = (options) => {
|
|
17
|
-
const canvasClient = (options == null ? void 0 : options.client) || new
|
|
17
|
+
const canvasClient = (options == null ? void 0 : options.client) || new CompositionDeliveryClient({
|
|
18
18
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
19
19
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
20
20
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -38,13 +38,14 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
38
38
|
} else {
|
|
39
39
|
try {
|
|
40
40
|
const time = Date.now();
|
|
41
|
-
const
|
|
41
|
+
const getParams = {
|
|
42
42
|
...options == null ? void 0 : options.requestOptions,
|
|
43
43
|
slug,
|
|
44
44
|
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE,
|
|
45
45
|
diagnostics: true,
|
|
46
46
|
releaseId
|
|
47
|
-
}
|
|
47
|
+
};
|
|
48
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionBySlug(getParams);
|
|
48
49
|
const duration = Date.now() - time;
|
|
49
50
|
composition = response.composition;
|
|
50
51
|
if (!(options == null ? void 0 : options.silent)) {
|
|
@@ -70,21 +71,27 @@ var withUniformGetServerSideProps = (options) => {
|
|
|
70
71
|
import {
|
|
71
72
|
CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE2,
|
|
72
73
|
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2,
|
|
73
|
-
|
|
74
|
+
CompositionManagementClient
|
|
74
75
|
} from "@uniformdev/canvas";
|
|
75
76
|
var withUniformGetStaticPaths = (options) => {
|
|
76
77
|
return async function wrappedGetStaticPaths() {
|
|
77
78
|
var _a;
|
|
78
|
-
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a :
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : (
|
|
80
|
+
// Build-time path enumeration only needs `_slug`, so read the lightweight
|
|
81
|
+
// canonical list from the origin (not the edge). bypassCache:false keeps the
|
|
82
|
+
// CDN-cacheable behavior of the old base CanvasClient at build time.
|
|
83
|
+
new CompositionManagementClient({
|
|
84
|
+
apiKey: process.env.UNIFORM_API_KEY,
|
|
85
|
+
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
86
|
+
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
87
|
+
bypassCache: false
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
const listParams = {
|
|
85
91
|
...options == null ? void 0 : options.requestOptions,
|
|
86
92
|
state: (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE2 : CANVAS_PUBLISHED_STATE2
|
|
87
|
-
}
|
|
93
|
+
};
|
|
94
|
+
const response = "list" in canvasClient ? await canvasClient.list(listParams) : await canvasClient.getCompositionList(listParams);
|
|
88
95
|
const compositions = (options == null ? void 0 : options.callback) ? await options.callback(response.compositions) : response.compositions;
|
|
89
96
|
const paths = compositions.filter((reference) => !!reference.composition._slug).map((composition) => {
|
|
90
97
|
var _a2;
|
|
@@ -101,12 +108,12 @@ var withUniformGetStaticPaths = (options) => {
|
|
|
101
108
|
import {
|
|
102
109
|
CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE3,
|
|
103
110
|
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3,
|
|
104
|
-
|
|
111
|
+
CompositionDeliveryClient as CompositionDeliveryClient2,
|
|
105
112
|
EMPTY_COMPOSITION as EMPTY_COMPOSITION2
|
|
106
113
|
} from "@uniformdev/canvas";
|
|
107
114
|
var withUniformGetStaticProps = (options) => {
|
|
108
115
|
var _a;
|
|
109
|
-
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new
|
|
116
|
+
const canvasClient = (_a = options == null ? void 0 : options.client) != null ? _a : new CompositionDeliveryClient2({
|
|
110
117
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
111
118
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
112
119
|
apiHost: process.env.UNIFORM_CLI_BASE_URL,
|
|
@@ -133,12 +140,13 @@ var withUniformGetStaticProps = (options) => {
|
|
|
133
140
|
} else {
|
|
134
141
|
try {
|
|
135
142
|
const time = Date.now();
|
|
136
|
-
const
|
|
143
|
+
const getParams = {
|
|
137
144
|
slug: slugString,
|
|
138
145
|
state: preview || (options == null ? void 0 : options.preview) ? CANVAS_DRAFT_STATE3 : CANVAS_PUBLISHED_STATE3,
|
|
139
146
|
...options == null ? void 0 : options.requestOptions,
|
|
140
147
|
releaseId
|
|
141
|
-
}
|
|
148
|
+
};
|
|
149
|
+
const response = "get" in canvasClient ? await canvasClient.get(getParams) : await canvasClient.getCompositionBySlug(getParams);
|
|
142
150
|
const duration = Date.now() - time;
|
|
143
151
|
composition = response.composition;
|
|
144
152
|
if (!(options == null ? void 0 : options.silent)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next",
|
|
3
|
-
"version": "20.74.
|
|
3
|
+
"version": "20.74.7-alpha.12+f93a44837e",
|
|
4
4
|
"description": "Next.js SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"apidocs-extract": "api-extractor run --local"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@uniformdev/canvas": "20.74.
|
|
70
|
-
"@uniformdev/canvas-react": "20.74.
|
|
71
|
-
"@uniformdev/context": "20.74.
|
|
72
|
-
"@uniformdev/project-map": "20.74.
|
|
73
|
-
"@uniformdev/redirect": "20.74.
|
|
74
|
-
"@uniformdev/richtext": "20.74.
|
|
69
|
+
"@uniformdev/canvas": "20.74.7-alpha.12+f93a44837e",
|
|
70
|
+
"@uniformdev/canvas-react": "20.74.7-alpha.12+f93a44837e",
|
|
71
|
+
"@uniformdev/context": "20.74.7-alpha.12+f93a44837e",
|
|
72
|
+
"@uniformdev/project-map": "20.74.7-alpha.12+f93a44837e",
|
|
73
|
+
"@uniformdev/redirect": "20.74.7-alpha.12+f93a44837e",
|
|
74
|
+
"@uniformdev/richtext": "20.74.7-alpha.12+f93a44837e",
|
|
75
75
|
"colorette": "2.0.20"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "f93a44837e168f8ece4f56657a29a6f72467c1cb"
|
|
95
95
|
}
|