@uniformdev/project-map 17.3.1-alpha.194 → 17.4.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,36 +1,450 @@
1
1
  import { ApiClient } from '@uniformdev/context/api';
2
- import { SitemapNodeUpsertRequest, SitemapNodeUpsertRequestNode, SitemapNodeDeleteRequest, SitemapNodeGetRequest, SitemapNodeGetResponse, SitemapNode, SitemapNodeWithId, SitemapGetRequest, SitemapGetResponse, SitemapUpsertRequest, SitemapDeleteRequest, SitemapDefinition, SitemapDefinitionWithId, SitemapUpsertResponse } from '@uniformdev/sitemap';
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-nodes": {
9
+ /** Called to get a list of nodes belonging to a specific path or Id */
10
+ get: {
11
+ parameters: {
12
+ query: {
13
+ /** The project map id that the desired nodes belong */
14
+ projectMapId: string;
15
+ /** The project id that contains the project map tree that this node belongs to */
16
+ projectId: string;
17
+ /** The id of the node to retrieve, cannot have both this parameter and Path */
18
+ id?: string;
19
+ /** The path of the root node to retrieve, cannot have both this parameter and Id */
20
+ path?: string;
21
+ /** Composition id to find associated sitemap nodes for */
22
+ compositionId?: string;
23
+ /** Limit the number or records returned by a number */
24
+ limit?: number;
25
+ /** Number of records to skip before returning nodes */
26
+ offset?: number;
27
+ /** Depth of the tree to fetch */
28
+ depth?: number;
29
+ /** should the data be returned as a json tree object */
30
+ tree?: boolean;
31
+ /** text search filter */
32
+ search?: string;
33
+ /** include expanded helper computed properties, includes isLeaf, parentPath, pathSegment */
34
+ expanded?: boolean;
35
+ };
36
+ };
37
+ responses: {
38
+ /** OK */
39
+ 200: {
40
+ content: {
41
+ "application/json": {
42
+ nodes?: components$1["schemas"]["ProjectMapNodeDefinition"][];
43
+ tree?: external$1["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"];
44
+ };
45
+ };
46
+ };
47
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
48
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
49
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
50
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
51
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
52
+ };
53
+ };
54
+ /** Called to insert or update a node or nodes */
55
+ put: {
56
+ responses: {
57
+ /** OK */
58
+ 204: never;
59
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
60
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
61
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
62
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
63
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
64
+ };
65
+ requestBody: {
66
+ content: {
67
+ "application/json": {
68
+ /** @description An array of projectMap node objects to be updated or inserted */
69
+ nodes: {
70
+ node: components$1["schemas"]["ProjectMapNodeUpdate"];
71
+ /** @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 */
72
+ previousSibling?: string;
73
+ /** @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 */
74
+ nextSibling?: string;
75
+ }[];
76
+ /**
77
+ * Format: uuid
78
+ * @description The project id of the project that the projectMap belongs to
79
+ */
80
+ projectId: string;
81
+ /**
82
+ * Format: uuid
83
+ * @description The projectMap id that the changing or inserting nodes belong to
84
+ */
85
+ projectMapId: string;
86
+ };
87
+ };
88
+ };
89
+ };
90
+ /** Called to delete a particular projectMap node by id or path */
91
+ delete: {
92
+ responses: {
93
+ /** OK */
94
+ 204: never;
95
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
96
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
97
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
98
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
99
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
100
+ };
101
+ requestBody: {
102
+ content: {
103
+ "application/json": {
104
+ /**
105
+ * Format: uuid
106
+ * @description Id of the projectMap node to delete
107
+ */
108
+ nodeId?: string;
109
+ /** @description Path to the projectMap node to delete */
110
+ path: string;
111
+ /**
112
+ * Format: uuid
113
+ * @description Project map id that the node to delete belongs to
114
+ */
115
+ projectMapId: string;
116
+ /**
117
+ * Format: uuid
118
+ * @description Project id that the project map belongs to
119
+ */
120
+ projectId: string;
121
+ } | {
122
+ /**
123
+ * Format: uuid
124
+ * @description Id of the projectMap node to delete
125
+ */
126
+ nodeId: string;
127
+ /** @description Path to the projectMap node to delete */
128
+ path?: string;
129
+ /**
130
+ * Format: uuid
131
+ * @description Project map id that the node to delete belongs to
132
+ */
133
+ projectMapId: string;
134
+ /**
135
+ * Format: uuid
136
+ * @description Project id that the project map belongs to
137
+ */
138
+ projectId: string;
139
+ };
140
+ };
141
+ };
142
+ };
143
+ };
144
+ }
145
+ interface components$1 {
146
+ schemas: {
147
+ ProjectMapNodeDefinition: {
148
+ /**
149
+ * Format: uuid
150
+ * @description The id of the projectMap entry
151
+ */
152
+ id: string;
153
+ /** @description Dot delimited path representing the path to the current node */
154
+ path: string;
155
+ /** @description Ordering of the node, higher numbers go after lower numbers. */
156
+ order?: number;
157
+ /** @description Data associated with this projectMap node */
158
+ data?: {
159
+ [key: string]: unknown;
160
+ };
161
+ /** @description The name of the projectMap entry */
162
+ name: string;
163
+ /**
164
+ * @description The type of the projectMap entry
165
+ * @enum {string}
166
+ */
167
+ type: "composition" | "redirect" | "placeholder";
168
+ /**
169
+ * Format: uuid
170
+ * @description The composition id related to the projectMap entry
171
+ */
172
+ compositionId?: string;
173
+ /** @description Description of the projectMap node */
174
+ description?: string;
175
+ /** @description Parent path of the current node, only included if requested with the expanded flag */
176
+ parentPath?: string;
177
+ /** @description Last segment of the url, only included if requested with the expanded flag */
178
+ pathSegment?: string;
179
+ /** @description returns true if the node is a leaf node, meaning having no children, only included if requested with the expanded flag */
180
+ isLeaf?: boolean;
181
+ };
182
+ ProjectMapNodeUpdate: {
183
+ /**
184
+ * Format: uuid
185
+ * @description The id of the projectMap entry
186
+ */
187
+ id?: string;
188
+ /** @description Dot delimited path representing the path to the current node */
189
+ path: string;
190
+ /** @description Ordering of the node, higher numbers go after lower numbers. */
191
+ order?: number;
192
+ /** @description Data associated with this projectMap node */
193
+ data?: {
194
+ [key: string]: unknown;
195
+ };
196
+ /** @description The name of the projectMap entry */
197
+ name: string;
198
+ /**
199
+ * @description The type of the projectMap entry
200
+ * @enum {string}
201
+ */
202
+ type: "composition" | "redirect" | "placeholder";
203
+ /**
204
+ * Format: uuid
205
+ * @description The composition id related to the projectMap entry
206
+ */
207
+ compositionId?: string;
208
+ /** @description Description of the projectMap node */
209
+ description?: string;
210
+ };
211
+ };
212
+ }
213
+ interface external$1 {
214
+ "swagger.yml": {
215
+ paths: {};
216
+ components: {
217
+ schemas: {
218
+ Error: {
219
+ /** @description Error message(s) that occurred while processing the request */
220
+ errorMessage?: string[] | string;
221
+ };
222
+ };
223
+ responses: {
224
+ /** Request input validation failed */
225
+ BadRequestError: {
226
+ content: {
227
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
228
+ };
229
+ };
230
+ /** API key or token was not valid */
231
+ UnauthorizedError: {
232
+ content: {
233
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
234
+ };
235
+ };
236
+ /** Permission was denied */
237
+ ForbiddenError: {
238
+ content: {
239
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
240
+ };
241
+ };
242
+ /** Resource not found */
243
+ NotFoundError: {
244
+ content: {
245
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
246
+ };
247
+ };
248
+ /** Too many requests in allowed time period */
249
+ RateLimitError: unknown;
250
+ /** Execution error occurred */
251
+ InternalServerError: unknown;
252
+ };
253
+ };
254
+ operations: {};
255
+ };
256
+ "v1-project-map-tree.swagger.yml": {
257
+ paths: {};
258
+ components: {
259
+ schemas: {
260
+ ProjectMapTreeNodeDefinition: components$1["schemas"]["ProjectMapNodeDefinition"] & {
261
+ /** @description Children of the node */
262
+ children?: external$1["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"][];
263
+ } & {
264
+ name: unknown;
265
+ };
266
+ };
267
+ };
268
+ operations: {};
269
+ };
270
+ }
271
+
272
+ /**
273
+ * This file was auto-generated by openapi-typescript.
274
+ * Do not make direct changes to the file.
275
+ */
276
+ interface paths {
277
+ "/api/v1/project-map": {
278
+ /** Called to retrieve a list of project maps related to a project or a specific project map by id */
279
+ get: {
280
+ parameters: {
281
+ query: {
282
+ /** The project to fetch project map for */
283
+ projectId: string;
284
+ /** The id of the project map to fetch */
285
+ projectMapId?: string;
286
+ };
287
+ };
288
+ responses: {
289
+ /** OK */
290
+ 200: {
291
+ content: {
292
+ "application/json": {
293
+ projectMaps: components["schemas"]["ProjectMapDefinition"][];
294
+ };
295
+ };
296
+ };
297
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
298
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
299
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
300
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
301
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
302
+ };
303
+ };
304
+ put: {
305
+ responses: {
306
+ /** OK */
307
+ 200: {
308
+ content: {
309
+ "application/json": {
310
+ /**
311
+ * Format: uuid
312
+ * @description Id of the projectMap
313
+ */
314
+ projectMapId: string;
315
+ };
316
+ };
317
+ };
318
+ /** OK */
319
+ 204: never;
320
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
321
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
322
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
323
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
324
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
325
+ };
326
+ requestBody: {
327
+ content: {
328
+ "application/json": {
329
+ /** @description Project map object to insert */
330
+ projectMap: components["schemas"]["ProjectMapDefinition"];
331
+ /**
332
+ * Format: uuid
333
+ * @description Project id to insert the projectMap into
334
+ */
335
+ projectId: string;
336
+ };
337
+ };
338
+ };
339
+ };
340
+ /** Called to delete a projectMap */
341
+ delete: {
342
+ responses: {
343
+ /** OK */
344
+ 204: never;
345
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
346
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
347
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
348
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
349
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
350
+ };
351
+ requestBody: {
352
+ content: {
353
+ "application/json": {
354
+ /**
355
+ * Format: uuid
356
+ * @description Id of the project that this projectMap belongs to
357
+ */
358
+ projectId: string;
359
+ /**
360
+ * Format: uuid
361
+ * @description Id of the projectMap to delete
362
+ */
363
+ projectMapId: string;
364
+ };
365
+ };
366
+ };
367
+ };
368
+ };
369
+ }
370
+ interface components {
371
+ schemas: {
372
+ ProjectMapDefinition: {
373
+ /** @description The id of the projectMap node */
374
+ id?: string;
375
+ /** @description The name of the projectMap node */
376
+ name: string;
377
+ /** @description Description of the projectMap node */
378
+ description?: string;
379
+ /** @description The prefix of the url generated by this projectMap */
380
+ baseUrl?: string;
381
+ default?: boolean;
382
+ };
383
+ };
384
+ }
385
+ interface external {
386
+ "swagger.yml": {
387
+ paths: {};
388
+ components: {
389
+ schemas: {
390
+ Error: {
391
+ /** @description Error message(s) that occurred while processing the request */
392
+ errorMessage?: string[] | string;
393
+ };
394
+ };
395
+ responses: {
396
+ /** Request input validation failed */
397
+ BadRequestError: {
398
+ content: {
399
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
400
+ };
401
+ };
402
+ /** API key or token was not valid */
403
+ UnauthorizedError: {
404
+ content: {
405
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
406
+ };
407
+ };
408
+ /** Permission was denied */
409
+ ForbiddenError: {
410
+ content: {
411
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
412
+ };
413
+ };
414
+ /** Resource not found */
415
+ NotFoundError: {
416
+ content: {
417
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
418
+ };
419
+ };
420
+ /** Too many requests in allowed time period */
421
+ RateLimitError: unknown;
422
+ /** Execution error occurred */
423
+ InternalServerError: unknown;
424
+ };
425
+ };
426
+ operations: {};
427
+ };
428
+ }
3
429
 
4
430
  declare type ProjectMapNodeWithProjectMapReference = ProjectMapNodeWithId & {
5
431
  projectMapId: string;
6
432
  };
7
433
 
8
- declare type ProjectMapNodeUpsertRequest = Omit<SitemapNodeUpsertRequest, 'sitemapId'> & {
9
- projectMapId: string;
10
- };
11
- declare type ProjectMapNodeUpsertRequestNode = SitemapNodeUpsertRequestNode;
12
- declare type ProjectMapNodeDeleteRequest = Omit<SitemapNodeDeleteRequest, 'sitemapId'> & {
13
- projectMapId: string;
14
- };
15
- declare type ProjectMapNodeGetRequest = Omit<SitemapNodeGetRequest, 'sitemapId'> & {
16
- projectMapId: string;
17
- };
18
- declare type ProjectMapNodeGetResponse = SitemapNodeGetResponse;
19
- declare type ProjectMapNode = SitemapNode;
20
- declare type ProjectMapNodeWithId = SitemapNodeWithId;
21
- declare type ProjectMapGetRequest = Omit<SitemapGetRequest, 'sitemapId'> & {
22
- projectMapId: string;
23
- };
24
- declare type ProjectMapGetResponse = SitemapGetResponse;
25
- declare type ProjectMapUpsertRequest = Omit<SitemapUpsertRequest, 'sitemap'> & {
26
- projectMap: SitemapUpsertRequest['sitemap'];
27
- };
28
- declare type ProjectMapDeleteRequest = Omit<SitemapDeleteRequest, 'sitemapId'> & {
29
- projectMapId: string;
30
- };
31
- declare type ProjectMapDefinition = SitemapDefinition;
32
- declare type ProjectMapDefinitionWithId = SitemapDefinitionWithId;
33
- declare type ProjectMapUpsertResponse = SitemapUpsertResponse;
434
+ declare type ProjectMapNodeUpsertRequest = paths$1['/api/v1/project-map-nodes']['put']['requestBody']['content']['application/json'];
435
+ declare type ProjectMapNodeUpsertRequestNode = ProjectMapNodeUpsertRequest['nodes'][0]['node'];
436
+ declare type ProjectMapNodeDeleteRequest = paths$1['/api/v1/project-map-nodes']['delete']['requestBody']['content']['application/json'];
437
+ declare type ProjectMapNodeGetRequest = paths$1['/api/v1/project-map-nodes']['get']['parameters']['query'];
438
+ declare type ProjectMapNodeGetResponse = paths$1['/api/v1/project-map-nodes']['get']['responses']['200']['content']['application/json'];
439
+ declare type ProjectMapNode = NonNullable<ProjectMapNodeGetResponse['nodes']>[0];
440
+ declare type ProjectMapNodeWithId = ProjectMapNode & Required<Pick<ProjectMapNode, 'id' | 'name'>>;
441
+ declare type ProjectMapGetRequest = paths['/api/v1/project-map']['get']['parameters']['query'];
442
+ declare type ProjectMapGetResponse = paths['/api/v1/project-map']['get']['responses']['200']['content']['application/json'];
443
+ declare type ProjectMapUpsertRequest = paths['/api/v1/project-map']['put']['requestBody']['content']['application/json'];
444
+ declare type ProjectMapDeleteRequest = paths['/api/v1/project-map']['delete']['requestBody']['content']['application/json'];
445
+ declare type ProjectMapDefinition = ProjectMapGetResponse['projectMaps'][0];
446
+ declare type ProjectMapDefinitionWithId = ProjectMapDefinition & Required<Pick<ProjectMapDefinition, 'id'>>;
447
+ declare type ProjectMapUpsertResponse = paths['/api/v1/project-map']['put']['responses']['200']['content']['application/json'];
34
448
  declare type NodeType = 'placeholder' | 'composition' | 'redirect';
35
449
  declare type ProjectMapDefinitions = {
36
450
  projectMaps: ProjectMapDefinitionWithId[];
@@ -58,8 +472,8 @@ declare type ProjectMapSubtree = ProjectMapNode & {
58
472
  };
59
473
  declare class ProjectMapClient extends ApiClient<ProjectMapClientOptions> {
60
474
  constructor(options: ProjectMapClientOptions);
61
- fetchProjectMapDefinitions: (projectId: string) => Promise<{
62
- sitemaps: {
475
+ getProjectMapDefinitions: (projectId: string) => Promise<{
476
+ projectMaps: {
63
477
  id?: string | undefined;
64
478
  name: string;
65
479
  description?: string | undefined;
@@ -67,8 +481,8 @@ declare class ProjectMapClient extends ApiClient<ProjectMapClientOptions> {
67
481
  default?: boolean | undefined;
68
482
  }[];
69
483
  }>;
70
- fetchProjectMapDefinition: (options: ProjectMapGetRequest) => Promise<{
71
- sitemaps: {
484
+ getProjectMapDefinition: (options: ProjectMapGetRequest) => Promise<{
485
+ projectMaps: {
72
486
  id?: string | undefined;
73
487
  name: string;
74
488
  description?: string | undefined;
@@ -80,8 +494,8 @@ declare class ProjectMapClient extends ApiClient<ProjectMapClientOptions> {
80
494
  deleteProjectMap: (options: ProjectMapDeleteRequest) => Promise<void>;
81
495
  upsertProjectMapNodes: (options: ProjectMapNodeUpsertRequest) => Promise<void>;
82
496
  deleteProjectMapNode: (options: ProjectMapNodeDeleteRequest) => Promise<void>;
83
- fetchSubtree: (options: ProjectMapNodeGetRequest) => Promise<ProjectMapSubtree | undefined>;
84
- fetchNodes: (options: ProjectMapNodeGetRequest) => Promise<ProjectMapNodeGetResponse>;
497
+ getSubtree: (options: ProjectMapNodeGetRequest) => Promise<ProjectMapSubtree | undefined>;
498
+ getNodes: (options: ProjectMapNodeGetRequest) => Promise<ProjectMapNodeGetResponse>;
85
499
  private cleanProjectMapNode;
86
500
  private validatePath;
87
501
  }
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- import{g as o,h as r,i as e}from"./chunk-QOYLUYYN.mjs";export{r as ProjectMapClient,o as ROOT_NODE_PATH,e as UncachedProjectMapClient};
1
+ import{g as o,h as r,i as e}from"./chunk-4VJBTGFT.mjs";export{r as ProjectMapClient,o as ROOT_NODE_PATH,e as UncachedProjectMapClient};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var R=(a,i)=>{for(var e in i)u(a,e,{get:i[e],enumerable:!0})},y=(a,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of m(i))!N.call(a,r)&&r!==e&&u(a,r,{get:()=>i[r],enumerable:!(t=l(i,r))||t.enumerable});return a};var U=a=>y(u({},"__esModule",{value:!0}),a);var g={};R(g,{ProjectMapClient:()=>n,ROOT_NODE_PATH:()=>b,UncachedProjectMapClient:()=>j});module.exports=U(g);var P=require("@uniformdev/context/api"),b="/",n=class extends P.ApiClient{constructor(e){super(e);this.fetchProjectMapDefinitions=async e=>{let t=this.createUrl("/api/v1/sitemap",{projectId:e});return await this.apiClient(t)};this.fetchProjectMapDefinition=async e=>{let t=this.createUrl("/api/v1/sitemap",{...e,sitemapId:e.projectMapId});return await this.apiClient(t)};this.upsertProjectMap=async e=>{let t=this.createUrl("/api/v1/sitemap");return(await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,sitemap:e.projectMap,projectMap:void 0})})).sitemapId};this.deleteProjectMap=async e=>{let t=this.createUrl("/api/v1/sitemap");await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,sitemapId:e.projectMapId,projectMapId:void 0}),expectNoContent:!0})};this.upsertProjectMapNodes=async e=>{let t=this.createUrl("/api/v1/sitemap-nodes");await this.apiClient(t,{method:"PUT",body:JSON.stringify({projectId:e.projectId,sitemapId:e.projectMapId,nodes:e.nodes.map(r=>({...r,node:{...this.cleanProjectMapNode(r.node)}}))}),expectNoContent:!0})};this.deleteProjectMapNode=async e=>{let t=this.createUrl("/api/v1/sitemap-nodes");(!e.path||this.validatePath(e.path))&&await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,sitemapId:e.projectMapId}),expectNoContent:!0})};this.fetchSubtree=async e=>{var M;let t={};t.projectId=e.projectId,e.projectMapId&&(t.sitemapId=e.projectMapId),e.path&&this.validatePath(e.path)&&(t.path=e.path),e.depth&&(t.depth=e.depth.toString()),t.tree="true";let r=this.createUrl("/api/v1/sitemap-nodes",t),f={...(await this.apiClient(r)).tree},s=[f];for(;s&&s.length>0;){let c=s.pop(),o;(M=c==null?void 0:c.children)==null||M.forEach(p=>{p.parent=h(c),p.previousSibling=h(o),o&&(o.nextSibling=h(p)),o=p,s.push(p)})}return f};this.fetchNodes=async e=>{let t={};t.projectId=e.projectId,e.projectMapId&&(t.sitemapId=e.projectMapId),e.path&&this.validatePath(e.path)&&(t.path=e.path),e.id&&(t.id=e.id),e.limit&&(t.limit=e.limit.toString()),e.offset&&(t.offset=e.offset.toString());let r=this.createUrl("/api/v1/sitemap-nodes",t);return await this.apiClient(r)}}cleanProjectMapNode(e){var t,r,d;return{id:((d=(r=(t=e.id)==null?void 0:t.match(/^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i))==null?void 0:r.length)!=null?d:0)==1?e.id:void 0,path:e.path,name:e.name,type:e.type,compositionId:e.compositionId,description:e.description}}validatePath(e){let t=/[*%!&@]/g;if(e==null?void 0:e.match(t))throw"path cannot contain reserved characters * % ! & @";return!0}},j=class extends n{constructor(i){super({...i,bypassCache:!0})}},h=a=>a?{...a,parent:void 0,children:void 0}:void 0;0&&(module.exports={ProjectMapClient,ROOT_NODE_PATH,UncachedProjectMapClient});
1
+ "use strict";var j=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var I=(a,p)=>{for(var e in p)j(a,e,{get:p[e],enumerable:!0})},R=(a,p,e,t)=>{if(p&&typeof p=="object"||typeof p=="function")for(let r of m(p))!N.call(a,r)&&r!==e&&j(a,r,{get:()=>p[r],enumerable:!(t=l(p,r))||t.enumerable});return a};var g=a=>R(j({},"__esModule",{value:!0}),a);var U={};I(U,{ProjectMapClient:()=>n,ROOT_NODE_PATH:()=>y,UncachedProjectMapClient:()=>h});module.exports=g(U);var P=require("@uniformdev/context/api"),y="/",n=class extends P.ApiClient{constructor(e){super(e);this.getProjectMapDefinitions=async e=>{let t=this.createUrl("/api/v1/project-map",{projectId:e});return await this.apiClient(t)};this.getProjectMapDefinition=async e=>{let t=this.createUrl("/api/v1/project-map",{...e,projectMapId:e.projectMapId});return await this.apiClient(t)};this.upsertProjectMap=async e=>{let t=this.createUrl("/api/v1/project-map");return(await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectMap:e.projectMap})})).projectMapId};this.deleteProjectMap=async e=>{let t=this.createUrl("/api/v1/project-map");await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectMapId:e.projectMapId}),expectNoContent:!0})};this.upsertProjectMapNodes=async e=>{let t=this.createUrl("/api/v1/project-map-nodes");await this.apiClient(t,{method:"PUT",body:JSON.stringify({projectId:e.projectId,projectMapId:e.projectMapId,nodes:e.nodes.map(r=>({...r,node:{...this.cleanProjectMapNode(r.node)}}))}),expectNoContent:!0})};this.deleteProjectMapNode=async e=>{let t=this.createUrl("/api/v1/project-map-nodes");(!e.path||this.validatePath(e.path))&&await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectMapId:e.projectMapId}),expectNoContent:!0})};this.getSubtree=async e=>{var f;let t={};t.projectId=e.projectId,e.projectMapId?t.projectMapId=e.projectMapId:e.path&&this.validatePath(e.path)?t.path=e.path:e.compositionId&&(t.compositionId=e.compositionId),e.depth&&(t.depth=e.depth.toString()),e.expanded&&(t.expanded="true"),t.tree="true";let r=this.createUrl("/api/v1/project-map-nodes",t),M={...(await this.apiClient(r)).tree},o=[M];for(;o&&o.length>0;){let i=o.pop(),s;(f=i==null?void 0:i.children)==null||f.forEach(c=>{c.parent=u(i),c.previousSibling=u(s),s&&(s.nextSibling=u(c)),s=c,o.push(c)})}return M};this.getNodes=async e=>{let t={};t.projectId=e.projectId,e.projectMapId&&(t.projectMapId=e.projectMapId),e.id?t.id=e.id:e.path&&this.validatePath(e.path)?t.path=e.path:e.compositionId&&(t.compositionId=e.compositionId),e.limit&&(t.limit=e.limit.toString()),e.offset&&(t.offset=e.offset.toString()),e.expanded&&(t.expanded="true");let r=this.createUrl("/api/v1/project-map-nodes",t);return await this.apiClient(r)}}cleanProjectMapNode(e){var t,r,d;return{id:((d=(r=(t=e.id)==null?void 0:t.match(/^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i))==null?void 0:r.length)!=null?d:0)==1?e.id:void 0,path:e.path,name:e.name,type:e.type,compositionId:e.compositionId,description:e.description}}validatePath(e){let t=/[*%!&@]/g;if(e==null?void 0:e.match(t))throw"Path cannot contain reserved characters * % ! & @";return!0}},h=class extends n{constructor(p){super({...p,bypassCache:!0})}},u=a=>a?{...a,parent:void 0,children:void 0}:void 0;0&&(module.exports={ProjectMapClient,ROOT_NODE_PATH,UncachedProjectMapClient});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{g as o,h as r,i as e}from"./chunk-QOYLUYYN.mjs";export{r as ProjectMapClient,o as ROOT_NODE_PATH,e as UncachedProjectMapClient};
1
+ import{g as o,h as r,i as e}from"./chunk-4VJBTGFT.mjs";export{r as ProjectMapClient,o as ROOT_NODE_PATH,e as UncachedProjectMapClient};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uniformdev/project-map",
3
- "version": "17.3.1-alpha.194+213d546fd",
4
- "description": "Uniform Sitemap",
3
+ "version": "17.4.1-alpha.0+59ecbc3",
4
+ "description": "Uniform Project Map",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.esm.js",
@@ -32,31 +32,31 @@
32
32
  },
33
33
  "sideEffects": false,
34
34
  "scripts": {
35
- "build": "run-s build:ts",
35
+ "build": "run-s update-openapi build:ts",
36
36
  "build:ts": "tsup --minify",
37
- "dev": "run-s dev:ts",
37
+ "dev": "run-s update-openapi dev:ts",
38
38
  "dev:ts": "tsup --watch",
39
39
  "clean": "rimraf dist",
40
40
  "test": "jest --maxWorkers=1 --passWithNoTests",
41
41
  "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
42
- "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
42
+ "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
43
+ "update-openapi": "tsx ./scripts/update-openapi.cts"
43
44
  },
44
45
  "files": [
45
46
  "/dist"
46
47
  ],
47
48
  "dependencies": {
48
- "@uniformdev/canvas": "^17.3.1-alpha.194+213d546fd",
49
- "@uniformdev/context": "^17.3.1-alpha.194+213d546fd",
50
- "@uniformdev/sitemap": "^17.3.1-alpha.194+213d546fd",
49
+ "@uniformdev/canvas": "^17.4.1-alpha.0+59ecbc3",
50
+ "@uniformdev/context": "^17.4.1-alpha.0+59ecbc3",
51
51
  "p-limit": "^3.1.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/yargs": "17.0.13",
55
- "@uniformdev/cli": "^17.3.1-alpha.194+213d546fd",
56
- "yargs": "17.6.0"
55
+ "@uniformdev/cli": "^17.4.1-alpha.0+59ecbc3",
56
+ "yargs": "17.6.2"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "213d546fdfd0eb7482a220be62a91093b6925eb3"
61
+ "gitHead": "59ecbc39bc240b9e2e5312a7cc0a5bb565508612"
62
62
  }
@@ -1 +0,0 @@
1
- var l=Object.create;var n=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var b=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(a,e)=>(typeof require!="undefined"?require:a)[e]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var g=(r,a)=>()=>(r&&(a=r(r=0)),a);var I=(r,a)=>()=>(a||r((a={exports:{}}).exports,a),a.exports),S=(r,a)=>{for(var e in a)n(r,e,{get:a[e],enumerable:!0})},M=(r,a,e,t)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of N(a))!y.call(r,i)&&i!==e&&n(r,i,{get:()=>a[i],enumerable:!(t=m(a,i))||t.enumerable});return r};var C=(r,a,e)=>(e=r!=null?l(R(r)):{},M(a||!r||!r.__esModule?n(e,"default",{value:r,enumerable:!0}):e,r)),v=r=>M(n({},"__esModule",{value:!0}),r);import{ApiClient as U}from"@uniformdev/context/api";var x="/",h=class extends U{constructor(e){super(e);this.fetchProjectMapDefinitions=async e=>{let t=this.createUrl("/api/v1/sitemap",{projectId:e});return await this.apiClient(t)};this.fetchProjectMapDefinition=async e=>{let t=this.createUrl("/api/v1/sitemap",{...e,sitemapId:e.projectMapId});return await this.apiClient(t)};this.upsertProjectMap=async e=>{let t=this.createUrl("/api/v1/sitemap");return(await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,sitemap:e.projectMap,projectMap:void 0})})).sitemapId};this.deleteProjectMap=async e=>{let t=this.createUrl("/api/v1/sitemap");await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,sitemapId:e.projectMapId,projectMapId:void 0}),expectNoContent:!0})};this.upsertProjectMapNodes=async e=>{let t=this.createUrl("/api/v1/sitemap-nodes");await this.apiClient(t,{method:"PUT",body:JSON.stringify({projectId:e.projectId,sitemapId:e.projectMapId,nodes:e.nodes.map(i=>({...i,node:{...this.cleanProjectMapNode(i.node)}}))}),expectNoContent:!0})};this.deleteProjectMapNode=async e=>{let t=this.createUrl("/api/v1/sitemap-nodes");(!e.path||this.validatePath(e.path))&&await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,sitemapId:e.projectMapId}),expectNoContent:!0})};this.fetchSubtree=async e=>{var f;let t={};t.projectId=e.projectId,e.projectMapId&&(t.sitemapId=e.projectMapId),e.path&&this.validatePath(e.path)&&(t.path=e.path),e.depth&&(t.depth=e.depth.toString()),t.tree="true";let i=this.createUrl("/api/v1/sitemap-nodes",t),j={...(await this.apiClient(i)).tree},s=[j];for(;s&&s.length>0;){let c=s.pop(),o;(f=c==null?void 0:c.children)==null||f.forEach(p=>{p.parent=u(c),p.previousSibling=u(o),o&&(o.nextSibling=u(p)),o=p,s.push(p)})}return j};this.fetchNodes=async e=>{let t={};t.projectId=e.projectId,e.projectMapId&&(t.sitemapId=e.projectMapId),e.path&&this.validatePath(e.path)&&(t.path=e.path),e.id&&(t.id=e.id),e.limit&&(t.limit=e.limit.toString()),e.offset&&(t.offset=e.offset.toString());let i=this.createUrl("/api/v1/sitemap-nodes",t);return await this.apiClient(i)}}cleanProjectMapNode(e){var t,i,d;return{id:((d=(i=(t=e.id)==null?void 0:t.match(/^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i))==null?void 0:i.length)!=null?d:0)==1?e.id:void 0,path:e.path,name:e.name,type:e.type,compositionId:e.compositionId,description:e.description}}validatePath(e){let t=/[*%!&@]/g;if(e==null?void 0:e.match(t))throw"path cannot contain reserved characters * % ! & @";return!0}},P=class extends h{constructor(a){super({...a,bypassCache:!0})}},u=r=>r?{...r,parent:void 0,children:void 0}:void 0;export{b as a,g as b,I as c,S as d,C as e,v as f,x as g,h,P as i};