@uniformdev/canvas-next 19.8.0 → 19.9.2-alpha.3
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/{chunk-2MI7UYW7.mjs → chunk-TR7V6ABJ.mjs} +1 -1
- package/dist/chunk-ZOXJSPVQ.mjs +165 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/project-map/index.d.ts +11 -41
- package/dist/project-map/index.js +27 -16
- package/dist/project-map/index.mjs +8 -142
- package/dist/route/index.d.ts +285 -150
- package/dist/route/index.js +334 -131
- package/dist/route/index.mjs +190 -133
- package/dist/slug/index.d.ts +8 -4
- package/dist/slug/index.js +26 -15
- package/dist/slug/index.mjs +30 -17
- package/dist/withUniformGetStaticPaths-6a31a8f8.d.ts +38 -0
- package/package.json +8 -7
package/dist/route/index.d.ts
CHANGED
|
@@ -1,170 +1,305 @@
|
|
|
1
1
|
import * as next from 'next';
|
|
2
|
-
import { GetServerSidePropsContext,
|
|
3
|
-
import {
|
|
2
|
+
import { GetServerSidePropsContext, GetServerSidePropsResult, GetServerSideProps, GetStaticPropsContext, GetStaticPropsResult, GetStaticProps } from 'next';
|
|
3
|
+
import { a as UniformPreviewData } from '../models-092c0912.js';
|
|
4
4
|
import * as querystring from 'querystring';
|
|
5
5
|
import { ParsedUrlQuery } from 'querystring';
|
|
6
|
-
|
|
7
|
-
import {
|
|
6
|
+
export { w as withUniformGetStaticPaths } from '../withUniformGetStaticPaths-6a31a8f8.js';
|
|
7
|
+
import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, unstable_RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
|
|
8
8
|
import '@uniformdev/canvas-react';
|
|
9
|
+
import '@uniformdev/project-map';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
value: unknown;
|
|
15
|
-
type: string;
|
|
16
|
-
connectedData?: {
|
|
17
|
-
pointer: string;
|
|
18
|
-
syntax: "jptr";
|
|
19
|
-
} | undefined;
|
|
20
|
-
};
|
|
21
|
-
} | undefined;
|
|
22
|
-
variant?: string | undefined;
|
|
23
|
-
projectMapNodes?: {
|
|
24
|
-
id: string;
|
|
25
|
-
path: string;
|
|
26
|
-
projectMapId: string;
|
|
27
|
-
}[] | undefined;
|
|
28
|
-
slots?: {
|
|
29
|
-
[key: string]: {
|
|
30
|
-
type: string;
|
|
31
|
-
parameters?: {
|
|
32
|
-
[key: string]: {
|
|
33
|
-
value: unknown;
|
|
34
|
-
type: string;
|
|
35
|
-
connectedData?: {
|
|
36
|
-
pointer: string;
|
|
37
|
-
syntax: "jptr";
|
|
38
|
-
} | undefined;
|
|
39
|
-
};
|
|
40
|
-
} | undefined;
|
|
41
|
-
variant?: string | undefined;
|
|
42
|
-
slots?: {
|
|
43
|
-
[key: string]: any[];
|
|
44
|
-
} | undefined;
|
|
45
|
-
_id?: string | undefined;
|
|
46
|
-
_pattern?: string | undefined;
|
|
47
|
-
_dataResources?: {
|
|
48
|
-
[key: string]: {
|
|
49
|
-
type: string;
|
|
50
|
-
isPatternParameter?: boolean | undefined;
|
|
51
|
-
ignorePatternParameterDefault?: boolean | undefined;
|
|
52
|
-
variables?: {
|
|
53
|
-
[key: string]: string;
|
|
54
|
-
} | undefined;
|
|
55
|
-
};
|
|
56
|
-
} | undefined;
|
|
57
|
-
_patternDataResources?: {
|
|
58
|
-
[key: string]: {
|
|
59
|
-
type: string;
|
|
60
|
-
isPatternParameter?: boolean | undefined;
|
|
61
|
-
ignorePatternParameterDefault?: boolean | undefined;
|
|
62
|
-
variables?: {
|
|
63
|
-
[key: string]: string;
|
|
64
|
-
} | undefined;
|
|
65
|
-
};
|
|
66
|
-
} | undefined;
|
|
67
|
-
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
|
68
|
-
_overrides?: {
|
|
69
|
-
[key: string]: {
|
|
70
|
-
parameters?: {
|
|
71
|
-
[key: string]: {
|
|
72
|
-
value: unknown;
|
|
73
|
-
type: string;
|
|
74
|
-
connectedData?: {
|
|
75
|
-
pointer: string;
|
|
76
|
-
syntax: "jptr";
|
|
77
|
-
} | undefined;
|
|
78
|
-
};
|
|
79
|
-
} | undefined;
|
|
80
|
-
variant?: string | undefined;
|
|
81
|
-
};
|
|
82
|
-
} | undefined;
|
|
83
|
-
_overridability?: {
|
|
84
|
-
parameters?: {
|
|
85
|
-
[key: string]: "yes" | "no";
|
|
86
|
-
} | undefined;
|
|
87
|
-
variants?: boolean | undefined;
|
|
88
|
-
} | undefined;
|
|
89
|
-
}[];
|
|
90
|
-
} | undefined;
|
|
91
|
-
_id: string;
|
|
92
|
-
_slug?: string | null | undefined;
|
|
93
|
-
_name: string;
|
|
94
|
-
_dataResources?: {
|
|
95
|
-
[key: string]: {
|
|
96
|
-
type: string;
|
|
97
|
-
isPatternParameter?: boolean | undefined;
|
|
98
|
-
ignorePatternParameterDefault?: boolean | undefined;
|
|
99
|
-
variables?: {
|
|
100
|
-
[key: string]: string;
|
|
101
|
-
} | undefined;
|
|
102
|
-
};
|
|
103
|
-
} | undefined;
|
|
104
|
-
_overrides?: {
|
|
105
|
-
[key: string]: {
|
|
106
|
-
parameters?: {
|
|
107
|
-
[key: string]: {
|
|
108
|
-
value: unknown;
|
|
109
|
-
type: string;
|
|
110
|
-
connectedData?: {
|
|
111
|
-
pointer: string;
|
|
112
|
-
syntax: "jptr";
|
|
113
|
-
} | undefined;
|
|
114
|
-
};
|
|
115
|
-
} | undefined;
|
|
116
|
-
variant?: string | undefined;
|
|
117
|
-
};
|
|
118
|
-
} | undefined;
|
|
119
|
-
_overridability?: {
|
|
120
|
-
parameters?: {
|
|
121
|
-
[key: string]: "yes" | "no";
|
|
122
|
-
} | undefined;
|
|
123
|
-
variants?: boolean | undefined;
|
|
124
|
-
} | undefined;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Creates an implementation of `getServerSideProps` using the Uniform Route API.
|
|
129
|
-
* Static and dynamic routing as well as redirection is automatically supported.
|
|
130
|
-
* Custom behavior can be added by passing in options to hook to specific processing events.
|
|
131
|
-
* @deprecated - this is experimental functionality that is subject to change without notice.
|
|
132
|
-
*/
|
|
133
|
-
declare const unstable_withUniformGetServerSideProps: <TProps extends {
|
|
134
|
-
[key: string]: any;
|
|
135
|
-
} = {
|
|
136
|
-
[key: string]: any;
|
|
137
|
-
}>(options?: {
|
|
11
|
+
type HandleRouteCompositionFunction<TContext, TResult> = (composition: RouteGetResponseEdgehancedComposition, context: TContext, defaultHandler: (composition: RouteGetResponseEdgehancedComposition) => Promise<TResult | null> | TResult | null, duration: number) => Promise<TResult | null> | TResult | null;
|
|
12
|
+
type HandleRouteNotFoundFunction<TContext, TResult> = (result: RouteGetResponseNotFound, context: TContext, defaultHandler: (result: RouteGetResponseNotFound) => TResult, duration: number) => TResult;
|
|
13
|
+
type HandleRouteRedirectFunction<TContext, TResult> = (requestUrl: string, redirect: RouteGetResponseRedirect, context: TContext, defaultHandler: (redirect: RouteGetResponseRedirect) => TResult, duration: number) => TResult;
|
|
14
|
+
type RouteHandlerOptions<TContext, TResult, TSuccessResult> = {
|
|
138
15
|
/** If you need to override the default client, you can pass it here */
|
|
139
|
-
client?: unstable_RouteClient
|
|
16
|
+
client?: unstable_RouteClient;
|
|
140
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 */
|
|
141
|
-
prefix?: string
|
|
18
|
+
prefix?: string;
|
|
142
19
|
/** Useful when you need to modify the path passed to the API */
|
|
143
|
-
modifyPath?: (
|
|
144
|
-
/** The project map ID to connect to. If not set, the default project map will be used. */
|
|
145
|
-
projectMapId?: string
|
|
20
|
+
modifyPath?: (path: string, context: TContext) => string;
|
|
21
|
+
/** The project map ID to connect to. If not set, the default project map for the configured project will be used. */
|
|
22
|
+
projectMapId?: string;
|
|
146
23
|
/** Way to override getRoute request params */
|
|
147
|
-
requestOptions?: Partial<RouteGetParameters
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
* NOTE: not called for not found or redirect responses, only for valid-composition responses.
|
|
151
|
-
*/
|
|
152
|
-
callback?: UniformGetServerSideProps<TProps> | undefined;
|
|
24
|
+
requestOptions?: Partial<RouteGetParameters>;
|
|
25
|
+
/** Disables logging of response information and timings */
|
|
26
|
+
silent?: boolean;
|
|
153
27
|
/** Override handling of a composition route response. Return null to signal not found. */
|
|
154
|
-
handleComposition?:
|
|
28
|
+
handleComposition?: HandleRouteCompositionFunction<TContext, TSuccessResult>;
|
|
155
29
|
/** Override default handling of a redirect route response */
|
|
156
|
-
handleRedirect?:
|
|
30
|
+
handleRedirect?: HandleRouteRedirectFunction<TContext, TResult>;
|
|
157
31
|
/**
|
|
158
32
|
* Override default handling of a not found route response
|
|
159
33
|
* NOTE: not called when the API returns a 404 error (project map not found), only when the route result is not found
|
|
160
34
|
*/
|
|
161
|
-
handleNotFound?:
|
|
162
|
-
}
|
|
35
|
+
handleNotFound?: HandleRouteNotFoundFunction<TContext, TResult>;
|
|
36
|
+
};
|
|
163
37
|
|
|
164
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Creates an implementation of `getServerSideProps` using the Uniform Route API.
|
|
40
|
+
* Static and dynamic routing as well as redirection is automatically supported.
|
|
41
|
+
* Custom behavior can be added by passing in options to hook to specific processing events.
|
|
42
|
+
*/
|
|
43
|
+
declare const unstable_withUniformGetServerSideProps: <TProps extends {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
} = {
|
|
46
|
+
data: RootComponentInstance;
|
|
47
|
+
}>(options?: RouteHandlerOptions<GetServerSidePropsContext<ParsedUrlQuery, UniformPreviewData>, GetServerSidePropsResult<never>, GetServerSidePropsResult<TProps>> | undefined) => GetServerSideProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
165
48
|
|
|
166
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Creates an implementation of `getServerSideProps` using the Uniform Route API.
|
|
51
|
+
* Static and dynamic routing as well as redirection is automatically supported.
|
|
52
|
+
* Custom behavior can be added by passing in options to hook to specific processing events.
|
|
53
|
+
*/
|
|
54
|
+
declare const unstable_withUniformGetStaticProps: <TProps extends {
|
|
167
55
|
[key: string]: any;
|
|
56
|
+
} = {
|
|
57
|
+
data: RootComponentInstance;
|
|
58
|
+
}>(options?: (RouteHandlerOptions<GetStaticPropsContext<ParsedUrlQuery, UniformPreviewData>, GetStaticPropsResult<never>, GetStaticPropsResult<TProps>> & {
|
|
59
|
+
/** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */
|
|
60
|
+
param?: string | undefined;
|
|
61
|
+
}) | undefined) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
62
|
+
|
|
63
|
+
declare const unstable_getServerSideProps: next.GetServerSideProps<{
|
|
64
|
+
data: {
|
|
65
|
+
type: string;
|
|
66
|
+
parameters?: {
|
|
67
|
+
[key: string]: {
|
|
68
|
+
value: unknown;
|
|
69
|
+
type: string;
|
|
70
|
+
connectedData?: {
|
|
71
|
+
pointer: string;
|
|
72
|
+
syntax: "jptr";
|
|
73
|
+
} | undefined;
|
|
74
|
+
};
|
|
75
|
+
} | undefined;
|
|
76
|
+
variant?: string | undefined;
|
|
77
|
+
projectMapNodes?: {
|
|
78
|
+
id: string;
|
|
79
|
+
path: string;
|
|
80
|
+
projectMapId: string;
|
|
81
|
+
}[] | undefined;
|
|
82
|
+
slots?: {
|
|
83
|
+
[key: string]: {
|
|
84
|
+
type: string;
|
|
85
|
+
parameters?: {
|
|
86
|
+
[key: string]: {
|
|
87
|
+
value: unknown;
|
|
88
|
+
type: string;
|
|
89
|
+
connectedData?: {
|
|
90
|
+
pointer: string;
|
|
91
|
+
syntax: "jptr";
|
|
92
|
+
} | undefined;
|
|
93
|
+
};
|
|
94
|
+
} | undefined;
|
|
95
|
+
variant?: string | undefined;
|
|
96
|
+
slots?: {
|
|
97
|
+
[key: string]: any[];
|
|
98
|
+
} | undefined;
|
|
99
|
+
_id?: string | undefined;
|
|
100
|
+
_pattern?: string | undefined;
|
|
101
|
+
_dataResources?: {
|
|
102
|
+
[key: string]: {
|
|
103
|
+
type: string;
|
|
104
|
+
isPatternParameter?: boolean | undefined;
|
|
105
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
106
|
+
variables?: {
|
|
107
|
+
[key: string]: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
};
|
|
110
|
+
} | undefined;
|
|
111
|
+
_patternDataResources?: {
|
|
112
|
+
[key: string]: {
|
|
113
|
+
type: string;
|
|
114
|
+
isPatternParameter?: boolean | undefined;
|
|
115
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
116
|
+
variables?: {
|
|
117
|
+
[key: string]: string;
|
|
118
|
+
} | undefined;
|
|
119
|
+
};
|
|
120
|
+
} | undefined;
|
|
121
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
|
122
|
+
_overrides?: {
|
|
123
|
+
[key: string]: {
|
|
124
|
+
parameters?: {
|
|
125
|
+
[key: string]: {
|
|
126
|
+
value: unknown;
|
|
127
|
+
type: string;
|
|
128
|
+
connectedData?: {
|
|
129
|
+
pointer: string;
|
|
130
|
+
syntax: "jptr";
|
|
131
|
+
} | undefined;
|
|
132
|
+
};
|
|
133
|
+
} | undefined;
|
|
134
|
+
variant?: string | undefined;
|
|
135
|
+
};
|
|
136
|
+
} | undefined;
|
|
137
|
+
_overridability?: {
|
|
138
|
+
parameters?: {
|
|
139
|
+
[key: string]: "yes" | "no";
|
|
140
|
+
} | undefined;
|
|
141
|
+
variants?: boolean | undefined;
|
|
142
|
+
} | undefined;
|
|
143
|
+
}[];
|
|
144
|
+
} | undefined;
|
|
145
|
+
_id: string;
|
|
146
|
+
_slug?: string | null | undefined;
|
|
147
|
+
_name: string;
|
|
148
|
+
_dataResources?: {
|
|
149
|
+
[key: string]: {
|
|
150
|
+
type: string;
|
|
151
|
+
isPatternParameter?: boolean | undefined;
|
|
152
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
153
|
+
variables?: {
|
|
154
|
+
[key: string]: string;
|
|
155
|
+
} | undefined;
|
|
156
|
+
};
|
|
157
|
+
} | undefined;
|
|
158
|
+
_overrides?: {
|
|
159
|
+
[key: string]: {
|
|
160
|
+
parameters?: {
|
|
161
|
+
[key: string]: {
|
|
162
|
+
value: unknown;
|
|
163
|
+
type: string;
|
|
164
|
+
connectedData?: {
|
|
165
|
+
pointer: string;
|
|
166
|
+
syntax: "jptr";
|
|
167
|
+
} | undefined;
|
|
168
|
+
};
|
|
169
|
+
} | undefined;
|
|
170
|
+
variant?: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
} | undefined;
|
|
173
|
+
_overridability?: {
|
|
174
|
+
parameters?: {
|
|
175
|
+
[key: string]: "yes" | "no";
|
|
176
|
+
} | undefined;
|
|
177
|
+
variants?: boolean | undefined;
|
|
178
|
+
} | undefined;
|
|
179
|
+
};
|
|
180
|
+
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
181
|
+
|
|
182
|
+
declare const unstable_getStaticProps: next.GetStaticProps<{
|
|
183
|
+
data: {
|
|
184
|
+
type: string;
|
|
185
|
+
parameters?: {
|
|
186
|
+
[key: string]: {
|
|
187
|
+
value: unknown;
|
|
188
|
+
type: string;
|
|
189
|
+
connectedData?: {
|
|
190
|
+
pointer: string;
|
|
191
|
+
syntax: "jptr";
|
|
192
|
+
} | undefined;
|
|
193
|
+
};
|
|
194
|
+
} | undefined;
|
|
195
|
+
variant?: string | undefined;
|
|
196
|
+
projectMapNodes?: {
|
|
197
|
+
id: string;
|
|
198
|
+
path: string;
|
|
199
|
+
projectMapId: string;
|
|
200
|
+
}[] | undefined;
|
|
201
|
+
slots?: {
|
|
202
|
+
[key: string]: {
|
|
203
|
+
type: string;
|
|
204
|
+
parameters?: {
|
|
205
|
+
[key: string]: {
|
|
206
|
+
value: unknown;
|
|
207
|
+
type: string;
|
|
208
|
+
connectedData?: {
|
|
209
|
+
pointer: string;
|
|
210
|
+
syntax: "jptr";
|
|
211
|
+
} | undefined;
|
|
212
|
+
};
|
|
213
|
+
} | undefined;
|
|
214
|
+
variant?: string | undefined;
|
|
215
|
+
slots?: {
|
|
216
|
+
[key: string]: any[];
|
|
217
|
+
} | undefined;
|
|
218
|
+
_id?: string | undefined;
|
|
219
|
+
_pattern?: string | undefined;
|
|
220
|
+
_dataResources?: {
|
|
221
|
+
[key: string]: {
|
|
222
|
+
type: string;
|
|
223
|
+
isPatternParameter?: boolean | undefined;
|
|
224
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
225
|
+
variables?: {
|
|
226
|
+
[key: string]: string;
|
|
227
|
+
} | undefined;
|
|
228
|
+
};
|
|
229
|
+
} | undefined;
|
|
230
|
+
_patternDataResources?: {
|
|
231
|
+
[key: string]: {
|
|
232
|
+
type: string;
|
|
233
|
+
isPatternParameter?: boolean | undefined;
|
|
234
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
235
|
+
variables?: {
|
|
236
|
+
[key: string]: string;
|
|
237
|
+
} | undefined;
|
|
238
|
+
};
|
|
239
|
+
} | undefined;
|
|
240
|
+
_patternError?: "NOTFOUND" | "CYCLIC" | undefined;
|
|
241
|
+
_overrides?: {
|
|
242
|
+
[key: string]: {
|
|
243
|
+
parameters?: {
|
|
244
|
+
[key: string]: {
|
|
245
|
+
value: unknown;
|
|
246
|
+
type: string;
|
|
247
|
+
connectedData?: {
|
|
248
|
+
pointer: string;
|
|
249
|
+
syntax: "jptr";
|
|
250
|
+
} | undefined;
|
|
251
|
+
};
|
|
252
|
+
} | undefined;
|
|
253
|
+
variant?: string | undefined;
|
|
254
|
+
};
|
|
255
|
+
} | undefined;
|
|
256
|
+
_overridability?: {
|
|
257
|
+
parameters?: {
|
|
258
|
+
[key: string]: "yes" | "no";
|
|
259
|
+
} | undefined;
|
|
260
|
+
variants?: boolean | undefined;
|
|
261
|
+
} | undefined;
|
|
262
|
+
}[];
|
|
263
|
+
} | undefined;
|
|
264
|
+
_id: string;
|
|
265
|
+
_slug?: string | null | undefined;
|
|
266
|
+
_name: string;
|
|
267
|
+
_dataResources?: {
|
|
268
|
+
[key: string]: {
|
|
269
|
+
type: string;
|
|
270
|
+
isPatternParameter?: boolean | undefined;
|
|
271
|
+
ignorePatternParameterDefault?: boolean | undefined;
|
|
272
|
+
variables?: {
|
|
273
|
+
[key: string]: string;
|
|
274
|
+
} | undefined;
|
|
275
|
+
};
|
|
276
|
+
} | undefined;
|
|
277
|
+
_overrides?: {
|
|
278
|
+
[key: string]: {
|
|
279
|
+
parameters?: {
|
|
280
|
+
[key: string]: {
|
|
281
|
+
value: unknown;
|
|
282
|
+
type: string;
|
|
283
|
+
connectedData?: {
|
|
284
|
+
pointer: string;
|
|
285
|
+
syntax: "jptr";
|
|
286
|
+
} | undefined;
|
|
287
|
+
};
|
|
288
|
+
} | undefined;
|
|
289
|
+
variant?: string | undefined;
|
|
290
|
+
};
|
|
291
|
+
} | undefined;
|
|
292
|
+
_overridability?: {
|
|
293
|
+
parameters?: {
|
|
294
|
+
[key: string]: "yes" | "no";
|
|
295
|
+
} | undefined;
|
|
296
|
+
variants?: boolean | undefined;
|
|
297
|
+
} | undefined;
|
|
298
|
+
};
|
|
168
299
|
}, querystring.ParsedUrlQuery, UniformPreviewData>;
|
|
300
|
+
declare const getStaticPaths: () => Promise<{
|
|
301
|
+
paths: string[] | undefined;
|
|
302
|
+
fallback: boolean;
|
|
303
|
+
}>;
|
|
169
304
|
|
|
170
|
-
export { unstable_getServerSideProps,
|
|
305
|
+
export { HandleRouteCompositionFunction, HandleRouteNotFoundFunction, HandleRouteRedirectFunction, RouteHandlerOptions, getStaticPaths, unstable_getServerSideProps, unstable_getStaticProps, unstable_withUniformGetServerSideProps, unstable_withUniformGetStaticProps };
|