@uniformdev/project-map 19.35.1 → 19.35.3-alpha.82

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.
@@ -0,0 +1,640 @@
1
+ import { ApiClient } from '@uniformdev/context/api';
2
+
3
+ /**
4
+ * This file was auto-generated by openapi-typescript.
5
+ * Do not make direct changes to the file.
6
+ */
7
+ interface paths$1 {
8
+ "/api/v1/project-map": {
9
+ /** Called to retrieve a list of project maps related to a project or a specific project map by id */
10
+ get: {
11
+ parameters: {
12
+ query: {
13
+ /** The project to fetch project map for */
14
+ projectId: string;
15
+ /** The id of the project map to fetch */
16
+ projectMapId?: string;
17
+ };
18
+ };
19
+ responses: {
20
+ /** OK */
21
+ 200: {
22
+ content: {
23
+ "application/json": {
24
+ projectMaps: components$1["schemas"]["ProjectMapDefinition"][];
25
+ };
26
+ };
27
+ };
28
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
29
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
30
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
31
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
32
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
33
+ };
34
+ };
35
+ put: {
36
+ responses: {
37
+ /** OK */
38
+ 200: {
39
+ content: {
40
+ "application/json": {
41
+ /**
42
+ * Format: uuid
43
+ * @description Id of the projectMap
44
+ */
45
+ projectMapId: string;
46
+ };
47
+ };
48
+ };
49
+ /** OK */
50
+ 204: never;
51
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
52
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
53
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
54
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
55
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
56
+ };
57
+ requestBody: {
58
+ content: {
59
+ "application/json": {
60
+ /** @description Project map object to insert */
61
+ projectMap: components$1["schemas"]["ProjectMapDefinition"];
62
+ /**
63
+ * Format: uuid
64
+ * @description Project id to insert the projectMap into
65
+ */
66
+ projectId: string;
67
+ };
68
+ };
69
+ };
70
+ };
71
+ /** Called to delete a projectMap */
72
+ delete: {
73
+ responses: {
74
+ /** OK */
75
+ 204: never;
76
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
77
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
78
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
79
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
80
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
81
+ };
82
+ requestBody: {
83
+ content: {
84
+ "application/json": {
85
+ /**
86
+ * Format: uuid
87
+ * @description Id of the project that this projectMap belongs to
88
+ */
89
+ projectId: string;
90
+ /**
91
+ * Format: uuid
92
+ * @description Id of the projectMap to delete
93
+ */
94
+ projectMapId: string;
95
+ };
96
+ };
97
+ };
98
+ };
99
+ /** Handles preflight requests. This endpoint allows CORS. */
100
+ options: {
101
+ responses: {
102
+ /** OK */
103
+ 204: never;
104
+ };
105
+ };
106
+ };
107
+ }
108
+ interface components$1 {
109
+ schemas: {
110
+ ProjectMapDefinition: {
111
+ /** @description The id of the projectMap node */
112
+ id?: string;
113
+ /** @description The name of the projectMap node */
114
+ name: string;
115
+ /** @description Description of the projectMap node */
116
+ description?: string;
117
+ /** @description The prefix of the url generated by this projectMap */
118
+ baseUrl?: string;
119
+ default?: boolean;
120
+ };
121
+ };
122
+ }
123
+ interface external$1 {
124
+ "swagger.yml": {
125
+ paths: {};
126
+ components: {
127
+ schemas: {
128
+ Error: {
129
+ /** @description Error message(s) that occurred while processing the request */
130
+ errorMessage?: string[] | string;
131
+ };
132
+ };
133
+ responses: {
134
+ /** Request input validation failed */
135
+ BadRequestError: {
136
+ content: {
137
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
138
+ };
139
+ };
140
+ /** API key or token was not valid */
141
+ UnauthorizedError: {
142
+ content: {
143
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
144
+ };
145
+ };
146
+ /** Permission was denied */
147
+ ForbiddenError: {
148
+ content: {
149
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
150
+ };
151
+ };
152
+ /** Resource not found */
153
+ NotFoundError: {
154
+ content: {
155
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
156
+ };
157
+ };
158
+ /** Too many requests in allowed time period */
159
+ RateLimitError: unknown;
160
+ /** Execution error occurred */
161
+ InternalServerError: unknown;
162
+ };
163
+ };
164
+ operations: {};
165
+ };
166
+ }
167
+
168
+ /**
169
+ * This file was auto-generated by openapi-typescript.
170
+ * Do not make direct changes to the file.
171
+ */
172
+ interface paths {
173
+ "/api/v1/project-map-nodes": {
174
+ /** Called to get a list of nodes belonging to a specific path or Id */
175
+ get: {
176
+ parameters: {
177
+ query: {
178
+ /** The project map id that the desired nodes belong */
179
+ projectMapId?: string;
180
+ /** The project id that contains the project map tree that this node belongs to */
181
+ projectId: string;
182
+ /** The id of the node to retrieve, cannot have both this parameter and Path */
183
+ id?: string;
184
+ /** The path of the root node to retrieve, cannot have both this parameter and Id */
185
+ path?: string;
186
+ /** Composition id to find associated sitemap nodes for */
187
+ compositionId?: string;
188
+ /** Limit the number or records returned by a number */
189
+ limit?: number;
190
+ /** Number of records to skip before returning nodes */
191
+ offset?: number;
192
+ /** Depth of the tree to fetch. Only applies when fetching by path. */
193
+ depth?: number;
194
+ /** State of compositions to fetch. 0 = draft, 64 = published. */
195
+ state?: number;
196
+ /** should the data be returned as a json tree object (or a flat array) */
197
+ tree?: boolean;
198
+ /** text search filter */
199
+ search?: string;
200
+ /**
201
+ * Modifies the results to include all ancestors of matched nodes, in addition to the nodes themselves.
202
+ * Results are sorted by path. If multiple nodes are selected, ancestors are not duplicated.
203
+ */
204
+ includeAncestors?: boolean;
205
+ /** include expanded helper computed properties, includes isLeaf, parentPath, pathSegment */
206
+ expanded?: boolean;
207
+ /** include basic composition information. ID, type, state, name, and definition id. */
208
+ withCompositionData?: boolean;
209
+ /**
210
+ * @deprecated Returns the UI status string of the composition.
211
+ * This internal status is subject to change without notice, and is thus marked deprecated to discourage use of internal data.
212
+ */
213
+ withCompositionUIStatus?: boolean;
214
+ };
215
+ };
216
+ responses: {
217
+ /** OK */
218
+ 200: {
219
+ content: {
220
+ "application/json": {
221
+ nodes?: components["schemas"]["ProjectMapNodeDefinition"][];
222
+ tree?: external["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"];
223
+ };
224
+ };
225
+ };
226
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
227
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
228
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
229
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
230
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
231
+ };
232
+ };
233
+ /** Called to insert or update a node or nodes */
234
+ put: {
235
+ responses: {
236
+ /** OK */
237
+ 204: never;
238
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
239
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
240
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
241
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
242
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
243
+ };
244
+ requestBody: {
245
+ content: {
246
+ "application/json": {
247
+ /** @description An array of projectMap node objects to be updated or inserted */
248
+ nodes: {
249
+ node: components["schemas"]["ProjectMapNodeUpdate"];
250
+ /** @description The path of the node directly prior to the location where the current node is desired to go or undefined if there isn't one */
251
+ previousSibling?: string;
252
+ /** @description The path of the node directly after the location where the current node is desired to go or undefined if there isn't one */
253
+ nextSibling?: string;
254
+ }[];
255
+ /**
256
+ * Format: uuid
257
+ * @description The project id of the project that the projectMap belongs to
258
+ */
259
+ projectId: string;
260
+ /**
261
+ * Format: uuid
262
+ * @description The projectMap id that the changing or inserting nodes belong to
263
+ */
264
+ projectMapId?: string;
265
+ };
266
+ };
267
+ };
268
+ };
269
+ /** Called to delete a particular projectMap node by id or path */
270
+ delete: {
271
+ responses: {
272
+ /** OK */
273
+ 204: never;
274
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
275
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
276
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
277
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
278
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
279
+ };
280
+ requestBody: {
281
+ content: {
282
+ "application/json": {
283
+ /**
284
+ * Format: uuid
285
+ * @description Id of the projectMap node to delete
286
+ */
287
+ nodeId?: string;
288
+ /** @description Path to the projectMap node to delete */
289
+ path: string;
290
+ /**
291
+ * Format: uuid
292
+ * @description Project map id that the node to delete belongs to
293
+ */
294
+ projectMapId?: string;
295
+ /**
296
+ * Format: uuid
297
+ * @description Project id that the project map belongs to
298
+ */
299
+ projectId: string;
300
+ } | {
301
+ /**
302
+ * Format: uuid
303
+ * @description Id of the projectMap node to delete
304
+ */
305
+ nodeId: string;
306
+ /** @description Path to the projectMap node to delete */
307
+ path?: string;
308
+ /**
309
+ * Format: uuid
310
+ * @description Project map id that the node to delete belongs to
311
+ */
312
+ projectMapId?: string;
313
+ /**
314
+ * Format: uuid
315
+ * @description Project id that the project map belongs to
316
+ */
317
+ projectId: string;
318
+ };
319
+ };
320
+ };
321
+ };
322
+ /** Handles preflight requests. This endpoint allows CORS. */
323
+ options: {
324
+ responses: {
325
+ /** OK */
326
+ 204: never;
327
+ };
328
+ };
329
+ };
330
+ }
331
+ interface components {
332
+ schemas: {
333
+ ProjectMapNodeDefinition: {
334
+ /**
335
+ * Format: uuid
336
+ * @description The id of the projectMap entry
337
+ */
338
+ id: string;
339
+ /** @description Dot delimited path representing the path to the current node */
340
+ path: string;
341
+ /** @description Ordering of the node, higher numbers go after lower numbers. */
342
+ order?: number;
343
+ data?: components["schemas"]["ProjectMapNodeData"];
344
+ /** @description The name of the projectMap entry */
345
+ name: string;
346
+ /**
347
+ * @description The type of the projectMap entry
348
+ * @enum {string}
349
+ */
350
+ type: "composition" | "redirect" | "placeholder";
351
+ /**
352
+ * Format: uuid
353
+ * @description The composition id related to the projectMap entry
354
+ */
355
+ compositionId?: string;
356
+ /** @description Description of the projectMap node */
357
+ description?: string;
358
+ /** @description Parent path of the current node, only included if requested with the expanded flag */
359
+ parentPath?: string;
360
+ /** @description Last segment of the url, only included if requested with the expanded flag */
361
+ pathSegment?: string;
362
+ /** @description returns true if the node is a leaf node, meaning having no children, only included if requested with the expanded flag */
363
+ isLeaf?: boolean;
364
+ compositionData?: components["schemas"]["ProjectMapNodeCompositionData"];
365
+ };
366
+ /** @description Basic information about a composition from the context of a project map node. */
367
+ ProjectMapNodeCompositionData: {
368
+ /** @description Type of the composition instance (public_id of its definition) */
369
+ type: string;
370
+ /**
371
+ * Format: uuid
372
+ * @description The public UUID of the composition.
373
+ */
374
+ id: string;
375
+ /** @description Slug pattern of this composition. */
376
+ slug?: string | null;
377
+ /** @description Friendly name of this composition. */
378
+ name: string;
379
+ /**
380
+ * @deprecated
381
+ * @description UI status value. Subject to change without notice; do not rely on this value. Only present when `withCompositionUIStatus` option is true.
382
+ * @enum {string}
383
+ */
384
+ uiStatus?: "Draft" | "Modified" | "Published" | "Orphan";
385
+ /**
386
+ * @description Icon name or URL for the composition definition (e.g. 'screen' or 'https://s3/my-component.jpg')
387
+ * @default screen
388
+ */
389
+ icon?: string;
390
+ /** @description Friendly name of this Composition's Definition */
391
+ typeName?: string;
392
+ };
393
+ ProjectMapNodeUpdate: {
394
+ /**
395
+ * Format: uuid
396
+ * @description The id of the projectMap entry
397
+ */
398
+ id?: string;
399
+ /** @description Path representing the path to the current node */
400
+ path: string;
401
+ /** @description Ordering of the node, higher numbers go after lower numbers. */
402
+ order?: number;
403
+ data?: components["schemas"]["ProjectMapNodeData"];
404
+ /** @description The name of the projectMap entry */
405
+ name: string;
406
+ /**
407
+ * @description The type of the projectMap entry
408
+ * @enum {string}
409
+ */
410
+ type: "composition" | "redirect" | "placeholder";
411
+ /**
412
+ * Format: uuid
413
+ * @description The composition id related to the projectMap entry
414
+ */
415
+ compositionId?: string;
416
+ /** @description Description of the projectMap node */
417
+ description?: string;
418
+ };
419
+ ProjectMapNodeData: {
420
+ /** @description While performing a search if a node is a hit, this property will return true. If it's supporting structure, like a parent of a search hit, it will return false */
421
+ isSearchHit?: boolean;
422
+ /** @description Query strings that are allowed to be passed to the node */
423
+ queryStrings?: components["schemas"]["ProjectMapNodeAllowedQueryString"][];
424
+ /**
425
+ * @description For dynamic nodes, this is the preview value for the dynamic value.
426
+ * The preview value is used when editing a connected composition, and is the default
427
+ * dynamic node value unless the author has explicitly chosen a different value.
428
+ */
429
+ previewValue?: string;
430
+ };
431
+ ProjectMapNodeAllowedQueryString: {
432
+ /** @description The name of the query string parameter */
433
+ name: string;
434
+ /** @description The default value of the query string if it is not provided by an incoming route path */
435
+ value: string;
436
+ /** @description Help text for authors who might be setting up a preview value for this query string */
437
+ helpText?: string;
438
+ };
439
+ };
440
+ }
441
+ interface external {
442
+ "swagger.yml": {
443
+ paths: {};
444
+ components: {
445
+ schemas: {
446
+ Error: {
447
+ /** @description Error message(s) that occurred while processing the request */
448
+ errorMessage?: string[] | string;
449
+ };
450
+ };
451
+ responses: {
452
+ /** Request input validation failed */
453
+ BadRequestError: {
454
+ content: {
455
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
456
+ };
457
+ };
458
+ /** API key or token was not valid */
459
+ UnauthorizedError: {
460
+ content: {
461
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
462
+ };
463
+ };
464
+ /** Permission was denied */
465
+ ForbiddenError: {
466
+ content: {
467
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
468
+ };
469
+ };
470
+ /** Resource not found */
471
+ NotFoundError: {
472
+ content: {
473
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
474
+ };
475
+ };
476
+ /** Too many requests in allowed time period */
477
+ RateLimitError: unknown;
478
+ /** Execution error occurred */
479
+ InternalServerError: unknown;
480
+ };
481
+ };
482
+ operations: {};
483
+ };
484
+ "v1-project-map-tree.swagger.yml": {
485
+ paths: {};
486
+ components: {
487
+ schemas: {
488
+ ProjectMapTreeNodeDefinition: components["schemas"]["ProjectMapNodeDefinition"] & {
489
+ /** @description Children of the node */
490
+ children?: external["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"][];
491
+ } & {
492
+ name: unknown;
493
+ };
494
+ };
495
+ };
496
+ operations: {};
497
+ };
498
+ }
499
+
500
+ type ProjectMapNodeUpsertRequest = paths['/api/v1/project-map-nodes']['put']['requestBody']['content']['application/json'];
501
+ type ProjectMapNodeUpsertRequestNode = ProjectMapNodeUpsertRequest['nodes'][0]['node'];
502
+ type ProjectMapNodeDeleteRequest = paths['/api/v1/project-map-nodes']['delete']['requestBody']['content']['application/json'];
503
+ type ProjectMapNodeGetRequest = paths['/api/v1/project-map-nodes']['get']['parameters']['query'];
504
+ type ProjectMapNodeGetResponse = paths['/api/v1/project-map-nodes']['get']['responses']['200']['content']['application/json'];
505
+ type ProjectMapNode = NonNullable<ProjectMapNodeGetResponse['nodes']>[0];
506
+ type ProjectMapNodeWithId = ProjectMapNode & Required<Pick<ProjectMapNode, 'id' | 'name'>>;
507
+ type ProjectMapGetRequest = paths$1['/api/v1/project-map']['get']['parameters']['query'];
508
+ type ProjectMapGetResponse = paths$1['/api/v1/project-map']['get']['responses']['200']['content']['application/json'];
509
+ type ProjectMapUpsertRequest = paths$1['/api/v1/project-map']['put']['requestBody']['content']['application/json'];
510
+ type ProjectMapDeleteRequest = paths$1['/api/v1/project-map']['delete']['requestBody']['content']['application/json'];
511
+ type ProjectMapDefinition = ProjectMapGetResponse['projectMaps'][0];
512
+ type ProjectMapDefinitionWithId = ProjectMapDefinition & Required<Pick<ProjectMapDefinition, 'id'>>;
513
+ type ProjectMapUpsertResponse = paths$1['/api/v1/project-map']['put']['responses']['200']['content']['application/json'];
514
+ type NodeType = 'placeholder' | 'composition' | 'redirect';
515
+ type ProjectMapNodeWithProjectMapReference = ProjectMapNodeWithId & {
516
+ projectMapId: string;
517
+ };
518
+ type ProjectMapDefinitions = {
519
+ projectMaps: ProjectMapDefinitionWithId[];
520
+ projectMapNodes: ProjectMapNodeWithProjectMapReference[];
521
+ };
522
+ type ProjectMapNodeData = components['schemas']['ProjectMapNodeData'];
523
+ type ProjectMapNodeAllowedQueryString = components['schemas']['ProjectMapNodeAllowedQueryString'];
524
+
525
+ declare const ROOT_NODE_PATH = "/";
526
+ type ProjectMapClientOptions = {
527
+ /** The Uniform API host to use. Internal use. */
528
+ apiHost?: string;
529
+ /** The Uniform API key to use when sending API requests. This or bearer token must be specified. */
530
+ apiKey?: string | undefined;
531
+ /** The Uniform bearer token to use. Internal use. */
532
+ bearerToken?: string | undefined;
533
+ /** The Uniform project ID to connect to */
534
+ projectId?: string | null;
535
+ /** Specify a fetch implementation to use when fetching data. Useful if you want to only polyfill selectively. */
536
+ fetch?: typeof fetch;
537
+ /** Specify whether caching is disabled. */
538
+ bypassCache?: boolean;
539
+ };
540
+ type ProjectMapSubtree = ProjectMapNode & {
541
+ children?: Array<ProjectMapSubtree> | undefined;
542
+ parent?: ProjectMapSubtree | undefined;
543
+ previousSibling?: ProjectMapSubtree | undefined;
544
+ nextSibling?: ProjectMapSubtree | undefined;
545
+ };
546
+ type WithoutProjectId<T extends {
547
+ projectId: string;
548
+ }> = Omit<T, 'projectId'>;
549
+ declare class ProjectMapClient extends ApiClient<ProjectMapClientOptions> {
550
+ constructor(options: ProjectMapClientOptions);
551
+ /**
552
+ * Get available project map defintions
553
+ */
554
+ getProjectMapDefinitions: () => Promise<{
555
+ projectMaps: {
556
+ id?: string | undefined;
557
+ name: string;
558
+ description?: string | undefined;
559
+ baseUrl?: string | undefined;
560
+ default?: boolean | undefined;
561
+ }[];
562
+ }>;
563
+ /**
564
+ * Get specific project map definition
565
+ */
566
+ getProjectMapDefinition: (options: WithoutProjectId<ProjectMapGetRequest>) => Promise<{
567
+ projectMaps: {
568
+ id?: string | undefined;
569
+ name: string;
570
+ description?: string | undefined;
571
+ baseUrl?: string | undefined;
572
+ default?: boolean | undefined;
573
+ }[];
574
+ }>;
575
+ /**
576
+ * Update or insert a project map definition
577
+ */
578
+ upsertProjectMap: (options: WithoutProjectId<ProjectMapUpsertRequest>) => Promise<string>;
579
+ /**
580
+ * Delete a project map definition
581
+ */
582
+ deleteProjectMap: (options: WithoutProjectId<ProjectMapDeleteRequest>) => Promise<void>;
583
+ /**
584
+ * Update or insert a list of project map nodes
585
+ */
586
+ upsertProjectMapNodes: (options: WithoutProjectId<ProjectMapNodeUpsertRequest>) => Promise<void>;
587
+ /**
588
+ * Delete a project map node
589
+ */
590
+ deleteProjectMapNode: (options: WithoutProjectId<ProjectMapNodeDeleteRequest>) => Promise<void>;
591
+ /**
592
+ * Get a subtree of the project map tree returned in a tree format
593
+ */
594
+ getSubtree: (options: WithoutProjectId<ProjectMapNodeGetRequest>) => Promise<ProjectMapSubtree | undefined>;
595
+ /**
596
+ * Get a subtree of the project map tree returned in a list format
597
+ */
598
+ getNodes: (options: WithoutProjectId<ProjectMapNodeGetRequest>) => Promise<ProjectMapNodeGetResponse>;
599
+ private setFetchOptions;
600
+ private cleanProjectMapNode;
601
+ }
602
+ declare class UncachedProjectMapClient extends ProjectMapClient {
603
+ constructor(options: Omit<ProjectMapClientOptions, 'bypassCache'>);
604
+ }
605
+
606
+ type MatchedRoute = {
607
+ match: true;
608
+ dynamicSegmentCount: number;
609
+ pathParams: {
610
+ [key: string]: string;
611
+ };
612
+ queryParams: {
613
+ [key: string]: string;
614
+ };
615
+ };
616
+ type UnmatchedRoute = {
617
+ match: false;
618
+ };
619
+ type ExpandOptions = {
620
+ dynamicInputValues?: Record<string, string>;
621
+ allowedQueryParams?: Array<string>;
622
+ /** Prevents URL-escaping of variable expressions of the form ${...} in the expand result */
623
+ doNotEscapeVariables?: boolean;
624
+ };
625
+ declare class Route {
626
+ #private;
627
+ readonly route: string;
628
+ constructor(route: string);
629
+ get dynamicSegmentCount(): number;
630
+ /** Tests if an incoming path matches this route */
631
+ matches(path: string): MatchedRoute | UnmatchedRoute;
632
+ /**
633
+ * Creates an expanded path value for this route given dynamic input values and allowed query string values
634
+ */
635
+ expand(options?: ExpandOptions): string;
636
+ static getDynamicRouteSegmentName(segment: string): string | undefined;
637
+ static dynamicSegmentPrefix: string;
638
+ }
639
+
640
+ export { ExpandOptions, MatchedRoute, NodeType, ProjectMapClient, ProjectMapClientOptions, ProjectMapDefinition, ProjectMapDefinitionWithId, ProjectMapDefinitions, ProjectMapDeleteRequest, ProjectMapGetRequest, ProjectMapGetResponse, ProjectMapNode, ProjectMapNodeAllowedQueryString, ProjectMapNodeData, ProjectMapNodeDeleteRequest, ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapNodeUpsertRequest, ProjectMapNodeUpsertRequestNode, ProjectMapNodeWithId, ProjectMapNodeWithProjectMapReference, ProjectMapSubtree, ProjectMapUpsertRequest, ProjectMapUpsertResponse, ROOT_NODE_PATH, Route, UncachedProjectMapClient, UnmatchedRoute };
package/dist/index.d.ts CHANGED
@@ -619,6 +619,8 @@ type UnmatchedRoute = {
619
619
  type ExpandOptions = {
620
620
  dynamicInputValues?: Record<string, string>;
621
621
  allowedQueryParams?: Array<string>;
622
+ /** Prevents URL-escaping of variable expressions of the form ${...} in the expand result */
623
+ doNotEscapeVariables?: boolean;
622
624
  };
623
625
  declare class Route {
624
626
  #private;
package/dist/index.esm.js CHANGED
@@ -193,6 +193,7 @@ var cutReferences = (node) => node ? {
193
193
  } : void 0;
194
194
 
195
195
  // src/util/Route.ts
196
+ import { createVariableReference, parseVariableExpression } from "@uniformdev/canvas";
196
197
  var _routeInfo, _parseRouteOrPath, parseRouteOrPath_fn, _isDynamicRouteSegment, isDynamicRouteSegment_fn;
197
198
  var _Route = class _Route {
198
199
  constructor(route) {
@@ -244,7 +245,7 @@ var _Route = class _Route {
244
245
  * Creates an expanded path value for this route given dynamic input values and allowed query string values
245
246
  */
246
247
  expand(options) {
247
- const { dynamicInputValues = {}, allowedQueryParams = [] } = options != null ? options : {};
248
+ const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
248
249
  const path = __privateGet(this, _routeInfo).segments.map((segment) => {
249
250
  const dynamicSegmentName = _Route.getDynamicRouteSegmentName(segment);
250
251
  if (!dynamicSegmentName) {
@@ -261,9 +262,14 @@ var _Route = class _Route {
261
262
  );
262
263
  return segment;
263
264
  }
264
- return encodeURIComponent(dynamicSegmentValue);
265
+ return encodeRouteComponent(dynamicSegmentValue, doNotEscapeVariables);
265
266
  }).join("/");
266
- const queries = allowedQueryParams.filter((qs) => typeof dynamicInputValues[qs] === "string").map((qs) => `${encodeURIComponent(qs)}=${encodeURIComponent(dynamicInputValues[qs])}`);
267
+ const queries = allowedQueryParams.filter((qs) => typeof dynamicInputValues[qs] === "string").map(
268
+ (qs) => `${encodeRouteComponent(qs, doNotEscapeVariables)}=${encodeRouteComponent(
269
+ dynamicInputValues[qs],
270
+ doNotEscapeVariables
271
+ )}`
272
+ );
267
273
  const query = queries.length ? `?${queries.join("&")}` : "";
268
274
  return `/${path}${query}`;
269
275
  }
@@ -295,6 +301,20 @@ __privateAdd(_Route, _parseRouteOrPath);
295
301
  __privateAdd(_Route, _isDynamicRouteSegment);
296
302
  _Route.dynamicSegmentPrefix = ":";
297
303
  var Route = _Route;
304
+ function encodeRouteComponent(value, doNotEscapeVariables) {
305
+ if (!doNotEscapeVariables) {
306
+ return encodeURIComponent(value);
307
+ }
308
+ const result = [];
309
+ parseVariableExpression(value, (token, type) => {
310
+ if (type === "variable") {
311
+ result.push(createVariableReference(token));
312
+ } else {
313
+ result.push(encodeURIComponent(token));
314
+ }
315
+ });
316
+ return result.join("");
317
+ }
298
318
  export {
299
319
  ProjectMapClient,
300
320
  ROOT_NODE_PATH,
package/dist/index.js CHANGED
@@ -221,6 +221,7 @@ var cutReferences = (node) => node ? {
221
221
  } : void 0;
222
222
 
223
223
  // src/util/Route.ts
224
+ var import_canvas = require("@uniformdev/canvas");
224
225
  var _routeInfo, _parseRouteOrPath, parseRouteOrPath_fn, _isDynamicRouteSegment, isDynamicRouteSegment_fn;
225
226
  var _Route = class _Route {
226
227
  constructor(route) {
@@ -272,7 +273,7 @@ var _Route = class _Route {
272
273
  * Creates an expanded path value for this route given dynamic input values and allowed query string values
273
274
  */
274
275
  expand(options) {
275
- const { dynamicInputValues = {}, allowedQueryParams = [] } = options != null ? options : {};
276
+ const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
276
277
  const path = __privateGet(this, _routeInfo).segments.map((segment) => {
277
278
  const dynamicSegmentName = _Route.getDynamicRouteSegmentName(segment);
278
279
  if (!dynamicSegmentName) {
@@ -289,9 +290,14 @@ var _Route = class _Route {
289
290
  );
290
291
  return segment;
291
292
  }
292
- return encodeURIComponent(dynamicSegmentValue);
293
+ return encodeRouteComponent(dynamicSegmentValue, doNotEscapeVariables);
293
294
  }).join("/");
294
- const queries = allowedQueryParams.filter((qs) => typeof dynamicInputValues[qs] === "string").map((qs) => `${encodeURIComponent(qs)}=${encodeURIComponent(dynamicInputValues[qs])}`);
295
+ const queries = allowedQueryParams.filter((qs) => typeof dynamicInputValues[qs] === "string").map(
296
+ (qs) => `${encodeRouteComponent(qs, doNotEscapeVariables)}=${encodeRouteComponent(
297
+ dynamicInputValues[qs],
298
+ doNotEscapeVariables
299
+ )}`
300
+ );
295
301
  const query = queries.length ? `?${queries.join("&")}` : "";
296
302
  return `/${path}${query}`;
297
303
  }
@@ -323,6 +329,20 @@ __privateAdd(_Route, _parseRouteOrPath);
323
329
  __privateAdd(_Route, _isDynamicRouteSegment);
324
330
  _Route.dynamicSegmentPrefix = ":";
325
331
  var Route = _Route;
332
+ function encodeRouteComponent(value, doNotEscapeVariables) {
333
+ if (!doNotEscapeVariables) {
334
+ return encodeURIComponent(value);
335
+ }
336
+ const result = [];
337
+ (0, import_canvas.parseVariableExpression)(value, (token, type) => {
338
+ if (type === "variable") {
339
+ result.push((0, import_canvas.createVariableReference)(token));
340
+ } else {
341
+ result.push(encodeURIComponent(token));
342
+ }
343
+ });
344
+ return result.join("");
345
+ }
326
346
  // Annotate the CommonJS export names for ESM import in node:
327
347
  0 && (module.exports = {
328
348
  ProjectMapClient,
package/dist/index.mjs CHANGED
@@ -193,6 +193,7 @@ var cutReferences = (node) => node ? {
193
193
  } : void 0;
194
194
 
195
195
  // src/util/Route.ts
196
+ import { createVariableReference, parseVariableExpression } from "@uniformdev/canvas";
196
197
  var _routeInfo, _parseRouteOrPath, parseRouteOrPath_fn, _isDynamicRouteSegment, isDynamicRouteSegment_fn;
197
198
  var _Route = class _Route {
198
199
  constructor(route) {
@@ -244,7 +245,7 @@ var _Route = class _Route {
244
245
  * Creates an expanded path value for this route given dynamic input values and allowed query string values
245
246
  */
246
247
  expand(options) {
247
- const { dynamicInputValues = {}, allowedQueryParams = [] } = options != null ? options : {};
248
+ const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
248
249
  const path = __privateGet(this, _routeInfo).segments.map((segment) => {
249
250
  const dynamicSegmentName = _Route.getDynamicRouteSegmentName(segment);
250
251
  if (!dynamicSegmentName) {
@@ -261,9 +262,14 @@ var _Route = class _Route {
261
262
  );
262
263
  return segment;
263
264
  }
264
- return encodeURIComponent(dynamicSegmentValue);
265
+ return encodeRouteComponent(dynamicSegmentValue, doNotEscapeVariables);
265
266
  }).join("/");
266
- const queries = allowedQueryParams.filter((qs) => typeof dynamicInputValues[qs] === "string").map((qs) => `${encodeURIComponent(qs)}=${encodeURIComponent(dynamicInputValues[qs])}`);
267
+ const queries = allowedQueryParams.filter((qs) => typeof dynamicInputValues[qs] === "string").map(
268
+ (qs) => `${encodeRouteComponent(qs, doNotEscapeVariables)}=${encodeRouteComponent(
269
+ dynamicInputValues[qs],
270
+ doNotEscapeVariables
271
+ )}`
272
+ );
267
273
  const query = queries.length ? `?${queries.join("&")}` : "";
268
274
  return `/${path}${query}`;
269
275
  }
@@ -295,6 +301,20 @@ __privateAdd(_Route, _parseRouteOrPath);
295
301
  __privateAdd(_Route, _isDynamicRouteSegment);
296
302
  _Route.dynamicSegmentPrefix = ":";
297
303
  var Route = _Route;
304
+ function encodeRouteComponent(value, doNotEscapeVariables) {
305
+ if (!doNotEscapeVariables) {
306
+ return encodeURIComponent(value);
307
+ }
308
+ const result = [];
309
+ parseVariableExpression(value, (token, type) => {
310
+ if (type === "variable") {
311
+ result.push(createVariableReference(token));
312
+ } else {
313
+ result.push(encodeURIComponent(token));
314
+ }
315
+ });
316
+ return result.join("");
317
+ }
298
318
  export {
299
319
  ProjectMapClient,
300
320
  ROOT_NODE_PATH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/project-map",
3
- "version": "19.35.1",
3
+ "version": "19.35.3-alpha.82+4bc341093",
4
4
  "description": "Uniform Project Map",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,11 +32,11 @@
32
32
  "/dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.35.1",
36
- "@uniformdev/context": "19.35.1"
35
+ "@uniformdev/canvas": "19.35.3-alpha.82+4bc341093",
36
+ "@uniformdev/context": "19.35.3-alpha.82+4bc341093"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "a85462ec75d379c5447dc625135f828e9d4d7dd6"
41
+ "gitHead": "4bc341093bc946900df2646fe53eca4bcddc693c"
42
42
  }